Skip to contentSkip to conversation

16550 serial support

DISCUSSION Josip Rodin 2 participants 30 messages Sep 11, 2008 – Sep 14, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

Here's me with my dunce hat yet again...

I wanted to add serial ports to a Fire v240 (so that I can connect the Fire 280R's serial console cable to it). So I went to the nearest shop and bought a PCI card with a couple of RS-232 ports. It is identified by lspci as:

0001:00:02.0 Serial controller: Timedia Technology Co Ltd PCI2S550 (Dual 16550 UART) (rev 01)

But then I noticed that no kernel module detected this, and that SERIAL_8250 depends on (BROKEN || !SPARC). Googling didn't help much, most users installed this in PCs and it seems everything worked for them (apart from an occasional setserial(8)-related complaint).

Is this then completely unsupported, supported by a different part of the kernel (sunsu, sunsab?), or?

Signature · 1 line
     2. That which causes joy or happiness.
maintainer
#1 lore raw

From: Josip Rodin <[email protected]>
Date: Thu, 11 Sep 2008 16:31:46 +0200

Quoted 9 lines

Here's me with my dunce hat yet again...

I wanted to add serial ports to a Fire v240 (so that I can connect the Fire 280R's serial console cable to it). So I went to the nearest shop and bought a PCI card with a couple of RS-232 ports. It is identified by lspci as:

0001:00:02.0 Serial controller: Timedia Technology Co Ltd PCI2S550 (Dual 16550 UART) (rev 01)

Quoted 7 lines

But then I noticed that no kernel module detected this, and that SERIAL_8250 depends on (BROKEN || !SPARC). Googling didn't help much, most users installed this in PCs and it seems everything worked for them (apart from an occasional setserial(8)-related complaint).

Is this then completely unsupported, supported by a different part of the kernel (sunsu, sunsab?), or?

We don't build this on sparc, because, at least a long time ago it was difficult to get the device to not poke around at the standard ISA port locations for the rs232 ports.

It might actually work.

Try just removing that "depends on" line and then enable SERIAL_8250_PCI but do not enable any of the other SERIAL_8250_ variants. Actually it seems to take care of enabling SERIAL_8250_PCI automatically.

Let me know how it goes.

Wait... let me first check if it will build properly and not spit out any suspicious errors...

Yeah, it won't build:

drivers/serial/8250.c:93:24: error: asm/serial.h: No such file or directory

What does it want in there? Let's have a look.... Ok, it seems we can get by with just providing a BASE_BAUD definition.

The following patch should get it building for you so you can test it out. Meanwhile, I'll toss this into sparc-next-2.6

serial: Allow 8250 to be built on sparc.

---
 arch/sparc/include/asm/serial.h |    6 ++++++
 drivers/serial/Kconfig          |    1 -
 2 files changed, 6 insertions(+), 1 deletions(-)
 create mode 100644 arch/sparc/include/asm/serial.h
arch/sparc/include/asm/serial.h new file +6 -0
new file mode 100644
index 0000000..f90d61c
@@ -0,0 +1,6 @@
+#ifndef __SPARC_SERIAL_H
+#define __SPARC_SERIAL_H
+
+#define BASE_BAUD ( 1843200 / 16 )
+
+#endif /* __SPARC_SERIAL_H */
drivers/serial/Kconfig +0 -1
index 77cb342..db54763 100644
@@ -9,7 +9,6 @@ menu "Serial drivers"
 # The new 8250/16550 serial drivers
 config SERIAL_8250
 	tristate "8250/16550 and compatible serial support"
-	depends on (BROKEN || !SPARC)
 	select SERIAL_CORE
 	---help---
 	  This selects whether you want to include the driver for the standard
Signature · 1 line
1.5.6.5.GIT
#2 lore raw
In reply to Josip Rodin
Quoted 2 lines · David Miller

The following patch should get it building for you so you can test it out. Meanwhile, I'll toss this into sparc-next-2.6

OK, some limited progress, the new kernel boot added the following into dmesg (damn that automagic udev thingy, I wanted to modprobe this like in the old days :):

Serial: 8250/16550 driver4 ports, IRQ sharing disabled 8250_pci: Unknown symbol serial8250_unregister_port 8250_pci: Unknown symbol serial8250_resume_port 8250_pci: Unknown symbol serial8250_register_port 8250_pci: Unknown symbol serial8250_suspend_port
Serial: 8250/16550 driver4 ports, IRQ sharing disabled 8250_pci: Unknown symbol serial8250_unregister_port 8250_pci: Unknown symbol serial8250_resume_port 8250_pci: Unknown symbol serial8250_register_port 8250_pci: Unknown symbol serial8250_suspend_port

I don't get it, 8250.c defines these and they don't seem to be encumbered by anything...

Signature · 1 line
     2. That which causes joy or happiness.
maintainer
#3 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Fri, 12 Sep 2008 00:19:51 +0200

Quoted 15 lines

OK, some limited progress, the new kernel boot added the following into dmesg (damn that automagic udev thingy, I wanted to modprobe this like in the old days :):

Serial: 8250/16550 driver4 ports, IRQ sharing disabled 8250_pci: Unknown symbol serial8250_unregister_port 8250_pci: Unknown symbol serial8250_resume_port 8250_pci: Unknown symbol serial8250_register_port 8250_pci: Unknown symbol serial8250_suspend_port
Serial: 8250/16550 driver4 ports, IRQ sharing disabled 8250_pci: Unknown symbol serial8250_unregister_port 8250_pci: Unknown symbol serial8250_resume_port 8250_pci: Unknown symbol serial8250_register_port 8250_pci: Unknown symbol serial8250_suspend_port

Quoted 2 lines

I don't get it, 8250.c defines these and they don't seem to be encumbered by anything...

Yes that looks strange.

I'd do a fresh build and make sure to do a full "make modules_install" to make sure the depmod dependencies get generated properly.

#4 lore raw
In reply to Josip Rodin
Quoted 6 lines · David Miller
Quoted 6 lines

Serial: 8250/16550 driver4 ports, IRQ sharing disabled 8250_pci: Unknown symbol serial8250_unregister_port 8250_pci: Unknown symbol serial8250_resume_port 8250_pci: Unknown symbol serial8250_register_port 8250_pci: Unknown symbol serial8250_suspend_port

Quoted 7 lines
Quoted 2 lines

I don't get it, 8250.c defines these and they don't seem to be encumbered by anything...

Yes that looks strange.

I'd do a fresh build and make sure to do a full "make modules_install" to make sure the depmod dependencies get generated properly.

Oh, it's definitely a build issue, after I wiped out the modules directory and re-ran modules_install, depmod warned about the same issue.

So I did a make clean and rebuilt, rebooted, and it still has the same problem :/

I vaguely remember having something likes on x86 a couple of times.

Once it happened when I tried to insert the smc-ircc2 IRDA driver, it needed to be loaded before the native 8250 stuff. In that case it was vice-verse - the irda stuff showed undefined symbols.

And then another time I saw the problem with Xen - I told it to use ttyS0 for its own console, and then the 8250 modules couldn't get loaded because of its undefined symbols (possibly the very same ones as the above), until I switched 'xencons' over to ttyS31.

Could it be that the sunsu driver is somehow disturbing 8250?

(Should we Cc: this to some other mailing list?)

Signature · 1 line
     2. That which causes joy or happiness.
#5 lore raw
In reply to Josip Rodin
Quoted 8 lines · Josip Rodin
Quoted 8 lines
Quoted 8 lines

Serial: 8250/16550 driver4 ports, IRQ sharing disabled 8250_pci: Unknown symbol serial8250_unregister_port 8250_pci: Unknown symbol serial8250_resume_port 8250_pci: Unknown symbol serial8250_register_port 8250_pci: Unknown symbol serial8250_suspend_port

I don't get it, 8250.c defines these and they don't seem to be encumbered by anything...

Oh, I think I have a small clue... the latter four messages come from the 8250_pci loading attempt, but the first message is from the 8250 loading attempt - which also fails (but does the printk which makes it look all right). A standalone attempt reveals:

% sudo modprobe 8250
FATAL: Error inserting 8250 (/lib/modules/2.6.27-rc4/kernel/drivers/serial/8250.ko): Device or resource busy %

That should be EBUSY, and that gets mentioned twice in serial8250_request_std_resource() and once in serial8250_request_rsa_resource(), after failures of request_mem_region() and request_region(). Both of those are macros for __request_region(). The stuff past that is uncharted territory for me :)

Signature · 1 line
     2. That which causes joy or happiness.
maintainer
#6 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Fri, 12 Sep 2008 01:15:43 +0200

Quoted 5 lines

Oh, it's definitely a build issue, after I wiped out the modules directory and re-ran modules_install, depmod warned about the same issue.

So I did a make clean and rebuilt, rebooted, and it still has the same problem :/

Strange. Maybe make clean isn't powerful enough? Perhaps try "make mrproper". It could be that some module signature file is not being rebuilt.

The thing you're seeing can happen if the module symbols are being versioned, 8250.c does exports using versions but 8250_pci.c is referencing those symbols without versions, or vice versa.

Quoted 1 line

Could it be that the sunsu driver is somehow disturbing 8250?

I doubt it. The sunsu driver does not export nor reference symbols with those names.

Quoted 1 line

(Should we Cc: this to some other mailing list?)

Right now we're not sure if sparc64 or a corrupted build is to blame or not, so not yet :)

maintainer
#7 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Fri, 12 Sep 2008 01:27:29 +0200

Quoted 9 lines

Oh, I think I have a small clue... the latter four messages come from the 8250_pci loading attempt, but the first message is from the 8250 loading attempt - which also fails (but does the printk which makes it look all right). A standalone attempt reveals:

% sudo modprobe 8250
FATAL: Error inserting 8250 (/lib/modules/2.6.27-rc4/kernel/drivers/serial/8250.ko): Device or resource busy %

Quoted 5 lines

That should be EBUSY, and that gets mentioned twice in serial8250_request_std_resource() and once in serial8250_request_rsa_resource(), after failures of request_mem_region() and request_region(). Both of those are macros for __request_region(). The stuff past that is uncharted territory for me :)

