ReactOS 0.4.15-dev-7918-g2a2556c
tbxfload.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "actables.h"
#include "acevents.h"
Include dependency graph for tbxfload.c:

Go to the source code of this file.

Macros

#define EXPORT_ACPI_INTERFACES
 
#define _COMPONENT   ACPI_TABLES
 

Functions

ACPI_STATUS ACPI_INIT_FUNCTION AcpiLoadTables (void)
 
ACPI_STATUS AcpiTbLoadNamespace (void)
 
ACPI_STATUS ACPI_INIT_FUNCTION AcpiInstallTable (ACPI_TABLE_HEADER *Table)
 
ACPI_STATUS ACPI_INIT_FUNCTION AcpiInstallPhysicalTable (ACPI_PHYSICAL_ADDRESS Address)
 
ACPI_STATUS AcpiLoadTable (ACPI_TABLE_HEADER *Table, UINT32 *TableIdx)
 
ACPI_STATUS AcpiUnloadParentTable (ACPI_HANDLE Object)
 
ACPI_STATUS AcpiUnloadTable (UINT32 TableIndex)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_TABLES

Definition at line 52 of file tbxfload.c.

◆ EXPORT_ACPI_INTERFACES

#define EXPORT_ACPI_INTERFACES

Definition at line 44 of file tbxfload.c.

Function Documentation

◆ AcpiInstallPhysicalTable()

ACPI_STATUS ACPI_INIT_FUNCTION AcpiInstallPhysicalTable ( ACPI_PHYSICAL_ADDRESS  Address)

Definition at line 336 of file tbxfload.c.

338{
340 UINT32 TableIndex;
341
342
344
345
348
350}
unsigned int UINT32
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_STATUS AcpiTbInstallStandardTable(ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table, BOOLEAN Reload, BOOLEAN Override, UINT32 *TableIndex)
Definition: tbinstal.c:139
#define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL
Definition: actbl.h:430
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
Status
Definition: gdiplustypes.h:25
static WCHAR Address[46]
Definition: ping.c:68
ACPI_STATUS ACPI_INIT_FUNCTION AcpiInstallPhysicalTable(ACPI_PHYSICAL_ADDRESS Address)
Definition: tbxfload.c:336

Referenced by AcpiInstallPhysicalTable().

◆ AcpiInstallTable()

ACPI_STATUS ACPI_INIT_FUNCTION AcpiInstallTable ( ACPI_TABLE_HEADER Table)

Definition at line 302 of file tbxfload.c.

304{
306 UINT32 TableIndex;
307
308
310
311
314
316}
#define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL
Definition: actbl.h:429
#define ACPI_PTR_TO_PHYSADDR(i)
Definition: actypes.h:559
ASMGENDATA Table[]
Definition: genincdata.c:61
ACPI_STATUS ACPI_INIT_FUNCTION AcpiInstallTable(ACPI_TABLE_HEADER *Table)
Definition: tbxfload.c:302

Referenced by AcpiInstallTable().

◆ AcpiLoadTable()

ACPI_STATUS AcpiLoadTable ( ACPI_TABLE_HEADER Table,
UINT32 TableIdx 
)

Definition at line 375 of file tbxfload.c.

378{
380 UINT32 TableIndex;
381
382
384
385
386 /* Parameter validation */
387
388 if (!Table)
389 {
391 }
392
393 /* Install the table and load it into the namespace */
394
395 ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
398 if (TableIdx)
399 {
400 *TableIdx = TableIndex;
401 }
402
403 if (ACPI_SUCCESS (Status))
404 {
405 /* Complete the initialization/resolution of new objects */
406
408 }
409
411}
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
ACPI_STATUS AcpiNsInitializeObjects(void)
Definition: nsinit.c:92
#define ACPI_INFO(plist)
Definition: acoutput.h:237
ACPI_STATUS AcpiTbInstallAndLoadTable(ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table, BOOLEAN Override, UINT32 *TableIndex)
Definition: tbdata.c:1162
ACPI_STATUS AcpiLoadTable(ACPI_TABLE_HEADER *Table, UINT32 *TableIdx)
Definition: tbxfload.c:375

Referenced by AcpiLoadTable().

◆ AcpiLoadTables()

ACPI_STATUS ACPI_INIT_FUNCTION AcpiLoadTables ( void  )

Definition at line 69 of file tbxfload.c.

