Skip to content

Commit

Permalink
FDT stuff, very dirty
Browse files Browse the repository at this point in the history
  • Loading branch information
halal-beef committed Jul 19, 2024
1 parent 4fb1aed commit ffe8fe1
Show file tree
Hide file tree
Showing 22 changed files with 6,233 additions and 4 deletions.
2 changes: 2 additions & 0 deletions BootShim/AARCH64/BootShim.S
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ _StackSize:
.long 0 /* Reserved */

_Start:
mov x10, (UEFI_BASE + UEFI_SIZE)
str x0, [x10]
mov x4, x1
ldr x5, _StackBase
cmp x4, x5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ gDeviceMemoryDescriptorEx[] = {
{"UEFI Stack", 0x80002000, 0x00040000, AddMem, SYS_MEM, SYS_MEM_CAP, BsData, WRITE_BACK},
{"RAM Partition", 0x80042000, 0x11FBE000, AddMem, SYS_MEM, SYS_MEM_CAP, Conv, WRITE_BACK},
{"UEFI FD", 0x92000000, 0x00200000, AddMem, SYS_MEM, SYS_MEM_CAP, BsData, WRITE_BACK},
{"DXE Heap", 0x92200000, 0x03C00000, AddMem, SYS_MEM, SYS_MEM_CAP, Conv, WRITE_BACK},
{"RAM Partition", 0x95E00000, 0x24D00000, AddMem, SYS_MEM, SYS_MEM_CAP, Conv, WRITE_BACK},
{"FDT", 0x92200000, 0x00001000, AddMem, MEM_RES, SYS_MEM_CAP, Reserv, UNCACHED_UNBUFFERED},
{"DXE Heap", 0x92201000, 0x03C00000, AddMem, SYS_MEM, SYS_MEM_CAP, Conv, WRITE_BACK},
{"RAM Partition", 0x95E01000, 0x24CFF000, AddMem, SYS_MEM, SYS_MEM_CAP, Conv, WRITE_BACK},

// Memory Hole: 0xBAB00000 -> 0xC1200000 (0x6700000)

Expand Down
30 changes: 29 additions & 1 deletion Platforms/Samsung/x1sPkg/Library/DevicePrePiLib/DevicePrePiLib.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
#include <Library/DevicePrePiLib.h>
#include <Library/DebugLib.h>
#include <Library/IoLib.h>

#include "libfdt.h"

VOID
DeviceInitialize () {}
DeviceInitialize ()
{
UINT32 fdtBase = MmioRead32(0x92200000);

DEBUG((EFI_D_WARN, "\n\n\n\nFDT Base: 0x%x\n", fdtBase));
DEBUG((EFI_D_ERROR, "\n\n\n\nFDT Base: 0x%x\n", fdtBase));

UINT32 fdt = MmioRead32(0x8A080000);
DEBUG((EFI_D_WARN, "FDT MAGIC: 0x%x\n", fdt));

CONST VOID *fdtP = (CONST VOID *)(0x8A080000);

if (fdt_check_header(fdtP) == 0) DEBUG((EFI_D_WARN, "ITS AN FDT JIM\n"));

INT32 offset = 0;

while ((offset = fdt_next_node(fdtP, offset, NULL)) >= 0) {
const char *node_name = fdt_get_name(fdtP, offset, NULL);
DEBUG((EFI_D_WARN, "Node: %s\n", node_name));
}

// if(FdtCheckHeader (fdt) == 0) DEBUG((EFI_D_WARN, "ITS AN FDT JIM\n"));

while(TRUE){}
}
19 changes: 19 additions & 0 deletions Platforms/Samsung/x1sPkg/Library/DevicePrePiLib/DevicePrePiLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,26 @@

[Sources]
DevicePrePiLib.c
fdt.c
fdt_addresses.c
fdt_check.c
fdt_empty_tree.c
fdt_overlay.c
fdt_ro.c
fdt_rw.c
fdt_strerror.c
fdt_sw.c
fdt_strfuncs.c
fdt_wip.c
fdt.h
libfdt.h
libfdt_env.h
libfdt_internal.h

[Packages]
MdePkg/MdePkg.dec
SiliciumPkg/SiliciumPkg.dec

[LibraryClasses]
IoLib
DebugLib
3 changes: 3 additions & 0 deletions Platforms/Samsung/x1sPkg/Library/DevicePrePiLib/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Tree traversal functions
- Graft function
- Complete libfdt.h documenting comments
Loading

0 comments on commit ffe8fe1

Please sign in to comment.