2014年5月18日星期日

Examples of how to modify the application to post plx9x5x own pci card

the hands of their own colleagues do it is a PCI card , FPGA those are customizable.
I want to PLx9x5x driver ( example the WDK , WDF mode ) switch to change it , but I do not know how to start .

currently conducting a number of attempts , the post- inf of devID and vendorID modify the device manager pci card can be identified . But the next step debugging using windbg , not even driverEntry have entered not . Do not understand how it was.

experts provide ideas .
------ Solution ---------------------------------------- ----

yes. The first parameter
WdfCommonBufferCreate of : WDFDMAENABLER DmaEnabler is to obtain the corresponding DMA enabler object through WdfDmaEnablerCreate.
You can look , WdfDmaEnablerCreate return is likely to be a failure.
WdfDmaEnablerCreate method


sample code is used to initialize the various variables. Read the relevant address register / memory space.
So, according to your own needs may have to be modified.

processing can keep this Switch / case approach.
------ For reference only -------------------------------------- -
driver installed successfully yet ?
------ For reference only -------------------------------------- -
novice or recommend the use of JUGO of WINDRIVER, develop simple ;

WDK inside PLX9X5X example just to demonstrate how to develop WDF drivers, drivers from the practical application is still a considerable distance , such IOCTL processing .

In addition , WDK driver development debugging requires the use TRACEVIEW, the details you can look C:. \ WinDDK \ 7600.16385.1 \ tools \ tracing \ i386 inside help
------ For reference only ---------------------------------------

...... did not understand what you mean . If you have the drive , I also developed what .
------ For reference only -------------------------------------- -

driver is loaded by the system ? The process of installing the driver there is nothing wrong ? Inside the Device Manager , the device status is correct ?
system is in the process of loading the driver was going to call driverEntry 's .
------ For reference only -------------------------------------- -
Thanks for the reply to the two friends . I am now able to get into the system resources that step , that is prepareHardware there. Resource allocation framework and drive inconsistent, fail to quit. Config error saying configuration error . About how to allocate resources framework , how to modify the code for the driver is still under study , please share.
No
into the drive before because the reasons are not familiar with the assembly , I added the statement DbgPrint go , it is more intuitive .

TRACEVIEW with a little, to generate a 200K file , but did not see the useful content after opening . DbgPrint way should say no essential difference , right? TraceEvent just use it to generate a log file ? Content or fill their own thing. Not figure it out.
------ For reference only -------------------------------------- -
further describe the problem.
WdfCmResourcesListGetDescriptor (ResourceTranslated, i) This function can not be understood , mainly confused ResourceTransltaed what the resources are , how the framework is a resource allocation . More confused desc returned by the function of each one are what meaning , specifically how to participate in the work . Please master wing .

I'm going to plug the card after the commissioning of the drive during the installation , it will go wrong at the following location :
if (! foundRegs && desc-> u.Memory.Length == 0x200)
value u.Memory.Length of decency get is 0x100.
I will modify the code if (! foundRegs && desc-> u.Memory.Length == 0x100)
then compile debug mistakes in :
if (! (foundRegs && foundSRAM)) {
TraceEvents (TRACE_LEVEL_ERROR, DBG_PNP, "PLxMapResources: Missing resources");
return STATUS_DEVICE_CONFIGURATION_ERROR;
}
device_configuration do not understand what went wrong in front of the code are system calls, not seen to be self- populated fields.
------ For reference only -------------------------------------- -
put your PCI devices Configuration Descriptor posted a look ?

If you do not understand the meaning of equipment Descriptor , then the function returns success WdfCmResourcesListGetDescriptor directly see, is not enough.
Also, try to complete some of the code is posted , it makes it easier to understand your problems encountered .
------ For reference only -------------------------------------- -
give you a code reference under
  