I think it's this platform ISA device it registers in 8250.c

No... I think I see the problem. Your suspicion about sunsu appears to be correct.

Both drivers want to register devices using major number TTY_MAJOR and minor number(s) 64, 65, etc.

So whichever driver gets it first succeeds, and then the other gets -EBUSY.

Here is a quick patch that might make it work.

drivers/serial/8250.c +8 -0
index 342e12f..3afd31e 100644
@@ -44,6 +44,10 @@
 
 #include "8250.h"
 
+#ifdef CONFIG_SPARC
+#include "suncore.h"
+#endif
+
 /*
  * Configuration:
  *   share_irqs - whether we pass IRQF_SHARED to request_irq().  This option
@@ -2954,7 +2958,11 @@ static int __init serial8250_init(void)
 	for (i = 0; i < NR_IRQS; i++)
 		spin_lock_init(&irq_lists[i].lock);
 
+#ifdef CONFIG_SPARC
+	ret = sunserial_register_minors(&serial8250_reg, nr_uarts);
+#else
 	ret = uart_register_driver(&serial8250_reg);
+#endif
 	if (ret)
 		goto out;
 
drivers/serial/Makefile +10 -5
index 7e7383e..7bc1292 100644
@@ -4,6 +4,16 @@
 
 obj-$(CONFIG_SERIAL_CORE) += serial_core.o
 obj-$(CONFIG_SERIAL_21285) += 21285.o
+
+# These Sparc drivers have to appear before others such as 8250
+# which share ttySx minor node space.  Otherwise console device
+# names change and other unplesantries.
+obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o
+obj-$(CONFIG_SERIAL_SUNHV) += sunhv.o
+obj-$(CONFIG_SERIAL_SUNZILOG) += sunzilog.o
+obj-$(CONFIG_SERIAL_SUNSU) += sunsu.o
+obj-$(CONFIG_SERIAL_SUNSAB) += sunsab.o
+
 obj-$(CONFIG_SERIAL_8250) += 8250.o
 obj-$(CONFIG_SERIAL_8250_PNP) += 8250_pnp.o
 obj-$(CONFIG_SERIAL_8250_GSC) += 8250_gsc.o
@@ -31,12 +41,7 @@ obj-$(CONFIG_SERIAL_S3C2400) += s3c2400.o
 obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o
 obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o
 obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o
-obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o
-obj-$(CONFIG_SERIAL_SUNHV) += sunhv.o
-obj-$(CONFIG_SERIAL_SUNZILOG) += sunzilog.o
 obj-$(CONFIG_SERIAL_IP22_ZILOG) += ip22zilog.o
-obj-$(CONFIG_SERIAL_SUNSU) += sunsu.o
-obj-$(CONFIG_SERIAL_SUNSAB) += sunsab.o
 obj-$(CONFIG_SERIAL_MUX) += mux.o
 obj-$(CONFIG_SERIAL_68328) += 68328serial.o
 obj-$(CONFIG_SERIAL_68360) += 68360serial.o
#8 lore raw
In reply to Josip Rodin
Quoted 10 lines · David Miller

No... I think I see the problem. Your suspicion about sunsu appears to be correct.

Both drivers want to register devices using major number TTY_MAJOR and minor number(s) 64, 65, etc.

So whichever driver gets it first succeeds, and then the other gets -EBUSY.

Here is a quick patch that might make it work.

OK, I did a clean rebuild and reboot, but no dice:

Serial: 8250/16550 driver4 ports, IRQ sharing disabled

Unable to handle kernel NULL pointer dereference
tsk->{mm,active_mm}->context = 00000000000001e1
tsk->{mm,active_mm}->pgd = fffff8103d624000
              \|/ ____ \|/
              "@'/ .. \`@"
              /_| \__/ |_\
                 \__U_/

modprobe(782): Oops [#1]
TSTATE: 0000000011009606 TPC: 0000000000580e8c TNPC: 0000000000580e90 Y: 00000000 Not tainted
TPC: <sunserial_register_minors+0x5c/0x68>
g0: 0000000000000b40 g1: 0000000000000002 g2: 0000000000000000 g3: 0000000000000000
g4: fffff8103d7169e0 g5: fffff8103f57c000 g6: fffff8103c878000 g7: 0000000000000000
o0: 0000000010059288 o1: 0000000000781922 o2: 0000000000000001 o3: 000000000072f250
o4: 000000000072f250 o5: 0000000000002000 sp: fffff8103c87b2a1 ret_pc: 0000000000455594
RPC: <printk+0x24/0x38>
l0: fffff8103c93e028 l1: 000000010000c000 l2: 000000010000c000 l3: 000000010000c000
l4: fffff8103f002800 l5: fffff8103f373eb4 l6: 0000000000000001 l7: 0000000000000000
i0: 0000000010059288 i1: 0000000000000004 i2: 0000000010057290 i3: 0000000000400000
i4: fffff8000000a040 i5: 0000000000000008 i6: fffff8103c87b361 i7: 000000001005e180
I7: <serial8250_init+0x88/0x158 [8250]>
Caller[000000001005e180]: serial8250_init+0x88/0x158 [8250]
Caller[0000000000426a78]: do_one_initcall+0x38/0x140
Caller[0000000000475d34]: sys_init_module+0x17f8/0x1954
Caller[0000000000406214]: linux_sparc_syscall32+0x34/0x40
Caller[00000000000133b4]: 0x133b4
Instruction DUMP: c206201c c45e2038 82007fc0 <c220a088> 81cfe008 9138e000 81c3e008 90102001 81c3e008

Signature · 1 line
     2. That which causes joy or happiness.
maintainer
#9 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Fri, 12 Sep 2008 02:40:14 +0200

Quoted 4 lines

OK, I did a clean rebuild and reboot, but no dice:

Serial: 8250/16550 driver4 ports, IRQ sharing disabled

Unable to handle kernel NULL pointer dereference

Please add this follow-on patch:

serial/8250.c renamed from serial/8250.c~ +2 -2
@@ -2673,7 +2673,6 @@ static struct uart_driver serial8250_reg
 	.dev_name		= "ttyS",
 	.major			= TTY_MAJOR,
 	.minor			= 64,
-	.nr			= UART_NR,
 	.cons			= SERIAL8250_CONSOLE,
 };
 
@@ -2959,8 +2958,9 @@ static int __init serial8250_init(void)
 		spin_lock_init(&irq_lists[i].lock);
 
 #ifdef CONFIG_SPARC
-	ret = sunserial_register_minors(&serial8250_reg, nr_uarts);
+	ret = sunserial_register_minors(&serial8250_reg, UART_NR);
 #else
+	serial8250_reg.nr = UART_NR;
 	ret = uart_register_driver(&serial8250_reg);
 #endif
 	if (ret)
#10 lore raw
In reply to Josip Rodin

Review

Quoted 10 lines · David Miller
Quoted 4 lines

OK, I did a clean rebuild and reboot, but no dice:

Serial: 8250/16550 driver4 ports, IRQ sharing disabled

Unable to handle kernel NULL pointer dereference

Please add this follow-on patch:

#ifdef CONFIG_SPARC

(quoted diff) +1 -1
-	ret = sunserial_register_minors(&serial8250_reg, nr_uarts);
+	ret = sunserial_register_minors(&serial8250_reg, UART_NR);

OK, this is strange, now the loading attempt hangs. stracing it shows looping...

open("/lib/modules/2.6.27-rc4/kernel/drivers/serial/8250.ko", O_RDWR) = 3 fcntl64(3, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=0, len=1}) = 0
open("/proc/modules", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7f4c000 read(4, "ip6t_REJECT 6592 2 - Live 0x0000"..., 1024) = 1024
read(4, "80 0 - Live 0x0000000010062000\n8"..., 1024) = 207

nanosleep({0, 100000000}, NULL)         = 0
close(4)                                = 0
munmap(0xf7f4c000, 8192)                = 0
open("/proc/modules", O_RDONLY)         = 4

fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7f4c000 read(4, "ip6t_REJECT 6592 2 - Live 0x0000"..., 1024) = 1024
read(4, "80 0 - Live 0x0000000010062000\n8"..., 1024) = 207

nanosleep({0, 100000000}, NULL)         = 0
close(4)                                = 0
munmap(0xf7f4c000, 8192)                = 0
open("/proc/modules", O_RDONLY)         = 4

fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7f4c000 read(4, "ip6t_REJECT 6592 2 - Live 0x0000"..., 1024) = 1024
read(4, "80 0 - Live 0x0000000010062000\n8"..., 1024) = 207

nanosleep({0, 100000000}, NULL)         = 0
close(4)                                = 0
munmap(0xf7f4c000, 8192)                = 0
open("/proc/modules", O_RDONLY)         = 4

fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7f4c000 read(4, "ip6t_REJECT 6592 2 - Live 0x0000"..., 1024) = 1024
read(4, "80 0 - Live 0x0000000010062000\n8"..., 1024) = 207

nanosleep({0, 100000000}, NULL)         = 0
close(4)                                = 0
munmap(0xf7f4c000, 8192)                = 0
open("/proc/modules", O_RDONLY)         = 4

fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7f4c000 read(4, "ip6t_REJECT 6592 2 - Live 0x0000"..., 1024) = 1024
read(4, "80 0 - Live 0x0000000010062000\n8"..., 1024) = 207

nanosleep({0, 100000000}, NULL)         = 0
close(4)                                = 0
munmap(0xf7f4c000, 8192)                = 0
open("/proc/modules", O_RDONLY)         = 4

fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xf7f4c000 read(4, "ip6t_REJECT 6592 2 - Live 0x0000"..., 1024) = 1024
read(4, "80 0 - Live 0x0000000010062000\n8"..., 1024) = 207

nanosleep({0, 100000000}, NULL)         = 0
close(4)                                = 0
munmap(0xf7f4c000, 8192)                = 0
open("/proc/modules", O_RDONLY)         = 4

[...]

For the record:

% cat /proc/modules
ip6t_REJECT 6592 2 - Live 0x000000001013e000
nf_conntrack_ipv6 16800 1 - Live 0x0000000010136000
ip6table_filter 5376 1 - Live 0x0000000010132000
ip6_tables 21264 1 ip6table_filter, Live 0x000000001012a000
ipv6 274464 26 ip6t_REJECT,nf_conntrack_ipv6, Live 0x00000000100e4000
ipt_REJECT 5696 2 - Live 0x00000000100e0000
xt_tcpudp 5824 20 - Live 0x00000000100dc000
nf_conntrack_ipv4 17816 1 - Live 0x00000000100d4000
xt_state 4672 2 - Live 0x0000000010050000
nf_conntrack 70160 3 nf_conntrack_ipv6,nf_conntrack_ipv4,xt_state, Live 0x00000000100c0000 iptable_filter 5568 1 - Live 0x000000001002a000
ip_tables 19920 1 iptable_filter, Live 0x00000000100b8000
x_tables 24520 6 ip6t_REJECT,ip6_tables,ipt_REJECT,xt_tcpudp,xt_state,ip_tables, Live 0x00000000100b0000 dm_snapshot 20416 0 - Live 0x00000000100a8000
dm_mirror 19584 0 - Live 0x00000000100a0000
dm_log 13441 1 dm_mirror, Live 0x000000001009a000
dm_mod 57232 3 dm_snapshot,dm_mirror,dm_log, Live 0x000000001008a000
qla1280 121232 0 - Live 0x000000001006a000
ohci_hcd 24480 0 - Live 0x0000000010062000
8250 29680 1 - Loading 0x0000000010054000
usbcore 127232 1 ohci_hcd, Live 0x000000001002e000
tg3 130052 0 - Live 0x0000000010008000
libphy 23936 1 tg3, Live 0x0000000010000000

Signature · 1 line
     2. That which causes joy or happiness.
#11 lore raw
In reply to Josip Rodin
Quoted 3 lines · Josip Rodin

OK, this is strange, now the loading attempt hangs. stracing it shows looping...
8250 29680 1 - Loading 0x0000000010054000

Unloading the module also didn't work the same way... so I figured it might be another unclean upgrade issue, so I rebooted it to see what happens when I start from scratch - and then a much more serious problem arose: at the point during the boot sequence when udev detected and loaded the modules, the machine reproducibly crashes (tried it twice in a row).

The serial console seems to gets jumbled because the error message overwrites the last few lines, and then the ALOM prints its reset notice on top of the screen. This is my reproduction of the last output:

Serial: 8250/16550 driver4 ports, IRQ sharing disabled [a couple of assorted messages from tg3]

Fatal Error Reset

CPU 0000.0000.0000.0000 AFSR 0080.0000.0000.0000 JEIC AFAR 0000.0000.0000.0000

SC Alert: Host System has Reset

Signature · 1 line
     2. That which causes joy or happiness.
maintainer
#12 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Fri, 12 Sep 2008 20:36:40 +0200

Quoted 5 lines

Unloading the module also didn't work the same way... so I figured it might be another unclean upgrade issue, so I rebooted it to see what happens when I start from scratch - and then a much more serious problem arose: at the point during the boot sequence when udev detected and loaded the modules, the machine reproducibly crashes (tried it twice in a row).

Does this make things better?

include/linux/serial_core.h +1 -1
index 3b2f6c0..e27f216 100644
@@ -241,7 +241,7 @@ typedef unsigned int __bitwise__ upf_t;
 
 struct uart_port {
 	spinlock_t		lock;			/* port lock */
