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>
21 #include <asm/sn/hwgfs.h>
23 typedef hwgfs_handle_t vertex_hdl_t;
25 typedef int64_t __psint_t; /* needed by klgraph.c */
27 typedef enum { B_FALSE, B_TRUE } boolean_t;
31 ** Possible return values from graph routines.
33 typedef enum graph_error_e {
34 GRAPH_SUCCESS, /* 0 */
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 */
44 #define KM_SLEEP 0x0000
45 #define KM_NOSLEEP 0x0001 /* needed by kmem_alloc_node(), kmem_zalloc()
47 #define VM_NOSLEEP 0x0001 /* needed kmem_alloc_node(), kmem_zalloc_node
49 #define XG_WIDGET_PART_NUM 0xC102 /* KONA/xt_regs.h XG_XT_PART_NUM_VALUE */
51 typedef uint64_t vhandl_t;
54 #define NBPP PAGE_SIZE
55 #define _PAGESZ PAGE_SIZE
58 #define MAXDEVNAME 256
61 #define HUB_PIO_CONVEYOR 0x1
62 #define CNODEID_NONE ((cnodeid_t)-1)
63 #define XTALK_PCI_PART_NUM "030-1275-"
67 #define COPYIN(a, b, c) copy_from_user(b,a,c)
68 #define COPYOUT(a, b, c) copy_to_user(b,a,c)
70 #define BZERO(a,b) memset(a, 0, b)
72 #define kern_malloc(x) kmalloc(x, GFP_KERNEL)
73 #define kern_free(x) kfree(x)
75 typedef cpuid_t cpu_cookie_t;
79 * mutext support mapping
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);
90 // #define mutex_spinunlock(s,t) spin_unlock_irqrestore(s,t)
91 #define mutex_spinunlock(s,t) spin_unlock(s)
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)
100 #define io_splock(s) mutex_spinlock(s)
101 #define io_spunlock(s,t) spin_unlock(s)
103 #define spin_lock_destroy(s)
105 #if defined(DISABLE_ASSERT)
107 #define ASSERT_ALWAYS(expr)
109 #define ASSERT(expr) do { \
111 printk( "Assertion [%s] failed! %s:%s(line=%d)\n",\
112 #expr,__FILE__,__FUNCTION__,__LINE__); \
113 panic("Assertion panic\n"); \
116 #define ASSERT_ALWAYS(expr) do {\
118 printk( "Assertion [%s] failed! %s:%s(line=%d)\n",\
119 #expr,__FILE__,__FUNCTION__,__LINE__); \
120 panic("Assertion always panic\n"); \
122 #endif /* DISABLE_ASSERT */
124 #define PRINT_PANIC panic
126 /* print_register() defs */
130 * map between numeric values and symbolic values
133 unsigned long long rv_value;
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
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 */
149 extern void print_register(unsigned long long, struct reg_desc *);
151 /******************************************
152 * Definitions that do not exist in linux *
153 ******************************************/
157 /************************************************
158 * Routines redefined to use linux equivalents. *
159 ************************************************/
161 /* #define FIXME(s) printk("FIXME: [ %s ] in %s at %s:%d\n", s, __FUNCTION__, __FILE__, __LINE__) */
165 /* move to stubs.c yet */
166 #define dev_to_vhdl(dev) 0
167 #define get_timestamp() 0
169 #define v_mapphys(a,b,c) 0 // printk("Fixme: v_mapphys - soft->base 0x%p\n", b);
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 *);
178 #endif /* _ASM_IA64_SN_SGI_H */