Update ia64 patch to 2.5.69-030521, throwing away the parts included
[linux-flexiantxendom0-3.2.10.git] / include / asm-ia64 / sn / sgi.h
1 /*
2  *
3  * This file is subject to the terms and conditions of the GNU General Public
4  * License.  See the file "COPYING" in the main directory of this archive
5  * for more details.
6  *
7  * Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved.
8  */
9
10
11 #ifndef _ASM_IA64_SN_SGI_H
12 #define _ASM_IA64_SN_SGI_H
13
14 #include <linux/config.h>
15
16 #include <asm/sn/types.h>
17 #include <asm/uaccess.h>                /* for copy_??_user */
18 #include <linux/mm.h>
19 #include <linux/devfs_fs_kernel.h>
20 #ifdef CONFIG_HWGFS_FS
21 #include <linux/fs.h>
22 #include <asm/sn/hwgfs.h>
23 typedef hwgfs_handle_t vertex_hdl_t;
24 #else
25 typedef devfs_handle_t vertex_hdl_t;
26 #endif
27
28 typedef int64_t  __psint_t;     /* needed by klgraph.c */
29
30 typedef enum { B_FALSE, B_TRUE } boolean_t;
31
32 #define ctob(x)                 ((uint64_t)(x)*NBPC)
33 #define btoc(x)                 (((uint64_t)(x)+(NBPC-1))/NBPC)
34
35
36 /*
37 ** Possible return values from graph routines.
38 */
39 typedef enum graph_error_e {
40         GRAPH_SUCCESS,          /* 0 */
41         GRAPH_DUP,              /* 1 */
42         GRAPH_NOT_FOUND,        /* 2 */
43         GRAPH_BAD_PARAM,        /* 3 */
44         GRAPH_HIT_LIMIT,        /* 4 */
45         GRAPH_CANNOT_ALLOC,     /* 5 */
46         GRAPH_ILLEGAL_REQUEST,  /* 6 */
47         GRAPH_IN_USE            /* 7 */
48 } graph_error_t;
49
50 #define KM_SLEEP   0x0000
51 #define KM_NOSLEEP 0x0001               /* needed by kmem_alloc_node(), kmem_zalloc()
52                                          * calls */
53 #define VM_NOSLEEP 0x0001               /* needed kmem_alloc_node(), kmem_zalloc_node
54                                          * calls */
55 #define XG_WIDGET_PART_NUM      0xC102          /* KONA/xt_regs.h     XG_XT_PART_NUM_VALUE */
56
57 typedef uint64_t vhandl_t;
58
59
60 #define NBPP PAGE_SIZE
61 #define _PAGESZ PAGE_SIZE
62
63 #ifndef D_MP
64 #define D_MP 1
65 #endif
66
67 #ifndef MAXDEVNAME
68 #define MAXDEVNAME 256
69 #endif
70
71 #ifndef NBPC
72 #define NBPC 0
73 #endif
74
75 typedef uint64_t mrlock_t;      /* needed by devsupport.c */
76
77 #define HUB_PIO_CONVEYOR 0x1
78 #define CNODEID_NONE ((cnodeid_t)-1)
79 #define XTALK_PCI_PART_NUM "030-1275-"
80 #define kdebug 0
81
82
83 #define COPYIN(a, b, c)         copy_from_user(b,a,c)
84 #define COPYOUT(a, b, c)        copy_to_user(b,a,c)
85
86 #define kvtophys(x)             (alenaddr_t) (x)
87 #define POFFMASK                (NBPP - 1)
88 #define poff(X)                 ((__psunsigned_t)(X) & POFFMASK)
89
90 #define BZERO(a,b)              memset(a, 0, b)
91
92 #define kern_malloc(x)          kmalloc(x, GFP_KERNEL)
93 #define kern_free(x)            kfree(x)
94
95 typedef cpuid_t cpu_cookie_t;
96 #define CPU_NONE                (-1)
97
98 /*
99  * mutext support mapping
100  */
101
102 #define mutex_spinlock_init(s)  spin_lock_init(s)
103 inline static unsigned long
104 mutex_spinlock(spinlock_t *sem) {
105         unsigned long flags = 0;
106 //      spin_lock_irqsave(sem, flags);
107         spin_lock(sem);
108         return(flags);
109 }
110 // #define mutex_spinunlock(s,t)        spin_unlock_irqrestore(s,t)
111 #define mutex_spinunlock(s,t)   spin_unlock(s)
112
113
114 #define mutex_t                 struct semaphore
115 #define mutex_init(s)           init_MUTEX(s)
116 #define mutex_init_locked(s)    init_MUTEX_LOCKED(s)
117 #define mutex_lock(s)           down(s)
118 #define mutex_unlock(s)         up(s)
119
120 #define io_splock(s)            mutex_spinlock(s)
121 #define io_spunlock(s,t)        spin_unlock(s)
122
123 #define spin_lock_destroy(s)
124
125 #if defined(DISABLE_ASSERT)
126 #define ASSERT(expr)
127 #define ASSERT_ALWAYS(expr)
128 #else
129 #define ASSERT(expr)  do {      \
130         if(!(expr)) { \
131                 printk( "Assertion [%s] failed! %s:%s(line=%d)\n",\
132                         #expr,__FILE__,__FUNCTION__,__LINE__); \
133                 panic("Assertion panic\n");     \
134         } } while(0)
135
136 #define ASSERT_ALWAYS(expr)     do {\
137         if(!(expr)) { \
138                 printk( "Assertion [%s] failed! %s:%s(line=%d)\n",\
139                         #expr,__FILE__,__FUNCTION__,__LINE__); \
140                 panic("Assertion always panic\n");      \
141         } } while(0)
142 #endif  /* DISABLE_ASSERT */
143
144 #define PRINT_PANIC             panic
145
146 /* print_register() defs */
147
148 /*
149  * register values
150  * map between numeric values and symbolic values
151  */
152 struct reg_values {
153         unsigned long long rv_value;
154         char *rv_name;
155 };
156
157 /*
158  * register descriptors are used for formatted prints of register values
159  * rd_mask and rd_shift must be defined, other entries may be null
160  */
161 struct reg_desc {
162         unsigned long long rd_mask;     /* mask to extract field */
163         int rd_shift;           /* shift for extracted value, - >>, + << */
164         char *rd_name;          /* field name */
165         char *rd_format;        /* format to print field */
166         struct reg_values *rd_values;   /* symbolic names of values */
167 };
168
169 extern void print_register(unsigned long long, struct reg_desc *);
170
171 /******************************************
172  * Definitions that do not exist in linux *
173  ******************************************/
174
175 typedef int cred_t;     /* This is for compilation reasons */
176 struct cred { int x; };
177
178
179 #define DELAY(a)
180
181 /************************************************
182  * Routines redefined to use linux equivalents. *
183  ************************************************/
184
185 /* #define FIXME(s) printk("FIXME: [ %s ] in %s at %s:%d\n", s, __FUNCTION__, __FILE__, __LINE__) */
186
187 #define FIXME(s)
188
189 /* move to stubs.c yet */
190 #define dev_to_vhdl(dev) 0
191 #define get_timestamp() 0
192 #define us_delay(a)
193 #define v_mapphys(a,b,c) 0    // printk("Fixme: v_mapphys - soft->base 0x%p\n", b);
194 #define splhi()  0
195 #define splx(s)
196
197 extern void * snia_kmem_alloc_node(register size_t, register int, cnodeid_t);
198 extern void * snia_kmem_zalloc(size_t, int);
199 extern void * snia_kmem_zalloc_node(register size_t, register int, cnodeid_t );
200 extern int is_specified(char *);
201
202 #endif /* _ASM_IA64_SN_SGI_H */