summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>1998-04-14 13:51:19 +0000
committerkato <kato@FreeBSD.org>1998-04-14 13:51:19 +0000
commit630b424dc028c078fe4fc9cfd7014bc47f02ae47 (patch)
tree35d7f2f29f810b3b680203d89ad640c006eec473 /sys
parent88d08c78f759300f072a29b518e96ecfba302fd7 (diff)
downloadFreeBSD-src-630b424dc028c078fe4fc9cfd7014bc47f02ae47.zip
FreeBSD-src-630b424dc028c078fe4fc9cfd7014bc47f02ae47.tar.gz
Fix page fault panic by probing NE200 compatible PCI card.
Submitted by: chi@bd.mbn.or.jp (Chiharu Shibata)
Diffstat (limited to 'sys')
-rw-r--r--sys/pc98/pc98/if_ed.c19
-rw-r--r--sys/pc98/pc98/if_ed98.h13
2 files changed, 17 insertions, 15 deletions
diff --git a/sys/pc98/pc98/if_ed.c b/sys/pc98/pc98/if_ed.c
index 14e4001..8dc6eae 100644
--- a/sys/pc98/pc98/if_ed.c
+++ b/sys/pc98/pc98/if_ed.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_ed.c,v 1.43 1998/03/29 12:48:46 kato Exp $
+ * $Id: if_ed.c,v 1.44 1998/03/30 12:10:02 kato Exp $
*/
/*
@@ -419,7 +419,6 @@ ed_probe(isa_dev)
* IO-DATA PCLA/T
*/
if (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_LPC) {
- ed_softc[isa_dev->id_unit].type = ED_TYPE98_LPC;
nports98 = pc98_set_register(isa_dev, ED_TYPE98_LPC);
nports = ed_probe_Novell(isa_dev);
if (nports)
@@ -430,7 +429,6 @@ ed_probe(isa_dev)
* Generic probe routine
* Allied Telesis CenterCom LA-98-T
*/
- ed_softc[isa_dev->id_unit].type = ED_TYPE98_GENERIC;
nports98 = pc98_set_register(isa_dev, ED_TYPE98_GENERIC);
if (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_GENERIC) {
@@ -453,7 +451,6 @@ ed_probe(isa_dev)
* Allied Telesis SIC-98
*/
if (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_SIC) {
- ed_softc[isa_dev->id_unit].type = ED_TYPE98_SIC;
nports98 = pc98_set_register(isa_dev, ED_TYPE98_SIC);
nports = ed_probe_SIC98(isa_dev);
if (nports)
@@ -466,7 +463,6 @@ ed_probe(isa_dev)
*/
if (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_BDN) {
/* LD-BDN */
- ed_softc[isa_dev->id_unit].type = ED_TYPE98_BDN;
nports98 = pc98_set_register(isa_dev, ED_TYPE98_BDN);
nports = ed_probe_Novell(isa_dev);
if (nports)
@@ -479,7 +475,6 @@ ed_probe(isa_dev)
*/
if (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_LGY) {
/* LGY-98 */
- ed_softc[isa_dev->id_unit].type = ED_TYPE98_LGY;
nports98 = pc98_set_register(isa_dev, ED_TYPE98_LGY);
nports = ed_probe_Novell(isa_dev);
if (nports)
@@ -492,7 +487,6 @@ ed_probe(isa_dev)
*/
if (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_ICM) {
/* ICM */
- ed_softc[isa_dev->id_unit].type = ED_TYPE98_ICM;
nports98 = pc98_set_register(isa_dev, ED_TYPE98_ICM);
nports = ed_probe_Novell(isa_dev);
if (nports)
@@ -505,7 +499,6 @@ ed_probe(isa_dev)
*/
if (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_EGY) {
/* EGY-98 */
- ed_softc[isa_dev->id_unit].type = ED_TYPE98_EGY;
nports98 = pc98_set_register(isa_dev, ED_TYPE98_EGY);
nports = ed_probe_Novell(isa_dev);
if (nports)
@@ -517,7 +510,6 @@ ed_probe(isa_dev)
*/
if (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_LA98) {
/* LA-98 */
- ed_softc[isa_dev->id_unit].type = ED_TYPE98_LA98;
nports98 = pc98_set_register(isa_dev, ED_TYPE98_LA98);
nports = ed_probe_Novell(isa_dev);
if (nports)
@@ -529,7 +521,6 @@ ed_probe(isa_dev)
*/
if (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_108) {
/* PC-9801-108 */
- ed_softc[isa_dev->id_unit].type = ED_TYPE98_108;
nports98 = pc98_set_register(isa_dev, ED_TYPE98_108);
nports = ed_probe_Novell(isa_dev);
if (nports)
@@ -541,7 +532,6 @@ ed_probe(isa_dev)
*/
if (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_CNET98EL) {
/* C-NET(98)E/L */
- ed_softc[isa_dev->id_unit].type = ED_TYPE98_CNET98EL;
nports98 = pc98_set_register(isa_dev, ED_TYPE98_CNET98EL);
nports = ed_probe_CNET98EL(isa_dev);
if (nports)
@@ -553,7 +543,6 @@ ed_probe(isa_dev)
*/
if (ED_TYPE98(isa_dev->id_flags) == ED_TYPE98_CNET98) {
/* C-NET(98) */
- ed_softc[isa_dev->id_unit].type = ED_TYPE98_CNET98;
nports98 = pc98_set_register(isa_dev, ED_TYPE98_CNET98);
nports = ed_probe_CNET98(isa_dev);
if (nports)
@@ -1575,6 +1564,9 @@ ed_probe_pccard(isa_dev, ether)
{
int nports;
+#ifdef PC98
+ (void)pc98_set_register(isa_dev, ED_TYPE98_GENERIC);
+#endif
nports = ed_probe_WD80x3(isa_dev);
if (nports)
return (nports);
@@ -2506,6 +2498,9 @@ ed_attach_NE2000_pci(unit, port)
return sc;
bzero(sc, sizeof *sc);
+#ifdef PC98
+ (void)pc98_set_register_unit(sc, ED_TYPE98_GENERIC, 0);
+#endif
if (ed_probe_Novell_generic(sc, port, unit, isa_flags) == 0
|| ed_attach(sc, unit, isa_flags) == 0) {
free(sc, M_DEVBUF);
diff --git a/sys/pc98/pc98/if_ed98.h b/sys/pc98/pc98/if_ed98.h
index 7f95f0a..6320064 100644
--- a/sys/pc98/pc98/if_ed98.h
+++ b/sys/pc98/pc98/if_ed98.h
@@ -37,6 +37,7 @@
#endif
static int pc98_set_register __P((struct isa_device *dev, int type));
+static int pc98_set_register_unit __P((struct ed_softc *sc, int type, int iobase));
/*
* Vendor types
@@ -386,10 +387,16 @@ static unsigned int edp_cnet98[16] = {
static int
pc98_set_register(struct isa_device *dev, int type)
{
- struct ed_softc *sc = &ed_softc[dev->id_unit];
+ return pc98_set_register_unit(&ed_softc[dev->id_unit], type, dev->id_iobase);
+}
+
+static int
+pc98_set_register_unit(struct ed_softc *sc, int type, int iobase)
+{
int adj;
int nports;
+ sc->type = type;
switch (type) {
case ED_TYPE98_GENERIC:
sc->edreg.port = edp_generic;
@@ -470,9 +477,9 @@ pc98_set_register(struct isa_device *dev, int type)
case ED_TYPE98_108:
sc->edreg.port = edp_nec108;
- adj = (dev->id_iobase & 0xf000) / 2;
+ adj = (iobase & 0xf000) / 2;
ED_NOVELL_NIC_OFFSET = 0;
- ED_NOVELL_ASIC_OFFSET = (0x888 | adj) - dev->id_iobase;
+ ED_NOVELL_ASIC_OFFSET = (0x888 | adj) - iobase;
ED_NOVELL_DATA = 0;
ED_NOVELL_RESET = 2;
ED_PC_MISC = 0x18;
OpenPOWER on IntegriCloud