NTSTATUS
EvtDevicePrepareHardware
(
IN WDFDEVICE Device,
IN WDFCMRESLIST ResourceList,
IN WDFCMRESLIST ResourceListTranslated
)
{
ULONG i, j;
PHYSICAL_ADDRESS port; / / port address
ULONG port_len; / / length of port region
ULONG region_cnt = 0;
ULONG port_cnt = 0;
ULONG devTypeConfigSpace; / / find the device type.
PCM_PARTIAL_RESOURCE_DESCRIPTOR desc;
NTSTATUS status = STATUS_SUCCESS;
PDEVICE_CONTEXT devCtx;
BOOLEAN error = FALSE;
ULONG reg = 0;

UNREFERENCED_PARAMETER (Device);
UNREFERENCED_PARAMETER (ResourceList);

PAGED_CODE ();

TraceEvents (TRACE_LEVEL_INFORMATION, DBG_INIT, __ DRIVER_NAME "-> EvtDevicePrepareHardware");

devCtx = GetDeviceContext (Device); / / get pointer to device context area

for (j = 0; j {
devCtx-> base [j] = NULL;
devCtx-> Direct_Baddr [j] = NULL;
devCtx-> Mdl [j] = NULL;
}

for (i = 0; i {
desc = WdfCmResourceListGetDescriptor (ResourceListTranslated, i); / / pointer to individual resource
if (! desc)
return STATUS_DEVICE_CONFIGURATION_ERROR;

switch (desc-> Type)
{
case CmResourceTypeMemory: / / Memory Region
port = desc-> u.Memory.Start; / / beginning address of a contiguous range of memory locations
port_len = desc-> u.Memory.Length; / / number of bytes in the range

devCtx-> base [region_cnt] = (PULONG) MmMapIoSpace (port, port_len, MmNonCached); / / map phys addr to virt.. ; addr
devCtx-> base_len [region_cnt] = (ULONG) desc-> u.Memory.Length;

if (! devCtx-> base [region_cnt]) / / insufficient space
{
for (j = 0; j <= region_cnt; j + +) / / Undo mappings
if (devCtx-> mem_mapped [j])
{
MmUnmapIoSpace (devCtx-> base [j], devCtx-> base_len [j]);
devCtx-> mem_mapped [j] = FALSE;
}
return STATUS_INSUFFICIENT_RESOURCES;
}
devCtx-> mem_mapped [region_cnt] = TRUE; / / indicates valid memory regions
region_cnt + +; / / increment region indices
break;

case CmResourceTypePort: / / I / O Region
devCtx-> base_port [port_cnt] = (PULONG) desc-> u.Port.Start.LowPart;
devCtx-> base_port_len [port_cnt] = desc-> u.Port.Length;
port_cnt + +;
break;

case CmResourceTypeInterrupt:
/ /
/ / Deal with interrupts initialization in another routine.
/ / Here just prevent to enter error report part later.
/ /
break;

case CmResourceTypeDevicePrivate:
break;

default:
break;
}
}
TraceEvents (TRACE_LEVEL_INFORMATION, DBG_INIT, __ DRIVER_NAME "<- EvtDevicePrepareHardware");

return status;
}


NTSTATUS
EvtDeviceReleaseHardware (
IN WDFDEVICE Device,
IN WDFCMRESLIST ResourceListTranslated
)
{
NTSTATUS status = STATUS_SUCCESS;
ULONG i;
ULONG region_cnt = 0;
PCM_PARTIAL_RESOURCE_DESCRIPTOR desc;
PDEVICE_CONTEXT devCtx;

TraceEvents (TRACE_LEVEL_INFORMATION, DBG_PNP, __ DRIVER_NAME "-> EvtDeviceReleaseHardware");

devCtx = GetDeviceContext (Device);
for (i = 0; i {
devCtx-> Direct_Baddr [i] = NULL;
devCtx-> DeviceType = e_DevType_NULL;
devCtx-> DeviceReg.rINTCSR = 0;
devCtx-> TransferMode = e_TransferMode_Block;
/ / devCtx-> InterruptCapable = FALSE;
}

for (i = 0; i {
desc = WdfCmResourceListGetDescriptor (ResourceListTranslated, i);
if (! desc)
return STATUS_DEVICE_CONFIGURATION_ERROR;

switch (desc-> Type)
{
case CmResourceTypeMemory:
MmUnmapIoSpace (devCtx-> base [region_cnt], devCtx-> base_len [region_cnt]);
devCtx-> mem_mapped [region_cnt] = FALSE;
region_cnt + +;
break;

default:
break;

}
}

TraceEvents (TRACE_LEVEL_INFORMATION, DBG_PNP, __ DRIVER_NAME "<- EvtDeviceReleaseHardware");

return status;
}

------ For reference only ---------------------------------- -----
I think I need to describe the problem :
1, question the premise that the card is a PCI card irrelevant , the driver is an example of the WDK Plx9x5x
2, the current situation is Plx9x5x driver can not successfully install PCI cards up ( which is, of course )
3, my question is, how to modify Plx9x5x drive so that it could successfully install the PCI card up .
4, the specific situation : I have changed the ID value that allows the driver began to mount , but it would be wrong to continue the installation process . I now want to know specifically where the purpose is wrong, why is it wrong , and how to change .

gradually result is an error in the debug : PLxPrepareHardware function:
if (! (foundRegs && foundSRAM)) {
TraceEvents (TRACE_LEVEL_ERROR, DBG_PNP,
"PLxMapResources: Missing resources ");
return STATUS_DEVICE_CONFIGURATION_ERROR;
}
Here the program returned.
in front for (i = 0; i desc = WdfCmResourceListGetDescriptor (ResourcesTranslated, i);
switch (desc-> Type) judgment , the debugger get to desc-> value respectively three Type : 0x03, 0x81, 0x02, 0x03 which corresponds to the case CmResourceTypeMemory: branch , another two values ​​do not correspond to the statement processing .

I want to know is what CmResourceTypeMemory is ? What CmResourceTypePort again ? Other types of how to handle it ? For example 0x81. Please do not tell me CmResourceTypeMemory is the type of memory resources , CmResourceTypePort is the port type of resource ...... literally , I want to know is the principle , windows what ResourcesTranslated assigned to the drive frame , what they are, are responsible for doing .


there is a problem : PLxInitializeDMA function called before PLxPrepareHardware, all return value status is 0 , it should be said execution is correct, for example:
status = WdfCommonBufferCreate (DevExt-> DmaEnabler,
DevExt-> WriteCommonBufferSize,
WDF_NO_OBJECT_ATTRIBUTES,
& DevExt-> WriteCommonBuffer);
However , windbg debugging information , DevExt-> WriteCommonBuffer value , I do not know really failed to create a buffer , or because of other reasons not display correctly ( it creates a buffer success ) .


------ For reference only ---------------------------------- -----
complete code is as follows :
NTSTATUS
PLxPrepareHardware(
    IN PDEVICE_EXTENSION DevExt,
    IN WDFCMRESLIST     ResourcesTranslated
    )
/*++
Routine Description:

    Gets the HW resources assigned by the bus driver from the start-irp
    and maps it to system address space.

Arguments:

    DevExt      Pointer to our DEVICE_EXTENSION

Return Value:

     None

--*/
{
    ULONG               i;
    NTSTATUS            status = STATUS_SUCCESS;
    CHAR              * bar;

    BOOLEAN             foundRegs      = FALSE;
    PHYSICAL_ADDRESS    regsBasePA     = {0};
    ULONG               regsLength     = 0;

    BOOLEAN             foundSRAM      = FALSE;
    PHYSICAL_ADDRESS    SRAMBasePA     = {0};
    ULONG               SRAMLength     = 0;

    BOOLEAN             foundSRAM2     = FALSE;
    PHYSICAL_ADDRESS    SRAM2BasePA    = {0};
    ULONG               SRAM2Length    = 0;

    BOOLEAN             foundPort      = FALSE;
    PHYSICAL_ADDRESS    PortBasePA     = {0};
    ULONG               PortLength     = 0;

    PCM_PARTIAL_RESOURCE_DESCRIPTOR  desc;

    PAGED_CODE();

    //
    // Parse the resource list and save the resource information.
    //
    for (i=0; i < WdfCmResourceListGetCount(ResourcesTranslated); i++) {

        desc = WdfCmResourceListGetDescriptor( ResourcesTranslated, i );

        if(!desc) {
            TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
                        "WdfResourceCmGetDescriptor failed");
            return STATUS_DEVICE_CONFIGURATION_ERROR;
        }

        switch (desc->Type) {

            case CmResourceTypeMemory:

                bar = NULL;

                if (foundSRAM && !foundSRAM2 &&
                    desc->u.Memory.Length == PCI9656_SRAM_SIZE) {

                    SRAM2BasePA = desc->u.Memory.Start;
                    SRAM2Length = desc->u.Memory.Length;
                    foundSRAM2 = TRUE;
                    bar = "BAR3";
                }

                if (foundRegs && !foundSRAM &&
                    desc->u.Memory.Length == PCI9656_SRAM_SIZE) {

                    SRAMBasePA = desc->u.Memory.Start;
                    SRAMLength = desc->u.Memory.Length;
                    foundSRAM = TRUE;
                    bar = "BAR2";
                }

                if (!foundRegs &&
                    desc->u.Memory.Length == 0x200) {

                    regsBasePA = desc->u.Memory.Start;
                    regsLength = desc->u.Memory.Length;
                    foundRegs = TRUE;
                    bar = "BAR0";
                }

                TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,
                            " - Memory Resource [%I64X-%I64X] %s",
                            desc->u.Memory.Start.QuadPart,
                            desc->u.Memory.Start.QuadPart +
                            desc->u.Memory.Length,
                            (bar) ? bar : "<unrecognized>" );
                break;

            case CmResourceTypePort:

                bar = NULL;

                if (!foundPort &&
                    desc->u.Port.Length >= 0x100) {

                    PortBasePA = desc->u.Port.Start;
                    PortLength = desc->u.Port.Length;
                    foundPort = TRUE;
                    bar = "BAR1";
                }

                TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,
                            " - Port   Resource [%08I64X-%08I64X] %s",
                            desc->u.Port.Start.QuadPart,
                            desc->u.Port.Start.QuadPart +
                            desc->u.Port.Length,
                            (bar) ? bar : "<unrecognized>" );
                break;

            default:
                //
                // Ignore all other descriptors
                //
                break;
        }
    }

    if (!(foundRegs && foundSRAM)) {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
                    "PLxMapResources: Missing resources");
        return STATUS_DEVICE_CONFIGURATION_ERROR;
    }

    //
    // Map in the Registers Memory resource: BAR0
    //
    DevExt->RegsBase = (PUCHAR) MmMapIoSpace( regsBasePA,
                                              regsLength,
                                              MmNonCached );

    if (!DevExt->RegsBase) {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
                    " - Unable to map Registers memory %08I64X, length %d",
                    regsBasePA.QuadPart, regsLength);
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    DevExt->RegsLength = regsLength;

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,
                " - Registers %p, length %d",
                DevExt->RegsBase, DevExt->RegsLength );

    //
    // Set seperated pointer to PCI9656_REGS structure.
    //
    DevExt->Regs = (PPCI9656_REGS) DevExt->RegsBase;

    //
    // Map in the SRAM Memory Space resource: BAR2
    //
    DevExt->SRAMBase = (PUCHAR) MmMapIoSpace( SRAMBasePA,
                                              SRAMLength,
                                              MmNonCached );

    if (!DevExt->SRAMBase) {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
                    " - Unable to map SRAM memory %08I64X, length %d",
                    SRAMBasePA.QuadPart,  SRAMLength);
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    DevExt->SRAMLength = SRAMLength;

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,
                " - SRAM      %p, length %d",
                DevExt->SRAMBase, DevExt->SRAMLength );

    return status;
}