-	unsigned int		iobase;			/* in/out[bwl] */
+	unsigned long		iobase;			/* in/out[bwl] */
 	unsigned char __iomem	*membase;		/* read/write[bwl] */
 	unsigned int		irq;			/* irq number */
 	unsigned int		uartclk;		/* base uart clock */
#13 lore raw
In reply to Josip Rodin
Quoted 12 lines · David Miller

From: Josip Rodin <[email protected]>
Date: Fri, 12 Sep 2008 20:36:40 +0200

Quoted 5 lines

Unloading the module also didn't work the same way... so I figured it might be another unclean upgrade issue, so I rebooted it to see what happens when I start from scratch - and then a much more serious problem arose: at the point during the boot sequence when udev detected and loaded the modules, the machine reproducibly crashes (tried it twice in a row).

Does this make things better?

struct uart_port {

Review

Quoted 3 lines
(quoted diff) +1 -1
 	spinlock_t		lock;			/* port lock */
-	unsigned int		iobase;			/* in/out[bwl] */
+	unsigned long		iobase;			/* in/out[bwl] */

Yay, that made it not crash, and more :)

Serial: 8250/16550 driver4 ports, IRQ sharing disabled
PCI: Enabling device: (0001:00:02.0), cmd 81 0001:00:02.0: ttyS0 at I/O 0x1000940 (irq = 19) is a 16550A 0001:00:02.0: ttyS1 at I/O 0x1000948 (irq = 19) is a 16550A

