ReactOS 0.4.16-dev-311-g9382aa2
tbxface.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "actables.h"
Include dependency graph for tbxface.c:

Go to the source code of this file.

Macros

#define EXPORT_ACPI_INTERFACES
 
#define _COMPONENT   ACPI_TABLES
 

Functions

ACPI_STATUS AcpiAllocateRootTable (UINT32 InitialTableCount)
 
ACPI_STATUS ACPI_INIT_FUNCTION AcpiInitializeTables (ACPI_TABLE_DESC *InitialTableArray, UINT32 InitialTableCount, BOOLEAN AllowResize)
 
ACPI_STATUS ACPI_INIT_FUNCTION AcpiReallocateRootTable (void)
 
ACPI_STATUS AcpiGetTableHeader (char *Signature, UINT32 Instance, ACPI_TABLE_HEADER *OutTableHeader)
 
ACPI_STATUS AcpiGetTable (char *Signature, UINT32 Instance, ACPI_TABLE_HEADER **OutTable)
 
void AcpiPutTable (ACPI_TABLE_HEADER *Table)
 
ACPI_STATUS AcpiGetTableByIndex (UINT32 TableIndex, ACPI_TABLE_HEADER **OutTable)
 
ACPI_STATUS AcpiInstallTableHandler (ACPI_TABLE_HANDLER Handler, void *Context)
 
ACPI_STATUS AcpiRemoveTableHandler (ACPI_TABLE_HANDLER Handler)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_TABLES

Definition at line 50 of file tbxface.c.

◆ EXPORT_ACPI_INTERFACES

#define EXPORT_ACPI_INTERFACES

Definition at line 44 of file tbxface.c.

Function Documentation

◆ AcpiAllocateRootTable()

ACPI_STATUS AcpiAllocateRootTable ( UINT32  InitialTableCount)

Definition at line 69 of file tbxface.c.

71{
72
73 AcpiGbl_RootTableList.MaxTableCount = InitialTableCount;
74 AcpiGbl_RootTableList.Flags = ACPI_ROOT_ALLOW_RESIZE;
75
76 return (AcpiTbResizeRootTableList ());
77}
#define ACPI_ROOT_ALLOW_RESIZE
Definition: aclocal.h:245
ACPI_STATUS AcpiTbResizeRootTableList(void)
Definition: tbdata.c:677

Referenced by AcpiInitializeTables().

◆ AcpiGetTable()

ACPI_STATUS AcpiGetTable ( char Signature,
UINT32  Instance,
ACPI_TABLE_HEADER **  OutTable 
)

Definition at line 366 of file tbxface.c.

370{
371 UINT32 i;
372 UINT32 j;
374 ACPI_TABLE_DESC *TableDesc;
375
376
377 /* Parameter validation */
378
379 if (!Signature || !OutTable)
380 {
381 return (AE_BAD_PARAMETER);
382 }
383
384 /*
385 * Note that the following line is required by some OSPMs, they only
386 * check if the returned table is NULL instead of the returned status
387 * to determined if this function is succeeded.
388 */
389 *OutTable = NULL;
390
392
393 /* Walk the root table list */
394
395 for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
396 {
397 TableDesc = &AcpiGbl_RootTableList.Tables[i];
398
399 if (!ACPI_COMPARE_NAMESEG (&TableDesc->Signature, Signature))
400 {
401 continue;
402 }
403
404 if (++j < Instance)
405 {
406 continue;
407 }
408
409 Status = AcpiTbGetTable (TableDesc, OutTable);
410 break;
411 }
412
414 return (Status);
415}
unsigned int UINT32
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define AE_NOT_FOUND
Definition: acexcep.h:113
#define ACPI_MTX_TABLES
Definition: aclocal.h:86
ACPI_STATUS AcpiTbGetTable(ACPI_TABLE_DESC *TableDesc, ACPI_TABLE_HEADER **OutTable)
Definition: tbutils.c:434
#define ACPI_COMPARE_NAMESEG(a, b)
Definition: actypes.h:564
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
#define NULL
Definition: types.h:112
static const WCHAR Signature[]
Definition: parser.c:141
Status
Definition: gdiplustypes.h:25
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
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 GLint GLint j
Definition: glfuncs.h:250
ACPI_NAME_UNION Signature
Definition: actbl.h:406
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_opt_ WDFWMIINSTANCE * Instance
Definition: wdfwmi.h:481

