ReactOS 0.4.15-dev-7988-g06a3508
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)
 
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 49 of file uefihw.c.

50{
52 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
53 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
55 PACPI_BIOS_DATA AcpiBiosData;
57
58 Rsdp = FindAcpiBios();
59
60 if (Rsdp)
61 {
62 /* Set up the flag in the loader block */
64
65 /* Calculate the table size */
67 sizeof(ACPI_BIOS_DATA) - sizeof(BIOS_MEMORY_MAP);
68
69 /* Set 'Configuration Data' value */
70 PartialResourceList = FrLdrHeapAlloc(sizeof(CM_PARTIAL_RESOURCE_LIST) +
72 if (PartialResourceList == NULL)
73 {
74 ERR("Failed to allocate resource descriptor\n");
75 return;
76 }
77
78 RtlZeroMemory(PartialResourceList, sizeof(CM_PARTIAL_RESOURCE_LIST) + TableSize);
79 PartialResourceList->Version = 0;
80 PartialResourceList->Revision = 0;
81 PartialResourceList->Count = 1;
82
83 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
84 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
86 PartialDescriptor->u.DeviceSpecificData.DataSize = TableSize;
87
88 /* Fill the table */
89 AcpiBiosData = (PACPI_BIOS_DATA)&PartialResourceList->PartialDescriptors[1];
90
91 if (Rsdp->revision > 0)
92 {
93 TRACE("ACPI >1.0, using XSDT address\n");
94 AcpiBiosData->RSDTAddress.QuadPart = Rsdp->xsdt_physical_address;
95 }
96 else
97 {
98 TRACE("ACPI 1.0, using RSDT address\n");
99 AcpiBiosData->RSDTAddress.LowPart = Rsdp->rsdt_physical_address;
100 }
101
102 AcpiBiosData->Count = FreeldrDescCount;
103 memcpy(AcpiBiosData->MemoryMap, EfiMemoryMap,
105
106 TRACE("RSDT %p, data size %x\n", Rsdp->rsdt_physical_address, TableSize);
107
108 /* Create new bus key */
109 FldrCreateComponentKey(SystemKey,
112 0x0,
113 0x0,
114 0xFFFFFFFF,
115 "ACPI BIOS",
116 PartialResourceList,
118 &BiosKey);
119
120 /* Increment bus number */
121 (*BusNumber)++;
122 }
123}
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: debug.h:110
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
#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:29
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 29 of file uefihw.c.

30{
31 UINTN i;
32 RSDP_DESCRIPTOR* rsdp = NULL;
34
36 {
38 &acpi2_guid, sizeof(acpi2_guid)))
39 {
41 break;
42 }
43 }
44
45 return rsdp;
46}
#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().

◆ UefiHwDetect()

PCONFIGURATION_COMPONENT_DATA UefiHwDetect ( _In_opt_ PCSTR  Options)

Definition at line 126 of file uefihw.c.

128{
130 ULONG BusNumber = 0;
131
132 TRACE("DetectHardware()\n");
133
134 /* Create the 'System' key */
135#if defined(_M_IX86) || defined(_M_AMD64)
136 FldrCreateSystemKey(&SystemKey, "AT/AT COMPATIBLE");
137#elif defined(_M_IA64)
138 FldrCreateSystemKey(&SystemKey, "Intel Itanium processor family");
139#elif defined(_M_ARM) || defined(_M_ARM64)
140 FldrCreateSystemKey(&SystemKey, "ARM processor family");
141#else
142 #error Please define a system key for your architecture
143#endif
144
145 /* Detect ACPI */
146 DetectAcpiBios(SystemKey, &BusNumber);
147
148 TRACE("DetectHardware() Done\n");
149 return SystemKey;
150}
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:49
_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 WinLdrInitializePhase1().

◆ 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().