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_hpp.c 154924 2006-01-27 19:10:13Z imp $"); |
32 33#include "opt_ed.h" 34 35#ifdef ED_HPP 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/sockio.h> --- 15 unchanged lines hidden (view full) --- 55#include <net/if_mib.h> 56#include <net/if_media.h> 57 58#include <net/bpf.h> 59 60#include <dev/ed/if_edreg.h> 61#include <dev/ed/if_edvar.h> 62 |
63static void ed_hpp_readmem(struct ed_softc *, bus_size_t, uint8_t *, 64 uint16_t); |
65static void ed_hpp_writemem(struct ed_softc *, uint8_t *, uint16_t, 66 uint16_t); 67static void ed_hpp_set_physical_link(struct ed_softc *sc); |
68static u_short ed_hpp_write_mbufs(struct ed_softc *, struct mbuf *, 69 bus_size_t); |
70 71/* 72 * Interrupt conversion table for the HP PC LAN+ 73 */ 74static uint16_t ed_hpp_intr_val[] = { 75 0, /* 0 */ 76 0, /* 1 */ 77 0, /* 2 */ --- 278 unchanged lines hidden (view full) --- 356 test_buffer, sizeof(test_pattern)); 357 358 if (bcmp(test_pattern, test_buffer, 359 sizeof(test_pattern))) 360 return (ENXIO); 361 } 362 363 sc->sc_mediachg = ed_hpp_set_physical_link; |
364 sc->sc_write_mbufs = ed_hpp_write_mbufs; 365 sc->readmem = ed_hpp_readmem; |
366 return (0); 367} 368 369/* 370 * HP PC Lan+ : Set the physical link to use AUI or TP/TL. 371 */ 372 373static void --- 38 unchanged lines hidden (view full) --- 412 * Support routines to handle the HP PC Lan+ card. 413 */ 414 415/* 416 * HP PC Lan+: Read from NIC memory, using either PIO or memory mapped 417 * IO. 418 */ 419 |
420static void |
421ed_hpp_readmem(struct ed_softc *sc, bus_size_t src, uint8_t *dst, 422 uint16_t amount) 423{ 424 int use_32bit_access = !(sc->hpp_id & ED_HPP_ID_16_BIT_ACCESS); 425 426 /* Program the source address in RAM */ 427 ed_asic_outw(sc, ED_HPP_PAGE_2, src); 428 --- 119 unchanged lines hidden (view full) --- 548/* 549 * Write to HP PC Lan+ NIC memory. Access to the NIC can be by using 550 * outsw() or via the memory mapped interface to the same register. 551 * Writes have to be in word units; byte accesses won't work and may cause 552 * the NIC to behave weirdly. Long word accesses are permitted if the ASIC 553 * allows it. 554 */ 555 |
556static u_short 557ed_hpp_write_mbufs(struct ed_softc *sc, struct mbuf *m, bus_size_t dst) |
558{ 559 int len, wantbyte; 560 unsigned short total_len; 561 unsigned char savebyte[2]; 562 volatile u_short * const d = 563 (volatile u_short *) sc->hpp_mem_start; 564 int use_32bit_accesses = !(sc->hpp_id & ED_HPP_ID_16_BIT_ACCESS); 565 --- 107 unchanged lines hidden --- |