Changeset 101453 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Oct 16, 2023 1:22:28 PM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/fdt.cpp
r100048 r101453 1532 1532 1533 1533 1534 RTDECL(int) RTFdtNodePropertyAddU64(RTFDT hFdt, const char *pszProperty, uint64_t u64) 1535 { 1536 PRTFDTINT pThis = hFdt; 1537 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1538 1539 uint32_t u32Low = RT_H2BE_U32((uint32_t)u64); 1540 uint32_t u32High = RT_H2BE_U32((uint32_t)(u64 >> 32)); 1541 return RTFdtNodePropertyAddCellsU32(pThis, pszProperty, 2, u32High, u32Low); 1542 } 1543 1544 1534 1545 RTDECL(int) RTFdtNodePropertyAddString(RTFDT hFdt, const char *pszProperty, const char *pszVal) 1535 1546 { … … 1584 1595 1585 1596 1597 RTDECL(int) RTFdtNodePropertyAddCellsU64(RTFDT hFdt, const char *pszProperty, uint32_t cCells, ...) 1598 { 1599 va_list va; 1600 va_start(va, cCells); 1601 int rc = RTFdtNodePropertyAddCellsU64V(hFdt, pszProperty, cCells, va); 1602 va_end(va); 1603 return rc; 1604 } 1605 1606 1607 RTDECL(int) RTFdtNodePropertyAddCellsU64V(RTFDT hFdt, const char *pszProperty, uint32_t cCells, va_list va) 1608 { 1609 PRTFDTINT pThis = hFdt; 1610 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1611 1612 /* Insert the property name into the strings block. */ 1613 uint32_t offStr; 1614 int rc = rtFdtStringsInsertString(pThis, pszProperty, &offStr); 1615 if (RT_FAILURE(rc)) 1616 return rc; 1617 1618 uint32_t cbProp = cCells * 2 * sizeof(uint32_t) + 3 * sizeof(uint32_t); 1619 1620 rc = rtFdtStructEnsureSpace(pThis, cbProp); 1621 if (RT_FAILURE(rc)) 1622 return rc; 1623 1624 uint32_t *pu32 = (uint32_t *)(pThis->pbStruct + pThis->cbStruct); 1625 *pu32++ = DTB_FDT_TOKEN_PROPERTY_BE; 1626 *pu32++ = RT_H2BE_U32(cCells * 2 * sizeof(uint32_t)); 1627 *pu32++ = RT_H2BE_U32(offStr); 1628 for (uint32_t i = 0; i < cCells; i++) 1629 { 1630 /* First the high 32-bits of the 64-bit value are stored, then the lower ones. */ 1631 uint64_t u64 = va_arg(va, uint64_t); 1632 *pu32++ = RT_H2BE_U32((uint32_t)(u64 >> 32)); 1633 *pu32++ = RT_H2BE_U32((uint32_t)u64); 1634 } 1635 1636 pThis->cbStruct += cbProp; 1637 return VINF_SUCCESS; 1638 } 1639 1640 1586 1641 RTDECL(int) RTFdtNodePropertyAddStringList(RTFDT hFdt, const char *pszProperty, uint32_t cStrings, ...) 1587 1642 {
Note:
See TracChangeset
for help on using the changeset viewer.