-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a71af0b
commit 700aae9
Showing
3 changed files
with
475 additions
and
475 deletions.
There are no files selected for viewing
112 changes: 56 additions & 56 deletions
112
ArmPkg/Drivers/ArmPsciMpServicesDxe/ArmPsciMpServicesDxe.inf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
## @file | ||
# ARM MP services protocol driver | ||
# | ||
# Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.<BR> | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
# | ||
## | ||
|
||
[Defines] | ||
INF_VERSION = 1.27 | ||
BASE_NAME = ArmPsciMpServicesDxe | ||
FILE_GUID = 007ab472-dc4a-4df8-a5c2-abb4a327278c | ||
MODULE_TYPE = DXE_DRIVER | ||
VERSION_STRING = 1.0 | ||
|
||
ENTRY_POINT = ArmPsciMpServicesDxeInitialize | ||
|
||
[Sources.Common] | ||
ArmPsciMpServicesDxe.c | ||
MpFuncs.S | ||
MpServicesInternal.h | ||
|
||
[Packages] | ||
ArmPkg/ArmPkg.dec | ||
ArmPlatformPkg/ArmPlatformPkg.dec | ||
EmbeddedPkg/EmbeddedPkg.dec | ||
MdePkg/MdePkg.dec | ||
MdeModulePkg/MdeModulePkg.dec | ||
|
||
[LibraryClasses] | ||
ArmLib | ||
ArmMmuLib | ||
ArmSmcLib | ||
BaseMemoryLib | ||
CacheMaintenanceLib | ||
CpuExceptionHandlerLib | ||
DebugLib | ||
HobLib | ||
MemoryAllocationLib | ||
UefiBootServicesTableLib | ||
UefiDriverEntryPoint | ||
UefiLib | ||
|
||
[Protocols] | ||
gEfiMpServiceProtocolGuid ## PRODUCES | ||
gEfiLoadedImageProtocolGuid ## CONSUMES | ||
|
||
[Guids] | ||
gArmMpCoreInfoGuid | ||
|
||
[Depex] | ||
TRUE | ||
|
||
[BuildOptions] | ||
GCC:*_*_*_CC_FLAGS = -mstrict-align | ||
## @file | ||
# ARM MP services protocol driver | ||
# | ||
# Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.<BR> | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
# | ||
## | ||
[Defines] | ||
INF_VERSION = 1.27 | ||
BASE_NAME = ArmPsciMpServicesDxe | ||
FILE_GUID = 007ab472-dc4a-4df8-a5c2-abb4a327278c | ||
MODULE_TYPE = DXE_DRIVER | ||
VERSION_STRING = 1.0 | ||
ENTRY_POINT = ArmPsciMpServicesDxeInitialize | ||
[Sources.Common] | ||
ArmPsciMpServicesDxe.c | ||
MpFuncs.S | ||
MpServicesInternal.h | ||
[Packages] | ||
ArmPkg/ArmPkg.dec | ||
ArmPlatformPkg/ArmPlatformPkg.dec | ||
EmbeddedPkg/EmbeddedPkg.dec | ||
MdePkg/MdePkg.dec | ||
MdeModulePkg/MdeModulePkg.dec | ||
[LibraryClasses] | ||
ArmLib | ||
ArmMmuLib | ||
ArmSmcLib | ||
BaseMemoryLib | ||
CacheMaintenanceLib | ||
CpuExceptionHandlerLib | ||
DebugLib | ||
HobLib | ||
MemoryAllocationLib | ||
UefiBootServicesTableLib | ||
UefiDriverEntryPoint | ||
UefiLib | ||
[Protocols] | ||
gEfiMpServiceProtocolGuid ## PRODUCES | ||
gEfiLoadedImageProtocolGuid ## CONSUMES | ||
[Guids] | ||
gArmMpCoreInfoGuid | ||
[Depex] | ||
TRUE | ||
[BuildOptions] | ||
GCC:*_*_*_CC_FLAGS = -mstrict-align |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,74 @@ | ||
#=============================================================================== | ||
# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
#=============================================================================== | ||
|
||
.text | ||
.align 3 | ||
|
||
#include <AsmMacroIoLibV8.h> | ||
#include <IndustryStandard/ArmStdSmc.h> | ||
#include <Library/ArmLib.h> | ||
|
||
#include "MpServicesInternal.h" | ||
|
||
GCC_ASM_IMPORT (gApStacksBase) | ||
GCC_ASM_IMPORT (gProcessorIDs) | ||
GCC_ASM_IMPORT (ApProcedure) | ||
GCC_ASM_IMPORT (gApStackSize) | ||
GCC_ASM_IMPORT (gTcr) | ||
GCC_ASM_IMPORT (gTtbr0) | ||
GCC_ASM_IMPORT (gMair) | ||
|
||
GCC_ASM_EXPORT (ApEntryPoint) | ||
|
||
// Entry-point for the AP | ||
// VOID | ||
// ApEntryPoint ( | ||
// VOID | ||
// ); | ||
ASM_PFX(ApEntryPoint): | ||
// Configure the MMU and caches | ||
ldr x0, gTcr | ||
bl ArmSetTCR | ||
ldr x0, gTtbr0 | ||
bl ArmSetTTBR0 | ||
ldr x0, gMair | ||
bl ArmSetMAIR | ||
bl ArmDisableAlignmentCheck | ||
bl ArmEnableStackAlignmentCheck | ||
bl ArmEnableInstructionCache | ||
bl ArmEnableDataCache | ||
bl ArmEnableMmu | ||
|
||
mrs x0, mpidr_el1 | ||
// Mask the non-affinity bits | ||
bic x0, x0, 0x00ff000000 | ||
and x0, x0, 0xffffffffff | ||
ldr x1, gProcessorIDs | ||
mov x2, 0 // x2 = processor index | ||
|
||
// Find index in gProcessorIDs for current processor | ||
1: | ||
ldr x3, [x1, x2, lsl #3] // x4 = gProcessorIDs + x2 * 8 | ||
cmp x3, #-1 // check if we've reached the end of gProcessorIDs | ||
beq ProcessorNotFound | ||
add x2, x2, 1 // x2++ | ||
cmp x0, x3 // if mpidr_el1 != gProcessorIDs[x] then loop | ||
bne 1b | ||
|
||
// Calculate stack address | ||
// x2 contains the index for the current processor plus 1 | ||
ldr x0, gApStacksBase | ||
ldr x1, gApStackSize | ||
mul x3, x2, x1 // x3 = (ProcessorIndex + 1) * gApStackSize | ||
add sp, x0, x3 // sp = gApStacksBase + x3 | ||
mov x29, xzr | ||
bl ApProcedure // doesn't return | ||
|
||
ProcessorNotFound: | ||
// Turn off the processor | ||
MOV32 (w0, ARM_SMC_ID_PSCI_CPU_OFF) | ||
smc #0 | ||
b . | ||
#=============================================================================== | ||
# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
#=============================================================================== | ||
|
||
.text | ||
.align 3 | ||
|
||
#include <AsmMacroIoLibV8.h> | ||
#include <IndustryStandard/ArmStdSmc.h> | ||
#include <Library/ArmLib.h> | ||
|
||
#include "MpServicesInternal.h" | ||
|
||
GCC_ASM_IMPORT (gApStacksBase) | ||
GCC_ASM_IMPORT (gProcessorIDs) | ||
GCC_ASM_IMPORT (ApProcedure) | ||
GCC_ASM_IMPORT (gApStackSize) | ||
GCC_ASM_IMPORT (gTcr) | ||
GCC_ASM_IMPORT (gTtbr0) | ||
GCC_ASM_IMPORT (gMair) | ||
|
||
GCC_ASM_EXPORT (ApEntryPoint) | ||
|
||
// Entry-point for the AP | ||
// VOID | ||
// ApEntryPoint ( | ||
// VOID | ||
// ); | ||
ASM_PFX(ApEntryPoint): | ||
// Configure the MMU and caches | ||
ldr x0, gTcr | ||
bl ArmSetTCR | ||
ldr x0, gTtbr0 | ||
bl ArmSetTTBR0 | ||
ldr x0, gMair | ||
bl ArmSetMAIR | ||
bl ArmDisableAlignmentCheck | ||
bl ArmEnableStackAlignmentCheck | ||
bl ArmEnableInstructionCache | ||
bl ArmEnableDataCache | ||
bl ArmEnableMmu | ||
|
||
mrs x0, mpidr_el1 | ||
// Mask the non-affinity bits | ||
bic x0, x0, 0x00ff000000 | ||
and x0, x0, 0xffffffffff | ||
ldr x1, gProcessorIDs | ||
mov x2, 0 // x2 = processor index | ||
|
||
// Find index in gProcessorIDs for current processor | ||
1: | ||
ldr x3, [x1, x2, lsl #3] // x4 = gProcessorIDs + x2 * 8 | ||
cmp x3, #-1 // check if we've reached the end of gProcessorIDs | ||
beq ProcessorNotFound | ||
add x2, x2, 1 // x2++ | ||
cmp x0, x3 // if mpidr_el1 != gProcessorIDs[x] then loop | ||
bne 1b | ||
|
||
// Calculate stack address | ||
// x2 contains the index for the current processor plus 1 | ||
ldr x0, gApStacksBase | ||
ldr x1, gApStackSize | ||
mul x3, x2, x1 // x3 = (ProcessorIndex + 1) * gApStackSize | ||
add sp, x0, x3 // sp = gApStacksBase + x3 | ||
mov x29, xzr | ||
bl ApProcedure // doesn't return | ||
|
||
ProcessorNotFound: | ||
// Turn off the processor | ||
MOV32 (w0, ARM_SMC_ID_PSCI_CPU_OFF) | ||
smc #0 | ||
b . |
Oops, something went wrong.