ReactOS 0.4.15-dev-7887-g64a59a1
tbdata.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "actables.h"
#include "acevents.h"
Include dependency graph for tbdata.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_TABLES
 

Functions

static ACPI_STATUS AcpiTbCheckDuplication (ACPI_TABLE_DESC *TableDesc, UINT32 *TableIndex)
 
static BOOLEAN AcpiTbCompareTables (ACPI_TABLE_DESC *TableDesc, UINT32 TableIndex)
 
void AcpiTbInitTableDescriptor (ACPI_TABLE_DESC *TableDesc, ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table)
 
ACPI_STATUS AcpiTbAcquireTable (ACPI_TABLE_DESC *TableDesc, ACPI_TABLE_HEADER **TablePtr, UINT32 *TableLength, UINT8 *TableFlags)
 
void AcpiTbReleaseTable (ACPI_TABLE_HEADER *Table, UINT32 TableLength, UINT8 TableFlags)
 
ACPI_STATUS AcpiTbAcquireTempTable (ACPI_TABLE_DESC *TableDesc, ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table)
 
void AcpiTbReleaseTempTable (ACPI_TABLE_DESC *TableDesc)
 
ACPI_STATUS AcpiTbValidateTable (ACPI_TABLE_DESC *TableDesc)
 
void AcpiTbInvalidateTable (ACPI_TABLE_DESC *TableDesc)
 
ACPI_STATUS AcpiTbValidateTempTable (ACPI_TABLE_DESC *TableDesc)
 
ACPI_STATUS AcpiTbVerifyTempTable (ACPI_TABLE_DESC *TableDesc, char *Signature, UINT32 *TableIndex)
 
ACPI_STATUS AcpiTbResizeRootTableList (void)
 
ACPI_STATUS AcpiTbGetNextTableDescriptor (UINT32 *TableIndex, ACPI_TABLE_DESC **TableDesc)
 
void AcpiTbTerminate (void)
 
ACPI_STATUS AcpiTbDeleteNamespaceByOwner (UINT32 TableIndex)
 
ACPI_STATUS AcpiTbAllocateOwnerId (UINT32 TableIndex)
 
ACPI_STATUS AcpiTbReleaseOwnerId (UINT32 TableIndex)
 
ACPI_STATUS AcpiTbGetOwnerId (UINT32 TableIndex, ACPI_OWNER_ID *OwnerId)
 
BOOLEAN AcpiTbIsTableLoaded (UINT32 TableIndex)
 
void AcpiTbSetTableLoadedFlag (UINT32 TableIndex, BOOLEAN IsLoaded)
 
ACPI_STATUS AcpiTbLoadTable (UINT32 TableIndex, ACPI_NAMESPACE_NODE *ParentNode)
 
ACPI_STATUS AcpiTbInstallAndLoadTable (ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table, BOOLEAN Override, UINT32 *TableIndex)
 
ACPI_STATUS AcpiTbUnloadTable (UINT32 TableIndex)
 
void AcpiTbNotifyTable (UINT32 Event, void *Table)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_TABLES

Definition at line 50 of file tbdata.c.

Function Documentation

◆ AcpiTbAcquireTable()

ACPI_STATUS AcpiTbAcquireTable ( ACPI_TABLE_DESC TableDesc,
ACPI_TABLE_HEADER **  TablePtr,
UINT32 TableLength,
UINT8 TableFlags 
)

Definition at line 180 of file tbdata.c.

185{
187
188
189 switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
190 {
192
193 Table = AcpiOsMapMemory (TableDesc->Address, TableDesc->Length);
194 break;
195
198
199 Table = TableDesc->Pointer;
200 break;
201
202 default:
203
204 break;
205 }
206
207 /* Table is not valid yet */
208
209 if (!Table)
210 {
211 return (AE_NO_MEMORY);
212 }
213
214 /* Fill the return values */
215
216 *TablePtr = Table;
217 *TableLength = TableDesc->Length;
218 *TableFlags = TableDesc->Flags;
219 return (AE_OK);
220}
#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
#define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL
Definition: actbl.h:431
#define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL
Definition: actbl.h:429
#define ACPI_TABLE_ORIGIN_MASK
Definition: actbl.h:432
#define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL
Definition: actbl.h:430
#define NULL
Definition: types.h:112
ASMGENDATA Table[]
Definition: genincdata.c:61
UINT8 Flags
Definition: actbl.h:408
ACPI_PHYSICAL_ADDRESS Address
Definition: actbl.h:403
UINT32 Length
Definition: actbl.h:405
ACPI_TABLE_HEADER * Pointer
Definition: actbl.h:404

