Skip to contentSkip to conversation

Garbage on serial console after serial driver loads

DISCUSSION Luca 6 participants 13 messages Mar 25, 2005 – Apr 18, 2005 TTY layer and serial drivers

lore
Share & tools
lore

Luca

author
#0 lore raw

Hi,
I attached a null modem cable to my notebook and I'm seeing garbage as soon as the serial driver is loaded. I tried booting with init=/bin/bash to be sure that it's not some rc script doing strange things to the serial port, but this didn't solve the problem.

This is the relevant part of .config:

#
# Serial drivers
#
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
# CONFIG_SERIAL_8250_CS is not set
# CONFIG_SERIAL_8250_ACPI is not set
CONFIG_SERIAL_8250_NR_UARTS=4
# CONFIG_SERIAL_8250_EXTENDED is not set

I also tried with ACPI discovery (just in case) without success:

#
# Serial drivers
#
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
# CONFIG_SERIAL_8250_CS is not set
CONFIG_SERIAL_8250_ACPI=y
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_EXTENDED=y
# CONFIG_SERIAL_8250_MANY_PORTS is not set
# CONFIG_SERIAL_8250_SHARE_IRQ is not set
CONFIG_SERIAL_8250_DETECT_IRQ=y
# CONFIG_SERIAL_8250_MULTIPORT is not set
# CONFIG_SERIAL_8250_RSA is not set

This is kernel command line:

Kernel command line: BOOT_IMAGE=linux-2.6.12rc1 ro root=305 video=sisfb:mode:1024x768x16 console=tty0 console=ttyS0,38400n8 init=/bin/bash

And this is where garbage appears:

PNP: PS/2 Controller [PNP0303:PS2K,PNP0f13:PS2M] at 0x60,0x64 irq 1,12 i8042.c: Detected active multiplexing controller, rev 1.1.
serio: i8042 AUX0 port at 0x60,0x64 irq 12
serio: i8042 AUX1 port at 0x60,0x64 irq 12
serio: i8042 AUX2 port at 0x60,0x64 irq 12
serio: i8042 AUX3 port at 0x60,0x64 irq 12
serio: i8042 KBD port at 0x60,0x64 irq 1
Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled [garbage]

Once I get the shell using 'clear' cures the problem. The log (from dmesg) should be:

Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a NS16550A
ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A

This is the first time that I use serial console with the notebook, but I've done this before with other machines and never saw this problem.

