From owner-freebsd-hackers Sun Aug 3 16:31:02 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id QAA25896 for hackers-outgoing; Sun, 3 Aug 1997 16:31:02 -0700 (PDT) Received: from zephyr.isi.edu (zephyr.isi.edu [128.9.160.160]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id QAA25891 for ; Sun, 3 Aug 1997 16:30:59 -0700 (PDT) Received: from vermouth.isi.edu by zephyr.isi.edu (5.65c/5.61+local-26) id ; Sun, 3 Aug 1997 16:30:55 -0700 Received: from marlis.lunabase.org (localhost [127.0.0.1]) by vermouth.isi.edu (8.8.5/8.8.5) with ESMTP id QAA00649; Sun, 3 Aug 1997 16:33:37 -0700 (PDT) Message-Id: <199708032333.QAA00649@vermouth.isi.edu> X-Mailer: exmh version 2.0gamma 1/27/96 To: freebsd-hackers@freebsd.org Subject: patch to lnc driver for Hitachi Mx laptop X-Url: http://www.isi.edu/~faber Cc: faber@ISI.EDU, faber@lunabase.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 03 Aug 1997 16:33:36 -0700 From: Ted Faber Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk In the course of getting FreeBSD 2.2.2-RELEASE up on my Hitachi Mx133 laptop, I had to modify the PCI driver code for the lnc driver in order to use the builtin ethernet port. The changes are adding a new constant and case branch for the chip ID of the lance chip they use (I don't know the part number, but it behaves like an Am79C970 except for the ID) in i386/isa/if_lnc.[ch], changing the pci_conf_read call to a pci_map_port call in pci/if_lnc_p.c (which seems to properly initialize multiple bridge chips where pci_map_conf doesn't) and checking for a different result code from ne2100_probe in the pci attach routine in i386/isa/if_lnc.c to avoid deallocating the controller block. The last is protected by an ifdef using the option HITACHI_MX. The others should have no change on existing code, so I left them unprotected. The patch is included. Let me know what you think. *** pci/if_lnc_p.c.orig Fri Apr 4 08:48:12 1997 --- pci/if_lnc_p.c Sun Aug 3 00:10:24 1997 *************** *** 75,81 **** unsigned iobase; void *lnc; /* device specific data for interrupt handler ... */ ! iobase = pci_conf_read(config_id, PCI_MAP_REG_START) & ~PCI_MAP_IO; lnc = lnc_attach_ne2100_pci(unit, iobase); if (!lnc) --- 75,86 ---- unsigned iobase; void *lnc; /* device specific data for interrupt handler ... */ ! /* pci_map_port correctly initializes bridge chips -- tvf */ ! ! if ( !pci_map_port(config_id,PCI_MAP_REG_START,(u_short *)&iobase) ) ! printf("lnc%d: pci_port_map_attach failed?!\n",unit); ! else ! printf("lnc%d: pci port mapped to %x\n",unit,iobase); lnc = lnc_attach_ne2100_pci(unit, iobase); if (!lnc) *** i386/isa/if_lnc.h.orig Tue Sep 10 01:21:57 1996 --- i386/isa/if_lnc.h Sat Aug 2 23:45:02 1997 *************** *** 69,74 **** --- 69,75 ---- #define Am79C961 0x2260 #define Am79C965 0x2430 #define Am79C970 0x0242 + #define HITACHI_Am79C970 0x2621 /* Board types */ #define UNKNOWN 0 *** i386/isa/if_lnc.c.orig Tue Apr 8 03:59:30 1997 --- i386/isa/if_lnc.c Sun Aug 3 14:59:06 1997 *************** *** 1068,1073 **** --- 1068,1075 ---- * do NOT try to ISA attach the PCI version */ return (0); + case HITACHI_Am79C970: + return (PCnet_PCI); default: break; } *************** *** 1197,1203 **** if (sc) { bzero (sc, sizeof *sc); ! if ((ne2100_probe(sc, iobase) == 0) || (lnc_attach_sc(sc, unit) == 0)) { free(sc, M_DEVBUF); sc = NULL; --- 1199,1209 ---- if (sc) { bzero (sc, sizeof *sc); ! #ifdef HITACHI_MX ! if ((ne2100_probe(sc, iobase) == NE2100_IOSIZE) ! #else ! if ((ne2100_probe(sc, iobase) == 0) ! #endif || (lnc_attach_sc(sc, unit) == 0)) { free(sc, M_DEVBUF); sc = NULL;