coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
vboot.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3
#include <
bootmode.h
>
4
#include <
device/i2c_simple.h
>
5
#include <soc/i2c.h>
6
#include <
soc/reg_access.h
>
7
#include <
spi_flash.h
>
8
#include <
security/vboot/vboot_common.h
>
9
#include <
security/vboot/vbnv.h
>
10
11
#include "
reg_access.h
"
12
#include "
gen1.h
"
13
#include "
gen2.h
"
14
15
int
get_recovery_mode_switch
(
void
)
16
{
17
return
0;
18
}
19
20
int
get_write_protect_state
(
void
)
21
{
22
/* Not write protected */
23
return
0;
24
}
25
26
void
verstage_mainboard_init
(
void
)
27
{
28
const
struct
reg_script
*script;
29
30
/* Crypto Shield I2C Addresses:
31
*
32
* 0x29: AT97S3204T - TPM 1.2
33
* 0x50: ATAES132 - AES-128
34
* 0x60: ATECC108 - Elliptical Curve
35
* 0x64: ATSHA204 - SHA-256
36
* 0x68: DS3231M - RTC
37
*/
38
39
/* Determine the correct script for the board */
40
if
(
CONFIG
(GALILEO_GEN2))
41
script =
gen2_i2c_init
;
42
else
43
/* Determine which I2C address is in use */
44
script = (
reg_legacy_gpio_read
(
R_QNC_GPIO_RGLVL_RESUME_WELL
)
45
&
GALILEO_DETERMINE_IOEXP_SLA_RESUMEWELL_GPIO
)
46
?
gen1_i2c_0x20_init
:
gen1_i2c_0x21_init
;
47
48
/* Direct the I2C SDA and SCL signals to the Arduino connector */
49
reg_script_run
(script);
50
}
51
52
void
__weak
vboot_platform_prepare_reboot
(
void
)
53
{
54
const
struct
reg_script
*script;
55
56
/* Crypto Shield I2C Addresses:
57
*
58
* 0x29: AT97S3204T - TPM 1.2
59
* 0x50: ATAES132 - AES-128
60
* 0x60: ATECC108 - Elliptical Curve
61
* 0x64: ATSHA204 - SHA-256
62
* 0x68: DS3231M - RTC
63
*/
64
65
/* Determine the correct script for the board */
66
if
(
CONFIG
(GALILEO_GEN2))
67
script =
gen2_tpm_reset
;
68
else
69
/* Determine which I2C address is in use */
70
script = (
reg_legacy_gpio_read
(
R_QNC_GPIO_RGLVL_RESUME_WELL
)
71
&
GALILEO_DETERMINE_IOEXP_SLA_RESUMEWELL_GPIO
)
72
?
gen1_tpm_reset_0x20
:
gen1_tpm_reset_0x21
;
73
74
/* Reset the TPM */
75
reg_script_run
(script);
76
}
77
78
int
vbnv_cmos_failed
(
void
)
79
{
80
/* Indicate no failure until RTC failure bits are supported. */
81
return
0;
82
}
R_QNC_GPIO_RGLVL_RESUME_WELL
#define R_QNC_GPIO_RGLVL_RESUME_WELL
Definition:
QuarkNcSocId.h:477
bootmode.h
CONFIG
@ CONFIG
Definition:
dsi_common.h:201
get_recovery_mode_switch
int get_recovery_mode_switch(void)
HACK: Use Fn-Key as recovery mode switch.
Definition:
vboot.c:14
get_write_protect_state
int get_write_protect_state(void)
Only used if CONFIG(CHROMEOS) is set.
Definition:
vboot.c:39
gen1.h
GALILEO_DETERMINE_IOEXP_SLA_RESUMEWELL_GPIO
#define GALILEO_DETERMINE_IOEXP_SLA_RESUMEWELL_GPIO
Definition:
gen1.h:7
gen1_i2c_0x20_init
static const struct reg_script gen1_i2c_0x20_init[]
Definition:
gen1.h:99
gen1_tpm_reset_0x21
static const struct reg_script gen1_tpm_reset_0x21[]
Definition:
gen1.h:154
gen1_tpm_reset_0x20
static const struct reg_script gen1_tpm_reset_0x20[]
Definition:
gen1.h:141
gen1_i2c_0x21_init
static const struct reg_script gen1_i2c_0x21_init[]
Definition:
gen1.h:120
gen2.h
gen2_tpm_reset
static const struct reg_script gen2_tpm_reset[]
Definition:
gen2.h:89
gen2_i2c_init
static const struct reg_script gen2_i2c_init[]
Definition:
gen2.h:64
i2c_simple.h
vboot_platform_prepare_reboot
void __weak vboot_platform_prepare_reboot(void)
Definition:
vboot.c:52
vbnv_cmos_failed
int vbnv_cmos_failed(void)
Definition:
vboot.c:78
verstage_mainboard_init
void verstage_mainboard_init(void)
Definition:
vboot.c:26
reg_script_run
void reg_script_run(const struct reg_script *script)
Definition:
reg_script.c:700
__weak
const struct smm_save_state_ops *legacy_ops __weak
Definition:
save_state.c:8
reg_access.h
reg_legacy_gpio_read
uint32_t reg_legacy_gpio_read(uint32_t reg_address)
Definition:
reg_access.c:208
spi_flash.h
reg_script
Definition:
reg_script.h:64
vbnv.h
vboot_common.h
src
mainboard
intel
galileo
vboot.c
Generated by
1.9.1