From owner-freebsd-arm@freebsd.org Thu Mar 28 19:10:45 2019 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A71211566000 for ; Thu, 28 Mar 2019 19:10:45 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E94986E30 for ; Thu, 28 Mar 2019 19:10:45 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id E33EF1F2F2 for ; Thu, 28 Mar 2019 19:10:44 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lj1-f174.google.com with SMTP id r24so17603667ljg.3 for ; Thu, 28 Mar 2019 12:10:44 -0700 (PDT) X-Gm-Message-State: APjAAAWljPkEmZwxcVJ6CfVbGZBpGq1L9IQ3E9bC8sVM4HYJ9M/UijDx SSjBFptCOmwcKOJ92FNCXVwnugyT18ZBCgZ2hkY= X-Google-Smtp-Source: APXvYqxsKwAqOKTTRmUP1cqsPwlaZeWDIH/eE6wVz04alxWGC3YFPLRzbCz5ZVZ1dBVPPvfbr8AAz/qorLdRyneFpaU= X-Received: by 2002:a2e:8991:: with SMTP id c17mr6737671lji.83.1553800243433; Thu, 28 Mar 2019 12:10:43 -0700 (PDT) MIME-Version: 1.0 References: <20190327192320.GA64908@freebsd-t450.fritz.box> <20190328190355.1459c85b48211905f8a3e04a@freenet.de> In-Reply-To: From: Kyle Evans Date: Thu, 28 Mar 2019 14:10:27 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: efi-loader ignores dtb files? To: =?UTF-8?Q?Manuel_St=C3=BChn?= Cc: "freebsd-arm@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4E94986E30 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.99)[-0.990,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Mar 2019 19:10:46 -0000 On Thu, Mar 28, 2019 at 1:30 PM Kyle Evans wrote: > > On Thu, Mar 28, 2019 at 1:06 PM Manuel St=C3=BChn wrote: > > > > On Wed, 27 Mar 2019 14:35:26 -0500 > > Kyle Evans wrote: > [... snip ...] > > > I'm not sure off-hand why fdt_overlays were not recognized. I would > > > drop to loader prompt and double check that it actually ended up in > > > the environment, but I don't see any reason off-hand that it wouldn't= . > > > > I tried to load the overlays from loader prompt by hand like this: > > load -t dtbo sun50i-nanopi-neo2-codec.dtbo > > load -t dtbo sun50i-nanopi-neo2-sid.dtbo > > load -t dtbo sun50i-nanopi-neo2-ths.dtbo > > and they got applied correctly and the corresponding devices appeared i= n the OS. > > > > As another test I did was to not load the base dtb file via loader.conf= but to use the one provided by u-boot/EFI. > > The output looked like this > > [...] > > Using DTB provided by EFI at 0x47ef8000. > > Loading DTB overlays: 'sun50i-nanopi-neo2-codec.dtbo,sun50i-nanopi-neo2= -sid,sun50i-nanopi-neo2-ths.dtbo' > > /boot/dtb/overlays/sun50i-nanopi-neo2-codec.dtbo size=3D0x11a > > /boot/dtb/overlays/sun50i-nanopi-neo2-sid.dtbo size=3D0x1f5 > > /boot/dtb/overlays/sun50i-nanopi-neo2-ths.dtbo size=3D0x3c5 > > applying DTB overlay '/boot/dtb/overlays/sun50i-nanopi-neo2-codec.dtbo' > > applying DTB overlay '/boot/dtb/overlays/sun50i-nanopi-neo2-sid.dtbo' > > applying DTB overlay '/boot/dtb/overlays/sun50i-nanopi-neo2-ths.dtbo' > > failed to apply overlay: FDT_ERR_NOTFOUND > > [...] > > In this case the overlays were found and loaded, but did most likely no= t match the u-boot dtb file. > > > > Is there an issue with loading overlays in conjunction with manually lo= ading dtb files via loader.conf? > > > > Yes, I see a problem -- try something like [0] (not even compile > tested, but it should work). I'll start working out a more proper > solution. I've devised a solution that's a little less hacky at [1]. It separates out the loading of overlays from platform_load_dtb into its own platform_load_overlays. I've left it as a platform-specific thing instead of lifting it into the common fdt bits for two reasons: 1.) We still technically support setting fdt_overlays in the U-Boot environment and honoring that, and 2.) Not all FDT platforms support overlays as they've not been tested, so it's probably best to nop it there for now just in case... If we're ok with dropping #1 (probably not even used, but we don't have a way of measuring usage there) and OK with adding untested overlay support to powerpc/{ofw,kboot} then this diff drops dramatically and the calls to fdt_platform_load_overlays get replaced with fdt_load_dtb_overlays calls. > [0] https://people.freebsd.org/~kevans/overlay-hack.diff [1] http://people.freebsd.org/~kevans/overlay-lesshack.diff