summaryrefslogtreecommitdiffstats
path: root/patches/memtest86+-4.20/0002-Use-serial-port-addresses-provided-by-BIOS.patch
blob: 9747df7369f40b76d59aeeb867c468390ca5bd26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From: Alexander Stein <alexander.stein@systec-electronic.com>
Date: Wed, 23 Nov 2011 16:30:13 +0100
Subject: [PATCH] Use serial port addresses provided by BIOS

Using this patch memtest86+ uses the serial port addresses provided by BIOS rather hardcoded defaults.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
 lib.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib.c b/lib.c
index d107039..91ea950 100644
--- a/lib.c
+++ b/lib.c
@@ -24,7 +24,7 @@ short serial_cons = SERIAL_CONSOLE_DEFAULT;
 #error Bad SERIAL_TTY. Only ttyS0 and ttyS1 are supported.
 #endif
 short serial_tty = SERIAL_TTY;
-const short serial_base_ports[] = {0x3f8, 0x2f8, 0x3e8, 0x2e8};
+unsigned short serial_base_ports[] = {0x3f8, 0x2f8, 0x3e8, 0x2e8};
 
 #if ((115200%SERIAL_BAUD_RATE) != 0)
 #error Bad default baud rate
@@ -1112,6 +1112,8 @@ void serial_console_setup(char *param)
 	serial_baud_rate = (int) baud_rate;
  save_tty:
 	serial_tty = (short) tty;
+	/* fetch I/O port address from BIOS data area */
+	serial_base_ports[serial_tty] = ((const unsigned short *) 0x0400)[serial_tty];
 	serial_cons = 1;
 }