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 typedef struct _LIST_ENTRY {
49 struct _LIST_ENTRY *nle_flink;
50 struct _LIST_ENTRY *nle_blink;
51 } list_entry, LIST_ENTRY, *PLIST_ENTRY;
53 #define InitializeListHead(l) \
54 (l)->nle_flink = (l)->nle_blink = (l)
56 #define IsListEmpty(h) \
57 ((h)->nle_flink == (h))
59 #define RemoveEntryList(e) \
70 /* These two have to be inlined since they return things. */
72 static __inline PLIST_ENTRY
73 RemoveHeadList(list_entry *l)
86 static __inline PLIST_ENTRY
87 RemoveTailList(list_entry *l)
101 #define InsertTailList(l, e) \
105 b = (l)->nle_blink; \
106 (e)->nle_flink = (l); \
107 (e)->nle_blink = b; \
108 b->nle_flink = (e); \
109 (l)->nle_blink = (e); \
112 #define InsertHeadList(l, e) \
116 f = (l)->nle_flink; \
117 (e)->nle_flink = f; \
118 (e)->nle_blink = l; \
119 f->nle_blink = (e); \
120 (l)->nle_flink = (e); \
127 #define SLIC_TIMESTAMP(value) { \
128 struct timeval timev; \
129 do_gettimeofday(&timev); \
130 value = timev.tv_sec*1000000 + timev.tv_usec; \
133 #define SLIC_TIMESTAMP(value)
137 /****************** SXG DEFINES *****************************************/
140 #define SXG_TIMESTAMP(value) { \
141 struct timeval timev; \
142 do_gettimeofday(&timev); \
143 value = timev.tv_sec*1000000 + timev.tv_usec; \
146 #define SXG_TIMESTAMP(value)
149 #define WRITE_REG(reg,value,flush) sxg_reg32_write((®), (value), (flush))
150 #define WRITE_REG64(a,reg,value,cpu) sxg_reg64_write((a),(®),(value),(cpu))
151 #define READ_REG(reg,value) (value) = readl((void __iomem *)(®))
153 #endif /* _SLIC_OS_SPECIFIC_H_ */