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 <
bootstate.h
>
4
#include <
console/console.h
>
5
#include <
console/debug.h
>
6
#include <
cpu/x86/smm.h
>
7
#include <
device/pci.h
>
8
#include <
intelpch/lockdown.h
>
9
#include <soc/pci_devs.h>
10
#include <soc/pm.h>
11
#include <
soc/util.h
>
12
13
#include "chip.h"
14
15
static
void
lock_pam0123
(
void
)
16
{
17
const
struct
device
*dev;
18
19
if
(
get_lockdown_config
() !=
CHIPSET_LOCKDOWN_COREBOOT
)
20
return
;
21
22
dev =
pcidev_path_on_bus
(
get_stack_busno
(1),
PCI_DEVFN
(
SAD_ALL_DEV
,
SAD_ALL_FUNC
));
23
pci_or_config32
(dev,
SAD_ALL_PAM0123_CSR
,
PAM_LOCK
);
24
}
25
26
static
void
soc_finalize
(
void
*unused)
27
{
28
printk
(
BIOS_DEBUG
,
"Finalizing chipset.\n"
);
29
30
/*
31
* Disable ACPI PM timer based on Kconfig
32
*
33
* Disabling ACPI PM timer is necessary for XTAL OSC shutdown.
34
* Disabling ACPI PM timer also switches off TCO.
35
*
36
* Note: In contrast to other platforms supporting PM timer emulation,
37
* disabling the PM timer must be done *after* FSP has run on Xeon-SP,
38
* because FSP makes use of the PM timer.
39
*/
40
if
(!
CONFIG
(USE_PM_ACPI_TIMER))
41
setbits8
(
pmc_mmio_regs
() +
PCH_PWRM_ACPI_TMR_CTL
,
ACPI_TIM_DIS
);
42
43
apm_control
(
APM_CNT_FINALIZE
);
44
lock_pam0123
();
45
46
post_code
(
POST_OS_BOOT
);
47
}
48
49
BOOT_STATE_INIT_ENTRY
(
BS_PAYLOAD_LOAD
,
BS_ON_ENTRY
,
soc_finalize
,
NULL
);
pmc_mmio_regs
uint8_t * pmc_mmio_regs(void)
Definition:
pmutil.c:142
bootstate.h
BS_PAYLOAD_LOAD
@ BS_PAYLOAD_LOAD
Definition:
bootstate.h:88
BS_ON_ENTRY
@ BS_ON_ENTRY
Definition:
bootstate.h:95
printk
#define printk(level,...)
Definition:
stdlib.h:16
console.h
pcidev_path_on_bus
DEVTREE_CONST struct device * pcidev_path_on_bus(unsigned int bus, pci_devfn_t devfn)
Definition:
device_const.c:221
CONFIG
@ CONFIG
Definition:
dsi_common.h:201
debug.h
smm.h
APM_CNT_FINALIZE
#define APM_CNT_FINALIZE
Definition:
smm.h:24
setbits8
#define setbits8(addr, set)
Definition:
mmio.h:19
pci_or_config32
static __always_inline void pci_or_config32(const struct device *dev, u16 reg, u32 ormask)
Definition:
pci_ops.h:191
ACPI_TIM_DIS
#define ACPI_TIM_DIS
Definition:
pmc.h:108
PCH_PWRM_ACPI_TMR_CTL
#define PCH_PWRM_ACPI_TMR_CTL
Definition:
pmc.h:107
lockdown.h
get_lockdown_config
int get_lockdown_config(void)
Definition:
lockdown.c:22
BIOS_DEBUG
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition:
loglevel.h:128
pci.h
PCI_DEVFN
#define PCI_DEVFN(slot, func)
Definition:
pci_def.h:548
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
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)
CHIPSET_LOCKDOWN_COREBOOT
@ CHIPSET_LOCKDOWN_COREBOOT
Definition:
cfg.h:12
SAD_ALL_FUNC
#define SAD_ALL_FUNC
Definition:
pci_devs.h:12
SAD_ALL_PAM0123_CSR
#define SAD_ALL_PAM0123_CSR
Definition:
pci_devs.h:13
SAD_ALL_DEV
#define SAD_ALL_DEV
Definition:
pci_devs.h:11
soc_finalize
static void soc_finalize(void *unused)
Definition:
finalize.c:26
lock_pam0123
static void lock_pam0123(void)
Definition:
finalize.c:15
util.h
get_stack_busno
uint8_t get_stack_busno(const uint8_t stack)
Definition:
util.c:16
NULL
#define NULL
Definition:
stddef.h:19
device
Definition:
device.h:107
PAM_LOCK
#define PAM_LOCK
Definition:
systemagent_def.h:39
src
soc
intel
xeon_sp
finalize.c
Generated by
1.9.1