From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (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 6B18C1A1E5C for ; Thu, 28 Jul 2016 20:26:40 -0700 (PDT) Received: from GaryWorkstation.apac.novell.com (ip-203-192-156-9.asianetcom.net [203.192.156.9]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Fri, 29 Jul 2016 05:26:37 +0200 From: Gary Lin To: edk2-devel@lists.01.org Cc: David Wei Date: Fri, 29 Jul 2016 11:25:37 +0800 Message-Id: <20160729032538.17730-19-glin@suse.com> X-Mailer: git-send-email 2.9.2 In-Reply-To: <20160729032538.17730-1-glin@suse.com> References: <20160729032538.17730-1-glin@suse.com> Subject: [PATCH v2 18/19] Vlv2TbltDevicePkg/PpmPolicy: Remove the usage of global variables X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2016 03:26:41 -0000 gcc issued the error of "multiple deifintion" since gBS was also defined in MdePkg/Library/UefiBootServicesTableLib. Actually those global variables, gBS, pBS, and pRS, in PpmPolicy.h were only used in one function. Besides, gBS and pRS were not really used. Remove gBS and pRS and declare pBS in PpmPolicyEntry() to satisfy gcc. Cc: David Wei Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin Reviewed-by: David Wei --- Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.c | 10 +++------- Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.h | 6 +----- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.c b/Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.c index 2f8996b..fb4e7fc 100644 --- a/Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.c +++ b/Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.c @@ -33,8 +33,6 @@ Abstract: #define EFI_CPUID_MODEL 0x00F0 #define EFI_CPUID_STEPPING 0x000F - - EFI_STATUS EFIAPI PpmPolicyEntry( @@ -42,6 +40,7 @@ PpmPolicyEntry( IN EFI_SYSTEM_TABLE *SystemTable ) { + EFI_BOOT_SERVICES *pBS; EFI_MP_SERVICES_PROTOCOL *MpService; EFI_CPUID_REGISTER Cpuid01 = { 0, 0, 0, 0}; EFI_HANDLE Handle; @@ -52,15 +51,12 @@ PpmPolicyEntry( PCH_STEPPING Stepping; - - gBS = SystemTable->BootServices; pBS = SystemTable->BootServices; - pRS = SystemTable->RuntimeServices; // // Set PPM policy structure to known value // - gBS->SetMem (&mDxePlatformPpmPolicy, sizeof(PPM_PLATFORM_POLICY_PROTOCOL), 0); + pBS->SetMem (&mDxePlatformPpmPolicy, sizeof(PPM_PLATFORM_POLICY_PROTOCOL), 0); // // Find the MpService Protocol @@ -147,7 +143,7 @@ PpmPolicyEntry( mDxePlatformPpmPolicy.S3RestoreMsrSwSmiNumber = S3_RESTORE_MSR_SW_SMI; Handle = NULL; - Status = gBS->InstallMultipleProtocolInterfaces ( + Status = pBS->InstallMultipleProtocolInterfaces ( &Handle, &gPpmPlatformPolicyProtocolGuid, &mDxePlatformPpmPolicy, diff --git a/Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.h b/Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.h index cd3676b..cc7bed7 100644 --- a/Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.h +++ b/Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.h @@ -31,10 +31,6 @@ PPM_PLATFORM_POLICY_PROTOCOL mDxePlatformPpmPolicy; #define ICH_DEVICE_ENABLE 1 #define ICH_DEVICE_DISABLE 0 -EFI_BOOT_SERVICES *gBS; -EFI_BOOT_SERVICES *pBS; -EFI_RUNTIME_SERVICES *pRS; - #define POWER_STATE_SWITCH_SMI 43 #define ENABLE_C_STATE_IO_REDIRECTION_SMI 70 #define DISABLE_C_STATE_IO_REDIRECTION_SMI 71 @@ -43,4 +39,4 @@ EFI_RUNTIME_SERVICES *pRS; #define ENABLE_P_STATE_HARDWARE_COORDINATION_SMI 74 #define DISABLE_P_STATE_HARDWARE_COORDINATION_SMI 75 #define S3_RESTORE_MSR_SW_SMI 48 -#define ENABLE_C6_RESIDENCY_SMI 76 \ No newline at end of file +#define ENABLE_C6_RESIDENCY_SMI 76 -- 2.9.2