mirror of
https://github.com/reactos/reactos.git
synced 2025-07-22 19:25:53 +00:00
[VIDEOPRT]
- Support passing a resource requirements list to VideoPortGetAccessRanges svn path=/trunk/; revision=54239
This commit is contained in:
parent
69fdb2ac71
commit
c64e8b00c0
1 changed files with 210 additions and 179 deletions
|
@ -576,6 +576,8 @@ VideoPortGetAccessRanges(
|
||||||
PVIDEO_ACCESS_RANGE LegacyAccessRanges;
|
PVIDEO_ACCESS_RANGE LegacyAccessRanges;
|
||||||
ULONG LegacyAccessRangeCount;
|
ULONG LegacyAccessRangeCount;
|
||||||
PDRIVER_OBJECT DriverObject;
|
PDRIVER_OBJECT DriverObject;
|
||||||
|
ULONG ListSize;
|
||||||
|
PIO_RESOURCE_REQUIREMENTS_LIST ResReqList;
|
||||||
BOOLEAN DeviceAndVendorFound = FALSE;
|
BOOLEAN DeviceAndVendorFound = FALSE;
|
||||||
|
|
||||||
TRACE_(VIDEOPRT, "VideoPortGetAccessRanges\n");
|
TRACE_(VIDEOPRT, "VideoPortGetAccessRanges\n");
|
||||||
|
@ -594,8 +596,7 @@ VideoPortGetAccessRanges(
|
||||||
{
|
{
|
||||||
PciSlotNumber.u.AsULONG = DeviceExtension->SystemIoSlotNumber;
|
PciSlotNumber.u.AsULONG = DeviceExtension->SystemIoSlotNumber;
|
||||||
|
|
||||||
ReturnedLength = HalGetBusData(
|
ReturnedLength = HalGetBusData(PCIConfiguration,
|
||||||
PCIConfiguration,
|
|
||||||
DeviceExtension->SystemIoBusNumber,
|
DeviceExtension->SystemIoBusNumber,
|
||||||
PciSlotNumber.u.AsULONG,
|
PciSlotNumber.u.AsULONG,
|
||||||
&Config,
|
&Config,
|
||||||
|
@ -630,8 +631,7 @@ VideoPortGetAccessRanges(
|
||||||
{
|
{
|
||||||
INFO_(VIDEOPRT, "- Function number: %d\n", FunctionNumber);
|
INFO_(VIDEOPRT, "- Function number: %d\n", FunctionNumber);
|
||||||
PciSlotNumber.u.bits.FunctionNumber = FunctionNumber;
|
PciSlotNumber.u.bits.FunctionNumber = FunctionNumber;
|
||||||
ReturnedLength = HalGetBusData(
|
ReturnedLength = HalGetBusData(PCIConfiguration,
|
||||||
PCIConfiguration,
|
|
||||||
DeviceExtension->SystemIoBusNumber,
|
DeviceExtension->SystemIoBusNumber,
|
||||||
PciSlotNumber.u.AsULONG,
|
PciSlotNumber.u.AsULONG,
|
||||||
&Config,
|
&Config,
|
||||||
|
@ -664,8 +664,7 @@ VideoPortGetAccessRanges(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = HalAssignSlotResources(
|
Status = HalAssignSlotResources(&DeviceExtension->RegistryPath,
|
||||||
&DeviceExtension->RegistryPath,
|
|
||||||
NULL,
|
NULL,
|
||||||
DeviceExtension->DriverObject,
|
DeviceExtension->DriverObject,
|
||||||
DeviceExtension->DriverObject->DeviceObject,
|
DeviceExtension->DriverObject->DeviceObject,
|
||||||
|
@ -680,13 +679,50 @@ VideoPortGetAccessRanges(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
DeviceExtension->AllocatedResources = AllocatedResources;
|
DeviceExtension->AllocatedResources = AllocatedResources;
|
||||||
|
|
||||||
/* Return the slot number if the caller wants it */
|
|
||||||
if (Slot != NULL) *Slot = PciSlotNumber.u.AsULONG;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + (NumRequestedResources - 1) * sizeof(IO_RESOURCE_DESCRIPTOR);
|
||||||
|
ResReqList = ExAllocatePool(NonPagedPool, ListSize);
|
||||||
|
if (!ResReqList) return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
|
|
||||||
|
ResReqList->ListSize = ListSize;
|
||||||
|
ResReqList->InterfaceType = DeviceExtension->AdapterInterfaceType;
|
||||||
|
ResReqList->BusNumber = DeviceExtension->SystemIoBusNumber;
|
||||||
|
ResReqList->SlotNumber = DeviceExtension->SystemIoSlotNumber;
|
||||||
|
ResReqList->AlternativeLists = 1;
|
||||||
|
ResReqList->List[0].Version = 1;
|
||||||
|
ResReqList->List[0].Revision = 1;
|
||||||
|
ResReqList->List[0].Count = NumRequestedResources;
|
||||||
|
|
||||||
|
/* Copy in the caller's resource list */
|
||||||
|
RtlCopyMemory(ResReqList->List[0].Descriptors,
|
||||||
|
RequestedResources,
|
||||||
|
NumRequestedResources * sizeof(IO_RESOURCE_DESCRIPTOR));
|
||||||
|
|
||||||
|
Status = IoAssignResources(&DeviceExtension->RegistryPath,
|
||||||
|
NULL,
|
||||||
|
DeviceExtension->DriverObject,
|
||||||
|
DeviceExtension->PhysicalDeviceObject ?
|
||||||
|
DeviceExtension->PhysicalDeviceObject :
|
||||||
|
DeviceExtension->DriverObject->DeviceObject,
|
||||||
|
ResReqList,
|
||||||
|
&AllocatedResources);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
return Status;
|
||||||
|
|
||||||
|
if (!DeviceExtension->AllocatedResources)
|
||||||
|
DeviceExtension->AllocatedResources = AllocatedResources;
|
||||||
|
}
|
||||||
|
|
||||||
if (AllocatedResources == NULL)
|
if (AllocatedResources == NULL)
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
|
|
||||||
|
/* Return the slot number if the caller wants it */
|
||||||
|
if (Slot != NULL) *Slot = DeviceExtension->SystemIoBusNumber;
|
||||||
|
|
||||||
Status = IntVideoPortGetLegacyResources(DriverExtension, DeviceExtension,
|
Status = IntVideoPortGetLegacyResources(DriverExtension, DeviceExtension,
|
||||||
&LegacyAccessRanges, &LegacyAccessRangeCount);
|
&LegacyAccessRanges, &LegacyAccessRangeCount);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -758,11 +794,6 @@ VideoPortGetAccessRanges(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
}
|
|
||||||
|
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue