| 1 |
|
| 2 |
|
| 3 |
#include <bootblock_common.h> |
| 4 |
#include <stdint.h> |
| 5 |
#include <arch/io.h> |
| 6 |
#include <superio/smsc/sio1007/sio1007.h> |
| 7 |
|
| 8 |
#define SIO_PORT 0x164e |
| 9 |
|
| 10 |
void bootblock_mainboard_early_init(void) |
| 11 |
{ |
| 12 |
const u16 port = SIO_PORT; |
| 13 |
const u16 runtime_port = 0x180; |
| 14 |
|
| 15 |
|
| 16 |
if (CONFIG(DRIVERS_UART_8250IO)) |
| 17 |
sio1007_enable_uart_at(port); |
| 18 |
|
| 19 |
|
| 20 |
outb(0x55, port); |
| 21 |
|
| 22 |
|
| 23 |
sio1007_setreg(port, 0x31, 1 << 0, 1 << 0); |
| 24 |
sio1007_setreg(port, 0x32, 0 << 0, 1 << 0); |
| 25 |
sio1007_setreg(port, 0x33, 0 << 0, 1 << 0); |
| 26 |
|
| 27 |
|
| 28 |
sio1007_setreg(port, 0x30, runtime_port >> 4, 0xff); |
| 29 |
sio1007_setreg(port, 0x21, runtime_port >> 12, 0xff); |
| 30 |
|
| 31 |
|
| 32 |
sio1007_setreg(port, 0x3a, 1 << 1, 1 << 1); |
| 33 |
|
| 34 |
|
| 35 |
u8 byte; |
| 36 |
byte = inb(runtime_port + 0xc); |
| 37 |
byte |= (1 << 0); |
| 38 |
outb(byte, runtime_port + 0xc); |
| 39 |
|
| 40 |
|
| 41 |
sio1007_setreg(port, 0x3a, 0 << 1, 1 << 1); |
| 42 |
|
| 43 |
|
| 44 |
outb(0xaa, port); |
| 45 |
} |