Date: Tue, 15 Jun 1999 11:10:57 -0700 (PDT) From: "Jonathan M. Bresler" <jmb@hub.freebsd.org> To: hackers@FreeBSD.ORG Subject: PATCH for NE2000 driver--if_ed.c Message-ID: <19990615181057.1983915543@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
patch adds support for the Linksys 10/100 PCMCIA card
if you have a NE2000 type card which is supported by if_ed.c, please
apply this patch and provide feedback. it work wonderfully for me,
but i have only two cards that use this driver.....there are a wide
variety of cards that use the if_ed.c driver. i want to make sure of
the change before committing it.
*** /sys/i386/isa/if_ed.c.orig Tue Jan 2 05:33:53 1990
--- /sys/i386/isa/if_ed.c Sun Jun 6 06:59:40 1999
***************
*** 193,198 ****
--- 193,200 ----
static u_long ds_crc __P((u_char *ep));
+ static int ed_get_Linksys __P((struct ed_softc *));
+
#if (NCARD > 0) || (NPNP > 0)
#include <sys/kernel.h>
#endif
***************
*** 410,415 ****
--- 412,435 ----
return (1);
}
+ static int
+ ed_get_Linksys(sc)
+ struct ed_softc *sc;
+ {
+ u_char sum;
+ int i;
+
+ for (sum = 0, i = 0x14; i < 0x1c; i++)
+ sum += inb(sc->nic_addr +i);
+ if (sum != 0xff)
+ return (0);
+ for (i = 0; i < ETHER_ADDR_LEN; i++) {
+ sc->arpcom.ac_enaddr[i] = inb(sc->nic_addr + 0x14 + i);
+ printf("%02x.", sc->arpcom.ac_enaddr[i]);
+ }
+ return (1);
+ }
+
/*
* Probe and vendor-specific initialization routine for SMC/WD80x3 boards
*/
***************
*** 1072,1077 ****
--- 1092,1098 ----
u_char romdata[16], tmp;
static char test_pattern[32] = "THIS is A memory TEST pattern";
char test_buffer[32];
+ int linksys = 0;
sc->asic_addr = port + ED_NOVELL_ASIC_OFFSET;
sc->nic_addr = port + ED_NOVELL_NIC_OFFSET;
***************
*** 1141,1147 ****
ed_pio_writemem(sc, test_pattern, 8192, sizeof(test_pattern));
ed_pio_readmem(sc, 8192, test_buffer, sizeof(test_pattern));
! if (bcmp(test_pattern, test_buffer, sizeof(test_pattern))) {
/* not an NE1000 - try NE2000 */
outb(sc->nic_addr + ED_P0_DCR, ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS);
--- 1162,1174 ----
ed_pio_writemem(sc, test_pattern, 8192, sizeof(test_pattern));
ed_pio_readmem(sc, 8192, test_buffer, sizeof(test_pattern));
! linksys = ed_get_Linksys(sc);
! if (linksys) {
! outb(sc->nic_addr + ED_P0_DCR, ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS);
! sc->isa16bit = 1;
! sc->type = ED_TYPE_NE2000;
! sc->type_str = "Linksys";
! } else if (bcmp(test_pattern, test_buffer, sizeof(test_pattern))) {
/* not an NE1000 - try NE2000 */
outb(sc->nic_addr + ED_P0_DCR, ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS);
***************
*** 1251,1269 ****
* Use one xmit buffer if < 16k, two buffers otherwise (if not told
* otherwise).
*/
! if ((memsize < 16384) || (flags & ED_FLAGS_NO_MULTI_BUFFERING))
sc->txb_cnt = 1;
else
sc->txb_cnt = 2;
sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE;
! sc->rec_page_stop = sc->tx_page_start + memsize / ED_PAGE_SIZE;
sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE;
!
! ed_pio_readmem(sc, 0, romdata, 16);
! for (n = 0; n < ETHER_ADDR_LEN; n++)
! sc->arpcom.ac_enaddr[n] = romdata[n * (sc->isa16bit + 1)];
#ifdef GWETHER
if (sc->arpcom.ac_enaddr[2] == 0x86) {
--- 1278,1298 ----
* Use one xmit buffer if < 16k, two buffers otherwise (if not told
* otherwise).
*/
! if ((sc->mem_size < 16384) || (flags & ED_FLAGS_NO_MULTI_BUFFERING))
sc->txb_cnt = 1;
else
sc->txb_cnt = 2;
sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE;
! n = sc->tx_page_start + sc->mem_size / ED_PAGE_SIZE;
! sc->rec_page_stop = (n > 0xff) ? 0xff : n;
sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE;
! if (!linksys) {
! ed_pio_readmem(sc, 0, romdata, 16);
! for (n = 0; n < ETHER_ADDR_LEN; n++)
! sc->arpcom.ac_enaddr[n] = romdata[n * (sc->isa16bit + 1)];
! }
#ifdef GWETHER
if (sc->arpcom.ac_enaddr[2] == 0x86) {
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990615181057.1983915543>