Thanks a bunch :) minicom isn't giving me anything useful, but that might well be a cable issue :)

Signature · 1 line
     2. That which causes joy or happiness.
maintainer
#14 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Sat, 13 Sep 2008 04:31:30 +0200

Quoted 10 lines · David Miller

Review

Quoted 6 lines

Does this make things better?

struct uart_port {

(quoted diff) +1 -1
 	spinlock_t		lock;			/* port lock */
-	unsigned int		iobase;			/* in/out[bwl] */
+	unsigned long		iobase;			/* in/out[bwl] */

Yay, that made it not crash, and more :)

Quoted 7 lines

Serial: 8250/16550 driver4 ports, IRQ sharing disabled
PCI: Enabling device: (0001:00:02.0), cmd 81 0001:00:02.0: ttyS0 at I/O 0x1000940 (irq = 19) is a 16550A 0001:00:02.0: ttyS1 at I/O 0x1000948 (irq = 19) is a 16550A

Thanks a bunch :) minicom isn't giving me anything useful, but that might well be a cable issue :)

Thank you for testing.

I'll try to get all of this stuff merged upstream in 2.6.28 somehow.

#15 lore raw
In reply to Josip Rodin
Quoted 7 lines · Josip Rodin

Serial: 8250/16550 driver4 ports, IRQ sharing disabled
PCI: Enabling device: (0001:00:02.0), cmd 81 0001:00:02.0: ttyS0 at I/O 0x1000940 (irq = 19) is a 16550A 0001:00:02.0: ttyS1 at I/O 0x1000948 (irq = 19) is a 16550A

Thanks a bunch :) minicom isn't giving me anything useful, but that might well be a cable issue :)

Hm, no, I just tested the cable between two x86s and it works - I ran minicom with 9600N1 no hardware or software flow control, typed in something on the one end and it came out on the other end, and vice versa. Doing the same with the sparc didn't produce any result. I also tried connecting the two ports on the card and running two minicoms each on its own ttyS[01], to no avail. I'll have to take the card out and insert it into an x86 to see whether it works in that environment.

Signature · 1 line
     2. That which causes joy or happiness.
#16 lore raw
In reply to Josip Rodin
Quoted 9 lines · Josip Rodin
Quoted 7 lines · Josip Rodin

Serial: 8250/16550 driver4 ports, IRQ sharing disabled
PCI: Enabling device: (0001:00:02.0), cmd 81 0001:00:02.0: ttyS0 at I/O 0x1000940 (irq = 19) is a 16550A 0001:00:02.0: ttyS1 at I/O 0x1000948 (irq = 19) is a 16550A

