summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2018-07-09 13:41:07 +0300
committerGarrett D'Amore <garrett@damore.org>2018-10-25 08:47:28 -0400
commitcbae61951b3562e1b0233a21ac0b7d871a31e4f8 (patch)
tree82aa754794740d2603653b80f511110989b02259
parent146341134a2d1d0e3b8b8bab1cf2750d28a3cb14 (diff)
downloadillumos-gate-cbae61951b3562e1b0233a21ac0b7d871a31e4f8.tar.gz
9773 loader.efi: parity and stop bits switches are missing default case
Reviewed by: Yuri Pankov <yuripv@yuripv.net> Reviewed by: Garrett D'Amore <garrett@damore.org> Approved by: Garrett D'Amore <garrett@damore.org>
-rw-r--r--usr/src/boot/sys/boot/efi/loader/comconsole.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/usr/src/boot/sys/boot/efi/loader/comconsole.c b/usr/src/boot/sys/boot/efi/loader/comconsole.c
index 57168cca17..7fb19b11f1 100644
--- a/usr/src/boot/sys/boot/efi/loader/comconsole.c
+++ b/usr/src/boot/sys/boot/efi/loader/comconsole.c
@@ -310,28 +310,49 @@ comc_ischar(struct console *cp)
static char *
comc_asprint_mode(struct serial *sp)
{
- char par = 'n', *buf;
- int stop = 1;
+ char par, *buf;
+ char *stop;
if (sp == NULL)
return (NULL);
switch (sp->parity) {
- case NoParity: par = 'n';
+ case NoParity:
+ par = 'n';
break;
- case EvenParity: par = 'e';
+ case EvenParity:
+ par = 'e';
break;
- case OddParity: par = 'o';
+ case OddParity:
+ par = 'o';
+ break;
+ case MarkParity:
+ par = 'm';
+ break;
+ case SpaceParity:
+ par = 's';
+ break;
+ default:
+ par = 'n';
break;
}
+
switch (sp->stopbits) {
- case OneStopBit: stop = 1;
+ case OneStopBit:
+ stop = "1";
+ break;
+ case TwoStopBits:
+ stop = "2";
break;
- case TwoStopBits: stop = 2;
+ case OneFiveStopBits:
+ stop = "1.5";
+ break;
+ default:
+ stop = "1";
break;
}
- asprintf(&buf, "%ju,%d,%c,%d,-", sp->baudrate, sp->databits, par, stop);
+ asprintf(&buf, "%ju,%d,%c,%s,-", sp->baudrate, sp->databits, par, stop);
return (buf);
}
@@ -360,6 +381,10 @@ comc_parse_mode(struct serial *sp, const char *value)
return (CMD_ERROR);
switch (n) {
+ case 5: databits = 5;
+ break;
+ case 6: databits = 6;
+ break;
case 7: databits = 7;
break;
case 8: databits = 8;
@@ -376,6 +401,10 @@ comc_parse_mode(struct serial *sp, const char *value)
break;
case 'o': parity = OddParity;
break;
+ case 'm': parity = MarkParity;
+ break;
+ case 's': parity = SpaceParity;
+ break;
default:
return (CMD_ERROR);
}
@@ -387,6 +416,10 @@ comc_parse_mode(struct serial *sp, const char *value)
switch (*ep++) {
case '1': stopbits = OneStopBit;
+ if (ep[0] == '.' && ep[1] == '5') {
+ ep += 2;
+ stopbits = OneFiveStopBits;
+ }
break;
case '2': stopbits = TwoStopBits;
break;