From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web12.1783.1571047300429888073 for ; Mon, 14 Oct 2019 03:01:40 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=euK7JQ9K; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571047299; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lF9sQlEnKQclwYdd1fXAKVlpRa5UeFEYm+4arbAsW9I=; b=euK7JQ9Kp/JaHS+VKc4A84fAObenyAtL7IKffwTe4TxfrVVI8MgdPuqivc1/6WxJjQjlxF RUEs3KOd2IJT87WteBsPHuVcLgLQx54zHH0YomM/wB4DE2pdqF4UxRd7XERm/AIqJOI7b7 QAbU9HabJdu2pIPRmOdgTRxuzhyi96k= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-219-9fUeNG3AOp6vPc1ov8TbEQ-1; Mon, 14 Oct 2019 06:01:31 -0400 Received: by mail-wr1-f71.google.com with SMTP id t11so8259739wro.10 for ; Mon, 14 Oct 2019 03:01:30 -0700 (PDT) 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=zicMmjR1v6iycSdoOkq0oBWzbcj38MqfGi5s2Y43ODU=; b=qpdHjBvuQMWWp2TVIEr9LoEWsC9mMgwZfPSYWejRfwDvgrYACBClXU8beZ5tUT6bAL j38n+I98G4pubTZunCN7qxVAKeYIP/jD5TEo3W3Wd9zo9/36pRg5uBRiEtvuUcOyB7pg RKZPjpUtJGTYvN9JIXuMWs93T/4HJuMSPlToVAoLtk/jxlaxUo1spHfiLCMU1oJw658A bZOB858PLecXFf8dOK7Qum3OU8gfYkSFV48705kUBZPbNeIjuralOkL3oh1T2zWyIUp+ EUod89oJPD+zfP4N/Lfqh9Kxr5YYfEf2Dt9kqeEzHODMiiYelmillydb+q98+XZbAbw8 tTvA== X-Gm-Message-State: APjAAAUfjNEpckRhTIu1LRaDf8qsDA4gXhQmNrP9mdGWejs9GdfWEhxf hC412r9Tf32+Fi3z5zdxJSNQIJoiVkVagmvh/KCZDgxYW/cwNOKkbtgVvknCvBLXegc0tAUKUCe QdJX1Uh3NUbmdxg== X-Received: by 2002:a05:600c:2201:: with SMTP id z1mr14686453wml.169.1571047290084; Mon, 14 Oct 2019 03:01:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9ZJjsw021X2BObbtNT/yXQPnPWBG9Q7Eme5WVFvt9xNhYYzzLLmE/DYwLCLoIQ81p/5weHQ== X-Received: by 2002:a05:600c:2201:: with SMTP id z1mr14686434wml.169.1571047289868; Mon, 14 Oct 2019 03:01:29 -0700 (PDT) Return-Path: Received: from [192.168.50.32] (243.red-88-26-246.staticip.rima-tde.net. [88.26.246.243]) by smtp.gmail.com with ESMTPSA id e15sm19419293wrs.49.2019.10.14.03.01.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Oct 2019 03:01:29 -0700 (PDT) Subject: Re: [edk2-devel] [edk2-platforms][PATCH v3 5/5] Platform/RPi3/PlatformSmbiosDxe: Derive RAM size from board revision To: devel@edk2.groups.io, pete@akeo.ie Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org References: <20191011110746.1952-1-pete@akeo.ie> <20191011110746.1952-6-pete@akeo.ie> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: Date: Mon, 14 Oct 2019 12:01:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <20191011110746.1952-6-pete@akeo.ie> X-MC-Unique: 9fUeNG3AOp6vPc1ov8TbEQ-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi Pete, On 10/11/19 1:07 PM, Pete Batard wrote: > The board revision is the proper channel to use to detect the amount of > RAM available as bits [20-22] report the effective RAM size for the board > starting with 256 MB (000b) and doubling in size for each value. >=20 > Signed-off-by: Pete Batard > Reviewed-by: Leif Lindholm > --- > Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c= | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) >=20 > diff --git a/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/Platform= SmbiosDxe.c b/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformS= mbiosDxe.c > index b5dcff897a59..5abc82b8d363 100644 > --- a/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.c > +++ b/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.c > @@ -866,16 +866,22 @@ MemArrMapInfoUpdateSmbiosType19 ( > ) > { > EFI_STATUS Status; > - UINT32 Base; > - UINT32 Size; > + UINT32 BoardRevision =3D 0; > =20 > - Status =3D mFwProtocol->GetArmMem (&Base, &Size); > + // Note: Type 19 addresses are expressed in KB, not bytes > + mMemArrMapInfoType19.StartingAddress =3D 0; Now you assume the ARM base RAM address is always 0, why? > + // The minimum RAM size used on any Raspberry Pi model is 256 MB > + mMemArrMapInfoType19.EndingAddress =3D 256 * 1024; > + Status =3D mFwProtocol->GetModelRevision (&BoardRevision); > if (Status !=3D EFI_SUCCESS) { > - DEBUG ((DEBUG_ERROR, "Couldn't get the ARM memory size: %r\n", Statu= s)); > + DEBUG ((DEBUG_WARNING, "Couldn't get the board memory size - default= ing to 256 MB: %r\n", Status)); > } else { > - mMemArrMapInfoType19.StartingAddress =3D Base / 1024; > - mMemArrMapInfoType19.EndingAddress =3D (Base + Size - 1) / 1024; > + // www.raspberrypi.org/documentation/hardware/raspberrypi/revision-c= odes/README.md > + // Bits [20-22] indicate the amount of memory starting with 256MB (0= 00b) > + // and doubling in size for each value (001b =3D 512 MB, 010b =3D 1G= B, etc.) > + mMemArrMapInfoType19.EndingAddress <<=3D (BoardRevision >> 20) & 0x0= 7; > } > + mMemArrMapInfoType19.EndingAddress -=3D 1; > =20 > LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mMemArrMapInfoType19, mMemA= rrMapInfoType19Strings, NULL); > } >=20