Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107331655
D40559.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D40559.diff
View Options
diff --git a/usr.sbin/bhyve/acpi.c b/usr.sbin/bhyve/acpi.c
--- a/usr.sbin/bhyve/acpi.c
+++ b/usr.sbin/bhyve/acpi.c
@@ -91,9 +91,6 @@
static int dsdt_indent_level;
static int dsdt_error;
-static struct basl_table *rsdt;
-static struct basl_table *xsdt;
-
struct basl_fio {
int fd;
FILE *fp;
@@ -532,10 +529,7 @@
BASL_EXEC(basl_table_add_pointer(table, ACPI_SIG_DSDT,
offsetof(ACPI_TABLE_FADT, XDsdt), sizeof(fadt.XDsdt)));
- BASL_EXEC(basl_table_append_pointer(rsdt, ACPI_SIG_FADT,
- ACPI_RSDT_ENTRY_SIZE));
- BASL_EXEC(basl_table_append_pointer(xsdt, ACPI_SIG_FADT,
- ACPI_XSDT_ENTRY_SIZE));
+ BASL_EXEC(basl_table_register_to_rsdt(table));
return (0);
}
@@ -557,10 +551,7 @@
hpet.Flags = ACPI_HPET_PAGE_PROTECT4;
BASL_EXEC(basl_table_append_content(table, &hpet, sizeof(hpet)));
- BASL_EXEC(basl_table_append_pointer(rsdt, ACPI_SIG_HPET,
- ACPI_RSDT_ENTRY_SIZE));
- BASL_EXEC(basl_table_append_pointer(xsdt, ACPI_SIG_HPET,
- ACPI_XSDT_ENTRY_SIZE));
+ BASL_EXEC(basl_table_register_to_rsdt(table));
return (0);
}
@@ -635,10 +626,7 @@
BASL_EXEC(basl_table_append_bytes(table, &madt_lapic_nmi,
sizeof(madt_lapic_nmi)));
- BASL_EXEC(basl_table_append_pointer(rsdt, ACPI_SIG_MADT,
- ACPI_RSDT_ENTRY_SIZE));
- BASL_EXEC(basl_table_append_pointer(xsdt, ACPI_SIG_MADT,
- ACPI_XSDT_ENTRY_SIZE));
+ BASL_EXEC(basl_table_register_to_rsdt(table));
return (0);
}
@@ -663,10 +651,7 @@
BASL_EXEC(basl_table_append_bytes(table, &mcfg_allocation,
sizeof(mcfg_allocation)));
- BASL_EXEC(basl_table_append_pointer(rsdt, ACPI_SIG_MCFG,
- ACPI_RSDT_ENTRY_SIZE));
- BASL_EXEC(basl_table_append_pointer(xsdt, ACPI_SIG_MCFG,
- ACPI_XSDT_ENTRY_SIZE));
+ BASL_EXEC(basl_table_register_to_rsdt(table));
return (0);
}
@@ -708,19 +693,6 @@
return (0);
}
-static int
-build_rsdt(struct vmctx *const ctx)
-{
- BASL_EXEC(
- basl_table_create(&rsdt, ctx, ACPI_SIG_RSDT, BASL_TABLE_ALIGNMENT));
-
- /* Header */
- BASL_EXEC(basl_table_append_header(rsdt, ACPI_SIG_RSDT, 1, 1));
- /* Pointers (added by other build_XXX funcs) */
-
- return (0);
-}
-
static int
build_spcr(struct vmctx *const ctx)
{
@@ -744,23 +716,7 @@
spcr.TerminalType = ACPI_SPCR_TERMINAL_TYPE_VT_UTF8;
BASL_EXEC(basl_table_append_content(table, &spcr, sizeof(spcr)));
- BASL_EXEC(basl_table_append_pointer(rsdt, ACPI_SIG_SPCR,
- ACPI_RSDT_ENTRY_SIZE));
- BASL_EXEC(basl_table_append_pointer(xsdt, ACPI_SIG_SPCR,
- ACPI_XSDT_ENTRY_SIZE));
-
- return (0);
-}
-
-static int
-build_xsdt(struct vmctx *const ctx)
-{
- BASL_EXEC(
- basl_table_create(&xsdt, ctx, ACPI_SIG_XSDT, BASL_TABLE_ALIGNMENT));
-
- /* Header */
- BASL_EXEC(basl_table_append_header(xsdt, ACPI_SIG_XSDT, 1, 1));
- /* Pointers (added by other build_XXX funcs) */
+ BASL_EXEC(basl_table_register_to_rsdt(table));
return (0);
}
@@ -790,7 +746,7 @@
if (getenv("BHYVE_ACPI_KEEPTMPS"))
basl_keep_temps = 1;
- BASL_EXEC(basl_init());
+ BASL_EXEC(basl_init(ctx));
BASL_EXEC(basl_make_templates());
@@ -802,8 +758,6 @@
* first table after XSDT.
*/
BASL_EXEC(build_rsdp(ctx));
- BASL_EXEC(build_rsdt(ctx));
- BASL_EXEC(build_xsdt(ctx));
BASL_EXEC(build_fadt(ctx));
BASL_EXEC(build_madt(ctx));
BASL_EXEC(build_hpet(ctx));
diff --git a/usr.sbin/bhyve/basl.h b/usr.sbin/bhyve/basl.h
--- a/usr.sbin/bhyve/basl.h
+++ b/usr.sbin/bhyve/basl.h
@@ -67,7 +67,7 @@
uint8_t bit_width, uint8_t bit_offset, uint8_t access_width,
uint64_t address);
int basl_finish(void);
-int basl_init(void);
+int basl_init(struct vmctx *ctx);
int basl_table_add_checksum(struct basl_table *const table, const uint32_t off,
const uint32_t start, const uint32_t len);
int basl_table_add_length(struct basl_table *const table, const uint32_t off,
@@ -97,3 +97,5 @@
const uint8_t src_signature[ACPI_NAMESEG_SIZE], uint8_t size);
int basl_table_create(struct basl_table **table, struct vmctx *ctx,
const uint8_t *name, uint32_t alignment);
+/* Adds the table to RSDT and XSDT */
+int basl_table_register_to_rsdt(struct basl_table *table);
diff --git a/usr.sbin/bhyve/basl.c b/usr.sbin/bhyve/basl.c
--- a/usr.sbin/bhyve/basl.c
+++ b/usr.sbin/bhyve/basl.c
@@ -58,6 +58,8 @@
basl_tables);
static struct qemu_loader *basl_loader;
+static struct basl_table *rsdt;
+static struct basl_table *xsdt;
static __inline uint64_t
basl_le_dec(void *pp, size_t len)
@@ -358,10 +360,41 @@
return (0);
}
+static int
+basl_init_rsdt(struct vmctx *const ctx)
+{
+ BASL_EXEC(
+ basl_table_create(&rsdt, ctx, ACPI_SIG_RSDT, BASL_TABLE_ALIGNMENT));
+
+ /* Header */
+ BASL_EXEC(basl_table_append_header(rsdt, ACPI_SIG_RSDT, 1, 1));
+ /* Pointers (added by basl_table_register_to_rsdt) */
+
+ return (0);
+}
+
+static int
+basl_init_xsdt(struct vmctx *const ctx)
+{
+ BASL_EXEC(
+ basl_table_create(&xsdt, ctx, ACPI_SIG_XSDT, BASL_TABLE_ALIGNMENT));
+
+ /* Header */
+ BASL_EXEC(basl_table_append_header(xsdt, ACPI_SIG_XSDT, 1, 1));
+ /* Pointers (added by basl_table_register_to_rsdt) */
+
+ return (0);
+}
+
int
-basl_init(void)
+basl_init(struct vmctx *const ctx)
{
- return (qemu_loader_create(&basl_loader, QEMU_FWCFG_FILE_TABLE_LOADER));
+ BASL_EXEC(basl_init_rsdt(ctx));
+ BASL_EXEC(basl_init_xsdt(ctx));
+ BASL_EXEC(
+ qemu_loader_create(&basl_loader, QEMU_FWCFG_FILE_TABLE_LOADER));
+
+ return (0);
}
int
@@ -627,3 +660,20 @@
return (0);
}
+
+int
+basl_table_register_to_rsdt(struct basl_table *table)
+{
+ const ACPI_TABLE_HEADER *header;
+
+ assert(table != NULL);
+
+ header = (const ACPI_TABLE_HEADER *)table->data;
+
+ BASL_EXEC(basl_table_append_pointer(rsdt, header->Signature,
+ ACPI_RSDT_ENTRY_SIZE));
+ BASL_EXEC(basl_table_append_pointer(xsdt, header->Signature,
+ ACPI_XSDT_ENTRY_SIZE));
+
+ return (0);
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 13, 2:53 PM (19 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15783224
Default Alt Text
D40559.diff (5 KB)
Attached To
Mode
D40559: bhyve: maintain RSDT and XSDT by basl
Attached
Detach File
Event Timeline
Log In to Comment