lkml.org 
[lkml]   [1999]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subjectne2k-pci.c fix for Big-Endian processors
Date
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2448.0">
<TITLE>ne2k-pci.c fix for Big-Endian processors</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2 FACE="Courier New">--- linux-2.2.9-i586/drivers/net/ne2k-pci.c&nbsp;&nbsp;&nbsp;&nbsp; Mon Jan 25 07:04:02 1999</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+++ linux-2.2.9-ppc/drivers/net/ne2k-pci.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Fri Jun 18 15:07:10 1999</FONT>
<BR><FONT SIZE=2 FACE="Courier New">@@ -21,6 +21,7 @@</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Issues remaining:</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; No full-duplex support.</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;*/</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+/* Big-Endian support added</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial"></FONT> <FONT SIZE=2 FACE="Arial">by</FONT> <FONT SIZE=2 FACE="Courier New">Patrick</FONT><FONT SIZE=2 FACE="Courier New"> LERDA lerda@microprocess.com */</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;/* Our copyright info must remain in the binary. */</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;static const char *version =</FONT>
<BR><FONT SIZE=2 FACE="Courier New">@@ -39,6 +40,7 @@</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;#include &lt;asm/system.h&gt;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;#include &lt;asm/io.h&gt;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;#include &lt;asm/irq.h&gt;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+#include &lt;asm/byteorder.h&gt;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;#include &lt;linux/netdevice.h&gt;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;#include &lt;linux/etherdevice.h&gt;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">@@ -462,9 +464,30 @@</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; outb(E8390_RREAD+E8390_START, nic_base + NE_CMD);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;#if defined(USE_LONGIO)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *(u32*)hdr = inl(NE_BASE + NE_DATAPORT);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned long u=inl(NE_BASE + NE_DATAPORT);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*PL*/ /*endian ok*/</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr-&gt;status = (u&gt;&gt; 0) &amp; 0xFF;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr-&gt;next&nbsp;&nbsp; = (u&gt;&gt; 8) &amp; 0xFF;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr-&gt;count&nbsp; = (u&gt;&gt;16) &amp; 0xFFFF;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+#ifdef DEBUG</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk(&quot;hdr: %02x %02x %04x\n&quot;,</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr-&gt;status,hdr-&gt;next,hdr-&gt;count);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+#endif</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;#else</FONT>
<BR><FONT SIZE=2 FACE="Courier New">-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; insw(NE_BASE + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr)&gt;&gt;1);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*PL*/ /*endian ok*/</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; u16 u;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //insw(NE_BASE + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr)&gt;&gt;1);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; u=inw(NE_BASE + NE_DATAPORT);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr-&gt;status = (u&gt;&gt; 0) &amp; 0xFF;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr-&gt;next&nbsp;&nbsp; = (u&gt;&gt; 8) &amp; 0xFF;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr-&gt;count&nbsp; = inw(NE_BASE + NE_DATAPORT);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;#endif</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; outb(ENISR_RDC, nic_base + EN0_ISR);&nbsp;&nbsp;&nbsp; /* Ack intr. */</FONT>
<BR><FONT SIZE=2 FACE="Courier New">@@ -500,10 +523,11 @@</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;#if defined(USE_LONGIO)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; insl(NE_BASE + NE_DATAPORT, buf, count&gt;&gt;2);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (count &amp; 3) {</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf += count &amp; ~3;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (count &amp; 2)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *((u16*)buf)++ = inw(NE_BASE + NE_DATAPORT);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *((u16*)buf)++ = le16_to_cpu(inw(NE_BASE + NE_DATAPORT));</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (count &amp; 1)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *buf = inb(NE_BASE + NE_DATAPORT);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=2 FACE="Courier New">@@ -563,10 +587,11 @@</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; outb(E8390_RWRITE+E8390_START, nic_base + NE_CMD);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;#if defined(USE_LONGIO)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; outsl(NE_BASE + NE_DATAPORT, buf, count&gt;&gt;2);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (count &amp; 3) {</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buf += count &amp; ~3;</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (count &amp; 2)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; outw(*((u16*)buf)++, NE_BASE + NE_DATAPORT);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; outw(cpu_to_le16(*((u16*)buf)++), NE_BASE + NE_DATAPORT);</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;#else</FONT>
<BR><FONT SIZE=2 FACE="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; outsw(NE_BASE + NE_DATAPORT, buf, count&gt;&gt;1);</FONT>
</P>
<BR>

</BODY>
</HTML>
\
 
 \ /
  Last update: 2005-03-22 13:53    [W:1.538 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site