* [Qemu-devel] [PATCH] Pass trusted NIC to OS through SMBIOS
@ 2009-01-18 16:05 Gleb Natapov
0 siblings, 0 replies; only message in thread
From: Gleb Natapov @ 2009-01-18 16:05 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/bios/rombios32.c b/bios/rombios32.c
index 944d2e7..d55d252 100644
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -413,6 +413,7 @@ unsigned long bios_table_end_addr;
#define QEMU_CFG_SIGNATURE 0x00
#define QEMU_CFG_ID 0x01
#define QEMU_CFG_UUID 0x02
+#define QEMU_CFG_TRUSTED_NIC 0x07
int qemu_cfg_port;
@@ -440,6 +441,19 @@ void qemu_cfg_read(uint8_t *buf, int len)
while (len--)
*(buf++) = inb(QEMU_CFG_DATA_PORT);
}
+
+int qemu_cfg_read_string(uint8_t *buf, int len)
+{
+ int c = 0;
+ while (c < len) {
+ buf[c] = inb(QEMU_CFG_DATA_PORT);
+ if (!buf[c])
+ break;
+ c++;
+ }
+
+ return c;
+}
#endif
void uuid_probe(void)
@@ -1708,6 +1722,13 @@ struct smbios_type_4 {
uint16_t l3_cache_handle;
} __attribute__((__packed__));
+/* SMBIOS type 11 - OEM Strings
+ */
+struct smbios_type_11 {
+ struct smbios_structure_header header;
+ uint8_t count;
+} __attribute__((__packed__));
+
/* SMBIOS type 16 - Physical Memory Array
* Associated with one type 17 (Memory Device).
*/
@@ -1944,6 +1965,34 @@ smbios_type_4_init(void *start, unsigned int cpu_number)
return start+7;
}
+/* Type 11 -- OEM Strings */
+static void *
+smbios_type_11_init(void *start)
+{
+#ifdef BX_QEMU
+ struct smbios_type_11 *p = (struct smbios_type_11*)start;
+ int len;
+
+ p->header.type = 11;
+ p->header.length = sizeof(struct smbios_type_11);
+ p->header.handle = 0x500;
+ p->count = 1;
+ start += sizeof (struct smbios_type_11);
+ memcpy(start, "Trusted NIC ", 12);
+ start += 12;
+ qemu_cfg_select(QEMU_CFG_TRUSTED_NIC);
+ len = qemu_cfg_read_string(start, 100);
+ if (len == 0)
+ return p;
+ start += (len + 1);
+ *((uint8_t *)start) = 0;
+
+ return start + 1;
+#else
+ return start;
+#endif
+}
+
/* Type 16 -- Physical Memory Array */
static void *
smbios_type_16_init(void *start, uint32_t memsize)
@@ -2106,6 +2155,7 @@ void smbios_init(void)
add_struct(smbios_type_3_init(p));
for (cpu_num = 1; cpu_num <= smp_cpus; cpu_num++)
add_struct(smbios_type_4_init(p, cpu_num));
+ add_struct(smbios_type_11_init(p));
add_struct(smbios_type_16_init(p, memsize));
add_struct(smbios_type_17_init(p, memsize));
add_struct(smbios_type_19_init(p, memsize));
--
Gleb.
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-01-18 16:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-18 16:05 [Qemu-devel] [PATCH] Pass trusted NIC to OS through SMBIOS Gleb Natapov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).