summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Include
Commit message (Collapse)AuthorAgeFilesLines
* MdeModulePkg:Remove MpService2Ppi field in SMM_S3_RESUME_STATEDun Tan42 hours1-2/+1
| | | | | | | | | | | | | | | This MpService2Ppi field in SMM_S3_RESUME_STATE is used to wakeup AP to do the CPU initialization during smm s3 boot when the execution mode of PEI and DXE are the same. Currently, in CpuS3.c of smm cpu driver, BSP doesn't need to wakeup AP anymore. The initialization for AP will be done in S3Resume.c before transfer to CpuS3.c of smm cpu driver. So we can remove the MpService2Ppi field in SMM_S3_RESUME_STATE. Signed-off-by: Dun Tan <dun.tan@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Use newly defined Unaccepted Memory TypeSachin Ganesh2024-05-082-45/+0
| | | | | | | | | | | | EFI_RESOURCE_MEMORY_UNACCEPTED has been officially defined in the PI 1.8 specification. So all temporary solutions have been replaced with the actual definition. Cc: Felix Polyudov <felixp@ami.com> Cc: Dhanaraj V <vdhanaraj@ami.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Sachin Ganesh <sachinganesh@ami.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg:BaseSpiHcPlatformLib: Adding NULL lib instanceBrit Chesley2024-05-081-0/+148
| | | | | | | | | | | | | | | | | | Adding NULL SpiHcPlatformLib instance. This library is responsible for handling the low level details of the SPI host controller. Since this is platform specific this library will be dependent on OEM SPI implementation. The SPI host controller layer will utilize this library for SPI bus transactions. Bugzilla #4753 Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Ray Ni <ray.ni@intel.com> Cc: Abner Chang <abner.chang@amd.com> Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> Signed-off-by: Brit Chesley <brit.chesley@amd.com> Acked-by: Abner Chang <abner.chang@amd.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/Core/Dxe: Set MemoryTypeInfo bin range from HOBMichael D Kinney2024-01-301-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide an optional method for PEI to declare a specific address range to use for the Memory Type Information bins. The current algorithm uses heuristics that tends to place the Memory Type Information bins in the same location, but memory configuration changes across boots or algorithm changes across a firmware updates could potentially change the Memory Type Information bin location. If the bin locations move across an S4 save/resume cycle, then the S4 resume may fail. Enabling this feature increases the number of scenarios that an S4 resume operation may succeed. If the HOB List contains a Resource Descriptor HOB that describes tested system memory and has an Owner GUID of gEfiMemoryTypeInformationGuid, then use the address range described by the Resource Descriptor HOB as the preferred location of the Memory Type Information bins. If this HOB is not detected, then the current behavior is preserved. The HOB with an Owner GUID of gEfiMemoryTypeInformationGuid is ignored for the following conditions: * The HOB with an Owner GUID of gEfiMemoryTypeInformationGuid is smaller than the Memory Type Information bins. * The HOB list contains more than one Resource Descriptor HOB with an owner GUID of gEfiMemoryTypeInformationGuid. * The Resource Descriptor HOB with an Owner GUID of gEfiMemoryTypeInformationGuid is the same Resource Descriptor HOB that that describes the PHIT memory range. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Aaron Li <aaron.li@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* MdeModulePkg: Support customized FV Migration InformationCheng Sun2023-12-251-1/+41
| | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4533 There are use cases which not all FVs need be migrated from TempRam to permanent memory before TempRam tears down. This new guid is introduced to avoid unnecessary FV migration to improve boot performance. Platform can publish MigrationInfo hob with this guid to customize FV migration info, and PeiCore will only migrate FVs indicated by this Hob info. This is a backwards compatible change, PeiCore will check MigrationInfo hob before migration. If MigrationInfo hobs exists, only migrate FVs recorded by hobs. If MigrationInfo hobs not exists, migrate all FVs to permanent memory. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Ray Ni <ray.ni@intel.com> Cc: Guomin Jiang <guomin.jiang@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Ray Ni <ray.ni@intel.com> Signed-off-by: Cheng Sun <chengx.sun@intel.com>
* MdeModulePkg: Update DumpImageRecord() in ImagePropertiesRecordLibTaylor Beebe2023-11-271-3/+3
| | | | | | | | | | | | | | | Update DumpImageRecord() to be DumpImageRecords(), and improve the debug output. The function will output at DEBUG_INFO instead, and the function will be run in DXE and SMM MAT logic when the MAT is installed at EndOfDxe on DEBUG builds. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Taylor Beebe <taylor.d.beebe@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Add Logic to Create/Delete Image Properties RecordsTaylor Beebe2023-11-271-0/+39
| | | | | | | | | | | | | Add logic to create and delete image properties records. Where applicable, redirect existing code to use the new library. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Taylor Beebe <taylor.d.beebe@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Transition SMM MAT Logic to Use ImagePropertiesRecordLibTaylor Beebe2023-11-271-0/+11
| | | | | | | | | | | | | | Now that the bugs are fixed in the MAT logic, we can remove the duplicate logic from PiSmmCore/MemoryAttributesTable.c and use ImagePropertiesRecordLib instead. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Taylor Beebe <taylor.d.beebe@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Add NULL checks and Return Status to ImagePropertiesRecordLibTaylor Beebe2023-11-271-66/+77
| | | | | | | | | | | | | Update function headers to clarify the contract of each function and improve readability. Add NULL checks to all functions that take a pointer as an argument. Add return status to functions that may need to return early due to invalid input. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Taylor Beebe <taylor.d.beebe@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Move Some DXE MAT Logic to ImagePropertiesRecordLibTaylor Beebe2023-11-271-0/+159
| | | | | | | | | | | Move some DXE MAT logic to ImagePropertiesRecordLib to consolidate code and enable unit testability. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Taylor Beebe <taylor.d.beebe@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Add ImagePropertiesRecordLibTaylor Beebe2023-11-271-0/+14
| | | | | | | | | | | | Create a library for manipulating image properties records. The library is currently blank and will be filled in a future patch to help with reviewer readability. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Taylor Beebe <taylor.d.beebe@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/VariablePolicy: Add more granular variable policy queryingMichael Kubacki2023-10-313-12/+267
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces two new APIs to EDKII_VARIABLE_POLICY_PROTOCOL: 1. GetVariablePolicyInfo() 2. GetLockOnVariableStateVariablePolicyInfo() These allow a caller to retrieve policy information associated with a UEFI variable given the variable name and vendor GUID. GetVariablePolicyInfo() - Returns the variable policy applied to the UEFI variable. If the variable policy is applied toward an individual UEFI variable, that name can optionally be returned. GetLockOnVariableStateVariablePolicyInfo() - Returns the Lock on Variable State policy applied to the UEFI variable. If the Lock on Variable State policy is applied to a specific variable name, that name can optionally be returned. These functions can be useful for a variety of purposes such as auditing, testing, and functional flows. Also fixed some variable name typos in code touched by the changes. Cc: Dandan Bi <dandan.bi@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Message-Id: <20231030203112.736-2-mikuback@linux.microsoft.com>
* MdeModulePkg/Include: API of IPMI Get System Interface CapabilitiesAbner Chang2023-10-261-0/+17
| | | | | | | | | | | Define the API for IPMI Get System Interface Capabilities command (0x57) Signed-off-by: Abner Chang <abner.chang@amd.com> Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Nickle Wang <nicklew@nvidia.com>
* MdeModulePkg: UsbRndis: get rid of magic valuesMike Maslenkin2023-10-161-0/+4
| | | | | | | | | | | Replace magic values used for checking Base Class, SubClass and Protocol fields of USB Interface Descriptor. Add definitions for Base Class EFh (Miscellaneous) and RNDIS subclass. These definitions were taken from https://www.usb.org/defined-class-codes Cc: Richard Ho <richardho@ami.com> Cc: Rebecca Cran <rebecca@bsdio.com> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
* MdeModulePkg: UsbNetwork: fix Ethernet functional descriptor processingMike Maslenkin2023-10-161-0/+2
| | | | | | | | | | | | | | | | | | | | This patch fixes wrong condition because of UINT16 value to integer promotion. NumberMcFilters is UINT16 value, so when bitwise shift operator applied to small integer type, the operation is preceded by integral promotion. This is described in MISRA-C:2004 guideline as Rule 10.5: "If the bitwise operators ~ and << are applied to an operand of underlying type unsigned char or unsigned short, the result shall be immediately cast to the underlying type of the operand." A simple fix for this issue would be the following: if ((UINT16)(UsbEthFunDescriptor.NumberMcFilters << 1) == 0) But this patch proposes to use bitwise AND operation with a proper bit mask rather than shifting to prevent similar mistakes in future. Cc: Richard Ho <richardho@ami.com> Cc: Rebecca Cran <rebecca@bsdio.com> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
* MdeModulePkg/Rng: Add GUID to describe unsafe Rng algorithmsPierre Gondois2023-09-081-0/+23
| | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4441 The EFI_RNG_PROTOCOL can rely on the RngLib. The RngLib has multiple implementations, some of them are unsafe (e.g. BaseRngLibTimerLib). To allow the RngDxe to detect when such implementation is used, a GetRngGuid() function is added in a following patch. Prepare GetRngGuid() return values and add a gEdkiiRngAlgorithmUnSafe to describe an unsafe implementation, cf. the BaseRngLibTimerLib. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Tested-by: Kun Qin <kun.qin@microsoft.com>
* MdeModulePkg: add MpService2Ppi field in SMM_S3_RESUME_STATEDun Tan2023-09-081-1/+2
| | | | | | | | | | | | | Add MpService2Ppi field in SMM_S3_RESUME_STATE of AcpiS3Context.h. It will be used to wakeup AP to do the CPU initialization during smm s3 boot flow in following patches. With this field, we can avoid sending InitSipiSipi to wakeup AP. Signed-off-by: Dun Tan <dun.tan@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis: Add USB RNDIS devices supportRichard Ho2023-07-131-0/+878
| | | | | | | | | | | | | | | | | | This driver provides UEFI driver for USB RNDIS device Signed-off-by: Richard Ho <richardho@ami.com> Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Tested-by: Tinh Nguyen <tinhnguyen@os.amperecomputing.com> Acked-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Tony Lo <tonylo@ami.com>
* MdeModulePkg: Define memory attribute PPIArd Biesheuvel2023-06-261-0/+83
| | | | | | | | | | | | | Define a PPI interface that may be used by the PEI core or other PEIMs to manage permissions on memory ranges. This is primarily intended for restricting permissions to what is actually needed for correct execution by the code in question, and for limiting the use of memory mappings that are both writable and executable at the same time. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Oliver Smith-Denny <osde@linux.microsoft.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Add TraceHubDebugSysTLib libraryGua Guo2023-05-111-0/+24
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4144 This Library provides API to dump Trace Hub message. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Guo Gua <gua.guo@intel.com> Cc: Chan Laura <laura.chan@intel.com> Cc: Prakashan Krishnadas Veliyathuparambil <krishnadas.veliyathuparambil.prakashan@intel.com> Cc: K N Karthik <karthik.k.n@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Guo Gua <gua.guo@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: K N Karthik <karthik.k.n@intel.com> Reviewed-by: Chan Laura <laura.chan@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/Include/Ppi: Add FirmwareVolumeShadowPpiUmang Patel2023-03-271-0/+61
| | | | | | | | | Add FirmwareVolumeShadow PPI to shadow an FV to memory. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Patel Umang <umang.patel@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg: Correct memory type in PrePiDxeCis.hDionna Glaze via groups.io2023-01-301-1/+1
| | | | | | | | | | | | | | The enumeration in MdePkg/Include/Pi/PiDxeCis.h has a duplicated entry, so the 8th position in the list doesn't count as index 7. The value EfiGcdMemoryTypeUnaccepted will have when added before EfiGcdMemoryTypeMaximum will be 6. Cc: Min M Xu <min.m.xu@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Dionna Glaze <dionnaglaze@google.com> Reviewed-by: Min Xu <min.m.xu@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/Include: Add IpmiCommandLib header fileAbner Chang2023-01-191-0/+683
| | | | | | | | | | | | | | | | | | | | | | | | Add IpmiCommandLib to MdeModulePkg. This header file is copied from edk2-platforms/Features/Intel/OutOfBandManagement/ IpmiFeaturePkg\Include\Library. Having this header file in edk2 to avoid the dependence of edk2 module with edk2-platfrom. The NULL instance of IpmiCommandLib under MdeModulePkg has to be implemented for the same reason. IpmiCommandLib.h in edk2-platforms should be removed once this patch set is merged. Expect no impacts on edk2-platforms because MdeModulePkg is referred in INF file by all edk2 modules under edk2-platforms that use IpmiCommandLib. Signed-off-by: Abner Chang <abner.chang@amd.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Nickle Wang <nicklew@nvidia.com> Cc: Igor Kulchytskyy <igork@ami.com> Cc: Isaac Oram <isaac.w.oram@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Reviewed-by: Isaac Oram <isaac.w.oram@intel.com> Reviewed-by: Igor Kulchytskyy <igork@ami.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdePkg: Add UEFI Unaccepted memory definitionMin M Xu2022-11-011-0/+25
| | | | | | | | | | | | | | | | | | | | RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3937 Plase refer to: UEFI Spec v2.9 Table 7-5 Memory Type Usage before ExitBootServices() Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Min Xu <min.m.xu@intel.com>
* MdeModulePkg: Add PrePiHob.hMin M Xu2022-11-011-0/+20
| | | | | | | | | | | | | | | | | | | | | RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3937 BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED is defined for unaccepted memory. But this defitinion has not been officially in the PI spec. Base on the code-first we define BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED at MdeModulePkg/Include/Pi/PrePiHob.h. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Ray Ni <ray.ni@intel.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Min Xu <min.m.xu@intel.com>
* MdeModulePkg: Move CPU_EXCEPTION_INIT_DATA to UefiCpuPkgLiu, Zhiguang2022-08-091-67/+0
| | | | | | | | | | | | | | | Since the API InitializeSeparateExceptionStacks is simplified and does't use the struct CPU_EXCEPTION_INIT_DATA, CPU_EXCEPTION_INIT_DATA become a inner implementation of CpuExcetionHandlerLib. Cc: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* UefiCpuPkg: Simplify InitializeSeparateExceptionStacksLiu, Zhiguang2022-08-091-6/+9
| | | | | | | | | | | | | | | | Hide the Exception implementation details in CpuExcetionHandlerLib and caller only need to provide buffer Cc: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* MdeModulePkg: Add EDKII_PCI_DEVICE_PPI definitionCzajkowski, Maciej2022-08-051-0/+32
| | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3907 This commit introduces EDKII_PCI_DEVICE_PPI. The purpose of this PPI is to provide a way of accessing PCI devices to drvice drivers such as NvmExpressPei or AhciPei. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Maciej Czajkowski <maciej.czajkowski@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg/Include: Long debug string is truncated to 104 charCosmo Lai2022-07-231-1/+9
| | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3986 The EFI_STATUS_CODE_DATA_MAX_SIZE is defined as 200 in MdeModulePkg. After reducing 96byte buffer for variable parameters it is limited to only 104 char debug string. This is a non-necessary limitation. This change sets EFI_STATUS_CODE_DATA_MAX_SIZE to 0x200, and moves MAX_EXTENDED_DATA_SIZE definition to the same header file with value of EFI_STATUS_CODE_DATA_MAX_SIZE + sizeof (EFI_STATUS_CODE_DATA) which is used in ReportStatusCodeLib to support longer debug string. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Cosmo Lai <cosmo.lai@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* CpuException: Add InitializeSeparateExceptionStacksRay Ni2022-06-101-18/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Today InitializeCpuExceptionHandlersEx is called from three modules: 1. DxeCore (links to DxeCpuExceptionHandlerLib) DxeCore expects it initializes the IDT entries as well as assigning separate stacks for #DF and #PF. 2. CpuMpPei (links to PeiCpuExceptionHandlerLib) and CpuDxe (links to DxeCpuExceptionHandlerLib) It's called for each thread for only assigning separate stacks for #DF and #PF. The IDT entries initialization is skipped because caller sets InitData->X64.InitDefaultHandlers to FALSE. Additionally, SecPeiCpuExceptionHandlerLib, SmmCpuExceptionHandlerLib also implement such API and the behavior of the API is simply to initialize IDT entries only. Because it mixes the IDT entries initialization and separate stacks assignment for certain exception handlers together, in order to know whether the function call only initializes IDT entries, or assigns stacks, we need to check: 1. value of InitData->X64.InitDefaultHandlers 2. library instance This patch cleans up the code to separate the stack assignment to a new API: InitializeSeparateExceptionStacks(). Only when caller calls the new API, the separate stacks are assigned. With this change, the SecPei and Smm instance can return unsupported which gives caller a very clear status. The old API InitializeCpuExceptionHandlersEx() is removed in this patch. Because no platform module is consuming the old API, the impact is none. Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com>
* CpuException: Remove InitializeCpuInterruptHandlersRay Ni2022-06-101-25/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | InitializeCpuExceptionHandlers() expects caller allocates IDT while InitializeCpuInterruptHandlers() allocates 256 IDT entries itself. InitializeCpuExceptionHandlers() fills max 32 IDT entries allocated by caller. If caller allocates 10 entries, the API just fills 10 IDT entries. The inconsistency between the two APIs makes code hard to unerstand and hard to share. Because there is only one caller (CpuDxe) for InitializeCpuInterruptHandler(), this patch updates CpuDxe driver to allocates 256 IDT entries then call InitializeCpuExceptionHandlers(). This is also a backward compatible change. With this change, InitializeCpuInterruptHandlers() is removed completely. And InitializeCpuExceptionHandlers() fills max 32 entries for PEI and SMM instance, max 256 entries for DXE instance. Such behavior matches to the original one. Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Eric Dong <eric.dong@intel.com>
* MdeModulePkg/UniversalPayload: Align Identifier value with UPL specGua Guo2022-05-271-1/+1
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3933 URL: https://universalpayload.github.io/documentation/ Currently, Identifier value is "UPLD", it needs to have correct value "PLDH" based on Universal Payload Specification spec section 2.12.2 Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Guo Dong <guo.dong@intel.com> Signed-off-by: Gua Guo <gua.guo@intel.com>
* MdeModulePkg/VariableFlashInfoLib: Add initial libraryMichael Kubacki2022-05-191-0/+68
| | | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3479 Adds a new library class VariableFlashInfoLib that abstracts access to variable flash information. The instance provided first attempts to retrieve information from the Variable Flash Info HOB. If that HOB is not present, it falls back to the PCDs defined in MdeModulePkg. This fall back behavior provides backward compatibility for platforms that only provide PCDs but also allows platforms that need to dynamically provide the information using the Variable Flash Info HOB to do so at runtime. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* MdeModulePkg: Add Variable Flash Info HOBMichael Kubacki2022-05-191-0/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3479 Adds a new GUID that is used to identify a HOB that passes variable flash information to UEFI variable drivers in HOB consumption phases such as DXE, Traditional MM, and Standalone MM. This information was previously passed directly with PCDs such as EfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase and gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize. However, the Standalone MM variable driver instance does not have direct access to the PCD database. Therefore, this HOB will first be considered as the source for variable flash information and if platforms do not produce the HOB, reading the information from the PCDs directly will be a backup to provide backward compatibility. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* MdeModulePkg: Add bRefClkFreq card attribute programming supportBandaru, Purna Chandra Rao2022-03-101-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3851 When the UFS card comes out of Manufacturer, bRefClkFreq attribute is set to 1h on the UFS card as per the Manufacturer Default Value specified by the spec JESD220*. However, depends on the UFS host system environment, it need to be set to the correct value. Reference Clock Frequency value 0h:19.2 MHz 1h: 26 MHz 2h: 38.4 MHz 3h: Obsolete Others: Reserved Cc: Wu Hao A <hao.a.wu@intel.com> Cc: Albecki Mateusz <mateusz.albecki@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Purna Chandra Rao Bandaru <purna.chandra.rao.bandaru@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg: Apply uncrustify changesMichael Kubacki2021-12-07155-1841/+1763
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Change OPTIONAL keyword usage styleMichael D Kinney2021-12-0713-48/+47
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3760 Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/PiSmmCore: Drop deprecated image profiling commandsMarvin H?user2021-09-011-3/+3
| | | | | | | | | | | | | The legacy codebase allowed SMM images to be registered for profiling from DXE. Support for this has been dropped entirely, so remove the remaining handlers. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Vitaly Cheptsov <vit9696@protonmail.com> Signed-off-by: Marvin H?user <mhaeuser@posteo.de>
* MdeModulePkg: Add BootDiscoveryPolicyOld variable.Grzegorz Bernacki2021-08-301-0/+1
| | | | | | | | | | | This variable is needed to track the change to BootDiscoveryPolicy variable. Boot options should be refreshed only if BootDiscoveryPolicy has been changed. Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com> Reviewed-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com> Acked-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg: Add BootDiscoveryPolicyUiLib.Grzegorz Bernacki2021-08-031-0/+22
| | | | | | | | | | | This library extends Boot Maintenance Menu and allows to select Boot Discovery Policy. When choice is made BootDiscoveryPolicy variable is set. Platform code can use this variable to decide which class of device shall be connected. Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sunny Wang <sunny.wang@arm.com>
* MdeModulePkg: Change the PldHeader to Header in ExtraData.hTan, Dun2021-07-131-1/+3
| | | | | | | | | | | | | | | Change the PldHeader to Header in UNIVERSAL_PAYLOAD_EXTRA_DATA The meaning of Pld is too general Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com> Acked-by: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: DunTan <dun.tan@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg: Add new structure for the Universal Payload Serial Port InfoZhiguang Liu2021-06-241-0/+30
| | | | | | | | | | | | Add Universal Payload Serial Port Info definition header file according to Universal Payload's documentation as below: https://universalpayload.github.io/documentation/ Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* MdeModulePkg/UniversalPayload: Add definition for extra info in payloadRay Ni2021-06-162-0/+52
| | | | | | | | | | | | | | The payload is in ELF format per the universal payload spec. UNIVERSAL_PAYLOAD_INFO_HEADER is stored in the ELF payload as a separate section named ".upld_info". Extra data needed by payload is stored in sections whose name starts with ".upld.". Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Maurice Ma <maurice.ma@intel.com> Cc: Guo Dong <guo.dong@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg: Add new structure for the Universal Payload ACPI Table HobZhiguang Liu2021-06-161-0/+30
| | | | | | | | | | Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Tested-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* MdeModulePkg: Add new structure for the Universal Payload SMBios Table HobZhiguang Liu2021-06-161-0/+30
| | | | | | | | | | Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Tested-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* MdeModulePkg: Add new structure for the PCI Root Bridge Info HobZhiguang Liu2021-06-161-0/+91
| | | | | | | | | | | | | | Also add ExceptionList in MdeModulePkg\MdeModulePkg.ci.yaml, to avoid open CI issue, because UID and HID are terms which are already used in current source code. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Tested-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* MdeModulePkg: Add Universal Payload general definition header fileZhiguang Liu2021-06-161-0/+35
| | | | | | | | | | | | | | Add Universal Payload general definition header file according to Universal Payload's documentation as below: https://universalpayload.github.io/documentation/ Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Tested-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* MdeModulePkg/Library: Add HiiGetStringEx to UefiHiiLib for EDK2 RedfishAbner Chang2021-02-051-13/+47
| | | | | | | | | | | | | | | | | | Add HiiGetStringEx and leveraged by HiiGetString function to support getting string with the best language in optionally. This avoids the string in x-uefi language is misled to the language defined by "PlatformLang" or the "Supported Languages". This change is introduced to support x-uefi keyword language for configuring BIOS setting. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Signed-off-by: Siyuan Fu <siyuan.fu@intel.com> Signed-off-by: Fan Wang <fan.wang@intel.com> Signed-off-by: Abner Chang <abner.chang@hpe.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Nickle Wang <nickle.wang@hpe.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Define the VarCheckPolicyLib and SMM interfaceBret Barkelew2020-11-171-0/+54
| | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2522 VariablePolicy is an updated interface to replace VarLock and VarCheckProtocol. This is an instance of a VarCheckLib that is backed by the VariablePolicyLib business logic. It also publishes the SMM calling interface for messages from the DXE protocol. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bret Barkelew <brbarkel@microsoft.com> Signed-off-by: Bret Barkelew <brbarkel@microsoft.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Acked-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg: Define the VariablePolicyHelperLibBret Barkelew2020-11-171-0/+164
| | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2522 VariablePolicy is an updated interface to replace VarLock and VarCheckProtocol. Add the VariablePolicyHelperLib library, containing several functions to help with the repetitive process of creating a correctly structured and packed VariablePolicy entry. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bret Barkelew <brbarkel@microsoft.com> Signed-off-by: Bret Barkelew <brbarkel@microsoft.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Acked-by: Jian J Wang <jian.j.wang@intel.com>