aslpredef.c revision 1.1.1.2.2.2 1 1.1.1.2.2.2 bouyer /******************************************************************************
2 1.1.1.2.2.2 bouyer *
3 1.1.1.2.2.2 bouyer * Module Name: aslpredef - support for ACPI predefined names
4 1.1.1.2.2.2 bouyer *
5 1.1.1.2.2.2 bouyer *****************************************************************************/
6 1.1.1.2.2.2 bouyer
7 1.1.1.2.2.2 bouyer /*
8 1.1.1.2.2.2 bouyer * Copyright (C) 2000 - 2011, Intel Corp.
9 1.1.1.2.2.2 bouyer * All rights reserved.
10 1.1.1.2.2.2 bouyer *
11 1.1.1.2.2.2 bouyer * Redistribution and use in source and binary forms, with or without
12 1.1.1.2.2.2 bouyer * modification, are permitted provided that the following conditions
13 1.1.1.2.2.2 bouyer * are met:
14 1.1.1.2.2.2 bouyer * 1. Redistributions of source code must retain the above copyright
15 1.1.1.2.2.2 bouyer * notice, this list of conditions, and the following disclaimer,
16 1.1.1.2.2.2 bouyer * without modification.
17 1.1.1.2.2.2 bouyer * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.2.2.2 bouyer * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.2.2.2 bouyer * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.2.2.2 bouyer * including a substantially similar Disclaimer requirement for further
21 1.1.1.2.2.2 bouyer * binary redistribution.
22 1.1.1.2.2.2 bouyer * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.2.2.2 bouyer * of any contributors may be used to endorse or promote products derived
24 1.1.1.2.2.2 bouyer * from this software without specific prior written permission.
25 1.1.1.2.2.2 bouyer *
26 1.1.1.2.2.2 bouyer * Alternatively, this software may be distributed under the terms of the
27 1.1.1.2.2.2 bouyer * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.2.2.2 bouyer * Software Foundation.
29 1.1.1.2.2.2 bouyer *
30 1.1.1.2.2.2 bouyer * NO WARRANTY
31 1.1.1.2.2.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.2.2.2 bouyer * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.2.2.2 bouyer * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1.1.2.2.2 bouyer * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.2.2.2 bouyer * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.2.2.2 bouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.2.2.2 bouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.2.2.2 bouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.2.2.2 bouyer * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.2.2.2 bouyer * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.2.2.2 bouyer * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.2.2.2 bouyer */
43 1.1.1.2.2.2 bouyer
44 1.1.1.2.2.2 bouyer #define ACPI_CREATE_PREDEFINED_TABLE
45 1.1.1.2.2.2 bouyer
46 1.1.1.2.2.2 bouyer #include "aslcompiler.h"
47 1.1.1.2.2.2 bouyer #include "aslcompiler.y.h"
48 1.1.1.2.2.2 bouyer #include "acpredef.h"
49 1.1.1.2.2.2 bouyer
50 1.1.1.2.2.2 bouyer
51 1.1.1.2.2.2 bouyer #define _COMPONENT ACPI_COMPILER
52 1.1.1.2.2.2 bouyer ACPI_MODULE_NAME ("aslpredef")
53 1.1.1.2.2.2 bouyer
54 1.1.1.2.2.2 bouyer
55 1.1.1.2.2.2 bouyer /* Local prototypes */
56 1.1.1.2.2.2 bouyer
57 1.1.1.2.2.2 bouyer static void
58 1.1.1.2.2.2 bouyer ApCheckForUnexpectedReturnValue (
59 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
60 1.1.1.2.2.2 bouyer ASL_METHOD_INFO *MethodInfo);
61 1.1.1.2.2.2 bouyer
62 1.1.1.2.2.2 bouyer static UINT32
63 1.1.1.2.2.2 bouyer ApCheckForSpecialName (
64 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
65 1.1.1.2.2.2 bouyer char *Name);
66 1.1.1.2.2.2 bouyer
67 1.1.1.2.2.2 bouyer static void
68 1.1.1.2.2.2 bouyer ApCheckObjectType (
69 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
70 1.1.1.2.2.2 bouyer UINT32 ExpectedBtypes);
71 1.1.1.2.2.2 bouyer
72 1.1.1.2.2.2 bouyer static void
73 1.1.1.2.2.2 bouyer ApGetExpectedTypes (
74 1.1.1.2.2.2 bouyer char *Buffer,
75 1.1.1.2.2.2 bouyer UINT32 ExpectedBtypes);
76 1.1.1.2.2.2 bouyer
77 1.1.1.2.2.2 bouyer
78 1.1.1.2.2.2 bouyer /*
79 1.1.1.2.2.2 bouyer * Names for the types that can be returned by the predefined objects.
80 1.1.1.2.2.2 bouyer * Used for warning messages. Must be in the same order as the ACPI_RTYPEs
81 1.1.1.2.2.2 bouyer */
82 1.1.1.2.2.2 bouyer static const char *AcpiRtypeNames[] =
83 1.1.1.2.2.2 bouyer {
84 1.1.1.2.2.2 bouyer "/Integer",
85 1.1.1.2.2.2 bouyer "/String",
86 1.1.1.2.2.2 bouyer "/Buffer",
87 1.1.1.2.2.2 bouyer "/Package",
88 1.1.1.2.2.2 bouyer "/Reference",
89 1.1.1.2.2.2 bouyer };
90 1.1.1.2.2.2 bouyer
91 1.1.1.2.2.2 bouyer /*
92 1.1.1.2.2.2 bouyer * Predefined names for use in Resource Descriptors. These names do not
93 1.1.1.2.2.2 bouyer * appear in the global Predefined Name table (since these names never
94 1.1.1.2.2.2 bouyer * appear in actual AML byte code, only in the original ASL)
95 1.1.1.2.2.2 bouyer */
96 1.1.1.2.2.2 bouyer static const ACPI_PREDEFINED_INFO ResourceNames[] = {
97 1.1.1.2.2.2 bouyer {{"_ALN", 0, 0}},
98 1.1.1.2.2.2 bouyer {{"_ASI", 0, 0}},
99 1.1.1.2.2.2 bouyer {{"_ASZ", 0, 0}},
100 1.1.1.2.2.2 bouyer {{"_ATT", 0, 0}},
101 1.1.1.2.2.2 bouyer {{"_BAS", 0, 0}},
102 1.1.1.2.2.2 bouyer {{"_BM_", 0, 0}},
103 1.1.1.2.2.2 bouyer {{"_DEC", 0, 0}},
104 1.1.1.2.2.2 bouyer {{"_GRA", 0, 0}},
105 1.1.1.2.2.2 bouyer {{"_HE_", 0, 0}},
106 1.1.1.2.2.2 bouyer {{"_INT", 0, 0}},
107 1.1.1.2.2.2 bouyer {{"_LEN", 0, 0}},
108 1.1.1.2.2.2 bouyer {{"_LL_", 0, 0}},
109 1.1.1.2.2.2 bouyer {{"_MAF", 0, 0}},
110 1.1.1.2.2.2 bouyer {{"_MAX", 0, 0}},
111 1.1.1.2.2.2 bouyer {{"_MEM", 0, 0}},
112 1.1.1.2.2.2 bouyer {{"_MIF", 0, 0}},
113 1.1.1.2.2.2 bouyer {{"_MIN", 0, 0}},
114 1.1.1.2.2.2 bouyer {{"_MTP", 0, 0}},
115 1.1.1.2.2.2 bouyer {{"_RBO", 0, 0}},
116 1.1.1.2.2.2 bouyer {{"_RBW", 0, 0}},
117 1.1.1.2.2.2 bouyer {{"_RNG", 0, 0}},
118 1.1.1.2.2.2 bouyer {{"_RT_", 0, 0}}, /* Acpi 3.0 */
119 1.1.1.2.2.2 bouyer {{"_RW_", 0, 0}},
120 1.1.1.2.2.2 bouyer {{"_SHR", 0, 0}},
121 1.1.1.2.2.2 bouyer {{"_SIZ", 0, 0}},
122 1.1.1.2.2.2 bouyer {{"_TRA", 0, 0}},
123 1.1.1.2.2.2 bouyer {{"_TRS", 0, 0}},
124 1.1.1.2.2.2 bouyer {{"_TSF", 0, 0}}, /* Acpi 3.0 */
125 1.1.1.2.2.2 bouyer {{"_TTP", 0, 0}},
126 1.1.1.2.2.2 bouyer {{"_TYP", 0, 0}},
127 1.1.1.2.2.2 bouyer {{{0,0,0,0}, 0, 0}} /* Table terminator */
128 1.1.1.2.2.2 bouyer };
129 1.1.1.2.2.2 bouyer
130 1.1.1.2.2.2 bouyer static const ACPI_PREDEFINED_INFO ScopeNames[] = {
131 1.1.1.2.2.2 bouyer {{"_SB_", 0, 0}},
132 1.1.1.2.2.2 bouyer {{"_SI_", 0, 0}},
133 1.1.1.2.2.2 bouyer {{"_TZ_", 0, 0}},
134 1.1.1.2.2.2 bouyer {{{0,0,0,0}, 0, 0}} /* Table terminator */
135 1.1.1.2.2.2 bouyer };
136 1.1.1.2.2.2 bouyer
137 1.1.1.2.2.2 bouyer
138 1.1.1.2.2.2 bouyer /*******************************************************************************
139 1.1.1.2.2.2 bouyer *
140 1.1.1.2.2.2 bouyer * FUNCTION: ApCheckForPredefinedMethod
141 1.1.1.2.2.2 bouyer *
142 1.1.1.2.2.2 bouyer * PARAMETERS: Op - A parse node of type "METHOD".
143 1.1.1.2.2.2 bouyer * MethodInfo - Saved info about this method
144 1.1.1.2.2.2 bouyer *
145 1.1.1.2.2.2 bouyer * RETURN: None
146 1.1.1.2.2.2 bouyer *
147 1.1.1.2.2.2 bouyer * DESCRIPTION: If method is a predefined name, check that the number of
148 1.1.1.2.2.2 bouyer * arguments and the return type (returns a value or not)
149 1.1.1.2.2.2 bouyer * is correct.
150 1.1.1.2.2.2 bouyer *
151 1.1.1.2.2.2 bouyer ******************************************************************************/
152 1.1.1.2.2.2 bouyer
153 1.1.1.2.2.2 bouyer void
154 1.1.1.2.2.2 bouyer ApCheckForPredefinedMethod (
155 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
156 1.1.1.2.2.2 bouyer ASL_METHOD_INFO *MethodInfo)
157 1.1.1.2.2.2 bouyer {
158 1.1.1.2.2.2 bouyer UINT32 Index;
159 1.1.1.2.2.2 bouyer UINT32 RequiredArgsCurrent;
160 1.1.1.2.2.2 bouyer UINT32 RequiredArgsOld;
161 1.1.1.2.2.2 bouyer
162 1.1.1.2.2.2 bouyer
163 1.1.1.2.2.2 bouyer /* Check for a match against the predefined name list */
164 1.1.1.2.2.2 bouyer
165 1.1.1.2.2.2 bouyer Index = ApCheckForPredefinedName (Op, Op->Asl.NameSeg);
166 1.1.1.2.2.2 bouyer
167 1.1.1.2.2.2 bouyer switch (Index)
168 1.1.1.2.2.2 bouyer {
169 1.1.1.2.2.2 bouyer case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
170 1.1.1.2.2.2 bouyer case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
171 1.1.1.2.2.2 bouyer case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
172 1.1.1.2.2.2 bouyer
173 1.1.1.2.2.2 bouyer /* Just return, nothing to do */
174 1.1.1.2.2.2 bouyer break;
175 1.1.1.2.2.2 bouyer
176 1.1.1.2.2.2 bouyer
177 1.1.1.2.2.2 bouyer case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
178 1.1.1.2.2.2 bouyer
179 1.1.1.2.2.2 bouyer Gbl_ReservedMethods++;
180 1.1.1.2.2.2 bouyer
181 1.1.1.2.2.2 bouyer /* NumArguments must be zero for all _Lxx/_Exx/_Wxx/_Qxx methods */
182 1.1.1.2.2.2 bouyer
183 1.1.1.2.2.2 bouyer if (MethodInfo->NumArguments != 0)
184 1.1.1.2.2.2 bouyer {
185 1.1.1.2.2.2 bouyer sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName, 0);
186 1.1.1.2.2.2 bouyer
187 1.1.1.2.2.2 bouyer AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
188 1.1.1.2.2.2 bouyer MsgBuffer);
189 1.1.1.2.2.2 bouyer }
190 1.1.1.2.2.2 bouyer break;
191 1.1.1.2.2.2 bouyer
192 1.1.1.2.2.2 bouyer
193 1.1.1.2.2.2 bouyer default:
194 1.1.1.2.2.2 bouyer /*
195 1.1.1.2.2.2 bouyer * Matched a predefined method name
196 1.1.1.2.2.2 bouyer *
197 1.1.1.2.2.2 bouyer * Validate the ASL-defined argument count. Allow two different legal
198 1.1.1.2.2.2 bouyer * arg counts.
199 1.1.1.2.2.2 bouyer */
200 1.1.1.2.2.2 bouyer Gbl_ReservedMethods++;
201 1.1.1.2.2.2 bouyer
202 1.1.1.2.2.2 bouyer RequiredArgsCurrent = PredefinedNames[Index].Info.ParamCount & 0x0F;
203 1.1.1.2.2.2 bouyer RequiredArgsOld = PredefinedNames[Index].Info.ParamCount >> 4;
204 1.1.1.2.2.2 bouyer
205 1.1.1.2.2.2 bouyer if ((MethodInfo->NumArguments != RequiredArgsCurrent) &&
206 1.1.1.2.2.2 bouyer (MethodInfo->NumArguments != RequiredArgsOld))
207 1.1.1.2.2.2 bouyer {
208 1.1.1.2.2.2 bouyer sprintf (MsgBuffer, "%4.4s requires %u",
209 1.1.1.2.2.2 bouyer PredefinedNames[Index].Info.Name, RequiredArgsCurrent);
210 1.1.1.2.2.2 bouyer
211 1.1.1.2.2.2 bouyer if (MethodInfo->NumArguments > RequiredArgsCurrent)
212 1.1.1.2.2.2 bouyer {
213 1.1.1.2.2.2 bouyer AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
214 1.1.1.2.2.2 bouyer MsgBuffer);
215 1.1.1.2.2.2 bouyer }
216 1.1.1.2.2.2 bouyer else
217 1.1.1.2.2.2 bouyer {
218 1.1.1.2.2.2 bouyer AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op,
219 1.1.1.2.2.2 bouyer MsgBuffer);
220 1.1.1.2.2.2 bouyer }
221 1.1.1.2.2.2 bouyer }
222 1.1.1.2.2.2 bouyer
223 1.1.1.2.2.2 bouyer /*
224 1.1.1.2.2.2 bouyer * Check if method returns no value, but the predefined name is
225 1.1.1.2.2.2 bouyer * required to return a value
226 1.1.1.2.2.2 bouyer */
227 1.1.1.2.2.2 bouyer if (MethodInfo->NumReturnNoValue &&
228 1.1.1.2.2.2 bouyer PredefinedNames[Index].Info.ExpectedBtypes)
229 1.1.1.2.2.2 bouyer {
230 1.1.1.2.2.2 bouyer ApGetExpectedTypes (StringBuffer,
231 1.1.1.2.2.2 bouyer PredefinedNames[Index].Info.ExpectedBtypes);
232 1.1.1.2.2.2 bouyer
233 1.1.1.2.2.2 bouyer sprintf (MsgBuffer, "%s required for %4.4s",
234 1.1.1.2.2.2 bouyer StringBuffer, PredefinedNames[Index].Info.Name);
235 1.1.1.2.2.2 bouyer
236 1.1.1.2.2.2 bouyer AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op,
237 1.1.1.2.2.2 bouyer MsgBuffer);
238 1.1.1.2.2.2 bouyer }
239 1.1.1.2.2.2 bouyer break;
240 1.1.1.2.2.2 bouyer }
241 1.1.1.2.2.2 bouyer }
242 1.1.1.2.2.2 bouyer
243 1.1.1.2.2.2 bouyer
244 1.1.1.2.2.2 bouyer /*******************************************************************************
245 1.1.1.2.2.2 bouyer *
246 1.1.1.2.2.2 bouyer * FUNCTION: ApCheckForUnexpectedReturnValue
247 1.1.1.2.2.2 bouyer *
248 1.1.1.2.2.2 bouyer * PARAMETERS: Op - A parse node of type "RETURN".
249 1.1.1.2.2.2 bouyer * MethodInfo - Saved info about this method
250 1.1.1.2.2.2 bouyer *
251 1.1.1.2.2.2 bouyer * RETURN: None
252 1.1.1.2.2.2 bouyer *
253 1.1.1.2.2.2 bouyer * DESCRIPTION: Check for an unexpected return value from a predefined method.
254 1.1.1.2.2.2 bouyer * Invoked for predefined methods that are defined to not return
255 1.1.1.2.2.2 bouyer * any value. If there is a return value, issue a remark, since
256 1.1.1.2.2.2 bouyer * the ASL writer may be confused as to the method definition
257 1.1.1.2.2.2 bouyer * and/or functionality.
258 1.1.1.2.2.2 bouyer *
259 1.1.1.2.2.2 bouyer * Note: We ignore all return values of "Zero", since this is what a standalone
260 1.1.1.2.2.2 bouyer * Return() statement will always generate -- so we ignore it here --
261 1.1.1.2.2.2 bouyer * i.e., there is no difference between Return() and Return(Zero).
262 1.1.1.2.2.2 bouyer * Also, a null Return() will be disassembled to return(Zero) -- so, we
263 1.1.1.2.2.2 bouyer * don't want to generate extraneous remarks/warnings for a disassembled
264 1.1.1.2.2.2 bouyer * ASL file.
265 1.1.1.2.2.2 bouyer *
266 1.1.1.2.2.2 bouyer ******************************************************************************/
267 1.1.1.2.2.2 bouyer
268 1.1.1.2.2.2 bouyer static void
269 1.1.1.2.2.2 bouyer ApCheckForUnexpectedReturnValue (
270 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
271 1.1.1.2.2.2 bouyer ASL_METHOD_INFO *MethodInfo)
272 1.1.1.2.2.2 bouyer {
273 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *ReturnValueOp;
274 1.1.1.2.2.2 bouyer
275 1.1.1.2.2.2 bouyer
276 1.1.1.2.2.2 bouyer /* Ignore Return() and Return(Zero) (they are the same) */
277 1.1.1.2.2.2 bouyer
278 1.1.1.2.2.2 bouyer ReturnValueOp = Op->Asl.Child;
279 1.1.1.2.2.2 bouyer if (ReturnValueOp->Asl.ParseOpcode == PARSEOP_ZERO)
280 1.1.1.2.2.2 bouyer {
281 1.1.1.2.2.2 bouyer return;
282 1.1.1.2.2.2 bouyer }
283 1.1.1.2.2.2 bouyer
284 1.1.1.2.2.2 bouyer /* We have a valid return value, but the reserved name did not expect it */
285 1.1.1.2.2.2 bouyer
286 1.1.1.2.2.2 bouyer AslError (ASL_WARNING, ASL_MSG_RESERVED_NO_RETURN_VAL,
287 1.1.1.2.2.2 bouyer Op, MethodInfo->Op->Asl.ExternalName);
288 1.1.1.2.2.2 bouyer }
289 1.1.1.2.2.2 bouyer
290 1.1.1.2.2.2 bouyer
291 1.1.1.2.2.2 bouyer /*******************************************************************************
292 1.1.1.2.2.2 bouyer *
293 1.1.1.2.2.2 bouyer * FUNCTION: ApCheckPredefinedReturnValue
294 1.1.1.2.2.2 bouyer *
295 1.1.1.2.2.2 bouyer * PARAMETERS: Op - A parse node of type "RETURN".
296 1.1.1.2.2.2 bouyer * MethodInfo - Saved info about this method
297 1.1.1.2.2.2 bouyer *
298 1.1.1.2.2.2 bouyer * RETURN: None
299 1.1.1.2.2.2 bouyer *
300 1.1.1.2.2.2 bouyer * DESCRIPTION: If method is a predefined name, attempt to validate the return
301 1.1.1.2.2.2 bouyer * value. Only "static" types can be validated - a simple return
302 1.1.1.2.2.2 bouyer * of an integer/string/buffer/package or a named reference to
303 1.1.1.2.2.2 bouyer * a static object. Values such as a Localx or Argx or a control
304 1.1.1.2.2.2 bouyer * method invocation are not checked. Issue a warning if there is
305 1.1.1.2.2.2 bouyer * a valid return value, but the reserved method defines no
306 1.1.1.2.2.2 bouyer * return value.
307 1.1.1.2.2.2 bouyer *
308 1.1.1.2.2.2 bouyer ******************************************************************************/
309 1.1.1.2.2.2 bouyer
310 1.1.1.2.2.2 bouyer void
311 1.1.1.2.2.2 bouyer ApCheckPredefinedReturnValue (
312 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
313 1.1.1.2.2.2 bouyer ASL_METHOD_INFO *MethodInfo)
314 1.1.1.2.2.2 bouyer {
315 1.1.1.2.2.2 bouyer UINT32 Index;
316 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *ReturnValueOp;
317 1.1.1.2.2.2 bouyer
318 1.1.1.2.2.2 bouyer
319 1.1.1.2.2.2 bouyer /* Check parent method for a match against the predefined name list */
320 1.1.1.2.2.2 bouyer
321 1.1.1.2.2.2 bouyer Index = ApCheckForPredefinedName (MethodInfo->Op,
322 1.1.1.2.2.2 bouyer MethodInfo->Op->Asl.NameSeg);
323 1.1.1.2.2.2 bouyer
324 1.1.1.2.2.2 bouyer switch (Index)
325 1.1.1.2.2.2 bouyer {
326 1.1.1.2.2.2 bouyer case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
327 1.1.1.2.2.2 bouyer
328 1.1.1.2.2.2 bouyer /* No return value expected, warn if there is one */
329 1.1.1.2.2.2 bouyer
330 1.1.1.2.2.2 bouyer ApCheckForUnexpectedReturnValue (Op, MethodInfo);
331 1.1.1.2.2.2 bouyer return;
332 1.1.1.2.2.2 bouyer
333 1.1.1.2.2.2 bouyer case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
334 1.1.1.2.2.2 bouyer case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
335 1.1.1.2.2.2 bouyer case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
336 1.1.1.2.2.2 bouyer
337 1.1.1.2.2.2 bouyer /* Just return, nothing to do */
338 1.1.1.2.2.2 bouyer return;
339 1.1.1.2.2.2 bouyer
340 1.1.1.2.2.2 bouyer default: /* A standard predefined ACPI name */
341 1.1.1.2.2.2 bouyer
342 1.1.1.2.2.2 bouyer if (!PredefinedNames[Index].Info.ExpectedBtypes)
343 1.1.1.2.2.2 bouyer {
344 1.1.1.2.2.2 bouyer /* No return value expected, warn if there is one */
345 1.1.1.2.2.2 bouyer
346 1.1.1.2.2.2 bouyer ApCheckForUnexpectedReturnValue (Op, MethodInfo);
347 1.1.1.2.2.2 bouyer return;
348 1.1.1.2.2.2 bouyer }
349 1.1.1.2.2.2 bouyer
350 1.1.1.2.2.2 bouyer /* Get the object returned, it is the next argument */
351 1.1.1.2.2.2 bouyer
352 1.1.1.2.2.2 bouyer ReturnValueOp = Op->Asl.Child;
353 1.1.1.2.2.2 bouyer switch (ReturnValueOp->Asl.ParseOpcode)
354 1.1.1.2.2.2 bouyer {
355 1.1.1.2.2.2 bouyer case PARSEOP_ZERO:
356 1.1.1.2.2.2 bouyer case PARSEOP_ONE:
357 1.1.1.2.2.2 bouyer case PARSEOP_ONES:
358 1.1.1.2.2.2 bouyer case PARSEOP_INTEGER:
359 1.1.1.2.2.2 bouyer case PARSEOP_STRING_LITERAL:
360 1.1.1.2.2.2 bouyer case PARSEOP_BUFFER:
361 1.1.1.2.2.2 bouyer case PARSEOP_PACKAGE:
362 1.1.1.2.2.2 bouyer
363 1.1.1.2.2.2 bouyer /* Static data return object - check against expected type */
364 1.1.1.2.2.2 bouyer
365 1.1.1.2.2.2 bouyer ApCheckObjectType (ReturnValueOp,
366 1.1.1.2.2.2 bouyer PredefinedNames[Index].Info.ExpectedBtypes);
367 1.1.1.2.2.2 bouyer break;
368 1.1.1.2.2.2 bouyer
369 1.1.1.2.2.2 bouyer default:
370 1.1.1.2.2.2 bouyer
371 1.1.1.2.2.2 bouyer /*
372 1.1.1.2.2.2 bouyer * All other ops are very difficult or impossible to typecheck at
373 1.1.1.2.2.2 bouyer * compile time. These include all Localx, Argx, and method
374 1.1.1.2.2.2 bouyer * invocations. Also, NAMESEG and NAMESTRING because the type of
375 1.1.1.2.2.2 bouyer * any named object can be changed at runtime (for example,
376 1.1.1.2.2.2 bouyer * CopyObject will change the type of the target object.)
377 1.1.1.2.2.2 bouyer */
378 1.1.1.2.2.2 bouyer break;
379 1.1.1.2.2.2 bouyer }
380 1.1.1.2.2.2 bouyer }
381 1.1.1.2.2.2 bouyer }
382 1.1.1.2.2.2 bouyer
383 1.1.1.2.2.2 bouyer
384 1.1.1.2.2.2 bouyer /*******************************************************************************
385 1.1.1.2.2.2 bouyer *
386 1.1.1.2.2.2 bouyer * FUNCTION: ApCheckForPredefinedObject
387 1.1.1.2.2.2 bouyer *
388 1.1.1.2.2.2 bouyer * PARAMETERS: Op - A parse node
389 1.1.1.2.2.2 bouyer * Name - The ACPI name to be checked
390 1.1.1.2.2.2 bouyer *
391 1.1.1.2.2.2 bouyer * RETURN: None
392 1.1.1.2.2.2 bouyer *
393 1.1.1.2.2.2 bouyer * DESCRIPTION: Check for a predefined name for a static object (created via
394 1.1.1.2.2.2 bouyer * the ASL Name operator). If it is a predefined ACPI name, ensure
395 1.1.1.2.2.2 bouyer * that the name does not require any arguments (which would
396 1.1.1.2.2.2 bouyer * require a control method implemenation of the name), and that
397 1.1.1.2.2.2 bouyer * the type of the object is one of the expected types for the
398 1.1.1.2.2.2 bouyer * predefined name.
399 1.1.1.2.2.2 bouyer *
400 1.1.1.2.2.2 bouyer ******************************************************************************/
401 1.1.1.2.2.2 bouyer
402 1.1.1.2.2.2 bouyer void
403 1.1.1.2.2.2 bouyer ApCheckForPredefinedObject (
404 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
405 1.1.1.2.2.2 bouyer char *Name)
406 1.1.1.2.2.2 bouyer {
407 1.1.1.2.2.2 bouyer UINT32 Index;
408 1.1.1.2.2.2 bouyer
409 1.1.1.2.2.2 bouyer
410 1.1.1.2.2.2 bouyer /*
411 1.1.1.2.2.2 bouyer * Check for a real predefined name -- not a resource descriptor name
412 1.1.1.2.2.2 bouyer * or a predefined scope name
413 1.1.1.2.2.2 bouyer */
414 1.1.1.2.2.2 bouyer Index = ApCheckForPredefinedName (Op, Name);
415 1.1.1.2.2.2 bouyer
416 1.1.1.2.2.2 bouyer switch (Index)
417 1.1.1.2.2.2 bouyer {
418 1.1.1.2.2.2 bouyer case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
419 1.1.1.2.2.2 bouyer case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
420 1.1.1.2.2.2 bouyer case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
421 1.1.1.2.2.2 bouyer
422 1.1.1.2.2.2 bouyer /* Nothing to do */
423 1.1.1.2.2.2 bouyer return;
424 1.1.1.2.2.2 bouyer
425 1.1.1.2.2.2 bouyer case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
426 1.1.1.2.2.2 bouyer
427 1.1.1.2.2.2 bouyer /*
428 1.1.1.2.2.2 bouyer * These names must be control methods, by definition in ACPI spec.
429 1.1.1.2.2.2 bouyer * Also because they are defined to return no value. None of them
430 1.1.1.2.2.2 bouyer * require any arguments.
431 1.1.1.2.2.2 bouyer */
432 1.1.1.2.2.2 bouyer AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
433 1.1.1.2.2.2 bouyer "with zero arguments");
434 1.1.1.2.2.2 bouyer return;
435 1.1.1.2.2.2 bouyer
436 1.1.1.2.2.2 bouyer default: /* A standard predefined ACPI name */
437 1.1.1.2.2.2 bouyer
438 1.1.1.2.2.2 bouyer /*
439 1.1.1.2.2.2 bouyer * If this predefined name requires input arguments, then
440 1.1.1.2.2.2 bouyer * it must be implemented as a control method
441 1.1.1.2.2.2 bouyer */
442 1.1.1.2.2.2 bouyer if (PredefinedNames[Index].Info.ParamCount > 0)
443 1.1.1.2.2.2 bouyer {
444 1.1.1.2.2.2 bouyer AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
445 1.1.1.2.2.2 bouyer "with arguments");
446 1.1.1.2.2.2 bouyer return;
447 1.1.1.2.2.2 bouyer }
448 1.1.1.2.2.2 bouyer
449 1.1.1.2.2.2 bouyer /*
450 1.1.1.2.2.2 bouyer * If no return value is expected from this predefined name, then
451 1.1.1.2.2.2 bouyer * it follows that it must be implemented as a control method
452 1.1.1.2.2.2 bouyer * (with zero args, because the args > 0 case was handled above)
453 1.1.1.2.2.2 bouyer * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx
454 1.1.1.2.2.2 bouyer */
455 1.1.1.2.2.2 bouyer if (!PredefinedNames[Index].Info.ExpectedBtypes)
456 1.1.1.2.2.2 bouyer {
457 1.1.1.2.2.2 bouyer AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
458 1.1.1.2.2.2 bouyer "with zero arguments");
459 1.1.1.2.2.2 bouyer return;
460 1.1.1.2.2.2 bouyer }
461 1.1.1.2.2.2 bouyer
462 1.1.1.2.2.2 bouyer /* Typecheck the actual object, it is the next argument */
463 1.1.1.2.2.2 bouyer
464 1.1.1.2.2.2 bouyer ApCheckObjectType (Op->Asl.Child->Asl.Next,
465 1.1.1.2.2.2 bouyer PredefinedNames[Index].Info.ExpectedBtypes);
466 1.1.1.2.2.2 bouyer return;
467 1.1.1.2.2.2 bouyer }
468 1.1.1.2.2.2 bouyer }
469 1.1.1.2.2.2 bouyer
470 1.1.1.2.2.2 bouyer
471 1.1.1.2.2.2 bouyer /*******************************************************************************
472 1.1.1.2.2.2 bouyer *
473 1.1.1.2.2.2 bouyer * FUNCTION: ApCheckForPredefinedName
474 1.1.1.2.2.2 bouyer *
475 1.1.1.2.2.2 bouyer * PARAMETERS: Op - A parse node
476 1.1.1.2.2.2 bouyer * Name - NameSeg to check
477 1.1.1.2.2.2 bouyer *
478 1.1.1.2.2.2 bouyer * RETURN: None
479 1.1.1.2.2.2 bouyer *
480 1.1.1.2.2.2 bouyer * DESCRIPTION: Check a NameSeg against the reserved list.
481 1.1.1.2.2.2 bouyer *
482 1.1.1.2.2.2 bouyer ******************************************************************************/
483 1.1.1.2.2.2 bouyer
484 1.1.1.2.2.2 bouyer UINT32
485 1.1.1.2.2.2 bouyer ApCheckForPredefinedName (
486 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
487 1.1.1.2.2.2 bouyer char *Name)
488 1.1.1.2.2.2 bouyer {
489 1.1.1.2.2.2 bouyer UINT32 i;
490 1.1.1.2.2.2 bouyer
491 1.1.1.2.2.2 bouyer
492 1.1.1.2.2.2 bouyer if (Name[0] == 0)
493 1.1.1.2.2.2 bouyer {
494 1.1.1.2.2.2 bouyer AcpiOsPrintf ("Found a null name, external = %s\n",
495 1.1.1.2.2.2 bouyer Op->Asl.ExternalName);
496 1.1.1.2.2.2 bouyer }
497 1.1.1.2.2.2 bouyer
498 1.1.1.2.2.2 bouyer /* All reserved names are prefixed with a single underscore */
499 1.1.1.2.2.2 bouyer
500 1.1.1.2.2.2 bouyer if (Name[0] != '_')
501 1.1.1.2.2.2 bouyer {
502 1.1.1.2.2.2 bouyer return (ACPI_NOT_RESERVED_NAME);
503 1.1.1.2.2.2 bouyer }
504 1.1.1.2.2.2 bouyer
505 1.1.1.2.2.2 bouyer /* Check for a standard predefined method name */
506 1.1.1.2.2.2 bouyer
507 1.1.1.2.2.2 bouyer for (i = 0; PredefinedNames[i].Info.Name[0]; i++)
508 1.1.1.2.2.2 bouyer {
509 1.1.1.2.2.2 bouyer if (ACPI_COMPARE_NAME (Name, PredefinedNames[i].Info.Name))
510 1.1.1.2.2.2 bouyer {
511 1.1.1.2.2.2 bouyer /* Return index into predefined array */
512 1.1.1.2.2.2 bouyer return (i);
513 1.1.1.2.2.2 bouyer }
514 1.1.1.2.2.2 bouyer }
515 1.1.1.2.2.2 bouyer
516 1.1.1.2.2.2 bouyer /* Check for resource names and predefined scope names */
517 1.1.1.2.2.2 bouyer
518 1.1.1.2.2.2 bouyer for (i = 0; ResourceNames[i].Info.Name[0]; i++)
519 1.1.1.2.2.2 bouyer {
520 1.1.1.2.2.2 bouyer if (ACPI_COMPARE_NAME (Name, ResourceNames[i].Info.Name))
521 1.1.1.2.2.2 bouyer {
522 1.1.1.2.2.2 bouyer return (ACPI_PREDEFINED_NAME);
523 1.1.1.2.2.2 bouyer }
524 1.1.1.2.2.2 bouyer }
525 1.1.1.2.2.2 bouyer
526 1.1.1.2.2.2 bouyer for (i = 0; ScopeNames[i].Info.Name[0]; i++)
527 1.1.1.2.2.2 bouyer {
528 1.1.1.2.2.2 bouyer if (ACPI_COMPARE_NAME (Name, ScopeNames[i].Info.Name))
529 1.1.1.2.2.2 bouyer {
530 1.1.1.2.2.2 bouyer return (ACPI_PREDEFINED_NAME);
531 1.1.1.2.2.2 bouyer }
532 1.1.1.2.2.2 bouyer }
533 1.1.1.2.2.2 bouyer
534 1.1.1.2.2.2 bouyer /* Check for _Lxx/_Exx/_Wxx/_Qxx/_T_x. Warning if unknown predefined name */
535 1.1.1.2.2.2 bouyer
536 1.1.1.2.2.2 bouyer return (ApCheckForSpecialName (Op, Name));
537 1.1.1.2.2.2 bouyer }
538 1.1.1.2.2.2 bouyer
539 1.1.1.2.2.2 bouyer
540 1.1.1.2.2.2 bouyer /*******************************************************************************
541 1.1.1.2.2.2 bouyer *
542 1.1.1.2.2.2 bouyer * FUNCTION: ApCheckForSpecialName
543 1.1.1.2.2.2 bouyer *
544 1.1.1.2.2.2 bouyer * PARAMETERS: Op - A parse node
545 1.1.1.2.2.2 bouyer * Name - NameSeg to check
546 1.1.1.2.2.2 bouyer *
547 1.1.1.2.2.2 bouyer * RETURN: None
548 1.1.1.2.2.2 bouyer *
549 1.1.1.2.2.2 bouyer * DESCRIPTION: Check for the "special" predefined names -
550 1.1.1.2.2.2 bouyer * _Lxx, _Exx, _Qxx, _Wxx, and _T_x
551 1.1.1.2.2.2 bouyer *
552 1.1.1.2.2.2 bouyer ******************************************************************************/
553 1.1.1.2.2.2 bouyer
554 1.1.1.2.2.2 bouyer static UINT32
555 1.1.1.2.2.2 bouyer ApCheckForSpecialName (
556 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
557 1.1.1.2.2.2 bouyer char *Name)
558 1.1.1.2.2.2 bouyer {
559 1.1.1.2.2.2 bouyer
560 1.1.1.2.2.2 bouyer /*
561 1.1.1.2.2.2 bouyer * Check for the "special" predefined names. We already know that the
562 1.1.1.2.2.2 bouyer * first character is an underscore.
563 1.1.1.2.2.2 bouyer * GPE: _Lxx
564 1.1.1.2.2.2 bouyer * GPE: _Exx
565 1.1.1.2.2.2 bouyer * GPE: _Wxx
566 1.1.1.2.2.2 bouyer * EC: _Qxx
567 1.1.1.2.2.2 bouyer */
568 1.1.1.2.2.2 bouyer if ((Name[1] == 'L') ||
569 1.1.1.2.2.2 bouyer (Name[1] == 'E') ||
570 1.1.1.2.2.2 bouyer (Name[1] == 'W') ||
571 1.1.1.2.2.2 bouyer (Name[1] == 'Q'))
572 1.1.1.2.2.2 bouyer {
573 1.1.1.2.2.2 bouyer /* The next two characters must be hex digits */
574 1.1.1.2.2.2 bouyer
575 1.1.1.2.2.2 bouyer if ((isxdigit ((int) Name[2])) &&
576 1.1.1.2.2.2 bouyer (isxdigit ((int) Name[3])))
577 1.1.1.2.2.2 bouyer {
578 1.1.1.2.2.2 bouyer return (ACPI_EVENT_RESERVED_NAME);
579 1.1.1.2.2.2 bouyer }
580 1.1.1.2.2.2 bouyer }
581 1.1.1.2.2.2 bouyer
582 1.1.1.2.2.2 bouyer /* Check for the names reserved for the compiler itself: _T_x */
583 1.1.1.2.2.2 bouyer
584 1.1.1.2.2.2 bouyer else if ((Op->Asl.ExternalName[1] == 'T') &&
585 1.1.1.2.2.2 bouyer (Op->Asl.ExternalName[2] == '_'))
586 1.1.1.2.2.2 bouyer {
587 1.1.1.2.2.2 bouyer /* Ignore if actually emitted by the compiler */
588 1.1.1.2.2.2 bouyer
589 1.1.1.2.2.2 bouyer if (Op->Asl.CompileFlags & NODE_COMPILER_EMITTED)
590 1.1.1.2.2.2 bouyer {
591 1.1.1.2.2.2 bouyer return (ACPI_NOT_RESERVED_NAME);
592 1.1.1.2.2.2 bouyer }
593 1.1.1.2.2.2 bouyer
594 1.1.1.2.2.2 bouyer /*
595 1.1.1.2.2.2 bouyer * Was not actually emitted by the compiler. This is a special case,
596 1.1.1.2.2.2 bouyer * however. If the ASL code being compiled was the result of a
597 1.1.1.2.2.2 bouyer * dissasembly, it may possibly contain valid compiler-emitted names
598 1.1.1.2.2.2 bouyer * of the form "_T_x". We don't want to issue an error or even a
599 1.1.1.2.2.2 bouyer * warning and force the user to manually change the names. So, we
600 1.1.1.2.2.2 bouyer * will issue a remark instead.
601 1.1.1.2.2.2 bouyer */
602 1.1.1.2.2.2 bouyer AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName);
603 1.1.1.2.2.2 bouyer return (ACPI_COMPILER_RESERVED_NAME);
604 1.1.1.2.2.2 bouyer }
605 1.1.1.2.2.2 bouyer
606 1.1.1.2.2.2 bouyer /*
607 1.1.1.2.2.2 bouyer * The name didn't match any of the known predefined names. Flag it as a
608 1.1.1.2.2.2 bouyer * warning, since the entire namespace starting with an underscore is
609 1.1.1.2.2.2 bouyer * reserved by the ACPI spec.
610 1.1.1.2.2.2 bouyer */
611 1.1.1.2.2.2 bouyer AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op,
612 1.1.1.2.2.2 bouyer Op->Asl.ExternalName);
613 1.1.1.2.2.2 bouyer
614 1.1.1.2.2.2 bouyer return (ACPI_NOT_RESERVED_NAME);
615 1.1.1.2.2.2 bouyer }
616 1.1.1.2.2.2 bouyer
617 1.1.1.2.2.2 bouyer
618 1.1.1.2.2.2 bouyer /*******************************************************************************
619 1.1.1.2.2.2 bouyer *
620 1.1.1.2.2.2 bouyer * FUNCTION: ApCheckObjectType
621 1.1.1.2.2.2 bouyer *
622 1.1.1.2.2.2 bouyer * PARAMETERS: Op - Current parse node
623 1.1.1.2.2.2 bouyer * ExpectedBtypes - Bitmap of expected return type(s)
624 1.1.1.2.2.2 bouyer *
625 1.1.1.2.2.2 bouyer * RETURN: None
626 1.1.1.2.2.2 bouyer *
627 1.1.1.2.2.2 bouyer * DESCRIPTION: Check if the object type is one of the types that is expected
628 1.1.1.2.2.2 bouyer * by the predefined name. Only a limited number of object types
629 1.1.1.2.2.2 bouyer * can be returned by the predefined names.
630 1.1.1.2.2.2 bouyer *
631 1.1.1.2.2.2 bouyer ******************************************************************************/
632 1.1.1.2.2.2 bouyer
633 1.1.1.2.2.2 bouyer static void
634 1.1.1.2.2.2 bouyer ApCheckObjectType (
635 1.1.1.2.2.2 bouyer ACPI_PARSE_OBJECT *Op,
636 1.1.1.2.2.2 bouyer UINT32 ExpectedBtypes)
637 1.1.1.2.2.2 bouyer {
638 1.1.1.2.2.2 bouyer UINT32 ReturnBtype;
639 1.1.1.2.2.2 bouyer
640 1.1.1.2.2.2 bouyer
641 1.1.1.2.2.2 bouyer switch (Op->Asl.ParseOpcode)
642 1.1.1.2.2.2 bouyer {
643 1.1.1.2.2.2 bouyer case PARSEOP_ZERO:
644 1.1.1.2.2.2 bouyer case PARSEOP_ONE:
645 1.1.1.2.2.2 bouyer case PARSEOP_ONES:
646 1.1.1.2.2.2 bouyer case PARSEOP_INTEGER:
647 1.1.1.2.2.2 bouyer ReturnBtype = ACPI_RTYPE_INTEGER;
648 1.1.1.2.2.2 bouyer break;
649 1.1.1.2.2.2 bouyer
650 1.1.1.2.2.2 bouyer case PARSEOP_BUFFER:
651 1.1.1.2.2.2 bouyer ReturnBtype = ACPI_RTYPE_BUFFER;
652 1.1.1.2.2.2 bouyer break;
653 1.1.1.2.2.2 bouyer
654 1.1.1.2.2.2 bouyer case PARSEOP_STRING_LITERAL:
655 1.1.1.2.2.2 bouyer ReturnBtype = ACPI_RTYPE_STRING;
656 1.1.1.2.2.2 bouyer break;
657 1.1.1.2.2.2 bouyer
658 1.1.1.2.2.2 bouyer case PARSEOP_PACKAGE:
659 1.1.1.2.2.2 bouyer ReturnBtype = ACPI_RTYPE_PACKAGE;
660 1.1.1.2.2.2 bouyer break;
661 1.1.1.2.2.2 bouyer
662 1.1.1.2.2.2 bouyer default:
663 1.1.1.2.2.2 bouyer /* Not one of the supported object types */
664 1.1.1.2.2.2 bouyer
665 1.1.1.2.2.2 bouyer goto TypeErrorExit;
666 1.1.1.2.2.2 bouyer }
667 1.1.1.2.2.2 bouyer
668 1.1.1.2.2.2 bouyer /* Exit if the object is one of the expected types */
669 1.1.1.2.2.2 bouyer
670 1.1.1.2.2.2 bouyer if (ReturnBtype & ExpectedBtypes)
671 1.1.1.2.2.2 bouyer {
672 1.1.1.2.2.2 bouyer return;
673 1.1.1.2.2.2 bouyer }
674 1.1.1.2.2.2 bouyer
675 1.1.1.2.2.2 bouyer
676 1.1.1.2.2.2 bouyer TypeErrorExit:
677 1.1.1.2.2.2 bouyer
678 1.1.1.2.2.2 bouyer /* Format the expected types and emit an error message */
679 1.1.1.2.2.2 bouyer
680 1.1.1.2.2.2 bouyer ApGetExpectedTypes (StringBuffer, ExpectedBtypes);
681 1.1.1.2.2.2 bouyer
682 1.1.1.2.2.2 bouyer sprintf (MsgBuffer, "found %s, requires %s",
683 1.1.1.2.2.2 bouyer UtGetOpName (Op->Asl.ParseOpcode), StringBuffer);
684 1.1.1.2.2.2 bouyer
685 1.1.1.2.2.2 bouyer AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op,
686 1.1.1.2.2.2 bouyer MsgBuffer);
687 1.1.1.2.2.2 bouyer }
688 1.1.1.2.2.2 bouyer
689 1.1.1.2.2.2 bouyer
690 1.1.1.2.2.2 bouyer /*******************************************************************************
691 1.1.1.2.2.2 bouyer *
692 1.1.1.2.2.2 bouyer * FUNCTION: ApDisplayReservedNames
693 1.1.1.2.2.2 bouyer *
694 1.1.1.2.2.2 bouyer * PARAMETERS: None
695 1.1.1.2.2.2 bouyer *
696 1.1.1.2.2.2 bouyer * RETURN: None
697 1.1.1.2.2.2 bouyer *
698 1.1.1.2.2.2 bouyer * DESCRIPTION: Dump information about the ACPI predefined names and predefined
699 1.1.1.2.2.2 bouyer * resource descriptor names.
700 1.1.1.2.2.2 bouyer *
701 1.1.1.2.2.2 bouyer ******************************************************************************/
702 1.1.1.2.2.2 bouyer
703 1.1.1.2.2.2 bouyer void
704 1.1.1.2.2.2 bouyer ApDisplayReservedNames (
705 1.1.1.2.2.2 bouyer void)
706 1.1.1.2.2.2 bouyer {
707 1.1.1.2.2.2 bouyer const ACPI_PREDEFINED_INFO *ThisName;
708 1.1.1.2.2.2 bouyer char TypeBuffer[48]; /* Room for 5 types */
709 1.1.1.2.2.2 bouyer UINT32 Count;
710 1.1.1.2.2.2 bouyer
711 1.1.1.2.2.2 bouyer
712 1.1.1.2.2.2 bouyer /*
713 1.1.1.2.2.2 bouyer * Predefined names/methods
714 1.1.1.2.2.2 bouyer */
715 1.1.1.2.2.2 bouyer printf ("\nPredefined Name Information\n\n");
716 1.1.1.2.2.2 bouyer
717 1.1.1.2.2.2 bouyer Count = 0;
718 1.1.1.2.2.2 bouyer ThisName = PredefinedNames;
719 1.1.1.2.2.2 bouyer while (ThisName->Info.Name[0])
720 1.1.1.2.2.2 bouyer {
721 1.1.1.2.2.2 bouyer printf ("%4.4s Requires %u arguments, ",
722 1.1.1.2.2.2 bouyer ThisName->Info.Name, ThisName->Info.ParamCount & 0x0F);
723 1.1.1.2.2.2 bouyer
724 1.1.1.2.2.2 bouyer if (ThisName->Info.ExpectedBtypes)
725 1.1.1.2.2.2 bouyer {
726 1.1.1.2.2.2 bouyer ApGetExpectedTypes (TypeBuffer, ThisName->Info.ExpectedBtypes);
727 1.1.1.2.2.2 bouyer printf ("Must return: %s\n", TypeBuffer);
728 1.1.1.2.2.2 bouyer }
729 1.1.1.2.2.2 bouyer else
730 1.1.1.2.2.2 bouyer {
731 1.1.1.2.2.2 bouyer printf ("No return value\n");
732 1.1.1.2.2.2 bouyer }
733 1.1.1.2.2.2 bouyer
734 1.1.1.2.2.2 bouyer /*
735 1.1.1.2.2.2 bouyer * Skip next entry in the table if this name returns a Package
736 1.1.1.2.2.2 bouyer * (next entry contains the package info)
737 1.1.1.2.2.2 bouyer */
738 1.1.1.2.2.2 bouyer if (ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE)
739 1.1.1.2.2.2 bouyer {
740 1.1.1.2.2.2 bouyer ThisName++;
741 1.1.1.2.2.2 bouyer }
742 1.1.1.2.2.2 bouyer
743 1.1.1.2.2.2 bouyer Count++;
744 1.1.1.2.2.2 bouyer ThisName++;
745 1.1.1.2.2.2 bouyer }
746 1.1.1.2.2.2 bouyer
747 1.1.1.2.2.2 bouyer printf ("%u Predefined Names are recognized\n", Count);
748 1.1.1.2.2.2 bouyer
749 1.1.1.2.2.2 bouyer /*
750 1.1.1.2.2.2 bouyer * Resource Descriptor names
751 1.1.1.2.2.2 bouyer */
752 1.1.1.2.2.2 bouyer printf ("\nResource Descriptor Predefined Names\n\n");
753 1.1.1.2.2.2 bouyer
754 1.1.1.2.2.2 bouyer Count = 0;
755 1.1.1.2.2.2 bouyer ThisName = ResourceNames;
756 1.1.1.2.2.2 bouyer while (ThisName->Info.Name[0])
757 1.1.1.2.2.2 bouyer {
758 1.1.1.2.2.2 bouyer printf ("%4.4s Resource Descriptor\n", ThisName->Info.Name);
759 1.1.1.2.2.2 bouyer Count++;
760 1.1.1.2.2.2 bouyer ThisName++;
761 1.1.1.2.2.2 bouyer }
762 1.1.1.2.2.2 bouyer
763 1.1.1.2.2.2 bouyer printf ("%u Resource Descriptor Names are recognized\n", Count);
764 1.1.1.2.2.2 bouyer
765 1.1.1.2.2.2 bouyer /*
766 1.1.1.2.2.2 bouyer * Predefined scope names
767 1.1.1.2.2.2 bouyer */
768 1.1.1.2.2.2 bouyer printf ("\nPredefined Scope Names\n\n");
769 1.1.1.2.2.2 bouyer
770 1.1.1.2.2.2 bouyer ThisName = ScopeNames;
771 1.1.1.2.2.2 bouyer while (ThisName->Info.Name[0])
772 1.1.1.2.2.2 bouyer {
773 1.1.1.2.2.2 bouyer printf ("%4.4s Scope\n", ThisName->Info.Name);
774 1.1.1.2.2.2 bouyer ThisName++;
775 1.1.1.2.2.2 bouyer }
776 1.1.1.2.2.2 bouyer }
777 1.1.1.2.2.2 bouyer
778 1.1.1.2.2.2 bouyer
779 1.1.1.2.2.2 bouyer /*******************************************************************************
780 1.1.1.2.2.2 bouyer *
781 1.1.1.2.2.2 bouyer * FUNCTION: ApGetExpectedTypes
782 1.1.1.2.2.2 bouyer *
783 1.1.1.2.2.2 bouyer * PARAMETERS: Buffer - Where the formatted string is returned
784 1.1.1.2.2.2 bouyer * ExpectedBTypes - Bitfield of expected data types
785 1.1.1.2.2.2 bouyer *
786 1.1.1.2.2.2 bouyer * RETURN: None, formatted string
787 1.1.1.2.2.2 bouyer *
788 1.1.1.2.2.2 bouyer * DESCRIPTION: Format the expected object types into a printable string.
789 1.1.1.2.2.2 bouyer *
790 1.1.1.2.2.2 bouyer ******************************************************************************/
791 1.1.1.2.2.2 bouyer
792 1.1.1.2.2.2 bouyer static void
793 1.1.1.2.2.2 bouyer ApGetExpectedTypes (
794 1.1.1.2.2.2 bouyer char *Buffer,
795 1.1.1.2.2.2 bouyer UINT32 ExpectedBtypes)
796 1.1.1.2.2.2 bouyer {
797 1.1.1.2.2.2 bouyer UINT32 ThisRtype;
798 1.1.1.2.2.2 bouyer UINT32 i;
799 1.1.1.2.2.2 bouyer UINT32 j;
800 1.1.1.2.2.2 bouyer
801 1.1.1.2.2.2 bouyer
802 1.1.1.2.2.2 bouyer j = 1;
803 1.1.1.2.2.2 bouyer Buffer[0] = 0;
804 1.1.1.2.2.2 bouyer ThisRtype = ACPI_RTYPE_INTEGER;
805 1.1.1.2.2.2 bouyer
806 1.1.1.2.2.2 bouyer for (i = 0; i < ACPI_NUM_RTYPES; i++)
807 1.1.1.2.2.2 bouyer {
808 1.1.1.2.2.2 bouyer /* If one of the expected types, concatenate the name of this type */
809 1.1.1.2.2.2 bouyer
810 1.1.1.2.2.2 bouyer if (ExpectedBtypes & ThisRtype)
811 1.1.1.2.2.2 bouyer {
812 1.1.1.2.2.2 bouyer ACPI_STRCAT (Buffer, &AcpiRtypeNames[i][j]);
813 1.1.1.2.2.2 bouyer j = 0; /* Use name separator from now on */
814 1.1.1.2.2.2 bouyer }
815 1.1.1.2.2.2 bouyer ThisRtype <<= 1; /* Next Rtype */
816 1.1.1.2.2.2 bouyer }
817 1.1.1.2.2.2 bouyer }
818 1.1.1.2.2.2 bouyer
819