]> Zhao Yanbai Git Server - minix.git/commitdiff
Support for ethernet in QEMU.
authorPhilip Homburg <philip@cs.vu.nl>
Tue, 9 Aug 2005 11:23:41 +0000 (11:23 +0000)
committerPhilip Homburg <philip@cs.vu.nl>
Tue, 9 Aug 2005 11:23:41 +0000 (11:23 +0000)
drivers/dp8390/rtl8029.c
drivers/libpci/pci.c

index 631f63d879436878ffb720c1812be7326d65b053..76fa8cf52436563c534fd5961270d61735c3d534 100644 (file)
@@ -119,12 +119,10 @@ struct dpeth *dep;
        pci_reserve(devind);
        /* printf("cr = 0x%x\n", pci_attr_r16(devind, PCI_CR)); */
        bar= pci_attr_r32(devind, PCI_BAR) & 0xffffffe0;
-       if ((bar & 0x3ff) >= 0x100-32 || bar < 0x400)
-       {
-               printf("rtl8029: ignoring bad base address 0x%x for QEMU\n",
-                       bar);
-               /* panic("", "base address is not properly configured", NO_NUM); */
-       }
+
+       if (bar < 0x400)
+               panic("", "base address is not properly configured", NO_NUM);
+
        dep->de_base_port= bar;
 
        ilr= pci_attr_r8(devind, PCI_ILR);
index bb444f2d0dcb513d85b97a6df0442c8eff7eacb2..65b4ffaa7d96627fe46691125151334b620efc84 100644 (file)
@@ -24,7 +24,6 @@ Created:      Jan 2000 by Philip Homburg <philip@cs.vu.nl>
 
 
 #if !__minix_vmd
-#define debug 0        
 #define irq_mode_pci(irq) ((void)0)
 #endif
 
@@ -39,6 +38,8 @@ Created:      Jan 2000 by Philip Homburg <philip@cs.vu.nl>
 #define PBT_INTEL       1
 #define PBT_PCIBRIDGE   2
 
+PRIVATE int debug= 0;
+
 PRIVATE struct pcibus
 {
        int pb_type;
@@ -71,6 +72,9 @@ PRIVATE struct pcidev
 } pcidev[NR_PCIDEV];
 PRIVATE int nr_pcidev= 0;
 
+/* Work around the limitation of the PCI emulation in QEMU 0.7.1 */
+PRIVATE int qemu_pci= 0;
+
 FORWARD _PROTOTYPE( void pci_intel_init, (void)                                );
 FORWARD _PROTOTYPE( void probe_bus, (int busind)                       );
 FORWARD _PROTOTYPE( int do_isabridge, (int busind)                     );
@@ -150,9 +154,20 @@ PUBLIC void pci_init()
 {
        static int first_time= 1;
 
+       long v;
+
        if (!first_time)
                return;
 
+       v= 0;
+       env_parse("qemu_pci", "d", 0, &v, 0, 1);
+       qemu_pci= v;
+
+       v= 0;
+       env_parse("pci_debug", "d", 0, &v, 0, 1);
+       debug= v;
+
+
        /* We don't expect to interrupted */
        assert(first_time == 1);
        first_time= -1;
@@ -514,21 +529,20 @@ printf("probe_bus(%d)\n", busind);
                        did= pci_attr_r16(devind, PCI_DID);
                        headt= pci_attr_r8(devind, PCI_HEADT);
                        sts= pci_attr_rsts(devind);
+
+                       if (vid == NO_VID)
+                               break;  /* Nothing here */
+
                        if (sts & (PSR_SSE|PSR_RMAS|PSR_RTAS))
                        {
-#if 0
-                               printf(
+                               if (qemu_pci)
+                               {
+                                       printf(
                        "pci: ignoring bad value 0x%x in sts for QEMU\n",
                                        sts & (PSR_SSE|PSR_RMAS|PSR_RTAS));
-#endif
-                               break;
-                       }
-                       if (vid == NO_VID)
-                       {
-                               /* Some bridge implementations do support 
-                                * pci_attr_rsts.
-                                */
-                               break;
+                               }
+                               else
+                                       break;
                        }
 
                        dstr= pci_dev_name(vid, did);
@@ -800,10 +814,17 @@ int devind;
                                printf("INT%c: %d\n", 'A'+i, irq);
                        if (!(elcr & (1 << irq)))
                        {
-                               printf("IRQ %d is not level triggered\n",
-                                       irq);
-                               printf("(ignored for QEMU)\n");
-                               /* panic(NULL,NULL, NO_NUM); */
+                               if (qemu_pci)
+                               {
+                                       printf(
+                       "IRQ is not level triggered (ignored for QEMU)\n");
+                               }
+                               else
+                               {
+                                       panic("PCI",
+                                               "IRQ is not level triggered\n",
+                                               NO_NUM);
+                               }
                        }
                        irq_mode_pci(irq);
                }