reactos/hal/halx86/legacy/halpcat.c

127 lines
2.6 KiB
C
Raw Normal View History

/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
[HAL]: Bus support in the HAL actually creates a further wedge between the different x86 HALs: There are actually two dinstinct implementations. On the ACPI HAL, the system is assumed not to have things like special ISA, MCA, EISA buses, and a PCI driver is used in combination with the ACPI Interface for PCI Bus support. On non-ACPI systems, the legacy "Bus Handler" library is used, and the HAL provides a core set of CMOS, EISA, ISA, MCA and PCI bus handlers, each with their own routines and specific code. Additionally, PCI IRQ Routing and other PCI bus internals are handled directly by the HAL -- on the ACPI HAL, the PCI Bus support is implemented through a "Fake"/static bus handler, just to keep the functions shared. On ReactOS, both the ACPI and non-ACPI HAL were currently using a mix of both HAL bus handling types, mostly implemented the "ACPI way" (with a fake PCI bus handler and such). As a result, none of the Hal*Bus HALDISPATCH routines were implemented, which bus drivers expect to find when they're not on ACPI systems (ReactOS today). eVb's new PCI driver was crashing, for example. Furthermore, legacy systems suffer, because the ACPI HAL Bus routines (that we currently have) expect perfect ACPI-style-compliant systems, not the legacy crap from the early 90ies. This works fine in VMs and new hardware, but old hardware is left behind. This patch basically corrects the first part of the problem, by making the bus handling support separate between ACPI and non-ACPI HALs. For now, the code remains 100% the same in functionality between both. However, I have started adding the first few elements: [HAL]: Implement HalRegisterBusHandler HALDISPATCH routine. [HAL]: On legacy HALs, register the CMOS, ISA, SYSTEM handlers. [HAL]: Add cmosbus.c. Stub all bus-specific bus handler routines in the xxxbus.c files. No real functionality change occurs with this patch, yet. svn path=/trunk/; revision=47649
2010-06-07 01:09:41 +00:00
* FILE: hal/halx86/generic/legacy/halpcat.c
* PURPOSE: HAL Legacy Support Code
* PROGRAMMERS: ReactOS Portable Systems Group
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/
/* This determines the HAL type */
BOOLEAN HalDisableFirmwareMapper = FALSE;
PWCHAR HalHardwareIdString = L"e_isa_up";
PWCHAR HalName = L"PC Compatible Eisa/Isa HAL";
/* PRIVATE FUNCTIONS **********************************************************/
NTSTATUS
NTAPI
INIT_FUNCTION
HalpSetupAcpiPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
/* There is no ACPI on these HALs */
return STATUS_NO_SUCH_DEVICE;
}
VOID
NTAPI
INIT_FUNCTION
HalpBuildAddressMap(VOID)
{
/* FIXME: Inherit ROM blocks from the registry */
//HalpInheritROMBlocks();
/* FIXME: Add the ROM blocks to our ranges */
//HalpAddROMRanges();
}
BOOLEAN
NTAPI
INIT_FUNCTION
HalpGetDebugPortTable(VOID)
{
/* No ACPI */
return FALSE;
}
ULONG
NTAPI
INIT_FUNCTION
HalpIs16BitPortDecodeSupported(VOID)
{
/* Only EISA systems support this */
return (HalpBusType == MACHINE_TYPE_EISA) ? CM_RESOURCE_PORT_16_BIT_DECODE : 0;
}
#if 0
NTSTATUS
NTAPI
INIT_FUNCTION
HaliInitPnpDriver(VOID)
{
/* On PC-AT, this will interface with the PCI driver */
//HalpDebugPciBus();
return STATUS_SUCCESS;
}
#endif
/*
* @implemented
*/
VOID
NTAPI
INIT_FUNCTION
HalReportResourceUsage(VOID)
{
INTERFACE_TYPE InterfaceType;
UNICODE_STRING HalString;
/* FIXME: Initialize MCA bus */
/* Initialize PCI bus. */
HalpInitializePciBus();
/* Initialize the stubs */
HalpInitializePciStubs();
/* What kind of bus is this? */
switch (HalpBusType)
{
/* ISA Machine */
case MACHINE_TYPE_ISA:
InterfaceType = Isa;
break;
/* EISA Machine */
case MACHINE_TYPE_EISA:
InterfaceType = Eisa;
break;
/* MCA Machine */
case MACHINE_TYPE_MCA:
InterfaceType = MicroChannel;
break;
/* Unknown */
default:
InterfaceType = Internal;
break;
}
/* Build HAL usage */
RtlInitUnicodeString(&HalString, HalName);
HalpReportResourceUsage(&HalString, InterfaceType);
/* Setup PCI debugging and Hibernation */
HalpRegisterPciDebuggingDeviceInfo();
}
/* EOF */