Referenced by acpi_create_volatile_registry_tables().

◆ AcpiGetTableByIndex()

ACPI_STATUS AcpiGetTableByIndex ( UINT32  TableIndex,
ACPI_TABLE_HEADER **  OutTable 
)

Definition at line 491 of file tbxface.c.

494{
496
497
499
500
501 /* Parameter validation */
502
503 if (!OutTable)
504 {
506 }
507
508 /*
509 * Note that the following line is required by some OSPMs, they only
510 * check if the returned table is NULL instead of the returned status
511 * to determined if this function is succeeded.
512 */
513 *OutTable = NULL;
514
516
517 /* Validate index */
518
519 if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount)
520 {
522 goto UnlockAndExit;
523 }
524
526 &AcpiGbl_RootTableList.Tables[TableIndex], OutTable);
527
528UnlockAndExit:
531}
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_STATUS AcpiGetTableByIndex(UINT32 TableIndex, ACPI_TABLE_HEADER **OutTable)
Definition: tbxface.c:491

Referenced by AcpiDsEvalTableRegionOperands(), AcpiDsInitializeObjects(), AcpiGetTableByIndex(), AcpiNsExecuteTable(), AcpiNsOneCompleteParse(), AcpiTbInitializeFacs(), AcpiTbLoadTable(), and AcpiTbUnloadTable().

◆ AcpiGetTableHeader()

ACPI_STATUS AcpiGetTableHeader ( char Signature,
UINT32  Instance,
ACPI_TABLE_HEADER OutTableHeader 
)

Definition at line 275 of file tbxface.c.

