Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixgbe/ixgbe_osdep.h
| /****************************************************************************** | /****************************************************************************** | ||||
| Copyright (c) 2001-2015, Intel Corporation | Copyright (c) 2001-2017, Intel Corporation | ||||
| All rights reserved. | All rights reserved. | ||||
| Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
| modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
| 1. Redistributions of source code must retain the above copyright notice, | 1. Redistributions of source code must retain the above copyright notice, | ||||
| this list of conditions and the following disclaimer. | this list of conditions and the following disclaimer. | ||||
| 2. Redistributions in binary form must reproduce the above copyright | 2. Redistributions in binary form must reproduce the above copyright | ||||
| notice, this list of conditions and the following disclaimer in the | notice, this list of conditions and the following disclaimer in the | ||||
| documentation and/or other materials provided with the distribution. | documentation and/or other materials provided with the distribution. | ||||
| 3. Neither the name of the Intel Corporation nor the names of its | 3. Neither the name of the Intel Corporation nor the names of its | ||||
| contributors may be used to endorse or promote products derived from | contributors may be used to endorse or promote products derived from | ||||
| this software without specific prior written permission. | this software without specific prior written permission. | ||||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||||
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
| ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||||
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||||
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||||
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||||
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||||
| POSSIBILITY OF SUCH DAMAGE. | POSSIBILITY OF SUCH DAMAGE. | ||||
| ******************************************************************************/ | ******************************************************************************/ | ||||
| /*$FreeBSD$*/ | /*$FreeBSD$*/ | ||||
| #ifndef _IXGBE_OS_H_ | #ifndef _IXGBE_OS_H_ | ||||
| #define _IXGBE_OS_H_ | #define _IXGBE_OS_H_ | ||||
| Show All 13 Lines | |||||
| #include <machine/resource.h> | #include <machine/resource.h> | ||||
| #include <vm/vm.h> | #include <vm/vm.h> | ||||
| #include <vm/pmap.h> | #include <vm/pmap.h> | ||||
| #include <machine/clock.h> | #include <machine/clock.h> | ||||
| #include <dev/pci/pcivar.h> | #include <dev/pci/pcivar.h> | ||||
| #include <dev/pci/pcireg.h> | #include <dev/pci/pcireg.h> | ||||
| #define ASSERT(x) if(!(x)) panic("IXGBE: x") | #define ASSERT(x) if(!(x)) panic("IXGBE: x") | ||||
| #define EWARN(H, W, S) printf(W) | #define EWARN(H, W) printf(W) | ||||
| enum { | enum { | ||||
| IXGBE_ERROR_SOFTWARE, | IXGBE_ERROR_SOFTWARE, | ||||
| IXGBE_ERROR_POLLING, | IXGBE_ERROR_POLLING, | ||||
| IXGBE_ERROR_INVALID_STATE, | IXGBE_ERROR_INVALID_STATE, | ||||
| IXGBE_ERROR_UNSUPPORTED, | IXGBE_ERROR_UNSUPPORTED, | ||||
| IXGBE_ERROR_ARGUMENT, | IXGBE_ERROR_ARGUMENT, | ||||
| IXGBE_ERROR_CAUTION, | IXGBE_ERROR_CAUTION, | ||||
| ▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
| #define UNREFERENCED_2PARAMETER(_p, _q) | #define UNREFERENCED_2PARAMETER(_p, _q) | ||||
| #define UNREFERENCED_3PARAMETER(_p, _q, _r) | #define UNREFERENCED_3PARAMETER(_p, _q, _r) | ||||
| #define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) | #define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) | ||||
| #define IXGBE_NTOHL(_i) ntohl(_i) | #define IXGBE_NTOHL(_i) ntohl(_i) | ||||
| #define IXGBE_NTOHS(_i) ntohs(_i) | #define IXGBE_NTOHS(_i) ntohs(_i) | ||||
| /* XXX these need to be revisited */ | /* XXX these need to be revisited */ | ||||
| #define IXGBE_CPU_TO_LE16 htole16 | |||||
| #define IXGBE_CPU_TO_LE32 htole32 | #define IXGBE_CPU_TO_LE32 htole32 | ||||
| #define IXGBE_LE32_TO_CPU le32toh | |||||
| #define IXGBE_LE32_TO_CPUS(x) | #define IXGBE_LE32_TO_CPUS(x) | ||||
| #define IXGBE_CPU_TO_BE16 htobe16 | #define IXGBE_CPU_TO_BE16 htobe16 | ||||
| #define IXGBE_CPU_TO_BE32 htobe32 | #define IXGBE_CPU_TO_BE32 htobe32 | ||||
| #define IXGBE_BE32_TO_CPU be32toh | |||||
| typedef uint8_t u8; | typedef uint8_t u8; | ||||
| typedef int8_t s8; | typedef int8_t s8; | ||||
| typedef uint16_t u16; | typedef uint16_t u16; | ||||
| typedef int16_t s16; | typedef int16_t s16; | ||||
| typedef uint32_t u32; | typedef uint32_t u32; | ||||
| typedef int32_t s32; | typedef int32_t s32; | ||||
| typedef uint64_t u64; | typedef uint64_t u64; | ||||
| #ifndef __bool_true_false_are_defined | #ifndef __bool_true_false_are_defined | ||||
| typedef boolean_t bool; | typedef boolean_t bool; | ||||
| #endif | #endif | ||||
| /* shared code requires this */ | /* shared code requires this */ | ||||
| #define __le16 u16 | #define __le16 u16 | ||||
| #define __le32 u32 | #define __le32 u32 | ||||
| #define __le64 u64 | #define __le64 u64 | ||||
| #define __be16 u16 | #define __be16 u16 | ||||
| #define __be32 u32 | #define __be32 u32 | ||||
| #define __be64 u64 | #define __be64 u64 | ||||
| #define le16_to_cpu | #define le16_to_cpu | ||||
| #if __FreeBSD_version < 800000 | #if __FreeBSD_version < 800000 | ||||
| #if defined(__i386__) || defined(__amd64__) | #if defined(__i386__) || defined(__amd64__) | ||||
| #define mb() __asm volatile("mfence" ::: "memory") | #define mb() __asm volatile("mfence" ::: "memory") | ||||
| #define wmb() __asm volatile("sfence" ::: "memory") | #define wmb() __asm volatile("sfence" ::: "memory") | ||||
| #define rmb() __asm volatile("lfence" ::: "memory") | #define rmb() __asm volatile("lfence" ::: "memory") | ||||
| #else | #else | ||||
| #define mb() | #define mb() | ||||
| Show All 33 Lines | |||||
| struct ixgbe_osdep | struct ixgbe_osdep | ||||
| { | { | ||||
| bus_space_tag_t mem_bus_space_tag; | bus_space_tag_t mem_bus_space_tag; | ||||
| bus_space_handle_t mem_bus_space_handle; | bus_space_handle_t mem_bus_space_handle; | ||||
| }; | }; | ||||
| /* These routines need struct ixgbe_hw declared */ | /* These routines need struct ixgbe_hw declared */ | ||||
| struct ixgbe_hw; | struct ixgbe_hw; | ||||
| device_t ixgbe_dev_from_hw(struct ixgbe_hw *hw); | device_t ixgbe_dev_from_hw(struct ixgbe_hw *hw); | ||||
| /* These routines are needed by the shared code */ | /* These routines are needed by the shared code */ | ||||
| extern u16 ixgbe_read_pci_cfg(struct ixgbe_hw *, u32); | extern u16 ixgbe_read_pci_cfg(struct ixgbe_hw *, u32); | ||||
| #define IXGBE_READ_PCIE_WORD ixgbe_read_pci_cfg | #define IXGBE_READ_PCIE_WORD ixgbe_read_pci_cfg | ||||
| extern void ixgbe_write_pci_cfg(struct ixgbe_hw *, u32, u16); | extern void ixgbe_write_pci_cfg(struct ixgbe_hw *, u32, u16); | ||||
| #define IXGBE_WRITE_PCIE_WORD ixgbe_write_pci_cfg | #define IXGBE_WRITE_PCIE_WORD ixgbe_write_pci_cfg | ||||
| Show All 18 Lines | |||||