[HAL]: Split HalReportResouceUsage into per-platform function, since PC/AT HAL and ACPI HAL have different requirements. As a bonus, the ACPI HAL now identifies itself as ACPI Compatible, instead of using the "PC Compatible" moniker.

[HAL]: Implement HalpGetNMICrashFlag so you can do NMI crashes now.
[HAL]: Implement basic HalpRegistryPciDebuggingDeviceInfo for the day someone implements the Kd routines.
[HAL]: HalpInitializePciBus needs to be different between "Bus Handler HALs" (non-ACPI/embedded) and "Non-Bus Handler HALs" (ACPI/x64). On ACPI, all we do is setup the raw PCI Stubs and NMI crashing. PC/AT will need more involved code.

svn path=/trunk/; revision=46647
This commit is contained in:
Sir Richard 2010-04-01 19:42:07 +00:00
parent b021015c8f
commit 111a56f09b
6 changed files with 248 additions and 48 deletions

View file

@ -861,4 +861,64 @@ HalpSetupAcpiPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
return STATUS_SUCCESS;
}
VOID
NTAPI
HalpInitializePciBus(VOID)
{
/* Setup the PCI stub support */
HalpInitializePciStubs();
/* Set the NMI crash flag */
HalpGetNMICrashFlag();
}
/*
* @implemented
*/
VOID
NTAPI
HalReportResourceUsage(VOID)
{
INTERFACE_TYPE InterfaceType;
UNICODE_STRING HalString;
/* FIXME: Initialize DMA 64-bit support */
/* FIXME: Initialize MCA bus */
/* Initialize PCI bus. */
HalpInitializePciBus();
/* 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, L"ACPI Compatible Eisa/Isa HAL");
HalpReportResourceUsage(&HalString, InterfaceType);
/* Setup PCI debugging and Hibernation */
HalpRegisterPciDebuggingDeviceInfo();
}
/* EOF */

View file

@ -14,6 +14,8 @@
/* GLOBALS *******************************************************************/
PCI_TYPE1_CFG_CYCLE_BITS HalpPciDebuggingDevice[2] = {{{{0}}}};
BOOLEAN HalpPCIConfigInitialized;
ULONG HalpMinPciBus, HalpMaxPciBus;
KSPIN_LOCK HalpPCIConfigLock;
@ -521,6 +523,34 @@ HalpReleasePciDeviceForDebugging(IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice)
return STATUS_NOT_IMPLEMENTED;
}
VOID
NTAPI
HalpRegisterPciDebuggingDeviceInfo(VOID)
{
BOOLEAN Found = FALSE;
ULONG i;
PAGED_CODE();
/* Loop PCI debugging devices */
for (i = 0; i < 2; i++)
{
/* Reserved bit is set if we found one */
if (HalpPciDebuggingDevice[i].u.bits.Reserved1)
{
Found = TRUE;
break;
}
}
/* Bail out if there aren't any */
if (!Found) return;
/* FIXME: TODO */
DPRINT1("You have implemented the KD routines for searching PCI debugger"
"devices, but you have forgotten to implement this routine\n");
while (TRUE);
}
static ULONG NTAPI
PciSize(ULONG Base, ULONG Mask)
{
@ -1026,9 +1056,3 @@ HalpInitializePciStubs(VOID)
HalpPCIConfigInitialized = TRUE;
}
VOID
NTAPI
HalpInitializePciBus(VOID)
{
/* FIXME: Initialize NMI Crash Flag */
}

View file

@ -24,4 +24,67 @@ HalpSetupAcpiPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
return STATUS_NO_SUCH_DEVICE;
}
VOID
NTAPI
HalpInitializePciBus(VOID)
{
/* FIXME: Should do legacy PCI bus detection */
/* FIXME: Should detect chipset hacks */
/* FIXME: Should detect broken PCI hardware and apply hacks */
/* FIXME: Should build resource ranges */
}
/*
* @implemented
*/
VOID
NTAPI
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, L"PC Compatible Eisa/Isa HAL");
HalpReportResourceUsage(&HalString, InterfaceType);
/* Setup PCI debugging and Hibernation */
HalpRegisterPciDebuggingDeviceInfo();
}
/* EOF */

View file

