mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[ISAPNP] Create resource list ahead of IRP_MN_QUERY_RESOURCES
This commit is contained in:
parent
debec8c96e
commit
61c1079a18
3 changed files with 53 additions and 28 deletions
|
@ -379,6 +379,45 @@ IsaPnpCreateReadPortDORequirements(
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
IsaPnpCreateReadPortDOResources(
|
||||
IN PISAPNP_PDO_EXTENSION PdoExt)
|
||||
{
|
||||
USHORT Ports[] = { ISAPNP_WRITE_DATA, ISAPNP_ADDRESS };
|
||||
ULONG ListSize, i;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor;
|
||||
|
||||
ListSize = sizeof(CM_RESOURCE_LIST)
|
||||
+ (ARRAYSIZE(Ports) - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
ResourceList = ExAllocatePool(PagedPool, ListSize);
|
||||
if (!ResourceList)
|
||||
return STATUS_NO_MEMORY;
|
||||
|
||||
RtlZeroMemory(ResourceList, ListSize);
|
||||
ResourceList->Count = 1;
|
||||
ResourceList->List[0].InterfaceType = Internal;
|
||||
ResourceList->List[0].PartialResourceList.Version = 1;
|
||||
ResourceList->List[0].PartialResourceList.Revision = 1;
|
||||
ResourceList->List[0].PartialResourceList.Count = 2;
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(Ports); i++)
|
||||
{
|
||||
Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[i];
|
||||
Descriptor->Type = CmResourceTypePort;
|
||||
Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
|
||||
Descriptor->Flags = CM_RESOURCE_PORT_16_BIT_DECODE;
|
||||
Descriptor->u.Port.Length = 0x01;
|
||||
Descriptor->u.Port.Start.LowPart = Ports[i];
|
||||
}
|
||||
|
||||
PdoExt->ResourceList = ResourceList;
|
||||
PdoExt->ResourceListSize = ListSize;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
|
@ -435,6 +474,10 @@ IsaPnpCreateReadPortDO(PISAPNP_FDO_EXTENSION FdoExt)
|
|||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
Status = IsaPnpCreateReadPortDOResources(PdoExt);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ typedef struct _ISAPNP_PDO_EXTENSION {
|
|||
UNICODE_STRING CompatibleIDs;
|
||||
UNICODE_STRING InstanceID;
|
||||
PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
ULONG ResourceListSize;
|
||||
} ISAPNP_PDO_EXTENSION, *PISAPNP_PDO_EXTENSION;
|
||||
|
||||
/* isapnp.c */
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
#include <isapnp.h>
|
||||
#include <isapnphw.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
@ -144,34 +143,18 @@ IsaPdoQueryResources(
|
|||
IN PIRP Irp,
|
||||
IN PIO_STACK_LOCATION IrpSp)
|
||||
{
|
||||
USHORT Ports[] = { ISAPNP_WRITE_DATA, ISAPNP_ADDRESS };
|
||||
ULONG ListSize, i;
|
||||
ULONG ListSize;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor;
|
||||
|
||||
ListSize = sizeof(CM_RESOURCE_LIST)
|
||||
+ (ARRAYSIZE(Ports) - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
ResourceList = ExAllocatePool(NonPagedPool, ListSize);
|
||||
if (!PdoExt->ResourceList)
|
||||
return Irp->IoStatus.Status;
|
||||
|
||||
ListSize = PdoExt->ResourceListSize;
|
||||
ResourceList = ExAllocatePool(PagedPool, ListSize);
|
||||
if (!ResourceList)
|
||||
return STATUS_NO_MEMORY;
|
||||
|
||||
RtlZeroMemory(ResourceList, ListSize);
|
||||
ResourceList->Count = 1;
|
||||
ResourceList->List[0].InterfaceType = Internal;
|
||||
ResourceList->List[0].PartialResourceList.Version = 1;
|
||||
ResourceList->List[0].PartialResourceList.Revision = 1;
|
||||
ResourceList->List[0].PartialResourceList.Count = 2;
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(Ports); i++)
|
||||
{
|
||||
Descriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[i];
|
||||
Descriptor->Type = CmResourceTypePort;
|
||||
Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
|
||||
Descriptor->Flags = CM_RESOURCE_PORT_16_BIT_DECODE;
|
||||
Descriptor->u.Port.Length = 0x01;
|
||||
Descriptor->u.Port.Start.LowPart = Ports[i];
|
||||
}
|
||||
|
||||
RtlCopyMemory(ResourceList, PdoExt->ResourceList, ListSize);
|
||||
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -348,10 +331,7 @@ IsaPdoPnp(
|
|||
break;
|
||||
|
||||
case IRP_MN_QUERY_RESOURCES:
|
||||
if (PdoExt->Common.Self == PdoExt->FdoExt->DataPortPdo)
|
||||
Status = IsaPdoQueryResources(PdoExt, Irp, IrpSp);
|
||||
else
|
||||
DPRINT1("IRP_MN_QUERY_RESOURCES is UNIMPLEMENTED!\n");
|
||||
Status = IsaPdoQueryResources(PdoExt, Irp, IrpSp);
|
||||
break;
|
||||
|
||||
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
|
||||
|
|
Loading…
Reference in a new issue