Date: Sun, 03 Aug 1997 16:33:36 -0700 From: Ted Faber <faber@ISI.EDU> To: freebsd-hackers@freebsd.org Cc: faber@ISI.EDU, faber@lunabase.org Subject: patch to lnc driver for Hitachi Mx laptop Message-ID: <199708032333.QAA00649@vermouth.isi.edu>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708032333.QAA00649>