
7 Feb
2022
7 Feb
'22
12:02 a.m.
On Sun, Feb 06, 2022 at 10:07:04PM +0100, Janne Grunau wrote:
Support for Apple M1 Pro and Max will allow using a single binary for all M1 SoCs. The M1 Pro/Max have a different memory layout. The RAM start address is 0x100_0000_0000 instead of 0x8_0000_0000. Replace the hardcoded memory layout with dynamic initialized environment variables in board_late_init().
Tested on Mac Mini (2020) and Macbook Pro 14-inch (2021).
Signed-off-by: Janne Grunau j@jannau.net
[snip]
+int board_late_init(void) +{
ulong max_size;
u32 status = 0;
max_size = gd->start_addr_sp - CONFIG_STACK_SIZE;
max_size = round_down(max_size, SZ_16M);
status |= env_set_hex("scriptaddr", max_size + SZ_2M);
status |= env_set_hex("pxefile_addr_r", max_size + SZ_1M);
status |= env_set_hex("fdt_addr_r", gd->ram_base + SZ_32M - SZ_1M);
status |= env_set_hex("kernel_addr_r", gd->ram_base + SZ_32M);
status |= env_set_hex("ramdisk_addr_r", gd->ram_base + SZ_64M);
if (status)
printf("%s: Saving run time variables FAILED\n", __func__);
This should be "Setting" rather than saving, since we don't (and shouldn't) save the environment here.
--
Tom