From 181df970c7018f61e801e89a81dd70c141cc9586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicente=20Cort=C3=A9s?= Date: Wed, 14 Aug 2024 11:59:43 -0400 Subject: [PATCH] fix dxecore and boot --- MSM8909Pkg/CommonDsc.dsc.inc | 1 + MSM8909Pkg/Devices/goyavewifi.dsc | 2 +- MSM8909Pkg/Drivers/SimpleFbDxe/SimpleFbDxe.c | 2 +- MSM8909Pkg/Include/Configuration/DeviceMemoryMap.h | 9 +++++---- MSM8909Pkg/MSM8909Pkg.dsc | 1 + MSM8909Pkg/MSM8909Pkg.fdf | 1 + MSM8909Pkg/PrePi/ModuleEntryPoint.S | 8 ++++++++ 7 files changed, 18 insertions(+), 6 deletions(-) diff --git a/MSM8909Pkg/CommonDsc.dsc.inc b/MSM8909Pkg/CommonDsc.dsc.inc index fc5aa24..4311579 100644 --- a/MSM8909Pkg/CommonDsc.dsc.inc +++ b/MSM8909Pkg/CommonDsc.dsc.inc @@ -64,6 +64,7 @@ ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf + ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf # ARM PL011 UART Driver PL011UartClockLib|ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf diff --git a/MSM8909Pkg/Devices/goyavewifi.dsc b/MSM8909Pkg/Devices/goyavewifi.dsc index 8adb825..b2acb1d 100644 --- a/MSM8909Pkg/Devices/goyavewifi.dsc +++ b/MSM8909Pkg/Devices/goyavewifi.dsc @@ -18,7 +18,7 @@ gEmbeddedTokenSpaceGuid.PcdPrePiStackBase|0x80C00000 gEmbeddedTokenSpaceGuid.PcdPrePiStackSize|0x00040000 # 256K stack gMSM8909PkgTokenSpaceGuid.PcdUefiMemPoolBase|0x80D00000 # DXE Heap base address - gMSM8909PkgTokenSpaceGuid.PcdUefiMemPoolSize|0x03300000 # UefiMemorySize, DXE heap size + gMSM8909PkgTokenSpaceGuid.PcdUefiMemPoolSize|0x0F3B0000 # UefiMemorySize, DXE heap size gArmTokenSpaceGuid.PcdCpuVectorBaseAddress|0x80C40000 # Framebuffer (1024x600) diff --git a/MSM8909Pkg/Drivers/SimpleFbDxe/SimpleFbDxe.c b/MSM8909Pkg/Drivers/SimpleFbDxe/SimpleFbDxe.c index 18780a5..b763e36 100644 --- a/MSM8909Pkg/Drivers/SimpleFbDxe/SimpleFbDxe.c +++ b/MSM8909Pkg/Drivers/SimpleFbDxe/SimpleFbDxe.c @@ -267,7 +267,7 @@ SimpleFbDxeInitialize EFI_PHYSICAL_ADDRESS FrameBufferAddress = MipiFrameBufferAddr; mDisplay.Mode->Info->PixelsPerScanLine = MipiFrameBufferWidth; - mDisplay.Mode->Info->PixelFormat = PixelBlueGreenRedReserved8BitPerColor; + mDisplay.Mode->Info->PixelFormat = PixelRedGreenBlueReserved8BitPerColor; mDisplay.Mode->SizeOfInfo = sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); mDisplay.Mode->FrameBufferBase = FrameBufferAddress; mDisplay.Mode->FrameBufferSize = FrameBufferSize; diff --git a/MSM8909Pkg/Include/Configuration/DeviceMemoryMap.h b/MSM8909Pkg/Include/Configuration/DeviceMemoryMap.h index 0cb15a5..ba462bf 100644 --- a/MSM8909Pkg/Include/Configuration/DeviceMemoryMap.h +++ b/MSM8909Pkg/Include/Configuration/DeviceMemoryMap.h @@ -59,15 +59,16 @@ typedef struct { static ARM_MEMORY_REGION_DESCRIPTOR_EX gDeviceMemoryDescriptorEx[] = { // EFI_RESOURCE_ EFI_RESOURCE_ATTRIBUTE_ ARM_REGION_ATTRIBUTE_ //MemBase, MemSize, MemLabel(32 Char.), BuildHob, ResourceType, ResourceAttribute, MemoryType, CacheAttributes - +//------------- Register Regions ---------- +{0x00000000, 0x20000000, "Peripherals", AddMem, MEM_RES, UNCACHEABLE, RtCode, DEVICE}, //------------- DDR ------}, -{0x80000000, 0x00010000, "HLOS 0", AddMem, SYS_MEM, SYS_MEM_CAP, Conv, WRITE_BACK_XN}, +{0x80000000, 0x00010000, "HLOS 0", AddMem, SYS_MEM, SYS_MEM_CAP, Conv, WRITE_BACK}, {0x80C00000, 0x00040000, "UEFI Stack", AddMem, SYS_MEM, SYS_MEM_CAP, BsData, WRITE_BACK}, {0x80C40000, 0x00010000, "CPU Vectors", AddMem, SYS_MEM, SYS_MEM_CAP, BsCode, WRITE_BACK}, {0x80024000, 0x001DC000, "HLOS 1", AddMem, SYS_MEM, SYS_MEM_CAP, Conv, WRITE_BACK}, {0x80200000, 0x00200000, "UEFI FD", AddMem, SYS_MEM, SYS_MEM_CAP, BsCode, WRITE_BACK}, -{0x80D00000, 0x03300000, "HLOS 2", AddMem, SYS_MEM, SYS_MEM_CAP, BsData, WRITE_BACK}, -{0x9eef4000, 0x00708000, "Display Reserved", AddMem, MEM_RES, WRITE_THROUGH, MaxMem, WRITE_THROUGH_XN}, +{0x9eef4000, 0x00708000, "Display Reserved", AddMem, MEM_RES, WRITE_THROUGH, MaxMem, WRITE_THROUGH}, +{0x80D00000, 0x0F3B0000, "HLOS 2", AddMem, SYS_MEM, SYS_MEM_CAP, BsData, WRITE_BACK}, // {0x87800000, 0x00240000, "SMEM", AddMem, MEM_RES, UNCACHEABLE, Reserv, UNCACHED_UNBUFFERED}, //------------- Terminator for MMU ---------- diff --git a/MSM8909Pkg/MSM8909Pkg.dsc b/MSM8909Pkg/MSM8909Pkg.dsc index 71ee562..b65a98c 100644 --- a/MSM8909Pkg/MSM8909Pkg.dsc +++ b/MSM8909Pkg/MSM8909Pkg.dsc @@ -188,6 +188,7 @@ MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf diff --git a/MSM8909Pkg/MSM8909Pkg.fdf b/MSM8909Pkg/MSM8909Pkg.fdf index d08f424..0f69055 100644 --- a/MSM8909Pkg/MSM8909Pkg.fdf +++ b/MSM8909Pkg/MSM8909Pkg.fdf @@ -100,6 +100,7 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf + INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf diff --git a/MSM8909Pkg/PrePi/ModuleEntryPoint.S b/MSM8909Pkg/PrePi/ModuleEntryPoint.S index 975a353..a8fcbc4 100644 --- a/MSM8909Pkg/PrePi/ModuleEntryPoint.S +++ b/MSM8909Pkg/PrePi/ModuleEntryPoint.S @@ -41,6 +41,14 @@ _ModuleEntryPoint: /* Invalidate TLB */ bl ASM_PFX(ArmInvalidateTlb) + //Disable Strict alignment checking & Enable Instruction cache + mrc p15, 0, r0, c1, c0, 0 + bic r0, r0, #0x00002300 /* clear bits 13, 9:8 (--V- --RS) */ + bic r0, r0, #0x00000005 /* clear bits 0, 2 (---- -C-M) */ + bic r0, r0, #0x00000002 /* Clear bit 1 (Alignment faults) */ + orr r0, r0, #0x00001000 /* set bit 12 (I) enable I-Cache */ + mcr p15, 0, r0, c1, c0, 0 + _SetupExceptionVector: LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress), r0) ldr r1, dead