-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upl #10570
Draft
sjg20
wants to merge
28
commits into
tianocore:master
Choose a base branch
from
sjg20:upl
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Upl #10570
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
e925cdf
MdeModulePkg: HobPrintLib: Fix CPU HOB format specifiers
benjamindoron f07203a
UefiPayloadPkg: Fix FIT image's FDT property names
benjamindoron eb915bc
UefiPayloadPkg: Fix unnecessary arch-specific DSC lines and bugs
benjamindoron fde5dec
UefiPayloadPkg: HobParseLib: Strip down library's imports
benjamindoron f9d008c
UefiPayloadPkg: CustomFdtNodeParserLib: Make "hoblistptr" optional
benjamindoron 891f0ba
UefiPayloadPkg: FdtParserLib: Don't accept reserved-memory
benjamindoron 1fda1d0
UefiPayloadPkg: FdtParserLib: Improve handling of cross-node dependency
benjamindoron 748ed6a
UefiPayloadPkg: FdtParserLib: Handling "serial" FDT nodes
benjamindoron 0b6e89e
UefiPayloadPkg: FdtParserLib: Cleanup the function a little
benjamindoron 30a676b
UefiPayloadPkg: "load" property should reflect image, not whole FIT
benjamindoron 00815b4
UefiPayloadPkg: FdtParserLib: Make "pci-rb" optional
benjamindoron a769797
UefiPayloadPkg: Add support for finding FVs in the UPL FDT
benjamindoron de74337
UefiPayloadPkg: Change "entry-start" prop to "entry"
benjamindoron cf49140
DNM: UefiPayloadPkg: FdtParserLib: Support coreboot memory nodes
benjamindoron fb56700
Tianocore: Move libfdt to the latest version
sjg20 71bf1a3
UefiPayloadPkg: Convert to use Fdt class
sjg20 50583c8
UefiPayloadPkg: Set the loadables property
sjg20 8c92b74
UefiPayloadPkg: Use the correct 'firmware' type
sjg20 da883d0
UefiPayloadPkg: Set the OS type
sjg20 510d4ff
UefiPayloadPkg: Use i386 for the architecture
sjg20 b16de57
UefiPayloadPkg: Raise an exception on error
sjg20 98be596
UefiPayloadPkg: Correct data-offset property
sjg20 cc71486
UefiPayloadPkg: Set the architecture type
sjg20 b8196d1
UefiPayloadPkg: Improve debugging messages in CustomFdtNodeParserLib
sjg20 4bea365
UefiPayloadPkg: Use UPL description rather than name
sjg20 14e69b8
UefiPayloadPkg: Fix up serial debugging
sjg20 6b96c9e
UefiPayloadPkg: Use an assumed FIT totalsize of 4K
sjg20 3826c86
WIP: Debugging
sjg20 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,7 @@ def BuildFvImageNode(Fdt, InfoHeader, ParentNode, DataOffset, DataSize, Descript | |
Fdt.setprop_str(ParentNode, 'project', 'tianocore') | ||
Fdt.setprop_str(ParentNode, 'arch',Arch) | ||
Fdt.setprop_str(ParentNode, 'type', 'firmware') | ||
Fdt.setprop_u64(ParentNode, 'load', InfoHeader.LoadAddr + DataOffset - InfoHeader.DataOffset) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FVs aren't place-specific. Do we need a |
||
Fdt.setprop_str(ParentNode, 'description', Description) | ||
|
||
def BuildTianoImageNode(Fdt, InfoHeader, ParentNode, DataOffset, DataSize, Description, Arch): | ||
|
@@ -79,7 +80,7 @@ def BuildTianoImageNode(Fdt, InfoHeader, ParentNode, DataOffset, DataSize, Descr | |
if InfoHeader.DataSize is not None: | ||
Fdt.setprop_u32(ParentNode, 'data-size', DataSize) | ||
if InfoHeader.DataOffset is not None: | ||
Fdt.setprop_u32(ParentNode, 'data-offset', DataOffset) | ||
Fdt.setprop_u32(ParentNode, 'data-offset', DataOffset - InfoHeader.DataOffset) | ||
if InfoHeader.Producer is not None: | ||
Fdt.setprop_str(ParentNode, 'producer', InfoHeader.Producer) | ||
if InfoHeader.Capabilities is not None: | ||
|
@@ -170,7 +171,7 @@ def MakeFitImage(InfoHeader, Arch): | |
# | ||
return BuildFitImage(Fdt, InfoHeader, Arch) | ||
|
||
def ReplaceFv (UplBinary, SectionFvFile, SectionName, Arch): | ||
def ReplaceFv (UplBinary, SectionFvFile, SectionName, Arch, DataOffset): | ||
try: | ||
# | ||
# Get Original Multi Fv | ||
|
@@ -198,7 +199,7 @@ def ReplaceFv (UplBinary, SectionFvFile, SectionName, Arch): | |
MultiFvList = [] | ||
for Item in LoadablesList: | ||
ImageNode = libfdt.fdt_subnode_offset(NewFitHeader, ImagesNode, Item) | ||
ImageOffset = int.from_bytes (libfdt.fdt_getprop (NewFitHeader, ImageNode, 'data-offset')[0], 'big') | ||
ImageOffset = int.from_bytes (libfdt.fdt_getprop (NewFitHeader, ImageNode, 'data-offset')[0], 'big') + DataOffset | ||
ImageSize = int.from_bytes (libfdt.fdt_getprop (NewFitHeader, ImageNode, 'data-size')[0], 'big') | ||
MultiFvList.append ([Item, Dtb[ImageOffset:ImageOffset + ImageSize]]) | ||
|
||
|
@@ -229,9 +230,9 @@ def ReplaceFv (UplBinary, SectionFvFile, SectionName, Arch): | |
else: | ||
for Index in range (0, len (MultiFvList)): | ||
ImageNode = libfdt.fdt_subnode_offset(NewFitHeader, ImagesNode, MultiFvList[Index][0]) | ||
ImageOffset = int.from_bytes (libfdt.fdt_getprop (NewFitHeader, ImageNode, 'data-offset')[0], 'big') | ||
ImageOffset = int.from_bytes (libfdt.fdt_getprop (NewFitHeader, ImageNode, 'data-offset')[0], 'big') + DataOffset | ||
if ImageOffset > ReplaceOffset: | ||
libfdt.fdt_setprop_u32(NewFitHeader, ImageNode, 'data-offset', ImageOffset + OffsetDelta) | ||
libfdt.fdt_setprop_u32(NewFitHeader, ImageNode, 'data-offset', ImageOffset + OffsetDelta - DataOffset) | ||
|
||
ConfNodes = libfdt.fdt_subnode_offset(NewFitHeader, 0, 'configurations') | ||
libfdt.fdt_setprop(NewFitHeader, ConfNodes, 'default', bytes('conf-1', 'utf-8'), len('conf-1') + 1) | ||
|
@@ -244,7 +245,7 @@ def ReplaceFv (UplBinary, SectionFvFile, SectionName, Arch): | |
# | ||
ImagesNode = libfdt.fdt_subnode_offset(NewFitHeader, 0, 'images') | ||
TianoNode = libfdt.fdt_subnode_offset(NewFitHeader, ImagesNode, 'tianocore') | ||
TianoOffset = int.from_bytes (libfdt.fdt_getprop (NewFitHeader, TianoNode, 'data-offset')[0], 'big') | ||
TianoOffset = int.from_bytes (libfdt.fdt_getprop (NewFitHeader, TianoNode, 'data-offset')[0], 'big') + DataOffset | ||
TianoSize = int.from_bytes (libfdt.fdt_getprop (NewFitHeader, TianoNode, 'data-size')[0], 'big') | ||
TianoBinary = Dtb[TianoOffset:TianoOffset + TianoSize] | ||
|
||
|
@@ -256,7 +257,7 @@ def ReplaceFv (UplBinary, SectionFvFile, SectionName, Arch): | |
NewUplBinary[len(NewFitHeader):len(NewFitHeader) + len(TianoBinary)] = TianoBinary | ||
for Index in range (0, len (MultiFvList)): | ||
ImageNode = libfdt.fdt_subnode_offset(NewFitHeader, ImagesNode, MultiFvList[Index][0]) | ||
ImageOffset = int.from_bytes (libfdt.fdt_getprop (NewFitHeader, ImageNode, 'data-offset')[0], 'big') | ||
ImageOffset = int.from_bytes (libfdt.fdt_getprop (NewFitHeader, ImageNode, 'data-offset')[0], 'big') + DataOffset | ||
ImageSize = int.from_bytes (libfdt.fdt_getprop (NewFitHeader, ImageNode, 'data-size')[0], 'big') | ||
NewUplBinary[ImageOffset:ImageOffset + ImageSize] = MultiFvList[Index][1] | ||
print("Update " + MultiFvList[Index][0] + "\t\t to " + str(hex(ImageOffset)) + "\t ~ " + str(hex(ImageOffset + ImageSize))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to break PayloadLoaderPeim and coreboot. If the changes have to be made, I'll likely be making coreboot's, but please sync this with FitPayloadLoaderPeim. This is also getting hard to read, (well, harder, after what I did to
load
) and I'm not sure if we can avoid that