Annotation of sys/dev/pci/if_ixgb_osdep.h, Revision 1.1
1.1 ! nbrk 1: /**************************************************************************
! 2:
! 3: Copyright (c) 2001-2005, Intel Corporation
! 4: All rights reserved.
! 5:
! 6: Redistribution and use in source and binary forms, with or without
! 7: modification, are permitted provided that the following conditions are met:
! 8:
! 9: 1. Redistributions of source code must retain the above copyright notice,
! 10: this list of conditions and the following disclaimer.
! 11:
! 12: 2. Redistributions in binary form must reproduce the above copyright
! 13: notice, this list of conditions and the following disclaimer in the
! 14: documentation and/or other materials provided with the distribution.
! 15:
! 16: 3. Neither the name of the Intel Corporation nor the names of its
! 17: contributors may be used to endorse or promote products derived from
! 18: this software without specific prior written permission.
! 19:
! 20: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
! 21: AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 22: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 23: ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
! 24: LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! 25: CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! 26: SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! 27: INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! 28: CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! 29: ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! 30: POSSIBILITY OF SUCH DAMAGE.
! 31:
! 32: ***************************************************************************/
! 33:
! 34: /* $OpenBSD: if_ixgb_osdep.h,v 1.2 2006/05/01 21:01:12 brad Exp $ */
! 35:
! 36: #ifndef _IXGB_OPENBSD_OS_H_
! 37: #define _IXGB_OPENBSD_OS_H_
! 38:
! 39: #define ASSERT(x) if(!(x)) panic("IXGB: x")
! 40:
! 41: /* The happy-fun DELAY macro is defined in /usr/src/sys/i386/include/clock.h */
! 42: #define usec_delay(x) DELAY(x)
! 43: #define msec_delay(x) DELAY(1000*(x))
! 44:
! 45: #define DBG 0
! 46: #define MSGOUT(S, A, B) printf(S "\n", A, B)
! 47: #define DEBUGFUNC(F) DEBUGOUT(F);
! 48: #if DBG
! 49: #define DEBUGOUT(S) printf(S "\n")
! 50: #define DEBUGOUT1(S,A) printf(S "\n",A)
! 51: #define DEBUGOUT2(S,A,B) printf(S "\n",A,B)
! 52: #define DEBUGOUT3(S,A,B,C) printf(S "\n",A,B,C)
! 53: #define DEBUGOUT7(S,A,B,C,D,E,F,G) printf(S "\n",A,B,C,D,E,F,G)
! 54: #else
! 55: #define DEBUGOUT(S)
! 56: #define DEBUGOUT1(S,A)
! 57: #define DEBUGOUT2(S,A,B)
! 58: #define DEBUGOUT3(S,A,B,C)
! 59: #define DEBUGOUT7(S,A,B,C,D,E,F,G)
! 60: #endif
! 61:
! 62: #define CMD_MEM_WRT_INVALIDATE 0x0010 /* BIT_4 */
! 63:
! 64: #define le16_to_cpu
! 65:
! 66: struct ixgb_osdep
! 67: {
! 68: bus_space_tag_t mem_bus_space_tag;
! 69: bus_space_handle_t mem_bus_space_handle;
! 70: struct device *dev;
! 71:
! 72: struct pci_attach_args ixgb_pa;
! 73:
! 74: bus_size_t ixgb_memsize;
! 75: bus_addr_t ixgb_membase;
! 76: };
! 77:
! 78: #define IXGB_WRITE_FLUSH(a) IXGB_READ_REG(a, STATUS)
! 79:
! 80: #define IXGB_READ_REG(a, reg) \
! 81: bus_space_read_4( ((struct ixgb_osdep *)(a)->back)->mem_bus_space_tag, \
! 82: ((struct ixgb_osdep *)(a)->back)->mem_bus_space_handle, \
! 83: IXGB_##reg)
! 84:
! 85: #define IXGB_WRITE_REG(a, reg, value) \
! 86: bus_space_write_4( ((struct ixgb_osdep *)(a)->back)->mem_bus_space_tag, \
! 87: ((struct ixgb_osdep *)(a)->back)->mem_bus_space_handle, \
! 88: IXGB_##reg, value)
! 89:
! 90: #define IXGB_READ_REG_ARRAY(a, reg, offset) \
! 91: bus_space_read_4( ((struct ixgb_osdep *)(a)->back)->mem_bus_space_tag, \
! 92: ((struct ixgb_osdep *)(a)->back)->mem_bus_space_handle, \
! 93: (IXGB_##reg + ((offset) << 2)))
! 94:
! 95: #define IXGB_WRITE_REG_ARRAY(a, reg, offset, value) \
! 96: bus_space_write_4( ((struct ixgb_osdep *)(a)->back)->mem_bus_space_tag, \
! 97: ((struct ixgb_osdep *)(a)->back)->mem_bus_space_handle, \
! 98: (IXGB_##reg + ((offset) << 2)), value)
! 99:
! 100: #ifdef DEBUG
! 101: #define IXGB_KASSERT(exp,msg) do { if (!(exp)) panic msg; } while (0)
! 102: #else
! 103: #define IXGB_KASSERT(exp,msg)
! 104: #endif
! 105:
! 106: #endif /* _IXGB_OPENBSD_OS_H_ */
CVSweb