none
WdfCmResourceListGetCount(ResourcesRaw); returns 0 RRS feed

  • Question

  • Hello All

    I am working on Intel E3900 apollo lake based processor. Where I am running a KMDF driver on Windows IOT Core OS.

    Using KMDF I am trying to access Hardware resources using MmMapIoSpace(); APIs. However "wdfcmresourcelistgetcount" function call returning a ZERO. I have created a PnPCallback for PrepareHardware function  and calling the wdfcmresourcelistgetcount function. Below is the code snippet, can someone point what I am doing wrong.

    NTSTATUS
    USBDriver1EvtDevicePrepareHardware(
    _In_ WDFDEVICE Device,
    _In_ WDFCMRESLIST ResourcesRaw,
    _In_ WDFCMRESLIST ResourcesTranslated
    )

    {
    NTSTATUS Status;
    ULONG ResCount;
    ULONG ResIndex;
    PCONTROLLER_CONTEXT ControllerContext;
    BOOLEAN MemoryResourceMapped;

    PAGED_CODE();

    // TraceEntry();
    //TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "%!FUNC! Entry");

    ControllerContext = DeviceGetControllerContext(Device);
    MemoryResourceMapped = FALSE;

    ResCount = WdfCmResourceListGetCount(ResourcesRaw);

            ResCount1 = WdfCmResourceListGetCount(ResourcesTranslated);
    Status = STATUS_SUCCESS;

    for (ResIndex = 0; ResIndex < ResCount; ResIndex++) {

    PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptorRaw;
    PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptorTranslated;

    ResourceDescriptorRaw = WdfCmResourceListGetDescriptor(
    ResourcesRaw,
    ResIndex);
    switch (ResourceDescriptorRaw->Type) {

    case CmResourceTypeMemory:
    if (MemoryResourceMapped == FALSE) {
    MemoryResourceMapped = TRUE;
    Status = RegistersCreate(Device, ResourceDescriptorRaw);
    // CHK_NT_MSG(Status, "Failed to read the HW registers");
    }
    break;

    case CmResourceTypeInterrupt:
    ResourceDescriptorTranslated = WdfCmResourceListGetDescriptor(
    ResourcesTranslated,
    ResIndex);
    /* Status = InterruptCreate(
    Device,
    ResourceDescriptorRaw,
    ResourceDescriptorTranslated);*/
    // CHK_NT_MSG(Status, "Failed to create WDFINTERRUPT object");
    break;

    default:
    break;
    }
    }

    NT_ASSERT(ControllerContext->DeviceInterrupt != NULL);

    //End:
    // TraceExit();
    return STATUS_SUCCESS;
    }

    Looking forward to get the solution

    Thank you & Regards

    Lokesh

    Monday, March 2, 2020 11:14 AM

All replies

  • How did you install the driver? If you used devcon install, you created a root enumerated device which will not have assigned resources. Instead you should use devcon update to apply your driver to an existing pnp device.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, March 3, 2020 6:20 AM