VirtualBox

Changeset 107064 in vbox


Ignore:
Timestamp:
Nov 20, 2024 8:21:23 PM (2 months ago)
Author:
vboxsync
Message:

Runtime/RTAcpi*: Support more statements, an extended variant of the Region() API, bugref:10733

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/acpi.h

    r107063 r107064  
    261261 */
    262262RTDECL(int) RTAcpiTblNameAppend(RTACPITBL hAcpiTbl, const char *pszName);
     263
     264
     265/**
     266 * Appends a new NullName object.
     267 *
     268 * @returns IPRT status code.
     269 * @param   hAcpiTbl            The ACPI table handle.
     270 */
     271RTDECL(int) RTAcpiTblNullNameAppend(RTACPITBL hAcpiTbl);
     272
     273
     274/**
     275 * Appends a new NameString object.
     276 *
     277 * @returns IPRT status code.
     278 * @param   hAcpiTbl            The ACPI table handle.
     279 * @param   pszName             The name to append.
     280 */
     281RTDECL(int) RTAcpiTblNameStringAppend(RTACPITBL hAcpiTbl, const char *pszName);
    263282
    264283
     
    321340    kAcpiStmt_Break,
    322341    /** Continue statement. */
    323     kAcpiStmt_Continue
     342    kAcpiStmt_Continue,
     343    /** Add(Operand, Operand, Target) statement. */
     344    kAcpiStmt_Add,
     345    /** Subtract(Operand, Operand, Target) statement. */
     346    kAcpiStmt_Subtract,
     347    /** And(Operand, Operand, Target) statement. */
     348    kAcpiStmt_And,
     349    /** Nand(Operand, Operand, Target) statement. */
     350    kAcpiStmt_Nand,
     351    /** Or(Operand, Operand, Target) statement. */
     352    kAcpiStmt_Or,
     353    /** Xor(Operand, Operand, Target) statement. */
     354    kAcpiStmt_Xor,
     355    /** Not(Operand, Target) statement. */
     356    kAcpiStmt_Not,
     357    /** Store(TermArg, Supername) statement. */
     358    kAcpiStmt_Store,
     359    /** Index(BuffPkgStrObj, IndexValue, Target) statement. */
     360    kAcpiStmt_Index,
     361    /** DerefOf(ObjReference) statement. */
     362    kAcpiStmt_DerefOf
    324363} RTACPISTMT;
    325364
     
    480519
    481520/**
     521 * Appends a new OperationRegion() to the given ACPI table - extended version.
     522 *
     523 * @returns IPRT status code.
     524 * @param   hAcpiTbl            The ACPI table handle.
     525 * @param   pszName             The name of the operation region.
     526 * @param   enmSpace            The operation region space type.
     527 *
     528 * @note This doesn't encode the region offset and size arguments but leaves it up to the caller
     529 *       to be able to encode complex stuff.
     530 */
     531RTDECL(int) RTAcpiTblOpRegionAppendEx(RTACPITBL hAcpiTbl, const char *pszName, RTACPIOPREGIONSPACE enmSpace);
     532
     533
     534/**
    482535 * Appends a new OperationRegion() to the given ACPI table.
    483536 *
  • trunk/include/iprt/mangling.h

    r107063 r107064  
    412412# define RTAcpiTblMethodFinalize                        RT_MANGLER(RTAcpiTblMethodFinalize)
    413413# define RTAcpiTblNameAppend                            RT_MANGLER(RTAcpiTblNameAppend)
     414# define RTAcpiTblNameStringAppend                      RT_MANGLER(RTAcpiTblNameStringAppend)
     415# define RTAcpiTblNullNameAppend                        RT_MANGLER(RTAcpiTblNullNameAppend)
    414416# define RTAcpiTblOpRegionAppend                        RT_MANGLER(RTAcpiTblOpRegionAppend)
     417# define RTAcpiTblOpRegionAppendEx                      RT_MANGLER(RTAcpiTblOpRegionAppendEx)
    415418# define RTAcpiTblPackageStart                          RT_MANGLER(RTAcpiTblPackageStart)
    416419# define RTAcpiTblPackageFinalize                       RT_MANGLER(RTAcpiTblPackageFinalize)
  • trunk/src/VBox/Runtime/common/misc/acpi.cpp

    r107063 r107064  
    750750
    751751
     752RTDECL(int) RTAcpiTblNullNameAppend(RTACPITBL hAcpiTbl)
     753{
     754    PRTACPITBLINT pThis = hAcpiTbl;
     755    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     756
     757    rtAcpiTblAppendByte(pThis, 0x00);
     758    return pThis->rcErr;
     759}
     760
     761
     762RTDECL(int) RTAcpiTblNameStringAppend(RTACPITBL hAcpiTbl, const char *pszName)
     763{
     764    PRTACPITBLINT pThis = hAcpiTbl;
     765    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     766
     767    rtAcpiTblAppendNameString(pThis, pszName);
     768    return pThis->rcErr;
     769}
     770
     771
    752772RTDECL(int) RTAcpiTblStringAppend(RTACPITBL hAcpiTbl, const char *psz)
    753773{
     
    849869        case kAcpiStmt_Break:      bOp = ACPI_AML_BYTE_CODE_OP_BREAK;       break;
    850870        case kAcpiStmt_Continue:   bOp = ACPI_AML_BYTE_CODE_OP_CONTINUE;    break;
     871        case kAcpiStmt_Add:        bOp = ACPI_AML_BYTE_CODE_OP_ADD;         break;
     872        case kAcpiStmt_Subtract:   bOp = ACPI_AML_BYTE_CODE_OP_SUBTRACT;    break;
     873        case kAcpiStmt_And:        bOp = ACPI_AML_BYTE_CODE_OP_AND;         break;
     874        case kAcpiStmt_Nand:       bOp = ACPI_AML_BYTE_CODE_OP_NAND;        break;
     875        case kAcpiStmt_Or:         bOp = ACPI_AML_BYTE_CODE_OP_OR;          break;
     876        case kAcpiStmt_Xor:        bOp = ACPI_AML_BYTE_CODE_OP_XOR;         break;
     877        case kAcpiStmt_Not:        bOp = ACPI_AML_BYTE_CODE_OP_NOT;         break;
     878        case kAcpiStmt_Store:      bOp = ACPI_AML_BYTE_CODE_OP_STORE;       break;
     879        case kAcpiStmt_Index:      bOp = ACPI_AML_BYTE_CODE_OP_INDEX;       break;
     880        case kAcpiStmt_DerefOf:    bOp = ACPI_AML_BYTE_CODE_OP_DEREF_OF;    break;
    851881        default:
    852882            AssertFailedReturn(VERR_INVALID_PARAMETER);
     
    9771007
    9781008
    979 RTDECL(int) RTAcpiTblOpRegionAppend(RTACPITBL hAcpiTbl, const char *pszName, RTACPIOPREGIONSPACE enmSpace,
    980                                     uint64_t offRegion, uint64_t cbRegion)
     1009RTDECL(int) RTAcpiTblOpRegionAppendEx(RTACPITBL hAcpiTbl, const char *pszName, RTACPIOPREGIONSPACE enmSpace)
    9811010{
    9821011    PRTACPITBLINT pThis = hAcpiTbl;
     
    10061035    }
    10071036    rtAcpiTblAppendByte(pThis, bRegionSpace);
     1037    return pThis->rcErr;
     1038}
     1039
     1040
     1041RTDECL(int) RTAcpiTblOpRegionAppend(RTACPITBL hAcpiTbl, const char *pszName, RTACPIOPREGIONSPACE enmSpace,
     1042                                    uint64_t offRegion, uint64_t cbRegion)
     1043{
     1044    PRTACPITBLINT pThis = hAcpiTbl;
     1045    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     1046
     1047    int rc = RTAcpiTblOpRegionAppendEx(pThis, pszName, enmSpace);
     1048    if (RT_FAILURE(rc))
     1049        return rc;
     1050
    10081051    RTAcpiTblIntegerAppend(pThis, offRegion);
    10091052    RTAcpiTblIntegerAppend(pThis, cbRegion);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette