Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C691CC433EF for ; Mon, 7 Feb 2022 08:05:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E1AF183C2C; Mon, 7 Feb 2022 09:05:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jannau.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id CC72983C69; Mon, 7 Feb 2022 09:05:54 +0100 (CET) Received: from soltyk.jannau.net (soltyk.jannau.net [144.76.91.90]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0E0B181F50 for ; Mon, 7 Feb 2022 09:05:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jannau.net Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=janne@jannau.net Received: by soltyk.jannau.net (Postfix, from userid 1000) id B4ACC26E36B; Mon, 7 Feb 2022 09:05:51 +0100 (CET) Date: Mon, 7 Feb 2022 09:05:51 +0100 From: Janne Grunau To: Tom Rini Cc: u-boot@lists.denx.de, Mark Kettenis , sjg@chromium.com Subject: Re: [PATCH 1/1] arm: apple: Switch to fully dynamic mem layout Message-ID: <20220207080551.GB1848@jannau.net> References: <20220206210704.29138-1-j@jannau.net> <20220206230243.GV7515@bill-the-cat> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220206230243.GV7515@bill-the-cat> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean 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 > [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