Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F28485903
fwcfg_v02.patch
corvink (Corvin Köhne)
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
corvink
Sep 10 2021, 12:33 PM
2021-09-10 12:33:53 (UTC+0)
Size
86 KB
Referenced Files
None
Subscribers
None
fwcfg_v02.patch
View Options
diff --git a/.azurepipelines/templates/pr-gate-build-job.yml b/.azurepipelines/templates/pr-gate-build-job.yml
index d5b16c127f..207acc7631 100644
--- a/.azurepipelines/templates/pr-gate-build-job.yml
+++ b/.azurepipelines/templates/pr-gate-build-job.yml
@@ -48,9 +48,6 @@ jobs:
TARGET_SECURITY:
Build.Pkgs: 'SecurityPkg'
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
- TARGET_UEFIPAYLOAD:
- Build.Pkgs: 'UefiPayloadPkg'
- Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
TARGET_PLATFORMS:
# For Platforms only check code. Leave it to Platform CI
# to build them.
diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py
index ce330e2c73..96e6baa519 100644
--- a/.pytool/CISettings.py
+++ b/.pytool/CISettings.py
@@ -67,8 +67,7 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag
"CryptoPkg",
"UnitTestFrameworkPkg",
"OvmfPkg",
- "RedfishPkg",
- "UefiPayloadPkg"
+ "RedfishPkg"
)
def GetArchitecturesSupported(self):
diff --git a/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c b/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c
index fa515d1a01..85ee4c87b6 100644
--- a/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c
+++ b/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c
@@ -344,6 +344,10 @@ GicV3ExitBootServicesEvent (
GicV3DisableInterruptSource (&gHardwareInterruptV3Protocol, Index);
}
+ for (Index = 0; Index < mGicNumInterrupts; Index++) {
+ GicV3EndOfInterrupt (&gHardwareInterruptV3Protocol, Index);
+ }
+
// Disable Gic Interface
ArmGicV3DisableInterruptInterface ();
diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
index 1e4020487a..5ceb23d822 100644
--- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -2,10 +2,9 @@
Implementation for PlatformBootManagerLib library class interfaces.
Copyright (C) 2015-2016, Red Hat, Inc.
- Copyright (c) 2014 - 2021, ARM Ltd. All rights reserved.<BR>
+ Copyright (c) 2014 - 2019, ARM Ltd. All rights reserved.<BR>
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
- Copyright (c) 2021, Semihalf All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -20,7 +19,6 @@
#include <Library/UefiBootManagerLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Protocol/BootManagerPolicy.h>
#include <Protocol/DevicePath.h>
#include <Protocol/EsrtManagement.h>
#include <Protocol/GraphicsOutput.h>
@@ -29,7 +27,6 @@
#include <Protocol/PciIo.h>
#include <Protocol/PciRootBridgeIo.h>
#include <Protocol/PlatformBootManager.h>
-#include <Guid/BootDiscoveryPolicy.h>
#include <Guid/EventGroup.h>
#include <Guid/NonDiscoverableDevice.h>
#include <Guid/TtyTerm.h>
@@ -706,113 +703,6 @@ HandleCapsules (
#define VERSION_STRING_PREFIX L"Tianocore/EDK2 firmware version "
-/**
- This functions checks the value of BootDiscoverPolicy variable and
- connect devices of class specified by that variable. Then it refreshes
- Boot order for newly discovered boot device.
-
- @retval EFI_SUCCESS Devices connected successfully or connection
- not required.
- @retval others Return values from GetVariable(), LocateProtocol()
- and ConnectDeviceClass().
-**/
-STATIC
-EFI_STATUS
-BootDiscoveryPolicyHandler (
- VOID
- )
-{
- EFI_STATUS Status;
- UINT32 DiscoveryPolicy;
- UINT32 DiscoveryPolicyOld;
- UINTN Size;
- EFI_BOOT_MANAGER_POLICY_PROTOCOL *BMPolicy;
- EFI_GUID *Class;
-
- Size = sizeof (DiscoveryPolicy);
- Status = gRT->GetVariable (
- BOOT_DISCOVERY_POLICY_VAR,
- &gBootDiscoveryPolicyMgrFormsetGuid,
- NULL,
- &Size,
- &DiscoveryPolicy
- );
- if (Status == EFI_NOT_FOUND) {
- DiscoveryPolicy = PcdGet32 (PcdBootDiscoveryPolicy);
- Status = PcdSet32S (PcdBootDiscoveryPolicy, DiscoveryPolicy);
- if (Status == EFI_NOT_FOUND) {
- return EFI_SUCCESS;
- } else if (EFI_ERROR (Status)) {
- return Status;
- }
- } else if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (DiscoveryPolicy == BDP_CONNECT_MINIMAL) {
- return EFI_SUCCESS;
- }
-
- switch (DiscoveryPolicy) {
- case BDP_CONNECT_NET:
- Class = &gEfiBootManagerPolicyNetworkGuid;
- break;
- case BDP_CONNECT_ALL:
- Class = &gEfiBootManagerPolicyConnectAllGuid;
- break;
- default:
- DEBUG ((
- DEBUG_INFO,
- "%a - Unexpected DiscoveryPolicy (0x%x). Run Minimal Discovery Policy\n",
- __FUNCTION__,
- DiscoveryPolicy
- ));
- return EFI_SUCCESS;
- }
-
- Status = gBS->LocateProtocol (
- &gEfiBootManagerPolicyProtocolGuid,
- NULL,
- (VOID **)&BMPolicy
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_INFO, "%a - Failed to locate gEfiBootManagerPolicyProtocolGuid."
- "Driver connect will be skipped.\n", __FUNCTION__));
- return Status;
- }
-
- Status = BMPolicy->ConnectDeviceClass (BMPolicy, Class);
- if (EFI_ERROR (Status)){
- DEBUG ((DEBUG_ERROR, "%a - ConnectDeviceClass returns - %r\n", __FUNCTION__, Status));
- return Status;
- }
-
- //
- // Refresh Boot Options if Boot Discovery Policy has been changed
- //
- Size = sizeof (DiscoveryPolicyOld);
- Status = gRT->GetVariable (
- BOOT_DISCOVERY_POLICY_OLD_VAR,
- &gBootDiscoveryPolicyMgrFormsetGuid,
- NULL,
- &Size,
- &DiscoveryPolicyOld
- );
- if ((Status == EFI_NOT_FOUND) || (DiscoveryPolicyOld != DiscoveryPolicy)) {
- EfiBootManagerRefreshAllBootOption ();
-
- Status = gRT->SetVariable (
- BOOT_DISCOVERY_POLICY_OLD_VAR,
- &gBootDiscoveryPolicyMgrFormsetGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
- sizeof (DiscoveryPolicyOld),
- &DiscoveryPolicy
- );
- }
-
- return EFI_SUCCESS;
-}
-
/**
Do the platform specific action after the console is ready
Possible things that can be done in PlatformBootManagerAfterConsole:
@@ -863,12 +753,6 @@ PlatformBootManagerAfterConsole (
}
}
- //
- // Connect device specified by BootDiscoverPolicy variable and
- // refresh Boot order for newly discovered boot devices
- //
- BootDiscoveryPolicyHandler ();
-
//
// On ARM, there is currently no reason to use the phased capsule
// update approach where some capsules are dispatched before EndOfDxe
diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 86751b45f8..353d7a967b 100644
--- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -65,15 +65,11 @@
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
- gEfiMdeModulePkgTokenSpaceGuid.PcdBootDiscoveryPolicy
[Guids]
- gBootDiscoveryPolicyMgrFormsetGuid
gEdkiiNonDiscoverableEhciDeviceGuid
gEdkiiNonDiscoverableUhciDeviceGuid
gEdkiiNonDiscoverableXhciDeviceGuid
- gEfiBootManagerPolicyNetworkGuid
- gEfiBootManagerPolicyConnectAllGuid
gEfiFileInfoGuid
gEfiFileSystemInfoGuid
gEfiFileSystemVolumeLabelInfoIdGuid
@@ -83,7 +79,6 @@
[Protocols]
gEdkiiNonDiscoverableDeviceProtocolGuid
- gEfiBootManagerPolicyProtocolGuid
gEfiDevicePathProtocolGuid
gEfiGraphicsOutputProtocolGuid
gEfiLoadedImageProtocolGuid
diff --git a/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py b/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py
index 680b90e09d..008c7d7a16 100644
--- a/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py
+++ b/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py
@@ -807,12 +807,12 @@ class application(tkinter.Frame):
self.page_id = ''
self.page_list = {}
self.conf_list = {}
- self.cfg_page_dict = {}
self.cfg_data_obj = None
self.org_cfg_data_bin = None
self.in_left = state()
self.in_right = state()
self.search_text = ''
+ self.binseg_dict = {}
# Check if current directory contains a file with a .yaml extension
# if not default self.last_dir to a Platform directory where it is
@@ -1009,17 +1009,10 @@ class application(tkinter.Frame):
return visible
if self.cfg_data_obj.binseg_dict:
str_split = item['path'].split('.')
- if str_split[-2] not in CGenYamlCfg.available_fv and \
- str_split[-2] not in CGenYamlCfg.missing_fv:
- if self.cfg_data_obj.binseg_dict[str_split[-3]] == -1:
- visible = False
- widget.grid_remove()
- return visible
- else:
- if self.cfg_data_obj.binseg_dict[str_split[-2]] == -1:
- visible = False
- widget.grid_remove()
- return visible
+ if self.cfg_data_obj.binseg_dict[str_split[-2]] == -1:
+ visible = False
+ widget.grid_remove()
+ return visible
result = 1
if item['condition']:
result = self.evaluate_condition(item)
@@ -1378,34 +1371,8 @@ class application(tkinter.Frame):
self.clear_widgets_inLayout()
self.on_config_page_select_change(None)
- def set_config_data_page(self):
- page_id_list = []
- for idx, page in enumerate(
- self.cfg_data_obj._cfg_page['root']['child']):
- page_id_list.append(list(page.keys())[0])
- page_list = self.cfg_data_obj.get_cfg_list(page_id_list[idx])
- self.cfg_page_dict[page_id_list[idx]] = 0
- for item in page_list:
- str_split = item['path'].split('.')
- if str_split[-2] not in CGenYamlCfg.available_fv and \
- str_split[-2] not in CGenYamlCfg.missing_fv:
- if self.cfg_data_obj.binseg_dict[str_split[-3]] != -1:
- self.cfg_page_dict[page_id_list[idx]] += 1
- else:
- if self.cfg_data_obj.binseg_dict[str_split[-2]] != -1:
- self.cfg_page_dict[page_id_list[idx]] += 1
- removed_page = 0
- for idx, id in enumerate(page_id_list):
- if self.cfg_page_dict[id] == 0:
- del self.cfg_data_obj._cfg_page['root']['child'][idx-removed_page] # noqa: E501
- removed_page += 1
-
def reload_config_data_from_bin(self, bin_dat):
self.cfg_data_obj.load_default_from_bin(bin_dat)
- self.set_config_data_page()
- self.left.delete(*self.left.get_children())
- self.build_config_page_tree(self.cfg_data_obj.get_cfg_page()['root'],
- '')
self.refresh_config_data_page()
def set_config_item_value(self, item, value_str):
diff --git a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py b/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py
index b593885807..611a9a9c72 100644
--- a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py
+++ b/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py
@@ -13,7 +13,6 @@ import string
import operator as op
import ast
import tkinter.messagebox as messagebox
-import tkinter
from datetime import date
from collections import OrderedDict
@@ -584,6 +583,7 @@ class CGenYamlCfg:
self._mode = ''
self._debug = False
self._macro_dict = {}
+ self.bin_offset = []
self.binseg_dict = {}
self.initialize()
@@ -1046,7 +1046,6 @@ option format '%s' !" % option)
try:
value = self.reformat_value_str(act_cfg['value'],
act_cfg['length'])
-
except Exception:
value = act_cfg['value']
length = bit_len // 8
@@ -1299,85 +1298,18 @@ option format '%s' !" % option)
self.traverse_cfg_tree(_get_field_value, top)
return result
- data_diff = ''
-
- def find_data_difference(self, act_val, act_cfg):
- # checks for any difference between BSF and Binary file
- config_val = ''
- if act_val != act_cfg['value']:
-
- if 'DEC' in act_cfg['type']:
- bsf_val = '0x%x' % int(act_val)
- if bsf_val != act_cfg['value']:
- config_val = bsf_val
- else:
- config_val = ''
- else:
- config_val = act_val
-
- available_fv1 = 'none'
- available_fv2 = 'none'
-
- if self.detect_fsp():
- if len(self.available_fv) >= 1:
- if len(self.available_fv) > 1:
- available_fv1 = self.available_fv[1]
- if self.available_fv[2]:
- available_fv2 = self.available_fv[2]
- else:
- available_fv1 = self.available_fv[1]
- if act_cfg['length'] == 16:
- config_val = int(config_val, 16)
- config_val = '0x%x' % config_val
- act_cfg['value'] = int(
- act_cfg['value'], 16)
- act_cfg['value'] = '0x%x' % \
- act_cfg['value']
-
- if config_val:
- string = ('.' + act_cfg['cname'])
- if (act_cfg['path'].endswith(self.available_fv[0] + string)
- or act_cfg['path'].endswith(available_fv1 + string)
- or act_cfg['path'].endswith(available_fv2 + string)) \
- and 'BsfSkip' not in act_cfg['cname'] \
- and 'Reserved' not in act_cfg['name']:
- if act_cfg['option'] != '':
- if act_cfg['length'] == 8:
- config_val = int(config_val, 16)
- config_val = '0x%x' % config_val
- act_cfg['value'] = int(
- act_cfg['value'], 16)
- act_cfg['value'] = '0x%x' % \
- act_cfg['value']
- option = act_cfg['option']
-
- cfg_val = ''
- bin_val = ''
- for i in option.split(','):
- if act_cfg['value'] in i:
- bin_val = i
- elif config_val in i:
- cfg_val = i
- if cfg_val != '' and bin_val != '':
- self.data_diff += '\n\nBinary: ' \
- + act_cfg['name'] \
- + ': ' + bin_val.replace(' ', '') \
- + '\nConfig file: ' \
- + act_cfg['name'] + ': ' \
- + cfg_val.replace(' ', '') + '\n'
- else:
- self.data_diff += '\n\nBinary: ' \
- + act_cfg['name'] + ': ' + act_cfg['value'] \
- + '\nConfig file: ' + act_cfg['name'] \
- + ': ' + config_val + '\n'
-
def set_field_value(self, top, value_bytes, force=False):
def _set_field_value(name, cfgs, level):
if 'indx' not in cfgs:
return
act_cfg = self.get_item_by_index(cfgs['indx'])
actual_offset = act_cfg['offset'] - struct_info['offset']
- if force or act_cfg['value'] == '':
+ set_value = True
+ for each in self.bin_offset:
+ if actual_offset in range(each[0], (each[0] + each[2]) * 8):
+ if each[1] < 0:
+ set_value = False
+ if set_value and force or act_cfg['value'] == '':
value = get_bits_from_bytes(full_bytes,
actual_offset,
act_cfg['length'])
@@ -1389,7 +1321,6 @@ option format '%s' !" % option)
act_val)
act_cfg['value'] = self.format_value_to_str(
value, act_cfg['length'], act_val)
- self.find_data_difference(act_val, act_cfg)
if 'indx' in top:
# it is config option
@@ -1507,9 +1438,6 @@ for '%s' !" % (act_cfg['value'], act_cfg['path']))
return bin_segs
- available_fv = []
- missing_fv = []
-
def extract_cfg_from_bin(self, bin_data):
# get cfg bin length
cfg_bins = bytearray()
@@ -1517,12 +1445,12 @@ for '%s' !" % (act_cfg['value'], act_cfg['path']))
Dummy_offset = 0
for each in bin_segs:
if each[1] != -1:
+ self.bin_offset.append([Dummy_offset, each[1], each[2]])
cfg_bins.extend(bin_data[each[1]:each[1] + each[2]])
- self.available_fv.append(each[0])
else:
- self.missing_fv.append(each[0])
string = each[0] + ' is not availabe.'
messagebox.showinfo('', string)
+ self.bin_offset.append([Dummy_offset, each[1], each[2]])
cfg_bins.extend(bytearray(each[2]))
Dummy_offset += each[2]
return cfg_bins
@@ -1548,41 +1476,10 @@ for '%s' !" % (act_cfg['value'], act_cfg['path']))
print('Patched the loaded binary successfully !')
return bin_data
- def show_data_difference(self, data_diff):
- # Displays if any data difference detected in BSF and Binary file
- pop_up_text = 'There are differences in Config file and binary '\
- 'data detected!\n'
- pop_up_text += data_diff
-
- window = tkinter.Tk()
- window.title("Data Difference")
- window.resizable(1, 1)
- # Window Size
- window.geometry("800x400")
- frame = tkinter.Frame(window, height=800, width=700)
- frame.pack(side=tkinter.BOTTOM)
- # Vertical (y) Scroll Bar
- scroll = tkinter.Scrollbar(window)
- scroll.pack(side=tkinter.RIGHT, fill=tkinter.Y)
-
- text = tkinter.Text(window, wrap=tkinter.NONE,
- yscrollcommand=scroll.set,
- width=700, height=400)
- text.insert(tkinter.INSERT, pop_up_text)
- text.pack()
- # Configure the scrollbars
- scroll.config(command=text.yview)
- exit_button = tkinter.Button(
- window, text="Close", command=window.destroy)
- exit_button.pack(in_=frame, side=tkinter.RIGHT, padx=20, pady=10)
-
def load_default_from_bin(self, bin_data):
self._old_bin = bin_data
cfg_bins = self.extract_cfg_from_bin(bin_data)
self.set_field_value(self._cfg_tree, cfg_bins, True)
-
- if self.data_diff:
- self.show_data_difference(self.data_diff)
return cfg_bins
def generate_binary_array(self, path=''):
diff --git a/Maintainers.txt b/Maintainers.txt
index 41f491bcae..cd2f555750 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -145,7 +145,6 @@ W: https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg
M: Ard Biesheuvel <ardb+tianocore@kernel.org> [ardbiesheuvel]
R: Leif Lindholm <leif@nuviainc.com> [leiflindholm]
R: Sami Mujawar <sami.mujawar@arm.com> [samimujawar]
-R: Gerd Hoffmann <kraxel@redhat.com> [kraxel]
ArmVirtPkg: modules used on Xen
F: ArmVirtPkg/ArmVirtXen.*
@@ -226,7 +225,7 @@ MdeModulePkg
F: MdeModulePkg/
W: https://github.com/tianocore/tianocore.github.io/wiki/MdeModulePkg
M: Jian J Wang <jian.j.wang@intel.com> [jwang36]
-M: Liming Gao <gaoliming@byosoft.com.cn> [lgao4]
+M: Hao A Wu <hao.a.wu@intel.com> [hwu25]
MdeModulePkg: ACPI modules
F: MdeModulePkg/Include/*Acpi*.h
@@ -333,6 +332,7 @@ F: MdeModulePkg/Include/Protocol/FirmwareManagementProgress.h
F: MdeModulePkg/Library/DisplayUpdateProgressLib*/
F: MdeModulePkg/Library/FmpAuthenticationLibNull/
F: MdeModulePkg/Universal/Esrt*/
+R: Hao A Wu <hao.a.wu@intel.com> [hwu25]
R: Liming Gao <gaoliming@byosoft.com.cn> [lgao4]
R: Guomin Jiang <guomin.jiang@intel.com> [guominjia]
@@ -378,6 +378,7 @@ R: Ray Ni <ray.ni@intel.com> [niruiyu]
MdeModulePkg: Serial modules
F: MdeModulePkg/*Serial*/
F: MdeModulePkg/Include/*SerialPort*.h
+R: Hao A Wu <hao.a.wu@intel.com> [hwu25]
R: Ray Ni <ray.ni@intel.com> [niruiyu]
R: Zhichao Gao <zhichao.gao@intel.com> [ZhichaoGao]
@@ -423,7 +424,6 @@ W: http://www.tianocore.org/ovmf/
M: Ard Biesheuvel <ardb+tianocore@kernel.org> [ardbiesheuvel]
M: Jiewen Yao <jiewen.yao@intel.com> [jyao1]
R: Jordan Justen <jordan.l.justen@intel.com> [jljusten]
-R: Gerd Hoffmann <kraxel@redhat.com> [kraxel]
S: Maintained
OvmfPkg: bhyve-related modules
diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
index 450d372b2f..95f8b18bc4 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c
@@ -931,8 +931,6 @@ NvmeControllerInit (
DEBUG ((EFI_D_INFO, " SN : %a\n", Sn));
DEBUG ((EFI_D_INFO, " MN : %a\n", Mn));
DEBUG ((EFI_D_INFO, " FR : 0x%x\n", *((UINT64*)Private->ControllerData->Fr)));
- DEBUG ((DEBUG_INFO, " TNVMCAP (high 8-byte) : 0x%lx\n", *((UINT64*)(Private->ControllerData->Tnvmcap + 8))));
- DEBUG ((DEBUG_INFO, " TNVMCAP (low 8-byte) : 0x%lx\n", *((UINT64*)Private->ControllerData->Tnvmcap)));
DEBUG ((EFI_D_INFO, " RAB : 0x%x\n", Private->ControllerData->Rab));
DEBUG ((EFI_D_INFO, " IEEE : 0x%x\n", *(UINT32*)Private->ControllerData->Ieee_oui));
DEBUG ((EFI_D_INFO, " AERL : 0x%x\n", Private->ControllerData->Aerl));
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index 61d4b67c64..3369585bcc 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -1057,6 +1057,102 @@ ConvertStatusCodeCallbacks (
}
}
+/**
+ Migrates SEC modules in the given firmware volume.
+
+ Migrating SECURITY_CORE files requires special treatment since they are not tracked for PEI dispatch.
+
+ This functioun should be called after the FV has been copied to its post-memory location and the PEI Core FV list has
+ been updated.
+
+ @param Private Pointer to the PeiCore's private data structure.
+ @param FvIndex The firmware volume index to migrate.
+ @param OrgFvHandle The handle to the firmware volume in temporary memory.
+
+ @retval EFI_SUCCESS SEC modules were migrated successfully
+ @retval EFI_INVALID_PARAMETER The Private pointer is NULL or FvCount is invalid.
+ @retval EFI_NOT_FOUND Can't find valid FFS header.
+
+**/
+EFI_STATUS
+EFIAPI
+MigrateSecModulesInFv (
+ IN PEI_CORE_INSTANCE *Private,
+ IN UINTN FvIndex,
+ IN UINTN OrgFvHandle
+ )
+{
+ EFI_STATUS Status;
+ EFI_STATUS FindFileStatus;
+ EFI_PEI_FILE_HANDLE MigratedFileHandle;
+ EFI_PEI_FILE_HANDLE FileHandle;
+ UINT32 SectionAuthenticationStatus;
+ UINT32 FileSize;
+ VOID *OrgPe32SectionData;
+ VOID *Pe32SectionData;
+ EFI_FFS_FILE_HEADER *FfsFileHeader;
+ EFI_COMMON_SECTION_HEADER *Section;
+ BOOLEAN IsFfs3Fv;
+ UINTN SectionInstance;
+
+ if (Private == NULL || FvIndex >= Private->FvCount) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ do {
+ FindFileStatus = PeiFfsFindNextFile (
+ GetPeiServicesTablePointer (),
+ EFI_FV_FILETYPE_SECURITY_CORE,
+ Private->Fv[FvIndex].FvHandle,
+ &MigratedFileHandle
+ );
+ if (!EFI_ERROR (FindFileStatus ) && MigratedFileHandle != NULL) {
+ FileHandle = (EFI_PEI_FILE_HANDLE) ((UINTN) MigratedFileHandle - (UINTN) Private->Fv[FvIndex].FvHandle + OrgFvHandle);
+ FfsFileHeader = (EFI_FFS_FILE_HEADER *) MigratedFileHandle;
+
+ DEBUG ((DEBUG_VERBOSE, " Migrating SEC_CORE MigratedFileHandle at 0x%x.\n", (UINTN) MigratedFileHandle));
+ DEBUG ((DEBUG_VERBOSE, " FileHandle at 0x%x.\n", (UINTN) FileHandle));
+
+ IsFfs3Fv = CompareGuid (&Private->Fv[FvIndex].FvHeader->FileSystemGuid, &gEfiFirmwareFileSystem3Guid);
+ if (IS_FFS_FILE2 (FfsFileHeader)) {
+ ASSERT (FFS_FILE2_SIZE (FfsFileHeader) > 0x00FFFFFF);
+ if (!IsFfs3Fv) {
+ DEBUG ((DEBUG_ERROR, "It is a FFS3 formatted file: %g in a non-FFS3 formatted FV.\n", &FfsFileHeader->Name));
+ return EFI_NOT_FOUND;
+ }
+ Section = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) FfsFileHeader + sizeof (EFI_FFS_FILE_HEADER2));
+ FileSize = FFS_FILE2_SIZE (FfsFileHeader) - sizeof (EFI_FFS_FILE_HEADER2);
+ } else {
+ Section = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) FfsFileHeader + sizeof (EFI_FFS_FILE_HEADER));
+ FileSize = FFS_FILE_SIZE (FfsFileHeader) - sizeof (EFI_FFS_FILE_HEADER);
+ }
+
+ SectionInstance = 1;
+ SectionAuthenticationStatus = 0;
+ Status = ProcessSection (
+ GetPeiServicesTablePointer (),
+ EFI_SECTION_PE32,
+ &SectionInstance,
+ Section,
+ FileSize,
+ &Pe32SectionData,
+ &SectionAuthenticationStatus,
+ IsFfs3Fv
+ );
+
+ if (!EFI_ERROR (Status)) {
+ OrgPe32SectionData = (VOID *) ((UINTN) Pe32SectionData - (UINTN) MigratedFileHandle + (UINTN) FileHandle);
+ DEBUG ((DEBUG_VERBOSE, " PE32 section in migrated file at 0x%x.\n", (UINTN) Pe32SectionData));
+ DEBUG ((DEBUG_VERBOSE, " PE32 section in original file at 0x%x.\n", (UINTN) OrgPe32SectionData));
+ Status = LoadAndRelocatePeCoffImageInPlace (OrgPe32SectionData, Pe32SectionData);
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+ } while (!EFI_ERROR (FindFileStatus));
+
+ return EFI_SUCCESS;
+}
+
/**
Migrates PEIMs in the given firmware volume.
diff --git a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
index 9d6e3bf27a..1b302c810c 100644
--- a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
+++ b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
@@ -2232,6 +2232,64 @@ Done:
mSmramProfileGettingStatus = SmramProfileGettingStatus;
}
+/**
+ SMRAM profile handler to register SMM image.
+
+ @param SmramProfileParameterRegisterImage The parameter of SMM profile register image.
+
+**/
+VOID
+SmramProfileHandlerRegisterImage (
+ IN SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE *SmramProfileParameterRegisterImage
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMM_DRIVER_ENTRY DriverEntry;
+ VOID *EntryPointInImage;
+
+ ZeroMem (&DriverEntry, sizeof (DriverEntry));
+ CopyMem (&DriverEntry.FileName, &SmramProfileParameterRegisterImage->FileName, sizeof(EFI_GUID));
+ DriverEntry.ImageBuffer = SmramProfileParameterRegisterImage->ImageBuffer;
+ DriverEntry.NumberOfPage = (UINTN) SmramProfileParameterRegisterImage->NumberOfPage;
+ Status = InternalPeCoffGetEntryPoint ((VOID *) (UINTN) DriverEntry.ImageBuffer, &EntryPointInImage);
+ ASSERT_EFI_ERROR (Status);
+ DriverEntry.ImageEntryPoint = (PHYSICAL_ADDRESS) (UINTN) EntryPointInImage;
+
+ Status = RegisterSmramProfileImage (&DriverEntry, FALSE);
+ if (!EFI_ERROR (Status)) {
+ SmramProfileParameterRegisterImage->Header.ReturnStatus = 0;
+ }
+}
+
+/**
+ SMRAM profile handler to unregister SMM image.
+
+ @param SmramProfileParameterUnregisterImage The parameter of SMM profile unregister image.
+
+**/
+VOID
+SmramProfileHandlerUnregisterImage (
+ IN SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE *SmramProfileParameterUnregisterImage
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMM_DRIVER_ENTRY DriverEntry;
+ VOID *EntryPointInImage;
+
+ ZeroMem (&DriverEntry, sizeof (DriverEntry));
+ CopyMem (&DriverEntry.FileName, &SmramProfileParameterUnregisterImage->FileName, sizeof (EFI_GUID));
+ DriverEntry.ImageBuffer = SmramProfileParameterUnregisterImage->ImageBuffer;
+ DriverEntry.NumberOfPage = (UINTN) SmramProfileParameterUnregisterImage->NumberOfPage;
+ Status = InternalPeCoffGetEntryPoint ((VOID *) (UINTN) DriverEntry.ImageBuffer, &EntryPointInImage);
+ ASSERT_EFI_ERROR (Status);
+ DriverEntry.ImageEntryPoint = (PHYSICAL_ADDRESS) (UINTN) EntryPointInImage;
+
+ Status = UnregisterSmramProfileImage (&DriverEntry, FALSE);
+ if (!EFI_ERROR (Status)) {
+ SmramProfileParameterUnregisterImage->Header.ReturnStatus = 0;
+ }
+}
+
/**
Dispatch function for a Software SMI handler.
@@ -2316,6 +2374,28 @@ SmramProfileHandler (
}
SmramProfileHandlerGetDataByOffset ((SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET *) (UINTN) CommBuffer);
break;
+ case SMRAM_PROFILE_COMMAND_REGISTER_IMAGE:
+ DEBUG ((EFI_D_ERROR, "SmramProfileHandlerRegisterImage\n"));
+ if (TempCommBufferSize != sizeof (SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE)) {
+ DEBUG ((EFI_D_ERROR, "SmramProfileHandler: SMM communication buffer size invalid!\n"));
+ return EFI_SUCCESS;
+ }
+ if (mSmramReadyToLock) {
+ return EFI_SUCCESS;
+ }
+ SmramProfileHandlerRegisterImage ((SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE *) (UINTN) CommBuffer);
+ break;
+ case SMRAM_PROFILE_COMMAND_UNREGISTER_IMAGE:
+ DEBUG ((EFI_D_ERROR, "SmramProfileHandlerUnregisterImage\n"));
+ if (TempCommBufferSize != sizeof (SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE)) {
+ DEBUG ((EFI_D_ERROR, "SmramProfileHandler: SMM communication buffer size invalid!\n"));
+ return EFI_SUCCESS;
+ }
+ if (mSmramReadyToLock) {
+ return EFI_SUCCESS;
+ }
+ SmramProfileHandlerUnregisterImage ((SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE *) (UINTN) CommBuffer);
+ break;
case SMRAM_PROFILE_COMMAND_GET_RECORDING_STATE:
DEBUG ((EFI_D_ERROR, "SmramProfileHandlerGetRecordingState\n"));
if (TempCommBufferSize != sizeof (SMRAM_PROFILE_PARAMETER_RECORDING_STATE)) {
@@ -2337,15 +2417,6 @@ SmramProfileHandler (
ParameterRecordingState->Header.ReturnStatus = 0;
break;
- //
- // Below 2 commands have been deprecated. They may not be (re-)used.
- //
- case SMRAM_PROFILE_COMMAND_DEPRECATED1:
- case SMRAM_PROFILE_COMMAND_DEPRECATED2:
- ASSERT (FALSE);
- //
- // Fall-through to the default (unrecognized command) case.
- //
default:
break;
}
diff --git a/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h b/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h
index f4e3b03ba1..06e38921a0 100644
--- a/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h
+++ b/MdeModulePkg/Include/Guid/BootDiscoveryPolicy.h
@@ -18,6 +18,5 @@
#define BOOT_DISCOVERY_POLICY_MGR_FORMSET_GUID { 0x5b6f7107, 0xbb3c, 0x4660, { 0x92, 0xcd, 0x54, 0x26, 0x90, 0x28, 0x0b, 0xbd } }
#define BOOT_DISCOVERY_POLICY_VAR L"BootDiscoveryPolicy"
-#define BOOT_DISCOVERY_POLICY_OLD_VAR L"BootDiscoveryPolicyOld"
#endif
diff --git a/MdeModulePkg/Include/Guid/MemoryProfile.h b/MdeModulePkg/Include/Guid/MemoryProfile.h
index 7565e68b5c..eee3b91252 100644
--- a/MdeModulePkg/Include/Guid/MemoryProfile.h
+++ b/MdeModulePkg/Include/Guid/MemoryProfile.h
@@ -389,10 +389,10 @@ struct _EDKII_MEMORY_PROFILE_PROTOCOL {
#define SMRAM_PROFILE_COMMAND_GET_PROFILE_INFO 0x1
#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA 0x2
//
-// Below 2 commands have been deprecated. They may not be re-used.
+// Below 2 commands are now used by ECP only and only valid before SmmReadyToLock
//
-#define SMRAM_PROFILE_COMMAND_DEPRECATED1 0x3
-#define SMRAM_PROFILE_COMMAND_DEPRECATED2 0x4
+#define SMRAM_PROFILE_COMMAND_REGISTER_IMAGE 0x3
+#define SMRAM_PROFILE_COMMAND_UNREGISTER_IMAGE 0x4
#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET 0x5
#define SMRAM_PROFILE_COMMAND_GET_RECORDING_STATE 0x6
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c
index a45a55c823..4333e00053 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c
@@ -195,7 +195,7 @@ RamDiskPublishNfit (
MemoryFound = TRUE;
DEBUG ((
EFI_D_INFO,
- "RamDiskPublishNfit: RAM disk with reserved memory type, will publish to NFIT.\n"
+ "RamDiskPublishNfit: RAM disk with reserved meomry type, will publish to NFIT.\n"
));
break;
}
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c
index e417f4870f..611b2de5d8 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/Edb.c
@@ -219,11 +219,7 @@ EdbCheckBreakpoint (
//
// If hit, record current breakpoint
//
- CopyMem (
- &DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX],
- &DebuggerPrivate->DebuggerBreakpointContext[Index],
- sizeof (DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX])
- );
+ DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX] = DebuggerPrivate->DebuggerBreakpointContext[Index];
DebuggerPrivate->DebuggerBreakpointContext[EFI_DEBUGGER_BREAKPOINT_MAX].State = TRUE;
//
// Do not set Breakpoint flag. We record the address here just let it not patch breakpoint address when de-init.
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c
index 5d32c68406..e0c797be24 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c
@@ -158,11 +158,7 @@ DebuggerBreakpointDel (
// Delete this breakpoint
//
for (BpIndex = Index; BpIndex < DebuggerPrivate->DebuggerBreakpointCount - 1; BpIndex++) {
- CopyMem (
- &DebuggerPrivate->DebuggerBreakpointContext[BpIndex],
- &DebuggerPrivate->DebuggerBreakpointContext[BpIndex + 1],
- sizeof (DebuggerPrivate->DebuggerBreakpointContext[BpIndex])
- );
+ DebuggerPrivate->DebuggerBreakpointContext[BpIndex] = DebuggerPrivate->DebuggerBreakpointContext[BpIndex + 1];
}
ZeroMem (
&DebuggerPrivate->DebuggerBreakpointContext[BpIndex],
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c
index 1bfe5240c7..83257a2c25 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbHook.c
@@ -230,11 +230,7 @@ EbcDebuggerPushTraceDestEntry (
//
ASSERT (mDebuggerPrivate.TraceEntry[EFI_DEBUGGER_TRACE_MAX].Type == Type);
for (Index = 0; Index < EFI_DEBUGGER_TRACE_MAX; Index++) {
- CopyMem (
- &mDebuggerPrivate.TraceEntry[Index],
- &mDebuggerPrivate.TraceEntry[Index + 1],
- sizeof (mDebuggerPrivate.TraceEntry[Index])
- );
+ mDebuggerPrivate.TraceEntry[Index] = mDebuggerPrivate.TraceEntry[Index + 1];
}
mDebuggerPrivate.TraceEntry[EFI_DEBUGGER_CALLSTACK_MAX - 1].DestAddress = DestEntry;
mDebuggerPrivate.TraceEntryCount = EFI_DEBUGGER_TRACE_MAX;
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index 17a914208c..d492b769d5 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -2871,6 +2871,9 @@ ParseIfrData (
//
if ((BlockData->Name == NULL) && ((BlockData->Offset + BlockData->Width) > VarStorageData->Size)) {
Status = EFI_INVALID_PARAMETER;
+ if (BlockData->Name != NULL) {
+ FreePool (BlockData->Name);
+ }
FreePool (BlockData);
goto Done;
}
diff --git a/MdePkg/Include/IndustryStandard/Nvme.h b/MdePkg/Include/IndustryStandard/Nvme.h
index f7a1a9f6ca..9b19a2074b 100644
--- a/MdePkg/Include/IndustryStandard/Nvme.h
+++ b/MdePkg/Include/IndustryStandard/Nvme.h
@@ -353,16 +353,7 @@ typedef struct {
UINT8 Npss; /* Number of Power States Support */
UINT8 Avscc; /* Admin Vendor Specific Command Configuration */
UINT8 Apsta; /* Autonomous Power State Transition Attributes */
- //
- // Below fields before Rsvd2 are defined in NVM Express 1.3 Spec
- //
- UINT16 Wctemp; /* Warning Composite Temperature Threshold */
- UINT16 Cctemp; /* Critical Composite Temperature Threshold */
- UINT16 Mtfa; /* Maximum Time for Firmware Activation */
- UINT32 Hmpre; /* Host Memory Buffer Preferred Size */
- UINT32 Hmmin; /* Host Memory Buffer Minimum Size */
- UINT8 Tnvmcap[16]; /* Total NVM Capacity */
- UINT8 Rsvd2[216]; /* Reserved as of NVM Express */
+ UINT8 Rsvd2[246]; /* Reserved as of Nvm Express 1.1 Spec */
//
// NVM Command Set Attributes
//
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
index 595fd055f9..94c65f32dc 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -43,6 +43,7 @@
MemoryAllocationLib
OrderedCollectionLib
PcdLib
+ QemuFwCfgLib
UefiBootServicesTableLib
UefiDriverEntryPoint
UefiLib
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
index 01ee894746..e31579311b 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
@@ -11,6 +11,41 @@
#include <Library/BaseMemoryLib.h>
#include <Library/BhyveFwCtlLib.h>
#include <Library/MemoryAllocationLib.h>
+#include <Library/QemuFwCfgLib.h> // QemuFwCfgFindFile()
+
+STATIC
+EFI_STATUS
+EFIAPI
+BhyveGetCpuCount (
+ OUT UINT32 *CpuCount
+ )
+{
+ FIRMWARE_CONFIG_ITEM Item;
+ UINTN Size;
+
+ if (QemuFwCfgIsAvailable ()) {
+ if (EFI_ERROR (QemuFwCfgFindFile ("opt/bhyve/hw.ncpu", &Item, &Size))) {
+ return EFI_NOT_FOUND;
+ } else if (Size != sizeof (*CpuCount)) {
+ return EFI_BAD_BUFFER_SIZE;
+ }
+
+ QemuFwCfgSelectItem (Item);
+ QemuFwCfgReadBytes (Size, CpuCount);
+
+ return EFI_SUCCESS;
+ }
+
+ //
+ // QemuFwCfg not available, try BhyveFwCtl.
+ //
+ Size = sizeof (*CpuCount);
+ if (BhyveFwCtlGet ("hw.ncpu", CpuCount, &Size) == RETURN_SUCCESS) {
+ return EFI_SUCCESS;
+ }
+
+ return EFI_UNSUPPORTED;
+}
STATIC
EFI_STATUS
@@ -23,7 +58,6 @@ BhyveInstallAcpiMadtTable (
)
{
UINT32 CpuCount;
- UINTN cSize;
UINTN NewBufferSize;
EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *Madt;
EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE *LocalApic;
@@ -36,9 +70,8 @@ BhyveInstallAcpiMadtTable (
ASSERT (AcpiTableBufferSize >= sizeof (EFI_ACPI_DESCRIPTION_HEADER));
// Query the host for the number of vCPUs
- CpuCount = 0;
- cSize = sizeof(CpuCount);
- if (BhyveFwCtlGet ("hw.ncpu", &CpuCount, &cSize) == RETURN_SUCCESS) {
+ Status = BhyveGetCpuCount (&CpuCount);
+ if (!EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "Retrieved CpuCount %d\n", CpuCount));
ASSERT (CpuCount >= 1);
} else {
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index d8fe607d1c..4abb31d993 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -163,8 +163,7 @@
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
- QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf
- QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
+ QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
BhyveFwCtlLib|OvmfPkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.inf
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf
@@ -354,6 +353,7 @@
!endif
PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
+ QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf
[LibraryClasses.common.UEFI_APPLICATION]
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
diff --git a/OvmfPkg/Include/IndustryStandard/Virtio10.h b/OvmfPkg/Include/IndustryStandard/Virtio10.h
index a1712247e0..2c60be2b7c 100644
--- a/OvmfPkg/Include/IndustryStandard/Virtio10.h
+++ b/OvmfPkg/Include/IndustryStandard/Virtio10.h
@@ -81,16 +81,4 @@ typedef struct {
#define VIRTIO_F_VERSION_1 BIT32
#define VIRTIO_F_IOMMU_PLATFORM BIT33
-//
-// MMIO VirtIo Header Offsets
-//
-#define VIRTIO_MMIO_OFFSET_QUEUE_READY 0x44
-#define VIRTIO_MMIO_OFFSET_QUEUE_DESC_LO 0x80
-#define VIRTIO_MMIO_OFFSET_QUEUE_DESC_HI 0x84
-#define VIRTIO_MMIO_OFFSET_QUEUE_AVAIL_LO 0x90
-#define VIRTIO_MMIO_OFFSET_QUEUE_AVAIL_HI 0x94
-#define VIRTIO_MMIO_OFFSET_QUEUE_USED_LO 0xa0
-#define VIRTIO_MMIO_OFFSET_QUEUE_USED_HI 0xa4
-#define VIRTIO_MMIO_OFFSET_CONFIG_GENERATION 0xfc
-
#endif // _VIRTIO_1_0_H_
diff --git a/OvmfPkg/Include/Library/MemEncryptSevLib.h b/OvmfPkg/Include/Library/MemEncryptSevLib.h
index adc490e466..76d06c206c 100644
--- a/OvmfPkg/Include/Library/MemEncryptSevLib.h
+++ b/OvmfPkg/Include/Library/MemEncryptSevLib.h
@@ -12,7 +12,6 @@
#define _MEM_ENCRYPT_SEV_LIB_H_
#include <Base.h>
-#include <WorkArea.h>
//
// Define the maximum number of #VCs allowed (e.g. the level of nesting
@@ -37,6 +36,26 @@ typedef struct {
VOID *GhcbBackupPages;
} SEV_ES_PER_CPU_DATA;
+//
+// Internal structure for holding SEV-ES information needed during SEC phase
+// and valid only during SEC phase and early PEI during platform
+// initialization.
+//
+// This structure is also used by assembler files:
+// OvmfPkg/ResetVector/ResetVector.nasmb
+// OvmfPkg/ResetVector/Ia32/PageTables64.asm
+// OvmfPkg/ResetVector/Ia32/Flat32ToFlat64.asm
+// any changes must stay in sync with its usage.
+//
+typedef struct _SEC_SEV_ES_WORK_AREA {
+ UINT8 SevEsEnabled;
+ UINT8 Reserved1[7];
+
+ UINT64 RandomData;
+
+ UINT64 EncryptionMask;
+} SEC_SEV_ES_WORK_AREA;
+
//
// Memory encryption address range states.
//
diff --git a/OvmfPkg/Include/WorkArea.h b/OvmfPkg/Include/WorkArea.h
deleted file mode 100644
index c16030e3ac..0000000000
--- a/OvmfPkg/Include/WorkArea.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/** @file
-
- Work Area structure definition
-
- Copyright (c) 2021, AMD Inc.
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef __OVMF_WORK_AREA_H__
-#define __OVMF_WORK_AREA_H__
-
-//
-// Guest type for the work area
-//
-typedef enum {
- GUEST_TYPE_NON_ENCRYPTED,
- GUEST_TYPE_AMD_SEV,
- GUEST_TYPE_INTEL_TDX,
-
-} GUEST_TYPE;
-
-//
-// Confidential computing work area header definition. Any change
-// to the structure need to be kept in sync with the
-// PcdOvmfConfidentialComputingWorkAreaHeader.
-//
-typedef struct _CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER {
- UINT8 GuestType;
- UINT8 Reserved1[3];
-} CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER;
-
-//
-// Internal structure for holding SEV-ES information needed during SEC phase
-// and valid only during SEC phase and early PEI during platform
-// initialization.
-//
-// This structure is also used by assembler files:
-// OvmfPkg/ResetVector/ResetVector.nasmb
-// OvmfPkg/ResetVector/Ia32/PageTables64.asm
-// OvmfPkg/ResetVector/Ia32/Flat32ToFlat64.asm
-// any changes must stay in sync with its usage.
-//
-typedef struct _SEC_SEV_ES_WORK_AREA {
- UINT8 SevEsEnabled;
- UINT8 Reserved1[7];
-
- UINT64 RandomData;
-
- UINT64 EncryptionMask;
-} SEC_SEV_ES_WORK_AREA;
-
-//
-// The SEV work area definition.
-//
-typedef struct _SEV_WORK_AREA {
- CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER Header;
-
- SEC_SEV_ES_WORK_AREA SevEsWorkArea;
-} SEV_WORK_AREA;
-
-typedef union {
- CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER Header;
- SEV_WORK_AREA SevWorkArea;
-} OVMF_WORK_AREA;
-
-#endif
diff --git a/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c b/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c
index 7dc2eea239..b28ad4d2db 100644
--- a/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c
+++ b/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c
@@ -12,6 +12,8 @@
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
+#include <Library/QemuFwCfgLib.h>
+#include <Library/QemuFwCfgS3Lib.h>
#include <Protocol/LockBox.h>
#include <LockBoxLib.h>
@@ -115,7 +117,7 @@ LockBoxDxeLibInitialize (
Status = LockBoxLibInitialize ();
if (!EFI_ERROR (Status)) {
- if (PcdGetBool (PcdAcpiS3Enable)) {
+ if (QemuFwCfgS3Enabled ()) {
//
// When S3 enabled, the first driver run with this library linked will
// have this library constructor to install LockBox protocol on the
diff --git a/OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf b/OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf
index 9140b1ba9d..38bcc57708 100644
--- a/OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf
+++ b/OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf
@@ -33,6 +33,8 @@
BaseMemoryLib
DebugLib
UefiBootServicesTableLib
+ QemuFwCfgLib
+ QemuFwCfgS3Lib
[Protocols]
gEfiLockBoxProtocolGuid ## SOMETIMES_PRODUCES
@@ -40,7 +42,6 @@
[Pcd]
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable
[FeaturePcd]
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 71f63b2448..b0e9742937 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -379,7 +379,7 @@ PlatformBootManagerBeforeConsole (
//
EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);
- if (PcdGetBool (PcdAcpiS3Enable)) {
+ if (QemuFwCfgS3Enabled ()) {
//
// Save the boot script too. Note that this will require us to emit the
// DxeSmmReadyToLock event just below, which in turn locks down SMM.
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index c249a3cf1e..e470b9a6a3 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -61,7 +61,6 @@
gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
- gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate ## CONSUMES
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits ## CONSUMES
diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
index a97ef9352d..6dbbba008c 100644
--- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
+++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
@@ -58,6 +58,7 @@ VirtioMmioInit (
)
{
UINT32 MagicValue;
+ UINT32 Version;
//
// Initialize VirtIo Mmio Device
@@ -65,6 +66,7 @@ VirtioMmioInit (
CopyMem (&Device->VirtioDevice, &mMmioDeviceProtocolTemplate,
sizeof (VIRTIO_DEVICE_PROTOCOL));
Device->BaseAddress = BaseAddress;
+ Device->VirtioDevice.Revision = VIRTIO_SPEC_REVISION (0, 9, 5);
Device->VirtioDevice.SubSystemDeviceId =
MmioRead32 (BaseAddress + VIRTIO_MMIO_OFFSET_DEVICE_ID);
@@ -76,19 +78,8 @@ VirtioMmioInit (
return EFI_UNSUPPORTED;
}
- Device->Version = VIRTIO_CFG_READ (Device, VIRTIO_MMIO_OFFSET_VERSION);
- switch (Device->Version) {
- case VIRTIO_MMIO_DEVICE_VERSION_0_95:
- DEBUG ((DEBUG_INFO, "%a virtio 0.9.5, id %d\n", __FUNCTION__,
- Device->VirtioDevice.SubSystemDeviceId));
- Device->VirtioDevice.Revision = VIRTIO_SPEC_REVISION (0, 9, 5);
- break;
- case VIRTIO_MMIO_DEVICE_VERSION_1_00:
- DEBUG ((DEBUG_INFO, "%a virtio 1.0, id %d\n", __FUNCTION__,
- Device->VirtioDevice.SubSystemDeviceId));
- Device->VirtioDevice.Revision = VIRTIO_SPEC_REVISION (1, 0, 0);
- break;
- default:
+ Version = VIRTIO_CFG_READ (Device, VIRTIO_MMIO_OFFSET_VERSION);
+ if (Version != 1) {
return EFI_UNSUPPORTED;
}
diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
index 5ad951f415..ab53b90d51 100644
--- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
+++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h
@@ -23,14 +23,9 @@
#include <Library/MemoryAllocationLib.h>
#define VIRTIO_MMIO_DEVICE_SIGNATURE SIGNATURE_32 ('V', 'M', 'I', 'O')
-#define VIRTIO_MMIO_DEVICE_VERSION_0_95 1
-#define VIRTIO_MMIO_DEVICE_VERSION_1_00 2
-
typedef struct {
UINT32 Signature;
- UINT32 Version;
- UINT16 QueueNum;
VIRTIO_DEVICE_PROTOCOL VirtioDevice;
PHYSICAL_ADDRESS BaseAddress;
} VIRTIO_MMIO_DEVICE;
diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c
index b43850e69d..b0d75fb1dd 100644
--- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c
+++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c
@@ -20,7 +20,6 @@ VirtioMmioGetDeviceFeatures (
)
{
VIRTIO_MMIO_DEVICE *Device;
- UINT32 LowBits, HighBits;
if (DeviceFeatures == NULL) {
return EFI_INVALID_PARAMETER;
@@ -28,15 +27,7 @@ VirtioMmioGetDeviceFeatures (
Device = VIRTIO_MMIO_DEVICE_FROM_VIRTIO_DEVICE (This);
- if (Device->Version == VIRTIO_MMIO_DEVICE_VERSION_0_95) {
- *DeviceFeatures = VIRTIO_CFG_READ (Device, VIRTIO_MMIO_OFFSET_HOST_FEATURES);
- } else {
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_HOST_FEATURES_SEL, 0);
- LowBits = VIRTIO_CFG_READ (Device, VIRTIO_MMIO_OFFSET_HOST_FEATURES);
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_HOST_FEATURES_SEL, 1);
- HighBits = VIRTIO_CFG_READ (Device, VIRTIO_MMIO_OFFSET_HOST_FEATURES);
- *DeviceFeatures = LShiftU64(HighBits, 32) | LowBits;
- }
+ *DeviceFeatures = VIRTIO_CFG_READ (Device, VIRTIO_MMIO_OFFSET_HOST_FEATURES);
return EFI_SUCCESS;
}
@@ -92,11 +83,7 @@ VirtioMmioSetQueueSize (
Device = VIRTIO_MMIO_DEVICE_FROM_VIRTIO_DEVICE (This);
- if (Device->Version == VIRTIO_MMIO_DEVICE_VERSION_0_95) {
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_NUM, QueueSize);
- } else {
- Device->QueueNum = QueueSize;
- }
+ VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_NUM, QueueSize);
return EFI_SUCCESS;
}
@@ -164,9 +151,7 @@ VirtioMmioSetPageSize (
Device = VIRTIO_MMIO_DEVICE_FROM_VIRTIO_DEVICE (This);
- if (Device->Version == VIRTIO_MMIO_DEVICE_VERSION_0_95) {
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_GUEST_PAGE_SIZE, PageSize);
- }
+ VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_GUEST_PAGE_SIZE, PageSize);
return EFI_SUCCESS;
}
@@ -184,10 +169,6 @@ VirtioMmioSetQueueSel (
VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_SEL, Sel);
- if (Device->Version == VIRTIO_MMIO_DEVICE_VERSION_0_95) {
- Device->QueueNum = VIRTIO_CFG_READ (Device, VIRTIO_MMIO_OFFSET_QUEUE_NUM_MAX) & 0xFFFF;
- }
-
return EFI_SUCCESS;
}
@@ -200,38 +181,13 @@ VirtioMmioSetQueueAddress (
)
{
VIRTIO_MMIO_DEVICE *Device;
- UINT64 Address;
ASSERT (RingBaseShift == 0);
Device = VIRTIO_MMIO_DEVICE_FROM_VIRTIO_DEVICE (This);
- if (Device->Version == VIRTIO_MMIO_DEVICE_VERSION_0_95) {
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_PFN,
- (UINT32)((UINTN)Ring->Base >> EFI_PAGE_SHIFT));
- } else {
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_NUM, Device->QueueNum);
-
- Address = (UINTN)Ring->Base;
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_DESC_LO,
- (UINT32)Address);
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_DESC_HI,
- (UINT32)RShiftU64(Address, 32));
-
- Address = (UINTN)Ring->Avail.Flags;
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_AVAIL_LO,
- (UINT32)Address);
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_AVAIL_HI,
- (UINT32)RShiftU64(Address, 32));
-
- Address = (UINTN)Ring->Used.Flags;
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_USED_LO,
- (UINT32)Address);
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_USED_HI,
- (UINT32)RShiftU64(Address, 32));
-
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_READY, 1);
- }
+ VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_PFN,
+ (UINT32)((UINTN)Ring->Base >> EFI_PAGE_SHIFT));
return EFI_SUCCESS;
}
@@ -247,20 +203,11 @@ VirtioMmioSetGuestFeatures (
Device = VIRTIO_MMIO_DEVICE_FROM_VIRTIO_DEVICE (This);
- if (Device->Version == VIRTIO_MMIO_DEVICE_VERSION_0_95) {
- if (Features > MAX_UINT32) {
- return EFI_UNSUPPORTED;
- }
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_GUEST_FEATURES,
- (UINT32)Features);
- } else {
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_GUEST_FEATURES_SEL, 0);
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_GUEST_FEATURES,
- (UINT32)Features);
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_GUEST_FEATURES_SEL, 1);
- VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_GUEST_FEATURES,
- (UINT32)RShiftU64(Features, 32));
+ if (Features > MAX_UINT32) {
+ return EFI_UNSUPPORTED;
}
+ VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_GUEST_FEATURES,
+ (UINT32)Features);
return EFI_SUCCESS;
}
diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index c37dafad49..8fb6f257e8 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -329,18 +329,6 @@
gUefiOvmfPkgTokenSpaceGuid.PcdQemuHashTableBase|0x0|UINT32|0x47
gUefiOvmfPkgTokenSpaceGuid.PcdQemuHashTableSize|0x0|UINT32|0x48
- ## The base address and size of the work area used during the SEC
- # phase by the SEV and TDX supports.
- gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase|0|UINT32|0x49
- gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize|0|UINT32|0x50
-
- ## The work area contains a fixed size header in the Include/WorkArea.h.
- # The size of this header is used early boot, and is provided through
- # a fixed PCD. It need to be kept in sync with any changes to the
- # header definition.
- gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader|0|UINT32|0x51
-
-
[PcdsDynamic, PcdsDynamicEx]
gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|2
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable|FALSE|BOOLEAN|0x10
diff --git a/OvmfPkg/OvmfPkgDefines.fdf.inc b/OvmfPkg/OvmfPkgDefines.fdf.inc
index 3b5e452539..35fd454b97 100644
--- a/OvmfPkg/OvmfPkgDefines.fdf.inc
+++ b/OvmfPkg/OvmfPkgDefines.fdf.inc
@@ -82,12 +82,6 @@ SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize = $(BLOCK_SIZ
SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwSpareBase = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = $(VARS_SPARE_SIZE)
-# The OVMF WorkArea contains a fixed size header followed by the actual data.
-# The size of header is accessed through a fixed PCD in the reset vector code.
-# The value need to be kept in sync with the any changes to the Confidential
-# Computing Work Area header defined in the Include/WorkArea.h
-SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader = 4
-
!if $(SMM_REQUIRE) == TRUE
SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase
SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 23936242e7..5fa8c08958 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -83,7 +83,7 @@ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbPageTableBase|gUefiOvmfPkgTokenSpaceGui
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbSize
0x00B000|0x001000
-gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize
+gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase|gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaSize
0x00C000|0x001000
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbBackupBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbBackupSize
@@ -99,13 +99,6 @@ FV = PEIFV
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize
FV = DXEFV
-##########################################################################################
-# Set the SEV-ES specific work area PCDs
-#
-SET gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase = $(MEMFD_BASE_ADDRESS) + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader
-SET gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaSize = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize - gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader
-##########################################################################################
-
################################################################################
[FV.SECFV]
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 1a9c06c164..3c1ca6bfd4 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -587,7 +587,6 @@
NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
!endif
}
- OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
OvmfPkg/XenIoPvhDxe/XenIoPvhDxe.inf
OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
OvmfPkg/XenBusDxe/XenBusDxe.inf
diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf
index 8b58235559..aeb9336fd5 100644
--- a/OvmfPkg/OvmfXen.fdf
+++ b/OvmfPkg/OvmfXen.fdf
@@ -324,7 +324,6 @@ INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
INF MdeModulePkg/Application/UiApp/UiApp.inf
-INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
index 2c2c4641ec..2deec128f4 100644
--- a/OvmfPkg/PlatformPei/MemDetect.c
+++ b/OvmfPkg/PlatformPei/MemDetect.c
@@ -939,9 +939,9 @@ InitializeRamRegions (
}
#ifdef MDE_CPU_X64
- if (FixedPcdGet32 (PcdOvmfWorkAreaSize) != 0) {
+ if (MemEncryptSevEsIsEnabled ()) {
//
- // Reserve the work area.
+ // If SEV-ES is enabled, reserve the SEV-ES work area.
//
// Since this memory range will be used by the Reset Vector on S3
// resume, it must be reserved as ACPI NVS.
@@ -951,8 +951,8 @@ InitializeRamRegions (
// such that they would overlap the work area.
//
BuildMemoryAllocationHob (
- (EFI_PHYSICAL_ADDRESS)(UINTN) FixedPcdGet32 (PcdOvmfWorkAreaBase),
- (UINT64)(UINTN) FixedPcdGet32 (PcdOvmfWorkAreaSize),
+ (EFI_PHYSICAL_ADDRESS)(UINTN) FixedPcdGet32 (PcdSevEsWorkAreaBase),
+ (UINT64)(UINTN) FixedPcdGet32 (PcdSevEsWorkAreaSize),
mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData
);
}
diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf
index 67eb7aa716..89d1f76368 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -116,8 +116,8 @@
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbBackupBase
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbBackupSize
- gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase
- gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaSize
+ gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase
+ gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaSize
[FeaturePcd]
gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable
diff --git a/OvmfPkg/ResetVector/Ia32/AmdSev.asm b/OvmfPkg/ResetVector/Ia32/AmdSev.asm
index 250ac8d8b1..aa95d06ead 100644
--- a/OvmfPkg/ResetVector/Ia32/AmdSev.asm
+++ b/OvmfPkg/ResetVector/Ia32/AmdSev.asm
@@ -44,27 +44,6 @@ BITS 32
; The unexpected response code
%define TERM_UNEXPECTED_RESP_CODE 2
-%define PAGE_PRESENT 0x01
-%define PAGE_READ_WRITE 0x02
-%define PAGE_USER_SUPERVISOR 0x04
-%define PAGE_WRITE_THROUGH 0x08
-%define PAGE_CACHE_DISABLE 0x010
-%define PAGE_ACCESSED 0x020
-%define PAGE_DIRTY 0x040
-%define PAGE_PAT 0x080
-%define PAGE_GLOBAL 0x0100
-%define PAGE_2M_MBO 0x080
-%define PAGE_2M_PAT 0x01000
-
-%define PAGE_4K_PDE_ATTR (PAGE_ACCESSED + \
- PAGE_DIRTY + \
- PAGE_READ_WRITE + \
- PAGE_PRESENT)
-
-%define PAGE_PDP_ATTR (PAGE_ACCESSED + \
- PAGE_READ_WRITE + \
- PAGE_PRESENT)
-
; Macro is used to issue the MSR protocol based VMGEXIT. The caller is
; responsible to populate values in the EDX:EAX registers. After the vmmcall
@@ -138,70 +117,6 @@ BITS 32
SevEsUnexpectedRespTerminate:
TerminateVmgExit TERM_UNEXPECTED_RESP_CODE
-; If SEV-ES is enabled then initialize and make the GHCB page shared
-SevClearPageEncMaskForGhcbPage:
- ; Check if SEV is enabled
- cmp byte[WORK_AREA_GUEST_TYPE], 1
- jnz SevClearPageEncMaskForGhcbPageExit
-
- ; Check if SEV-ES is enabled
- cmp byte[SEV_ES_WORK_AREA], 1
- jnz SevClearPageEncMaskForGhcbPageExit
-
- ;
- ; The initial GHCB will live at GHCB_BASE and needs to be un-encrypted.
- ; This requires the 2MB page for this range be broken down into 512 4KB
- ; pages. All will be marked encrypted, except for the GHCB.
- ;
- mov ecx, (GHCB_BASE >> 21)
- mov eax, GHCB_PT_ADDR + PAGE_PDP_ATTR
- mov [ecx * 8 + PT_ADDR (0x2000)], eax
-
- ;
- ; Page Table Entries (512 * 4KB entries => 2MB)
- ;
- mov ecx, 512
-pageTableEntries4kLoop:
- mov eax, ecx
- dec eax
- shl eax, 12
- add eax, GHCB_BASE & 0xFFE0_0000
- add eax, PAGE_4K_PDE_ATTR
- mov [ecx * 8 + GHCB_PT_ADDR - 8], eax
- mov [(ecx * 8 + GHCB_PT_ADDR - 8) + 4], edx
- loop pageTableEntries4kLoop
-
- ;
- ; Clear the encryption bit from the GHCB entry
- ;
- mov ecx, (GHCB_BASE & 0x1F_FFFF) >> 12
- mov [ecx * 8 + GHCB_PT_ADDR + 4], strict dword 0
-
- mov ecx, GHCB_SIZE / 4
- xor eax, eax
-clearGhcbMemoryLoop:
- mov dword[ecx * 4 + GHCB_BASE - 4], eax
- loop clearGhcbMemoryLoop
-
-SevClearPageEncMaskForGhcbPageExit:
- OneTimeCallRet SevClearPageEncMaskForGhcbPage
-
-; Check if SEV is enabled, and get the C-bit mask above 31.
-; Modified: EDX
-;
-; The value is returned in the EDX
-GetSevCBitMaskAbove31:
- xor edx, edx
-
- ; Check if SEV is enabled
- cmp byte[WORK_AREA_GUEST_TYPE], 1
- jnz GetSevCBitMaskAbove31Exit
-
- mov edx, dword[SEV_ES_WORK_AREA_ENC_MASK + 4]
-
-GetSevCBitMaskAbove31Exit:
- OneTimeCallRet GetSevCBitMaskAbove31
-
; Check if Secure Encrypted Virtualization (SEV) features are enabled.
;
; Register usage is tight in this routine, so multiple calls for the
@@ -256,9 +171,6 @@ CheckSevFeatures:
bt eax, 0
jnc NoSev
- ; Set the work area header to indicate that the SEV is enabled
- mov byte[WORK_AREA_GUEST_TYPE], 1
-
; Check for SEV-ES memory encryption feature:
; CPUID Fn8000_001F[EAX] - Bit 3
; CPUID raises a #VC exception if running as an SEV-ES guest
@@ -334,6 +246,27 @@ SevExit:
OneTimeCallRet CheckSevFeatures
+; Check if Secure Encrypted Virtualization - Encrypted State (SEV-ES) feature
+; is enabled.
+;
+; Modified: EAX
+;
+; If SEV-ES is enabled then EAX will be non-zero.
+; If SEV-ES is disabled then EAX will be zero.
+;
+IsSevEsEnabled:
+ xor eax, eax
+
+ ; During CheckSevFeatures, the SEV_ES_WORK_AREA was set to 1 if
+ ; SEV-ES is enabled.
+ cmp byte[SEV_ES_WORK_AREA], 1
+ jne SevEsDisabled
+
+ mov eax, 1
+
+SevEsDisabled:
+ OneTimeCallRet IsSevEsEnabled
+
; Start of #VC exception handling routines
;
diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
index 07b6ca0709..eacdb69ddb 100644
--- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm
+++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm
@@ -42,17 +42,16 @@ BITS 32
;
SetCr3ForPageTables64:
- ; Clear the WorkArea header. The SEV probe routines will populate the
- ; work area when detected.
- mov byte[WORK_AREA_GUEST_TYPE], 0
-
- ; Check whether the SEV is active and populate the SevEsWorkArea
OneTimeCall CheckSevFeatures
+ xor edx, edx
+ test eax, eax
+ jz SevNotActive
+
+ ; If SEV is enabled, C-bit is always above 31
+ sub eax, 32
+ bts edx, eax
- ; If SEV is enabled, the C-bit position is always above 31.
- ; The mask will be saved in the EDX and applied during the
- ; the page table build below.
- OneTimeCall GetSevCBitMaskAbove31
+SevNotActive:
;
; For OVMF, build some initial page tables at
@@ -102,8 +101,44 @@ pageTableEntriesLoop:
mov [(ecx * 8 + PT_ADDR (0x2000 - 8)) + 4], edx
loop pageTableEntriesLoop
- ; Clear the C-bit from the GHCB page if the SEV-ES is enabled.
- OneTimeCall SevClearPageEncMaskForGhcbPage
+ OneTimeCall IsSevEsEnabled
+ test eax, eax
+ jz SetCr3
+
+ ;
+ ; The initial GHCB will live at GHCB_BASE and needs to be un-encrypted.
+ ; This requires the 2MB page for this range be broken down into 512 4KB
+ ; pages. All will be marked encrypted, except for the GHCB.
+ ;
+ mov ecx, (GHCB_BASE >> 21)
+ mov eax, GHCB_PT_ADDR + PAGE_PDP_ATTR
+ mov [ecx * 8 + PT_ADDR (0x2000)], eax
+
+ ;
+ ; Page Table Entries (512 * 4KB entries => 2MB)
+ ;
+ mov ecx, 512
+pageTableEntries4kLoop:
+ mov eax, ecx
+ dec eax
+ shl eax, 12
+ add eax, GHCB_BASE & 0xFFE0_0000
+ add eax, PAGE_4K_PDE_ATTR
+ mov [ecx * 8 + GHCB_PT_ADDR - 8], eax
+ mov [(ecx * 8 + GHCB_PT_ADDR - 8) + 4], edx
+ loop pageTableEntries4kLoop
+
+ ;
+ ; Clear the encryption bit from the GHCB entry
+ ;
+ mov ecx, (GHCB_BASE & 0x1F_FFFF) >> 12
+ mov [ecx * 8 + GHCB_PT_ADDR + 4], strict dword 0
+
+ mov ecx, GHCB_SIZE / 4
+ xor eax, eax
+clearGhcbMemoryLoop:
+ mov dword[ecx * 4 + GHCB_BASE - 4], eax
+ loop clearGhcbMemoryLoop
SetCr3:
;
diff --git a/OvmfPkg/ResetVector/ResetVector.inf b/OvmfPkg/ResetVector/ResetVector.inf
index a2520dde55..d028c92d8c 100644
--- a/OvmfPkg/ResetVector/ResetVector.inf
+++ b/OvmfPkg/ResetVector/ResetVector.inf
@@ -43,7 +43,6 @@
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize
- gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase
[FixedPcd]
gUefiOvmfPkgTokenSpaceGuid.PcdSevLaunchSecretBase
diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/ResetVector.nasmb
index d1d800c567..acec46a324 100644
--- a/OvmfPkg/ResetVector/ResetVector.nasmb
+++ b/OvmfPkg/ResetVector/ResetVector.nasmb
@@ -72,7 +72,6 @@
%define GHCB_PT_ADDR (FixedPcdGet32 (PcdOvmfSecGhcbPageTableBase))
%define GHCB_BASE (FixedPcdGet32 (PcdOvmfSecGhcbBase))
%define GHCB_SIZE (FixedPcdGet32 (PcdOvmfSecGhcbSize))
- %define WORK_AREA_GUEST_TYPE (FixedPcdGet32 (PcdOvmfWorkAreaBase))
%define SEV_ES_WORK_AREA (FixedPcdGet32 (PcdSevEsWorkAreaBase))
%define SEV_ES_WORK_AREA_RDRAND (FixedPcdGet32 (PcdSevEsWorkAreaBase) + 8)
%define SEV_ES_WORK_AREA_ENC_MASK (FixedPcdGet32 (PcdSevEsWorkAreaBase) + 16)
diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c
index 707b0d4bbf..9db67e17b2 100644
--- a/OvmfPkg/Sec/SecMain.c
+++ b/OvmfPkg/Sec/SecMain.c
@@ -807,36 +807,6 @@ SevEsProtocolCheck (
Ghcb->GhcbUsage = GHCB_STANDARD_USAGE;
}
-/**
- Determine if the SEV is active.
-
- During the early booting, GuestType is set in the work area. Verify that it
- is an SEV guest.
-
- @retval TRUE SEV is enabled
- @retval FALSE SEV is not enabled
-
-**/
-STATIC
-BOOLEAN
-IsSevGuest (
- VOID
- )
-{
- OVMF_WORK_AREA *WorkArea;
-
- //
- // Ensure that the size of the Confidential Computing work area header
- // is same as what is provided through a fixed PCD.
- //
- ASSERT ((UINTN) FixedPcdGet32 (PcdOvmfConfidentialComputingWorkAreaHeader) ==
- sizeof(CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER));
-
- WorkArea = (OVMF_WORK_AREA *) FixedPcdGet32 (PcdOvmfWorkAreaBase);
-
- return ((WorkArea != NULL) && (WorkArea->Header.GuestType == GUEST_TYPE_AMD_SEV));
-}
-
/**
Determine if SEV-ES is active.
@@ -856,13 +826,9 @@ SevEsIsEnabled (
{
SEC_SEV_ES_WORK_AREA *SevEsWorkArea;
- if (!IsSevGuest()) {
- return FALSE;
- }
-
SevEsWorkArea = (SEC_SEV_ES_WORK_AREA *) FixedPcdGet32 (PcdSevEsWorkAreaBase);
- return (SevEsWorkArea->SevEsEnabled != 0);
+ return ((SevEsWorkArea != NULL) && (SevEsWorkArea->SevEsEnabled != 0));
}
VOID
diff --git a/OvmfPkg/Sec/SecMain.inf b/OvmfPkg/Sec/SecMain.inf
index ea4b9611f5..7f78dcee27 100644
--- a/OvmfPkg/Sec/SecMain.inf
+++ b/OvmfPkg/Sec/SecMain.inf
@@ -70,8 +70,6 @@
gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDecompressionScratchEnd
gEfiMdeModulePkgTokenSpaceGuid.PcdInitValueInTempStack
- gUefiOvmfPkgTokenSpaceGuid.PcdOvmfConfidentialComputingWorkAreaHeader
- gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase
[FeaturePcd]
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire
diff --git a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c
index be04baf7b2..9547c20288 100644
--- a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c
+++ b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c
@@ -25,6 +25,8 @@
#include <Library/IoLib.h>
#include <Library/PcdLib.h>
#include <Library/PciLib.h>
+#include <Library/QemuFwCfgLib.h>
+#include <Library/QemuFwCfgS3Lib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Protocol/S3SaveState.h>
#include <Protocol/SmmControl2.h>
@@ -236,7 +238,7 @@ SmmControl2DxeEntryPoint (
//
mSmiFeatureNegotiation = NegotiateSmiFeatures ();
- if (PcdGetBool (PcdAcpiS3Enable)) {
+ if (QemuFwCfgS3Enabled ()) {
VOID *Registration;
//
diff --git a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf
index 4cad56516f..b8fdea8deb 100644
--- a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf
+++ b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf
@@ -39,7 +39,6 @@
[Packages]
MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
OvmfPkg/OvmfPkg.dec
UefiCpuPkg/UefiCpuPkg.dec
@@ -63,7 +62,6 @@
[Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout ## SOMETIMES_PRODUCES
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode ## SOMETIMES_PRODUCES
- gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable
[FeaturePcd]
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire
diff --git a/OvmfPkg/XenPlatformPei/Platform.c b/OvmfPkg/XenPlatformPei/Platform.c
index e60478fdb4..a811e72ee3 100644
--- a/OvmfPkg/XenPlatformPei/Platform.c
+++ b/OvmfPkg/XenPlatformPei/Platform.c
@@ -26,7 +26,6 @@
#include <Library/PciLib.h>
#include <Library/PeimEntryPoint.h>
#include <Library/PeiServicesLib.h>
-#include <Library/QemuFwCfgS3Lib.h>
#include <Library/ResourcePublicationLib.h>
#include <Guid/MemoryTypeInformation.h>
#include <Ppi/MasterBootMode.h>
@@ -424,8 +423,6 @@ InitializeXenPlatform (
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
- EFI_STATUS Status;
-
DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n"));
DebugDumpCmos ();
@@ -436,16 +433,6 @@ InitializeXenPlatform (
CpuDeadLoop ();
}
- //
- // This S3 conditional test is mainly for HVM Direct Kernel Boot since
- // QEMU fwcfg isn't really supported other than that.
- //
- if (QemuFwCfgS3Enabled ()) {
- DEBUG ((DEBUG_INFO, "S3 support was detected on QEMU\n"));
- Status = PcdSetBoolS (PcdAcpiS3Enable, TRUE);
- ASSERT_EFI_ERROR (Status);
- }
-
XenConnect ();
BootModeInitialization ();
diff --git a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
index 20c27ff34b..597cb6fcd7 100644
--- a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
+++ b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
@@ -57,7 +57,6 @@
ResourcePublicationLib
PeiServicesLib
PeimEntryPoint
- QemuFwCfgS3Lib
MtrrLib
MemEncryptSevLib
PcdLib
@@ -80,7 +79,6 @@
gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base
gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size
gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes
- gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
diff --git a/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.c b/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.c
index 32b64a31d1..1bf49f2d0f 100644
--- a/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.c
+++ b/SecurityPkg/Tcg/MemoryOverwriteControl/TcgMor.c
@@ -52,7 +52,7 @@ OnReadyToBoot (
&mMorControl
);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "TcgMor: Clear MOR_CLEAR_MEMORY_BIT failure, Status = %r\n", Status));
+ DEBUG ((EFI_D_ERROR, "TcgMor: Clear MOR_CLEAR_MEMORY_BIT failure, Status = %r\n"));
}
}
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
index 67ad9a4c07..db68e1316e 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
@@ -729,8 +729,8 @@ PiCpuSmmEntry (
DEBUG ((DEBUG_INFO, "PcdControlFlowEnforcementPropertyMask = %d\n", PcdGet32 (PcdControlFlowEnforcementPropertyMask)));
if (PcdGet32 (PcdControlFlowEnforcementPropertyMask) != 0) {
- AsmCpuid (CPUID_SIGNATURE, &RegEax, NULL, NULL, NULL);
- if (RegEax >= CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS) {
+ AsmCpuid (CPUID_EXTENDED_FUNCTION, &RegEax, NULL, NULL, NULL);
+ if (RegEax > CPUID_EXTENDED_FUNCTION) {
AsmCpuidEx (CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS, CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_SUB_LEAF_INFO, NULL, NULL, &RegEcx, &RegEdx);
DEBUG ((DEBUG_INFO, "CPUID[7/0] ECX - 0x%08x\n", RegEcx));
DEBUG ((DEBUG_INFO, " CET_SS - 0x%08x\n", RegEcx & CPUID_CET_SS));
@@ -747,9 +747,6 @@ PiCpuSmmEntry (
AsmCpuidEx(CPUID_EXTENDED_STATE, 12, &RegEax, NULL, &RegEcx, NULL);
DEBUG ((DEBUG_INFO, "CPUID[D/12] EAX - 0x%08x, ECX - 0x%08x\n", RegEax, RegEcx));
}
- } else {
- mCetSupported = FALSE;
- PatchInstructionX86(mPatchCetSupported, mCetSupported, 1);
}
} else {
mCetSupported = FALSE;
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
index 972bdc2859..d7ed9ab7a7 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
@@ -985,14 +985,13 @@ CheckFeatureSupported (
MSR_IA32_MISC_ENABLE_REGISTER MiscEnableMsr;
if ((PcdGet32 (PcdControlFlowEnforcementPropertyMask) != 0) && mCetSupported) {
- AsmCpuid (CPUID_SIGNATURE, &RegEax, NULL, NULL, NULL);
- if (RegEax >= CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS) {
- AsmCpuidEx (CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS, CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_SUB_LEAF_INFO, NULL, NULL, &RegEcx, NULL);
- if ((RegEcx & CPUID_CET_SS) == 0) {
- mCetSupported = FALSE;
- PatchInstructionX86 (mPatchCetSupported, mCetSupported, 1);
- }
- } else {
+ AsmCpuid (CPUID_EXTENDED_FUNCTION, &RegEax, NULL, NULL, NULL);
+ if (RegEax <= CPUID_EXTENDED_FUNCTION) {
+ mCetSupported = FALSE;
+ PatchInstructionX86 (mPatchCetSupported, mCetSupported, 1);
+ }
+ AsmCpuidEx (CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS, CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_SUB_LEAF_INFO, NULL, NULL, &RegEcx, NULL);
+ if ((RegEcx & CPUID_CET_SS) == 0) {
mCetSupported = FALSE;
PatchInstructionX86 (mPatchCetSupported, mCetSupported, 1);
}
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
index 518978c1d9..fc418c2500 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
@@ -315,12 +315,12 @@ ReadSaveStateRegisterByIndex (
}
//
- // Write at most 4 of the lower bytes of the return buffer
+ // Write lower 32-bits of return buffer
//
CopyMem(Buffer, (UINT8 *)CpuSaveState + mSmmCpuWidthOffset[RegisterIndex].Offset64Lo, MIN(4, Width));
- if (Width > 4) {
+ if (Width >= 4) {
//
- // Write at most 4 of the upper bytes of the return buffer
+ // Write upper 32-bits of return buffer
//
CopyMem((UINT8 *)Buffer + 4, (UINT8 *)CpuSaveState + mSmmCpuWidthOffset[RegisterIndex].Offset64Hi, Width - 4);
}
@@ -546,12 +546,12 @@ WriteSaveStateRegister (
}
//
- // Write at most 4 of the lower bytes of SMM State register
+ // Write lower 32-bits of SMM State register
//
CopyMem((UINT8 *)CpuSaveState + mSmmCpuWidthOffset[RegisterIndex].Offset64Lo, Buffer, MIN (4, Width));
- if (Width > 4) {
+ if (Width >= 4) {
//
- // Write at most 4 of the upper bytes of SMM State register
+ // Write upper 32-bits of SMM State register
//
CopyMem((UINT8 *)CpuSaveState + mSmmCpuWidthOffset[RegisterIndex].Offset64Hi, (UINT8 *)Buffer + 4, Width - 4);
}
diff --git a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
index dd25ac2682..768c3db770 100644
--- a/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
+++ b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c
@@ -77,9 +77,9 @@ HobConstructor (
Hob->Version = EFI_HOB_HANDOFF_TABLE_VERSION;
Hob->BootMode = BOOT_WITH_FULL_CONFIGURATION;
- Hob->EfiMemoryTop = (EFI_PHYSICAL_ADDRESS) (UINTN) EfiMemoryTop;
- Hob->EfiMemoryBottom = (EFI_PHYSICAL_ADDRESS) (UINTN) EfiMemoryBottom;
- Hob->EfiFreeMemoryTop = (EFI_PHYSICAL_ADDRESS) (UINTN) EfiFreeMemoryTop;
+ Hob->EfiMemoryTop = (EFI_PHYSICAL_ADDRESS) EfiMemoryTop;
+ Hob->EfiMemoryBottom = (EFI_PHYSICAL_ADDRESS) EfiMemoryBottom;
+ Hob->EfiFreeMemoryTop = (EFI_PHYSICAL_ADDRESS) EfiFreeMemoryTop;
Hob->EfiFreeMemoryBottom = (EFI_PHYSICAL_ADDRESS) (UINTN) (HobEnd+1);
Hob->EfiEndOfHobList = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd;
diff --git a/UefiPayloadPkg/UefiPayloadEntry/MemoryAllocation.c b/UefiPayloadPkg/UefiPayloadEntry/MemoryAllocation.c
index f3494969e5..1204573b3e 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/MemoryAllocation.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/MemoryAllocation.c
@@ -163,7 +163,7 @@ AllocatePool (
return NULL;
}
- Hob = (EFI_HOB_MEMORY_POOL *)CreateHob (EFI_HOB_TYPE_MEMORY_POOL, (UINT16)(sizeof (EFI_HOB_MEMORY_POOL) + AllocationSize));
+ Hob = (EFI_HOB_MEMORY_POOL *)CreateHob (EFI_HOB_TYPE_MEMORY_POOL, (UINT16)(sizeof (EFI_HOB_TYPE_MEMORY_POOL) + AllocationSize));
return (VOID *)(Hob + 1);
}
diff --git a/UefiPayloadPkg/UefiPayloadPkg.ci.yaml b/UefiPayloadPkg/UefiPayloadPkg.ci.yaml
deleted file mode 100644
index 35e6fb3540..0000000000
--- a/UefiPayloadPkg/UefiPayloadPkg.ci.yaml
+++ /dev/null
@@ -1,90 +0,0 @@
-## @file
-# Core CI configuration for UefiPayloadPkg
-#
-# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-##
-{
- ## options defined .pytool/Plugin/LicenseCheck
- "LicenseCheck": {
- "IgnoreFiles": []
- },
- "EccCheck": {
- ## Exception sample looks like below:
- ## "ExceptionList": [
- ## "<ErrorID>", "<KeyWord>"
- ## ]
- "ExceptionList": [
- ],
- ## Both file path and directory path are accepted.
- "IgnoreFiles": [
- ]
- },
- ## options defined .pytool/Plugin/CompilerPlugin
- "CompilerPlugin": {
- "DscPath": "UefiPayloadPkg.dsc"
- },
-
- ## options defined .pytool/Plugin/HostUnitTestCompilerPlugin
- "HostUnitTestCompilerPlugin": {
- "DscPath": "" # Don't support this test
- },
-
- ## options defined .pytool/Plugin/CharEncodingCheck
- "CharEncodingCheck": {
- "IgnoreFiles": []
- },
-
- ## options defined .pytool/Plugin/DependencyCheck
- "DependencyCheck": {
- "AcceptableDependencies": [],
- # For host based unit tests
- "AcceptableDependencies-HOST_APPLICATION":[],
- # For UEFI shell based apps
- "AcceptableDependencies-UEFI_APPLICATION":[],
- "IgnoreInf": [],
- "skip": True
- },
-
- ## options defined .pytool/Plugin/DscCompleteCheck
- "DscCompleteCheck": {
- "IgnoreInf": [""],
- "DscPath": "" # Don't support this test
- },
-
- ## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck
- "HostUnitTestDscCompleteCheck": {
- "IgnoreInf": [""],
- "DscPath": "" # Don't support this test
- },
-
- ## options defined .pytool/Plugin/GuidCheck
- "GuidCheck": {
- "IgnoreGuidName": [],
- "IgnoreGuidValue": [],
- "IgnoreFoldersAndFiles": [],
- "IgnoreDuplicates": [],
- },
-
- ## options defined .pytool/Plugin/LibraryClassCheck
- "LibraryClassCheck": {
- "IgnoreHeaderFile": [],
- "skip": True
- },
-
- ## options defined .pytool/Plugin/SpellCheck
- "SpellCheck": {
- "AuditOnly": True, # Fails right now with over 270 errors
- "IgnoreFiles": [], # use gitignore syntax to ignore errors in matching files
- "ExtendWords": [], # words to extend to the dictionary for this package
- "IgnoreStandardPaths": [], # Standard Plugin defined paths that should be ignore
- "AdditionalIncludePaths": [] # Additional paths to spell check (wildcards supported)
- },
-
- "Defines": {
- "BLD_*_UNIVERSAL_PAYLOAD": "TRUE",
- "BLD_*_EMU_VARIABLE_ENABLE": "FALSE",
- "BLD_*_DISABLE_RESET_SYSTEM": "TRUE",
- "BLD_*_SERIAL_DRIVER_ENABLE": "FALSE",
- }
-}
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 856d5ea786..b4a30be381 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -415,7 +415,7 @@
#
################################################################################
-!if "IA32" in "$(ARCH)"
+!if "IA32" in $(ARCH)
[Components.IA32]
!if $(UNIVERSAL_PAYLOAD) == TRUE
UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf b/UefiPayloadPkg/UefiPayloadPkg.fdf
index 5871d71dbb..b2cfb6b405 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -201,6 +201,22 @@ INF ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
INF ShellPkg/Application/Shell/Shell.inf
!endif
+!if $(SHELL_TYPE) == MIN_BIN
+!if $(ARCH) == IA32
+INF RuleOverride = BINARY USE = IA32 ShellBinPkg/MinUefiShell/MinUefiShell.inf
+!else
+INF RuleOverride = BINARY USE = X64 ShellBinPkg/MinUefiShell/MinUefiShell.inf
+!endif
+!endif
+
+!if $(SHELL_TYPE) == UEFI_BIN
+!if $(ARCH) == IA32
+INF RuleOverride = BINARY USE = IA32 ShellBinPkg/UefiShell/UefiShell.inf
+!else
+INF RuleOverride = BINARY USE = X64 ShellBinPkg/UefiShell/UefiShell.inf
+!endif
+!endif
+
################################################################################
#
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4053669
Default Alt Text
fwcfg_v02.patch (86 KB)
Attached To
Mode
D31578: bhyve: add support for QEMU's fwcfg
Attached
Detach File
Event Timeline
Log In to Comment