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
/*
4
* This file is created based on Intel Alder Lake Processor PCH Datasheet
5
* Document number: 621483
6
* Chapter number: 4, 29
7
*/
8
9
#include <arch/io.h>
10
#include <
bootstate.h
>
11
#include <
commonlib/console/post_codes.h
>
12
#include <
console/console.h
>
13
#include <
cpu/x86/smm.h
>
14
#include <
device/mmio.h
>
15
#include <
device/pci.h
>
16
#include <
intelblocks/cse.h
>
17
#include <
intelblocks/lpc_lib.h
>
18
#include <
intelblocks/pcr.h
>
19
#include <
intelblocks/pmclib.h
>
20
#include <
intelblocks/systemagent.h
>
21
#include <
intelblocks/tco.h
>
22
#include <soc/p2sb.h>
23
#include <soc/pci_devs.h>
24
#include <soc/pcr_ids.h>
25
#include <soc/pm.h>
26
#include <soc/smbus.h>
27
#include <soc/soc_chip.h>
28
#include <soc/systemagent.h>
29
#include <
spi-generic.h
>
30
31
#define CAMERA1_CLK 0x8000
/* Camera 1 Clock */
32
#define CAMERA2_CLK 0x8080
/* Camera 2 Clock */
33
#define CAM_CLK_EN (1 << 1)
34
#define MIPI_CLK (1 << 0)
35
#define HDPLL_CLK (0 << 0)
36
37
static
void
pch_enable_isclk
(
void
)
38
{
39
pcr_or32
(
PID_ISCLK
,
CAMERA1_CLK
,
CAM_CLK_EN
|
MIPI_CLK
);
40
pcr_or32
(
PID_ISCLK
,
CAMERA2_CLK
,
CAM_CLK_EN
|
MIPI_CLK
);
41
}
42
43
static
void
pch_handle_sideband
(
config_t
*
config
)
44
{
45
if
(
config
->pch_isclk)
46
pch_enable_isclk
();
47
}
48
49
static
void
pch_finalize
(
void
)
50
{
51
config_t
*
config
=
config_of_soc
();
52
53
/* TCO Lock down */
54
tco_lockdown
();
55
56
/* TODO: Add Thermal Configuration */
57
58
pch_handle_sideband
(
config
);
59
60
pmc_clear_pmcon_sts
();
61
}
62
63
static
void
tbt_finalize
(
void
)
64
{
65
int
i;
66
const
struct
device
*dev;
67
68
/* Disable Thunderbolt PCIe root ports bus master */
69
for
(i = 0; i <
NUM_TBT_FUNCTIONS
; i++) {
70
dev =
pcidev_path_on_root
(
SA_DEVFN_TBT
(i));
71
if
(dev)
72
pci_dev_disable_bus_master
(dev);
73
}
74
}
75
76
static
void
heci_finalize
(
void
)
77
{
78
heci_set_to_d0i3
();
79
if
(
CONFIG
(DISABLE_HECI1_AT_PRE_BOOT))
80
heci1_disable
();
81
}
82
83
static
void
soc_finalize
(
void
*unused)
84
{
85
printk
(
BIOS_DEBUG
,
"Finalizing chipset.\n"
);
86
87
pch_finalize
();
88
apm_control
(
APM_CNT_FINALIZE
);
89
tbt_finalize
();
90
if
(
CONFIG
(USE_FSP_NOTIFY_PHASE_READY_TO_BOOT) &&
91
CONFIG
(USE_FSP_NOTIFY_PHASE_END_OF_FIRMWARE))
92
heci_finalize
();
93
94
/* Indicate finalize step with post code */
95
post_code
(
POST_OS_BOOT
);
96
}
97
98
BOOT_STATE_INIT_ENTRY
(
BS_OS_RESUME
,
BS_ON_ENTRY
,
soc_finalize
,
NULL
);
99
/*
100
* The purpose of this change is to accommodate more time to push out sending
101
* CSE EOP messages at post.
102
*/
103
BOOT_STATE_INIT_ENTRY
(
BS_PAYLOAD_BOOT
,
BS_ON_ENTRY
,
soc_finalize
,
NULL
);
PID_ISCLK
#define PID_ISCLK
Definition:
pcr_ids.h:26
bootstate.h
BS_PAYLOAD_BOOT
@ BS_PAYLOAD_BOOT
Definition:
bootstate.h:89
BS_OS_RESUME
@ BS_OS_RESUME
Definition:
bootstate.h:86
BS_ON_ENTRY
@ BS_ON_ENTRY
Definition:
bootstate.h:95
heci_set_to_d0i3
void heci_set_to_d0i3(void)
Definition:
cse.c:1012
pcr.h
pcr_or32
void pcr_or32(uint8_t pid, uint16_t offset, uint32_t ordata)
Definition:
pcr.c:184
systemagent.h
printk
#define printk(level,...)
Definition:
stdlib.h:16
console.h
cse.h
pcidev_path_on_root
DEVTREE_CONST struct device * pcidev_path_on_root(pci_devfn_t devfn)
Definition:
device_const.c:255
heci1_disable
void heci1_disable(void)
Definition:
disable_heci.c:84
CONFIG
@ CONFIG
Definition:
dsi_common.h:201
smm.h
APM_CNT_FINALIZE
#define APM_CNT_FINALIZE
Definition:
smm.h:24
config_of_soc
#define config_of_soc()
Definition:
device.h:394
mmio.h
BIOS_DEBUG
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition:
loglevel.h:128
lpc_lib.h
config
enum board_config config
Definition:
memory.c:448
pci.h
pci_dev_disable_bus_master
void pci_dev_disable_bus_master(const struct device *dev)
Definition:
pci_device.c:1616
post_code
#define post_code(value)
Definition:
post_code.h:12
post_codes.h
POST_OS_BOOT
#define POST_OS_BOOT
Final code before OS boots.
Definition:
post_codes.h:414
apm_control
int apm_control(u8 cmd)
Definition:
smi_trigger.c:31
BOOT_STATE_INIT_ENTRY
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, soc_finalize, NULL)
heci_finalize
static void heci_finalize(void)
Definition:
finalize.c:76
CAMERA2_CLK
#define CAMERA2_CLK
Definition:
finalize.c:32
pch_handle_sideband
static void pch_handle_sideband(config_t *config)
Definition:
finalize.c:43
soc_finalize
static void soc_finalize(void *unused)
Definition:
finalize.c:83
CAM_CLK_EN
#define CAM_CLK_EN
Definition:
finalize.c:33
pch_finalize
static void pch_finalize(void)
Definition:
finalize.c:49
MIPI_CLK
#define MIPI_CLK
Definition:
finalize.c:34
CAMERA1_CLK
#define CAMERA1_CLK
Definition:
finalize.c:31
pch_enable_isclk
static void pch_enable_isclk(void)
Definition:
finalize.c:37
tbt_finalize
static void tbt_finalize(void)
Definition:
finalize.c:63
SA_DEVFN_TBT
#define SA_DEVFN_TBT(x)
Definition:
pci_devs.h:48
NUM_TBT_FUNCTIONS
#define NUM_TBT_FUNCTIONS
Definition:
pci_devs.h:49
pmclib.h
pmc_clear_pmcon_sts
void pmc_clear_pmcon_sts(void)
tco.h
tco_lockdown
void tco_lockdown(void)
Definition:
tco.c:50
spi-generic.h
NULL
#define NULL
Definition:
stddef.h:19
device
Definition:
device.h:107
ec_kontron_it8516e_config
Definition:
chip.h:8
src
soc
intel
alderlake
finalize.c
Generated by
1.9.1