Changeset 107952 in vbox
- Timestamp:
- Jan 27, 2025 6:55:47 PM (4 weeks ago)
- svn:sync-xref-src-repo-rev:
- 167199
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/acpi.h
r107064 r107952 56 56 #ifdef IN_RING3 57 57 58 /** 59 * ACPI table type. 60 */ 61 typedef enum RTACPITBLTYPE 62 { 63 /** The invalid output type. */ 64 RTACPITBLTYPE_INVALID = 0, 65 /** Type is an UTF-8 ASL source. */ 66 RTACPITBLTYPE_ASL, 67 /** Type is the AML bytecode. */ 68 RTACPITBLTYPE_AML, 69 /** Usual 32-bit hack. */ 70 RTACPITBLTYPE_32BIT_HACK = 0x7fffffff 71 } RTACPITBLTYPE; 72 58 73 59 74 /** … … 74 89 */ 75 90 RTDECL(void) RTAcpiTblHdrChecksumGenerate(PACPITBLHDR pTbl, size_t cbTbl); 91 92 93 /** 94 * Creates an ACPI table from the given VFS file. 95 * 96 * @returns IPRT status code. 97 * @param phAcpiTbl Where to store the ACPI table handle on success. 98 * @param hVfsIos The VFS I/O stream handle to read the ACPI table from. 99 * @param enmInType The input type of the ACPI table. 100 * @param pErrInfo Where to return additional error information. 101 */ 102 RTDECL(int) RTAcpiTblCreateFromVfsIoStrm(PRTACPITBL phAcpiTbl, RTVFSIOSTREAM hVfsIos, RTACPITBLTYPE enmInType, PRTERRINFO pErrInfo); 103 104 105 /** 106 * Converts a given ACPI table input stream to the given output type. 107 * 108 * @returns IPRT status code. 109 * @param hVfsIosOut The VFS I/O stream handle to output the result to. 110 * @param enmOutType The output type. 111 * @param hVfsIosIn The VFS I/O stream handle to read the ACPI table from. 112 * @param enmInType The input type of the ACPI table. 113 * @param pErrInfo Where to return additional error information. 114 */ 115 RTDECL(int) RTAcpiTblConvertFromVfsIoStrm(RTVFSIOSTREAM hVfsIosOut, RTACPITBLTYPE enmOutType, 116 RTVFSIOSTREAM hVfsIosIn, RTACPITBLTYPE enmInType, PRTERRINFO pErrInfo); 117 118 119 /** 120 * Creates an ACPI table from the given filename. 121 * 122 * @returns IPRT status code. 123 * @param phAcpiTbl Where to store the ACPI table handle on success. 124 * @param pszFilename The filename to read the ACPI table from. 125 * @param enmInType The input type of the ACPI table. 126 * @param pErrInfo Where to return additional error information. 127 */ 128 RTDECL(int) RTAcpiTblCreateFromFile(PRTACPITBL phAcpiTbl, const char *pszFilename, RTACPITBLTYPE enmInType, PRTERRINFO pErrInfo); 76 129 77 130 … … 129 182 * @returns IPRT status code. 130 183 * @param hAcpiTbl The ACPI table handle. 184 * @param enmOutType The output type. 131 185 * @param hVfsIos The VFS I/O stream handle to dump the table to. 132 186 */ 133 RTDECL(int) RTAcpiTblDumpToVfsIoStrm(RTACPITBL hAcpiTbl, RT VFSIOSTREAM hVfsIos);187 RTDECL(int) RTAcpiTblDumpToVfsIoStrm(RTACPITBL hAcpiTbl, RTACPITBLTYPE enmOutType, RTVFSIOSTREAM hVfsIos); 134 188 135 189 … … 139 193 * @returns IPRT status code. 140 194 * @param hAcpiTbl The ACPI table handle. 195 * @param enmOutType The output type. 141 196 * @param pszFilename The file path to dump the table to. 142 197 */ 143 RTDECL(int) RTAcpiTblDumpToFile(RTACPITBL hAcpiTbl, const char *pszFilename);198 RTDECL(int) RTAcpiTblDumpToFile(RTACPITBL hAcpiTbl, RTACPITBLTYPE enmOutType, const char *pszFilename); 144 199 145 200 -
trunk/include/iprt/formats/acpi-aml.h
r106070 r107952 55 55 /** @name AML Bytecode values (see https://uefi.org/specs/ACPI/6.5/20_AML_Specification.html#aml-byte-stream-byte-values). 56 56 * @{ */ 57 /** Encoding Name: ZeroOp, Encoding Group: Name Object */ 58 #define ACPI_AML_BYTE_CODE_PREFIX_NULL_NAME 0x00 57 59 /** Encoding Name: ZeroOp, Encoding Group: Data Object */ 58 60 #define ACPI_AML_BYTE_CODE_OP_ZERO 0x00 … … 293 295 /** @} */ 294 296 297 298 /** @name Some helpers for classifying AML bytecode. 299 * @{ */ 300 DECLINLINE(bool) rtAcpiAmlOpcIsConstObj(uint8_t bOpc) 301 { 302 return bOpc == ACPI_AML_BYTE_CODE_OP_ZERO 303 || bOpc == ACPI_AML_BYTE_CODE_OP_ONE 304 || bOpc == ACPI_AML_BYTE_CODE_OP_ONES; 305 } 306 307 308 DECLINLINE(bool) rtAcpiAmlOpcIsComputationalData(uint8_t bOpc) 309 { 310 /** @todo RevisionOp (requires two bytes) */ 311 return rtAcpiAmlOpcIsConstObj(bOpc) 312 || bOpc == ACPI_AML_BYTE_CODE_PREFIX_BYTE 313 || bOpc == ACPI_AML_BYTE_CODE_PREFIX_WORD 314 || bOpc == ACPI_AML_BYTE_CODE_PREFIX_DWORD 315 || bOpc == ACPI_AML_BYTE_CODE_PREFIX_QWORD 316 || bOpc == ACPI_AML_BYTE_CODE_PREFIX_STRING 317 || bOpc == ACPI_AML_BYTE_CODE_OP_BUFFER; 318 } 319 320 321 DECLINLINE(bool) rtAcpiAmlOpcIsDataObject(uint8_t bOpc) 322 { 323 return rtAcpiAmlOpcIsComputationalData(bOpc) 324 || bOpc == ACPI_AML_BYTE_CODE_OP_PACKAGE 325 || bOpc == ACPI_AML_BYTE_CODE_OP_VAR_PACKAGE; 326 } 327 328 329 DECLINLINE(bool) rtAcpiAmlOpcIsDataRefObject(uint8_t bOpc) 330 { 331 return rtAcpiAmlOpcIsDataObject(bOpc); /** @todo ObjectReference and DDBHandle. */ 332 } 333 334 335 DECLINLINE(bool) rtAcpiAmlOpcIsArgObj(uint8_t bOpc) 336 { 337 return (bOpc >= ACPI_AML_BYTE_CODE_OP_ARG_0) 338 && (bOpc <= ACPI_AML_BYTE_CODE_OP_ARG_6); 339 } 340 341 342 DECLINLINE(bool) rtAcpiAmlOpcIsLocalObj(uint8_t bOpc) 343 { 344 return (bOpc >= ACPI_AML_BYTE_CODE_OP_LOCAL_0) 345 && (bOpc <= ACPI_AML_BYTE_CODE_OP_LOCAL_7); 346 } 347 348 349 DECLINLINE(bool) rtAcpiAmlOpcIsTermArg(uint8_t bOpc) 350 { 351 /** @todo Type2Opcode */ 352 return rtAcpiAmlOpcIsDataObject(bOpc) 353 || rtAcpiAmlOpcIsArgObj(bOpc) 354 || rtAcpiAmlOpcIsLocalObj(bOpc); 355 } 295 356 /** @} */ 296 357 358 /** @} */ 359 297 360 #endif /* !IPRT_INCLUDED_formats_acpi_aml_h */ 298 361 -
trunk/include/iprt/mangling.h
r107192 r107952 391 391 # define RTAcpiTblBinaryOpAppend RT_MANGLER(RTAcpiTblBinaryOpAppend) 392 392 # define RTAcpiTblBufferAppend RT_MANGLER(RTAcpiTblBufferAppend) 393 # define RTAcpiTblConvertFromVfsIoStrm RT_MANGLER(RTAcpiTblConvertFromVfsIoStrm) 393 394 # define RTAcpiTblCreate RT_MANGLER(RTAcpiTblCreate) 395 # define RTAcpiTblCreateFromVfsIoStrm RT_MANGLER(RTAcpiTblCreateFromVfsIoStrm) 396 # define RTAcpiTblCreateFromFile RT_MANGLER(RTAcpiTblCreateFromFile) 394 397 # define RTAcpiTblDestroy RT_MANGLER(RTAcpiTblDestroy) 395 398 # define RTAcpiTblDeviceFinalize RT_MANGLER(RTAcpiTblDeviceFinalize) -
trunk/src/VBox/Main/src-client/SystemTableBuilder.cpp
r107770 r107952 170 170 171 171 /* Write the DSDT. */ 172 vrc = RTAcpiTblDumpToVfsIoStrm(m_hAcpiDsdt, hVfsIos);172 vrc = RTAcpiTblDumpToVfsIoStrm(m_hAcpiDsdt, RTACPITBLTYPE_AML, hVfsIos); 173 173 AssertRCReturn(vrc, vrc); 174 174 … … 465 465 int SystemTableBuilderAcpi::dumpTables(const char *pszFilename) 466 466 { 467 return RTAcpiTblDumpToFile(m_hAcpiDsdt, pszFilename);467 return RTAcpiTblDumpToFile(m_hAcpiDsdt, RTACPITBLTYPE_AML, pszFilename); 468 468 } 469 469 -
trunk/src/VBox/Runtime/Makefile.kmk
r107192 r107952 599 599 common/misc/RTSystemFirmwareTypeName.cpp \ 600 600 common/misc/acpi.cpp \ 601 common/misc/acpi-decompiler.cpp \ 601 602 common/misc/assert.cpp \ 602 603 common/misc/buildconfig.cpp \ -
trunk/src/VBox/Runtime/common/misc/acpi.cpp
r107951 r107952 605 605 606 606 607 RTDECL(int) RTAcpiTblDumpToVfsIoStrm(RTACPITBL hAcpiTbl, RT VFSIOSTREAM hVfsIos)607 RTDECL(int) RTAcpiTblDumpToVfsIoStrm(RTACPITBL hAcpiTbl, RTACPITBLTYPE enmOutType, RTVFSIOSTREAM hVfsIos) 608 608 { 609 609 PRTACPITBLINT pThis = hAcpiTbl; 610 610 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 611 611 AssertRCReturn(pThis->rcErr, 0); 612 AssertReturn(enmOutType == RTACPITBLTYPE_AML, VERR_NOT_SUPPORTED); 612 613 613 614 return RTVfsIoStrmWrite(hVfsIos, pThis->pbTblBuf, pThis->paPkgStack[0].cbPkg, … … 616 617 617 618 618 RTDECL(int) RTAcpiTblDumpToFile(RTACPITBL hAcpiTbl, const char *pszFilename)619 RTDECL(int) RTAcpiTblDumpToFile(RTACPITBL hAcpiTbl, RTACPITBLTYPE enmOutType, const char *pszFilename) 619 620 { 620 621 RTVFSIOSTREAM hVfsIos = NIL_RTVFSIOSTREAM; … … 624 625 return rc; 625 626 626 rc = RTAcpiTblDumpToVfsIoStrm(hAcpiTbl, hVfsIos);627 rc = RTAcpiTblDumpToVfsIoStrm(hAcpiTbl, enmOutType, hVfsIos); 627 628 RTVfsIoStrmRelease(hVfsIos); 628 629 return rc; -
trunk/src/VBox/Runtime/tools/Makefile.kmk
r106425 r107952 299 299 RTDtc_SOURCES = RTDtc.cpp 300 300 301 # RTIasl - ACPI source language compiler/decompiler. 302 PROGRAMS += RTIasl 303 RTIasl_TEMPLATE = VBoxR3Tool 304 RTIasl_SOURCES = RTIasl.cpp 305 301 306 endif # !VBOX_ONLY_BUILD 302 307
Note:
See TracChangeset
for help on using the changeset viewer.