coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
finalize.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
3
#include <
console/console.h
>
4
#include <
device/pci_ops.h
>
5
#include <
southbridge/intel/common/pmbase.h
>
6
#include <
southbridge/intel/common/pmutil.h
>
7
#include <
southbridge/intel/common/rcba.h
>
8
#include <
spi-generic.h
>
9
10
#include "
finalize.h
"
11
12
void
intel_pch_finalize_smm
(
void
)
13
{
14
const
pci_devfn_t
lpc_dev =
PCI_DEV
(0, 0x1f, 0);
15
16
/* Lock SPIBAR */
17
RCBA32_OR
(0x3804, (1 << 15));
18
19
if
(
CONFIG
(SPI_FLASH_SMM))
20
/* Re-init SPI driver to handle locked BAR */
21
spi_init
();
22
23
/* TCLOCKDN: TC Lockdown */
24
RCBA32_OR
(0x0050, (1UL << 31));
25
26
/* BIOS Interface Lockdown */
27
RCBA32_OR
(0x3410, (1 << 0));
28
29
/* Function Disable SUS Well Lockdown */
30
RCBA_AND_OR
(8, 0x3420, ~0U, (1 << 7));
31
32
pci_or_config16
(lpc_dev,
D31F0_GEN_PMCON_1
,
SMI_LOCK
);
33
34
pci_or_config8
(lpc_dev,
D31F0_GEN_PMCON_LOCK
,
35
ACPI_BASE_LOCK
|
SLP_STR_POL_LOCK
);
36
37
pci_update_config32
(lpc_dev,
D31F0_ETR3
, ~
ETR3_CF9GR
,
ETR3_CF9LOCK
);
38
39
if
(
CONFIG
(SOUTHBRIDGE_INTEL_LYNXPOINT))
40
/* PMSYNC */
41
RCBA32_OR
(0x33c4, (1UL << 31));
42
43
/* R/WO registers */
44
RCBA32
(0x21a4) =
RCBA32
(0x21a4);
45
pci_write_config32
(
PCI_DEV
(0, 27, 0), 0x74,
46
pci_read_config32
(
PCI_DEV
(0, 27, 0), 0x74));
47
48
if
(
CONFIG
(BOOTMEDIA_SMM_BWP))
49
write_pmbase16
(
SMI_EN
,
read_pmbase16
(
SMI_EN
) |
TCO_EN
);
50
51
write_pmbase16
(
TCO1_CNT
,
read_pmbase16
(
TCO1_CNT
) |
TCO_LOCK
);
52
53
post_code
(
POST_OS_BOOT
);
54
}
SMI_EN
#define SMI_EN
Definition:
pm.h:32
TCO_EN
#define TCO_EN
Definition:
pm.h:211
console.h
CONFIG
@ CONFIG
Definition:
dsi_common.h:201
finalize.h
pci_ops.h
pci_write_config32
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
Definition:
pci_ops.h:76
pci_update_config32
static __always_inline void pci_update_config32(const struct device *dev, u16 reg, u32 mask, u32 or)
Definition:
pci_ops.h:120
pci_or_config16
static __always_inline void pci_or_config16(const struct device *dev, u16 reg, u16 ormask)
Definition:
pci_ops.h:180
pci_or_config8
static __always_inline void pci_or_config8(const struct device *dev, u16 reg, u8 ormask)
Definition:
pci_ops.h:169
pci_read_config32
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
Definition:
pci_ops.h:58
ACPI_BASE_LOCK
#define ACPI_BASE_LOCK
Definition:
pmc.h:55
SMI_LOCK
#define SMI_LOCK
Definition:
pmc.h:60
SLP_STR_POL_LOCK
#define SLP_STR_POL_LOCK
Definition:
pmc.h:54
ETR3_CF9GR
#define ETR3_CF9GR
CF9h Global Reset.
Definition:
pmc.h:43
ETR3_CF9LOCK
#define ETR3_CF9LOCK
CF9h Lockdown.
Definition:
pmc.h:42
PCI_DEV
#define PCI_DEV(SEGBUS, DEV, FN)
Definition:
pci_type.h:14
pci_devfn_t
u32 pci_devfn_t
Definition:
pci_type.h:8
write_pmbase16
void write_pmbase16(const u8 addr, const u16 val)
Definition:
pmbase.c:43
read_pmbase16
u16 read_pmbase16(const u8 addr)
Definition:
pmbase.c:64
pmbase.h
pmutil.h
D31F0_GEN_PMCON_1
#define D31F0_GEN_PMCON_1
Definition:
pmutil.h:9
D31F0_GEN_PMCON_LOCK
#define D31F0_GEN_PMCON_LOCK
Definition:
pmutil.h:16
D31F0_ETR3
#define D31F0_ETR3
Definition:
pmutil.h:19
post_code
#define post_code(value)
Definition:
post_code.h:12
POST_OS_BOOT
#define POST_OS_BOOT
Final code before OS boots.
Definition:
post_codes.h:414
TCO1_CNT
#define TCO1_CNT
Definition:
smbus.h:12
TCO_LOCK
#define TCO_LOCK
Definition:
smbus.h:13
intel_pch_finalize_smm
void intel_pch_finalize_smm(void)
Definition:
finalize.c:12
rcba.h
RCBA32_OR
#define RCBA32_OR(x, or)
Definition:
rcba.h:22
RCBA_AND_OR
#define RCBA_AND_OR(bits, x, and, or)
Definition:
rcba.h:17
RCBA32
#define RCBA32(x)
Definition:
rcba.h:14
spi_init
void __weak spi_init(void)
Definition:
spi-generic.c:117
spi-generic.h
src
southbridge
intel
common
finalize.c
Generated by
1.9.1