ReactOS  0.4.14-dev-599-g2d4d3f5
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, 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,
BOOLEAN  Reload,
BOOLEAN  Override,
UINT32 TableIndex 
)

Definition at line 137 of file tbinstal.c.

143 {
144  UINT32 i;
146  ACPI_TABLE_DESC NewTableDesc;
147 
148 
149  ACPI_FUNCTION_TRACE (TbInstallStandardTable);
150 
151 
152  /* Acquire a temporary table descriptor for validation */
153 
154  Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, Flags);
155  if (ACPI_FAILURE (Status))
156  {
158  "Could not acquire table length at %8.8X%8.8X",
161  }
162 
163  /*
164  * Optionally do not load any SSDTs from the RSDT/XSDT. This can
165  * be useful for debugging ACPI problems on some machines.
166  */
167  if (!Reload &&
168  AcpiGbl_DisableSsdtTableInstall &&
170  {
171  ACPI_INFO ((
172  "Ignoring installation of %4.4s at %8.8X%8.8X",
173  NewTableDesc.Signature.Ascii, ACPI_FORMAT_UINT64 (Address)));
174  goto ReleaseAndExit;
175  }
176 
177  /* Acquire the table lock */
178 
180 
181  /* Validate and verify a table before installation */
182 
183  Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL, &i);
184  if (ACPI_FAILURE (Status))
185  {
186  if (Status == AE_CTRL_TERMINATE)
187  {
188  /*
189  * Table was unloaded, allow it to be reloaded.
190  * As we are going to return AE_OK to the caller, we should
191  * take the responsibility of freeing the input descriptor.
192  * Refill the input descriptor to ensure
193  * AcpiTbInstallTableWithOverride() can be called again to
194  * indicate the re-installation.
195  */
196  AcpiTbUninstallTable (&NewTableDesc);
198  *TableIndex = i;
200  }
201  goto UnlockAndExit;
202  }
203 
204  /* Add the table to the global root table list */
205 
206  AcpiTbInstallTableWithOverride (&NewTableDesc, Override, TableIndex);
207 
208  /* Invoke table handler */
209 
213 
214 UnlockAndExit:
215 
216  /* Release the table lock */
217 
219 
220 ReleaseAndExit:
221 
222  /* Release the temporary table descriptor */
223 
224  AcpiTbReleaseTempTable (&NewTableDesc);
226 }
ACPI_STATUS AcpiTbAcquireTempTable(ACPI_TABLE_DESC *TableDesc, ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags)
Definition: tbdata.c:265
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
char Ascii[4]
Definition: actbl.h:394
UINT32 ACPI_STATUS
Definition: actypes.h:460
void AcpiTbUninstallTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbinstal.c:333
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
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
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
#define AE_CTRL_TERMINATE
Definition: acexcep.h:226
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
unsigned int UINT32
ACPI_NAME_UNION Signature
Definition: actbl.h:406
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
static WCHAR Address[46]
Definition: ping.c:68
void AcpiTbReleaseTempTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbdata.c:326
#define ACPI_MTX_TABLES
Definition: aclocal.h:86
#define ACPI_COMPARE_NAMESEG(a, b)
Definition: actypes.h:561
#define ACPI_TABLE_EVENT_INSTALL
Definition: actypes.h:1184
ACPI_TABLE_HEADER * Pointer
Definition: actbl.h:404
void AcpiTbNotifyTable(UINT32 Event, void *Table)
Definition: tbdata.c:1220
#define ACPI_SIG_SSDT
Definition: actbl.h:75
#define ACPI_INFO(plist)
Definition: acoutput.h:237
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
ACPI_STATUS AcpiTbVerifyTempTable(ACPI_TABLE_DESC *TableDesc, char *Signature, UINT32 *TableIndex)
Definition: tbdata.c:549
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
void AcpiTbInstallTableWithOverride(ACPI_TABLE_DESC *NewTableDesc, BOOLEAN Override, UINT32 *TableIndex)
Definition: tbinstal.c:70
#define AE_OK
Definition: acexcep.h:97

Referenced by 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 AcpiUtSetIntegerWidth(UINT8 Revision)
Definition: utmisc.c:181
UINT8 Revision
Definition: actbl.h:110
UINT32 ACPI_STATUS
Definition: actypes.h:460
void AcpiTbOverrideTable(ACPI_TABLE_DESC *OldTableDesc)
Definition: tbinstal.c:247
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
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
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
ACPI_TABLE_HEADER * Pointer
Definition: actbl.h:404
ACPI_STATUS AcpiTbGetNextTableDescriptor(UINT32 *TableIndex, ACPI_TABLE_DESC **TableDesc)
Definition: tbdata.c:727
void AcpiTbInitTableDescriptor(ACPI_TABLE_DESC *TableDesc, ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table)
Definition: tbdata.c:130
Status
Definition: gdiplustypes.h:24
void AcpiTbPrintTableHeader(ACPI_PHYSICAL_ADDRESS Address, ACPI_TABLE_HEADER *Header)
Definition: tbprint.c:141
ACPI_PHYSICAL_ADDRESS Address
Definition: actbl.h:403
UINT8 Flags
Definition: actbl.h:408

Referenced by AcpiTbInstallStandardTable().

◆ AcpiTbOverrideTable()

void AcpiTbOverrideTable ( ACPI_TABLE_DESC OldTableDesc)

Definition at line 247 of file tbinstal.c.

