I have PCI-E board which adds 4 serial ports to the system. So I'm developing bus driver for this hardware.
My idea to create 4 PDOs devices, provide necessary resources and use standard serial driver from WDK examples (with minimal changes if necessary).
But I have some issue with resource rebalancing.
I do the following:
1) The bus driver receives a memory from the Pnp manager in EvtDevicePrepareHardware.
2) This region of memory is divided into several sub-regions and distributed between child devices in EvtDeviceResourceRequirementsQuery.
3) The child device driver maps the provided memory in the EvtDevicePrepareHardware function.
The problem is that the Pnp manager starts rebalancing resources because the bus driver and child device driver own overlapping areas of memory.
In Device Manager, I can see that a bus device and child devices may own overlapped resources.
How to allocate overlapped resources to child devices to avoid resource rebalancing?
This is source code (from bus driver) which provides resources to child devices in regions EvtDeviceResourceRequirementsQuery:
serialNo = ...
status = RtlIoEncodeMemIoResource(&descriptor, CmResourceTypeMemory, 0, PAGE_SIZE, baseAddr.LowPart + (serialNo - 1) * 0x40, baseAddr.LowPart + (serialNo - 1) * 0x40 + 0x40);
descriptor.ShareDisposition = CmResourceShareShared;
descriptor.ShareDisposition = CM_RESOURCE_MEMORY_READ_WRITE;
status = WdfIoResourceListAppendDescriptor(reslist, &descriptor);
Thanks in advance!
It looks like you're new here. If you want to get involved, click one of these buttons!
|Upcoming OSR Seminars|
|Writing WDF Drivers||21 Oct 2019||OSR Seminar Space & ONLINE|
|Internals & Software Drivers||18 Nov 2019||Dulles, VA|
|Kernel Debugging||30 Mar 2020||OSR Seminar Space|
|Developing Minifilters||27 Apr 2020||OSR Seminar Space & ONLINE|