Linux 5.1.15
[linux/fpc-iii.git] / drivers / scsi / aic7xxx / aicasm / aicasm_symbol.h
blob7bf7fd5953ac97aeb767fa87249abed6e246d975
1 /*
2 * Aic7xxx SCSI host adapter firmware assembler symbol table definitions
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * Copyright (c) 2002 Adaptec Inc.
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions, and the following disclaimer,
13 * without modification.
14 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
15 * substantially similar to the "NO WARRANTY" disclaimer below
16 * ("Disclaimer") and any redistribution must be conditioned upon
17 * including a substantially similar Disclaimer requirement for further
18 * binary redistribution.
19 * 3. Neither the names of the above-listed copyright holders nor the names
20 * of any contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
23 * Alternatively, this software may be distributed under the terms of the
24 * GNU General Public License ("GPL") version 2 as published by the Free
25 * Software Foundation.
27 * NO WARRANTY
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
37 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGES.
40 * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_symbol.h#17 $
42 * $FreeBSD$
45 #include "../queue.h"
47 typedef enum {
48 UNINITIALIZED,
49 REGISTER,
50 ALIAS,
51 SCBLOC,
52 SRAMLOC,
53 ENUM_ENTRY,
54 FIELD,
55 MASK,
56 ENUM,
57 CONST,
58 DOWNLOAD_CONST,
59 LABEL,
60 CONDITIONAL,
61 MACRO
62 } symtype;
64 typedef enum {
65 RO = 0x01,
66 WO = 0x02,
67 RW = 0x03
68 }amode_t;
70 typedef SLIST_HEAD(symlist, symbol_node) symlist_t;
72 struct reg_info {
73 u_int address;
74 int size;
75 amode_t mode;
76 symlist_t fields;
77 uint8_t valid_bitmask;
78 uint8_t modes;
79 int typecheck_masks;
82 struct field_info {
83 symlist_t symrefs;
84 uint8_t value;
85 uint8_t mask;
88 struct const_info {
89 u_int value;
90 int define;
93 struct alias_info {
94 struct symbol *parent;
97 struct label_info {
98 int address;
99 int exported;
102 struct cond_info {
103 int func_num;
106 struct macro_arg {
107 STAILQ_ENTRY(macro_arg) links;
108 regex_t arg_regex;
109 char *replacement_text;
111 STAILQ_HEAD(macro_arg_list, macro_arg) args;
113 struct macro_info {
114 struct macro_arg_list args;
115 int narg;
116 const char* body;
119 typedef struct expression_info {
120 symlist_t referenced_syms;
121 int value;
122 } expression_t;
124 typedef struct symbol {
125 char *name;
126 symtype type;
127 int count;
128 union {
129 struct reg_info *rinfo;
130 struct field_info *finfo;
131 struct const_info *cinfo;
132 struct alias_info *ainfo;
133 struct label_info *linfo;
134 struct cond_info *condinfo;
135 struct macro_info *macroinfo;
136 } info;
137 int dont_generate_debug_code;
138 } symbol_t;
140 typedef struct symbol_ref {
141 symbol_t *symbol;
142 int offset;
143 } symbol_ref_t;
145 typedef struct symbol_node {
146 SLIST_ENTRY(symbol_node) links;
147 symbol_t *symbol;
148 } symbol_node_t;
150 typedef struct critical_section {
151 TAILQ_ENTRY(critical_section) links;
152 int begin_addr;
153 int end_addr;
154 } critical_section_t;
156 typedef enum {
157 SCOPE_ROOT,
158 SCOPE_IF,
159 SCOPE_ELSE_IF,
160 SCOPE_ELSE
161 } scope_type;
163 typedef struct patch_info {
164 int skip_patch;
165 int skip_instr;
166 } patch_info_t;
168 typedef struct scope {
169 SLIST_ENTRY(scope) scope_stack_links;
170 TAILQ_ENTRY(scope) scope_links;
171 TAILQ_HEAD(, scope) inner_scope;
172 scope_type type;
173 int inner_scope_patches;
174 int begin_addr;
175 int end_addr;
176 patch_info_t patches[2];
177 int func_num;
178 } scope_t;
180 TAILQ_HEAD(cs_tailq, critical_section);
181 SLIST_HEAD(scope_list, scope);
182 TAILQ_HEAD(scope_tailq, scope);
184 void symbol_delete(symbol_t *symbol);
186 void symtable_open(void);
188 void symtable_close(void);
190 symbol_t *
191 symtable_get(char *name);
193 symbol_node_t *
194 symlist_search(symlist_t *symlist, char *symname);
196 void
197 symlist_add(symlist_t *symlist, symbol_t *symbol, int how);
198 #define SYMLIST_INSERT_HEAD 0x00
199 #define SYMLIST_SORT 0x01
201 void symlist_free(symlist_t *symlist);
203 void symlist_merge(symlist_t *symlist_dest, symlist_t *symlist_src1,
204 symlist_t *symlist_src2);
205 void symtable_dump(FILE *ofile, FILE *dfile);