@ -14,6 +14,7 @@
/* GLOBALS ********************************************************************/
BOOLEAN HalpNMIDumpFlag;
PUCHAR KdComPortInUse;
PADDRESS_USAGE HalpAddressUsageList;
IDTUsageFlags HalpIDTUsageFlags[MAXIMUM_IDTVECTOR];
@ -88,55 +89,56 @@ HalpEnableInterruptHandler(IN UCHAR Flags,
/* Enable the interrupt */
HalEnableSystemInterrupt(SystemVector, Irql, Mode);
}
#endif
/*
* @unimplemented
*/
VOID
NTAPI
HalReportResourceUsage(VOID)
HalpGetNMICrashFlag(VOID)
{
INTERFACE_TYPE InterfaceType;
UNICODE_STRING HalString;
UNICODE_STRING ValueName;
UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\CrashControl");
OBJECT_ATTRIBUTES ObjectAttributes;
ULONG ResultLength;
HANDLE Handle;
NTSTATUS Status;
KEY_VALUE_PARTIAL_INFORMATION KeyValueInformation;
/* FIXME: Initialize DMA 64-bit support */
/* Set default */
HalpNMIDumpFlag = 0;
/* FIXME: Initialize MCA bus */
/* Initialize PCI bus. */
HalpInitializePciBus();
/* Initialize attributes */
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
/* Initialize the stubs */
HalpInitializePciStubs();
/* What kind of bus is this? */
switch (HalpBusType)
/* Open crash key */
Status = ZwOpenKey(&Handle, KEY_READ, &ObjectAttributes);
if (NT_SUCCESS(Status))
{
/* 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;
/* Query key value */
RtlInitUnicodeString(&ValueName, L"NMICrashDump");
Status = ZwQueryValueKey(Handle,
&ValueName,
KeyValuePartialInformation,
&KeyValueInformation,
sizeof(KeyValueInformation),
&ResultLength);
if (NT_SUCCESS(Status))
{
/* Check for valid data */
if (ResultLength == sizeof(KEY_VALUE_PARTIAL_INFORMATION))
{
/* Read the flag */
HalpNMIDumpFlag = KeyValueInformation.Data[0];
}
}
/* We're done */
ZwClose(Handle);
}
/* Build HAL usage */
RtlInitUnicodeString(&HalString, L"PC Compatible Eisa/Isa HAL");
HalpReportResourceUsage(&HalString, InterfaceType);
/* FIXME: Setup PCI debugging and Hibernation */
}
#endif
/* EOF */

View file

@ -158,6 +158,38 @@ typedef struct _PCI_REGISTRY_INFO_INTERNAL
PCI_CARD_DESCRIPTOR CardList[ANYSIZE_ARRAY];
} PCI_REGISTRY_INFO_INTERNAL, *PPCI_REGISTRY_INFO_INTERNAL;
typedef struct _PCI_TYPE0_CFG_CYCLE_BITS
{
union
{
struct
{
ULONG Reserved1:2;
ULONG RegisterNumber:6;
ULONG FunctionNumber:3;
ULONG Reserved2:21;
} bits;
ULONG AsULONG;
} u;
} PCI_TYPE0_CFG_CYCLE_BITS, *PPCI_TYPE0_CFG_CYCLE_BITS;
typedef struct _PCI_TYPE1_CFG_CYCLE_BITS
{
union
{
struct
{
ULONG Reserved1:2;
ULONG RegisterNumber:6;
ULONG FunctionNumber:3;
ULONG DeviceNumber:5;
ULONG BusNumber:8;
ULONG Reserved2:8;
} bits;
ULONG AsULONG;
} u;
} PCI_TYPE1_CFG_CYCLE_BITS, *PPCI_TYPE1_CFG_CYCLE_BITS;
typedef struct _ARRAY
{
ULONG ArraySize;
@ -359,6 +391,12 @@ HalpFindBusAddressTranslation(
IN BOOLEAN NextBus
);
VOID
NTAPI
HalpRegisterPciDebuggingDeviceInfo(
VOID
);
extern ULONG HalpBusType;
extern BOOLEAN HalpPCIConfigInitialized;
extern BUS_HANDLER HalpFakePciBusHandler;

View file

@ -707,6 +707,19 @@ HalpOpenRegistryKey(
IN BOOLEAN Create
);
VOID
NTAPI
HalpGetNMICrashFlag(
VOID
);
VOID
NTAPI
HalpReportResourceUsage(
IN PUNICODE_STRING HalName,
IN INTERFACE_TYPE InterfaceType
);
VOID
FASTCALL
KeUpdateSystemTime(