ReactOS  0.4.15-dev-3442-gc05a45e
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)
 
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 54 of file hwacpi.c.

55 {
57  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
58  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
59  PRSDP_DESCRIPTOR Rsdp;
60  PACPI_BIOS_DATA AcpiBiosData;
62 
63  Rsdp = FindAcpiBios();
64 
65  if (Rsdp)
66  {
67  /* Set up the flag in the loader block */
68  AcpiPresent = TRUE;
69 
70  /* Calculate the table size */
72  sizeof(ACPI_BIOS_DATA) - sizeof(BIOS_MEMORY_MAP);
73 
74  /* Set 'Configuration Data' value */
75  PartialResourceList =
78  if (PartialResourceList == NULL)
79  {
80  ERR("Failed to allocate resource descriptor\n");
81  return;
82  }
83 
84  RtlZeroMemory(PartialResourceList, sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize);
85  PartialResourceList->Version = 0;
86  PartialResourceList->Revision = 0;
87  PartialResourceList->Count = 1;
88 
89  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
90  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
91  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
92  PartialDescriptor->u.DeviceSpecificData.DataSize = TableSize;
93 
94  /* Fill the table */
95  AcpiBiosData = (PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1];
96 
97  if (Rsdp->revision > 0)
98  {
99  TRACE("ACPI >1.0, using XSDT address\n");
100  AcpiBiosData->RSDTAddress.QuadPart = Rsdp->xsdt_physical_address;
101  }
102  else
103  {
104  TRACE("ACPI 1.0, using RSDT address\n");
105  AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
106  }
107 
108  AcpiBiosData->Count = PcBiosMapCount;
109  memcpy(AcpiBiosData->MemoryMap, PcBiosMemoryMap,
110  PcBiosMapCount * sizeof(BIOS_MEMORY_MAP));
111 
112  TRACE("RSDT %p, data size %x\n", Rsdp->rsdt_physical_address,
113  TableSize);
114 
115  /* Create new bus key */
116  FldrCreateComponentKey(SystemKey,
117  AdapterClass,
118  MultiFunctionAdapter,
119  0x0,
120  0x0,
121  0xFFFFFFFF,
122  "ACPI BIOS",
123  PartialResourceList,
125  &BiosKey);
126 
127  /* Increment bus number */
128  (*BusNumber)++;
129  }
130 }
UCHAR revision
Definition: winldr.h:25
PHYSICAL_ADDRESS RSDTAddress
Definition: pcbios.h:77
ULONGLONG xsdt_physical_address
Definition: winldr.h:28
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
BOOLEAN AcpiPresent
Definition: hwacpi.c:26
GLint x0
Definition: linetemp.h:95
struct _ACPI_BIOS_DATA * PACPI_BIOS_DATA
#define TRUE
Definition: types.h:120
if(dx==0 &&dy==0)
Definition: linetemp.h:174
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376::@385 DeviceSpecificData
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@376 u
ULONGLONG Count
Definition: pcbios.h:78
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
BIOS_MEMORY_MAP PcBiosMemoryMap[MAX_BIOS_DESCRIPTORS]
Definition: pcmem.c:37
static PRSDP_DESCRIPTOR FindAcpiBios(VOID)
Definition: hwacpi.c:29
BIOS_MEMORY_MAP MemoryMap[1]
Definition: pcbios.h:79
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
ULONG LowPart
Definition: typedefs.h:106
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
VOID NTAPI 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 PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
#define ERR(fmt,...)
Definition: debug.h:110
ULONG rsdt_physical_address
Definition: winldr.h:26
#define NULL
Definition: types.h:112
_Must_inspect_result_ typedef _Out_ PULONG TableSize
Definition: iotypes.h:4327
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:23
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG PcBiosMapCount
Definition: pcmem.c:38

Referenced by Pc98HwDetect(), and PcHwDetect().

◆ FindAcpiBios()

static PRSDP_DESCRIPTOR FindAcpiBios ( VOID  )
static

Definition at line 29 of file hwacpi.c.

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

Referenced by DetectAcpiBios().

Variable Documentation

◆ AcpiPresent

BOOLEAN AcpiPresent = FALSE

Definition at line 26 of file hwacpi.c.

Referenced by DetectAcpiBios(), and WinLdrInitializePhase1().