From cbb89e6622e0ffb1f12db84154a70f072e904c98 Mon Sep 17 00:00:00 2001 From: "Jonathan M. Bresler" Date: Mon, 1 Nov 1999 00:53:12 +0000 Subject: [PATCH] rearrange order of tests for NE1000, NE2000, and Linksys cards. previous order caused computers with NE2000 cards to hang during boot. --- sys/i386/isa/if_ed.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/sys/i386/isa/if_ed.c b/sys/i386/isa/if_ed.c index df3a7395c09b..017444da1441 100644 --- a/sys/i386/isa/if_ed.c +++ b/sys/i386/isa/if_ed.c @@ -1011,6 +1011,7 @@ ed_probe_3Com(isa_dev) sc->isa16bit = isa16bit; /* + if (bcmp(test_pattern, test_buffer, sizeof(test_pattern)) == 0) { * Initialize GA page start/stop registers. Probably only needed if * doing DMA, but what the hell. */ @@ -1155,15 +1156,21 @@ ed_probe_Novell_generic(sc, port, unit, flags) 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 */ + if (bcmp(test_pattern, test_buffer, sizeof(test_pattern)) == 0) { + /* could be either an NE1000 or a Linksys ethernet controller */ + 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 { + sc->type = ED_TYPE_NE1000; + sc->type_str = "NE1000"; + } + } else { + /* neither an NE1000 nor a Linksys - try NE2000 */ outb(sc->nic_addr + ED_P0_DCR, ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS); outb(sc->nic_addr + ED_P0_PSTART, 16384 / ED_PAGE_SIZE); outb(sc->nic_addr + ED_P0_PSTOP, 32768 / ED_PAGE_SIZE); @@ -1177,16 +1184,15 @@ ed_probe_Novell_generic(sc, port, unit, flags) ed_pio_writemem(sc, test_pattern, 16384, sizeof(test_pattern)); ed_pio_readmem(sc, 16384, test_buffer, sizeof(test_pattern)); - if (bcmp(test_pattern, test_buffer, sizeof(test_pattern))) - return (0); /* not an NE2000 either */ - - sc->type = ED_TYPE_NE2000; - sc->type_str = "NE2000"; - } else { - sc->type = ED_TYPE_NE1000; - sc->type_str = "NE1000"; + if (bcmp(test_pattern, test_buffer, sizeof(test_pattern)) == 0) { + sc->type = ED_TYPE_NE2000; + sc->type_str = "NE2000"; + } else { + return (ENXIO); + } } + /* 8k of memory plus an additional 8k if 16bit */ memsize = 8192 + sc->isa16bit * 8192;