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
7 * Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved.
11 #ifndef _ASM_IA64_SN_SGI_H
12 #define _ASM_IA64_SN_SGI_H
14 #include <linux/config.h>
16 #include <asm/sn/types.h>
17 #include <asm/uaccess.h> /* for copy_??_user */
19 #include <linux/devfs_fs_kernel.h>
20 #ifdef CONFIG_HWGFS_FS
22 #include <asm/sn/hwgfs.h>
23 typedef hwgfs_handle_t vertex_hdl_t;
25 typedef devfs_handle_t vertex_hdl_t;
28 typedef int64_t __psint_t; /* needed by klgraph.c */
30 typedef enum { B_FALSE, B_TRUE } boolean_t;
32 #define ctob(x) ((uint64_t)(x)*NBPC)
33 #define btoc(x) (((uint64_t)(x)+(NBPC-1))/NBPC)
37 ** Possible return values from graph routines.
39 typedef enum graph_error_e {
40 GRAPH_SUCCESS, /* 0 */
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 */
50 #define KM_SLEEP 0x0000
51 #define KM_NOSLEEP 0x0001 /* needed by kmem_alloc_node(), kmem_zalloc()
53 #define VM_NOSLEEP 0x0001 /* needed kmem_alloc_node(), kmem_zalloc_node
55 #define XG_WIDGET_PART_NUM 0xC102 /* KONA/xt_regs.h XG_XT_PART_NUM_VALUE */
57 typedef uint64_t vhandl_t;
60 #define NBPP PAGE_SIZE
61 #define _PAGESZ PAGE_SIZE
68 #define MAXDEVNAME 256
75 typedef uint64_t mrlock_t; /* needed by devsupport.c */
77 #define HUB_PIO_CONVEYOR 0x1
78 #define CNODEID_NONE ((cnodeid_t)-1)
79 #define XTALK_PCI_PART_NUM "030-1275-"
83 #define COPYIN(a, b, c) copy_from_user(b,a,c)
84 #define COPYOUT(a, b, c) copy_to_user(b,a,c)
86 #define kvtophys(x) (alenaddr_t) (x)
87 #define POFFMASK (NBPP - 1)
88 #define poff(X) ((__psunsigned_t)(X) & POFFMASK)
90 #define BZERO(a,b) memset(a, 0, b)
92 #define kern_malloc(x) kmalloc(x, GFP_KERNEL)
93 #define kern_free(x) kfree(x)
95 typedef cpuid_t cpu_cookie_t;
99 * mutext support mapping
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);
110 // #define mutex_spinunlock(s,t) spin_unlock_irqrestore(s,t)
111 #define mutex_spinunlock(s,t) spin_unlock(s)
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)
120 #define io_splock(s) mutex_spinlock(s)
121 #define io_spunlock(s,t) spin_unlock(s)
123 #define spin_lock_destroy(s)
125 #if defined(DISABLE_ASSERT)
127 #define ASSERT_ALWAYS(expr)
129 #define ASSERT(expr) do { \
131 printk( "Assertion [%s] failed! %s:%s(line=%d)\n",\
132 #expr,__FILE__,__FUNCTION__,__LINE__); \
133 panic("Assertion panic\n"); \
136 #define ASSERT_ALWAYS(expr) do {\
138 printk( "Assertion [%s] failed! %s:%s(line=%d)\n",\
139 #expr,__FILE__,__FUNCTION__,__LINE__); \
140 panic("Assertion always panic\n"); \
142 #endif /* DISABLE_ASSERT */
144 #define PRINT_PANIC panic
146 /* print_register() defs */
150 * map between numeric values and symbolic values
153 unsigned long long rv_value;
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
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 */
169 extern void print_register(unsigned long long, struct reg_desc *);
171 /******************************************
172 * Definitions that do not exist in linux *
173 ******************************************/
175 typedef int cred_t; /* This is for compilation reasons */
176 struct cred { int x; };
181 /************************************************
182 * Routines redefined to use linux equivalents. *
183 ************************************************/
185 /* #define FIXME(s) printk("FIXME: [ %s ] in %s at %s:%d\n", s, __FUNCTION__, __FILE__, __LINE__) */
189 /* move to stubs.c yet */
190 #define dev_to_vhdl(dev) 0
191 #define get_timestamp() 0
193 #define v_mapphys(a,b,c) 0 // printk("Fixme: v_mapphys - soft->base 0x%p\n", b);
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 *);
202 #endif /* _ASM_IA64_SN_SGI_H */