From 2dd634c55b1ebc356fe9e9bff9c8c41444c70aba Mon Sep 17 00:00:00 2001 From: Warren Togami Date: Thu, 18 Oct 2007 16:11:16 +0000 Subject: [PATCH] one more patch from mschmidt to allow configuration of parity and bits --- memtest86+.spec | 7 +++- parity-bits.diff | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 parity-bits.diff diff --git a/memtest86+.spec b/memtest86+.spec index ca66c80..b03e56d 100644 --- a/memtest86+.spec +++ b/memtest86+.spec @@ -6,7 +6,7 @@ Summary: Stand-alone memory tester for x86 and x86-64 computers Name: memtest86+ Version: 1.70 -Release: 2%{?dist} +Release: 3%{?dist} License: GPL ExclusiveArch: %{ix86} x86_64 Group: System Environment/Base @@ -18,6 +18,7 @@ Source2: memtest-setup Patch0: additional-lib-functions.diff Patch1: console-boot-parameter.diff Patch2: use-strtoul-in-getval.diff +Patch3: parity-bits.diff Requires(preun): coreutils # require glibc-devel.i386 via this file: BuildRequires: %{_includedir}/gnu/stubs-32.h @@ -37,6 +38,7 @@ Run 'memtest-setup' to add to your GRUB or lilo boot menu. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 %build # Regular build flags not wanted for this binary @@ -68,6 +70,9 @@ rm -rf $RPM_BUILD_ROOT /sbin/new-memtest-pkg --remove %{version} %changelog +* Thu Oct 18 2007 Warren Togami - 1.70-3 +- one more patch from mschmidt to allow configuration of parity and bits + * Wed Oct 17 2007 Warren Togami - 1.70-2 - mschmidt's boot time configuration of serial console (#319631) diff --git a/parity-bits.diff b/parity-bits.diff new file mode 100644 index 0000000..1bfe4d8 --- /dev/null +++ b/parity-bits.diff @@ -0,0 +1,97 @@ +Index: memtest86+-1.70/lib.c +=================================================================== +--- memtest86+-1.70.orig/lib.c ++++ memtest86+-1.70/lib.c +@@ -23,6 +23,9 @@ const short serial_base_ports[] = {0x3f8 + #endif + int serial_baud_rate = SERIAL_BAUD_RATE; + ++unsigned char serial_parity = 0; ++unsigned char serial_bits = 8; ++ + char buf[18]; + + struct ascii_map_str { +@@ -722,6 +725,7 @@ void ttyprint(int y, int x, const char * + void serial_echo_init(void) + { + int comstat, hi, lo, serial_div; ++ unsigned char lcr; + + /* read the Divisor Latch */ + comstat = serial_echo_inb(UART_LCR); +@@ -731,12 +735,13 @@ void serial_echo_init(void) + serial_echo_outb(comstat, UART_LCR); + + /* now do hardwired init */ +- serial_echo_outb(0x03, UART_LCR); /* No parity, 8 data bits, 1 stop */ ++ lcr = serial_parity | (serial_bits - 5); ++ serial_echo_outb(lcr, UART_LCR); /* No parity, 8 data bits, 1 stop */ + serial_div = 115200 / serial_baud_rate; +- serial_echo_outb(0x83, UART_LCR); /* Access divisor latch */ ++ serial_echo_outb(0x80|lcr, UART_LCR); /* Access divisor latch */ + serial_echo_outb(serial_div & 0xff, UART_DLL); /* baud rate divisor */ + serial_echo_outb((serial_div >> 8) & 0xff, UART_DLM); +- serial_echo_outb(0x03, UART_LCR); /* Done with divisor */ ++ serial_echo_outb(lcr, UART_LCR); /* Done with divisor */ + + /* Prior to disabling interrupts, read the LSR and RBR + * registers */ +@@ -969,12 +974,14 @@ void wait_keyup( void ) { + * ttyS0 + * ttyS1 + * ttyS0,115200 ++ * ttyS0,9600e8 + */ + void serial_console_setup(char *param) + { + char *option, *end; + unsigned long tty; + unsigned long baud_rate; ++ unsigned char parity, bits; + + if (strncmp(param, "ttyS", 4)) + return; /* not a serial port */ +@@ -1005,9 +1012,42 @@ void serial_console_setup(char *param) + if (baud_rate == 0 || (115200 % baud_rate) != 0) + return; /* wrong baud rate */ + ++ if (*end == '\0') ++ goto save_baud_rate; /* no more options given */ ++ ++ switch (toupper(*end)) { ++ case 'N': ++ parity = 0; ++ break; ++ case 'O': ++ parity = UART_LCR_PARITY; ++ break; ++ case 'E': ++ parity = UART_LCR_PARITY | UART_LCR_EPAR; ++ break; ++ default: ++ /* Unknown parity */ ++ return; ++ } ++ ++ end++; ++ if (*end == '\0') ++ goto save_parity; ++ ++ /* word length (bits) */ ++ if (*end < '7' || *end > '8') ++ return; /* invalid number of bits */ ++ ++ bits = *end - '0'; ++ ++ end++; + if (*end != '\0') + return; /* garbage at the end */ + ++ serial_bits = bits; ++save_parity: ++ serial_parity = parity; ++save_baud_rate: + serial_baud_rate = (int) baud_rate; + save_tty: + serial_tty = (short) tty;