1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
| /** @file
| *
| * Copyright (c) 2018-2021, ARM Limited. All rights reserved.
| *
| * SPDX-License-Identifier: BSD-2-Clause-Patent
| *
| **/
|
| #include <Library/ArmPlatformLib.h>
| #include <Library/BaseLib.h>
| #include <Library/HobLib.h>
| #include <Ppi/ArmMpCoreInfo.h>
| #include <Ppi/SgiPlatformId.h>
|
| #include "SgiPlatform.h"
|
| UINT64 NtFwConfigDtBlob;
| STATIC SGI_NT_FW_CONFIG_INFO_PPI mNtFwConfigDtInfoPpi;
|
| STATIC ARM_CORE_INFO mCoreInfoTable[] = {
| {
| // Cluster 0, Core 0
| 0x0, 0x0,
| },
| };
|
| STATIC CONST SGI_PRODUCT_ID_LOOKUP SgiProductIdLookup[] = {
| {
| Sgi575,
| SGI575_PART_NUM,
| SGI575_CONF_NUM,
| 0
| },
| {
| RdN1Edge,
| RD_N1E1_EDGE_PART_NUM,
| RD_N1_EDGE_CONF_ID,
| 0
| },
| {
| RdN1EdgeX2,
| RD_N1E1_EDGE_PART_NUM,
| RD_N1_EDGE_CONF_ID,
| 1
| },
| {
| RdE1Edge,
| RD_N1E1_EDGE_PART_NUM,
| RD_E1_EDGE_CONF_ID,
| 0
| },
| {
| RdV1,
| RD_V1_PART_NUM,
| RD_V1_CONF_ID,
| 0
| },
| {
| RdV1Mc,
| RD_V1_PART_NUM,
| RD_V1_MC_CONF_ID,
| 1
| },
| {
| RdN2,
| RD_N2_PART_NUM,
| RD_N2_CONF_ID,
| 0
| },
| {
| RdN2Cfg1,
| RD_N2_CFG1_PART_NUM,
| RD_N2_CFG1_CONF_ID,
| 0
| },
| };
|
| EFI_BOOT_MODE
| ArmPlatformGetBootMode (
| VOID
| )
| {
| return BOOT_WITH_FULL_CONFIGURATION;
| }
|
| RETURN_STATUS
| ArmPlatformInitialize (
| IN UINTN MpId
| )
| {
| mNtFwConfigDtInfoPpi.NtFwConfigDtAddr = NtFwConfigDtBlob;
| return RETURN_SUCCESS;
| }
|
| EFI_STATUS
| PrePeiCoreGetMpCoreInfo (
| OUT UINTN *CoreCount,
| OUT ARM_CORE_INFO **ArmCoreTable
| )
| {
| *CoreCount = 1;
| *ArmCoreTable = mCoreInfoTable;
| return EFI_SUCCESS;
| }
|
| STATIC ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = {
| PrePeiCoreGetMpCoreInfo
| };
|
| EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
| {
| EFI_PEI_PPI_DESCRIPTOR_PPI,
| &gArmMpCoreInfoPpiGuid,
| &mMpCoreInfoPpi
| },
| {
| EFI_PEI_PPI_DESCRIPTOR_PPI,
| &gNtFwConfigDtInfoPpiGuid,
| &mNtFwConfigDtInfoPpi
| }
| };
|
| VOID
| ArmPlatformGetPlatformPpiList (
| OUT UINTN *PpiListSize,
| OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
| )
| {
| *PpiListSize = sizeof (gPlatformPpiTable);
| *PpiList = gPlatformPpiTable;
| }
|
| /**
| Derermine the product ID.
|
| Determine the product ID by using the data in the Platform ID Descriptor HOB
| to lookup for a matching product ID.
|
| @retval Zero Failed identify platform.
| @retval Others ARM_RD_PRODUCT_ID of the identified platform.
| **/
| UINT8
| SgiGetProductId (
| VOID
| )
| {
| VOID *SystemIdHob;
| UINT8 Idx;
| SGI_PLATFORM_DESCRIPTOR *HobData;
|
| SystemIdHob = GetFirstGuidHob (&gArmSgiPlatformIdDescriptorGuid);
| if (SystemIdHob == NULL) {
| return UnknownId;
| }
|
| HobData = (SGI_PLATFORM_DESCRIPTOR *)GET_GUID_HOB_DATA (SystemIdHob);
|
| for (Idx = 0; Idx < ARRAY_SIZE (SgiProductIdLookup); Idx++) {
| if ((HobData->PlatformId == SgiProductIdLookup[Idx].PlatformId) &&
| (HobData->ConfigId == SgiProductIdLookup[Idx].ConfigId) &&
| (HobData->MultiChipMode == SgiProductIdLookup[Idx].MultiChipMode)) {
| return SgiProductIdLookup[Idx].ProductId;
| }
| }
|
| return UnknownId;
| }
|
|