added a lot of printk output to ease writing of emulator
[linux-2.4.21-pre4.git] / include / asm-ia64 / sn / labelcl.h
1 /* $Id: labelcl.h,v 1.1.1.1 2005/04/11 02:50:52 jack Exp $
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) 1992 - 1997, 2000-2002 Silicon Graphics, Inc. All rights reserved.
8  */
9 #ifndef _ASM_IA64_SN_LABELCL_H
10 #define _ASM_IA64_SN_LABELCL_H
11
12 #include <asm/sn/hcl.h>
13
14 #define LABELCL_MAGIC 0x4857434c        /* 'HWLC' */
15 #define LABEL_LENGTH_MAX 256            /* Includes NULL char */
16 #define INFO_DESC_PRIVATE (-1)          /* default */
17 #define INFO_DESC_EXPORT  0             /* export info itself */
18
19 /*
20  * Internal Error codes.
21  */
22 typedef enum labelcl_error_e {  LABELCL_SUCCESS,          /* 0 */
23                                 LABELCL_DUP,              /* 1 */
24                                 LABELCL_NOT_FOUND,        /* 2 */
25                                 LABELCL_BAD_PARAM,        /* 3 */
26                                 LABELCL_HIT_LIMIT,        /* 4 */
27                                 LABELCL_CANNOT_ALLOC,     /* 5 */
28                                 LABELCL_ILLEGAL_REQUEST,  /* 6 */
29                                 LABELCL_IN_USE            /* 7 */
30                                 } labelcl_error_t;
31
32
33 /*
34  * Description of a label entry.
35  */
36 typedef struct label_info_s {
37         char                    *name;
38         arb_info_desc_t         desc;
39         arbitrary_info_t        info;
40 } label_info_t;
41
42 /*
43  * Definition of the data structure that provides the link to 
44  * the hwgraph fastinfo and the label entries associated with a 
45  * particular devfs entry.
46  */
47 typedef struct labelcl_info_s {
48         unsigned long   hwcl_magic;
49         unsigned long   num_labels;
50         void            *label_list;
51         arbitrary_info_t IDX_list[HWGRAPH_NUM_INDEX_INFO];
52 } labelcl_info_t;
53
54 /*
55  * Definitions for the string table that holds the actual names 
56  * of the labels.
57  */
58 struct string_table_item {
59         struct string_table_item        *next;
60         char                            string[1];
61 };
62
63 struct string_table {
64         struct string_table_item        *string_table_head;
65         long                            string_table_generation;
66 };
67
68
69 #define STRTBL_BASIC_SIZE ((size_t)(((struct string_table_item *)0)->string))
70 #define STRTBL_ITEM_SIZE(str_length) (STRTBL_BASIC_SIZE + (str_length) + 1)
71
72 #define STRTBL_ALLOC(str_length) \
73         ((struct string_table_item *)kmalloc(STRTBL_ITEM_SIZE(str_length), GFP_KERNEL))
74
75 #define STRTBL_FREE(ptr) kfree(ptr)
76
77
78 extern labelcl_info_t *labelcl_info_create(void);
79 extern int labelcl_info_destroy(labelcl_info_t *);
80 extern int labelcl_info_add_LBL(struct devfs_entry *, char *, arb_info_desc_t, arbitrary_info_t);
81 extern int labelcl_info_remove_LBL(struct devfs_entry *, char *, arb_info_desc_t *, arbitrary_info_t *);
82 extern int labelcl_info_replace_LBL(struct devfs_entry *, char *, arb_info_desc_t,
83                         arbitrary_info_t, arb_info_desc_t *, arbitrary_info_t *);
84 extern int labelcl_info_get_LBL(struct devfs_entry *, char *, arb_info_desc_t *,
85                       arbitrary_info_t *);
86 extern int labelcl_info_get_next_LBL(struct devfs_entry *, char *, arb_info_desc_t *,
87                            arbitrary_info_t *, labelcl_info_place_t *);
88 extern int labelcl_info_replace_IDX(struct devfs_entry *, int, arbitrary_info_t, 
89                         arbitrary_info_t *);
90 extern int labelcl_info_connectpt_set(struct devfs_entry *, struct devfs_entry *);
91 extern int labelcl_info_get_IDX(struct devfs_entry *, int, arbitrary_info_t *);
92 extern struct devfs_entry *device_info_connectpt_get(struct devfs_entry *);
93
94 #endif /* _ASM_IA64_SN_LABELCL_H */