coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
romstage.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
3
#include <
stdint.h
>
4
#include <
amdblocks/acpimmio.h
>
5
#include <
amdblocks/gpio.h
>
6
#include <
amdblocks/gpio_defs.h
>
7
#include <
device/pci_def.h
>
8
#include <
device/pci_ops.h
>
9
#include <
gpio.h
>
10
#include <
northbridge/amd/agesa/state_machine.h
>
11
12
#include "
gpio_ftns.h
"
13
14
static
void
early_lpc_init
(
void
);
15
16
void
board_BeforeAgesa
(
struct
sysinfo
*cb)
17
{
18
u32
val
;
19
20
early_lpc_init
();
21
22
/* Disable SVI2 controller to wait for command completion */
23
val
=
pci_read_config32
(
PCI_DEV
(0, 0x18, 5), 0x12C);
24
if
(!(
val
& (1 << 30))) {
25
val
|= (1 << 30);
26
pci_write_config32
(
PCI_DEV
(0, 0x18, 5), 0x12C,
val
);
27
}
28
29
/* Release GPIO32/33 for other uses. */
30
pm_write8
(0xea, 1);
31
}
32
33
const
struct
soc_amd_gpio
gpio_common
[] = {
34
PAD_GPI
(
GPIO_49
,
PULL_NONE
),
35
PAD_GPI
(
GPIO_50
,
PULL_NONE
),
36
PAD_GPI
(
GPIO_71
,
PULL_NONE
),
37
PAD_GPO
(
GPIO_57
, LOW),
38
PAD_GPO
(
GPIO_58
, LOW),
39
PAD_GPO
(
GPIO_59
, LOW),
40
PAD_GPO
(
GPIO_51
, HIGH),
41
PAD_GPO
(
GPIO_55
, HIGH),
42
PAD_GPO
(
GPIO_64
, HIGH),
43
PAD_GPO
(
GPIO_68
, HIGH),
44
};
45
46
const
struct
soc_amd_gpio
gpio_apu2
[] = {
47
PAD_GPI
(
GPIO_32
,
PULL_NONE
),
48
};
49
50
const
struct
soc_amd_gpio
gpio_apu34
[] = {
51
PAD_GPI
(
GPIO_32
,
PULL_NONE
),
52
PAD_GPO
(
GPIO_33
, LOW),
53
};
54
55
const
struct
soc_amd_gpio
gpio_apu5
[] = {
56
PAD_GPI
(
GPIO_22
,
PULL_NONE
),
57
PAD_GPO
(
GPIO_32
, HIGH),
58
PAD_GPO
(
GPIO_33
, HIGH),
59
};
60
61
static
void
early_lpc_init
(
void
)
62
{
63
gpio_configure_pads
(
gpio_common
,
ARRAY_SIZE
(
gpio_common
));
64
65
if
(
CONFIG
(BOARD_PCENGINES_APU2))
66
gpio_configure_pads
(
gpio_apu2
,
ARRAY_SIZE
(
gpio_apu2
));
67
68
if
(
CONFIG
(BOARD_PCENGINES_APU3) ||
CONFIG
(BOARD_PCENGINES_APU4))
69
gpio_configure_pads
(
gpio_apu34
,
ARRAY_SIZE
(
gpio_apu34
));
70
71
if
(
CONFIG
(BOARD_PCENGINES_APU5))
72
gpio_configure_pads
(
gpio_apu5
,
ARRAY_SIZE
(
gpio_apu5
));
73
}
acpimmio.h
pm_write8
static void pm_write8(uint8_t reg, uint8_t value)
Definition:
acpimmio.h:181
gpio_ftns.h
GPIO_51
#define GPIO_51
Definition:
gpio_ftns.h:19
GPIO_49
#define GPIO_49
Definition:
gpio_ftns.h:17
GPIO_57
#define GPIO_57
Definition:
gpio_ftns.h:21
GPIO_50
#define GPIO_50
Definition:
gpio_ftns.h:18
GPIO_64
#define GPIO_64
Definition:
gpio_ftns.h:24
GPIO_71
#define GPIO_71
Definition:
gpio_ftns.h:27
GPIO_22
#define GPIO_22
Definition:
gpio_ftns.h:14
GPIO_58
#define GPIO_58
Definition:
gpio_ftns.h:22
GPIO_59
#define GPIO_59
Definition:
gpio_ftns.h:23
GPIO_32
#define GPIO_32
Definition:
gpio_ftns.h:15
GPIO_68
#define GPIO_68
Definition:
gpio_ftns.h:26
GPIO_55
#define GPIO_55
Definition:
gpio_ftns.h:20
GPIO_33
#define GPIO_33
Definition:
gpio_ftns.h:16
ARRAY_SIZE
#define ARRAY_SIZE(a)
Definition:
helpers.h:12
board_BeforeAgesa
void __weak board_BeforeAgesa(struct sysinfo *cb)
Definition:
romstage.c:19
CONFIG
@ CONFIG
Definition:
dsi_common.h:201
PULL_NONE
#define PULL_NONE
Definition:
buildOpts.c:72
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_read_config32
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
Definition:
pci_ops.h:58
early_lpc_init
static void early_lpc_init(void)
Definition:
romstage.c:61
gpio_common
const struct soc_amd_gpio gpio_common[]
Definition:
romstage.c:33
gpio_apu5
const struct soc_amd_gpio gpio_apu5[]
Definition:
romstage.c:55
gpio_apu2
const struct soc_amd_gpio gpio_apu2[]
Definition:
romstage.c:46
gpio_apu34
const struct soc_amd_gpio gpio_apu34[]
Definition:
romstage.c:50
pci_def.h
PCI_DEV
#define PCI_DEV(SEGBUS, DEV, FN)
Definition:
pci_type.h:14
gpio_configure_pads
void gpio_configure_pads(const struct soc_amd_gpio *gpio_list_ptr, size_t size)
program a particular set of GPIO
Definition:
gpio.c:307
gpio.h
gpio_defs.h
PAD_GPO
#define PAD_GPO(pin, direction)
Definition:
gpio_defs.h:220
PAD_GPI
#define PAD_GPI(pin, pull)
Definition:
gpio_defs.h:216
gpio.h
state_machine.h
stdint.h
u32
uint32_t u32
Definition:
stdint.h:51
soc_amd_gpio
Definition:
gpio.h:11
sysinfo
Definition:
state_machine.h:28
val
u8 val
Definition:
sys.c:300
src
mainboard
pcengines
apu2
romstage.c
Generated by
1.9.1