71{
73
74
76
77
78 /*
79 * Install the default operation region handlers. These are the
80 * handlers that are defined by the ACPI specification to be
81 * "always accessible" -- namely, SystemMemory, SystemIO, and
82 * PCI_Config. This also means that no _REG methods need to be
83 * run for these address spaces. We need to have these handlers
84 * installed before any AML code can be executed, especially any
85 * module-level code (11/2015).
86 * Note that we allow OSPMs to install their own region handlers
87 * between AcpiInitializeSubsystem() and AcpiLoadTables() to use
88 * their customized default region handlers.
89 */
91 if (ACPI_FAILURE (Status))
92 {
93 ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization"));
95 }
96
97 /* Load the namespace from the tables */
98
100
101 /* Don't let single failures abort the load */
102
104 {
105 Status = AE_OK;
106 }
107
108 if (ACPI_FAILURE (Status))
109 {
111 "While loading namespace from ACPI tables"));
112 }
113
114 /*
115 * Initialize the objects in the namespace that remain uninitialized.
116 * This runs the executable AML that may be part of the declaration of
117 * these name objects:
118 * OperationRegions, BufferFields, Buffers, and Packages.
119 *
120 */
122 if (ACPI_SUCCESS (Status))
123 {
124 AcpiGbl_NamespaceInitialized = TRUE;
125 }
126
128}
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_CTRL_TERMINATE
Definition: acexcep.h:226
#define AE_OK
Definition: acexcep.h:97
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define AE_INFO
Definition: acoutput.h:230
#define TRUE
Definition: types.h:120
ACPI_STATUS AcpiEvInstallRegionHandlers(void)
Definition: evhandler.c:88
ACPI_STATUS AcpiTbLoadNamespace(void)
Definition: tbxfload.c:147
ACPI_STATUS ACPI_INIT_FUNCTION AcpiLoadTables(void)
Definition: tbxfload.c:69

Referenced by AcpiLoadTables(), and Bus_StartFdo().

◆ AcpiTbLoadNamespace()

ACPI_STATUS AcpiTbLoadNamespace ( void  )

Definition at line 147 of file tbxfload.c.

149{
151 UINT32 i;
152 ACPI_TABLE_HEADER *NewDsdt;
154 UINT32 TablesLoaded = 0;
155 UINT32 TablesFailed = 0;
156
157
158 ACPI_FUNCTION_TRACE (TbLoadNamespace);
159
160
162
163 /*
164 * Load the namespace. The DSDT is required, but any SSDT and
165 * PSDT tables are optional. Verify the DSDT.
166 */
167 Table = &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex];
168
169 if (!AcpiGbl_RootTableList.CurrentTableCount ||
170 !ACPI_COMPARE_NAMESEG (Table->Signature.Ascii, ACPI_SIG_DSDT) ||
172 {
174 goto UnlockAndExit;
175 }
176
177 /*
178 * Save the DSDT pointer for simple access. This is the mapped memory
179 * address. We must take care here because the address of the .Tables
180 * array can change dynamically as tables are loaded at run-time. Note:
181 * .Pointer field is not validated until after call to AcpiTbValidateTable.
182 */
183 AcpiGbl_DSDT = Table->Pointer;
184
185 /*
186 * Optionally copy the entire DSDT to local memory (instead of simply
187 * mapping it.) There are some BIOSs that corrupt or replace the original
188 * DSDT, creating the need for this option. Default is FALSE, do not copy
189 * the DSDT.
190 */
191 if (AcpiGbl_CopyDsdtLocally)
192 {
193 NewDsdt = AcpiTbCopyDsdt (AcpiGbl_DsdtIndex);
194 if (NewDsdt)
195 {
196 AcpiGbl_DSDT = NewDsdt;
197 }
198 }
199
200 /*
201 * Save the original DSDT header for detection of table corruption
202 * and/or replacement of the DSDT from outside the OS.
203 */
204 memcpy (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT,
205 sizeof (ACPI_TABLE_HEADER));
206
207 /* Load and parse tables */
208
210 Status = AcpiNsLoadTable (AcpiGbl_DsdtIndex, AcpiGbl_RootNode);
212 if (ACPI_FAILURE (Status))
213 {
214 ACPI_EXCEPTION ((AE_INFO, Status, "[DSDT] table load failed"));
215 TablesFailed++;
216 }
217 else
218 {
219 TablesLoaded++;
220 }
221
222 /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
223
224 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
225 {
226 Table = &AcpiGbl_RootTableList.Tables[i];
227
228 if (!Table->Address ||
229 (!ACPI_COMPARE_NAMESEG (Table->Signature.Ascii, ACPI_SIG_SSDT) &&
230 !ACPI_COMPARE_NAMESEG (Table->Signature.Ascii, ACPI_SIG_PSDT) &&
231 !ACPI_COMPARE_NAMESEG (Table->Signature.Ascii, ACPI_SIG_OSDT)) ||
233 {
234 continue;
235 }
236
237 /* Ignore errors while loading tables, get as many as possible */
238
240 Status = AcpiNsLoadTable (i, AcpiGbl_RootNode);
242 if (ACPI_FAILURE (Status))
243 {
244 ACPI_EXCEPTION ((AE_INFO, Status, "(%4.4s:%8.8s) while loading table",
245 Table->Signature.Ascii, Table->Pointer->OemTableId));
246
247 TablesFailed++;
248
250 "Table [%4.4s:%8.8s] (id FF) - Table namespace load failed\n\n",
251 Table->Signature.Ascii, Table->Pointer->OemTableId));
252 }
253 else
254 {
255 TablesLoaded++;
256 }
257 }
258
259 if (!TablesFailed)
260 {
261 ACPI_INFO ((
262 "%u ACPI AML tables successfully acquired and loaded",
263 TablesLoaded));
264 }
265 else
266 {
268 "%u table load failures, %u successful",
269 TablesFailed, TablesLoaded));
270
271 /* Indicate at least one failure */
272
274 }
275
276#ifdef ACPI_APPLICATION
278#endif
279
280
281UnlockAndExit:
284}
#define AE_NO_ACPI_TABLES
Definition: acexcep.h:110
#define ACPI_MTX_TABLES
Definition: aclocal.h:86
ACPI_STATUS AcpiNsLoadTable(UINT32 TableIndex, ACPI_NAMESPACE_NODE *Node)
Definition: nsload.c:82
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
#define ACPI_DB_INIT
Definition: acoutput.h:151
ACPI_STATUS AcpiTbValidateTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbdata.c:375
ACPI_TABLE_HEADER * AcpiTbCopyDsdt(UINT32 TableIndex)
Definition: tbutils.c:163
#define ACPI_SIG_DSDT
Definition: actbl.h:67
#define ACPI_SIG_PSDT
Definition: actbl.h:71
#define ACPI_SIG_OSDT
Definition: actbl.h:70
#define ACPI_SIG_SSDT
Definition: actbl.h:75
#define ACPI_COMPARE_NAMESEG(a, b)
Definition: actypes.h:564
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
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
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by AcpiLoadTables().

