Update code to add back support for ACPI

svn path=/trunk/; revision=28297
This commit is contained in:
Hervé Poussineau 2007-08-12 08:37:38 +00:00
parent fcd3ddadc4
commit cc185a5b73
2 changed files with 41 additions and 24 deletions

View file

@ -15,6 +15,8 @@
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
//#define ENABLE_ACPI
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
PDEVICE_NODE IopRootDeviceNode; PDEVICE_NODE IopRootDeviceNode;
@ -2688,9 +2690,11 @@ IopEnumerateDetectedDevices(
const UNICODE_STRING IdentifierPci = RTL_CONSTANT_STRING(L"PCI BIOS"); const UNICODE_STRING IdentifierPci = RTL_CONSTANT_STRING(L"PCI BIOS");
UNICODE_STRING HardwareIdPci = RTL_CONSTANT_STRING(L"*PNP0A03\0"); UNICODE_STRING HardwareIdPci = RTL_CONSTANT_STRING(L"*PNP0A03\0");
static ULONG DeviceIndexPci = 0; static ULONG DeviceIndexPci = 0;
/*const UNICODE_STRING IdentifierAcpi = RTL_CONSTANT_STRING(L"ACPI BIOS"); #ifdef ENABLE_ACPI
const UNICODE_STRING IdentifierAcpi = RTL_CONSTANT_STRING(L"ACPI BIOS");
UNICODE_STRING HardwareIdAcpi = RTL_CONSTANT_STRING(L"*PNP0C08\0"); UNICODE_STRING HardwareIdAcpi = RTL_CONSTANT_STRING(L"*PNP0C08\0");
static ULONG DeviceIndexAcpi = 0;*/ static ULONG DeviceIndexAcpi = 0;
#endif
const UNICODE_STRING IdentifierSerial = RTL_CONSTANT_STRING(L"SerialController"); const UNICODE_STRING IdentifierSerial = RTL_CONSTANT_STRING(L"SerialController");
UNICODE_STRING HardwareIdSerial = RTL_CONSTANT_STRING(L"*PNP0501\0"); UNICODE_STRING HardwareIdSerial = RTL_CONSTANT_STRING(L"*PNP0501\0");
static ULONG DeviceIndexSerial = 0; static ULONG DeviceIndexSerial = 0;
@ -2950,11 +2954,13 @@ IopEnumerateDetectedDevices(
pHardwareId = &HardwareIdPci; pHardwareId = &HardwareIdPci;
DeviceIndex = DeviceIndexPci++; DeviceIndex = DeviceIndexPci++;
} }
/*else if (RtlCompareUnicodeString(&ValueName, &IdentifierAcpi, FALSE) == 0) #ifdef ENABLE_ACPI
else if (RtlCompareUnicodeString(&ValueName, &IdentifierAcpi, FALSE) == 0)
{ {
pHardwareId = &HardwareIdAcpi; pHardwareId = &HardwareIdAcpi;
DeviceIndex = DeviceIndexAcpi++; DeviceIndex = DeviceIndexAcpi++;
}*/ }
#endif
else else
{ {
/* Unknown device */ /* Unknown device */
@ -3016,9 +3022,7 @@ IopEnumerateDetectedDevices(
ZwDeleteKey(hLevel2Key); ZwDeleteKey(hLevel2Key);
goto nextdevice; goto nextdevice;
} }
if (BootResourcesLength > 0) /* Create 'LogConf' subkey */
{
/* Save boot resources to 'LogConf\BootConfig' */
InitializeObjectAttributes(&ObjectAttributes, &LogConfU, OBJ_KERNEL_HANDLE, hLevel2Key, NULL); InitializeObjectAttributes(&ObjectAttributes, &LogConfU, OBJ_KERNEL_HANDLE, hLevel2Key, NULL);
Status = ZwCreateKey( Status = ZwCreateKey(
&hLogConf, &hLogConf,
@ -3034,15 +3038,19 @@ IopEnumerateDetectedDevices(
ZwDeleteKey(hLevel2Key); ZwDeleteKey(hLevel2Key);
goto nextdevice; goto nextdevice;
} }
if (BootResourcesLength > 0)
{
/* Save boot resources to 'LogConf\BootConfig' */
Status = ZwSetValueKey(hLogConf, &BootConfigU, 0, REG_FULL_RESOURCE_DESCRIPTOR, BootResources, BootResourcesLength); Status = ZwSetValueKey(hLogConf, &BootConfigU, 0, REG_FULL_RESOURCE_DESCRIPTOR, BootResources, BootResourcesLength);
ZwClose(hLogConf);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("ZwSetValueKey() failed with status 0x%08lx\n", Status); DPRINT("ZwSetValueKey() failed with status 0x%08lx\n", Status);
ZwClose(hLogConf);
ZwDeleteKey(hLevel2Key); ZwDeleteKey(hLevel2Key);
goto nextdevice; goto nextdevice;
} }
} }
ZwClose(hLogConf);
nextdevice: nextdevice:
if (BootResources && BootResources != ParentBootResources) if (BootResources && BootResources != ParentBootResources)
@ -3076,8 +3084,9 @@ cleanup:
static BOOLEAN INIT_FUNCTION static BOOLEAN INIT_FUNCTION
IopIsAcpiComputer(VOID) IopIsAcpiComputer(VOID)
{ {
#ifndef ENABLE_ACPI
return FALSE; return FALSE;
#if 0 #else
UNICODE_STRING MultiKeyPathU = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter"); UNICODE_STRING MultiKeyPathU = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter");
UNICODE_STRING IdentifierU = RTL_CONSTANT_STRING(L"Identifier"); UNICODE_STRING IdentifierU = RTL_CONSTANT_STRING(L"Identifier");
UNICODE_STRING AcpiBiosIdentifier = RTL_CONSTANT_STRING(L"ACPI BIOS"); UNICODE_STRING AcpiBiosIdentifier = RTL_CONSTANT_STRING(L"ACPI BIOS");
@ -3219,12 +3228,13 @@ IopUpdateRootKey(VOID)
UNICODE_STRING MultiKeyPathU = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter"); UNICODE_STRING MultiKeyPathU = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter");
UNICODE_STRING DeviceDescU = RTL_CONSTANT_STRING(L"DeviceDesc"); UNICODE_STRING DeviceDescU = RTL_CONSTANT_STRING(L"DeviceDesc");
UNICODE_STRING HardwareIDU = RTL_CONSTANT_STRING(L"HardwareID"); UNICODE_STRING HardwareIDU = RTL_CONSTANT_STRING(L"HardwareID");
UNICODE_STRING LogConfU = RTL_CONSTANT_STRING(L"LogConf");
UNICODE_STRING HalAcpiDevice = RTL_CONSTANT_STRING(L"ACPI_HAL"); UNICODE_STRING HalAcpiDevice = RTL_CONSTANT_STRING(L"ACPI_HAL");
UNICODE_STRING HalAcpiId = RTL_CONSTANT_STRING(L"0000"); UNICODE_STRING HalAcpiId = RTL_CONSTANT_STRING(L"0000");
UNICODE_STRING HalAcpiDeviceDesc = RTL_CONSTANT_STRING(L"HAL ACPI"); UNICODE_STRING HalAcpiDeviceDesc = RTL_CONSTANT_STRING(L"HAL ACPI");
UNICODE_STRING HalAcpiHardwareID = RTL_CONSTANT_STRING(L"*PNP0C08\0"); UNICODE_STRING HalAcpiHardwareID = RTL_CONSTANT_STRING(L"*PNP0C08\0");
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE hRoot, hHalAcpiDevice, hHalAcpiId; HANDLE hRoot, hHalAcpiDevice, hHalAcpiId, hLogConf;
NTSTATUS Status; NTSTATUS Status;
InitializeObjectAttributes(&ObjectAttributes, &RootPathU, OBJ_KERNEL_HANDLE, NULL, NULL); InitializeObjectAttributes(&ObjectAttributes, &RootPathU, OBJ_KERNEL_HANDLE, NULL, NULL);
@ -3255,6 +3265,13 @@ IopUpdateRootKey(VOID)
Status = ZwSetValueKey(hHalAcpiId, &DeviceDescU, 0, REG_SZ, HalAcpiDeviceDesc.Buffer, HalAcpiDeviceDesc.MaximumLength); Status = ZwSetValueKey(hHalAcpiId, &DeviceDescU, 0, REG_SZ, HalAcpiDeviceDesc.Buffer, HalAcpiDeviceDesc.MaximumLength);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
Status = ZwSetValueKey(hHalAcpiId, &HardwareIDU, 0, REG_MULTI_SZ, HalAcpiHardwareID.Buffer, HalAcpiHardwareID.MaximumLength); Status = ZwSetValueKey(hHalAcpiId, &HardwareIDU, 0, REG_MULTI_SZ, HalAcpiHardwareID.Buffer, HalAcpiHardwareID.MaximumLength);
if (NT_SUCCESS(Status))
{
InitializeObjectAttributes(&ObjectAttributes, &LogConfU, OBJ_KERNEL_HANDLE, hHalAcpiId, NULL);
Status = ZwCreateKey(&hLogConf, 0, &ObjectAttributes, 0, NULL, REG_OPTION_VOLATILE, NULL);
if (NT_SUCCESS(Status))
ZwClose(hLogConf);
}
ZwClose(hHalAcpiId); ZwClose(hHalAcpiId);
return Status; return Status;
} }