[uart] Make baud rate a property of the UART

Make the current baud rate (if specified) a property of the UART, to
allow the default_serial_console() function to specify the default
baud rate as well as the default UART device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-11-05 12:16:22 +00:00
parent a786c8d231
commit 08d4d7fe9d
5 changed files with 23 additions and 16 deletions

View File

@@ -22,6 +22,9 @@ struct uart {
/** List of registered UARTs */
struct list_head list;
/** Baud rate (if specified) */
unsigned int baud;
/** UART operations */
struct uart_operations *op;
/** Driver-private data */
@@ -56,10 +59,9 @@ struct uart_operations {
* Initialise UART
*
* @v uart UART
* @v baud Baud rate, or zero to leave unchanged
* @ret rc Return status code
*/
int ( * init ) ( struct uart *uart, unsigned int baud );
int ( * init ) ( struct uart *uart );
/**
* Flush transmitted data
*
@@ -109,13 +111,12 @@ uart_receive ( struct uart *uart ) {
* Initialise UART
*
* @v uart UART
* @v baud Baud rate, or zero to leave unchanged
* @ret rc Return status code
*/
static inline __attribute__ (( always_inline )) int
uart_init ( struct uart *uart, unsigned int baud ) {
uart_init ( struct uart *uart ) {
return uart->op->init ( uart, baud );
return uart->op->init ( uart );
}
/**