Referenced by AcpiTbCompareTables(), and AcpiTbValidateTable().

◆ AcpiTbAcquireTempTable()

ACPI_STATUS AcpiTbAcquireTempTable ( ACPI_TABLE_DESC TableDesc,
ACPI_PHYSICAL_ADDRESS  Address,
UINT8  Flags,
ACPI_TABLE_HEADER Table 
)

Definition at line 280 of file tbdata.c.

285{
286 BOOLEAN MappedTable = FALSE;
287
288
290 {
292
293 /* Get the length of the full table from the header */
294
295 if (!Table)
296 {
298 if (!Table)
299 {
300 return (AE_NO_MEMORY);
301 }
302
303 MappedTable = TRUE;
304 }
305
306 break;
307
310
311 if (!Table)
312 {
313 return (AE_BAD_PARAMETER);
314 }
315
316 break;
317
318 default:
319
320 /* Table is not valid yet */
321
322 return (AE_NO_MEMORY);
323 }
324
326 if (MappedTable)
327 {
329 }
330
331 return (AE_OK);
332}
unsigned char BOOLEAN
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
void AcpiOsUnmapMemory(void *LogicalAddress, ACPI_SIZE Size)
Definition: osl.c:128
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static WCHAR Address[46]
Definition: ping.c:68
void AcpiTbInitTableDescriptor(ACPI_TABLE_DESC *TableDesc, ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table)
Definition: tbdata.c:130
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by AcpiTbInstallStandardTable(), and AcpiTbOverrideTable().

◆ AcpiTbAllocateOwnerId()

ACPI_STATUS AcpiTbAllocateOwnerId ( UINT32  TableIndex)

Definition at line 923 of file tbdata.c.

925{
927
928
929 ACPI_FUNCTION_TRACE (TbAllocateOwnerId);
930
931
933 if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
934 {
936 &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
937 }
938
941}
#define ACPI_MTX_TABLES
Definition: aclocal.h:86
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiUtAllocateOwnerId(ACPI_OWNER_ID *OwnerId)
Definition: utownerid.c:68
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
Status
Definition: gdiplustypes.h:25

Referenced by AcpiNsLoadTable().

◆ AcpiTbCheckDuplication()

static ACPI_STATUS AcpiTbCheckDuplication ( ACPI_TABLE_DESC TableDesc,
UINT32 TableIndex 
)
static

Definition at line 502 of file tbdata.c.

