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-or-later */
2 
3 #include <arch/io.h>
4 #include <device/pnp.h>
5 #include <stdint.h>
6 #include "nct5104d.h"
7 
8 #define NUVOTON_ENTRY_KEY 0x87
9 #define NUVOTON_EXIT_KEY 0xAA
10 
11 /* Enable configuration: pass entry key '0x87' into index port dev
12  * two times. */
14 {
15  u16 port = dev >> 8;
18 }
19 
20 /* Disable configuration: pass exit key '0xAA' into index port dev. */
22 {
23  u16 port = dev >> 8;
25 }
26 
27 /* Route UARTD to pins 41-48 */
29 {
30  u8 tmp;
31  u16 port = dev >> 8;
33  outb(0x1c, port);
34  tmp = inb(port + 1);
35  tmp |= 0x04;
36  outb(tmp, port + 1);
38 }
u8 inb(u16 port)
void outb(u8 val, u16 port)
port
Definition: i915.h:29
u32 pnp_devfn_t
Definition: pnp_type.h:8
uint16_t u16
Definition: stdint.h:48
uint8_t u8
Definition: stdint.h:45
static void pnp_enter_conf_state(pnp_devfn_t dev)
Definition: early_init.c:13
void nct5104d_enable_uartd(pnp_devfn_t dev)
Definition: early_init.c:28
#define NUVOTON_EXIT_KEY
Definition: early_init.c:9
static void pnp_exit_conf_state(pnp_devfn_t dev)
Definition: early_init.c:21
#define NUVOTON_ENTRY_KEY
Definition: early_init.c:8