Thanks a bunch :) minicom isn't giving me anything useful, but that might well be a cable issue :)

Quoted 7 lines

Hm, no, I just tested the cable between two x86s and it works - I ran minicom with 9600N1 no hardware or software flow control, typed in something on the one end and it came out on the other end, and vice versa. Doing the same with the sparc didn't produce any result. I also tried connecting the two ports on the card and running two minicoms each on its own ttyS[01], to no avail. I'll have to take the card out and insert it into an x86 to see whether it works in that environment.

It works on x86_64 with 2.6.22.18 and 2.6.24.2 (will test with .26.5 soon). The two ports can talk to each other, and they can also talk to the ports on another such serial PCI card that I just bought (covering my bases :).

The first card is identified as:

% sudo lspci -v -s 05:08
05:08.0 Serial controller: Timedia Technology Co Ltd PCI2S550 (Dual 16550 UART) (rev 01) (prog-if 02 [16550])
Subsystem: Timedia Technology Co Ltd Unknown device 4037
Flags: stepping, medium devsel, IRQ 16
I/O ports at 9c00 [size2]

The other card is identified as:

% sudo lspci -v -s 05:0a
05:0a.0 Serial controller: Oxford Semiconductor Ltd OX16PCI952 (Dual 16950 UART) (prog-if 06 [16950])

        Subsystem: Oxford Semiconductor Ltd Unknown device 0001
        Flags: medium devsel, IRQ 18
        I/O ports at 9800 [size=8]
        I/O ports at 9400 [size=8]
        I/O ports at 9000 [size2]
        Memory at fdffe000 (32-bit, non-prefetchable) [size=4K]
        Memory at fdffd000 (32-bit, non-prefetchable) [size=4K]
        Capabilities: [40] Power Management version 1

05:0a.1 Parallel controller: Oxford Semiconductor Ltd OX16PCI952 Integrated Parallel Port (prog-if 01 [BiDir])

        Subsystem: Oxford Semiconductor Ltd Unknown device 0001
        Flags: medium devsel, IRQ 18
        I/O ports at 8c00 [size=8]
        I/O ports at 8800 [size=4]
        I/O ports at 8400 [size2]
        Memory at fdffc000 (32-bit, non-prefetchable) [size=4K]
        Capabilities: [40] Power Management version 1

After I test with 2.6.26.5, I'll put them both into the Sun Fire v240 and see how they do there.

Signature · 1 line
     2. That which causes joy or happiness.
#17 lore raw
In reply to Josip Rodin
Quoted 19 lines · Josip Rodin
Quoted 9 lines · Josip Rodin
Quoted 7 lines · Josip Rodin

Serial: 8250/16550 driver4 ports, IRQ sharing disabled
PCI: Enabling device: (0001:00:02.0), cmd 81 0001:00:02.0: ttyS0 at I/O 0x1000940 (irq = 19) is a 16550A 0001:00:02.0: ttyS1 at I/O 0x1000948 (irq = 19) is a 16550A

Thanks a bunch :) minicom isn't giving me anything useful, but that might well be a cable issue :)

Quoted 7 lines

Hm, no, I just tested the cable between two x86s and it works - I ran minicom with 9600N1 no hardware or software flow control, typed in something on the one end and it came out on the other end, and vice versa. Doing the same with the sparc didn't produce any result. I also tried connecting the two ports on the card and running two minicoms each on its own ttyS[01], to no avail. I'll have to take the card out and insert it into an x86 to see whether it works in that environment.

It works on x86_64 with 2.6.22.18 and 2.6.24.2 (will test with .26.5 soon).

[...]

Quoted 2 lines

After I test with 2.6.26.5, I'll put them both into the Sun Fire v240 and see how they do there.

I tested it with 2.6.26.5 on x86_64 - that also works. testing with v240 later (I'm not physically nearby currently).

After being put into the v240, they reliably stop working :/

The lspci output on the sparc machine is this:

% sudo lspci -v -s 0001:00:03
0001:00:03.0 Serial controller: Timedia Technology Co Ltd PCI2S550 (Dual 16550 UART) (rev 01) (prog-if 02 [16550])

        Subsystem: Timedia Technology Co Ltd Unknown device 4037
        Flags: stepping, medium devsel, IRQ 20
        I/O ports at 09a0 [size2]
        [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable) [disabled] [size=1]
        [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable) [disabled] [size=1]
        [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable) [disabled] [size=1]
        [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable) [disabled] [size=1]
        [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable) [disabled] [size=1]
        [virtual] Expansion ROM at fffff80100000000 [disabled] [size=1]

% sudo lspci -v -s 0001:00:02
0001:00:02.0 Serial controller: Oxford Semiconductor Ltd OX16PCI952 (Dual 16950 UART) (prog-if 06 [16950])

        Subsystem: Oxford Semiconductor Ltd Unknown device 0001
        Flags: medium devsel, IRQ 19
        I/O ports at 0930 [size=8]
        I/O ports at 0938 [size=8]
        I/O ports at 0940 [size2]
        Memory at 00100000 (32-bit, non-prefetchable) [size=8K]
        Memory at 00102000 (32-bit, non-prefetchable) [size=8K]
        [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable) [size=1]
        [virtual] Expansion ROM at fffff80100000000 [disabled] [size=1]
        Capabilities: [40] Power Management version 1

0001:00:02.1 Parallel controller: Oxford Semiconductor Ltd OX16PCI952 Integrated Parallel Port (prog-if 01 [BiDir])

        Subsystem: Oxford Semiconductor Ltd Unknown device 0001
        Flags: medium devsel, IRQ 19
        I/O ports at 0960 [disabled] [size=8]
        I/O ports at 0968 [disabled] [size=4]
        I/O ports at 0980 [disabled] [size2]
        Memory at 00104000 (32-bit, non-prefetchable) [disabled] [size=8K]
        [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable) [disabled] [size=1]
        [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable) [disabled] [size=1]
        [virtual] Expansion ROM at fffff80100000000 [disabled] [size=1]
        Capabilities: [40] Power Management version 1

Here's also the printks:

% dmesg | grep 1:00:03
PCI: Enabling device: (0001:00:03.0), cmd 81 0001:00:03.0: ttyS2 at I/O 0x10009a0 (irq = 20) is a 16550A 0001:00:03.0: ttyS3 at I/O 0x10009a8 (irq = 20) is a 16550A

% dmesg | grep 1:00:02
pci 0001:00:02.0: supports D2
pci 0001:00:02.0: PME# supported from D0 D2 D3hot
pci 0001:00:02.0: PME# disabled
pci 0001:00:02.1: supports D2
pci 0001:00:02.1: PME# supported from D0 D2 D3hot
pci 0001:00:02.1: PME# disabled
PCI: Enabling device: (0001:00:02.0), cmd 3 0001:00:02.0: ttyS0 at I/O 0x1000930 (irq = 19) is a 16C950/954 0001:00:02.0: ttyS1 at I/O 0x1000938 (irq = 19) is a 16C950/954

Signature · 1 line
     2. That which causes joy or happiness.
#18 lore raw
In reply to Josip Rodin
Quoted 1 line · Josip Rodin

After being put into the v240, they reliably stop working :/

Errrr, in another round of sparcs screwing with my mind :) I have almost accidentally gotten one combination to work - I plugged both ends of the cable into the Oxford card, and established communication between ttyS2 and ttyS3.