505{
506 UINT32 i;
507
508
509 ACPI_FUNCTION_TRACE (TbCheckDuplication);
510
511
512 /* Check if table is already registered */
513
514 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
515 {
516 /* Do not compare with unverified tables */
517
518 if (!(AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_IS_VERIFIED))
519 {
520 continue;
521 }
522
523 /*
524 * Check for a table match on the entire table length,
525 * not just the header.
526 */
527 if (!AcpiTbCompareTables (TableDesc, i))
528 {
529 continue;
530 }
531
532 /*
533 * Note: the current mechanism does not unregister a table if it is
534 * dynamically unloaded. The related namespace entries are deleted,
535 * but the table remains in the root table list.
536 *
537 * The assumption here is that the number of different tables that
538 * will be loaded is actually small, and there is minimal overhead
539 * in just keeping the table in case it is needed again.
540 *
541 * If this assumption changes in the future (perhaps on large
542 * machines with many table load/unload operations), tables will
543 * need to be unregistered when they are unloaded, and slots in the
544 * root table list should be reused when empty.
545 */
546 if (AcpiGbl_RootTableList.Tables[i].Flags &
548 {
549 /* Table is still loaded, this is an error */
550
552 }
553 else
554 {
555 *TableIndex = i;
557 }
558 }
559
560 /* Indicate no duplication to the caller */
561
563}
unsigned int UINT32
#define AE_ALREADY_EXISTS
Definition: acexcep.h:115
#define AE_CTRL_TERMINATE
Definition: acexcep.h:226
#define ACPI_TABLE_IS_VERIFIED
Definition: actbl.h:433
#define ACPI_TABLE_IS_LOADED
Definition: actbl.h:434
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
static BOOLEAN AcpiTbCompareTables(ACPI_TABLE_DESC *TableDesc, UINT32 TableIndex)
Definition: tbdata.c:81

Referenced by AcpiTbVerifyTempTable().

◆ AcpiTbCompareTables()

static BOOLEAN AcpiTbCompareTables ( ACPI_TABLE_DESC TableDesc,
UINT32  TableIndex 
)
static

Definition at line 81 of file tbdata.c.

84{
86 BOOLEAN IsIdentical;
88 UINT32 TableLength;
89 UINT8 TableFlags;
90
91
92 Status = AcpiTbAcquireTable (&AcpiGbl_RootTableList.Tables[TableIndex],
93 &Table, &TableLength, &TableFlags);
94 if (ACPI_FAILURE (Status))
95 {
96 return (FALSE);
97 }
98
99 /*
100 * Check for a table match on the entire table length,
101 * not just the header.
102 */
103 IsIdentical = (BOOLEAN)((TableDesc->Length != TableLength ||
104 memcmp (TableDesc->Pointer, Table, TableLength)) ?
105 FALSE : TRUE);
106
107 /* Release the acquired table */
108
109 AcpiTbReleaseTable (Table, TableLength, TableFlags);
110 return (IsIdentical);
111}
unsigned char UINT8
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define BOOLEAN
Definition: pedump.c:73
void AcpiTbReleaseTable(ACPI_TABLE_HEADER *Table, UINT32 TableLength, UINT8 TableFlags)
Definition: tbdata.c:238
ACPI_STATUS AcpiTbAcquireTable(ACPI_TABLE_DESC *TableDesc, ACPI_TABLE_HEADER **TablePtr, UINT32 *TableLength, UINT8 *TableFlags)
Definition: tbdata.c:180

Referenced by AcpiTbCheckDuplication().

◆ AcpiTbDeleteNamespaceByOwner()

ACPI_STATUS AcpiTbDeleteNamespaceByOwner ( UINT32  TableIndex)

Definition at line 862 of file tbdata.c.

864{
867
868
869 ACPI_FUNCTION_TRACE (TbDeleteNamespaceByOwner);
870
871
873 if (ACPI_FAILURE (Status))
874 {
876 }
877
878 if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount)
879 {
880 /* The table index does not exist */
881
884 }
885
886 /* Get the owner ID for this table, used to delete namespace nodes */
887
888 OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
890
891 /*
892 * Need to acquire the namespace writer lock to prevent interference
893 * with any concurrent namespace walks. The interpreter must be
894 * released during the deletion since the acquisition of the deletion
895 * lock may block, and also since the execution of a namespace walk
896 * must be allowed to use the interpreter.
897 */
898 Status = AcpiUtAcquireWriteLock (&AcpiGbl_NamespaceRwLock);
899 if (ACPI_FAILURE (Status))
900 {
902 }
903
905 AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock);
907}
#define AE_NOT_EXIST
Definition: acexcep.h:114
void AcpiNsDeleteNamespaceByOwner(ACPI_OWNER_ID OwnerId)
Definition: nsalloc.c:497
UINT16 ACPI_OWNER_ID
Definition: actypes.h:486
void AcpiUtReleaseWriteLock(ACPI_RW_LOCK *Lock)
Definition: utlock.c:197
ACPI_STATUS AcpiUtAcquireWriteLock(ACPI_RW_LOCK *Lock)
Definition: utlock.c:185
_Must_inspect_result_ _In_opt_ PVOID OwnerId
Definition: fsrtlfuncs.h:907

Referenced by AcpiTbUnloadTable().

◆ AcpiTbGetNextTableDescriptor()

ACPI_STATUS AcpiTbGetNextTableDescriptor ( UINT32 TableIndex,
ACPI_TABLE_DESC **  TableDesc 
)

Definition at line 762 of file tbdata.c.

