We add MP Initialize Library defined in UefiCpuPkg/Include/Library/MpInitLib.h.
It will provide basic functionalities of MP services and could be consumed by
CPU MP PEI and CPU MP DXE to produce CPU MP PPI and CPU MP Protocol. Then most
of code could be shared between PEI and DXE modules.

PeiMpInitLib and DxeMpInitLib are added to make the CpuMpPei and CpuDxe more
simply.

I also updated the Ovmf Platform and Quark platform to consume MP Initialize 
library. I have tested Ovmf platform and have not tested Quark yet.

v4:
  1. Update Patches #2 - #6, #10, #15, #28, #30, #31, #33, #34, #38, #41, #43.
  2. Add Patches #7, #8, #42, #44 - #46.
  3. Add Reviewed-by: Laszlo Ersek <ler...@redhat.com> on Patches #1, #2.
  (Please see the patches commit log for more details)
  
v3:
  1. Update Patch #2, #4 - #8, #28, #33, #36, #38 per Giri's comments to
     a. Update SDM date to June, 2016
     b. Mention BCD format in CPU_MICROCODE_DATE
     c. Rename ProcessorChecksum to Checksum to match SDM.
     d. Add whitespace after MpInitLibInitialize
     e. Rename MpInitLibSwitchBsp to MpInitLibSwitchBSP to match PI spec.
     f. Rename NumApsExecutingLoction to NumApsExecutingLocation
     g. Add whitespace after ; in .nasm file
     h. Rename *RellocateAp* to *RelocateAp*
  2. Update Patch #16, #17, #29-#32 to
     a. Use CamelCase for mStopCheckAllApsStatus and CheckAndUpdateApsStatus().
  3. Update Patch #36 and #39 to
     a. Add PeiMpInitLib instance in UefiCpuPkg.dsc
     b. Add DxeMpInitLib instance in UefiCpuPkg.dsc
  4. Update Patch #39 and #40 to 
     a. move the code of consuming MP Initialize library from patch #40 to
     patch #39.
  5. Update Patch #1, #3 - #8, #16 to
     a. Add Reviewed-by: Giri P Mudusuru <giri.p.mudus...@intel.com> 

I fork the whole tree with the updated v3 patches
at https://github.com/vanjeff/edk2/tree/MpInitLibV4 for review.