249 {
251  ACPI_TABLE_DESC NewTableDesc;
253  ACPI_PHYSICAL_ADDRESS Address;
254  UINT32 Length;
255  ACPI_ERROR_ONLY (char *OverrideType);
256 
257 
258  /* (1) Attempt logical override (returns a logical address) */
259 
260  Status = AcpiOsTableOverride (OldTableDesc->Pointer, &Table);
261  if (ACPI_SUCCESS (Status) && Table)
262  {
265  ACPI_ERROR_ONLY (OverrideType = "Logical");
266  goto FinishOverride;
267  }
268 
269  /* (2) Attempt physical override (returns a physical address) */
270 
271  Status = AcpiOsPhysicalTableOverride (OldTableDesc->Pointer,
272  &Address, &Length);
273  if (ACPI_SUCCESS (Status) && Address && Length)
274  {
275  AcpiTbAcquireTempTable (&NewTableDesc, Address,
277  ACPI_ERROR_ONLY (OverrideType = "Physical");
278  goto FinishOverride;
279  }
280 
281  return; /* There was no override */
282 
283 
284 FinishOverride:
285 
286  /*
287  * Validate and verify a table before overriding, no nested table
288  * duplication check as it's too complicated and unnecessary.
289  */
290  Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL, NULL);
291  if (ACPI_FAILURE (Status))
292  {
293  return;
294  }
295 
296  ACPI_INFO (("%4.4s 0x%8.8X%8.8X"
297  " %s table override, new table: 0x%8.8X%8.8X",
298  OldTableDesc->Signature.Ascii,
299  ACPI_FORMAT_UINT64 (OldTableDesc->Address),
300  OverrideType, ACPI_FORMAT_UINT64 (NewTableDesc.Address)));
301 
302  /* We can now uninstall the original table */
303 
304  AcpiTbUninstallTable (OldTableDesc);
305 
306  /*
307  * Replace the original table descriptor and keep its state as
308  * "VALIDATED".
309  */
310  AcpiTbInitTableDescriptor (OldTableDesc, NewTableDesc.Address,
311  NewTableDesc.Flags, NewTableDesc.Pointer);
312  AcpiTbValidateTempTable (OldTableDesc);
313 
314  /* Release the temporary table descriptor */
315 
316  AcpiTbReleaseTempTable (&NewTableDesc);
317 }
ASMGENDATA Table[]
Definition: genincdata.c:61
ACPI_STATUS AcpiTbAcquireTempTable(ACPI_TABLE_DESC *TableDesc, ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags)
Definition: tbdata.c:265
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define ACPI_ERROR_ONLY(s)
Definition: acmacros.h:467
char Ascii[4]
Definition: actbl.h:394
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL
Definition: actbl.h:430
void AcpiTbUninstallTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbinstal.c:333
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
unsigned int UINT32
ACPI_NAME_UNION Signature
Definition: actbl.h:406
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
void AcpiTbReleaseTempTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbdata.c:326
ACPI_STATUS AcpiTbValidateTempTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbdata.c:428
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ACPI_TABLE_HEADER * Pointer
Definition: actbl.h:404
#define ACPI_PTR_TO_PHYSADDR(i)
Definition: actypes.h:556
ACPI_STATUS AcpiOsPhysicalTableOverride(ACPI_TABLE_HEADER *ExistingTable, ACPI_PHYSICAL_ADDRESS *NewAddress, UINT32 *NewTableLength)
Definition: osl.c:89
#define ACPI_INFO(plist)
Definition: acoutput.h:237
void AcpiTbInitTableDescriptor(ACPI_TABLE_DESC *TableDesc, ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, ACPI_TABLE_HEADER *Table)
Definition: tbdata.c:130
Status
Definition: gdiplustypes.h:24
ACPI_PHYSICAL_ADDRESS Address
Definition: actbl.h:403
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
ACPI_STATUS AcpiTbVerifyTempTable(ACPI_TABLE_DESC *TableDesc, char *Signature, UINT32 *TableIndex)
Definition: tbdata.c:549
ACPI_STATUS AcpiOsTableOverride(ACPI_TABLE_HEADER *ExistingTable, ACPI_TABLE_HEADER **NewTable)
Definition: osl.c:72
UINT8 Flags
Definition: actbl.h:408
#define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL
Definition: actbl.h:429

Referenced by AcpiTbInstallTableWithOverride().

◆ AcpiTbUninstallTable()

void AcpiTbUninstallTable ( ACPI_TABLE_DESC TableDesc)

Definition at line 333 of file tbinstal.c.

335 {
336 
337  ACPI_FUNCTION_TRACE (TbUninstallTable);
338 
339 
340  /* Table must be installed */
341 
342  if (!TableDesc->Address)
343  {
344  return_VOID;
345  }
346 
347  AcpiTbInvalidateTable (TableDesc);
348 
349  if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) ==
351  {
352  ACPI_FREE (ACPI_PHYSADDR_TO_PTR (TableDesc->Address));
353  }
354 
355  TableDesc->Address = ACPI_PTR_TO_PHYSADDR (NULL);
356  return_VOID;
357 }
#define ACPI_FREE(a)
Definition: actypes.h:386
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_PHYSADDR_TO_PTR(i)
Definition: actypes.h:555
#define return_VOID
Definition: acoutput.h:495
#define ACPI_PTR_TO_PHYSADDR(i)
Definition: actypes.h:556
#define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL
Definition: actbl.h:431
ACPI_PHYSICAL_ADDRESS Address
Definition: actbl.h:403
void AcpiTbInvalidateTable(ACPI_TABLE_DESC *TableDesc)
Definition: tbdata.c:392
#define ACPI_TABLE_ORIGIN_MASK
Definition: actbl.h:432
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
UINT8 Flags
Definition: actbl.h:408

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