From nobody Tue May 7 10:54:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+57518+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57518+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587137887; cv=none; d=zohomail.com; s=zohoarc; b=fJ4uhOWJrW9eiwrec+trfspRWG8+5h4+8HWDOvJgpW5uovK0mmL6mklov+Z27Ik5n4o2dtBFj7T4AYMa9+QgOm/yticjeEBXIjbo+AKjGknYGhYzsmaymWrOVzEh39TDvYVGMdMGJ+U0bnarjPcp3hGBnlefKEuHKMsq0v38LwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587137887; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=h29gMSCRX2fKnZry0cNdaJK3jcDa/wpPYyK+hrAUFdU=; b=IoAOXlZkR4UBnmv0vovjsJn8J0Y5lMeKkKI3MCdsVqcWoME0zIw9QvdtEZIAqv3dhOxpo4HzUxze9k3LnbfTVkvihDOp3eh5vwXLSfsjrs6EqumV7/ICgpW1ecfeHrPUe61NNydR5i9KTBPxx+VOV7j+dtb4qlfrmnsbGihLu4w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57518+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1587137887159948.9775025822108; Fri, 17 Apr 2020 08:38:07 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 4XMPYY1788612xFlZ0vDDKEc; Fri, 17 Apr 2020 08:38:06 -0700 X-Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web12.3731.1587137886172020067 for ; Fri, 17 Apr 2020 08:38:06 -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-344-MATb-aSsMwuPmaV-AakCYg-1; Fri, 17 Apr 2020 11:37:58 -0400 X-MC-Unique: MATb-aSsMwuPmaV-AakCYg-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 1F811107ACC4; Fri, 17 Apr 2020 15:37:57 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-253.ams2.redhat.com [10.36.113.253]) by smtp.corp.redhat.com (Postfix) with ESMTP id C749E6EF91; Fri, 17 Apr 2020 15:37:55 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Ard Biesheuvel , Jordan Justen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Rebecca Cran Subject: [edk2-devel] [PATCH 1/6] OvmfPkg/ResetSystemLib: wrap long lines Date: Fri, 17 Apr 2020 17:37:46 +0200 Message-Id: <20200417153751.7110-2-lersek@redhat.com> In-Reply-To: <20200417153751.7110-1-lersek@redhat.com> References: <20200417153751.7110-1-lersek@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: 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,lersek@redhat.com X-Gm-Message-State: xLfR9PhDPexRsnFkd8YlZBU0x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587137886; bh=h29gMSCRX2fKnZry0cNdaJK3jcDa/wpPYyK+hrAUFdU=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=wgbYciPxqnvx+xOqHt7QmC4LPuHuODMvQhM9T2iut6Fg1JpmBj8vAqUTtJqzds4BKOz CQuArHeZM0Evx+W5eUTiOq3kJ0Zgf6xXvksyXKg0MuT+csPCFNS1VwJPQenpbCId3MpqP W4gXmxixE+trN5ae5FsqwDF6ETWyPPIxrBk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Wrap the source code and the INF file at 79 characters. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Philippe Mathieu-Daud=C3=A9 Cc: Rebecca Cran Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2675 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daude Reviewed-by: Rebecca Cran --- OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf | 3 ++- OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Li= brary/ResetSystemLib/ResetSystemLib.inf index 2f24dac87faf..063dc49f2453 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf @@ -15,7 +15,8 @@ [Defines] LIBRARY_CLASS =3D ResetSystemLib =20 # -# The following information is for reference only and not required by the = build tools. +# The following information is for reference only and not required by the = build +# tools. # # VALID_ARCHITECTURES =3D IA32 X64 # diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Libr= ary/ResetSystemLib/ResetSystemLib.c index 2f2e1293a3ef..b3abda80e75a 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -103,10 +103,11 @@ ResetShutdown ( =20 /** This function causes a systemwide reset. The exact type of the reset is - defined by the EFI_GUID that follows the Null-terminated Unicode string = passed - into ResetData. If the platform does not recognize the EFI_GUID in Reset= Data - the platform must pick a supported reset type to perform.The platform may - optionally log the parameters from any non-normal reset that occurs. + defined by the EFI_GUID that follows the Null-terminated Unicode string + passed into ResetData. If the platform does not recognize the EFI_GUID in + ResetData the platform must pick a supported reset type to perform.The + platform may optionally log the parameters from any non-normal reset that + occurs. =20 @param[in] DataSize The size, in bytes, of ResetData. @param[in] ResetData The data buffer starts with a Null-terminated str= ing, @@ -128,11 +129,12 @@ ResetPlatformSpecific ( @param[in] ResetType The type of reset to perform. @param[in] ResetStatus The status code for the reset. @param[in] DataSize The size, in bytes, of ResetData. - @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm,= or EfiResetShutdown - the data buffer starts with a Null-terminated = string, optionally - followed by additional binary data. The string= is a description - that the caller may use to further indicate th= e reason for the - system reset. + @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm,= or + EfiResetShutdown the data buffer starts with a + Null-terminated string, optionally followed by + additional binary data. The string is a descri= ption + that the caller may use to further indicate the + reason for the system reset. **/ VOID EFIAPI --=20 2.19.1.3.g30247aa5d201 -=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 (#57518): https://edk2.groups.io/g/devel/message/57518 Mute This Topic: https://groups.io/mt/73085503/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 Tue May 7 10:54:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+57515+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57515+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587137885; cv=none; d=zohomail.com; s=zohoarc; b=LZvveSbY1PyW+I2AOAXRc+OmBB43ekmj9mCW7vQTI7Vz+S/Xbgv09EM7YRu5W7r7xaPVbJmTllg7GlThNtSegE6darU1gKUwhxhm7Vqdeuj1YlSOqnIAB42twSlQMhrRbfaVR5lo4/yCsjn1axS0IUCd406yRM8zUqsWGaEVpdU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587137885; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=6Ch6EVD/6n9RPOdJ7jp6BD6OWX59XIaZzVIbgHL3XJQ=; b=fiG/wnGBaKI9/un9YywuUMwVKIy9r5DBcAVFo2uEa2yeA1PwjPS0dhKiqVCwibM8bGZB6Z+NIl/ERUNPYhllPnw5BErxLTBxgrZlwXpQA3X5UCVzSaifTIJpbB8duHURpHcQpfBu1LAteqv0MRgog0PrURSbLPMF9leTBiHEIt4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57515+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1587137885140440.61823854846114; Fri, 17 Apr 2020 08:38:05 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id rR7AYY1788612xZJm4C72Q9z; Fri, 17 Apr 2020 08:38:04 -0700 X-Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web10.3689.1587137884069677684 for ; Fri, 17 Apr 2020 08:38:04 -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-460-3iJg3JtyOdWs8_NZJc7dHg-1; Fri, 17 Apr 2020 11:38:01 -0400 X-MC-Unique: 3iJg3JtyOdWs8_NZJc7dHg-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 17EA08018B6; Fri, 17 Apr 2020 15:38:00 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-253.ams2.redhat.com [10.36.113.253]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1C1A6EF91; Fri, 17 Apr 2020 15:37:58 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Ard Biesheuvel , Jordan Justen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Rebecca Cran Subject: [edk2-devel] [PATCH 2/6] OvmfPkg/ResetSystemLib: clean up library dependencies Date: Fri, 17 Apr 2020 17:37:47 +0200 Message-Id: <20200417153751.7110-3-lersek@redhat.com> In-Reply-To: <20200417153751.7110-1-lersek@redhat.com> References: <20200417153751.7110-1-lersek@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: 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,lersek@redhat.com X-Gm-Message-State: WbOL1BvnniCT88pgCw5bdGnDx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587137884; bh=6Ch6EVD/6n9RPOdJ7jp6BD6OWX59XIaZzVIbgHL3XJQ=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=sZsbfO+y6Jj+fS8+7NLRI7ECQuvfP9LaAxchfyQlQERJlFXQOwZNFMDsSQ0JweeIARs MaMb60deYwANyBKVOC9cIkFtXNpAMN+VomZJtbzufkAjR3104rVXUbiypzmckI9/YSppr HUrpdnvvdajDocZw823x29fuPW+mH4jLho4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Annotate the #include directives with the interfaces that this lib instance needs from the included lib class headers. This will help us keep the #include set minimal, when we move code around later. While at it, synchronize the [LibraryClasses] section with the #include directives -- list BaseLib. Also #include the ResetSystemLib class header, which declares the interfaces that this lib instance implements. This forces us to spell out the "MdeModulePkg.dec" dependency too, under [Packages]. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Philippe Mathieu-Daud=C3=A9 Cc: Rebecca Cran Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2675 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daude Reviewed-by: Rebecca Cran --- OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf | 2 ++ OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Li= brary/ResetSystemLib/ResetSystemLib.inf index 063dc49f2453..af20f516c035 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf @@ -25,10 +25,12 @@ [Sources] ResetSystemLib.c =20 [Packages] + MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec OvmfPkg/OvmfPkg.dec =20 [LibraryClasses] + BaseLib DebugLib IoLib PciLib diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Libr= ary/ResetSystemLib/ResetSystemLib.c index b3abda80e75a..23816183a953 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -6,14 +6,15 @@ =20 **/ =20 -#include +#include // BIT1 =20 -#include -#include -#include -#include -#include -#include +#include // CpuDeadLoop() +#include // ASSERT() +#include // IoWrite8() +#include // PciRead16() +#include // ResetCold() +#include // MicroSecondDelay() +#include // OVMF_HOSTBRIDGE_DID =20 VOID AcpiPmControl ( --=20 2.19.1.3.g30247aa5d201 -=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 (#57515): https://edk2.groups.io/g/devel/message/57515 Mute This Topic: https://groups.io/mt/73085500/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 Tue May 7 10:54:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+57517+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57517+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587137886; cv=none; d=zohomail.com; s=zohoarc; b=m9VfujF02o0QpgMP7koug0+NNOcUqhaUbAcI+9Nswhy9rOHpK5C+zmcULYWU+XiX6W2rLycCiteDF7r/KcnI9vgnSfdUuCbZnPxY6gf92fz044EmBrcpFrRrKUgOekWKPogNRfBgkzLJQqnyxLEGPiplvPYl4InNyUvB6J5IZe0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587137886; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ijIu82//4DxnpOa/hbt80uCNKWOlEvixGRR27ndjwXg=; b=AQ9dYt4asFMNsTGGtMZaLQKxiz+fDsOKoL756i4roMnfOx40vDa3EbD6w3cLmyoqpDVEyAN28k9IW+cEGD2dY5wNjeCImD8/RvlBMGcirfHnekodelE3Wl78/6/E4pHzRqqOQl/PXzFD9oLKavkQIBZQfB7fohZgHSF83LIz5g0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57517+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1587137886540542.4457891591729; Fri, 17 Apr 2020 08:38:06 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id nEUwYY1788612x4b5lfyaSj2; Fri, 17 Apr 2020 08:38:06 -0700 X-Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web10.3690.1587137885622373059 for ; Fri, 17 Apr 2020 08:38:05 -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-369-VTML84g8NIaPhyyikrJjDA-1; Fri, 17 Apr 2020 11:38:02 -0400 X-MC-Unique: VTML84g8NIaPhyyikrJjDA-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 BBDB418B9FC9; Fri, 17 Apr 2020 15:38:01 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-253.ams2.redhat.com [10.36.113.253]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DE3C11A031; Fri, 17 Apr 2020 15:38:00 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Ard Biesheuvel , Jordan Justen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Rebecca Cran Subject: [edk2-devel] [PATCH 3/6] OvmfPkg/ResetSystemLib: improve coding style in ResetSystem() Date: Fri, 17 Apr 2020 17:37:48 +0200 Message-Id: <20200417153751.7110-4-lersek@redhat.com> In-Reply-To: <20200417153751.7110-1-lersek@redhat.com> References: <20200417153751.7110-1-lersek@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: 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,lersek@redhat.com X-Gm-Message-State: IS9br3cpkzQPmIgzsam0yvaQx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587137886; bh=ijIu82//4DxnpOa/hbt80uCNKWOlEvixGRR27ndjwXg=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=VSTWJyQorRAFmNn+F1ORI2/hZ4GagKrnO3m4LfjwpuJZsuSBX4RgOKxsm19w2gtki7+ 6LTWFkZ6rEjB0YBAnBCwUV6piTx1xEzhiGAvnRABY6ccVs4MZT5wzkOZLY0MDdE3o3xZ8 RqCQgKlblE8tF3eL82Hoc9VX/dgg5xuRTb8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The cases under ResetSystem() currently mix "break"s with "return"s for no good reason. Use "break" consistently. (The inconsistency was introduced in commit 84c0b80de716, "OvmfPkg/ResetSystemLib: Add new API ResetSystem", 2019-04-28.) Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Philippe Mathieu-Daud=C3=A9 Cc: Rebecca Cran Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2675 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daude Reviewed-by: Rebecca Cran --- OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Libr= ary/ResetSystemLib/ResetSystemLib.c index 23816183a953..0fc142325ece 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -157,13 +157,13 @@ ResetSystem ( =20 case EfiResetShutdown: ResetShutdown (); - return; + break; =20 case EfiResetPlatformSpecific: ResetPlatformSpecific (DataSize, ResetData); - return; + break; =20 default: - return; + break; } } --=20 2.19.1.3.g30247aa5d201 -=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 (#57517): https://edk2.groups.io/g/devel/message/57517 Mute This Topic: https://groups.io/mt/73085502/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 Tue May 7 10:54:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+57519+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57519+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587137888; cv=none; d=zohomail.com; s=zohoarc; b=liY0q37e4jvUkroI7w5jRcRwz/nEj66G+qDva6OOSRAgroJ3SMMBNMnw5fyxffa2RzXbK7OtfttLINypCT3ZvWUdsyctfbwOIqMh1aDPb9SSX5Hhnr5jqY4k/U0xhM8/P++P3vxPX+QkhhSQ3Iyj75KM65CYAkBXX7MkQc6LR5k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587137888; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Fso4DJgnNgOLZ2BKBqAk3BWiqhKUGWKcAmCmSR126Tg=; b=be/Cj2j12GZXBoCVL466OgG8G/qdMqmzKZPyFSXLYWTZoCFiwANV8aEDJDJG1ZDVTLegE4wNkQw4IcDdtsJsKSIpUnDH/hjabqJWIePve3b9kFpYUCjfNCVVku1tJKow8NiK0ha/AyJIn633oUdxzTIB/PzI3ujL5C/wq8mw0S4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57519+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1587137888344695.8352910514942; Fri, 17 Apr 2020 08:38:08 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id iWrJYY1788612xYjr8kfWUJe; Fri, 17 Apr 2020 08:38:07 -0700 X-Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web12.3732.1587137887076471862 for ; Fri, 17 Apr 2020 08:38:07 -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-386-V3y_wOxkOAatl98xbx8GNA-1; Fri, 17 Apr 2020 11:38:04 -0400 X-MC-Unique: V3y_wOxkOAatl98xbx8GNA-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 6A6E0801E57; Fri, 17 Apr 2020 15:38:03 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-253.ams2.redhat.com [10.36.113.253]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CCB26EF91; Fri, 17 Apr 2020 15:38:01 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Ard Biesheuvel , Jordan Justen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Rebecca Cran Subject: [edk2-devel] [PATCH 4/6] OvmfPkg/ResetSystemLib: factor out ResetShutdown() Date: Fri, 17 Apr 2020 17:37:49 +0200 Message-Id: <20200417153751.7110-5-lersek@redhat.com> In-Reply-To: <20200417153751.7110-1-lersek@redhat.com> References: <20200417153751.7110-1-lersek@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: 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,lersek@redhat.com X-Gm-Message-State: 2IkVgV7i9j9JpPWnlqvjcc4Gx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587137887; bh=Fso4DJgnNgOLZ2BKBqAk3BWiqhKUGWKcAmCmSR126Tg=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=DqOTu15gs5Axb+FVLJPhUMWP1TA+eQZKlbEU3c1znc3Lv193xU/USITZNRT5ZIffGXq NmG3MxfljW9bbh/tP8Eb9DX3VAknxmIuqZhIgd/CeWtQxydTTo2Ol3eN4k2pyzSN2vXIb M0lYaUwFwK5CVVQTSQ/AMMsghhhlG7dYv9U= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Move the ResetShutdown() definition to its own file. This will help us introduce: - a new library instance that is not broken in runtime modules (the current library instance is broken in runtime modules), - another new library instance for bhyve support. While at it, squash AcpiPmControl() into ResetShutdown(), open-coding SuspendType=3D0. This is justified because we've had no other callers for AcpiPmControl() since commit 2d9950a2bff8 ("OvmfPkg: remove EnterS3WithImmediateWake () from ResetSystemLib", 2020-01-10). Tested with the "reset -s" UEFI shell command, on both i440fx and q35. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Philippe Mathieu-Daud=C3=A9 Cc: Rebecca Cran Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2675 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daude Reviewed-by: Rebecca Cran --- OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf | 1 + OvmfPkg/Library/ResetSystemLib/ResetShutdown.c | 51 ++++++++++++++++++++ OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c | 49 ------------------- 3 files changed, 52 insertions(+), 49 deletions(-) diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Li= brary/ResetSystemLib/ResetSystemLib.inf index af20f516c035..9362f884f124 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf @@ -22,6 +22,7 @@ [Defines] # =20 [Sources] + ResetShutdown.c ResetSystemLib.c =20 [Packages] diff --git a/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c b/OvmfPkg/Libra= ry/ResetSystemLib/ResetShutdown.c new file mode 100644 index 000000000000..971d94fa5766 --- /dev/null +++ b/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c @@ -0,0 +1,51 @@ +/** @file + Reset System Library Shutdown API implementation for OVMF. + + Copyright (C) 2020, Red Hat, Inc. + Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include // BIT13 + +#include // CpuDeadLoop() +#include // ASSERT() +#include // IoOr16() +#include // PciRead16() +#include // ResetShutdown() +#include // OVMF_HOSTBRIDGE_DID + +/** + Calling this function causes the system to enter a power state equivalent + to the ACPI G2/S5 or G3 states. + + System shutdown should not return, if it returns, it means the system do= es + not support shut down reset. +**/ +VOID +EFIAPI +ResetShutdown ( + VOID + ) +{ + UINT16 AcpiPmBaseAddress; + UINT16 HostBridgeDevId; + + AcpiPmBaseAddress =3D 0; + HostBridgeDevId =3D PciRead16 (OVMF_HOSTBRIDGE_DID); + switch (HostBridgeDevId) { + case INTEL_82441_DEVICE_ID: + AcpiPmBaseAddress =3D PIIX4_PMBA_VALUE; + break; + case INTEL_Q35_MCH_DEVICE_ID: + AcpiPmBaseAddress =3D ICH9_PMBASE_VALUE; + break; + default: + ASSERT (FALSE); + CpuDeadLoop (); + } + + IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, 0); + IoOr16 (AcpiPmBaseAddress + 4, BIT13); + CpuDeadLoop (); +} diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Libr= ary/ResetSystemLib/ResetSystemLib.c index 0fc142325ece..fe51f53d1df2 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -9,41 +9,9 @@ #include // BIT1 =20 #include // CpuDeadLoop() -#include // ASSERT() #include // IoWrite8() -#include // PciRead16() #include // ResetCold() #include // MicroSecondDelay() -#include // OVMF_HOSTBRIDGE_DID - -VOID -AcpiPmControl ( - UINTN SuspendType - ) -{ - UINT16 AcpiPmBaseAddress; - UINT16 HostBridgeDevId; - - ASSERT (SuspendType < 6); - - AcpiPmBaseAddress =3D 0; - HostBridgeDevId =3D PciRead16 (OVMF_HOSTBRIDGE_DID); - switch (HostBridgeDevId) { - case INTEL_82441_DEVICE_ID: - AcpiPmBaseAddress =3D PIIX4_PMBA_VALUE; - break; - case INTEL_Q35_MCH_DEVICE_ID: - AcpiPmBaseAddress =3D ICH9_PMBASE_VALUE; - break; - default: - ASSERT (FALSE); - CpuDeadLoop (); - } - - IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, (UINT16) SuspendType); - IoOr16 (AcpiPmBaseAddress + 4, BIT13); - CpuDeadLoop (); -} =20 /** Calling this function causes a system-wide reset. This sets @@ -84,23 +52,6 @@ ResetWarm ( CpuDeadLoop (); } =20 -/** - Calling this function causes the system to enter a power state equivalent - to the ACPI G2/S5 or G3 states. - - System shutdown should not return, if it returns, it means the system do= es - not support shut down reset. -**/ -VOID -EFIAPI -ResetShutdown ( - VOID - ) -{ - AcpiPmControl (0); - ASSERT (FALSE); -} - =20 /** This function causes a systemwide reset. The exact type of the reset is --=20 2.19.1.3.g30247aa5d201 -=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 (#57519): https://edk2.groups.io/g/devel/message/57519 Mute This Topic: https://groups.io/mt/73085505/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 Tue May 7 10:54:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+57520+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57520+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587137892; cv=none; d=zohomail.com; s=zohoarc; b=bvLi3ZG55rpbG0esbETrPWNYSP2GKoDxC4Pc6Luj+6ZDlgYbmgojDZEx8mMAsml/erUAMj5FEUboXBYPUKykKXNoKjefRflONEAh9v/CTyu4QOBvmdlvEwTRXp2CDFc/OHqUOF21ZS/0TVbwzzpR0AgIv3sOgxASzowWB4PKpjo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587137892; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=wA5J6HdgCnE9iKX/oEo76HF+xr+vHEhjwzBWrOJt/9c=; b=Gi3h4Rk+e6M8VcGQZrczBb5/ijLIjusYVKX35qRKcN5BU5Cc0/58Hos6xp+jzDj7ZBs6zO1gDLzrNJ5D/WLgFeTQXd0gad/sAWanmyHRUYvvQtakPLDopOwO4O61L/O/Gj7czaY61jw6LOOjjXF23T4xSK2p4EemWbUNRxm8Kq8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57520+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1587137892402418.62589293593317; Fri, 17 Apr 2020 08:38:12 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 8RhgYY1788612xpnqz2SWy2j; Fri, 17 Apr 2020 08:38:12 -0700 X-Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web12.3739.1587137891392131518 for ; Fri, 17 Apr 2020 08:38:11 -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-364-1_n0g1rTOCKAEvgbg1fz-A-1; Fri, 17 Apr 2020 11:38:06 -0400 X-MC-Unique: 1_n0g1rTOCKAEvgbg1fz-A-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 758CB8010CA; Fri, 17 Apr 2020 15:38:05 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-253.ams2.redhat.com [10.36.113.253]) by smtp.corp.redhat.com (Postfix) with ESMTP id C212D6EF91; Fri, 17 Apr 2020 15:38:03 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Anthony Perard , Ard Biesheuvel , Jordan Justen , Julien Grall , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Rebecca Cran Subject: [edk2-devel] [PATCH 5/6] OvmfPkg/ResetSystemLib: rename to BaseResetSystemLib Date: Fri, 17 Apr 2020 17:37:50 +0200 Message-Id: <20200417153751.7110-6-lersek@redhat.com> In-Reply-To: <20200417153751.7110-1-lersek@redhat.com> References: <20200417153751.7110-1-lersek@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: 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,lersek@redhat.com X-Gm-Message-State: 2mBRwIto1hRUbQIhJoLeFeH5x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587137892; bh=wA5J6HdgCnE9iKX/oEo76HF+xr+vHEhjwzBWrOJt/9c=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=RJ7OdHt7bAc+8SZMsP+IAMq5vDBjOBjtxQCxU1rL26A+ZecTS201Xlsa1jlQTBU0nte IDvLZhOmD3H1fNGjunMBj+h95HkM98lmDNqDd1bXnyMfYxTs+mdAHwrGIy+TY/p8EpJMI 9CDDW/I9JJ8i+Z4co/+qRmeXGC4G0gb2dOE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" In preparation for introducing DxeResetSystemLib, rename the current (only) ResetSystemLib instance to BaseResetSystemLib. In the DSC files, keep the ResetSystemLib resolution in the same [LibraryClasses] section, but move it near the TimerLib resolution, as the differences between the ResetSystemLib instances will mostly follow those seen under OvmfPkg/Library/AcpiTimerLib. (While OvmfXen does not use "OvmfPkg/Library/AcpiTimerLib", perform the same movement there too, for keeping future DSC diffing simple.) Cc: Anthony Perard Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Julien Grall Cc: Philippe Mathieu-Daud=C3=A9 Cc: Rebecca Cran Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2675 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Rebecca Cran --- OvmfPkg/OvmfPkgIa32.dsc = | 2 +- OvmfPkg/OvmfPkgIa32X64.dsc = | 2 +- OvmfPkg/OvmfPkgX64.dsc = | 2 +- OvmfPkg/OvmfXen.dsc = | 2 +- OvmfPkg/Library/ResetSystemLib/{ResetSystemLib.inf =3D> BaseResetSystemLib= .inf} | 6 +++--- OvmfPkg/Library/ResetSystemLib/{ResetShutdown.c =3D> BaseResetShutdown.c} = | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index cbc5f0e583bc..cd0ed34e0e5a 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -114,6 +114,7 @@ [SkuIds] [LibraryClasses] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf BaseLib|MdePkg/Library/BaseLib/BaseLib.inf @@ -176,7 +177,6 @@ [LibraryClasses] DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.i= nf !endif =20 - ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD= ebugPrintErrorLevelLib.inf =20 diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 6d69cc6cb56f..3c377c6e858e 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -118,6 +118,7 @@ [SkuIds] [LibraryClasses] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf BaseLib|MdePkg/Library/BaseLib/BaseLib.inf @@ -180,7 +181,6 @@ [LibraryClasses] DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.i= nf !endif =20 - ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD= ebugPrintErrorLevelLib.inf =20 diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 5ad4f461ce52..701a7ccea987 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -118,6 +118,7 @@ [SkuIds] [LibraryClasses] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf BaseLib|MdePkg/Library/BaseLib/BaseLib.inf @@ -180,7 +181,6 @@ [LibraryClasses] DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.i= nf !endif =20 - ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD= ebugPrintErrorLevelLib.inf =20 diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 47ee8db8b884..86b24d1716b9 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -110,6 +110,7 @@ [SkuIds] [LibraryClasses] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf TimerLib|MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf BaseLib|MdePkg/Library/BaseLib/BaseLib.inf @@ -169,7 +170,6 @@ [LibraryClasses] DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.i= nf !endif =20 - ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD= ebugPrintErrorLevelLib.inf =20 diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Li= brary/ResetSystemLib/BaseResetSystemLib.inf similarity index 80% rename from OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf rename to OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf index 9362f884f124..0772780b2dc2 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf +++ b/OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf @@ -1,5 +1,5 @@ ## @file -# Library instance for ResetSystem library class for OVMF +# Base library instance for ResetSystem library class for OVMF # # Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent @@ -8,7 +8,7 @@ =20 [Defines] INF_VERSION =3D 0x00010005 - BASE_NAME =3D ResetSystemLib + BASE_NAME =3D BaseResetSystemLib FILE_GUID =3D 66564872-21d4-4d2a-a68b-1e844f980820 MODULE_TYPE =3D BASE VERSION_STRING =3D 1.0 @@ -22,7 +22,7 @@ [Defines] # =20 [Sources] - ResetShutdown.c + BaseResetShutdown.c ResetSystemLib.c =20 [Packages] diff --git a/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c b/OvmfPkg/Libra= ry/ResetSystemLib/BaseResetShutdown.c similarity index 91% rename from OvmfPkg/Library/ResetSystemLib/ResetShutdown.c rename to OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c index 971d94fa5766..21c80e43230c 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c +++ b/OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c @@ -1,5 +1,5 @@ /** @file - Reset System Library Shutdown API implementation for OVMF. + Base Reset System Library Shutdown API implementation for OVMF. =20 Copyright (C) 2020, Red Hat, Inc. Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
--=20 2.19.1.3.g30247aa5d201 -=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 (#57520): https://edk2.groups.io/g/devel/message/57520 Mute This Topic: https://groups.io/mt/73085508/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 Tue May 7 10:54:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+57521+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57521+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587137892; cv=none; d=zohomail.com; s=zohoarc; b=gJa4ekysoUgnCIWUtG68+pz4ttg+Ep4e80yXjv8Yr6fJd7aNC34hl/jqakhcGofE/aphwTA0yP4WWq2TJK6mGcFw/thQMcQPeH/X2EP73RvZbN/OZHivzz2ueXI0wQThAvw/3Md1O44w8T4Fsb2lE1GY4U8kVWUoii13A+scIOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587137892; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=5Fb14jL7gIziil/M2h9qgoIglFS+Vkx6vq23D+3Xo2s=; b=WfvJqJ+J5N3l+I//dR7iATBO7dBa8AFE6I8QpJKP/9e9t4+iPMEewChMeERZEQ4+PQM5ihPTQAAhJByWzDQJzPR0gpXX7sq1KsymP1zL4MQ7C/APyAyXXrjOpIWfqJ/BEIzhq1wdCRirKQTB/d0Js/mJs7u+FUSKBmA/jW/Ei38= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57521+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1587137892674364.6651240504028; Fri, 17 Apr 2020 08:38:12 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id rcQ1YY1788612xmVVSA14Luh; Fri, 17 Apr 2020 08:38:12 -0700 X-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.web10.3696.1587137891515312865 for ; Fri, 17 Apr 2020 08:38:11 -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-425-SnkniztiPji9rp-zza4nhQ-1; Fri, 17 Apr 2020 11:38:09 -0400 X-MC-Unique: SnkniztiPji9rp-zza4nhQ-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 A931F8017FE; Fri, 17 Apr 2020 15:38:07 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-253.ams2.redhat.com [10.36.113.253]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA1FC6EF91; Fri, 17 Apr 2020 15:38:05 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Anthony Perard , Ard Biesheuvel , Jordan Justen , Julien Grall , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Rebecca Cran Subject: [edk2-devel] [PATCH 6/6] OvmfPkg/ResetSystemLib: introduce the DxeResetSystemLib instance Date: Fri, 17 Apr 2020 17:37:51 +0200 Message-Id: <20200417153751.7110-7-lersek@redhat.com> In-Reply-To: <20200417153751.7110-1-lersek@redhat.com> References: <20200417153751.7110-1-lersek@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: 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,lersek@redhat.com X-Gm-Message-State: kB4A8lTMBxx5F8xfSanM5BDdx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587137892; bh=5Fb14jL7gIziil/M2h9qgoIglFS+Vkx6vq23D+3Xo2s=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=HacgBbs4ps11KBb6KlOo3F6ress1rjzJyHcSnnWmRYD/gaQ56w9aVpMFh2iq+/lX7nK PhV6o6lydzM/kEoIT3QFKtPoc/5XtqXipWKOZ+GsOf131jHfakY6tZWOB23tNsfG076Px cY+SET/BBIg4axooIpV4/fZfpWHQMyooz30= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The BaseResetSystemLib instance is not suitable for OS runtime, because its ResetShutdown() implementation calls PciRead16 (OVMF_HOSTBRIDGE_DID). On q35, this boils down to a memory-mapped config space access -- but we never ask the OS to map MMCONFIG for runtime. There are at least three alternatives to approach this: (1) Investigate "MdePkg/Library/DxeRuntimePciExpressLib", which offers some kind of runtime mapping for MMCONFIG. (2) Consume PciCf8Lib directly, rather than PciLib, in ResetSystemLib. Then we'll read OVMF_HOSTBRIDGE_DID from the config space with IO port accesses on q35 too, not just on i440fx. IO ports don't depend on page tables. (3) In the lib constructor, cache "mAcpiPmBaseAddress" based on "PcdOvmfHostBridgePciDevId" (which is set by PlatformPei). Then the host bridge type will be known at runtime without PCI config space accesses. This patch follows approach (3), in order to mirror AcpiTimerLib. Notes: * This patch is best viewed with "git show --find-copies-harder -C43". * PCDs are not usable in the DXE_CORE, as the PCD PPI is gone, and the PCD protocol is not available yet. (The DXE_CORE does consume ResetSystemLib in practice, when OVMF is built with -D SOURCE_DEBUG_ENABLE.) * The bug is not easy to trigger in common setups, because e.g. the Linux guest cannot easily be convinced to use the EFI runtime service for poweroff. One way to trigger the bug is to (a) patch OVMF as follows: > diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Li= brary/ResetSystemLib/ResetSystemLib.c > index fe51f53d1df2..1edc4349ad20 100644 > --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c > +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c > @@ -28,6 +28,7 @@ ResetCold ( > VOID > ) > { > + ResetShutdown (); > IoWrite8 (0xCF9, BIT2 | BIT1); // 1st choice: PIIX3 RCR, RCPU|SRST > MicroSecondDelay (50); (b) boot a Linux guest with "reboot=3Defi" on q35, and (c) reboot the guest with the "reboot" command. Then the guest kernel will log: > reboot: Restarting system > reboot: machine restart > ------------[ cut here ]------------ > [Firmware Bug]: Page fault caused by firmware at PA: 0xb0000002 > WARNING: CPU: 0 PID: 1362 at arch/x86/platform/efi/quirks.c:738 > efi_recover_from_page_fault+0x2a/0xc8 > Modules linked in: ip_set nfnetlink sunrpc vfat fat intel_rapl_msr > intel_rapl_common kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul > bochs_drm drm_vram_helper ttm ghash_clmulni_intel drm_kms_helper > iTCO_wdt iTCO_vendor > CPU: 0 PID: 1362 Comm: reboot Not tainted 5.3.6-200.fc30.x86_64 #1 > Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 > 02/06/2015 > RIP: 0010:efi_recover_from_page_fault+0x2a/0xc8 > Code: 0f 1f 44 00 00 8b 15 35 c2 c1 01 85 d2 74 09 48 81 ff ff 0f 00 00 > 77 01 c3 53 48 89 fe 48 c7 c7 58 ba 12 aa 50 e8 74 f0 00 00 <0f> 0b 83 > 3d 0d c2 c1 01 0a 0f 84 8f 00 00 00 48 8b 05 70 c8 4a 01 > RSP: 0018:ffffaf3a402539d8 EFLAGS: 00010286 > RAX: 0000000000000000 RBX: ffff8a3c33711f40 RCX: 00000000000003b2 > RDX: 0000000000000001 RSI: 0000000000000096 RDI: 0000000000000246 > RBP: ffffaf3a40253a88 R08: 0000000000000000 R09: 00000000000003b2 > R10: 0000000000000001 R11: ffffffffa9ee3800 R12: 00000000b0000002 > R13: 0000000000000000 R14: 000000000000000b R15: 0000000000000001 > FS: 00007fbca9cf8940(0000) GS:ffff8a3c3ae00000(0000) > knlGS:0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: fffffffeff8a67a1 CR3: 0000000072868006 CR4: 00000000001606f0 > Call Trace: > no_context+0x15b/0x380 > ? do_user_addr_fault+0x12e/0x440 > do_page_fault+0x31/0x110 > async_page_fault+0x3e/0x50 > RIP: 0010:0xfffffffeff8a67a1 > Code: Bad RIP value. > RSP: 0018:ffffaf3a40253b30 EFLAGS: 00010046 > RAX: 00000000b0000002 RBX: 0000000000000000 RCX: 00000000b0000002 > RDX: 00000000b0000000 RSI: 0000000000000000 RDI: fffffffeff8a80f0 > RBP: ffffaf3a40253b60 R08: fffffffeff8aadb8 R09: 0000000000000000 > R10: ffffffffaa5762c0 R11: ffffffffa9ee3800 R12: 0000000000000000 > R13: 0000000000000000 R14: 0000000000000046 R15: 0000000000000000 > ? efi_call+0x58/0x90 > ? virt_efi_reset_system+0x8d/0x100 > ? efi_reboot+0x85/0xb8 > ? native_machine_emergency_restart+0x9f/0x250 > ? native_apic_msr_read+0x16/0x20 > ? disconnect_bsp_APIC+0x8c/0xd0 > ? __do_sys_reboot+0x1d2/0x210 > ? __fput+0x168/0x250 > ? do_writev+0x6b/0x110 > ? do_syscall_64+0x5f/0x1a0 > ? entry_SYSCALL_64_after_hwframe+0x44/0xa9 > ---[ end trace d5bee708166d198b ]--- > efi: efi_reset_system() buggy! Reboot through BIOS Cc: Anthony Perard Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Julien Grall Cc: Philippe Mathieu-Daud=C3=A9 Cc: Rebecca Cran Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2675 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daude Reviewed-by: Rebecca Cran --- OvmfPkg/OvmfPkgIa32.dsc = | 6 +++ OvmfPkg/OvmfPkgIa32X64.dsc = | 6 +++ OvmfPkg/OvmfPkgX64.dsc = | 6 +++ OvmfPkg/OvmfXen.dsc = | 4 ++ OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf = | 2 +- OvmfPkg/Library/ResetSystemLib/{BaseResetSystemLib.inf =3D> DxeResetSystem= Lib.inf} | 21 +++++---- OvmfPkg/Library/ResetSystemLib/{BaseResetShutdown.c =3D> DxeResetShutdown.= c} | 49 ++++++++++++-------- 7 files changed, 66 insertions(+), 28 deletions(-) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index cd0ed34e0e5a..d5e90c001370 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -314,6 +314,7 @@ [LibraryClasses.common.DXE_CORE] [LibraryClasses.common.DXE_RUNTIME_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf @@ -331,6 +332,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER] [LibraryClasses.common.UEFI_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf @@ -346,6 +348,7 @@ [LibraryClasses.common.UEFI_DRIVER] [LibraryClasses.common.DXE_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf @@ -383,6 +386,7 @@ [LibraryClasses.common.DXE_DRIVER] [LibraryClasses.common.UEFI_APPLICATION] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf @@ -396,6 +400,7 @@ [LibraryClasses.common.UEFI_APPLICATION] [LibraryClasses.common.DXE_SMM_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAlloc= ationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf @@ -417,6 +422,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER] [LibraryClasses.common.SMM_CORE] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/S= mmCorePlatformHookLibNull.inf MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/Pi= SmmCoreMemoryAllocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 3c377c6e858e..066f49aeaee0 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -318,6 +318,7 @@ [LibraryClasses.common.DXE_CORE] [LibraryClasses.common.DXE_RUNTIME_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf @@ -335,6 +336,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER] [LibraryClasses.common.UEFI_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf @@ -350,6 +352,7 @@ [LibraryClasses.common.UEFI_DRIVER] [LibraryClasses.common.DXE_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf @@ -387,6 +390,7 @@ [LibraryClasses.common.DXE_DRIVER] [LibraryClasses.common.UEFI_APPLICATION] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf @@ -400,6 +404,7 @@ [LibraryClasses.common.UEFI_APPLICATION] [LibraryClasses.common.DXE_SMM_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAlloc= ationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf @@ -421,6 +426,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER] [LibraryClasses.common.SMM_CORE] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/S= mmCorePlatformHookLibNull.inf MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/Pi= SmmCoreMemoryAllocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 701a7ccea987..ac510522a9ff 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -318,6 +318,7 @@ [LibraryClasses.common.DXE_CORE] [LibraryClasses.common.DXE_RUNTIME_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf @@ -335,6 +336,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER] [LibraryClasses.common.UEFI_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf @@ -350,6 +352,7 @@ [LibraryClasses.common.UEFI_DRIVER] [LibraryClasses.common.DXE_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf @@ -387,6 +390,7 @@ [LibraryClasses.common.DXE_DRIVER] [LibraryClasses.common.UEFI_APPLICATION] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf @@ -400,6 +404,7 @@ [LibraryClasses.common.UEFI_APPLICATION] [LibraryClasses.common.DXE_SMM_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAlloc= ationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf @@ -421,6 +426,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER] [LibraryClasses.common.SMM_CORE] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/S= mmCorePlatformHookLibNull.inf MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/Pi= SmmCoreMemoryAllocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 86b24d1716b9..f6214bd3465a 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -288,6 +288,7 @@ [LibraryClasses.common.DXE_CORE] =20 [LibraryClasses.common.DXE_RUNTIME_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf @@ -304,6 +305,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER] =20 [LibraryClasses.common.UEFI_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf @@ -318,6 +320,7 @@ [LibraryClasses.common.UEFI_DRIVER] =20 [LibraryClasses.common.DXE_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf @@ -341,6 +344,7 @@ [LibraryClasses.common.DXE_DRIVER] =20 [LibraryClasses.common.UEFI_APPLICATION] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf diff --git a/OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf b/OvmfPk= g/Library/ResetSystemLib/BaseResetSystemLib.inf index 0772780b2dc2..35d317f1e0b3 100644 --- a/OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf +++ b/OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf @@ -12,7 +12,7 @@ [Defines] FILE_GUID =3D 66564872-21d4-4d2a-a68b-1e844f980820 MODULE_TYPE =3D BASE VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D ResetSystemLib + LIBRARY_CLASS =3D ResetSystemLib|SEC PEI_CORE PEIM DXE_= CORE =20 # # The following information is for reference only and not required by the = build diff --git a/OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf b/OvmfPk= g/Library/ResetSystemLib/DxeResetSystemLib.inf similarity index 43% copy from OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf copy to OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf index 0772780b2dc2..a9b4ce90000a 100644 --- a/OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf +++ b/OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf @@ -1,18 +1,20 @@ ## @file -# Base library instance for ResetSystem library class for OVMF +# DXE library instance for ResetSystem library class for OVMF # +# Copyright (C) 2020, Red Hat, Inc. # Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## =20 [Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D BaseResetSystemLib - FILE_GUID =3D 66564872-21d4-4d2a-a68b-1e844f980820 - MODULE_TYPE =3D BASE + INF_VERSION =3D 1.29 + BASE_NAME =3D DxeResetSystemLib + FILE_GUID =3D bc7835ea-4094-41fe-b770-bad9e6c479b2 + MODULE_TYPE =3D DXE_DRIVER VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D ResetSystemLib + LIBRARY_CLASS =3D ResetSystemLib|DXE_DRIVER DXE_RUNTIME= _DRIVER SMM_CORE DXE_SMM_DRIVER UEFI_DRIVER UEFI_APPLICATION + CONSTRUCTOR =3D DxeResetInit =20 # # The following information is for reference only and not required by the = build @@ -22,7 +24,7 @@ [Defines] # =20 [Sources] - BaseResetShutdown.c + DxeResetShutdown.c ResetSystemLib.c =20 [Packages] @@ -34,5 +36,8 @@ [LibraryClasses] BaseLib DebugLib IoLib - PciLib + PcdLib TimerLib + +[Pcd] + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId ## CONSUMES diff --git a/OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c b/OvmfPkg/L= ibrary/ResetSystemLib/DxeResetShutdown.c similarity index 57% copy from OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c copy to OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c index 21c80e43230c..5a75c32df361 100644 --- a/OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c +++ b/OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c @@ -1,5 +1,5 @@ /** @file - Base Reset System Library Shutdown API implementation for OVMF. + DXE Reset System Library Shutdown API implementation for OVMF. =20 Copyright (C) 2020, Red Hat, Inc. Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
@@ -11,41 +11,52 @@ #include // CpuDeadLoop() #include // ASSERT() #include // IoOr16() -#include // PciRead16() +#include // PcdGet16() #include // ResetShutdown() -#include // OVMF_HOSTBRIDGE_DID +#include // PIIX4_PMBA_VALUE =20 -/** - Calling this function causes the system to enter a power state equivalent - to the ACPI G2/S5 or G3 states. +STATIC UINT16 mAcpiPmBaseAddress; =20 - System shutdown should not return, if it returns, it means the system do= es - not support shut down reset. -**/ -VOID +EFI_STATUS EFIAPI -ResetShutdown ( - VOID +DxeResetInit ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable ) { - UINT16 AcpiPmBaseAddress; UINT16 HostBridgeDevId; =20 - AcpiPmBaseAddress =3D 0; - HostBridgeDevId =3D PciRead16 (OVMF_HOSTBRIDGE_DID); + HostBridgeDevId =3D PcdGet16 (PcdOvmfHostBridgePciDevId); switch (HostBridgeDevId) { case INTEL_82441_DEVICE_ID: - AcpiPmBaseAddress =3D PIIX4_PMBA_VALUE; + mAcpiPmBaseAddress =3D PIIX4_PMBA_VALUE; break; case INTEL_Q35_MCH_DEVICE_ID: - AcpiPmBaseAddress =3D ICH9_PMBASE_VALUE; + mAcpiPmBaseAddress =3D ICH9_PMBASE_VALUE; break; default: ASSERT (FALSE); CpuDeadLoop (); + return EFI_UNSUPPORTED; } =20 - IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, 0); - IoOr16 (AcpiPmBaseAddress + 4, BIT13); + return EFI_SUCCESS; +} + +/** + Calling this function causes the system to enter a power state equivalent + to the ACPI G2/S5 or G3 states. + + System shutdown should not return, if it returns, it means the system do= es + not support shut down reset. +**/ +VOID +EFIAPI +ResetShutdown ( + VOID + ) +{ + IoBitFieldWrite16 (mAcpiPmBaseAddress + 4, 10, 13, 0); + IoOr16 (mAcpiPmBaseAddress + 4, BIT13); CpuDeadLoop (); } --=20 2.19.1.3.g30247aa5d201 -=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 (#57521): https://edk2.groups.io/g/devel/message/57521 Mute This Topic: https://groups.io/mt/73085509/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-