Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Nov 2022 13:58:02 GMT
From:      =?utf-8?Q?Corvin=20K=C3=B6hne?= <corvink@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a3d85d0e12be - stable/13 - bhyve: add basl support for generic addresses
Message-ID:  <202211291358.2ATDw24O029444@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=a3d85d0e12be1331c0c7d6d6ed73ec4bbf54bc36

commit a3d85d0e12be1331c0c7d6d6ed73ec4bbf54bc36
Author:     Corvin Köhne <corvink@FreeBSD.org>
AuthorDate: 2022-11-04 13:30:53 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2022-11-29 13:53:50 +0000

    bhyve: add basl support for generic addresses
    
    In upcoming commits, bhyve will build some ACPI tables by it's own.
    Therefore, it should be capable of appending GENERIC_ADDRESS structs to
    ACPI tables.
    
    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/D36988
    
    (cherry picked from commit 995374a6553dbdfbdaffbc5f5a5ceff08a437cd7)
---
 usr.sbin/bhyve/basl.c | 16 ++++++++++++++++
 usr.sbin/bhyve/basl.h | 10 ++++++++++
 2 files changed, 26 insertions(+)

diff --git a/usr.sbin/bhyve/basl.c b/usr.sbin/bhyve/basl.c
index b3a561f51571..7dfeb8d2acb3 100644
--- a/usr.sbin/bhyve/basl.c
+++ b/usr.sbin/bhyve/basl.c
@@ -156,6 +156,22 @@ basl_table_append_bytes(struct basl_table *const table, const void *const bytes,
 	return (0);
 }
 
+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,
+    const uint8_t access_width, const uint64_t address)
+{
+	ACPI_GENERIC_ADDRESS gas_le = {
+		.SpaceId = space_id,
+		.BitWidth = bit_width,
+		.BitOffset = bit_offset,
+		.AccessWidth = access_width,
+		.Address = htole64(address),
+	};
+
+	return (basl_table_append_bytes(table, &gas_le, sizeof(gas_le)));
+}
+
 int
 basl_table_append_int(struct basl_table *const table, const uint64_t val,
     const uint8_t size)
diff --git a/usr.sbin/bhyve/basl.h b/usr.sbin/bhyve/basl.h
index 3ce33dea63e0..95164e98ed7a 100644
--- a/usr.sbin/bhyve/basl.h
+++ b/usr.sbin/bhyve/basl.h
@@ -8,6 +8,13 @@
 
 #include <contrib/dev/acpica/include/acpi.h>
 
+#define ACPI_GAS_ACCESS_WIDTH_LEGACY 0
+#define ACPI_GAS_ACCESS_WIDTH_UNDEFINED 0
+#define ACPI_GAS_ACCESS_WIDTH_BYTE 1
+#define ACPI_GAS_ACCESS_WIDTH_WORD 2
+#define ACPI_GAS_ACCESS_WIDTH_DWORD 3
+#define ACPI_GAS_ACCESS_WIDTH_QWORD 4
+
 #define BHYVE_ACPI_BASE 0xf2400
 
 #define BASL_TABLE_ALIGNMENT 0x10
@@ -32,6 +39,9 @@ int basl_finish(void);
 int basl_init(void);
 int basl_table_append_bytes(struct basl_table *table, const void *bytes,
     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);
 int basl_table_append_int(struct basl_table *table, uint64_t val, uint8_t size);
 int basl_table_create(struct basl_table **table, struct vmctx *ctx,
     const uint8_t *name, uint32_t alignment, uint32_t off);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202211291358.2ATDw24O029444>