Skip to content

Commit

Permalink
DNM: UefiPayloadPkg: FdtParserLib: Support coreboot memory nodes
Browse files Browse the repository at this point in the history
DNM: This is not the way to handle it! Better to stash addr-cells and
size-cells, and have a 'FDT native length to CPU native endianness'
function, which take one of these as an additional argument, calls the
relevant FDT getter, and possibly increments the pointer if necessary.

Signed-off-by: Benjamin Doron <[email protected]>
  • Loading branch information
benjamindoron committed Dec 17, 2024
1 parent de74337 commit cf49140
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ ParseMemory (
if (AsciiStrCmp (TempStr, "reg") == 0) {
Data64 = (UINT64 *)(PropertyPtr->Data);
StartAddress = Fdt64ToCpu (ReadUnaligned64 (Data64));
NumberOfBytes = Fdt64ToCpu (ReadUnaligned64 (Data64 + 1));
NumberOfBytes = Fdt32ToCpu (*(Data64 + 1));

This comment has been minimized.

Copy link
@dhaval-rivos

dhaval-rivos Dec 28, 2024

Contributor

Maybe there is a better way. In our case RV, size node is of 64 bits and causing issues with boot.

} else if (AsciiStrCmp (TempStr, "ecc-detection-bits") == 0) {
Data32 = (UINT32 *)(PropertyPtr->Data);
ECCData = Fdt32ToCpu (*Data32);
Expand Down Expand Up @@ -257,7 +257,7 @@ ParseReservedMemory (
if (TempLen > 0) {
Data64 = (UINT64 *)(PropertyPtr->Data);
StartAddress = Fdt64ToCpu (ReadUnaligned64 (Data64));
NumberOfBytes = Fdt64ToCpu (ReadUnaligned64 (Data64 + 1));
NumberOfBytes = Fdt32ToCpu (*(Data64 + 1));
DEBUG ((DEBUG_INFO, "\n Property %a", TempStr));
DEBUG ((DEBUG_INFO, " %016lX %016lX\n", StartAddress, NumberOfBytes));
}
Expand Down Expand Up @@ -925,7 +925,7 @@ ParseDtb (
if (AsciiStrCmp (TempStr, "reg") == 0) {
Data64 = (UINT64 *)(PropertyPtr->Data);
StartAddress = Fdt64ToCpu (ReadUnaligned64 (Data64));
NumberOfBytes = Fdt64ToCpu (ReadUnaligned64 (Data64 + 1));
NumberOfBytes = Fdt32ToCpu (*(Data64 + 1));
DEBUG ((DEBUG_INFO, "\n Property(%08X) %a", Property, TempStr));
DEBUG ((DEBUG_INFO, " %016lX %016lX", StartAddress, NumberOfBytes));
if (!IsHobConstructed) {
Expand Down

0 comments on commit cf49140

Please sign in to comment.