From 94066e01efc2c8e51c8a532f6bb11c1ae947d36c Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sat, 12 Mar 2005 00:49:18 +0000 Subject: [PATCH] Alex Ionescu Pass an ACPI flag from FreeLdr to the kernel and replace the usage of ACPI compile time option with it. svn path=/trunk/; revision=13945 --- .../boot/freeldr/freeldr/arch/i386/hwacpi.c | 2 ++ .../boot/freeldr/freeldr/include/multiboot.h | 1 + .../boot/freeldr/freeldr/reactos/reactos.c | 6 +++-- reactos/config | 5 ---- reactos/include/ntos/types.h | 1 + reactos/ntoskrnl/include/internal/po.h | 2 +- reactos/ntoskrnl/io/device.c | 2 -- reactos/ntoskrnl/ke/main.c | 2 +- reactos/ntoskrnl/po/power.c | 24 ++++++++++--------- reactos/tools/config.mk | 4 ---- 10 files changed, 23 insertions(+), 26 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c b/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c index 733f71a8a36..f7c7fd8513b 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c @@ -28,6 +28,7 @@ #include "../../reactos/registry.h" #include "hardware.h" +BOOLEAN AcpiPresent = FALSE; static BOOL FindAcpiBios(VOID) @@ -63,6 +64,7 @@ DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber) if (FindAcpiBios()) { + AcpiPresent = TRUE; /* Create new bus key */ sprintf(Buffer, "MultifunctionAdapter\\%u", *BusNumber); diff --git a/reactos/boot/freeldr/freeldr/include/multiboot.h b/reactos/boot/freeldr/freeldr/include/multiboot.h index f4e2cb42cf7..0e50e08f4d2 100644 --- a/reactos/boot/freeldr/freeldr/include/multiboot.h +++ b/reactos/boot/freeldr/freeldr/include/multiboot.h @@ -52,6 +52,7 @@ #define MB_INFO_FLAG_BOOT_LOADER_NAME 0x00000200 #define MB_INFO_FLAG_APM_TABLE 0x00000400 #define MB_INFO_FLAG_GRAPHICS_TABLE 0x00000800 +#define MB_INFO_FLAG_ACPI_TABLE 0x00001000 #ifndef ASM /* Do not include here in boot.S. */ diff --git a/reactos/boot/freeldr/freeldr/reactos/reactos.c b/reactos/boot/freeldr/freeldr/reactos/reactos.c index 427f34e6c23..0e1e4e0aedc 100644 --- a/reactos/boot/freeldr/freeldr/reactos/reactos.c +++ b/reactos/boot/freeldr/freeldr/reactos/reactos.c @@ -580,6 +580,7 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName) extern ULONG PageDirectoryStart; extern ULONG PageDirectoryEnd; + extern BOOLEAN AcpiPresent; // // Open the operating system section @@ -596,8 +597,9 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName) * Setup multiboot information structure */ LoaderBlock.Flags = MB_INFO_FLAG_MEM_SIZE | MB_INFO_FLAG_BOOT_DEVICE | MB_INFO_FLAG_COMMAND_LINE | MB_INFO_FLAG_MODULES; - LoaderBlock.PageDirectoryStart = (ULONG)&PageDirectoryStart; - LoaderBlock.PageDirectoryEnd = (ULONG)&PageDirectoryEnd; + if (AcpiPresent) LoaderBlock.Flags |= MB_INFO_FLAG_ACPI_TABLE; + LoaderBlock.PageDirectoryStart = (ULONG)&PageDirectoryStart; + LoaderBlock.PageDirectoryEnd = (ULONG)&PageDirectoryEnd; LoaderBlock.BootDevice = 0xffffffff; LoaderBlock.CommandLine = (unsigned long)multiboot_kernel_cmdline; LoaderBlock.ModsCount = 0; diff --git a/reactos/config b/reactos/config index 1df93292ac2..34aa938c0b5 100644 --- a/reactos/config +++ b/reactos/config @@ -37,11 +37,6 @@ OPTIMIZED := 0 # CONFIG_SMP := 0 -# -# Whether to compile for ACPI compliant systems -# -ACPI := 0 - # # whether to use a 3GB User, 1GB Kernel memory map # diff --git a/reactos/include/ntos/types.h b/reactos/include/ntos/types.h index 0ee104f787c..c74fc2167b5 100644 --- a/reactos/include/ntos/types.h +++ b/reactos/include/ntos/types.h @@ -492,6 +492,7 @@ typedef struct _ADDRESS_RANGE #define MB_FLAGS_BOOT_LOADER_NAME (0x200) #define MB_FLAGS_APM_TABLE (0x400) #define MB_FLAGS_GRAPHICS_TABLE (0x800) +#define MB_FLAGS_ACPI_TABLE (0x1000) typedef struct _LOADER_MODULE { diff --git a/reactos/ntoskrnl/include/internal/po.h b/reactos/ntoskrnl/include/internal/po.h index ffed3760d13..19387ebba6f 100644 --- a/reactos/ntoskrnl/include/internal/po.h +++ b/reactos/ntoskrnl/include/internal/po.h @@ -18,7 +18,7 @@ extern PDEVICE_NODE PopSystemPowerDeviceNode; VOID -PoInit(VOID); +PoInit(PLOADER_PARAMETER_BLOCK LoaderBlock, BOOLEAN ForceAcpiDisable); NTSTATUS PopSetSystemPowerState( diff --git a/reactos/ntoskrnl/io/device.c b/reactos/ntoskrnl/io/device.c index d598b4f5ddf..ddc633e0196 100644 --- a/reactos/ntoskrnl/io/device.c +++ b/reactos/ntoskrnl/io/device.c @@ -82,7 +82,6 @@ IopInitializeDevice( return Status; } -#ifdef ACPI if (Fdo->DeviceType == FILE_DEVICE_ACPI) { static BOOLEAN SystemPowerDeviceNodeCreated = FALSE; @@ -94,7 +93,6 @@ IopInitializeDevice( SystemPowerDeviceNodeCreated = TRUE; } } -#endif /* ACPI */ if (Fdo->DeviceType == FILE_DEVICE_BUS_EXTENDER || Fdo->DeviceType == FILE_DEVICE_ACPI) diff --git a/reactos/ntoskrnl/ke/main.c b/reactos/ntoskrnl/ke/main.c index 2545534601c..4893d1ef798 100644 --- a/reactos/ntoskrnl/ke/main.c +++ b/reactos/ntoskrnl/ke/main.c @@ -528,7 +528,7 @@ ExpInitializeExecutive(VOID) ExInit3(); KdInit1(); IoInit(); - PoInit(); + PoInit(&KeLoaderBlock, FALSE); CmInitializeRegistry(); MmInit3(); CcInit(); diff --git a/reactos/ntoskrnl/po/power.c b/reactos/ntoskrnl/po/power.c index b478b9cc3c8..e8b5da34f43 100644 --- a/reactos/ntoskrnl/po/power.c +++ b/reactos/ntoskrnl/po/power.c @@ -12,8 +12,8 @@ #define NDEBUG #include - PDEVICE_NODE PopSystemPowerDeviceNode = NULL; +BOOLEAN PopAcpiPresent = FALSE; /* * @implemented @@ -133,10 +133,7 @@ PoUnregisterSystemState( NTSTATUS PopSetSystemPowerState( SYSTEM_POWER_STATE PowerState) -{ - -#ifdef ACPI - +{ IO_STATUS_BLOCK IoStatusBlock; PDEVICE_OBJECT DeviceObject; PIO_STACK_LOCATION IrpSp; @@ -144,6 +141,8 @@ PopSetSystemPowerState( NTSTATUS Status; KEVENT Event; PIRP Irp; + + if (!PopAcpiPresent) return STATUS_NOT_IMPLEMENTED; Status = IopGetSystemPowerDeviceObject(&DeviceObject); if (!NT_SUCCESS(Status)) { @@ -190,15 +189,18 @@ PopSetSystemPowerState( ObDereferenceObject(Fdo); return Status; - -#endif /* ACPI */ - - return STATUS_NOT_IMPLEMENTED; } -VOID INIT_FUNCTION -PoInit(VOID) +VOID +INIT_FUNCTION +PoInit(PLOADER_PARAMETER_BLOCK LoaderBlock, + BOOLEAN ForceAcpiDisable) { + /* Set the ACPI State to False if it's been forced that way */ + if (ForceAcpiDisable) PopAcpiPresent = FALSE; + + /* Otherwise check the LoaderBlock's Flag */ + PopAcpiPresent = LoaderBlock->Flags & MB_FLAGS_ACPI_TABLE; } /* diff --git a/reactos/tools/config.mk b/reactos/tools/config.mk index 26ecb208a68..a6a4e326d8b 100644 --- a/reactos/tools/config.mk +++ b/reactos/tools/config.mk @@ -19,10 +19,6 @@ ifeq ($(CONFIG_SMP), 1) CONFIG += CONFIG_SMP endif -ifeq ($(ACPI), 1) -CONFIG += ACPI -endif - $(PATH_TO_TOP)/tools/mkconfig$(EXE_POSTFIX): $(PATH_TO_TOP)/tools/mkconfig.c @$(HOST_CC) -g -o $(PATH_TO_TOP)/tools/mkconfig$(EXE_POSTFIX) $(PATH_TO_TOP)/tools/mkconfig.c -- 2.17.1