qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] eepro100c additions/changes required for VxWorks 5.4.2 to w


From: ZAPPACOSTA, Rolando (Rolando)
Subject: [Qemu-devel] eepro100c additions/changes required for VxWorks 5.4.2 to work
Date: Wed, 19 Aug 2009 11:38:21 +0200

Hi Stefan,

I was able to make VxWorks 5.4.2 load from FTP it's target binary file (I'll 
now try to figure out why I receive some VxWorks errors once it finishes the 
download).

To do so, I had to implement some 8255x features not yet included as well as to 
change some of the already coded ones.

Please feel free to make any comments to below patch (against repository of 
2009-08-18 16:01 CEST) and to include them.

Last but not least, please don't hesitate to contact me for further information 
and/or testings.

Regards,
Rolando.


--- hw/eepro100.c.original      2009-08-13 09:41:52.000000000 +0200
+++ hw/eepro100.c       2009-08-19 11:13:50.000000000 +0200
@@ -25,6 +25,14 @@
  *      Linux networking e100 driver (mips, mipsel) ok
  *      Linux networking eepro100 driver (mipsel) not ok
  *      Windows networking (Vista) ???
+ *      VxWorks 5.4.2 (i386) ok, tested with 82557b: succesfuly loads
+ *             the target file when limiting the download rate of
+ *             the FTP server to ~5KB/s. The target used to test it
+ *             then hangs with these errors:
+ *                     0x00000633
+ *                     0x00000800
+ *                     0x00000001
+ *                     0x0781ABFD
  *
  * Untested:
  *      non-i386 platforms
@@ -39,6 +47,7 @@
  * EE100   eepro100_write2         feature is missing in this emulation: 
unknown word write
  * EE100   eepro100_read2          addr=General Status/Control+2 val=0x0080
  * EE100   eepro100_read2          feature is missing in this emulation: 
unknown word read
+ * Rolando: action_command => case CmdDiagnose: should make sure bit F gets 
reseted
  */

 #include <assert.h>
