Revision: 18827
http://sourceforge.net/p/edk2/code/18827
Author: vanjeff
Date: 2015-11-17 04:53:12 +0000 (Tue, 17 Nov 2015)
Log Message:
-----------
UefiCpuPkg: CpuDxe: broadcast MTRR changes to APs
The Quark_EDKII_v1.1.0/IA32FamilyCpuBasePkg/CpuArchDxe
driver applies any MTRR changes to APs, if the
EFI_MP_SERVICES_PROTOCOL is available. We should do the same.
Additionally, the broadcast should occur at MP startup as well,
not only when MTRR settings are changed. The inspiration is
taken from
Quark_EDKII_v1.1.0/IA32FamilyCpuBasePkg/CpuMpDxe/
(see the EarlyMpInit() function and its call sites in
"ProcessorConfig.c").
(Sync patch r18632 from main trunk.)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Jeff Fan <[email protected]>
Reviewed-by: Michael Kinney <[email protected]>
Revision Links:
--------------
http://sourceforge.net/p/edk2/code/18632
Modified Paths:
--------------
branches/UDK2015/UefiCpuPkg/CpuDxe/CpuDxe.c
branches/UDK2015/UefiCpuPkg/CpuDxe/CpuMp.c
branches/UDK2015/UefiCpuPkg/CpuDxe/CpuMp.h
Modified: branches/UDK2015/UefiCpuPkg/CpuDxe/CpuDxe.c
===================================================================
--- branches/UDK2015/UefiCpuPkg/CpuDxe/CpuDxe.c 2015-11-17 04:52:28 UTC (rev
18826)
+++ branches/UDK2015/UefiCpuPkg/CpuDxe/CpuDxe.c 2015-11-17 04:53:12 UTC (rev
18827)
@@ -350,6 +350,9 @@
{
RETURN_STATUS Status;
MTRR_MEMORY_CACHE_TYPE CacheType;
+ EFI_STATUS MpStatus;
+ EFI_MP_SERVICES_PROTOCOL *MpService;
+ MTRR_SETTINGS MtrrSettings;
if (!IsMtrrSupported ()) {
return EFI_UNSUPPORTED;
@@ -405,6 +408,29 @@
CacheType
);
+ if (!RETURN_ERROR (Status)) {
+ MpStatus = gBS->LocateProtocol (
+ &gEfiMpServiceProtocolGuid,
+ NULL,
+ (VOID **)&MpService
+ );
+ //
+ // Synchronize the update with all APs
+ //
+ if (!EFI_ERROR (MpStatus)) {
+ MtrrGetAllMtrrs (&MtrrSettings);
+ MpStatus = MpService->StartupAllAPs (
+ MpService, // This
+ SetMtrrsFromBuffer, // Procedure
+ TRUE, // SingleThread
+ NULL, // WaitEvent
+ 0, // TimeoutInMicrosecsond
+ &MtrrSettings, // ProcedureArgument
+ NULL // FailedCpuList
+ );
+ ASSERT (MpStatus == EFI_SUCCESS || MpStatus == EFI_NOT_STARTED);
+ }
+ }
return (EFI_STATUS) Status;
}
Modified: branches/UDK2015/UefiCpuPkg/CpuDxe/CpuMp.c
===================================================================
--- branches/UDK2015/UefiCpuPkg/CpuDxe/CpuMp.c 2015-11-17 04:52:28 UTC (rev
18826)
+++ branches/UDK2015/UefiCpuPkg/CpuDxe/CpuMp.c 2015-11-17 04:53:12 UTC (rev
18827)
@@ -1667,6 +1667,22 @@
}
/**
+ A minimal wrapper function that allows MtrrSetAllMtrrs() to be passed to
+ EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() as Procedure.
+
+ @param[in] Buffer Pointer to an MTRR_SETTINGS object, to be passed to
+ MtrrSetAllMtrrs().
+**/
+VOID
+EFIAPI
+SetMtrrsFromBuffer (
+ IN VOID *Buffer
+ )
+{
+ MtrrSetAllMtrrs (Buffer);
+}
+
+/**
Initialize Multi-processor support.
**/
@@ -1676,6 +1692,7 @@
)
{
EFI_STATUS Status;
+ MTRR_SETTINGS MtrrSettings;
UINTN Timeout;
gMaxLogicalProcessorNumber = (UINTN) PcdGet32
(PcdCpuMaxLogicalProcessorNumber);
@@ -1748,6 +1765,21 @@
//
CollectBistDataFromHob ();
+ //
+ // Synchronize MTRR settings to APs.
+ //
+ MtrrGetAllMtrrs (&MtrrSettings);
+ Status = mMpServicesTemplate.StartupAllAPs (
+ &mMpServicesTemplate, // This
+ SetMtrrsFromBuffer, // Procedure
+ TRUE, // SingleThread
+ NULL, // WaitEvent
+ 0, // TimeoutInMicrosecsond
+ &MtrrSettings, // ProcedureArgument
+ NULL // FailedCpuList
+ );
+ ASSERT (Status == EFI_SUCCESS || Status == EFI_NOT_STARTED);
+
Status = gBS->InstallMultipleProtocolInterfaces (
&mMpServiceHandle,
&gEfiMpServiceProtocolGuid, &mMpServicesTemplate,
Modified: branches/UDK2015/UefiCpuPkg/CpuDxe/CpuMp.h
===================================================================
--- branches/UDK2015/UefiCpuPkg/CpuDxe/CpuMp.h 2015-11-17 04:52:28 UTC (rev
18826)
+++ branches/UDK2015/UefiCpuPkg/CpuDxe/CpuMp.h 2015-11-17 04:53:12 UTC (rev
18827)
@@ -643,5 +643,18 @@
IN UINT32 ProcessorId
);
+/**
+ A minimal wrapper function that allows MtrrSetAllMtrrs() to be passed to
+ EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() as Procedure.
+
+ @param[in] Buffer Pointer to an MTRR_SETTINGS object, to be passed to
+ MtrrSetAllMtrrs().
+**/
+VOID
+EFIAPI
+SetMtrrsFromBuffer (
+ IN VOID *Buffer
+ );
+
#endif // _CPU_MP_H_
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits