summaryrefslogtreecommitdiffstats
path: root/PrmPkg/PrmLoaderDxe
Commit message (Collapse)AuthorAgeFilesLines
* PrmPkg: Apply uncrustify changesMichael Kubacki2022-04-052-120/+125
| | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in PrmPkg. Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
* PrmPkg: Replace PcdPrmPlatformGuid with EDKII_DSC_PLATFORM_GUIDMichael Kubacki2022-04-052-8/+5
| | | | | | | | | | | | | | | | | | | | | | | Bugzilla request https://bugzilla.tianocore.org/show_bug.cgi?id=2969 was recently completed which causes the PLATFORM_GUID value from the DSC file to be placed into Autogen file .c & .h files. With this change, the PRM Platform GUID can be directly matched to the DSC PLATFORM_GUID value. Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
* PrmPkg: Add PlatformGuidMichael Kubacki2022-04-053-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | Adds a "platform GUID" field to the PRM ACPI table. This field is used by a platform to uniquely identify itself such that it can be targeted by runtime PRM module updates for that platform. Platforms using PRM are currently required to set a unique value for gPrmPkgTokenSpaceGuid.PcdPrmPlatformGuid in their platform DSC. Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
* PrmPkg: Enforce stricter typesMichael Kubacki2022-04-051-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes the following changes to enforce stricter types: 1. PrmPkg/PrmConfigDxe The function PrmConfigEndOfDxeNotification () is used as a notify function (of type EFI_EVENT_NOTIFY), however it has a return type of EFI_STATUS whereas the return type should actually be VOID. 2. PrmPkg/PrmLoaderDxe Updates the following types to be more accurate than were allowed in the VS compiler: * 3rd actual argument given to GetModuleContextBuffers () is explicitly marked as CONST PRM_MODULE_CONTEXT_BUFFERS ** * 3rd actual argument given to GetContextBuffer () is explicitly marked as CONST PRM_CONTEXT_BUFFER ** * PrmLoaderEndOfDxeNotification () return type is changed to VOID to align with the EFI_EVENT_NOTIFY type 3. PrmPkg/Application/PrmInfo Updates the following types to be more accurate than were allowed in the VS compiler: * SHELL_STATUS in ParseParameterList () is now EFI_STATUS * 3rd actual argument given to GetModuleContextBuffers () is explicitly marked as CONST PRM_MODULE_CONTEXT_BUFFERS ** * 3rd actual argument given to GetContextBuffer () is explicitly marked as CONST PRM_CONTEXT_BUFFER ** Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
* PrmPkg: Refactor some PrmLoaderDxe functionality into librariesMichael Kubacki2022-04-053-636/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change breaks out two sets of responsibilities in PrmLoaderDxe into libraries: * PE/COFF functions -> PrmPeCoffLib * PRM module discovery functions -> PrmModuleDiscoveryLib This is core infrastructure code for PRM functionality that needs to be directly reused and tested in other places. At this time, the primary motivating factor is to use this code in two other locations: 1.) Link the functionality into unit testing modules 2.) Link the functionality into a PRM UEFI application Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
* PrmPkg/PrmLoaderDxe: Add ACPI parameter buffer supportMichael Kubacki2022-04-051-0/+17
| | | | | | | | | | | | | | | | | | | | | Adds support to PrmLoaderDxe to move the ACPI parameter buffer address for a given PRM handler to the corresponding field in the PRM handler information structure (PRMT ACPI table). Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
* PrmPkg: Remove ALLOCATE_CONTEXT_BUFFER_IN_FW build flagMichael Kubacki2022-04-052-10/+0
| | | | | | | | | | | | | | | | | | | | | The POR is firmly to use an OS allocated context buffer now so the build flag that allows firmware to allocate the context buffer is removed along with supporting code. Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
* PrmPkg: Remove PRM Module Update LockMichael Kubacki2022-04-052-20/+0
| | | | | | | | | | | | | | | | | | | | | | | | Per latest design direction, we've abandoned treating the PRM Module Update Lock as an exported object. There was concern sharing the PRM module address space (where the lock structure resided in a data section) with the OS kernel mode driver. The lock will now be entirely maintained in OS context with interaces to control the lock available to ASL (for _DSM invocation) and OS native code (for direct call). Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
* PrmPkg: Add initial PrmSsdtInstallDxe moduleMichael Kubacki2022-04-053-123/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a new module that installs a PRM SSDT. Note: A library class would allow a high degree of flexibility for platforms that choose: 1. To not install a PRM SSDT at all (using a NULL library instance) 2. To install a specific PRM SSDT implementation However, it is implemented as a driver since build tools are not linking ACPI tables to drivers from linked library classes. Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
* PrmPkg: Publish PRM operation region to support PRM ACPI _DSM invocationLiu2022-04-053-0/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A PRM Handler has a 1-to-1 mapping to the corresponding _DSM method. The UUID of the _DSM Method will be passed by the ASL code to the OpRegionHandler which will look up the PRMT Table to extract the pointer of the corresponding PRM Handler. PRM loader pre-builds an SSDT that includes this PRM operation region. In boot time, the PRM loader will load and publish this SSDT, so that in OS runtime ACPI _DSM can invoke the PRM handler by pass the UUID to PRM operation region. The pre-build SSDT also includes a PRMT device as a Sample ACPI _DSM to invoke PRM handler. Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Liu Yun <yun.y.liu@intel.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
* PrmPkg: Enable variable growth for the PRM_MODULE_EXPORT macroMichael Kubacki2022-04-051-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PRM_MODULE_EXPORT parameterized macro allows a caller to produce a static PRM module export descriptor structure in the binary by simply passing PRM_HANDLER_EXPORT_ENTRY arguments with each argument representing a PRM handler to be exported by the module. Previously, the PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT used in the PRM_MODULE_EXPORT macro was fixed to a maximum of three handlers. This change removes that restriction and allows the structure to grow based on the number of PRM handlers given to the macro. This means a local type will be customized per PRM module. The reference type PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT keeps a field at the end that allows array access to PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT members. Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
* PrmPkg: Add ALLOCATE_CONTEXT_BUFFER_IN_FW build optionMichael Kubacki2022-04-052-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's currently two approaches being considered for how to allocate the context buffer passed to PRM handlers: 1. The context buffer is allocated and populated in firmware. As such, the FW converts all pointers internal to the buffer to virtual memory addresses at the virtual address change event. A single context buffer pointer is given to the OS via the PRM ACPI table and the OS converts this single physical address to a virtual address when it passes the context buffer as a pointer to PRM handlers. 2. The context buffer is allocated and populated in the OS. The OS gets all the information needed to populate the context buffer from other pre-existing resources (mainly physical addresses in the PRM ACPI table). The OS converts all the physical addresses to virtual addresses, allocates the context buffer instances, and fills in the information. The OS passes the context buffer virtual address to PRM handlers. The prior behavior was (1). The current POR behavior has moved to (2). Until (2) is used more widely, it can be kept around with fairly minimal overhead via a build flag in a few places. So the default behavior is now (2) (the expected permanent behavior) with (1) easily enabled by defining "ALLOCATE_CONTEXT_BUFFER_IN_FW" in the compiler defined macros. A DSC define was added in PrmPkg.dsc to set this compiler macro in the package build. At some point in the future, all code (and some peripheral code) surrounded with this build flag can be removed if (2) is fully decided upon. Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
* PrmPkg/PrmConfigDxe: Add initial driverMichael Kubacki2022-04-054-0/+1132
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3812 This driver serves as a generic PRM configuration driver. Its primary role is to prepare PRM resources published by PRM module configuration libraries for OS runtime. As such, it locates all PRM Configuration Protocol instances and consumes the information to ready those resources. For example, set runtime memory attributes on MMIO ranges and convert physical addresses to virtual addresses in PRM buffers. Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>