Changeset 108015 in vbox
- Timestamp:
- Feb 1, 2025 7:21:10 PM (2 months ago)
- svn:sync-xref-src-repo-rev:
- 167287
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 3 added
- 1 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r107952 r108015 395 395 396 396 RuntimeBaseR3_SOURCES := \ 397 common/acpi/acpi.cpp \ 398 common/acpi/acpi-compiler.cpp \ 399 common/acpi/acpi-decompiler.cpp \ 397 400 common/alloc/alloc.cpp \ 398 401 common/alloc/heapsimple.cpp \ … … 598 601 common/misc/RTMemWipeThoroughly.cpp \ 599 602 common/misc/RTSystemFirmwareTypeName.cpp \ 600 common/misc/acpi.cpp \601 common/misc/acpi-decompiler.cpp \602 603 common/misc/assert.cpp \ 603 604 common/misc/buildconfig.cpp \ -
trunk/src/VBox/Runtime/common/acpi/acpi-decompiler.cpp
r108014 r108015 45 45 #include <iprt/err.h> 46 46 #include <iprt/file.h> 47 #include <iprt/list.h> 47 48 #include <iprt/mem.h> 48 49 #include <iprt/string.h> … … 52 53 #include <iprt/formats/acpi-resources.h> 53 54 55 #include "internal/acpi.h" 56 54 57 55 58 /********************************************************************************************************************************* … … 62 65 * Structures and Typedefs * 63 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 64 107 65 108 /** … … 84 127 /** Flag whether to indent. */ 85 128 bool fIndent; 129 /** List of known objects. */ 130 RTLISTANCHOR LstObjs; 86 131 } RTACPITBLAMLDECODE; 87 132 /** Pointer to a ACPI AML -> ASL decoder state. */ … … 422 467 static int rtAcpiTblAmlDecodeIndent(RTVFSIOSTREAM hVfsIos, uint32_t uIndentLvl) 423 468 { 469 ssize_t cch = RTVfsIoStrmPrintf(hVfsIos, "\n"); 470 if (cch != 1) 471 return cch < 0 ? (int)cch : VERR_BUFFER_UNDERFLOW; 472 424 473 while (uIndentLvl--) 425 474 { 426 ssize_tcch = RTVfsIoStrmPrintf(hVfsIos, " ");475 cch = RTVfsIoStrmPrintf(hVfsIos, " "); 427 476 if (cch != 4) 428 477 return cch < 0 ? (int)cch : VERR_BUFFER_UNDERFLOW; … … 501 550 pThis->pacbPkgLeft[iLvlNew] = cbPkg; 502 551 pThis->pacbPkg[iLvlNew] = cbPkg; 503 int rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "{ \n");552 int rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "{"); 504 553 pThis->iLvl = iLvlNew; 505 554 return rc; … … 518 567 519 568 pThis->pacbPkgLeft[pThis->iLvl] -= cbPkg; 520 int rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "} \n");569 int rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "}"); 521 570 if (RT_FAILURE(rc)) 522 571 return rc; … … 617 666 if (RT_FAILURE(rc)) return rc; 618 667 619 return rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%s", szName); 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; 620 709 } 621 710 … … 704 793 705 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 706 844 /** 707 845 * AML Opcode -> ASL decoder array. … … 710 848 { 711 849 #define RTACPI_AML_OPC_INVALID \ 712 { NULL, 0,{ kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL }850 { NULL, RTACPI_AML_OPC_F_NONE, { kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL } 713 851 #define RTACPI_AML_OPC_SIMPLE_0(a_pszOpc, a_fFlags) \ 714 { a_pszOpc, a_fFlags, { kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL }852 { a_pszOpc, a_fFlags, { kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL } 715 853 #define RTACPI_AML_OPC_SIMPLE_1(a_pszOpc, a_fFlags, a_enmType0) \ 716 { a_pszOpc, a_fFlags, { a_enmType0, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL }854 { a_pszOpc, a_fFlags, { a_enmType0, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL } 717 855 #define RTACPI_AML_OPC_SIMPLE_2(a_pszOpc, a_fFlags, a_enmType0, a_enmType1) \ 718 { a_pszOpc, a_fFlags, { a_enmType0, a_enmType1, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL }856 { a_pszOpc, a_fFlags, { a_enmType0, a_enmType1, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL } 719 857 #define RTACPI_AML_OPC_SIMPLE_3(a_pszOpc, a_fFlags, a_enmType0, a_enmType1, a_enmType2) \ 720 { a_pszOpc, a_fFlags, { a_enmType0, a_enmType1, a_enmType2, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL }858 { a_pszOpc, a_fFlags, { a_enmType0, a_enmType1, a_enmType2, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, NULL } 721 859 #define RTACPI_AML_OPC_SIMPLE_4(a_pszOpc, a_fFlags, a_enmType0, a_enmType1, a_enmType2, a_enmType3) \ 722 { a_pszOpc, a_fFlags, { a_enmType0, a_enmType1, a_enmType2, a_enmType3, kAcpiAmlOpcType_Invalid }, NULL }860 { a_pszOpc, a_fFlags, { a_enmType0, a_enmType1, a_enmType2, a_enmType3, kAcpiAmlOpcType_Invalid }, NULL } 723 861 #define RTACPI_AML_OPC_SIMPLE_5(a_pszOpc, a_fFlags, a_enmType0, a_enmType1, a_enmType2, a_enmType3, a_enmType4) \ 724 { a_pszOpc, a_fFlags, { a_enmType0, a_enmType1, a_enmType2, a_enmType3, a_enmType4 }, NULL }862 { a_pszOpc, a_fFlags, { a_enmType0, a_enmType1, a_enmType2, a_enmType3, a_enmType4 }, NULL } 725 863 #define RTACPI_AML_OPC_HANDLER(a_pszOpc, a_pfnHandler) \ 726 { a_pszOpc, 0,{ kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, a_pfnHandler }864 { a_pszOpc, RTACPI_AML_OPC_F_NONE, { kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid, kAcpiAmlOpcType_Invalid }, a_pfnHandler } 727 865 728 866 /* 0x00 */ RTACPI_AML_OPC_SIMPLE_0("Zero", RTACPI_AML_OPC_F_NONE), … … 747 885 /* 0x12 */ RTACPI_AML_OPC_INVALID, 748 886 /* 0x13 */ RTACPI_AML_OPC_INVALID, 749 /* 0x14 */ RTACPI_AML_OPC_ SIMPLE_2("Method", RTACPI_AML_OPC_F_HAS_PKG_LENGTH, kAcpiAmlOpcType_NameString, kAcpiAmlOpcType_Byte),887 /* 0x14 */ RTACPI_AML_OPC_HANDLER( "Method", rtAcpiTblAmlDecodeMethod), 750 888 /* 0x15 */ RTACPI_AML_OPC_SIMPLE_3("External", RTACPI_AML_OPC_F_NONE, kAcpiAmlOpcType_NameString, kAcpiAmlOpcType_Byte, kAcpiAmlOpcType_Byte), 751 889 /* 0x16 */ RTACPI_AML_OPC_INVALID, … … 1303 1441 if (pAmlOpc->aenmTypes[0] != kAcpiAmlOpcType_Invalid) 1304 1442 { 1443 bool fOld = pThis->fIndent; 1305 1444 pThis->fIndent = false; 1306 1445 1307 rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, " (");1446 rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, " ("); 1308 1447 if (RT_FAILURE(rc)) return rc; 1309 1448 … … 1364 1503 if (RT_FAILURE(rc)) return rc; 1365 1504 1366 rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "%s", szName); 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); 1367 1548 if (RT_FAILURE(rc)) return rc; 1549 1368 1550 1369 1551 cbPkgConsumed += cbName; … … 1388 1570 } 1389 1571 1390 rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, ") \n");1572 rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, ")"); 1391 1573 if (RT_FAILURE(rc)) return rc; 1392 1574 1393 pThis->fIndent = true; 1394 } 1395 else if (pThis->fIndent) 1396 { 1397 rc = rtAcpiTblAmlDecodeFormat(pThis, hVfsIosOut, "\n"); 1398 if (RT_FAILURE(rc)) return rc; 1575 pThis->fIndent = fOld; 1399 1576 } 1400 1577 … … 1447 1624 1448 1625 1449 RTDECL(int) RTAcpiTblCreateFromVfsIoStrm(PRTACPITBL phAcpiTbl, RTVFSIOSTREAM hVfsIos, RTACPITBLTYPE enmInType, PRTERRINFO pErrInfo) 1450 { 1451 AssertPtrReturn(phAcpiTbl, VERR_INVALID_POINTER); 1452 AssertReturn(hVfsIos != NIL_RTVFSIOSTREAM, VERR_INVALID_HANDLE); 1453 1454 RT_NOREF(pErrInfo, enmInType); 1455 #if 0 1456 if (enmInType == RTACPITBLTYPE_AML) 1457 return rtAcpiTblLoadAml(phAcpiTbl, hVfsIos, pErrInfo); 1458 #endif 1459 1460 return VERR_NOT_IMPLEMENTED; 1461 } 1462 1463 1464 RTDECL(int) RTAcpiTblConvertFromVfsIoStrm(RTVFSIOSTREAM hVfsIosOut, RTACPITBLTYPE enmOutType, 1465 RTVFSIOSTREAM hVfsIosIn, RTACPITBLTYPE enmInType, PRTERRINFO pErrInfo) 1466 { 1467 AssertReturn(hVfsIosOut != NIL_RTVFSIOSTREAM, VERR_INVALID_HANDLE); 1468 AssertReturn(hVfsIosIn != NIL_RTVFSIOSTREAM, VERR_INVALID_HANDLE); 1469 AssertReturn(enmInType == RTACPITBLTYPE_AML, VERR_NOT_SUPPORTED); 1470 AssertReturn(enmOutType == RTACPITBLTYPE_ASL, VERR_NOT_SUPPORTED); 1471 1626 DECLHIDDEN(int) rtAcpiTblConvertFromAmlToAsl(RTVFSIOSTREAM hVfsIosOut, RTVFSIOSTREAM hVfsIosIn, PRTERRINFO pErrInfo) 1627 { 1472 1628 ACPITBLHDR Hdr; 1473 1629 int rc = RTVfsIoStrmRead(hVfsIosIn, &Hdr, sizeof(Hdr), true /*fBlocking*/, NULL /*pcbRead*/); … … 1489 1645 { 1490 1646 /** @todo Verify checksum */ 1491 ssize_t cch = RTVfsIoStrmPrintf(hVfsIosOut, "DefinitionBlock(\"\", \"%s\", %u, \"%.6s\", \"%.8s\", %u) \n",1647 ssize_t cch = RTVfsIoStrmPrintf(hVfsIosOut, "DefinitionBlock(\"\", \"%s\", %u, \"%.6s\", \"%.8s\", %u)", 1492 1648 Hdr.u32Signature == ACPI_TABLE_HDR_SIGNATURE_SSDT ? "SSDT" : "DSDT", 1493 1649 1, &Hdr.abOemId[0], &Hdr.abOemTblId[0], Hdr.u32OemRevision); … … 1502 1658 AmlDecode.pacbPkgLeft = NULL; 1503 1659 AmlDecode.fIndent = true; 1660 RTListInit(&AmlDecode.LstObjs); 1504 1661 rc = rtAcpiTblAmlDecodePkgPush(&AmlDecode, hVfsIosOut, AmlDecode.cbTbl, pErrInfo); 1505 1662 while ( RT_SUCCESS(rc) … … 1512 1669 if (AmlDecode.pacbPkgLeft) 1513 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 } 1514 1678 1515 1679 if (RT_SUCCESS(rc)) … … 1540 1704 return rc; 1541 1705 } 1542 1543 1544 RTDECL(int) RTAcpiTblCreateFromFile(PRTACPITBL phAcpiTbl, const char *pszFilename, RTACPITBLTYPE enmInType, PRTERRINFO pErrInfo)1545 {1546 RTVFSIOSTREAM hVfsIos = NIL_RTVFSIOSTREAM;1547 int rc = RTVfsChainOpenIoStream(pszFilename, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE,1548 &hVfsIos, NULL /*poffError*/, pErrInfo);1549 if (RT_FAILURE(rc))1550 return rc;1551 1552 rc = RTAcpiTblCreateFromVfsIoStrm(phAcpiTbl, hVfsIos, enmInType, pErrInfo);1553 RTVfsIoStrmRelease(hVfsIos);1554 return rc;1555 } -
trunk/src/VBox/Runtime/common/acpi/acpi.cpp
r108014 r108015 49 49 #include <iprt/formats/acpi-aml.h> 50 50 #include <iprt/formats/acpi-resources.h> 51 52 #include "internal/acpi.h" 51 53 52 54 … … 1103 1105 1104 1106 1107 RTDECL(int) RTAcpiTblCreateFromVfsIoStrm(PRTACPITBL phAcpiTbl, RTVFSIOSTREAM hVfsIos, RTACPITBLTYPE enmInType, PRTERRINFO pErrInfo) 1108 { 1109 AssertPtrReturn(phAcpiTbl, VERR_INVALID_POINTER); 1110 AssertReturn(hVfsIos != NIL_RTVFSIOSTREAM, VERR_INVALID_HANDLE); 1111 1112 RT_NOREF(pErrInfo, enmInType); 1113 #if 0 1114 if (enmInType == RTACPITBLTYPE_AML) 1115 return rtAcpiTblLoadAml(phAcpiTbl, hVfsIos, pErrInfo); 1116 #endif 1117 1118 return VERR_NOT_IMPLEMENTED; 1119 } 1120 1121 1122 RTDECL(int) RTAcpiTblConvertFromVfsIoStrm(RTVFSIOSTREAM hVfsIosOut, RTACPITBLTYPE enmOutType, 1123 RTVFSIOSTREAM hVfsIosIn, RTACPITBLTYPE enmInType, PRTERRINFO pErrInfo) 1124 { 1125 AssertReturn(hVfsIosOut != NIL_RTVFSIOSTREAM, VERR_INVALID_HANDLE); 1126 AssertReturn(hVfsIosIn != NIL_RTVFSIOSTREAM, VERR_INVALID_HANDLE); 1127 1128 if (enmInType == RTACPITBLTYPE_AML && enmOutType == RTACPITBLTYPE_ASL) 1129 return rtAcpiTblConvertFromAmlToAsl(hVfsIosOut, hVfsIosIn, pErrInfo); 1130 else if (enmInType == RTACPITBLTYPE_ASL && enmOutType == RTACPITBLTYPE_AML) 1131 return rtAcpiTblConvertFromAslToAml(hVfsIosOut, hVfsIosIn, pErrInfo); 1132 1133 return VERR_NOT_SUPPORTED; 1134 } 1135 1136 1137 RTDECL(int) RTAcpiTblCreateFromFile(PRTACPITBL phAcpiTbl, const char *pszFilename, RTACPITBLTYPE enmInType, PRTERRINFO pErrInfo) 1138 { 1139 RTVFSIOSTREAM hVfsIos = NIL_RTVFSIOSTREAM; 1140 int rc = RTVfsChainOpenIoStream(pszFilename, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE, 1141 &hVfsIos, NULL /*poffError*/, pErrInfo); 1142 if (RT_FAILURE(rc)) 1143 return rc; 1144 1145 rc = RTAcpiTblCreateFromVfsIoStrm(phAcpiTbl, hVfsIos, enmInType, pErrInfo); 1146 RTVfsIoStrmRelease(hVfsIos); 1147 return rc; 1148 } 1149 1150 1105 1151 /** 1106 1152 * Ensures there is at least the given amount of space in the given ACPI resource.
Note:
See TracChangeset
for help on using the changeset viewer.