coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
uart8250io.c File Reference
#include <arch/io.h>
#include <boot/coreboot_tables.h>
#include <console/uart.h>
#include "uart8250reg.h"
Include dependency graph for uart8250io.c:

Go to the source code of this file.

Macros

#define SINGLE_CHAR_TIMEOUT   (50 * 1000)
 
#define FIFO_TIMEOUT   (16 * SINGLE_CHAR_TIMEOUT)
 

Functions

static int uart8250_can_tx_byte (unsigned int base_port)
 
static void uart8250_tx_byte (unsigned int base_port, unsigned char data)
 
static void uart8250_tx_flush (unsigned int base_port)
 
static int uart8250_can_rx_byte (unsigned int base_port)
 
static unsigned char uart8250_rx_byte (unsigned int base_port)
 
static void uart8250_init (unsigned int base_port, unsigned int divisor)
 
uintptr_t uart_platform_base (unsigned int idx)
 
void uart_init (unsigned int idx)
 
void uart_tx_byte (unsigned int idx, unsigned char data)
 
unsigned char uart_rx_byte (unsigned int idx)
 
void uart_tx_flush (unsigned int idx)
 
void uart_fill_lb (void *data)
 

Variables

static const unsigned int bases [] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }
 

Macro Definition Documentation

◆ FIFO_TIMEOUT

#define FIFO_TIMEOUT   (16 * SINGLE_CHAR_TIMEOUT)

Definition at line 17 of file uart8250io.c.

◆ SINGLE_CHAR_TIMEOUT

#define SINGLE_CHAR_TIMEOUT   (50 * 1000)

Definition at line 16 of file uart8250io.c.

Function Documentation

◆ uart8250_can_rx_byte()

static int uart8250_can_rx_byte ( unsigned int  base_port)
static

Definition at line 37 of file uart8250io.c.

References inb(), UART8250_LSR, and UART8250_LSR_DR.

Referenced by uart8250_rx_byte().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uart8250_can_tx_byte()

static int uart8250_can_tx_byte ( unsigned int  base_port)
static

Definition at line 19 of file uart8250io.c.

References inb(), UART8250_LSR, and UART8250_LSR_THRE.

Referenced by uart8250_tx_byte().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uart8250_init()

static void uart8250_init ( unsigned int  base_port,
unsigned int  divisor 
)
static

Definition at line 54 of file uart8250io.c.

References outb(), UART8250_DLL, UART8250_DLM, UART8250_FCR, UART8250_FCR_FIFO_EN, UART8250_IER, UART8250_LCR, UART8250_LCR_DLAB, UART8250_MCR, UART8250_MCR_DTR, and UART8250_MCR_RTS.

Referenced by uart_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uart8250_rx_byte()

static unsigned char uart8250_rx_byte ( unsigned int  base_port)
static

Definition at line 42 of file uart8250io.c.

References inb(), SINGLE_CHAR_TIMEOUT, uart8250_can_rx_byte(), and UART8250_RBR.

Referenced by uart_rx_byte().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uart8250_tx_byte()

static void uart8250_tx_byte ( unsigned int  base_port,
unsigned char  data 
)
static

Definition at line 24 of file uart8250io.c.

References outb(), SINGLE_CHAR_TIMEOUT, uart8250_can_tx_byte(), and UART8250_TBR.

Referenced by uart_tx_byte().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uart8250_tx_flush()

static void uart8250_tx_flush ( unsigned int  base_port)
static

Definition at line 31 of file uart8250io.c.

References FIFO_TIMEOUT, inb(), UART8250_LSR, and UART8250_LSR_TEMT.

Referenced by uart_tx_flush().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uart_fill_lb()

void uart_fill_lb ( void data)

◆ uart_init()

void uart_init ( unsigned int  idx)

Definition at line 84 of file uart8250io.c.

References CONFIG, get_uart_baudrate(), uart8250_init(), uart_baudrate_divisor(), uart_input_clock_divider(), uart_platform_base(), and uart_platform_refclk().

Here is the call graph for this function:

◆ uart_platform_base()

uintptr_t uart_platform_base ( unsigned int  idx)

Definition at line 77 of file uart8250io.c.

References ARRAY_SIZE, and bases.

Referenced by uart_fill_lb(), uart_init(), uart_rx_byte(), uart_tx_byte(), and uart_tx_flush().

Here is the caller graph for this function:

◆ uart_rx_byte()

unsigned char uart_rx_byte ( unsigned int  idx)

Definition at line 99 of file uart8250io.c.

References uart8250_rx_byte(), and uart_platform_base().

Here is the call graph for this function:

◆ uart_tx_byte()

void uart_tx_byte ( unsigned int  idx,
unsigned char  data 
)

Definition at line 94 of file uart8250io.c.

References uart8250_tx_byte(), and uart_platform_base().

Here is the call graph for this function:

◆ uart_tx_flush()

void uart_tx_flush ( unsigned int  idx)

Definition at line 104 of file uart8250io.c.

References uart8250_tx_flush(), and uart_platform_base().

Here is the call graph for this function:

Variable Documentation

◆ bases

const unsigned int bases[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }
static

Definition at line 75 of file uart8250io.c.

Referenced by mainboard_config_upd(), and uart_platform_base().