From: Joseph C. <jos...@in...> - 2010-07-27 08:51:46
|
changeset a5db79cb4fb8 in /var/www/tboot.hg details: tboot.hg?cmd=changeset;node=a5db79cb4fb8 description: Change serial command line option back to original format The serial command line options (for setting baud rate, IO port, etc.) are now changed back to their orignal format: serial=<baud>[/<clock_hz>][,<DPS>[,<io-base>[,<irq>[,<serial-bdf>[,<bridge-bdf>]]]]] Signed-off-by: Shane Wang <sha...@in...> Reviewed-by: Joseph Cihula <jos...@in...> diffstat: README | 8 +++----- tboot/common/cmdline.c | 43 +++++++------------------------------------ tboot/common/com.c | 4 ++-- tboot/common/printk.c | 2 +- tboot/include/cmdline.h | 2 +- 5 files changed, 14 insertions(+), 45 deletions(-) diffs (128 lines): diff -r ba340f853d32 -r a5db79cb4fb8 README --- a/README Tue Jul 27 01:47:19 2010 -0700 +++ b/README Tue Jul 27 01:54:29 2010 -0700 @@ -117,12 +117,10 @@ If serial logging is set, the serial port settings can be configured with the following parameters: - serial=com[1|2|3|4|<IO port>] where <IO port> is specified as a hex - value (e.g. 0x3f8) - com[1|2|3|4]=<baud>,<data bits><parity><stop bits> + serial=<baud>[/<clock_hz>][,<DPS>[,<io-base>[,<irq>[,<serial-bdf> + [,<bridge-bdf>]]]]] - The default values for these are: serial=com1 and com1=115200,8n1 (where - com1 uses IO port 0x3f8). + The default values for these are: serial=115200,8n1,0x3f8. o Disabling legacy USB SMIs: By default, tboot will disable legacy USB SMIs, which allows it to avoid diff -r ba340f853d32 -r a5db79cb4fb8 tboot/common/cmdline.c --- a/tboot/common/cmdline.c Tue Jul 27 01:47:19 2010 -0700 +++ b/tboot/common/cmdline.c Tue Jul 27 01:54:29 2010 -0700 @@ -70,12 +70,8 @@ static const cmdline_option_t g_tboot_cmdline_options[] = { { "loglvl", "all" }, /* all|none */ { "logging", "serial" }, /* vga,serial,memory|none */ - { "serial", "com1" }, /* com[1|2|3|4] or its IO port (e.g. 0x3f8) */ - /* comX=<baud>[/<clock_hz>][,<DPS>[,<io-base>[,<irq>[,<serial-bdf>[,<bridge-bdf>]]]]] */ - { "com1", "115200,8n1" }, - { "com2", "115200,8n1" }, - { "com3", "115200,8n1" }, - { "com4", "115200,8n1" }, + { "serial", "115200,8n1" }, + /* serial=<baud>[/<clock_hz>][,<DPS>[,<io-base>[,<irq>[,<serial-bdf>[,<bridge-bdf>]]]]] */ { "vga_delay", "0" }, /* # secs */ { "no_usb", "true" }, /* true|false */ { NULL, NULL } @@ -296,7 +292,7 @@ return true; } -static bool parse_com_param(const char *com) +static bool parse_serial_param(const char *com) { /* parse baud */ g_com_port.comc_curspeed = strtoul(com, (char **)&com, 10); @@ -355,39 +351,14 @@ return true; } -bool get_tboot_console(void) +bool get_tboot_serial(void) { - static struct { - const char *com_name; - unsigned long com_addr; - } coms[] = { {"com1", COM1_ADDR}, {"com2", COM2_ADDR}, - {"com3", COM3_ADDR}, {"com4", COM4_ADDR} }; - - const char *console = get_option_val(g_tboot_cmdline_options, + const char *serial = get_option_val(g_tboot_cmdline_options, g_tboot_param_values, "serial"); - if ( console == NULL || *console == '\0' ) + if ( serial == NULL || *serial == '\0' ) return false; - unsigned int i; - for ( i = 0; i < ARRAY_SIZE(coms); i++ ) { - if ( strcmp(console, coms[i].com_name) == 0 || - strtoul(console, NULL, 0) == coms[i].com_addr ) { - g_com_port.comc_port = coms[i].com_addr; - break; - } - } - if ( i == ARRAY_SIZE(coms) ) { - printk("unsupported serial port\n"); - return false; - } - - const char *com_value = get_option_val(g_tboot_cmdline_options, - g_tboot_param_values, - coms[i].com_name); - if ( com_value != NULL && *com_value != '\0' ) - return parse_com_param(com_value); - - return false; + return parse_serial_param(serial); } void get_tboot_vga_delay(void) diff -r ba340f853d32 -r a5db79cb4fb8 tboot/common/com.c --- a/tboot/common/com.c Tue Jul 27 01:47:19 2010 -0700 +++ b/tboot/common/com.c Tue Jul 27 01:54:29 2010 -0700 @@ -38,8 +38,8 @@ #include <pci_cfgreg.h> #include <com.h> -#define COMC_TXWAIT 0x40000 /* transmit timeout */ -#define COMC_BPS(x) (115200 / (x)) /* speed to DLAB divisor */ +#define COMC_TXWAIT 0x40000 /* transmit timeout */ +#define COMC_BPS(x) (115200 / (x)) /* speed to DLAB divisor */ #define COMC_DIV2BPS(x) (115200 / (x)) /* DLAB divisor to speed */ #define OUTB(add, val) outb(g_com_port.comc_port + (add), (val)) diff -r ba340f853d32 -r a5db79cb4fb8 tboot/common/printk.c --- a/tboot/common/printk.c Tue Jul 27 01:47:19 2010 -0700 +++ b/tboot/common/printk.c Tue Jul 27 01:54:29 2010 -0700 @@ -109,7 +109,7 @@ get_tboot_log_targets(); /* parse serial settings */ - if ( !get_tboot_console() ) + if ( !get_tboot_serial() ) g_log_targets &= ~TBOOT_LOG_TARGET_SERIAL; if ( g_log_targets & TBOOT_LOG_TARGET_MEMORY ) diff -r ba340f853d32 -r a5db79cb4fb8 tboot/include/cmdline.h --- a/tboot/include/cmdline.h Tue Jul 27 01:47:19 2010 -0700 +++ b/tboot/include/cmdline.h Tue Jul 27 01:54:29 2010 -0700 @@ -43,7 +43,7 @@ extern void tboot_parse_cmdline(void); extern void get_tboot_loglvl(void); extern void get_tboot_log_targets(void); -extern bool get_tboot_console(void); +extern bool get_tboot_serial(void); extern void get_tboot_baud(void); extern void get_tboot_fmt(void); extern void get_tboot_vga_delay(void); |