Resource Assignment Problem

Hi all,
A few weeks back, I started writing a windows kernel PnP driver
for reading System Management BIOS. There are other ways to read
SMBIOS but I just started for learning windows driver development.
Now, I have a problem. Since the driver is PnP, it receives PnP IRP
with minor code IRP_MN_FILTER_RESOURCE_REQUIREMENTS. On return from
handling IRP_MN_FILTER_RESOURCE_REQUIREMENTS, I passed PnP manager a
resource requirements list. Here is the list :-

reqResourceRequirementsList->ListSize =
sizeof(IO_RESOURCE_REQUIREMENTS_LIST);
reqResourceRequirementsList->List[0].Version = 1;
reqResourceRequirementsList->List[0].Revision = 1;
reqResourceRequirementsList->List[0].Count = 1;
reqResourceRequirementsList->List[0].Descriptors[0].Option = 0;
// Resource is required
reqResourceRequirementsList->List[0].Descriptors[0].Type =
CmResourceTypeMemory;
reqResourceRequirementsList->List[0].Descriptors[0].ShareDisposition
= CmResourceShareShared;
reqResourceRequirementsList->List[0].Descriptors[0].Flags =
CM_RESOURCE_MEMORY_READ_ONLY;
reqResourceRequirementsList->List[0].Descriptors[0].u.Memory.Length
= (0x000FFFFF - 0x000F0000);
reqResourceRequirementsList->List[0].Descriptors[0].u.Memory.Alignment
= (0x000FFFFF - 0x000F0000);
reqResourceRequirementsList->List[0].Descriptors[0].u.Memory.MinimumAddress.u.LowPart
= 0x000F0000;
reqResourceRequirementsList->List[0].Descriptors[0].u.Memory.MinimumAddress.u.HighPart
= 0;
reqResourceRequirementsList->List[0].Descriptors[0].u.Memory.MaximumAddress.u.LowPart
= 0x000FFFFF;
reqResourceRequirementsList->List[0].Descriptors[0].u.Memory.MaximumAddress.u.HighPart
= 0;

Now, when I receive PnP IRP with minor code IRP_MN_START_DEVICE, the
allocated raw and translated resources are NULL. So, my question is
that can we ask the PnP manager that we are going to use that part of
physical memory (i.e. 0x000F0000 to 0x000FFFFF) as read-only.

Thank you.

salman razzaq wrote:

A few weeks back, I started writing a windows kernel PnP driver
for reading System Management BIOS. There are other ways to read
SMBIOS but I just started for learning windows driver development.
Now, I have a problem. Since the driver is PnP, it receives PnP IRP
with minor code IRP_MN_FILTER_RESOURCE_REQUIREMENTS. On return from
handling IRP_MN_FILTER_RESOURCE_REQUIREMENTS, I passed PnP manager a
resource requirements list. Here is the list :-

reqResourceRequirementsList->List[0].Descriptors[0].u.Memory.MinimumAddress.u.LowPart
= 0x000F0000;
reqResourceRequirementsList->List[0].Descriptors[0].u.Memory.MinimumAddress.u.HighPart
= 0;
reqResourceRequirementsList->List[0].Descriptors[0].u.Memory.MaximumAddress.u.LowPart
= 0x000FFFFF;
reqResourceRequirementsList->List[0].Descriptors[0].u.Memory.MaximumAddress.u.HighPart
= 0;

Now, when I receive PnP IRP with minor code IRP_MN_START_DEVICE, the
allocated raw and translated resources are NULL. So, my question is
that can we ask the PnP manager that we are going to use that part of
physical memory (i.e. 0x000F0000 to 0x000FFFFF) as read-only.

PnP won’t let you have that space. It has already been assigned to
another driver. However, there is nothing preventing you from using
MmMapIoSpace to talk to it. On the other hand, if all you need is the
F0000 ROM space, you can rely on a little internal knowledge of how the
Windows kernel works, and start reading at 800F0000. The low few
megabytes of physical space are mapped at 80000000.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.