Page MenuHomeFreeBSD

D36992.id112769.diff
No OneTemporary

D36992.id112769.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
@@ -18,6 +18,10 @@
#define BHYVE_ACPI_BASE 0xf2400
+#define BASL_COMPILER_ID "BASL"
+
+#define BASL_COMPILER_REVISION 0x20220504
+
#define BASL_TABLE_ALIGNMENT 0x10
#define BASL_TABLE_ALIGNMENT_FACS 0x40
@@ -47,6 +51,10 @@
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 sign[ACPI_NAMESEG_SIZE], uint8_t rev,
+ const uint8_t oem_id[ACPI_OEM_ID_SIZE],
+ const uint8_t oem_table_id[ACPI_OEM_TABLE_ID_SIZE], 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
@@ -452,6 +452,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 sign[ACPI_NAMESEG_SIZE], const uint8_t rev,
+ const uint8_t oem_id[ACPI_OEM_ID_SIZE],
+ const uint8_t oem_table_id[ACPI_OEM_TABLE_ID_SIZE],
+ const uint32_t oem_revision)
+{
+ if (table == NULL || table->len != 0) {
+ return (EINVAL);
+ }
+
+ ACPI_TABLE_HEADER header_le;
+
+ memcpy(header_le.Signature, sign, sizeof(header_le.Signature));
+ header_le.Length = 0; /* patched by basl_finish */
+ header_le.Revision = rev;
+ header_le.Checksum = 0; /* patched by basl_finish */
+ memcpy(header_le.OemId, oem_id, sizeof(header_le.OemId));
+ 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");
+ memcpy(header_le.AslCompilerId, BASL_COMPILER_ID,
+ sizeof(header_le.AslCompilerId));
+ header_le.AslCompilerRevision = htole32(BASL_COMPILER_REVISION);
+
+ 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
Fri, Nov 28, 11:39 PM (13 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26308497
Default Alt Text
D36992.id112769.diff (2 KB)

Event Timeline