dtexpress.c revision 1.1.1.1.2.2 1 1.1.1.1.2.2 bouyer /******************************************************************************
2 1.1.1.1.2.2 bouyer *
3 1.1.1.1.2.2 bouyer * Module Name: dtexpress.c - Support for integer expressions and labels
4 1.1.1.1.2.2 bouyer *
5 1.1.1.1.2.2 bouyer *****************************************************************************/
6 1.1.1.1.2.2 bouyer
7 1.1.1.1.2.2 bouyer /*
8 1.1.1.1.2.2 bouyer * Copyright (C) 2000 - 2011, Intel Corp.
9 1.1.1.1.2.2 bouyer * All rights reserved.
10 1.1.1.1.2.2 bouyer *
11 1.1.1.1.2.2 bouyer * Redistribution and use in source and binary forms, with or without
12 1.1.1.1.2.2 bouyer * modification, are permitted provided that the following conditions
13 1.1.1.1.2.2 bouyer * are met:
14 1.1.1.1.2.2 bouyer * 1. Redistributions of source code must retain the above copyright
15 1.1.1.1.2.2 bouyer * notice, this list of conditions, and the following disclaimer,
16 1.1.1.1.2.2 bouyer * without modification.
17 1.1.1.1.2.2 bouyer * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.1.2.2 bouyer * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.1.2.2 bouyer * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.1.2.2 bouyer * including a substantially similar Disclaimer requirement for further
21 1.1.1.1.2.2 bouyer * binary redistribution.
22 1.1.1.1.2.2 bouyer * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.1.2.2 bouyer * of any contributors may be used to endorse or promote products derived
24 1.1.1.1.2.2 bouyer * from this software without specific prior written permission.
25 1.1.1.1.2.2 bouyer *
26 1.1.1.1.2.2 bouyer * Alternatively, this software may be distributed under the terms of the
27 1.1.1.1.2.2 bouyer * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.1.2.2 bouyer * Software Foundation.
29 1.1.1.1.2.2 bouyer *
30 1.1.1.1.2.2 bouyer * NO WARRANTY
31 1.1.1.1.2.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.1.2.2 bouyer * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.1.2.2 bouyer * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1.1.1.2.2 bouyer * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.1.2.2 bouyer * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.1.2.2 bouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.1.2.2 bouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.1.2.2 bouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.1.2.2 bouyer * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.1.2.2 bouyer * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.1.2.2 bouyer * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.1.2.2 bouyer */
43 1.1.1.1.2.2 bouyer
44 1.1.1.1.2.2 bouyer #define __DTEXPRESS_C__
45 1.1.1.1.2.2 bouyer
46 1.1.1.1.2.2 bouyer #include "aslcompiler.h"
47 1.1.1.1.2.2 bouyer #include "dtcompiler.h"
48 1.1.1.1.2.2 bouyer
49 1.1.1.1.2.2 bouyer #define _COMPONENT DT_COMPILER
50 1.1.1.1.2.2 bouyer ACPI_MODULE_NAME ("dtexpress")
51 1.1.1.1.2.2 bouyer
52 1.1.1.1.2.2 bouyer
53 1.1.1.1.2.2 bouyer /* Local prototypes */
54 1.1.1.1.2.2 bouyer
55 1.1.1.1.2.2 bouyer static UINT64
56 1.1.1.1.2.2 bouyer DtResolveInteger (
57 1.1.1.1.2.2 bouyer DT_FIELD *Field,
58 1.1.1.1.2.2 bouyer char *IntegerString);
59 1.1.1.1.2.2 bouyer
60 1.1.1.1.2.2 bouyer static void
61 1.1.1.1.2.2 bouyer DtInsertLabelField (
62 1.1.1.1.2.2 bouyer DT_FIELD *Field);
63 1.1.1.1.2.2 bouyer
64 1.1.1.1.2.2 bouyer static DT_FIELD *
65 1.1.1.1.2.2 bouyer DtLookupLabel (
66 1.1.1.1.2.2 bouyer char *Name);
67 1.1.1.1.2.2 bouyer
68 1.1.1.1.2.2 bouyer
69 1.1.1.1.2.2 bouyer /******************************************************************************
70 1.1.1.1.2.2 bouyer *
71 1.1.1.1.2.2 bouyer * FUNCTION: DtResolveIntegerExpression
72 1.1.1.1.2.2 bouyer *
73 1.1.1.1.2.2 bouyer * PARAMETERS: Field - Field object with Integer expression
74 1.1.1.1.2.2 bouyer *
75 1.1.1.1.2.2 bouyer * RETURN: A 64-bit integer value
76 1.1.1.1.2.2 bouyer *
77 1.1.1.1.2.2 bouyer * DESCRIPTION: Resolve an integer expression to a single value. Supports
78 1.1.1.1.2.2 bouyer * both integer constants and labels. Supported operators are:
79 1.1.1.1.2.2 bouyer * +,-,*,/,%,|,&,^
80 1.1.1.1.2.2 bouyer *
81 1.1.1.1.2.2 bouyer *****************************************************************************/
82 1.1.1.1.2.2 bouyer
83 1.1.1.1.2.2 bouyer UINT64
84 1.1.1.1.2.2 bouyer DtResolveIntegerExpression (
85 1.1.1.1.2.2 bouyer DT_FIELD *Field)
86 1.1.1.1.2.2 bouyer {
87 1.1.1.1.2.2 bouyer char *IntegerString;
88 1.1.1.1.2.2 bouyer char *Operator;
89 1.1.1.1.2.2 bouyer UINT64 Value;
90 1.1.1.1.2.2 bouyer UINT64 Value2;
91 1.1.1.1.2.2 bouyer
92 1.1.1.1.2.2 bouyer
93 1.1.1.1.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "Full Integer expression: %s\n",
94 1.1.1.1.2.2 bouyer Field->Value);
95 1.1.1.1.2.2 bouyer
96 1.1.1.1.2.2 bouyer strcpy (MsgBuffer, Field->Value); /* Must take a copy for strtok() */
97 1.1.1.1.2.2 bouyer
98 1.1.1.1.2.2 bouyer /* Obtain and resolve the first operand */
99 1.1.1.1.2.2 bouyer
100 1.1.1.1.2.2 bouyer IntegerString = strtok (MsgBuffer, " ");
101 1.1.1.1.2.2 bouyer if (!IntegerString)
102 1.1.1.1.2.2 bouyer {
103 1.1.1.1.2.2 bouyer DtError (ASL_ERROR, ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
104 1.1.1.1.2.2 bouyer return (0);
105 1.1.1.1.2.2 bouyer }
106 1.1.1.1.2.2 bouyer
107 1.1.1.1.2.2 bouyer Value = DtResolveInteger (Field, IntegerString);
108 1.1.1.1.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "Integer resolved to V1: %8.8X%8.8X\n",
109 1.1.1.1.2.2 bouyer ACPI_FORMAT_UINT64 (Value));
110 1.1.1.1.2.2 bouyer
111 1.1.1.1.2.2 bouyer /*
112 1.1.1.1.2.2 bouyer * Consume the entire expression string. For the rest of the
113 1.1.1.1.2.2 bouyer * expression string, values are of the form:
114 1.1.1.1.2.2 bouyer * <operator> <integer>
115 1.1.1.1.2.2 bouyer */
116 1.1.1.1.2.2 bouyer while (1)
117 1.1.1.1.2.2 bouyer {
118 1.1.1.1.2.2 bouyer Operator = strtok (NULL, " ");
119 1.1.1.1.2.2 bouyer if (!Operator)
120 1.1.1.1.2.2 bouyer {
121 1.1.1.1.2.2 bouyer /* Normal exit */
122 1.1.1.1.2.2 bouyer
123 1.1.1.1.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "Expression Resolved to: %8.8X%8.8X\n",
124 1.1.1.1.2.2 bouyer ACPI_FORMAT_UINT64 (Value));
125 1.1.1.1.2.2 bouyer
126 1.1.1.1.2.2 bouyer return (Value);
127 1.1.1.1.2.2 bouyer }
128 1.1.1.1.2.2 bouyer
129 1.1.1.1.2.2 bouyer IntegerString = strtok (NULL, " ");
130 1.1.1.1.2.2 bouyer if (!IntegerString ||
131 1.1.1.1.2.2 bouyer (strlen (Operator) > 1))
132 1.1.1.1.2.2 bouyer {
133 1.1.1.1.2.2 bouyer /* No corresponding operand for operator or invalid operator */
134 1.1.1.1.2.2 bouyer
135 1.1.1.1.2.2 bouyer DtError (ASL_ERROR, ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
136 1.1.1.1.2.2 bouyer return (0);
137 1.1.1.1.2.2 bouyer }
138 1.1.1.1.2.2 bouyer
139 1.1.1.1.2.2 bouyer Value2 = DtResolveInteger (Field, IntegerString);
140 1.1.1.1.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "Integer resolved to V2: %8.8X%8.8X\n",
141 1.1.1.1.2.2 bouyer ACPI_FORMAT_UINT64 (Value2));
142 1.1.1.1.2.2 bouyer
143 1.1.1.1.2.2 bouyer /* Perform the requested operation */
144 1.1.1.1.2.2 bouyer
145 1.1.1.1.2.2 bouyer switch (*Operator)
146 1.1.1.1.2.2 bouyer {
147 1.1.1.1.2.2 bouyer case '-':
148 1.1.1.1.2.2 bouyer Value -= Value2;
149 1.1.1.1.2.2 bouyer break;
150 1.1.1.1.2.2 bouyer
151 1.1.1.1.2.2 bouyer case '+':
152 1.1.1.1.2.2 bouyer Value += Value2;
153 1.1.1.1.2.2 bouyer break;
154 1.1.1.1.2.2 bouyer
155 1.1.1.1.2.2 bouyer case '*':
156 1.1.1.1.2.2 bouyer Value *= Value2;
157 1.1.1.1.2.2 bouyer break;
158 1.1.1.1.2.2 bouyer
159 1.1.1.1.2.2 bouyer case '|':
160 1.1.1.1.2.2 bouyer Value |= Value2;
161 1.1.1.1.2.2 bouyer break;
162 1.1.1.1.2.2 bouyer
163 1.1.1.1.2.2 bouyer case '&':
164 1.1.1.1.2.2 bouyer Value &= Value2;
165 1.1.1.1.2.2 bouyer break;
166 1.1.1.1.2.2 bouyer
167 1.1.1.1.2.2 bouyer case '^':
168 1.1.1.1.2.2 bouyer Value ^= Value2;
169 1.1.1.1.2.2 bouyer break;
170 1.1.1.1.2.2 bouyer
171 1.1.1.1.2.2 bouyer case '/':
172 1.1.1.1.2.2 bouyer if (!Value2)
173 1.1.1.1.2.2 bouyer {
174 1.1.1.1.2.2 bouyer DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, Field, Field->Value);
175 1.1.1.1.2.2 bouyer return (0);
176 1.1.1.1.2.2 bouyer }
177 1.1.1.1.2.2 bouyer Value /= Value2;
178 1.1.1.1.2.2 bouyer break;
179 1.1.1.1.2.2 bouyer
180 1.1.1.1.2.2 bouyer case '%':
181 1.1.1.1.2.2 bouyer if (!Value2)
182 1.1.1.1.2.2 bouyer {
183 1.1.1.1.2.2 bouyer DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, Field, Field->Value);
184 1.1.1.1.2.2 bouyer return (0);
185 1.1.1.1.2.2 bouyer }
186 1.1.1.1.2.2 bouyer Value %= Value2;
187 1.1.1.1.2.2 bouyer break;
188 1.1.1.1.2.2 bouyer
189 1.1.1.1.2.2 bouyer default:
190 1.1.1.1.2.2 bouyer
191 1.1.1.1.2.2 bouyer /* Unknown operator */
192 1.1.1.1.2.2 bouyer
193 1.1.1.1.2.2 bouyer DtFatal (ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
194 1.1.1.1.2.2 bouyer break;
195 1.1.1.1.2.2 bouyer }
196 1.1.1.1.2.2 bouyer }
197 1.1.1.1.2.2 bouyer
198 1.1.1.1.2.2 bouyer return (Value);
199 1.1.1.1.2.2 bouyer }
200 1.1.1.1.2.2 bouyer
201 1.1.1.1.2.2 bouyer
202 1.1.1.1.2.2 bouyer /******************************************************************************
203 1.1.1.1.2.2 bouyer *
204 1.1.1.1.2.2 bouyer * FUNCTION: DtResolveInteger
205 1.1.1.1.2.2 bouyer *
206 1.1.1.1.2.2 bouyer * PARAMETERS: Field - Field object with string to be resolved
207 1.1.1.1.2.2 bouyer * IntegerString - Integer to be resolved
208 1.1.1.1.2.2 bouyer *
209 1.1.1.1.2.2 bouyer * RETURN: A 64-bit integer value
210 1.1.1.1.2.2 bouyer *
211 1.1.1.1.2.2 bouyer * DESCRIPTION: Resolve a single integer string to a value. Supports both
212 1.1.1.1.2.2 bouyer * integer constants and labels.
213 1.1.1.1.2.2 bouyer *
214 1.1.1.1.2.2 bouyer * NOTE: References to labels must begin with a dollar sign ($)
215 1.1.1.1.2.2 bouyer *
216 1.1.1.1.2.2 bouyer *****************************************************************************/
217 1.1.1.1.2.2 bouyer
218 1.1.1.1.2.2 bouyer static UINT64
219 1.1.1.1.2.2 bouyer DtResolveInteger (
220 1.1.1.1.2.2 bouyer DT_FIELD *Field,
221 1.1.1.1.2.2 bouyer char *IntegerString)
222 1.1.1.1.2.2 bouyer {
223 1.1.1.1.2.2 bouyer DT_FIELD *LabelField;
224 1.1.1.1.2.2 bouyer UINT64 Value = 0;
225 1.1.1.1.2.2 bouyer char *Message = NULL;
226 1.1.1.1.2.2 bouyer ACPI_STATUS Status;
227 1.1.1.1.2.2 bouyer
228 1.1.1.1.2.2 bouyer
229 1.1.1.1.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT, "Resolve Integer: %s\n", IntegerString);
230 1.1.1.1.2.2 bouyer
231 1.1.1.1.2.2 bouyer /* Resolve a label reference to an integer (table offset) */
232 1.1.1.1.2.2 bouyer
233 1.1.1.1.2.2 bouyer if (*IntegerString == '$')
234 1.1.1.1.2.2 bouyer {
235 1.1.1.1.2.2 bouyer LabelField = DtLookupLabel (IntegerString);
236 1.1.1.1.2.2 bouyer if (!LabelField)
237 1.1.1.1.2.2 bouyer {
238 1.1.1.1.2.2 bouyer DtError (ASL_ERROR, ASL_MSG_UNKNOWN_LABEL, Field, IntegerString);
239 1.1.1.1.2.2 bouyer return (0);
240 1.1.1.1.2.2 bouyer }
241 1.1.1.1.2.2 bouyer
242 1.1.1.1.2.2 bouyer /* All we need from the label is the offset in the table */
243 1.1.1.1.2.2 bouyer
244 1.1.1.1.2.2 bouyer Value = LabelField->TableOffset;
245 1.1.1.1.2.2 bouyer return (Value);
246 1.1.1.1.2.2 bouyer }
247 1.1.1.1.2.2 bouyer
248 1.1.1.1.2.2 bouyer /* Convert string to an actual integer */
249 1.1.1.1.2.2 bouyer
250 1.1.1.1.2.2 bouyer Status = DtStrtoul64 (IntegerString, &Value);
251 1.1.1.1.2.2 bouyer if (ACPI_FAILURE (Status))
252 1.1.1.1.2.2 bouyer {
253 1.1.1.1.2.2 bouyer if (Status == AE_LIMIT)
254 1.1.1.1.2.2 bouyer {
255 1.1.1.1.2.2 bouyer Message = "Constant larger than 64 bits";
256 1.1.1.1.2.2 bouyer }
257 1.1.1.1.2.2 bouyer else if (Status == AE_BAD_CHARACTER)
258 1.1.1.1.2.2 bouyer {
259 1.1.1.1.2.2 bouyer Message = "Invalid character in constant";
260 1.1.1.1.2.2 bouyer }
261 1.1.1.1.2.2 bouyer
262 1.1.1.1.2.2 bouyer DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, Message);
263 1.1.1.1.2.2 bouyer }
264 1.1.1.1.2.2 bouyer
265 1.1.1.1.2.2 bouyer return (Value);
266 1.1.1.1.2.2 bouyer }
267 1.1.1.1.2.2 bouyer
268 1.1.1.1.2.2 bouyer
269 1.1.1.1.2.2 bouyer /******************************************************************************
270 1.1.1.1.2.2 bouyer *
271 1.1.1.1.2.2 bouyer * FUNCTION: DtDetectAllLabels
272 1.1.1.1.2.2 bouyer *
273 1.1.1.1.2.2 bouyer * PARAMETERS: FieldList - Field object at start of generic list
274 1.1.1.1.2.2 bouyer *
275 1.1.1.1.2.2 bouyer * RETURN: None
276 1.1.1.1.2.2 bouyer *
277 1.1.1.1.2.2 bouyer * DESCRIPTION: Detect all labels in a list of "generic" opcodes (such as
278 1.1.1.1.2.2 bouyer * a UEFI table.) and insert them into the global label list.
279 1.1.1.1.2.2 bouyer *
280 1.1.1.1.2.2 bouyer *****************************************************************************/
281 1.1.1.1.2.2 bouyer
282 1.1.1.1.2.2 bouyer void
283 1.1.1.1.2.2 bouyer DtDetectAllLabels (
284 1.1.1.1.2.2 bouyer DT_FIELD *FieldList)
285 1.1.1.1.2.2 bouyer {
286 1.1.1.1.2.2 bouyer ACPI_DMTABLE_INFO *Info;
287 1.1.1.1.2.2 bouyer DT_FIELD *GenericField;
288 1.1.1.1.2.2 bouyer UINT32 TableOffset;
289 1.1.1.1.2.2 bouyer
290 1.1.1.1.2.2 bouyer
291 1.1.1.1.2.2 bouyer TableOffset = Gbl_CurrentTableOffset;
292 1.1.1.1.2.2 bouyer GenericField = FieldList;
293 1.1.1.1.2.2 bouyer
294 1.1.1.1.2.2 bouyer /*
295 1.1.1.1.2.2 bouyer * Process all "Label:" fields within the parse tree. We need
296 1.1.1.1.2.2 bouyer * to know the offsets for all labels before we can compile
297 1.1.1.1.2.2 bouyer * the parse tree in order to handle forward references. Traverse
298 1.1.1.1.2.2 bouyer * tree and get/set all field lengths of all operators in order to
299 1.1.1.1.2.2 bouyer * determine the label offsets.
300 1.1.1.1.2.2 bouyer */
301 1.1.1.1.2.2 bouyer while (GenericField)
302 1.1.1.1.2.2 bouyer {
303 1.1.1.1.2.2 bouyer Info = DtGetGenericTableInfo (GenericField->Name);
304 1.1.1.1.2.2 bouyer if (Info)
305 1.1.1.1.2.2 bouyer {
306 1.1.1.1.2.2 bouyer /* Maintain table offsets */
307 1.1.1.1.2.2 bouyer
308 1.1.1.1.2.2 bouyer GenericField->TableOffset = TableOffset;
309 1.1.1.1.2.2 bouyer TableOffset += DtGetFieldLength (GenericField, Info);
310 1.1.1.1.2.2 bouyer
311 1.1.1.1.2.2 bouyer /* Insert all labels in the global label list */
312 1.1.1.1.2.2 bouyer
313 1.1.1.1.2.2 bouyer if (Info->Opcode == ACPI_DMT_LABEL)
314 1.1.1.1.2.2 bouyer {
315 1.1.1.1.2.2 bouyer DtInsertLabelField (GenericField);
316 1.1.1.1.2.2 bouyer }
317 1.1.1.1.2.2 bouyer }
318 1.1.1.1.2.2 bouyer
319 1.1.1.1.2.2 bouyer GenericField = GenericField->Next;
320 1.1.1.1.2.2 bouyer }
321 1.1.1.1.2.2 bouyer }
322 1.1.1.1.2.2 bouyer
323 1.1.1.1.2.2 bouyer
324 1.1.1.1.2.2 bouyer /******************************************************************************
325 1.1.1.1.2.2 bouyer *
326 1.1.1.1.2.2 bouyer * FUNCTION: DtInsertLabelField
327 1.1.1.1.2.2 bouyer *
328 1.1.1.1.2.2 bouyer * PARAMETERS: Field - Field object with Label to be inserted
329 1.1.1.1.2.2 bouyer *
330 1.1.1.1.2.2 bouyer * RETURN: None
331 1.1.1.1.2.2 bouyer *
332 1.1.1.1.2.2 bouyer * DESCRIPTION: Insert a label field into the global label list
333 1.1.1.1.2.2 bouyer *
334 1.1.1.1.2.2 bouyer *****************************************************************************/
335 1.1.1.1.2.2 bouyer
336 1.1.1.1.2.2 bouyer static void
337 1.1.1.1.2.2 bouyer DtInsertLabelField (
338 1.1.1.1.2.2 bouyer DT_FIELD *Field)
339 1.1.1.1.2.2 bouyer {
340 1.1.1.1.2.2 bouyer
341 1.1.1.1.2.2 bouyer DbgPrint (ASL_DEBUG_OUTPUT,
342 1.1.1.1.2.2 bouyer "DtInsertLabelField: Found Label : %s at output table offset %X\n",
343 1.1.1.1.2.2 bouyer Field->Value, Field->TableOffset);
344 1.1.1.1.2.2 bouyer
345 1.1.1.1.2.2 bouyer Field->NextLabel = Gbl_LabelList;
346 1.1.1.1.2.2 bouyer Gbl_LabelList = Field;
347 1.1.1.1.2.2 bouyer }
348 1.1.1.1.2.2 bouyer
349 1.1.1.1.2.2 bouyer
350 1.1.1.1.2.2 bouyer /******************************************************************************
351 1.1.1.1.2.2 bouyer *
352 1.1.1.1.2.2 bouyer * FUNCTION: DtLookupLabel
353 1.1.1.1.2.2 bouyer *
354 1.1.1.1.2.2 bouyer * PARAMETERS: Name - Label to be resolved
355 1.1.1.1.2.2 bouyer *
356 1.1.1.1.2.2 bouyer * RETURN: Field object associated with the label
357 1.1.1.1.2.2 bouyer *
358 1.1.1.1.2.2 bouyer * DESCRIPTION: Lookup a label in the global label list. Used during the
359 1.1.1.1.2.2 bouyer * resolution of integer expressions.
360 1.1.1.1.2.2 bouyer *
361 1.1.1.1.2.2 bouyer *****************************************************************************/
362 1.1.1.1.2.2 bouyer
363 1.1.1.1.2.2 bouyer static DT_FIELD *
364 1.1.1.1.2.2 bouyer DtLookupLabel (
365 1.1.1.1.2.2 bouyer char *Name)
366 1.1.1.1.2.2 bouyer {
367 1.1.1.1.2.2 bouyer DT_FIELD *LabelField;
368 1.1.1.1.2.2 bouyer
369 1.1.1.1.2.2 bouyer
370 1.1.1.1.2.2 bouyer /* Skip a leading $ */
371 1.1.1.1.2.2 bouyer
372 1.1.1.1.2.2 bouyer if (*Name == '$')
373 1.1.1.1.2.2 bouyer {
374 1.1.1.1.2.2 bouyer Name++;
375 1.1.1.1.2.2 bouyer }
376 1.1.1.1.2.2 bouyer
377 1.1.1.1.2.2 bouyer /* Search global list */
378 1.1.1.1.2.2 bouyer
379 1.1.1.1.2.2 bouyer LabelField = Gbl_LabelList;
380 1.1.1.1.2.2 bouyer while (LabelField)
381 1.1.1.1.2.2 bouyer {
382 1.1.1.1.2.2 bouyer if (!ACPI_STRCMP (Name, LabelField->Value))
383 1.1.1.1.2.2 bouyer {
384 1.1.1.1.2.2 bouyer return (LabelField);
385 1.1.1.1.2.2 bouyer }
386 1.1.1.1.2.2 bouyer LabelField = LabelField->NextLabel;
387 1.1.1.1.2.2 bouyer }
388 1.1.1.1.2.2 bouyer
389 1.1.1.1.2.2 bouyer return (NULL);
390 1.1.1.1.2.2 bouyer }
391