[OpenBIOS] r319 - in openbios-devel: arch/ppc/qemu arch/sparc64 drivers

svn at openbios.org svn at openbios.org
Tue Dec 23 14:38:11 CET 2008


Author: blueswirl
Date: 2008-12-23 14:38:11 +0100 (Tue, 23 Dec 2008)
New Revision: 319

Modified:
   openbios-devel/arch/ppc/qemu/init.c
   openbios-devel/arch/sparc64/openbios.c
   openbios-devel/drivers/obio.c
Log:
Check configuration device version

Modified: openbios-devel/arch/ppc/qemu/init.c
===================================================================
--- openbios-devel/arch/ppc/qemu/init.c	2008-12-23 13:14:33 UTC (rev 318)
+++ openbios-devel/arch/ppc/qemu/init.c	2008-12-23 13:38:11 UTC (rev 319)
@@ -105,13 +105,22 @@
 void
 entry( void )
 {
-        uint32_t temp;
-        uint16_t machine_id;
+        uint32_t temp = 0;
+        uint16_t machine_id = 0;
         char buf[5], qemu_uuid[16];
 
-        machine_id = fw_cfg_read_i16(FW_CFG_MACHINE_ID);
+        arch = &known_arch[ARCH_HEATHROW];
 
-        arch = &known_arch[machine_id];
+        fw_cfg_read(FW_CFG_SIGNATURE, buf, 4);
+        buf[4] = '\0';
+        if (strncmp(buf, "QEMU", 4) == 0) {
+            temp = fw_cfg_read_i32(FW_CFG_ID);
+            if (temp == 1) {
+                machine_id = fw_cfg_read_i16(FW_CFG_MACHINE_ID);
+                arch = &known_arch[machine_id];
+            }
+        }
+
 	isa_io_base = arch->io_base;
 
 	serial_init();
@@ -120,13 +129,13 @@
 	printk("=============================================================\n");
 	printk("OpenBIOS %s [%s]\n", OPENBIOS_RELEASE, OPENBIOS_BUILD_DATE );
 
-        fw_cfg_read(FW_CFG_SIGNATURE, buf, 4);
-        buf[4] = '\0';
 
+        if (temp != 1) {
+            printk("Incompatible configuration device version, freezing\n");
+            for(;;);
+        }
         printk("Configuration device id %s", buf);
 
-        temp = fw_cfg_read_i32(FW_CFG_ID);
-
         printk(" version %d machine id %d\n", temp, machine_id);
 
         temp = fw_cfg_read_i32(FW_CFG_NB_CPUS);

Modified: openbios-devel/arch/sparc64/openbios.c
===================================================================
--- openbios-devel/arch/sparc64/openbios.c	2008-12-23 13:14:33 UTC (rev 318)
+++ openbios-devel/arch/sparc64/openbios.c	2008-12-23 13:38:11 UTC (rev 319)
@@ -656,6 +656,11 @@
 
     printk(" version %d machine id %d\n", temp, machine_id);
 
+    if (temp != 1) {
+        printk("Incompatible configuration device version, freezing\n");
+        for(;;);
+    }
+
     kernel_image = nv_info.kernel_image;
     kernel_size = nv_info.kernel_size;
     size = nv_info.cmdline_size;

Modified: openbios-devel/drivers/obio.c
===================================================================
--- openbios-devel/drivers/obio.c	2008-12-23 13:14:33 UTC (rev 318)
+++ openbios-devel/drivers/obio.c	2008-12-23 13:38:11 UTC (rev 319)
@@ -1042,6 +1042,11 @@
 
     printk(" version %d machine id %d\n", temp, machine_id);
 
+    if (temp != 1) {
+        printk("Incompatible configuration device version, freezing\n");
+        for(;;);
+    }
+
     memcpy(&nv_info, nvram, sizeof(nv_info));
     kernel_image = nv_info.kernel_image;
     kernel_size = nv_info.kernel_size;




More information about the OpenBIOS mailing list