From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 B1227226EAC93 for ; Thu, 12 Apr 2018 01:50:38 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2018 01:50:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,440,1517904000"; d="scan'208";a="41415615" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by FMSMGA003.fm.intel.com with ESMTP; 12 Apr 2018 01:50:37 -0700 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Eric Dong , Laszlo Ersek Date: Thu, 12 Apr 2018 16:50:14 +0800 Message-Id: <20180412085014.107784-1-dandan.bi@intel.com> X-Mailer: git-send-email 2.14.3.windows.1 Subject: [patch] UefiCpuPkg/PiSmmCpuDxeSmm: Add "extern" keyword for "gPatchxxx" X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Apr 2018 08:50:38 -0000 Background description: In SmmProfileInternal.h, ECC check tool report an issue at line 103. Detailed ECC Error info:Variable definition appears in header file. Include files should contain only public or only private data and cannot contain code or define data variables ECC report similar issues in PiSmmCpuDxeSmm.h. Then we review all the new introduced "gPatchxxx", since they have been defined in the nasm file, we can add "extern" keyword for them in the C source or header files. Cc: Eric Dong Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi --- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 8 ++++---- UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h | 2 +- UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c | 6 +++--- UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h index 1d016594e02..bcfbab51144 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h @@ -295,16 +295,16 @@ WriteSaveStateRegister ( IN CONST VOID *Buffer ); extern CONST UINT8 gcSmmInitTemplate[]; extern CONST UINT16 gcSmmInitSize; -X86_ASSEMBLY_PATCH_LABEL gPatchSmmCr0; +extern X86_ASSEMBLY_PATCH_LABEL gPatchSmmCr0; extern UINT32 mSmmCr0; -X86_ASSEMBLY_PATCH_LABEL gPatchSmmCr3; +extern X86_ASSEMBLY_PATCH_LABEL gPatchSmmCr3; extern UINT32 mSmmCr4; -X86_ASSEMBLY_PATCH_LABEL gPatchSmmCr4; -X86_ASSEMBLY_PATCH_LABEL gPatchSmmInitStack; +extern X86_ASSEMBLY_PATCH_LABEL gPatchSmmCr4; +extern X86_ASSEMBLY_PATCH_LABEL gPatchSmmInitStack; /** Semaphore operation for all processor relocate SMMBase. **/ VOID diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h index 1613e9cd5cb..662814412b2 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h @@ -98,11 +98,11 @@ typedef struct { } SMM_PROFILE_ENTRY; extern SMM_S3_RESUME_STATE *mSmmS3ResumeState; extern UINTN gSmiExceptionHandlers[]; extern BOOLEAN mXdSupported; -X86_ASSEMBLY_PATCH_LABEL gPatchXdSupported; +extern X86_ASSEMBLY_PATCH_LABEL gPatchXdSupported; extern UINTN *mPFEntryCount; extern UINT64 (*mLastPFEntryValue)[MAX_PF_ENTRY_COUNT]; extern UINT64 *(*mLastPFEntryPointer)[MAX_PF_ENTRY_COUNT]; // diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c index 5c2eb9ab6a1..dddc2f12325 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c @@ -103,13 +103,13 @@ typedef struct { } CPU_SMM_SAVE_STATE_IO_WIDTH; /// /// Variables from SMI Handler /// -X86_ASSEMBLY_PATCH_LABEL gPatchSmbase; -X86_ASSEMBLY_PATCH_LABEL gPatchSmiStack; -X86_ASSEMBLY_PATCH_LABEL gPatchSmiCr3; +extern X86_ASSEMBLY_PATCH_LABEL gPatchSmbase; +extern X86_ASSEMBLY_PATCH_LABEL gPatchSmiStack; +extern X86_ASSEMBLY_PATCH_LABEL gPatchSmiCr3; extern volatile UINT8 gcSmiHandlerTemplate[]; extern CONST UINT16 gcSmiHandlerSize; // // Variables used by SMI Handler diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c index 87f595ddb8c..dfee5416161 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c @@ -13,12 +13,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "PiSmmCpuDxeSmm.h" -X86_ASSEMBLY_PATCH_LABEL gPatchSmmRelocationOriginalAddressPtr32; -X86_ASSEMBLY_PATCH_LABEL gPatchRebasedFlagAddr32; +extern X86_ASSEMBLY_PATCH_LABEL gPatchSmmRelocationOriginalAddressPtr32; +extern X86_ASSEMBLY_PATCH_LABEL gPatchRebasedFlagAddr32; UINTN mSmmRelocationOriginalAddress; volatile BOOLEAN *mRebasedFlag; /** -- 2.14.3.windows.1