Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140109230
D38334.id118068.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D38334.id118068.diff
View Options
diff --git a/usr.sbin/bhyve/qemu_fwcfg.c b/usr.sbin/bhyve/qemu_fwcfg.c
--- a/usr.sbin/bhyve/qemu_fwcfg.c
+++ b/usr.sbin/bhyve/qemu_fwcfg.c
@@ -130,6 +130,31 @@
return (0);
}
+static int
+qemu_fwcfg_add_item(const uint16_t architecture, const uint16_t index,
+ const uint32_t size, void *const data)
+{
+ /* truncate architecture and index to their desired size */
+ const uint16_t arch = architecture & QEMU_FWCFG_ARCHITECTURE_MASK;
+ const uint16_t idx = index & QEMU_FWCFG_INDEX_MASK;
+
+ /* get pointer to item specified by selector */
+ struct qemu_fwcfg_item *const fwcfg_item = &fwcfg_sc.items[arch][idx];
+
+ /* check if item is already used */
+ if (fwcfg_item->data != NULL) {
+ warnx("%s: qemu fwcfg item exists (architecture %s index 0x%x)",
+ __func__, arch ? "specific" : "generic", idx);
+ return (-1);
+ }
+
+ /* save data of the item */
+ fwcfg_item->size = size;
+ fwcfg_item->data = data;
+
+ return (0);
+}
+
static int
qemu_fwcfg_register_port(const char *const name, const int port, const int size,
const int flags, const inout_func_t handler)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 21, 8:44 AM (3 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27110406
Default Alt Text
D38334.id118068.diff (1 KB)
Attached To
Mode
D38334: bhyve: add helper to add fwcfg items
Attached
Detach File
Event Timeline
Log In to Comment