ReactOS 0.4.15-dev-5669-g09dde2c
tbinstal.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "actables.h"
Include dependency graph for tbinstal.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_TABLES
 

Functions

void AcpiTbInstallTableWithOverride (ACPI_TABLE_DESC *NewTableDesc, BOOLEAN Override, UINT32 *TableIndex)
 
ACPI_STATUS AcpiTbInstallStandardTable (ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table, BOOLEAN Reload, BOOLEAN Override, UINT32 *TableIndex)
 
void AcpiTbOverrideTable (ACPI_TABLE_DESC *OldTableDesc)
 
void AcpiTbUninstallTable (ACPI_TABLE_DESC *TableDesc)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_TABLES

Definition at line 48 of file tbinstal.c.

Function Documentation

◆ AcpiTbInstallStandardTable()

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

Definition at line 139 of file tbinstal.c.

146{
147 UINT32 i;
149 ACPI_TABLE_DESC NewTableDesc;
150
151
152 ACPI_FUNCTION_TRACE (TbInstallStandardTable);
153
154
155 /* Acquire a temporary table descriptor for validation */
156
157 Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, Flags, Table);
158 if (ACPI_FAILURE (Status))
159 {
161 "Could not acquire table length at %8.8X%8.8X",
164 }
165
166 /*
167 * Optionally do not load any SSDTs from the RSDT/XSDT. This can
168 * be useful for debugging ACPI problems on some machines.
169 */
170 if (!Reload &&
171 AcpiGbl_DisableSsdtTableInstall &&
173 {
174 ACPI_INFO ((
175 "Ignoring installation of %4.4s at %8.8X%8.8X",
176 NewTableDesc.Signature.Ascii, ACPI_FORMAT_UINT64 (Address)));
177 goto ReleaseAndExit;
178 }
179
180 /* Acquire the table lock */
181
183
184 /* Validate and verify a table before installation */
185
186 Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL, &i);
187 if (ACPI_FAILURE (Status))
188 {
190 {
191 /*
192 * Table was unloaded, allow it to be reloaded.
193 * As we are going to return AE_OK to the caller, we should
194 * take the responsibility of freeing the input descriptor.
195 * Refill the input descriptor to ensure
196 * AcpiTbInstallTableWithOverride() can be called again to
197 * indicate the re-installation.
198 */
199 AcpiTbUninstallTable (&NewTableDesc);
201 *TableIndex = i;
203 }
204 goto UnlockAndExit;
205 }
206
207 /* Add the table to the global root table list */
208
209 AcpiTbInstallTableWithOverride (&NewTableDesc, Override, TableIndex);
210
211 /* Invoke table handler */
212
216
217UnlockAndExit:
218
219 /* Release the table lock */
220
222
223ReleaseAndExit:
224
225 /* Release the temporary table descriptor */
226
227 AcpiTbReleaseTempTable (&NewTableDesc);
229}
unsigned int UINT32
#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_MTX_TABLES
Definition: aclocal.h:86
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_INFO(plist)
Definition: acoutput.h:237
void AcpiTbReleaseTempTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbdata.c:348
ACPI_STATUS AcpiTbAcquireTempTable(ACPI_TABLE_DESC *TableDesc, ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table)
Definition: tbdata.c:280
ACPI_STATUS AcpiTbVerifyTempTable(ACPI_TABLE_DESC *TableDesc, char *Signature, UINT32 *TableIndex)
Definition: tbdata.c:584
void AcpiTbNotifyTable(UINT32 Event, void *Table)
Definition: tbdata.c:1259
#define ACPI_SIG_SSDT
Definition: actbl.h:75
#define ACPI_COMPARE_NAMESEG(a, b)
Definition: actypes.h:564
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_TABLE_EVENT_INSTALL
Definition: actypes.h:1195
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
Status
Definition: gdiplustypes.h:25
ASMGENDATA Table[]
Definition: genincdata.c:61
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 WCHAR Address[46]
Definition: ping.c:68
ACPI_NAME_UNION Signature
Definition: actbl.h:406
ACPI_TABLE_HEADER * Pointer
Definition: actbl.h:404
void AcpiTbUninstallTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbinstal.c:336
void AcpiTbInstallTableWithOverride(ACPI_TABLE_DESC *NewTableDesc, BOOLEAN Override, UINT32 *TableIndex)
Definition: tbinstal.c:70
char Ascii[4]
Definition: actbl.h:394
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by AcpiInstallPhysicalTable(), AcpiInstallTable(), AcpiTbInstallAndLoadTable(), AcpiTbParseFadt(), and AcpiTbParseRootTable().

◆ AcpiTbInstallTableWithOverride()

void AcpiTbInstallTableWithOverride ( ACPI_TABLE_DESC NewTableDesc,
BOOLEAN  Override,
UINT32 TableIndex 
)

Definition at line 70 of file tbinstal.c.

