VERSION = 1
PATCHLEVEL = 3
-SUBLEVEL = 14
+SUBLEVEL = 15
ARCH = i386
@@ -225,8+225,7 @@ bool 'Second extended fs support' CONFIG_EXT2_FS y bool 'xiafs filesystem support' CONFIG_XIA_FS n
bool 'msdos fs support' CONFIG_MSDOS_FS y
if [ "$CONFIG_MSDOS_FS" = "y" ]; then
-#bool 'umsdos: Unix like fs on top of std MSDOS FAT fs' CONFIG_UMSDOS_FS n
-comment 'Umsdos is not supported in 1.3.0: wait for 1.3.1'
+bool 'umsdos: Unix like fs on top of std MSDOS FAT fs' CONFIG_UMSDOS_FS n
fi
bool '/proc filesystem support' CONFIG_PROC_FS y
if [ "$CONFIG_INET" = "y" ]; then
@@ -76,7+76,7 @@ short intel_short(short l) return t.s[0];
}
-void die(char * str)
+void die(const char * str)
{
fprintf(stderr,"%s\n",str);
exit(1);
@@ -180,7+180,7 @@ if [ "$CONFIG_NET_ISA" = "y" ]; then fi
bool 'HP PCLAN+ (27247B and 27252A) support' CONFIG_HPLAN_PLUS n
bool 'HP PCLAN (27245 and other 27xxx series) support' CONFIG_HPLAN n
- bool 'HP 10/100VG PCLAN (257X series) support' CONFIG_HP100 y
+ bool 'HP 10/100VG PCLAN (ISA, EISA, PCI) support' CONFIG_HP100 y
bool 'NE2000/NE1000 support' CONFIG_NE2000 y
bool 'SK_G16 support' CONFIG_SK_G16 n
fi
@@ -363,7+363,7 @@ int pcibios_write_config_dword (unsigned char bus, return (int) (ret & 0xff00) >> 8;
}
-char *pcibios_strerror (int error)
+const char *pcibios_strerror (int error)
{
static char buf[80];
@@ -103,7+103,7 @@ void setup_arch(char **cmdline_p, init_task.mm->brk = TASK_SIZE + (unsigned long) &_end;
for (;;) {
- if (c == ' ' && *(unsigned long *)from == *(unsigned long *)"mem=") {
+ if (c == ' ' && *(const unsigned long *)from == *(const unsigned long *)"mem=") {
memory_end = simple_strtoul(from+4, &from, 0);
if ( *from == 'K' || *from == 'k' ) {
memory_end = memory_end << 10;
@@ -136,7+136,7 @@ void setup_arch(char **cmdline_p,
int get_cpuinfo(char * buffer)
{
- char *model[2][9]={{"DX","SX","DX/2","4","SX/2","6",
+ static const char *model[2][9]={{"DX","SX","DX/2","4","SX/2","6",
"DX/2-WB","DX/4"},
{"Pentium 60/66","Pentium 90/100","3",
"4","5","6","7","8"}};
@@ -93,7+93,7 @@ int kstack_depth_to_print = 24; #define VMALLOC_OFFSET (8*1024*1024)
#define MODULE_RANGE (8*1024*1024)
-/*static*/ void die_if_kernel(char * str, struct pt_regs * regs, long err)
+/*static*/ void die_if_kernel(const char * str, struct pt_regs * regs, long err)
{
int i;
unsigned long esp;
* computes a partial checksum, e.g. for TCP/UDP fragments
*/
-unsigned int csum_partial(unsigned char * buff, int len, unsigned int sum) {
+unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) {
/*
* Experiments with ethernet and slip connections show that buff
* is aligned on either a 2-byte or 4-byte boundary. We get at
@@ -101,7+101,7 @@ unsigned int csum_partial(unsigned char * buff, int len, unsigned int sum) { * copy from fs while checksumming, otherwise like csum_partial
*/
-unsigned int csum_partial_copy_fromuser( char *src, char *dst,
+unsigned int csum_partial_copy_fromuser(const char *src, char *dst,
int len, int sum) {
__asm__("
testl $2, %%edi # Check alignment.
@@ -196,7+196,7 @@ unsigned int csum_partial_copy_fromuser( char *src, char *dst, * copy from ds while checksumming, otherwise like csum_partial
*/
-unsigned int csum_partial_copy( char *src, char *dst,
+unsigned int csum_partial_copy(const char *src, char *dst,
int len, int sum) {
__asm__("
testl $2, %%edi # Check alignment.
@@ -85,7+85,7 @@ void FPU_illegal(void) void emu_printall()
{
int i;
- static char *tag_desc[] = { "Valid", "Zero", "ERROR", "ERROR",
+ static const char *tag_desc[] = { "Valid", "Zero", "ERROR", "ERROR",
"DeNorm", "Inf", "NaN", "Empty" };
unsigned char byte1, FPU_modrm;
unsigned long address = FPU_ORIG_EIP;
@@ -212,7+212,7 @@ printk(" CW: ic=%d rc=%ld%ld pc=%ld%ld iem=%d ef=%d%d%d%d%d%d\n",
static struct {
int type;
- char *name;
+ const char *name;
} exception_names[] = {
{ EX_StackOver, "stack overflow" },
{ EX_StackUnder, "stack underflow" },
@@ -133,9+133,9 @@ extern unsigned char const data_sizes_16[32];
#define reg_move(x, y) { \
- *(short *)&((y)->sign) = *(short *)&((x)->sign); \
- *(long *)&((y)->exp) = *(long *)&((x)->exp); \
- *(long long *)&((y)->sigl) = *(long long *)&((x)->sigl); }
+ *(short *)&((y)->sign) = *(const short *)&((x)->sign); \
+ *(long *)&((y)->exp) = *(const long *)&((x)->exp); \
+ *(long long *)&((y)->sigl) = *(const long long *)&((x)->sigl); }
#define significand(x) ( ((unsigned long long *)&((x)->sigl))[0] )
#include <asm/segment.h>
#include <asm/pgtable.h>
-extern void die_if_kernel(char *,struct pt_regs *,long);
+extern void die_if_kernel(const char *,struct pt_regs *,long);
/*
* This routine handles page faults. It determines the address,
@@ -380,20+380,6 @@ disable_interrupts(void) outb(curr_control_reg, sony_cd_control_reg);
}
-static void
-cdu31a_interrupt(int irq, struct pt_regs *regs)
-{
- disable_interrupts();
- if (cdu31a_irq_wait != NULL)
- {
- wake_up(&cdu31a_irq_wait);
- }
- else
- {
- printk("CDU31A: Got an interrupt but nothing was waiting\n");
- }
-}
-
/*
* Wait a little while (used for polling the drive). If in initialization,
* setting a timeout doesn't work, so just loop for a while.
@@ -528,6+514,50 @@ write_cmd(unsigned char cmd) outb(cmd, sony_cd_cmd_reg);
}
+static void
+cdu31a_interrupt(int irq, struct pt_regs *regs)
+{
+ unsigned char val;
+
+ if (abort_read_started)
+ {
+ /* We might be waiting for an abort to finish. Don't
+ disable interrupts yet, though, because we handle
+ this one here. */
+ /* Clear out the result registers. */
+ while (is_result_reg_not_empty())
+ {
+ val = read_result_register();
+ }
+ clear_data_ready();
+ clear_result_ready();
+
+ /* Clear out the data */
+ while (is_data_requested())
+ {
+ val = read_data_register();
+ }
+ abort_read_started = 0;
+
+ /* If something was waiting, wake it up now. */
+ if (cdu31a_irq_wait != NULL)
+ {
+ disable_interrupts();
+ wake_up(&cdu31a_irq_wait);
+ }
+ }
+ else if (cdu31a_irq_wait != NULL)
+ {
+ disable_interrupts();
+ wake_up(&cdu31a_irq_wait);
+ }
+ else
+ {
+ disable_interrupts();
+ printk("CDU31A: Got an interrupt but nothing was waiting\n");
+ }
+}
+
/*
* Set the drive parameters so the drive will auto-spin-up when a
* disk is inserted.
@@ -2270,7+2300,7 @@ exit_read_audio: }
static int
-do_sony_cd_cmd_chk(char *name,
+do_sony_cd_cmd_chk(const char *name,
unsigned char cmd,
unsigned char *params,
unsigned int num_params,
@@ -2788,7+2818,7 @@ static struct file_operations scd_fops = {
/* The different types of disc loading mechanisms supported */
-static char *load_mech[] = { "caddy", "tray", "pop-up", "unknown" };
+static const char *load_mech[] = { "caddy", "tray", "pop-up", "unknown" };
static void
get_drive_configuration(unsigned short base_io,
@@ -1129,7+1129,7 @@ int probe_irq(int nr) { #define ERROR -EIO
static int cm206[2] = {0,0}; /* for compatible `insmod' parameter passing */
-void parse_options()
+void parse_options(void)
{
int i;
for (i=0; i<2; i++) {
@@ -311,7+311,7 @@ static int inr; /* size of reply buffer, when called from interrupt */ */
static struct {
struct floppy_drive_params params;
- char *name; /* name printed while booting */
+ const char *name; /* name printed while booting */
} default_drive_params[]= {
/* NOTE: the time values in jiffies should be in msec!
CMOS drive type
@@ -545,7+545,7 @@ static inline void set_debugt(void) #endif
}
-static inline void debugt(char *message)
+static inline void debugt(const char *message)
{
#ifdef DEBUGT
if ( DP->flags & DEBUGT )
@@ -557,10+557,10 @@ typedef void (*timeout_fn)(unsigned long); static struct timer_list fd_timeout ={ NULL, NULL, 0, 0,
(timeout_fn) floppy_shutdown };
-static char *timeout_message;
+static const char *timeout_message;
#ifdef CONFIG_FLOPPY_SANITY
-static void is_alive(char *message)
+static void is_alive(const char *message)
{
/* this routine checks whether the floppy driver is "alive" */
if (fdc_busy && command_status < 2 && !fd_timeout.prev){
@@ -593,7+593,7 @@ static int output_log_pos=0;
-static void reschedule_timeout(int drive, char *message, int marg)
+static void reschedule_timeout(int drive, const char *message, int marg)
{
if (drive == CURRENTD )
drive = current_drive;
@@ -2801,7+2801,7 @@ static int fd_copyout(void *param, volatile void *address, int size) #define COPYOUT(x) (fd_copyout( (void *)param, &(x), sizeof(x)))
#define COPYIN(x) (memcpy_fromfs( &(x), (void *) param, sizeof(x)),0)
-static char *drive_name(int type, int drive )
+static const char *drive_name(int type, int drive )
{
struct floppy_struct *floppy;
@@ -2924,7+2924,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, struct format_descr tmp_format_req;
int i,device,drive,type,cnt;
struct floppy_struct *this_floppy;
- char *name;
+ const char *name;
device = inode->i_rdev;
switch (cmd) {
@@ -3151,7+3151,7 @@ static int floppy_read(struct inode * inode, struct file * filp, }
static int floppy_write(struct inode * inode, struct file * filp,
- char * buf, int count)
+ const char * buf, int count)
{
int block;
int ret;
@@ -3523,7+3523,7 @@ static void set_cmos(int *ints, int dummy) }
static struct param_table {
- char *name;
+ const char *name;
void (*fn)(int *ints, int param);
int def_param;
} config_params[]={
@@ -134,7+134,7 @@ read_mbr: * Check for Disk Manager v6.0x with geometry translation
*/
if (!tested_for_dm6++) { /* only check for DM6 *once* */
- extern int ide_xlate_1024(dev_t, int, char *);
+ extern int ide_xlate_1024(dev_t, int, const char *);
/* check for DM6 with Dynamic Drive Overlay (DDO) */
if (p->sys_ind == DM6_PARTITION) {
/*
@@ -2178,7+2178,7 @@ void hdd_setup(char *str, int *ints) ide_setup (str, ints);
}
-int ide_xlate_1024 (dev_t full_dev, int need_offset, char *msg)
+int ide_xlate_1024 (dev_t full_dev, int need_offset, const char *msg)
{
ide_dev_t *dev;
byte head_vals[] = {4, 8, 16, 32, 64, 128, 255, 0}, *heads = head_vals;
@@ -494,24+494,24 @@ static struct cdrom_multisession ms_info; static unsigned char msgnum=0;
static char msgbuf[80];
-static char *str_sb = "SoundBlaster";
-static char *str_sb_l = "soundblaster";
-static char *str_lm = "LaserMate";
-static char *str_sp = "SPEA";
-static char *str_sp_l = "spea";
-char *type;
+static const char *str_sb = "SoundBlaster";
+static const char *str_sb_l = "soundblaster";
+static const char *str_lm = "LaserMate";
+static const char *str_sp = "SPEA";
+static const char *str_sp_l = "spea";
+const char *type;
#if !(SBPCD_ISSUE-1)
-static char *major_name="sbpcd";
+static const char *major_name="sbpcd";
#endif
#if !(SBPCD_ISSUE-2)
-static char *major_name="sbpcd2";
+static const char *major_name="sbpcd2";
#endif
#if !(SBPCD_ISSUE-3)
-static char *major_name="sbpcd3";
+static const char *major_name="sbpcd3";
#endif
#if !(SBPCD_ISSUE-4)
-static char *major_name="sbpcd4";
+static const char *major_name="sbpcd4";
#endif
/*==========================================================================*/
@@ -691,7+691,7 @@ static struct timer_list audio_timer = { NULL, NULL, 0, 0, mark_timeout_audio}; /*
* DDI interface
*/
-static void msg(int level, char *fmt, ...)
+static void msg(int level, const char *fmt, ...)
{
char buf[256];
va_list args;
@@ -4983,7+4983,7 @@ static struct file_operations sbpcd_fops = #if (SBPCD_ISSUE-1)
static
#endif
-void sbpcd_setup(char *s, int *p)
+void sbpcd_setup(const char *s, int *p)
{
setup_done++;
msg(DBG_INI,"sbpcd_setup called with %04X,%s\n",p[1], s);
@@ -113,7+113,7 @@ static int open_mouse(struct inode * inode, struct file * file) }
-static int write_mouse(struct inode * inode, struct file * file, char * buffer, int count)
+static int write_mouse(struct inode * inode, struct file * file, const char * buffer, int count)
{
return -EINVAL;
}
@@ -124,7+124,7 @@ static int open_mouse(struct inode * inode, struct file * file) * writes are disallowed
*/
-static int write_mouse(struct inode * inode, struct file * file, char * buffer, int count)
+static int write_mouse(struct inode * inode, struct file * file, const char * buffer, int count)
{
return -EINVAL;
}
@@ -1006,7+1006,7 @@ static void csi_m(int currcons) update_attr(currcons);
}
-static void respond_string(char * p, struct tty_struct * tty)
+static void respond_string(const char * p, struct tty_struct * tty)
{
while (*p) {
tty_insert_flip_char(tty, *p, 0);
@@ -1409,7+1409,7 @@ static void con_start(struct tty_struct *tty) }
static int con_write(struct tty_struct * tty, int from_user,
- unsigned char *buf, int count)
+ const unsigned char *buf, int count)
{
int c, tc, ok, n = 0;
unsigned int currcons;
@@ -1991,7+1991,7 @@ static void con_setsize(unsigned long rows, unsigned long cols) */
long con_init(long kmem_start)
{
- char *display_desc = "????";
+ const char *display_desc = "????";
int currcons = 0;
int orig_x = ORIG_X;
int orig_y = ORIG_Y;
@@ -1561,7+1561,7 @@ cy_flush_chars(struct tty_struct *tty) */
static int
cy_write(struct tty_struct * tty, int from_user,
- unsigned char *buf, int count)
+ const unsigned char *buf, int count)
{
struct cyclades_port *info = (struct cyclades_port *)tty->driver_data;
unsigned long flags;
@@ -856,8+856,8 @@ static void do_fn(unsigned char value, char up_flag)
static void do_pad(unsigned char value, char up_flag)
{
- static char *pad_chars = "0123456789+-*/\015,.?";
- static char *app_map = "pqrstuvwxylSRQMnn?";
+ static const char *pad_chars = "0123456789+-*/\015,.?";
+ static const char *app_map = "pqrstuvwxylSRQMnn?";
if (up_flag)
return; /* no action, if this is a key release */
@@ -913,7+913,7 @@ static void do_pad(unsigned char value, char up_flag)
static void do_cur(unsigned char value, char up_flag)
{
- static char *cur_chars = "BDCA";
+ static const char *cur_chars = "BDCA";
if (up_flag)
return;
@@ -157,7+157,7 @@ static void lp_interrupt(int irq, struct pt_regs *regs) wake_up(&lp->lp_wait_q);
}
-static int lp_write_interrupt(struct inode * inode, struct file * file, char * buf, int count)
+static int lp_write_interrupt(struct inode * inode, struct file * file, const char * buf, int count)
{
unsigned int minor = MINOR(inode->i_rdev);
unsigned long copy_size;
@@ -223,11+223,12 @@ static int lp_write_interrupt(struct inode * inode, struct file * file, char * b }
static int lp_write_polled(struct inode * inode, struct file * file,
- char * buf, int count)
+ const char * buf, int count)
{
int retval;
unsigned int minor = MINOR(inode->i_rdev);
- char c, *temp = buf;
+ char c;
+ const char *temp = buf;
#ifdef LP_DEBUG
if (jiffies-lp_last_call > LP_TIME(minor)) {
@@ -296,7+297,7 @@ static int lp_write_polled(struct inode * inode, struct file * file, return temp-buf;
}
-static int lp_write(struct inode * inode, struct file * file, char * buf, int count)
+static int lp_write(struct inode * inode, struct file * file, const char * buf, int count)
{
if (LP_IRQ(MINOR(inode->i_rdev)))
return lp_write_interrupt(inode, file, buf, count);
@@ -30,7+30,7 @@ static int read_ram(struct inode * inode, struct file * file,char * buf, int cou return -EIO;
}
-static int write_ram(struct inode * inode, struct file * file,char * buf, int count)
+static int write_ram(struct inode * inode, struct file * file, const char * buf, int count)
{
return -EIO;
}
@@ -60,7+60,7 @@ static int read_mem(struct inode * inode, struct file * file,char * buf, int cou return read;
}
-static int write_mem(struct inode * inode, struct file * file,char * buf, int count)
+static int write_mem(struct inode * inode, struct file * file,const char * buf, int count)
{
unsigned long p = file->f_pos;
int written;
@@ -134,10+134,10 @@ static int read_port(struct inode * inode,struct file * file,char * buf, int cou return tmp-buf;
}
-static int write_port(struct inode * inode,struct file * file,char * buf, int count)
+static int write_port(struct inode * inode,struct file * file,const char * buf, int count)
{
unsigned int i = file->f_pos;
- char * tmp = buf;
+ const char * tmp = buf;
while (count-- > 0 && i < 65536) {
outb(get_user(tmp),i);
@@ -153,7+153,7 @@ static int read_null(struct inode * node,struct file * file,char * buf,int count return 0;
}
-static int write_null(struct inode * inode,struct file * file,char * buf, int count)
+static int write_null(struct inode * inode,struct file * file, const char * buf, int count)
{
return count;
}
@@ -183,7+183,7 @@ static int read_full(struct inode * node,struct file * file,char * buf,int count return count;
}
-static int write_full(struct inode * inode,struct file * file,char * buf, int count)
+static int write_full(struct inode * inode,struct file * file, const char * buf, int count)
{
return -ENOSPC;
}
@@ -96,7+96,7 @@ static int open_mouse(struct inode * inode, struct file * file) }
-static int write_mouse(struct inode * inode, struct file * file, char * buffer, int count)
+static int write_mouse(struct inode * inode, struct file * file, const char * buffer, int count)
{
return -EINVAL;
}
@@ -525,10+525,10 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) put_tty_queue(c, tty);
}
-static void n_tty_receive_buf(struct tty_struct *tty, unsigned char *cp,
+static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
char *fp, int count)
{
- unsigned char *p;
+ const unsigned char *p;
char *f, flags = 0;
int i;
@@ -912,11+912,11 @@ do_it_again: }
static int write_chan(struct tty_struct * tty, struct file * file,
- unsigned char * buf, unsigned int nr)
+ const unsigned char * buf, unsigned int nr)
{
struct wait_queue wait = { current, NULL };
int c;
- unsigned char *b = buf;
+ const unsigned char *b = buf;
int retval = 0;
/* Job control check -- must be done at start (POSIX.1 7.1.1.4). */
@@ -372,7+372,7 @@ static int open_qp(struct inode * inode, struct file * file) * Write to the aux device.
*/
-static int write_aux(struct inode * inode, struct file * file, char * buffer, int count)
+static int write_aux(struct inode * inode, struct file * file, const char * buffer, int count)
{
int i = count;
@@ -394,7+394,7 @@ static int write_aux(struct inode * inode, struct file * file, char * buffer, in * Write to the 82C710 mouse device.
*/
-static int write_qp(struct inode * inode, struct file * file, char * buffer, int count)
+static int write_qp(struct inode * inode, struct file * file, const char * buffer, int count)
{
int i = count;
@@ -110,7+110,7 @@ static void pty_unthrottle(struct tty_struct * tty) }
static int pty_write(struct tty_struct * tty, int from_user,
- unsigned char *buf, int count)
+ const unsigned char *buf, int count)
{
struct tty_struct *to = tty->link;
int c=0, n, r;
@@ -98,7+98,7 @@ long scc_init(long kmem_start);
int scc_open(struct tty_struct *tty, struct file *filp);
static void scc_close(struct tty_struct *tty, struct file *filp);
-int scc_write(struct tty_struct *tty, int from_user, unsigned char *buf, int count);
+int scc_write(struct tty_struct *tty, int from_user, const unsigned char *buf, int count);
static void scc_put_char(struct tty_struct *tty, unsigned char ch);
static void scc_flush_chars(struct tty_struct *tty);
static int scc_write_room(struct tty_struct *tty);
@@ -1988,7+1988,7 @@ static inline void check_tx_queue(register struct scc_channel *scc) /* ----> tx routine: decode KISS data and scc_enqueue it <---- */
/* send raw frame to SCC. used for AX.25 */
-int scc_write(struct tty_struct *tty, int from_user, unsigned char *buf, int count)
+int scc_write(struct tty_struct *tty, int from_user, const unsigned char *buf, int count)
{
unsigned long flags;
static unsigned char *p;
@@ -1293,7+1293,7 @@ static void rs_flush_chars(struct tty_struct *tty) }
static int rs_write(struct tty_struct * tty, int from_user,
- unsigned char *buf, int count)
+ const unsigned char *buf, int count)
{
int c, total = 0;
struct async_struct *info = (struct async_struct *)tty->driver_data;
@@ -339,7+339,7 @@ static unsigned long buffaddr; /* aligned physical address of buffer */
/* This translates minor numbers to the corresponding recording format: */
-static char *format_names[] = {
+static const char *format_names[] = {
"not set", /* for dumb drives unable to handle format selection */
"11", /* extinct */
"24",
@@ -371,7+371,7 @@ static char *format_names[] = { */
static struct exception_list_type {
unsigned short mask, code;
- char *msg;
+ const char *msg;
/* EXC_nr attribute should match with tpqic02.h */
} exception_list[] = {
{0, 0,
@@ -424,7+424,7 @@ static struct exception_list_type {
-static void tpqputs(unsigned long flags, char *s)
+static void tpqputs(unsigned long flags, const char *s)
{
if ((flags & TPQD_ALWAYS) || (flags & QIC02_TAPE_DEBUG))
printk(TPQIC02_NAME ": %s\n", s);
@@ -2090,7+2090,7 @@ static int qic02_tape_read(struct inode * inode, struct file * filp, char * buf, * tape device again. The driver will detect an exception status in (No Cartridge)
* and force a rewind. After that tar may continue writing.
*/
-static int qic02_tape_write(struct inode * inode, struct file * filp, char * buf, int count)
+static int qic02_tape_write(struct inode * inode, struct file * filp, const char * buf, int count)
{
int error;
dev_t dev = inode->i_rdev;
@@ -2163,7+2163,7 @@ static int qic02_tape_write(struct inode * inode, struct file * filp, char * buf
/* copy from user to DMA buffer and initiate transfer. */
if (bytes_todo>0) {
- memcpy_fromfs( (void *) buffaddr, (void *) buf, bytes_todo);
+ memcpy_fromfs( (void *) buffaddr, (const void *) buf, bytes_todo);
/****************** similar problem with read() at FM could happen here at EOT.
******************/
@@ -2427,14+2427,6 @@ static int qic02_tape_open(struct inode * inode, struct file * filp) } /* qic02_tape_open */
-
-static int qic02_tape_readdir(struct inode * inode, struct file * filp, struct dirent * dp, int count)
-{
- return -ENOTDIR; /* not supported */
-} /* qic02_tape_readdir */
-
-
-
static void qic02_tape_release(struct inode * inode, struct file * filp)
{
dev_t dev = inode->i_rdev;
@@ -2791,7+2783,7 @@ static struct file_operations qic02_tape_fops = { qic02_tape_lseek, /* not allowed */
qic02_tape_read, /* read */
qic02_tape_write, /* write */
- qic02_tape_readdir, /* not allowed */
+ NULL, /* readdir not allowed */
NULL, /* select ??? */
qic02_tape_ioctl, /* ioctl */
NULL, /* mmap not allowed */
@@ -94,7+94,7 @@ struct wait_queue * keypress_wait = NULL; static void initialize_tty_struct(struct tty_struct *tty);
static int tty_read(struct inode *, struct file *, char *, int);
-static int tty_write(struct inode *, struct file *, char *, int);
+static int tty_write(struct inode *, struct file *, const char *, int);
static int tty_select(struct inode *, struct file *, int, select_table *);
static int tty_open(struct inode *, struct file *);
static void tty_release(struct inode *, struct file *);
@@ -292,7+292,7 @@ static int hung_up_tty_read(struct inode * inode, struct file * file, char * buf return 0;
}
-static int hung_up_tty_write(struct inode * inode, struct file * file, char * buf, int count)
+static int hung_up_tty_write(struct inode * inode, struct file * file, const char * buf, int count)
{
return -EIO;
}
@@ -720,7+720,7 @@ static int tty_read(struct inode * inode, struct file * file, char * buf, int co return i;
}
-static int tty_write(struct inode * inode, struct file * file, char * buf, int count)
+static int tty_write(struct inode * inode, struct file * file, const char * buf, int count)
{
int i, is_console;
struct tty_struct * tty;
@@ -748,7+748,7 @@ static int tty_write(struct inode * inode, struct file * file, char * buf, int c #endif
if (tty->ldisc.write)
/* XXX casts are for what kernel-wide prototypes should be. */
- i = (tty->ldisc.write)(tty,file,(unsigned char *)buf,(unsigned int)count);
+ i = (tty->ldisc.write)(tty,file,(const unsigned char *)buf,(unsigned int)count);
else
i = -EIO;
if (i > 0)
@@ -1681,7+1681,7 @@ int tty_unregister_driver(struct tty_driver *driver) int retval;
struct tty_driver *p;
int found = 0;
- char *othername = NULL;
+ const char *othername = NULL;
if (*driver->refcount)
return -EBUSY;
@@ -118,12+118,12 @@ vcs_read(struct inode *inode, struct file *file, char *buf, int count) }
static int
-vcs_write(struct inode *inode, struct file *file, char *buf, int count)
+vcs_write(struct inode *inode, struct file *file, const char *buf, int count)
{
unsigned long p = file->f_pos;
unsigned int cons = MINOR(inode->i_rdev);
int viewed, attr, size, written;
- char *buf0;
+ const char *buf0;
unsigned short *org;
attr = (cons & 128);
@@ -169,7+169,7 @@ vcs_write(struct inode *inode, struct file *file, char *buf, int count) org++;
}
while (count > 1) {
- scr_writew(get_user((unsigned short *) buf), org++);
+ scr_writew(get_user((const unsigned short *) buf), org++);
buf += 2;
count -= 2;
}
@@ -424,7+424,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
if (!perm)
return -EPERM;
- i = verify_area(VERIFY_READ, (void *)a, sizeof(struct kbentry));
+ i = verify_area(VERIFY_READ, (const void *)a, sizeof(struct kbentry));
if (i)
return i;
if ((i = get_user(&a->kb_index)) >= NR_KEYS)
*/
-static char *version =
+static const char *version =
"3c501.c: 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov).\n";
/*
@@ -223,7+223,7 @@ el1_probe1(struct device *dev, int ioaddr) {
#ifndef MODULE
- char *mname; /* Vendor name */
+ const char *mname; /* Vendor name */
unsigned char station_addr[6];
int autoirq = 0;
int i;
The Crynwr 3c503 packet driver.
*/
-static char *version =
+static const char *version =
"3c503.c:v1.10 9/23/93 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
#include <linux/kernel.h>
*
*********************************************************/
-static char * filename = __FILE__;
+static const char * filename = __FILE__;
-static char * null_msg = "*** NULL at %s:%s (line %d) ***\n";
+static const char * null_msg = "*** NULL at %s:%s (line %d) ***\n";
#define CHECK_NULL(p) \
if (!p) printk(null_msg, filename,__FUNCTION__,__LINE__)
-static char * timeout_msg = "*** timeout at %s:%s (line %d) ***\n";
+static const char * timeout_msg = "*** timeout at %s:%s (line %d) ***\n";
#define TIMEOUT_MSG(lineno) \
printk(timeout_msg, filename,__FUNCTION__,(lineno))
-static char * invalid_pcb_msg =
+static const char * invalid_pcb_msg =
"*** invalid pcb length %d at %s:%s (line %d) ***\n";
#define INVALID_PCB_MSG(len) \
printk(invalid_pcb_msg, (len),filename,__FUNCTION__,__LINE__)
-static char * search_msg = "%s: Looking for 3c505 adapter at address %#x...";
+static const char * search_msg = "%s: Looking for 3c505 adapter at address %#x...";
-static char * stilllooking_msg = "still looking...";
+static const char * stilllooking_msg = "still looking...";
-static char * found_msg = "found.\n";
+static const char * found_msg = "found.\n";
-static char * notfound_msg = "not found (reason = %d)\n";
+static const char * notfound_msg = "not found (reason = %d)\n";
-static char * couldnot_msg = "%s: 3c505 not found\n";
+static const char * couldnot_msg = "%s: 3c505 not found\n";
/*********************************************************
*
@@ -1261,7+1261,7 @@ elp_sense (struct device * dev) {
int timeout;
int addr=dev->base_addr;
- char *name=dev->name;
+ const char *name=dev->name;
byte orig_HCR=inb_control(addr),
orig_HSR=inb_status(addr);
The statistics need to be updated correctly.
*/
-static char *version =
+static const char *version =
"3c507.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
#include <linux/config.h>
practice this rarely happens.
*/
-static char *version = "3c509.c:1.03 10/8/94 becker@cesdis.gsfc.nasa.gov\n";
+static const char *version = "3c509.c:1.03 10/8/94 becker@cesdis.gsfc.nasa.gov\n";
#include <linux/config.h>
#ifdef MODULE
@@ -227,7+227,7 @@ int el3_probe(struct device *dev) request_region(dev->base_addr, 16,"3c509");
{
- char *if_names[] = {"10baseT", "AUI", "undefined", "BNC"};
+ const char *if_names[] = {"10baseT", "AUI", "undefined", "BNC"};
printk("%s: 3c509 at %#3.3lx tag %d, %s port, address ",
dev->name, dev->base_addr, current_tag, if_names[dev->if_port]);
}
*/
-static char *version =
+static const char *version =
"8390.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
/*
@@ -37,7+37,7 @@ extern int autoirq_report(int waittime); things in there should be here!) */
/* You have one of these per-board */
struct ei_device {
- char *name;
+ const char *name;
void (*reset_8390)(struct device *);
void (*block_output)(struct device *, int, const unsigned char *, int);
int (*block_input)(struct device *, int, char *, int);
by glee@ardnassak.math.clemson.edu.
*/
-static char *version =
+static const char *version =
"ac3200.c:v1.01 7/1/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
#include <linux/kernel.h>
@@ -44,7+44,7 @@ static char *version = static unsigned char config2irqmap[8] = {15, 12, 11, 10, 9, 7, 5, 3};
static int addrmap[8] =
{0xFF0000, 0xFE0000, 0xFD0000, 0xFFF0000, 0xFFE0000, 0xFFC0000, 0xD0000, 0 };
-static char *port_name[4] = { "10baseT", "invalid", "AUI", "10base2"};
+static const char *port_name[4] = { "10baseT", "invalid", "AUI", "10base2"};
#define config2irq(configval) config2irqmap[((configval) >> 3) & 7]
#define config2mem(configval) addrmap[(configval) & 7]
*/
-static char *version = "apricot.c:v0.2 05/12/94\n";
+static const char *version = "apricot.c:v0.2 05/12/94\n";
#ifdef MODULE
#include <linux/module.h>
<jojo@repas.de>
*/
-static char *version =
+static const char *version =
"arcnet.c:v1.92 ALPHA 95/07/11 Avery Pennarun <apenwarr@foxnet.net>\n";
/**************************************************************************/
response to inb()s from other device probes!
*/
-static char *version =
+static const char *version =
"at1700.c:v1.12 1/18/95 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
#include <linux/config.h>
@@ -228,7+228,7 @@ int at1700_probe1(struct device *dev, short ioaddr) 0x1800 == use coax interface
*/
{
- char *porttype[] = {"auto-sense", "10baseT", "auto-sense", "10base2"};
+ const char *porttype[] = {"auto-sense", "10baseT", "auto-sense", "10base2"};
ushort setup_value = read_eeprom(ioaddr, 12);
dev->if_port = setup_value >> 8;
The timer-based reset code was written by Bill Carlson, wwc@super.org.
*/
-static char *version =
+static const char *version =
"atp.c:v1.01 1/18/95 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
/*
=========================================================================
*/
-static char *version = "de4x5.c:v0.32 6/26/95 davies@wanton.lkg.dec.com\n";
+static const char *version = "de4x5.c:v0.32 6/26/95 davies@wanton.lkg.dec.com\n";
#include <linux/config.h>
#ifdef MODULE
@@ -2163,7+2163,7 @@ static void dce_ms_delay(u32 msec) static int EISA_signature(char *name, s32 eisa_id)
{
u_int i;
- char *signatures[] = DE4X5_SIGNATURE;
+ const char *signatures[] = DE4X5_SIGNATURE;
char ManCode[DE4X5_STRLEN];
union {
s32 ID;
-static char *version =
+static const char *version =
"de600.c: $Revision: 1.40 $, Bjorn Ekwall (bj0rn@blox.se)\n";
/*
* de600.c
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
-static char *version =
+static const char *version =
"de620.c: $Revision: 1.31 $, Bjorn Ekwall <bj0rn@blox.se>\n";
\f
/***********************************************************************
=========================================================================
*/
-static char *version = "depca.c:v0.41 5/26/95 davies@wanton.lkg.dec.com\n";
+static const char *version = "depca.c:v0.41 5/26/95 davies@wanton.lkg.dec.com\n";
#include <linux/config.h>
#ifdef MODULE
@@ -1438,7+1438,7 @@ static struct device *alloc_device(struct device *dev, u_long iobase) static void DepcaSignature(char *name, u_long paddr)
{
u_int i,j,k;
- char *signatures[] = DEPCA_SIGNATURE;
+ const char *signatures[] = DEPCA_SIGNATURE;
char tmpstr[16];
for (i=0;i<16;i++) { /* copy the first 16 bytes of ROM to */
@@ -1622,7+1622,7 @@ static int load_packet(struct device *dev, struct sk_buff *skb) static int EISA_signature(char *name, s32 eisa_id)
{
u_int i;
- char *signatures[] = DEPCA_SIGNATURE;
+ const char *signatures[] = DEPCA_SIGNATURE;
char ManCode[DEPCA_STRLEN];
union {
s32 ID;
If this happens, you must power down the machine for about 30 seconds.
*/
-static char *version =
+static const char *version =
"e2100.c:v1.01 7/21/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
#include <linux/kernel.h>
*/
-static char *version =
+static const char *version =
"eepro.c: v0.07a 6/5/95 Bao C. Ha (bao@saigon.async.com)\n";
/* Always include 'config.h' first in case the user wants to turn on
@@ -313,7+313,7 @@ int eepro_probe1(struct device *dev, short ioaddr) int i;
int eepro; /* a flag, TRUE=1 for the EtherExpress Pro/10,
FALSE = 0 for other 82595-based lan cards. */
- char *ifmap[] = {"AUI", "10Base2", "10BaseT"};
+ const char *ifmap[] = {"AUI", "10Base2", "10BaseT"};
enum iftype { AUI=0, BNC=1, TPE=2 };
/* Now, we are going to check for the signature of the
Changed to support io= irq= by Alan Cox <Alan.Cox@linux.org>
*/
-static char *version =
+static const char *version =
"eexpress.c:v0.07 1/19/94 Donald Becker (becker@super.org)\n";
#include <linux/config.h>
@@ -375,7+375,7 @@ int eexp_probe1(struct device *dev, short ioaddr) interface to minimize bogus bug reports. */
{
char irqmap[] = {0, 9, 3, 4, 5, 10, 11, 0};
- char *ifmap[] = {"AUI", "BNC", "10baseT"};
+ const char *ifmap[] = {"AUI", "BNC", "10baseT"};
enum iftype {AUI=0, BNC=1, TP=2};
unsigned short setupval = read_eeprom(ioaddr, 0);
* Phone: 1-703-847-0040 ext 103
*/
-static char *version =
+static const char *version =
"Equalizer: $Revision: 3.12 $ $Date: 1995/01/19 $ Simon Janes (simon@ncm.com)\n";
#include <linux/config.h>
=========================================================================
*/
-static char *version = "ewrk3.c:v0.32 1/16/95 davies@wanton.lkg.dec.com\n";
+static const char *version = "ewrk3.c:v0.32 1/16/95 davies@wanton.lkg.dec.com\n";
#ifdef MODULE
#include <linux/module.h>
programming information.
*/
-static char *version =
+static const char *version =
"hp-plus.c:v1.10 9/24/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
#include <linux/string.h> /* Important -- this inlines word moves. */
@@ -144,7+144,7 @@ int hpp_probe1(struct device *dev, int ioaddr) {
int i;
unsigned char checksum = 0;
- char *name = "HP-PC-LAN+";
+ const char *name = "HP-PC-LAN+";
int mem_start;
/* Check for the HP+ signature, 50 48 0x 53. */
The Crynwr packet driver.
*/
-static char *version =
+static const char *version =
"hp.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
#include <linux/kernel.h>
@@ -100,7+100,7 @@ int hp_probe(struct device *dev) int hp_probe1(struct device *dev, int ioaddr)
{
int i, board_id, wordmode;
- char *name;
+ const char *name;
/* Check for the HP physical address, 08 00 09 xx xx xx. */
/* This really isn't good enough: we may pick up HP LANCE boards
* HP 27248B 10 only EISA card with Cascade chip
* HP J2577 10/100 EISA card with Cascade chip
* HP J2573 10/100 ISA card with Cascade chip
+ * HP J2585 10/100 PCI card
*
* Other ATT2MD01 Chip based boards might be supported in the future
* (there are some minor changes needed).
* TO DO:
* ======
* - ioctl handling - some runtime setup things
- * - PCI card support
+ * - high priority communications support
+ * - memory mapped access support for PCI cards
*
* Revision history:
* =================
* Little bug in hp100_close function fixed.
* 100Mb/s connection debugged.
* 0.12 14-Jul-95 Link down is now handled better.
+ * 0.20 01-Aug-95 Added PCI support for HP J2585A card.
+ * Statistics bug fixed.
*
*/
#include <linux/ioport.h>
#include <linux/malloc.h>
#include <linux/interrupt.h>
+#include <linux/pci.h>
+#include <linux/bios32.h>
#include <asm/bitops.h>
#include <asm/io.h>
* defines
*/
+#define HP100_BUS_ISA 0
+#define HP100_BUS_EISA 1
+#define HP100_BUS_PCI 2
+
+#define HP100_REGION_SIZE 0x20
+
#define HP100_MAX_PACKET_SIZE (1536+4)
#define HP100_MIN_PACKET_SIZE 60
struct hp100_eisa_id {
u_int id;
- char *name;
+ const char *name;
+ u_char bus;
};
struct hp100_private {
@@ -118,28+131,39 @@ struct hp100_private { u_short soft_model;
u_int memory_size;
u_short rx_ratio;
+ short mem_mapped; /* memory mapped access */
+ u_char *mem_ptr; /* pointer to memory mapped area */
short lan_type; /* 10Mb/s, 100Mb/s or -1 (error) */
- int hub_status; /* login to hub successfull? */
+ int hub_status; /* login to hub was successfull? */
u_char mac1_mode;
u_char mac2_mode;
struct enet_statistics stats;
};
-struct hp100_rx_look {
- struct hp100_rx_header header;
- char something[ 24 ]; /* 2 * MAC @6 + protocol @2+8 + pad to 4 byte */
-};
-
/*
* variables
*/
static struct hp100_eisa_id hp100_eisa_ids[] = {
- { 0x080F1F022, "HP J2577 rev A" }, /* 10/100 EISA card with REVA Cascade chip */
- { 0x050F1F022, "HP J2573 rev A" }, /* 10/100 ISA card with REVA Cascade chip */
- { 0x02019F022, "HP 27248B" }, /* 10 only EISA card with Cascade chip */
- { 0x04019F022, "HP J2577" }, /* 10/100 EISA card with Cascade chip */
- { 0x05019F022, "HP J2573" } /* 10/100 ISA card with Cascade chip */
+
+ /* 10/100 EISA card with REVA Cascade chip */
+ { 0x080F1F022, "HP J2577 rev A", HP100_BUS_EISA },
+
+ /* 10/100 ISA card with REVA Cascade chip */
+ { 0x050F1F022, "HP J2573 rev A", HP100_BUS_ISA },
+
+ /* 10 only EISA card with Cascade chip */
+ { 0x02019F022, "HP 27248B", HP100_BUS_EISA },
+
+ /* 10/100 EISA card with Cascade chip */
+ { 0x04019F022, "HP J2577", HP100_BUS_EISA },
+
+ /* 10/100 ISA card with Cascade chip */
+ { 0x05019F022, "HP J2573", HP100_BUS_ISA },
+
+ /* 10/100 PCI card */
+ /* Note: ID for this card is same as PCI vendor/device numbers. */
+ { 0x01030103c, "HP J2585", HP100_BUS_PCI },
};
#ifdef MODULE
@@ -150,21+174,18 @@ int hp100_default_rx_ratio = HP100_RX_RATIO; * prototypes
*/
-static int hp100_probe1( struct device *dev, int ioaddr );
+static int hp100_probe1( struct device *dev, int ioaddr, int bus );
static int hp100_open( struct device *dev );
static int hp100_close( struct device *dev );
static int hp100_start_xmit( struct sk_buff *skb, struct device *dev );
static void hp100_rx( struct device *dev );
static struct enet_statistics *hp100_get_stats( struct device *dev );
static void hp100_update_stats( struct device *dev );
+static void hp100_clear_stats( int ioaddr );
#ifdef HAVE_MULTICAST
static void hp100_set_multicast_list( struct device *dev, int num_addrs, void *addrs );
#endif
-#ifndef LINUX_1_1_52
static void hp100_interrupt( int irq, struct pt_regs *regs );
-#else
-static void hp100_interrupt( int irq );
-#endif
static void hp100_start_interface( struct device *dev );
static void hp100_stop_interface( struct device *dev );
@@ -181,36+202,97 @@ int hp100_probe( struct device *dev ) {
int base_addr = dev ? dev -> base_addr : 0;
int ioaddr;
-
+#ifdef CONFIG_PCI
+ int pci_start_index = 0;
+#endif
+
if ( base_addr > 0xff ) /* Check a single specified location. */
- return hp100_probe1(dev, base_addr);
+ {
+ if ( check_region( base_addr, HP100_REGION_SIZE ) ) return -EINVAL;
+ if ( base_addr < 0x400 )
+ return hp100_probe1( dev, base_addr, HP100_BUS_ISA );
+ else
+ return hp100_probe1( dev, base_addr, HP100_BUS_EISA );
+ }
else
+#ifdef CONFIG_PCI
+ if ( base_addr > 0 && base_addr < 8 + 1 )
+ pci_start_index = 0x100 | ( base_addr - 1 );
+ else
+#endif
if ( base_addr != 0 ) return -ENXIO;
+
+ /* at first - scan PCI bus(es) */
+
+#ifdef CONFIG_PCI
+ if ( pcibios_present() )
+ {
+ int pci_index;
+
+#ifdef HP100_DEBUG_PCI
+ printk( "hp100: PCI BIOS is present, checking for devices..\n" );
+#endif
+ for ( pci_index = pci_start_index & 7; pci_index < 8; pci_index++ )
+ {
+ u_char pci_bus, pci_device_fn;
+ u_short pci_command;
+
+ if ( pcibios_find_device( PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585A,
+ pci_index, &pci_bus,
+ &pci_device_fn ) != 0 ) break;
+ pcibios_read_config_dword( pci_bus, pci_device_fn,
+ PCI_BASE_ADDRESS_0, &ioaddr );
+
+ ioaddr &= ~3; /* remove I/O space marker in bit 0. */
+
+ if ( check_region( ioaddr, HP100_REGION_SIZE ) ) continue;
+
+ pcibios_read_config_word( pci_bus, pci_device_fn,
+ PCI_COMMAND, &pci_command );
+ if ( !( pci_command & PCI_COMMAND_MASTER ) )
+ {
+#ifdef HP100_DEBUG_PCI
+ printk( "hp100: PCI Master Bit has not been set. Setting...\n" );
+#endif
+ pci_command |= PCI_COMMAND_MASTER;
+ pcibios_write_config_word( pci_bus, pci_device_fn,
+ PCI_COMMAND, pci_command );
+ }
+#ifdef HP100_DEBUG_PCI
+ printk( "hp100: PCI adapter found at 0x%x\n", ioaddr );
+#endif
+ if ( hp100_probe1( dev, ioaddr, HP100_BUS_PCI ) == 0 ) return 0;
+ }
+ }
+ if ( pci_start_index > 0 ) return -ENODEV;
+#endif /* CONFIG_PCI */
- /* at first - probe all EISA possible port regions (if EISA bus present) */
+ /* at second - probe all EISA possible port regions (if EISA bus present) */
for ( ioaddr = 0x1c38; EISA_bus && ioaddr < 0x10000; ioaddr += 0x400 )
{
- if ( check_region( ioaddr, 0x20 ) ) continue;
- if ( hp100_probe1( dev, ioaddr ) == 0 ) return 0;
+ if ( check_region( ioaddr, HP100_REGION_SIZE ) ) continue;
+ if ( hp100_probe1( dev, ioaddr, HP100_BUS_EISA ) == 0 ) return 0;
}
- /* at second - probe all ISA possible port regions */
+ /* at third - probe all ISA possible port regions */
for ( ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x20 )
{
- if ( check_region( ioaddr, 0x20 ) ) continue;
- if ( hp100_probe1( dev, ioaddr ) == 0 ) return 0;
+ if ( check_region( ioaddr, HP100_REGION_SIZE ) ) continue;
+ if ( hp100_probe1( dev, ioaddr, HP100_BUS_ISA ) == 0 ) return 0;
}
return -ENODEV;
}
-static int hp100_probe1( struct device *dev, int ioaddr )
+static int hp100_probe1( struct device *dev, int ioaddr, int bus )
{
int i;
- u_char uc;
+ u_char uc, uc_1;
u_int eisa_id;
+ short mem_mapped;
+ u_char *mem_ptr;
struct hp100_private *lp;
struct hp100_eisa_id *eid;
@@ -222,11+304,12 @@ static int hp100_probe1( struct device *dev, int ioaddr ) return EIO;
}
- if ( inb( ioaddr + 0 ) != HP100_HW_ID_0 ||
- inb( ioaddr + 1 ) != HP100_HW_ID_1 ||
- ( inb( ioaddr + 2 ) & 0xf0 ) != HP100_HW_ID_2_REVA ||
- inb( ioaddr + 3 ) != HP100_HW_ID_3 )
- return -ENODEV;
+ if ( bus != HP100_BUS_PCI ) /* don't check PCI cards again */
+ if ( inb( ioaddr + 0 ) != HP100_HW_ID_0 ||
+ inb( ioaddr + 1 ) != HP100_HW_ID_1 ||
+ ( inb( ioaddr + 2 ) & 0xf0 ) != HP100_HW_ID_2_REVA ||
+ inb( ioaddr + 3 ) != HP100_HW_ID_3 )
+ return -ENODEV;
dev -> base_addr = ioaddr;
@@ -238,8+321,9 @@ static int hp100_probe1( struct device *dev, int ioaddr ) for ( i = uc = eisa_id = 0; i < 4; i++ )
{
eisa_id >>= 8;
- eisa_id |= ( hp100_inb( BOARD_ID + i ) ) << 24;
- uc += eisa_id >> 24;
+ uc_1 = hp100_inb( BOARD_ID + i );
+ eisa_id |= uc_1 << 24;
+ uc += uc_1;
}
uc += hp100_inb( BOARD_ID + 4 );
@@ -258,7+342,7 @@ static int hp100_probe1( struct device *dev, int ioaddr ) break;
if ( i >= sizeof( hp100_eisa_ids ) / sizeof( struct hp100_eisa_id ) )
{
- printk( "hp100_probe1: card at port 0x%x isn't known\n", ioaddr );
+ printk( "hp100_probe1: card at port 0x%x isn't known (id = 0x%x)\n", ioaddr, eisa_id );
return -ENODEV;
}
eid = &hp100_eisa_ids[ i ];
@@ -278,13+362,35 @@ static int hp100_probe1( struct device *dev, int ioaddr ) return -EIO;
}
+#ifndef HP100_IO_MAPPED
hp100_page( HW_MAP );
- if ( hp100_inw( OPTION_LSW ) & ( HP100_MEM_EN | HP100_BM_WRITE | HP100_BM_READ ) )
+ mem_mapped = ( hp100_inw( OPTION_LSW ) &
+ ( HP100_MEM_EN | HP100_BM_WRITE | HP100_BM_READ ) ) != 0;
+ mem_ptr = NULL;
+ if ( mem_mapped )
{
- printk( "hp100_probe1: memory mapped io isn't supported (card %s at port 0x%x)\n",
- eid -> name, ioaddr );
- return -EIO;
+ mem_ptr = (u_char *)( hp100_inw( MEM_MAP_LSW ) |
+ ( hp100_inw( MEM_MAP_MSW ) << 16 ) );
+ (u_int)mem_ptr &= ~0x1fff; /* 8k aligment */
+ if ( bus == HP100_BUS_ISA && ( (u_int)mem_ptr & ~0xfffff ) != 0 )
+ {
+ mem_ptr = NULL;
+ mem_mapped = 0;
+ }
+ if ( mem_mapped && bus == HP100_BUS_PCI )
+ {
+#if 0
+ printk( "writeb !!!\n" );
+ writeb( 0, mem_ptr );
+#endif
+ mem_ptr = NULL;
+ mem_mapped = 0;
+ }
}
+#else
+ mem_mapped = 0;
+ mem_ptr = NULL;
+#endif
if ( ( dev -> priv = kmalloc( sizeof( struct hp100_private ), GFP_KERNEL ) ) == NULL )
return -ENOMEM;
@@ -292,6+398,8 @@ static int hp100_probe1( struct device *dev, int ioaddr )
lp = (struct hp100_private *)dev -> priv;
lp -> id = eid;
+ lp -> mem_mapped = mem_mapped;
+ lp -> mem_ptr = mem_ptr;
hp100_page( ID_MAC_ADDR );
lp -> soft_model = hp100_inb( SOFT_MODEL );
lp -> mac1_mode = HP100_MAC1MODE3;
@@ -316,28+424,46 @@ static int hp100_probe1( struct device *dev, int ioaddr ) dev -> set_multicast_list = &hp100_set_multicast_list;
#endif
-#ifndef LINUX_1_1_52
- request_region( dev -> base_addr, 0x20, eid -> name );
-#endif
+ request_region( dev -> base_addr, HP100_REGION_SIZE, eid -> name );
hp100_page( ID_MAC_ADDR );
for ( i = uc = 0; i < 6; i++ )
dev -> dev_addr[ i ] = hp100_inb( LAN_ADDR + i );
+ hp100_clear_stats( ioaddr );
+
ether_setup( dev );
lp -> lan_type = hp100_sense_lan( dev );
- printk( "%s: %s at 0x%x, IRQ %d, %dkB SRAM (rx/tx %d%%), ",
- dev -> name, lp -> id -> name, ioaddr, dev -> irq,
+ printk( "%s: %s at 0x%x, IRQ %d, ",
+ dev -> name, lp -> id -> name, ioaddr, dev -> irq );
+ switch ( bus ) {
+ case HP100_BUS_EISA: printk( "EISA" ); break;
+ case HP100_BUS_PCI: printk( "PCI" ); break;
+ default: printk( "ISA" ); break;
+ }
+ printk( " bus, %dk SRAM (rx/tx %d%%).\n",
lp -> memory_size >> ( 10 - 4 ), lp -> rx_ratio );
+ if ( mem_mapped )
+ printk( "%s: Memory mapped access used at 0x%x-0x%x.\n",
+ dev -> name, (u_int)mem_ptr, (u_int)mem_ptr + 0x1fff );
+ printk( "%s: ", dev -> name );
+ if ( lp -> lan_type != HP100_LAN_ERR )
+ printk( "Adapter is attached to " );
switch ( lp -> lan_type ) {
- case HP100_LAN_100: printk( "100Mb/s VG TP" ); break;
- case HP100_LAN_10: printk( "10Mb/s TP" ); break;
- default: printk( "link down" ); break;
+ case HP100_LAN_100:
+ printk( "100Mb/s Voice Grade AnyLAN network.\n" );
+ break;
+ case HP100_LAN_10:
+ printk( "10Mb/s network.\n" );
+ break;
+ default:
+ printk( "Warning! Link down.\n" );
}
- printk( ".\n" );
-
+
+ hp100_stop_interface( dev );
+
return 0;
}
@@ -372,10+498,9 @@ static int hp100_open( struct device *dev ) lp -> mac2_mode = HP100_MAC2MODE3;
hp100_page( MAC_CTRL );
- hp100_orw( HP100_LINK_BEAT_DIS, LAN_CFG_10 );
+ hp100_orw( HP100_LINK_BEAT_DIS | HP100_RESET_LB, LAN_CFG_10 );
hp100_stop_interface( dev );
- hp100_reset_card();
hp100_load_eeprom( dev );
hp100_outw( HP100_MMAP_DIS | HP100_SET_HB |
@@ -388,7+513,7 @@ static int hp100_open( struct device *dev ) #else
hp100_outw( HP100_ADV_NXT_PKT | HP100_TX_CMD | HP100_RESET_LB, OPTION_MSW );
#endif
-
+
hp100_page( MAC_ADDRESS );
for ( i = 0; i < 6; i++ )
hp100_outb( dev -> dev_addr[ i ], MAC_ADDR + i );
@@ -396,7+521,7 @@ static int hp100_open( struct device *dev ) hp100_outb( 0xff, HASH_BYTE0 + i );
hp100_page( PERFORMANCE );
hp100_outw( 0xfefe, IRQ_MASK ); /* mask off all ints */
- hp100_outw( 0xffff, IRQ_STATUS ); /* ack */
+ hp100_outw( 0xffff, IRQ_STATUS ); /* ack IRQ */
hp100_outw( (HP100_RX_PACKET | HP100_RX_ERROR | HP100_SET_HB) |
(HP100_TX_ERROR | HP100_SET_LB ), IRQ_MASK );
/* and enable few */
@@ -521,30+646,48 @@ static int hp100_start_xmit( struct sk_buff *skb, struct device *dev ) printk( "hp100_start_xmit: busy\n" );
#endif
}
-
+
hp100_ints_off();
val = hp100_inw( IRQ_STATUS );
hp100_outw( val & HP100_TX_COMPLETE, IRQ_STATUS );
#ifdef HP100_DEBUG_TX
printk( "hp100_start_xmit: irq_status = 0x%x, len = %d\n", val, (int)skb -> len );
#endif
- if ( skb -> len >= HP100_MIN_PACKET_SIZE )
+ if ( lp -> mem_mapped )
{
- hp100_outw( skb -> len, DATA32 ); /* length to memory manager */
- hp100_outw( skb -> len, FRAGMENT_LEN );
- outsl( ioaddr + HP100_REG_DATA32, skb -> data, ( skb -> len + 3 ) >> 2 );
- hp100_outw( HP100_TX_CMD | HP100_SET_LB, OPTION_MSW ); /* send packet */
+ if ( skb -> len >= HP100_MIN_PACKET_SIZE )
+ {
+ hp100_outw( skb -> len, DATA32 ); /* length to memory manager */
+ hp100_outw( skb -> len, FRAGMENT_LEN );
+ memcpy_toio( lp -> mem_ptr, skb -> data, skb -> len );
+ }
+ else
+ {
+ hp100_outw( HP100_MIN_PACKET_SIZE, DATA32 ); /* length to memory manager */
+ hp100_outw( HP100_MIN_PACKET_SIZE, FRAGMENT_LEN );
+ memcpy_toio( lp -> mem_ptr, skb -> data, skb -> len );
+ memset_io( lp -> mem_ptr, 0, HP100_MIN_PACKET_SIZE - skb -> len );
+ }
}
else
{
- hp100_outw( HP100_MIN_PACKET_SIZE, DATA32 ); /* length to memory manager */
- hp100_outw( HP100_MIN_PACKET_SIZE, FRAGMENT_LEN );
- i = skb -> len + 3;
- outsl( ioaddr + HP100_REG_DATA32, skb -> data, i >> 2 );
- for ( i &= ~3; i < HP100_MIN_PACKET_SIZE; i += 4 )
- hp100_outl( 0, DATA32 );
- hp100_outw( HP100_TX_CMD | HP100_SET_LB, OPTION_MSW ); /* send packet */
+ if ( skb -> len >= HP100_MIN_PACKET_SIZE )
+ {
+ hp100_outw( skb -> len, DATA32 ); /* length to memory manager */
+ hp100_outw( skb -> len, FRAGMENT_LEN );
+ outsl( ioaddr + HP100_REG_DATA32, skb -> data, ( skb -> len + 3 ) >> 2 );
+ }
+ else
+ {
+ hp100_outw( HP100_MIN_PACKET_SIZE, DATA32 ); /* length to memory manager */
+ hp100_outw( HP100_MIN_PACKET_SIZE, FRAGMENT_LEN );
+ i = skb -> len + 3;
+ outsl( ioaddr + HP100_REG_DATA32, skb -> data, i >> 2 );
+ for ( i &= ~3; i < HP100_MIN_PACKET_SIZE; i += 4 )
+ hp100_outl( 0, DATA32 );
+ }
}
+ hp100_outw( HP100_TX_CMD | HP100_SET_LB, OPTION_MSW ); /* send packet */
lp -> stats.tx_packets++;
dev -> trans_start = jiffies;
hp100_ints_on();
@@ -592,7+735,7 @@ static void hp100_rx( struct device *dev ) printk( "hp100_rx: busy, remaining packets = %d\n", packets );
#endif
}
- header = hp100_inl( DATA32 );
+ header = lp -> mem_mapped ? readl( lp -> mem_ptr ) : hp100_inl( DATA32 );
pkt_len = header & HP100_PKT_LEN_MASK;
#ifdef HP100_DEBUG_RX
printk( "hp100_rx: new packet - length = %d, errors = 0x%x, dest = 0x%x\n",
@@ -603,7+746,7 @@ static void hp100_rx( struct device *dev ) * allocating more than asked (notably, aligning the request up to
* the next 16-byte length).
*/
- skb = dev_alloc_skb(pkt_len);
+ skb = dev_alloc_skb( pkt_len );
if ( skb == NULL )
{
#ifdef HP100_DEBUG
@@ -613,11+756,22 @@ static void hp100_rx( struct device *dev ) }
else
{
+ u_char *ptr;
+
skb -> dev = dev;
- insl( ioaddr + HP100_REG_DATA32, skb_put(skb, pkt_len), ( pkt_len + 3 ) >> 2 );
- skb->protocol=eth_type_trans(skb,dev);
+ ptr = (u_char *)skb_put( skb, pkt_len );
+ if ( lp -> mem_mapped )
+ memcpy_fromio( ptr, lp -> mem_ptr, ( pkt_len + 3 ) & ~3 );
+ else
+ insl( ioaddr + HP100_REG_DATA32, ptr, ( pkt_len + 3 ) >> 2 );
+ skb -> protocol = eth_type_trans( skb, dev );
netif_rx( skb );
lp -> stats.rx_packets++;
+#ifdef HP100_DEBUG_RX
+ printk( "rx: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
+ ptr[ 0 ], ptr[ 1 ], ptr[ 2 ], ptr[ 3 ], ptr[ 4 ], ptr[ 5 ],
+ ptr[ 6 ], ptr[ 7 ], ptr[ 8 ], ptr[ 9 ], ptr[ 10 ], ptr[ 11 ] );
+#endif
}
hp100_outw( HP100_ADV_NXT_PKT | HP100_SET_LB, OPTION_MSW );
switch ( header & 0x00070000 ) {
@@ -664,6+818,17 @@ static void hp100_update_stats( struct device *dev ) hp100_page( PERFORMANCE );
}
+static void hp100_clear_stats( int ioaddr )
+{
+ cli();
+ hp100_page( MAC_CTRL ); /* get all statistics bytes */
+ hp100_inw( DROPPED );
+ hp100_inb( CRC );
+ hp100_inb( ABORT );
+ hp100_page( PERFORMANCE );
+ sti();
+}
+
/*
* multicast setup
*/
@@ -687,8+852,8 @@ static void hp100_set_multicast_list( struct device *dev, int num_addrs, void *a #ifdef HP100_DEBUG_MULTI
printk( "hp100_set_multicast_list: num_addrs = %d\n", num_addrs );
#endif
- hp100_ints_off();
cli();
+ hp100_ints_off();
hp100_page( MAC_CTRL );
hp100_andb( ~(HP100_RX_EN | HP100_TX_EN), MAC_CFG_1 ); /* stop rx/tx */
@@ -711,13+876,12 @@ static void hp100_set_multicast_list( struct device *dev, int num_addrs, void *a
hp100_outb( lp -> mac2_mode, MAC_CFG_2 );
hp100_andb( HP100_MAC1MODEMASK, MAC_CFG_1 );
- hp100_orb( lp -> mac1_mode, MAC_CFG_1 );
-
- hp100_orb( HP100_RX_EN | HP100_RX_IDLE, MAC_CFG_1 ); /* enable rx */
- hp100_orb( HP100_TX_EN | HP100_TX_IDLE, MAC_CFG_1 ); /* enable tx */
+ hp100_orb( lp -> mac1_mode |
+ HP100_RX_EN | HP100_RX_IDLE | /* enable rx */
+ HP100_TX_EN | HP100_TX_IDLE, MAC_CFG_1 ); /* enable tx */
hp100_page( PERFORMANCE );
- sti();
hp100_ints_on();
+ sti();
}
#endif /* HAVE_MULTICAST */
@@ -726,11+890,7 @@ static void hp100_set_multicast_list( struct device *dev, int num_addrs, void *a * hardware interrupt handling
*/
-#ifndef LINUX_1_1_52
static void hp100_interrupt( int irq, struct pt_regs *regs )
-#else
-static void hp100_interrupt( int irq )
-#endif
{
struct device *dev = (struct device *)irq2dev_map[ irq ];
struct hp100_private *lp;
@@ -779,17+939,22 @@ static void hp100_start_interface( struct device *dev ) int ioaddr = dev -> base_addr;
struct hp100_private *lp = (struct hp100_private *)dev -> priv;
- hp100_unreset_card();
cli();
+ hp100_unreset_card();
hp100_page( MAC_CTRL );
hp100_outb( lp -> mac2_mode, MAC_CFG_2 );
hp100_andb( HP100_MAC1MODEMASK, MAC_CFG_1 );
- hp100_orb( lp -> mac1_mode, MAC_CFG_1 );
- hp100_orb( HP100_RX_EN | HP100_RX_IDLE, MAC_CFG_1 );
- hp100_orb( HP100_TX_EN | HP100_TX_IDLE, MAC_CFG_1 );
+ hp100_orb( lp -> mac1_mode |
+ HP100_RX_EN | HP100_RX_IDLE |
+ HP100_TX_EN | HP100_TX_IDLE, MAC_CFG_1 );
hp100_page( PERFORMANCE );
hp100_outw( HP100_INT_EN | HP100_SET_LB, OPTION_LSW );
hp100_outw( HP100_TRI_INT | HP100_RESET_HB, OPTION_LSW );
+ if ( lp -> mem_mapped )
+ {
+ /* enable memory mapping */
+ hp100_outw( HP100_MMAP_DIS | HP100_RESET_HB, OPTION_LSW );
+ }
sti();
}
@@ -799,7+964,7 @@ static void hp100_stop_interface( struct device *dev ) u_short val;
hp100_outw( HP100_INT_EN | HP100_RESET_LB |
- HP100_TRI_INT | HP100_SET_HB, OPTION_LSW );
+ HP100_TRI_INT | HP100_MMAP_DIS | HP100_SET_HB, OPTION_LSW );
val = hp100_inw( OPTION_LSW );
hp100_page( HW_MAP );
hp100_andb( HP100_BM_SLAVE, BM );
@@ -959,7+1124,7 @@ int init_module( void ) void cleanup_module( void )
{
unregister_netdev( &dev_hp100 );
- release_region( dev_hp100.base_addr, 0x20 );
+ release_region( dev_hp100.base_addr, HP100_REGION_SIZE );
kfree_s( dev_hp100.priv, sizeof( struct hp100_private ) );
dev_hp100.priv = NULL;
}
*/
/*
- Changes by Peter De Schrijver (stud11@cc4.kuleuven.ac.be) :
+ Changes by Peter De Schrijver (Peter.Deschrijver@linux.cc.kuleuven.ac.be) :
+ changed name to ibmtr.c in anticipation of other tr boards.
+ changed reset code and adapter open code.
#define FALSE 0
#define TRUE (!FALSE)
-static char *version = "ibmtr.c:v1.1.48 8/7/94 Peter De Schrijver and Mark Swanson\n"
+static const char *version = "ibmtr.c:v1.1.48 8/7/94 Peter De Schrijver and Mark Swanson\n"
" modified 10/3/94 David W. Morris\n";
static char pcchannelid[]={0x05, 0x00, 0x04, 0x09,
@@ -120,7+120,7 @@ int DummyCallCount=0; /* This routine combined with the #DEFINE DPRINTD serves
to workaround the gcc apparent bug. in tr_tx() */
-static void DummyCall(char * fmt,...) {DummyCallCount++;return;}
+static void DummyCall(const char * fmt,...) {DummyCallCount++;return;}
static void PrtChanID(char *pcid, short stride) {
short i, j;
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
*/
-static char *version = "lance.c:v1.08 4/10/95 dplatt@3do.com\n";
+static const char *version = "lance.c:v1.08 4/10/95 dplatt@3do.com\n";
#include <linux/config.h>
#include <linux/kernel.h>
@@ -194,7+194,7 @@ struct lance_private { struct lance_rx_head rx_ring[RX_RING_SIZE];
struct lance_tx_head tx_ring[TX_RING_SIZE];
struct lance_init_block init_block;
- char *name;
+ const char *name;
/* The saved address of a sent-in-place packet/buffer, for skfree(). */
struct sk_buff* tx_skbuff[TX_RING_SIZE];
long rx_buffs; /* Address of Rx and Tx buffers. */
@@ -220,7+220,7 @@ struct lance_private { reportedly has the same ID as the '965. */
static struct lance_chip_type {
int id_number;
- char *name;
+ const char *name;
int flags;
} chip_table[] = {
{0x0000, "LANCE 7990", /* Ancient lance chip. */
@@ -337,7+337,7 @@ unsigned long lance_probe1(int ioaddr, unsigned long mem_start) struct lance_private *lp;
short dma_channels; /* Mark spuriously-busy DMA channels */
int i, reset_val, lance_version;
- char *chipname;
+ const char *chipname;
/* Flags for specific chips or boards. */
unsigned char hpJ2405A = 0; /* HP ISA adaptor */
int hp_builtin = 0; /* HP on-board ethernet. */
/* Routines for the NatSemi-based designs (NE[12]000). */
-static char *version =
+static const char *version =
"ne.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
#include <linux/kernel.h>
@@ -61,7+61,7 @@ static unsigned int netcard_portlist[] =
#ifdef CONFIG_NE_BAD_CLONES
/* A list of bad clones that we none-the-less recognize. */
-static struct { char *name8, *name16; unsigned char SAprefix[4];}
+static struct { const char *name8, *name16; unsigned char SAprefix[4];}
bad_clone_list[] = {
{"DE100", "DE200", {0x00, 0xDE, 0x01,}},
{"DE120", "DE220", {0x00, 0x80, 0xc8,}},
@@ -148,7+148,7 @@ static int ne_probe1(struct device *dev, int ioaddr) int i;
unsigned char SA_prom[32];
int wordlength = 2;
- char *name = NULL;
+ const char *name = NULL;
int start_page, stop_page;
int neX000, ctron;
int reg0 = inb_p(ioaddr);
struct device *init_etherdev(struct device *dev, int sizeof_private,
unsigned long *mem_startp);
-static char *version =
+static const char *version =
"PI: V0.8 ALPHA April 23 1995 David Perry (dp@hydra.carleton.ca)\n";
/* The following #define is only really required for the PI card, not
* So, this PLIP can't communicate the PLIP of Linux v1.0.
*/
-static char *version = "NET3 PLIP version 2.0 gniibe@mri.co.jp\n";
+static const char *version = "NET3 PLIP version 2.0 gniibe@mri.co.jp\n";
/*
Sources:
@@ -136,11+136,11 @@ static int ppp_lock(struct ppp *); static void ppp_unlock(struct ppp *);
static void ppp_add_fcs(struct ppp *);
static int ppp_check_fcs(struct ppp *);
-static void ppp_print_buffer(const char *,char *,int,int);
+static void ppp_print_buffer(const char *,const char *,int,int);
static int ppp_read(struct tty_struct *, struct file *, unsigned char *,
unsigned int);
-static int ppp_write(struct tty_struct *, struct file *, unsigned char *,
+static int ppp_write(struct tty_struct *, struct file *, const unsigned char *,
unsigned int);
static int ppp_ioctl(struct tty_struct *, struct file *, unsigned int,
unsigned long);
@@ -151,7+151,7 @@ static void ppp_close(struct tty_struct *);
#ifdef NEW_TTY_DRIVERS
static int ppp_receive_room(struct tty_struct *tty);
-static void ppp_receive_buf(struct tty_struct *tty, unsigned char *cp,
+static void ppp_receive_buf(struct tty_struct *tty, const unsigned char *cp,
char *fp, int count);
static void ppp_write_wakeup(struct tty_struct *tty);
#else
@@ -918,7+918,7 @@ static int ppp_receive_room(struct tty_struct *tty) }
-static void ppp_receive_buf(struct tty_struct *tty, unsigned char *cp,
+static void ppp_receive_buf(struct tty_struct *tty, const unsigned char *cp,
char *fp, int count)
{
register struct ppp *ppp = ppp_find (tty);
@@ -1350,7+1350,7 @@ ppp_stuff_char(struct ppp *ppp, unsigned char c) */
static int
-ppp_write(struct tty_struct *tty, struct file *file, unsigned char *buf, unsigned int nr)
+ppp_write(struct tty_struct *tty, struct file *file, const unsigned char *buf, unsigned int nr)
{
struct ppp *ppp = ppp_find(tty);
int i;
@@ -2021,7+2021,7 @@ ppp_check_fcs(struct ppp *ppp)
static char hex[] = "0123456789ABCDEF";
-static inline void ppp_print_hex (register char *out, char *in, int count)
+static inline void ppp_print_hex (register char *out, const char *in, int count)
{
register unsigned char next_ch;
@@ -2035,7+2035,7 @@ static inline void ppp_print_hex (register char *out, char *in, int count) }
}
-static inline void ppp_print_char (register char *out, char *in, int count)
+static inline void ppp_print_char (register char *out, const char *in, int count)
{
register unsigned char next_ch;
@@ -2054,7+2054,7 @@ static inline void ppp_print_char (register char *out, char *in, int count) *out = '\0';
}
-static void ppp_print_buffer(const char *name, char *buf, int count, int seg)
+static void ppp_print_buffer(const char *name, const char *buf, int count, int seg)
{
char line [44];
int old_fs = get_fs();
*/
-static char *version =
+static const char *version =
"seeq8005.c:v1.00 8/07/95 Hamish Coleman (hamish@zot.apana.org.au)\n";
/* Always include 'config.h' first in case the user wants to turn on
*
-*/
-static char *rcsid = "$Id: sk_g16.c,v 1.1 1994/06/30 16:25:15 root Exp $";
+static const char *rcsid = "$Id: sk_g16.c,v 1.1 1994/06/30 16:25:15 root Exp $";
/*
* The Schneider & Koch (SK) G16 Network device driver is based
* Modularization.
* - Jan 1995 Bjorn Ekwall
* Use ip_fast_csum from ip.h
+ * - July 1995 Christos A. Polyzols
+ * Spotted bug in tcp option checking
*
*
* This module is a difficult issue. It's clearly inet code but it's also clearly
@@ -355,7+357,7 @@ found: || ip->ttl != cs->cs_ip.ttl
|| th->doff != cs->cs_tcp.doff
|| (ip->ihl > 5 && memcmp(ip+1,cs->cs_ipopt,((ip->ihl)-5)*4) != 0)
- || (th->doff > 5 && memcmp(th+1,cs->cs_tcpopt,((th->doff)-5)*4 != 0))){
+ || (th->doff > 5 && memcmp(th+1,cs->cs_tcpopt,((th->doff)-5)*4) != 0)){
goto uncompressed;
}
@@ -617,7+617,7 @@ slip_receive_room(struct tty_struct *tty) * and sent on to some IP layer for further processing.
*/
static void
-slip_receive_buf(struct tty_struct *tty, unsigned char *cp, char *fp, int count)
+slip_receive_buf(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
{
struct slip *sl = (struct slip *) tty->disc_data;
use the non-8390-compatible "Altego" mode. (No support currently planned.)
*/
-static char *version =
+static const char *version =
"smc-ultra.c:v1.12 1/18/95 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
#include <linux/kernel.h>
@@ -111,7+111,7 @@ int ultra_probe1(struct device *dev, int ioaddr) {
int i;
int checksum = 0;
- char *model_name;
+ const char *model_name;
unsigned char eeprom_irq = 0;
/* Values from various config regs. */
unsigned char num_pages, irqreg, addr;
@@ -72,7+72,7 @@ struct net_local
extern int wavelan_probe(device *); /* See Space.c */
-static char *version = "wavelan.c:v7 95/4/8\n";
+static const char *version = "wavelan.c:v7 95/4/8\n";
/*
* Entry point forward declarations.
@@ -494,7+494,7 @@ wavelan_ack(device *dev) */
static
int
-wavelan_synchronous_cmd(device *dev, char *str)
+wavelan_synchronous_cmd(device *dev, const char *str)
{
unsigned short ioaddr;
net_local *lp;
@@ -749,7+749,7 @@ wavelan_hardware_reset(device *dev) #if STRUCT_CHECK == 1
static
-char *
+const char *
wavelan_struct_check(void)
{
#define SC(t,s,n) if (sizeof(t) != s) return n
@@ -2447,7+2447,7 @@ wavelan_dev_show(device *dev) {
printk("dev:");
printk(" start=%d,", dev->start);
- printk(" tbusy=%d,", dev->tbusy);
+ printk(" tbusy=%ld,", dev->tbusy);
printk(" interrupt=%d,", dev->interrupt);
printk(" trans_start=%ld,", dev->trans_start);
printk(" flags=0x%x,", dev->flags);
Thanks to Russ Nelson (nelson@crnwyr.com) for loaning me a WD8013.
*/
-static char *version =
+static const char *version =
"wd.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
#include <linux/kernel.h>
@@ -103,7+103,7 @@ int wd_probe1(struct device *dev, int ioaddr) int checksum = 0;
int ancient = 0; /* An old card without config registers. */
int word16 = 0; /* 0 = 8 bit, 1 = 16 bit */
- char *model_name;
+ const char *model_name;
for (i = 0; i < 8; i++)
checksum += inb(ioaddr + 8 + i);
/* znet.c: An Zenith Z-Note ethernet driver for linux. */
-static char *version = "znet.c:v1.02 9/23/94 becker@cesdis.gsfc.nasa.gov\n";
+static const char *version = "znet.c:v1.02 9/23/94 becker@cesdis.gsfc.nasa.gov\n";
/*
Written by Donald Becker.
@@ -135,7+135,8 @@ struct pci_dev_info dev_info[] = { DEVICE( QLOGIC, QLOGIC_ISP1020, "ISP1020"),
DEVICE( QLOGIC, QLOGIC_ISP1022, "ISP1022"),
DEVICE( X, X_AGX016, "ITT AGX016"),
- DEVICE( VORTEX, VORTEX_GDT, "GDT 6000b")
+ DEVICE( VORTEX, VORTEX_GDT, "GDT 6000b"),
+ DEVICE( HP, HP_J2585A, "J2585A")
};
@@ -157,9+158,9 @@ struct pci_dev_info dev_info[] = { * optimizations...
*/
struct optimization_type {
- char *type;
- char *off;
- char *on;
+ const char *type;
+ const char *off;
+ const char *on;
} bridge_optimization[] = {
{"Cache L2", "write trough", "write back"},
{"CPU-PCI posted write", "off", "on"},
@@ -233,7+234,7 @@ struct pci_dev_info *pci_lookup_dev(unsigned int vendor, unsigned int dev) }
-char *pci_strbioserr (int error)
+const char *pci_strbioserr (int error)
{
switch (error) {
case PCIBIOS_SUCCESSFUL: return "SUCCESSFUL";
@@ -337,6+338,7 @@ const char *pci_strvendor(unsigned int vendor) case PCI_VENDOR_ID_X: return "X TECHNOLOGY";
case PCI_VENDOR_ID_ACC: return "ACC MICROELECTRONICS";
case PCI_VENDOR_ID_VORTEX: return "VORTEX";
+ case PCI_VENDOR_ID_HP: return "Hewlett Packard";
default: return "Unknown vendor";
}
}
@@ -189,7+189,7 @@ static void intr_phase_mismatch (struct Scsi_Host *host, struct NCR53c7x0_cmd static void intr_dma (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd);
static void print_dsa (struct Scsi_Host *host, u32 *dsa);
static int print_insn (struct Scsi_Host *host, u32 *insn,
- char *prefix, int kernel);
+ const char *prefix, int kernel);
static void NCR53c8xx_dsa_fixup (struct NCR53c7x0_cmd *cmd);
static void NCR53c8x0_init_fixup (struct Scsi_Host *host);
@@ -3344,7+3344,7 @@ static void intr_phase_mismatch (struct Scsi_Host *host, struct NCR53c7x0_cmd unsigned char dcmd, sbcl;
struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *)
host->hostdata;
- char *phase;
+ const char *phase;
NCR53c7x0_local_setup(host);
if (!cmd) {
@@ -3712,7+3712,7 @@ static void intr_dma (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) { */
static int print_insn (struct Scsi_Host *host, u32 *insn,
- char *prefix, int kernel) {
+ const char *prefix, int kernel) {
char buf[80], /* Temporary buffer and pointer */
*tmp;
unsigned char dcmd; /* dcmd register for *insn */
@@ -320,7+320,7 @@ static __inline__ void initialize_SCp(Scsi_Cmnd *cmd) { #ifdef NDEBUG
static struct {
unsigned char mask;
- char * name;}
+ const char * name;}
signals[] = {{ SR_DBP, "PARITY"}, { SR_RST, "RST" }, { SR_BSY, "BSY" },
{ SR_REQ, "REQ" }, { SR_MSG, "MSG" }, { SR_CD, "CD" }, { SR_IO, "IO" },
{ SR_SEL, "SEL" }, {0, NULL}},
@@ -371,7+371,7 @@ static void NCR5380_print(struct Scsi_Host *instance) {
static struct {
unsigned char value;
- char *name;
+ const char *name;
} phases[] = {
{PHASE_DATAOUT, "DATAOUT"}, {PHASE_DATAIN, "DATAIN"}, {PHASE_CMDOUT, "CMDOUT"},
{PHASE_STATIN, "STATIN"}, {PHASE_MSGOUT, "MSGOUT"}, {PHASE_MSGIN, "MSGIN"},
@@ -338,7+338,7 @@ void aha152x_done( int error ); void aha152x_setup( char *str, int *ints );
static void aha152x_reset_ports(void);
-static void aha152x_panic(char *msg);
+static void aha152x_panic(const char *msg);
static void disp_ports(void);
static void show_command(Scsi_Cmnd *ptr);
@@ -2274,7+2274,7 @@ void aha152x_intr( int irqno, struct pt_regs * regs ) /*
* Dump the current driver status and panic...
*/
-static void aha152x_panic(char *msg)
+static void aha152x_panic(const char *msg)
{
printk("\naha152x_panic: %s\n", msg);
show_queues();
@@ -713,7+713,7 @@ static void setup_mailboxes(int bse, struct Scsi_Host * shpnt) aha1542_intr_reset(bse);
}
-static int aha1542_getconfig(int base_io, unsigned char * irq_level, unsigned char * dma_chan)
+static int aha1542_getconfig(int base_io, unsigned char * irq_level, unsigned char * dma_chan, unsigned char * scsi_id)
{
unchar inquiry_cmd[] = {CMD_RETCONF };
unchar inquiry_result[3];
@@ -775,6+775,7 @@ static int aha1542_getconfig(int base_io, unsigned char * irq_level, unsigned ch printk("Unable to determine Adaptec IRQ level. Disabling board\n");
return -1;
};
+ *scsi_id=inquiry_result[2] & 7;
return 0;
}
@@ -855,7+856,7 @@ static int aha1542_query(int base_io, int * transl) /* called from init/main.c */
void aha1542_setup( char *str, int *ints)
{
- char *ahausage = "aha1542: usage: aha1542=<PORTBASE>[,<BUSON>,<BUSOFF>[,<DMASPEED>]]\n";
+ const char *ahausage = "aha1542: usage: aha1542=<PORTBASE>[,<BUSON>,<BUSOFF>[,<DMASPEED>]]\n";
static int setup_idx = 0;
int setup_portbase;
@@ -918,6+919,7 @@ int aha1542_detect(Scsi_Host_Template * tpnt) {
unsigned char dma_chan;
unsigned char irq_level;
+ unsigned char scsi_id;
unsigned long flags;
unsigned int base_io;
int trans;
@@ -977,9+979,9 @@ int aha1542_detect(Scsi_Host_Template * tpnt) }
if(aha1542_query(base_io, &trans)) goto unregister;
- if (aha1542_getconfig(base_io, &irq_level, &dma_chan) == -1) goto unregister;
+ if (aha1542_getconfig(base_io, &irq_level, &dma_chan, &scsi_id) == -1) goto unregister;
- printk("Configuring Adaptec at IO:%x, IRQ %d",base_io, irq_level);
+ printk("Configuring Adaptec (SCSI-ID %d) at IO:%x, IRQ %d", scsi_id, base_io, irq_level);
if (dma_chan != 0xFF)
printk(", DMA priority %d", dma_chan);
printk("\n");
*
* -- Daniel M. Eischen, deischen@iworks.InterWorks.org, 04/03/95
*
- * $Id: aic7xxx.c,v 1.49 1995/06/28 05:41:09 deang Exp $
+ * $Id: aic7xxx.c,v 2.0 1995/08/02 05:28:42 deang Exp $
*-M*************************************************************************/
#ifdef MODULE
#include <stdarg.h>
#include <asm/io.h>
#include <linux/string.h>
+#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/bios32.h>
#include "hosts.h"
#include "aic7xxx.h"
-#define AIC7XXX_C_VERSION "$Revision: 1.49 $"
+#define AIC7XXX_C_VERSION "$Revision: 2.0 $"
#define NUMBER(arr) (sizeof(arr) / sizeof(arr[0]))
-#define MIN(a,b) ((a < b) ? a : b)
+#define MIN(a,b) ((a < b) ? a : b)
+#ifndef TRUE
+# define TRUE 1
+#endif
+#ifndef FALSE
+# define FALSE 0
+#endif
/*
* Defines for PCI bus support, testing twin bus support, DMAing of
@@ -395,13+402,26 @@ typedef enum { /*
* Board Control (p. 3-43)
*/
-#define BCTL(x) ((x) + 0xC84ul)
+#define BCTL(x) ((x) + 0xC84ul)
/* RSVD 0xF0 */
#define ACE 0x08 /* Support for external processors */
/* RSVD 0x06 */
#define ENABLE 0x01
-#define BUSSPD(x) ((x) + 0xC86ul) /* FIFO threshold bits ? */
+/*
+ * Bus On/Off Time (p. 3-44)
+ */
+#define BUSTIME(x) ((x) + 0xC85ul)
+#define BOFF 0xF0
+#define BON 0x0F
+
+/*
+ * Bus Speed (p. 3-45)
+ */
+#define BUSSPD(x) ((x) + 0xC86ul)
+#define DFTHRSH 0xC0
+#define STBOFF 0x38
+#define STBON 0x07
/*
* Host Control (p. 3-47) R/W
@@ -719,13+739,45 @@ struct seeprom_config { * to zero inside the kernel - we have to initialize them all
* explicitly.
*
- * We support a maximum of one adapter card per IRQ level (see the
- * rationale for this above). On an interrupt, use the IRQ as an
- * index into aic7xxx_boards[] to locate the card information.
+ * We support multiple adapter cards per interrupt, but keep a
+ * linked list of Scsi_Host structures for each IRQ. On an interrupt,
+ * use the IRQ as an index into aic7xxx_boards[] to locate the card
+ * information.
*/
static struct Scsi_Host *aic7xxx_boards[MAXIRQ + 1];
/*
+ * When we detect and register the card, it is possible to
+ * have the card raise a spurious interrupt. Because we need
+ * to support multiple cards, we cannot tell which card caused
+ * the spurious interrupt. And, we might not even have added
+ * the card info to the linked list at the time the spurious
+ * interrupt gets raised. This variable is suppose to keep track
+ * of when we are registering a card and how many spurious
+ * interrupts we have encountered.
+ *
+ * 0 - do not allow spurious interrupts.
+ * 1 - allow 1 spurious interrupt
+ * 2 - have 1 spurious interrupt, do not allow any more.
+ *
+ * I've made it an integer instead of a boolean in case we
+ * want to allow more than one spurious interrupt for debugging
+ * purposes. Otherwise, it could just go from true to false to
+ * true (or something like that).
+ *
+ * When the driver detects the cards, we'll set the count to 1
+ * for each card detection and registration. After the registration
+ * of a card completes, we'll set the count back to 0. So far, it
+ * seems to be enough to allow a spurious interrupt only during
+ * card registration; if a spurious interrupt is going to occur,
+ * this is where it happens.
+ *
+ * We should be able to find a way to avoid getting the spurious
+ * interrupt. But until we do, we have to keep this ugly code.
+ */
+static int aic7xxx_spurious_count;
+
+/*
* The driver keeps up to four scb structures per card in memory. Only the
* first 26 bytes of the structure are valid for the hardware, the rest used
* for driver level bookeeping. The driver is further optimized
@@ -801,7+853,7 @@ struct aic7xxx_scb {
static struct {
unsigned char errno;
- char *errmesg;
+ const char *errmesg;
} hard_error[] = {
{ ILLHADDR, "Illegal Host Access" },
{ ILLSADDR, "Illegal Sequencer Address referrenced" },
@@ -872,7+924,7 @@ struct aic7xxx_host_config { static struct {
short period;
short rate;
- char *english;
+ const char *english;
} aic7xxx_syncrates[] = {
{ 100, 0, "10.0" },
{ 125, 1, "8.0" },
@@ -911,7+963,7 @@ debug_config(struct aic7xxx_host_config *p)
static int DFT[] = { 0, 50, 75, 100 };
static int SST[] = { 256, 128, 64, 32 };
- static char *BUSW[] = { "", "-TWIN", "-WIDE" };
+ static const char *BUSW[] = { "", "-TWIN", "-WIDE" };
host_conf = inb(HA_HOSTCONF(p->base));
scsi_conf = inb(HA_SCSICONF(p->base));
@@ -925,14+977,14 @@ debug_config(struct aic7xxx_host_config *p) */
if ((p->type == AIC_274x) || (p->type == AIC_284x))
{
- brelease = scsi_conf & 0x3F;
dfthresh = host_conf >> 6;
}
else
{
- brelease = p->busrtime;
dfthresh = scsi_conf >> 6;
}
+
+ brelease = p->busrtime;
if (brelease == 0)
{
brelease = 2;
@@ -1031,7+1083,7 @@ aic7xxx_setup(char *s, int *dummy) char *p;
static struct {
- char *name;
+ const char *name;
int *flag;
} options[] = {
{ "extended", &aic7xxx_extended },
@@ -1124,7+1176,7 @@ aic7xxx_delay(int seconds) {
unsigned long i;
- i = jiffies + (seconds * 100); /* compute time to stop */
+ i = jiffies + (seconds * HZ); /* compute time to stop */
while (jiffies < i)
{
@@ -1327,7+1379,7 @@ aic7xxx_length(Scsi_Cmnd *cmd, int sg_last) length = cmd->request_bufflen;
}
- return(length);
+ return (length);
}
/*+F*************************************************************************
@@ -1380,7+1432,7 @@ aic7xxx_isr(int irq, struct pt_regs * regs) unsigned char active, ha_flags, transfer;
unsigned char scsi_id, bus_width;
unsigned char offset, rate, scratch;
- unsigned char max_offset;
+ unsigned char max_offset, rej_byte;
unsigned char head, tail;
unsigned short target_mask;
long flags;
@@ -1389,40+1441,58 @@ aic7xxx_isr(int irq, struct pt_regs * regs) int target, tcl;
int scbptr;
Scsi_Cmnd *cmd;
-#if 0
-static int_count = 0;
-#endif
p = (struct aic7xxx_host *) aic7xxx_boards[irq]->hostdata;
-#ifdef AIC7XXX_SHARE_IRQS
+
/*
- * Search for the host with a pending interrupt.
+ * Search for the host with a pending interrupt. If we can't find
+ * one, then we've encountered a spurious interrupt.
*/
while ((p != NULL) && !(inb(INTSTAT(p->base)) & INT_PEND))
{
- p = (struct aic7xxx_host *) p->next->hostdata;
+ if (p->next == NULL)
+ {
+ p = NULL;
+ }
+ else
+ {
+ p = (struct aic7xxx_host *) p->next->hostdata;
+ }
}
+
if (p == NULL)
{
- printk("aic7xxx_isr: Encountered spurious interrupt.\n");
- return;
- }
-#endif
- base = p->base;
- if (p->isr_count == 0xffffffff)
- {
- p->isr_count = 0;
- }
- else
- {
- p->isr_count = p->isr_count + 1;
+ if (aic7xxx_spurious_count == 1)
+ {
+ aic7xxx_spurious_count = 2;
+ printk("aic7xxx_isr: Encountered spurious interrupt.\n");
+ return;
+ }
+ else
+ {
+ /*
+ * The best we can do is to set p back to head of list and process
+ * the erroneous interrupt - most likely a BRKADRINT.
+ */
+ p = (struct aic7xxx_host *) aic7xxx_boards[irq]->hostdata;
+ }
}
+
+ p->isr_count++; /* Keep track of interrupts for /proc/scsi */
+
if ((p->a_scanned == 0) && (p->isr_count == 1))
{
- /* Allow for one interrupt when the card is enabled. */
+ /*
+ * We must only have one card at this IRQ and it must have been
+ * added to the board data before the spurious interrupt occurred.
+ * It is sufficient that we check isr_count and not the spurious
+ * interrupt count.
+ */
+ printk("aic7xxx_isr: Encountered spurious interrupt.\n");
return;
}
+ base = p->base;
/*
* Handle all the interrupt sources - especially for SCSI
* interrupts, we won't get a second chance at them.
@@ -1462,10+1532,26 @@ static int_count = 0; {
case BAD_PHASE:
panic("aic7xxx_isr: unknown scsi bus phase\n");
+ break;
case SEND_REJECT:
- debug("aic7xxx_isr warning: issuing message reject, 1st byte 0x%x\n",
- inb(HA_REJBYTE(base)));
+ rej_byte = inb(HA_REJBYTE(base));
+ scsi_id = inb(SCSIID(base)) >> 0x04;
+ scbptr = inb(SCBPTR(base));
+ scb = &(p->scb_array[scbptr]);
+ if (rej_byte != 0x20)
+ {
+ debug("aic7xxx_isr warning: issuing message reject, 1st byte 0x%x\n",
+ rej_byte);
+ }
+ else
+ {
+ printk("aic7xxx_isr warning: Tagged message rejected for target %d,"
+ " channel %c.\n",
+ scsi_id, (inb(SBLKCTL(base)) & SELBUSB ? 'B': 'A'));
+ scb->cmd->device->tagged_supported = 0;
+ scb->cmd->device->tagged_queue = 0;
+ }
break;
case NO_IDENT:
@@ -1572,7+1658,7 @@ static int_count = 0; /*
* Send our own SDTR in reply.
*/
- printk("Sending SDTR!!\n");
+ printk("aic7xxx_isr: Sending SDTR!!\n");
outb(SEND_SDTR, HA_RETURN_1(base));
}
}
@@ -1591,7+1677,7 @@ static int_count = 0; {
scsi_id = scsi_id + 8; /* B channel */
}
- printk("Received MSG_WDTR, scsi_id = %d, "
+ printk("aic7xxx_isr: Received MSG_WDTR, scsi_id = %d, "
"needwdtr = 0x%x\n", scsi_id, p->needwdtr);
scratch = inb(HA_TARG_SCRATCH(base) + scsi_id);
@@ -1620,7+1706,7 @@ static int_count = 0; /*
* Send our own WDTR in reply.
*/
- printk("Will send WDTR!!\n");
+ printk("aic7xxx_isr: Will send WDTR!!\n");
switch (bus_width)
{
case BUS_8_BIT:
@@ -1769,13+1855,13 @@ static int_count = 0; sizeof(scb->SCSI_cmd_pointer));
#ifdef AIC7XXX_USE_SG
scb->SG_segment_count = 1;
- memcpy (scb->SG_list_pointer, &req_buf,
+ memcpy(scb->SG_list_pointer, &req_buf,
sizeof(scb->SG_list_pointer));
#else
scb->SG_segment_count = 0;
- memcpy (scb->data_pointer, &req_buf,
+ memcpy(scb->data_pointer, &req_buf,
sizeof(scb->data_pointer));
- memcpy (scb->data_count, &req_buflen, 3);
+ memcpy(scb->data_count, &req_buflen, 3);
#endif
outb(SCBAUTO, SCBCNT(base));
@@ -1935,7+2021,7 @@ static int_count = 0; scb->next = p->free_scb; /* preserve next pointer */
p->free_scb = scb; /* add at head of list */
- restore_flags (flags);
+ restore_flags(flags);
cmd->result = (DID_RETRY_COMMAND << 16);
cmd->scsi_done(cmd);
}
@@ -1964,8+2050,8 @@ static int_count = 0; }
else
{
- panic ("aic7xxx_isr: AWAITING_SCB for an SCB that does "
- "not have a waiting message");
+ panic("aic7xxx_isr: AWAITING_SCB for an SCB that does "
+ "not have a waiting message");
}
}
break;
@@ -2121,7+2207,7 @@ static int_count = 0; }
else
{
- if (! (status & BUSFREE))
+ if (!(status & BUSFREE))
{
/*
* We don't know what's going on. Turn off the
@@ -2268,14+2354,14 @@ aic7xxx_probe(int slot, int base) {
if (inb(base + 4) & 1)
{
- return(AIC7xxx[i].type);
+ return (AIC7xxx[i].type);
}
printk("aic7xxx disabled at slot %d, ignored\n", slot);
}
}
- return(AIC_NONE);
+ return (AIC_NONE);
}
/*+F*************************************************************************
@@ -2362,7+2448,7 @@ read_seeprom(int base, struct seeprom_config *sc) }
if ((inb(SEECTL(base)) & SEERDY) == 0)
{
- outb (0, SEECTL(base));
+ outb(0, SEECTL(base));
return (0);
}
@@ -2372,7+2458,7 @@ read_seeprom(int base, struct seeprom_config *sc) * but only the first 32 are used by Adaptec BIOS. The loop
* will range from 0 to 31.
*/
- for (k = 0; k < (sizeof(*sc) / 2); k = k + 1)
+ for (k = 0; k < (sizeof(*sc) / 2); k++)
{
/* Send chip select for one clock cycle. */
outb(SEEMS | SEECK | SEECS, SEECTL(base));
@@ -2382,7+2468,7 @@ read_seeprom(int base, struct seeprom_config *sc) * Now we're ready to send the read command followed by the
* address of the 16-bit register we want to read.
*/
- for (i = 0; i < seeprom_read.len; i = i + 1)
+ for (i = 0; i < seeprom_read.len; i++)
{
temp = SEEMS | SEECS | (seeprom_read.bits[i] << 1);
outb(temp, SEECTL(base));
@@ -2392,7+2478,7 @@ read_seeprom(int base, struct seeprom_config *sc) CLOCK_PULSE(base);
}
/* Send the 6 bit address (MSB first, LSB last). */
- for (i = 5; i >= 0; i = i - 1)
+ for (i = 5; i >= 0; i--)
{
temp = k;
temp = (temp >> i) & 1; /* Mask out all but lower bit. */
@@ -2410,7+2496,7 @@ read_seeprom(int base, struct seeprom_config *sc) * with bit 0 (LSB). The initial 0 will be shifted off the
* top of our word as we let the loop run from 0 to 16.
*/
- for (i = 0; i <= 16; i = i + 1)
+ for (i = 0; i <= 16; i++)
{
temp = SEEMS | SEECS;
outb(temp, SEECTL(base));
@@ -2443,22+2529,22 @@ read_seeprom(int base, struct seeprom_config *sc)
if (checksum != sc->checksum)
{
- printk ("aic7xxx : SEEPROM checksum error, ignoring SEEPROM settings.\n");
+ printk("aic7xxx: SEEPROM checksum error, ignoring SEEPROM settings.\n");
return (0);
}
#if 0
- printk ("Computed checksum 0x%x, checksum read 0x%x\n", checksum, sc->checksum);
- printk ("Serial EEPROM:");
- for (k = 0; k < (sizeof(*sc) / 2); k = k + 1)
+ printk("Computed checksum 0x%x, checksum read 0x%x\n", checksum, sc->checksum);
+ printk("Serial EEPROM:");
+ for (k = 0; k < (sizeof(*sc) / 2); k++)
{
if (((k % 8) == 0) && (k != 0))
{
- printk ("\n ");
+ printk("\n ");
}
- printk (" 0x%x", seeprom[k]);
+ printk(" 0x%x", seeprom[k]);
}
- printk ("\n");
+ printk("\n");
#endif
/* Release access to the memory port and the serial EEPROM. */
@@ -2531,7+2617,7 @@ detect_maxscb(aha_type type, int base) break;
}
- return(maxscb);
+ return (maxscb);
}
/*+F*************************************************************************
@@ -2545,13+2631,13 @@ static int aic7xxx_register(Scsi_Host_Template *template, aha_type type,
int base, unsigned char irq)
{
- static char * board_name[] = {"", "274x", "284x", "7870", "7850", "7872"};
+ static const char * board_name[] = {"", "274x", "284x", "7870", "7850", "7872"};
int i;
unsigned char sblkctl;
int max_targets;
int found = 1;
unsigned char target_settings;
- unsigned char scsi_conf;
+ unsigned char scsi_conf, host_conf;
int have_seeprom = 0;
struct Scsi_Host *host;
struct aic7xxx_host *p;
@@ -2574,7+2660,7 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, switch (type)
{
case AIC_274x:
-#if 1
+#if 0
printk("aha274x: aic7770 hcntrl=0x%x\n", inb(HCNTRL(config.base)));
#endif
/*
@@ -2622,7+2708,12 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, * since there was some issue about reseting the board.
*/
config.irq = inb(HA_INTDEF(config.base)) & 0x0F;
- config.busrtime = inb(HA_SCSICONF(config.base)) & 0x3C;
+ host_conf = inb(HA_HOSTCONF(config.base));
+ config.busrtime = host_conf & 0x3C;
+ /* XXX Is this valid for motherboard based controllers? */
+ /* Setup the FIFO threshold and the bus off time */
+ outb(host_conf & DFTHRSH, BUSSPD(config.base));
+ outb((host_conf << 2) & BOFF, BUSTIME(config.base));
/*
* A reminder until this can be detected automatically.
@@ -2632,7+2723,7 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, break;
case AIC_284x:
-#if 1
+#if 0
printk("aha284x: aic7770 hcntrl=0x%x\n", inb(HCNTRL(config.base)));
#endif
outb(CHIPRST, HCNTRL(config.base));
@@ -2640,6+2731,12 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, config.pause = REQ_PAUSE; /* DWG would like to be like the rest */
config.extended = aic7xxx_extended;
config.irq = inb(HA_INTDEF(config.base)) & 0x0F;
+ host_conf = inb(HA_HOSTCONF(config.base));
+ config.busrtime = host_conf & 0x3C;
+ /* XXX Is this valid for motherboard based controllers? */
+ /* Setup the FIFO threshold and the bus off time */
+ outb(host_conf & DFTHRSH, BUSSPD(config.base));
+ outb((host_conf << 2) & BOFF, BUSTIME(config.base));
/*
* A reminder until this can be detected automatically.
@@ -2651,7+2748,7 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, case AIC_7850:
case AIC_7870:
case AIC_7872:
-#if 1
+#if 0
printk("aic%s hcntrl=0x%x\n", board_name[type], inb(HCNTRL(config.base)));
#endif
@@ -2661,15+2758,15 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, config.extended = aic7xxx_extended;
config.scsi_id = 7;
- printk ("aic78xx: Reading SEEPROM... ");
+ printk("aic78xx: Reading SEEPROM... ");
have_seeprom = read_seeprom(base, &sc);
- if (! have_seeprom)
+ if (!have_seeprom)
{
- printk ("Unable to read SEEPROM\n");
+ printk("aic78xx: unable to read SEEPROM\n");
}
else
{
- printk ("done\n");
+ printk("done\n");
config.extended = (sc.bios_control & CFEXTEND) >> 7;
config.scsi_id = (sc.brtime_id & CFSCSIID);
config.parity = (sc.adapter_control & CFSPARITY) ?
@@ -2734,7+2831,7 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, case 2: /* Wide bus */
config.scsi_id = inb(HA_SCSICONF(base) + 1) & 0x0F;
config.bus_type = AIC_WIDE;
- printk("aic7xxx : Enabling wide channel of %s-Wide\n",
+ printk("aic7xxx: Enabling wide channel of %s-Wide\n",
board_name[config.type]);
outb(WIDE_BUS, HA_FLAGS(base));
break;
@@ -2744,12+2841,12 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, #ifdef AIC7XXX_TWIN_SUPPORT
config.scsi_id_b = inb(HA_SCSICONF(base) + 1) & 0x07;
config.bus_type = AIC_TWIN;
- printk("aic7xxx : Enabled channel B of %s-Twin\n",
+ printk("aic7xxx: Enabled channel B of %s-Twin\n",
board_name[config.type]);
outb(TWIN_BUS, HA_FLAGS(base));
#else
config.bus_type = AIC_SINGLE;
- printk("aic7xxx : Channel B of %s-Twin will be ignored\n",
+ printk("aic7xxx: Channel B of %s-Twin will be ignored\n",
board_name[config.type]);
outb(0, HA_FLAGS(base));
#endif
@@ -2759,7+2856,7 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, printk("aic7xxx is an unsupported type 0x%x, please "
"mail deang@ims.com\n", inb(SBLKCTL(base)));
outb(0, HA_FLAGS(base));
- return(0);
+ return (0);
}
/*
@@ -2784,7+2881,7 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, && (config.irq < 9 || config.irq > 15))
{
printk("aic7xxx uses unsupported IRQ level, ignoring\n");
- return(0);
+ return (0);
}
/*
@@ -2798,7+2895,7 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, if (aic7xxx_boards[config.irq] != NULL)
{
printk("aic7xxx_register: Sharing of IRQs is not configured.\n");
- return(0);
+ return (0);
}
#endif
@@ -2857,7+2954,7 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, p = (struct aic7xxx_host *) host->hostdata;
/* Initialize the scb array by setting the state to free. */
- for (i = 0; i < AIC7XXX_MAXSCB; i = i + 1)
+ for (i = 0; i < AIC7XXX_MAXSCB; i++)
{
p->scb_array[i].state = SCB_FREE;
p->scb_array[i].next = NULL;
@@ -2884,14+2981,23 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, if (aic7xxx_boards[config.irq] == NULL)
{
/*
+ * Warning! This must be done before requesting the irq. It is
+ * possible for some boards to raise an interrupt as soon as
+ * they are enabled. So when we request the irq from the Linux
+ * kernel, an interrupt is triggered immediately. Therefore, we
+ * must ensure the board data is correctly set before the request.
+ */
+ aic7xxx_boards[config.irq] = host;
+
+ /*
* Register IRQ with the kernel.
*/
if (request_irq(config.irq, aic7xxx_isr, SA_INTERRUPT, "aic7xxx"))
{
printk("aic7xxx couldn't register irq %d, ignoring\n", config.irq);
- return(0);
+ aic7xxx_boards[config.irq] = NULL;
+ return (0);
}
- aic7xxx_boards[config.irq] = host;
}
else
{
@@ -2966,7+3072,7 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, max_targets = 16;
}
- for (i = 0; i < max_targets; i = i + 1)
+ for (i = 0; i < max_targets; i++)
{
if (have_seeprom)
{
@@ -3007,14+3113,16 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type,
p->needsdtr = p->needsdtr_copy;
p->needwdtr = p->needwdtr_copy;
+#if 0
printk("NeedSdtr = 0x%x, 0x%x\n", p->needsdtr_copy, p->needsdtr);
printk("NeedWdtr = 0x%x, 0x%x\n", p->needwdtr_copy, p->needwdtr);
+#endif 0
- /*
+ /*
* Clear the control byte for every SCB so that the sequencer
* doesn't get confused and think that one of them is valid
*/
- for (i = 0; i < config.maxscb; i = i + 1)
+ for (i = 0; i < config.maxscb; i++)
{
outb(i, SCBPTR(base));
outb(0, SCBARRAY(base));
@@ -3052,6+3160,21 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, if (!aic7xxx_no_reset)
{
printk("Resetting the SCSI bus...\n");
+ if (p->bus_type == AIC_TWIN)
+ {
+ /*
+ * Select channel B.
+ */
+ outb(2, SBLKCTL(base));
+ outb(SCSIRSTO, SCSISEQ(base));
+ udelay(1000);
+ outb(0, SCSISEQ(base));
+ /*
+ * Select channel A.
+ */
+ outb(0, SBLKCTL(base));
+ }
+
outb(SCSIRSTO, SCSISEQ(base));
udelay(1000);
outb(0, SCSISEQ(base));
@@ -3064,7+3187,7 @@ aic7xxx_register(Scsi_Host_Template *template, aha_type type, * command is sent to us by the high-level SCSI code.
*/
UNPAUSE_SEQUENCER(p);
- return(found);
+ return (found);
}
/*+F*************************************************************************
@@ -3095,6+3218,11 @@ aic7xxx_detect(Scsi_Host_Template *template) }
/*
+ * Initialize the spurious count to 0.
+ */
+ aic7xxx_spurious_count = 0;
+
+ /*
* EISA/VL-bus card signature probe.
*/
for (slot = MINSLOT; slot <= MAXSLOT; slot++)
@@ -3113,8+3241,13 @@ aic7xxx_detect(Scsi_Host_Template *template) type = aic7xxx_probe(slot, HID0(base));
if (type != AIC_NONE)
{
- printk("aic7xxx: hcntrl=0x%x\n", inb(HCNTRL(base)));
+ /*
+ * We found a card, allow 1 spurious interrupt.
+ */
+ aic7xxx_spurious_count = 1;
+
#if 0
+ printk("aic7xxx: hcntrl=0x%x\n", inb(HCNTRL(base)));
outb(inb(HCNTRL(base)) | CHIPRST, HCNTRL(base));
irq = inb(HA_INTDEF(base)) & 0x0F;
#endif
@@ -3125,6+3258,11 @@ aic7xxx_detect(Scsi_Host_Template *template) * it with the kernel without incident.
*/
found += aic7xxx_register(template, type, base, irq);
+
+ /*
+ * Disallow spurious interrupts.
+ */
+ aic7xxx_spurious_count = 0;
}
}
@@ -3135,10+3273,6 @@ aic7xxx_detect(Scsi_Host_Template *template) #define DEVSTATUS 0x41
#define RAMPSM 0x02
-/* This should be defined in pci.h */
-#define PCI_DEVICE_ID_ADAPTEC_7850 0x5078
-#define PCI_DEVICE_ID_ADAPTEC_7872 0x7278
-
/*
* PCI-bus probe.
*/
@@ -3212,36+3346,51 @@ aic7xxx_detect(Scsi_Host_Template *template) */
base = io_port - 0xC01;
+ /*
+ * I don't think we need to bother with allowing
+ * spurious interrupts for the 787x/7850, but what
+ * the hey.
+ */
+ aic7xxx_spurious_count = 1;
+
+#if 0
printk("aic7xxx: hcntrl=0x%x\n", inb(HCNTRL(base)));
+#endif
outb(inb(HCNTRL(base)) | CHIPRST, HCNTRL(base));
error = pcibios_read_config_byte(pci_bus, pci_device_fn,
DEVREVID, &devrevid);
if (devrevid < 3)
{
- printk ("aic7xxx_detect: AIC-7870 Rev %c\n", rev_id[devrevid]);
+ printk("aic7xxx_detect: AIC-7870 Rev %c\n", rev_id[devrevid]);
}
error = pcibios_read_config_byte(pci_bus, pci_device_fn,
DEVCONFIG, &devconfig);
error = pcibios_read_config_byte(pci_bus, pci_device_fn,
DEVSTATUS, &devstatus);
- printk ("aic7xxx_detect: devconfig 0x%x, devstatus 0x%x\n",
- devconfig, devstatus);
+ printk("aic7xxx_detect: devconfig 0x%x, devstatus 0x%x\n",
+ devconfig, devstatus);
if (devstatus & RAMPSM)
{
- printk ("aic7xxx_detect: detected external SCB RAM, "
- "mail deang@ims.com for test patch");
+ printk("aic7xxx_detect: detected external SCB RAM, "
+ "mail deang@ims.com for test patch");
}
found += aic7xxx_register(template, type, base, irq);
+
+ /*
+ * Disable spurious interrupts.
+ */
+ aic7xxx_spurious_count = 0;
+
index += 1;
}
}
}
#endif CONFIG_PCI
- template->name = (char *) aic7xxx_info(NULL);
- return(found);
+ template->name = aic7xxx_info(NULL);
+ return (found);
}
@@ -3270,8+3419,8 @@ aic7xxx_buildscb(struct aic7xxx_host *p, {
if (cmd->device->tagged_queue == 0)
{
- printk ("aic7xxx_buildscb: Enabling tagged queuing for target %d, "
- "channel %d\n", cmd->target, cmd->channel);
+ printk("aic7xxx_buildscb: Enabling tagged queuing for target %d, "
+ "channel %d\n", cmd->target, cmd->channel);
cmd->device->tagged_queue = 1;
cmd->device->current_tag = 1; /* enable tagging */
}
@@ -3346,8+3495,8 @@ aic7xxx_buildscb(struct aic7xxx_host *p, else
{
#if 0
- debug ("aic7xxx_buildscb: Creating scatterlist, addr=0x%lx, length=%d.\n",
- (unsigned long) cmd->request_buffer, cmd->request_bufflen);
+ debug("aic7xxx_buildscb: Creating scatterlist, addr=0x%lx, length=%d.\n",
+ (unsigned long) cmd->request_buffer, cmd->request_bufflen);
#endif
#ifdef AIC7XXX_USE_SG
scb->SG_segment_count = 1;
@@ -3455,7+3604,7 @@ aic7xxx_queue(Scsi_Cmnd *cmd, void (*fn)(Scsi_Cmnd *)) memset(scb, 0, sizeof(*scb));
scb->position = p->numscb;
- p->numscb = p->numscb + 1;
+ p->numscb++;
scb->state = SCB_ACTIVE;
scb->next_waiting = SCB_LIST_NULL;
memcpy(scb->host_scb, &scb, sizeof(scb));
@@ -3526,11+3675,11 @@ aic7xxx_queue(Scsi_Cmnd *cmd, void (*fn)(Scsi_Cmnd *)) aic7xxx_status(cmd) = 0;
cmd->result = 0;
- memset (&cmd->sense_buffer, 0, sizeof (cmd->sense_buffer));
+ memset(&cmd->sense_buffer, 0, sizeof(cmd->sense_buffer));
UNPAUSE_SEQUENCER(p);
restore_flags(flags);
- return(0);
+ return (0);
}
/* return values from aic7xxx_kill */
@@ -3597,7+3746,7 @@ aic7xxx_kill(Scsi_Cmnd *cmd, unsigned char message, if (scbsave[i] == scb->position)
{
found = 1;
- i = i - 1;
+ i--;
}
}
@@ -3722,7+3871,7 @@ complete: p->free_scb = scb; /* add at head of free list */
cmd->result = cmd->result << 16;
cmd->scsi_done(cmd);
- return(status);
+ return (status);
}
/*+F*************************************************************************
@@ -3751,7+3900,7 @@ aic7xxx_abort(Scsi_Cmnd *cmd) }
restore_flags(flags);
- return(rv);
+ return (rv);
}
/*+F*************************************************************************
@@ -3836,7+3985,7 @@ aic7xxx_reset(Scsi_Cmnd *cmd) }
restore_flags(flags);
- return(SCSI_RESET_SUCCESS);
+ return (SCSI_RESET_SUCCESS);
}
/*+F*************************************************************************
@@ -3874,7+4023,7 @@ aic7xxx_biosparam(Disk *disk, int devno, int geom[]) geom[1] = sectors;
geom[2] = cylinders;
- return(0);
+ return (0);
}
#ifdef MODULE
@@ -3884,3+4033,21 @@ Scsi_Host_Template driver_template = AIC7XXX; #include "scsi_module.c"
#endif
+/*
+ * Overrides for Emacs so that we almost follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only. This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-indent-level: 2
+ * c-brace-imaginary-offset: 0
+ * c-brace-offset: -2
+ * c-argdecl-indent: 2
+ * c-label-offset: -2
+ * c-continued-statement-offset: 2
+ * c-continued-brace-offset: 0
+ * indent-tabs-mode: nil
+ * tab-width: 8
+ * End:
+ */
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: aic7xxx.h,v 1.18 1995/06/22 04:17:56 deang Exp $
+ * $Id: aic7xxx.h,v 2.0 1995/08/02 05:28:42 deang Exp $
*-M*************************************************************************/
#ifndef _aic7xxx_h
#define _aic7xxx_h
-#define AIC7XXX_H_VERSION "$Revision: 1.18 $"
+#define AIC7XXX_H_VERSION "$Revision: 2.0 $"
/*
* Scsi_Host_Template (see hosts.h) for AIC-7770/AIC-7870 - some fields
#
# Copyright (c) 1994 John Aycock
# The University of Calgary Department of Computer Science.
-# All rights reserved.
#
# Modifications/enhancements:
# Copyright (c) 1994, 1995 Justin Gibbs. All rights reserved.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions, and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by the University of Calgary
-# Department of Computer Science and its contributors.
-# 4. Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to
+# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#
# FreeBSD, Twin, Wide, 2 command per target support, tagged queuing and other
# optimizations provided by Justin T. Gibbs (gibbs@FreeBSD.org)
-#
##-M#########################################################################
-VERSION AIC7XXX_SEQ_VER "$Id: aic7xxx.seq,v 1.19 1995/06/05 06:11:41 deang Exp $"
+VERSION AIC7XXX_SEQ_VER "$Id: aic7xxx.seq,v 2.0 1995/08/02 05:28:42 deang Exp $"
SCBMASK = 0x1f
*
* A <label> is an <undef-sym> ending in a colon. Spaces, tabs, and commas
* are token separators.
- *
*-M*************************************************************************/
-static char id[] = "$Id: aic7xxx_asm.c,v 1.8 1995/05/25 06:25:36 root Exp $";
+static char id[] = "$Id: aic7xxx_asm.c,v 2.0 1995/08/02 05:28:42 deang Exp $";
#include <ctype.h>
#include <stdio.h>
#include <string.h>
@@ -56,7+55,7 @@ FILE *ifp, *ofp; unsigned char M[MEMORY][4];
void
-error(char *s)
+error(const char *s)
{
fprintf(stderr, "%s: %s at line %d\n", filename, s, lineno);
exit(EXIT_FAILURE);
@@ -262,7+261,7 @@ rescan: #define NA -1 /* not applicable */
struct {
- char *name;
+ const char *name;
int n; /* number of operands, including opcode */
unsigned int op; /* immediate or L?|pos_from_0 */
unsigned int dest; /* NA, pos_from_0, or I|immediate */
@@ -329,7+328,7 @@ eval_operand(char **a, int spec)
static struct {
unsigned int what;
- char *name;
+ const char *name;
int value;
} jmptab[] = {
{ LO, "jmp", 8 },
@@ -154,13+154,13 @@ void print_status (int status) { struct error_info{
unsigned char code1, code2;
unsigned short int devices;
- char * text;
+ const char * text;
};
struct error_info2{
unsigned char code1, code2_min, code2_max;
unsigned short int devices;
- char * text;
+ const char * text;
};
static struct error_info2 additional2[] =
@@ -367,7+367,7 @@ static struct error_info additional[] = #endif
#if (CONSTANTS & CONST_SENSE)
-static char *snstext[] = {
+static const char *snstext[] = {
"None","Recovered Error","Not Ready","Medium Error","Hardware Error",
"Illegal Request","Unit Attention","Data Protect","Blank Check",
"Key=9","Copy Aborted","Aborted Command","End-Of-Medium",
@@ -376,12+376,12 @@ static char *snstext[] = {
/* Print sense information */
-void print_sense(char * devclass, Scsi_Cmnd * SCpnt)
+void print_sense(const char * devclass, Scsi_Cmnd * SCpnt)
{
int i, s;
int sense_class, valid, code;
unsigned char * sense_buffer = SCpnt->sense_buffer;
- char * error = NULL;
+ const char * error = NULL;
int dev = SCpnt->request.dev;
sense_class = (sense_buffer[0] >> 4) & 0x07;
#define _CONSTANTS_H
extern void print_command(unsigned char *);
extern int print_msg(unsigned char *);
-extern void print_sense(char *, Scsi_Cmnd *);
+/* extern void print_sense(const char *, Scsi_Cmnd *); */
extern void print_status(int);
extern void print_Scsi_Cmnd (Scsi_Cmnd *);
#endif /* def _CONSTANTS_H */
@@ -310,7+310,7 @@ struct hostdata { };
static struct Scsi_Host * sh[MAX_BOARDS + 1];
-static char* driver_name = "EATA";
+static const char* driver_name = "EATA";
static unsigned int irqlist[MAX_IRQ], calls[MAX_IRQ];
#define HD(board) ((struct hostdata *) &sh[board]->hostdata)
@@ -364,7+364,7 @@ static inline int port_detect(ushort *port_base, unsigned int j, unsigned char irq, dma_channel, subversion;
unsigned char protocol_rev;
struct eata_info info;
- char *board_status;
+ const char *board_status;
/* Allowed DMA channels for ISA (0 indicates reserved) */
unsigned char dma_channel_table[4] = { 5, 6, 7, 0 };
@@ -76,7+76,7 @@ static uint internal_command_finished = TRUE; static ulong int_counter = 0;
static ulong queue_counter = 0;
-void hprint(char *str)
+void hprint(const char *str)
{
char *hptr =(char *) 0x000b0000;
char *hptr2=(char *) 0x000b00a0;
@@ -368,7+368,7 @@ static unsigned short ints[] = { 3, 5, 10, 11, 12, 14, 15, 0 }; */
struct signature {
- char *signature;
+ const char *signature;
int sig_offset;
int sig_length;
int major_bios_version;
@@ -64,7+64,7 @@ typedef struct SHT int (*proc_info)(char *, char **, off_t, int, int, int);
/* driver name that will appear in the /proc/scsi directory */
- char *procname;
+ const char *procname;
/* low_ino of the drivers /proc/scsi entry. Defined in proc_fs.h */
unsigned short low_ino;
@@ -73,7+73,7 @@ typedef struct SHT * The name pointer is a pointer to the name of the SCSI
* device detected.
*/
- char *name;
+ const char *name;
/*
* The detect function shall return non zero on detection,
@@ -335,8+335,8 @@ extern int scsicam_bios_param (Disk *, int, int *); struct Scsi_Device_Template
{
struct Scsi_Device_Template * next;
- char * name;
- char * tag;
+ const char * name;
+ const char * tag;
int * usage_count; /* Used for loadable modules */
unsigned char scsi_type;
unsigned char major;
@@ -175,9+175,9 @@ static void scsi_dump_status(void); #define BLIST_SINGLELUN 0x10
struct dev_info{
- char * vendor;
- char * model;
- char * revision; /* Latest revision known to be bad. Not used yet */
+ const char * vendor;
+ const char * model;
+ const char * revision; /* Latest revision known to be bad. Not used yet */
unsigned flags;
};
@@ -1267,7+1267,7 @@ void scsi_do_cmd (Scsi_Cmnd * SCpnt, const void *cmnd , * the completion function for the high level driver.
*/
- memcpy ((void *) SCpnt->data_cmnd , (void *) cmnd, 12);
+ memcpy ((void *) SCpnt->data_cmnd , (const void *) cmnd, 12);
#if 0
SCpnt->host = host;
SCpnt->channel = channel;
@@ -1282,7+1282,7 @@ void scsi_do_cmd (Scsi_Cmnd * SCpnt, const void *cmnd , SCpnt->done = done;
SCpnt->timeout_per_command = timeout;
- memcpy ((void *) SCpnt->cmnd , (void *) cmnd, 12);
+ memcpy ((void *) SCpnt->cmnd , (const void *) cmnd, 12);
/* Zero the sense buffer. Some host adapters automatically request
* sense on error. 0 is not a valid sense code.
*/
@@ -558,7+558,7 @@ extern void proc_print_scsidevice(Scsi_Device *, char *, int *, int); extern int kernel_scsi_ioctl (Scsi_Device *dev, int cmd, void *arg);
extern int scsi_ioctl (Scsi_Device *dev, int cmd, void *arg);
extern void print_command(unsigned char *);
-extern void print_sense(char *, Scsi_Cmnd *);
+extern void print_sense(const char *, Scsi_Cmnd *);
#if defined(MAJOR_NR) && (MAJOR_NR != SCSI_TAPE_MAJOR)
@@ -95,7+95,7 @@ static int incommand; /* in some command phase.
*/
-static void *base_address = NULL; /*
+static const void *base_address = NULL; /*
Where the card ROM starts,
used to calculate memory mapped
register location.
@@ -153,7+153,7 @@ static const char * seagate_bases[] = { };
typedef struct {
- char *signature ;
+ const char *signature ;
unsigned offset;
unsigned length;
unsigned char type;
@@ -327,10+327,10 @@ int seagate_st0x_detect (Scsi_Host_Template * tpnt)
for (i = 0; i < (sizeof (seagate_bases) / sizeof (char * )); ++i)
for (j = 0; !base_address && j < NUM_SIGNATURES; ++j)
- if (!memcmp ((void *) (seagate_bases[i] +
- signatures[j].offset), (void *) signatures[j].signature,
+ if (!memcmp ((const void *) (seagate_bases[i] +
+ signatures[j].offset), (const void *) signatures[j].signature,
signatures[j].length)) {
- base_address = (void *) seagate_bases[i];
+ base_address = (const void *) seagate_bases[i];
controller_type = signatures[j].type;
}
#endif /* OVERRIDE */
@@ -341,8+341,8 @@ int seagate_st0x_detect (Scsi_Host_Template * tpnt)
if (base_address)
{
- st0x_cr_sr =(void *) (((unsigned char *) base_address) + (controller_type == SEAGATE ? 0x1a00 : 0x1c00));
- st0x_dr = (void *) (((unsigned char *) base_address ) + (controller_type == SEAGATE ? 0x1c00 : 0x1e00));
+ st0x_cr_sr =(void *) (((const unsigned char *) base_address) + (controller_type == SEAGATE ? 0x1a00 : 0x1c00));
+ st0x_dr = (void *) (((const unsigned char *) base_address ) + (controller_type == SEAGATE ? 0x1c00 : 0x1e00));
#ifdef DEBUG
printk("%s detected. Base address = %x, cr = %x, dr = %x\n", tpnt->name, base_address, st0x_cr_sr, st0x_dr);
#endif
@@ -1307,8+1307,8 @@ if (fast && transfersize && !(len % transfersize) && (len >= transfersize) while (((status_read = STATUS) & STAT_BSY) &&
((status_read & REQ_MASK) == REQ_CMDOUT))
if (status_read & STAT_REQ) {
- DATA = *(unsigned char *) cmnd;
- cmnd = 1+(unsigned char *) cmnd;
+ DATA = *(const unsigned char *) cmnd;
+ cmnd = 1+(const unsigned char *) cmnd;
#ifdef SLOW_HANDSHAKE
if (borken)
borken_wait();
@@ -289,7+289,7 @@ static void sg_command_done(Scsi_Cmnd * SCpnt) #define SG_SEND 0
#define SG_REC 1
-static int sg_write(struct inode *inode,struct file *filp,char *buf,int count)
+static int sg_write(struct inode *inode,struct file *filp,const char *buf,int count)
{
int bsize,size,amt,i;
unsigned char cmnd[MAX_COMMAND_SIZE];
@@ -298,7+298,6 @@ static int sg_write(struct inode *inode,struct file *filp,char *buf,int count) int direction;
unsigned char opcode;
Scsi_Cmnd * SCpnt;
- int sgcnt;
if ((i=verify_area(VERIFY_READ,buf,count)))
return i;
@@ -1131,8+1131,6 @@ int init_module(void) {
void cleanup_module( void)
{
- int i;
-
if (MOD_IN_USE) {
printk(KERN_INFO __FILE__ ": module is in use, remove rejected\n");
return;
@@ -117,7+117,7 @@ st_chk_result(Scsi_Cmnd * SCpnt) int dev = SCpnt->request.dev;
int result = SCpnt->result;
unsigned char * sense = SCpnt->sense_buffer, scode;
- char *stp;
+ const char *stp;
if (!result /* && SCpnt->sense_buffer[0] == 0 */ )
return 0;
@@ -753,14+753,14 @@ scsi_tape_close(struct inode * inode, struct file * filp) \f
/* Write command */
static int
-st_write(struct inode * inode, struct file * filp, char * buf, int count)
+st_write(struct inode * inode, struct file * filp, const char * buf, int count)
{
int dev;
int total, do_count, blks, retval, transfer;
int write_threshold;
int doing_write = 0;
static unsigned char cmd[10];
- char *b_point;
+ const char *b_point;
Scsi_Cmnd * SCpnt;
Scsi_Tape * STp;
unsigned int flags;
@@ -275,7+275,7 @@ struct hostdata { };
static struct Scsi_Host * sh[MAX_BOARDS + 1];
-static char* driver_name = "Ux4F";
+static const char* driver_name = "Ux4F";
static unsigned int irqlist[MAX_IRQ], calls[MAX_IRQ];
#define HD(board) ((struct hostdata *) &sh[board]->hostdata)
@@ -204,9+204,9 @@ static const Config configs[] = { * added for the Future Domain version.
*/
typedef struct signature {
- void *sig; /* String to look for */
- unsigned ofs; /* offset from BIOS base address */
- unsigned len; /* length of string */
+ const void *sig; /* String to look for */
+ unsigned ofs; /* offset from BIOS base address */
+ unsigned len; /* length of string */
} Signature;
static const Signature signatures[] = {
@@ -396,7+396,7 @@ probe_pss_mpu (struct address_info *hw_config) }
#ifdef EXCLUDE_MIDI
- return 0
+ return 0;
#else
return probe_mpu401 (hw_config);
#endif
@@ -780,7+780,7 @@ load_elf_library(int fd){ * These are the only things you should do on a core-file: use only these
* functions to write out all the necessary info.
*/
-static int dump_write(struct file *file, void *addr, int nr)
+static int dump_write(struct file *file, const void *addr, int nr)
{
return file->f_op->write(file->f_inode, file, addr, nr) == nr;
}
@@ -818,7+818,7 @@ static inline int maydump(struct vm_area_struct *vma) /* An ELF note in memory */
struct memelfnote
{
- char *name;
+ const char *name;
int type;
unsigned int datasz;
void *data;
@@ -20,7+20,7 @@ extern int *blksize_size[]; #define MAX_BUF_PER_PAGE (PAGE_SIZE / 512)
#define NBUF 64
-int block_write(struct inode * inode, struct file * filp, char * buf, int count)
+int block_write(struct inode * inode, struct file * filp, const char * buf, int count)
{
int blocksize, blocksize_bits, i, j, buffercount,write_error;
int block, blocks;
@@ -197,6+197,9 @@ int block_read(struct inode * inode, struct file * filp, char * buf, int count)
if (offset > size)
left = 0;
+ /* size - offset might not fit into left, so check explicitly. */
+ else if (size - offset > INT_MAX)
+ left = INT_MAX;
else
left = size - offset;
if (left > count)
@@ -104,7+104,7 @@ static inline void update_lru(struct dir_cache_entry * de) */
static inline unsigned long namehash(const char * name, int len)
{
- return len * *(unsigned char *) name;
+ return len * *(const unsigned char *) name;
}
/*
#include <linux/ext_fs.h>
static int ext_file_read(struct inode *, struct file *, char *, int);
-static int ext_file_write(struct inode *, struct file *, char *, int);
+static int ext_file_write(struct inode *, struct file *, const char *, int);
/*
* We have mostly NULL's here: the current defaults are ok for
@@ -194,7+194,7 @@ static int ext_file_read(struct inode * inode, struct file * filp, char * buf, i return read;
}
-static int ext_file_write(struct inode * inode, struct file * filp, char * buf, int count)
+static int ext_file_write(struct inode * inode, struct file * filp, const char * buf, int count)
{
off_t pos;
int written,c;
@@ -69,11+69,11 @@ struct inode_operations ext2_dir_inode_operations = { NULL /* smap */
};
-int ext2_check_dir_entry (char * function, struct inode * dir,
+int ext2_check_dir_entry (const char * function, struct inode * dir,
struct ext2_dir_entry * de, struct buffer_head * bh,
unsigned long offset)
{
- char * error_msg = NULL;
+ const char * error_msg = NULL;
if (de->rec_len < EXT2_DIR_REC_LEN(1))
error_msg = "rec_len is smaller than minimal";
#include <linux/ext2_fs.h>
static int ext2_file_read (struct inode *, struct file *, char *, int);
-static int ext2_file_write (struct inode *, struct file *, char *, int);
+static int ext2_file_write (struct inode *, struct file *, const char *, int);
static void ext2_release_file (struct inode *, struct file *);
/*
@@ -229,7+229,7 @@ static int ext2_file_read (struct inode * inode, struct file * filp, }
static int ext2_file_write (struct inode * inode, struct file * filp,
- char * buf, int count)
+ const char * buf, int count)
{
const loff_t two_gb = 2147483647;
loff_t pos;
*
* NOTE! unlike strncmp, isofs_match returns 1 for success, 0 for failure.
*/
-static int isofs_match(int len,const char * name, char * compare, int dlen)
+static int isofs_match(int len,const char * name, const char * compare, int dlen)
{
if (!compare)
return 0;
#include <linux/minix_fs.h>
static int minix_file_read(struct inode *, struct file *, char *, int);
-static int minix_file_write(struct inode *, struct file *, char *, int);
+static int minix_file_write(struct inode *, struct file *, const char *, int);
/*
* We have mostly NULL's here: the current defaults are ok for
@@ -190,7+190,7 @@ static int minix_file_read(struct inode * inode, struct file * filp, char * buf, return read;
}
-static int minix_file_write(struct inode * inode, struct file * filp, char * buf, int count)
+static int minix_file_write(struct inode * inode, struct file * filp, const char * buf, int count)
{
off_t pos;
int written,c;
@@ -267,13+267,14 @@ int msdos_file_read( int msdos_file_write(
struct inode *inode,
struct file *filp,
- char *buf,
+ const char *buf,
int count)
{
struct super_block *sb = inode->i_sb;
int sector,offset,size,left,written;
int error,carry;
- char *start,*to,ch;
+ const char *start;
+ char *to,ch;
struct buffer_head *bh;
int binary_mode = MSDOS_I(inode)->i_binary;
@@ -36,7+36,7 @@ static char bin_extensions[] = * read-only. The file system can be made writable again by remounting it.
*/
-void fs_panic(struct super_block *s,char *msg)
+void fs_panic(struct super_block *s,const char *msg)
{
int not_ro;
@@ -365,7+365,7 @@ int msdos_get_entry(struct inode *dir, loff_t *pos,struct buffer_head **bh, (*number)++; \
}
-static int raw_scan_sector(struct super_block *sb,int sector,char *name,
+static int raw_scan_sector(struct super_block *sb,int sector,const char *name,
int *number,int *ino,struct buffer_head **res_bh,
struct msdos_dir_entry **res_de)
{
@@ -406,7+406,7 @@ static int raw_scan_sector(struct super_block *sb,int sector,char *name, * requested entry is found or the end of the directory is reached.
*/
-static int raw_scan_root(struct super_block *sb,char *name,int *number,int *ino,
+static int raw_scan_root(struct super_block *sb,const char *name,int *number,int *ino,
struct buffer_head **res_bh,struct msdos_dir_entry **res_de)
{
int count,cluster;
@@ -424,7+424,7 @@ static int raw_scan_root(struct super_block *sb,char *name,int *number,int *ino, * requested entry is found or the end of the directory is reached.
*/
-static int raw_scan_nonroot(struct super_block *sb,int start,char *name,
+static int raw_scan_nonroot(struct super_block *sb,int start,const char *name,
int *number,int *ino,struct buffer_head **res_bh,struct msdos_dir_entry
**res_de)
{
@@ -460,7+460,7 @@ static int raw_scan_nonroot(struct super_block *sb,int start,char *name, * being created.
*/
-static int raw_scan(struct super_block *sb,int start,char *name,int *number,
+static int raw_scan(struct super_block *sb,int start,const char *name,int *number,
int *ino,struct buffer_head **res_bh,struct msdos_dir_entry **res_de)
{
if (start)
@@ -532,7+532,7 @@ int msdos_subdirs(struct inode *dir) * for an empty directory slot (name is NULL). Returns an error code or zero.
*/
-int msdos_scan(struct inode *dir,char *name,struct buffer_head **res_bh,
+int msdos_scan(struct inode *dir,const char *name,struct buffer_head **res_bh,
struct msdos_dir_entry **res_de,int *ino)
{
int res;
/* MS-DOS "device special files" */
-static char *reserved_names[] = {
+static const char *reserved_names[] = {
"CON ","PRN ","NUL ","AUX ",
"LPT1 ","LPT2 ","LPT3 ","LPT4 ",
"COM1 ","COM2 ","COM3 ","COM4 ",
@@ -41,7+41,8 @@ static char bad_if_strict[] = "+=,; "; static int msdos_format_name(char conv,const char *name,int len,char *res,
int dot_dirs)
{
- char *walk,**reserved;
+ char *walk;
+ const char **reserved;
unsigned char c;
int space;
@@ -177,7+178,7 @@ int msdos_lookup(struct inode *dir,const char *name,int len,
/* Creates a directory entry (name is already formatted). */
-static int msdos_create_entry(struct inode *dir,char *name,int is_dir,
+static int msdos_create_entry(struct inode *dir,const char *name,int is_dir,
struct inode **result)
{
struct super_block *sb = dir->i_sb;
@@ -253,7+253,7 @@ static void nfs_lookup_cache_add(struct inode *dir, const char *filename, entry->fhandle = *fhandle;
entry->fattr = *fattr;
entry->expiration_date = jiffies + (S_ISDIR(fattr->mode)
- ? NFS_SERVER(dir)->acdirmax : NFS_SERVER(dir)->acregmax);
+ ? NFS_SERVER(dir)->acdirmin : NFS_SERVER(dir)->acregmin);
}
static void nfs_lookup_cache_remove(struct inode *dir, struct inode *inode,
#include <linux/malloc.h>
static int nfs_file_read(struct inode *, struct file *, char *, int);
-static int nfs_file_write(struct inode *, struct file *, char *, int);
+static int nfs_file_write(struct inode *, struct file *, const char *, int);
static int nfs_fsync(struct inode *, struct file *);
static struct file_operations nfs_file_operations = {
@@ -190,7+190,7 @@ static int nfs_file_read(struct inode *inode, struct file *file, char *buf, return i + hunk;
}
-static int nfs_file_write(struct inode *inode, struct file *file, char *buf,
+static int nfs_file_write(struct inode *inode, struct file *file, const char *buf,
int count)
{
int result, hunk, i, n, pos;
@@ -144,7+144,7 @@ static inline int *xdr_decode_string2(int *p, char **string, unsigned int *len, }
-static inline int *xdr_encode_data(int *p, char *data, int len)
+static inline int *xdr_encode_data(int *p, const char *data, int len)
{
int quadlen = QUADLEN(len);
@@ -423,7+423,7 @@ retry: }
int nfs_proc_write(struct nfs_server *server, struct nfs_fh *fhandle,
- int offset, int count, char *data, struct nfs_fattr *fattr)
+ int offset, int count, const char *data, struct nfs_fattr *fattr)
{
int *p, *p0;
int status;
@@ -69,7+69,7 @@ static int pipe_read(struct inode * inode, struct file * filp, char * buf, int c return 0;
}
-static int pipe_write(struct inode * inode, struct file * filp, char * buf, int count)
+static int pipe_write(struct inode * inode, struct file * filp, const char * buf, int count)
{
int chars = 0, free = 0, written = 0;
char *pipebuf;
@@ -121,7+121,12 @@ static int pipe_lseek(struct inode * inode, struct file * file, off_t offset, in return -ESPIPE;
}
-static int bad_pipe_rw(struct inode * inode, struct file * filp, char * buf, int count)
+static int bad_pipe_r(struct inode * inode, struct file * filp, char * buf, int count)
+{
+ return -EBADF;
+}
+
+static int bad_pipe_w(struct inode * inode, struct file * filp, const char * buf, int count)
{
return -EBADF;
}
@@ -265,7+270,7 @@ static void pipe_rdwr_release(struct inode * inode, struct file * filp) struct file_operations connecting_fifo_fops = {
pipe_lseek,
connect_read,
- bad_pipe_rw,
+ bad_pipe_w,
NULL, /* no readdir */
connect_select,
pipe_ioctl,
@@ -278,7+283,7 @@ struct file_operations connecting_fifo_fops = { struct file_operations read_fifo_fops = {
pipe_lseek,
pipe_read,
- bad_pipe_rw,
+ bad_pipe_w,
NULL, /* no readdir */
fifo_select,
pipe_ioctl,
@@ -290,7+295,7 @@ struct file_operations read_fifo_fops = {
struct file_operations write_fifo_fops = {
pipe_lseek,
- bad_pipe_rw,
+ bad_pipe_r,
pipe_write,
NULL, /* no readdir */
fifo_select,
@@ -317,7+322,7 @@ struct file_operations rdwr_fifo_fops = { struct file_operations read_pipe_fops = {
pipe_lseek,
pipe_read,
- bad_pipe_rw,
+ bad_pipe_w,
NULL, /* no readdir */
pipe_select,
pipe_ioctl,
@@ -329,7+334,7 @@ struct file_operations read_pipe_fops = {
struct file_operations write_pipe_fops = {
pipe_lseek,
- bad_pipe_rw,
+ bad_pipe_r,
pipe_write,
NULL, /* no readdir */
pipe_select,
@@ -146,7+146,7 @@ static int read_profile(struct inode *inode, struct file *file, char *buf, int c }
/* Writing to /proc/profile resets the counters */
-static int write_profile(struct inode * inode, struct file * file, char * buf, int count)
+static int write_profile(struct inode * inode, struct file * file, const char * buf, int count)
{
int i=prof_len;
@@ -230,10+230,9 @@ void proc_read_inode(struct inode * inode) return;
}
ino &= 0x0000ffff;
- if (ino == PROC_PID_INO ||
- (p->dumpable && p->uid == p->euid && p->gid == p->egid)) {
- inode->i_uid = p->uid;
- inode->i_gid = p->gid;
+ if (ino == PROC_PID_INO || p->dumpable) {
+ inode->i_uid = p->euid;
+ inode->i_gid = p->egid;
}
switch (ino) {
case PROC_PID_INO:
static int proc_readscsi(struct inode * inode, struct file * file,
char * buf, int count);
static int proc_writescsi(struct inode * inode, struct file * file,
- char * buf, int count);
+ const char * buf, int count);
static int proc_readscsidir(struct inode *, struct file *,
void *, filldir_t filldir);
static int proc_lookupscsi(struct inode *,const char *,int,struct inode **);
@@ -282,7+282,7 @@ static int proc_readscsi(struct inode * inode, struct file * file,
static int proc_writescsi(struct inode * inode, struct file * file,
- char * buf, int count)
+ const char * buf, int count)
{
int ret = 0;
char * page;
@@ -128,7+128,7 @@ smb_file_read(struct inode *inode, struct file *file, char *buf, int count) }
static int
-smb_file_write(struct inode *inode, struct file *file, char *buf, int count)
+smb_file_write(struct inode *inode, struct file *file, const char *buf, int count)
{
int result, bufsize, to_write, already_written;
off_t pos;
@@ -658,7+658,7 @@ smb_proc_read(struct smb_server *server, struct smb_dirent *finfo,
int
smb_proc_write(struct smb_server *server, struct smb_dirent *finfo,
- off_t offset, int count, char *data)
+ off_t offset, int count, const char *data)
{
int res = 0;
char *buf = server->packet;
@@ -1513,7+1513,7 @@ smb_proc_dskattr(struct super_block *super, struct smb_dskattr *attr)
struct smb_prots {
enum smb_protocol prot;
- char *name;
+ const char *name;
};
/* smb_proc_reconnect: We expect the server to be locked, so that you
@@ -168,7+168,7 @@ int get_filesystem_list(char * buf) return len;
}
-struct file_system_type *get_fs_type(char *name)
+struct file_system_type *get_fs_type(const char *name)
{
struct file_system_type * fs = file_systems;
@@ -254,7+254,7 @@ void put_super(dev_t dev) sb->s_op->put_super(sb);
}
-static struct super_block * read_super(dev_t dev,char *name,int flags,
+static struct super_block * read_super(dev_t dev,const char *name,int flags,
void *data, int silent)
{
struct super_block * s;
@@ -428,7+428,7 @@ asmlinkage int sys_umount(char * name) * We also have to flush all inode-data for this device, as the new mount
* might need new info.
*/
-static int do_mount(dev_t dev, const char * dir, char * type, int flags, void * data)
+static int do_mount(dev_t dev, const char * dir, const char * type, int flags, void * data)
{
struct inode * dir_i;
struct super_block * sb;
@@ -554,7+554,7 @@ asmlinkage int sys_mount(char * dev_name, char * dir_name, char * type, struct file_operations * fops;
dev_t dev;
int retval;
- char * t;
+ const char * t;
unsigned long flags = 0;
unsigned long page = 0;
#include <linux/fs.h>
#include <linux/sysv_fs.h>
-static int sysv_file_write(struct inode *, struct file *, char *, int);
+static int sysv_file_write(struct inode *, struct file *, const char *, int);
/*
* We have mostly NULL's here: the current defaults are ok for
@@ -200,7+200,7 @@ int sysv_file_read(struct inode * inode, struct file * filp, char * buf, int cou return read;
}
-static int sysv_file_write(struct inode * inode, struct file * filp, char * buf, int count)
+static int sysv_file_write(struct inode * inode, struct file * filp, const char * buf, int count)
{
struct super_block * sb = inode->i_sb;
off_t pos;
@@ -44,7+44,7 @@ int umsdos_file_read_kmem( int umsdos_file_write_kmem(
struct inode *inode,
struct file *filp,
- char *buf,
+ const char *buf,
int count)
{
int ret;
@@ -49,7+49,7 @@ static int UMSDOS_file_read( static int UMSDOS_file_write(
struct inode *inode,
struct file *filp,
- char *buf,
+ const char *buf,
int count)
{
return msdos_file_write(inode,filp,buf,count);
@@ -175,7+175,7 @@ int umsdos_parse ( like this.
*/
int i;
- static char *spc = "\"*+,/:;<=>?[\\]|~";
+ static const char *spc = "\"*+,/:;<=>?[\\]|~";
is_init = 1;
for (i=0; i<=32; i++) lkp[i] = '#';
for (i=33; i<'A'; i++) lkp[i] = (char)i;
@@ -450,7+450,7 @@ static int umsdos_symlink_x( struct file filp;
filp.f_pos = 0;
/* Make the inode acceptable to MSDOS */
- ret = umsdos_file_write_kmem (inode,&filp,(char*)symname,len);
+ ret = umsdos_file_write_kmem (inode,&filp,symname,len);
iput (inode);
if (ret >= 0){
if (ret != len){
#define MAX(a,b) (((a)>(b))?(a):(b))
static int xiafs_file_read(struct inode *, struct file *, char *, int);
-static int xiafs_file_write(struct inode *, struct file *, char *, int);
+static int xiafs_file_write(struct inode *, struct file *, const char *, int);
/*
* We have mostly NULL's here: the current defaults are ok for
@@ -191,7+191,7 @@ xiafs_file_read(struct inode * inode, struct file * filp, char * buf, int count) }
static int
-xiafs_file_write(struct inode * inode, struct file * filp, char * buf, int count)
+xiafs_file_write(struct inode * inode, struct file * filp, const char * buf, int count)
{
off_t pos;
int written, c;
@@ -30,7+30,7 @@ extern unsigned short int csum_tcpudp_magic(unsigned long saddr, *
* it's best to have buff aligned on a 32-bit boundary
*/
-extern unsigned int csum_partial(unsigned char * buff, int len, unsigned int sum);
+extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum);
/*
* the same as csum_partial, but copies from src while it
@@ -39,7+39,7 @@ extern unsigned int csum_partial(unsigned char * buff, int len, unsigned int sum * here even more important to align src and dst on a 32-bit (or even
* better 64-bit) boundary
*/
-unsigned int csum_partial_copy( char *src, char *dst, int len, int sum);
+unsigned int csum_partial_copy( const char *src, char *dst, int len, int sum);
/*
* the same as csum_partial, but copies from user space (but on the alpha
@@ -294,7+294,7 @@ static __inline__ int get_dma_residue(unsigned int dmanr)
/* These are in kernel/dma.c: */
-extern int request_dma(unsigned int dmanr, char * device_id); /* reserve a DMA channel */
+extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
extern void free_dma(unsigned int dmanr); /* release it again */
*
* it's best to have buff aligned on a 32-bit boundary
*/
-unsigned int csum_partial(unsigned char * buff, int len, unsigned int sum);
+unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum);
/*
* the same as csum_partial, but copies from src while it
@@ -23,7+23,7 @@ unsigned int csum_partial(unsigned char * buff, int len, unsigned int sum); * better 64-bit) boundary
*/
-unsigned int csum_partial_copy( char *src, char *dst, int len, int sum);
+unsigned int csum_partial_copy( const char *src, char *dst, int len, int sum);
/*
@@ -33,7+33,7 @@ unsigned int csum_partial_copy( char *src, char *dst, int len, int sum); * better 64-bit) boundary
*/
-unsigned int csum_partial_copy_fromuser( char *src, char *dst, int len, int sum);
+unsigned int csum_partial_copy_fromuser(const char *src, char *dst, int len, int sum);
/*
* This is a version of ip_compute_csum() optimized for IP headers,
@@ -264,7+264,7 @@ static __inline__ int get_dma_residue(unsigned int dmanr)
/* These are in kernel/dma.c: */
-extern int request_dma(unsigned int dmanr, char * device_id); /* reserve a DMA channel */
+extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
extern void free_dma(unsigned int dmanr); /* release it again */
@@ -267,7+267,7 @@ static __inline__ int get_dma_residue(unsigned int dmanr)
/* These are in kernel/dma.c: */
-extern int request_dma(unsigned int dmanr, char * device_id); /* reserve a DMA channel */
+extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
extern void free_dma(unsigned int dmanr); /* release it again */
@@ -56,6+56,6 @@ extern int pcibios_write_config_word (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned short val);
extern pcibios_write_config_dword (unsigned char bus, unsigned char dev_fn,
unsigned char where, unsigned int val);
-extern char *pcibios_strerror (int error);
+extern const char *pcibios_strerror (int error);
#endif /* BIOS32_H */
@@ -427,7+427,7 @@ extern void ext2_check_blocks_bitmap (struct super_block *); extern unsigned long ext2_count_free (struct buffer_head *, unsigned);
/* dir.c */
-extern int ext2_check_dir_entry (char *, struct inode *,
+extern int ext2_check_dir_entry (const char *, struct inode *,
struct ext2_dir_entry *, struct buffer_head *,
unsigned long);
@@ -69,7+69,7 @@ struct floppy_struct { rate, /* data rate. |= 0x40 for perpendicular */
spec1, /* stepping rate, head unload time */
fmt_gap; /* gap2 size */
- char * name; /* used only for predefined formats */
+ const char * name; /* used only for predefined formats */
};
struct format_descr {
@@ -336,7+336,7 @@ typedef int (*filldir_t)(void *, const char *, int, off_t, ino_t); struct file_operations {
int (*lseek) (struct inode *, struct file *, off_t, int);
int (*read) (struct inode *, struct file *, char *, int);
- int (*write) (struct inode *, struct file *, char *, int);
+ int (*write) (struct inode *, struct file *, const char *, int);
int (*readdir) (struct inode *, struct file *, void *, filldir_t);
int (*select) (struct inode *, struct file *, int, select_table *);
int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
@@ -381,7+381,7 @@ struct super_operations {
struct file_system_type {
struct super_block *(*read_super) (struct super_block *, void *, int);
- char *name;
+ const char *name;
int requires_dev;
struct file_system_type * next;
};
@@ -419,7+419,7 @@ extern struct file_operations read_pipe_fops; extern struct file_operations write_pipe_fops;
extern struct file_operations rdwr_pipe_fops;
-extern struct file_system_type *get_fs_type(char *name);
+extern struct file_system_type *get_fs_type(const char *name);
extern int fs_may_mount(dev_t dev);
extern int fs_may_umount(dev_t dev, struct inode * mount_root);
@@ -515,8+515,8 @@ extern int char_read(struct inode *, struct file *, char *, int); extern int block_read(struct inode *, struct file *, char *, int);
extern int read_ahead[];
-extern int char_write(struct inode *, struct file *, char *, int);
-extern int block_write(struct inode *, struct file *, char *, int);
+extern int char_write(struct inode *, struct file *, const char *, int);
+extern int block_write(struct inode *, struct file *, const char *, int);
extern int generic_mmap(struct inode *, struct file *, struct vm_area_struct *);
@@ -41,7+41,7 @@ struct hd_struct {
struct gendisk {
int major; /* major number of driver */
- char *major_name; /* name of major driver */
+ const char *major_name; /* name of major driver */
int minor_shift; /* number of times minor is shifted to
get real minor */
int max_p; /* maximum partitions per device */
extern void inet_proto_init(struct net_proto *pro);
extern char *in_ntoa(unsigned long in);
-extern unsigned long in_aton(char *str);
+extern unsigned long in_aton(const char *str);
#endif
#endif /* _LINUX_INET_H */
@@ -46,7+46,7 @@ struct module_ref {
struct internal_symbol {
void *addr;
- char *name;
+ const char *name;
};
struct symbol_table { /* received from "insmod" */
@@ -64,7+64,7 @@ struct module { struct module *next;
struct module_ref *ref; /* the list of modules that refer to me */
struct symbol_table *symtab;
- char *name;
+ const char *name;
int size; /* size of module in pages */
void* addr; /* address of module */
int state;
/* attribute bits that are copied "as is" */
#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
-#define IS_FREE(n) (!*(n) || *(unsigned char *) (n) == DELETED_FLAG || \
- *(unsigned char *) (n) == FD_FILL_BYTE)
+#define IS_FREE(n) (!*(n) || *(const unsigned char *) (n) == DELETED_FLAG || \
+ *(const unsigned char *) (n) == FD_FILL_BYTE)
#define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)
/* valid file mode bits */
@@ -112,7+112,7 @@ struct fat_cache {
/* misc.c */
-extern void fs_panic(struct super_block *s,char *msg);
+extern void fs_panic(struct super_block *s,const char *msg);
extern int is_binary(char conversion,char *extension);
extern void lock_creation(void);
extern void unlock_creation(void);
@@ -123,7+123,7 @@ extern int date_dos2unix(__u16 time, __u16 date); extern void date_unix2dos(int unix_date,__u16 *time, __u16 *date);
extern int msdos_get_entry(struct inode *dir,loff_t *pos,struct buffer_head **bh,
struct msdos_dir_entry **de);
-extern int msdos_scan(struct inode *dir,char *name,struct buffer_head **res_bh,
+extern int msdos_scan(struct inode *dir,const char *name,struct buffer_head **res_bh,
struct msdos_dir_entry **res_de,int *ino);
extern int msdos_parent_ino(struct inode *dir,int locked);
extern int msdos_subdirs(struct inode *dir);
@@ -175,7+175,7 @@ extern int msdos_readdir (struct inode *inode, struct file *filp, extern struct inode_operations msdos_file_inode_operations;
extern struct inode_operations msdos_file_inode_operations_1024;
extern int msdos_file_read(struct inode *, struct file *, char *, int);
-extern int msdos_file_write(struct inode *, struct file *, char *, int);
+extern int msdos_file_write(struct inode *, struct file *, const char *, int);
extern struct inode_operations msdos_file_inode_operations_no_bmap;
extern void msdos_truncate(struct inode *inode);
@@ -102,18+102,18 @@ struct proto_ops { int *usockaddr_len, int peer);
int (*read) (struct socket *sock, char *ubuf, int size,
int nonblock);
- int (*write) (struct socket *sock, char *ubuf, int size,
+ int (*write) (struct socket *sock, const char *ubuf, int size,
int nonblock);
int (*select) (struct socket *sock, int sel_type,
select_table *wait);
int (*ioctl) (struct socket *sock, unsigned int cmd,
unsigned long arg);
int (*listen) (struct socket *sock, int len);
- int (*send) (struct socket *sock, void *buff, int len, int nonblock,
+ int (*send) (struct socket *sock, const void *buff, int len, int nonblock,
unsigned flags);
int (*recv) (struct socket *sock, void *buff, int len, int nonblock,
unsigned flags);
- int (*sendto) (struct socket *sock, void *buff, int len, int nonblock,
+ int (*sendto) (struct socket *sock, const void *buff, int len, int nonblock,
unsigned flags, struct sockaddr *, int addr_len);
int (*recvfrom) (struct socket *sock, void *buff, int len, int nonblock,
unsigned flags, struct sockaddr *, int *addr_len);
@@ -127,7+127,7 @@ struct proto_ops { };
struct net_proto {
- char *name; /* Protocol name */
+ const char *name; /* Protocol name */
void (*init_func)(struct net_proto *); /* Bootstrap */
};
@@ -196,7+196,7 @@ extern unsigned long ip_get_mask(unsigned long addr);
extern void dev_add_pack(struct packet_type *pt);
extern void dev_remove_pack(struct packet_type *pt);
-extern struct device *dev_get(char *name);
+extern struct device *dev_get(const char *name);
extern int dev_open(struct device *dev);
extern int dev_close(struct device *dev);
extern void dev_queue_xmit(struct sk_buff *skb, struct device *dev,
@@ -63,7+63,7 @@ extern int nfs_proc_read(struct nfs_server *server, struct nfs_fh *fhandle, int offset, int count, char *data,
struct nfs_fattr *fattr, int fs);
extern int nfs_proc_write(struct nfs_server *server, struct nfs_fh *fhandle,
- int offset, int count, char *data,
+ int offset, int count, const char *data,
struct nfs_fattr *fattr);
extern int nfs_proc_create(struct nfs_server *server, struct nfs_fh *dir,
const char *name, struct nfs_sattr *sattr,
#define PCI_DEVICE_ID_ADAPTEC_2940 0x7178
#define PCI_DEVICE_ID_ADAPTEC_294x 0x7078
#define PCI_DEVICE_ID_ADAPTEC_7850 0x5078
+#define PCI_DEVICE_ID_ADAPTEC_7872 0x7278
#define PCI_VENDOR_ID_DPT 0x1044
#define PCI_DEVICE_ID_DPT 0xa400
#define PCI_VENDOR_ID_VORTEX 0x1119
#define PCI_DEVICE_ID_VORTEX_GDT 0x0001
+#define PCI_VENDOR_ID_HP 0x103c
+#define PCI_DEVICE_ID_HP_J2585A 0x1030
/*
* The PCI interface treats multi-function devices as independent
@@ -430,7+433,7 @@ extern unsigned long pci_init (unsigned long mem_start, unsigned long mem_end);
extern struct pci_dev_info *pci_lookup_dev (unsigned int vendor,
unsigned int dev);
-extern char *pci_strbioserr (int error);
+extern const char *pci_strbioserr (int error);
extern const char *pci_strclass (unsigned int class);
extern const char *pci_strvendor (unsigned int vendor);
extern const char *pci_strdev (unsigned int vendor, unsigned int device);
@@ -32,7+32,7 @@ typedef asmlinkage void (*lcall7_func)(struct pt_regs *); * offset of the handler is hard coded in kernel/sys_call.S.
*/
struct exec_domain {
- char *name;
+ const char *name;
lcall7_func handler;
unsigned char pers_low, pers_high;
unsigned long * signal_map;
@@ -139,7+139,7 @@ enum scsi_directory_inos { struct proc_dir_entry {
unsigned short low_ino;
unsigned short namelen;
- char * name;
+ const char * name;
};
extern struct super_block *proc_read_super(struct super_block *,void *,int);
@@ -130,7+130,7 @@ int smb_proc_close(struct smb_server *server, struct smb_dirent *finfo); int smb_proc_read(struct smb_server *server, struct smb_dirent *finfo,
off_t offset, long count, char *data, int fs);
int smb_proc_write(struct smb_server *server, struct smb_dirent *finfo,
- off_t offset, int count, char *data);
+ off_t offset, int count, const char *data);
int smb_proc_create(struct smb_server *server, const char *path,
int len, struct smb_dirent *entry);
int smb_proc_mknew(struct smb_server *server, const char *path, int len,
struct tty_driver {
int magic; /* magic number for this structure */
- char *name;
+ const char *name;
int name_base; /* offset of printed name */
short major; /* major device number */
short minor_start; /* start of minor device number*/
@@ -124,7+124,7 @@ struct tty_driver { int (*open)(struct tty_struct * tty, struct file * filp);
void (*close)(struct tty_struct * tty, struct file * filp);
int (*write)(struct tty_struct * tty, int from_user,
- unsigned char *buf, int count);
+ const unsigned char *buf, int count);
void (*put_char)(struct tty_struct *tty, unsigned char ch);
void (*flush_chars)(struct tty_struct *tty);
int (*write_room)(struct tty_struct *tty);
@@ -22,7+22,7 @@ struct tty_ldisc { int (*read)(struct tty_struct * tty, struct file * file,
unsigned char * buf, unsigned int nr);
int (*write)(struct tty_struct * tty, struct file * file,
- unsigned char * buf, unsigned int nr);
+ const unsigned char * buf, unsigned int nr);
int (*ioctl)(struct tty_struct * tty, struct file * file,
unsigned int cmd, unsigned long arg);
void (*set_termios)(struct tty_struct *tty, struct termios * old);
@@ -33,7+33,7 @@ struct tty_ldisc { /*
* The following routines are called from below.
*/
- void (*receive_buf)(struct tty_struct *, unsigned char *cp,
+ void (*receive_buf)(struct tty_struct *, const unsigned char *cp,
char *fp, int count);
int (*receive_room)(struct tty_struct *);
void (*write_wakeup)(struct tty_struct *);
@@ -26,7+26,7 @@ int umsdos_file_read_kmem (struct inode *inode, int count);
int umsdos_file_write_kmem (struct inode *inode,
struct file *filp,
- char *buf,
+ const char *buf,
int count);
int umsdos_emd_dir_write (struct inode *emd_dir,
struct file *filp,
@@ -98,10+98,10 @@ typedef struct { /* this structure defines a ROM BIOS signature */
typedef struct {
u_long offset;
- char *string;
+ const char *string;
void (*init_controller)(u_char *address);
void (*init_drive)(u_char drive);
- char *name;
+ const char *name;
} XD_SIGNATURE;
u_long xd_init (u_long mem_start,u_long mem_end);
struct datalink_proto {
unsigned short type_len;
unsigned char type[8];
- char *string_name;
+ const char *string_name;
unsigned short header_length;
int (*rcvfunc)(struct sk_buff *, struct device *,
struct packet_type *);
@@ -98,12+98,12 @@ extern int ip_setsockopt(struct sock *sk, int level, int optname, char *optval extern int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *optlen);
extern void ip_init(void);
extern int ip_build_xmit(struct sock *sk,
- void getfrag (void *,
+ void getfrag (const void *,
int,
char *,
unsigned int,
unsigned int),
- void *frag,
+ const void *frag,
unsigned short int length,
int daddr,
int flags,
@@ -44,7+44,7 @@ struct inet_protocol { unsigned char protocol;
unsigned char copy:1;
void *data;
- char *name;
+ const char *name;
};
@@ -220,10+220,10 @@ struct proto { void (*close)(struct sock *sk, int timeout);
int (*read)(struct sock *sk, unsigned char *to,
int len, int nonblock, unsigned flags);
- int (*write)(struct sock *sk, unsigned char *to,
+ int (*write)(struct sock *sk, const unsigned char *to,
int len, int nonblock, unsigned flags);
int (*sendto)(struct sock *sk,
- unsigned char *from, int len, int noblock,
+ const unsigned char *from, int len, int noblock,
unsigned flags, struct sockaddr_in *usin,
int addr_len);
int (*recvfrom)(struct sock *sk,
@@ -145,7+145,7 @@ char *get_options(char *str, int *ints) }
struct {
- char *str;
+ const char *str;
void (*setup_func)(char *, int *);
} bootsetups[] = {
{ "reserve=", reserve_setup },
@@ -305,7+305,7 @@ static void calibrate_delay(void) static void parse_options(char *line)
{
char *next;
- static char *devnames[] = { "hda", "hdb", "hdc", "hdd", "sda", "sdb", "sdc", "sdd", "sde", "fd", "xda", "xdb", NULL };
+ static const char *devnames[] = { "hda", "hdb", "hdc", "hdd", "sda", "sdb", "sdc", "sdd", "sde", "fd", "xda", "xdb", NULL };
static int devnums[] = { 0x300, 0x340, 0x1600, 0x1640, 0x800, 0x810, 0x820, 0x830, 0x840, 0x200, 0xD00, 0xD40, 0};
int args, envs;
@@ -15,6+15,6 @@ struct new_utsname system_utsname = { UTS_MACHINE, UTS_DOMAINNAME
};
-char *linux_banner =
+const char *linux_banner =
"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
struct dma_chan {
int lock;
- char *device_id;
+ const char *device_id;
};
static struct dma_chan dma_chan_busy[MAX_DMA_CHANNELS] = {
@@ -69,7+69,7 @@ int get_dma_list(char *buf) } /* get_dma_list */
-int request_dma(unsigned int dmanr, char * device_id)
+int request_dma(unsigned int dmanr, const char * device_id)
{
if (dmanr >= MAX_DMA_CHANNELS)
return -EINVAL;
#include <asm/segment.h>
+/*
+ * change timeval to jiffies, trying to avoid the
+ * most obvious overflows..
+ *
+ * The tv_*sec values are signed, but nothing seems to
+ * indicate whether we really should use them as signed values
+ * when doing itimers. POSIX doesn't mention this (but if
+ * alarm() uses itimers without checking, we have to use unsigned
+ * arithmetic).
+ */
static unsigned long tvtojiffies(struct timeval *value)
{
- return((unsigned long )value->tv_sec * HZ +
- (unsigned long )(value->tv_usec + (1000000 / HZ - 1)) /
- (1000000 / HZ));
+ unsigned long sec = (unsigned) value->tv_sec;
+ unsigned long usec = (unsigned) value->tv_usec;
+
+ if (sec > (unsigned) (LONG_MAX / HZ))
+ return LONG_MAX;
+ usec += 1000000 / HZ - 1;
+ usec /= 1000000 / HZ;
+ return HZ*sec+usec;
}
static void jiffiestotv(unsigned long jiffies, struct timeval *value)
@@ -512,7+512,7 @@ free_modules( void) int get_module_list(char *buf)
{
char *p;
- char *q;
+ const char *q;
int i;
struct module *mp;
struct module_ref *ref;
@@ -713,7+713,7 @@ static void do_timer(int irq, struct pt_regs * regs) sti();
}
-asmlinkage int sys_alarm(long seconds)
+asmlinkage unsigned int sys_alarm(unsigned int seconds)
{
struct itimerval it_new, it_old;
@@ -772,7+772,7 @@ asmlinkage int sys_nice(long increment) static void show_task(int nr,struct task_struct * p)
{
unsigned long free;
- static char * stat_nam[] = { "R", "S", "D", "Z", "T", "W" };
+ static const char * stat_nam[] = { "R", "S", "D", "Z", "T", "W" };
printk("%-8s %3d ", p->comm, (p == current) ? -nr : nr);
if (((unsigned) p->state) < sizeof(stat_nam)/sizeof(char *))
@@ -137,7+137,7 @@ int vsprintf(char *buf, const char *fmt, va_list args) unsigned long num;
int i, base;
char * str;
- char *s;
+ const char *s;
int flags; /* flags to number() */
@@ -138,8+138,19 @@ o Obscure UDP/copy&sum bug fix [IN] o Fixed multicast [IN]
o TCP does rerouting for most cases [NOT WORKING YET]
-------->>>>> 1.3.? <<<<<----------
+------->>>>> 1.3.14 <<<<<----------
+o IPX works [IN]
+o NetROM works [IN]
+o AX.25 works [IN]
+o Most modules need recompiling even though they
+ load OK [BLAME LINUS]
+
+------->>>>> 1.3.15 <<<<<---------
+o Mike Shaver has started RFC1122 verification [IN PROGRESS]
+o Minor bug fixes [IN]
+
+------->>>> ???? <<<--------
o Finish merging the bridge code
o Device locking
o SIOCSLEEPRT patch
@@ -1457,7+1457,7 @@ int atalk_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) return(0);
}
-static int atalk_sendto(struct socket *sock, void *ubuf, int len, int noblock,
+static int atalk_sendto(struct socket *sock, const void *ubuf, int len, int noblock,
unsigned flags, struct sockaddr *sat, int addr_len)
{
atalk_socket *sk=(atalk_socket *)sock->data;
@@ -1634,7+1634,7 @@ static int atalk_sendto(struct socket *sock, void *ubuf, int len, int noblock, return len;
}
-static int atalk_send(struct socket *sock, void *ubuf, int size, int noblock, unsigned flags)
+static int atalk_send(struct socket *sock, const void *ubuf, int size, int noblock, unsigned flags)
{
return atalk_sendto(sock,ubuf,size,noblock,flags,NULL,0);
}
@@ -1690,7+1690,7 @@ static int atalk_recvfrom(struct socket *sock, void *ubuf, int size, int noblock }
-static int atalk_write(struct socket *sock, char *ubuf, int size, int noblock)
+static int atalk_write(struct socket *sock, const char *ubuf, int size, int noblock)
{
return atalk_send(sock,ubuf,size,noblock,0);
}
@@ -1566,7+1566,7 @@ static int bpq_rcv(struct sk_buff *skb, struct device *dev, struct packet_type * return ax25_rcv(skb, dev, &port_call, ptype);
}
-static int ax25_sendto(struct socket *sock, void *ubuf, int len, int noblock,
+static int ax25_sendto(struct socket *sock, const void *ubuf, int len, int noblock,
unsigned flags, struct sockaddr *usip, int addr_len)
{
struct sock *sk = (struct sock *)sock->data;
@@ -1716,12+1716,12 @@ static int ax25_sendto(struct socket *sock, void *ubuf, int len, int noblock,
}
-static int ax25_send(struct socket *sock, void *ubuf, int size, int noblock, unsigned flags)
+static int ax25_send(struct socket *sock, const void *ubuf, int size, int noblock, unsigned flags)
{
return ax25_sendto(sock, ubuf, size, noblock, flags, NULL, 0);
}
-static int ax25_write(struct socket *sock, char *ubuf, int size, int noblock)
+static int ax25_write(struct socket *sock, const char *ubuf, int size, int noblock)
{
return ax25_send(sock, ubuf, size, noblock, 0);
}
@@ -1910,7+1910,7 @@ int ax25_get_info(char *buffer, char **start, off_t offset, int length) {
ax25_cb *ax25;
struct device *dev;
- char *devname;
+ const char *devname;
int len = 0;
off_t pos = 0;
off_t begin = 0;
@@ -185,7+185,7 @@ void dev_remove_pack(struct packet_type *pt) * Find an interface by name.
*/
-struct device *dev_get(char *name)
+struct device *dev_get(const char *name)
{
struct device *dev;
@@ -1194,7+1194,7 @@ static int inet_read(struct socket *sock, char *ubuf, int size, int noblock) return(sk->prot->read(sk, (unsigned char *) ubuf, size, noblock, 0));
}
-static int inet_send(struct socket *sock, void *ubuf, int size, int noblock,
+static int inet_send(struct socket *sock, const void *ubuf, int size, int noblock,
unsigned flags)
{
struct sock *sk = (struct sock *) sock->data;
@@ -1208,15+1208,15 @@ static int inet_send(struct socket *sock, void *ubuf, int size, int noblock, /* We may need to bind the socket. */
if(inet_autobind(sk)!=0)
return(-EAGAIN);
- return(sk->prot->write(sk, (unsigned char *) ubuf, size, noblock, flags));
+ return(sk->prot->write(sk, (const unsigned char *) ubuf, size, noblock, flags));
}
-static int inet_write(struct socket *sock, char *ubuf, int size, int noblock)
+static int inet_write(struct socket *sock, const char *ubuf, int size, int noblock)
{
return inet_send(sock,ubuf,size,noblock,0);
}
-static int inet_sendto(struct socket *sock, void *ubuf, int size, int noblock,
+static int inet_sendto(struct socket *sock, const void *ubuf, int size, int noblock,
unsigned flags, struct sockaddr *sin, int addr_len)
{
struct sock *sk = (struct sock *) sock->data;
@@ -1232,7+1232,7 @@ static int inet_sendto(struct socket *sock, void *ubuf, int size, int noblock, /* We may need to bind the socket. */
if(inet_autobind(sk)!=0)
return -EAGAIN;
- return(sk->prot->sendto(sk, (unsigned char *) ubuf, size, noblock, flags,
+ return(sk->prot->sendto(sk, (const unsigned char *) ubuf, size, noblock, flags,
(struct sockaddr_in *)sin, addr_len));
}
* Alan Cox : Allow >4K in /proc
* Alan Cox : Make ARP add its own protocol entry
*
- * Ross Martin : Rewrote arp_rcv() and arp_get_info()
+ * Ross Martin : Rewrote arp_rcv() and arp_get_info()
* Stephen Henson : Add AX25 support to arp_get_info()
* Alan Cox : Drop data when a device is downed.
* Alan Cox : Use init_timer().
* Martin Seine : Move the arphdr structure
* to if_arp.h for compatibility.
* with BSD based programs.
- * Andrew Tridgell : Added ARP netmask code and
- * re-arranged proxy handling.
+ * Andrew Tridgell : Added ARP netmask code and
+ * re-arranged proxy handling.
* Alan Cox : Changed to use notifiers.
* Niibe Yutaka : Reply for this device or proxies only.
* Alan Cox : Don't proxy across hardware types!
* Jonathan Naylor : Added support for NET/ROM.
+ * Mike Shaver : RFC1122 checks.
*/
+/* RFC1122 Status:
+ 2.3.2.1 (ARP Cache Validation):
+ MUST provide mechanism to flush stale cache entries (OK)
+ SHOULD be able to configure cache timeout (NOT YET)
+ MUST throttle ARP retransmits (OK)
+ 2.3.2.2 (ARP Packet Queue):
+ SHOULD save at least one packet from each "conversation" with an
+ unresolved IP address. (OK)
+ 950727 -- MS
+*/
+
#include <linux/types.h>
#include <linux/string.h>
#include <linux/kernel.h>
@@ -112,6+124,10 @@ struct arp_table * next request is send.
*/
+/* RFC1122: OK. Throttles ARPing, as per 2.3.2.1. (MUST) */
+/* The recommended minimum timeout is 1 second per destination. */
+/* Is this a per-destination timeout? -- MS [YES AC]*/
+
#define ARP_RES_TIME (250*(HZ/10))
/*
@@ -184,7+200,7 @@ unsigned long arp_cache_stamp;
/*
* The last bits in the IP address are used for the cache lookup.
- * A special entry is used for proxy arp entries
+ * A special entry is used for proxy arp entries
*/
#define HASH(paddr) (htonl(paddr) & (ARP_TABLE_SIZE - 1))
@@ -198,6+214,8 @@ unsigned long arp_cache_stamp; * ARP_MAX_TRIES*ARP_RES_TIME.
*/
+/* RFC1122: Looks good. Prevents stale ARP entries, as per 2.3.2.1. (MUST) */
+
static void arp_check_expire(unsigned long dummy)
{
int i;
@@ -219,7+237,9 @@ static void arp_check_expire(unsigned long dummy) *pentry = entry->next; /* remove from list */
arp_cache_stamp++;
del_timer(&entry->timer); /* Paranoia */
- kfree_s(entry, sizeof(struct arp_table));
+ kfree_s(entry, sizeof(struct arp_table));
+ /* Don't have to remove packets in entry->skb. */
+ /* See comments above. */
}
else
pentry = &entry->next; /* go to next entry */
@@ -431,6+451,11 @@ static void arp_expire_request (unsigned long arg) /* proxy entries shouldn't really time out so this is really
only here for completeness
*/
+
+ /* RFC1122: They *can* be timed out, according to 2.3.2.1. */
+ /* They recommend a minute. -- MS */
+ /* The world doesn't work this way -- AC */
+
if (entry->flags & ATF_PUBL)
pentry = &arp_tables[PROXY_HASH];
else
@@ -453,6+478,10 @@ static void arp_expire_request (unsigned long arg) /*
* We should never arrive here.
*/
+
+ /* Should we perhaps flush the ARP table (except the ones we're */
+ /* publishing, if we can trust the queue that much) at this */
+ /* point? -- MS */
}
@@ -474,6+503,10 @@ static void arp_send_q(struct arp_table *entry, unsigned char *hw_dest) {
printk("arp_send_q: incomplete entry for %s\n",
in_ntoa(entry->ip));
+ /* Can't flush the skb, because RFC1122 says to hang on to */
+ /* at least one from any unresolved entry. --MS */
+ /* Whats happened is that someone has 'unresolved' the entry
+ as we got to use it - this 'can't happen' -- AC */
return;
}
@@ -580,6+613,8 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) {
kfree_skb(skb, FREE_READ);
return 0;
+ /* Should this be an error/printk? Seems like something */
+ /* you'd want to know about. Unless it's just !IFF_NOARP. -- MS */
}
/*
@@ -588,6+623,8 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) * match the protocol the device speaks. If it doesn't, there is a
* problem, so toss the packet.
*/
+/* Again, should this be an error/printk? -- MS */
+
switch(dev->type)
{
#ifdef CONFIG_AX25
@@ -681,6+718,10 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) /*
* Replies to other machines get tossed.
*/
+
+ /* Should we reset the expiry timers for an entry that isn't for us, if we */
+ /* have it in the cache? RFC1122 suggests it. -- MS */
+
kfree_skb(skb, FREE_READ);
return 0;
}
@@ -882,6+923,7 @@ int arp_find(unsigned char *haddr, u32 paddr, struct device *dev, case IS_MULTICAST:
if(dev->type==ARPHRD_ETHER || dev->type==ARPHRD_IEEE802)
{
+ /* What exactly does this do? -- MS */
haddr[0]=0x01;
haddr[1]=0x00;
haddr[2]=0x5e;
@@ -914,8+956,8 @@ int arp_find(unsigned char *haddr, u32 paddr, struct device *dev,
if (entry != NULL) /* It exists */
{
- if (!(entry->flags & ATF_COM))
- {
+ if (!(entry->flags & ATF_COM))
+ {
/*
* A request was already send, but no reply yet. Thus
* queue the packet with the previous attempt
@@ -954,7+996,7 @@ int arp_find(unsigned char *haddr, u32 paddr, struct device *dev, entry->last_used = jiffies;
entry->flags = 0;
entry->ip = paddr;
- entry->mask = DEF_ARP_NETMASK;
+ entry->mask = DEF_ARP_NETMASK;
memset(entry->ha, 0, dev->addr_len);
entry->hlen = dev->addr_len;
entry->htype = dev->type;
@@ -1072,15+1114,15 @@ int arp_get_info(char *buffer, char **start, off_t offset, int length) *start=buffer+(offset-begin); /* Start of wanted data */
len-=(offset-begin); /* Start slop */
if(len>length)
- len=length; /* Ending slop */
+ len=length; /* Ending slop */
return len;
}
/*
* This will find an entry in the ARP table by looking at the IP address.
- * If proxy is PROXY_EXACT then only exact IP matches will be allowed
- * for proxy entries, otherwise the netmask will be used
+ * If proxy is PROXY_EXACT then only exact IP matches will be allowed
+ * for proxy entries, otherwise the netmask will be used
*/
static struct arp_table *arp_lookup(u32 paddr, enum proxy proxy)
@@ -1095,7+1137,7 @@ static struct arp_table *arp_lookup(u32 paddr, enum proxy proxy) if (!entry && proxy != PROXY_NONE)
for (entry=arp_tables[PROXY_HASH]; entry != NULL; entry = entry->next)
if ((proxy==PROXY_EXACT) ? (entry->ip==paddr)
- : !((entry->ip^paddr)&entry->mask))
+ : !((entry->ip^paddr)&entry->mask))
break;
return entry;
@@ -1249,7+1291,7 @@ static int arp_req_set(struct arpreq *req)
if (entry == NULL)
{
- unsigned long hash = HASH(ip);
+ unsigned long hash = HASH(ip);
if (r.arp_flags & ATF_PUBL)
hash = PROXY_HASH;
* Alan Cox : Tightened even more.
* Arnt Gulbrandsen: Misplaced #endif with net redirect and break
* A.N.Kuznetsov : ICMP timestamp still used skb+1
+ * Mike Shaver : RFC1122 checks.
*
*
* This program is free software; you can redistribute it and/or
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
+
+/* RFC1122 Status: (boy, are there a lot of rules for ICMP)
+ 3.2.2 (Generic ICMP stuff)
+ MUST discard messages of unknown type. (OK)
+ MUST copy at least the first 8 bytes from the offending packet
+ when sending ICMP errors. (OK)
+ MUST pass received ICMP errors up to protocol level. (OK)
+ SHOULD send ICMP errors with TOS == 0. (OK)
+ MUST NOT send ICMP errors in reply to:
+ ICMP errors (OK)
+ Broadcast/multicast datagrams (OK)
+ MAC broadcasts (OK)
+ Non-initial fragments (OK)
+ Datagram with a source address that isn't a single host. (OK)
+ 3.2.2.1 (Destination Unreachable)
+ All the rules govern the IP layer, and are dealt with in ip.c, not here.
+ 3.2.2.2 (Redirect)
+ Host SHOULD NOT send ICMP_REDIRECTs. (OK)
+ MUST update routing table in response to host or network redirects.
+ (host OK, network NOT YET) [Intentionally -- AC]
+ SHOULD drop redirects if they're not from directly connected gateway
+ (OK -- we drop it if it's not from our old gateway, which is close
+ enough)
+ 3.2.2.3 (Source Quench)
+ MUST pass incoming SOURCE_QUENCHs to transport layer (OK)
+ Other requirements are dealt with at the transport layer.
+ 3.2.2.4 (Time Exceeded)
+ MUST pass TIME_EXCEEDED to transport layer (OK)
+ Other requirements dealt with at IP (generating TIME_EXCEEDED).
+ 3.2.2.5 (Parameter Problem)
+ SHOULD generate these, but it doesn't say for what. So we're OK. =)
+ MUST pass received PARAMPROBLEM to transport layer (NOT YET)
+ [Solaris 2.X seems to assert EPROTO when this occurs] -- AC
+ 3.2.2.6 (Echo Request/Reply)
+ MUST reply to ECHO_REQUEST, and give app to do ECHO stuff (OK, OK)
+ MAY discard broadcast ECHO_REQUESTs. (We don't, but that's OK.)
+ MUST reply using same source address as the request was sent to.
+ We're OK for unicast ECHOs, and it doesn't say anything about
+ how to handle broadcast ones, since it's optional.
+ MUST copy data from REQUEST to REPLY (OK)
+ unless it would require illegal fragmentation (MUST) (NOT YET)
+ MUST pass REPLYs to transport/user layer (OK)
+ MUST use any provided source route (reversed) for REPLY. (NOT YET)
+ 3.2.2.7 (Information Request/Reply)
+ MUST NOT implement this. (I guess that means silently discard...?) (OK)
+ 3.2.2.8 (Timestamp Request/Reply)
+ MAY implement (OK)
+ SHOULD be in-kernel for "minimum variability" (OK)
+ MAY discard broadcast REQUESTs. (OK, but see source for inconsistency)
+ MUST reply using same source address as the request was sent to. (OK)
+ MUST reverse source route, as per ECHO (NOT YET)
+ MUST pass REPLYs to transport/user layer (requires RAW, just like ECHO) (OK)
+ MUST update clock for timestamp at least 15 times/sec (OK)
+ MUST be "correct within a few minutes" (OK)
+ 3.2.2.9 (Address Mask Request/Reply)
+ MAY implement (OK)
+ MUST send a broadcast REQUEST if using this system to set netmask
+ (OK... we don't use it)
+ MUST discard received REPLYs if not using this system (OK)
+ MUST NOT send replies unless specifically made agent for this sort
+ of thing. (NOT YET)
+*/
+
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/kernel.h>
@@ -180,6+244,9 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, unsigned long info, s icmp_statistics.IcmpOutSrcQuenchs++;
break;
case ICMP_REDIRECT:
+ /* RFC1122: (3.2.2.2) Sorta bad. SHOULDN'T send */
+ /* ICMP_REDIRECTs unless we're a gateway. -- MS */
+ /* We don't .. this path isnt invoked -- AC */
icmp_statistics.IcmpOutRedirects++;
break;
case ICMP_ECHO:
@@ -227,6+294,11 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, unsigned long info, s */
our_addr = dev->pa_addr;
+
+ /* RFC1122: (3.2.2). MUST NOT send ICMP in reply to */
+ /* packet with a source IP address that doesn't define a single */
+ /* host. -- MS. Checked higher up -- AC */
+
if (iph->daddr != our_addr && ip_chk_addr(iph->daddr) == IS_MYADDR)
our_addr = iph->daddr;
offset = ip_build_header(skb, our_addr, iph->saddr,
@@ -250,6+322,9 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, unsigned long info, s * Fill in the frame
*/
+ /* RFC1122: SHOULD send with TOS == 0, and I guess this does. */
+ /* Perhaps it should be explicit? -- MS */
+
icmph = (struct icmphdr *) (skb->data + offset);
icmph->type = type;
icmph->code = code;
@@ -257,6+332,9 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, unsigned long info, s icmph->un.gateway = info; /* This might not be meant for
this form of the union but it will
be right anyway */
+
+ /* RFC1122: OK. Copies the minimum 8 bytes unchanged from the offending */
+ /* packet (MUST) as per 3.2.2. -- MS */
memcpy(icmph + 1, iph, sizeof(struct iphdr) + 8);
icmph->checksum = ip_compute_csum((unsigned char *)icmph,
@@ -332,6+410,10 @@ static void icmp_unreach(struct icmphdr *icmph, struct sk_buff *skb) /*
* Pass it off to everyone who wants it.
*/
+
+ /* RFC1122: OK. Passes appropriate ICMP errors to the */
+ /* appropriate protocol layer (MUST), as per 3.2.2. */
+
if (iph->protocol == ipprot->protocol && ipprot->err_handler)
{
ipprot->err_handler(err, (unsigned char *)(icmph + 1),
@@ -469,6+551,12 @@ static void icmp_echo(struct icmphdr *icmph, struct sk_buff *skb, struct device */
icmphr = (struct icmphdr *) (skb2->data + offset);
memcpy((char *) icmphr, (char *) icmph, len);
+
+ /* Are we copying the data from the ECHO datagram? */
+ /* We're supposed to, and it looks like we are. -- MS */
+ /* We're also supposed to truncate it if it would force */
+ /* illegal fragmentation. *sigh* */
+
icmphr->type = ICMP_ECHOREPLY;
icmphr->code = 0;
icmphr->checksum = 0;
@@ -587,11+675,20 @@ static void icmp_info(struct icmphdr *icmph, struct sk_buff *skb, struct device /*
* Handle ICMP_ADDRESS_MASK requests.
*/
+
+/* RFC1122 (3.2.2.9). A host MUST only send replies to */
+/* ADDRESS_MASK requests if it's been configured as an address mask */
+/* agent. Receiving a request doesn't constitute implicit permission to */
+/* act as one. Of course, implementing this correctly requires (SHOULD) */
+/* a way to turn the functionality on and off. Another one for sysctl(), */
+/* I guess. -- MS */
+/* Botched with a CONFIG option for now - Linus add scts sysctl please.. */
static void icmp_address(struct icmphdr *icmph, struct sk_buff *skb, struct device *dev,
unsigned long saddr, unsigned long daddr, int len,
struct options *opt)
{
+#ifdef CONFIG_IP_ADDR_AGENT
struct icmphdr *icmphr;
struct sk_buff *skb2;
int size, offset;
@@ -647,7+744,7 @@ static void icmp_address(struct icmphdr *icmph, struct sk_buff *skb, struct devi
/* Ship it out - free it when done */
ip_queue_xmit((struct sock *)NULL, ndev, skb2, 1);
-
+#endif
skb->sk = NULL;
kfree_skb(skb, FREE_READ);
}
@@ -699,6+796,11 @@ int icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt, if (ip_chk_addr(daddr) != IS_MYADDR)
{
if (icmph->type != ICMP_ECHO)
+ /* RFC1122: We're allowed to reply to ICMP_TIMESTAMP */
+ /* requests in the same manner as ICMP_ECHO (optionally */
+ /* drop those to a bcast/mcast), so perhaps we should be */
+ /* consistent? -- MS */
+
{
icmp_statistics.IcmpInErrors++;
kfree_skb(skb1, FREE_READ);
@@ -738,6+840,9 @@ int icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt, icmp_timestamp(icmph, skb1, dev, saddr, daddr, len, opt);
return 0;
case ICMP_TIMESTAMPREPLY:
+ /* RFC1122: MUST pass TIMESTAMPREPLY messages up to app layer, */
+ /* just as with ECHOREPLY. You have to use raw to get that */
+ /* functionality, just as with ECHOREPLY. Close enough. -- MS */
icmp_statistics.IcmpInTimestampReps++;
kfree_skb(skb1,FREE_READ);
return 0;
@@ -762,6+867,8 @@ int icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt, kfree_skb(skb1, FREE_READ);
return(0);
default:
+ /* RFC1122: OK. Silently discarding weird ICMP (MUST), */
+ /* as per 3.2.2. -- MS */
icmp_statistics.IcmpInErrors++;
kfree_skb(skb1, FREE_READ);
return(0);
@@ -2346,12+2346,12 @@ int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *op */
int ip_build_xmit(struct sock *sk,
- void getfrag (void *,
+ void getfrag (const void *,
int,
char *,
unsigned int,
unsigned int),
- void *frag,
+ const void *frag,
unsigned short int length,
int daddr,
int flags,
@@ -128,7+128,7 @@ struct ip_fw *ip_acct_chain; */
static unsigned short masq_port = PORT_MASQ_BEGIN;
-static char *strProt[] = {"UDP","TCP"};
+static const char *strProt[] = {"UDP","TCP"};
struct ip_masq *ip_msq_hosts;
#endif
@@ -141,7+141,7 @@ int packet_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) * protocol layers and you must therefore supply it with a complete frame
*/
-static int packet_sendto(struct sock *sk, unsigned char *from, int len,
+static int packet_sendto(struct sock *sk, const unsigned char *from, int len,
int noblock, unsigned flags, struct sockaddr_in *usin,
int addr_len)
{
@@ -224,7+224,7 @@ static int packet_sendto(struct sock *sk, unsigned char *from, int len, * always fail but we include it for completeness and future expansion.
*/
-static int packet_write(struct sock *sk, unsigned char *buff,
+static int packet_write(struct sock *sk, const unsigned char *buff,
int len, int noblock, unsigned flags)
{
return(packet_sendto(sk, buff, len, noblock, flags, NULL, 0));
@@ -127,18+127,18 @@ int raw_rcv(struct sock *sk, struct sk_buff *skb, struct device *dev, long saddr * Callback support is trivial for SOCK_RAW
*/
-static void raw_getfrag(void *p, int saddr, char *to, unsigned int offset, unsigned int fraglen)
+static void raw_getfrag(const void *p, int saddr, char *to, unsigned int offset, unsigned int fraglen)
{
- memcpy_fromfs(to, (unsigned char *)p+offset, fraglen);
+ memcpy_fromfs(to, (const unsigned char *)p+offset, fraglen);
}
/*
* IPPROTO_RAW needs extra work.
*/
-static void raw_getrawfrag(void *p, int saddr, char *to, unsigned int offset, unsigned int fraglen)
+static void raw_getrawfrag(const void *p, int saddr, char *to, unsigned int offset, unsigned int fraglen)
{
- memcpy_fromfs(to, (unsigned char *)p+offset, fraglen);
+ memcpy_fromfs(to, (const unsigned char *)p+offset, fraglen);
if(offset==0)
{
struct iphdr *iph=(struct iphdr *)to;
@@ -155,7+155,7 @@ static void raw_getrawfrag(void *p, int saddr, char *to, unsigned int offset, un }
}
-static int raw_sendto(struct sock *sk, unsigned char *from,
+static int raw_sendto(struct sock *sk, const unsigned char *from,
int len, int noblock, unsigned flags, struct sockaddr_in *usin, int addr_len)
{
int err;
@@ -207,7+207,7 @@ static int raw_sendto(struct sock *sk, unsigned char *from, }
-static int raw_write(struct sock *sk, unsigned char *buff, int len, int noblock,
+static int raw_write(struct sock *sk, const unsigned char *buff, int len, int noblock,
unsigned flags)
{
return(raw_sendto(sk, buff, len, noblock, flags, NULL, 0));
@@ -336,7+336,7 @@ static __inline__ void tcp_set_state(struct sock *sk, int state) * of two things. Firstly we will bin packets even within the window
* in order to get the data we are waiting for into the memory limit.
* Secondly we bin common duplicate forms at receive time
- * Better heuristics welcome
+ * Better heuristics welcome
*/
int tcp_select_window(struct sock *sk)
@@ -1456,7+1456,7 @@ extern __inline int tcp_build_header(struct tcphdr *th, struct sock *sk, int pus * and starts the transmit system.
*/
-static int tcp_write(struct sock *sk, unsigned char *from,
+static int tcp_write(struct sock *sk, const unsigned char *from,
int len, int nonblock, unsigned flags)
{
int copied = 0;
@@ -1576,11+1576,11 @@ static int tcp_write(struct sock *sk, unsigned char *from,
if ((skb = tcp_dequeue_partial(sk)) != NULL)
{
- int hdrlen;
+ int hdrlen;
- /* IP header + TCP header */
+ /* IP header + TCP header */
hdrlen = ((unsigned long)skb->h.th - (unsigned long)skb->data)
- + sizeof(struct tcphdr);
+ + sizeof(struct tcphdr);
/* Add more stuff to the end of skb->len */
if (!(flags & MSG_OOB))
@@ -1777,7+1777,7 @@ static int tcp_write(struct sock *sk, unsigned char *from, * This is just a wrapper.
*/
-static int tcp_sendto(struct sock *sk, unsigned char *from,
+static int tcp_sendto(struct sock *sk, const unsigned char *from,
int len, int nonblock, unsigned flags,
struct sockaddr_in *addr, int addr_len)
{
@@ -2586,10+2586,10 @@ static void tcp_reset(unsigned long saddr, unsigned long daddr, struct tcphdr *t
/*
* Look for tcp options. Parses everything but only knows about MSS.
- * This routine is always called with the packet containing the SYN.
- * However it may also be called with the ack to the SYN. So you
- * can't assume this is always the SYN. It's always called after
- * we have set up sk->mtu to our own MTU.
+ * This routine is always called with the packet containing the SYN.
+ * However it may also be called with the ack to the SYN. So you
+ * can't assume this is always the SYN. It's always called after
+ * we have set up sk->mtu to our own MTU.
*
* We need at minimum to add PAWS support here. Possibly large windows
* as Linux gets deployed on 100Mb/sec networks.
@@ -3452,7+3452,7 @@ extern __inline__ int tcp_ack(struct sock *sk, struct tcphdr *th, unsigned long sk->backoff = 0;
}
flag |= (2|4); /* 2 is really more like 'don't adjust the rtt
- In this case as we just set it up */
+ In this case as we just set it up */
cli();
oskb = sk->send_head;
IS_SKB(oskb);
@@ -3495,7+3495,7 @@ extern __inline__ int tcp_ack(struct sock *sk, struct tcphdr *th, unsigned long if (skb_peek(&sk->write_queue) != NULL)
{
if (after (sk->window_seq+1, sk->write_queue.next->h.seq) &&
- (sk->retransmits == 0 ||
+ (sk->retransmits == 0 ||
sk->ip_xmit_timeout != TIME_WRITE ||
before(sk->write_queue.next->h.seq, sk->rcv_ack_seq + 1))
&& sk->packets_out < sk->cong_window)
@@ -3514,7+3514,7 @@ extern __inline__ int tcp_ack(struct sock *sk, struct tcphdr *th, unsigned long /*
* Data to queue but no room.
*/
- reset_xmit_timer(sk, TIME_PROBE0, sk->rto);
+ reset_xmit_timer(sk, TIME_PROBE0, sk->rto);
}
}
else
* Alan Cox : Cache last socket
* Alan Cox : Route cache
* Jon Peatfield : Minor efficientcy fix to sendto().
+ * Mike Shaver : RFC1122 checks.
*
*
* This program is free software; you can redistribute it and/or
* 2 of the License, or (at your option) any later version.
*/
+/* RFC1122 Status:
+ 4.1.3.1 (Ports):
+ SHOULD send ICMP_PORT_UNREACHABLE in reponse to datagrams to
+ an un-listened port. (OK)
+ 4.1.3.2 (IP Options)
+ MUST pass IP options from IP -> application (OK)
+ MUST allow application to specify IP options (OK)
+ 4.1.3.3 (ICMP Messages)
+ MUST pass ICMP error messages to application (OK)
+ 4.1.3.4 (UDP Checksums)
+ MUST provide facility for checksumming (OK)
+ MAY allow application to control checksumming (OK)
+ MUST default to checksumming on (OK)
+ MUST discard silently datagrams with bad csums (OK)
+ 4.1.3.5 (UDP Multihoming)
+ MUST allow application to specify source address (OK)
+ SHOULD be able to communicate the chosen src addr up to application
+ when application doesn't choose (NOT YET - doesnt seem to be in the BSD API)
+ [Does opening a SOCK_PACKET and snooping your output count 8)]
+ 4.1.3.6 (Invalid Addresses)
+ MUST discard invalid source addresses (NOT YET -- will be implemented
+ in IP, so UDP will eventually be OK. Right now it's a violation.)
+ MUST only send datagrams with one of our addresses (NOT YET - ought to be OK )
+ 950728 -- MS
+*/
+
#include <asm/system.h>
#include <asm/segment.h>
#include <linux/types.h>
#include <net/checksum.h>
/*
- * SNMP MIB for the UDP layer
+ * Snmp MIB for the UDP layer
*/
struct udp_mib udp_statistics;
@@ -158,6+185,10 @@ void udp_err(int err, unsigned char *header, unsigned long daddr, * client code people.
*/
+ /* RFC1122: OK. Passes ICMP errors back to application, as per */
+ /* 4.1.3.3. */
+ /* After the comment above, that should be no surprise. */
+
if (icmp_err_convert[err & 0xff].fatal)
{
sk->err = icmp_err_convert[err & 0xff].errno;
@@ -176,7+207,7 @@ struct udpfakehdr struct udphdr uh;
int daddr;
int other;
- char *from;
+ const char *from;
int wcheck;
};
@@ -186,10+217,11 @@ struct udpfakehdr * for direct user->board I/O transfers. That one will be fun.
*/
-static void udp_getfrag(void *p, int saddr, char * to, unsigned int offset, unsigned int fraglen)
+static void udp_getfrag(const void *p, int saddr, char * to, unsigned int offset, unsigned int fraglen)
{
struct udpfakehdr *ufh = (struct udpfakehdr *)p;
- char *src, *dst;
+ const char *src;
+ char *dst;
unsigned int len;
if (offset)
@@ -225,10+257,11 @@ static void udp_getfrag(void *p, int saddr, char * to, unsigned int offset, unsi * this is a valid decision.
*/
-static void udp_getfrag_nosum(void *p, int saddr, char * to, unsigned int offset, unsigned int fraglen)
+static void udp_getfrag_nosum(const void *p, int saddr, char * to, unsigned int offset, unsigned int fraglen)
{
struct udpfakehdr *ufh = (struct udpfakehdr *)p;
- char *src, *dst;
+ const char *src;
+ char *dst;
unsigned int len;
if (offset)
@@ -254,7+287,7 @@ static void udp_getfrag_nosum(void *p, int saddr, char * to, unsigned int offset */
static int udp_send(struct sock *sk, struct sockaddr_in *sin,
- unsigned char *from, int len, int rt)
+ const unsigned char *from, int len, int rt)
{
int ulen = len + sizeof(struct udphdr);
int a;
@@ -268,6+301,17 @@ static int udp_send(struct sock *sk, struct sockaddr_in *sin, ufh.other = (htons(ulen) << 16) + IPPROTO_UDP*256;
ufh.from = from;
ufh.wcheck = 0;
+
+ /* RFC1122 Violation: there is no provision for passing IP options */
+ /* from the application layer to the IP one. It's a MUST (4.1.3.2), */
+ /* but it looks like it'd require some work on ip_build_xmit. */
+ /* Alan says he's got a Cunning Plan. -- MS */
+
+ /* RFC1122: OK. Provides the checksumming facility (MUST) as per */
+ /* 4.1.3.4. It's configurable by the application via setsockopt() */
+ /* (MAY) and it defaults to on (MUST). Almost makes up for the */
+ /* violation above. -- MS */
+
if(sk->no_check)
a = ip_build_xmit(sk, udp_getfrag_nosum, &ufh, ulen,
sin->sin_addr.s_addr, rt, IPPROTO_UDP);
@@ -281,7+325,7 @@ static int udp_send(struct sock *sk, struct sockaddr_in *sin, }
-static int udp_sendto(struct sock *sk, unsigned char *from, int len, int noblock,
+static int udp_sendto(struct sock *sk, const unsigned char *from, int len, int noblock,
unsigned flags, struct sockaddr_in *usin, int addr_len)
{
struct sockaddr_in sin;
@@ -320,6+364,16 @@ static int udp_sendto(struct sock *sk, unsigned char *from, int len, int noblock * broadcasting of data.
*/
+ /* RFC1122: OK. Allows the application to select the specific */
+ /* source address for an outgoing packet (MUST) as per 4.1.3.5. */
+ /* Optional addition: a mechanism for telling the application what */
+ /* address was used. (4.1.3.5, MAY) -- MS */
+
+ /* RFC1122: MUST ensure that all outgoing packets have one */
+ /* of this host's addresses as a source addr.(4.1.3.6) - bind in */
+ /* af_inet.c checks these. It does need work to allow BSD style */
+ /* bind to multicast as is done by xntpd */
+
if(usin->sin_addr.s_addr==INADDR_ANY)
usin->sin_addr.s_addr=ip_my_addr();
@@ -340,7+394,7 @@ static int udp_sendto(struct sock *sk, unsigned char *from, int len, int noblock * In BSD SOCK_DGRAM a write is just like a send.
*/
-static int udp_write(struct sock *sk, unsigned char *buff, int len, int noblock,
+static int udp_write(struct sock *sk, const unsigned char *buff, int len, int noblock,
unsigned flags)
{
return(udp_sendto(sk, buff, len, noblock, flags, NULL, 0));
@@ -545,6+599,13 @@ int udp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt, return(0);
}
+ /* RFC1122 warning: According to 4.1.3.6, we MUST discard any */
+ /* datagram which has an invalid source address, either here or */
+ /* in IP. */
+ /* Right now, IP isn't doing it, and neither is UDP. It's on the */
+ /* FIXME list for IP, though, so I wouldn't worry about it. */
+ /* (That's the Right Place to do it, IMHO.) -- MS */
+
if (uh->check && (
( skb->ip_summed && udp_check(uh, len, saddr, daddr, skb->csum ) ) ||
( !skb->ip_summed && udp_check(uh, len, saddr, daddr,csum_partial((char*)uh, len, 0)))
@@ -553,6+614,10 @@ int udp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt, {
/* <mea@utu.fi> wants to know, who sent it, to
go and stomp on the garbage sender... */
+
+ /* RFC1122: OK. Discards the bad packet silently (as far as */
+ /* the network is concered, anyway) as per 4.1.3.4 (MUST). */
+
NETDEBUG(printk("UDP: bad checksum. From %08lX:%d to %08lX:%d ulen %d\n",
ntohl(saddr),ntohs(uh->source),
ntohl(daddr),ntohs(uh->dest),
@@ -644,6+709,9 @@ static int udp_deliver(struct sock *sk, struct udphdr *uh, struct sk_buff *skb, * Charge it to the socket, dropping if the queue is full.
*/
+ /* I assume this includes the IP options, as per RFC1122 (4.1.3.2). */
+ /* If not, please let me know. -- MS */
+
if (sock_queue_rcv_skb(sk,skb)<0)
{
udp_statistics.UdpInErrors++;
@@ -692,4+760,3 @@ struct proto udp_prot = { 0, 0,
{NULL,}
};
-
@@ -62,7+62,7 @@ char *in_ntoa(unsigned long in) * Convert an ASCII string to binary IP.
*/
-unsigned long in_aton(char *str)
+unsigned long in_aton(const char *str)
{
unsigned long l;
unsigned int val;
@@ -553,8+553,8 @@ ipxitf_add_local_route(ipx_interface *intrfc) return ipxrtr_add_route(intrfc->if_netnum, intrfc, NULL);
}
-static char * ipx_frame_name(unsigned short);
-static char * ipx_device_name(ipx_interface *);
+static const char * ipx_frame_name(unsigned short);
+static const char * ipx_device_name(ipx_interface *);
static int ipxrtr_route_skb(struct sk_buff *);
static int
@@ -986,7+986,7 @@ ipxrtr_delete(long net) }
static int
-ipxrtr_route_packet(ipx_socket *sk, struct sockaddr_ipx *usipx, void *ubuf, int len)
+ipxrtr_route_packet(ipx_socket *sk, struct sockaddr_ipx *usipx, const void *ubuf, int len)
{
struct sk_buff *skb;
ipx_interface *intrfc;
@@ -1103,7+1103,7 @@ static int ipxrtr_ioctl(unsigned int cmd, void *arg) }
}
-static char *
+static const char *
ipx_frame_name(unsigned short frame)
{
switch (ntohs(frame)) {
@@ -1115,7+1115,7 @@ ipx_frame_name(unsigned short frame) }
}
-static char *
+static const char *
ipx_device_name(ipx_interface *intrfc)
{
return (intrfc->if_internal ? "Internal" :
@@ -1687,7+1687,7 @@ int ipx_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) return ipxitf_rcv(intrfc, skb);
}
-static int ipx_sendto(struct socket *sock, void *ubuf, int len, int noblock,
+static int ipx_sendto(struct socket *sock, const void *ubuf, int len, int noblock,
unsigned flags, struct sockaddr *usip, int addr_len)
{
ipx_socket *sk=(ipx_socket *)sock->data;
@@ -1730,7+1730,7 @@ static int ipx_sendto(struct socket *sock, void *ubuf, int len, int noblock, return len;
}
-static int ipx_send(struct socket *sock, void *ubuf, int size, int noblock, unsigned flags)
+static int ipx_send(struct socket *sock, const void *ubuf, int size, int noblock, unsigned flags)
{
return ipx_sendto(sock,ubuf,size,noblock,flags,NULL,0);
}
@@ -1780,7+1780,7 @@ static int ipx_recvfrom(struct socket *sock, void *ubuf, int size, int noblock, return(truesize);
}
-static int ipx_write(struct socket *sock, char *ubuf, int size, int noblock)
+static int ipx_write(struct socket *sock, const char *ubuf, int size, int noblock)
{
return ipx_send(sock,ubuf,size,noblock,0);
}
@@ -1006,7+1006,7 @@ int nr_rx_frame(struct sk_buff *skb, struct device *dev) return 1;
}
-static int nr_sendto(struct socket *sock, void *ubuf, int len, int noblock,
+static int nr_sendto(struct socket *sock, const void *ubuf, int len, int noblock,
unsigned flags, struct sockaddr *usip, int addr_len)
{
struct sock *sk = (struct sock *)sock->data;
@@ -1112,12+1112,12 @@ static int nr_sendto(struct socket *sock, void *ubuf, int len, int noblock, return len;
}
-static int nr_send(struct socket *sock, void *ubuf, int size, int noblock, unsigned flags)
+static int nr_send(struct socket *sock, const void *ubuf, int size, int noblock, unsigned flags)
{
return nr_sendto(sock, ubuf, size, noblock, flags, NULL, 0);
}
-static int nr_write(struct socket *sock, char *ubuf, int size, int noblock)
+static int nr_write(struct socket *sock, const char *ubuf, int size, int noblock)
{
return nr_send(sock, ubuf, size, noblock, 0);
}
@@ -1288,7+1288,7 @@ int nr_get_info(char *buffer, char **start, off_t offset, int length) {
struct sock *s;
struct device *dev;
- char *devname;
+ const char *devname;
int len = 0;
off_t pos = 0;
off_t begin = 0;
@@ -62,7+62,7 @@ static struct nr_neigh *nr_neigh_list = NULL; * Add a new route to a node, and in the process add the node and the
* neighbour if it is new.
*/
-static int nr_add_node(ax25_address *nr, char *mnemonic, ax25_address *ax25,
+static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax25,
ax25_digi *ax25_digi, struct device *dev, int quality, int obs_count)
{
struct nr_node *nr_node;
@@ -69,7+69,7 @@ static int sock_lseek(struct inode *inode, struct file *file, off_t offset, int whence);
static int sock_read(struct inode *inode, struct file *file, char *buf,
int size);
-static int sock_write(struct inode *inode, struct file *file, char *buf,
+static int sock_write(struct inode *inode, struct file *file, const char *buf,
int size);
static void sock_close(struct inode *inode, struct file *file);
@@ -337,7+337,7 @@ static int sock_read(struct inode *inode, struct file *file, char *ubuf, int siz * readable by the user process.
*/
-static int sock_write(struct inode *inode, struct file *file, char *ubuf, int size)
+static int sock_write(struct inode *inode, struct file *file, const char *ubuf, int size)
{
struct socket *sock;
int err;
@@ -71,17+71,17 @@ static int unix_proto_getname(struct socket *sock, struct sockaddr *usockaddr, int *usockaddr_len, int peer);
static int unix_proto_read(struct socket *sock, char *ubuf, int size,
int nonblock);
-static int unix_proto_write(struct socket *sock, char *ubuf, int size,
+static int unix_proto_write(struct socket *sock, const char *ubuf, int size,
int nonblock);
static int unix_proto_select(struct socket *sock, int sel_type, select_table * wait);
static int unix_proto_ioctl(struct socket *sock, unsigned int cmd,
unsigned long arg);
static int unix_proto_listen(struct socket *sock, int backlog);
-static int unix_proto_send(struct socket *sock, void *buff, int len,
+static int unix_proto_send(struct socket *sock, const void *buff, int len,
int nonblock, unsigned flags);
static int unix_proto_recv(struct socket *sock, void *buff, int len,
int nonblock, unsigned flags);
-static int unix_proto_sendto(struct socket *sock, void *buff, int len,
+static int unix_proto_sendto(struct socket *sock, const void *buff, int len,
int nonblock, unsigned flags,
struct sockaddr *addr, int addr_len);
static int unix_proto_recvfrom(struct socket *sock, void *buff, int len,
@@ -160,7+160,7 @@ static int unix_proto_getsockopt(struct socket *sock, int level, int optname, * SendTo() doesn't matter as we also have no Datagram support!
*/
-static int unix_proto_sendto(struct socket *sock, void *buff, int len, int nonblock,
+static int unix_proto_sendto(struct socket *sock, const void *buff, int len, int nonblock,
unsigned flags, struct sockaddr *addr, int addr_len)
{
return(-EOPNOTSUPP);
@@ -186,12+186,12 @@ static int unix_proto_shutdown(struct socket *sock, int how) * Send data to a unix socket.
*/
-static int unix_proto_send(struct socket *sock, void *buff, int len, int nonblock,
+static int unix_proto_send(struct socket *sock, const void *buff, int len, int nonblock,
unsigned flags)
{
if (flags != 0)
return(-EINVAL);
- return(unix_proto_write(sock, (char *) buff, len, nonblock));
+ return(unix_proto_write(sock, (const char *) buff, len, nonblock));
}
@@ -676,7+676,7 @@ static int unix_proto_read(struct socket *sock, char *ubuf, int size, int nonblo * peer has disconnected, which we check other ways.
*/
-static int unix_proto_write(struct socket *sock, char *ubuf, int size, int nonblock)
+static int unix_proto_write(struct socket *sock, const char *ubuf, int size, int nonblock)
{
struct unix_proto_data *pupd;
int todo, space;