coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
early_init.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include <bootblock_common.h>
4 #include <device/pci_ops.h>
9 
10 #define SERIAL_DEV PNP_DEV(0x4e, W83627THG_SP1)
11 
13 {
14  /* Disable Serial IRQ */
15  pci_write_config8(PCI_DEV(0, 0x1f, 0), SERIRQ_CNTL, 0x00);
16  /* Decode range */
17  pci_or_config16(PCI_DEV(0, 0x1f, 0), LPC_IO_DEC, 0x0010);
20  | COMB_LPC_EN);
21 
22  pci_write_config32(PCI_DEV(0, 0x1f, 0), GEN2_DEC, 0x7c0291);
23 
24  winbond_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
25 }
26 
27 void mb_pirq_setup(void)
28 {
29  /* dev irq route register */
30  RCBA16(D31IR) = 0x0132;
31  RCBA16(D30IR) = 0x0146;
32  RCBA16(D29IR) = 0x0237;
33  RCBA16(D28IR) = 0x3201;
34  RCBA16(D27IR) = 0x0146;
35 
36  /* Does not belong here, but is it needed? */
37  RCBA32(FD) |= FD_INTLAN;
38 }
39 
40 void get_mb_spd_addrmap(u8 *spd_addrmap)
41 {
42  spd_addrmap[0] = 0x50;
43  spd_addrmap[1] = 0x51;
44 }
#define GEN2_DEC
Definition: i82801gx.h:89
#define FD_INTLAN
Definition: i82801gx.h:248
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
Definition: pci_ops.h:76
static __always_inline void pci_or_config16(const struct device *dev, u16 reg, u16 ormask)
Definition: pci_ops.h:180
static __always_inline void pci_write_config16(const struct device *dev, u16 reg, u16 val)
Definition: pci_ops.h:70
static __always_inline void pci_write_config8(const struct device *dev, u16 reg, u8 val)
Definition: pci_ops.h:64
void bootblock_mainboard_early_init(void)
Definition: early_init.c:11
void get_mb_spd_addrmap(u8 *spd_addrmap)
Definition: early_init.c:16
#define SERIAL_DEV
Definition: early_init.c:10
void mb_pirq_setup(void)
Definition: early_init.c:27
#define PCI_DEV(SEGBUS, DEV, FN)
Definition: pci_type.h:14
#define SERIRQ_CNTL
Definition: espi.h:21
#define COMB_LPC_EN
Definition: lpc.h:45
#define KBC_LPC_EN
Definition: lpc.h:40
#define COMA_LPC_EN
Definition: lpc.h:46
#define CNF2_LPC_EN
Definition: lpc.h:37
#define CNF1_LPC_EN
Definition: lpc.h:38
#define LPC_IO_DEC
Definition: lpc.h:35
#define LPC_EN
Definition: lpc.h:36
#define D31IR
Definition: rcba.h:87
#define D30IR
Definition: rcba.h:88
#define D28IR
Definition: rcba.h:90
#define D29IR
Definition: rcba.h:89
#define FD
Definition: rcba.h:125
#define D27IR
Definition: rcba.h:91
#define RCBA16(x)
Definition: rcba.h:13
#define RCBA32(x)
Definition: rcba.h:14
uint8_t u8
Definition: stdint.h:45
void winbond_enable_serial(pnp_devfn_t dev, u16 iobase)
Definition: early_init.c:47