Alex Ionescu <ionucu@videotron.ca>

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
This commit is contained in:
Filip Navara 2005-03-12 00:49:18 +00:00
parent b89e71762d
commit 94066e01ef
10 changed files with 23 additions and 26 deletions

View file

@ -28,6 +28,7 @@
#include "../../reactos/registry.h" #include "../../reactos/registry.h"
#include "hardware.h" #include "hardware.h"
BOOLEAN AcpiPresent = FALSE;
static BOOL static BOOL
FindAcpiBios(VOID) FindAcpiBios(VOID)
@ -63,6 +64,7 @@ DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
if (FindAcpiBios()) if (FindAcpiBios())
{ {
AcpiPresent = TRUE;
/* Create new bus key */ /* Create new bus key */
sprintf(Buffer, sprintf(Buffer,
"MultifunctionAdapter\\%u", *BusNumber); "MultifunctionAdapter\\%u", *BusNumber);

View file

@ -52,6 +52,7 @@
#define MB_INFO_FLAG_BOOT_LOADER_NAME 0x00000200 #define MB_INFO_FLAG_BOOT_LOADER_NAME 0x00000200
#define MB_INFO_FLAG_APM_TABLE 0x00000400 #define MB_INFO_FLAG_APM_TABLE 0x00000400
#define MB_INFO_FLAG_GRAPHICS_TABLE 0x00000800 #define MB_INFO_FLAG_GRAPHICS_TABLE 0x00000800
#define MB_INFO_FLAG_ACPI_TABLE 0x00001000
#ifndef ASM #ifndef ASM
/* Do not include here in boot.S. */ /* Do not include here in boot.S. */

View file

@ -580,6 +580,7 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
extern ULONG PageDirectoryStart; extern ULONG PageDirectoryStart;
extern ULONG PageDirectoryEnd; extern ULONG PageDirectoryEnd;
extern BOOLEAN AcpiPresent;
// //
// Open the operating system section // Open the operating system section
@ -596,8 +597,9 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
* Setup multiboot information structure * 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.Flags = MB_INFO_FLAG_MEM_SIZE | MB_INFO_FLAG_BOOT_DEVICE | MB_INFO_FLAG_COMMAND_LINE | MB_INFO_FLAG_MODULES;
LoaderBlock.PageDirectoryStart = (ULONG)&PageDirectoryStart; if (AcpiPresent) LoaderBlock.Flags |= MB_INFO_FLAG_ACPI_TABLE;
LoaderBlock.PageDirectoryEnd = (ULONG)&PageDirectoryEnd; LoaderBlock.PageDirectoryStart = (ULONG)&PageDirectoryStart;
LoaderBlock.PageDirectoryEnd = (ULONG)&PageDirectoryEnd;
LoaderBlock.BootDevice = 0xffffffff; LoaderBlock.BootDevice = 0xffffffff;
LoaderBlock.CommandLine = (unsigned long)multiboot_kernel_cmdline; LoaderBlock.CommandLine = (unsigned long)multiboot_kernel_cmdline;
LoaderBlock.ModsCount = 0; LoaderBlock.ModsCount = 0;

View file

@ -37,11 +37,6 @@ OPTIMIZED := 0
# #
CONFIG_SMP := 0 CONFIG_SMP := 0
#
# Whether to compile for ACPI compliant systems
#
ACPI := 0
# #
# whether to use a 3GB User, 1GB Kernel memory map # whether to use a 3GB User, 1GB Kernel memory map
# #

View file

@ -492,6 +492,7 @@ typedef struct _ADDRESS_RANGE
#define MB_FLAGS_BOOT_LOADER_NAME (0x200) #define MB_FLAGS_BOOT_LOADER_NAME (0x200)
#define MB_FLAGS_APM_TABLE (0x400) #define MB_FLAGS_APM_TABLE (0x400)
#define MB_FLAGS_GRAPHICS_TABLE (0x800) #define MB_FLAGS_GRAPHICS_TABLE (0x800)
#define MB_FLAGS_ACPI_TABLE (0x1000)
typedef struct _LOADER_MODULE typedef struct _LOADER_MODULE
{ {

View file

@ -18,7 +18,7 @@
extern PDEVICE_NODE PopSystemPowerDeviceNode; extern PDEVICE_NODE PopSystemPowerDeviceNode;
VOID VOID
PoInit(VOID); PoInit(PLOADER_PARAMETER_BLOCK LoaderBlock, BOOLEAN ForceAcpiDisable);
NTSTATUS NTSTATUS
PopSetSystemPowerState( PopSetSystemPowerState(

View file

@ -82,7 +82,6 @@ IopInitializeDevice(
return Status; return Status;
} }
#ifdef ACPI
if (Fdo->DeviceType == FILE_DEVICE_ACPI) if (Fdo->DeviceType == FILE_DEVICE_ACPI)
{ {
static BOOLEAN SystemPowerDeviceNodeCreated = FALSE; static BOOLEAN SystemPowerDeviceNodeCreated = FALSE;
@ -94,7 +93,6 @@ IopInitializeDevice(
SystemPowerDeviceNodeCreated = TRUE; SystemPowerDeviceNodeCreated = TRUE;
} }
} }
#endif /* ACPI */
if (Fdo->DeviceType == FILE_DEVICE_BUS_EXTENDER || if (Fdo->DeviceType == FILE_DEVICE_BUS_EXTENDER ||
Fdo->DeviceType == FILE_DEVICE_ACPI) Fdo->DeviceType == FILE_DEVICE_ACPI)

View file

@ -528,7 +528,7 @@ ExpInitializeExecutive(VOID)
ExInit3(); ExInit3();
KdInit1(); KdInit1();
IoInit(); IoInit();
PoInit(); PoInit(&KeLoaderBlock, FALSE);
CmInitializeRegistry(); CmInitializeRegistry();
MmInit3(); MmInit3();
CcInit(); CcInit();

View file

@ -12,8 +12,8 @@
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
PDEVICE_NODE PopSystemPowerDeviceNode = NULL; PDEVICE_NODE PopSystemPowerDeviceNode = NULL;
BOOLEAN PopAcpiPresent = FALSE;
/* /*
* @implemented * @implemented
@ -133,10 +133,7 @@ PoUnregisterSystemState(
NTSTATUS NTSTATUS
PopSetSystemPowerState( PopSetSystemPowerState(
SYSTEM_POWER_STATE PowerState) SYSTEM_POWER_STATE PowerState)
{ {
#ifdef ACPI
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
PDEVICE_OBJECT DeviceObject; PDEVICE_OBJECT DeviceObject;
PIO_STACK_LOCATION IrpSp; PIO_STACK_LOCATION IrpSp;
@ -144,6 +141,8 @@ PopSetSystemPowerState(
NTSTATUS Status; NTSTATUS Status;
KEVENT Event; KEVENT Event;
PIRP Irp; PIRP Irp;
if (!PopAcpiPresent) return STATUS_NOT_IMPLEMENTED;
Status = IopGetSystemPowerDeviceObject(&DeviceObject); Status = IopGetSystemPowerDeviceObject(&DeviceObject);
if (!NT_SUCCESS(Status)) { if (!NT_SUCCESS(Status)) {
@ -190,15 +189,18 @@ PopSetSystemPowerState(
ObDereferenceObject(Fdo); ObDereferenceObject(Fdo);
return Status; return Status;
#endif /* ACPI */
return STATUS_NOT_IMPLEMENTED;
} }
VOID INIT_FUNCTION VOID
PoInit(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;
} }
/* /*

View file

@ -19,10 +19,6 @@ ifeq ($(CONFIG_SMP), 1)
CONFIG += CONFIG_SMP CONFIG += CONFIG_SMP
endif endif
ifeq ($(ACPI), 1)
CONFIG += ACPI
endif
$(PATH_TO_TOP)/tools/mkconfig$(EXE_POSTFIX): $(PATH_TO_TOP)/tools/mkconfig.c $(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 @$(HOST_CC) -g -o $(PATH_TO_TOP)/tools/mkconfig$(EXE_POSTFIX) $(PATH_TO_TOP)/tools/mkconfig.c