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>
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 
43 {
44  map_rcba();
47  set_spi_speed();
48 
49  /* Enable upper 128bytes of CMOS */
50  RCBA32(RC) = (1 << 2);
51 
54 
55  if (CONFIG(SERIALIO_UART_CONSOLE))
57 }
void __weak bootblock_early_southbridge_init(void)
Definition: bootblock.c:17
@ CONFIG
Definition: dsi_common.h:201
static void enable_spi_prefetching_and_caching(void)
Definition: early_spi.h:8
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
Definition: pci_ops.h:76
void mainboard_config_superio(void)
Definition: bootblock.c:47
#define RCBA
Definition: lpc.h:17
#define GCS
Definition: lpc.h:36
#define RC
Definition: rcba.h:120
#define SPIBAR8(x)
Definition: spi.h:12
#define SPIBAR32(x)
Definition: spi.h:13
void uart_bootblock_init(void)
Definition: uart.c:97
static void pch_enable_lpc(void)
Definition: early_pch.c:51
#define PCH_LPC_DEV
Definition: lpc.h:7
#define RCBA32(x)
Definition: rcba.h:14
static void enable_port80_on_lpc(void)
Definition: bootblock.c:13
static void map_rcba(void)
Definition: bootblock.c:8
static void set_spi_speed(void)
Definition: bootblock.c:22
#define FDOD
Definition: pch.h:653
#define FDOC
Definition: pch.h:652
#define SSFC
Definition: pch.h:651
uint32_t u32
Definition: stdint.h:51
uint8_t u8
Definition: stdint.h:45