1 | /* $Id: acpi-decompiler.cpp 108015 2025-02-01 19:21:10Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Advanced Configuration and Power Interface (ACPI) Table generation API.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2025 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | * CDDL are applicable instead of those of the GPL.
|
---|
30 | *
|
---|
31 | * You may elect to license modified versions of this file under the
|
---|
32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 |
|
---|
38 | /*********************************************************************************************************************************
|
---|
39 | * Header Files *
|
---|
40 | *********************************************************************************************************************************/
|
---|
41 | #define LOG_GROUP RTLOGGROUP_ACPI
|
---|
42 | #include <iprt/acpi.h>
|
---|
43 | #include <iprt/asm.h>
|
---|
44 | #include <iprt/ctype.h>
|
---|
45 | #include <iprt/err.h>
|
---|
46 | #include <iprt/file.h>
|
---|
47 | #include <iprt/list.h>
|
---|
48 | #include <iprt/mem.h>
|
---|
49 | #include <iprt/string.h>
|
---|
50 | #include <iprt/uuid.h>
|
---|
51 |
|
---|
52 | #include <iprt/formats/acpi-aml.h>
|
---|
53 | #include <iprt/formats/acpi-resources.h>
|
---|
54 |
|
---|
55 | #include "internal/acpi.h"
|
---|
56 |
|
---|
57 |
|
---|
58 | /*********************************************************************************************************************************
|
---|
59 | * Defined Constants And Macros *
|
---|
60 | *********************************************************************************************************************************/
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|
64 | /*********************************************************************************************************************************
|
---|
65 | * Structures and Typedefs *
|
---|
66 | *********************************************************************************************************************************/
|
---|
67 |
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * AML object type.
|
---|
71 | */
|
---|
72 | typedef enum RTACPITBLAMLOBJTYPE
|
---|
73 | {
|
---|
74 | /** Invalid object type. */
|
---|
75 | kAcpiAmlObjType_Invalid = 0,
|
---|
76 | /** Unknown object type. */
|
---|
77 | kAcpiAmlObjType_Unknown,
|
---|
78 | /** Method object type. */
|
---|
79 | kAcpiAmlObjType_Method,
|
---|
80 | /** 32bit hack. */
|
---|
81 | kAcpiAmlObjType_32Bit_Hack = 0x7fffffff
|
---|
82 | } RTACPITBLAMLOBJTYPE;
|
---|
83 |
|
---|
84 |
|
---|
85 | /**
|
---|
86 | * Known object in namespace.
|
---|
87 | */
|
---|
88 | typedef struct RTACPITBLAMLOBJ
|
---|
89 | {
|
---|
90 | /** List node. */
|
---|
91 | RTLISTNODE NdObjs;
|
---|
92 | /** Object Type. */
|
---|
93 | RTACPITBLAMLOBJTYPE enmType;
|
---|
94 | /** Additional data depending on the type. */
|
---|
95 | union
|
---|
96 | {
|
---|
97 | /** Method object argument count. */
|
---|
98 | uint32_t cMethodArgs;
|
---|
99 | } u;
|
---|
100 | /** Zero terminated object name - variable in size. */
|
---|
101 | char szName[1];
|
---|
102 | } RTACPITBLAMLOBJ;
|
---|
103 | typedef RTACPITBLAMLOBJ *PRTACPITBLAMLOBJ;
|
---|
104 | typedef const RTACPITBLAMLOBJ *PCRTACPITBLAMLOBJ;
|
---|
105 |
|
---|
106 |
|
---|
107 |
|
---|
108 | /**
|
---|
109 | * ACPI AML -> ASL decoder state.
|
---|
110 | */
|
---|
111 | typedef struct RTACPITBLAMLDECODE
|
---|
112 | {
|
---|
113 | /** Pointe to the raw table data. */
|
---|
114 | const uint8_t *pbTbl;
|
---|
115 | /** Size of the table. */
|
---|
116 | uint32_t cbTbl;
|
---|
117 | /** Offset into the table. */
|
---|
118 | uint32_t offTbl;
|
---|
119 | /** Current stack level. */
|
---|
120 | uint32_t iLvl;
|
---|
121 | /** Number of entries in the package stack. */
|
---|
122 | uint32_t cPkgStackMax;
|
---|
123 | /** Stack of package lengths. */
|
---|
124 | size_t *pacbPkgLeft;
|
---|
125 | /** Stack of original package lengths. */
|
---|
126 | size_t *pacbPkg;
|
---|
127 | /** Flag whether to indent. */
|
---|
128 | bool fIndent;
|
---|
129 | /** List of known objects. */
|
---|
130 | RTLISTANCHOR LstObjs;
|
---|
131 | } RTACPITBLAMLDECODE;
|
---|
132 | /** Pointer to a ACPI AML -> ASL decoder state. */
|
---|
133 | typedef RTACPITBLAMLDECODE *PRTACPITBLAMLDECODE;
|
---|
134 |
|
---|
135 |
|
---|
136 | /**
|
---|
137 | * ACPI AML -> ASL decode callback
|
---|
138 | *
|
---|
139 | * @returns IPRT status code.
|
---|
140 | * @param pThis ACPI table decoder state.
|
---|
141 | * @param hVfsIosOut VFS I/O stream output handle.
|
---|
142 | * @param bOp The opcode.
|
---|
143 | * @param pErrInfo Where to return additional error information.
|
---|
144 | */
|
---|
145 | typedef DECLCALLBACKTYPE(int, FNRTACPITBLAMLOPCDECODE,(PRTACPITBLAMLDECODE pThis, RTVFSIOSTREAM hVfsIosOut, uint8_t bOp, PRTERRINFO pErrInfo));
|
---|
146 | /** Pointer to a ACPI AML -> ASL decode callback. */
|
---|
147 | typedef FNRTACPITBLAMLOPCDECODE *PFNRTACPITBLAMLOPCDECODE;
|
---|
148 |
|
---|
149 |
|
---|
150 | typedef enum ACPIAMLOPCTYPE
|
---|
151 | {
|
---|
152 | kAcpiAmlOpcType_Invalid = 0,
|
---|
153 | kAcpiAmlOpcType_Byte,
|
---|
154 | kAcpiAmlOpcType_Word,
|
---|
155 | kAcpiAmlOpcType_DWord,
|
---|
156 | kAcpiAmlOpcType_NameString,
|
---|
157 | kAcpiAmlOpcType_TermArg,
|
---|
158 | kAcpiAmlOpcType_SuperName,
|
---|
159 | kAcpiAmlOpcType_32BitHack = 0x7fffffff
|
---|
160 | } ACPIAMLOPCTYPE;
|
---|
161 |
|
---|
162 |
|
---|
163 | typedef struct RTACPIAMLOPC
|
---|
164 | {
|
---|
165 | /** Name of the opcode. */
|
---|
166 | const char *pszOpc;
|
---|
167 | /** Flags for the opcode. */
|
---|
168 | uint32_t fFlags;
|
---|
169 | /** Opcode type for the fields following. */
|
---|
170 | ACPIAMLOPCTYPE aenmTypes[5];
|
---|
171 | /** Optional decoder callback. */
|
---|
172 | PFNRTACPITBLAMLOPCDECODE pfnDecode;
|
---|
173 | } RTACPIAMLOPC;
|
---|
174 | typedef RTACPIAMLOPC *PRTACPIAMLOPC;
|
---|
175 | typedef const RTACPIAMLOPC *PCRTACPIAMLOPC;
|
---|
176 |
|
---|
177 | #define RTACPI_AML_OPC_F_NONE 0
|
---|
178 | #define RTACPI_AML_OPC_F_HAS_PKG_LENGTH RT_BIT_32(0)
|
---|
179 |
|
---|
180 |
|
---|
181 | /*********************************************************************************************************************************
|
---|
182 | * Global Variables *
|
---|
183 | *********************************************************************************************************************************/
|
---|
184 |
|
---|
185 |
|
---|
186 | /*********************************************************************************************************************************
|
---|
187 | * Internal Functions *
|
---|
188 | *********************************************************************************************************************************/
|
---|
189 |
|
---|
190 | static int rtAcpiTblAmlDecodeTerminal(PRTACPITBLAMLDECODE pThis, RTVFSIOSTREAM hVfsIosOut, PRTERRINFO pErrInfo);
|
---|
191 |
|
---|
192 |
|
---|
193 | DECLINLINE(int) rtAcpiTblAmlDecodeReadU8(PRTACPITBLAMLDECODE pThis, uint8_t *pb, PRTERRINFO pErrInfo)
|
---|
194 | {
|
---|
195 | if (pThis->offTbl < pThis->cbTbl)
|
---|
196 | { /* probable */ }
|
---|
197 | else
|
---|
198 | return RTErrInfoSetF(pErrInfo, VERR_EOF, "AML stream ended prematurely at offset '%#x' trying to read a byte", pThis->offTbl);
|
---|
199 |
|
---|
200 | if (!pThis->pacbPkgLeft[pThis->iLvl])
|
---|
201 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_STATE, "Data overflows current package limitation");
|
---|
202 |
|
---|
203 | pThis->pacbPkgLeft[pThis->iLvl]--;
|
---|
204 |
|
---|
205 | *pb = pThis->pbTbl[pThis->offTbl++];
|
---|
206 | return VINF_SUCCESS;
|
---|
207 | }
|
---|
208 |
|
---|
209 |
|
---|
210 | #if 0
|
---|
211 | DECLINLINE(int) rtAcpiTblAmlDecodeSkipU8IfEqual(PRTACPITBLAMLDECODE pThis, uint8_t ch, bool *fSkipped, PRTERRINFO pErrInfo)
|
---|
212 | {
|
---|
213 | if (pThis->offTbl < pThis->cbTbl)
|
---|
214 | { /* probable */ }
|
---|
215 | else
|
---|
216 | return RTErrInfoSetF(pErrInfo, VERR_EOF, "AML stream ended prematurely at offset '%#x' trying to read a byte", pThis->offTbl);
|
---|
217 |
|
---|
218 | if (pThis->pbTbl[pThis->offTbl] == ch)
|
---|
219 | {
|
---|
220 | pThis->offTbl++;
|
---|
221 | *pfSkipped = true;
|
---|
222 | }
|
---|
223 | else
|
---|
224 | *pfSkipped = false;
|
---|
225 | return VINF_SUCCESS;
|
---|
226 | }
|
---|
227 | #endif
|
---|
228 |
|
---|
229 |
|
---|
230 | DECLINLINE(int) rtAcpiTblAmlDecodeReadU16(PRTACPITBLAMLDECODE pThis, uint16_t *pu16, PRTERRINFO pErrInfo)
|
---|
231 | {
|
---|
232 | if (pThis->offTbl <= pThis->cbTbl + sizeof(uint16_t))
|
---|
233 | { /* probable */ }
|
---|
234 | else
|
---|
235 | return RTErrInfoSetF(pErrInfo, VERR_EOF, "AML stream ended prematurely at offset '%#x' trying to read two bytes", pThis->offTbl);
|
---|
236 |
|
---|
237 | if (pThis->pacbPkgLeft[pThis->iLvl] < sizeof(uint16_t))
|
---|
238 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_STATE, "Data overflows current package limitation");
|
---|
239 |
|
---|
240 | pThis->pacbPkgLeft[pThis->iLvl] -= sizeof(uint16_t);
|
---|
241 |
|
---|
242 | *pu16 = pThis->pbTbl[pThis->offTbl++];
|
---|
243 | *pu16 |= (uint16_t)pThis->pbTbl[pThis->offTbl++] << 8;
|
---|
244 | return VINF_SUCCESS;
|
---|
245 | }
|
---|
246 |
|
---|
247 |
|
---|
248 | DECLINLINE(int) rtAcpiTblAmlDecodeReadU32(PRTACPITBLAMLDECODE pThis, uint32_t *pu32, PRTERRINFO pErrInfo)
|
---|
249 | {
|
---|
250 | if (pThis->offTbl <= pThis->cbTbl + sizeof(uint32_t))
|
---|
251 | { /* probable */ }
|
---|
252 | else
|
---|
253 | return RTErrInfoSetF(pErrInfo, VERR_EOF, "AML stream ended prematurely at offset '%#x' trying to read four bytes", pThis->offTbl);
|
---|
254 |
|
---|
255 | if (pThis->pacbPkgLeft[pThis->iLvl] < sizeof(uint32_t))
|
---|
256 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_STATE, "Data overflows current package limitation");
|
---|
257 |
|
---|
258 | pThis->pacbPkgLeft[pThis->iLvl] -= sizeof(uint32_t);
|
---|
259 |
|
---|
260 | *pu32 = pThis->pbTbl[pThis->offTbl++];
|
---|
261 | *pu32 |= (uint32_t)pThis->pbTbl[pThis->offTbl++] << 8;
|
---|
262 | *pu32 |= (uint32_t)pThis->pbTbl[pThis->offTbl++] << 16;
|
---|
263 | *pu32 |= (uint32_t)pThis->pbTbl[pThis->offTbl++] << 24;
|
---|
264 | return VINF_SUCCESS;
|
---|
265 | }
|
---|
266 |
|
---|
267 |
|
---|
268 | DECLINLINE(int) rtAcpiTblAmlDecodeReadU64(PRTACPITBLAMLDECODE pThis, uint64_t *pu64, PRTERRINFO pErrInfo)
|
---|
269 | {
|
---|
270 | if (pThis->offTbl <= pThis->cbTbl + sizeof(uint64_t))
|
---|
271 | { /* probable */ }
|
---|
272 | else
|
---|
273 | return RTErrInfoSetF(pErrInfo, VERR_EOF, "AML stream ended prematurely at offset '%#x' trying to read eight bytes", pThis->offTbl);
|
---|
274 |
|
---|
275 | if (pThis->pacbPkgLeft[pThis->iLvl] < sizeof(uint64_t))
|
---|
276 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_STATE, "Data overflows current package limitation");
|
---|
277 |
|
---|
278 | pThis->pacbPkgLeft[pThis->iLvl] -= sizeof(uint64_t);
|
---|
279 |
|
---|
280 | *pu64 = pThis->pbTbl[pThis->offTbl++];
|
---|
281 | *pu64 |= (uint64_t)pThis->pbTbl[pThis->offTbl++] << 8;
|
---|
282 | *pu64 |= (uint64_t)pThis->pbTbl[pThis->offTbl++] << 16;
|
---|
283 | *pu64 |= (uint64_t)pThis->pbTbl[pThis->offTbl++] << 24;
|
---|
284 | *pu64 |= (uint64_t)pThis->pbTbl[pThis->offTbl++] << 32;
|
---|
285 | *pu64 |= (uint64_t)pThis->pbTbl[pThis->offTbl++] << 40;
|
---|
286 | *pu64 |= (uint64_t)pThis->pbTbl[pThis->offTbl++] << 48;
|
---|
287 | *pu64 |= (uint64_t)pThis->pbTbl[pThis->offTbl++] << 54;
|
---|
288 | return VINF_SUCCESS;
|
---|
289 | }
|
---|
290 |
|
---|
291 |
|
---|
292 | static int rtAcpiTblAmlDecodeNameSeg(PRTACPITBLAMLDECODE pThis, char *pszNameString, PRTERRINFO pErrInfo)
|
---|
293 | {
|
---|
294 | uint8_t abNameSeg[4];
|
---|
295 | for (uint8_t i = 0; i < sizeof(abNameSeg); i++)
|
---|
296 | {
|
---|
297 | int rc = rtAcpiTblAmlDecodeReadU8(pThis, &abNameSeg[i], pErrInfo);
|
---|
298 | if (RT_FAILURE(rc)) return rc;
|
---|
299 | }
|
---|
300 |
|
---|
301 | /* LeadNameChar */
|
---|
302 | if ( abNameSeg[0] != '_'
|
---|
303 | && !RTLocCIsUpper(abNameSeg[0]))
|
---|
304 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_PARAMETER, "AML stream contains invalid lead name character '%#02RX8'", abNameSeg[0]);
|
---|
305 |
|
---|
306 | for (uint8_t i = 1; i < sizeof(abNameSeg); i++)
|
---|
307 | {
|
---|
308 | if ( abNameSeg[i] != '_'
|
---|
309 | && !RTLocCIsUpper(abNameSeg[i])
|
---|
310 | && !RTLocCIsDigit(abNameSeg[i]))
|
---|
311 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_PARAMETER, "AML stream contains invalid name character '%#02RX8", abNameSeg[i]);
|
---|
312 | }
|
---|
313 |
|
---|
314 | pszNameString[0] = (char)abNameSeg[0];
|
---|
315 | pszNameString[1] = (char)abNameSeg[1];
|
---|
316 | pszNameString[2] = (char)abNameSeg[2];
|
---|
317 | pszNameString[3] = (char)abNameSeg[3];
|
---|
318 | return VINF_SUCCESS;
|
---|
319 | }
|
---|
320 |
|
---|
321 |
|
---|
322 | static int rtAcpiTblAmlDecodeNameSegWithoutLeadChar(PRTACPITBLAMLDECODE pThis, uint8_t bLeadChar, char *pszNameString, PRTERRINFO pErrInfo)
|
---|
323 | {
|
---|
324 | uint8_t abNameSeg[3];
|
---|
325 | for (uint8_t i = 0; i < sizeof(abNameSeg); i++)
|
---|
326 | {
|
---|
327 | int rc = rtAcpiTblAmlDecodeReadU8(pThis, &abNameSeg[i], pErrInfo);
|
---|
328 | if (RT_FAILURE(rc)) return rc;
|
---|
329 | }
|
---|
330 |
|
---|
331 | /* LeadNameChar */
|
---|
332 | if ( bLeadChar != '_'
|
---|
333 | && !RTLocCIsUpper(bLeadChar))
|
---|
334 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_PARAMETER, "AML stream contains invalid lead name character '%#02RX8'", bLeadChar);
|
---|
335 |
|
---|
336 | for (uint8_t i = 1; i < sizeof(abNameSeg); i++)
|
---|
337 | {
|
---|
338 | if ( abNameSeg[i] != '_'
|
---|
339 | && !RTLocCIsUpper(abNameSeg[i])
|
---|
340 | && !RTLocCIsDigit(abNameSeg[i]))
|
---|
341 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_PARAMETER, "AML stream contains invalid name character '%#02RX8'", abNameSeg[i]);
|
---|
342 | }
|
---|
343 |
|
---|
344 | pszNameString[0] = (char)bLeadChar;
|
---|
345 | pszNameString[1] = (char)abNameSeg[0];
|
---|
346 | pszNameString[2] = (char)abNameSeg[1];
|
---|
347 | pszNameString[3] = (char)abNameSeg[2];
|
---|
348 | return VINF_SUCCESS;
|
---|
349 | }
|
---|
350 |
|
---|
351 |
|
---|
352 | static int rtAcpiTblAmlDecodeNameStringWithLead(PRTACPITBLAMLDECODE pThis, uint8_t bLeadChar, char *pszNameString, size_t cchNameString, size_t *pcbNameString, PRTERRINFO pErrInfo)
|
---|
353 | {
|
---|
354 | AssertReturn(cchNameString >= 5, VERR_INVALID_PARAMETER); /* One name segment is at least 4 bytes (+ terminator). */
|
---|
355 |
|
---|
356 | /* Check for a root path. */
|
---|
357 | int rc = VINF_SUCCESS;
|
---|
358 | uint8_t bTmp = bLeadChar;
|
---|
359 | size_t idxName = 0;
|
---|
360 | if (bTmp == '\\')
|
---|
361 | {
|
---|
362 | pszNameString[idxName++] = '\\';
|
---|
363 |
|
---|
364 | rc = rtAcpiTblAmlDecodeReadU8(pThis, &bTmp, pErrInfo);
|
---|
365 | if (RT_FAILURE(rc)) return rc;
|
---|
366 | }
|
---|
367 | else if (bTmp == '^')
|
---|
368 | {
|
---|
369 | /* Prefix path, can have multiple ^ prefixes. */
|
---|
370 | pszNameString[idxName++] = '^';
|
---|
371 |
|
---|
372 | for (;;)
|
---|
373 | {
|
---|
374 | rc = rtAcpiTblAmlDecodeReadU8(pThis, &bTmp, pErrInfo);
|
---|
375 | if (RT_FAILURE(rc)) return rc;
|
---|
376 |
|
---|
377 | if (bTmp != '^')
|
---|
378 | break;
|
---|
379 |
|
---|
380 | if (idxName == cchNameString - 1)
|
---|
381 | return RTErrInfoSetF(pErrInfo, VERR_BUFFER_OVERFLOW, "PrefixPath in AML byte stream is too long to fit into a %zu byte buffer",
|
---|
382 | cchNameString - 1);
|
---|
383 |
|
---|
384 | pszNameString[idxName++] = '^';
|
---|
385 | }
|
---|
386 | }
|
---|
387 |
|
---|
388 | if (bTmp == ACPI_AML_BYTE_CODE_PREFIX_DUAL_NAME)
|
---|
389 | {
|
---|
390 | if (idxName + 8 < cchNameString)
|
---|
391 | {
|
---|
392 | rc = rtAcpiTblAmlDecodeNameSeg(pThis, &pszNameString[idxName], pErrInfo);
|
---|
393 | if (RT_FAILURE(rc)) return rc;
|
---|
394 |
|
---|
395 | rc = rtAcpiTblAmlDecodeNameSeg(pThis, &pszNameString[idxName + 4], pErrInfo);
|
---|
396 | if (RT_FAILURE(rc)) return rc;
|
---|
397 |
|
---|
398 | idxName += 8;
|
---|
399 | pszNameString[idxName] = '\0';
|
---|
400 | }
|
---|
401 | else
|
---|
402 | rc = RTErrInfoSetF(pErrInfo, VERR_BUFFER_OVERFLOW, "DualNamePrefix string in AML byte stream is too long to fit into a %zu byte buffer",
|
---|
403 | cchNameString - 1);
|
---|
404 | }
|
---|
405 | else if (bTmp == ACPI_AML_BYTE_CODE_PREFIX_MULTI_NAME)
|
---|
406 | {
|
---|
407 | uint8_t cSegs = 0;
|
---|
408 | rc = rtAcpiTblAmlDecodeReadU8(pThis, &cSegs, pErrInfo);
|
---|
409 | if (RT_FAILURE(rc)) return rc;
|
---|
410 |
|
---|
411 | if (idxName + cSegs * 4 < cchNameString)
|
---|
412 | {
|
---|
413 | for (uint8_t i = 0; i < cSegs; i++)
|
---|
414 | {
|
---|
415 | rc = rtAcpiTblAmlDecodeNameSeg(pThis, &pszNameString[idxName + i * 4], pErrInfo);
|
---|
416 | if (RT_FAILURE(rc)) return rc;
|
---|
417 | }
|
---|
418 |
|
---|
419 | idxName += cSegs * 4;
|
---|
420 | pszNameString[idxName] = '\0';
|
---|
421 | }
|
---|
422 | else
|
---|
423 | rc = RTErrInfoSetF(pErrInfo, VERR_BUFFER_OVERFLOW, "MultiNamePrefix string in AML byte stream is too long to fit into a %zu byte buffer",
|
---|
424 | cchNameString - 1);
|
---|
425 | }
|
---|
426 | else if (bTmp == ACPI_AML_BYTE_CODE_PREFIX_NULL_NAME)
|
---|
427 | pszNameString[idxName] = '\0';
|
---|
428 | else
|
---|
429 | {
|
---|
430 | if (idxName + 4 < cchNameString)
|
---|
431 | {
|
---|
432 | rc = rtAcpiTblAmlDecodeNameSegWithoutLeadChar(pThis, bTmp, &pszNameString[idxName], pErrInfo);
|
---|
433 | if (RT_FAILURE(rc)) return rc;
|
---|
434 |
|
---|
435 | idxName += 4;
|
---|
436 | pszNameString[idxName] = '\0';
|
---|
437 | }
|
---|
438 | else
|
---|
439 | rc = RTErrInfoSetF(pErrInfo, VERR_BUFFER_OVERFLOW, "Name string in AML byte stream is too long to fit into a %zu byte buffer",
|
---|
440 | cchNameString - 1);
|
---|
441 | }
|
---|
442 |
|
---|
443 | *pcbNameString = idxName;
|
---|
444 | return rc;
|
---|
445 | }
|
---|
446 |
|
---|
447 |
|
---|
448 | static int rtAcpiTblAmlDecodeNameString(PRTACPITBLAMLDECODE pThis, char *pszNameString, size_t cchNameString, size_t *pcbNameString, PRTERRINFO pErrInfo)
|
---|
449 | {
|
---|
450 | AssertReturn(cchNameString >= 5, VERR_INVALID_PARAMETER); /* One name segment is at least 4 bytes (+ terminator). */
|
---|
451 |
|
---|
452 | uint8_t bLead = 0; /* shut up gcc */
|
---|
453 | int rc = rtAcpiTblAmlDecodeReadU8(pThis, &bLead, pErrInfo);
|
---|
454 | if (RT_FAILURE(rc)) return rc;
|
---|
455 |
|
---|
456 | return rtAcpiTblAmlDecodeNameStringWithLead( pThis, bLead, pszNameString, cchNameString, pcbNameString, pErrInfo);
|
---|
457 | }
|
---|
458 |
|
---|
459 |
|
---|
460 | /**
|
---|
461 | * Adds the proper indentation before a new line.
|
---|
462 | *
|
---|
463 | * @returns IPRT status code.
|
---|
464 | * @param hVfsIos The VFS I/O stream handle to dump the ASL to.
|
---|
465 | * @param uIndentLvl The level of indentation.
|
---|
466 | */
|
---|
467 | static int rtAcpiTblAmlDecodeIndent(RTVFSIOSTREAM hVfsIos, uint32_t uIndentLvl)
|
---|
468 | {
|
---|
469 | ssize_t cch = RTVfsIoStrmPrintf(hVfsIos, "\n");
|
---|
470 | if (cch != 1)
|
---|
471 | return cch < 0 ? (int)cch : VERR_BUFFER_UNDERFLOW;
|
---|
472 |
|
---|
473 | while (uIndentLvl--)
|
---|
474 | {
|
---|
475 | cch = RTVfsIoStrmPrintf(hVfsIos, " ");
|
---|
476 | if (cch != 4)
|
---|
477 | return cch < 0 ? (int)cch : VERR_BUFFER_UNDERFLOW;
|
---|
478 | }
|
---|
479 |
|
---|
480 | return VINF_SUCCESS;
|
---|
481 | }
|
---|
482 |
|
---|
483 |
|
---|
484 | static int rtAcpiTblAmlDecodeFormat(PRTACPITBLAMLDECODE pThis, RTVFSIOSTREAM hVfsIos, const char *pszFmt, ...)
|
---|
485 | {
|
---|
486 | int rc = VINF_SUCCESS;
|
---|
487 | if (pThis->fIndent)
|
---|
488 | rc = rtAcpiTblAmlDecodeIndent(hVfsIos, pThis->iLvl);
|
---|
489 | if (RT_SUCCESS(rc))
|
---|
490 | {
|
---|
491 | va_list VaArgs;
|
---|
492 | va_start(VaArgs, pszFmt);
|
---|
493 | ssize_t cch = RTVfsIoStrmPrintfV(hVfsIos, pszFmt, VaArgs);
|
---|
494 | va_end(VaArgs);
|
---|
495 | if (cch <= 0)
|
---|
496 | rc = cch < 0 ? (int)cch : VERR_NO_MEMORY;
|
---|
497 | }
|
---|
498 |
|
---|
499 | return rc;
|
---|
500 | }
|
---|
501 |
|
---|
502 |
|
---|
503 | static int rtAcpiTblAmlDecodePkgLength(PRTACPITBLAMLDECODE pThis, size_t *pcbPkg, size_t *pcbPkgLength, PRTERRINFO pErrInfo)
|
---|
504 | {
|
---|
505 | uint8_t bTmp = 0; /* shut up gcc */
|
---|
506 | int rc = rtAcpiTblAmlDecodeReadU8(pThis, &bTmp, pErrInfo);
|
---|
507 | if (RT_FAILURE(rc))
|
---|
508 | return rc;
|
---|
509 |
|
---|
510 | /* High 2 bits give the remaining bytes following to form the final package length. */
|
---|
511 | uint8_t cBytesRemaining = (bTmp >> 6) & 0x3;
|
---|
512 | *pcbPkgLength = 1 + cBytesRemaining;
|
---|
513 |
|
---|
514 | if (cBytesRemaining)
|
---|
515 | {
|
---|
516 | size_t cbPkg = bTmp & 0xf;
|
---|
517 | for (uint8_t i = 0; i < cBytesRemaining; i++)
|
---|
518 | {
|
---|
519 | rc = rtAcpiTblAmlDecodeReadU8(pThis, &bTmp, pErrInfo);
|
---|
520 | if (RT_FAILURE(rc))
|
---|
521 | return rc;
|
---|
522 |
|
---|
523 | cbPkg |= (size_t)bTmp << (i * 8 + 4);
|
---|
524 | *pcbPkg = cbPkg;
|
---|
525 | }
|
---|
526 | }
|
---|
527 | else
|
---|
528 | *pcbPkg = bTmp & 0x3f;
|
---|
529 |
|
---|
530 | return VINF_SUCCESS;
|
---|
531 | }
|
---|
532 |
|
---|
533 |
|
---|
534 | static int rtAcpiTblAmlDecodePkgPush(PRTACPITBLAMLDECODE pThis, RTVFSIOSTREAM hVfsIosOut, size_t cbPkg, PRTERRINFO pErrInfo)
|
---|
535 | {
|
---|
536 | /* Get a new stack element. */
|
---|
537 | if (pThis->iLvl == pThis->cPkgStackMax)
|
---|
538 | {
|
---|
539 | uint32_t const cPkgElemsNew = pThis->cPkgStackMax + 8;
|
---|
540 | size_t *pacbPkgLeftNew = (size_t *)RTMemRealloc(pThis->pacbPkgLeft, 2 * cPkgElemsNew * sizeof(*pacbPkgLeftNew));
|
---|
541 | if (!pacbPkgLeftNew)
|
---|
542 | return RTErrInfoSetF(pErrInfo, VERR_NO_MEMORY, "Out of memory pushing a new package onto the stack");
|
---|
543 |
|
---|
544 | pThis->pacbPkgLeft = pacbPkgLeftNew;
|
---|
545 | pThis->pacbPkg = pacbPkgLeftNew + cPkgElemsNew;
|
---|
546 | pThis->cPkgStackMax = cPkgElemsNew;
|
---|
547 | }
|
---|
548 |
|
---|
549 | uint32_t const iLvlNew = pThis->iLvl + 1;
|
---|
550 | pThis->pacbPkgLeft[iLvlNew] = cbPkg;
|
---|
551 | pThis->pacbPkg[iLvlNew] = cbPkg;
|
---|
552 | int rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "{");
|
---|
553 | pThis->iLvl = iLvlNew;
|
---|
554 | return rc;
|
---|
555 | }
|
---|
556 |
|
---|
557 |
|
---|
558 | DECLINLINE(int) rtAcpiTblAmlDecodePkgPop(PRTACPITBLAMLDECODE pThis, RTVFSIOSTREAM hVfsIosOut, PRTERRINFO pErrInfo)
|
---|
559 | {
|
---|
560 | while (!pThis->pacbPkgLeft[pThis->iLvl])
|
---|
561 | {
|
---|
562 | size_t cbPkg = pThis->pacbPkg[pThis->iLvl];
|
---|
563 | pThis->iLvl--;
|
---|
564 |
|
---|
565 | if (pThis->pacbPkgLeft[pThis->iLvl] < cbPkg)
|
---|
566 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_STATE, "AML contains invalid package length encoding");
|
---|
567 |
|
---|
568 | pThis->pacbPkgLeft[pThis->iLvl] -= cbPkg;
|
---|
569 | int rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "}");
|
---|
570 | if (RT_FAILURE(rc))
|
---|
571 | return rc;
|
---|
572 | }
|
---|
573 |
|
---|
574 | return VINF_SUCCESS;
|
---|
575 | }
|
---|
576 |
|
---|
577 |
|
---|
578 | static int rtAcpiTblAmlDecodeIntegerFromPrefix(PRTACPITBLAMLDECODE pThis, uint8_t bPrefix, uint64_t *pu64, size_t cbDecodeMax, size_t *pcbDecoded, PRTERRINFO pErrInfo)
|
---|
579 | {
|
---|
580 | switch (bPrefix)
|
---|
581 | {
|
---|
582 | case ACPI_AML_BYTE_CODE_PREFIX_BYTE:
|
---|
583 | {
|
---|
584 | if (!cbDecodeMax)
|
---|
585 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_STATE, "Not enough data left to decode byte integer in AML stream");
|
---|
586 |
|
---|
587 | uint8_t bInt = 0;
|
---|
588 | int rc = rtAcpiTblAmlDecodeReadU8(pThis, &bInt, pErrInfo);
|
---|
589 | if (RT_FAILURE(rc))
|
---|
590 | return rc;
|
---|
591 |
|
---|
592 | *pu64 = bInt;
|
---|
593 | *pcbDecoded = 2;
|
---|
594 | break;
|
---|
595 | }
|
---|
596 | case ACPI_AML_BYTE_CODE_PREFIX_WORD:
|
---|
597 | {
|
---|
598 | if (cbDecodeMax < 2)
|
---|
599 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_STATE, "Not enough data left to decode word integer in AML stream");
|
---|
600 |
|
---|
601 | uint16_t u16 = 0;
|
---|
602 | int rc = rtAcpiTblAmlDecodeReadU16(pThis, &u16, pErrInfo);
|
---|
603 | if (RT_FAILURE(rc))
|
---|
604 | return rc;
|
---|
605 |
|
---|
606 | *pu64 = u16;
|
---|
607 | *pcbDecoded = 3;
|
---|
608 | break;
|
---|
609 | }
|
---|
610 | case ACPI_AML_BYTE_CODE_PREFIX_DWORD:
|
---|
611 | {
|
---|
612 | if (cbDecodeMax < 4)
|
---|
613 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_STATE, "Not enough data left to decode double word integer in AML stream");
|
---|
614 |
|
---|
615 | uint32_t u32 = 0;
|
---|
616 | int rc = rtAcpiTblAmlDecodeReadU32(pThis, &u32, pErrInfo);
|
---|
617 | if (RT_FAILURE(rc))
|
---|
618 | return rc;
|
---|
619 |
|
---|
620 | *pu64 = u32;
|
---|
621 | *pcbDecoded = 5;
|
---|
622 | break;
|
---|
623 | }
|
---|
624 | case ACPI_AML_BYTE_CODE_PREFIX_QWORD:
|
---|
625 | {
|
---|
626 | if (cbDecodeMax < 8)
|
---|
627 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_STATE, "Not enough data left to decode quad word integer in AML stream");
|
---|
628 |
|
---|
629 | uint64_t u64 = 0;
|
---|
630 | int rc = rtAcpiTblAmlDecodeReadU64(pThis, &u64, pErrInfo);
|
---|
631 | if (RT_FAILURE(rc))
|
---|
632 | return rc;
|
---|
633 |
|
---|
634 | *pu64 = u64;
|
---|
635 | *pcbDecoded = 9;
|
---|
636 | break;
|
---|
637 | }
|
---|
638 | default:
|
---|
639 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_STATE, "Invalid integer prefix '%#02RX8'", bPrefix);
|
---|
640 | }
|
---|
641 |
|
---|
642 | return VINF_SUCCESS;
|
---|
643 | }
|
---|
644 |
|
---|
645 |
|
---|
646 | static int rtAcpiTblAmlDecodeIntegerWorker(PRTACPITBLAMLDECODE pThis, uint64_t *pu64, size_t cbDecodeMax, size_t *pcbDecoded, PRTERRINFO pErrInfo)
|
---|
647 | {
|
---|
648 | AssertReturn(cbDecodeMax >= 1, VERR_INVALID_PARAMETER);
|
---|
649 |
|
---|
650 | uint8_t bPrefix = 0; /* shut up gcc */
|
---|
651 | int rc = rtAcpiTblAmlDecodeReadU8(pThis, &bPrefix, pErrInfo);
|
---|
652 | if (RT_FAILURE(rc))
|
---|
653 | return rc;
|
---|
654 |
|
---|
655 | cbDecodeMax--;
|
---|
656 | return rtAcpiTblAmlDecodeIntegerFromPrefix(pThis, bPrefix, pu64, cbDecodeMax, pcbDecoded, pErrInfo);
|
---|
657 | }
|
---|
658 |
|
---|
659 |
|
---|
660 | static DECLCALLBACK(int) rtAcpiTblAmlDecodeNameObject(PRTACPITBLAMLDECODE pThis, RTVFSIOSTREAM hVfsIosOut, uint8_t bOp, PRTERRINFO pErrInfo)
|
---|
661 | {
|
---|
662 | char szName[512];
|
---|
663 | size_t cbName = 0;
|
---|
664 |
|
---|
665 | int rc = rtAcpiTblAmlDecodeNameStringWithLead(pThis, bOp, &szName[0], sizeof(szName), &cbName, pErrInfo);
|
---|
666 | if (RT_FAILURE(rc)) return rc;
|
---|
667 |
|
---|
668 | PRTACPITBLAMLOBJ pIt;
|
---|
669 | bool fFound = false;
|
---|
670 | RTListForEach(&pThis->LstObjs, pIt, RTACPITBLAMLOBJ, NdObjs)
|
---|
671 | {
|
---|
672 | if (!strcmp(pIt->szName, szName))
|
---|
673 | {
|
---|
674 | fFound = true;
|
---|
675 | break;
|
---|
676 | }
|
---|
677 | }
|
---|
678 |
|
---|
679 | if (fFound)
|
---|
680 | {
|
---|
681 | if (pIt->enmType == kAcpiAmlObjType_Method)
|
---|
682 | {
|
---|
683 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%s(", szName);
|
---|
684 | if (RT_FAILURE(rc)) return rc;
|
---|
685 |
|
---|
686 | bool fIndentOld = pThis->fIndent;
|
---|
687 | pThis->fIndent = false;
|
---|
688 | for (uint32_t iArg = 0; iArg < pIt->u.cMethodArgs; iArg++)
|
---|
689 | {
|
---|
690 | rc = rtAcpiTblAmlDecodeTerminal(pThis, hVfsIosOut, pErrInfo);
|
---|
691 | if (RT_FAILURE(rc)) return rc;
|
---|
692 |
|
---|
693 | if (iArg < pIt->u.cMethodArgs - 1)
|
---|
694 | {
|
---|
695 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, ", ", szName);
|
---|
696 | if (RT_FAILURE(rc)) return rc;
|
---|
697 | }
|
---|
698 | }
|
---|
699 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, ")");
|
---|
700 | pThis->fIndent = fIndentOld;
|
---|
701 | }
|
---|
702 | else
|
---|
703 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%s", szName);
|
---|
704 | }
|
---|
705 | else
|
---|
706 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%s", szName);
|
---|
707 |
|
---|
708 | return rc;
|
---|
709 | }
|
---|
710 |
|
---|
711 |
|
---|
712 | static DECLCALLBACK(int) rtAcpiTblAmlDecodeString(PRTACPITBLAMLDECODE pThis, RTVFSIOSTREAM hVfsIosOut, uint8_t bOp, PRTERRINFO pErrInfo)
|
---|
713 | {
|
---|
714 | RT_NOREF(bOp);
|
---|
715 |
|
---|
716 | char szStr[512];
|
---|
717 | uint32_t i = 0;
|
---|
718 | for (;;)
|
---|
719 | {
|
---|
720 | uint8_t bTmp = 0; /* shut up gcc */
|
---|
721 | int rc = rtAcpiTblAmlDecodeReadU8(pThis, &bTmp, pErrInfo);
|
---|
722 | if (RT_FAILURE(rc))
|
---|
723 | return rc;
|
---|
724 |
|
---|
725 | if (bTmp >= 0x1 && bTmp <= 0x7f)
|
---|
726 | szStr[i++] = (char)bTmp;
|
---|
727 | else if (bTmp == 0x00)
|
---|
728 | {
|
---|
729 | szStr[i++] = '\0';
|
---|
730 | break;
|
---|
731 | }
|
---|
732 | else
|
---|
733 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_STATE, "Invalid ASCII string character %#x in string", bTmp);
|
---|
734 |
|
---|
735 | if (i == sizeof(szStr))
|
---|
736 | return RTErrInfoSetF(pErrInfo, VERR_BUFFER_OVERFLOW, "ASCII string is out of bounds");
|
---|
737 | }
|
---|
738 |
|
---|
739 | return rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "\"%s\"", szStr);
|
---|
740 | }
|
---|
741 |
|
---|
742 |
|
---|
743 | static DECLCALLBACK(int) rtAcpiTblAmlDecodeBuffer(PRTACPITBLAMLDECODE pThis, RTVFSIOSTREAM hVfsIosOut, uint8_t bOp, PRTERRINFO pErrInfo)
|
---|
744 | {
|
---|
745 | RT_NOREF(bOp);
|
---|
746 |
|
---|
747 | size_t cbPkg = 0;
|
---|
748 | size_t cbPkgLength = 0;
|
---|
749 | int rc = rtAcpiTblAmlDecodePkgLength(pThis, &cbPkg, &cbPkgLength, pErrInfo);
|
---|
750 | if (RT_FAILURE(rc))
|
---|
751 | return rc;
|
---|
752 |
|
---|
753 | cbPkg -= cbPkgLength;
|
---|
754 | uint64_t u64 = 0;
|
---|
755 | size_t cbInt = 0;
|
---|
756 | rc = rtAcpiTblAmlDecodeIntegerWorker(pThis, &u64, cbPkg, &cbInt, pErrInfo);
|
---|
757 | if (RT_FAILURE(rc))
|
---|
758 | return rc;
|
---|
759 |
|
---|
760 | cbPkg -= cbInt;
|
---|
761 |
|
---|
762 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "Buffer (%RU64) {", u64);
|
---|
763 | if (RT_FAILURE(rc))
|
---|
764 | return rc;
|
---|
765 |
|
---|
766 | /* Decode remaining bytes. */
|
---|
767 | while (cbPkg--)
|
---|
768 | {
|
---|
769 | uint8_t bTmp = 0;
|
---|
770 | rc = rtAcpiTblAmlDecodeReadU8(pThis, &bTmp, pErrInfo);
|
---|
771 | if (RT_FAILURE(rc))
|
---|
772 | return rc;
|
---|
773 |
|
---|
774 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%#02RX8%s", bTmp, cbPkg ? "," : "");
|
---|
775 | if (RT_FAILURE(rc))
|
---|
776 | return rc;
|
---|
777 | }
|
---|
778 |
|
---|
779 | return rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "}");
|
---|
780 | }
|
---|
781 |
|
---|
782 |
|
---|
783 | static DECLCALLBACK(int) rtAcpiTblAmlDecodeInteger(PRTACPITBLAMLDECODE pThis, RTVFSIOSTREAM hVfsIosOut, uint8_t bOp, PRTERRINFO pErrInfo)
|
---|
784 | {
|
---|
785 | uint64_t u64 = 0;
|
---|
786 | size_t cbDecoded = 0;
|
---|
787 | int rc = rtAcpiTblAmlDecodeIntegerFromPrefix(pThis, bOp, &u64, sizeof(uint64_t), &cbDecoded, pErrInfo);
|
---|
788 | if (RT_FAILURE(rc))
|
---|
789 | return rc;
|
---|
790 |
|
---|
791 | return rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%#RX64", u64);
|
---|
792 | }
|
---|
793 |
|
---|
794 |
|
---|
795 | static DECLCALLBACK(int) rtAcpiTblAmlDecodeMethod(PRTACPITBLAMLDECODE pThis, RTVFSIOSTREAM hVfsIosOut, uint8_t bOp, PRTERRINFO pErrInfo)
|
---|
796 | {
|
---|
797 | RT_NOREF(bOp);
|
---|
798 |
|
---|
799 | size_t cbPkg = 0;
|
---|
800 | size_t cbPkgLength = 0;
|
---|
801 | int rc = rtAcpiTblAmlDecodePkgLength(pThis, &cbPkg, &cbPkgLength, pErrInfo);
|
---|
802 | if (RT_FAILURE(rc))
|
---|
803 | return rc;
|
---|
804 |
|
---|
805 | size_t cbPkgConsumed = cbPkgLength;
|
---|
806 | char szName[512]; RT_ZERO(szName);
|
---|
807 | size_t cchName = 0;
|
---|
808 | rc = rtAcpiTblAmlDecodeNameString(pThis, &szName[0], sizeof(szName), &cchName, pErrInfo);
|
---|
809 | if (RT_FAILURE(rc))
|
---|
810 | return rc;
|
---|
811 |
|
---|
812 | cbPkgConsumed += cchName;
|
---|
813 |
|
---|
814 | uint8_t bMethod;
|
---|
815 | rc = rtAcpiTblAmlDecodeReadU8(pThis, &bMethod, pErrInfo);
|
---|
816 | if (RT_FAILURE(rc))
|
---|
817 | return rc;
|
---|
818 |
|
---|
819 | cbPkgConsumed++;
|
---|
820 |
|
---|
821 | if (cbPkg < cbPkgConsumed)
|
---|
822 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_STATE, "Number of bytes consumed for the current package exceeds package length (%zu vs %zu)",
|
---|
823 | cbPkgConsumed, cbPkg);
|
---|
824 |
|
---|
825 | PRTACPITBLAMLOBJ pObj = (PRTACPITBLAMLOBJ)RTMemAllocZ(RT_UOFFSETOF_DYN(RTACPITBLAMLOBJ, szName[cchName + 1]));
|
---|
826 | if (!pObj)
|
---|
827 | return RTErrInfoSetF(pErrInfo, VERR_NO_MEMORY, "Failed to allocate %zu bytes for method object %s",
|
---|
828 | RT_UOFFSETOF_DYN(RTACPITBLAMLOBJ, szName[cchName + 1]), szName);
|
---|
829 |
|
---|
830 | pObj->enmType = kAcpiAmlObjType_Method;
|
---|
831 | pObj->u.cMethodArgs = bMethod & 0x7;
|
---|
832 | memcpy(&pObj->szName[0], &szName[0], cchName);
|
---|
833 | RTListAppend(&pThis->LstObjs, &pObj->NdObjs);
|
---|
834 |
|
---|
835 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "Method(%s, %u, %s, %u)",
|
---|
836 | pObj->szName, pObj->u.cMethodArgs, bMethod & RT_BIT(3) ? "Serialized" : "NotSerialized",
|
---|
837 | bMethod >> 4);
|
---|
838 | if (RT_FAILURE(rc))
|
---|
839 | return rc;
|
---|
840 | return rtAcpiTblAmlDecodePkgPush(pThis, hVfsIosOut, cbPkg - cbPkgConsumed, pErrInfo);
|
---|
841 | }
|
---|
842 |
|
---|
843 |
|
---|
844 | /**
|
---|
845 | * AML Opcode -> ASL decoder array.
|
---|
846 | */
|
---|
847 | static const RTACPIAMLOPC g_aAmlOpcodeDecode[] =
|
---|
848 | {
|
---|
849 | #define RTACPI_AML_OPC_INVALID \
|
---|
850 | { NULL, RTACPI_AML_OPC_F_NONE, { kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL }
|
---|
851 | #define RTACPI_AML_OPC_SIMPLE_0(a_pszOpc, a_fFlags) \
|
---|
852 | { a_pszOpc, a_fFlags, { kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL }
|
---|
853 | #define RTACPI_AML_OPC_SIMPLE_1(a_pszOpc, a_fFlags, a_enmType0) \
|
---|
854 | { a_pszOpc, a_fFlags, { a_enmType0, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL }
|
---|
855 | #define RTACPI_AML_OPC_SIMPLE_2(a_pszOpc, a_fFlags, a_enmType0, a_enmType1) \
|
---|
856 | { a_pszOpc, a_fFlags, { a_enmType0, a_enmType1, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL }
|
---|
857 | #define RTACPI_AML_OPC_SIMPLE_3(a_pszOpc, a_fFlags, a_enmType0, a_enmType1, a_enmType2) \
|
---|
858 | { a_pszOpc, a_fFlags, { a_enmType0, a_enmType1, a_enmType2, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL }
|
---|
859 | #define RTACPI_AML_OPC_SIMPLE_4(a_pszOpc, a_fFlags, a_enmType0, a_enmType1, a_enmType2, a_enmType3) \
|
---|
860 | { a_pszOpc, a_fFlags, { a_enmType0, a_enmType1, a_enmType2, a_enmType3, kAcpiAmlOpcType_Invalid }, NULL }
|
---|
861 | #define RTACPI_AML_OPC_SIMPLE_5(a_pszOpc, a_fFlags, a_enmType0, a_enmType1, a_enmType2, a_enmType3, a_enmType4) \
|
---|
862 | { a_pszOpc, a_fFlags, { a_enmType0, a_enmType1, a_enmType2, a_enmType3, a_enmType4 }, NULL }
|
---|
863 | #define RTACPI_AML_OPC_HANDLER(a_pszOpc, a_pfnHandler) \
|
---|
864 | { a_pszOpc, RTACPI_AML_OPC_F_NONE, { kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, a_pfnHandler }
|
---|
865 |
|
---|
866 | /* 0x00 */ RTACPI_AML_OPC_SIMPLE_0("Zero", RTACPI_AML_OPC_F_NONE),
|
---|
867 | /* 0x01 */ RTACPI_AML_OPC_SIMPLE_0("One", RTACPI_AML_OPC_F_NONE),
|
---|
868 | /* 0x02 */ RTACPI_AML_OPC_INVALID,
|
---|
869 | /* 0x03 */ RTACPI_AML_OPC_INVALID,
|
---|
870 | /* 0x04 */ RTACPI_AML_OPC_INVALID,
|
---|
871 | /* 0x05 */ RTACPI_AML_OPC_INVALID,
|
---|
872 | /* 0x06 */ RTACPI_AML_OPC_INVALID,
|
---|
873 | /* 0x07 */ RTACPI_AML_OPC_INVALID,
|
---|
874 | /* 0x08 */ RTACPI_AML_OPC_SIMPLE_2("Name", 0, kAcpiAmlOpcType_NameString, kAcpiAmlOpcType_TermArg),
|
---|
875 | /* 0x09 */ RTACPI_AML_OPC_INVALID,
|
---|
876 | /* 0x0a */ RTACPI_AML_OPC_HANDLER( "ByteInteger", rtAcpiTblAmlDecodeInteger),
|
---|
877 | /* 0x0b */ RTACPI_AML_OPC_HANDLER( "WordInteger", rtAcpiTblAmlDecodeInteger),
|
---|
878 | /* 0x0c */ RTACPI_AML_OPC_HANDLER( "DWordInteger", rtAcpiTblAmlDecodeInteger),
|
---|
879 | /* 0x0d */ RTACPI_AML_OPC_HANDLER( "StringPrefix", rtAcpiTblAmlDecodeString),
|
---|
880 | /* 0x0e */ RTACPI_AML_OPC_HANDLER( "QWordInteger", rtAcpiTblAmlDecodeInteger),
|
---|
881 | /* 0x0f */ RTACPI_AML_OPC_INVALID,
|
---|
882 |
|
---|
883 | /* 0x10 */ RTACPI_AML_OPC_SIMPLE_1("Scope", RTACPI_AML_OPC_F_HAS_PKG_LENGTH, kAcpiAmlOpcType_NameString),
|
---|
884 | /* 0x11 */ RTACPI_AML_OPC_HANDLER( "Buffer", rtAcpiTblAmlDecodeBuffer),
|
---|
885 | /* 0x12 */ RTACPI_AML_OPC_INVALID,
|
---|
886 | /* 0x13 */ RTACPI_AML_OPC_INVALID,
|
---|
887 | /* 0x14 */ RTACPI_AML_OPC_HANDLER( "Method", rtAcpiTblAmlDecodeMethod),
|
---|
888 | /* 0x15 */ RTACPI_AML_OPC_SIMPLE_3("External", RTACPI_AML_OPC_F_NONE, kAcpiAmlOpcType_NameString, kAcpiAmlOpcType_Byte, kAcpiAmlOpcType_Byte),
|
---|
889 | /* 0x16 */ RTACPI_AML_OPC_INVALID,
|
---|
890 | /* 0x17 */ RTACPI_AML_OPC_INVALID,
|
---|
891 | /* 0x18 */ RTACPI_AML_OPC_INVALID,
|
---|
892 | /* 0x19 */ RTACPI_AML_OPC_INVALID,
|
---|
893 | /* 0x1a */ RTACPI_AML_OPC_INVALID,
|
---|
894 | /* 0x1b */ RTACPI_AML_OPC_INVALID,
|
---|
895 | /* 0x1c */ RTACPI_AML_OPC_INVALID,
|
---|
896 | /* 0x1d */ RTACPI_AML_OPC_INVALID,
|
---|
897 | /* 0x1e */ RTACPI_AML_OPC_INVALID,
|
---|
898 | /* 0x1f */ RTACPI_AML_OPC_INVALID,
|
---|
899 |
|
---|
900 | /* 0x20 */ RTACPI_AML_OPC_INVALID,
|
---|
901 | /* 0x21 */ RTACPI_AML_OPC_INVALID,
|
---|
902 | /* 0x22 */ RTACPI_AML_OPC_INVALID,
|
---|
903 | /* 0x23 */ RTACPI_AML_OPC_INVALID,
|
---|
904 | /* 0x24 */ RTACPI_AML_OPC_INVALID,
|
---|
905 | /* 0x25 */ RTACPI_AML_OPC_INVALID,
|
---|
906 | /* 0x26 */ RTACPI_AML_OPC_INVALID,
|
---|
907 | /* 0x27 */ RTACPI_AML_OPC_INVALID,
|
---|
908 | /* 0x28 */ RTACPI_AML_OPC_INVALID,
|
---|
909 | /* 0x29 */ RTACPI_AML_OPC_INVALID,
|
---|
910 | /* 0x2a */ RTACPI_AML_OPC_INVALID,
|
---|
911 | /* 0x2b */ RTACPI_AML_OPC_INVALID,
|
---|
912 | /* 0x2c */ RTACPI_AML_OPC_INVALID,
|
---|
913 | /* 0x2d */ RTACPI_AML_OPC_INVALID,
|
---|
914 | /* 0x2e */ RTACPI_AML_OPC_INVALID,
|
---|
915 | /* 0x2f */ RTACPI_AML_OPC_INVALID,
|
---|
916 |
|
---|
917 | /* 0x30 */ RTACPI_AML_OPC_INVALID,
|
---|
918 | /* 0x31 */ RTACPI_AML_OPC_INVALID,
|
---|
919 | /* 0x32 */ RTACPI_AML_OPC_INVALID,
|
---|
920 | /* 0x33 */ RTACPI_AML_OPC_INVALID,
|
---|
921 | /* 0x34 */ RTACPI_AML_OPC_INVALID,
|
---|
922 | /* 0x35 */ RTACPI_AML_OPC_INVALID,
|
---|
923 | /* 0x36 */ RTACPI_AML_OPC_INVALID,
|
---|
924 | /* 0x37 */ RTACPI_AML_OPC_INVALID,
|
---|
925 | /* 0x38 */ RTACPI_AML_OPC_INVALID,
|
---|
926 | /* 0x39 */ RTACPI_AML_OPC_INVALID,
|
---|
927 | /* 0x3a */ RTACPI_AML_OPC_INVALID,
|
---|
928 | /* 0x3b */ RTACPI_AML_OPC_INVALID,
|
---|
929 | /* 0x3c */ RTACPI_AML_OPC_INVALID,
|
---|
930 | /* 0x3d */ RTACPI_AML_OPC_INVALID,
|
---|
931 | /* 0x3e */ RTACPI_AML_OPC_INVALID,
|
---|
932 | /* 0x3f */ RTACPI_AML_OPC_INVALID,
|
---|
933 |
|
---|
934 | /* 0x40 */ RTACPI_AML_OPC_INVALID,
|
---|
935 | /* 0x41 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
936 | /* 0x42 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
937 | /* 0x43 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
938 | /* 0x44 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
939 | /* 0x45 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
940 | /* 0x46 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
941 | /* 0x47 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
942 | /* 0x48 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
943 | /* 0x49 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
944 | /* 0x4a */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
945 | /* 0x4b */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
946 | /* 0x4c */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
947 | /* 0x4d */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
948 | /* 0x4e */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
949 | /* 0x4f */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
950 |
|
---|
951 | /* 0x50 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
952 | /* 0x51 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
953 | /* 0x52 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
954 | /* 0x53 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
955 | /* 0x54 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
956 | /* 0x55 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
957 | /* 0x56 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
958 | /* 0x57 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
959 | /* 0x58 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
960 | /* 0x59 */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
961 | /* 0x5a */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
962 | /* 0x5b */ RTACPI_AML_OPC_INVALID,
|
---|
963 | /* 0x5c */ RTACPI_AML_OPC_HANDLER("RootChar", rtAcpiTblAmlDecodeNameObject),
|
---|
964 | /* 0x5d */ RTACPI_AML_OPC_INVALID,
|
---|
965 | /* 0x5e */ RTACPI_AML_OPC_HANDLER("ParentPrefixChar", rtAcpiTblAmlDecodeNameObject),
|
---|
966 | /* 0x5f */ RTACPI_AML_OPC_HANDLER("NameChar", rtAcpiTblAmlDecodeNameObject),
|
---|
967 |
|
---|
968 | /* 0x60 */ RTACPI_AML_OPC_SIMPLE_0("Local0", RTACPI_AML_OPC_F_NONE),
|
---|
969 | /* 0x61 */ RTACPI_AML_OPC_SIMPLE_0("Local1", RTACPI_AML_OPC_F_NONE),
|
---|
970 | /* 0x62 */ RTACPI_AML_OPC_SIMPLE_0("Local2", RTACPI_AML_OPC_F_NONE),
|
---|
971 | /* 0x63 */ RTACPI_AML_OPC_SIMPLE_0("Local3", RTACPI_AML_OPC_F_NONE),
|
---|
972 | /* 0x64 */ RTACPI_AML_OPC_SIMPLE_0("Local4", RTACPI_AML_OPC_F_NONE),
|
---|
973 | /* 0x65 */ RTACPI_AML_OPC_SIMPLE_0("Local5", RTACPI_AML_OPC_F_NONE),
|
---|
974 | /* 0x66 */ RTACPI_AML_OPC_SIMPLE_0("Local6", RTACPI_AML_OPC_F_NONE),
|
---|
975 | /* 0x67 */ RTACPI_AML_OPC_SIMPLE_0("Local7", RTACPI_AML_OPC_F_NONE),
|
---|
976 | /* 0x68 */ RTACPI_AML_OPC_SIMPLE_0("Arg0", RTACPI_AML_OPC_F_NONE),
|
---|
977 | /* 0x69 */ RTACPI_AML_OPC_SIMPLE_0("Arg1", RTACPI_AML_OPC_F_NONE),
|
---|
978 | /* 0x6a */ RTACPI_AML_OPC_SIMPLE_0("Arg2", RTACPI_AML_OPC_F_NONE),
|
---|
979 | /* 0x6b */ RTACPI_AML_OPC_SIMPLE_0("Arg3", RTACPI_AML_OPC_F_NONE),
|
---|
980 | /* 0x6c */ RTACPI_AML_OPC_SIMPLE_0("Arg4", RTACPI_AML_OPC_F_NONE),
|
---|
981 | /* 0x6d */ RTACPI_AML_OPC_SIMPLE_0("Arg5", RTACPI_AML_OPC_F_NONE),
|
---|
982 | /* 0x6e */ RTACPI_AML_OPC_SIMPLE_0("Arg6", RTACPI_AML_OPC_F_NONE),
|
---|
983 | /* 0x6f */ RTACPI_AML_OPC_INVALID,
|
---|
984 |
|
---|
985 | /* 0x70 */ RTACPI_AML_OPC_SIMPLE_2("Store", 0, kAcpiAmlOpcType_TermArg, kAcpiAmlOpcType_SuperName),
|
---|
986 | /* 0x71 */ RTACPI_AML_OPC_INVALID,
|
---|
987 | /* 0x72 */ RTACPI_AML_OPC_INVALID,
|
---|
988 | /* 0x73 */ RTACPI_AML_OPC_INVALID,
|
---|
989 | /* 0x74 */ RTACPI_AML_OPC_INVALID,
|
---|
990 | /* 0x75 */ RTACPI_AML_OPC_INVALID,
|
---|
991 | /* 0x76 */ RTACPI_AML_OPC_INVALID,
|
---|
992 | /* 0x77 */ RTACPI_AML_OPC_INVALID,
|
---|
993 | /* 0x78 */ RTACPI_AML_OPC_INVALID,
|
---|
994 | /* 0x79 */ RTACPI_AML_OPC_INVALID,
|
---|
995 | /* 0x7a */ RTACPI_AML_OPC_INVALID,
|
---|
996 | /* 0x7b */ RTACPI_AML_OPC_INVALID,
|
---|
997 | /* 0x7c */ RTACPI_AML_OPC_INVALID,
|
---|
998 | /* 0x7d */ RTACPI_AML_OPC_INVALID,
|
---|
999 | /* 0x7e */ RTACPI_AML_OPC_INVALID,
|
---|
1000 | /* 0x7f */ RTACPI_AML_OPC_INVALID,
|
---|
1001 |
|
---|
1002 | /* 0x80 */ RTACPI_AML_OPC_INVALID,
|
---|
1003 | /* 0x81 */ RTACPI_AML_OPC_INVALID,
|
---|
1004 | /* 0x82 */ RTACPI_AML_OPC_INVALID,
|
---|
1005 | /* 0x83 */ RTACPI_AML_OPC_INVALID,
|
---|
1006 | /* 0x84 */ RTACPI_AML_OPC_INVALID,
|
---|
1007 | /* 0x85 */ RTACPI_AML_OPC_INVALID,
|
---|
1008 | /* 0x86 */ RTACPI_AML_OPC_SIMPLE_2("Notify", 0, kAcpiAmlOpcType_SuperName, kAcpiAmlOpcType_TermArg),
|
---|
1009 | /* 0x87 */ RTACPI_AML_OPC_INVALID,
|
---|
1010 | /* 0x88 */ RTACPI_AML_OPC_SIMPLE_3("Index", 0, kAcpiAmlOpcType_TermArg, kAcpiAmlOpcType_TermArg, kAcpiAmlOpcType_SuperName),
|
---|
1011 | /* 0x89 */ RTACPI_AML_OPC_INVALID,
|
---|
1012 | /* 0x8a */ RTACPI_AML_OPC_INVALID,
|
---|
1013 | /* 0x8b */ RTACPI_AML_OPC_INVALID,
|
---|
1014 | /* 0x8c */ RTACPI_AML_OPC_INVALID,
|
---|
1015 | /* 0x8d */ RTACPI_AML_OPC_INVALID,
|
---|
1016 | /* 0x8e */ RTACPI_AML_OPC_INVALID,
|
---|
1017 | /* 0x8f */ RTACPI_AML_OPC_INVALID,
|
---|
1018 |
|
---|
1019 | /* 0x90 */ RTACPI_AML_OPC_INVALID,
|
---|
1020 | /* 0x91 */ RTACPI_AML_OPC_INVALID,
|
---|
1021 | /* 0x92 */ RTACPI_AML_OPC_INVALID,
|
---|
1022 | /* 0x93 */ RTACPI_AML_OPC_SIMPLE_2("LEqual", 0, kAcpiAmlOpcType_TermArg, kAcpiAmlOpcType_TermArg),
|
---|
1023 | /* 0x94 */ RTACPI_AML_OPC_INVALID,
|
---|
1024 | /* 0x95 */ RTACPI_AML_OPC_INVALID,
|
---|
1025 | /* 0x96 */ RTACPI_AML_OPC_INVALID,
|
---|
1026 | /* 0x97 */ RTACPI_AML_OPC_INVALID,
|
---|
1027 | /* 0x98 */ RTACPI_AML_OPC_INVALID,
|
---|
1028 | /* 0x99 */ RTACPI_AML_OPC_INVALID,
|
---|
1029 | /* 0x9a */ RTACPI_AML_OPC_INVALID,
|
---|
1030 | /* 0x9b */ RTACPI_AML_OPC_INVALID,
|
---|
1031 | /* 0x9c */ RTACPI_AML_OPC_INVALID,
|
---|
1032 | /* 0x9d */ RTACPI_AML_OPC_INVALID,
|
---|
1033 | /* 0x9e */ RTACPI_AML_OPC_INVALID,
|
---|
1034 | /* 0x9f */ RTACPI_AML_OPC_INVALID,
|
---|
1035 |
|
---|
1036 | /* 0xa0 */ RTACPI_AML_OPC_SIMPLE_1("If", RTACPI_AML_OPC_F_HAS_PKG_LENGTH, kAcpiAmlOpcType_TermArg),
|
---|
1037 | /* 0xa1 */ RTACPI_AML_OPC_SIMPLE_0("Else", RTACPI_AML_OPC_F_HAS_PKG_LENGTH),
|
---|
1038 | /* 0xa2 */ RTACPI_AML_OPC_INVALID,
|
---|
1039 | /* 0xa3 */ RTACPI_AML_OPC_INVALID,
|
---|
1040 | /* 0xa4 */ RTACPI_AML_OPC_SIMPLE_1("Return", 0, kAcpiAmlOpcType_TermArg),
|
---|
1041 | /* 0xa5 */ RTACPI_AML_OPC_INVALID,
|
---|
1042 | /* 0xa6 */ RTACPI_AML_OPC_INVALID,
|
---|
1043 | /* 0xa7 */ RTACPI_AML_OPC_INVALID,
|
---|
1044 | /* 0xa8 */ RTACPI_AML_OPC_INVALID,
|
---|
1045 | /* 0xa9 */ RTACPI_AML_OPC_INVALID,
|
---|
1046 | /* 0xaa */ RTACPI_AML_OPC_INVALID,
|
---|
1047 | /* 0xab */ RTACPI_AML_OPC_INVALID,
|
---|
1048 | /* 0xac */ RTACPI_AML_OPC_INVALID,
|
---|
1049 | /* 0xad */ RTACPI_AML_OPC_INVALID,
|
---|
1050 | /* 0xae */ RTACPI_AML_OPC_INVALID,
|
---|
1051 | /* 0xaf */ RTACPI_AML_OPC_INVALID,
|
---|
1052 |
|
---|
1053 | /* 0xb0 */ RTACPI_AML_OPC_INVALID,
|
---|
1054 | /* 0xb1 */ RTACPI_AML_OPC_INVALID,
|
---|
1055 | /* 0xb2 */ RTACPI_AML_OPC_INVALID,
|
---|
1056 | /* 0xb3 */ RTACPI_AML_OPC_INVALID,
|
---|
1057 | /* 0xb4 */ RTACPI_AML_OPC_INVALID,
|
---|
1058 | /* 0xb5 */ RTACPI_AML_OPC_INVALID,
|
---|
1059 | /* 0xb6 */ RTACPI_AML_OPC_INVALID,
|
---|
1060 | /* 0xb7 */ RTACPI_AML_OPC_INVALID,
|
---|
1061 | /* 0xb8 */ RTACPI_AML_OPC_INVALID,
|
---|
1062 | /* 0xb9 */ RTACPI_AML_OPC_INVALID,
|
---|
1063 | /* 0xba */ RTACPI_AML_OPC_INVALID,
|
---|
1064 | /* 0xbb */ RTACPI_AML_OPC_INVALID,
|
---|
1065 | /* 0xbc */ RTACPI_AML_OPC_INVALID,
|
---|
1066 | /* 0xbd */ RTACPI_AML_OPC_INVALID,
|
---|
1067 | /* 0xbe */ RTACPI_AML_OPC_INVALID,
|
---|
1068 | /* 0xbf */ RTACPI_AML_OPC_INVALID,
|
---|
1069 |
|
---|
1070 | /* 0xc0 */ RTACPI_AML_OPC_INVALID,
|
---|
1071 | /* 0xc1 */ RTACPI_AML_OPC_INVALID,
|
---|
1072 | /* 0xc2 */ RTACPI_AML_OPC_INVALID,
|
---|
1073 | /* 0xc3 */ RTACPI_AML_OPC_INVALID,
|
---|
1074 | /* 0xc4 */ RTACPI_AML_OPC_INVALID,
|
---|
1075 | /* 0xc5 */ RTACPI_AML_OPC_INVALID,
|
---|
1076 | /* 0xc6 */ RTACPI_AML_OPC_INVALID,
|
---|
1077 | /* 0xc7 */ RTACPI_AML_OPC_INVALID,
|
---|
1078 | /* 0xc8 */ RTACPI_AML_OPC_INVALID,
|
---|
1079 | /* 0xc9 */ RTACPI_AML_OPC_INVALID,
|
---|
1080 | /* 0xca */ RTACPI_AML_OPC_INVALID,
|
---|
1081 | /* 0xcb */ RTACPI_AML_OPC_INVALID,
|
---|
1082 | /* 0xcc */ RTACPI_AML_OPC_INVALID,
|
---|
1083 | /* 0xcd */ RTACPI_AML_OPC_INVALID,
|
---|
1084 | /* 0xce */ RTACPI_AML_OPC_INVALID,
|
---|
1085 | /* 0xcf */ RTACPI_AML_OPC_INVALID,
|
---|
1086 |
|
---|
1087 | /* 0xd0 */ RTACPI_AML_OPC_INVALID,
|
---|
1088 | /* 0xd1 */ RTACPI_AML_OPC_INVALID,
|
---|
1089 | /* 0xd2 */ RTACPI_AML_OPC_INVALID,
|
---|
1090 | /* 0xd3 */ RTACPI_AML_OPC_INVALID,
|
---|
1091 | /* 0xd4 */ RTACPI_AML_OPC_INVALID,
|
---|
1092 | /* 0xd5 */ RTACPI_AML_OPC_INVALID,
|
---|
1093 | /* 0xd6 */ RTACPI_AML_OPC_INVALID,
|
---|
1094 | /* 0xd7 */ RTACPI_AML_OPC_INVALID,
|
---|
1095 | /* 0xd8 */ RTACPI_AML_OPC_INVALID,
|
---|
1096 | /* 0xd9 */ RTACPI_AML_OPC_INVALID,
|
---|
1097 | /* 0xda */ RTACPI_AML_OPC_INVALID,
|
---|
1098 | /* 0xdb */ RTACPI_AML_OPC_INVALID,
|
---|
1099 | /* 0xdc */ RTACPI_AML_OPC_INVALID,
|
---|
1100 | /* 0xdd */ RTACPI_AML_OPC_INVALID,
|
---|
1101 | /* 0xde */ RTACPI_AML_OPC_INVALID,
|
---|
1102 | /* 0xdf */ RTACPI_AML_OPC_INVALID,
|
---|
1103 |
|
---|
1104 | /* 0xe0 */ RTACPI_AML_OPC_INVALID,
|
---|
1105 | /* 0xe1 */ RTACPI_AML_OPC_INVALID,
|
---|
1106 | /* 0xe2 */ RTACPI_AML_OPC_INVALID,
|
---|
1107 | /* 0xe3 */ RTACPI_AML_OPC_INVALID,
|
---|
1108 | /* 0xe4 */ RTACPI_AML_OPC_INVALID,
|
---|
1109 | /* 0xe5 */ RTACPI_AML_OPC_INVALID,
|
---|
1110 | /* 0xe6 */ RTACPI_AML_OPC_INVALID,
|
---|
1111 | /* 0xe7 */ RTACPI_AML_OPC_INVALID,
|
---|
1112 | /* 0xe8 */ RTACPI_AML_OPC_INVALID,
|
---|
1113 | /* 0xe9 */ RTACPI_AML_OPC_INVALID,
|
---|
1114 | /* 0xea */ RTACPI_AML_OPC_INVALID,
|
---|
1115 | /* 0xeb */ RTACPI_AML_OPC_INVALID,
|
---|
1116 | /* 0xec */ RTACPI_AML_OPC_INVALID,
|
---|
1117 | /* 0xed */ RTACPI_AML_OPC_INVALID,
|
---|
1118 | /* 0xee */ RTACPI_AML_OPC_INVALID,
|
---|
1119 | /* 0xef */ RTACPI_AML_OPC_INVALID,
|
---|
1120 |
|
---|
1121 | /* 0xf0 */ RTACPI_AML_OPC_INVALID,
|
---|
1122 | /* 0xf1 */ RTACPI_AML_OPC_INVALID,
|
---|
1123 | /* 0xf2 */ RTACPI_AML_OPC_INVALID,
|
---|
1124 | /* 0xf3 */ RTACPI_AML_OPC_INVALID,
|
---|
1125 | /* 0xf4 */ RTACPI_AML_OPC_INVALID,
|
---|
1126 | /* 0xf5 */ RTACPI_AML_OPC_INVALID,
|
---|
1127 | /* 0xf6 */ RTACPI_AML_OPC_INVALID,
|
---|
1128 | /* 0xf7 */ RTACPI_AML_OPC_INVALID,
|
---|
1129 | /* 0xf8 */ RTACPI_AML_OPC_INVALID,
|
---|
1130 | /* 0xf9 */ RTACPI_AML_OPC_INVALID,
|
---|
1131 | /* 0xfa */ RTACPI_AML_OPC_INVALID,
|
---|
1132 | /* 0xfb */ RTACPI_AML_OPC_INVALID,
|
---|
1133 | /* 0xfc */ RTACPI_AML_OPC_INVALID,
|
---|
1134 | /* 0xfd */ RTACPI_AML_OPC_INVALID,
|
---|
1135 | /* 0xfe */ RTACPI_AML_OPC_INVALID,
|
---|
1136 | /* 0xff */ RTACPI_AML_OPC_INVALID
|
---|
1137 | };
|
---|
1138 |
|
---|
1139 |
|
---|
1140 | /**
|
---|
1141 | * AML extended opcode -> ASL decoder array.
|
---|
1142 | */
|
---|
1143 | static const RTACPIAMLOPC g_aAmlExtOpcodeDecode[] =
|
---|
1144 | {
|
---|
1145 | /* 0x00 */ RTACPI_AML_OPC_INVALID,
|
---|
1146 | /* 0x01 */ RTACPI_AML_OPC_INVALID,
|
---|
1147 | /* 0x02 */ RTACPI_AML_OPC_INVALID,
|
---|
1148 | /* 0x03 */ RTACPI_AML_OPC_INVALID,
|
---|
1149 | /* 0x04 */ RTACPI_AML_OPC_INVALID,
|
---|
1150 | /* 0x05 */ RTACPI_AML_OPC_INVALID,
|
---|
1151 | /* 0x06 */ RTACPI_AML_OPC_INVALID,
|
---|
1152 | /* 0x07 */ RTACPI_AML_OPC_INVALID,
|
---|
1153 | /* 0x08 */ RTACPI_AML_OPC_INVALID,
|
---|
1154 | /* 0x09 */ RTACPI_AML_OPC_INVALID,
|
---|
1155 | /* 0x0a */ RTACPI_AML_OPC_INVALID,
|
---|
1156 | /* 0x0b */ RTACPI_AML_OPC_INVALID,
|
---|
1157 | /* 0x0c */ RTACPI_AML_OPC_INVALID,
|
---|
1158 | /* 0x0d */ RTACPI_AML_OPC_INVALID,
|
---|
1159 | /* 0x0e */ RTACPI_AML_OPC_INVALID,
|
---|
1160 | /* 0x0f */ RTACPI_AML_OPC_INVALID,
|
---|
1161 |
|
---|
1162 | /* 0x10 */ RTACPI_AML_OPC_INVALID,
|
---|
1163 | /* 0x11 */ RTACPI_AML_OPC_INVALID,
|
---|
1164 | /* 0x12 */ RTACPI_AML_OPC_INVALID,
|
---|
1165 | /* 0x13 */ RTACPI_AML_OPC_INVALID,
|
---|
1166 | /* 0x14 */ RTACPI_AML_OPC_INVALID,
|
---|
1167 | /* 0x15 */ RTACPI_AML_OPC_INVALID,
|
---|
1168 | /* 0x16 */ RTACPI_AML_OPC_INVALID,
|
---|
1169 | /* 0x17 */ RTACPI_AML_OPC_INVALID,
|
---|
1170 | /* 0x18 */ RTACPI_AML_OPC_INVALID,
|
---|
1171 | /* 0x19 */ RTACPI_AML_OPC_INVALID,
|
---|
1172 | /* 0x1a */ RTACPI_AML_OPC_INVALID,
|
---|
1173 | /* 0x1b */ RTACPI_AML_OPC_INVALID,
|
---|
1174 | /* 0x1c */ RTACPI_AML_OPC_INVALID,
|
---|
1175 | /* 0x1d */ RTACPI_AML_OPC_INVALID,
|
---|
1176 | /* 0x1e */ RTACPI_AML_OPC_INVALID,
|
---|
1177 | /* 0x1f */ RTACPI_AML_OPC_INVALID,
|
---|
1178 |
|
---|
1179 | /* 0x20 */ RTACPI_AML_OPC_INVALID,
|
---|
1180 | /* 0x21 */ RTACPI_AML_OPC_INVALID,
|
---|
1181 | /* 0x22 */ RTACPI_AML_OPC_INVALID,
|
---|
1182 | /* 0x23 */ RTACPI_AML_OPC_INVALID,
|
---|
1183 | /* 0x24 */ RTACPI_AML_OPC_INVALID,
|
---|
1184 | /* 0x25 */ RTACPI_AML_OPC_INVALID,
|
---|
1185 | /* 0x26 */ RTACPI_AML_OPC_INVALID,
|
---|
1186 | /* 0x27 */ RTACPI_AML_OPC_INVALID,
|
---|
1187 | /* 0x28 */ RTACPI_AML_OPC_INVALID,
|
---|
1188 | /* 0x29 */ RTACPI_AML_OPC_INVALID,
|
---|
1189 | /* 0x2a */ RTACPI_AML_OPC_INVALID,
|
---|
1190 | /* 0x2b */ RTACPI_AML_OPC_INVALID,
|
---|
1191 | /* 0x2c */ RTACPI_AML_OPC_INVALID,
|
---|
1192 | /* 0x2d */ RTACPI_AML_OPC_INVALID,
|
---|
1193 | /* 0x2e */ RTACPI_AML_OPC_INVALID,
|
---|
1194 | /* 0x2f */ RTACPI_AML_OPC_INVALID,
|
---|
1195 |
|
---|
1196 | /* 0x30 */ RTACPI_AML_OPC_INVALID,
|
---|
1197 | /* 0x31 */ RTACPI_AML_OPC_SIMPLE_0("Debug", RTACPI_AML_OPC_F_NONE),
|
---|
1198 | /* 0x32 */ RTACPI_AML_OPC_INVALID,
|
---|
1199 | /* 0x33 */ RTACPI_AML_OPC_INVALID,
|
---|
1200 | /* 0x34 */ RTACPI_AML_OPC_INVALID,
|
---|
1201 | /* 0x35 */ RTACPI_AML_OPC_INVALID,
|
---|
1202 | /* 0x36 */ RTACPI_AML_OPC_INVALID,
|
---|
1203 | /* 0x37 */ RTACPI_AML_OPC_INVALID,
|
---|
1204 | /* 0x38 */ RTACPI_AML_OPC_INVALID,
|
---|
1205 | /* 0x39 */ RTACPI_AML_OPC_INVALID,
|
---|
1206 | /* 0x3a */ RTACPI_AML_OPC_INVALID,
|
---|
1207 | /* 0x3b */ RTACPI_AML_OPC_INVALID,
|
---|
1208 | /* 0x3c */ RTACPI_AML_OPC_INVALID,
|
---|
1209 | /* 0x3d */ RTACPI_AML_OPC_INVALID,
|
---|
1210 | /* 0x3e */ RTACPI_AML_OPC_INVALID,
|
---|
1211 | /* 0x3f */ RTACPI_AML_OPC_INVALID,
|
---|
1212 |
|
---|
1213 | /* 0x40 */ RTACPI_AML_OPC_INVALID,
|
---|
1214 | /* 0x41 */ RTACPI_AML_OPC_INVALID,
|
---|
1215 | /* 0x42 */ RTACPI_AML_OPC_INVALID,
|
---|
1216 | /* 0x43 */ RTACPI_AML_OPC_INVALID,
|
---|
1217 | /* 0x44 */ RTACPI_AML_OPC_INVALID,
|
---|
1218 | /* 0x45 */ RTACPI_AML_OPC_INVALID,
|
---|
1219 | /* 0x46 */ RTACPI_AML_OPC_INVALID,
|
---|
1220 | /* 0x47 */ RTACPI_AML_OPC_INVALID,
|
---|
1221 | /* 0x48 */ RTACPI_AML_OPC_INVALID,
|
---|
1222 | /* 0x49 */ RTACPI_AML_OPC_INVALID,
|
---|
1223 | /* 0x4a */ RTACPI_AML_OPC_INVALID,
|
---|
1224 | /* 0x4b */ RTACPI_AML_OPC_INVALID,
|
---|
1225 | /* 0x4c */ RTACPI_AML_OPC_INVALID,
|
---|
1226 | /* 0x4d */ RTACPI_AML_OPC_INVALID,
|
---|
1227 | /* 0x4e */ RTACPI_AML_OPC_INVALID,
|
---|
1228 | /* 0x4f */ RTACPI_AML_OPC_INVALID,
|
---|
1229 |
|
---|
1230 | /* 0x50 */ RTACPI_AML_OPC_INVALID,
|
---|
1231 | /* 0x51 */ RTACPI_AML_OPC_INVALID,
|
---|
1232 | /* 0x52 */ RTACPI_AML_OPC_INVALID,
|
---|
1233 | /* 0x53 */ RTACPI_AML_OPC_INVALID,
|
---|
1234 | /* 0x54 */ RTACPI_AML_OPC_INVALID,
|
---|
1235 | /* 0x55 */ RTACPI_AML_OPC_INVALID,
|
---|
1236 | /* 0x56 */ RTACPI_AML_OPC_INVALID,
|
---|
1237 | /* 0x57 */ RTACPI_AML_OPC_INVALID,
|
---|
1238 | /* 0x58 */ RTACPI_AML_OPC_INVALID,
|
---|
1239 | /* 0x59 */ RTACPI_AML_OPC_INVALID,
|
---|
1240 | /* 0x5a */ RTACPI_AML_OPC_INVALID,
|
---|
1241 | /* 0x5b */ RTACPI_AML_OPC_INVALID,
|
---|
1242 | /* 0x5c */ RTACPI_AML_OPC_INVALID,
|
---|
1243 | /* 0x5d */ RTACPI_AML_OPC_INVALID,
|
---|
1244 | /* 0x5e */ RTACPI_AML_OPC_INVALID,
|
---|
1245 | /* 0x5f */ RTACPI_AML_OPC_INVALID,
|
---|
1246 |
|
---|
1247 | /* 0x60 */ RTACPI_AML_OPC_INVALID,
|
---|
1248 | /* 0x61 */ RTACPI_AML_OPC_INVALID,
|
---|
1249 | /* 0x62 */ RTACPI_AML_OPC_INVALID,
|
---|
1250 | /* 0x63 */ RTACPI_AML_OPC_INVALID,
|
---|
1251 | /* 0x64 */ RTACPI_AML_OPC_INVALID,
|
---|
1252 | /* 0x65 */ RTACPI_AML_OPC_INVALID,
|
---|
1253 | /* 0x66 */ RTACPI_AML_OPC_INVALID,
|
---|
1254 | /* 0x67 */ RTACPI_AML_OPC_INVALID,
|
---|
1255 | /* 0x68 */ RTACPI_AML_OPC_INVALID,
|
---|
1256 | /* 0x69 */ RTACPI_AML_OPC_INVALID,
|
---|
1257 | /* 0x6a */ RTACPI_AML_OPC_INVALID,
|
---|
1258 | /* 0x6b */ RTACPI_AML_OPC_INVALID,
|
---|
1259 | /* 0x6c */ RTACPI_AML_OPC_INVALID,
|
---|
1260 | /* 0x6d */ RTACPI_AML_OPC_INVALID,
|
---|
1261 | /* 0x6e */ RTACPI_AML_OPC_INVALID,
|
---|
1262 | /* 0x6f */ RTACPI_AML_OPC_INVALID,
|
---|
1263 |
|
---|
1264 | /* 0x70 */ RTACPI_AML_OPC_INVALID,
|
---|
1265 | /* 0x71 */ RTACPI_AML_OPC_INVALID,
|
---|
1266 | /* 0x72 */ RTACPI_AML_OPC_INVALID,
|
---|
1267 | /* 0x73 */ RTACPI_AML_OPC_INVALID,
|
---|
1268 | /* 0x74 */ RTACPI_AML_OPC_INVALID,
|
---|
1269 | /* 0x75 */ RTACPI_AML_OPC_INVALID,
|
---|
1270 | /* 0x76 */ RTACPI_AML_OPC_INVALID,
|
---|
1271 | /* 0x77 */ RTACPI_AML_OPC_INVALID,
|
---|
1272 | /* 0x78 */ RTACPI_AML_OPC_INVALID,
|
---|
1273 | /* 0x79 */ RTACPI_AML_OPC_INVALID,
|
---|
1274 | /* 0x7a */ RTACPI_AML_OPC_INVALID,
|
---|
1275 | /* 0x7b */ RTACPI_AML_OPC_INVALID,
|
---|
1276 | /* 0x7c */ RTACPI_AML_OPC_INVALID,
|
---|
1277 | /* 0x7d */ RTACPI_AML_OPC_INVALID,
|
---|
1278 | /* 0x7e */ RTACPI_AML_OPC_INVALID,
|
---|
1279 | /* 0x7f */ RTACPI_AML_OPC_INVALID,
|
---|
1280 |
|
---|
1281 | /* 0x80 */ RTACPI_AML_OPC_SIMPLE_4("OpRegion", 0, kAcpiAmlOpcType_NameString, kAcpiAmlOpcType_Byte, kAcpiAmlOpcType_TermArg, kAcpiAmlOpcType_TermArg),
|
---|
1282 | /* 0x81 */ RTACPI_AML_OPC_INVALID,
|
---|
1283 | /* 0x82 */ RTACPI_AML_OPC_SIMPLE_1("Device", RTACPI_AML_OPC_F_HAS_PKG_LENGTH, kAcpiAmlOpcType_NameString),
|
---|
1284 | /* 0x83 */ RTACPI_AML_OPC_SIMPLE_4("Processor", RTACPI_AML_OPC_F_HAS_PKG_LENGTH, kAcpiAmlOpcType_NameString, kAcpiAmlOpcType_Byte, kAcpiAmlOpcType_DWord, kAcpiAmlOpcType_Byte),
|
---|
1285 | /* 0x84 */ RTACPI_AML_OPC_INVALID,
|
---|
1286 | /* 0x85 */ RTACPI_AML_OPC_INVALID,
|
---|
1287 | /* 0x86 */ RTACPI_AML_OPC_INVALID,
|
---|
1288 | /* 0x87 */ RTACPI_AML_OPC_INVALID,
|
---|
1289 | /* 0x88 */ RTACPI_AML_OPC_INVALID,
|
---|
1290 | /* 0x89 */ RTACPI_AML_OPC_INVALID,
|
---|
1291 | /* 0x8a */ RTACPI_AML_OPC_INVALID,
|
---|
1292 | /* 0x8b */ RTACPI_AML_OPC_INVALID,
|
---|
1293 | /* 0x8c */ RTACPI_AML_OPC_INVALID,
|
---|
1294 | /* 0x8d */ RTACPI_AML_OPC_INVALID,
|
---|
1295 | /* 0x8e */ RTACPI_AML_OPC_INVALID,
|
---|
1296 | /* 0x8f */ RTACPI_AML_OPC_INVALID,
|
---|
1297 |
|
---|
1298 | /* 0x90 */ RTACPI_AML_OPC_INVALID,
|
---|
1299 | /* 0x91 */ RTACPI_AML_OPC_INVALID,
|
---|
1300 | /* 0x92 */ RTACPI_AML_OPC_INVALID,
|
---|
1301 | /* 0x93 */ RTACPI_AML_OPC_INVALID,
|
---|
1302 | /* 0x94 */ RTACPI_AML_OPC_INVALID,
|
---|
1303 | /* 0x95 */ RTACPI_AML_OPC_INVALID,
|
---|
1304 | /* 0x96 */ RTACPI_AML_OPC_INVALID,
|
---|
1305 | /* 0x97 */ RTACPI_AML_OPC_INVALID,
|
---|
1306 | /* 0x98 */ RTACPI_AML_OPC_INVALID,
|
---|
1307 | /* 0x99 */ RTACPI_AML_OPC_INVALID,
|
---|
1308 | /* 0x9a */ RTACPI_AML_OPC_INVALID,
|
---|
1309 | /* 0x9b */ RTACPI_AML_OPC_INVALID,
|
---|
1310 | /* 0x9c */ RTACPI_AML_OPC_INVALID,
|
---|
1311 | /* 0x9d */ RTACPI_AML_OPC_INVALID,
|
---|
1312 | /* 0x9e */ RTACPI_AML_OPC_INVALID,
|
---|
1313 | /* 0x9f */ RTACPI_AML_OPC_INVALID,
|
---|
1314 |
|
---|
1315 | /* 0xa0 */ RTACPI_AML_OPC_INVALID,
|
---|
1316 | /* 0xa1 */ RTACPI_AML_OPC_INVALID,
|
---|
1317 | /* 0xa2 */ RTACPI_AML_OPC_INVALID,
|
---|
1318 | /* 0xa3 */ RTACPI_AML_OPC_INVALID,
|
---|
1319 | /* 0xa4 */ RTACPI_AML_OPC_INVALID,
|
---|
1320 | /* 0xa5 */ RTACPI_AML_OPC_INVALID,
|
---|
1321 | /* 0xa6 */ RTACPI_AML_OPC_INVALID,
|
---|
1322 | /* 0xa7 */ RTACPI_AML_OPC_INVALID,
|
---|
1323 | /* 0xa8 */ RTACPI_AML_OPC_INVALID,
|
---|
1324 | /* 0xa9 */ RTACPI_AML_OPC_INVALID,
|
---|
1325 | /* 0xaa */ RTACPI_AML_OPC_INVALID,
|
---|
1326 | /* 0xab */ RTACPI_AML_OPC_INVALID,
|
---|
1327 | /* 0xac */ RTACPI_AML_OPC_INVALID,
|
---|
1328 | /* 0xad */ RTACPI_AML_OPC_INVALID,
|
---|
1329 | /* 0xae */ RTACPI_AML_OPC_INVALID,
|
---|
1330 | /* 0xaf */ RTACPI_AML_OPC_INVALID,
|
---|
1331 |
|
---|
1332 | /* 0xb0 */ RTACPI_AML_OPC_INVALID,
|
---|
1333 | /* 0xb1 */ RTACPI_AML_OPC_INVALID,
|
---|
1334 | /* 0xb2 */ RTACPI_AML_OPC_INVALID,
|
---|
1335 | /* 0xb3 */ RTACPI_AML_OPC_INVALID,
|
---|
1336 | /* 0xb4 */ RTACPI_AML_OPC_INVALID,
|
---|
1337 | /* 0xb5 */ RTACPI_AML_OPC_INVALID,
|
---|
1338 | /* 0xb6 */ RTACPI_AML_OPC_INVALID,
|
---|
1339 | /* 0xb7 */ RTACPI_AML_OPC_INVALID,
|
---|
1340 | /* 0xb8 */ RTACPI_AML_OPC_INVALID,
|
---|
1341 | /* 0xb9 */ RTACPI_AML_OPC_INVALID,
|
---|
1342 | /* 0xba */ RTACPI_AML_OPC_INVALID,
|
---|
1343 | /* 0xbb */ RTACPI_AML_OPC_INVALID,
|
---|
1344 | /* 0xbc */ RTACPI_AML_OPC_INVALID,
|
---|
1345 | /* 0xbd */ RTACPI_AML_OPC_INVALID,
|
---|
1346 | /* 0xbe */ RTACPI_AML_OPC_INVALID,
|
---|
1347 | /* 0xbf */ RTACPI_AML_OPC_INVALID,
|
---|
1348 |
|
---|
1349 | /* 0xc0 */ RTACPI_AML_OPC_INVALID,
|
---|
1350 | /* 0xc1 */ RTACPI_AML_OPC_INVALID,
|
---|
1351 | /* 0xc2 */ RTACPI_AML_OPC_INVALID,
|
---|
1352 | /* 0xc3 */ RTACPI_AML_OPC_INVALID,
|
---|
1353 | /* 0xc4 */ RTACPI_AML_OPC_INVALID,
|
---|
1354 | /* 0xc5 */ RTACPI_AML_OPC_INVALID,
|
---|
1355 | /* 0xc6 */ RTACPI_AML_OPC_INVALID,
|
---|
1356 | /* 0xc7 */ RTACPI_AML_OPC_INVALID,
|
---|
1357 | /* 0xc8 */ RTACPI_AML_OPC_INVALID,
|
---|
1358 | /* 0xc9 */ RTACPI_AML_OPC_INVALID,
|
---|
1359 | /* 0xca */ RTACPI_AML_OPC_INVALID,
|
---|
1360 | /* 0xcb */ RTACPI_AML_OPC_INVALID,
|
---|
1361 | /* 0xcc */ RTACPI_AML_OPC_INVALID,
|
---|
1362 | /* 0xcd */ RTACPI_AML_OPC_INVALID,
|
---|
1363 | /* 0xce */ RTACPI_AML_OPC_INVALID,
|
---|
1364 | /* 0xcf */ RTACPI_AML_OPC_INVALID,
|
---|
1365 |
|
---|
1366 | /* 0xd0 */ RTACPI_AML_OPC_INVALID,
|
---|
1367 | /* 0xd1 */ RTACPI_AML_OPC_INVALID,
|
---|
1368 | /* 0xd2 */ RTACPI_AML_OPC_INVALID,
|
---|
1369 | /* 0xd3 */ RTACPI_AML_OPC_INVALID,
|
---|
1370 | /* 0xd4 */ RTACPI_AML_OPC_INVALID,
|
---|
1371 | /* 0xd5 */ RTACPI_AML_OPC_INVALID,
|
---|
1372 | /* 0xd6 */ RTACPI_AML_OPC_INVALID,
|
---|
1373 | /* 0xd7 */ RTACPI_AML_OPC_INVALID,
|
---|
1374 | /* 0xd8 */ RTACPI_AML_OPC_INVALID,
|
---|
1375 | /* 0xd9 */ RTACPI_AML_OPC_INVALID,
|
---|
1376 | /* 0xda */ RTACPI_AML_OPC_INVALID,
|
---|
1377 | /* 0xdb */ RTACPI_AML_OPC_INVALID,
|
---|
1378 | /* 0xdc */ RTACPI_AML_OPC_INVALID,
|
---|
1379 | /* 0xdd */ RTACPI_AML_OPC_INVALID,
|
---|
1380 | /* 0xde */ RTACPI_AML_OPC_INVALID,
|
---|
1381 | /* 0xdf */ RTACPI_AML_OPC_INVALID,
|
---|
1382 |
|
---|
1383 | /* 0xe0 */ RTACPI_AML_OPC_INVALID,
|
---|
1384 | /* 0xe1 */ RTACPI_AML_OPC_INVALID,
|
---|
1385 | /* 0xe2 */ RTACPI_AML_OPC_INVALID,
|
---|
1386 | /* 0xe3 */ RTACPI_AML_OPC_INVALID,
|
---|
1387 | /* 0xe4 */ RTACPI_AML_OPC_INVALID,
|
---|
1388 | /* 0xe5 */ RTACPI_AML_OPC_INVALID,
|
---|
1389 | /* 0xe6 */ RTACPI_AML_OPC_INVALID,
|
---|
1390 | /* 0xe7 */ RTACPI_AML_OPC_INVALID,
|
---|
1391 | /* 0xe8 */ RTACPI_AML_OPC_INVALID,
|
---|
1392 | /* 0xe9 */ RTACPI_AML_OPC_INVALID,
|
---|
1393 | /* 0xea */ RTACPI_AML_OPC_INVALID,
|
---|
1394 | /* 0xeb */ RTACPI_AML_OPC_INVALID,
|
---|
1395 | /* 0xec */ RTACPI_AML_OPC_INVALID,
|
---|
1396 | /* 0xed */ RTACPI_AML_OPC_INVALID,
|
---|
1397 | /* 0xee */ RTACPI_AML_OPC_INVALID,
|
---|
1398 | /* 0xef */ RTACPI_AML_OPC_INVALID,
|
---|
1399 |
|
---|
1400 | /* 0xf0 */ RTACPI_AML_OPC_INVALID,
|
---|
1401 | /* 0xf1 */ RTACPI_AML_OPC_INVALID,
|
---|
1402 | /* 0xf2 */ RTACPI_AML_OPC_INVALID,
|
---|
1403 | /* 0xf3 */ RTACPI_AML_OPC_INVALID,
|
---|
1404 | /* 0xf4 */ RTACPI_AML_OPC_INVALID,
|
---|
1405 | /* 0xf5 */ RTACPI_AML_OPC_INVALID,
|
---|
1406 | /* 0xf6 */ RTACPI_AML_OPC_INVALID,
|
---|
1407 | /* 0xf7 */ RTACPI_AML_OPC_INVALID,
|
---|
1408 | /* 0xf8 */ RTACPI_AML_OPC_INVALID,
|
---|
1409 | /* 0xf9 */ RTACPI_AML_OPC_INVALID,
|
---|
1410 | /* 0xfa */ RTACPI_AML_OPC_INVALID,
|
---|
1411 | /* 0xfb */ RTACPI_AML_OPC_INVALID,
|
---|
1412 | /* 0xfc */ RTACPI_AML_OPC_INVALID,
|
---|
1413 | /* 0xfd */ RTACPI_AML_OPC_INVALID,
|
---|
1414 | /* 0xfe */ RTACPI_AML_OPC_INVALID,
|
---|
1415 | /* 0xff */ RTACPI_AML_OPC_INVALID
|
---|
1416 | };
|
---|
1417 |
|
---|
1418 |
|
---|
1419 | static int rtAcpiTblAmlDecodeSimple(PRTACPITBLAMLDECODE pThis, PCRTACPIAMLOPC pAmlOpc, uint8_t bOpc, RTVFSIOSTREAM hVfsIosOut, PRTERRINFO pErrInfo)
|
---|
1420 | {
|
---|
1421 | RT_NOREF(bOpc);
|
---|
1422 |
|
---|
1423 | int rc;
|
---|
1424 |
|
---|
1425 | /* Decode any package length field first. */
|
---|
1426 | size_t cbPkg = 0;
|
---|
1427 | size_t cbPkgLength = 0;
|
---|
1428 | size_t cbPkgConsumed = 0;
|
---|
1429 | if (pAmlOpc->fFlags & RTACPI_AML_OPC_F_HAS_PKG_LENGTH)
|
---|
1430 | {
|
---|
1431 | rc = rtAcpiTblAmlDecodePkgLength(pThis, &cbPkg, &cbPkgLength, pErrInfo);
|
---|
1432 | if (RT_FAILURE(rc)) return rc;
|
---|
1433 |
|
---|
1434 | cbPkgConsumed += cbPkgLength;
|
---|
1435 | }
|
---|
1436 |
|
---|
1437 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%s", pAmlOpc->pszOpc);
|
---|
1438 | if (RT_FAILURE(rc)) return rc;
|
---|
1439 |
|
---|
1440 | /* Any arguments? */
|
---|
1441 | if (pAmlOpc->aenmTypes[0] != kAcpiAmlOpcType_Invalid)
|
---|
1442 | {
|
---|
1443 | bool fOld = pThis->fIndent;
|
---|
1444 | pThis->fIndent = false;
|
---|
1445 |
|
---|
1446 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, " (");
|
---|
1447 | if (RT_FAILURE(rc)) return rc;
|
---|
1448 |
|
---|
1449 | for (uint32_t i = 0; i < RT_ELEMENTS(pAmlOpc->aenmTypes); i++)
|
---|
1450 | {
|
---|
1451 | if (pAmlOpc->aenmTypes[i] == kAcpiAmlOpcType_Invalid)
|
---|
1452 | break; /* End of arguments. */
|
---|
1453 |
|
---|
1454 | if (i > 0)
|
---|
1455 | {
|
---|
1456 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, ", ");
|
---|
1457 | if (RT_FAILURE(rc)) return rc;
|
---|
1458 | }
|
---|
1459 |
|
---|
1460 | switch (pAmlOpc->aenmTypes[i])
|
---|
1461 | {
|
---|
1462 | case kAcpiAmlOpcType_Byte:
|
---|
1463 | {
|
---|
1464 | uint8_t bVal = 0; /* shut up gcc */
|
---|
1465 | rc = rtAcpiTblAmlDecodeReadU8(pThis, &bVal, pErrInfo);
|
---|
1466 | if (RT_FAILURE(rc)) return rc;
|
---|
1467 |
|
---|
1468 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%RU8", bVal);
|
---|
1469 | if (RT_FAILURE(rc)) return rc;
|
---|
1470 |
|
---|
1471 | cbPkgConsumed++;
|
---|
1472 | break;
|
---|
1473 | }
|
---|
1474 | case kAcpiAmlOpcType_Word:
|
---|
1475 | {
|
---|
1476 | uint16_t u16Val = 0; /* shut up gcc */
|
---|
1477 | rc = rtAcpiTblAmlDecodeReadU16(pThis, &u16Val, pErrInfo);
|
---|
1478 | if (RT_FAILURE(rc)) return rc;
|
---|
1479 |
|
---|
1480 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%RX16", u16Val);
|
---|
1481 | if (RT_FAILURE(rc)) return rc;
|
---|
1482 |
|
---|
1483 | cbPkgConsumed += sizeof(uint16_t);
|
---|
1484 | break;
|
---|
1485 | }
|
---|
1486 | case kAcpiAmlOpcType_DWord:
|
---|
1487 | {
|
---|
1488 | uint32_t u32Val = 0; /* shut up gcc */
|
---|
1489 | rc = rtAcpiTblAmlDecodeReadU32(pThis, &u32Val, pErrInfo);
|
---|
1490 | if (RT_FAILURE(rc)) return rc;
|
---|
1491 |
|
---|
1492 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%RX32", u32Val);
|
---|
1493 | if (RT_FAILURE(rc)) return rc;
|
---|
1494 |
|
---|
1495 | cbPkgConsumed += sizeof(uint32_t);
|
---|
1496 | break;
|
---|
1497 | }
|
---|
1498 | case kAcpiAmlOpcType_NameString:
|
---|
1499 | {
|
---|
1500 | char szName[512];
|
---|
1501 | size_t cbName = 0;
|
---|
1502 | rc = rtAcpiTblAmlDecodeNameString(pThis, &szName[0], sizeof(szName), &cbName, pErrInfo);
|
---|
1503 | if (RT_FAILURE(rc)) return rc;
|
---|
1504 |
|
---|
1505 | PRTACPITBLAMLOBJ pIt;
|
---|
1506 | bool fFound = false;
|
---|
1507 | RTListForEach(&pThis->LstObjs, pIt, RTACPITBLAMLOBJ, NdObjs)
|
---|
1508 | {
|
---|
1509 | if (!strcmp(pIt->szName, szName))
|
---|
1510 | {
|
---|
1511 | fFound = true;
|
---|
1512 | break;
|
---|
1513 | }
|
---|
1514 | }
|
---|
1515 |
|
---|
1516 | if (fFound)
|
---|
1517 | {
|
---|
1518 | if (pIt->enmType == kAcpiAmlObjType_Method)
|
---|
1519 | {
|
---|
1520 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%s(", szName);
|
---|
1521 | if (RT_FAILURE(rc)) return rc;
|
---|
1522 |
|
---|
1523 | bool fIndentOld = pThis->fIndent;
|
---|
1524 | pThis->fIndent = false;
|
---|
1525 |
|
---|
1526 | size_t offTblOrig = pThis->offTbl;
|
---|
1527 | for (uint32_t iArg = 0; iArg < pIt->u.cMethodArgs; iArg++)
|
---|
1528 | {
|
---|
1529 | rc = rtAcpiTblAmlDecodeTerminal(pThis, hVfsIosOut, pErrInfo);
|
---|
1530 | if (RT_FAILURE(rc)) return rc;
|
---|
1531 |
|
---|
1532 | if (iArg < pIt->u.cMethodArgs - 1)
|
---|
1533 | {
|
---|
1534 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, ", ", szName);
|
---|
1535 | if (RT_FAILURE(rc)) return rc;
|
---|
1536 | }
|
---|
1537 | }
|
---|
1538 | cbPkgConsumed += pThis->offTbl - offTblOrig;
|
---|
1539 |
|
---|
1540 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, ")");
|
---|
1541 | pThis->fIndent = fIndentOld;
|
---|
1542 | }
|
---|
1543 | else
|
---|
1544 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%s", szName);
|
---|
1545 | }
|
---|
1546 | else
|
---|
1547 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%s", szName);
|
---|
1548 | if (RT_FAILURE(rc)) return rc;
|
---|
1549 |
|
---|
1550 |
|
---|
1551 | cbPkgConsumed += cbName;
|
---|
1552 | break;
|
---|
1553 | }
|
---|
1554 | case kAcpiAmlOpcType_SuperName:
|
---|
1555 | case kAcpiAmlOpcType_TermArg:
|
---|
1556 | {
|
---|
1557 | /** @todo SuperName has limited allowed arguments. */
|
---|
1558 | size_t offTblOrig = pThis->offTbl;
|
---|
1559 |
|
---|
1560 | rc = rtAcpiTblAmlDecodeTerminal(pThis, hVfsIosOut, pErrInfo);
|
---|
1561 | if (RT_FAILURE(rc)) return rc;
|
---|
1562 |
|
---|
1563 | cbPkgConsumed += pThis->offTbl - offTblOrig;
|
---|
1564 | break;
|
---|
1565 | }
|
---|
1566 | case kAcpiAmlOpcType_Invalid:
|
---|
1567 | default:
|
---|
1568 | AssertReleaseFailed();
|
---|
1569 | }
|
---|
1570 | }
|
---|
1571 |
|
---|
1572 | rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, ")");
|
---|
1573 | if (RT_FAILURE(rc)) return rc;
|
---|
1574 |
|
---|
1575 | pThis->fIndent = fOld;
|
---|
1576 | }
|
---|
1577 |
|
---|
1578 | if (pAmlOpc->fFlags & RTACPI_AML_OPC_F_HAS_PKG_LENGTH)
|
---|
1579 | {
|
---|
1580 | if (cbPkg < cbPkgConsumed)
|
---|
1581 | return RTErrInfoSetF(pErrInfo, VERR_BUFFER_OVERFLOW, "Opcode arguments consumed more than the package length indicated (%zu vs %zu)", cbPkg, cbPkgConsumed);
|
---|
1582 | rc = rtAcpiTblAmlDecodePkgPush(pThis, hVfsIosOut, cbPkg - cbPkgConsumed, pErrInfo);
|
---|
1583 | }
|
---|
1584 |
|
---|
1585 | return rc;
|
---|
1586 | }
|
---|
1587 |
|
---|
1588 | static int rtAcpiTblAmlDecode(PRTACPITBLAMLDECODE pThis, PCRTACPIAMLOPC pAmlOpc, uint8_t bOpc, RTVFSIOSTREAM hVfsIosOut, PRTERRINFO pErrInfo)
|
---|
1589 | {
|
---|
1590 | if (pAmlOpc->pszOpc)
|
---|
1591 | {
|
---|
1592 | if (pAmlOpc->pfnDecode)
|
---|
1593 | return pAmlOpc->pfnDecode(pThis, hVfsIosOut, bOpc, pErrInfo);
|
---|
1594 | return rtAcpiTblAmlDecodeSimple(pThis, pAmlOpc, bOpc, hVfsIosOut, pErrInfo);
|
---|
1595 | }
|
---|
1596 |
|
---|
1597 | return RTErrInfoSetF(pErrInfo, VERR_INVALID_STATE, "Invalid opcode %#x in ACPI table at offset %u", bOpc, pThis->offTbl);
|
---|
1598 | }
|
---|
1599 |
|
---|
1600 |
|
---|
1601 | static int rtAcpiTblAmlDecodeTerminal(PRTACPITBLAMLDECODE pThis, RTVFSIOSTREAM hVfsIosOut, PRTERRINFO pErrInfo)
|
---|
1602 | {
|
---|
1603 | PCRTACPIAMLOPC pAmlOpc = NULL;
|
---|
1604 | uint8_t bOpc = 0; /* shut up gcc */
|
---|
1605 | int rc = rtAcpiTblAmlDecodeReadU8(pThis, &bOpc, pErrInfo);
|
---|
1606 | if (RT_SUCCESS(rc))
|
---|
1607 | {
|
---|
1608 | if (bOpc == ACPI_AML_BYTE_CODE_PREFIX_EXT_OP)
|
---|
1609 | {
|
---|
1610 | rc = rtAcpiTblAmlDecodeReadU8(pThis, &bOpc, pErrInfo);
|
---|
1611 | if (RT_FAILURE(rc))
|
---|
1612 | return rc;
|
---|
1613 |
|
---|
1614 | pAmlOpc = &g_aAmlExtOpcodeDecode[bOpc];
|
---|
1615 | }
|
---|
1616 | else
|
---|
1617 | pAmlOpc = &g_aAmlOpcodeDecode[bOpc];
|
---|
1618 |
|
---|
1619 | return rtAcpiTblAmlDecode(pThis, pAmlOpc, bOpc, hVfsIosOut, pErrInfo);
|
---|
1620 | }
|
---|
1621 |
|
---|
1622 | return rc;
|
---|
1623 | }
|
---|
1624 |
|
---|
1625 |
|
---|
1626 | DECLHIDDEN(int) rtAcpiTblConvertFromAmlToAsl(RTVFSIOSTREAM hVfsIosOut, RTVFSIOSTREAM hVfsIosIn, PRTERRINFO pErrInfo)
|
---|
1627 | {
|
---|
1628 | ACPITBLHDR Hdr;
|
---|
1629 | int rc = RTVfsIoStrmRead(hVfsIosIn, &Hdr, sizeof(Hdr), true /*fBlocking*/, NULL /*pcbRead*/);
|
---|
1630 | if (RT_SUCCESS(rc))
|
---|
1631 | {
|
---|
1632 | Hdr.u32Signature = RT_LE2H_U32(Hdr.u32Signature);
|
---|
1633 | Hdr.cbTbl = RT_LE2H_U32(Hdr.cbTbl);
|
---|
1634 | Hdr.u32OemRevision = RT_LE2H_U32(Hdr.u32OemRevision);
|
---|
1635 | Hdr.u32CreatorRevision = RT_LE2H_U32(Hdr.u32CreatorRevision);
|
---|
1636 |
|
---|
1637 | if ( Hdr.u32Signature == ACPI_TABLE_HDR_SIGNATURE_SSDT
|
---|
1638 | || Hdr.u32Signature == ACPI_TABLE_HDR_SIGNATURE_DSDT)
|
---|
1639 | {
|
---|
1640 | uint8_t *pbTbl = (uint8_t *)RTMemAlloc(Hdr.cbTbl);
|
---|
1641 | if (pbTbl)
|
---|
1642 | {
|
---|
1643 | rc = RTVfsIoStrmRead(hVfsIosIn, pbTbl, Hdr.cbTbl - sizeof(Hdr), true /*fBlocking*/, NULL /*pcbRead*/);
|
---|
1644 | if (RT_SUCCESS(rc))
|
---|
1645 | {
|
---|
1646 | /** @todo Verify checksum */
|
---|
1647 | ssize_t cch = RTVfsIoStrmPrintf(hVfsIosOut, "DefinitionBlock(\"\", \"%s\", %u, \"%.6s\", \"%.8s\", %u)",
|
---|
1648 | Hdr.u32Signature == ACPI_TABLE_HDR_SIGNATURE_SSDT ? "SSDT" : "DSDT",
|
---|
1649 | 1, &Hdr.abOemId[0], &Hdr.abOemTblId[0], Hdr.u32OemRevision);
|
---|
1650 | if (cch > 0)
|
---|
1651 | {
|
---|
1652 | RTACPITBLAMLDECODE AmlDecode;
|
---|
1653 | AmlDecode.pbTbl = pbTbl;
|
---|
1654 | AmlDecode.cbTbl = Hdr.cbTbl - sizeof(Hdr);
|
---|
1655 | AmlDecode.offTbl = 0;
|
---|
1656 | AmlDecode.iLvl = 0;
|
---|
1657 | AmlDecode.cPkgStackMax = 0;
|
---|
1658 | AmlDecode.pacbPkgLeft = NULL;
|
---|
1659 | AmlDecode.fIndent = true;
|
---|
1660 | RTListInit(&AmlDecode.LstObjs);
|
---|
1661 | rc = rtAcpiTblAmlDecodePkgPush(&AmlDecode, hVfsIosOut, AmlDecode.cbTbl, pErrInfo);
|
---|
1662 | while ( RT_SUCCESS(rc)
|
---|
1663 | && AmlDecode.offTbl < Hdr.cbTbl - sizeof(Hdr))
|
---|
1664 | {
|
---|
1665 | rc = rtAcpiTblAmlDecodeTerminal(&AmlDecode, hVfsIosOut, pErrInfo);
|
---|
1666 | if (RT_SUCCESS(rc))
|
---|
1667 | rc = rtAcpiTblAmlDecodePkgPop(&AmlDecode, hVfsIosOut, pErrInfo);
|
---|
1668 | }
|
---|
1669 | if (AmlDecode.pacbPkgLeft)
|
---|
1670 | RTMemFree(AmlDecode.pacbPkgLeft);
|
---|
1671 |
|
---|
1672 | PRTACPITBLAMLOBJ pIt, pItNext;
|
---|
1673 | RTListForEachSafe(&AmlDecode.LstObjs, pIt, pItNext, RTACPITBLAMLOBJ, NdObjs)
|
---|
1674 | {
|
---|
1675 | RTListNodeRemove(&pIt->NdObjs);
|
---|
1676 | RTMemFree(pIt);
|
---|
1677 | }
|
---|
1678 |
|
---|
1679 | if (RT_SUCCESS(rc))
|
---|
1680 | {
|
---|
1681 | cch = RTVfsIoStrmPrintf(hVfsIosOut, "}\n");
|
---|
1682 | if (cch <= 0)
|
---|
1683 | rc = RTErrInfoSetF(pErrInfo, cch == 0 ? VERR_NO_MEMORY : (int)cch, "Failed to emit closing definition block");
|
---|
1684 | }
|
---|
1685 | }
|
---|
1686 | else
|
---|
1687 | rc = RTErrInfoSetF(pErrInfo, cch == 0 ? VERR_NO_MEMORY : (int)cch, "Failed to emit DefinitionBlock()");
|
---|
1688 | }
|
---|
1689 | else
|
---|
1690 | rc = RTErrInfoSetF(pErrInfo, rc, "Reading %u bytes of the ACPI table failed", Hdr.cbTbl);
|
---|
1691 |
|
---|
1692 | RTMemFree(pbTbl);
|
---|
1693 | pbTbl = NULL;
|
---|
1694 | }
|
---|
1695 | else
|
---|
1696 | rc = RTErrInfoSetF(pErrInfo, VERR_NO_MEMORY, "Allocating memory for the ACPI table failed");
|
---|
1697 | }
|
---|
1698 | else
|
---|
1699 | rc = RTErrInfoSetF(pErrInfo, VERR_NOT_SUPPORTED, "Only DSDT and SSDT ACPI tables are supported");
|
---|
1700 | }
|
---|
1701 | else
|
---|
1702 | rc = RTErrInfoSetF(pErrInfo, rc, "Reading the ACPI table header failed with %Rrc", rc);
|
---|
1703 |
|
---|
1704 | return rc;
|
---|
1705 | }
|
---|