[PATCH 1/1] arm: apple: Switch to fully dynamic mem layout

Janne Grunau j at jannau.net
Mon Feb 7 09:05:51 CET 2022


On 2022-02-06 18:02:43 -0500, Tom Rini wrote:
> 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 at 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.

yes, sorry I forgot I wanted to change that. I suppose log_warning() 
would be more appropiate than printf. Changed locally in addition to 
using tabs for indentation. I'll wait a little while before I send a 
fixed v2.

Thanks,

Janne



More information about the U-Boot mailing list