mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[HAL]
- give apic hal its own halinit_apic - give minihal an own halinit_mini.c containing function stubs - move HalInitializeProcessor to halinit.c and add hal specific function HalpInitProcessor - get rid of all the #ifndef _MINIHAL_ in halinit.c and move the file to lib_hal_generic - improve the hal version/build check - Update spec file for amd64 svn path=/trunk/; revision=53625
This commit is contained in:
parent
2f5ccca699
commit
f85bf4380d
9 changed files with 204 additions and 74 deletions
|
@ -27,12 +27,13 @@
|
|||
@ stdcall HalAllocateCommonBuffer(ptr long ptr long)
|
||||
@ stdcall HalAllocateCrashDumpRegisters(ptr ptr)
|
||||
@ stdcall HalAssignSlotResources(ptr ptr ptr ptr long long long ptr)
|
||||
@ stdcall HalBeginSystemInterrupt(long long ptr)
|
||||
@ stdcall -arch=i386,arm HalBeginSystemInterrupt(long long ptr)
|
||||
@ stdcall HalCalibratePerformanceCounter(ptr long long)
|
||||
;@ stdcall -arch=x86_64 HalCallBios()
|
||||
@ stdcall HalDisableSystemInterrupt(long long)
|
||||
@ stdcall HalDisplayString(str)
|
||||
@ stdcall HalEnableSystemInterrupt(long long long)
|
||||
@ stdcall HalEndSystemInterrupt(long long)
|
||||
@ stdcall -arch=i386,arm HalEndSystemInterrupt(long long)
|
||||
@ stdcall HalFlushCommonBuffer(long long long long long)
|
||||
@ stdcall HalFreeCommonBuffer(ptr long long long ptr long)
|
||||
@ stdcall HalGetAdapter(ptr ptr)
|
||||
|
@ -41,18 +42,22 @@
|
|||
@ stdcall HalGetEnvironmentVariable(str long str)
|
||||
@ fastcall -arch=arm HalGetInterruptSource()
|
||||
@ stdcall HalGetInterruptVector(long long long long ptr ptr)
|
||||
@ stdcall -arch=i386 HalHandleNMI(ptr)
|
||||
;@ stdcall -arch=x86_64 HalHandleMcheck()
|
||||
@ stdcall -arch=i386,x86_64 HalHandleNMI(ptr)
|
||||
@ stdcall HalInitSystem(long ptr)
|
||||
@ stdcall HalInitializeProcessor(long ptr)
|
||||
;@ stdcall -arch=x86_64 HalIsHyperThreadingEnabled()
|
||||
@ stdcall HalMakeBeep(long)
|
||||
@ stdcall HalProcessorIdle()
|
||||
@ stdcall HalPutDmaAdapter(ptr)
|
||||
@ stdcall -arch=i386 HalPutDmaAdapter(ptr)
|
||||
@ stdcall HalQueryDisplayParameters(ptr ptr ptr ptr)
|
||||
@ stdcall HalQueryRealTimeClock(ptr)
|
||||
@ stdcall HalReadDmaCounter(ptr)
|
||||
@ stdcall HalReportResourceUsage()
|
||||
@ stdcall HalRequestIpi(long)
|
||||
@ stdcall HalReturnToFirmware(long)
|
||||
;@ stdcall -arch=x86_64 HalSendNMI()
|
||||
;@ stdcall -arch=x86_64 HalSendSoftwareInterrupt()
|
||||
@ stdcall HalSetBusData(long long long ptr long)
|
||||
@ stdcall HalSetBusDataByOffset(long long long ptr long long)
|
||||
@ stdcall HalSetDisplayParameters(long long)
|
||||
|
@ -65,6 +70,7 @@
|
|||
@ stdcall HalStopProfileInterrupt(long)
|
||||
@ fastcall -arch=arm HalSweepIcache()
|
||||
@ fastcall -arch=arm HalSweepDcache()
|
||||
;@ stdcall -arch=x86_64 HalSystemVectorDispatchEntry()
|
||||
@ stdcall HalTranslateBusAddress(long long long long ptr ptr)
|
||||
@ stdcall IoFlushAdapterBuffers(ptr ptr ptr ptr long long)
|
||||
@ stdcall IoFreeAdapterChannel(ptr)
|
||||
|
@ -98,3 +104,6 @@
|
|||
@ stdcall -arch=i386,arm WRITE_PORT_ULONG(ptr long)
|
||||
@ stdcall -arch=i386,arm WRITE_PORT_USHORT(ptr long)
|
||||
@ stdcall -arch=x86_64 HalInitializeBios(long ptr)
|
||||
;@ stdcall -arch=x86_64 x86BiosExecuteInterrupt()
|
||||
;@ stdcall -arch=x86_64 x86BiosInitializeBiosEx()
|
||||
;@ stdcall -arch=x86_64 x86BiosTranslateAddress()
|
||||
|
|
|
@ -13,6 +13,7 @@ list(APPEND HAL_GENERIC_SOURCE
|
|||
generic/display.c
|
||||
generic/dma.c
|
||||
generic/drive.c
|
||||
generic/halinit.c
|
||||
generic/memory.c
|
||||
generic/misc.c
|
||||
generic/reboot.c
|
||||
|
@ -56,8 +57,6 @@ target_link_libraries(lib_hal_acpi lib_hal_generic)
|
|||
|
||||
list(APPEND HAL_UP_SOURCE
|
||||
generic/spinlock.c
|
||||
generic/halinit.c
|
||||
up/halinit_up.c
|
||||
up/processor.c)
|
||||
|
||||
list(APPEND HAL_PIC_SOURCE
|
||||
|
@ -65,12 +64,14 @@ list(APPEND HAL_PIC_SOURCE
|
|||
generic/timer.c
|
||||
generic/systimer.S
|
||||
generic/trap.S
|
||||
up/halinit_up.c
|
||||
up/pic.c)
|
||||
|
||||
list(APPEND HAL_APIC_SOURCE
|
||||
apic/apic.c
|
||||
apic/apictimer.c
|
||||
apic/apictrap.S
|
||||
apic/halinit_apic.c
|
||||
apic/rtctimer.c
|
||||
apic/tsc.c
|
||||
apic/tsccal.S)
|
||||
|
@ -98,7 +99,7 @@ if(ARCH MATCHES i386)
|
|||
generic/sysinfo.c
|
||||
generic/timer.c
|
||||
generic/usage.c
|
||||
up/halinit_up.c
|
||||
up/halinit_mini.c
|
||||
up/pic.c
|
||||
up/processor.c)
|
||||
|
||||
|
@ -157,7 +158,6 @@ elseif(ARCH MATCHES amd64)
|
|||
${HAL_ACPI_SOURCE}
|
||||
${HAL_APIC_SOURCE}
|
||||
generic/spinlock.c
|
||||
generic/halinit.c
|
||||
amd64/x86bios.c
|
||||
amd64/halinit.c
|
||||
amd64/processor.c
|
||||
|
|
53
reactos/hal/halx86/apic/halinit_apic.c
Normal file
53
reactos/hal/halx86/apic/halinit_apic.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $Id: halinit_up.c 53529 2011-09-02 14:45:19Z tkreuzer $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/hal/x86/halinit.c
|
||||
* PURPOSE: Initalize the x86 hal
|
||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
||||
* UPDATE HISTORY:
|
||||
* 11/06/98: Created
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <hal.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
ApicInitializeLocalApic(ULONG Cpu);
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
HalpInitProcessor(
|
||||
IN ULONG ProcessorNumber,
|
||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
DPRINT1("ApicInitializeProcessor(%ld)\n", ProcessorNumber);
|
||||
|
||||
/* Initialize the local APIC for this cpu */
|
||||
ApicInitializeLocalApic(ProcessorNumber);
|
||||
|
||||
/* Initialize the timer */
|
||||
//ApicInitializeTimer(ProcessorNumber);
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
HalpInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
HalpInitPhase1(VOID)
|
||||
{
|
||||
/* Initialize DMA. NT does this in Phase 0 */
|
||||
HalpInitDma();
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -41,6 +41,27 @@ HalpGetParameters(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
HalInitializeProcessor(
|
||||
IN ULONG ProcessorNumber,
|
||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
/* Hal specific initialization for this cpu */
|
||||
HalpInitProcessor(ProcessorNumber, LoaderBlock);
|
||||
|
||||
/* Set default stall count */
|
||||
KeGetPcr()->StallScaleFactor = INITIAL_STALL_COUNT;
|
||||
|
||||
/* Update the interrupt affinity and processor mask */
|
||||
InterlockedBitTestAndSet((PLONG)&HalpActiveProcessors, ProcessorNumber);
|
||||
InterlockedBitTestAndSet((PLONG)&HalpDefaultInterruptAffinity,
|
||||
ProcessorNumber);
|
||||
|
||||
/* Register routines for KDCOM */
|
||||
HalpRegisterKdSupportFunctions();
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
@ -61,48 +82,25 @@ HalInitSystem(IN ULONG BootPhase,
|
|||
/* Get command-line parameters */
|
||||
HalpGetParameters(LoaderBlock);
|
||||
|
||||
/* Checked HAL requires checked kernel */
|
||||
#if DBG
|
||||
if (!(Prcb->BuildType & PRCB_BUILD_DEBUG))
|
||||
{
|
||||
/* No match, bugcheck */
|
||||
KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 1, 0);
|
||||
}
|
||||
#else
|
||||
/* Release build requires release HAL */
|
||||
if (Prcb->BuildType & PRCB_BUILD_DEBUG)
|
||||
{
|
||||
/* No match, bugcheck */
|
||||
KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* SMP HAL requires SMP kernel */
|
||||
if (Prcb->BuildType & PRCB_BUILD_UNIPROCESSOR)
|
||||
{
|
||||
/* No match, bugcheck */
|
||||
KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Validate the PRCB */
|
||||
/* Check for PRCB version mismatch */
|
||||
if (Prcb->MajorVersion != PRCB_MAJOR_VERSION)
|
||||
{
|
||||
/* Validation failed, bugcheck */
|
||||
KeBugCheckEx(MISMATCHED_HAL, 1, Prcb->MajorVersion, 1, 0);
|
||||
/* No match, bugcheck */
|
||||
KeBugCheckEx(MISMATCHED_HAL, 1, Prcb->MajorVersion, PRCB_MAJOR_VERSION, 0);
|
||||
}
|
||||
|
||||
/* Checked/free HAL requires checked/free kernel */
|
||||
if (Prcb->BuildType != HAL_BUILD_TYPE)
|
||||
{
|
||||
/* No match, bugcheck */
|
||||
KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, HAL_BUILD_TYPE, 0);
|
||||
}
|
||||
|
||||
#ifndef _MINIHAL_
|
||||
/* Initialize ACPI */
|
||||
HalpSetupAcpiPhase0(LoaderBlock);
|
||||
|
||||
/* Initialize the PICs */
|
||||
HalpInitializePICs(TRUE);
|
||||
#endif
|
||||
|
||||
/* Force initial PIC state */
|
||||
KfRaiseIrql(KeGetCurrentIrql());
|
||||
|
||||
/* Initialize CMOS lock */
|
||||
KeInitializeSpinLock(&HalpSystemHardwareLock);
|
||||
|
@ -114,17 +112,10 @@ HalInitSystem(IN ULONG BootPhase,
|
|||
HalQuerySystemInformation = HaliQuerySystemInformation;
|
||||
HalSetSystemInformation = HaliSetSystemInformation;
|
||||
HalInitPnpDriver = HaliInitPnpDriver;
|
||||
#ifndef _MINIHAL_
|
||||
HalGetDmaAdapter = HalpGetDmaAdapter;
|
||||
#else
|
||||
HalGetDmaAdapter = NULL;
|
||||
#endif
|
||||
|
||||
HalGetInterruptTranslator = NULL; // FIXME: TODO
|
||||
#ifndef _MINIHAL_
|
||||
HalResetDisplay = HalpBiosDisplayReset;
|
||||
#else
|
||||
HalResetDisplay = NULL;
|
||||
#endif
|
||||
HalHaltSystem = HaliHaltSystem;
|
||||
|
||||
/* Register IRQ 2 */
|
||||
|
@ -140,10 +131,8 @@ HalInitSystem(IN ULONG BootPhase,
|
|||
/* Setup busy waiting */
|
||||
HalpCalibrateStallExecution();
|
||||
|
||||
#ifndef _MINIHAL_
|
||||
/* Initialize the clock */
|
||||
HalpInitializeClock();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We could be rebooting with a pending profile interrupt,
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<file>bussupp.c</file>
|
||||
</directory>
|
||||
<directory name="up">
|
||||
<file>halinit_up.c</file>
|
||||
<file>halinit_mini.c</file>
|
||||
<file>pic.c</file>
|
||||
<file>processor.c</file>
|
||||
</directory>
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
#define REGISTERCALL __attribute__((regparm(3)))
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
#define HAL_BUILD_TYPE (DBG ? PRCB_BUILD_DEBUG : 0)
|
||||
#else
|
||||
#define HAL_BUILD_TYPE ((DBG ? PRCB_BUILD_DEBUG : 0) | PRCB_BUILD_UNIPROCESSOR)
|
||||
#endif
|
||||
|
||||
typedef struct _HAL_BIOS_FRAME
|
||||
{
|
||||
ULONG SegSs;
|
||||
|
@ -836,8 +842,18 @@ HalpDebugPciDumpBus(
|
|||
IN PPCI_COMMON_CONFIG PciData
|
||||
);
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
HalpInitProcessor(
|
||||
IN ULONG ProcessorNumber,
|
||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock
|
||||
);
|
||||
|
||||
#ifdef _M_AMD64
|
||||
#define KfLowerIrql KeLowerIrql
|
||||
#define KiEnterInterruptTrap(TrapFrame) /* We do all neccessary in asm code */
|
||||
#define KiEoiHelper() return
|
||||
#define HalBeginSystemInterrupt(Irql, Vector, OldIrql) TRUE
|
||||
#ifndef CONFIG_SMP
|
||||
/* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */
|
||||
#define KiAcquireSpinLock(SpinLock)
|
||||
|
|
75
reactos/hal/halx86/up/halinit_mini.c
Normal file
75
reactos/hal/halx86/up/halinit_mini.c
Normal file
|
@ -0,0 +1,75 @@
|
|||
/* $Id: halinit_up.c 53529 2011-09-02 14:45:19Z tkreuzer $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/hal/x86/halinit.c
|
||||
* PURPOSE: Initalize the x86 hal
|
||||
* PROGRAMMER: David Welch (welch@cwcom.net)
|
||||
* UPDATE HISTORY:
|
||||
* 11/06/98: Created
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <hal.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
HalpInitProcessor(
|
||||
IN ULONG ProcessorNumber,
|
||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
}
|
||||
|
||||
VOID
|
||||
HalpInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
}
|
||||
|
||||
VOID
|
||||
HalpInitPhase1(VOID)
|
||||
{
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
HalpSetupAcpiPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
HalpInitializePICs(IN BOOLEAN EnableInterrupts)
|
||||
{
|
||||
}
|
||||
|
||||
PDMA_ADAPTER
|
||||
NTAPI
|
||||
HalpGetDmaAdapter(
|
||||
IN PVOID Context,
|
||||
IN PDEVICE_DESCRIPTION DeviceDescription,
|
||||
OUT PULONG NumberOfMapRegisters)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
HalpBiosDisplayReset(VOID)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
INIT_FUNCTION
|
||||
HalpInitializeClock(VOID)
|
||||
{
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -17,6 +17,16 @@
|
|||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
HalpInitProcessor(
|
||||
IN ULONG ProcessorNumber,
|
||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
/* Set default IDR */
|
||||
KeGetPcr()->IDR = 0xFFFFFFFB;
|
||||
}
|
||||
|
||||
VOID
|
||||
HalpInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
|
@ -26,7 +36,6 @@ HalpInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
VOID
|
||||
HalpInitPhase1(VOID)
|
||||
{
|
||||
#ifndef _MINIHAL_
|
||||
/* Enable IRQ 0 */
|
||||
HalpEnableInterruptHandler(IDT_DEVICE,
|
||||
0,
|
||||
|
@ -45,7 +54,6 @@ HalpInitPhase1(VOID)
|
|||
|
||||
/* Initialize DMA. NT does this in Phase 0 */
|
||||
HalpInitDma();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -28,26 +28,6 @@ HaliHaltSystem(VOID)
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
HalInitializeProcessor(IN ULONG ProcessorNumber,
|
||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
/* Set default IDR and stall count */
|
||||
KeGetPcr()->IDR = 0xFFFFFFFB;
|
||||
KeGetPcr()->StallScaleFactor = INITIAL_STALL_COUNT;
|
||||
|
||||
/* Update the interrupt affinity and processor mask */
|
||||
InterlockedBitTestAndSet((PLONG)&HalpActiveProcessors, ProcessorNumber);
|
||||
InterlockedBitTestAndSet((PLONG)&HalpDefaultInterruptAffinity,
|
||||
ProcessorNumber);
|
||||
|
||||
/* Register routines for KDCOM */
|
||||
HalpRegisterKdSupportFunctions();
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
|
Loading…
Reference in a new issue