Oops on 2.6.1-rc1 serial access
Quoted 3 lines · David Dillow
The oops occurs when running the command without arguments, which causes it to scan for available ports. According to the attached strace output, it dies opening ttyS2 -- both ttyS0 & ttyS1 are ok.
Sunzilog was telling the serial core that we were going to register 4 ports, but then only registered 2. Serial core was calling uart_close() on ports that had never been set up (ttyS2 & ttyS3), therefore the illegal access.
The attached patch teaches Sunzilog to not count ports attached to a keyboard or mouse when registering with serial_core. With this patch, I no longer get an oops when opening the problem ports.
There's probably a simpler way (like, oh, subtracting 2 from NUM_CHANNELS), but this way doesn't care how many keyboard/mice ports are there, as long as they are marked.
Dave
drivers/serial/sunzilog.c renamed from drivers/serial/sunzilog.c.orig +16 -5
@@ -1631,6 +1631,8 @@ {struct zs_probe_scan scan;int ret; +int uart_count; +int i;printk (KERN_DEBUG "SunZilog: %d chips.\n" ,NUM_SUNZILOG );
@@ -1650,18 +1652,27 @@sunzilog_init_hw ();/* We can only init this once we have probed the Zilogs -* in the system. +* in the system. Do not count channels assigned to keyboards +* or mice when we are deciding how many ports to register. */ - sunzilog_reg.nr =NUM_CHANNELS ; + uart_count =0 ; +for (i =0 ; i <NUM_CHANNELS ; i++) { +struct uart_sunzilog_port *up = &sunzilog_port_table[i]; + +if (ZS_IS_KEYB (up) ||ZS_IS_MOUSE (up)) +continue ; + + uart_count++; + } + + sunzilog_reg.nr = uart_count; sunzilog_reg.cons =SUNZILOG_CONSOLE ; sunzilog_reg.minor = sunserial_current_minor; - sunserial_current_minor +=NUM_CHANNELS ; + sunserial_current_minor += uart_count; ret =uart_register_driver (&sunzilog_reg);if (ret ==0 ) { -int i; -for (i =0 ; i <NUM_CHANNELS ; i++) {struct uart_sunzilog_port *up = &sunzilog_port_table[i];
Quoted 8 lines · On 04 Jan 2004 01:38:07 -0500 David Dillow <[email protected]> wrote:
Sunzilog was telling the serial core that we were going to register 4 ports, but then only registered 2. Serial core was calling
uart_close()on ports that had never been set up (ttyS2 & ttyS3), therefore the illegal access.The attached patch teaches Sunzilog to not count ports attached to a keyboard or mouse when registering with
serial_core. With this patch, I no longer get an oops when opening the problem ports.
Looks great, patch applied.
Thanks David.