adjourned
------ For reference only --------------------------------- ------
NTSTATUS
PLxInitializeDMA(
    IN PDEVICE_EXTENSION DevExt
    )
/*++
Routine Description:

    Initializes the DMA adapter.

Arguments:

    DevExt      Pointer to our DEVICE_EXTENSION

Return Value:

     None

--*/
{
    NTSTATUS    status;
    WDF_OBJECT_ATTRIBUTES attributes;

    PAGED_CODE();

    //
    // PLx PCI9656 DMA_TRANSFER_ELEMENTS must be 16-byte aligned
    //
    WdfDeviceSetAlignmentRequirement( DevExt->Device,
                                      PCI9656_DTE_ALIGNMENT_16 );

    //
    // Create a new DMA Enabler instance.
    // Use Scatter/Gather, 64-bit Addresses, Duplex-type profile.
    //
    {
        WDF_DMA_ENABLER_CONFIG   dmaConfig;

        WDF_DMA_ENABLER_CONFIG_INIT( &dmaConfig,
                                     WdfDmaProfileScatterGather64Duplex,
                                     DevExt->MaximumTransferLength );

        TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,
                    " - The DMA Profile is WdfDmaProfileScatterGather64Duplex");

        status = WdfDmaEnablerCreate( DevExt->Device,
                                      &dmaConfig,
                                      WDF_NO_OBJECT_ATTRIBUTES,
                                      &DevExt->DmaEnabler );

        if (!NT_SUCCESS (status)) {

            TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
                        "WdfDmaEnablerCreate failed: %!STATUS!", status);
            return status;
        }
    }

    //
    // Allocate common buffer for building writes
    //
    // NOTE: This common buffer will not be cached.
    //       Perhaps in some future revision, cached option could
    //       be used. This would have faster access, but requires
    //       flushing before starting the DMA in PLxStartWriteDma.
    //
    DevExt->WriteCommonBufferSize =
        sizeof(DMA_TRANSFER_ELEMENT) * DevExt->WriteTransferElements;

    status = WdfCommonBufferCreate( DevExt->DmaEnabler,
                                    DevExt->WriteCommonBufferSize,
                                    WDF_NO_OBJECT_ATTRIBUTES,
                                    &DevExt->WriteCommonBuffer );

    if (!NT_SUCCESS(status)) {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
                    "WdfCommonBufferCreate (write) failed: %!STATUS!", status);
        return status;
    }


    DevExt->WriteCommonBufferBase =
        WdfCommonBufferGetAlignedVirtualAddress(DevExt->WriteCommonBuffer);

    DevExt->WriteCommonBufferBaseLA =
        WdfCommonBufferGetAlignedLogicalAddress(DevExt->WriteCommonBuffer);

    RtlZeroMemory( DevExt->WriteCommonBufferBase,
                   DevExt->WriteCommonBufferSize);

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,
                "WriteCommonBuffer 0x%p  (#0x%I64X), length %I64d",
                DevExt->WriteCommonBufferBase,
                DevExt->WriteCommonBufferBaseLA.QuadPart,
                WdfCommonBufferGetLength(DevExt->WriteCommonBuffer) );

    //
    // Allocate common buffer for building reads
    //
    // NOTE: This common buffer will not be cached.
    //       Perhaps in some future revision, cached option could
    //       be used. This would have faster access, but requires
    //       flushing before starting the DMA in PLxStartReadDma.
    //
    DevExt->ReadCommonBufferSize =
        sizeof(DMA_TRANSFER_ELEMENT) * DevExt->ReadTransferElements;

    status = WdfCommonBufferCreate( DevExt->DmaEnabler,
                                    DevExt->ReadCommonBufferSize,
                                    WDF_NO_OBJECT_ATTRIBUTES,
                                    &DevExt->ReadCommonBuffer );

    if (!NT_SUCCESS(status)) {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
                    "WdfCommonBufferCreate (read) failed %!STATUS!", status);
        return status;
    }

    DevExt->ReadCommonBufferBase =
        WdfCommonBufferGetAlignedVirtualAddress(DevExt->ReadCommonBuffer);

    DevExt->ReadCommonBufferBaseLA =
        WdfCommonBufferGetAlignedLogicalAddress(DevExt->ReadCommonBuffer);

    RtlZeroMemory( DevExt->ReadCommonBufferBase,
                   DevExt->ReadCommonBufferSize);

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,
                "ReadCommonBuffer  0x%p  (#0x%I64X), length %I64d",
                DevExt->ReadCommonBufferBase,
                DevExt->ReadCommonBufferBaseLA.QuadPart,
                WdfCommonBufferGetLength(DevExt->ReadCommonBuffer) );

    //
    // Since we are using sequential queue and processing one request
    // at a time, we will create transaction objects upfront and reuse
    // them to do DMA transfer. Transactions objects are parented to
    // DMA enabler object by default. They will be deleted along with
    // along with the DMA enabler object. So need to delete them
    // explicitly.
    //
    WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, TRANSACTION_CONTEXT);
    
    status = WdfDmaTransactionCreate( DevExt->DmaEnabler,
                                      &attributes,
                                      &DevExt->ReadDmaTransaction);

    if(!NT_SUCCESS(status)) {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
                    "WdfDmaTransactionCreate(read) failed: %!STATUS!", status);
        return status;
    }

    WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, TRANSACTION_CONTEXT);
    //
    // Create a new DmaTransaction.
    //
    status = WdfDmaTransactionCreate( DevExt->DmaEnabler,
                                      &attributes,
                                      &DevExt->WriteDmaTransaction );

    if(!NT_SUCCESS(status)) {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
                    "WdfDmaTransactionCreate(write) failed: %!STATUS!", status);
        return status;
    }

    return status;
}

