3 Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
16 Do platform specific PEI stage initializations.
21 #include "PlatformEarlyInit.h"
24 #pragma GCC push_options
25 #pragma GCC optimize ("O0")
27 #pragma optimize ("", off)
32 static EFI_PEI_STALL_PPI mStallPpi
= {
37 static EFI_PEI_PPI_DESCRIPTOR mInstallStallPpi
= {
38 EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
,
44 // The reserved SMBus addresses are defined in PlatformDxe.h file.
46 static UINT8 mSmbusRsvdAddresses
[] = PLATFORM_SMBUS_RSVD_ADDRESSES
;
47 static PEI_SMBUS_POLICY_PPI mSmbusPolicyPpi
= {
50 PLATFORM_NUM_SMBUS_RSVD_ADDRESSES
,
54 static EFI_PEI_PPI_DESCRIPTOR mInstallSmbusPolicyPpi
= {
55 EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
,
56 &gPeiSmbusPolicyPpiGuid
,
59 static PEI_SPEAKER_IF_PPI mSpeakerInterfacePpi
= {
64 static EFI_PEI_PPI_DESCRIPTOR mInstallSpeakerInterfacePpi
= {
65 EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
,
66 &gPeiSpeakerInterfacePpiGuid
,
70 static EFI_PEI_RESET_PPI mResetPpi
= { IchReset
};
73 static EFI_PEI_FIND_FV_PPI mEfiFindFvPpi
= {
74 (EFI_PEI_FIND_FV_FINDFV
)FindFv
77 static EFI_PEI_PPI_DESCRIPTOR mPpiList
[] = {
79 EFI_PEI_PPI_DESCRIPTOR_PPI
,
80 &gEfiPeiMasterBootModePpiGuid
,
84 EFI_PEI_PPI_DESCRIPTOR_PPI
,
89 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
95 static EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList
[] = {
97 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK
,
98 &gEfiEndOfPeiSignalPpiGuid
,
99 (EFI_PEIM_NOTIFY_ENTRY_POINT
)EndOfPeiPpiNotifyCallback
102 (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
103 &gEfiPeiMemoryDiscoveredPpiGuid
,
104 (EFI_PEIM_NOTIFY_ENTRY_POINT
)MemoryDiscoveredPpiNotifyCallback
112 Parse the status registers for figuring out the wake-up event and save it into
113 an GUID HOB which will be referenced later. However, modification is required
114 to meet the chipset register definition and the practical hardware design. Thus,
115 this is just an example.
118 @param PeiServices pointer to the PEI Service Table
119 @param EFI_SUCCESS Always return Success
127 GetWakeupEventAndSaveToHob (
128 IN CONST EFI_PEI_SERVICES
**PeiServices
136 // Read the ACPI registers
138 Pm1Sts
= IoRead16 (ACPI_BASE_ADDRESS
+ R_PCH_ACPI_PM1_STS
);
139 Gpe0Sts
= IoRead32 (ACPI_BASE_ADDRESS
+ R_PCH_ACPI_GPE0a_STS
);
142 // Figure out the wake-up event
144 if ((Pm1Sts
& B_PCH_ACPI_PM1_STS_PWRBTN
) != 0) {
145 WakeEventData
= SMBIOS_WAKEUP_TYPE_POWER_SWITCH
;
146 } else if (((Pm1Sts
& B_PCH_ACPI_PM1_STS_WAK
) != 0)) {
147 WakeEventData
= SMBIOS_WAKEUP_TYPE_PCI_PME
;
148 } else if (Gpe0Sts
!= 0) {
149 WakeEventData
= SMBIOS_WAKEUP_TYPE_OTHERS
;
151 WakeEventData
= SMBIOS_WAKEUP_TYPE_UNKNOWN
;
154 DEBUG ((EFI_D_ERROR
, "ACPI Wake Status Register: %04x\n", Pm1Sts
));
155 DEBUG ((EFI_D_ERROR
, "ACPI Wake Event Data: %02x\n", WakeEventData
));
162 IN CONST EFI_PEI_SERVICES
**PeiServices
,
163 IN SYSTEM_CONFIGURATION
*SystemConfiguration
168 EFI_PEI_READ_ONLY_VARIABLE2_PPI
*Variable
;
170 VariableSize
= sizeof (SYSTEM_CONFIGURATION
);
171 ZeroMem (SystemConfiguration
, sizeof (SYSTEM_CONFIGURATION
));
173 Status
= (*PeiServices
)->LocatePpi (
175 &gEfiPeiReadOnlyVariable2PpiGuid
,
180 ASSERT_EFI_ERROR (Status
);
183 // Use normal setup default from NVRAM variable,
184 // the Platform Mode (manufacturing/safe/normal) is handle in PeiGetVariable.
186 VariableSize
= sizeof(SYSTEM_CONFIGURATION
);
187 Status
= Variable
->GetVariable (
190 &gEfiSetupVariableGuid
,
195 if (EFI_ERROR (Status
) || VariableSize
!= sizeof(SYSTEM_CONFIGURATION
)) {
196 //The setup variable is corrupted
197 VariableSize
= sizeof(SYSTEM_CONFIGURATION
);
198 Status
= Variable
->GetVariable(
201 &gEfiSetupVariableGuid
,
206 ASSERT_EFI_ERROR (Status
);
213 IN CONST EFI_PEI_SERVICES
**PeiServices
,
214 IN SYSTEM_CONFIGURATION
*SystemConfiguration
218 EFI_PEI_PPI_DESCRIPTOR
*mVlvPolicyPpiDesc
;
219 VLV_POLICY_PPI
*mVlvPolicyPpi
;
221 Status
= (*PeiServices
)->AllocatePool(
223 sizeof (EFI_PEI_PPI_DESCRIPTOR
),
224 (void **)&mVlvPolicyPpiDesc
226 ASSERT_EFI_ERROR (Status
);
228 Status
= (*PeiServices
)->AllocatePool(
230 sizeof (VLV_POLICY_PPI
),
231 (void **)&mVlvPolicyPpi
233 ASSERT_EFI_ERROR (Status
);
238 (*PeiServices
)->SetMem ((VOID
*)mVlvPolicyPpi
, sizeof (VLV_POLICY_PPI
), 0);
239 mVlvPolicyPpiDesc
->Flags
= EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
;
240 mVlvPolicyPpiDesc
->Guid
= &gVlvPolicyPpiGuid
;
241 mVlvPolicyPpiDesc
->Ppi
= mVlvPolicyPpi
;
242 mVlvPolicyPpi
->GtConfig
.PrimaryDisplay
= SystemConfiguration
->PrimaryVideoAdaptor
;
243 mVlvPolicyPpi
->GtConfig
.IgdDvmt50PreAlloc
= SystemConfiguration
->IgdDvmt50PreAlloc
;
244 mVlvPolicyPpi
->GtConfig
.ApertureSize
= SystemConfiguration
->IgdApertureSize
;
245 mVlvPolicyPpi
->GtConfig
.GttSize
= SystemConfiguration
->GTTSize
;
246 if (SystemConfiguration
->PrimaryVideoAdaptor
!= 2) {
247 mVlvPolicyPpi
->GtConfig
.InternalGraphics
= SystemConfiguration
->Igd
;
249 mVlvPolicyPpi
->GtConfig
.InternalGraphics
= 0;
253 mVlvPolicyPpi
->GtConfig
.IgdTurboEn
= 1;
256 mVlvPolicyPpi
->PlatformData
.FastBoot
= SystemConfiguration
->FastBoot
;
257 mVlvPolicyPpi
->PlatformData
.DynSR
= 1;
258 DEBUG ((EFI_D_ERROR
, "Setup Option ISPEn: 0x%x\n", SystemConfiguration
->ISPEn
));
259 mVlvPolicyPpi
->ISPEn
= SystemConfiguration
->ISPEn
;
260 DEBUG ((EFI_D_ERROR
, "Setup Option ISPDevSel: 0x%x\n", SystemConfiguration
->ISPDevSel
));
261 mVlvPolicyPpi
->ISPPciDevConfig
= SystemConfiguration
->ISPDevSel
;
262 if (SystemConfiguration
->ISPEn
== 0) {
263 mVlvPolicyPpi
->ISPPciDevConfig
= 0;
264 DEBUG ((EFI_D_ERROR
, "Update Setup Option ISPDevSel: 0x%x\n", mVlvPolicyPpi
->ISPPciDevConfig
));
266 Status
= (*PeiServices
)->InstallPpi(
270 ASSERT_EFI_ERROR (Status
);
278 IN SYSTEM_CONFIGURATION
*SystemConfiguration
282 DEBUG ((EFI_D_ERROR
, "ConfigureSoCGpio------------start\n"));
283 if (SystemConfiguration
->eMMCBootMode
== 1) {// Auto detection mode
284 DEBUG ((EFI_D_ERROR
, "Auto detection mode------------start\n"));
289 switch (PchStepping()) {
290 case PchA0
: // SOC A0 and A1
292 DEBUG ((EFI_D_ERROR
, "SOC A0/A1: eMMC 4.41 GPIO Configuration\n"));
293 SystemConfiguration
->LpsseMMCEnabled
= 1;
294 SystemConfiguration
->LpsseMMC45Enabled
= 0;
296 case PchB0
: // SOC B0 and later
298 DEBUG ((EFI_D_ERROR
, "SOC B0 and later: eMMC 4.5 GPIO Configuration\n"));
299 SystemConfiguration
->LpsseMMCEnabled
= 0;
300 SystemConfiguration
->LpsseMMC45Enabled
= 1;
303 } else if (SystemConfiguration
->eMMCBootMode
== 2) { // eMMC 4.41
304 DEBUG ((EFI_D_ERROR
, "Force to eMMC 4.41 GPIO Configuration\n"));
305 SystemConfiguration
->LpsseMMCEnabled
= 1;
306 SystemConfiguration
->LpsseMMC45Enabled
= 0;
307 } else if (SystemConfiguration
->eMMCBootMode
== 3) { // eMMC 4.5
308 DEBUG ((EFI_D_ERROR
, "Force to eMMC 4.5 GPIO Configuration\n"));
309 SystemConfiguration
->LpsseMMCEnabled
= 0;
310 SystemConfiguration
->LpsseMMC45Enabled
= 1;
312 } else { // Disable eMMC controllers
313 DEBUG ((EFI_D_ERROR
, "Disable eMMC GPIO controllers\n"));
314 SystemConfiguration
->LpsseMMCEnabled
= 0;
315 SystemConfiguration
->LpsseMMC45Enabled
= 0;
320 SDMMC1_CLK - write 0x2003ED01 to IOBASE + 0x03E0
321 SDMMC1_CMD - write 0x2003EC81 to IOBASE + 0x0390
322 SDMMC1_D0 - write 0x2003EC81 to IOBASE + 0x03D0
323 SDMMC1_D1 - write 0x2003EC81 to IOBASE + 0x0400
324 SDMMC1_D2 - write 0x2003EC81 to IOBASE + 0x03B0
325 SDMMC1_D3_CD_B - write 0x2003EC81 to IOBASE + 0x0360
326 MMC1_D4_SD_WE - write 0x2003EC81 to IOBASE + 0x0380
327 MMC1_D5 - write 0x2003EC81 to IOBASE + 0x03C0
328 MMC1_D6 - write 0x2003EC81 to IOBASE + 0x0370
329 MMC1_D7 - write 0x2003EC81 to IOBASE + 0x03F0
330 MMC1_RESET_B - write 0x2003ED01 to IOBASE + 0x0330
332 if (SystemConfiguration
->LpsseMMCEnabled
== 1) {
333 MmioWrite32 (IO_BASE_ADDRESS
+ 0x03E0, 0x2003ED01); //EMMC 4.41
334 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0390, 0x2003EC81);
335 MmioWrite32 (IO_BASE_ADDRESS
+ 0x03D0, 0x2003EC81);
336 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0400, 0x2003EC81);
337 MmioWrite32 (IO_BASE_ADDRESS
+ 0x03B0, 0x2003EC81);
338 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0360, 0x2003EC81);
339 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0380, 0x2003EC81);
340 MmioWrite32 (IO_BASE_ADDRESS
+ 0x03C0, 0x2003EC81);
341 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0370, 0x2003EC81);
342 MmioWrite32 (IO_BASE_ADDRESS
+ 0x03F0, 0x2003EC81);
343 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0330, 0x2003ED01);
348 SDMMC1_CLK - write 0x2003ED03 to IOBASE + 0x03E0
349 SDMMC1_CMD - write 0x2003EC83 to IOBASE + 0x0390
350 SDMMC1_D0 - write 0x2003EC83 to IOBASE + 0x03D0
351 SDMMC1_D1 - write 0x2003EC83 to IOBASE + 0x0400
352 SDMMC1_D2 - write 0x2003EC83 to IOBASE + 0x03B0
353 SDMMC1_D3_CD_B - write 0x2003EC83 to IOBASE + 0x0360
354 MMC1_D4_SD_WE - write 0x2003EC83 to IOBASE + 0x0380
355 MMC1_D5 - write 0x2003EC83 to IOBASE + 0x03C0
356 MMC1_D6 - write 0x2003EC83 to IOBASE + 0x0370
357 MMC1_D7 - write 0x2003EC83 to IOBASE + 0x03F0
358 MMC1_RESET_B - write 0x2003ED03 to IOBASE + 0x0330
360 if (SystemConfiguration
->LpsseMMC45Enabled
== 1) {
361 MmioWrite32 (IO_BASE_ADDRESS
+ 0x03E0, 0x2003ED03); // EMMC 4.5
362 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0390, 0x2003EC83);
363 MmioWrite32 (IO_BASE_ADDRESS
+ 0x03D0, 0x2003EC83);
364 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0400, 0x2003EC83);
365 MmioWrite32 (IO_BASE_ADDRESS
+ 0x03B0, 0x2003EC83);
366 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0360, 0x2003EC83);
367 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0380, 0x2003EC83);
368 MmioWrite32 (IO_BASE_ADDRESS
+ 0x03C0, 0x2003EC83);
369 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0370, 0x2003EC83);
370 MmioWrite32 (IO_BASE_ADDRESS
+ 0x03F0, 0x2003EC83);
371 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0330, 0x2003ED03);
376 // Change GPIOC_0 setting to allow MMIO access under Android.
378 IoWrite32 (GPIO_BASE_ADDRESS
+ R_PCH_GPIO_SC_USE_SEL
,
379 (IoRead32(GPIO_BASE_ADDRESS
+ R_PCH_GPIO_SC_USE_SEL
) & (UINT32
)~BIT0
));
380 DEBUG ((EFI_D_ERROR
, "ConfigureSoCGpio------------end\n"));
386 IN CONST EFI_PEI_SERVICES
**PeiServices
,
387 IN SYSTEM_CONFIGURATION
*SystemConfiguration
390 if (SystemConfiguration
->MeasuredBootEnable
) {
391 PcdSetBool (PcdMeasuredBootEnable
, TRUE
);
393 PcdSetBool (PcdMeasuredBootEnable
, FALSE
);
401 ConfigureLpssAndSccGpio (
402 IN SYSTEM_CONFIGURATION
*SystemConfiguration
,
403 IN EFI_PLATFORM_INFO_HOB
*PlatformInfo
406 /*One time configuration to each GPIO controller PSB_CONF register should be done before starting pad configuration:
407 GPIO SCORE - write 0x01001002 to IOBASE + 0x0700
408 GPIO NCORE - write 0x01001002 to IOBASE + 0x0F00
409 GPIO SSUS - write 0x01001002 to IOBASE + 0x1700
411 DEBUG ((EFI_D_ERROR
, "ConfigureLpssAndSccGpio------------start\n"));
415 PWM0 - write 0x2003CD01 to IOBASE + 0x00A0
417 PWM0 - write 0x2003CD01 to IOBASE + 0x00B0
419 if (SystemConfiguration
->LpssPwm0Enabled
== 1) {
420 MmioWrite32 (IO_BASE_ADDRESS
+ 0x00A0, 0x2003CD01);
421 } else if (SystemConfiguration
->LpssPwm0Enabled
== 0) {
422 MmioWrite32 (IO_BASE_ADDRESS
+ 0x00A0, 0x2003CD00);
425 if (SystemConfiguration
->LpssPwm1Enabled
== 1) {
426 MmioWrite32 (IO_BASE_ADDRESS
+ 0x00B0, 0x2003CC01);
427 } else if (SystemConfiguration
->LpssPwm1Enabled
== 0) {
428 MmioWrite32 (IO_BASE_ADDRESS
+ 0x00B0, 0x2003CD00);
433 UART1_RXD-L - write 0x2003CC81 to IOBASE + 0x0020
434 UART1_TXD-0 - write 0x2003CC81 to IOBASE + 0x0010
435 UART1_RTS_B-1 - write 0x2003CC81 to IOBASE + 0x0000
436 UART1_CTS_B-H - write 0x2003CC81 to IOBASE + 0x0040
438 if (SystemConfiguration
->LpssHsuart0Enabled
== 1) {
439 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0020, 0x2003CC81); // uart1
440 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0010, 0x2003CC81);
441 if (SystemConfiguration
->LpssHsuart0FlowControlEnabled
== 0) {
442 DEBUG ((EFI_D_ERROR
, "LpssHsuart0FlowControlEnabled[0]\n"));
443 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0000, 0x2003CC80);
444 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0040, 0x2003CC80);
446 DEBUG ((EFI_D_ERROR
, "LpssHsuart0FlowControlEnabled[1]\n"));
447 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0000, 0x2003CC81);
448 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0040, 0x2003CC01);//W/A HSD 4752617 0x2003CC81
450 } else if (SystemConfiguration
->LpssHsuart0Enabled
== 0) {
451 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0020, 0x2003CC80); // uart1
452 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0010, 0x2003CC80);
458 UART2_RTS_B-1 - write 0x2003CC81 to IOBASE + 0x0090
459 UART2_CTS_B-H - write 0x2003CC81 to IOBASE + 0x0080
460 UART2_RXD-H - write 0x2003CC81 to IOBASE + 0x0060
461 UART2_TXD-0 - write 0x2003CC81 to IOBASE + 0x0070
463 if (SystemConfiguration
->LpssHsuart1Enabled
== 1) {
464 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0060, 0x2003CC81);
465 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0070, 0x2003CC81);
467 if (SystemConfiguration
->LpssHsuart1FlowControlEnabled
== 0) {
468 DEBUG ((EFI_D_ERROR
, "LpssHsuart1FlowControlEnabled[0]\n"));
469 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0090, 0x2003CC80); // UART2_RTS_B
470 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0080, 0x2003CC80); // UART2_CTS_B
472 DEBUG ((EFI_D_ERROR
, "LpssHsuart1FlowControlEnabled[1]\n"));
473 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0090, 0x2003CC81); // uart2
474 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0080, 0x2003CC01); //W/A HSD 4752617 0x2003CC81
476 } else if (SystemConfiguration
->LpssHsuart1Enabled
== 0) {
477 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0060, 0x2003CC80);
478 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0070, 0x2003CC80);
483 SPI1_CS0_B - write 0x2003CC81 to IOBASE + 0x0110
484 SPI1_CLK - write 0x2003CD01 to IOBASE + 0x0100
485 SPI1_MOSI - write 0x2003CC81 to IOBASE + 0x0130
486 SPI1_MISO - write 0x2003CC81 to IOBASE + 0x0120
488 if (SystemConfiguration
->LpssSpiEnabled
== 1) {
489 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0110, 0x2003CC81); // SPI
490 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0100, 0x2003CD01);
491 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0130, 0x2003CC81);
492 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0120, 0x2003CC81);
493 } else if (SystemConfiguration
->LpssSpiEnabled
== 0) {
494 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0110, 0x2003cc80);
495 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0100, 0x2003cc80);
496 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0130, 0x2003cc80);
497 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0120, 0x2003cc80);
502 I2C0_SDA-OD-O - write 0x2003CC81 to IOBASE + 0x0210
503 I2C0_SCL-OD-O - write 0x2003CC81 to IOBASE + 0x0200
505 if (SystemConfiguration
->LpssI2C0Enabled
== 1) {
506 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0210, 0x2003C881);
507 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0200, 0x2003C881);
511 I2C1_SDA-OD-O/I - write 0x2003CC81 to IOBASE + 0x01F0
512 I2C1_SCL-OD-O/I - write 0x2003CC81 to IOBASE + 0x01E0
515 if (SystemConfiguration
->LpssI2C1Enabled
== 1) {
516 MmioWrite32 (IO_BASE_ADDRESS
+ 0x01F0, 0x2003C881);
517 MmioWrite32 (IO_BASE_ADDRESS
+ 0x01E0, 0x2003C881);
521 I2C2_SDA-OD-O/I - write 0x2003CC81 to IOBASE + 0x01D0
522 I2C2_SCL-OD-O/I - write 0x2003CC81 to IOBASE + 0x01B0
524 if (SystemConfiguration
->LpssI2C2Enabled
== 1) {
525 MmioWrite32 (IO_BASE_ADDRESS
+ 0x01D0, 0x2003C881);
526 MmioWrite32 (IO_BASE_ADDRESS
+ 0x01B0, 0x2003C881);
530 I2C3_SDA-OD-O/I - write 0x2003CC81 to IOBASE + 0x0190
531 I2C3_SCL-OD-O/I - write 0x2003CC81 to IOBASE + 0x01C0
533 if (SystemConfiguration
->LpssI2C3Enabled
== 1) {
534 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0190, 0x2003C881);
535 MmioWrite32 (IO_BASE_ADDRESS
+ 0x01C0, 0x2003C881);
539 I2C4_SDA-OD-O/I - write 0x2003CC81 to IOBASE + 0x01A0
540 I2C4_SCL-OD-O/I - write 0x2003CC81 to IOBASE + 0x0170
542 if (SystemConfiguration
->LpssI2C4Enabled
== 1) {
543 MmioWrite32 (IO_BASE_ADDRESS
+ 0x01A0, 0x2003C881);
544 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0170, 0x2003C881);
548 I2C5_SDA-OD-O/I - write 0x2003CC81 to IOBASE + 0x0150
549 I2C5_SCL-OD-O/I - write 0x2003CC81 to IOBASE + 0x0140
551 //touch 1.7M support on i2c5(from 0) need 2k PULL-UP.
552 if (SystemConfiguration
->LpssI2C5Enabled
== 1) {
553 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0150, 0x2003C881);
554 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0140, 0x2003C881);
555 } else if(SystemConfiguration
->LpssI2C5Enabled
== 0) {
556 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0150, 0x2003C880);
557 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0140, 0x2003C880);
561 I2C6_SDA-OD-O/I - write 0x2003CC81 to IOBASE + 0x0180
562 I2C6_SCL-OD-O/I - write 0x2003CC81 to IOBASE + 0x0160
564 if (SystemConfiguration
->LpssI2C6Enabled
== 1) {
565 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0180, 0x2003C881);
566 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0160, 0x2003C881);
567 } else if (SystemConfiguration
->LpssI2C6Enabled
== 0) {
568 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0180, 0x2003C880);
569 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0160, 0x2003C880);
575 SDMMC2_CLK - write 0x2003ED01 to IOBASE + 0x0320
576 SDMMC2_CMD - write 0x2003EC81 to IOBASE + 0x0300
577 SDMMC2_D0 - write 0x2003EC81 to IOBASE + 0x0350
578 SDMMC2_D1 - write 0x2003EC81 to IOBASE + 0x02F0
579 SDMMC2_D2 - write 0x2003EC81 to IOBASE + 0x0340
580 SDMMC2_D3_CD_B - write 0x2003EC81 to IOBASE + 0x0310
582 if (SystemConfiguration
->LpssSdioEnabled
== 1) {
583 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0320, 0x2003ED01);//SDIO
584 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0300, 0x2003EC81);
585 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0350, 0x2003EC81);
586 MmioWrite32 (IO_BASE_ADDRESS
+ 0x02F0, 0x2003EC81);
587 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0340, 0x2003EC81);
588 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0310, 0x2003EC81);
593 SDMMC3_1P8_EN - write 0x2003CD01 to IOBASE + 0x03F0
594 SDMMC3_CD_B - write 0x2003CC81 to IOBASE + 0x03A0
595 SDMMC3_CLK - write 0x2003CD01 to IOBASE + 0x02B0
596 SDMMC3_CMD - write 0x2003CC81 to IOBASE + 0x02C0
597 SDMMC3_D0 - write 0x2003CC81 to IOBASE + 0x02E0
598 SDMMC3_D1 - write 0x2003CC81 to IOBASE + 0x0290
599 SDMMC3_D2 - write 0x2003CC81 to IOBASE + 0x02D0
600 SDMMC3_D3 - write 0x2003CC81 to IOBASE + 0x02A0
601 SDMMC3_PWR_EN_B - write 0x2003CC81 to IOBASE + 0x0690
602 SDMMC3_WP - write 0x2003CC82 to IOBASE + 0x0160
604 if (SystemConfiguration
->LpssSdcardEnabled
== 1) {
605 if (!((PlatformInfo
->BoardId
== BOARD_ID_BL_FFRD
&& PlatformInfo
->BoardRev
== PR11
) && (SystemConfiguration
->CfioPnpSettings
== 1))) {
606 MmioWrite32 (IO_BASE_ADDRESS
+ 0x05F0, 0x2003CD01);//SDCARD
607 MmioWrite32 (IO_BASE_ADDRESS
+ 0x02B0, 0x2003CD01);
608 MmioWrite32 (IO_BASE_ADDRESS
+ 0x02C0, 0x2003CC81);
609 MmioWrite32 (IO_BASE_ADDRESS
+ 0x02E0, 0x2003CC81);
610 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0290, 0x2003CC81);
611 MmioWrite32 (IO_BASE_ADDRESS
+ 0x02D0, 0x2003CC81);
612 MmioWrite32 (IO_BASE_ADDRESS
+ 0x02A0, 0x2003CC81);
613 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0690, 0x2003CC81);
614 MmioWrite32 (IO_BASE_ADDRESS
+ 0x0650, 0x2003CC82); //GPIOC_7 set to WP Pin
619 DEBUG ((EFI_D_ERROR
, "ConfigureLpssAndSccGpio------------end\n"));
625 IN SYSTEM_CONFIGURATION
*SystemConfiguration
628 DEBUG ((EFI_D_ERROR
, "ConfigureLpeGpio------------start\n"));
630 if (SystemConfiguration
->PchAzalia
== 0) {
631 MmioAndThenOr32 (IO_BASE_ADDRESS
+ 0x220, (UINT32
)~(0x7), (UINT32
) (0x01));
632 MmioAndThenOr32 (IO_BASE_ADDRESS
+ 0x250, (UINT32
)~(0x7), (UINT32
) (0x01));
633 MmioAndThenOr32 (IO_BASE_ADDRESS
+ 0x240, (UINT32
)~(0x7), (UINT32
) (0x01));
634 MmioAndThenOr32 (IO_BASE_ADDRESS
+ 0x260, (UINT32
)~(0x7), (UINT32
) (0x01));
635 MmioAndThenOr32 (IO_BASE_ADDRESS
+ 0x270, (UINT32
)~(0x7), (UINT32
) (0x01));
636 MmioAndThenOr32 (IO_BASE_ADDRESS
+ 0x230, (UINT32
)~(0x7), (UINT32
) (0x01));
637 MmioAndThenOr32 (IO_BASE_ADDRESS
+ 0x280, (UINT32
)~(0x7), (UINT32
) (0x01));
638 MmioAndThenOr32 (IO_BASE_ADDRESS
+ 0x540, (UINT32
)~(0x7), (UINT32
) (0x01));
641 DEBUG ((EFI_D_ERROR
, "ConfigureLpeGpio------------end\n"));
647 ConfigureSciSmiGpioRout (
648 IN EFI_PLATFORM_INFO_HOB
*PlatformInfo
)
652 GPI_Routing
= MmioRead32 (PMC_BASE_ADDRESS
+ R_PCH_PMC_GPI_ROUT
);
655 // For FAB3, Route GPIO_CORE 0 to cause Runtime SCI, GPIO_SUS 0 to cause Wake SCI and GPIO_SUS 7 to cause EXTSMI
657 if(PlatformInfo
->BoardRev
== 3) {
658 GPI_Routing
= GPI_Routing
& 0xfffc3ffc;
659 GPI_Routing
= GPI_Routing
| 0x00024002;
663 // For FAB2/1, Route GPIO_CORE 7 to cause Runtime SCI, GPIO_SUS 0 to cause Wake SCI and GPIO_SUS 7 to cause EXTSMI
666 GPI_Routing
= GPI_Routing
& 0x3fff3ffc;
667 GPI_Routing
= GPI_Routing
| 0x80004002;
669 MmioWrite32((PMC_BASE_ADDRESS
+ R_PCH_PMC_GPI_ROUT
), GPI_Routing
);
679 //Configure the platform clock for MIPI-CSI usage
682 MmioAndThenOr32 (IO_BASE_ADDRESS
+ 0x6a0, (UINT32
)~(0x7), (UINT32
) (0x01));
687 MmioAndThenOr32 (IO_BASE_ADDRESS
+ 0x570, (UINT32
)~(0x7), (UINT32
) (0x01));
692 MmioAndThenOr32 (IO_BASE_ADDRESS
+ 0x5B0, (UINT32
)~(0x7), (UINT32
) (0x01));
705 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x338, (UINT32
)~(0x7), (UINT32
) (GPI
));
706 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x330, (UINT32
)~(0x187), (UINT32
) (0x101));
711 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x388, (UINT32
)~(0x7), (UINT32
) (GPI
));
712 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x380, (UINT32
)~(0x187), (UINT32
) (0x101));
717 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x368, (UINT32
)~(0x7), (UINT32
) (GPI
));
718 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x360, (UINT32
)~(0x187), (UINT32
) (0x101));
723 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x318, (UINT32
)~(0x7), (UINT32
) (GPI
));
724 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x310, (UINT32
)~(0x187), (UINT32
) (0x101));
729 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x378, (UINT32
)~(0x7), (UINT32
) (GPI
));
730 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x370, (UINT32
)~(0x187), (UINT32
) (0x101));
735 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x308, (UINT32
)~(0x7), (UINT32
) (GPI
));
736 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x300, (UINT32
)~(0x187), (UINT32
) (0x101));
741 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x398, (UINT32
)~(0x7), (UINT32
) (GPI
));
742 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x390, (UINT32
)~(0x187), (UINT32
) (0x101));
747 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x328, (UINT32
)~(0x7), (UINT32
) (GPI
));
748 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x320, (UINT32
)~(0x187), (UINT32
) (0x101));
753 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x3a8, (UINT32
)~(0x7), (UINT32
) (GPI
));
754 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x3a0, (UINT32
)~(0x187), (UINT32
) (0x101));
759 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x348, (UINT32
)~(0x7), (UINT32
) (GPI
));
760 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x340, (UINT32
)~(0x187), (UINT32
) (0x81));
765 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x358, (UINT32
)~(0x7), (UINT32
) (GPI
));
766 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x350, (UINT32
)~(0x187), (UINT32
) (0x101));
771 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x3b8, (UINT32
)~(0x7), (UINT32
) (GPI
));
772 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x3b0, (UINT32
)~(0x187), (UINT32
) (0x81));
777 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x288, (UINT32
)~(0x7), (UINT32
) (GPI
));
778 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x280, (UINT32
)~(0x187), (UINT32
) (0x101));
790 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x210, (UINT32
)~(0x0f000007), (UINT32
) (0x00));
791 MmioAndThenOr32 (IO_BASE_ADDRESS
+ GPIO_SSUS_OFFSET
+ 0x1e0, (UINT32
)~(0x0f000007), (UINT32
) (0x00));
797 Platform specific initializations in stage1.
799 @param FfsHeader Pointer to the PEIM FFS file header.
800 @param PeiServices General purpose services available to every PEIM.
802 @retval EFI_SUCCESS Operation completed successfully.
803 @retval Otherwise Platform initialization failed.
807 PlatformEarlyInitEntry (
809 IN EFI_PEI_FILE_HANDLE FileHandle
,
810 IN CONST EFI_PEI_SERVICES
**PeiServices
814 SYSTEM_CONFIGURATION SystemConfiguration
;
815 EFI_PLATFORM_INFO_HOB
*PlatformInfo
;
816 EFI_PEI_HOB_POINTERS Hob
;
817 EFI_PLATFORM_CPU_INFO PlatformCpuInfo
;
818 EFI_SMRAM_HOB_DESCRIPTOR_BLOCK
*DescriptorBlock
;
819 EFI_SMRAM_HOB_DESCRIPTOR_BLOCK
*NewDescriptorBlock
;
827 // Make sure base and size of the SMRAM region is aligned
829 Hob
.Raw
= GetFirstGuidHob (&gEfiSmmPeiSmramMemoryReserveGuid
);
830 if (Hob
.Raw
!= NULL
) {
831 DescriptorBlock
= GET_GUID_HOB_DATA (Hob
.Raw
);
832 DEBUG ((DEBUG_INFO
, "SMM PEI SMRAM Memory Reserved HOB\n"));
833 for (Index
= 0; Index
< DescriptorBlock
->NumberOfSmmReservedRegions
; Index
++) {
834 DEBUG((DEBUG_INFO
, " SMRAM Descriptor[%02x]: Start=%016lx Size=%016lx State=%02x\n",
836 DescriptorBlock
->Descriptor
[Index
].PhysicalStart
,
837 DescriptorBlock
->Descriptor
[Index
].PhysicalSize
,
838 DescriptorBlock
->Descriptor
[Index
].RegionState
843 // Find the largest usable range of SMRAM between 1MB and 4GB
845 for (Index
= 0, MaxIndex
= 0, Size
= 0; Index
< DescriptorBlock
->NumberOfSmmReservedRegions
; Index
++) {
847 // Skip any SMRAM region that is already allocated, needs testing, or needs ECC initialization
849 if ((DescriptorBlock
->Descriptor
[Index
].RegionState
& (EFI_ALLOCATED
| EFI_NEEDS_TESTING
| EFI_NEEDS_ECC_INITIALIZATION
)) != 0) {
853 // Skip any SMRAM region below 1MB
855 if (DescriptorBlock
->Descriptor
[Index
].CpuStart
< BASE_1MB
) {
859 // Skip any SMRAM region that is above 4GB or crosses the 4GB boundary
861 if ((DescriptorBlock
->Descriptor
[Index
].CpuStart
+ DescriptorBlock
->Descriptor
[Index
].PhysicalSize
) >= BASE_4GB
) {
865 // Cache the largest SMRAM region index
867 if (DescriptorBlock
->Descriptor
[Index
].PhysicalSize
>= DescriptorBlock
->Descriptor
[MaxIndex
].PhysicalSize
) {
873 // Find the extent of the contiguous SMRAM region that surrounds the largest usable SMRAM range
875 Base
= DescriptorBlock
->Descriptor
[MaxIndex
].CpuStart
;
876 Size
= DescriptorBlock
->Descriptor
[MaxIndex
].PhysicalSize
;
877 for (Index
= 0; Index
< DescriptorBlock
->NumberOfSmmReservedRegions
; Index
++) {
878 if (DescriptorBlock
->Descriptor
[Index
].CpuStart
< Base
&&
879 Base
== (DescriptorBlock
->Descriptor
[Index
].CpuStart
+ DescriptorBlock
->Descriptor
[Index
].PhysicalSize
)) {
880 Base
= DescriptorBlock
->Descriptor
[Index
].CpuStart
;
881 Size
+= DescriptorBlock
->Descriptor
[Index
].PhysicalSize
;
882 } else if ((Base
+ Size
) == DescriptorBlock
->Descriptor
[Index
].CpuStart
) {
883 Size
+= DescriptorBlock
->Descriptor
[Index
].PhysicalSize
;
888 // Round SMRAM region up to nearest power of 2 that is at least 4KB
890 NewSize
= MAX (LShiftU64 (1, HighBitSet64 (Size
- 1) + 1), SIZE_4KB
);
891 if ((Base
& ~(NewSize
- 1)) != Base
) {
893 // SMRAM region Base Address has smaller alignment than SMRAM region Size
894 // This is not compatible with SMRR settings
896 DEBUG((DEBUG_ERROR
, "ERROR: SMRAM Region Size has larger alignment than SMRAM Region Base\n"));
897 DEBUG((DEBUG_ERROR
, " SMRAM Region Base=%016lx Size=%016lx\n", Base
, NewSize
));
899 } else if (Size
!= NewSize
) {
901 // See if the size difference can be added to an adjacent descriptor that is already allocated
903 for (Index
= 0; Index
< DescriptorBlock
->NumberOfSmmReservedRegions
; Index
++) {
904 if ((DescriptorBlock
->Descriptor
[Index
].CpuStart
+ DescriptorBlock
->Descriptor
[Index
].PhysicalSize
) == (Base
+ Size
)) {
905 if (((DescriptorBlock
->Descriptor
[Index
].RegionState
) & EFI_ALLOCATED
) != 0) {
906 DescriptorBlock
->Descriptor
[Index
].PhysicalSize
+= (NewSize
- Size
);
913 if (Size
!= NewSize
) {
915 // Add an allocated descriptor to the SMM PEI SMRAM Memory Reserved HOB to accomodate the larger size.
917 Index
= DescriptorBlock
->NumberOfSmmReservedRegions
;
918 NewDescriptorBlock
= (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK
*)BuildGuidHob (
919 &gEfiSmmPeiSmramMemoryReserveGuid
,
920 sizeof (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK
) + ((Index
+ 1) * sizeof (EFI_SMRAM_DESCRIPTOR
))
922 ASSERT (NewDescriptorBlock
!= NULL
);
925 // Copy old EFI_SMRAM_HOB_DESCRIPTOR_BLOCK to new allocated region
930 sizeof (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK
) + (Index
* sizeof (EFI_SMRAM_DESCRIPTOR
))
934 // Make sure last descriptor in NewDescriptorBlock contains last descriptor from DescriptorBlock
937 &NewDescriptorBlock
->Descriptor
[Index
],
938 &NewDescriptorBlock
->Descriptor
[Index
- 1],
939 sizeof (EFI_SMRAM_DESCRIPTOR
)
943 // Fill next to last descriptor with an allocated descriptor that aligns the total size of SMRAM
945 NewDescriptorBlock
->Descriptor
[Index
- 1].CpuStart
= Base
+ Size
;
946 NewDescriptorBlock
->Descriptor
[Index
- 1].PhysicalStart
= Base
+ Size
;
947 NewDescriptorBlock
->Descriptor
[Index
- 1].PhysicalSize
= NewSize
- Size
;
948 NewDescriptorBlock
->Descriptor
[Index
- 1].RegionState
= DescriptorBlock
->Descriptor
[MaxIndex
].RegionState
| EFI_ALLOCATED
;
949 NewDescriptorBlock
->NumberOfSmmReservedRegions
++;
952 // Invalidate the original gEfiSmmPeiSmramMemoryReserveGuid HOB
954 ZeroMem (&Hob
.Guid
->Name
, sizeof (&Hob
.Guid
->Name
));
957 Hob
.Raw
= GetFirstGuidHob (&gEfiSmmPeiSmramMemoryReserveGuid
);
958 DescriptorBlock
= GET_GUID_HOB_DATA (Hob
.Raw
);
959 DEBUG ((DEBUG_INFO
, "SMM PEI SMRAM Memory Reserved HOB - Updated\n"));
960 for (Index
= 0; Index
< DescriptorBlock
->NumberOfSmmReservedRegions
; Index
++) {
961 DEBUG((DEBUG_INFO
, " SMRAM Descriptor[%02x]: Start=%016lx Size=%016lx State=%02x\n",
963 DescriptorBlock
->Descriptor
[Index
].PhysicalStart
,
964 DescriptorBlock
->Descriptor
[Index
].PhysicalSize
,
965 DescriptorBlock
->Descriptor
[Index
].RegionState
972 // Initialize SmbusPolicy PPI
974 Status
= (*PeiServices
)->InstallPpi(PeiServices
, &mInstallSmbusPolicyPpi
);
975 ASSERT_EFI_ERROR (Status
);
978 // Initialize Stall PPIs
980 Status
= (*PeiServices
)->InstallPpi (PeiServices
, &mInstallStallPpi
);
981 ASSERT_EFI_ERROR (Status
);
984 // Initialize platform PPIs
986 Status
= (*PeiServices
)->InstallPpi (PeiServices
, &mInstallSpeakerInterfacePpi
);
987 ASSERT_EFI_ERROR (Status
);
990 // Variable initialization
992 ZeroMem(&PlatformCpuInfo
, sizeof(EFI_PLATFORM_CPU_INFO
));
995 // Set the some PCI and chipset range as UC
996 // And align to 1M at leaset
998 Hob
.Raw
= GetFirstGuidHob (&gEfiPlatformInfoGuid
);
999 ASSERT (Hob
.Raw
!= NULL
);
1000 PlatformInfo
= GET_GUID_HOB_DATA(Hob
.Raw
);
1003 // Initialize PlatformInfo HOB
1005 MultiPlatformInfoInit(PeiServices
, PlatformInfo
);
1008 // Do basic MCH init
1010 MchInit (PeiServices
);
1013 // Set the new boot mode
1015 Status
= UpdateBootMode (PeiServices
, PlatformInfo
);
1016 ASSERT_EFI_ERROR (Status
);
1018 SetPlatformBootMode (PeiServices
, PlatformInfo
);
1021 // Get setup variable. This can only be done after BootMode is updated
1023 GetSetupVariable (PeiServices
, &SystemConfiguration
);
1025 CheckOsSelection(PeiServices
, &SystemConfiguration
);
1028 // Update PlatformInfo HOB according to setup variable
1030 PlatformInfoUpdate(PeiServices
, PlatformInfo
, &SystemConfiguration
);
1032 InitializePlatform (PeiServices
, PlatformInfo
, &SystemConfiguration
);
1035 // Initialize VlvPolicy PPI
1037 Status
= VlvPolicyInit (PeiServices
, &SystemConfiguration
);
1038 ASSERT_EFI_ERROR (Status
);
1041 // Soc specific GPIO setting
1043 ConfigureSoCGpio(&SystemConfiguration
);
1046 // Baylake Board specific.
1048 if (PlatformInfo
->BoardId
== BOARD_ID_BL_RVP
||
1049 PlatformInfo
->BoardId
== BOARD_ID_BL_FFRD
||
1050 PlatformInfo
->BoardId
== BOARD_ID_BL_FFRD8
||
1051 PlatformInfo
->BoardId
== BOARD_ID_BL_RVP_DDR3L
||
1052 PlatformInfo
->BoardId
== BOARD_ID_BL_STHI
||
1053 PlatformInfo
->BoardId
== BOARD_ID_BB_RVP
||
1054 PlatformInfo
->BoardId
== BOARD_ID_BS_RVP
||
1055 PlatformInfo
->BoardId
== BOARD_ID_MINNOW2
||
1056 PlatformInfo
->BoardId
== BOARD_ID_MINNOW2_TURBOT
||
1057 PlatformInfo
->BoardId
== BOARD_ID_CVH
) {
1058 ConfigureLpssAndSccGpio(&SystemConfiguration
, PlatformInfo
);
1065 // Alpine Valley and Bayley Bay board specific
1067 ConfigureLpeGpio(&SystemConfiguration
);
1070 // Bayley Bay Board specific.
1072 ConfigureSciSmiGpioRout(PlatformInfo
);
1073 if (SystemConfiguration
.LpssI2C3Enabled
== 1) {
1079 // Do basic CPU init
1081 Status
= PlatformCpuInit (PeiServices
, &SystemConfiguration
, &PlatformCpuInfo
);
1084 // Perform basic SSA related platform initialization
1086 PlatformSsaInit (&SystemConfiguration
,PeiServices
);
1090 // Do basic PCH init
1092 Status
= PlatformPchInit (&SystemConfiguration
, PeiServices
, PlatformInfo
->PlatformType
);
1093 ASSERT_EFI_ERROR (Status
);
1096 // Initialize platform PPIs
1098 Status
= (*PeiServices
)->InstallPpi (PeiServices
, &mPpiList
[0]);
1099 ASSERT_EFI_ERROR (Status
);
1101 if (PlatformInfo
->BoardId
!= BOARD_ID_CVH
) {
1102 InstallPlatformClocksNotify (PeiServices
);
1103 InstallPlatformSysCtrlGPIONotify(PeiServices
);
1107 // Initialize platform PPIs
1109 Status
= (*PeiServices
)->NotifyPpi(PeiServices
, &mNotifyList
[0]);
1110 ASSERT_EFI_ERROR (Status
);
1113 // Initialize Measured Boot
1115 Status
= MeasuredBootInit (PeiServices
, &SystemConfiguration
);
1116 ASSERT_EFI_ERROR (Status
);
1123 Return the mainblockcompact Fv.
1125 @param FvNumber Our enumeration of the firmware volumes we care about.
1127 @param FvAddress Base Address of the memory containing the firmware volume
1130 @retval EFI_NOT_FOUND
1136 IN EFI_PEI_FIND_FV_PPI
*This
,
1137 IN CONST EFI_PEI_SERVICES
**PeiServices
,
1138 IN OUT UINT8
*FvNumber
,
1139 OUT EFI_FIRMWARE_VOLUME_HEADER
**FVAddress
1143 // At present, we only have one Fv to search
1145 if (*FvNumber
== 0) {
1147 *FVAddress
= (EFI_FIRMWARE_VOLUME_HEADER
*)(UINTN
)FixedPcdGet32 (PcdFlashFvMainBase
);
1150 else if (*FvNumber
== 1) {
1152 *FVAddress
= (EFI_FIRMWARE_VOLUME_HEADER
*)(UINTN
)FixedPcdGet32 (PcdFlashFvRecovery2Base
);
1155 else { // Not the one Fv we care about
1156 return EFI_NOT_FOUND
;
1163 IN CONST EFI_PEI_SERVICES
**PeiServices
1166 // MsgBus32Write(CDV_UNIT_PUNIT, PUNIT_CPU_RST, 0x01)
1185 // If we get here we need to mark it as a failure.
1187 return EFI_UNSUPPORTED
;
1192 #pragma GCC pop_options
1194 #pragma optimize ("", on)