git: c8029c30a872 - stable/13 - bhyve: add helper to append a basl table without a header
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 05 Dec 2022 07:41:59 UTC
The branch stable/13 has been updated by corvink:
URL: https://cgit.FreeBSD.org/src/commit/?id=c8029c30a8729b8af133352df92d1c4a0d41353e
commit c8029c30a8729b8af133352df92d1c4a0d41353e
Author: Corvin Köhne <corvink@FreeBSD.org>
AuthorDate: 2022-11-16 08:31:29 +0000
Commit: Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2022-12-05 07:39:34 +0000
bhyve: add helper to append a basl table without a header
The common style for build an ACPI table will be:
1. basl_table_create
2. basl_table_append_header
3. setup an ACPI_TABLE_* struct
4. basl_table_append_bytes (without header)
Add a helper for the last step.
Reviewed by: jhb, markj
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37406
(cherry picked from commit 8897b562abbf1dbc2d6c83d31ed673d5220c3da3)
---
usr.sbin/bhyve/basl.c | 11 +++++++++++
usr.sbin/bhyve/basl.h | 3 +++
2 files changed, 14 insertions(+)
diff --git a/usr.sbin/bhyve/basl.c b/usr.sbin/bhyve/basl.c
index 7accc7088a9d..9af1baed7dd7 100644
--- a/usr.sbin/bhyve/basl.c
+++ b/usr.sbin/bhyve/basl.c
@@ -438,6 +438,17 @@ basl_table_append_checksum(struct basl_table *const table, const uint32_t start,
return (0);
}
+int
+basl_table_append_content(struct basl_table *table, void *data, uint32_t len)
+{
+ assert(data != NULL);
+ assert(len >= sizeof(ACPI_TABLE_HEADER));
+
+ return (basl_table_append_bytes(table,
+ (void *)((uintptr_t)(data) + sizeof(ACPI_TABLE_HEADER)),
+ len - sizeof(ACPI_TABLE_HEADER)));
+}
+
int
basl_table_append_gas(struct basl_table *const table, const uint8_t space_id,
const uint8_t bit_width, const uint8_t bit_offset,
diff --git a/usr.sbin/bhyve/basl.h b/usr.sbin/bhyve/basl.h
index 5c6c5123d887..b634164c42de 100644
--- a/usr.sbin/bhyve/basl.h
+++ b/usr.sbin/bhyve/basl.h
@@ -50,6 +50,9 @@ int basl_table_append_bytes(struct basl_table *table, const void *bytes,
uint32_t len);
int basl_table_append_checksum(struct basl_table *table, uint32_t start,
uint32_t len);
+/* Add an ACPI_TABLE_* to basl without its header. */
+int basl_table_append_content(struct basl_table *table, void *data,
+ uint32_t len);
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);