D: Various bugfixes and changes to sound drivers
S: USA
-M: Krzysztof G. Baranowski
+N: Krzysztof G. Baranowski
E: kgb@manjak.knm.org.pl
P: 1024/FA6F16D1 96 D1 1A CF 5F CA 69 EC F9 4F 36 1F 6D 60 7B DA
D: Maintainer of the System V file system.
Its devices are called bcp0 through bcp3.
baycom_epp:
- This driver supports the epp modem.
+ This driver supports the EPP modem.
Its devices are called bce0 through bce3.
This driver is work-in-progress.
an additional power supply. Furthermore, it incorporates a carrier
detect circuitry.
-epp: This is a high speed modem adaptor that connects to an enhanced parallel port.
+EPP: This is a high-speed modem adaptor that connects to an enhanced parallel port.
Its target audience is users working over a high speed hub (76.8kbit/s).
-eppfpga: This is a redesign of the epp adaptor.
+eppfpga: This is a redesign of the EPP adaptor.
* io=### - specify IO address (200h-360h)
* irq=## - specify interrupt level
* mmode=##### - specify memory base address
-* dma=# - specify dma channel
+* dma=# - specify DMA channel
* media=rj45 - specify media type
or media=2
or media=aui
assigned during hardware configuration. The following tests are performed:
* IO Register Read/Write Test
- The IO Register Read/Write test insures that the CS8900/20 can be
+ The IO Register Read/Write test ensures that the CS8900/20 can be
accessed in IO mode, and that the IO base address is correct.
* Shared Memory Test
- The Shared Memory test insures the CS8900/20 can be accessed in memory
+ The Shared Memory test ensures the CS8900/20 can be accessed in memory
mode and that the range of memory addresses assigned does not conflict
with other devices in the system.
* Interrupt Test
- The Interrupt test insures there are no conflicts with the assigned IRQ
+ The Interrupt test ensures there are no conflicts with the assigned IRQ
signal.
* EEPROM Test
- The EEPROM test insures the EEPROM can be read.
+ The EEPROM test ensures the EEPROM can be read.
* Chip RAM Test
- The Chip RAM test insures the 4K of memory internal to the CS8900/20 is
+ The Chip RAM test ensures the 4 K of memory internal to the CS8900/20 is
working properly.
* Internal Loop-back Test
- The Internal Loop Back test insures the adapter's transmitter and
+ The Internal Loop Back test ensures the adapter's transmitter and
receiver are operating properly. If this test fails, make sure the
adapter's cable is connected to the network (check for LED activity for
example).
* Boot PROM Test
- The Boot PROM test insures the Boot PROM is present, and can be read.
+ The Boot PROM test ensures the Boot PROM is present, and can be read.
Failure indicates the Boot PROM was not successfully read due to a
hardware problem or due to a conflicts on the Boot PROM address
assignment. (Test only applies if the adapter is configured to use the
Telephone :(800) 888-5016 (from inside U.S. and Canada)
:(512) 442-7555 (from outside the U.S. and Canada)
Fax :(512) 912-3871
-Email :ethernet@crystal.cirrus.com
+E-mail :ethernet@crystal.cirrus.com
WWW :http://www.crystal.com
2. Opposite case. Just forget all that you know about routing
tables. Every rule is supplied with its own gateway, device
info. record. This approach is not appropriate for automated
- route maintanance, but it is ideal for manual configuration.
+ route maintenance, but it is ideal for manual configuration.
HOWTO: iproute addrule [ from PREFIX ] [ to PREFIX ] [ tos TOS ]
[ dev INPUTDEV] [ pref PREFERENCE ] route [ gw GATEWAY ]
speed 1200 # the default baudrate
clock dpll # clock source:
- # dpll = normal halfduplex operation
+ # dpll = normal half duplex operation
# external = MODEM provides own Rx/Tx clock
# divider = use full duplex divider if
# installed (1)
Berkshire Products PC Watchdog Card
Support for ISA Cards Revision A and C
- Documentation and Driver by Ken Hollis <khollis@nurk.org>
+ Documentation and Driver by Ken Hollis <kenji@bitgate.com>
The PC Watchdog is a card that offers the same type of functionality that
the WDT card does, only it doesn't require an IRQ to run. Furthermore,
The Watchdog Driver will automatically find your watchdog card, and will
attach a running driver for use with that card. After the watchdog
drivers have initialized, you can then talk to the card using the PC
- Watchdog program, available from ftp.bitgate.com:/pub/bitgate/pcwd.
+ Watchdog program, available from http://ftp.bitgate.com/pcwd/.
I suggest putting a "watchdog -d" before the beginning of an fsck, and
a "watchdog -e -t 1" immediately after the end of an fsck. (Remember
And that's all she wrote!
-- Ken Hollis
- (khollis@nurk.org)
+ (kenji@bitgate.com)
+
+(This documentation may be out of date. Check
+ http://ftp.bitgate.com/pcwd/ for the absolute latest additions.)
SMC etherpower for that.)
3. Make sure your changes compile correctly in multiple
- configurations. In paticular check changes work both as a module
- and built into the kernel.
+ configurations. In particular check that changes work both as a
+ module and built into the kernel.
4. When you are happy with a change make it generally available for
testing and await feedback.
and variable names. These aren't as silly as they seem. One
job the maintainers (and especially Linus) do is to keep things
looking the same. Sometimes this means that the clever hack in
- your driver to get around a problem actual needs to become a
+ your driver to get around a problem actually needs to become a
generalized kernel feature ready for next time. See
Documentation/CodingStyle for guidance here.
Maintainers List (try to look for most precise areas first)
-Note: For the hard of thinking, this list is meant to remain in Alphabetical
-order. If you could add yourselves to it in Alphabetical order that would
+Note: For the hard of thinking, this list is meant to remain in alphabetical
+order. If you could add yourselves to it in alphabetical order that would
so much easier [Ed]
P: Person
W: http://www.ife.ee.ethz.ch/~sailer/ham/ham.html
S: Maintained
+BERKSHIRE PRODUCTS PC WATCHDOG DRIVER
+P: Kenji Hollis
+M: kenji@bitgate.com
+W: http://ftp.bitgate.com/pcwd/
+S: Maintained
+
BUSLOGIC SCSI DRIVER
P: Leonard N. Zubkoff
M: Leonard N. Zubkoff <lnz@dandelion.com>
L: linux-eata@i-connect.net, linux-scsi@vger.rutgers.edu
S: Maintained
+COMPAQ SMART2 RAID DRIVER
+P: Charles White
+M: Charles White <arrays@compaq.com>
+L: compaqandlinux@yps.org
+S: Maintained
+
EATA ISA/EISA/PCI SCSI DRIVER
P: Dario Ballabio
M: dario@milano.europe.dg.com
L: linux-kernel@vger.rutgers.edu
S: Maintained
+OLYMPIC NETWORK DRIVER
+P: Peter De Shrijver
+M: p2@ace.ulyssis.sutdent.kuleuven.ac.be
+P: Mike Phillips
+M: phillim@amtrak.com
+L: linux-net@vger.rutgers.edu
+L: linux-tr@emissary.aus-etc.com
+W: http://www.linuxtr.net
+S: Maintained
+
+OLYMPIC NETWORK DRIVER
+P: Peter De Shrijver
+M: p2@ace.ulyssis.sutdent.kuleuven.ac.be
+P: Mike Phillips
+M: phillim@amtrak.com
+L: linux-net@vger.rutgers.edu
+L: linux-tr@emissary.aus-etc.com
+W: http://www.linuxtr.net
+S: Maintained
+
OPL3-SA2, SA3, and SAx DRIVER
P: Scott Murray
M: scottm@interlog.com
REAL TIME CLOCK DRIVER
P: Paul Gortmaker
-M gpg109@rsphy1.anu.edu.au
+M: gpg109@rsphy1.anu.edu.au
L: linux-kernel@vger.rutgers.edu
S: Maintained
S: Maintained
SMB FILESYSTEM
-P: Volker Lendecke
-M: vl@kki.org
-L: samba@listproc.anu.edu.au
+P: Andrew Tridgell
+M: tridge@samba.org
+W: http://samba.org/
+L: samba@samba.org
S: Maintained
SMP: (except SPARC)
# Network device support
#
CONFIG_NETDEVICES=y
+
+#
+# ARCnet devices
+#
# CONFIG_ARCNET is not set
CONFIG_DUMMY=m
# CONFIG_EQUALIZER is not set
+
+#
+# Ethernet (10 or 100Mbit)
+#
CONFIG_NET_ETHERNET=y
# CONFIG_NET_VENDOR_3COM is not set
# CONFIG_LANCE is not set
# CONFIG_VIA_RHINE is not set
# CONFIG_NET_POCKET is not set
# CONFIG_FDDI is not set
-# CONFIG_DLCI is not set
# CONFIG_PPP is not set
# CONFIG_SLIP is not set
# CONFIG_NET_RADIO is not set
+
+#
+# Token ring devices
+#
# CONFIG_TR is not set
+
+#
+# Wan interfaces
+#
# CONFIG_HOSTESS_SV11 is not set
# CONFIG_COSA is not set
-# CONFIG_RCPCI is not set
+# CONFIG_SEALEVEL_4021 is not set
+# CONFIG_DLCI is not set
# CONFIG_WAN_DRIVERS is not set
# CONFIG_LAPBETHER is not set
# CONFIG_X25_ASY is not set
unsigned long arg);
extern asmlinkage int sys_write(unsigned int fd,char * buf,unsigned int count);
extern void start_tty(struct tty_struct *tty);
-
static struct tty_struct *get_tty(int fd)
{
struct file *filp;
+ struct tty_struct *ttyp = NULL;
- if(!(filp = fcheck(fd)))
- return ((struct tty_struct *) 0);
- if(filp->private_data) {
- struct tty_struct *ttyp = (struct tty_struct *) filp->private_data;
+ read_lock(¤t->files->file_lock);
+ filp = fcheck(fd);
+ if(filp && filp->private_data) {
+ ttyp = (struct tty_struct *) filp->private_data;
- if(ttyp->magic == TTY_MAGIC)
- return ttyp;
+ if(ttyp->magic != TTY_MAGIC)
+ ttyp =NULL;
}
- return ((struct tty_struct *) 0);
+ read_unlock(¤t->files->file_lock);
+ return ttyp;
}
static struct tty_struct *get_real_tty(struct tty_struct *tp)
asmlinkage int sunos_ioctl (int fd, unsigned long cmd, unsigned long arg)
{
- struct file *filp;
int ret = -EBADF;
lock_kernel();
- if (fd >= SUNOS_NR_OPEN || !(filp = current->files->fd [fd]))
+ if (fd >= SUNOS_NR_OPEN || !fcheck(fd))
goto out;
/* First handle an easy compat. case for tty ldisc. */
-# $Id: config.in,v 1.66 1999/03/29 05:08:42 davem Exp $
+# $Id: config.in,v 1.67 1999/05/01 09:17:37 davem Exp $
# For a description of the syntax of this configuration file,
# see the Configure script.
#
fi
endmenu
+mainmenu_option next_comment
+comment 'Video For Linux'
+tristate 'Video For Linux' CONFIG_VIDEO_DEV
+if [ "$CONFIG_VIDEO_DEV" != "n" ]; then
+ if [ "$CONFIG_PCI" != "n" ]; then
+ dep_tristate 'BT848 Video For Linux' CONFIG_VIDEO_BT848 $CONFIG_VIDEO_DEV
+ fi
+fi
+endmenu
+
source fs/Config.in
mainmenu_option next_comment
CONFIG_UNIX98_PTYS=y
CONFIG_UNIX98_PTY_COUNT=256
+#
+# Video For Linux
+#
+CONFIG_VIDEO_DEV=y
+CONFIG_VIDEO_BT848=y
+
#
# Filesystems
#
int error = -EBADF;
lock_kernel();
- filp = fcheck(fd);
+ filp = fget(fd);
if(!filp)
- goto out;
+ goto out2;
if (!filp->f_op || !filp->f_op->ioctl) {
error = sys_ioctl (fd, cmd, arg);
break;
}
out:
+ fput(filp);
+out2:
unlock_kernel();
return error;
}
break;
}
/* Bump the usage count and install the file. */
- atomic_inc(&fp[i]->f_count);
- current->files->fd[new_fd] = fp[i];
+ get_file(fp[i]);
+ fd_install(new_fd, fp[i]);
}
if (i > 0) {
struct inode *inode;
struct file *file;
- file = current->files->fd [fd];
+ file = fcheck(fd);
if(!file)
return 0;
static inline int solaris_timod(unsigned int fd, unsigned int cmd, u32 arg,
int len, int *len_p)
{
- struct file *filp;
struct inode *ino;
int ret;
-
- filp = current->files->fd[fd];
- if (! filp ||
- ! (ino = filp->f_dentry->d_inode) ||
- ! ino->i_sock)
- return TBADF;
switch (cmd & 0xff) {
case 141: /* TI_OPTMGMT */
return TNOTSUPPORT;
}
-static inline int solaris_S(unsigned int fd, unsigned int cmd, u32 arg)
+static inline int solaris_S(struct file *filp, unsigned int fd, unsigned int cmd, u32 arg)
{
char *p;
int ret;
struct sol_socket_struct *sock;
struct module_info *mi;
- filp = current->files->fd[fd];
- if (! filp ||
- ! (ino = filp->f_dentry->d_inode) ||
+ if (! (ino = filp->f_dentry->d_inode) ||
! ino->i_sock)
return -EBADF;
sock = filp->private_data;
struct file *filp;
int error = -EBADF;
- lock_kernel();
- filp = fcheck(fd);
+ filp = fget(fd);
if (!filp)
goto out;
+ lock_kernel();
error = -EFAULT;
switch ((cmd >> 8) & 0xff) {
- case 'S': error = solaris_S(fd, cmd, arg); break;
+ case 'S': error = solaris_S(filp, fd, cmd, arg); break;
case 'T': error = solaris_T(fd, cmd, arg); break;
case 'i': error = solaris_i(fd, cmd, arg); break;
case 'r': error = solaris_r(fd, cmd, arg); break;
error = -ENOSYS;
break;
}
+ unlock_kernel();
+ fput(filp);
out:
if (error == -ENOSYS) {
unsigned char c = cmd>>8;
(int)fd, (unsigned int)cmd, c, (unsigned int)arg);
error = -EINVAL;
}
- unlock_kernel();
return error;
}
NULL, /* revalidate */
};
-__initfunc(void amiga_floppy_setup (char *str, int *ints))
+void __init amiga_floppy_setup (char *str, int *ints)
{
printk (KERN_INFO "amiflop: Setting default df0 to %x\n", ints[1]);
fd_def_df0 = ints[1];
}
-__initfunc(static int fd_probe_drives(void))
+static int __init fd_probe_drives(void)
{
int drive,drives,nomem;
return -ENOMEM;
}
-__initfunc(int amiga_floppy_init(void))
+int __init amiga_floppy_init(void)
{
int i;
/* Initialize the 'unit' variable for drive 'drive' */
-__initfunc(static void fd_probe( int drive ))
+static void __init fd_probe( int drive )
{
UD.connected = 0;
UDT = NULL;
* declared absent.
*/
-__initfunc(static int fd_test_drive_present( int drive ))
+static int __init fd_test_drive_present( int drive )
{
unsigned long timeout;
unsigned char status;
* floppies, additionally start the disk-change and motor-off timers.
*/
-__initfunc(static void config_types( void ))
+static void __init config_types( void )
{
int drive, cnt = 0;
floppy_revalidate, /* revalidate */
};
-__initfunc(int atari_floppy_init (void))
+int __init atari_floppy_init (void)
{
int i;
}
-__initfunc(void atari_floppy_setup( char *str, int *ints ))
+void __init atari_floppy_setup( char *str, int *ints )
{
int i;
return cmd646_dmaproc(func, drive);
}
-__initfunc(void ide_init_cmd646 (ide_hwif_t *hwif))
+void __init ide_init_cmd646 (ide_hwif_t *hwif)
{
struct pci_dev *dev = hwif->pci_dev;
unsigned char mrdmode;
* driver, you'll probably need the Compaq Array Controller Interface
* Specificiation (Document number ECG086/1198)
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/types.h>
#include <linux/blkdev.h>
#include <linux/locks.h>
#include <linux/malloc.h>
-#include <linux/config.h>
#include <linux/proc_fs.h>
#include <linux/md.h>
#include <linux/timer.h>
/* Determine the floppy disk controller type */
/* This routine was written by David C. Niemi */
-__initfunc(static char get_fdc_version(void))
+static char __init get_fdc_version(void)
{
int r;
/* lilo configuration */
-__initfunc(static void floppy_set_flags(int *ints,int param, int param2))
+static void __init floppy_set_flags(int *ints,int param, int param2)
{
int i;
DPRINT("%s flag 0x%x\n", param2 ? "Setting" : "Clearing", param);
}
-__initfunc(static void daring(int *ints,int param, int param2))
+static void __init daring(int *ints,int param, int param2)
{
int i;
DPRINT("Assuming %s floppy hardware\n", param ? "standard" : "broken");
}
-__initfunc(static void set_cmos(int *ints, int dummy, int dummy2))
+static void __init set_cmos(int *ints, int dummy, int dummy2)
{
int current_drive=0;
{ "L40SX", 0, &print_unex, 0, 0 } };
#define FLOPPY_SETUP
-__initfunc(void floppy_setup(char *str, int *ints))
+void __init floppy_setup(char *str, int *ints)
{
int i;
int param;
static int have_no_fdc= -EIO;
-__initfunc(int floppy_init(void))
+int __init floppy_init(void)
{
int i,unit,drive;
char *floppy=NULL;
-__initfunc(static void parse_floppy_cfg_string(char *cfg))
+static void __init parse_floppy_cfg_string(char *cfg)
{
char *ptr;
int ints[11];
}
}
-__initfunc(static void mod_setup(char *pattern, void (*setup)(char *, int *)))
+static void __init mod_setup(char *pattern, void (*setup)(char *, int *))
{
unsigned long i;
char c;
}
#endif
-__initfunc(void hd_setup(char *str, int *ints))
+void __init hd_setup(char *str, int *ints)
{
int hdind = 0;
block_fsync /* fsync */
};
-__initfunc(int hd_init(void))
+int __init hd_init(void)
{
if (register_blkdev(MAJOR_NR,"hd",&hd_fops)) {
printk("hd: unable to get major %d for hard disk\n",MAJOR_NR);
/*
- * linux/drivers/block/ide-tape.c Version 1.14 Dec 30, 1998
+ * linux/drivers/block/ide-tape.c Version 1.15 Jul 4, 1999
*
- * Copyright (C) 1995 - 1998 Gadi Oxman <gadio@netvision.net.il>
+ * Copyright (C) 1995 - 1999 Gadi Oxman <gadio@netvision.net.il>
*
* This driver was constructed as a student project in the software laboratory
* of the faculty of electrical engineering in the Technion - Israel's
* Ver 1.13 Jan 2 98 Add "speed == 0" work-around for HP COLORADO 5GB
* Ver 1.14 Dec 30 98 Partial fixes for the Sony/AIWA tape drives.
* Replace cli()/sti() with hwgroup spinlocks.
+ * Ver 1.15 Mar 25 99 Fix SMP race condition by replacing hwgroup
+ * spinlock with private per-tape spinlock.
+ * Fix use of freed memory.
*
* Here are some words from the first releases of hd.c, which are quoted
* in ide.c and apply here as well:
int excess_bh_size; /* Wasted space in each stage */
unsigned int flags; /* Status/Action flags */
+ spinlock_t spinlock; /* protects the ide-tape queue */
} idetape_tape_t;
/*
#if IDETAPE_DEBUG_LOG
printk (KERN_INFO "Reached idetape_add_stage_tail\n");
#endif /* IDETAPE_DEBUG_LOG */
- spin_lock_irqsave(&HWGROUP(drive)->spinlock, flags);
+ spin_lock_irqsave(&tape->spinlock, flags);
stage->next=NULL;
if (tape->last_stage != NULL)
tape->last_stage->next=stage;
tape->next_stage=tape->last_stage;
tape->nr_stages++;
tape->nr_pending_stages++;
- spin_unlock_irqrestore(&HWGROUP(drive)->spinlock, flags);
+ spin_unlock_irqrestore(&tape->spinlock, flags);
}
/*
ide_drive_t *drive = hwgroup->drive;
struct request *rq = hwgroup->rq;
idetape_tape_t *tape = drive->driver_data;
+ unsigned long flags;
int error;
+ int remove_stage = 0;
#if IDETAPE_DEBUG_LOG
printk (KERN_INFO "Reached idetape_end_request\n");
if (error)
tape->failed_pc = NULL;
+ spin_lock_irqsave(&tape->spinlock, flags);
if (tape->active_data_request == rq) { /* The request was a pipelined data transfer request */
tape->active_stage = NULL;
tape->active_data_request = NULL;
if (error == IDETAPE_ERROR_EOD)
idetape_abort_pipeline (drive);
}
- idetape_remove_stage_head (drive);
+ remove_stage = 1;
}
if (tape->next_stage != NULL) {
idetape_active_next_stage (drive);
idetape_increase_max_pipeline_stages (drive);
}
ide_end_drive_cmd (drive, 0, 0);
+ if (remove_stage)
+ idetape_remove_stage_head (drive);
+ spin_unlock_irqrestore(&tape->spinlock, flags);
}
/*
static void idetape_wait_for_request (ide_drive_t *drive, struct request *rq)
{
DECLARE_MUTEX_LOCKED(sem);
+ idetape_tape_t *tape = drive->driver_data;
#if IDETAPE_DEBUG_BUGS
if (rq == NULL || !IDETAPE_RQ_CMD (rq->cmd)) {
}
#endif /* IDETAPE_DEBUG_BUGS */
rq->sem = &sem;
- spin_unlock(&HWGROUP(drive)->spinlock);
+ spin_unlock(&tape->spinlock);
down(&sem);
- spin_lock_irq(&HWGROUP(drive)->spinlock);
+ spin_lock_irq(&tape->spinlock);
}
/*
*/
return (idetape_queue_rw_tail (drive, IDETAPE_READ_RQ, blocks, tape->merge_stage->bh));
}
- spin_lock_irqsave(&HWGROUP(drive)->spinlock, flags);
+ spin_lock_irqsave(&tape->spinlock, flags);
if (tape->active_stage == tape->first_stage)
idetape_wait_for_request(drive, tape->active_data_request);
- spin_unlock_irqrestore(&HWGROUP(drive)->spinlock, flags);
+ spin_unlock_irqrestore(&tape->spinlock, flags);
rq_ptr = &tape->first_stage->rq;
bytes_read = tape->tape_block_size * (rq_ptr->nr_sectors - rq_ptr->current_nr_sectors);
* Pay special attention to possible race conditions.
*/
while ((new_stage = idetape_kmalloc_stage (tape)) == NULL) {
- spin_lock_irqsave(&HWGROUP(drive)->spinlock, flags);
+ spin_lock_irqsave(&tape->spinlock, flags);
if (idetape_pipeline_active (tape)) {
idetape_wait_for_request(drive, tape->active_data_request);
- spin_unlock_irqrestore(&HWGROUP(drive)->spinlock, flags);
+ spin_unlock_irqrestore(&tape->spinlock, flags);
} else {
- spin_unlock_irqrestore(&HWGROUP(drive)->spinlock, flags);
+ spin_unlock_irqrestore(&tape->spinlock, flags);
idetape_insert_pipeline_into_queue (drive);
if (idetape_pipeline_active (tape))
continue;
if (tape->first_stage == NULL)
return;
- spin_lock_irqsave(&HWGROUP(drive)->spinlock, flags);
+ spin_lock_irqsave(&tape->spinlock, flags);
tape->next_stage = NULL;
if (idetape_pipeline_active (tape))
idetape_wait_for_request(drive, tape->active_data_request);
- spin_unlock_irqrestore(&HWGROUP(drive)->spinlock, flags);
+ spin_unlock_irqrestore(&tape->spinlock, flags);
while (tape->first_stage != NULL)
idetape_remove_stage_head (drive);
if (!idetape_pipeline_active (tape))
idetape_insert_pipeline_into_queue (drive);
- spin_lock_irqsave(&HWGROUP(drive)->spinlock, flags);
+ spin_lock_irqsave(&tape->spinlock, flags);
if (!idetape_pipeline_active (tape))
goto abort;
#if IDETAPE_DEBUG_BUGS
#endif /* IDETAPE_DEBUG_BUGS */
idetape_wait_for_request(drive, &tape->last_stage->rq);
abort:
- spin_unlock_irqrestore(&HWGROUP(drive)->spinlock, flags);
+ spin_unlock_irqrestore(&tape->spinlock, flags);
}
static void idetape_pad_zeros (ide_drive_t *drive, int bcount)
* Wait until the first read-ahead request
* is serviced.
*/
- spin_lock_irqsave(&HWGROUP(drive)->spinlock, flags);
+ spin_lock_irqsave(&tape->spinlock, flags);
if (tape->active_stage == tape->first_stage)
idetape_wait_for_request(drive, tape->active_data_request);
- spin_unlock_irqrestore(&HWGROUP(drive)->spinlock, flags);
+ spin_unlock_irqrestore(&tape->spinlock, flags);
if (tape->first_stage->rq.errors == IDETAPE_ERROR_FILEMARK)
count++;
u16 speed;
struct idetape_id_gcw gcw;
+ memset (tape, 0, sizeof (idetape_tape_t));
+ spin_lock_init(&tape->spinlock);
drive->driver_data = tape;
drive->ready_stat = 0; /* An ATAPI device ignores DRDY */
#ifdef CONFIG_BLK_DEV_IDEPCI
#ifdef AZT_KERNEL_PRIOR_2_1
void aztcd_setup(char *str, int *ints)
#else
-__initfunc(void aztcd_setup(char *str, int *ints))
+void __init aztcd_setup(char *str, int *ints)
#endif
{ if (ints[0] > 0)
azt_port = ints[1];
#ifdef AZT_KERNEL_PRIOR_2_1
int aztcd_init(void)
#else
-__initfunc(int aztcd_init(void))
+int __init aztcd_init(void)
#endif
{ long int count, max_count;
unsigned char result[50];
/* The different types of disc loading mechanisms supported */
static const char *load_mech[] __initdata = { "caddy", "tray", "pop-up", "unknown" };
-__initfunc(static void
+static void __init
get_drive_configuration(unsigned short base_io,
unsigned char res_reg[],
- unsigned int *res_size))
+ unsigned int *res_size)
{
int retry_count;
/*
* Set up base I/O and interrupts, called from main.c.
*/
-__initfunc(void
+void __init
cdu31a_setup(char *strings,
- int *ints))
+ int *ints)
{
if (ints[0] > 0)
{
/*
* Initialize the driver.
*/
-__initfunc(int
-cdu31a_init(void))
+int __init
+cdu31a_init(void)
{
struct s_sony_drive_config drive_config;
unsigned int res_size;
check_region, 15 bits of one port and 6 of another make things
likely enough to accept the region on the first hit...
*/
-__initfunc(int probe_base_port(int base))
+int __init probe_base_port(int base)
{
int b=0x300, e=0x370; /* this is the range of start addresses */
volatile int fool, i;
#if !defined(MODULE) || defined(AUTO_PROBE_MODULE)
/* Probe for irq# nr. If nr==0, probe for all possible irq's. */
-__initfunc(int probe_irq(int nr)) {
+int __init probe_irq(int nr){
int irqs, irq;
outw(dc_normal | READ_AHEAD, r_data_control); /* disable irq-generation */
sti();
}
#endif
-__initfunc(int cm206_init(void))
+int __init cm206_init(void)
{
uch e=0;
long int size=sizeof(struct cm206_struct);
static int cm206[2] = {0,0}; /* for compatible `insmod' parameter passing */
-__initfunc(void parse_options(void))
+void __init parse_options(void)
{
int i;
for (i=0; i<2; i++) {
/* This setup function accepts either `auto' or numbers in the range
* 3--11 (for irq) or 0x300--0x370 (for base port) or both. */
-__initfunc(void cm206_setup(char *s, int *p))
+void __init cm206_setup(char *s, int *p)
{
int i;
if (!strcmp(s, "auto")) auto_probe=1;
}
-__initfunc(void gscd_setup (char *str, int *ints))
+void __init gscd_setup (char *str, int *ints)
{
if (ints[0] > 0)
{
return;
}
-__initfunc(int find_drives (void))
+int __init find_drives (void)
{
int *pdrv;
int drvnum;
return drvnum;
}
-__initfunc(void init_cd_drive ( int num ))
+void __init init_cd_drive ( int num )
{
char resp [50];
int i;
/* Test for presence of drive and initialize it. Called only at boot time. */
-__initfunc(int gscd_init (void))
+int __init gscd_init (void)
{
return my_gscd_init ();
}
/* This is the common initialisation for the GoldStar drive. */
/* It is called at boot time AND for module init. */
-__initfunc(int my_gscd_init (void))
+int __init my_gscd_init (void)
{
int i;
int result;
#define ISP16_OUT(p,b) (outb(isp16_ctrl,ISP16_CTRL_PORT), outb(b,p))
-__initfunc(void
-isp16_setup(char *str, int *ints))
+void __init
+isp16_setup(char *str, int *ints)
{
if ( ints[0] > 0 )
isp16_cdrom_base = ints[1];
* ISP16 initialisation.
*
*/
-__initfunc(int
-isp16_init(void))
+int __init
+isp16_init(void)
{
u_char expected_drive;
return(0);
}
-__initfunc(static short
-isp16_detect(void))
+static short __init
+isp16_detect(void)
{
if ( isp16_c929__detect() >= 0 )
return(isp16_c928__detect());
}
-__initfunc(static short
-isp16_c928__detect(void))
+static short __init
+isp16_c928__detect(void)
{
u_char ctrl;
u_char enable_cdrom;
return(i);
}
-__initfunc(static short
-isp16_c929__detect(void))
+static short __init
+isp16_c929__detect(void)
{
u_char ctrl;
u_char tmp;
return(2);
}
-__initfunc(static short
-isp16_cdi_config(int base, u_char drive_type, int irq, int dma))
+static short __init
+isp16_cdi_config(int base, u_char drive_type, int irq, int dma)
{
u_char base_code;
u_char irq_code;
};
-
-__initfunc(void mcd_setup(char *str, int *ints))
+void __init mcd_setup(char *str, int *ints)
{
if (ints[0] > 0)
mcd_port = ints[1];
* Test for presence of drive and initialize it. Called at boot time.
*/
-__initfunc(int mcd_init(void))
+int __init mcd_init(void)
{
int count;
unsigned char result[3];
return 1;
}
-__initfunc(void mcdx_setup(char *str, int *pi))
+void __init mcdx_setup(char *str, int *pi)
{
if (pi[0] > 0) mcdx_drive_map[0][0] = pi[1];
if (pi[0] > 1) mcdx_drive_map[0][1] = pi[2];
/* Support functions ************************************************/
-__initfunc(int mcdx_init_drive(int drive))
+int __init mcdx_init_drive(int drive)
{
struct s_version version;
struct s_drive_stuff* stuffp;
return 0;
}
-__initfunc(int mcdx_init(void))
+int __init mcdx_init(void)
{
int drive;
#ifdef MODULE
/* Returns 1 if a drive is detected with a version string
starting with "DOLPHIN". Otherwise 0. */
-__initfunc(static int version_ok(void))
+static int __init version_ok(void)
{
char devname[100];
int count, i, ch, status;
/* Get kernel parameter when used as a kernel driver */
-__initfunc(void optcd_setup(char *str, int *ints))
+void __init optcd_setup(char *str, int *ints)
{
if (ints[0] > 0)
optcd_port = ints[1];
/* Test for presence of drive and initialize it. Called at boot time
or during module initialisation. */
-__initfunc(int optcd_init(void))
+int __init optcd_init(void)
{
int status;
}
#endif FUTURE
/*==========================================================================*/
-__initfunc(static void check_datarate(void))
+static void __init check_datarate(void)
{
int i=0;
}
#endif
/*==========================================================================*/
-__initfunc(static void ask_mail(void))
+static void __init ask_mail(void)
{
int i;
msg(DBG_INF,"infobuf =%s\n", msgbuf);
}
/*==========================================================================*/
-__initfunc(static int check_version(void))
+static int __init check_version(void)
{
int i, j, l;
int teac_possible=0;
/*
* probe for the presence of an interface card
*/
-__initfunc(static int check_card(int port))
+static int __init check_card(int port)
{
#undef N_RESPO
#define N_RESPO 20
/*
* probe for the presence of drives on the selected controller
*/
-__initfunc(static int check_drives(void))
+static int __init check_drives(void)
{
int i, j;
*
*/
#if (SBPCD_ISSUE-1)
-__initfunc(static void sbpcd_setup(const char *s, int *p))
+static void __init sbpcd_setup(const char *s, int *p)
#else
-__initfunc(void sbpcd_setup(const char *s, int *p))
+void __init sbpcd_setup(const char *s, int *p)
#endif
{
setup_done++;
* port 0x330, we have to use an offset of 8; so, the real CDROM port
* address is 0x338.
*/
-__initfunc(static int config_spea(void))
+static int __init config_spea(void)
{
/*
* base address offset between configuration port and CDROM port,
#ifdef MODULE
int init_module(void)
#else
-__initfunc(int SBPCD_INIT(void))
+int __init SBPCD_INIT(void)
#endif MODULE
{
int i=0, j=0;
* Set up device, i.e., use command line data to set
* base address.
*/
-__initfunc(void sjcd_setup( char *str, int *ints ))
+void __init sjcd_setup( char *str, int *ints )
{
if (ints[0] > 0)
sjcd_base = ints[1];
* Test for presence of drive and initialize it. Called at boot time.
* Probe cdrom, find out version and status.
*/
-__initfunc(int sjcd_init( void )){
+int __init sjcd_init( void ){
int i;
printk(KERN_INFO "SJCD: Sanyo CDR-H94A cdrom driver version %d.%d.\n", SJCD_VERSION_MAJOR,
/*
* Initialize the driver.
*/
-__initfunc(int
-sony535_init(void))
+int __init
+sony535_init(void)
{
struct s535_sony_drive_config drive_config;
Byte cmd_buff[3];
*
* the address value has to be the existing CDROM port address.
*/
-__initfunc(void
-sonycd535_setup(char *strings, int *ints))
+void __init
+sonycd535_setup(char *strings, int *ints)
{
/* if IRQ change and default io base desired,
* then call with io base of 0
tristate 'Digiboard PC/Xx Support' CONFIG_DIGI
fi
tristate 'Cyclades async mux support' CONFIG_CYCLADES
+ if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_CYCLADES" != "n" ]; then
+ bool ' Cyclades-Z interrupt mode operation (EXPERIMENTAL)' CONFIG_CYZ_INTR
+ fi
bool 'Stallion multiport serial support' CONFIG_STALDRV
if [ "$CONFIG_STALDRV" = "y" ]; then
tristate ' Stallion EasyIO or EC8/32 support' CONFIG_STALLION
comment ' from the tpqic02-support package. It is available at'
comment ' metalab.unc.edu or ftp://titus.cfw.com/pub/Linux/util/'
fi
+ dep_tristate 'Zoran ZR36057/36060 support' CONFIG_VIDEO_ZORAN $CONFIG_VIDEO_DEV
+ dep_tristate ' Include support for Iomega Buz' CONFIG_VIDEO_BUZ $CONFIG_VIDEO_ZORAN
+ dep_tristate ' Include support for LML33' CONFIG_VIDEO_LML33 $CONFIG_VIDEO_ZORAN
fi
bool 'Watchdog Timer Support' CONFIG_WATCHDOG
tristate 'Video For Linux' CONFIG_VIDEO_DEV
if [ "$CONFIG_VIDEO_DEV" != "n" ]; then
+ dep_tristate 'ADS Cadet AM/FM Tuner' CONFIG_RADIO_CADET $CONFIG_VIDEO_DEV
dep_tristate 'AIMSlab RadioTrack (aka RadioReveal) support' CONFIG_RADIO_RTRACK $CONFIG_VIDEO_DEV
if [ "$CONFIG_RADIO_RTRACK" = "y" ]; then
hex ' RadioTrack i/o port (0x20f or 0x30f)' CONFIG_RADIO_RTRACK_PORT 20f
if [ "$CONFIG_RADIO_AZTECH" = "y" ]; then
hex ' Aztech/Packard Bell I/O port (0x350 or 0x358)' CONFIG_RADIO_AZTECH_PORT 350
fi
- dep_tristate 'ADS Cadet AM/FM Tuner' CONFIG_RADIO_CADET $CONFIG_VIDEO_DEV
- dep_tristate 'Miro PCM20 Radio' CONFIG_RADIO_MIROPCM20 $CONFIG_VIDEO_DEV
dep_tristate 'GemTek Radio Card support' CONFIG_RADIO_GEMTEK $CONFIG_VIDEO_DEV
if [ "$CONFIG_RADIO_GEMTEK" = "y" ]; then
hex ' GemTek i/o port (0x20c, 0x30c, 0x24c or 0x34c)' CONFIG_RADIO_GEMTEK_PORT 34c
fi
+ dep_tristate 'Miro PCM20 Radio' CONFIG_RADIO_MIROPCM20 $CONFIG_VIDEO_DEV
+ dep_tristate 'TerraTec ActiveRadio ISA Standalone' CONFIG_RADIO_TERRATEC $CONFIG_VIDEO_DEV
+ if [ "$CONFIG_RADIO_TERRATEC" = "y" ]; then
+ hex ' Terratec i/o port (normally 0x590)' CONFIG_RADIO_TERRATEC_PORT 590
+ fi
if [ "$CONFIG_PCI" != "n" ]; then
dep_tristate 'BT848 Video For Linux' CONFIG_VIDEO_BT848 $CONFIG_VIDEO_DEV
fi
endif
endif
+ifeq ($(CONFIG_VIDEO_ZORAN),y)
+L_OBJS += buz.o
+else
+ ifeq ($(CONFIG_VIDEO_LML33),m)
+ M_OBJS += buz.o
+ endif
+endif
+
+ifeq ($(CONFIG_VIDEO_LML33),y)
+L_OBJS += bt856.o bt819.o
+else
+ ifeq ($(CONFIG_VIDEO_LML33),m)
+ M_OBJS += bt856.o bt819.o
+ endif
+endif
+
+ifeq ($(CONFIG_VIDEO_BUZ),y)
+L_OBJS += saa7111.o saa7185.o
+else
+ ifeq ($(CONFIG_VIDEO_BUZ),m)
+ M_OBJS += saa7111.o saa7185.o
+ endif
+endif
+
ifeq ($(CONFIG_VIDEO_PMS),y)
L_OBJS += pms.o
else
endif
endif
+ifeq ($(CONFIG_VIDEO_VINO),y)
+L_OBJS += vino.o
+else
+ ifeq ($(CONFIG_VIDEO_VINO),m)
+ M_OBJS += vino.o
+ endif
+endif
+
ifeq ($(CONFIG_RADIO_AZTECH),y)
L_OBJS += radio-aztech.o
else
endif
endif
+ifeq ($(CONFIG_RADIO_TERRATEC),y)
+L_OBJS += radio-terratec.o
+else
+ ifeq ($(CONFIG_RADIO_TERRATEC),m)
+ M_OBJS += radio-terratec.o
+ endif
+endif
+
ifeq ($(CONFIG_QIC02_TAPE),y)
L_OBJS += tpqic02.o
else
#endif
-__initfunc(int acq_init(void))
+int __init acq_init(void)
{
printk("WDT driver for Acquire single board computer initialising.\n");
ADB_MOUSE_MINOR, "adbmouse", &adb_mouse_fops
};
-__initfunc(int adb_mouse_init(void))
+int __init adb_mouse_init(void)
{
mouse.active = 0;
mouse.ready = 0;
* option, which is about using ADB keyboard buttons to emulate
* mouse buttons. -- paulus
*/
-__initfunc(void adb_mouse_setup(char *str, int *ints))
+void __init adb_mouse_setup(char *str, int *ints)
{
if (ints[0] >= 1) {
adb_emulate_buttons = ints[1] > 0;
AMIGAMOUSE_MINOR, "amigamouse", &amiga_mouse_fops
};
-__initfunc(int amiga_mouse_init(void))
+int __init amiga_mouse_init(void)
{
if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE))
return -ENODEV;
}
}
-__initfunc(int amiga_keyb_init(void))
+int __init amiga_keyb_init(void)
{
if (!AMIGAHW_PRESENT(AMI_KEYBOARD))
return -EIO;
}
/* for "kbd-reset" cmdline param */
-__initfunc(void amiga_kbd_reset_setup(char *str, int *ints))
+void __init amiga_kbd_reset_setup(char *str, int *ints)
{
}
ATARIMOUSE_MINOR, "atarimouse", &atari_mouse_fops
};
-__initfunc(int atari_mouse_init(void))
+int __init atari_mouse_init(void)
{
int r;
#define MIN_THRESHOLD 1
#define MAX_THRESHOLD 20 /* more seems not reasonable... */
-__initfunc(void atari_mouse_setup( char *str, int *ints ))
+void __init atari_mouse_setup( char *str, int *ints )
{
if (ints[0] < 1) {
printk( "atari_mouse_setup: no arguments!\n" );
};
-__initfunc(int atixl_busmouse_init(void))
+int __init atixl_busmouse_init(void)
{
unsigned char a,b,c;
MODULE_PARM(mouse_irq, "i");
#endif
-__initfunc(void bmouse_setup(char *str, int *ints))
+void __init bmouse_setup(char *str, int *ints)
{
if (ints[0] > 0)
mouse_irq=ints[1];
LOGITECH_BUSMOUSE, "busmouse", &bus_mouse_fops
};
-__initfunc(int bus_mouse_init(void))
+int __init bus_mouse_init(void)
{
if (check_region(LOGIBM_BASE, LOGIBM_EXTENT)) {
mouse.present = 0;
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/errno.h>
struct tty_driver console_driver;
static int console_refcount;
-__initfunc(unsigned long con_init(unsigned long kmem_start))
+unsigned long __init con_init(unsigned long kmem_start)
{
const char *display_desc = NULL;
unsigned int currcons = 0;
* initialized. It must be possible to call kmalloc(..., GFP_KERNEL)
* from this function, hence the call from sys_setup.
*/
-__initfunc(void
-console_map_init(void))
+void __init
+console_map_init(void)
{
int i;
#define BLOCKMOVE
#define Z_WAKE
static char rcsid[] =
-"$Revision: 2.2.2.2 $$Date: 1999/05/21 17:18:15 $";
+"$Revision: 2.2.2.3 $$Date: 1999/06/28 11:13:29 $";
/*
* linux/drivers/char/cyclades.c
* void cleanup_module(void);
*
* $Log: cyclades.c,v $
+ * Revision 2.2.2.3 1999/06/28 11:13:29 ivan
+ * Added support for interrupt mode operation for the Z cards;
+ * Removed the driver inactivity control for the Z;
+ * Added a missing MOD_DEC_USE_COUNT in the cy_open function for when
+ * the Z firmware is not loaded yet;
+ * Replaced the "manual" Z Tx flush buffer by a call to a FW command of
+ * same functionality;
+ * Implemented workaround for IRQ setting loss on the PCI configuration
+ * registers after a PCI bridge EEPROM reload (affects PLX9060 only);
+ *
* Revision 2.2.2.2 1999/05/14 17:18:15 ivan
* /proc entry location changed to /proc/tty/driver/cyclades;
* Added support to shared IRQ's (only for PCI boards);
constant in the definition below. No other change is necessary to
support more boards/ports. */
-#define NR_PORTS 128
+#define NR_PORTS 256
#define ZE_V1_NPORTS 64
#define ZO_V1 0
#ifndef CONFIG_COBALT_27
static void cy_probe(int, void *, struct pt_regs *);
#endif /* CONFIG_COBALT_27 */
-static void cyz_poll(unsigned long);
#ifdef CYCLOM_SHOW_STATUS
static void show_status(int);
#endif
static int cyclades_get_proc_info(char *, char **, off_t , int , int *, void *);
+#ifndef CONFIG_CYZ_INTR
+static void cyz_poll(unsigned long);
+
/* The Cyclades-Z polling cycle is defined by this variable */
static long cyz_polling_cycle = CZ_DEF_POLL;
cyz_timerlist = {
NULL, NULL, 0, 0, cyz_poll
};
+#endif /* CONFIG_CYZ_INTR */
/**************************************************
error = verify_area(VERIFY_WRITE, (void *) arg, sizeof(unsigned long));
if((cinfo = (struct cyclades_card *)dev_id) == 0){
#ifdef CY_DEBUG_INTERRUPTS
- printk("cy_interrupt: spurious interrupt %d\n\r", irq);
+ printk("cyy_interrupt: spurious interrupt %d\n\r", irq);
#endif
return; /* spurious interrupt */
}
}
if (status & CySRReceive) { /* reception interrupt */
#ifdef CY_DEBUG_INTERRUPTS
- printk("cy_interrupt: rcvd intr, chip %d\n\r", chip);
+ printk("cyy_interrupt: rcvd intr, chip %d\n\r", chip);
#endif
/* determine the channel & change to that context */
save_xir = (u_char) cy_readb(base_addr+(CyRIR<<index));
is empty, we know we can always stuff a dozen
characters. */
#ifdef CY_DEBUG_INTERRUPTS
- printk("cy_interrupt: xmit intr, chip %d\n\r", chip);
+ printk("cyy_interrupt: xmit intr, chip %d\n\r", chip);
#endif
/* determine the channel & change to that context */
} /* cyz_update_channel */
#endif
-
+#ifdef CONFIG_CYZ_INTR
static void
cyz_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
+ struct tty_struct *tty;
+ struct cyclades_card *cinfo;
+ struct cyclades_port *info;
+ static volatile struct FIRM_ID *firm_id;
+ static volatile struct ZFW_CTRL *zfw_ctrl;
+ static volatile struct BOARD_CTRL *board_ctrl;
+ static volatile struct CH_CTRL *ch_ctrl;
+ static volatile struct BUF_CTRL *buf_ctrl;
+ uclong channel;
+ ucchar cmd;
+ uclong param;
+ uclong hw_ver, fw_ver;
+ char data;
+ volatile int char_count, special_count;
+#ifdef BLOCKMOVE
+ int small_count;
+#endif
+ volatile uclong tx_put, tx_get, tx_bufsize;
+ volatile uclong rx_put, rx_get, rx_bufsize;
+
+ if((cinfo = (struct cyclades_card *)dev_id) == 0){
+#ifdef CY_DEBUG_INTERRUPTS
+ printk("cyz_interrupt: spurious interrupt %d\n\r", irq);
+#endif
+ return; /* spurious interrupt */
+ }
+
+ firm_id = (struct FIRM_ID *)(cinfo->base_addr + ID_ADDRESS);
+ if (!ISZLOADED(*cinfo)) {
+#ifdef CY_DEBUG_INTERRUPTS
+ printk("cyz_interrupt: board not yet loaded (INT %d).\n\r", irq);
+#endif
+ return;
+ }
+
+ zfw_ctrl = (struct ZFW_CTRL *)
+ (cinfo->base_addr + cy_readl(&firm_id->zfwctrl_addr));
+ board_ctrl = &(zfw_ctrl->board_ctrl);
+ fw_ver = cy_readl(&board_ctrl->fw_version);
+ hw_ver = cy_readl(&((struct RUNTIME_9060 *)
+ (cinfo->ctl_addr))->mail_box_0);
+
+ while(cyz_fetch_msg(cinfo, &channel, &cmd, ¶m) == 1) {
+ special_count = 0;
+ info = &cy_port[channel + cinfo->first_line];
+ if((tty = info->tty) == 0) continue;
+ ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
+ buf_ctrl = &(zfw_ctrl->buf_ctrl[channel]);
+
+ switch(cmd){
+ case C_CM_PR_ERROR:
+ tty->flip.count++;
+ *tty->flip.flag_buf_ptr++ = TTY_PARITY;
+ *tty->flip.char_buf_ptr++ = 0;
+ special_count++;
+ break;
+ case C_CM_FR_ERROR:
+ tty->flip.count++;
+ *tty->flip.flag_buf_ptr++ = TTY_FRAME;
+ *tty->flip.char_buf_ptr++ = 0;
+ special_count++;
+ break;
+ case C_CM_RXBRK:
+ tty->flip.count++;
+ *tty->flip.flag_buf_ptr++ = TTY_BREAK;
+ *tty->flip.char_buf_ptr++ = 0;
+ special_count++;
+ break;
+ case C_CM_MDCD:
+ if (info->flags & ASYNC_CHECK_CD){
+ if ((fw_ver > 241 ?
+ ((u_long)param) :
+ cy_readl(&ch_ctrl[channel].rs_status)) & C_RS_DCD) {
+ /* SP("Open Wakeup\n"); */
+ cy_sched_event(info,
+ Cy_EVENT_OPEN_WAKEUP);
+ }else if(!((info->flags
+ & ASYNC_CALLOUT_ACTIVE)
+ &&(info->flags
+ & ASYNC_CALLOUT_NOHUP))){
+ /* SP("Hangup\n"); */
+ cy_sched_event(info,
+ Cy_EVENT_HANGUP);
+ }
+ }
+ break;
+ case C_CM_MCTS:
+ if (info->flags & ASYNC_CTS_FLOW) {
+ if(info->tty->hw_stopped){
+ if( cy_readl(&ch_ctrl[channel].rs_status) & C_RS_DCD){
+ /* cy_start isn't used because...
+ HW flow is handled by the board */
+ /* SP("Write Wakeup\n"); */
+ cy_sched_event(info,
+ Cy_EVENT_WRITE_WAKEUP);
+ }
+ }else{
+ if(!(cy_readl(&ch_ctrl[channel].rs_status) & C_RS_CTS)){
+ /* cy_stop isn't used because
+ HW flow is handled by the board */
+ /* SP("Write stop\n"); */
+ }
+ }
+ }
+ break;
+ case C_CM_MRI:
+ break;
+ case C_CM_MDSR:
+ break;
+#ifdef Z_WAKE
+ case C_CM_IOCTLW:
+ cy_sched_event(info, Cy_EVENT_SHUTDOWN_WAKEUP);
+ break;
+#endif
+ case C_CM_RXHIWM:
+ case C_CM_RXNNDT:
+ /* Reception Interrupt */
+#ifdef CY_DEBUG_INTERRUPTS
+ printk("cyz_interrupt: rcvd intr, card %d, port %ld\n\r",
+ info->card, channel);
+#endif
+
+ rx_get = cy_readl(&buf_ctrl->rx_get);
+ rx_put = cy_readl(&buf_ctrl->rx_put);
+ rx_bufsize = cy_readl(&buf_ctrl->rx_bufsize);
+ if (rx_put >= rx_get)
+ char_count = rx_put - rx_get;
+ else
+ char_count = rx_put - rx_get + rx_bufsize;
+
+ if ( char_count ){
+
+#ifdef CY_ENABLE_MONITORING
+ info->mon.int_count++;
+ info->mon.char_count += char_count;
+ if (char_count > info->mon.char_max)
+ info->mon.char_max = char_count;
+ info->mon.char_last = char_count;
+#endif
+ info->idle_stats.recv_bytes += char_count;
+ info->idle_stats.recv_idle = jiffies;
+ if( tty == 0){
+ /* flush received characters */
+ rx_get = (rx_get + char_count) & (rx_bufsize - 1);
+ /* SP("-"); */
+ info->rflush_count++;
+ }else{
+#ifdef BLOCKMOVE
+ /* we'd like to use memcpy(t, f, n) and memset(s, c, count)
+ for performance, but because of buffer boundaries, there
+ may be several steps to the operation */
+ while(0 < (small_count
+ = cy_min((rx_bufsize - rx_get),
+ cy_min((TTY_FLIPBUF_SIZE - tty->flip.count),
+ char_count)))){
+
+ memcpy_fromio(tty->flip.char_buf_ptr,
+ (char *)(cinfo->base_addr
+ + cy_readl(&buf_ctrl->rx_bufaddr)
+ + rx_get),
+ small_count);
+
+ tty->flip.char_buf_ptr += small_count;
+ memset(tty->flip.flag_buf_ptr,
+ TTY_NORMAL,
+ small_count);
+ tty->flip.flag_buf_ptr += small_count;
+ rx_get = (rx_get + small_count) & (rx_bufsize - 1);
+ char_count -= small_count;
+ tty->flip.count += small_count;
+ }
+#else
+ while(char_count--){
+ if (tty->flip.count >= TTY_FLIPBUF_SIZE){
+ break;
+ }
+ data = cy_readb(cinfo->base_addr +
+ cy_readl(&buf_ctrl->rx_bufaddr) + rx_get);
+ rx_get = (rx_get + 1) & (rx_bufsize - 1);
+ tty->flip.count++;
+ *tty->flip.flag_buf_ptr++ = TTY_NORMAL;
+ *tty->flip.char_buf_ptr++ = data;
+ }
+#endif
+ queue_task(&tty->flip.tqueue, &tq_timer);
+ }
+ /* Update rx_get */
+ cy_writel(&buf_ctrl->rx_get, rx_get);
+ }
+ break;
+ case C_CM_TXBEMPTY:
+ case C_CM_TXLOWWM:
+ case C_CM_INTBACK:
+ /* Transmission Interrupt */
+#ifdef CY_DEBUG_INTERRUPTS
+ printk("cyz_interrupt: xmit intr, card %d, port %ld\n\r",
+ info->card, channel);
+#endif
+
+ tx_get = cy_readl(&buf_ctrl->tx_get);
+ tx_put = cy_readl(&buf_ctrl->tx_put);
+ tx_bufsize = cy_readl(&buf_ctrl->tx_bufsize);
+ if (tx_put >= tx_get)
+ char_count = tx_get - tx_put - 1 + tx_bufsize;
+ else
+ char_count = tx_get - tx_put - 1;
+
+ if ( char_count ){
+
+ if( tty == 0 ){
+ goto ztxdone;
+ }
+
+ if(info->x_char) { /* send special char */
+ data = info->x_char;
+
+ cy_writeb((cinfo->base_addr +
+ cy_readl(&buf_ctrl->tx_bufaddr) + tx_put), data);
+ tx_put = (tx_put + 1) & (tx_bufsize - 1);
+ info->x_char = 0;
+ char_count--;
+ }
+#ifdef BLOCKMOVE
+ while(0 < (small_count
+ = cy_min((tx_bufsize - tx_put),
+ cy_min ((SERIAL_XMIT_SIZE - info->xmit_tail),
+ cy_min(info->xmit_cnt, char_count))))){
+
+ memcpy_toio((char *)(cinfo->base_addr
+ + cy_readl(&buf_ctrl->tx_bufaddr) + tx_put),
+ &info->xmit_buf[info->xmit_tail],
+ small_count);
+
+ tx_put = (tx_put + small_count) & (tx_bufsize - 1);
+ char_count -= small_count;
+ info->xmit_cnt -= small_count;
+ info->xmit_tail =
+ (info->xmit_tail + small_count) & (SERIAL_XMIT_SIZE - 1);
+ }
+#else
+ while (info->xmit_cnt && char_count){
+ data = info->xmit_buf[info->xmit_tail];
+ info->xmit_cnt--;
+ info->xmit_tail =
+ (info->xmit_tail + 1) & (SERIAL_XMIT_SIZE - 1);
+
+ cy_writeb(cinfo->base_addr +
+ cy_readl(&buf_ctrl->tx_bufaddr) + tx_put,
+ data);
+ tx_put = (tx_put + 1) & (tx_bufsize - 1);
+ char_count--;
+ }
+
+#endif
+ ztxdone:
+ if (info->xmit_cnt < WAKEUP_CHARS) {
+ cy_sched_event(info, Cy_EVENT_WRITE_WAKEUP);
+ }
+ /* Update tx_put */
+ cy_writel(&buf_ctrl->tx_put, tx_put);
+ }
+ break;
+ case C_CM_FATAL:
+ /* should do something with this !!! */
+ break;
+ }
+ if(special_count){
+ queue_task(&tty->flip.tqueue, &tq_timer);
+ }
+ }
+
+ return;
} /* cyz_interrupt */
+#else /* CONFIG_CYZ_INTR */
static void
cyz_poll(unsigned long arg)
firm_id = (struct FIRM_ID *)(cinfo->base_addr + ID_ADDRESS);
if (!ISZLOADED(*cinfo)) {
- cinfo->inact_ctrl = 0;
continue;
}
hw_ver = cy_readl(&((struct RUNTIME_9060 *)
(cinfo->ctl_addr))->mail_box_0);
- /* Enables the firmware inactivity control */
- if ((fw_ver > 0x00000310L) && (!cinfo->inact_ctrl)) {
- param = cyz_issue_cmd( &cy_card[card], 0L, C_CM_TINACT, 0L);
- cinfo->inact_ctrl = 1;
- }
-
while(cyz_fetch_msg(cinfo, &channel, &cmd, ¶m) == 1){
char_count = 0;
info = &cy_port[ channel + cinfo->first_line ];
}
/* poll every 40 ms */
cyz_timerlist.expires = jiffies + cyz_polling_cycle;
-
- /* refresh inactivity counter */
- if (cinfo->inact_ctrl) {
- cy_writel(&board_ctrl->inactivity, (uclong) ZF_TINACT);
- }
}
add_timer(&cyz_timerlist);
return;
} /* cyz_poll */
+#endif /* CONFIG_CYZ_INTR */
/********** End of block of Cyclades-Z specific code *********/
/***********************************************************/
cy_writel(&ch_ctrl[channel].op_mode, C_CH_ENABLE);
#ifdef Z_WAKE
+#ifdef CONFIG_CYZ_INTR
cy_writel(&ch_ctrl[channel].intr_enable,
- C_IN_MDCD|C_IN_MCTS|C_IN_IOCTLW);
+ C_IN_TXBEMPTY|C_IN_TXLOWWM|C_IN_RXHIWM|C_IN_RXNNDT|
+ C_IN_IOCTLW|
+ C_IN_MDCD|C_IN_MCTS);
#else
cy_writel(&ch_ctrl[channel].intr_enable,
+ C_IN_IOCTLW|
C_IN_MDCD|C_IN_MCTS);
-#endif
+#endif /* CONFIG_CYZ_INTR */
+#else
+#ifdef CONFIG_CYZ_INTR
+ cy_writel(&ch_ctrl[channel].intr_enable,
+ C_IN_TXBEMPTY|C_IN_TXLOWWM|C_IN_RXHIWM|C_IN_RXNNDT|
+ C_IN_MDCD|C_IN_MCTS);
+#else
+ cy_writel(&ch_ctrl[channel].intr_enable,
+ C_IN_MDCD|C_IN_MCTS);
+#endif /* CONFIG_CYZ_INTR */
+#endif /* Z_WAKE */
+
retval = cyz_issue_cmd( &cy_card[card],
channel, C_CM_IOCTL, 0L); /* was C_CM_RESET */
if (retval != 0){
cy_readb(base_addr+(CySRER<<index)) | CyTxMpty);
restore_flags(flags);
} else {
+#ifdef CONFIG_CYZ_INTR
+ int retval;
+
+ save_flags(flags); cli();
+ retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_INTBACK, 0L);
+ if (retval != 0){
+ printk("cyc:start_xmit retval was %x\n", retval);
+ }
+ restore_flags(flags);
+#else /* CONFIG_CYZ_INTR */
/* Don't have to do anything at this time */
+#endif /* CONFIG_CYZ_INTR */
}
} /* start_xmit */
-
/*
* This routine shuts down a serial port; interrupts are disabled,
* and DTR is dropped if the hangup on close termio flag is on.
} else {
printk("cyc:Cyclades-Z firmware not yet loaded\n");
}
+ MOD_DEC_USE_COUNT;
return -ENODEV;
}
+#ifdef CONFIG_CYZ_INTR
+ else {
+ /* In case this Z board is operating in interrupt mode, its
+ interrupts should be enabled as soon as the first open happens
+ to one of its ports. */
+ if (!cy_card[info->card].intr_enabled) {
+ retval = cyz_issue_cmd(&cy_card[info->card],
+ 0, C_CM_IRQ_ENBL, 0L);
+ if (retval != 0){
+ printk("cyc:IRQ enable retval was %x\n", retval);
+ }
+ cy_card[info->card].intr_enabled = 1;
+ }
+ }
+#endif /* CONFIG_CYZ_INTR */
}
#ifdef CY_DEBUG_OTHER
printk("cyc:cy_open ttyC%d\n", info->line); /* */
if (break_state == -1) {
if (!info->breakon) {
info->breakon = 1;
- if (!info->xmit_cnt ) {
+ if (!info->xmit_cnt) {
start_xmit(info);
}
}
} else {
if (!info->breakoff) {
info->breakoff = 1;
- if (!info->xmit_cnt ) {
+ if (!info->xmit_cnt) {
start_xmit(info);
}
}
case CYGETCD1400VER:
ret_val = info->chip_rev;
break;
+#ifndef CONFIG_CYZ_INTR
case CYZSETPOLLCYCLE:
cyz_polling_cycle = (arg * HZ) / 1000;
ret_val = 0;
case CYZGETPOLLCYCLE:
ret_val = (cyz_polling_cycle * 1000) / HZ;
break;
+#endif /* CONFIG_CYZ_INTR */
case CYSETWAIT:
info->closing_wait = (unsigned short)arg * HZ/100;
ret_val = 0;
cy_flush_buffer(struct tty_struct *tty)
{
struct cyclades_port *info = (struct cyclades_port *)tty->driver_data;
- int card, channel;
+ int card, channel, retval;
unsigned long flags;
#ifdef CY_DEBUG_IO
if (IS_CYC_Z(cy_card[card])) { /* If it is a Z card, flush the on-board
buffers as well */
- static volatile struct FIRM_ID *firm_id;
- static volatile struct ZFW_CTRL *zfw_ctrl;
- static volatile struct CH_CTRL *ch_ctrl;
- static volatile struct BUF_CTRL *buf_ctrl;
-
- firm_id = (struct FIRM_ID *)(cy_card[card].base_addr + ID_ADDRESS);
- zfw_ctrl = (struct ZFW_CTRL *) (cy_card[card].base_addr +
- cy_readl(&firm_id->zfwctrl_addr));
- ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
- buf_ctrl = &(zfw_ctrl->buf_ctrl[channel]);
-
- while (cy_readl(&buf_ctrl->tx_get) != cy_readl(&buf_ctrl->tx_put))
- cy_writel(&buf_ctrl->tx_put, cy_readl(&buf_ctrl->tx_get));
+ retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_FLUSH_TX, 0L);
+ if (retval != 0) {
+ printk("cyc: flush_buffer retval was %x\n", retval);
+ }
}
wake_up_interruptible(&tty->write_wait);
if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP))
/* initialize chips on Cyclom-Y card -- return number of valid
chips (which is number of ports/4) */
-__initfunc(static unsigned short
-cyy_init_card(volatile ucchar *true_base_addr,int index))
+static unsigned short __init
+cyy_init_card(volatile ucchar *true_base_addr,int index)
{
unsigned int chip_number;
volatile ucchar* base_addr;
* sets global variables and return the number of ISA boards found.
* ---------------------------------------------------------------------
*/
-__initfunc(static int
-cy_detect_isa(void))
+static int __init cy_detect_isa(void)
{
unsigned short cy_isa_irq,nboard;
volatile ucchar *cy_isa_address;
* sets global variables and return the number of PCI boards found.
* ---------------------------------------------------------------------
*/
-__initfunc(static int
-cy_detect_pci(void))
+static int __init
+cy_detect_pci(void)
{
#ifdef CONFIG_PCI
return(i);
}
+#ifdef CONFIG_CYZ_INTR
/* allocate IRQ only if board has an IRQ */
- if( (1 < cy_pci_irq) && (cy_pci_irq < 15) ) {
- if(request_irq(cy_pci_irq,cyz_interrupt,
- SA_SHIRQ,"Cyclades-Z",&cy_card[j]))
+ if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) {
+ if(request_irq(cy_pci_irq, cyz_interrupt,
+ SA_SHIRQ, "Cyclades-Z", &cy_card[j]))
{
printk("Could not allocate IRQ%d ",
cy_pci_irq);
return(i);
}
}
+#endif /* CONFIG_CYZ_INTR */
/* set cy_card */
/* print message */
/* don't report IRQ if board is no IRQ */
- if( (cy_pci_irq < 15) && (cy_pci_irq > 1) ) {
+ if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) {
printk("Cyclades-8Zo/PCI #%d: 0x%lx-0x%lx, IRQ%d, ",
j+1,(ulong)cy_pci_addr2,
(ulong)(cy_pci_addr2 + CyPCI_Zwin - 1),
}
printk("%d channels starting from port %d.\n",
cy_pci_nchan,cy_next_channel);
+#ifdef CONFIG_CYZ_INTR
+ /* Enable interrupts on the PLX chip */
+ cy_writew(cy_pci_addr0+0x68,
+ cy_readw(cy_pci_addr0+0x68)|0x0900);
+#endif /* CONFIG_CYZ_INTR */
cy_next_channel += cy_pci_nchan;
}
}
(ulong)cy_pci_addr2, (ulong)cy_pci_addr0);
printk("Cyclades-Z/PCI: New Cyclades-Z board. FPGA not loaded\n");
#endif
- /* The following clears the firmware id word. This ensures
- that the driver will not attempt to talk to the board
- until it has been properly initialized.
- */
PAUSE
/* This must be the new Cyclades-Ze/PCI. */
cy_pci_nchan = ZE_V1_NPORTS;
return(i);
}
+#ifdef CONFIG_CYZ_INTR
/* allocate IRQ only if board has an IRQ */
- if( (1 < cy_pci_irq) && (cy_pci_irq < 15) ) {
- if(request_irq(cy_pci_irq,cyz_interrupt,
- SA_SHIRQ,"Cyclades-Z",&cy_card[j]))
+ if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) {
+ if(request_irq(cy_pci_irq, cyz_interrupt,
+ SA_SHIRQ, "Cyclades-Z", &cy_card[j]))
{
printk("Could not allocate IRQ%d ",
cy_pci_irq);
return(i);
}
}
+#endif /* CONFIG_CYZ_INTR */
/* set cy_card */
cy_card[j].base_addr = cy_pci_addr2;
/* print message */
/* don't report IRQ if board is no IRQ */
- if( (cy_pci_irq < 15) && (cy_pci_irq > 1) ) {
+ if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) {
printk("Cyclades-Ze/PCI #%d: 0x%lx-0x%lx, IRQ%d, ",
j+1,(ulong)cy_pci_addr2,
(ulong)(cy_pci_addr2 + CyPCI_Ze_win - 1),
}
printk("%d channels starting from port %d.\n",
cy_pci_nchan,cy_next_channel);
+#ifdef CONFIG_CYZ_INTR
+ /* Enable interrupts on the PLX chip */
+ cy_writew(cy_pci_addr0+0x68,
+ cy_readw(cy_pci_addr0+0x68)|0x0900);
+#endif /* CONFIG_CYZ_INTR */
cy_next_channel += cy_pci_nchan;
}
if (ZeIndex != 0) {
extra ports are ignored.
*/
-__initfunc(int
-cy_init(void))
+int __init
+cy_init(void)
{
struct cyclades_port *info;
struct cyclades_card *cinfo;
mailbox = cy_readl(&((struct RUNTIME_9060 *)
cy_card[board].ctl_addr)->mail_box_0);
nports = (mailbox == ZE_V1) ? ZE_V1_NPORTS : 8;
+ cinfo->intr_enabled = 0;
for (port = cinfo->first_line ;
port < cinfo->first_line + nports;
port++)
}
}
}
-
- if ( number_z_boards && !cyz_timeron){
- cyz_timeron++;
+
+#ifndef CONFIG_CYZ_INTR
+ if (number_z_boards && !cyz_timeron){
+ cyz_timeron++;
cyz_timerlist.expires = jiffies + 1;
add_timer(&cyz_timerlist);
#ifdef CY_PCI_DEBUG
printk("Cyclades-Z polling initialized\n");
#endif
}
+#endif /* CONFIG_CYZ_INTR */
#ifdef CY_PROC
ent = create_proc_entry("cyclades", S_IFREG | S_IRUGO, 0);
int e1, e2;
unsigned long flags;
+#ifndef CONFIG_CYZ_INTR
if (cyz_timeron){
cyz_timeron = 0;
del_timer(&cyz_timerlist);
}
+#endif /* CONFIG_CYZ_INTR */
save_flags(flags); cli();
remove_bh(CYCLADES_BH);
for (i = 0; i < NR_CARDS; i++) {
if (cy_card[i].base_addr != 0
+#ifndef CONFIG_CYZ_INTR
+ && cy_card[i].num_chips != -1 /* not a Z card */
+#endif /* CONFIG_CYZ_INTR */
&& cy_card[i].irq)
{
free_irq(cy_card[i].irq, &cy_card[i]);
APOLLO_MOUSE_MINOR, "apollomouse", &apollo_mouse_fops
};
-__initfunc(int dn_keyb_init(void)) {
+int __init dn_keyb_init(void){
/* printk("dn_keyb_init\n"); */
/****** Init and module functions ******/
-
-__initfunc(int dsp56k_init(void))
+int __init dsp56k_init(void)
{
if(!MACH_IS_ATARI || !ATARIHW_PRESENT(DSP56K)) {
printk("DSP56k driver: Hardware not present\n");
/*
* The serial driver boot-time initialization code!
*/
-__initfunc(int espserial_init(void))
+int __init espserial_init(void)
{
int i, offset;
int region_start;
/* Called by modules package when installing the driver
* or by kernel during the initialization phase
*/
-__initfunc(int ftape_init(void))
+int __init ftape_init(void)
{
TRACE_FUN(ft_t_flow);
return len;
}
-__initfunc(int ftape_proc_init(void))
+int __init ftape_proc_init(void)
{
return FT_PROC_REGISTER(&proc_root, &proc_ftape);
}
{ "mach2", &ft_mach2, CONFIG_FT_MACH2, 0, 1}
};
-__initfunc(void ftape_setup(char *str, int *ints))
+void __init ftape_setup(char *str, int *ints)
{
int i;
int param;
/* Called by modules package when installing the driver or by kernel
* during the initialization phase
*/
-__initfunc(int zft_init(void))
+int __init zft_init(void)
{
TRACE_FUN(ft_t_flow);
}
/* --------------------------------------------------------------------- */
-__initfunc(static int check_lpt(struct hfmodem_state *dev, unsigned int iobase))
+static int __init check_lpt(struct hfmodem_state *dev, unsigned int iobase)
{
struct parport *pp = parport_enumerate();
enum uart { c_uart_unknown, c_uart_8250, c_uart_16450, c_uart_16550, c_uart_16550A };
static const char *uart_str[] __initdata = { "unknown", "8250", "16450", "16550", "16550A" };
-__initfunc(static enum uart check_uart(unsigned int iobase))
+static enum uart __init check_uart(unsigned int iobase)
{
unsigned char b1,b2,b3;
enum uart u;
/* --------------------------------------------------------------------- */
-__initfunc(static int check_midi(unsigned int iobase))
+static int __init check_midi(unsigned int iobase)
{
unsigned long timeout;
unsigned long flags;
/* --------------------------------------------------------------------- */
-__initfunc(static void output_check(struct hfmodem_state *dev))
+static void __init output_check(struct hfmodem_state *dev)
{
enum uart u = c_uart_unknown;
#endif
-__initfunc(int init_module(void))
+int __init init_module(void)
{
int i;
static int hw = 0;
-__initfunc(void hfmodem_setup(char *str, int *ints))
+void __init hfmodem_setup(char *str, int *ints)
{
if (ints[0] < 7) {
printk(KERN_WARNING "%s: setup: too few parameters\n", hfmodem_drvname);
hfmodem_refclock_setscale(ints[ints[0]-2], ints[ints[0]-1], ints[ints[0]]);
}
-__initfunc(void hfmodem_init(void))
+void __init hfmodem_init(void)
{
int i;
/* --------------------------------------------------------------------- */
#ifdef __i386__
-__initfunc(static void i386_capability(void))
+static void __init i386_capability(void)
{
if (boot_cpu_data.x86_capability & X86_FEATURE_TSC)
rdtsc_ok = 1;
/* --------------------------------------------------------------------- */
-__initfunc(void hfmodem_refclock_probe(void))
+void __init hfmodem_refclock_probe(void)
{
#ifdef __i386__
if (rdtsc_ok) {
* 971222 Changed open/close for temperature handling
* Michael Meskes <meskes@debian.org>.
* 980112 Used minor numbers from include/linux/miscdevice.h
+ * 990605 Made changes to code to support Firmware 1.22a, added
+ * fairly useless proc entry.
+ * 990610 removed said useless proc code for the merge <alan>
*/
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/watchdog.h>
#include <linux/init.h>
+#include <linux/proc_fs.h>
#include <asm/uaccess.h>
#include <asm/io.h>
*/
static int pcwd_ioports[] = { 0x270, 0x350, 0x370, 0x000 };
-#define WD_VER "1.0 (11/18/96)"
+#define WD_VER "1.10 (06/05/99)"
/*
* It should be noted that PCWD_REVISION_B was removed because A and B
* This routine checks the "current_readport" to see if the card lies there.
* If it does, it returns accordingly.
*/
-__initfunc(static int pcwd_checkcard(void))
+static int __init pcwd_checkcard(void)
{
int card_dat, prev_card_dat, found = 0, count = 0, done = 0;
int i, cdat, rv;
static struct watchdog_info ident=
{
- /* FIXME: should set A/C here */
WDIOF_OVERHEAT|WDIOF_CARDRESET,
1,
- "PCWD."
+ "PCWD"
};
switch(cmd) {
switch(MINOR(file->f_dentry->d_inode->i_rdev))
{
case TEMP_MINOR:
- /* c is in celsius, we need fahrenheit */
- cp = (c*9/5)+32;
+ /*
+ * Convert metric to Fahrenheit, since this was
+ * the decided 'standard' for this return value.
+ */
+ cp = (c * 9 / 5) + 32;
if(copy_to_user(buf, &cp, 1))
return -EFAULT;
return 1;
return(PCWD_REVISION_C);
}
-__initfunc(static int send_command(int cmd))
+static int __init send_command(int cmd)
{
int i;
mode_debug = 0;
}
+static int pcwd_proc_get_info(char *buffer, char **start, off_t offset,
+ int length, int inout)
+{
+ int len;
+ off_t begin = 0;
+
+ revision = get_revision();
+ len = sprintf(buffer, "Version = " WD_VER "\n");
+
+ if (revision == PCWD_REVISION_A)
+ len += sprintf(buffer + len, "Revision = A\n");
+ else
+ len += sprintf(buffer + len, "Revision = C\n");
+
+ if (supports_temp) {
+ unsigned short c = inb(current_readport);
+
+ len += sprintf(buffer + len, "Temp = Yes\n"
+ "Current temp = %d (Celsius)\n",
+ c);
+ } else
+ len += sprintf(buffer + len, "Temp = No\n");
+
+ *start = buffer + (offset);
+ len -= offset;
+
+ if (len > length)
+ len = length;
+
+ return len;
+}
+
static struct file_operations pcwd_fops = {
NULL, /* Seek */
pcwd_read, /* Read */
#ifdef MODULE
int init_module(void)
#else
-__initfunc(int pcwatchdog_init(void))
+int __init pcwatchdog_init(void)
#endif
{
int i, found = 0;
revision = PCWD_REVISION_A;
- printk("pcwd: v%s Ken Hollis (khollis@nurk.org)\n", WD_VER);
+ printk("pcwd: v%s Ken Hollis (kenji@bitgate.com)\n", WD_VER);
/* Initial variables */
is_open = 0;
return -1;
}
+ if (supports_temp)
+ printk("pcwd: Temperature Option Detected.\n");
+
debug_off();
pcwd_showprevstate();
}
/* Only one at a time from here on... */
- if (atomic_read(&filp->f_count)>1) /* filp->f_count==1 for the first open() */
+ if (file_count(filp)>1) /* filp->f_count==1 for the first open() */
{
return -EBUSY;
}
* Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI>
*/
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/pci.h>
return(0);
}
-__initfunc(int
-setup_amd7930(struct IsdnCard *card))
+int __init
+setup_amd7930(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
char tmp[64];
return(0);
}
-__initfunc(int
-setup_asuscom(struct IsdnCard *card))
+int __init
+setup_asuscom(struct IsdnCard *card)
{
int bytecnt;
struct IsdnCardState *cs = card->cs;
return(0);
}
-__initfunc(int
-setup_avm_a1(struct IsdnCard *card))
+int __init
+setup_avm_a1(struct IsdnCard *card)
{
u_char val;
struct IsdnCardState *cs = card->cs;
#ifdef MODULE
#define HiSax_init init_module
#else
-__initfunc(void
-HiSax_setup(char *str, int *ints))
+void __init
+HiSax_setup(char *str, int *ints)
{
int i, j, argc;
}
-__initfunc(int
-HiSax_init(void))
+int __init
+HiSax_init(void)
{
int i;
static struct pci_dev *dev_diva __initdata = NULL;
static struct pci_dev *dev_diva_u __initdata = NULL;
-__initfunc(int
-setup_diva(struct IsdnCard *card))
+int __init
+setup_diva(struct IsdnCard *card)
{
int bytecnt;
u_char val;
extern struct foreign_interface dbri_foreign_interface;
#endif
-__initfunc(int
-setup_foreign(struct IsdnCard *card))
+int __init
+setup_foreign(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
char tmp[64];
#endif
}
-__initfunc(unsigned int
-*init_send_hfcd(int cnt))
+unsigned int __init
+*init_send_hfcd(int cnt)
{
int i, *send;
return(send);
}
-__initfunc(void
-init2bds0(struct IsdnCardState *cs))
+void __init
+init2bds0(struct IsdnCardState *cs)
{
cs->setstack_d = setstack_hfcd;
cs->dbusytimer.function = (void *) hfc_dbusy_timer;
return (0);
}
-__initfunc(void
-init_send(struct BCState *bcs))
+void __init
+init_send(struct BCState *bcs)
{
int i;
bcs->hw.hfc.send[i] = 0x1fff;
}
-__initfunc(void
-inithfc(struct IsdnCardState *cs))
+void __init
+inithfc(struct IsdnCardState *cs)
{
init_send(&cs->bcs[0]);
init_send(&cs->bcs[1]);
}
-__initfunc(int
-setup_ix1micro(struct IsdnCard *card))
+int __init
+setup_ix1micro(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
char tmp[64];
return(0);
}
-__initfunc(int
-setup_mic(struct IsdnCard *card))
+int __init
+setup_mic(struct IsdnCard *card)
{
int bytecnt;
struct IsdnCardState *cs = card->cs;
}
-__initfunc(void
-inittiger(struct IsdnCardState *cs))
+void __init
+inittiger(struct IsdnCardState *cs)
{
if (!(cs->bcs[0].hw.tiger.send = kmalloc(NETJET_DMA_SIZE * sizeof(unsigned int),
GFP_KERNEL | GFP_DMA))) {
static struct pci_dev *dev_netjet __initdata = NULL;
-__initfunc(int
-setup_netjet(struct IsdnCard *card))
+int __init
+setup_netjet(struct IsdnCard *card)
{
int bytecnt;
struct IsdnCardState *cs = card->cs;
static struct pci_dev *niccy_dev __initdata = NULL;
-__initfunc(int
-setup_niccy(struct IsdnCard *card))
+int __init
+setup_niccy(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
char tmp[64];
static int pci_index __initdata = 0;
#endif
-__initfunc(int
-setup_sedlbauer(struct IsdnCard *card))
+int __init
+setup_sedlbauer(struct IsdnCard *card)
{
int bytecnt, ver, val;
struct IsdnCardState *cs = card->cs;
return(0);
}
-__initfunc(int
-get_io_range(struct IsdnCardState *cs))
+int __init
+get_io_range(struct IsdnCardState *cs)
{
int i, j, adr;
}
}
-__initfunc(int
-setup_sportster(struct IsdnCard *card))
+int __init
+setup_sportster(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
char tmp[64];
return(0);
}
-__initfunc(int
-setup_TeleInt(struct IsdnCard *card))
+int __init
+setup_TeleInt(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
char tmp[64];
return(0);
}
-__initfunc(int
-setup_teles0(struct IsdnCard *card))
+int __init
+setup_teles0(struct IsdnCard *card)
{
u_char val;
struct IsdnCardState *cs = card->cs;
return(0);
}
-__initfunc(int
-setup_teles3(struct IsdnCard *card))
+int __init
+setup_teles3(struct IsdnCard *card)
{
u_char val;
struct IsdnCardState *cs = card->cs;
return(0);
}
-__initfunc(int
-setup_t163c(struct IsdnCard *card))
+int __init
+setup_t163c(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
char tmp[64];
const void *buffer, size_t len,
int flags)
{
- return 0; /* FIXME */
+ /* This is untested */
+ unsigned char *bp = (unsigned char *) buffer;
+ size_t ret = 0;
+
+ parport_frob_control (port,
+ PARPORT_CONTROL_STROBE |
+ PARPORT_CONTROL_AUTOFD |
+ PARPORT_CONTROL_SELECT,
+ PARPORT_CONTROL_STROBE |
+ PARPORT_CONTROL_SELECT);
+ port->ops->data_forward (port);
+ for (; len > 0; len--, bp++) {
+ parport_write_data (port, *bp);
+
+ if (parport_wait_peripheral (port, PARPORT_STATUS_BUSY,
+ PARPORT_STATUS_BUSY))
+ break;
+
+ /* Strobe data */
+ parport_frob_control (port, PARPORT_CONTROL_AUTOFD,
+ PARPORT_CONTROL_AUTOFD);
+
+ if (parport_wait_peripheral (port, PARPORT_STATUS_BUSY, 0))
+ break;
+
+ parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);
+ ret++;
+ }
+
+ return ret;
}
/* EPP mode, reverse channel, data. */
void *buffer, size_t len,
int flags)
{
- return 0; /* FIXME */
+ /* This is untested. */
+ unsigned char *bp = (unsigned char *) buffer;
+ unsigned ret = 0;
+
+ parport_frob_control (port,
+ PARPORT_CONTROL_STROBE |
+ PARPORT_CONTROL_AUTOFD |
+ PARPORT_CONTROL_SELECT, 0);
+ port->ops->data_reverse (port);
+ for (; len > 0; len--, bp++) {
+ if (parport_wait_peripheral (port, PARPORT_STATUS_BUSY,
+ PARPORT_STATUS_BUSY))
+ break;
+
+ parport_frob_control (port, PARPORT_CONTROL_AUTOFD,
+ PARPORT_CONTROL_AUTOFD);
+
+ if (parport_wait_peripheral (port, PARPORT_STATUS_BUSY, 0))
+ break;
+
+ *bp = parport_read_data (port);
+
+ parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);
+ ret++;
+ }
+ port->ops->data_forward (port);
+
+ return ret;
}
/* EPP mode, forward channel, addresses. */
const void *buffer, size_t len,
int flags)
{
- return 0; /* FIXME */
+ /* This is untested */
+ unsigned char *bp = (unsigned char *) buffer;
+ size_t ret = 0;
+
+ parport_frob_control (port,
+ PARPORT_CONTROL_STROBE |
+ PARPORT_CONTROL_SELECT |
+ PARPORT_CONTROL_AUTOFD,
+ PARPORT_CONTROL_STROBE |
+ PARPORT_CONTROL_SELECT);
+ port->ops->data_forward (port);
+ for (; len > 0; len--, bp++) {
+ parport_write_data (port, *bp);
+
+ if (parport_wait_peripheral (port, PARPORT_STATUS_BUSY,
+ PARPORT_STATUS_BUSY))
+ break;
+
+ /* Strobe data */
+ parport_frob_control (port, PARPORT_CONTROL_SELECT,
+ PARPORT_CONTROL_SELECT);
+
+ if (parport_wait_peripheral (port, PARPORT_STATUS_BUSY, 0))
+ break;
+
+ parport_frob_control (port, PARPORT_CONTROL_SELECT, 0);
+ ret++;
+ }
+
+ return ret;
}
/* EPP mode, reverse channel, addresses. */
void *buffer, size_t len,
int flags)
{
- return 0; /* FIXME */
+ /* This is untested. */
+ unsigned char *bp = (unsigned char *) buffer;
+ unsigned ret = 0;
+
+ parport_frob_control (port,
+ PARPORT_CONTROL_STROBE |
+ PARPORT_CONTROL_SELECT |
+ PARPORT_CONTROL_AUTOFD, 0);
+ port->ops->data_reverse (port);
+ for (; len > 0; len--, bp++) {
+ if (parport_wait_peripheral (port, PARPORT_STATUS_BUSY,
+ PARPORT_STATUS_BUSY))
+ break;
+
+ parport_frob_control (port, PARPORT_CONTROL_SELECT,
+ PARPORT_CONTROL_SELECT);
+
+ if (parport_wait_peripheral (port, PARPORT_STATUS_BUSY, 0))
+ break;
+
+ *bp = parport_read_data (port);
+
+ parport_frob_control (port, PARPORT_CONTROL_SELECT, 0);
+ ret++;
+ }
+ port->ops->data_forward (port);
+
+ return ret;
}
struct netdev_entry el1_drv = {"3c501", el1_probe1, EL1_IO_EXTENT, netcard_portlist};
#else
-__initfunc(int el1_probe(struct device *dev))
+int __init el1_probe(struct device *dev)
{
int i;
int base_addr = dev ? dev->base_addr : 0;
* The actual probe.
*/
-__initfunc(static int el1_probe1(struct device *dev, int ioaddr))
+static int __init el1_probe1(struct device *dev, int ioaddr)
{
struct net_local *lp;
const char *mname; /* Vendor name */
If the ethercard isn't found there is an optional probe for
ethercard jumpered to programmed-I/O mode.
*/
-__initfunc(int
-el2_probe(struct device *dev))
+int __init
+el2_probe(struct device *dev)
{
int *addr, addrs[] = { 0xddffe, 0xd9ffe, 0xcdffe, 0xc9ffe, 0};
int base_addr = dev->base_addr;
#ifndef HAVE_DEVLIST
/* Try all of the locations that aren't obviously empty. This touches
a lot of locations, and is much riskier than the code above. */
-__initfunc(int
-el2_pio_probe(struct device *dev))
+int __init
+el2_pio_probe(struct device *dev)
{
int i;
int base_addr = dev ? dev->base_addr : 0;
/* Probe for the Etherlink II card at I/O port base IOADDR,
returning non-zero on success. If found, set the station
address and memory parameters in DEVICE. */
-__initfunc(int
-el2_probe1(struct device *dev, int ioaddr))
+int __init
+el2_probe1(struct device *dev, int ioaddr)
{
int i, iobase_reg, membase_reg, saved_406, wordlength;
static unsigned version_printed = 0;
* Called only by elp_autodetect
************************************************************/
-__initfunc(static int elp_sense(struct device *dev))
+static int __init elp_sense(struct device *dev)
{
int timeout;
int addr = dev->base_addr;
* Called only by eplus_probe
*************************************************************/
-__initfunc(static int elp_autodetect(struct device *dev))
+static int __init elp_autodetect(struct device *dev)
{
int idx = 0;
* work at all if it was in a weird state).
*/
-__initfunc(int elplus_probe(struct device *dev))
+int __init elplus_probe(struct device *dev)
{
elp_device *adapter;
int i, tries, tries1, timeout, okay;
device and return success.
*/
-__initfunc(int el16_probe(struct device *dev))
+int __init el16_probe(struct device *dev)
{
int base_addr = dev ? dev->base_addr : 0;
int i;
return ENODEV;
}
-__initfunc(int el16_probe1(struct device *dev, int ioaddr))
+int __init el16_probe1(struct device *dev, int ioaddr)
{
static unsigned char init_ID_done = 0, version_printed = 0;
int i, irq, irqval;
* Check to see if there's an 82586 out there.
*/
-__initfunc(static int check586(struct device *dev, unsigned long where, unsigned size))
+static int __init check586(struct device *dev, unsigned long where, unsigned size)
{
struct priv *p = (struct priv *) dev->priv;
char *iscp_addrs[2];
/*****************************************************************/
-__initfunc(int elmc_probe(struct device *dev))
+int __init elmc_probe(struct device *dev)
{
static int slot = 0;
int base_addr = dev ? dev->base_addr : 0;
* (detachable devices only).
*/
-__initfunc(int mc32_probe(struct device *dev))
+int __init mc32_probe(struct device *dev)
{
static int current_mca_slot = -1;
int i;
* probes on the ISA bus. A good device probes avoids doing writes, and
* verifies that the correct device exists and functions.
*/
-__initfunc(static int mc32_probe1(struct device *dev, int slot))
+static int __init mc32_probe1(struct device *dev, int slot)
{
static unsigned version_printed = 0;
int i;
printk("type %2.2X%2.2X\n", (unsigned char) add[12], (unsigned char) add[13]);
}
-__initfunc(int i82596_probe(struct device *dev))
+int __init i82596_probe(struct device *dev)
{
int i;
struct i596_private *lp;
# Network device configuration
#
+mainmenu_option next_comment
+comment 'ARCnet devices'
+
tristate 'ARCnet support' CONFIG_ARCNET
if [ "$CONFIG_ARCNET" != "n" ]; then
bool ' Enable arc0e (ARCnet "Ether-Encap" packet format)' CONFIG_ARCNET_ETH
dep_tristate ' ARCnet COM20020 chipset driver' CONFIG_ARCNET_COM20020 $CONFIG_ARCNET
fi
+endmenu
+
tristate 'Dummy net driver support' CONFIG_DUMMY
tristate 'EQL (serial line load balancing) support' CONFIG_EQUALIZER
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
#
# Ethernet
#
+
+mainmenu_option next_comment
+comment 'Ethernet (10 or 100Mbit)'
+
bool 'Ethernet (10 or 100Mbit)' CONFIG_NET_ETHERNET
if [ "$CONFIG_NET_ETHERNET" = "y" ]; then
if [ "$CONFIG_ARM" = "y" ]; then
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
tristate 'RealTek 8129/8139 (not 8019/8029!) support' CONFIG_RTL8139
tristate 'Packet Engines Yellowfin Gigabit-NIC support' CONFIG_YELLOWFIN
- tristate 'Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support' CONFIG_ACENIC
fi
bool 'Other ISA cards' CONFIG_NET_ISA
if [ "$CONFIG_NET_ISA" = "y" ]; then
- tristate 'AT1700/1720 support' CONFIG_AT1700
+ tristate 'AT1700/1720 support (EXPERIMENTAL)' CONFIG_AT1700
tristate 'Cabletron E21xx support' CONFIG_E2100
tristate 'DEPCA, DE10x, DE200, DE201, DE202, DE422 support' CONFIG_DEPCA
tristate 'EtherWORKS 3 (DE203, DE204, DE205) support' CONFIG_EWRK3
tristate 'EtherExpress 16 support' CONFIG_EEXPRESS
- if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
- tristate 'EtherExpressPro support' CONFIG_EEXPRESS_PRO
- fi
+ tristate 'EtherExpressPro support' CONFIG_EEXPRESS_PRO
tristate 'FMV-181/182/183/184 support' CONFIG_FMV18X
tristate 'HP PCLAN+ (27247B and 27252A) support' CONFIG_HPLAN_PLUS
tristate 'HP PCLAN (27245 and other 27xxx series) support' CONFIG_HPLAN
fi
tristate 'NE2000/NE1000 support' CONFIG_NE2000
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
- bool 'SEEQ8005 support (EXPERIMENTAL)' CONFIG_SEEQ8005
+ tristate 'SEEQ8005 support (EXPERIMENTAL)' CONFIG_SEEQ8005
fi
bool 'SK_G16 support' CONFIG_SK_G16
fi
if [ "$CONFIG_NET_EISA" = "y" ]; then
tristate 'AMD PCnet32 (VLB and PCI) support' CONFIG_PCNET32
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+ tristate 'Alteon AceNIC/3Com 3C985/NetGear GA620 Gigabit support' CONFIG_ACENIC
tristate 'Ansel Communications EISA 3200 support (EXPERIMENTAL)' CONFIG_AC3200
fi
fi
fi
+endmenu
+
bool 'FDDI driver support' CONFIG_FDDI
if [ "$CONFIG_FDDI" = "y" ]; then
bool 'Digital DEFEA and DEFPA adapter support' CONFIG_DEFXX
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
bool 'HIPPI driver support (EXPERIMENTAL)' CONFIG_HIPPI
if [ "$CONFIG_HIPPI" = "y" ]; then
- bool 'CERN HIPPI PCI adapter support' CONFIG_CERN_HIPPI
- bool 'Essential RoadRunner HIPPI PCI adapter support' CONFIG_ROADRUNNER
+ tristate 'Essential RoadRunner HIPPI PCI adapter support' CONFIG_ROADRUNNER
if [ "$CONFIG_ROADRUNNER" != "n" ]; then
bool ' Use large TX/RX rings' CONFIG_ROADRUNNER_LARGE_RINGS
fi
fi
fi
-tristate 'Frame relay DLCI support' CONFIG_DLCI
-if [ "$CONFIG_DLCI" = "y" -o "$CONFIG_DLCI" = "m" ]; then
- int ' Max open DLCI' CONFIG_DLCI_COUNT 24
- int ' Max DLCI per device' CONFIG_DLCI_MAX 8
- dep_tristate ' SDLA (Sangoma S502/S508) support' CONFIG_SDLA $CONFIG_DLCI
-fi
-
#
# AppleTalk
#
+
if [ "$CONFIG_ATALK" != "n" ]; then
+ mainmenu_option next_comment
+ comment 'Appletalk devices'
dep_tristate 'Apple/Farallon LocalTalk PC support' CONFIG_LTPC $CONFIG_ATALK
dep_tristate 'COPS LocalTalk PC support' CONFIG_COPS $CONFIG_ATALK
if [ "$CONFIG_COPS" != "n" ]; then
bool 'IP to Appletalk-IP Encapsulation support' CONFIG_IPDDP_ENCAP
bool 'Appletalk-IP to IP Decapsulation support' CONFIG_IPDDP_DECAP
fi
+ endmenu
fi
if [ ! "$CONFIG_PARPORT" = "n" ]; then
bool 'Wireless LAN (non-hamradio)' CONFIG_NET_RADIO
if [ "$CONFIG_NET_RADIO" = "y" ]; then
- tristate 'STRIP (Metricom starmode radio IP)' CONFIG_STRIP
+ dep_tristate 'STRIP (Metricom starmode radio IP)' CONFIG_STRIP $CONFIG_INET
tristate 'AT&T WaveLAN & DEC RoamAbout DS support' CONFIG_WAVELAN
+ tristate 'Aironet Arlan 655 & IC2200 DS support' CONFIG_ARLAN
+
fi
+mainmenu_option next_comment
+comment 'Token ring devices'
+
bool 'Token Ring driver support' CONFIG_TR
if [ "$CONFIG_TR" = "y" ]; then
tristate 'IBM Tropic chipset based adaptor support' CONFIG_IBMTR
# tristate 'IBM Lanstreamer PCI adaptor support' CONFIG_IBMLS
+ tristate 'IBM Olympic chipset PCI adapter support' CONFIG_IBMOL
tristate 'SysKonnect adapter support' CONFIG_SKTR
fi
+endmenu
+
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+ tristate 'Red Creek Hardware VPN (EXPERIMENTAL)' CONFIG_RCPCI
tristate 'Traffic Shaper (EXPERIMENTAL)' CONFIG_SHAPER
fi
+
#
# WAN drivers support
#
+
+mainmenu_option next_comment
+comment 'Wan interfaces'
+
+
# There is no way to detect a comtrol sv11 - force it modular for now.
#
dep_tristate 'Comtrol Hostess SV-11 support' CONFIG_HOSTESS_SV11 m
# The COSA/SRP driver has not been tested as non-modular yet.
#
dep_tristate 'COSA/SRP sync serial boards support' CONFIG_COSA m
-tristate 'Red Creek Hardware VPN (EXPERIMENTAL)' CONFIG_RCPCI
#
+# There is no way to detect a Sealevel board. Force it modular
+#
+dep_tristate 'Sealevel Systems 4021 support' CONFIG_SEALEVEL_4021 m
+
+tristate 'Frame relay DLCI support' CONFIG_DLCI
+if [ "$CONFIG_DLCI" != "n" ]; then
+ int ' Max open DLCI' CONFIG_DLCI_COUNT 24
+ int ' Max DLCI per device' CONFIG_DLCI_MAX 8
+ dep_tristate ' SDLA (Sangoma S502/S508) support' CONFIG_SDLA $CONFIG_DLCI
+fi
+
+#
+# Wan router core.
+#
+
if [ "$CONFIG_WAN_ROUTER" != "n" ]; then
bool 'WAN drivers' CONFIG_WAN_DRIVERS
if [ "$CONFIG_WAN_DRIVERS" = "y" ]; then
endif
endif
+ifeq ($(CONFIG_IBMOL),y)
+L_OBJS += olympic.o
+else
+ ifeq ($(CONFIG_IBMOL),m)
+ M_OBJS += olympic.o
+ endif
+endif
+
ifeq ($(CONFIG_SKTR),y)
L_OBJS += sktr.o
else
endif
endif
+ifeq ($(CONFIG_SUNBMAC),y)
+L_OBJS += sunbmac.o
+else
+ ifeq ($(CONFIG_SUNBMAC),m)
+ M_OBJS += sunbmac.o
+ endif
+endif
+
ifeq ($(CONFIG_MYRI_SBUS),y)
L_OBJS += myri_sbus.o
else
endif
endif
+ifeq ($(CONFIG_ARLAN),y)
+LX_OBJS += arlan.o arlan-proc.o
+else
+ ifeq ($(CONFIG_ARLAN),m)
+ MX_OBJS += arlan.o arlan-proc.o
+ endif
+endif
+
ifeq ($(CONFIG_TLAN),y)
L_OBJS += tlan.o
else
endif
endif
+ifeq ($(CONFIG_SEALEVEL_4021),y)
+L_OBJS += sealevel.o
+CONFIG_85230_BUILTIN = y
+CONFIG_SYNCPPP_BUILTIN = y
+else
+ ifeq ($(CONFIG_SEALEVEL_4021),m)
+ CONFIG_85230_MODULE = y
+ CONFIG_SYNCPPP_MODULE = y
+ M_OBJS += sealevel.o
+ endif
+endif
+
+
ifeq ($(CONFIG_COSA),y)
L_OBJS += cosa.o
CONFIG_SYNCPPP_BUILTIN = y
endif
endif
-ifeq ($(CONFIG_CYCLADES_SYNC),m)
- MX_OBJS += cycx_drv.o
- M_OBJS += cyclomx.o
- CYCLOMX_OBJS = cycx_main.o
- ifeq ($(CONFIG_CYCLOMX_X25),y)
- CYCLOMX_OBJS += cycx_x25.o
- endif
-endif
-
ifeq ($(CONFIG_X25_ASY),y)
L_OBJS += x25_asy.o
else
extern int de4x5_probe(struct device *);
extern int el1_probe(struct device *);
extern int wavelan_probe(struct device *);
+extern int arlan_probe(struct device *);
extern int el16_probe(struct device *);
extern int elmc_probe(struct device *);
extern int skmca_probe(struct device *);
* autoprobe (i.e. a probe that fails to find a card when autoprobing
* will not be asked to autoprobe again). It exits when a card is found.
*/
-__initfunc(static int probe_list(struct device *dev, struct devprobe *plist))
+static int __init probe_list(struct device *dev, struct devprobe *plist)
{
struct devprobe *p = plist;
unsigned long base_addr = dev->base_addr;
#ifdef CONFIG_WAVELAN /* WaveLAN */
{wavelan_probe, 0},
#endif
+#ifdef CONFIG_ARLAN /* Aironet */
+ {arlan_probe, 0},
+#endif
#ifdef CONFIG_EL16 /* 3c507 */
{el16_probe, 0},
#endif
* Unified ethernet device probe, segmented per architecture and
* per bus interface.
*/
-__initfunc(static int ethif_probe(struct device *dev))
+static int __init ethif_probe(struct device *dev)
{
unsigned long base_addr = dev->base_addr;
}
#ifdef CONFIG_FDDI
-__initfunc(static int fddiif_probe(struct device *dev))
+static int __init fddiif_probe(struct device *dev)
{
unsigned long base_addr = dev->base_addr;
#ifdef CONFIG_TR
/* Token-ring device probe */
extern int ibmtr_probe(struct device *);
+extern int olympic_probe(struct device *);
static int
trif_probe(struct device *dev)
#ifdef CONFIG_IBMTR
&& ibmtr_probe(dev)
#endif
+#ifdef CONFIG_IBMOL
+ && olympic_probe(dev)
+#endif
#ifdef CONFIG_SKTR
&& sktr_probe(dev)
#endif
mark_bh(NET_BH);
}
-
-__initfunc(int a2065_probe(struct device *dev))
+int __init a2065_probe(struct device *dev)
{
unsigned int key, is_cbm;
const struct ConfigDev *cd;
or the unique value in the station address PROM.
*/
-__initfunc(int ac3200_probe(struct device *dev))
+int __init ac3200_probe(struct device *dev)
{
unsigned short ioaddr = dev->base_addr;
return ENODEV;
}
-__initfunc(static int ac_probe1(int ioaddr, struct device *dev))
+static int __init ac_probe1(int ioaddr, struct device *dev)
{
int i;
static int probed __initdata = 0;
-__initfunc(int acenic_probe (struct device *dev))
+int __init acenic_probe (struct device *dev)
{
int boards_found = 0;
int version_disp;
}
-__initfunc(static int ace_init(struct device *dev, int board_idx))
+static int __init ace_init(struct device *dev, int board_idx)
{
struct ace_private *ap;
struct ace_regs *regs;
}
-__initfunc(void ace_copy(struct ace_regs *regs, void *src, u32 dest, int size))
+void __init ace_copy(struct ace_regs *regs, void *src, u32 dest, int size)
{
unsigned long tdest;
u32 *wsrc;
}
-__initfunc(void ace_clear(struct ace_regs *regs, u32 dest, int size))
+void __init ace_clear(struct ace_regs *regs, u32 dest, int size)
{
unsigned long tdest;
short tsize = 0, i;
* This operation requires the NIC to be halted and is performed with
* interrupts disabled and with the spinlock hold.
*/
-__initfunc(int ace_load_firmware(struct device *dev))
+int __init ace_load_firmware(struct device *dev)
{
struct ace_private *ap;
struct ace_regs *regs;
static int apne_owned = 0; /* signal if card already owned */
-__initfunc(int apne_probe(struct device *dev))
+int __init apne_probe(struct device *dev)
{
#ifndef MANUAL_CONFIG
char tuple[8];
}
-
-__initfunc(static int apne_probe1(struct device *dev, int ioaddr))
+static int __init apne_probe1(struct device *dev, int ioaddr)
{
int i;
unsigned char SA_prom[32];
MODULE_PARM(device, "s");
MODULE_PARM (node, "i");
#else
-__initfunc(void arcrimi_setup (char *str, int *ints));
+void __init arcrimi_setup (char *str, int *ints);
extern struct device arcnet_devs[];
extern char arcnet_dev_names[][10];
extern int arcnet_num_devs;
* them. In fact, we can't even get their node ID automatically. So, we
* need to be passed a specific shmem address, IRQ, and node ID.
*/
-__initfunc(int arcrimi_probe(struct device *dev))
+int __init arcrimi_probe(struct device *dev)
{
BUGLVL(D_NORMAL) printk(version);
BUGMSG(D_NORMAL,"Given: node %02Xh, shmem %lXh, irq %d\n",
/* Set up the struct device associated with this card. Called after
* probing succeeds.
*/
-__initfunc(int arcrimi_found(struct device *dev,int node,int airq, u_long shmem))
+int __init arcrimi_found(struct device *dev,int node,int airq, u_long shmem)
{
struct arcnet_local *lp;
u_long first_mirror,last_mirror;
#else
-__initfunc(void arcrimi_setup (char *str, int *ints))
+void __init arcrimi_setup (char *str, int *ints)
{
struct device *dev;
#ifdef CONFIG_ARCNET_1051
/* Initialize the RFC1051-encap protocol driver */
- lp->sdev=(struct device *)kmalloc(sizeof(struct device),GFP_KERNEL);
+ lp->sdev=(struct device *)kmalloc(sizeof(struct device)+10,GFP_KERNEL);
+ if(lp->sdev = NULL)
+ {
+ if(lp->edev)
+ kfree(lp->edev);
+ lp->edev=NULL;
+ return -ENOMEM;
+ }
memcpy(lp->sdev,dev,sizeof(struct device));
- lp->sdev->name=(char *)kmalloc(10,GFP_KERNEL);
+ lp->sdev->name=(char *)(lp+1);
sprintf(lp->sdev->name,"%ss",dev->name);
lp->sdev->init=arcnetS_init;
register_netdevice(lp->sdev);
/* free the RFC1051-encap protocol device */
lp->sdev->priv=NULL;
unregister_netdevice(lp->sdev);
- kfree(lp->sdev->name);
kfree(lp->sdev);
lp->sdev=NULL;
#endif
int arcnet_num_devs=0;
char arcnet_dev_names[MAX_ARCNET_DEVS][10];
-__initfunc(void arcnet_init(void))
+void __init arcnet_init(void)
{
int c;
#ifdef MODULE
int init_module(void)
#else
-__initfunc(static int init_module(void))
+static int __init init_module(void)
#endif
{
#ifdef ALPHA_WARNING
}
-__initfunc(int ariadne_probe(struct device *dev))
+int __init ariadne_probe(struct device *dev)
{
unsigned int key;
const struct ConfigDev *cd;
const unsigned char *buf,
const int start_page);
-
-__initfunc(int ariadne2_probe(struct device *dev))
+int __init ariadne2_probe(struct device *dev)
{
unsigned int key;
const struct ConfigDev *cd;
return -ENODEV;
}
-__initfunc(static int ariadne2_init(struct device *dev, unsigned int key,
- unsigned long board))
+static int __init ariadne2_init(struct device *dev, unsigned int key,
+ unsigned long board)
{
int i;
unsigned char SA_prom[32];
-
+#include <linux/config.h>
#include "arlan.h"
#ifdef CONFIG_PROC_FS
* This module provides support for the Arlan 655 card made by Aironet
*/
-
+#include <linux/config.h>
#include "arlan.h"
static const char *arlan_version = "C.Jennigs 97 & Elmer.Joandi@ut.ee Oct'98, http://www.ylenurme.ee/~elmer/655/";
/* Check for a network adaptor of this type, and return '0' if one exists.
*/
-__initfunc(int
-bionet_probe(struct device *dev)) {
+int __init
+bionet_probe(struct device *dev){
unsigned char station_addr[6];
static unsigned version_printed = 0;
static int no_more_found = 0; /* avoid "Probing for..." printed 4 times */
/* Check for a network adaptor of this type, and return '0' if one exists.
*/
-__initfunc(extern int
-pamsnet_probe (dev))
+extern int __init
+pamsnet_probe (dev)
struct device *dev;
{
int i;
}
-__initfunc(int atarilance_probe( struct device *dev ))
-
-{ int i;
+int __init atarilance_probe( struct device *dev )
+{
+ int i;
static int found = 0;
if (!MACH_IS_ATARI || found)
/* Derived from hwreg_present() in atari/config.c: */
-__initfunc(static int addr_accessible( volatile void *regp, int wordflag, int writeflag ))
-
-{ int ret;
+static int __init addr_accessible( volatile void *regp, int wordflag, int writeflag )
+{
+ int ret;
long flags;
long *vbr, save_berr;
}
-__initfunc(static unsigned long lance_probe1( struct device *dev,
- struct lance_addr *init_rec ))
-
-{ volatile unsigned short *memaddr =
+static unsigned long __init lance_probe1( struct device *dev,
+ struct lance_addr *init_rec )
+{
+ volatile unsigned short *memaddr =
(volatile unsigned short *)init_rec->memaddr;
volatile unsigned short *ioaddr =
(volatile unsigned short *)init_rec->ioaddr;
If dev->base_addr == 2, allocate space for the device and return success
(detachable devices only).
*/
-__initfunc(int
-atp_init(struct device *dev))
+int __init
+atp_init(struct device *dev)
{
int *port, ports[] = {0x378, 0x278, 0x3bc, 0};
int base_addr = dev->base_addr;
return ENODEV;
}
-__initfunc(static int atp_probe1(struct device *dev, short ioaddr))
+static int __init atp_probe1(struct device *dev, short ioaddr)
{
int saved_ctrl_reg, status;
}
/* Read the station address PROM, usually a word-wide EEPROM. */
-__initfunc(static void get_node_ID(struct device *dev))
+static void __init get_node_ID(struct device *dev)
{
short ioaddr = dev->base_addr;
int sa_offset = 0;
* DO : _________X_______X
*/
-__initfunc(static unsigned short eeprom_op(short ioaddr, unsigned int cmd))
+static unsigned short __init eeprom_op(short ioaddr, unsigned int cmd)
{
unsigned eedata_out = 0;
int num_bits = EE_CMD_SIZE;
MODULE_PARM(backplane,"i");
MODULE_PARM(clock,"i");
#else
-__initfunc(void com20020_setup (char *str, int *ints));
+void __init com20020_setup (char *str, int *ints);
extern struct device arcnet_devs[];
extern char arcnet_dev_names[][10];
extern int arcnet_num_devs;
* it's where we were told it was, and even autoirq
*/
-__initfunc(int arc20020_probe(struct device *dev))
+int __init arc20020_probe(struct device *dev)
{
int ioaddr=dev->base_addr,status,delayval;
unsigned long airqmask;
/* Set up the struct device associated with this card. Called after
* probing succeeds.
*/
-__initfunc(int arc20020_found(struct device *dev,int ioaddr,int airq))
+int __init arc20020_found(struct device *dev,int ioaddr,int airq)
{
struct arcnet_local *lp;
#else
-__initfunc(void com20020_setup (char *str, int *ints))
+void __init com20020_setup (char *str, int *ints)
{
struct device *dev;
MODULE_PARM(irq, "i");
MODULE_PARM(device, "s");
#else
-__initfunc(void com90io_setup (char *str, int *ints));
+void __init com90io_setup (char *str, int *ints);
extern struct device arcnet_devs[];
extern char arcnet_dev_names[][10];
extern int arcnet_num_devs;
* it's where we were told it was, and even autoirq
*/
-__initfunc(int arc90io_probe(struct device *dev))
+int __init arc90io_probe(struct device *dev)
{
int ioaddr=dev->base_addr,status,delayval;
unsigned long airqmask;
/* Set up the struct device associated with this card. Called after
* probing succeeds.
*/
-__initfunc(int arc90io_found(struct device *dev,int ioaddr,int airq))
+int __init arc90io_found(struct device *dev,int ioaddr,int airq)
{
struct arcnet_local *lp;
#else
-__initfunc(void com90io_setup (char *str, int *ints))
+void __init com90io_setup (char *str, int *ints)
{
struct device *dev;
MODULE_PARM(shmem, "i");
MODULE_PARM(device, "s");
#else
-__initfunc(void com90xx_setup(char *str, int *ints));
+void __init com90xx_setup(char *str, int *ints);
char __initdata com90xx_explicit = 0;
extern struct device arcnet_devs[];
0
};
-__initfunc(int arc90xx_probe(struct device *dev))
+int __init arc90xx_probe(struct device *dev)
{
static int init_once = 0;
static int numports = sizeof(ports) / sizeof(ports[0]), numshmems = sizeof(shmems) / sizeof(shmems[0]);
*/
airqmask = probe_irq_on();
AINTMASK(NORXflag);
- udelay(1);
+ mdelay(1);
AINTMASK(0);
airq = probe_irq_off(airqmask);
/* Set up the struct device associated with this card. Called after
* probing succeeds.
*/
-__initfunc(static int arc90xx_found(struct device *dev, int ioaddr, int airq, u_long shmem, int more))
+static int __init arc90xx_found(struct device *dev, int ioaddr, int airq, u_long shmem, int more)
{
struct arcnet_local *lp;
u_long first_mirror, last_mirror;
#else
-__initfunc(void com90xx_setup(char *str, int *ints))
+void __init com90xx_setup(char *str, int *ints)
{
struct device *dev;
* If dev->base_addr in [1..0x1ff], always return failure.
* otherwise go with what we pass in.
*/
-__initfunc(int cops_probe(struct device *dev))
+int __init cops_probe(struct device *dev)
{
int i;
int base_addr = dev ? dev->base_addr : 0;
* probes on the ISA bus. A good device probes avoids doing writes, and
* verifies that the correct device exists and functions.
*/
-__initfunc(static int cops_probe1(struct device *dev, int ioaddr))
+static int __init cops_probe1(struct device *dev, int ioaddr)
{
struct cops_local *lp;
static unsigned version_printed = 0;
return 0;
}
-__initfunc(static int cops_irq (int ioaddr, int board))
+static int __init cops_irq (int ioaddr, int board)
{ /*
* This does not use the IRQ to determine where the IRQ is. We just
* assume that when we get a correct status response that it's the IRQ.
#ifdef MODULE
int init_module(void)
#else
-__initfunc(static int cosa_init(void))
+static int __init cosa_init(void)
#endif
{
int i;
struct netdev_entry netcard_drv =
{"netcard", cs89x0_probe1, NETCARD_IO_EXTENT, netcard_portlist};
#else
-__initfunc(int
-cs89x0_probe(struct device *dev))
+int __init
+cs89x0_probe(struct device *dev)
{
int i;
int base_addr = dev ? dev->base_addr : 0;
outw(value, dev->base_addr + portno);
}
-__initfunc(static int
-wait_eeprom_ready(struct device *dev))
+static int __init
+wait_eeprom_ready(struct device *dev)
{
int timeout = jiffies;
/* check to see if the EEPROM is ready, a timeout is used -
return 0;
}
-__initfunc(static int
-get_eeprom_data(struct device *dev, int off, int len, int *buffer))
+static int __init
+get_eeprom_data(struct device *dev, int off, int len, int *buffer)
{
int i;
return 0;
}
-__initfunc(static int
-get_eeprom_cksum(int off, int len, int *buffer))
+static int __init
+get_eeprom_cksum(int off, int len, int *buffer)
{
int i, cksum;
probes on the ISA bus. A good device probes avoids doing writes, and
verifies that the correct device exists and functions. */
-__initfunc(static int cs89x0_probe1(struct device *dev, int ioaddr))
+static int __init cs89x0_probe1(struct device *dev, int ioaddr)
{
struct net_local *lp;
static unsigned version_printed = 0;
return 0;
}
-
-\f
-__initfunc(void
-reset_chip(struct device *dev))
+void __init
+reset_chip(struct device *dev)
{
struct net_local *lp = (struct net_local *)dev->priv;
int ioaddr = dev->base_addr;
** Autoprobing in modules is allowed here. See the top of the file for
** more info.
*/
-__initfunc(int
-de4x5_probe(struct device *dev))
+int __init
+de4x5_probe(struct device *dev)
{
u_long iobase = dev->base_addr;
return (dev->priv ? 0 : -ENODEV);
}
-__initfunc(static int
-de4x5_hw_init(struct device *dev, u_long iobase))
+static int __init
+de4x5_hw_init(struct device *dev, u_long iobase)
{
struct bus_type *lp = &bus;
int i, status=0;
** EISA bus I/O device probe. Probe from slot 1 since slot 0 is usually
** the motherboard. Upto 15 EISA devices are supported.
*/
-__initfunc(static void
-eisa_probe(struct device *dev, u_long ioaddr))
+static void __init
+eisa_probe(struct device *dev, u_long ioaddr)
{
int i, maxSlots, status, device;
u_char irq;
*/
#define PCI_LAST_DEV 32
-__initfunc(static void
-pci_probe(struct device *dev, u_long ioaddr))
+static void __init
+pci_probe(struct device *dev, u_long ioaddr)
{
u_char pb, pbus, dev_num, dnum, timer;
u_short vendor, index, status;
** DECchips, we can find the base SROM irrespective of the BIOS scan direction.
** For single port cards this is a time waster...
*/
-__initfunc(static void
-srom_search(struct pci_dev *dev))
+static void __init
+srom_search(struct pci_dev *dev)
{
u_char pb;
u_short vendor, status;
return;
}
-__initfunc(static void
-link_modules(struct device *dev, struct device *tmp))
+static void __init
+link_modules(struct device *dev, struct device *tmp)
{
struct device *p=dev;
switch(ioc->cmd) {
case DE4X5_GET_HWADDR: /* Get the hardware address */
ioc->len = ETH_ALEN;
- if (verify_area(VERIFY_WRITE, ioc->data, ioc->len)) return -EFAULT;
for (i=0; i<ETH_ALEN; i++) {
tmp.addr[i] = dev->dev_addr[i];
}
- copy_to_user(ioc->data, tmp.addr, ioc->len);
+ if (copy_to_user(ioc->data, tmp.addr, ioc->len)) return -EFAULT;
break;
case DE4X5_SET_HWADDR: /* Set the hardware address */
if (!capable(CAP_NET_ADMIN)) return -EPERM;
- if (verify_area(VERIFY_READ, ioc->data, ETH_ALEN)) return -EFAULT;
- copy_from_user(tmp.addr, ioc->data, ETH_ALEN);
+ if (copy_from_user(tmp.addr, ioc->data, ETH_ALEN)) return -EFAULT;
for (i=0; i<ETH_ALEN; i++) {
dev->dev_addr[i] = tmp.addr[i];
}
case DE4X5_GET_STATS: /* Get the driver statistics */
ioc->len = sizeof(lp->pktStats);
- if (verify_area(VERIFY_WRITE, ioc->data, ioc->len)) return -EFAULT;
spin_lock_irqsave(&lp->lock, flags);
- copy_to_user(ioc->data, &lp->pktStats, ioc->len);
+ if (copy_to_user(ioc->data, &lp->pktStats, ioc->len)) return -EFAULT;
spin_unlock_irqrestore(&lp->lock, flags);
break;
case DE4X5_GET_OMR: /* Get the OMR Register contents */
tmp.addr[0] = inl(DE4X5_OMR);
- if (verify_area(VERIFY_WRITE, ioc->data, 1)) return -EFAULT;
- copy_to_user(ioc->data, tmp.addr, 1);
+ if (copy_to_user(ioc->data, tmp.addr, 1)) return -EFAULT;
break;
case DE4X5_SET_OMR: /* Set the OMR Register contents */
if (!capable(CAP_NET_ADMIN)) return -EPERM;
- if (verify_area(VERIFY_READ, ioc->data, 1)) return -EFAULT;
- copy_from_user(tmp.addr, ioc->data, 1);
+ if (copy_from_user(tmp.addr, ioc->data, 1)) return -EFAULT;
outl(tmp.addr[0], DE4X5_OMR);
break;
tmp.lval[6] = inl(DE4X5_STRR); j+=4;
tmp.lval[7] = inl(DE4X5_SIGR); j+=4;
ioc->len = j;
- if (verify_area(VERIFY_WRITE, ioc->data, ioc->len)) return -EFAULT;
- copy_to_user(ioc->data, tmp.addr, ioc->len);
+ if (copy_to_user(ioc->data, tmp.addr, ioc->len)) return -EFAULT;
break;
#define DE4X5_DUMP 0x0f /* Dump the DE4X5 Status */
tmp.addr[j++] = dev->tbusy;
ioc->len = j;
- if (verify_area(VERIFY_WRITE, ioc->data, ioc->len)) return -EFAULT;
- copy_to_user(ioc->data, tmp.addr, ioc->len);
+ if (copy_to_user(ioc->data, tmp.addr, ioc->len)) return -EFAULT;
break;
*/
** If at end of eth device list and can't use current entry, malloc
** one up. If memory could not be allocated, print an error message.
*/
-__initfunc(static struct device *
-insert_device(struct device *dev, u_long iobase, int (*init)(struct device *)))
+static struct device * __init
+insert_device(struct device *dev, u_long iobase, int (*init)(struct device *))
{
struct device *new;
*/
}
-__initfunc(int
-de600_probe(struct device *dev))
+int __init
+de600_probe(struct device *dev)
{
int i;
static struct net_device_stats de600_netstats;
*
* Check if there is a DE-620 connected
*/
-__initfunc(int
-de620_probe(struct device *dev))
+int __init
+de620_probe(struct device *dev)
{
static struct net_device_stats de620_netstats;
int i;
*/
#define sendit(dev,data) de620_set_register(dev, W_EIP, data | EIPRegister);
-__initfunc(static unsigned short
-ReadAWord(struct device *dev, int from))
+static unsigned short __init
+ReadAWord(struct device *dev, int from)
{
unsigned short data;
int nbits;
return data;
}
-__initfunc(static int
-read_eeprom(struct device *dev))
+static int __init
+read_eeprom(struct device *dev)
{
unsigned short wrd;
* the device structure.
*/
-__initfunc(int dfx_probe(
- struct device *dev
- ))
-
- {
+int __init dfx_probe(struct device *dev)
+{
int i; /* used in for loops */
int version_disp; /* was version info string already displayed? */
int port_len; /* length of port address range (in bytes) */
* None
*/
-__initfunc(struct device *dfx_alloc_device(
- struct device *dev,
- u16 iobase
- ))
-
- {
+struct device __init *dfx_alloc_device( struct device *dev, u16 iobase)
+{
struct device *tmp_dev; /* pointer to a device structure */
DBG_printk("In dfx_alloc_device...\n");
* enabled yet.
*/
-__initfunc(void dfx_bus_init(
- struct device *dev
- ))
-
- {
+void __init dfx_bus_init(struct device *dev)
+{
DFX_board_t *bp = (DFX_board_t *)dev->priv;
u8 val; /* used for I/O read/writes */
* None
*/
-__initfunc(void dfx_bus_config_check(
- DFX_board_t *bp
- ))
-
- {
+void __init dfx_bus_config_check(DFX_board_t *bp)
+{
int status; /* return code from adapter port control call */
u32 slot_id; /* EISA-bus hardware id (DEC3001, DEC3002,...) */
u32 host_data; /* LW data returned from port control call */
* returning from this routine.
*/
-__initfunc(int dfx_driver_init(
- struct device *dev
- ))
-
- {
+int __init dfx_driver_init(struct device *dev)
+{
DFX_board_t *bp = (DFX_board_t *)dev->priv;
int alloc_size; /* total buffer size needed */
char *top_v, *curr_v; /* virtual addrs into memory block */
outw(CSR0, DEPCA_ADDR);\
outw(STOP, DEPCA_DATA)
-\f
-
-__initfunc(int
-depca_probe(struct device *dev))
+int __init
+depca_probe(struct device *dev)
{
int tmp = num_depcas, status = -ENODEV;
u_long iobase = dev->base_addr;
return status;
}
-__initfunc(static int
-depca_hw_init(struct device *dev, u_long ioaddr, int mca_slot))
+static int __init
+depca_hw_init(struct device *dev, u_long ioaddr, int mca_slot)
{
struct depca_private *lp;
int i, j, offset, netRAM, mem_len, status=0;
/*
** Microchannel bus I/O device probe
*/
-__initfunc(static void
-mca_probe(struct device *dev, u_long ioaddr))
+static void __init
+mca_probe(struct device *dev, u_long ioaddr)
{
unsigned char pos[2];
unsigned char where;
/*
** ISA bus I/O device probe
*/
-__initfunc(static void
-isa_probe(struct device *dev, u_long ioaddr))
+static void __init
+isa_probe(struct device *dev, u_long ioaddr)
{
int i = num_depcas, maxSlots;
s32 ports[] = DEPCA_IO_PORTS;
** EISA bus I/O device probe. Probe from slot 1 since slot 0 is usually
** the motherboard. Upto 15 EISA devices are supported.
*/
-__initfunc(static void
-eisa_probe(struct device *dev, u_long ioaddr))
+static void __init
+eisa_probe(struct device *dev, u_long ioaddr)
{
int i, maxSlots;
u_long iobase;
** are not available then insert a new device structure at the end of
** the current list.
*/
-__initfunc(static struct device *
-alloc_device(struct device *dev, u_long iobase))
+static struct device * __init
+alloc_device(struct device *dev, u_long iobase)
{
struct device *adev = NULL;
int fixed = 0, new_dev = 0;
** If at end of eth device list and can't use current entry, malloc
** one up. If memory could not be allocated, print an error message.
*/
-__initfunc(static struct device *
-insert_device(struct device *dev, u_long iobase, int (*init)(struct device *)))
+static struct device * __init
+insert_device(struct device *dev, u_long iobase, int (*init)(struct device *))
{
struct device *new;
return dev;
}
-__initfunc(static int
-depca_dev_index(char *s))
+static int __init
+depca_dev_index(char *s)
{
int i=0, j=0;
** and Boot (readb) ROM. This will also give us a clue to the network RAM
** base address.
*/
-__initfunc(static void
-DepcaSignature(char *name, u_long paddr))
+static void __init
+DepcaSignature(char *name, u_long paddr)
{
u_int i,j,k;
const char *signatures[] = DEPCA_SIGNATURE;
** PROM address counter is correctly positioned at the start of the
** ethernet address for later read out.
*/
-__initfunc(static int
-DevicePresent(u_long ioaddr))
+static int __init
+DevicePresent(u_long ioaddr)
{
union {
struct {
** reason: access the upper half of the PROM with x=0; access the lower half
** with x=1.
*/
-__initfunc(static int
-get_hw_addr(struct device *dev))
+static int __init
+get_hw_addr(struct device *dev)
{
u_long ioaddr = dev->base_addr;
int i, k, tmp, status = 0;
/*
** Look for a particular board name in the EISA configuration space
*/
-__initfunc(static int
-EISA_signature(char *name, s32 eisa_id))
+static int __init
+EISA_signature(char *name, s32 eisa_id)
{
u_int i;
const char *signatures[] = DEPCA_SIGNATURE;
/*
* Download the board firmware
*/
-__initfunc(static int
-dgrs_download(struct device *dev0))
+static int __init
+dgrs_download(struct device *dev0)
{
DGRS_PRIV *priv0 = (DGRS_PRIV *) dev0->priv;
int is;
/*
* Probe (init) a board
*/
-__initfunc(int
-dgrs_probe1(struct device *dev))
+int __init
+dgrs_probe1(struct device *dev)
{
DGRS_PRIV *priv = (DGRS_PRIV *) dev->priv;
int i;
return (0);
}
-__initfunc(int
-dgrs_initclone(struct device *dev))
+int __init
+dgrs_initclone(struct device *dev)
{
DGRS_PRIV *priv = (DGRS_PRIV *) dev->priv;
int i;
return (0);
}
-__initfunc(static int
+static int __init
dgrs_found_device(
struct device *dev,
int io,
int irq,
ulong plxreg,
ulong plxdma
-))
+)
{
DGRS_PRIV *priv;
*/
static int is2iv[8] __initdata = { 0, 3, 5, 7, 10, 11, 12, 15 };
-__initfunc(static int
-dgrs_scan(struct device *dev))
+static int __init
+dgrs_scan(struct device *dev)
{
int cards_found = 0;
uint io;
#else
-__initfunc(int
-dgrs_probe(struct device *dev))
+int __init
+dgrs_probe(struct device *dev)
{
int cards_found;
return(0);
}
-__initfunc(int dlci_setup(void))
+int __init dlci_setup(void)
{
int i;
}
#endif
-__initfunc(int dummy_init(struct device *dev))
+int __init dummy_init(struct device *dev)
{
/* Initialize the device structure. */
dev->hard_start_xmit = dummy_xmit;
#ifdef MODULE
-__initfunc(static int dummy_probe(struct device *dev))
+static int __init dummy_probe(struct device *dev)
{
dummy_init(dev);
return 0;
station address).
*/
-__initfunc(int e2100_probe(struct device *dev))
+int __init e2100_probe(struct device *dev)
{
int *port;
int base_addr = dev->base_addr;
return ENODEV;
}
-__initfunc(int e21_probe1(struct device *dev, int ioaddr))
+int __init e21_probe1(struct device *dev, int ioaddr)
{
int i, status;
unsigned char *station_addr = dev->dev_addr;
* checks for presence of EtherExpress card
*/
-__initfunc(int express_probe(struct device *dev))
+int __init express_probe(struct device *dev)
{
unsigned short *port;
static unsigned short ports[] = { 0x300,0x310,0x270,0x320,0x340,0 };
* than one card in a machine.
*/
-__initfunc(static int eexp_hw_probe(struct device *dev, unsigned short ioaddr))
+static int __init eexp_hw_probe(struct device *dev, unsigned short ioaddr)
{
unsigned short hw_addr[3];
unsigned char buswidth;
* Read a word from the EtherExpress on-board serial EEPROM.
* The EEPROM contains 64 words of 16 bits.
*/
-__initfunc(static unsigned short eexp_hw_readeeprom(unsigned short ioaddr,
- unsigned char location))
+static unsigned short __init eexp_hw_readeeprom(unsigned short ioaddr,
+ unsigned char location)
{
unsigned short cmd = 0x180|(location&0x7f);
unsigned short rval = 0,wval = EC_CS|i586_RST;
* PROM for a match against the Racal-Interlan assigned value.
*/
-__initfunc(int es_probe(struct device *dev))
+int __init es_probe(struct device *dev)
{
unsigned short ioaddr = dev->base_addr;
return ENODEV;
}
-__initfunc(int es_probe1(struct device *dev, int ioaddr))
+int __init es_probe1(struct device *dev, int ioaddr)
{
int i;
unsigned long eisa_id;
* hardware it would have to check what was present.
*/
-__initfunc(int ethertap_probe(struct device *dev))
+int __init ethertap_probe(struct device *dev)
{
memcpy(dev->dev_addr, "\xFE\xFD\x00\x00\x00\x00", 6);
if (dev->mem_start & 0xf)
struct netdev_entry fmv18x_drv =
{"fmv18x", fmv18x_probe1, FMV18X_IO_EXTENT, fmv18x_probe_list};
#else
-__initfunc(int
-fmv18x_probe(struct device *dev))
+int __init
+fmv18x_probe(struct device *dev)
{
int i;
int base_addr = dev ? dev->base_addr : 0;
that can be done is checking a few bits and then diving right into MAC
address check. */
-__initfunc(int fmv18x_probe1(struct device *dev, short ioaddr))
+int __init fmv18x_probe1(struct device *dev, short ioaddr)
{
char irqmap[4] = {3, 7, 10, 15};
char irqmap_pnp[8] = {3, 4, 5, 7, 9, 10, 11, 15};
#ifdef MODULE
static int sixpack_init_ctrl_dev(void)
#else /* !MODULE */
-__initfunc(int sixpack_init_ctrl_dev(struct device *dummy))
+int __init sixpack_init_ctrl_dev(struct device *dummy)
#endif /* !MODULE */
{
int status;
/* --------------------------------------------------------------------- */
-__initfunc(int baycom_par_init(void))
+int __init baycom_par_init(void)
{
int i, j, found = 0;
char set_hw = 1;
#endif
-__initfunc(int init_module(void))
+int __init init_module(void)
{
int i;
* mode: par96,picpar
*/
-__initfunc(void baycom_par_setup(char *str, int *ints))
+void __init baycom_par_setup(char *str, int *ints)
{
int i;
/* --------------------------------------------------------------------- */
-__initfunc(int baycom_ser_fdx_init(void))
+int __init baycom_ser_fdx_init(void)
{
int i, j, found = 0;
char set_hw = 1;
#endif
-__initfunc(int init_module(void))
+int __init init_module(void)
{
int i;
* * indicates sofware DCD
*/
-__initfunc(void baycom_ser_fdx_setup(char *str, int *ints))
+void __init baycom_ser_fdx_setup(char *str, int *ints)
{
int i;
/* --------------------------------------------------------------------- */
-__initfunc(int baycom_ser_hdx_init(void))
+int __init baycom_ser_hdx_init(void)
{
int i, j, found = 0;
char set_hw = 1;
#endif
-__initfunc(int init_module(void))
+int __init init_module(void)
{
int i;
* * indicates sofware DCD
*/
-__initfunc(void baycom_ser_hdx_setup(char *str, int *ints))
+void __init baycom_ser_hdx_setup(char *str, int *ints)
{
int i;
* Initialize driver. To be called from af_ax25 if not compiled as a
* module
*/
-__initfunc(int bpq_init(void))
+int __init bpq_init(void)
{
struct device *dev;
#else
-__initfunc(void dmascc_setup(char *str, int *ints))
+void __init dmascc_setup(char *str, int *ints)
{
int i;
/* Initialization functions */
-__initfunc(int dmascc_init(void))
+int __init dmascc_init(void)
{
int h, i, j, n;
int base[MAX_NUM_DEVS], tcmd[MAX_NUM_DEVS], t0[MAX_NUM_DEVS],
return -EIO;
}
-
-__initfunc(int setup_adapter(int io, int h, int n))
+int __init setup_adapter(int io, int h, int n)
{
int i, irq, chip;
struct scc_info *info;
/* --------------------------------------------------------------------- */
-__initfunc(int init_module(void))
+int __init init_module(void)
{
printk(KERN_INFO "hdlcdrv: (C) 1996 Thomas Sailer HB9JNX/AE4WA\n");
printk(KERN_INFO "hdlcdrv: version 0.6 compiled " __TIME__ " " __DATE__ "\n");
}
/* Initialize AX25 control device -- register AX25 line discipline */
-__initfunc(int mkiss_init_ctrl_dev(void))
+int __init mkiss_init_ctrl_dev(void)
{
int status;
/* * Init MKISS driver * */
/* ******************************************************************** */
-__initfunc(static int mkiss_init(void))
+static int __init mkiss_init(void)
{
memset(&mkiss_driver, 0, sizeof(struct tty_driver));
/* Probe for a PI card. */
/* This routine also initializes the timer chip */
-__initfunc(static int hw_probe(int ioaddr))
+static int __init hw_probe(int ioaddr)
{
int time = 1000; /* Number of milliseconds for test */
unsigned long start_time, end_time;
}
-__initfunc(int pi_init(void))
+int __init pi_init(void)
{
int *port;
int ioaddr = 0;
} /* chipset_init() */
-
-__initfunc(int pt_init(void))
+int __init pt_init(void)
{
int *port;
int ioaddr = 0;
/*
* Probe for PT card. Also initialises the timers
*/
-__initfunc(static int hw_probe(int ioaddr))
+static int __init hw_probe(int ioaddr)
{
int time = 1000; /* Number of milliseconds to test */
int a = 1;
/* * Init SCC driver * */
/* ******************************************************************** */
-__initfunc(int scc_init (void))
+int __init scc_init (void)
{
int chip, chan, k, result;
char devname[10];
/* --------------------------------------------------------------------- */
#ifdef MODULE
-__initfunc(static int sm_init(void))
+static int __init sm_init(void)
#else /* MODULE */
-__initfunc(int sm_init(void))
+int __init sm_init(void)
#endif /* MODULE */
{
int i, j, found = 0;
#endif
-__initfunc(int init_module(void))
+int __init init_module(void)
{
if (mode) {
if (iobase == -1)
* modem: afsk1200, fsk9600
*/
-__initfunc(void sm_setup(char *str, int *ints))
+void __init sm_setup(char *str, int *ints)
{
int i;
{"hpplus", hpp_probe1, HP_IO_EXTENT, hpplus_portlist};
#else
-__initfunc(int hp_plus_probe(struct device *dev))
+int __init hp_plus_probe(struct device *dev)
{
int i;
int base_addr = dev ? dev->base_addr : 0;
#endif
/* Do the interesting part of the probe at a single address. */
-__initfunc(int hpp_probe1(struct device *dev, int ioaddr))
+int __init hpp_probe1(struct device *dev, int ioaddr)
{
int i;
unsigned char checksum = 0;
{"hp", hp_probe1, HP_IO_EXTENT, hppclan_portlist};
#else
-__initfunc(int hp_probe(struct device *dev))
+int __init hp_probe(struct device *dev)
{
int i;
int base_addr = dev ? dev->base_addr : 0;
}
#endif
-__initfunc(int hp_probe1(struct device *dev, int ioaddr))
+int __init hp_probe1(struct device *dev, int ioaddr)
{
int i, board_id, wordmode;
const char *name;
#include <linux/types.h>
#include <linux/config.h> /* for CONFIG_PCI */
#include <linux/delay.h>
+#include <linux/init.h>
#if LINUX_VERSION_CODE >= 0x020100
#define LINUX_2_1
* since this could cause problems when the card is not installed.
*/
-__initfunc(int hp100_probe( struct device *dev ))
+int __init hp100_probe( struct device *dev )
{
int base_addr = dev ? dev -> base_addr : 0;
int ioaddr = 0;
\f
#ifdef LINUX_2_1
-__initfunc(static int hp100_probe1( struct device *dev, int ioaddr, u_char bus, struct pci_dev *pci_dev ))
+static int __init hp100_probe1( struct device *dev, int ioaddr, u_char bus, struct pci_dev *pci_dev )
#else
-__initfunc(static int hp100_probe1( struct device *dev, int ioaddr, u_char bus, u_char pci_bus, u_char pci_device_fn ))
+static int __init hp100_probe1( struct device *dev, int ioaddr, u_char bus, u_char pci_bus, u_char pci_device_fn )
#endif
{
int i;
#endif
/* Find all the HP Lance boards and initialise them... */
-__initfunc(int hplance_probe(struct device *dev))
+int __init hplance_probe(struct device *dev)
{
int cards = 0, called = 0;
}
/* Initialise a single lance board at the given select code */
-__initfunc (static int hplance_init(struct device *dev, int scode))
+static int __init hplance_init(struct device *dev, int scode)
{
/* const char *name = dio_scodetoname(scode); */
static const char name[] = "HP LANCE";
#endif
-__initfunc(int hydra_probe(struct device *dev))
+int __init hydra_probe(struct device *dev)
{
struct hydra_private *priv;
u32 board;
"ISA", "MCA", "ISA P&P"
};
-__initfunc(char *adapter_def(char type))
+char __init *adapter_def(char type)
{
switch (type)
{
static __u32 ibmtr_mem_base = 0xd0000;
-__initfunc(static void PrtChanID(char *pcid, short stride) )
+static void __init PrtChanID(char *pcid, short stride)
{
short i, j;
for (i=0, j=0; i<24; i++, j+=stride)
printk("\n");
}
-__initfunc(static void HWPrtChanID (__u32 pcid, short stride))
+static void __init HWPrtChanID (__u32 pcid, short stride)
{
short i, j;
for (i=0, j=0; i<24; i++, j+=stride)
* which references it.
*/
-__initfunc(int ibmtr_probe(struct device *dev))
+int __init ibmtr_probe(struct device *dev)
{
int i;
int base_addr = dev ? dev->base_addr : 0;
return -ENODEV;
}
-__initfunc(static int ibmtr_probe1(struct device *dev, int PIOaddr))
+static int __init ibmtr_probe1(struct device *dev, int PIOaddr)
{
unsigned char segment=0, intr=0, irq=0, i=0, j=0, cardpresent=NOTOK,temp=0;
__u32 t_mmio=0;
/* query the adapter for the size of shared RAM */
-__initfunc(static unsigned char get_sram_size(struct tok_info *adapt_info))
+static unsigned char __init get_sram_size(struct tok_info *adapt_info)
{
unsigned char avail_sram_code;
return 1<<((readb(adapt_info->mmio+ ACA_OFFSET + ACA_RW + RRR_ODD)>>2)+4);
}
-__initfunc(static int trdev_init(struct device *dev))
+static int __init trdev_init(struct device *dev)
{
struct tok_info *ti=(struct tok_info *)dev->priv;
actisys_init_qos,
};
-__initfunc(int actisys_init(void))
+int __init actisys_init(void)
{
int ret;
esi_qos_init,
};
-__initfunc(int esi_init(void))
+int __init esi_init(void)
{
return irda_device_register_dongle(&dongle);
}
girbil_init_qos,
};
-__initfunc(int girbil_init(void))
+int __init girbil_init(void)
{
return irda_device_register_dongle(&dongle);
}
static void irport_set_dtr_rts(struct irda_device *idev, int dtr, int rts);
static int irport_raw_write(struct irda_device *idev, __u8 *buf, int len);
-__initfunc(int irport_init(void))
+int __init irport_init(void)
{
int i;
char *, int);
char *driver_name = "irtty";
-__initfunc(int irtty_init(void))
+int __init irtty_init(void)
{
int status;
litelink_init_qos,
};
-__initfunc(int litelink_init(void))
+int __init litelink_init(void)
{
return irda_device_register_dongle(&dongle);
}
* Initialize chip. Just try to find out how many chips we are dealing with
* and where they are
*/
-__initfunc(int pc87108_init(void))
+int __init pc87108_init(void)
{
int i;
* Initialize chip. Just try to find out how many chips we are dealing with
* and where they are
*/
-__initfunc(int ircc_init(void))
+int __init ircc_init(void)
{
int i;
tekram_init_qos,
};
-__initfunc(int tekram_init(void))
+int __init tekram_init(void)
{
return irda_device_register_dongle(&dongle);
}
* Initialize chip. Just try to find out how many chips we are dealing with
* and where they are
*/
-__initfunc(int uircc_init(void))
+int __init uircc_init(void)
{
int i;
* Initialize chip. Just try to find out how many chips we are dealing with
* and where they are
*/
-__initfunc(int w83977af_init(void))
+int __init w83977af_init(void)
{
int i;
return -ENODEV;
}
-__initfunc(int lance_probe1(struct device *dev, int ioaddr, int irq, int options))
+int __init lance_probe1(struct device *dev, int ioaddr, int irq, int options)
{
struct lance_private *lp;
short dma_channels; /* Mark spuriously-busy DMA channels */
lp = (struct lance_private *)(((unsigned long)kmalloc(sizeof(*lp)+7,
GFP_DMA | GFP_KERNEL)+7) & ~7);
+ if(lp==NULL)
+ return -ENODEV;
if (lance_debug > 6) printk(" (#0x%05lx)", (unsigned long)lp);
memset(lp, 0, sizeof(*lp));
dev->priv = lp;
* PROM for a match against the value assigned to Mylex.
*/
-__initfunc(int lne390_probe(struct device *dev))
+int __init lne390_probe(struct device *dev)
{
unsigned short ioaddr = dev->base_addr;
return ENODEV;
}
-__initfunc(int lne390_probe1(struct device *dev, int ioaddr))
+int __init lne390_probe1(struct device *dev, int ioaddr)
{
int i, revision;
unsigned long eisa_id;
}
/* Initialize the rest of the LOOPBACK device. */
-__initfunc(int loopback_init(struct device *dev))
+int __init loopback_init(struct device *dev)
{
dev->mtu = LOOPBACK_MTU;
dev->tbusy = 0;
/* initialization stuff */
-__initfunc(int ltpc_probe_dma(int base))
+int __init ltpc_probe_dma(int base)
{
int dma = 0;
int timeout;
return dma;
}
-__initfunc(int ltpc_probe(struct device *dev))
+int __init ltpc_probe(struct device *dev)
{
int err;
int x=0,y=0;
}
/* handles "ltpc=io,irq,dma" kernel command lines */
-__initfunc(void ltpc_setup(char *str, int *ints))
+void __init ltpc_setup(char *str, int *ints)
{
if (ints[0] == 0) {
if (str && !strncmp(str, "auto", 4)) {
return 0;
}
-__initfunc(int myri_sbus_probe(struct device *dev))
+int __init myri_sbus_probe(struct device *dev)
{
struct linux_sbus *bus;
struct linux_sbus_device *sdev = 0;
* the card.
*/
-__initfunc(int ne_probe(struct device *dev))
+int __init ne_probe(struct device *dev)
{
int base_addr = dev ? dev->base_addr : 0;
#endif
#ifdef CONFIG_PCI
-__initfunc(static int ne_probe_pci(struct device *dev))
+static int __init ne_probe_pci(struct device *dev)
{
int i;
}
#endif /* CONFIG_PCI */
-__initfunc(static int ne_probe1(struct device *dev, int ioaddr))
+static int __init ne_probe1(struct device *dev, int ioaddr)
{
int i;
unsigned char SA_prom[32];
* Note that at boot, this probe only picks up one card at a time.
*/
-__initfunc (int ne2_probe(struct device *dev))
+int __init ne2_probe(struct device *dev)
{
static int current_mca_slot = -1;
int i;
return len;
}
-
-__initfunc (static int ne2_probe1(struct device *dev, int slot))
+static int __init ne2_probe1(struct device *dev, int slot)
{
int i, base_addr, irq;
unsigned char POS;
* PROM for a match against the value assigned to Novell.
*/
-__initfunc(int ne3210_probe(struct device *dev))
+int __init ne3210_probe(struct device *dev)
{
unsigned short ioaddr = dev->base_addr;
return ENODEV;
}
-__initfunc(int ne3210_probe1(struct device *dev, int ioaddr))
+int __init ne3210_probe1(struct device *dev, int ioaddr)
{
int i;
unsigned long eisa_id;
#define OLYMPIC_NETWORK_MONITOR 0
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/timer.h>
#include <linux/in.h>
#include <linux/ioport.h>
-#include <linux/errno.h>
#include <linux/string.h>
#include <linux/proc_fs.h>
#include <linux/ptrace.h>
/*
* Translate PSA irq parameter to irq number
*/
-__initfunc(static int
-wv_psa_to_irq(u_char irqval))
+static int __init
+wv_psa_to_irq(u_char irqval)
{
int irq;
{
struct iw_range range;
- /* Verify the user buffer. */
- ret = verify_area(VERIFY_WRITE, wrq->u.data.pointer,
- sizeof(struct iw_range));
- if(ret)
- break;
-
/* Set the length (useless: it's constant). */
wrq->u.data.length = sizeof(struct iw_range);
range.max_qual.noise = MMR_SILENCE_LVL;
/* Copy structure to the user buffer. */
- copy_to_user(wrq->u.data.pointer, &range,
- sizeof(struct iw_range));
+ if (copy_to_user(wrq->u.data.pointer, &range, sizeof(struct iw_range)))
+ ret = -EFAULT;
}
break;
{ SIOCGIPHISTO, 0, IW_PRIV_TYPE_INT | 16, "gethisto" },
};
- /* Verify the user buffer. */
- ret = verify_area(VERIFY_WRITE, wrq->u.data.pointer,
- sizeof(priv));
- if(ret)
- break;
-
/* Set the number of available ioctls. */
wrq->u.data.length = 4;
/* Copy structure to the user buffer. */
- copy_to_user(wrq->u.data.pointer, (u_char *) priv,
- sizeof(priv));
+ if (copy_to_user(wrq->u.data.pointer, (u_char *) priv, sizeof(priv)))
+ ret = -EFAULT;
}
break;
struct sockaddr address[IW_MAX_SPY];
int i;
- /* Verify where the user has set his addresses. */
- ret = verify_area(VERIFY_READ, wrq->u.data.pointer,
- sizeof(struct sockaddr) * lp->spy_number);
- if(ret)
- break;
/* Copy addresses to the driver. */
- copy_from_user(address, wrq->u.data.pointer,
- sizeof(struct sockaddr) * lp->spy_number);
+ if (copy_from_user(address, wrq->u.data.pointer, sizeof(struct sockaddr) * lp->spy_number)) {
+ ret = -EFAULT;
+ break;
+ }
/* Copy addresses to the lp structure. */
for(i = 0; i < lp->spy_number; i++)
struct sockaddr address[IW_MAX_SPY];
int i;
- /* Verify the user buffer. */
- ret = verify_area(VERIFY_WRITE, wrq->u.data.pointer,
- (sizeof(iw_qual) + sizeof(struct sockaddr))
- * IW_MAX_SPY);
- if(ret)
- break;
-
/* Copy addresses from the lp structure. */
for(i = 0; i < lp->spy_number; i++)
{
}
/* Copy addresses to the user buffer. */
- copy_to_user(wrq->u.data.pointer, address,
- sizeof(struct sockaddr) * lp->spy_number);
-
+ if (copy_to_user(wrq->u.data.pointer, address, sizeof(struct sockaddr) * lp->spy_number)) {
+ ret = -EFAULT;
+ break;
+ }
+
/* Copy stats to the user buffer (just after). */
- copy_to_user(wrq->u.data.pointer +
+ if (copy_to_user(wrq->u.data.pointer +
(sizeof(struct sockaddr) * lp->spy_number),
- lp->spy_stat, sizeof(iw_qual) * lp->spy_number);
+ lp->spy_stat, sizeof(iw_qual) * lp->spy_number)) {
+ ret = -EFAULT;
+ break;
+ }
/* Reset updated flags. */
for(i = 0; i < lp->spy_number; i++)
/* Are there addresses to copy? */
if(lp->his_number > 0)
{
- /* Verify where the user has set his addresses. */
- ret = verify_area(VERIFY_READ, wrq->u.data.pointer,
- sizeof(char) * lp->his_number);
- if(ret)
- break;
/* Copy interval ranges to the driver */
- copy_from_user(lp->his_range, wrq->u.data.pointer,
- sizeof(char) * lp->his_number);
+ if (copy_from_user(lp->his_range, wrq->u.data.pointer, sizeof(char) * lp->his_number)) {
+ ret = -EFAULT;
+ break;
+ }
/* Reset structure. */
memset(lp->his_sum, 0x00, sizeof(long) * 16);
/* Give back the distribution statistics */
if((lp->his_number > 0) && (wrq->u.data.pointer != (caddr_t) 0))
{
- /* Verify the user buffer. */
- ret = verify_area(VERIFY_WRITE, wrq->u.data.pointer,
- sizeof(long) * 16);
- if(ret)
- break;
-
/* Copy data to the user buffer. */
- copy_to_user(wrq->u.data.pointer, lp->his_sum,
- sizeof(long) * lp->his_number);
+ if (copy_to_user(wrq->u.data.pointer, lp->his_sum, sizeof(long) * lp->his_number))
+ ret = -EFAULT;
+
} /* if(pointer != NULL) */
break;
#endif /* HISTOGRAM */
* device structure
* (called by wavelan_probe() and via init_module()).
*/
-__initfunc(static int
-wavelan_config(device * dev))
+static int __init
+wavelan_config(device * dev)
{
u_long ioaddr = dev->base_addr;
u_char irq_mask;
* We follow the example in drivers/net/ne.c.
* (called in "Space.c")
*/
-__initfunc(int
-wavelan_probe(device * dev))
+int __init
+wavelan_probe(device * dev)
{
short base_addr;
mac_addr mac; /* MAC address (check existence of WaveLAN) */
/* Create device and set basic arguments. */
dev = kmalloc(sizeof(struct device), GFP_KERNEL);
+ if(dev==NULL)
+ {
+ ret = -ENOMEM;
+ break;
+ }
memset(dev, 0x00, sizeof(struct device));
dev->name = name[i];
dev->base_addr = io[i];
DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_128V, "MagicGraph 128V"),
DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_128ZV, "MagicGraph 128ZV"),
DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_NM2160, "MagicGraph NM2160"),
+ DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_128ZVPLUS, "MagicGraph 128ZV+"),
DEVICE( ASP, ASP_ABP940, "ABP940"),
DEVICE( ASP, ASP_ABP940U, "ABP940U"),
DEVICE( ASP, ASP_ABP940UW, "ABP940UW"),
DEVICE( SATSAGEM, SATSAGEM_PCR2101,"PCR2101 DVB receiver"),
DEVICE( SATSAGEM, SATSAGEM_TELSATTURBO,"Telsat Turbo DVB"),
DEVICE( HUGHES, HUGHES_DIRECPC, "DirecPC"),
+ DEVICE( ENSONIQ, ENSONIQ_ES1371, "ES1371"),
DEVICE( ENSONIQ, ENSONIQ_AUDIOPCI,"AudioPCI"),
DEVICE( ALTEON, ALTEON_ACENIC, "AceNIC"),
DEVICE( PICTUREL, PICTUREL_PCIVST,"PCIVST"),
DEVICE( S3, S3_ViRGE_MXPMV, "ViRGE/MX+MV"),
DEVICE( S3, S3_SONICVIBES, "SonicVibes"),
DEVICE( DCI, DCI_PCCOM4, "PC COM PCI Bus 4 port serial Adapter"),
+ DEVICE( GENROCO, GENROCO_HFP832, "TURBOstor HFP832"),
DEVICE( INTEL, INTEL_82375, "82375EB"),
DEVICE( INTEL, INTEL_82424, "82424ZX Saturn"),
DEVICE( INTEL, INTEL_82378, "82378IB"),
DEVICE( KTI, KTI_ET32P2, "ET32P2"),
DEVICE( ADAPTEC, ADAPTEC_7810, "AIC-7810 RAID"),
DEVICE( ADAPTEC, ADAPTEC_7821, "AIC-7860"),
+ DEVICE( ADAPTEC, ADAPTEC_38602, "AIC-7860"),
DEVICE( ADAPTEC, ADAPTEC_7850, "AIC-7850"),
DEVICE( ADAPTEC, ADAPTEC_7855, "AIC-7855"),
DEVICE( ADAPTEC, ADAPTEC_5800, "AIC-5800"),
case PCI_VENDOR_ID_NETVIN: return "NetVin";
case PCI_VENDOR_ID_S3: return "S3 Inc.";
case PCI_VENDOR_ID_DCI: return "Decision Computer Int.";
+ case PCI_VENDOR_ID_GENROCO: return "Genroco";
case PCI_VENDOR_ID_INTEL: return "Intel";
case PCI_VENDOR_ID_KTI: return "KTI";
case PCI_VENDOR_ID_ADAPTEC: return "Adaptec";
0, &proc_array_inode_operations
};
-__initfunc(void proc_old_pci_init(void))
+void __init proc_old_pci_init(void)
{
proc_register(&proc_root, &proc_old_pci);
}
**************************************************************************
-
+
DESCRIPTION:
This is the Linux low-level SCSI driver for Adaptec AHA-1520/1522 SCSI
CONFIGURATION ARGUMENTS:
- IOPORT base io address (0x340/0x140)
- IRQ interrupt level (9-12; default 11)
- SCSI_ID scsi id of controller (0-7; default 7)
- RECONNECT allow targets to disconnect from the bus (0/1; default 1 [on])
- PARITY enable parity checking (0/1; default 1 [on])
- SYNCHRONOUS enable synchronous transfers (0/1; default 0 [off])
- (NOT WORKING YET)
- DELAY: bus reset delay (default 100)
- EXT_TRANS: enable extended translation (0/1: default 0 [off])
- (see NOTES below)
+ IOPORT base io address (0x340/0x140)
+ IRQ interrupt level (9-12; default 11)
+ SCSI_ID scsi id of controller (0-7; default 7)
+ RECONNECT allow targets to disconnect from the bus (0/1; default 1 [on])
+ PARITY enable parity checking (0/1; default 1 [on])
+ SYNCHRONOUS enable synchronous transfers (0/1; default 0 [off])
+ (NOT WORKING YET)
+ DELAY: bus reset delay (default 100)
+ EXT_TRANS: enable extended translation (0/1: default 0 [off])
+ (see NOTES below)
COMPILE TIME CONFIGURATION (put into AHA152X in drivers/scsi/Makefile):
-DAUTOCONF
- use configuration the controller reports (AHA-152x only)
+ use configuration the controller reports (AHA-152x only)
-DSKIP_BIOSTEST
- Don't test for BIOS signature (AHA-1510 or disabled BIOS)
+ Don't test for BIOS signature (AHA-1510 or disabled BIOS)
-DSETUP0="{ IOPORT, IRQ, SCSI_ID, RECONNECT, PARITY, SYNCHRONOUS, DELAY, EXT_TRANS }"
- override for the first controller
-
+ override for the first controller
+
-DSETUP1="{ IOPORT, IRQ, SCSI_ID, RECONNECT, PARITY, SYNCHRONOUS, DELAY, EXT_TRANS }"
- override for the second controller
+ override for the second controller
LILO COMMAND LINE OPTIONS:
SYMBOLS FOR MODULE CONFIGURATION:
-
- aha152x=IOPORT,IRQ,SCSI_ID,RECONNECT,PARITY,SYNCHRONOUS,DELAY,EXT_TRANS
- configuration override of first controller
-
- aha152x1=IOPORT,IRQ,SCSI_ID,RECONNECT,PARITY,SYNCHRONOUS,DELAY,EXT_TRANS
- configuration override of second controller
+ aha152x=IOPORT,IRQ,SCSI_ID,RECONNECT,PARITY,SYNCHRONOUS,DELAY,EXT_TRANS
+ configuration override of first controller
+
+
+ aha152x1=IOPORT,IRQ,SCSI_ID,RECONNECT,PARITY,SYNCHRONOUS,DELAY,EXT_TRANS
+ configuration override of second controller
NOTES ON EXT_TRANS:
- for disks<1GB: use default translation (C/32/64)
- for disks>1GB:
- - take current geometry from the partition table
- (using scsicam_bios_param and accept only `valid' geometries,
- ie. either (C/32/64) or (C/63/255)). This can be extended
- translation even if it's not enabled in the driver.
- - if that fails, take extended translation if enabled by override,
- kernel or module parameter, otherwise take default translation and
- ask the user for verification. This might on not yet partitioned
- disks or
+ - take current geometry from the partition table
+ (using scsicam_bios_param and accept only `valid' geometries,
+ ie. either (C/32/64) or (C/63/255)). This can be extended
+ translation even if it's not enabled in the driver.
+ - if that fails, take extended translation if enabled by override,
+ kernel or module parameter, otherwise take default translation and
+ ask the user for verification. This might on not yet partitioned
+ disks or
REFERENCES USED:
"Kernel Hacker's Guide", Michael K. Johnson (johnsonm@sunsite.unc.edu)
"Adaptec 1520/1522 User's Guide", Adaptec Corporation.
-
+
Michael K. Johnson (johnsonm@sunsite.unc.edu)
Drew Eckhardt (drew@cs.colorado.edu)
#include <scsi/scsicam.h>
-struct proc_dir_entry proc_scsi_aha152x = {
- PROC_SCSI_AHA152X, 7, "aha152x",
- S_IFDIR | S_IRUGO | S_IXUGO, 2
+struct proc_dir_entry proc_scsi_aha152x =
+{
+ PROC_SCSI_AHA152X, 7, "aha152x",
+ S_IFDIR | S_IRUGO | S_IXUGO, 2
};
/* DEFINES */
#if defined(DEBUG_AHA152X)
-#undef SKIP_PORTS /* don't display ports */
-
-#undef DEBUG_QUEUE /* debug queue() */
-#undef DEBUG_RESET /* debug reset() */
-#undef DEBUG_INTR /* debug intr() */
-#undef DEBUG_SELECTION /* debug selection part in intr() */
-#undef DEBUG_MSGO /* debug message out phase in intr() */
-#undef DEBUG_MSGI /* debug message in phase in intr() */
-#undef DEBUG_STATUS /* debug status phase in intr() */
-#undef DEBUG_CMD /* debug command phase in intr() */
-#undef DEBUG_DATAI /* debug data in phase in intr() */
-#undef DEBUG_DATAO /* debug data out phase in intr() */
-#undef DEBUG_ABORT /* debug abort() */
-#undef DEBUG_DONE /* debug done() */
-#undef DEBUG_BIOSPARAM /* debug biosparam() */
-
-#undef DEBUG_RACE /* debug race conditions */
-#undef DEBUG_PHASES /* debug phases (useful to trace) */
-#undef DEBUG_QUEUES /* debug reselection */
+#undef SKIP_PORTS /* don't display ports */
+
+#undef DEBUG_QUEUE /* debug queue() */
+#undef DEBUG_RESET /* debug reset() */
+#undef DEBUG_INTR /* debug intr() */
+#undef DEBUG_SELECTION /* debug selection part in intr() */
+#undef DEBUG_MSGO /* debug message out phase in intr() */
+#undef DEBUG_MSGI /* debug message in phase in intr() */
+#undef DEBUG_STATUS /* debug status phase in intr() */
+#undef DEBUG_CMD /* debug command phase in intr() */
+#undef DEBUG_DATAI /* debug data in phase in intr() */
+#undef DEBUG_DATAO /* debug data out phase in intr() */
+#undef DEBUG_ABORT /* debug abort() */
+#undef DEBUG_DONE /* debug done() */
+#undef DEBUG_BIOSPARAM /* debug biosparam() */
+
+#undef DEBUG_RACE /* debug race conditions */
+#undef DEBUG_PHASES /* debug phases (useful to trace) */
+#undef DEBUG_QUEUES /* debug reselection */
/* recently used for debugging */
#if 0
#define IRQS IRQ_MAX-IRQ_MIN+1
enum {
- not_issued = 0x0001,
- in_selection = 0x0002,
- disconnected = 0x0004,
- aborted = 0x0008,
- sent_ident = 0x0010,
- in_other = 0x0020,
- in_sync = 0x0040,
- sync_ok = 0x0080,
+ not_issued = 0x0001,
+ in_selection = 0x0002,
+ disconnected = 0x0004,
+ aborted = 0x0008,
+ sent_ident = 0x0010,
+ in_other = 0x0020,
+ in_sync = 0x0040,
+ sync_ok = 0x0080,
};
#if defined(MODULE)
#if defined(DEBUG_AHA152X)
-int aha152x[] = { 0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0, DEBUG_DEFAULT };
-int aha152x1[] = { 0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0, DEBUG_DEFAULT };
+int aha152x[] =
+{0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0, DEBUG_DEFAULT};
+int aha152x1[] =
+{0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0, DEBUG_DEFAULT};
MODULE_PARM(aha152x, "1-9i");
MODULE_PARM(aha152x1, "1-9i");
#else
-int aha152x[] = { 0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0 };
-int aha152x1[] = { 0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0 };
+int aha152x[] =
+{0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0};
+int aha152x1[] =
+{0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0};
MODULE_PARM(aha152x, "1-8i");
MODULE_PARM(aha152x1, "1-8i");
#endif
#endif
/* set by aha152x_setup according to the command line */
-static int setup_count=0;
-static int registered_count=0;
+static int setup_count = 0;
+static int registered_count = 0;
static struct aha152x_setup {
- int io_port;
- int irq;
- int scsiid;
- int reconnect;
- int parity;
- int synchronous;
- int delay;
- int ext_trans;
+ int io_port;
+ int irq;
+ int scsiid;
+ int reconnect;
+ int parity;
+ int synchronous;
+ int delay;
+ int ext_trans;
#ifdef DEBUG_AHA152X
- int debug;
+ int debug;
#endif
- char *conf;
+ char *conf;
} setup[2];
static struct Scsi_Host *aha152x_host[IRQS];
#define ADDMSG(x) (MSG(MSGLEN++)=x)
struct aha152x_hostdata {
- Scsi_Cmnd *issue_SC;
- Scsi_Cmnd *current_SC;
- Scsi_Cmnd *disconnected_SC;
- int aborting;
- int abortion_complete;
- int abort_result;
- int commands;
-
- int reconnect;
- int parity;
- int synchronous;
- int delay;
- int ext_trans;
-
- int swint;
- int service;
-
- unsigned char syncrate[8];
-
- unsigned char message[256];
- int message_len;
+ Scsi_Cmnd *issue_SC;
+ Scsi_Cmnd *current_SC;
+ Scsi_Cmnd *disconnected_SC;
+ int aborting;
+ int abortion_complete;
+ int abort_result;
+ int commands;
+
+ int reconnect;
+ int parity;
+ int synchronous;
+ int delay;
+ int ext_trans;
+
+ int swint;
+ int service;
+
+ unsigned char syncrate[8];
+
+ unsigned char message[256];
+ int message_len;
#ifdef DEBUG_AHA152X
- int debug;
+ int debug;
#endif
};
static void aha152x_panic(struct Scsi_Host *shpnt, char *msg);
static void disp_ports(struct Scsi_Host *shpnt);
-static void show_command(Scsi_Cmnd *ptr);
+static void show_command(Scsi_Cmnd * ptr);
static void show_queues(struct Scsi_Host *shpnt);
static void disp_enintr(struct Scsi_Host *shpnt);
/* possible i/o addresses for the AIC-6260 */
static unsigned short ports[] =
{
- 0x340, /* default first */
- 0x140
+ 0x340, /* default first */
+ 0x140
};
#define PORT_COUNT (sizeof(ports) / sizeof(unsigned short))
/* possible locations for the Adaptec BIOS */
static unsigned int addresses[] =
{
- 0xdc000, /* default first */
- 0xc8000,
- 0xcc000,
- 0xd0000,
- 0xd4000,
- 0xd8000,
- 0xe0000,
- 0xeb800, /* VTech Platinum SMP */
- 0xf0000,
+ 0xdc000, /* default first */
+ 0xc8000,
+ 0xcc000,
+ 0xd0000,
+ 0xd4000,
+ 0xd8000,
+ 0xe0000,
+ 0xeb800, /* VTech Platinum SMP */
+ 0xf0000,
};
#define ADDRESS_COUNT (sizeof(addresses) / sizeof(unsigned int))
needed anyway. May be an information whether or not the BIOS supports
extended translation could be also useful here. */
static struct signature {
- unsigned char *signature;
- int sig_offset;
- int sig_length;
+ unsigned char *signature;
+ int sig_offset;
+ int sig_length;
} signatures[] =
+
{
- { "Adaptec AHA-1520 BIOS", 0x102e, 21 }, /* Adaptec 152x */
- { "Adaptec AHA-1520B", 0x0b, 19 }, /* Adaptec 152x rev B */
- { "Adaptec ASW-B626 BIOS", 0x1029, 21 }, /* on-board controller */
- { "Adaptec BIOS: ASW-B626", 0x0f, 22 }, /* on-board controller */
- { "Adaptec ASW-B626 S2", 0x2e6c, 19 }, /* on-board controller */
- { "Adaptec BIOS:AIC-6360", 0xc, 21 }, /* on-board controller */
- { "ScsiPro SP-360 BIOS", 0x2873, 19 }, /* ScsiPro-Controller */
- { "GA-400 LOCAL BUS SCSI BIOS", 0x102e, 26 }, /* Gigabyte Local-Bus-SCSI */
- { "Adaptec BIOS:AVA-282X", 0xc, 21 }, /* Adaptec 282x */
- { "Adaptec IBM Dock II SCSI", 0x2edd, 24 }, /* IBM Thinkpad Dock II */
- { "Adaptec BIOS:AHA-1532P", 0x1c, 22 }, /* IBM Thinkpad Dock II SCSI */
- { "DTC3520A Host Adapter BIOS", 0x318a, 26 }, /* DTC 3520A ISA SCSI */
+ {
+ "Adaptec AHA-1520 BIOS", 0x102e, 21
+ }, /* Adaptec 152x */
+ {
+ "Adaptec AHA-1520B", 0x0b, 19
+ }, /* Adaptec 152x rev B */
+ {
+ "Adaptec ASW-B626 BIOS", 0x1029, 21
+ }, /* on-board controller */
+ {
+ "Adaptec BIOS: ASW-B626", 0x0f, 22
+ }, /* on-board controller */
+ {
+ "Adaptec ASW-B626 S2", 0x2e6c, 19
+ }, /* on-board controller */
+ {
+ "Adaptec BIOS:AIC-6360", 0xc, 21
+ }, /* on-board controller */
+ {
+ "ScsiPro SP-360 BIOS", 0x2873, 19
+ }, /* ScsiPro-Controller */
+ {
+ "GA-400 LOCAL BUS SCSI BIOS", 0x102e, 26
+ }, /* Gigabyte Local-Bus-SCSI */
+ {
+ "Adaptec BIOS:AVA-282X", 0xc, 21
+ }, /* Adaptec 282x */
+ {
+ "Adaptec IBM Dock II SCSI", 0x2edd, 24
+ }, /* IBM Thinkpad Dock II */
+ {
+ "Adaptec BIOS:AHA-1532P", 0x1c, 22
+ }, /* IBM Thinkpad Dock II SCSI */
+ {
+ "DTC3520A Host Adapter BIOS", 0x318a, 26
+ }, /* DTC 3520A ISA SCSI */
};
+
#define SIGNATURE_COUNT (sizeof(signatures) / sizeof(struct signature))
#endif
-static void do_pause(unsigned amount) /* Pause for amount*10 milliseconds */
-{
- unsigned long the_time = jiffies + amount; /* 0.01 seconds per jiffy */
+static void do_pause(unsigned amount)
+{ /* Pause for amount*10 milliseconds */
+ unsigned long the_time = jiffies + amount; /* 0.01 seconds per jiffy */
- while (time_before(jiffies, the_time))
- barrier();
+ while (time_before(jiffies, the_time))
+ barrier();
}
/*
* queue services:
*/
-static inline void append_SC(Scsi_Cmnd **SC, Scsi_Cmnd *new_SC)
+static inline void append_SC(Scsi_Cmnd ** SC, Scsi_Cmnd * new_SC)
{
- Scsi_Cmnd *end;
-
- new_SC->host_scribble = (unsigned char *) NULL;
- if(!*SC)
- *SC=new_SC;
- else {
- for(end=*SC; end->host_scribble; end = (Scsi_Cmnd *) end->host_scribble)
- ;
- end->host_scribble = (unsigned char *) new_SC;
- }
+ Scsi_Cmnd *end;
+
+ new_SC->host_scribble = (unsigned char *) NULL;
+ if (!*SC)
+ *SC = new_SC;
+ else {
+ for (end = *SC; end->host_scribble; end = (Scsi_Cmnd *) end->host_scribble);
+ end->host_scribble = (unsigned char *) new_SC;
+ }
}
-static inline Scsi_Cmnd *remove_first_SC(Scsi_Cmnd **SC)
+static inline Scsi_Cmnd *remove_first_SC(Scsi_Cmnd ** SC)
{
- Scsi_Cmnd *ptr;
+ Scsi_Cmnd *ptr;
- ptr=*SC;
- if(ptr)
- *SC= (Scsi_Cmnd *) (*SC)->host_scribble;
- return ptr;
+ ptr = *SC;
+ if (ptr)
+ *SC = (Scsi_Cmnd *) (*SC)->host_scribble;
+ return ptr;
}
-static inline Scsi_Cmnd *remove_SC(Scsi_Cmnd **SC, int target, int lun)
+static inline Scsi_Cmnd *remove_SC(Scsi_Cmnd ** SC, int target, int lun)
{
- Scsi_Cmnd *ptr, *prev;
-
- for(ptr=*SC, prev=NULL;
- ptr && ((ptr->target!=target) || (ptr->lun!=lun));
- prev = ptr, ptr = (Scsi_Cmnd *) ptr->host_scribble)
- ;
+ Scsi_Cmnd *ptr, *prev;
- if(ptr){
- if(prev)
- prev->host_scribble = ptr->host_scribble;
- else
- *SC= (Scsi_Cmnd *) ptr->host_scribble;
- }
+ for (ptr = *SC, prev = NULL;
+ ptr && ((ptr->target != target) || (ptr->lun != lun));
+ prev = ptr, ptr = (Scsi_Cmnd *) ptr->host_scribble);
- return ptr;
+ if (ptr) {
+ if (prev)
+ prev->host_scribble = ptr->host_scribble;
+ else
+ *SC = (Scsi_Cmnd *) ptr->host_scribble;
+ }
+ return ptr;
}
/*
*/
static void make_acklow(struct Scsi_Host *shpnt)
{
- SETPORT(SXFRCTL0, CH1|SPIOEN);
- GETPORT(SCSIDAT);
- SETPORT(SXFRCTL0, CH1);
+ SETPORT(SXFRCTL0, CH1 | SPIOEN);
+ GETPORT(SCSIDAT);
+ SETPORT(SXFRCTL0, CH1);
- while(TESTHI(SCSISIG, ACKI))
- barrier();
+ while (TESTHI(SCSISIG, ACKI))
+ barrier();
}
/*
*/
static int getphase(struct Scsi_Host *shpnt)
{
- int phase, sstat1;
-
- while(1) {
- do {
- while(!((sstat1 = GETPORT(SSTAT1)) & (BUSFREE|SCSIRSTI|REQINIT)))
- barrier();
- if(sstat1 & BUSFREE)
- return P_BUSFREE;
- if(sstat1 & SCSIRSTI) {
- printk("aha152x: RESET IN\n");
- SETPORT(SSTAT1, SCSIRSTI);
- }
- } while(TESTHI(SCSISIG, ACKI) || TESTLO(SSTAT1, REQINIT));
-
- SETPORT(SSTAT1, CLRSCSIPERR);
-
- phase = GETPORT(SCSISIG) & P_MASK ;
-
- if(TESTHI(SSTAT1, SCSIPERR)) {
- if((phase & (CDO|MSGO))==0) /* DATA phase */
- return P_PARITY;
-
- make_acklow(shpnt);
- } else
- return phase;
- }
+ int phase, sstat1;
+
+ while (1) {
+ do {
+ while (!((sstat1 = GETPORT(SSTAT1)) & (BUSFREE | SCSIRSTI | REQINIT)))
+ barrier();
+ if (sstat1 & BUSFREE)
+ return P_BUSFREE;
+ if (sstat1 & SCSIRSTI) {
+ printk("aha152x: RESET IN\n");
+ SETPORT(SSTAT1, SCSIRSTI);
+ }
+ } while (TESTHI(SCSISIG, ACKI) || TESTLO(SSTAT1, REQINIT));
+
+ SETPORT(SSTAT1, CLRSCSIPERR);
+
+ phase = GETPORT(SCSISIG) & P_MASK;
+
+ if (TESTHI(SSTAT1, SCSIPERR)) {
+ if ((phase & (CDO | MSGO)) == 0) /* DATA phase */
+ return P_PARITY;
+
+ make_acklow(shpnt);
+ } else
+ return phase;
+ }
}
/* called from init/main.c */
void aha152x_setup(char *str, int *ints)
{
- if(setup_count>2)
- panic("aha152x: you can only configure up to two controllers\n");
-
- setup[setup_count].conf = str;
- setup[setup_count].io_port = ints[0] >= 1 ? ints[1] : 0x340;
- setup[setup_count].irq = ints[0] >= 2 ? ints[2] : 11;
- setup[setup_count].scsiid = ints[0] >= 3 ? ints[3] : 7;
- setup[setup_count].reconnect = ints[0] >= 4 ? ints[4] : 1;
- setup[setup_count].parity = ints[0] >= 5 ? ints[5] : 1;
- setup[setup_count].synchronous = ints[0] >= 6 ? ints[6] : 0 /* FIXME: 1 */;
- setup[setup_count].delay = ints[0] >= 7 ? ints[7] : DELAY_DEFAULT;
- setup[setup_count].ext_trans = ints[0] >= 8 ? ints[8] : 0;
+ if (setup_count > 2)
+ panic("aha152x: you can only configure up to two controllers\n");
+
+ setup[setup_count].conf = str;
+ setup[setup_count].io_port = ints[0] >= 1 ? ints[1] : 0x340;
+ setup[setup_count].irq = ints[0] >= 2 ? ints[2] : 11;
+ setup[setup_count].scsiid = ints[0] >= 3 ? ints[3] : 7;
+ setup[setup_count].reconnect = ints[0] >= 4 ? ints[4] : 1;
+ setup[setup_count].parity = ints[0] >= 5 ? ints[5] : 1;
+ setup[setup_count].synchronous = ints[0] >= 6 ? ints[6] : 0 /* FIXME: 1 */ ;
+ setup[setup_count].delay = ints[0] >= 7 ? ints[7] : DELAY_DEFAULT;
+ setup[setup_count].ext_trans = ints[0] >= 8 ? ints[8] : 0;
#ifdef DEBUG_AHA152X
- setup[setup_count].debug = ints[0] >= 9 ? ints[9] : DEBUG_DEFAULT;
- if(ints[0]>9) {
- printk("aha152x: usage: aha152x=<IOBASE>[,<IRQ>[,<SCSI ID>"
- "[,<RECONNECT>[,<PARITY>[,<SYNCHRONOUS>[,<DELAY>[,<EXT_TRANS>[,<DEBUG>]]]]]]]]\n");
+ setup[setup_count].debug = ints[0] >= 9 ? ints[9] : DEBUG_DEFAULT;
+ if (ints[0] > 9) {
+ printk("aha152x: usage: aha152x=<IOBASE>[,<IRQ>[,<SCSI ID>"
+ "[,<RECONNECT>[,<PARITY>[,<SYNCHRONOUS>[,<DELAY>[,<EXT_TRANS>[,<DEBUG>]]]]]]]]\n");
#else
- if(ints[0]>8) {
- printk("aha152x: usage: aha152x=<IOBASE>[,<IRQ>[,<SCSI ID>"
- "[,<RECONNECT>[,<PARITY>[,<SYNCHRONOUS>[,<DELAY>[,<EXT_TRANS>]]]]]]]\n");
+ if (ints[0] > 8) {
+ printk("aha152x: usage: aha152x=<IOBASE>[,<IRQ>[,<SCSI ID>"
+ "[,<RECONNECT>[,<PARITY>[,<SYNCHRONOUS>[,<DELAY>[,<EXT_TRANS>]]]]]]]\n");
#endif
- } else
- setup_count++;
+ } else
+ setup_count++;
}
/*
*/
static int aha152x_porttest(int io_port)
{
- int i;
+ int i;
- if(check_region(io_port, IO_RANGE))
- return 0;
+ if (check_region(io_port, IO_RANGE))
+ return 0;
- SETPORT(io_port+O_DMACNTRL1, 0); /* reset stack pointer */
- for(i=0; i<16; i++)
- SETPORT(io_port+O_STACK, i);
+ SETPORT(io_port + O_DMACNTRL1, 0); /* reset stack pointer */
+ for (i = 0; i < 16; i++)
+ SETPORT(io_port + O_STACK, i);
- SETPORT(io_port+O_DMACNTRL1, 0); /* reset stack pointer */
- for(i=0; i<16 && GETPORT(io_port+O_STACK)==i; i++)
- ;
+ SETPORT(io_port + O_DMACNTRL1, 0); /* reset stack pointer */
+ for (i = 0; i < 16 && GETPORT(io_port + O_STACK) == i; i++);
- return(i==16);
+ return (i == 16);
}
int aha152x_checksetup(struct aha152x_setup *setup)
{
- int i;
-
+ int i;
+
#ifndef PCMCIA
- for(i=0; i<PORT_COUNT && (setup->io_port != ports[i]); i++)
- ;
-
- if(i==PORT_COUNT)
- return 0;
-#endif
-
- if(!aha152x_porttest(setup->io_port))
- return 0;
-
- if((setup->irq<IRQ_MIN) || (setup->irq>IRQ_MAX))
- return 0;
-
- if((setup->scsiid < 0) || (setup->scsiid > 7))
- return 0;
-
- if((setup->reconnect < 0) || (setup->reconnect > 1))
- return 0;
-
- if((setup->parity < 0) || (setup->parity > 1))
- return 0;
-
- if((setup->synchronous < 0) || (setup->synchronous > 1))
- return 0;
-
- if((setup->ext_trans < 0) || (setup->ext_trans > 1))
- return 0;
-
-
- return 1;
+ for (i = 0; i < PORT_COUNT && (setup->io_port != ports[i]); i++);
+
+ if (i == PORT_COUNT)
+ return 0;
+#endif
+
+ if (!aha152x_porttest(setup->io_port))
+ return 0;
+
+ if ((setup->irq < IRQ_MIN) || (setup->irq > IRQ_MAX))
+ return 0;
+
+ if ((setup->scsiid < 0) || (setup->scsiid > 7))
+ return 0;
+
+ if ((setup->reconnect < 0) || (setup->reconnect > 1))
+ return 0;
+
+ if ((setup->parity < 0) || (setup->parity > 1))
+ return 0;
+
+ if ((setup->synchronous < 0) || (setup->synchronous > 1))
+ return 0;
+
+ if ((setup->ext_trans < 0) || (setup->ext_trans > 1))
+ return 0;
+
+
+ return 1;
}
-void aha152x_swintr(int irqno, void *dev_id, struct pt_regs * regs)
+void aha152x_swintr(int irqno, void *dev_id, struct pt_regs *regs)
{
- struct Scsi_Host *shpnt = aha152x_host[irqno-IRQ_MIN];
+ struct Scsi_Host *shpnt = aha152x_host[irqno - IRQ_MIN];
- if(!shpnt)
- panic("aha152x: catched software interrupt for unknown controller.\n");
+ if (!shpnt)
+ panic("aha152x: catched software interrupt for unknown controller.\n");
- HOSTDATA(shpnt)->swint++;
+ HOSTDATA(shpnt)->swint++;
}
int aha152x_detect(Scsi_Host_Template * tpnt)
{
- int i, j, ok;
+ int i, j, ok;
#if defined(AUTOCONF)
- aha152x_config conf;
-#endif
-
- tpnt->proc_dir = &proc_scsi_aha152x;
-
- for(i=0; i<IRQS; i++)
- aha152x_host[i] = (struct Scsi_Host *) NULL;
-
- if(setup_count) {
- printk("aha152x: processing commandline: ");
-
- for(i=0; i<setup_count; i++)
- if(!aha152x_checksetup(&setup[i])) {
- printk("\naha152x: %s\n", setup[i].conf);
- printk("aha152x: invalid line (controller=%d)\n", i+1);
- }
-
- printk("ok\n");
- }
-
+ aha152x_config conf;
+#endif
+
+ tpnt->proc_dir = &proc_scsi_aha152x;
+
+ for (i = 0; i < IRQS; i++)
+ aha152x_host[i] = (struct Scsi_Host *) NULL;
+
+ if (setup_count) {
+ printk("aha152x: processing commandline: ");
+
+ for (i = 0; i < setup_count; i++)
+ if (!aha152x_checksetup(&setup[i])) {
+ printk("\naha152x: %s\n", setup[i].conf);
+ printk("aha152x: invalid line (controller=%d)\n", i + 1);
+ }
+ printk("ok\n");
+ }
#ifdef SETUP0
- if(setup_count<2) {
- struct aha152x_setup override = SETUP0;
-
- if(setup_count==0 || (override.io_port != setup[0].io_port))
- if(!aha152x_checksetup(&override)) {
- printk("\naha152x: invalid override SETUP0={0x%x,%d,%d,%d,%d,%d,%d,%d}\n",
- override.io_port,
- override.irq,
- override.scsiid,
- override.reconnect,
- override.parity,
- override.synchronous,
- override.delay,
- override.ext_trans);
- } else
- setup[setup_count++] = override;
- }
+ if (setup_count < 2) {
+ struct aha152x_setup override = SETUP0;
+
+ if (setup_count == 0 || (override.io_port != setup[0].io_port))
+ if (!aha152x_checksetup(&override)) {
+ printk("\naha152x: invalid override SETUP0={0x%x,%d,%d,%d,%d,%d,%d,%d}\n",
+ override.io_port,
+ override.irq,
+ override.scsiid,
+ override.reconnect,
+ override.parity,
+ override.synchronous,
+ override.delay,
+ override.ext_trans);
+ } else
+ setup[setup_count++] = override;
+ }
#endif
#ifdef SETUP1
- if(setup_count<2) {
- struct aha152x_setup override = SETUP1;
-
- if(setup_count==0 || (override.io_port != setup[0].io_port))
- if(!aha152x_checksetup(&override)) {
- printk("\naha152x: invalid override SETUP1={0x%x,%d,%d,%d,%d,%d,%d,%d}\n",
- override.io_port,
- override.irq,
- override.scsiid,
- override.reconnect,
- override.parity,
- override.synchronous,
- override.delay,
- override.ext_trans);
- } else
- setup[setup_count++] = override;
- }
+ if (setup_count < 2) {
+ struct aha152x_setup override = SETUP1;
+
+ if (setup_count == 0 || (override.io_port != setup[0].io_port))
+ if (!aha152x_checksetup(&override)) {
+ printk("\naha152x: invalid override SETUP1={0x%x,%d,%d,%d,%d,%d,%d,%d}\n",
+ override.io_port,
+ override.irq,
+ override.scsiid,
+ override.reconnect,
+ override.parity,
+ override.synchronous,
+ override.delay,
+ override.ext_trans);
+ } else
+ setup[setup_count++] = override;
+ }
#endif
#if defined(MODULE)
- if(setup_count<2 && aha152x[0]!=0) {
- setup[setup_count].conf = "";
- setup[setup_count].io_port = aha152x[0];
- setup[setup_count].irq = aha152x[1];
- setup[setup_count].scsiid = aha152x[2];
- setup[setup_count].reconnect = aha152x[3];
- setup[setup_count].parity = aha152x[4];
- setup[setup_count].synchronous = aha152x[5];
- setup[setup_count].delay = aha152x[6];
- setup[setup_count].ext_trans = aha152x[7];
+ if (setup_count < 2 && aha152x[0] != 0) {
+ setup[setup_count].conf = "";
+ setup[setup_count].io_port = aha152x[0];
+ setup[setup_count].irq = aha152x[1];
+ setup[setup_count].scsiid = aha152x[2];
+ setup[setup_count].reconnect = aha152x[3];
+ setup[setup_count].parity = aha152x[4];
+ setup[setup_count].synchronous = aha152x[5];
+ setup[setup_count].delay = aha152x[6];
+ setup[setup_count].ext_trans = aha152x[7];
#ifdef DEBUG_AHA152X
- setup[setup_count].debug = aha152x[8];
-#endif
- if(aha152x_checksetup(&setup[setup_count]))
- setup_count++;
- else
- printk("\naha152x: invalid module argument aha152x=0x%x,%d,%d,%d,%d,%d,%d,%d\n",
- setup[setup_count].io_port,
- setup[setup_count].irq,
- setup[setup_count].scsiid,
- setup[setup_count].reconnect,
- setup[setup_count].parity,
- setup[setup_count].synchronous,
- setup[setup_count].delay,
- setup[setup_count].ext_trans);
- }
-
- if(setup_count<2 && aha152x1[0]!=0) {
- setup[setup_count].conf = "";
- setup[setup_count].io_port = aha152x1[0];
- setup[setup_count].irq = aha152x1[1];
- setup[setup_count].scsiid = aha152x1[2];
- setup[setup_count].reconnect = aha152x1[3];
- setup[setup_count].parity = aha152x1[4];
- setup[setup_count].synchronous = aha152x1[5];
- setup[setup_count].delay = aha152x1[6];
- setup[setup_count].ext_trans = aha152x1[7];
+ setup[setup_count].debug = aha152x[8];
+#endif
+ if (aha152x_checksetup(&setup[setup_count]))
+ setup_count++;
+ else
+ printk("\naha152x: invalid module argument aha152x=0x%x,%d,%d,%d,%d,%d,%d,%d\n",
+ setup[setup_count].io_port,
+ setup[setup_count].irq,
+ setup[setup_count].scsiid,
+ setup[setup_count].reconnect,
+ setup[setup_count].parity,
+ setup[setup_count].synchronous,
+ setup[setup_count].delay,
+ setup[setup_count].ext_trans);
+ }
+ if (setup_count < 2 && aha152x1[0] != 0) {
+ setup[setup_count].conf = "";
+ setup[setup_count].io_port = aha152x1[0];
+ setup[setup_count].irq = aha152x1[1];
+ setup[setup_count].scsiid = aha152x1[2];
+ setup[setup_count].reconnect = aha152x1[3];
+ setup[setup_count].parity = aha152x1[4];
+ setup[setup_count].synchronous = aha152x1[5];
+ setup[setup_count].delay = aha152x1[6];
+ setup[setup_count].ext_trans = aha152x1[7];
#ifdef DEBUG_AHA152X
- setup[setup_count].debug = aha152x1[8];
-#endif
- if(aha152x_checksetup(&setup[setup_count]))
- setup_count++;
- else
- printk("\naha152x: invalid module argument aha152x1=0x%x,%d,%d,%d,%d,%d,%d,%d\n",
- setup[setup_count].io_port,
- setup[setup_count].irq,
- setup[setup_count].scsiid,
- setup[setup_count].reconnect,
- setup[setup_count].parity,
- setup[setup_count].synchronous,
- setup[setup_count].delay,
- setup[setup_count].ext_trans);
- }
-#endif
-
+ setup[setup_count].debug = aha152x1[8];
+#endif
+ if (aha152x_checksetup(&setup[setup_count]))
+ setup_count++;
+ else
+ printk("\naha152x: invalid module argument aha152x1=0x%x,%d,%d,%d,%d,%d,%d,%d\n",
+ setup[setup_count].io_port,
+ setup[setup_count].irq,
+ setup[setup_count].scsiid,
+ setup[setup_count].reconnect,
+ setup[setup_count].parity,
+ setup[setup_count].synchronous,
+ setup[setup_count].delay,
+ setup[setup_count].ext_trans);
+ }
+#endif
+
#if defined(AUTOCONF)
- if(setup_count<2) {
+ if (setup_count < 2) {
#if !defined(SKIP_BIOSTEST)
- ok=0;
- for(i=0; i < ADDRESS_COUNT && !ok; i++)
- for(j=0; (j < SIGNATURE_COUNT) && !ok; j++)
- ok = check_signature(addresses[i]+signatures[j].sig_offset,
- signatures[j].signature, signatures[j].sig_length);
+ ok = 0;
+ for (i = 0; i < ADDRESS_COUNT && !ok; i++)
+ for (j = 0; (j < SIGNATURE_COUNT) && !ok; j++)
+ ok = check_signature(addresses[i] + signatures[j].sig_offset,
+ signatures[j].signature, signatures[j].sig_length);
- if(!ok && setup_count==0)
- return 0;
+ if (!ok && setup_count == 0)
+ return 0;
- printk("aha152x: BIOS test: passed, ");
+ printk("aha152x: BIOS test: passed, ");
#else
- printk("aha152x: ");
-#endif /* !SKIP_BIOSTEST */
-
- ok=0;
- for(i=0; i<PORT_COUNT && setup_count<2; i++) {
- if((setup_count==1) && (setup[0].io_port == ports[i]))
- continue;
-
- if(aha152x_porttest(ports[i])) {
- ok++;
- setup[setup_count].io_port = ports[i];
-
- conf.cf_port =
- (GETPORT(ports[i]+O_PORTA)<<8) + GETPORT(ports[i]+O_PORTB);
-
- setup[setup_count].irq = IRQ_MIN + conf.cf_irq;
- setup[setup_count].scsiid = conf.cf_id;
- setup[setup_count].reconnect = conf.cf_tardisc;
- setup[setup_count].parity = !conf.cf_parity;
- setup[setup_count].synchronous = 0 /* FIXME: conf.cf_syncneg */;
- setup[setup_count].delay = DELAY_DEFAULT;
- setup[setup_count].ext_trans = 0;
+ printk("aha152x: ");
+#endif /* !SKIP_BIOSTEST */
+
+ ok = 0;
+ for (i = 0; i < PORT_COUNT && setup_count < 2; i++) {
+ if ((setup_count == 1) && (setup[0].io_port == ports[i]))
+ continue;
+
+ if (aha152x_porttest(ports[i])) {
+ ok++;
+ setup[setup_count].io_port = ports[i];
+
+ conf.cf_port =
+ (GETPORT(ports[i] + O_PORTA) << 8) + GETPORT(ports[i] + O_PORTB);
+
+ setup[setup_count].irq = IRQ_MIN + conf.cf_irq;
+ setup[setup_count].scsiid = conf.cf_id;
+ setup[setup_count].reconnect = conf.cf_tardisc;
+ setup[setup_count].parity = !conf.cf_parity;
+ setup[setup_count].synchronous = 0 /* FIXME: conf.cf_syncneg */ ;
+ setup[setup_count].delay = DELAY_DEFAULT;
+ setup[setup_count].ext_trans = 0;
#ifdef DEBUG_AHA152X
- setup[setup_count].debug = DEBUG_DEFAULT;
+ setup[setup_count].debug = DEBUG_DEFAULT;
#endif
- setup_count++;
- }
- }
+ setup_count++;
+ }
+ }
- if(ok)
- printk("auto configuration: ok, ");
- }
+ if (ok)
+ printk("auto configuration: ok, ");
+ }
#endif
- printk("detected %d controller(s)\n", setup_count);
+ printk("detected %d controller(s)\n", setup_count);
- for(i=0; i<setup_count; i++) {
- struct Scsi_Host *shpnt;
- unsigned long int the_time;
+ for (i = 0; i < setup_count; i++) {
+ struct Scsi_Host *shpnt;
+ unsigned long int the_time;
- shpnt = aha152x_host[setup[i].irq-IRQ_MIN] =
- scsi_register(tpnt, sizeof(struct aha152x_hostdata));
- registered_count++;
+ shpnt = aha152x_host[setup[i].irq - IRQ_MIN] =
+ scsi_register(tpnt, sizeof(struct aha152x_hostdata));
+ registered_count++;
- shpnt->io_port = setup[i].io_port;
- shpnt->n_io_port = IO_RANGE;
- shpnt->irq = setup[i].irq;
+ shpnt->io_port = setup[i].io_port;
+ shpnt->n_io_port = IO_RANGE;
+ shpnt->irq = setup[i].irq;
- ISSUE_SC = (Scsi_Cmnd *) NULL;
- CURRENT_SC = (Scsi_Cmnd *) NULL;
- DISCONNECTED_SC = (Scsi_Cmnd *) NULL;
+ ISSUE_SC = (Scsi_Cmnd *) NULL;
+ CURRENT_SC = (Scsi_Cmnd *) NULL;
+ DISCONNECTED_SC = (Scsi_Cmnd *) NULL;
- HOSTDATA(shpnt)->reconnect = setup[i].reconnect;
- HOSTDATA(shpnt)->parity = setup[i].parity;
- HOSTDATA(shpnt)->synchronous = setup[i].synchronous;
- HOSTDATA(shpnt)->delay = setup[i].delay;
- HOSTDATA(shpnt)->ext_trans = setup[i].ext_trans;
+ HOSTDATA(shpnt)->reconnect = setup[i].reconnect;
+ HOSTDATA(shpnt)->parity = setup[i].parity;
+ HOSTDATA(shpnt)->synchronous = setup[i].synchronous;
+ HOSTDATA(shpnt)->delay = setup[i].delay;
+ HOSTDATA(shpnt)->ext_trans = setup[i].ext_trans;
#ifdef DEBUG_AHA152X
- HOSTDATA(shpnt)->debug = setup[i].debug;
-#endif
-
- HOSTDATA(shpnt)->aborting = 0;
- HOSTDATA(shpnt)->abortion_complete = 0;
- HOSTDATA(shpnt)->abort_result = 0;
- HOSTDATA(shpnt)->commands = 0;
-
- HOSTDATA(shpnt)->message_len = 0;
-
- for(j=0; j<8; j++)
- HOSTDATA(shpnt)->syncrate[j] = 0;
-
- SETPORT(SCSIID, setup[i].scsiid << 4);
- shpnt->this_id=setup[i].scsiid;
-
- if(setup[i].reconnect)
- shpnt->can_queue=AHA152X_MAXQUEUE;
-
- /* RESET OUT */
- SETBITS(SCSISEQ, SCSIRSTO);
- do_pause(30);
- CLRBITS(SCSISEQ, SCSIRSTO);
- do_pause(setup[i].delay);
-
- aha152x_reset_ports(shpnt);
-
- printk("aha152x%d: vital data: PORTBASE=0x%03lx, IRQ=%d, SCSI ID=%d,"
- " reconnect=%s, parity=%s, synchronous=%s, delay=%d, extended translation=%s\n",
- i,
- shpnt->io_port,
- shpnt->irq,
- shpnt->this_id,
- HOSTDATA(shpnt)->reconnect ? "enabled" : "disabled",
- HOSTDATA(shpnt)->parity ? "enabled" : "disabled",
- HOSTDATA(shpnt)->synchronous ? "enabled" : "disabled",
- HOSTDATA(shpnt)->delay,
- HOSTDATA(shpnt)->ext_trans ? "enabled" : "disabled");
-
- request_region(shpnt->io_port, IO_RANGE, "aha152x"); /* Register */
-
- /* not expecting any interrupts */
- SETPORT(SIMODE0, 0);
- SETPORT(SIMODE1, 0);
-
- SETBITS(DMACNTRL0, INTEN);
-
- ok = request_irq(shpnt->irq, aha152x_swintr, SA_INTERRUPT, "aha152x", shpnt);
- if(ok<0) {
- if(ok == -EINVAL)
- printk("aha152x%d: bad IRQ %d.\n", i, shpnt->irq);
- else if(ok == -EBUSY)
- printk("aha152x%d: IRQ %d already in use.\n", i, shpnt->irq);
- else
- printk("\naha152x%d: Unexpected error code %d on requesting IRQ %d.\n", i, ok, shpnt->irq);
- printk("aha152x: driver needs an IRQ.\n");
-
- scsi_unregister(shpnt);
- registered_count--;
- release_region(shpnt->io_port, IO_RANGE);
- shpnt=aha152x_host[shpnt->irq-IRQ_MIN]=0;
- continue;
- }
-
- HOSTDATA(shpnt)->swint=0;
-
- printk("aha152x: trying software interrupt, ");
- SETBITS(DMACNTRL0, SWINT);
-
- the_time=jiffies+100;
- while(!HOSTDATA(shpnt)->swint && time_before(jiffies, the_time))
- barrier();
-
- free_irq(shpnt->irq,shpnt);
-
- if(!HOSTDATA(shpnt)->swint) {
- if(TESTHI(DMASTAT, INTSTAT)) {
- printk("lost.\n");
- } else {
- printk("failed.\n");
- }
-
- printk("aha152x: IRQ %d possibly wrong. Please verify.\n", shpnt->irq);
-
- scsi_unregister(shpnt);
- registered_count--;
- release_region(shpnt->io_port, IO_RANGE);
- shpnt=aha152x_host[shpnt->irq-IRQ_MIN]=0;
- continue;
- }
-
- printk("ok.\n");
-
- CLRBITS(DMACNTRL0, SWINT);
-
- /* clear interrupts */
- SETPORT(SSTAT0, 0x7f);
- SETPORT(SSTAT1, 0xef);
-
- if(request_irq(shpnt->irq,aha152x_intr,SA_INTERRUPT,"aha152x",shpnt)<0) {
- printk("aha152x: failed to reassign interrupt.\n");
- }
- }
-
- return (registered_count>0);
+ HOSTDATA(shpnt)->debug = setup[i].debug;
+#endif
+
+ HOSTDATA(shpnt)->aborting = 0;
+ HOSTDATA(shpnt)->abortion_complete = 0;
+ HOSTDATA(shpnt)->abort_result = 0;
+ HOSTDATA(shpnt)->commands = 0;
+
+ HOSTDATA(shpnt)->message_len = 0;
+
+ for (j = 0; j < 8; j++)
+ HOSTDATA(shpnt)->syncrate[j] = 0;
+
+ SETPORT(SCSIID, setup[i].scsiid << 4);
+ shpnt->this_id = setup[i].scsiid;
+
+ if (setup[i].reconnect)
+ shpnt->can_queue = AHA152X_MAXQUEUE;
+
+ /* RESET OUT */
+ SETBITS(SCSISEQ, SCSIRSTO);
+ do_pause(30);
+ CLRBITS(SCSISEQ, SCSIRSTO);
+ do_pause(setup[i].delay);
+
+ aha152x_reset_ports(shpnt);
+
+ printk("aha152x%d: vital data: PORTBASE=0x%03lx, IRQ=%d, SCSI ID=%d,"
+ " reconnect=%s, parity=%s, synchronous=%s, delay=%d, extended translation=%s\n",
+ i,
+ shpnt->io_port,
+ shpnt->irq,
+ shpnt->this_id,
+ HOSTDATA(shpnt)->reconnect ? "enabled" : "disabled",
+ HOSTDATA(shpnt)->parity ? "enabled" : "disabled",
+ HOSTDATA(shpnt)->synchronous ? "enabled" : "disabled",
+ HOSTDATA(shpnt)->delay,
+ HOSTDATA(shpnt)->ext_trans ? "enabled" : "disabled");
+
+ request_region(shpnt->io_port, IO_RANGE, "aha152x"); /* Register */
+
+ /* not expecting any interrupts */
+ SETPORT(SIMODE0, 0);
+ SETPORT(SIMODE1, 0);
+
+ SETBITS(DMACNTRL0, INTEN);
+
+ ok = request_irq(shpnt->irq, aha152x_swintr, SA_INTERRUPT, "aha152x", shpnt);
+ if (ok < 0) {
+ if (ok == -EINVAL)
+ printk("aha152x%d: bad IRQ %d.\n", i, shpnt->irq);
+ else if (ok == -EBUSY)
+ printk("aha152x%d: IRQ %d already in use.\n", i, shpnt->irq);
+ else
+ printk("\naha152x%d: Unexpected error code %d on requesting IRQ %d.\n", i, ok, shpnt->irq);
+ printk("aha152x: driver needs an IRQ.\n");
+
+ scsi_unregister(shpnt);
+ registered_count--;
+ release_region(shpnt->io_port, IO_RANGE);
+ shpnt = aha152x_host[shpnt->irq - IRQ_MIN] = 0;
+ continue;
+ }
+ HOSTDATA(shpnt)->swint = 0;
+
+ printk("aha152x: trying software interrupt, ");
+ SETBITS(DMACNTRL0, SWINT);
+
+ the_time = jiffies + 100;
+ while (!HOSTDATA(shpnt)->swint && time_before(jiffies, the_time))
+ barrier();
+
+ free_irq(shpnt->irq, shpnt);
+
+ if (!HOSTDATA(shpnt)->swint) {
+ if (TESTHI(DMASTAT, INTSTAT)) {
+ printk("lost.\n");
+ } else {
+ printk("failed.\n");
+ }
+
+ printk("aha152x: IRQ %d possibly wrong. Please verify.\n", shpnt->irq);
+
+ scsi_unregister(shpnt);
+ registered_count--;
+ release_region(shpnt->io_port, IO_RANGE);
+ shpnt = aha152x_host[shpnt->irq - IRQ_MIN] = 0;
+ continue;
+ }
+ printk("ok.\n");
+
+ CLRBITS(DMACNTRL0, SWINT);
+
+ /* clear interrupts */
+ SETPORT(SSTAT0, 0x7f);
+ SETPORT(SSTAT1, 0xef);
+
+ if (request_irq(shpnt->irq, aha152x_intr, SA_INTERRUPT, "aha152x", shpnt) < 0) {
+ printk("aha152x: failed to reassign interrupt.\n");
+ }
+ }
+
+ return (registered_count > 0);
}
int aha152x_release(struct Scsi_Host *shpnt)
{
- if (shpnt->irq)
- free_irq(shpnt->irq, shpnt);
- if (shpnt->io_port)
- release_region(shpnt->io_port, IO_RANGE);
+ if (shpnt->irq)
+ free_irq(shpnt->irq, shpnt);
+ if (shpnt->io_port)
+ release_region(shpnt->io_port, IO_RANGE);
- return 0;
+ return 0;
}
/*
* Queue a command and setup interrupts for a free bus.
*/
-int aha152x_queue(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
+int aha152x_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
{
- struct Scsi_Host *shpnt = SCpnt->host;
- unsigned long flags;
+ struct Scsi_Host *shpnt = SCpnt->host;
+ unsigned long flags;
#if defined(DEBUG_RACE)
- enter_driver("queue");
+ enter_driver("queue");
#else
#if defined(DEBUG_QUEUE)
- if(HOSTDATA(shpnt)->debug & debug_queue)
- printk("aha152x: queue(), ");
+ if (HOSTDATA(shpnt)->debug & debug_queue)
+ printk("aha152x: queue(), ");
#endif
#endif
#if defined(DEBUG_QUEUE)
- if(HOSTDATA(shpnt)->debug & debug_queue) {
- printk("SCpnt (target = %d lun = %d cmnd = ",
- SCpnt->target, SCpnt->lun);
- print_command(SCpnt->cmnd);
- printk(", cmd_len=%d, pieces = %d size = %u), ",
- SCpnt->cmd_len, SCpnt->use_sg, SCpnt->request_bufflen);
- disp_ports(shpnt);
- }
-#endif
-
- SCpnt->scsi_done = done;
-
- /* setup scratch area
- SCp.ptr : buffer pointer
- SCp.this_residual : buffer length
- SCp.buffer : next buffer
- SCp.buffers_residual : left buffers in list
- SCp.phase : current state of the command */
- SCpnt->SCp.phase = not_issued;
- if (SCpnt->use_sg) {
- SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer;
- SCpnt->SCp.ptr = SCpnt->SCp.buffer->address;
- SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
- SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
- } else {
- SCpnt->SCp.ptr = (char *)SCpnt->request_buffer;
- SCpnt->SCp.this_residual = SCpnt->request_bufflen;
- SCpnt->SCp.buffer = NULL;
- SCpnt->SCp.buffers_residual = 0;
- }
-
- SCpnt->SCp.Status = CHECK_CONDITION;
- SCpnt->SCp.Message = 0;
- SCpnt->SCp.have_data_in = 0;
- SCpnt->SCp.sent_command = 0;
-
- /* Turn led on, when this is the first command. */
- save_flags(flags);
- cli();
- HOSTDATA(shpnt)->commands++;
- if(HOSTDATA(shpnt)->commands==1)
- SETPORT(PORTA, 1);
+ if (HOSTDATA(shpnt)->debug & debug_queue) {
+ printk("SCpnt (target = %d lun = %d cmnd = ",
+ SCpnt->target, SCpnt->lun);
+ print_command(SCpnt->cmnd);
+ printk(", cmd_len=%d, pieces = %d size = %u), ",
+ SCpnt->cmd_len, SCpnt->use_sg, SCpnt->request_bufflen);
+ disp_ports(shpnt);
+ }
+#endif
+
+ SCpnt->scsi_done = done;
+
+ /* setup scratch area
+ SCp.ptr : buffer pointer
+ SCp.this_residual : buffer length
+ SCp.buffer : next buffer
+ SCp.buffers_residual : left buffers in list
+ SCp.phase : current state of the command */
+ SCpnt->SCp.phase = not_issued;
+ if (SCpnt->use_sg) {
+ SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer;
+ SCpnt->SCp.ptr = SCpnt->SCp.buffer->address;
+ SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
+ SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
+ } else {
+ SCpnt->SCp.ptr = (char *) SCpnt->request_buffer;
+ SCpnt->SCp.this_residual = SCpnt->request_bufflen;
+ SCpnt->SCp.buffer = NULL;
+ SCpnt->SCp.buffers_residual = 0;
+ }
+
+ SCpnt->SCp.Status = CHECK_CONDITION;
+ SCpnt->SCp.Message = 0;
+ SCpnt->SCp.have_data_in = 0;
+ SCpnt->SCp.sent_command = 0;
+
+ /* Turn led on, when this is the first command. */
+ save_flags(flags);
+ cli();
+ HOSTDATA(shpnt)->commands++;
+ if (HOSTDATA(shpnt)->commands == 1)
+ SETPORT(PORTA, 1);
#if defined(DEBUG_QUEUES)
- if(HOSTDATA(shpnt)->debug & debug_queues)
- printk("i+ (%d), ", HOSTDATA(shpnt)->commands);
-#endif
- append_SC(&ISSUE_SC, SCpnt);
-
- /* Enable bus free interrupt, when we aren't currently on the bus */
- if(!CURRENT_SC) {
- SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
- SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
- }
- restore_flags(flags);
+ if (HOSTDATA(shpnt)->debug & debug_queues)
+ printk("i+ (%d), ", HOSTDATA(shpnt)->commands);
+#endif
+ append_SC(&ISSUE_SC, SCpnt);
+
+ /* Enable bus free interrupt, when we aren't currently on the bus */
+ if (!CURRENT_SC) {
+ SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
+ SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
+ }
+ restore_flags(flags);
#if defined(DEBUG_RACE)
- leave_driver("queue");
+ leave_driver("queue");
#endif
- return 0;
+ return 0;
}
/*
* We only support commands in interrupt-driven fashion
*/
-int aha152x_command(Scsi_Cmnd *SCpnt)
+int aha152x_command(Scsi_Cmnd * SCpnt)
{
- printk("aha152x: interrupt driven driver; use aha152x_queue()\n");
- return -1;
+ printk("aha152x: interrupt driven driver; use aha152x_queue()\n");
+ return -1;
}
/*
* Abort a queued command
* (commands that are on the bus can't be aborted easily)
*/
-int aha152x_abort(Scsi_Cmnd *SCpnt)
+int aha152x_abort(Scsi_Cmnd * SCpnt)
{
- struct Scsi_Host *shpnt = SCpnt->host;
- unsigned long flags;
- Scsi_Cmnd *ptr, *prev;
+ struct Scsi_Host *shpnt = SCpnt->host;
+ unsigned long flags;
+ Scsi_Cmnd *ptr, *prev;
- save_flags(flags);
- cli();
+ save_flags(flags);
+ cli();
#if defined(DEBUG_ABORT)
- if(HOSTDATA(shpnt)->debug & debug_abort) {
- printk("aha152x: abort(), SCpnt=0x%08x, ", (unsigned int) SCpnt);
- show_queues(shpnt);
- }
-#endif
-
- /* look for command in issue queue */
- for(ptr=ISSUE_SC, prev=NULL;
- ptr && ptr!=SCpnt;
- prev=ptr, ptr=(Scsi_Cmnd *) ptr->host_scribble)
- ;
-
- if(ptr) {
- /* dequeue */
- if(prev)
- prev->host_scribble = ptr->host_scribble;
- else
- ISSUE_SC = (Scsi_Cmnd *) ptr->host_scribble;
-
- HOSTDATA(shpnt)->commands--;
-
- restore_flags(flags);
-
- ptr->host_scribble = NULL;
- ptr->result = DID_ABORT << 16;
- ptr->scsi_done(ptr);
-
- return SCSI_ABORT_SUCCESS;
- }
-
- /* if the bus is busy or a command is currently processed,
- we can't do anything more */
- if (TESTLO(SSTAT1, BUSFREE) || (CURRENT_SC && CURRENT_SC!=SCpnt)) {
- /* fail abortion, if bus is busy */
-
- if(!CURRENT_SC)
- printk("bus busy w/o current command, ");
-
- restore_flags(flags);
-
- return SCSI_ABORT_BUSY;
- }
-
- /* bus is free */
-
- if(CURRENT_SC) {
- HOSTDATA(shpnt)->commands--;
-
- /* target entered bus free before COMMAND COMPLETE, nothing to abort */
- restore_flags(flags);
- CURRENT_SC->result = DID_ERROR << 16;
- CURRENT_SC->scsi_done(CURRENT_SC);
- CURRENT_SC = (Scsi_Cmnd *) NULL;
-
- return SCSI_ABORT_SUCCESS;
- }
-
- /* look for command in disconnected queue */
- for(ptr=DISCONNECTED_SC, prev=NULL;
- ptr && ptr!=SCpnt;
- prev=ptr, ptr=(Scsi_Cmnd *) ptr->host_scribble)
- ;
-
- if(!ptr) {
- /* command wasn't found */
- printk("command not found\n");
- restore_flags(flags);
-
- return SCSI_ABORT_NOT_RUNNING;
- }
-
- if(!HOSTDATA(shpnt)->aborting) {
- /* dequeue */
- if(prev)
- prev->host_scribble = ptr->host_scribble;
- else
- DISCONNECTED_SC = (Scsi_Cmnd *) ptr->host_scribble;
-
- HOSTDATA(shpnt)->commands--;
-
- /* set command current and initiate selection,
- let the interrupt routine take care of the abortion */
- CURRENT_SC = ptr;
- ptr->SCp.phase = in_selection|aborted;
- SETPORT(SCSIID, (shpnt->this_id << OID_) | CURRENT_SC->target);
-
- ADDMSG(ABORT);
-
- /* enable interrupts for SELECTION OUT DONE and SELECTION TIME OUT */
- SETPORT(SIMODE0, ENSELDO | (DISCONNECTED_SC ? ENSELDI : 0));
- SETPORT(SIMODE1, ENSELTIMO);
-
- /* Enable SELECTION OUT sequence */
- SETBITS(SCSISEQ, ENSELO | ENAUTOATNO);
-
- SETBITS(DMACNTRL0, INTEN);
- HOSTDATA(shpnt)->abort_result=SCSI_ABORT_SUCCESS;
- HOSTDATA(shpnt)->aborting++;
- HOSTDATA(shpnt)->abortion_complete=0;
-
- restore_flags(flags);
-
- /* sleep until the abortion is complete */
- while(!HOSTDATA(shpnt)->abortion_complete)
- barrier();
- HOSTDATA(shpnt)->aborting=0;
-
- return HOSTDATA(shpnt)->abort_result;
- } else {
- /* we're already aborting a command */
- restore_flags(flags);
+ if (HOSTDATA(shpnt)->debug & debug_abort) {
+ printk("aha152x: abort(), SCpnt=0x%08x, ", (unsigned int) SCpnt);
+ show_queues(shpnt);
+ }
+#endif
+
+ /* look for command in issue queue */
+ for (ptr = ISSUE_SC, prev = NULL;
+ ptr && ptr != SCpnt;
+ prev = ptr, ptr = (Scsi_Cmnd *) ptr->host_scribble);
+
+ if (ptr) {
+ /* dequeue */
+ if (prev)
+ prev->host_scribble = ptr->host_scribble;
+ else
+ ISSUE_SC = (Scsi_Cmnd *) ptr->host_scribble;
+
+ HOSTDATA(shpnt)->commands--;
+
+ restore_flags(flags);
+
+ ptr->host_scribble = NULL;
+ ptr->result = DID_ABORT << 16;
+ spin_lock_irqsave(&io_request_lock, flags);
+ ptr->scsi_done(ptr);
+ spin_unlock_irqrestore(&io_request_lock, flags);
+
+ return SCSI_ABORT_SUCCESS;
+ }
+ /* if the bus is busy or a command is currently processed,
+ we can't do anything more */
+ if (TESTLO(SSTAT1, BUSFREE) || (CURRENT_SC && CURRENT_SC != SCpnt)) {
+ /* fail abortion, if bus is busy */
+
+ if (!CURRENT_SC)
+ printk("bus busy w/o current command, ");
- return SCSI_ABORT_BUSY;
- }
+ restore_flags(flags);
+
+ return SCSI_ABORT_BUSY;
+ }
+ /* bus is free */
+
+ if (CURRENT_SC) {
+ HOSTDATA(shpnt)->commands--;
+
+ /* target entered bus free before COMMAND COMPLETE, nothing to abort */
+ restore_flags(flags);
+ spin_lock_irqsave(&io_request_lock, flags);
+ CURRENT_SC->result = DID_ERROR << 16;
+ CURRENT_SC->scsi_done(CURRENT_SC);
+ CURRENT_SC = (Scsi_Cmnd *) NULL;
+ spin_unlock_irqrestore(&io_request_lock, flags);
+
+ return SCSI_ABORT_SUCCESS;
+ }
+ /* look for command in disconnected queue */
+ for (ptr = DISCONNECTED_SC, prev = NULL;
+ ptr && ptr != SCpnt;
+ prev = ptr, ptr = (Scsi_Cmnd *) ptr->host_scribble);
+
+ if (!ptr) {
+ /* command wasn't found */
+ printk("command not found\n");
+ restore_flags(flags);
+
+ return SCSI_ABORT_NOT_RUNNING;
+ }
+ if (!HOSTDATA(shpnt)->aborting) {
+ /* dequeue */
+ if (prev)
+ prev->host_scribble = ptr->host_scribble;
+ else
+ DISCONNECTED_SC = (Scsi_Cmnd *) ptr->host_scribble;
+
+ HOSTDATA(shpnt)->commands--;
+
+ /* set command current and initiate selection,
+ let the interrupt routine take care of the abortion */
+ CURRENT_SC = ptr;
+ ptr->SCp.phase = in_selection | aborted;
+ SETPORT(SCSIID, (shpnt->this_id << OID_) | CURRENT_SC->target);
+
+ ADDMSG(ABORT);
+
+ /* enable interrupts for SELECTION OUT DONE and SELECTION TIME OUT */
+ SETPORT(SIMODE0, ENSELDO | (DISCONNECTED_SC ? ENSELDI : 0));
+ SETPORT(SIMODE1, ENSELTIMO);
+
+ /* Enable SELECTION OUT sequence */
+ SETBITS(SCSISEQ, ENSELO | ENAUTOATNO);
+
+ SETBITS(DMACNTRL0, INTEN);
+ HOSTDATA(shpnt)->abort_result = SCSI_ABORT_SUCCESS;
+ HOSTDATA(shpnt)->aborting++;
+ HOSTDATA(shpnt)->abortion_complete = 0;
+
+ restore_flags(flags);
+
+ /* sleep until the abortion is complete */
+ while (!HOSTDATA(shpnt)->abortion_complete)
+ barrier();
+ HOSTDATA(shpnt)->aborting = 0;
+
+ return HOSTDATA(shpnt)->abort_result;
+ } else {
+ /* we're already aborting a command */
+ restore_flags(flags);
+
+ return SCSI_ABORT_BUSY;
+ }
}
/*
*/
static void aha152x_reset_ports(struct Scsi_Host *shpnt)
{
- /* disable interrupts */
- SETPORT(DMACNTRL0, RSTFIFO);
+ /* disable interrupts */
+ SETPORT(DMACNTRL0, RSTFIFO);
- SETPORT(SCSISEQ, 0);
+ SETPORT(SCSISEQ, 0);
- SETPORT(SXFRCTL1, 0);
- SETPORT(SCSISIG, 0);
- SETPORT(SCSIRATE, 0);
+ SETPORT(SXFRCTL1, 0);
+ SETPORT(SCSISIG, 0);
+ SETPORT(SCSIRATE, 0);
- /* clear all interrupt conditions */
- SETPORT(SSTAT0, 0x7f);
- SETPORT(SSTAT1, 0xef);
+ /* clear all interrupt conditions */
+ SETPORT(SSTAT0, 0x7f);
+ SETPORT(SSTAT1, 0xef);
- SETPORT(SSTAT4, SYNCERR|FWERR|FRERR);
+ SETPORT(SSTAT4, SYNCERR | FWERR | FRERR);
- SETPORT(DMACNTRL0, 0);
- SETPORT(DMACNTRL1, 0);
+ SETPORT(DMACNTRL0, 0);
+ SETPORT(DMACNTRL1, 0);
- SETPORT(BRSTCNTRL, 0xf1);
+ SETPORT(BRSTCNTRL, 0xf1);
- /* clear SCSI fifo and transfer count */
- SETPORT(SXFRCTL0, CH1|CLRCH1|CLRSTCNT);
- SETPORT(SXFRCTL0, CH1);
+ /* clear SCSI fifo and transfer count */
+ SETPORT(SXFRCTL0, CH1 | CLRCH1 | CLRSTCNT);
+ SETPORT(SXFRCTL0, CH1);
- /* enable interrupts */
- SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
- SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
+ /* enable interrupts */
+ SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
+ SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
}
/*
* Reset registers, reset a hanging bus and
* kill active and disconnected commands for target w/o soft reset
*/
-int aha152x_reset(Scsi_Cmnd *SCpnt, unsigned int unused)
+int aha152x_reset(Scsi_Cmnd * SCpnt, unsigned int unused)
{
- struct Scsi_Host *shpnt = SCpnt->host;
- unsigned long flags;
- Scsi_Cmnd *ptr, *prev, *next;
+ struct Scsi_Host *shpnt = SCpnt->host;
+ unsigned long flags;
+ Scsi_Cmnd *ptr, *prev, *next;
- aha152x_reset_ports(shpnt);
+ aha152x_reset_ports(shpnt);
- /* Reset, if bus hangs */
- if(TESTLO(SSTAT1, BUSFREE)) {
- CLRBITS(DMACNTRL0, INTEN);
+ /* Reset, if bus hangs */
+ if (TESTLO(SSTAT1, BUSFREE)) {
+ CLRBITS(DMACNTRL0, INTEN);
#if defined(DEBUG_RESET)
- if(HOSTDATA(shpnt)->debug & debug_reset) {
- printk("aha152x: reset(), bus not free: SCSI RESET OUT\n");
- show_queues(shpnt);
- }
-#endif
-
- ptr=CURRENT_SC;
- if(ptr && !ptr->device->soft_reset) {
- ptr->host_scribble = NULL;
- ptr->result = DID_RESET << 16;
- ptr->scsi_done(CURRENT_SC);
- CURRENT_SC=NULL;
- }
-
- save_flags(flags);
- cli();
- prev=NULL; ptr=DISCONNECTED_SC;
- while(ptr) {
- if(!ptr->device->soft_reset) {
- if(prev)
- prev->host_scribble = ptr->host_scribble;
- else
- DISCONNECTED_SC = (Scsi_Cmnd *) ptr->host_scribble;
-
- next = (Scsi_Cmnd *) ptr->host_scribble;
-
- ptr->host_scribble = NULL;
- ptr->result = DID_RESET << 16;
- ptr->scsi_done(ptr);
-
- ptr = next;
- } else {
- prev=ptr;
- ptr = (Scsi_Cmnd *) ptr->host_scribble;
- }
- }
- restore_flags(flags);
+ if (HOSTDATA(shpnt)->debug & debug_reset) {
+ printk("aha152x: reset(), bus not free: SCSI RESET OUT\n");
+ show_queues(shpnt);
+ }
+#endif
+
+ ptr = CURRENT_SC;
+ if (ptr && !ptr->device->soft_reset) {
+ ptr->host_scribble = NULL;
+ ptr->result = DID_RESET << 16;
+ spin_lock_irqsave(&io_request_lock, flags);
+ ptr->scsi_done(CURRENT_SC);
+ spin_unlock_irqrestore(&io_request_lock, flags);
+ CURRENT_SC = NULL;
+ }
+ save_flags(flags);
+ cli();
+ prev = NULL;
+ ptr = DISCONNECTED_SC;
+ while (ptr) {
+ if (!ptr->device->soft_reset) {
+ if (prev)
+ prev->host_scribble = ptr->host_scribble;
+ else
+ DISCONNECTED_SC = (Scsi_Cmnd *) ptr->host_scribble;
+
+ next = (Scsi_Cmnd *) ptr->host_scribble;
+
+ ptr->host_scribble = NULL;
+ ptr->result = DID_RESET << 16;
+ spin_lock_irqsave(&io_request_lock, flags);
+ ptr->scsi_done(ptr);
+ spin_unlock_irqrestore(&io_request_lock, flags);
+
+ ptr = next;
+ } else {
+ prev = ptr;
+ ptr = (Scsi_Cmnd *) ptr->host_scribble;
+ }
+ }
+ restore_flags(flags);
#if defined(DEBUG_RESET)
- if(HOSTDATA(shpnt)->debug & debug_reset) {
- printk("commands on targets w/ soft-resets:\n");
- show_queues(shpnt);
- }
+ if (HOSTDATA(shpnt)->debug & debug_reset) {
+ printk("commands on targets w/ soft-resets:\n");
+ show_queues(shpnt);
+ }
#endif
- /* RESET OUT */
- SETPORT(SCSISEQ, SCSIRSTO);
- do_pause(30);
- SETPORT(SCSISEQ, 0);
- do_pause(DELAY);
-
- SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
- SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
+ /* RESET OUT */
+ SETPORT(SCSISEQ, SCSIRSTO);
+ do_pause(30);
+ SETPORT(SCSISEQ, 0);
+ do_pause(DELAY);
- SETPORT(DMACNTRL0, INTEN);
- }
+ SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
+ SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
- return SCSI_RESET_SUCCESS;
+ SETPORT(DMACNTRL0, INTEN);
+ }
+ return SCSI_RESET_SUCCESS;
}
/*
*/
int aha152x_biosparam(Scsi_Disk * disk, kdev_t dev, int *info_array)
{
- struct Scsi_Host *shpnt=disk->device->host;
+ struct Scsi_Host *shpnt = disk->device->host;
#if defined(DEBUG_BIOSPARAM)
- if(HOSTDATA(shpnt)->debug & debug_biosparam)
- printk("aha152x_biosparam: dev=%s, size=%d, ",
- kdevname(dev), disk->capacity);
-#endif
-
- /* try default translation */
- info_array[0]=64;
- info_array[1]=32;
- info_array[2]=disk->capacity / (64 * 32);
-
- /* for disks >1GB do some guessing */
- if(info_array[2]>=1024) {
- int info[3];
-
- /* try to figure out the geometry from the partition table */
- if(scsicam_bios_param(disk, dev, info)<0 ||
- !((info[0]==64 && info[1]==32) || (info[0]==255 && info[1]==63))) {
- if(EXT_TRANS) {
- printk("aha152x: unable to verify geometry for disk with >1GB.\n"
- " using extended translation.\n");
- info_array[0] = 255;
- info_array[1] = 63;
- info_array[2] = disk->capacity / (255 * 63);
- } else {
- printk("aha152x: unable to verify geometry for disk with >1GB.\n"
- " Using default translation. Please verify yourself.\n"
- " Perhaps you need to enable extended translation in the driver.\n"
- " See /usr/src/linux/drivers/scsi/aha152x.c for details.\n");
- }
- } else {
- info_array[0]=info[0];
- info_array[1]=info[1];
- info_array[2]=info[2];
-
- if(info[0]==255 && !EXT_TRANS) {
- printk("aha152x: current partition table is using extended translation.\n"
- " using it also, although it's not explicty enabled.\n");
- }
- }
- }
-
+ if (HOSTDATA(shpnt)->debug & debug_biosparam)
+ printk("aha152x_biosparam: dev=%s, size=%d, ",
+ kdevname(dev), disk->capacity);
+#endif
+
+ /* try default translation */
+ info_array[0] = 64;
+ info_array[1] = 32;
+ info_array[2] = disk->capacity / (64 * 32);
+
+ /* for disks >1GB do some guessing */
+ if (info_array[2] >= 1024) {
+ int info[3];
+
+ /* try to figure out the geometry from the partition table */
+ if (scsicam_bios_param(disk, dev, info) < 0 ||
+ !((info[0] == 64 && info[1] == 32) || (info[0] == 255 && info[1] == 63))) {
+ if (EXT_TRANS) {
+ printk("aha152x: unable to verify geometry for disk with >1GB.\n"
+ " using extended translation.\n");
+ info_array[0] = 255;
+ info_array[1] = 63;
+ info_array[2] = disk->capacity / (255 * 63);
+ } else {
+ printk("aha152x: unable to verify geometry for disk with >1GB.\n"
+ " Using default translation. Please verify yourself.\n"
+ " Perhaps you need to enable extended translation in the driver.\n"
+ " See /usr/src/linux/drivers/scsi/aha152x.c for details.\n");
+ }
+ } else {
+ info_array[0] = info[0];
+ info_array[1] = info[1];
+ info_array[2] = info[2];
+
+ if (info[0] == 255 && !EXT_TRANS) {
+ printk("aha152x: current partition table is using extended translation.\n"
+ " using it also, although it's not explicty enabled.\n");
+ }
+ }
+ }
#if defined(DEBUG_BIOSPARAM)
- if(HOSTDATA(shpnt)->debug & debug_biosparam) {
- printk("bios geometry: head=%d, sec=%d, cyl=%d\n",
- info_array[0], info_array[1], info_array[2]);
- printk("WARNING: check, if the bios geometry is correct.\n");
- }
+ if (HOSTDATA(shpnt)->debug & debug_biosparam) {
+ printk("bios geometry: head=%d, sec=%d, cyl=%d\n",
+ info_array[0], info_array[1], info_array[2]);
+ printk("WARNING: check, if the bios geometry is correct.\n");
+ }
#endif
- return 0;
+ return 0;
}
/*
*/
void aha152x_done(struct Scsi_Host *shpnt, int error)
{
- unsigned long flags;
- Scsi_Cmnd *done_SC;
+ unsigned long flags;
+ Scsi_Cmnd *done_SC;
#if defined(DEBUG_DONE)
- if(HOSTDATA(shpnt)->debug & debug_done) {
- printk("\naha152x: done(), ");
- disp_ports(shpnt);
- }
+ if (HOSTDATA(shpnt)->debug & debug_done) {
+ printk("\naha152x: done(), ");
+ disp_ports(shpnt);
+ }
#endif
- if(CURRENT_SC) {
+ if (CURRENT_SC) {
#if defined(DEBUG_DONE)
- if(HOSTDATA(shpnt)->debug & debug_done)
- printk("done(%x), ", error);
+ if (HOSTDATA(shpnt)->debug & debug_done)
+ printk("done(%x), ", error);
#endif
- save_flags(flags);
- cli();
+ save_flags(flags);
+ cli();
- done_SC = CURRENT_SC;
- CURRENT_SC = NULL;
+ done_SC = CURRENT_SC;
+ CURRENT_SC = NULL;
- /* turn led off, when no commands are in the driver */
- HOSTDATA(shpnt)->commands--;
- if(!HOSTDATA(shpnt)->commands)
- SETPORT(PORTA, 0); /* turn led off */
+ /* turn led off, when no commands are in the driver */
+ HOSTDATA(shpnt)->commands--;
+ if (!HOSTDATA(shpnt)->commands)
+ SETPORT(PORTA, 0); /* turn led off */
#if defined(DEBUG_QUEUES)
- if(HOSTDATA(shpnt)->debug & debug_queues)
- printk("ok (%d), ", HOSTDATA(shpnt)->commands);
+ if (HOSTDATA(shpnt)->debug & debug_queues)
+ printk("ok (%d), ", HOSTDATA(shpnt)->commands);
#endif
- restore_flags(flags);
+ restore_flags(flags);
- SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
- SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
+ SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
+ SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
#if 0
/* Why poll for the BUS FREE phase, when we have setup the interrupt!? */
#if defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & debug_phases)
- printk("BUS FREE loop, ");
+ if (HOSTDATA(shpnt)->debug & debug_phases)
+ printk("BUS FREE loop, ");
#endif
- while(TESTLO(SSTAT1, BUSFREE))
- barrier();
+ while (TESTLO(SSTAT1, BUSFREE))
+ barrier();
#if defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & debug_phases)
- printk("BUS FREE\n");
+ if (HOSTDATA(shpnt)->debug & debug_phases)
+ printk("BUS FREE\n");
#endif
#endif
- done_SC->result = error;
- if(done_SC->scsi_done) {
+ done_SC->result = error;
+ if (done_SC->scsi_done) {
#if defined(DEBUG_DONE)
- if(HOSTDATA(shpnt)->debug & debug_done)
- printk("calling scsi_done, ");
+ if (HOSTDATA(shpnt)->debug & debug_done)
+ printk("calling scsi_done, ");
#endif
- done_SC->scsi_done(done_SC);
+ spin_lock_irqsave(&io_request_lock, flags);
+ done_SC->scsi_done(done_SC);
+ spin_unlock_irqrestore(&io_request_lock, flags);
#if defined(DEBUG_DONE)
- if(HOSTDATA(shpnt)->debug & debug_done)
- printk("done returned, ");
+ if (HOSTDATA(shpnt)->debug & debug_done)
+ printk("done returned, ");
#endif
- } else
- panic("aha152x: current_SC->scsi_done() == NULL");
- } else
- aha152x_panic(shpnt, "done() called outside of command");
+ } else
+ panic("aha152x: current_SC->scsi_done() == NULL");
+ } else
+ aha152x_panic(shpnt, "done() called outside of command");
}
static struct tq_struct aha152x_tq;
/*
- * Run service completions on the card with interrupts enabled.
+ * Run service completions on the card with interrupts enabled.
*/
-
+
static void aha152x_run(void)
{
int i;
- for(i=0;i<IRQS;i++)
- {
- struct Scsi_Host *shpnt=aha152x_host[i];
- if(shpnt && HOSTDATA(shpnt)->service)
- {
- HOSTDATA(shpnt)->service=0;
+ for (i = 0; i < IRQS; i++) {
+ struct Scsi_Host *shpnt = aha152x_host[i];
+ if (shpnt && HOSTDATA(shpnt)->service) {
+ HOSTDATA(shpnt)->service = 0;
aha152x_complete(shpnt);
}
}
}
/*
- * Interrupts handler (main routine of the driver)
+ * Interrupts handler (main routine of the driver)
*/
-static void aha152x_intr(int irqno, void *dev_id, struct pt_regs * regs)
+static void aha152x_intr(int irqno, void *dev_id, struct pt_regs *regs)
{
- struct Scsi_Host *shpnt = aha152x_host[irqno-IRQ_MIN];
+ struct Scsi_Host *shpnt = aha152x_host[irqno - IRQ_MIN];
#if defined(DEBUG_RACE)
enter_driver("intr");
#else
#if defined(DEBUG_INTR)
- if(HOSTDATA(shpnt)->debug & debug_intr)
+ if (HOSTDATA(shpnt)->debug & debug_intr)
printk("\naha152x: intr(), ");
#endif
#endif
- if(!shpnt)
+ if (!shpnt)
panic("aha152x: catched interrupt for unknown controller.\n");
/* no more interrupts from the controller, while we're busy.
CLRBITS(DMACNTRL0, INTEN);
/* Poke the BH handler */
-
- HOSTDATA(shpnt)->service=1;
- aha152x_tq.routine = (void *)aha152x_run;
+
+ HOSTDATA(shpnt)->service = 1;
+ aha152x_tq.routine = (void *) aha152x_run;
queue_task(&aha152x_tq, &tq_immediate);
mark_bh(IMMEDIATE_BH);
}
static void aha152x_complete(struct Scsi_Host *shpnt)
{
unsigned int flags;
- int done=0, phase;
+ int done = 0, phase;
/* disconnected target is trying to reconnect.
Only possible, if we have disconnected nexuses and
nothing is occupying the bus.
*/
-
- if(TESTHI(SSTAT0, SELDI) &&
- DISCONNECTED_SC &&
- (!CURRENT_SC || (CURRENT_SC->SCp.phase & in_selection)) ) {
- int identify_msg, target, i;
-
- /* Avoid conflicts when a target reconnects
- while we are trying to connect to another. */
- if(CURRENT_SC) {
-#if defined(DEBUG_QUEUES)
- if(HOSTDATA(shpnt)->debug & debug_queues)
- printk("i+, ");
-#endif
- save_flags(flags);
- cli();
- append_SC(&ISSUE_SC, CURRENT_SC);
- CURRENT_SC=NULL;
- restore_flags(flags);
- }
- /* disable sequences */
- SETPORT(SCSISEQ, 0);
- SETPORT(SSTAT0, CLRSELDI);
- SETPORT(SSTAT1, CLRBUSFREE);
+ if (TESTHI(SSTAT0, SELDI) &&
+ DISCONNECTED_SC &&
+ (!CURRENT_SC || (CURRENT_SC->SCp.phase & in_selection))) {
+ int identify_msg, target, i;
+
+ /* Avoid conflicts when a target reconnects
+ while we are trying to connect to another. */
+ if (CURRENT_SC) {
+#if defined(DEBUG_QUEUES)
+ if (HOSTDATA(shpnt)->debug & debug_queues)
+ printk("i+, ");
+#endif
+ save_flags(flags);
+ cli();
+ append_SC(&ISSUE_SC, CURRENT_SC);
+ CURRENT_SC = NULL;
+ restore_flags(flags);
+ }
+ /* disable sequences */
+ SETPORT(SCSISEQ, 0);
+ SETPORT(SSTAT0, CLRSELDI);
+ SETPORT(SSTAT1, CLRBUSFREE);
#if defined(DEBUG_QUEUES) || defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & (debug_queues|debug_phases))
- printk("reselected, ");
+ if (HOSTDATA(shpnt)->debug & (debug_queues | debug_phases))
+ printk("reselected, ");
#endif
- i = GETPORT(SELID) & ~(1 << shpnt->this_id);
- target=0;
+ i = GETPORT(SELID) & ~(1 << shpnt->this_id);
+ target = 0;
- if(i==0)
- aha152x_panic(shpnt, "reconnecting target unknown");
+ if (i == 0)
+ aha152x_panic(shpnt, "reconnecting target unknown");
- for(; (i & 1)==0; target++, i>>=1)
- ;
+ for (; (i & 1) == 0; target++, i >>= 1);
#if defined(DEBUG_QUEUES)
- if(HOSTDATA(shpnt)->debug & debug_queues)
- printk("SELID=%02x, target=%d, ", GETPORT(SELID), target);
+ if (HOSTDATA(shpnt)->debug & debug_queues)
+ printk("SELID=%02x, target=%d, ", GETPORT(SELID), target);
#endif
- SETPORT(SCSIID, (shpnt->this_id << OID_) | target);
- SETPORT(SCSISEQ, ENRESELI);
+ SETPORT(SCSIID, (shpnt->this_id << OID_) | target);
+ SETPORT(SCSISEQ, ENRESELI);
- if(TESTLO(SSTAT0, SELDI))
- aha152x_panic(shpnt, "RESELI failed");
+ if (TESTLO(SSTAT0, SELDI))
+ aha152x_panic(shpnt, "RESELI failed");
- SETPORT(SCSIRATE, HOSTDATA(shpnt)->syncrate[target]&0x7f);
+ SETPORT(SCSIRATE, HOSTDATA(shpnt)->syncrate[target] & 0x7f);
- SETPORT(SCSISIG, P_MSGI);
+ SETPORT(SCSISIG, P_MSGI);
- /* Get identify message */
- if((i=getphase(shpnt))!=P_MSGI) {
- printk("target doesn't enter MSGI to identify (phase=%02x)\n", i);
- aha152x_panic(shpnt, "unknown lun");
- }
- SETPORT(SCSISEQ, 0);
-
- SETPORT(SXFRCTL0, CH1);
-
- identify_msg = GETPORT(SCSIBUS);
+ /* Get identify message */
+ if ((i = getphase(shpnt)) != P_MSGI) {
+ printk("target doesn't enter MSGI to identify (phase=%02x)\n", i);
+ aha152x_panic(shpnt, "unknown lun");
+ }
+ SETPORT(SCSISEQ, 0);
- if(!(identify_msg & IDENTIFY_BASE)) {
- printk("target=%d, inbound message (%02x) != IDENTIFY\n",
- target, identify_msg);
- aha152x_panic(shpnt, "unknown lun");
- }
+ SETPORT(SXFRCTL0, CH1);
+ identify_msg = GETPORT(SCSIBUS);
+ if (!(identify_msg & IDENTIFY_BASE)) {
+ printk("target=%d, inbound message (%02x) != IDENTIFY\n",
+ target, identify_msg);
+ aha152x_panic(shpnt, "unknown lun");
+ }
#if defined(DEBUG_QUEUES)
- if(HOSTDATA(shpnt)->debug & debug_queues)
- printk("identify=%02x, lun=%d, ", identify_msg, identify_msg & 0x3f);
+ if (HOSTDATA(shpnt)->debug & debug_queues)
+ printk("identify=%02x, lun=%d, ", identify_msg, identify_msg & 0x3f);
#endif
- save_flags(flags);
- cli();
+ save_flags(flags);
+ cli();
#if defined(DEBUG_QUEUES)
- if(HOSTDATA(shpnt)->debug & debug_queues)
- printk("d-, ");
+ if (HOSTDATA(shpnt)->debug & debug_queues)
+ printk("d-, ");
#endif
- CURRENT_SC = remove_SC(&DISCONNECTED_SC, target, identify_msg & 0x3f);
-
- if(!CURRENT_SC) {
- printk("lun=%d, ", identify_msg & 0x3f);
- aha152x_panic(shpnt, "no disconnected command for that lun");
- }
+ CURRENT_SC = remove_SC(&DISCONNECTED_SC, target, identify_msg & 0x3f);
- CURRENT_SC->SCp.phase &= ~disconnected;
- restore_flags(flags);
+ if (!CURRENT_SC) {
+ printk("lun=%d, ", identify_msg & 0x3f);
+ aha152x_panic(shpnt, "no disconnected command for that lun");
+ }
+ CURRENT_SC->SCp.phase &= ~disconnected;
+ restore_flags(flags);
- make_acklow(shpnt);
- if(getphase(shpnt)!=P_MSGI) {
- SETPORT(SIMODE0, 0);
- SETPORT(SIMODE1, ENPHASEMIS|ENBUSFREE);
+ make_acklow(shpnt);
+ if (getphase(shpnt) != P_MSGI) {
+ SETPORT(SIMODE0, 0);
+ SETPORT(SIMODE1, ENPHASEMIS | ENBUSFREE);
#if defined(DEBUG_RACE)
- leave_driver("(reselected) intr");
-#endif
- SETBITS(DMACNTRL0, INTEN);
- return;
- }
- }
-
- /* Check, if we aren't busy with a command */
- if(!CURRENT_SC) {
- /* bus is free to issue a queued command */
- if(TESTHI(SSTAT1, BUSFREE) && ISSUE_SC) {
- save_flags(flags);
- cli();
+ leave_driver("(reselected) intr");
+#endif
+ SETBITS(DMACNTRL0, INTEN);
+ return;
+ }
+ }
+ /* Check, if we aren't busy with a command */
+ if (!CURRENT_SC) {
+ /* bus is free to issue a queued command */
+ if (TESTHI(SSTAT1, BUSFREE) && ISSUE_SC) {
+ save_flags(flags);
+ cli();
#if defined(DEBUG_QUEUES)
- if(HOSTDATA(shpnt)->debug & debug_queues)
- printk("i-, ");
+ if (HOSTDATA(shpnt)->debug & debug_queues)
+ printk("i-, ");
#endif
- CURRENT_SC = remove_first_SC(&ISSUE_SC);
- restore_flags(flags);
+ CURRENT_SC = remove_first_SC(&ISSUE_SC);
+ restore_flags(flags);
#if defined(DEBUG_INTR) || defined(DEBUG_SELECTION) || defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & (debug_intr|debug_selection|debug_phases))
- printk("issuing command, ");
+ if (HOSTDATA(shpnt)->debug & (debug_intr | debug_selection | debug_phases))
+ printk("issuing command, ");
#endif
- CURRENT_SC->SCp.phase = in_selection;
+ CURRENT_SC->SCp.phase = in_selection;
#if defined(DEBUG_INTR) || defined(DEBUG_SELECTION) || defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & (debug_intr|debug_selection|debug_phases))
- printk("selecting %d, ", CURRENT_SC->target);
-#endif
- SETPORT(SCSIID, (shpnt->this_id << OID_) | CURRENT_SC->target);
-
- /* Enable interrupts for SELECTION OUT DONE and SELECTION OUT INITIATED */
- SETPORT(SXFRCTL1, HOSTDATA(shpnt)->parity ? (ENSPCHK|ENSTIMER) : ENSTIMER);
-
- /* enable interrupts for SELECTION OUT DONE and SELECTION TIME OUT */
- SETPORT(SIMODE0, ENSELDO | (DISCONNECTED_SC ? ENSELDI : 0));
- SETPORT(SIMODE1, ENSELTIMO);
-
- /* Enable SELECTION OUT sequence */
- SETBITS(SCSISEQ, ENSELO | ENAUTOATNO);
-
- } else {
- /* No command we are busy with and no new to issue */
- printk("aha152x: ignoring spurious interrupt, nothing to do\n");
- if(TESTHI(DMACNTRL0, SWINT)) {
- printk("aha152x: SWINT is set! Why?\n");
- CLRBITS(DMACNTRL0, SWINT);
- }
- show_queues(shpnt);
- }
+ if (HOSTDATA(shpnt)->debug & (debug_intr | debug_selection | debug_phases))
+ printk("selecting %d, ", CURRENT_SC->target);
+#endif
+ SETPORT(SCSIID, (shpnt->this_id << OID_) | CURRENT_SC->target);
+
+ /* Enable interrupts for SELECTION OUT DONE and SELECTION OUT INITIATED */
+ SETPORT(SXFRCTL1, HOSTDATA(shpnt)->parity ? (ENSPCHK | ENSTIMER) : ENSTIMER);
+
+ /* enable interrupts for SELECTION OUT DONE and SELECTION TIME OUT */
+ SETPORT(SIMODE0, ENSELDO | (DISCONNECTED_SC ? ENSELDI : 0));
+ SETPORT(SIMODE1, ENSELTIMO);
+
+ /* Enable SELECTION OUT sequence */
+ SETBITS(SCSISEQ, ENSELO | ENAUTOATNO);
+
+ } else {
+ /* No command we are busy with and no new to issue */
+ printk("aha152x: ignoring spurious interrupt, nothing to do\n");
+ if (TESTHI(DMACNTRL0, SWINT)) {
+ printk("aha152x: SWINT is set! Why?\n");
+ CLRBITS(DMACNTRL0, SWINT);
+ }
+ show_queues(shpnt);
+ }
#if defined(DEBUG_RACE)
- leave_driver("(selecting) intr");
+ leave_driver("(selecting) intr");
#endif
- SETBITS(DMACNTRL0, INTEN);
- return;
- }
-
- /* the bus is busy with something */
+ SETBITS(DMACNTRL0, INTEN);
+ return;
+ }
+ /* the bus is busy with something */
#if defined(DEBUG_INTR)
- if(HOSTDATA(shpnt)->debug & debug_intr)
- disp_ports(shpnt);
+ if (HOSTDATA(shpnt)->debug & debug_intr)
+ disp_ports(shpnt);
#endif
- /* we are waiting for the result of a selection attempt */
- if(CURRENT_SC->SCp.phase & in_selection) {
- if(TESTLO(SSTAT1, SELTO)) {
- /* no timeout */
- if(TESTHI(SSTAT0, SELDO)) {
- /* clear BUS FREE interrupt */
- SETPORT(SSTAT1, CLRBUSFREE);
+ /* we are waiting for the result of a selection attempt */
+ if (CURRENT_SC->SCp.phase & in_selection) {
+ if (TESTLO(SSTAT1, SELTO)) {
+ /* no timeout */
+ if (TESTHI(SSTAT0, SELDO)) {
+ /* clear BUS FREE interrupt */
+ SETPORT(SSTAT1, CLRBUSFREE);
- /* Disable SELECTION OUT sequence */
- CLRBITS(SCSISEQ, ENSELO|ENAUTOATNO);
+ /* Disable SELECTION OUT sequence */
+ CLRBITS(SCSISEQ, ENSELO | ENAUTOATNO);
- /* Disable SELECTION OUT DONE interrupt */
- CLRBITS(SIMODE0, ENSELDO);
- CLRBITS(SIMODE1, ENSELTIMO);
+ /* Disable SELECTION OUT DONE interrupt */
+ CLRBITS(SIMODE0, ENSELDO);
+ CLRBITS(SIMODE1, ENSELTIMO);
- if(TESTLO(SSTAT0, SELDO)) {
- printk("aha152x: passing bus free condition\n");
+ if (TESTLO(SSTAT0, SELDO)) {
+ printk("aha152x: passing bus free condition\n");
#if defined(DEBUG_RACE)
- leave_driver("(passing bus free) intr");
+ leave_driver("(passing bus free) intr");
#endif
- SETBITS(DMACNTRL0, INTEN);
-
- if(CURRENT_SC->SCp.phase & aborted) {
- HOSTDATA(shpnt)->abort_result=SCSI_ABORT_ERROR;
- HOSTDATA(shpnt)->abortion_complete++;
- }
+ SETBITS(DMACNTRL0, INTEN);
- aha152x_done(shpnt, DID_NO_CONNECT << 16);
+ if (CURRENT_SC->SCp.phase & aborted) {
+ HOSTDATA(shpnt)->abort_result = SCSI_ABORT_ERROR;
+ HOSTDATA(shpnt)->abortion_complete++;
+ }
+ aha152x_done(shpnt, DID_NO_CONNECT << 16);
- return;
- }
+ return;
+ }
#if defined(DEBUG_SELECTION) || defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & (debug_selection|debug_phases))
- printk("SELDO (SELID=%x), ", GETPORT(SELID));
+ if (HOSTDATA(shpnt)->debug & (debug_selection | debug_phases))
+ printk("SELDO (SELID=%x), ", GETPORT(SELID));
#endif
- /* selection was done */
- SETPORT(SSTAT0, CLRSELDO);
+ /* selection was done */
+ SETPORT(SSTAT0, CLRSELDO);
#if defined(DEBUG_ABORT)
- if((HOSTDATA(shpnt)->debug & debug_abort) && (CURRENT_SC->SCp.phase & aborted))
- printk("(ABORT) target selected, ");
+ if ((HOSTDATA(shpnt)->debug & debug_abort) && (CURRENT_SC->SCp.phase & aborted))
+ printk("(ABORT) target selected, ");
#endif
- CURRENT_SC->SCp.phase &= ~in_selection;
- CURRENT_SC->SCp.phase |= in_other;
+ CURRENT_SC->SCp.phase &= ~in_selection;
+ CURRENT_SC->SCp.phase |= in_other;
- ADDMSG(IDENTIFY(HOSTDATA(shpnt)->reconnect,CURRENT_SC->lun));
+ ADDMSG(IDENTIFY(HOSTDATA(shpnt)->reconnect, CURRENT_SC->lun));
- if(!(SYNCRATE&0x80) && HOSTDATA(shpnt)->synchronous) {
- ADDMSG(EXTENDED_MESSAGE);
- ADDMSG(3);
- ADDMSG(EXTENDED_SDTR);
- ADDMSG(50);
- ADDMSG(8);
+ if (!(SYNCRATE & 0x80) && HOSTDATA(shpnt)->synchronous) {
+ ADDMSG(EXTENDED_MESSAGE);
+ ADDMSG(3);
+ ADDMSG(EXTENDED_SDTR);
+ ADDMSG(50);
+ ADDMSG(8);
- printk("outbound SDTR: ");
- print_msg(&MSG(MSGLEN-5));
-
- SYNCRATE=0x80;
- CURRENT_SC->SCp.phase |= in_sync;
- }
+ printk("outbound SDTR: ");
+ print_msg(&MSG(MSGLEN - 5));
+ SYNCRATE = 0x80;
+ CURRENT_SC->SCp.phase |= in_sync;
+ }
#if defined(DEBUG_RACE)
- leave_driver("(SELDO) intr");
+ leave_driver("(SELDO) intr");
#endif
- SETPORT(SCSIRATE, SYNCRATE&0x7f);
+ SETPORT(SCSIRATE, SYNCRATE & 0x7f);
- SETPORT(SCSISIG, P_MSGO);
+ SETPORT(SCSISIG, P_MSGO);
- SETPORT(SIMODE0, 0);
- SETPORT(SIMODE1, ENREQINIT|ENBUSFREE);
- SETBITS(DMACNTRL0, INTEN);
+ SETPORT(SIMODE0, 0);
+ SETPORT(SIMODE1, ENREQINIT | ENBUSFREE);
+ SETBITS(DMACNTRL0, INTEN);
- return;
- } else
- aha152x_panic(shpnt, "neither timeout nor selection\007");
- } else {
+ return;
+ } else
+ aha152x_panic(shpnt, "neither timeout nor selection\007");
+ } else {
#if defined(DEBUG_SELECTION) || defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & (debug_selection|debug_phases))
- printk("SELTO, ");
+ if (HOSTDATA(shpnt)->debug & (debug_selection | debug_phases))
+ printk("SELTO, ");
#endif
- /* end selection attempt */
- CLRBITS(SCSISEQ, ENSELO|ENAUTOATNO);
+ /* end selection attempt */
+ CLRBITS(SCSISEQ, ENSELO | ENAUTOATNO);
- /* timeout */
- SETPORT(SSTAT1, CLRSELTIMO);
+ /* timeout */
+ SETPORT(SSTAT1, CLRSELTIMO);
- SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
- SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
- SETBITS(DMACNTRL0, INTEN);
+ SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
+ SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
+ SETBITS(DMACNTRL0, INTEN);
#if defined(DEBUG_RACE)
- leave_driver("(SELTO) intr");
+ leave_driver("(SELTO) intr");
#endif
- if(CURRENT_SC->SCp.phase & aborted) {
+ if (CURRENT_SC->SCp.phase & aborted) {
#if defined(DEBUG_ABORT)
- if(HOSTDATA(shpnt)->debug & debug_abort)
- printk("(ABORT) selection timeout, ");
-#endif
- HOSTDATA(shpnt)->abort_result=SCSI_ABORT_ERROR;
- HOSTDATA(shpnt)->abortion_complete++;
- }
-
- if(TESTLO(SSTAT0, SELINGO))
- /* ARBITRATION not won */
- aha152x_done(shpnt, DID_BUS_BUSY << 16);
- else
- /* ARBITRATION won, but SELECTION failed */
- aha152x_done(shpnt, DID_NO_CONNECT << 16);
-
- return;
- }
- }
-
- /* enable interrupt, when target leaves current phase */
- phase = getphase(shpnt);
- if(!(phase & ~P_MASK)) /* "real" phase */
- SETPORT(SCSISIG, phase);
- SETPORT(SSTAT1, CLRPHASECHG);
- CURRENT_SC->SCp.phase =
- (CURRENT_SC->SCp.phase & ~((P_MASK|1)<<16)) | (phase << 16);
-
- /* information transfer phase */
- switch(phase) {
- case P_MSGO: /* MESSAGE OUT */
- {
- int i, identify=0, abort=0;
+ if (HOSTDATA(shpnt)->debug & debug_abort)
+ printk("(ABORT) selection timeout, ");
+#endif
+ HOSTDATA(shpnt)->abort_result = SCSI_ABORT_ERROR;
+ HOSTDATA(shpnt)->abortion_complete++;
+ }
+ if (TESTLO(SSTAT0, SELINGO))
+ /* ARBITRATION not won */
+ aha152x_done(shpnt, DID_BUS_BUSY << 16);
+ else
+ /* ARBITRATION won, but SELECTION failed */
+ aha152x_done(shpnt, DID_NO_CONNECT << 16);
+
+ return;
+ }
+ }
+ /* enable interrupt, when target leaves current phase */
+ phase = getphase(shpnt);
+ if (!(phase & ~P_MASK)) /* "real" phase */
+ SETPORT(SCSISIG, phase);
+ SETPORT(SSTAT1, CLRPHASECHG);
+ CURRENT_SC->SCp.phase =
+ (CURRENT_SC->SCp.phase & ~((P_MASK | 1) << 16)) | (phase << 16);
+
+ /* information transfer phase */
+ switch (phase) {
+ case P_MSGO: /* MESSAGE OUT */
+ {
+ int i, identify = 0, abort = 0;
#if defined(DEBUG_INTR) || defined(DEBUG_MSGO) || defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & (debug_intr|debug_msgo|debug_phases))
- printk("MESSAGE OUT, ");
+ if (HOSTDATA(shpnt)->debug & (debug_intr | debug_msgo | debug_phases))
+ printk("MESSAGE OUT, ");
#endif
- if(MSGLEN==0) {
- ADDMSG(MESSAGE_REJECT);
+ if (MSGLEN == 0) {
+ ADDMSG(MESSAGE_REJECT);
#if defined(DEBUG_MSGO)
- if(HOSTDATA(shpnt)->debug & debug_msgo)
- printk("unexpected MESSAGE OUT phase; rejecting, ");
-#endif
- }
-
- CLRBITS(SXFRCTL0, ENDMA);
-
- SETPORT(SIMODE0, 0);
- SETPORT(SIMODE1, ENPHASEMIS|ENREQINIT|ENBUSFREE);
-
- /* wait for data latch to become ready or a phase change */
- while(TESTLO(DMASTAT, INTSTAT))
- barrier();
-
+ if (HOSTDATA(shpnt)->debug & debug_msgo)
+ printk("unexpected MESSAGE OUT phase; rejecting, ");
+#endif
+ }
+ CLRBITS(SXFRCTL0, ENDMA);
+
+ SETPORT(SIMODE0, 0);
+ SETPORT(SIMODE1, ENPHASEMIS | ENREQINIT | ENBUSFREE);
+
+ /* wait for data latch to become ready or a phase change */
+ while (TESTLO(DMASTAT, INTSTAT))
+ barrier();
+
#if defined(DEBUG_MSGO)
- if(HOSTDATA(shpnt)->debug & debug_msgo) {
- int i;
-
- printk("messages (");
- for(i=0; i<MSGLEN; i+=print_msg(&MSG(i)), printk(" "))
- ;
- printk("), ");
- }
-#endif
-
- for(i=0; i<MSGLEN && TESTLO(SSTAT1, PHASEMIS); i++) {
+ if (HOSTDATA(shpnt)->debug & debug_msgo) {
+ int i;
+
+ printk("messages (");
+ for (i = 0; i < MSGLEN; i += print_msg(&MSG(i)), printk(" "));
+ printk("), ");
+ }
+#endif
+
+ for (i = 0; i < MSGLEN && TESTLO(SSTAT1, PHASEMIS); i++) {
#if defined(DEBUG_MSGO)
- if(HOSTDATA(shpnt)->debug & debug_msgo)
- printk("%x ", MSG(i));
+ if (HOSTDATA(shpnt)->debug & debug_msgo)
+ printk("%x ", MSG(i));
#endif
- if(i==MSGLEN-1) {
- /* Leave MESSAGE OUT after transfer */
- SETPORT(SSTAT1, CLRATNO);
- }
-
- SETPORT(SCSIDAT, MSG(i));
+ if (i == MSGLEN - 1) {
+ /* Leave MESSAGE OUT after transfer */
+ SETPORT(SSTAT1, CLRATNO);
+ }
+ SETPORT(SCSIDAT, MSG(i));
- make_acklow(shpnt);
- getphase(shpnt);
+ make_acklow(shpnt);
+ getphase(shpnt);
- if(MSG(i)==IDENTIFY(HOSTDATA(shpnt)->reconnect,CURRENT_SC->lun))
- identify++;
+ if (MSG(i) == IDENTIFY(HOSTDATA(shpnt)->reconnect, CURRENT_SC->lun))
+ identify++;
- if(MSG(i)==ABORT)
- abort++;
+ if (MSG(i) == ABORT)
+ abort++;
- }
+ }
- MSGLEN=0;
+ MSGLEN = 0;
- if(identify)
- CURRENT_SC->SCp.phase |= sent_ident;
+ if (identify)
+ CURRENT_SC->SCp.phase |= sent_ident;
- if(abort) {
- /* revive abort(); abort() enables interrupts */
- HOSTDATA(shpnt)->abort_result=SCSI_ABORT_SUCCESS;
- HOSTDATA(shpnt)->abortion_complete++;
+ if (abort) {
+ /* revive abort(); abort() enables interrupts */
+ HOSTDATA(shpnt)->abort_result = SCSI_ABORT_SUCCESS;
+ HOSTDATA(shpnt)->abortion_complete++;
- CURRENT_SC->SCp.phase &= ~(P_MASK<<16);
+ CURRENT_SC->SCp.phase &= ~(P_MASK << 16);
- /* exit */
- SETBITS(DMACNTRL0, INTEN);
+ /* exit */
+ SETBITS(DMACNTRL0, INTEN);
#if defined(DEBUG_RACE)
- leave_driver("(ABORT) intr");
+ leave_driver("(ABORT) intr");
#endif
- aha152x_done(shpnt, DID_ABORT<<16);
+ aha152x_done(shpnt, DID_ABORT << 16);
- return;
- }
- }
- break;
+ return;
+ }
+ }
+ break;
- case P_CMD: /* COMMAND phase */
+ case P_CMD: /* COMMAND phase */
#if defined(DEBUG_INTR) || defined(DEBUG_CMD) || defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & (debug_intr|debug_cmd|debug_phases))
- printk("COMMAND, ");
-#endif
- if(!(CURRENT_SC->SCp.sent_command)) {
- int i;
-
- CLRBITS(SXFRCTL0, ENDMA);
-
- SETPORT(SIMODE0, 0);
- SETPORT(SIMODE1, ENPHASEMIS|ENREQINIT|ENBUSFREE);
-
- /* wait for data latch to become ready or a phase change */
- while(TESTLO(DMASTAT, INTSTAT))
- barrier();
-
- for(i=0; i<CURRENT_SC->cmd_len && TESTLO(SSTAT1, PHASEMIS); i++) {
- SETPORT(SCSIDAT, CURRENT_SC->cmnd[i]);
-
- make_acklow(shpnt);
- getphase(shpnt);
- }
-
- if(i<CURRENT_SC->cmd_len && TESTHI(SSTAT1, PHASEMIS))
- aha152x_panic(shpnt, "target left COMMAND");
-
- CURRENT_SC->SCp.sent_command++;
- } else
- aha152x_panic(shpnt, "Nothing to send while in COMMAND");
- break;
-
- case P_MSGI: /* MESSAGE IN phase */
- {
- int start_sync=0;
-
+ if (HOSTDATA(shpnt)->debug & (debug_intr | debug_cmd | debug_phases))
+ printk("COMMAND, ");
+#endif
+ if (!(CURRENT_SC->SCp.sent_command)) {
+ int i;
+
+ CLRBITS(SXFRCTL0, ENDMA);
+
+ SETPORT(SIMODE0, 0);
+ SETPORT(SIMODE1, ENPHASEMIS | ENREQINIT | ENBUSFREE);
+
+ /* wait for data latch to become ready or a phase change */
+ while (TESTLO(DMASTAT, INTSTAT))
+ barrier();
+
+ for (i = 0; i < CURRENT_SC->cmd_len && TESTLO(SSTAT1, PHASEMIS); i++) {
+ SETPORT(SCSIDAT, CURRENT_SC->cmnd[i]);
+
+ make_acklow(shpnt);
+ getphase(shpnt);
+ }
+
+ if (i < CURRENT_SC->cmd_len && TESTHI(SSTAT1, PHASEMIS))
+ aha152x_panic(shpnt, "target left COMMAND");
+
+ CURRENT_SC->SCp.sent_command++;
+ } else
+ aha152x_panic(shpnt, "Nothing to send while in COMMAND");
+ break;
+
+ case P_MSGI: /* MESSAGE IN phase */
+ {
+ int start_sync = 0;
+
#if defined(DEBUG_INTR) || defined(DEBUG_MSGI) || defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & (debug_intr|debug_msgi|debug_phases))
- printk("MESSAGE IN, ");
-#endif
- SETPORT(SXFRCTL0, CH1);
-
- SETPORT(SIMODE0, 0);
- SETPORT(SIMODE1, ENBUSFREE);
-
- while(phase == P_MSGI) {
- CURRENT_SC->SCp.Message = GETPORT(SCSIDAT);
- switch(CURRENT_SC->SCp.Message) {
- case DISCONNECT:
+ if (HOSTDATA(shpnt)->debug & (debug_intr | debug_msgi | debug_phases))
+ printk("MESSAGE IN, ");
+#endif
+ SETPORT(SXFRCTL0, CH1);
+
+ SETPORT(SIMODE0, 0);
+ SETPORT(SIMODE1, ENBUSFREE);
+
+ while (phase == P_MSGI) {
+ CURRENT_SC->SCp.Message = GETPORT(SCSIDAT);
+ switch (CURRENT_SC->SCp.Message) {
+ case DISCONNECT:
#if defined(DEBUG_MSGI) || defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & (debug_msgi|debug_phases))
- printk("target disconnected, ");
+ if (HOSTDATA(shpnt)->debug & (debug_msgi | debug_phases))
+ printk("target disconnected, ");
#endif
- CURRENT_SC->SCp.Message = 0;
- CURRENT_SC->SCp.phase |= disconnected;
- if(!HOSTDATA(shpnt)->reconnect)
- aha152x_panic(shpnt, "target was not allowed to disconnect");
+ CURRENT_SC->SCp.Message = 0;
+ CURRENT_SC->SCp.phase |= disconnected;
+ if (!HOSTDATA(shpnt)->reconnect)
+ aha152x_panic(shpnt, "target was not allowed to disconnect");
+
+ break;
- break;
-
- case COMMAND_COMPLETE:
+ case COMMAND_COMPLETE:
#if defined(DEBUG_MSGI) || defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & (debug_msgi|debug_phases))
- printk("inbound message (COMMAND COMPLETE), ");
-#endif
- done++;
- break;
-
- case MESSAGE_REJECT:
- if(CURRENT_SC->SCp.phase & in_sync) {
- CURRENT_SC->SCp.phase &= ~in_sync;
- SYNCRATE=0x80;
- printk("synchronous rejected, ");
- } else
- printk("inbound message (MESSAGE REJECT), ");
+ if (HOSTDATA(shpnt)->debug & (debug_msgi | debug_phases))
+ printk("inbound message (COMMAND COMPLETE), ");
+#endif
+ done++;
+ break;
+
+ case MESSAGE_REJECT:
+ if (CURRENT_SC->SCp.phase & in_sync) {
+ CURRENT_SC->SCp.phase &= ~in_sync;
+ SYNCRATE = 0x80;
+ printk("synchronous rejected, ");
+ } else
+ printk("inbound message (MESSAGE REJECT), ");
#if defined(DEBUG_MSGI)
- if(HOSTDATA(shpnt)->debug & debug_msgi)
- printk("inbound message (MESSAGE REJECT), ");
+ if (HOSTDATA(shpnt)->debug & debug_msgi)
+ printk("inbound message (MESSAGE REJECT), ");
#endif
- break;
+ break;
- case SAVE_POINTERS:
+ case SAVE_POINTERS:
#if defined(DEBUG_MSGI)
- if(HOSTDATA(shpnt)->debug & debug_msgi)
- printk("inbound message (SAVE DATA POINTERS), ");
+ if (HOSTDATA(shpnt)->debug & debug_msgi)
+ printk("inbound message (SAVE DATA POINTERS), ");
#endif
- break;
+ break;
- case RESTORE_POINTERS:
+ case RESTORE_POINTERS:
#if defined(DEBUG_MSGI)
- if(HOSTDATA(shpnt)->debug & debug_msgi)
- printk("inbound message (RESTORE DATA POINTERS), ");
+ if (HOSTDATA(shpnt)->debug & debug_msgi)
+ printk("inbound message (RESTORE DATA POINTERS), ");
#endif
- break;
+ break;
- case EXTENDED_MESSAGE:
- {
- char buffer[16];
- int i;
+ case EXTENDED_MESSAGE:
+ {
+ char buffer[16];
+ int i;
#if defined(DEBUG_MSGI)
- if(HOSTDATA(shpnt)->debug & debug_msgi)
- printk("inbound message (EXTENDED MESSAGE), ");
+ if (HOSTDATA(shpnt)->debug & debug_msgi)
+ printk("inbound message (EXTENDED MESSAGE), ");
#endif
- make_acklow(shpnt);
- if(getphase(shpnt)!=P_MSGI)
- break;
-
- buffer[0]=EXTENDED_MESSAGE;
- buffer[1]=GETPORT(SCSIDAT);
+ make_acklow(shpnt);
+ if (getphase(shpnt) != P_MSGI)
+ break;
- for(i=0; i<buffer[1] &&
- (make_acklow(shpnt), getphase(shpnt)==P_MSGI); i++)
- buffer[2+i]=GETPORT(SCSIDAT);
+ buffer[0] = EXTENDED_MESSAGE;
+ buffer[1] = GETPORT(SCSIDAT);
+
+ for (i = 0; i < buffer[1] &&
+ (make_acklow(shpnt), getphase(shpnt) == P_MSGI); i++)
+ buffer[2 + i] = GETPORT(SCSIDAT);
#if defined(DEBUG_MSGI)
- if(HOSTDATA(shpnt)->debug & debug_msgi)
- print_msg(buffer);
-#endif
-
- switch(buffer [2]) {
- case EXTENDED_SDTR:
- {
- long ticks;
-
- if(buffer[1]!=3)
- aha152x_panic(shpnt, "SDTR message length != 3");
-
- if(!HOSTDATA(shpnt)->synchronous)
- break;
-
- printk("inbound SDTR: "); print_msg(buffer);
-
- ticks=(buffer[3]*4+49)/50;
-
- if(CURRENT_SC->SCp.phase & in_sync) {
- /* we initiated SDTR */
- if(ticks>9 || buffer[4]<1 || buffer[4]>8)
- aha152x_panic(shpnt, "received SDTR invalid");
-
- SYNCRATE |= ((ticks-2)<<4) + buffer[4];
- } else if(ticks<=9 && buffer[4]>=1) {
- if(buffer[4]>8)
- buffer[4]=8;
-
- ADDMSG(EXTENDED_MESSAGE);
- ADDMSG(3);
- ADDMSG(EXTENDED_SDTR);
- if(ticks<4) {
- ticks=4;
- ADDMSG(50);
- } else
- ADDMSG(buffer[3]);
-
- ADDMSG(buffer[4]);
-
- printk("outbound SDTR: ");
- print_msg(&MSG(MSGLEN-5));
-
- CURRENT_SC->SCp.phase |= in_sync;
-
- SYNCRATE |= ((ticks-2)<<4) + buffer[4];
-
- start_sync++;
- } else {
- /* requested SDTR is too slow, do it asynchronously */
- ADDMSG(MESSAGE_REJECT);
- SYNCRATE = 0;
- }
-
- SETPORT(SCSIRATE, SYNCRATE&0x7f);
- }
- break;
-
- case EXTENDED_MODIFY_DATA_POINTER:
- case EXTENDED_EXTENDED_IDENTIFY:
- case EXTENDED_WDTR:
- default:
- ADDMSG(MESSAGE_REJECT);
- break;
- }
- }
- break;
-
- default:
- printk("unsupported inbound message %x, ", CURRENT_SC->SCp.Message);
- break;
-
- }
-
- make_acklow(shpnt);
- phase=getphase(shpnt);
- }
-
- if(start_sync)
- CURRENT_SC->SCp.phase |= in_sync;
- else
- CURRENT_SC->SCp.phase &= ~in_sync;
-
- if(MSGLEN>0)
- SETPORT(SCSISIG, P_MSGI|ATNO);
-
- /* clear SCSI fifo on BUSFREE */
- if(phase==P_BUSFREE)
- SETPORT(SXFRCTL0, CH1|CLRCH1);
-
- if(CURRENT_SC->SCp.phase & disconnected) {
- save_flags(flags);
- cli();
+ if (HOSTDATA(shpnt)->debug & debug_msgi)
+ print_msg(buffer);
+#endif
+
+ switch (buffer[2]) {
+ case EXTENDED_SDTR:
+ {
+ long ticks;
+
+ if (buffer[1] != 3)
+ aha152x_panic(shpnt, "SDTR message length != 3");
+
+ if (!HOSTDATA(shpnt)->synchronous)
+ break;
+
+ printk("inbound SDTR: ");
+ print_msg(buffer);
+
+ ticks = (buffer[3] * 4 + 49) / 50;
+
+ if (CURRENT_SC->SCp.phase & in_sync) {
+ /* we initiated SDTR */
+ if (ticks > 9 || buffer[4] < 1 || buffer[4] > 8)
+ aha152x_panic(shpnt, "received SDTR invalid");
+
+ SYNCRATE |= ((ticks - 2) << 4) + buffer[4];
+ } else if (ticks <= 9 && buffer[4] >= 1) {
+ if (buffer[4] > 8)
+ buffer[4] = 8;
+
+ ADDMSG(EXTENDED_MESSAGE);
+ ADDMSG(3);
+ ADDMSG(EXTENDED_SDTR);
+ if (ticks < 4) {
+ ticks = 4;
+ ADDMSG(50);
+ } else
+ ADDMSG(buffer[3]);
+
+ ADDMSG(buffer[4]);
+
+ printk("outbound SDTR: ");
+ print_msg(&MSG(MSGLEN - 5));
+
+ CURRENT_SC->SCp.phase |= in_sync;
+
+ SYNCRATE |= ((ticks - 2) << 4) + buffer[4];
+
+ start_sync++;
+ } else {
+ /* requested SDTR is too slow, do it asynchronously */
+ ADDMSG(MESSAGE_REJECT);
+ SYNCRATE = 0;
+ }
+
+ SETPORT(SCSIRATE, SYNCRATE & 0x7f);
+ }
+ break;
+
+ case EXTENDED_MODIFY_DATA_POINTER:
+ case EXTENDED_EXTENDED_IDENTIFY:
+ case EXTENDED_WDTR:
+ default:
+ ADDMSG(MESSAGE_REJECT);
+ break;
+ }
+ }
+ break;
+
+ default:
+ printk("unsupported inbound message %x, ", CURRENT_SC->SCp.Message);
+ break;
+
+ }
+
+ make_acklow(shpnt);
+ phase = getphase(shpnt);
+ }
+
+ if (start_sync)
+ CURRENT_SC->SCp.phase |= in_sync;
+ else
+ CURRENT_SC->SCp.phase &= ~in_sync;
+
+ if (MSGLEN > 0)
+ SETPORT(SCSISIG, P_MSGI | ATNO);
+
+ /* clear SCSI fifo on BUSFREE */
+ if (phase == P_BUSFREE)
+ SETPORT(SXFRCTL0, CH1 | CLRCH1);
+
+ if (CURRENT_SC->SCp.phase & disconnected) {
+ save_flags(flags);
+ cli();
#if defined(DEBUG_QUEUES)
- if(HOSTDATA(shpnt)->debug & debug_queues)
- printk("d+, ");
+ if (HOSTDATA(shpnt)->debug & debug_queues)
+ printk("d+, ");
#endif
- append_SC(&DISCONNECTED_SC, CURRENT_SC);
- CURRENT_SC->SCp.phase |= 1<<16;
- CURRENT_SC = NULL;
- restore_flags(flags);
+ append_SC(&DISCONNECTED_SC, CURRENT_SC);
+ CURRENT_SC->SCp.phase |= 1 << 16;
+ CURRENT_SC = NULL;
+ restore_flags(flags);
- SETBITS(SCSISEQ, ENRESELI);
+ SETBITS(SCSISEQ, ENRESELI);
- SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
- SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
+ SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
+ SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
- SETBITS(DMACNTRL0, INTEN);
+ SETBITS(DMACNTRL0, INTEN);
- return;
- }
- }
- break;
+ return;
+ }
+ }
+ break;
- case P_STATUS: /* STATUS IN phase */
+ case P_STATUS: /* STATUS IN phase */
#if defined(DEBUG_STATUS) || defined(DEBUG_INTR) || defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & (debug_status|debug_intr|debug_phases))
- printk("STATUS, ");
+ if (HOSTDATA(shpnt)->debug & (debug_status | debug_intr | debug_phases))
+ printk("STATUS, ");
#endif
- SETPORT(SXFRCTL0, CH1);
+ SETPORT(SXFRCTL0, CH1);
+
+ SETPORT(SIMODE0, 0);
+ SETPORT(SIMODE1, ENREQINIT | ENBUSFREE);
- SETPORT(SIMODE0, 0);
- SETPORT(SIMODE1, ENREQINIT|ENBUSFREE);
+ if (TESTHI(SSTAT1, PHASEMIS))
+ printk("aha152x: passing STATUS phase");
- if(TESTHI(SSTAT1, PHASEMIS))
- printk("aha152x: passing STATUS phase");
-
- CURRENT_SC->SCp.Status = GETPORT(SCSIBUS);
- make_acklow(shpnt);
- getphase(shpnt);
+ CURRENT_SC->SCp.Status = GETPORT(SCSIBUS);
+ make_acklow(shpnt);
+ getphase(shpnt);
#if defined(DEBUG_STATUS)
- if(HOSTDATA(shpnt)->debug & debug_status) {
- printk("inbound status ");
- print_status(CURRENT_SC->SCp.Status);
- printk(", ");
- }
+ if (HOSTDATA(shpnt)->debug & debug_status) {
+ printk("inbound status ");
+ print_status(CURRENT_SC->SCp.Status);
+ printk(", ");
+ }
#endif
- break;
+ break;
- case P_DATAI: /* DATA IN phase */
- {
- int fifodata, data_count, done;
+ case P_DATAI: /* DATA IN phase */
+ {
+ int fifodata, data_count, done;
#if defined(DEBUG_DATAI) || defined(DEBUG_INTR) || defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & (debug_datai|debug_intr|debug_phases))
- printk("DATA IN, ");
+ if (HOSTDATA(shpnt)->debug & (debug_datai | debug_intr | debug_phases))
+ printk("DATA IN, ");
#endif
#if 0
- if(GETPORT(FIFOSTAT) || GETPORT(SSTAT2) & (SFULL|SFCNT))
- printk("aha152x: P_DATAI: %d(%d) bytes left in FIFO, resetting\n",
- GETPORT(FIFOSTAT), GETPORT(SSTAT2) & (SFULL|SFCNT));
+ if (GETPORT(FIFOSTAT) || GETPORT(SSTAT2) & (SFULL | SFCNT))
+ printk("aha152x: P_DATAI: %d(%d) bytes left in FIFO, resetting\n",
+ GETPORT(FIFOSTAT), GETPORT(SSTAT2) & (SFULL | SFCNT));
#endif
- /* reset host fifo */
- SETPORT(DMACNTRL0, RSTFIFO);
- SETPORT(DMACNTRL0, RSTFIFO|ENDMA);
+ /* reset host fifo */
+ SETPORT(DMACNTRL0, RSTFIFO);
+ SETPORT(DMACNTRL0, RSTFIFO | ENDMA);
- SETPORT(SXFRCTL0, CH1|SCSIEN|DMAEN);
+ SETPORT(SXFRCTL0, CH1 | SCSIEN | DMAEN);
- SETPORT(SIMODE0, 0);
- SETPORT(SIMODE1, ENPHASEMIS|ENBUSFREE);
+ SETPORT(SIMODE0, 0);
+ SETPORT(SIMODE1, ENPHASEMIS | ENBUSFREE);
- /* done is set when the FIFO is empty after the target left DATA IN */
- done=0;
-
- /* while the target stays in DATA to transfer data */
- while (!done) {
+ /* done is set when the FIFO is empty after the target left DATA IN */
+ done = 0;
+
+ /* while the target stays in DATA to transfer data */
+ while (!done) {
#if defined(DEBUG_DATAI)
- if(HOSTDATA(shpnt)->debug & debug_datai)
- printk("expecting data, ");
+ if (HOSTDATA(shpnt)->debug & debug_datai)
+ printk("expecting data, ");
#endif
- /* wait for PHASEMIS or full FIFO */
- while(TESTLO(DMASTAT, DFIFOFULL|INTSTAT))
- barrier();
+ /* wait for PHASEMIS or full FIFO */
+ while (TESTLO(DMASTAT, DFIFOFULL | INTSTAT))
+ barrier();
#if defined(DEBUG_DATAI)
- if(HOSTDATA(shpnt)->debug & debug_datai)
- printk("ok, ");
-#endif
-
- if(TESTHI(DMASTAT, DFIFOFULL))
- fifodata=GETPORT(FIFOSTAT);
- else {
- /* wait for SCSI fifo to get empty */
- while(TESTLO(SSTAT2, SEMPTY))
- barrier();
-
- /* rest of data in FIFO */
- fifodata=GETPORT(FIFOSTAT);
+ if (HOSTDATA(shpnt)->debug & debug_datai)
+ printk("ok, ");
+#endif
+
+ if (TESTHI(DMASTAT, DFIFOFULL))
+ fifodata = GETPORT(FIFOSTAT);
+ else {
+ /* wait for SCSI fifo to get empty */
+ while (TESTLO(SSTAT2, SEMPTY))
+ barrier();
+
+ /* rest of data in FIFO */
+ fifodata = GETPORT(FIFOSTAT);
#if defined(DEBUG_DATAI)
- if(HOSTDATA(shpnt)->debug & debug_datai)
- printk("last transfer, ");
+ if (HOSTDATA(shpnt)->debug & debug_datai)
+ printk("last transfer, ");
#endif
- done=1;
- }
-
+ done = 1;
+ }
+
#if defined(DEBUG_DATAI)
- if(HOSTDATA(shpnt)->debug & debug_datai)
- printk("fifodata=%d, ", fifodata);
+ if (HOSTDATA(shpnt)->debug & debug_datai)
+ printk("fifodata=%d, ", fifodata);
#endif
- while(fifodata && CURRENT_SC->SCp.this_residual) {
- data_count=fifodata;
-
- /* limit data transfer to size of first sg buffer */
- if(data_count > CURRENT_SC->SCp.this_residual)
- data_count = CURRENT_SC->SCp.this_residual;
-
- fifodata -= data_count;
+ while (fifodata && CURRENT_SC->SCp.this_residual) {
+ data_count = fifodata;
+
+ /* limit data transfer to size of first sg buffer */
+ if (data_count > CURRENT_SC->SCp.this_residual)
+ data_count = CURRENT_SC->SCp.this_residual;
+
+ fifodata -= data_count;
#if defined(DEBUG_DATAI)
- if(HOSTDATA(shpnt)->debug & debug_datai)
- printk("data_count=%d, ", data_count);
-#endif
-
- if(data_count&1) {
- /* get a single byte in byte mode */
- SETBITS(DMACNTRL0, _8BIT);
- *CURRENT_SC->SCp.ptr++ = GETPORT(DATAPORT);
- CURRENT_SC->SCp.this_residual--;
- }
-
- if(data_count>1) {
- CLRBITS(DMACNTRL0, _8BIT);
- data_count >>= 1; /* Number of words */
- insw(DATAPORT, CURRENT_SC->SCp.ptr, data_count);
+ if (HOSTDATA(shpnt)->debug & debug_datai)
+ printk("data_count=%d, ", data_count);
+#endif
+
+ if (data_count & 1) {
+ /* get a single byte in byte mode */
+ SETBITS(DMACNTRL0, _8BIT);
+ *CURRENT_SC->SCp.ptr++ = GETPORT(DATAPORT);
+ CURRENT_SC->SCp.this_residual--;
+ }
+ if (data_count > 1) {
+ CLRBITS(DMACNTRL0, _8BIT);
+ data_count >>= 1; /* Number of words */
+ insw(DATAPORT, CURRENT_SC->SCp.ptr, data_count);
#if defined(DEBUG_DATAI)
- if(HOSTDATA(shpnt)->debug & debug_datai)
- /* show what comes with the last transfer */
- if(done) {
+ if (HOSTDATA(shpnt)->debug & debug_datai)
+ /* show what comes with the last transfer */
+ if (done) {
#if 0
- int i;
- unsigned char *data;
+ int i;
+ unsigned char *data;
#endif
-
- printk("data on last transfer (%d bytes) ",
- 2*data_count);
-#if 0
- printk("data on last transfer (%d bytes: ",
- 2*data_count);
- data = (unsigned char *) CURRENT_SC->SCp.ptr;
- for(i=0; i<2*data_count; i++)
- printk("%2x ", *data++);
- printk("), ");
-#endif
- }
-#endif
- CURRENT_SC->SCp.ptr += 2 * data_count;
- CURRENT_SC->SCp.this_residual -= 2 * data_count;
- }
-
- /* if this buffer is full and there are more buffers left */
- if(!CURRENT_SC->SCp.this_residual &&
- CURRENT_SC->SCp.buffers_residual) {
- /* advance to next buffer */
- CURRENT_SC->SCp.buffers_residual--;
- CURRENT_SC->SCp.buffer++;
- CURRENT_SC->SCp.ptr = CURRENT_SC->SCp.buffer->address;
- CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length;
- }
- }
-
- /*
- * FIFO should be empty
- */
- if(fifodata>0) {
- printk("aha152x: more data than expected (%d bytes)\n",
- GETPORT(FIFOSTAT));
- SETBITS(DMACNTRL0, _8BIT);
- printk("aha152x: data (");
- while(fifodata--)
- printk("%2x ", GETPORT(DATAPORT));
- printk(")\n");
- }
+ printk("data on last transfer (%d bytes) ",
+ 2 * data_count);
+#if 0
+ printk("data on last transfer (%d bytes: ",
+ 2 * data_count);
+ data = (unsigned char *) CURRENT_SC->SCp.ptr;
+ for (i = 0; i < 2 * data_count; i++)
+ printk("%2x ", *data++);
+ printk("), ");
+#endif
+ }
+#endif
+ CURRENT_SC->SCp.ptr += 2 * data_count;
+ CURRENT_SC->SCp.this_residual -= 2 * data_count;
+ }
+ /* if this buffer is full and there are more buffers left */
+ if (!CURRENT_SC->SCp.this_residual &&
+ CURRENT_SC->SCp.buffers_residual) {
+ /* advance to next buffer */
+ CURRENT_SC->SCp.buffers_residual--;
+ CURRENT_SC->SCp.buffer++;
+ CURRENT_SC->SCp.ptr = CURRENT_SC->SCp.buffer->address;
+ CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length;
+ }
+ }
+
+ /*
+ * FIFO should be empty
+ */
+ if (fifodata > 0) {
+ printk("aha152x: more data than expected (%d bytes)\n",
+ GETPORT(FIFOSTAT));
+ SETBITS(DMACNTRL0, _8BIT);
+ printk("aha152x: data (");
+ while (fifodata--)
+ printk("%2x ", GETPORT(DATAPORT));
+ printk(")\n");
+ }
#if defined(DEBUG_DATAI)
- if(HOSTDATA(shpnt)->debug & debug_datai)
- if(!fifodata)
- printk("fifo empty, ");
- else
- printk("something left in fifo, ");
+ if (HOSTDATA(shpnt)->debug & debug_datai)
+ if (!fifodata)
+ printk("fifo empty, ");
+ else
+ printk("something left in fifo, ");
#endif
- }
+ }
#if defined(DEBUG_DATAI)
- if((HOSTDATA(shpnt)->debug & debug_datai) &&
- (CURRENT_SC->SCp.buffers_residual ||
- CURRENT_SC->SCp.this_residual))
- printk("left buffers (buffers=%d, bytes=%d), ",
- CURRENT_SC->SCp.buffers_residual, CURRENT_SC->SCp.this_residual);
-#endif
- /* transfer can be considered ended, when SCSIEN reads back zero */
- CLRBITS(SXFRCTL0, SCSIEN|DMAEN);
- while(TESTHI(SXFRCTL0, SCSIEN))
- barrier();
- CLRBITS(DMACNTRL0, ENDMA);
+ if ((HOSTDATA(shpnt)->debug & debug_datai) &&
+ (CURRENT_SC->SCp.buffers_residual ||
+ CURRENT_SC->SCp.this_residual))
+ printk("left buffers (buffers=%d, bytes=%d), ",
+ CURRENT_SC->SCp.buffers_residual, CURRENT_SC->SCp.this_residual);
+#endif
+ /* transfer can be considered ended, when SCSIEN reads back zero */
+ CLRBITS(SXFRCTL0, SCSIEN | DMAEN);
+ while (TESTHI(SXFRCTL0, SCSIEN))
+ barrier();
+ CLRBITS(DMACNTRL0, ENDMA);
#if defined(DEBUG_DATAI) || defined(DEBUG_INTR)
- if(HOSTDATA(shpnt)->debug & (debug_datai|debug_intr))
- printk("got %d bytes, ", GETSTCNT());
+ if (HOSTDATA(shpnt)->debug & (debug_datai | debug_intr))
+ printk("got %d bytes, ", GETSTCNT());
#endif
- CURRENT_SC->SCp.have_data_in++;
- }
- break;
+ CURRENT_SC->SCp.have_data_in++;
+ }
+ break;
- case P_DATAO: /* DATA OUT phase */
- {
- int data_count;
+ case P_DATAO: /* DATA OUT phase */
+ {
+ int data_count;
#if defined(DEBUG_DATAO) || defined(DEBUG_INTR) || defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & (debug_datao|debug_intr|debug_phases))
- printk("DATA OUT, ");
+ if (HOSTDATA(shpnt)->debug & (debug_datao | debug_intr | debug_phases))
+ printk("DATA OUT, ");
#endif
#if defined(DEBUG_DATAO)
- if(HOSTDATA(shpnt)->debug & debug_datao)
- printk("got data to send (bytes=%d, buffers=%d), ",
- CURRENT_SC->SCp.this_residual,
- CURRENT_SC->SCp.buffers_residual);
-#endif
-
- if(GETPORT(FIFOSTAT) || GETPORT(SSTAT2) & (SFULL|SFCNT)) {
- printk("%d(%d) left in FIFO, ",
- GETPORT(FIFOSTAT), GETPORT(SSTAT2) & (SFULL|SFCNT));
- aha152x_panic(shpnt, "FIFO should be empty");
- }
-
- SETPORT(SXFRCTL0, CH1|CLRSTCNT|CLRCH1);
- SETPORT(SXFRCTL0, SCSIEN|DMAEN|CH1);
-
- SETPORT(DMACNTRL0, WRITE_READ|RSTFIFO);
- SETPORT(DMACNTRL0, ENDMA|WRITE_READ);
-
- SETPORT(SIMODE0, 0);
- SETPORT(SIMODE1, ENPHASEMIS|ENBUSFREE);
-
- /* while current buffer is not empty or
- there are more buffers to transfer */
- while(TESTLO(SSTAT1, PHASEMIS) &&
- (CURRENT_SC->SCp.this_residual ||
- CURRENT_SC->SCp.buffers_residual)) {
+ if (HOSTDATA(shpnt)->debug & debug_datao)
+ printk("got data to send (bytes=%d, buffers=%d), ",
+ CURRENT_SC->SCp.this_residual,
+ CURRENT_SC->SCp.buffers_residual);
+#endif
+
+ if (GETPORT(FIFOSTAT) || GETPORT(SSTAT2) & (SFULL | SFCNT)) {
+ printk("%d(%d) left in FIFO, ",
+ GETPORT(FIFOSTAT), GETPORT(SSTAT2) & (SFULL | SFCNT));
+ aha152x_panic(shpnt, "FIFO should be empty");
+ }
+ SETPORT(SXFRCTL0, CH1 | CLRSTCNT | CLRCH1);
+ SETPORT(SXFRCTL0, SCSIEN | DMAEN | CH1);
+
+ SETPORT(DMACNTRL0, WRITE_READ | RSTFIFO);
+ SETPORT(DMACNTRL0, ENDMA | WRITE_READ);
+
+ SETPORT(SIMODE0, 0);
+ SETPORT(SIMODE1, ENPHASEMIS | ENBUSFREE);
+
+ /* while current buffer is not empty or
+ there are more buffers to transfer */
+ while (TESTLO(SSTAT1, PHASEMIS) &&
+ (CURRENT_SC->SCp.this_residual ||
+ CURRENT_SC->SCp.buffers_residual)) {
#if defined(DEBUG_DATAO)
- if(HOSTDATA(shpnt)->debug & debug_datao)
- printk("sending data (left: bytes=%d, buffers=%d), waiting, ",
- CURRENT_SC->SCp.this_residual,
- CURRENT_SC->SCp.buffers_residual);
+ if (HOSTDATA(shpnt)->debug & debug_datao)
+ printk("sending data (left: bytes=%d, buffers=%d), waiting, ",
+ CURRENT_SC->SCp.this_residual,
+ CURRENT_SC->SCp.buffers_residual);
#endif
- /* transfer rest of buffer, but max. 128 byte */
- data_count =
- CURRENT_SC->SCp.this_residual > 128 ?
- 128 : CURRENT_SC->SCp.this_residual ;
+ /* transfer rest of buffer, but max. 128 byte */
+ data_count =
+ CURRENT_SC->SCp.this_residual > 128 ?
+ 128 : CURRENT_SC->SCp.this_residual;
#if defined(DEBUG_DATAO)
- if(HOSTDATA(shpnt)->debug & debug_datao)
- printk("data_count=%d, ", data_count);
-#endif
-
- if(data_count&1) {
- /* put a single byte in byte mode */
- SETBITS(DMACNTRL0, _8BIT);
- SETPORT(DATAPORT, *CURRENT_SC->SCp.ptr++);
- CURRENT_SC->SCp.this_residual--;
- }
- if(data_count>1) {
- CLRBITS(DMACNTRL0, _8BIT);
- data_count >>= 1; /* number of words */
- outsw(DATAPORT, CURRENT_SC->SCp.ptr, data_count);
- CURRENT_SC->SCp.ptr += 2 * data_count;
- CURRENT_SC->SCp.this_residual -= 2 * data_count;
- }
-
- /* wait for FIFO to get empty */
- while(TESTLO(DMASTAT, DFIFOEMP|INTSTAT))
- barrier();
+ if (HOSTDATA(shpnt)->debug & debug_datao)
+ printk("data_count=%d, ", data_count);
+#endif
+
+ if (data_count & 1) {
+ /* put a single byte in byte mode */
+ SETBITS(DMACNTRL0, _8BIT);
+ SETPORT(DATAPORT, *CURRENT_SC->SCp.ptr++);
+ CURRENT_SC->SCp.this_residual--;
+ }
+ if (data_count > 1) {
+ CLRBITS(DMACNTRL0, _8BIT);
+ data_count >>= 1; /* number of words */
+ outsw(DATAPORT, CURRENT_SC->SCp.ptr, data_count);
+ CURRENT_SC->SCp.ptr += 2 * data_count;
+ CURRENT_SC->SCp.this_residual -= 2 * data_count;
+ }
+ /* wait for FIFO to get empty */
+ while (TESTLO(DMASTAT, DFIFOEMP | INTSTAT))
+ barrier();
#if defined(DEBUG_DATAO)
- if(HOSTDATA(shpnt)->debug & debug_datao)
- printk("fifo (%d bytes), transfered (%d bytes), ",
- GETPORT(FIFOSTAT), GETSTCNT());
-#endif
-
- /* if this buffer is empty and there are more buffers left */
- if(TESTLO(SSTAT1, PHASEMIS) &&
- !CURRENT_SC->SCp.this_residual &&
- CURRENT_SC->SCp.buffers_residual) {
- /* advance to next buffer */
- CURRENT_SC->SCp.buffers_residual--;
- CURRENT_SC->SCp.buffer++;
- CURRENT_SC->SCp.ptr = CURRENT_SC->SCp.buffer->address;
- CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length;
- }
- }
-
- if(CURRENT_SC->SCp.this_residual || CURRENT_SC->SCp.buffers_residual) {
- /* target leaves DATA OUT for an other phase (perhaps disconnect) */
-
- /* data in fifos has to be resend */
- data_count = GETPORT(SSTAT2) & (SFULL|SFCNT);
-
- data_count += GETPORT(FIFOSTAT) ;
- CURRENT_SC->SCp.ptr -= data_count;
- CURRENT_SC->SCp.this_residual += data_count;
+ if (HOSTDATA(shpnt)->debug & debug_datao)
+ printk("fifo (%d bytes), transfered (%d bytes), ",
+ GETPORT(FIFOSTAT), GETSTCNT());
+#endif
+
+ /* if this buffer is empty and there are more buffers left */
+ if (TESTLO(SSTAT1, PHASEMIS) &&
+ !CURRENT_SC->SCp.this_residual &&
+ CURRENT_SC->SCp.buffers_residual) {
+ /* advance to next buffer */
+ CURRENT_SC->SCp.buffers_residual--;
+ CURRENT_SC->SCp.buffer++;
+ CURRENT_SC->SCp.ptr = CURRENT_SC->SCp.buffer->address;
+ CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length;
+ }
+ }
+
+ if (CURRENT_SC->SCp.this_residual || CURRENT_SC->SCp.buffers_residual) {
+ /* target leaves DATA OUT for an other phase (perhaps disconnect) */
+
+ /* data in fifos has to be resend */
+ data_count = GETPORT(SSTAT2) & (SFULL | SFCNT);
+
+ data_count += GETPORT(FIFOSTAT);
+ CURRENT_SC->SCp.ptr -= data_count;
+ CURRENT_SC->SCp.this_residual += data_count;
#if defined(DEBUG_DATAO)
- if(HOSTDATA(shpnt)->debug & debug_datao)
- printk("left data (bytes=%d, buffers=%d), fifos (bytes=%d), "
- "transfer incomplete, resetting fifo, ",
- CURRENT_SC->SCp.this_residual,
- CURRENT_SC->SCp.buffers_residual,
- data_count);
-#endif
- SETPORT(DMACNTRL0, WRITE_READ|RSTFIFO);
- CLRBITS(SXFRCTL0, SCSIEN|DMAEN);
- CLRBITS(DMACNTRL0, ENDMA);
- } else {
+ if (HOSTDATA(shpnt)->debug & debug_datao)
+ printk("left data (bytes=%d, buffers=%d), fifos (bytes=%d), "
+ "transfer incomplete, resetting fifo, ",
+ CURRENT_SC->SCp.this_residual,
+ CURRENT_SC->SCp.buffers_residual,
+ data_count);
+#endif
+ SETPORT(DMACNTRL0, WRITE_READ | RSTFIFO);
+ CLRBITS(SXFRCTL0, SCSIEN | DMAEN);
+ CLRBITS(DMACNTRL0, ENDMA);
+ } else {
#if defined(DEBUG_DATAO)
- if(HOSTDATA(shpnt)->debug & debug_datao)
- printk("waiting for SCSI fifo to get empty, ");
+ if (HOSTDATA(shpnt)->debug & debug_datao)
+ printk("waiting for SCSI fifo to get empty, ");
#endif
- /* wait for SCSI fifo to get empty */
- while(TESTLO(SSTAT2, SEMPTY))
- barrier();
+ /* wait for SCSI fifo to get empty */
+ while (TESTLO(SSTAT2, SEMPTY))
+ barrier();
#if defined(DEBUG_DATAO)
- if(HOSTDATA(shpnt)->debug & debug_datao)
- printk("ok, left data (bytes=%d, buffers=%d) ",
- CURRENT_SC->SCp.this_residual,
- CURRENT_SC->SCp.buffers_residual);
+ if (HOSTDATA(shpnt)->debug & debug_datao)
+ printk("ok, left data (bytes=%d, buffers=%d) ",
+ CURRENT_SC->SCp.this_residual,
+ CURRENT_SC->SCp.buffers_residual);
#endif
- CLRBITS(SXFRCTL0, SCSIEN|DMAEN);
+ CLRBITS(SXFRCTL0, SCSIEN | DMAEN);
- /* transfer can be considered ended, when SCSIEN reads back zero */
- while(TESTHI(SXFRCTL0, SCSIEN))
- barrier();
+ /* transfer can be considered ended, when SCSIEN reads back zero */
+ while (TESTHI(SXFRCTL0, SCSIEN))
+ barrier();
- CLRBITS(DMACNTRL0, ENDMA);
- }
+ CLRBITS(DMACNTRL0, ENDMA);
+ }
#if defined(DEBUG_DATAO) || defined(DEBUG_INTR)
- if(HOSTDATA(shpnt)->debug & (debug_datao|debug_intr))
- printk("sent %d data bytes, ", GETSTCNT());
+ if (HOSTDATA(shpnt)->debug & (debug_datao | debug_intr))
+ printk("sent %d data bytes, ", GETSTCNT());
#endif
- }
- break;
+ }
+ break;
- case P_BUSFREE: /* BUSFREE */
+ case P_BUSFREE: /* BUSFREE */
#if defined(DEBUG_RACE)
- leave_driver("(BUSFREE) intr");
+ leave_driver("(BUSFREE) intr");
#endif
#if defined(DEBUG_PHASES)
- if(HOSTDATA(shpnt)->debug & debug_phases)
- printk("unexpected BUS FREE, ");
+ if (HOSTDATA(shpnt)->debug & debug_phases)
+ printk("unexpected BUS FREE, ");
#endif
- CURRENT_SC->SCp.phase &= ~(P_MASK<<16);
+ CURRENT_SC->SCp.phase &= ~(P_MASK << 16);
- aha152x_done(shpnt, DID_ERROR << 16); /* Don't know any better */
- return;
- break;
+ aha152x_done(shpnt, DID_ERROR << 16); /* Don't know any better */
+ return;
+ break;
- case P_PARITY: /* parity error in DATA phase */
+ case P_PARITY: /* parity error in DATA phase */
#if defined(DEBUG_RACE)
- leave_driver("(DID_PARITY) intr");
+ leave_driver("(DID_PARITY) intr");
#endif
- printk("PARITY error in DATA phase, ");
+ printk("PARITY error in DATA phase, ");
- CURRENT_SC->SCp.phase &= ~(P_MASK<<16);
+ CURRENT_SC->SCp.phase &= ~(P_MASK << 16);
- SETBITS(DMACNTRL0, INTEN);
- aha152x_done(shpnt, DID_PARITY << 16);
- return;
- break;
+ SETBITS(DMACNTRL0, INTEN);
+ aha152x_done(shpnt, DID_PARITY << 16);
+ return;
+ break;
- default:
- printk("aha152x: unexpected phase\n");
- break;
- }
+ default:
+ printk("aha152x: unexpected phase\n");
+ break;
+ }
- if(done) {
+ if (done) {
#if defined(DEBUG_INTR)
- if(HOSTDATA(shpnt)->debug & debug_intr)
- printk("command done.\n");
+ if (HOSTDATA(shpnt)->debug & debug_intr)
+ printk("command done.\n");
#endif
#if defined(DEBUG_RACE)
- leave_driver("(done) intr");
+ leave_driver("(done) intr");
#endif
- SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
- SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
- SETPORT(SCSISEQ, DISCONNECTED_SC ? ENRESELI : 0);
-
- SETBITS(DMACNTRL0, INTEN);
-
- aha152x_done(shpnt,
- (CURRENT_SC->SCp.Status & 0xff)
- | ((CURRENT_SC->SCp.Message & 0xff) << 8)
- | (DID_OK << 16));
+ SETPORT(SIMODE0, DISCONNECTED_SC ? ENSELDI : 0);
+ SETPORT(SIMODE1, ISSUE_SC ? ENBUSFREE : 0);
+ SETPORT(SCSISEQ, DISCONNECTED_SC ? ENRESELI : 0);
+
+ SETBITS(DMACNTRL0, INTEN);
+
+ aha152x_done(shpnt,
+ (CURRENT_SC->SCp.Status & 0xff)
+ | ((CURRENT_SC->SCp.Message & 0xff) << 8)
+ | (DID_OK << 16));
#if defined(DEBUG_RACE)
- printk("done returned (DID_OK: Status=%x; Message=%x).\n",
- CURRENT_SC->SCp.Status, CURRENT_SC->SCp.Message);
+ printk("done returned (DID_OK: Status=%x; Message=%x).\n",
+ CURRENT_SC->SCp.Status, CURRENT_SC->SCp.Message);
#endif
- return;
- }
-
- if(CURRENT_SC)
- CURRENT_SC->SCp.phase |= 1<<16;
+ return;
+ }
+ if (CURRENT_SC)
+ CURRENT_SC->SCp.phase |= 1 << 16;
- SETPORT(SIMODE0, 0);
- SETPORT(SIMODE1, ENPHASEMIS|ENBUSFREE);
+ SETPORT(SIMODE0, 0);
+ SETPORT(SIMODE1, ENPHASEMIS | ENBUSFREE);
#if defined(DEBUG_INTR)
- if(HOSTDATA(shpnt)->debug & debug_intr)
- disp_enintr(shpnt);
+ if (HOSTDATA(shpnt)->debug & debug_intr)
+ disp_enintr(shpnt);
#endif
#if defined(DEBUG_RACE)
- leave_driver("(PHASEEND) intr");
+ leave_driver("(PHASEEND) intr");
#endif
- SETBITS(DMACNTRL0, INTEN);
- return;
+ SETBITS(DMACNTRL0, INTEN);
+ return;
}
/*
*/
static void aha152x_panic(struct Scsi_Host *shpnt, char *msg)
{
- printk("\naha152x: %s\n", msg);
- show_queues(shpnt);
- panic("aha152x panic");
+ printk("\naha152x: %s\n", msg);
+ show_queues(shpnt);
+ panic("aha152x panic");
}
/*
static void disp_ports(struct Scsi_Host *shpnt)
{
#ifdef DEBUG_AHA152X
- int s;
+ int s;
#ifdef SKIP_PORTS
- if(HOSTDATA(shpnt)->debug & debug_skipports)
- return;
-#endif
-
- printk("\n%s: ", CURRENT_SC ? "on bus" : "waiting");
-
- s=GETPORT(SCSISEQ);
- printk("SCSISEQ (");
- if(s & TEMODEO) printk("TARGET MODE ");
- if(s & ENSELO) printk("SELO ");
- if(s & ENSELI) printk("SELI ");
- if(s & ENRESELI) printk("RESELI ");
- if(s & ENAUTOATNO) printk("AUTOATNO ");
- if(s & ENAUTOATNI) printk("AUTOATNI ");
- if(s & ENAUTOATNP) printk("AUTOATNP ");
- if(s & SCSIRSTO) printk("SCSIRSTO ");
- printk(");");
-
- printk(" SCSISIG (");
- s=GETPORT(SCSISIG);
- switch(s & P_MASK) {
- case P_DATAO:
- printk("DATA OUT");
- break;
- case P_DATAI:
- printk("DATA IN");
- break;
- case P_CMD:
- printk("COMMAND");
- break;
- case P_STATUS:
- printk("STATUS");
- break;
- case P_MSGO:
- printk("MESSAGE OUT");
- break;
- case P_MSGI:
- printk("MESSAGE IN");
- break;
- default:
- printk("*illegal*");
- break;
- }
-
- printk("); ");
-
- printk("INTSTAT (%s); ", TESTHI(DMASTAT, INTSTAT) ? "hi" : "lo");
-
- printk("SSTAT (");
- s=GETPORT(SSTAT0);
- if(s & TARGET) printk("TARGET ");
- if(s & SELDO) printk("SELDO ");
- if(s & SELDI) printk("SELDI ");
- if(s & SELINGO) printk("SELINGO ");
- if(s & SWRAP) printk("SWRAP ");
- if(s & SDONE) printk("SDONE ");
- if(s & SPIORDY) printk("SPIORDY ");
- if(s & DMADONE) printk("DMADONE ");
-
- s=GETPORT(SSTAT1);
- if(s & SELTO) printk("SELTO ");
- if(s & ATNTARG) printk("ATNTARG ");
- if(s & SCSIRSTI) printk("SCSIRSTI ");
- if(s & PHASEMIS) printk("PHASEMIS ");
- if(s & BUSFREE) printk("BUSFREE ");
- if(s & SCSIPERR) printk("SCSIPERR ");
- if(s & PHASECHG) printk("PHASECHG ");
- if(s & REQINIT) printk("REQINIT ");
- printk("); ");
-
-
- printk("SSTAT (");
-
- s=GETPORT(SSTAT0) & GETPORT(SIMODE0);
-
- if(s & TARGET) printk("TARGET ");
- if(s & SELDO) printk("SELDO ");
- if(s & SELDI) printk("SELDI ");
- if(s & SELINGO) printk("SELINGO ");
- if(s & SWRAP) printk("SWRAP ");
- if(s & SDONE) printk("SDONE ");
- if(s & SPIORDY) printk("SPIORDY ");
- if(s & DMADONE) printk("DMADONE ");
-
- s=GETPORT(SSTAT1) & GETPORT(SIMODE1);
-
- if(s & SELTO) printk("SELTO ");
- if(s & ATNTARG) printk("ATNTARG ");
- if(s & SCSIRSTI) printk("SCSIRSTI ");
- if(s & PHASEMIS) printk("PHASEMIS ");
- if(s & BUSFREE) printk("BUSFREE ");
- if(s & SCSIPERR) printk("SCSIPERR ");
- if(s & PHASECHG) printk("PHASECHG ");
- if(s & REQINIT) printk("REQINIT ");
- printk("); ");
-
- printk("SXFRCTL0 (");
-
- s=GETPORT(SXFRCTL0);
- if(s & SCSIEN) printk("SCSIEN ");
- if(s & DMAEN) printk("DMAEN ");
- if(s & CH1) printk("CH1 ");
- if(s & CLRSTCNT) printk("CLRSTCNT ");
- if(s & SPIOEN) printk("SPIOEN ");
- if(s & CLRCH1) printk("CLRCH1 ");
- printk("); ");
-
- printk("SIGNAL (");
-
- s=GETPORT(SCSISIG);
- if(s & ATNI) printk("ATNI ");
- if(s & SELI) printk("SELI ");
- if(s & BSYI) printk("BSYI ");
- if(s & REQI) printk("REQI ");
- if(s & ACKI) printk("ACKI ");
- printk("); ");
-
- printk("SELID (%02x), ", GETPORT(SELID));
-
- printk("SSTAT2 (");
-
- s=GETPORT(SSTAT2);
- if(s & SOFFSET) printk("SOFFSET ");
- if(s & SEMPTY) printk("SEMPTY ");
- if(s & SFULL) printk("SFULL ");
- printk("); SFCNT (%d); ", s & (SFULL|SFCNT));
-
- s=GETPORT(SSTAT3);
- printk("SCSICNT (%d), OFFCNT(%d), ", (s&0xf0)>>4, s&0x0f);
-
- printk("SSTAT4 (");
- s=GETPORT(SSTAT4);
- if(s & SYNCERR) printk("SYNCERR ");
- if(s & FWERR) printk("FWERR ");
- if(s & FRERR) printk("FRERR ");
- printk("); ");
-
- printk("DMACNTRL0 (");
- s=GETPORT(DMACNTRL0);
- printk("%s ", s & _8BIT ? "8BIT" : "16BIT");
- printk("%s ", s & DMA ? "DMA" : "PIO" );
- printk("%s ", s & WRITE_READ ? "WRITE" : "READ" );
- if(s & ENDMA) printk("ENDMA ");
- if(s & INTEN) printk("INTEN ");
- if(s & RSTFIFO) printk("RSTFIFO ");
- if(s & SWINT) printk("SWINT ");
- printk("); ");
-
- printk("DMASTAT (");
- s=GETPORT(DMASTAT);
- if(s & ATDONE) printk("ATDONE ");
- if(s & WORDRDY) printk("WORDRDY ");
- if(s & DFIFOFULL) printk("DFIFOFULL ");
- if(s & DFIFOEMP) printk("DFIFOEMP ");
- printk(")");
-
- printk("\n");
+ if (HOSTDATA(shpnt)->debug & debug_skipports)
+ return;
+#endif
+
+ printk("\n%s: ", CURRENT_SC ? "on bus" : "waiting");
+
+ s = GETPORT(SCSISEQ);
+ printk("SCSISEQ (");
+ if (s & TEMODEO)
+ printk("TARGET MODE ");
+ if (s & ENSELO)
+ printk("SELO ");
+ if (s & ENSELI)
+ printk("SELI ");
+ if (s & ENRESELI)
+ printk("RESELI ");
+ if (s & ENAUTOATNO)
+ printk("AUTOATNO ");
+ if (s & ENAUTOATNI)
+ printk("AUTOATNI ");
+ if (s & ENAUTOATNP)
+ printk("AUTOATNP ");
+ if (s & SCSIRSTO)
+ printk("SCSIRSTO ");
+ printk(");");
+
+ printk(" SCSISIG (");
+ s = GETPORT(SCSISIG);
+ switch (s & P_MASK) {
+ case P_DATAO:
+ printk("DATA OUT");
+ break;
+ case P_DATAI:
+ printk("DATA IN");
+ break;
+ case P_CMD:
+ printk("COMMAND");
+ break;
+ case P_STATUS:
+ printk("STATUS");
+ break;
+ case P_MSGO:
+ printk("MESSAGE OUT");
+ break;
+ case P_MSGI:
+ printk("MESSAGE IN");
+ break;
+ default:
+ printk("*illegal*");
+ break;
+ }
+
+ printk("); ");
+
+ printk("INTSTAT (%s); ", TESTHI(DMASTAT, INTSTAT) ? "hi" : "lo");
+
+ printk("SSTAT (");
+ s = GETPORT(SSTAT0);
+ if (s & TARGET)
+ printk("TARGET ");
+ if (s & SELDO)
+ printk("SELDO ");
+ if (s & SELDI)
+ printk("SELDI ");
+ if (s & SELINGO)
+ printk("SELINGO ");
+ if (s & SWRAP)
+ printk("SWRAP ");
+ if (s & SDONE)
+ printk("SDONE ");
+ if (s & SPIORDY)
+ printk("SPIORDY ");
+ if (s & DMADONE)
+ printk("DMADONE ");
+
+ s = GETPORT(SSTAT1);
+ if (s & SELTO)
+ printk("SELTO ");
+ if (s & ATNTARG)
+ printk("ATNTARG ");
+ if (s & SCSIRSTI)
+ printk("SCSIRSTI ");
+ if (s & PHASEMIS)
+ printk("PHASEMIS ");
+ if (s & BUSFREE)
+ printk("BUSFREE ");
+ if (s & SCSIPERR)
+ printk("SCSIPERR ");
+ if (s & PHASECHG)
+ printk("PHASECHG ");
+ if (s & REQINIT)
+ printk("REQINIT ");
+ printk("); ");
+
+
+ printk("SSTAT (");
+
+ s = GETPORT(SSTAT0) & GETPORT(SIMODE0);
+
+ if (s & TARGET)
+ printk("TARGET ");
+ if (s & SELDO)
+ printk("SELDO ");
+ if (s & SELDI)
+ printk("SELDI ");
+ if (s & SELINGO)
+ printk("SELINGO ");
+ if (s & SWRAP)
+ printk("SWRAP ");
+ if (s & SDONE)
+ printk("SDONE ");
+ if (s & SPIORDY)
+ printk("SPIORDY ");
+ if (s & DMADONE)
+ printk("DMADONE ");
+
+ s = GETPORT(SSTAT1) & GETPORT(SIMODE1);
+
+ if (s & SELTO)
+ printk("SELTO ");
+ if (s & ATNTARG)
+ printk("ATNTARG ");
+ if (s & SCSIRSTI)
+ printk("SCSIRSTI ");
+ if (s & PHASEMIS)
+ printk("PHASEMIS ");
+ if (s & BUSFREE)
+ printk("BUSFREE ");
+ if (s & SCSIPERR)
+ printk("SCSIPERR ");
+ if (s & PHASECHG)
+ printk("PHASECHG ");
+ if (s & REQINIT)
+ printk("REQINIT ");
+ printk("); ");
+
+ printk("SXFRCTL0 (");
+
+ s = GETPORT(SXFRCTL0);
+ if (s & SCSIEN)
+ printk("SCSIEN ");
+ if (s & DMAEN)
+ printk("DMAEN ");
+ if (s & CH1)
+ printk("CH1 ");
+ if (s & CLRSTCNT)
+ printk("CLRSTCNT ");
+ if (s & SPIOEN)
+ printk("SPIOEN ");
+ if (s & CLRCH1)
+ printk("CLRCH1 ");
+ printk("); ");
+
+ printk("SIGNAL (");
+
+ s = GETPORT(SCSISIG);
+ if (s & ATNI)
+ printk("ATNI ");
+ if (s & SELI)
+ printk("SELI ");
+ if (s & BSYI)
+ printk("BSYI ");
+ if (s & REQI)
+ printk("REQI ");
+ if (s & ACKI)
+ printk("ACKI ");
+ printk("); ");
+
+ printk("SELID (%02x), ", GETPORT(SELID));
+
+ printk("SSTAT2 (");
+
+ s = GETPORT(SSTAT2);
+ if (s & SOFFSET)
+ printk("SOFFSET ");
+ if (s & SEMPTY)
+ printk("SEMPTY ");
+ if (s & SFULL)
+ printk("SFULL ");
+ printk("); SFCNT (%d); ", s & (SFULL | SFCNT));
+
+ s = GETPORT(SSTAT3);
+ printk("SCSICNT (%d), OFFCNT(%d), ", (s & 0xf0) >> 4, s & 0x0f);
+
+ printk("SSTAT4 (");
+ s = GETPORT(SSTAT4);
+ if (s & SYNCERR)
+ printk("SYNCERR ");
+ if (s & FWERR)
+ printk("FWERR ");
+ if (s & FRERR)
+ printk("FRERR ");
+ printk("); ");
+
+ printk("DMACNTRL0 (");
+ s = GETPORT(DMACNTRL0);
+ printk("%s ", s & _8BIT ? "8BIT" : "16BIT");
+ printk("%s ", s & DMA ? "DMA" : "PIO");
+ printk("%s ", s & WRITE_READ ? "WRITE" : "READ");
+ if (s & ENDMA)
+ printk("ENDMA ");
+ if (s & INTEN)
+ printk("INTEN ");
+ if (s & RSTFIFO)
+ printk("RSTFIFO ");
+ if (s & SWINT)
+ printk("SWINT ");
+ printk("); ");
+
+ printk("DMASTAT (");
+ s = GETPORT(DMASTAT);
+ if (s & ATDONE)
+ printk("ATDONE ");
+ if (s & WORDRDY)
+ printk("WORDRDY ");
+ if (s & DFIFOFULL)
+ printk("DFIFOFULL ");
+ if (s & DFIFOEMP)
+ printk("DFIFOEMP ");
+ printk(")");
+
+ printk("\n");
#endif
}
*/
static void disp_enintr(struct Scsi_Host *shpnt)
{
- int s;
-
- printk("enabled interrupts (");
-
- s=GETPORT(SIMODE0);
- if(s & ENSELDO) printk("ENSELDO ");
- if(s & ENSELDI) printk("ENSELDI ");
- if(s & ENSELINGO) printk("ENSELINGO ");
- if(s & ENSWRAP) printk("ENSWRAP ");
- if(s & ENSDONE) printk("ENSDONE ");
- if(s & ENSPIORDY) printk("ENSPIORDY ");
- if(s & ENDMADONE) printk("ENDMADONE ");
-
- s=GETPORT(SIMODE1);
- if(s & ENSELTIMO) printk("ENSELTIMO ");
- if(s & ENATNTARG) printk("ENATNTARG ");
- if(s & ENPHASEMIS) printk("ENPHASEMIS ");
- if(s & ENBUSFREE) printk("ENBUSFREE ");
- if(s & ENSCSIPERR) printk("ENSCSIPERR ");
- if(s & ENPHASECHG) printk("ENPHASECHG ");
- if(s & ENREQINIT) printk("ENREQINIT ");
- printk(")\n");
+ int s;
+
+ printk("enabled interrupts (");
+
+ s = GETPORT(SIMODE0);
+ if (s & ENSELDO)
+ printk("ENSELDO ");
+ if (s & ENSELDI)
+ printk("ENSELDI ");
+ if (s & ENSELINGO)
+ printk("ENSELINGO ");
+ if (s & ENSWRAP)
+ printk("ENSWRAP ");
+ if (s & ENSDONE)
+ printk("ENSDONE ");
+ if (s & ENSPIORDY)
+ printk("ENSPIORDY ");
+ if (s & ENDMADONE)
+ printk("ENDMADONE ");
+
+ s = GETPORT(SIMODE1);
+ if (s & ENSELTIMO)
+ printk("ENSELTIMO ");
+ if (s & ENATNTARG)
+ printk("ENATNTARG ");
+ if (s & ENPHASEMIS)
+ printk("ENPHASEMIS ");
+ if (s & ENBUSFREE)
+ printk("ENBUSFREE ");
+ if (s & ENSCSIPERR)
+ printk("ENSCSIPERR ");
+ if (s & ENPHASECHG)
+ printk("ENPHASECHG ");
+ if (s & ENREQINIT)
+ printk("ENREQINIT ");
+ printk(")\n");
}
#if defined(DEBUG_RACE)
static const char *should_leave;
-static int in_driver=0;
+static int in_driver = 0;
/*
* Only one routine can be in the driver at once.
*/
static void enter_driver(const char *func)
{
- unsigned long flags;
-
- save_flags(flags);
- cli();
- printk("aha152x: entering %s() (%x)\n", func, jiffies);
- if(in_driver) {
- printk("%s should leave first.\n", should_leave);
- panic("aha152x: already in driver\n");
- }
-
- in_driver++;
- should_leave=func;
- restore_flags(flags);
+ unsigned long flags;
+
+ save_flags(flags);
+ cli();
+ printk("aha152x: entering %s() (%x)\n", func, jiffies);
+ if (in_driver) {
+ printk("%s should leave first.\n", should_leave);
+ panic("aha152x: already in driver\n");
+ }
+ in_driver++;
+ should_leave = func;
+ restore_flags(flags);
}
static void leave_driver(const char *func)
{
- unsigned long flags;
-
- save_flags(flags);
- cli();
- printk("\naha152x: leaving %s() (%x)\n", func, jiffies);
- if(!in_driver) {
- printk("aha152x: %s already left.\n", should_leave);
- panic("aha152x: %s already left driver.\n");
- }
-
- in_driver--;
- should_leave=func;
- restore_flags(flags);
+ unsigned long flags;
+
+ save_flags(flags);
+ cli();
+ printk("\naha152x: leaving %s() (%x)\n", func, jiffies);
+ if (!in_driver) {
+ printk("aha152x: %s already left.\n", should_leave);
+ panic("aha152x: %s already left driver.\n");
+ }
+ in_driver--;
+ should_leave = func;
+ restore_flags(flags);
}
#endif
/*
* Show the command data of a command
*/
-static void show_command(Scsi_Cmnd *ptr)
+static void show_command(Scsi_Cmnd * ptr)
{
- printk("0x%08x: target=%d; lun=%d; cmnd=(",
- (unsigned int) ptr, ptr->target, ptr->lun);
-
- print_command(ptr->cmnd);
-
- printk("); residual=%d; buffers=%d; phase |",
- ptr->SCp.this_residual, ptr->SCp.buffers_residual);
-
- if(ptr->SCp.phase & not_issued ) printk("not issued|");
- if(ptr->SCp.phase & in_selection) printk("in selection|");
- if(ptr->SCp.phase & disconnected) printk("disconnected|");
- if(ptr->SCp.phase & aborted ) printk("aborted|");
- if(ptr->SCp.phase & sent_ident ) printk("send_ident|");
- if(ptr->SCp.phase & in_other) {
- printk("; in other(");
- switch((ptr->SCp.phase >> 16) & P_MASK) {
- case P_DATAO:
- printk("DATA OUT");
- break;
- case P_DATAI:
- printk("DATA IN");
- break;
- case P_CMD:
- printk("COMMAND");
- break;
- case P_STATUS:
- printk("STATUS");
- break;
- case P_MSGO:
- printk("MESSAGE OUT");
- break;
- case P_MSGI:
- printk("MESSAGE IN");
- break;
- default:
- printk("*illegal*");
- break;
- }
- printk(")");
- if(ptr->SCp.phase & (1<<16))
- printk("; phaseend");
- }
- printk("; next=0x%08x\n", (unsigned int) ptr->host_scribble);
+ printk("0x%08x: target=%d; lun=%d; cmnd=(",
+ (unsigned int) ptr, ptr->target, ptr->lun);
+
+ print_command(ptr->cmnd);
+
+ printk("); residual=%d; buffers=%d; phase |",
+ ptr->SCp.this_residual, ptr->SCp.buffers_residual);
+
+ if (ptr->SCp.phase & not_issued)
+ printk("not issued|");
+ if (ptr->SCp.phase & in_selection)
+ printk("in selection|");
+ if (ptr->SCp.phase & disconnected)
+ printk("disconnected|");
+ if (ptr->SCp.phase & aborted)
+ printk("aborted|");
+ if (ptr->SCp.phase & sent_ident)
+ printk("send_ident|");
+ if (ptr->SCp.phase & in_other) {
+ printk("; in other(");
+ switch ((ptr->SCp.phase >> 16) & P_MASK) {
+ case P_DATAO:
+ printk("DATA OUT");
+ break;
+ case P_DATAI:
+ printk("DATA IN");
+ break;
+ case P_CMD:
+ printk("COMMAND");
+ break;
+ case P_STATUS:
+ printk("STATUS");
+ break;
+ case P_MSGO:
+ printk("MESSAGE OUT");
+ break;
+ case P_MSGI:
+ printk("MESSAGE IN");
+ break;
+ default:
+ printk("*illegal*");
+ break;
+ }
+ printk(")");
+ if (ptr->SCp.phase & (1 << 16))
+ printk("; phaseend");
+ }
+ printk("; next=0x%08x\n", (unsigned int) ptr->host_scribble);
}
-
+
/*
* Dump the queued data
*/
static void show_queues(struct Scsi_Host *shpnt)
{
- unsigned long flags;
- Scsi_Cmnd *ptr;
-
- save_flags(flags);
- cli();
- printk("QUEUE STATUS:\nissue_SC:\n");
- for(ptr=ISSUE_SC; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
- show_command(ptr);
-
- printk("current_SC:\n");
- if(CURRENT_SC)
- show_command(CURRENT_SC);
- else
- printk("none\n");
-
- printk("disconnected_SC:\n");
- for(ptr=DISCONNECTED_SC; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
- show_command(ptr);
-
- disp_ports(shpnt);
- disp_enintr(shpnt);
- restore_flags(flags);
+ unsigned long flags;
+ Scsi_Cmnd *ptr;
+
+ save_flags(flags);
+ cli();
+ printk("QUEUE STATUS:\nissue_SC:\n");
+ for (ptr = ISSUE_SC; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
+ show_command(ptr);
+
+ printk("current_SC:\n");
+ if (CURRENT_SC)
+ show_command(CURRENT_SC);
+ else
+ printk("none\n");
+
+ printk("disconnected_SC:\n");
+ for (ptr = DISCONNECTED_SC; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
+ show_command(ptr);
+
+ disp_ports(shpnt);
+ disp_enintr(shpnt);
+ restore_flags(flags);
}
int aha152x_set_info(char *buffer, int length, struct Scsi_Host *shpnt)
{
- return(-ENOSYS); /* Currently this is a no-op */
+ return (-ENOSYS); /* Currently this is a no-op */
}
#undef SPRINTF
#define SPRINTF(args...) pos += sprintf(pos, ## args)
-static int get_command(char *pos, Scsi_Cmnd *ptr)
+static int get_command(char *pos, Scsi_Cmnd * ptr)
{
- char *start = pos;
- int i;
-
- SPRINTF("0x%08x: target=%d; lun=%d; cmnd=( ",
- (unsigned int) ptr, ptr->target, ptr->lun);
-
- for(i=0; i<COMMAND_SIZE(ptr->cmnd[0]); i++)
- SPRINTF("0x%02x ", ptr->cmnd[i]);
-
- SPRINTF("); residual=%d; buffers=%d; phase |",
- ptr->SCp.this_residual, ptr->SCp.buffers_residual);
-
- if(ptr->SCp.phase & not_issued ) SPRINTF("not issued|");
- if(ptr->SCp.phase & in_selection) SPRINTF("in selection|");
- if(ptr->SCp.phase & disconnected) SPRINTF("disconnected|");
- if(ptr->SCp.phase & aborted ) SPRINTF("aborted|");
- if(ptr->SCp.phase & sent_ident ) SPRINTF("send_ident|");
- if(ptr->SCp.phase & in_other) {
- SPRINTF("; in other(");
- switch((ptr->SCp.phase >> 16) & P_MASK) {
- case P_DATAO:
- SPRINTF("DATA OUT");
- break;
- case P_DATAI:
- SPRINTF("DATA IN");
- break;
- case P_CMD:
- SPRINTF("COMMAND");
- break;
- case P_STATUS:
- SPRINTF("STATUS");
- break;
- case P_MSGO:
- SPRINTF("MESSAGE OUT");
- break;
- case P_MSGI:
- SPRINTF("MESSAGE IN");
- break;
- default:
- SPRINTF("*illegal*");
- break;
- }
- SPRINTF(")");
- if(ptr->SCp.phase & (1<<16))
- SPRINTF("; phaseend");
- }
- SPRINTF("; next=0x%08x\n", (unsigned int) ptr->host_scribble);
-
- return(pos-start);
+ char *start = pos;
+ int i;
+
+ SPRINTF("0x%08x: target=%d; lun=%d; cmnd=( ",
+ (unsigned int) ptr, ptr->target, ptr->lun);
+
+ for (i = 0; i < COMMAND_SIZE(ptr->cmnd[0]); i++)
+ SPRINTF("0x%02x ", ptr->cmnd[i]);
+
+ SPRINTF("); residual=%d; buffers=%d; phase |",
+ ptr->SCp.this_residual, ptr->SCp.buffers_residual);
+
+ if (ptr->SCp.phase & not_issued)
+ SPRINTF("not issued|");
+ if (ptr->SCp.phase & in_selection)
+ SPRINTF("in selection|");
+ if (ptr->SCp.phase & disconnected)
+ SPRINTF("disconnected|");
+ if (ptr->SCp.phase & aborted)
+ SPRINTF("aborted|");
+ if (ptr->SCp.phase & sent_ident)
+ SPRINTF("send_ident|");
+ if (ptr->SCp.phase & in_other) {
+ SPRINTF("; in other(");
+ switch ((ptr->SCp.phase >> 16) & P_MASK) {
+ case P_DATAO:
+ SPRINTF("DATA OUT");
+ break;
+ case P_DATAI:
+ SPRINTF("DATA IN");
+ break;
+ case P_CMD:
+ SPRINTF("COMMAND");
+ break;
+ case P_STATUS:
+ SPRINTF("STATUS");
+ break;
+ case P_MSGO:
+ SPRINTF("MESSAGE OUT");
+ break;
+ case P_MSGI:
+ SPRINTF("MESSAGE IN");
+ break;
+ default:
+ SPRINTF("*illegal*");
+ break;
+ }
+ SPRINTF(")");
+ if (ptr->SCp.phase & (1 << 16))
+ SPRINTF("; phaseend");
+ }
+ SPRINTF("; next=0x%08x\n", (unsigned int) ptr->host_scribble);
+
+ return (pos - start);
}
static int get_ports(struct Scsi_Host *shpnt, char *pos)
{
- char *start = pos;
- int s;
+ char *start = pos;
+ int s;
#ifdef SKIP_PORTS
- if(HOSTDATA(shpnt)->debug & debug_skipports)
- return;
-#endif
-
- SPRINTF("\n%s: ", CURRENT_SC ? "on bus" : "waiting");
-
- s=GETPORT(SCSISEQ);
- SPRINTF("SCSISEQ (");
- if(s & TEMODEO) SPRINTF("TARGET MODE ");
- if(s & ENSELO) SPRINTF("SELO ");
- if(s & ENSELI) SPRINTF("SELI ");
- if(s & ENRESELI) SPRINTF("RESELI ");
- if(s & ENAUTOATNO) SPRINTF("AUTOATNO ");
- if(s & ENAUTOATNI) SPRINTF("AUTOATNI ");
- if(s & ENAUTOATNP) SPRINTF("AUTOATNP ");
- if(s & SCSIRSTO) SPRINTF("SCSIRSTO ");
- SPRINTF(");");
-
- SPRINTF(" SCSISIG (");
- s=GETPORT(SCSISIG);
- switch(s & P_MASK) {
- case P_DATAO:
- SPRINTF("DATA OUT");
- break;
- case P_DATAI:
- SPRINTF("DATA IN");
- break;
- case P_CMD:
- SPRINTF("COMMAND");
- break;
- case P_STATUS:
- SPRINTF("STATUS");
- break;
- case P_MSGO:
- SPRINTF("MESSAGE OUT");
- break;
- case P_MSGI:
- SPRINTF("MESSAGE IN");
- break;
- default:
- SPRINTF("*illegal*");
- break;
- }
-
- SPRINTF("); ");
-
- SPRINTF("INTSTAT (%s); ", TESTHI(DMASTAT, INTSTAT) ? "hi" : "lo");
-
- SPRINTF("SSTAT (");
- s=GETPORT(SSTAT0);
- if(s & TARGET) SPRINTF("TARGET ");
- if(s & SELDO) SPRINTF("SELDO ");
- if(s & SELDI) SPRINTF("SELDI ");
- if(s & SELINGO) SPRINTF("SELINGO ");
- if(s & SWRAP) SPRINTF("SWRAP ");
- if(s & SDONE) SPRINTF("SDONE ");
- if(s & SPIORDY) SPRINTF("SPIORDY ");
- if(s & DMADONE) SPRINTF("DMADONE ");
-
- s=GETPORT(SSTAT1);
- if(s & SELTO) SPRINTF("SELTO ");
- if(s & ATNTARG) SPRINTF("ATNTARG ");
- if(s & SCSIRSTI) SPRINTF("SCSIRSTI ");
- if(s & PHASEMIS) SPRINTF("PHASEMIS ");
- if(s & BUSFREE) SPRINTF("BUSFREE ");
- if(s & SCSIPERR) SPRINTF("SCSIPERR ");
- if(s & PHASECHG) SPRINTF("PHASECHG ");
- if(s & REQINIT) SPRINTF("REQINIT ");
- SPRINTF("); ");
-
-
- SPRINTF("SSTAT (");
-
- s=GETPORT(SSTAT0) & GETPORT(SIMODE0);
-
- if(s & TARGET) SPRINTF("TARGET ");
- if(s & SELDO) SPRINTF("SELDO ");
- if(s & SELDI) SPRINTF("SELDI ");
- if(s & SELINGO) SPRINTF("SELINGO ");
- if(s & SWRAP) SPRINTF("SWRAP ");
- if(s & SDONE) SPRINTF("SDONE ");
- if(s & SPIORDY) SPRINTF("SPIORDY ");
- if(s & DMADONE) SPRINTF("DMADONE ");
-
- s=GETPORT(SSTAT1) & GETPORT(SIMODE1);
-
- if(s & SELTO) SPRINTF("SELTO ");
- if(s & ATNTARG) SPRINTF("ATNTARG ");
- if(s & SCSIRSTI) SPRINTF("SCSIRSTI ");
- if(s & PHASEMIS) SPRINTF("PHASEMIS ");
- if(s & BUSFREE) SPRINTF("BUSFREE ");
- if(s & SCSIPERR) SPRINTF("SCSIPERR ");
- if(s & PHASECHG) SPRINTF("PHASECHG ");
- if(s & REQINIT) SPRINTF("REQINIT ");
- SPRINTF("); ");
-
- SPRINTF("SXFRCTL0 (");
-
- s=GETPORT(SXFRCTL0);
- if(s & SCSIEN) SPRINTF("SCSIEN ");
- if(s & DMAEN) SPRINTF("DMAEN ");
- if(s & CH1) SPRINTF("CH1 ");
- if(s & CLRSTCNT) SPRINTF("CLRSTCNT ");
- if(s & SPIOEN) SPRINTF("SPIOEN ");
- if(s & CLRCH1) SPRINTF("CLRCH1 ");
- SPRINTF("); ");
-
- SPRINTF("SIGNAL (");
-
- s=GETPORT(SCSISIG);
- if(s & ATNI) SPRINTF("ATNI ");
- if(s & SELI) SPRINTF("SELI ");
- if(s & BSYI) SPRINTF("BSYI ");
- if(s & REQI) SPRINTF("REQI ");
- if(s & ACKI) SPRINTF("ACKI ");
- SPRINTF("); ");
-
- SPRINTF("SELID (%02x), ", GETPORT(SELID));
-
- SPRINTF("SSTAT2 (");
-
- s=GETPORT(SSTAT2);
- if(s & SOFFSET) SPRINTF("SOFFSET ");
- if(s & SEMPTY) SPRINTF("SEMPTY ");
- if(s & SFULL) SPRINTF("SFULL ");
- SPRINTF("); SFCNT (%d); ", s & (SFULL|SFCNT));
-
- s=GETPORT(SSTAT3);
- SPRINTF("SCSICNT (%d), OFFCNT(%d), ", (s&0xf0)>>4, s&0x0f);
-
- SPRINTF("SSTAT4 (");
- s=GETPORT(SSTAT4);
- if(s & SYNCERR) SPRINTF("SYNCERR ");
- if(s & FWERR) SPRINTF("FWERR ");
- if(s & FRERR) SPRINTF("FRERR ");
- SPRINTF("); ");
-
- SPRINTF("DMACNTRL0 (");
- s=GETPORT(DMACNTRL0);
- SPRINTF("%s ", s & _8BIT ? "8BIT" : "16BIT");
- SPRINTF("%s ", s & DMA ? "DMA" : "PIO" );
- SPRINTF("%s ", s & WRITE_READ ? "WRITE" : "READ" );
- if(s & ENDMA) SPRINTF("ENDMA ");
- if(s & INTEN) SPRINTF("INTEN ");
- if(s & RSTFIFO) SPRINTF("RSTFIFO ");
- if(s & SWINT) SPRINTF("SWINT ");
- SPRINTF("); ");
-
- SPRINTF("DMASTAT (");
- s=GETPORT(DMASTAT);
- if(s & ATDONE) SPRINTF("ATDONE ");
- if(s & WORDRDY) SPRINTF("WORDRDY ");
- if(s & DFIFOFULL) SPRINTF("DFIFOFULL ");
- if(s & DFIFOEMP) SPRINTF("DFIFOEMP ");
- SPRINTF(")\n\n");
-
- SPRINTF("enabled interrupts (");
-
- s=GETPORT(SIMODE0);
- if(s & ENSELDO) SPRINTF("ENSELDO ");
- if(s & ENSELDI) SPRINTF("ENSELDI ");
- if(s & ENSELINGO) SPRINTF("ENSELINGO ");
- if(s & ENSWRAP) SPRINTF("ENSWRAP ");
- if(s & ENSDONE) SPRINTF("ENSDONE ");
- if(s & ENSPIORDY) SPRINTF("ENSPIORDY ");
- if(s & ENDMADONE) SPRINTF("ENDMADONE ");
-
- s=GETPORT(SIMODE1);
- if(s & ENSELTIMO) SPRINTF("ENSELTIMO ");
- if(s & ENATNTARG) SPRINTF("ENATNTARG ");
- if(s & ENPHASEMIS) SPRINTF("ENPHASEMIS ");
- if(s & ENBUSFREE) SPRINTF("ENBUSFREE ");
- if(s & ENSCSIPERR) SPRINTF("ENSCSIPERR ");
- if(s & ENPHASECHG) SPRINTF("ENPHASECHG ");
- if(s & ENREQINIT) SPRINTF("ENREQINIT ");
- SPRINTF(")\n");
-
- return (pos-start);
+ if (HOSTDATA(shpnt)->debug & debug_skipports)
+ return;
+#endif
+
+ SPRINTF("\n%s: ", CURRENT_SC ? "on bus" : "waiting");
+
+ s = GETPORT(SCSISEQ);
+ SPRINTF("SCSISEQ (");
+ if (s & TEMODEO)
+ SPRINTF("TARGET MODE ");
+ if (s & ENSELO)
+ SPRINTF("SELO ");
+ if (s & ENSELI)
+ SPRINTF("SELI ");
+ if (s & ENRESELI)
+ SPRINTF("RESELI ");
+ if (s & ENAUTOATNO)
+ SPRINTF("AUTOATNO ");
+ if (s & ENAUTOATNI)
+ SPRINTF("AUTOATNI ");
+ if (s & ENAUTOATNP)
+ SPRINTF("AUTOATNP ");
+ if (s & SCSIRSTO)
+ SPRINTF("SCSIRSTO ");
+ SPRINTF(");");
+
+ SPRINTF(" SCSISIG (");
+ s = GETPORT(SCSISIG);
+ switch (s & P_MASK) {
+ case P_DATAO:
+ SPRINTF("DATA OUT");
+ break;
+ case P_DATAI:
+ SPRINTF("DATA IN");
+ break;
+ case P_CMD:
+ SPRINTF("COMMAND");
+ break;
+ case P_STATUS:
+ SPRINTF("STATUS");
+ break;
+ case P_MSGO:
+ SPRINTF("MESSAGE OUT");
+ break;
+ case P_MSGI:
+ SPRINTF("MESSAGE IN");
+ break;
+ default:
+ SPRINTF("*illegal*");
+ break;
+ }
+
+ SPRINTF("); ");
+
+ SPRINTF("INTSTAT (%s); ", TESTHI(DMASTAT, INTSTAT) ? "hi" : "lo");
+
+ SPRINTF("SSTAT (");
+ s = GETPORT(SSTAT0);
+ if (s & TARGET)
+ SPRINTF("TARGET ");
+ if (s & SELDO)
+ SPRINTF("SELDO ");
+ if (s & SELDI)
+ SPRINTF("SELDI ");
+ if (s & SELINGO)
+ SPRINTF("SELINGO ");
+ if (s & SWRAP)
+ SPRINTF("SWRAP ");
+ if (s & SDONE)
+ SPRINTF("SDONE ");
+ if (s & SPIORDY)
+ SPRINTF("SPIORDY ");
+ if (s & DMADONE)
+ SPRINTF("DMADONE ");
+
+ s = GETPORT(SSTAT1);
+ if (s & SELTO)
+ SPRINTF("SELTO ");
+ if (s & ATNTARG)
+ SPRINTF("ATNTARG ");
+ if (s & SCSIRSTI)
+ SPRINTF("SCSIRSTI ");
+ if (s & PHASEMIS)
+ SPRINTF("PHASEMIS ");
+ if (s & BUSFREE)
+ SPRINTF("BUSFREE ");
+ if (s & SCSIPERR)
+ SPRINTF("SCSIPERR ");
+ if (s & PHASECHG)
+ SPRINTF("PHASECHG ");
+ if (s & REQINIT)
+ SPRINTF("REQINIT ");
+ SPRINTF("); ");
+
+
+ SPRINTF("SSTAT (");
+
+ s = GETPORT(SSTAT0) & GETPORT(SIMODE0);
+
+ if (s & TARGET)
+ SPRINTF("TARGET ");
+ if (s & SELDO)
+ SPRINTF("SELDO ");
+ if (s & SELDI)
+ SPRINTF("SELDI ");
+ if (s & SELINGO)
+ SPRINTF("SELINGO ");
+ if (s & SWRAP)
+ SPRINTF("SWRAP ");
+ if (s & SDONE)
+ SPRINTF("SDONE ");
+ if (s & SPIORDY)
+ SPRINTF("SPIORDY ");
+ if (s & DMADONE)
+ SPRINTF("DMADONE ");
+
+ s = GETPORT(SSTAT1) & GETPORT(SIMODE1);
+
+ if (s & SELTO)
+ SPRINTF("SELTO ");
+ if (s & ATNTARG)
+ SPRINTF("ATNTARG ");
+ if (s & SCSIRSTI)
+ SPRINTF("SCSIRSTI ");
+ if (s & PHASEMIS)
+ SPRINTF("PHASEMIS ");
+ if (s & BUSFREE)
+ SPRINTF("BUSFREE ");
+ if (s & SCSIPERR)
+ SPRINTF("SCSIPERR ");
+ if (s & PHASECHG)
+ SPRINTF("PHASECHG ");
+ if (s & REQINIT)
+ SPRINTF("REQINIT ");
+ SPRINTF("); ");
+
+ SPRINTF("SXFRCTL0 (");
+
+ s = GETPORT(SXFRCTL0);
+ if (s & SCSIEN)
+ SPRINTF("SCSIEN ");
+ if (s & DMAEN)
+ SPRINTF("DMAEN ");
+ if (s & CH1)
+ SPRINTF("CH1 ");
+ if (s & CLRSTCNT)
+ SPRINTF("CLRSTCNT ");
+ if (s & SPIOEN)
+ SPRINTF("SPIOEN ");
+ if (s & CLRCH1)
+ SPRINTF("CLRCH1 ");
+ SPRINTF("); ");
+
+ SPRINTF("SIGNAL (");
+
+ s = GETPORT(SCSISIG);
+ if (s & ATNI)
+ SPRINTF("ATNI ");
+ if (s & SELI)
+ SPRINTF("SELI ");
+ if (s & BSYI)
+ SPRINTF("BSYI ");
+ if (s & REQI)
+ SPRINTF("REQI ");
+ if (s & ACKI)
+ SPRINTF("ACKI ");
+ SPRINTF("); ");
+
+ SPRINTF("SELID (%02x), ", GETPORT(SELID));
+
+ SPRINTF("SSTAT2 (");
+
+ s = GETPORT(SSTAT2);
+ if (s & SOFFSET)
+ SPRINTF("SOFFSET ");
+ if (s & SEMPTY)
+ SPRINTF("SEMPTY ");
+ if (s & SFULL)
+ SPRINTF("SFULL ");
+ SPRINTF("); SFCNT (%d); ", s & (SFULL | SFCNT));
+
+ s = GETPORT(SSTAT3);
+ SPRINTF("SCSICNT (%d), OFFCNT(%d), ", (s & 0xf0) >> 4, s & 0x0f);
+
+ SPRINTF("SSTAT4 (");
+ s = GETPORT(SSTAT4);
+ if (s & SYNCERR)
+ SPRINTF("SYNCERR ");
+ if (s & FWERR)
+ SPRINTF("FWERR ");
+ if (s & FRERR)
+ SPRINTF("FRERR ");
+ SPRINTF("); ");
+
+ SPRINTF("DMACNTRL0 (");
+ s = GETPORT(DMACNTRL0);
+ SPRINTF("%s ", s & _8BIT ? "8BIT" : "16BIT");
+ SPRINTF("%s ", s & DMA ? "DMA" : "PIO");
+ SPRINTF("%s ", s & WRITE_READ ? "WRITE" : "READ");
+ if (s & ENDMA)
+ SPRINTF("ENDMA ");
+ if (s & INTEN)
+ SPRINTF("INTEN ");
+ if (s & RSTFIFO)
+ SPRINTF("RSTFIFO ");
+ if (s & SWINT)
+ SPRINTF("SWINT ");
+ SPRINTF("); ");
+
+ SPRINTF("DMASTAT (");
+ s = GETPORT(DMASTAT);
+ if (s & ATDONE)
+ SPRINTF("ATDONE ");
+ if (s & WORDRDY)
+ SPRINTF("WORDRDY ");
+ if (s & DFIFOFULL)
+ SPRINTF("DFIFOFULL ");
+ if (s & DFIFOEMP)
+ SPRINTF("DFIFOEMP ");
+ SPRINTF(")\n\n");
+
+ SPRINTF("enabled interrupts (");
+
+ s = GETPORT(SIMODE0);
+ if (s & ENSELDO)
+ SPRINTF("ENSELDO ");
+ if (s & ENSELDI)
+ SPRINTF("ENSELDI ");
+ if (s & ENSELINGO)
+ SPRINTF("ENSELINGO ");
+ if (s & ENSWRAP)
+ SPRINTF("ENSWRAP ");
+ if (s & ENSDONE)
+ SPRINTF("ENSDONE ");
+ if (s & ENSPIORDY)
+ SPRINTF("ENSPIORDY ");
+ if (s & ENDMADONE)
+ SPRINTF("ENDMADONE ");
+
+ s = GETPORT(SIMODE1);
+ if (s & ENSELTIMO)
+ SPRINTF("ENSELTIMO ");
+ if (s & ENATNTARG)
+ SPRINTF("ENATNTARG ");
+ if (s & ENPHASEMIS)
+ SPRINTF("ENPHASEMIS ");
+ if (s & ENBUSFREE)
+ SPRINTF("ENBUSFREE ");
+ if (s & ENSCSIPERR)
+ SPRINTF("ENSCSIPERR ");
+ if (s & ENPHASECHG)
+ SPRINTF("ENPHASECHG ");
+ if (s & ENREQINIT)
+ SPRINTF("ENREQINIT ");
+ SPRINTF(")\n");
+
+ return (pos - start);
}
#undef SPRINTF
#define SPRINTF(args...) do { if(pos < buffer + length) pos += sprintf(pos, ## args); } while(0)
int aha152x_proc_info(char *buffer, char **start,
- off_t offset, int length, int hostno, int inout)
+ off_t offset, int length, int hostno, int inout)
{
- int i;
- char *pos = buffer;
- struct Scsi_Host *shpnt;
- unsigned long flags;
- Scsi_Cmnd *ptr;
-
- for(i=0, shpnt= (struct Scsi_Host *) NULL; i<IRQS; i++)
- if(aha152x_host[i] && aha152x_host[i]->host_no == hostno)
- shpnt=aha152x_host[i];
-
- if(!shpnt)
- return(-ESRCH);
-
- if(inout) /* Has data been written to the file ? */
- return(aha152x_set_info(buffer, length, shpnt));
-
- SPRINTF(AHA152X_REVID "\n");
-
- save_flags(flags);
- cli();
-
- SPRINTF("ioports 0x%04lx to 0x%04lx\n",
- shpnt->io_port, shpnt->io_port+shpnt->n_io_port-1);
- SPRINTF("interrupt 0x%02x\n", shpnt->irq);
- SPRINTF("disconnection/reconnection %s\n",
- HOSTDATA(shpnt)->reconnect ? "enabled" : "disabled");
- SPRINTF("parity checking %s\n",
- HOSTDATA(shpnt)->parity ? "enabled" : "disabled");
- SPRINTF("synchronous transfers %s\n",
- HOSTDATA(shpnt)->synchronous ? "enabled" : "disabled");
- SPRINTF("%d commands currently queued\n", HOSTDATA(shpnt)->commands);
-
- if(HOSTDATA(shpnt)->synchronous) {
+ int i;
+ char *pos = buffer;
+ struct Scsi_Host *shpnt;
+ unsigned long flags;
+ Scsi_Cmnd *ptr;
+
+ for (i = 0, shpnt = (struct Scsi_Host *) NULL; i < IRQS; i++)
+ if (aha152x_host[i] && aha152x_host[i]->host_no == hostno)
+ shpnt = aha152x_host[i];
+
+ if (!shpnt)
+ return (-ESRCH);
+
+ if (inout) /* Has data been written to the file ? */
+ return (aha152x_set_info(buffer, length, shpnt));
+
+ SPRINTF(AHA152X_REVID "\n");
+
+ save_flags(flags);
+ cli();
+
+ SPRINTF("ioports 0x%04lx to 0x%04lx\n",
+ shpnt->io_port, shpnt->io_port + shpnt->n_io_port - 1);
+ SPRINTF("interrupt 0x%02x\n", shpnt->irq);
+ SPRINTF("disconnection/reconnection %s\n",
+ HOSTDATA(shpnt)->reconnect ? "enabled" : "disabled");
+ SPRINTF("parity checking %s\n",
+ HOSTDATA(shpnt)->parity ? "enabled" : "disabled");
+ SPRINTF("synchronous transfers %s\n",
+ HOSTDATA(shpnt)->synchronous ? "enabled" : "disabled");
+ SPRINTF("%d commands currently queued\n", HOSTDATA(shpnt)->commands);
+
+ if (HOSTDATA(shpnt)->synchronous) {
#if 0
- SPRINTF("synchronously operating targets (tick=%ld ns):\n",
- 250000000/loops_per_sec);
- for(i=0; i<8; i++)
- if(HOSTDATA(shpnt)->syncrate[i]&0x7f)
- SPRINTF("target %d: period %dT/%ldns; req/ack offset %d\n",
- i,
- (((HOSTDATA(shpnt)->syncrate[i]&0x70)>>4)+2),
- (((HOSTDATA(shpnt)->syncrate[i]&0x70)>>4)+2)*
- 250000000/loops_per_sec,
- HOSTDATA(shpnt)->syncrate[i]&0x0f);
+ SPRINTF("synchronously operating targets (tick=%ld ns):\n",
+ 250000000 / loops_per_sec);
+ for (i = 0; i < 8; i++)
+ if (HOSTDATA(shpnt)->syncrate[i] & 0x7f)
+ SPRINTF("target %d: period %dT/%ldns; req/ack offset %d\n",
+ i,
+ (((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2),
+ (((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2) *
+ 250000000 / loops_per_sec,
+ HOSTDATA(shpnt)->syncrate[i] & 0x0f);
#else
- SPRINTF("synchronously operating targets (tick=50 ns):\n");
- for(i=0; i<8; i++)
- if(HOSTDATA(shpnt)->syncrate[i]&0x7f)
- SPRINTF("target %d: period %dT/%dns; req/ack offset %d\n",
- i,
- (((HOSTDATA(shpnt)->syncrate[i]&0x70)>>4)+2),
- (((HOSTDATA(shpnt)->syncrate[i]&0x70)>>4)+2)*50,
- HOSTDATA(shpnt)->syncrate[i]&0x0f);
-#endif
- }
-
+ SPRINTF("synchronously operating targets (tick=50 ns):\n");
+ for (i = 0; i < 8; i++)
+ if (HOSTDATA(shpnt)->syncrate[i] & 0x7f)
+ SPRINTF("target %d: period %dT/%dns; req/ack offset %d\n",
+ i,
+ (((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2),
+ (((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2) * 50,
+ HOSTDATA(shpnt)->syncrate[i] & 0x0f);
+#endif
+ }
#ifdef DEBUG_AHA152X
#define PDEBUG(flags,txt) if(HOSTDATA(shpnt)->debug & flags) SPRINTF("(%s) ", txt);
-
- SPRINTF("enabled debugging options: ");
-
- PDEBUG(debug_skipports, "skip ports");
- PDEBUG(debug_queue, "queue");
- PDEBUG(debug_intr, "interrupt");
- PDEBUG(debug_selection, "selection");
- PDEBUG(debug_msgo, "message out");
- PDEBUG(debug_msgi, "message in");
- PDEBUG(debug_status, "status");
- PDEBUG(debug_cmd, "command");
- PDEBUG(debug_datai, "data in");
- PDEBUG(debug_datao, "data out");
- PDEBUG(debug_abort, "abort");
- PDEBUG(debug_done, "done");
- PDEBUG(debug_biosparam, "bios parameters");
- PDEBUG(debug_phases, "phases");
- PDEBUG(debug_queues, "queues");
- PDEBUG(debug_reset, "reset");
-
- SPRINTF("\n");
-#endif
-
- SPRINTF("\nqueue status:\n");
- if(ISSUE_SC) {
- SPRINTF("not yet issued commands:\n");
- for(ptr=ISSUE_SC; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
- pos += get_command(pos, ptr);
- } else
- SPRINTF("no not yet issued commands\n");
-
- if(CURRENT_SC) {
- SPRINTF("current command:\n");
- pos += get_command(pos, CURRENT_SC);
- } else
- SPRINTF("no current command\n");
-
- if(DISCONNECTED_SC) {
- SPRINTF("disconnected commands:\n");
- for(ptr=DISCONNECTED_SC; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
- pos += get_command(pos, ptr);
- } else
- SPRINTF("no disconnected commands\n");
-
- restore_flags(flags);
-
- pos += get_ports(shpnt, pos);
-
- *start=buffer+offset;
- if (pos - buffer < offset)
- return 0;
- else if (pos - buffer - offset < length)
- return pos - buffer - offset;
- else
- return length;
+
+ SPRINTF("enabled debugging options: ");
+
+ PDEBUG(debug_skipports, "skip ports");
+ PDEBUG(debug_queue, "queue");
+ PDEBUG(debug_intr, "interrupt");
+ PDEBUG(debug_selection, "selection");
+ PDEBUG(debug_msgo, "message out");
+ PDEBUG(debug_msgi, "message in");
+ PDEBUG(debug_status, "status");
+ PDEBUG(debug_cmd, "command");
+ PDEBUG(debug_datai, "data in");
+ PDEBUG(debug_datao, "data out");
+ PDEBUG(debug_abort, "abort");
+ PDEBUG(debug_done, "done");
+ PDEBUG(debug_biosparam, "bios parameters");
+ PDEBUG(debug_phases, "phases");
+ PDEBUG(debug_queues, "queues");
+ PDEBUG(debug_reset, "reset");
+
+ SPRINTF("\n");
+#endif
+
+ SPRINTF("\nqueue status:\n");
+ if (ISSUE_SC) {
+ SPRINTF("not yet issued commands:\n");
+ for (ptr = ISSUE_SC; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
+ pos += get_command(pos, ptr);
+ } else
+ SPRINTF("no not yet issued commands\n");
+
+ if (CURRENT_SC) {
+ SPRINTF("current command:\n");
+ pos += get_command(pos, CURRENT_SC);
+ } else
+ SPRINTF("no current command\n");
+
+ if (DISCONNECTED_SC) {
+ SPRINTF("disconnected commands:\n");
+ for (ptr = DISCONNECTED_SC; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
+ pos += get_command(pos, ptr);
+ } else
+ SPRINTF("no disconnected commands\n");
+
+ restore_flags(flags);
+
+ pos += get_ports(shpnt, pos);
+
+ *start = buffer + offset;
+ if (pos - buffer < offset)
+ return 0;
+ else if (pos - buffer - offset < length)
+ return pos - buffer - offset;
+ else
+ return length;
}
#ifdef MODULE
/*
- * linux/drivers/scsi/ide-scsi.c Version 0.6 Jan 27, 1998
+ * linux/drivers/scsi/ide-scsi.c Version 0.9 Jul 4, 1999
*
- * Copyright (C) 1996 - 1998 Gadi Oxman <gadio@netvision.net.il>
+ * Copyright (C) 1996 - 1999 Gadi Oxman <gadio@netvision.net.il>
*/
/*
* Fix MODE_SENSE_6/MODE_SELECT_6/INQUIRY translation.
* Ver 0.7 Dec 04 98 Ignore commands where lun != 0 to avoid multiple
* detection of devices with CONFIG_SCSI_MULTI_LUN
- * Ver 0.8 Feb 05 99 Optical media need translation too.
+ * Ver 0.8 Feb 05 99 Optical media need translation too. Reverse 0.7.
+ * Ver 0.9 Jul 04 99 Fix a bug in SG_SET_TRANSFORM.
*/
-#define IDESCSI_VERSION "0.6"
+#define IDESCSI_VERSION "0.9"
#include <linux/module.h>
#include <linux/types.h>
{
ide_drive_t *drive = idescsi_drives[dev->id];
idescsi_scsi_t *scsi = drive->driver_data;
+ int enable = (int) arg;
if (cmd == SG_SET_TRANSFORM) {
- set_bit(IDESCSI_SG_TRANSFORM, &scsi->transform);
+ if (enable)
+ set_bit(IDESCSI_SG_TRANSFORM, &scsi->transform);
+ else
+ clear_bit(IDESCSI_SG_TRANSFORM, &scsi->transform);
return 0;
} else if (cmd == SG_GET_TRANSFORM)
return put_user(test_bit(IDESCSI_SG_TRANSFORM, &scsi->transform), (int *) arg);
SCpnt->transfersize = rscsi_disks[dev].sector_size;
SCpnt->underflow = this_count << 9;
+ SCpnt->cmd_len = 0;
scsi_do_cmd (SCpnt, (void *) cmd, buff,
this_count * rscsi_disks[dev].sector_size,
rw_intr,
* ES1946 yes This is a PCI chip; not handled by this driver
*/
-#include <linux/config.h>
#include <linux/delay.h>
#include "sound_config.h"
while ( alias != &inode->i_dentry ) {
alias_de = list_entry(alias, struct dentry, d_alias);
coda_flag_children(alias_de, flag);
- shrink_dcache_parent(alias_de);
alias = alias->next;
+ shrink_dcache_parent(alias_de);
}
}
extern int coda_debug;
extern int coda_print_entry;
+inline int coda_fideq(ViceFid *fid1, ViceFid *fid2)
+{
+ if (fid1->Vnode != fid2->Vnode)
+ return 0;
+ if (fid1->Volume != fid2->Volume)
+ return 0;
+ if (fid1->Unique != fid2->Unique)
+ return 0;
+ return 1;
+}
+
/* cnode.c */
static void coda_fill_inode(struct inode *inode, struct coda_vattr *attr)
{
}
cnp = ITOC(*inode);
- if ( cnp->c_magic != 0 ) {
- printk("coda_cnode make on initialized inode %ld, old %s new
+ /* see if we've got it already */
+ if ( cnp->c_magic != 0 && coda_fideq(fid, &cnp->c_fid)) {
+ return 0;
+ }
+
+ /* not fresh: collision */
+ if ( cnp->c_magic != 0 ) {
+ printk("coda_cnode_make on initialized inode %ld, old %s new
%s!\n",
(*inode)->i_ino, coda_f2s(&cnp->c_fid), coda_f2s2(fid));
iput(*inode);
return 0;
}
-inline int coda_fideq(ViceFid *fid1, ViceFid *fid2)
-{
- int eq;
- eq = ( (fid1->Vnode == fid2->Vnode) &&
- (fid1->Volume == fid2->Volume) &&
- (fid1->Unique == fid2->Unique) );
- return eq;
-}
void coda_replace_fid(struct inode *inode, struct ViceFid *oldfid,
struct ViceFid *newfid)
if (attr->va_ctime.tv_sec != -1)
inode->i_ctime = attr->va_ctime.tv_sec;
}
+
+
/*
* BSD sets attributes that need not be modified to -1.
* Linux uses the valid field to indicate what should be
shrink_dcache_parent(de);
+ /* propagate for a flush */
+ if (cii->c_flags & C_FLUSH)
+ coda_flag_inode_children(inode, C_FLUSH);
+
if (de->d_count > 1) {
/* pretend it's valid, but don't change the flags */
CDEBUG(D_DOWNCALL, "BOOM for: ino %ld, %s\n",
return 1;
}
- /* propagate for a flush */
- if (cii->c_flags & C_FLUSH)
- coda_flag_inode_children(inode, C_FLUSH);
-
/* clear the flags. */
cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH);
if ( sbi->sbi_sb ) {
printk("Already mounted\n");
+ unlock_super(sb);
+ EXIT;
+ MOD_DEC_USE_COUNT;
return NULL;
}
printk("coda_read_super: coda_get_rootfid failed with %d\n",
error);
sb->s_dev = 0;
- unlock_super(sb);
goto error;
}
printk("coda_read_super: rootfid is %s\n", coda_f2s(&fid));
if ( error || !root ) {
printk("Failure of coda_cnode_make for root: error %d\n", error);
sb->s_dev = 0;
- unlock_super(sb);
goto error;
}
return sb;
error:
+ unlock_super(sb);
EXIT;
MOD_DEC_USE_COUNT;
if (sbi) {
sb->s_dev = 0;
coda_cache_clear_all(sb);
sb_info = coda_sbp(sb);
-/* sb_info->sbi_vcomm->vc_inuse = 0; You can not do this: psdev_release would see usagecount == 0 and would refuse to decrease MOD_USE_COUNT --pavel */
coda_super_info.sbi_sb = NULL;
printk("Coda: Bye bye.\n");
memset(sb_info, 0, sizeof(* sb_info));
EXIT;
}
-static int coda_notify_change(struct dentry *de, struct iattr *iattr)
+static int coda_notify_change(struct dentry *de, struct iattr *iattr)
{
struct inode *inode = de->d_inode;
struct coda_inode_info *cii;
return error;
}
-/* we need _something_ for this routine. Let's mimic AFS */
static int coda_statfs(struct super_block *sb, struct statfs *buf,
int bufsiz)
{
struct statfs tmp;
+ int error;
+
+ memset(&tmp, 0, sizeof(struct statfs));
+ error = venus_statfs(sb, &tmp);
+
+ if (error) {
+ /* fake something like AFS does */
+ tmp.f_blocks = 9000000;
+ tmp.f_bfree = 9000000;
+ tmp.f_bavail = 9000000;
+ tmp.f_files = 9000000;
+ tmp.f_ffree = 9000000;
+ }
+
+ /* and fill in the rest */
tmp.f_type = CODA_SUPER_MAGIC;
tmp.f_bsize = 1024;
- tmp.f_blocks = 9000000;
- tmp.f_bfree = 9000000;
- tmp.f_bavail = 9000000 ;
- tmp.f_files = 9000000;
- tmp.f_ffree = 9000000;
- tmp.f_namelen = 0;
+ tmp.f_namelen = CODA_MAXNAMLEN;
+
copy_to_user(buf, &tmp, bufsiz);
+
return 0;
}
struct coda_cache_inv_stats coda_cache_inv_stat;
struct coda_upcall_stats_entry coda_upcall_stat[CODA_NCALLS];
struct coda_upcallstats coda_callstats;
+int coda_upcall_timestamping = 0;
/* keep this in sync with coda.h! */
char *coda_upcall_names[] = {
"purgeuser ", /* 26 */
"zapfile ", /* 27 */
"zapdir ", /* 28 */
- "zapvnode ", /* 28 */
+ "noop2 ", /* 29 */
"purgefid ", /* 30 */
- "open_by_path" /* 31 */
+ "open_by_path", /* 31 */
+ "resolve ", /* 32 */
+ "reintegrate ", /* 33 */
+ "statfs " /* 34 */
};
void do_time_stats( struct coda_upcall_stats_entry * pentry,
unsigned long runtime )
{
-
- unsigned long time = runtime * 1000 /HZ; /* time in ms */
+ unsigned long time = runtime; /* time in us */
CDEBUG(D_SPECIAL, "time: %ld\n", time);
if ( pentry->count == 0 ) {
{
if ( write ) {
reset_coda_vfs_stats();
+
+ filp->f_pos += *lenp;
+ } else {
+ *lenp = 0;
}
-
- *lenp = 0;
+
return 0;
}
size_t * lenp )
{
if ( write ) {
+ if (*lenp > 0) {
+ char c;
+ if (get_user(c, (char *)buffer))
+ return -EFAULT;
+ coda_upcall_timestamping = (c == '1');
+ }
reset_coda_upcall_stats();
+
+ filp->f_pos += *lenp;
+ } else {
+ *lenp = 0;
}
-
- *lenp = 0;
+
return 0;
}
{
if ( write ) {
reset_coda_permission_stats();
+
+ filp->f_pos += *lenp;
+ } else {
+ *lenp = 0;
}
-
- *lenp = 0;
+
return 0;
}
{
if ( write ) {
reset_coda_cache_inv_stats();
+
+ filp->f_pos += *lenp;
+ } else {
+ *lenp = 0;
}
- *lenp = 0;
return 0;
}
if ( offset < 160)
len += sprintf( buffer + len,"%-79s\n", "======================");
if ( offset < 240)
- len += sprintf( buffer + len,"%-79s\n", "upcall\t\t count\tavg time(ms)\tstd deviation(ms)");
+ len += sprintf( buffer + len,"%-79s\n", "upcall count avg time(us) std deviation(us)");
if ( offset < 320)
- len += sprintf( buffer + len,"%-79s\n", "------\t\t -----\t------------\t-----------------");
+ len += sprintf( buffer + len,"%-79s\n", "------ ----- ------------ -----------------");
pos = 320;
for ( i = 0 ; i < CODA_NCALLS ; i++ ) {
- tmplen += sprintf(tmpbuf,"%s\t%9d\t%10ld\t%10ld",
+ tmplen += sprintf(tmpbuf,"%s %9d %10ld %10ld",
coda_upcall_names[i],
coda_upcall_stat[i].count,
get_time_average(&coda_upcall_stat[i]),
MOD_INC_USE_COUNT;
else
MOD_DEC_USE_COUNT;
+
}
#endif
return error;
}
+int venus_statfs(struct super_block *sb, struct statfs *sfs)
+{
+ union inputArgs *inp;
+ union outputArgs *outp;
+ int insize, outsize, error;
+
+ insize = max(INSIZE(statfs), OUTSIZE(statfs));
+ UPARG(CODA_STATFS);
+
+ error = coda_upcall(coda_sbp(sb), insize, &outsize, inp);
+
+ if (!error) {
+ sfs->f_blocks = outp->coda_statfs.stat.f_blocks;
+ sfs->f_bfree = outp->coda_statfs.stat.f_bfree;
+ sfs->f_bavail = outp->coda_statfs.stat.f_bavail;
+ sfs->f_files = outp->coda_statfs.stat.f_files;
+ sfs->f_ffree = outp->coda_statfs.stat.f_ffree;
+ } else {
+ printk("coda_statfs: Venus returns: %d\n", error);
+ }
+
+ if (inp) CODA_FREE(inp, insize);
+ CDEBUG(D_INODE, " result %d\n",error);
+ EXIT;
+ return error;
+}
+
/*
* coda_upcall and coda_downcall routines.
*
static inline unsigned long coda_waitfor_upcall(struct upc_req *vmp)
{
DECLARE_WAITQUEUE(wait, current);
- unsigned long posttime;
+ struct timeval begin = { 0, 0 }, end = { 0, 0 };
vmp->uc_posttime = jiffies;
- posttime = jiffies;
+
+ if (coda_upcall_timestamping)
+ do_gettimeofday(&begin);
add_wait_queue(&vmp->uc_sleep, &wait);
for (;;) {
remove_wait_queue(&vmp->uc_sleep, &wait);
current->state = TASK_RUNNING;
- CDEBUG(D_SPECIAL, "posttime: %ld, returned: %ld\n", posttime, jiffies-posttime);
- return (jiffies - posttime);
+ if (coda_upcall_timestamping && begin.tv_sec != 0) {
+ do_gettimeofday(&end);
+
+ if (end.tv_usec < begin.tv_usec) {
+ end.tv_usec += 1000000; end.tv_sec--;
+ }
+ end.tv_sec -= begin.tv_sec;
+ end.tv_usec -= begin.tv_usec;
+ }
+
+ CDEBUG(D_SPECIAL, "begin: %ld.%06ld, elapsed: %ld.%06ld\n",
+ begin.tv_sec, begin.tv_usec, end.tv_sec, end.tv_usec);
+ return ((end.tv_sec * 1000000) + end.tv_usec);
}
char bufname[14];
char *ptname = bufname;
int dotoffset = 0;
+ unsigned long *furrfu = &lpos;
+ unsigned long dummy;
cpos = filp->f_pos;
/* Fake . and .. for the root directory. */
cpos++;
filp->f_pos++;
}
- if (cpos == 2)
+ if (cpos == 2) {
+ dummy = 2;
+ furrfu = &dummy;
cpos = 0;
+ }
}
if (cpos & (sizeof(struct msdos_dir_entry)-1))
return -ENOENT;
if (!long_slots||shortnames) {
if (both)
bufname[i] = '\0';
- if (filldir(dirent, bufname, i, lpos, inum) < 0)
+ if (filldir(dirent, bufname, i, *furrfu, inum) < 0)
goto FillFailed;
} else {
char longname[275];
memcpy(&longname[long_len+1], bufname, i);
long_len += i;
}
- if (filldir(dirent, longname, long_len, lpos, inum) < 0)
+ if (filldir(dirent, longname, long_len, *furrfu, inum) < 0)
goto FillFailed;
}
RecEnd:
+ furrfu = &lpos;
filp->f_pos = cpos;
goto GetNew;
EODir:
#define MAX(a,b) (((a)>(b))?(a):(b))
#include <linux/fs.h>
-#include <linux/minix_fs.h>
/*
* Write to a file (through the page cache).
/* Set up arguments and perform rpc call */
nfs_readreq_setup(&rqst, NFS_FH(dentry), offset, buffer, rsize);
- result = rpc_call(NFS_CLIENT(inode), NFSPROC_READ,
- &rqst.ra_args, &rqst.ra_res, flags);
+ lock_kernel();
+ result = rpc_call(NFS_CLIENT(inode), NFSPROC_READ, &rqst.ra_args, &rqst.ra_res, flags);
+ unlock_kernel();
/*
* Even if we had a partial success we can't mark the page
/* Florian Coosmann (FGC) ^ current = 1 */
/* Additionally, we now use locking technique. This prevents race condition */
/* in case of paging and multiple read/write on the same pipe. (FGC) */
-
+/* Reads with count = 0 should always return 0. Julian Bradfield 1999-06-07. */
static ssize_t do_pipe_read(struct file * filp, char * buf, size_t count)
{
{
ssize_t retval;
+
if (ppos != &filp->f_pos)
return -ESPIPE;
+ if ( !count ) return 0;
+
lock_kernel();
retval = do_pipe_read(filp, buf, count);
unlock_kernel();
#if defined(__linux__)
#define cdev_t u_quad_t
+#ifndef __KERNEL__
#if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
#define _UQUAD_T_ 1
typedef unsigned long long u_quad_t;
#endif
+#else /*__KERNEL__ */
+typedef unsigned long long u_quad_t;
+#endif /* __KERNEL__ */
#else
#define cdev_t dev_t
#endif
#ifdef __CYGWIN32__
-typedef unsigned char u_int8_t;
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};
#endif
+#ifndef __BIT_TYPES_DEFINED__
+#define __BIT_TYPES_DEFINED__
+typedef signed char int8_t;
+typedef unsigned char u_int8_t;
+typedef short int16_t;
+typedef unsigned short u_int16_t;
+typedef int int32_t;
+typedef unsigned int u_int32_t;
+#endif
+
/*
* Cfs constants
struct venus_dirent {
unsigned long d_fileno; /* file number of entry */
unsigned short d_reclen; /* length of this record */
- char d_type; /* file type, see below */
- char d_namlen; /* length of string in d_name */
+ unsigned char d_type; /* file type, see below */
+ unsigned char d_namlen; /* length of string in d_name */
char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */
};
#undef DIRSIZ
#endif
-#ifndef __BIT_TYPES_DEFINED__
-#define u_int32_t unsigned int
-#endif
-
-
#ifndef _VUID_T_
#define _VUID_T_
typedef u_int32_t vuid_t;
#ifndef _CODACRED_T_
#define _CODACRED_T_
struct coda_cred {
- vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid;
- vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid;
-#if defined(CODA_SUPPORTS_SUPPLEMENTARY_GROUPS)
- int cr_nsupgps;
- vgid_t cr_supgps[NGROUPS];
-#endif /* defined(CODA_SUPPORTS_SUPPLEMENTARY_GROUPS) */
+ vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/
+ vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
};
#endif
enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
struct coda_vattr {
- int va_type; /* vnode type (for create) */
+ long va_type; /* vnode type (for create) */
u_short va_mode; /* files access mode and type */
short va_nlink; /* number of references to file */
vuid_t va_uid; /* owner user id */
#endif
+/* structure used by CODA_STATFS for getting cache information from venus */
+struct coda_statfs {
+ int32_t f_blocks;
+ int32_t f_bfree;
+ int32_t f_bavail;
+ int32_t f_files;
+ int32_t f_ffree;
+};
+
/*
* Kernel <--> Venus communications.
*/
#define CODA_OPEN_BY_PATH 31
#define CODA_RESOLVE 32
#define CODA_REINTEGRATE 33
-#define CODA_NCALLS 34
+#define CODA_STATFS 34
+#define CODA_NCALLS 35
#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
int path;
};
+/* coda_statfs: NO_IN */
+struct coda_statfs_in {
+ struct coda_in_hdr in;
+};
+
+struct coda_statfs_out {
+ struct coda_out_hdr oh;
+ struct coda_statfs stat;
+};
+
/*
* Occasionally, we don't cache the fid returned by CODA_LOOKUP.
* For instance, if the fid is inconsistent.
struct coda_inactive_in coda_inactive;
struct coda_vget_in coda_vget;
struct coda_rdwr_in coda_rdwr;
- struct coda_open_by_path_in coda_open_by_path;
+ struct coda_open_by_path_in coda_open_by_path;
+ struct coda_statfs_in coda_statfs;
};
union outputArgs {
struct coda_purgefid_out coda_purgefid;
struct coda_rdwr_out coda_rdwr;
struct coda_replace_out coda_replace;
- struct coda_open_by_path_out coda_open_by_path;
+ struct coda_open_by_path_out coda_open_by_path;
+ struct coda_statfs_out coda_statfs;
};
union coda_downcalls {
short out_size; /* Maximum size of output buffer, <= 2K */
};
-#if defined(__CYGWIN32__) || defined(DJGPP)
struct PioctlData {
- unsigned long cmd;
const char *path;
int follow;
struct ViceIoctl vi;
};
-#else
-struct PioctlData {
- const char *path;
- int follow;
- struct ViceIoctl vi;
-};
-#endif
#define CODA_CONTROL ".CONTROL"
#define CODA_CONTROLLEN 8
extern struct coda_vfs_stats coda_vfs_stat;
extern struct coda_permission_stats coda_permission_stat;
extern struct coda_cache_inv_stats coda_cache_inv_stat;
+extern int coda_upcall_timestamping;
/* reset statistics to 0 */
void reset_coda_vfs_stats( void );
unsigned int cmd, struct PioctlData *data);
int coda_downcall(int opcode, union outputArgs *out, struct super_block *sb);
int venus_fsync(struct super_block *sb, struct ViceFid *fid);
+int venus_statfs(struct super_block *sb, struct statfs *sfs);
/* messages between coda filesystem in kernel and Venus */
int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */
int first_line; /* minor number of first channel on card */
int bus_index; /* address shift - 0 for ISA, 1 for PCI */
- int inact_ctrl; /* FW Inactivity control - 0 disabled, 1 enabled */
+ int intr_enabled; /* FW Interrupt flag - 0 disabled, 1 enabled */
};
struct cyclades_chip {
+++ /dev/null
-/* isdn_timru.h
- *
- * Linux ISDN subsystem, timeout-rules for network interfaces.
- *
- * Copyright 1997 by Christian Lademann <cal@zls.de>
- *
- * 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; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
-02.06.97:cal:ISDN_TIMRU_PACKET_NONE def., ISDN_TIMRU_PACKET_* inkr.
-*/
-
-#ifndef __isdn_timru_h__
-#define __isdn_timru_h__
-
-#define ISDN_TIMRU_PACKET_NONE 0
-#define ISDN_TIMRU_PACKET_SKB 1
-#define ISDN_TIMRU_PACKET_PPP 2
-#define ISDN_TIMRU_PACKET_PPP_NO_HEADER 3
-
-#define ISDN_TIMRU_BRINGUP 0
-#define ISDN_TIMRU_KEEPUP_IN 1
-#define ISDN_TIMRU_KEEPUP_OUT 2
-#define ISDN_TIMRU_BRINGDOWN 3
-#define ISDN_TIMRU_NUM_CHECK 4
-
-#define ISDN_TIMRU_PROTFAM_WILDCARD 0
-#define ISDN_TIMRU_PROTFAM_IP 1
-#define ISDN_TIMRU_PROTFAM_PPP 2
-#define ISDN_TIMRU_PROTFAM_IPX 3
-#define ISDN_TIMRU_NUM_PROTFAM 4
-
-#define ISDN_TIMRU_IP_WILDCARD 0
-#define ISDN_TIMRU_IP_ICMP 1
-#define ISDN_TIMRU_IP_TCP 2
-#define ISDN_TIMRU_IP_UDP 3
-
-#define ISDN_TIMRU_PPP_WILDCARD 0
-#define ISDN_TIMRU_PPP_IPCP 1
-#define ISDN_TIMRU_PPP_IPXCP 2
-#define ISDN_TIMRU_PPP_CCP 3
-#define ISDN_TIMRU_PPP_LCP 4
-#define ISDN_TIMRU_PPP_PAP 5
-#define ISDN_TIMRU_PPP_LQR 6
-#define ISDN_TIMRU_PPP_CHAP 7
-
-typedef struct {
- struct in_addr saddr, /* Source Address */
- smask, /* Source Subnetmask */
- daddr, /* Dest. Address */
- dmask; /* Dest. Subnetmask */
- ushort protocol; /* TCP, UDP, ... */
- union {
- struct {
- __u16 s_from, /* Source Port */
- s_to,
- d_from,
- d_to;
- } port;
- struct {
- __u8 from, /* ICMP-Type */
- to;
- } type;
- } pt;
-} isdn_timeout_rule_ip;
-
-
-typedef struct {
- ushort protocol; /* IPCP, LCP, ... */
-} isdn_timeout_rule_ppp;
-
-
-typedef struct isdn_timeout_rule_s {
- struct isdn_timeout_rule_s *next, /* Pointer to next rule */
- *prev; /* Pointer to previous rule */
- ushort type, /* BRINGUP, KEEPUP_*, ... */
- neg;
- int timeout; /* Timeout value */
- ushort protfam; /* IP, IPX, PPP, ... */
- union {
- isdn_timeout_rule_ip ip; /* IP-Rule */
- isdn_timeout_rule_ppp ppp; /* PPP-Rule */
- } rule; /* Prot.-specific rule */
-} isdn_timeout_rule;
-
-
-typedef struct {
- char name [9]; /* Interface */
- int where, /* 0/1: add to start/end of list, -1: handle default */
- type,
- protfam,
- index,
- defval;
- isdn_timeout_rule rule; /* Rule */
-} isdn_ioctl_timeout_rule;
-
-#ifdef __KERNEL__
-extern int isdn_net_recalc_timeout(int, int, struct device *, void *, ulong);
-extern int isdn_timru_alloc_timeout_rules(struct device *);
-extern int isdn_timru_ioctl_add_rule(isdn_ioctl_timeout_rule *);
-extern int isdn_timru_ioctl_del_rule(isdn_ioctl_timeout_rule *);
-extern int isdn_timru_ioctl_get_rule(isdn_ioctl_timeout_rule *);
-#endif /* __KERNEL__ */
-
-#endif /* __isdn_timru_h__ */
struct file *files[MAXQUOTAS]; /* fp's to quotafiles */
time_t inode_expire[MAXQUOTAS]; /* expiretime for inode-quota */
time_t block_expire[MAXQUOTAS]; /* expiretime for block-quota */
- char rsquash[MAXQUOTAS]; /* for quotas threath root as any other user */
+ char rsquash[MAXQUOTAS]; /* for quotas treat root as any other user */
};
struct vfsmount
#define PCI_CLASS_SERIAL_USB 0x0c03
#define PCI_CLASS_SERIAL_FIBER 0x0c04
+#define PCI_BASE_CLASS_INTELLIGENT 0x0e
+#define PCI_CLASS_INTELLIGENT_I2O 0x0e00
+
#define PCI_CLASS_HOT_SWAP_CONTROLLER 0xff00
#define PCI_CLASS_OTHERS 0xff
#define PCI_DEVICE_ID_NCR_53C895 0x000c
#define PCI_DEVICE_ID_NCR_53C885 0x000d
#define PCI_DEVICE_ID_NCR_53C875 0x000f
+#define PCI_DEVICE_ID_NCR_53C1510 0x0010
#define PCI_DEVICE_ID_NCR_53C875J 0x008f
#define PCI_VENDOR_ID_ATI 0x1002
#define PCI_DEVICE_ID_DEC_21152 0x0024
#define PCI_DEVICE_ID_DEC_21153 0x0025
#define PCI_DEVICE_ID_DEC_21154 0x0026
+#define PCI_DEVICE_ID_COMPAQ_42XX 0x0046
#define PCI_VENDOR_ID_CIRRUS 0x1013
#define PCI_DEVICE_ID_CIRRUS_7548 0x0038
#define PCI_VENDOR_ID_AMD 0x1022
#define PCI_DEVICE_ID_AMD_LANCE 0x2000
+#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
#define PCI_DEVICE_ID_AMD_SCSI 0x2020
#define PCI_VENDOR_ID_TRIDENT 0x1023
#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128V 0x0002
#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZV 0x0003
#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2160 0x0004
+#define PCI_DEVICE_ID_NEOMAGIC_MAGICMEDIA_256AV 0x0005
+#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZVPLUS 0x0083
#define PCI_VENDOR_ID_ASP 0x10cd
#define PCI_DEVICE_ID_ASP_ABP940 0x1200
#define PCI_VENDOR_ID_GALILEO 0x11ab
#define PCI_DEVICE_ID_GALILEO_GT64011 0x4146
+#define PCI_VENDOR_ID_GALILEO 0x11ab
+#define PCI_DEVICE_ID_GALILEO_GT64011 0x4146
+
#define PCI_VENDOR_ID_LITEON 0x11ad
#define PCI_DEVICE_ID_LITEON_LNE100TX 0x0002
#define PCI_VENDOR_ID_ENSONIQ 0x1274
#define PCI_DEVICE_ID_ENSONIQ_AUDIOPCI 0x5000
+#define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371
#define PCI_VENDOR_ID_ALTEON 0x12ae
#define PCI_DEVICE_ID_ALTEON_ACENIC 0x0001
#define PCI_DEVICE_ID_GENROCO_HFP832 0x0003
#define PCI_VENDOR_ID_INTEL 0x8086
+#define PCI_DEVICE_ID_INTEL_21145 0x0039
#define PCI_DEVICE_ID_INTEL_82375 0x0482
#define PCI_DEVICE_ID_INTEL_82424 0x0483
#define PCI_DEVICE_ID_INTEL_82378 0x0484
#define PCI_VENDOR_ID_ADAPTEC 0x9004
#define PCI_DEVICE_ID_ADAPTEC_7810 0x1078
#define PCI_DEVICE_ID_ADAPTEC_7821 0x2178
+#define PCI_DEVICE_ID_ADAPTEC_38602 0x3860
#define PCI_DEVICE_ID_ADAPTEC_7850 0x5078
#define PCI_DEVICE_ID_ADAPTEC_7855 0x5578
#define PCI_DEVICE_ID_ADAPTEC_5800 0x5800
* If a task terminates while we're swapping the page, the vma and
* and file could be released ... increment the count to be safe.
*/
- atomic_inc(&file->f_count);
+ get_file(file);
result = do_write_page(inode, file, (const char *) page, offset);
fput(file);
return result;
}
}
-static inline int zap_pte_range(pmd_t * pmd, unsigned long address, unsigned long size)
+static inline int zap_pte_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size)
{
pte_t * pte;
int freed;
pte_t page;
if (!size)
break;
+ spin_lock(&mm->page_table_lock);
page = *pte;
pte++;
size--;
+ pte_clear(pte-1);
+ spin_unlock(&mm->page_table_lock);
if (pte_none(page))
continue;
- pte_clear(pte-1);
freed += free_pte(page);
}
return freed;
}
-static inline int zap_pmd_range(pgd_t * dir, unsigned long address, unsigned long size)
+static inline int zap_pmd_range(struct mm_struct *mm, pgd_t * dir, unsigned long address, unsigned long size)
{
pmd_t * pmd;
unsigned long end;
end = PGDIR_SIZE;
freed = 0;
do {
- freed += zap_pte_range(pmd, address, end - address);
+ freed += zap_pte_range(mm, pmd, address, end - address);
address = (address + PMD_SIZE) & PMD_MASK;
pmd++;
} while (address < end);
dir = pgd_offset(mm, address);
while (address < end) {
- freed += zap_pmd_range(dir, address, end - address);
+ freed += zap_pmd_range(mm, dir, address, end - address);
address = (address + PGDIR_SIZE) & PGDIR_MASK;
dir++;
}
vma->vm_offset += vma->vm_start - n->vm_start;
n->vm_flags = newflags;
if (n->vm_file)
- atomic_inc(&n->vm_file->f_count);
+ get_file(n->vm_file);
if (n->vm_ops && n->vm_ops->open)
n->vm_ops->open(n);
insert_vm_struct(current->mm, n);
n->vm_offset += n->vm_start - vma->vm_start;
n->vm_flags = newflags;
if (n->vm_file)
- atomic_inc(&n->vm_file->f_count);
+ get_file(n->vm_file);
if (n->vm_ops && n->vm_ops->open)
n->vm_ops->open(n);
insert_vm_struct(current->mm, n);
int error = -ENOMEM;
down(¤t->mm->mmap_sem);
- lock_kernel();
len = (len + (start & ~PAGE_MASK) + ~PAGE_MASK) & PAGE_MASK;
start &= PAGE_MASK;
error = do_mlock(start, len, 1);
out:
- unlock_kernel();
up(¤t->mm->mmap_sem);
return error;
}
int ret;
down(¤t->mm->mmap_sem);
- lock_kernel();
len = (len + (start & ~PAGE_MASK) + ~PAGE_MASK) & PAGE_MASK;
start &= PAGE_MASK;
ret = do_mlock(start, len, 0);
- unlock_kernel();
up(¤t->mm->mmap_sem);
return ret;
}
int ret = -EINVAL;
down(¤t->mm->mmap_sem);
- lock_kernel();
if (!flags || (flags & ~(MCL_CURRENT | MCL_FUTURE)))
goto out;
ret = do_mlockall(flags);
out:
- unlock_kernel();
up(¤t->mm->mmap_sem);
return ret;
}
int ret;
down(¤t->mm->mmap_sem);
- lock_kernel();
ret = do_mlockall(0);
- unlock_kernel();
up(¤t->mm->mmap_sem);
return ret;
}
if (error)
goto unmap_and_free_vma;
vma->vm_file = file;
- atomic_inc(&file->f_count);
+ get_file(file);
}
/*
mpnt->vm_file = area->vm_file;
mpnt->vm_pte = area->vm_pte;
if (mpnt->vm_file)
- atomic_inc(&mpnt->vm_file->f_count);
+ get_file(mpnt->vm_file);
if (mpnt->vm_ops && mpnt->vm_ops->open)
mpnt->vm_ops->open(mpnt);
area->vm_end = addr; /* Truncate area */
size = end - st;
lock_kernel();
-
if (mpnt->vm_ops && mpnt->vm_ops->unmap)
mpnt->vm_ops->unmap(mpnt, st, size);
+ unlock_kernel();
remove_shared_vm_struct(mpnt);
mm->map_count--;
* Fix the mapping, and free the old area if it wasn't reused.
*/
extra = unmap_fixup(mpnt, st, size, extra);
-
- unlock_kernel();
}
/* Release the extra vma struct if it wasn't used */
flags = vma->vm_flags;
addr = vma->vm_start;
- lock_kernel(); /* kswapd, ugh */
insert_vm_struct(mm, vma);
merge_segments(mm, vma->vm_start, vma->vm_end);
- unlock_kernel();
mm->total_vm += len >> PAGE_SHIFT;
if (flags & VM_LOCKED) {
n->vm_flags = newflags;
n->vm_page_prot = prot;
if (n->vm_file)
- atomic_inc(&n->vm_file->f_count);
+ get_file(n->vm_file);
if (n->vm_ops && n->vm_ops->open)
n->vm_ops->open(n);
insert_vm_struct(current->mm, n);
n->vm_flags = newflags;
n->vm_page_prot = prot;
if (n->vm_file)
- atomic_inc(&n->vm_file->f_count);
+ get_file(n->vm_file);
if (n->vm_ops && n->vm_ops->open)
n->vm_ops->open(n);
insert_vm_struct(current->mm, n);
return 0;
down(¤t->mm->mmap_sem);
- lock_kernel();
vma = find_vma(current->mm, start);
error = -EFAULT;
}
merge_segments(current->mm, start, end);
out:
- unlock_kernel();
up(¤t->mm->mmap_sem);
return error;
}
return pte;
}
-static inline int copy_one_pte(pte_t * src, pte_t * dst)
+static inline int copy_one_pte(struct mm_struct *mm, pte_t * src, pte_t * dst)
{
int error = 0;
- pte_t pte = *src;
+ pte_t pte;
+ spin_lock(&mm->page_table_lock);
+ pte = *src;
if (!pte_none(pte)) {
error++;
if (dst) {
error--;
}
}
+ spin_unlock(&mm->page_table_lock);
return error;
}
src = get_one_pte(mm, old_addr);
if (src)
- error = copy_one_pte(src, alloc_one_pte(mm, new_addr));
+ error = copy_one_pte(mm, src, alloc_one_pte(mm, new_addr));
return error;
}
new_vma->vm_start = new_addr;
new_vma->vm_end = new_addr+new_len;
new_vma->vm_offset = vma->vm_offset + (addr - vma->vm_start);
- lock_kernel();
if (new_vma->vm_file)
- atomic_inc(&new_vma->vm_file->f_count);
+ get_file(new_vma->vm_file);
if (new_vma->vm_ops && new_vma->vm_ops->open)
new_vma->vm_ops->open(new_vma);
insert_vm_struct(current->mm, new_vma);
merge_segments(current->mm, new_vma->vm_start, new_vma->vm_end);
- unlock_kernel();
do_munmap(addr, old_len);
current->mm->total_vm += new_len >> PAGE_SHIFT;
if (new_vma->vm_flags & VM_LOCKED) {
* in flight we are in use.
*/
if(s->socket && s->socket->file &&
- atomic_read(&s->socket->file->f_count) > s->protinfo.af_unix.inflight)
+ file_count(s->socket->file) > s->protinfo.af_unix.inflight)
maybe_unmark_and_push(s);
}