2001-04-20 13:05:51

by Russell Coker

[permalink] [raw]
Subject: Rocketport device driver for 2.4.3

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


Attachments:
rocket.oops (1.96 kB)
rocket.oops