From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by mx.groups.io with SMTP id smtpd.web09.10607.1579528262434394554 for ; Mon, 20 Jan 2020 05:51:02 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=VpG6RYWI; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.221.66, mailfrom: pete@akeo.ie) Received: by mail-wr1-f66.google.com with SMTP id b6so29690977wrq.0 for ; Mon, 20 Jan 2020 05:51:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=glR1irt1gW+7yyKWoPZ2vL3ElFWckytzfzFVFTdlN7g=; b=VpG6RYWIo96A5xglp3L37bognwvhPcClDg+kLOaryifaRsQpZW98iApVzG590drpyR Xrs9/cIbus0FdbXWJooRTKhqOz2s5nIl1dqNu5/84MnrZboRyhSHN+/mG/3fJjyZcj7N CE+UaltA4gSlhV8E4+drazxiE2JwV7yDKh5DowZL+cxLms46zJsCNdr2tXU6FVcjbmF3 DGWIcjNOa1SS4DBi+xXS+5ax4aDhPYAwJ1yi3wMoUmNe27x7kcjKE2A3NJL+kIbijfw4 bqQQQa56Vji2F5J5cfdabu/+KwBK2foLbUEVLbs01S0KOJFFLnkrZBQ1a/77CgHCKdAw mDqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=glR1irt1gW+7yyKWoPZ2vL3ElFWckytzfzFVFTdlN7g=; b=oGTMCFLKrsjrWJ3nuVgjM+nBfRYsDHQrXrvxbUQrQqKHmJAeTRj7KdvAEp/8k0d47c dYe2IaZ1xr5vZkkunHI+pZYeuzn40HdLFjMAsEUaZasANZodbkb3WXRROfXH37jQsZSU XVdwbNMFz77hMhdul4NSs6kHrYZ5Z0QzxNzVd9Q05QOiHycEAPFmxEq1lZSUK3A9TMs5 CNTB8z6BJZld3M6HNeMvD/ZVKyCJyInIL3eutAhVeI+EBUZXDrvnmT1qjXXBYXuY/RSI bYMCEqv4L79nrvZo8l6WakRy5U1b8MBtXtg5qE40MpdLZ2JrU1t//h1OFE7WvOLD+rQ6 Z1yg== X-Gm-Message-State: APjAAAUth3znHV8EHmR4ZfWwrEAjetweo0Ss3OrElTIFKxLCM5TP0UgA J7cArzGpIYrOgQCsz8b2Q1WKdg== X-Google-Smtp-Source: APXvYqypd6/ZvQ7pk27SyuzOW7APwKqmb7wfWGObST4R/YRT3X77V9lPn6ZKb+T0/yZJg3pI1BqE8w== X-Received: by 2002:a5d:4a91:: with SMTP id o17mr17423019wrq.232.1579528260963; Mon, 20 Jan 2020 05:51:00 -0800 (PST) Return-Path: Received: from [10.0.0.122] ([84.203.95.128]) by smtp.googlemail.com with ESMTPSA id z6sm47772700wrw.36.2020.01.20.05.50.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Jan 2020 05:51:00 -0800 (PST) Subject: Re: [edk2-platforms][PATCH 2/2] Platform/RPi/RPiFirmwareDxe: Fix serial number population for RPi4 From: "Pete Batard" To: Ard Biesheuvel Cc: edk2-devel-groups-io , leif@nuviainc.com, =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= References: <20200108170004.6680-1-pete@akeo.ie> <20200108170004.6680-3-pete@akeo.ie> <787fa8df-69a2-9aba-8296-8a6e14a8af4a@akeo.ie> Message-ID: <2b491f71-e9e0-d07d-3eb3-0a962f58187b@akeo.ie> Date: Mon, 20 Jan 2020 13:50:59 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <787fa8df-69a2-9aba-8296-8a6e14a8af4a@akeo.ie> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Could I have a ping on this, as well as https://edk2.groups.io/g/devel/topic/69331625#52611? It looks to me like the latest RPi related patches have reached some kind of integration limbo, since I'm not seeing any of those being requested a v2. Thanks, /Pete On 2020.01.09 15:02, Pete Batard wrote: > Hi Ard, > > On 2020.01.09 14:44, Ard Biesheuvel wrote: >> On Wed, 8 Jan 2020 at 18:00, Pete Batard wrote: >>> >>> Some (all?) Raspbery Pi 4 platforms report 0x0000000010000000 as their >>> board serial when queried through the VideoCore mailbox. >>> >>> Fix this by using the MAC address then. >>> >>> Signed-off-by: Pete Batard >>> --- >>>   Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 5 +++-- >>>   1 file changed, 3 insertions(+), 2 deletions(-) >>> >>> diff --git >>> a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c >>> b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c >>> index dd61ef089ca7..75826fdc0e53 100644 >>> --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c >>> +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c >>> @@ -394,8 +394,9 @@ RpiFirmwareGetSerial ( >>>     } >>> >>>     *Serial = Cmd->TagBody.Serial; >>> -  // Some platforms return 0 for serial. For those, try to use the >>> MAC address. >>> -  if (*Serial == 0) { >>> +  // Some platforms return 0 or 0x0000000010000000 for serial. >>> +  // For those, try to use the MAC address. >>> +  if ((*Serial == 0) || ((*Serial & 0xFFFFFFFF0FFFFFFFULL) == 0)) { >> >> What is the point of using a mask here? Is it deliberately matching >> 0x0000000020000000 or 0x00000000F0000000 as well? > > My expectation is that if we're seeing 0x0000000010000000 as a board > serial, there's not so insignificant chance are future boards may use > 0x0000000010000000, 0x0000000030000000 and so on. > > In other words, when someone starts counting from 0 to 1 somewhere, it's > not unreasonable to also expect them to reach 2 at some stage... > > Now, if anything, the one change we could apply here is remove the > (*Serial == 0) check, which of course is redundant. But I fail to see > why we'd want to restrict ourselves to checking only for > 0x0000000010000000 here, when we have no clear idea how the value we > read may evolve in the future, as anything that the mask condition > matches is clearly not a serial we want to use anyway... > > Regards, > > /Pete > > >> >>>       Status = RpiFirmwareGetMacAddress ((UINT8*) Serial); >>>       // Convert to a more user-friendly value >>>       *Serial = SwapBytes64 (*Serial << 16); >>> -- >>> 2.21.0.windows.1 >>> >