2016-06-29 11:12:57 +03:00
|
|
|
#ifndef HW_ACPI_AML_BUILD_H
|
|
|
|
#define HW_ACPI_AML_BUILD_H
|
2015-01-30 16:29:36 +03:00
|
|
|
|
2015-04-03 13:03:34 +03:00
|
|
|
#include "hw/acpi/acpi-defs.h"
|
2016-05-19 16:19:25 +03:00
|
|
|
#include "hw/acpi/bios-linker-loader.h"
|
2015-04-03 13:03:34 +03:00
|
|
|
|
|
|
|
/* Reserve RAM space for tables: add another order of magnitude. */
|
|
|
|
#define ACPI_BUILD_TABLE_MAX_SIZE 0x200000
|
|
|
|
|
|
|
|
#define ACPI_BUILD_APPNAME6 "BOCHS "
|
|
|
|
#define ACPI_BUILD_APPNAME4 "BXPC"
|
|
|
|
|
|
|
|
#define ACPI_BUILD_TABLE_FILE "etc/acpi/tables"
|
|
|
|
#define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp"
|
|
|
|
#define ACPI_BUILD_TPMLOG_FILE "etc/tpm/log"
|
2015-01-30 16:29:36 +03:00
|
|
|
|
2015-12-28 20:02:26 +03:00
|
|
|
#define AML_NOTIFY_METHOD "NTFY"
|
|
|
|
|
2015-02-18 22:14:14 +03:00
|
|
|
typedef enum {
|
|
|
|
AML_NO_OPCODE = 0,/* has only data */
|
|
|
|
AML_OPCODE, /* has opcode optionally followed by data */
|
|
|
|
AML_PACKAGE, /* has opcode and uses PkgLength for its length */
|
2015-03-08 12:36:52 +03:00
|
|
|
AML_EXT_PACKAGE, /* Same as AML_PACKAGE but also has 'ExOpPrefix' */
|
2015-02-18 22:14:14 +03:00
|
|
|
AML_BUFFER, /* data encoded as 'DefBuffer' */
|
|
|
|
AML_RES_TEMPLATE, /* encoded as ResourceTemplate macro */
|
|
|
|
} AmlBlockFlags;
|
|
|
|
|
|
|
|
struct Aml {
|
|
|
|
GArray *buf;
|
|
|
|
|
|
|
|
/*< private >*/
|
|
|
|
uint8_t op;
|
|
|
|
AmlBlockFlags block_flags;
|
|
|
|
};
|
|
|
|
typedef struct Aml Aml;
|
|
|
|
|
2015-12-10 02:41:15 +03:00
|
|
|
typedef enum {
|
|
|
|
AML_COMPATIBILITY = 0,
|
|
|
|
AML_TYPEA = 1,
|
|
|
|
AML_TYPEB = 2,
|
|
|
|
AML_TYPEF = 3,
|
|
|
|
} AmlDmaType;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
AML_NOTBUSMASTER = 0,
|
|
|
|
AML_BUSMASTER = 1,
|
|
|
|
} AmlDmaBusMaster;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
AML_TRANSFER8 = 0,
|
|
|
|
AML_TRANSFER8_16 = 1,
|
|
|
|
AML_TRANSFER16 = 2,
|
|
|
|
} AmlTransferSize;
|
|
|
|
|
2015-02-18 22:14:32 +03:00
|
|
|
typedef enum {
|
2015-05-29 13:28:54 +03:00
|
|
|
AML_DECODE10 = 0,
|
|
|
|
AML_DECODE16 = 1,
|
2015-02-18 22:14:32 +03:00
|
|
|
} AmlIODecode;
|
|
|
|
|
2015-02-18 22:14:35 +03:00
|
|
|
typedef enum {
|
2015-05-29 13:28:54 +03:00
|
|
|
AML_ANY_ACC = 0,
|
|
|
|
AML_BYTE_ACC = 1,
|
|
|
|
AML_WORD_ACC = 2,
|
|
|
|
AML_DWORD_ACC = 3,
|
|
|
|
AML_QWORD_ACC = 4,
|
|
|
|
AML_BUFFER_ACC = 5,
|
2015-04-27 11:47:19 +03:00
|
|
|
} AmlAccessType;
|
|
|
|
|
2015-12-10 02:41:12 +03:00
|
|
|
typedef enum {
|
|
|
|
AML_NOLOCK = 0,
|
|
|
|
AML_LOCK = 1,
|
|
|
|
} AmlLockRule;
|
|
|
|
|
2015-04-27 11:47:19 +03:00
|
|
|
typedef enum {
|
2015-05-29 13:28:54 +03:00
|
|
|
AML_PRESERVE = 0,
|
|
|
|
AML_WRITE_AS_ONES = 1,
|
|
|
|
AML_WRITE_AS_ZEROS = 2,
|
2015-04-27 11:47:19 +03:00
|
|
|
} AmlUpdateRule;
|
2015-02-18 22:14:35 +03:00
|
|
|
|
2018-02-28 17:23:49 +03:00
|
|
|
typedef enum {
|
|
|
|
AML_AS_SYSTEM_MEMORY = 0X00,
|
|
|
|
AML_AS_SYSTEM_IO = 0X01,
|
|
|
|
AML_AS_PCI_CONFIG = 0X02,
|
|
|
|
AML_AS_EMBEDDED_CTRL = 0X03,
|
|
|
|
AML_AS_SMBUS = 0X04,
|
|
|
|
AML_AS_FFH = 0X7F,
|
|
|
|
} AmlAddressSpace;
|
|
|
|
|
2015-02-18 22:14:34 +03:00
|
|
|
typedef enum {
|
2015-05-29 13:28:54 +03:00
|
|
|
AML_SYSTEM_MEMORY = 0X00,
|
|
|
|
AML_SYSTEM_IO = 0X01,
|
2015-12-28 20:02:37 +03:00
|
|
|
AML_PCI_CONFIG = 0X02,
|
2015-02-18 22:14:34 +03:00
|
|
|
} AmlRegionSpace;
|
|
|
|
|
2015-02-18 22:14:48 +03:00
|
|
|
typedef enum {
|
2015-05-29 13:28:54 +03:00
|
|
|
AML_MEMORY_RANGE = 0,
|
|
|
|
AML_IO_RANGE = 1,
|
|
|
|
AML_BUS_NUMBER_RANGE = 2,
|
2015-02-18 22:14:48 +03:00
|
|
|
} AmlResourceType;
|
|
|
|
|
|
|
|
typedef enum {
|
2015-05-29 13:28:54 +03:00
|
|
|
AML_SUB_DECODE = 1 << 1,
|
|
|
|
AML_POS_DECODE = 0
|
2015-02-18 22:14:48 +03:00
|
|
|
} AmlDecode;
|
|
|
|
|
|
|
|
typedef enum {
|
2015-05-29 13:28:54 +03:00
|
|
|
AML_MAX_FIXED = 1 << 3,
|
|
|
|
AML_MAX_NOT_FIXED = 0,
|
2015-02-18 22:14:48 +03:00
|
|
|
} AmlMaxFixed;
|
|
|
|
|
|
|
|
typedef enum {
|
2015-05-29 13:28:54 +03:00
|
|
|
AML_MIN_FIXED = 1 << 2,
|
|
|
|
AML_MIN_NOT_FIXED = 0
|
2015-02-18 22:14:48 +03:00
|
|
|
} AmlMinFixed;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ACPI 1.0b: Table 6-26 I/O Resource Flag (Resource Type = 1) Definitions
|
|
|
|
* _RNG field definition
|
|
|
|
*/
|
|
|
|
typedef enum {
|
2015-05-29 13:28:54 +03:00
|
|
|
AML_ISA_ONLY = 1,
|
|
|
|
AML_NON_ISA_ONLY = 2,
|
|
|
|
AML_ENTIRE_RANGE = 3,
|
2015-02-18 22:14:48 +03:00
|
|
|
} AmlISARanges;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ACPI 1.0b: Table 6-25 Memory Resource Flag (Resource Type = 0) Definitions
|
|
|
|
* _MEM field definition
|
|
|
|
*/
|
|
|
|
typedef enum {
|
2015-05-29 13:28:54 +03:00
|
|
|
AML_NON_CACHEABLE = 0,
|
|
|
|
AML_CACHEABLE = 1,
|
|
|
|
AML_WRITE_COMBINING = 2,
|
|
|
|
AML_PREFETCHABLE = 3,
|
|
|
|
} AmlCacheable;
|
2015-02-18 22:14:48 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ACPI 1.0b: Table 6-25 Memory Resource Flag (Resource Type = 0) Definitions
|
|
|
|
* _RW field definition
|
|
|
|
*/
|
|
|
|
typedef enum {
|
2015-05-29 13:28:54 +03:00
|
|
|
AML_READ_ONLY = 0,
|
|
|
|
AML_READ_WRITE = 1,
|
2015-02-18 22:14:48 +03:00
|
|
|
} AmlReadAndWrite;
|
|
|
|
|
2015-05-29 13:28:55 +03:00
|
|
|
/*
|
|
|
|
* ACPI 5.0: Table 6-187 Extended Interrupt Descriptor Definition
|
|
|
|
* Interrupt Vector Flags Bits[0] Consumer/Producer
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
AML_CONSUMER_PRODUCER = 0,
|
|
|
|
AML_CONSUMER = 1,
|
|
|
|
} AmlConsumerAndProducer;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ACPI 5.0: Table 6-187 Extended Interrupt Descriptor Definition
|
|
|
|
* _HE field definition
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
AML_LEVEL = 0,
|
|
|
|
AML_EDGE = 1,
|
|
|
|
} AmlLevelAndEdge;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ACPI 5.0: Table 6-187 Extended Interrupt Descriptor Definition
|
|
|
|
* _LL field definition
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
AML_ACTIVE_HIGH = 0,
|
|
|
|
AML_ACTIVE_LOW = 1,
|
|
|
|
} AmlActiveHighAndLow;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ACPI 5.0: Table 6-187 Extended Interrupt Descriptor Definition
|
|
|
|
* _SHR field definition
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
AML_EXCLUSIVE = 0,
|
|
|
|
AML_SHARED = 1,
|
|
|
|
AML_EXCLUSIVE_AND_WAKE = 2,
|
|
|
|
AML_SHARED_AND_WAKE = 3,
|
|
|
|
} AmlShared;
|
|
|
|
|
2015-12-17 16:37:13 +03:00
|
|
|
/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: MethodFlags */
|
|
|
|
typedef enum {
|
|
|
|
AML_NOTSERIALIZED = 0,
|
|
|
|
AML_SERIALIZED = 1,
|
|
|
|
} AmlSerializeFlag;
|
|
|
|
|
2015-12-17 16:37:14 +03:00
|
|
|
/*
|
|
|
|
* ACPI 5.0: Table 6-189 GPIO Connection Descriptor Definition
|
|
|
|
* GPIO Connection Type
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
AML_INTERRUPT_CONNECTION = 0,
|
|
|
|
AML_IO_CONNECTION = 1,
|
|
|
|
} AmlGpioConnectionType;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ACPI 5.0: Table 6-189 GPIO Connection Descriptor Definition
|
|
|
|
* _PPI field definition
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
AML_PULL_DEFAULT = 0,
|
|
|
|
AML_PULL_UP = 1,
|
|
|
|
AML_PULL_DOWN = 2,
|
|
|
|
AML_PULL_NONE = 3,
|
|
|
|
} AmlPinConfig;
|
|
|
|
|
2016-05-12 15:22:28 +03:00
|
|
|
typedef enum {
|
|
|
|
MEM_AFFINITY_NOFLAGS = 0,
|
|
|
|
MEM_AFFINITY_ENABLED = (1 << 0),
|
|
|
|
MEM_AFFINITY_HOTPLUGGABLE = (1 << 1),
|
|
|
|
MEM_AFFINITY_NON_VOLATILE = (1 << 2),
|
|
|
|
} MemoryAffinityFlags;
|
|
|
|
|
2015-04-03 13:03:34 +03:00
|
|
|
typedef
|
|
|
|
struct AcpiBuildTables {
|
|
|
|
GArray *table_data;
|
|
|
|
GArray *rsdp;
|
|
|
|
GArray *tcpalog;
|
2017-02-17 02:15:35 +03:00
|
|
|
GArray *vmgenid;
|
2016-05-19 16:19:25 +03:00
|
|
|
BIOSLinker *linker;
|
2015-04-03 13:03:34 +03:00
|
|
|
} AcpiBuildTables;
|
|
|
|
|
2015-02-18 22:14:14 +03:00
|
|
|
/**
|
|
|
|
* init_aml_allocator:
|
|
|
|
*
|
|
|
|
* Called for initializing API allocator which allow to use
|
|
|
|
* AML API.
|
|
|
|
* Returns: toplevel container which accumulates all other
|
|
|
|
* AML elements for a table.
|
|
|
|
*/
|
|
|
|
Aml *init_aml_allocator(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* free_aml_allocator:
|
|
|
|
*
|
|
|
|
* Releases all elements used by AML API, frees associated memory
|
|
|
|
* and invalidates AML allocator. After this call @init_aml_allocator
|
|
|
|
* should be called again if AML API is to be used again.
|
|
|
|
*/
|
|
|
|
void free_aml_allocator(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* aml_append:
|
|
|
|
* @parent_ctx: context to which @child element is added
|
|
|
|
* @child: element that is copied into @parent_ctx context
|
|
|
|
*
|
|
|
|
* Joins Aml elements together and helps to construct AML tables
|
|
|
|
* Examle of usage:
|
|
|
|
* Aml *table = aml_def_block("SSDT", ...);
|
2015-04-21 11:26:12 +03:00
|
|
|
* Aml *sb = aml_scope("\\_SB");
|
2015-02-18 22:14:14 +03:00
|
|
|
* Aml *dev = aml_device("PCI0");
|
|
|
|
*
|
|
|
|
* aml_append(dev, aml_name_decl("HID", aml_eisaid("PNP0A03")));
|
|
|
|
* aml_append(sb, dev);
|
|
|
|
* aml_append(table, sb);
|
|
|
|
*/
|
|
|
|
void aml_append(Aml *parent_ctx, Aml *child);
|
|
|
|
|
2015-02-18 22:14:20 +03:00
|
|
|
/* non block AML object primitives */
|
|
|
|
Aml *aml_name(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
|
|
|
|
Aml *aml_name_decl(const char *name, Aml *val);
|
2016-05-17 17:42:54 +03:00
|
|
|
Aml *aml_debug(void);
|
2015-02-18 22:14:22 +03:00
|
|
|
Aml *aml_return(Aml *val);
|
2015-02-18 22:14:21 +03:00
|
|
|
Aml *aml_int(const uint64_t val);
|
2015-02-18 22:14:23 +03:00
|
|
|
Aml *aml_arg(int pos);
|
2015-12-10 02:41:05 +03:00
|
|
|
Aml *aml_to_integer(Aml *arg);
|
2015-12-10 02:41:13 +03:00
|
|
|
Aml *aml_to_hexstring(Aml *src, Aml *dst);
|
2015-12-10 02:41:14 +03:00
|
|
|
Aml *aml_to_buffer(Aml *src, Aml *dst);
|
2015-02-18 22:14:24 +03:00
|
|
|
Aml *aml_store(Aml *val, Aml *target);
|
2015-12-10 02:41:17 +03:00
|
|
|
Aml *aml_and(Aml *arg1, Aml *arg2, Aml *dst);
|
2015-12-10 02:41:16 +03:00
|
|
|
Aml *aml_or(Aml *arg1, Aml *arg2, Aml *dst);
|
2015-12-10 02:41:10 +03:00
|
|
|
Aml *aml_lor(Aml *arg1, Aml *arg2);
|
2015-05-25 18:33:43 +03:00
|
|
|
Aml *aml_shiftleft(Aml *arg1, Aml *count);
|
2015-12-10 02:41:06 +03:00
|
|
|
Aml *aml_shiftright(Aml *arg1, Aml *count, Aml *dst);
|
2015-05-25 18:33:41 +03:00
|
|
|
Aml *aml_lless(Aml *arg1, Aml *arg2);
|
2015-12-10 02:41:02 +03:00
|
|
|
Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst);
|
2015-12-10 02:41:03 +03:00
|
|
|
Aml *aml_subtract(Aml *arg1, Aml *arg2, Aml *dst);
|
2015-05-25 18:33:45 +03:00
|
|
|
Aml *aml_increment(Aml *arg);
|
2015-12-10 02:41:03 +03:00
|
|
|
Aml *aml_decrement(Aml *arg);
|
2015-05-25 18:33:42 +03:00
|
|
|
Aml *aml_index(Aml *arg1, Aml *idx);
|
2015-02-18 22:14:26 +03:00
|
|
|
Aml *aml_notify(Aml *arg1, Aml *arg2);
|
2015-12-10 02:41:04 +03:00
|
|
|
Aml *aml_call0(const char *method);
|
2015-02-18 22:14:27 +03:00
|
|
|
Aml *aml_call1(const char *method, Aml *arg1);
|
|
|
|
Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2);
|
|
|
|
Aml *aml_call3(const char *method, Aml *arg1, Aml *arg2, Aml *arg3);
|
|
|
|
Aml *aml_call4(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *arg4);
|
2016-06-07 15:22:00 +03:00
|
|
|
Aml *aml_call5(const char *method, Aml *arg1, Aml *arg2, Aml *arg3, Aml *arg4,
|
|
|
|
Aml *arg5);
|
2015-12-17 16:37:14 +03:00
|
|
|
Aml *aml_gpio_int(AmlConsumerAndProducer con_and_pro,
|
|
|
|
AmlLevelAndEdge edge_level,
|
|
|
|
AmlActiveHighAndLow active_level, AmlShared shared,
|
|
|
|
AmlPinConfig pin_config, uint16_t debounce_timeout,
|
|
|
|
const uint32_t pin_list[], uint32_t pin_count,
|
|
|
|
const char *resource_source_name,
|
|
|
|
const uint8_t *vendor_data, uint16_t vendor_data_len);
|
2015-05-29 13:28:55 +03:00
|
|
|
Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
|
|
|
|
AmlReadAndWrite read_and_write);
|
2015-05-29 13:28:55 +03:00
|
|
|
Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
|
|
|
|
AmlLevelAndEdge level_and_edge,
|
|
|
|
AmlActiveHighAndLow high_and_low, AmlShared shared,
|
2015-12-17 16:37:13 +03:00
|
|
|
uint32_t *irq_list, uint8_t irq_count);
|
2015-02-18 22:14:32 +03:00
|
|
|
Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
|
|
|
|
uint8_t aln, uint8_t len);
|
2015-02-18 22:14:34 +03:00
|
|
|
Aml *aml_operation_region(const char *name, AmlRegionSpace rs,
|
2016-03-01 13:56:05 +03:00
|
|
|
Aml *offset, uint32_t len);
|
2015-02-20 21:22:10 +03:00
|
|
|
Aml *aml_irq_no_flags(uint8_t irq);
|
2015-02-18 22:14:35 +03:00
|
|
|
Aml *aml_named_field(const char *name, unsigned length);
|
2015-02-18 22:14:45 +03:00
|
|
|
Aml *aml_reserved_field(unsigned length);
|
2015-02-18 22:14:36 +03:00
|
|
|
Aml *aml_local(int num);
|
2015-02-18 22:14:37 +03:00
|
|
|
Aml *aml_string(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
|
2015-05-29 13:28:58 +03:00
|
|
|
Aml *aml_lnot(Aml *arg);
|
2015-02-18 22:14:40 +03:00
|
|
|
Aml *aml_equal(Aml *arg1, Aml *arg2);
|
2015-12-10 02:41:11 +03:00
|
|
|
Aml *aml_lgreater(Aml *arg1, Aml *arg2);
|
2015-12-10 02:40:58 +03:00
|
|
|
Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2);
|
2015-02-18 22:14:41 +03:00
|
|
|
Aml *aml_processor(uint8_t proc_id, uint32_t pblk_addr, uint8_t pblk_len,
|
|
|
|
const char *name_format, ...) GCC_FMT_ATTR(4, 5);
|
2015-02-18 22:14:42 +03:00
|
|
|
Aml *aml_eisaid(const char *str);
|
2015-02-18 22:14:48 +03:00
|
|
|
Aml *aml_word_bus_number(AmlMinFixed min_fixed, AmlMaxFixed max_fixed,
|
|
|
|
AmlDecode dec, uint16_t addr_gran,
|
|
|
|
uint16_t addr_min, uint16_t addr_max,
|
|
|
|
uint16_t addr_trans, uint16_t len);
|
|
|
|
Aml *aml_word_io(AmlMinFixed min_fixed, AmlMaxFixed max_fixed,
|
|
|
|
AmlDecode dec, AmlISARanges isa_ranges,
|
|
|
|
uint16_t addr_gran, uint16_t addr_min,
|
|
|
|
uint16_t addr_max, uint16_t addr_trans,
|
|
|
|
uint16_t len);
|
2015-05-29 13:28:58 +03:00
|
|
|
Aml *aml_dword_io(AmlMinFixed min_fixed, AmlMaxFixed max_fixed,
|
|
|
|
AmlDecode dec, AmlISARanges isa_ranges,
|
|
|
|
uint32_t addr_gran, uint32_t addr_min,
|
|
|
|
uint32_t addr_max, uint32_t addr_trans,
|
|
|
|
uint32_t len);
|
2015-02-18 22:14:48 +03:00
|
|
|
Aml *aml_dword_memory(AmlDecode dec, AmlMinFixed min_fixed,
|
2015-05-29 13:28:54 +03:00
|
|
|
AmlMaxFixed max_fixed, AmlCacheable cacheable,
|
2015-02-18 22:14:48 +03:00
|
|
|
AmlReadAndWrite read_and_write,
|
|
|
|
uint32_t addr_gran, uint32_t addr_min,
|
|
|
|
uint32_t addr_max, uint32_t addr_trans,
|
|
|
|
uint32_t len);
|
|
|
|
Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed,
|
2015-05-29 13:28:54 +03:00
|
|
|
AmlMaxFixed max_fixed, AmlCacheable cacheable,
|
2015-02-18 22:14:48 +03:00
|
|
|
AmlReadAndWrite read_and_write,
|
|
|
|
uint64_t addr_gran, uint64_t addr_min,
|
|
|
|
uint64_t addr_max, uint64_t addr_trans,
|
|
|
|
uint64_t len);
|
2015-12-10 02:41:15 +03:00
|
|
|
Aml *aml_dma(AmlDmaType typ, AmlDmaBusMaster bm, AmlTransferSize sz,
|
|
|
|
uint8_t channel);
|
2015-12-10 02:41:08 +03:00
|
|
|
Aml *aml_sleep(uint64_t msec);
|
2015-02-18 22:14:20 +03:00
|
|
|
|
2015-02-18 22:14:15 +03:00
|
|
|
/* Block AML object primitives */
|
|
|
|
Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
|
2015-02-18 22:14:17 +03:00
|
|
|
Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
|
2015-12-17 16:37:13 +03:00
|
|
|
Aml *aml_method(const char *name, int arg_count, AmlSerializeFlag sflag);
|
2015-02-18 22:14:19 +03:00
|
|
|
Aml *aml_if(Aml *predicate);
|
2015-05-29 13:28:58 +03:00
|
|
|
Aml *aml_else(void);
|
2015-05-25 18:33:46 +03:00
|
|
|
Aml *aml_while(Aml *predicate);
|
2015-02-18 22:14:28 +03:00
|
|
|
Aml *aml_package(uint8_t num_elements);
|
2015-05-29 13:28:57 +03:00
|
|
|
Aml *aml_buffer(int buffer_size, uint8_t *byte_list);
|
2015-02-18 22:14:31 +03:00
|
|
|
Aml *aml_resource_template(void);
|
2015-12-10 02:41:12 +03:00
|
|
|
Aml *aml_field(const char *name, AmlAccessType type, AmlLockRule lock,
|
|
|
|
AmlUpdateRule rule);
|
2015-12-10 02:40:59 +03:00
|
|
|
Aml *aml_mutex(const char *name, uint8_t sync_level);
|
|
|
|
Aml *aml_acquire(Aml *mutex, uint16_t timeout);
|
|
|
|
Aml *aml_release(Aml *mutex);
|
2015-12-10 02:41:07 +03:00
|
|
|
Aml *aml_alias(const char *source_object, const char *alias_object);
|
2016-03-01 13:56:03 +03:00
|
|
|
Aml *aml_create_field(Aml *srcbuf, Aml *bit_index, Aml *num_bits,
|
|
|
|
const char *name);
|
2015-05-29 13:28:58 +03:00
|
|
|
Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name);
|
2015-12-10 02:41:00 +03:00
|
|
|
Aml *aml_create_qword_field(Aml *srcbuf, Aml *index, const char *name);
|
2015-02-18 22:14:39 +03:00
|
|
|
Aml *aml_varpackage(uint32_t num_elements);
|
2015-05-29 13:28:57 +03:00
|
|
|
Aml *aml_touuid(const char *uuid);
|
2015-05-29 13:28:59 +03:00
|
|
|
Aml *aml_unicode(const char *str);
|
2016-05-17 17:42:55 +03:00
|
|
|
Aml *aml_refof(Aml *arg);
|
2015-12-10 02:40:56 +03:00
|
|
|
Aml *aml_derefof(Aml *arg);
|
2015-12-10 02:40:57 +03:00
|
|
|
Aml *aml_sizeof(Aml *arg);
|
2016-03-01 13:56:04 +03:00
|
|
|
Aml *aml_concatenate(Aml *source1, Aml *source2, Aml *target);
|
2016-06-07 15:21:59 +03:00
|
|
|
Aml *aml_object_type(Aml *object);
|
2015-02-18 22:14:15 +03:00
|
|
|
|
2016-09-20 18:42:34 +03:00
|
|
|
void build_append_int_noprefix(GArray *table, uint64_t value, int size);
|
2015-04-03 13:03:34 +03:00
|
|
|
void
|
2016-05-19 16:19:25 +03:00
|
|
|
build_header(BIOSLinker *linker, GArray *table_data,
|
2015-12-02 10:20:57 +03:00
|
|
|
AcpiTableHeader *h, const char *sig, int len, uint8_t rev,
|
2016-01-18 17:12:10 +03:00
|
|
|
const char *oem_id, const char *oem_table_id);
|
2015-04-03 13:03:34 +03:00
|
|
|
void *acpi_data_push(GArray *table_data, unsigned size);
|
|
|
|
unsigned acpi_data_len(GArray *table);
|
|
|
|
void acpi_add_table(GArray *table_offsets, GArray *table_data);
|
|
|
|
void acpi_build_tables_init(AcpiBuildTables *tables);
|
|
|
|
void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre);
|
2015-05-29 13:28:56 +03:00
|
|
|
void
|
2018-12-17 18:34:48 +03:00
|
|
|
build_rsdp(GArray *tbl, BIOSLinker *linker, AcpiRsdpData *rsdp_data);
|
|
|
|
void
|
2016-05-19 16:19:25 +03:00
|
|
|
build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,
|
2016-01-18 17:12:11 +03:00
|
|
|
const char *oem_id, const char *oem_table_id);
|
2017-04-10 18:03:50 +03:00
|
|
|
void
|
|
|
|
build_xsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,
|
|
|
|
const char *oem_id, const char *oem_table_id);
|
2015-04-03 13:03:34 +03:00
|
|
|
|
2016-03-01 13:56:07 +03:00
|
|
|
int
|
2016-03-16 22:43:37 +03:00
|
|
|
build_append_named_dword(GArray *array, const char *name_format, ...)
|
|
|
|
GCC_FMT_ATTR(2, 3);
|
2016-03-01 13:56:07 +03:00
|
|
|
|
2018-02-28 17:23:49 +03:00
|
|
|
void build_append_gas(GArray *table, AmlAddressSpace as,
|
|
|
|
uint8_t bit_width, uint8_t bit_offset,
|
|
|
|
uint8_t access_width, uint64_t address);
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
build_append_gas_from_struct(GArray *table, const struct AcpiGenericAddress *s)
|
|
|
|
{
|
|
|
|
build_append_gas(table, s->space_id, s->bit_width, s->bit_offset,
|
|
|
|
s->access_width, s->address);
|
|
|
|
}
|
|
|
|
|
2016-05-12 15:22:28 +03:00
|
|
|
void build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base,
|
|
|
|
uint64_t len, int node, MemoryAffinityFlags flags);
|
|
|
|
|
numa: Allow setting NUMA distance for different NUMA nodes
This patch is going to add SLIT table support in QEMU, and provides
additional option `dist` for command `-numa` to allow user set vNUMA
distance by QEMU command.
With this patch, when a user wants to create a guest that contains
several vNUMA nodes and also wants to set distance among those nodes,
the QEMU command would like:
```
-numa node,nodeid=0,cpus=0 \
-numa node,nodeid=1,cpus=1 \
-numa node,nodeid=2,cpus=2 \
-numa node,nodeid=3,cpus=3 \
-numa dist,src=0,dst=1,val=21 \
-numa dist,src=0,dst=2,val=31 \
-numa dist,src=0,dst=3,val=41 \
-numa dist,src=1,dst=2,val=21 \
-numa dist,src=1,dst=3,val=31 \
-numa dist,src=2,dst=3,val=21 \
```
Signed-off-by: He Chen <he.chen@linux.intel.com>
Message-Id: <1493260558-20728-1-git-send-email-he.chen@linux.intel.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2017-04-27 05:35:58 +03:00
|
|
|
void build_slit(GArray *table_data, BIOSLinker *linker);
|
2018-02-28 17:23:53 +03:00
|
|
|
|
|
|
|
void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f,
|
|
|
|
const char *oem_id, const char *oem_table_id);
|
2015-01-30 16:29:36 +03:00
|
|
|
#endif
|