From nobody Sun May 5 11:00:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+79839+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79839+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1629971752; cv=none; d=zohomail.com; s=zohoarc; b=ghUGAB69f+owklVftpwGGTyUcGvuMpXt1Q9CarjUIlLDPhSwt0oOiUtRL4zLHjSYhTKnIWjaMb18k7gUeyPjnfzMXjriIQ7V3YoxtsBZaZv6HL6TmphjoChZSDj/NZsJbCiGKVHHMF26lltnG216U4vHPSH4MaOiDAtcOxVBd0E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629971752; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=oNlMVZx0z227DUlU/7nJomYlNpep3kn0FReWh0SzqCE=; b=ZDU9d+XeIjQLSfT8dcm/pril85q1XTJ0MJgvihO5XnvW0NgorNY3/hnoukcn8N5hq+6+GboNZ7ghAjG91w4VY74jDcr1KLH2abrFhH18PVE3tLqFfzF2qfH2lmTS07OyK57iSqIuiWogXSR+FfDhAJiGdPACmfJgaGwCIjiEHmo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79839+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1629971752530470.2693900769383; Thu, 26 Aug 2021 02:55:52 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Abv7YY1788612xAzBBQWF4KD; Thu, 26 Aug 2021 02:55:52 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.28255.1629971751188277138 for ; Thu, 26 Aug 2021 02:55:51 -0700 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-90-t4LXFOjEP5OgbpaaTDu_Cg-1; Thu, 26 Aug 2021 05:55:46 -0400 X-MC-Unique: t4LXFOjEP5OgbpaaTDu_Cg-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB2E81019623; Thu, 26 Aug 2021 09:55:45 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D22719C59; Thu, 26 Aug 2021 09:55:42 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0494D18003B6; Thu, 26 Aug 2021 11:55:41 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Philippe Mathieu-Daude , Gerd Hoffmann Subject: [edk2-devel] [PATCH v2 1/3] OvmfPkg/PlatformPei: ScanOrAdd64BitE820Ram improvements Date: Thu, 26 Aug 2021 11:55:38 +0200 Message-Id: <20210826095540.3798609-2-kraxel@redhat.com> In-Reply-To: <20210826095540.3798609-1-kraxel@redhat.com> References: <20210826095540.3798609-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,kraxel@redhat.com X-Gm-Message-State: sfJ7OKM3alIWFH64rnSHnsftx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1629971752; bh=Eb4+x/Bcd53sVfWoy0tAh16FF6+01f1aJi+k5JHaEd0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=HHZIyzeSpPMU+sVLdZitAH9Pq7aT/MqLZLJF5aODyX+m8LMwoSvsyFowy9IxE/rGHQF G5o6wO/OQ7exs7L5SOJCyToW2pHfoQs6OS/U3/eGjnqcLL3APu7r283EM10HqHzmr2Pla 2YCeGEMXzaz3zekpFotHZklUy7LxAB1rYuI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1629971754737100008 Content-Type: text/plain; charset="utf-8" Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3593 Add a bool parameter to ScanOrAdd64BitE820Ram to explicitly specify whenever ScanOrAdd64BitE820Ram should add HOBs for high memory (above 4G) or scan only. Also add a lowmem parameter so ScanOrAdd64BitE820Ram can report the memory size below 4G. This allows a more flexible usage of ScanOrAdd64BitE820Ram, a followup patch will use it for all memory detection. No functional change. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daude --- OvmfPkg/PlatformPei/MemDetect.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetec= t.c index 2deec128f464..d7fb3e742be3 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -200,6 +200,8 @@ QemuUc32BaseInitialization ( STATIC EFI_STATUS ScanOrAdd64BitE820Ram ( + IN BOOLEAN AddHighHob, + OUT UINT64 *LowMemory OPTIONAL, OUT UINT64 *MaxAddress OPTIONAL ) { @@ -217,6 +219,9 @@ ScanOrAdd64BitE820Ram ( return EFI_PROTOCOL_ERROR; } =20 + if (LowMemory !=3D NULL) { + *LowMemory =3D 0; + } if (MaxAddress !=3D NULL) { *MaxAddress =3D BASE_4GB; } @@ -232,9 +237,8 @@ ScanOrAdd64BitE820Ram ( E820Entry.Length, E820Entry.Type )); - if (E820Entry.Type =3D=3D EfiAcpiAddressRangeMemory && - E820Entry.BaseAddr >=3D BASE_4GB) { - if (MaxAddress =3D=3D NULL) { + if (E820Entry.Type =3D=3D EfiAcpiAddressRangeMemory) { + if (AddHighHob && E820Entry.BaseAddr >=3D BASE_4GB) { UINT64 Base; UINT64 End; =20 @@ -254,11 +258,12 @@ ScanOrAdd64BitE820Ram ( End )); } - } else { + } + if (MaxAddress || LowMemory) { UINT64 Candidate; =20 Candidate =3D E820Entry.BaseAddr + E820Entry.Length; - if (Candidate > *MaxAddress) { + if (MaxAddress && Candidate > *MaxAddress) { *MaxAddress =3D Candidate; DEBUG (( DEBUG_VERBOSE, @@ -267,6 +272,15 @@ ScanOrAdd64BitE820Ram ( *MaxAddress )); } + if (LowMemory && Candidate > *LowMemory && Candidate < BASE_4GB) { + *LowMemory =3D Candidate; + DEBUG (( + DEBUG_VERBOSE, + "%a: LowMemory=3D0x%Lx\n", + __FUNCTION__, + *LowMemory + )); + } } } } @@ -353,7 +367,7 @@ GetFirstNonAddress ( // Otherwise, get the flat size of the memory above 4GB from the CMOS (w= hich // can only express a size smaller than 1TB), and add it to 4GB. // - Status =3D ScanOrAdd64BitE820Ram (&FirstNonAddress); + Status =3D ScanOrAdd64BitE820Ram (FALSE, NULL, &FirstNonAddress); if (EFI_ERROR (Status)) { FirstNonAddress =3D BASE_4GB + GetSystemMemorySizeAbove4gb (); } @@ -754,7 +768,7 @@ QemuInitializeRam ( // entries. Otherwise, create a single memory HOB with the flat >=3D4GB // memory size read from the CMOS. // - Status =3D ScanOrAdd64BitE820Ram (NULL); + Status =3D ScanOrAdd64BitE820Ram (TRUE, NULL, NULL); if (EFI_ERROR (Status) && UpperMemorySize !=3D 0) { AddMemoryBaseSizeHob (BASE_4GB, UpperMemorySize); } --=20 2.31.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 (#79839): https://edk2.groups.io/g/devel/message/79839 Mute This Topic: https://groups.io/mt/85157657/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- From nobody Sun May 5 11:00:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+79840+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79840+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1629971753; cv=none; d=zohomail.com; s=zohoarc; b=kTBPyeNV2XcZmbmqtAA2dnrNw2fFpVlKgIoNi3jF8ejJs9wBmI0Pl9mt4L+xSGABtP0xqS6BFzjmJLs16GF5SbupmYVVCyWkBmjxD1cU84J20eIY8TvPYOx40t68DpbhEGZb2BBYoL6EyxXfpoLVUsfFcYfCi3rXujkQ3RMLlzQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629971753; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=SvFjo+b3CHt3kX7oVow+JI//g7i2xQm3Z9cRPRN+jXQ=; b=lgUtZylnQtpTgFDCUW2VvGeZ5zuAANFWk7QnD57hI64UvXxWybR9u1zUoJI1DgwX4zcJT7v+PN9j3NyLNdSk6N14SPTut7vddznxhANyW7qD8Prd/Am+zxaBTXQiJNoSwgkIvC9hggLERGmUcAoTvHK0E/sWyCfPFg1kIwdQE94= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79840+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1629971753756837.5342228195158; Thu, 26 Aug 2021 02:55:53 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 9KVjYY1788612xUQwxr3hhP5; Thu, 26 Aug 2021 02:55:53 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web08.28212.1629971752744860566 for ; Thu, 26 Aug 2021 02:55:53 -0700 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-394-Tc7aI6CRPBakJPVZHfggOA-1; Thu, 26 Aug 2021 05:55:48 -0400 X-MC-Unique: Tc7aI6CRPBakJPVZHfggOA-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 84830804302; Thu, 26 Aug 2021 09:55:47 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 49A2D18432; Thu, 26 Aug 2021 09:55:47 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0A01418007A1; Thu, 26 Aug 2021 11:55:41 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Philippe Mathieu-Daude , Gerd Hoffmann Subject: [edk2-devel] [PATCH v2 2/3] OvmfPkg/PlatformPei: prefer etc/e820 for memory detection Date: Thu, 26 Aug 2021 11:55:39 +0200 Message-Id: <20210826095540.3798609-3-kraxel@redhat.com> In-Reply-To: <20210826095540.3798609-1-kraxel@redhat.com> References: <20210826095540.3798609-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,kraxel@redhat.com X-Gm-Message-State: pFxiCDHOInmkXQRIJ31lcJ80x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1629971753; bh=P8cXGZMfjVnIvv1fZ0tdYY7DORPh7U6GVR+Qv76fcKo=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=N1IuFbYrYmNmWcH5K+ICVKwvB3r+jEdD6PHSV3MH754S4aze53VprmfmtIWaVheHZQL zYnPtGor++NSiug/obKtzIOPA+QL2YSemai9atzaWtHkA+s4ZwhbmihXqRgp4VMHacR4m /8NXeBlmYrQcIVeXsqJCf21akPwT4+M9qWY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1629972655959100001 Content-Type: text/plain; charset="utf-8" Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3593 Prefer the e820 map provided via qemu firmware config interface for memory detection. Use rtc cmos only as fallback, which should be rarely needed these days as qemu supports etc/e820 since 2013. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daude --- OvmfPkg/PlatformPei/MemDetect.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetec= t.c index d7fb3e742be3..20154255324b 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -293,9 +293,16 @@ GetSystemMemorySizeBelow4gb ( VOID ) { + EFI_STATUS Status; + UINT64 LowerMemorySize =3D 0; UINT8 Cmos0x34; UINT8 Cmos0x35; =20 + Status =3D ScanOrAdd64BitE820Ram (FALSE, &LowerMemorySize, NULL); + if (Status =3D=3D EFI_SUCCESS && LowerMemorySize > 0) { + return LowerMemorySize; + } + // // CMOS 0x34/0x35 specifies the system memory above 16 MB. // * CMOS(0x35) is the high byte @@ -722,7 +729,6 @@ QemuInitializeRam ( // Determine total memory size available // LowerMemorySize =3D GetSystemMemorySizeBelow4gb (); - UpperMemorySize =3D GetSystemMemorySizeAbove4gb (); =20 if (mBootMode =3D=3D BOOT_ON_S3_RESUME) { // @@ -769,8 +775,11 @@ QemuInitializeRam ( // memory size read from the CMOS. // Status =3D ScanOrAdd64BitE820Ram (TRUE, NULL, NULL); - if (EFI_ERROR (Status) && UpperMemorySize !=3D 0) { - AddMemoryBaseSizeHob (BASE_4GB, UpperMemorySize); + if (EFI_ERROR (Status)) { + UpperMemorySize =3D GetSystemMemorySizeAbove4gb (); + if (UpperMemorySize !=3D 0) { + AddMemoryBaseSizeHob (BASE_4GB, UpperMemorySize); + } } } =20 --=20 2.31.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 (#79840): https://edk2.groups.io/g/devel/message/79840 Mute This Topic: https://groups.io/mt/85157658/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- From nobody Sun May 5 11:00:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+79841+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79841+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1629971756; cv=none; d=zohomail.com; s=zohoarc; b=Ij+4TvMX6kwymcWknNYPKrSgOf26mHESS3nsGTkTnCCIuFszEimTqmwbjSvImPU3KQDXXNLcEqSXG099NHQi1nt8fImQ1O33TeC58dapj4WfkF8DmiBvyIt+MNeLpc8hwt7WjAd5JrWNOKtWYBwqDFyVXFngXxqjPiQbWRyI63s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629971756; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=lB6c4+jz9W6xumA2q/W1lu+t24ohCUbDbOj+RTVXNvE=; b=DoWzKn9o30IH/mQzfivVCQXKVhLDx1dBFcFT+T2BFLd6FcdnjCr7f33g/nP2vW/qiUmkQWcRWDIT1kwTsYv+5mMlRTKViiIbV8aJBt978aFB8b/iNkbKfSt9FPQVQRDLs7sjnuIqZTjwsZSjRoUFMUeFzC5KatGFy248BmnUUAQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79841+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1629971756735530.0790805116656; Thu, 26 Aug 2021 02:55:56 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id a1s4YY1788612xilNOZc0KTD; Thu, 26 Aug 2021 02:55:56 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web10.28505.1629971755587026173 for ; Thu, 26 Aug 2021 02:55:55 -0700 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-589-6VWMLPb7Of6YC9TzHoXGZQ-1; Thu, 26 Aug 2021 05:55:51 -0400 X-MC-Unique: 6VWMLPb7Of6YC9TzHoXGZQ-1 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E8CF802923; Thu, 26 Aug 2021 09:55:50 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DD69100763B; Thu, 26 Aug 2021 09:55:47 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0CB4D1800909; Thu, 26 Aug 2021 11:55:41 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Philippe Mathieu-Daude , Gerd Hoffmann Subject: [edk2-devel] [PATCH v2 3/3] RFC: OvmfPkg/PlatformPei: stop using cmos for memory detection Date: Thu, 26 Aug 2021 11:55:40 +0200 Message-Id: <20210826095540.3798609-4-kraxel@redhat.com> In-Reply-To: <20210826095540.3798609-1-kraxel@redhat.com> References: <20210826095540.3798609-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,kraxel@redhat.com X-Gm-Message-State: p84bIdyrhuHhghkBTI8xADGCx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1629971756; bh=rbXE9cjx7nPyKxZ1A8TyJJfn30Y4mrpL8fyFjS/L/6U=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=qy2HyxOBLvB29Ak1YDTOwAkwohb8cUVSccJBdHThZmId752uyj76g4b8ws8G7gb+OzG 9uLofR8cLGFFbq3oZerzxDxI/nqrpt5Plu8dRe9jy7MeCKDmztZHBna2cVIjgAXk0mxxs PjkAC5kDwWVBLulSzcRDzBMGn7nGbvE5Ouc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1629971757060100002 Content-Type: text/plain; charset="utf-8" Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3593 Not needed for qemu 1.7 (released in 2013) and newer. Signed-off-by: Gerd Hoffmann --- OvmfPkg/PlatformPei/MemDetect.c | 58 ++------------------------------- 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetec= t.c index 20154255324b..8d2c7f432472 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -37,7 +37,6 @@ Module Name: #include =20 #include "Platform.h" -#include "Cmos.h" =20 UINT8 mPhysMemAddressWidth; =20 @@ -295,52 +294,11 @@ GetSystemMemorySizeBelow4gb ( { EFI_STATUS Status; UINT64 LowerMemorySize =3D 0; - UINT8 Cmos0x34; - UINT8 Cmos0x35; =20 Status =3D ScanOrAdd64BitE820Ram (FALSE, &LowerMemorySize, NULL); - if (Status =3D=3D EFI_SUCCESS && LowerMemorySize > 0) { - return LowerMemorySize; - } + ASSERT (Status =3D=3D EFI_SUCCESS && LowerMemorySize > 0); + return LowerMemorySize; =20 - // - // CMOS 0x34/0x35 specifies the system memory above 16 MB. - // * CMOS(0x35) is the high byte - // * CMOS(0x34) is the low byte - // * The size is specified in 64kb chunks - // * Since this is memory above 16MB, the 16MB must be added - // into the calculation to get the total memory size. - // - - Cmos0x34 =3D (UINT8) CmosRead8 (0x34); - Cmos0x35 =3D (UINT8) CmosRead8 (0x35); - - return (UINT32) (((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB= ); -} - - -STATIC -UINT64 -GetSystemMemorySizeAbove4gb ( - ) -{ - UINT32 Size; - UINTN CmosIndex; - - // - // CMOS 0x5b-0x5d specifies the system memory above 4GB MB. - // * CMOS(0x5d) is the most significant size byte - // * CMOS(0x5c) is the middle size byte - // * CMOS(0x5b) is the least significant size byte - // * The size is specified in 64kb chunks - // - - Size =3D 0; - for (CmosIndex =3D 0x5d; CmosIndex >=3D 0x5b; CmosIndex--) { - Size =3D (UINT32) (Size << 8) + (UINT32) CmosRead8 (CmosIndex); - } - - return LShiftU64 (Size, 16); } =20 =20 @@ -371,12 +329,9 @@ GetFirstNonAddress ( // If QEMU presents an E820 map, then get the highest exclusive >=3D4GB = RAM // address from it. This can express an address >=3D 4GB+1TB. // - // Otherwise, get the flat size of the memory above 4GB from the CMOS (w= hich - // can only express a size smaller than 1TB), and add it to 4GB. - // Status =3D ScanOrAdd64BitE820Ram (FALSE, NULL, &FirstNonAddress); if (EFI_ERROR (Status)) { - FirstNonAddress =3D BASE_4GB + GetSystemMemorySizeAbove4gb (); + FirstNonAddress =3D BASE_4GB; } =20 // @@ -719,7 +674,6 @@ QemuInitializeRam ( ) { UINT64 LowerMemorySize; - UINT64 UpperMemorySize; MTRR_SETTINGS MtrrSettings; EFI_STATUS Status; =20 @@ -775,12 +729,6 @@ QemuInitializeRam ( // memory size read from the CMOS. // Status =3D ScanOrAdd64BitE820Ram (TRUE, NULL, NULL); - if (EFI_ERROR (Status)) { - UpperMemorySize =3D GetSystemMemorySizeAbove4gb (); - if (UpperMemorySize !=3D 0) { - AddMemoryBaseSizeHob (BASE_4GB, UpperMemorySize); - } - } } =20 // --=20 2.31.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 (#79841): https://edk2.groups.io/g/devel/message/79841 Mute This Topic: https://groups.io/mt/85157660/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-