Author: tkreuzer
Date: Wed Sep 7 18:25:43 2011
New Revision: 53625
URL:
http://svn.reactos.org/svn/reactos?rev=53625&view=rev
Log:
[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
Added:
trunk/reactos/hal/halx86/apic/halinit_apic.c (with props)
trunk/reactos/hal/halx86/up/halinit_mini.c (with props)
Modified:
trunk/reactos/hal/hal.spec
trunk/reactos/hal/halx86/CMakeLists.txt
trunk/reactos/hal/halx86/generic/halinit.c
trunk/reactos/hal/halx86/hal_mini.rbuild
trunk/reactos/hal/halx86/include/halp.h
trunk/reactos/hal/halx86/up/halinit_up.c
trunk/reactos/hal/halx86/up/processor.c
Modified: trunk/reactos/hal/hal.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/hal.spec?rev=53625&…
==============================================================================
--- trunk/reactos/hal/hal.spec [iso-8859-1] (original)
+++ trunk/reactos/hal/hal.spec [iso-8859-1] Wed Sep 7 18:25:43 2011
@@ -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()
Modified: trunk/reactos/hal/halx86/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/CMakeLists.txt?…
==============================================================================
--- trunk/reactos/hal/halx86/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/CMakeLists.txt [iso-8859-1] Wed Sep 7 18:25:43 2011
@@ -13,6 +13,7 @@
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 @@
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 @@
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 @@
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 @@
${HAL_ACPI_SOURCE}
${HAL_APIC_SOURCE}
generic/spinlock.c
- generic/halinit.c
amd64/x86bios.c
amd64/halinit.c
amd64/processor.c
Added: trunk/reactos/hal/halx86/apic/halinit_apic.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/apic/halinit_ap…
==============================================================================
--- trunk/reactos/hal/halx86/apic/halinit_apic.c (added)
+++ trunk/reactos/hal/halx86/apic/halinit_apic.c [iso-8859-1] Wed Sep 7 18:25:43 2011
@@ -1,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(a)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 */
Propchange: trunk/reactos/hal/halx86/apic/halinit_apic.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/hal/halx86/generic/halinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/halinit…
==============================================================================
--- trunk/reactos/hal/halx86/generic/halinit.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/halinit.c [iso-8859-1] Wed Sep 7 18:25:43 2011
@@ -41,6 +41,27 @@
/* 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 @@
/* Get command-line parameters */
HalpGetParameters(LoaderBlock);
- /* Checked HAL requires checked kernel */
-#if DBG
- if (!(Prcb->BuildType & PRCB_BUILD_DEBUG))
+ /* Check for PRCB version mismatch */
+ if (Prcb->MajorVersion != PRCB_MAJOR_VERSION)
{
/* No match, bugcheck */
- KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 1, 0);
+ KeBugCheckEx(MISMATCHED_HAL, 1, Prcb->MajorVersion, PRCB_MAJOR_VERSION,
0);
}
-#else
- /* Release build requires release HAL */
- if (Prcb->BuildType & PRCB_BUILD_DEBUG)
+
+ /* Checked/free HAL requires checked/free kernel */
+ if (Prcb->BuildType != HAL_BUILD_TYPE)
{
/* 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 */
- if (Prcb->MajorVersion != PRCB_MAJOR_VERSION)
- {
- /* Validation failed, bugcheck */
- KeBugCheckEx(MISMATCHED_HAL, 1, Prcb->MajorVersion, 1, 0);
+ 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 @@
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 @@
/* Setup busy waiting */
HalpCalibrateStallExecution();
-#ifndef _MINIHAL_
/* Initialize the clock */
HalpInitializeClock();
-#endif
/*
* We could be rebooting with a pending profile interrupt,
Modified: trunk/reactos/hal/halx86/hal_mini.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/hal_mini.rbuild…
==============================================================================
--- trunk/reactos/hal/halx86/hal_mini.rbuild [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/hal_mini.rbuild [iso-8859-1] Wed Sep 7 18:25:43 2011
@@ -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>
Modified: trunk/reactos/hal/halx86/include/halp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/halp.h?…
==============================================================================
--- trunk/reactos/hal/halx86/include/halp.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/include/halp.h [iso-8859-1] Wed Sep 7 18:25:43 2011
@@ -19,6 +19,12 @@
#define REGISTERCALL FASTCALL
#else
#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
@@ -836,8 +842,18 @@
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)
Added: trunk/reactos/hal/halx86/up/halinit_mini.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/up/halinit_mini…
==============================================================================
--- trunk/reactos/hal/halx86/up/halinit_mini.c (added)
+++ trunk/reactos/hal/halx86/up/halinit_mini.c [iso-8859-1] Wed Sep 7 18:25:43 2011
@@ -1,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(a)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 */
Propchange: trunk/reactos/hal/halx86/up/halinit_mini.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/hal/halx86/up/halinit_up.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/up/halinit_up.c…
==============================================================================
--- trunk/reactos/hal/halx86/up/halinit_up.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/up/halinit_up.c [iso-8859-1] Wed Sep 7 18:25:43 2011
@@ -18,6 +18,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 @@
VOID
HalpInitPhase1(VOID)
{
-#ifndef _MINIHAL_
/* Enable IRQ 0 */
HalpEnableInterruptHandler(IDT_DEVICE,
0,
@@ -45,7 +54,6 @@
/* Initialize DMA. NT does this in Phase 0 */
HalpInitDma();
-#endif
}
/* EOF */
Modified: trunk/reactos/hal/halx86/up/processor.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/up/processor.c?…
==============================================================================
--- trunk/reactos/hal/halx86/up/processor.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/up/processor.c [iso-8859-1] Wed Sep 7 18:25:43 2011
@@ -28,26 +28,6 @@
/* 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