xref: /freebsd/sys/contrib/edk2/Include/Protocol/AcpiTable.h (revision e985c628a0e4082d9b953897d6f56c81d177cea7)
1*e985c628SWarner Losh /** @file
2*e985c628SWarner Losh   The file provides the protocol to install or remove an ACPI
3*e985c628SWarner Losh   table from a platform.
4*e985c628SWarner Losh 
5*e985c628SWarner Losh   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6*e985c628SWarner Losh   SPDX-License-Identifier: BSD-2-Clause-Patent
7*e985c628SWarner Losh 
8*e985c628SWarner Losh   @par Revision Reference:
9*e985c628SWarner Losh   This Protocol was introduced in UEFI Specification 2.3.
10*e985c628SWarner Losh 
11*e985c628SWarner Losh **/
12*e985c628SWarner Losh 
13*e985c628SWarner Losh #ifndef __ACPI_TABLE_H___
14*e985c628SWarner Losh #define __ACPI_TABLE_H___
15*e985c628SWarner Losh 
16*e985c628SWarner Losh #define EFI_ACPI_TABLE_PROTOCOL_GUID \
17*e985c628SWarner Losh   { 0xffe06bdd, 0x6107, 0x46a6, { 0x7b, 0xb2, 0x5a, 0x9c, 0x7e, 0xc5, 0x27, 0x5c }}
18*e985c628SWarner Losh 
19*e985c628SWarner Losh typedef struct _EFI_ACPI_TABLE_PROTOCOL EFI_ACPI_TABLE_PROTOCOL;
20*e985c628SWarner Losh 
21*e985c628SWarner Losh /**
22*e985c628SWarner Losh 
23*e985c628SWarner Losh   The InstallAcpiTable() function allows a caller to install an
24*e985c628SWarner Losh   ACPI table. When successful, the table will be linked by the
25*e985c628SWarner Losh   RSDT/XSDT. AcpiTableBuffer specifies the table to be installed.
26*e985c628SWarner Losh   InstallAcpiTable() will make a copy of the table and insert the
27*e985c628SWarner Losh   copy into the RSDT/XSDT. InstallAcpiTable() must insert the new
28*e985c628SWarner Losh   table at the end of the RSDT/XSDT. To prevent namespace
29*e985c628SWarner Losh   collision, ACPI tables may be created using UEFI ACPI table
30*e985c628SWarner Losh   format. If this protocol is used to install a table with a
31*e985c628SWarner Losh   signature already present in the system, the new table will not
32*e985c628SWarner Losh   replace the existing table. It is a platform implementation
33*e985c628SWarner Losh   decision to add a new table with a signature matching an
34*e985c628SWarner Losh   existing table or disallow duplicate table signatures and
35*e985c628SWarner Losh   return EFI_ACCESS_DENIED. On successful output, TableKey is
36*e985c628SWarner Losh   initialized with a unique key. Its value may be used in a
37*e985c628SWarner Losh   subsequent call to UninstallAcpiTable to remove an ACPI table.
38*e985c628SWarner Losh   If an EFI application is running at the time of this call, the
39*e985c628SWarner Losh   relevant EFI_CONFIGURATION_TABLE pointer to the RSDT is no
40*e985c628SWarner Losh   longer considered valid.
41*e985c628SWarner Losh 
42*e985c628SWarner Losh 
43*e985c628SWarner Losh   @param This                 A pointer to a EFI_ACPI_TABLE_PROTOCOL.
44*e985c628SWarner Losh 
45*e985c628SWarner Losh   @param AcpiTableBuffer      A pointer to a buffer containing the
46*e985c628SWarner Losh                               ACPI table to be installed.
47*e985c628SWarner Losh 
48*e985c628SWarner Losh   @param AcpiTableBufferSize  Specifies the size, in bytes, of
49*e985c628SWarner Losh                               the AcpiTableBuffer buffer.
50*e985c628SWarner Losh 
51*e985c628SWarner Losh 
52*e985c628SWarner Losh   @param TableKey             Returns a key to refer to the ACPI table.
53*e985c628SWarner Losh 
54*e985c628SWarner Losh   @retval EFI_SUCCESS           The table was successfully inserted
55*e985c628SWarner Losh 
56*e985c628SWarner Losh   @retval EFI_INVALID_PARAMETER Either AcpiTableBuffer is NULL,
57*e985c628SWarner Losh                                 TableKey is NULL, or
58*e985c628SWarner Losh                                 AcpiTableBufferSize and the size
59*e985c628SWarner Losh                                 field embedded in the ACPI table
60*e985c628SWarner Losh                                 pointed to by AcpiTableBuffer
61*e985c628SWarner Losh                                 are not in sync.
62*e985c628SWarner Losh 
63*e985c628SWarner Losh   @retval EFI_OUT_OF_RESOURCES  Insufficient resources exist to
64*e985c628SWarner Losh                                 complete the request.
65*e985c628SWarner Losh   @retval EFI_ACCESS_DENIED     The table signature matches a table already
66*e985c628SWarner Losh                                 present in the system and platform policy
67*e985c628SWarner Losh                                 does not allow duplicate tables of this type.
68*e985c628SWarner Losh 
69*e985c628SWarner Losh **/
70*e985c628SWarner Losh typedef
71*e985c628SWarner Losh EFI_STATUS
72*e985c628SWarner Losh (EFIAPI *EFI_ACPI_TABLE_INSTALL_ACPI_TABLE)(
73*e985c628SWarner Losh   IN   EFI_ACPI_TABLE_PROTOCOL       *This,
74*e985c628SWarner Losh   IN   VOID                          *AcpiTableBuffer,
75*e985c628SWarner Losh   IN   UINTN                         AcpiTableBufferSize,
76*e985c628SWarner Losh   OUT  UINTN                         *TableKey
77*e985c628SWarner Losh   );
78*e985c628SWarner Losh 
79*e985c628SWarner Losh /**
80*e985c628SWarner Losh 
81*e985c628SWarner Losh   The UninstallAcpiTable() function allows a caller to remove an
82*e985c628SWarner Losh   ACPI table. The routine will remove its reference from the
83*e985c628SWarner Losh   RSDT/XSDT. A table is referenced by the TableKey parameter
84*e985c628SWarner Losh   returned from a prior call to InstallAcpiTable(). If an EFI
85*e985c628SWarner Losh   application is running at the time of this call, the relevant
86*e985c628SWarner Losh   EFI_CONFIGURATION_TABLE pointer to the RSDT is no longer
87*e985c628SWarner Losh   considered valid.
88*e985c628SWarner Losh 
89*e985c628SWarner Losh   @param This                   A pointer to a EFI_ACPI_TABLE_PROTOCOL.
90*e985c628SWarner Losh 
91*e985c628SWarner Losh   @param TableKey               Specifies the table to uninstall. The key was
92*e985c628SWarner Losh                                 returned from InstallAcpiTable().
93*e985c628SWarner Losh 
94*e985c628SWarner Losh   @retval EFI_SUCCESS           The table was successfully inserted
95*e985c628SWarner Losh 
96*e985c628SWarner Losh   @retval EFI_NOT_FOUND         TableKey does not refer to a valid key
97*e985c628SWarner Losh                                 for a table entry.
98*e985c628SWarner Losh 
99*e985c628SWarner Losh   @retval EFI_OUT_OF_RESOURCES  Insufficient resources exist to
100*e985c628SWarner Losh                                 complete the request.
101*e985c628SWarner Losh 
102*e985c628SWarner Losh **/
103*e985c628SWarner Losh typedef
104*e985c628SWarner Losh EFI_STATUS
105*e985c628SWarner Losh (EFIAPI *EFI_ACPI_TABLE_UNINSTALL_ACPI_TABLE)(
106*e985c628SWarner Losh   IN  EFI_ACPI_TABLE_PROTOCOL       *This,
107*e985c628SWarner Losh   IN  UINTN                         TableKey
108*e985c628SWarner Losh   );
109*e985c628SWarner Losh 
110*e985c628SWarner Losh ///
111*e985c628SWarner Losh /// The EFI_ACPI_TABLE_PROTOCOL provides the ability for a component
112*e985c628SWarner Losh /// to install and uninstall ACPI tables from a platform.
113*e985c628SWarner Losh ///
114*e985c628SWarner Losh struct _EFI_ACPI_TABLE_PROTOCOL {
115*e985c628SWarner Losh   EFI_ACPI_TABLE_INSTALL_ACPI_TABLE      InstallAcpiTable;
116*e985c628SWarner Losh   EFI_ACPI_TABLE_UNINSTALL_ACPI_TABLE    UninstallAcpiTable;
117*e985c628SWarner Losh };
118*e985c628SWarner Losh 
119*e985c628SWarner Losh extern EFI_GUID  gEfiAcpiTableProtocolGuid;
120*e985c628SWarner Losh 
121*e985c628SWarner Losh #endif
122