◆ AcpiUnloadParentTable()

ACPI_STATUS AcpiUnloadParentTable ( ACPI_HANDLE  Object)

Definition at line 433 of file tbxfload.c.

435{
439 UINT32 i;
440
441
443
444
445 /* Parameter validation */
446
447 if (!Object)
448 {
450 }
451
452 /*
453 * The node OwnerId is currently the same as the parent table ID.
454 * However, this could change in the future.
455 */
456 OwnerId = Node->OwnerId;
457 if (!OwnerId)
458 {
459 /* OwnerId==0 means DSDT is the owner. DSDT cannot be unloaded */
460
462 }
463
464 /* Must acquire the table lock during this operation */
465
467 if (ACPI_FAILURE (Status))
468 {
470 }
471
472 /* Find the table in the global table list */
473
474 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
475 {
476 if (OwnerId != AcpiGbl_RootTableList.Tables[i].OwnerId)
477 {
478 continue;
479 }
480
481 /*
482 * Allow unload of SSDT and OEMx tables only. Do not allow unload
483 * of the DSDT. No other types of tables should get here, since
484 * only these types can contain AML and thus are the only types
485 * that can create namespace objects.
486 */
488 AcpiGbl_RootTableList.Tables[i].Signature.Ascii,
490 {
491 Status = AE_TYPE;
492 break;
493 }
494
498 break;
499 }
500
503}
#define AE_NOT_EXIST
Definition: acexcep.h:114
#define AE_TYPE
Definition: acexcep.h:116
ACPI_STATUS AcpiTbUnloadTable(UINT32 TableIndex)
Definition: tbdata.c:1206
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
UINT16 ACPI_OWNER_ID
Definition: actypes.h:486
_Must_inspect_result_ _In_opt_ PVOID OwnerId
Definition: fsrtlfuncs.h:907
ACPI_STATUS AcpiUnloadParentTable(ACPI_HANDLE Object)
Definition: tbxfload.c:433
Definition: dlist.c:348
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object

Referenced by AcpiUnloadParentTable().

◆ AcpiUnloadTable()

ACPI_STATUS AcpiUnloadTable ( UINT32  TableIndex)

Definition at line 524 of file tbxfload.c.

526{
528
529
531
532
533 if (TableIndex == 1)
534 {
535 /* TableIndex==1 means DSDT is the owner. DSDT cannot be unloaded */
536
538 }
539
540 Status = AcpiTbUnloadTable (TableIndex);
542}
ACPI_STATUS AcpiUnloadTable(UINT32 TableIndex)
Definition: tbxfload.c:524

Referenced by AcpiUnloadTable().