void PRP1PRP2_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ // Lookup objs which were created in a prior test within group string work; uint64_t i; SharedASQPtr asq = CAST_TO_ASQ(gRsrcMngr->GetObj(ASQ_GROUP_ID)) SharedACQPtr acq = CAST_TO_ACQ(gRsrcMngr->GetObj(ACQ_GROUP_ID)) LOG_NRM("Create get log page cmd and assoc some buffer memory"); SharedGetLogPagePtr getLogPgCmd = SharedGetLogPagePtr(new GetLogPage()); LOG_NRM("Get log page to request firmware slot information"); getLogPgCmd->SetNUMD(PRP1_ONLY_NUMD - 1); // 0-based getLogPgCmd->SetLID(FIRM_SLOT_INFO_LID); getLogPgCmd->SetNSID(0xFFFFFFFF); LOG_NRM("Set the offset into the buffer at 0x%04X", BUFFER_OFFSET); SharedMemBufferPtr getLogPageMem = SharedMemBufferPtr(new MemBuffer()); getLogPageMem->InitOffset1stPage(GetLogPage::FIRMSLOT_DATA_SIZE, BUFFER_OFFSET, true); send_64b_bitmask prpReq = (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE); getLogPgCmd->SetPrpBuffer(prpReq, getLogPageMem); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, getLogPgCmd, "prp1prp2", true); }
void UnsupportRsvdFields_r10b::VerifyDataPat(SharedReadPtr readCmd, SharedWritePtr writeCmd) { LOG_NRM("Compare read vs written data to verify"); SharedMemBufferPtr rdPayload = readCmd->GetRWPrpBuffer(); SharedMemBufferPtr wrPayload = writeCmd->GetRWPrpBuffer(); if (rdPayload->Compare(wrPayload) == false) { readCmd->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "ReadCmd"), "Read command"); writeCmd->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "WriteCmd"), "Write command"); throw FrmwkEx(HERE, "Data miscompare"); } // If meta data is allocated then compare meta data. if (writeCmd->GetMetaBuffer() != NULL) { const uint8_t *metaRdBuff = readCmd->GetMetaBuffer(); const uint8_t *metaWrBuff = writeCmd->GetMetaBuffer(); if (memcmp(metaRdBuff, metaWrBuff, writeCmd->GetMetaBufferSize())) { readCmd->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "ReadCmdMeta"), "Read command with meta data"); writeCmd->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "WriteCmdMeta"), "Write command with meta data"); throw FrmwkEx(HERE, "Meta data miscompare"); } } }
void UnsupportRrvdFields_r10b::ReadLogPage(SharedACQPtr &acq, SharedASQPtr &asq, uint8_t logId) { string work; LOG_NRM("Reading log page with LID = %d to clear the event mask", logId); ConstSharedIdentifyPtr idCtrlrStruct = gInformative->GetIdentifyCmdCtrlr(); uint8_t X = idCtrlrStruct->GetValue(IDCTRLRCAP_ELPE) + 1; LOG_NRM("Identify controller ELPE = %d (1-based)", X); LOG_NRM("Create get log page cmd and assoc some buffer memory"); SharedGetLogPagePtr getLogPgCmd = SharedGetLogPagePtr(new GetLogPage()); LOG_NRM("Create memory buffer for log page to request error information"); SharedMemBufferPtr getLogPageMem = SharedMemBufferPtr(new MemBuffer()); send_64b_bitmask prpReq = (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE); LOG_NRM("Get log page to request error information logId = %d", logId); getLogPgCmd->SetLID(logId); getLogPageMem->Init(GetLogPage::ERRINFO_DATA_SIZE * X, true); getLogPgCmd->SetPrpBuffer(prpReq, getLogPageMem); getLogPgCmd->SetNUMD((GetLogPage::ERRINFO_DATA_SIZE * X / 4) - 1); //0-based work = str(boost::format("ErrorLog%d") % (uint32_t)logId); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, getLogPgCmd, work, true); }
void FunctionalityMeta_r10b::VerifyDataPat(SharedReadPtr readCmd, SharedWritePtr writeCmd, uint64_t metaBuffSz) { LOG_NRM("Compare read vs written data to verify"); SharedMemBufferPtr rdPayload = readCmd->GetRWPrpBuffer(); SharedMemBufferPtr wrPayload = writeCmd->GetRWPrpBuffer(); if (rdPayload->Compare(wrPayload) == false) { readCmd->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "ReadCmd"), "Read command"); rdPayload->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "ReadPayload"), "Data read from media miscompared from written"); wrPayload->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "WrittenPayload"), "Data read from media miscompared from written"); throw FrmwkEx(HERE, "Data miscompare"); } // If meta data is allocated then compare meta data. if (writeCmd->GetMetaBuffer() != NULL) { const uint8_t *metaRdBuff = readCmd->GetMetaBuffer(); const uint8_t *metaWrBuff = writeCmd->GetMetaBuffer(); if (memcmp(metaRdBuff, metaWrBuff, metaBuffSz)) { readCmd->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "ReadCmdMeta"), "Read command with meta data"); writeCmd->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "WriteCmdMeta"), "Write command with meta data"); throw FrmwkEx(HERE, "Meta data miscompare, Meta Sz %d", metaBuffSz); } } }
void MandatorySMART_r10b::IssueGetLogPgCmdLessDwords(SharedASQPtr asq, SharedACQPtr acq, SharedGetLogPagePtr getLogPgCmd, SharedMemBufferPtr getLogPageMem) { string work; send_64b_bitmask prpReq = (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE); for (uint32_t numd = 1; numd <= SMART_HEALTH_NUMD; numd++) { LOG_NRM("Issue get log page for smart info with NUMD = %d", numd); getLogPageMem->Init(GetLogPage::SMART_DATA_SIZE, true); getLogPgCmd->SetPrpBuffer(prpReq, getLogPageMem); getLogPgCmd->SetNUMD(numd - 1); // 0-based work = str(boost::format("Smart.NSID.%Xh.NUMD.%d") % getLogPgCmd->GetNSID() % numd); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, getLogPgCmd, work, true); LOG_NRM("Verify the buffer's non-retrieved = 0x00"); SharedMemBufferPtr cmdPayload = getLogPgCmd->GetRWPrpBuffer(); uint32_t offset = (numd * 4); uint8_t *cmdPayloadBuff = (uint8_t *)cmdPayload->GetBuffer() + offset; for (; offset < GetLogPage::SMART_DATA_SIZE; offset++) { LOG_NRM("Verify data at offset = 0x%X", offset); if (*cmdPayloadBuff != 0x0) { throw FrmwkEx(HERE, "Invalid data at buffer offset = 0x%08X, " "value = 0x%08X", cmdPayloadBuff, *cmdPayloadBuff); } cmdPayloadBuff++; } } }
void AdminQFull_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) none * \endverbatim */ LOG_NRM("Create identify cmd and assoc some buffer memory"); SharedIdentifyPtr idCmdCtrlr = SharedIdentifyPtr(new Identify()); LOG_NRM("Force identify to request ctrlr capabilities struct"); idCmdCtrlr->SetCNS(true); SharedMemBufferPtr idMemCap = SharedMemBufferPtr(new MemBuffer()); idMemCap->InitAlignment(Identify::IDEAL_DATA_SIZE, sizeof(uint64_t), false, 0); send_64b_bitmask prpReq = (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE); idCmdCtrlr->SetPrpBuffer(prpReq, idMemCap); // Case 1 - ASQ = ACQ (min, middle and max) AdminQFull(2, 2, idCmdCtrlr); AdminQFull((MAX_ADMIN_Q_SIZE/2), (MAX_ADMIN_Q_SIZE/2), idCmdCtrlr); AdminQFull(MAX_ADMIN_Q_SIZE, MAX_ADMIN_Q_SIZE, idCmdCtrlr); // Case 2 - ASQ = ACQ + 1 (min , middle and max) AdminQFull(3, 2, idCmdCtrlr); AdminQFull((MAX_ADMIN_Q_SIZE/2), ((MAX_ADMIN_Q_SIZE/2) - 1), idCmdCtrlr); AdminQFull(MAX_ADMIN_Q_SIZE, (MAX_ADMIN_Q_SIZE - 1), idCmdCtrlr); }
void CIDAcceptedASQ_r10b::ReapVerifyCID(SharedASQPtr asq, SharedACQPtr acq, uint16_t currCID) { uint32_t isrCount; uint32_t ceRemain; uint32_t numReaped; uint32_t numCE; if (acq->ReapInquiryWaitSpecify(CALC_TIMEOUT_ms(1), 1, numCE, isrCount) == false) { acq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "acq.fail"), "Dump Entire ACQ"); throw FrmwkEx(HERE, "Unable to see CEs for issued cmd"); } SharedMemBufferPtr ceMem = SharedMemBufferPtr(new MemBuffer()); if ((numReaped = acq->Reap(ceRemain, ceMem, isrCount, numCE, true)) != 1) { acq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "acq.fail"), "Dump Entire ACQ"); throw FrmwkEx(HERE, "Unable to reap on ACQ"); } union CE *ce = (union CE *)ceMem->GetBuffer(); ProcessCE::Validate(*ce); // throws upon error if (ce->n.CID != currCID) { asq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "asq.fail"), "Dump Entire ASQ"); acq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "acq.fail"), "Dump Entire ACQ"); throw FrmwkEx(HERE, "Received CID %d but expected %d", ce->n.CID, currCID); } }
void PRP1PRP2_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ LOG_NRM("Lookup objs which were created in a prior test within group"); SharedASQPtr asq = CAST_TO_ASQ(gRsrcMngr->GetObj(ASQ_GROUP_ID)) SharedACQPtr acq = CAST_TO_ACQ(gRsrcMngr->GetObj(ACQ_GROUP_ID)) LOG_NRM("Determine if DUT has atleast one namespace support"); ConstSharedIdentifyPtr idCmdCtrlr = gInformative->GetIdentifyCmdCtrlr(); if ((idCmdCtrlr->GetValue(IDCTRLRCAP_NN)) == 0) throw FrmwkEx(HERE, "Required to support >= 1 namespace"); LOG_NRM("Form identify namespace cmd and associate some buffer"); SharedIdentifyPtr idCmdNamSpc = SharedIdentifyPtr(new Identify()); idCmdNamSpc->SetCNS(false); idCmdNamSpc->SetNSID(1); SharedMemBufferPtr idMemNamSpc = SharedMemBufferPtr(new MemBuffer()); idMemNamSpc->InitOffset1stPage(Identify::IDEAL_DATA_SIZE, PRP_BUFFER_OFFSET, true); LOG_NRM("Allow PRP1 and PRP2"); send_64b_bitmask idPrpNamSpc = (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE); idCmdNamSpc->SetPrpBuffer(idPrpNamSpc, idMemNamSpc); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, idCmdNamSpc, "prp1Prp2", true); }
void InvalidLogPageNVMSet_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ string work; // Lookup objs which were created in a prior test within group SharedASQPtr asq = CAST_TO_ASQ(gRsrcMngr->GetObj(ASQ_GROUP_ID)) SharedACQPtr acq = CAST_TO_ACQ(gRsrcMngr->GetObj(ACQ_GROUP_ID)) LOG_NRM("Create get log page cmd and assoc some buffer memory"); SharedGetLogPagePtr getLogPgCmd = SharedGetLogPagePtr(new GetLogPage()); SharedMemBufferPtr getLogPageMem = SharedMemBufferPtr(new MemBuffer()); send_64b_bitmask prpReq = (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE); getLogPageMem->InitOffset1stPage(BUFFER_SIZE, 0, true); getLogPgCmd->SetPrpBuffer(prpReq, getLogPageMem); getLogPgCmd->SetNUMD(NUMD - 1); // 0-based getLogPgCmd->SetNSID(0xFFFFFFFF); list<uint32_t> invalidLIDs = GetInvalidLIDs(); for (list<uint32_t>::iterator invalidLID = invalidLIDs.begin(); invalidLID != invalidLIDs.end(); invalidLID++) { LOG_NRM("Processing for invalid LID = 0x%04X", *invalidLID); getLogPgCmd->SetLID(*invalidLID); work = str(boost::format("invalidLID.%d") % *invalidLID); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, getLogPgCmd, work, true, CESTAT_INVAL_LOG_PAGE); } }
void UnsupportRsvdFields_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ // Lookup objs which were created in a prior test within group string globalWork; //uint64_t i; SharedASQPtr asq = CAST_TO_ASQ(gRsrcMngr->GetObj(ASQ_GROUP_ID)) SharedACQPtr acq = CAST_TO_ACQ(gRsrcMngr->GetObj(ACQ_GROUP_ID)) LOG_NRM("Create get log page cmd and assoc some buffer memory"); SharedGetLogPagePtr getLogPgCmd = SharedGetLogPagePtr(new GetLogPage()); LOG_NRM("Get log page to request firmware slot information"); getLogPgCmd->SetNUMD(PRP1_ONLY_NUMD - 1); // 0-based getLogPgCmd->SetLID(FIRM_SLOT_INFO_LID); getLogPgCmd->SetNSID(0xFFFFFFFF); SharedMemBufferPtr getLogPageMem = SharedMemBufferPtr(new MemBuffer()); getLogPageMem->InitOffset1stPage(GetLogPage::FIRMSLOT_DATA_SIZE, BUFFER_OFFSET, true); send_64b_bitmask prpReq = (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE); getLogPgCmd->SetPrpBuffer(prpReq, getLogPageMem); LOG_NRM("Issue GetLogPage cmd without setting reserved bits."); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, getLogPgCmd, "rsvd.notset", true); LOG_NRM("Set all cmd's rsvd bits"); uint32_t work = getLogPgCmd->GetDword(0); work |= 0x0000fc00; // Set DW0_b15:10 bits getLogPgCmd->SetDword(work, 0); getLogPgCmd->SetDword(0xffffffff, 2); getLogPgCmd->SetDword(0xffffffff, 3); getLogPgCmd->SetDword(0xffffffff, 4); getLogPgCmd->SetDword(0xffffffff, 5); work = getLogPgCmd->GetDword(10); work |= 0xf0000000; // Set DW10_b31:28 bits getLogPgCmd->SetDword(work, 10); getLogPgCmd->SetDword(0xffffffff, 11); getLogPgCmd->SetDword(0xffffffff, 12); getLogPgCmd->SetDword(0xffffffff, 13); getLogPgCmd->SetDword(0xffffffff, 14); getLogPgCmd->SetDword(0xffffffff, 15); LOG_NRM("Issue GetLogPage cmd after setting reserved bits."); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, getLogPgCmd, "rsvd.set", true); }
void MandatoryErrInfo_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ string work; uint64_t i; // Lookup objs which were created in a prior test within group SharedASQPtr asq = CAST_TO_ASQ(gRsrcMngr->GetObj(ASQ_GROUP_ID)) SharedACQPtr acq = CAST_TO_ACQ(gRsrcMngr->GetObj(ACQ_GROUP_ID)) ConstSharedIdentifyPtr idCtrlrStruct = gInformative->GetIdentifyCmdCtrlr(); uint8_t X = idCtrlrStruct->GetValue(IDCTRLRCAP_ELPE) + 1; LOG_NRM("Identify controller ELPE = %d (1-based)", X); LOG_NRM("Create get log page cmd and assoc some buffer memory"); SharedGetLogPagePtr getLogPgCmd = SharedGetLogPagePtr(new GetLogPage()); LOG_NRM("Create memory buffer for log page to request error information"); SharedMemBufferPtr getLogPageMem = SharedMemBufferPtr(new MemBuffer()); send_64b_bitmask prpReq = (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE); LOG_NRM("Get log page to request error information"); getLogPgCmd->SetLID(ERRINFO_LID); // loop for all log entries supported by controller for (uint32_t numd = ERRINFO_NUMD; numd <= (X * ERRINFO_NUMD); numd += ERRINFO_NUMD) { LOG_NRM("Issue Get log page cmd with NUMD = %d and log entries = %d", numd, (numd/ERRINFO_NUMD)); getLogPageMem->Init(GetLogPage::ERRINFO_DATA_SIZE * X, true); getLogPgCmd->SetPrpBuffer(prpReq, getLogPageMem); getLogPgCmd->SetNUMD(numd - 1); // 0-based getLogPgCmd->SetNSID(0xFFFFFFFF); work = str(boost::format("logEnties%d") % (numd / ERRINFO_NUMD)); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, getLogPgCmd, work, true); // Verify the buffer's non-retrieved log entries = 0x00. SharedMemBufferPtr cmdPayload = getLogPgCmd->GetRWPrpBuffer(); uint32_t offset = (numd * 4); uint8_t *cmdPayloadBuff = (uint8_t *)cmdPayload->GetBuffer() + offset; for (; offset < (X * GetLogPage::ERRINFO_DATA_SIZE); offset++) { LOG_NRM("Verify data at offset = 0x%X", offset); if (*cmdPayloadBuff != 0x0) { throw FrmwkEx(HERE, "Invalid data at buffer offset = 0x%08X, " "value = 0x%08X", cmdPayloadBuff, *cmdPayloadBuff); } cmdPayloadBuff++; } } }
void UnsupportRsvdFields_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ LOG_NRM("Lookup objs which were created in a prior test within group"); SharedASQPtr asq = CAST_TO_ASQ(gRsrcMngr->GetObj(ASQ_GROUP_ID)) SharedACQPtr acq = CAST_TO_ACQ(gRsrcMngr->GetObj(ACQ_GROUP_ID)) LOG_NRM("Determine if DUT has atleast one namespace support"); ConstSharedIdentifyPtr idCmdCtrlr = gInformative->GetIdentifyCmdCtrlr(); if ((idCmdCtrlr->GetValue(IDCTRLRCAP_NN)) == 0) throw FrmwkEx(HERE, "Required to support >= 1 namespace"); LOG_NRM("Form identify namespace cmd and associate some buffer"); SharedIdentifyPtr idCmdNamSpc = SharedIdentifyPtr(new Identify()); idCmdNamSpc->SetCNS(0); idCmdNamSpc->SetNSID(1); SharedMemBufferPtr idMemNamSpc = SharedMemBufferPtr(new MemBuffer()); idMemNamSpc->InitOffset1stPage(Identify::IDEAL_DATA_SIZE, PRP_BUFFER_OFFSET, true); LOG_NRM("Allow PRP1 and PRP2"); send_64b_bitmask idPrpNamSpc = (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE); idCmdNamSpc->SetPrpBuffer(idPrpNamSpc, idMemNamSpc); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, idCmdNamSpc, "rsvdnone.set", true); LOG_NRM("Set all cmd's rsvd bits"); uint32_t work = idCmdNamSpc->GetDword(0); work |= 0x0000fc00; // Set DW0_b15:10 bits idCmdNamSpc->SetDword(work, 0); idCmdNamSpc->SetDword(0xffffffff, 2); idCmdNamSpc->SetDword(0xffffffff, 3); idCmdNamSpc->SetDword(0xffffffff, 4); idCmdNamSpc->SetDword(0xffffffff, 5); work = idCmdNamSpc->GetDword(10); work |= 0xfffffffe; // Set DW10_b31:1 bits idCmdNamSpc->SetDword(work, 10); idCmdNamSpc->SetDword(0xffffffff, 11); idCmdNamSpc->SetDword(0xffffffff, 12); idCmdNamSpc->SetDword(0xffffffff, 13); idCmdNamSpc->SetDword(0xffffffff, 14); idCmdNamSpc->SetDword(0xffffffff, 15); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, idCmdNamSpc, "rsvdall.set", true); }
void WriteDataPat_r10b::WriteDataPattern() { uint64_t regVal; LOG_NRM("Calc buffer size to write %d logical blks to media", WRITE_DATA_PAT_NUM_BLKS); ConstSharedIdentifyPtr namSpcPtr = gInformative->GetIdentifyCmdNamspc(1); if (namSpcPtr == Identify::NullIdentifyPtr) { LOG_ERR("Namespace #1 must exist"); throw exception(); } uint64_t lbaDataSize = namSpcPtr->GetLBADataSize(); LOG_NRM("Create data pattern to write to media"); SharedMemBufferPtr dataPat = SharedMemBufferPtr(new MemBuffer()); dataPat->Init(WRITE_DATA_PAT_NUM_BLKS * lbaDataSize); dataPat->SetDataPattern(MemBuffer::DATAPAT_INC_16BIT); dataPat->Dump(FileSystem::PrepLogFile(mGrpName, mTestName, "DataPat"), "Write buffer's data pattern"); LOG_NRM("Create a generic write cmd to send data pattern to namspc 1"); SharedWritePtr writeCmd = SharedWritePtr(new Write(mFd)); send_64b_bitmask prpBitmask = (send_64b_bitmask) (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST); writeCmd->SetPrpBuffer(prpBitmask, dataPat); writeCmd->SetNSID(1); writeCmd->SetNLB(WRITE_DATA_PAT_NUM_BLKS-1); // convert to 0-based value // Lookup objs which were created in a prior test within group SharedIOSQPtr iosqContig = CAST_TO_IOSQ( gRsrcMngr->GetObj(IOSQ_CONTIG_GROUP_ID)) SharedIOCQPtr iocqContig = CAST_TO_IOCQ( gRsrcMngr->GetObj(IOCQ_CONTIG_GROUP_ID)) SharedIOSQPtr iosqDiscontig = CAST_TO_IOSQ( gRsrcMngr->GetObj(IOSQ_DISCONTIG_GROUP_ID)) SharedIOCQPtr iocqDiscontig = CAST_TO_IOCQ( gRsrcMngr->GetObj(IOCQ_DISCONTIG_GROUP_ID)) LOG_NRM("Send the cmd to hdw via the contiguous IOQ's"); SendToIOSQ(iosqContig, iocqContig, writeCmd, "contig"); // To run the discontig part of this test, the hdw must support that feature if (gRegisters->Read(CTLSPC_CAP, regVal) == false) { LOG_ERR("Unable to determine Q memory requirements"); throw exception(); } else if (regVal & CAP_CQR) { LOG_NRM("Unable to utilize discontig Q's, DUT requires contig"); return; } LOG_NRM("Send the cmd to hdw via the discontiguous IOQ's"); SendToIOSQ(iosqDiscontig, iocqDiscontig, writeCmd, "discontig"); }
void LBAOutOfRangeBare_r12::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ uint64_t nsze; char work[256]; ConstSharedIdentifyPtr namSpcPtr; // Lookup objs which were created in a prior test within group SharedIOSQPtr iosq = CAST_TO_IOSQ(gRsrcMngr->GetObj(IOSQ_GROUP_ID)); SharedIOCQPtr iocq = CAST_TO_IOCQ(gRsrcMngr->GetObj(IOCQ_GROUP_ID)); vector<uint32_t> bare = gInformative->GetBareNamespaces(); for (size_t i = 0; i < bare.size(); i++) { namSpcPtr = gInformative->GetIdentifyCmdNamspc(bare[i]); if (namSpcPtr->isZeroFilled()) { LOG_NRM("Namespace %lu is inactive", i); } else { nsze = namSpcPtr->GetValue(IDNAMESPC_NSZE); LOG_NRM("Create memory to contain write payload"); SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer()); uint64_t lbaDataSize = namSpcPtr->GetLBADataSize(); writeMem->Init(WR_NUM_BLKS * lbaDataSize); LOG_NRM("Create a write cmd to write data to namspc %d", bare[i]); SharedWritePtr writeCmd = SharedWritePtr(new Write()); send_64b_bitmask prpBitmask = (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST); writeCmd->SetPrpBuffer(prpBitmask, writeMem); writeCmd->SetNSID(bare[i]); writeCmd->SetNLB(WR_NUM_BLKS - 1); // convert to 0-based value LOG_NRM( "Issue cmd where 1st block starts at LBA (Identify.NSZE-2)"); snprintf(work, sizeof(work), "nsze-2.%01d", (uint32_t)i); writeCmd->SetSLBA(nsze - 2); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq, writeCmd, work, true); LOG_NRM( "Issue cmd where 1st block starts at LBA (Identify.NSZE-1)"); snprintf(work, sizeof(work), "nsze-1.%d01d", (uint32_t)i); writeCmd->SetSLBA(nsze - 1); SendCmdToHdw(iosq, iocq, writeCmd, work); LOG_NRM("Issue cmd where 1st block starts at LBA (Identify.NSZE)"); snprintf(work, sizeof(work), "nsze.%01d", (uint32_t)i); writeCmd->SetSLBA(nsze); SendCmdToHdw(iosq, iocq, writeCmd, work); } } }
void CIDAcceptedASQ_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ uint32_t isrCount; // Lookup objs which were created in a prior test within group SharedASQPtr asq = CAST_TO_ASQ(gRsrcMngr->GetObj(ASQ_GROUP_ID)) SharedACQPtr acq = CAST_TO_ACQ(gRsrcMngr->GetObj(ACQ_GROUP_ID)) LOG_NRM("Verifying that the ACQ is empty"); if (acq->ReapInquiry(isrCount, true) != 0) { acq->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "acq", "notEmpty"), "Test assumption have not been met"); throw FrmwkEx(HERE, "The ACQ should not have any CE's waiting before testing"); } LOG_NRM("Create identify cmd and assoc some buffer memory"); SharedIdentifyPtr idCmdCap = SharedIdentifyPtr(new Identify()); LOG_NRM("Force identify to request ctrlr capabilities struct"); idCmdCap->SetCNS(CNS_Controller); SharedMemBufferPtr idMemCap = SharedMemBufferPtr(new MemBuffer()); idMemCap->InitAlignment(Identify::IDEAL_DATA_SIZE, PRP_BUFFER_ALIGNMENT, false, 0); send_64b_bitmask idPrpCap = (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE); idCmdCap->SetPrpBuffer(idPrpCap, idMemCap); LOG_NRM("Learn initial unique command id assigned by dnvme."); uint16_t currCID; asq->Send(idCmdCap, currCID); uint16_t prevCID = currCID; for (uint32_t nCmds = 0; nCmds < MAX_CMDS; nCmds++) { asq->Ring(); LOG_NRM("Verify unique CID #%d for Cmd #%d", currCID, nCmds + 1); ReapVerifyCID(asq, acq, currCID); asq->Send(idCmdCap, currCID); if (currCID != (uint16_t)(prevCID + 1)) { asq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "asq.fail"), "Dump Entire ASQ"); acq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "acq.fail"), "Dump Entire ACQ"); throw FrmwkEx(HERE, "Current CID(%d) != prev + 1(%d)", currCID, prevCID); } prevCID = currCID; } }
bool LBAOutOfRangeBare_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ uint64_t nsze; ConstSharedIdentifyPtr namSpcPtr; // Lookup objs which were created in a prior test within group SharedIOSQPtr iosqContig = CAST_TO_IOSQ( gRsrcMngr->GetObj(IOSQ_CONTIG_GROUP_ID)) SharedIOCQPtr iocqContig = CAST_TO_IOCQ( gRsrcMngr->GetObj(IOCQ_CONTIG_GROUP_ID)) vector<uint32_t> bare = gInformative->GetBareNamespaces(); for (size_t i = 1; i < bare.size(); i++) { namSpcPtr = gInformative->GetIdentifyCmdNamspc(i); if (namSpcPtr == Identify::NullIdentifyPtr) { LOG_ERR("Identify namspc struct #%d doesn't exist", bare[i]); throw exception(); } nsze = namSpcPtr->GetValue(IDNAMESPC_NSZE); LOG_NRM("Create memory to contain read payload"); SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer()); uint64_t lbaDataSize = namSpcPtr->GetLBADataSize(); readMem->Init(RD_NUM_BLKS * lbaDataSize); LOG_NRM("Create a read cmd to read data from namspc %d", bare[i]); SharedReadPtr readCmd = SharedReadPtr(new Read(mFd)); send_64b_bitmask prpBitmask = (send_64b_bitmask) (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST); readCmd->SetPrpBuffer(prpBitmask, readMem); readCmd->SetNSID(bare[i]); readCmd->SetNLB(RD_NUM_BLKS - 1); // convert to 0-based value LOG_NRM("Issue cmd where 1st block starts at LBA (Identify.NSZE-2)"); readCmd->SetSLBA(nsze - 2); IO::SendCmdToHdw(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iosqContig, iocqContig, readCmd, "nsze-2", true); LOG_NRM("Issue cmd where 1st block starts at LBA (Identify.NSZE-1)"); readCmd->SetSLBA(nsze - 1); SendCmdToHdw(iosqContig, iocqContig, readCmd, "nsze-1"); LOG_NRM("Issue cmd where 1st block starts at LBA (Identify.NSZE)"); readCmd->SetSLBA(nsze); SendCmdToHdw(iosqContig, iocqContig, readCmd, "nsze"); } return true; }
void DeleteIOQDiscontigPoll_r10b::DeleteIOSQDiscontigPoll(SharedASQPtr asq, SharedACQPtr acq) { uint16_t numCE; LOG_NRM("Lookup IOSQ which was created in a prior test within group"); SharedIOSQPtr iosq = CAST_TO_IOSQ( gRsrcMngr->GetObj(IOSQ_DISCONTIG_POLL_GROUP_ID)) LOG_NRM("Create a Delete IOSQ cmd to perform the IOSQ deletion"); SharedDeleteIOSQPtr deleteIOSQCmd = SharedDeleteIOSQPtr(new DeleteIOSQ(mFd)); deleteIOSQCmd->Init(iosq); LOG_NRM("Send the Delete IOSQ cmd to hdw"); asq->Send(deleteIOSQCmd); asq->Dump(FileSystem::PrepLogFile(mGrpName, mTestName, "asq", "deleteIOSQCmd"), "Just B4 ringing SQ0 doorbell, dump entire SQ contents"); asq->Ring(); LOG_NRM("Wait for the CE to arrive in ACQ"); if (acq->ReapInquiryWaitSpecify(DEFAULT_CMD_WAIT_ms, 1, numCE) == false) { LOG_ERR("Unable to see completion of Delete IOSQ cmd"); acq->Dump( FileSystem::PrepLogFile(mGrpName, mTestName, "acq","deleteIOSQCmd"), "Unable to see any CE's in CQ0, dump entire CQ contents"); throw exception(); } acq->Dump(FileSystem::PrepLogFile(mGrpName, mTestName, "acq", "deleteIOSQCmd"), "Just B4 reaping CQ0, dump entire CQ contents"); { uint16_t ceRemain; uint16_t numReaped; LOG_NRM("Reaping CE from ACQ, requires memory to hold reaped CE"); SharedMemBufferPtr ceMemIOSQ = SharedMemBufferPtr(new MemBuffer()); if ((numReaped = acq->Reap(ceRemain, ceMemIOSQ, numCE, true)) != 1) { LOG_ERR("Verified there was 1 CE, but reaping produced %d", numReaped); throw exception(); } LOG_NRM("The reaped identify CE is..."); ceMemIOSQ->Log(); } // Not explicitly necessary, but is more clean to free what is not needed gRsrcMngr->FreeObj(IOSQ_DISCONTIG_POLL_GROUP_ID); }
void InvalidNamspc_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ uint64_t inc, i; string work; uint32_t numCE; uint32_t isrCountB4; LOG_NRM("Lookup objs which were created in a prior test within group"); SharedIOSQPtr iosq = CAST_TO_IOSQ(gRsrcMngr->GetObj(IOSQ_GROUP_ID)); SharedIOCQPtr iocq = CAST_TO_IOCQ(gRsrcMngr->GetObj(IOCQ_GROUP_ID)); if ((numCE = iocq->ReapInquiry(isrCountB4, true)) != 0) { iocq->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", "notEmpty"), "Test assumption have not been met"); throw FrmwkEx(HERE, "Require 0 CE's within CQ %d, not upheld, found %d", iocq->GetQId(), numCE); } LOG_NRM("Setup write cmd's values that won't change per namspc"); SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer()); uint64_t lbaDataSize = 512; writeMem->Init(lbaDataSize); SharedWritePtr writeCmd = SharedWritePtr(new Write()); send_64b_bitmask prpBitmask = (send_64b_bitmask) (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST); writeCmd->SetPrpBuffer(prpBitmask, writeMem); writeCmd->SetNLB(0); // convert to 0-based value writeCmd->SetSLBA(0); LOG_NRM("For all namspc's issue cmd to an illegal namspc"); ConstSharedIdentifyPtr idCtrlrStruct = gInformative->GetIdentifyCmdCtrlr(); uint32_t nn = (uint32_t)idCtrlrStruct->GetValue(IDCTRLRCAP_NN); if (nn == 0 ) { throw FrmwkEx(HERE, "Required to support >= 1 namespace"); } for (i = (nn + 1), inc = 1; i <= 0xffffffff; i += (2 * inc), inc += 1327) { LOG_NRM("Issue flush cmd with illegal namspc ID=%llu", (unsigned long long)i); writeCmd->SetNSID(i); work = str(boost::format("namspc%d") % i); SendCmdToHdw(iosq, iocq, writeCmd, work); } }
void CQ::Init(uint16_t qId, uint16_t entrySize, uint16_t numEntries, const SharedMemBufferPtr memBuffer, bool irqEnabled, uint16_t irqVec) { Queue::Init(qId, entrySize, numEntries); mIrqEnabled = irqEnabled; mIrqVec = irqVec; LOG_NRM("Allocating discontiguous CQ memory in tnvme"); if (numEntries < 2) LOG_WARN("Number elements breaches spec requirement"); if (memBuffer == MemBuffer::NullMemBufferPtr) { LOG_DBG("Passing an uninitialized SharedMemBufferPtr"); throw exception(); } else if (GetIsAdmin()) { // There are no appropriate methods for an NVME device to report ASC/ACQ // creation errors, thus since ASC/ASQ may only be contiguous then don't // allow these problems to be injected, at best they will only succeed // to seg fault the app or crash the kernel. LOG_DBG("Illegal memory alignment will corrupt"); throw exception(); } else if (memBuffer->GetBufSize() < GetQSize()) { LOG_DBG("Q buffer memory ambiguous to passed size params"); LOG_DBG("Mem buffer size = %d, Q size = %d", memBuffer->GetBufSize(), GetQSize()); throw exception(); } else if (memBuffer->GetAlignment() != sysconf(_SC_PAGESIZE)) { // Nonconformance to page alignment will seg fault the app or crash // the kernel. This state is not testable since no errors can be // reported by hdw, thus disallow this attempt. LOG_DBG("Q content memory shall be page aligned"); throw exception(); } // Zero out the content memory so the P-bit correlates to a newly alloc'd Q. // Also assuming life time ownership of this object if it wasn't created // by the RsrcMngr. mDiscontigBuf = memBuffer; mDiscontigBuf->Zero(); // We are creating a discontiguous IOCQ struct nvme_prep_cq q; q.cq_id = GetQId(); q.elements = GetNumEntries(); q.contig = false; CreateIOCQ(q); LOG_NRM( "Created CQ: (id, entrySize, numEntry, IRQEnable) = (%d, %d, %d, %s)", GetQId(), GetEntrySize(), GetNumEntries(), GetIrqEnabled() ? "T" : "F"); }
void ProtInfoIgnoreBare_r10b::RunCoreTest() { /** \verbatim * Assumptions: * None. * \endverbatim */ char context[256]; ConstSharedIdentifyPtr namSpcPtr; // Lookup objs which were created in a prior test within group SharedIOSQPtr iosq = CAST_TO_IOSQ(gRsrcMngr->GetObj(IOSQ_GROUP_ID)); SharedIOCQPtr iocq = CAST_TO_IOCQ(gRsrcMngr->GetObj(IOCQ_GROUP_ID)); vector<uint32_t> bare = gInformative->GetBareNamespaces(); for (size_t i = 0; i < bare.size(); i++) { namSpcPtr = gInformative->GetIdentifyCmdNamspc(bare[i]); if (namSpcPtr == Identify::NullIdentifyPtr) { throw FrmwkEx(HERE, "Identify namspc struct #%d doesn't exist", bare[i]); } LOG_NRM("Create memory to contain write payload"); SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer()); uint64_t lbaDataSize = namSpcPtr->GetLBADataSize(); writeMem->Init(lbaDataSize); LOG_NRM("Create a write cmd to read data from namspc %d", bare[i]); SharedWritePtr writeCmd = SharedWritePtr(new Write()); send_64b_bitmask prpBitmask = (send_64b_bitmask) (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST); writeCmd->SetPrpBuffer(prpBitmask, writeMem); writeCmd->SetNSID(bare[i]); writeCmd->SetNLB(0); // convert to 0-based value for (uint16_t protInfo = 0; protInfo <= 0x0f; protInfo++) { uint8_t work = writeCmd->GetByte(12, 3); work &= ~0x3c; // PRINFO specific bits work |= (protInfo << 2); writeCmd->SetByte(work, 12, 3); snprintf(context, sizeof(context), "ns%d.protInfo0x%02X", (uint32_t)i, protInfo); IO::SendAndReapCmd(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iosq, iocq, writeCmd, context, true); } } }
bool MemBuffer::Compare(const SharedMemBufferPtr compTo) { if (compTo->GetBufSize() != GetBufSize()) { throw FrmwkEx(HERE, "Compare buffers not same size: %d != %d", compTo->GetBufSize(), GetBufSize()); } if (memcmp(compTo->GetBuffer(), GetBuffer(), GetBufSize()) != 0) { LOG_ERR("Detected data miscompare"); return false; } return true; }
void UnsupportRsvdFields_r11b::TestAsyncEvents(SharedACQPtr &acq, SharedASQPtr &asq, bool rsvd) { uint32_t isrCount; uint32_t ceRemain; uint32_t numReaped; uint32_t numCE; SendAsyncEventRequests(asq, 1, rsvd); sleep(5); if (acq->ReapInquiryWaitSpecify(CALC_TIMEOUT_ms(1), 1, numCE, isrCount) == true) { acq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "acq.fail1"), "Dump Entire ACQ"); throw FrmwkEx(HERE, "0 CE's expected in ACQ but found %d CE's", numCE); } InvalidSQWriteDoorbell(); sleep(1); if (acq->ReapInquiryWaitSpecify(CALC_TIMEOUT_ms(1), 1, numCE, isrCount) == false) { acq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "acq.fail2"), "Dump Entire ACQ"); throw FrmwkEx(HERE, "1 CE expected in ACQ but found %d CE's", numCE); } SharedMemBufferPtr ceMem = SharedMemBufferPtr(new MemBuffer()); if ((numReaped = acq->Reap(ceRemain, ceMem, isrCount, numCE, true)) != 1) { acq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "acq.fail3"), "Dump Entire ACQ"); throw FrmwkEx(HERE, "Unable to reap on ACQ"); } union CE *ce = (union CE *)ceMem->GetBuffer(); if (ce->n.async.asyncEventType != EVENT_TYPE_ERROR_STS) { throw FrmwkEx(HERE, "Invalid async event error status, " "(Expected : Received) :: (%d : %d)", EVENT_TYPE_ERROR_STS, ce->n.async.asyncEventType); } else if (ce->n.async.asyncEventInfo != ERR_STS_INVALID_SQ) { throw FrmwkEx(HERE, "Invalid async event info, " "(Expected : Received) :: (%d : %d)", ERR_STS_INVALID_SQ, ce->n.async.asyncEventInfo); } LOG_NRM("Associated Log page = %d", ce->n.async.assocLogPage); ReadLogPage(acq, asq, ce->n.async.assocLogPage); }
void CIDAcceptedIOSQ_r10b::ReapVerifyCID(SharedIOSQPtr iosq, SharedIOCQPtr iocq, uint16_t expCID) { uint32_t isrCount; uint32_t ceRemain; uint32_t numReaped; uint32_t numCE; if (iocq->ReapInquiryWaitSpecify(DEFAULT_CMD_WAIT_ms, 1, numCE, isrCount) == false) { iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail"), "Dump Entire IOCQ"); iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail"), "Dump Entire IOSQ"); throw FrmwkEx(HERE, "Unable to see CEs for issued cmd"); } SharedMemBufferPtr ceMem = SharedMemBufferPtr(new MemBuffer()); if ((numReaped = iocq->Reap(ceRemain, ceMem, isrCount, numCE, true)) != 1) { iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail"), "Dump Entire IOCQ"); iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail"), "Dump Entire IOSQ"); throw FrmwkEx(HERE, "Unable to reap on IOCQ"); } union CE *ce = (union CE *)ceMem->GetBuffer(); ProcessCE::Validate(*ce); // throws upon error if (ce->n.CID != expCID) { iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail"), "Dump Entire IOCQ"); iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail"), "Dump Entire IOSQ"); throw FrmwkEx(HERE, "Received CID %d but expected %d", ce->n.CID, expCID); } if (ce->n.SQID != iosq->GetQId()) { iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail"), "Dump Entire IOCQ"); iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail"), "Dump Entire IOSQ"); throw FrmwkEx(HERE, "Rx'd SDID %d but expt'd %d", ce->n.SQID, iosq->GetQId()); } }
void ProtInfoIgnoreBare_r12::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ char context[256]; ConstSharedIdentifyPtr namSpcPtr; // Lookup objs which were created in a prior test within group SharedIOSQPtr iosq = CAST_TO_IOSQ(gRsrcMngr->GetObj(IOSQ_GROUP_ID)); SharedIOCQPtr iocq = CAST_TO_IOCQ(gRsrcMngr->GetObj(IOCQ_GROUP_ID)); vector<uint32_t> bare = gInformative->GetBareNamespaces(); for (size_t i = 0; i < bare.size(); i++) { namSpcPtr = gInformative->GetIdentifyCmdNamspc(bare[i]); if (namSpcPtr->isZeroFilled()) { LOG_NRM("Namespace %lu is inactive", i); } else { LOG_NRM("Create memory to contain read payload"); SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer()); uint64_t lbaDataSize = namSpcPtr->GetLBADataSize(); readMem->Init(lbaDataSize); LOG_NRM("Create a read cmd to read data from namspc %d", bare[i]); SharedReadPtr readCmd = SharedReadPtr(new Read()); send_64b_bitmask prpBitmask = (send_64b_bitmask) (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST); readCmd->SetPrpBuffer(prpBitmask, readMem); readCmd->SetNSID(bare[i]); readCmd->SetNLB(0); // convert to 0-based value for (uint16_t protInfo = 0; protInfo <= 0x0f; protInfo++) { uint8_t work = readCmd->GetByte(12, 3); work &= ~0x3c; // PRINFO specific bits work |= (protInfo << 2); readCmd->SetByte(work, 12, 3); snprintf(context, sizeof(context), "ns%d.protInfo0x%02X", (uint32_t)i, protInfo); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq, readCmd, context, true); } } } }
void NUMDIsAdhered_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ // Lookup objs which were created in a prior test within group string work; uint64_t i; SharedASQPtr asq = CAST_TO_ASQ(gRsrcMngr->GetObj(ASQ_GROUP_ID)) SharedACQPtr acq = CAST_TO_ACQ(gRsrcMngr->GetObj(ACQ_GROUP_ID)) LOG_NRM("Create get log page cmd and assoc some buffer memory"); SharedGetLogPagePtr getLogPgCmd = SharedGetLogPagePtr(new GetLogPage()); LOG_NRM("Get log page to request firmware slot information"); getLogPgCmd->SetNUMD(NUMDW_ADHERED - 1); // 0-based getLogPgCmd->SetLID(FIRM_SLOT_INFO_LID); getLogPgCmd->SetNSID(0xFFFFFFFF); LOG_NRM("Set the offset into the buffer at 0x%04X", BUFFER_OFFSET); SharedMemBufferPtr getLogPageMem = SharedMemBufferPtr(new MemBuffer()); getLogPageMem->InitOffset1stPage(GetLogPage::FIRMSLOT_DATA_SIZE, BUFFER_OFFSET, true, BUFFER_INIT_VAL); send_64b_bitmask prpReq = (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE); getLogPgCmd->SetPrpBuffer(prpReq, getLogPageMem); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, getLogPgCmd, "NUMD.adhered", true); LOG_NRM("Compare cmd buffer to verify the last half of buffer = 0xA5"); SharedMemBufferPtr cmdPayload = getLogPgCmd->GetRWPrpBuffer(); uint16_t offset = (NUMDW_ADHERED * 4); uint8_t *cmdPayloadBuff = (uint8_t *)cmdPayload->GetBuffer() + offset; for (; offset < (GetLogPage::FIRMSLOT_DATA_SIZE); offset++) { LOG_NRM("Verify data at offset = 0x%X", offset); if (*cmdPayloadBuff != BUFFER_INIT_VAL) { throw FrmwkEx(HERE, "NUMD not adhered at offset = 0x%08X, " "value = 0x%08X", cmdPayloadBuff, *cmdPayloadBuff); } cmdPayloadBuff++; } }
void CIDAcceptedIOSQ_r10b::InitTstRsrcs(SharedASQPtr asq, SharedACQPtr acq, vector <SharedIOSQPtr> &iosqs, SharedIOCQPtr &iocq) { uint8_t iocqes = (gInformative->GetIdentifyCmdCtrlr()-> GetValue(IDCTRLRCAP_CQES) & 0xf); uint8_t iosqes = (gInformative->GetIdentifyCmdCtrlr()-> GetValue(IDCTRLRCAP_SQES) & 0xf); gCtrlrConfig->SetIOCQES(iocqes); gCtrlrConfig->SetIOSQES(iosqes); uint32_t numIOSQs = (NUM_IO_SQS <= gInformative->GetFeaturesNumOfIOSQs()) ? NUM_IO_SQS : gInformative->GetFeaturesNumOfIOSQs(); LOG_NRM("Initialize test resources."); const uint32_t nEntriesIOQ = 2; // minimum Q entries always supported. SharedIOSQPtr iosq; if (Queues::SupportDiscontigIOQ() == true) { SharedMemBufferPtr iocqMem = SharedMemBufferPtr(new MemBuffer()); iocqMem->InitOffset1stPage((nEntriesIOQ * (1 << iocqes)), 0, true); iocq = Queues::CreateIOCQDiscontigToHdw(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, IOQ_ID, nEntriesIOQ, false, IOCQ_GROUP_ID, true, 1, iocqMem); for (uint32_t iosqId = 1; iosqId <= numIOSQs; iosqId++) { SharedMemBufferPtr iosqMem = SharedMemBufferPtr(new MemBuffer()); iosqMem->InitOffset1stPage((nEntriesIOQ * (1 << iosqes)), 0, true); iosq = Queues::CreateIOSQDiscontigToHdw(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, iosqId, nEntriesIOQ, false, IOSQ_GROUP_ID, IOQ_ID, 0, iosqMem); iosqs.push_back(iosq); } } else { iocq = Queues::CreateIOCQContigToHdw(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, IOQ_ID, nEntriesIOQ, false, IOCQ_GROUP_ID, true, 1); for (uint32_t iosqId = 1; iosqId <= numIOSQs; iosqId++) { iosq = Queues::CreateIOSQContigToHdw(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, iosqId, nEntriesIOQ, false, IOSQ_GROUP_ID, IOQ_ID, 0); iosqs.push_back(iosq); } } }
void IgnoreMetaPtrBare_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ string work; ConstSharedIdentifyPtr namSpcPtr; LOG_NRM("Lookup objs which were created in a prior test within group"); SharedIOSQPtr iosq = CAST_TO_IOSQ(gRsrcMngr->GetObj(IOSQ_GROUP_ID)); SharedIOCQPtr iocq = CAST_TO_IOCQ(gRsrcMngr->GetObj(IOCQ_GROUP_ID)); LOG_NRM("For all bare namspc's issue cmd with non-zero meta ptr"); vector<uint32_t> bare = gInformative->GetBareNamespaces(); for (size_t i = 0; i < bare.size(); i++) { namSpcPtr = gInformative->GetIdentifyCmdNamspc(bare[i]); if (namSpcPtr == Identify::NullIdentifyPtr) { throw FrmwkEx(HERE, "Identify namspc struct #%d doesn't exist", bare[i]); } LOG_NRM("Setup write cmd's values that won't change per namspc"); SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer()); uint64_t lbaDataSize = namSpcPtr->GetLBADataSize(); writeMem->Init(lbaDataSize); SharedWritePtr writeCmd = SharedWritePtr(new Write()); send_64b_bitmask prpBitmask = (send_64b_bitmask) (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST); writeCmd->SetPrpBuffer(prpBitmask, writeMem); writeCmd->SetNLB(0); // convert to 0-based value writeCmd->SetSLBA(0); LOG_NRM("Set MPTR in cmd to max value"); writeCmd->SetDword(0xffffffff, 4); writeCmd->SetDword(0xffffffff, 5); writeCmd->SetNSID(bare[i]); work = str(boost::format("namspc%d") % bare[i]); IO::SendAndReapCmd(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iosq, iocq, writeCmd, work, true); } }
void IgnoreMetaPtrBare_r12::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ string work; ConstSharedIdentifyPtr namSpcPtr; // Lookup objs which were created in a prior test within group SharedIOSQPtr iosq = CAST_TO_IOSQ(gRsrcMngr->GetObj(IOSQ_GROUP_ID)); SharedIOCQPtr iocq = CAST_TO_IOCQ(gRsrcMngr->GetObj(IOCQ_GROUP_ID)); LOG_NRM("For all bare namspc's issue cmd with non-zero meta ptr"); vector<uint32_t> bare = gInformative->GetBareNamespaces(); for (size_t i = 0; i < bare.size(); i++) { namSpcPtr = gInformative->GetIdentifyCmdNamspc(bare[i]); if (namSpcPtr->isZeroFilled()) { LOG_NRM("Namespace %lu is inactive", i); } else { LOG_NRM("Setup read cmd's values that won't change per namspc"); SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer()); uint64_t lbaDataSize = namSpcPtr->GetLBADataSize(); readMem->Init(lbaDataSize); SharedReadPtr readCmd = SharedReadPtr(new Read()); send_64b_bitmask prpBitmask = (send_64b_bitmask) (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST); readCmd->SetPrpBuffer(prpBitmask, readMem); readCmd->SetNLB(0); // convert to 0-based value readCmd->SetSLBA(0); LOG_NRM("Set MPTR in cmd to max value"); readCmd->SetDword(0xffffffff, 4); readCmd->SetDword(0xffffffff, 5); readCmd->SetNSID(bare[i]); work = str(boost::format("namspc%d") % bare[i]); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq, readCmd, work, true); } } }
void VerifyDataPat_r10b::SendToIOSQ(SharedIOSQPtr iosq, SharedIOCQPtr iocq, SharedReadPtr readCmd, string qualifier, SharedMemBufferPtr writtenPayload, SharedMemBufferPtr readPayload) { IO::SendCmdToHdw(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iosq, iocq, readCmd, qualifier, true); LOG_NRM("Compare read vs written data to verify"); if (readPayload->Compare(writtenPayload) == false) { readPayload->Dump( FileSystem::PrepLogFile(mGrpName, mTestName, "ReadPayload"), "Data read from media miscompared from written"); writtenPayload->Dump( FileSystem::PrepLogFile(mGrpName, mTestName, "WrittenPayload"), "Data read from media miscompared from written"); } }
void UnsupportRsvdFields_r11b::ReadLogPage(SharedACQPtr &acq, SharedASQPtr &asq, uint8_t logId) { string work; LOG_NRM("Reading log page with LID = %d to clear the event mask", logId); ConstSharedIdentifyPtr idCtrlrStruct = gInformative->GetIdentifyCmdCtrlr(); uint16_t elpeVal = idCtrlrStruct->GetValue(IDCTRLRCAP_ELPE) + 1; LOG_NRM("Identify controller ELPE = %d (1-based)", elpeVal); uint16_t totalBytes = elpeVal * GetLogPage::ERRINFO_DATA_SIZE; LOG_NRM("Total bytes available for error info log page: %d", totalBytes); uint8_t mps; if (!gCtrlrConfig->GetMPS(mps)) throw FrmwkEx(HERE, "Failed to retrieve CC.MPS value"); uint32_t twoPages = 2 * (1 << (mps + 12)); LOG_NRM("Size of two memory pages (i.e. PRP1 & PRP2): %d bytes", twoPages); // PRP2 cannot be pointer to PRP list, so don't ask for more than 2 pages if (totalBytes > twoPages) { LOG_NRM("Can only utilize two memory pages; reducing total bytes"); totalBytes = twoPages; } uint16_t totalDwords = totalBytes / 4; LOG_NRM("Create get log page cmd and assoc some buffer memory"); SharedGetLogPagePtr getLogPgCmd = SharedGetLogPagePtr(new GetLogPage()); LOG_NRM("Create memory buffer for log page to request error information"); SharedMemBufferPtr getLogPageMem = SharedMemBufferPtr(new MemBuffer()); send_64b_bitmask prpReq = (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE); LOG_NRM("Get log page to request error information logId = %d", logId); getLogPgCmd->SetLID(logId); getLogPageMem->Init(totalBytes, true); getLogPgCmd->SetPrpBuffer(prpReq, getLogPageMem); getLogPgCmd->SetNUMD(totalDwords - 1); //0-based work = str(boost::format("ErrorLog%d") % (uint32_t)logId); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, getLogPgCmd, work, true); }