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.web10.3630.1570697028081538569 for ; Thu, 10 Oct 2019 01:43:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=GN+J7BZp; spf=pass (domain: linaro.org, ip: 209.85.221.66, mailfrom: leif.lindholm@linaro.org) Received: by mail-wr1-f66.google.com with SMTP id o18so6718618wrv.13 for ; Thu, 10 Oct 2019 01:43:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=imnwu2e2WWRIOI2DppSxYtseeZSpUOWGfszCey+cHNU=; b=GN+J7BZp7E12cv0hlQvp6QUR0qwftJ/YUEOY/KmluF92114eQFvN18gcAqDAzw/LbO PrDqOpwHTX9/ByVQShyAZ2HG/rlqyN8TIANcEevhnof3b4uCXEq12OZ5nFd2C2BRT93A FDqeq3Rbnae0j7nRS0ribwJFGMh86IofKBC2wSkV6MRqB/2ieNM0FCq2Fz6/TbTdRvSm k1MHwo8PGMI86zlWxkbgFOF9zXyxfYYGmay/JJthXW6IRGUQkyFo/fsktLnbutBq7MNO iU2uFkMF1IPnTim1alytdyE+NcRkm/LskvA/V+9wz7eevMGXVVTN5nqAI1RAvughHXvz Xv1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=imnwu2e2WWRIOI2DppSxYtseeZSpUOWGfszCey+cHNU=; b=EZTFa3eO3MGqoiDNagtJxLNCGjMfzOznrBsVxys38s8EN9tIlIC9Lbe7j5AG0ExFc4 /7BPR6tZMJ3qx65xb7MNlyMeWPoJYGwT3JU7djFoUSmdDBxP5czVs8Tp0QAkXnMAwV+h e2BtuDom2Io/uuiCZlZTWzv+HB4KahxIfqc37bOLMFQDmY33WZwqh3zoohmfIoZmwmpQ gj02/KwvqVhohWhM17fBjuGz2348iDxN98ScnilAIflCzRaFuL2QZq15snd0F69+QgUD esWbz2g/hLIQiBsfdMcR7ED5d1Xhy3HkscJBU9yhr+HQFsbiq2w+1Mk1B2yXHJZy07c+ gk0w== X-Gm-Message-State: APjAAAXECA8VeFfv8R1BGMNGI/Nn9gCGVN5qupjo0DF2yiEOCnVw3vkb +Rpz9Ad16u3/6ArblwibMfWw3w== X-Google-Smtp-Source: APXvYqyV14bzcAvz2MWj94YZ3gJOB73kksgeoU5QI0QGmlVwNdUiwbzlYEH4tSAbGpKSl6ys/O5oIw== X-Received: by 2002:a5d:5484:: with SMTP id h4mr7426003wrv.305.1570697026559; Thu, 10 Oct 2019 01:43:46 -0700 (PDT) Return-Path: Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id d78sm5543769wmd.47.2019.10.10.01.43.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 01:43:45 -0700 (PDT) Date: Thu, 10 Oct 2019 09:43:44 +0100 From: "Leif Lindholm" To: Pete Batard Cc: devel@edk2.groups.io, ard.biesheuvel@linaro.org Subject: Re: [edk2-platforms][PATCH v2 2/5] Platform/RPi3/RpiFirmwareDxe: Improve serial number population Message-ID: <20191010084344.GT25504@bivouac.eciton.net> References: <20191008123841.12952-1-pete@akeo.ie> <20191008123841.12952-3-pete@akeo.ie> MIME-Version: 1.0 In-Reply-To: <20191008123841.12952-3-pete@akeo.ie> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Oct 08, 2019 at 01:38:38PM +0100, Pete Batard wrote: > Improve RpiFirmwareGetSerial() to derive a serial number from the > MAC address, in case the platform returns 0 for the serial number. > > Also fix a typo where "%s" was used instead of "%a". I did not see a reply to my feedback on the previous round, so I'm unsure if this is a mistake or a disagreement? > Signed-off-by: Pete Batard > --- > Platform/RaspberryPi/RPi3/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/Platform/RaspberryPi/RPi3/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b/Platform/RaspberryPi/RPi3/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c > index 378c99bcba05..c2344252d2c0 100644 > --- a/Platform/RaspberryPi/RPi3/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c > +++ b/Platform/RaspberryPi/RPi3/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c > @@ -219,7 +219,7 @@ RpiFirmwareSetPowerState ( > > if (!EFI_ERROR (Status) && > PowerState ^ (Cmd->TagBody.PowerState & RPI_MBOX_POWER_STATE_ENABLE)) { > - DEBUG ((DEBUG_ERROR, "%a: failed to %sable power for device %d\n", > + DEBUG ((DEBUG_ERROR, "%a: failed to %aable power for device %d\n", This is clearly a bugfix, but I don't see it as being part of "Improve serial number population", which is what it claims to be if I view it wih git blame. / Leif > __FUNCTION__, PowerState ? "en" : "dis", DeviceId)); > Status = EFI_DEVICE_ERROR; > } > @@ -393,7 +393,14 @@ RpiFirmwareGetSerial ( > } > > *Serial = Cmd->TagBody.Serial; > - return EFI_SUCCESS; > + // Some platforms return 0 for serial. For those, try to use the MAC address. > + if (*Serial == 0) { > + Status = RpiFirmwareGetMacAddress ((UINT8*) Serial); > + // Convert to a more user-friendly value > + *Serial = SwapBytes64 (*Serial << 16); > + } > + > + return Status; > } > > #pragma pack() > -- > 2.21.0.windows.1 >