1/* 2 * Copyright (c) 1995, David Greenman 3 * All rights reserved. 4 * 5 * Modifications to support NetBSD: 6 * Copyright (c) 1997 Jason R. Thorpe. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice unmodified, this list of conditions, and the following 13 * disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 *
| 1/* 2 * Copyright (c) 1995, David Greenman 3 * All rights reserved. 4 * 5 * Modifications to support NetBSD: 6 * Copyright (c) 1997 Jason R. Thorpe. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice unmodified, this list of conditions, and the following 13 * disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 *
|
62}; 63 64/* Macros to ease CSR access. */ 65#if defined(__NetBSD__) 66#define CSR_READ_1(sc, reg) \ 67 bus_space_read_1((sc)->sc_st, (sc)->sc_sh, (reg)) 68#define CSR_READ_2(sc, reg) \ 69 bus_space_read_2((sc)->sc_st, (sc)->sc_sh, (reg)) 70#define CSR_READ_4(sc, reg) \ 71 bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg)) 72#define CSR_WRITE_1(sc, reg, val) \ 73 bus_space_write_1((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 74#define CSR_WRITE_2(sc, reg, val) \ 75 bus_space_write_2((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 76#define CSR_WRITE_4(sc, reg, val) \ 77 bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 78#else 79#define CSR_READ_1(sc, reg) \ 80 (*((u_int8_t *)((sc)->csr + (reg)))) 81#define CSR_READ_2(sc, reg) \ 82 (*((u_int16_t *)((sc)->csr + (reg)))) 83#define CSR_READ_4(sc, reg) \ 84 (*((u_int32_t *)((sc)->csr + (reg)))) 85#define CSR_WRITE_1(sc, reg, val) \ 86 (*((u_int8_t *)((sc)->csr + (reg)))) = (val) 87#define CSR_WRITE_2(sc, reg, val) \ 88 (*((u_int16_t *)((sc)->csr + (reg)))) = (val) 89#define CSR_WRITE_4(sc, reg, val) \ 90 (*((u_int32_t *)((sc)->csr + (reg)))) = (val) 91#endif /* __NetBSD__ */ 92 93/* Deal with slight differences in software interfaces. */ 94#if defined(__NetBSD__) 95#define sc_if sc_ethercom.ec_if 96#define FXP_FORMAT "%s" 97#define FXP_ARGS(sc) (sc)->sc_dev.dv_xname 98#define FXP_INTR_TYPE int 99#define FXP_IOCTLCMD_TYPE u_long 100#define FXP_BPFTAP_ARG(ifp) (ifp)->if_bpf 101#else /* __FreeBSD__ */ 102#define sc_if arpcom.ac_if 103#define FXP_FORMAT "fxp%d" 104#define FXP_ARGS(sc) (sc)->arpcom.ac_if.if_unit 105#define FXP_INTR_TYPE void 106#define FXP_IOCTLCMD_TYPE int 107#define FXP_BPFTAP_ARG(ifp) ifp 108#endif /* __NetBSD__ */
| 66}; 67 68/* Macros to ease CSR access. */ 69#if defined(__NetBSD__) 70#define CSR_READ_1(sc, reg) \ 71 bus_space_read_1((sc)->sc_st, (sc)->sc_sh, (reg)) 72#define CSR_READ_2(sc, reg) \ 73 bus_space_read_2((sc)->sc_st, (sc)->sc_sh, (reg)) 74#define CSR_READ_4(sc, reg) \ 75 bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg)) 76#define CSR_WRITE_1(sc, reg, val) \ 77 bus_space_write_1((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 78#define CSR_WRITE_2(sc, reg, val) \ 79 bus_space_write_2((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 80#define CSR_WRITE_4(sc, reg, val) \ 81 bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 82#else 83#define CSR_READ_1(sc, reg) \ 84 (*((u_int8_t *)((sc)->csr + (reg)))) 85#define CSR_READ_2(sc, reg) \ 86 (*((u_int16_t *)((sc)->csr + (reg)))) 87#define CSR_READ_4(sc, reg) \ 88 (*((u_int32_t *)((sc)->csr + (reg)))) 89#define CSR_WRITE_1(sc, reg, val) \ 90 (*((u_int8_t *)((sc)->csr + (reg)))) = (val) 91#define CSR_WRITE_2(sc, reg, val) \ 92 (*((u_int16_t *)((sc)->csr + (reg)))) = (val) 93#define CSR_WRITE_4(sc, reg, val) \ 94 (*((u_int32_t *)((sc)->csr + (reg)))) = (val) 95#endif /* __NetBSD__ */ 96 97/* Deal with slight differences in software interfaces. */ 98#if defined(__NetBSD__) 99#define sc_if sc_ethercom.ec_if 100#define FXP_FORMAT "%s" 101#define FXP_ARGS(sc) (sc)->sc_dev.dv_xname 102#define FXP_INTR_TYPE int 103#define FXP_IOCTLCMD_TYPE u_long 104#define FXP_BPFTAP_ARG(ifp) (ifp)->if_bpf 105#else /* __FreeBSD__ */ 106#define sc_if arpcom.ac_if 107#define FXP_FORMAT "fxp%d" 108#define FXP_ARGS(sc) (sc)->arpcom.ac_if.if_unit 109#define FXP_INTR_TYPE void 110#define FXP_IOCTLCMD_TYPE int 111#define FXP_BPFTAP_ARG(ifp) ifp 112#endif /* __NetBSD__ */
|