That can't be right...

% dmesg | grep 'ttyS[23]'
0001:00:03.0: ttyS2 at I/O 0x10009a0 (irq = 20) is a 16550A 0001:00:03.0: ttyS3 at I/O 0x10009a8 (irq = 20) is a 16550A

% sudo lspci -s 0001:00:03.0
0001:00:03.0 Serial controller: Timedia Technology Co Ltd PCI2S550 (Dual 16550 UART) (rev 01)

Uhh.

Then I went back to the machine, opened it up (live) and made physically sure that the cables were indeed plugged into the Oxford card. Software is wrong, I swear! :)

Then I tried to experiment with plugging both ends of the cable into the (physical) Timedia card, and connecting minicoms via ttyS0 and ttyS1 - but that did not work.

Dave, I hope you can make sense of all this... you have the prtconf of the machine in the repository so you can see which PCI controller that is. If you need any more details, please don't hesitate to let me know.

Signature · 1 line
     2. That which causes joy or happiness.
maintainer
#19 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Sat, 13 Sep 2008 20:04:27 +0200

Quoted 3 lines

Dave, I hope you can make sense of all this... you have the prtconf of the machine in the repository so you can see which PCI controller that is. If you need any more details, please don't hesitate to let me know.

I wonder if interrupts are getting through.

Can you watch /proc/interrupts when you try to use the card in the sparc box?

#20 lore raw
In reply to Josip Rodin
Quoted 4 lines · David Miller

I wonder if interrupts are getting through.

Can you watch /proc/interrupts when you try to use the card in the sparc box?

I don't have it plugged into the bad combination right now (need to get more cables...), and I'm not there to change the wiring again, but I think I have one data point:

* when I generate traffic over the working ttyS2 link, IRQ 19 appears in /proc/interrupts normally
* when I generate traffic over the broken as well as disconnected ttyS0 link, IRQ 15 described as "su(serial), su(serial)" gets activated on CPU1
* when I generate traffic over the broken as well as disconnected ttyS1 link, IRQ 15 described as "su(serial), su(serial)" gets activated on CPU0

That sounds to me like sunsu has developed an unhealthy attachment to the ttyS[01] devices :) despite the fact it's 8250 which is supposed to be handling them - there are no physical serial ports used by sunsu on this v240, only the ALOM serial port.

For the record I then also noticed this:

% sudo ls -l /proc/tty/driver/
total 0
-r--r--r-- 1 root root 0 2008-09-14 02:16 serial
-r--r--r-- 1 root root 0 2008-09-14 02:16 sunsu

% sudo cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16C950/954 port:7FE01000930 irq:19 tx:290 rx:2875 fe:243 brk:12 RTS|CTS|DTR|DSR|CD 1: uart:16C950/954 port:7FE01000938 irq:19 tx:36 rx:33 RTS|DTR
2: uart:16550A port:7FE010009A0 irq:20 tx:0 rx:0
3: uart:16550A port:7FE010009A8 irq:20 tx:0 rx:0

% sudo cat /proc/tty/driver/sunsu
serinfo:1.0 driver revision:
0: uart:16550A mmio:0x7FE010003F8 irq:15 tx:380 rx:0 RTS|CTS|DTR|DSR|CD 1: uart:16550A mmio:0x7FE010002E8 irq:15 tx:72 rx:0 RTS|DTR

That definitely sounds suspicious.

Signature · 1 line
     2. That which causes joy or happiness.
maintainer
#21 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Sun, 14 Sep 2008 02:52:12 +0200

Quoted 14 lines

For the record I then also noticed this:

% sudo ls -l /proc/tty/driver/
total 0

(quoted diff) +0 -2
-r--r--r-- 1 root root 0 2008-09-14 02:16 serial
-r--r--r-- 1 root root 0 2008-09-14 02:16 sunsu

% sudo cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16C950/954 port:7FE01000930 irq:19 tx:290 rx:2875 fe:243 brk:12 RTS|CTS|DTR|DSR|CD 1: uart:16C950/954 port:7FE01000938 irq:19 tx:36 rx:33 RTS|DTR
2: uart:16550A port:7FE010009A0 irq:20 tx:0 rx:0
3: uart:16550A port:7FE010009A8 irq:20 tx:0 rx:0

Quoted 6 lines

% sudo cat /proc/tty/driver/sunsu
serinfo:1.0 driver revision:
0: uart:16550A mmio:0x7FE010003F8 irq:15 tx:380 rx:0 RTS|CTS|DTR|DSR|CD 1: uart:16550A mmio:0x7FE010002E8 irq:15 tx:72 rx:0 RTS|DTR

That definitely sounds suspicious.

Although this is a good area to investigate, conflicting ttyS? device usage, I think the above is OK looking.

Those indexes "0", "1", etc. are within the namespace of the device type itself. It does not determine which ttyS? device index these things gets hooked up to.

That is determined by the sunserial_register_minors() call made by the Sun drivers and now 8250.

What should happen on your system is sunsu registers first, and takes devices /dev/ttyS0 and /dev/ttyS1

Then later the PCI 8250 driver loads and takes /dev/ttyS2 and /dev/ttyS3 for your first card and /dev/ttyS4 and /dev/ttyS5 for your second card.

If you look at the contents of /proc/tty/drivers you can probably see this. For example, on my workstation it states:

davem@sunset:~/src/GIT/sparc-next-2.6$ cat /proc/tty/drivers
/dev/tty             /dev/tty        5       0 system:/dev/tty
/dev/console         /dev/console    5       1 system:console
/dev/ptmx            /dev/ptmx       5       2 system
/dev/vc/0            /dev/vc/0       4       0 system:vtmaster
sunsu                /dev/ttyS       4 64-65 serial
pty_slave            /dev/pts      136 0-1048575 pty:slave
pty_master           /dev/ptm      128 0-1048575 pty:master
unknown              /dev/tty        4 1-63 console
davem@sunset:~/src/GIT/sparc-next-2.6$ 

You probably have something that looks like:

sunsu                /dev/ttyS       4 64-65 serial
serial               /dev/ttyS       4 66-69 serial

which would match up with my predictions above. /dev/ttyS0 uses device minor 64, /dev/ttyS1 gets minor 65, etc.

maintainer
#22 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Sat, 13 Sep 2008 20:04:27 +0200

Quoted 9 lines · Josip Rodin
Quoted 1 line

