bool
GrpAdminSetGetFeatCombo::RestoreIRQCoalescing(SharedASQPtr asq,
    SharedACQPtr acq)
{
    SharedGetFeaturesPtr getFeaturesCmd =
        SharedGetFeaturesPtr(new GetFeatures());
    SharedSetFeaturesPtr setFeaturesCmd =
        SharedSetFeaturesPtr(new SetFeatures());

    LOG_NRM("Restoring state with IRQCoalescing = 0x%04X", mIrqCoalescing);
    setFeaturesCmd->SetFID(FID[FID_IRQ_COALESCING]);
    getFeaturesCmd->SetFID(FID[FID_IRQ_COALESCING]);

    setFeaturesCmd->SetDword(mIrqCoalescing, 11);
    IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
        setFeaturesCmd, "RestoreIRQCoalescing", true);

    struct nvme_gen_cq acqMetrics = acq->GetQMetrics();
    IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
        getFeaturesCmd, "RestoreIRQCoalescing", true);
    union CE ce = acq->PeekCE(acqMetrics.head_ptr);

    if (mIrqCoalescing != ce.t.dw0) {
        LOG_ERR("IRQCoalescing restore to original state failed. "
            "(Actual: Expected) = (0x%04X:0x%04X)", ce.t.dw0, mIrqCoalescing);
        return false;
    }
    return true;
}
Exemplo n.º 2
0
void
UnsupportRrvdFields_r10b::RunCoreTest()
{
    /** \verbatim
     * Assumptions:
     * 1) none
     *  \endverbatim
     */
    if (gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY) == false)
        throw FrmwkEx(HERE);

    LOG_NRM("Create admin queues ACQ and ASQ for test lifetime");
    SharedACQPtr acq = SharedACQPtr(new ACQ(gDutFd));
    acq->Init(5);

    SharedASQPtr asq = SharedASQPtr(new ASQ(gDutFd));
    asq->Init(5);

    // All queues will use identical IRQ vector
    IRQ::SetAnySchemeSpecifyNum(1);

    gCtrlrConfig->SetCSS(CtrlrConfig::CSS_NVM_CMDSET);
    if (gCtrlrConfig->SetState(ST_ENABLE) == false)
        throw FrmwkEx(HERE);

    // Test async events without setting the rsvd bits in the cmd.
    TestAsyncEvents(acq, asq, false);

    // Test async events by setting the rsvd bits in the cmd.
    TestAsyncEvents(acq, asq, true);

}
bool
GrpAdminSetGetFeatCombo::RestoreAsyncEvent(SharedASQPtr asq, SharedACQPtr acq)
{
    SharedGetFeaturesPtr getFeaturesCmd =
        SharedGetFeaturesPtr(new GetFeatures());
    SharedSetFeaturesPtr setFeaturesCmd =
        SharedSetFeaturesPtr(new SetFeatures());

    LOG_NRM("Restoring state with mAsyncEvent = 0x%04X", mAsyncEvent);
    setFeaturesCmd->SetFID(FID[FID_ASYNC_EVENT_CONFIG]);
    getFeaturesCmd->SetFID(FID[FID_ASYNC_EVENT_CONFIG]);

    setFeaturesCmd->SetDword(mAsyncEvent, 11);
    IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
        setFeaturesCmd, "RestoreWrAtomicity", true);

    struct nvme_gen_cq acqMetrics = acq->GetQMetrics();
    IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
        getFeaturesCmd, "RestoreAsyncEvent", true);
    union CE ce = acq->PeekCE(acqMetrics.head_ptr);

    if (mAsyncEvent != ce.t.dw0) {
        LOG_ERR("AsyncEvent restore to original state failed. "
            "(Actual: Expected) = (0x%04X:0x%04X)", ce.t.dw0, mAsyncEvent);
        return false;
    }
    return true;
}
Exemplo n.º 4
0
uint16_t
GetLogPage::GetLID() const
{
    uint16_t curVal = GetWord(10, 0);
    LOG_NRM("Getting LID 0x%04X", curVal);
    return curVal;
}
Exemplo n.º 5
0
bool
RestoreState()
{
    // For the majority of test groups this feature most likely won't be needed
    LOG_NRM("Restoring state is intended to be over ridden in children");
    return true;
}
Exemplo n.º 6
0
Arquivo: sq.cpp Projeto: 10jul/tnvme
void
SQ::Send(SharedCmdPtr cmd, uint16_t &uniqueId)
{
    int rc;
    struct nvme_64b_send io;


    // Detect if doing something that looks suspicious/incorrect/illegal
    if (gCtrlrConfig->IsStateEnabled() == false)
        LOG_WARN("Sending cmds to a disabled DUT is suspicious");

    io.q_id = GetQId();
    io.bit_mask = (send_64b_bitmask)(cmd->GetPrpBitmask() |
        cmd->GetMetaBitmask());
    io.meta_buf_id = cmd->GetMetaBufferID();
    io.data_buf_size = cmd->GetPrpBufferSize();
    io.data_buf_ptr = cmd->GetROPrpBuffer();
    io.cmd_buf_ptr = cmd->GetCmd()->GetBuffer();
    io.data_dir = cmd->GetDataDir();

    LOG_NRM("Send cmd opcode 0x%02X, payload size 0x%04X, to SQ id 0x%02X",
        cmd->GetOpcode(), io.data_buf_size, io.q_id);

    if ((rc = ioctl(mFd, NVME_IOCTL_SEND_64B_CMD, &io)) < 0)
        throw FrmwkEx(HERE, "Error sending cmd, rc =%d", rc);

    // Allow tnvme to learn of the unique cmd ID which was assigned by dnvme
    uniqueId = io.unique_id;
}
Exemplo n.º 7
0
void
StartingLBAMeta_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);
        }
    }
}
Exemplo n.º 8
0
void
Write::SetSLBA(uint64_t lba)
{
    LOG_NRM("Setting SLBA = 0x%016llX", (long long unsigned int)lba);
    SetDword((uint32_t)(lba >> 0), 10);
    SetDword((uint32_t)(lba >> 32), 11);
}
bool
GrpAdminSetGetFeatCombo::RestoreVolWrCache(SharedASQPtr asq, SharedACQPtr acq)
{
    SharedGetFeaturesPtr getFeaturesCmd =
        SharedGetFeaturesPtr(new GetFeatures());
    SharedSetFeaturesPtr setFeaturesCmd =
        SharedSetFeaturesPtr(new SetFeatures());

    LOG_NRM("Restoring state with VWC = 0x%04X", mVolWrCache);
    setFeaturesCmd->SetFID(FID[FID_VOL_WR_CACHE]);
    getFeaturesCmd->SetFID(FID[FID_VOL_WR_CACHE]);

    setFeaturesCmd->SetDword(mVolWrCache, 11);
    IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
        setFeaturesCmd, "RestoreVWC", true);

    struct nvme_gen_cq acqMetrics = acq->GetQMetrics();
    IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
        getFeaturesCmd, "RestoreVWC", true);
    union CE ce = acq->PeekCE(acqMetrics.head_ptr);

    if (mVolWrCache != ce.t.dw0) {
        LOG_ERR("VWC restore to original state failed. "
            "(Actual: Expected) = (0x%04X:0x%04X)", ce.t.dw0, mVolWrCache);
        return false;
    }
    return true;
}
void
GrpAdminSetGetFeatCombo::SaveIRQCoalescing(SharedASQPtr asq, SharedACQPtr acq)
{
    LOG_NRM("Create Get features cmd");
    SharedGetFeaturesPtr getFeaturesCmd =
        SharedGetFeaturesPtr(new GetFeatures());

    getFeaturesCmd->SetFID(FID[FID_IRQ_COALESCING]);
    struct nvme_gen_cq acqMetrics = acq->GetQMetrics();
    IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
        getFeaturesCmd, "SaveFeatIRQCoalescing", true);
    union CE ce = acq->PeekCE(acqMetrics.head_ptr);
    mIrqCoalescing = ce.t.dw0;
    LOG_NRM("Default irq coalescing using Get Features = 0x%04X",
        mIrqCoalescing);
}
bool
GrpAdminSetGetFeatCombo::RestoreTLER(SharedASQPtr asq, SharedACQPtr acq)
{
    SharedGetFeaturesPtr getFeaturesCmd =
        SharedGetFeaturesPtr(new GetFeatures());
    SharedSetFeaturesPtr setFeaturesCmd =
        SharedSetFeaturesPtr(new SetFeatures());

    LOG_NRM("Restoring state with TLER = 0x%04X", mTimeLimErrRec);
    setFeaturesCmd->SetFID(FID[FID_ERR_RECOVERY]);
    getFeaturesCmd->SetFID(FID[FID_ERR_RECOVERY]);

    setFeaturesCmd->SetDword(mTimeLimErrRec, 11);
    IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
        setFeaturesCmd, "RestoreTLER", true);

    struct nvme_gen_cq acqMetrics = acq->GetQMetrics();
    IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
        getFeaturesCmd, "RestoreTLER", true);
    union CE ce = acq->PeekCE(acqMetrics.head_ptr);

    if (mTimeLimErrRec != ce.t.dw0) {
        LOG_ERR("TLER restore to original state failed. "
            "(Actual: Expected) = (0x%04X:0x%04X)", ce.t.dw0, mTimeLimErrRec);
        return false;
    }
    return true;
}
void
GrpAdminSetGetFeatCombo::SaveVolWrCache(SharedASQPtr asq, SharedACQPtr acq)
{
    LOG_NRM("Create Get features cmd");
    SharedGetFeaturesPtr getFeaturesCmd =
        SharedGetFeaturesPtr(new GetFeatures());

    getFeaturesCmd->SetFID(FID[FID_VOL_WR_CACHE]);
    struct nvme_gen_cq acqMetrics = acq->GetQMetrics();
    IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
        getFeaturesCmd, "SaveFeatVWC", true);
    union CE ce = acq->PeekCE(acqMetrics.head_ptr);
    mVolWrCache = ce.t.dw0;
    LOG_NRM("Default volatile write cache using Get Features = 0x%04X",
        mVolWrCache);
}
Exemplo n.º 13
0
bool
GrpAdminSetGetFeatCombo::RestoreTMPTH(SharedASQPtr asq, SharedACQPtr acq)
{
    SharedGetFeaturesPtr getFeaturesCmd =
        SharedGetFeaturesPtr(new GetFeatures());
    SharedSetFeaturesPtr setFeaturesCmd =
        SharedSetFeaturesPtr(new SetFeatures());

    LOG_NRM("Restoring state with TMPTH = 0x%04X", mTmpThreshold);
    setFeaturesCmd->SetFID(BaseFeatures::FID_TEMP_THRESHOLD);
    getFeaturesCmd->SetFID(BaseFeatures::FID_TEMP_THRESHOLD);

    setFeaturesCmd->SetDword(mTmpThreshold, 11);
    IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
        setFeaturesCmd, "RestoreTMPTH", true);

    struct nvme_gen_cq acqMetrics = acq->GetQMetrics();
    IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
        getFeaturesCmd, "RestoreTMPTH", true);
    union CE ce = acq->PeekCE(acqMetrics.head_ptr);

    if (mTmpThreshold != ce.t.dw0) {
        LOG_ERR("TMPTH restore to original state failed. "
            "(Actual: Expected) = (0x%04X:0x%04X)", ce.t.dw0, mTmpThreshold);
        return false;
    }
    return true;
}
Exemplo n.º 14
0
void
MaxIOQMSIXManyTo1_r10b::VerifyData(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, "RdCmd"),
            "Read command");
        writeCmd->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "WrCmd"),
            "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, "RdCmdMeta"),
                "Read command with meta data");
            writeCmd->Dump(
                FileSystem::PrepDumpFile(mGrpName, mTestName, "WrCmdMeta"),
                "Write command with meta data");
            throw FrmwkEx(HERE, "Meta data miscompare");
        }
    }
}
Exemplo n.º 15
0
bool
CtrlrConfig::SetIOSQES(uint8_t value)
{
    LOG_NRM("Writing CC.IOSQES = 0x%02X; (2^%d) = %d", value, value,
        (1 << value));
    return SetRegValue(value, 0x0f, CC_IOSQES, CC_SH_IOSQES);
}
Exemplo n.º 16
0
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++;
    }
}
Exemplo n.º 17
0
void
QIDVariations_r10b::ReapVerifyOnCQ(SharedIOCQPtr iocq, SharedIOSQPtr iosq)
{
    uint32_t numCE;
    uint32_t ceRemain;
    uint32_t numReaped;
    uint32_t isrCount;

    LOG_NRM("Reap and verify CE.");
    SharedMemBufferPtr ceMemIOCQ = SharedMemBufferPtr(new MemBuffer());
    for (uint32_t nCmds = 1; nCmds < iosq->GetNumEntries(); nCmds++) {
        LOG_NRM("Wait for the CE to arrive in IOCQ");
        if (iocq->ReapInquiryWaitSpecify(CALC_TIMEOUT_ms(1), 1, numCE,
            isrCount) == false) {
            iocq->Dump(
                FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", "reapInq"),
                "Unable to see any CE's in IOCQ, dump entire CQ contents");
            throw FrmwkEx(HERE, "Unable to see completion of cmd");
        }

        LOG_NRM("The CQ's metrics B4 reaping holds head_ptr needed");
        struct nvme_gen_cq iocqMetrics = iocq->GetQMetrics();
        KernelAPI::LogCQMetrics(iocqMetrics);

        if ((numReaped = iocq->Reap(ceRemain, ceMemIOCQ, isrCount, 1, true))
            != 1) {
            iocq->Dump(
                FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", "reap"),
                "Unable to see any CE's in IOCQ, dump entire CQ contents");
            throw FrmwkEx(HERE, "Verified there was 1 CE, but reaping failed");
        }

        LOG_NRM("The reaped CE is...");
        iocq->LogCE(iocqMetrics.head_ptr);

        union CE ce = iocq->PeekCE(iocqMetrics.head_ptr);
        ProcessCE::Validate(ce);  // throws upon error

        if (ce.n.SQID != iosq->GetQId()) {
            iocq->Dump(
                FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", "sqId"),
                "Wrong SQID in the CE of IOCQ, dump entire CQ contents");
            throw FrmwkEx(HERE, "Invalid SQID %d in CE, expected SQID", ce.n.SQID,
                iosq->GetQId());
        }
    }
}
Exemplo n.º 18
0
bool
Group::GetTestDependency(TestRef test, TestRef &cfgDepend,
    TestIteratorType &seqDepend)
{
    // Assume failure, ignore cfgDepend & seqDepend
    cfgDepend = test;
    seqDepend = -1;

    if (test.group == mGrpNum) {
        if ((test.yLev == 0) && (test.zLev == 0)) {
            LOG_NRM("Targeted test has zero dependencies");
            return true;
        } else if (test.zLev == 0) {
            cfgDepend.Init(test.group, test.xLev, 0, 0);
            if (TestExists(cfgDepend)) {
                LOG_NRM("Targeted test has a configuration dependency");
                return true;
            } else {
                LOG_ERR("Unable to locate configuration dependency");
                return false;
            }
        } else {
            TestRef seqTest(test.group, test.xLev, test.yLev, 0);
            if (TestRefToIterator(seqTest, seqDepend)) {
                LOG_NRM("Targeted test has a sequence dependency");
            } else {
                LOG_ERR("Unable to locate sequence test dependency");
                return false;
            }

            // There may or may not be a configuration dependency
            if (test.yLev != 0) {
                cfgDepend.Init(test.group, test.xLev, 0, 0);
                if (TestExists(cfgDepend)) {
                    LOG_NRM("Targeted test has a configuration dependency");
                    return true;
                } else {
                    LOG_ERR("Unable to locate configuration dependency");
                    return false;
                }
            }
            return true;
        }
    }
    LOG_ERR("Targeted test does not belong to this group: %ld", mGrpNum);
    return false;
}
Exemplo n.º 19
0
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);
    }
}
Exemplo n.º 20
0
bool
CtrlrConfig::GetEN(uint8_t &value)
{
    bool retVal;
    retVal = GetRegValue(value, CC_EN, CC_SH_EN);
    LOG_NRM("Reading CC.EN = 0x%02X", value);
    return retVal;
}
Exemplo n.º 21
0
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
    SharedIOSQPtr iosq = CAST_TO_IOSQ(gRsrcMngr->GetObj(IOSQ_GROUP_ID));
    SharedIOCQPtr iocq = CAST_TO_IOCQ(gRsrcMngr->GetObj(IOCQ_GROUP_ID));

    SharedFlushPtr flushCmd = SharedFlushPtr(new Flush());
    ConstSharedIdentifyPtr idCtrlr = gInformative->GetIdentifyCmdCtrlr();
    for (uint64_t i = 1; i <= idCtrlr->GetValue(IDCTRLRCAP_NN); i++) {
        LOG_NRM("Processing namspc %ld", i);
        flushCmd->SetNSID(i);

        IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq,
            flushCmd, "none.set", true);

        LOG_NRM("Set all cmd's rsvd bits");
        uint32_t work = flushCmd->GetDword(0);
        work |= 0x0000fc00;      // Set DW0_b15:10 bits
        flushCmd->SetDword(work, 0);

        flushCmd->SetDword(0xffffffff, 2);
        flushCmd->SetDword(0xffffffff, 3);
        flushCmd->SetDword(0xffffffff, 4);
        flushCmd->SetDword(0xffffffff, 5);
        flushCmd->SetDword(0xffffffff, 6);
        flushCmd->SetDword(0xffffffff, 7);
        flushCmd->SetDword(0xffffffff, 8);
        flushCmd->SetDword(0xffffffff, 9);
        flushCmd->SetDword(0xffffffff, 10);
        flushCmd->SetDword(0xffffffff, 11);
        flushCmd->SetDword(0xffffffff, 12);
        flushCmd->SetDword(0xffffffff, 13);
        flushCmd->SetDword(0xffffffff, 14);
        flushCmd->SetDword(0xffffffff, 15);

        IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq,
            flushCmd, "all.set", true);
    }
}
Exemplo n.º 22
0
uint8_t
FormatNVM::GetSES() const
{
    uint8_t work;
    LOG_NRM("Getting SES");
    work = GetByte(10, 1);
    return ((work & BYTE_BITMASK_SES) >> 1);
}
Exemplo n.º 23
0
uint8_t
FormatNVM::GetLBAF() const
{
    uint8_t work;
    LOG_NRM("Getting LBAF");
    work = GetByte(10, 0);
    return ((work & BYTE_BITMASK_LBAF) >> 0);
}
Exemplo n.º 24
0
uint8_t
FormatNVM::GetPI() const
{
    uint8_t work;
    LOG_NRM("Getting PI");
    work = GetByte(10, 0);
    return ((work & BYTE_BITMASK_PI) >> 5);
}
Exemplo n.º 25
0
void
SetFeatures::SetIntVecConfig(uint8_t cd, uint16_t iv)
{
    LOG_NRM("Setting interrupt vector configuration");

    SetIntVecConfigCD(cd);
    SetIntVecConfigIV(iv);
}
Exemplo n.º 26
0
bool
CtrlrConfig::GetCSS(uint8_t &value)
{
    bool retVal;
    retVal = GetRegValue(value, CC_CSS, CC_SH_CSS);
    LOG_NRM("Reading CC.CSS = 0x%02X", value);
    return retVal;
}
Exemplo n.º 27
0
void
NamespaceManagement::SetSEL(uint8_t sel)
{
    LOG_NRM("Setting SEL = 0x%01X", sel);
//    uint8_t val = GetByte(10, 0);
//    SetByte(val | (sel & 0xF), 10, 0); // 1st byte in DW10
    SetNibble(sel, 10, 0);
}
Exemplo n.º 28
0
uint16_t
GetLogPage::GetNUMD() const
{
    uint16_t curVal = GetWord(10, 1);
    curVal &= NUMD_BITMASK;
    LOG_NRM("Getting NUMD 0x%04X", curVal);
    return curVal;
}
Exemplo n.º 29
0
void
ProtInfoIgnoreBare_r10b::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]);

        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, DEFAULT_CMD_WAIT_ms, iosq,
                iocq, readCmd, context, true);
        }
    }
}
Exemplo n.º 30
0
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);
        }
    }
}