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
>
7
#include <
superio/ite/common/ite.h
>
8
#include <
superio/ite/it8728f/it8728f.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
29
void
bootblock_mainboard_early_init
(
void
)
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 */
51
sbxxx_enable_48mhzout
();
52
53
/* Enable serial output on it8728f */
54
ite_conf_clkin
(
CLKIN_DEV
,
ITE_UART_CLK_PREDIVIDE_48
);
55
ite_kill_watchdog
(
GPIO_DEV
);
56
ite_enable_serial
(
SERIAL_DEV
, CONFIG_TTYS0_BASE);
57
}
acpimmio.h
misc_read32
static uint32_t misc_read32(uint8_t reg)
Definition:
acpimmio.h:266
misc_write32
static void misc_write32(uint8_t reg, uint32_t value)
Definition:
acpimmio.h:281
bootblock_common.h
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_config8
static __always_inline u8 pci_read_config8(const struct device *dev, u16 reg)
Definition:
pci_ops.h:46
pci_write_config8
static __always_inline void pci_write_config8(const struct device *dev, u16 reg, u8 val)
Definition:
pci_ops.h:64
it8728f.h
ite_enable_serial
void ite_enable_serial(pnp_devfn_t dev, u16 iobase)
Definition:
early_serial.c:61
ite_kill_watchdog
void ite_kill_watchdog(pnp_devfn_t dev)
Definition:
early_serial.c:129
ite_conf_clkin
void ite_conf_clkin(pnp_devfn_t dev, u8 predivide)
Definition:
early_serial.c:55
ite.h
ITE_UART_CLK_PREDIVIDE_48
#define ITE_UART_CLK_PREDIVIDE_48
Definition:
ite.h:9
bootblock_mainboard_early_init
__weak void bootblock_mainboard_early_init(void)
Definition:
bootblock.c:16
GPIO_DEV
#define GPIO_DEV
Definition:
bootblock.c:11
sbxxx_enable_48mhzout
static void sbxxx_enable_48mhzout(void)
Definition:
bootblock.c:14
CLKIN_DEV
#define CLKIN_DEV
Definition:
bootblock.c:12
SERIAL_DEV
#define SERIAL_DEV
Definition:
bootblock.c:10
pm_io_write8
void pm_io_write8(uint8_t reg, uint8_t value)
Definition:
mmio_util.c:119
PCI_DEV
#define PCI_DEV(SEGBUS, DEV, FN)
Definition:
pci_type.h:14
pci_devfn_t
u32 pci_devfn_t
Definition:
pci_type.h:8
stdint.h
u32
uint32_t u32
Definition:
stdint.h:51
u8
uint8_t u8
Definition:
stdint.h:45
src
mainboard
biostar
a68n_5200
bootblock.c
Generated by
1.9.1