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 <amdblocks/acpimmio.h>
4 #include <bootblock_common.h>
5 #include <stdint.h>
6 #include <device/pci_ops.h>
9 
10 #define SERIAL_DEV PNP_DEV(0x2e, IT8728F_SP1)
11 #define GPIO_DEV PNP_DEV(0x2e, IT8728F_GPIO)
12 #define CLKIN_DEV PNP_DEV(0x2e, IT8728F_GPIO)
13 
14 static void sbxxx_enable_48mhzout(void)
15 {
16  u32 reg32;
17 
18  /* Set auxiliary output clock frequency on OSCOUT1 pin to be 48MHz */
19  reg32 = misc_read32(0x28);
20  reg32 &= 0xfff8ffff;
21  misc_write32(0x28, reg32);
22 
23  /* Enable Auxiliary Clock1, disable FCH 14 MHz OscClk */
24  reg32 = misc_read32(0x40);
25  reg32 &= 0xffffbffb;
26  misc_write32(0x40, reg32);
27 }
28 
30 {
31  u8 byte;
32 
33  /* Enable the AcpiMmio space */
34  pm_io_write8(0x24, 1);
35 
36  /* Set LPC decode enables. */
37  const pci_devfn_t dev = PCI_DEV(0, 0x14, 3);
38  pci_write_config32(dev, 0x44, 0xff03ffd5);
39 
40  /* enable SIO LPC decode */
41  byte = pci_read_config8(dev, 0x48);
42  byte |= 3; /* 2e, 2f */
43  pci_write_config8(dev, 0x48, byte);
44 
45  /* enable serial decode */
46  byte = pci_read_config8(dev, 0x44);
47  byte |= (1 << 6); /* 0x3f8 */
48  pci_write_config8(dev, 0x44, byte);
49 
50  /* enable SIO clock */
52 
53  /* Enable serial output on it8728f */
56  ite_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
57 }
static uint32_t misc_read32(uint8_t reg)
Definition: acpimmio.h:266
static void misc_write32(uint8_t reg, uint32_t value)
Definition: acpimmio.h:281
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
Definition: pci_ops.h:76
static __always_inline u8 pci_read_config8(const struct device *dev, u16 reg)
Definition: pci_ops.h:46
static __always_inline void pci_write_config8(const struct device *dev, u16 reg, u8 val)
Definition: pci_ops.h:64
void ite_enable_serial(pnp_devfn_t dev, u16 iobase)
Definition: early_serial.c:61
void ite_kill_watchdog(pnp_devfn_t dev)
Definition: early_serial.c:129
void ite_conf_clkin(pnp_devfn_t dev, u8 predivide)
Definition: early_serial.c:55
#define ITE_UART_CLK_PREDIVIDE_48
Definition: ite.h:9
__weak void bootblock_mainboard_early_init(void)
Definition: bootblock.c:16
#define GPIO_DEV
Definition: bootblock.c:11
static void sbxxx_enable_48mhzout(void)
Definition: bootblock.c:14
#define CLKIN_DEV
Definition: bootblock.c:12
#define SERIAL_DEV
Definition: bootblock.c:10
void pm_io_write8(uint8_t reg, uint8_t value)
Definition: mmio_util.c:119
#define PCI_DEV(SEGBUS, DEV, FN)
Definition: pci_type.h:14
u32 pci_devfn_t
Definition: pci_type.h:8
uint32_t u32
Definition: stdint.h:51
uint8_t u8
Definition: stdint.h:45