]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Vlv2TbltDevicePkg/PpmPolicy: Remove the usage of global variables
authorGary Lin <glin@suse.com>
Fri, 29 Jul 2016 03:25:37 +0000 (11:25 +0800)
committerdavid wei <david.wei@intel.com>
Wed, 3 Aug 2016 03:08:33 +0000 (11:08 +0800)
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
Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.h

index 2f8996bc1a58fa73ef6c968b0abbce33b7239197..fb4e7fc87b92936a8d8da4bf479e42380a2d5493 100644 (file)
@@ -33,8 +33,6 @@ Abstract:
 #define EFI_CPUID_MODEL                       0x00F0\r
 #define EFI_CPUID_STEPPING                    0x000F\r
 \r
-\r
-\r
 EFI_STATUS \r
 EFIAPI\r
 PpmPolicyEntry(\r
@@ -42,6 +40,7 @@ PpmPolicyEntry(
   IN EFI_SYSTEM_TABLE *SystemTable\r
 )\r
 {\r
+  EFI_BOOT_SERVICES        *pBS;\r
   EFI_MP_SERVICES_PROTOCOL *MpService;\r
   EFI_CPUID_REGISTER        Cpuid01 = { 0, 0, 0, 0};\r
   EFI_HANDLE                Handle;\r
@@ -52,15 +51,12 @@ PpmPolicyEntry(
 \r
   PCH_STEPPING              Stepping;\r
 \r
-\r
-  gBS = SystemTable->BootServices;\r
   pBS = SystemTable->BootServices;\r
-  pRS = SystemTable->RuntimeServices;\r
 \r
   //\r
   // Set PPM policy structure to known value\r
   //\r
-  gBS->SetMem (&mDxePlatformPpmPolicy, sizeof(PPM_PLATFORM_POLICY_PROTOCOL), 0);\r
+  pBS->SetMem (&mDxePlatformPpmPolicy, sizeof(PPM_PLATFORM_POLICY_PROTOCOL), 0);\r
 \r
   //\r
   // Find the MpService Protocol\r
@@ -147,7 +143,7 @@ PpmPolicyEntry(
   mDxePlatformPpmPolicy.S3RestoreMsrSwSmiNumber                       = S3_RESTORE_MSR_SW_SMI;\r
 \r
   Handle = NULL;\r
-  Status = gBS->InstallMultipleProtocolInterfaces (\r
+  Status = pBS->InstallMultipleProtocolInterfaces (\r
                                                   &Handle,\r
                                                   &gPpmPlatformPolicyProtocolGuid,\r
                                                   &mDxePlatformPpmPolicy,\r
index cd3676b3d850d2b55077a56597fb7980f136ca6f..cc7bed74fd11346b74a80c882dc924bd205dee5a 100644 (file)
@@ -31,10 +31,6 @@ PPM_PLATFORM_POLICY_PROTOCOL    mDxePlatformPpmPolicy;
 #define  ICH_DEVICE_ENABLE       1\r
 #define  ICH_DEVICE_DISABLE      0\r
 \r
-EFI_BOOT_SERVICES     *gBS;\r
-EFI_BOOT_SERVICES     *pBS;\r
-EFI_RUNTIME_SERVICES  *pRS;\r
-\r
 #define POWER_STATE_SWITCH_SMI                       43\r
 #define ENABLE_C_STATE_IO_REDIRECTION_SMI            70\r
 #define DISABLE_C_STATE_IO_REDIRECTION_SMI           71\r
@@ -43,4 +39,4 @@ EFI_RUNTIME_SERVICES  *pRS;
 #define ENABLE_P_STATE_HARDWARE_COORDINATION_SMI     74\r
 #define DISABLE_P_STATE_HARDWARE_COORDINATION_SMI    75\r
 #define S3_RESTORE_MSR_SW_SMI                        48\r
-#define ENABLE_C6_RESIDENCY_SMI                      76
\ No newline at end of file
+#define ENABLE_C6_RESIDENCY_SMI                      76\r