Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/acpi.c
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
#define EFPRINTF(...) \ | #define EFPRINTF(...) \ | ||||
if (fprintf(__VA_ARGS__) < 0) goto err_exit; | if (fprintf(__VA_ARGS__) < 0) goto err_exit; | ||||
#define EFFLUSH(x) \ | #define EFFLUSH(x) \ | ||||
if (fflush(x) != 0) goto err_exit; | if (fflush(x) != 0) goto err_exit; | ||||
/* | |||||
* A list for additional ACPI devices like a TPM. | |||||
*/ | |||||
struct acpi_device_list_entry { | |||||
SLIST_ENTRY(acpi_device_list_entry) chain; | |||||
const struct acpi_device *dev; | |||||
}; | |||||
SLIST_HEAD(acpi_device_list, | |||||
acpi_device_list_entry) acpi_devices = SLIST_HEAD_INITIALIZER(acpi_devices); | |||||
int | |||||
acpi_tables_add_device(const struct acpi_device *const dev) | |||||
{ | |||||
struct acpi_device_list_entry *const entry = calloc(1, sizeof(*entry)); | |||||
if (entry == NULL) { | |||||
return (ENOMEM); | |||||
} | |||||
entry->dev = dev; | |||||
SLIST_INSERT_HEAD(&acpi_devices, entry, chain); | |||||
return (0); | |||||
} | |||||
static int | static int | ||||
basl_fwrite_rsdp(FILE *fp) | basl_fwrite_rsdp(FILE *fp) | ||||
{ | { | ||||
EFPRINTF(fp, "/*\n"); | EFPRINTF(fp, "/*\n"); | ||||
EFPRINTF(fp, " * bhyve RSDP template\n"); | EFPRINTF(fp, " * bhyve RSDP template\n"); | ||||
EFPRINTF(fp, " */\n"); | EFPRINTF(fp, " */\n"); | ||||
EFPRINTF(fp, "[0008]\t\tSignature : \"RSD PTR \"\n"); | EFPRINTF(fp, "[0008]\t\tSignature : \"RSD PTR \"\n"); | ||||
EFPRINTF(fp, "[0001]\t\tChecksum : 43\n"); | EFPRINTF(fp, "[0001]\t\tChecksum : 43\n"); | ||||
▲ Show 20 Lines • Show All 604 Lines • ▼ Show 20 Lines | basl_fwrite_dsdt(FILE *fp) | ||||
dsdt_indent(4); | dsdt_indent(4); | ||||
dsdt_fixed_mem32(0xFED00000, 0x400); | dsdt_fixed_mem32(0xFED00000, 0x400); | ||||
dsdt_unindent(4); | dsdt_unindent(4); | ||||
dsdt_line(" })"); | dsdt_line(" })"); | ||||
dsdt_line(" }"); | dsdt_line(" }"); | ||||
dsdt_line(" }"); | dsdt_line(" }"); | ||||
vmgenc_write_dsdt(); | vmgenc_write_dsdt(); | ||||
const struct acpi_device_list_entry *entry; | |||||
SLIST_FOREACH(entry, &acpi_devices, chain) { | |||||
acpi_device_write_dsdt(entry->dev); | |||||
} | |||||
dsdt_line("}"); | dsdt_line("}"); | ||||
if (dsdt_error != 0) | if (dsdt_error != 0) | ||||
return (dsdt_error); | return (dsdt_error); | ||||
EFFLUSH(fp); | EFFLUSH(fp); | ||||
▲ Show 20 Lines • Show All 234 Lines • Show Last 20 Lines |