From 2512c3e67bd161b427497f283d507b74cf86b538 Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Mon, 20 Jul 1998 17:33:01 +0000 Subject: [PATCH] Add support for PCNet PCI chips that only work when we talk to them as ISA devices. Specifically fix the case for the Hitachi version as used in their VisionBook models. Submitted by: Ted Faber --- sys/dev/lnc/if_lnc.c | 21 +++++++++++++++++++-- sys/dev/lnc/if_lnc_pci.c | 7 +++++-- sys/dev/lnc/if_lncvar.h | 1 + sys/i386/isa/if_lnc.c | 21 +++++++++++++++++++-- sys/i386/isa/if_lnc.h | 1 + sys/pci/if_lnc_p.c | 7 +++++-- 6 files changed, 50 insertions(+), 8 deletions(-) diff --git a/sys/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c index bff5d17b59ad..dd201a3805ed 100644 --- a/sys/dev/lnc/if_lnc.c +++ b/sys/dev/lnc/if_lnc.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_lnc.c,v 1.42 1998/05/27 11:05:17 paul Exp $ + * $Id: if_lnc.c,v 1.43 1998/06/07 17:10:36 dfr Exp $ */ /* @@ -1145,6 +1145,14 @@ pcnet_probe(struct lnc_softc *sc) * do NOT try to ISA attach the PCI version */ return (0); + case HITACHI_Am79C970: + + /* + * PCI cards that should be attached in + * ISA mode should return this value. -- tvf + */ + + return (PCnet_PCI); default: break; } @@ -1274,7 +1282,16 @@ lnc_attach_ne2100_pci(int unit, unsigned iobase) if (sc) { bzero (sc, sizeof *sc); - if ((ne2100_probe(sc, iobase) == 0) + /* + * ne2100_probe sets sc->nic.ic to PCnet_PCI for PCI + * cards that work in ISA emulation mode. The first + * clause this code avoids attaching such a card at + * this time to allow it to be picked up as an ISA + * card later. -- tvf + */ + + if (((ne2100_probe(sc, iobase) == 0) || + sc->nic.ic == PCnet_PCI) || (lnc_attach_sc(sc, unit) == 0)) { free(sc, M_DEVBUF); sc = NULL; diff --git a/sys/dev/lnc/if_lnc_pci.c b/sys/dev/lnc/if_lnc_pci.c index f1ec93919f9e..3cffcab8030a 100644 --- a/sys/dev/lnc/if_lnc_pci.c +++ b/sys/dev/lnc/if_lnc_pci.c @@ -17,7 +17,7 @@ * 4. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: if_lnc_p.c,v 1.4 1997/04/04 16:44:52 kato Exp $ + * $Id: if_lnc_p.c,v 1.5 1997/08/02 14:33:11 bde Exp $ */ #include "pci.h" @@ -74,7 +74,10 @@ lnc_pci_attach(config_id, unit) unsigned iobase; void *lnc; /* device specific data for interrupt handler ... */ - iobase = pci_conf_read(config_id, PCI_MAP_REG_START) & ~PCI_MAP_IO; + /* 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); lnc = lnc_attach_ne2100_pci(unit, iobase); if (!lnc) diff --git a/sys/dev/lnc/if_lncvar.h b/sys/dev/lnc/if_lncvar.h index 001ea687019d..8d628c7ceecb 100644 --- a/sys/dev/lnc/if_lncvar.h +++ b/sys/dev/lnc/if_lncvar.h @@ -83,6 +83,7 @@ #define Am79C961 0x2260 #define Am79C965 0x2430 #define Am79C970 0x0242 +#define HITACHI_Am79C970 0x2621 /* Board types */ #define UNKNOWN 0 diff --git a/sys/i386/isa/if_lnc.c b/sys/i386/isa/if_lnc.c index bff5d17b59ad..dd201a3805ed 100644 --- a/sys/i386/isa/if_lnc.c +++ b/sys/i386/isa/if_lnc.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_lnc.c,v 1.42 1998/05/27 11:05:17 paul Exp $ + * $Id: if_lnc.c,v 1.43 1998/06/07 17:10:36 dfr Exp $ */ /* @@ -1145,6 +1145,14 @@ pcnet_probe(struct lnc_softc *sc) * do NOT try to ISA attach the PCI version */ return (0); + case HITACHI_Am79C970: + + /* + * PCI cards that should be attached in + * ISA mode should return this value. -- tvf + */ + + return (PCnet_PCI); default: break; } @@ -1274,7 +1282,16 @@ lnc_attach_ne2100_pci(int unit, unsigned iobase) if (sc) { bzero (sc, sizeof *sc); - if ((ne2100_probe(sc, iobase) == 0) + /* + * ne2100_probe sets sc->nic.ic to PCnet_PCI for PCI + * cards that work in ISA emulation mode. The first + * clause this code avoids attaching such a card at + * this time to allow it to be picked up as an ISA + * card later. -- tvf + */ + + if (((ne2100_probe(sc, iobase) == 0) || + sc->nic.ic == PCnet_PCI) || (lnc_attach_sc(sc, unit) == 0)) { free(sc, M_DEVBUF); sc = NULL; diff --git a/sys/i386/isa/if_lnc.h b/sys/i386/isa/if_lnc.h index 001ea687019d..8d628c7ceecb 100644 --- a/sys/i386/isa/if_lnc.h +++ b/sys/i386/isa/if_lnc.h @@ -83,6 +83,7 @@ #define Am79C961 0x2260 #define Am79C965 0x2430 #define Am79C970 0x0242 +#define HITACHI_Am79C970 0x2621 /* Board types */ #define UNKNOWN 0 diff --git a/sys/pci/if_lnc_p.c b/sys/pci/if_lnc_p.c index f1ec93919f9e..3cffcab8030a 100644 --- a/sys/pci/if_lnc_p.c +++ b/sys/pci/if_lnc_p.c @@ -17,7 +17,7 @@ * 4. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: if_lnc_p.c,v 1.4 1997/04/04 16:44:52 kato Exp $ + * $Id: if_lnc_p.c,v 1.5 1997/08/02 14:33:11 bde Exp $ */ #include "pci.h" @@ -74,7 +74,10 @@ lnc_pci_attach(config_id, unit) unsigned iobase; void *lnc; /* device specific data for interrupt handler ... */ - iobase = pci_conf_read(config_id, PCI_MAP_REG_START) & ~PCI_MAP_IO; + /* 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); lnc = lnc_attach_ne2100_pci(unit, iobase); if (!lnc)