mirror of
https://github.com/ipxe/ipxe
synced 2026-05-23 20:00:12 +03:00
[spcr] Add support for the ACPI Serial Port Console Redirection table
The BIOS may provide an ACPI Serial Port Console Redirection (SPCR) table to describe the serial port to be used for early boot messages. Add support for parsing the SPCR and instantiating a 16550-based UART. We do not currently attempt to support other types of UART, since iPXE does not yet have drivers for other types. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -88,6 +88,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#define ERRFILE_efi_table ( ERRFILE_CORE | 0x00300000 )
|
||||
#define ERRFILE_efi_connect ( ERRFILE_CORE | 0x00310000 )
|
||||
#define ERRFILE_gpio ( ERRFILE_CORE | 0x00320000 )
|
||||
#define ERRFILE_spcr ( ERRFILE_CORE | 0x00330000 )
|
||||
|
||||
#define ERRFILE_eisa ( ERRFILE_DRIVER | 0x00000000 )
|
||||
#define ERRFILE_isa ( ERRFILE_DRIVER | 0x00010000 )
|
||||
|
||||
@@ -11,6 +11,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <ipxe/uart.h>
|
||||
|
||||
/** Length of register region */
|
||||
#define NS16550_LEN 8
|
||||
|
||||
/** Transmitter holding register */
|
||||
#define NS16550_THR 0x00
|
||||
|
||||
|
||||
@@ -67,4 +67,6 @@ struct uart * default_serial_console ( void );
|
||||
|
||||
extern struct uart *serial_console;
|
||||
|
||||
extern struct uart * fixed_serial_console ( void );
|
||||
|
||||
#endif /* _IPXE_SERIAL_H */
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
#ifndef _IPXE_SPCR_H
|
||||
#define _IPXE_SPCR_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ACPI Serial Port Console Redirection (SPCR)
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ipxe/acpi.h>
|
||||
|
||||
/** Serial Port Console Redirection table signature */
|
||||
#define SPCR_SIGNATURE ACPI_SIGNATURE ( 'S', 'P', 'C', 'R' )
|
||||
|
||||
/** A Serial Port Console Redirection table */
|
||||
struct spcr_table {
|
||||
/** ACPI header */
|
||||
struct acpi_header acpi;
|
||||
/** Interface type */
|
||||
uint8_t type;
|
||||
/** Reserved */
|
||||
uint8_t reserved_a[3];
|
||||
/** Base address */
|
||||
struct acpi_address base;
|
||||
/** Reserved */
|
||||
uint8_t reserved_b[6];
|
||||
/** Baud rate
|
||||
*
|
||||
* 0: leave unchanged
|
||||
* 1: 2400 = 115200 / 48 (not defined in standard)
|
||||
* 2: 4800 = 115200 / 24 (not defined in standard)
|
||||
* 3: 9600 = 115200 / 12
|
||||
* 4: 19200 = 115200 / 6
|
||||
* 5: 38400 = 115200 / 3 (not defined in standard)
|
||||
* 6: 57600 = 115200 / 2
|
||||
* 7: 115200 = 115200 / 1
|
||||
*/
|
||||
uint8_t baud;
|
||||
/** Parity */
|
||||
uint8_t parity;
|
||||
/** Stop bits */
|
||||
uint8_t stop;
|
||||
/** Flow control */
|
||||
uint8_t flow;
|
||||
/** Terminal type */
|
||||
uint8_t terminal;
|
||||
/** Language */
|
||||
uint8_t lang;
|
||||
/** PCI device ID */
|
||||
uint16_t pci_device_id;
|
||||
/** PCI vendor ID */
|
||||
uint16_t pci_vendor_id;
|
||||
/** PCI bus number */
|
||||
uint8_t pci_bus;
|
||||
/** PCI device number */
|
||||
uint8_t pci_dev;
|
||||
/** PCI function number */
|
||||
uint8_t pci_func;
|
||||
/** Reserved */
|
||||
uint8_t reserved_c[4];
|
||||
/** PCI segment */
|
||||
uint8_t pci_segment;
|
||||
/** Clock frequency */
|
||||
uint32_t clock;
|
||||
/** Precise baud rate */
|
||||
uint32_t precise;
|
||||
/** Reserved */
|
||||
uint8_t reserved_d[4];
|
||||
} __attribute__ (( packed ));
|
||||
|
||||
/* SPCR interface types */
|
||||
#define SPCR_TYPE_16550 0x0000 /**< 16550-compatible */
|
||||
#define SPCR_TYPE_16450 0x0001 /**< 16450-compatible */
|
||||
|
||||
/** SPCR baud rates */
|
||||
enum spcr_baud {
|
||||
SPCR_BAUD_2400 = 1,
|
||||
SPCR_BAUD_4800 = 2,
|
||||
SPCR_BAUD_9600 = 3,
|
||||
SPCR_BAUD_19200 = 4,
|
||||
SPCR_BAUD_38400 = 5,
|
||||
SPCR_BAUD_57600 = 6,
|
||||
SPCR_BAUD_115200 = 7,
|
||||
SPCR_BAUD_MAX
|
||||
};
|
||||
|
||||
#endif /* _IPXE_SPCR_H */
|
||||
Reference in New Issue
Block a user