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  * This file is a bit of a dumping ground. A lot of things that don't really
12  * have a home, but which make life easier, end up here.
13  */
14 
15 #ifndef _ASM_IA64_SN_SGI_H
16 #define _ASM_IA64_SN_SGI_H
17 
18 #include <linux/config.h>
19 #include <asm/sn/types.h>
20 #include <linux/mm.h>
21 #include <linux/devfs_fs_kernel.h>
22 #ifdef CONFIG_HWGFS_FS
23 #include <linux/fs.h>
24 #include <asm/sn/hwgfs.h>
25 typedef hwgfs_handle_t vertex_hdl_t;
26 #else
27 typedef devfs_handle_t vertex_hdl_t;
28 #endif
29 
30 /* Nice general name length that lots of people like to use */
31 #ifndef MAXDEVNAME
32 #define MAXDEVNAME 256
33 #endif
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 CNODEID_NONE ((cnodeid_t)-1)
51 #define CPU_NONE		(-1)
52 
53 
54 /* print_register() defs */
55 
56 /*
57  * register values
58  * map between numeric values and symbolic values
59  */
60 struct reg_values {
61 	unsigned long long rv_value;
62 	char *rv_name;
63 };
64 
65 /*
66  * register descriptors are used for formatted prints of register values
67  * rd_mask and rd_shift must be defined, other entries may be null
68  */
69 struct reg_desc {
70 	unsigned long long rd_mask;	/* mask to extract field */
71 	int rd_shift;		/* shift for extracted value, - >>, + << */
72 	char *rd_name;		/* field name */
73 	char *rd_format;	/* format to print field */
74 	struct reg_values *rd_values;	/* symbolic names of values */
75 };
76 
77 extern void print_register(unsigned long long, struct reg_desc *);
78 
79 
80 /*
81  * No code is complete without an Assertion macro
82  */
83 
84 #if defined(DISABLE_ASSERT)
85 #define ASSERT(expr)
86 #define ASSERT_ALWAYS(expr)
87 #else
88 #define ASSERT(expr)  do {	\
89         if(!(expr)) { \
90 		printk( "Assertion [%s] failed! %s:%s(line=%d)\n",\
91 			#expr,__FILE__,__FUNCTION__,__LINE__); \
92 		panic("Assertion panic\n"); 	\
93         } } while(0)
94 
95 #define ASSERT_ALWAYS(expr)	do {\
96         if(!(expr)) { \
97 		printk( "Assertion [%s] failed! %s:%s(line=%d)\n",\
98 			#expr,__FILE__,__FUNCTION__,__LINE__); \
99 		panic("Assertion always panic\n"); 	\
100         } } while(0)
101 #endif	/* DISABLE_ASSERT */
102 
103 #endif /* _ASM_IA64_SN_SGI_H */
104