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. */
13
static
void
pnp_enter_conf_state
(
pnp_devfn_t
dev)
14
{
15
u16
port
= dev >> 8;
16
outb
(
NUVOTON_ENTRY_KEY
,
port
);
17
outb
(
NUVOTON_ENTRY_KEY
,
port
);
18
}
19
20
/* Disable configuration: pass exit key '0xAA' into index port dev. */
21
static
void
pnp_exit_conf_state
(
pnp_devfn_t
dev)
22
{
23
u16
port
= dev >> 8;
24
outb
(
NUVOTON_EXIT_KEY
,
port
);
25
}
26
27
/* Route UARTD to pins 41-48 */
28
void
nct5104d_enable_uartd
(
pnp_devfn_t
dev)
29
{
30
u8
tmp;
31
u16
port
= dev >> 8;
32
pnp_enter_conf_state
(dev);
33
outb
(0x1c,
port
);
34
tmp =
inb
(
port
+ 1);
35
tmp |= 0x04;
36
outb
(tmp,
port
+ 1);
37
pnp_exit_conf_state
(dev);
38
}
inb
u8 inb(u16 port)
outb
void outb(u8 val, u16 port)
port
port
Definition:
i915.h:29
nct5104d.h
pnp.h
pnp_devfn_t
u32 pnp_devfn_t
Definition:
pnp_type.h:8
stdint.h
u16
uint16_t u16
Definition:
stdint.h:48
u8
uint8_t u8
Definition:
stdint.h:45
pnp_enter_conf_state
static void pnp_enter_conf_state(pnp_devfn_t dev)
Definition:
early_init.c:13
nct5104d_enable_uartd
void nct5104d_enable_uartd(pnp_devfn_t dev)
Definition:
early_init.c:28
NUVOTON_EXIT_KEY
#define NUVOTON_EXIT_KEY
Definition:
early_init.c:9
pnp_exit_conf_state
static void pnp_exit_conf_state(pnp_devfn_t dev)
Definition:
early_init.c:21
NUVOTON_ENTRY_KEY
#define NUVOTON_ENTRY_KEY
Definition:
early_init.c:8
src
superio
nuvoton
nct5104d
early_init.c
Generated by
1.9.1