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
|
/** @file
Implementation of Fsp Misc UPD Initialization.
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <PiPei.h>
#include <Library/DebugLib.h>
#include <Library/PeiLib.h>
#include <Library/ConfigBlockLib.h>
#include <FspEas.h>
#include <FspmUpd.h>
#include <FspsUpd.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/DebugPrintErrorLevelLib.h>
#include <Library/PciLib.h>
#include <Guid/MemoryOverwriteControl.h>
#include <PchAccess.h>
/**
Performs FSP Misc UPD initialization.
@param[in][out] FspmUpd Pointer to FSPM_UPD Data.
@retval EFI_SUCCESS FSP UPD Data is updated.
**/
EFI_STATUS
EFIAPI
PeiFspMiscUpdUpdatePreMem (
IN OUT FSPM_UPD *FspmUpd
)
{
EFI_STATUS Status;
UINTN VariableSize;
VOID *MemorySavedData;
UINT8 MorControl;
VOID *MorControlPtr;
//
// Initialize S3 Data variable (S3DataPtr). It may be used for warm and fast boot paths.
//
VariableSize = 0;
MemorySavedData = NULL;
Status = PeiGetVariable (
L"MemoryConfig",
&gFspNonVolatileStorageHobGuid,
&MemorySavedData,
&VariableSize
);
DEBUG ((DEBUG_INFO, "Get L\"MemoryConfig\" gFspNonVolatileStorageHobGuid - %r\n", Status));
DEBUG ((DEBUG_INFO, "MemoryConfig Size - 0x%x\n", VariableSize));
FspmUpd->FspmArchUpd.NvsBufferPtr = MemorySavedData;
if (FspmUpd->FspmArchUpd.NvsBufferPtr != NULL) {
//
// Set the DISB bit in PCH (DRAM Initialization Scratchpad Bit - GEN_PMCON_A[23]),
// after memory Data is saved to NVRAM.
//
PciOr32 ((UINTN)PCI_LIB_ADDRESS (0, PCI_DEVICE_NUMBER_PCH_PMC, PCI_FUNCTION_NUMBER_PCH_PMC, R_PCH_PMC_GEN_PMCON_A), B_PCH_PMC_GEN_PMCON_A_DISB);
}
//
// MOR
//
MorControl = 0;
MorControlPtr = &MorControl;
VariableSize = sizeof (MorControl);
Status = PeiGetVariable (
MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
&gEfiMemoryOverwriteControlDataGuid,
&MorControlPtr,
&VariableSize
);
DEBUG ((DEBUG_INFO, "MorControl - 0x%x (%r)\n", MorControl, Status));
if (MOR_CLEAR_MEMORY_VALUE (MorControl)) {
FspmUpd->FspmConfig.CleanMemory = (BOOLEAN)(MorControl & MOR_CLEAR_MEMORY_BIT_MASK);
}
return EFI_SUCCESS;
}
|