@@ -257,6 +266,8 @@ typedef struct {
     /* Temporary data. */
     eepro100_tx_t tx;
     uint32_t cb_address;
+    /* used to store the partial values of the pointer before calling 
eepro100_write_port */
+    uint16_t port_lo_word;

     /* Statistical counters. */
     eepro100_stats_t statistics;
@@ -374,8 +385,8 @@ static const char *nic_dump(const uint8_
 {
     static char dump[3 * 16 + 1];
     char *p = &dump[0];
-    if (size > 16)
-        size = 16;
+    if (size > 2600)
+        size = 2600;
     while (size-- > 0) {
         p += sprintf(p, " %02x", *buf++);
     }
@@ -661,7 +672,7 @@ static const char *e100_reg[PCI_IO_SIZE

 static char *regname(uint32_t addr)
 {
-    static char buf[16];
+    static char buf[26];
     if (addr < PCI_IO_SIZE) {
         const char *r = e100_reg[addr / 4];
         if (r != 0) {
@@ -782,27 +793,30 @@ static void tx_command(EEPRO100State *s)
     TRACE(RXTX, logout
         ("transmit, TBD array address 0x%08x, TCB byte count 0x%04x, TBD count 
%u\n",
          tbd_array, tcb_bytes, s->tx.tbd_count));
-    assert(!(s->tx.command & COMMAND_NC));
-    assert(tcb_bytes <= sizeof(buf));
+
+    if (s->tx.command & COMMAND_NC) {
+        logout("support for NC=1 is not implemented\n");
+       assert (0);
+    }
+
+    if (tcb_bytes > sizeof(buf)) {
+        logout("illegal value of the TCB byte count! (cannot be greater than 
0x%04x)\n", sizeof(buf));
+       assert (0);
+    }
+
     if (!((tcb_bytes > 0) || (tbd_array != 0xffffffff))) {
         logout
             ("illegal values of TBD array address and TCB byte count!\n");
     }
-    for (size = 0; size < tcb_bytes; ) {
-        uint32_t tx_buffer_address = ldl_le_phys(tbd_address);
-        uint16_t tx_buffer_size = lduw_le_phys(tbd_address + 4);
-        //~ uint16_t tx_buffer_el = lduw_le_phys(tbd_address + 6);
-        tbd_address += 8;
-        TRACE(RXTX, logout
-            ("TBD (simplified mode): buffer address 0x%08x, size 0x%04x\n",
-             tx_buffer_address, tx_buffer_size));
-        assert(size + tx_buffer_size <= sizeof(buf));
-        cpu_physical_memory_read(tx_buffer_address, &buf[size],
-                                 tx_buffer_size);
-        size += tx_buffer_size;
+
+    if (tcb_bytes > 0) {
+           TRACE(RXTX, logout("TCB byte count>0, adding the data after the TCB 
to the buffer\n"));
+           cpu_physical_memory_read(s->cb_address + 0x10, &buf[0], tcb_bytes);
+           size = tcb_bytes;
     }
     if (!(s->tx.command & COMMAND_SF)) {
         /* Simplified mode. Was already handled by code above. */
+        TRACE(RXTX, logout("Simplified Mode, no TBDs have to be processed\n"));
         if (tbd_array != 0xffffffff) {
             UNEXPECTED();
         }
@@ -896,16 +910,18 @@ static void action_command(EEPRO100State
         switch (s->tx.command & COMMAND_CMD) {
         case CmdNOp:
             /* Do nothing. */
+            TRACE(OTHER, logout("   Rolando: NOP\n"));
             break;
         case CmdIASetup:
             cpu_physical_memory_read(s->cb_address + 8, &s->macaddr[0], 6);
-            TRACE(OTHER, logout("macaddr: %s\n", nic_dump(&s->macaddr[0], 6)));
+            TRACE(OTHER, logout("initial addr setup, macaddr: %s\n", 
nic_dump(&s->macaddr[0], 6)));
         // !!! missing
             break;
         case CmdConfigure:
             cpu_physical_memory_read(s->cb_address + 8, &s->configuration[0],
                                      sizeof(s->configuration));
-            TRACE(OTHER, logout("configuration: %s\n", 
nic_dump(&s->configuration[0], 16)));
+            TRACE(OTHER, logout("configuration: %s\n", 
nic_dump(&s->configuration[0], sizeof(s->configuration))));
+            TRACE(OTHER, logout("   Rolando: NSAI bit=0x%01x (1=SA comes from 
memory, 0=SA comes from internal device IA)\n", (s->configuration[10] & 4)/4));
             break;
         case CmdMulticastList:
             set_multicast_list(s);
@@ -918,6 +934,9 @@ static void action_command(EEPRO100State
             /* Starting with offset 8, the command contains
              * 64 dwords microcode which we just ignore here. */
             break;
+        case CmdDiagnose:
+            TRACE(OTHER, logout("   Rolando: diagnose\n"));
+            break;
         default:
             missing("undefined command");
         }
@@ -1079,9 +1098,9 @@ static uint16_t eepro100_read_eeprom(EEP
     return val;
 }

-static void eepro100_write_eeprom(eeprom_t * eeprom, uint8_t val)
+static void eepro100_write_eeprom(eeprom_t * eeprom, uint32_t val)
 {
-    TRACE(OTHER, logout("val=0x%02x\n", val));
+    TRACE(OTHER, logout("val=0x%08x\n", val));

     /* mask unwriteable bits */
     //~ val = SET_MASKED(val, 0x31, eeprom->value);
@@ -1129,7 +1148,7 @@ static const char *reg2name(uint8_t reg)
     if (reg < ARRAY_SIZE(mdi_reg_name)) {
         p = mdi_reg_name[reg];
     } else {
-        snprintf(buffer, sizeof(buf), "reg=0x%02x", reg);
+        snprintf(buffer, sizeof(buffer), "reg=0x%02x", reg);
     }
     return p;
 }
@@ -1364,12 +1383,16 @@ static uint16_t eepro100_read2(EEPRO100S
     switch (addr) {
     case SCBStatus:
         //~ val = eepro100_read_status(s);
-        TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val));
+        TRACE(OTHER, logout("   Rolando: read the Status word, addr=%s 
val=0x%04x\n", regname(addr), val));
         break;
     case SCBeeprom:
         val = eepro100_read_eeprom(s);
         TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val));
         break;
+    case SCBCmd:
+        // val = eepro100_read_command(s);
+        TRACE(OTHER, logout("   Rolando: read the Command word, addr=%s 
val=0x%04x\n", regname(addr), val));
+        break;
     default:
         logout("addr=%s val=0x%04x\n", regname(addr), val);
         missing("unknown word read");
@@ -1484,6 +1507,23 @@ static void eepro100_write2(EEPRO100Stat
     case SCBeeprom:
         eepro100_write_eeprom(s->eeprom, val);
         break;
+    case SCBPointer:
+       s->pointer = (s->pointer & 0xffff0000) + val;
+       logout("   Rolando: wrote the General Pointer, it's now 0x%08x\n", 
s->pointer);
+       break;
+    case SCBPointer+2:
+       s->pointer = (s->pointer & 0xffff) + ( val * 0x10000 );
+       logout("   Rolando: wrote the General Pointer, it's now 0x%08x\n", 
s->pointer);
+       break;
+    case SCBPort:
+       s->port_lo_word = val;
+       logout("   Rolando: stored the low-word of the Port Interface: 
0x%04x\n", s->port_lo_word);
+       break;
+    case SCBPort+2:
+       val = s->port_lo_word + val*0x10000;
+       logout("   Rolando: got the hi-word of the Port Interface, calling it. 
The command is 0x%08x\n", val);
+       eepro100_write_port(s, val);
+       break;
     default:
         logout("addr=%s val=0x%04x\n", regname(addr), val);
         missing("unknown word write");




reply via email to

[Prev in Thread] Current Thread [Next in Thread]