efidroid / projectmanagement

EFIDroid Project Management
118 stars 12 forks source link

LG G3s support/porting - UEFI does not boot #112

Open 0lvin opened 7 years ago

0lvin commented 7 years ago

SOC: MSM8926

Device can boot with lk.img but hanging on boot uefi.img

Config.ini:

[variables]
DEVICE_NAME = G3s
LK_TARGET = msm8226
LK_BASE = 0x000000000ff00000
LK_SOURCE = qcom/LA.BF64
BOOTIMG_BASE = 0x00000000
BOOTIMG_PAGESIZE = 2048
LCD_DENSITY = 200
BOOTIMG_DT = $(DEVICE_DIR)/dt.img
EDK2_BASE = 0x000000003e000000
EDK2_SIZE = 0x0000000002000000

Full config

Last messages on screenshot.

0lvin commented 7 years ago

Phone booted with alligined mmap size.

Look to MSM_IOMAP_END and MSM_IOMAP_BASE (0xFEFFFFFF - 0xF9000000) == 0x5FFFFFF:

#define MSM_IOMAP_END               0xFEFFFFFF
#define MSM_IOMAP_BASE              0xF9000000
diff --git a/uefiapi/target/msm8226.c b/uefiapi/target/msm8226.c
index 47915ded..4ba1f47d 100644
--- a/uefiapi/target/msm8226.c
+++ b/uefiapi/target/msm8226.c
@@ -1,5 +1,7 @@
 #include <err.h>
 #include <stdint.h>
+#include <stdlib.h>
+#include <arch/defines.h>
 #include <pm8x41.h>
 #include <dev/newkeys.h>
 #include <platform/iomap.h>
@@ -43,7 +45,7 @@ void uefiapi_platform_init_post(void)
 void* uefiapi_mmap_add_platform_mappings(void *pdata, lkapi_mmap_add_cb_t cb)
 {
     // iomap
-    pdata = cb(pdata, MSM_IOMAP_BASE, (MSM_IOMAP_END - MSM_IOMAP_BASE), LKAPI_MMAP_RANGEFLAG_RESERVED,
+    pdata = cb(pdata, MSM_IOMAP_BASE, ROUNDUP(MSM_IOMAP_END - MSM_IOMAP_BASE, PAGE_SIZE), LKAPI_MMAP_RANGEFLAG_RESERVED,
                       LKAPI_MEMORYATTR_DEVICE, 0, LKAPI_MMAP_RANGEFLAG_UNUSED|LKAPI_MMAP_RANGEFLAG_DRAM);

     return pdata;