From b6f6e3d3a71cee61320216a42940cfaa9b42a162 Mon Sep 17 00:00:00 2001 From: aliguori Date: Fri, 17 Apr 2009 18:59:56 +0000 Subject: [PATCH] qemu: Add support for SMBIOS command line otions (Alex Williamson) Create a new -smbios option (x86-only) to allow binary SMBIOS entries to be passed through to the BIOS or modify the default values of individual fields of type 0 and 1 entries on the command line. Binary SMBIOS entries can be generated as follows: dmidecode -t 1 -u | grep $'^\t\t[^"]' | xargs -n1 | \ perl -lne 'printf "%c", hex($_)' > smbios_type_1.bin These can then be passed to the BIOS using this switch: -smbios file=smbios_type_1.bin Command line generation supports the following syntax: -smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d] -smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str] [,uuid=$(uuidgen)][,sku=str][,family=str] For instance, to add a serial number to the type 1 table: -smbios type=1,serial=0123456789 Interface is extensible to support more fields/tables as needed. aliguori: remove texi formatting from help output Signed-off-by: Alex Williamson Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7163 c046a42c-6fe2-441c-8c8c-71466251a162 --- Makefile.target | 2 +- hw/pc.c | 9 + hw/smbios.c | 224 +++++++++ hw/smbios.h | 162 ++++++ ...d-smbios-entries-and-files-from-qemu.patch | 470 ++++++++++++++++++ pc-bios/bios-pq/series | 1 + pc-bios/bios.bin | Bin 131072 -> 131072 bytes qemu-options.hx | 21 + vl.c | 11 + 9 files changed, 899 insertions(+), 1 deletion(-) create mode 100644 hw/smbios.c create mode 100644 hw/smbios.h create mode 100644 pc-bios/bios-pq/0012-load-smbios-entries-and-files-from-qemu.patch diff --git a/Makefile.target b/Makefile.target index e9b039d06a..dae339bc2e 100644 --- a/Makefile.target +++ b/Makefile.target @@ -576,7 +576,7 @@ OBJS+= ide.o pckbd.o vga.o $(SOUND_HW) dma.o OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o OBJS+= cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o -OBJS += device-hotplug.o pci-hotplug.o +OBJS += device-hotplug.o pci-hotplug.o smbios.o CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE endif ifeq ($(TARGET_BASE_ARCH), ppc) diff --git a/hw/pc.c b/hw/pc.c index 6a1750e10b..5451f05fa8 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -37,6 +37,7 @@ #include "virtio-balloon.h" #include "virtio-console.h" #include "hpet_emul.h" +#include "smbios.h" /* output Bochs bios info messages */ //#define DEBUG_BIOS @@ -51,6 +52,7 @@ #define ACPI_DATA_SIZE 0x10000 #define BIOS_CFG_IOPORT 0x510 #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0) +#define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1) #define MAX_IDE_BUS 2 @@ -425,6 +427,8 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) static void bochs_bios_init(void) { void *fw_cfg; + uint8_t *smbios_table; + size_t smbios_len; register_ioport_write(0x400, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x401, 1, 2, bochs_bios_write, NULL); @@ -442,6 +446,11 @@ static void bochs_bios_init(void) fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables, acpi_tables_len); + + smbios_table = smbios_get_table(&smbios_len); + if (smbios_table) + fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, + smbios_table, smbios_len); } /* Generate an initial boot sector which sets state and jump to diff --git a/hw/smbios.c b/hw/smbios.c new file mode 100644 index 0000000000..ced90ce235 --- /dev/null +++ b/hw/smbios.c @@ -0,0 +1,224 @@ +/* + * SMBIOS Support + * + * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. + * + * Authors: + * Alex Williamson + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#include "sysemu.h" +#include "smbios.h" + +/* + * Structures shared with the BIOS + */ +struct smbios_header { + uint16_t length; + uint8_t type; +} __attribute__((__packed__)); + +struct smbios_field { + struct smbios_header header; + uint8_t type; + uint16_t offset; + uint8_t data[]; +} __attribute__((__packed__)); + +struct smbios_table { + struct smbios_header header; + uint8_t data[]; +} __attribute__((__packed__)); + +#define SMBIOS_FIELD_ENTRY 0 +#define SMBIOS_TABLE_ENTRY 1 + + +static uint8_t *smbios_entries; +static size_t smbios_entries_len; + +uint8_t *smbios_get_table(size_t *length) +{ + *length = smbios_entries_len; + return smbios_entries; +} + +/* + * To avoid unresolvable overlaps in data, don't allow both + * tables and fields for the same smbios type. + */ +static void smbios_check_collision(int type, int entry) +{ + uint16_t *num_entries = (uint16_t *)smbios_entries; + struct smbios_header *header; + char *p; + int i; + + if (!num_entries) + return; + + p = (char *)(num_entries + 1); + + for (i = 0; i < *num_entries; i++) { + header = (struct smbios_header *)p; + if (entry == SMBIOS_TABLE_ENTRY && header->type == SMBIOS_FIELD_ENTRY) { + struct smbios_field *field = (void *)header; + if (type == field->type) { + fprintf(stderr, "SMBIOS type %d field already defined, " + "cannot add table\n", type); + exit(1); + } + } else if (entry == SMBIOS_FIELD_ENTRY && + header->type == SMBIOS_TABLE_ENTRY) { + struct smbios_structure_header *table = (void *)(header + 1); + if (type == table->type) { + fprintf(stderr, "SMBIOS type %d table already defined, " + "cannot add field\n", type); + exit(1); + } + } + p += le16_to_cpu(header->length); + } +} + +void smbios_add_field(int type, int offset, int len, void *data) +{ + struct smbios_field *field; + + smbios_check_collision(type, SMBIOS_FIELD_ENTRY); + + if (!smbios_entries) { + smbios_entries_len = sizeof(uint16_t); + smbios_entries = qemu_mallocz(smbios_entries_len); + } + smbios_entries = qemu_realloc(smbios_entries, smbios_entries_len + + sizeof(*field) + len); + field = (struct smbios_field *)(smbios_entries + smbios_entries_len); + field->header.type = SMBIOS_FIELD_ENTRY; + field->header.length = cpu_to_le16(sizeof(*field) + len); + + field->type = type; + field->offset = cpu_to_le16(offset); + memcpy(field->data, data, len); + + smbios_entries_len += sizeof(*field) + len; + (*(uint16_t *)smbios_entries) = + cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1); +} + +static void smbios_build_type_0_fields(const char *t) +{ + char buf[1024]; + + if (get_param_value(buf, sizeof(buf), "vendor", t)) + smbios_add_field(0, offsetof(struct smbios_type_0, vendor_str), + strlen(buf) + 1, buf); + if (get_param_value(buf, sizeof(buf), "version", t)) + smbios_add_field(0, offsetof(struct smbios_type_0, bios_version_str), + strlen(buf) + 1, buf); + if (get_param_value(buf, sizeof(buf), "date", t)) + smbios_add_field(0, offsetof(struct smbios_type_0, + bios_release_date_str), + strlen(buf) + 1, buf); + if (get_param_value(buf, sizeof(buf), "release", t)) { + int major, minor; + sscanf(buf, "%d.%d", &major, &minor); + smbios_add_field(0, offsetof(struct smbios_type_0, + system_bios_major_release), 1, &major); + smbios_add_field(0, offsetof(struct smbios_type_0, + system_bios_minor_release), 1, &minor); + } +} + +static void smbios_build_type_1_fields(const char *t) +{ + char buf[1024]; + + if (get_param_value(buf, sizeof(buf), "manufacturer", t)) + smbios_add_field(1, offsetof(struct smbios_type_1, manufacturer_str), + strlen(buf) + 1, buf); + if (get_param_value(buf, sizeof(buf), "product", t)) + smbios_add_field(1, offsetof(struct smbios_type_1, product_name_str), + strlen(buf) + 1, buf); + if (get_param_value(buf, sizeof(buf), "version", t)) + smbios_add_field(1, offsetof(struct smbios_type_1, version_str), + strlen(buf) + 1, buf); + if (get_param_value(buf, sizeof(buf), "serial", t)) + smbios_add_field(1, offsetof(struct smbios_type_1, serial_number_str), + strlen(buf) + 1, buf); + if (get_param_value(buf, sizeof(buf), "uuid", t)) { + if (qemu_uuid_parse(buf, qemu_uuid) != 0) { + fprintf(stderr, "Invalid SMBIOS UUID string\n"); + exit(1); + } + } + if (get_param_value(buf, sizeof(buf), "sku", t)) + smbios_add_field(1, offsetof(struct smbios_type_1, sku_number_str), + strlen(buf) + 1, buf); + if (get_param_value(buf, sizeof(buf), "family", t)) + smbios_add_field(1, offsetof(struct smbios_type_1, family_str), + strlen(buf) + 1, buf); +} + +int smbios_entry_add(const char *t) +{ + char buf[1024]; + + if (get_param_value(buf, sizeof(buf), "file", t)) { + struct smbios_structure_header *header; + struct smbios_table *table; + int size = get_image_size(buf); + + if (size < sizeof(struct smbios_structure_header)) { + fprintf(stderr, "Cannot read smbios file %s", buf); + exit(1); + } + + if (!smbios_entries) { + smbios_entries_len = sizeof(uint16_t); + smbios_entries = qemu_mallocz(smbios_entries_len); + } + + smbios_entries = qemu_realloc(smbios_entries, smbios_entries_len + + sizeof(*table) + size); + table = (struct smbios_table *)(smbios_entries + smbios_entries_len); + table->header.type = SMBIOS_TABLE_ENTRY; + table->header.length = cpu_to_le16(sizeof(*table) + size); + + if (load_image(buf, table->data) != size) { + fprintf(stderr, "Failed to load smbios file %s", buf); + exit(1); + } + + header = (struct smbios_structure_header *)(table->data); + smbios_check_collision(header->type, SMBIOS_TABLE_ENTRY); + + smbios_entries_len += sizeof(*table) + size; + (*(uint16_t *)smbios_entries) = + cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1); + return 0; + } + + if (get_param_value(buf, sizeof(buf), "type", t)) { + unsigned long type = strtoul(buf, NULL, 0); + switch (type) { + case 0: + smbios_build_type_0_fields(t); + return 0; + case 1: + smbios_build_type_1_fields(t); + return 0; + default: + fprintf(stderr, "Don't know how to build fields for SMBIOS type " + "%ld\n", type); + exit(1); + } + } + + fprintf(stderr, "smbios: must specify type= or file=\n"); + return -1; +} diff --git a/hw/smbios.h b/hw/smbios.h new file mode 100644 index 0000000000..3a5169dbd3 --- /dev/null +++ b/hw/smbios.h @@ -0,0 +1,162 @@ +#ifndef QEMU_SMBIOS_H +#define QEMU_SMBIOS_H +/* + * SMBIOS Support + * + * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. + * + * Authors: + * Alex Williamson + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +int smbios_entry_add(const char *t); +void smbios_add_field(int type, int offset, int len, void *data); +uint8_t *smbios_get_table(size_t *length); + +/* + * SMBIOS spec defined tables + */ + +/* This goes at the beginning of every SMBIOS structure. */ +struct smbios_structure_header { + uint8_t type; + uint8_t length; + uint16_t handle; +} __attribute__((__packed__)); + +/* SMBIOS type 0 - BIOS Information */ +struct smbios_type_0 { + struct smbios_structure_header header; + uint8_t vendor_str; + uint8_t bios_version_str; + uint16_t bios_starting_address_segment; + uint8_t bios_release_date_str; + uint8_t bios_rom_size; + uint8_t bios_characteristics[8]; + uint8_t bios_characteristics_extension_bytes[2]; + uint8_t system_bios_major_release; + uint8_t system_bios_minor_release; + uint8_t embedded_controller_major_release; + uint8_t embedded_controller_minor_release; +} __attribute__((__packed__)); + +/* SMBIOS type 1 - System Information */ +struct smbios_type_1 { + struct smbios_structure_header header; + uint8_t manufacturer_str; + uint8_t product_name_str; + uint8_t version_str; + uint8_t serial_number_str; + uint8_t uuid[16]; + uint8_t wake_up_type; + uint8_t sku_number_str; + uint8_t family_str; +} __attribute__((__packed__)); + +/* SMBIOS type 3 - System Enclosure (v2.3) */ +struct smbios_type_3 { + struct smbios_structure_header header; + uint8_t manufacturer_str; + uint8_t type; + uint8_t version_str; + uint8_t serial_number_str; + uint8_t asset_tag_number_str; + uint8_t boot_up_state; + uint8_t power_supply_state; + uint8_t thermal_state; + uint8_t security_status; + uint32_t oem_defined; + uint8_t height; + uint8_t number_of_power_cords; + uint8_t contained_element_count; + // contained elements follow +} __attribute__((__packed__)); + +/* SMBIOS type 4 - Processor Information (v2.0) */ +struct smbios_type_4 { + struct smbios_structure_header header; + uint8_t socket_designation_str; + uint8_t processor_type; + uint8_t processor_family; + uint8_t processor_manufacturer_str; + uint32_t processor_id[2]; + uint8_t processor_version_str; + uint8_t voltage; + uint16_t external_clock; + uint16_t max_speed; + uint16_t current_speed; + uint8_t status; + uint8_t processor_upgrade; + uint16_t l1_cache_handle; + uint16_t l2_cache_handle; + uint16_t l3_cache_handle; +} __attribute__((__packed__)); + +/* SMBIOS type 16 - Physical Memory Array + * Associated with one type 17 (Memory Device). + */ +struct smbios_type_16 { + struct smbios_structure_header header; + uint8_t location; + uint8_t use; + uint8_t error_correction; + uint32_t maximum_capacity; + uint16_t memory_error_information_handle; + uint16_t number_of_memory_devices; +} __attribute__((__packed__)); +/* SMBIOS type 17 - Memory Device + * Associated with one type 19 + */ +struct smbios_type_17 { + struct smbios_structure_header header; + uint16_t physical_memory_array_handle; + uint16_t memory_error_information_handle; + uint16_t total_width; + uint16_t data_width; + uint16_t size; + uint8_t form_factor; + uint8_t device_set; + uint8_t device_locator_str; + uint8_t bank_locator_str; + uint8_t memory_type; + uint16_t type_detail; +} __attribute__((__packed__)); + +/* SMBIOS type 19 - Memory Array Mapped Address */ +struct smbios_type_19 { + struct smbios_structure_header header; + uint32_t starting_address; + uint32_t ending_address; + uint16_t memory_array_handle; + uint8_t partition_width; +} __attribute__((__packed__)); + +/* SMBIOS type 20 - Memory Device Mapped Address */ +struct smbios_type_20 { + struct smbios_structure_header header; + uint32_t starting_address; + uint32_t ending_address; + uint16_t memory_device_handle; + uint16_t memory_array_mapped_address_handle; + uint8_t partition_row_position; + uint8_t interleave_position; + uint8_t interleaved_data_depth; +} __attribute__((__packed__)); + +/* SMBIOS type 32 - System Boot Information */ +struct smbios_type_32 { + struct smbios_structure_header header; + uint8_t reserved[6]; + uint8_t boot_status; +} __attribute__((__packed__)); + +/* SMBIOS type 127 -- End-of-table */ +struct smbios_type_127 { + struct smbios_structure_header header; +} __attribute__((__packed__)); + +#endif /*QEMU_SMBIOS_H */ diff --git a/pc-bios/bios-pq/0012-load-smbios-entries-and-files-from-qemu.patch b/pc-bios/bios-pq/0012-load-smbios-entries-and-files-from-qemu.patch new file mode 100644 index 0000000000..e7a1204116 --- /dev/null +++ b/pc-bios/bios-pq/0012-load-smbios-entries-and-files-from-qemu.patch @@ -0,0 +1,470 @@ +qemu:bios: Load SMBIOS entries and files from qemu (Alex Williamson) + +Allow SMBIOS fields to be overridden and entries replaced by those +read from qemu. + +Signed-off-by: Alex Williamson +Signed-off-by: Anthony Liguori + +diff --git a/bios/rombios32.c b/bios/rombios32.c +index 7be4216..1a1ed64 100644 +--- a/bios/rombios32.c ++++ b/bios/rombios32.c +@@ -441,7 +441,6 @@ uint32_t cpuid_features; + uint32_t cpuid_ext_features; + unsigned long ram_size; + uint64_t ram_end; +-uint8_t bios_uuid[16]; + #ifdef BX_USE_EBDA_TABLES + unsigned long ebda_cur_addr; + #endif +@@ -471,6 +470,7 @@ void wrmsr_smp(uint32_t index, uint64_t val) + #define QEMU_CFG_UUID 0x02 + #define QEMU_CFG_ARCH_LOCAL 0x8000 + #define QEMU_CFG_ACPI_TABLES (QEMU_CFG_ARCH_LOCAL + 0) ++#define QEMU_CFG_SMBIOS_ENTRIES (QEMU_CFG_ARCH_LOCAL + 1) + + int qemu_cfg_port; + +@@ -519,19 +519,17 @@ static int acpi_load_table(int i, uint32_t addr, uint16_t *len) + qemu_cfg_read((uint8_t*)addr, *len); + return 0; + } +-#endif + +-void uuid_probe(void) ++static uint16_t smbios_entries(void) + { +-#ifdef BX_QEMU +- if(qemu_cfg_port) { +- qemu_cfg_select(QEMU_CFG_UUID); +- qemu_cfg_read(bios_uuid, 16); +- return; +- } +-#endif +- memset(bios_uuid, 0, 16); ++ uint16_t cnt; ++ ++ qemu_cfg_select(QEMU_CFG_SMBIOS_ENTRIES); ++ qemu_cfg_read((uint8_t*)&cnt, sizeof(cnt)); ++ ++ return cnt; + } ++#endif + + void cpu_probe(void) + { +@@ -1963,21 +1961,105 @@ smbios_entry_point_init(void *start, + ep->intermediate_checksum = -sum; + } + ++struct smbios_header { ++ uint16_t length; ++ uint8_t type; ++} __attribute__((__packed__)); ++ ++struct smbios_field { ++ struct smbios_header header; ++ uint8_t type; ++ uint16_t offset; ++ uint8_t data[]; ++} __attribute__((__packed__)); ++ ++struct smbios_table { ++ struct smbios_header header; ++ uint8_t data[]; ++} __attribute__((__packed__)); ++ ++#define SMBIOS_FIELD_ENTRY 0 ++#define SMBIOS_TABLE_ENTRY 1 ++ ++static size_t ++smbios_load_field(int type, size_t offset, void *addr) ++{ ++#ifdef BX_QEMU ++ int i; ++ ++ for (i = smbios_entries(); i > 0; i--) { ++ struct smbios_field field; ++ ++ qemu_cfg_read((uint8_t *)&field, sizeof(struct smbios_header)); ++ field.header.length -= sizeof(struct smbios_header); ++ ++ if (field.header.type != SMBIOS_FIELD_ENTRY) { ++ while (field.header.length--) ++ inb(QEMU_CFG_DATA_PORT); ++ continue; ++ } ++ ++ qemu_cfg_read((uint8_t *)&field.type, ++ sizeof(field) - sizeof(struct smbios_header)); ++ field.header.length -= sizeof(field) - sizeof(struct smbios_header); ++ ++ if (field.type != type || field.offset != offset) { ++ while (field.header.length--) ++ inb(QEMU_CFG_DATA_PORT); ++ continue; ++ } ++ ++ qemu_cfg_read(addr, field.header.length); ++ return (size_t)field.header.length; ++ } ++#endif ++ return 0; ++} ++ ++#define load_str_field_with_default(type, field, def) do { \ ++ size = smbios_load_field(type, offsetof(struct smbios_type_##type, \ ++ field), end); \ ++ if (size > 0) { \ ++ end += size; \ ++ } else { \ ++ memcpy(end, def, sizeof(def)); \ ++ end += sizeof(def); \ ++ } \ ++ p->field = ++str_index; \ ++} while (0) ++ ++#define load_str_field_or_skip(type, field) do { \ ++ size = smbios_load_field(type, offsetof(struct smbios_type_##type, \ ++ field), end); \ ++ if (size > 0) { \ ++ end += size; \ ++ p->field = ++str_index; \ ++ } else { \ ++ p->field = 0; \ ++ } \ ++} while (0) ++ + /* Type 0 -- BIOS Information */ + #define RELEASE_DATE_STR "01/01/2007" + static void * +-smbios_type_0_init(void *start) ++smbios_init_type_0(void *start) + { + struct smbios_type_0 *p = (struct smbios_type_0 *)start; ++ char *end = (char *)start + sizeof(struct smbios_type_0); ++ size_t size; ++ int str_index = 0; + + p->header.type = 0; + p->header.length = sizeof(struct smbios_type_0); + p->header.handle = 0; + +- p->vendor_str = 1; +- p->bios_version_str = 1; ++ load_str_field_with_default(0, vendor_str, BX_APPNAME); ++ load_str_field_with_default(0, bios_version_str, BX_APPNAME); ++ + p->bios_starting_address_segment = 0xe800; +- p->bios_release_date_str = 2; ++ ++ load_str_field_with_default(0, bios_release_date_str, RELEASE_DATE_STR); ++ + p->bios_rom_size = 0; /* FIXME */ + + memset(p->bios_characteristics, 0, 8); +@@ -1985,50 +2067,66 @@ smbios_type_0_init(void *start) + p->bios_characteristics_extension_bytes[0] = 0; + p->bios_characteristics_extension_bytes[1] = 0; + +- p->system_bios_major_release = 1; +- p->system_bios_minor_release = 0; ++ if (!smbios_load_field(0, offsetof(struct smbios_type_0, ++ system_bios_major_release), ++ &p->system_bios_major_release)) ++ p->system_bios_major_release = 1; ++ ++ if (!smbios_load_field(0, offsetof(struct smbios_type_0, ++ system_bios_minor_release), ++ &p->system_bios_minor_release)) ++ p->system_bios_minor_release = 0; ++ + p->embedded_controller_major_release = 0xff; + p->embedded_controller_minor_release = 0xff; + +- start += sizeof(struct smbios_type_0); +- memcpy((char *)start, BX_APPNAME, sizeof(BX_APPNAME)); +- start += sizeof(BX_APPNAME); +- memcpy((char *)start, RELEASE_DATE_STR, sizeof(RELEASE_DATE_STR)); +- start += sizeof(RELEASE_DATE_STR); +- *((uint8_t *)start) = 0; ++ *end = 0; ++ end++; + +- return start+1; ++ return end; + } + + /* Type 1 -- System Information */ + static void * +-smbios_type_1_init(void *start) ++smbios_init_type_1(void *start) + { + struct smbios_type_1 *p = (struct smbios_type_1 *)start; ++ char *end = (char *)start + sizeof(struct smbios_type_1); ++ size_t size; ++ int str_index = 0; ++ + p->header.type = 1; + p->header.length = sizeof(struct smbios_type_1); + p->header.handle = 0x100; + +- p->manufacturer_str = 0; +- p->product_name_str = 0; +- p->version_str = 0; +- p->serial_number_str = 0; ++ load_str_field_or_skip(1, manufacturer_str); ++ load_str_field_or_skip(1, product_name_str); ++ load_str_field_or_skip(1, version_str); ++ load_str_field_or_skip(1, serial_number_str); + +- memcpy(p->uuid, bios_uuid, 16); ++ size = smbios_load_field(1, offsetof(struct smbios_type_1, ++ uuid), &p->uuid); ++ if (size == 0) ++ memset(p->uuid, 0, 16); + + p->wake_up_type = 0x06; /* power switch */ +- p->sku_number_str = 0; +- p->family_str = 0; + +- start += sizeof(struct smbios_type_1); +- *((uint16_t *)start) = 0; ++ load_str_field_or_skip(1, sku_number_str); ++ load_str_field_or_skip(1, family_str); + +- return start+2; ++ *end = 0; ++ end++; ++ if (!str_index) { ++ *end = 0; ++ end++; ++ } ++ ++ return end; + } + + /* Type 3 -- System Enclosure */ + static void * +-smbios_type_3_init(void *start) ++smbios_init_type_3(void *start) + { + struct smbios_type_3 *p = (struct smbios_type_3 *)start; + +@@ -2058,7 +2156,7 @@ smbios_type_3_init(void *start) + + /* Type 4 -- Processor Information */ + static void * +-smbios_type_4_init(void *start, unsigned int cpu_number) ++smbios_init_type_4(void *start, unsigned int cpu_number) + { + struct smbios_type_4 *p = (struct smbios_type_4 *)start; + +@@ -2098,7 +2196,7 @@ smbios_type_4_init(void *start, unsigned int cpu_number) + + /* Type 16 -- Physical Memory Array */ + static void * +-smbios_type_16_init(void *start, uint32_t memsize, int nr_mem_devs) ++smbios_init_type_16(void *start, uint32_t memsize, int nr_mem_devs) + { + struct smbios_type_16 *p = (struct smbios_type_16*)start; + +@@ -2121,7 +2219,7 @@ smbios_type_16_init(void *start, uint32_t memsize, int nr_mem_devs) + + /* Type 17 -- Memory Device */ + static void * +-smbios_type_17_init(void *start, uint32_t memory_size_mb, int instance) ++smbios_init_type_17(void *start, uint32_t memory_size_mb, int instance) + { + struct smbios_type_17 *p = (struct smbios_type_17 *)start; + +@@ -2151,7 +2249,7 @@ smbios_type_17_init(void *start, uint32_t memory_size_mb, int instance) + + /* Type 19 -- Memory Array Mapped Address */ + static void * +-smbios_type_19_init(void *start, uint32_t memory_size_mb, int instance) ++smbios_init_type_19(void *start, uint32_t memory_size_mb, int instance) + { + struct smbios_type_19 *p = (struct smbios_type_19 *)start; + +@@ -2172,7 +2270,7 @@ smbios_type_19_init(void *start, uint32_t memory_size_mb, int instance) + + /* Type 20 -- Memory Device Mapped Address */ + static void * +-smbios_type_20_init(void *start, uint32_t memory_size_mb, int instance) ++smbios_init_type_20(void *start, uint32_t memory_size_mb, int instance) + { + struct smbios_type_20 *p = (struct smbios_type_20 *)start; + +@@ -2196,7 +2294,7 @@ smbios_type_20_init(void *start, uint32_t memory_size_mb, int instance) + + /* Type 32 -- System Boot Information */ + static void * +-smbios_type_32_init(void *start) ++smbios_init_type_32(void *start) + { + struct smbios_type_32 *p = (struct smbios_type_32 *)start; + +@@ -2214,7 +2312,7 @@ smbios_type_32_init(void *start) + + /* Type 127 -- End of Table */ + static void * +-smbios_type_127_init(void *start) ++smbios_init_type_127(void *start) + { + struct smbios_type_127 *p = (struct smbios_type_127 *)start; + +@@ -2228,6 +2326,78 @@ smbios_type_127_init(void *start) + return start + 2; + } + ++static int ++smbios_load_external(int type, char **p, unsigned *nr_structs, ++ unsigned *max_struct_size) ++{ ++#ifdef BX_QEMU ++ static uint64_t used_bitmap[4] = { 0 }; ++ char *start = *p; ++ int i; ++ ++ /* Check if we've already reported these tables */ ++ if (used_bitmap[(type >> 6) & 0x3] & (1ULL << (type & 0x3f))) ++ return 1; ++ ++ /* Don't introduce spurious end markers */ ++ if (type == 127) ++ return 0; ++ ++ for (i = smbios_entries(); i > 0; i--) { ++ struct smbios_table table; ++ struct smbios_structure_header *header = (void *)*p; ++ int string; ++ ++ qemu_cfg_read((uint8_t *)&table, sizeof(struct smbios_header)); ++ table.header.length -= sizeof(struct smbios_header); ++ ++ if (table.header.type != SMBIOS_TABLE_ENTRY) { ++ while (table.header.length--) ++ inb(QEMU_CFG_DATA_PORT); ++ continue; ++ } ++ ++ qemu_cfg_read((uint8_t *)*p, sizeof(struct smbios_structure_header)); ++ table.header.length -= sizeof(struct smbios_structure_header); ++ ++ if (header->type != type) { ++ while (table.header.length--) ++ inb(QEMU_CFG_DATA_PORT); ++ continue; ++ } ++ ++ *p += sizeof(struct smbios_structure_header); ++ ++ /* Entries end with a double NULL char, if there's a string at ++ * the end (length is greater than formatted length), the string ++ * terminator provides the first NULL. */ ++ string = header->length < table.header.length + ++ sizeof(struct smbios_structure_header); ++ ++ /* Read the rest and terminate the entry */ ++ qemu_cfg_read((uint8_t *)*p, table.header.length); ++ *p += table.header.length; ++ *((uint8_t*)*p) = 0; ++ (*p)++; ++ if (!string) { ++ *((uint8_t*)*p) = 0; ++ (*p)++; ++ } ++ ++ (*nr_structs)++; ++ if (*p - (char *)header > *max_struct_size) ++ *max_struct_size = *p - (char *)header; ++ } ++ ++ /* Mark that we've reported on this type */ ++ used_bitmap[(type >> 6) & 0x3] |= (1ULL << (type & 0x3f)); ++ ++ return (start != *p); ++#else /* !BX_QEMU */ ++ return 0; ++#endif ++} ++ + void smbios_init(void) + { + unsigned cpu_num, nr_structs = 0, max_struct_size = 0; +@@ -2246,34 +2416,39 @@ void smbios_init(void) + + p = (char *)start + sizeof(struct smbios_entry_point); + +-#define add_struct(fn) do{ \ +- q = (fn); \ +- nr_structs++; \ +- if ((q - p) > max_struct_size) \ +- max_struct_size = q - p; \ +- p = q; \ +-}while (0) +- +- add_struct(smbios_type_0_init(p)); +- add_struct(smbios_type_1_init(p)); +- add_struct(smbios_type_3_init(p)); ++#define add_struct(type, args...) do { \ ++ if (!smbios_load_external(type, &p, &nr_structs, &max_struct_size)) { \ ++ q = smbios_init_type_##type(args); \ ++ nr_structs++; \ ++ if ((q - p) > max_struct_size) \ ++ max_struct_size = q - p; \ ++ p = q; \ ++ } \ ++} while (0) ++ ++ add_struct(0, p); ++ add_struct(1, p); ++ add_struct(3, p); + for (cpu_num = 1; cpu_num <= smp_cpus; cpu_num++) +- add_struct(smbios_type_4_init(p, cpu_num)); ++ add_struct(4, p, cpu_num); + + /* Each 'memory device' covers up to 16GB of address space. */ + nr_mem_devs = (memsize + 0x3fff) >> 14; +- add_struct(smbios_type_16_init(p, memsize, nr_mem_devs)); ++ add_struct(16, p, memsize, nr_mem_devs); + for ( i = 0; i < nr_mem_devs; i++ ) + { + uint32_t dev_memsize = ((i == (nr_mem_devs - 1)) + ? (((memsize-1) & 0x3fff)+1) : 0x4000); +- add_struct(smbios_type_17_init(p, dev_memsize, i)); +- add_struct(smbios_type_19_init(p, dev_memsize, i)); +- add_struct(smbios_type_20_init(p, dev_memsize, i)); ++ add_struct(17, p, dev_memsize, i); ++ add_struct(19, p, dev_memsize, i); ++ add_struct(20, p, dev_memsize, i); + } + +- add_struct(smbios_type_32_init(p)); +- add_struct(smbios_type_127_init(p)); ++ add_struct(32, p); ++ /* Add any remaining provided entries before the end marker */ ++ for (i = 0; i < 256; i++) ++ smbios_load_external(i, &p, &nr_structs, &max_struct_size); ++ add_struct(127, p); + + #undef add_struct + +@@ -2380,8 +2555,6 @@ void rombios32_init(uint32_t *s3_resume_vector, uint8_t *shutdown_flag) + + mptable_init(); + +- uuid_probe(); +- + smbios_init(); + + if (acpi_enabled) + + +-- +To unsubscribe from this list: send the line "unsubscribe kvm" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + diff --git a/pc-bios/bios-pq/series b/pc-bios/bios-pq/series index 5a29df939b..0cd0a18aa8 100644 --- a/pc-bios/bios-pq/series +++ b/pc-bios/bios-pq/series @@ -9,3 +9,4 @@ 0009_qemu-bios-pci-hotplug-support.patch 0010_bios-mark-the-acpi-sci-interrupt-as-connected-to-irq-9.patch 0011_read-additional-acpi-tables-from-a-vm.patch +0012-load-smbios-entries-and-files-from-qemu.patch diff --git a/pc-bios/bios.bin b/pc-bios/bios.bin index d7cb1057d4dd4ba6b030627aab3454217403a917..791f8586e8230ba1b36314ada6e6d1ad807db743 100644 GIT binary patch delta 5049 zcmZu#eRLDomA`L1`oOXEY%GJ#r;`Y82x+iVvPd`-Sz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`di2YB$&f z7NoI7?A*k-WOxiOZZO05wnWmgZ}U5+i<@6x^OOF$d5zN4>dz=mP5g(_w#`fwB*i_u z5P+DaFJ;Ogtt{G#O!va-XV_6`UZ}ovMEV+b{rIm-1eO%>6?U6e*tL(j3a8cZbOuJ& zTuXDb#rtKq8&Yd8Q~G~AW#mb6+l%^AcA&9E)P~1`Q(J$hw&I&zOkIjc^0huB9$^&_ z?2SLzJaIuXbE@V%b@C^Or1lT9Fr4qX-FN)I@j0cf8u0{gZGS_Lj#`Y;zzVw-WI|GZN;r3hq1yJp#i~s-t diff --git a/qemu-options.hx b/qemu-options.hx index f551775152..4d15f9b1ed 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -682,6 +682,27 @@ STEXI Add ACPI table with specified header fields and context from specified files. ETEXI +#ifdef TARGET_I386 +DEF("smbios", HAS_ARG, QEMU_OPTION_smbios, + "-smbios file=binary\n" + " Load SMBIOS entry from binary file\n" + "-smbios type=0[,vendor=str][,version=str][,date=str][,release=%%d.%%d]\n" + " Specify SMBIOS type 0 fields\n" + "-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]\n" + " [,uuid=uuid][,sku=str][,family=str]\n" + " Specify SMBIOS type 1 fields\n") +#endif +STEXI +@item -smbios file=@var{binary} +Load SMBIOS entry from binary file. + +@item -smbios type=0[,vendor=@var{str}][,version=@var{str}][,date=@var{str}][,release=@var{%d.%d}] +Specify SMBIOS type 0 fields + +@item -smbios type=1[,manufacturer=@var{str}][,product=@var{str}][,version=@var{str}][,serial=@var{str}][,uuid=@var{uuid}][,sku=@var{str}][,family=@var{str}] +Specify SMBIOS type 1 fields +ETEXI + #ifdef TARGET_I386 DEFHEADING() #endif diff --git a/vl.c b/vl.c index 1515e7af58..72ea0e40b1 100644 --- a/vl.c +++ b/vl.c @@ -138,6 +138,7 @@ int main(int argc, char **argv) #include "hw/isa.h" #include "hw/baum.h" #include "hw/bt.h" +#include "hw/smbios.h" #include "bt-host.h" #include "net.h" #include "monitor.h" @@ -4214,6 +4215,10 @@ int qemu_uuid_parse(const char *str, uint8_t *uuid) if(ret != 16) return -1; +#ifdef TARGET_I386 + smbios_add_field(1, offsetof(struct smbios_type_1, uuid), 16, uuid); +#endif + return 0; } @@ -4797,6 +4802,12 @@ int main(int argc, char **argv, char **envp) exit(1); } break; + case QEMU_OPTION_smbios: + if(smbios_entry_add(optarg) < 0) { + fprintf(stderr, "Wrong smbios provided\n"); + exit(1); + } + break; #endif #ifdef USE_KQEMU case QEMU_OPTION_no_kqemu: -- 2.50.1