------ For reference only -------------------------- -------------

TRACEVIEW answer my own question . It should be on the target machine , start , select pdb file. Actual use, when debugging single-step progress, goal chance to die, so do not immediately see the printed result traceEvents of
------ For reference only ------------ ---------------------------
baffling. Post a reply more than three ? ? ? ? You can not modify and delete their own posts ? ? ? ? ? These restrictions do csdn truth lie? ? ? ? ? ? ? ? ? ? ?
------ For reference only -------------------------------------- -
equipment Descriptor if you do not understand the meaning , then the function returns success WdfCmResourcesListGetDescriptor direct look , is not it enough ?

WdfCmResourcesListGetDescriptor function is to identify and resolve a variety of PCI Descriptor of . Examples of code is used to resolve Plx9x5x the relevant configuration , and you certainly do not apply directly to the board . Therefore, the function returns directly to STATUS_SUCCESS, the system will then follow-up function to call , good luck , loaded success.
------ For reference only -------------------------------------- -

Thank you. "Analysis Plx9x5x related configuration " is explained what I wanted. Would also like to ask two questions:
1, PLxInitializeDMA function called before PLxPrepareHardware, all return value status is 0 , it should be said execution is correct, for example:
status = WdfCommonBufferCreate (DevExt-> DmaEnabler,
DevExt-> WriteCommonBufferSize,
WDF_NO_OBJECT_ATTRIBUTES,
& DevExt-> WriteCommonBuffer);
However , windbg debugging information , DevExt-> WriteCommonBuffer value , I do not know really failed to create a buffer , or because of other reasons not display correctly ( it creates a buffer success ) .

