aboutsummaryrefslogtreecommitdiff
path: root/include/hw/acpi/aml-build.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/hw/acpi/aml-build.h')
-rw-r--r--include/hw/acpi/aml-build.h41
1 files changed, 38 insertions, 3 deletions
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 17d3beb5a3..3947201fd1 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -4,6 +4,18 @@
#include <stdint.h>
#include <glib.h>
#include "qemu/compiler.h"
+#include "hw/acpi/acpi-defs.h"
+
+/* Reserve RAM space for tables: add another order of magnitude. */
+#define ACPI_BUILD_TABLE_MAX_SIZE 0x200000
+
+#define ACPI_BUILD_APPNAME "Bochs"
+#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"
typedef enum {
AML_NO_OPCODE = 0,/* has only data */
@@ -35,7 +47,13 @@ typedef enum {
aml_dword_acc = 3,
aml_qword_acc = 4,
aml_buffer_acc = 5,
-} AmlFieldFlags;
+} AmlAccessType;
+
+typedef enum {
+ aml_preserve = 0,
+ aml_write_as_ones = 1,
+ aml_write_as_zeros = 2,
+} AmlUpdateRule;
typedef enum {
aml_system_memory = 0x00,
@@ -93,6 +111,14 @@ typedef enum {
aml_ReadWrite = 1,
} AmlReadAndWrite;
+typedef
+struct AcpiBuildTables {
+ GArray *table_data;
+ GArray *rsdp;
+ GArray *tcpalog;
+ GArray *linker;
+} AcpiBuildTables;
+
/**
* init_aml_allocator:
*
@@ -120,7 +146,7 @@ void free_aml_allocator(void);
* Joins Aml elements together and helps to construct AML tables
* Examle of usage:
* Aml *table = aml_def_block("SSDT", ...);
- * Aml *sb = aml_scope("\_SB");
+ * Aml *sb = aml_scope("\\_SB");
* Aml *dev = aml_device("PCI0");
*
* aml_append(dev, aml_name_decl("HID", aml_eisaid("PNP0A03")));
@@ -185,7 +211,16 @@ Aml *aml_if(Aml *predicate);
Aml *aml_package(uint8_t num_elements);
Aml *aml_buffer(void);
Aml *aml_resource_template(void);
-Aml *aml_field(const char *name, AmlFieldFlags flags);
+Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule);
Aml *aml_varpackage(uint32_t num_elements);
+void
+build_header(GArray *linker, GArray *table_data,
+ AcpiTableHeader *h, const char *sig, int len, uint8_t rev);
+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);
+
#endif