Deleted Added
full compact
if_ed_cbus.c (150136) if_ed_cbus.c (154924)
1/*-
2 * Copyright (c) 1995, David Greenman
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright (c) 1995, David Greenman
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/sys/dev/ed/if_ed_cbus.c 150136 2005-09-14 19:03:14Z ru $
27 * $FreeBSD: head/sys/dev/ed/if_ed_cbus.c 154924 2006-01-27 19:10:13Z imp $
28 */
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/socket.h>
33#include <sys/kernel.h>
34
35#include <sys/module.h>

--- 13 unchanged lines hidden (view full) ---

49
50#include <dev/ed/if_edvar.h>
51#include <dev/ed/if_edreg.h>
52#include <dev/ed/if_ed98.h>
53
54static int ed98_alloc_port(device_t, int);
55static int ed98_alloc_memory(device_t, int);
56static int ed_pio_testmem(struct ed_softc *, int, int, int);
28 */
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/socket.h>
33#include <sys/kernel.h>
34
35#include <sys/module.h>

--- 13 unchanged lines hidden (view full) ---

49
50#include <dev/ed/if_edvar.h>
51#include <dev/ed/if_edreg.h>
52#include <dev/ed/if_ed98.h>
53
54static int ed98_alloc_port(device_t, int);
55static int ed98_alloc_memory(device_t, int);
56static int ed_pio_testmem(struct ed_softc *, int, int, int);
57static int ed_probe_SIC98(device_t, int, int);
58static int ed_probe_CNET98(device_t, int, int);
59static int ed_probe_CNET98EL(device_t, int, int);
57static int ed_probe_CNET98(device_t, int, int);
58static int ed_probe_CNET98EL(device_t, int, int);
59static int ed_probe_EZ98(device_t, int, int);
60static int ed_probe_NEC77(device_t, int, int);
61static int ed_probe_NW98X(device_t, int, int);
62static int ed_probe_SB98(device_t, int, int);
60static int ed_probe_NEC77(device_t, int, int);
61static int ed_probe_NW98X(device_t, int, int);
62static int ed_probe_SB98(device_t, int, int);
63static int ed_probe_EZ98(device_t, int, int);
63static int ed_probe_SIC98(device_t, int, int);
64static int ed98_probe_Novell(device_t, int, int);
65static int ed98_probe_generic8390(struct ed_softc *);
66static void ed_reset_CNET98(struct ed_softc *, int);
67static void ed_winsel_CNET98(struct ed_softc *, u_short);
68static void ed_get_SB98(struct ed_softc *);
69
70static int ed_cbus_probe(device_t);
71static int ed_cbus_attach(device_t);

--- 711 unchanged lines hidden (view full) ---

783 for (n = 0; n < ETHER_ADDR_LEN; n++)
784 sc->enaddr[n] = romdata[n * (sc->isa16bit + 1)];
785 break;
786 }
787
788 /* clear any pending interrupts that might have occurred above */
789 ed_nic_outb(sc, ED_P0_ISR, 0xff);
790
64static int ed98_probe_Novell(device_t, int, int);
65static int ed98_probe_generic8390(struct ed_softc *);
66static void ed_reset_CNET98(struct ed_softc *, int);
67static void ed_winsel_CNET98(struct ed_softc *, u_short);
68static void ed_get_SB98(struct ed_softc *);
69
70static int ed_cbus_probe(device_t);
71static int ed_cbus_attach(device_t);

--- 711 unchanged lines hidden (view full) ---

783 for (n = 0; n < ETHER_ADDR_LEN; n++)
784 sc->enaddr[n] = romdata[n * (sc->isa16bit + 1)];
785 break;
786 }
787
788 /* clear any pending interrupts that might have occurred above */
789 ed_nic_outb(sc, ED_P0_ISR, 0xff);
790
791 sc->sc_write_mbufs = ed_pio_write_mbufs;
791 return (0);
792}
793
794/*
795 * Probe and vendor-specific initialization routine for SIC-98 boards
796 */
797static int
798ed_probe_SIC98(device_t dev, int port_rid, int flags)

--- 84 unchanged lines hidden (view full) ---

883 sc->txb_cnt = 2;
884 sc->tx_page_start = 0;
885
886 sc->rec_page_start = sc->tx_page_start + ED_TXBUF_SIZE * sc->txb_cnt;
887 sc->rec_page_stop = sc->tx_page_start + sc->mem_size / ED_PAGE_SIZE;
888
889 sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE;
890
792 return (0);
793}
794
795/*
796 * Probe and vendor-specific initialization routine for SIC-98 boards
797 */
798static int
799ed_probe_SIC98(device_t dev, int port_rid, int flags)

--- 84 unchanged lines hidden (view full) ---

884 sc->txb_cnt = 2;
885 sc->tx_page_start = 0;
886
887 sc->rec_page_start = sc->tx_page_start + ED_TXBUF_SIZE * sc->txb_cnt;
888 sc->rec_page_stop = sc->tx_page_start + sc->mem_size / ED_PAGE_SIZE;
889
890 sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE;
891
892 sc->sc_write_mbufs = ed_shmem_write_mbufs;
891 return (0);
892}
893
894/*
895 * Contec C-NET(98) series support routines
896 */
897static void
898ed_reset_CNET98(struct ed_softc *sc, int flags)

