[HALX86] Add function prototypes needed for parsing ACPI MADT table

- Use ACPICA headers to gather the information.
- Add PROCESSOR_IDENTITY structure that will be used by all APIC HALs.
This commit is contained in:
Justin Miller 2021-06-24 09:57:19 -07:00 committed by Stanislav Motylkov
parent 2204695f0a
commit 0fc21e5a9b
No known key found for this signature in database
GPG key ID: AFE513258CBA9E92
9 changed files with 129 additions and 3 deletions

View file

@ -66,7 +66,8 @@ if(ARCH STREQUAL "i386")
add_hal(halxbox SOURCES xbox/halxbox.rc COMPONENTS xbox up) add_hal(halxbox SOURCES xbox/halxbox.rc COMPONENTS xbox up)
add_hal(halpc98 SOURCES pc98/halpc98.rc COMPONENTS pc98 up) add_hal(halpc98 SOURCES pc98/halpc98.rc COMPONENTS pc98 up)
#add_hal(halmacpi SOURCES acpi/halacpi.rc COMPONENTS generic acpi smp pic) #add_hal(halmacpi SOURCES smp/halmacpi.rc COMPONENTS generic acpi smp apic)
#add_hal(halmp SOURCES mp/halmp.rc COMPONENTS generic legacy smp apic)
elseif(ARCH STREQUAL "amd64") elseif(ARCH STREQUAL "amd64")

View file

@ -1,11 +1,20 @@
include_directories(include ${REACTOS_SOURCE_DIR}/drivers/bus/acpi/acpica/include)
list(APPEND HAL_ACPI_SOURCE list(APPEND HAL_ACPI_SOURCE
acpi/halacpi.c acpi/halacpi.c
acpi/halpnpdd.c acpi/halpnpdd.c
acpi/busemul.c acpi/busemul.c
acpi/madt.c
legacy/bus/pcibus.c) legacy/bus/pcibus.c)
# Needed to compile while using ACPICA
if(ARCH STREQUAL "amd64")
add_definitions(-DWIN64)
endif()
add_library(lib_hal_acpi OBJECT ${HAL_ACPI_SOURCE}) add_library(lib_hal_acpi OBJECT ${HAL_ACPI_SOURCE})
add_pch(lib_hal_acpi ${REACTOS_SOURCE_DIR}/drivers/bus/acpi/acpica/include/acpi.h ${HAL_ACPI_SOURCE})
add_dependencies(lib_hal_acpi bugcodes xdk) add_dependencies(lib_hal_acpi bugcodes xdk)
#add_pch(lib_hal_acpi include/hal.h) #add_pch(lib_hal_acpi include/hal.h)

30
hal/halx86/acpi/madt.c Normal file
View file

@ -0,0 +1,30 @@
/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Source File for MADT Table parsing
* COPYRIGHT: Copyright 2021 Justin Miller <justinmiller100@gmail.com>
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#include <acpi.h>
/* ACPI_BIOS_ERROR defined in acoutput.h and bugcodes.h */
#undef ACPI_BIOS_ERROR
#include <smp.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/
PROCESSOR_IDENTITY HalpStaticProcessorIdentity[MAXIMUM_PROCESSORS] = {{0}};
PPROCESSOR_IDENTITY HalpProcessorIdentity = NULL;
/* FUNCTIONS ******************************************************************/
VOID
HalpParseApicTables(
_In_ PLOADER_PARAMETER_BLOCK LoaderBlock)
{
UNIMPLEMENTED;
}

View file

@ -9,6 +9,7 @@
#include <hal.h> #include <hal.h>
#include "apicp.h" #include "apicp.h"
#include <smp.h>
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
@ -24,6 +25,16 @@ HalpInitProcessor(
IN ULONG ProcessorNumber, IN ULONG ProcessorNumber,
IN PLOADER_PARAMETER_BLOCK LoaderBlock) IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{ {
if (ProcessorNumber == 0)
{
/* APIC tables should always be parsed once before touching APIC */
HalpParseApicTables(LoaderBlock);
}
#ifdef CONFIG_SMP
HalpSetupProcessorsTable(ProcessorNumber);
#endif
/* Initialize the local APIC for this cpu */ /* Initialize the local APIC for this cpu */
ApicInitializeLocalApic(ProcessorNumber); ApicInitializeLocalApic(ProcessorNumber);

27
hal/halx86/include/smp.h Normal file
View file

@ -0,0 +1,27 @@
/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Header File for SMP support
* COPYRIGHT: Copyright 2021 Justin Miller <justinmiller100@gmail.com>
*/
#pragma once
/* This table is filled for each physical processor on system */
typedef struct _PROCESSOR_IDENTITY
{
UCHAR ProcessorId;
UCHAR LapicId;
BOOLEAN ProcessorStarted;
BOOLEAN BSPCheck;
PKPRCB ProcessorPrcb;
} PROCESSOR_IDENTITY, *PPROCESSOR_IDENTITY;
VOID
HalpParseApicTables(
_In_ PLOADER_PARAMETER_BLOCK LoaderBlock);
VOID
HalpSetupProcessorsTable(
_In_ UINT32 NTProcessorNumber);

View file

@ -9,7 +9,8 @@ list(APPEND HAL_LEGACY_SOURCE
legacy/bus/sysbus.c legacy/bus/sysbus.c
legacy/bussupp.c legacy/bussupp.c
legacy/halpnpdd.c legacy/halpnpdd.c
legacy/halpcat.c) legacy/halpcat.c
smp/mps/mps.c)
add_library(lib_hal_legacy OBJECT ${HAL_LEGACY_SOURCE}) add_library(lib_hal_legacy OBJECT ${HAL_LEGACY_SOURCE})
add_dependencies(lib_hal_legacy bugcodes xdk) add_dependencies(lib_hal_legacy bugcodes xdk)

View file

@ -1,7 +1,8 @@
list(APPEND HAL_SMP_SOURCE list(APPEND HAL_SMP_SOURCE
generic/buildtype.c generic/buildtype.c
generic/spinlock.c) generic/spinlock.c
smp/smp.c)
add_library(lib_hal_smp OBJECT ${HAL_SMP_SOURCE}) add_library(lib_hal_smp OBJECT ${HAL_SMP_SOURCE})
add_dependencies(lib_hal_smp bugcodes xdk) add_dependencies(lib_hal_smp bugcodes xdk)

22
hal/halx86/smp/mps/mps.c Normal file
View file

@ -0,0 +1,22 @@
/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Source File for MPS specific functions
* COPYRIGHT: Copyright 2021 Justin Miller <justinmiller100@gmail.com>
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#include <smp.h>
#define NDEBUG
#include <debug.h>
/* FUNCTIONS ******************************************************************/
VOID
HalpParseApicTables(
_In_ PLOADER_PARAMETER_BLOCK LoaderBlock)
{
UNIMPLEMENTED;
}

24
hal/halx86/smp/smp.c Normal file
View file

@ -0,0 +1,24 @@
/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Core source file for SMP management
* COPYRIGHT: Copyright 2021 Justin Miller <justinmiller100@gmail.com>
*/
/* INCLUDES ******************************************************************/
#include <hal.h>
#include <smp.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS *******************************************************************/
/* FUNCTIONS *****************************************************************/
VOID
HalpSetupProcessorsTable(
_In_ UINT32 NTProcessorNumber)
{
UNIMPLEMENTED;
}