Page MenuHomeFreeBSD

D36992.id113132.diff
No OneTemporary

D36992.id113132.diff

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
@@ -46,6 +46,9 @@
int basl_table_append_gas(struct basl_table *table, uint8_t space_id,
uint8_t bit_width, uint8_t bit_offset, uint8_t access_width,
uint64_t address);
+int basl_table_append_header(struct basl_table *table,
+ const uint8_t signature[ACPI_NAMESEG_SIZE], uint8_t revision,
+ uint32_t oem_revision);
int basl_table_append_int(struct basl_table *table, uint64_t val, uint8_t size);
int basl_table_append_length(struct basl_table *table, uint8_t size);
int basl_table_append_pointer(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
@@ -446,6 +446,45 @@
return (basl_table_append_bytes(table, &gas_le, sizeof(gas_le)));
}
+int
+basl_table_append_header(struct basl_table *const table,
+ const uint8_t signature[ACPI_NAMESEG_SIZE], const uint8_t revision,
+ const uint32_t oem_revision)
+{
+ ACPI_TABLE_HEADER header_le;
+ /* + 1 is required for the null terminator */
+ char oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1];
+
+ assert(table != NULL);
+ assert(table->len == 0);
+
+ header_le.Signature = signature;
+ header_le.Length = 0; /* patched by basl_finish */
+ header_le.Revision = revision;
+ header_le.Checksum = 0; /* patched by basl_finish */
+ header_le.OemId = "BHYVE ";
+ snprintf(oem_table_id, ACPI_OEM_TABLE_ID_SIZE, "BV%.4s ", signature);
+ memcpy(header_le.OemTableId, oem_table_id,
+ sizeof(header_le.OemTableId));
+ header_le.OemRevision = htole32(oem_revision);
+ static_assert(sizeof(header_le.AslCompilerId) ==
+ sizeof(BASL_COMPILER_ID) - 1 /* Without '\0' */,
+ "Mismatching ASL compiler id size");
+ header_le.AslCompilerId = "BASL";
+ header_le.AslCompilerRevision = htole32(0x20220504);
+
+ BASL_EXEC(
+ basl_table_append_bytes(table, &header_le, sizeof(header_le)));
+
+ BASL_EXEC(basl_table_add_length(table,
+ offsetof(ACPI_TABLE_HEADER, Length), sizeof(header_le.Length)));
+ BASL_EXEC(basl_table_add_checksum(table,
+ offsetof(ACPI_TABLE_HEADER, Checksum), 0,
+ BASL_TABLE_CHECKSUM_LEN_FULL_TABLE));
+
+ return (0);
+}
+
int
basl_table_append_int(struct basl_table *const table, const uint64_t val,
const uint8_t size)

File Metadata

Mime Type
text/plain
Expires
Mon, Feb 9, 5:08 AM (19 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28540737
Default Alt Text
D36992.id113132.diff (2 KB)

Event Timeline