Jeff Fan (46):
  UefiCpuPkg/LocalApic.h: Remove duplicated/conflicted definitions
  UefiCpuPkg/MpInitLib: Add microcode definitions defined in IA32 SDM
  UefiCpuPkg/CpuS3DataDxe: Move StartupVector allocation to EndOfDxe()
  UefiCpuPkg/MpInitLib: Add MP Initialize library class definition
  UefiCpuPkg/MpInitLib: Add two instances PeiMpInitLib and DxeMpInitLib
  UefiCpuPkg/MpInitLib: Add AP assembly code and MP_CPU_EXCHANGE_INFO
  UefiCpuPkg/MpInitLib: Fix typo and clean up the code
  UefiCpuPkg/MpInitLib: Add EnableExecuteDisable in MP_CPU_EXCHANGE_INFO
  UefiCpuPkg/MpInitLib: Add AsmRelocateApLoop() assembly code
  UefiCpuPkg/MpInitLib: Add MP_ASSEMBLY_ADDRESS_MAP
  UefiCpuPkg/MpInitLib: Get ApLoopMode and MointorFilter size
  UefiCpuPkg/MpInitLib: Allocate and initialize memory of MP Data buffer
  UefiCpuPkg/MpInitLib: Initialize CPU_AP_DATA for CPU APs
  UefiCpuPkg/MpInitLib: Add CPU_VOLATILE_REGISTERS & worker functions
  UefiCpuPkg/MpInitLib: Add MicrocodeDetect() and load microcode on BSP
  UefiCpuPkg/MpInitLib: Save CPU MP Data pointer
  UefiCpuPkg/MpInitLib: Register one End of PEI callback function
  UefiCpuPkg/MpInitLib: Register one period event to check APs status
  UefiCpuPkg/MpInitLib: Allocate AP reset vector buffer under 1MB
  UefiCpuPkg/MpInitLib: Add ApCFunction() executed by assembly code
  UefiCpuPkg/MpInitLib: Fill MP_CPU_EXCHANGE_INFO fields
  UefiCpuPkg/MpInitLib: Add WakeUpAP()
  UefiCpuPkg/MpInitLib: Send INIT-SIPI-SIPI to get processor count
  UefiCpuPkg/MpInitLib: Enable x2APIC mode on BSP/APs
  UefiCpuPkg/MpInitLib: Sort processor by ascending order of APIC ID
  UefiCpuPkg/MpInitLib: Skip collect processor count if GUIDed HOB exist
  UefiCpuPkg/MpInitLib: Implementation of
    MpInitLibGetNumberOfProcessors()
  UefiCpuPkg/MpInitLib: Implementation of MpInitLibGetProcessorInfo()
  UefiCpuPkg/MpInitLib: Implementation of MpInitLibWhoAmI()
  UefiCpuPkg/MpInitLib: Implementation of MpInitLibSwitchBSP()
  UefiCpuPkg/MpInitLib: Implementation of MpInitLibEnableDisableAP()
  UefiCpuPkg/MpInitLib: Check APs Status and update APs status
  UefiCpuPkg/MpInitLib: Implementation of MpInitLibStartupThisAP()
  UefiCpuPkg/MpInitLib: Implementation of MpInitLibStartupAllAPs()
  UefiCpuPkg/MpInitLib: Place APs in safe loop before hand-off to OS
  OvmfPkg: Add MpInitLib reference in DSC files.
  QuarkPlatformPkg: Add MpInitLib reference in DSC files.
  UefiCpuPkg/CpuMpPei: Consume MpInitLib to produce CPU MP PPI services
  UefiCpuPkg/CpuMpPei: Remove unused files and codes
  UefiCpuPkg/CpuMpPei: Delete PeiMpServices.c and PeiMpServices.h
  UefiCpuPkg/CpuDxe: Consume MpInitLib to produce CPU MP Protocol
    services
  UefiCpuPkg/CpuDxe: Move SetMtrrsFromBuffer() location.
  UefiCpuPkg/CpuDxe: Remove unused codes and files
  MdePkg/MpService.h: Fixed typo in function header to match PI spec
  MdePkg/MpService.h: Trim whitespace at end of line
  UefiCpuPkg/CpuDxe: Fixed typo in function header to match PI spec

 MdePkg/Include/Protocol/MpService.h                |  490 ++---
 OvmfPkg/OvmfPkgIa32.dsc                            |    2 +
 OvmfPkg/OvmfPkgIa32X64.dsc                         |    2 +
 OvmfPkg/OvmfPkgX64.dsc                             |    2 +
 QuarkPlatformPkg/Quark.dsc                         |    1 +
 QuarkPlatformPkg/QuarkMin.dsc                      |    3 +-
 UefiCpuPkg/CpuDxe/ApStartup.c                      |  478 -----
 UefiCpuPkg/CpuDxe/CpuDxe.c                         |   17 +-
 UefiCpuPkg/CpuDxe/CpuDxe.h                         |   13 +-
 UefiCpuPkg/CpuDxe/CpuDxe.inf                       |   12 +-
 UefiCpuPkg/CpuDxe/CpuDxe.uni                       |   10 +-
 UefiCpuPkg/CpuDxe/CpuDxeExtra.uni                  |    4 +-
 UefiCpuPkg/CpuDxe/CpuMp.c                          | 1302 +------------
 UefiCpuPkg/CpuDxe/CpuMp.h                          |  186 +-
 UefiCpuPkg/CpuDxe/Ia32/MpAsm.asm                   |   76 -
 UefiCpuPkg/CpuDxe/Ia32/MpAsm.nasm                  |   68 -
 UefiCpuPkg/CpuDxe/X64/MpAsm.asm                    |   76 -
 UefiCpuPkg/CpuDxe/X64/MpAsm.nasm                   |   70 -
 UefiCpuPkg/CpuMpPei/CpuBist.c                      |   53 +-
 UefiCpuPkg/CpuMpPei/CpuMpPei.c                     | 1118 ++++-------
 UefiCpuPkg/CpuMpPei/CpuMpPei.h                     |  515 ++---
 UefiCpuPkg/CpuMpPei/CpuMpPei.inf                   |   32 +-
 UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm               |  250 ---
 UefiCpuPkg/CpuMpPei/Microcode.h                    |   58 -
 UefiCpuPkg/CpuMpPei/PeiMpServices.c                |  956 ----------
 UefiCpuPkg/CpuMpPei/PeiMpServices.h                |  377 ----
 UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm                |  290 ---
 UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c                |   42 +-
 UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf           |    2 +-
 UefiCpuPkg/Include/Library/MpInitLib.h             |  353 ++++
 UefiCpuPkg/Include/Register/LocalApic.h            |   20 +-
 UefiCpuPkg/Include/Register/Microcode.h            |  200 ++
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c     |   29 +-
 .../BaseXApicX2ApicLib/BaseXApicX2ApicLib.c        |   51 +-
 .../MpInitLib/DxeMpInitLib.inf}                    |   68 +-
 .../MpInitLib/DxeMpInitLib.uni}                    |   12 +-
 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c            |  646 +++++++
 .../{CpuMpPei => Library/MpInitLib}/Ia32/MpEqu.inc |    4 +-
 .../MpInitLib}/Ia32/MpFuncs.nasm                   |   66 +-
 .../{CpuMpPei => Library/MpInitLib}/Microcode.c    |   77 +-
 UefiCpuPkg/Library/MpInitLib/MpLib.c               | 2018 ++++++++++++++++++++
 UefiCpuPkg/Library/MpInitLib/MpLib.h               |  529 +++++
 .../MpInitLib/PeiMpInitLib.inf}                    |   60 +-
 .../MpInitLib/PeiMpInitLib.uni}                    |   12 +-
 UefiCpuPkg/Library/MpInitLib/PeiMpLib.c            |  640 +++++++
 .../{CpuMpPei => Library/MpInitLib}/X64/MpEqu.inc  |    6 +-
 .../MpInitLib}/X64/MpFuncs.nasm                    |   84 +-
 UefiCpuPkg/UefiCpuPkg.dec                          |    4 +
 UefiCpuPkg/UefiCpuPkg.dsc                          |    5 +-
 49 files changed, 5744 insertions(+), 5645 deletions(-)
 delete mode 100644 UefiCpuPkg/CpuDxe/ApStartup.c
 delete mode 100644 UefiCpuPkg/CpuDxe/Ia32/MpAsm.asm
 delete mode 100644 UefiCpuPkg/CpuDxe/Ia32/MpAsm.nasm
 delete mode 100644 UefiCpuPkg/CpuDxe/X64/MpAsm.asm
 delete mode 100644 UefiCpuPkg/CpuDxe/X64/MpAsm.nasm
 delete mode 100644 UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm
 delete mode 100644 UefiCpuPkg/CpuMpPei/Microcode.h
 delete mode 100644 UefiCpuPkg/CpuMpPei/PeiMpServices.c
 delete mode 100644 UefiCpuPkg/CpuMpPei/PeiMpServices.h
 delete mode 100644 UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm
 create mode 100644 UefiCpuPkg/Include/Library/MpInitLib.h
 create mode 100644 UefiCpuPkg/Include/Register/Microcode.h
 copy UefiCpuPkg/{CpuMpPei/CpuMpPei.inf => Library/MpInitLib/DxeMpInitLib.inf} 
(52%)
 copy UefiCpuPkg/{CpuDxe/CpuDxeExtra.uni => Library/MpInitLib/DxeMpInitLib.uni} 
(53%)
 create mode 100644 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
 rename UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/Ia32/MpEqu.inc (88%)
 rename UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/Ia32/MpFuncs.nasm (77%)
 rename UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/Microcode.c (68%)
 create mode 100644 UefiCpuPkg/Library/MpInitLib/MpLib.c
 create mode 100644 UefiCpuPkg/Library/MpInitLib/MpLib.h
 copy UefiCpuPkg/{CpuMpPei/CpuMpPei.inf => Library/MpInitLib/PeiMpInitLib.inf} 
(58%)
 copy UefiCpuPkg/{CpuDxe/CpuDxeExtra.uni => Library/MpInitLib/PeiMpInitLib.uni} 
(53%)
 create mode 100644 UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
 rename UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/X64/MpEqu.inc (88%)
 rename UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/X64/MpFuncs.nasm (73%)

-- 
2.7.4.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to