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
This commit is contained in:
Corvin Köhne 2022-11-16 09:31:29 +01:00
parent 7263419f38
commit 8897b562ab
No known key found for this signature in database
GPG key ID: D854DA56315E026A
2 changed files with 14 additions and 0 deletions

View file

@ -437,6 +437,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,

View file

@ -53,6 +53,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);