UefiCpuPkg/MpInitLib: Remove global variable X2ApicEnable

MpInitLib sets X2ApicEnable in two places.
1. CollectProcessorCount()
   This function is called when MpInitLibInitialize() hasn't been
   called before.
   It sets X2ApicEnable and later in the same function it configures
   all CPUs to operate in X2 APIC mode.
2. MpInitLibInitialize()
   The X2ApicEnable setting happens when this function is called in
   second time. But after that setting, no code consumes that flag.

With the above analysis and with the purpose of simplifying the code,
the X2ApicEnable in #1 is changed to local variable and the #2 can be
changed to remove the setting of X2ApicEnable.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Ray Ni
2019-10-23 14:54:57 +08:00
parent 54d1e76f4e
commit fe3ca5fd25
2 changed files with 6 additions and 9 deletions

View File

@@ -227,7 +227,6 @@ struct _CPU_MP_DATA {
UINTN **FailedCpuList;
AP_INIT_STATE InitFlag;
BOOLEAN X2ApicEnable;
BOOLEAN SwitchBspFlag;
UINTN NewBspNumber;
CPU_EXCHANGE_ROLE_INFO BSPInfo;