- Properly fix boot/build.

svn path=/trunk/; revision=24968
This commit is contained in:
Alex Ionescu 2006-11-29 17:35:15 +00:00
parent 09f6f9fded
commit f675588849
5 changed files with 157 additions and 3 deletions

View file

@ -9,7 +9,6 @@
<file>cmos.c</file>
<file>dma.c</file>
<file>drive.c</file>
<file>halinit.c</file>
<file>misc.c</file>
<file>pci.c</file>
<file>portio.c</file>
@ -26,6 +25,7 @@
<define name="_NTHAL_" />
<define name="__USE_W32API" />
<file>irql.c</file>
<file>halinit.c</file>
<file>processor.c</file>
<file>spinlock.c</file>
</module>

View file

@ -93,7 +93,7 @@ HalInitSystem(IN ULONG BootPhase,
}
/* Initialize the PICs */
//HalpInitPICs();
HalpInitPICs();
/* Force initial PIC state */
KfRaiseIrql(KeGetCurrentIrql());

View file

@ -116,7 +116,7 @@ HalSetTimeIncrement(IN ULONG Increment)
/* Normalize between our minimum (1 ms) and maximum (variable) setting */
if (Increment > HalpLargestClockMS) Increment = HalpLargestClockMS;
if (Increment < 0) Increment = 1;
if (Increment <= 0) Increment = 1;
/* Set the rate and tell HAL we want to change it */
HalpNextMSRate = Increment;

View file

@ -0,0 +1,153 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: GPL - See COPYING in the top level directory
* FILE: hal/halx86/generic/halinit.c
* PURPOSE: HAL Entrypoint and Initialization
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS *******************************************************************/
HALP_HOOKS HalpHooks;
BOOLEAN HalpPciLockSettings;
/* PRIVATE FUNCTIONS *********************************************************/
VOID
NTAPI
HalpGetParameters(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
PCHAR CommandLine;
/* Make sure we have a loader block and command line */
if ((LoaderBlock) && (LoaderBlock->LoadOptions))
{
/* Read the command line */
CommandLine = LoaderBlock->LoadOptions;
/* Check if PCI is locked */
if (strstr(CommandLine, "PCILOCK")) HalpPciLockSettings = TRUE;
/* Check for initial breakpoint */
if (strstr(CommandLine, "BREAK")) DbgBreakPoint();
}
}
/* FUNCTIONS *****************************************************************/
/*
* @implemented
*/
BOOLEAN
NTAPI
HalInitSystem(IN ULONG BootPhase,
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
PKPRCB Prcb = KeGetCurrentPrcb();
/* Check the boot phase */
if (!BootPhase)
{
/* Phase 0... save bus type */
HalpBusType = LoaderBlock->u.I386.MachineType & 0xFF;
/* 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 */
if (Prcb->MajorVersion != PRCB_MAJOR_VERSION)
{
/* Validation failed, bugcheck */
KeBugCheckEx(MISMATCHED_HAL, 1, Prcb->MajorVersion, 1, 0);
}
/* Initialize the PICs */
HalpInitPICs();
/* Force initial PIC state */
KfRaiseIrql(KeGetCurrentIrql());
/* Initialize the clock */
HalpInitializeClock();
/* Setup busy waiting */
//HalpCalibrateStallExecution();
/* Fill out the dispatch tables */
HalQuerySystemInformation = HaliQuerySystemInformation;
HalSetSystemInformation = HaliSetSystemInformation;
HalInitPnpDriver = NULL; // FIXME: TODO
HalGetDmaAdapter = HalpGetDmaAdapter;
HalGetInterruptTranslator = NULL; // FIXME: TODO
/* Initialize the hardware lock (CMOS) */
KeInitializeSpinLock(&HalpSystemHardwareLock);
}
else if (BootPhase == 1)
{
/* Initialize the default HAL stubs for bus handling functions */
HalpInitNonBusHandler();
/* Enable the clock interrupt */
((PKIPCR)KeGetPcr())->IDT[0x30].ExtendedOffset =
(USHORT)(((ULONG_PTR)HalpClockInterrupt >> 16) & 0xFFFF);
((PKIPCR)KeGetPcr())->IDT[0x30].Offset =
(USHORT)HalpClockInterrupt;
HalEnableSystemInterrupt(0x30, CLOCK2_LEVEL, Latched);
/* Initialize DMA. NT does this in Phase 0 */
HalpInitDma();
}
/* All done, return */
return TRUE;
}
/*
* @unimplemented
*/
VOID
NTAPI
HalReportResourceUsage(VOID)
{
/* Initialize PCI bus. */
HalpInitializePciBus();
/* FIXME: This is done in ReactOS MP HAL only*/
//HaliReconfigurePciInterrupts();
/* FIXME: Report HAL Usage to kernel */
}
/* EOF */

View file

@ -11,6 +11,7 @@
<library>hal_generic_pc</library>
<library>ntoskrnl</library>
<file>apic.c</file>
<file>halinit.c</file>
<file>halinit_mp.c</file>
<file>ioapic.c</file>
<file>ipi_mp.c</file>