ReactOS 0.4.16-dev-736-g28b802b
uefihw.c File Reference
#include <uefildr.h>
#include <debug.h>
Include dependency graph for uefihw.c:

Go to the source code of this file.

Functions

 DBG_DEFAULT_CHANNEL (WARNING)
 
BOOLEAN IsAcpiPresent (VOID)
 
static PRSDP_DESCRIPTOR FindAcpiBios (VOID)
 
VOID DetectAcpiBios (PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
 
PCONFIGURATION_COMPONENT_DATA UefiHwDetect (_In_opt_ PCSTR Options)
 

Variables

EFI_SYSTEM_TABLEGlobalSystemTable
 
EFI_HANDLE GlobalImageHandle
 
UCHAR PcBiosDiskCount
 
EFI_MEMORY_DESCRIPTOREfiMemoryMap
 
UINT32 FreeldrDescCount
 
BOOLEAN AcpiPresent = FALSE
 

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( WARNING  )

◆ DetectAcpiBios()

VOID DetectAcpiBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)

Definition at line 54 of file uefihw.c.

55{
57 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
58 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
60 PACPI_BIOS_DATA AcpiBiosData;
62
63 Rsdp = FindAcpiBios();
64
65 if (Rsdp)
66 {
67 /* Set up the flag in the loader block */
69
70 /* Calculate the table size */
72 sizeof(ACPI_BIOS_DATA) - sizeof(BIOS_MEMORY_MAP);
73
74 /* Set 'Configuration Data' value */
75 PartialResourceList = FrLdrHeapAlloc(sizeof(CM_PARTIAL_RESOURCE_LIST) +
77 if (PartialResourceList == NULL)
78 {
79 ERR("Failed to allocate resource descriptor\n");
80 return;
81 }
82
83 RtlZeroMemory(PartialResourceList, sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize);
84 PartialResourceList->Version = 0;
85 PartialResourceList->Revision = 0;
86 PartialResourceList->Count = 1;
87
88 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
89 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
91 PartialDescriptor->u.DeviceSpecificData.DataSize = TableSize;
92
93 /* Fill the table */
94 AcpiBiosData = (PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1];
95
96 if (Rsdp->revision > 0)
97 {
98 TRACE("ACPI >1.0, using XSDT address\n");
99 AcpiBiosData->RSDTAddress.QuadPart = Rsdp->xsdt_physical_address;
100 }
101 else
102 {
103 TRACE("ACPI 1.0, using RSDT address\n");
104 AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
105 }
106
107 AcpiBiosData->Count = FreeldrDescCount;
108 memcpy(AcpiBiosData->MemoryMap, EfiMemoryMap,
110
111 TRACE("RSDT %p, data size %x\n", Rsdp->rsdt_physical_address, TableSize);
112
113 /* Create new bus key */
114 FldrCreateComponentKey(SystemKey,
117 0x0,
118 0x0,
119 0xFFFFFFFF,
120 "ACPI BIOS",
121 PartialResourceList,
123 &BiosKey);
124
125 /* Increment bus number */
126 (*BusNumber)++;
127 }
128}
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
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
@ 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::@393 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@393::@402 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
UINT32 FreeldrDescCount
Definition: uefimem.c:36
EFI_MEMORY_DESCRIPTOR * EfiMemoryMap
Definition: uefimem.c:35
BOOLEAN AcpiPresent
Definition: uefihw.c:23
static PRSDP_DESCRIPTOR FindAcpiBios(VOID)
Definition: uefihw.c:34
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:4327

Referenced by UefiHwDetect().

◆ FindAcpiBios()

static PRSDP_DESCRIPTOR FindAcpiBios ( VOID  )
static

Definition at line 34 of file uefihw.c.

35{
36 UINTN i;
37 RSDP_DESCRIPTOR* rsdp = NULL;
39
41 {
43 &acpi2_guid, sizeof(acpi2_guid)))
44 {
46 break;
47 }
48 }
49
50 return rsdp;
51}
#define EFI_ACPI_20_TABLE_GUID
Definition: Acpi.h:40
UINT32 UINTN
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
EFI_CONFIGURATION_TABLE * ConfigurationTable
Definition: UefiSpec.h:1968
UINTN NumberOfTableEntries
Definition: UefiSpec.h:1963
EFI_SYSTEM_TABLE * GlobalSystemTable
Definition: uefildr.c:16

Referenced by DetectAcpiBios().

◆ IsAcpiPresent()

BOOLEAN IsAcpiPresent ( VOID  )

Definition at line 27 of file uefihw.c.

28{
29 return AcpiPresent;
30}

Referenced by WinLdrInitializePhase1().

◆ UefiHwDetect()

PCONFIGURATION_COMPONENT_DATA UefiHwDetect ( _In_opt_ PCSTR  Options)

Definition at line 131 of file uefihw.c.

133{
135 ULONG BusNumber = 0;
136
137 TRACE("DetectHardware()\n");
138
139 /* Create the 'System' key */
140#if defined(_M_IX86) || defined(_M_AMD64)
141 FldrCreateSystemKey(&SystemKey, "AT/AT COMPATIBLE");
142#elif defined(_M_IA64)
143 FldrCreateSystemKey(&SystemKey, "Intel Itanium processor family");
144#elif defined(_M_ARM) || defined(_M_ARM64)
145 FldrCreateSystemKey(&SystemKey, "ARM processor family");
146#else
147 #error Please define a system key for your architecture
148#endif
149
150 /* Detect ACPI */
151 DetectAcpiBios(SystemKey, &BusNumber);
152
153 TRACE("DetectHardware() Done\n");
154 return SystemKey;
155}
VOID FldrCreateSystemKey(_Out_ PCONFIGURATION_COMPONENT_DATA *SystemNode, _In_ PCSTR IdentifierString)
Definition: archwsup.c:135
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: uefihw.c:54
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160

Referenced by MachInit().

Variable Documentation

◆ AcpiPresent

BOOLEAN AcpiPresent = FALSE

Definition at line 23 of file uefihw.c.

Referenced by DetectAcpiBios(), and IsAcpiPresent().

◆ EfiMemoryMap

EFI_MEMORY_DESCRIPTOR* EfiMemoryMap
extern

◆ FreeldrDescCount

UINT32 FreeldrDescCount
extern

Definition at line 36 of file uefimem.c.

Referenced by DetectAcpiBios(), UefiMemGetMemoryMap(), and UefiSetMemory().

◆ GlobalImageHandle

EFI_HANDLE GlobalImageHandle
extern

Definition at line 15 of file uefildr.c.

◆ GlobalSystemTable

EFI_SYSTEM_TABLE* GlobalSystemTable
extern

Definition at line 16 of file uefildr.c.

Referenced by FindAcpiBios().

◆ PcBiosDiskCount

UCHAR PcBiosDiskCount
extern

Definition at line 46 of file hwdisk.c.

Referenced by EnumerateHarddisks(), UefiInitializeBootDevices(), and UefiSetupBlockDevices().