Googling aroung I found another user with the same problem:
http://www.ussg.iu.edu/hypermail/linux/kernel/0503.1/0442.html
but no answer :(

Any suggestion?

Luca

Signature · 3 lines
Home: http://kronoz.cjb.net
Un apostolo vedendo Gesu` camminare sulle acque:
- Cazzo se e` buono 'sto fumo!!!
#1 lore raw
Quoted 4 lines · Luca

I attached a null modem cable to my notebook and I'm seeing garbage as soon as the serial driver is loaded. I tried booting with init=/bin/bash to be sure that it's not some rc script doing strange things to the serial port, but this didn't solve the problem.

I'm uncertain how this problem can occur, unless you have one of:

* serial debugging enabled (which isn't compatible with serial console)
* a NS16550A, in which case dwmw2 needs to rework his autodetect code to adjust the baud rate appropriately.

I suspect your case is the latter.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
author
#2 lore raw

Il Fri, Mar 25, 2005 at 08:38:53PM +0000, Russell King ha scritto:

Quoted 9 lines · Luca
Quoted 4 lines

I attached a null modem cable to my notebook and I'm seeing garbage as soon as the serial driver is loaded. I tried booting with init=/bin/bash to be sure that it's not some rc script doing strange things to the serial port, but this didn't solve the problem.

I'm uncertain how this problem can occur, unless you have one of:

* serial debugging enabled (which isn't compatible with serial console)

Do you mean #define DEBUG in serial_core.c? No.

Quoted 2 lines

* a NS16550A, in which case dwmw2 needs to rework his autodetect code to adjust the baud rate appropriately.

Well, serial_core seems to think so:

Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a NS16550A
ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A

Luca

Signature · 2 lines
Home: http://kronoz.cjb.net
La mia opinione puo` essere cambiata, ma non il fatto che ho ragione.
#3 lore raw
Quoted 6 lines

Well, serial_core seems to think so:

Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a NS16550A
ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A

Does it work if you set the baud rate manually, as a bootloader option?

Jan Engelhardt

Signature · 1 line
No TOFU for me, please.
author
#4 lore raw

Il Sat, Mar 26, 2005 at 11:16:09AM +0100, Jan Engelhardt ha scritto:

Quoted 8 lines
Quoted 6 lines

Well, serial_core seems to think so:

Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a NS16550A
ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A

Does it work if you set the baud rate manually, as a bootloader option?

I'm using console=ttyS0,38400n8. But it also happens with 9600, 57600 and 115200.

Luca

Signature · 3 lines
Home: http://kronoz.cjb.net
Mi piace avere amici rispettabili;
Mi piace essere il peggiore della compagnia.
#5 lore raw
In reply to Jan Engelhardt
Quoted 8 lines · Jan Engelhardt
Quoted 6 lines

Well, serial_core seems to think so:

Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a NS16550A
ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A

Does it work if you set the baud rate manually, as a bootloader option?

Doesn't matter. The problem is that dwmw2's NS16550A patch (from ages ago) changes the prescaler setting for this device so we can use the higher speed baud rates. This means any programmed divisor (programmed at early serial console initialisation time) suddenly becomes wrong as soon as we fiddle with the prescaler during normal UART initialisation time.

I think the argument for not initialising serial console _until_ after UART initialisation time is gaining more technical merit:

1. spinlock initialisation issues (see other threads)
2. prescaler/divisor interaction issues (this thread)

even though it isn't _that_ desirable.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#6 lore raw
Quoted 6 lines · Russell King

Doesn't matter. The problem is that dwmw2's NS16550A patch (from ages ago) changes the prescaler setting for this device so we can use the higher speed baud rates. This means any programmed divisor (programmed at early serial console initialisation time) suddenly becomes wrong as soon as we fiddle with the prescaler during normal UART initialisation time.

FWIW, I see the same thing here on some Dell Poweredge boxes:

serio: i8042 AUX port at 0x60,0x64 irq 12
serio: i8042 KBD port at 0x60,0x64 irq 1
Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
<garbage>

But intererstingly, on identical boxes, the garbage only appears on those hooked up to a PortMaster device - those using a Cyclades never display this problem. (???)

Phil

#7 lore raw
Quoted 17 lines · Phil Oester
Quoted 6 lines · Russell King

Doesn't matter. The problem is that dwmw2's NS16550A patch (from ages ago) changes the prescaler setting for this device so we can use the higher speed baud rates. This means any programmed divisor (programmed at early serial console initialisation time) suddenly becomes wrong as soon as we fiddle with the prescaler during normal UART initialisation time.

FWIW, I see the same thing here on some Dell Poweredge boxes:

serio: i8042 AUX port at 0x60,0x64 irq 12
serio: i8042 KBD port at 0x60,0x64 irq 1
Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
<garbage>

Quoted 3 lines

But intererstingly, on identical boxes, the garbage only appears on those hooked up to a PortMaster device - those using a Cyclades never display this problem. (???)

Sorry, I don't understand your scenarios. Can you explain the circumstances under which you see corruption?

Quoted 1 line

From the kernel messages you've quoted above, I can only think that

you're not using ttyS0 as the serial console - if you were, my understanding of this issue would indicate that you should get the garbage immediately after the line starting "Serial:"

Either my understanding of the cause of this problem is wrong, or I'm not understanding your setup.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#8 lore raw
Quoted 7 lines · Russell King
Quoted 3 lines

But intererstingly, on identical boxes, the garbage only appears on those hooked up to a PortMaster device - those using a Cyclades never display this problem. (???)

Sorry, I don't understand your scenarios. Can you explain the circumstances under which you see corruption?

Quoted 7 lines

From the kernel messages you've quoted above, I can only think that you're not using ttyS0 as the serial console - if you were, my understanding of this issue would indicate that you should get the garbage immediately after the line starting "Serial:"

Either my understanding of the cause of this problem is wrong, or I'm not understanding your setup.

I have a number of PowerEdge 2550 servers. All are setup with serial console on ttyS0 @ 9600. One group uses a (old) Portmaster device for console access, the other group uses a Cyclades device. Only those servers using the Portmaster device exhibit the garbage problem. The Cyclades group never displays garbage on boot.

Phil

#9 lore raw
In reply to Russell King
Quoted 3 lines · Russell King
Quoted 3 lines

serio: i8042 AUX port at 0x60,0x64 irq 12
serio: i8042 KBD port at 0x60,0x64 irq 1
Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled

Garbage here

Sorry -- I was relying upon my (flawed) memory of the bootup sequence, but sending you the contents from /var/log/dmesg.

Phil

#10 lore raw
In reply to Phil Oester
Quoted 17 lines · Phil Oester
Quoted 6 lines · Russell King

Doesn't matter. The problem is that dwmw2's NS16550A patch (from ages ago) changes the prescaler setting for this device so we can use the higher speed baud rates. This means any programmed divisor (programmed at early serial console initialisation time) suddenly becomes wrong as soon as we fiddle with the prescaler during normal UART initialisation time.

FWIW, I see the same thing here on some Dell Poweredge boxes:

serio: i8042 AUX port at 0x60,0x64 irq 12
serio: i8042 KBD port at 0x60,0x64 irq 1
Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled ttyS0 at I/O 0x3f8 (irq = 4) is a NS16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
<garbage>

Quoted 3 lines

But intererstingly, on identical boxes, the garbage only appears on those hooked up to a PortMaster device - those using a Cyclades never display this problem. (???)

We have a variety of Dell rackmount systems, also on Cyclades, and see this mess everywhere.

I had reported this problem a little while ago, see
http://marc.theaimsgroup.com/?l=linux-kernel&m=111036598927105&w=2
but unfortunately didn't get any response at that time.

Paul Slootman

#12 lore raw
In reply to Paul Slootman
Quoted 8 lines · Paul Slootman
Quoted 7 lines · Phil Oester
Quoted 6 lines · Russell King

Doesn't matter. The problem is that dwmw2's NS16550A patch (from ages ago) changes the prescaler setting for this device so we can use the higher speed baud rates. This means any programmed divisor (programmed at early serial console initialisation time) suddenly becomes wrong as soon as we fiddle with the prescaler during normal UART initialisation time.

Hmm. Why aren't we recalculating the divisor when we change the prescaler? This used to work for serial consoles at the time -- even for serial consoles about 115200 baud, IIRC.

Signature · 1 line
dwmw2