--- 233 unchanged lines hidden (view full) ---

1132 * Set interrupt mask.
1133 * bit7:1 all interrupt mask
1134 * bit1:1 timer interrupt mask
1135 * bit0:0 NS controler interrupt enable
1136 */
1137 ed_asic_outb(sc, ED_CNET98_INT_MASK, 0x7e);
1138 DELAY(1000);
1139
893 return (0);
894}
895
896/*
897 * Contec C-NET(98) series support routines
898 */
899static void
900ed_reset_CNET98(struct ed_softc *sc, int flags)

--- 233 unchanged lines hidden (view full) ---

1134 * Set interrupt mask.
1135 * bit7:1 all interrupt mask
1136 * bit1:1 timer interrupt mask
1137 * bit0:0 NS controler interrupt enable
1138 */
1139 ed_asic_outb(sc, ED_CNET98_INT_MASK, 0x7e);
1140 DELAY(1000);
1141
1142 sc->sc_write_mbufs = ed_shmem_write_mbufs;
1140 return (0);
1141}
1142
1143/*
1144 * Probe and vendor-specific initialization routine for C-NET(98)E/L boards
1145 */
1146static int
1147ed_probe_CNET98EL(device_t dev, int port_rid, int flags)

--- 78 unchanged lines hidden (view full) ---

1226 /* Get station address from on-board ROM */
1227 ed_pio_readmem(sc, 16384, romdata, sizeof(romdata));
1228 for (i = 0; i < ETHER_ADDR_LEN; i++)
1229 sc->enaddr[i] = romdata[i * 2];
1230
1231 /* clear any pending interrupts that might have occurred above */
1232 ed_nic_outb(sc, ED_P0_ISR, 0xff);
1233
1143 return (0);
1144}
1145
1146/*
1147 * Probe and vendor-specific initialization routine for C-NET(98)E/L boards
1148 */
1149static int
1150ed_probe_CNET98EL(device_t dev, int port_rid, int flags)

--- 78 unchanged lines hidden (view full) ---

1229 /* Get station address from on-board ROM */
1230 ed_pio_readmem(sc, 16384, romdata, sizeof(romdata));
1231 for (i = 0; i < ETHER_ADDR_LEN; i++)
1232 sc->enaddr[i] = romdata[i * 2];
1233
1234 /* clear any pending interrupts that might have occurred above */
1235 ed_nic_outb(sc, ED_P0_ISR, 0xff);
1236
1237 sc->sc_write_mbufs = ed_pio_write_mbufs;
1234 return (0);
1235}
1236
1237/*
1238 * Probe and vendor-specific initialization routine for PC-9801-77 boards
1239 */
1240static int
1241ed_probe_NEC77(device_t dev, int port_rid, int flags)

--- 251 unchanged lines hidden (view full) ---

1493 DELAY(5000);
1494
1495 /* Make sure that we really have an 8390 based board */
1496 if (!ed98_probe_generic8390(sc))
1497 return (ENXIO);
1498
1499 /* Test memory via PIO */
1500 sc->cr_proto = ED_CR_RD2;
1238 return (0);
1239}
1240
1241/*
1242 * Probe and vendor-specific initialization routine for PC-9801-77 boards
1243 */
1244static int
1245ed_probe_NEC77(device_t dev, int port_rid, int flags)

--- 251 unchanged lines hidden (view full) ---

1497 DELAY(5000);
1498
1499 /* Make sure that we really have an 8390 based board */
1500 if (!ed98_probe_generic8390(sc))
1501 return (ENXIO);
1502
1503 /* Test memory via PIO */
1504 sc->cr_proto = ED_CR_RD2;
1501 if (!ed_pio_testmem(sc, 16384, 1, flags)) {
1505 if (!ed_pio_testmem(sc, 16384, 1, flags))
1502 return (ENXIO);
1506 return (ENXIO);
1503 }
1504
1505 /* This looks like an SB9801 board. */
1506 sc->type_str = "SB9801";
1507
1508 /* Get station address */
1509 ed_get_SB98(sc);
1510
1511 /* clear any pending interrupts that might have occurred above */
1512 ed_nic_outb(sc, ED_P0_ISR, 0xff);
1513
1507
1508 /* This looks like an SB9801 board. */
1509 sc->type_str = "SB9801";
1510
1511 /* Get station address */
1512 ed_get_SB98(sc);
1513
1514 /* clear any pending interrupts that might have occurred above */
1515 ed_nic_outb(sc, ED_P0_ISR, 0xff);
1516
1517 sc->sc_write_mbufs = ed_pio_write_mbufs;
1514 return (0);
1515}
1516
1517/*
1518 * Test the ability to read and write to the NIC memory.
1519 */
1520static int
1521ed_pio_testmem(struct ed_softc *sc, int page_offset, int isa16bit, int flags)

--- 100 unchanged lines hidden ---
1518 return (0);
1519}
1520
1521/*
1522 * Test the ability to read and write to the NIC memory.
1523 */
1524static int
1525ed_pio_testmem(struct ed_softc *sc, int page_offset, int isa16bit, int flags)

--- 100 unchanged lines hidden ---