After being put into the v240, they reliably stop working :/

Errrr, in another round of sparcs screwing with my mind :) I have almost accidentally gotten one combination to work - I plugged both ends of the cable into the Oxford card, and established communication between ttyS2 and ttyS3.

That can't be right...

That's perfectly correct, the first PCI card will get ttyS2 and ttyS3.

Quoted 3 lines

Then I tried to experiment with plugging both ends of the cable into the (physical) Timedia card, and connecting minicoms via ttyS0 and ttyS1 - but that did not work.

Of course it won't work, ttyS0 and ttyS1 are the sunsu ports.

Try using ttyS4 and ttyS5 to get at the Timedia card.

maintainer
#23 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Sat, 13 Sep 2008 19:49:45 +0200

Quoted 6 lines

PCI: Enabling device: (0001:00:03.0), cmd 81 0001:00:03.0: ttyS2 at I/O 0x10009a0 (irq = 20) is a 16550A 0001:00:03.0: ttyS3 at I/O 0x10009a8 (irq = 20) is a 16550A
PCI: Enabling device: (0001:00:02.0), cmd 3 0001:00:02.0: ttyS0 at I/O 0x1000930 (irq = 19) is a 16C950/954 0001:00:02.0: ttyS1 at I/O 0x1000938 (irq = 19) is a 16C950/954

I see what's happening, uart_report_port() assumes a direct relationship between port->line and the ttyXXX device indexes. But that isn't true in situations where the device major's minor number space is shared between differnt drivers.

The reporting is just wrong, these devices are using ttyS2, ttyS3, ttyS4, and ttyS5.

This patch should fix most cases.

drivers/serial/8250.c +15 -7
index dac80fd..7c35354 100644
@@ -57,6 +57,13 @@ static unsigned int share_irqs = SERIAL8250_SHARE_IRQS;
 
 static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS;
 
+static struct uart_driver serial8250_reg;
+
+static int serial_index(struct uart_port *port)
+{
+	return (serial8250_reg.minor - 64) + port->line;
+}
+
 /*
  * Debugging.
  */
@@ -997,7 +1004,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
 		return;
 
 	DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04x, 0x%p): ",
-			up->port.line, up->port.iobase, up->port.membase);
+		       serial_index(&up->port), up->port.iobase, up->port.membase);
 
 	/*
 	 * We really do need global IRQs disabled here - we're going to
@@ -1132,8 +1139,8 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
 	if (up->capabilities != uart_config[up->port.type].flags) {
 		printk(KERN_WARNING
 		       "ttyS%d: detected caps %08x should be %08x\n",
-			up->port.line, up->capabilities,
-			uart_config[up->port.type].flags);
+		       serial_index(&up->port), up->capabilities,
+		       uart_config[up->port.type].flags);
 	}
 
 	up->port.fifosize = uart_config[up->port.type].fifo_size;
@@ -1858,7 +1865,8 @@ static int serial8250_startup(struct uart_port *port)
 	 */
 	if (!(up->port.flags & UPF_BUGGY_UART) &&
 	    (serial_inp(up, UART_LSR) = 0xff)) {
-		printk("ttyS%d: LSR safety check engaged!\n", up->port.line);
+		printk("ttyS%d: LSR safety check engaged!\n",
+		       serial_index(&up->port));
 		return -ENODEV;
 	}
 
@@ -1912,7 +1920,8 @@ static int serial8250_startup(struct uart_port *port)
 		 * kick the UART on a regular basis.
 		 */
 		if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) {
-			pr_debug("ttyS%d - using backup timer\n", port->line);
+			pr_debug("ttyS%d - using backup timer\n",
+				 serial_index(port));
 			up->timer.function = serial8250_backup_timeout;
 			up->timer.data = (unsigned long)up;
 			mod_timer(&up->timer, jiffies +
@@ -1965,7 +1974,7 @@ static int serial8250_startup(struct uart_port *port)
 		if (!(up->bugs & UART_BUG_TXEN)) {
 			up->bugs |= UART_BUG_TXEN;
 			pr_debug("ttyS%d - enabling bad tx status workarounds\n",
-				 port->line);
+				 serial_index(port));
 		}
 	} else {
 		up->bugs &= ~UART_BUG_TXEN;
@@ -2626,7 +2635,6 @@ static int serial8250_console_early_setup(void)
 	return serial8250_find_port_for_earlycon();
 }
 
-static struct uart_driver serial8250_reg;
 static struct console serial8250_console = {
 	.name		= "ttyS",
 	.write		= serial8250_console_write,
drivers/serial/serial_core.c +5 -2
index f977c98..760a0ec 100644
@@ -2051,7 +2051,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
 					"transmitter\n",
 			       port->dev ? port->dev->bus_id : "",
 			       port->dev ? ": " : "",
-			       drv->dev_name, port->line);
+			       drv->dev_name,
+			       drv->tty_driver->name_base + port->line);
 
 		ops->shutdown(port);
 	}
@@ -2177,7 +2178,9 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port)
 	printk(KERN_INFO "%s%s%s%d at %s (irq = %d) is a %s\n",
 	       port->dev ? port->dev->bus_id : "",
 	       port->dev ? ": " : "",
-	       drv->dev_name, port->line, address, port->irq, uart_type(port));
+	       drv->dev_name,
+	       drv->tty_driver->name_base + port->line,
+	       address, port->irq, uart_type(port));
 }
 
 static void
#24 lore raw
In reply to Josip Rodin
Quoted 3 lines · David Miller

Those indexes "0", "1", etc. are within the namespace of the device type itself. It does not determine which ttyS? device index these things gets hooked up to. [...]

OK, I was hoping for that, but it didn't seem to be that way in practice.

Quoted 7 lines

You probably have something that looks like:

sunsu                /dev/ttyS       4 64-65 serial
serial               /dev/ttyS       4 66-69 serial

which would match up with my predictions above. /dev/ttyS0 uses device minor 64, /dev/ttyS1 gets minor 65, etc.

Yes, you're right, /proc/tty/drivers does say that.

Signature · 1 line
     2. That which causes joy or happiness.
#25 lore raw
In reply to Josip Rodin
Quoted 12 lines · David Miller
Quoted 6 lines

PCI: Enabling device: (0001:00:03.0), cmd 81 0001:00:03.0: ttyS2 at I/O 0x10009a0 (irq = 20) is a 16550A 0001:00:03.0: ttyS3 at I/O 0x10009a8 (irq = 20) is a 16550A
PCI: Enabling device: (0001:00:02.0), cmd 3 0001:00:02.0: ttyS0 at I/O 0x1000930 (irq = 19) is a 16C950/954 0001:00:02.0: ttyS1 at I/O 0x1000938 (irq = 19) is a 16C950/954

I see what's happening, uart_report_port() assumes a direct relationship between port->line and the ttyXXX device indexes. But that isn't true in situations where the device major's minor number space is shared between differnt drivers.