765{
767 UINT32 i;
768
769
770 /* Ensure that there is room for the table in the Root Table List */
771
772 if (AcpiGbl_RootTableList.CurrentTableCount >=
773 AcpiGbl_RootTableList.MaxTableCount)
774 {
776 if (ACPI_FAILURE (Status))
777 {
778 return (Status);
779 }
780 }
781
782 i = AcpiGbl_RootTableList.CurrentTableCount;
783 AcpiGbl_RootTableList.CurrentTableCount++;
784
785 if (TableIndex)
786 {
787 *TableIndex = i;
788 }
789 if (TableDesc)
790 {
791 *TableDesc = &AcpiGbl_RootTableList.Tables[i];
792 }
793
794 return (AE_OK);
795}
ACPI_STATUS AcpiTbResizeRootTableList(void)
Definition: tbdata.c:677

Referenced by AcpiTbInstallTableWithOverride().

◆ AcpiTbGetOwnerId()

ACPI_STATUS AcpiTbGetOwnerId ( UINT32  TableIndex,
ACPI_OWNER_ID OwnerId 
)

Definition at line 993 of file tbdata.c.

996{
998
999
1000 ACPI_FUNCTION_TRACE (TbGetOwnerId);
1001
1002
1004 if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
1005 {
1006 *OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
1007 Status = AE_OK;
1008 }
1009
1012}

Referenced by AcpiDsInitializeObjects(), AcpiNsExecuteTable(), AcpiNsOneCompleteParse(), and AcpiTbLoadTable().

◆ AcpiTbInitTableDescriptor()

void AcpiTbInitTableDescriptor ( ACPI_TABLE_DESC TableDesc,
ACPI_PHYSICAL_ADDRESS  Address,
UINT8  Flags,
ACPI_TABLE_HEADER Table 
)

Definition at line 130 of file tbdata.c.

135{
136
137 /*
138 * Initialize the table descriptor. Set the pointer to NULL for external
139 * tables, since the table is not fully mapped at this time.
140 */
141 memset (TableDesc, 0, sizeof (ACPI_TABLE_DESC));
142 TableDesc->Address = Address;
143 TableDesc->Length = Table->Length;
144 TableDesc->Flags = Flags;
145 ACPI_MOVE_32_TO_32 (TableDesc->Signature.Ascii, Table->Signature);
146
147 switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
148 {
151
152 TableDesc->Pointer = Table;
153 break;
154
156 default:
157
158 break;
159 }
160}
#define ACPI_MOVE_32_TO_32(d, s)
Definition: acmacros.h:148
#define memset(x, y, z)
Definition: compat.h:39
ACPI_NAME_UNION Signature
Definition: actbl.h:406
char Ascii[4]
Definition: actbl.h:394

Referenced by AcpiTbAcquireTempTable(), AcpiTbCopyDsdt(), AcpiTbInstallTableWithOverride(), and AcpiTbOverrideTable().

◆ AcpiTbInstallAndLoadTable()

ACPI_STATUS AcpiTbInstallAndLoadTable ( ACPI_PHYSICAL_ADDRESS  Address,
UINT8  Flags,
ACPI_TABLE_HEADER Table,
BOOLEAN  Override,
UINT32 TableIndex 
)

Definition at line 1162 of file tbdata.c.

1168{
1170 UINT32 i;
1171
1172
1173 ACPI_FUNCTION_TRACE (TbInstallAndLoadTable);
1174
1175
1176 /* Install the table and load it into the namespace */
1177
1179 Override, &i);
1180 if (ACPI_FAILURE (Status))
1181 {
1182 goto Exit;
1183 }
1184
1185 Status = AcpiTbLoadTable (i, AcpiGbl_RootNode);
1186
1187Exit:
1188 *TableIndex = i;
1190}
ACPI_STATUS AcpiTbInstallStandardTable(ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table, BOOLEAN Reload, BOOLEAN Override, UINT32 *TableIndex)
Definition: tbinstal.c:139
static void Exit(void)
Definition: sock.c:1330
ACPI_STATUS AcpiTbLoadTable(UINT32 TableIndex, ACPI_NAMESPACE_NODE *ParentNode)
Definition: tbdata.c:1097

Referenced by AcpiExLoadOp(), and AcpiLoadTable().

◆ AcpiTbInvalidateTable()

void AcpiTbInvalidateTable ( ACPI_TABLE_DESC TableDesc)

