3 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 #include "PlatformEarlyInit.h"
25 #define LEN_64M 0x4000000
28 // Default PCI32 resource size
30 #define RES_MEM32_MIN_LEN 0x38000000
32 #define RES_IO_BASE 0x0D00
33 #define RES_IO_LIMIT 0xFFFF
35 #define MemoryCeilingVariable L"MemCeil."
39 IN CONST EFI_PEI_SERVICES
**PeiServices
,
40 IN SYSTEM_CONFIGURATION
*SystemConfiguration
44 EFI_PEI_READ_ONLY_VARIABLE2_PPI
*Variable
;
46 EFI_OS_SELECTION_HOB
*OsSelectionHob
;
48 UINT8
*LpssDataHobPtr
;
49 UINT8
*LpssDataVarPtr
;
52 Status
= (*PeiServices
)->LocatePpi (
54 &gEfiPeiReadOnlyVariable2PpiGuid
,
59 if (!EFI_ERROR(Status
)) {
60 VariableSize
= sizeof (OsSelection
);
61 Status
= Variable
->GetVariable (
64 &gOsSelectionVariableGuid
,
70 if (!EFI_ERROR(Status
) && (SystemConfiguration
->ReservedO
!= OsSelection
)) {
72 // Build HOB for OsSelection
74 OsSelectionHob
= BuildGuidHob (&gOsSelectionVariableGuid
, sizeof (EFI_OS_SELECTION_HOB
));
75 ASSERT (OsSelectionHob
!= NULL
);
77 OsSelectionHob
->OsSelectionChanged
= TRUE
;
78 OsSelectionHob
->OsSelection
= OsSelection
;
79 SystemConfiguration
->ReservedO
= OsSelectionHob
->OsSelection
;
82 // Load LPSS and SCC default configurations
84 OsSelectionHob
->LpssData
.LpsseMMCEnabled
= FALSE
;
85 OsSelectionHob
->LpssData
.LpssSdioEnabled
= TRUE
;
86 OsSelectionHob
->LpssData
.LpssSdcardEnabled
= TRUE
;
87 OsSelectionHob
->LpssData
.LpssSdCardSDR25Enabled
= FALSE
;
88 OsSelectionHob
->LpssData
.LpssSdCardDDR50Enabled
= TRUE
;
89 OsSelectionHob
->LpssData
.LpssMipiHsi
= FALSE
;
90 OsSelectionHob
->LpssData
.LpsseMMC45Enabled
= TRUE
;
91 OsSelectionHob
->LpssData
.LpsseMMC45DDR50Enabled
= TRUE
;
92 OsSelectionHob
->LpssData
.LpsseMMC45HS200Enabled
= FALSE
;
93 OsSelectionHob
->LpssData
.LpsseMMC45RetuneTimerValue
= 8;
94 OsSelectionHob
->LpssData
.eMMCBootMode
= 1; // Auto Detect
97 SystemConfiguration
->Lpe
= OsSelectionHob
->Lpe
;
98 SystemConfiguration
->PchAzalia
= SystemConfiguration
->PchAzalia
;
99 LpssDataHobPtr
= &OsSelectionHob
->LpssData
.LpssPciModeEnabled
;
100 LpssDataVarPtr
= &SystemConfiguration
->LpssPciModeEnabled
;
102 for (i
= 0; i
< sizeof(EFI_PLATFORM_LPSS_DATA
); i
++) {
103 *LpssDataVarPtr
= *LpssDataHobPtr
;
116 IN CONST EFI_PEI_SERVICES
**PeiServices
,
117 IN OUT EFI_PLATFORM_INFO_HOB
*PlatformInfoHob
,
118 IN SYSTEM_CONFIGURATION
*SystemConfiguration
122 EFI_PEI_READ_ONLY_VARIABLE2_PPI
*Variable
;
124 UINT32 MemoryCeiling
;
127 // Checking PCI32 resource from previous boot to determine the memory ceiling
129 Status
= (*PeiServices
)->LocatePpi (
131 &gEfiPeiReadOnlyVariable2PpiGuid
,
136 if (!EFI_ERROR(Status
)) {
138 // Get the memory ceiling
140 VariableSize
= sizeof(MemoryCeiling
);
141 Status
= Variable
->GetVariable (
143 MemoryCeilingVariable
,
144 &gEfiGlobalVariableGuid
,
149 if(!EFI_ERROR(Status
)) {
151 // Set the new PCI32 resource Base if the variable available
153 PlatformInfoHob
->PciData
.PciResourceMem32Base
= MemoryCeiling
;
154 PlatformInfoHob
->MemData
.MemMaxTolm
= MemoryCeiling
;
155 PlatformInfoHob
->MemData
.MemTolm
= MemoryCeiling
;
158 // Platform PCI MMIO Size in unit of 1MB
160 PlatformInfoHob
->MemData
.MmioSize
= 0x1000 - (UINT16
)(PlatformInfoHob
->MemData
.MemMaxTolm
>> 20);
168 Initialize the platform related info hob according to the
169 pre-determine value or setup option
171 @retval EFI_SUCCESS Memory initialization completed successfully.
172 @retval Others All other error conditions encountered result in an ASSERT.
176 IN CONST EFI_PEI_SERVICES
**PeiServices
,
177 IN EFI_PLATFORM_INFO_HOB
*PlatformInfoHob
,
178 IN SYSTEM_CONFIGURATION
*SystemConfiguration
182 // -- cchew10 need to update here.