]> git.proxmox.com Git - mirror_edk2.git/blob - QuarkPlatformPkg/Platform/Pei/PlatformConfig/PlatformConfigPei.c
024dff89dfc1a2451fb8bf2dd65f41e8979d554b
[mirror_edk2.git] / QuarkPlatformPkg / Platform / Pei / PlatformConfig / PlatformConfigPei.c
1 /** @file
2 Principle source module for Clanton Peak platform config PEIM driver.
3
4 Copyright (c) 2013 Intel Corporation.
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #include <PiPei.h>
11 #include <Library/IntelQNCLib.h>
12 #include <Library/PlatformHelperLib.h>
13 #include <Library/QNCAccessLib.h>
14
15 VOID
16 EFIAPI
17 LegacySpiProtect (
18 VOID
19 )
20 {
21 UINT32 RegVal;
22
23 RegVal = PcdGet32 (PcdLegacyProtectedBIOSRange0Pei);
24 if (RegVal != 0) {
25 PlatformWriteFirstFreeSpiProtect (
26 RegVal,
27 0,
28 0
29 );
30 }
31 RegVal = PcdGet32 (PcdLegacyProtectedBIOSRange1Pei);
32 if (RegVal != 0) {
33 PlatformWriteFirstFreeSpiProtect (
34 RegVal,
35 0,
36 0
37 );
38 }
39 RegVal = PcdGet32 (PcdLegacyProtectedBIOSRange2Pei);
40 if (RegVal != 0) {
41 PlatformWriteFirstFreeSpiProtect (
42 RegVal,
43 0,
44 0
45 );
46 }
47
48 //
49 // Make legacy SPI READ/WRITE enabled if not a secure build
50 //
51 LpcPciCfg32And (R_QNC_LPC_BIOS_CNTL, ~B_QNC_LPC_BIOS_CNTL_BIOSWE);
52 }
53
54 /** PlatformConfigPei driver entry point.
55
56 Platform config in PEI stage.
57
58 @param[in] FfsHeader Pointer to Firmware File System file header.
59 @param[in] PeiServices General purpose services available to every PEIM.
60
61 @retval EFI_SUCCESS Platform config success.
62 */
63 EFI_STATUS
64 EFIAPI
65 PlatformConfigPeiInit (
66 IN EFI_PEI_FILE_HANDLE FileHandle,
67 IN CONST EFI_PEI_SERVICES **PeiServices
68 )
69 {
70 //
71 // Do SOC Init Pre memory init.
72 //
73 PeiQNCPreMemInit ();
74
75 //
76 // Protect areas specified by PCDs.
77 //
78 LegacySpiProtect ();
79
80 return EFI_SUCCESS;
81 }