iPXE
Macros | Functions
x86_uart.c File Reference

16550-compatible UART More...

#include <string.h>
#include <ipxe/serial.h>
#include <ipxe/ns16550.h>

Go to the source code of this file.

Macros

#define ISA_UART(NAME, BASE)
 Define a fixed ISA UART. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
 ISA_UART (com1, COM1_BASE)
 
 ISA_UART (com2, COM2_BASE)
 
 ISA_UART (com3, COM3_BASE)
 
 ISA_UART (com4, COM4_BASE)
 
int uart_register_fixed (void)
 Register fixed ISA UARTs. More...
 

Detailed Description

16550-compatible UART

Definition in file x86_uart.c.

Macro Definition Documentation

◆ ISA_UART

#define ISA_UART (   NAME,
  BASE 
)
Value:
static struct ns16550_uart ns16550_ ## NAME = { \
.base = ( ( void * ) (BASE) ), \
}; \
struct uart NAME = { \
.refcnt = REF_INIT ( ref_no_free ), \
.name = #NAME, \
.priv = &ns16550_ ## NAME, \
}
A generic UART.
Definition: uart.h:17
void * base
Register base address.
Definition: ns16550.h:82
#define NS16550_CLK_DEFAULT
Default input clock rate (1.8432 MHz)
Definition: ns16550.h:95
unsigned int clock
Input clock frequency.
Definition: ns16550.h:86
A 16550-compatible UART.
Definition: ns16550.h:80
struct uart_operations ns16550_operations
16550 UART operations
Definition: ns16550.c:171
#define REF_INIT(free_fn)
Initialise a static reference counter.
Definition: refcnt.h:77
#define BASE
Definition: 3c595.h:69
void ref_no_free(struct refcnt *refcnt __unused)
Do not free reference-counted object.
Definition: refcnt.c:101

Define a fixed ISA UART.

Definition at line 37 of file x86_uart.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ ISA_UART() [1/4]

ISA_UART ( com1  ,
COM1_BASE   
)

◆ ISA_UART() [2/4]

ISA_UART ( com2  ,
COM2_BASE   
)

◆ ISA_UART() [3/4]

ISA_UART ( com3  ,
COM3_BASE   
)

◆ ISA_UART() [4/4]

ISA_UART ( com4  ,
COM4_BASE   
)

◆ uart_register_fixed()

int uart_register_fixed ( void  )

Register fixed ISA UARTs.

Register fixed UARTs (when not provided by platform)

Return values
rcReturn status code

Definition at line 60 of file x86_uart.c.

60  {
61  static struct uart *ports[] = { COM1, COM2, COM3, COM4 };
62  unsigned int i;
63  int rc;
64 
65  /* Register all fixed ISA UARTs */
66  for ( i = 0 ; i < ( sizeof ( ports ) / sizeof ( ports[0] ) ) ; i++ ) {
67  if ( ( rc = uart_register ( ports[i] ) ) != 0 ) {
68  DBGC ( ports[i], "UART could not register %s: %s\n",
69  ports[i]->name, strerror ( rc ) );
70  return rc;
71  }
72  }
73 
74  return 0;
75 }
#define COM2
Definition: ns16550.h:56
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Definition: ath9k_hw.c:1984
A generic UART.
Definition: uart.h:17
#define COM4
Definition: ns16550.h:58
#define DBGC(...)
Definition: compiler.h:505
int uart_register(struct uart *uart)
Register UART.
Definition: uart.c:102
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define COM1
Definition: ns16550.h:55
#define COM3
Definition: ns16550.h:57

References COM1, COM2, COM3, COM4, DBGC, name, rc, strerror(), and uart_register().