public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Gary Lin <glin@suse.com>
To: edk2-devel@lists.01.org
Cc: David Wei <david.wei@intel.com>
Subject: [PATCH v2 18/19] Vlv2TbltDevicePkg/PpmPolicy: Remove the usage of global variables
Date: Fri, 29 Jul 2016 11:25:37 +0800	[thread overview]
Message-ID: <20160729032538.17730-19-glin@suse.com> (raw)
In-Reply-To: <20160729032538.17730-1-glin@suse.com>

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 <david.wei@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: David Wei <david.wei@intel.com>
---
 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



  parent reply	other threads:[~2016-07-29  3:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-29  3:25 [PATCH v2 00/19] Fix Vlv2TbltDevicePkg gcc build Gary Lin
2016-07-29  3:25 ` [PATCH v2 01/19] Vlv2TbltDevicePkg: Amend the build script Gary Lin
2016-07-29  3:25 ` [PATCH v2 02/19] Vlv2TbltDevicePkg: Only define MDEPKG_NDEBUG for gcc release build Gary Lin
2016-07-29  7:42   ` Laszlo Ersek
2016-07-29  3:25 ` [PATCH v2 03/19] Vlv2TbltDevicePkg/MultiPlatformLib: Remove the unused variables Gary Lin
2016-07-29  3:25 ` [PATCH v2 04/19] Vlv2TbltDevicePkg/PlatformPei: Remove the unused variable Gary Lin
2016-07-29  3:25 ` [PATCH v2 05/19] Vlv2TbltDevicePkg/PlatformBdsLib: " Gary Lin
2016-07-29  3:25 ` [PATCH v2 06/19] Vlv2TbltDevicePkg/PlatformInitPei: Remove the unused variables Gary Lin
2016-07-29  3:25 ` [PATCH v2 07/19] Vlv2TbltDevicePkg/PlatformInitPei: Suppress the gcc error message Gary Lin
2016-07-29  3:25 ` [PATCH v2 08/19] Vlv2TbltDevicePkg/AcpiPlatform: Remove unused variables Gary Lin
2016-07-29  3:25 ` [PATCH v2 09/19] Vlv2TbltDevicePkg/AcpiPlatform: Amend the declaration of mGlobalNvsArea Gary Lin
2016-07-29  3:25 ` [PATCH v2 10/19] Vlv2TbltDevicePkg/PlatformGopPolicy: include UefiBootServicesTableLib.h Gary Lin
2016-07-29  3:25 ` [PATCH v2 11/19] Vlv2DeviceRefCodePkg/ValleyView2Soc: Remove the unused code Gary Lin
2016-07-29  3:25 ` [PATCH v2 12/19] Vlv2TbltDevicePkg/FvbRuntimeDxe: Remove unused variables Gary Lin
2016-07-29  3:25 ` [PATCH v2 13/19] Vlv2TbltDevicePkg/PlatformSetupDxe: Remove the " Gary Lin
2016-07-29  3:25 ` [PATCH v2 14/19] Vlv2TbltDevicePkg/VlvPlatformInitDxe: Remove " Gary Lin
2016-07-29  3:25 ` [PATCH v2 15/19] Vlv2TbltDevicePkg/PlatformDxe: Remove the " Gary Lin
2016-07-29  3:25 ` [PATCH v2 16/19] Vlv2TbltDevicePkg/Wpce791: Remove the unused variable Gary Lin
2016-07-29  3:25 ` [PATCH v2 17/19] Vlv2TbltDevicePkg/SmBiosMiscDxe: Remove unused variables Gary Lin
2016-07-29  3:25 ` Gary Lin [this message]
2016-07-29  3:25 ` [PATCH v2 19/19] Vlv2TbltDevicePkg/PpmPolicy: Remove the unused variable Gary Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160729032538.17730-19-glin@suse.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox