xref: /openbmc/qemu/include/hw/acpi/aml-build.h (revision 0073518dd7232fb4da6331ea298589383d2d16cb)
119934e0eSIgor Mammedov #ifndef HW_ACPI_GEN_UTILS_H
219934e0eSIgor Mammedov #define HW_ACPI_GEN_UTILS_H
319934e0eSIgor Mammedov 
419934e0eSIgor Mammedov #include <stdint.h>
519934e0eSIgor Mammedov #include <glib.h>
619934e0eSIgor Mammedov #include "qemu/compiler.h"
7658c2718SShannon Zhao #include "hw/acpi/acpi-defs.h"
8658c2718SShannon Zhao 
9658c2718SShannon Zhao /* Reserve RAM space for tables: add another order of magnitude. */
10658c2718SShannon Zhao #define ACPI_BUILD_TABLE_MAX_SIZE         0x200000
11658c2718SShannon Zhao 
12658c2718SShannon Zhao #define ACPI_BUILD_APPNAME6 "BOCHS "
13658c2718SShannon Zhao #define ACPI_BUILD_APPNAME4 "BXPC"
14658c2718SShannon Zhao 
15658c2718SShannon Zhao #define ACPI_BUILD_TABLE_FILE "etc/acpi/tables"
16658c2718SShannon Zhao #define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp"
17658c2718SShannon Zhao #define ACPI_BUILD_TPMLOG_FILE "etc/tpm/log"
1819934e0eSIgor Mammedov 
190f2707e4SIgor Mammedov typedef enum {
200f2707e4SIgor Mammedov     AML_NO_OPCODE = 0,/* has only data */
210f2707e4SIgor Mammedov     AML_OPCODE,       /* has opcode optionally followed by data */
220f2707e4SIgor Mammedov     AML_PACKAGE,      /* has opcode and uses PkgLength for its length */
2356521fb8SMichael S. Tsirkin     AML_EXT_PACKAGE,  /* Same as AML_PACKAGE but also has 'ExOpPrefix' */
240f2707e4SIgor Mammedov     AML_BUFFER,       /* data encoded as 'DefBuffer' */
250f2707e4SIgor Mammedov     AML_RES_TEMPLATE, /* encoded as ResourceTemplate macro */
260f2707e4SIgor Mammedov } AmlBlockFlags;
270f2707e4SIgor Mammedov 
280f2707e4SIgor Mammedov struct Aml {
290f2707e4SIgor Mammedov     GArray *buf;
300f2707e4SIgor Mammedov 
310f2707e4SIgor Mammedov     /*< private >*/
320f2707e4SIgor Mammedov     uint8_t op;
330f2707e4SIgor Mammedov     AmlBlockFlags block_flags;
340f2707e4SIgor Mammedov };
350f2707e4SIgor Mammedov typedef struct Aml Aml;
360f2707e4SIgor Mammedov 
3752fa397cSIgor Mammedov typedef enum {
38ff80dc7fSShannon Zhao     AML_DECODE10 = 0,
39ff80dc7fSShannon Zhao     AML_DECODE16 = 1,
4052fa397cSIgor Mammedov } AmlIODecode;
4152fa397cSIgor Mammedov 
4231127938SIgor Mammedov typedef enum {
43ff80dc7fSShannon Zhao     AML_ANY_ACC = 0,
44ff80dc7fSShannon Zhao     AML_BYTE_ACC = 1,
45ff80dc7fSShannon Zhao     AML_WORD_ACC = 2,
46ff80dc7fSShannon Zhao     AML_DWORD_ACC = 3,
47ff80dc7fSShannon Zhao     AML_QWORD_ACC = 4,
48ff80dc7fSShannon Zhao     AML_BUFFER_ACC = 5,
49af509897SZhu Guihua } AmlAccessType;
50af509897SZhu Guihua 
51af509897SZhu Guihua typedef enum {
52ff80dc7fSShannon Zhao     AML_PRESERVE = 0,
53ff80dc7fSShannon Zhao     AML_WRITE_AS_ONES = 1,
54ff80dc7fSShannon Zhao     AML_WRITE_AS_ZEROS = 2,
55af509897SZhu Guihua } AmlUpdateRule;
56214ae59fSIgor Mammedov 
57214ae59fSIgor Mammedov typedef enum {
58ff80dc7fSShannon Zhao     AML_SYSTEM_MEMORY = 0X00,
59ff80dc7fSShannon Zhao     AML_SYSTEM_IO = 0X01,
6031127938SIgor Mammedov } AmlRegionSpace;
6131127938SIgor Mammedov 
626ece7053SIgor Mammedov typedef enum {
63ff80dc7fSShannon Zhao     AML_MEMORY_RANGE = 0,
64ff80dc7fSShannon Zhao     AML_IO_RANGE = 1,
65ff80dc7fSShannon Zhao     AML_BUS_NUMBER_RANGE = 2,
666ece7053SIgor Mammedov } AmlResourceType;
676ece7053SIgor Mammedov 
686ece7053SIgor Mammedov typedef enum {
69ff80dc7fSShannon Zhao     AML_SUB_DECODE = 1 << 1,
70ff80dc7fSShannon Zhao     AML_POS_DECODE = 0
716ece7053SIgor Mammedov } AmlDecode;
726ece7053SIgor Mammedov 
736ece7053SIgor Mammedov typedef enum {
74ff80dc7fSShannon Zhao     AML_MAX_FIXED = 1 << 3,
75ff80dc7fSShannon Zhao     AML_MAX_NOT_FIXED = 0,
766ece7053SIgor Mammedov } AmlMaxFixed;
776ece7053SIgor Mammedov 
786ece7053SIgor Mammedov typedef enum {
79ff80dc7fSShannon Zhao     AML_MIN_FIXED = 1 << 2,
80ff80dc7fSShannon Zhao     AML_MIN_NOT_FIXED = 0
816ece7053SIgor Mammedov } AmlMinFixed;
826ece7053SIgor Mammedov 
836ece7053SIgor Mammedov /*
846ece7053SIgor Mammedov  * ACPI 1.0b: Table 6-26 I/O Resource Flag (Resource Type = 1) Definitions
856ece7053SIgor Mammedov  * _RNG field definition
866ece7053SIgor Mammedov  */
876ece7053SIgor Mammedov typedef enum {
88ff80dc7fSShannon Zhao     AML_ISA_ONLY = 1,
89ff80dc7fSShannon Zhao     AML_NON_ISA_ONLY = 2,
90ff80dc7fSShannon Zhao     AML_ENTIRE_RANGE = 3,
916ece7053SIgor Mammedov } AmlISARanges;
926ece7053SIgor Mammedov 
936ece7053SIgor Mammedov /*
946ece7053SIgor Mammedov  * ACPI 1.0b: Table 6-25 Memory Resource Flag (Resource Type = 0) Definitions
956ece7053SIgor Mammedov  * _MEM field definition
966ece7053SIgor Mammedov  */
976ece7053SIgor Mammedov typedef enum {
98ff80dc7fSShannon Zhao     AML_NON_CACHEABLE = 0,
99ff80dc7fSShannon Zhao     AML_CACHEABLE = 1,
100ff80dc7fSShannon Zhao     AML_WRITE_COMBINING = 2,
101ff80dc7fSShannon Zhao     AML_PREFETCHABLE = 3,
102ff80dc7fSShannon Zhao } AmlCacheable;
1036ece7053SIgor Mammedov 
1046ece7053SIgor Mammedov /*
1056ece7053SIgor Mammedov  * ACPI 1.0b: Table 6-25 Memory Resource Flag (Resource Type = 0) Definitions
1066ece7053SIgor Mammedov  * _RW field definition
1076ece7053SIgor Mammedov  */
1086ece7053SIgor Mammedov typedef enum {
109ff80dc7fSShannon Zhao     AML_READ_ONLY = 0,
110ff80dc7fSShannon Zhao     AML_READ_WRITE = 1,
1116ece7053SIgor Mammedov } AmlReadAndWrite;
1126ece7053SIgor Mammedov 
113205d1d1cSShannon Zhao /*
114205d1d1cSShannon Zhao  * ACPI 5.0: Table 6-187 Extended Interrupt Descriptor Definition
115205d1d1cSShannon Zhao  * Interrupt Vector Flags Bits[0] Consumer/Producer
116205d1d1cSShannon Zhao  */
117205d1d1cSShannon Zhao typedef enum {
118205d1d1cSShannon Zhao     AML_CONSUMER_PRODUCER = 0,
119205d1d1cSShannon Zhao     AML_CONSUMER = 1,
120205d1d1cSShannon Zhao } AmlConsumerAndProducer;
121205d1d1cSShannon Zhao 
122205d1d1cSShannon Zhao /*
123205d1d1cSShannon Zhao  * ACPI 5.0: Table 6-187 Extended Interrupt Descriptor Definition
124205d1d1cSShannon Zhao  * _HE field definition
125205d1d1cSShannon Zhao  */
126205d1d1cSShannon Zhao typedef enum {
127205d1d1cSShannon Zhao     AML_LEVEL = 0,
128205d1d1cSShannon Zhao     AML_EDGE = 1,
129205d1d1cSShannon Zhao } AmlLevelAndEdge;
130205d1d1cSShannon Zhao 
131205d1d1cSShannon Zhao /*
132205d1d1cSShannon Zhao  * ACPI 5.0: Table 6-187 Extended Interrupt Descriptor Definition
133205d1d1cSShannon Zhao  * _LL field definition
134205d1d1cSShannon Zhao  */
135205d1d1cSShannon Zhao typedef enum {
136205d1d1cSShannon Zhao     AML_ACTIVE_HIGH = 0,
137205d1d1cSShannon Zhao     AML_ACTIVE_LOW = 1,
138205d1d1cSShannon Zhao } AmlActiveHighAndLow;
139205d1d1cSShannon Zhao 
140205d1d1cSShannon Zhao /*
141205d1d1cSShannon Zhao  * ACPI 5.0: Table 6-187 Extended Interrupt Descriptor Definition
142205d1d1cSShannon Zhao  * _SHR field definition
143205d1d1cSShannon Zhao  */
144205d1d1cSShannon Zhao typedef enum {
145205d1d1cSShannon Zhao     AML_EXCLUSIVE = 0,
146205d1d1cSShannon Zhao     AML_SHARED = 1,
147205d1d1cSShannon Zhao     AML_EXCLUSIVE_AND_WAKE = 2,
148205d1d1cSShannon Zhao     AML_SHARED_AND_WAKE = 3,
149205d1d1cSShannon Zhao } AmlShared;
150205d1d1cSShannon Zhao 
1514dbfc881SXiao Guangrong /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: MethodFlags */
1524dbfc881SXiao Guangrong typedef enum {
1534dbfc881SXiao Guangrong     AML_NOTSERIALIZED = 0,
1544dbfc881SXiao Guangrong     AML_SERIALIZED = 1,
1554dbfc881SXiao Guangrong } AmlSerializeFlag;
1564dbfc881SXiao Guangrong 
1574ecdc746SShannon Zhao /*
1584ecdc746SShannon Zhao  * ACPI 5.0: Table 6-189 GPIO Connection Descriptor Definition
1594ecdc746SShannon Zhao  * GPIO Connection Type
1604ecdc746SShannon Zhao  */
1614ecdc746SShannon Zhao typedef enum {
1624ecdc746SShannon Zhao     AML_INTERRUPT_CONNECTION = 0,
1634ecdc746SShannon Zhao     AML_IO_CONNECTION = 1,
1644ecdc746SShannon Zhao } AmlGpioConnectionType;
1654ecdc746SShannon Zhao 
1664ecdc746SShannon Zhao /*
1674ecdc746SShannon Zhao  * ACPI 5.0: Table 6-189 GPIO Connection Descriptor Definition
1684ecdc746SShannon Zhao  * _PPI field definition
1694ecdc746SShannon Zhao  */
1704ecdc746SShannon Zhao typedef enum {
1714ecdc746SShannon Zhao     AML_PULL_DEFAULT = 0,
1724ecdc746SShannon Zhao     AML_PULL_UP = 1,
1734ecdc746SShannon Zhao     AML_PULL_DOWN = 2,
1744ecdc746SShannon Zhao     AML_PULL_NONE = 3,
1754ecdc746SShannon Zhao } AmlPinConfig;
1764ecdc746SShannon Zhao 
177658c2718SShannon Zhao typedef
178658c2718SShannon Zhao struct AcpiBuildTables {
179658c2718SShannon Zhao     GArray *table_data;
180658c2718SShannon Zhao     GArray *rsdp;
181658c2718SShannon Zhao     GArray *tcpalog;
182658c2718SShannon Zhao     GArray *linker;
183658c2718SShannon Zhao } AcpiBuildTables;
184658c2718SShannon Zhao 
1850f2707e4SIgor Mammedov /**
1860f2707e4SIgor Mammedov  * init_aml_allocator:
1870f2707e4SIgor Mammedov  *
1880f2707e4SIgor Mammedov  * Called for initializing API allocator which allow to use
1890f2707e4SIgor Mammedov  * AML API.
1900f2707e4SIgor Mammedov  * Returns: toplevel container which accumulates all other
1910f2707e4SIgor Mammedov  * AML elements for a table.
1920f2707e4SIgor Mammedov  */
1930f2707e4SIgor Mammedov Aml *init_aml_allocator(void);
1940f2707e4SIgor Mammedov 
1950f2707e4SIgor Mammedov /**
1960f2707e4SIgor Mammedov  * free_aml_allocator:
1970f2707e4SIgor Mammedov  *
1980f2707e4SIgor Mammedov  * Releases all elements used by AML API, frees associated memory
1990f2707e4SIgor Mammedov  * and invalidates AML allocator. After this call @init_aml_allocator
2000f2707e4SIgor Mammedov  * should be called again if AML API is to be used again.
2010f2707e4SIgor Mammedov  */
2020f2707e4SIgor Mammedov void free_aml_allocator(void);
2030f2707e4SIgor Mammedov 
2040f2707e4SIgor Mammedov /**
2050f2707e4SIgor Mammedov  * aml_append:
2060f2707e4SIgor Mammedov  * @parent_ctx: context to which @child element is added
2070f2707e4SIgor Mammedov  * @child: element that is copied into @parent_ctx context
2080f2707e4SIgor Mammedov  *
2090f2707e4SIgor Mammedov  * Joins Aml elements together and helps to construct AML tables
2100f2707e4SIgor Mammedov  * Examle of usage:
2110f2707e4SIgor Mammedov  *   Aml *table = aml_def_block("SSDT", ...);
2127824df38SGal Hammer  *   Aml *sb = aml_scope("\\_SB");
2130f2707e4SIgor Mammedov  *   Aml *dev = aml_device("PCI0");
2140f2707e4SIgor Mammedov  *
2150f2707e4SIgor Mammedov  *   aml_append(dev, aml_name_decl("HID", aml_eisaid("PNP0A03")));
2160f2707e4SIgor Mammedov  *   aml_append(sb, dev);
2170f2707e4SIgor Mammedov  *   aml_append(table, sb);
2180f2707e4SIgor Mammedov  */
2190f2707e4SIgor Mammedov void aml_append(Aml *parent_ctx, Aml *child);
2200f2707e4SIgor Mammedov 
2213c054bd5SIgor Mammedov /* non block AML object primitives */
2223c054bd5SIgor Mammedov Aml *aml_name(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
2233c054bd5SIgor Mammedov Aml *aml_name_decl(const char *name, Aml *val);
224b25af5adSIgor Mammedov Aml *aml_return(Aml *val);
225295a515dSIgor Mammedov Aml *aml_int(const uint64_t val);
2267193f3a6SIgor Mammedov Aml *aml_arg(int pos);
227f411199dSIgor Mammedov Aml *aml_to_integer(Aml *arg);
228c263b3f7SIgor Mammedov Aml *aml_store(Aml *val, Aml *target);
229926f5aaeSIgor Mammedov Aml *aml_and(Aml *arg1, Aml *arg2);
230922cc882SShannon Zhao Aml *aml_or(Aml *arg1, Aml *arg2);
231a57dddddSMarcel Apfelbaum Aml *aml_shiftleft(Aml *arg1, Aml *count);
232c360639aSIgor Mammedov Aml *aml_shiftright(Aml *arg1, Aml *count, Aml *dst);
23396396e28SMarcel Apfelbaum Aml *aml_lless(Aml *arg1, Aml *arg2);
23420ca5208SIgor Mammedov Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst);
2357059eb42SIgor Mammedov Aml *aml_subtract(Aml *arg1, Aml *arg2, Aml *dst);
236af39d536SMarcel Apfelbaum Aml *aml_increment(Aml *arg);
2377059eb42SIgor Mammedov Aml *aml_decrement(Aml *arg);
238928b8996SMarcel Apfelbaum Aml *aml_index(Aml *arg1, Aml *idx);
23934189453SIgor Mammedov Aml *aml_notify(Aml *arg1, Aml *arg2);
2407b38ba9cSIgor Mammedov Aml *aml_call0(const char *method);
2413f3992b7SIgor Mammedov Aml *aml_call1(const char *method, Aml *arg1);
2423f3992b7SIgor Mammedov Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2);
2433f3992b7SIgor Mammedov Aml *aml_call3(const char *method, Aml *arg1, Aml *arg2, Aml *arg3);
2443f3992b7SIgor Mammedov Aml *aml_call4(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *arg4);
24537d0e980SShannon Zhao Aml *aml_gpio_int(AmlConsumerAndProducer con_and_pro,
24637d0e980SShannon Zhao                   AmlLevelAndEdge edge_level,
24737d0e980SShannon Zhao                   AmlActiveHighAndLow active_level, AmlShared shared,
24837d0e980SShannon Zhao                   AmlPinConfig pin_config, uint16_t debounce_timeout,
24937d0e980SShannon Zhao                   const uint32_t pin_list[], uint32_t pin_count,
25037d0e980SShannon Zhao                   const char *resource_source_name,
25137d0e980SShannon Zhao                   const uint8_t *vendor_data, uint16_t vendor_data_len);
252dc17ab1dSShannon Zhao Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
253dc17ab1dSShannon Zhao                         AmlReadAndWrite read_and_write);
254205d1d1cSShannon Zhao Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
255205d1d1cSShannon Zhao                    AmlLevelAndEdge level_and_edge,
256205d1d1cSShannon Zhao                    AmlActiveHighAndLow high_and_low, AmlShared shared,
25745fcf539SIgor Mammedov                    uint32_t *irq_list, uint8_t irq_count);
25852fa397cSIgor Mammedov Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
25952fa397cSIgor Mammedov             uint8_t aln, uint8_t len);
26031127938SIgor Mammedov Aml *aml_operation_region(const char *name, AmlRegionSpace rs,
26131127938SIgor Mammedov                           uint32_t offset, uint32_t len);
26270560453SIgor Mammedov Aml *aml_irq_no_flags(uint8_t irq);
263214ae59fSIgor Mammedov Aml *aml_named_field(const char *name, unsigned length);
264e2ea299bSIgor Mammedov Aml *aml_reserved_field(unsigned length);
265b8a5d689SIgor Mammedov Aml *aml_local(int num);
266d5e5830fSIgor Mammedov Aml *aml_string(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
267ea7df04aSShannon Zhao Aml *aml_lnot(Aml *arg);
26815e44e56SIgor Mammedov Aml *aml_equal(Aml *arg1, Aml *arg2);
2692d3f667dSIgor Mammedov Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2);
2703dd15643SIgor Mammedov Aml *aml_processor(uint8_t proc_id, uint32_t pblk_addr, uint8_t pblk_len,
2713dd15643SIgor Mammedov                    const char *name_format, ...) GCC_FMT_ATTR(4, 5);
272a7891dacSIgor Mammedov Aml *aml_eisaid(const char *str);
2736ece7053SIgor Mammedov Aml *aml_word_bus_number(AmlMinFixed min_fixed, AmlMaxFixed max_fixed,
2746ece7053SIgor Mammedov                          AmlDecode dec, uint16_t addr_gran,
2756ece7053SIgor Mammedov                          uint16_t addr_min, uint16_t addr_max,
2766ece7053SIgor Mammedov                          uint16_t addr_trans, uint16_t len);
2776ece7053SIgor Mammedov Aml *aml_word_io(AmlMinFixed min_fixed, AmlMaxFixed max_fixed,
2786ece7053SIgor Mammedov                  AmlDecode dec, AmlISARanges isa_ranges,
2796ece7053SIgor Mammedov                  uint16_t addr_gran, uint16_t addr_min,
2806ece7053SIgor Mammedov                  uint16_t addr_max, uint16_t addr_trans,
2816ece7053SIgor Mammedov                  uint16_t len);
282616ef329SShannon Zhao Aml *aml_dword_io(AmlMinFixed min_fixed, AmlMaxFixed max_fixed,
283616ef329SShannon Zhao                  AmlDecode dec, AmlISARanges isa_ranges,
284616ef329SShannon Zhao                  uint32_t addr_gran, uint32_t addr_min,
285616ef329SShannon Zhao                  uint32_t addr_max, uint32_t addr_trans,
286616ef329SShannon Zhao                  uint32_t len);
2876ece7053SIgor Mammedov Aml *aml_dword_memory(AmlDecode dec, AmlMinFixed min_fixed,
288ff80dc7fSShannon Zhao                       AmlMaxFixed max_fixed, AmlCacheable cacheable,
2896ece7053SIgor Mammedov                       AmlReadAndWrite read_and_write,
2906ece7053SIgor Mammedov                       uint32_t addr_gran, uint32_t addr_min,
2916ece7053SIgor Mammedov                       uint32_t addr_max, uint32_t addr_trans,
2926ece7053SIgor Mammedov                       uint32_t len);
2936ece7053SIgor Mammedov Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed,
294ff80dc7fSShannon Zhao                       AmlMaxFixed max_fixed, AmlCacheable cacheable,
2956ece7053SIgor Mammedov                       AmlReadAndWrite read_and_write,
2966ece7053SIgor Mammedov                       uint64_t addr_gran, uint64_t addr_min,
2976ece7053SIgor Mammedov                       uint64_t addr_max, uint64_t addr_trans,
2986ece7053SIgor Mammedov                       uint64_t len);
299*0073518dSIgor Mammedov Aml *aml_sleep(uint64_t msec);
3003c054bd5SIgor Mammedov 
3012ef7c27bSIgor Mammedov /* Block AML object primitives */
3022ef7c27bSIgor Mammedov Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
303be06ebd0SIgor Mammedov Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
3044dbfc881SXiao Guangrong Aml *aml_method(const char *name, int arg_count, AmlSerializeFlag sflag);
30532acac9eSIgor Mammedov Aml *aml_if(Aml *predicate);
306467b07dfSShannon Zhao Aml *aml_else(void);
30768e6b0afSMarcel Apfelbaum Aml *aml_while(Aml *predicate);
3083bfa74a7SIgor Mammedov Aml *aml_package(uint8_t num_elements);
309ed8b5847SShannon Zhao Aml *aml_buffer(int buffer_size, uint8_t *byte_list);
310ad4a80bcSIgor Mammedov Aml *aml_resource_template(void);
311af509897SZhu Guihua Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule);
3126e1db3f2SXiao Guangrong Aml *aml_mutex(const char *name, uint8_t sync_level);
3136e1db3f2SXiao Guangrong Aml *aml_acquire(Aml *mutex, uint16_t timeout);
3146e1db3f2SXiao Guangrong Aml *aml_release(Aml *mutex);
31567a5c0faSIgor Mammedov Aml *aml_alias(const char *source_object, const char *alias_object);
316ed8176a3SShannon Zhao Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name);
3177e192a38SIgor Mammedov Aml *aml_create_qword_field(Aml *srcbuf, Aml *index, const char *name);
318a678508eSIgor Mammedov Aml *aml_varpackage(uint32_t num_elements);
319b930fb9dSShannon Zhao Aml *aml_touuid(const char *uuid);
320e1f776c4SShannon Zhao Aml *aml_unicode(const char *str);
32195cb0661SXiao Guangrong Aml *aml_derefof(Aml *arg);
32252483d14SXiao Guangrong Aml *aml_sizeof(Aml *arg);
3232ef7c27bSIgor Mammedov 
324658c2718SShannon Zhao void
325658c2718SShannon Zhao build_header(GArray *linker, GArray *table_data,
3268870ca0eSXiao Guangrong              AcpiTableHeader *h, const char *sig, int len, uint8_t rev,
3278870ca0eSXiao Guangrong              const char *oem_table_id);
328658c2718SShannon Zhao void *acpi_data_push(GArray *table_data, unsigned size);
329658c2718SShannon Zhao unsigned acpi_data_len(GArray *table);
330658c2718SShannon Zhao void acpi_add_table(GArray *table_offsets, GArray *table_data);
331658c2718SShannon Zhao void acpi_build_tables_init(AcpiBuildTables *tables);
332658c2718SShannon Zhao void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre);
333243bdb79SShannon Zhao void
334243bdb79SShannon Zhao build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets);
335658c2718SShannon Zhao 
33619934e0eSIgor Mammedov #endif
337