#include "util.h"
#include "hypercall.h"
#include "e820.h"
+#include "markers.h"
static int
write_smbios_tables(void *start,
smbios_type_4_init(void *start, unsigned int cpu_number,
char *cpu_manufacturer);
static void *
+smbios_type_11_init(void *start);
+static void *
smbios_type_16_init(void *start, uint32_t memory_size_mb, int nr_mem_devs);
static void *
smbios_type_17_init(void *start, uint32_t memory_size_mb, int instance);
do_struct(smbios_type_3_init(p));
for ( cpu_num = 1; cpu_num <= vcpus; cpu_num++ )
do_struct(smbios_type_4_init(p, cpu_num, cpu_manufacturer));
+ do_struct(smbios_type_11_init(p));
/* Each 'memory device' covers up to 16GB of address space. */
nr_mem_devs = (memsize + 0x3fff) >> 14;
p->release_date_str = 3;
p->rom_size = 0;
+ memset(p->characteristics, 0, 8);
/* BIOS Characteristics. */
p->characteristics[0] = 0x80; /* PCI is supported */
p->characteristics[2] = 0x08; /* EDD is supported */
p->embedded_controller_minor = 0xff;
start += sizeof(struct smbios_type_0);
- strcpy((char *)start, "Xen");
- start += strlen("Xen") + 1;
- strcpy((char *)start, xen_version);
- start += strlen(xen_version) + 1;
+ strcpy((char *)start, bios_vendor.value);
+ start += strlen(bios_vendor.value) + 1;
+
+ if ( strlen(bios_version.value) == 0 ) {
+ strncpy(bios_version.value, xen_version, sizeof(bios_version.value));
+ }
+
+ strcpy((char *)start, bios_version.value);
+ start += strlen(bios_version.value) + 1;
+
strcpy((char *)start, smbios_release_date);
start += strlen(smbios_release_date) + 1;
{
char uuid_str[37];
struct smbios_type_1 *p = (struct smbios_type_1 *)start;
+ int next = 5;
memset(p, 0, sizeof(*p));
memcpy(p->uuid, uuid, 16);
p->wake_up_type = 0x06; /* power switch */
- p->sku_str = 0;
- p->family_str = 0;
start += sizeof(struct smbios_type_1);
+
+ strcpy((char *)start, sys_manufacturer.value);
+ start += strlen(sys_manufacturer.value) + 1;
+ strcpy((char *)start, sys_product_name.value);
+ start += strlen(sys_product_name.value) + 1;
+
+ if ( strlen(sys_product_version.value) == 0 ) {
+ strncpy(sys_product_version.value, xen_version, sizeof(sys_product_version.value));
+ }
- strcpy((char *)start, "Xen");
- start += strlen("Xen") + 1;
- strcpy((char *)start, "HVM domU");
- start += strlen("HVM domU") + 1;
- strcpy((char *)start, xen_version);
- start += strlen(xen_version) + 1;
- uuid_to_string(uuid_str, uuid);
- strcpy((char *)start, uuid_str);
- start += strlen(uuid_str) + 1;
+ strcpy((char *)start, sys_product_version.value);
+ start += strlen(sys_product_version.value) + 1;
+
+ if ( strlen(sys_product_serial.value) == 0 ) {
+ uuid_to_string(uuid_str, uuid);
+ strncpy(sys_product_serial.value, uuid_str, sizeof(sys_product_serial.value));
+ }
+
+ strcpy((char *)start, sys_product_serial.value);
+ start += strlen(sys_product_serial.value) + 1;
+
+ /* no internal defaults for these if the value is not set */
+ if ( strlen(sys_product_sku.value) != 0 ) {
+ strcpy((char *)start, sys_product_sku.value);
+ start += strlen(sys_product_sku.value) + 1;
+ p->sku_str = next++;
+ }
+ else
+ p->sku_str = 0;
+
+ if ( strlen(sys_product_family.value) != 0 ) {
+ strcpy((char *)start, sys_product_family.value);
+ start += strlen(sys_product_family.value) + 1;
+ p->family_str = next++;
+ }
+ else
+ p->family_str = 0;
+
*((uint8_t *)start) = 0;
return start+1;
start += sizeof(struct smbios_type_3);
- strcpy((char *)start, "Xen");
- start += strlen("Xen") + 1;
+ strcpy((char *)start, sys_enclosure_manufacturer.value);
+ start += strlen(sys_enclosure_manufacturer.value) + 1;
+
+ /* no internal defaults for this if the value is not set */
+ if ( strlen(sys_enclosure_serial.value) != 0 ) {
+ strcpy((char *)start, sys_enclosure_serial.value);
+ start += strlen(sys_enclosure_serial.value) + 1;
+ p->serial_number_str = 2;
+ }
+ else
+ p->serial_number_str = 0;
+
*((uint8_t *)start) = 0;
return start+1;
}
return start+1;
}
+/* Type 11 -- OEM Strings */
+static void *
+smbios_type_11_init(void *start)
+{
+ struct smbios_type_11 *p = (struct smbios_type_11 *)start;
+ int i = 0;
+
+ if ( oem_strings_array[0] == NULL )
+ return start; /* no OEM strings to add */
+
+ p->header.type = 11;
+ p->header.length = sizeof(struct smbios_type_11);
+ p->header.handle = 0xB00;
+ start += sizeof(struct smbios_type_11);
+
+ while ( oem_strings_array[i] != NULL ) {
+ strcpy((char *)start, oem_strings_array[i]);
+ start += strlen(oem_strings_array[i]) + 1;
+ i++;
+ }
+ p->count = i;
+ *((uint8_t *)start) = 0;
+
+ return start+1;
+}
+
/* Type 16 -- Physical Memory Array */
static void *
smbios_type_16_init(void *start, uint32_t memsize, int nr_mem_devs)