Deleted Added
full compact
if_ed_3c503.c (154895) if_ed_3c503.c (154924)
1/*-
2 * Copyright (c) 2005, M. Warner Losh
3 * All rights reserved.
4 * Copyright (c) 1995, David Greenman
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2005, M. Warner Losh
3 * All rights reserved.
4 * Copyright (c) 1995, David Greenman
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/ed/if_ed_3c503.c 154895 2006-01-27 08:25:47Z imp $");
31__FBSDID("$FreeBSD: head/sys/dev/ed/if_ed_3c503.c 154924 2006-01-27 19:10:13Z imp $");
32
33#include "opt_ed.h"
34
35#ifdef ED_3C503
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/sockio.h>

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

320 return (ENXIO);
321 }
322
323 /*
324 * Initialize GA configuration register. Set bank and enable shared
325 * mem.
326 */
327 ed_asic_outb(sc, ED_3COM_GACFR, ED_3COM_GACFR_RSEL |
32
33#include "opt_ed.h"
34
35#ifdef ED_3C503
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/sockio.h>

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

320 return (ENXIO);
321 }
322
323 /*
324 * Initialize GA configuration register. Set bank and enable shared
325 * mem.
326 */
327 ed_asic_outb(sc, ED_3COM_GACFR, ED_3COM_GACFR_RSEL |
328 ED_3COM_GACFR_MBS0);
328 ED_3COM_GACFR_MBS0);
329
330 /*
331 * Initialize "Vector Pointer" registers. These gawd-awful things are
332 * compared to 20 bits of the address on ISA, and if they match, the
333 * shared memory is disabled. We set them to 0xffff0...allegedly the
334 * reset vector.
335 */
336 ed_asic_outb(sc, ED_3COM_VPTR2, 0xff);
337 ed_asic_outb(sc, ED_3COM_VPTR1, 0xff);
338 ed_asic_outb(sc, ED_3COM_VPTR0, 0x00);
339
340 error = ed_clear_memory(dev);
329
330 /*
331 * Initialize "Vector Pointer" registers. These gawd-awful things are
332 * compared to 20 bits of the address on ISA, and if they match, the
333 * shared memory is disabled. We set them to 0xffff0...allegedly the
334 * reset vector.
335 */
336 ed_asic_outb(sc, ED_3COM_VPTR2, 0xff);
337 ed_asic_outb(sc, ED_3COM_VPTR1, 0xff);
338 ed_asic_outb(sc, ED_3COM_VPTR0, 0x00);
339
340 error = ed_clear_memory(dev);
341 if (error == 0)
341 if (error == 0) {
342 sc->sc_mediachg = ed_3c503_mediachg;
342 sc->sc_mediachg = ed_3c503_mediachg;
343 sc->sc_write_mbufs = ed_shmem_write_mbufs;
344 }
343 return (error);
344}
345
346static void
347ed_3c503_mediachg(struct ed_softc *sc)
348{
349 struct ifnet *ifp = sc->ifp;
350
351 /*
352 * If this is a 3Com board, the tranceiver must be software enabled
353 * (there is no settable hardware default).
354 */
355 if (ifp->if_flags & IFF_LINK2)
356 ed_asic_outb(sc, ED_3COM_CR, 0);
357 else
358 ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_XSEL);
359}
360
361#endif /* ED_3C503 */
345 return (error);
346}
347
348static void
349ed_3c503_mediachg(struct ed_softc *sc)
350{
351 struct ifnet *ifp = sc->ifp;
352
353 /*
354 * If this is a 3Com board, the tranceiver must be software enabled
355 * (there is no settable hardware default).
356 */
357 if (ifp->if_flags & IFF_LINK2)
358 ed_asic_outb(sc, ED_3COM_CR, 0);
359 else
360 ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_XSEL);
361}
362
363#endif /* ED_3C503 */