From df50364bebc4b5ff63703048e7adbbde8691184f Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:10:08 -0500 Subject: [PATCH] Import 1.3.15 --- Makefile | 2 +- arch/alpha/config.in | 3 +- arch/i386/boot/tools/build.c | 2 +- arch/i386/config.in | 2 +- arch/i386/kernel/bios32.c | 2 +- arch/i386/kernel/setup.c | 4 +- arch/i386/kernel/traps.c | 2 +- arch/i386/lib/checksum.c | 6 +- arch/i386/math-emu/errors.c | 4 +- arch/i386/math-emu/fpu_emu.h | 6 +- arch/i386/mm/fault.c | 2 +- drivers/block/cdu31a.c | 62 ++++-- drivers/block/cm206.c | 2 +- drivers/block/floppy.c | 18 +- drivers/block/genhd.c | 2 +- drivers/block/ide.c | 2 +- drivers/block/sbpcd.c | 24 +-- drivers/char/atixlmouse.c | 2 +- drivers/char/busmouse.c | 2 +- drivers/char/console.c | 6 +- drivers/char/cyclades.c | 2 +- drivers/char/keyboard.c | 6 +- drivers/char/lp.c | 9 +- drivers/char/mem.c | 12 +- drivers/char/msbusmouse.c | 2 +- drivers/char/n_tty.c | 8 +- drivers/char/psaux.c | 4 +- drivers/char/pty.c | 2 +- drivers/char/scc.c | 4 +- drivers/char/serial.c | 2 +- drivers/char/tpqic02.c | 20 +- drivers/char/tty_io.c | 10 +- drivers/char/vc_screen.c | 6 +- drivers/char/vt.c | 2 +- drivers/net/3c501.c | 4 +- drivers/net/3c503.c | 2 +- drivers/net/3c505.c | 20 +- drivers/net/3c507.c | 2 +- drivers/net/3c509.c | 4 +- drivers/net/8390.c | 2 +- drivers/net/8390.h | 2 +- drivers/net/ac3200.c | 4 +- drivers/net/apricot.c | 2 +- drivers/net/arcnet.c | 2 +- drivers/net/at1700.c | 4 +- drivers/net/atp.c | 2 +- drivers/net/de4x5.c | 4 +- drivers/net/de600.c | 2 +- drivers/net/de620.c | 2 +- drivers/net/depca.c | 6 +- drivers/net/e2100.c | 2 +- drivers/net/eepro.c | 4 +- drivers/net/eexpress.c | 4 +- drivers/net/eql.c | 2 +- drivers/net/ewrk3.c | 2 +- drivers/net/hp-plus.c | 4 +- drivers/net/hp.c | 4 +- drivers/net/hp100.c | 339 ++++++++++++++++++++++-------- drivers/net/ibmtr.c | 6 +- drivers/net/lance.c | 8 +- drivers/net/ne.c | 6 +- drivers/net/pi2.c | 2 +- drivers/net/plip.c | 2 +- drivers/net/ppp.c | 16 +- drivers/net/seeq8005.c | 2 +- drivers/net/sk_g16.c | 2 +- drivers/net/slhc.c | 4 +- drivers/net/slip.c | 2 +- drivers/net/smc-ultra.c | 4 +- drivers/net/wavelan.c | 8 +- drivers/net/wd.c | 4 +- drivers/net/znet.c | 2 +- drivers/pci/pci.c | 12 +- drivers/scsi/53c7,8xx.c | 6 +- drivers/scsi/NCR5380.c | 4 +- drivers/scsi/aha152x.c | 4 +- drivers/scsi/aha1542.c | 10 +- drivers/scsi/aic7xxx.c | 387 +++++++++++++++++++++++++---------- drivers/scsi/aic7xxx.h | 4 +- drivers/scsi/aic7xxx.seq | 44 ++-- drivers/scsi/aic7xxx_asm.c | 9 +- drivers/scsi/constants.c | 10 +- drivers/scsi/constants.h | 2 +- drivers/scsi/eata.c | 4 +- drivers/scsi/eata_pio.c | 2 +- drivers/scsi/fdomain.c | 2 +- drivers/scsi/hosts.h | 8 +- drivers/scsi/scsi.c | 10 +- drivers/scsi/scsi.h | 2 +- drivers/scsi/seagate.c | 18 +- drivers/scsi/sg.c | 3 +- drivers/scsi/sr.c | 2 - drivers/scsi/st.c | 6 +- drivers/scsi/u14-34f.c | 2 +- drivers/scsi/wd7000.c | 6 +- drivers/sound/pss.c | 2 +- fs/binfmt_elf.c | 4 +- fs/block_dev.c | 5 +- fs/dcache.c | 2 +- fs/ext/file.c | 4 +- fs/ext2/dir.c | 4 +- fs/ext2/file.c | 4 +- fs/isofs/namei.c | 2 +- fs/minix/file.c | 4 +- fs/msdos/file.c | 5 +- fs/msdos/misc.c | 12 +- fs/msdos/namei.c | 7 +- fs/nfs/dir.c | 2 +- fs/nfs/file.c | 4 +- fs/nfs/proc.c | 4 +- fs/pipe.c | 19 +- fs/proc/array.c | 2 +- fs/proc/inode.c | 7 +- fs/proc/scsi.c | 4 +- fs/smbfs/file.c | 2 +- fs/smbfs/proc.c | 4 +- fs/super.c | 8 +- fs/sysv/file.c | 4 +- fs/umsdos/emd.c | 2 +- fs/umsdos/file.c | 2 +- fs/umsdos/mangle.c | 2 +- fs/umsdos/namei.c | 2 +- fs/xiafs/file.c | 4 +- include/asm-alpha/checksum.h | 4 +- include/asm-alpha/dma.h | 2 +- include/asm-i386/checksum.h | 6 +- include/asm-i386/dma.h | 2 +- include/asm-mips/dma.h | 2 +- include/linux/bios32.h | 2 +- include/linux/ext2_fs.h | 2 +- include/linux/fd.h | 2 +- include/linux/fs.h | 10 +- include/linux/genhd.h | 2 +- include/linux/inet.h | 2 +- include/linux/module.h | 4 +- include/linux/msdos_fs.h | 10 +- include/linux/net.h | 8 +- include/linux/netdevice.h | 2 +- include/linux/nfs_fs.h | 2 +- include/linux/pci.h | 5 +- include/linux/personality.h | 2 +- include/linux/proc_fs.h | 2 +- include/linux/smb_fs.h | 2 +- include/linux/tty_driver.h | 4 +- include/linux/tty_ldisc.h | 4 +- include/linux/umsdos_fs.p | 2 +- include/linux/xd.h | 4 +- include/net/datalink.h | 2 +- include/net/ip.h | 4 +- include/net/protocol.h | 2 +- include/net/sock.h | 4 +- init/main.c | 4 +- init/version.c | 2 +- kernel/dma.c | 4 +- kernel/itimer.c | 21 +- kernel/module.c | 2 +- kernel/sched.c | 4 +- lib/vsprintf.c | 2 +- net/Changes | 13 +- net/appletalk/ddp.c | 6 +- net/ax25/af_ax25.c | 8 +- net/core/dev.c | 2 +- net/ipv4/af_inet.c | 10 +- net/ipv4/arp.c | 68 ++++-- net/ipv4/icmp.c | 109 +++++++++- net/ipv4/ip.c | 4 +- net/ipv4/ip_fw.c | 2 +- net/ipv4/packet.c | 4 +- net/ipv4/raw.c | 12 +- net/ipv4/tcp.c | 26 +-- net/ipv4/udp.c | 87 +++++++- net/ipv4/utils.c | 2 +- net/ipx/af_ipx.c | 16 +- net/netrom/af_netrom.c | 8 +- net/netrom/nr_route.c | 2 +- net/socket.c | 4 +- net/unix/sock.c | 14 +- 177 files changed, 1275 insertions(+), 681 deletions(-) diff --git a/Makefile b/Makefile index 0d926106c92c..ccb3eaac93c8 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 1 PATCHLEVEL = 3 -SUBLEVEL = 14 +SUBLEVEL = 15 ARCH = i386 diff --git a/arch/alpha/config.in b/arch/alpha/config.in index e559ad73eeb5..df71673c356f 100644 --- a/arch/alpha/config.in +++ b/arch/alpha/config.in @@ -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 diff --git a/arch/i386/boot/tools/build.c b/arch/i386/boot/tools/build.c index c50ffc2d2e35..d8be672f8f19 100644 --- a/arch/i386/boot/tools/build.c +++ b/arch/i386/boot/tools/build.c @@ -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); diff --git a/arch/i386/config.in b/arch/i386/config.in index c7ee4638e041..afe0a061ba68 100644 --- a/arch/i386/config.in +++ b/arch/i386/config.in @@ -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 diff --git a/arch/i386/kernel/bios32.c b/arch/i386/kernel/bios32.c index 8cc3d76faf75..640f0c9bc9fd 100644 --- a/arch/i386/kernel/bios32.c +++ b/arch/i386/kernel/bios32.c @@ -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]; diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index d422e478e91e..785aa33817cf 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c @@ -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"}}; diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index f375a3cf64c6..ab57e2c70a42 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c @@ -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; diff --git a/arch/i386/lib/checksum.c b/arch/i386/lib/checksum.c index 055610d3c899..55be5b60c762 100644 --- a/arch/i386/lib/checksum.c +++ b/arch/i386/lib/checksum.c @@ -23,7 +23,7 @@ * 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. diff --git a/arch/i386/math-emu/errors.c b/arch/i386/math-emu/errors.c index e34eec9422ee..4e0335e5555f 100644 --- a/arch/i386/math-emu/errors.c +++ b/arch/i386/math-emu/errors.c @@ -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" }, diff --git a/arch/i386/math-emu/fpu_emu.h b/arch/i386/math-emu/fpu_emu.h index 68bcb0d5b461..2cf14a61c7cb 100644 --- a/arch/i386/math-emu/fpu_emu.h +++ b/arch/i386/math-emu/fpu_emu.h @@ -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] ) diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c index 01c259f0f761..2ec977ee5115 100644 --- a/arch/i386/mm/fault.c +++ b/arch/i386/mm/fault.c @@ -20,7 +20,7 @@ #include #include -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, diff --git a/drivers/block/cdu31a.c b/drivers/block/cdu31a.c index 9c3402c1eff0..daa63633668c 100644 --- a/drivers/block/cdu31a.c +++ b/drivers/block/cdu31a.c @@ -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, diff --git a/drivers/block/cm206.c b/drivers/block/cm206.c index e5f7a50c0166..d0afcd6099d9 100644 --- a/drivers/block/cm206.c +++ b/drivers/block/cm206.c @@ -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++) { diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 4fb930639c49..34755464467b 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -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[]={ diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c index db310d43d406..f68db26f38dd 100644 --- a/drivers/block/genhd.c +++ b/drivers/block/genhd.c @@ -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) { /* diff --git a/drivers/block/ide.c b/drivers/block/ide.c index 467b75f824cc..fb771a907ef0 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -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; diff --git a/drivers/block/sbpcd.c b/drivers/block/sbpcd.c index 87d5743f9ac2..53f8966253a3 100644 --- a/drivers/block/sbpcd.c +++ b/drivers/block/sbpcd.c @@ -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); diff --git a/drivers/char/atixlmouse.c b/drivers/char/atixlmouse.c index da70da8806c0..0cea5c9dfc85 100644 --- a/drivers/char/atixlmouse.c +++ b/drivers/char/atixlmouse.c @@ -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; } diff --git a/drivers/char/busmouse.c b/drivers/char/busmouse.c index 120efcb6e31f..1aacd1873d49 100644 --- a/drivers/char/busmouse.c +++ b/drivers/char/busmouse.c @@ -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; } diff --git a/drivers/char/console.c b/drivers/char/console.c index b8d07e495ac5..25056cd23679 100644 --- a/drivers/char/console.c +++ b/drivers/char/console.c @@ -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; diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index fe785607c90f..9a59aef2b8d2 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c @@ -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; diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 401e3ca05a8e..500247e53466 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c @@ -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; diff --git a/drivers/char/lp.c b/drivers/char/lp.c index 0fbf1fe2e076..65c9dd57cd33 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c @@ -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); diff --git a/drivers/char/mem.c b/drivers/char/mem.c index be96f4cb8e79..3e2280153695 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -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; } diff --git a/drivers/char/msbusmouse.c b/drivers/char/msbusmouse.c index 2b4c7e8b494f..bbeafc9ec3e5 100644 --- a/drivers/char/msbusmouse.c +++ b/drivers/char/msbusmouse.c @@ -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; } diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index 1bafe6933ad1..7a8d96d20f85 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c @@ -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). */ diff --git a/drivers/char/psaux.c b/drivers/char/psaux.c index 56eb5c89ef4d..f3641f74766c 100644 --- a/drivers/char/psaux.c +++ b/drivers/char/psaux.c @@ -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; diff --git a/drivers/char/pty.c b/drivers/char/pty.c index 6577dcf565e4..24ec459c7562 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c @@ -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; diff --git a/drivers/char/scc.c b/drivers/char/scc.c index 19e6274e50df..5a6658dce6f8 100644 --- a/drivers/char/scc.c +++ b/drivers/char/scc.c @@ -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; diff --git a/drivers/char/serial.c b/drivers/char/serial.c index 05464bef2e65..5ef09b003cf8 100644 --- a/drivers/char/serial.c +++ b/drivers/char/serial.c @@ -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; diff --git a/drivers/char/tpqic02.c b/drivers/char/tpqic02.c index 38fd53500504..19cad53084cc 100644 --- a/drivers/char/tpqic02.c +++ b/drivers/char/tpqic02.c @@ -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 */ diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 976990fed1e4..992af730a9c2 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -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; diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c index d7928a208f38..34e8f1898b0f 100644 --- a/drivers/char/vc_screen.c +++ b/drivers/char/vc_screen.c @@ -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; } diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 36e91bcc3a60..53d96e625ba1 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c @@ -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) diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c index 080aa977cd6d..931f03a52691 100644 --- a/drivers/net/3c501.c +++ b/drivers/net/3c501.c @@ -75,7 +75,7 @@ */ -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; diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c index 2c3ab0351647..7be835695865 100644 --- a/drivers/net/3c503.c +++ b/drivers/net/3c503.c @@ -22,7 +22,7 @@ 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 diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c index e288676b37ec..34f66cee20d6 100644 --- a/drivers/net/3c505.c +++ b/drivers/net/3c505.c @@ -57,30 +57,30 @@ * *********************************************************/ -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); diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c index b0eebb88d4f3..05cd8c4c7dd7 100644 --- a/drivers/net/3c507.c +++ b/drivers/net/3c507.c @@ -23,7 +23,7 @@ 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 diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index 678c213440b5..69459f5a7c77 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c @@ -24,7 +24,7 @@ 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 #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]); } diff --git a/drivers/net/8390.c b/drivers/net/8390.c index 4182302d353a..b3aa33805bee 100644 --- a/drivers/net/8390.c +++ b/drivers/net/8390.c @@ -22,7 +22,7 @@ */ -static char *version = +static const char *version = "8390.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n"; /* diff --git a/drivers/net/8390.h b/drivers/net/8390.h index 0ec981e34f5c..49747884eb81 100644 --- a/drivers/net/8390.h +++ b/drivers/net/8390.h @@ -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); diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c index 8e7424d9602e..7de4322cf799 100644 --- a/drivers/net/ac3200.c +++ b/drivers/net/ac3200.c @@ -14,7 +14,7 @@ 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 @@ -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] diff --git a/drivers/net/apricot.c b/drivers/net/apricot.c index c39d66de86b7..9f24e9c936fd 100644 --- a/drivers/net/apricot.c +++ b/drivers/net/apricot.c @@ -19,7 +19,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 diff --git a/drivers/net/arcnet.c b/drivers/net/arcnet.c index 60fee1f881c9..9586d855b76b 100644 --- a/drivers/net/arcnet.c +++ b/drivers/net/arcnet.c @@ -119,7 +119,7 @@ */ -static char *version = +static const char *version = "arcnet.c:v1.92 ALPHA 95/07/11 Avery Pennarun \n"; /**************************************************************************/ diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c index abbe4da6eb7b..45128b29dd44 100644 --- a/drivers/net/at1700.c +++ b/drivers/net/at1700.c @@ -28,7 +28,7 @@ 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 @@ -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; diff --git a/drivers/net/atp.c b/drivers/net/atp.c index 322d74657398..bf097a705d5e 100644 --- a/drivers/net/atp.c +++ b/drivers/net/atp.c @@ -18,7 +18,7 @@ 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"; /* diff --git a/drivers/net/de4x5.c b/drivers/net/de4x5.c index 578c6e9c80d1..ea33135ba0b7 100644 --- a/drivers/net/de4x5.c +++ b/drivers/net/de4x5.c @@ -141,7 +141,7 @@ ========================================================================= */ -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 #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; diff --git a/drivers/net/de600.c b/drivers/net/de600.c index 385a05ebad8b..292eed31ce2a 100644 --- a/drivers/net/de600.c +++ b/drivers/net/de600.c @@ -1,4 +1,4 @@ -static char *version = +static const char *version = "de600.c: $Revision: 1.40 $, Bjorn Ekwall (bj0rn@blox.se)\n"; /* * de600.c diff --git a/drivers/net/de620.c b/drivers/net/de620.c index 9bcf806f9176..636baafc92e7 100644 --- a/drivers/net/de620.c +++ b/drivers/net/de620.c @@ -38,7 +38,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *****************************************************************************/ -static char *version = +static const char *version = "de620.c: $Revision: 1.31 $, Bjorn Ekwall \n"; /*********************************************************************** diff --git a/drivers/net/depca.c b/drivers/net/depca.c index e2fd02a554d3..4efb415e7286 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c @@ -186,7 +186,7 @@ ========================================================================= */ -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 #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; diff --git a/drivers/net/e2100.c b/drivers/net/e2100.c index 94471dc4a0c7..6f421209f875 100644 --- a/drivers/net/e2100.c +++ b/drivers/net/e2100.c @@ -31,7 +31,7 @@ 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 diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index 55cbd5fc6ae7..a79a495692af 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c @@ -51,7 +51,7 @@ */ -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 diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c index 42071f8c644b..5a1248fe67b2 100644 --- a/drivers/net/eexpress.c +++ b/drivers/net/eexpress.c @@ -22,7 +22,7 @@ Changed to support io= irq= by Alan Cox */ -static char *version = +static const char *version = "eexpress.c:v0.07 1/19/94 Donald Becker (becker@super.org)\n"; #include @@ -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); diff --git a/drivers/net/eql.c b/drivers/net/eql.c index 229949578d20..2d4684a15e82 100644 --- a/drivers/net/eql.c +++ b/drivers/net/eql.c @@ -16,7 +16,7 @@ * 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 diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c index ab021e166eb6..0a45813a408e 100644 --- a/drivers/net/ewrk3.c +++ b/drivers/net/ewrk3.c @@ -126,7 +126,7 @@ ========================================================================= */ -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 diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c index 694b3c0d567b..5c5db743854d 100644 --- a/drivers/net/hp-plus.c +++ b/drivers/net/hp-plus.c @@ -18,7 +18,7 @@ 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 /* 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. */ diff --git a/drivers/net/hp.c b/drivers/net/hp.c index 393b1a1d913d..68de711b2846 100644 --- a/drivers/net/hp.c +++ b/drivers/net/hp.c @@ -18,7 +18,7 @@ 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 @@ -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 diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index 9a1d2e92624e..3db397c63674 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c @@ -10,6 +10,7 @@ * 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). @@ -53,7 +54,8 @@ * TO DO: * ====== * - ioctl handling - some runtime setup things - * - PCI card support + * - high priority communications support + * - memory mapped access support for PCI cards * * Revision history: * ================= @@ -66,6 +68,8 @@ * 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. * */ @@ -81,6 +85,8 @@ #include #include #include +#include +#include #include #include @@ -96,6 +102,12 @@ * 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 @@ -110,7 +122,8 @@ 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; } diff --git a/drivers/net/ibmtr.c b/drivers/net/ibmtr.c index b9ff59cba3df..bfdfabb5eeb1 100644 --- a/drivers/net/ibmtr.c +++ b/drivers/net/ibmtr.c @@ -12,7 +12,7 @@ */ /* - 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. @@ -37,7 +37,7 @@ #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; diff --git a/drivers/net/lance.c b/drivers/net/lance.c index c63431d931ef..d10c96a62203 100644 --- a/drivers/net/lance.c +++ b/drivers/net/lance.c @@ -15,7 +15,7 @@ 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 #include @@ -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. */ diff --git a/drivers/net/ne.c b/drivers/net/ne.c index 43803706b3bc..762cd9b9d3d3 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c @@ -26,7 +26,7 @@ /* 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 @@ -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); diff --git a/drivers/net/pi2.c b/drivers/net/pi2.c index 14310b354a1f..a30419482ad2 100644 --- a/drivers/net/pi2.c +++ b/drivers/net/pi2.c @@ -82,7 +82,7 @@ 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 diff --git a/drivers/net/plip.c b/drivers/net/plip.c index 9244123ff300..360735212acc 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c @@ -32,7 +32,7 @@ * 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: diff --git a/drivers/net/ppp.c b/drivers/net/ppp.c index 5d2953d01f1c..c42d640bdeca 100644 --- a/drivers/net/ppp.c +++ b/drivers/net/ppp.c @@ -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(); diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c index 5fd5f17f8c7c..0dc794d4301c 100644 --- a/drivers/net/seeq8005.c +++ b/drivers/net/seeq8005.c @@ -14,7 +14,7 @@ */ -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 diff --git a/drivers/net/sk_g16.c b/drivers/net/sk_g16.c index db9ecb4c172f..4cd79401aef8 100644 --- a/drivers/net/sk_g16.c +++ b/drivers/net/sk_g16.c @@ -19,7 +19,7 @@ * -*/ -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 diff --git a/drivers/net/slhc.c b/drivers/net/slhc.c index ba0c7d9fade6..783b30ecfebf 100644 --- a/drivers/net/slhc.c +++ b/drivers/net/slhc.c @@ -42,6 +42,8 @@ * 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; } diff --git a/drivers/net/slip.c b/drivers/net/slip.c index bed8e956153e..8fb0ba9e88a9 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -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; diff --git a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c index 6f015688753f..741a71e20046 100644 --- a/drivers/net/smc-ultra.c +++ b/drivers/net/smc-ultra.c @@ -37,7 +37,7 @@ 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 @@ -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; diff --git a/drivers/net/wavelan.c b/drivers/net/wavelan.c index 4b82bc133ed2..423693c23009 100644 --- a/drivers/net/wavelan.c +++ b/drivers/net/wavelan.c @@ -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); diff --git a/drivers/net/wd.c b/drivers/net/wd.c index d59a68ab8bba..fc1ada53a28a 100644 --- a/drivers/net/wd.c +++ b/drivers/net/wd.c @@ -17,7 +17,7 @@ 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 @@ -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); diff --git a/drivers/net/znet.c b/drivers/net/znet.c index ec3feb9954a6..df6a47d10999 100644 --- a/drivers/net/znet.c +++ b/drivers/net/znet.c @@ -1,6 +1,6 @@ /* 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. diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index a09eb076d471..cd59d103193c 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -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"; } } diff --git a/drivers/scsi/53c7,8xx.c b/drivers/scsi/53c7,8xx.c index c948d3254c69..359edf2a0d26 100644 --- a/drivers/scsi/53c7,8xx.c +++ b/drivers/scsi/53c7,8xx.c @@ -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 */ diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 3b78233e68f3..45278d8a97cd 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c @@ -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"}, diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index b488f7021eb4..2f998bd02a54 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c @@ -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(); diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index d090f2e848df..0fb1a492a2b6 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c @@ -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=[,,[,]]\n"; + const char *ahausage = "aha1542: usage: aha1542=[,,[,]]\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"); diff --git a/drivers/scsi/aic7xxx.c b/drivers/scsi/aic7xxx.c index bae1776d2ba6..cf57ac026d12 100644 --- a/drivers/scsi/aic7xxx.c +++ b/drivers/scsi/aic7xxx.c @@ -41,7 +41,7 @@ * * -- 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 @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -64,10 +65,16 @@ #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,12 +739,44 @@ 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 @@ -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; @@ -2883,15 +2980,24 @@ 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************************************************************************* @@ -3094,6 +3217,11 @@ aic7xxx_detect(Scsi_Host_Template *template) aic7xxx_boards[i] = NULL; } + /* + * Initialize the spurious count to 0. + */ + aic7xxx_spurious_count = 0; + /* * EISA/VL-bus card signature probe. */ @@ -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: + */ diff --git a/drivers/scsi/aic7xxx.h b/drivers/scsi/aic7xxx.h index 5cc2fec57123..f7bc1d54614c 100644 --- a/drivers/scsi/aic7xxx.h +++ b/drivers/scsi/aic7xxx.h @@ -18,12 +18,12 @@ * 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 diff --git a/drivers/scsi/aic7xxx.seq b/drivers/scsi/aic7xxx.seq index a9bd7b829265..c4868426a6ff 100644 --- a/drivers/scsi/aic7xxx.seq +++ b/drivers/scsi/aic7xxx.seq @@ -3,45 +3,29 @@ # # 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 diff --git a/drivers/scsi/aic7xxx_asm.c b/drivers/scsi/aic7xxx_asm.c index 8b2baf60d5db..4de3eaebaad3 100644 --- a/drivers/scsi/aic7xxx_asm.c +++ b/drivers/scsi/aic7xxx_asm.c @@ -26,9 +26,8 @@ * * A