Author: sir_richard
Date: Thu Apr 1 22:46:55 2010
New Revision: 46652
URL:
http://svn.reactos.org/svn/reactos?rev=46652&view=rev
Log:
[HAL]: Move all HAL-specific names to halacpi.c and halpcat.c. This includes the PnP
Device Name (e_isa_up vs acpipic_up", the HAL Name, and whether or not the firmware
mapper should be disabled (tells I/O Manager to skip legacy detection).
[HAL]: Implement HalpReportUsage! On ACPI, all is implemented, on PC/AT, we don't yet
parse the ROM blocks in the registry (but does FreeLDR even put them in?), and I don't
think we'll ever enable 16-bit port decoding since FreeLDR never detects ISA vs EISA
machines (so we always run as ISA).
[HAL]: Fill out the "????" entries in HalpDefaultIoSpace... more typical Alex
"I copied something without knowing what it meant"-magic.
Modified:
trunk/reactos/hal/halx86/generic/acpi/halacpi.c
trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c
trunk/reactos/hal/halx86/generic/legacy/halpcat.c
trunk/reactos/hal/halx86/generic/misc.c
trunk/reactos/hal/halx86/generic/usage.c
trunk/reactos/hal/halx86/include/halp.h
Modified: trunk/reactos/hal/halx86/generic/acpi/halacpi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/acpi/ha…
==============================================================================
--- trunk/reactos/hal/halx86/generic/acpi/halacpi.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/acpi/halacpi.c [iso-8859-1] Thu Apr 1 22:46:55 2010
@@ -36,6 +36,11 @@
LIST_ENTRY HalpAcpiTableMatchList;
ULONG HalpInvalidAcpiTable;
+
+/* This determines the HAL type */
+BOOLEAN HalDisableFirmwareMapper = TRUE;
+PWCHAR HalHardwareIdString = L"acpipic_up";
+PWCHAR HalName = L"ACPI Compatible Eisa/Isa HAL";
/* PRIVATE FUNCTIONS **********************************************************/
@@ -872,6 +877,29 @@
HalpGetNMICrashFlag();
}
+VOID
+NTAPI
+HalpBuildAddressMap(VOID)
+{
+ /* ACPI is magic baby */
+}
+
+BOOLEAN
+NTAPI
+HalpGetDebugPortTable(VOID)
+{
+ return ((HalpDebugPortTable) &&
+ (HalpDebugPortTable->BaseAddress.AddressSpaceID == 1));
+}
+
+ULONG
+NTAPI
+HalpIs16BitPortDecodeSupported(VOID)
+{
+ /* All ACPI systems are at least "EISA" so they support this */
+ return CM_RESOURCE_PORT_16_BIT_DECODE;
+}
+
/*
* @implemented
*/
@@ -914,7 +942,7 @@
}
/* Build HAL usage */
- RtlInitUnicodeString(&HalString, L"ACPI Compatible Eisa/Isa HAL");
+ RtlInitUnicodeString(&HalString, HalName);
HalpReportResourceUsage(&HalString, InterfaceType);
/* Setup PCI debugging and Hibernation */
Modified: trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/acpi/ha…
==============================================================================
--- trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c [iso-8859-1] Thu Apr 1 22:46:55
2010
@@ -47,56 +47,8 @@
/* GLOBALS ********************************************************************/
PDRIVER_OBJECT HalpDriverObject;
-BOOLEAN HalDisableFirmwareMapper = TRUE;
-PWCHAR HalHardwareIdString = L"acpipic_up";
/* PRIVATE FUNCTIONS **********************************************************/
-
-NTSTATUS
-NTAPI
-HalpMarkAcpiHal(VOID)
-{
- NTSTATUS Status;
- UNICODE_STRING KeyString;
- HANDLE KeyHandle;
- HANDLE Handle;
-
- /* Open the control set key */
- RtlInitUnicodeString(&KeyString,
- L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET");
- Status = HalpOpenRegistryKey(&Handle, 0, &KeyString, KEY_ALL_ACCESS, FALSE);
- if (NT_SUCCESS(Status))
- {
- /* Open the PNP key */
- RtlInitUnicodeString(&KeyString, L"Control\\Pnp");
- Status = HalpOpenRegistryKey(&KeyHandle,
- Handle,
- &KeyString,
- KEY_ALL_ACCESS,
- TRUE);
- /* Close root key */
- ZwClose(Handle);
-
- /* Check if PNP BIOS key exists */
- if (NT_SUCCESS(Status))
- {
- /* Set the disable value to false -- we need the mapper */
- RtlInitUnicodeString(&KeyString, L"DisableFirmwareMapper");
- Status = ZwSetValueKey(KeyHandle,
- &KeyString,
- 0,
- REG_DWORD,
- &HalDisableFirmwareMapper,
- sizeof(HalDisableFirmwareMapper));
-
- /* Close subkey */
- ZwClose(KeyHandle);
- }
- }
-
- /* Return status */
- return Status;
-}
NTSTATUS
NTAPI
Modified: trunk/reactos/hal/halx86/generic/legacy/halpcat.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/legacy/…
==============================================================================
--- trunk/reactos/hal/halx86/generic/legacy/halpcat.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/legacy/halpcat.c [iso-8859-1] Thu Apr 1 22:46:55
2010
@@ -13,6 +13,11 @@
#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 **********************************************************/
@@ -35,6 +40,33 @@
/* FIXME: Should detect broken PCI hardware and apply hacks */
/* FIXME: Should build resource ranges */
+}
+
+VOID
+NTAPI
+HalpBuildAddressMap(VOID)
+{
+ /* FIXME: Inherit ROM blocks from the registry */
+ //HalpInheritROMBlocks();
+
+ /* FIXME: Add the ROM blocks to our ranges */
+ //HalpAddROMRanges();
+}
+
+BOOLEAN
+NTAPI
+HalpGetDebugPortTable(VOID)
+{
+ /* No ACPI */
+ return FALSE;
+}
+
+ULONG
+NTAPI
+HalpIs16BitPortDecodeSupported(VOID)
+{
+ /* Only EISA systems support this */
+ return (HalpBusType == MACHINE_TYPE_EISA) ? CM_RESOURCE_PORT_16_BIT_DECODE : 0;
}
/*
@@ -80,7 +112,7 @@
}
/* Build HAL usage */
- RtlInitUnicodeString(&HalString, L"PC Compatible Eisa/Isa HAL");
+ RtlInitUnicodeString(&HalString, HalName);
HalpReportResourceUsage(&HalString, InterfaceType);
/* Setup PCI debugging and Hibernation */
Modified: trunk/reactos/hal/halx86/generic/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/misc.c?…
==============================================================================
--- trunk/reactos/hal/halx86/generic/misc.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/misc.c [iso-8859-1] Thu Apr 1 22:46:55 2010
@@ -16,9 +16,88 @@
BOOLEAN HalpNMIInProgress;
+UCHAR HalpSerialLen;
+CHAR HalpSerialNumber[31];
+
/* PRIVATE FUNCTIONS **********************************************************/
#ifndef _MINIHAL_
+VOID
+NTAPI
+HalpReportSerialNumber(VOID)
+{
+ NTSTATUS Status;
+ UNICODE_STRING KeyString;
+ HANDLE Handle;
+
+ /* Make sure there is a serial number */
+ if (!HalpSerialLen) return;
+
+ /* Open the system key */
+ RtlInitUnicodeString(&KeyString,
L"\\Registry\\Machine\\Hardware\\Description\\System");
+ Status = HalpOpenRegistryKey(&Handle, 0, &KeyString, KEY_ALL_ACCESS, FALSE);
+ if (NT_SUCCESS(Status))
+ {
+ /* Add the serial number */
+ RtlInitUnicodeString(&KeyString, L"Serial Number");
+ ZwSetValueKey(Handle,
+ &KeyString,
+ 0,
+ REG_BINARY,
+ HalpSerialNumber,
+ HalpSerialLen);
+
+ /* Close the handle */
+ ZwClose(Handle);
+ }
+}
+
+NTSTATUS
+NTAPI
+HalpMarkAcpiHal(VOID)
+{
+ NTSTATUS Status;
+ UNICODE_STRING KeyString;
+ HANDLE KeyHandle;
+ HANDLE Handle;
+
+ /* Open the control set key */
+ RtlInitUnicodeString(&KeyString,
+ L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET");
+ Status = HalpOpenRegistryKey(&Handle, 0, &KeyString, KEY_ALL_ACCESS, FALSE);
+ if (NT_SUCCESS(Status))
+ {
+ /* Open the PNP key */
+ RtlInitUnicodeString(&KeyString, L"Control\\Pnp");
+ Status = HalpOpenRegistryKey(&KeyHandle,
+ Handle,
+ &KeyString,
+ KEY_ALL_ACCESS,
+ TRUE);
+ /* Close root key */
+ ZwClose(Handle);
+
+ /* Check if PNP BIOS key exists */
+ if (NT_SUCCESS(Status))
+ {
+ /* Set the disable value to false -- we need the mapper */
+ RtlInitUnicodeString(&KeyString, L"DisableFirmwareMapper");
+ Status = ZwSetValueKey(KeyHandle,
+ &KeyString,
+ 0,
+ REG_DWORD,
+ &HalDisableFirmwareMapper,
+ sizeof(HalDisableFirmwareMapper));
+
+ /* Close subkey */
+ ZwClose(KeyHandle);
+ }
+ }
+
+ /* Return status */
+ return Status;
+}
+
NTSTATUS
NTAPI
HalpOpenRegistryKey(IN PHANDLE KeyHandle,
Modified: trunk/reactos/hal/halx86/generic/usage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/usage.c…
==============================================================================
--- trunk/reactos/hal/halx86/generic/usage.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/usage.c [iso-8859-1] Thu Apr 1 22:46:55 2010
@@ -14,26 +14,45 @@
/* GLOBALS ********************************************************************/
+BOOLEAN HalpGetInfoFromACPI;
BOOLEAN HalpNMIDumpFlag;
PUCHAR KdComPortInUse;
PADDRESS_USAGE HalpAddressUsageList;
IDTUsageFlags HalpIDTUsageFlags[MAXIMUM_IDTVECTOR];
IDTUsage HalpIDTUsage[MAXIMUM_IDTVECTOR];
+USHORT HalpComPortIrqMapping[5][2] =
+{
+ {0x3F8, 4},
+ {0x2F8, 3},
+ {0x3E8, 4},
+ {0x2E8, 3},
+ {0, 0}
+};
+
+ADDRESS_USAGE HalpComIoSpace =
+{
+ NULL, CmResourceTypePort, IDT_INTERNAL,
+ {
+ {0x2F8, 0x8}, /* COM 1 */
+ {0,0},
+ }
+};
+
ADDRESS_USAGE HalpDefaultIoSpace =
{
NULL, CmResourceTypePort, IDT_INTERNAL,
{
- {0x2000, 0xC000}, /* PIC?? */
+ {0x2000, 0xC000}, /* Everything */
{0xC000, 0x1000}, /* DMA 2 */
{0x8000, 0x1000}, /* DMA 1 */
{0x2000, 0x200}, /* PIC 1 */
{0xA000, 0x200}, /* PIC 2 */
{0x4000, 0x400}, /* PIT 1 */
{0x4800, 0x400}, /* PIT 2 */
- {0x9200, 0x100}, /* ????? */
+ {0x9200, 0x100}, /* System Control Port A */
{0x7000, 0x200}, /* CMOS */
- {0xF000, 0x1000}, /* ????? */
+ {0xF000, 0x1000}, /* x87 Coprocessor */
{0xCF800, 0x800}, /* PCI 0 */
{0,0},
}
@@ -43,10 +62,424 @@
VOID
NTAPI
+HalpGetResourceSortValue(IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor,
+ OUT PULONG Scale,
+ OUT PLARGE_INTEGER Value)
+{
+ /* Sorting depends on resource type */
+ switch (Descriptor->Type)
+ {
+ case CmResourceTypeInterrupt:
+
+ /* Interrupt goes by level */
+ *Scale = 0;
+ *Value = RtlConvertUlongToLargeInteger(Descriptor->u.Interrupt.Level);
+ break;
+
+ case CmResourceTypePort:
+
+ /* Port goes by port address */
+ *Scale = 1;
+ *Value = Descriptor->u.Port.Start;
+ break;
+
+ case CmResourceTypeMemory:
+
+ /* Memory goes by base address */
+ *Scale = 2;
+ *Value = Descriptor->u.Memory.Start;
+ break;
+
+ default:
+
+ /* Anything else */
+ *Scale = 4;
+ *Value = RtlConvertUlongToLargeInteger(0);
+ break;
+ }
+}
+
+VOID
+NTAPI
+HalpBuildPartialFromIdt(IN ULONG Entry,
+ IN PCM_PARTIAL_RESOURCE_DESCRIPTOR RawDescriptor,
+ IN PCM_PARTIAL_RESOURCE_DESCRIPTOR TranslatedDescriptor)
+{
+ /* Exclusive interrupt entry */
+ RawDescriptor->Type = CmResourceTypeInterrupt;
+ RawDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
+
+ /* Check the interrupt type */
+ if (HalpIDTUsageFlags[Entry].Flags & IDT_LATCHED)
+ {
+ /* Latched */
+ RawDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
+ }
+ else
+ {
+ /* Level */
+ RawDescriptor->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
+ }
+
+ /* Get vector and level from IDT usage */
+ RawDescriptor->u.Interrupt.Vector = HalpIDTUsage[Entry].BusReleativeVector;
+ RawDescriptor->u.Interrupt.Level = HalpIDTUsage[Entry].BusReleativeVector;
+
+ /* Affinity is all the CPUs */
+ RawDescriptor->u.Interrupt.Affinity = HalpActiveProcessors;
+
+ /* The translated copy is identical */
+ RtlCopyMemory(TranslatedDescriptor, RawDescriptor, sizeof(TranslatedDescriptor));
+
+ /* But the vector and IRQL must be set correctly */
+ TranslatedDescriptor->u.Interrupt.Vector = Entry;
+ TranslatedDescriptor->u.Interrupt.Level = HalpIDTUsage[Entry].Irql;
+}
+
+VOID
+NTAPI
+HalpBuildPartialFromAddress(IN INTERFACE_TYPE Interface,
+ IN PADDRESS_USAGE CurrentAddress,
+ IN ULONG Element,
+ IN PCM_PARTIAL_RESOURCE_DESCRIPTOR RawDescriptor,
+ IN PCM_PARTIAL_RESOURCE_DESCRIPTOR TranslatedDescriptor)
+{
+ ULONG AddressSpace;
+
+ /* Set the type and make it exclusive */
+ RawDescriptor->Type = CurrentAddress->Type;
+ RawDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
+
+ /* Check what this is */
+ if (RawDescriptor->Type == CmResourceTypePort)
+ {
+ /* Write out port data */
+ AddressSpace = 1;
+ RawDescriptor->Flags = CM_RESOURCE_PORT_IO;
+ RawDescriptor->u.Port.Start.HighPart = 0;
+ RawDescriptor->u.Port.Start.LowPart =
CurrentAddress->Element[Element].Start;
+ RawDescriptor->u.Port.Length = CurrentAddress->Element[Element].Length;
+
+ /* Determine if 16-bit port addresses are allowed */
+ RawDescriptor->Flags |= HalpIs16BitPortDecodeSupported();
+ }
+ else
+ {
+ /* Write out memory data */
+ AddressSpace = 0;
+ RawDescriptor->Flags = (CurrentAddress->Flags & IDT_READ_ONLY) ?
+ CM_RESOURCE_MEMORY_READ_ONLY :
+ CM_RESOURCE_MEMORY_READ_WRITE;
+ RawDescriptor->u.Memory.Start.HighPart = 0;
+ RawDescriptor->u.Memory.Start.LowPart =
CurrentAddress->Element[Element].Start;
+ RawDescriptor->u.Memory.Length = CurrentAddress->Element[Element].Length;
+ }
+
+ /* Make an identical copy to begin with */
+ RtlCopyMemory(TranslatedDescriptor, RawDescriptor, sizeof(TranslatedDescriptor));
+
+ /* Check what this is */
+ if (RawDescriptor->Type == CmResourceTypePort)
+ {
+ /* Translate the port */
+ HalTranslateBusAddress(Interface,
+ 0,
+ RawDescriptor->u.Port.Start,
+ &AddressSpace,
+ &TranslatedDescriptor->u.Port.Start);
+
+ /* If it turns out this is memory once translated, flag it */
+ if (AddressSpace == 0) TranslatedDescriptor->Flags = CM_RESOURCE_PORT_MEMORY;
+
+ }
+ else
+ {
+ /* Translate the memory */
+ HalTranslateBusAddress(Interface,
+ 0,
+ RawDescriptor->u.Memory.Start,
+ &AddressSpace,
+ &TranslatedDescriptor->u.Memory.Start);
+ }
+}
+
+VOID
+NTAPI
HalpReportResourceUsage(IN PUNICODE_STRING HalName,
IN INTERFACE_TYPE InterfaceType)
{
- DbgPrint("%wZ has been initialized\n", HalName);
+ PCM_RESOURCE_LIST RawList, TranslatedList;
+ PCM_FULL_RESOURCE_DESCRIPTOR RawFull, TranslatedFull;
+ PCM_PARTIAL_RESOURCE_DESCRIPTOR CurrentRaw, CurrentTranslated, SortedRaw,
SortedTranslated;
+ CM_PARTIAL_RESOURCE_DESCRIPTOR RawPartial, TranslatedPartial;
+ PCM_PARTIAL_RESOURCE_LIST RawPartialList = NULL, TranslatedPartialList = NULL;
+ INTERFACE_TYPE Interface;
+ ULONG i, j, k, ListSize, Count, Port, Element, CurrentScale, SortScale, ReportType,
FlagMatch;
+ ADDRESS_USAGE *CurrentAddress;
+ LARGE_INTEGER CurrentSortValue, SortValue;
+ DbgPrint("%wZ Detected\n", HalName);
+
+ /* Check if KD is using a COM port */
+ if (KdComPortInUse)
+ {
+ /* Enter it into the I/O space */
+ HalpComIoSpace.Element[0].Start = (ULONG_PTR)KdComPortInUse;
+ HalpComIoSpace.Next = HalpAddressUsageList;
+ HalpAddressUsageList = &HalpComIoSpace;
+
+ /* Use the debug port table if we have one */
+ HalpGetInfoFromACPI = HalpGetDebugPortTable();
+
+ /* Check if we're using ACPI */
+ if (!HalpGetInfoFromACPI)
+ {
+ /* No, so use our local table */
+ Port = HalpComPortIrqMapping[0][0];
+ for (i = 0; Port; i++)
+ {
+ /* Is this the port we want? */
+ if (Port == (ULONG_PTR)KdComPortInUse)
+ {
+ /* Register it */
+ HalpRegisterVector(IDT_DEVICE | IDT_LATCHED,
+ HalpComPortIrqMapping[i][1],
+ HalpComPortIrqMapping[i][1] +
+ PRIMARY_VECTOR_BASE,
+ HIGH_LEVEL);
+ }
+
+ /* Next port */
+ Port = HalpComPortIrqMapping[i][0];
+ }
+ }
+ }
+
+ /* On non-ACPI systems, we need to build an address map */
+ HalpBuildAddressMap();
+
+ /* Allocate the master raw and translated lists */
+ RawList = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE * 2, ' laH');
+ TranslatedList = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE * 2, ' laH');
+ if (!(RawList) || !(TranslatedList))
+ {
+ /* Bugcheck the system */
+ KeBugCheckEx(HAL_MEMORY_ALLOCATION,
+ 4 * PAGE_SIZE,
+ 1,
+ (ULONG_PTR)__FILE__,
+ __LINE__);
+ }
+
+ /* Zero out the lists */
+ RtlZeroMemory(RawList, PAGE_SIZE * 2);
+ RtlZeroMemory(TranslatedList, PAGE_SIZE * 2);
+
+ /* Set the interface type to begin with */
+ RawList->List[0].InterfaceType = InterfaceTypeUndefined;
+
+ /* Loop all IDT entries that are not IRQs */
+ for (i = 0; i < PRIMARY_VECTOR_BASE; i++)
+ {
+ /* Check if the IDT isn't owned */
+ if (!(HalpIDTUsageFlags[i].Flags & IDT_REGISTERED))
+ {
+ /* Then register it for internal usage */
+ HalpIDTUsageFlags[i].Flags = IDT_INTERNAL;
+ HalpIDTUsage[i].BusReleativeVector = i;
+ }
+ }
+
+ /* Our full raw descriptors start here */
+ RawFull = RawList->List;
+
+ /* Keep track of the current partial raw and translated descriptors */
+ CurrentRaw = (PCM_PARTIAL_RESOURCE_DESCRIPTOR)RawList->List;
+ CurrentTranslated = (PCM_PARTIAL_RESOURCE_DESCRIPTOR)TranslatedList->List;
+
+ /* Do two passes */
+ for (ReportType = 0; ReportType < 2; ReportType++)
+ {
+ /* Pass 0 is for device usage */
+ if (ReportType == 0)
+ {
+ FlagMatch = IDT_DEVICE & ~IDT_REGISTERED;
+ Interface = InterfaceType;
+ }
+ else
+ {
+ /* Past 1 is for internal HAL usage */
+ FlagMatch = IDT_INTERNAL & ~IDT_REGISTERED;
+ Interface = Internal;
+ }
+
+ /* Reset loop variables */
+ i = Element = 0;
+
+ /* Start looping our address uage list and interrupts */
+ CurrentAddress = HalpAddressUsageList;
+ while (TRUE)
+ {
+ /* Check for valid vector number */
+ if (i <= MAXIMUM_IDTVECTOR)
+ {
+ /* Check if this entry should be parsed */
+ if ((HalpIDTUsageFlags[i].Flags & FlagMatch))
+ {
+ /* Parse it */
+ HalpBuildPartialFromIdt(i, &RawPartial, &TranslatedPartial);
+ i++;
+ }
+ else
+ {
+ /* Skip this entry */
+ i++;
+ continue;
+ }
+ }
+ else
+ {
+ /* This is an address instead */
+ if (!CurrentAddress) break;
+
+ /* Check if the address should be reported */
+ if (!(CurrentAddress->Flags & FlagMatch) ||
+ !(CurrentAddress->Element[Element].Length))
+ {
+ /* Nope, skip it */
+ Element = 0;
+ CurrentAddress = CurrentAddress->Next;
+ continue;
+ }
+
+ /* Otherwise, parse the entry */
+ HalpBuildPartialFromAddress(Interface,
+ CurrentAddress,
+ Element,
+ &RawPartial,
+ &TranslatedPartial);
+ Element++;
+ }
+
+ /* Check for interface change */
+ if (RawFull->InterfaceType != Interface)
+ {
+ /* We need to add another full descriptor */
+ RawList->Count++;
+ TranslatedList->Count++;
+
+ /* The full descriptor follows wherever we were */
+ RawFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentRaw;
+ TranslatedFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentTranslated;
+
+ /* And it is of this new interface type */
+ RawFull->InterfaceType = Interface;
+ TranslatedFull->InterfaceType = Interface;
+
+ /* And its partial descriptors begin here */
+ RawPartialList = &RawFull->PartialResourceList;
+ TranslatedPartialList = &TranslatedFull->PartialResourceList;
+
+ /* And our next full descriptor should follow here */
+ CurrentRaw = RawFull->PartialResourceList.PartialDescriptors;
+ CurrentTranslated =
TranslatedFull->PartialResourceList.PartialDescriptors;
+ }
+
+ /* We have written a new partial descriptor */
+ RawPartialList->Count++;
+ TranslatedPartialList->Count++;
+
+ /* Copy our local descriptors into the actual list */
+ RtlCopyMemory(CurrentRaw, &RawPartial, sizeof(RawPartial));
+ RtlCopyMemory(CurrentTranslated, &TranslatedPartial,
sizeof(TranslatedPartial));
+
+ /* Move to the next partial descriptor */
+ CurrentRaw++;
+ CurrentTranslated++;
+ }
+ }
+
+ /* Get the final list of the size for the kernel call later */
+ ListSize = (ULONG_PTR)CurrentRaw - (ULONG_PTR)RawList;
+
+ /* Now reset back to the first full descriptor */
+ RawFull = RawList->List;
+ TranslatedFull = TranslatedList->List;
+
+ /* And loop all the full descriptors */
+ for (i = 0; i < RawList->Count; i++)
+ {
+ /* Get the first partial descriptor in this list */
+ CurrentRaw = RawFull->PartialResourceList.PartialDescriptors;
+ CurrentTranslated = TranslatedFull->PartialResourceList.PartialDescriptors;
+
+ /* Get the count of partials in this list */
+ Count = RawFull->PartialResourceList.Count;
+
+ /* Loop all the partials in this list */
+ for (j = 0; j < Count; j++)
+ {
+ /* Get the sort value at this point */
+ HalpGetResourceSortValue(CurrentRaw, &CurrentScale,
&CurrentSortValue);
+
+ /* Save the current sort pointer */
+ SortedRaw = CurrentRaw;
+ SortedTranslated = CurrentTranslated;
+
+ /* Loop all descriptors starting from this one */
+ for (k = j; k < Count; k++)
+ {
+ /* Get the sort value at the sort point */
+ HalpGetResourceSortValue(SortedRaw, &SortScale, &SortValue);
+
+ /* Check if a swap needs to occur */
+ if ((SortScale < CurrentScale) ||
+ ((SortScale == CurrentScale) &&
+ (SortValue.QuadPart <= CurrentSortValue.QuadPart)))
+ {
+ /* Swap raw partial with the sort location partial */
+ RtlCopyMemory(&RawPartial, CurrentRaw, sizeof(RawPartial));
+ RtlCopyMemory(CurrentRaw, SortedRaw, sizeof(RawPartial));
+ RtlCopyMemory(SortedRaw, &RawPartial, sizeof(RawPartial));
+
+ /* Swap translated partial in the same way */
+ RtlCopyMemory(&TranslatedPartial, CurrentTranslated,
sizeof(TranslatedPartial));
+ RtlCopyMemory(CurrentTranslated, SortedTranslated,
sizeof(TranslatedPartial));
+ RtlCopyMemory(SortedTranslated, &TranslatedPartial,
sizeof(TranslatedPartial));
+
+ /* Update the sort value at this point */
+ HalpGetResourceSortValue(CurrentRaw, &CurrentScale,
&CurrentSortValue);
+ }
+
+ /* The sort location has been updated */
+ SortedRaw++;
+ SortedTranslated++;
+ }
+
+ /* Move to the next partial */
+ CurrentRaw++;
+ CurrentTranslated++;
+ }
+
+ /* Move to the next full descriptor */
+ RawFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentRaw;
+ TranslatedFull = (PCM_FULL_RESOURCE_DESCRIPTOR)CurrentTranslated;
+ }
+
+ /* Mark this is an ACPI system, if it is */
+ HalpMarkAcpiHal();
+
+ /* Tell the kernel about all this */
+ IoReportHalResourceUsage(HalName,
+ RawList,
+ TranslatedList,
+ ListSize);
+
+ /* Free our lists */
+ ExFreePool(RawList);
+ ExFreePool(TranslatedList);
+
+ /* Get the machine's serial number */
+ HalpReportSerialNumber();
}
VOID
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] Thu Apr 1 22:46:55 2010
@@ -49,6 +49,7 @@
/* Usage flags */
#define IDT_REGISTERED 0x01
#define IDT_LATCHED 0x02
+#define IDT_READ_ONLY 0x04
#define IDT_INTERNAL 0x11
#define IDT_DEVICE 0x21
@@ -713,11 +714,41 @@
VOID
);
+BOOLEAN
+NTAPI
+HalpGetDebugPortTable(
+ VOID
+);
+
+VOID
+NTAPI
+HalpReportSerialNumber(
+ VOID
+);
+
+NTSTATUS
+NTAPI
+HalpMarkAcpiHal(
+ VOID
+);
+
+VOID
+NTAPI
+HalpBuildAddressMap(
+ VOID
+);
+
VOID
NTAPI
HalpReportResourceUsage(
IN PUNICODE_STRING HalName,
IN INTERFACE_TYPE InterfaceType
+);
+
+ULONG
+NTAPI
+HalpIs16BitPortDecodeSupported(
+ VOID
);
VOID
@@ -748,3 +779,9 @@
extern PADDRESS_USAGE HalpAddressUsageList;
extern LARGE_INTEGER HalpPerfCounter;
+
+extern KAFFINITY HalpActiveProcessors;
+
+extern BOOLEAN HalDisableFirmwareMapper;
+extern PWCHAR HalHardwareIdString;
+extern PWCHAR HalName;