Quoted 4 lines

The reporting is just wrong, these devices are using ttyS2, ttyS3, ttyS4, and ttyS5.

This patch should fix most cases.

Phew :) I'll rebuild the kernel with the patch shortly. Thanks!

I do wonder, however, why did sunsu register two ports, when there is no matching hardware... or maybe there is a chip that provides it, but there are no physical ports.

(I'll go set CONFIG_SERIAL_SUNSU=m rather than =y.)

Signature · 1 line
     2. That which causes joy or happiness.
#26 lore raw
In reply to Josip Rodin

Review uart_report_port(struct uart_driver *drv, struct uart_port *port) · line 2186

Quoted 11 lines · David Miller
(quoted diff) +3 -1
@@ -2177,7 +2178,9 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port)
 	printk(KERN_INFO "%s%s%s%d at %s (irq = %d) is a %s\n",
 	       port->dev ? port->dev->bus_id : "",
 	       port->dev ? ": " : "",
-	       drv->dev_name, port->line, address, port->irq, uart_type(port));
+	       drv->dev_name,
+	       drv->tty_driver->name_base + port->line,
+	       address, port->irq, uart_type(port));
 }
 
 static void

BTW, while we're at it - since the data type of uart_port->iobase is larger now, the two snprintf()'s which print it out started complaining:

drivers/serial/serial_core.c: In function 'uart_report_port':
drivers/serial/serial_core.c:2159: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long unsigned int' drivers/serial/serial_core.c:2159: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long unsigned int' drivers/serial/serial_core.c:2163: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long unsigned int' drivers/serial/serial_core.c:2163: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long unsigned int'

After the following trivial patch it goes quiet:

serial/serial_core.c renamed from serial/serial_core.c~ +2 -2
@@ -2156,11 +2156,11 @@
 	switch (port->iotype) {
 	case UPIO_PORT:
 		snprintf(address, sizeof(address),
-			 "I/O 0x%x", port->iobase);
+			 "I/O 0x%lx", port->iobase);
 		break;
 	case UPIO_HUB6:
 		snprintf(address, sizeof(address),
-			 "I/O 0x%x offset 0x%x", port->iobase, port->hub6);
+			 "I/O 0x%lx offset 0x%x", port->iobase, port->hub6);
 		break;
 	case UPIO_MEM:
 	case UPIO_MEM32:
Signature · 1 line
     2. That which causes joy or happiness.
#27 lore raw
In reply to Josip Rodin
Quoted 7 lines · Josip Rodin

Phew :) I'll rebuild the kernel with the patch shortly. Thanks!

I do wonder, however, why did sunsu register two ports, when there is no matching hardware... or maybe there is a chip that provides it, but there are no physical ports.

(I'll go set CONFIG_SERIAL_SUNSU=m rather than =y.)

OK, that didn't work out so well :)

Turns out udev selects 8250 before sunsu, if they are on level terms upon boot, and that doesn't play too well with my preset getty settings, meaning the machine sends semi-random data to the wrong ports, where the Fire 280R happens to be listening and automatically reacts by effectively doing Stop-A, and obviously badness ensues.

And the ALOM serial console also started misbehaving without sunsu in the kernel image. It would show everything nicely up to the console handover, then it would scroll to the top of the screen and proceed to write spaces throughout the screen two times[1], but then it started printing a bunch of output all on one line, as if it skipped all the line-breaks. Eventually it would come to the point where there's a pause for the detection of SCSI disks, and then the output would continue normally with line-breaks.

So I just reverted that change and put sunsu back into the kernel image. The serial device-related dmesg output is now:

[...]
f00989ec: ttyS0 at MMIO 0x7fe010003f8 (irq = 15) is a 16550A
Console: ttyS0 (SU)
console [ttyS0] enabled
f009a454: ttyS1 at MMIO 0x7fe010002e8 (irq = 15) is a 16550A [...]
pci 0001:00:02.0: supports D2
pci 0001:00:02.0: PME# supported from D0 D2 D3hot
pci 0001:00:02.0: PME# disabled
[...]
PCI: Enabling device: (0001:00:02.0), cmd 3
ttyS2: detected caps 00000700 should be 00000100 0001:00:02.0: ttyS2 at I/O 0x7fe01000930 (irq = 19) is a 16C950/954
ttyS3: detected caps 00000700 should be 00000100 0001:00:02.0: ttyS3 at I/O 0x7fe01000938 (irq = 19) is a 16C950/954
PCI: Enabling device: (0001:00:03.0), cmd 81 0001:00:03.0: ttyS4 at I/O 0x7fe010009a0 (irq = 20) is a 16550A 0001:00:03.0: ttyS5 at I/O 0x7fe010009a8 (irq = 20) is a 16550A

I have a getty from Fire 280R on this machine's ttyS2 and that's great.

Thanks again, and sorry for all this rambling.

[1] It always does that, although I don't quite see why... it could be related to the fact that it wants 34 lines whereas my terminals usually have just 24 lines. Also, on a normal boot (with sunsu on ttyS0 enabled from the start), I seem to be seeing numerous early boot messages printed twice. But that's much better than not seeing them at all, so this is not a complaint :)

Signature · 1 line
     2. That which causes joy or happiness.
maintainer
#28 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Sun, 14 Sep 2008 13:12:40 +0200

Quoted 16 lines · David Miller

Review uart_report_port(struct uart_driver *drv, struct uart_port *port) · line 2186

Quoted 11 lines
(quoted diff) +3 -1
@@ -2177,7 +2178,9 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port)
 	printk(KERN_INFO "%s%s%s%d at %s (irq = %d) is a %s\n",
 	       port->dev ? port->dev->bus_id : "",
 	       port->dev ? ": " : "",
-	       drv->dev_name, port->line, address, port->irq, uart_type(port));
+	       drv->dev_name,
+	       drv->tty_driver->name_base + port->line,
+	       address, port->irq, uart_type(port));
 }
 
 static void

BTW, while we're at it - since the data type of uart_port->iobase is larger now, the two snprintf()'s which print it out started complaining:

Quoted 7 lines

drivers/serial/serial_core.c: In function 'uart_report_port':
drivers/serial/serial_core.c:2159: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long unsigned int' drivers/serial/serial_core.c:2159: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long unsigned int' drivers/serial/serial_core.c:2163: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long unsigned int' drivers/serial/serial_core.c:2163: warning: format '%x' expects type 'unsigned int', but argument 4 has type 'long unsigned int'

After the following trivial patch it goes quiet:

I already have that patch in my tree, but thanks anyways :)

maintainer
#29 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Sun, 14 Sep 2008 13:01:16 +0200

Quoted 3 lines

I do wonder, however, why did sunsu register two ports, when there is no matching hardware... or maybe there is a chip that provides it, but there are no physical ports.

The chips are there on the motherboard, just not hooked up to anything.

Look at /usr/bin/prtconf -pv output, they are there, and those device nodes are what make the device attach.