[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
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 */
/* GLOBALS *******************************************************************/
+PCI_TYPE1_CFG_CYCLE_BITS HalpPciDebuggingDevice[2] = {{{{0}}}};
+
BOOLEAN HalpPCIConfigInitialized;
ULONG HalpMinPciBus, HalpMaxPciBus;
KSPIN_LOCK HalpPCIConfigLock;
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)
{
HalpPCIConfigInitialized = TRUE;
}
-VOID
-NTAPI
-HalpInitializePciBus(VOID)
-{
- /* FIXME: Initialize NMI Crash Flag */
-}
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 */
/* GLOBALS ********************************************************************/
+BOOLEAN HalpNMIDumpFlag;
PUCHAR KdComPortInUse;
PADDRESS_USAGE HalpAddressUsageList;
IDTUsageFlags HalpIDTUsageFlags[MAXIMUM_IDTVECTOR];
/* Enable the interrupt */
HalEnableSystemInterrupt(SystemVector, Irql, Mode);
}
-#endif
-/*
- * @unimplemented
- */
VOID
NTAPI
-HalReportResourceUsage(VOID)
+HalpGetNMICrashFlag(VOID)
{
- INTERFACE_TYPE InterfaceType;
- UNICODE_STRING HalString;
-
- /* FIXME: Initialize DMA 64-bit support */
-
- /* FIXME: Initialize MCA bus */
-
- /* Initialize PCI bus. */
- HalpInitializePciBus();
+ 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;
+
+ /* Set default */
+ HalpNMIDumpFlag = 0;
+
+ /* 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);
}
+}
+#endif
- /* Build HAL usage */
- RtlInitUnicodeString(&HalString, L"PC Compatible Eisa/Isa HAL");
- HalpReportResourceUsage(&HalString, InterfaceType);
+/* EOF */
- /* FIXME: Setup PCI debugging and Hibernation */
-}
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;
IN BOOLEAN NextBus
);
+VOID
+NTAPI
+HalpRegisterPciDebuggingDeviceInfo(
+ VOID
+);
+
extern ULONG HalpBusType;
extern BOOLEAN HalpPCIConfigInitialized;
extern BUS_HANDLER HalpFakePciBusHandler;
IN BOOLEAN Create
);
+VOID
+NTAPI
+HalpGetNMICrashFlag(
+ VOID
+);
+
+VOID
+NTAPI
+HalpReportResourceUsage(
+ IN PUNICODE_STRING HalName,
+ IN INTERFACE_TYPE InterfaceType
+);
+
VOID
FASTCALL
KeUpdateSystemTime(