The problem is not possible because DMA hardware itself no storage resources , so the application is successful operation , but did not get the resources ?

2, if it is your own card , part of my code below need to change it? The processing flow .

 switch (desc->Type) {

            case CmResourceTypeMemory:

                bar = NULL;

                if (foundSRAM && !foundSRAM2 &&
                    desc->u.Memory.Length == PCI9656_SRAM_SIZE) {

                    SRAM2BasePA = desc->u.Memory.Start;
                    SRAM2Length = desc->u.Memory.Length;
                    foundSRAM2 = TRUE;
                    bar = "BAR3";
                }

                if (foundRegs && !foundSRAM &&
                    desc->u.Memory.Length == PCI9656_SRAM_SIZE) {

                    SRAMBasePA = desc->u.Memory.Start;
                    SRAMLength = desc->u.Memory.Length;
                    foundSRAM = TRUE;
                    bar = "BAR2";
                }

                if (!foundRegs &&
                    desc->u.Memory.Length == 0x200) {

                    regsBasePA = desc->u.Memory.Start;
                    regsLength = desc->u.Memory.Length;
                    foundRegs = TRUE;
                    bar = "BAR0";
                }

                TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,
                            " - Memory Resource [%I64X-%I64X] %s",
                            desc->u.Memory.Start.QuadPart,
                            desc->u.Memory.Start.QuadPart +
                            desc->u.Memory.Length,
                            (bar) ? bar : "<unrecognized>" );
                break;

            case CmResourceTypePort:

                bar = NULL;

                if (!foundPort &&
                    desc->u.Port.Length >= 0x100) {

                    PortBasePA = desc->u.Port.Start;
                    PortLength = desc->u.Port.Length;
                    foundPort = TRUE;
                    bar = "BAR1";
                }

                TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,
                            " - Port   Resource [%08I64X-%08I64X] %s",
                            desc->u.Port.Start.QuadPart,
                            desc->u.Port.Start.QuadPart +
                            desc->u.Port.Length,
                            (bar) ? bar : "<unrecognized>" );
                break;

            default:
                //
                // Ignore all other descriptors
                //
                break;
        }
    }

------ For reference only ----------------------------------- ----
in order to continue, ready to find models of hardware , seeking recommendations can debug PLX9x5x board , the cheaper the better .
WDK said:
PLX9x5x
SUMMARY
This sample demonstrates how to write driver for a generic PCI device using Windows Driver Framework. The target hardware for this driver is . PLX9656/9653RDK-LITE board The product kit and the hardware specification are available at http: / / www.plxtech.com/products/tools/rdk/9xxxrdks/9656rdk-lite.htm.

PLX9656/9653RDK-LITE board can not find this stuff ......
------ For reference only -------------------- -------------------
you ready yet ?
------ For reference only -------------------------------------- -
say using plx9656 chip mean. . .

没有评论:

发表评论