ReactOS 0.4.16-dev-1056-gbe87e00
hwacpi.c File Reference
#include <freeldr.h>
#include <debug.h>
Include dependency graph for hwacpi.c:

Go to the source code of this file.

Functions

 DBG_DEFAULT_CHANNEL (HWDETECT)
 
BOOLEAN IsAcpiPresent (VOID)
 
static PRSDP_DESCRIPTOR FindAcpiBios (VOID)
 
VOID DetectAcpiBios (PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
 

Variables

BOOLEAN AcpiPresent = FALSE
 

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( HWDETECT  )

◆ DetectAcpiBios()

VOID DetectAcpiBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)

Definition at line 59 of file hwacpi.c.

60{
62 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
63 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
65 PACPI_BIOS_DATA AcpiBiosData;
67
68 Rsdp = FindAcpiBios();
69
70 if (Rsdp)
71 {
72 /* Set up the flag in the loader block */
74
75 /* Calculate the table size */
77 sizeof(ACPI_BIOS_DATA) - sizeof(BIOS_MEMORY_MAP);
78
79 /* Set 'Configuration Data' value */
80 PartialResourceList =
83 if (PartialResourceList == NULL)
84 {
85 ERR("Failed to allocate resource descriptor\n");
86 return;
87 }
88
89 RtlZeroMemory(PartialResourceList, sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize);
90 PartialResourceList->Version = 0;
91 PartialResourceList->Revision = 0;
92 PartialResourceList->Count = 1;
93
94 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
95 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
97 PartialDescriptor->u.DeviceSpecificData.DataSize = TableSize;
98
99 /* Fill the table */
100 AcpiBiosData = (PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1];
101
102 if (Rsdp->revision > 0)
103 {
104 TRACE("ACPI >1.0, using XSDT address\n");
105 AcpiBiosData->RSDTAddress.QuadPart = Rsdp->xsdt_physical_address;
106 }
107 else
108 {
109 TRACE("ACPI 1.0, using RSDT address\n");
110 AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
111 }
112
113 AcpiBiosData->Count = PcBiosMapCount;
114 memcpy(AcpiBiosData->MemoryMap, PcBiosMemoryMap,
116
117 TRACE("RSDT %p, data size %x\n", Rsdp->rsdt_physical_address,
118 TableSize);
119
120 /* Create new bus key */
121 FldrCreateComponentKey(SystemKey,
124 0,
125 0,
126 0xFFFFFFFF,
127 "ACPI BIOS",
128 PartialResourceList,
130 &BiosKey);
131
132 /* Increment bus number */
133 (*BusNumber)++;
134 }
135}
VOID FldrCreateComponentKey(_In_ PCONFIGURATION_COMPONENT_DATA SystemNode, _In_ CONFIGURATION_CLASS Class, _In_ CONFIGURATION_TYPE Type, _In_ IDENTIFIER_FLAG Flags, _In_ ULONG Key, _In_ ULONG Affinity, _In_ PCSTR IdentifierString, _In_ PCM_PARTIAL_RESOURCE_LIST ResourceList, _In_ ULONG Size, _Out_ PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:198
#define ERR(fmt,...)
Definition: precomp.h:57
BOOLEAN AcpiPresent
Definition: hwacpi.c:26
static PRSDP_DESCRIPTOR FindAcpiBios(VOID)
Definition: hwacpi.c:34
PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: heap.c:533
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
if(dx< 0)
Definition: linetemp.h:194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct _ACPI_BIOS_DATA * PACPI_BIOS_DATA
ULONG PcBiosMapCount
Definition: pcmem.c:38
BIOS_MEMORY_MAP PcBiosMemoryMap[MAX_BIOS_DESCRIPTORS]
Definition: pcmem.c:37
@ AdapterClass
Definition: arc.h:93
@ MultiFunctionAdapter
Definition: arc.h:116
#define TRACE(s)
Definition: solgame.cpp:4
ULONG rsdt_physical_address
Definition: winldr.h:26
UCHAR revision
Definition: winldr.h:25
ULONGLONG xsdt_physical_address
Definition: winldr.h:28
PHYSICAL_ADDRESS RSDTAddress
Definition: pcbios.h:77
BIOS_MEMORY_MAP MemoryMap[1]
Definition: pcbios.h:79
ULONGLONG Count
Definition: pcbios.h:78
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@424 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@424::@433 DeviceSpecificData
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
#define TAG_HW_RESOURCE_LIST
Definition: uefidisk.c:15
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
@ CmResourceShareUndetermined
Definition: cmtypes.h:240
_Must_inspect_result_ typedef _Out_ PULONG TableSize
Definition: iotypes.h:4328

Referenced by Pc98HwDetect(), and PcHwDetect().

◆ FindAcpiBios()

static PRSDP_DESCRIPTOR FindAcpiBios ( VOID  )
static

Definition at line 34 of file hwacpi.c.

35{
36 PUCHAR Ptr;
37
38 /* Find the 'Root System Descriptor Table Pointer' */
39 Ptr = (PUCHAR)0xE0000;
40 while ((ULONG_PTR)Ptr < 0x100000)
41 {
42 if (!memcmp(Ptr, "RSD PTR ", 8))
43 {
44 TRACE("ACPI supported\n");
45
46 return (PRSDP_DESCRIPTOR)Ptr;
47 }
48
49 Ptr = (PUCHAR)((ULONG_PTR)Ptr + 0x10);
50 }
51
52 TRACE("ACPI not supported\n");
53
54 return NULL;
55}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
uint32_t ULONG_PTR
Definition: typedefs.h:65
unsigned char * PUCHAR
Definition: typedefs.h:53

Referenced by DetectAcpiBios().

◆ IsAcpiPresent()

BOOLEAN IsAcpiPresent ( VOID  )

Definition at line 28 of file hwacpi.c.

29{
30 return AcpiPresent;
31}

Variable Documentation

◆ AcpiPresent

BOOLEAN AcpiPresent = FALSE

Definition at line 26 of file hwacpi.c.

Referenced by DetectAcpiBios(), and IsAcpiPresent().