From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=QcCz/W+s; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.128.66, mailfrom: pete@akeo.ie) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by groups.io with SMTP; Tue, 23 Jul 2019 04:19:10 -0700 Received: by mail-wm1-f66.google.com with SMTP id s15so16784617wmj.3 for ; Tue, 23 Jul 2019 04:19:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=KZpNZtapTkvWZi9WHAWkQv9Gvq4mEn/8SuILAAz53DM=; b=QcCz/W+sZ+PwUjXH/Vwz5R/9rdoL5sm9ZNgNDE4TRQp7mlv6FdymSeqSHyPSkxM8hH CEI8oABihivbOHGVOoDMO7pdkO3onNBx+WkSpogs1xzfHYLeAdz7ZzRHASF/33ru2dQI HiLCTg363ovHFE24IeZ/Kf4t90H96Q6UeiACMS39LPsCUD8vkyRPhs3qb28nOBHIeD27 rINKi1RAut5IcxPrDhHWP4ub9HqyNrhj7s+tjs1dKhE0TMNnxO3gEeQPnOh24yweuEan SdGIuwxXMz2obTyovkLyHA/Kjyq/dcerwNGat4FEbuc7iQMKNTEu6ZoHhrO7x9LLVTXY JgAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=KZpNZtapTkvWZi9WHAWkQv9Gvq4mEn/8SuILAAz53DM=; b=GzHzdA3gQS7nHMUisJaDXeTY4lTltGX0GTqsIoyb46fT6wy5lKfQ0cAKwIxHKrEXmY HpKzNvyKn8EsWHv4cVblddXaifUp8UHWThYyskqjp3Q1OoGKAO/CQvpuGbdcREqOUGUP hu6uOh6GzhOA17xjmvI2hTJlYaXRWHlP/x5+BtoMOSET5VZFWU3noajsFUqyaORNvUQS IwwEW9JtXpTS0lwSFti+Ff4wv0kCg67q8NaqYKRU0WEmTyPwc0FDv3ogAtbP6j2mhgzl J8Mhf2tD/kZ4ODCneMErGrQc4Z/MtRO7Y2id/E3y2DRgOobKO3dk6xIZullXF830VEIe LLCg== X-Gm-Message-State: APjAAAUnOCVdaMwU2h+i1qFnHLHr36XrdAx857w0u726k2Opf2WGyKzN AUgX096isSC3QVTsa57s+7btewnS X-Google-Smtp-Source: APXvYqxWwty3jnmC8sDn40GAdeaBT+Wde1/hGFhf1gMPUBAYvzdqZELjWOEaTrs48Vhj090gyFdWSQ== X-Received: by 2002:a1c:5f87:: with SMTP id t129mr72447905wmb.150.1563880748509; Tue, 23 Jul 2019 04:19:08 -0700 (PDT) Return-Path: Received: from [10.0.0.122] ([84.203.61.230]) by smtp.googlemail.com with ESMTPSA id f1sm29264800wml.28.2019.07.23.04.19.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jul 2019 04:19:07 -0700 (PDT) Subject: Re: [edk2-platforms: PATCH 1/1] Platform/RPi3: Accept "ethernet" or "ethernet0" aliases in device tree To: Michael Brown , Leif Lindholm Cc: devel@edk2.groups.io, ard.biesheuvel@linaro.org References: <20190719172907.788170-1-mbrown@fensystems.co.uk> <20190719172907.788170-2-mbrown@fensystems.co.uk> <20190723103436.GF11541@bivouac.eciton.net> <19dd2d90-18b0-7ff2-cc21-a3d33a32d5e1@fensystems.co.uk> From: "Pete Batard" Message-ID: <81cb7359-0f16-9d71-3c16-d2faf050f0bd@akeo.ie> Date: Tue, 23 Jul 2019 12:19:06 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <19dd2d90-18b0-7ff2-cc21-a3d33a32d5e1@fensystems.co.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Just adding a comment for one item, that isn't directly relevant to what direction we should take with this patch, but that clarifies where we got our .dtb's from. On 2019.07.23 12:00, Michael Brown wrote: > On 23/07/2019 11:34, Leif Lindholm wrote: >> On Fri, Jul 19, 2019 at 06:29:07PM +0100, Michael Brown wrote: >>> Older device trees tend to use the alias "ethernet".  Newer device >>> trees tend to use "ethernet0" since older versions of U-Boot would >>> skip aliases that do not include an index number.  See, for example, >>> Linux kernel commit 10b6c0c ("ARM: dts: bcm2835: add index to the >>> ethernet alias") and U-Boot commit f8e57c6 ("fdt_support: Fixup >>> 'ethernet' aliases not ending in digits"). >>> >>> Accept either "ethernet" or "ethernet0" as being the alias to the node >>> for which the MAC address should be updated. >> >> Why is this patch useful? >> I understand the problem, but we include the .dtb from our own >> edk2-non-osi tree. And it seems that device tree already provides an >> alias to support both: >> https://github.com/tianocore/edk2-non-osi/blob/master/Platform/RaspberryPi/RPi3/DeviceTree/bcm2710-rpi-3-b.dts >> >> >> Would it be more useful to warn loudly if "ethernet" isn't present? >> (And just *replace* ethernet[0] with ethernet below.) > > The device tree can also be provided by the VC4 firmware, e.g. with a > config.txt containing e.g. > >   device_tree_address=0x10000 >   device_tree_end=0x20000 >   device_tree=bcm2710-rpi-3-b-plus.dtb > > It is also possible to omit the explicit "device_tree=..." and have just > >   device_tree_address=0x10000 >   device_tree_end=0x20000 > > This configuration will cause the VC4 firmware to automatically load the > appropriate device tree file.  I have tested that this allows me to boot > from a 3B or 3B+ using a single SD card image that contains all of the > .dtb files from > >   https://github.com/raspberrypi/firmware/tree/master/boot > > These "official" raspberrypi-firmware .dtb files are built from the > stock Linux kernel .dts files, and contain only "ethernet0". Note that the .dtb's we use for this platform (in edk2-non-osi) were actually picked up from the URL above, then decompiled to produce a .dts which was then edited to fix a couple issues, as per: https://github.com/tianocore/edk2-non-osi/blob/master/Platform/RaspberryPi/RPi3/DeviceTree/bcm2710-rpi-3-b-plus.dts#L6-L15 Most notably, unless you change compatible = "brcm,bcm2708-usb"; to compatible = "brcm,bcm2835-usb"; in the usb@7e980000 section you will find your USB keyboard may not work during a Linux install (Tested with both the Ubuntu 18.04 and Debian 10 installers). Now, I am also aware that the Raspberry Pi Foundation has updated its official .dtb's for the Pi 3 with the release of the Pi 4, and I have some plans to send a patch to also update our Device Tree accordingly at some stage. For the record, I've been testing these updated official versions last week and confirmed that the keyboard issue was still present. Regards, /Pete > To address your specific questions: > > > Why is this patch useful? > > It allows us to boot using the "official" .dtb files without any > unexpected behaviour. > > This in turn allows us to boot with the VC4 firmware automatically > selecting the appropriate .dtb file for the hardware.  This is extremely > useful when trying to provide a single SD card image that will work on a > wide range of hardware. > > > Would it be more useful to warn loudly if "ethernet" isn't present? > > (And just *replace* ethernet[0] with ethernet below.) > > This would also solve the problem.  I would find it mildly surprising > behaviour if I were debugging around it, since the "official" .dtb files > have moved in the other direction (going from "ethernet" to > "ethernet0"), but I would not expect it to break anything. > > Another option would be to have UpdateMacAddress() ensure that both > "ethernet" and "ethernet0" aliases exist. > > I am happy to work up a new version of the patch: just let me know which > option you prefer. > > Many thanks, > > Michael