]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Drivers/CpuDxe/CpuMpCore.c
ArmPkg: delete references to unused guids/Pcds from CpuDxe
[mirror_edk2.git] / ArmPkg / Drivers / CpuDxe / CpuMpCore.c
CommitLineData
44788bae 1/** @file\r
2*\r
b0fdce95 3* Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
44788bae 4*\r
b0fdce95
OM
5* This program and the accompanying materials\r
6* are licensed and made available under the terms and conditions of the BSD License\r
7* which accompanies this distribution. The full text of the license may be found at\r
8* http://opensource.org/licenses/bsd-license.php\r
9*\r
10* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
44788bae 12*\r
13**/\r
14\r
15#include <Library/UefiBootServicesTableLib.h>\r
16#include <Library/BaseMemoryLib.h>\r
17#include <Library/HobLib.h>\r
18#include <Library/DebugLib.h>\r
19#include <Library/MemoryAllocationLib.h>\r
20\r
21#include <Guid/ArmMpCoreInfo.h>\r
22\r
23ARM_PROCESSOR_TABLE mArmProcessorTableTemplate = {\r
24 {\r
25 EFI_ARM_PROCESSOR_TABLE_SIGNATURE,\r
26 0,\r
27 EFI_ARM_PROCESSOR_TABLE_REVISION,\r
28 EFI_ARM_PROCESSOR_TABLE_OEM_ID,\r
29 EFI_ARM_PROCESSOR_TABLE_OEM_TABLE_ID,\r
30 EFI_ARM_PROCESSOR_TABLE_OEM_REVISION,\r
31 EFI_ARM_PROCESSOR_TABLE_CREATOR_ID,\r
32 EFI_ARM_PROCESSOR_TABLE_CREATOR_REVISION,\r
b0fdce95 33 { 0 },\r
44788bae 34 0\r
35 }, //ARM Processor table header\r
36 0, // Number of entries in ARM processor Table\r
37 NULL // ARM Processor Table\r
38};\r
39\r
40/** Publish ARM Processor Data table in UEFI SYSTEM Table.\r
41 * @param: HobStart Pointer to the beginning of the HOB List from PEI.\r
42 *\r
43 * Description : This function iterates through HOB list and finds ARM processor Table Entry HOB.\r
44 * If the ARM processor Table Entry HOB is found, the HOB data is copied to run-time memory\r
45 * and a pointer is assigned to it in ARM processor table. Then the ARM processor table is\r
46 * installed in EFI configuration table.\r
47**/\r
48VOID\r
49EFIAPI\r
50PublishArmProcessorTable (\r
51 VOID\r
52 )\r
53{\r
54 EFI_PEI_HOB_POINTERS Hob;\r
55\r
56 Hob.Raw = GetHobList ();\r
57\r
58 // Iterate through the HOBs and find if there is ARM PROCESSOR ENTRY HOB\r
59 for (; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {\r
60 // Check for Correct HOB type\r
61 if ((GET_HOB_TYPE (Hob)) == EFI_HOB_TYPE_GUID_EXTENSION) {\r
62 // Check for correct GUID type\r
63 if (CompareGuid(&(Hob.Guid->Name), &gArmMpCoreInfoGuid)) {\r
64 ARM_PROCESSOR_TABLE *ArmProcessorTable;\r
65 EFI_STATUS Status;\r
66\r
67 // Allocate Runtime memory for ARM processor table\r
68 ArmProcessorTable = (ARM_PROCESSOR_TABLE*)AllocateRuntimePool(sizeof(ARM_PROCESSOR_TABLE));\r
69\r
70 // Check if the memory allocation is succesful or not\r
71 ASSERT(NULL != ArmProcessorTable);\r
72\r
73 // Set ARM processor table to default values\r
74 CopyMem(ArmProcessorTable,&mArmProcessorTableTemplate,sizeof(ARM_PROCESSOR_TABLE));\r
75\r
76 // Fill in Length fields of ARM processor table\r
77 ArmProcessorTable->Header.Length = sizeof(ARM_PROCESSOR_TABLE);\r
78 ArmProcessorTable->Header.DataLen = GET_GUID_HOB_DATA_SIZE(Hob);\r
79\r
80 // Fill in Identifier(ARM processor table GUID)\r
81 ArmProcessorTable->Header.Identifier = gArmMpCoreInfoGuid;\r
82\r
83 // Set Number of ARM core entries in the Table\r
84 ArmProcessorTable->NumberOfEntries = GET_GUID_HOB_DATA_SIZE(Hob)/sizeof(ARM_CORE_INFO);\r
85\r
86 // Allocate runtime memory for ARM processor Table entries\r
87 ArmProcessorTable->ArmCpus = (ARM_CORE_INFO*)AllocateRuntimePool (\r
88 ArmProcessorTable->NumberOfEntries * sizeof(ARM_CORE_INFO));\r
89\r
90 // Check if the memory allocation is succesful or not\r
91 ASSERT(NULL != ArmProcessorTable->ArmCpus);\r
92\r
93 // Copy ARM Processor Table data from HOB list to newly allocated memory\r
94 CopyMem(ArmProcessorTable->ArmCpus,GET_GUID_HOB_DATA(Hob), ArmProcessorTable->Header.DataLen);\r
95\r
96 // Install the ARM Processor table into EFI system configuration table\r
97 Status = gBS->InstallConfigurationTable (&gArmMpCoreInfoGuid, ArmProcessorTable);\r
98\r
99 ASSERT_EFI_ERROR (Status);\r
100 }\r
101 }\r
102 }\r
103}\r