Skip to content

Commit

Permalink
acpi: add function to extract oem_id and oem_table_id from the user's…
Browse files Browse the repository at this point in the history
… SLIC

The acpi_get_slic_oem() function stores pointers to these fields in the
(first) SLIC table that the user passes in with the -acpitable switch.

Cc: "Michael S. Tsirkin" <[email protected]> (supporter:ACPI/SMBIOS)
Cc: Igor Mammedov <[email protected]> (supporter:ACPI/SMBIOS)
Cc: Richard W.M. Jones <[email protected]>
Cc: Aleksei Kovura <[email protected]>
Cc: Michael Tokarev <[email protected]>
Cc: Steven Newbury <[email protected]>
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1248758
LP: https://bugs.launchpad.net/qemu/+bug/1533848
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Steven Newbury <[email protected]>
  • Loading branch information
lersek authored and mstsirkin committed Feb 6, 2016
1 parent 5151355 commit 88594e4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
16 changes: 16 additions & 0 deletions hw/acpi/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,22 @@ uint8_t *acpi_table_next(uint8_t *current)
}
}

int acpi_get_slic_oem(AcpiSlicOem *oem)
{
uint8_t *u;

for (u = acpi_table_first(); u; u = acpi_table_next(u)) {
struct acpi_table_header *hdr = (void *)(u - sizeof(hdr->_length));

if (memcmp(hdr->sig, "SLIC", 4) == 0) {
oem->id = hdr->oem_id;
oem->table_id = hdr->oem_table_id;
return 0;
}
}
return -1;
}

static void acpi_notify_wakeup(Notifier *notifier, void *data)
{
ACPIREGS *ar = container_of(notifier, ACPIREGS, wakeup);
Expand Down
7 changes: 7 additions & 0 deletions include/hw/acpi/acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,11 @@ unsigned acpi_table_len(void *current);
void acpi_table_add(const QemuOpts *opts, Error **errp);
void acpi_table_add_builtin(const QemuOpts *opts, Error **errp);

typedef struct AcpiSlicOem AcpiSlicOem;
struct AcpiSlicOem {
char *id;
char *table_id;
};
int acpi_get_slic_oem(AcpiSlicOem *oem);

#endif /* !QEMU_HW_ACPI_H */

0 comments on commit 88594e4

Please sign in to comment.