mirror of
https://github.com/ipxe/ipxe
synced 2026-04-04 03:00:20 +03:00
[uart] Allow for dynamically registered 16550 UARTs
Use the generic UART driver-private data pointer, rather than embedding the generic UART within the 16550 UART structure. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -35,13 +35,14 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/** Define a fixed ISA UART */
|
||||
#define ISA_UART( NAME, BASE ) \
|
||||
struct ns16550_uart NAME = { \
|
||||
.uart = { \
|
||||
.refcnt = REF_INIT ( ref_no_free ), \
|
||||
.name = #NAME, \
|
||||
.op = &ns16550_operations, \
|
||||
}, \
|
||||
static struct ns16550_uart ns16550_ ## NAME = { \
|
||||
.base = ( ( void * ) (BASE) ), \
|
||||
}; \
|
||||
struct uart NAME = { \
|
||||
.refcnt = REF_INIT ( ref_no_free ), \
|
||||
.name = #NAME, \
|
||||
.op = &ns16550_operations, \
|
||||
.priv = &ns16550_ ## NAME, \
|
||||
}
|
||||
|
||||
/* Fixed ISA UARTs */
|
||||
|
||||
@@ -46,15 +46,15 @@ ns16550_read ( struct ns16550_uart *ns16550, unsigned int address ) {
|
||||
#define COM4_BASE 0x2e8
|
||||
|
||||
/* Fixed ISA serial ports */
|
||||
extern struct ns16550_uart com1;
|
||||
extern struct ns16550_uart com2;
|
||||
extern struct ns16550_uart com3;
|
||||
extern struct ns16550_uart com4;
|
||||
extern struct uart com1;
|
||||
extern struct uart com2;
|
||||
extern struct uart com3;
|
||||
extern struct uart com4;
|
||||
|
||||
/* Fixed ISA serial port names */
|
||||
#define COM1 &com1.uart
|
||||
#define COM2 &com2.uart
|
||||
#define COM3 &com3.uart
|
||||
#define COM4 &com4.uart
|
||||
#define COM1 &com1
|
||||
#define COM2 &com2
|
||||
#define COM3 &com3
|
||||
#define COM4 &com4
|
||||
|
||||
#endif /* _BITS_NS16550_H */
|
||||
|
||||
@@ -447,9 +447,7 @@ static __asmcall __used void int22 ( struct i386_all_regs *ix86 ) {
|
||||
|
||||
case 0x000B: /* Get Serial Console Configuration */
|
||||
if ( serial_console ) {
|
||||
struct ns16550_uart *comport =
|
||||
container_of ( serial_console,
|
||||
struct ns16550_uart, uart );
|
||||
struct ns16550_uart *comport = serial_console->priv;
|
||||
|
||||
ix86->regs.dx = ( ( intptr_t ) comport->base );
|
||||
ix86->regs.cx = comport->divisor;
|
||||
|
||||
Reference in New Issue
Block a user