Definition at line 414 of file tbdata.c.

416{
417
418 ACPI_FUNCTION_TRACE (TbInvalidateTable);
419
420
421 /* Table must be validated */
422
423 if (!TableDesc->Pointer)
424 {
426 }
427
428 AcpiTbReleaseTable (TableDesc->Pointer, TableDesc->Length,
429 TableDesc->Flags);
430
431 switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
432 {
434
435 TableDesc->Pointer = NULL;
436 break;
437
440 default:
441
442 break;
443 }
444
446}
#define return_VOID
Definition: acoutput.h:495

Referenced by AcpiTbPutTable(), AcpiTbReleaseTempTable(), AcpiTbUninstallTable(), and AcpiTbVerifyTempTable().

◆ AcpiTbIsTableLoaded()

BOOLEAN AcpiTbIsTableLoaded ( UINT32  TableIndex)

Definition at line 1026 of file tbdata.c.

1028{
1029 BOOLEAN IsLoaded = FALSE;
1030
1031
1033 if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
1034 {
1035 IsLoaded = (BOOLEAN)
1036 (AcpiGbl_RootTableList.Tables[TableIndex].Flags &
1038 }
1039
1041 return (IsLoaded);
1042}

Referenced by AcpiNsLoadTable(), and AcpiTbUnloadTable().

◆ AcpiTbLoadTable()

ACPI_STATUS AcpiTbLoadTable ( UINT32  TableIndex,
ACPI_NAMESPACE_NODE ParentNode 
)

Definition at line 1097 of file tbdata.c.

1100{
1104
1105
1106 ACPI_FUNCTION_TRACE (TbLoadTable);
1107
1108
1109 /*
1110 * Note: Now table is "INSTALLED", it must be validated before
1111 * using.
1112 */
1113 Status = AcpiGetTableByIndex (TableIndex, &Table);
1114 if (ACPI_FAILURE (Status))
1115 {
1117 }
1118
1119 Status = AcpiNsLoadTable (TableIndex, ParentNode);
1120 if (ACPI_FAILURE (Status))
1121 {
1123 }
1124
1125 /*
1126 * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
1127 * responsible for discovering any new wake GPEs by running _PRW methods
1128 * that may have been loaded by this table.
1129 */
1130 Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
1131 if (ACPI_SUCCESS (Status))
1132 {
1134 }
1135
1136 /* Invoke table handler */
1137
1140}
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
ACPI_STATUS AcpiNsLoadTable(UINT32 TableIndex, ACPI_NAMESPACE_NODE *Node)
Definition: nsload.c:82
#define ACPI_TABLE_EVENT_LOAD
Definition: actypes.h:1193
void AcpiEvUpdateGpes(ACPI_OWNER_ID TableOwnerId)
Definition: evgpeinit.c:233
ACPI_STATUS AcpiTbGetOwnerId(UINT32 TableIndex, ACPI_OWNER_ID *OwnerId)
Definition: tbdata.c:993
void AcpiTbNotifyTable(UINT32 Event, void *Table)
Definition: tbdata.c:1259
ACPI_STATUS AcpiGetTableByIndex(UINT32 TableIndex, ACPI_TABLE_HEADER **OutTable)
Definition: tbxface.c:491

Referenced by AcpiExLoadTableOp(), and AcpiTbInstallAndLoadTable().

◆ AcpiTbNotifyTable()

void AcpiTbNotifyTable ( UINT32  Event,
void Table 
)

Definition at line 1259 of file tbdata.c.

1262{
1263 /* Invoke table handler if present */
1264
1265 if (AcpiGbl_TableHandler)
1266 {
1267 (void) AcpiGbl_TableHandler (Event, Table,
1268 AcpiGbl_TableHandlerContext);
1269 }
1270}

Referenced by AcpiTbInstallStandardTable(), AcpiTbLoadTable(), and AcpiTbUnloadTable().

◆ AcpiTbReleaseOwnerId()

ACPI_STATUS AcpiTbReleaseOwnerId ( UINT32  TableIndex)

Definition at line 957 of file tbdata.c.

959{
961
962
963 ACPI_FUNCTION_TRACE (TbReleaseOwnerId);
964
965
967 if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
968 {
970 &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
971 Status = AE_OK;
972 }
973
976}
void AcpiUtReleaseOwnerId(ACPI_OWNER_ID *OwnerId)
Definition: utownerid.c:190

Referenced by AcpiNsLoadTable(), and AcpiTbUnloadTable().

◆ AcpiTbReleaseTable()

void AcpiTbReleaseTable ( ACPI_TABLE_HEADER Table,
UINT32  TableLength,
UINT8  TableFlags 
)

Definition at line 238 of file tbdata.c.

242{
243
244 switch (TableFlags & ACPI_TABLE_ORIGIN_MASK)
245 {
247
248 AcpiOsUnmapMemory (Table, TableLength);
249 break;
250
253 default:
254
255 break;
256 }
257}

Referenced by AcpiTbCompareTables(), and AcpiTbInvalidateTable().

◆ AcpiTbReleaseTempTable()

void AcpiTbReleaseTempTable ( ACPI_TABLE_DESC TableDesc)

Definition at line 348 of file tbdata.c.

350{
351
352 /*
353 * Note that the .Address is maintained by the callers of
354 * AcpiTbAcquireTempTable(), thus do not invoke AcpiTbUninstallTable()
355 * where .Address will be freed.
356 */
357 AcpiTbInvalidateTable (TableDesc);
358}
void AcpiTbInvalidateTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbdata.c:414

Referenced by AcpiTbInstallStandardTable(), and AcpiTbOverrideTable().

◆ AcpiTbResizeRootTableList()

ACPI_STATUS AcpiTbResizeRootTableList ( void  )

Definition at line 677 of file tbdata.c.

679{
680 ACPI_TABLE_DESC *Tables;
681 UINT32 TableCount;
682 UINT32 CurrentTableCount, MaxTableCount;
683 UINT32 i;
684
685
686 ACPI_FUNCTION_TRACE (TbResizeRootTableList);
687
688
689 /* AllowResize flag is a parameter to AcpiInitializeTables */
690
691 if (!(AcpiGbl_RootTableList.Flags & ACPI_ROOT_ALLOW_RESIZE))
692 {
693 ACPI_ERROR ((AE_INFO, "Resize of Root Table Array is not allowed"));
695 }
696
697 /* Increase the Table Array size */
698
699 if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
700 {
701 TableCount = AcpiGbl_RootTableList.MaxTableCount;
702 }
703 else
704 {
705 TableCount = AcpiGbl_RootTableList.CurrentTableCount;
706 }
707
708 MaxTableCount = TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT;
709 Tables = ACPI_ALLOCATE_ZEROED (
710 ((ACPI_SIZE) MaxTableCount) * sizeof (ACPI_TABLE_DESC));
711 if (!Tables)
712 {
713 ACPI_ERROR ((AE_INFO, "Could not allocate new root table array"));
715 }
716
717 /* Copy and free the previous table array */
718
719 CurrentTableCount = 0;
720 if (AcpiGbl_RootTableList.Tables)
721 {
722 for (i = 0; i < TableCount; i++)
723 {
724 if (AcpiGbl_RootTableList.Tables[i].Address)
725 {
726 memcpy (Tables + CurrentTableCount,
727 AcpiGbl_RootTableList.Tables + i,
729 CurrentTableCount++;
730 }
731 }
732
733 if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
734 {
735 ACPI_FREE (AcpiGbl_RootTableList.Tables);
736 }
737 }
738
739 AcpiGbl_RootTableList.Tables = Tables;
740 AcpiGbl_RootTableList.MaxTableCount = MaxTableCount;
741 AcpiGbl_RootTableList.CurrentTableCount = CurrentTableCount;
742 AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ORIGIN_ALLOCATED;
743
745}
#define AE_SUPPORT
Definition: acexcep.h:123
#define ACPI_ROOT_ORIGIN_ALLOCATED
Definition: aclocal.h:244
#define ACPI_ROOT_ALLOW_RESIZE
Definition: aclocal.h:245
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define ACPI_ROOT_TABLE_SIZE_INCREMENT
Definition: acconfig.h:140
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

Referenced by AcpiAllocateRootTable(), AcpiReallocateRootTable(), and AcpiTbGetNextTableDescriptor().

◆ AcpiTbSetTableLoadedFlag()

void AcpiTbSetTableLoadedFlag ( UINT32  TableIndex,
BOOLEAN  IsLoaded 
)

Definition at line 1059 of file tbdata.c.

1062{
1063
1065 if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
1066 {
1067 if (IsLoaded)
1068 {
1069 AcpiGbl_RootTableList.Tables[TableIndex].Flags |=
1071 }
1072 else
1073 {
1074 AcpiGbl_RootTableList.Tables[TableIndex].Flags &=
1075 ~ACPI_TABLE_IS_LOADED;
1076 }
1077 }
1078
1080}

Referenced by AcpiNsLoadTable(), and AcpiTbUnloadTable().

◆ AcpiTbTerminate()

void AcpiTbTerminate ( void  )

Definition at line 811 of file tbdata.c.

813{
814 UINT32 i;
815
816
817 ACPI_FUNCTION_TRACE (TbTerminate);
818
819
821
822 /* Delete the individual tables */
823
824 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
825 {
826 AcpiTbUninstallTable (&AcpiGbl_RootTableList.Tables[i]);
827 }
828
829 /*
830 * Delete the root table array if allocated locally. Array cannot be
831 * mapped, so we don't need to check for that flag.
832 */
833 if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
834 {
835 ACPI_FREE (AcpiGbl_RootTableList.Tables);
836 }
837
838 AcpiGbl_RootTableList.Tables = NULL;
839 AcpiGbl_RootTableList.Flags = 0;
840 AcpiGbl_RootTableList.CurrentTableCount = 0;
841
842 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
843
846}
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_DB_INFO
Definition: acoutput.h:153
void AcpiTbUninstallTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbinstal.c:336

Referenced by AcpiUtSubsystemShutdown().

◆ AcpiTbUnloadTable()

ACPI_STATUS AcpiTbUnloadTable ( UINT32  TableIndex)

Definition at line 1206 of file tbdata.c.

1208{
1211
1212
1213 ACPI_FUNCTION_TRACE (TbUnloadTable);
1214
1215
1216 /* Ensure the table is still loaded */
1217
1218 if (!AcpiTbIsTableLoaded (TableIndex))
1219 {
1221 }
1222
1223 /* Invoke table handler */
1224
1225 Status = AcpiGetTableByIndex (TableIndex, &Table);
1226 if (ACPI_SUCCESS (Status))
1227 {
1229 }
1230
1231 /* Delete the portion of the namespace owned by this table */
1232
1233 Status = AcpiTbDeleteNamespaceByOwner (TableIndex);
1234 if (ACPI_FAILURE (Status))
1235 {
1237 }
1238
1239 (void) AcpiTbReleaseOwnerId (TableIndex);
1240 AcpiTbSetTableLoadedFlag (TableIndex, FALSE);
1242}
#define ACPI_TABLE_EVENT_UNLOAD
Definition: actypes.h:1194
void AcpiTbSetTableLoadedFlag(UINT32 TableIndex, BOOLEAN IsLoaded)
Definition: tbdata.c:1059
BOOLEAN AcpiTbIsTableLoaded(UINT32 TableIndex)
Definition: tbdata.c:1026
ACPI_STATUS AcpiTbReleaseOwnerId(UINT32 TableIndex)
Definition: tbdata.c:957
ACPI_STATUS AcpiTbDeleteNamespaceByOwner(UINT32 TableIndex)
Definition: tbdata.c:862

Referenced by AcpiExUnloadTable(), AcpiUnloadParentTable(), and AcpiUnloadTable().

◆ AcpiTbValidateTable()

ACPI_STATUS AcpiTbValidateTable ( ACPI_TABLE_DESC TableDesc)

Definition at line 375 of file tbdata.c.

377{
379
380
381 ACPI_FUNCTION_TRACE (TbValidateTable);
382
383
384 /* Validate the table if necessary */
385
386 if (!TableDesc->Pointer)
387 {
388 Status = AcpiTbAcquireTable (TableDesc, &TableDesc->Pointer,
389 &TableDesc->Length, &TableDesc->Flags);
390 if (!TableDesc->Pointer)
391 {
393 }
394 }
395
397}

Referenced by AcpiTbFindTable(), AcpiTbGetTable(), AcpiTbLoadNamespace(), and AcpiTbValidateTempTable().

◆ AcpiTbValidateTempTable()

ACPI_STATUS AcpiTbValidateTempTable ( ACPI_TABLE_DESC TableDesc)

Definition at line 463 of file tbdata.c.

465{
466
467 if (!TableDesc->Pointer && !AcpiGbl_EnableTableValidation)
468 {
469 /*
470 * Only validates the header of the table.
471 * Note that Length contains the size of the mapping after invoking
472 * this work around, this value is required by
473 * AcpiTbReleaseTempTable().
474 * We can do this because in AcpiInitTableDescriptor(), the Length
475 * field of the installed descriptor is filled with the actual
476 * table length obtaining from the table header.
477 */
478 TableDesc->Length = sizeof (ACPI_TABLE_HEADER);
479 }
480
481 return (AcpiTbValidateTable (TableDesc));
482}
struct acpi_table_header ACPI_TABLE_HEADER
ACPI_STATUS AcpiTbValidateTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbdata.c:375

Referenced by AcpiTbOverrideTable(), and AcpiTbVerifyTempTable().

◆ AcpiTbVerifyTempTable()

ACPI_STATUS AcpiTbVerifyTempTable ( ACPI_TABLE_DESC TableDesc,
char Signature,
UINT32 TableIndex 
)

Definition at line 584 of file tbdata.c.

588{
590
591
592 ACPI_FUNCTION_TRACE (TbVerifyTempTable);
593
594
595 /* Validate the table */
596
597 Status = AcpiTbValidateTempTable (TableDesc);
598 if (ACPI_FAILURE (Status))
599 {
601 }
602
603 /* If a particular signature is expected (DSDT/FACS), it must match */
604
605 if (Signature &&
607 {
609 "Invalid signature 0x%X for ACPI table, expected [%s]",
610 TableDesc->Signature.Integer, Signature));
612 goto InvalidateAndExit;
613 }
614
615 if (AcpiGbl_EnableTableValidation)
616 {
617 /* Verify the checksum */
618
619 Status = AcpiUtVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
620 if (ACPI_FAILURE (Status))
621 {
623 "%4.4s 0x%8.8X%8.8X"
624 " Attempted table install failed",
625 AcpiUtValidNameseg (TableDesc->Signature.Ascii) ?
626 TableDesc->Signature.Ascii : "????",
627 ACPI_FORMAT_UINT64 (TableDesc->Address)));
628
629 goto InvalidateAndExit;
630 }
631
632 /* Avoid duplications */
633
634 if (TableIndex)
635 {
636 Status = AcpiTbCheckDuplication (TableDesc, TableIndex);
637 if (ACPI_FAILURE (Status))
638 {
640 {
642 "%4.4s 0x%8.8X%8.8X"
643 " Table is already loaded",
644 AcpiUtValidNameseg (TableDesc->Signature.Ascii) ?
645 TableDesc->Signature.Ascii : "????",
646 ACPI_FORMAT_UINT64 (TableDesc->Address)));
647 }
648
649 goto InvalidateAndExit;
650 }
651 }
652
653 TableDesc->Flags |= ACPI_TABLE_IS_VERIFIED;
654 }
655
657
658InvalidateAndExit:
659 AcpiTbInvalidateTable (TableDesc);
661}
#define AE_BAD_SIGNATURE
Definition: acexcep.h:167
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define ACPI_BIOS_ERROR(plist)
Definition: acoutput.h:243
#define ACPI_COMPARE_NAMESEG(a, b)
Definition: actypes.h:564
ACPI_STATUS AcpiUtVerifyChecksum(ACPI_TABLE_HEADER *Table, UINT32 Length)
Definition: utcksum.c:74
BOOLEAN AcpiUtValidNameseg(char *Signature)
Definition: utascii.c:63
static const WCHAR Signature[]
Definition: parser.c:141
static ACPI_STATUS AcpiTbCheckDuplication(ACPI_TABLE_DESC *TableDesc, UINT32 *TableIndex)
Definition: tbdata.c:502
ACPI_STATUS AcpiTbValidateTempTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbdata.c:463
UINT32 Integer
Definition: actbl.h:393

Referenced by AcpiReallocateRootTable(), AcpiTbInstallStandardTable(), and AcpiTbOverrideTable().