coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
early_pch.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
3
#include <arch/io.h>
4
#include <
console/console.h
>
5
#include <
device/pci_def.h
>
6
#include <
device/pci_ops.h
>
7
#include <
device/smbus_host.h
>
8
#include <
northbridge/intel/ironlake/ironlake.h
>
9
#include <
southbridge/intel/ibexpeak/pch.h
>
10
#include <
southbridge/intel/common/gpio.h
>
11
12
static
void
early_gpio_init
(
void
)
13
{
14
pci_write_config32
(
PCH_LPC_DEV
,
GPIO_BASE
,
DEFAULT_GPIOBASE
| 1);
15
pci_write_config8
(
PCH_LPC_DEV
,
GPIO_CNTL
, 0x10);
16
17
setup_pch_gpios
(&
mainboard_gpio_map
);
18
}
19
20
static
void
pch_default_disable
(
void
)
21
{
22
/* Must set BIT0 (hides performance counters PCI device).
23
coreboot enables the Rate Matching Hub which makes the UHCI PCI
24
devices disappear, so BIT5-12 and BIT28 can be set to hide those. */
25
RCBA32
(
FD
) = (1 << 28) | (0xff << 5) | 1;
26
27
/* Set reserved bit to 1 */
28
RCBA32
(
FD2
) = 1;
29
}
30
31
void
ibexpeak_setup_bars
(
void
)
32
{
33
printk
(
BIOS_DEBUG
,
"Setting up static southbridge registers..."
);
34
pci_write_config32
(
PCI_DEV
(0, 0x1f, 0),
RCBA
, CONFIG_FIXED_RCBA_MMIO_BASE | 1);
35
36
pci_write_config32
(
PCI_DEV
(0, 0x1f, 0),
PMBASE
,
DEFAULT_PMBASE
| 1);
37
/* Enable ACPI BAR */
38
pci_write_config8
(
PCH_LPC_DEV
,
ACPI_CNTL
,
ACPI_EN
);
39
40
printk
(
BIOS_DEBUG
,
" done.\n"
);
41
42
printk
(
BIOS_DEBUG
,
"Disabling Watchdog reboot..."
);
43
/* No reset */
44
RCBA32
(
GCS
) =
RCBA32
(
GCS
) | (1 << 5);
45
/* halt timer */
46
outw
((1 << 11),
DEFAULT_PMBASE
| 0x60 | 0x08);
47
/* halt timer */
48
outw
(
inw
(
DEFAULT_PMBASE
| 0x60 | 0x06) | 2,
DEFAULT_PMBASE
| 0x60 | 0x06);
49
printk
(
BIOS_DEBUG
,
" done.\n"
);
50
51
pci_write_config32
(
PCI_DEV
(0, 0x16, 0),
PCI_BASE_ADDRESS_0
,
52
(
uintptr_t
)
DEFAULT_HECIBAR
);
53
pci_write_config32
(
PCI_DEV
(0, 0x16, 0),
PCI_COMMAND
,
54
PCI_COMMAND_MASTER
|
PCI_COMMAND_MEMORY
);
55
}
56
57
void
early_pch_init
(
void
)
58
{
59
early_gpio_init
();
60
enable_smbus
();
61
/* TODO, make this configurable */
62
pch_setup_cir
(
IRONLAKE_MOBILE
);
63
southbridge_configure_default_intmap
();
64
pch_default_disable
();
65
early_usb_init
(
mainboard_usb_ports
);
66
}
early_usb_init
void early_usb_init(const struct southbridge_usb_port *portmap)
Definition:
early_usb.c:11
printk
#define printk(level,...)
Definition:
stdlib.h:16
console.h
inw
u16 inw(u16 port)
outw
void outw(u16 val, u16 port)
southbridge_configure_default_intmap
void southbridge_configure_default_intmap(void)
Definition:
early_rcba.c:5
pch_setup_cir
void pch_setup_cir(int chipset_type)
Definition:
early_cir.c:11
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_write_config8
static __always_inline void pci_write_config8(const struct device *dev, u16 reg, u8 val)
Definition:
pci_ops.h:64
ACPI_EN
#define ACPI_EN
Definition:
pmc.h:146
DEFAULT_PMBASE
#define DEFAULT_PMBASE
Definition:
iomap.h:14
ironlake.h
IRONLAKE_MOBILE
#define IRONLAKE_MOBILE
Definition:
ironlake.h:16
BIOS_DEBUG
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition:
loglevel.h:128
mainboard_gpio_map
const struct pch_gpio_map mainboard_gpio_map
Definition:
gpio.c:87
mainboard_usb_ports
const struct southbridge_usb_port mainboard_usb_ports[]
Definition:
early_init.c:8
DEFAULT_HECIBAR
#define DEFAULT_HECIBAR
Definition:
memmap.h:6
pci_def.h
PCI_COMMAND_MASTER
#define PCI_COMMAND_MASTER
Definition:
pci_def.h:13
PCI_COMMAND_MEMORY
#define PCI_COMMAND_MEMORY
Definition:
pci_def.h:12
PCI_BASE_ADDRESS_0
#define PCI_BASE_ADDRESS_0
Definition:
pci_def.h:63
PCI_COMMAND
#define PCI_COMMAND
Definition:
pci_def.h:10
PCI_DEV
#define PCI_DEV(SEGBUS, DEV, FN)
Definition:
pci_type.h:14
smbus_host.h
enable_smbus
static void enable_smbus(void)
Definition:
smbus_host.h:34
RCBA
#define RCBA
Definition:
lpc.h:17
GCS
#define GCS
Definition:
lpc.h:36
PMBASE
#define PMBASE
Definition:
lpc.h:8
GPIO_CNTL
#define GPIO_CNTL
Definition:
lpc.h:22
ACPI_CNTL
#define ACPI_CNTL
Definition:
lpc.h:9
GPIO_BASE
#define GPIO_BASE
Definition:
lpc.h:21
FD2
#define FD2
Definition:
rcba.h:128
FD
#define FD
Definition:
rcba.h:125
PCH_LPC_DEV
#define PCH_LPC_DEV
Definition:
lpc.h:7
early_pch_init
void early_pch_init(void)
Definition:
early_pch.c:299
DEFAULT_GPIOBASE
#define DEFAULT_GPIOBASE
Definition:
pch.h:22
setup_pch_gpios
void setup_pch_gpios(const struct pch_gpio_map *gpio)
Definition:
gpio.c:33
gpio.h
RCBA32
#define RCBA32(x)
Definition:
rcba.h:14
pch_default_disable
static void pch_default_disable(void)
Definition:
early_pch.c:20
ibexpeak_setup_bars
void ibexpeak_setup_bars(void)
Definition:
early_pch.c:31
early_gpio_init
static void early_gpio_init(void)
Definition:
early_pch.c:12
pch.h
uintptr_t
unsigned long uintptr_t
Definition:
stdint.h:21
src
southbridge
intel
ibexpeak
early_pch.c
Generated by
1.9.1