dmresrc.c revision 1.3.4.2 1 1.3.4.2 rmind /*******************************************************************************
2 1.3.4.2 rmind *
3 1.3.4.2 rmind * Module Name: dmresrc.c - Resource Descriptor disassembly
4 1.3.4.2 rmind *
5 1.3.4.2 rmind ******************************************************************************/
6 1.3.4.2 rmind
7 1.3.4.2 rmind /*
8 1.3.4.2 rmind * Copyright (C) 2000 - 2011, Intel Corp.
9 1.3.4.2 rmind * All rights reserved.
10 1.3.4.2 rmind *
11 1.3.4.2 rmind * Redistribution and use in source and binary forms, with or without
12 1.3.4.2 rmind * modification, are permitted provided that the following conditions
13 1.3.4.2 rmind * are met:
14 1.3.4.2 rmind * 1. Redistributions of source code must retain the above copyright
15 1.3.4.2 rmind * notice, this list of conditions, and the following disclaimer,
16 1.3.4.2 rmind * without modification.
17 1.3.4.2 rmind * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.3.4.2 rmind * substantially similar to the "NO WARRANTY" disclaimer below
19 1.3.4.2 rmind * ("Disclaimer") and any redistribution must be conditioned upon
20 1.3.4.2 rmind * including a substantially similar Disclaimer requirement for further
21 1.3.4.2 rmind * binary redistribution.
22 1.3.4.2 rmind * 3. Neither the names of the above-listed copyright holders nor the names
23 1.3.4.2 rmind * of any contributors may be used to endorse or promote products derived
24 1.3.4.2 rmind * from this software without specific prior written permission.
25 1.3.4.2 rmind *
26 1.3.4.2 rmind * Alternatively, this software may be distributed under the terms of the
27 1.3.4.2 rmind * GNU General Public License ("GPL") version 2 as published by the Free
28 1.3.4.2 rmind * Software Foundation.
29 1.3.4.2 rmind *
30 1.3.4.2 rmind * NO WARRANTY
31 1.3.4.2 rmind * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.3.4.2 rmind * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.3.4.2 rmind * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.3.4.2 rmind * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.3.4.2 rmind * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.3.4.2 rmind * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.3.4.2 rmind * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.3.4.2 rmind * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.3.4.2 rmind * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.3.4.2 rmind * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.3.4.2 rmind * POSSIBILITY OF SUCH DAMAGES.
42 1.3.4.2 rmind */
43 1.3.4.2 rmind
44 1.3.4.2 rmind
45 1.3.4.2 rmind #include "acpi.h"
46 1.3.4.2 rmind #include "accommon.h"
47 1.3.4.2 rmind #include "amlcode.h"
48 1.3.4.2 rmind #include "acdisasm.h"
49 1.3.4.2 rmind
50 1.3.4.2 rmind #ifdef ACPI_DISASSEMBLER
51 1.3.4.2 rmind
52 1.3.4.2 rmind #define _COMPONENT ACPI_CA_DEBUGGER
53 1.3.4.2 rmind ACPI_MODULE_NAME ("dbresrc")
54 1.3.4.2 rmind
55 1.3.4.2 rmind
56 1.3.4.2 rmind /* Dispatch tables for Resource disassembly functions */
57 1.3.4.2 rmind
58 1.3.4.2 rmind typedef
59 1.3.4.2 rmind void (*ACPI_RESOURCE_HANDLER) (
60 1.3.4.2 rmind AML_RESOURCE *Resource,
61 1.3.4.2 rmind UINT32 Length,
62 1.3.4.2 rmind UINT32 Level);
63 1.3.4.2 rmind
64 1.3.4.2 rmind static ACPI_RESOURCE_HANDLER AcpiGbl_DmResourceDispatch [] =
65 1.3.4.2 rmind {
66 1.3.4.2 rmind /* Small descriptors */
67 1.3.4.2 rmind
68 1.3.4.2 rmind NULL, /* 0x00, Reserved */
69 1.3.4.2 rmind NULL, /* 0x01, Reserved */
70 1.3.4.2 rmind NULL, /* 0x02, Reserved */
71 1.3.4.2 rmind NULL, /* 0x03, Reserved */
72 1.3.4.2 rmind AcpiDmIrqDescriptor, /* 0x04, ACPI_RESOURCE_NAME_IRQ_FORMAT */
73 1.3.4.2 rmind AcpiDmDmaDescriptor, /* 0x05, ACPI_RESOURCE_NAME_DMA_FORMAT */
74 1.3.4.2 rmind AcpiDmStartDependentDescriptor, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */
75 1.3.4.2 rmind AcpiDmEndDependentDescriptor, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
76 1.3.4.2 rmind AcpiDmIoDescriptor, /* 0x08, ACPI_RESOURCE_NAME_IO_PORT */
77 1.3.4.2 rmind AcpiDmFixedIoDescriptor, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO_PORT */
78 1.3.4.2 rmind NULL, /* 0x0A, Reserved */
79 1.3.4.2 rmind NULL, /* 0x0B, Reserved */
80 1.3.4.2 rmind NULL, /* 0x0C, Reserved */
81 1.3.4.2 rmind NULL, /* 0x0D, Reserved */
82 1.3.4.2 rmind AcpiDmVendorSmallDescriptor, /* 0x0E, ACPI_RESOURCE_NAME_SMALL_VENDOR */
83 1.3.4.2 rmind NULL, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG (not used) */
84 1.3.4.2 rmind
85 1.3.4.2 rmind /* Large descriptors */
86 1.3.4.2 rmind
87 1.3.4.2 rmind NULL, /* 0x00, Reserved */
88 1.3.4.2 rmind AcpiDmMemory24Descriptor, /* 0x01, ACPI_RESOURCE_NAME_MEMORY_24 */
89 1.3.4.2 rmind AcpiDmGenericRegisterDescriptor,/* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
90 1.3.4.2 rmind NULL, /* 0x03, Reserved */
91 1.3.4.2 rmind AcpiDmVendorLargeDescriptor, /* 0x04, ACPI_RESOURCE_NAME_LARGE_VENDOR */
92 1.3.4.2 rmind AcpiDmMemory32Descriptor, /* 0x05, ACPI_RESOURCE_NAME_MEMORY_32 */
93 1.3.4.2 rmind AcpiDmFixedMemory32Descriptor, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY_32 */
94 1.3.4.2 rmind AcpiDmDwordDescriptor, /* 0x07, ACPI_RESOURCE_NAME_DWORD_ADDRESS_SPACE */
95 1.3.4.2 rmind AcpiDmWordDescriptor, /* 0x08, ACPI_RESOURCE_NAME_WORD_ADDRESS_SPACE */
96 1.3.4.2 rmind AcpiDmInterruptDescriptor, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_XRUPT */
97 1.3.4.2 rmind AcpiDmQwordDescriptor, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */
98 1.3.4.2 rmind AcpiDmExtendedDescriptor /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */
99 1.3.4.2 rmind };
100 1.3.4.2 rmind
101 1.3.4.2 rmind
102 1.3.4.2 rmind /* Only used for single-threaded applications */
103 1.3.4.2 rmind /* TBD: remove when name is passed as parameter to the dump functions */
104 1.3.4.2 rmind
105 1.3.4.2 rmind static UINT32 ResourceName;
106 1.3.4.2 rmind
107 1.3.4.2 rmind
108 1.3.4.2 rmind /*******************************************************************************
109 1.3.4.2 rmind *
110 1.3.4.2 rmind * FUNCTION: AcpiDmDescriptorName
111 1.3.4.2 rmind *
112 1.3.4.2 rmind * PARAMETERS: None
113 1.3.4.2 rmind *
114 1.3.4.2 rmind * RETURN: None
115 1.3.4.2 rmind *
116 1.3.4.2 rmind * DESCRIPTION: Emit a name for the descriptor if one is present (indicated
117 1.3.4.2 rmind * by the name being changed from the default name.) A name is only
118 1.3.4.2 rmind * emitted if a reference to the descriptor has been made somewhere
119 1.3.4.2 rmind * in the original ASL code.
120 1.3.4.2 rmind *
121 1.3.4.2 rmind ******************************************************************************/
122 1.3.4.2 rmind
123 1.3.4.2 rmind void
124 1.3.4.2 rmind AcpiDmDescriptorName (
125 1.3.4.2 rmind void)
126 1.3.4.2 rmind {
127 1.3.4.2 rmind
128 1.3.4.2 rmind if (ResourceName == ACPI_DEFAULT_RESNAME)
129 1.3.4.2 rmind {
130 1.3.4.2 rmind return;
131 1.3.4.2 rmind }
132 1.3.4.2 rmind
133 1.3.4.2 rmind AcpiOsPrintf ("%4.4s", (char *) &ResourceName);
134 1.3.4.2 rmind }
135 1.3.4.2 rmind
136 1.3.4.2 rmind
137 1.3.4.2 rmind /*******************************************************************************
138 1.3.4.2 rmind *
139 1.3.4.2 rmind * FUNCTION: AcpiDmDumpInteger*
140 1.3.4.2 rmind *
141 1.3.4.2 rmind * PARAMETERS: Value - Value to emit
142 1.3.4.2 rmind * Name - Associated name (emitted as a comment)
143 1.3.4.2 rmind *
144 1.3.4.2 rmind * RETURN: None
145 1.3.4.2 rmind *
146 1.3.4.2 rmind * DESCRIPTION: Integer output helper functions
147 1.3.4.2 rmind *
148 1.3.4.2 rmind ******************************************************************************/
149 1.3.4.2 rmind
150 1.3.4.2 rmind void
151 1.3.4.2 rmind AcpiDmDumpInteger8 (
152 1.3.4.2 rmind UINT8 Value,
153 1.3.4.2 rmind const char *Name)
154 1.3.4.2 rmind {
155 1.3.4.2 rmind AcpiOsPrintf ("0x%2.2X, // %s\n", Value, Name);
156 1.3.4.2 rmind }
157 1.3.4.2 rmind
158 1.3.4.2 rmind void
159 1.3.4.2 rmind AcpiDmDumpInteger16 (
160 1.3.4.2 rmind UINT16 Value,
161 1.3.4.2 rmind const char *Name)
162 1.3.4.2 rmind {
163 1.3.4.2 rmind AcpiOsPrintf ("0x%4.4X, // %s\n", Value, Name);
164 1.3.4.2 rmind }
165 1.3.4.2 rmind
166 1.3.4.2 rmind void
167 1.3.4.2 rmind AcpiDmDumpInteger32 (
168 1.3.4.2 rmind UINT32 Value,
169 1.3.4.2 rmind const char *Name)
170 1.3.4.2 rmind {
171 1.3.4.2 rmind AcpiOsPrintf ("0x%8.8X, // %s\n", Value, Name);
172 1.3.4.2 rmind }
173 1.3.4.2 rmind
174 1.3.4.2 rmind void
175 1.3.4.2 rmind AcpiDmDumpInteger64 (
176 1.3.4.2 rmind UINT64 Value,
177 1.3.4.2 rmind const char *Name)
178 1.3.4.2 rmind {
179 1.3.4.2 rmind AcpiOsPrintf ("0x%8.8X%8.8X, // %s\n", ACPI_FORMAT_UINT64 (Value), Name);
180 1.3.4.2 rmind }
181 1.3.4.2 rmind
182 1.3.4.2 rmind
183 1.3.4.2 rmind /*******************************************************************************
184 1.3.4.2 rmind *
185 1.3.4.2 rmind * FUNCTION: AcpiDmBitList
186 1.3.4.2 rmind *
187 1.3.4.2 rmind * PARAMETERS: Mask - 16-bit value corresponding to 16 interrupt
188 1.3.4.2 rmind * or DMA values
189 1.3.4.2 rmind *
190 1.3.4.2 rmind * RETURN: None
191 1.3.4.2 rmind *
192 1.3.4.2 rmind * DESCRIPTION: Dump a bit mask as a list of individual interrupt/DMA levels.
193 1.3.4.2 rmind *
194 1.3.4.2 rmind ******************************************************************************/
195 1.3.4.2 rmind
196 1.3.4.2 rmind void
197 1.3.4.2 rmind AcpiDmBitList (
198 1.3.4.2 rmind UINT16 Mask)
199 1.3.4.2 rmind {
200 1.3.4.2 rmind UINT32 i;
201 1.3.4.2 rmind BOOLEAN Previous = FALSE;
202 1.3.4.2 rmind
203 1.3.4.2 rmind
204 1.3.4.2 rmind /* Open the initializer list */
205 1.3.4.2 rmind
206 1.3.4.2 rmind AcpiOsPrintf ("{");
207 1.3.4.2 rmind
208 1.3.4.2 rmind /* Examine each bit */
209 1.3.4.2 rmind
210 1.3.4.2 rmind for (i = 0; i < 16; i++)
211 1.3.4.2 rmind {
212 1.3.4.2 rmind /* Only interested in bits that are set to 1 */
213 1.3.4.2 rmind
214 1.3.4.2 rmind if (Mask & 1)
215 1.3.4.2 rmind {
216 1.3.4.2 rmind if (Previous)
217 1.3.4.2 rmind {
218 1.3.4.2 rmind AcpiOsPrintf (",");
219 1.3.4.2 rmind }
220 1.3.4.2 rmind Previous = TRUE;
221 1.3.4.2 rmind AcpiOsPrintf ("%u", i);
222 1.3.4.2 rmind }
223 1.3.4.2 rmind
224 1.3.4.2 rmind Mask >>= 1;
225 1.3.4.2 rmind }
226 1.3.4.2 rmind
227 1.3.4.2 rmind /* Close list */
228 1.3.4.2 rmind
229 1.3.4.2 rmind AcpiOsPrintf ("}\n");
230 1.3.4.2 rmind }
231 1.3.4.2 rmind
232 1.3.4.2 rmind
233 1.3.4.2 rmind /*******************************************************************************
234 1.3.4.2 rmind *
235 1.3.4.2 rmind * FUNCTION: AcpiDmResourceTemplate
236 1.3.4.2 rmind *
237 1.3.4.2 rmind * PARAMETERS: Info - Curent parse tree walk info
238 1.3.4.2 rmind * ByteData - Pointer to the byte list data
239 1.3.4.2 rmind * ByteCount - Length of the byte list
240 1.3.4.2 rmind *
241 1.3.4.2 rmind * RETURN: None
242 1.3.4.2 rmind *
243 1.3.4.2 rmind * DESCRIPTION: Dump the contents of a Resource Template containing a set of
244 1.3.4.2 rmind * Resource Descriptors.
245 1.3.4.2 rmind *
246 1.3.4.2 rmind ******************************************************************************/
247 1.3.4.2 rmind
248 1.3.4.2 rmind void
249 1.3.4.2 rmind AcpiDmResourceTemplate (
250 1.3.4.2 rmind ACPI_OP_WALK_INFO *Info,
251 1.3.4.2 rmind ACPI_PARSE_OBJECT *Op,
252 1.3.4.2 rmind UINT8 *ByteData,
253 1.3.4.2 rmind UINT32 ByteCount)
254 1.3.4.2 rmind {
255 1.3.4.2 rmind ACPI_STATUS Status;
256 1.3.4.2 rmind UINT32 CurrentByteOffset;
257 1.3.4.2 rmind UINT8 ResourceType;
258 1.3.4.2 rmind UINT32 ResourceLength;
259 1.3.4.2 rmind void *Aml;
260 1.3.4.2 rmind UINT32 Level;
261 1.3.4.2 rmind BOOLEAN DependentFns = FALSE;
262 1.3.4.2 rmind UINT8 ResourceIndex;
263 1.3.4.2 rmind ACPI_NAMESPACE_NODE *Node;
264 1.3.4.2 rmind
265 1.3.4.2 rmind
266 1.3.4.2 rmind Level = Info->Level;
267 1.3.4.2 rmind ResourceName = ACPI_DEFAULT_RESNAME;
268 1.3.4.2 rmind Node = Op->Common.Node;
269 1.3.4.2 rmind if (Node)
270 1.3.4.2 rmind {
271 1.3.4.2 rmind Node = Node->Child;
272 1.3.4.2 rmind }
273 1.3.4.2 rmind
274 1.3.4.2 rmind for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount;)
275 1.3.4.2 rmind {
276 1.3.4.2 rmind Aml = &ByteData[CurrentByteOffset];
277 1.3.4.2 rmind
278 1.3.4.2 rmind /* Get the descriptor type and length */
279 1.3.4.2 rmind
280 1.3.4.2 rmind ResourceType = AcpiUtGetResourceType (Aml);
281 1.3.4.2 rmind ResourceLength = AcpiUtGetResourceLength (Aml);
282 1.3.4.2 rmind
283 1.3.4.2 rmind /* Validate the Resource Type and Resource Length */
284 1.3.4.2 rmind
285 1.3.4.2 rmind Status = AcpiUtValidateResource (Aml, &ResourceIndex);
286 1.3.4.2 rmind if (ACPI_FAILURE (Status))
287 1.3.4.2 rmind {
288 1.3.4.2 rmind AcpiOsPrintf ("/*** Could not validate Resource, type (%X) %s***/\n",
289 1.3.4.2 rmind ResourceType, AcpiFormatException (Status));
290 1.3.4.2 rmind return;
291 1.3.4.2 rmind }
292 1.3.4.2 rmind
293 1.3.4.2 rmind /* Point to next descriptor */
294 1.3.4.2 rmind
295 1.3.4.2 rmind CurrentByteOffset += AcpiUtGetDescriptorLength (Aml);
296 1.3.4.2 rmind
297 1.3.4.2 rmind /* Descriptor pre-processing */
298 1.3.4.2 rmind
299 1.3.4.2 rmind switch (ResourceType)
300 1.3.4.2 rmind {
301 1.3.4.2 rmind case ACPI_RESOURCE_NAME_START_DEPENDENT:
302 1.3.4.2 rmind
303 1.3.4.2 rmind /* Finish a previous StartDependentFns */
304 1.3.4.2 rmind
305 1.3.4.2 rmind if (DependentFns)
306 1.3.4.2 rmind {
307 1.3.4.2 rmind Level--;
308 1.3.4.2 rmind AcpiDmIndent (Level);
309 1.3.4.2 rmind AcpiOsPrintf ("}\n");
310 1.3.4.2 rmind }
311 1.3.4.2 rmind break;
312 1.3.4.2 rmind
313 1.3.4.2 rmind case ACPI_RESOURCE_NAME_END_DEPENDENT:
314 1.3.4.2 rmind
315 1.3.4.2 rmind Level--;
316 1.3.4.2 rmind DependentFns = FALSE;
317 1.3.4.2 rmind break;
318 1.3.4.2 rmind
319 1.3.4.2 rmind case ACPI_RESOURCE_NAME_END_TAG:
320 1.3.4.2 rmind
321 1.3.4.2 rmind /* Normal exit, the resource list is finished */
322 1.3.4.2 rmind
323 1.3.4.2 rmind if (DependentFns)
324 1.3.4.2 rmind {
325 1.3.4.2 rmind /*
326 1.3.4.2 rmind * Close an open StartDependentDescriptor. This indicates a
327 1.3.4.2 rmind * missing EndDependentDescriptor.
328 1.3.4.2 rmind */
329 1.3.4.2 rmind Level--;
330 1.3.4.2 rmind DependentFns = FALSE;
331 1.3.4.2 rmind
332 1.3.4.2 rmind /* Go ahead and insert EndDependentFn() */
333 1.3.4.2 rmind
334 1.3.4.2 rmind AcpiDmEndDependentDescriptor (Aml, ResourceLength, Level);
335 1.3.4.2 rmind
336 1.3.4.2 rmind AcpiDmIndent (Level);
337 1.3.4.2 rmind AcpiOsPrintf (
338 1.3.4.2 rmind "/*** Disassembler: inserted missing EndDependentFn () ***/\n");
339 1.3.4.2 rmind }
340 1.3.4.2 rmind return;
341 1.3.4.2 rmind
342 1.3.4.2 rmind default:
343 1.3.4.2 rmind break;
344 1.3.4.2 rmind }
345 1.3.4.2 rmind
346 1.3.4.2 rmind /* Disassemble the resource structure */
347 1.3.4.2 rmind
348 1.3.4.2 rmind if (Node)
349 1.3.4.2 rmind {
350 1.3.4.2 rmind ResourceName = Node->Name.Integer;
351 1.3.4.2 rmind Node = Node->Peer;
352 1.3.4.2 rmind }
353 1.3.4.2 rmind
354 1.3.4.2 rmind AcpiGbl_DmResourceDispatch [ResourceIndex] (
355 1.3.4.2 rmind Aml, ResourceLength, Level);
356 1.3.4.2 rmind
357 1.3.4.2 rmind /* Descriptor post-processing */
358 1.3.4.2 rmind
359 1.3.4.2 rmind if (ResourceType == ACPI_RESOURCE_NAME_START_DEPENDENT)
360 1.3.4.2 rmind {
361 1.3.4.2 rmind DependentFns = TRUE;
362 1.3.4.2 rmind Level++;
363 1.3.4.2 rmind }
364 1.3.4.2 rmind }
365 1.3.4.2 rmind }
366 1.3.4.2 rmind
367 1.3.4.2 rmind
368 1.3.4.2 rmind /*******************************************************************************
369 1.3.4.2 rmind *
370 1.3.4.2 rmind * FUNCTION: AcpiDmIsResourceTemplate
371 1.3.4.2 rmind *
372 1.3.4.2 rmind * PARAMETERS: Op - Buffer Op to be examined
373 1.3.4.2 rmind *
374 1.3.4.2 rmind * RETURN: Status. AE_OK if valid template
375 1.3.4.2 rmind *
376 1.3.4.2 rmind * DESCRIPTION: Walk a byte list to determine if it consists of a valid set
377 1.3.4.2 rmind * of resource descriptors. Nothing is output.
378 1.3.4.2 rmind *
379 1.3.4.2 rmind ******************************************************************************/
380 1.3.4.2 rmind
381 1.3.4.2 rmind ACPI_STATUS
382 1.3.4.2 rmind AcpiDmIsResourceTemplate (
383 1.3.4.2 rmind ACPI_PARSE_OBJECT *Op)
384 1.3.4.2 rmind {
385 1.3.4.2 rmind ACPI_STATUS Status;
386 1.3.4.2 rmind ACPI_PARSE_OBJECT *NextOp;
387 1.3.4.2 rmind UINT8 *Aml;
388 1.3.4.2 rmind UINT8 *EndAml;
389 1.3.4.2 rmind ACPI_SIZE Length;
390 1.3.4.2 rmind
391 1.3.4.2 rmind
392 1.3.4.2 rmind /* This op must be a buffer */
393 1.3.4.2 rmind
394 1.3.4.2 rmind if (Op->Common.AmlOpcode != AML_BUFFER_OP)
395 1.3.4.2 rmind {
396 1.3.4.2 rmind return (AE_TYPE);
397 1.3.4.2 rmind }
398 1.3.4.2 rmind
399 1.3.4.2 rmind /* Get the ByteData list and length */
400 1.3.4.2 rmind
401 1.3.4.2 rmind NextOp = Op->Common.Value.Arg;
402 1.3.4.2 rmind NextOp = NextOp->Common.Next;
403 1.3.4.2 rmind if (!NextOp)
404 1.3.4.2 rmind {
405 1.3.4.2 rmind return (AE_TYPE);
406 1.3.4.2 rmind }
407 1.3.4.2 rmind
408 1.3.4.2 rmind Aml = NextOp->Named.Data;
409 1.3.4.2 rmind Length = (ACPI_SIZE) NextOp->Common.Value.Integer;
410 1.3.4.2 rmind
411 1.3.4.2 rmind /* Walk the byte list, abort on any invalid descriptor type or length */
412 1.3.4.2 rmind
413 1.3.4.2 rmind Status = AcpiUtWalkAmlResources (Aml, Length, NULL, &EndAml);
414 1.3.4.2 rmind if (ACPI_FAILURE (Status))
415 1.3.4.2 rmind {
416 1.3.4.2 rmind return (AE_TYPE);
417 1.3.4.2 rmind }
418 1.3.4.2 rmind
419 1.3.4.2 rmind /*
420 1.3.4.2 rmind * For the resource template to be valid, one EndTag must appear
421 1.3.4.2 rmind * at the very end of the ByteList, not before. (For proper disassembly
422 1.3.4.2 rmind * of a ResourceTemplate, the buffer must not have any extra data after
423 1.3.4.2 rmind * the EndTag.)
424 1.3.4.2 rmind */
425 1.3.4.2 rmind if ((Aml + Length - sizeof (AML_RESOURCE_END_TAG)) != EndAml)
426 1.3.4.2 rmind {
427 1.3.4.2 rmind return (AE_AML_NO_RESOURCE_END_TAG);
428 1.3.4.2 rmind }
429 1.3.4.2 rmind
430 1.3.4.2 rmind /*
431 1.3.4.2 rmind * All resource descriptors are valid, therefore this list appears
432 1.3.4.2 rmind * to be a valid resource template
433 1.3.4.2 rmind */
434 1.3.4.2 rmind return (AE_OK);
435 1.3.4.2 rmind }
436 1.3.4.2 rmind
437 1.3.4.2 rmind #endif
438