mirror of
https://github.com/reactos/reactos.git
synced 2024-11-19 05:22:59 +00:00
- Fix Freeldr to correctly send reported resources (at least PCI buses and PS/2 devices)
- Let Root bus report BootResources - If no resource requirement are found, use the boot resource list (not sure of this one) svn path=/trunk/; revision=24128
This commit is contained in:
parent
3daa4394f7
commit
2a1513dc5c
4 changed files with 84 additions and 91 deletions
|
@ -640,14 +640,6 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","ImagePath",0x00020000,"system32\d
|
|||
HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","Start",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","Type",0x00010001,0x00000001
|
||||
|
||||
; PCI driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Enum\Root\*PNP0A03\0000","HardwareID",0x00010000,"*PNP0A03"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Enum\Root\*PNP0A03\0000","DeviceDesc",0x00000000,"PCI bus"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Enum\Root\*PNP0A03\0000\LogConf","BasicConfigVector",0x000A0001, \
|
||||
40,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, \
|
||||
01,00,00,00,01,00,01,00,01,00,00,00, \
|
||||
00,06,00,00,00,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
|
||||
|
||||
; NetLogon
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","ErrorControl",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Netlogon","ImagePath",0x00020000,"%SystemRoot%\system32\lsass.exe"
|
||||
|
|
|
@ -1270,6 +1270,8 @@ DetectSerialPointerPeripheral(FRLDRHKEY ControllerKey,
|
|||
FullResourceDescriptor.InterfaceType = Isa;
|
||||
FullResourceDescriptor.BusNumber = 0;
|
||||
FullResourceDescriptor.PartialResourceList.Count = 0;
|
||||
FullResourceDescriptor.PartialResourceList.Version = 1;
|
||||
FullResourceDescriptor.PartialResourceList.Revision = 1;
|
||||
|
||||
Error = RegSetValue(PeripheralKey,
|
||||
L"Configuration Data",
|
||||
|
@ -1688,8 +1690,8 @@ DetectKeyboardPeripheral(FRLDRHKEY ControllerKey)
|
|||
PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_KEYBOARD_DEVICE_DATA);
|
||||
|
||||
KeyboardData = (PVOID)(((ULONG_PTR)FullResourceDescriptor) + sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
|
||||
KeyboardData->Version = 0;
|
||||
KeyboardData->Revision = 0;
|
||||
KeyboardData->Version = 1;
|
||||
KeyboardData->Revision = 1;
|
||||
KeyboardData->Type = 4;
|
||||
KeyboardData->Subtype = 0;
|
||||
KeyboardData->KeyboardFlags = 0x20;
|
||||
|
|
|
@ -277,8 +277,7 @@ DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
|
|||
}
|
||||
|
||||
/* Set 'Configuration Data' value */
|
||||
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
|
||||
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
Size = sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
|
||||
FullResourceDescriptor = MmAllocateMemory(Size);
|
||||
if (FullResourceDescriptor == NULL)
|
||||
{
|
||||
|
@ -291,7 +290,13 @@ DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
|
|||
memset(FullResourceDescriptor, 0, Size);
|
||||
FullResourceDescriptor->InterfaceType = PCIBus;
|
||||
FullResourceDescriptor->BusNumber = 0;
|
||||
FullResourceDescriptor->PartialResourceList.Count = 0;
|
||||
FullResourceDescriptor->PartialResourceList.Version = 1;
|
||||
FullResourceDescriptor->PartialResourceList.Revision = 1;
|
||||
FullResourceDescriptor->PartialResourceList.Count = 1;
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].Type = CmResourceTypeBusNumber;
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].ShareDisposition = CmResourceShareDeviceExclusive;
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].u.BusNumber.Start = 0;
|
||||
FullResourceDescriptor->PartialResourceList.PartialDescriptors[0].u.BusNumber.Length = 1;
|
||||
|
||||
/* Set 'Configuration Data' value */
|
||||
Error = RegSetValue(BiosKey,
|
||||
|
|
|
@ -33,6 +33,9 @@ typedef struct _PNPROOT_DEVICE
|
|||
UNICODE_STRING InstanceID;
|
||||
// Device description
|
||||
UNICODE_STRING DeviceDescription;
|
||||
// Boot resource list
|
||||
PCM_FULL_RESOURCE_DESCRIPTOR BootResourceList;
|
||||
SIZE_T BootResourceListSize;
|
||||
// Resource requirement list
|
||||
PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirementsList;
|
||||
} PNPROOT_DEVICE, *PPNPROOT_DEVICE;
|
||||
|
@ -67,12 +70,8 @@ typedef struct _PNPROOT_PDO_DEVICE_EXTENSION
|
|||
{
|
||||
// Common device data
|
||||
PNPROOT_COMMON_DEVICE_EXTENSION Common;
|
||||
// Device ID
|
||||
UNICODE_STRING DeviceID;
|
||||
// Instance ID
|
||||
UNICODE_STRING InstanceID;
|
||||
// Resource requirement list
|
||||
PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirementsList;
|
||||
// Device
|
||||
PPNPROOT_DEVICE Device;
|
||||
} PNPROOT_PDO_DEVICE_EXTENSION, *PPNPROOT_PDO_DEVICE_EXTENSION;
|
||||
|
||||
|
||||
|
@ -158,23 +157,6 @@ PnpRootCreateDevice(
|
|||
|
||||
PdoDeviceExtension->Common.DevicePowerState = PowerDeviceD0;
|
||||
|
||||
if (!RtlCreateUnicodeString(
|
||||
&PdoDeviceExtension->DeviceID,
|
||||
ENUM_NAME_ROOT \
|
||||
L"\\LEGACY_UNKNOWN"))
|
||||
{
|
||||
/* FIXME: */
|
||||
DPRINT("RtlCreateUnicodeString() failed\n");
|
||||
}
|
||||
|
||||
if (!RtlCreateUnicodeString(
|
||||
&PdoDeviceExtension->InstanceID,
|
||||
L"0000"))
|
||||
{
|
||||
/* FIXME: */
|
||||
DPRINT("RtlCreateUnicodeString() failed\n");
|
||||
}
|
||||
|
||||
ExInterlockedInsertTailList(
|
||||
&DeviceExtension->DeviceListHead,
|
||||
&Device->ListEntry,
|
||||
|
@ -210,9 +192,12 @@ PdoQueryId(
|
|||
|
||||
switch (IrpSp->Parameters.QueryId.IdType) {
|
||||
case BusQueryDeviceID:
|
||||
if (DeviceExtension->Device)
|
||||
Status = RtlDuplicateUnicodeString(TRUE,
|
||||
&DeviceExtension->DeviceID,
|
||||
&DeviceExtension->Device->DeviceID,
|
||||
&String);
|
||||
else
|
||||
Status = RtlCreateUnicodeString(&String, ENUM_NAME_ROOT L"\\LEGACY_UNKNOWN");
|
||||
|
||||
DPRINT("DeviceID: %wZ\n", &String);
|
||||
|
||||
|
@ -225,9 +210,12 @@ PdoQueryId(
|
|||
break;
|
||||
|
||||
case BusQueryInstanceID:
|
||||
if (DeviceExtension->Device)
|
||||
Status = RtlDuplicateUnicodeString(TRUE,
|
||||
&DeviceExtension->InstanceID,
|
||||
&DeviceExtension->Device->InstanceID,
|
||||
&String);
|
||||
else
|
||||
Status = RtlCreateUnicodeString(&String, L"0000");
|
||||
|
||||
DPRINT("InstanceID: %S\n", String.Buffer);
|
||||
|
||||
|
@ -249,9 +237,17 @@ PdoQueryResources(
|
|||
IN PIRP Irp,
|
||||
PIO_STACK_LOCATION IrpSp)
|
||||
{
|
||||
PPNPROOT_PDO_DEVICE_EXTENSION DeviceExtension;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
ULONG ResourceListSize = FIELD_OFFSET(CM_RESOURCE_LIST, List);
|
||||
|
||||
DPRINT("Called\n");
|
||||
|
||||
DeviceExtension = (PPNPROOT_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
if (!DeviceExtension->Device || DeviceExtension->Device->BootResourceList == NULL)
|
||||
{
|
||||
/* Create an empty resource list */
|
||||
ResourceList = ExAllocatePool(PagedPool, ResourceListSize);
|
||||
if (ResourceList == NULL)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -259,6 +255,22 @@ PdoQueryResources(
|
|||
ResourceList->Count = 0;
|
||||
|
||||
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Copy existing resource list */
|
||||
ResourceList = ExAllocatePool(PagedPool,
|
||||
FIELD_OFFSET(CM_RESOURCE_LIST, List) + DeviceExtension->Device->BootResourceListSize);
|
||||
if (ResourceList == NULL)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
ResourceList->Count = 1;
|
||||
RtlCopyMemory(
|
||||
&ResourceList->List,
|
||||
DeviceExtension->Device->BootResourceList,
|
||||
DeviceExtension->Device->BootResourceListSize);
|
||||
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -278,7 +290,7 @@ PdoQueryResourceRequirements(
|
|||
|
||||
DeviceExtension = (PPNPROOT_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
if (DeviceExtension->ResourceRequirementsList == NULL)
|
||||
if (!DeviceExtension->Device || DeviceExtension->Device->ResourceRequirementsList == NULL)
|
||||
{
|
||||
/* Create an empty resource list */
|
||||
ResourceList = ExAllocatePool(PagedPool, ResourceListSize);
|
||||
|
@ -293,14 +305,14 @@ PdoQueryResourceRequirements(
|
|||
else
|
||||
{
|
||||
/* Copy existing resource requirement list */
|
||||
ResourceList = ExAllocatePool(PagedPool, DeviceExtension->ResourceRequirementsList->ListSize);
|
||||
ResourceList = ExAllocatePool(PagedPool, DeviceExtension->Device->ResourceRequirementsList->ListSize);
|
||||
if (ResourceList == NULL)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
RtlCopyMemory(
|
||||
ResourceList,
|
||||
DeviceExtension->ResourceRequirementsList,
|
||||
DeviceExtension->ResourceRequirementsList->ListSize);
|
||||
DeviceExtension->Device->ResourceRequirementsList,
|
||||
DeviceExtension->Device->ResourceRequirementsList->ListSize);
|
||||
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
||||
}
|
||||
|
||||
|
@ -449,7 +461,8 @@ static NTSTATUS
|
|||
PnpRootReadRegistryBinary(
|
||||
IN PWSTR KeyName,
|
||||
IN PWSTR ValueKeyName,
|
||||
OUT PVOID* Buffer)
|
||||
OUT PVOID* Buffer,
|
||||
OUT SIZE_T* BufferSize OPTIONAL)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING KeyNameU;
|
||||
|
@ -500,7 +513,7 @@ PnpRootReadRegistryBinary(
|
|||
{
|
||||
DPRINT("ExAllocatePoolWithTag() failed\n", Status);
|
||||
ZwClose(KeyHandle);
|
||||
return Status;
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
Status = ZwQueryValueKey(
|
||||
|
@ -512,12 +525,13 @@ PnpRootReadRegistryBinary(
|
|||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
*Buffer = ExAllocatePoolWithTag(PagedPool, Data->DataLength, TAG_PNP_ROOT);
|
||||
if (BufferSize) *BufferSize = Data->DataLength;
|
||||
if (!*Buffer)
|
||||
{
|
||||
DPRINT("ExAllocatePoolWithTag() failed\n", Status);
|
||||
ExFreePoolWithTag(Data, TAG_PNP_ROOT);
|
||||
ZwClose(KeyHandle);
|
||||
return Status;
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
RtlCopyMemory(
|
||||
|
@ -591,7 +605,21 @@ PnpRootFdoReadDeviceInfo(
|
|||
Status = PnpRootReadRegistryBinary(
|
||||
KeyName,
|
||||
L"BasicConfigVector",
|
||||
(PVOID*)&Device->ResourceRequirementsList);
|
||||
(PVOID*)&Device->ResourceRequirementsList,
|
||||
NULL);
|
||||
|
||||
DPRINT("PnpRootReadRegistryBinary() returned status 0x%08lx\n", Status);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* FIXME: */
|
||||
}
|
||||
|
||||
Status = PnpRootReadRegistryBinary(
|
||||
KeyName,
|
||||
L"BootConfig",
|
||||
(PVOID*)&Device->BootResourceList,
|
||||
&Device->BootResourceListSize);
|
||||
|
||||
DPRINT("PnpRootReadRegistryBinary() returned status 0x%08lx\n", Status);
|
||||
|
||||
|
@ -861,52 +889,18 @@ PnpRootQueryBusRelations(
|
|||
|
||||
PdoDeviceExtension->Common.DevicePowerState = PowerDeviceD0;
|
||||
|
||||
if (!RtlCreateUnicodeString(
|
||||
&PdoDeviceExtension->DeviceID,
|
||||
Device->DeviceID.Buffer))
|
||||
{
|
||||
DPRINT("Insufficient resources\n");
|
||||
/* FIXME: */
|
||||
}
|
||||
PdoDeviceExtension->Device = Device;
|
||||
|
||||
DPRINT("DeviceID: %wZ PDO %p\n",
|
||||
&PdoDeviceExtension->DeviceID,
|
||||
&PdoDeviceExtension->Device->DeviceID,
|
||||
Device->Pdo);
|
||||
|
||||
if (!RtlCreateUnicodeString(
|
||||
&PdoDeviceExtension->InstanceID,
|
||||
Device->InstanceID.Buffer))
|
||||
{
|
||||
DPRINT("Insufficient resources\n");
|
||||
/* FIXME: */
|
||||
}
|
||||
|
||||
DPRINT("InstanceID: %wZ PDO %p\n",
|
||||
&PdoDeviceExtension->InstanceID,
|
||||
&PdoDeviceExtension->Device->InstanceID,
|
||||
Device->Pdo);
|
||||
|
||||
if (Device->ResourceRequirementsList != NULL)
|
||||
{
|
||||
PdoDeviceExtension->ResourceRequirementsList = ExAllocatePoolWithTag(
|
||||
PagedPool,
|
||||
Device->ResourceRequirementsList->ListSize,
|
||||
TAG_PNP_ROOT);
|
||||
if (PdoDeviceExtension->ResourceRequirementsList)
|
||||
{
|
||||
RtlCopyMemory(
|
||||
PdoDeviceExtension->ResourceRequirementsList,
|
||||
Device->ResourceRequirementsList,
|
||||
Device->ResourceRequirementsList->ListSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME */
|
||||
DPRINT("ExAllocatePoolWithTag() failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
DPRINT("ResourceRequirementsList: %p PDO %p\n",
|
||||
PdoDeviceExtension->ResourceRequirementsList,
|
||||
PdoDeviceExtension->Device->ResourceRequirementsList,
|
||||
Device->Pdo);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue