@@ -47,6 +47,7 @@ static int acpi_checksum(const uint8_t *data, int len)
int acpi_table_add(const char *t)
{
static const char *dfl_id = "QEMUQEMU";
+ bool load_header = false;
char buf[1024], *p, *f;
struct acpi_table_header acpi_hdr;
unsigned long val;
@@ -54,6 +55,17 @@ int acpi_table_add(const char *t)
struct acpi_table_header *acpi_hdr_p;
size_t off;
+ if (strncmp(t, "load_header", strlen("load_header")) == 0) {
+ /* the files includes acpi header to load.
+ * the acpi header options, sig, rev, ... will be ignored.
+ */
+ load_header = true;
+ t += strlen("load_header");
+ if (*t == ',') {
+ t++;
+ }
+ }
+
memset(&acpi_hdr, 0, sizeof(acpi_hdr));
if (get_param_value(buf, sizeof(buf), "sig", t)) {
@@ -110,7 +122,11 @@ int acpi_table_add(const char *t)
buf[0] = '\0';
}
- length = sizeof(acpi_hdr);
+ if (load_header) {
+ length = 0;
+ } else {
+ length = sizeof(acpi_hdr);
+ }
f = buf;
while (buf[0]) {
@@ -140,8 +156,12 @@ int acpi_table_add(const char *t)
*(uint16_t*)p = cpu_to_le32(length);
p += sizeof(uint16_t);
- memcpy(p, &acpi_hdr, sizeof(acpi_hdr));
- off = sizeof(acpi_hdr);
+ if (load_header) {
+ off = 0;
+ } else {
+ off = sizeof(acpi_hdr);
+ memcpy(p, &acpi_hdr, sizeof(acpi_hdr));
+ }
f = buf;
while (buf[0]) {
@@ -981,9 +981,11 @@ ETEXI
DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable,
"-acpitable [sig=str][,rev=n][,oem_id=str][,oem_table_id=str][,oem_rev=n][,asl_compiler_id=str][,asl_compiler_rev=n][,data=file1[:file2]...]\n"
+ "-acpitable [load_header][,data=file1[:file2]...]\n"
" ACPI table description\n", QEMU_ARCH_I386)
STEXI
@item -acpitable [sig=@var{str}][,rev=@var{n}][,oem_id=@var{str}][,oem_table_id=@var{str}][,oem_rev=@var{n}] [,asl_compiler_id=@var{str}][,asl_compiler_rev=@var{n}][,data=@var{file1}[:@var{file2}]...]
+@item -acpitable [load_header][,data=@var{file1}[:@var{file2}]...]
@findex -acpitable
Add ACPI table with specified header fields and context from specified files.
ETEXI