From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B2A672095B093 for ; Sun, 8 Oct 2017 23:52:14 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Oct 2017 23:55:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,499,1500966000"; d="scan'208";a="1180068585" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga001.jf.intel.com with ESMTP; 08 Oct 2017 23:55:40 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 8 Oct 2017 23:55:40 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 8 Oct 2017 23:55:40 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.98]) with mapi id 14.03.0319.002; Mon, 9 Oct 2017 14:55:38 +0800 From: "Zeng, Star" To: Laszlo Ersek , edk2-devel-01 CC: "Dong, Eric" , "Yao, Jiewen" , Ladi Prosek , "Zeng, Star" Thread-Topic: [PATCH 2/6] MdeModulePkg/Variable/RuntimeDxe: move MOR func. declarations to header Thread-Index: AQHTPI6heGqE39lprk6vneJcoL9Bf6LbC3Mg Date: Mon, 9 Oct 2017 06:55:37 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B97F2D1@shsmsx102.ccr.corp.intel.com> References: <20171003212834.25740-1-lersek@redhat.com> <20171003212834.25740-3-lersek@redhat.com> In-Reply-To: <20171003212834.25740-3-lersek@redhat.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 2/6] MdeModulePkg/Variable/RuntimeDxe: move MOR func. declarations to header X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Oct 2017 06:52:14 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Minor comment: How about also to fix the comment for Attributes parameter of SetVariableCh= eckHandlerMor() like below? @param[in] Attributes Attributes bitmask to set for the variable= . Thanks, Star -----Original Message----- From: Laszlo Ersek [mailto:lersek@redhat.com]=20 Sent: Wednesday, October 4, 2017 5:29 AM To: edk2-devel-01 Cc: Dong, Eric ; Yao, Jiewen ; L= adi Prosek ; Zeng, Star Subject: [PATCH 2/6] MdeModulePkg/Variable/RuntimeDxe: move MOR func. decla= rations to header The MorLockInit() and SetVariableCheckHandlerMor() functions have separate = implementations for VariableRuntimeDxe (=3D unprivileged, unified DXE_RUNTI= ME driver) and VariableSmm (=3D privileged, DXE_SMM back-end of the split v= ariable driver). Move their declarations from "Variable.c" to "PrivilegePolymorphic.h", so t= hat the compiler enforce that the declarations and the definitions match. (All C source files with the call sites and the function definitions alread= y include "PrivilegePolymorphic.h" via "Variable.h".) At the same time: - replace two typos in the MorLockInit() description: - replace "EFI_SUCEESS" with "EFI_SUCCESS", - replace "MOR Lock Control" with "MOR Control Lock"; - in the SetVariableCheckHandlerMor() description: - replace @param with @param[in], - rewrap the comment to 80 columns. This change cleans up commit 2f6aa774fe38 ("MdeModulePkg: Add MorLock to va= riable driver.", 2016-01-19). Cc: Eric Dong Cc: Jiewen Yao Cc: Ladi Prosek Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek --- MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h | 41 +++= +++++++++++++++++ MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c | 30 +++= ++++------- MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c | 30 +++= ++++------- MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 37 ---= --------------- 4 files changed, 75 insertions(+), 63 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphi= c.h b/MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h index 0aa0d4f48f10..1118f4b52e49 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h @@ -35,4 +35,45 @@ SecureBootHook ( IN EFI_GUID *VendorGuid ); =20 +/** + Initialization for MOR Control Lock. + + @retval EFI_SUCCESS MorLock initialization success. + @return Others Some error occurs. +**/ +EFI_STATUS +MorLockInit ( + VOID + ); + +/** + This service is an MOR/MorLock checker handler for the SetVariable(). + + @param[in] VariableName the name of the vendor's variable, as a + Null-Terminated Unicode String + @param[in] VendorGuid Unify identifier for vendor. + @param[in] Attributes Point to memory location to return the attribut= es of + variable. If the point is NULL, the parameter w= ould + be ignored. + @param[in] DataSize The size in bytes of Data-Buffer. + @param[in] Data Point to the content of the variable. + + @retval EFI_SUCCESS The MOR/MorLock check pass, and Variable + driver can store the variable data. + @retval EFI_INVALID_PARAMETER The MOR/MorLock data or data size or + attributes is not allowed for MOR variab= le. + @retval EFI_ACCESS_DENIED The MOR/MorLock is locked. + @retval EFI_ALREADY_STARTED The MorLock variable is handled inside t= his + function. Variable driver can just retur= n + EFI_SUCCESS. +**/ +EFI_STATUS +SetVariableCheckHandlerMor ( + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + IN UINT32 Attributes, + IN UINTN DataSize, + IN VOID *Data + ); + #endif diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c b/M= deModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c index c32eb3b1ac4b..ab3e5d416cd4 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockDxe.c @@ -28,19 +28,23 @@ extern EDKII_VARIABLE_LOCK_PROTOCOL mVariableLock; /** This service is an MOR/MorLock checker handler for the SetVariable(). =20 - @param VariableName the name of the vendor's variable, as a - Null-Terminated Unicode String - @param VendorGuid Unify identifier for vendor. - @param Attributes Point to memory location to return the attributes o= f variable. If the point - is NULL, the parameter would be ignored. - @param DataSize The size in bytes of Data-Buffer. - @param Data Point to the content of the variable. + @param[in] VariableName the name of the vendor's variable, as a + Null-Terminated Unicode String + @param[in] VendorGuid Unify identifier for vendor. + @param[in] Attributes Point to memory location to return the attribut= es of + variable. If the point is NULL, the parameter w= ould + be ignored. + @param[in] DataSize The size in bytes of Data-Buffer. + @param[in] Data Point to the content of the variable. =20 - @retval EFI_SUCCESS The MOR/MorLock check pass, and Variable= driver can store the variable data. - @retval EFI_INVALID_PARAMETER The MOR/MorLock data or data size or att= ributes is not allowed for MOR variable. + @retval EFI_SUCCESS The MOR/MorLock check pass, and Variable + driver can store the variable data. + @retval EFI_INVALID_PARAMETER The MOR/MorLock data or data size or + attributes is not allowed for MOR variab= le. @retval EFI_ACCESS_DENIED The MOR/MorLock is locked. - @retval EFI_ALREADY_STARTED The MorLock variable is handled inside t= his function. - Variable driver can just return EFI_SUCC= ESS. + @retval EFI_ALREADY_STARTED The MorLock variable is handled inside t= his + function. Variable driver can just retur= n + EFI_SUCCESS. **/ EFI_STATUS SetVariableCheckHandlerMor ( @@ -58,9 +62,9 @@ SetVariableCheckHandlerMor ( } =20 /** - Initialization for MOR Lock Control. + Initialization for MOR Control Lock. =20 - @retval EFI_SUCEESS MorLock initialization success. + @retval EFI_SUCCESS MorLock initialization success. @return Others Some error occurs. **/ EFI_STATUS diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c b/M= deModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c index d06317ca9cf4..390c8fde4bd4 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c @@ -309,19 +309,23 @@ SetVariableCheckHandlerMorLock ( /** This service is an MOR/MorLock checker handler for the SetVariable(). =20 - @param VariableName the name of the vendor's variable, as a - Null-Terminated Unicode String - @param VendorGuid Unify identifier for vendor. - @param Attributes Point to memory location to return the attributes o= f variable. If the point - is NULL, the parameter would be ignored. - @param DataSize The size in bytes of Data-Buffer. - @param Data Point to the content of the variable. + @param[in] VariableName the name of the vendor's variable, as a + Null-Terminated Unicode String + @param[in] VendorGuid Unify identifier for vendor. + @param[in] Attributes Point to memory location to return the attribut= es of + variable. If the point is NULL, the parameter w= ould + be ignored. + @param[in] DataSize The size in bytes of Data-Buffer. + @param[in] Data Point to the content of the variable. =20 - @retval EFI_SUCCESS The MOR/MorLock check pass, and Variable= driver can store the variable data. - @retval EFI_INVALID_PARAMETER The MOR/MorLock data or data size or att= ributes is not allowed for MOR variable. + @retval EFI_SUCCESS The MOR/MorLock check pass, and Variable + driver can store the variable data. + @retval EFI_INVALID_PARAMETER The MOR/MorLock data or data size or + attributes is not allowed for MOR variab= le. @retval EFI_ACCESS_DENIED The MOR/MorLock is locked. - @retval EFI_ALREADY_STARTED The MorLock variable is handled inside t= his function. - Variable driver can just return EFI_SUCC= ESS. + @retval EFI_ALREADY_STARTED The MorLock variable is handled inside t= his + function. Variable driver can just retur= n + EFI_SUCCESS. **/ EFI_STATUS SetVariableCheckHandlerMor ( @@ -377,9 +381,9 @@ SetVariableCheckHandlerMor ( } =20 /** - Initialization for MOR Lock Control. + Initialization for MOR Control Lock. =20 - @retval EFI_SUCEESS MorLock initialization success. + @retval EFI_SUCCESS MorLock initialization success. @return Others Some error occurs. **/ EFI_STATUS diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeMod= ulePkg/Universal/Variable/RuntimeDxe/Variable.c index 28e4ac8f3819..d68dfbe648ce 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -97,43 +97,6 @@ AUTH_VAR_LIB_CONTEXT_IN mAuthContextIn =3D { =20 AUTH_VAR_LIB_CONTEXT_OUT mAuthContextOut; =20 -/** - Initialization for MOR Lock Control. - - @retval EFI_SUCEESS MorLock initialization success. - @return Others Some error occurs. -**/ -EFI_STATUS -MorLockInit ( - VOID - ); - -/** - This service is an MOR/MorLock checker handler for the SetVariable(). - - @param VariableName the name of the vendor's variable, as a - Null-Terminated Unicode String - @param VendorGuid Unify identifier for vendor. - @param Attributes Point to memory location to return the attributes o= f variable. If the point - is NULL, the parameter would be ignored. - @param DataSize The size in bytes of Data-Buffer. - @param Data Point to the content of the variable. - - @retval EFI_SUCCESS The MOR/MorLock check pass, and Variable= driver can store the variable data. - @retval EFI_INVALID_PARAMETER The MOR/MorLock data or data size or att= ributes is not allowed for MOR variable. - @retval EFI_ACCESS_DENIED The MOR/MorLock is locked. - @retval EFI_ALREADY_STARTED The MorLock variable is handled inside t= his function. - Variable driver can just return EFI_SUCC= ESS. -**/ -EFI_STATUS -SetVariableCheckHandlerMor ( - IN CHAR16 *VariableName, - IN EFI_GUID *VendorGuid, - IN UINT32 Attributes, - IN UINTN DataSize, - IN VOID *Data - ); - /** Routine used to track statistical information about variable usage. The data is stored in the EFI system table so it can be accessed later. -- 2.14.1.3.gb7cf6e02401b