qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] 0.8.2 and win64
@ 2006-07-26 10:08 ZIGLIO, Frediano, VF-IT
  2006-07-26 10:36 ` Johannes Schindelin
  2006-07-27  4:00 ` Igor Kovalenko
  0 siblings, 2 replies; 6+ messages in thread
From: ZIGLIO, Frediano, VF-IT @ 2006-07-26 10:08 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 546 bytes --]

Hi,
  as expected 0.8.2 make windows 64 works. There is however a small
problem with network card. Windows 64 do not support old ne card so I
used rtl8139. It seems that 8139plus card make windows enter in an
infinite loop at shutdown. Changing pci id from 0x20 to 0x10 (that is
use old 8139, not plus) make the card work. I'm unable to find windows
driver for pcnet so I'm unable to try it. Just to make it happy I wrote
this patch that add a rtl8139too card. It simply change pci revision id
but use rtl8139 code.

Frediano Ziglio


[-- Attachment #2: 8139too.diff --]
[-- Type: application/octet-stream, Size: 5806 bytes --]

Index: vl.h
===================================================================
RCS file: /sources/qemu/qemu/vl.h,v
retrieving revision 1.136
diff -u -1 -0 -r1.136 vl.h
--- vl.h	13 Jul 2006 23:20:22 -0000	1.136
+++ vl.h	26 Jul 2006 08:59:23 -0000
@@ -820,21 +820,21 @@
                        BlockDriverState **fds);
 int fdctrl_get_drive_type(fdctrl_t *fdctrl, int drive_num);
 
 /* ne2000.c */
 
 void isa_ne2000_init(int base, int irq, NICInfo *nd);
 void pci_ne2000_init(PCIBus *bus, NICInfo *nd);
 
 /* rtl8139.c */
 
-void pci_rtl8139_init(PCIBus *bus, NICInfo *nd);
+void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int old_card);
 
 /* pcnet.c */
 
 void pci_pcnet_init(PCIBus *bus, NICInfo *nd);
 
 /* pckbd.c */
 
 void kbd_init(void);
 
 /* mc146818rtc.c */
Index: hw/pci.c
===================================================================
RCS file: /sources/qemu/qemu/hw/pci.c,v
retrieving revision 1.27
diff -u -1 -0 -r1.27 pci.c
--- hw/pci.c	4 Jul 2006 11:33:00 -0000	1.27
+++ hw/pci.c	26 Jul 2006 08:59:23 -0000
@@ -485,19 +485,21 @@
 {
     pci_for_each_device(pci_info_device);
 }
 
 /* Initialize a PCI NIC.  */
 void pci_nic_init(PCIBus *bus, NICInfo *nd)
 {
     if (strcmp(nd->model, "ne2k_pci") == 0) {
         pci_ne2000_init(bus, nd);
     } else if (strcmp(nd->model, "rtl8139") == 0) {
-        pci_rtl8139_init(bus, nd);
+        pci_rtl8139_init(bus, nd, 0);
+    } else if (strcmp(nd->model, "rtl8139too") == 0) {
+        pci_rtl8139_init(bus, nd, 1);
     } else if (strcmp(nd->model, "pcnet") == 0) {
         pci_pcnet_init(bus, nd);
     } else {
         fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd->model);
         exit (1);
     }
 }
 
Index: hw/rtl8139.c
===================================================================
RCS file: /sources/qemu/qemu/hw/rtl8139.c,v
retrieving revision 1.4
diff -u -1 -0 -r1.4 rtl8139.c
--- hw/rtl8139.c	10 Jul 2006 21:38:17 -0000	1.4
+++ hw/rtl8139.c	26 Jul 2006 08:59:25 -0000
@@ -340,22 +340,20 @@
     HasLWake = (1 << 1),
 };
 
 #define HW_REVID(b30, b29, b28, b27, b26, b23, b22) \
     (b30<<30 | b29<<29 | b28<<28 | b27<<27 | b26<<26 | b23<<23 | b22<<22)
 #define HW_REVID_MASK    HW_REVID(1, 1, 1, 1, 1, 1, 1)
 
 #define RTL8139_PCI_REVID_8139      0x10
 #define RTL8139_PCI_REVID_8139CPLUS 0x20
 
-#define RTL8139_PCI_REVID           RTL8139_PCI_REVID_8139CPLUS
-
 /* Size is 64 * 16bit words */
 #define EEPROM_9346_ADDR_BITS 6
 #define EEPROM_9346_SIZE  (1 << EEPROM_9346_ADDR_BITS)
 #define EEPROM_9346_ADDR_MASK (EEPROM_9346_SIZE - 1)
 
 enum Chip9346Operation
 {
     Chip9346_op_mask = 0xc0,          /* 10 zzzzzz */
     Chip9346_op_read = 0x80,          /* 10 AAAAAA */
     Chip9346_op_write = 0x40,         /* 01 AAAAAA D(15)..D(0) */
@@ -453,20 +451,21 @@
     uint16_t MultiIntr;
 
     uint16_t BasicModeCtrl;
     uint16_t BasicModeStatus;
     uint16_t NWayAdvert;
     uint16_t NWayLPAR;
     uint16_t NWayExpansion;
 
     uint16_t CpCmd;
     uint8_t  TxThresh;
+    uint8_t  PciRevId;
 
     int irq;
     PCIDevice *pci_dev;
     VLANClientState *vc;
     uint8_t macaddr[6];
     int rtl8139_mmio_io_addr;
 
     /* C ring mode */
     uint32_t   currTxDesc;
 
@@ -2862,21 +2861,21 @@
             ret = 0xd0;
             DEBUG_PRINT(("RTL8139: MediaStatus read 0x%x\n", ret));
             break;
 
         case HltClk:
             ret = s->clock_enabled;
             DEBUG_PRINT(("RTL8139: HltClk read 0x%x\n", ret));
             break;
 
         case PCIRevisionID:
-            ret = RTL8139_PCI_REVID;
+            ret = s->PciRevId;
             DEBUG_PRINT(("RTL8139: PCI Revision ID read 0x%x\n", ret));
             break;
 
         case TxThresh:
             ret = s->TxThresh;
             DEBUG_PRINT(("RTL8139C+ TxThresh read(b) val=0x%02x\n", ret));
             break;
 
         case 0x43: /* Part of TxConfig register. Windows driver tries to read it */
             ret = s->TxConfig >> 24;
@@ -3394,45 +3393,46 @@
         DEBUG_PRINT(("RTL8139: >>> timer: timeout tick=%08u\n", s->TCTR));
         s->IntrStatus |= PCSTimeout;
         rtl8139_update_irq(s);
     }
 
     qemu_mod_timer(s->timer, 
         rtl8139_get_next_tctr_time(s,curr_time));
 }
 #endif /* RTL8139_ONBOARD_TIMER */
 
-void pci_rtl8139_init(PCIBus *bus, NICInfo *nd)
+void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int old_card)
 {
     PCIRTL8139State *d;
     RTL8139State *s;
     uint8_t *pci_conf;
     
     d = (PCIRTL8139State *)pci_register_device(bus,
                                               "RTL8139", sizeof(PCIRTL8139State),
                                               -1, 
                                               NULL, NULL);
+    s = &d->rtl8139;
+    s->PciRevId = old_card ? RTL8139_PCI_REVID_8139 : RTL8139_PCI_REVID_8139CPLUS;
+
     pci_conf = d->dev.config;
     pci_conf[0x00] = 0xec; /* Realtek 8139 */
     pci_conf[0x01] = 0x10;
     pci_conf[0x02] = 0x39;
     pci_conf[0x03] = 0x81;
     pci_conf[0x04] = 0x05; /* command = I/O space, Bus Master */
-    pci_conf[0x08] = RTL8139_PCI_REVID; /* PCI revision ID; >=0x20 is for 8139C+ */
+    pci_conf[0x08] = s->PciRevId; /* PCI revision ID; >=0x20 is for 8139C+ */
     pci_conf[0x0a] = 0x00; /* ethernet network controller */
     pci_conf[0x0b] = 0x02;
     pci_conf[0x0e] = 0x00; /* header_type */
     pci_conf[0x3d] = 1;    /* interrupt pin 0 */
     pci_conf[0x34] = 0xdc;
 
-    s = &d->rtl8139;
-
     /* I/O handler for memory-mapped I/O */
     s->rtl8139_mmio_io_addr =
     cpu_register_io_memory(0, rtl8139_mmio_read, rtl8139_mmio_write, s);
 
     pci_register_io_region(&d->dev, 0, 0x100, 
                            PCI_ADDRESS_SPACE_IO,  rtl8139_ioport_map);
 
     pci_register_io_region(&d->dev, 1, 0x100, 
                            PCI_ADDRESS_SPACE_MEM, rtl8139_mmio_map);
 

^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: [Qemu-devel] 0.8.2 and win64
@ 2006-07-27 13:05 ZIGLIO, Frediano, VF-IT
  2006-07-27 17:13 ` Igor Kovalenko
  0 siblings, 1 reply; 6+ messages in thread
From: ZIGLIO, Frediano, VF-IT @ 2006-07-27 13:05 UTC (permalink / raw)
  To: qemu-devel

> 	
> On 7/26/06, ZIGLIO, Frediano, VF-IT <Frediano.Ziglio@vodafone.com>
wrote: 
> > 
> > Hi,
> >   as expected 0.8.2 make windows 64 works. There is however a small
> > problem with network card. Windows 64 do not support old ne card so
I
> > used rtl8139. It seems that 8139plus card make windows enter in an
> > infinite loop at shutdown. Changing pci id from 0x20 to 0x10 (that
is
> > use old 8139, not plus) make the card work. I'm unable to find
windows
> > driver for pcnet so I'm unable to try it. Just to make it happy I
wrote
> > this patch that add a rtl8139too card. It simply change pci revision
id
> > but use rtl8139 code.
> > 
> 
> Do you have debugging logs available? I'm interested in fixing the C+
mode without adding 8139too option. 

Mmm... some suggestion on how to debug? Connect gdb ?

freddy77

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-07-27 17:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-26 10:08 [Qemu-devel] 0.8.2 and win64 ZIGLIO, Frediano, VF-IT
2006-07-26 10:36 ` Johannes Schindelin
2006-07-26 10:38   ` Johannes Schindelin
2006-07-27  4:00 ` Igor Kovalenko
  -- strict thread matches above, loose matches on Subject: below --
2006-07-27 13:05 ZIGLIO, Frediano, VF-IT
2006-07-27 17:13 ` Igor Kovalenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).