Add PowerPC power-management state check callback.
[qemu] / hw / mcf5208.c
index 49108e0..993a686 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Motorola ColdFire MCF5208 SoC emulation.
  *
  * Copyright (c) 2007 CodeSourcery.
@@ -62,9 +62,9 @@ static void m5208_timer_write(m5208_timer_state *s, int offset,
         prescale = 1 << ((s->pcsr & PCSR_PRE_MASK) >> PCSR_PRE_SHIFT);
         ptimer_set_freq(s->timer, (SYS_FREQ / 2) / prescale);
         if (s->pcsr & PCSR_RLD)
-            limit = 0xffff;
-        else
             limit = s->pmr;
+        else
+            limit = 0xffff;
         ptimer_set_limit(s->timer, limit, 0);
 
         if (s->pcsr & PCSR_EN)
@@ -73,9 +73,12 @@ static void m5208_timer_write(m5208_timer_state *s, int offset,
     case 2:
         s->pmr = value;
         s->pcsr &= ~PCSR_PIF;
-        if (s->pcsr & PCSR_RLD)
-            value = 0xffff;
-        ptimer_set_limit(s->timer, value, s->pcsr & PCSR_OVW);
+        if ((s->pcsr & PCSR_RLD) == 0) {
+            if (s->pcsr & PCSR_OVW)
+                ptimer_set_count(s->timer, value);
+        } else {
+            ptimer_set_limit(s->timer, value, s->pcsr & PCSR_OVW);
+        }
         break;
     case 4:
         break;
@@ -233,10 +236,27 @@ static void mcf5208evb_init(int ram_size, int vga_ram_size, int boot_device,
 
     mcf5208_sys_init(pic);
 
+    if (nb_nics > 1) {
+        fprintf(stderr, "Too many NICs\n");
+        exit(1);
+    }
+    if (nd_table[0].vlan) {
+        if (nd_table[0].model == NULL
+            || strcmp(nd_table[0].model, "mcf_fec") == 0) {
+            mcf_fec_init(&nd_table[0], 0xfc030000, pic + 36);
+        } else if (strcmp(nd_table[0].model, "?") == 0) {
+            fprintf(stderr, "qemu: Supported NICs: mcf_fec\n");
+            exit (1);
+        } else {
+            fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model);
+            exit (1);
+        }
+    }
+
     /*  0xfc000000 SCM.  */
     /*  0xfc004000 XBS.  */
     /*  0xfc008000 FlexBus CS.  */
-    /*  0xfc030000 FEC.  */
+    /* 0xfc030000 FEC.  */
     /*  0xfc040000 SCM + Power management.  */
     /*  0xfc044000 eDMA.  */
     /* 0xfc048000 INTC.  */