279{
280 UINT32 i;
281 UINT32 j;
283
284
285 /* Parameter validation */
286
287 if (!Signature || !OutTableHeader)
288 {
289 return (AE_BAD_PARAMETER);
290 }
291
292 /* Walk the root table list */
293
294 for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
295 {
297 &(AcpiGbl_RootTableList.Tables[i].Signature), Signature))
298 {
299 continue;
300 }
301
302 if (++j < Instance)
303 {
304 continue;
305 }
306
307 if (!AcpiGbl_RootTableList.Tables[i].Pointer)
308 {
309 if ((AcpiGbl_RootTableList.Tables[i].Flags &
312 {
314 AcpiGbl_RootTableList.Tables[i].Address,
316 if (!Header)
317 {
318 return (AE_NO_MEMORY);
319 }
320
321 memcpy (OutTableHeader, Header, sizeof (ACPI_TABLE_HEADER));
323 }
324 else
325 {
326 return (AE_NOT_FOUND);
327 }
328 }
329 else
330 {
331 memcpy (OutTableHeader,
332 AcpiGbl_RootTableList.Tables[i].Pointer,
334 }
335
336 return (AE_OK);
337 }
338
339 return (AE_NOT_FOUND);
340}
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_OK
Definition: acexcep.h:97
void * AcpiOsMapMemory(ACPI_PHYSICAL_ADDRESS Where, ACPI_SIZE Length)
Definition: osl.c:108
void AcpiOsUnmapMemory(void *LogicalAddress, ACPI_SIZE Size)
Definition: osl.c:128
#define ACPI_TABLE_ORIGIN_MASK
Definition: actbl.h:432
#define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL
Definition: actbl.h:430
Definition: Header.h:9
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

◆ AcpiInitializeTables()

ACPI_STATUS ACPI_INIT_FUNCTION AcpiInitializeTables ( ACPI_TABLE_DESC InitialTableArray,
UINT32  InitialTableCount,
BOOLEAN  AllowResize 
)

Definition at line 107 of file tbxface.c.

111{
112 ACPI_PHYSICAL_ADDRESS RsdpAddress;
114
115
117
118
119 /*
120 * Setup the Root Table Array and allocate the table array
121 * if requested
122 */
123 if (!InitialTableArray)
124 {
125 Status = AcpiAllocateRootTable (InitialTableCount);
126 if (ACPI_FAILURE (Status))
127 {
129 }
130 }
131 else
132 {
133 /* Root Table Array has been statically allocated by the host */
134
135 memset (InitialTableArray, 0,
136 (ACPI_SIZE) InitialTableCount * sizeof (ACPI_TABLE_DESC));
137
138 AcpiGbl_RootTableList.Tables = InitialTableArray;
139 AcpiGbl_RootTableList.MaxTableCount = InitialTableCount;
140 AcpiGbl_RootTableList.Flags = ACPI_ROOT_ORIGIN_UNKNOWN;
141 if (AllowResize)
142 {
143 AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ALLOW_RESIZE;
144 }
145 }
146
147 /* Get the address of the RSDP */
148
149 RsdpAddress = AcpiOsGetRootPointer ();
150 if (!RsdpAddress)
151 {
153 }
154
155 /*
156 * Get the root table (RSDT or XSDT) and extract all entries to the local
157 * Root Table Array. This array contains the information of the RSDT/XSDT
158 * in a common, more usable format.
159 */
160 Status = AcpiTbParseRootTable (RsdpAddress);
162}
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_ROOT_ORIGIN_UNKNOWN
Definition: aclocal.h:243
ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer(void)
Definition: osl.c:43
ACPI_STATUS AcpiTbParseRootTable(ACPI_PHYSICAL_ADDRESS RsdpAddress)
Definition: tbutils.c:277
#define memset(x, y, z)
Definition: compat.h:39
UINT8 Flags
Definition: actbl.h:408
ACPI_STATUS AcpiAllocateRootTable(UINT32 InitialTableCount)
Definition: tbxface.c:69
ACPI_STATUS ACPI_INIT_FUNCTION AcpiInitializeTables(ACPI_TABLE_DESC *InitialTableArray, UINT32 InitialTableCount, BOOLEAN AllowResize)
Definition: tbxface.c:107

Referenced by AcpiInitializeTables(), and Bus_StartFdo().

◆ AcpiInstallTableHandler()

ACPI_STATUS AcpiInstallTableHandler ( ACPI_TABLE_HANDLER  Handler,
void Context 
)

Definition at line 550 of file tbxface.c.

553{
555
556
558
559
560 if (!Handler)
561 {
563 }
564
566 if (ACPI_FAILURE (Status))
567 {
569 }
570
571 /* Don't allow more than one handler */
572
573 if (AcpiGbl_TableHandler)
574 {
576 goto Cleanup;
577 }
578
579 /* Install the handler */
580
581 AcpiGbl_TableHandler = Handler;
582 AcpiGbl_TableHandlerContext = Context;
583
584Cleanup:
587}
#define AE_ALREADY_EXISTS
Definition: acexcep.h:115
#define ACPI_MTX_EVENTS
Definition: aclocal.h:87
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:672
static const WCHAR Cleanup[]
Definition: register.c:80
ACPI_STATUS AcpiInstallTableHandler(ACPI_TABLE_HANDLER Handler, void *Context)
Definition: tbxface.c:550

Referenced by AcpiInstallTableHandler().

◆ AcpiPutTable()

void AcpiPutTable ( ACPI_TABLE_HEADER Table)

Definition at line 437 of file tbxface.c.

439{
440 UINT32 i;
441 ACPI_TABLE_DESC *TableDesc;
442
443
445
446
447 if (!Table)
448 {
450 }
451
453
454 /* Walk the root table list */
455
456 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
457 {
458 TableDesc = &AcpiGbl_RootTableList.Tables[i];
459
460 if (TableDesc->Pointer != Table)
461 {
462 continue;
463 }
464
465 AcpiTbPutTable (TableDesc);
466 break;
467 }
468
471}
#define return_VOID
Definition: acoutput.h:495
void AcpiTbPutTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbutils.c:491
ASMGENDATA Table[]
Definition: genincdata.c:61
ACPI_TABLE_HEADER * Pointer
Definition: actbl.h:404
void AcpiPutTable(ACPI_TABLE_HEADER *Table)
Definition: tbxface.c:437

Referenced by AcpiPutTable().

◆ AcpiReallocateRootTable()

ACPI_STATUS ACPI_INIT_FUNCTION AcpiReallocateRootTable ( void  )

Definition at line 183 of file tbxface.c.

185{
187 ACPI_TABLE_DESC *TableDesc;
188 UINT32 i, j;
189
190
192
193
194 /*
195 * If there are tables unverified, it is required to reallocate the
196 * root table list to clean up invalid table entries. Otherwise only
197 * reallocate the root table list if the host provided a static buffer
198 * for the table array in the call to AcpiInitializeTables().
199 */
200 if ((AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) &&
201 AcpiGbl_EnableTableValidation)
202 {
204 }
205
207
208 /*
209 * Ensure OS early boot logic, which is required by some hosts. If the
210 * table state is reported to be wrong, developers should fix the
211 * issue by invoking AcpiPutTable() for the reported table during the
212 * early stage.
213 */
214 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
215 {
216 TableDesc = &AcpiGbl_RootTableList.Tables[i];
217 if (TableDesc->Pointer)
218 {
220 "Table [%4.4s] is not invalidated during early boot stage",
221 TableDesc->Signature.Ascii));
222 }
223 }
224
225 if (!AcpiGbl_EnableTableValidation)
226 {
227 /*
228 * Now it's safe to do full table validation. We can do deferred
229 * table initialization here once the flag is set.
230 */
231 AcpiGbl_EnableTableValidation = TRUE;
232 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
233 {
234 TableDesc = &AcpiGbl_RootTableList.Tables[i];
235 if (!(TableDesc->Flags & ACPI_TABLE_IS_VERIFIED))
236 {
237 Status = AcpiTbVerifyTempTable (TableDesc, NULL, &j);
238 if (ACPI_FAILURE (Status))
239 {
240 AcpiTbUninstallTable (TableDesc);
241 }
242 }
243 }
244 }
245
246 AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ALLOW_RESIZE;
248 AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ORIGIN_ALLOCATED;
249
252}
#define AE_SUPPORT
Definition: acexcep.h:123
#define ACPI_ROOT_ORIGIN_ALLOCATED
Definition: aclocal.h:244
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
void AcpiTbUninstallTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbinstal.c:336
ACPI_STATUS AcpiTbVerifyTempTable(ACPI_TABLE_DESC *TableDesc, char *Signature, UINT32 *TableIndex)
Definition: tbdata.c:584
#define ACPI_TABLE_IS_VERIFIED
Definition: actbl.h:433
#define TRUE
Definition: types.h:120
ACPI_STATUS ACPI_INIT_FUNCTION AcpiReallocateRootTable(void)
Definition: tbxface.c:183
char Ascii[4]
Definition: actbl.h:394

Referenced by AcpiReallocateRootTable().

◆ AcpiRemoveTableHandler()

ACPI_STATUS AcpiRemoveTableHandler ( ACPI_TABLE_HANDLER  Handler)

Definition at line 606 of file tbxface.c.

608{
610
611
613
614
616 if (ACPI_FAILURE (Status))
617 {
619 }
620
621 /* Make sure that the installed handler is the same */
622
623 if (!Handler ||
624 Handler != AcpiGbl_TableHandler)
625 {
627 goto Cleanup;
628 }
629
630 /* Remove the handler */
631
632 AcpiGbl_TableHandler = NULL;
633
634Cleanup:
637}
ACPI_STATUS AcpiRemoveTableHandler(ACPI_TABLE_HANDLER Handler)
Definition: tbxface.c:606

Referenced by AcpiRemoveTableHandler().