Deleted Added
full compact
e1000_osdep.h (185353) e1000_osdep.h (200243)
1/******************************************************************************
2
1/******************************************************************************
2
3 Copyright (c) 2001-2008, Intel Corporation
3 Copyright (c) 2001-2009, 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

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

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******************************************************************************/
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

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

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/*$FreeBSD: head/sys/dev/e1000/e1000_osdep.h 185353 2008-11-26 23:57:23Z jfv $*/
33/*$FreeBSD: head/sys/dev/e1000/e1000_osdep.h 200243 2009-12-08 01:07:44Z jfv $*/
34
35
36#ifndef _FREEBSD_OS_H_
37#define _FREEBSD_OS_H_
38
39#include <sys/types.h>
40#include <sys/param.h>
41#include <sys/systm.h>
34
35
36#ifndef _FREEBSD_OS_H_
37#define _FREEBSD_OS_H_
38
39#include <sys/types.h>
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/lock.h>
43#include <sys/mutex.h>
42#include <sys/mbuf.h>
43#include <sys/protosw.h>
44#include <sys/socket.h>
45#include <sys/malloc.h>
46#include <sys/kernel.h>
47#include <sys/bus.h>
48#include <machine/bus.h>
49#include <sys/rman.h>
50#include <machine/resource.h>
51#include <vm/vm.h>
52#include <vm/pmap.h>
53#include <machine/clock.h>
54#include <dev/pci/pcivar.h>
55#include <dev/pci/pcireg.h>
56
57
58#define ASSERT(x) if(!(x)) panic("EM: x")
59
44#include <sys/mbuf.h>
45#include <sys/protosw.h>
46#include <sys/socket.h>
47#include <sys/malloc.h>
48#include <sys/kernel.h>
49#include <sys/bus.h>
50#include <machine/bus.h>
51#include <sys/rman.h>
52#include <machine/resource.h>
53#include <vm/vm.h>
54#include <vm/pmap.h>
55#include <machine/clock.h>
56#include <dev/pci/pcivar.h>
57#include <dev/pci/pcireg.h>
58
59
60#define ASSERT(x) if(!(x)) panic("EM: x")
61
60/* The happy-fun DELAY macro is defined in /usr/src/sys/i386/include/clock.h */
61#define usec_delay(x) DELAY(x)
62#define msec_delay(x) DELAY(1000*(x))
62#define usec_delay(x) DELAY(x)
63#define msec_delay(x) DELAY(1000*(x))
63/* TODO: Should we be paranoid about delaying in interrupt context? */
64#define msec_delay_irq(x) DELAY(1000*(x))
65
66#define MSGOUT(S, A, B) printf(S "\n", A, B)
67#define DEBUGFUNC(F) DEBUGOUT(F);
68 #define DEBUGOUT(S)
69 #define DEBUGOUT1(S,A)
70 #define DEBUGOUT2(S,A,B)
71 #define DEBUGOUT3(S,A,B,C)
72 #define DEBUGOUT7(S,A,B,C,D,E,F,G)
73
74#define STATIC static
75#define FALSE 0
64#define msec_delay_irq(x) DELAY(1000*(x))
65
66#define MSGOUT(S, A, B) printf(S "\n", A, B)
67#define DEBUGFUNC(F) DEBUGOUT(F);
68 #define DEBUGOUT(S)
69 #define DEBUGOUT1(S,A)
70 #define DEBUGOUT2(S,A,B)
71 #define DEBUGOUT3(S,A,B,C)
72 #define DEBUGOUT7(S,A,B,C,D,E,F,G)
73
74#define STATIC static
75#define FALSE 0
76#define false FALSE /* shared code stupidity */
76#define false FALSE
77#define TRUE 1
78#define true TRUE
79#define CMD_MEM_WRT_INVALIDATE 0x0010 /* BIT_4 */
80#define PCI_COMMAND_REGISTER PCIR_COMMAND
81
77#define TRUE 1
78#define true TRUE
79#define CMD_MEM_WRT_INVALIDATE 0x0010 /* BIT_4 */
80#define PCI_COMMAND_REGISTER PCIR_COMMAND
81
82/*
83** These typedefs are necessary due to the new
84** shared code, they are native to Linux.
85*/
82/* Mutex used in the shared code */
83#define E1000_MUTEX struct mtx
84#define E1000_MUTEX_INIT(mutex) mtx_init((mutex), #mutex, \
85 MTX_NETWORK_LOCK, \
86 MTX_DEF | MTX_SPIN)
87#define E1000_MUTEX_DESTROY(mutex) mtx_destroy(mutex)
88#define E1000_MUTEX_LOCK(mutex) mtx_lock(mutex)
89#define E1000_MUTEX_TRYLOCK(mutex) mtx_trylock(mutex)
90#define E1000_MUTEX_UNLOCK(mutex) mtx_unlock(mutex)
91
86typedef uint64_t u64;
87typedef uint32_t u32;
88typedef uint16_t u16;
89typedef uint8_t u8;
90typedef int64_t s64;
91typedef int32_t s32;
92typedef int16_t s16;
93typedef int8_t s8;
94typedef boolean_t bool;
95
96#define __le16 u16
97#define __le32 u32
98#define __le64 u64
99
92typedef uint64_t u64;
93typedef uint32_t u32;
94typedef uint16_t u16;
95typedef uint8_t u8;
96typedef int64_t s64;
97typedef int32_t s32;
98typedef int16_t s16;
99typedef int8_t s8;
100typedef boolean_t bool;
101
102#define __le16 u16
103#define __le32 u32
104#define __le64 u64
105
106#if __FreeBSD_version < 800000 /* Now in HEAD */
107#if defined(__i386__) || defined(__amd64__)
108#define mb() __asm volatile("mfence" ::: "memory")
109#define wmb() __asm volatile("sfence" ::: "memory")
110#define rmb() __asm volatile("lfence" ::: "memory")
111#else
112#define mb()
113#define rmb()
114#define wmb()
115#endif
116#endif /*__FreeBSD_version < 800000 */
117
118#if defined(__i386__) || defined(__amd64__)
119static __inline
120void prefetch(void *x)
121{
122 __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x));
123}
124#else
125#define prefetch(x)
126#endif
127
100struct e1000_osdep
101{
102 bus_space_tag_t mem_bus_space_tag;
103 bus_space_handle_t mem_bus_space_handle;
104 bus_space_tag_t io_bus_space_tag;
105 bus_space_handle_t io_bus_space_handle;
106 bus_space_tag_t flash_bus_space_tag;
107 bus_space_handle_t flash_bus_space_handle;

--- 84 unchanged lines hidden ---
128struct e1000_osdep
129{
130 bus_space_tag_t mem_bus_space_tag;
131 bus_space_handle_t mem_bus_space_handle;
132 bus_space_tag_t io_bus_space_tag;
133 bus_space_handle_t io_bus_space_handle;
134 bus_space_tag_t flash_bus_space_tag;
135 bus_space_handle_t flash_bus_space_handle;

--- 84 unchanged lines hidden ---