From nobody Mon Feb 9 19:04:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+50690+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50690+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1573747676; cv=none; d=zoho.com; s=zohoarc; b=hMRuBw6E5lPvOwWx0X9q8A27LPaoouJYOnGdOwhVld2/xA4TsK4s6VB71guAwXdjsGxIJZow0Uls/7SbiNtqGVfwN/pLI+uaakURmBTZWA4sRhZ8tKLMm55SlsmQAerjeYubjuHs8ep0c9LZLBD8oNE4+V+oMfr5WhdNEkr+ZKI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573747676; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=vWWUEd5A8MtevfWICDez9kvoyvey2Zv/R7sI9ktNN1Q=; b=eavqglVY9EROecXMu65R0NzuMQNDVxxQqLPs9HrgIXwtMnnrOPqjZUSUnDhezN/so/CbmXhWH7dpOGhxQvHqXGvU/muM82+A9eZAYfcpT7XajMymROpsuMuN+Vj4gflm66prdvZoBHZPbxla5c1R3HBdEB/8WtQohsCK12cOYNU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+50690+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 157374767679469.90101393765951; Thu, 14 Nov 2019 08:07:56 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 2HTPYY1788612xKuubYf1psx; Thu, 14 Nov 2019 08:07:55 -0800 X-Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web10.6492.1573747674773957432 for ; Thu, 14 Nov 2019 08:07:55 -0800 X-Received: by mail-wr1-f67.google.com with SMTP id i10so7107606wrs.7 for ; Thu, 14 Nov 2019 08:07:54 -0800 (PST) X-Gm-Message-State: 90YtMGA1xZJRbXwRBm5cQSGyx1787277AA= X-Google-Smtp-Source: APXvYqw4g/8sNnMa8P9K4lw0g2hyfxjMzBZseONWYGbzmFqjumj5uDpLMry7mNLp3prdv/kVdvYBCw== X-Received: by 2002:a05:6000:1083:: with SMTP id y3mr8548900wrw.290.1573747673066; Thu, 14 Nov 2019 08:07:53 -0800 (PST) X-Received: from localhost.localdomain ([84.203.67.47]) by smtp.gmail.com with ESMTPSA id a16sm6793088wmd.11.2019.11.14.08.07.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 08:07:52 -0800 (PST) From: "Pete Batard" To: devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, philmd@redhat.com Subject: [edk2-devel] [edk2-platforms][PATCH 1/8] Platform/RPi: Add model family detection Date: Thu, 14 Nov 2019 16:07:33 +0000 Message-Id: <20191114160740.10072-2-pete@akeo.ie> In-Reply-To: <20191114160740.10072-1-pete@akeo.ie> References: <20191114160740.10072-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1573747675; bh=SxcAl1C8wUqRaSWDgpsdlfG0OFWoEvLbGXTC8wr3vDw=; h=Cc:Date:From:Reply-To:Subject:To; b=gZ2nLbKP82WNCmGjs3G7aM+d3lmWvhoEeixwzwoKC1cH8OlrvzuzeJMefcb2mZAT+CT FVOA16I5CkC0ytw7Q2W+ikcJAtJBcLIxeNPW7RMcxJtDsYBJENIhg8xNca0SszISQtBxJ CnxSMhTWSkOIsdM+umHph9Ok5JCX33MOVnQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Samer El-Haj-Mahmoud Add GetModelFamily to RASPBERRY_PI_FIRMWARE_PROTOCOL. This uses the board revision to return a numeric value representing the RPi family (1=3DRPi, 2=3DRPi2, 3=3DRPi3 and 4=3DRPi4). Knowing the Pi family will help us set the SD card routing when we introduce support for the Pi 4 and should also be easier to maintain than if using individual model detection. Also add a missing entry for the "Raspberry Pi Compute Module 3+" in RpiFirmwareGetModelName (). Signed-off-by: Pete Batard --- Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 64 ++++++++= ++++++++++++ Platform/RaspberryPi/Include/Protocol/RpiFirmware.h | 8 +++ 2 files changed, 72 insertions(+) diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b= /Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c index 9b4aa068857c..dd61ef089ca7 100644 --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c @@ -1,5 +1,6 @@ /** @file * + * Copyright (c) 2019, ARM Limited. All rights reserved. * Copyright (c) 2017-2018, Andrei Warkentin * Copyright (c) 2016, Linaro, Ltd. All rights reserved. * @@ -595,6 +596,8 @@ RpiFirmwareGetModelName ( return "Raspberry Pi 3 Model B+"; case 0x0E: return "Raspberry Pi 3 Model A+"; + case 0x10: + return "Raspberry Pi Compute Module 3+"; case 0x11: return "Raspberry Pi 4 Model B"; default: @@ -602,6 +605,66 @@ RpiFirmwareGetModelName ( } } =20 +STATIC +EFI_STATUS +EFIAPI +RPiFirmwareGetModelFamily ( + OUT UINT32 *ModelFamily + ) +{ + EFI_STATUS Status; + UINT32 Revision; + UINT32 ModelId; + + Status =3D RpiFirmwareGetModelRevision(&Revision); + if (EFI_ERROR(Status)) { + DEBUG ((DEBUG_ERROR, + "%a: Could not get the board revision: Status =3D=3D %r\n", + __FUNCTION__, Status)); + return EFI_DEVICE_ERROR; + } else { + ModelId =3D (Revision >> 4) & 0xFF; + } + + switch (ModelId) { + // www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes= /README.md + case 0x00: // Raspberry Pi Model A + case 0x01: // Raspberry Pi Model B + case 0x02: // Raspberry Pi Model A+ + case 0x03: // Raspberry Pi Model B+ + case 0x06: // Raspberry Pi Compute Module 1 + case 0x09: // Raspberry Pi Zero + case 0x0C: // Raspberry Pi Zero W + *ModelFamily =3D 1; + break; + case 0x04: // Raspberry Pi 2 Model B + *ModelFamily =3D 2; + break; + case 0x08: // Raspberry Pi 3 Model B + case 0x0A: // Raspberry Pi Compute Module 3 + case 0x0D: // Raspberry Pi 3 Model B+ + case 0x0E: // Raspberry Pi 3 Model A+ + case 0x10: // Raspberry Pi Compute Module 3+ + *ModelFamily =3D 3; + break; + case 0x11: // Raspberry Pi 4 Model B + *ModelFamily =3D 4; + break; + default: + *ModelFamily =3D 0; + break; + } + + if (*ModelFamily =3D=3D 0) { + DEBUG ((DEBUG_ERROR, + "%a: Unknown Raspberry Pi model family : ModelId =3D=3D 0x%x\n", + __FUNCTION__, ModelId)); + return EFI_UNSUPPORTED; + } + + return EFI_SUCCESS; +} + STATIC CHAR8* EFIAPI @@ -1168,6 +1231,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL mRpiFirmwarePro= tocol =3D { RpiFirmwareGetModel, RpiFirmwareGetModelRevision, RpiFirmwareGetModelName, + RPiFirmwareGetModelFamily, RpiFirmwareGetFirmwareRevision, RpiFirmwareGetManufacturerName, RpiFirmwareGetCpuName, diff --git a/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h b/Platform= /RaspberryPi/Include/Protocol/RpiFirmware.h index e49d6e6132d9..e3287e3c040f 100644 --- a/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h +++ b/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h @@ -1,5 +1,6 @@ /** @file * + * Copyright (c) 2019, ARM Limited. All rights reserved. * Copyright (c) 2016, Linaro Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent @@ -102,6 +103,12 @@ CHAR8* INTN ModelId ); =20 +typedef +EFI_STATUS +(EFIAPI *GET_MODEL_FAMILY) ( + UINT32 *ModelFamily + ); + typedef EFI_STATUS (EFIAPI *GET_FIRMWARE_REVISION) ( @@ -143,6 +150,7 @@ typedef struct { GET_MODEL GetModel; GET_MODEL_REVISION GetModelRevision; GET_MODEL_NAME GetModelName; + GET_MODEL_FAMILY GetModelFamily; GET_FIRMWARE_REVISION GetFirmwareRevision; GET_MANUFACTURER_NAME GetManufacturerName; GET_CPU_NAME GetCpuName; --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#50690): https://edk2.groups.io/g/devel/message/50690 Mute This Topic: https://groups.io/mt/57792459/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-