lkml.org 
[lkml]   [2001]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRocketport device driver for 2.4.3
Date
I am working on a VA Linux server machine model 2240 which came with a 
RocketPort serial device.

The first issue is that it doesn't have support for devfs. I have attached a
patch to fix this that I believe to be good (I've done the same thing for
Stallion and Lucent WinModem drivers - it's not overly challenging).

The next problem is that accessing a port number that is greater than the
maximum that the RockerPort PCI card supports (apparently 32 ports for my
card) gives a kernel oops. I have attached the output of ksymoops to this
message.
The command that triggered this Oops was:
setserial /dev/ttr/99


diff -ru old-linux/drivers/char/rocket.c patched-linux/drivers/char/rocket.c
--- old-linux/drivers/char/rocket.c Sat Mar 31 09:50:44 2001
+++ patched-linux/drivers/char/rocket.c Fri Apr 20 12:38:51 2001
@@ -94,7 +94,15 @@
#undef ROCKET_DEBUG_WAIT_UNTIL_SENT
#undef ROCKET_DEBUG_RECEIVE
#undef ROCKET_DEBUG_HANGUP
-
+
+#ifdef CONFIG_DEVFS_FS
+#define TTR_DEVICE "ttr/%d"
+#define DEVICE_NAME TTR_DEVICE
+#else
+#define TTR_DEVICE "ttyR%d"
+#define DEVICE_NAME "ttyR"
+#endif
+

/* CAUTION!!!!! The TIME_STAT Function relies on the Pentium 64 bit
* register. For various reasons related to 1.2.13, the test for this
@@ -449,7 +457,7 @@
if (IntMask & DELTA_CD) { /* CD change */
#if (defined(ROCKET_DEBUG_OPEN) || defined(ROCKET_DEBUG_INTR) || \
defined(ROCKET_DEBUG_HANGUP))
- printk("ttyR%d CD now %s...", info->line,
+ printk(TTR_DEVICE " CD now %s...", info->line,
(ChanStatus & CD_ACT) ? "on" : "off");
#endif
if (!(ChanStatus & CD_ACT) &&
@@ -836,7 +844,7 @@
retval = 0;
add_wait_queue(&info->open_wait, &wait);
#ifdef ROCKET_DEBUG_OPEN
- printk("block_til_ready before block: ttyR%d, count = %d\n",
+ printk("block_til_ready before block: " TTR_DEVICE ", count = %d\n",
info->line, info->count);
#endif
save_flags(flags); cli();
@@ -871,7 +879,7 @@
break;
}
#ifdef ROCKET_DEBUG_OPEN
- printk("block_til_ready blocking: ttyR%d, count = %d, flags=0x%0x\n",
+ printk("block_til_ready blocking: " TTR_DEVICE ", count = %d,
flags=0x%0x\n",
info->line, info->count, info->flags);
#endif
schedule();
@@ -884,7 +892,7 @@
restore_flags(flags);
info->blocked_open--;
#ifdef ROCKET_DEBUG_OPEN
- printk("block_til_ready after blocking: ttyR%d, count = %d\n",
+ printk("block_til_ready after blocking: " TTR_DEVICE ", count = %d\n",
info->line, info->count);
#endif
if (retval)
@@ -964,7 +972,7 @@
#endif
}
#ifdef ROCKET_DEBUG_OPEN
- printk("rp_open ttyR%d, count=%d\n", info->line, info->count);
+ printk("rp_open " TTR_DEVICE ", count=%d\n", info->line, info->count);
#endif
/*
* Info->count is now 1; so it's safe to sleep now.
@@ -1050,7 +1058,7 @@
return;

#ifdef ROCKET_DEBUG_OPEN
- printk("rp_close ttyR%d, count = %d\n", info->line, info->count);
+ printk("rp_close " TTR_DEVICE ", count = %d\n", info->line, info->count);
#endif

save_flags(flags); cli();
@@ -1072,7 +1080,7 @@
info->count = 1;
}
if (--info->count < 0) {
- printk("rp_close: bad serial port count for ttyR%d: %d\n",
+ printk("rp_close: bad serial port count for " TTR_DEVICE ": %d\n",
info->line, info->count);
info->count = 0;
}
@@ -1166,7 +1174,7 @@
restore_flags(flags);

#ifdef ROCKET_DEBUG_OPEN
- printk("rp_close ttyR%d complete shutdown\n", info->line);
+ printk("rp_close " TTR_DEVICE " complete shutdown\n", info->line);
#endif

}
@@ -1646,7 +1654,7 @@
return;

#if (defined(ROCKET_DEBUG_OPEN) || defined(ROCKET_DEBUG_HANGUP))
- printk("rp_hangup of ttyR%d...", info->line);
+ printk("rp_hangup of " TTR_DEVICE "...", info->line);
#endif
/*
* If the port is in the process of being closed, just force
@@ -2193,7 +2201,7 @@
*/
memset(&rocket_driver, 0, sizeof(struct tty_driver));
rocket_driver.magic = TTY_DRIVER_MAGIC;
- rocket_driver.name = "ttyR";
+ rocket_driver.name = DEVICE_NAME;
rocket_driver.major = TTY_ROCKET_MAJOR;
rocket_driver.minor_start = 0;
rocket_driver.num = MAX_RP_PORTS;
@@ -2235,7 +2243,11 @@
* the minor number and the subtype code.
*/
callout_driver = rocket_driver;
+#ifdef CONFIG_DEVFS_FS
+ callout_driver.name = "cur/%d";
+#else
callout_driver.name = "cur";
+#endif
callout_driver.major = CUA_ROCKET_MAJOR;
callout_driver.minor_start = 0;
callout_driver.subtype = SERIAL_TYPE_CALLOUT;

--
http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/ Postal SMTP/POP benchmark
http://www.coker.com.au/projects.html Projects I am working on
http://www.coker.com.au/~russell/ My home page
Unable to handle kernel NULL pointer dereference at virtual address 0000000b
c8868e1c
*pde = 00000000
Oops: 0000
CPU: 0
EIP: 0010:[<c8868e1c>]
Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00010286
eax: 0000018c ebx: c70b0000 ecx: 00000000 edx: c886c800
esi: 00000063 edi: c7039744 ebp: c7040000 esp: c7155eb0
ds: 0018 es: 0018 ss: 0018
Process setserial (pid: 283, stackpage=c7155000)
Stack: 00000000 00000000 c7039744 c706b600 00000000 c016d73b c7040000 c7183aa0
c7039740 ffffffed c7039744 c706b600 c7fd89d0 08028009 c7040000 c70a40c0
00000000 c01453c9 c70a40c0 c0258c18 c706cae0 00000000 c013db59 c70a40c0
Call Trace: [<c016d73b>] [<c01453c9>] [<c013db59>] [<c013cfd7>] [<c015a460>] [<c0131f31>] [<c0131e6a>]
[<c0132184>] [<c0106f4b>]
Code: f6 41 0b 40 74 1e 89 c8 05 60 01 00 00 e8 ce ad 8a f7 31 d2

>>EIP; c8868e1c <[rocket]rp_open+90/3d4> <=====
Trace; c016d73b <tty_open+1db/34c>
Trace; c01453c9 <dput+19/164>
Trace; c013db59 <path_walk+7dd/8a4>
Trace; c013cfd7 <permission+8b/94>
Trace; c015a460 <devfs_open+f4/1f4>
Trace; c0131f31 <dentry_open+bd/14c>
Trace; c0131e6a <filp_open+52/5c>
Trace; c0132184 <sys_open+3c/f0>
Trace; c0106f4b <system_call+33/38>
Code; c8868e1c <[rocket]rp_open+90/3d4>
00000000 <_EIP>:
Code; c8868e1c <[rocket]rp_open+90/3d4> <=====
0: f6 41 0b 40 testb $0x40,0xb(%ecx) <=====
Code; c8868e20 <[rocket]rp_open+94/3d4>
4: 74 1e je 24 <_EIP+0x24> c8868e40 <[rocket]rp_open+b4/3d4>
Code; c8868e22 <[rocket]rp_open+96/3d4>
6: 89 c8 mov %ecx,%eax
Code; c8868e24 <[rocket]rp_open+98/3d4>
8: 05 60 01 00 00 add $0x160,%eax
Code; c8868e29 <[rocket]rp_open+9d/3d4>
d: e8 ce ad 8a f7 call f78aade0 <_EIP+0xf78aade0> c0113bfc <interruptible_sleep_on+0/6c>
Code; c8868e2e <[rocket]rp_open+a2/3d4>
12: 31 d2 xor %edx,%edx


2 warnings issued. Results may not be reliable.
\
 
 \ /
  Last update: 2005-03-22 13:27    [W:0.026 / U:1.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site