74{
75 UINT32 i;
77
78
80 if (ACPI_FAILURE (Status))
81 {
82 return;
83 }
84
85 /*
86 * ACPI Table Override:
87 *
88 * Before we install the table, let the host OS override it with a new
89 * one if desired. Any table within the RSDT/XSDT can be replaced,
90 * including the DSDT which is pointed to by the FADT.
91 */
92 if (Override)
93 {
94 AcpiTbOverrideTable (NewTableDesc);
95 }
96
97 AcpiTbInitTableDescriptor (&AcpiGbl_RootTableList.Tables[i],
98 NewTableDesc->Address, NewTableDesc->Flags, NewTableDesc->Pointer);
99
100 AcpiTbPrintTableHeader (NewTableDesc->Address, NewTableDesc->Pointer);
101
102 /* This synchronizes AcpiGbl_DsdtIndex */
103
104 *TableIndex = i;
105
106 /* Set the global integer width (based upon revision of the DSDT) */
107
108 if (i == AcpiGbl_DsdtIndex)
109 {
110 AcpiUtSetIntegerWidth (NewTableDesc->Pointer->Revision);
111 }
112}
void AcpiTbPrintTableHeader(ACPI_PHYSICAL_ADDRESS Address, ACPI_TABLE_HEADER *Header)
Definition: tbprint.c:143
void AcpiTbInitTableDescriptor(ACPI_TABLE_DESC *TableDesc, ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table)
Definition: tbdata.c:130
ACPI_STATUS AcpiTbGetNextTableDescriptor(UINT32 *TableIndex, ACPI_TABLE_DESC **TableDesc)
Definition: tbdata.c:762
void AcpiUtSetIntegerWidth(UINT8 Revision)
Definition: utmisc.c:181
UINT8 Flags
Definition: actbl.h:408
ACPI_PHYSICAL_ADDRESS Address
Definition: actbl.h:403
UINT8 Revision
Definition: actbl.h:110
void AcpiTbOverrideTable(ACPI_TABLE_DESC *OldTableDesc)
Definition: tbinstal.c:250

Referenced by AcpiTbInstallStandardTable().

◆ AcpiTbOverrideTable()

void AcpiTbOverrideTable ( ACPI_TABLE_DESC OldTableDesc)

Definition at line 250 of file tbinstal.c.

252{
254 ACPI_TABLE_DESC NewTableDesc;
256 ACPI_PHYSICAL_ADDRESS Address;
258 ACPI_ERROR_ONLY (char *OverrideType);
259
260
261 /* (1) Attempt logical override (returns a logical address) */
262
263 Status = AcpiOsTableOverride (OldTableDesc->Pointer, &Table);
264 if (ACPI_SUCCESS (Status) && Table)
265 {
268 ACPI_ERROR_ONLY (OverrideType = "Logical");
269 goto FinishOverride;
270 }
271
272 /* (2) Attempt physical override (returns a physical address) */
273
275 &Address, &Length);
276 if (ACPI_SUCCESS (Status) && Address && Length)
277 {
278 AcpiTbAcquireTempTable (&NewTableDesc, Address,
280 ACPI_ERROR_ONLY (OverrideType = "Physical");
281 goto FinishOverride;
282 }
283
284 return; /* There was no override */
285
286
287FinishOverride:
288
289 /*
290 * Validate and verify a table before overriding, no nested table
291 * duplication check as it's too complicated and unnecessary.
292 */
293 Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL, NULL);
294 if (ACPI_FAILURE (Status))
295 {
296 return;
297 }
298
299 ACPI_INFO (("%4.4s 0x%8.8X%8.8X"
300 " %s table override, new table: 0x%8.8X%8.8X",
301 OldTableDesc->Signature.Ascii,
302 ACPI_FORMAT_UINT64 (OldTableDesc->Address),
303 OverrideType, ACPI_FORMAT_UINT64 (NewTableDesc.Address)));
304
305 /* We can now uninstall the original table */
306
307 AcpiTbUninstallTable (OldTableDesc);
308
309 /*
310 * Replace the original table descriptor and keep its state as
311 * "VALIDATED".
312 */
313 AcpiTbInitTableDescriptor (OldTableDesc, NewTableDesc.Address,
314 NewTableDesc.Flags, NewTableDesc.Pointer);
315 AcpiTbValidateTempTable (OldTableDesc);
316
317 /* Release the temporary table descriptor */
318
319 AcpiTbReleaseTempTable (&NewTableDesc);
320}
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define ACPI_ERROR_ONLY(s)
Definition: acmacros.h:467
ACPI_STATUS AcpiOsTableOverride(ACPI_TABLE_HEADER *ExistingTable, ACPI_TABLE_HEADER **NewTable)
Definition: osl.c:72
ACPI_STATUS AcpiOsPhysicalTableOverride(ACPI_TABLE_HEADER *ExistingTable, ACPI_PHYSICAL_ADDRESS *NewAddress, UINT32 *NewTableLength)
Definition: osl.c:89
ACPI_STATUS AcpiTbValidateTempTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbdata.c:463
#define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL
Definition: actbl.h:429
#define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL
Definition: actbl.h:430
#define ACPI_PTR_TO_PHYSADDR(i)
Definition: actypes.h:559
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102

Referenced by AcpiTbInstallTableWithOverride().

◆ AcpiTbUninstallTable()

void AcpiTbUninstallTable ( ACPI_TABLE_DESC TableDesc)

Definition at line 336 of file tbinstal.c.

338{
339
340 ACPI_FUNCTION_TRACE (TbUninstallTable);
341
342
343 /* Table must be installed */
344
345 if (!TableDesc->Address)
346 {
348 }
349
350 AcpiTbInvalidateTable (TableDesc);
351
352 if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) ==
354 {
355 ACPI_FREE (TableDesc->Pointer);
356 TableDesc->Pointer = NULL;
357 }
358
359 TableDesc->Address = ACPI_PTR_TO_PHYSADDR (NULL);
361}
#define return_VOID
Definition: acoutput.h:495
void AcpiTbInvalidateTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbdata.c:414
#define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL
Definition: actbl.h:431
#define ACPI_TABLE_ORIGIN_MASK
Definition: actbl.h:432
#define ACPI_FREE(a)
Definition: actypes.h:386

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