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-only */
2
3
#include <
bootblock_common.h
>
4
#include <
stdint.h
>
5
#include <arch/io.h>
6
#include <
northbridge/intel/sandybridge/raminit_native.h
>
7
#include <
superio/smsc/sio1007/sio1007.h
>
8
#include <
southbridge/intel/bd82x6x/pch.h
>
9
10
#define SIO_PORT 0x164e
11
12
const
struct
southbridge_usb_port
mainboard_usb_ports
[] = {
13
{ 1, 1, 0 },
14
{ 1, 1, 0 },
15
{ 1, 1, 1 },
16
{ 1, 1, 1 },
17
{ 1, 0, 2 },
18
{ 1, 0, 2 },
19
{ 1, 0, 3 },
20
{ 1, 0, 3 },
21
{ 1, 1, 4 },
22
{ 1, 1, 4 },
23
{ 1, 0, 5 },
24
{ 1, 0, 5 },
25
{ 1, 0, 6 },
26
{ 1, 0, 6 },
27
};
28
29
void
bootblock_mainboard_early_init
(
void
)
30
{
31
const
u16
port
=
SIO_PORT
;
32
const
u16
runtime_port = 0x180;
33
34
/* Enable COM1 if requested */
35
if
(
CONFIG
(DRIVERS_UART_8250IO))
36
sio1007_enable_uart_at
(
port
);
37
38
/* Turn on configuration mode. */
39
outb
(0x55,
port
);
40
41
/* Set the GPIO direction, polarity, and type. */
42
sio1007_setreg
(
port
, 0x31, 1 << 0, 1 << 0);
43
sio1007_setreg
(
port
, 0x32, 0 << 0, 1 << 0);
44
sio1007_setreg
(
port
, 0x33, 0 << 0, 1 << 0);
45
46
/* Set the base address for the runtime register block. */
47
sio1007_setreg
(
port
, 0x30, runtime_port >> 4, 0xff);
48
sio1007_setreg
(
port
, 0x21, runtime_port >> 12, 0xff);
49
50
/* Turn on address decoding for it. */
51
sio1007_setreg
(
port
, 0x3a, 1 << 1, 1 << 1);
52
53
/* Set the value of GPIO 10 by changing GP1, bit 0. */
54
u8
byte;
55
byte
=
inb
(runtime_port + 0xc);
56
byte
|= (1 << 0);
57
outb
(
byte
, runtime_port + 0xc);
58
59
/* Turn off address decoding for it. */
60
sio1007_setreg
(
port
, 0x3a, 0 << 1, 1 << 1);
61
62
/* Turn off configuration mode. */
63
outb
(0xaa,
port
);
64
}
65
66
void
mainboard_get_spd
(
spd_raw_data
*spd,
bool
id_only)
67
{
68
read_spd
(&spd[0], 0x50, id_only);
69
read_spd
(&spd[2], 0x52, id_only);
70
}
bootblock_common.h
inb
u8 inb(u16 port)
outb
void outb(u8 val, u16 port)
CONFIG
@ CONFIG
Definition:
dsi_common.h:201
port
port
Definition:
i915.h:29
spd_raw_data
u8 spd_raw_data[256]
Definition:
ddr3.h:156
bootblock_mainboard_early_init
void bootblock_mainboard_early_init(void)
Definition:
early_init.c:11
mainboard_get_spd
void mainboard_get_spd(spd_raw_data *spd, bool id_only)
Definition:
early_init.c:25
mainboard_usb_ports
const struct southbridge_usb_port mainboard_usb_ports[]
Definition:
early_init.c:8
SIO_PORT
#define SIO_PORT
Definition:
early_init.c:10
read_spd
void read_spd(spd_raw_data *spd, u8 addr, bool id_only)
Definition:
raminit.c:138
raminit_native.h
sio1007.h
sio1007_enable_uart_at
int sio1007_enable_uart_at(u16 port)
Definition:
early_serial.c:18
sio1007_setreg
void sio1007_setreg(u16 lpc_port, u8 reg, u8 value, u8 mask)
Definition:
early_serial.c:7
pch.h
stdint.h
u16
uint16_t u16
Definition:
stdint.h:48
u8
uint8_t u8
Definition:
stdint.h:45
southbridge_usb_port
Definition:
pch.h:56
src
mainboard
compulab
intense_pc
early_init.c
Generated by
1.9.1