3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: hal/halx86/generic/acpi/halacpi.c
5 * PURPOSE: HAL ACPI Code
6 * PROGRAMMERS: ReactOS Portable Systems Group
9 /* INCLUDES *******************************************************************/
15 /* GLOBALS ********************************************************************/
17 LIST_ENTRY HalpAcpiTableCacheList
;
18 FAST_MUTEX HalpAcpiTableCacheLock
;
20 BOOLEAN HalpProcessedACPIPhase0
;
21 BOOLEAN HalpPhysicalMemoryMayAppearAbove4GB
;
23 FADT HalpFixedAcpiDescTable
;
24 PDEBUG_PORT_TABLE HalpDebugPortTable
;
25 PACPI_SRAT HalpAcpiSrat
;
26 PBOOT_TABLE HalpSimpleBootFlagTable
;
28 PHYSICAL_ADDRESS HalpMaxHotPlugMemoryAddress
;
29 PHYSICAL_ADDRESS HalpLowStubPhysicalAddress
;
30 PHARDWARE_PTE HalpPteForFlush
;
31 PVOID HalpVirtAddrForFlush
;
34 PACPI_BIOS_MULTI_NODE HalpAcpiMultiNode
;
36 LIST_ENTRY HalpAcpiTableMatchList
;
38 ULONG HalpInvalidAcpiTable
;
40 /* This determines the HAL type */
41 BOOLEAN HalDisableFirmwareMapper
= TRUE
;
42 PWCHAR HalHardwareIdString
= L
"acpipic_up";
43 PWCHAR HalName
= L
"ACPI Compatible Eisa/Isa HAL";
45 /* PRIVATE FUNCTIONS **********************************************************/
49 HalpAcpiGetCachedTable(IN ULONG Signature
)
51 PLIST_ENTRY ListHead
, NextEntry
;
52 PACPI_CACHED_TABLE CachedTable
;
54 /* Loop cached tables */
55 ListHead
= &HalpAcpiTableCacheList
;
56 NextEntry
= ListHead
->Flink
;
57 while (NextEntry
!= ListHead
)
60 CachedTable
= CONTAINING_RECORD(NextEntry
, ACPI_CACHED_TABLE
, Links
);
62 /* Compare signatures */
63 if (CachedTable
->Header
.Signature
== Signature
) return &CachedTable
->Header
;
66 NextEntry
= NextEntry
->Flink
;
75 HalpAcpiCacheTable(IN PDESCRIPTION_HEADER TableHeader
)
77 PACPI_CACHED_TABLE CachedTable
;
79 /* Get the cached table and link it */
80 CachedTable
= CONTAINING_RECORD(TableHeader
, ACPI_CACHED_TABLE
, Header
);
81 InsertTailList(&HalpAcpiTableCacheList
, &CachedTable
->Links
);
86 HalpAcpiCopyBiosTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock
,
87 IN PDESCRIPTION_HEADER TableHeader
)
91 PHYSICAL_ADDRESS PhysAddress
;
92 PACPI_CACHED_TABLE CachedTable
;
93 PDESCRIPTION_HEADER CopiedTable
;
95 /* Size we'll need for the cached table */
96 Size
= TableHeader
->Length
+ FIELD_OFFSET(ACPI_CACHED_TABLE
, Header
);
99 /* Phase 0: Convert to pages and use the HAL heap */
100 PageCount
= BYTES_TO_PAGES(Size
);
101 PhysAddress
.LowPart
= HalpAllocPhysicalMemory(LoaderBlock
,
105 if (PhysAddress
.LowPart
)
108 CachedTable
= HalpMapPhysicalMemory64(PhysAddress
, PageCount
);
112 /* No memory, so nothing to map */
119 CachedTable
= ExAllocatePoolWithTag(NonPagedPool
, Size
, ' laH');
122 /* Do we have the cached table? */
126 CopiedTable
= &CachedTable
->Header
;
127 RtlCopyMemory(CopiedTable
, TableHeader
, TableHeader
->Length
);
131 /* Nothing to return */
135 /* Return the table */
141 HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock
,
144 PHYSICAL_ADDRESS PhysicalAddress
;
148 PDESCRIPTION_HEADER Header
= NULL
;
152 ULONG EntryCount
, CurrentEntry
;
154 PFN_NUMBER PageCount
;
156 /* Should not query the RSDT/XSDT by itself */
157 if ((Signature
== RSDT_SIGNATURE
) || (Signature
== XSDT_SIGNATURE
)) return NULL
;
159 /* Special case request for DSDT, because the FADT points to it */
160 if (Signature
== DSDT_SIGNATURE
)
163 Fadt
= HalpAcpiGetTable(LoaderBlock
, FADT_SIGNATURE
);
166 /* Grab the DSDT address and assume 2 pages */
167 PhysicalAddress
.LowPart
= Fadt
->dsdt
;
168 TableLength
= 2 * PAGE_SIZE
;
173 /* Phase 0, use HAL heap */
174 Header
= HalpMapPhysicalMemory64(PhysicalAddress
, 2u);
178 /* Phase 1, use Mm */
179 Header
= MmMapIoSpace(PhysicalAddress
, 2 * PAGE_SIZE
, 0);
182 /* Fail if we couldn't map it */
185 DbgPrint("HAL: Failed to map ACPI table.\n");
189 /* Validate the signature */
190 DPRINT1("ACPI DSDT at 0x%p\n", Header
);
191 if (Header
->Signature
!= DSDT_SIGNATURE
)
197 HalpUnmapVirtualAddress(Header
, 2);
202 MmUnmapIoSpace(Header
, 2 * PAGE_SIZE
);
205 /* Didn't find anything */
211 /* Couldn't find it */
217 /* To find tables, we need the RSDT */
218 Rsdt
= HalpAcpiGetTable(LoaderBlock
, RSDT_SIGNATURE
);
221 /* Won't be using the XSDT */
226 /* Only other choice is to use the XSDT */
227 Xsdt
= HalpAcpiGetTable(LoaderBlock
, XSDT_SIGNATURE
);
228 if (!Xsdt
) return NULL
;
230 /* Won't be using the RSDT */
231 DPRINT1("ACPI XSDT at 0x%p\n", Xsdt
);
235 /* Smallest RSDT/XSDT is one without table entries */
236 Offset
= FIELD_OFFSET(RSDT
, Tables
);
239 /* Figure out total size of table and the offset */
240 TableLength
= Xsdt
->Header
.Length
;
241 if (TableLength
< Offset
) Offset
= Xsdt
->Header
.Length
;
243 /* The entries are each 64-bits, so count them */
244 EntryCount
= (TableLength
- Offset
) / sizeof(PHYSICAL_ADDRESS
);
248 /* Figure out total size of table and the offset */
249 TableLength
= Rsdt
->Header
.Length
;
250 if (TableLength
< Offset
) Offset
= Rsdt
->Header
.Length
;
252 /* The entries are each 32-bits, so count them */
253 EntryCount
= (TableLength
- Offset
) / sizeof(ULONG
);
256 /* Start at the beginning of the array and loop it */
257 for (CurrentEntry
= 0; CurrentEntry
< EntryCount
; CurrentEntry
++)
259 /* Are we using the XSDT? */
262 /* Read the 32-bit physical address */
263 PhysicalAddress
.LowPart
= Rsdt
->Tables
[CurrentEntry
];
267 /* Read the 64-bit physical address */
268 PhysicalAddress
= Xsdt
->Tables
[CurrentEntry
];
271 /* Had we already mapped a table? */
278 HalpUnmapVirtualAddress(Header
, 2);
283 MmUnmapIoSpace(Header
, 2 * PAGE_SIZE
);
287 /* Now map this table */
290 /* Phase 1: Use HAL heap */
291 Header
= MmMapIoSpace(PhysicalAddress
, 2 * PAGE_SIZE
, MmNonCached
);
295 /* Phase 0: Use Mm */
296 Header
= HalpMapPhysicalMemory64(PhysicalAddress
, 2);
299 /* Check if we mapped it */
303 DbgPrint("HAL: Failed to map ACPI table.\n");
307 /* We found it, break out */
308 DPRINT("Found ACPI table %c%c%c%c at 0x%p\n",
309 Header
->Signature
& 0xFF,
310 (Header
->Signature
& 0xFF00) >> 8,
311 (Header
->Signature
& 0xFF0000) >> 16,
312 (Header
->Signature
& 0xFF000000) >> 24,
314 if (Header
->Signature
== Signature
) break;
317 /* Did we end up here back at the last entry? */
318 if (CurrentEntry
== EntryCount
)
320 /* Yes, unmap the last table we processed */
324 HalpUnmapVirtualAddress(Header
, 2);
329 MmUnmapIoSpace(Header
, 2 * PAGE_SIZE
);
332 /* Didn't find anything */
337 /* Past this point, we assume something was found */
340 /* How many pages do we need? */
341 PageCount
= BYTES_TO_PAGES(Header
->Length
);
344 /* We assumed two, but this is not the case, free the current mapping */
348 HalpUnmapVirtualAddress(Header
, 2);
353 MmUnmapIoSpace(Header
, 2 * PAGE_SIZE
);
356 /* Now map this table using its correct size */
359 /* Phase 1: Use HAL heap */
360 Header
= MmMapIoSpace(PhysicalAddress
, PageCount
<< PAGE_SHIFT
, MmNonCached
);
364 /* Phase 0: Use Mm */
365 Header
= HalpMapPhysicalMemory64(PhysicalAddress
, PageCount
);
369 /* Fail if the remapped failed */
370 if (!Header
) return NULL
;
372 /* All tables in ACPI 3.0 other than the FACP should have correct checksum */
373 if ((Header
->Signature
!= FADT_SIGNATURE
) || (Header
->Revision
> 2))
375 /* Go to the end of the table */
377 CurrentByte
= (PCHAR
)Header
+ Header
->Length
;
378 while (CurrentByte
-- != (PCHAR
)Header
)
381 CheckSum
+= *CurrentByte
;
384 /* The correct checksum is always 0, anything else is illegal */
385 if (CheckSum
) HalpInvalidAcpiTable
= Header
->Signature
;
388 /* Return the table */
394 HalpAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock
,
397 PFN_NUMBER PageCount
;
398 PDESCRIPTION_HEADER TableAddress
, BiosCopy
;
400 /* See if we have a cached table? */
401 TableAddress
= HalpAcpiGetCachedTable(Signature
);
404 /* No cache, search the BIOS */
405 TableAddress
= HalpAcpiGetTableFromBios(LoaderBlock
, Signature
);
408 /* Found it, copy it into our own memory */
409 BiosCopy
= HalpAcpiCopyBiosTable(LoaderBlock
, TableAddress
);
411 /* Get the pages, and unmap the BIOS copy */
412 PageCount
= BYTES_TO_PAGES(TableAddress
->Length
);
415 /* Phase 0, use the HAL heap */
416 HalpUnmapVirtualAddress(TableAddress
, PageCount
);
420 /* Phase 1, use Mm */
421 MmUnmapIoSpace(TableAddress
, PageCount
<< 12);
424 /* Cache the bios copy */
425 TableAddress
= BiosCopy
;
426 if (BiosCopy
) HalpAcpiCacheTable(BiosCopy
);
430 /* Return the table */
436 HalAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock
,
439 PDESCRIPTION_HEADER TableHeader
;
444 /* Initialize the cache first */
445 if (!NT_SUCCESS(HalpAcpiTableCacheInit(LoaderBlock
))) return NULL
;
450 ExAcquireFastMutex(&HalpAcpiTableCacheLock
);
454 TableHeader
= HalpAcpiGetTable(LoaderBlock
, Signature
);
456 /* Release the lock in phase 1 */
457 if (!LoaderBlock
) ExReleaseFastMutex(&HalpAcpiTableCacheLock
);
459 /* Return the table */
465 HalpNumaInitializeStaticConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
467 PACPI_SRAT SratTable
;
469 /* Get the SRAT, bail out if it doesn't exist */
470 SratTable
= HalAcpiGetTable(LoaderBlock
, SRAT_SIGNATURE
);
471 HalpAcpiSrat
= SratTable
;
472 if (!SratTable
) return;
477 HalpGetHotPlugMemoryInfo(IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
479 PACPI_SRAT SratTable
;
481 /* Get the SRAT, bail out if it doesn't exist */
482 SratTable
= HalAcpiGetTable(LoaderBlock
, SRAT_SIGNATURE
);
483 HalpAcpiSrat
= SratTable
;
484 if (!SratTable
) return;
489 HalpDynamicSystemResourceConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
491 /* For this HAL, it means to get hot plug memory information */
492 HalpGetHotPlugMemoryInfo(LoaderBlock
);
497 HalpAcpiDetectMachineSpecificActions(IN PLOADER_PARAMETER_BLOCK LoaderBlock
,
498 IN PFADT DescriptionTable
)
500 /* Does this HAL specify something? */
501 if (HalpAcpiTableMatchList
.Flink
)
503 /* Great, but we don't support it */
504 DPRINT1("WARNING: Your HAL has specific ACPI hacks to apply!\n");
510 HalpInitBootTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
512 PBOOT_TABLE BootTable
;
514 /* Get the boot table */
515 BootTable
= HalAcpiGetTable(LoaderBlock
, BOOT_SIGNATURE
);
516 HalpSimpleBootFlagTable
= BootTable
;
517 DPRINT1("ACPI BOOT at 0x%p\n", HalpSimpleBootFlagTable
);
521 (BootTable
->Header
.Length
>= sizeof(BOOT_TABLE
)) &&
522 (BootTable
->CMOSIndex
>= 9))
524 DPRINT1("ACPI Boot table found, but not supported!\n");
528 /* Invalid or doesn't exist, ignore it */
529 HalpSimpleBootFlagTable
= 0;
532 /* Install the end of boot handler */
533 // HalEndOfBoot = HalpEndOfBoot;
538 HalpAcpiFindRsdtPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock
,
539 OUT PACPI_BIOS_MULTI_NODE
* AcpiMultiNode
)
541 PCONFIGURATION_COMPONENT_DATA ComponentEntry
;
542 PCONFIGURATION_COMPONENT_DATA Next
= NULL
;
543 PCM_PARTIAL_RESOURCE_LIST ResourceList
;
544 PACPI_BIOS_MULTI_NODE NodeData
;
546 PFN_NUMBER PageCount
;
548 PHYSICAL_ADDRESS PhysicalAddress
;
550 /* Did we already do this once? */
551 if (HalpAcpiMultiNode
)
553 /* Return what we know */
554 *AcpiMultiNode
= HalpAcpiMultiNode
;
555 return STATUS_SUCCESS
;
559 *AcpiMultiNode
= NULL
;
561 /* Find the multi function adapter key */
562 ComponentEntry
= KeFindConfigurationNextEntry(LoaderBlock
->ConfigurationRoot
,
564 MultiFunctionAdapter
,
567 while (ComponentEntry
)
569 /* Find the ACPI BIOS key */
570 if (!_stricmp(ComponentEntry
->ComponentEntry
.Identifier
, "ACPI BIOS"))
577 Next
= ComponentEntry
;
578 ComponentEntry
= KeFindConfigurationNextEntry(LoaderBlock
->ConfigurationRoot
,
580 MultiFunctionAdapter
,
585 /* Make sure we found it */
588 DbgPrint("**** HalpAcpiFindRsdtPhase0: did NOT find RSDT\n");
589 return STATUS_NOT_FOUND
;
592 /* The configuration data is a resource list, and the BIOS node follows */
593 ResourceList
= ComponentEntry
->ConfigurationData
;
594 NodeData
= (PACPI_BIOS_MULTI_NODE
)(ResourceList
+ 1);
596 /* How many E820 memory entries are there? */
597 NodeLength
= sizeof(ACPI_BIOS_MULTI_NODE
) +
598 (NodeData
->Count
- 1) * sizeof(ACPI_E820_ENTRY
);
600 /* Convert to pages */
601 PageCount
= BYTES_TO_PAGES(NodeLength
);
603 /* Allocate the memory */
604 PhysicalAddress
.LowPart
= HalpAllocPhysicalMemory(LoaderBlock
,
608 if (PhysicalAddress
.LowPart
)
610 /* Map it if the allocation worked */
611 MappedAddress
= HalpMapPhysicalMemory64(PhysicalAddress
, PageCount
);
615 /* Otherwise we'll have to fail */
616 MappedAddress
= NULL
;
619 /* Save the multi node, bail out if we didn't find it */
620 HalpAcpiMultiNode
= MappedAddress
;
621 if (!MappedAddress
) return STATUS_INSUFFICIENT_RESOURCES
;
623 /* Copy the multi-node data */
624 RtlCopyMemory(MappedAddress
, NodeData
, NodeLength
);
626 /* Return the data */
627 *AcpiMultiNode
= HalpAcpiMultiNode
;
628 return STATUS_SUCCESS
;
633 HalpAcpiTableCacheInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
635 PACPI_BIOS_MULTI_NODE AcpiMultiNode
;
636 NTSTATUS Status
= STATUS_SUCCESS
;
637 PHYSICAL_ADDRESS PhysicalAddress
;
641 PLOADER_PARAMETER_EXTENSION LoaderExtension
;
643 /* Only initialize once */
644 if (HalpAcpiTableCacheList
.Flink
) return Status
;
646 /* Setup the lock and table */
647 ExInitializeFastMutex(&HalpAcpiTableCacheLock
);
648 InitializeListHead(&HalpAcpiTableCacheList
);
651 Status
= HalpAcpiFindRsdtPhase0(LoaderBlock
, &AcpiMultiNode
);
652 if (!NT_SUCCESS(Status
)) return Status
;
657 /* Phase0: Use HAL Heap to map the RSDT, we assume it's about 2 pages */
658 PhysicalAddress
.QuadPart
= AcpiMultiNode
->RsdtAddress
.QuadPart
;
659 MappedAddress
= HalpMapPhysicalMemory64(PhysicalAddress
, 2);
664 MappedAddress
= MmMapIoSpace(PhysicalAddress
, PAGE_SIZE
* 2, MmNonCached
);
668 Rsdt
= MappedAddress
;
671 /* Fail, no memory */
672 DbgPrint("HAL: Failed to map RSDT\n");
673 return STATUS_INSUFFICIENT_RESOURCES
;
677 DPRINT1("ACPI RSDT at 0x%p\n", Rsdt
);
678 if ((Rsdt
->Header
.Signature
!= RSDT_SIGNATURE
) &&
679 (Rsdt
->Header
.Signature
!= XSDT_SIGNATURE
))
681 /* Very bad: crash */
682 HalDisplayString("Bad RSDT pointer\n");
683 KeBugCheckEx(MISMATCHED_HAL
, 4, __LINE__
, 0, 0);
686 /* We assumed two pages -- do we need less or more? */
687 TableLength
= ADDRESS_AND_SIZE_TO_SPAN_PAGES(PhysicalAddress
.LowPart
,
688 Rsdt
->Header
.Length
);
689 if (TableLength
!= 2)
691 /* Are we in phase 0 or 1? */
694 /* Unmap the old table, remap the new one, using Mm I/O space */
695 MmUnmapIoSpace(MappedAddress
, 2 * PAGE_SIZE
);
696 MappedAddress
= MmMapIoSpace(PhysicalAddress
,
697 TableLength
<< PAGE_SHIFT
,
702 /* Unmap the old table, remap the new one, using HAL heap */
703 HalpUnmapVirtualAddress(MappedAddress
, 2);
704 MappedAddress
= HalpMapPhysicalMemory64(PhysicalAddress
, TableLength
);
707 /* Get the remapped table */
708 Rsdt
= MappedAddress
;
711 /* Fail, no memory */
712 DbgPrint("HAL: Couldn't remap RSDT\n");
713 return STATUS_INSUFFICIENT_RESOURCES
;
717 /* Now take the BIOS copy and make our own local copy */
718 Rsdt
= HalpAcpiCopyBiosTable(LoaderBlock
, &Rsdt
->Header
);
721 /* Fail, no memory */
722 DbgPrint("HAL: Couldn't remap RSDT\n");
723 return STATUS_INSUFFICIENT_RESOURCES
;
726 /* Get rid of the BIOS mapping */
730 HalpUnmapVirtualAddress(MappedAddress
, TableLength
);
735 MmUnmapIoSpace(MappedAddress
, TableLength
<< PAGE_SHIFT
);
739 HalpAcpiCacheTable(&Rsdt
->Header
);
741 /* Check for compatible loader block extension */
742 LoaderExtension
= LoaderBlock
->Extension
;
743 if (LoaderExtension
->Size
>= 0x58)
745 /* Compatible loader: did it provide an ACPI table override? */
746 if ((LoaderExtension
->AcpiTable
) && (LoaderExtension
->AcpiTableSize
))
748 /* Great, because we don't support it! */
749 DPRINT1("ACPI Table Overrides Not Supported!\n");
759 HaliAcpiTimerInit(IN ULONG TimerPort
,
760 IN ULONG TimerValExt
)
764 /* Is this in the init phase? */
767 /* Get the data from the FADT */
768 TimerPort
= HalpFixedAcpiDescTable
.pm_tmr_blk_io_port
;
769 TimerValExt
= HalpFixedAcpiDescTable
.flags
& ACPI_TMR_VAL_EXT
;
772 /* FIXME: Now proceed to the timer initialization */
773 DPRINT1("ACPI Timer at: %Xh (EXT: %d)\n", TimerPort
, TimerValExt
);
774 //HalaAcpiTimerInit(TimerPort, TimerValExt);
779 HalpSetupAcpiPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock
)
784 PHYSICAL_ADDRESS PhysicalAddress
;
786 /* Only do this once */
787 DPRINT1("You are booting the ACPI HAL!\n");
788 if (HalpProcessedACPIPhase0
) return STATUS_SUCCESS
;
790 /* Setup the ACPI table cache */
791 Status
= HalpAcpiTableCacheInit(LoaderBlock
);
792 if (!NT_SUCCESS(Status
)) return Status
;
795 Fadt
= HalAcpiGetTable(LoaderBlock
, FADT_SIGNATURE
);
799 DbgPrint("HAL: Didn't find the FACP\n");
800 return STATUS_NOT_FOUND
;
803 /* Assume typical size, otherwise whatever the descriptor table says */
804 DPRINT1("ACPI FACP at 0x%p\n", Fadt
);
805 TableLength
= sizeof(FADT
);
806 if (Fadt
->Header
.Length
< sizeof(FADT
)) TableLength
= Fadt
->Header
.Length
;
808 /* Copy it in the HAL static buffer */
809 RtlCopyMemory(&HalpFixedAcpiDescTable
, Fadt
, TableLength
);
811 /* Anything special this HAL needs to do? */
812 HalpAcpiDetectMachineSpecificActions(LoaderBlock
, &HalpFixedAcpiDescTable
);
814 /* Get the debug table for KD */
815 HalpDebugPortTable
= HalAcpiGetTable(LoaderBlock
, DBGP_SIGNATURE
);
816 DPRINT1("ACPI DBGP at 0x%p\n", HalpDebugPortTable
);
818 /* Initialize NUMA through the SRAT */
819 HalpNumaInitializeStaticConfiguration(LoaderBlock
);
821 /* Initialize hotplug through the SRAT */
822 HalpDynamicSystemResourceConfiguration(LoaderBlock
);
823 DPRINT1("ACPI SRAT at 0x%p\n", HalpAcpiSrat
);
826 DPRINT1("Your machine has a SRAT, but NUMA/HotPlug are not supported!\n");
829 /* Can there be memory higher than 4GB? */
830 if (HalpMaxHotPlugMemoryAddress
.HighPart
>= 1)
832 /* We'll need this for DMA later */
833 HalpPhysicalMemoryMayAppearAbove4GB
= TRUE
;
836 /* Setup the ACPI timer */
837 HaliAcpiTimerInit(0, 0);
839 /* Do we have a low stub address yet? */
840 if (!HalpLowStubPhysicalAddress
.LowPart
)
843 HalpLowStubPhysicalAddress
.LowPart
= HalpAllocPhysicalMemory(LoaderBlock
,
847 if (HalpLowStubPhysicalAddress
.LowPart
)
850 HalpLowStub
= HalpMapPhysicalMemory64(HalpLowStubPhysicalAddress
, 1);
854 /* Grab a page for flushes */
855 PhysicalAddress
.QuadPart
= 0x100000;
856 HalpVirtAddrForFlush
= HalpMapPhysicalMemory64(PhysicalAddress
, 1);
857 HalpPteForFlush
= HalAddressToPte(HalpVirtAddrForFlush
);
859 /* Don't do this again */
860 HalpProcessedACPIPhase0
= TRUE
;
862 /* Setup the boot table */
863 HalpInitBootTable(LoaderBlock
);
866 return STATUS_SUCCESS
;
871 HalpInitializePciBus(VOID
)
873 /* Setup the PCI stub support */
874 HalpInitializePciStubs();
876 /* Set the NMI crash flag */
877 HalpGetNMICrashFlag();
882 HalpBuildAddressMap(VOID
)
884 /* ACPI is magic baby */
889 HalpGetDebugPortTable(VOID
)
891 return ((HalpDebugPortTable
) &&
892 (HalpDebugPortTable
->BaseAddress
.AddressSpaceID
== 1));
897 HalpIs16BitPortDecodeSupported(VOID
)
899 /* All ACPI systems are at least "EISA" so they support this */
900 return CM_RESOURCE_PORT_16_BIT_DECODE
;
908 HalReportResourceUsage(VOID
)
910 INTERFACE_TYPE InterfaceType
;
911 UNICODE_STRING HalString
;
913 /* FIXME: Initialize DMA 64-bit support */
915 /* FIXME: Initialize MCA bus */
917 /* Initialize PCI bus. */
918 HalpInitializePciBus();
920 /* What kind of bus is this? */
924 case MACHINE_TYPE_ISA
:
929 case MACHINE_TYPE_EISA
:
930 InterfaceType
= Eisa
;
934 case MACHINE_TYPE_MCA
:
935 InterfaceType
= MicroChannel
;
940 InterfaceType
= Internal
;
944 /* Build HAL usage */
945 RtlInitUnicodeString(&HalString
, HalName
);
946 HalpReportResourceUsage(&HalString
, InterfaceType
);
948 /* Setup PCI debugging and Hibernation */
949 HalpRegisterPciDebuggingDeviceInfo();