This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RealTek 8139 driver, 2. revision


On Wed, 2003-08-06 at 08:39, Eric Doenges wrote:
> Hi,
> 
> 
> this is the second revision of my 8139 driver, with changes suggested by
> Chris Nimmers (thanks Chris !). The differences to the 1. revision are:
> 
> 1. Added a cyg_drv_interrupt_acknowledge() in the ISR for platforms that
>     need it (the i386 PC seems to; mine doesn't).
> 
> 2. Made the interrupt masking configurable -- either by masking the
>     interrupt itself with cyg_drv_interrupt_mask(), or by masking the
>     interrupt source in the 8139 itself (the way I did it previously).
> 
> 3. Made interrupt sharing configurable (this is closely related to 2).
> 
> Both interrupt masking options work on my platform; I'd be interested
> to hear if there are problems on other platforms.

I've now tested this on another platform (ARM Xscale).  I had to make
a couple of changes:
  * As I mentioned before, on some systems the CPU and PCI bus masters
    don't address memory using the same addresses (some translation is
    required).
  * I experienced problems with the Rx buffer data because the buffers
    were cacheable.  On some systems (this one and most PowerPC), the
    CPU may not see changes to data which happens to already be in the
    CPU cache.  I got around this by using a non-cached address to
    access the Rx data.  n.b. this may not be sufficient for all 
    platforms.

Other than that, it was pretty easy to integrate and get working.

Any ideas when the paperwork will be signed?

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates
diff -ur /tmp/devs/eth/rltk/8139/current/src/if_8139.c devs/eth/rltk/8139/current/src/if_8139.c
--- /tmp/devs/eth/rltk/8139/current/src/if_8139.c	2003-08-06 08:30:19.000000000 -0600
+++ devs/eth/rltk/8139/current/src/if_8139.c	2003-08-08 13:06:10.000000000 -0600
@@ -609,19 +609,19 @@
    * Note the use of CYGARC_PHYSICAL_ADDRESS for platforms on which virtual
    * and physical addresses do not match.
    */
-  OUTL(CYGARC_PHYSICAL_ADDRESS((cyg_uint32)(rltk8139_info->tx_buffer
+  OUTL(CYGARC_PCI_DMA_ADDRESS((cyg_uint32)(rltk8139_info->tx_buffer
                                             + 0 * TX_BUF_SIZE)),
        rltk8139_info->base_address + TSAD0);
-  OUTL(CYGARC_PHYSICAL_ADDRESS((cyg_uint32)(rltk8139_info->tx_buffer
+  OUTL(CYGARC_PCI_DMA_ADDRESS((cyg_uint32)(rltk8139_info->tx_buffer
                                             + 1 * TX_BUF_SIZE)),
        rltk8139_info->base_address + TSAD1);
-  OUTL(CYGARC_PHYSICAL_ADDRESS((cyg_uint32)(rltk8139_info->tx_buffer
+  OUTL(CYGARC_PCI_DMA_ADDRESS((cyg_uint32)(rltk8139_info->tx_buffer
                                             + 2 * TX_BUF_SIZE)),
        rltk8139_info->base_address + TSAD2);
-  OUTL(CYGARC_PHYSICAL_ADDRESS((cyg_uint32)(rltk8139_info->tx_buffer
+  OUTL(CYGARC_PCI_DMA_ADDRESS((cyg_uint32)(rltk8139_info->tx_buffer
                                             + 3 * TX_BUF_SIZE)),
        rltk8139_info->base_address + TSAD3);
-  OUTL(CYGARC_PHYSICAL_ADDRESS((cyg_uint32)rltk8139_info->rx_ring),
+  OUTL(CYGARC_PCI_DMA_ADDRESS((cyg_uint32)rltk8139_info->rx_ring),
        rltk8139_info->base_address + RBSTART);
 
   /*
@@ -1072,7 +1072,7 @@
        * contains a 16 bit length and 16 bit status field, in little-endian
        * byte order.
        */
-      header = HAL_LE32TOC(*((cyg_uint32 *)&rltk8139_info->rx_ring[rx_pos]));
+      header = HAL_LE32TOC(*((cyg_uint32 *)CYGARC_UNCACHED_ADDRESS(&rltk8139_info->rx_ring[rx_pos])));
 
       /*
        * If the 8139 is still copying data for this packet into the
@@ -1102,7 +1102,7 @@
          * doesn't have to redetermine this information. Then, inform
          * the generic ethernet driver about the packet.
          */
-        rltk8139_info->rx_current = rltk8139_info->rx_ring + rx_pos + 4;
+        rltk8139_info->rx_current = CYGARC_UNCACHED_ADDRESS(rltk8139_info->rx_ring) + rx_pos + 4;
 
         /* Tell eCos about the packet */
         (sc->funs->eth_drv->recv)(sc, length);
@@ -1168,7 +1168,7 @@
 
 
 #ifdef DEBUG_RLTK8139_DRIVER
-  diag_printf("rltk8139_poll(%s)\n", sc->dev_name);
+//  diag_printf("rltk8139_poll(%s)\n", sc->dev_name);
 #endif
 
   rltk8139_info = (Rltk8139_t *)(sc->driver_private);
Only in devs/eth/rltk/8139/current/src: if_8139.c~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]