- forgot to cvs add the compilation patch.
This commit is contained in:
parent
001a8fc90c
commit
dfafa9c446
@ -1,101 +0,0 @@
|
|||||||
This adds several standard C functions to lib.c:
|
|
||||||
strncmp, toupper, isdigit, isxdigit
|
|
||||||
|
|
||||||
simple_strtoul is a limited implementation of strtoul, taken from Linux.
|
|
||||||
|
|
||||||
They will be needed for command line parsing.
|
|
||||||
|
|
||||||
Index: memtest86+-1.70/lib.c
|
|
||||||
===================================================================
|
|
||||||
--- memtest86+-1.70.orig/lib.c
|
|
||||||
+++ memtest86+-1.70/lib.c
|
|
||||||
@@ -69,6 +69,21 @@ int memcmp(const void *s1, const void *s
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+int strncmp(const char *s1, const char *s2, ulong n)
|
|
||||||
+{
|
|
||||||
+ signed char res = 0;
|
|
||||||
+ while (n) {
|
|
||||||
+ res = *s1 - *s2;
|
|
||||||
+ if (res != 0)
|
|
||||||
+ return res;
|
|
||||||
+ if (*s1 == '\0')
|
|
||||||
+ return 0;
|
|
||||||
+ ++s1, ++s2;
|
|
||||||
+ --n;
|
|
||||||
+ }
|
|
||||||
+ return res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void *memmove(void *dest, const void *src, ulong n)
|
|
||||||
{
|
|
||||||
long i;
|
|
||||||
@@ -87,6 +102,53 @@ void *memmove(void *dest, const void *sr
|
|
||||||
}
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+char toupper(char c)
|
|
||||||
+{
|
|
||||||
+ if (c >= 'a' && c <= 'z')
|
|
||||||
+ return c + 'A' -'a';
|
|
||||||
+ else
|
|
||||||
+ return c;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int isdigit(char c)
|
|
||||||
+{
|
|
||||||
+ return c >= '0' && c <= '9';
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int isxdigit(char c)
|
|
||||||
+{
|
|
||||||
+ return isdigit(c) || (toupper(c) >= 'A' && toupper(c) <= 'F');
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base)
|
|
||||||
+{
|
|
||||||
+ unsigned long result = 0, value;
|
|
||||||
+
|
|
||||||
+ if (!base) {
|
|
||||||
+ base = 10;
|
|
||||||
+ if (*cp == '0') {
|
|
||||||
+ base = 8;
|
|
||||||
+ cp++;
|
|
||||||
+ if (toupper(*cp) == 'X' && isxdigit(cp[1])) {
|
|
||||||
+ cp++;
|
|
||||||
+ base = 16;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ } else if (base == 16) {
|
|
||||||
+ if (cp[0] == '0' && toupper(cp[1]) == 'X')
|
|
||||||
+ cp += 2;
|
|
||||||
+ }
|
|
||||||
+ while (isxdigit(*cp) &&
|
|
||||||
+ (value = isdigit(*cp) ? *cp-'0' : toupper(*cp)-'A'+10) < base) {
|
|
||||||
+ result = result*base + value;
|
|
||||||
+ cp++;
|
|
||||||
+ }
|
|
||||||
+ if (endp)
|
|
||||||
+ *endp = (char *)cp;
|
|
||||||
+ return result;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* Scroll the error message area of the screen as needed
|
|
||||||
* Starts at line LINE_SCROLL and ends at line 23
|
|
||||||
Index: memtest86+-1.70/test.h
|
|
||||||
===================================================================
|
|
||||||
--- memtest86+-1.70.orig/test.h
|
|
||||||
+++ memtest86+-1.70/test.h
|
|
||||||
@@ -95,6 +95,7 @@ typedef unsigned long ulong;
|
|
||||||
#define getCx86(reg) ({ outb((reg), 0x22); inb(0x23); })
|
|
||||||
int memcmp(const void *s1, const void *s2, ulong count);
|
|
||||||
void *memmove(void *dest, const void *src, ulong n);
|
|
||||||
+int strncmp(const char *s1, const char *s2, ulong n);
|
|
||||||
int query_linuxbios(void);
|
|
||||||
int query_pcbios(void);
|
|
||||||
int insertaddress(ulong);
|
|
||||||
|
|
||||||
--
|
|
@ -1,239 +0,0 @@
|
|||||||
Make the serial console port and its baudrate configurable on the bootloader
|
|
||||||
(e.g GRUB) command line.
|
|
||||||
|
|
||||||
The parameter format is similar to Linux's. Examples:
|
|
||||||
console=ttyS0 # to enable serial console on the first serial port
|
|
||||||
console=ttyS1 # second serial port
|
|
||||||
console=ttyS0,38400 # with the given baudrate
|
|
||||||
|
|
||||||
Selectable parity, bits, flow control not implemented yet.
|
|
||||||
|
|
||||||
Index: memtest86+-1.70/config.h
|
|
||||||
===================================================================
|
|
||||||
--- memtest86+-1.70.orig/config.h
|
|
||||||
+++ memtest86+-1.70/config.h
|
|
||||||
@@ -15,6 +15,9 @@
|
|
||||||
/* to enable. */
|
|
||||||
#define SERIAL_CONSOLE_DEFAULT 0
|
|
||||||
|
|
||||||
+/* SERIAL_TTY - The default serial port to use. 0=ttyS0, 1=ttyS1 */
|
|
||||||
+#define SERIAL_TTY 0
|
|
||||||
+
|
|
||||||
/* SERIAL_BAUD_RATE - Baud rate for the serial console */
|
|
||||||
#define SERIAL_BAUD_RATE 9600
|
|
||||||
|
|
||||||
Index: memtest86+-1.70/lib.c
|
|
||||||
===================================================================
|
|
||||||
--- memtest86+-1.70.orig/lib.c
|
|
||||||
+++ memtest86+-1.70/lib.c
|
|
||||||
@@ -11,6 +11,18 @@
|
|
||||||
|
|
||||||
int slock = 0, lsr = 0;
|
|
||||||
short serial_cons = SERIAL_CONSOLE_DEFAULT;
|
|
||||||
+
|
|
||||||
+#if SERIAL_TTY != 0 && SERIAL_TTY != 1
|
|
||||||
+#error Bad SERIAL_TTY. Only ttyS0 and ttyS1 are supported.
|
|
||||||
+#endif
|
|
||||||
+short serial_tty = SERIAL_TTY;
|
|
||||||
+const short serial_base_ports[] = {0x3f8, 0x2f8};
|
|
||||||
+
|
|
||||||
+#if ((115200%SERIAL_BAUD_RATE) != 0)
|
|
||||||
+#error Bad default baud rate
|
|
||||||
+#endif
|
|
||||||
+int serial_baud_rate = SERIAL_BAUD_RATE;
|
|
||||||
+
|
|
||||||
char buf[18];
|
|
||||||
|
|
||||||
struct ascii_map_str {
|
|
||||||
@@ -721,19 +733,9 @@ void ttyprint(int y, int x, const char *
|
|
||||||
serial_echo_print(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
-#if defined(SERIAL_BAUD_RATE)
|
|
||||||
-
|
|
||||||
-#if ((115200%SERIAL_BAUD_RATE) != 0)
|
|
||||||
-#error Bad ttys0 baud rate
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
-#define SERIAL_DIV (115200/SERIAL_BAUD_RATE)
|
|
||||||
-
|
|
||||||
-#endif /* SERIAL_BAUD_RATE */
|
|
||||||
-
|
|
||||||
void serial_echo_init(void)
|
|
||||||
{
|
|
||||||
- int comstat, hi, lo;
|
|
||||||
+ int comstat, hi, lo, serial_div;
|
|
||||||
|
|
||||||
/* read the Divisor Latch */
|
|
||||||
comstat = serial_echo_inb(UART_LCR);
|
|
||||||
@@ -744,12 +746,11 @@ void serial_echo_init(void)
|
|
||||||
|
|
||||||
/* now do hardwired init */
|
|
||||||
serial_echo_outb(0x03, UART_LCR); /* No parity, 8 data bits, 1 stop */
|
|
||||||
-#if defined(SERIAL_BAUD_RATE)
|
|
||||||
+ serial_div = 115200 / serial_baud_rate;
|
|
||||||
serial_echo_outb(0x83, 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(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 */
|
|
||||||
-#endif
|
|
||||||
|
|
||||||
/* Prior to disabling interrupts, read the LSR and RBR
|
|
||||||
* registers */
|
|
||||||
@@ -974,6 +975,59 @@ void wait_keyup( void ) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * Handles "console=<param>" command line option
|
|
||||||
+ *
|
|
||||||
+ * Examples of accepted params:
|
|
||||||
+ * ttyS0
|
|
||||||
+ * ttyS1
|
|
||||||
+ * ttyS0,115200
|
|
||||||
+ */
|
|
||||||
+void serial_console_setup(char *param)
|
|
||||||
+{
|
|
||||||
+ char *option, *end;
|
|
||||||
+ unsigned long tty;
|
|
||||||
+ unsigned long baud_rate;
|
|
||||||
+
|
|
||||||
+ if (strncmp(param, "ttyS", 4))
|
|
||||||
+ return; /* not a serial port */
|
|
||||||
+
|
|
||||||
+ param += 4;
|
|
||||||
+
|
|
||||||
+ tty = simple_strtoul(param, &option, 10);
|
|
||||||
+
|
|
||||||
+ if (option == param)
|
|
||||||
+ return; /* there were no digits */
|
|
||||||
+
|
|
||||||
+ if (tty > 1)
|
|
||||||
+ return; /* only ttyS0 and ttyS1 supported */
|
|
||||||
+
|
|
||||||
+ if (*option == '\0')
|
|
||||||
+ goto save_tty; /* no options given, just ttyS? */
|
|
||||||
+
|
|
||||||
+ if (*option != ',')
|
|
||||||
+ return; /* missing the comma separator */
|
|
||||||
+
|
|
||||||
+ /* baud rate must follow */
|
|
||||||
+ option++;
|
|
||||||
+ baud_rate = simple_strtoul(option, &end, 10);
|
|
||||||
+
|
|
||||||
+ if (end == option)
|
|
||||||
+ return; /* no baudrate after comma */
|
|
||||||
+
|
|
||||||
+ if (baud_rate == 0 || (115200 % baud_rate) != 0)
|
|
||||||
+ return; /* wrong baud rate */
|
|
||||||
+
|
|
||||||
+ if (*end != '\0')
|
|
||||||
+ return; /* garbage at the end */
|
|
||||||
+
|
|
||||||
+ serial_baud_rate = (int) baud_rate;
|
|
||||||
+save_tty:
|
|
||||||
+ serial_tty = (short) tty;
|
|
||||||
+ serial_cons = 1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
#ifdef LP
|
|
||||||
#define DATA 0x00
|
|
||||||
#define STATUS 0x01
|
|
||||||
Index: memtest86+-1.70/main.c
|
|
||||||
===================================================================
|
|
||||||
--- memtest86+-1.70.orig/main.c
|
|
||||||
+++ memtest86+-1.70/main.c
|
|
||||||
@@ -31,6 +31,7 @@ const struct tseq tseq[] = {
|
|
||||||
};
|
|
||||||
|
|
||||||
char firsttime = 0;
|
|
||||||
+char cmdline_parsed = 0;
|
|
||||||
|
|
||||||
struct vars variables = {};
|
|
||||||
struct vars * const v = &variables;
|
|
||||||
@@ -135,12 +136,53 @@ static void run_at(unsigned long addr)
|
|
||||||
__run_at(run_at_addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* command line passing using the 'old' boot protocol */
|
|
||||||
+#define MK_PTR(seg,off) ((void*)(((unsigned long)(seg) << 4) + (off)))
|
|
||||||
+#define OLD_CL_MAGIC_ADDR ((unsigned short*) MK_PTR(INITSEG,0x20))
|
|
||||||
+#define OLD_CL_MAGIC 0xA33F
|
|
||||||
+#define OLD_CL_OFFSET_ADDR ((unsigned short*) MK_PTR(INITSEG,0x22))
|
|
||||||
+
|
|
||||||
+static void parse_command_line(void)
|
|
||||||
+{
|
|
||||||
+ char *cmdline;
|
|
||||||
+
|
|
||||||
+ if (cmdline_parsed)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ if (*OLD_CL_MAGIC_ADDR != OLD_CL_MAGIC)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ unsigned short offset = *OLD_CL_OFFSET_ADDR;
|
|
||||||
+ cmdline = MK_PTR(INITSEG, offset);
|
|
||||||
+
|
|
||||||
+ /* skip leading spaces */
|
|
||||||
+ while (*cmdline == ' ')
|
|
||||||
+ cmdline++;
|
|
||||||
+
|
|
||||||
+ while (*cmdline) {
|
|
||||||
+ if (!strncmp(cmdline, "console=", 8)) {
|
|
||||||
+ cmdline += 8;
|
|
||||||
+ serial_console_setup(cmdline);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* go to the next parameter */
|
|
||||||
+ while (*cmdline && *cmdline != ' ')
|
|
||||||
+ cmdline++;
|
|
||||||
+ while (*cmdline == ' ')
|
|
||||||
+ cmdline++;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ cmdline_parsed = 1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void do_test(void)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
unsigned long chunks;
|
|
||||||
unsigned long lo, hi;
|
|
||||||
|
|
||||||
+ parse_command_line();
|
|
||||||
+
|
|
||||||
/* If we have a partial relocation finish it */
|
|
||||||
if (run_at_addr == (unsigned long)&_start) {
|
|
||||||
run_at_addr = 0xffffffff;
|
|
||||||
Index: memtest86+-1.70/serial.h
|
|
||||||
===================================================================
|
|
||||||
--- memtest86+-1.70.orig/serial.h
|
|
||||||
+++ memtest86+-1.70/serial.h
|
|
||||||
@@ -136,8 +136,8 @@
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "io.h"
|
|
||||||
-#define serial_echo_outb(v,a) outb((v),(a)+0x3f8)
|
|
||||||
-#define serial_echo_inb(a) inb((a)+0x3f8)
|
|
||||||
+#define serial_echo_outb(v,a) outb((v),(a)+serial_base_ports[serial_tty])
|
|
||||||
+#define serial_echo_inb(a) inb((a)+serial_base_ports[serial_tty])
|
|
||||||
#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
|
|
||||||
/* Wait for transmitter & holding register to empty */
|
|
||||||
#define WAIT_FOR_XMITR \
|
|
||||||
Index: memtest86+-1.70/test.h
|
|
||||||
===================================================================
|
|
||||||
--- memtest86+-1.70.orig/test.h
|
|
||||||
+++ memtest86+-1.70/test.h
|
|
||||||
@@ -103,6 +103,7 @@ void printpatn(void);
|
|
||||||
void printpatn(void);
|
|
||||||
void itoa(char s[], int n);
|
|
||||||
void reverse(char *p);
|
|
||||||
+void serial_console_setup(char *param);
|
|
||||||
void serial_echo_init(void);
|
|
||||||
void serial_echo_print(const char *s);
|
|
||||||
void ttyprint(int y, int x, const char *s);
|
|
||||||
|
|
||||||
--
|
|
41
memtest-fix-makefile-for-x86_64.diff
Normal file
41
memtest-fix-makefile-for-x86_64.diff
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
Fix Makefile for x86_64
|
||||||
|
|
||||||
|
Tell as to generate 32-bit code.
|
||||||
|
*.s files are generated from *.S, so clean them too.
|
||||||
|
|
||||||
|
diff -up memtest86+-2.00/Makefile.orig memtest86+-2.00/Makefile
|
||||||
|
--- memtest86+-2.00/Makefile.orig 2008-02-11 14:10:25.000000000 +0100
|
||||||
|
+++ memtest86+-2.00/Makefile 2008-02-11 14:32:35.000000000 +0100
|
||||||
|
@@ -8,6 +8,7 @@
|
||||||
|
#
|
||||||
|
FDISK=/dev/fd0
|
||||||
|
|
||||||
|
+AS=as -32
|
||||||
|
CC=gcc
|
||||||
|
|
||||||
|
CFLAGS=-Wall -march=i486 -m32 -Os -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC
|
||||||
|
@@ -32,6 +33,15 @@ memtest_shared.bin: memtest_shared
|
||||||
|
memtest: memtest_shared.bin memtest.lds
|
||||||
|
$(LD) -s -T memtest.lds -b binary memtest_shared.bin -o $@
|
||||||
|
|
||||||
|
+head.s: head.S config.h defs.h test.h
|
||||||
|
+ $(CC) -E -traditional $< -o $@
|
||||||
|
+
|
||||||
|
+bootsect.s: bootsect.S config.h defs.h
|
||||||
|
+ $(CC) -E -traditional $< -o $@
|
||||||
|
+
|
||||||
|
+setup.s: setup.S config.h defs.h
|
||||||
|
+ $(CC) -E -traditional $< -o $@
|
||||||
|
+
|
||||||
|
memtest.bin: memtest_shared.bin bootsect.o setup.o memtest.bin.lds
|
||||||
|
$(LD) -T memtest.bin.lds bootsect.o setup.o -b binary \
|
||||||
|
memtest_shared.bin -o memtest.bin
|
||||||
|
@@ -43,7 +53,7 @@ test.o: test.c
|
||||||
|
$(CC) -c -Wall -march=i486 -m32 -Os -fomit-frame-pointer -fno-builtin -ffreestanding test.c
|
||||||
|
|
||||||
|
clean:
|
||||||
|
- rm -f *.o memtest.bin memtest memtest_shared memtest_shared.bin
|
||||||
|
+ rm -f *.o *.s memtest.bin memtest memtest_shared memtest_shared.bin
|
||||||
|
|
||||||
|
install: all
|
||||||
|
dd <memtest.bin >$(FDISK) bs=8192
|
@ -6,7 +6,7 @@
|
|||||||
Summary: Stand-alone memory tester for x86 and x86-64 computers
|
Summary: Stand-alone memory tester for x86 and x86-64 computers
|
||||||
Name: memtest86+
|
Name: memtest86+
|
||||||
Version: 2.00
|
Version: 2.00
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
ExclusiveArch: %{ix86} x86_64
|
ExclusiveArch: %{ix86} x86_64
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
@ -69,6 +69,9 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
/sbin/new-memtest-pkg --remove %{version}
|
/sbin/new-memtest-pkg --remove %{version}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Feb 11 2008 Michal Schmidt <mschmidt@redhat.com> - 2.00-2
|
||||||
|
- forgot to cvs add the compilation patch.
|
||||||
|
|
||||||
* Mon Feb 11 2008 Michal Schmidt <mschmidt@redhat.com> - 2.00-1
|
* Mon Feb 11 2008 Michal Schmidt <mschmidt@redhat.com> - 2.00-1
|
||||||
- New upstream release: 2.00.
|
- New upstream release: 2.00.
|
||||||
- Dropped boot time console configuration patches (already upstream).
|
- Dropped boot time console configuration patches (already upstream).
|
||||||
|
@ -1,97 +0,0 @@
|
|||||||
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;
|
|
@ -1,31 +0,0 @@
|
|||||||
Now that we have simple_strtoul() we can use it in getval().
|
|
||||||
|
|
||||||
Index: memtest86+-1.70/lib.c
|
|
||||||
===================================================================
|
|
||||||
--- memtest86+-1.70.orig/lib.c
|
|
||||||
+++ memtest86+-1.70/lib.c
|
|
||||||
@@ -683,21 +683,7 @@ ulong getval(int x, int y, int result_sh
|
|
||||||
shift -= result_shift;
|
|
||||||
|
|
||||||
/* Compute our current value */
|
|
||||||
- val = 0;
|
|
||||||
- for(i = (base == 16)? 2: 0; i < n; i++) {
|
|
||||||
- unsigned long digit = 0;
|
|
||||||
- if ((buf[i] >= '0') && (buf[i] <= '9')) {
|
|
||||||
- digit = buf[i] - '0';
|
|
||||||
- }
|
|
||||||
- else if ((buf[i] >= 'a') && (buf[i] <= 'f')) {
|
|
||||||
- digit = buf[i] - 'a' + 10;
|
|
||||||
- }
|
|
||||||
- else {
|
|
||||||
- /* It must be a suffix byte */
|
|
||||||
- break;
|
|
||||||
- }
|
|
||||||
- val = (val * base) + digit;
|
|
||||||
- }
|
|
||||||
+ val = simple_strtoul(buf, NULL, base);
|
|
||||||
if (shift > 0) {
|
|
||||||
if (shift >= 32) {
|
|
||||||
val = 0xffffffff;
|
|
||||||
|
|
||||||
--
|
|
Loading…
Reference in New Issue
Block a user