]> git.proxmox.com Git - mirror_edk2.git/blob - QuarkPlatformPkg/Platform/Pei/PlatformConfig/PlatformConfigPei.c
QuarkPlatformPkg: Add new package for Galileo boards
[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 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #include <PiPei.h>
17 #include <Library/IntelQNCLib.h>
18 #include <Library/PlatformHelperLib.h>
19 #include <Library/QNCAccessLib.h>
20
21 VOID
22 EFIAPI
23 LegacySpiProtect (
24 VOID
25 )
26 {
27 UINT32 RegVal;
28
29 RegVal = PcdGet32 (PcdLegacyProtectedBIOSRange0Pei);
30 if (RegVal != 0) {
31 PlatformWriteFirstFreeSpiProtect (
32 RegVal,
33 0,
34 0
35 );
36 }
37 RegVal = PcdGet32 (PcdLegacyProtectedBIOSRange1Pei);
38 if (RegVal != 0) {
39 PlatformWriteFirstFreeSpiProtect (
40 RegVal,
41 0,
42 0
43 );
44 }
45 RegVal = PcdGet32 (PcdLegacyProtectedBIOSRange2Pei);
46 if (RegVal != 0) {
47 PlatformWriteFirstFreeSpiProtect (
48 RegVal,
49 0,
50 0
51 );
52 }
53
54 //
55 // Make legacy SPI READ/WRITE enabled if not a secure build
56 //
57 LpcPciCfg32And (R_QNC_LPC_BIOS_CNTL, ~B_QNC_LPC_BIOS_CNTL_BIOSWE);
58 }
59
60 /** PlatformConfigPei driver entry point.
61
62 Platform config in PEI stage.
63
64 @param[in] FfsHeader Pointer to Firmware File System file header.
65 @param[in] PeiServices General purpose services available to every PEIM.
66
67 @retval EFI_SUCCESS Platform config success.
68 */
69 EFI_STATUS
70 EFIAPI
71 PlatformConfigPeiInit (
72 IN EFI_PEI_FILE_HANDLE FileHandle,
73 IN CONST EFI_PEI_SERVICES **PeiServices
74 )
75 {
76 //
77 // Do SOC Init Pre memory init.
78 //
79 PeiQNCPreMemInit ();
80
81 //
82 // Protect areas specified by PCDs.
83 //
84 LegacySpiProtect ();
85
86 return EFI_SUCCESS;
87 }