From nobody Fri Apr 26 00:52:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+42143+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42143+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1560216614; cv=none; d=zoho.com; s=zohoarc; b=kJNWSw0NgjTHtzTHryxOedjT65xPzf6KDvLmID+VRDRpWkALTfjoX+e65j1JmnUg6G1eSV2jVYDMOhy139iHvJuPkuKmnmn/df4kXzk3I6ubJL9W2hhsH+NA+UQD3TQ9SPWzRvM3KY2MT67ySoV6HKbjxIGG+C759jSOoabswf0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560216614; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=0X1hkZukVWmN5Xx/KB69If6xt5hGxRHePQ3HXwjSk3o=; b=LOUN9AnoawOPOzYcExRXwHW3Wlspl48jgJgkZH/Tz8OqEgdTngWR6rbtKj5UyF3xbjXjIQWKXG0PKpry8kr353qt/vsE7GxQ3ZFRKP6DsyaXXnp9lwqMLg0LMfYLTGDKn0DEQM1kZ+mxWoUB8fFRV4ozgAl2NY7ELxhPewkc6E8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42143+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 1560216614509272.6057965324036; Mon, 10 Jun 2019 18:30:14 -0700 (PDT) Return-Path: X-Received: from mga09.intel.com (mga09.intel.com []) by groups.io with SMTP; Mon, 10 Jun 2019 18:30:11 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 18:30:11 -0700 X-ExtLoop1: 1 X-Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.8]) by orsmga002.jf.intel.com with ESMTP; 10 Jun 2019 18:30:09 -0700 From: "Wu, Hao A" To: devel@edk2.groups.io Cc: Hao A Wu , David Woodhouse , Ray Ni , Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [edk2-devel] [PATCH v1 1/2] OvmfPkg: Remove 'CSM_ENABLE' flag & CSM modules in DSC/FDF files Date: Tue, 11 Jun 2019 09:30:05 +0800 Message-Id: <20190611013006.7620-2-hao.a.wu@intel.com> In-Reply-To: <20190611013006.7620-1-hao.a.wu@intel.com> References: <20190611013006.7620-1-hao.a.wu@intel.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,hao.a.wu@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1560216613; bh=BIMFjg1Yj88DyDFGxKpqvLn9Z/Daxw2Fk3KHSLtQl6Q=; h=Cc:Date:From:Reply-To:Subject:To; b=QA84NKjffoxUBVthXYtgrxYPtYI1oSSZH1um0n2edT9rheUd8ZfRiHPIcDiv8gVAwwf HG+SnyAyAeNf5Tz1vOlUFbZoyggr/LStPwVO3U2SK8BWuHv9CE0hBjPcp4ITYlmmTo1SN 7GO0Q6ySWDFhaSuZl/DwTCRbvNivdxtm49I= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1811 To drop the CSM support on OVMF, this commit will update the DSC/FDF files in OvmfPkg to remove: * The usage of build flag 'CSM_ENABLE'; * The consume of CSM related modules. Cc: David Woodhouse Cc: Ray Ni Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Signed-off-by: Hao A Wu Acked-by: Ard Biesheuvel --- OvmfPkg/OvmfPkgIa32.dsc | 21 +------------------- OvmfPkg/OvmfPkgIa32X64.dsc | 21 +------------------- OvmfPkg/OvmfPkgX64.dsc | 21 +------------------- OvmfPkg/OvmfPkgIa32.fdf | 6 ------ OvmfPkg/OvmfPkgIa32X64.fdf | 6 ------ OvmfPkg/OvmfPkgX64.fdf | 6 ------ 6 files changed, 3 insertions(+), 78 deletions(-) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 8281f409f2..d37aa52c53 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -681,23 +681,13 @@ [Components] MdeModulePkg/Universal/Metronome/Metronome.inf PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.i= nf MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf - MdeModulePkg/Universal/BdsDxe/BdsDxe.inf { - -!ifdef $(CSM_ENABLE) - NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf - NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBoot= ManagerLib.inf -!endif - } + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf MdeModulePkg/Logo/LogoDxe.inf MdeModulePkg/Application/UiApp/UiApp.inf { NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc= eManagerUiLib.inf -!ifdef $(CSM_ENABLE) - NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBoot= ManagerLib.inf - NULL|IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBoot= MaintUiLib.inf -!endif } OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf OvmfPkg/Virtio10Dxe/Virtio10.inf @@ -793,15 +783,6 @@ [Components] MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf =20 -!ifdef $(CSM_ENABLE) - IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf { - - PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - } - IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf - OvmfPkg/Csm/Csm16/Csm16.inf -!endif - !if $(TOOL_CHAIN_TAG) !=3D "XCODE5" ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf { diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 30d094d217..e4cbd995b7 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -690,23 +690,13 @@ [Components.X64] MdeModulePkg/Universal/Metronome/Metronome.inf PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.i= nf MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf - MdeModulePkg/Universal/BdsDxe/BdsDxe.inf { - -!ifdef $(CSM_ENABLE) - NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf - NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBoot= ManagerLib.inf -!endif - } + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf MdeModulePkg/Logo/LogoDxe.inf MdeModulePkg/Application/UiApp/UiApp.inf { NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc= eManagerUiLib.inf -!ifdef $(CSM_ENABLE) - NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBoot= ManagerLib.inf - NULL|IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBoot= MaintUiLib.inf -!endif } OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf OvmfPkg/Virtio10Dxe/Virtio10.inf @@ -802,15 +792,6 @@ [Components.X64] MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf =20 -!ifdef $(CSM_ENABLE) - IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf { - - PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - } - IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf - OvmfPkg/Csm/Csm16/Csm16.inf -!endif - !if $(TOOL_CHAIN_TAG) !=3D "XCODE5" ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf { diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 705795f0da..fc81fb1543 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -688,23 +688,13 @@ [Components] MdeModulePkg/Universal/Metronome/Metronome.inf PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.i= nf MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf - MdeModulePkg/Universal/BdsDxe/BdsDxe.inf { - -!ifdef $(CSM_ENABLE) - NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf - NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBoot= ManagerLib.inf -!endif - } + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf MdeModulePkg/Logo/LogoDxe.inf MdeModulePkg/Application/UiApp/UiApp.inf { NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc= eManagerUiLib.inf -!ifdef $(CSM_ENABLE) - NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBoot= ManagerLib.inf - NULL|IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBoot= MaintUiLib.inf -!endif } OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf OvmfPkg/Virtio10Dxe/Virtio10.inf @@ -800,15 +790,6 @@ [Components] MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf =20 -!ifdef $(CSM_ENABLE) - IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf { - - PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf - } - IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf - OvmfPkg/Csm/Csm16/Csm16.inf -!endif - !if $(TOOL_CHAIN_TAG) !=3D "XCODE5" ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf { diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf index 12da9f4706..1835ff27b0 100644 --- a/OvmfPkg/OvmfPkgIa32.fdf +++ b/OvmfPkg/OvmfPkgIa32.fdf @@ -301,12 +301,6 @@ [FV.DXEFV] INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf =20 -!ifdef $(CSM_ENABLE) -INF IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf -INF IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf -INF RuleOverride=3DCSM OvmfPkg/Csm/Csm16/Csm16.inf -!endif - INF OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf INF OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf INF OvmfPkg/VirtioGpuDxe/VirtioGpu.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf index 47ac7d8646..6c1e97b794 100644 --- a/OvmfPkg/OvmfPkgIa32X64.fdf +++ b/OvmfPkg/OvmfPkgIa32X64.fdf @@ -307,12 +307,6 @@ [FV.DXEFV] INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf =20 -!ifdef $(CSM_ENABLE) -INF IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf -INF IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf -INF RuleOverride=3DCSM OvmfPkg/Csm/Csm16/Csm16.inf -!endif - INF OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf INF OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf INF OvmfPkg/VirtioGpuDxe/VirtioGpu.inf diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf index 47ac7d8646..6c1e97b794 100644 --- a/OvmfPkg/OvmfPkgX64.fdf +++ b/OvmfPkg/OvmfPkgX64.fdf @@ -307,12 +307,6 @@ [FV.DXEFV] INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf =20 -!ifdef $(CSM_ENABLE) -INF IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf -INF IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf -INF RuleOverride=3DCSM OvmfPkg/Csm/Csm16/Csm16.inf -!endif - INF OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf INF OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf INF OvmfPkg/VirtioGpuDxe/VirtioGpu.inf --=20 2.12.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#42143): https://edk2.groups.io/g/devel/message/42143 Mute This Topic: https://groups.io/mt/32011735/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 Fri Apr 26 00:52:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+42144+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42144+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1560216616; cv=none; d=zoho.com; s=zohoarc; b=PlW1zFAjjYXS43ApQp1C96QK8olZD9kcTVliFKjgzSYuH24rEaJKS+rG3lErfK1zXyxN9Fqm5AlJI3q+Uqtc+jGiCUvvZoD7YAyZ0ZzocFanZdMbiVE45HjfiO3ZoRgCPpz4DFtsLzYQd0vO5NFzgNSlD1htAi15yEEyZFtMFV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560216616; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=6hlXr+SYtQ8Cljwdl9NY0j+Xt/08GwlS/MOz39VFF3c=; b=ZggEaVsXPtf197JnFUQ1iOoRna5RPJOGwp8C050uTgjklCTq5TBJQGBTxEY2EvLiEONzUvfMBZkdLsnxuLDRDovvejowxrKzHFvLu5r60SKKjixsJYV0qiim3+sZ4VBpCakv3eGDDamFb2cTdxRwZ8tpAP6Y8bP+Ss6H6+owXws= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42144+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 156021661614072.37515642535175; Mon, 10 Jun 2019 18:30:16 -0700 (PDT) Return-Path: X-Received: from mga09.intel.com (mga09.intel.com []) by groups.io with SMTP; Mon, 10 Jun 2019 18:30:14 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 18:30:14 -0700 X-ExtLoop1: 1 X-Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.8]) by orsmga002.jf.intel.com with ESMTP; 10 Jun 2019 18:30:11 -0700 From: "Wu, Hao A" To: devel@edk2.groups.io Cc: Hao A Wu , David Woodhouse , Ray Ni , Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [edk2-devel] [PATCH v1 2/2] OvmfPkg/Csm: Remove the components under this folder Date: Tue, 11 Jun 2019 09:30:06 +0800 Message-Id: <20190611013006.7620-3-hao.a.wu@intel.com> In-Reply-To: <20190611013006.7620-1-hao.a.wu@intel.com> References: <20190611013006.7620-1-hao.a.wu@intel.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,hao.a.wu@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1560216615; bh=z5fBHq/WRtIrk753pM8X1bzLmYALFc4fx+6ML848GAo=; h=Cc:Date:From:Reply-To:Subject:To; b=uL8FaASlQycFtXgtCSdsQpFRHxDr4dpgsYKETmPSm6Iuu036sN5ASdy45M1inHzvcTn oRQfoyGIiQu5b8gG9O9aAM4wN+AHWbjCxPgSn3rfTMh6pK2/Km/hcxEt/4WrdIgMcLj7r owKN4YZZ1Mmn91K6M1YocXMUv+8j8M/d48g= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1811 The previous commit has dropped the usage of all the CSM related components under folder OvmfPkg/Csm/ from the platform DSC/FDF file. This commit will delete these unused modules. Cc: David Woodhouse Cc: Ray Ni Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Signed-off-by: Hao A Wu Acked-by: Ard Biesheuvel --- OvmfPkg/Csm/Csm16/Csm16.inf | 17 - OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf | 56 -- OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.h | 49 - OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h | 117 --- OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.h | 98 -- OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h | 203 ---- OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.c | 32 - OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c | 214 ---- OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c | 1060 -------------------- OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c | 498 --------- OvmfPkg/Csm/Csm16/ReadMe.txt | 12 - 11 files changed, 2356 deletions(-) diff --git a/OvmfPkg/Csm/Csm16/Csm16.inf b/OvmfPkg/Csm/Csm16/Csm16.inf deleted file mode 100644 index 2bd33e309d..0000000000 --- a/OvmfPkg/Csm/Csm16/Csm16.inf +++ /dev/null @@ -1,17 +0,0 @@ -## @file -# CSM Binary -# -# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D Csm16 - FILE_GUID =3D 1547B4F3-3E8A-4FEF-81C8-328ED647AB1A - MODULE_TYPE =3D USER_DEFINED - VERSION_STRING =3D 1.0 - -[Binaries] - BIN|Csm16.bin|* \ No newline at end of file diff --git a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf b/OvmfPkg/Csm/CsmS= upportLib/CsmSupportLib.inf deleted file mode 100644 index 229f2e0b4b..0000000000 --- a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf +++ /dev/null @@ -1,56 +0,0 @@ -## @file -# Platform CSM Support Library -# -# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D CsmSupportLib - FILE_GUID =3D 04e03541-4663-417d-93f6-976378247d61 - MODULE_TYPE =3D BASE - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D CsmSupportLib - - CONSTRUCTOR =3D CsmSupportLibConstructor - -# -# The following information is for reference only and not required by the = build tools. -# -# VALID_ARCHITECTURES =3D IA32 X64 EBC -# - -[Sources] - CsmSupportLib.c - CsmSupportLib.h - LegacyInterrupt.c - LegacyInterrupt.h - LegacyPlatform.c - LegacyPlatform.h - LegacyRegion.c - LegacyRegion.h - -[Packages] - MdePkg/MdePkg.dec - IntelFrameworkPkg/IntelFrameworkPkg.dec - OvmfPkg/OvmfPkg.dec - -[Pcd] - gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId - -[Protocols] - gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED - gEfiDiskInfoProtocolGuid # PROTOCOL ALWAYS_CONSUMED - gEfiLegacyBiosPlatformProtocolGuid # PROTOCOL ALWAYS_CONSUMED - gEfiLegacyBiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED - gEfiLegacyInterruptProtocolGuid # PROTOCOL ALWAYS_PRODUCED - gEfiLegacyRegion2ProtocolGuid # PROTOCOL ALWAYS_PRODUCED - gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED - -[LibraryClasses] - BaseLib - PciLib - IoLib - diff --git a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.h b/OvmfPkg/Csm/CsmSup= portLib/CsmSupportLib.h deleted file mode 100644 index 922a6aba2c..0000000000 --- a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.h +++ /dev/null @@ -1,49 +0,0 @@ -/** @file - Platform CSM Support Library - - Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef _CSM_SUPPORT_LIB_H_ -#define _CSM_SUPPORT_LIB_H_ - -#include - -/** - Initialize Legacy Region support - - @retval EFI_SUCCESS Successfully initialized - -**/ -EFI_STATUS -LegacyRegionInit ( - VOID - ); - -/** - Initialize Legacy Interrupt support - - @retval EFI_SUCCESS Successfully initialized - -**/ -EFI_STATUS -LegacyInterruptInstall ( - VOID - ); - -/** - Initialize Legacy Platform support - - @retval EFI_SUCCESS Successfully initialized - -**/ -EFI_STATUS -LegacyBiosPlatformInstall ( - VOID - ); - -#endif - diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h b/OvmfPkg/Csm/CsmS= upportLib/LegacyInterrupt.h deleted file mode 100644 index 1e37a41a57..0000000000 --- a/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h +++ /dev/null @@ -1,117 +0,0 @@ -/** @file - Legacy Region Support - - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef _LEGACY_INTERRUPT_H_ -#define _LEGACY_INTERRUPT_H_ - -#include - -#include - -#include -#include -#include -#include -#include - - -#define LEGACY_INT_BUS 0 -#define LEGACY_INT_DEV_PIIX4 0x01 -#define LEGACY_INT_DEV_Q35 0x1f -#define LEGACY_INT_FUNC 0 - -#define PIRQN 0x00 // PIRQ Null -#define PIRQA 0x60 -#define PIRQB 0x61 -#define PIRQC 0x62 -#define PIRQD 0x63 -#define PIRQE 0x68 -#define PIRQF 0x69 -#define PIRQG 0x6A -#define PIRQH 0x6B - -#define MAX_PIRQ_NUMBER 8 - -/** - Return the number of PIRQs supported by this chipset. - - @param[in] This Pointer to LegacyInterrupt Protocol - @param[out] NumberPirqs The pointer to return the max IRQ number suppor= ted - - @retval EFI_SUCCESS Max PIRQs successfully returned - -**/ -EFI_STATUS -EFIAPI -GetNumberPirqs ( - IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, - OUT UINT8 *NumberPirqs - ); - -/** - Return PCI location of this device. - $PIR table requires this info. - - @param[in] This - Protocol instance pointer. - @param[out] Bus - PCI Bus - @param[out] Device - PCI Device - @param[out] Function - PCI Function - - @retval EFI_SUCCESS Bus/Device/Function returned - -**/ -EFI_STATUS -EFIAPI -GetLocation ( - IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, - OUT UINT8 *Bus, - OUT UINT8 *Device, - OUT UINT8 *Function - ); - -/** - Read the given PIRQ register - - @param[in] This Protocol instance pointer - @param[in] PirqNumber The Pirq register 0 =3D A, 1 =3D B etc - @param[out] PirqData Value read - - @retval EFI_SUCCESS Decoding change affected. - @retval EFI_INVALID_PARAMETER Invalid PIRQ number - -**/ -EFI_STATUS -EFIAPI -ReadPirq ( - IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, - IN UINT8 PirqNumber, - OUT UINT8 *PirqData - ); - -/** - Write the given PIRQ register - - @param[in] This Protocol instance pointer - @param[in] PirqNumber The Pirq register 0 =3D A, 1 =3D B etc - @param[out] PirqData Value to write - - @retval EFI_SUCCESS Decoding change affected. - @retval EFI_INVALID_PARAMETER Invalid PIRQ number - -**/ -EFI_STATUS -EFIAPI -WritePirq ( - IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, - IN UINT8 PirqNumber, - IN UINT8 PirqData - ); - -#endif - diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.h b/OvmfPkg/Csm/CsmSu= pportLib/LegacyPlatform.h deleted file mode 100644 index 1479efc749..0000000000 --- a/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.h +++ /dev/null @@ -1,98 +0,0 @@ -/** @file - Legacy BIOS Platform support - - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef LEGACY_BIOS_PLATFORM_H_ -#define LEGACY_BIOS_PLATFORM_H_ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -// -// PIRQ information constants. -// -#define MAX_IRQ_ROUTING_ENTRIES 6 -#define MAX_IRQ_PRIORITY_ENTRIES 7 - -#define V_INTEL_VENDOR_ID 0x8086 -#define V_PIIX4_IDE_DEVICE_ID 0x7010 - -// -// Type declarations -// -typedef struct { - UINT8 SetupValue; - UINT16 DeviceType; - UINT8 Class; - UINT8 SubClass; -} EFI_SETUP_BBS_MAP; - -typedef struct { - UINT8 Class; - UINT8 SubClass; -} PCI_CLASS_RECORD; - -typedef struct { - EFI_LEGACY_PIRQ_TABLE_HEADER PirqTable; - EFI_LEGACY_IRQ_ROUTING_ENTRY IrqRoutingEntry[MAX_IRQ_ROUTING_ENTRIES]; -} EFI_LEGACY_PIRQ_TABLE; - -typedef struct { - EFI_HANDLE Handle; - UINT16 Vid; - UINT16 Did; - UINT16 SvId; - UINT16 SysId; -} DEVICE_STRUCTURE; - -typedef struct { - EFI_GUID FileName; - UINTN Valid; -} SYSTEM_ROM_TABLE; - -typedef struct { - UINT32 Signature; - EFI_HANDLE Handle; - EFI_LEGACY_BIOS_PLATFORM_PROTOCOL LegacyBiosPlatform; - EFI_HANDLE ImageHandle; - EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo; -} LEGACY_BIOS_PLATFORM_INSTANCE; - -#define LEGACY_BIOS_PLATFORM_INSTANCE_SIGNATURE SIGNATURE_32('P','B','I'= ,'O') - -#define LEGACY_BIOS_PLATFORM_INSTANCE_FROM_THIS(this) \ - CR (this, \ - LEGACY_BIOS_PLATFORM_INSTANCE, \ - LegacyBiosPlatform, \ - LEGACY_BIOS_PLATFORM_INSTANCE_SIGNATURE \ - ) - -#endif - diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h b/OvmfPkg/Csm/CsmSupp= ortLib/LegacyRegion.h deleted file mode 100644 index e18cb97949..0000000000 --- a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h +++ /dev/null @@ -1,203 +0,0 @@ -/** @file - Legacy Region Support - - Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef _LEGACY_REGION_DXE_H_ -#define _LEGACY_REGION_DXE_H_ - -#include - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#define PAM_BASE_ADDRESS 0xc0000 -#define PAM_LIMIT_ADDRESS BASE_1MB - -// -// Describes Legacy Region blocks and status. -// -typedef struct { - UINT32 Start; - UINT32 Length; - BOOLEAN ReadEnabled; - BOOLEAN WriteEnabled; -} LEGACY_MEMORY_SECTION_INFO; - -// -// Provides a map of the PAM registers and bits used to set Read/Write acc= ess. -// -typedef struct { - UINTN PAMRegPciLibAddress; - UINT8 ReadEnableData; - UINT8 WriteEnableData; -} PAM_REGISTER_VALUE; - -/** - Modify the hardware to allow (decode) or disallow (not decode) memory re= ads in a region. - - If the On parameter evaluates to TRUE, this function enables memory read= s in the address range - Start to (Start + Length - 1). - If the On parameter evaluates to FALSE, this function disables memory re= ads in the address range - Start to (Start + Length - 1). - - @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL i= nstance. - @param Start[in] The beginning of the physical address of t= he region whose attributes - should be modified. - @param Length[in] The number of bytes of memory whose attrib= utes should be modified. - The actual number of bytes modified may be= greater than the number - specified. - @param Granularity[out] The number of bytes in the last region aff= ected. This may be less - than the total number of bytes affected if= the starting address - was not aligned to a region's starting add= ress or if the length - was greater than the number of bytes in th= e first region. - @param On[in] Decode / Non-Decode flag. - - @retval EFI_SUCCESS The region's attributes were successfully = modified. - @retval EFI_INVALID_PARAMETER If Start or Length describe an address not= in the Legacy Region. - -**/ -EFI_STATUS -EFIAPI -LegacyRegion2Decode ( - IN EFI_LEGACY_REGION2_PROTOCOL *This, - IN UINT32 Start, - IN UINT32 Length, - OUT UINT32 *Granularity, - IN BOOLEAN *On - ); - -/** - Modify the hardware to disallow memory writes in a region. - - This function changes the attributes of a memory range to not allow writ= es. - - @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL i= nstance. - @param Start[in] The beginning of the physical address of t= he region whose - attributes should be modified. - @param Length[in] The number of bytes of memory whose attrib= utes should be modified. - The actual number of bytes modified may be= greater than the number - specified. - @param Granularity[out] The number of bytes in the last region aff= ected. This may be less - than the total number of bytes affected if= the starting address was - not aligned to a region's starting address= or if the length was - greater than the number of bytes in the fi= rst region. - - @retval EFI_SUCCESS The region's attributes were successfully = modified. - @retval EFI_INVALID_PARAMETER If Start or Length describe an address not= in the Legacy Region. - -**/ -EFI_STATUS -EFIAPI -LegacyRegion2Lock ( - IN EFI_LEGACY_REGION2_PROTOCOL *This, - IN UINT32 Start, - IN UINT32 Length, - OUT UINT32 *Granularity - ); - -/** - Modify the hardware to disallow memory attribute changes in a region. - - This function makes the attributes of a region read only. Once a region = is boot-locked with this - function, the read and write attributes of that region cannot be changed= until a power cycle has - reset the boot-lock attribute. Calls to Decode(), Lock() and Unlock() wi= ll have no effect. - - @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL i= nstance. - @param Start[in] The beginning of the physical address of t= he region whose - attributes should be modified. - @param Length[in] The number of bytes of memory whose attrib= utes should be modified. - The actual number of bytes modified may be= greater than the number - specified. - @param Granularity[out] The number of bytes in the last region aff= ected. This may be less - than the total number of bytes affected if= the starting address was - not aligned to a region's starting address= or if the length was - greater than the number of bytes in the fi= rst region. - - @retval EFI_SUCCESS The region's attributes were successfully = modified. - @retval EFI_INVALID_PARAMETER If Start or Length describe an address not= in the Legacy Region. - @retval EFI_UNSUPPORTED The chipset does not support locking the c= onfiguration registers in - a way that will not affect memory regions = outside the legacy memory - region. - -**/ -EFI_STATUS -EFIAPI -LegacyRegion2BootLock ( - IN EFI_LEGACY_REGION2_PROTOCOL *This, - IN UINT32 Start, - IN UINT32 Length, - OUT UINT32 *Granularity - ); - -/** - Modify the hardware to allow memory writes in a region. - - This function changes the attributes of a memory range to allow writes. - - @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL i= nstance. - @param Start[in] The beginning of the physical address of t= he region whose - attributes should be modified. - @param Length[in] The number of bytes of memory whose attrib= utes should be modified. - The actual number of bytes modified may be= greater than the number - specified. - @param Granularity[out] The number of bytes in the last region aff= ected. This may be less - than the total number of bytes affected if= the starting address was - not aligned to a region's starting address= or if the length was - greater than the number of bytes in the fi= rst region. - - @retval EFI_SUCCESS The region's attributes were successfully = modified. - @retval EFI_INVALID_PARAMETER If Start or Length describe an address not= in the Legacy Region. - -**/ -EFI_STATUS -EFIAPI -LegacyRegion2Unlock ( - IN EFI_LEGACY_REGION2_PROTOCOL *This, - IN UINT32 Start, - IN UINT32 Length, - OUT UINT32 *Granularity - ); - -/** - Get region information for the attributes of the Legacy Region. - - This function is used to discover the granularity of the attributes for = the memory in the legacy - region. Each attribute may have a different granularity and the granular= ity may not be the same - for all memory ranges in the legacy region. - - @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL i= nstance. - @param DescriptorCount[out] The number of region descriptor entries re= turned in the Descriptor - buffer. - @param Descriptor[out] A pointer to a pointer used to return a bu= ffer where the legacy - region information is deposited. This buff= er will contain a list of - DescriptorCount number of region descripto= rs. This function will - provide the memory for the buffer. - - @retval EFI_SUCCESS The region's attributes were successfully = modified. - @retval EFI_INVALID_PARAMETER If Start or Length describe an address not= in the Legacy Region. - -**/ -EFI_STATUS -EFIAPI -LegacyRegionGetInfo ( - IN EFI_LEGACY_REGION2_PROTOCOL *This, - OUT UINT32 *DescriptorCount, - OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor - ); - -#endif - diff --git a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.c b/OvmfPkg/Csm/CsmSup= portLib/CsmSupportLib.c deleted file mode 100644 index 533b078593..0000000000 --- a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.c +++ /dev/null @@ -1,32 +0,0 @@ -/** @file - Platform CSM Support Library - - Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "CsmSupportLib.h" - -/** - The constructor function for the platform CSM support library - - @retval EFI_SUCCESS The constructor always returns RETURN_SUCCESS. - -**/ -RETURN_STATUS -EFIAPI -CsmSupportLibConstructor ( - VOID - ) -{ - LegacyRegionInit (); - - LegacyInterruptInstall (); - - LegacyBiosPlatformInstall (); - - return EFI_SUCCESS; -} - diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c b/OvmfPkg/Csm/CsmS= upportLib/LegacyInterrupt.c deleted file mode 100644 index 2928e26329..0000000000 --- a/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c +++ /dev/null @@ -1,214 +0,0 @@ -/** @file - Legacy Interrupt Support - - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "LegacyInterrupt.h" - -// -// Handle for the Legacy Interrupt Protocol instance produced by this driv= er -// -STATIC EFI_HANDLE mLegacyInterruptHandle =3D NULL; - -// -// Legacy Interrupt Device number (0x01 on piix4, 0x1f on q35/mch) -// -STATIC UINT8 mLegacyInterruptDevice; - -// -// The Legacy Interrupt Protocol instance produced by this driver -// -STATIC EFI_LEGACY_INTERRUPT_PROTOCOL mLegacyInterrupt =3D { - GetNumberPirqs, - GetLocation, - ReadPirq, - WritePirq -}; - -STATIC UINT8 PirqReg[MAX_PIRQ_NUMBER] =3D { PIRQA, PIRQB, PIRQC, PIRQD, PI= RQE, PIRQF, PIRQG, PIRQH }; - - -/** - Return the number of PIRQs supported by this chipset. - - @param[in] This Pointer to LegacyInterrupt Protocol - @param[out] NumberPirqs The pointer to return the max IRQ number suppor= ted - - @retval EFI_SUCCESS Max PIRQs successfully returned - -**/ -EFI_STATUS -EFIAPI -GetNumberPirqs ( - IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, - OUT UINT8 *NumberPirqs - ) -{ - *NumberPirqs =3D MAX_PIRQ_NUMBER; - - return EFI_SUCCESS; -} - - -/** - Return PCI location of this device. - $PIR table requires this info. - - @param[in] This - Protocol instance pointer. - @param[out] Bus - PCI Bus - @param[out] Device - PCI Device - @param[out] Function - PCI Function - - @retval EFI_SUCCESS Bus/Device/Function returned - -**/ -EFI_STATUS -EFIAPI -GetLocation ( - IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, - OUT UINT8 *Bus, - OUT UINT8 *Device, - OUT UINT8 *Function - ) -{ - *Bus =3D LEGACY_INT_BUS; - *Device =3D mLegacyInterruptDevice; - *Function =3D LEGACY_INT_FUNC; - - return EFI_SUCCESS; -} - - -/** - Builds the PCI configuration address for the register specified by PirqN= umber - - @param[in] PirqNumber - The PIRQ number to build the PCI configuration = address for - - @return The PCI Configuration address for the PIRQ -**/ -UINTN -GetAddress ( - UINT8 PirqNumber - ) -{ - return PCI_LIB_ADDRESS( - LEGACY_INT_BUS, - mLegacyInterruptDevice, - LEGACY_INT_FUNC, - PirqReg[PirqNumber] - ); -} - -/** - Read the given PIRQ register - - @param[in] This Protocol instance pointer - @param[in] PirqNumber The Pirq register 0 =3D A, 1 =3D B etc - @param[out] PirqData Value read - - @retval EFI_SUCCESS Decoding change affected. - @retval EFI_INVALID_PARAMETER Invalid PIRQ number - -**/ -EFI_STATUS -EFIAPI -ReadPirq ( - IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, - IN UINT8 PirqNumber, - OUT UINT8 *PirqData - ) -{ - if (PirqNumber >=3D MAX_PIRQ_NUMBER) { - return EFI_INVALID_PARAMETER; - } - - *PirqData =3D PciRead8 (GetAddress (PirqNumber)); - *PirqData =3D (UINT8) (*PirqData & 0x7f); - - return EFI_SUCCESS; -} - - -/** - Write the given PIRQ register - - @param[in] This Protocol instance pointer - @param[in] PirqNumber The Pirq register 0 =3D A, 1 =3D B etc - @param[out] PirqData Value to write - - @retval EFI_SUCCESS Decoding change affected. - @retval EFI_INVALID_PARAMETER Invalid PIRQ number - -**/ -EFI_STATUS -EFIAPI -WritePirq ( - IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, - IN UINT8 PirqNumber, - IN UINT8 PirqData - ) -{ - if (PirqNumber >=3D MAX_PIRQ_NUMBER) { - return EFI_INVALID_PARAMETER; - } - - PciWrite8 (GetAddress (PirqNumber), PirqData); - return EFI_SUCCESS; -} - - -/** - Initialize Legacy Interrupt support - - @retval EFI_SUCCESS Successfully initialized - -**/ -EFI_STATUS -LegacyInterruptInstall ( - VOID - ) -{ - UINT16 HostBridgeDevId; - EFI_STATUS Status; - - // - // Make sure the Legacy Interrupt Protocol is not already installed in t= he system - // - ASSERT_PROTOCOL_ALREADY_INSTALLED(NULL, &gEfiLegacyInterruptProtocolGuid= ); - - // - // Query Host Bridge DID to determine platform type, then set device num= ber - // - HostBridgeDevId =3D PcdGet16 (PcdOvmfHostBridgePciDevId); - switch (HostBridgeDevId) { - case INTEL_82441_DEVICE_ID: - mLegacyInterruptDevice =3D LEGACY_INT_DEV_PIIX4; - break; - case INTEL_Q35_MCH_DEVICE_ID: - mLegacyInterruptDevice =3D LEGACY_INT_DEV_Q35; - break; - default: - DEBUG ((EFI_D_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n", - __FUNCTION__, HostBridgeDevId)); - ASSERT (FALSE); - return EFI_UNSUPPORTED; - } - - // - // Make a new handle and install the protocol - // - Status =3D gBS->InstallMultipleProtocolInterfaces ( - &mLegacyInterruptHandle, - &gEfiLegacyInterruptProtocolGuid, - &mLegacyInterrupt, - NULL - ); - ASSERT_EFI_ERROR(Status); - - return Status; -} - diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c b/OvmfPkg/Csm/CsmSu= pportLib/LegacyPlatform.c deleted file mode 100644 index a07bb82da7..0000000000 --- a/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c +++ /dev/null @@ -1,1060 +0,0 @@ -/** @file - Legacy BIOS Platform support - - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "LegacyPlatform.h" - -EFI_SETUP_BBS_MAP mSetupBbsMap[] =3D { - { 1, 2, 1, 1 }, // ATA HardDrive - { 2, 3, 1, 1 }, // ATAPI CDROM - { 3, 0x80, 2, 0 }, // PXE - { 4, 1, 0, 6 }, // USB Floppy - { 4, 2, 0, 6 }, // USB HDD - { 4, 3, 0, 6 }, // USB CD - { 4, 1, 0, 0 }, // USB ZIP Bugbug since Class/SubClass code is u= ninitialized - { 4, 2, 0, 0 } // USB ZIP Bugbug since Class/SubClass code is u= ninitialized -}; - -// -// Global variables for System ROMs -// -#define SYSTEM_ROM_FILE_GUID \ -{ 0x1547B4F3, 0x3E8A, 0x4FEF, { 0x81, 0xC8, 0x32, 0x8E, 0xD6, 0x47, 0xAB, = 0x1A } } - -#define NULL_ROM_FILE_GUID \ -{ 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, = 0x00 } } - -SYSTEM_ROM_TABLE mSystemRomTable[] =3D { - { SYSTEM_ROM_FILE_GUID, 1 }, - { NULL_ROM_FILE_GUID, 0 } -}; - -EFI_HANDLE mVgaHandles[0x20]; -EFI_HANDLE mDiskHandles[0x20]; -EFI_HANDLE mIsaHandles[0x20]; - -EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY IrqPriorityTable[MAX_IRQ_PRIORITY_ENTR= IES] =3D { - {0x0B,0}, - {0x09,0}, - {0x0A,0}, - {0x05,0}, - {0x07,0}, - {0x00,0}, - {0x00,0} -}; - -// -// PIRQ Table -// - Slot numbering will be used to update the bus number and determine br= idge -// to check to get bus number. The Slot number - 1 is an index into a d= ecode -// table to get the bridge information. -// -EFI_LEGACY_PIRQ_TABLE PirqTableHead =3D { - { - EFI_LEGACY_PIRQ_TABLE_SIGNATURE, // UINT32 Signature - 0x00, // UINT8 MinorVersion - 0x01, // UINT8 MajorVersion - 0x0000, // UINT16 TableSize - 0x00, // UINT8 Bus - 0x08, // UINT8 DevFun - 0x0000, // UINT16 PciOnlyIrq - 0x8086, // UINT16 CompatibleVid - 0x122e, // UINT16 CompatibleDid - 0x00000000, // UINT32 Miniport - { // UINT8 Reserved[11] - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00 - }, - 0x00, // UINT8 Checksum - }, - { - // -- Pin 1 -- -- Pin 2 -- -- Pin 3 -- -- Pin 4 -- - // Bus Dev Reg Map Reg Map Reg Map Reg Map - // - {0x00,0x08,{{0x60,0xDEB8},{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8}},0= x00,0x00}, - {0x00,0x10,{{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8},{0x60,0xDEB8}},0= x01,0x00}, - {0x00,0x18,{{0x62,0xDEB8},{0x63,0xDEB8},{0x60,0xDEB8},{0x61,0xDEB8}},0= x02,0x00}, - {0x00,0x20,{{0x63,0xDEB8},{0x60,0xDEB8},{0x61,0xDEB8},{0x62,0xDEB8}},0= x03,0x00}, - {0x00,0x28,{{0x60,0xDEB8},{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8}},0= x04,0x00}, - {0x00,0x30,{{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8},{0x60,0xDEB8}},0= x05,0x00}, - } -}; - -LEGACY_BIOS_PLATFORM_INSTANCE mPrivateData; -EFI_HANDLE mImageHandle =3D NULL; - -/** - Return the handles and assorted information for the specified PCI Class = code - - @param[in] PciClasses Array of PCI_CLASS_RECORD to find terminate= d with ClassCode 0xff - @param[in,out] DeviceTable Table to place handles etc in. - @param[in,out] DeviceIndex Number of devices found - @param[in] DeviceFlags FALSE if a valid legacy ROM is required, TR= UE otherwise. - - @retval EFI_SUCCESS One or more devices found - @retval EFI_NOT_FOUND No device found - -**/ -EFI_STATUS -FindAllDeviceTypes ( - IN PCI_CLASS_RECORD *PciClasses, - IN OUT DEVICE_STRUCTURE *DeviceTable, - IN OUT UINT16 *DeviceIndex, - IN BOOLEAN DeviceFlags - ) -{ - UINTN HandleCount; - EFI_HANDLE *HandleBuffer; - UINTN Index; - UINTN StartIndex; - PCI_TYPE00 PciConfigHeader; - EFI_PCI_IO_PROTOCOL *PciIo; - EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; - UINTN Flags; - EFI_STATUS Status; - UINTN Index2; - - // - // Get legacy BIOS protocol as it is required to deal with Option ROMs. - // - StartIndex =3D *DeviceIndex; - Status =3D gBS->LocateProtocol ( - &gEfiLegacyBiosProtocolGuid, - NULL, - (VOID**)&LegacyBios - ); - ASSERT_EFI_ERROR (Status); - - // - // Get all PCI handles and check them to generate a list of matching dev= ices. - // - gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiPciIoProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer - ); - for (Index =3D 0; Index < HandleCount; Index++) { - gBS->HandleProtocol ( - HandleBuffer[Index], - &gEfiPciIoProtocolGuid, - (VOID**)&PciIo - ); - PciIo->Pci.Read ( - PciIo, - EfiPciIoWidthUint32, - 0, - sizeof (PciConfigHeader) / sizeof (UINT32), - &PciConfigHeader - ); - for (Index2 =3D 0; PciClasses[Index2].Class !=3D 0xff; Index2++) { - if ((PciConfigHeader.Hdr.ClassCode[2] =3D=3D PciClasses[Index2].Cl= ass) && - (PciConfigHeader.Hdr.ClassCode[1] =3D=3D PciClasses[Index2].Su= bClass)) { - LegacyBios->CheckPciRom ( - LegacyBios, - HandleBuffer[Index], - NULL, - NULL, - &Flags - ); - - // - // Verify that results of OPROM check match request. - // The two valid requests are: - // DeviceFlags =3D 0 require a valid legacy ROM - // DeviceFlags =3D 1 require either no ROM or a valid legacy ROM - // - if ( - ((DeviceFlags !=3D 0) && (Flags =3D=3D NO_ROM)) || - ((Flags & (ROM_FOUND | VALID_LEGACY_ROM)) =3D=3D (ROM_FOUND | = VALID_LEGACY_ROM)) - ) { - DeviceTable->Handle =3D HandleBuffer[Index]; - DeviceTable->Vid =3D PciConfigHeader.Hdr.VendorId; - DeviceTable->Did =3D PciConfigHeader.Hdr.DeviceId; - DeviceTable->SvId =3D PciConfigHeader.Device.SubsystemVendorID; - DeviceTable->SysId =3D PciConfigHeader.Device.SubsystemID; - ++ *DeviceIndex; - DeviceTable++; - } - } - } - } - - // - // Free any allocated buffers - // - gBS->FreePool (HandleBuffer); - - if (*DeviceIndex !=3D StartIndex) { - return EFI_SUCCESS; - } else { - return EFI_NOT_FOUND; - } -} - -/** - Load and initialize the Legacy BIOS SMM handler. - - @param This The protocol instance pointer. - @param EfiToLegacy16BootTable A pointer to Legacy16 boot table. - - @retval EFI_SUCCESS SMM code loaded. - @retval EFI_DEVICE_ERROR SMM code failed to load - -**/ -EFI_STATUS -EFIAPI -SmmInit ( - IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This, - IN VOID *EfiToLegacy16BootTable - ) -{ - return EFI_SUCCESS; -} - -/** - Finds the device path that should be used as the primary display adapter. - - @param VgaHandle - The handle of the video device - -**/ -VOID -GetSelectedVgaDeviceInfo ( - OUT EFI_HANDLE *VgaHandle - ) -{ - EFI_STATUS Status; - UINTN HandleCount; - EFI_HANDLE *HandleBuffer; - UINTN Index; - EFI_PCI_IO_PROTOCOL *PciIo; - PCI_TYPE00 Pci; - UINT8 MinBus; - UINT8 MaxBus; - UINTN Segment; - UINTN Bus; - UINTN Device; - UINTN Function; - UINTN SelectedAddress; - UINTN CurrentAddress; - - // - // Initialize return to 'not found' state - // - *VgaHandle =3D NULL; - - // - // Initialize variable states. This is important for selecting the VGA - // device if multiple devices exist behind a single bridge. - // - HandleCount =3D 0; - HandleBuffer =3D NULL; - SelectedAddress =3D PCI_LIB_ADDRESS(0xff, 0x1f, 0x7, 0); - - // - // The bus range to search for a VGA device in. - // - MinBus =3D MaxBus =3D 0; - - // - // Start to check all the pci io to find all possible VGA device - // - HandleCount =3D 0; - HandleBuffer =3D NULL; - Status =3D gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiPciIoProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer - ); - if (EFI_ERROR (Status)) { - return; - } - - for (Index =3D 0; Index < HandleCount; Index++) { - Status =3D gBS->HandleProtocol (HandleBuffer[Index], &gEfiPciIoProtoco= lGuid, (VOID**)&PciIo); - if (!EFI_ERROR (Status)) { - // - // Detemine if this is in the correct bus range. - // - Status =3D PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Func= tion); - if (EFI_ERROR(Status) || (Bus < MinBus || Bus > MaxBus)) { - continue; - } - - // - // Read device information. - // - Status =3D PciIo->Pci.Read ( - PciIo, - EfiPciIoWidthUint32, - 0, - sizeof (Pci) / sizeof (UINT32), - &Pci - ); - if (EFI_ERROR (Status)) { - continue; - } - - // - // Make sure the device is a VGA device. - // - if (!IS_PCI_VGA (&Pci)) { - continue; - } - DEBUG ((EFI_D_INFO, - "PCI VGA: 0x%04x:0x%04x\n", - Pci.Hdr.VendorId, - Pci.Hdr.DeviceId - )); - - // - // Currently we use the lowest numbered bus/device/function if multi= ple - // devices are found in the target bus range. - // - CurrentAddress =3D PCI_LIB_ADDRESS(Bus, Device, Function, 0); - if (CurrentAddress < SelectedAddress) { - SelectedAddress =3D CurrentAddress; - *VgaHandle =3D HandleBuffer[Index]; - } - } - } - - FreePool (HandleBuffer); -} - - -/** - Returns a buffer of handles for the requested subfunction. - - @param This The protocol instance pointer. - @param Mode Specifies what handle to return. See EFI_G= ET_PLATFORM_HANDLE_MODE enum. - @param Type Mode specific. See EFI_GET_PLATFORM_HANDLE= _MODE enum. - @param HandleBuffer Mode specific. See EFI_GET_PLATFORM_HANDLE= _MODE enum. - @param HandleCount Mode specific. See EFI_GET_PLATFORM_HANDLE= _MODE enum. - @param AdditionalData Mode specific. See EFI_GET_PLATFORM_HANDLE= _MODE enum. - - @retval EFI_SUCCESS Handle is valid. - @retval EFI_UNSUPPORTED Mode is not supported on the platform. - @retval EFI_NOT_FOUND Handle is not known. - -**/ -EFI_STATUS -EFIAPI -GetPlatformHandle ( - IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This, - IN EFI_GET_PLATFORM_HANDLE_MODE Mode, - IN UINT16 Type, - OUT EFI_HANDLE **HandleBuffer, - OUT UINTN *HandleCount, - OUT VOID **AdditionalData OPTIONAL - ) -{ - DEVICE_STRUCTURE LocalDevice[0x40]; - UINT32 LocalIndex; - UINT32 Index; - DEVICE_STRUCTURE TempDevice; - EFI_STATUS Status; - EFI_PCI_IO_PROTOCOL *PciIo; - UINTN Segment; - UINTN Bus; - UINTN Device; - UINTN Function; - HDD_INFO *HddInfo; - PCI_TYPE00 PciConfigHeader; - UINT32 HddIndex; - EFI_HANDLE IdeHandle; - EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; - PCI_CLASS_RECORD ClassLists[10]; - UINTN PriorityIndex; - - static BOOLEAN bConnected =3D FALSE; - - LocalIndex =3D 0x00; - HddInfo =3D NULL; - HddIndex =3D 0; - - Status =3D gBS->LocateProtocol ( - &gEfiLegacyBiosProtocolGuid, - NULL, - (VOID**)&LegacyBios - ); - - // - // Process mode specific operations - // - switch (Mode) { - case EfiGetPlatformVgaHandle: - // - // Get the handle for the currently selected VGA device. - // - GetSelectedVgaDeviceInfo (&mVgaHandles[0]); - *HandleBuffer =3D &mVgaHandles[0]; - *HandleCount =3D (mVgaHandles[0] !=3D NULL) ? 1 : 0; - return EFI_SUCCESS; - case EfiGetPlatformIdeHandle: - IdeHandle =3D NULL; - if (AdditionalData !=3D NULL) { - HddInfo =3D (HDD_INFO *) *AdditionalData; - } - - // - // Locate all found block io devices - // - ClassLists[0].Class =3D PCI_CLASS_MASS_STORAGE; - ClassLists[0].SubClass =3D PCI_CLASS_MASS_STORAGE_SCSI; - ClassLists[1].Class =3D PCI_CLASS_MASS_STORAGE; - ClassLists[1].SubClass =3D PCI_CLASS_MASS_STORAGE_IDE; - ClassLists[2].Class =3D PCI_CLASS_MASS_STORAGE; - ClassLists[2].SubClass =3D PCI_CLASS_MASS_STORAGE_RAID; - ClassLists[3].Class =3D PCI_CLASS_MASS_STORAGE; - ClassLists[3].SubClass =3D PCI_CLASS_MASS_STORAGE_SATADPA; - ClassLists[4].Class =3D 0xff; - FindAllDeviceTypes (ClassLists, LocalDevice, (UINT16 *) &LocalIndex,= TRUE); - if (LocalIndex =3D=3D 0) { - return EFI_NOT_FOUND; - } - - // - // Make sure all IDE controllers are connected. This is necessary - // in NO_CONFIG_CHANGE boot path to ensure IDE controller is correct= ly - // initialized and all IDE drives are enumerated - // - if (!bConnected) { - for (Index =3D 0; Index < LocalIndex; Index++) { - gBS->ConnectController (LocalDevice[Index].Handle, NULL, NULL, T= RUE); - } - } - - // - // Locate onboard controllers. - // - for (Index =3D 0; Index < LocalIndex; Index++) { - if (LocalDevice[Index].Vid =3D=3D V_INTEL_VENDOR_ID) { - if (LocalDevice[Index].Did =3D=3D V_PIIX4_IDE_DEVICE_ID) { - IdeHandle =3D LocalDevice[Index].Handle; - } - } - } - - // - // Set the IDE contorller as primary devices. - // - PriorityIndex =3D 0; - for (Index =3D 0; Index < LocalIndex; Index++) { - if (LocalDevice[Index].Handle =3D=3D IdeHandle && PriorityIndex = =3D=3D 0) { - TempDevice =3D LocalDevice[PriorityIndex]; - LocalDevice[PriorityIndex] =3D LocalDevice[Index]; - LocalDevice[Index] =3D TempDevice; - PriorityIndex++; - break; - } - } - - // - // Copy over handles and update return values. - // - for (Index =3D 0; Index < LocalIndex; Index++) { - mDiskHandles[Index] =3D LocalDevice[Index].Handle; - } - *HandleBuffer =3D &mDiskHandles[0]; - *HandleCount =3D LocalIndex; - - // - // We have connected all IDE controllers once. No more needed - // - bConnected =3D TRUE; - - // - // Log all onboard controllers. - // - for (Index =3D 0; (Index < LocalIndex) && (AdditionalData !=3D NULL)= ; Index++) { - if ((LocalDevice[Index].Handle !=3D NULL) && - (LocalDevice[Index].Handle =3D=3D IdeHandle)) { - Status =3D gBS->HandleProtocol ( - LocalDevice[Index].Handle, - &gEfiPciIoProtocolGuid, - (VOID **) &PciIo - ); - PciIo->Pci.Read ( - PciIo, - EfiPciIoWidthUint32, - 0, - sizeof (PciConfigHeader) / sizeof (UINT32), - &PciConfigHeader - ); - if (!EFI_ERROR (Status)) { - PciIo->GetLocation ( - PciIo, - &Segment, - &Bus, - &Device, - &Function - ); - - // - // Be sure to only fill out correct information based on platf= orm - // configureation. - // - HddInfo[HddIndex].Status |=3D HDD_PRIMARY; - HddInfo[HddIndex].Bus =3D (UINT32)Bus; - HddInfo[HddIndex].Device =3D (UINT32)Device; - HddInfo[HddIndex].Function =3D (UINT32)Function; - HddInfo[HddIndex + 1].Status |=3D HDD_SECONDARY; - HddInfo[HddIndex + 1].Bus =3D (UINT32)Bus; - HddInfo[HddIndex + 1].Device =3D (UINT32)Device; - HddInfo[HddIndex + 1].Function =3D (UINT32)Function; - - // - // Primary controller data - // - if ((PciConfigHeader.Hdr.ClassCode[0] & 0x01) !=3D 0) { - HddInfo[HddIndex].CommandBaseAddress =3D - (UINT16)(PciConfigHeader.Device.Bar[0] & 0xfffc); - HddInfo[HddIndex].ControlBaseAddress =3D - (UINT16)((PciConfigHeader.Device.Bar[1] & 0xfffc)+2); - HddInfo[HddIndex].BusMasterAddress =3D - (UINT16)(PciConfigHeader.Device.Bar[4] & 0xfffc); - HddInfo[HddIndex].HddIrq =3D PciConfigHeader.Device.Interrup= tLine; - } else { - HddInfo[HddIndex].HddIrq =3D 14; - HddInfo[HddIndex].CommandBaseAddress =3D 0x1f0; - HddInfo[HddIndex].ControlBaseAddress =3D 0x3f6; - HddInfo[HddIndex].BusMasterAddress =3D 0; - } - HddIndex++; - - // - // Secondary controller data - // - if ((PciConfigHeader.Hdr.ClassCode[0] & 0x04) !=3D 0) { - HddInfo[HddIndex].CommandBaseAddress =3D - (UINT16)(PciConfigHeader.Device.Bar[2] & 0xfffc); - HddInfo[HddIndex].ControlBaseAddress =3D - (UINT16)((PciConfigHeader.Device.Bar[3] & 0xfffc)+2); - HddInfo[HddIndex].BusMasterAddress =3D - (UINT16)(HddInfo[HddIndex].BusMasterAddress + 8); - HddInfo[HddIndex].HddIrq =3D PciConfigHeader.Device.Interrup= tLine; - } else { - HddInfo[HddIndex].HddIrq =3D 15; - HddInfo[HddIndex].CommandBaseAddress =3D 0x170; - HddInfo[HddIndex].ControlBaseAddress =3D 0x376; - HddInfo[HddIndex].BusMasterAddress =3D 0; - } - HddIndex++; - } - } - } - return EFI_SUCCESS; - case EfiGetPlatformIsaBusHandle: - ClassLists[0].Class =3D (UINT8) PCI_CLASS_BRIDGE; - ClassLists[0].SubClass =3D (UINT8) PCI_CLASS_BRIDGE_ISA_PDECODE; - ClassLists[1].Class =3D (UINT8) PCI_CLASS_BRIDGE; - ClassLists[1].SubClass =3D (UINT8) PCI_CLASS_BRIDGE_ISA; - ClassLists[2].Class =3D 0xff; - - // - // Locate all found block io devices - // - FindAllDeviceTypes (ClassLists, LocalDevice, (UINT16 *) (&LocalIndex= ), TRUE); - if (LocalIndex =3D=3D 0) { - return EFI_NOT_FOUND; - } - - // - // Find our ISA bridge. - // - for (Index =3D 0; Index < LocalIndex; Index++) { - if (LocalDevice[Index].Vid =3D=3D V_INTEL_VENDOR_ID) { - TempDevice =3D LocalDevice[0]; - LocalDevice[0] =3D LocalDevice[Index]; - LocalDevice[Index] =3D TempDevice; - } - } - - // - // Perform copy and update return values. - // - for (Index =3D 0; Index < LocalIndex; Index++) { - mIsaHandles[Index] =3D LocalDevice[Index].Handle; - } - *HandleBuffer =3D &mIsaHandles[0]; - *HandleCount =3D LocalIndex; - return EFI_SUCCESS; - case EfiGetPlatformUsbHandle: - default: - return EFI_UNSUPPORTED; - }; -} - -/** - Allows platform to perform any required action after a LegacyBios operat= ion. - Invokes the specific sub function specified by Mode. - - @param This The protocol instance pointer. - @param Mode Specifies what handle to return. See EFI_G= ET_PLATFORM_HOOK_MODE enum. - @param Type Mode specific. See EFI_GET_PLATFORM_HOOK_= MODE enum. - @param DeviceHandle Mode specific. See EFI_GET_PLATFORM_HOOK_= MODE enum. - @param ShadowAddress Mode specific. See EFI_GET_PLATFORM_HOOK_= MODE enum. - @param Compatibility16Table Mode specific. See EFI_GET_PLATFORM_HOOK_= MODE enum. - @param AdditionalData Mode specific. See EFI_GET_PLATFORM_HOOK_= MODE enum. - - @retval EFI_SUCCESS The operation performed successfully. Mode= specific. - @retval EFI_UNSUPPORTED Mode is not supported on the platform. - -**/ -EFI_STATUS -EFIAPI -PlatformHooks ( - IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This, - IN EFI_GET_PLATFORM_HOOK_MODE Mode, - IN UINT16 Type, - OUT EFI_HANDLE DeviceHandle, OPTIONAL - IN OUT UINTN *Shadowaddress, OPTIONAL - IN EFI_COMPATIBILITY16_TABLE *Compatibility16Table, OP= TIONAL - OUT VOID **AdditionalData OPTIONAL - ) -{ - EFI_IA32_REGISTER_SET Regs; - EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; - EFI_STATUS Status; - - switch (Mode) { - case EfiPlatformHookPrepareToScanRom: - Status =3D gBS->LocateProtocol ( - &gEfiLegacyBiosProtocolGuid, - NULL, - (VOID**)&LegacyBios - ); - - // - // Set the 80x25 Text VGA Mode - // - Regs.H.AH =3D 0x00; - Regs.H.AL =3D 0x03; - Status =3D LegacyBios->Int86 (LegacyBios, 0x10, &Regs); - return Status; - case EfiPlatformHookShadowServiceRoms: - return EFI_SUCCESS; - case EfiPlatformHookAfterRomInit: - default: - return EFI_UNSUPPORTED; - }; -} - -/** - Returns information associated with PCI IRQ routing. - This function returns the following information associated with PCI IRQ = routing: - * An IRQ routing table and number of entries in the table. - * The $PIR table and its size. - * A list of PCI IRQs and the priority order to assign them. - - @param This The protocol instance pointer. - @param RoutingTable The pointer to PCI IRQ Routing table. - This location is the $PIR table minus th= e header. - @param RoutingTableEntries The number of entries in table. - @param LocalPirqTable $PIR table. - @param PirqTableSize $PIR table size. - @param LocalIrqPriorityTable A list of interrupts in priority order t= o assign. - @param IrqPriorityTableEntries The number of entries in the priority ta= ble. - - @retval EFI_SUCCESS Data was successfully returned. - -**/ -EFI_STATUS -EFIAPI -GetRoutingTable ( - IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This, - OUT VOID **RoutingTable, - OUT UINTN *RoutingTableEntries, - OUT VOID **LocalPirqTable, OPTION= AL - OUT UINTN *PirqTableSize, OPTIONAL - OUT VOID **LocalIrqPriorityTable,= OPTIONAL - OUT UINTN *IrqPriorityTableEntries= OPTIONAL - ) -{ - UINT16 PTableSize; - UINT32 Index; - UINT8 Bus; - UINT8 Device; - UINT8 Function; - UINT8 Checksum; - UINT8 *Ptr; - EFI_STATUS Status; - EFI_LEGACY_INTERRUPT_PROTOCOL *LegacyInterrupt; - - Checksum =3D 0; - - if (LocalPirqTable !=3D NULL) { - PTableSize =3D sizeof (EFI_LEGACY_PIRQ_TABLE_HEADER) + - sizeof (EFI_LEGACY_IRQ_ROUTING_ENTRY) * MAX_IRQ_ROUTING_E= NTRIES; - - Status =3D gBS->LocateProtocol ( - &gEfiLegacyInterruptProtocolGuid, - NULL, - (VOID**)&LegacyInterrupt - ); - ASSERT_EFI_ERROR (Status); - LegacyInterrupt->GetLocation ( - LegacyInterrupt, - &Bus, - &Device, - &Function - ); - - // - // Update fields in $PIR table header - // - PirqTableHead.PirqTable.TableSize =3D PTableSize; - PirqTableHead.PirqTable.Bus =3D Bus; - PirqTableHead.PirqTable.DevFun =3D (UINT8) ((Device << 3) + Functio= n); - Ptr =3D (UINT8 *) (&PirqTableHead); - - // - // Calculate checksum. - // - for (Index =3D 0; Index < PTableSize; Index++) { - Checksum =3D (UINT8) (Checksum + (UINT8) *Ptr); - Ptr +=3D 1; - } - Checksum =3D (UINT8) (0x00 - Checksum); - PirqTableHead.PirqTable.Checksum =3D Checksum; - - // - // Update return values. - // - *LocalPirqTable =3D (VOID *) (&PirqTableHead); - *PirqTableSize =3D PTableSize; - } - - // - // More items to return. - // - *RoutingTable =3D PirqTableHead.IrqRoutingEntry; - *RoutingTableEntries =3D MAX_IRQ_ROUTING_ENTRIES; - if (LocalIrqPriorityTable !=3D NULL) { - *LocalIrqPriorityTable =3D IrqPriorityTable; - *IrqPriorityTableEntries =3D MAX_IRQ_PRIORITY_ENTRIES; - } - - return EFI_SUCCESS; -} - -/** - Finds the binary data or other platform information. - - @param This The protocol instance pointer. - @param Mode Specifies what data to return. See See EFI= _GET_PLATFORM_INFO_MODE enum. - @param Table Mode specific. See EFI_GET_PLATFORM_INFO_= MODE enum. - @param TableSize Mode specific. See EFI_GET_PLATFORM_INFO_= MODE enum. - @param Location Mode specific. See EFI_GET_PLATFORM_INFO_= MODE enum. - @param Alignment Mode specific. See EFI_GET_PLATFORM_INFO_= MODE enum. - @param LegacySegment Mode specific. See EFI_GET_PLATFORM_INFO_= MODE enum. - @param LegacyOffset Mode specific. See EFI_GET_PLATFORM_INFO_= MODE enum. - - @retval EFI_SUCCESS Data returned successfully. - @retval EFI_UNSUPPORTED Mode is not supported on the platform. - @retval EFI_NOT_FOUND Binary image or table not found. - -**/ -EFI_STATUS -EFIAPI -GetPlatformInfo ( - IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This, - IN EFI_GET_PLATFORM_INFO_MODE Mode, - OUT VOID **Table, - OUT UINTN *TableSize, - OUT UINTN *Location, - OUT UINTN *Alignment, - IN UINT16 LegacySegment, - IN UINT16 LegacyOffset - ) -{ - EFI_STATUS Status; - UINTN Index; - - switch (Mode) { - case EfiGetPlatformBinarySystemRom: - // - // Loop through table of System rom descriptions - // - for (Index =3D 0; mSystemRomTable[Index].Valid !=3D 0; Index++) { - Status =3D GetSectionFromFv ( - &mSystemRomTable[Index].FileName, - EFI_SECTION_RAW, - 0, - Table, - (UINTN *) TableSize - ); - if (EFI_ERROR (Status)) { - continue; - } - return EFI_SUCCESS; - } - - return EFI_NOT_FOUND; - case EfiGetPlatformBinaryOem16Data: - case EfiGetPlatformBinaryMpTable: - case EfiGetPlatformBinaryOemIntData: - case EfiGetPlatformBinaryOem32Data: - case EfiGetPlatformBinaryTpmBinary: - case EfiGetPlatformPciExpressBase: - default: - return EFI_UNSUPPORTED; - }; -} - -/** - Translates the given PIRQ accounting for bridge. - This function translates the given PIRQ back through all buses, if requi= red, - and returns the true PIRQ and associated IRQ. - - @param This The protocol instance pointer. - @param PciBus The PCI bus number for this device. - @param PciDevice The PCI device number for this device. - @param PciFunction The PCI function number for this device. - @param Pirq Input is PIRQ reported by device, and outp= ut is true PIRQ. - @param PciIrq The IRQ already assigned to the PIRQ, or t= he IRQ to be - assigned to the PIRQ. - - @retval EFI_SUCCESS The PIRQ was translated. - -**/ -EFI_STATUS -EFIAPI -TranslatePirq ( - IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This, - IN UINTN PciBus, - IN UINTN PciDevice, - IN UINTN PciFunction, - IN OUT UINT8 *Pirq, - OUT UINT8 *PciIrq - ) -{ - EFI_LEGACY_INTERRUPT_PROTOCOL *LegacyInterrupt; - EFI_STATUS Status; - UINTN Index; - UINTN Index1; - UINT8 LocalPirq; - UINT8 PirqData; - UINT8 MatchData; - - Status =3D gBS->LocateProtocol ( - &gEfiLegacyInterruptProtocolGuid, - NULL, - (VOID**)&LegacyInterrupt - ); - ASSERT_EFI_ERROR (Status); - LocalPirq =3D (UINT8) (*Pirq); - - for (Index =3D 0; Index < MAX_IRQ_ROUTING_ENTRIES; Index++) { - if ((PirqTableHead.IrqRoutingEntry[Index].Bus =3D=3D PciBus) && - (PirqTableHead.IrqRoutingEntry[Index].Device =3D=3D PciDevice)) { - LocalPirq =3D (UINT8) (PirqTableHead.IrqRoutingEntry[Index].PirqEntr= y[LocalPirq].Pirq & 0x0f); - if (LocalPirq > 4) { - LocalPirq -=3D 4; - } - - LegacyInterrupt->ReadPirq (LegacyInterrupt, LocalPirq, &PirqData); - MatchData =3D PCI_UNUSED; - while (PirqData =3D=3D 0) { - for (Index1 =3D 0; Index1 < MAX_IRQ_PRIORITY_ENTRIES; Index1++) { - if ((IrqPriorityTable[Index1].Used =3D=3D MatchData) && - (IrqPriorityTable[Index1].Irq !=3D 0)) { - PirqData =3D IrqPriorityTable[Index1].Irq; - IrqPriorityTable[Index1].Used =3D 0xff; - LegacyInterrupt->WritePirq ( - LegacyInterrupt, - LocalPirq, - PirqData - ); - break; - } - } - - if (PirqData =3D=3D 0) { - - // - // No unused interrpts, so start reusing them. - // - MatchData =3D (UINT8) (~MatchData); - } - } - - *PciIrq =3D PirqData; - *Pirq =3D LocalPirq; - } - } - - return EFI_SUCCESS; -} - - -/** - Attempt to legacy boot the BootOption. If the EFI contexted has been - compromised this function will not return. - - @param This The protocol instance pointer. - @param BbsDevicePath The EFI Device Path from BootXXXX variabl= e. - @param BbsTable The Internal BBS table. - @param LoadOptionSize The size of LoadOption in size. - @param LoadOption The LoadOption from BootXXXX variable - @param EfiToLegacy16BootTable A pointer to BootTable structure - - @retval EFI_SUCCESS Ready to boot. - -**/ -EFI_STATUS -EFIAPI -PrepareToBoot ( - IN EFI_LEGACY_BIOS_PLATFORM_PROTOCOL *This, - IN BBS_BBS_DEVICE_PATH *BbsDevicePath, - IN VOID *BbsTable, - IN UINT32 LoadOptionsSize, - IN VOID *LoadOptions, - IN VOID *EfiToLegacy16BootTable - ) -{ - BBS_TABLE *LocalBbsTable; - EFI_TO_COMPATIBILITY16_BOOT_TABLE *Legacy16BootTable; - DEVICE_PRODUCER_DATA_HEADER *SioPtr; - UINT16 DevicePathType; - UINT16 Index; - UINT16 Priority; - - // - // Initialize values - // - Priority =3D 0; - Legacy16BootTable =3D (EFI_TO_COMPATIBILITY16_BOOT_TABLE*) EfiToLegacy16= BootTable; - - // - // Set how Gate A20 is gated by hardware - // - SioPtr =3D &Legacy16BootTable->SioData; - SioPtr->Flags.A20Kybd =3D 1; - SioPtr->Flags.A20Port90 =3D 1; - SioPtr->MousePresent =3D 1; - - LocalBbsTable =3D BbsTable; - - // - // There are 2 cases that must be covered. - // Case 1: Booting to a legacy OS - BbsDevicePath is non-NULL. - // Case 2: Booting to an EFI aware OS - BbsDevicePath is NULL. - // We need to perform the PrepareToBoot function to assign - // drive numbers to HDD devices to allow the shell or EFI - // to access them. - // - if (BbsDevicePath !=3D NULL) { - DevicePathType =3D BbsDevicePath->DeviceType; - } else { - DevicePathType =3D BBS_HARDDISK; - } - - // - // Skip the boot devices where priority is set by BDS and set the next o= ne - // - for (Index =3D 0; Index < Legacy16BootTable->NumberBbsEntries; Index++) { - if ((LocalBbsTable[Index].BootPriority !=3D BBS_UNPRIORITIZED_ENTRY) && - (LocalBbsTable[Index].BootPriority !=3D BBS_IGNORE_ENTRY) && - (LocalBbsTable[Index].BootPriority !=3D BBS_LOWEST_PRIORITY) && - (Priority <=3D LocalBbsTable[Index].BootPriority)) { - Priority =3D (UINT16) (LocalBbsTable[Index].BootPriority + 1); - } - } - - switch (DevicePathType) { - case BBS_FLOPPY: - case BBS_HARDDISK: - case BBS_CDROM: - case BBS_EMBED_NETWORK: - for (Index =3D 0; Index < Legacy16BootTable->NumberBbsEntries; Index= ++) { - if ((LocalBbsTable[Index].BootPriority =3D=3D BBS_UNPRIORITIZED_EN= TRY) && - (LocalBbsTable[Index].DeviceType =3D=3D DevicePathType)) { - LocalBbsTable[Index].BootPriority =3D Priority; - ++Priority; - } - } - break; - case BBS_BEV_DEVICE: - for (Index =3D 0; Index < Legacy16BootTable->NumberBbsEntries; Index= ++) { - if ((LocalBbsTable[Index].BootPriority =3D=3D BBS_UNPRIORITIZED_EN= TRY) && - (LocalBbsTable[Index].Class =3D=3D 01) && - (LocalBbsTable[Index].SubClass =3D=3D 01)) { - LocalBbsTable[Index].BootPriority =3D Priority; - ++Priority; - } - } - break; - case BBS_USB: - case BBS_PCMCIA: - case BBS_UNKNOWN: - default: - break; - }; - - // - // Set priority for rest of devices - // - for (Index =3D 0; Index < Legacy16BootTable->NumberBbsEntries; Index++) { - if (LocalBbsTable[Index].BootPriority =3D=3D BBS_UNPRIORITIZED_ENTRY) { - LocalBbsTable[Index].BootPriority =3D Priority; - ++Priority; - } - } - - return EFI_SUCCESS; -} - - -/** - Initialize Legacy Platform support - - @retval EFI_SUCCESS Successfully initialized - -**/ -EFI_STATUS -LegacyBiosPlatformInstall ( - VOID - ) -{ - EFI_STATUS Status; - LEGACY_BIOS_PLATFORM_INSTANCE *Private; - - mImageHandle =3D gImageHandle; - Private =3D &mPrivateData; - - // - // Grab a copy of all the protocols we depend on. - // - Private->Signature =3D LEGACY_BIOS_PLATFORM_INSTANCE_SIGNATURE; - Private->LegacyBiosPlatform.GetPlatformInfo =3D GetPlatformInfo; - Private->LegacyBiosPlatform.GetPlatformHandle =3D GetPlatformHandle; - Private->LegacyBiosPlatform.SmmInit =3D SmmInit; - Private->LegacyBiosPlatform.PlatformHooks =3D PlatformHooks; - Private->LegacyBiosPlatform.GetRoutingTable =3D GetRoutingTable; - Private->LegacyBiosPlatform.TranslatePirq =3D TranslatePirq; - Private->LegacyBiosPlatform.PrepareToBoot =3D PrepareToBoot; - Private->ImageHandle =3D gImageHandle; - - // - // Make a new handle and install the protocol - // - Private->Handle =3D NULL; - Status =3D gBS->InstallProtocolInterface ( - &Private->Handle, - &gEfiLegacyBiosPlatformProtocolGuid, - EFI_NATIVE_INTERFACE, - &Private->LegacyBiosPlatform - ); - return Status; -} - diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c b/OvmfPkg/Csm/CsmSupp= ortLib/LegacyRegion.c deleted file mode 100644 index 73276dc228..0000000000 --- a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c +++ /dev/null @@ -1,498 +0,0 @@ -/** @file - Legacy Region Support - - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include "LegacyRegion.h" - -// -// 440/Q35 PAM map. -// -// PAM Range Offset Bits Operation -// 440 Q35 -// =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D =3D=3D=3D= =3D =3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D -// 0xC0000-0xC3FFF 0x5a 0x91 1:0 00 =3D DRAM Disabled, 01=3D Read Onl= y, 10 =3D Write Only, 11 =3D Normal -// 0xC4000-0xC7FFF 0x5a 0x91 5:4 00 =3D DRAM Disabled, 01=3D Read Onl= y, 10 =3D Write Only, 11 =3D Normal -// 0xC8000-0xCBFFF 0x5b 0x92 1:0 00 =3D DRAM Disabled, 01=3D Read Onl= y, 10 =3D Write Only, 11 =3D Normal -// 0xCC000-0xCFFFF 0x5b 0x92 5:4 00 =3D DRAM Disabled, 01=3D Read Onl= y, 10 =3D Write Only, 11 =3D Normal -// 0xD0000-0xD3FFF 0x5c 0x93 1:0 00 =3D DRAM Disabled, 01=3D Read Onl= y, 10 =3D Write Only, 11 =3D Normal -// 0xD4000-0xD7FFF 0x5c 0x93 5:4 00 =3D DRAM Disabled, 01=3D Read Onl= y, 10 =3D Write Only, 11 =3D Normal -// 0xD8000-0xDBFFF 0x5d 0x94 1:0 00 =3D DRAM Disabled, 01=3D Read Onl= y, 10 =3D Write Only, 11 =3D Normal -// 0xDC000-0xDFFFF 0x5d 0x94 5:4 00 =3D DRAM Disabled, 01=3D Read Onl= y, 10 =3D Write Only, 11 =3D Normal -// 0xE0000-0xE3FFF 0x5e 0x95 1:0 00 =3D DRAM Disabled, 01=3D Read Onl= y, 10 =3D Write Only, 11 =3D Normal -// 0xE4000-0xE7FFF 0x5e 0x95 5:4 00 =3D DRAM Disabled, 01=3D Read Onl= y, 10 =3D Write Only, 11 =3D Normal -// 0xE8000-0xEBFFF 0x5f 0x96 1:0 00 =3D DRAM Disabled, 01=3D Read Onl= y, 10 =3D Write Only, 11 =3D Normal -// 0xEC000-0xEFFFF 0x5f 0x96 5:4 00 =3D DRAM Disabled, 01=3D Read Onl= y, 10 =3D Write Only, 11 =3D Normal -// 0xF0000-0xFFFFF 0x59 0x90 5:4 00 =3D DRAM Disabled, 01=3D Read Onl= y, 10 =3D Write Only, 11 =3D Normal -// -STATIC LEGACY_MEMORY_SECTION_INFO mSectionArray[] =3D { - {0xC0000, SIZE_16KB, FALSE, FALSE}, - {0xC4000, SIZE_16KB, FALSE, FALSE}, - {0xC8000, SIZE_16KB, FALSE, FALSE}, - {0xCC000, SIZE_16KB, FALSE, FALSE}, - {0xD0000, SIZE_16KB, FALSE, FALSE}, - {0xD4000, SIZE_16KB, FALSE, FALSE}, - {0xD8000, SIZE_16KB, FALSE, FALSE}, - {0xDC000, SIZE_16KB, FALSE, FALSE}, - {0xE0000, SIZE_16KB, FALSE, FALSE}, - {0xE4000, SIZE_16KB, FALSE, FALSE}, - {0xE8000, SIZE_16KB, FALSE, FALSE}, - {0xEC000, SIZE_16KB, FALSE, FALSE}, - {0xF0000, SIZE_64KB, FALSE, FALSE} -}; - -STATIC PAM_REGISTER_VALUE mRegisterValues440[] =3D { - {PMC_REGISTER_PIIX4 (PIIX4_PAM1), 0x01, 0x02}, - {PMC_REGISTER_PIIX4 (PIIX4_PAM1), 0x10, 0x20}, - {PMC_REGISTER_PIIX4 (PIIX4_PAM2), 0x01, 0x02}, - {PMC_REGISTER_PIIX4 (PIIX4_PAM2), 0x10, 0x20}, - {PMC_REGISTER_PIIX4 (PIIX4_PAM3), 0x01, 0x02}, - {PMC_REGISTER_PIIX4 (PIIX4_PAM3), 0x10, 0x20}, - {PMC_REGISTER_PIIX4 (PIIX4_PAM4), 0x01, 0x02}, - {PMC_REGISTER_PIIX4 (PIIX4_PAM4), 0x10, 0x20}, - {PMC_REGISTER_PIIX4 (PIIX4_PAM5), 0x01, 0x02}, - {PMC_REGISTER_PIIX4 (PIIX4_PAM5), 0x10, 0x20}, - {PMC_REGISTER_PIIX4 (PIIX4_PAM6), 0x01, 0x02}, - {PMC_REGISTER_PIIX4 (PIIX4_PAM6), 0x10, 0x20}, - {PMC_REGISTER_PIIX4 (PIIX4_PAM0), 0x10, 0x20} -}; - -STATIC PAM_REGISTER_VALUE mRegisterValuesQ35[] =3D { - {DRAMC_REGISTER_Q35 (MCH_PAM1), 0x01, 0x02}, - {DRAMC_REGISTER_Q35 (MCH_PAM1), 0x10, 0x20}, - {DRAMC_REGISTER_Q35 (MCH_PAM2), 0x01, 0x02}, - {DRAMC_REGISTER_Q35 (MCH_PAM2), 0x10, 0x20}, - {DRAMC_REGISTER_Q35 (MCH_PAM3), 0x01, 0x02}, - {DRAMC_REGISTER_Q35 (MCH_PAM3), 0x10, 0x20}, - {DRAMC_REGISTER_Q35 (MCH_PAM4), 0x01, 0x02}, - {DRAMC_REGISTER_Q35 (MCH_PAM4), 0x10, 0x20}, - {DRAMC_REGISTER_Q35 (MCH_PAM5), 0x01, 0x02}, - {DRAMC_REGISTER_Q35 (MCH_PAM5), 0x10, 0x20}, - {DRAMC_REGISTER_Q35 (MCH_PAM6), 0x01, 0x02}, - {DRAMC_REGISTER_Q35 (MCH_PAM6), 0x10, 0x20}, - {DRAMC_REGISTER_Q35 (MCH_PAM0), 0x10, 0x20} -}; - -STATIC PAM_REGISTER_VALUE *mRegisterValues; - -// -// Handle used to install the Legacy Region Protocol -// -STATIC EFI_HANDLE mHandle =3D NULL; - -// -// Instance of the Legacy Region Protocol to install into the handle datab= ase -// -STATIC EFI_LEGACY_REGION2_PROTOCOL mLegacyRegion2 =3D { - LegacyRegion2Decode, - LegacyRegion2Lock, - LegacyRegion2BootLock, - LegacyRegion2Unlock, - LegacyRegionGetInfo -}; - -STATIC -EFI_STATUS -LegacyRegionManipulationInternal ( - IN UINT32 Start, - IN UINT32 Length, - IN BOOLEAN *ReadEnable, - IN BOOLEAN *WriteEnable, - OUT UINT32 *Granularity - ) -{ - UINT32 EndAddress; - UINTN Index; - UINTN StartIndex; - - // - // Validate input parameters. - // - if (Length =3D=3D 0 || Granularity =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } - EndAddress =3D Start + Length - 1; - if ((Start < PAM_BASE_ADDRESS) || EndAddress > PAM_LIMIT_ADDRESS) { - return EFI_INVALID_PARAMETER; - } - - // - // Loop to find the start PAM. - // - StartIndex =3D 0; - for (Index =3D 0; Index < ARRAY_SIZE (mSectionArray); Index++) { - if ((Start >=3D mSectionArray[Index].Start) && (Start < (mSectionArray= [Index].Start + mSectionArray[Index].Length))) { - StartIndex =3D Index; - break; - } - } - ASSERT (Index < ARRAY_SIZE (mSectionArray)); - - // - // Program PAM until end PAM is encountered - // - for (Index =3D StartIndex; Index < ARRAY_SIZE (mSectionArray); Index++) { - if (ReadEnable !=3D NULL) { - if (*ReadEnable) { - PciOr8 ( - mRegisterValues[Index].PAMRegPciLibAddress, - mRegisterValues[Index].ReadEnableData - ); - } else { - PciAnd8 ( - mRegisterValues[Index].PAMRegPciLibAddress, - (UINT8) (~mRegisterValues[Index].ReadEnableData) - ); - } - } - if (WriteEnable !=3D NULL) { - if (*WriteEnable) { - PciOr8 ( - mRegisterValues[Index].PAMRegPciLibAddress, - mRegisterValues[Index].WriteEnableData - ); - } else { - PciAnd8 ( - mRegisterValues[Index].PAMRegPciLibAddress, - (UINT8) (~mRegisterValues[Index].WriteEnableData) - ); - } - } - - // - // If the end PAM is encountered, record its length as granularity and= jump out. - // - if ((EndAddress >=3D mSectionArray[Index].Start) && (EndAddress < (mSe= ctionArray[Index].Start + mSectionArray[Index].Length))) { - *Granularity =3D mSectionArray[Index].Length; - break; - } - } - ASSERT (Index < ARRAY_SIZE (mSectionArray)); - - return EFI_SUCCESS; -} - -STATIC -EFI_STATUS -LegacyRegionGetInfoInternal ( - OUT UINT32 *DescriptorCount, - OUT LEGACY_MEMORY_SECTION_INFO **Descriptor - ) -{ - UINTN Index; - UINT8 PamValue; - - // - // Check input parameters - // - if (DescriptorCount =3D=3D NULL || Descriptor =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } - - // - // Fill in current status of legacy region. - // - *DescriptorCount =3D sizeof(mSectionArray) / sizeof (mSectionArray[0]); - for (Index =3D 0; Index < *DescriptorCount; Index++) { - PamValue =3D PciRead8 (mRegisterValues[Index].PAMRegPciLibAddress); - mSectionArray[Index].ReadEnabled =3D FALSE; - if ((PamValue & mRegisterValues[Index].ReadEnableData) !=3D 0) { - mSectionArray[Index].ReadEnabled =3D TRUE; - } - mSectionArray[Index].WriteEnabled =3D FALSE; - if ((PamValue & mRegisterValues[Index].WriteEnableData) !=3D 0) { - mSectionArray[Index].WriteEnabled =3D TRUE; - } - } - - *Descriptor =3D mSectionArray; - return EFI_SUCCESS; -} - -/** - Modify the hardware to allow (decode) or disallow (not decode) memory re= ads in a region. - - If the On parameter evaluates to TRUE, this function enables memory read= s in the address range - Start to (Start + Length - 1). - If the On parameter evaluates to FALSE, this function disables memory re= ads in the address range - Start to (Start + Length - 1). - - @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL i= nstance. - @param Start[in] The beginning of the physical address of t= he region whose attributes - should be modified. - @param Length[in] The number of bytes of memory whose attrib= utes should be modified. - The actual number of bytes modified may be= greater than the number - specified. - @param Granularity[out] The number of bytes in the last region aff= ected. This may be less - than the total number of bytes affected if= the starting address - was not aligned to a region's starting add= ress or if the length - was greater than the number of bytes in th= e first region. - @param On[in] Decode / Non-Decode flag. - - @retval EFI_SUCCESS The region's attributes were successfully = modified. - @retval EFI_INVALID_PARAMETER If Start or Length describe an address not= in the Legacy Region. - -**/ -EFI_STATUS -EFIAPI -LegacyRegion2Decode ( - IN EFI_LEGACY_REGION2_PROTOCOL *This, - IN UINT32 Start, - IN UINT32 Length, - OUT UINT32 *Granularity, - IN BOOLEAN *On - ) -{ - return LegacyRegionManipulationInternal (Start, Length, On, NULL, Granul= arity); -} - - -/** - Modify the hardware to disallow memory attribute changes in a region. - - This function makes the attributes of a region read only. Once a region = is boot-locked with this - function, the read and write attributes of that region cannot be changed= until a power cycle has - reset the boot-lock attribute. Calls to Decode(), Lock() and Unlock() wi= ll have no effect. - - @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL i= nstance. - @param Start[in] The beginning of the physical address of t= he region whose - attributes should be modified. - @param Length[in] The number of bytes of memory whose attrib= utes should be modified. - The actual number of bytes modified may be= greater than the number - specified. - @param Granularity[out] The number of bytes in the last region aff= ected. This may be less - than the total number of bytes affected if= the starting address was - not aligned to a region's starting address= or if the length was - greater than the number of bytes in the fi= rst region. - - @retval EFI_SUCCESS The region's attributes were successfully = modified. - @retval EFI_INVALID_PARAMETER If Start or Length describe an address not= in the Legacy Region. - @retval EFI_UNSUPPORTED The chipset does not support locking the c= onfiguration registers in - a way that will not affect memory regions = outside the legacy memory - region. - -**/ -EFI_STATUS -EFIAPI -LegacyRegion2BootLock ( - IN EFI_LEGACY_REGION2_PROTOCOL *This, - IN UINT32 Start, - IN UINT32 Length, - OUT UINT32 *Granularity - ) -{ - if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) { - return EFI_INVALID_PARAMETER; - } - - return EFI_UNSUPPORTED; -} - - -/** - Modify the hardware to disallow memory writes in a region. - - This function changes the attributes of a memory range to not allow writ= es. - - @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL i= nstance. - @param Start[in] The beginning of the physical address of t= he region whose - attributes should be modified. - @param Length[in] The number of bytes of memory whose attrib= utes should be modified. - The actual number of bytes modified may be= greater than the number - specified. - @param Granularity[out] The number of bytes in the last region aff= ected. This may be less - than the total number of bytes affected if= the starting address was - not aligned to a region's starting address= or if the length was - greater than the number of bytes in the fi= rst region. - - @retval EFI_SUCCESS The region's attributes were successfully = modified. - @retval EFI_INVALID_PARAMETER If Start or Length describe an address not= in the Legacy Region. - -**/ -EFI_STATUS -EFIAPI -LegacyRegion2Lock ( - IN EFI_LEGACY_REGION2_PROTOCOL *This, - IN UINT32 Start, - IN UINT32 Length, - OUT UINT32 *Granularity - ) -{ - BOOLEAN WriteEnable; - - WriteEnable =3D FALSE; - return LegacyRegionManipulationInternal (Start, Length, NULL, &WriteEnab= le, Granularity); -} - - -/** - Modify the hardware to allow memory writes in a region. - - This function changes the attributes of a memory range to allow writes. - - @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL i= nstance. - @param Start[in] The beginning of the physical address of t= he region whose - attributes should be modified. - @param Length[in] The number of bytes of memory whose attrib= utes should be modified. - The actual number of bytes modified may be= greater than the number - specified. - @param Granularity[out] The number of bytes in the last region aff= ected. This may be less - than the total number of bytes affected if= the starting address was - not aligned to a region's starting address= or if the length was - greater than the number of bytes in the fi= rst region. - - @retval EFI_SUCCESS The region's attributes were successfully = modified. - @retval EFI_INVALID_PARAMETER If Start or Length describe an address not= in the Legacy Region. - -**/ -EFI_STATUS -EFIAPI -LegacyRegion2Unlock ( - IN EFI_LEGACY_REGION2_PROTOCOL *This, - IN UINT32 Start, - IN UINT32 Length, - OUT UINT32 *Granularity - ) -{ - BOOLEAN WriteEnable; - - WriteEnable =3D TRUE; - return LegacyRegionManipulationInternal (Start, Length, NULL, &WriteEnab= le, Granularity); -} - -/** - Get region information for the attributes of the Legacy Region. - - This function is used to discover the granularity of the attributes for = the memory in the legacy - region. Each attribute may have a different granularity and the granular= ity may not be the same - for all memory ranges in the legacy region. - - @param This[in] Indicates the EFI_LEGACY_REGION_PROTOCOL i= nstance. - @param DescriptorCount[out] The number of region descriptor entries re= turned in the Descriptor - buffer. - @param Descriptor[out] A pointer to a pointer used to return a bu= ffer where the legacy - region information is deposited. This buff= er will contain a list of - DescriptorCount number of region descripto= rs. This function will - provide the memory for the buffer. - - @retval EFI_SUCCESS The region's attributes were successfully = modified. - @retval EFI_INVALID_PARAMETER If Start or Length describe an address not= in the Legacy Region. - -**/ -EFI_STATUS -EFIAPI -LegacyRegionGetInfo ( - IN EFI_LEGACY_REGION2_PROTOCOL *This, - OUT UINT32 *DescriptorCount, - OUT EFI_LEGACY_REGION_DESCRIPTOR **Descriptor - ) -{ - LEGACY_MEMORY_SECTION_INFO *SectionInfo; - UINT32 SectionCount; - EFI_LEGACY_REGION_DESCRIPTOR *DescriptorArray; - UINTN Index; - UINTN DescriptorIndex; - - // - // Get section numbers and information - // - LegacyRegionGetInfoInternal (&SectionCount, &SectionInfo); - - // - // Each section has 3 descriptors, corresponding to readability, writeab= ility, and lock status. - // - DescriptorArray =3D AllocatePool (sizeof (EFI_LEGACY_REGION_DESCRIPTOR) = * SectionCount * 3); - if (DescriptorArray =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - DescriptorIndex =3D 0; - for (Index =3D 0; Index < SectionCount; Index++) { - DescriptorArray[DescriptorIndex].Start =3D SectionInfo[Index].St= art; - DescriptorArray[DescriptorIndex].Length =3D SectionInfo[Index].Le= ngth; - DescriptorArray[DescriptorIndex].Granularity =3D SectionInfo[Index].Le= ngth; - if (SectionInfo[Index].ReadEnabled) { - DescriptorArray[DescriptorIndex].Attribute =3D LegacyRegionDecoded; - } else { - DescriptorArray[DescriptorIndex].Attribute =3D LegacyRegionNotDeco= ded; - } - DescriptorIndex++; - - // - // Create descriptor for writeability, according to lock status - // - DescriptorArray[DescriptorIndex].Start =3D SectionInfo[Index].St= art; - DescriptorArray[DescriptorIndex].Length =3D SectionInfo[Index].Le= ngth; - DescriptorArray[DescriptorIndex].Granularity =3D SectionInfo[Index].Le= ngth; - if (SectionInfo[Index].WriteEnabled) { - DescriptorArray[DescriptorIndex].Attribute =3D LegacyRegionWriteEnab= led; - } else { - DescriptorArray[DescriptorIndex].Attribute =3D LegacyRegionWriteDisa= bled; - } - DescriptorIndex++; - - // - // Chipset does not support bootlock. - // - DescriptorArray[DescriptorIndex].Start =3D SectionInfo[Index].St= art; - DescriptorArray[DescriptorIndex].Length =3D SectionInfo[Index].Le= ngth; - DescriptorArray[DescriptorIndex].Granularity =3D SectionInfo[Index].Le= ngth; - DescriptorArray[DescriptorIndex].Attribute =3D LegacyRegionNotLocked; - DescriptorIndex++; - } - - *DescriptorCount =3D (UINT32) DescriptorIndex; - *Descriptor =3D DescriptorArray; - - return EFI_SUCCESS; -} - -/** - Initialize Legacy Region support - - @retval EFI_SUCCESS Successfully initialized - -**/ -EFI_STATUS -LegacyRegionInit ( - VOID - ) -{ - EFI_STATUS Status; - UINT16 HostBridgeDevId; - - // - // Query Host Bridge DID to determine platform type - // - HostBridgeDevId =3D PcdGet16 (PcdOvmfHostBridgePciDevId); - switch (HostBridgeDevId) { - case INTEL_82441_DEVICE_ID: - mRegisterValues =3D mRegisterValues440; - break; - case INTEL_Q35_MCH_DEVICE_ID: - mRegisterValues =3D mRegisterValuesQ35; - break; - default: - DEBUG ((EFI_D_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n", - __FUNCTION__, HostBridgeDevId)); - ASSERT (FALSE); - return RETURN_UNSUPPORTED; - } - - // - // Install the Legacy Region Protocol on a new handle - // - Status =3D gBS->InstallMultipleProtocolInterfaces ( - &mHandle, - &gEfiLegacyRegion2ProtocolGuid, &mLegacyRegion2, - NULL - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - diff --git a/OvmfPkg/Csm/Csm16/ReadMe.txt b/OvmfPkg/Csm/Csm16/ReadMe.txt deleted file mode 100644 index 4d5d086bb4..0000000000 --- a/OvmfPkg/Csm/Csm16/ReadMe.txt +++ /dev/null @@ -1,12 +0,0 @@ -This module allows a CSM16 binary to be easily included -in the OVMF.fd output file. - -=3D=3D=3D How to use Csm16.inf =3D=3D=3D - -1. Copy the CSM16 binary to OvmfPkg/Csm/Csm16/Csm16.bin -2. Build OVMF with CSM_ENABLE defined. - - For example: - * build -D CSM_ENABLE, or - * OvmfPkg/build.sh -D CSM_ENABLE - --=20 2.12.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#42144): https://edk2.groups.io/g/devel/message/42144 Mute This Topic: https://groups.io/mt/32011737/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-