* [PATCH v1 0/2] Add MM Configuration PPI definition to MdePkg @ 2021-06-18 9:48 Kun Qin 2021-06-18 9:48 ` [PATCH v1 1/2] MdePkg: MmConfiguration: Moved EFI_MM_RESERVED_MMRAM_REGION to PiMmCis.h Kun Qin 2021-06-18 9:48 ` [PATCH v1 2/2] MdePkg: MmConfiguration: Added definition of MM Configuration PPI Kun Qin 0 siblings, 2 replies; 5+ messages in thread From: Kun Qin @ 2021-06-18 9:48 UTC (permalink / raw) To: devel; +Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Michael Kubacki REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3440 EFI_PEI_MM_CONFIGURATION_PPI is defined since PI spec v1.5. This patch series added the interface definition and related GUIDs into MdePkg. On the other hand, EFI_MM_RESERVED_MMRAM_REGION is referenced by both MM Configuration PPI and Protocol definitions, but currently defined in Protocol/MmConfiguration.h. To avoid data strcuture entanglement during usage, the EFI_MM_RESERVED_MMRAM_REGION definition is moved to PiMmCis.h for common access for both MM Configuration PPI and Protocol. Patch v1 branch: https://github.com/kuqin12/edk2/tree/mm_config_ppi_v1 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Kun Qin (2): MdePkg: MmConfiguration: Moved EFI_MM_RESERVED_MMRAM_REGION to PiMmCis.h MdePkg: MmConfiguration: Added definition of MM Configuration PPI MdePkg/Include/Pi/PiMmCis.h | 16 +++++ MdePkg/Include/Ppi/MmConfiguration.h | 62 ++++++++++++++++++++ MdePkg/Include/Protocol/MmConfiguration.h | 16 ----- MdePkg/MdePkg.dec | 3 + 4 files changed, 81 insertions(+), 16 deletions(-) create mode 100644 MdePkg/Include/Ppi/MmConfiguration.h -- 2.31.1.windows.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 1/2] MdePkg: MmConfiguration: Moved EFI_MM_RESERVED_MMRAM_REGION to PiMmCis.h 2021-06-18 9:48 [PATCH v1 0/2] Add MM Configuration PPI definition to MdePkg Kun Qin @ 2021-06-18 9:48 ` Kun Qin 2021-06-21 1:22 ` 回复: [edk2-devel] " gaoliming 2021-06-18 9:48 ` [PATCH v1 2/2] MdePkg: MmConfiguration: Added definition of MM Configuration PPI Kun Qin 1 sibling, 1 reply; 5+ messages in thread From: Kun Qin @ 2021-06-18 9:48 UTC (permalink / raw) To: devel; +Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Michael Kubacki REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3440 The definition of EFI_MM_RESERVED_MMRAM_REGION, according to PI Spec 1.5 is also referenced in EFI_PEI_MM_CONFIGURATION_PPI. Defining this structure as is will enforce any potential usage of MM Configuration PPI interface to include <Protocol/MmConfiguration.h>. This change moves EFI_MM_RESERVED_MMRAM_REGION definition into PiMmCis.h, which is already included in Protocol/MmConfiguration.h. It also paves way for introducing Ppi/MmConfiguration.h with proper dependency. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Kun Qin <kuqin12@gmail.com> --- MdePkg/Include/Pi/PiMmCis.h | 16 ++++++++++++++++ MdePkg/Include/Protocol/MmConfiguration.h | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/MdePkg/Include/Pi/PiMmCis.h b/MdePkg/Include/Pi/PiMmCis.h index fdf0591a03d6..422a3ea6c2bb 100644 --- a/MdePkg/Include/Pi/PiMmCis.h +++ b/MdePkg/Include/Pi/PiMmCis.h @@ -242,6 +242,22 @@ VOID IN CONST EFI_MM_ENTRY_CONTEXT *MmEntryContext ); +/// +/// Structure describing a MMRAM region which cannot be used for the MMRAM heap. +/// +typedef struct _EFI_MM_RESERVED_MMRAM_REGION { + /// + /// Starting address of the reserved MMRAM area, as it appears while MMRAM is open. + /// Ignored if MmramReservedSize is 0. + /// + EFI_PHYSICAL_ADDRESS MmramReservedStart; + /// + /// Number of bytes occupied by the reserved MMRAM area. A size of zero indicates the + /// last MMRAM area. + /// + UINT64 MmramReservedSize; +} EFI_MM_RESERVED_MMRAM_REGION; + /// /// Management Mode System Table (MMST) /// diff --git a/MdePkg/Include/Protocol/MmConfiguration.h b/MdePkg/Include/Protocol/MmConfiguration.h index eeb94f64bdf7..d2fb6a13d4af 100644 --- a/MdePkg/Include/Protocol/MmConfiguration.h +++ b/MdePkg/Include/Protocol/MmConfiguration.h @@ -21,22 +21,6 @@ 0x26eeb3de, 0xb689, 0x492e, {0x80, 0xf0, 0xbe, 0x8b, 0xd7, 0xda, 0x4b, 0xa7 } \ } -/// -/// Structure describing a MMRAM region which cannot be used for the MMRAM heap. -/// -typedef struct _EFI_MM_RESERVED_MMRAM_REGION { - /// - /// Starting address of the reserved MMRAM area, as it appears while MMRAM is open. - /// Ignored if MmramReservedSize is 0. - /// - EFI_PHYSICAL_ADDRESS MmramReservedStart; - /// - /// Number of bytes occupied by the reserved MMRAM area. A size of zero indicates the - /// last MMRAM area. - /// - UINT64 MmramReservedSize; -} EFI_MM_RESERVED_MMRAM_REGION; - typedef struct _EFI_MM_CONFIGURATION_PROTOCOL EFI_MM_CONFIGURATION_PROTOCOL; /** -- 2.31.1.windows.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* 回复: [edk2-devel] [PATCH v1 1/2] MdePkg: MmConfiguration: Moved EFI_MM_RESERVED_MMRAM_REGION to PiMmCis.h 2021-06-18 9:48 ` [PATCH v1 1/2] MdePkg: MmConfiguration: Moved EFI_MM_RESERVED_MMRAM_REGION to PiMmCis.h Kun Qin @ 2021-06-21 1:22 ` gaoliming 2021-06-24 0:54 ` Kun Qin 0 siblings, 1 reply; 5+ messages in thread From: gaoliming @ 2021-06-21 1:22 UTC (permalink / raw) To: devel, kuqin12 Cc: 'Michael D Kinney', 'Zhiguang Liu', 'Michael Kubacki' Kun: There is one header file edk2\MdePkg\Include\PiMultiPhase.h for this purpose. Can you place the common definition to it? Thanks Liming > -----邮件原件----- > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Kun Qin > 发送时间: 2021年6月18日 17:48 > 收件人: devel@edk2.groups.io > 抄送: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao > <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>; > Michael Kubacki <michael.kubacki@microsoft.com> > 主题: [edk2-devel] [PATCH v1 1/2] MdePkg: MmConfiguration: Moved > EFI_MM_RESERVED_MMRAM_REGION to PiMmCis.h > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3440 > > The definition of EFI_MM_RESERVED_MMRAM_REGION, according to PI Spec > 1.5 > is also referenced in EFI_PEI_MM_CONFIGURATION_PPI. Defining this > structure as is will enforce any potential usage of MM Configuration PPI > interface to include <Protocol/MmConfiguration.h>. > > This change moves EFI_MM_RESERVED_MMRAM_REGION definition into > PiMmCis.h, > which is already included in Protocol/MmConfiguration.h. It also paves > way for introducing Ppi/MmConfiguration.h with proper dependency. > > Cc: Michael D Kinney <michael.d.kinney@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Cc: Zhiguang Liu <zhiguang.liu@intel.com> > Cc: Michael Kubacki <michael.kubacki@microsoft.com> > > Signed-off-by: Kun Qin <kuqin12@gmail.com> > --- > MdePkg/Include/Pi/PiMmCis.h | 16 ++++++++++++++++ > MdePkg/Include/Protocol/MmConfiguration.h | 16 ---------------- > 2 files changed, 16 insertions(+), 16 deletions(-) > > diff --git a/MdePkg/Include/Pi/PiMmCis.h b/MdePkg/Include/Pi/PiMmCis.h > index fdf0591a03d6..422a3ea6c2bb 100644 > --- a/MdePkg/Include/Pi/PiMmCis.h > +++ b/MdePkg/Include/Pi/PiMmCis.h > @@ -242,6 +242,22 @@ VOID > IN CONST EFI_MM_ENTRY_CONTEXT *MmEntryContext > ); > > +/// > +/// Structure describing a MMRAM region which cannot be used for the > MMRAM heap. > +/// > +typedef struct _EFI_MM_RESERVED_MMRAM_REGION { > + /// > + /// Starting address of the reserved MMRAM area, as it appears while > MMRAM is open. > + /// Ignored if MmramReservedSize is 0. > + /// > + EFI_PHYSICAL_ADDRESS MmramReservedStart; > + /// > + /// Number of bytes occupied by the reserved MMRAM area. A size of > zero indicates the > + /// last MMRAM area. > + /// > + UINT64 MmramReservedSize; > +} EFI_MM_RESERVED_MMRAM_REGION; > + > /// > /// Management Mode System Table (MMST) > /// > diff --git a/MdePkg/Include/Protocol/MmConfiguration.h > b/MdePkg/Include/Protocol/MmConfiguration.h > index eeb94f64bdf7..d2fb6a13d4af 100644 > --- a/MdePkg/Include/Protocol/MmConfiguration.h > +++ b/MdePkg/Include/Protocol/MmConfiguration.h > @@ -21,22 +21,6 @@ > 0x26eeb3de, 0xb689, 0x492e, {0x80, 0xf0, 0xbe, 0x8b, 0xd7, 0xda, 0x4b, > 0xa7 } \ > } > > -/// > -/// Structure describing a MMRAM region which cannot be used for the > MMRAM heap. > -/// > -typedef struct _EFI_MM_RESERVED_MMRAM_REGION { > - /// > - /// Starting address of the reserved MMRAM area, as it appears while > MMRAM is open. > - /// Ignored if MmramReservedSize is 0. > - /// > - EFI_PHYSICAL_ADDRESS MmramReservedStart; > - /// > - /// Number of bytes occupied by the reserved MMRAM area. A size of > zero indicates the > - /// last MMRAM area. > - /// > - UINT64 MmramReservedSize; > -} EFI_MM_RESERVED_MMRAM_REGION; > - > typedef struct _EFI_MM_CONFIGURATION_PROTOCOL > EFI_MM_CONFIGURATION_PROTOCOL; > > /** > -- > 2.31.1.windows.1 > > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 回复: [edk2-devel] [PATCH v1 1/2] MdePkg: MmConfiguration: Moved EFI_MM_RESERVED_MMRAM_REGION to PiMmCis.h 2021-06-21 1:22 ` 回复: [edk2-devel] " gaoliming @ 2021-06-24 0:54 ` Kun Qin 0 siblings, 0 replies; 5+ messages in thread From: Kun Qin @ 2021-06-24 0:54 UTC (permalink / raw) To: gaoliming, devel Cc: 'Michael D Kinney', 'Zhiguang Liu', 'Michael Kubacki' Hi Liming, Thanks for pointing it out. I will updated the patches shortly. Regards, Kun On 06/20/2021 18:22, gaoliming wrote: > Kun: > There is one header file edk2\MdePkg\Include\PiMultiPhase.h for this > purpose. Can you place the common definition to it? > > Thanks > Liming >> -----邮件原件----- >> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Kun Qin >> 发送时间: 2021年6月18日 17:48 >> 收件人: devel@edk2.groups.io >> 抄送: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao >> <gaoliming@byosoft.com.cn>; Zhiguang Liu <zhiguang.liu@intel.com>; >> Michael Kubacki <michael.kubacki@microsoft.com> >> 主题: [edk2-devel] [PATCH v1 1/2] MdePkg: MmConfiguration: Moved >> EFI_MM_RESERVED_MMRAM_REGION to PiMmCis.h >> >> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3440 >> >> The definition of EFI_MM_RESERVED_MMRAM_REGION, according to PI Spec >> 1.5 >> is also referenced in EFI_PEI_MM_CONFIGURATION_PPI. Defining this >> structure as is will enforce any potential usage of MM Configuration PPI >> interface to include <Protocol/MmConfiguration.h>. >> >> This change moves EFI_MM_RESERVED_MMRAM_REGION definition into >> PiMmCis.h, >> which is already included in Protocol/MmConfiguration.h. It also paves >> way for introducing Ppi/MmConfiguration.h with proper dependency. >> >> Cc: Michael D Kinney <michael.d.kinney@intel.com> >> Cc: Liming Gao <gaoliming@byosoft.com.cn> >> Cc: Zhiguang Liu <zhiguang.liu@intel.com> >> Cc: Michael Kubacki <michael.kubacki@microsoft.com> >> >> Signed-off-by: Kun Qin <kuqin12@gmail.com> >> --- >> MdePkg/Include/Pi/PiMmCis.h | 16 ++++++++++++++++ >> MdePkg/Include/Protocol/MmConfiguration.h | 16 ---------------- >> 2 files changed, 16 insertions(+), 16 deletions(-) >> >> diff --git a/MdePkg/Include/Pi/PiMmCis.h b/MdePkg/Include/Pi/PiMmCis.h >> index fdf0591a03d6..422a3ea6c2bb 100644 >> --- a/MdePkg/Include/Pi/PiMmCis.h >> +++ b/MdePkg/Include/Pi/PiMmCis.h >> @@ -242,6 +242,22 @@ VOID >> IN CONST EFI_MM_ENTRY_CONTEXT *MmEntryContext >> ); >> >> +/// >> +/// Structure describing a MMRAM region which cannot be used for the >> MMRAM heap. >> +/// >> +typedef struct _EFI_MM_RESERVED_MMRAM_REGION { >> + /// >> + /// Starting address of the reserved MMRAM area, as it appears while >> MMRAM is open. >> + /// Ignored if MmramReservedSize is 0. >> + /// >> + EFI_PHYSICAL_ADDRESS MmramReservedStart; >> + /// >> + /// Number of bytes occupied by the reserved MMRAM area. A size of >> zero indicates the >> + /// last MMRAM area. >> + /// >> + UINT64 MmramReservedSize; >> +} EFI_MM_RESERVED_MMRAM_REGION; >> + >> /// >> /// Management Mode System Table (MMST) >> /// >> diff --git a/MdePkg/Include/Protocol/MmConfiguration.h >> b/MdePkg/Include/Protocol/MmConfiguration.h >> index eeb94f64bdf7..d2fb6a13d4af 100644 >> --- a/MdePkg/Include/Protocol/MmConfiguration.h >> +++ b/MdePkg/Include/Protocol/MmConfiguration.h >> @@ -21,22 +21,6 @@ >> 0x26eeb3de, 0xb689, 0x492e, {0x80, 0xf0, 0xbe, 0x8b, 0xd7, 0xda, > 0x4b, >> 0xa7 } \ >> } >> >> -/// >> -/// Structure describing a MMRAM region which cannot be used for the >> MMRAM heap. >> -/// >> -typedef struct _EFI_MM_RESERVED_MMRAM_REGION { >> - /// >> - /// Starting address of the reserved MMRAM area, as it appears while >> MMRAM is open. >> - /// Ignored if MmramReservedSize is 0. >> - /// >> - EFI_PHYSICAL_ADDRESS MmramReservedStart; >> - /// >> - /// Number of bytes occupied by the reserved MMRAM area. A size of >> zero indicates the >> - /// last MMRAM area. >> - /// >> - UINT64 MmramReservedSize; >> -} EFI_MM_RESERVED_MMRAM_REGION; >> - >> typedef struct _EFI_MM_CONFIGURATION_PROTOCOL >> EFI_MM_CONFIGURATION_PROTOCOL; >> >> /** >> -- >> 2.31.1.windows.1 >> >> >> >> >> > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 2/2] MdePkg: MmConfiguration: Added definition of MM Configuration PPI 2021-06-18 9:48 [PATCH v1 0/2] Add MM Configuration PPI definition to MdePkg Kun Qin 2021-06-18 9:48 ` [PATCH v1 1/2] MdePkg: MmConfiguration: Moved EFI_MM_RESERVED_MMRAM_REGION to PiMmCis.h Kun Qin @ 2021-06-18 9:48 ` Kun Qin 1 sibling, 0 replies; 5+ messages in thread From: Kun Qin @ 2021-06-18 9:48 UTC (permalink / raw) To: devel; +Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Michael Kubacki REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3440 MM Configuration PPI was defined in PI Specification since v1.5. This change added definition of such PPI and related GUIDs into MdePkg. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Kun Qin <kuqin12@gmail.com> --- MdePkg/Include/Ppi/MmConfiguration.h | 62 ++++++++++++++++++++ MdePkg/MdePkg.dec | 3 + 2 files changed, 65 insertions(+) diff --git a/MdePkg/Include/Ppi/MmConfiguration.h b/MdePkg/Include/Ppi/MmConfiguration.h new file mode 100644 index 000000000000..f950322b3877 --- /dev/null +++ b/MdePkg/Include/Ppi/MmConfiguration.h @@ -0,0 +1,62 @@ +/** @file + EFI MM Configuration PPI as defined in PI 1.5 specification. + + This PPI is used to: + 1) report the portions of MMRAM regions which cannot be used for the MMRAM heap. + 2) register the MM Foundation entry point with the processor code. The entry + point will be invoked by the MM processor entry code. + + Copyright (c) Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef MM_CONFIGURATION_PPI_H_ +#define MM_CONFIGURATION_PPI_H_ + +#include <Pi/PiMmCis.h> + +#define EFI_PEI_MM_CONFIGURATION_PPI_GUID \ + { \ + 0xc109319, 0xc149, 0x450e, { 0xa3, 0xe3, 0xb9, 0xba, 0xdd, 0x9d, 0xc3, 0xa4 } \ + } + +typedef struct _EFI_PEI_MM_CONFIGURATION_PPI EFI_PEI_MM_CONFIGURATION_PPI; + +/** + This function registers the MM Foundation entry point with the processor code. This entry point will be + invoked by the MM Processor entry code as defined in PI specification. + + @param[in] This The EFI_PEI_MM_CONFIGURATION_PPI instance. + @param[in] MmEntryPoint MM Foundation entry point. + + @retval EFI_SUCCESS The entry-point was successfully registered. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PEI_MM_REGISTER_MM_ENTRY) ( + IN CONST EFI_PEI_MM_CONFIGURATION_PPI *This, + IN EFI_MM_ENTRY_POINT MmEntryPoint + ); + +/// +/// This PPI is a PPI published by a CPU PEIM to indicate which areas within MMRAM are reserved for use by +/// the CPU for any purpose, such as stack, save state or MM entry point. If a platform chooses to let a CPU +/// PEIM do MMRAM relocation, this PPI must be produced by this CPU PEIM. +/// +/// The MmramReservedRegions points to an array of one or more EFI_MM_RESERVED_MMRAM_REGION structures, with +/// the last structure having the MmramReservedSize set to 0. An empty array would contain only the last +/// structure. +/// +/// The RegisterMmEntry() function allows the MM IPL PEIM to register the MM Foundation entry point with the +/// MM entry vector code. +/// +struct _EFI_PEI_MM_CONFIGURATION_PPI { + EFI_MM_RESERVED_MMRAM_REGION *MmramReservedRegions; + EFI_PEI_MM_REGISTER_MM_ENTRY RegisterMmEntry; +}; + +extern EFI_GUID gEfiPeiMmConfigurationPpi; + +#endif diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index b49f88d8e18f..c5319fdd71ca 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -983,6 +983,9 @@ [Ppis] ## Include/Ppi/MmControl.h gEfiPeiMmControlPpiGuid = { 0x61c68702, 0x4d7e, 0x4f43, { 0x8d, 0xef, 0xa7, 0x43, 0x5, 0xce, 0x74, 0xc5 }} + ## Include/Ppi/MmConfiguration.h + gEfiPeiMmConfigurationPpi = { 0xc109319, 0xc149, 0x450e, { 0xa3, 0xe3, 0xb9, 0xba, 0xdd, 0x9d, 0xc3, 0xa4 } } + # # PPIs defined in PI 1.7. # -- 2.31.1.windows.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-06-24 0:54 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-06-18 9:48 [PATCH v1 0/2] Add MM Configuration PPI definition to MdePkg Kun Qin 2021-06-18 9:48 ` [PATCH v1 1/2] MdePkg: MmConfiguration: Moved EFI_MM_RESERVED_MMRAM_REGION to PiMmCis.h Kun Qin 2021-06-21 1:22 ` 回复: [edk2-devel] " gaoliming 2021-06-24 0:54 ` Kun Qin 2021-06-18 9:48 ` [PATCH v1 2/2] MdePkg: MmConfiguration: Added definition of MM Configuration PPI Kun Qin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox