map220v / edk2-a72q

EDK2 for Samsung Galaxy A72 Based on SDM720G(SM7125)
13 stars 5 forks source link

I have question about getting baseaddress for other devices #2

Closed Gezine closed 2 years ago

Gezine commented 2 years ago

In the file GalaxyA72.fdf

BaseAddress = 0x9FC00000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in NOR Flash. Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device

How do I calculate this value for other devices? I'm trying to port edk2 for SD778G devices. Any help would be appreciated

map220v commented 2 years ago

This address i got from uefiplat.cfg in xbl.efi

Gezine commented 2 years ago

Thank you for your reply Are there any other device specific values that I should care? How do I make ACPI tables?

map220v commented 2 years ago

Addresses in DeviceMemoryMap.h needs to be changed to make dxe's work.(uefiplat.cfg has all needed addresses)

ACPI tables in this repo, from sc7180(it's exactly same SOC as sm7125 but with stronger cores) sm7325 most likely same as sc7280 because they share same codename "yupik"

Gezine commented 2 years ago

So to get ACPI tables I need to extract it from SC7280 devices?

Gezine commented 2 years ago

I changed every addresses in DeviceMemoryMap.h using my uefiplat.cfg except this

ifdef MEMORY_8G

{0xC0000000, 0x1C0000000, EFI_RESOURCE_SYSTEM_MEMORY,
 SYSTEM_MEMORY_RESOURCE_ATTR_CAPABILITIES, ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK,
 AddMem, EfiConventionalMemory},
#else
{0xC0000000, 0x140000000, EFI_RESOURCE_SYSTEM_MEMORY,
 SYSTEM_MEMORY_RESOURCE_ATTR_CAPABILITIES, ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK,
 AddMem, EfiConventionalMemory},
#endif

Where did you find 0xC0000000 address? I couldn't find this in uefiplat.cfg

map220v commented 2 years ago

It's from /proc/last_kmsg(xbl boot part) mem I Combined Size of RAM Entry 1 and RAM Entry 2 to get 0x1C0000000 And used RAM Entry 2 Base as starting Address

I didn't used RAM Entry 0 because it's used by some things like "HYP" or "SMEM"

Edit: also you need to change GalaxyA72_6G.dsc In 8G version i combined RAM Entry 1 Base and Size to get 0x280000000 and subtracted by 0x80000000 to get full memory size after 0x80000000

Gezine commented 2 years ago

UEFI Start [ 1196]

Didn't know samsung devices had /proc/last_kmsg support

So I think I changed everything but my device (Galaxy Tab S7 FE Wifi 6G RAM) keep stuck at boot screen

20220321_170231

What is expected behaviour when edk2 boot up? Does it show efi shell screen?

My device have vendor_boot.img and boot.img (both using android boot image version 3) Can this be a problem?

map220v commented 2 years ago

In GalaxyA72.dsc Change Address to "Display Reserved" from uefiplat.cfg to make Framebuffer work.

It's seems edk2 boots. If there is problem with boot.img it's should fail booting zImage and go to OdinApp.

Gezine commented 2 years ago

That was it! Changin framebuffer address did the trick

20220321_172310

But it crashes with Synchronous Exception at 0x00000001FF2954D0 Have any clue about it?

Gezine commented 2 years ago

20220321_174508

Recompiled DEBUG build for more logs

map220v commented 2 years ago

Try to remove this line (without this line it's should get correct timer frequency) Edit: it's seems this value is the same in sm7325

map220v commented 2 years ago

Maybe PcdArmArchTimer* is different on sm7325. I never had this error before.

Gezine commented 2 years ago

Tried removing multiple lines but no go Any other suggestions?

Oh BTW I commented out all ACPI related lines Can this be a problem?

map220v commented 2 years ago

Correct PcdArmArchTimer* is required for TimerDxe to work.

ACPI tables only used in windows.

Gezine commented 2 years ago

[deleted]

ABL and XBL files

[deleted]

edk2 now I am using

Can this will help you?

map220v commented 2 years ago

Try this values: gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|29 gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|30 gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0 #or 26 gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|27

Gezine commented 2 years ago

Sadly still no go for both values (0 or 26)

map220v commented 2 years ago

Try commenting TimerDxe.inf in SMT733.dsc and SMT733.fdf and use TimerDxe.efi from xbl FILE DRIVER = 49EA041E-6752-42CA-B0B1-7344FE2546B7 { SECTION DXE_DEPEX = SMT733/Binary/ArmTimerDxe/ArmTimerDxe.depex SECTION PE32 = SMT733/Binary/ArmTimerDxe/ArmTimerDxe.efi SECTION UI = "ArmTimerDxe" } ArmTimerDxe.zip

Gezine commented 2 years ago

I think it worked!

20220321_200057

But I think UFS driver from 845 causes crash Which tool did you use to extract efi drivers from XBL? I might try put every efi drivers on to it

map220v commented 2 years ago

Yes UFSDxe from 845 uses qcom ufs protocol v3 and sm7325 most likely has v4 or v5.

I used UEFITool.exe to extract it.

Gezine commented 2 years ago

How do I get GUID thing like this? FILE DRIVER = 49EA041E-6752-42CA-B0B1-7344FE2546B7 Does UEFITool provide it?

map220v commented 2 years ago

Yes. UFSDxe has same GUID in sm7325 "0D35CD8E-97EA-4F9A-96AF-0F0D89F76567" UFSDxe.zip

Gezine commented 2 years ago

https://user-images.githubusercontent.com/30000519/159259476-62c5f670-6bf9-4c64-a1a3-86c4d9d588f0.mp4

I think there is no error but device just automatically reboots after several times I checked log frame by frame but there was no errors What would be the problem?

map220v commented 2 years ago

UFSDxe and other drivers in xbl uses it's own DebugLib, etc. Thats why it's doesn't print errors. It's seems UFSDxe gives Assert (in qcom edk2 prod build, assert writes to pshold address to reboot phone)

Also making UFS work on samsung can be really hard. ufssamsung

Gezine commented 2 years ago

Damn if I cannot use UFS Is there a chance that I can use SDcard instead? My galaxy tab have SDcard slot

Gezine commented 2 years ago

20220321_213344

BTW disabling UFS driver did loaded efi shell How do I type anything in efi shell? Does usb OTG works?

map220v commented 2 years ago

Making SDCard work even harder, it's requires SdccDxe.efi patch(to enable driver loading, It's disabled by default because UFS boot mode is default) and PMIC.efi

OTG doesn't work without PMIC.efi

And we don't have PMIC. samsung

Gezine commented 2 years ago

Damn am I doomed then? No UFS, SDcard, USB What would be other alternatives?

map220v commented 2 years ago

Right now windows impossible to make work on samsung because storufs.sys causes some weird issues with Samsung UFS. (WinPE only if UFSDxe somehow works)

The only things that has working UFS is downstream linux kernel and mainline linux kernel.

Gezine commented 2 years ago

Thank you for teaching me whole day for me. Have a nice day