Update ia64 patch to 2.5.72-030619
[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 #include <linux/fs.h>
21 #include <asm/sn/hwgfs.h>
22
23 typedef hwgfs_handle_t vertex_hdl_t;
24
25 typedef int64_t  __psint_t;     /* needed by klgraph.c */
26
27 typedef enum { B_FALSE, B_TRUE } boolean_t;
28
29
30 /*
31 ** Possible return values from graph routines.
32 */
33 typedef enum graph_error_e {
34         GRAPH_SUCCESS,          /* 0 */
35         GRAPH_DUP,              /* 1 */
36         GRAPH_NOT_FOUND,        /* 2 */
37         GRAPH_BAD_PARAM,        /* 3 */
38         GRAPH_HIT_LIMIT,        /* 4 */
39         GRAPH_CANNOT_ALLOC,     /* 5 */
40         GRAPH_ILLEGAL_REQUEST,  /* 6 */
41         GRAPH_IN_USE            /* 7 */
42 } graph_error_t;
43
44 #define KM_SLEEP   0x0000
45 #define KM_NOSLEEP 0x0001               /* needed by kmem_alloc_node(), kmem_zalloc()
46                                          * calls */
47 #define VM_NOSLEEP 0x0001               /* needed kmem_alloc_node(), kmem_zalloc_node
48                                          * calls */
49 #define XG_WIDGET_PART_NUM      0xC102          /* KONA/xt_regs.h     XG_XT_PART_NUM_VALUE */
50
51 typedef uint64_t vhandl_t;
52
53
54 #define NBPP PAGE_SIZE
55 #define _PAGESZ PAGE_SIZE
56
57 #ifndef MAXDEVNAME
58 #define MAXDEVNAME 256
59 #endif
60
61 #define HUB_PIO_CONVEYOR 0x1
62 #define CNODEID_NONE ((cnodeid_t)-1)
63 #define XTALK_PCI_PART_NUM "030-1275-"
64 #define kdebug 0
65
66
67 #define COPYIN(a, b, c)         copy_from_user(b,a,c)
68 #define COPYOUT(a, b, c)        copy_to_user(b,a,c)
69
70 #define BZERO(a,b)              memset(a, 0, b)
71
72 #define kern_malloc(x)          kmalloc(x, GFP_KERNEL)
73 #define kern_free(x)            kfree(x)
74
75 typedef cpuid_t cpu_cookie_t;
76 #define CPU_NONE                (-1)
77
78 /*
79  * mutext support mapping
80  */
81
82 #define mutex_spinlock_init(s)  spin_lock_init(s)
83 inline static unsigned long
84 mutex_spinlock(spinlock_t *sem) {
85         unsigned long flags = 0;
86 //      spin_lock_irqsave(sem, flags);
87         spin_lock(sem);
88         return(flags);
89 }
90 // #define mutex_spinunlock(s,t)        spin_unlock_irqrestore(s,t)
91 #define mutex_spinunlock(s,t)   spin_unlock(s)
92
93
94 #define mutex_t                 struct semaphore
95 #define mutex_init(s)           init_MUTEX(s)
96 #define mutex_init_locked(s)    init_MUTEX_LOCKED(s)
97 #define mutex_lock(s)           down(s)
98 #define mutex_unlock(s)         up(s)
99
100 #define io_splock(s)            mutex_spinlock(s)
101 #define io_spunlock(s,t)        spin_unlock(s)
102
103 #define spin_lock_destroy(s)
104
105 #if defined(DISABLE_ASSERT)
106 #define ASSERT(expr)
107 #define ASSERT_ALWAYS(expr)
108 #else
109 #define ASSERT(expr)  do {      \
110         if(!(expr)) { \
111                 printk( "Assertion [%s] failed! %s:%s(line=%d)\n",\
112                         #expr,__FILE__,__FUNCTION__,__LINE__); \
113                 panic("Assertion panic\n");     \
114         } } while(0)
115
116 #define ASSERT_ALWAYS(expr)     do {\
117         if(!(expr)) { \
118                 printk( "Assertion [%s] failed! %s:%s(line=%d)\n",\
119                         #expr,__FILE__,__FUNCTION__,__LINE__); \
120                 panic("Assertion always panic\n");      \
121         } } while(0)
122 #endif  /* DISABLE_ASSERT */
123
124 #define PRINT_PANIC             panic
125
126 /* print_register() defs */
127
128 /*
129  * register values
130  * map between numeric values and symbolic values
131  */
132 struct reg_values {
133         unsigned long long rv_value;
134         char *rv_name;
135 };
136
137 /*
138  * register descriptors are used for formatted prints of register values
139  * rd_mask and rd_shift must be defined, other entries may be null
140  */
141 struct reg_desc {
142         unsigned long long rd_mask;     /* mask to extract field */
143         int rd_shift;           /* shift for extracted value, - >>, + << */
144         char *rd_name;          /* field name */
145         char *rd_format;        /* format to print field */
146         struct reg_values *rd_values;   /* symbolic names of values */
147 };
148
149 extern void print_register(unsigned long long, struct reg_desc *);
150
151 /******************************************
152  * Definitions that do not exist in linux *
153  ******************************************/
154
155 #define DELAY(a)
156
157 /************************************************
158  * Routines redefined to use linux equivalents. *
159  ************************************************/
160
161 /* #define FIXME(s) printk("FIXME: [ %s ] in %s at %s:%d\n", s, __FUNCTION__, __FILE__, __LINE__) */
162
163 #define FIXME(s)
164
165 /* move to stubs.c yet */
166 #define dev_to_vhdl(dev) 0
167 #define get_timestamp() 0
168 #define us_delay(a)
169 #define v_mapphys(a,b,c) 0    // printk("Fixme: v_mapphys - soft->base 0x%p\n", b);
170 #define splhi()  0
171 #define splx(s)
172
173 extern void * snia_kmem_alloc_node(register size_t, register int, cnodeid_t);
174 extern void * snia_kmem_zalloc(size_t, int);
175 extern void * snia_kmem_zalloc_node(register size_t, register int, cnodeid_t );
176 extern int is_specified(char *);
177
178 #endif /* _ASM_IA64_SN_SGI_H */