Add PowerPC power-management state check callback.
[qemu] / hw / mips_malta.c
index aa00d38..6f0edf9 100644 (file)
@@ -42,7 +42,6 @@
 #define ENVP_NB_ENTRIES                16
 #define ENVP_ENTRY_SIZE                256
 
-extern int nographic;
 extern FILE *logfile;
 
 typedef struct {
@@ -67,18 +66,16 @@ static void malta_fpga_update_display(void *opaque)
     int i;
     MaltaFPGAState *s = opaque;
 
-    if (!nographic) {
-        for (i = 7 ; i >= 0 ; i--) {
-            if (s->leds & (1 << i))
-                leds_text[i] = '#';
-            else
-                leds_text[i] = ' ';
-        }
-        leds_text[8] = '\0';
-
-        qemu_chr_printf(s->display, "\e[H\n\n|\e[32m%-8.8s\e[00m|\r\n", leds_text);
-        qemu_chr_printf(s->display, "\n\n\n\n|\e[31m%-8.8s\e[00m|", s->display_text);
+    for (i = 7 ; i >= 0 ; i--) {
+        if (s->leds & (1 << i))
+            leds_text[i] = '#';
+        else
+            leds_text[i] = ' ';
     }
+    leds_text[8] = '\0';
+
+    qemu_chr_printf(s->display, "\e[H\n\n|\e[32m%-8.8s\e[00m|\r\n", leds_text);
+    qemu_chr_printf(s->display, "\n\n\n\n|\e[31m%-8.8s\e[00m|", s->display_text);
 }
 
 /*
@@ -415,22 +412,20 @@ MaltaFPGAState *malta_fpga_init(target_phys_addr_t base, CPUState *env)
     cpu_register_physical_memory(base, 0x900, malta);
     cpu_register_physical_memory(base + 0xa00, 0x100000 - 0xa00, malta);
 
-    if (!nographic) {
-        s->display = qemu_chr_open("vc");
-        qemu_chr_printf(s->display, "\e[HMalta LEDBAR\r\n");
-        qemu_chr_printf(s->display, "+--------+\r\n");
-        qemu_chr_printf(s->display, "+        +\r\n");
-        qemu_chr_printf(s->display, "+--------+\r\n");
-        qemu_chr_printf(s->display, "\n");
-        qemu_chr_printf(s->display, "Malta ASCII\r\n");
-        qemu_chr_printf(s->display, "+--------+\r\n");
-        qemu_chr_printf(s->display, "+        +\r\n");
-        qemu_chr_printf(s->display, "+--------+\r\n");
-
-        uart_chr = qemu_chr_open("vc");
-        qemu_chr_printf(uart_chr, "CBUS UART\r\n");
-        s->uart = serial_mm_init(base + 0x900, 3, env->irq[2], uart_chr, 1);
-    }
+    s->display = qemu_chr_open("vc");
+    qemu_chr_printf(s->display, "\e[HMalta LEDBAR\r\n");
+    qemu_chr_printf(s->display, "+--------+\r\n");
+    qemu_chr_printf(s->display, "+        +\r\n");
+    qemu_chr_printf(s->display, "+--------+\r\n");
+    qemu_chr_printf(s->display, "\n");
+    qemu_chr_printf(s->display, "Malta ASCII\r\n");
+    qemu_chr_printf(s->display, "+--------+\r\n");
+    qemu_chr_printf(s->display, "+        +\r\n");
+    qemu_chr_printf(s->display, "+--------+\r\n");
+
+    uart_chr = qemu_chr_open("vc");
+    qemu_chr_printf(uart_chr, "CBUS UART\r\n");
+    s->uart = serial_mm_init(base + 0x900, 3, env->irq[2], uart_chr, 1);
 
     malta_fpga_reset(s);
     qemu_register_reset(malta_fpga_reset, s);
@@ -515,9 +510,9 @@ static void write_bootloader (CPUState *env, unsigned long bios_offset, int64_t
     stl_raw(p++, 0x00000000);                                      /* nop */
 
     /* YAMON service vector */
-    stl_raw(phys_ram_base + bios_offset + 0x500, 0xbfc00580);      /* start: */                                        
+    stl_raw(phys_ram_base + bios_offset + 0x500, 0xbfc00580);      /* start: */
     stl_raw(phys_ram_base + bios_offset + 0x504, 0xbfc0083c);      /* print_count: */
-    stl_raw(phys_ram_base + bios_offset + 0x520, 0xbfc00580);      /* start: */                                        
+    stl_raw(phys_ram_base + bios_offset + 0x520, 0xbfc00580);      /* start: */
     stl_raw(phys_ram_base + bios_offset + 0x52c, 0xbfc00800);      /* flush_cache: */
     stl_raw(phys_ram_base + bios_offset + 0x534, 0xbfc00808);      /* print: */
     stl_raw(phys_ram_base + bios_offset + 0x538, 0xbfc00800);      /* reg_cpu_isr: */
@@ -796,7 +791,9 @@ void mips_malta_init (int ram_size, int vga_ram_size, int boot_device,
 
     /* Load a BIOS image unless a kernel image has been specified. */
     if (!kernel_filename) {
-        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
+        if (bios_name == NULL)
+            bios_name = BIOS_FILENAME;
+        snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
         ret = load_image(buf, phys_ram_base + bios_offset);
         if (ret < 0 || ret > BIOS_SIZE) {
             fprintf(stderr,