diff options
author | Jan Beulich <jbeulich@suse.com> | 2012-09-11 15:56:45 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2012-09-11 15:56:45 +0200 |
commit | 25c8d4804304a6cbbbc4ecbccfcb46c6174f56dc (patch) | |
tree | 65a0cb545e80aef5584d3852087a81f8225d2f56 | |
parent | 631126d92d7baa9d6a219aad27db2afeed05e392 (diff) | |
download | xen-25c8d4804304a6cbbbc4ecbccfcb46c6174f56dc.tar.gz xen-25c8d4804304a6cbbbc4ecbccfcb46c6174f56dc.tar.bz2 xen-25c8d4804304a6cbbbc4ecbccfcb46c6174f56dc.zip |
ns16550: command line parsing adjustments
Allow intermediate parts of the command line options to be absent
(expressed by two immediately succeeding commas).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
-rw-r--r-- | docs/misc/xen-command-line.markdown | 2 | ||||
-rw-r--r-- | xen/drivers/char/ns16550.c | 50 |
2 files changed, 23 insertions, 29 deletions
diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown index e70b722500..e771fed3b2 100644 --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -199,7 +199,7 @@ If set, override Xen's calculation of the level 2 cache line size. If set, override Xen's default choice for the platform timer. ### com1,com2 -> `= <baud>[/<clock_hz>][,DPS[,<io-base>[,<irq>[,<port-bdf>[,<bridge-bdf>]]]] | pci | amt ] ` +> `= <baud>[/<clock_hz>][,[DPS][,[<io-base>|pci|amt][,[<irq>][,[<port-bdf>][,[<bridge-bdf>]]]]]]` Both option `com1` and `com2` follow the same format. diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index 4ea7128c60..16cd01d9ea 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -555,26 +555,23 @@ static void __init ns16550_parse_port_config( else if ( (baud = simple_strtoul(conf, &conf, 10)) != 0 ) uart->baud = baud; - if ( *conf == '/') + if ( *conf == '/' ) { conf++; uart->clock_hz = simple_strtoul(conf, &conf, 0) << 4; } - if ( *conf != ',' ) - goto config_parsed; - conf++; - - uart->data_bits = simple_strtoul(conf, &conf, 10); + if ( *conf == ',' && *++conf != ',' ) + { + uart->data_bits = simple_strtoul(conf, &conf, 10); - uart->parity = parse_parity_char(*conf); - conf++; + uart->parity = parse_parity_char(*conf); - uart->stop_bits = simple_strtoul(conf, &conf, 10); + uart->stop_bits = simple_strtoul(conf + 1, &conf, 10); + } - if ( *conf == ',' ) + if ( *conf == ',' && *++conf != ',' ) { - conf++; if ( strncmp(conf, "pci", 3) == 0 ) { if ( pci_uart_config(uart, 1/* skip AMT */, uart - ns16550_com) ) @@ -591,24 +588,21 @@ static void __init ns16550_parse_port_config( { uart->io_base = simple_strtoul(conf, &conf, 0); } + } - if ( *conf == ',' ) - { - conf++; - uart->irq = simple_strtoul(conf, &conf, 10); - if ( *conf == ',' ) - { - conf++; - uart->ps_bdf_enable = 1; - parse_pci_bdf(&conf, &uart->ps_bdf[0]); - if ( *conf == ',' ) - { - conf++; - uart->pb_bdf_enable = 1; - parse_pci_bdf(&conf, &uart->pb_bdf[0]); - } - } - } + if ( *conf == ',' && *++conf != ',' ) + uart->irq = simple_strtol(conf, &conf, 10); + + if ( *conf == ',' && *++conf != ',' ) + { + uart->ps_bdf_enable = 1; + parse_pci_bdf(&conf, &uart->ps_bdf[0]); + } + + if ( *conf == ',' && *++conf != ',' ) + { + uart->pb_bdf_enable = 1; + parse_pci_bdf(&conf, &uart->pb_bdf[0]); } config_parsed: |