Skip to contentSkip to conversation

HVM SMBIOS support 6/6

RFC PATCH New Andrew D. Ball 1 participant 1 message Jul 7, 2006

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 HVM SMBIOS support 6/6

[HVM] [Firmware] Write SMBIOS tables in hvmloader if enabled.

tools/firmware/hvmloader/Makefile +4 -4
diff -r 5e4bb5e0903f tools/firmware/hvmloader/Makefile
@@ -31,7 +31,7 @@
 DEFINES  =-DDEBUG
 XENINC   =-I$(XEN_ROOT)/tools/libxc
 
-OBJECTS	 = hvmloader.o acpi_madt.o util.o
+OBJECTS	 = hvmloader.o acpi_madt.o util.o smbios.o
 
 # Disable PIE/SSP if GCC supports them. They can break us.
 CFLAGS  += $(call test-gcc-flag,$(CC),-nopie)
@@ -45,9 +45,9 @@
 .PHONY: all
 all: hvmloader
 
-hvmloader: roms.h hvmloader.c acpi_madt.c util.c
-	$(CC) $(CFLAGS) -c hvmloader.c acpi_madt.c util.c
-	$(CC) $(LDFLAGS) -o hvmloader.tmp hvmloader.o acpi_madt.o util.o
+hvmloader: roms.h hvmloader.c acpi_madt.c util.c smbios.c
+	$(CC) $(CFLAGS) -c hvmloader.c acpi_madt.c util.c smbios.c
+	$(CC) $(LDFLAGS) -o hvmloader.tmp hvmloader.o acpi_madt.o util.o smbios.o
 	$(OBJCOPY) hvmloader.tmp hvmloader
 	rm -f hvmloader.tmp
 
tools/firmware/hvmloader/hvmloader.c +25 -0
diff -r 5e4bb5e0903f tools/firmware/hvmloader/hvmloader.c
@@ -24,6 +24,7 @@
 #include "roms.h"
 #include "../acpi/acpi2_0.h"  /* for ACPI_PHYSICAL_ADDRESS */
 #include "util.h"
+#include "smbios.h"
 
 /* memory map */
 #define VGABIOS_PHYSICAL_ADDRESS	0x000C0000
@@ -139,8 +140,17 @@
 }
 
 int
+get_smbios_enabled(void)
+{
+	struct hvm_info_table *t = get_hvm_info_table();
+	return t->smbios_enabled != 0;
+}
+
+int
 main(void)
 {
+	struct hvm_info_table *t = NULL;
+
 	puts("HVM Loader\n");
 
 	puts("Loading ROMBIOS ...\n");
@@ -168,6 +178,21 @@
 		}
 	}
 
+	if (get_smbios_enabled() != 0) {
+		puts("Loading SMBIOS ...\n");
+		t = get_hvm_info_table();
+		if (t == NULL) {
+			puts("Could not get hvm_info_table\n");
+		} else {
+			write_smbios_tables((void *)SMBIOS_PHYSICAL_ADDRESS,
+			                    SMBIOS_SIZE_LIMIT,
+			                    t->nr_vcpus, t->memsize, t->uuid,
+			                    t->xen_version,
+			                    t->xen_major_version,
+			                    t->xen_minor_version);
+		}
+	}
+
 	if (check_amd()) {
 		/* AMD implies this is SVM */
                 puts("SVM go ...\n");
tools/firmware/hvmloader/smbios.c new file +538 -0

538 lines not on this page · raw message

tools/firmware/hvmloader/smbios.h new file +56 -0

56 lines not on this page · raw message

tools/firmware/hvmloader/smbios_types.h new file +192 -0

192 lines not on this page · raw message

[HVM] [Firmware] Write SMBIOS tables in hvmloader if enabled.

tools/firmware/hvmloader/Makefile +4 -4
diff -r 5e4bb5e0903f tools/firmware/hvmloader/Makefile
@@ -31,7 +31,7 @@
 DEFINES  =-DDEBUG
 XENINC   =-I$(XEN_ROOT)/tools/libxc
 
-OBJECTS	 = hvmloader.o acpi_madt.o util.o
+OBJECTS	 = hvmloader.o acpi_madt.o util.o smbios.o
 
 # Disable PIE/SSP if GCC supports them. They can break us.
 CFLAGS  += $(call test-gcc-flag,$(CC),-nopie)
@@ -45,9 +45,9 @@
 .PHONY: all
 all: hvmloader
 
-hvmloader: roms.h hvmloader.c acpi_madt.c util.c
-	$(CC) $(CFLAGS) -c hvmloader.c acpi_madt.c util.c
-	$(CC) $(LDFLAGS) -o hvmloader.tmp hvmloader.o acpi_madt.o util.o
+hvmloader: roms.h hvmloader.c acpi_madt.c util.c smbios.c
+	$(CC) $(CFLAGS) -c hvmloader.c acpi_madt.c util.c smbios.c
+	$(CC) $(LDFLAGS) -o hvmloader.tmp hvmloader.o acpi_madt.o util.o smbios.o
 	$(OBJCOPY) hvmloader.tmp hvmloader
 	rm -f hvmloader.tmp
 
tools/firmware/hvmloader/hvmloader.c +25 -0
diff -r 5e4bb5e0903f tools/firmware/hvmloader/hvmloader.c
@@ -24,6 +24,7 @@
 #include "roms.h"
 #include "../acpi/acpi2_0.h"  /* for ACPI_PHYSICAL_ADDRESS */
 #include "util.h"
+#include "smbios.h"
 
 /* memory map */
 #define VGABIOS_PHYSICAL_ADDRESS	0x000C0000
@@ -139,8 +140,17 @@
 }
 
 int
+get_smbios_enabled(void)
+{
+	struct hvm_info_table *t = get_hvm_info_table();
+	return t->smbios_enabled != 0;
+}
+
+int
 main(void)
 {
+	struct hvm_info_table *t = NULL;
+
 	puts("HVM Loader\n");
 
 	puts("Loading ROMBIOS ...\n");
@@ -168,6 +178,21 @@
 		}
 	}
 
+	if (get_smbios_enabled() != 0) {
+		puts("Loading SMBIOS ...\n");
+		t = get_hvm_info_table();
+		if (t == NULL) {
+			puts("Could not get hvm_info_table\n");
+		} else {
+			write_smbios_tables((void *)SMBIOS_PHYSICAL_ADDRESS,
+			                    SMBIOS_SIZE_LIMIT,
+			                    t->nr_vcpus, t->memsize, t->uuid,
+			                    t->xen_version,
+			                    t->xen_major_version,
+			                    t->xen_minor_version);
+		}
+	}
+
 	if (check_amd()) {
 		/* AMD implies this is SVM */
                 puts("SVM go ...\n");
tools/firmware/hvmloader/smbios.c new file +538 -0

538 lines not on this page · raw message

tools/firmware/hvmloader/smbios.h new file +56 -0

56 lines not on this page · raw message

tools/firmware/hvmloader/smbios_types.h new file +192 -0

192 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel