coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
bootblock.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
3
#include <
arch/bootblock.h
>
4
#include <
device/pci_ops.h
>
5
#include <
southbridge/intel/common/early_spi.h
>
6
#include "
pch.h
"
7
8
static
void
map_rcba
(
void
)
9
{
10
pci_write_config32
(
PCH_LPC_DEV
,
RCBA
, CONFIG_FIXED_RCBA_MMIO_BASE | 1);
11
}
12
13
static
void
enable_port80_on_lpc
(
void
)
14
{
15
/* Enable port 80 POST on LPC. The chipset does this by default,
16
* but it doesn't appear to hurt anything. */
17
u32
gcs =
RCBA32
(
GCS
);
18
gcs = gcs & ~0x4;
19
RCBA32
(
GCS
) = gcs;
20
}
21
22
static
void
set_spi_speed
(
void
)
23
{
24
u32
fdod;
25
u8
ssfc;
26
27
/* Observe SPI Descriptor Component Section 0 */
28
SPIBAR32
(
FDOC
) = 0x1000;
29
30
/* Extract the Write/Erase SPI Frequency from descriptor */
31
fdod =
SPIBAR32
(
FDOD
);
32
fdod >>= 24;
33
fdod &= 7;
34
35
/* Set Software Sequence frequency to match */
36
ssfc =
SPIBAR8
(
SSFC
+ 2);
37
ssfc &= ~7;
38
ssfc |= fdod;
39
SPIBAR8
(
SSFC
+ 2) = ssfc;
40
}
41
42
void
bootblock_early_southbridge_init
(
void
)
43
{
44
map_rcba
();
45
enable_spi_prefetching_and_caching
();
46
enable_port80_on_lpc
();
47
set_spi_speed
();
48
49
/* Enable upper 128bytes of CMOS */
50
RCBA32
(
RC
) = (1 << 2);
51
52
pch_enable_lpc
();
53
mainboard_config_superio
();
54
55
if
(
CONFIG
(SERIALIO_UART_CONSOLE))
56
uart_bootblock_init
();
57
}
bootblock.h
bootblock_early_southbridge_init
void __weak bootblock_early_southbridge_init(void)
Definition:
bootblock.c:17
CONFIG
@ CONFIG
Definition:
dsi_common.h:201
early_spi.h
enable_spi_prefetching_and_caching
static void enable_spi_prefetching_and_caching(void)
Definition:
early_spi.h:8
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
mainboard_config_superio
void mainboard_config_superio(void)
Definition:
bootblock.c:47
RCBA
#define RCBA
Definition:
lpc.h:17
GCS
#define GCS
Definition:
lpc.h:36
RC
#define RC
Definition:
rcba.h:120
SPIBAR8
#define SPIBAR8(x)
Definition:
spi.h:12
SPIBAR32
#define SPIBAR32(x)
Definition:
spi.h:13
uart_bootblock_init
void uart_bootblock_init(void)
Definition:
uart.c:97
pch_enable_lpc
static void pch_enable_lpc(void)
Definition:
early_pch.c:51
PCH_LPC_DEV
#define PCH_LPC_DEV
Definition:
lpc.h:7
RCBA32
#define RCBA32(x)
Definition:
rcba.h:14
enable_port80_on_lpc
static void enable_port80_on_lpc(void)
Definition:
bootblock.c:13
map_rcba
static void map_rcba(void)
Definition:
bootblock.c:8
set_spi_speed
static void set_spi_speed(void)
Definition:
bootblock.c:22
pch.h
FDOD
#define FDOD
Definition:
pch.h:653
FDOC
#define FDOC
Definition:
pch.h:652
SSFC
#define SSFC
Definition:
pch.h:651
u32
uint32_t u32
Definition:
stdint.h:51
u8
uint8_t u8
Definition:
stdint.h:45
src
southbridge
intel
lynxpoint
bootblock.c
Generated by
1.9.1