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