1 /**************************************************************************
3 * Copyright (C) 2000-2008 Alacritech, Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following
13 * disclaimer in the documentation and/or other materials provided
14 * with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY ALACRITECH, INC. ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ALACRITECH, INC. OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * The views and conclusions contained in the software and documentation
30 * are those of the authors and should not be interpreted as representing
31 * official policies, either expressed or implied, of Alacritech, Inc.
33 **************************************************************************/
38 * These are the Linux-specific definitions required for the SLICOSS
39 * driver, which should allow for greater portability to other OSes.
41 #ifndef _SLIC_OS_SPECIFIC_H_
42 #define _SLIC_OS_SPECIFIC_H_
48 struct list_entry *nle_flink;
49 struct list_entry *nle_blink;
52 #define InitializeListHead(l) \
53 (l)->nle_flink = (l)->nle_blink = (l)
55 #define IsListEmpty(h) \
56 ((h)->nle_flink == (h))
58 #define RemoveEntryList(e) \
69 /* These two have to be inlined since they return things. */
71 static inline struct list_entry *RemoveHeadList(struct list_entry *l)
84 static inline struct list_entry *RemoveTailList(struct list_entry *l)
97 #define InsertTailList(l, e) \
99 struct list_entry *b; \
101 b = (l)->nle_blink; \
102 (e)->nle_flink = (l); \
103 (e)->nle_blink = b; \
104 b->nle_flink = (e); \
105 (l)->nle_blink = (e); \
108 #define InsertHeadList(l, e) \
110 struct list_entry *f; \
112 f = (l)->nle_flink; \
113 (e)->nle_flink = f; \
114 (e)->nle_blink = l; \
115 f->nle_blink = (e); \
116 (l)->nle_flink = (e); \
122 #define SLIC_TIMESTAMP(value) { \
123 struct timeval timev; \
124 do_gettimeofday(&timev); \
125 value = timev.tv_sec*1000000 + timev.tv_usec; \
128 #define SLIC_TIMESTAMP(value)
134 #define SXG_TIMESTAMP(value) { \
135 struct timeval timev; \
136 do_gettimeofday(&timev); \
137 value = timev.tv_sec*1000000 + timev.tv_usec; \
140 #define SXG_TIMESTAMP(value)
143 #define WRITE_REG(reg,value,flush) \
144 sxg_reg32_write((®), (value), (flush))
145 #define WRITE_REG64(a,reg,value,cpu) \
146 sxg_reg64_write((a),(®),(value),(cpu))
147 #define READ_REG(reg,value) (value) = readl((void __iomem *)(®))
149 #endif /* _SLIC_OS_SPECIFIC_H_ */