aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavem <davem>2002-01-15 05:18:16 +0000
committerdavem <davem>2002-01-15 05:18:16 +0000
commit31824c6359507be0612933ceba36d445afbf8742 (patch)
tree3e7ed66369e6ccf4d7f31d12e9196c2daff85ce0
parentf73f54a767ced40befc69a7047d9821b2d8be939 (diff)
downloadnetdev-vger-cvs-31824c6359507be0612933ceba36d445afbf8742.tar.gz
Back out a lot of local changes which will
get propagated from 2.4.x anyways and are only getting in the way of my work currently.
-rw-r--r--CREDITS19
-rw-r--r--Documentation/Changes5
-rw-r--r--Documentation/filesystems/Locking15
-rw-r--r--Documentation/filesystems/tmpfs.txt102
-rw-r--r--Documentation/pci.txt4
-rw-r--r--Documentation/video4linux/Zoran6
-rw-r--r--Documentation/video4linux/w9966.txt40
-rw-r--r--MAINTAINERS12
-rw-r--r--arch/i386/kernel/nmi.c2
-rw-r--r--arch/ppc/kernel/entry.S11
-rw-r--r--arch/ppc/kernel/misc.S8
-rw-r--r--arch/ppc/kernel/process.c28
-rw-r--r--arch/ppc/kernel/ptrace.c13
-rw-r--r--arch/ppc/kernel/signal.c20
-rw-r--r--arch/ppc/kernel/smp.c21
-rw-r--r--arch/ppc/mm/ppc_mmu.c3
-rw-r--r--drivers/atm/eni.c2
-rw-r--r--drivers/atm/firestream.c2
-rw-r--r--drivers/char/agp/agpgart_be.c14
-rw-r--r--drivers/char/drm/Config.in1
-rw-r--r--drivers/char/drm/Makefile7
-rw-r--r--drivers/char/drm/drm.h4
-rw-r--r--drivers/char/drm/drm_context.h11
-rw-r--r--drivers/char/drm/sis.h56
-rw-r--r--drivers/char/drm/sis_drm.h36
-rw-r--r--drivers/char/drm/sis_drv.c74
-rw-r--r--drivers/char/drm/sis_drv.h45
-rw-r--r--drivers/char/drm/sis_ds.c406
-rw-r--r--drivers/char/drm/sis_ds.h163
-rw-r--r--drivers/char/drm/sis_mm.c307
-rw-r--r--drivers/char/ip2.c3
-rw-r--r--drivers/char/ip2/i2cmd.c2
-rw-r--r--drivers/char/joystick/cs461x.c2
-rw-r--r--drivers/char/joystick/emu10k1-gp.c2
-rw-r--r--drivers/char/joystick/pcigame.c2
-rw-r--r--drivers/char/mem.c46
-rw-r--r--drivers/char/pcmcia/serial_cs.c47
-rw-r--r--drivers/char/serial.c20
-rw-r--r--drivers/ieee1394/ohci1394.c2
-rw-r--r--drivers/media/radio/radio-gemtek-pci.c2
-rw-r--r--drivers/media/radio/radio-maxiradio.c2
-rw-r--r--drivers/media/video/Config.in6
-rw-r--r--drivers/media/video/bttv-driver.c2
-rw-r--r--drivers/media/video/meye.c2
-rw-r--r--drivers/media/video/w9966.c142
-rw-r--r--drivers/net/3c59x.c2
-rw-r--r--drivers/net/8139cp.c2
-rw-r--r--drivers/net/8139too.c13
-rw-r--r--drivers/net/arcnet/com20020-pci.c2
-rw-r--r--drivers/net/defxx.c2
-rw-r--r--drivers/net/dl2k.c2
-rw-r--r--drivers/net/eepro100.c18
-rw-r--r--drivers/net/epic100.c2
-rw-r--r--drivers/net/fealnx.c2
-rw-r--r--drivers/net/ioc3-eth.c2
-rw-r--r--drivers/net/irda/vlsi_ir.c2
-rw-r--r--drivers/net/natsemi.c2
-rw-r--r--drivers/net/ne2k-pci.c2
-rw-r--r--drivers/net/ns83820.c2
-rw-r--r--drivers/net/pci-skeleton.c2
-rw-r--r--drivers/net/pcmcia/Config.in2
-rw-r--r--drivers/net/pcmcia/ax8390.h193
-rw-r--r--drivers/net/pcmcia/axnet_cs.c216
-rw-r--r--drivers/net/pcmcia/netwave_cs.c3
-rw-r--r--drivers/net/pcmcia/xircom_cb.c2
-rw-r--r--drivers/net/pcmcia/xircom_tulip_cb.c2
-rw-r--r--drivers/net/sis900.c2
-rw-r--r--drivers/net/starfire.c2
-rw-r--r--drivers/net/sundance.c2
-rw-r--r--drivers/net/tlan.c2
-rw-r--r--drivers/net/tokenring/lanstreamer.c2
-rw-r--r--drivers/net/tokenring/olympic.c2
-rw-r--r--drivers/net/tulip/tulip_core.c2
-rw-r--r--drivers/net/via-rhine.c2
-rw-r--r--drivers/net/wan/comx-hw-mixcom.c2
-rw-r--r--drivers/net/wan/farsync.c2
-rw-r--r--drivers/net/winbond-840.c2
-rw-r--r--drivers/net/wireless/airo.c2
-rw-r--r--drivers/net/wireless/orinoco_plx.c2
-rw-r--r--drivers/net/yellowfin.c2
-rw-r--r--drivers/parport/ChangeLog30
-rw-r--r--drivers/parport/Config.in10
-rw-r--r--drivers/parport/daisy.c2
-rw-r--r--drivers/parport/ieee1284_ops.c44
-rw-r--r--drivers/parport/parport_cs.c87
-rw-r--r--drivers/parport/parport_pc.c17
-rw-r--r--drivers/parport/parport_serial.c2
-rw-r--r--drivers/pcmcia/cistpl.c4
-rw-r--r--drivers/pcmcia/cs.c8
-rw-r--r--drivers/pcmcia/cs_internal.h6
-rw-r--r--drivers/pcmcia/pci_socket.c2
-rw-r--r--drivers/pcmcia/rsrc_mgr.c119
-rw-r--r--drivers/scsi/NCR5380.c1884
-rw-r--r--drivers/scsi/NCR5380.h282
-rw-r--r--drivers/scsi/g_NCR5380.c1060
-rw-r--r--drivers/scsi/g_NCR5380.h18
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c72
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c41
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c38
-rw-r--r--drivers/sound/Config.in3
-rw-r--r--drivers/sound/Makefile1
-rw-r--r--drivers/sound/btaudio.c2
-rw-r--r--drivers/sound/cs46xx.c2
-rw-r--r--drivers/sound/emu10k1/main.c2
-rw-r--r--drivers/sound/i810_audio.c14
-rw-r--r--drivers/sound/ymfpci.c157
-rw-r--r--drivers/usb/auerswald.c6
-rw-r--r--drivers/usb/uhci.c2
-rw-r--r--drivers/usb/usb-ohci.c2
-rw-r--r--drivers/usb/usb-uhci.c2
-rw-r--r--drivers/usb/usbnet.c5
-rw-r--r--drivers/video/aty/atyfb_base.c136
-rw-r--r--drivers/video/cyber2000fb.c2
-rw-r--r--drivers/video/imsttfb.c2
-rw-r--r--drivers/video/matrox/matroxfb_base.c1
-rw-r--r--drivers/video/modedb.c2
-rw-r--r--drivers/video/radeonfb.c2
-rw-r--r--drivers/video/riva/fbdev.c2
-rw-r--r--drivers/video/tdfxfb.c2
-rw-r--r--fs/inode.c2
-rw-r--r--fs/nfs/nfs3proc.c31
-rw-r--r--fs/nfs/pagelist.c2
-rw-r--r--fs/nfs/read.c3
-rw-r--r--fs/nfs/unlink.c2
-rw-r--r--fs/nfs/write.c52
-rw-r--r--include/asm-i386/mmu_context.h7
-rw-r--r--include/asm-ia64/pal.h8
-rw-r--r--include/asm-ia64/siginfo.h8
-rw-r--r--include/linux/init.h16
-rw-r--r--include/linux/mm.h13
-rw-r--r--include/linux/nfs_fs.h24
-rw-r--r--include/linux/raid/md_k.h2
-rw-r--r--include/linux/sysctl.h4
-rw-r--r--include/pcmcia/ciscode.h8
-rw-r--r--include/pcmcia/cs.h7
-rw-r--r--include/pcmcia/version.h6
-rw-r--r--kernel/sysctl.c4
-rw-r--r--kernel/time.c8
-rw-r--r--mm/filemap.c12
-rw-r--r--mm/memory.c19
-rw-r--r--mm/shmem.c30
-rw-r--r--mm/vmalloc.c38
142 files changed, 2829 insertions, 3772 deletions
diff --git a/CREDITS b/CREDITS
index 8a002fc77..d73f905e9 100644
--- a/CREDITS
+++ b/CREDITS
@@ -1169,16 +1169,6 @@ S: 5000 Forbes Avenue
S: Pittsburgh, Pennsylvania 15213
S: USA
-N: Jan Harkes
-E: jaharkes@cs.cmu.edu
-W: http://www.coda.cs.cmu.edu/
-D: Coda file system
-S: Computer Science Department
-S: Carnegie Mellon University
-S: 5000 Forbes Avenue
-S: Pittsburgh, Pennsylvania 15213
-S: USA
-
N: Kai Harrekilde-Petersen
E: kai.harrekilde@get2net.dk
D: Original author of the ftape-HOWTO, i82078 fdc detection code.
@@ -1666,13 +1656,6 @@ S: ul. Matemblewska 1B/10
S: 80-283 Gdansk
S: Poland
-N: Jakob Kemi
-E: jakob.kemi@telia.com
-D: V4L W9966 Webcam driver
-S: Forsbyvägen 33
-S: 74143 Knivsta
-S: Sweden
-
N: Gero Kuhlmann
E: gero@gkminix.han.de
D: mounting root via NFS
@@ -2539,7 +2522,7 @@ S: Wanniassa ACT 2903
S: Australia
N: Gerard Roudier
-E: groudier@free.fr
+E: groudier@iplus.fr
D: Contributed to asynchronous read-ahead improvement
S: 21 Rue Carnot
S: 95170 Deuil La Barre
diff --git a/Documentation/Changes b/Documentation/Changes
index f7e251222..8551fc7c8 100644
--- a/Documentation/Changes
+++ b/Documentation/Changes
@@ -53,7 +53,7 @@ o Gnu make 3.77 # make --version
o binutils 2.9.5.0.24 # ld -v
o util-linux 2.10o # fdformat --version
o modutils 2.4.2 # insmod -V
-o e2fsprogs 1.25 # tune2fs
+o e2fsprogs 1.19 # tune2fs
o reiserfsprogs 3.x.0j # reiserfsck 2>&1|grep reiserfsprogs
o pcmcia-cs 3.1.21 # cardmgr -V
o PPP 2.4.0 # pppd --version
@@ -304,7 +304,8 @@ o <ftp://rawhide.redhat.com/pub/rawhide/SRPMS/SRPMS/>
E2fsprogs
---------
-o <http://prdownloads.sourceforge.net/e2fsprogs/e2fsprogs-1.25.tar.gz>
+o <http://prdownloads.sourceforge.net/e2fsprogs/e2fsprogs-1.19.tar.gz>
+o <http://prdownloads.sourceforge.net/e2fsprogs/e2fsprogs-1.19-0.src.rpm>
Reiserfsprogs
-------------
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index c1d3e522b..8e7276b35 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -123,10 +123,6 @@ prototypes:
int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
int (*bmap)(struct address_space *, long);
- int (*flushpage) (struct page *, unsigned long);
- int (*releasepage) (struct page *, int);
- int (*direct_IO)(int, struct inode *, struct kiobuf *, unsigned long, int);
-
locking rules:
All may block
BKL PageLocked(page)
@@ -136,8 +132,6 @@ sync_page: no maybe
prepare_write: no yes
commit_write: no yes
bmap: yes
-flushpage: no yes
-releasepage: no yes
->prepare_write(), ->commit_write(), ->sync_page() and ->readpage()
may be called from the request handler (/dev/loop).
@@ -150,15 +144,6 @@ well-defined...
filesystems and by the swapper. The latter will eventually go away. All
instances do not actually need the BKL. Please, keep it that way and don't
breed new callers.
- ->flushpage() is called when the filesystem must attempt to drop
-some or all of the buffers from the page when it is being truncated. It
-returns zero on success. If ->flushpage is zero, the kernel uses
-block_flushpage() instead.
- ->releasepage() is called when the kernel is about to try to drop the
-buffers from the page in preparation for freeing it. It returns zero to
-indicate that the buffers are (or may be) freeable. If ->flushpage is zero,
-the kernel assumes that the fs has no private interest in the buffers.
-
Note: currently almost all instances of address_space methods are
using BKL for internal serialization and that's one of the worst sources
of contention. Normally they are calling library functions (in fs/buffer.c)
diff --git a/Documentation/filesystems/tmpfs.txt b/Documentation/filesystems/tmpfs.txt
deleted file mode 100644
index cc78cab18..000000000
--- a/Documentation/filesystems/tmpfs.txt
+++ /dev/null
@@ -1,102 +0,0 @@
-Tmpfs is a file system which keeps all files in virtual memory.
-
-
-Everything in tmpfs is temporary in the sense that no files will be
-created on your hard drive. If you unmount a tmpfs instance,
-everything stored therein is lost.
-
-tmpfs puts everything into the kernel internal caches and grows and
-shrinks to accommodate the files it contains and is able to swap
-unneeded pages out to swap space. It has maximum size limits which can
-be adjusted on the fly via 'mount -o remount ...'
-
-If you compare it to ramfs (which was the template to create tmpfs)
-you gain swapping and limit checking. Another similar thing is the RAM
-disk (/dev/ram*), which simulates a fixed size hard disk in physical
-RAM, where you have to create an ordinary filesystem on top. Ramdisks
-cannot swap and you do not have the possibility to resize them.
-
-Since tmpfs lives completely in the page cache and on swap, all tmpfs
-pages currently in memory will show up as cached. It will not show up
-as shared or something like that. Further on you can check the actual
-RAM+swap use of a tmpfs instance with df(1) and du(1).
-
-
-tmpfs has the following uses:
-
-1) There is always a kernel internal mount which you will not see at
- all. This is used for shared anonymous mappings and SYSV shared
- memory.
-
- This mount does not depend on CONFIG_TMPFS. If CONFIG_TMPFS is not
- set, the user visible part of tmpfs is not build. But the internal
- mechanisms are always present.
-
-2) glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
- POSIX shared memory (shm_open, shm_unlink). Adding the following
- line to /etc/fstab should take care of this:
-
- tmpfs /dev/shm tmpfs defaults 0 0
-
- Remember to create the directory that you intend to mount tmpfs on
- if necessary (/dev/shm is automagically created if you use devfs).
-
- This mount is _not_ needed for SYSV shared memory. The internal
- mount is used for that. (In the 2.3 kernel versions it was
- necessary to mount the predecessor of tmpfs (shm fs) to use SYSV
- shared memory)
-
-3) Some people (including me) find it very convenient to mount it
- e.g. on /tmp and /var/tmp and have a big swap partition. But be
- aware: loop mounts of tmpfs files do not work due to the internal
- design. So mkinitrd shipped by most distributions will fail with a
- tmpfs /tmp.
-
-4) And probably a lot more I do not know about :-)
-
-
-tmpfs has a couple of mount options:
-
-size: The limit of allocated bytes for this tmpfs instance. The
- default is half of your physical RAM without swap. If you
- oversize your tmpfs instances the machine will deadlock
- since the OOM handler will not be able to free that memory.
-nr_blocks: The same as size, but in blocks of PAGECACHE_SIZE.
-nr_inodes: The maximum number of inodes for this instance. The default
- is half of the number of your physical RAM pages.
-
-These parameters accept a suffix k, m or g for kilo, mega and giga and
-can be changed on remount.
-
-To specify the initial root directory you can use the following mount
-options:
-
-mode: The permissions as an octal number
-uid: The user id
-gid: The group id
-
-These options do not have any effect on remount. You can change these
-parameters with chmod(1), chown(1) and chgrp(1) on a mounted filesystem.
-
-
-So 'mount -t tmpfs -o size=10G,nr_inodes=10k,mode=700 tmpfs /mytmpfs'
-will give you tmpfs instance on /mytmpfs which can allocate 10GB
-RAM/SWAP in 10240 inodes and it is only accessible by root.
-
-
-TODOs:
-
-1) give the size option a percent semantic: If you give a mount option
- size=50% the tmpfs instance should be able to grow to 50 percent of
- RAM + swap. So the instance should adapt automatically if you add
- or remove swap space.
-2) loop mounts: This is difficult since loop.c relies on the readpage
- operation. This operation gets a page from the caller to be filled
- with the content of the file at that position. But tmpfs always has
- the page and thus cannot copy the content to the given page. So it
- cannot provide this operation. The VM had to be changed seriously
- to achieve this.
-3) Show the number of tmpfs RAM pages. (As shared?)
-
-Author:
- Christoph Rohland <cr@sap.com>, 1.12.01
diff --git a/Documentation/pci.txt b/Documentation/pci.txt
index 5ac05854a..dadb9a9dc 100644
--- a/Documentation/pci.txt
+++ b/Documentation/pci.txt
@@ -104,10 +104,6 @@ Tips:
If you are sure the driver is not a hotplug driver then use only
__init/exit __initdata/exitdata.
- Pointers to functions marked as __devexit must be created using
- __devexit_p(function_name). That will generate the function
- name or NULL if the __devexit function will be discarded.
-
2. How to find PCI devices manually (the old style)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/Documentation/video4linux/Zoran b/Documentation/video4linux/Zoran
index e1dda3e4a..67d87ff8f 100644
--- a/Documentation/video4linux/Zoran
+++ b/Documentation/video4linux/Zoran
@@ -160,9 +160,9 @@ grabbing facilities, you must either
set aside the necessary memory during boot time. There seem to be
several versions of this patch against various kernel versions
floating around in the net, you may obtain one e.g. from:
- http://www.polyware.nl/~middelin/hob-v4l.html#bigphysarea
- You also have to compile your driver AFTER installing that patch in
- order to get it working
+ http://www.polyware.nl/~middelin/patch/bigphysarea-2.2.1.tar.gz You
+ also have to compile your driver AFTER installing that patch in order
+ to get it working
or
diff --git a/Documentation/video4linux/w9966.txt b/Documentation/video4linux/w9966.txt
index e7ac33a7e..d132c4301 100644
--- a/Documentation/video4linux/w9966.txt
+++ b/Documentation/video4linux/w9966.txt
@@ -1,33 +1,37 @@
-W9966 Camera driver, written by Jakob Kemi (jakob.kemi@telia.com)
-After a lot of work in softice & wdasm, reading .pdf-files and tiresome
-trial-and-error work I've finally got everything to work. I needed vision for a
-robotics project so I borrowed this camera from a friend and started hacking.
-Anyway I've converted my original code from the AVR 8bit RISC C/ASM code into
-a working Linux driver.
+W9966 Camera driver, written by Jakob Kemi (jakob.kemi@post.utfors.se)
-To get it working simply configure your kernel to support
-parport, ieee1284, video4linux and w9966
+Ok, after a lot of work in softice, wdasm, reading pdf-files
+and trial-and-error work I've finally got everything to work.
+Since I needed some vision for a robotics project I borrowed
+this camera from a friend and started hacking. Anyway I've
+converted my original code from the AVR 8bit RISC C/asm
+into a working linux driver. I would really appreciate _any_
+kind of feedback regarding this driver.
-If w9966 is statically linked it will always perform aggressive probing for
-the camera. If built as a module you'll have more configuration options.
+To get it working quickly configure your kernel
+to support parport, ieee1284, video4linux, experimental drivers
+and w9966
+
+If w9966 is statically linked it will perform aggressive probing
+for the camera. If built as a module you'll have more configuration options.
Options:
- modprobe w9966.o pardev=parport0(or whatever) parmode=0 (0=auto, 1=ecp, 2=epp)
+modprobe w9966.o pardev=parport0(or whatever) parmode=0 (0=auto, 1=ecp, 2=epp)
+
voila!
you can also type 'modinfo -p w9966.o' for option usage
(or checkout w9966.c)
-The only thing to keep in mind is that the image format is in Y-U-Y-V format
-where every two pixels take 4 bytes. In SDL (www.libsdl.org) this format
-is called VIDEO_PALETTE_YUV422 (16 bpp).
-
-A minimal test application (with source) is available from:
- http://hem.fyristorg.com/mogul/w9966.html
+I've only tested it with custom built testprograms
+(http://hem.fyristorg.com/mogul/w9966.html) and with gqcam.
+(you'll need to tweak the code to qcam a bit to make it work,
+dimensions and such)
The slow framerate is due to missing DMA ECP read support in the
parport drivers. I might add working EPP support later.
Good luck!
- /Jakob Kemi
+
+ /Jakob
diff --git a/MAINTAINERS b/MAINTAINERS
index 936f12205..bbace6caf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -412,12 +412,6 @@ W: http://www.sucs.swan.ac.uk/~rohan/DECnet/index.html
L: linux-decnet-user@lists.sourceforge.net
S: Maintained
-DELL LAPTOP SMM DRIVER
-P: Massimo Dal Zotto
-M: dz@debian.org
-W: http://www.debian.org/~dz/i8k/
-S: Maintained
-
DEVICE NUMBER REGISTRY
P: H. Peter Anvin
M: hpa@zytor.com
@@ -932,12 +926,6 @@ L: linux-LVM@sistina.com
W: http://www.sistina.com/lvm
S: Maintained
-LSILOGIC/SYMBIOS/NCR 53C8XX and 53C1010 PCI-SCSI drivers
-P: Gerard Roudier
-M: groudier@free.fr
-L: linux-scsi@vger.kernel.org
-S: Maintained
-
M68K
P: Jes Sorensen
M: jes@trained-monkey.org
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index d991ca7b3..a73237983 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -276,7 +276,7 @@ void nmi_watchdog_tick (struct pt_regs * regs)
* wait a few IRQs (5 seconds) before doing the oops ...
*/
alert_counter[cpu]++;
- if (alert_counter[cpu] == 10*nmi_hz) {
+ if (alert_counter[cpu] == 5*nmi_hz) {
spin_lock(&nmi_print_lock);
/*
* We are in trouble anyway, lets at least try
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
index d5c7eaa3a..5ab5d6df6 100644
--- a/arch/ppc/kernel/entry.S
+++ b/arch/ppc/kernel/entry.S
@@ -1,5 +1,5 @@
/*
- * BK Id: SCCS/s.entry.S 1.24 11/23/01 16:38:29 paulus
+ * BK Id: SCCS/s.entry.S 1.22 08/15/01 22:43:06 paulus
*/
/*
* PowerPC version
@@ -216,7 +216,6 @@ _GLOBAL(_switch)
SAVE_8GPRS(14, r1)
SAVE_10GPRS(22, r1)
mflr r20 /* Return to switch caller */
- stw r20,INT_FRAME_SIZE+4(r1)
mfmsr r22
li r0,MSR_FP /* Disable floating-point */
#ifdef CONFIG_ALTIVEC
@@ -224,12 +223,10 @@ BEGIN_FTR_SECTION
oris r0,r0,MSR_VEC@h /* Disable altivec */
END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
#endif /* CONFIG_ALTIVEC */
- and. r0,r0,r22 /* FP or altivec enabled? */
- beq+ 1f
andc r22,r22,r0
mtmsr r22
isync
-1: stw r20,_NIP(r1)
+ stw r20,_NIP(r1)
stw r22,_MSR(r1)
stw r20,_LINK(r1)
mfcr r20
@@ -394,9 +391,9 @@ enter_rtas:
mfmsr r9
stw r9,8(r1)
li r0,0
- ori r0,r0,MSR_EE|MSR_SE|MSR_BE|MSR_FE0|MSR_FE1
+ ori r0,r0,MSR_EE|MSR_SE|MSR_BE
andc r0,r9,r0
- li r10,MSR_IR|MSR_DR|MSR_FP
+ li r10,MSR_IR|MSR_DR|MSR_FE0|MSR_FE1|MSR_FP
andc r9,r0,r10
SYNC /* disable interrupts so SRR0/1 */
mtmsr r0 /* don't get trashed */
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
index 8ebf09ec0..52e7b4e2e 100644
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -1,5 +1,5 @@
/*
- * BK Id: SCCS/s.misc.S 1.34 11/23/01 16:38:29 paulus
+ * BK Id: SCCS/s.misc.S 1.32 10/18/01 17:29:53 trini
*/
/*
* This file contains miscellaneous low-level functions.
@@ -866,8 +866,10 @@ _GLOBAL(kernel_thread)
sc
cmpi 0,r3,0 /* parent or child? */
bnelr /* return if parent */
- li r0,0 /* make top-level stack frame */
- stwu r0,-16(r1)
+ li r0,0 /* clear out p->thread.regs */
+ stw r0,THREAD+PT_REGS(r2) /* since we don't have user ctx */
+ addi r1,r2,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
+ stw r0,0(r1)
mtlr r6 /* fn addr in lr */
mr r3,r4 /* load arg and call fn */
blrl
diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c
index 28d7548ed..eca832613 100644
--- a/arch/ppc/kernel/process.c
+++ b/arch/ppc/kernel/process.c
@@ -1,5 +1,5 @@
/*
- * BK Id: SCCS/s.process.c 1.34 11/23/01 16:38:29 paulus
+ * BK Id: SCCS/s.process.c 1.31 10/02/01 09:51:41 paulus
*/
/*
* linux/arch/ppc/kernel/process.c
@@ -336,10 +336,9 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
/* for kernel thread, set `current' and stackptr in new task */
childregs->gpr[1] = sp + sizeof(struct pt_regs);
childregs->gpr[2] = (unsigned long) p;
- p->thread.regs = NULL; /* no user register state */
- } else
- p->thread.regs = childregs;
+ }
childregs->gpr[3] = 0; /* Result from fork() */
+ p->thread.regs = childregs;
sp -= STACK_FRAME_OVERHEAD;
childframe = sp;
@@ -466,27 +465,6 @@ print_backtrace(unsigned long *sp)
printk("\n");
}
-void show_trace_task(struct task_struct *tsk)
-{
- unsigned long stack_top = (unsigned long) tsk + THREAD_SIZE;
- unsigned long sp, prev_sp;
- int count = 0;
-
- if (tsk == NULL)
- return;
- sp = (unsigned long) &tsk->thread.ksp;
- do {
- prev_sp = sp;
- sp = *(unsigned long *)sp;
- if (sp <= prev_sp || sp >= stack_top || (sp & 3) != 0)
- break;
- if (count > 0)
- printk("[%08lx] ", *(unsigned long *)(sp + 4));
- } while (++count < 16);
- if (count > 1)
- printk("\n");
-}
-
#if 0
/*
* Low level print for debugging - Cort
diff --git a/arch/ppc/kernel/ptrace.c b/arch/ppc/kernel/ptrace.c
index b24da58d4..993068c91 100644
--- a/arch/ppc/kernel/ptrace.c
+++ b/arch/ppc/kernel/ptrace.c
@@ -1,5 +1,5 @@
/*
- * BK Id: SCCS/s.ptrace.c 1.12 11/23/01 16:38:30 paulus
+ * BK Id: SCCS/s.ptrace.c 1.8 07/07/01 17:00:08 paulus
*/
/*
* linux/arch/ppc/kernel/ptrace.c
@@ -132,9 +132,14 @@ int sys_ptrace(long request, long pid, long addr, long data)
ret = ptrace_attach(child);
goto out_tsk;
}
-
- ret = ptrace_check_attach(child, request == PTRACE_KILL);
- if (ret < 0)
+ ret = -ESRCH;
+ if (!(child->ptrace & PT_PTRACED))
+ goto out_tsk;
+ if (child->state != TASK_STOPPED) {
+ if (request != PTRACE_KILL)
+ goto out_tsk;
+ }
+ if (child->p_pptr != current)
goto out_tsk;
switch (request) {
diff --git a/arch/ppc/kernel/signal.c b/arch/ppc/kernel/signal.c
index 45b4f7759..99a76902d 100644
--- a/arch/ppc/kernel/signal.c
+++ b/arch/ppc/kernel/signal.c
@@ -1,5 +1,5 @@
/*
- * BK Id: SCCS/s.signal.c 1.10 11/23/01 16:38:30 paulus
+ * BK Id: SCCS/s.signal.c 1.7 05/17/01 18:14:22 cort
*/
/*
* linux/arch/ppc/kernel/signal.c
@@ -180,7 +180,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
siginitset(&new_ka.sa.sa_mask, mask);
}
- ret = do_sigaction(sig, (act? &new_ka: NULL), (oact? &old_ka: NULL));
+ ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) ||
@@ -254,8 +254,6 @@ int sys_rt_sigreturn(struct pt_regs *regs)
current->blocked = set;
recalc_sigpending(current);
spin_unlock_irq(&current->sigmask_lock);
- if (regs->msr & MSR_FP)
- giveup_fpu(current);
rt_sf++; /* Look at next rt_sigframe */
if (rt_sf == (struct rt_sigframe *)(sigctx.regs)) {
@@ -265,6 +263,8 @@ int sys_rt_sigreturn(struct pt_regs *regs)
* see handle_signal()
*/
sr = (struct sigregs *) sigctx.regs;
+ if (regs->msr & MSR_FP )
+ giveup_fpu(current);
if (copy_from_user(saved_regs, &sr->gp_regs,
sizeof(sr->gp_regs)))
goto badframe;
@@ -298,7 +298,6 @@ int sys_rt_sigreturn(struct pt_regs *regs)
if (get_user(prevsp, &sr->gp_regs[PT_R1])
|| put_user(prevsp, (unsigned long *) regs->gpr[1]))
goto badframe;
- current->thread.fpscr = 0;
}
return ret;
@@ -329,7 +328,6 @@ setup_rt_frame(struct pt_regs *regs, struct sigregs *frame,
goto badframe;
flush_icache_range((unsigned long) &frame->tramp[0],
(unsigned long) &frame->tramp[2]);
- current->thread.fpscr = 0; /* turn off all fp exceptions */
/* Retrieve rt_sigframe from stack and
set up registers for signal handler
@@ -381,13 +379,13 @@ int sys_sigreturn(struct pt_regs *regs)
current->blocked = set;
recalc_sigpending(current);
spin_unlock_irq(&current->sigmask_lock);
- if (regs->msr & MSR_FP )
- giveup_fpu(current);
sc++; /* Look at next sigcontext */
if (sc == (struct sigcontext_struct *)(sigctx.regs)) {
/* Last stacked signal - restore registers */
sr = (struct sigregs *) sigctx.regs;
+ if (regs->msr & MSR_FP )
+ giveup_fpu(current);
if (copy_from_user(saved_regs, &sr->gp_regs,
sizeof(sr->gp_regs)))
goto badframe;
@@ -415,7 +413,6 @@ int sys_sigreturn(struct pt_regs *regs)
if (get_user(prevsp, &sr->gp_regs[PT_R1])
|| put_user(prevsp, (unsigned long *) regs->gpr[1]))
goto badframe;
- current->thread.fpscr = 0;
}
return ret;
@@ -434,8 +431,8 @@ setup_frame(struct pt_regs *regs, struct sigregs *frame,
if (verify_area(VERIFY_WRITE, frame, sizeof(*frame)))
goto badframe;
- if (regs->msr & MSR_FP)
- giveup_fpu(current);
+ if (regs->msr & MSR_FP)
+ giveup_fpu(current);
if (__copy_to_user(&frame->gp_regs, regs, GP_REGS_SIZE)
|| __copy_to_user(&frame->fp_regs, current->thread.fpr,
ELF_NFPREG * sizeof(double))
@@ -444,7 +441,6 @@ setup_frame(struct pt_regs *regs, struct sigregs *frame,
goto badframe;
flush_icache_range((unsigned long) &frame->tramp[0],
(unsigned long) &frame->tramp[2]);
- current->thread.fpscr = 0; /* turn off all fp exceptions */
newsp -= __SIGNAL_FRAMESIZE;
if (put_user(regs->gpr[1], (unsigned long *)newsp)
diff --git a/arch/ppc/kernel/smp.c b/arch/ppc/kernel/smp.c
index a76cf7661..cf202435f 100644
--- a/arch/ppc/kernel/smp.c
+++ b/arch/ppc/kernel/smp.c
@@ -1,5 +1,5 @@
/*
- * BK Id: SCCS/s.smp.c 1.37 11/23/01 16:38:30 paulus
+ * BK Id: SCCS/s.smp.c 1.34 10/11/01 12:06:01 trini
*/
/*
* Smp support for ppc.
@@ -38,6 +38,8 @@
#include <asm/residual.h>
#include <asm/time.h>
+#include "open_pic.h"
+
int smp_threads_ready;
volatile int smp_commenced;
int smp_num_cpus = 1;
@@ -323,8 +325,21 @@ void __init smp_boot_cpus(void)
struct pt_regs regs;
/* create a process for the processor */
- /* only regs.msr is actually used, and 0 is OK for it */
+ /* we don't care about the values in regs since we'll
+ never reschedule the forked task. */
+ /* We DO care about one bit in the pt_regs we
+ pass to do_fork. That is the MSR_FP bit in
+ regs.msr. If that bit is on, then do_fork
+ (via copy_thread) will call giveup_fpu.
+ giveup_fpu will get a pointer to our (current's)
+ last register savearea via current->thread.regs
+ and using that pointer will turn off the MSR_FP,
+ MSR_FE0 and MSR_FE1 bits. At this point, this
+ pointer is pointing to some arbitrary point within
+ our stack. */
+
memset(&regs, 0, sizeof(struct pt_regs));
+
if (do_fork(CLONE_VM|CLONE_PID, 0, &regs, 0) < 0)
panic("failed fork for CPU %d", i);
p = init_task.prev_task;
@@ -492,6 +507,8 @@ void __init smp_callin(void)
smp_ops->setup_cpu(cpu);
+ init_idle();
+
/*
* This cpu is now "online". Only set them online
* before they enter the loop below since write access
diff --git a/arch/ppc/mm/ppc_mmu.c b/arch/ppc/mm/ppc_mmu.c
index 2a33e86e4..834b79378 100644
--- a/arch/ppc/mm/ppc_mmu.c
+++ b/arch/ppc/mm/ppc_mmu.c
@@ -304,9 +304,6 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
if (Hash == 0 || nopreload)
return;
- /* We only want HPTEs for linux PTEs that have _PAGE_ACCESSED set */
- if (!pte_young(pte))
- return;
mm = (address < TASK_SIZE)? vma->vm_mm: &init_mm;
pmd = pmd_offset(pgd_offset(mm, address), address);
if (!pmd_none(*pmd)) {
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 638e8d0ef..9ca723bb6 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -2310,7 +2310,7 @@ static struct pci_driver eni_driver = {
name: DEV_LABEL,
id_table: eni_pci_tbl,
probe: eni_init_one,
- remove: __devexit_p(eni_remove_one),
+ remove: eni_remove_one,
};
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 4db7ab6a3..a6a9046de 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -2102,7 +2102,7 @@ static struct pci_driver firestream_driver = {
name: "firestream",
id_table: firestream_pci_tbl,
probe: firestream_init_one,
- remove: __devexit_p(firestream_remove_one),
+ remove: firestream_remove_one,
};
static int __init firestream_init_module (void)
diff --git a/drivers/char/agp/agpgart_be.c b/drivers/char/agp/agpgart_be.c
index e28fd5eed..630ef9c4a 100644
--- a/drivers/char/agp/agpgart_be.c
+++ b/drivers/char/agp/agpgart_be.c
@@ -409,18 +409,8 @@ static void agp_generic_agp_enable(u32 mode)
* AGP devices and collect their data.
*/
-
- pci_for_each_dev(device)
- {
- /*
- * Enable AGP devices. Most will be VGA display but
- * some may be coprocessors on non VGA devices too
- */
-
- if((((device->class >> 16) & 0xFF) != PCI_BASE_CLASS_DISPLAY) &&
- (device->class != (PCI_CLASS_PROCESSOR_CO << 8)))
- continue;
-
+ while ((device = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8,
+ device)) != NULL) {
pci_read_config_dword(device, 0x04, &scratch);
if (!(scratch & 0x00100000))
diff --git a/drivers/char/drm/Config.in b/drivers/char/drm/Config.in
index 0cc3713d2..4936c6b3f 100644
--- a/drivers/char/drm/Config.in
+++ b/drivers/char/drm/Config.in
@@ -13,5 +13,4 @@ if [ "$CONFIG_DRM" != "n" ]; then
dep_tristate ' ATI Radeon' CONFIG_DRM_RADEON $CONFIG_AGP
dep_tristate ' Intel I810' CONFIG_DRM_I810 $CONFIG_AGP
dep_tristate ' Matrox g200/g400' CONFIG_DRM_MGA $CONFIG_AGP
- dep_tristate ' SiS' CONFIG_DRM_SIS $CONFIG_AGP
fi
diff --git a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile
index f0656be88..819418eb5 100644
--- a/drivers/char/drm/Makefile
+++ b/drivers/char/drm/Makefile
@@ -3,7 +3,7 @@
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
O_TARGET := drm.o
-list-multi := gamma.o tdfx.o r128.o mga.o i810.o radeon.o ffb.o sis.o
+list-multi := gamma.o tdfx.o r128.o mga.o i810.o radeon.o ffb.o
gamma-objs := gamma_drv.o gamma_dma.o
tdfx-objs := tdfx_drv.o
@@ -12,7 +12,6 @@ mga-objs := mga_drv.o mga_dma.o mga_state.o mga_warp.o
i810-objs := i810_drv.o i810_dma.o
radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o
ffb-objs := ffb_drv.o ffb_context.o
-sis-objs := sis_drv.o sis_ds.o sis_mm.o
obj-$(CONFIG_DRM_GAMMA) += gamma.o
obj-$(CONFIG_DRM_TDFX) += tdfx.o
@@ -21,7 +20,6 @@ obj-$(CONFIG_DRM_RADEON)+= radeon.o
obj-$(CONFIG_DRM_MGA) += mga.o
obj-$(CONFIG_DRM_I810) += i810.o
obj-$(CONFIG_DRM_FFB) += ffb.o
-obj-$(CONFIG_DRM_SIS) += sis.o
include $(TOPDIR)/Rules.make
@@ -45,6 +43,3 @@ radeon.o: $(radeon-objs) $(lib)
ffb.o: $(ffb-objs) $(lib)
$(LD) -r -o $@ $(ffb-objs) $(lib)
-
-sis.o: $(sis-objs) $(lib)
- $(LD) -r -o $@ $(sis-objs) $(lib)
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h
index 362de2ccf..ac9f407a7 100644
--- a/drivers/char/drm/drm.h
+++ b/drivers/char/drm/drm.h
@@ -104,7 +104,7 @@ typedef struct drm_tex_region {
#include "i810_drm.h"
#include "r128_drm.h"
#include "radeon_drm.h"
-#if defined(CONFIG_DRM_SIS) || defined(CONFIG_DRM_SIS_MODULE)
+#ifdef CONFIG_DRM_SIS
#include "sis_drm.h"
#endif
@@ -483,7 +483,7 @@ typedef struct drm_scatter_gather {
#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t)
#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4e, drm_radeon_texture_t)
-#if defined(CONFIG_DRM_SIS) || defined(CONFIG_DRM_SIS_MODULE)
+#ifdef CONFIG_DRM_SIS
/* SiS specific ioctls */
#define SIS_IOCTL_FB_ALLOC DRM_IOWR(0x44, drm_sis_mem_t)
#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t)
diff --git a/drivers/char/drm/drm_context.h b/drivers/char/drm/drm_context.h
index e155946dc..33d6112e3 100644
--- a/drivers/char/drm/drm_context.h
+++ b/drivers/char/drm/drm_context.h
@@ -27,10 +27,6 @@
* Authors:
* Rickard E. (Rik) Faith <faith@valinux.com>
* Gareth Hughes <gareth@valinux.com>
- * ChangeLog:
- * 2001-11-16 Torsten Duwe <duwe@caldera.de>
- * added context constructor/destructor hooks,
- * needed by SiS driver's memory management.
*/
#define __NO_VERSION__
@@ -320,10 +316,6 @@ int DRM(addctx)( struct inode *inode, struct file *filp,
/* Should this return -EBUSY instead? */
return -ENOMEM;
}
-#ifdef DRIVER_CTX_CTOR
- if ( ctx.handle != DRM_KERNEL_CONTEXT )
- DRIVER_CTX_CTOR(ctx.handle); /* XXX: also pass dev ? */
-#endif
if ( copy_to_user( (drm_ctx_t *)arg, &ctx, sizeof(ctx) ) )
return -EFAULT;
@@ -398,9 +390,6 @@ int DRM(rmctx)( struct inode *inode, struct file *filp,
priv->remove_auth_on_close = 1;
}
if ( ctx.handle != DRM_KERNEL_CONTEXT ) {
-#ifdef DRIVER_CTX_DTOR
- DRIVER_CTX_DTOR(ctx.handle); /* XXX: also pass dev ? */
-#endif
DRM(ctxbitmap_free)( dev, ctx.handle );
}
diff --git a/drivers/char/drm/sis.h b/drivers/char/drm/sis.h
deleted file mode 100644
index 9903c0037..000000000
--- a/drivers/char/drm/sis.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* sis_drv.h -- Private header for sis driver -*- linux-c -*-
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h,v 1.1 2001/05/19 18:29:22 dawes Exp $ */
-
-#ifndef __SIS_H__
-#define __SIS_H__
-
-/* This remains constant for all DRM template files.
- * Name it sisdrv_##x as there's a conflict with sis_free/malloc in the kernel
- * that's used for fb devices
- */
-#define DRM(x) sisdrv_##x
-
-/* General customization:
- */
-#define __HAVE_AGP 1
-#define __MUST_HAVE_AGP 0
-#define __HAVE_MTRR 1
-#define __HAVE_CTX_BITMAP 1
-
-/* Buffer customization:
- */
-#define DRIVER_AGP_BUFFERS_MAP( dev ) \
- ((drm_sis_private_t *)((dev)->dev_private))->buffers
-
-extern int sis_init_context(int context);
-extern int sis_final_context(int context);
-
-#define DRIVER_CTX_CTOR sis_init_context
-#define DRIVER_CTX_DTOR sis_final_context
-
-#endif
diff --git a/drivers/char/drm/sis_drm.h b/drivers/char/drm/sis_drm.h
deleted file mode 100644
index 339ed5a00..000000000
--- a/drivers/char/drm/sis_drm.h
+++ /dev/null
@@ -1,36 +0,0 @@
-
-#ifndef _sis_drm_public_h_
-#define _sis_drm_public_h_
-
-typedef struct {
- int context;
- unsigned int offset;
- unsigned int size;
- unsigned int free;
-} drm_sis_mem_t;
-
-typedef struct {
- unsigned int offset, size;
-} drm_sis_agp_t;
-
-typedef struct {
- unsigned int left, right;
-} drm_sis_flip_t;
-
-#ifdef __KERNEL__
-
-int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-int sis_fb_free(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-
-int sisp_agp_init(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-int sisp_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-int sisp_agp_free(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-
-#endif
-
-#endif
diff --git a/drivers/char/drm/sis_drv.c b/drivers/char/drm/sis_drv.c
deleted file mode 100644
index 3dd83fd7e..000000000
--- a/drivers/char/drm/sis_drv.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* sis.c -- sis driver -*- linux-c -*-
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#include <linux/config.h>
-#include "sis.h"
-#include "drmP.h"
-#include "sis_drm.h"
-#include "sis_drv.h"
-
-#define DRIVER_AUTHOR "SIS"
-#define DRIVER_NAME "sis"
-#define DRIVER_DESC "SIS 300/630/540"
-#define DRIVER_DATE "20010503"
-#define DRIVER_MAJOR 1
-#define DRIVER_MINOR 0
-#define DRIVER_PATCHLEVEL 0
-
-#define DRIVER_IOCTLS \
- [DRM_IOCTL_NR(SIS_IOCTL_FB_ALLOC)] = { sis_fb_alloc, 1, 1 }, \
- [DRM_IOCTL_NR(SIS_IOCTL_FB_FREE)] = { sis_fb_free, 1, 1 }, \
- /* AGP Memory Management */ \
- [DRM_IOCTL_NR(SIS_IOCTL_AGP_INIT)] = { sisp_agp_init, 1, 1 }, \
- [DRM_IOCTL_NR(SIS_IOCTL_AGP_ALLOC)] = { sisp_agp_alloc, 1, 1 }, \
- [DRM_IOCTL_NR(SIS_IOCTL_AGP_FREE)] = { sisp_agp_free, 1, 1 }
-#if 0 /* these don't appear to be defined */
- /* SIS Stereo */
- [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { sis_control, 1, 1 },
- [DRM_IOCTL_NR(SIS_IOCTL_FLIP)] = { sis_flip, 1, 1 },
- [DRM_IOCTL_NR(SIS_IOCTL_FLIP_INIT)] = { sis_flip_init, 1, 1 },
- [DRM_IOCTL_NR(SIS_IOCTL_FLIP_FINAL)] = { sis_flip_final, 1, 1 }
-#endif
-
-#define __HAVE_COUNTERS 5
-
-#include "drm_auth.h"
-#include "drm_agpsupport.h"
-#include "drm_bufs.h"
-#include "drm_context.h"
-#include "drm_dma.h"
-#include "drm_drawable.h"
-#include "drm_drv.h"
-#include "drm_fops.h"
-#include "drm_init.h"
-#include "drm_ioctl.h"
-#include "drm_lists.h"
-#include "drm_lock.h"
-#include "drm_memory.h"
-#include "drm_proc.h"
-#include "drm_vm.h"
-#include "drm_stub.h"
diff --git a/drivers/char/drm/sis_drv.h b/drivers/char/drm/sis_drv.h
deleted file mode 100644
index 844e38b07..000000000
--- a/drivers/char/drm/sis_drv.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* sis_drv.h -- Private header for sis driver -*- linux-c -*-
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-#ifndef _SIS_DRV_H_
-#define _SIS_DRV_H_
-
-typedef struct drm_sis_private {
- drm_map_t *buffers;
-} drm_sis_private_t;
-
-/* Stereo ? - this was never committed */
-
-int sis_flip(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-int sis_flip_init(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-int sis_flip_final(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-void flip_final(void);
-
-#endif
diff --git a/drivers/char/drm/sis_ds.c b/drivers/char/drm/sis_ds.c
deleted file mode 100644
index 6143ad83a..000000000
--- a/drivers/char/drm/sis_ds.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/* sis_ds.c -- Private header for Direct Rendering Manager -*- linux-c -*-
- * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw
- *
- * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- *
- */
-
-#define __NO_VERSION__
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/malloc.h>
-#include <linux/poll.h>
-#include <asm/io.h>
-#include <linux/pci.h>
-
-#include "sis_ds.h"
-
-/* Set Data Structure, not check repeated value
- * temporarily used
- */
-
-set_t *setInit(void)
-{
- int i;
- set_t *set;
-
- set = (set_t *)MALLOC(sizeof(set_t));
- for(i = 0; i < SET_SIZE; i++){
- set->list[i].free_next = i+1;
- set->list[i].alloc_next = -1;
- }
- set->list[SET_SIZE-1].free_next = -1;
- set->free = 0;
- set->alloc = -1;
- set->trace = -1;
-
- return set;
-}
-
-int setAdd(set_t *set, ITEM_TYPE item)
-{
- int free = set->free;
-
- if(free != -1){
- set->list[free].val = item;
- set->free = set->list[free].free_next;
- }
- else{
- return 0;
- }
-
- set->list[free].alloc_next = set->alloc;
- set->alloc = free;
- set->list[free].free_next = -1;
-
- return 1;
-}
-
-int setDel(set_t *set, ITEM_TYPE item)
-{
- int alloc = set->alloc;
- int prev = -1;
-
- while(alloc != -1){
- if(set->list[alloc].val == item){
- if(prev != -1)
- set->list[prev].alloc_next = set->list[alloc].alloc_next;
- else
- set->alloc = set->list[alloc].alloc_next;
- break;
- }
- prev = alloc;
- alloc = set->list[alloc].alloc_next;
- }
-
- if(alloc == -1)
- return 0;
-
- set->list[alloc].free_next = set->free;
- set->free = alloc;
- set->list[alloc].alloc_next = -1;
-
- return 1;
-}
-
-/* setFirst -> setAdd -> setNext is wrong */
-
-int setFirst(set_t *set, ITEM_TYPE *item)
-{
- if(set->alloc == -1)
- return 0;
-
- *item = set->list[set->alloc].val;
- set->trace = set->list[set->alloc].alloc_next;
-
- return 1;
-}
-
-int setNext(set_t *set, ITEM_TYPE *item)
-{
- if(set->trace == -1)
- return 0;
-
- *item = set->list[set->trace].val;
- set->trace = set->list[set->trace].alloc_next;
-
- return 1;
-}
-
-int setDestroy(set_t *set)
-{
- FREE(set);
-
- return 1;
-}
-
-/*
- * GLX Hardware Device Driver common code
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#define ISFREE(bptr) ((bptr)->free)
-
-#define PRINTF(fmt, arg...) do{}while(0)
-#define fprintf(fmt, arg...) do{}while(0)
-
-static void *calloc(size_t nmemb, size_t size)
-{
- void *addr;
- addr = kmalloc(nmemb*size, GFP_KERNEL);
- memset(addr, 0, nmemb*size);
- return addr;
-}
-#define free(n) kfree(n)
-
-void mmDumpMemInfo( memHeap_t *heap )
-{
- TMemBlock *p;
-
- PRINTF ("Memory heap %p:\n", heap);
- if (heap == 0) {
- PRINTF (" heap == 0\n");
- } else {
- p = (TMemBlock *)heap;
- while (p) {
- PRINTF (" Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
- p->free ? '.':'U',
- p->reserved ? 'R':'.');
- p = p->next;
- }
- }
- PRINTF ("End of memory blocks\n");
-}
-
-memHeap_t *mmInit(int ofs,
- int size)
-{
- PMemBlock blocks;
-
- if (size <= 0) {
- return 0;
- }
- blocks = (TMemBlock *) calloc(1,sizeof(TMemBlock));
- if (blocks) {
- blocks->ofs = ofs;
- blocks->size = size;
- blocks->free = 1;
- return (memHeap_t *)blocks;
- } else
- return 0;
-}
-
-/* Kludgey workaround for existing i810 server. Remove soon.
- */
-memHeap_t *mmAddRange( memHeap_t *heap,
- int ofs,
- int size )
-{
- PMemBlock blocks;
- blocks = (TMemBlock *) calloc(2,sizeof(TMemBlock));
- if (blocks) {
- blocks[0].size = size;
- blocks[0].free = 1;
- blocks[0].ofs = ofs;
- blocks[0].next = &blocks[1];
-
- /* Discontinuity - stops JoinBlock from trying to join non-adjacent
- * ranges.
- */
- blocks[1].size = 0;
- blocks[1].free = 0;
- blocks[1].ofs = ofs+size;
- blocks[1].next = (PMemBlock) heap;
- return (memHeap_t *)blocks;
- }
- else
- return heap;
-}
-
-static TMemBlock* SliceBlock(TMemBlock *p,
- int startofs, int size,
- int reserved, int alignment)
-{
- TMemBlock *newblock;
-
- /* break left */
- if (startofs > p->ofs) {
- newblock = (TMemBlock*) calloc(1,sizeof(TMemBlock));
- newblock->ofs = startofs;
- newblock->size = p->size - (startofs - p->ofs);
- newblock->free = 1;
- newblock->next = p->next;
- p->size -= newblock->size;
- p->next = newblock;
- p = newblock;
- }
-
- /* break right */
- if (size < p->size) {
- newblock = (TMemBlock*) calloc(1,sizeof(TMemBlock));
- newblock->ofs = startofs + size;
- newblock->size = p->size - size;
- newblock->free = 1;
- newblock->next = p->next;
- p->size = size;
- p->next = newblock;
- }
-
- /* p = middle block */
- p->align = alignment;
- p->free = 0;
- p->reserved = reserved;
- return p;
-}
-
-PMemBlock mmAllocMem( memHeap_t *heap, int size, int align2, int startSearch)
-{
- int mask,startofs,endofs;
- TMemBlock *p;
-
- if (!heap || align2 < 0 || size <= 0)
- return NULL;
- mask = (1 << align2)-1;
- startofs = 0;
- p = (TMemBlock *)heap;
- while (p) {
- if (ISFREE(p)) {
- startofs = (p->ofs + mask) & ~mask;
- if ( startofs < startSearch ) {
- startofs = startSearch;
- }
- endofs = startofs+size;
- if (endofs <= (p->ofs+p->size))
- break;
- }
- p = p->next;
- }
- if (!p)
- return NULL;
- p = SliceBlock(p,startofs,size,0,mask+1);
- p->heap = heap;
- return p;
-}
-
-static __inline__ int Join2Blocks(TMemBlock *p)
-{
- if (p->free && p->next && p->next->free) {
- TMemBlock *q = p->next;
- p->size += q->size;
- p->next = q->next;
- free(q);
- return 1;
- }
- return 0;
-}
-
-int mmFreeMem(PMemBlock b)
-{
- TMemBlock *p,*prev;
-
- if (!b)
- return 0;
- if (!b->heap) {
- fprintf(stderr, "no heap\n");
- return -1;
- }
- p = b->heap;
- prev = NULL;
- while (p && p != b) {
- prev = p;
- p = p->next;
- }
- if (!p || p->free || p->reserved) {
- if (!p)
- fprintf(stderr, "block not found in heap\n");
- else if (p->free)
- fprintf(stderr, "block already free\n");
- else
- fprintf(stderr, "block is reserved\n");
- return -1;
- }
- p->free = 1;
- Join2Blocks(p);
- if (prev)
- Join2Blocks(prev);
- return 0;
-}
-
-int mmReserveMem(memHeap_t *heap, int offset,int size)
-{
- int endofs;
- TMemBlock *p;
-
- if (!heap || size <= 0)
- return -1;
- endofs = offset+size;
- p = (TMemBlock *)heap;
- while (p && p->ofs <= offset) {
- if (ISFREE(p) && endofs <= (p->ofs+p->size)) {
- SliceBlock(p,offset,size,1,1);
- return 0;
- }
- p = p->next;
- }
- return -1;
-}
-
-int mmFreeReserved(memHeap_t *heap, int offset)
-{
- TMemBlock *p,*prev;
-
- if (!heap)
- return -1;
- p = (TMemBlock *)heap;
- prev = NULL;
- while (p && p->ofs != offset) {
- prev = p;
- p = p->next;
- }
- if (!p || !p->reserved)
- return -1;
- p->free = 1;
- p->reserved = 0;
- Join2Blocks(p);
- if (prev)
- Join2Blocks(prev);
- return 0;
-}
-
-void mmDestroy(memHeap_t *heap)
-{
- TMemBlock *p,*q;
-
- if (!heap)
- return;
- p = (TMemBlock *)heap;
- while (p) {
- q = p->next;
- free(p);
- p = q;
- }
-}
diff --git a/drivers/char/drm/sis_ds.h b/drivers/char/drm/sis_ds.h
deleted file mode 100644
index c3367dba7..000000000
--- a/drivers/char/drm/sis_ds.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/* sis_ds.h -- Private header for Direct Rendering Manager -*- linux-c -*-
- * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw
- *
- * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- *
- */
-
-#ifndef _sis_ds_h_
-#define _sis_ds_h_
-
-/* Set Data Structure */
-
-#define SET_SIZE 5000
-#define MALLOC(s) kmalloc(s, GFP_KERNEL)
-#define FREE(s) kfree(s)
-
-typedef unsigned int ITEM_TYPE;
-
-typedef struct {
- ITEM_TYPE val;
- int alloc_next, free_next;
-} list_item_t;
-
-typedef struct {
- int alloc;
- int free;
- int trace;
- list_item_t list[SET_SIZE];
-} set_t;
-
-set_t *setInit(void);
-int setAdd(set_t *set, ITEM_TYPE item);
-int setDel(set_t *set, ITEM_TYPE item);
-int setFirst(set_t *set, ITEM_TYPE *item);
-int setNext(set_t *set, ITEM_TYPE *item);
-int setDestroy(set_t *set);
-
-#endif
-
-/*
- * GLX Hardware Device Driver common code
- * Copyright (C) 1999 Keith Whitwell
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#ifndef MM_INC
-#define MM_INC
-
-struct mem_block_t {
- struct mem_block_t *next;
- struct mem_block_t *heap;
- int ofs,size;
- int align;
- int free:1;
- int reserved:1;
-};
-typedef struct mem_block_t TMemBlock;
-typedef struct mem_block_t *PMemBlock;
-
-/* a heap is just the first block in a chain */
-typedef struct mem_block_t memHeap_t;
-
-static __inline__ int mmBlockSize(PMemBlock b)
-{ return b->size; }
-
-static __inline__ int mmOffset(PMemBlock b)
-{ return b->ofs; }
-
-static __inline__ void mmMarkReserved(PMemBlock b)
-{ b->reserved = 1; }
-
-/*
- * input: total size in bytes
- * return: a heap pointer if OK, NULL if error
- */
-memHeap_t *mmInit( int ofs, int size );
-
-
-
-memHeap_t *mmAddRange( memHeap_t *heap,
- int ofs,
- int size );
-
-
-/*
- * Allocate 'size' bytes with 2^align2 bytes alignment,
- * restrict the search to free memory after 'startSearch'
- * depth and back buffers should be in different 4mb banks
- * to get better page hits if possible
- * input: size = size of block
- * align2 = 2^align2 bytes alignment
- * startSearch = linear offset from start of heap to begin search
- * return: pointer to the allocated block, 0 if error
- */
-PMemBlock mmAllocMem( memHeap_t *heap, int size, int align2, int startSearch );
-
-/*
- * Free block starts at offset
- * input: pointer to a block
- * return: 0 if OK, -1 if error
- */
-int mmFreeMem( PMemBlock b );
-
-/*
- * Reserve 'size' bytes block start at offset
- * This is used to prevent allocation of memory already used
- * by the X server for the front buffer, pixmaps, and cursor
- * input: size, offset
- * output: 0 if OK, -1 if error
- */
-int mmReserveMem( memHeap_t *heap, int offset,int size );
-int mmFreeReserved( memHeap_t *heap, int offset );
-
-/*
- * destroy MM
- */
-void mmDestroy( memHeap_t *mmInit );
-
-/* For debuging purpose. */
-void mmDumpMemInfo( memHeap_t *mmInit );
-
-#endif
diff --git a/drivers/char/drm/sis_mm.c b/drivers/char/drm/sis_mm.c
deleted file mode 100644
index 81832769d..000000000
--- a/drivers/char/drm/sis_mm.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/* sis_mm.c -- Private header for Direct Rendering Manager -*- linux-c -*-
- * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw
- *
- * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Sung-Ching Lin <sclin@sis.com.tw>
- *
- */
-
-#define __NO_VERSION__
-#include "sis.h"
-#include <linux/sisfb.h>
-#include "drmP.h"
-#include "sis_drm.h"
-#include "sis_drv.h"
-#include "sis_ds.h"
-
-#define MAX_CONTEXT 100
-#define VIDEO_TYPE 0
-#define AGP_TYPE 1
-
-typedef struct {
- int used;
- int context;
- set_t *sets[2]; /* 0 for video, 1 for AGP */
-} sis_context_t;
-
-static sis_context_t global_ppriv[MAX_CONTEXT];
-
-static int add_alloc_set(int context, int type, unsigned int val)
-{
- int i, retval = 0;
-
- for(i = 0; i < MAX_CONTEXT; i++)
- if(global_ppriv[i].used && global_ppriv[i].context == context){
- retval = setAdd(global_ppriv[i].sets[type], val);
- break;
- }
- return retval;
-}
-
-static int del_alloc_set(int context, int type, unsigned int val)
-{
- int i, retval = 0;
- for(i = 0; i < MAX_CONTEXT; i++)
- if(global_ppriv[i].used && global_ppriv[i].context == context){
- retval = setDel(global_ppriv[i].sets[type], val);
- break;
- }
- return retval;
-}
-
-/* fb management via fb device */
-#if 1
-int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
-{
- drm_sis_mem_t fb;
- struct sis_memreq req;
- int retval = 0;
-
- if (copy_from_user(&fb, (drm_sis_mem_t *)arg, sizeof(fb)))
- return -EFAULT;
-
- req.size = fb.size;
- sis_malloc(&req);
- if(req.offset){
- /* TODO */
- fb.offset = req.offset;
- fb.free = req.offset;
- if(!add_alloc_set(fb.context, VIDEO_TYPE, fb.free)){
- DRM_DEBUG("adding to allocation set fails\n");
- sis_free(req.offset);
- retval = -1;
- }
- }
- else{
- fb.offset = 0;
- fb.size = 0;
- fb.free = 0;
- }
-
- if (copy_to_user((drm_sis_mem_t *)arg, &fb, sizeof(fb))) return -EFAULT;
-
- DRM_DEBUG("alloc fb, size = %d, offset = %ld\n", fb.size, req.offset);
-
- return retval;
-}
-
-int sis_fb_free(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
-{
- drm_sis_mem_t fb;
- int retval = 0;
-
- if (copy_from_user(&fb, (drm_sis_mem_t *)arg, sizeof(fb)))
- return -EFAULT;
-
- if(!fb.free){
- return -1;
- }
-
- sis_free(fb.free);
- if(!del_alloc_set(fb.context, VIDEO_TYPE, fb.free))
- retval = -1;
-
- DRM_DEBUG("free fb, offset = %d\n", fb.free);
-
- return retval;
-}
-
-#else
-
-int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
-{
- return -1;
-}
-
-int sis_fb_free(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
-{
- return 0;
-}
-
-#endif
-
-/* agp memory management */
-#if 1
-
-static memHeap_t *AgpHeap = NULL;
-
-int sisp_agp_init(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
-{
- drm_sis_agp_t agp;
-
- if (copy_from_user(&agp, (drm_sis_agp_t *)arg, sizeof(agp)))
- return -EFAULT;
-
- AgpHeap = mmInit(agp.offset, agp.size);
-
- DRM_DEBUG("offset = %u, size = %u", agp.offset, agp.size);
-
- return 0;
-}
-
-int sisp_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
-{
- drm_sis_mem_t agp;
- PMemBlock block;
- int retval = 0;
-
- if(!AgpHeap)
- return -1;
-
- if (copy_from_user(&agp, (drm_sis_mem_t *)arg, sizeof(agp)))
- return -EFAULT;
-
- block = mmAllocMem(AgpHeap, agp.size, 0, 0);
- if(block){
- /* TODO */
- agp.offset = block->ofs;
- agp.free = (unsigned int)block;
- if(!add_alloc_set(agp.context, AGP_TYPE, agp.free)){
- DRM_DEBUG("adding to allocation set fails\n");
- mmFreeMem((PMemBlock)agp.free);
- retval = -1;
- }
- }
- else{
- agp.offset = 0;
- agp.size = 0;
- agp.free = 0;
- }
-
- if (copy_to_user((drm_sis_mem_t *)arg, &agp, sizeof(agp))) return -EFAULT;
-
- DRM_DEBUG("alloc agp, size = %d, offset = %d\n", agp.size, agp.offset);
-
- return retval;
-}
-
-int sisp_agp_free(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
-{
- drm_sis_mem_t agp;
- int retval = 0;
-
- if(!AgpHeap)
- return -1;
-
- if (copy_from_user(&agp, (drm_sis_mem_t *)arg, sizeof(agp)))
- return -EFAULT;
-
- if(!agp.free){
- return -1;
- }
-
- mmFreeMem((PMemBlock)agp.free);
- if(!del_alloc_set(agp.context, AGP_TYPE, agp.free))
- retval = -1;
-
- DRM_DEBUG("free agp, free = %d\n", agp.free);
-
- return retval;
-}
-
-#endif
-
-int sis_init_context(int context)
-{
- int i;
-
- for(i = 0; i < MAX_CONTEXT ; i++)
- if(global_ppriv[i].used && (global_ppriv[i].context == context))
- break;
-
- if(i >= MAX_CONTEXT){
- for(i = 0; i < MAX_CONTEXT ; i++){
- if(!global_ppriv[i].used){
- global_ppriv[i].context = context;
- global_ppriv[i].used = 1;
- global_ppriv[i].sets[0] = setInit();
- global_ppriv[i].sets[1] = setInit();
- DRM_DEBUG("init allocation set, socket=%d, context = %d\n",
- i, context);
- break;
- }
- }
- if((i >= MAX_CONTEXT) || (global_ppriv[i].sets[0] == NULL) ||
- (global_ppriv[i].sets[1] == NULL)){
- return 0;
- }
- }
-
- return 1;
-}
-
-int sis_final_context(int context)
-{
- int i;
-
- for(i=0; i<MAX_CONTEXT; i++)
- if(global_ppriv[i].used && (global_ppriv[i].context == context))
- break;
-
- if(i < MAX_CONTEXT){
- set_t *set;
- unsigned int item;
- int retval;
-
- DRM_DEBUG("find socket %d, context = %d\n", i, context);
-
- /* Video Memory */
- set = global_ppriv[i].sets[0];
- retval = setFirst(set, &item);
- while(retval){
- DRM_DEBUG("free video memory 0x%x\n", item);
- sis_free(item);
- retval = setNext(set, &item);
- }
- setDestroy(set);
-
- /* AGP Memory */
- set = global_ppriv[i].sets[1];
- retval = setFirst(set, &item);
- while(retval){
- DRM_DEBUG("free agp memory 0x%x\n", item);
- mmFreeMem((PMemBlock)item);
- retval = setNext(set, &item);
- }
- setDestroy(set);
-
- global_ppriv[i].used = 0;
- }
-
- /* turn-off auto-flip */
- /* TODO */
-#if defined(SIS_STEREO)
- flip_final();
-#endif
-
- return 1;
-}
diff --git a/drivers/char/ip2.c b/drivers/char/ip2.c
index 334d40c18..6b7465098 100644
--- a/drivers/char/ip2.c
+++ b/drivers/char/ip2.c
@@ -33,11 +33,10 @@ ip2_loadmain(int *, int *, unsigned char *, int ); // ref into ip2main.c
*/
static int io[IP2_MAX_BOARDS]= { 0, 0, 0, 0 };
static int irq[IP2_MAX_BOARDS] = { -1, -1, -1, -1 };
+static int poll_only = 0;
#ifdef MODULE
-static int poll_only = 0;
-
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
MODULE_AUTHOR("Doug McNash");
MODULE_DESCRIPTION("Computone IntelliPort Plus Driver");
diff --git a/drivers/char/ip2/i2cmd.c b/drivers/char/ip2/i2cmd.c
index ce4216631..77fd8543e 100644
--- a/drivers/char/ip2/i2cmd.c
+++ b/drivers/char/ip2/i2cmd.c
@@ -139,7 +139,7 @@ static UCHAR ct79[] = { 2, BYP, 0x4F,0 }; // XMIT_NOW
//static UCHAR ct86[]={ 2, BTH, 0x56,0 }; // RCV_ENABLE
static UCHAR ct87[] = { 1, BYP, 0x57 }; // HW_TEST
//static UCHAR ct88[]={ 3, BTH, 0x58,0,0 }; // RCV_THRESHOLD
-//static UCHAR ct89[]={ 1, BYP, 0x59 }; // DSS_NOW
+static UCHAR ct89[]={ 1, BYP, 0x59 }; // DSS_NOW
//static UCHAR ct90[]={ 3, BYP, 0x5A,0,0 }; // Set SILO
//static UCHAR ct91[]={ 2, BYP, 0x5B,0 }; // timed break
diff --git a/drivers/char/joystick/cs461x.c b/drivers/char/joystick/cs461x.c
index 6b096f0fe..7116b3453 100644
--- a/drivers/char/joystick/cs461x.c
+++ b/drivers/char/joystick/cs461x.c
@@ -313,7 +313,7 @@ static struct pci_driver cs461x_pci_driver = {
name: "PCI Gameport",
id_table: cs461x_pci_tbl,
probe: cs461x_pci_probe,
- remove: __devexit_p(cs461x_pci_remove),
+ remove: cs461x_pci_remove,
};
int __init js_cs461x_init(void)
diff --git a/drivers/char/joystick/emu10k1-gp.c b/drivers/char/joystick/emu10k1-gp.c
index 4763a02c7..2489b11c6 100644
--- a/drivers/char/joystick/emu10k1-gp.c
+++ b/drivers/char/joystick/emu10k1-gp.c
@@ -108,7 +108,7 @@ static struct pci_driver emu_driver = {
name: "Emu10k1 Gameport",
id_table: emu_tbl,
probe: emu_probe,
- remove: __devexit_p(emu_remove),
+ remove: emu_remove,
};
int __init emu_init(void)
diff --git a/drivers/char/joystick/pcigame.c b/drivers/char/joystick/pcigame.c
index 194814ca6..04e1bee04 100644
--- a/drivers/char/joystick/pcigame.c
+++ b/drivers/char/joystick/pcigame.c
@@ -180,7 +180,7 @@ static struct pci_driver pcigame_driver = {
name: "pcigame",
id_table: pcigame_id_table,
probe: pcigame_probe,
- remove: __devexit_p(pcigame_remove),
+ remove: pcigame_remove,
};
int __init pcigame_init(void)
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index e35edd69a..8b1f582a7 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -272,8 +272,6 @@ static ssize_t read_kmem(struct file *file, char *buf,
return virtr + read;
}
-extern long vwrite(char *buf, char *addr, unsigned long count);
-
/*
* This function writes to the *virtual* memory as seen by the kernel.
*/
@@ -281,46 +279,12 @@ static ssize_t write_kmem(struct file * file, const char * buf,
size_t count, loff_t *ppos)
{
unsigned long p = *ppos;
- ssize_t wrote = 0;
- ssize_t virtr = 0;
- char * kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */
-
- if (p < (unsigned long) high_memory) {
- wrote = count;
- if (count > (unsigned long) high_memory - p)
- wrote = (unsigned long) high_memory - p;
-
- wrote = do_write_mem(file, (void*)p, p, buf, wrote, ppos);
-
- p += wrote;
- buf += wrote;
- count -= wrote;
- }
-
- if (count > 0) {
- kbuf = (char *)__get_free_page(GFP_KERNEL);
- if (!kbuf)
- return -ENOMEM;
- while (count > 0) {
- int len = count;
- if (len > PAGE_SIZE)
- len = PAGE_SIZE;
- if (len && copy_from_user(kbuf, buf, len)) {
- free_page((unsigned long)kbuf);
- return -EFAULT;
- }
- len = vwrite(kbuf, (char *)p, len);
- count -= len;
- buf += len;
- virtr += len;
- p += len;
- }
- free_page((unsigned long)kbuf);
- }
-
- *ppos = p;
- return virtr + wrote;
+ if (p >= (unsigned long) high_memory)
+ return 0;
+ if (count > (unsigned long) high_memory - p)
+ count = (unsigned long) high_memory - p;
+ return do_write_mem(file, (void*)p, p, buf, count, ppos);
}
#if !defined(__mc68000__)
diff --git a/drivers/char/pcmcia/serial_cs.c b/drivers/char/pcmcia/serial_cs.c
index b9f628a01..892f2c832 100644
--- a/drivers/char/pcmcia/serial_cs.c
+++ b/drivers/char/pcmcia/serial_cs.c
@@ -2,7 +2,7 @@
A driver for PCMCIA serial devices
- serial_cs.c 1.128 2001/10/18 12:18:35
+ serial_cs.c 1.123 2000/08/24 18:46:38
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
@@ -19,8 +19,8 @@
are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
Alternatively, the contents of this file may be used under the
- terms of the GNU General Public License version 2 (the "GPL"), in
- which case the provisions of the GPL are applicable instead of the
+ terms of the GNU General Public License version 2 (the "GPL"), in which
+ case the provisions of the GPL are applicable instead of the
above. If you wish to allow the use of your version of this file
only under the terms of the GPL and not to allow others to use
your version of this file under the MPL, indicate your decision
@@ -44,7 +44,6 @@
#include <linux/major.h>
#include <asm/io.h>
#include <asm/system.h>
-#include <asm/byteorder.h>
#include <pcmcia/version.h>
#include <pcmcia/cs_types.h>
@@ -54,32 +53,30 @@
#include <pcmcia/ds.h>
#include <pcmcia/cisreg.h>
-/*====================================================================*/
-
-/* Module parameters */
+#ifdef PCMCIA_DEBUG
+static int pc_debug = PCMCIA_DEBUG;
+MODULE_PARM(pc_debug, "i");
+#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
+static char *version =
+"serial_cs.c 1.123 2000/08/24 18:46:38 (David Hinds)";
+#else
+#define DEBUG(n, args...)
+#endif
-MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
-MODULE_DESCRIPTION("PCMCIA serial card driver");
-MODULE_LICENSE("Dual MPL/GPL");
+/*====================================================================*/
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
+/* Parameters that can be set with 'insmod' */
/* Bit map of interrupts to choose from */
-INT_MODULE_PARM(irq_mask, 0xdeb8);
+static u_int irq_mask = 0xdeb8;
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
/* Enable the speaker? */
-INT_MODULE_PARM(do_sound, 1);
+static int do_sound = 1;
-#ifdef PCMCIA_DEBUG
-INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
-#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
-static char *version =
-"serial_cs.c 1.128 2001/10/18 12:18:35 (David Hinds)";
-#else
-#define DEBUG(n, args...)
-#endif
+MODULE_PARM(irq_mask, "i");
+MODULE_PARM(irq_list, "1-4i");
+MODULE_PARM(do_sound, "i");
/*====================================================================*/
@@ -96,8 +93,6 @@ static multi_id_t multi_id[] = {
{ MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232, 2 },
{ MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232_D1, 2 },
{ MANFID_QUATECH, PRODID_QUATECH_QUAD_RS232, 4 },
- { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS422, 2 },
- { MANFID_QUATECH, PRODID_QUATECH_QUAD_RS422, 4 },
{ MANFID_SOCKET, PRODID_SOCKET_DUAL_RS232, 2 },
{ MANFID_INTEL, PRODID_INTEL_DUAL_RS232, 2 },
{ MANFID_NATINST, PRODID_NATINST_QUAD_RS232, 4 }
@@ -362,6 +357,7 @@ static int simple_config(dev_link_t *link)
found_port:
if (i != CS_SUCCESS) {
+ printk(KERN_NOTICE "serial_cs: no usable port range found, giving up\n");
cs_error(link->handle, RequestIO, i);
return -1;
}
@@ -441,6 +437,7 @@ static int multi_config(dev_link_t *link)
i = CardServices(RequestIRQ, link->handle, &link->irq);
if (i != CS_SUCCESS) {
+ printk(KERN_NOTICE "serial_cs: no usable port range found, giving up\n");
cs_error(link->handle, RequestIRQ, i);
link->irq.AssignedIRQ = 0;
}
@@ -666,3 +663,5 @@ static void __exit exit_serial_cs(void)
module_init(init_serial_cs);
module_exit(exit_serial_cs);
+
+MODULE_LICENSE("GPL");
diff --git a/drivers/char/serial.c b/drivers/char/serial.c
index 4018baa08..9a9b3c565 100644
--- a/drivers/char/serial.c
+++ b/drivers/char/serial.c
@@ -3133,10 +3133,6 @@ static int get_async_struct(int line, struct async_struct **ret_info)
* enables interrupts for a serial port, linking in its async structure into
* the IRQ chain. It also performs the serial-specific
* initialization for the tty structure.
- *
- * Note that on failure, we don't decrement the module use count - the tty
- * later will call rs_close, which will decrement it for us as long as
- * tty->driver_data is set non-NULL. --rmk
*/
static int rs_open(struct tty_struct *tty, struct file * filp)
{
@@ -3157,8 +3153,10 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
}
tty->driver_data = info;
info->tty = tty;
- if (serial_paranoia_check(info, tty->device, "rs_open"))
+ if (serial_paranoia_check(info, tty->device, "rs_open")) {
+ MOD_DEC_USE_COUNT;
return -ENODEV;
+ }
#ifdef SERIAL_DEBUG_OPEN
printk("rs_open %s%d, count = %d\n", tty->driver.name, info->line,
@@ -3173,8 +3171,10 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
*/
if (!tmp_buf) {
page = get_zeroed_page(GFP_KERNEL);
- if (!page)
+ if (!page) {
+ MOD_DEC_USE_COUNT;
return -ENOMEM;
+ }
if (tmp_buf)
free_page(page);
else
@@ -3188,6 +3188,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
(info->flags & ASYNC_CLOSING)) {
if (info->flags & ASYNC_CLOSING)
interruptible_sleep_on(&info->close_wait);
+ MOD_DEC_USE_COUNT;
#ifdef SERIAL_DO_RESTART
return ((info->flags & ASYNC_HUP_NOTIFY) ?
-EAGAIN : -ERESTARTSYS);
@@ -3200,8 +3201,10 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
* Start up serial port
*/
retval = startup(info);
- if (retval)
+ if (retval) {
+ MOD_DEC_USE_COUNT;
return retval;
+ }
retval = block_til_ready(tty, filp, info);
if (retval) {
@@ -3209,6 +3212,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
printk("rs_open returning after block_til_ready with %d\n",
retval);
#endif
+ MOD_DEC_USE_COUNT;
return retval;
}
@@ -4892,7 +4896,7 @@ MODULE_DEVICE_TABLE(pci, serial_pci_tbl);
static struct pci_driver serial_pci_driver = {
name: "serial",
probe: serial_init_one,
- remove: __devexit_p(serial_remove_one),
+ remove: serial_remove_one,
id_table: serial_pci_tbl,
};
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index 9f2816e99..9b55ff5fd 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -2373,7 +2373,7 @@ static struct pci_driver ohci1394_driver = {
name: OHCI1394_DRIVER_NAME,
id_table: ohci1394_pci_tbl,
probe: ohci1394_add_one,
- remove: __devexit_p(ohci1394_remove_one),
+ remove: ohci1394_remove_one,
};
static void __exit ohci1394_cleanup (void)
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c
index 9da6a3619..68f612caa 100644
--- a/drivers/media/radio/radio-gemtek-pci.c
+++ b/drivers/media/radio/radio-gemtek-pci.c
@@ -424,7 +424,7 @@ static struct pci_driver gemtek_pci_driver =
name: "gemtek_pci",
id_table: gemtek_pci_id,
probe: gemtek_pci_probe,
- remove: __devexit_p(gemtek_pci_remove),
+ remove: gemtek_pci_remove
};
static int __init gemtek_pci_init_module( void )
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index dec250a7d..1368ff2ed 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -376,7 +376,7 @@ static struct pci_driver maxiradio_driver = {
name: "radio-maxiradio",
id_table: maxiradio_pci_tbl,
probe: maxiradio_init_one,
- remove: __devexit_p(maxiradio_remove_one),
+ remove: maxiradio_remove_one,
};
int __init maxiradio_radio_init(void)
diff --git a/drivers/media/video/Config.in b/drivers/media/video/Config.in
index d6a2f9ee3..4a4ed77a0 100644
--- a/drivers/media/video/Config.in
+++ b/drivers/media/video/Config.in
@@ -22,8 +22,10 @@ if [ "$CONFIG_PARPORT" != "n" ]; then
fi
fi
if [ "$CONFIG_PARPORT" != "n" ]; then
- if [ "$CONFIG_PARPORT_1284" != "n" ]; then
- dep_tristate ' W9966CF Webcam (FlyCam Supra and others) Video For Linux' CONFIG_VIDEO_W9966 $CONFIG_VIDEO_DEV $CONFIG_PARPORT
+ if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+ if [ "$CONFIG_PARPORT_1284" != "n" ]; then
+ dep_tristate ' Winbond W9966CF Webcam Video For Linux (EXPERIMENTAL)' CONFIG_VIDEO_W9966 $CONFIG_VIDEO_DEV $CONFIG_PARPORT
+ fi
fi
fi
dep_tristate ' CPiA Video For Linux' CONFIG_VIDEO_CPIA $CONFIG_VIDEO_DEV
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index 2023e9e6a..eb4328eb4 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -3024,7 +3024,7 @@ static struct pci_driver bttv_pci_driver = {
name: "bttv",
id_table: bttv_pci_tbl,
probe: bttv_probe,
- remove: __devexit_p(bttv_remove),
+ remove: bttv_remove,
};
int bttv_init_module(void)
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index 2eedc6b79..de4b02cd4 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -1460,7 +1460,7 @@ static struct pci_driver meye_driver = {
name: "meye",
id_table: meye_pci_tbl,
probe: meye_probe,
- remove: __devexit_p(meye_remove),
+ remove: meye_remove,
};
static int __init meye_init_module(void) {
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c
index 404a246ee..c5e67b48c 100644
--- a/drivers/media/video/w9966.c
+++ b/drivers/media/video/w9966.c
@@ -1,7 +1,9 @@
/*
Winbond w9966cf Webcam parport driver.
- Copyright (C) 2001 Jakob Kemi <jakob.kemi@telia.com>
+ Version 0.32
+
+ Copyright (C) 2001 Jakob Kemi <jakob.kemi@post.utfors.se>
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
@@ -19,16 +21,33 @@
*/
/*
Supported devices:
- * Lifeview FlyCam Supra (using the Philips saa7111a chip)
+ *Lifeview FlyCam Supra (using the Philips saa7111a chip)
+
+ Does any other model using the w9966 interface chip exist ?
Todo:
- * Add a working EPP mode
- * Support other ccd-control chips than the saa7111
- (what combinations exists?)
- * Add proper probing. IEEE1284 probing of w9966 chips haven't
- worked since parport drivers changed in 2.4.x.
- * Probe for onboard SRAM, port directions etc. (if possible)
+
+ *Add a working EPP mode, since DMA ECP read isn't implemented
+ in the parport drivers. (That's why it's so sloow)
+
+ *Add support for other ccd-control chips than the saa7111
+ please send me feedback on what kind of chips you have.
+
+ *Add proper probing. I don't know what's wrong with the IEEE1284
+ parport drivers but (IEEE1284_MODE_NIBBLE|IEEE1284_DEVICE_ID)
+ and nibble read seems to be broken for some peripherals.
+
+ *Add probing for onboard SRAM, port directions etc. (if possible)
+
+ *Add support for the hardware compressed modes (maybe using v4l2)
+
+ *Fix better support for the capture window (no skewed images, v4l
+ interface to capt. window)
+
+ *Probably some bugs that I don't know of
+ Please support me by sending feedback!
+
Changes:
Alan Cox: Removed RGB mode for kernel merge, added THIS_MODULE
@@ -40,8 +59,6 @@
#include <linux/delay.h>
#include <linux/videodev.h>
#include <linux/parport.h>
-#include <linux/types.h>
-#include <linux/slab.h>
//#define DEBUG // Undef me for production
@@ -82,44 +99,43 @@
#define W9966_I2C_W_CLOCK 0x01
struct w9966_dev {
- u8 dev_state;
- u8 i2c_state;
- int ppmode;
+ unsigned char dev_state;
+ unsigned char i2c_state;
+ unsigned short ppmode;
struct parport* pport;
struct pardevice* pdev;
struct video_device vdev;
- u16 width;
- u16 height;
- u8 brightness;
- s8 contrast;
- s8 color;
- s8 hue;
- u8* buffer;
+ unsigned short width;
+ unsigned short height;
+ unsigned char brightness;
+ signed char contrast;
+ signed char color;
+ signed char hue;
};
/*
* Module specific properties
*/
-MODULE_AUTHOR("Jakob Kemi <jakob.kemi@telia.com>");
-MODULE_DESCRIPTION("Winbond w9966cf WebCam driver (FlyCam Supra and others)");
+MODULE_AUTHOR("Jakob Kemi <jakob.kemi@post.utfors.se>");
+MODULE_DESCRIPTION("Winbond w9966cf WebCam driver (0.32)");
MODULE_LICENSE("GPL");
-static const char* pardev[] = {[0 ... W9966_MAXCAMS] = "auto"};
-MODULE_PARM(pardev, "0-" __MODULE_STRING(W9966_MAXCAMS) "s");
-MODULE_PARM_DESC(pardev,"\n\
-<auto|name|none[,...]> Where to find cameras.\n\
- auto = probe all parports for camera\n\
- name = name of parport (eg parport0)\n\
- none = don't search for this camera\n\
-You can specify all cameras this way, for example:
- pardev=parport2,auto,none,parport0 would search for cam1 on parport2, search\n\
- for cam2 on all parports, skip cam3 and search for cam4 on parport0");
+#ifdef MODULE
+static const char* pardev[] = {[0 ... W9966_MAXCAMS] = ""};
+#else
+static const char* pardev[] = {[0 ... W9966_MAXCAMS] = "aggressive"};
+#endif
+MODULE_PARM(pardev, "1-" __MODULE_STRING(W9966_MAXCAMS) "s");
+MODULE_PARM_DESC(pardev, "pardev: where to search for\n\
+\teach camera. 'aggressive' means brute-force search.\n\
+\tEg: >pardev=parport3,aggressive,parport2,parport1< would assign
+\tcam 1 to parport3 and search every parport for cam 2 etc...");
static int parmode = 0;
MODULE_PARM(parmode, "i");
-MODULE_PARM_DESC(parmode, "\n<0|1|2> transfer mode (0=auto, 1=ecp, 2=epp)");
+MODULE_PARM_DESC(parmode, "parmode: transfer mode (0=auto, 1=ecp, 2=epp");
static int video_nr = -1;
MODULE_PARM(video_nr, "i");
@@ -261,23 +277,17 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port)
case 0:
if (port->modes & PARPORT_MODE_ECP)
cam->ppmode = IEEE1284_MODE_ECP;
-/* else if (port->modes & PARPORT_MODE_EPP)
- cam->ppmode = IEEE1284_MODE_EPP;*/
+ else if (port->modes & PARPORT_MODE_EPP)
+ cam->ppmode = IEEE1284_MODE_EPP;
else
- cam->ppmode = IEEE1284_MODE_ECPSWE;
+ cam->ppmode = IEEE1284_MODE_ECP;
break;
case 1: // hw- or sw-ecp
- if (port->modes & PARPORT_MODE_ECP)
- cam->ppmode = IEEE1284_MODE_ECP;
- else
- cam->ppmode = IEEE1284_MODE_ECPSWE;
+ cam->ppmode = IEEE1284_MODE_ECP;
break;
case 2: // hw- or sw-epp
- if (port->modes & PARPORT_MODE_EPP)
- cam->ppmode = IEEE1284_MODE_EPP;
- else
- cam->ppmode = IEEE1284_MODE_EPPSWE;
- break;
+ cam->ppmode = IEEE1284_MODE_EPP;
+ break;
}
// Tell the parport driver that we exists
@@ -315,8 +325,6 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port)
w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV);
- cam->buffer = NULL;
-
// All ok
printk(
"w9966cf: Found and initialized a webcam on %s.\n",
@@ -329,12 +337,6 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port)
// Terminate everything gracefully
static void w9966_term(struct w9966_dev* cam)
{
-// Delete allocated buffer if needed
- if (cam->buffer != NULL) {
- kfree(cam->buffer);
- cam->buffer = NULL;
- }
-
// Unregister from v4l
if (w9966_getState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV)) {
video_unregister_device(&cam->vdev);
@@ -429,9 +431,9 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in
{
unsigned int i;
unsigned int enh_s, enh_e;
- u8 scale_x, scale_y;
- u8 regs[0x1c];
- u8 saa7111_regs[] = {
+ unsigned char scale_x, scale_y;
+ unsigned char regs[0x1c];
+ unsigned char saa7111_regs[] = {
0x21, 0x00, 0xd8, 0x23, 0x00, 0x80, 0x80, 0x00,
0x88, 0x10, 0x80, 0x40, 0x40, 0x00, 0x01, 0x00,
0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -662,7 +664,6 @@ static int w9966_rReg_i2c(struct w9966_dev* cam, int reg)
return data;
}
-
// Write a register to the i2c device.
// Expects claimed pdev. -1 on error
static int w9966_wReg_i2c(struct w9966_dev* cam, int reg, int data)
@@ -692,23 +693,11 @@ static int w9966_wReg_i2c(struct w9966_dev* cam, int reg, int data)
static int w9966_v4l_open(struct video_device *vdev, int flags)
{
- struct w9966_dev *cam = (struct w9966_dev*)vdev->priv;
- cam->buffer = (u8*)kmalloc(W9966_RBUFFER, GFP_KERNEL);
-
- if (cam->buffer == NULL)
- return -EFAULT;
-
return 0;
}
static void w9966_v4l_close(struct video_device *vdev)
{
- struct w9966_dev *cam = (struct w9966_dev*)vdev->priv;
-
- if (cam->buffer != NULL) {
- kfree(cam->buffer);
- cam->buffer = NULL;
- }
}
static int w9966_v4l_ioctl(struct video_device *vdev, unsigned int cmd, void *arg)
@@ -931,12 +920,13 @@ static long w9966_v4l_read(struct video_device *vdev, char *buf, unsigned long c
while(dleft > 0)
{
unsigned long tsize = (dleft > W9966_RBUFFER) ? W9966_RBUFFER : dleft;
+ unsigned char tbuf[W9966_RBUFFER];
- if (parport_read(cam->pport, cam->buffer, tsize) < tsize) {
+ if (parport_read(cam->pport, tbuf, tsize) < tsize) {
w9966_pdev_release(cam);
return -EFAULT;
}
- if (copy_to_user(dest, cam->buffer, tsize) != 0) {
+ if (copy_to_user(dest, tbuf, tsize) != 0) {
w9966_pdev_release(cam);
return -EFAULT;
}
@@ -958,14 +948,14 @@ static void w9966_attach(struct parport *port)
for (i = 0; i < W9966_MAXCAMS; i++)
{
- if (strcmp(pardev[i], "none") == 0) // Skip if 'none'
- continue;
if (w9966_cams[i].dev_state != 0) // Cam is already assigned
continue;
- if (strcmp(pardev[i], "auto") == 0 ||
- strcmp(pardev[i], port->name) == 0) {
+ if (
+ strcmp(pardev[i], "aggressive") == 0 ||
+ strcmp(pardev[i], port->name) == 0
+ ) {
if (w9966_init(&w9966_cams[i], port) != 0)
- w9966_term(&w9966_cams[i]);
+ w9966_term(&w9966_cams[i]);
break; // return
}
}
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 55e03ff65..62b7cf473 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -2919,7 +2919,7 @@ static void __devexit vortex_remove_one (struct pci_dev *pdev)
static struct pci_driver vortex_driver = {
name: "3c59x",
probe: vortex_init_one,
- remove: __devexit_p(vortex_remove_one),
+ remove: vortex_remove_one,
id_table: vortex_pci_tbl,
#ifdef CONFIG_PM
suspend: vortex_suspend,
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index f91b450e1..ff5f5792f 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -1313,7 +1313,7 @@ static struct pci_driver cp_driver = {
name: DRV_NAME,
id_table: cp_pci_tbl,
probe: cp_init_one,
- remove: __devexit_p(cp_remove_one),
+ remove: cp_remove_one,
};
static int __init cp_init (void)
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 352d60eaf..2d219b466 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -1636,24 +1636,23 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
struct rtl8139_private *tp = dev->priv;
void *ioaddr = tp->mmio_addr;
unsigned int entry;
- unsigned int len = skb->len;
/* Calculate the next Tx descriptor entry. */
entry = tp->cur_tx % NUM_TX_DESC;
- if (likely(len < TX_BUF_SIZE)) {
+ if (likely(skb->len < TX_BUF_SIZE)) {
skb_copy_and_csum_dev(skb, tp->tx_buf[entry]);
dev_kfree_skb(skb);
} else {
dev_kfree_skb(skb);
tp->stats.tx_dropped++;
return 0;
- }
+ }
/* Note: the chip doesn't have auto-pad! */
spin_lock_irq(&tp->lock);
RTL_W32_F (TxStatus0 + (entry * sizeof (u32)),
- tp->tx_flag | max(len, (unsigned int)ETH_ZLEN));
+ tp->tx_flag | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN));
dev->trans_start = jiffies;
@@ -1664,8 +1663,8 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
netif_stop_queue (dev);
spin_unlock_irq(&tp->lock);
- DPRINTK ("%s: Queued Tx packet size %u to slot %d.\n",
- dev->name, len, entry);
+ DPRINTK ("%s: Queued Tx packet at %p size %u to slot %d.\n",
+ dev->name, skb->data, skb->len, entry);
return 0;
}
@@ -2494,7 +2493,7 @@ static struct pci_driver rtl8139_pci_driver = {
name: DRV_NAME,
id_table: rtl8139_pci_tbl,
probe: rtl8139_init_one,
- remove: __devexit_p(rtl8139_remove_one),
+ remove: rtl8139_remove_one,
#ifdef CONFIG_PM
suspend: rtl8139_suspend,
resume: rtl8139_resume,
diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index ff13552a6..a6b5bc7ef 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -160,7 +160,7 @@ static struct pci_driver com20020pci_driver = {
name: "com20020",
id_table: com20020pci_id_table,
probe: com20020pci_probe,
- remove: __devexit_p(com20020pci_remove),
+ remove: com20020pci_remove
};
static int __init com20020pci_init(void)
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c
index 63319f83c..2a08c87cb 100644
--- a/drivers/net/defxx.c
+++ b/drivers/net/defxx.c
@@ -3362,7 +3362,7 @@ MODULE_DEVICE_TABLE(pci, dfx_pci_tbl);
static struct pci_driver dfx_driver = {
name: "defxx",
probe: dfx_init_one,
- remove: __devexit_p(dfx_remove_one),
+ remove: dfx_remove_one,
id_table: dfx_pci_tbl,
};
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 657565a71..161075784 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -1671,7 +1671,7 @@ static struct pci_driver rio_driver = {
name:"dl2k",
id_table:rio_pci_tbl,
probe:rio_probe1,
- remove:__devexit_p(rio_remove1),
+ remove:rio_remove1,
};
static int __init
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index 7576230ae..f9d6cb7de 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -2275,22 +2275,6 @@ static struct pci_device_id eepro100_pci_tbl[] __devinitdata = {
PCI_ANY_ID, PCI_ANY_ID, },
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_7,
PCI_ANY_ID, PCI_ANY_ID, },
- { PCI_VENDOR_ID_INTEL, 0x1032,
- PCI_ANY_ID, PCI_ANY_ID, },
- { PCI_VENDOR_ID_INTEL, 0x1033,
- PCI_ANY_ID, PCI_ANY_ID, },
- { PCI_VENDOR_ID_INTEL, 0x1034,
- PCI_ANY_ID, PCI_ANY_ID, },
- { PCI_VENDOR_ID_INTEL, 0x1038,
- PCI_ANY_ID, PCI_ANY_ID, },
- { PCI_VENDOR_ID_INTEL, 0x1227,
- PCI_ANY_ID, PCI_ANY_ID, },
- { PCI_VENDOR_ID_INTEL, 0x1228,
- PCI_ANY_ID, PCI_ANY_ID, },
- { PCI_VENDOR_ID_INTEL, 0x5200,
- PCI_ANY_ID, PCI_ANY_ID, },
- { PCI_VENDOR_ID_INTEL, 0x5201,
- PCI_ANY_ID, PCI_ANY_ID, },
{ 0,}
};
MODULE_DEVICE_TABLE(pci, eepro100_pci_tbl);
@@ -2299,7 +2283,7 @@ static struct pci_driver eepro100_driver = {
name: "eepro100",
id_table: eepro100_pci_tbl,
probe: eepro100_init_one,
- remove: __devexit_p(eepro100_remove_one),
+ remove: eepro100_remove_one,
#ifdef CONFIG_PM
suspend: eepro100_suspend,
resume: eepro100_resume,
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index f39c07ae4..468c675b4 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -1507,7 +1507,7 @@ static struct pci_driver epic_driver = {
name: DRV_NAME,
id_table: epic_pci_tbl,
probe: epic_init_one,
- remove: __devexit_p(epic_remove_one),
+ remove: epic_remove_one,
#ifdef CONFIG_PM
suspend: epic_suspend,
resume: epic_resume,
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c
index b782518e0..e63a3c542 100644
--- a/drivers/net/fealnx.c
+++ b/drivers/net/fealnx.c
@@ -1858,7 +1858,7 @@ static struct pci_driver fealnx_driver = {
name: "fealnx",
id_table: fealnx_pci_tbl,
probe: fealnx_init_one,
- remove: __devexit_p(fealnx_remove_one),
+ remove: fealnx_remove_one,
};
static int __init fealnx_init(void)
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index 68a88a901..dc1667b24 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -1515,7 +1515,7 @@ static struct pci_driver ioc3_driver = {
name: "ioc3-eth",
id_table: ioc3_pci_tbl,
probe: ioc3_probe,
- remove: __devexit_p(ioc3_remove_one),
+ remove: ioc3_remove_one,
};
static int __init ioc3_init_module(void)
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index 000f83892..e46fe5293 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -1291,7 +1291,7 @@ static struct pci_driver vlsi_irda_driver = {
name: drivername,
id_table: vlsi_irda_table,
probe: vlsi_irda_probe,
- remove: __devexit_p(vlsi_irda_remove),
+ remove: vlsi_irda_remove,
suspend: vlsi_irda_suspend,
resume: vlsi_irda_resume,
};
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 1bd57184c..7d01a2c6e 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -2518,7 +2518,7 @@ static struct pci_driver natsemi_driver = {
name: DRV_NAME,
id_table: natsemi_pci_tbl,
probe: natsemi_probe1,
- remove: __devexit_p(natsemi_remove1),
+ remove: natsemi_remove1,
#ifdef CONFIG_PM
suspend: natsemi_suspend,
resume: natsemi_resume,
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index d1addf61c..0189756a6 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -642,7 +642,7 @@ static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev)
static struct pci_driver ne2k_driver = {
name: DRV_NAME,
probe: ne2k_pci_init_one,
- remove: __devexit_p(ne2k_pci_remove_one),
+ remove: ne2k_pci_remove_one,
id_table: ne2k_pci_tbl,
};
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 55ff98ee4..8a1187855 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -1455,7 +1455,7 @@ static struct pci_driver driver = {
name: "ns83820",
id_table: ns83820_pci_tbl,
probe: ns83820_init_one,
- remove: __devexit_p(ns83820_remove_one),
+ remove: ns83820_remove_one,
#if 0 /* FIXME: implement */
suspend: ,
resume: ,
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c
index ee1d184c4..e94d6c3cb 100644
--- a/drivers/net/pci-skeleton.c
+++ b/drivers/net/pci-skeleton.c
@@ -1980,7 +1980,7 @@ static struct pci_driver netdrv_pci_driver = {
name: MODNAME,
id_table: netdrv_pci_tbl,
probe: netdrv_init_one,
- remove: __devexit_p(netdrv_remove_one),
+ remove: netdrv_remove_one,
#ifdef CONFIG_PM
suspend: netdrv_suspend,
resume: netdrv_resume,
diff --git a/drivers/net/pcmcia/Config.in b/drivers/net/pcmcia/Config.in
index e3eccedcc..e4be90c3d 100644
--- a/drivers/net/pcmcia/Config.in
+++ b/drivers/net/pcmcia/Config.in
@@ -11,10 +11,10 @@ if [ "$CONFIG_NET_PCMCIA" = "y" ]; then
dep_tristate ' 3Com 3c574 PCMCIA support' CONFIG_PCMCIA_3C574 $CONFIG_PCMCIA
dep_tristate ' Fujitsu FMV-J18x PCMCIA support' CONFIG_PCMCIA_FMVJ18X $CONFIG_PCMCIA
dep_tristate ' NE2000 compatible PCMCIA support' CONFIG_PCMCIA_PCNET $CONFIG_PCMCIA
- dep_tristate ' Asix AX88190 PCMCIA support' CONFIG_PCMCIA_AXNET $CONFIG_PCMCIA
dep_tristate ' New Media PCMCIA support' CONFIG_PCMCIA_NMCLAN $CONFIG_PCMCIA
dep_tristate ' SMC 91Cxx PCMCIA support' CONFIG_PCMCIA_SMC91C92 $CONFIG_PCMCIA
dep_tristate ' Xircom 16-bit PCMCIA support' CONFIG_PCMCIA_XIRC2PS $CONFIG_PCMCIA
+ dep_tristate ' broken NS8390-cards support' CONFIG_PCMCIA_AXNET $CONFIG_PCMCIA
dep_tristate ' COM20020 ARCnet PCMCIA support' CONFIG_ARCNET_COM20020_CS $CONFIG_ARCNET_COM20020 $CONFIG_ARCNET $CONFIG_PCMCIA
if [ "$CONFIG_IBMTR" != "y" ]; then
dep_tristate ' IBM PCMCIA tokenring adapter support' CONFIG_PCMCIA_IBMTR $CONFIG_TR $CONFIG_PCMCIA
diff --git a/drivers/net/pcmcia/ax8390.h b/drivers/net/pcmcia/ax8390.h
new file mode 100644
index 000000000..4d94199ad
--- /dev/null
+++ b/drivers/net/pcmcia/ax8390.h
@@ -0,0 +1,193 @@
+/* Generic NS8390 register definitions. */
+/* This file is part of Donald Becker's 8390 drivers, and is distributed
+ under the same license. Auto-loading of 8390.o only in v2.2 - Paul G.
+ Some of these names and comments originated from the Crynwr
+ packet drivers, which are distributed under the GPL. */
+
+#ifndef _8390_h
+#define _8390_h
+
+#include <linux/config.h>
+#include <linux/if_ether.h>
+#include <linux/ioport.h>
+#include <linux/skbuff.h>
+
+#define TX_2X_PAGES 12
+#define TX_1X_PAGES 6
+
+/* Should always use two Tx slots to get back-to-back transmits. */
+#define EI_PINGPONG
+
+#ifdef EI_PINGPONG
+#define TX_PAGES TX_2X_PAGES
+#else
+#define TX_PAGES TX_1X_PAGES
+#endif
+
+#define ETHER_ADDR_LEN 6
+
+/* The 8390 specific per-packet-header format. */
+struct e8390_pkt_hdr {
+ unsigned char status; /* status */
+ unsigned char next; /* pointer to next packet. */
+ unsigned short count; /* header + packet length in bytes */
+};
+
+#ifdef notdef
+extern int ei_debug;
+#else
+#define ei_debug 1
+#endif
+
+#ifndef HAVE_AUTOIRQ
+/* From auto_irq.c */
+extern void autoirq_setup(int waittime);
+extern unsigned long autoirq_report(int waittime);
+#endif
+
+static int ethdev_init(struct net_device *dev);
+static void NS8390_init(struct net_device *dev, int startp);
+static int ei_open(struct net_device *dev);
+static int ei_close(struct net_device *dev);
+static void ei_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+
+/* Most of these entries should be in 'struct net_device' (or most of the
+ things in there should be here!) */
+/* You have one of these per-board */
+struct ei_device {
+ const char *name;
+ void (*reset_8390)(struct net_device *);
+ void (*get_8390_hdr)(struct net_device *, struct e8390_pkt_hdr *, int);
+ void (*block_output)(struct net_device *, int, const unsigned char *, int);
+ void (*block_input)(struct net_device *, int, struct sk_buff *, int);
+ unsigned char mcfilter[8];
+ unsigned open:1;
+ unsigned word16:1; /* We have the 16-bit (vs 8-bit) version of the card. */
+ unsigned txing:1; /* Transmit Active */
+ unsigned irqlock:1; /* 8390's intrs disabled when '1'. */
+ unsigned dmaing:1; /* Remote DMA Active */
+ unsigned char tx_start_page, rx_start_page, stop_page;
+ unsigned char current_page; /* Read pointer in buffer */
+ unsigned char interface_num; /* Net port (AUI, 10bT.) to use. */
+ unsigned char txqueue; /* Tx Packet buffer queue length. */
+ short tx1, tx2; /* Packet lengths for ping-pong tx. */
+ short lasttx; /* Alpha version consistency check. */
+ unsigned char reg0; /* Register '0' in a WD8013 */
+ unsigned char reg5; /* Register '5' in a WD8013 */
+ unsigned char saved_irq; /* Original dev->irq value. */
+ struct net_device_stats stat; /* The new statistics table. */
+ u32 *reg_offset; /* Register mapping table */
+ spinlock_t page_lock; /* Page register locks */
+ unsigned long priv; /* Private field to store bus IDs etc. */
+};
+
+/* The maximum number of 8390 interrupt service routines called per IRQ. */
+#define MAX_SERVICE 12
+
+/* The maximum time waited (in jiffies) before assuming a Tx failed. (20ms) */
+#define TX_TIMEOUT (20*HZ/100)
+
+#define ei_status (*(struct ei_device *)(dev->priv))
+
+/* Some generic ethernet register configurations. */
+#define E8390_TX_IRQ_MASK 0xa /* For register EN0_ISR */
+#define E8390_RX_IRQ_MASK 0x5
+#define E8390_RXCONFIG 0x44 /* EN0_RXCR: broadcasts, no multicast,errors */
+#define E8390_RXOFF 0x20 /* EN0_RXCR: Accept no packets */
+#define E8390_TXCONFIG 0x00 /* EN0_TXCR: Normal transmit mode */
+#define E8390_TXOFF 0x02 /* EN0_TXCR: Transmitter off */
+
+/* Register accessed at EN_CMD, the 8390 base addr. */
+#define E8390_STOP 0x01 /* Stop and reset the chip */
+#define E8390_START 0x02 /* Start the chip, clear reset */
+#define E8390_TRANS 0x04 /* Transmit a frame */
+#define E8390_RREAD 0x08 /* Remote read */
+#define E8390_RWRITE 0x10 /* Remote write */
+#define E8390_NODMA 0x20 /* Remote DMA */
+#define E8390_PAGE0 0x00 /* Select page chip registers */
+#define E8390_PAGE1 0x40 /* using the two high-order bits */
+#define E8390_PAGE2 0x80 /* Page 3 is invalid. */
+
+/*
+ * Only generate indirect loads given a machine that needs them.
+ */
+
+#if defined(CONFIG_MAC) || defined(CONFIG_AMIGA_PCMCIA) || \
+ defined(CONFIG_ARIADNE2) || defined(CONFIG_ARIADNE2_MODULE) || \
+ defined(CONFIG_HYDRA) || defined(CONFIG_HYDRA_MODULE)
+#define EI_SHIFT(x) (ei_local->reg_offset[x])
+#else
+#define EI_SHIFT(x) (x)
+#endif
+
+#define E8390_CMD EI_SHIFT(0x00) /* The command register (for all pages) */
+/* Page 0 register offsets. */
+#define EN0_CLDALO EI_SHIFT(0x01) /* Low byte of current local dma addr RD */
+#define EN0_STARTPG EI_SHIFT(0x01) /* Starting page of ring bfr WR */
+#define EN0_CLDAHI EI_SHIFT(0x02) /* High byte of current local dma addr RD */
+#define EN0_STOPPG EI_SHIFT(0x02) /* Ending page +1 of ring bfr WR */
+#define EN0_BOUNDARY EI_SHIFT(0x03) /* Boundary page of ring bfr RD WR */
+#define EN0_TSR EI_SHIFT(0x04) /* Transmit status reg RD */
+#define EN0_TPSR EI_SHIFT(0x04) /* Transmit starting page WR */
+#define EN0_NCR EI_SHIFT(0x05) /* Number of collision reg RD */
+#define EN0_TCNTLO EI_SHIFT(0x05) /* Low byte of tx byte count WR */
+#define EN0_FIFO EI_SHIFT(0x06) /* FIFO RD */
+#define EN0_TCNTHI EI_SHIFT(0x06) /* High byte of tx byte count WR */
+#define EN0_ISR EI_SHIFT(0x07) /* Interrupt status reg RD WR */
+#define EN0_CRDALO EI_SHIFT(0x08) /* low byte of current remote dma address RD */
+#define EN0_RSARLO EI_SHIFT(0x08) /* Remote start address reg 0 */
+#define EN0_CRDAHI EI_SHIFT(0x09) /* high byte, current remote dma address RD */
+#define EN0_RSARHI EI_SHIFT(0x09) /* Remote start address reg 1 */
+#define EN0_RCNTLO EI_SHIFT(0x0a) /* Remote byte count reg WR */
+#define EN0_RCNTHI EI_SHIFT(0x0b) /* Remote byte count reg WR */
+#define EN0_RSR EI_SHIFT(0x0c) /* rx status reg RD */
+#define EN0_RXCR EI_SHIFT(0x0c) /* RX configuration reg WR */
+#define EN0_TXCR EI_SHIFT(0x0d) /* TX configuration reg WR */
+#define EN0_COUNTER0 EI_SHIFT(0x0d) /* Rcv alignment error counter RD */
+#define EN0_DCFG EI_SHIFT(0x0e) /* Data configuration reg WR */
+#define EN0_COUNTER1 EI_SHIFT(0x0e) /* Rcv CRC error counter RD */
+#define EN0_IMR EI_SHIFT(0x0f) /* Interrupt mask reg WR */
+#define EN0_COUNTER2 EI_SHIFT(0x0f) /* Rcv missed frame error counter RD */
+
+/* Bits in EN0_ISR - Interrupt status register */
+#define ENISR_RX 0x01 /* Receiver, no error */
+#define ENISR_TX 0x02 /* Transmitter, no error */
+#define ENISR_RX_ERR 0x04 /* Receiver, with error */
+#define ENISR_TX_ERR 0x08 /* Transmitter, with error */
+#define ENISR_OVER 0x10 /* Receiver overwrote the ring */
+#define ENISR_COUNTERS 0x20 /* Counters need emptying */
+#define ENISR_RDC 0x40 /* remote dma complete */
+#define ENISR_RESET 0x80 /* Reset completed */
+#define ENISR_ALL 0x3f /* Interrupts we will enable */
+
+/* Bits in EN0_DCFG - Data config register */
+#define ENDCFG_WTS 0x01 /* word transfer mode selection */
+
+/* Page 1 register offsets. */
+#define EN1_PHYS EI_SHIFT(0x01) /* This board's physical enet addr RD WR */
+#define EN1_PHYS_SHIFT(i) EI_SHIFT(i+1) /* Get and set mac address */
+#define EN1_CURPAG EI_SHIFT(0x07) /* Current memory page RD WR */
+#define EN1_MULT EI_SHIFT(0x08) /* Multicast filter mask array (8 bytes) RD WR */
+#define EN1_MULT_SHIFT(i) EI_SHIFT(8+i) /* Get and set multicast filter */
+
+/* Bits in received packet status byte and EN0_RSR*/
+#define ENRSR_RXOK 0x01 /* Received a good packet */
+#define ENRSR_CRC 0x02 /* CRC error */
+#define ENRSR_FAE 0x04 /* frame alignment error */
+#define ENRSR_FO 0x08 /* FIFO overrun */
+#define ENRSR_MPA 0x10 /* missed pkt */
+#define ENRSR_PHY 0x20 /* physical/multicast address */
+#define ENRSR_DIS 0x40 /* receiver disable. set in monitor mode */
+#define ENRSR_DEF 0x80 /* deferring */
+
+/* Transmitted packet status, EN0_TSR. */
+#define ENTSR_PTX 0x01 /* Packet transmitted without error */
+#define ENTSR_ND 0x02 /* The transmit wasn't deferred. */
+#define ENTSR_COL 0x04 /* The transmit collided at least once. */
+#define ENTSR_ABT 0x08 /* The transmit collided 16 times, and was deferred. */
+#define ENTSR_CRS 0x10 /* The carrier sense was lost. */
+#define ENTSR_FU 0x20 /* A "FIFO underrun" occurred during transmit. */
+#define ENTSR_CDH 0x40 /* The collision detect "heartbeat" signal was lost. */
+#define ENTSR_OWC 0x80 /* There was an out-of-window collision. */
+
+#endif /* _8390_h */
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index ddd66f7a0..815823b79 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -11,7 +11,7 @@
Copyright (C) 2001 David A. Hinds -- dahinds@users.sourceforge.net
- axnet_cs.c 1.24 2001/11/18 02:46:51
+ axnet_cs.c 1.11 2001/06/12 12:42:40
The network driver code is based on Donald Becker's NE2000 code:
@@ -20,7 +20,7 @@
Director, National Security Agency. This software may be used and
distributed according to the terms of the GNU General Public License,
incorporated herein by reference.
- Donald Becker may be reached at becker@scyld.com
+ Donald Becker may be reached at becker@cesdis1.gsfc.nasa.gov
======================================================================*/
@@ -33,13 +33,12 @@
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/delay.h>
-#include <linux/spinlock.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/byteorder.h>
#include <linux/netdevice.h>
-#include "../8390.h"
+#include "ax8390.h"
#include <pcmcia/version.h>
#include <pcmcia/cs_types.h>
@@ -52,6 +51,7 @@
#define AXNET_CMD 0x00
#define AXNET_DATAPORT 0x10 /* NatSemi-defined port window offset. */
#define AXNET_RESET 0x1f /* Issue a read to reset, a write to clear. */
+#define AXNET_MISC 0x18 /* For IBM CCAE and Socket EA cards */
#define AXNET_MII_EEP 0x14 /* Offset of MII access port */
#define AXNET_START_PG 0x40 /* First page of TX buffer */
@@ -59,13 +59,26 @@
#define AXNET_RDC_TIMEOUT 0x02 /* Max wait in jiffies for Tx RDC */
-/*====================================================================*/
+#ifdef PCMCIA_DEBUG
+static int pc_debug = PCMCIA_DEBUG;
+MODULE_PARM(pc_debug, "i");
+#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
+static char *version =
+"axnet_cs.c 1.11 2001/06/12 12:42:40 (David Hinds)";
+#else
+#define DEBUG(n, args...)
+#endif
-/* Module parameters */
+#define DEV_KFREE_SKB(skb) dev_kfree_skb(skb);
+#define skb_tx_check(dev, skb)
+#define add_rx_bytes(stats, n) (stats)->rx_bytes += n;
+#define add_tx_bytes(stats, n) (stats)->tx_bytes += n;
+#define netif_mark_up(dev) do { } while (0)
+#define netif_mark_down(dev) do { } while (0)
+
+/*====================================================================*/
-MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
-MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver");
-MODULE_LICENSE("GPL");
+/* Parameters that can be set with 'insmod' */
#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
@@ -74,14 +87,9 @@ INT_MODULE_PARM(irq_mask, 0xdeb8);
static int irq_list[4] = { -1 };
MODULE_PARM(irq_list, "1-4i");
-#ifdef PCMCIA_DEBUG
-INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
-#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
-static char *version =
-"axnet_cs.c 1.24 2001/11/18 02:46:51 (David Hinds)";
-#else
-#define DEBUG(n, args...)
-#endif
+/* Ugh! Let the user hardwire the hardware address for queer cards */
+static int hw_addr[6] = { 0, /* ... */ };
+MODULE_PARM(hw_addr, "6i");
/*====================================================================*/
@@ -112,11 +120,6 @@ static void axnet_detach(dev_link_t *);
static dev_info_t dev_info = "axnet_cs";
static dev_link_t *dev_list;
-static int axdev_init(struct net_device *dev);
-static void AX88190_init(struct net_device *dev, int startp);
-static int ax_open(struct net_device *dev);
-static void ax_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-
/*====================================================================*/
typedef struct axnet_dev_t {
@@ -207,7 +210,7 @@ static dev_link_t *axnet_attach(void)
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
- axdev_init(dev);
+ ethdev_init(dev);
dev->init = &axnet_init;
dev->open = &axnet_open;
dev->stop = &axnet_close;
@@ -299,7 +302,7 @@ static int get_prom(dev_link_t *link)
{0x00, EN0_RCNTHI},
{0x00, EN0_IMR}, /* Mask completion irq. */
{0xFF, EN0_ISR},
- {E8390_RXOFF|0x40, EN0_RXCR}, /* 0x60 Set to monitor */
+ {E8390_RXOFF, EN0_RXCR}, /* 0x20 Set to monitor */
{E8390_TXOFF, EN0_TXCR}, /* 0x02 and loopback mode. */
{0x10, EN0_RCNTLO},
{0x00, EN0_RCNTHI},
@@ -328,6 +331,30 @@ static int get_prom(dev_link_t *link)
/*======================================================================
+ This should be totally unnecessary... but when we can't figure
+ out the hardware address any other way, we'll let the user hard
+ wire it when the module is initialized.
+
+======================================================================*/
+
+static int get_hwired(dev_link_t *link)
+{
+ struct net_device *dev = link->priv;
+ int i;
+
+ for (i = 0; i < 6; i++)
+ if (hw_addr[i] != 0) break;
+ if (i == 6)
+ return 0;
+
+ for (i = 0; i < 6; i++)
+ dev->dev_addr[i] = hw_addr[i];
+
+ return 1;
+} /* get_hwired */
+
+/*======================================================================
+
axnet_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
ethernet device available to the system.
@@ -392,8 +419,7 @@ static void axnet_config(dev_link_t *link)
CS_CHECK(GetTupleData, handle, &tuple);
CS_CHECK(ParseTuple, handle, &tuple, &parse);
link->conf.ConfigBase = parse.config.base;
- /* don't trust the CIS on this; Linksys got it wrong */
- link->conf.Present = 0x63;
+ link->conf.Present = parse.config.rmask[0];
/* Configure card */
link->state |= DEV_CONFIG;
@@ -414,7 +440,7 @@ static void axnet_config(dev_link_t *link)
if ((cfg->index == 0) || (cfg->io.nwin == 0))
goto next_entry;
- link->conf.ConfigIndex = 0x05;
+ link->conf.ConfigIndex = cfg->index;
/* For multifunction cards, by convention, we configure the
network function with window 0, and serial with window 1 */
if (io->nwin > 1) {
@@ -454,9 +480,9 @@ static void axnet_config(dev_link_t *link)
goto failed;
}
- if (!get_prom(link)) {
- printk(KERN_NOTICE "axnet_cs: this is not an AX88190 card!\n");
- printk(KERN_NOTICE "axnet_cs: use pcnet_cs instead.\n");
+ if (!get_prom(link) && !get_hwired(link)) {
+ printk(KERN_NOTICE "axnet_cs: unable to read hardware net"
+ " address for io base %#3lx\n", dev->base_addr);
unregister_netdev(dev);
goto failed;
}
@@ -516,7 +542,7 @@ static void axnet_release(u_long arg)
if (link->open) {
DEBUG(1, "axnet_cs: release postponed, '%s' still open\n",
- ((axnet_dev_t *)(link->priv))->node.dev_name);
+ info->node.dev_name);
link->state |= DEV_STALE_CONFIG;
return;
}
@@ -576,7 +602,7 @@ static int axnet_event(event_t event, int priority,
CardServices(RequestConfiguration, link->handle, &link->conf);
if (link->open) {
axnet_reset_8390(&info->dev);
- AX88190_init(&info->dev, 1);
+ NS8390_init(&info->dev, 1);
netif_device_attach(&info->dev);
}
}
@@ -666,7 +692,7 @@ static int axnet_open(struct net_device *dev)
info->watchdog.expires = jiffies + HZ;
add_timer(&info->watchdog);
- return ax_open(dev);
+ return ei_open(dev);
} /* axnet_open */
/*====================================================================*/
@@ -682,6 +708,7 @@ static int axnet_close(struct net_device *dev)
link->open--;
netif_stop_queue(dev);
+ netif_mark_down(dev);
del_timer(&info->watchdog);
if (link->state & DEV_STALE_CONFIG)
mod_timer(&link->release, jiffies + HZ/20);
@@ -728,7 +755,7 @@ static void ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs)
{
axnet_dev_t *info = dev_id;
info->stale = 0;
- ax_interrupt(irq, dev_id, regs);
+ ei_interrupt(irq, dev_id, regs);
}
static void ei_watchdog(u_long arg)
@@ -780,7 +807,7 @@ static void ei_watchdog(u_long arg)
else
printk(KERN_INFO "%s: link partner did not autonegotiate\n",
dev->name);
- AX88190_init(dev, 1);
+ NS8390_init(dev, 1);
}
info->link_status = link;
}
@@ -917,11 +944,10 @@ module_exit(exit_axnet_cs);
This software may be used and distributed according to the terms
of the GNU General Public License, incorporated herein by reference.
- The author may be reached as becker@scyld.com, or C/O
- Scyld Computing Corporation
- 410 Severn Ave., Suite 210
- Annapolis MD 21403
-
+ The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
+ Center of Excellence in Space Data and Information Sciences
+ Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
+
This is the chip-specific code for many 8390-based ethernet adaptors.
This is not a complete driver, it must be combined with board-specific
code such as ne.c, wd.c, 3c503.c, etc.
@@ -931,6 +957,7 @@ module_exit(exit_axnet_cs);
a simple innocent change. Please contact me or Donald if you think
you have found something that needs changing. -- PG
+
Changelog:
Paul Gortmaker : remove set_bit lock, other cleanups.
@@ -954,8 +981,8 @@ module_exit(exit_axnet_cs);
*/
-static const char *version_8390 =
- "8390.c:v1.10cvs 9/23/94 Donald Becker (becker@scyld.com)\n";
+static const char *version =
+ "8390.c:v1.10cvs 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
#include <asm/uaccess.h>
#include <asm/bitops.h>
@@ -1035,23 +1062,25 @@ static void do_set_multicast_list(struct net_device *dev);
* them.
*/
+
+
/**
- * ax_open - Open/initialize the board.
+ * ei_open - Open/initialize the board.
* @dev: network device to initialize
*
* This routine goes all-out, setting everything
* up anew at each open, even though many of these registers should only
* need to be set once at boot.
*/
-static int ax_open(struct net_device *dev)
+static int ei_open(struct net_device *dev)
{
unsigned long flags;
struct ei_device *ei_local = (struct ei_device *) dev->priv;
- /* This can't happen unless somebody forgot to call axdev_init(). */
+ /* This can't happen unless somebody forgot to call ethdev_init(). */
if (ei_local == NULL)
{
- printk(KERN_EMERG "%s: ax_open passed a non-existent device!\n", dev->name);
+ printk(KERN_EMERG "%s: ei_open passed a non-existent device!\n", dev->name);
return -ENXIO;
}
@@ -1070,9 +1099,10 @@ static int ax_open(struct net_device *dev)
*/
spin_lock_irqsave(&ei_local->page_lock, flags);
- AX88190_init(dev, 1);
+ NS8390_init(dev, 1);
/* Set the flag before we drop the lock, That way the IRQ arrives
after its set and we get no silly warnings */
+ netif_mark_up(dev);
netif_start_queue(dev);
spin_unlock_irqrestore(&ei_local->page_lock, flags);
ei_local->irqlock = 0;
@@ -1080,6 +1110,27 @@ static int ax_open(struct net_device *dev)
}
/**
+ * ei_close - shut down network device
+ * @dev: network device to close
+ *
+ * Opposite of ei_open(). Only used when "ifconfig <devname> down" is done.
+ */
+static int ei_close(struct net_device *dev)
+{
+ unsigned long flags;
+
+ /*
+ * Hold the page lock during close
+ */
+
+ spin_lock_irqsave(&((struct ei_device *)dev->priv)->page_lock, flags);
+ NS8390_init(dev, 0);
+ spin_unlock_irqrestore(&((struct ei_device *)dev->priv)->page_lock, flags);
+ netif_stop_queue(dev);
+ return 0;
+}
+
+/**
* ei_tx_timeout - handle transmit time out condition
* @dev: network device which has apparently fallen asleep
*
@@ -1118,7 +1169,7 @@ void ei_tx_timeout(struct net_device *dev)
/* Try to restart the card. Perhaps the user has fixed something. */
ei_reset_8390(dev);
- AX88190_init(dev, 1);
+ NS8390_init(dev, 1);
spin_unlock(&ei_local->page_lock);
enable_irq(dev->irq);
@@ -1141,6 +1192,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
unsigned long flags;
netif_stop_queue(dev);
+ skb_tx_check(dev, skb);
length = skb->len;
@@ -1153,6 +1205,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
outb_p(0x00, e8390_base + EN0_IMR);
spin_unlock_irqrestore(&ei_local->page_lock, flags);
+
/*
* Slow phase with lock held.
*/
@@ -1165,6 +1218,8 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
send_length = ETH_ZLEN < length ? length : ETH_ZLEN;
+#ifdef EI_PINGPONG
+
/*
* We have two Tx slots available for use. Find the first free
* slot, and then perform some sanity checks. With two Tx bufs,
@@ -1233,6 +1288,22 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
else
netif_start_queue(dev);
+#else /* EI_PINGPONG */
+
+ /*
+ * Only one Tx buffer in use. You need two Tx bufs to come close to
+ * back-to-back transmits. Expect a 20 -> 25% performance hit on
+ * reasonable hardware if you only use one Tx buffer.
+ */
+
+ ei_block_output(dev, length, skb->data, ei_local->tx_start_page);
+ ei_local->txing = 1;
+ NS8390_trigger_send(dev, send_length, ei_local->tx_start_page);
+ dev->trans_start = jiffies;
+ netif_stop_queue(dev);
+
+#endif /* EI_PINGPONG */
+
/* Turn 8390 interrupts back on. */
ei_local->irqlock = 0;
outb_p(ENISR_ALL, e8390_base + EN0_IMR);
@@ -1240,14 +1311,14 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
spin_unlock(&ei_local->page_lock);
enable_irq(dev->irq);
- dev_kfree_skb (skb);
- ei_local->stat.tx_bytes += send_length;
+ DEV_KFREE_SKB (skb);
+ add_tx_bytes(&ei_local->stat, send_length);
return 0;
}
/**
- * ax_interrupt - handle the interrupts from an 8390
+ * ei_interrupt - handle the interrupts from an 8390
* @irq: interrupt number
* @dev_id: a pointer to the net_device
* @regs: unused
@@ -1259,7 +1330,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
* needed.
*/
-static void ax_interrupt(int irq, void *dev_id, struct pt_regs * regs)
+static void ei_interrupt(int irq, void *dev_id, struct pt_regs * regs)
{
struct net_device *dev = dev_id;
long e8390_base;
@@ -1426,6 +1497,8 @@ static void ei_tx_intr(struct net_device *dev)
struct ei_device *ei_local = (struct ei_device *) dev->priv;
int status = inb(e8390_base + EN0_TSR);
+#ifdef EI_PINGPONG
+
/*
* There are two Tx buffers, see which one finished, and trigger
* the send of another one if it exists.
@@ -1468,6 +1541,13 @@ static void ei_tx_intr(struct net_device *dev)
// else printk(KERN_WARNING "%s: unexpected TX-done interrupt, lasttx=%d.\n",
// dev->name, ei_local->lasttx);
+#else /* EI_PINGPONG */
+ /*
+ * Single Tx buffer: mark it free so another packet can be loaded.
+ */
+ ei_local->txing = 0;
+#endif
+
/* Minimize Tx latency: update the statistics after we restart TXing. */
if (status & ENTSR_COL)
ei_local->stat.collisions++;
@@ -1575,7 +1655,7 @@ static void ei_receive(struct net_device *dev)
netif_rx(skb);
dev->last_rx = jiffies;
ei_local->stat.rx_packets++;
- ei_local->stat.rx_bytes += pkt_len;
+ add_rx_bytes(&ei_local->stat, pkt_len);
if (pkt_stat & ENRSR_PHY)
ei_local->stat.multicast++;
}
@@ -1721,11 +1801,11 @@ static void do_set_multicast_list(struct net_device *dev)
long e8390_base = dev->base_addr;
if(dev->flags&IFF_PROMISC)
- outb_p(E8390_RXCONFIG | 0x58, e8390_base + EN0_RXCR);
+ outb_p(E8390_RXCONFIG | 0x18, e8390_base + EN0_RXCR);
else if(dev->flags&IFF_ALLMULTI || dev->mc_list)
- outb_p(E8390_RXCONFIG | 0x48, e8390_base + EN0_RXCR);
+ outb_p(E8390_RXCONFIG | 0x08, e8390_base + EN0_RXCR);
else
- outb_p(E8390_RXCONFIG | 0x40, e8390_base + EN0_RXCR);
+ outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR);
}
/*
@@ -1733,30 +1813,28 @@ static void do_set_multicast_list(struct net_device *dev)
* be parallel to just about everything else. Its also fairly quick and
* not called too often. Must protect against both bh and irq users
*/
-
-#define dev_lock(dev) (((struct ei_device *)(dev)->priv)->page_lock)
-
+
static void set_multicast_list(struct net_device *dev)
{
unsigned long flags;
- spin_lock_irqsave(&dev_lock(dev), flags);
+ spin_lock_irqsave(&((struct ei_device *)dev->priv)->page_lock, flags);
do_set_multicast_list(dev);
- spin_unlock_irqrestore(&dev_lock(dev), flags);
+ spin_unlock_irqrestore(&((struct ei_device *)dev->priv)->page_lock, flags);
}
/**
- * axdev_init - init rest of 8390 device struct
+ * ethdev_init - init rest of 8390 device struct
* @dev: network device structure to init
*
* Initialize the rest of the 8390 device structure. Do NOT __init
* this, as it is used by 8390 based modular drivers too.
*/
-static int axdev_init(struct net_device *dev)
+static int ethdev_init(struct net_device *dev)
{
if (ei_debug > 1)
- printk(version_8390);
+ printk(version);
if (dev->priv == NULL)
{
@@ -1779,18 +1857,20 @@ static int axdev_init(struct net_device *dev)
return 0;
}
+
+
/* This page of functions should be 8390 generic */
/* Follow National Semi's recommendations for initializing the "NIC". */
/**
- * AX88190_init - initialize 8390 hardware
+ * NS8390_init - initialize 8390 hardware
* @dev: network device to initialize
* @startp: boolean. non-zero value to initiate chip processing
*
* Must be called with lock held.
*/
-static void AX88190_init(struct net_device *dev, int startp)
+static void NS8390_init(struct net_device *dev, int startp)
{
axnet_dev_t *info = (axnet_dev_t *)dev;
long e8390_base = dev->base_addr;
@@ -1807,7 +1887,7 @@ static void AX88190_init(struct net_device *dev, int startp)
outb_p(0x00, e8390_base + EN0_RCNTLO);
outb_p(0x00, e8390_base + EN0_RCNTHI);
/* Set to monitor and loopback mode -- this is vital!. */
- outb_p(E8390_RXOFF|0x40, e8390_base + EN0_RXCR); /* 0x60 */
+ outb_p(E8390_RXOFF, e8390_base + EN0_RXCR); /* 0x20 */
outb_p(E8390_TXOFF, e8390_base + EN0_TXCR); /* 0x02 */
/* Set the transmit page and receive ring. */
outb_p(ei_local->tx_start_page, e8390_base + EN0_TPSR);
@@ -1851,7 +1931,7 @@ static void AX88190_init(struct net_device *dev, int startp)
outb_p(E8390_TXCONFIG | info->duplex_flag,
e8390_base + EN0_TXCR); /* xmit on. */
/* 3c503 TechMan says rxconfig only after the NIC is started. */
- outb_p(E8390_RXCONFIG | 0x40, e8390_base + EN0_RXCR); /* rx on, */
+ outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR); /* rx on, */
do_set_multicast_list(dev); /* (re)load the mcast table */
}
}
diff --git a/drivers/net/pcmcia/netwave_cs.c b/drivers/net/pcmcia/netwave_cs.c
index 1f4d51b17..8119f1193 100644
--- a/drivers/net/pcmcia/netwave_cs.c
+++ b/drivers/net/pcmcia/netwave_cs.c
@@ -200,8 +200,6 @@ MODULE_PARM(mem_speed, "i");
MODULE_PARM(irq_mask, "i");
MODULE_PARM(irq_list, "1-4i");
-MODULE_LICENSE("GPL");
-
/*====================================================================*/
/* PCMCIA (Card Services) related functions */
@@ -1599,3 +1597,4 @@ static void set_multicast_list(struct net_device *dev)
writeb(rcvMode, ramBase + NETWAVE_EREG_CB + 1);
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 2);
}
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/pcmcia/xircom_cb.c b/drivers/net/pcmcia/xircom_cb.c
index cc15b93a4..9fb35d9d0 100644
--- a/drivers/net/pcmcia/xircom_cb.c
+++ b/drivers/net/pcmcia/xircom_cb.c
@@ -170,7 +170,7 @@ static struct pci_driver xircom_ops = {
name: "xircom_cb",
id_table: xircom_pci_table,
probe: xircom_probe,
- remove: __devexit_p(xircom_remove),
+ remove: xircom_remove,
};
diff --git a/drivers/net/pcmcia/xircom_tulip_cb.c b/drivers/net/pcmcia/xircom_tulip_cb.c
index 92acf253e..e7fe6ae79 100644
--- a/drivers/net/pcmcia/xircom_tulip_cb.c
+++ b/drivers/net/pcmcia/xircom_tulip_cb.c
@@ -1748,7 +1748,7 @@ static struct pci_driver xircom_driver = {
name: DRV_NAME,
id_table: xircom_pci_table,
probe: xircom_init_one,
- remove: __devexit_p(xircom_remove_one),
+ remove: xircom_remove_one,
#ifdef CONFIG_PM
suspend: xircom_suspend,
resume: xircom_resume
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index f67dd3050..e6140c6cf 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -2098,7 +2098,7 @@ static struct pci_driver sis900_pci_driver = {
name: SIS900_MODULE_NAME,
id_table: sis900_pci_tbl,
probe: sis900_probe,
- remove: __devexit_p(sis900_remove),
+ remove: sis900_remove,
};
static int __init sis900_init_module(void)
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index ff1332e88..0fec2bcce 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -1963,7 +1963,7 @@ static void __devexit starfire_remove_one (struct pci_dev *pdev)
static struct pci_driver starfire_driver = {
name: DRV_NAME,
probe: starfire_init_one,
- remove: __devexit_p(starfire_remove_one),
+ remove: starfire_remove_one,
id_table: starfire_pci_tbl,
};
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index 7c55c0921..ab376ffed 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -1474,7 +1474,7 @@ static struct pci_driver sundance_driver = {
name: DRV_NAME,
id_table: sundance_pci_tbl,
probe: sundance_probe1,
- remove: __devexit_p(sundance_remove1),
+ remove: sundance_remove1,
};
static int __init sundance_init(void)
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c
index 9ba4c8678..58060ea03 100644
--- a/drivers/net/tlan.c
+++ b/drivers/net/tlan.c
@@ -431,7 +431,7 @@ static struct pci_driver tlan_driver = {
name: "tlan",
id_table: tlan_pci_tbl,
probe: tlan_init_one,
- remove: __devexit_p(tlan_remove_one),
+ remove: tlan_remove_one,
};
static int __init tlan_probe(void)
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index 32a11e49b..bbae0d622 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -1812,7 +1812,7 @@ static struct pci_driver streamer_pci_driver = {
name: "lanstreamer",
id_table: streamer_pci_tbl,
probe: streamer_init_one,
- remove: __devexit_p(streamer_remove_one),
+ remove: streamer_remove_one,
};
static int __init streamer_init_module(void) {
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index e1863ed9b..ec2cc2346 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -1705,7 +1705,7 @@ static struct pci_driver olympic_driver = {
name: "olympic",
id_table: olympic_pci_tbl,
probe: olympic_probe,
- remove: __devexit_p(olympic_remove_one),
+ remove: olympic_remove_one
};
static int __init olympic_pci_init(void)
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index fef6b4463..917f1a9be 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -1786,7 +1786,7 @@ static struct pci_driver tulip_driver = {
name: DRV_NAME,
id_table: tulip_pci_tbl,
probe: tulip_init_one,
- remove: __devexit_p(tulip_remove_one),
+ remove: tulip_remove_one,
#ifdef CONFIG_PM
suspend: tulip_suspend,
resume: tulip_resume,
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index e956ead13..2e753ad17 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -1667,7 +1667,7 @@ static struct pci_driver via_rhine_driver = {
name: "via-rhine",
id_table: via_rhine_pci_tbl,
probe: via_rhine_init_one,
- remove: __devexit_p(via_rhine_remove_one),
+ remove: via_rhine_remove_one,
};
diff --git a/drivers/net/wan/comx-hw-mixcom.c b/drivers/net/wan/comx-hw-mixcom.c
index 59b392748..3936d9716 100644
--- a/drivers/net/wan/comx-hw-mixcom.c
+++ b/drivers/net/wan/comx-hw-mixcom.c
@@ -566,6 +566,8 @@ static int MIXCOM_open(struct net_device *dev)
return 0;
+err_restore_flags:
+ restore_flags(flags);
err_release_region:
release_region(dev->base_addr, MIXCOM_IO_EXTENT);
err_ret:
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
index 64258f647..031506a5c 100644
--- a/drivers/net/wan/farsync.c
+++ b/drivers/net/wan/farsync.c
@@ -1810,7 +1810,7 @@ static struct pci_driver fst_driver = {
name: FST_NAME,
id_table: fst_pci_dev_id,
probe: fst_add_one,
- remove: __devexit_p(fst_remove_one),
+ remove: fst_remove_one,
suspend: NULL,
resume: NULL,
};
diff --git a/drivers/net/winbond-840.c b/drivers/net/winbond-840.c
index a28cbf9c8..f81fc206f 100644
--- a/drivers/net/winbond-840.c
+++ b/drivers/net/winbond-840.c
@@ -1697,7 +1697,7 @@ static struct pci_driver w840_driver = {
name: DRV_NAME,
id_table: w840_pci_tbl,
probe: w840_probe1,
- remove: __devexit_p(w840_remove1),
+ remove: w840_remove1,
#ifdef CONFIG_PM
suspend: w840_suspend,
resume: w840_resume,
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 5bb75f000..964485991 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -63,7 +63,7 @@ static struct pci_driver airo_driver = {
name: "airo",
id_table: card_ids,
probe: airo_pci_probe,
- remove: __devexit_p(airo_pci_remove),
+ remove: airo_pci_remove,
};
#endif /* CONFIG_PCI */
diff --git a/drivers/net/wireless/orinoco_plx.c b/drivers/net/wireless/orinoco_plx.c
index 9c84936c4..751a1e733 100644
--- a/drivers/net/wireless/orinoco_plx.c
+++ b/drivers/net/wireless/orinoco_plx.c
@@ -279,7 +279,7 @@ static struct pci_driver orinoco_plx_driver = {
name:"orinoco_plx",
id_table:orinoco_plx_pci_id_table,
probe:orinoco_plx_init_one,
- remove:__devexit_p(orinoco_plx_remove_one),
+ remove:orinoco_plx_remove_one,
suspend:0,
resume:0
};
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 6cd976b85..e169ad56f 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -1506,7 +1506,7 @@ static struct pci_driver yellowfin_driver = {
name: DRV_NAME,
id_table: yellowfin_pci_tbl,
probe: yellowfin_init_one,
- remove: __devexit_p(yellowfin_remove_one),
+ remove: yellowfin_remove_one,
};
diff --git a/drivers/parport/ChangeLog b/drivers/parport/ChangeLog
index 4411d2a1d..39ef2e14d 100644
--- a/drivers/parport/ChangeLog
+++ b/drivers/parport/ChangeLog
@@ -1,33 +1,3 @@
-2001-12-07 Tim Waugh <twaugh@redhat.com>
-
- * ieee1284_ops.c (parport_ieee1284_epp_write_addr,
- parport_ieee1284_epp_read_addr): Actually do something useful.
-
-2001-12-07 Tim Waugh <twaugh@redhat.com>
-
- * parport_pc.c (dmaval): Don't use DMA by default. It seems to be
- too buggy at the moment. Use 'dma=auto' to restore the previous
- behaviour.
-
-2001-12-03 Rich Liu <Rich.Liu@ite.com.tw>
-
- * parport_pc.c (sio_ite_8872_probe): ITE8873 is a single-port
- serial board, not a serial+parallel.
-
-2001-11-30 Neils Kristian Bech Jensen <nkbj@image.dk>
-
- * parport_pc.c: Fix compiler warning.
-
-2001-12-07 Tim Waugh <twaugh@redhat.com>
-
- * daisy.c (DEBUG): Undefine.
-
-2001-12-06 Tim Waugh <twaugh@redhat.com>
-
- * ieee1284_ops.c (parport_ieee1284_ecp_read_data): Mask off
- PARPORT_CONTROL_AUTOFD as well. Bug spotted by Joe
- <joeja@mindspring.com>.
-
2001-11-12 Tim Waugh <twaugh@redhat.com>
* parport_pc.c (init_module): Warn when parameters are ignored.
diff --git a/drivers/parport/Config.in b/drivers/parport/Config.in
index eb13f0748..b4d643315 100644
--- a/drivers/parport/Config.in
+++ b/drivers/parport/Config.in
@@ -24,13 +24,9 @@ if [ "$CONFIG_PARPORT" != "n" ]; then
bool ' Use FIFO/DMA if available (EXPERIMENTAL)' CONFIG_PARPORT_PC_FIFO
bool ' SuperIO chipset support (EXPERIMENTAL)' CONFIG_PARPORT_PC_SUPERIO
fi
- if [ "$CONFIG_HOTPLUG" = "y" -a "$CONFIG_PCMCIA" != "n" ]; then
- if [ "$CONFIG_PARPORT_PC" = "y" ]; then
- dep_tristate ' Support for PCMCIA management for PC-style ports' CONFIG_PARPORT_PC_PCMCIA $CONFIG_PCMCIA
- else
- dep_tristate ' Support for PCMCIA management for PC-style ports' CONFIG_PARPORT_PC_PCMCIA $CONFIG_PARPORT_PC
- fi
- fi
+ fi
+ if [ "$CONFIG_HOTPLUG" = "y" -a "$CONFIG_PCMCIA" != "n" ]; then
+ dep_tristate ' Support for PCMCIA management for PC-style ports' CONFIG_PARPORT_PC_PCMCIA $CONFIG_PCMCIA
fi
if [ "$CONFIG_ARM" = "y" ]; then
dep_tristate ' Archimedes hardware' CONFIG_PARPORT_ARC $CONFIG_PARPORT
diff --git a/drivers/parport/daisy.c b/drivers/parport/daisy.c
index b9ba843b9..573c5ef20 100644
--- a/drivers/parport/daisy.c
+++ b/drivers/parport/daisy.c
@@ -23,7 +23,7 @@
#include <linux/delay.h>
#include <asm/uaccess.h>
-#undef DEBUG /* undef me for production */
+#define DEBUG /* undef me for production */
#ifdef DEBUG
#define DPRINTK(stuff...) printk (stuff)
diff --git a/drivers/parport/ieee1284_ops.c b/drivers/parport/ieee1284_ops.c
index aee6e0065..51f771a62 100644
--- a/drivers/parport/ieee1284_ops.c
+++ b/drivers/parport/ieee1284_ops.c
@@ -514,8 +514,7 @@ size_t parport_ieee1284_ecp_read_data (struct parport *port,
/* Set HostAck low to start accepting data. */
ctl = parport_read_control (port);
- ctl &= ~(PARPORT_CONTROL_STROBE | PARPORT_CONTROL_INIT |
- PARPORT_CONTROL_AUTOFD);
+ ctl &= ~(PARPORT_CONTROL_STROBE | PARPORT_CONTROL_INIT);
parport_write_control (port,
ctl | PARPORT_CONTROL_AUTOFD);
while (count < len) {
@@ -824,40 +823,35 @@ size_t parport_ieee1284_epp_write_addr (struct parport *port,
const void *buffer, size_t len,
int flags)
{
+ /* This is untested */
unsigned char *bp = (unsigned char *) buffer;
size_t ret = 0;
- /* set EPP idle state (just to make sure) with strobe low */
parport_frob_control (port,
PARPORT_CONTROL_STROBE |
- PARPORT_CONTROL_AUTOFD |
PARPORT_CONTROL_SELECT |
- PARPORT_CONTROL_INIT,
+ PARPORT_CONTROL_AUTOFD,
PARPORT_CONTROL_STROBE |
- PARPORT_CONTROL_INIT);
+ PARPORT_CONTROL_SELECT);
port->ops->data_forward (port);
for (; len > 0; len--, bp++) {
- /* Event 56: Write data and set nAStrb low. */
+ /* Write data and assert nAStrb. */
parport_write_data (port, *bp);
parport_frob_control (port, PARPORT_CONTROL_SELECT,
PARPORT_CONTROL_SELECT);
- /* Event 58: wait for busy (nWait) to go high */
- if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY, 0, 10))
+ if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY,
+ PARPORT_STATUS_BUSY, 10))
break;
- /* Event 59: set nAStrb high */
parport_frob_control (port, PARPORT_CONTROL_SELECT, 0);
- /* Event 60: wait for busy (nWait) to go low */
- if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY,
- PARPORT_STATUS_BUSY, 5))
+ if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY, 0, 5))
break;
ret++;
}
- /* Event 61: set strobe (nWrite) high */
parport_frob_control (port, PARPORT_CONTROL_STROBE, 0);
return ret;
@@ -868,36 +862,28 @@ size_t parport_ieee1284_epp_read_addr (struct parport *port,
void *buffer, size_t len,
int flags)
{
+ /* This is untested. */
unsigned char *bp = (unsigned char *) buffer;
unsigned ret = 0;
- /* Set EPP idle state (just to make sure) with strobe high */
parport_frob_control (port,
PARPORT_CONTROL_STROBE |
- PARPORT_CONTROL_AUTOFD |
- PARPORT_CONTROL_SELECT |
- PARPORT_CONTROL_INIT,
- PARPORT_CONTROL_INIT);
+ PARPORT_CONTROL_AUTOFD, 0);
port->ops->data_reverse (port);
for (; len > 0; len--, bp++) {
- /* Event 64: set nSelectIn (nAStrb) low */
- parport_frob_control (port, PARPORT_CONTROL_SELECT,
- PARPORT_CONTROL_SELECT);
+ parport_frob_control (port, PARPORT_CONTROL_SELECT, 0);
- /* Event 58: wait for Busy to go high */
- if (parport_wait_peripheral (port, PARPORT_STATUS_BUSY, 0)) {
+ /* Event 58 */
+ if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY,
+ PARPORT_STATUS_BUSY, 10))
break;
- }
*bp = parport_read_data (port);
- /* Event 59: set nSelectIn (nAStrb) high */
parport_frob_control (port, PARPORT_CONTROL_SELECT,
PARPORT_CONTROL_SELECT);
- /* Event 60: wait for Busy to go low */
- if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY,
- PARPORT_STATUS_BUSY, 5))
+ if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY, 0, 5))
break;
ret++;
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index 783a1bd26..e90aa13c7 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -5,7 +5,7 @@
(specifically, for the Quatech SPP-100 EPP card: other cards will
probably require driver tweaks)
- parport_cs.c 1.24 2001/10/13 14:04:05
+ parport_cs.c 1.20 2000/11/02 23:15:05
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
@@ -57,31 +57,32 @@
#include <pcmcia/cisreg.h>
#include <pcmcia/ciscode.h>
-/*====================================================================*/
+#ifdef PCMCIA_DEBUG
+static int pc_debug = PCMCIA_DEBUG;
+MODULE_PARM(pc_debug, "i");
+#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
+static char *version =
+"parport_cs.c 1.20 2000/11/02 23:15:05 (David Hinds)";
+#else
+#define DEBUG(n, args...)
+#endif
-/* Module parameters */
+#ifndef VERSION
+#define VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+#endif
-MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
-MODULE_DESCRIPTION("PCMCIA parallel port card driver");
-MODULE_LICENSE("Dual MPL/GPL");
+/*====================================================================*/
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
+/* Parameters that can be set with 'insmod' */
/* Bit map of interrupts to choose from */
-INT_MODULE_PARM(irq_mask, 0xdeb8);
+static u_int irq_mask = 0xdeb8;
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
-
-INT_MODULE_PARM(epp_mode, 1);
+static int epp_mode = 1;
-#ifdef PCMCIA_DEBUG
-INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
-#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
-static char *version =
-"parport_cs.c 1.24 2001/10/13 14:04:05 (David Hinds)";
-#else
-#define DEBUG(n, args...)
-#endif
+MODULE_PARM(irq_mask, "i");
+MODULE_PARM(irq_list, "1-4i");
+MODULE_PARM(epp_mode, "i");
/*====================================================================*/
@@ -104,6 +105,9 @@ static int parport_event(event_t event, int priority,
static dev_info_t dev_info = "parport_cs";
static dev_link_t *dev_list = NULL;
+extern struct parport_operations parport_pc_ops;
+static struct parport_operations parport_cs_ops;
+
/*====================================================================*/
static void cs_error(client_handle_t handle, int func, int ret)
@@ -303,6 +307,19 @@ void parport_config(dev_link_t *link)
goto failed;
}
+#if (LINUX_VERSION_CODE < VERSION(2,3,6))
+#if (LINUX_VERSION_CODE >= VERSION(2,2,8))
+ p->private_data = kmalloc(sizeof(struct parport_pc_private),
+ GFP_KERNEL);
+ ((struct parport_pc_private *)(p->private_data))->ctr = 0x0c;
+#endif
+ parport_proc_register(p);
+ p->flags |= PARPORT_FLAG_COMA;
+ parport_pc_write_econtrol(p, 0x00);
+ parport_pc_write_control(p, 0x0c);
+ parport_pc_write_data(p, 0x00);
+#endif
+
p->modes |= PARPORT_MODE_PCSPP;
if (epp_mode)
p->modes |= PARPORT_MODE_TRISTATE | PARPORT_MODE_EPP;
@@ -348,8 +365,14 @@ void parport_cs_release(u_long arg)
if (info->ndev) {
struct parport *p = info->port;
+#if (LINUX_VERSION_CODE < VERSION(2,3,6))
+ if (!(p->flags & PARPORT_FLAG_COMA))
+ parport_quiesce(p);
+#endif
parport_proc_unregister(p);
+#if (LINUX_VERSION_CODE >= VERSION(2,2,8))
kfree(p->private_data);
+#endif
parport_unregister_port(p);
}
info->ndev = 0;
@@ -407,6 +430,24 @@ int parport_event(event_t event, int priority,
/*====================================================================*/
+#if (LINUX_VERSION_CODE < VERSION(2,3,6))
+
+static void inc_use_count(void)
+{
+ MOD_INC_USE_COUNT;
+ parport_pc_ops.inc_use_count();
+}
+
+static void dec_use_count(void)
+{
+ MOD_DEC_USE_COUNT;
+ parport_pc_ops.dec_use_count();
+}
+
+#endif
+
+/*====================================================================*/
+
static int __init init_parport_cs(void)
{
servinfo_t serv;
@@ -418,6 +459,13 @@ static int __init init_parport_cs(void)
return -1;
}
+#if (LINUX_VERSION_CODE < VERSION(2,3,6))
+ /* This is to protect against unloading modules out of order */
+ parport_cs_ops = parport_pc_ops;
+ parport_cs_ops.inc_use_count = &inc_use_count;
+ parport_cs_ops.dec_use_count = &dec_use_count;
+#endif
+
register_pccard_driver(&dev_info, &parport_attach, &parport_detach);
return 0;
}
@@ -432,3 +480,4 @@ static void __exit exit_parport_cs(void)
module_init(init_parport_cs);
module_exit(exit_parport_cs);
+MODULE_LICENSE("Dual MPL/GPL");
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 6973a2f64..0c5c82a3b 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -91,9 +91,7 @@ static struct superio_struct { /* For Super-IO chips autodetection */
} superios[NR_SUPERIOS] __devinitdata = { {0,},};
static int user_specified __devinitdata = 0;
-#if defined(CONFIG_PARPORT_PC_FIFO) || defined(CONFIG_PARPORT_PC_SUPERIO)
static int verbose_probing;
-#endif
static int registered_parport;
/* frob_control, but for ECR */
@@ -1782,7 +1780,6 @@ static int __devinit parport_PS2_supported(struct parport *pb)
return ok;
}
-#ifdef CONFIG_PARPORT_PC_FIFO
static int __devinit parport_ECP_supported(struct parport *pb)
{
int i;
@@ -1908,7 +1905,6 @@ static int __devinit parport_ECP_supported(struct parport *pb)
return 1;
}
-#endif
static int __devinit parport_ECPPS2_supported(struct parport *pb)
{
@@ -2008,9 +2004,7 @@ static int __devinit parport_ECPEPP_supported(struct parport *pb)
/* Don't bother probing for modes we know we won't use. */
static int __devinit parport_PS2_supported(struct parport *pb) { return 0; }
-#ifdef CONFIG_PARPORT_PC_FIFO
static int __devinit parport_ECP_supported(struct parport *pb) { return 0; }
-#endif
static int __devinit parport_EPP_supported(struct parport *pb) { return 0; }
static int __devinit parport_ECPEPP_supported(struct parport *pb){return 0;}
static int __devinit parport_ECPPS2_supported(struct parport *pb){return 0;}
@@ -2459,8 +2453,9 @@ static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq,
ite8872set = 0x64e00000;
break;
case 0x6:
- printk (KERN_INFO "parport_pc: ITE8873 found (1S)\n");
- return 0;
+ printk (KERN_INFO "parport_pc: ITE8873 found (1S1P)\n");
+ ite8872set = 0x64a00000;
+ break;
case 0x8:
DPRINTK (KERN_DEBUG "parport_pc: ITE8874 found (2S)\n");
return 0;
@@ -3012,7 +3007,7 @@ EXPORT_SYMBOL (parport_pc_unregister_port);
static int io[PARPORT_PC_MAX_PORTS+1] = { [0 ... PARPORT_PC_MAX_PORTS] = 0 };
static int io_hi[PARPORT_PC_MAX_PORTS+1] =
{ [0 ... PARPORT_PC_MAX_PORTS] = PARPORT_IOHI_AUTO };
-static int dmaval[PARPORT_PC_MAX_PORTS] = { [0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_DMA_NONE };
+static int dmaval[PARPORT_PC_MAX_PORTS] = { [0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_DMA_AUTO };
static int irqval[PARPORT_PC_MAX_PORTS] = { [0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_IRQ_PROBEONLY };
static const char *irq[PARPORT_PC_MAX_PORTS] = { NULL, };
static const char *dma[PARPORT_PC_MAX_PORTS] = { NULL, };
@@ -3029,10 +3024,8 @@ MODULE_PARM_DESC(irq, "IRQ line");
MODULE_PARM(irq, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "s");
MODULE_PARM_DESC(dma, "DMA channel");
MODULE_PARM(dma, "1-" __MODULE_STRING(PARPORT_PC_MAX_PORTS) "s");
-#if defined(CONFIG_PARPORT_PC_FIFO) || defined(CONFIG_PARPORT_PC_SUPERIO)
-MODULE_PARM_DESC(verbose_probing, "Log chit-chat during initialisation");
MODULE_PARM(verbose_probing, "i");
-#endif
+MODULE_PARM_DESC(verbose_probing, "Log chit-chat during initialisation");
int init_module(void)
{
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index 52649275c..6eb80f07f 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -331,7 +331,7 @@ static struct pci_driver parport_serial_pci_driver = {
name: "parport_serial",
id_table: parport_serial_pci_tbl,
probe: parport_serial_pci_probe,
- remove: __devexit_p(parport_serial_pci_remove),
+ remove: parport_serial_pci_remove,
};
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 070c3f773..2eb64a8f0 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -264,11 +264,11 @@ static int setup_cis_mem(socket_info_t *s)
(s->cis_mem.sys_start == 0)) {
int low = !(s->cap.features & SS_CAP_PAGE_REGS);
vs = s;
- validate_mem(cis_readable, checksum_match, low, s);
+ validate_mem(cis_readable, checksum_match, low);
s->cis_mem.sys_start = 0;
vs = NULL;
if (find_mem_region(&s->cis_mem.sys_start, s->cap.map_size,
- s->cap.map_size, low, "card services", s)) {
+ s->cap.map_size, low, "card services")) {
printk(KERN_NOTICE "cs: unable to map card memory!\n");
return CS_OUT_OF_RESOURCE;
}
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 37136815d..53927ece5 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -809,7 +809,7 @@ static int alloc_io_space(socket_info_t *s, u_int attr, ioaddr_t *base,
return 1;
for (i = 0; i < MAX_IO_WIN; i++) {
if (s->io[i].NumPorts == 0) {
- if (find_io_region(base, num, align, name, s) == 0) {
+ if (find_io_region(base, num, align, name) == 0) {
s->io[i].Attributes = attr;
s->io[i].BasePort = *base;
s->io[i].NumPorts = s->io[i].InUse = num;
@@ -821,7 +821,7 @@ static int alloc_io_space(socket_info_t *s, u_int attr, ioaddr_t *base,
/* Try to extend top of window */
try = s->io[i].BasePort + s->io[i].NumPorts;
if ((*base == 0) || (*base == try))
- if (find_io_region(&try, num, 0, name, s) == 0) {
+ if (find_io_region(&try, num, 0, name) == 0) {
*base = try;
s->io[i].NumPorts += num;
s->io[i].InUse += num;
@@ -830,7 +830,7 @@ static int alloc_io_space(socket_info_t *s, u_int attr, ioaddr_t *base,
/* Try to extend bottom of window */
try = s->io[i].BasePort - num;
if ((*base == 0) || (*base == try))
- if (find_io_region(&try, num, 0, name, s) == 0) {
+ if (find_io_region(&try, num, 0, name) == 0) {
s->io[i].BasePort = *base = try;
s->io[i].NumPorts += num;
s->io[i].InUse += num;
@@ -1974,7 +1974,7 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle
find_mem_region(&win->base, win->size, align,
(req->Attributes & WIN_MAP_BELOW_1MB) ||
!(s->cap.features & SS_CAP_PAGE_REGS),
- (*handle)->dev_info, s))
+ (*handle)->dev_info))
return CS_IN_USE;
(*handle)->state |= CLIENT_WIN_REQ(w);
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h
index 2844ac2af..126506431 100644
--- a/drivers/pcmcia/cs_internal.h
+++ b/drivers/pcmcia/cs_internal.h
@@ -238,11 +238,11 @@ int copy_memory(memory_handle_t handle, copy_op_t *req);
/* In rsrc_mgr */
void validate_mem(int (*is_valid)(u_long), int (*do_cksum)(u_long),
- int force_low, socket_info_t *s);
+ int force_low);
int find_io_region(ioaddr_t *base, ioaddr_t num, ioaddr_t align,
- char *name, socket_info_t *s);
+ char *name);
int find_mem_region(u_long *base, u_long num, u_long align,
- int force_low, char *name, socket_info_t *s);
+ int force_low, char *name);
int try_irq(u_int Attributes, int irq, int specific);
void undo_irq(u_int Attributes, int irq);
int adjust_resource_info(client_handle_t handle, adjust_t *adj);
diff --git a/drivers/pcmcia/pci_socket.c b/drivers/pcmcia/pci_socket.c
index d30df9b42..7c6615a64 100644
--- a/drivers/pcmcia/pci_socket.c
+++ b/drivers/pcmcia/pci_socket.c
@@ -249,7 +249,7 @@ static struct pci_driver pci_cardbus_driver = {
name: "cardbus",
id_table: cardbus_table,
probe: cardbus_probe,
- remove: __devexit_p(cardbus_remove),
+ remove: cardbus_remove,
suspend: cardbus_suspend,
resume: cardbus_resume,
};
diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c
index 9519d2c6d..5cfd31aac 100644
--- a/drivers/pcmcia/rsrc_mgr.c
+++ b/drivers/pcmcia/rsrc_mgr.c
@@ -44,7 +44,6 @@
#include <linux/ioport.h>
#include <linux/timer.h>
#include <linux/proc_fs.h>
-#include <linux/pci.h>
#include <asm/irq.h>
#include <asm/io.h>
@@ -104,82 +103,8 @@ static irq_info_t irq_table[NR_IRQS] = { { 0, 0, 0 }, /* etc */ };
======================================================================*/
-static struct resource *resource_parent(unsigned long b, unsigned long n,
- int flags, struct pci_dev *dev)
-{
-#ifdef CONFIG_PCI
- struct resource res, *pr;
-
- if (dev != NULL) {
- res.start = b;
- res.end = b + n - 1;
- res.flags = flags;
- pr = pci_find_parent_resource(dev, &res);
- if (pr)
- return pr;
- }
-#endif /* CONFIG_PCI */
- if (flags & IORESOURCE_MEM)
- return &iomem_resource;
- return &ioport_resource;
-}
-
-static inline int check_io_resource(unsigned long b, unsigned long n,
- struct pci_dev *dev)
-{
- return check_resource(resource_parent(b, n, IORESOURCE_IO, dev), b, n);
-}
-
-static inline int check_mem_resource(unsigned long b, unsigned long n,
- struct pci_dev *dev)
-{
- return check_resource(resource_parent(b, n, IORESOURCE_MEM, dev), b, n);
-}
-
-static struct resource *make_resource(unsigned long b, unsigned long n,
- int flags, char *name)
-{
- struct resource *res = kmalloc(sizeof(*res), GFP_KERNEL);
-
- if (res) {
- memset(res, 0, sizeof(*res));
- res->name = name;
- res->start = b;
- res->end = b + n - 1;
- res->flags = flags | IORESOURCE_BUSY;
- }
- return res;
-}
-
-static int request_io_resource(unsigned long b, unsigned long n,
- char *name, struct pci_dev *dev)
-{
- struct resource *res = make_resource(b, n, IORESOURCE_IO, name);
- struct resource *pr = resource_parent(b, n, IORESOURCE_IO, dev);
- int err = -ENOMEM;
-
- if (res) {
- err = request_resource(pr, res);
- if (err)
- kfree(res);
- }
- return err;
-}
-
-static int request_mem_resource(unsigned long b, unsigned long n,
- char *name, struct pci_dev *dev)
-{
- struct resource *res = make_resource(b, n, IORESOURCE_MEM, name);
- struct resource *pr = resource_parent(b, n, IORESOURCE_MEM, dev);
- int err = -ENOMEM;
-
- if (res) {
- err = request_resource(pr, res);
- if (err)
- kfree(res);
- }
- return err;
-}
+#define check_io_resource(b,n) check_resource(&ioport_resource, (b), (n))
+#define check_mem_resource(b,n) check_resource(&iomem_resource, (b), (n))
/*======================================================================
@@ -269,7 +194,7 @@ static void do_io_probe(ioaddr_t base, ioaddr_t num)
}
memset(b, 0, 256);
for (i = base, most = 0; i < base+num; i += 8) {
- if (check_io_resource(i, 8, NULL))
+ if (check_io_resource(i, 8))
continue;
hole = inb(i);
for (j = 1; j < 8; j++)
@@ -282,7 +207,7 @@ static void do_io_probe(ioaddr_t base, ioaddr_t num)
bad = any = 0;
for (i = base; i < base+num; i += 8) {
- if (check_io_resource(i, 8, NULL))
+ if (check_io_resource(i, 8))
continue;
for (j = 0; j < 8; j++)
if (inb(i+j) != most) break;
@@ -322,8 +247,7 @@ static void do_io_probe(ioaddr_t base, ioaddr_t num)
======================================================================*/
static int do_mem_probe(u_long base, u_long num,
- int (*is_valid)(u_long), int (*do_cksum)(u_long),
- socket_info_t *s)
+ int (*is_valid)(u_long), int (*do_cksum)(u_long))
{
u_long i, j, bad, fail, step;
@@ -334,14 +258,13 @@ static int do_mem_probe(u_long base, u_long num,
for (i = j = base; i < base+num; i = j + step) {
if (!fail) {
for (j = i; j < base+num; j += step)
- if ((check_mem_resource(j, step, s->cap.cb_dev) == 0) &&
- is_valid(j))
+ if ((check_mem_resource(j, step) == 0) && is_valid(j))
break;
fail = ((i == base) && (j == base+num));
}
if (fail) {
for (j = i; j < base+num; j += 2*step)
- if ((check_mem_resource(j, 2*step, s->cap.cb_dev) == 0) &&
+ if ((check_mem_resource(j, 2*step) == 0) &&
do_cksum(j) && do_cksum(j+step))
break;
}
@@ -360,12 +283,12 @@ static int do_mem_probe(u_long base, u_long num,
static u_long inv_probe(int (*is_valid)(u_long),
int (*do_cksum)(u_long),
- resource_map_t *m, socket_info_t *s)
+ resource_map_t *m)
{
u_long ok;
if (m == &mem_db)
return 0;
- ok = inv_probe(is_valid, do_cksum, m->next, s);
+ ok = inv_probe(is_valid, do_cksum, m->next);
if (ok) {
if (m->base >= 0x100000)
sub_interval(&mem_db, m->base, m->num);
@@ -373,11 +296,11 @@ static u_long inv_probe(int (*is_valid)(u_long),
}
if (m->base < 0x100000)
return 0;
- return do_mem_probe(m->base, m->num, is_valid, do_cksum, s);
+ return do_mem_probe(m->base, m->num, is_valid, do_cksum);
}
void validate_mem(int (*is_valid)(u_long), int (*do_cksum)(u_long),
- int force_low, socket_info_t *s)
+ int force_low)
{
resource_map_t *m, *n;
static u_char order[] = { 0xd0, 0xe0, 0xc0, 0xf0 };
@@ -387,7 +310,7 @@ void validate_mem(int (*is_valid)(u_long), int (*do_cksum)(u_long),
if (!probe_mem) return;
/* We do up to four passes through the list */
if (!force_low) {
- if (hi++ || (inv_probe(is_valid, do_cksum, mem_db.next, s) > 0))
+ if (hi++ || (inv_probe(is_valid, do_cksum, mem_db.next) > 0))
return;
printk(KERN_NOTICE "cs: warning: no high memory space "
"available!\n");
@@ -398,7 +321,7 @@ void validate_mem(int (*is_valid)(u_long), int (*do_cksum)(u_long),
/* Only probe < 1 MB */
if (m->base >= 0x100000) continue;
if ((m->base | m->num) & 0xffff) {
- ok += do_mem_probe(m->base, m->num, is_valid, do_cksum, s);
+ ok += do_mem_probe(m->base, m->num, is_valid, do_cksum);
continue;
}
/* Special probe for 64K-aligned block */
@@ -408,7 +331,7 @@ void validate_mem(int (*is_valid)(u_long), int (*do_cksum)(u_long),
if (ok >= mem_limit)
sub_interval(&mem_db, b, 0x10000);
else
- ok += do_mem_probe(b, 0x10000, is_valid, do_cksum, s);
+ ok += do_mem_probe(b, 0x10000, is_valid, do_cksum);
}
}
}
@@ -417,7 +340,7 @@ void validate_mem(int (*is_valid)(u_long), int (*do_cksum)(u_long),
#else /* CONFIG_ISA */
void validate_mem(int (*is_valid)(u_long), int (*do_cksum)(u_long),
- int force_low, socket_info_t *s)
+ int force_low)
{
resource_map_t *m;
static int done = 0;
@@ -425,7 +348,7 @@ void validate_mem(int (*is_valid)(u_long), int (*do_cksum)(u_long),
if (!probe_mem || done++)
return;
for (m = mem_db.next; m != &mem_db; m = m->next)
- if (do_mem_probe(m->base, m->num, is_valid, do_cksum, s))
+ if (do_mem_probe(m->base, m->num, is_valid, do_cksum))
return;
}
@@ -445,7 +368,7 @@ void validate_mem(int (*is_valid)(u_long), int (*do_cksum)(u_long),
======================================================================*/
int find_io_region(ioaddr_t *base, ioaddr_t num, ioaddr_t align,
- char *name, socket_info_t *s)
+ char *name)
{
ioaddr_t try;
resource_map_t *m;
@@ -455,8 +378,9 @@ int find_io_region(ioaddr_t *base, ioaddr_t num, ioaddr_t align,
for (try = (try >= m->base) ? try : try+align;
(try >= m->base) && (try+num <= m->base+m->num);
try += align) {
- if (request_io_resource(try, num, name, s->cap.cb_dev) == 0) {
+ if (check_io_resource(try, num) == 0) {
*base = try;
+ request_region(try, num, name);
return 0;
}
if (!align) break;
@@ -466,7 +390,7 @@ int find_io_region(ioaddr_t *base, ioaddr_t num, ioaddr_t align,
}
int find_mem_region(u_long *base, u_long num, u_long align,
- int force_low, char *name, socket_info_t *s)
+ int force_low, char *name)
{
u_long try;
resource_map_t *m;
@@ -479,7 +403,8 @@ int find_mem_region(u_long *base, u_long num, u_long align,
for (try = (try >= m->base) ? try : try+align;
(try >= m->base) && (try+num <= m->base+m->num);
try += align) {
- if (request_mem_resource(try, num, name, s->cap.cb_dev) == 0) {
+ if (check_mem_resource(try, num) == 0) {
+ request_mem_region(try, num, name);
*base = try;
return 0;
}
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index eab889e86..4d007c240 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -83,6 +83,8 @@
* basically, transfer size needs to be reduced by one
* and the last byte read as is done with PSEUDO_DMA.
*
+ * 3. Test USLEEP code
+ *
* 4. Test SCSI-II tagged queueing (I have no devices which support
* tagged queueing)
*
@@ -108,12 +110,6 @@
#define READ_OVERRUNS
#endif
-#ifdef BOARD_REQUIRES_NO_DELAY
-#define io_recovery_delay(x)
-#else
-#define io_recovery_delay(x) udelay(x)
-#endif
-
/*
* Design
* Issues :
@@ -196,8 +192,9 @@
* phase goes through the various phases as instructed by the target.
* if the target goes into MSG IN and sends a DISCONNECT message,
* the command structure is placed into the per instance disconnected
- * queue, and NCR5380_main tries to find more work. If the target is
- * idle for too long, the system will try to sleep.
+ * queue, and NCR5380_main tries to find more work. If USLEEP
+ * was defined, and the target is idle for too long, the system
+ * will try to sleep.
*
* If a command has disconnected, eventually an interrupt will trigger,
* calling NCR5380_intr() which will in turn call NCR5380_reselect
@@ -247,14 +244,21 @@
* rely on phase mismatch and EOP interrupts to determine end
* of phase.
*
+ * SCSI2 - if defined, SCSI-2 tagged queuing is used where possible
+ *
* UNSAFE - leave interrupts enabled during pseudo-DMA transfers. You
* only really want to use this if you're having a problem with
* dropped characters during high speed communications, and even
* then, you're going to be better off twiddling with transfersize
* in the high level code.
*
- * Defaults for these will be provided although the user may want to adjust
- * these to allocate CPU resources to the SCSI driver or "real" code.
+ * USLEEP - if defined, on devices that aren't disconnecting from the
+ * bus, we will go to sleep so that the CPU can get real work done
+ * when we run a command that won't complete immediately.
+ *
+ * Defaults for these will be provided if USLEEP is defined, although
+ * the user may want to adjust these to allocate CPU resources to
+ * the SCSI driver or "real" code.
*
* USLEEP_SLEEP - amount of time, in jiffies, to sleep
*
@@ -318,13 +322,18 @@ static int do_abort(struct Scsi_Host *host);
static void do_reset(struct Scsi_Host *host);
static struct Scsi_Host *first_instance = NULL;
static Scsi_Host_Template *the_template = NULL;
-static struct timer_list usleep_timer;
+
+#ifdef USLEEP
+struct timer_list usleep_timer;
+#endif
/*
- * initialize_SCp - init the scsi pointer field
- * @cmd: command block to set up
+ * Function : void initialize_SCp(Scsi_Cmnd *cmd)
+ *
+ * Purpose : initialize the saved data pointers for cmd to point to the
+ * start of the buffer.
*
- * Set up the internal fields in the SCSI command.
+ * Inputs : cmd - Scsi_Cmnd structure to have pointers reset.
*/
static __inline__ void initialize_SCp(Scsi_Cmnd * cmd)
@@ -353,49 +362,88 @@ static __inline__ void initialize_SCp(Scsi_Cmnd * cmd)
static struct {
unsigned char mask;
const char *name;
-} signals[] = {
- {SR_DBP, "PARITY"},
- {SR_RST, "RST"},
- {SR_BSY, "BSY"},
- {SR_REQ, "REQ"},
- {SR_MSG, "MSG"},
- {SR_CD, "CD"},
- {SR_IO, "IO"},
- {SR_SEL, "SEL"},
- {0, NULL}
-},
-basrs[] = {
- {BASR_ATN, "ATN"},
- {BASR_ACK, "ACK"},
- {0, NULL}
-},
-icrs[] = {
- {ICR_ASSERT_RST, "ASSERT RST"},
- {ICR_ASSERT_ACK, "ASSERT ACK"},
- {ICR_ASSERT_BSY, "ASSERT BSY"},
- {ICR_ASSERT_SEL, "ASSERT SEL"},
- {ICR_ASSERT_ATN, "ASSERT ATN"},
- {ICR_ASSERT_DATA, "ASSERT DATA"},
- {0, NULL}
-},
-mrs[] = {
- {MR_BLOCK_DMA_MODE, "MODE BLOCK DMA"},
- {MR_TARGET, "MODE TARGET"},
- {MR_ENABLE_PAR_CHECK, "MODE PARITY CHECK"},
- {MR_ENABLE_PAR_INTR, "MODE PARITY INTR"},
- {MR_MONITOR_BSY, "MODE MONITOR BSY"},
- {MR_DMA_MODE, "MODE DMA"},
- {MR_ARBITRATE, "MODE ARBITRATION"},
- {0, NULL}
+} signals[] = { {
+
+ SR_DBP, "PARITY"
+}, {
+ SR_RST, "RST"
+}, {
+ SR_BSY, "BSY"
+},
+{
+ SR_REQ, "REQ"
+}, {
+ SR_MSG, "MSG"
+}, {
+ SR_CD, "CD"
+}, {
+ SR_IO, "IO"
+},
+{
+ SR_SEL, "SEL"
+}, {
+ 0, NULL
+}
+},
+
+basrs[] = { {
+ BASR_ATN, "ATN"
+}, {
+ BASR_ACK, "ACK"
+}, {
+ 0, NULL
+}
+},
+
+icrs[] = { {
+ ICR_ASSERT_RST, "ASSERT RST"
+}, {
+ ICR_ASSERT_ACK, "ASSERT ACK"
+},
+{
+ ICR_ASSERT_BSY, "ASSERT BSY"
+}, {
+ ICR_ASSERT_SEL, "ASSERT SEL"
+},
+{
+ ICR_ASSERT_ATN, "ASSERT ATN"
+}, {
+ ICR_ASSERT_DATA, "ASSERT DATA"
+},
+{
+ 0, NULL
+}
+},
+
+mrs[] = { {
+ MR_BLOCK_DMA_MODE, "MODE BLOCK DMA"
+}, {
+ MR_TARGET, "MODE TARGET"
+},
+{
+ MR_ENABLE_PAR_CHECK, "MODE PARITY CHECK"
+}, {
+ MR_ENABLE_PAR_INTR,
+ "MODE PARITY INTR"
+}, {
+ MR_MONITOR_BSY, "MODE MONITOR BSY"
+},
+{
+ MR_DMA_MODE, "MODE DMA"
+}, {
+ MR_ARBITRATE, "MODE ARBITRATION"
+},
+{
+ 0, NULL
+}
};
-/**
- * NCR5380_print - print scsi bus signals
- * @instance: adapter state to dump
+/*
+ * Function : void NCR5380_print(struct Scsi_Host *instance)
*
- * Print the SCSI bus signals for debugging purposes
+ * Purpose : print the SCSI bus signals for debugging purposes
*
- * Locks: none
+ * Input : instance - which NCR5380
*/
static void NCR5380_print(struct Scsi_Host *instance)
@@ -404,7 +452,6 @@ static void NCR5380_print(struct Scsi_Host *instance)
unsigned long flags;
unsigned char status, data, basr, mr, icr, i;
NCR5380_setup(instance);
- /* FIXME - this needs proper locking */
save_flags(flags);
cli();
data = NCR5380_read(CURRENT_SCSI_DATA_REG);
@@ -436,22 +483,32 @@ static struct {
unsigned char value;
const char *name;
} phases[] = {
- {PHASE_DATAOUT, "DATAOUT"},
- {PHASE_DATAIN, "DATAIN"},
- {PHASE_CMDOUT, "CMDOUT"},
- {PHASE_STATIN, "STATIN"},
- {PHASE_MSGOUT, "MSGOUT"},
- {PHASE_MSGIN, "MSGIN"},
- {PHASE_UNKNOWN, "UNKNOWN"}
+
+ {
+ PHASE_DATAOUT, "DATAOUT"
+ }, {
+ PHASE_DATAIN, "DATAIN"
+ }, {
+ PHASE_CMDOUT, "CMDOUT"
+ },
+ {
+ PHASE_STATIN, "STATIN"
+ }, {
+ PHASE_MSGOUT, "MSGOUT"
+ }, {
+ PHASE_MSGIN, "MSGIN"
+ },
+ {
+ PHASE_UNKNOWN, "UNKNOWN"
+ }
};
/*
- * NCR5380_print_phase - show SCSI phase
- * @instance: adapter to dump
+ * Function : void NCR5380_print_phase(struct Scsi_Host *instance)
*
- * Print the current SCSI phase for debugging purposes
+ * Purpose : print the current SCSI phase for debugging purposes
*
- * Locks: none
+ * Input : instance - which NCR5380
*/
static void NCR5380_print_phase(struct Scsi_Host *instance)
@@ -463,9 +520,11 @@ static void NCR5380_print_phase(struct Scsi_Host *instance)
status = NCR5380_read(STATUS_REG);
if (!(status & SR_REQ))
- printk("scsi%d : REQ not asserted, phase unknown.\n", instance->host_no);
+ printk("scsi%d : REQ not asserted, phase unknown.\n",
+ instance->host_no);
else {
- for (i = 0; (phases[i].value != PHASE_UNKNOWN) && (phases[i].value != (status & PHASE_MASK)); ++i);
+ for (i = 0; (phases[i].value != PHASE_UNKNOWN) &&
+ (phases[i].value != (status & PHASE_MASK)); ++i);
printk("scsi%d : phase %s\n", instance->host_no, phases[i].name);
}
}
@@ -490,7 +549,7 @@ static void NCR5380_print_phase(struct Scsi_Host *instance)
* conditions are possible.
*/
-static unsigned long main_running = 0;
+static volatile int main_running = 0;
/*
* Function : run_main(void)
@@ -504,10 +563,14 @@ static unsigned long main_running = 0;
static __inline__ void run_main(void)
{
- if (!test_and_set_bit(0, &main_running))
+ if (!main_running) {
+ main_running = 1;
NCR5380_main();
+ }
}
+#ifdef USLEEP
+
/*
* These need tweaking, and would probably work best as per-device
* flags initialized differently for disk, tape, cd, etc devices.
@@ -558,67 +621,63 @@ static struct Scsi_Host *expires_first = NULL;
static int should_disconnect(unsigned char cmd)
{
switch (cmd) {
- case READ_6:
- case WRITE_6:
- case SEEK_6:
- case READ_10:
- case WRITE_10:
- case SEEK_10:
- return DISCONNECT_TIME_TO_DATA;
- case FORMAT_UNIT:
- case SEARCH_HIGH:
- case SEARCH_LOW:
- case SEARCH_EQUAL:
- return DISCONNECT_LONG;
- default:
- return DISCONNECT_NONE;
+ case READ_6:
+ case WRITE_6:
+ case SEEK_6:
+ case READ_10:
+ case WRITE_10:
+ case SEEK_10:
+ return DISCONNECT_TIME_TO_DATA;
+ case FORMAT_UNIT:
+ case SEARCH_HIGH:
+ case SEARCH_LOW:
+ case SEARCH_EQUAL:
+ return DISCONNECT_LONG;
+ default:
+ return DISCONNECT_NONE;
}
}
/*
* Assumes instance->time_expires has been set in higher level code.
- *
- * Locks: Caller must hold io_request_lock
*/
static int NCR5380_set_timer(struct Scsi_Host *instance)
{
+ unsigned long flags;
struct Scsi_Host *tmp, **prev;
+ save_flags(flags);
+ cli();
if (((struct NCR5380_hostdata *) (instance->hostdata))->next_timer) {
+ restore_flags(flags);
return -1;
}
- for (prev = &expires_first, tmp = expires_first; tmp; prev = &(((struct NCR5380_hostdata *) tmp->hostdata)->next_timer), tmp = ((struct NCR5380_hostdata *) tmp->hostdata)->next_timer)
- if (((struct NCR5380_hostdata *) instance->hostdata)->time_expires < ((struct NCR5380_hostdata *) tmp->hostdata)->time_expires)
+ for (prev = &expires_first, tmp = expires_first; tmp;
+ prev = &(((struct NCR5380_hostdata *) tmp->hostdata)->next_timer),
+ tmp = ((struct NCR5380_hostdata *) tmp->hostdata)->next_timer)
+ if (((struct NCR5380_hostdata *)instance->hostdata)->time_expires <
+ ((struct NCR5380_hostdata *)tmp->hostdata)->time_expires)
break;
((struct NCR5380_hostdata *) instance->hostdata)->next_timer = tmp;
*prev = instance;
-
+
mod_timer(&usleep_timer, ((struct NCR5380_hostdata *) expires_first->hostdata)->time_expires);
+ restore_flags(flags);
return 0;
}
-/**
- * NCR5380_timer_fn - handle polled timeouts
- * @unused: unused
- *
- * Walk the list of controllers, find which controllers have exceeded
- * their expiry timeout and then schedule the processing co-routine to
- * do the real work.
- *
- * Doing something about unwanted reentrancy here might be useful
- *
- * Locks: disables irqs, takes and frees io_request_lock
- */
-
-void NCR5380_timer_fn(unsigned long unused)
+/* Doing something about unwanted reentrancy here might be useful */
+void NCR5380_timer_fn(unsigned long surplus_to_requirements)
{
+ unsigned long flags;
struct Scsi_Host *instance;
-
- spin_lock_irq(&io_request_lock);
-
- for (; expires_first && time_before_eq(((struct NCR5380_hostdata *) expires_first->hostdata)->time_expires, jiffies);) {
+ save_flags(flags);
+ cli();
+ for (; expires_first &&
+ time_before_eq(((struct NCR5380_hostdata *)expires_first->hostdata)->time_expires, jiffies); )
+ {
instance = ((struct NCR5380_hostdata *) expires_first->hostdata)->next_timer;
((struct NCR5380_hostdata *) expires_first->hostdata)->next_timer = NULL;
((struct NCR5380_hostdata *) expires_first->hostdata)->time_expires = 0;
@@ -626,91 +685,90 @@ void NCR5380_timer_fn(unsigned long unused)
}
del_timer(&usleep_timer);
- if (expires_first) {
- usleep_timer.expires = ((struct NCR5380_hostdata *) expires_first->hostdata)->time_expires;
+ if (expires_first)
+ {
+ usleep_timer.expires = ((struct NCR5380_hostdata *)expires_first->hostdata)->time_expires;
add_timer(&usleep_timer);
}
+ restore_flags(flags);
+
+ spin_lock_irqsave(&io_request_lock, flags);
run_main();
- spin_unlock_irq(&io_request_lock);
+ spin_unlock_irqrestore(&io_request_lock, flags);
}
+#endif /* def USLEEP */
-/**
- * NCR5380_all_init - global setup
- *
- * Set up the global values and timers needed by the NCR5380 driver
- */
-
static inline void NCR5380_all_init(void)
{
static int done = 0;
if (!done) {
- dprintk(NDEBUG_INIT, ("scsi : NCR5380_all_init()\n"));
+#if (NDEBUG & NDEBUG_INIT)
+ printk("scsi : NCR5380_all_init()\n");
+#endif
done = 1;
+#ifdef USLEEP
init_timer(&usleep_timer);
usleep_timer.function = NCR5380_timer_fn;
+#endif
}
}
+#ifdef AUTOPROBE_IRQ
+/*
+ * Function : int NCR5380_probe_irq (struct Scsi_Host *instance, int possible)
+ *
+ * Purpose : autoprobe for the IRQ line used by the NCR5380.
+ *
+ * Inputs : instance - pointer to this instance of the NCR5380 driver,
+ * possible - bitmask of permissible interrupts.
+ *
+ * Returns : number of the IRQ selected, IRQ_NONE if no interrupt fired.
+ *
+ * XXX no effort is made to deal with spurious interrupts.
+ */
+
static int probe_irq __initdata = 0;
-/**
- * probe_intr - helper for IRQ autoprobe
- * @irq: interrupt number
- * @dev_id: unused
- * @regs: unused
- *
- * Set a flag to indicate the IRQ in question was received. This is
- * used by the IRQ probe code.
- */
-
static void __init probe_intr(int irq, void *dev_id, struct pt_regs *regs)
{
probe_irq = irq;
}
-/**
- * NCR5380_probe_irq - find the IRQ of an NCR5380
- * @instance: NCR5380 controller
- * @possible: bitmask of ISA IRQ lines
- *
- * Autoprobe for the IRQ line used by the NCR5380 by triggering an IRQ
- * and then looking to see what interrupt actually turned up.
- *
- * Locks: none, irqs must be enabled on entry
- */
-
static int __init NCR5380_probe_irq(struct Scsi_Host *instance, int possible)
{
NCR5380_local_declare();
- struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
+ struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *)
+ instance->hostdata;
unsigned long timeout;
int trying_irqs, i, mask;
NCR5380_setup(instance);
for (trying_irqs = i = 0, mask = 1; i < 16; ++i, mask <<= 1)
- if ((mask & possible) && (request_irq(i, &probe_intr, SA_INTERRUPT, "NCR-probe", NULL) == 0))
+ if ((mask & possible) && (request_irq(i, &probe_intr, SA_INTERRUPT, "NCR-probe", NULL)
+ == 0))
trying_irqs |= mask;
timeout = jiffies + (250 * HZ / 1000);
probe_irq = IRQ_NONE;
- /*
- * A interrupt is triggered whenever BSY = false, SEL = true
- * and a bit set in the SELECT_ENABLE_REG is asserted on the
- * SCSI bus.
- *
- * Note that the bus is only driven when the phase control signals
- * (I/O, C/D, and MSG) match those in the TCR, so we must reset that
- * to zero.
- */
+/*
+ * A interrupt is triggered whenever BSY = false, SEL = true
+ * and a bit set in the SELECT_ENABLE_REG is asserted on the
+ * SCSI bus.
+ *
+ * Note that the bus is only driven when the phase control signals
+ * (I/O, C/D, and MSG) match those in the TCR, so we must reset that
+ * to zero.
+ */
NCR5380_write(TARGET_COMMAND_REG, 0);
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask);
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_SEL);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA |
+ ICR_ASSERT_SEL);
- while (probe_irq == IRQ_NONE && time_before(jiffies, timeout))
+ while (probe_irq == IRQ_NONE && time_before(jiffies,timeout))
barrier();
NCR5380_write(SELECT_ENABLE_REG, 0);
@@ -722,16 +780,15 @@ static int __init NCR5380_probe_irq(struct Scsi_Host *instance, int possible)
return probe_irq;
}
+#endif /* AUTOPROBE_IRQ */
-/**
- * NCR58380_print_options - show options
- * @instance: unused for now
+/*
+ * Function : void NCR58380_print_options (struct Scsi_Host *instance)
*
- * Called by probe code indicating the NCR5380 driver options that
- * were selected. At some point this will switch to runtime options
- * read from the adapter in question
+ * Purpose : called by probe code indicating the NCR5380 driver
+ * options that were selected.
*
- * Locks: none
+ * Inputs : instance, pointer to this instance. Unused.
*/
static void __init NCR5380_print_options(struct Scsi_Host *instance)
@@ -758,25 +815,29 @@ static void __init NCR5380_print_options(struct Scsi_Host *instance)
#ifdef PSEUDO_DMA
" PSEUDO DMA"
#endif
+#ifdef SCSI2
+ " SCSI-2"
+#endif
#ifdef UNSAFE
" UNSAFE "
#endif
);
+#ifdef USLEEP
printk(" USLEEP, USLEEP_POLL=%d USLEEP_SLEEP=%d", USLEEP_POLL, USLEEP_SLEEP);
+#endif
printk(" generic release=%d", NCR5380_PUBLIC_RELEASE);
if (((struct NCR5380_hostdata *) instance->hostdata)->flags & FLAG_NCR53C400) {
printk(" ncr53c400 release=%d", NCR53C400_PUBLIC_RELEASE);
}
}
-/**
- * NCR5380_print_status - dump controller info
- * @instance: controller to dump
+/*
+ * Function : void NCR5380_print_status (struct Scsi_Host *instance)
*
- * Print commands in the various queues, called from NCR5380_abort
- * and NCR5380_debug to aid debugging.
+ * Purpose : print commands in the various queues, called from
+ * NCR5380_abort and NCR5380_debug to aid debugging.
*
- * Locks: called functions disable irqs, missing queue lock in proc call
+ * Inputs : instance, pointer to this instance.
*/
static void NCR5380_print_status(struct Scsi_Host *instance)
@@ -785,12 +846,16 @@ static void NCR5380_print_status(struct Scsi_Host *instance)
char *start;
int len;
- printk("NCR5380 : coroutine is%s running.\n", main_running ? "" : "n't");
+ printk("NCR5380 : coroutine is%s running.\n",
+ main_running ? "" : "n't");
- NCR5380_dprint(NDEBUG_ANY, instance);
- NCR5380_dprint_phase(NDEBUG_ANY, instance);
+#ifdef NDEBUG
+ NCR5380_print(instance);
+ NCR5380_print_phase(instance);
+#endif
- len = NCR5380_proc_info(pr_bfr, &start, 0, sizeof(pr_bfr), instance->host_no, 0);
+ len = NCR5380_proc_info(pr_bfr, &start, 0, sizeof(pr_bfr),
+ instance->host_no, 0);
pr_bfr[len] = 0;
printk("\n%s\n", pr_bfr);
}
@@ -821,14 +886,18 @@ char *lprint_opcode(int opcode, char *pos, char *buffer, int length);
#ifndef NCR5380_proc_info
static
#endif
-int NCR5380_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout)
+int NCR5380_proc_info(
+ char *buffer, char **start, off_t offset,
+ int length, int hostno, int inout)
{
+ unsigned long flags;
char *pos = buffer;
struct Scsi_Host *instance;
struct NCR5380_hostdata *hostdata;
Scsi_Cmnd *ptr;
- for (instance = first_instance; instance && instance->host_no != hostno; instance = instance->next);
+ for (instance = first_instance; instance &&
+ instance->host_no != hostno; instance = instance->next);
if (!instance)
return (-ESRCH);
hostdata = (struct NCR5380_hostdata *) instance->hostdata;
@@ -866,27 +935,32 @@ int NCR5380_proc_info(char *buffer, char **start, off_t offset, int length, int
SPRINTF("IRQ: %d.\n", instance->irq);
#ifdef DTC_PUBLIC_RELEASE
- SPRINTF("Highwater I/O busy_spin_counts -- write: %d read: %d\n", dtc_wmaxi, dtc_maxi);
+ SPRINTF("Highwater I/O busy_spin_counts -- write: %d read: %d\n",
+ dtc_wmaxi, dtc_maxi);
#endif
#ifdef PAS16_PUBLIC_RELEASE
- SPRINTF("Highwater I/O busy_spin_counts -- write: %d read: %d\n", pas_wmaxi, pas_maxi);
+ SPRINTF("Highwater I/O busy_spin_counts -- write: %d read: %d\n",
+ pas_wmaxi, pas_maxi);
#endif
- spin_lock_irq(&io_request_lock);
+ save_flags(flags);
+ cli();
SPRINTF("NCR5380 : coroutine is%s running.\n", main_running ? "" : "n't");
if (!hostdata->connected)
SPRINTF("scsi%d: no currently connected command\n", instance->host_no);
else
- pos = lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, pos, buffer, length);
+ pos = lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected,
+ pos, buffer, length);
SPRINTF("scsi%d: issue_queue\n", instance->host_no);
- for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
+ for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr;
+ ptr = (Scsi_Cmnd *) ptr->host_scribble)
pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length);
SPRINTF("scsi%d: disconnected_queue\n", instance->host_no);
- for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
+ for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr;
+ ptr = (Scsi_Cmnd *) ptr->host_scribble)
pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length);
- spin_unlock_irq(&io_request_lock);
-
+ restore_flags(flags);
*start = buffer;
if (pos - buffer < offset)
return 0;
@@ -898,14 +972,16 @@ int NCR5380_proc_info(char *buffer, char **start, off_t offset, int length, int
static
char *lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, char *pos, char *buffer, int length)
{
- SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->host->host_no, cmd->target, cmd->lun);
+ SPRINTF("scsi%d : destination target %d, lun %d\n",
+ cmd->host->host_no, cmd->target, cmd->lun);
SPRINTF(" command = ");
pos = lprint_command(cmd->cmnd, pos, buffer, length);
return (pos);
}
static
-char *lprint_command(unsigned char *command, char *pos, char *buffer, int length)
+char *lprint_command(unsigned char *command,
+ char *pos, char *buffer, int length)
{
int i, s;
pos = lprint_opcode(command[0], pos, buffer, length);
@@ -923,18 +999,17 @@ char *lprint_opcode(int opcode, char *pos, char *buffer, int length)
}
-/**
- * NCR5380_init - initialise an NCR5380
- * @instance: adapter to configure
- * @flags: control flags
+/*
+ * Function : void NCR5380_init (struct Scsi_Host *instance, flags)
*
- * Initializes *instance and corresponding 5380 chip,
+ * Purpose : initializes *instance and corresponding 5380 chip,
* with flags OR'd into the initial flags value.
*
- * Notes : I assume that the host, hostno, and id bits have been
- * set correctly. I don't care about the irq and other fields.
+ * Inputs : instance - instantiation of the 5380 driver.
*
- * Locks: interrupts must be enabled when we are called
+ * Notes : I assume that the host, hostno, and id bits have been
+ * set correctly. I don't care about the irq and other fields.
+ *
*/
static void __init NCR5380_init(struct Scsi_Host *instance, int flags)
@@ -942,10 +1017,9 @@ static void __init NCR5380_init(struct Scsi_Host *instance, int flags)
NCR5380_local_declare();
int i, pass;
unsigned long timeout;
- struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
+ struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *)
+ instance->hostdata;
- if(in_interrupt())
- printk(KERN_ERR "NCR5380_init called with interrupts off!\n");
/*
* On NCR53C400 boards, NCR5380 registers are mapped 8 past
* the base address.
@@ -957,6 +1031,7 @@ static void __init NCR5380_init(struct Scsi_Host *instance, int flags)
#endif
NCR5380_setup(instance);
+
NCR5380_all_init();
hostdata->aborted = 0;
@@ -995,13 +1070,17 @@ static void __init NCR5380_init(struct Scsi_Host *instance, int flags)
the_template = instance->hostt;
first_instance = instance;
}
+#ifdef USLEEP
hostdata->time_expires = 0;
hostdata->next_timer = NULL;
+#endif
#ifndef AUTOSENSE
if ((instance->cmd_per_lun > 1) || instance->can_queue > 1)
- printk(KERN_WARNING "scsi%d : WARNING : support for multiple outstanding commands enabled\n" " without AUTOSENSE option, contingent allegiance conditions may\n"
- " be incorrectly cleared.\n", instance->host_no);
+ )
+ printk("scsi%d : WARNING : support for multiple outstanding commands enabled\n"
+ " without AUTOSENSE option, contingent allegiance conditions may\n"
+ " be incorrectly cleared.\n", instance->host_no);
#endif /* def AUTOSENSE */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
@@ -1027,40 +1106,50 @@ static void __init NCR5380_init(struct Scsi_Host *instance, int flags)
* failing, do a hard reset of the SCSI bus
*/
- for (pass = 1; (NCR5380_read(STATUS_REG) & SR_BSY) && pass <= 6; ++pass) {
+ for (pass = 1; (NCR5380_read(STATUS_REG) & SR_BSY) &&
+ pass <= 6; ++pass) {
switch (pass) {
case 1:
case 3:
case 5:
- printk("scsi%d: SCSI bus busy, waiting up to five seconds\n", instance->host_no);
+ printk("scsi%d: SCSI bus busy, waiting up to five seconds\n",
+ instance->host_no);
timeout = jiffies + 5 * HZ;
- while (time_before(jiffies, timeout) && (NCR5380_read(STATUS_REG) & SR_BSY));
+ while (time_before(jiffies,timeout) && (NCR5380_read(STATUS_REG) & SR_BSY));
break;
case 2:
- printk("scsi%d: bus busy, attempting abort\n", instance->host_no);
+ printk("scsi%d: bus busy, attempting abort\n",
+ instance->host_no);
do_abort(instance);
break;
case 4:
- printk("scsi%d: bus busy, attempting reset\n", instance->host_no);
+ printk("scsi%d: bus busy, attempting reset\n",
+ instance->host_no);
do_reset(instance);
break;
case 6:
- printk("scsi%d: bus locked solid or invalid override\n", instance->host_no);
+ printk("scsi%d: bus locked solid or invalid override\n",
+ instance->host_no);
}
}
}
-/**
- * NCR5380_queue_command - queue a command
- * @cmd: SCSI command
- * @done: completion handler
+/*
+ * Function : int NCR5380_queue_command (Scsi_Cmnd *cmd,
+ * void (*done)(Scsi_Cmnd *))
+ *
+ * Purpose : enqueues a SCSI command
*
+ * Inputs : cmd - SCSI command, done - function called on completion, with
+ * a pointer to the command descriptor.
+ *
+ * Returns : 0
+ *
+ * Side effects :
* cmd is added to the per instance issue_queue, with minor
* twiddling done to the host specific fields of cmd. If the
* main coroutine is not running, it is restarted.
*
- * Locks: io_request lock held by caller. Called functions drop and
- * retake this lock. Called functions take dma lock.
*/
/* Only make static if a wrapper function is used */
@@ -1069,14 +1158,16 @@ static
#endif
int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) {
struct Scsi_Host *instance = cmd->host;
- struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
+ struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *)
+ instance->hostdata;
Scsi_Cmnd *tmp;
#if (NDEBUG & NDEBUG_NO_WRITE)
switch (cmd->cmnd[0]) {
- case WRITE_6:
- case WRITE_10:
- printk("scsi%d : WRITE attempted with NO_WRITE debugging flag set\n", instance->host_no);
+ case WRITE_6:
+ case WRITE_10:
+ printk("scsi%d : WRITE attempted with NO_WRITE debugging flag set\n",
+ instance->host_no);
cmd->result = (DID_ERROR << 16);
done(cmd);
return 0;
@@ -1084,22 +1175,31 @@ int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) {
#endif /* (NDEBUG & NDEBUG_NO_WRITE) */
#ifdef NCR5380_STATS
- switch (cmd->cmnd[0]) {
- case WRITE:
- case WRITE_6:
- case WRITE_10:
- hostdata->time_write[cmd->target] -= (jiffies - hostdata->timebase);
+#if 0
+ if (!hostdata->connected && !hostdata->issue_queue &&
+ !hostdata->disconnected_queue) {
+ hostdata->timebase = jiffies;
+ }
+#endif
+#ifdef NCR5380_STAT_LIMIT
+ if (cmd->request_bufflen > NCR5380_STAT_LIMIT)
+#endif
+ switch (cmd->cmnd[0]) {
+ case WRITE:
+ case WRITE_6:
+ case WRITE_10:
+ hostdata->time_write[cmd->target] -= (jiffies - hostdata->timebase);
hostdata->bytes_write[cmd->target] += cmd->request_bufflen;
hostdata->pendingw++;
break;
- case READ:
- case READ_6:
- case READ_10:
- hostdata->time_read[cmd->target] -= (jiffies - hostdata->timebase);
+ case READ:
+ case READ_6:
+ case READ_10:
+ hostdata->time_read[cmd->target] -= (jiffies - hostdata->timebase);
hostdata->bytes_read[cmd->target] += cmd->request_bufflen;
hostdata->pendingr++;
break;
- }
+ }
#endif
/*
@@ -1109,8 +1209,10 @@ int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) {
cmd->host_scribble = NULL;
cmd->scsi_done = done;
+
cmd->result = 0;
+
/*
* Insert the cmd into the issue queue. Note that REQUEST SENSE
* commands are added to the head of the queue since any command will
@@ -1123,28 +1225,31 @@ int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) {
cmd->host_scribble = (unsigned char *) hostdata->issue_queue;
hostdata->issue_queue = cmd;
} else {
- for (tmp = (Scsi_Cmnd *) hostdata->issue_queue; tmp->host_scribble; tmp = (Scsi_Cmnd *) tmp->host_scribble);
+ for (tmp = (Scsi_Cmnd *) hostdata->issue_queue; tmp->host_scribble;
+ tmp = (Scsi_Cmnd *) tmp->host_scribble);
LIST(cmd, tmp);
tmp->host_scribble = (unsigned char *) cmd;
}
- dprintk(NDEBUG_QUEUES, ("scsi%d : command added to %s of queue\n", instance->host_no, (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail"));
+#if (NDEBUG & NDEBUG_QUEUES)
+ printk("scsi%d : command added to %s of queue\n", instance->host_no,
+ (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail");
+#endif
- /* Run the coroutine if it isn't already running. */
+/* Run the coroutine if it isn't already running. */
run_main();
return 0;
}
-/**
- * NCR5380_main - NCR state machines
+/*
+ * Function : NCR5380_main (void)
*
- * NCR5380_main is a coroutine that runs as long as more work can
+ * Purpose : NCR5380_main is a coroutine that runs as long as more work can
* be done on the NCR5380 host adapters in a system. Both
* NCR5380_queue_command() and NCR5380_intr() will try to start it
* in case it is not running.
*
- * Locks; The caller must hold the io_request_lock. The lock will still be
- * held on return but may be dropped while running. Called functions take
- * the DMA lock.
+ * NOTE : NCR5380_main exits with interrupts *disabled*, the caller should
+ * reenable them. This prevents reentrancy and kernel stack overflow.
*/
static void NCR5380_main(void) {
@@ -1152,6 +1257,7 @@ static void NCR5380_main(void) {
struct Scsi_Host *instance;
struct NCR5380_hostdata *hostdata;
int done;
+ unsigned long flags;
/*
* We run (with interrupts disabled) until we're sure that none of
@@ -1165,22 +1271,43 @@ static void NCR5380_main(void) {
* this should prevent any race conditions.
*/
+ spin_unlock_irq(&io_request_lock);
+
+ save_flags(flags);
+
do {
- /* Lock held here */
+ cli(); /* Freeze request queues */
done = 1;
- for (instance = first_instance; instance && instance->hostt == the_template; instance = instance->next) {
- hostdata = (struct NCR5380_hostdata *) instance->hostdata;
- /* Lock held here */
+ for (instance = first_instance; instance &&
+ instance->hostt == the_template; instance = instance->next) {
+ hostdata = (struct NCR5380_hostdata *) instance->hostdata;
+ cli();
+#ifdef USLEEP
if (!hostdata->connected && !hostdata->selecting) {
- dprintk(NDEBUG_MAIN, ("scsi%d : not connected\n", instance->host_no));
+#else
+ if (!hostdata->connected) {
+#endif
+#if (NDEBUG & NDEBUG_MAIN)
+ printk("scsi%d : not connected\n", instance->host_no);
+#endif
/*
* Search through the issue_queue for a command destined
* for a target that's not busy.
*/
- for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble)
- {
+#if (NDEBUG & NDEBUG_LISTS)
+ for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev = NULL; tmp && (tmp != prev); prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble);
+ /*printk("%p ", tmp); */
+ if ((tmp == prev) && tmp)
+ printk(" LOOP\n"); /* else printk("\n"); */
+#endif
+ for (tmp = (Scsi_Cmnd *) hostdata->issue_queue,
+ prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *)
+ tmp->host_scribble) {
+
+#if (NDEBUG & NDEBUG_LISTS)
if (prev != tmp)
- dprintk(NDEBUG_LISTS, ("MAIN tmp=%p target=%d busy=%d lun=%d\n", tmp, tmp->target, hostdata->busy[tmp->target], tmp->lun));
+ printk("MAIN tmp=%p target=%d busy=%d lun=%d\n", tmp, tmp->target, hostdata->busy[tmp->target], tmp->lun);
+#endif
/* When we find one, remove it from the issue queue. */
if (!(hostdata->busy[tmp->target] & (1 << tmp->lun))) {
if (prev) {
@@ -1192,6 +1319,8 @@ static void NCR5380_main(void) {
}
tmp->host_scribble = NULL;
+ /* reenable interrupts after finding one */
+ restore_flags(flags);
/*
* Attempt to establish an I_T_L nexus here.
@@ -1199,7 +1328,10 @@ static void NCR5380_main(void) {
* On failure, we must add the command back to the
* issue queue so we can keep trying.
*/
- dprintk(NDEBUG_MAIN|NDEBUG_QUEUES, ("scsi%d : main() : command for target %d lun %d removed from issue_queue\n", instance->host_no, tmp->target, tmp->lun));
+#if (NDEBUG & (NDEBUG_MAIN | NDEBUG_QUEUES))
+ printk("scsi%d : main() : command for target %d lun %d removed from issue_queue\n",
+ instance->host_no, tmp->target, tmp->lun);
+#endif
/*
* A successful selection is defined as one that
@@ -1211,81 +1343,105 @@ static void NCR5380_main(void) {
* and see if we can do an information transfer,
* with failures we will restart.
*/
- hostdata->selecting = 0;
- /* RvC: have to preset this to indicate a new command is being performed */
+#ifdef USLEEP
+ hostdata->selecting = 0; /* RvC: have to preset this
+ to indicate a new command is being performed */
+#endif
if (!NCR5380_select(instance, tmp,
- /*
- * REQUEST SENSE commands are issued without tagged
- * queueing, even on SCSI-II devices because the
- * contingent allegiance condition exists for the
- * entire unit.
- */
- (tmp->cmnd[0] == REQUEST_SENSE) ? TAG_NONE : TAG_NEXT)) {
+ /*
+ * REQUEST SENSE commands are issued without tagged
+ * queueing, even on SCSI-II devices because the
+ * contingent allegiance condition exists for the
+ * entire unit.
+ */
+ (tmp->cmnd[0] == REQUEST_SENSE) ? TAG_NONE :
+ TAG_NEXT)) {
break;
} else {
+ cli();
LIST(tmp, hostdata->issue_queue);
- tmp->host_scribble = (unsigned char *) hostdata->issue_queue;
+ tmp->host_scribble = (unsigned char *)
+ hostdata->issue_queue;
hostdata->issue_queue = tmp;
done = 0;
- dprintk(NDEBUG_MAIN|NDEBUG_QUEUES, ("scsi%d : main(): select() failed, returned to issue_queue\n", instance->host_no));
+ restore_flags(flags);
+#if (NDEBUG & (NDEBUG_MAIN | NDEBUG_QUEUES))
+ printk("scsi%d : main(): select() failed, returned to issue_queue\n",
+ instance->host_no);
+#endif
}
- /* lock held here still */
} /* if target/lun is not busy */
} /* for */
- /* exited locked */
} /* if (!hostdata->connected) */
- if (hostdata->selecting) {
- tmp = (Scsi_Cmnd *) hostdata->selecting;
- /* Selection will drop and retake the lock */
- if (!NCR5380_select(instance, tmp, (tmp->cmnd[0] == REQUEST_SENSE) ? TAG_NONE : TAG_NEXT)) {
+#ifdef USLEEP
+ if (hostdata->selecting)
+ {
+ tmp = (Scsi_Cmnd *)hostdata->selecting;
+ if (!NCR5380_select(instance, tmp,
+ (tmp->cmnd[0] == REQUEST_SENSE) ? TAG_NONE : TAG_NEXT))
+ {
/* Ok ?? */
- } else {
+ }
+ else
+ {
/* RvC: device failed, so we wait a long time
- this is needed for Mustek scanners, that
- do not respond to commands immediately
- after a scan */
- printk(KERN_DEBUG "scsi%d: device %d did not respond in time\n", instance->host_no, tmp->target);
- //spin_lock_irq(&io_request_lock);
+ this is needed for Mustek scanners, that
+ do not respond to commands immediately
+ after a scan */
+ printk(KERN_DEBUG "scsi%d: device %d did not respond in time\n",
+ instance->host_no, tmp->target);
+ cli();
LIST(tmp, hostdata->issue_queue);
tmp->host_scribble = (unsigned char *) hostdata->issue_queue;
hostdata->issue_queue = tmp;
- //spin_unlock_irq(&io_request_lock);
+ restore_flags(flags);
hostdata->time_expires = jiffies + USLEEP_WAITLONG;
- NCR5380_set_timer(instance);
+ NCR5380_set_timer (instance);
}
- } /* if hostdata->selecting */
+ } /* if hostdata->selecting */
+#endif
if (hostdata->connected
#ifdef REAL_DMA
&& !hostdata->dmalen
#endif
+#ifdef USLEEP
&& (!hostdata->time_expires || time_before_eq(hostdata->time_expires, jiffies))
+#endif
) {
- dprintk(NDEBUG_MAIN, ("scsi%d : main() : performing information transfer\n", instance->host_no));
+ restore_flags(flags);
+#if (NDEBUG & NDEBUG_MAIN)
+ printk("scsi%d : main() : performing information transfer\n",
+ instance->host_no);
+#endif
NCR5380_information_transfer(instance);
- dprintk(NDEBUG_MAIN, ("scsi%d : main() : done set false\n", instance->host_no));
+#if (NDEBUG & NDEBUG_MAIN)
+ printk("scsi%d : main() : done set false\n", instance->host_no);
+#endif
done = 0;
} else
break;
} /* for instance */
} while (!done);
- /* Exit lock held */
- clear_bit(0, &main_running);
+ spin_lock_irq(&io_request_lock);
+ /* cli();*/
+ main_running = 0;
}
#ifndef DONT_USE_INTR
#include <linux/blk.h>
#include <linux/spinlock.h>
-/**
- * NCR5380_intr - generic NCR5380 irq handler
- *
- * Handle interrupts, reestablishing I_T_L or I_T_L_Q nexuses
+/*
+ * Function : void NCR5380_intr (int irq)
+ *
+ * Purpose : handle interrupts, reestablishing I_T_L or I_T_L_Q nexuses
* from the disconnected queue, and restarting NCR5380_main()
* as required.
*
- * Locks: caller must hold the io_request lock.
+ * Inputs : int irq, irq that caused this interrupt.
+ *
*/
static void NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs) {
@@ -1293,12 +1449,17 @@ static void NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs) {
struct Scsi_Host *instance;
int done;
unsigned char basr;
+ unsigned long flags;
- dprintk(NDEBUG_INTR, ("scsi : NCR5380 irq %d triggered\n", irq));
-
+ save_flags(flags);
+ cli();
+#if (NDEBUG & NDEBUG_INTR)
+ printk("scsi : NCR5380 irq %d triggered\n", irq);
+#endif
do {
done = 1;
- for (instance = first_instance; instance && (instance->hostt == the_template); instance = instance->next)
+ for (instance = first_instance; instance && (instance->hostt ==
+ the_template); instance = instance->next)
if (instance->irq == irq) {
/* Look for pending interrupts */
@@ -1306,19 +1467,34 @@ static void NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs) {
basr = NCR5380_read(BUS_AND_STATUS_REG);
/* XXX dispatch to appropriate routine if found and done=0 */
if (basr & BASR_IRQ) {
- NCR5380_dprint(NDEBUG_INTR, instance);
- if ((NCR5380_read(STATUS_REG) & (SR_SEL | SR_IO)) == (SR_SEL | SR_IO)) {
+#if (NDEBUG & NDEBUG_INTR)
+ NCR5380_print(instance);
+#endif
+ if ((NCR5380_read(STATUS_REG) & (SR_SEL | SR_IO)) ==
+ (SR_SEL | SR_IO)) {
done = 0;
- dprintk(NDEBUG_INTR, ("scsi%d : SEL interrupt\n", instance->host_no));
+ restore_flags(flags);
+#if (NDEBUG & NDEBUG_INTR)
+ printk("scsi%d : SEL interrupt\n", instance->host_no);
+#endif
NCR5380_reselect(instance);
(void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);
} else if (basr & BASR_PARITY_ERROR) {
- dprintk(NDEBUG_INTR, ("scsi%d : PARITY interrupt\n", instance->host_no));
+#if (NDEBUG & NDEBUG_INTR)
+ printk("scsi%d : PARITY interrupt\n", instance->host_no);
+#endif
(void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);
} else if ((NCR5380_read(STATUS_REG) & SR_RST) == SR_RST) {
- dprintk(NDEBUG_INTR, ("scsi%d : RESET interrupt\n", instance->host_no));
+#if (NDEBUG & NDEBUG_INTR)
+ printk("scsi%d : RESET interrupt\n", instance->host_no);
+#endif
(void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);
} else {
+/*
+ * XXX the rest of the interrupt conditions should *only* occur during a
+ * DMA transfer, which I haven't gotten around to fixing yet.
+ */
+
#if defined(REAL_DMA)
/*
* We should only get PHASE MISMATCH and EOP interrupts
@@ -1326,11 +1502,14 @@ static void NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs) {
* the current setting of the MODE register.
*/
- if ((NCR5380_read(MODE_REG) & MR_DMA) && ((basr & BASR_END_DMA_TRANSFER) || !(basr & BASR_PHASE_MATCH))) {
+ if ((NCR5380_read(MODE_REG) & MR_DMA) && ((basr &
+ BASR_END_DMA_TRANSFER) ||
+ !(basr & BASR_PHASE_MATCH))) {
int transfered;
if (!hostdata->connected)
- panic("scsi%d : received end of DMA interrupt with no connected cmd\n", instance->hostno);
+ panic("scsi%d : received end of DMA interrupt with no connected cmd\n",
+ instance->hostno);
transfered = (hostdata->dmalen - NCR5380_dma_residual(instance));
hostdata->connected->SCp.this_residual -= transferred;
@@ -1343,13 +1522,15 @@ static void NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs) {
unsigned long timeout = jiffies + NCR_TIMEOUT;
spin_unlock_irq(&io_request_lock);
- while (NCR5380_read(BUS_AND_STATUS_REG) & BASR_ACK && time_before(jiffies, timeout));
+ while (NCR5380_read(BUS_AND_STATUS_REG) & BASR_ACK
+ && time_before(jiffies, timeout));
spin_lock_irq(&io_request_lock);
-
- if (time_after_eq(jiffies, timeout))
- printk("scsi%d: timeout at NCR5380.c:%d\n", host->host_no, __LINE__);
+
+ if (time_after_eq(jiffies, timeout) )
+ printk("scsi%d: timeout at NCR5380.c:%d\n",
+ host->host_no, __LINE__);
}
-#else /* NCR_TIMEOUT */
+#else /* NCR_TIMEOUT */
while (NCR5380_read(BUS_AND_STATUS_REG) & BASR_ACK);
#endif
@@ -1357,7 +1538,9 @@ static void NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs) {
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
}
#else
- dprintk(NDEBUG_INTR, ("scsi : unknown interrupt, BASR 0x%X, MR 0x%X, SR 0x%x\n", basr, NCR5380_read(MODE_REG), NCR5380_read(STATUS_REG)));
+#if (NDEBUG & NDEBUG_INTR)
+ printk("scsi : unknown interrupt, BASR 0x%X, MR 0x%X, SR 0x%x\n", basr, NCR5380_read(MODE_REG), NCR5380_read(STATUS_REG));
+#endif
(void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);
#endif
}
@@ -1368,17 +1551,6 @@ static void NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs) {
} while (!done);
}
-/**
- * do_NCR5380_intr
- * @irq: interrupt number
- * @dev_id: device info
- * @regs: registers (unused)
- *
- * Takes the io_request_lock and invokes the generic NCR5380 interrupt
- * handler code
- *
- * Locks: takes and releases the io_request lock
- */
static void do_NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs) {
unsigned long flags;
@@ -1387,38 +1559,32 @@ static void do_NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs) {
NCR5380_intr(irq, dev_id, regs);
spin_unlock_irqrestore(&io_request_lock, flags);
}
-#endif
+#endif
-/**
- * collect_stats - collect stats on a scsi command
- * @hostdata: adapter
- * @cmd: command being issued
- *
- * Update the statistical data by parsing the command in question
- */
-
-static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd)
-{
#ifdef NCR5380_STATS
- switch (cmd->cmnd[0]) {
- case WRITE:
- case WRITE_6:
- case WRITE_10:
- hostdata->time_write[cmd->target] += (jiffies - hostdata->timebase);
- hostdata->pendingw--;
- break;
- case READ:
- case READ_6:
- case READ_10:
- hostdata->time_read[cmd->target] += (jiffies - hostdata->timebase);
- hostdata->pendingr--;
- break;
- }
+static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd) {
+#ifdef NCR5380_STAT_LIMIT
+ if (cmd->request_bufflen > NCR5380_STAT_LIMIT)
#endif
+ switch (cmd->cmnd[0]) {
+ case WRITE:
+ case WRITE_6:
+ case WRITE_10:
+ hostdata->time_write[cmd->target] += (jiffies - hostdata->timebase);
+ /*hostdata->bytes_write[cmd->target] += cmd->request_bufflen; */
+ hostdata->pendingw--;
+ break;
+ case READ:
+ case READ_6:
+ case READ_10:
+ hostdata->time_read[cmd->target] += (jiffies - hostdata->timebase);
+ /*hostdata->bytes_read[cmd->target] += cmd->request_bufflen; */
+ hostdata->pendingr--;
+ break;
+ }
}
-
-
+#endif
/*
* Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd,
* int tag);
@@ -1448,44 +1614,55 @@ static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd)
*
* If failed (no target) : cmd->scsi_done() will be called, and the
* cmd->result host byte set to DID_BAD_TARGET.
- *
- * Locks: caller holds io_request_lock
*/
-
-static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
-{
+static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag) {
NCR5380_local_declare();
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
unsigned char tmp[3], phase;
unsigned char *data;
int len;
unsigned long timeout;
+ unsigned long flags;
+#ifdef USLEEP
unsigned char value;
+#endif
+
NCR5380_setup(instance);
- if (hostdata->selecting) {
+#ifdef USLEEP
+
+ if (hostdata->selecting)
+ {
goto part2; /* RvC: sorry prof. Dijkstra, but it keeps the
rest of the code nearly the same */
}
+#endif
- hostdata->restart_select = 0;
-
- NCR5380_dprint(NDEBUG_ARBITRATION, instance);
- dprintk(NDEBUG_ARBITRATION, ("scsi%d : starting arbitration, id = %d\n", instance->host_no, instance->this_id));
+ hostdata->restart_select = 0;
+#if defined (NDEBUG) && (NDEBUG & NDEBUG_ARBITRATION)
+ NCR5380_print(instance);
+ printk("scsi%d : starting arbitration, id = %d\n", instance->host_no,
+ instance->this_id);
+#endif
+ save_flags(flags);
+ cli();
/*
* Set the phase bits to 0, otherwise the NCR5380 won't drive the
* data bus during SELECTION.
*/
- NCR5380_write(TARGET_COMMAND_REG, 0);
+ NCR5380_write(TARGET_COMMAND_REG, 0);
+
/*
* Start arbitration.
*/
- NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask);
- NCR5380_write(MODE_REG, MR_ARBITRATE);
+ NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask);
+ NCR5380_write(MODE_REG, MR_ARBITRATE);
+
+ restore_flags(flags);
/* Wait for arbitration logic to complete */
#if NCR_TIMEOUT
@@ -1495,11 +1672,11 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
spin_unlock_irq(&io_request_lock);
while (!(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_PROGRESS)
- && time_before(jiffies, timeout));
+ && time_before(jiffies,timeout));
spin_lock_irq(&io_request_lock);
-
- if (time_after_eq(jiffies, timeout)) {
+
+ if (time_after_eq(jiffies,timeout)) {
printk("scsi: arbitration timeout at %d\n", __LINE__);
NCR5380_write(MODE_REG, MR_BASE);
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
@@ -1510,7 +1687,11 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
while (!(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_PROGRESS));
#endif
- dprintk(NDEBUG_ARBITRATION, ("scsi%d : arbitration complete\n", instance->host_no));
+#if (NDEBUG & NDEBUG_ARBITRATION)
+ printk("scsi%d : arbitration complete\n", instance->host_no);
+/* Avoid GCC 2.4.5 asm needs to many reloads error */
+ __asm__("nop");
+#endif
/*
* The arbitration delay is 2.2us, but this is a minimum and there is
@@ -1519,25 +1700,34 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
*
*/
- udelay(3);
+ udelay(3);
/* Check for lost arbitration */
- if ((NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) || (NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_higher_mask) || (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST)) {
+ if ((NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) ||
+ (NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_higher_mask) ||
+ (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST)) {
NCR5380_write(MODE_REG, MR_BASE);
- dprintk(NDEBUG_ARBITRATION, ("scsi%d : lost arbitration, deasserting MR_ARBITRATE\n", instance->host_no));
+#if (NDEBUG & NDEBUG_ARBITRATION)
+ printk("scsi%d : lost arbitration, deasserting MR_ARBITRATE\n",
+ instance->host_no);
+#endif
return -1;
}
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_SEL);
if (!(hostdata->flags & FLAG_DTC3181E) &&
- /* RvC: DTC3181E has some trouble with this
- * so we simply removed it. Seems to work with
- * only Mustek scanner attached
- */
- (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST)) {
+ /* RvC: DTC3181E has some trouble with this
+ * so we simply removed it. Seems to work with
+ * only Mustek scanner attached
+ */
+ (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST))
+ {
NCR5380_write(MODE_REG, MR_BASE);
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
- dprintk(NDEBUG_ARBITRATION, ("scsi%d : lost arbitration, deasserting ICR_ASSERT_SEL\n", instance->host_no));
+#if (NDEBUG & NDEBUG_ARBITRATION)
+ printk("scsi%d : lost arbitration, deasserting ICR_ASSERT_SEL\n",
+ instance->host_no);
+#endif
return -1;
}
/*
@@ -1547,7 +1737,10 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
udelay(2);
- dprintk(NDEBUG_ARBITRATION, ("scsi%d : won arbitration\n", instance->host_no));
+#if (NDEBUG & NDEBUG_ARBITRATION)
+ printk("scsi%d : won arbitration\n", instance->host_no);
+#endif
+
/*
* Now that we have won arbitration, start Selection process, asserting
@@ -1562,7 +1755,8 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
* phase immediately after selection.
*/
- NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_BSY | ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_SEL));
+ NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_BSY |
+ ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_SEL));
NCR5380_write(MODE_REG, MR_BASE);
/*
@@ -1578,7 +1772,8 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
udelay(1); /* wingel -- wait two bus deskew delay >2*45ns */
/* Reset BSY */
- NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_SEL));
+ NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_DATA |
+ ICR_ASSERT_ATN | ICR_ASSERT_SEL));
/*
* Something weird happens when we cease to drive BSY - looks
@@ -1599,7 +1794,9 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
udelay(1);
- dprintk(NDEBUG_SELECTION, ("scsi%d : selecting target %d\n", instance->host_no, cmd->target));
+#if (NDEBUG & NDEBUG_SELECTION)
+ printk("scsi%d : selecting target %d\n", instance->host_no, cmd->target);
+#endif
/*
* The SCSI specification calls for a 250 ms timeout for the actual
@@ -1614,30 +1811,40 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
* and it's detecting as true. Sigh.
*/
- hostdata->select_time = 0; /* we count the clock ticks at which we polled */
+#ifdef USLEEP
+ hostdata->select_time = 0; /* we count the clock ticks at which we polled */
hostdata->selecting = cmd;
part2:
- /* RvC: here we enter after a sleeping period, or immediately after
- execution of part 1
- we poll only once ech clock tick */
+ /* RvC: here we enter after a sleeping period, or immediately after
+ execution of part 1
+ we poll only once ech clock tick */
value = NCR5380_read(STATUS_REG) & (SR_BSY | SR_IO);
- if (!value && (hostdata->select_time < 25)) {
+ if (!value && (hostdata->select_time < 25))
+ {
/* RvC: we still must wait for a device response */
- hostdata->select_time++; /* after 25 ticks the device has failed */
+ hostdata->select_time++; /* after 25 ticks the device has failed */
hostdata->time_expires = jiffies + 1;
NCR5380_set_timer(instance);
return 0; /* RvC: we return here with hostdata->selecting set,
to go to sleep */
}
- hostdata->selecting = 0; /* clear this pointer, because we passed the
- waiting period */
- if ((NCR5380_read(STATUS_REG) & (SR_SEL | SR_IO)) == (SR_SEL | SR_IO)) {
+ hostdata->selecting = 0; /* clear this pointer, because we passed the
+ waiting period */
+#else
+ spin_unlock_irq(&io_request_lock);
+ while (time_before(jiffies, timeout) && !(NCR5380_read(STATUS_REG) &
+ (SR_BSY | SR_IO)));
+ spin_lock_irq(&io_request_lock);
+#endif
+ if ((NCR5380_read(STATUS_REG) & (SR_SEL | SR_IO)) ==
+ (SR_SEL | SR_IO)) {
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
NCR5380_reselect(instance);
- printk("scsi%d : reselection after won arbitration?\n", instance->host_no);
+ printk("scsi%d : reselection after won arbitration?\n",
+ instance->host_no);
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
return -1;
}
@@ -1657,15 +1864,22 @@ part2:
printk("scsi%d : weirdness\n", instance->host_no);
if (hostdata->restart_select)
printk("\trestart select\n");
- NCR5380_dprint(NDEBUG_SELECTION, instance);
+#if (NDEBUG & NDEBUG_SELECTION)
+ NCR5380_print(instance);
+#endif
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
return -1;
}
cmd->result = DID_BAD_TARGET << 16;
+#ifdef NCR5380_STATS
collect_stats(hostdata, cmd);
+#endif
cmd->scsi_done(cmd);
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
- dprintk(NDEBUG_SELECTION, ("scsi%d : target did not respond within 250ms\n", instance->host_no));
+#if (NDEBUG & NDEBUG_SELECTION)
+ printk("scsi%d : target did not respond within 250ms\n",
+ instance->host_no);
+#endif
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
return 0;
}
@@ -1694,7 +1908,7 @@ part2:
spin_unlock_irq(&io_request_lock);
while (!(NCR5380_read(STATUS_REG) & SR_REQ) && time_before(jiffies, timeout));
spin_lock_irq(&io_request_lock);
-
+
if (time_after_eq(jiffies, timeout)) {
printk("scsi%d: timeout at NCR5380.c:%d\n", instance->host_no, __LINE__);
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
@@ -1705,20 +1919,47 @@ part2:
while (!(NCR5380_read(STATUS_REG) & SR_REQ));
#endif /* def NCR_TIMEOUT */
- dprintk(NDEBUG_SELECTION, ("scsi%d : target %d selected, going into MESSAGE OUT phase.\n", instance->host_no, cmd->target));
+#if (NDEBUG & NDEBUG_SELECTION)
+ printk("scsi%d : target %d selected, going into MESSAGE OUT phase.\n",
+ instance->host_no, cmd->target);
+#endif
tmp[0] = IDENTIFY(((instance->irq == IRQ_NONE) ? 0 : 1), cmd->lun);
-
- len = 1;
- cmd->tag = 0;
+#ifdef SCSI2
+ if (cmd->device->tagged_queue && (tag != TAG_NONE)) {
+ tmp[1] = SIMPLE_QUEUE_TAG;
+ if (tag == TAG_NEXT) {
+ /* 0 is TAG_NONE, used to imply no tag for this command */
+ if (cmd->device->current_tag == 0)
+ cmd->device->current_tag = 1;
+
+ cmd->tag = cmd->device->current_tag;
+ cmd->device->current_tag++;
+ } else
+ cmd->tag = (unsigned char) tag;
+
+ tmp[2] = cmd->tag;
+ hostdata->last_message = SIMPLE_QUEUE_TAG;
+ len = 3;
+ } else
+#endif /* def SCSI2 */
+ {
+ len = 1;
+ cmd->tag = 0;
+ }
/* Send message(s) */
data = tmp;
phase = PHASE_MSGOUT;
NCR5380_transfer_pio(instance, &phase, &len, &data);
- dprintk(NDEBUG_SELECTION, ("scsi%d : nexus established.\n", instance->host_no));
+#if (NDEBUG & NDEBUG_SELECTION)
+ printk("scsi%d : nexus established.\n", instance->host_no);
+#endif
/* XXX need to handle errors here */
hostdata->connected = cmd;
- hostdata->busy[cmd->target] |= (1 << cmd->lun);
+#ifdef SCSI2
+ if (!cmd->device->tagged_queue)
+#endif
+ hostdata->busy[cmd->target] |= (1 << cmd->lun);
initialize_SCp(cmd);
@@ -1751,22 +1992,27 @@ part2:
* counts, we will always do a pseudo DMA or DMA transfer.
*/
-static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data) {
+static int NCR5380_transfer_pio(struct Scsi_Host *instance,
+ unsigned char *phase, int *count, unsigned char **data) {
NCR5380_local_declare();
- unsigned char p = *phase, tmp;
- int c = *count;
- unsigned char *d = *data;
+ register unsigned char p = *phase, tmp;
+ register int c = *count;
+ register unsigned char *d = *data;
+#ifdef USLEEP
/*
- * RvC: some administrative data to process polling time
+ * RvC: some administrative data to process polling time
*/
int break_allowed = 0;
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
+#endif
NCR5380_setup(instance);
+#if (NDEBUG & NDEBUG_PIO)
if (!(p & SR_IO))
- dprintk(NDEBUG_PIO, ("scsi%d : pio write %d bytes\n", instance->host_no, c));
+ printk("scsi%d : pio write %d bytes\n", instance->host_no, c);
else
- dprintk(NDEBUG_PIO, ("scsi%d : pio read %d bytes\n", instance->host_no, c));
+ printk("scsi%d : pio read %d bytes\n", instance->host_no, c);
+#endif
/*
* The NCR5380 chip will only drive the SCSI bus when the
@@ -1776,42 +2022,56 @@ static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase
NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p));
+#ifdef USLEEP
/* RvC: don't know if this is necessary, but other SCSI I/O is short
- * so breaks are not necessary there
+ * so breaks are not necessary there
*/
- if ((p == PHASE_DATAIN) || (p == PHASE_DATAOUT)) {
+ if ((p == PHASE_DATAIN) || (p == PHASE_DATAOUT))
+ {
break_allowed = 1;
}
+#endif
+
+
do {
/*
* Wait for assertion of REQ, after which the phase bits will be
* valid
*/
+#ifdef USLEEP
/* RvC: we simply poll once, after that we stop temporarily
- * and let the device buffer fill up
- * if breaking is not allowed, we keep polling as long as needed
+ * and let the device buffer fill up
+ * if breaking is not allowed, we keep polling as long as needed
*/
- while (!((tmp = NCR5380_read(STATUS_REG)) & SR_REQ) && !break_allowed);
- if (!(tmp & SR_REQ)) {
+ while ( !((tmp = NCR5380_read(STATUS_REG)) & SR_REQ) &&
+ !break_allowed );
+ if (!(tmp & SR_REQ))
+ {
/* timeout condition */
hostdata->time_expires = jiffies + USLEEP_SLEEP;
- NCR5380_set_timer(instance);
+ NCR5380_set_timer (instance);
break;
}
+#else
+ while ( !((tmp = NCR5380_read(STATUS_REG)) & SR_REQ) );
+#endif
- dprintk(NDEBUG_HANDSHAKE, ("scsi%d : REQ detected\n", instance->host_no));
+#if (NDEBUG & NDEBUG_HANDSHAKE)
+ printk("scsi%d : REQ detected\n", instance->host_no);
+#endif
/* Check for phase mismatch */
if ((tmp & PHASE_MASK) != p) {
- dprintk(NDEBUG_HANDSHAKE, ("scsi%d : phase mismatch\n", instance->host_no));
- NCR5380_dprint_phase(NDEBUG_HANDSHAKE, instance);
+#if (NDEBUG & NDEBUG_PIO)
+ printk("scsi%d : phase mismatch\n", instance->host_no);
+ NCR5380_print_phase(instance);
+#endif
break;
}
- /* Do actual transfer from SCSI bus to / from memory */
- if (!(p & SR_IO))
- NCR5380_write(OUTPUT_DATA_REG, *d);
+ /* Do actual transfer from SCSI bus to / from memory */ if (!(p & SR_IO))
+ NCR5380_write(OUTPUT_DATA_REG, *d);
else
*d = NCR5380_read(CURRENT_SCSI_DATA_REG);
@@ -1826,22 +2086,34 @@ static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase
if (!(p & SR_IO)) {
if (!((p & SR_MSG) && c > 1)) {
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA);
- NCR5380_dprint(NDEBUG_PIO, instance);
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_ACK);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
+ ICR_ASSERT_DATA);
+#if (NDEBUG & NDEBUG_PIO)
+ NCR5380_print(instance);
+#endif
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
+ ICR_ASSERT_DATA | ICR_ASSERT_ACK);
} else {
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_ATN);
- NCR5380_dprint(NDEBUG_PIO, instance);
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
+ ICR_ASSERT_DATA | ICR_ASSERT_ATN);
+#if (NDEBUG & NDEBUG_PIO)
+ NCR5380_print(instance);
+#endif
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
+ ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
}
} else {
- NCR5380_dprint(NDEBUG_PIO, instance);
+#if (NDEBUG & NDEBUG_PIO)
+ NCR5380_print(instance);
+#endif
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ACK);
}
while (NCR5380_read(STATUS_REG) & SR_REQ);
- dprintk(NDEBUG_HANDSHAKE, ("scsi%d : req false, handshake complete\n", instance->host_no));
+#if (NDEBUG & NDEBUG_HANDSHAKE)
+ printk("scsi%d : req false, handshake complete\n", instance->host_no);
+#endif
/*
* We have several special cases to consider during REQ/ACK handshaking :
@@ -1862,7 +2134,9 @@ static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase
}
} while (--c);
- dprintk(NDEBUG_PIO, ("scsi%d : residual %d\n", instance->host_no, c));
+#if (NDEBUG & NDEBUG_PIO)
+ printk("scsi%d : residual %d\n", instance->host_no, c);
+#endif
*count = c;
*data = d;
@@ -1878,46 +2152,36 @@ static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase
return -1;
}
-/**
- * do_reset - issue a reset command
- * @host: adapter to reset
- *
- * Issue a reset sequence to the NCR5380 and try and get the bus
- * back into sane shape.
- *
- * Locks: caller holds io_request lock
- */
-
static void do_reset(struct Scsi_Host *host) {
- NCR5380_local_declare();
- NCR5380_setup(host);
-
- NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG) & PHASE_MASK));
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST);
- udelay(25);
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
-}
-
-/*
- * Function : do_abort (Scsi_Host *host)
- *
- * Purpose : abort the currently established nexus. Should only be
- * called from a routine which can drop into a
- *
- * Returns : 0 on success, -1 on failure.
- *
- * Locks: io_request lock held by caller
- */
-
-static int do_abort(struct Scsi_Host *host) {
+ unsigned long flags;
+ NCR5380_local_declare();
+ NCR5380_setup(host);
+
+ save_flags(flags);
+ cli();
+ NCR5380_write(TARGET_COMMAND_REG,
+ PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG) & PHASE_MASK));
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST);
+ udelay(25);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
+ restore_flags(flags);
+} /*
+
+ * Function : do_abort (Scsi_Host *host)
+ *
+ * Purpose : abort the currently established nexus. Should only be
+ * called from a routine which can drop into a
+ *
+ * Returns : 0 on success, -1 on failure.
+ */ static int do_abort(struct Scsi_Host *host) {
NCR5380_local_declare();
unsigned char tmp, *msgptr, phase;
int len;
- NCR5380_setup(host);
+ NCR5380_setup(host);
/* Request message out phase */
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
/*
* Wait for the target to indicate a valid phase by asserting
@@ -1931,10 +2195,11 @@ static int do_abort(struct Scsi_Host *host) {
while (!(tmp = NCR5380_read(STATUS_REG)) & SR_REQ);
- NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp));
+ NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp));
if ((tmp & PHASE_MASK) != PHASE_MSGOUT) {
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN |
+ ICR_ASSERT_ACK);
while (NCR5380_read(STATUS_REG) & SR_REQ);
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
}
@@ -1970,46 +2235,54 @@ static int do_abort(struct Scsi_Host *host) {
*
* Also, *phase, *count, *data are modified in place.
*
- * Locks: io_request lock held by caller
*/
-static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data) {
+static int NCR5380_transfer_dma(struct Scsi_Host *instance,
+ unsigned char *phase, int *count, unsigned char **data) {
NCR5380_local_declare();
register int c = *count;
register unsigned char p = *phase;
register unsigned char *d = *data;
unsigned char tmp;
+#if defined(PSEUDO_DMA) && !defined(UNSAFE)
+ unsigned long flags;
+#endif
int foo;
#if defined(REAL_DMA_POLL)
int cnt, toPIO;
unsigned char saved_data = 0, overrun = 0, residue;
#endif
- struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
+ struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *)
+ instance->hostdata;
- NCR5380_setup(instance);
+ NCR5380_setup(instance);
if ((tmp = (NCR5380_read(STATUS_REG) & PHASE_MASK)) != p) {
*phase = tmp;
return -1;
}
#if defined(REAL_DMA) || defined(REAL_DMA_POLL)
-#ifdef READ_OVERRUNS
- if (p & SR_IO) {
- c -= 2;
- }
+#ifdef READ_OVERRUNS
+ if (p & SR_IO) { c -= 2; }
+#endif
+#if (NDEBUG & NDEBUG_DMA)
+printk("scsi%d : initializing DMA channel %d for %s, %d bytes %s %0x\n",
+ instance->host_no, instance->dma_channel, (p & SR_IO) ? "reading" :
+ "writing", c, (p & SR_IO) ? "to" : "from", (unsigned) d);
#endif
- dprintk(NDEBUG_DMA, ("scsi%d : initializing DMA channel %d for %s, %d bytes %s %0x\n", instance->host_no, instance->dma_channel, (p & SR_IO) ? "reading" : "writing", c, (p & SR_IO) ? "to" : "from", (unsigned) d));
- hostdata->dma_len = (p & SR_IO) ? NCR5380_dma_read_setup(instance, d, c) : NCR5380_dma_write_setup(instance, d, c);
+hostdata->dma_len = (p & SR_IO) ?
+NCR5380_dma_read_setup(instance, d, c) :
+NCR5380_dma_write_setup(instance, d, c);
#endif
- NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p));
+NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(p));
#ifdef REAL_DMA
- NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_ENABLE_EOP_INTR | MR_MONITOR_BSY);
+NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_ENABLE_EOP_INTR | MR_MONITOR_BSY);
#elif defined(REAL_DMA_POLL)
- NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE);
+NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE);
#else
/*
* Note : on my sample board, watch-dog timeouts occurred when interrupts
@@ -2017,38 +2290,58 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase
* before the setting of DMA mode to after transfer of the last byte.
*/
-#if defined(PSEUDO_DMA) && defined(UNSAFE)
- spin_unlock_irq(&io_request_lock);
+#if defined(PSEUDO_DMA) && !defined(UNSAFE)
+save_flags(flags);
+cli();
#endif
/* KLL May need eop and parity in 53c400 */
- if (hostdata->flags & FLAG_NCR53C400)
- NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_ENABLE_PAR_CHECK | MR_ENABLE_PAR_INTR | MR_ENABLE_EOP_INTR | MR_DMA_MODE | MR_MONITOR_BSY);
- else
- NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE);
+if (hostdata->flags & FLAG_NCR53C400)
+ NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_ENABLE_PAR_CHECK
+ | MR_ENABLE_PAR_INTR | MR_ENABLE_EOP_INTR | MR_DMA_MODE
+ | MR_MONITOR_BSY);
+else
+ NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE);
#endif /* def REAL_DMA */
- dprintk(NDEBUG_DMA, ("scsi%d : mode reg = 0x%X\n", instance->host_no, NCR5380_read(MODE_REG)));
+#if (NDEBUG & NDEBUG_DMA) & 0
+printk("scsi%d : mode reg = 0x%X\n", instance->host_no, NCR5380_read(MODE_REG));
+#endif
- /*
- * On the PAS16 at least I/O recovery delays are not needed here.
- * Everyone else seems to want them.
- */
+/*
+ * FOO stuff. For some UNAPPARENT reason, I'm getting
+ * watchdog timers fired on bootup for NO APPARENT REASON, meaning it's
+ * probably a timing problem.
+ *
+ * Since this is the only place I have back-to-back writes, perhaps this
+ * is the problem?
+ */
- if (p & SR_IO) {
- io_recovery_delay(1);
- NCR5380_write(START_DMA_INITIATOR_RECEIVE_REG, 0);
- } else {
- io_recovery_delay(1);
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA);
- io_recovery_delay(1);
- NCR5380_write(START_DMA_SEND_REG, 0);
- io_recovery_delay(1);
- }
+if (p & SR_IO)
+{
+#ifndef FOO
+udelay(1);
+#endif
+NCR5380_write(START_DMA_INITIATOR_RECEIVE_REG, 0);
+} else {
+#ifndef FOO
+ udelay(1);
+#endif
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA);
+#ifndef FOO
+ udelay(1);
+#endif
+ NCR5380_write(START_DMA_SEND_REG, 0);
+#ifndef FOO
+ udelay(1);
+#endif
+}
#if defined(REAL_DMA_POLL)
- do {
- tmp = NCR5380_read(BUS_AND_STATUS_REG);
- } while ((tmp & BASR_PHASE_MATCH) && !(tmp & (BASR_BUSY_ERROR | BASR_END_DMA_TRANSFER)));
+do {
+ tmp = NCR5380_read(BUS_AND_STATUS_REG);
+} while ((tmp & BASR_PHASE_MATCH) && !(tmp & (BASR_BUSY_ERROR |
+
+ BASR_END_DMA_TRANSFER)));
/*
At this point, either we've completed DMA, or we have a phase mismatch,
@@ -2086,128 +2379,172 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase
request.
*/
- if (p & SR_IO) {
+if (p & SR_IO) {
#ifdef READ_OVERRUNS
- udelay(10);
- if (((NCR5380_read(BUS_AND_STATUS_REG) & (BASR_PHASE_MATCH | BASR_ACK)) == (BASR_PHASE_MATCH | BASR_ACK))) {
- saved_data = NCR5380_read(INPUT_DATA_REGISTER);
- overrun = 1;
- }
+ udelay(10);
+ if (((NCR5380_read(BUS_AND_STATUS_REG) & (BASR_PHASE_MATCH | BASR_ACK)) ==
+ (BASR_PHASE_MATCH | BASR_ACK))) {
+ saved_data = NCR5380_read(INPUT_DATA_REGISTER);
+ overrun = 1;
+ }
#endif
- } else {
- int limit = 100;
- while (((tmp = NCR5380_read(BUS_AND_STATUS_REG)) & BASR_ACK) || (NCR5380_read(STATUS_REG) & SR_REQ)) {
- if (!(tmp & BASR_PHASE_MATCH))
- break;
- if (--limit < 0)
- break;
- }
+} else {
+ int limit = 100;
+ while (((tmp = NCR5380_read(BUS_AND_STATUS_REG)) & BASR_ACK) ||
+ (NCR5380_read(STATUS_REG) & SR_REQ)) {
+ if (!(tmp & BASR_PHASE_MATCH))
+ break;
+ if (--limit < 0)
+ break;
}
+}
- dprintk(NDEBUG_DMA, ("scsi%d : polled DMA transfer complete, basr 0x%X, sr 0x%X\n", instance->host_no, tmp, NCR5380_read(STATUS_REG)));
- NCR5380_write(MODE_REG, MR_BASE);
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
+#if (NDEBUG & NDEBUG_DMA)
+printk("scsi%d : polled DMA transfer complete, basr 0x%X, sr 0x%X\n",
+ instance->host_no, tmp, NCR5380_read(STATUS_REG));
+#endif
- residue = NCR5380_dma_residual(instance);
- c -= residue;
- *count -= c;
- *data += c;
- *phase = NCR5380_read(STATUS_REG) & PHASE_MASK;
+NCR5380_write(MODE_REG, MR_BASE);
+NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
+
+residue = NCR5380_dma_residual(instance);
+c -= residue;
+*count -= c;
+*data += c;
+*phase = NCR5380_read(STATUS_REG) & PHASE_MASK;
#ifdef READ_OVERRUNS
- if (*phase == p && (p & SR_IO) && residue == 0) {
- if (overrun) {
- dprintk(NDEBUG_DMA, ("Got an input overrun, using saved byte\n"));
- **data = saved_data;
- *data += 1;
- *count -= 1;
- cnt = toPIO = 1;
- } else {
- printk("No overrun??\n");
- cnt = toPIO = 2;
- }
- dprintk(NDEBUG_DMA, ("Doing %d-byte PIO to 0x%X\n", cnt, *data));
- NCR5380_transfer_pio(instance, phase, &cnt, data);
- *count -= toPIO - cnt;
- }
+if (*phase == p && (p & SR_IO) && residue == 0)
+{
+if (overrun) {
+#if (NDEBUG & NDEBUG_DMA)
+ printk("Got an input overrun, using saved byte\n");
+#endif
+ **data = saved_data;
+ *data += 1;
+ *count -= 1;
+ cnt = toPIO = 1;
+} else {
+ printk("No overrun??\n");
+ cnt = toPIO = 2;
+}
+#if (NDEBUG & NDEBUG_DMA)
+printk("Doing %d-byte PIO to 0x%X\n", cnt, *data);
+#endif
+NCR5380_transfer_pio(instance, phase, &cnt, data);
+*count -= toPIO - cnt;
+}
#endif
- dprintk(NDEBUG_DMA, ("Return with data ptr = 0x%X, count %d, last 0x%X, next 0x%X\n", *data, *count, *(*data + *count - 1), *(*data + *count)));
- return 0;
+#if (NDEBUG & NDEBUG_DMA)
+printk("Return with data ptr = 0x%X, count %d, last 0x%X, next 0x%X\n",
+ *data, *count, *(*data + *count - 1), *(*data + *count));
+#endif
+return 0;
#elif defined(REAL_DMA)
- return 0;
+return 0;
#else /* defined(REAL_DMA_POLL) */
- if (p & SR_IO) {
+if (p & SR_IO) {
#ifdef DMA_WORKS_RIGHT
- foo = NCR5380_pread(instance, d, c);
+ foo = NCR5380_pread(instance, d, c);
#else
- int diff = 1;
- if (hostdata->flags & FLAG_NCR53C400) {
- diff = 0;
- }
- if (!(foo = NCR5380_pread(instance, d, c - diff))) {
- /*
- * We can't disable DMA mode after successfully transferring
- * what we plan to be the last byte, since that would open up
- * a race condition where if the target asserted REQ before
- * we got the DMA mode reset, the NCR5380 would have latched
- * an additional byte into the INPUT DATA register and we'd
- * have dropped it.
- *
- * The workaround was to transfer one fewer bytes than we
- * intended to with the pseudo-DMA read function, wait for
- * the chip to latch the last byte, read it, and then disable
- * pseudo-DMA mode.
- *
- * After REQ is asserted, the NCR5380 asserts DRQ and ACK.
- * REQ is deasserted when ACK is asserted, and not reasserted
- * until ACK goes false. Since the NCR5380 won't lower ACK
- * until DACK is asserted, which won't happen unless we twiddle
- * the DMA port or we take the NCR5380 out of DMA mode, we
- * can guarantee that we won't handshake another extra
- * byte.
- */
+ int diff = 1;
+ if (hostdata->flags & FLAG_NCR53C400) {
+ diff = 0;
+ }
+ if (!(foo = NCR5380_pread(instance, d, c - diff))) {
+ /*
+ * We can't disable DMA mode after successfully transferring
+ * what we plan to be the last byte, since that would open up
+ * a race condition where if the target asserted REQ before
+ * we got the DMA mode reset, the NCR5380 would have latched
+ * an additional byte into the INPUT DATA register and we'd
+ * have dropped it.
+ *
+ * The workaround was to transfer one fewer bytes than we
+ * intended to with the pseudo-DMA read function, wait for
+ * the chip to latch the last byte, read it, and then disable
+ * pseudo-DMA mode.
+ *
+ * After REQ is asserted, the NCR5380 asserts DRQ and ACK.
+ * REQ is deasserted when ACK is asserted, and not reasserted
+ * until ACK goes false. Since the NCR5380 won't lower ACK
+ * until DACK is asserted, which won't happen unless we twiddle
+ * the DMA port or we take the NCR5380 out of DMA mode, we
+ * can guarantee that we won't handshake another extra
+ * byte.
+ */
- if (!(hostdata->flags & FLAG_NCR53C400)) {
- while (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ));
- /* Wait for clean handshake */
- while (NCR5380_read(STATUS_REG) & SR_REQ);
- d[c - 1] = NCR5380_read(INPUT_DATA_REG);
- }
+ if (!(hostdata->flags & FLAG_NCR53C400)) {
+ while (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ));
+ /* Wait for clean handshake */
+ while (NCR5380_read(STATUS_REG) & SR_REQ);
+ d[c - 1] = NCR5380_read(INPUT_DATA_REG);
}
+ }
#endif
- } else {
+} else {
#ifdef DMA_WORKS_RIGHT
- foo = NCR5380_pwrite(instance, d, c);
+ foo = NCR5380_pwrite(instance, d, c);
#else
- int timeout;
- dprintk(NDEBUG_C400_PWRITE, ("About to pwrite %d bytes\n", c));
- if (!(foo = NCR5380_pwrite(instance, d, c))) {
- /*
- * Wait for the last byte to be sent. If REQ is being asserted for
- * the byte we're interested, we'll ACK it and it will go false.
- */
- if (!(hostdata->flags & FLAG_HAS_LAST_BYTE_SENT)) {
- timeout = 20000;
- while (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ) && (NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH));
-
- if (!timeout)
- dprintk(NDEBUG_LAST_BYTE_SENT, ("scsi%d : timed out on last byte\n", instance->host_no));
-
- if (hostdata->flags & FLAG_CHECK_LAST_BYTE_SENT) {
- hostdata->flags &= ~FLAG_CHECK_LAST_BYTE_SENT;
- if (NCR5380_read(TARGET_COMMAND_REG) & TCR_LAST_BYTE_SENT) {
- hostdata->flags |= FLAG_HAS_LAST_BYTE_SENT;
- dprintk(NDEBUG_LAST_WRITE_SENT, ("scsi%d : last bit sent works\n", instance->host_no));
- }
+ int timeout;
+#if (NDEBUG & NDEBUG_C400_PWRITE)
+ printk("About to pwrite %d bytes\n", c);
+#endif
+ if (!(foo = NCR5380_pwrite(instance, d, c))) {
+ /*
+ * Wait for the last byte to be sent. If REQ is being asserted for
+ * the byte we're interested, we'll ACK it and it will go false.
+ */
+ if (!(hostdata->flags & FLAG_HAS_LAST_BYTE_SENT)) {
+ timeout = 20000;
+#if 1
+#if 1
+ while (!(NCR5380_read(BUS_AND_STATUS_REG) &
+ BASR_DRQ) && (NCR5380_read(BUS_AND_STATUS_REG) &
+ BASR_PHASE_MATCH));
+#else
+ if (NCR5380_read(STATUS_REG) & SR_REQ) {
+ for (; timeout &&
+ !(NCR5380_read(BUS_AND_STATUS_REG) & BASR_ACK);
+ --timeout);
+ for (; timeout && (NCR5380_read(STATUS_REG) & SR_REQ);
+ --timeout);
+ }
+#endif
+
+
+#if (NDEBUG & NDEBUG_LAST_BYTE_SENT)
+ if (!timeout)
+ printk("scsi%d : timed out on last byte\n",
+ instance->host_no);
+#endif
+
+
+ if (hostdata->flags & FLAG_CHECK_LAST_BYTE_SENT) {
+ hostdata->flags &= ~FLAG_CHECK_LAST_BYTE_SENT;
+ if (NCR5380_read(TARGET_COMMAND_REG) & TCR_LAST_BYTE_SENT) {
+ hostdata->flags |= FLAG_HAS_LAST_BYTE_SENT;
+#if (NDEBUG & NDEBUG_LAST_BYTE_SENT)
+ printk("scsi%d : last bit sent works\n",
+ instance->host_no);
+#endif
}
- } else {
- dprintk(NDEBUG_C400_PWRITE, ("Waiting for LASTBYTE\n"));
- while (!(NCR5380_read(TARGET_COMMAND_REG) & TCR_LAST_BYTE_SENT));
- dprintk(NDEBUG_C400_PWRITE, ("Got LASTBYTE\n"));
}
+ } else {
+#if (NDEBUG & NDEBUG_C400_PWRITE)
+ printk("Waiting for LASTBYTE\n");
+#endif
+ while (!(NCR5380_read(TARGET_COMMAND_REG) & TCR_LAST_BYTE_SENT));
+#if (NDEBUG & NDEBUG_C400_PWRITE)
+ printk("Got LASTBYTE\n");
+#endif
+ }
+#else
+ udelay(5);
+#endif
}
#endif
}
@@ -2215,9 +2552,13 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
if ((!(p & SR_IO)) && (hostdata->flags & FLAG_NCR53C400)) {
- dprintk(NDEBUG_C400_PWRITE, ("53C400w: Checking for IRQ\n"));
+#if (NDEBUG & NDEBUG_C400_PWRITE)
+ printk("53C400w: Checking for IRQ\n");
+#endif
if (NCR5380_read(BUS_AND_STATUS_REG) & BASR_IRQ) {
- dprintk(NDEBUG_C400_PWRITE, ("53C400w: got it, reading reset interrupt reg\n"));
+#if (NDEBUG & NDEBUG_C400_PWRITE)
+ printk("53C400w: got it, reading reset interrupt reg\n");
+#endif
NCR5380_read(RESET_PARITY_INTERRUPT_REG);
} else {
printk("53C400w: IRQ NOT THERE!\n");
@@ -2226,8 +2567,11 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase
*data = d + c;
*count = 0;
*phase = NCR5380_read(STATUS_REG) & PHASE_MASK;
-#if defined(PSEUDO_DMA) && defined(UNSAFE)
- spin_lock_irq(&io_request_lock);
+#if 0
+ NCR5380_print_phase(instance);
+#endif
+#if defined(PSEUDO_DMA) && !defined(UNSAFE)
+ restore_flags(flags);
#endif /* defined(REAL_DMA_POLL) */
return foo;
#endif /* def REAL_DMA */
@@ -2249,13 +2593,12 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase
*
* XXX Note : we need to watch for bus free or a reset condition here
* to recover from an unexpected bus free condition.
- *
- * Locks: io_request_lock held by caller
*/
static void NCR5380_information_transfer(struct Scsi_Host *instance) {
NCR5380_local_declare();
- struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *)instance->hostdata;
+ struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *)
+ instance->hostdata;
unsigned char msgout = NOP;
int sink = 0;
int len;
@@ -2265,8 +2608,10 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
unsigned char *data;
unsigned char phase, tmp, extended_msg[10], old_phase = 0xff;
Scsi_Cmnd *cmd = (Scsi_Cmnd *) hostdata->connected;
+#ifdef USLEEP
/* RvC: we need to set the end of the polling time */
unsigned long poll_time = jiffies + USLEEP_POLL;
+#endif
NCR5380_setup(instance);
@@ -2277,22 +2622,27 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
phase = (tmp & PHASE_MASK);
if (phase != old_phase) {
old_phase = phase;
- NCR5380_dprint_phase(NDEBUG_INFORMATION, instance);
+#if (NDEBUG & NDEBUG_INFORMATION)
+ NCR5380_print_phase(instance);
+#endif
}
if (sink && (phase != PHASE_MSGOUT)) {
NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp));
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN |
+ ICR_ASSERT_ACK);
while (NCR5380_read(STATUS_REG) & SR_REQ);
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
+ ICR_ASSERT_ATN);
sink = 0;
continue;
}
switch (phase) {
- case PHASE_DATAIN:
- case PHASE_DATAOUT:
+ case PHASE_DATAIN:
+ case PHASE_DATAOUT:
#if (NDEBUG & NDEBUG_NO_DATAOUT)
- printk("scsi%d : NDEBUG_NO_DATAOUT set, attempted DATAOUT aborted\n", instance->host_no);
+ printk("scsi%d : NDEBUG_NO_DATAOUT set, attempted DATAOUT aborted\n",
+ instance->host_no);
sink = 1;
do_abort(instance);
cmd->result = DID_ERROR << 16;
@@ -2309,7 +2659,11 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
--cmd->SCp.buffers_residual;
cmd->SCp.this_residual = cmd->SCp.buffer->length;
cmd->SCp.ptr = cmd->SCp.buffer->address;
- dprintk(NDEBUG_INFORMATION, ("scsi%d : %d bytes and %d buffers left\n", instance->host_no, cmd->SCp.this_residual, cmd->SCp.buffers_residual));
+#if (NDEBUG & NDEBUG_INFORMATION)
+ printk("scsi%d : %d bytes and %d buffers left\n",
+ instance->host_no, cmd->SCp.this_residual,
+ cmd->SCp.buffers_residual);
+#endif
}
/*
* The preferred transfer method is going to be
@@ -2330,7 +2684,9 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
* We supplement these 2 if's with the flag.
*/
#ifdef NCR5380_dma_xfer_len
- if (!cmd->device->borken && !(hostdata->flags & FLAG_NO_PSEUDO_DMA) && (transfersize = NCR5380_dma_xfer_len(instance, cmd)) != 0) {
+ if (!cmd->device->borken &&
+ !(hostdata->flags & FLAG_NO_PSEUDO_DMA) &&
+ (transfersize = NCR5380_dma_xfer_len(instance, cmd)) != 0) {
#else
transfersize = cmd->transfersize;
@@ -2339,21 +2695,27 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
transfersize = 512;
#endif /* LIMIT_TRANSFERSIZE */
- if (!cmd->device->borken && transfersize && !(hostdata->flags & FLAG_NO_PSEUDO_DMA) && cmd->SCp.this_residual && !(cmd->SCp.this_residual % transfersize)) {
+ if (!cmd->device->borken && transfersize &&
+ !(hostdata->flags & FLAG_NO_PSEUDO_DMA) &&
+ cmd->SCp.this_residual && !(cmd->SCp.this_residual %
+ transfersize)) {
/* Limit transfers to 32K, for xx400 & xx406
* pseudoDMA that transfers in 128 bytes blocks. */
if (transfersize > 32 * 1024)
transfersize = 32 * 1024;
#endif
len = transfersize;
- if (NCR5380_transfer_dma(instance, &phase, &len, (unsigned char **) &cmd->SCp.ptr)) {
+ if (NCR5380_transfer_dma(instance, &phase,
+ &len, (unsigned char **) &cmd->SCp.ptr)) {
/*
* If the watchdog timer fires, all future accesses to this
* device will use the polled-IO.
*/
- printk("scsi%d : switching target %d lun %d to slow handshake\n", instance->host_no, cmd->target, cmd->lun);
+ printk("scsi%d : switching target %d lun %d to slow handshake\n",
+ instance->host_no, cmd->target, cmd->lun);
cmd->device->borken = 1;
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
+ ICR_ASSERT_ATN);
sink = 1;
do_abort(instance);
cmd->result = DID_ERROR << 16;
@@ -2363,11 +2725,12 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
cmd->SCp.this_residual -= transfersize - len;
} else
#endif /* defined(PSEUDO_DMA) || defined(REAL_DMA_POLL) */
- NCR5380_transfer_pio(instance, &phase, (int *) &cmd->SCp.this_residual, (unsigned char **)
- &cmd->SCp.ptr);
+ NCR5380_transfer_pio(instance, &phase,
+ (int *) &cmd->SCp.this_residual, (unsigned char **)
+ &cmd->SCp.ptr);
break;
- case PHASE_MSGIN:
- len = 1;
+ case PHASE_MSGIN:
+ len = 1;
data = &tmp;
NCR5380_transfer_pio(instance, &phase, &len, &data);
cmd->SCp.Message = tmp;
@@ -2384,18 +2747,24 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
* next_link, done() is called as with unlinked commands.
*/
#ifdef LINKED
- case LINKED_CMD_COMPLETE:
- case LINKED_FLG_CMD_COMPLETE:
+ case LINKED_CMD_COMPLETE:
+ case LINKED_FLG_CMD_COMPLETE:
/* Accept message by clearing ACK */
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
- dprintk(NDEBUG_LINKED, ("scsi%d : target %d lun %d linked command complete.\n", instance->host_no, cmd->target, cmd->lun));
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
+
+#if (NDEBUG & NDEBUG_LINKED)
+ printk("scsi%d : target %d lun %d linked command complete.\n",
+ instance->host_no, cmd->target, cmd->lun);
+#endif
/*
* Sanity check : A linked command should only terminate with
* one of these messages if there are more linked commands
* available.
*/
+
if (!cmd->next_link) {
- printk("scsi%d : target %d lun %d linked command complete, no next_link\n" instance->host_no, cmd->target, cmd->lun);
+ printk("scsi%d : target %d lun %d linked command complete, no next_link\n"
+ instance->host_no, cmd->target, cmd->lun);
sink = 1;
do_abort(instance);
return;
@@ -2404,19 +2773,27 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
/* The next command is still part of this process */
cmd->next_link->tag = cmd->tag;
cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
- dprintk(NDEBUG_LINKED, ("scsi%d : target %d lun %d linked request done, calling scsi_done().\n", instance->host_no, cmd->target, cmd->lun));
+#if (NDEBUG & NDEBUG_LINKED)
+ printk("scsi%d : target %d lun %d linked request done, calling scsi_done().\n",
+ instance->host_no, cmd->target, cmd->lun);
+#endif
+#ifdef NCR5380_STATS
collect_stats(hostdata, cmd);
+#endif
cmd->scsi_done(cmd);
cmd = hostdata->connected;
break;
#endif /* def LINKED */
- case ABORT:
- case COMMAND_COMPLETE:
+ case ABORT:
+ case COMMAND_COMPLETE:
/* Accept message by clearing ACK */
- sink = 1;
+ sink = 1;
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
hostdata->connected = NULL;
- dprintk(NDEBUG_QUEUES, ("scsi%d : command for target %d, lun %d completed\n", instance->host_no, cmd->target, cmd->lun));
+#if (NDEBUG & NDEBUG_QUEUES)
+ printk("scsi%d : command for target %d, lun %d completed\n",
+ instance->host_no, cmd->target, cmd->lun);
+#endif
hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
/*
@@ -2441,8 +2818,13 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
#ifdef AUTOSENSE
- if ((cmd->cmnd[0] != REQUEST_SENSE) && (cmd->SCp.Status == CHECK_CONDITION)) {
- dprintk(NDEBUG_AUTOSENSE, ("scsi%d : performing request sense\n", instance->host_no));
+ if ((cmd->cmnd[0] != REQUEST_SENSE) &&
+ (cmd->SCp.Status == CHECK_CONDITION)) {
+ unsigned long flags;
+#if (NDEBUG & NDEBUG_AUTOSENSE)
+ printk("scsi%d : performing request sense\n",
+ instance->host_no);
+#endif
cmd->cmnd[0] = REQUEST_SENSE;
cmd->cmnd[1] &= 0xe0;
cmd->cmnd[2] = 0;
@@ -2455,14 +2837,21 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
cmd->SCp.ptr = (char *) cmd->sense_buffer;
cmd->SCp.this_residual = sizeof(cmd->sense_buffer);
+ save_flags(flags);
+ cli();
LIST(cmd, hostdata->issue_queue);
cmd->host_scribble = (unsigned char *)
hostdata->issue_queue;
hostdata->issue_queue = (Scsi_Cmnd *) cmd;
- dprintk(NDEBUG_QUEUES, ("scsi%d : REQUEST SENSE added to head of issue queue\n", instance->host_no));
+ restore_flags(flags);
+#if (NDEBUG & NDEBUG_QUEUES)
+ printk("scsi%d : REQUEST SENSE added to head of issue queue\n", instance->host_no);
+#endif
} else {
#endif /* def AUTOSENSE */
+#ifdef NCR5380_STATS
collect_stats(hostdata, cmd);
+#endif
cmd->scsi_done(cmd);
}
@@ -2476,29 +2865,37 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
while ((NCR5380_read(STATUS_REG) & SR_BSY) && !hostdata->connected)
barrier();
return;
- case MESSAGE_REJECT:
+ case MESSAGE_REJECT:
/* Accept message by clearing ACK */
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
switch (hostdata->last_message) {
- case HEAD_OF_QUEUE_TAG:
- case ORDERED_QUEUE_TAG:
- case SIMPLE_QUEUE_TAG:
- cmd->device->tagged_queue = 0;
+ case HEAD_OF_QUEUE_TAG:
+ case ORDERED_QUEUE_TAG:
+ case SIMPLE_QUEUE_TAG:
+ cmd->device->tagged_queue = 0;
hostdata->busy[cmd->target] |= (1 << cmd->lun);
break;
- default:
- break;
+ default:
+ break;
}
- case DISCONNECT:{
+ case DISCONNECT: {
+ unsigned long flags;
/* Accept message by clearing ACK */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
cmd->device->disconnect = 1;
+ save_flags(flags);
+ cli();
LIST(cmd, hostdata->disconnected_queue);
cmd->host_scribble = (unsigned char *)
hostdata->disconnected_queue;
hostdata->connected = NULL;
hostdata->disconnected_queue = cmd;
- dprintk(NDEBUG_QUEUES, ("scsi%d : command for target %d lun %d was moved from connected to" " the disconnected_queue\n", instance->host_no, cmd->target, cmd->lun));
+ restore_flags(flags);
+#if (NDEBUG & NDEBUG_QUEUES)
+ printk("scsi%d : command for target %d lun %d was moved from connected to"
+ " the disconnected_queue\n", instance->host_no,
+ cmd->target, cmd->lun);
+#endif
/*
* Restore phase bits to 0 so an interrupted selection,
* arbitration can resume.
@@ -2510,6 +2907,9 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
/* Wait for bus free to avoid nasty timeouts */
while ((NCR5380_read(STATUS_REG) & SR_BSY) && !hostdata->connected)
barrier();
+#if 0
+ NCR5380_print_status(instance);
+#endif
return;
}
/*
@@ -2522,12 +2922,12 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
* disconnecting, and we have to break spec to remain
* compatible.
*/
- case SAVE_POINTERS:
- case RESTORE_POINTERS:
+ case SAVE_POINTERS:
+ case RESTORE_POINTERS:
/* Accept message by clearing ACK */
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
break;
- case EXTENDED_MESSAGE:
+ case EXTENDED_MESSAGE:
/*
* Extended messages are sent in the following format :
* Byte
@@ -2540,19 +2940,28 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
* Start the extended message buffer with the EXTENDED_MESSAGE
* byte, since print_msg() wants the whole thing.
*/
- extended_msg[0] = EXTENDED_MESSAGE;
+ extended_msg[0] = EXTENDED_MESSAGE;
/* Accept first byte by clearing ACK */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
- dprintk(NDEBUG_EXTENDED, ("scsi%d : receiving extended message\n", instance->host_no));
+
+#if (NDEBUG & NDEBUG_EXTENDED)
+ printk("scsi%d : receiving extended message\n",
+ instance->host_no);
+#endif
len = 2;
data = extended_msg + 1;
phase = PHASE_MSGIN;
NCR5380_transfer_pio(instance, &phase, &len, &data);
- dprintk(NDEBUG_EXTENDED, ("scsi%d : length=%d, code=0x%02x\n", instance->host_no, (int) extended_msg[1], (int) extended_msg[2]));
+#if (NDEBUG & NDEBUG_EXTENDED)
+ printk("scsi%d : length=%d, code=0x%02x\n",
+ instance->host_no, (int) extended_msg[1],
+ (int) extended_msg[2]);
+#endif
- if (!len && extended_msg[1] <= (sizeof(extended_msg) - 1)) {
+ if (!len && extended_msg[1] <=
+ (sizeof(extended_msg) - 1)) {
/* Accept third byte by clearing ACK */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
len = extended_msg[1] - 1;
@@ -2560,20 +2969,26 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
phase = PHASE_MSGIN;
NCR5380_transfer_pio(instance, &phase, &len, &data);
- dprintk(NDEBUG_EXTENDED, ("scsi%d : message received, residual %d\n", instance->host_no, len));
+
+#if (NDEBUG & NDEBUG_EXTENDED)
+ printk("scsi%d : message received, residual %d\n",
+ instance->host_no, len);
+#endif
switch (extended_msg[2]) {
- case EXTENDED_SDTR:
- case EXTENDED_WDTR:
- case EXTENDED_MODIFY_DATA_POINTER:
- case EXTENDED_EXTENDED_IDENTIFY:
- tmp = 0;
+ case EXTENDED_SDTR:
+ case EXTENDED_WDTR:
+ case EXTENDED_MODIFY_DATA_POINTER:
+ case EXTENDED_EXTENDED_IDENTIFY:
+ tmp = 0;
}
} else if (len) {
- printk("scsi%d: error receiving extended message\n", instance->host_no);
+ printk("scsi%d: error receiving extended message\n",
+ instance->host_no);
tmp = 0;
} else {
- printk("scsi%d: extended message code %02x length %d is too long\n", instance->host_no, extended_msg[2], extended_msg[1]);
+ printk("scsi%d: extended message code %02x length %d is too long\n",
+ instance->host_no, extended_msg[2], extended_msg[1]);
tmp = 0;
}
/* Fall through to reject message */
@@ -2582,23 +2997,26 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
* If we get something weird that we aren't expecting,
* reject it.
*/
- default:
- if (!tmp) {
+ default:
+ if (!tmp) {
printk("scsi%d: rejecting message ", instance->host_no);
print_msg(extended_msg);
printk("\n");
} else if (tmp != EXTENDED_MESSAGE)
- printk("scsi%d: rejecting unknown message %02x from target %d, lun %d\n", instance->host_no, tmp, cmd->target, cmd->lun);
+ printk("scsi%d: rejecting unknown message %02x from target %d, lun %d\n",
+ instance->host_no, tmp, cmd->target, cmd->lun);
else
- printk("scsi%d: rejecting unknown extended message code %02x, length %d from target %d, lun %d\n", instance->host_no, extended_msg[1], extended_msg[0], cmd->target, cmd->lun);
+ printk("scsi%d: rejecting unknown extended message code %02x, length %d from target %d, lun %d\n",
+ instance->host_no, extended_msg[1], extended_msg[0], cmd->target, cmd->lun);
msgout = MESSAGE_REJECT;
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
+ ICR_ASSERT_ATN);
break;
} /* switch (tmp) */
break;
- case PHASE_MSGOUT:
- len = 1;
+ case PHASE_MSGOUT:
+ len = 1;
data = &msgout;
hostdata->last_message = msgout;
NCR5380_transfer_pio(instance, &phase, &len, &data);
@@ -2606,50 +3024,69 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
hostdata->connected = NULL;
cmd->result = DID_ERROR << 16;
+#ifdef NCR5380_STATS
collect_stats(hostdata, cmd);
+#endif
cmd->scsi_done(cmd);
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
return;
}
msgout = NOP;
break;
- case PHASE_CMDOUT:
- len = cmd->cmd_len;
+ case PHASE_CMDOUT:
+ len = cmd->cmd_len;
data = cmd->cmnd;
/*
* XXX for performance reasons, on machines with a
* PSEUDO-DMA architecture we should probably
* use the dma transfer function.
*/
- NCR5380_transfer_pio(instance, &phase, &len, &data);
- if (!cmd->device->disconnect && should_disconnect(cmd->cmnd[0])) {
+ NCR5380_transfer_pio(instance, &phase, &len,
+ &data);
+#ifdef USLEEP
+ if (!cmd->device->disconnect &&
+ should_disconnect(cmd->cmnd[0]))
+ {
hostdata->time_expires = jiffies + USLEEP_SLEEP;
- dprintk(NDEBUG_USLEEP, ("scsi%d : issued command, sleeping until %ul\n", instance->host_no, hostdata->time_expires));
+#if (NDEBUG & NDEBUG_USLEEP)
+ printk("scsi%d : issued command, sleeping until %ul\n", instance->host_no,
+ hostdata->time_expires);
+#endif
NCR5380_set_timer(instance);
return;
}
+#endif /* def USLEEP */
break;
- case PHASE_STATIN:
- len = 1;
+ case PHASE_STATIN:
+ len = 1;
data = &tmp;
NCR5380_transfer_pio(instance, &phase, &len, &data);
cmd->SCp.Status = tmp;
break;
- default:
- printk("scsi%d : unknown phase\n", instance->host_no);
- NCR5380_dprint(NDEBUG_ALL, instance);
+ default:
+ printk("scsi%d : unknown phase\n", instance->host_no);
+#ifdef NDEBUG
+ NCR5380_print(instance);
+#endif
} /* switch(phase) */
} /* if (tmp * SR_REQ) */
- else {
+#ifdef USLEEP
+ else
+ {
/* RvC: go to sleep if polling time expired
*/
- if (!cmd->device->disconnect && time_after_eq(jiffies, poll_time)) {
+ if (!cmd->device->disconnect && time_after_eq(jiffies, poll_time))
+ {
hostdata->time_expires = jiffies + USLEEP_SLEEP;
- dprintk(NDEBUG_USLEEP, ("scsi%d : poll timed out, sleeping until %ul\n", instance->host_no, hostdata->time_expires));
+#if (NDEBUG & NDEBUG_USLEEP)
+ printk("scsi%d : poll timed out, sleeping until %ul\n", instance->host_no,
+ hostdata->time_expires);
+#endif
NCR5380_set_timer(instance);
return;
}
}
+#endif
} /* while (1) */
}
@@ -2662,9 +3099,9 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
*
* Inputs : instance - this instance of the NCR5380.
*
- * Locks: io_request_lock held by caller
*/
+
static void NCR5380_reselect(struct Scsi_Host *instance) {
NCR5380_local_declare();
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *)
@@ -2672,22 +3109,28 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
unsigned char target_mask;
unsigned char lun, phase;
int len;
+#ifdef SCSI2
+ unsigned char tag;
+#endif
unsigned char msg[3];
unsigned char *data;
Scsi_Cmnd *tmp = NULL, *prev;
int abort = 0;
- NCR5380_setup(instance);
+ NCR5380_setup(instance);
/*
* Disable arbitration, etc. since the host adapter obviously
* lost, and tell an interrupted NCR5380_select() to restart.
*/
- NCR5380_write(MODE_REG, MR_BASE);
- hostdata->restart_select = 1;
+ NCR5380_write(MODE_REG, MR_BASE);
+ hostdata->restart_select = 1;
- target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask);
- dprintk(NDEBUG_SELECTION, ("scsi%d : reselect\n", instance->host_no));
+ target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask);
+
+#if (NDEBUG & NDEBUG_RESELECTION)
+ printk("scsi%d : reselect\n", instance->host_no);
+#endif
/*
* At this point, we have detected that our SCSI ID is on the bus,
@@ -2698,10 +3141,10 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
* signal.
*/
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY);
while (NCR5380_read(STATUS_REG) & SR_SEL);
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
/*
* Wait for target to go into MSGIN.
@@ -2709,13 +3152,15 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
while (!(NCR5380_read(STATUS_REG) & SR_REQ));
- len = 1;
- data = msg;
- phase = PHASE_MSGIN;
- NCR5380_transfer_pio(instance, &phase, &len, &data);
+ len = 1;
+ data = msg;
+ phase = PHASE_MSGIN;
+ NCR5380_transfer_pio(instance, &phase, &len, &data);
+
if (!msg[0] & 0x80) {
- printk("scsi%d : expecting IDENTIFY message, got ", instance->host_no);
+ printk("scsi%d : expecting IDENTIFY message, got ",
+ instance->host_no);
print_msg(msg);
abort = 1;
} else {
@@ -2729,14 +3174,22 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
* nexuses so we can chose to do additional data transfer.
*/
+#ifdef SCSI2
+#error "SCSI-II tagged queueing is not supported yet"
+#endif
+
/*
* Find the command corresponding to the I_T_L or I_T_L_Q nexus we
* just reestablished, and remove it from the disconnected queue.
*/
- for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble)
+ for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL;
+ tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble)
if ((target_mask == (1 << tmp->target)) && (lun == tmp->lun)
+#ifdef SCSI2
+ && (tag == tmp->tag)
+#endif
) {
if (prev) {
REMOVE(prev, prev->host_scribble, tmp, tmp->host_scribble);
@@ -2749,7 +3202,13 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
break;
}
if (!tmp) {
- printk("scsi%d : warning : target bitmask %02x lun %d not in disconnect_queue.\n", instance->host_no, target_mask, lun);
+#ifdef SCSI2
+ printk("scsi%d : warning : target bitmask %02x lun %d tag %d not in disconnect_queue.\n",
+ instance->host_no, target_mask, lun, tag);
+#else
+ printk("scsi%d : warning : target bitmask %02x lun %d not in disconnect_queue.\n",
+ instance->host_no, target_mask, lun);
+#endif
/*
* Since we have an established nexus that we can't do anything with,
* we must abort it.
@@ -2762,7 +3221,10 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
do_abort(instance);
} else {
hostdata->connected = tmp;
- dprintk(NDEBUG_RESELECTION, ("scsi%d : nexus established, target = %d, lun = %d, tag = %d\n", instance->host_no, tmp->target, tmp->lun, tmp->tag));
+#if (NDEBUG & NDEBUG_RESELECTION)
+ printk("scsi%d : nexus established, target = %d, lun = %d, tag = %d\n",
+ instance->host_no, tmp->target, tmp->lun, tmp->tag);
+#endif
}
}
@@ -2781,7 +3243,8 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
#ifdef REAL_DMA
static void NCR5380_dma_complete(NCR5380_instance * instance) {
NCR5380_local_declare();
- struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata * instance->hostdata);
+ struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *
+ instance->hostdata);
int transferred;
NCR5380_setup(instance);
@@ -2824,12 +3287,10 @@ static void NCR5380_dma_complete(NCR5380_instance * instance) {
*
* Returns : 0 - success, -1 on failure.
*
- * XXX - there is no way to abort the command that is currently
- * connected, you have to wait for it to complete. If this is
- * a problem, we could implement longjmp() / setjmp(), setjmp()
- * called where the loop started in NCR5380_main().
- *
- * Locks: io_request_lock held by caller
+ * XXX - there is no way to abort the command that is currently
+ * connected, you have to wait for it to complete. If this is
+ * a problem, we could implement longjmp() / setjmp(), setjmp()
+ * called where the loop started in NCR5380_main().
*/
#ifndef NCR5380_abort
@@ -2837,8 +3298,10 @@ static
#endif
int NCR5380_abort(Scsi_Cmnd * cmd) {
NCR5380_local_declare();
+ unsigned long flags;
struct Scsi_Host *instance = cmd->host;
- struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
+ struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *)
+ instance->hostdata;
Scsi_Cmnd *tmp, **prev;
printk("scsi%d : aborting command\n", instance->host_no);
@@ -2851,10 +3314,15 @@ int NCR5380_abort(Scsi_Cmnd * cmd) {
NCR5380_print_status(instance);
+ save_flags(flags);
+ cli();
NCR5380_setup(instance);
- dprintk(NDEBUG_ABORT, ("scsi%d : abort called\n", instance->host_no));
- dprintk(NDEBUG_ABORT, (" basr 0x%X, sr 0x%X\n", NCR5380_read(BUS_AND_STATUS_REG), NCR5380_read(STATUS_REG)));
+#if (NDEBUG & NDEBUG_ABORT)
+ printk("scsi%d : abort called\n", instance->host_no);
+ printk(" basr 0x%X, sr 0x%X\n",
+ NCR5380_read(BUS_AND_STATUS_REG), NCR5380_read(STATUS_REG));
+#endif
#if 0
/*
@@ -2864,7 +3332,9 @@ int NCR5380_abort(Scsi_Cmnd * cmd) {
*/
if (hostdata->connected == cmd) {
- dprintk(NDEBUG_ABORT, ("scsi%d : aborting connected command\n", instance->host_no));
+#if (NDEBUG & NDEBUG_ABORT)
+ printk("scsi%d : aborting connected command\n", instance->host_no);
+#endif
hostdata->aborted = 1;
/*
* We should perform BSY checking, and make sure we haven't slipped
@@ -2891,15 +3361,24 @@ int NCR5380_abort(Scsi_Cmnd * cmd) {
* Case 2 : If the command hasn't been issued yet, we simply remove it
* from the issue queue.
*/
+#if (NDEBUG & NDEBUG_ABORT)
/* KLL */
- dprintk(NDEBUG_ABORT, ("scsi%d : abort going into loop.\n", instance->host_no));
- for (prev = (Scsi_Cmnd **) & (hostdata->issue_queue), tmp = (Scsi_Cmnd *) hostdata->issue_queue; tmp; prev = (Scsi_Cmnd **) & (tmp->host_scribble), tmp = (Scsi_Cmnd *) tmp->host_scribble)
+ printk("scsi%d : abort going into loop.\n", instance->host_no);
+#endif
+ for (prev = (Scsi_Cmnd **) & (hostdata->issue_queue),
+ tmp = (Scsi_Cmnd *) hostdata->issue_queue;
+ tmp; prev = (Scsi_Cmnd **) & (tmp->host_scribble), tmp =
+ (Scsi_Cmnd *) tmp->host_scribble)
if (cmd == tmp) {
REMOVE(5, *prev, tmp, tmp->host_scribble);
(*prev) = (Scsi_Cmnd *) tmp->host_scribble;
tmp->host_scribble = NULL;
tmp->result = DID_ABORT << 16;
- dprintk(NDEBUG_ABORT, ("scsi%d : abort removed command from issue queue.\n", instance->host_no));
+ restore_flags(flags);
+#if (NDEBUG & NDEBUG_ABORT)
+ printk("scsi%d : abort removed command from issue queue.\n",
+ instance->host_no);
+#endif
tmp->done(tmp);
return SCSI_ABORT_SUCCESS;
}
@@ -2921,7 +3400,10 @@ int NCR5380_abort(Scsi_Cmnd * cmd) {
*/
if (hostdata->connected) {
- dprintk(NDEBUG_ABORT, ("scsi%d : abort failed, command connected.\n", instance->host_no));
+ restore_flags(flags);
+#if (NDEBUG & NDEBUG_ABORT)
+ printk("scsi%d : abort failed, command connected.\n", instance->host_no);
+#endif
return SCSI_ABORT_NOT_RUNNING;
}
/*
@@ -2949,22 +3431,34 @@ int NCR5380_abort(Scsi_Cmnd * cmd) {
* it from the disconnected queue.
*/
- for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp; tmp = (Scsi_Cmnd *) tmp->host_scribble)
+ for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp;
+ tmp = (Scsi_Cmnd *) tmp->host_scribble)
if (cmd == tmp) {
- dprintk(NDEBUG_ABORT, ("scsi%d : aborting disconnected command.\n", instance->host_no));
+ restore_flags(flags);
+#if (NDEBUG & NDEBUG_ABORT)
+ printk("scsi%d : aborting disconnected command.\n", instance->host_no);
+#endif
if (NCR5380_select(instance, cmd, (int) cmd->tag))
return SCSI_ABORT_BUSY;
- dprintk(NDEBUG_ABORT, ("scsi%d : nexus reestablished.\n", instance->host_no));
+
+#if (NDEBUG & NDEBUG_ABORT)
+ printk("scsi%d : nexus reestablished.\n", instance->host_no);
+#endif
do_abort(instance);
- for (prev = (Scsi_Cmnd **) & (hostdata->disconnected_queue), tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp; prev = (Scsi_Cmnd **) & (tmp->host_scribble), tmp = (Scsi_Cmnd *) tmp->host_scribble)
+ cli();
+ for (prev = (Scsi_Cmnd **) & (hostdata->disconnected_queue),
+ tmp = (Scsi_Cmnd *) hostdata->disconnected_queue;
+ tmp; prev = (Scsi_Cmnd **) & (tmp->host_scribble), tmp =
+ (Scsi_Cmnd *) tmp->host_scribble)
if (cmd == tmp) {
REMOVE(5, *prev, tmp, tmp->host_scribble);
*prev = (Scsi_Cmnd *) tmp->host_scribble;
tmp->host_scribble = NULL;
tmp->result = DID_ABORT << 16;
+ restore_flags(flags);
tmp->done(tmp);
return SCSI_ABORT_SUCCESS;
}
@@ -2978,7 +3472,10 @@ int NCR5380_abort(Scsi_Cmnd * cmd) {
* so we won't panic, but we will notify the user in case something really
* broke.
*/
- printk("scsi%d : warning : SCSI command probably completed successfully\n" " before abortion\n", instance->host_no);
+
+ restore_flags(flags);
+ printk("scsi%d : warning : SCSI command probably completed successfully\n"
+ " before abortion\n", instance->host_no);
return SCSI_ABORT_NOT_RUNNING;
}
@@ -2990,7 +3487,6 @@ int NCR5380_abort(Scsi_Cmnd * cmd) {
*
* Returns : SCSI_RESET_WAKEUP
*
- * Locks: io_request_lock held by caller
*/
#ifndef NCR5380_reset
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index c7882e224..af6d8122d 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -55,8 +55,6 @@
#define NDEBUG_C400_PWRITE 0x200000
#define NDEBUG_LISTS 0x400000
-#define NDEBUG_ANY 0xFFFFFFFFUL
-
/*
* The contents of the OUTPUT DATA register are asserted on the bus when
* either arbitration is occurring or the phase-indicating signals (
@@ -64,8 +62,8 @@
* bit in the INITIATOR COMMAND register is set.
*/
-#define OUTPUT_DATA_REG 0 /* wo DATA lines on SCSI bus */
-#define CURRENT_SCSI_DATA_REG 0 /* ro same */
+#define OUTPUT_DATA_REG 0 /* wo DATA lines on SCSI bus */
+#define CURRENT_SCSI_DATA_REG 0 /* ro same */
#define INITIATOR_COMMAND_REG 1 /* rw */
#define ICR_ASSERT_RST 0x80 /* rw Set to assert RST */
@@ -93,10 +91,10 @@
*/
#define MR_BLOCK_DMA_MODE 0x80 /* rw block mode DMA */
#define MR_TARGET 0x40 /* rw target mode */
-#define MR_ENABLE_PAR_CHECK 0x20 /* rw enable parity checking */
+#define MR_ENABLE_PAR_CHECK 0x20 /* rw enable parity checking */
#define MR_ENABLE_PAR_INTR 0x10 /* rw enable bad parity interrupt */
#define MR_ENABLE_EOP_INTR 0x08 /* rw enable eop interrupt */
-#define MR_MONITOR_BSY 0x04 /* rw enable int on unexpected bsy fail */
+#define MR_MONITOR_BSY 0x04 /* rw enable int on unexpected bsy fail */
#define MR_DMA_MODE 0x02 /* rw DMA / pseudo DMA mode */
#define MR_ARBITRATE 0x01 /* rw start arbitration */
@@ -118,7 +116,7 @@
* Note : a set bit indicates an active signal, driven by us or another
* device.
*/
-#define SR_RST 0x80
+#define SR_RST 0x80
#define SR_BSY 0x40
#define SR_REQ 0x20
#define SR_MSG 0x10
@@ -161,17 +159,17 @@
/* Write any value to this register to start an ini mode DMA receive */
#define START_DMA_INITIATOR_RECEIVE_REG 7 /* wo */
-#define C400_CONTROL_STATUS_REG NCR53C400_register_offset-8 /* rw */
+#define C400_CONTROL_STATUS_REG NCR53C400_register_offset-8 /* rw */
-#define CSR_RESET 0x80 /* wo Resets 53c400 */
-#define CSR_53C80_REG 0x80 /* ro 5380 registers busy */
-#define CSR_TRANS_DIR 0x40 /* rw Data transfer direction */
-#define CSR_SCSI_BUFF_INTR 0x20 /* rw Enable int on transfer ready */
-#define CSR_53C80_INTR 0x10 /* rw Enable 53c80 interrupts */
-#define CSR_SHARED_INTR 0x08 /* rw Interrupt sharing */
-#define CSR_HOST_BUF_NOT_RDY 0x04 /* ro Is Host buffer ready */
-#define CSR_SCSI_BUF_RDY 0x02 /* ro SCSI buffer read */
-#define CSR_GATED_53C80_IRQ 0x01 /* ro Last block xferred */
+#define CSR_RESET 0x80 /* wo Resets 53c400 */
+#define CSR_53C80_REG 0x80 /* ro 5380 registers busy */
+#define CSR_TRANS_DIR 0x40 /* rw Data transfer direction */
+#define CSR_SCSI_BUFF_INTR 0x20 /* rw Enable int on transfer ready */
+#define CSR_53C80_INTR 0x10 /* rw Enable 53c80 interrupts */
+#define CSR_SHARED_INTR 0x08 /* rw Interrupt sharing */
+#define CSR_HOST_BUF_NOT_RDY 0x04 /* ro Is Host buffer ready */
+#define CSR_SCSI_BUF_RDY 0x02 /* ro SCSI buffer read */
+#define CSR_GATED_53C80_IRQ 0x01 /* ro Last block xferred */
#if 0
#define CSR_BASE CSR_SCSI_BUFF_INTR | CSR_53C80_INTR
@@ -180,13 +178,13 @@
#endif
/* Number of 128-byte blocks to be transferred */
-#define C400_BLOCK_COUNTER_REG NCR53C400_register_offset-7 /* rw */
+#define C400_BLOCK_COUNTER_REG NCR53C400_register_offset-7 /* rw */
/* Resume transfer after disconnect */
-#define C400_RESUME_TRANSFER_REG NCR53C400_register_offset-6 /* wo */
+#define C400_RESUME_TRANSFER_REG NCR53C400_register_offset-6 /* wo */
/* Access to host buffer stack */
-#define C400_HOST_BUFFER NCR53C400_register_offset-4 /* rw */
+#define C400_HOST_BUFFER NCR53C400_register_offset-4 /* rw */
/* Note : PHASE_* macros are based on the values of the STATUS register */
@@ -205,8 +203,8 @@
* the target register so we can get phase mismatch interrupts on DMA
* transfers.
*/
-
-#define PHASE_SR_TO_TCR(phase) ((phase) >> 2)
+
+#define PHASE_SR_TO_TCR(phase) ((phase) >> 2)
/*
* The internal should_disconnect() function returns these based on the
@@ -222,7 +220,7 @@
* These are "special" values for the tag parameter passed to NCR5380_select.
*/
-#define TAG_NEXT -1 /* Use next free tag */
+#define TAG_NEXT -1 /* Use next free tag */
#define TAG_NONE -2 /*
* Establish I_T_L nexus instead of I_T_L_Q
* even on SCSI-II devices.
@@ -237,7 +235,7 @@
#define DMA_NONE 255
#define IRQ_AUTO 254
#define DMA_AUTO 254
-#define PORT_AUTO 0xffff /* autoprobe io port for 53c400a */
+#define PORT_AUTO 0xffff /* autoprobe io port for 53c400a */
#define FLAG_HAS_LAST_BYTE_SENT 1 /* NCR53c81 or better */
#define FLAG_CHECK_LAST_BYTE_SENT 2 /* Only test once */
@@ -247,188 +245,134 @@
#ifndef ASM
struct NCR5380_hostdata {
- NCR5380_implementation_fields; /* implementation specific */
- unsigned char id_mask, id_higher_mask; /* 1 << id, all bits greater */
- unsigned char targets_present; /* targets we have connected
+ NCR5380_implementation_fields; /* implementation specific */
+ unsigned char id_mask, id_higher_mask; /* 1 << id, all bits greater */
+ unsigned char targets_present; /* targets we have connected
to, so we can call a select
failure a retryable condition */
- volatile unsigned char busy[8]; /* index = target, bit = lun */
+ volatile unsigned char busy[8]; /* index = target, bit = lun */
#if defined(REAL_DMA) || defined(REAL_DMA_POLL)
- volatile int dma_len; /* requested length of DMA */
+ volatile int dma_len; /* requested length of DMA */
#endif
- volatile unsigned char last_message; /* last message OUT */
- volatile Scsi_Cmnd *connected; /* currently connected command */
- volatile Scsi_Cmnd *issue_queue; /* waiting to be issued */
- volatile Scsi_Cmnd *disconnected_queue; /* waiting for reconnect */
- volatile int restart_select; /* we have disconnected,
+ volatile unsigned char last_message; /* last message OUT */
+ volatile Scsi_Cmnd *connected; /* currently connected command */
+ volatile Scsi_Cmnd *issue_queue; /* waiting to be issued */
+ volatile Scsi_Cmnd *disconnected_queue; /* waiting for reconnect */
+ volatile int restart_select; /* we have disconnected,
used to restart
NCR5380_select() */
- volatile unsigned aborted:1; /* flag, says aborted */
- int flags;
- unsigned long time_expires; /* in jiffies, set prior to sleeping */
- struct Scsi_Host *next_timer;
- int select_time; /* timer in select for target response */
- volatile Scsi_Cmnd *selecting;
+ volatile unsigned aborted:1; /* flag, says aborted */
+ int flags;
+#ifdef USLEEP
+ unsigned long time_expires; /* in jiffies, set prior to sleeping */
+ struct Scsi_Host *next_timer;
+ int select_time; /* timer in select for target response */
+ volatile Scsi_Cmnd *selecting;
+#endif
#ifdef NCR5380_STATS
- unsigned timebase; /* Base for time calcs */
- long time_read[8]; /* time to do reads */
- long time_write[8]; /* time to do writes */
- unsigned long bytes_read[8]; /* bytes read */
- unsigned long bytes_write[8]; /* bytes written */
- unsigned pendingr;
- unsigned pendingw;
+ unsigned timebase; /* Base for time calcs */
+ long time_read[8]; /* time to do reads */
+ long time_write[8]; /* time to do writes */
+ unsigned long bytes_read[8]; /* bytes read */
+ unsigned long bytes_write[8]; /* bytes written */
+ unsigned pendingr;
+ unsigned pendingw;
#endif
};
#ifdef __KERNEL__
-static struct Scsi_Host *first_instance; /* linked list of 5380's */
-
-#define dprintk(a,b) do {} while(0)
-#define NCR5380_dprint(a,b) do {} while(0)
-#define NCR5380_dprint_phase(a,b) do {} while(0)
+static struct Scsi_Host *first_instance; /* linked list of 5380's */
#if defined(AUTOPROBE_IRQ)
-static int NCR5380_probe_irq(struct Scsi_Host *instance, int possible);
+static int NCR5380_probe_irq (struct Scsi_Host *instance, int possible);
#endif
-static void NCR5380_init(struct Scsi_Host *instance, int flags);
-static void NCR5380_information_transfer(struct Scsi_Host *instance);
+static void NCR5380_init (struct Scsi_Host *instance, int flags);
+static void NCR5380_information_transfer (struct Scsi_Host *instance);
#ifndef DONT_USE_INTR
-static void NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs);
-static void do_NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs);
+static void NCR5380_intr (int irq, void *dev_id, struct pt_regs * regs);
+static void do_NCR5380_intr (int irq, void *dev_id, struct pt_regs * regs);
#endif
-static void NCR5380_main(void);
-static void NCR5380_print_options(struct Scsi_Host *instance);
-static void NCR5380_print_phase(struct Scsi_Host *instance);
-static void NCR5380_print(struct Scsi_Host *instance);
+static void NCR5380_main (void);
+static void NCR5380_print_options (struct Scsi_Host *instance);
+static void NCR5380_print_phase (struct Scsi_Host *instance);
+static void NCR5380_print (struct Scsi_Host *instance);
#ifndef NCR5380_abort
static
#endif
-int NCR5380_abort(Scsi_Cmnd * cmd);
+int NCR5380_abort (Scsi_Cmnd *cmd);
#ifndef NCR5380_reset
static
#endif
-int NCR5380_reset(Scsi_Cmnd * cmd, unsigned int reset_flags);
+int NCR5380_reset (Scsi_Cmnd *cmd, unsigned int reset_flags);
#ifndef NCR5380_queue_command
-static
+static
#endif
-int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *));
+int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *));
-static void NCR5380_reselect(struct Scsi_Host *instance);
-static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag);
+static void NCR5380_reselect (struct Scsi_Host *instance);
+static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag);
#if defined(PSEUDO_DMA) || defined(REAL_DMA) || defined(REAL_DMA_POLL)
-static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
+static int NCR5380_transfer_dma (struct Scsi_Host *instance,
+ unsigned char *phase, int *count, unsigned char **data);
#endif
-static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
+static int NCR5380_transfer_pio (struct Scsi_Host *instance,
+ unsigned char *phase, int *count, unsigned char **data);
#if (defined(REAL_DMA) || defined(REAL_DMA_POLL))
#if defined(i386) || defined(__alpha__)
-/**
- * NCR5380_pc_dma_setup - setup ISA DMA
- * @instance: adapter to set up
- * @ptr: block to transfer (virtual address)
- * @count: number of bytes to transfer
- * @mode: DMA controller mode to use
- *
- * Program the DMA controller ready to perform an ISA DMA transfer
- * on this chip.
- *
- * Locks: takes and releases the ISA DMA lock.
- */
-
-static __inline__ int NCR5380_pc_dma_setup(struct Scsi_Host *instance, unsigned char *ptr, unsigned int count, unsigned char mode)
-{
- unsigned limit;
- unsigned long bus_addr = virt_to_bus(ptr);
- unsigned long flags;
-
- if (instance->dma_channel <= 3) {
- if (count > 65536)
- count = 65536;
- limit = 65536 - (bus_addr & 0xFFFF);
- } else {
- if (count > 65536 * 2)
- count = 65536 * 2;
- limit = 65536 * 2 - (bus_addr & 0x1FFFF);
- }
-
- if (count > limit)
- count = limit;
-
- if ((count & 1) || (bus_addr & 1))
- panic("scsi%d : attempted unaligned DMA transfer\n", instance->host_no);
-
- flags=claim_dma_lock();
- disable_dma(instance->dma_channel);
- clear_dma_ff(instance->dma_channel);
- set_dma_addr(instance->dma_channel, bus_addr);
- set_dma_count(instance->dma_channel, count);
- set_dma_mode(instance->dma_channel, mode);
- enable_dma(instance->dma_channel);
- release_dma_lock(flags);
-
- return count;
+static __inline__ int NCR5380_pc_dma_setup (struct Scsi_Host *instance,
+ unsigned char *ptr, unsigned int count, unsigned char mode) {
+ unsigned limit;
+ unsigned long bus_addr = virt_to_bus(ptr);
+
+ if (instance->dma_channel <=3) {
+ if (count > 65536)
+ count = 65536;
+ limit = 65536 - (bus_addr & 0xFFFF);
+ } else {
+ if (count > 65536 * 2)
+ count = 65536 * 2;
+ limit = 65536* 2 - (bus_addr & 0x1FFFF);
+ }
+
+ if (count > limit) count = limit;
+
+ if ((count & 1) || (bus_addr & 1))
+ panic ("scsi%d : attempted unaligned DMA transfer\n", instance->host_no);
+ cli();
+ disable_dma(instance->dma_channel);
+ clear_dma_ff(instance->dma_channel);
+ set_dma_addr(instance->dma_channel, bus_addr);
+ set_dma_count(instance->dma_channel, count);
+ set_dma_mode(instance->dma_channel, mode);
+ enable_dma(instance->dma_channel);
+ sti();
+ return count;
}
-/**
- * NCR5380_pc_dma_write_setup - setup ISA DMA write
- * @instance: adapter to set up
- * @ptr: block to transfer (virtual address)
- * @count: number of bytes to transfer
- *
- * Program the DMA controller ready to perform an ISA DMA write to the
- * SCSI controller.
- *
- * Locks: called routines take and release the ISA DMA lock.
- */
-
-static __inline__ int NCR5380_pc_dma_write_setup(struct Scsi_Host *instance, unsigned char *src, unsigned int count)
-{
- return NCR5380_pc_dma_setup(instance, src, count, DMA_MODE_WRITE);
+static __inline__ int NCR5380_pc_dma_write_setup (struct Scsi_Host *instance,
+ unsigned char *src, unsigned int count) {
+ return NCR5380_pc_dma_setup (instance, src, count, DMA_MODE_WRITE);
}
-/**
- * NCR5380_pc_dma_read_setup - setup ISA DMA read
- * @instance: adapter to set up
- * @ptr: block to transfer (virtual address)
- * @count: number of bytes to transfer
- *
- * Program the DMA controller ready to perform an ISA DMA read from the
- * SCSI controller.
- *
- * Locks: called routines take and release the ISA DMA lock.
- */
-
-static __inline__ int NCR5380_pc_dma_read_setup(struct Scsi_Host *instance, unsigned char *src, unsigned int count)
-{
- return NCR5380_pc_dma_setup(instance, src, count, DMA_MODE_READ);
+static __inline__ int NCR5380_pc_dma_read_setup (struct Scsi_Host *instance,
+ unsigned char *src, unsigned int count) {
+ return NCR5380_pc_dma_setup (instance, src, count, DMA_MODE_READ);
}
-/**
- * NCR5380_pc_dma_residual - return bytes left
- * @instance: adapter
- *
- * Reports the number of bytes left over after the DMA was terminated.
- *
- * Locks: takes and releases the ISA DMA lock.
- */
-
-static __inline__ int NCR5380_pc_dma_residual(struct Scsi_Host *instance)
-{
- unsigned long flags;
- int tmp;
-
- flags = claim_dma_lock();
- clear_dma_ff(instance->dma_channel);
- tmp = get_dma_residue(instance->dma_channel);
- release_dma_lock(flags);
-
- return tmp;
+static __inline__ int NCR5380_pc_dma_residual (struct Scsi_Host *instance) {
+ register int tmp;
+ cli();
+ clear_dma_ff(instance->dma_channel);
+ tmp = get_dma_residue(instance->dma_channel);
+ sti();
+ return tmp;
}
-#endif /* defined(i386) || defined(__alpha__) */
-#endif /* defined(REAL_DMA) */
-#endif /* __KERNEL__ */
-#endif /* ndef ASM */
-#endif /* NCR5380_H */
+#endif /* defined(i386) || defined(__alpha__) */
+#endif /* defined(REAL_DMA) */
+#endif /* __KERNEL__ */
+#endif /* ndef ASM */
+#endif /* NCR5380_H */
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 1fbb5199d..1d15edfbb 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -77,7 +77,7 @@
* IRQ line if overridden on the command line.
*
*/
-
+
/*
* $Log: generic_NCR5380.c,v $
*/
@@ -124,25 +124,24 @@
#include <linux/isapnp.h>
#define NCR_NOT_SET 0
-static int ncr_irq = NCR_NOT_SET;
-static int ncr_dma = NCR_NOT_SET;
-static int ncr_addr = NCR_NOT_SET;
-static int ncr_5380 = NCR_NOT_SET;
-static int ncr_53c400 = NCR_NOT_SET;
-static int ncr_53c400a = NCR_NOT_SET;
-static int dtc_3181e = NCR_NOT_SET;
+static int ncr_irq=NCR_NOT_SET;
+static int ncr_dma=NCR_NOT_SET;
+static int ncr_addr=NCR_NOT_SET;
+static int ncr_5380=NCR_NOT_SET;
+static int ncr_53c400=NCR_NOT_SET;
+static int ncr_53c400a=NCR_NOT_SET;
+static int dtc_3181e=NCR_NOT_SET;
static struct override {
NCR5380_implementation_fields;
- int irq;
- int dma;
- int board; /* Use NCR53c400, Ricoh, etc. extensions ? */
-} overrides
-#ifdef GENERIC_NCR5380_OVERRIDE
-[] __initdata = GENERIC_NCR5380_OVERRIDE;
+ int irq;
+ int dma;
+ int board; /* Use NCR53c400, Ricoh, etc. extensions ? */
+} overrides
+#ifdef GENERIC_NCR5380_OVERRIDE
+ [] __initdata = GENERIC_NCR5380_OVERRIDE;
#else
-[1] __initdata = { {
-0,},};
+ [1] __initdata = {{0,},};
#endif
#define NO_OVERRIDES (sizeof(overrides) / sizeof(struct override))
@@ -158,46 +157,45 @@ static struct override {
*
*/
-static void __init internal_setup(int board, char *str, int *ints)
-{
- static int commandline_current = 0;
- switch (board) {
- case BOARD_NCR5380:
- if (ints[0] != 2 && ints[0] != 3) {
- printk("generic_NCR5380_setup : usage ncr5380=" STRVAL(NCR5380_map_name) ",irq,dma\n");
- return;
- }
- break;
- case BOARD_NCR53C400:
- if (ints[0] != 2) {
- printk("generic_NCR53C400_setup : usage ncr53c400=" STRVAL(NCR5380_map_name) ",irq\n");
- return;
- }
- break;
- case BOARD_NCR53C400A:
- if (ints[0] != 2) {
- printk("generic_NCR53C400A_setup : usage ncr53c400a=" STRVAL(NCR5380_map_name) ",irq\n");
- return;
- }
- break;
- case BOARD_DTC3181E:
- if (ints[0] != 2) {
- printk("generic_DTC3181E_setup : usage dtc3181e=" STRVAL(NCR5380_map_name) ",irq\n");
- return;
- }
- break;
+static void __init internal_setup(int board, char *str, int *ints){
+ static int commandline_current = 0;
+ switch (board) {
+ case BOARD_NCR5380:
+ if (ints[0] != 2 && ints[0] != 3) {
+ printk("generic_NCR5380_setup : usage ncr5380=" STRVAL(NCR5380_map_name) ",irq,dma\n");
+ return;
}
-
- if (commandline_current < NO_OVERRIDES) {
- overrides[commandline_current].NCR5380_map_name = (NCR5380_map_type) ints[1];
- overrides[commandline_current].irq = ints[2];
- if (ints[0] == 3)
- overrides[commandline_current].dma = ints[3];
- else
- overrides[commandline_current].dma = DMA_NONE;
- overrides[commandline_current].board = board;
- ++commandline_current;
+ break;
+ case BOARD_NCR53C400:
+ if (ints[0] != 2) {
+ printk("generic_NCR53C400_setup : usage ncr53c400=" STRVAL(NCR5380_map_name) ",irq\n");
+ return;
+ }
+ break;
+ case BOARD_NCR53C400A:
+ if (ints[0] != 2) {
+ printk("generic_NCR53C400A_setup : usage ncr53c400a=" STRVAL(NCR5380_map_name) ",irq\n");
+ return;
}
+ break;
+ case BOARD_DTC3181E:
+ if (ints[0] != 2) {
+ printk("generic_DTC3181E_setup : usage dtc3181e=" STRVAL(NCR5380_map_name) ",irq\n");
+ return;
+ }
+ break;
+ }
+
+ if (commandline_current < NO_OVERRIDES) {
+ overrides[commandline_current].NCR5380_map_name = (NCR5380_map_type)ints[1];
+ overrides[commandline_current].irq = ints[2];
+ if (ints[0] == 3)
+ overrides[commandline_current].dma = ints[3];
+ else
+ overrides[commandline_current].dma = DMA_NONE;
+ overrides[commandline_current].board = board;
+ ++commandline_current;
+ }
}
/*
@@ -209,9 +207,8 @@ static void __init internal_setup(int board, char *str, int *ints)
* equal to the number of ints.
*/
-void __init generic_NCR5380_setup(char *str, int *ints)
-{
- internal_setup(BOARD_NCR5380, str, ints);
+void __init generic_NCR5380_setup (char *str, int *ints){
+ internal_setup (BOARD_NCR5380, str, ints);
}
/*
@@ -223,9 +220,8 @@ void __init generic_NCR5380_setup(char *str, int *ints)
* equal to the number of ints.
*/
-void __init generic_NCR53C400_setup(char *str, int *ints)
-{
- internal_setup(BOARD_NCR53C400, str, ints);
+void __init generic_NCR53C400_setup (char *str, int *ints){
+ internal_setup (BOARD_NCR53C400, str, ints);
}
/*
@@ -237,9 +233,8 @@ void __init generic_NCR53C400_setup(char *str, int *ints)
* equal to the number of ints.
*/
-void generic_NCR53C400A_setup(char *str, int *ints)
-{
- internal_setup(BOARD_NCR53C400A, str, ints);
+void generic_NCR53C400A_setup (char *str, int *ints) {
+ internal_setup (BOARD_NCR53C400A, str, ints);
}
/*
@@ -251,9 +246,8 @@ void generic_NCR53C400A_setup(char *str, int *ints)
* equal to the number of ints.
*/
-void generic_DTC3181E_setup(char *str, int *ints)
-{
- internal_setup(BOARD_DTC3181E, str, ints);
+void generic_DTC3181E_setup (char *str, int *ints) {
+ internal_setup (BOARD_DTC3181E, str, ints);
}
/*
@@ -268,197 +262,202 @@ void generic_DTC3181E_setup(char *str, int *ints)
*
*/
-int __init generic_NCR5380_detect(Scsi_Host_Template * tpnt)
-{
- static int current_override = 0;
- int count, i;
- u_int *ports;
- u_int ncr_53c400a_ports[] = { 0x280, 0x290, 0x300, 0x310, 0x330,
- 0x340, 0x348, 0x350, 0
- };
- u_int dtc_3181e_ports[] = { 0x220, 0x240, 0x280, 0x2a0, 0x2c0,
- 0x300, 0x320, 0x340, 0
- };
- int flags = 0;
- struct Scsi_Host *instance;
-
- if (ncr_irq != NCR_NOT_SET)
- overrides[0].irq = ncr_irq;
- if (ncr_dma != NCR_NOT_SET)
- overrides[0].dma = ncr_dma;
- if (ncr_addr != NCR_NOT_SET)
- overrides[0].NCR5380_map_name = (NCR5380_map_type) ncr_addr;
- if (ncr_5380 != NCR_NOT_SET)
- overrides[0].board = BOARD_NCR5380;
- else if (ncr_53c400 != NCR_NOT_SET)
- overrides[0].board = BOARD_NCR53C400;
- else if (ncr_53c400a != NCR_NOT_SET)
- overrides[0].board = BOARD_NCR53C400A;
- else if (dtc_3181e != NCR_NOT_SET)
- overrides[0].board = BOARD_DTC3181E;
-
- if (!current_override && isapnp_present()) {
- struct pci_dev *dev = NULL;
- count = 0;
- while ((dev = isapnp_find_dev(NULL, ISAPNP_VENDOR('D', 'T', 'C'), ISAPNP_FUNCTION(0x436e), dev))) {
- if (count >= NO_OVERRIDES)
- break;
- if (!dev->active && dev->prepare(dev) < 0) {
- printk(KERN_ERR "dtc436e probe: prepare failed\n");
- continue;
- }
- if (!(dev->resource[0].flags & IORESOURCE_IO))
- continue;
- if (!dev->active && dev->activate(dev) < 0) {
- printk(KERN_ERR "dtc436e probe: activate failed\n");
- continue;
- }
- if (dev->irq_resource[0].flags & IORESOURCE_IRQ)
- overrides[count].irq = dev->irq_resource[0].start;
- else
- overrides[count].irq = IRQ_NONE;
- if (dev->dma_resource[0].flags & IORESOURCE_DMA)
- overrides[count].dma = dev->dma_resource[0].start;
- else
- overrides[count].dma = DMA_NONE;
- overrides[count].NCR5380_map_name = (NCR5380_map_type) dev->resource[0].start;
- overrides[count].board = BOARD_DTC3181E;
- count++;
- }
+int __init generic_NCR5380_detect(Scsi_Host_Template * tpnt){
+ static int current_override = 0;
+ int count, i;
+ u_int *ports;
+ u_int ncr_53c400a_ports[] = {0x280, 0x290, 0x300, 0x310, 0x330,
+ 0x340, 0x348, 0x350, 0};
+ u_int dtc_3181e_ports[] = {0x220, 0x240, 0x280, 0x2a0, 0x2c0,
+ 0x300, 0x320, 0x340, 0};
+ int flags = 0;
+ struct Scsi_Host *instance;
+
+ if (ncr_irq != NCR_NOT_SET)
+ overrides[0].irq=ncr_irq;
+ if (ncr_dma != NCR_NOT_SET)
+ overrides[0].dma=ncr_dma;
+ if (ncr_addr != NCR_NOT_SET)
+ overrides[0].NCR5380_map_name=(NCR5380_map_type)ncr_addr;
+ if (ncr_5380 != NCR_NOT_SET)
+ overrides[0].board=BOARD_NCR5380;
+ else if (ncr_53c400 != NCR_NOT_SET)
+ overrides[0].board=BOARD_NCR53C400;
+ else if (ncr_53c400a != NCR_NOT_SET)
+ overrides[0].board=BOARD_NCR53C400A;
+ else if (dtc_3181e != NCR_NOT_SET)
+ overrides[0].board=BOARD_DTC3181E;
+
+ if (!current_override && isapnp_present()) {
+ struct pci_dev *dev = NULL;
+ count = 0;
+ while ((dev = isapnp_find_dev(NULL, ISAPNP_VENDOR('D','T','C'), ISAPNP_FUNCTION(0x436e), dev))) {
+ if (count >= NO_OVERRIDES)
+ break;
+ if (!dev->active && dev->prepare(dev) < 0) {
+ printk(KERN_ERR "dtc436e probe: prepare failed\n");
+ continue;
+ }
+ if (!(dev->resource[0].flags & IORESOURCE_IO))
+ continue;
+ if (!dev->active && dev->activate(dev) < 0) {
+ printk(KERN_ERR "dtc436e probe: activate failed\n");
+ continue;
+ }
+ if (dev->irq_resource[0].flags & IORESOURCE_IRQ)
+ overrides[count].irq=dev->irq_resource[0].start;
+ else
+ overrides[count].irq=IRQ_NONE;
+ if (dev->dma_resource[0].flags & IORESOURCE_DMA)
+ overrides[count].dma=dev->dma_resource[0].start;
+ else
+ overrides[count].dma=DMA_NONE;
+ overrides[count].NCR5380_map_name=(NCR5380_map_type)dev->resource[0].start;
+ overrides[count].board=BOARD_DTC3181E;
+ count++;
+ }
+ }
+
+ tpnt->proc_name = "g_NCR5380";
+
+ for (count = 0; current_override < NO_OVERRIDES; ++current_override) {
+ if (!(overrides[current_override].NCR5380_map_name))
+ continue;
+
+ ports = 0;
+ switch (overrides[current_override].board) {
+ case BOARD_NCR5380:
+ flags = FLAG_NO_PSEUDO_DMA;
+ break;
+ case BOARD_NCR53C400:
+ flags = FLAG_NCR53C400;
+ break;
+ case BOARD_NCR53C400A:
+ flags = FLAG_NO_PSEUDO_DMA;
+ ports = ncr_53c400a_ports;
+ break;
+ case BOARD_DTC3181E:
+ flags = FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E;
+ ports = dtc_3181e_ports;
+ break;
}
- tpnt->proc_name = "g_NCR5380";
-
- for (count = 0; current_override < NO_OVERRIDES; ++current_override) {
- if (!(overrides[current_override].NCR5380_map_name))
- continue;
-
- ports = 0;
- switch (overrides[current_override].board) {
- case BOARD_NCR5380:
- flags = FLAG_NO_PSEUDO_DMA;
- break;
- case BOARD_NCR53C400:
- flags = FLAG_NCR53C400;
- break;
- case BOARD_NCR53C400A:
- flags = FLAG_NO_PSEUDO_DMA;
- ports = ncr_53c400a_ports;
- break;
- case BOARD_DTC3181E:
- flags = FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E;
- ports = dtc_3181e_ports;
- break;
- }
-
#ifdef CONFIG_SCSI_G_NCR5380_PORT
- if (ports) {
- /* wakeup sequence for the NCR53C400A and DTC3181E */
-
- /* Disable the adapter and look for a free io port */
- outb(0x59, 0x779);
- outb(0xb9, 0x379);
- outb(0xc5, 0x379);
- outb(0xae, 0x379);
- outb(0xa6, 0x379);
- outb(0x00, 0x379);
-
- if (overrides[current_override].NCR5380_map_name != PORT_AUTO)
- for (i = 0; ports[i]; i++) {
- if (overrides[current_override].NCR5380_map_name == ports[i])
- break;
- } else
- for (i = 0; ports[i]; i++) {
- if ((!check_region(ports[i], 16)) && (inb(ports[i]) == 0xff))
- break;
- }
- if (ports[i]) {
- outb(0x59, 0x779);
- outb(0xb9, 0x379);
- outb(0xc5, 0x379);
- outb(0xae, 0x379);
- outb(0xa6, 0x379);
- outb(0x80 | i, 0x379); /* set io port to be used */
- outb(0xc0, ports[i] + 9);
- if (inb(ports[i] + 9) != 0x80)
- continue;
- else
- overrides[current_override].NCR5380_map_name = ports[i];
- } else
- continue;
+ if (ports) {
+ /* wakeup sequence for the NCR53C400A and DTC3181E*/
+
+ /* Disable the adapter and look for a free io port */
+ outb(0x59, 0x779);
+ outb(0xb9, 0x379);
+ outb(0xc5, 0x379);
+ outb(0xae, 0x379);
+ outb(0xa6, 0x379);
+ outb(0x00, 0x379);
+
+ if (overrides[current_override].NCR5380_map_name != PORT_AUTO)
+ for(i=0; ports[i]; i++) {
+ if (overrides[current_override].NCR5380_map_name == ports[i])
+ break;
+ }
+ else
+ for(i=0; ports[i]; i++) {
+ if ((!check_region(ports[i], 16)) && (inb(ports[i]) == 0xff))
+ break;
}
+ if (ports[i]) {
+ outb(0x59, 0x779);
+ outb(0xb9, 0x379);
+ outb(0xc5, 0x379);
+ outb(0xae, 0x379);
+ outb(0xa6, 0x379);
+ outb(0x80 | i, 0x379); /* set io port to be used */
+ outb(0xc0, ports[i] + 9);
+ if (inb(ports[i] + 9) != 0x80)
+ continue;
+ else
+ overrides[current_override].NCR5380_map_name=ports[i];
+ } else
+ continue;
+ }
- request_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size, "ncr5380");
+ request_region(overrides[current_override].NCR5380_map_name,
+ NCR5380_region_size, "ncr5380");
#else
- if (check_mem_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size))
- continue;
- request_mem_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size, "ncr5380");
-#endif
- instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata));
- if (instance == NULL) {
+ if(check_mem_region(overrides[current_override].NCR5380_map_name,
+ NCR5380_region_size))
+ continue;
+ request_mem_region(overrides[current_override].NCR5380_map_name,
+ NCR5380_region_size, "ncr5380");
+#endif
+ instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata));
+ if(instance == NULL)
+ {
#ifdef CONFIG_SCSI_G_NCR5380_PORT
- release_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size);
+ release_region(overrides[current_override].NCR5380_map_name,
+ NCR5380_region_size);
#else
- release_mem_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size);
+ release_mem_region(overrides[current_override].NCR5380_map_name,
+ NCR5380_region_size);
#endif
- continue;
- }
-
- instance->NCR5380_instance_name = overrides[current_override].NCR5380_map_name;
-
- NCR5380_init(instance, flags);
-
- if (overrides[current_override].irq != IRQ_AUTO)
- instance->irq = overrides[current_override].irq;
- else
- instance->irq = NCR5380_probe_irq(instance, 0xffff);
-
- if (instance->irq != IRQ_NONE)
- if (request_irq(instance->irq, do_generic_NCR5380_intr, SA_INTERRUPT, "NCR5380", NULL)) {
- printk("scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq);
- instance->irq = IRQ_NONE;
- }
-
- if (instance->irq == IRQ_NONE) {
- printk("scsi%d : interrupts not enabled. for better interactive performance,\n", instance->host_no);
- printk("scsi%d : please jumper the board for a free IRQ.\n", instance->host_no);
- }
-
- printk("scsi%d : at " STRVAL(NCR5380_map_name) " 0x%x", instance->host_no, (unsigned int) instance->NCR5380_instance_name);
- if (instance->irq == IRQ_NONE)
- printk(" interrupts disabled");
- else
- printk(" irq %d", instance->irq);
- printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d", CAN_QUEUE, CMD_PER_LUN, GENERIC_NCR5380_PUBLIC_RELEASE);
- NCR5380_print_options(instance);
- printk("\n");
-
- ++current_override;
- ++count;
+ continue;
+ }
+
+ instance->NCR5380_instance_name = overrides[current_override].NCR5380_map_name;
+
+ NCR5380_init(instance, flags);
+
+ if (overrides[current_override].irq != IRQ_AUTO)
+ instance->irq = overrides[current_override].irq;
+ else
+ instance->irq = NCR5380_probe_irq(instance, 0xffff);
+
+ if (instance->irq != IRQ_NONE)
+ if (request_irq(instance->irq, do_generic_NCR5380_intr, SA_INTERRUPT, "NCR5380", NULL)) {
+ printk("scsi%d : IRQ%d not free, interrupts disabled\n",
+ instance->host_no, instance->irq);
+ instance->irq = IRQ_NONE;
+ }
+
+ if (instance->irq == IRQ_NONE) {
+ printk("scsi%d : interrupts not enabled. for better interactive performance,\n", instance->host_no);
+ printk("scsi%d : please jumper the board for a free IRQ.\n", instance->host_no);
}
- return count;
+
+ printk("scsi%d : at " STRVAL(NCR5380_map_name) " 0x%x", instance->host_no, (unsigned int)instance->NCR5380_instance_name);
+ if (instance->irq == IRQ_NONE)
+ printk (" interrupts disabled");
+ else
+ printk (" irq %d", instance->irq);
+ printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d",
+ CAN_QUEUE, CMD_PER_LUN, GENERIC_NCR5380_PUBLIC_RELEASE);
+ NCR5380_print_options(instance);
+ printk("\n");
+
+ ++current_override;
+ ++count;
+ }
+ return count;
}
-const char *generic_NCR5380_info(struct Scsi_Host *host)
-{
- static const char string[] = "Generic NCR5380/53C400 Driver";
- return string;
+const char * generic_NCR5380_info (struct Scsi_Host* host) {
+ static const char string[]="Generic NCR5380/53C400 Driver";
+ return string;
}
-int generic_NCR5380_release_resources(struct Scsi_Host *instance)
+int generic_NCR5380_release_resources(struct Scsi_Host * instance)
{
- NCR5380_local_declare();
+ NCR5380_local_declare();
- NCR5380_setup(instance);
+ NCR5380_setup(instance);
#ifdef CONFIG_SCSI_G_NCR5380_PORT
- release_region(instance->NCR5380_instance_name, NCR5380_region_size);
+ release_region(instance->NCR5380_instance_name, NCR5380_region_size);
#else
- release_mem_region(instance->NCR5380_instance_name, NCR5380_region_size);
-#endif
+ release_mem_region(instance->NCR5380_instance_name, NCR5380_region_size);
+#endif
- if (instance->irq != IRQ_NONE)
- free_irq(instance->irq, NULL);
+ if (instance->irq != IRQ_NONE)
+ free_irq(instance->irq, NULL);
return 0;
}
@@ -486,109 +485,112 @@ int generic_NCR5380_release_resources(struct Scsi_Host *instance)
int generic_NCR5380_biosparam(Disk * disk, kdev_t dev, int *ip)
{
- int size = disk->capacity;
- ip[0] = 64;
- ip[1] = 32;
- ip[2] = size >> 11;
- return 0;
+ int size = disk->capacity;
+ ip[0] = 64;
+ ip[1] = 32;
+ ip[2] = size >> 11;
+ return 0;
}
#endif
#if NCR53C400_PSEUDO_DMA
-static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len)
+static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst, int len)
{
- int blocks = len / 128;
- int start = 0;
- int bl;
+ int blocks = len / 128;
+ int start = 0;
+ int bl;
#ifdef CONFIG_SCSI_G_NCR5380_PORT
- int i;
-#endif
+ int i;
+#endif
- NCR5380_local_declare();
+ NCR5380_local_declare();
- NCR5380_setup(instance);
+ NCR5380_setup(instance);
#if (NDEBUG & NDEBUG_C400_PREAD)
- printk("53C400r: About to read %d blocks for %d bytes\n", blocks, len);
+ printk("53C400r: About to read %d blocks for %d bytes\n", blocks, len);
#endif
- NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE | CSR_TRANS_DIR);
- NCR5380_write(C400_BLOCK_COUNTER_REG, blocks);
- while (1) {
-
+ NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE | CSR_TRANS_DIR);
+ NCR5380_write(C400_BLOCK_COUNTER_REG, blocks);
+ while (1) {
+
#if (NDEBUG & NDEBUG_C400_PREAD)
- printk("53C400r: %d blocks left\n", blocks);
+ printk("53C400r: %d blocks left\n", blocks);
#endif
- if ((bl = NCR5380_read(C400_BLOCK_COUNTER_REG)) == 0) {
+ if ((bl=NCR5380_read(C400_BLOCK_COUNTER_REG)) == 0) {
#if (NDEBUG & NDEBUG_C400_PREAD)
- if (blocks)
- printk("53C400r: blocks still == %d\n", blocks);
- else
- printk("53C400r: Exiting loop\n");
+ if (blocks)
+ printk("53C400r: blocks still == %d\n", blocks);
+ else
+ printk("53C400r: Exiting loop\n");
#endif
- break;
- }
+ break;
+ }
+
#if 1
- if (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ) {
- printk("53C400r: Got 53C80_IRQ start=%d, blocks=%d\n", start, blocks);
- return -1;
- }
+ if (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ) {
+ printk("53C400r: Got 53C80_IRQ start=%d, blocks=%d\n", start, blocks);
+ return -1;
+ }
#endif
#if (NDEBUG & NDEBUG_C400_PREAD)
- printk("53C400r: Waiting for buffer, bl=%d\n", bl);
+ printk("53C400r: Waiting for buffer, bl=%d\n", bl);
#endif
- while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY);
+ while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
+ ;
#if (NDEBUG & NDEBUG_C400_PREAD)
- printk("53C400r: Transferring 128 bytes\n");
+ printk("53C400r: Transferring 128 bytes\n");
#endif
#ifdef CONFIG_SCSI_G_NCR5380_PORT
- for (i = 0; i < 128; i++)
- dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
+ for (i=0; i<128; i++)
+ dst[start+i] = NCR5380_read(C400_HOST_BUFFER);
#else
- /* implies CONFIG_SCSI_G_NCR5380_MEM */
- isa_memcpy_fromio(dst + start, NCR53C400_host_buffer + NCR5380_map_name, 128);
+ /* implies CONFIG_SCSI_G_NCR5380_MEM */
+ isa_memcpy_fromio(dst+start,NCR53C400_host_buffer+NCR5380_map_name,128);
#endif
- start += 128;
- blocks--;
- }
+ start+=128;
+ blocks--;
+ }
- if (blocks) {
+ if (blocks) {
#if (NDEBUG & NDEBUG_C400_PREAD)
- printk("53C400r: EXTRA: Waiting for buffer\n");
+ printk("53C400r: EXTRA: Waiting for buffer\n");
#endif
- while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY);
+ while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
+ ;
#if (NDEBUG & NDEBUG_C400_PREAD)
- printk("53C400r: Transferring EXTRA 128 bytes\n");
+ printk("53C400r: Transferring EXTRA 128 bytes\n");
#endif
#ifdef CONFIG_SCSI_G_NCR5380_PORT
- for (i = 0; i < 128; i++)
- dst[start + i] = NCR5380_read(C400_HOST_BUFFER);
+ for (i=0; i<128; i++)
+ dst[start+i] = NCR5380_read(C400_HOST_BUFFER);
#else
- /* implies CONFIG_SCSI_G_NCR5380_MEM */
- isa_memcpy_fromio(dst + start, NCR53C400_host_buffer + NCR5380_map_name, 128);
+ /* implies CONFIG_SCSI_G_NCR5380_MEM */
+ isa_memcpy_fromio(dst+start,NCR53C400_host_buffer+NCR5380_map_name,128);
#endif
- start += 128;
- blocks--;
- }
+ start+=128;
+ blocks--;
+ }
#if (NDEBUG & NDEBUG_C400_PREAD)
- else
- printk("53C400r: No EXTRA required\n");
+ else
+ printk("53C400r: No EXTRA required\n");
#endif
#if (NDEBUG & NDEBUG_C400_PREAD)
- printk("53C400r: Final values: blocks=%d start=%d\n", blocks, start);
+ printk("53C400r: Final values: blocks=%d start=%d\n", blocks, start);
#endif
- if (!(NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ))
- printk("53C400r: no 53C80 gated irq after transfer");
+ if (!(NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ))
+ printk("53C400r: no 53C80 gated irq after transfer");
#if (NDEBUG & NDEBUG_C400_PREAD)
- else
- printk("53C400r: Got 53C80 interrupt and tried to clear it\n");
+ else
+ printk("53C400r: Got 53C80 interrupt and tried to clear it\n");
#endif
/* DON'T DO THIS - THEY NEVER ARRIVE!
@@ -597,287 +599,299 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
;
*/
- if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_END_DMA_TRANSFER))
- printk("53C400r: no end dma signal\n");
+ if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_END_DMA_TRANSFER))
+ printk("53C400r: no end dma signal\n");
#if (NDEBUG & NDEBUG_C400_PREAD)
- else
- printk("53C400r: end dma as expected\n");
+ else
+ printk("53C400r: end dma as expected\n");
#endif
- NCR5380_write(MODE_REG, MR_BASE);
- NCR5380_read(RESET_PARITY_INTERRUPT_REG);
- return 0;
+ NCR5380_write(MODE_REG, MR_BASE);
+ NCR5380_read(RESET_PARITY_INTERRUPT_REG);
+ return 0;
}
-
-static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len)
+
+static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src, int len)
{
- int blocks = len / 128;
- int start = 0;
- int i;
- int bl;
- NCR5380_local_declare();
+ int blocks = len / 128;
+ int start = 0;
+ int i;
+ int bl;
+ NCR5380_local_declare();
- NCR5380_setup(instance);
+ NCR5380_setup(instance);
#if (NDEBUG & NDEBUG_C400_PWRITE)
- printk("53C400w: About to write %d blocks for %d bytes\n", blocks, len);
+ printk("53C400w: About to write %d blocks for %d bytes\n", blocks, len);
#endif
- NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
- NCR5380_write(C400_BLOCK_COUNTER_REG, blocks);
- while (1) {
- if (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ) {
- printk("53C400w: Got 53C80_IRQ start=%d, blocks=%d\n", start, blocks);
- return -1;
- }
+ NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
+ NCR5380_write(C400_BLOCK_COUNTER_REG, blocks);
+ while (1) {
+ if (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ) {
+ printk("53C400w: Got 53C80_IRQ start=%d, blocks=%d\n", start, blocks);
+ return -1;
+ }
- if ((bl = NCR5380_read(C400_BLOCK_COUNTER_REG)) == 0) {
+ if ((bl=NCR5380_read(C400_BLOCK_COUNTER_REG)) == 0) {
#if (NDEBUG & NDEBUG_C400_PWRITE)
- if (blocks)
- printk("53C400w: exiting loop, blocks still == %d\n", blocks);
- else
- printk("53C400w: exiting loop\n");
+ if (blocks)
+ printk("53C400w: exiting loop, blocks still == %d\n", blocks);
+ else
+ printk("53C400w: exiting loop\n");
#endif
- break;
- }
+ break;
+ }
+
#if (NDEBUG & NDEBUG_C400_PWRITE)
- printk("53C400w: %d blocks left\n", blocks);
+ printk("53C400w: %d blocks left\n", blocks);
- printk("53C400w: waiting for buffer, bl=%d\n", bl);
+ printk("53C400w: waiting for buffer, bl=%d\n", bl);
#endif
- while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY);
+ while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
+ ;
#if (NDEBUG & NDEBUG_C400_PWRITE)
- printk("53C400w: transferring 128 bytes\n");
+ printk("53C400w: transferring 128 bytes\n");
#endif
#ifdef CONFIG_SCSI_G_NCR5380_PORT
- for (i = 0; i < 128; i++)
- NCR5380_write(C400_HOST_BUFFER, src[start + i]);
+ for (i=0; i<128; i++)
+ NCR5380_write(C400_HOST_BUFFER, src[start+i]);
#else
- /* implies CONFIG_SCSI_G_NCR5380_MEM */
- isa_memcpy_toio(NCR53C400_host_buffer + NCR5380_map_name, src + start, 128);
+ /* implies CONFIG_SCSI_G_NCR5380_MEM */
+ isa_memcpy_toio(NCR53C400_host_buffer+NCR5380_map_name,src+start,128);
#endif
- start += 128;
- blocks--;
- }
- if (blocks) {
+ start+=128;
+ blocks--;
+ }
+ if (blocks) {
#if (NDEBUG & NDEBUG_C400_PWRITE)
- printk("53C400w: EXTRA waiting for buffer\n");
+ printk("53C400w: EXTRA waiting for buffer\n");
#endif
- while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY);
+ while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
+ ;
#if (NDEBUG & NDEBUG_C400_PWRITE)
- printk("53C400w: transferring EXTRA 128 bytes\n");
+ printk("53C400w: transferring EXTRA 128 bytes\n");
#endif
#ifdef CONFIG_SCSI_G_NCR5380_PORT
- for (i = 0; i < 128; i++)
- NCR5380_write(C400_HOST_BUFFER, src[start + i]);
+ for (i=0; i<128; i++)
+ NCR5380_write(C400_HOST_BUFFER, src[start+i]);
#else
- /* implies CONFIG_SCSI_G_NCR5380_MEM */
- isa_memcpy_toio(NCR53C400_host_buffer + NCR5380_map_name, src + start, 128);
+ /* implies CONFIG_SCSI_G_NCR5380_MEM */
+ isa_memcpy_toio(NCR53C400_host_buffer+NCR5380_map_name,src+start,128);
#endif
- start += 128;
- blocks--;
- }
+ start+=128;
+ blocks--;
+ }
#if (NDEBUG & NDEBUG_C400_PWRITE)
- else
- printk("53C400w: No EXTRA required\n");
+ else
+ printk("53C400w: No EXTRA required\n");
#endif
-
+
#if (NDEBUG & NDEBUG_C400_PWRITE)
- printk("53C400w: Final values: blocks=%d start=%d\n", blocks, start);
+ printk("53C400w: Final values: blocks=%d start=%d\n", blocks, start);
#endif
#if 0
- printk("53C400w: waiting for registers to be available\n");
- THEY NEVER DO ! while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_53C80_REG);
- printk("53C400w: Got em\n");
-#endif
-
- /* Let's wait for this instead - could be ugly */
- /* All documentation says to check for this. Maybe my hardware is too
- * fast. Waiting for it seems to work fine! KLL
- */
- while (!(i = NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ));
-
- /*
- * I know. i is certainly != 0 here but the loop is new. See previous
- * comment.
- */
- if (i) {
+ printk("53C400w: waiting for registers to be available\n");
+ THEY NEVER DO!
+ while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_53C80_REG)
+ ;
+ printk("53C400w: Got em\n");
+#endif
+
+ /* Let's wait for this instead - could be ugly */
+ /* All documentation says to check for this. Maybe my hardware is too
+ * fast. Waiting for it seems to work fine! KLL
+ */
+ while (!(i = NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_GATED_53C80_IRQ))
+ ;
+
+ /*
+ * I know. i is certainly != 0 here but the loop is new. See previous
+ * comment.
+ */
+ if (i) {
#if (NDEBUG & NDEBUG_C400_PWRITE)
- printk("53C400w: got 53C80 gated irq (last block)\n");
+ printk("53C400w: got 53C80 gated irq (last block)\n");
#endif
- if (!((i = NCR5380_read(BUS_AND_STATUS_REG)) & BASR_END_DMA_TRANSFER))
- printk("53C400w: No END OF DMA bit - WHOOPS! BASR=%0x\n", i);
+ if (!((i=NCR5380_read(BUS_AND_STATUS_REG)) & BASR_END_DMA_TRANSFER))
+ printk("53C400w: No END OF DMA bit - WHOOPS! BASR=%0x\n",i);
#if (NDEBUG & NDEBUG_C400_PWRITE)
- else
- printk("53C400w: Got END OF DMA\n");
+ else
+ printk("53C400w: Got END OF DMA\n");
#endif
- } else
- printk("53C400w: no 53C80 gated irq after transfer (last block)\n");
+ }
+ else
+ printk("53C400w: no 53C80 gated irq after transfer (last block)\n");
#if 0
- if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_END_DMA_TRANSFER)) {
- printk("53C400w: no end dma signal\n");
- }
+ if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_END_DMA_TRANSFER)) {
+ printk("53C400w: no end dma signal\n");
+ }
#endif
#if (NDEBUG & NDEBUG_C400_PWRITE)
- printk("53C400w: waiting for last byte...\n");
+ printk("53C400w: waiting for last byte...\n");
#endif
- while (!(NCR5380_read(TARGET_COMMAND_REG) & TCR_LAST_BYTE_SENT));
+ while (!(NCR5380_read(TARGET_COMMAND_REG) & TCR_LAST_BYTE_SENT))
+ ;
#if (NDEBUG & NDEBUG_C400_PWRITE)
- printk("53C400w: got last byte.\n");
- printk("53C400w: pwrite exiting with status 0, whoopee!\n");
+ printk("53C400w: got last byte.\n");
+ printk("53C400w: pwrite exiting with status 0, whoopee!\n");
#endif
- return 0;
+ return 0;
}
-#endif /* PSEUDO_DMA */
+#endif /* PSEUDO_DMA */
#include "NCR5380.c"
#define PRINTP(x) len += sprintf(buffer+len, x)
#define ANDP ,
-static int sprint_opcode(char *buffer, int len, int opcode)
-{
- int start = len;
- PRINTP("0x%02x " ANDP opcode);
- return len - start;
+static int sprint_opcode(char* buffer, int len, int opcode) {
+ int start = len;
+ PRINTP("0x%02x " ANDP opcode);
+ return len-start;
}
-static int sprint_command(char *buffer, int len, unsigned char *command)
-{
- int i, s, start = len;
- len += sprint_opcode(buffer, len, command[0]);
- for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
- PRINTP("%02x " ANDP command[i]);
- PRINTP("\n");
- return len - start;
+static int sprint_command (char* buffer, int len, unsigned char *command) {
+ int i,s,start=len;
+ len += sprint_opcode(buffer, len, command[0]);
+ for ( i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
+ PRINTP("%02x " ANDP command[i]);
+ PRINTP("\n");
+ return len-start;
}
-static int sprint_Scsi_Cmnd(char *buffer, int len, Scsi_Cmnd * cmd)
-{
- int start = len;
- PRINTP("host number %d destination target %d, lun %d\n" ANDP cmd->host->host_no ANDP cmd->target ANDP cmd->lun);
- PRINTP(" command = ");
- len += sprint_command(buffer, len, cmd->cmnd);
- return len - start;
+static int sprint_Scsi_Cmnd (char* buffer, int len, Scsi_Cmnd *cmd) {
+ int start = len;
+ PRINTP("host number %d destination target %d, lun %d\n" ANDP
+ cmd->host->host_no ANDP
+ cmd->target ANDP
+ cmd->lun);
+ PRINTP(" command = ");
+ len += sprint_command (buffer, len, cmd->cmnd);
+ return len-start;
}
-int generic_NCR5380_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout)
+int generic_NCR5380_proc_info(char* buffer, char** start, off_t offset, int length, int hostno, int inout)
{
- int len = 0;
- NCR5380_local_declare();
- unsigned long flags;
- unsigned char status;
- int i;
- struct Scsi_Host *scsi_ptr;
- Scsi_Cmnd *ptr;
- struct NCR5380_hostdata *hostdata;
+ int len = 0;
+ NCR5380_local_declare();
+ unsigned long flags;
+ unsigned char status;
+ int i;
+ struct Scsi_Host *scsi_ptr;
+ Scsi_Cmnd *ptr;
+ struct NCR5380_hostdata *hostdata;
#ifdef NCR5380_STATS
- Scsi_Device *dev;
- extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
+ Scsi_Device *dev;
+ extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
#endif
- save_flags(flags);
- cli();
+ save_flags(flags);
+ cli();
- for (scsi_ptr = first_instance; scsi_ptr; scsi_ptr = scsi_ptr->next)
- if (scsi_ptr->host_no == hostno)
- break;
- NCR5380_setup(scsi_ptr);
- hostdata = (struct NCR5380_hostdata *) scsi_ptr->hostdata;
+ for (scsi_ptr = first_instance; scsi_ptr; scsi_ptr=scsi_ptr->next)
+ if (scsi_ptr->host_no == hostno)
+ break;
+ NCR5380_setup(scsi_ptr);
+ hostdata = (struct NCR5380_hostdata *)scsi_ptr->hostdata;
- PRINTP("SCSI host number %d : %s\n" ANDP scsi_ptr->host_no ANDP scsi_ptr->hostt->name);
- PRINTP("Generic NCR5380 driver version %d\n" ANDP GENERIC_NCR5380_PUBLIC_RELEASE);
- PRINTP("NCR5380 core version %d\n" ANDP NCR5380_PUBLIC_RELEASE);
+ PRINTP("SCSI host number %d : %s\n" ANDP scsi_ptr->host_no ANDP scsi_ptr->hostt->name);
+ PRINTP("Generic NCR5380 driver version %d\n" ANDP GENERIC_NCR5380_PUBLIC_RELEASE);
+ PRINTP("NCR5380 core version %d\n" ANDP NCR5380_PUBLIC_RELEASE);
#ifdef NCR53C400
- PRINTP("NCR53C400 extension version %d\n" ANDP NCR53C400_PUBLIC_RELEASE);
- PRINTP("NCR53C400 card%s detected\n" ANDP(((struct NCR5380_hostdata *) scsi_ptr->hostdata)->flags & FLAG_NCR53C400) ? "" : " not");
+ PRINTP("NCR53C400 extension version %d\n" ANDP NCR53C400_PUBLIC_RELEASE);
+ PRINTP("NCR53C400 card%s detected\n" ANDP (((struct NCR5380_hostdata *)scsi_ptr->hostdata)->flags & FLAG_NCR53C400)?"":" not");
# if NCR53C400_PSEUDO_DMA
- PRINTP("NCR53C400 pseudo DMA used\n");
+ PRINTP("NCR53C400 pseudo DMA used\n");
# endif
#else
- PRINTP("NO NCR53C400 driver extensions\n");
+ PRINTP("NO NCR53C400 driver extensions\n");
#endif
- PRINTP("Using %s mapping at %s 0x%lx, " ANDP STRVAL(NCR5380_map_config) ANDP STRVAL(NCR5380_map_name) ANDP scsi_ptr->NCR5380_instance_name);
- if (scsi_ptr->irq == IRQ_NONE)
- PRINTP("no interrupt\n");
- else
- PRINTP("on interrupt %d\n" ANDP scsi_ptr->irq);
+ PRINTP("Using %s mapping at %s 0x%lx, " ANDP STRVAL(NCR5380_map_config) ANDP STRVAL(NCR5380_map_name) ANDP scsi_ptr->NCR5380_instance_name);
+ if (scsi_ptr->irq == IRQ_NONE)
+ PRINTP("no interrupt\n");
+ else
+ PRINTP("on interrupt %d\n" ANDP scsi_ptr->irq);
#ifdef NCR5380_STATS
- if (hostdata->connected || hostdata->issue_queue || hostdata->disconnected_queue)
- PRINTP("There are commands pending, transfer rates may be crud\n");
- if (hostdata->pendingr)
- PRINTP(" %d pending reads" ANDP hostdata->pendingr);
- if (hostdata->pendingw)
- PRINTP(" %d pending writes" ANDP hostdata->pendingw);
- if (hostdata->pendingr || hostdata->pendingw)
- PRINTP("\n");
- for (dev = scsi_ptr->host_queue; dev; dev = dev->next) {
- unsigned long br = hostdata->bytes_read[dev->id];
- unsigned long bw = hostdata->bytes_write[dev->id];
- long tr = hostdata->time_read[dev->id] / HZ;
- long tw = hostdata->time_write[dev->id] / HZ;
-
- PRINTP(" T:%d %s " ANDP dev->id ANDP(dev->type < MAX_SCSI_DEVICE_CODE) ? scsi_device_types[(int) dev->type] : "Unknown");
- for (i = 0; i < 8; i++)
- if (dev->vendor[i] >= 0x20)
- *(buffer + (len++)) = dev->vendor[i];
- *(buffer + (len++)) = ' ';
- for (i = 0; i < 16; i++)
- if (dev->model[i] >= 0x20)
- *(buffer + (len++)) = dev->model[i];
- *(buffer + (len++)) = ' ';
- for (i = 0; i < 4; i++)
- if (dev->rev[i] >= 0x20)
- *(buffer + (len++)) = dev->rev[i];
- *(buffer + (len++)) = ' ';
-
- PRINTP("\n%10ld kb read in %5ld secs" ANDP br / 1024 ANDP tr);
- if (tr)
- PRINTP(" @ %5ld bps" ANDP br / tr);
-
- PRINTP("\n%10ld kb written in %5ld secs" ANDP bw / 1024 ANDP tw);
- if (tw)
- PRINTP(" @ %5ld bps" ANDP bw / tw);
- PRINTP("\n");
- }
-#endif
-
- status = NCR5380_read(STATUS_REG);
- if (!(status & SR_REQ))
- PRINTP("REQ not asserted, phase unknown.\n");
- else {
- for (i = 0; (phases[i].value != PHASE_UNKNOWN) && (phases[i].value != (status & PHASE_MASK)); ++i);
- PRINTP("Phase %s\n" ANDP phases[i].name);
- }
-
- if (!hostdata->connected) {
- PRINTP("No currently connected command\n");
- } else {
- len += sprint_Scsi_Cmnd(buffer, len, (Scsi_Cmnd *) hostdata->connected);
- }
-
- PRINTP("issue_queue\n");
-
- for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
- len += sprint_Scsi_Cmnd(buffer, len, ptr);
-
- PRINTP("disconnected_queue\n");
-
- for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
- len += sprint_Scsi_Cmnd(buffer, len, ptr);
-
- *start = buffer + offset;
- len -= offset;
- if (len > length)
- len = length;
- restore_flags(flags);
- return len;
+ if (hostdata->connected || hostdata->issue_queue || hostdata->disconnected_queue)
+ PRINTP("There are commands pending, transfer rates may be crud\n");
+ if (hostdata->pendingr)
+ PRINTP(" %d pending reads" ANDP hostdata->pendingr);
+ if (hostdata->pendingw)
+ PRINTP(" %d pending writes" ANDP hostdata->pendingw);
+ if (hostdata->pendingr || hostdata->pendingw)
+ PRINTP("\n");
+ for (dev = scsi_ptr->host_queue; dev; dev=dev->next) {
+ unsigned long br = hostdata->bytes_read[dev->id];
+ unsigned long bw = hostdata->bytes_write[dev->id];
+ long tr = hostdata->time_read[dev->id] / HZ;
+ long tw = hostdata->time_write[dev->id] / HZ;
+
+ PRINTP(" T:%d %s " ANDP dev->id ANDP (dev->type < MAX_SCSI_DEVICE_CODE) ? scsi_device_types[(int)dev->type] : "Unknown");
+ for (i=0; i<8; i++)
+ if (dev->vendor[i] >= 0x20)
+ *(buffer+(len++)) = dev->vendor[i];
+ *(buffer+(len++)) = ' ';
+ for (i=0; i<16; i++)
+ if (dev->model[i] >= 0x20)
+ *(buffer+(len++)) = dev->model[i];
+ *(buffer+(len++)) = ' ';
+ for (i=0; i<4; i++)
+ if (dev->rev[i] >= 0x20)
+ *(buffer+(len++)) = dev->rev[i];
+ *(buffer+(len++)) = ' ';
+
+ PRINTP("\n%10ld kb read in %5ld secs" ANDP br/1024 ANDP tr);
+ if (tr)
+ PRINTP(" @ %5ld bps" ANDP br / tr);
+
+ PRINTP("\n%10ld kb written in %5ld secs" ANDP bw/1024 ANDP tw);
+ if (tw)
+ PRINTP(" @ %5ld bps" ANDP bw / tw);
+ PRINTP("\n");
+ }
+#endif
+
+ status = NCR5380_read(STATUS_REG);
+ if (!(status & SR_REQ))
+ PRINTP("REQ not asserted, phase unknown.\n");
+ else {
+ for (i = 0; (phases[i].value != PHASE_UNKNOWN) &&
+ (phases[i].value != (status & PHASE_MASK)); ++i)
+ ;
+ PRINTP("Phase %s\n" ANDP phases[i].name);
+ }
+
+ if (!hostdata->connected) {
+ PRINTP("No currently connected command\n");
+ } else {
+ len += sprint_Scsi_Cmnd (buffer, len, (Scsi_Cmnd *) hostdata->connected);
+ }
+
+ PRINTP("issue_queue\n");
+
+ for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr;
+ ptr = (Scsi_Cmnd *) ptr->host_scribble)
+ len += sprint_Scsi_Cmnd (buffer, len, ptr);
+
+ PRINTP("disconnected_queue\n");
+
+ for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr;
+ ptr = (Scsi_Cmnd *) ptr->host_scribble)
+ len += sprint_Scsi_Cmnd (buffer, len, ptr);
+
+ *start = buffer + offset;
+ len -= offset;
+ if (len > length)
+ len = length;
+ restore_flags(flags);
+ return len;
}
#undef PRINTP
@@ -889,7 +903,7 @@ static Scsi_Host_Template driver_template = GENERIC_NCR5380;
#include <linux/module.h>
#include "scsi_module.c"
-#ifdef MODULE
+#ifdef MODULE
MODULE_PARM(ncr_irq, "i");
MODULE_PARM(ncr_dma, "i");
@@ -903,42 +917,42 @@ MODULE_LICENSE("GPL");
static int __init do_NCR5380_setup(char *str)
{
- int ints[10];
+ int ints[10];
- get_options(str, sizeof(ints) / sizeof(int), ints);
- generic_NCR5380_setup(str, ints);
+ get_options(str, sizeof(ints)/sizeof(int), ints);
+ generic_NCR5380_setup(str,ints);
- return 1;
+ return 1;
}
static int __init do_NCR53C400_setup(char *str)
{
- int ints[10];
+ int ints[10];
- get_options(str, sizeof(ints) / sizeof(int), ints);
- generic_NCR53C400_setup(str, ints);
+ get_options(str, sizeof(ints)/sizeof(int), ints);
+ generic_NCR53C400_setup(str,ints);
- return 1;
+ return 1;
}
static int __init do_NCR53C400A_setup(char *str)
{
- int ints[10];
+ int ints[10];
- get_options(str, sizeof(ints) / sizeof(int), ints);
- generic_NCR53C400A_setup(str, ints);
+ get_options(str, sizeof(ints)/sizeof(int), ints);
+ generic_NCR53C400A_setup(str,ints);
- return 1;
+ return 1;
}
static int __init do_DTC3181E_setup(char *str)
{
- int ints[10];
+ int ints[10];
- get_options(str, sizeof(ints) / sizeof(int), ints);
- generic_DTC3181E_setup(str, ints);
+ get_options(str, sizeof(ints)/sizeof(int), ints);
+ generic_DTC3181E_setup(str,ints);
- return 1;
+ return 1;
}
__setup("ncr5380=", do_NCR5380_setup);
@@ -948,9 +962,10 @@ __setup("dtc3181e=", do_DTC3181E_setup);
static struct isapnp_device_id id_table[] __devinitdata = {
{
- ISAPNP_ANY_ID, ISAPNP_ANY_ID,
- ISAPNP_VENDOR('D', 'T', 'C'), ISAPNP_FUNCTION(0x436e),
- 0},
+ ISAPNP_ANY_ID, ISAPNP_ANY_ID,
+ ISAPNP_VENDOR('D','T','C'), ISAPNP_FUNCTION(0x436e),
+ 0
+ },
{0}
};
@@ -959,3 +974,4 @@ MODULE_LICENSE("GPL");
#endif
+
diff --git a/drivers/scsi/g_NCR5380.h b/drivers/scsi/g_NCR5380.h
index 8e7b68128..3ab55b6f7 100644
--- a/drivers/scsi/g_NCR5380.h
+++ b/drivers/scsi/g_NCR5380.h
@@ -47,15 +47,16 @@
int generic_NCR5380_abort(Scsi_Cmnd *);
int generic_NCR5380_detect(Scsi_Host_Template *);
int generic_NCR5380_release_resources(struct Scsi_Host *);
-int generic_NCR5380_queue_command(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
+int generic_NCR5380_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
int generic_NCR5380_reset(Scsi_Cmnd *, unsigned int);
-int notyet_generic_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout);
-const char *generic_NCR5380_info(struct Scsi_Host *);
+int notyet_generic_proc_info (char *buffer ,char **start, off_t offset,
+ int length, int hostno, int inout);
+const char* generic_NCR5380_info(struct Scsi_Host *);
#ifdef BIOSPARAM
int generic_NCR5380_biosparam(Disk *, kdev_t, int *);
#endif
-int generic_NCR5380_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout);
+int generic_NCR5380_proc_info(char* buffer, char** start, off_t offset, int length, int hostno, int inout);
#ifndef NULL
#define NULL 0
@@ -113,7 +114,7 @@ int generic_NCR5380_proc_info(char *buffer, char **start, off_t offset, int leng
#define NCR5380_read(reg) (inb(NCR5380_map_name + (reg)))
#define NCR5380_write(reg, value) (outb((value), (NCR5380_map_name + (reg))))
-#else
+#else
/* therefore CONFIG_SCSI_G_NCR5380_MEM */
#define NCR5380_map_config memory
@@ -163,6 +164,7 @@ int generic_NCR5380_proc_info(char *buffer, char **start, off_t offset, int leng
#define BOARD_NCR53C400A 2
#define BOARD_DTC3181E 3
-#endif /* else def HOSTS_C */
-#endif /* ndef ASM */
-#endif /* GENERIC_NCR5380_H */
+#endif /* else def HOSTS_C */
+#endif /* ndef ASM */
+#endif /* GENERIC_NCR5380_H */
+
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 65b0d3c73..5882c11b1 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -5,7 +5,7 @@
This driver supports the Adaptec AHA-1460, the New Media Bus
Toaster, and the New Media Toast & Jam.
- aha152x_cs.c 1.58 2001/10/13 00:08:51
+ aha152x_cs.c 1.54 2000/06/12 21:27:25
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
@@ -22,8 +22,8 @@
are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
Alternatively, the contents of this file may be used under the
- terms of the GNU General Public License version 2 (the "GPL"), in
- which case the provisions of the GPL are applicable instead of the
+ terms of the GNU General Public License version 2 (the "GPL"), in which
+ case the provisions of the GPL are applicable instead of the
above. If you wish to allow the use of your version of this file
only under the terms of the GPL and not to allow others to use
your version of this file under the MPL, indicate your decision
@@ -57,39 +57,42 @@
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
-/*====================================================================*/
+#ifdef PCMCIA_DEBUG
+static int pc_debug = PCMCIA_DEBUG;
+MODULE_PARM(pc_debug, "i");
+#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
+static char *version =
+"aha152x_cs.c 1.54 2000/06/12 21:27:25 (David Hinds)";
+#else
+#define DEBUG(n, args...)
+#endif
-/* Module parameters */
+/*====================================================================*/
-MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
-MODULE_DESCRIPTION("Adaptec AHA152x-compatible PCMCIA SCSI driver");
-MODULE_LICENSE("Dual MPL/GPL");
+/* Parameters that can be set with 'insmod' */
+/* Bit map of interrupts to choose from */
+static u_int irq_mask = 0xdeb8;
static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
-
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
-INT_MODULE_PARM(irq_mask, 0xdeb8);
-INT_MODULE_PARM(host_id, 7);
-INT_MODULE_PARM(reconnect, 1);
-INT_MODULE_PARM(parity, 1);
-INT_MODULE_PARM(synchronous, 0);
-INT_MODULE_PARM(reset_delay, 100);
-INT_MODULE_PARM(ext_trans, 0);
+/* SCSI bus setup options */
+static int host_id = 7;
+static int reconnect = 1;
+static int parity = 1;
+static int synchronous = 0;
+static int reset_delay = 100;
+static int ext_trans = 0;
-#ifdef AHA152X_DEBUG
-INT_MODULE_PARM(debug, 0);
-#endif
+MODULE_PARM(irq_mask, "i");
+MODULE_PARM(irq_list, "1-4i");
+MODULE_PARM(host_id, "i");
+MODULE_PARM(reconnect, "i");
+MODULE_PARM(parity, "i");
+MODULE_PARM(synchronous, "i");
+MODULE_PARM(reset_delay, "i");
+MODULE_PARM(ext_trans, "i");
-#ifdef PCMCIA_DEBUG
-INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
-#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
-static char *version =
-"aha152x_cs.c 1.58 2001/10/13 00:08:51 (David Hinds)";
-#else
-#define DEBUG(n, args...)
-#endif
+MODULE_LICENSE("Dual MPL/GPL");
/*====================================================================*/
@@ -274,6 +277,7 @@ static void aha152x_config_cs(dev_link_t *link)
release_region(link->io.BasePort1, link->io.NumPorts1);
/* Set configuration options for the aha152x driver */
+ ints[0] = 7;
ints[1] = link->io.BasePort1;
ints[2] = link->irq.AssignedIRQ;
ints[3] = host_id;
@@ -281,13 +285,9 @@ static void aha152x_config_cs(dev_link_t *link)
ints[5] = parity;
ints[6] = synchronous;
ints[7] = reset_delay;
- ints[8] = ext_trans;
-#ifdef AHA152X_DEBUG
- ints[9] = debug;
- ints[0] = 9;
-#else
- ints[0] = 8;
-#endif
+ if (ext_trans) {
+ ints[8] = ext_trans; ints[0] = 8;
+ }
aha152x_setup("PCMCIA setup", ints);
scsi_register_host(&driver_template);
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index a14a17bea..3149c5bb8 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -2,7 +2,7 @@
A driver for Future Domain-compatible PCMCIA SCSI cards
- fdomain_cs.c 1.47 2001/10/13 00:08:52
+ fdomain_cs.c 1.43 2000/06/12 21:27:25
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
@@ -19,8 +19,8 @@
are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
Alternatively, the contents of this file may be used under the
- terms of the GNU General Public License version 2 (the "GPL"), in
- which case the provisions of the GPL are applicable instead of the
+ terms of the GNU General Public License version 2 (the "GPL"), in which
+ case the provisions of the GPL are applicable instead of the
above. If you wish to allow the use of your version of this file
only under the terms of the GPL and not to allow others to use
your version of this file under the MPL, indicate your decision
@@ -54,32 +54,29 @@
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
-/*====================================================================*/
-
-/* Module parameters */
-
-MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
-MODULE_DESCRIPTION("Future Domain PCMCIA SCSI driver");
-MODULE_LICENSE("Dual MPL/GPL");
-
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
-
-/* Bit map of interrupts to choose from */
-INT_MODULE_PARM(irq_mask, 0xdeb8);
-static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
-
#ifdef PCMCIA_DEBUG
-INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
+static int pc_debug = PCMCIA_DEBUG;
+MODULE_PARM(pc_debug, "i");
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
-"fdomain_cs.c 1.47 2001/10/13 00:08:52 (David Hinds)";
+"fdomain_cs.c 1.43 2000/06/12 21:27:25 (David Hinds)";
#else
#define DEBUG(n, args...)
#endif
/*====================================================================*/
+/* Parameters that can be set with 'insmod' */
+
+/* Bit map of interrupts to choose from */
+static u_int irq_mask = 0xdeb8;
+static int irq_list[4] = { -1 };
+
+MODULE_PARM(irq_mask, "i");
+MODULE_PARM(irq_list, "1-4i");
+
+/*====================================================================*/
+
typedef struct scsi_info_t {
dev_link_t link;
int ndev;
@@ -215,7 +212,6 @@ static void fdomain_config(dev_link_t *link)
u_char tuple_data[64];
Scsi_Device *dev;
dev_node_t *node, **tail;
- char str[16];
struct Scsi_Host *host;
DEBUG(0, "fdomain_config(0x%p)\n", link);
@@ -256,8 +252,7 @@ static void fdomain_config(dev_link_t *link)
ints[0] = 2;
ints[1] = link->io.BasePort1;
ints[2] = link->irq.AssignedIRQ;
- sprintf(str, "%d,%d", link->io.BasePort1, link->irq.AssignedIRQ);
- fdomain_setup(str, ints);
+ fdomain_setup("PCMCIA setup", ints);
scsi_register_host(&driver_template);
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index 9ff5d4685..0bfa59d14 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -2,7 +2,7 @@
A driver for the Qlogic SCSI card
- qlogic_cs.c 1.83 2001/10/13 00:08:53
+ qlogic_cs.c 1.79 2000/06/12 21:27:26
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
@@ -19,8 +19,8 @@
are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
Alternatively, the contents of this file may be used under the
- terms of the GNU General Public License version 2 (the "GPL"), in
- which case the provisions of the GPL are applicable instead of the
+ terms of the GNU General Public License version 2 (the "GPL"), in which
+ case the provisions of the GPL are applicable instead of the
above. If you wish to allow the use of your version of this file
only under the terms of the GPL and not to allow others to use
your version of this file under the MPL, indicate your decision
@@ -40,7 +40,6 @@
#include <linux/timer.h>
#include <linux/ioport.h>
#include <asm/io.h>
-#include <asm/byteorder.h>
#include <scsi/scsi.h>
#include <linux/major.h>
#include <linux/blk.h>
@@ -62,32 +61,29 @@
extern void qlogicfas_preset(int port, int irq);
-/*====================================================================*/
-
-/* Module parameters */
-
-MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
-MODULE_DESCRIPTION("Qlogic PCMCIA SCSI driver");
-MODULE_LICENSE("Dual MPL/GPL");
-
-#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
-
-/* Bit map of interrupts to choose from */
-INT_MODULE_PARM(irq_mask, 0xdeb8);
-static int irq_list[4] = { -1 };
-MODULE_PARM(irq_list, "1-4i");
-
#ifdef PCMCIA_DEBUG
-INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
+static int pc_debug = PCMCIA_DEBUG;
+MODULE_PARM(pc_debug, "i");
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version =
-"qlogic_cs.c 1.83 2001/10/13 00:08:53 (David Hinds)";
+"qlogic_cs.c 1.79 2000/06/12 21:27:26 (David Hinds)";
#else
#define DEBUG(n, args...)
#endif
/*====================================================================*/
+/* Parameters that can be set with 'insmod' */
+
+/* Bit map of interrupts to choose from */
+static u_int irq_mask = 0xdeb8;
+static int irq_list[4] = { -1 };
+
+MODULE_PARM(irq_mask, "i");
+MODULE_PARM(irq_list, "1-4i");
+
+/*====================================================================*/
+
typedef struct scsi_info_t {
dev_link_t link;
u_short manf_id;
diff --git a/drivers/sound/Config.in b/drivers/sound/Config.in
index f6ac188c9..f52174182 100644
--- a/drivers/sound/Config.in
+++ b/drivers/sound/Config.in
@@ -40,9 +40,6 @@ dep_tristate ' ESS Technology Solo1' CONFIG_SOUND_ESSSOLO1 $CONFIG_SOUND
dep_tristate ' ESS Maestro, Maestro2, Maestro2E driver' CONFIG_SOUND_MAESTRO $CONFIG_SOUND
dep_tristate ' ESS Maestro3/Allegro driver (EXPERIMENTAL)' CONFIG_SOUND_MAESTRO3 $CONFIG_SOUND $CONFIG_PCI $CONFIG_EXPERIMENTAL
dep_tristate ' Intel ICH (i8xx) audio support' CONFIG_SOUND_ICH $CONFIG_PCI
-if [ "$CONFIG_MIPS_ITE8172" = "y" -o "$CONFIG_MIPS_IVR" = "y" ]; then
- dep_tristate ' IT8172G Sound' CONFIG_SOUND_IT8172 $CONFIG_SOUND
-fi
dep_tristate ' RME Hammerfall (RME96XX) support' CONFIG_SOUND_RME96XX $CONFIG_SOUND $CONFIG_PCI $CONFIG_EXPERIMENTAL
dep_tristate ' S3 SonicVibes' CONFIG_SOUND_SONICVIBES $CONFIG_SOUND
if [ "$CONFIG_VISWS" = "y" ]; then
diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile
index ac7150de1..b9904f7a5 100644
--- a/drivers/sound/Makefile
+++ b/drivers/sound/Makefile
@@ -73,7 +73,6 @@ obj-$(CONFIG_SOUND_EMU10K1) += ac97_codec.o
obj-$(CONFIG_SOUND_RME96XX) += rme96xx.o
obj-$(CONFIG_SOUND_BT878) += btaudio.o
obj-$(CONFIG_SOUND_EMU10K1) += ac97_codec.o
-obj-$(CONFIG_SOUND_IT8172) += ite8172.o ac97_codec.o
ifeq ($(CONFIG_MIDI_EMU10K1),y)
obj-$(CONFIG_SOUND_EMU10K1) += sound.o
diff --git a/drivers/sound/btaudio.c b/drivers/sound/btaudio.c
index 40a6966ea..e70f65823 100644
--- a/drivers/sound/btaudio.c
+++ b/drivers/sound/btaudio.c
@@ -1030,7 +1030,7 @@ static struct pci_driver btaudio_pci_driver = {
name: "btaudio",
id_table: btaudio_pci_tbl,
probe: btaudio_probe,
- remove: __devexit_p(btaudio_remove),
+ remove: btaudio_remove,
};
int btaudio_init_module(void)
diff --git a/drivers/sound/cs46xx.c b/drivers/sound/cs46xx.c
index 1de32dadb..d45f2809f 100644
--- a/drivers/sound/cs46xx.c
+++ b/drivers/sound/cs46xx.c
@@ -3003,7 +3003,7 @@ static int cs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
return -ENODEV;
case SNDCTL_DSP_SETDUPLEX:
- return 0;
+ return -EINVAL;
case SNDCTL_DSP_GETODELAY:
if (!(file->f_mode & FMODE_WRITE))
diff --git a/drivers/sound/emu10k1/main.c b/drivers/sound/emu10k1/main.c
index 69f192c8d..bc53fcfd7 100644
--- a/drivers/sound/emu10k1/main.c
+++ b/drivers/sound/emu10k1/main.c
@@ -1127,7 +1127,7 @@ static struct pci_driver emu10k1_pci_driver = {
name: "emu10k1",
id_table: emu10k1_pci_tbl,
probe: emu10k1_probe,
- remove: __devexit_p(emu10k1_remove),
+ remove: emu10k1_remove,
};
static int __init emu10k1_init_module(void)
diff --git a/drivers/sound/i810_audio.c b/drivers/sound/i810_audio.c
index 2915a5a70..78b062c67 100644
--- a/drivers/sound/i810_audio.c
+++ b/drivers/sound/i810_audio.c
@@ -1405,9 +1405,10 @@ static ssize_t i810_write(struct file *file, const char *buffer, size_t count, l
if (dmabuf->count < 0) {
dmabuf->count = 0;
}
- cnt = dmabuf->dmasize - swptr;
- if(cnt > (dmabuf->dmasize - dmabuf->count))
- cnt = dmabuf->dmasize - dmabuf->count;
+ cnt = dmabuf->dmasize - dmabuf->fragsize - dmabuf->count;
+ // this is to make the copy_from_user simpler below
+ if(cnt > (dmabuf->dmasize - swptr))
+ cnt = dmabuf->dmasize - swptr;
spin_unlock_irqrestore(&state->card->lock, flags);
#ifdef DEBUG2
@@ -1418,13 +1419,16 @@ static ssize_t i810_write(struct file *file, const char *buffer, size_t count, l
if (cnt <= 0) {
unsigned long tmo;
// There is data waiting to be played
- i810_update_lvi(state,0);
if(!dmabuf->enable && dmabuf->count) {
/* force the starting incase SETTRIGGER has been used */
/* to stop it, otherwise this is a deadlock situation */
dmabuf->trigger |= PCM_ENABLE_OUTPUT;
start_dac(state);
}
+ // Update the LVI pointer in case we have already
+ // written data in this syscall and are just waiting
+ // on the tail bit of data
+ i810_update_lvi(state,0);
if (file->f_flags & O_NONBLOCK) {
if (!ret) ret = -EAGAIN;
goto ret;
@@ -1856,7 +1860,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
if(dmabuf->mapped)
abinfo.bytes = dmabuf->count;
else
- abinfo.bytes = dmabuf->dmasize - dmabuf->fragsize - dmabuf->count;
+ abinfo.bytes = dmabuf->dmasize - dmabuf->count;
abinfo.fragments = abinfo.bytes / dmabuf->userfragsize;
spin_unlock_irqrestore(&state->card->lock, flags);
#ifdef DEBUG
diff --git a/drivers/sound/ymfpci.c b/drivers/sound/ymfpci.c
index db3b9eed7..d90a28c85 100644
--- a/drivers/sound/ymfpci.c
+++ b/drivers/sound/ymfpci.c
@@ -39,7 +39,6 @@
* native synthesizer through a playback slot.
* - Use new 2.3.x cache coherent PCI DMA routines instead of virt_to_bus.
* - Make the thing big endian compatible. ALSA has it done.
- * - 2001/11/29 ac97_save_state
*/
#include <linux/config.h>
@@ -156,7 +155,7 @@ static int ymfpci_codec_ready(ymfpci_t *codec, int secondary, int sched)
schedule_timeout(1);
}
} while (end_time - (signed long)jiffies >= 0);
- printk(KERN_ERR "ymfpci_codec_ready: codec %i is not ready [0x%x]\n",
+ printk("ymfpci_codec_ready: codec %i is not ready [0x%x]\n",
secondary, ymfpci_readw(codec, reg));
return -EBUSY;
}
@@ -174,19 +173,19 @@ static void ymfpci_codec_write(struct ac97_codec *dev, u8 reg, u16 val)
static u16 ymfpci_codec_read(struct ac97_codec *dev, u8 reg)
{
- ymfpci_t *unit = dev->private_data;
- int i;
+ ymfpci_t *codec = dev->private_data;
- if (ymfpci_codec_ready(unit, 0, 0))
+ if (ymfpci_codec_ready(codec, 0, 0))
return ~0;
- ymfpci_writew(unit, YDSXGR_AC97CMDADR, YDSXG_AC97READCMD | reg);
- if (ymfpci_codec_ready(unit, 0, 0))
+ ymfpci_writew(codec, YDSXGR_AC97CMDADR, YDSXG_AC97READCMD | reg);
+ if (ymfpci_codec_ready(codec, 0, 0))
return ~0;
- if (unit->pci->device == PCI_DEVICE_ID_YAMAHA_744 && unit->rev < 2) {
+ if (codec->pci->device == PCI_DEVICE_ID_YAMAHA_744 && codec->rev < 2) {
+ int i;
for (i = 0; i < 600; i++)
- ymfpci_readw(unit, YDSXGR_PRISTATUSDATA);
+ ymfpci_readw(codec, YDSXGR_PRISTATUSDATA);
}
- return ymfpci_readw(unit, YDSXGR_PRISTATUSDATA);
+ return ymfpci_readw(codec, YDSXGR_PRISTATUSDATA);
}
/*
@@ -405,7 +404,7 @@ static int prog_dmabuf(struct ymf_state *state, int rec)
dmabuf->ready = 1;
#if 0
- printk(KERN_DEBUG "prog_dmabuf: rate %d format 0x%x,"
+ printk("prog_dmabuf: rate %d format 0x%x,"
" numfrag %d fragsize %d dmasize %d\n",
state->format.rate, state->format.format, dmabuf->numfrag,
dmabuf->fragsize, dmabuf->dmasize);
@@ -616,7 +615,7 @@ static void ymf_pcm_interrupt(ymfpci_t *codec, ymfpci_voice_t *voice)
dmabuf->hwptr = pos;
if (dmabuf->count == 0) {
- printk(KERN_ERR "ymfpci%d: %d: strain: hwptr %d\n",
+ printk("ymfpci%d: %d: strain: hwptr %d\n",
codec->dev_audio, voice->number, dmabuf->hwptr);
ymf_playback_trigger(codec, ypcm, 0);
}
@@ -634,7 +633,7 @@ static void ymf_pcm_interrupt(ymfpci_t *codec, ymfpci_voice_t *voice)
/*
* Lost interrupt or other screwage.
*/
- printk(KERN_ERR "ymfpci%d: %d: lost: delta %d"
+ printk("ymfpci%d: %d: lost: delta %d"
" hwptr %d swptr %d distance %d count %d\n",
codec->dev_audio, voice->number, delta,
dmabuf->hwptr, swptr, distance, dmabuf->count);
@@ -642,10 +641,10 @@ static void ymf_pcm_interrupt(ymfpci_t *codec, ymfpci_voice_t *voice)
/*
* Normal end of DMA.
*/
- YMFDBGI("ymfpci%d: %d: done: delta %d"
- " hwptr %d swptr %d distance %d count %d\n",
- codec->dev_audio, voice->number, delta,
- dmabuf->hwptr, swptr, distance, dmabuf->count);
+// printk("ymfpci%d: %d: done: delta %d"
+// " hwptr %d swptr %d distance %d count %d\n",
+// codec->dev_audio, voice->number, delta,
+// dmabuf->hwptr, swptr, distance, dmabuf->count);
}
played = dmabuf->count;
if (ypcm->running) {
@@ -1443,14 +1442,13 @@ static unsigned int ymf_poll(struct file *file, struct poll_table_struct *wait)
{
struct ymf_state *state = (struct ymf_state *)file->private_data;
struct ymf_dmabuf *dmabuf;
- int redzone;
unsigned long flags;
unsigned int mask = 0;
if (file->f_mode & FMODE_WRITE)
poll_wait(file, &state->wpcm.dmabuf.wait, wait);
- if (file->f_mode & FMODE_READ)
- poll_wait(file, &state->rpcm.dmabuf.wait, wait);
+ // if (file->f_mode & FMODE_READ)
+ // poll_wait(file, &dmabuf->wait, wait);
spin_lock_irqsave(&state->unit->reg_lock, flags);
if (file->f_mode & FMODE_READ) {
@@ -1459,21 +1457,12 @@ static unsigned int ymf_poll(struct file *file, struct poll_table_struct *wait)
mask |= POLLIN | POLLRDNORM;
}
if (file->f_mode & FMODE_WRITE) {
- redzone = ymf_calc_lend(state->format.rate);
- redzone <<= state->format.shift;
- redzone *= 3;
-
dmabuf = &state->wpcm.dmabuf;
if (dmabuf->mapped) {
if (dmabuf->count >= (signed)dmabuf->fragsize)
mask |= POLLOUT | POLLWRNORM;
} else {
- /*
- * Don't select unless a full fragment is available.
- * Otherwise artsd does GETOSPACE, sees 0, and loops.
- */
- if (dmabuf->count + redzone + dmabuf->fragsize
- <= dmabuf->dmasize)
+ if ((signed)dmabuf->dmasize >= dmabuf->count + (signed)dmabuf->fragsize)
mask |= POLLOUT | POLLWRNORM;
}
}
@@ -1520,16 +1509,13 @@ static int ymf_ioctl(struct inode *inode, struct file *file,
unsigned long flags;
audio_buf_info abinfo;
count_info cinfo;
- int redzone;
int val;
switch (cmd) {
case OSS_GETVERSION:
- YMFDBGX("ymf_ioctl: cmd 0x%x(GETVER) arg 0x%lx\n", cmd, arg);
return put_user(SOUND_VERSION, (int *)arg);
case SNDCTL_DSP_RESET:
- YMFDBGX("ymf_ioctl: cmd 0x%x(RESET)\n", cmd);
if (file->f_mode & FMODE_WRITE) {
ymf_wait_dac(state);
dmabuf = &state->wpcm.dmabuf;
@@ -1551,7 +1537,6 @@ static int ymf_ioctl(struct inode *inode, struct file *file,
return 0;
case SNDCTL_DSP_SYNC:
- YMFDBGX("ymf_ioctl: cmd 0x%x(SYNC)\n", cmd);
if (file->f_mode & FMODE_WRITE) {
dmabuf = &state->wpcm.dmabuf;
if (file->f_flags & O_NONBLOCK) {
@@ -1570,7 +1555,6 @@ static int ymf_ioctl(struct inode *inode, struct file *file,
case SNDCTL_DSP_SPEED: /* set smaple rate */
if (get_user(val, (int *)arg))
return -EFAULT;
- YMFDBGX("ymf_ioctl: cmd 0x%x(SPEED) sp %d\n", cmd, val);
if (val >= 8000 && val <= 48000) {
if (file->f_mode & FMODE_WRITE) {
ymf_wait_dac(state);
@@ -1602,7 +1586,6 @@ static int ymf_ioctl(struct inode *inode, struct file *file,
case SNDCTL_DSP_STEREO: /* set stereo or mono channel */
if (get_user(val, (int *)arg))
return -EFAULT;
- YMFDBGX("ymf_ioctl: cmd 0x%x(STEREO) st %d\n", cmd, val);
if (file->f_mode & FMODE_WRITE) {
ymf_wait_dac(state);
dmabuf = &state->wpcm.dmabuf;
@@ -1624,31 +1607,24 @@ static int ymf_ioctl(struct inode *inode, struct file *file,
return 0;
case SNDCTL_DSP_GETBLKSIZE:
- YMFDBGX("ymf_ioctl: cmd 0x%x(GETBLK)\n", cmd);
if (file->f_mode & FMODE_WRITE) {
if ((val = prog_dmabuf(state, 0)))
return val;
- val = state->wpcm.dmabuf.fragsize;
- YMFDBGX("ymf_ioctl: GETBLK w %d\n", val);
- return put_user(val, (int *)arg);
+ return put_user(state->wpcm.dmabuf.fragsize, (int *)arg);
}
if (file->f_mode & FMODE_READ) {
if ((val = prog_dmabuf(state, 1)))
return val;
- val = state->rpcm.dmabuf.fragsize;
- YMFDBGX("ymf_ioctl: GETBLK r %d\n", val);
- return put_user(val, (int *)arg);
+ return put_user(state->rpcm.dmabuf.fragsize, (int *)arg);
}
return -EINVAL;
case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format*/
- YMFDBGX("ymf_ioctl: cmd 0x%x(GETFMTS)\n", cmd);
return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg);
case SNDCTL_DSP_SETFMT: /* Select sample format */
if (get_user(val, (int *)arg))
return -EFAULT;
- YMFDBGX("ymf_ioctl: cmd 0x%x(SETFMT) fmt %d\n", cmd, val);
if (val == AFMT_S16_LE || val == AFMT_U8) {
if (file->f_mode & FMODE_WRITE) {
ymf_wait_dac(state);
@@ -1674,7 +1650,6 @@ static int ymf_ioctl(struct inode *inode, struct file *file,
case SNDCTL_DSP_CHANNELS:
if (get_user(val, (int *)arg))
return -EFAULT;
- YMFDBGX("ymf_ioctl: cmd 0x%x(CHAN) ch %d\n", cmd, val);
if (val != 0) {
if (file->f_mode & FMODE_WRITE) {
ymf_wait_dac(state);
@@ -1702,7 +1677,6 @@ static int ymf_ioctl(struct inode *inode, struct file *file,
return put_user(state->format.voices, (int *)arg);
case SNDCTL_DSP_POST:
- YMFDBGX("ymf_ioctl: cmd 0x%x(POST)\n", cmd);
/*
* Quoting OSS PG:
* The ioctl SNDCTL_DSP_POST is a lightweight version of
@@ -1724,10 +1698,6 @@ static int ymf_ioctl(struct inode *inode, struct file *file,
case SNDCTL_DSP_SETFRAGMENT:
if (get_user(val, (int *)arg))
return -EFAULT;
- YMFDBGX("ymf_ioctl: cmd 0x%x(SETFRAG) fr 0x%04x:%04x(%d:%d)\n",
- cmd,
- (val >> 16) & 0xFFFF, val & 0xFFFF,
- (val >> 16) & 0xFFFF, val & 0xFFFF);
dmabuf = &state->wpcm.dmabuf;
dmabuf->ossfragshift = val & 0xffff;
dmabuf->ossmaxfrags = (val >> 16) & 0xffff;
@@ -1738,25 +1708,20 @@ static int ymf_ioctl(struct inode *inode, struct file *file,
return 0;
case SNDCTL_DSP_GETOSPACE:
- YMFDBGX("ymf_ioctl: cmd 0x%x(GETOSPACE)\n", cmd);
if (!(file->f_mode & FMODE_WRITE))
return -EINVAL;
dmabuf = &state->wpcm.dmabuf;
if (!dmabuf->ready && (val = prog_dmabuf(state, 0)) != 0)
return val;
- redzone = ymf_calc_lend(state->format.rate);
- redzone <<= state->format.shift;
- redzone *= 3;
spin_lock_irqsave(&state->unit->reg_lock, flags);
abinfo.fragsize = dmabuf->fragsize;
- abinfo.bytes = dmabuf->dmasize - dmabuf->count - redzone;
+ abinfo.bytes = dmabuf->dmasize - dmabuf->count;
abinfo.fragstotal = dmabuf->numfrag;
abinfo.fragments = abinfo.bytes >> dmabuf->fragshift;
spin_unlock_irqrestore(&state->unit->reg_lock, flags);
return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
case SNDCTL_DSP_GETISPACE:
- YMFDBGX("ymf_ioctl: cmd 0x%x(GETISPACE)\n", cmd);
if (!(file->f_mode & FMODE_READ))
return -EINVAL;
dmabuf = &state->rpcm.dmabuf;
@@ -1771,18 +1736,15 @@ static int ymf_ioctl(struct inode *inode, struct file *file,
return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
case SNDCTL_DSP_NONBLOCK:
- YMFDBGX("ymf_ioctl: cmd 0x%x(NONBLOCK)\n", cmd);
file->f_flags |= O_NONBLOCK;
return 0;
case SNDCTL_DSP_GETCAPS:
- YMFDBGX("ymf_ioctl: cmd 0x%x(GETCAPS)\n", cmd);
/* return put_user(DSP_CAP_REALTIME|DSP_CAP_TRIGGER|DSP_CAP_MMAP,
(int *)arg); */
return put_user(0, (int *)arg);
case SNDCTL_DSP_GETIPTR:
- YMFDBGX("ymf_ioctl: cmd 0x%x(GETIPTR)\n", cmd);
if (!(file->f_mode & FMODE_READ))
return -EINVAL;
dmabuf = &state->rpcm.dmabuf;
@@ -1790,13 +1752,13 @@ static int ymf_ioctl(struct inode *inode, struct file *file,
cinfo.bytes = dmabuf->total_bytes;
cinfo.blocks = dmabuf->count >> dmabuf->fragshift;
cinfo.ptr = dmabuf->hwptr;
+ /* XXX fishy - breaks invariant count=hwptr-swptr */
+ if (dmabuf->mapped)
+ dmabuf->count &= dmabuf->fragsize-1;
spin_unlock_irqrestore(&state->unit->reg_lock, flags);
- YMFDBGX("ymf_ioctl: GETIPTR ptr %d bytes %d\n",
- cinfo.ptr, cinfo.bytes);
return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
case SNDCTL_DSP_GETOPTR:
- YMFDBGX("ymf_ioctl: cmd 0x%x(GETOPTR)\n", cmd);
if (!(file->f_mode & FMODE_WRITE))
return -EINVAL;
dmabuf = &state->wpcm.dmabuf;
@@ -1804,25 +1766,22 @@ static int ymf_ioctl(struct inode *inode, struct file *file,
cinfo.bytes = dmabuf->total_bytes;
cinfo.blocks = dmabuf->count >> dmabuf->fragshift;
cinfo.ptr = dmabuf->hwptr;
+ /* XXX fishy - breaks invariant count=swptr-hwptr */
+ if (dmabuf->mapped)
+ dmabuf->count &= dmabuf->fragsize-1;
spin_unlock_irqrestore(&state->unit->reg_lock, flags);
- YMFDBGX("ymf_ioctl: GETOPTR ptr %d bytes %d\n",
- cinfo.ptr, cinfo.bytes);
return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
case SNDCTL_DSP_SETDUPLEX: /* XXX TODO */
- YMFDBGX("ymf_ioctl: cmd 0x%x(SETDUPLEX)\n", cmd);
return -EINVAL;
case SOUND_PCM_READ_RATE:
- YMFDBGX("ymf_ioctl: cmd 0x%x(READ_RATE)\n", cmd);
return put_user(state->format.rate, (int *)arg);
case SOUND_PCM_READ_CHANNELS:
- YMFDBGX("ymf_ioctl: cmd 0x%x(READ_CH)\n", cmd);
return put_user(state->format.voices, (int *)arg);
case SOUND_PCM_READ_BITS:
- YMFDBGX("ymf_ioctl: cmd 0x%x(READ_BITS)\n", cmd);
return put_user(AFMT_S16_LE, (int *)arg);
case SNDCTL_DSP_MAPINBUF:
@@ -1908,8 +1867,8 @@ static int ymf_open(struct inode *inode, struct file *file)
}
#if 0 /* test if interrupts work */
- ymfpci_writew(unit, YDSXGR_TIMERCOUNT, 0xfffe); /* ~ 680ms */
- ymfpci_writeb(unit, YDSXGR_TIMERCTRL,
+ ymfpci_writew(codec, YDSXGR_TIMERCOUNT, 0xfffe); /* ~ 680ms */
+ ymfpci_writeb(codec, YDSXGR_TIMERCTRL,
(YDSXGR_TIMERCTRL_TEN|YDSXGR_TIMERCTRL_TIEN));
#endif
up(&unit->open_sem);
@@ -1937,13 +1896,13 @@ out_nodma:
static int ymf_release(struct inode *inode, struct file *file)
{
struct ymf_state *state = (struct ymf_state *)file->private_data;
- ymfpci_t *unit = state->unit;
+ ymfpci_t *codec = state->unit;
#if 0 /* test if interrupts work */
- ymfpci_writeb(unit, YDSXGR_TIMERCTRL, 0);
+ ymfpci_writeb(codec, YDSXGR_TIMERCTRL, 0);
#endif
- down(&unit->open_sem);
+ down(&codec->open_sem);
/*
* XXX Solve the case of O_NONBLOCK close - don't deallocate here.
@@ -1960,7 +1919,7 @@ static int ymf_release(struct inode *inode, struct file *file)
file->private_data = NULL; /* Can you tell I programmed Solaris */
kfree(state);
- up(&unit->open_sem);
+ up(&codec->open_sem);
return 0;
}
@@ -1970,10 +1929,10 @@ static int ymf_release(struct inode *inode, struct file *file)
*/
static int ymf_open_mixdev(struct inode *inode, struct file *file)
{
+ int i;
int minor = minor(inode->i_rdev);
struct list_head *list;
ymfpci_t *unit;
- int i;
list_for_each(list, &ymf_devs) {
unit = list_entry(list, ymfpci_t, ymf_devs);
@@ -2030,26 +1989,23 @@ static /*const*/ struct file_operations ymf_mixer_fops = {
static int ymf_suspend(struct pci_dev *pcidev, u32 unused)
{
+ int i;
struct ymf_unit *unit = pci_get_drvdata(pcidev);
unsigned long flags;
struct ymf_dmabuf *dmabuf;
struct list_head *p;
struct ymf_state *state;
struct ac97_codec *codec;
- int i;
spin_lock_irqsave(&unit->reg_lock, flags);
unit->suspended = 1;
- /*
- * XXX Talk to Kai to remove ac97_save_state before it's too late!
- * Other drivers call ac97_reset, which does not have
- * a save counterpart. Current ac97_save_state is empty.
- */
for (i = 0; i < NR_AC97; i++) {
- if ((codec = unit->ac97_codec[i]) != NULL)
- ac97_save_state(codec);
+ codec = unit->ac97_codec[i];
+ if (!codec)
+ continue;
+ ac97_save_state(codec);
}
list_for_each(p, &unit->states) {
@@ -2076,12 +2032,12 @@ static int ymf_suspend(struct pci_dev *pcidev, u32 unused)
static int ymf_resume(struct pci_dev *pcidev)
{
+ int i;
struct ymf_unit *unit = pci_get_drvdata(pcidev);
unsigned long flags;
struct list_head *p;
struct ymf_state *state;
struct ac97_codec *codec;
- int i;
ymfpci_aclink_reset(unit->pci);
ymfpci_codec_ready(unit, 0, 1); /* prints diag if not ready. */
@@ -2102,8 +2058,10 @@ static int ymf_resume(struct pci_dev *pcidev)
}
for (i = 0; i < NR_AC97; i++) {
- if ((codec = unit->ac97_codec[i]) != NULL)
- ac97_restore_state(codec);
+ codec = unit->ac97_codec[i];
+ if (!codec)
+ continue;
+ ac97_restore_state(codec);
}
unit->suspended = 0;
@@ -2400,7 +2358,7 @@ static int ymf_ac97_init(ymfpci_t *unit, int num_ac97)
codec->codec_write = ymfpci_codec_write;
if (ac97_probe_codec(codec) == 0) {
- printk(KERN_ERR "ymfpci: ac97_probe_codec failed\n");
+ printk("ymfpci: ac97_probe_codec failed\n");
goto out_kfree;
}
@@ -2441,7 +2399,6 @@ static int assigned;
static int __devinit ymf_probe_one(struct pci_dev *pcidev, const struct pci_device_id *ent)
{
u16 ctrl;
- unsigned long base;
ymfpci_t *codec;
int err;
@@ -2450,7 +2407,6 @@ static int __devinit ymf_probe_one(struct pci_dev *pcidev, const struct pci_devi
printk(KERN_ERR "ymfpci: pci_enable_device failed\n");
return err;
}
- base = pci_resource_start(pcidev, 0);
if ((codec = kmalloc(sizeof(ymfpci_t), GFP_KERNEL)) == NULL) {
printk(KERN_ERR "ymfpci: no core\n");
@@ -2465,21 +2421,16 @@ static int __devinit ymf_probe_one(struct pci_dev *pcidev, const struct pci_devi
codec->pci = pcidev;
pci_read_config_byte(pcidev, PCI_REVISION_ID, &codec->rev);
-
- if (request_mem_region(base, 0x8000, "ymfpci") == NULL) {
- printk(KERN_ERR "ymfpci: unable to request mem region\n");
- goto out_free;
- }
-
- if ((codec->reg_area_virt = ioremap(base, 0x8000)) == NULL) {
+ codec->reg_area_virt = ioremap(pci_resource_start(pcidev, 0), 0x8000);
+ if (codec->reg_area_virt == NULL) {
printk(KERN_ERR "ymfpci: unable to map registers\n");
- goto out_release_region;
+ goto out_free;
}
pci_set_master(pcidev);
printk(KERN_INFO "ymfpci: %s at 0x%lx IRQ %d\n",
- (char *)ent->driver_data, base, pcidev->irq);
+ (char *)ent->driver_data, pci_resource_start(pcidev, 0), pcidev->irq);
ymfpci_aclink_reset(pcidev);
if (ymfpci_codec_ready(codec, 0, 1) < 0)
@@ -2509,7 +2460,8 @@ static int __devinit ymf_probe_one(struct pci_dev *pcidev, const struct pci_devi
/* register /dev/dsp */
if ((codec->dev_audio = register_sound_dsp(&ymf_fops, -1)) < 0) {
- printk(KERN_ERR "ymfpci: unable to register dsp\n");
+ printk(KERN_ERR "ymfpci%d: unable to register dsp\n",
+ codec->dev_audio);
goto out_free_irq;
}
@@ -2555,8 +2507,6 @@ static int __devinit ymf_probe_one(struct pci_dev *pcidev, const struct pci_devi
ymfpci_writel(codec, YDSXGR_STATUS, ~0);
out_unmap:
iounmap(codec->reg_area_virt);
- out_release_region:
- release_mem_region(pci_resource_start(pcidev, 0), 0x8000);
out_free:
kfree(codec);
return -ENODEV;
@@ -2580,7 +2530,6 @@ static void __devexit ymf_remove_one(struct pci_dev *pcidev)
ctrl = ymfpci_readw(codec, YDSXGR_GLOBALCTRL);
ymfpci_writew(codec, YDSXGR_GLOBALCTRL, ctrl & ~0x0007);
iounmap(codec->reg_area_virt);
- release_mem_region(pci_resource_start(pcidev, 0), 0x8000);
#ifdef CONFIG_SOUND_YMFPCI_LEGACY
if (codec->iomidi) {
unload_uart401(&codec->mpu_data);
@@ -2597,7 +2546,7 @@ static struct pci_driver ymfpci_driver = {
name: "ymfpci",
id_table: ymf_id_tbl,
probe: ymf_probe_one,
- remove: __devexit_p(ymf_remove_one),
+ remove: ymf_remove_one,
suspend: ymf_suspend,
resume: ymf_resume
};
diff --git a/drivers/usb/auerswald.c b/drivers/usb/auerswald.c
index 417d5f083..073b0c80d 100644
--- a/drivers/usb/auerswald.c
+++ b/drivers/usb/auerswald.c
@@ -895,7 +895,7 @@ static void auerswald_ctrlread_wretcomplete (urb_t * urb)
bp->dr->bRequest = AUV_RBLOCK;
bp->dr->wLength = bp->dr->wValue; /* temporary stored */
bp->dr->wValue = cpu_to_le16 (1); /* Retry Flag */
- /* bp->dr->wIndex = channel id; remains */
+ /* bp->dr->index = channel id; remains */
FILL_CONTROL_URB (bp->urbp, cp->usbdev, usb_rcvctrlpipe (cp->usbdev, 0),
(unsigned char*)bp->dr, bp->bufp, le16_to_cpu (bp->dr->wLength),
(usb_complete_t)auerswald_ctrlread_complete,bp);
@@ -1017,7 +1017,7 @@ static void auerswald_int_complete (urb_t * urb)
/* now extract the information */
channelid = cp->intbufp[2];
- bytecount = le16_to_cpup ((u16 *)&cp->intbufp[3]);
+ bytecount = le16_to_cpup (&cp->intbufp[3]);
/* check the channel id */
if (channelid >= AUH_TYPESIZE) {
@@ -1983,7 +1983,7 @@ static void *auerswald_probe (struct usb_device *usbdev, unsigned int ifnum,
2, /* length of the buffer */
HZ * 2); /* time to wait for the message to complete before timing out */
if (ret == 2) {
- cp->maxControlLength = le16_to_cpup((u16 *)pbuf);
+ cp->maxControlLength = le16_to_cpup(pbuf);
kfree(pbuf);
dbg("setup: max. allowed control transfersize is %d bytes", cp->maxControlLength);
} else {
diff --git a/drivers/usb/uhci.c b/drivers/usb/uhci.c
index 8889f668f..de513c7ad 100644
--- a/drivers/usb/uhci.c
+++ b/drivers/usb/uhci.c
@@ -2990,7 +2990,7 @@ static struct pci_driver uhci_pci_driver = {
id_table: uhci_pci_ids,
probe: uhci_pci_probe,
- remove: __devexit_p(uhci_pci_remove),
+ remove: uhci_pci_remove,
#ifdef CONFIG_PM
suspend: uhci_pci_suspend,
diff --git a/drivers/usb/usb-ohci.c b/drivers/usb/usb-ohci.c
index 2b2a484e7..e62ca8a87 100644
--- a/drivers/usb/usb-ohci.c
+++ b/drivers/usb/usb-ohci.c
@@ -2860,7 +2860,7 @@ static struct pci_driver ohci_pci_driver = {
id_table: &ohci_pci_ids [0],
probe: ohci_pci_probe,
- remove: __devexit_p(ohci_pci_remove),
+ remove: ohci_pci_remove,
#ifdef CONFIG_PM
suspend: ohci_pci_suspend,
diff --git a/drivers/usb/usb-uhci.c b/drivers/usb/usb-uhci.c
index 50660b98e..df729fd09 100644
--- a/drivers/usb/usb-uhci.c
+++ b/drivers/usb/usb-uhci.c
@@ -3067,7 +3067,7 @@ static struct pci_driver uhci_pci_driver = {
id_table: &uhci_pci_ids [0],
probe: uhci_pci_probe,
- remove: __devexit_p(uhci_pci_remove),
+ remove: uhci_pci_remove,
#ifdef CONFIG_PM
suspend: uhci_pci_suspend,
diff --git a/drivers/usb/usbnet.c b/drivers/usb/usbnet.c
index 32a358366..70bcf013f 100644
--- a/drivers/usb/usbnet.c
+++ b/drivers/usb/usbnet.c
@@ -1875,11 +1875,6 @@ static const struct usb_device_id products [] = {
USB_DEVICE (0x0547, 0x2727), // Xircom PGUNET
driver_info: (unsigned long) &an2720_info,
},
-
-{
- USB_DEVICE (0x0547, 0x2727), // Xircom PGUNET
- driver_info: (unsigned long) &an2720_info,
-},
#endif
#ifdef CONFIG_USB_BELKIN
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 8af67b721..50a1f4f42 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -88,9 +88,6 @@
#include <linux/adb.h>
#include <linux/pmu.h>
#endif
-#ifdef CONFIG_BOOTX_TEXT
-#include <asm/btext.h>
-#endif
#ifdef CONFIG_NVRAM
#include <linux/nvram.h>
#endif
@@ -254,11 +251,11 @@ static int default_pll __initdata = 0;
static int default_mclk __initdata = 0;
#ifndef MODULE
-static char *mode_option __initdata = NULL;
+static const char *mode_option __initdata = NULL;
#endif
#ifdef CONFIG_PPC
-#ifndef CONFIG_NVRAM
+#ifdef CONFIG_NVRAM_NOT_DEFINED
static int default_vmode __initdata = VMODE_NVRAM;
static int default_cmode __initdata = CMODE_NVRAM;
#else
@@ -274,35 +271,31 @@ static unsigned long phys_size[FB_MAX] __initdata = { 0, };
static unsigned long phys_guiregbase[FB_MAX] __initdata = { 0, };
#endif
-#ifdef CONFIG_FB_ATY_GX
-static char m64n_gx[] __initdata = "mach64GX (ATI888GX00)";
-static char m64n_cx[] __initdata = "mach64CX (ATI888CX00)";
-#endif /* CONFIG_FB_ATY_GX */
+static const char m64n_gx[] __initdata = "mach64GX (ATI888GX00)";
+static const char m64n_cx[] __initdata = "mach64CX (ATI888CX00)";
+static const char m64n_ct[] __initdata = "mach64CT (ATI264CT)";
+static const char m64n_et[] __initdata = "mach64ET (ATI264ET)";
+static const char m64n_vta3[] __initdata = "mach64VTA3 (ATI264VT)";
+static const char m64n_vta4[] __initdata = "mach64VTA4 (ATI264VT)";
+static const char m64n_vtb[] __initdata = "mach64VTB (ATI264VTB)";
+static const char m64n_vt4[] __initdata = "mach64VT4 (ATI264VT4)";
+static const char m64n_gt[] __initdata = "3D RAGE (GT)";
+static const char m64n_gtb[] __initdata = "3D RAGE II+ (GTB)";
+static const char m64n_iic_p[] __initdata = "3D RAGE IIC (PCI)";
+static const char m64n_iic_a[] __initdata = "3D RAGE IIC (AGP)";
+static const char m64n_lt[] __initdata = "3D RAGE LT";
+static const char m64n_ltg[] __initdata = "3D RAGE LT-G";
+static const char m64n_gtc_ba[] __initdata = "3D RAGE PRO (BGA, AGP)";
+static const char m64n_gtc_ba1[] __initdata = "3D RAGE PRO (BGA, AGP, 1x only)";
+static const char m64n_gtc_bp[] __initdata = "3D RAGE PRO (BGA, PCI)";
+static const char m64n_gtc_pp[] __initdata = "3D RAGE PRO (PQFP, PCI)";
+static const char m64n_gtc_ppl[] __initdata = "3D RAGE PRO (PQFP, PCI, limited 3D)";
+static const char m64n_xl[] __initdata = "3D RAGE (XL)";
+static const char m64n_ltp_a[] __initdata = "3D RAGE LT PRO (AGP)";
+static const char m64n_ltp_p[] __initdata = "3D RAGE LT PRO (PCI)";
+static const char m64n_mob_p[] __initdata = "3D RAGE Mobility (PCI)";
+static const char m64n_mob_a[] __initdata = "3D RAGE Mobility (AGP)";
-#ifdef CONFIG_FB_ATY_CT
-static char m64n_ct[] __initdata = "mach64CT (ATI264CT)";
-static char m64n_et[] __initdata = "mach64ET (ATI264ET)";
-static char m64n_vta3[] __initdata = "mach64VTA3 (ATI264VT)";
-static char m64n_vta4[] __initdata = "mach64VTA4 (ATI264VT)";
-static char m64n_vtb[] __initdata = "mach64VTB (ATI264VTB)";
-static char m64n_vt4[] __initdata = "mach64VT4 (ATI264VT4)";
-static char m64n_gt[] __initdata = "3D RAGE (GT)";
-static char m64n_gtb[] __initdata = "3D RAGE II+ (GTB)";
-static char m64n_iic_p[] __initdata = "3D RAGE IIC (PCI)";
-static char m64n_iic_a[] __initdata = "3D RAGE IIC (AGP)";
-static char m64n_lt[] __initdata = "3D RAGE LT";
-static char m64n_ltg[] __initdata = "3D RAGE LT-G";
-static char m64n_gtc_ba[] __initdata = "3D RAGE PRO (BGA, AGP)";
-static char m64n_gtc_ba1[] __initdata = "3D RAGE PRO (BGA, AGP, 1x only)";
-static char m64n_gtc_bp[] __initdata = "3D RAGE PRO (BGA, PCI)";
-static char m64n_gtc_pp[] __initdata = "3D RAGE PRO (PQFP, PCI)";
-static char m64n_gtc_ppl[] __initdata = "3D RAGE PRO (PQFP, PCI, limited 3D)";
-static char m64n_xl[] __initdata = "3D RAGE (XL)";
-static char m64n_ltp_a[] __initdata = "3D RAGE LT PRO (AGP)";
-static char m64n_ltp_p[] __initdata = "3D RAGE LT PRO (PCI)";
-static char m64n_mob_p[] __initdata = "3D RAGE Mobility (PCI)";
-static char m64n_mob_a[] __initdata = "3D RAGE Mobility (AGP)";
-#endif /* CONFIG_FB_ATY_CT */
static const struct {
u16 pci_id, chip_type;
@@ -364,32 +357,24 @@ static const struct {
#endif /* CONFIG_FB_ATY_CT */
};
-#if defined(CONFIG_FB_ATY_GX) || defined(CONFIG_FB_ATY_CT)
-static char ram_dram[] __initdata = "DRAM";
-#endif /* CONFIG_FB_ATY_GX || CONFIG_FB_ATY_CT */
+static const char ram_dram[] __initdata = "DRAM";
+static const char ram_vram[] __initdata = "VRAM";
+static const char ram_edo[] __initdata = "EDO";
+static const char ram_sdram[] __initdata = "SDRAM";
+static const char ram_sgram[] __initdata = "SGRAM";
+static const char ram_wram[] __initdata = "WRAM";
+static const char ram_off[] __initdata = "OFF";
+static const char ram_resv[] __initdata = "RESV";
#ifdef CONFIG_FB_ATY_GX
-static char ram_vram[] __initdata = "VRAM";
-#endif /* CONFIG_FB_ATY_GX */
-
-#ifdef CONFIG_FB_ATY_CT
-static char ram_edo[] __initdata = "EDO";
-static char ram_sdram[] __initdata = "SDRAM";
-static char ram_sgram[] __initdata = "SGRAM";
-static char ram_wram[] __initdata = "WRAM";
-static char ram_off[] __initdata = "OFF";
-static char ram_resv[] __initdata = "RESV";
-#endif /* CONFIG_FB_ATY_CT */
-
-#ifdef CONFIG_FB_ATY_GX
-static char *aty_gx_ram[8] __initdata = {
+static const char *aty_gx_ram[8] __initdata = {
ram_dram, ram_vram, ram_vram, ram_dram,
ram_dram, ram_vram, ram_vram, ram_resv
};
#endif /* CONFIG_FB_ATY_GX */
#ifdef CONFIG_FB_ATY_CT
-static char *aty_ct_ram[8] __initdata = {
+static const char *aty_ct_ram[8] __initdata = {
ram_off, ram_dram, ram_edo, ram_edo,
ram_sdram, ram_sgram, ram_wram, ram_resv
};
@@ -834,13 +819,6 @@ static void atyfb_set_par(const struct atyfb_par *par,
display_info.disp_reg_address = info->ati_regbase_phys;
}
#endif /* CONFIG_FB_COMPAT_XPMAC */
-#ifdef CONFIG_BOOTX_TEXT
- btext_update_display(info->frame_buffer_phys,
- (((par->crtc.h_tot_disp>>16) & 0xff)+1)*8,
- ((par->crtc.v_tot_disp>>16) & 0x7ff)+1,
- par->crtc.bpp,
- par->crtc.vxres*par->crtc.bpp/8);
-#endif /* CONFIG_BOOTX_TEXT */
}
static int atyfb_decode_var(const struct fb_var_screeninfo *var,
@@ -1660,8 +1638,6 @@ static int aty_sleep_notify(struct pmu_sleep_notifier *self, int when)
}
break;
case PBOOK_SLEEP_NOW:
- if (currcon >= 0)
- fb_display[currcon].dispsw = &fbcon_dummy;
if (info->blitter_may_be_busy)
wait_for_idle(info);
/* Stop accel engine (stop bus mastering) */
@@ -1691,11 +1667,7 @@ static int aty_sleep_notify(struct pmu_sleep_notifier *self, int when)
info->save_framebuffer = 0;
}
/* Restore display */
- if (currcon >= 0) {
- atyfb_set_dispsw(&fb_display[currcon],
- info, info->current_par.crtc.bpp,
- info->current_par.accel_flags & FB_ACCELF_TEXT);
- }
+ atyfb_set_par(&info->current_par, info);
atyfbcon_blank(0, (struct fb_info *)info);
break;
}
@@ -2014,7 +1986,7 @@ found:
disp = &info->disp;
strcpy(info->fb_info.modename, atyfb_name);
- info->fb_info.node = NODEV;
+ info->fb_info.node = -1;
info->fb_info.fbops = &atyfb_ops;
info->fb_info.disp = disp;
strcpy(info->fb_info.fontname, fontname);
@@ -2048,6 +2020,13 @@ found:
if (!mac_find_mode(&var, &info->fb_info, mode_option, 8))
var = default_var;
} else {
+#ifdef CONFIG_NVRAM
+ if (default_vmode == VMODE_NVRAM) {
+ default_vmode = nvram_read_byte(NV_VMODE);
+ if (default_vmode <= 0 || default_vmode > VMODE_MAX)
+ default_vmode = VMODE_CHOOSE;
+ }
+#endif
if (default_vmode == VMODE_CHOOSE) {
if (M64_HAS(G3_PB_1024x768))
/* G3 PowerBook with 1024x768 LCD */
@@ -2160,16 +2139,11 @@ int __init atyfb_init(void)
return -ENXIO;
#else
u16 tmp;
- int aux_app;
- unsigned long raddr;
#endif
while ((pdev = pci_find_device(PCI_VENDOR_ID_ATI, PCI_ANY_ID, pdev))) {
if ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
struct resource *rp;
-#ifndef __sparc__
- struct resource *rrp;
-#endif
for (i = sizeof(aty_chips)/sizeof(*aty_chips)-1; i >= 0; i--)
if (pdev->device == aty_chips[i].pci_id)
@@ -2401,19 +2375,9 @@ int __init atyfb_init(void)
}
#else /* __sparc__ */
- aux_app = 0;
- raddr = addr + 0x7ff000UL;
- rrp = &pdev->resource[2];
- if ((rrp->flags & IORESOURCE_MEM)
- && request_mem_region(rrp->start, rrp->end - rrp->start + 1,
- "atyfb")) {
- aux_app = 1;
- raddr = rrp->start;
- printk(KERN_INFO "atyfb: using auxiliary register aperture\n");
- }
-
- info->ati_regbase_phys = raddr;
- info->ati_regbase = (unsigned long) ioremap(raddr, 0x1000);
+ info->ati_regbase_phys = 0x7ff000 + addr;
+ info->ati_regbase = (unsigned long)
+ ioremap(info->ati_regbase_phys, 0x1000);
if(!info->ati_regbase) {
kfree(info);
@@ -2421,8 +2385,8 @@ int __init atyfb_init(void)
return -ENOMEM;
}
- info->ati_regbase_phys += aux_app? 0x400: 0xc00;
- info->ati_regbase += aux_app? 0x400: 0xc00;
+ info->ati_regbase_phys += 0xc00;
+ info->ati_regbase += 0xc00;
/*
* Enable memory-space accesses using config-space
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c
index 74553d139..d83338cc3 100644
--- a/drivers/video/cyber2000fb.c
+++ b/drivers/video/cyber2000fb.c
@@ -1683,7 +1683,7 @@ static struct pci_device_id cyberpro_pci_table[] __devinitdata = {
static struct pci_driver cyberpro_driver = {
name: "CyberPro",
probe: cyberpro_probe,
- remove: __devexit_p(cyberpro_remove),
+ remove: cyberpro_remove,
suspend: cyberpro_suspend,
resume: cyberpro_resume,
id_table: cyberpro_pci_table
diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c
index 3ec9b07d6..2030ab596 100644
--- a/drivers/video/imsttfb.c
+++ b/drivers/video/imsttfb.c
@@ -1643,7 +1643,7 @@ static struct pci_driver imsttfb_pci_driver = {
name: "imsttfb",
id_table: imsttfb_pci_tbl,
probe: imsttfb_probe,
- remove: __devexit_p(imsttfb_remove),
+ remove: imsttfb_remove,
};
static struct fb_ops imsttfb_ops = {
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c
index bd51027b0..0902bee80 100644
--- a/drivers/video/matrox/matroxfb_base.c
+++ b/drivers/video/matrox/matroxfb_base.c
@@ -108,7 +108,6 @@ static int default_cmode = CMODE_NVRAM;
#endif
static void matroxfb_unregister_device(struct matrox_fb_info* minfo);
-int matroxfb_switch(int con, struct fb_info *info);
/* --------------------------------------------------------------------- */
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index 845e8e494..a96746f85 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -41,7 +41,7 @@ const char *global_mode_option = NULL;
#define DEFAULT_MODEDB_INDEX 0
-static struct fb_videomode modedb[] __initdata = {
+static const struct fb_videomode modedb[] __initdata = {
{
/* 640x400 @ 70 Hz, 31.5 kHz hsync */
NULL, 70, 640, 400, 39721, 40, 24, 39, 9, 96, 2,
diff --git a/drivers/video/radeonfb.c b/drivers/video/radeonfb.c
index 2b3dbe4f2..30db837cb 100644
--- a/drivers/video/radeonfb.c
+++ b/drivers/video/radeonfb.c
@@ -619,7 +619,7 @@ static struct pci_driver radeonfb_driver = {
name: "radeonfb",
id_table: radeonfb_pci_table,
probe: radeonfb_pci_register,
- remove: __devexit_p(radeonfb_pci_unregister),
+ remove: radeonfb_pci_unregister,
};
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 72d42b197..2213a8595 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -2082,7 +2082,7 @@ static struct pci_driver rivafb_driver = {
name: "rivafb",
id_table: rivafb_pci_tbl,
probe: rivafb_init_one,
- remove: __devexit_p(rivafb_remove_one),
+ remove: rivafb_remove_one,
};
diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c
index b7e522187..11c93e737 100644
--- a/drivers/video/tdfxfb.c
+++ b/drivers/video/tdfxfb.c
@@ -495,7 +495,7 @@ static struct pci_driver tdfxfb_driver = {
name: "tdfxfb",
id_table: tdfxfb_id_table,
probe: tdfxfb_probe,
- remove: __devexit_p(tdfxfb_remove),
+ remove: tdfxfb_remove,
};
MODULE_DEVICE_TABLE(pci, tdfxfb_id_table);
diff --git a/fs/inode.c b/fs/inode.c
index 9d435477c..22b6d538e 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1207,8 +1207,6 @@ static inline void do_atime_update(struct inode *inode)
void update_atime (struct inode *inode)
{
- if (inode->i_atime == CURRENT_TIME)
- return;
if ( IS_NOATIME (inode) ) return;
if ( IS_NODIRATIME (inode) && S_ISDIR (inode->i_mode) ) return;
if ( IS_RDONLY (inode) ) return;
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 545e1c1af..2c9987eba 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -17,37 +17,6 @@
#define NFSDBG_FACILITY NFSDBG_PROC
-/* A wrapper to handle the EJUKEBOX error message */
-static int
-nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
-{
- sigset_t oldset;
- int res;
- rpc_clnt_sigmask(clnt, &oldset);
- do {
- res = rpc_call_sync(clnt, msg, flags);
- if (res != -EJUKEBOX)
- break;
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(NFS_JUKEBOX_RETRY_TIME);
- res = -ERESTARTSYS;
- } while (!signalled());
- rpc_clnt_sigunmask(clnt, &oldset);
- return res;
-}
-
-static inline int
-nfs3_rpc_call_wrapper(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp, int flags)
-{
- struct rpc_message msg = { proc, argp, resp, NULL };
- return nfs3_rpc_wrapper(clnt, &msg, flags);
-}
-
-#define rpc_call(clnt, proc, argp, resp, flags) \
- nfs3_rpc_call_wrapper(clnt, proc, argp, resp, flags)
-#define rpc_call_sync(clnt, msg, flags) \
- nfs3_rpc_wrapper(clnt, msg, flags)
-
/*
* Bare-bones access to getattr: this is for nfs_read_super.
*/
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index f11966985..4196c397e 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -186,7 +186,7 @@ nfs_list_add_request(struct nfs_page *req, struct list_head *head)
BUG();
}
#endif
- list_for_each_prev(pos, head) {
+ for (pos = head->prev; pos != head; pos = pos->prev) {
struct nfs_page *p = nfs_list_entry(pos);
if (page_index(p->wb_page) < pg_idx)
break;
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 068005fa1..936ce1dba 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -404,9 +404,6 @@ nfs_readpage_result(struct rpc_task *task)
dprintk("NFS: %4d nfs_readpage_result, (status %d)\n",
task->tk_pid, task->tk_status);
- if (nfs_async_handle_jukebox(task))
- return;
-
nfs_refresh_inode(inode, &data->fattr);
while (!list_empty(&data->pages)) {
struct nfs_page *req = nfs_list_entry(data->pages.next);
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 08e67912f..800fc5767 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -123,8 +123,6 @@ nfs_async_unlink_done(struct rpc_task *task)
struct dentry *dir = data->dir;
struct inode *dir_i;
- if (nfs_async_handle_jukebox(task))
- return;
if (!dir)
return;
dir_i = dir->d_inode;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index c53cdb7b2..096ea12f8 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -311,30 +311,18 @@ region_locked(struct inode *inode, struct nfs_page *req)
/*
* Insert a write request into an inode
- * Note: we sort the list in order to be able to optimize nfs_find_request()
- * & co. for the 'write append' case. For 2.5 we may want to consider
- * some form of hashing so as to perform well on random writes.
*/
static inline void
nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
{
- struct list_head *pos, *head;
- unsigned long pg_idx = page_index(req->wb_page);
-
if (!list_empty(&req->wb_hash))
return;
if (!NFS_WBACK_BUSY(req))
printk(KERN_ERR "NFS: unlocked request attempted hashed!\n");
- head = &inode->u.nfs_i.writeback;
- if (list_empty(head))
+ if (list_empty(&inode->u.nfs_i.writeback))
igrab(inode);
- list_for_each_prev(pos, head) {
- struct nfs_page *entry = nfs_inode_wb_entry(pos);
- if (page_index(entry->wb_page) < pg_idx)
- break;
- }
inode->u.nfs_i.npages++;
- list_add(&req->wb_hash, pos);
+ list_add(&req->wb_hash, &inode->u.nfs_i.writeback);
req->wb_count++;
}
@@ -372,18 +360,15 @@ nfs_inode_remove_request(struct nfs_page *req)
static inline struct nfs_page *
_nfs_find_request(struct inode *inode, struct page *page)
{
- struct list_head *head, *pos;
- unsigned long pg_idx = page_index(page);
+ struct list_head *head, *next;
head = &inode->u.nfs_i.writeback;
- list_for_each_prev(pos, head) {
- struct nfs_page *req = nfs_inode_wb_entry(pos);
- unsigned long found_idx = page_index(req->wb_page);
-
- if (pg_idx < found_idx)
+ next = head->next;
+ while (next != head) {
+ struct nfs_page *req = nfs_inode_wb_entry(next);
+ next = next->next;
+ if (page_index(req->wb_page) != page_index(page))
continue;
- if (pg_idx != found_idx)
- break;
req->wb_count++;
return req;
}
@@ -465,20 +450,20 @@ nfs_wait_on_requests(struct inode *inode, struct file *file, unsigned long idx_s
else
idx_end = idx_start + npages - 1;
- head = &inode->u.nfs_i.writeback;
- restart:
spin_lock(&nfs_wreq_lock);
- list_for_each_prev(p, head) {
+ head = &inode->u.nfs_i.writeback;
+ p = head->next;
+ while (p != head) {
unsigned long pg_idx;
struct nfs_page *req = nfs_inode_wb_entry(p);
+ p = p->next;
+
if (file && req->wb_file != file)
continue;
pg_idx = page_index(req->wb_page);
- if (pg_idx < idx_start)
- break;
- if (pg_idx > idx_end)
+ if (pg_idx < idx_start || pg_idx > idx_end)
continue;
if (!NFS_WBACK_BUSY(req))
@@ -489,8 +474,9 @@ nfs_wait_on_requests(struct inode *inode, struct file *file, unsigned long idx_s
nfs_release_request(req);
if (error < 0)
return error;
+ spin_lock(&nfs_wreq_lock);
+ p = head->next;
res++;
- goto restart;
}
spin_unlock(&nfs_wreq_lock);
return res;
@@ -1016,9 +1002,6 @@ nfs_writeback_done(struct rpc_task *task)
dprintk("NFS: %4d nfs_writeback_done (status %d)\n",
task->tk_pid, task->tk_status);
- if (nfs_async_handle_jukebox(task))
- return;
-
/* We can't handle that yet but we check for it nevertheless */
if (resp->count < argp->count && task->tk_status >= 0) {
static unsigned long complain;
@@ -1212,9 +1195,6 @@ nfs_commit_done(struct rpc_task *task)
dprintk("NFS: %4d nfs_commit_done (status %d)\n",
task->tk_pid, task->tk_status);
- if (nfs_async_handle_jukebox(task))
- return;
-
nfs_write_attributes(inode, resp->fattr);
while (!list_empty(&data->pages)) {
req = nfs_list_entry(data->pages.next);
diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h
index 36fd740a4..2f7605859 100644
--- a/include/asm-i386/mmu_context.h
+++ b/include/asm-i386/mmu_context.h
@@ -9,20 +9,21 @@
/*
* Every architecture must define this function. It's the fastest
* way of searching a 168-bit bitmap where the first 128 bits are
- * unlikely to be clear. It's guaranteed that at least one of the 168
+ * unlikely to be set. It's guaranteed that at least one of the 168
* bits is cleared.
*/
#if MAX_RT_PRIO != 128 || MAX_PRIO != 168
# error update this function.
#endif
-static inline int sched_find_first_zero_bit(unsigned long *b)
+static inline int sched_find_first_zero_bit(char *bitmap)
{
+ unsigned int *b = (unsigned int *)bitmap;
unsigned int rt;
rt = b[0] & b[1] & b[2] & b[3];
if (unlikely(rt != 0xffffffff))
- return find_first_zero_bit(b, MAX_RT_PRIO);
+ return find_first_zero_bit(bitmap, MAX_RT_PRIO);
if (b[4] != ~0)
return ffz(b[4]) + MAX_RT_PRIO;
diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h
index 26107d9e1..f429cdec4 100644
--- a/include/asm-ia64/pal.h
+++ b/include/asm-ia64/pal.h
@@ -88,10 +88,10 @@
typedef s64 pal_status_t;
#define PAL_STATUS_SUCCESS 0 /* No error */
-#define PAL_STATUS_UNIMPLEMENTED (-1) /* Unimplemented procedure */
-#define PAL_STATUS_EINVAL (-2) /* Invalid argument */
-#define PAL_STATUS_ERROR (-3) /* Error */
-#define PAL_STATUS_CACHE_INIT_FAIL (-4) /* Could not initialize the
+#define PAL_STATUS_UNIMPLEMENTED -1 /* Unimplemented procedure */
+#define PAL_STATUS_EINVAL -2 /* Invalid argument */
+#define PAL_STATUS_ERROR -3 /* Error */
+#define PAL_STATUS_CACHE_INIT_FAIL -4 /* Could not initialize the
* specified level and type of
* cache without sideeffects
* and "restrict" was 1
diff --git a/include/asm-ia64/siginfo.h b/include/asm-ia64/siginfo.h
index c5972a262..dc801e5ab 100644
--- a/include/asm-ia64/siginfo.h
+++ b/include/asm-ia64/siginfo.h
@@ -119,11 +119,11 @@ typedef struct siginfo {
#define SI_USER 0 /* sent by kill, sigsend, raise */
#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
-#define SI_QUEUE (-1) /* sent by sigqueue */
+#define SI_QUEUE -1 /* sent by sigqueue */
#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */
-#define SI_MESGQ (-3) /* sent by real time mesq state change */
-#define SI_ASYNCIO (-4) /* sent by AIO completion */
-#define SI_SIGIO (-5) /* sent by queued SIGIO */
+#define SI_MESGQ -3 /* sent by real time mesq state change */
+#define SI_ASYNCIO -4 /* sent by AIO completion */
+#define SI_SIGIO -5 /* sent by queued SIGIO */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
diff --git a/include/linux/init.h b/include/linux/init.h
index 53218e330..f0644ca30 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -111,7 +111,7 @@ extern struct kernel_param __setup_start, __setup_end;
*/
#define module_exit(x) __exitcall(x);
-#else /* MODULE */
+#else
#define __init
#define __exit
@@ -141,7 +141,7 @@ typedef void (*__cleanup_module_func_t)(void);
#define __setup(str,func) /* nothing */
-#endif /* !MODULE */
+#endif
#ifdef CONFIG_HOTPLUG
#define __devinit
@@ -155,16 +155,4 @@ typedef void (*__cleanup_module_func_t)(void);
#define __devexitdata __exitdata
#endif
-/* Functions marked as __devexit may be discarded at kernel link time, depending
- on config options. Newer versions of binutils detect references from
- retained sections to discarded sections and flag an error. Pointers to
- __devexit functions must use __devexit_p(function_name), the wrapper will
- insert either the function_name or NULL, depending on the config options.
- */
-#if defined(MODULE) || defined(CONFIG_HOTPLUG)
-#define __devexit_p(x) x
-#else
-#define __devexit_p(x) NULL
-#endif
-
#endif /* _LINUX_INIT_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 96473ba9b..ba870227f 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -112,10 +112,6 @@ struct vm_area_struct {
#define VM_SequentialReadHint(v) ((v)->vm_flags & VM_SEQ_READ)
#define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ)
-/* read ahead limits */
-extern int vm_min_readahead;
-extern int vm_max_readahead;
-
/*
* mapping from the currently active vm_flags protection bits (the
* low four bits) to a page protection mask..
@@ -381,9 +377,6 @@ extern int ptrace_check_attach(struct task_struct *task, int kill);
int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
-int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
- int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
-
/*
* On a two-level page table, this ends up being trivial. Thus the
* inlining and the symmetry break with pte_alloc() that does all
@@ -490,13 +483,11 @@ static inline int expand_stack(struct vm_area_struct * vma, unsigned long addres
* before relocating the vma range ourself.
*/
address &= PAGE_MASK;
- spin_lock(&vma->vm_mm->page_table_lock);
grow = (vma->vm_start - address) >> PAGE_SHIFT;
if (vma->vm_end - address > current->rlim[RLIMIT_STACK].rlim_cur ||
- ((vma->vm_mm->total_vm + grow) << PAGE_SHIFT) > current->rlim[RLIMIT_AS].rlim_cur) {
- spin_unlock(&vma->vm_mm->page_table_lock);
+ ((vma->vm_mm->total_vm + grow) << PAGE_SHIFT) > current->rlim[RLIMIT_AS].rlim_cur)
return -ENOMEM;
- }
+ spin_lock(&vma->vm_mm->page_table_lock);
vma->vm_start = address;
vma->vm_pgoff -= grow;
vma->vm_mm->total_vm += grow;
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 4266b3ce0..efbbdba3a 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -16,7 +16,6 @@
#include <linux/sunrpc/debug.h>
#include <linux/sunrpc/auth.h>
-#include <linux/sunrpc/clnt.h>
#include <linux/nfs.h>
#include <linux/nfs2.h>
@@ -333,29 +332,6 @@ extern void * nfs_root_data(void);
__retval; \
})
-#ifdef CONFIG_NFS_V3
-
-#define NFS_JUKEBOX_RETRY_TIME (5 * HZ)
-static inline int
-nfs_async_handle_jukebox(struct rpc_task *task)
-{
- if (task->tk_status != -EJUKEBOX)
- return 0;
- task->tk_status = 0;
- rpc_restart_call(task);
- rpc_delay(task, NFS_JUKEBOX_RETRY_TIME);
- return 1;
-}
-
-#else
-
-static inline int
-nfs_async_handle_jukebox(struct rpc_task *task)
-{
- return 0;
-}
-#endif /* CONFIG_NFS_V3 */
-
#endif /* __KERNEL__ */
/*
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 81009d605..c0c21e26f 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -91,7 +91,7 @@ static inline mddev_t * kdev_to_mddev (kdev_t dev)
/*
* default readahead
*/
-#define MD_READAHEAD vm_max_readahead
+#define MD_READAHEAD MAX_READAHEAD
static inline int disk_faulty(mdp_disk_t * d)
{
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 908cf6808..938560387 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -139,9 +139,7 @@ enum
VM_PAGECACHE=7, /* struct: Set cache memory thresholds */
VM_PAGERDAEMON=8, /* struct: Control kswapd behaviour */
VM_PGT_CACHE=9, /* struct: Set page table cache parameters */
- VM_PAGE_CLUSTER=10, /* int: set number of pages to swap together */
- VM_MIN_READAHEAD=12, /* Min file readahead */
- VM_MAX_READAHEAD=13 /* Max file readahead */
+ VM_PAGE_CLUSTER=10 /* int: set number of pages to swap together */
};
diff --git a/include/pcmcia/ciscode.h b/include/pcmcia/ciscode.h
index 660b1f491..2e0a838f1 100644
--- a/include/pcmcia/ciscode.h
+++ b/include/pcmcia/ciscode.h
@@ -1,5 +1,5 @@
/*
- * ciscode.h 1.48 2001/08/24 12:16:12
+ * ciscode.h 1.45 2000/08/12 02:08:23
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
@@ -16,8 +16,8 @@
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
- * terms of the GNU General Public License version 2 (the "GPL"), in
- * which case the provisions of the GPL are applicable instead of the
+ * terms of the GNU General Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
@@ -104,8 +104,6 @@
#define PRODID_QUATECH_DUAL_RS232 0x0012
#define PRODID_QUATECH_DUAL_RS232_D1 0x0007
#define PRODID_QUATECH_QUAD_RS232 0x001b
-#define PRODID_QUATECH_DUAL_RS422 0x000e
-#define PRODID_QUATECH_QUAD_RS422 0x0045
#define MANFID_SMC 0x0108
#define PRODID_SMC_ETHER 0x0105
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index 537e8c09e..2bd505c96 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -1,5 +1,5 @@
/*
- * cs.h 1.74 2001/10/04 03:15:22
+ * cs.h 1.71 2000/08/29 00:54:20
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
@@ -16,8 +16,8 @@
* are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the
- * terms of the GNU General Public License version 2 (the "GPL"), in
- * which case the provisions of the GPL are applicable instead of the
+ * terms of the GNU General Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
* above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
@@ -181,7 +181,6 @@ typedef struct config_req_t {
#define INT_MEMORY 0x01
#define INT_MEMORY_AND_IO 0x02
#define INT_CARDBUS 0x04
-#define INT_ZOOMED_VIDEO 0x08
/* For RequestIO and ReleaseIO */
typedef struct io_req_t {
diff --git a/include/pcmcia/version.h b/include/pcmcia/version.h
index 4053e4982..eb88263fc 100644
--- a/include/pcmcia/version.h
+++ b/include/pcmcia/version.h
@@ -1,4 +1,4 @@
-/* version.h 1.102 2001/08/29 23:13:22 (David Hinds) */
+/* version.h 1.94 2000/10/03 17:55:48 (David Hinds) */
-#define CS_RELEASE "3.1.30"
-#define CS_RELEASE_CODE 0x311e
+#define CS_RELEASE "3.1.22"
+#define CS_RELEASE_CODE 0x3116
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 50f855bdc..9035ae798 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -272,10 +272,6 @@ static ctl_table vm_table[] = {
&pgt_cache_water, 2*sizeof(int), 0644, NULL, &proc_dointvec},
{VM_PAGE_CLUSTER, "page-cluster",
&page_cluster, sizeof(int), 0644, NULL, &proc_dointvec},
- {VM_MIN_READAHEAD, "min-readahead",
- &vm_min_readahead,sizeof(int), 0644, NULL, &proc_dointvec},
- {VM_MAX_READAHEAD, "max-readahead",
- &vm_max_readahead,sizeof(int), 0644, NULL, &proc_dointvec},
{0}
};
diff --git a/kernel/time.c b/kernel/time.c
index 1a1e73564..ffad77ad6 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -70,11 +70,11 @@ extern rwlock_t xtime_lock;
*/
asmlinkage long sys_time(int * tloc)
{
- struct timeval now;
- int i;
+ int i;
- do_gettimeofday(&now);
- i = now.tv_sec;
+ /* SMP: This is fairly trivial. We grab CURRENT_TIME and
+ stuff it to user space. No side effects */
+ i = CURRENT_TIME;
if (tloc) {
if (put_user(i,tloc))
i = -EFAULT;
diff --git a/mm/filemap.c b/mm/filemap.c
index fa5ec9d7a..89968606f 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -47,12 +47,6 @@ atomic_t page_cache_size = ATOMIC_INIT(0);
unsigned int page_hash_bits;
struct page **page_hash_table;
-int vm_max_readahead = 31;
-int vm_min_readahead = 3;
-EXPORT_SYMBOL(vm_max_readahead);
-EXPORT_SYMBOL(vm_min_readahead);
-
-
spinlock_t pagecache_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
/*
* NOTE: to avoid deadlocking you must never acquire the pagemap_lru_lock
@@ -1139,7 +1133,7 @@ static void profile_readahead(int async, struct file *filp)
static inline int get_max_readahead(struct inode * inode)
{
if (kdev_none(inode->i_dev) || !max_readahead[major(inode->i_dev)])
- return vm_max_readahead;
+ return MAX_READAHEAD;
return max_readahead[major(inode->i_dev)][minor(inode->i_dev)];
}
@@ -1322,8 +1316,8 @@ void do_generic_file_read(struct file * filp, loff_t *ppos, read_descriptor_t *
if (filp->f_ramax < needed)
filp->f_ramax = needed;
- if (reada_ok && filp->f_ramax < vm_min_readahead)
- filp->f_ramax = vm_min_readahead;
+ if (reada_ok && filp->f_ramax < MIN_READAHEAD)
+ filp->f_ramax = MIN_READAHEAD;
if (filp->f_ramax > max_readahead)
filp->f_ramax = max_readahead;
}
diff --git a/mm/memory.c b/mm/memory.c
index f4ef76985..e20f9d6e8 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1035,10 +1035,16 @@ out_unlock:
do_expand:
limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
- if (limit != RLIM_INFINITY && offset > limit)
- goto out_sig;
- if (offset > inode->i_sb->s_maxbytes)
- goto out;
+ if (limit != RLIM_INFINITY) {
+ if (inode->i_size >= limit) {
+ send_sig(SIGXFSZ, current, 0);
+ goto out;
+ }
+ if (offset > limit) {
+ send_sig(SIGXFSZ, current, 0);
+ offset = limit;
+ }
+ }
inode->i_size = offset;
out_truncate:
@@ -1047,11 +1053,8 @@ out_truncate:
inode->i_op->truncate(inode);
unlock_kernel();
}
- return 0;
-out_sig:
- send_sig(SIGXFSZ, current, 0);
out:
- return -EFBIG;
+ return 0;
}
/*
diff --git a/mm/shmem.c b/mm/shmem.c
index 1eb57db74..ddcac7a48 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1193,7 +1193,7 @@ static struct inode_operations shmem_symlink_inode_operations = {
follow_link: shmem_follow_link,
};
-static int shmem_parse_options(char *options, int *mode, uid_t *uid, gid_t *gid, unsigned long * blocks, unsigned long *inodes)
+static int shmem_parse_options(char *options, int *mode, unsigned long * blocks, unsigned long *inodes)
{
char *this_char, *value, *rest;
@@ -1205,7 +1205,7 @@ static int shmem_parse_options(char *options, int *mode, uid_t *uid, gid_t *gid,
*value++ = 0;
} else {
printk(KERN_ERR
- "tmpfs: No value for mount option '%s'\n",
+ "shmem_parse_options: No value for option '%s'\n",
this_char);
return 1;
}
@@ -1230,20 +1230,8 @@ static int shmem_parse_options(char *options, int *mode, uid_t *uid, gid_t *gid,
*mode = simple_strtoul(value,&rest,8);
if (*rest)
goto bad_val;
- } else if (!strcmp(this_char,"uid")) {
- if (!uid)
- continue;
- *uid = simple_strtoul(value,&rest,0);
- if (*rest)
- goto bad_val;
- } else if (!strcmp(this_char,"gid")) {
- if (!gid)
- continue;
- *gid = simple_strtoul(value,&rest,0);
- if (*rest)
- goto bad_val;
} else {
- printk(KERN_ERR "tmpfs: Bad mount option %s\n",
+ printk(KERN_ERR "shmem_parse_options: Bad option %s\n",
this_char);
return 1;
}
@@ -1251,7 +1239,7 @@ static int shmem_parse_options(char *options, int *mode, uid_t *uid, gid_t *gid,
return 0;
bad_val:
- printk(KERN_ERR "tmpfs: Bad value '%s' for mount option '%s'\n",
+ printk(KERN_ERR "shmem_parse_options: Bad value '%s' for option '%s'\n",
value, this_char);
return 1;
@@ -1263,7 +1251,7 @@ static int shmem_remount_fs (struct super_block *sb, int *flags, char *data)
unsigned long max_blocks = sbinfo->max_blocks;
unsigned long max_inodes = sbinfo->max_inodes;
- if (shmem_parse_options (data, NULL, NULL, NULL, &max_blocks, &max_inodes))
+ if (shmem_parse_options (data, NULL, &max_blocks, &max_inodes))
return -EINVAL;
return shmem_set_size(sbinfo, max_blocks, max_inodes);
}
@@ -1280,8 +1268,6 @@ static struct super_block *shmem_read_super(struct super_block * sb, void * data
struct dentry * root;
unsigned long blocks, inodes;
int mode = S_IRWXUGO | S_ISVTX;
- uid_t uid = current->fsuid;
- gid_t gid = current->fsgid;
struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
struct sysinfo si;
@@ -1293,8 +1279,10 @@ static struct super_block *shmem_read_super(struct super_block * sb, void * data
blocks = inodes = si.totalram / 2;
#ifdef CONFIG_TMPFS
- if (shmem_parse_options (data, &mode, &uid, &gid, &blocks, &inodes))
+ if (shmem_parse_options (data, &mode, &blocks, &inodes)) {
+ printk(KERN_ERR "tmpfs invalid option\n");
return NULL;
+ }
#endif
spin_lock_init (&sbinfo->stat_lock);
@@ -1311,8 +1299,6 @@ static struct super_block *shmem_read_super(struct super_block * sb, void * data
if (!inode)
return NULL;
- inode->i_uid = uid;
- inode->i_gid = gid;
root = d_alloc_root(inode);
if (!root) {
iput(inode);
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index b743e432e..87fd3e0ed 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -6,7 +6,6 @@
* SMP-safe vmalloc/vfree/ioremap, Tigran Aivazian <tigran@veritas.com>, May 2000
*/
-#include <linux/config.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/spinlock.h>
@@ -283,40 +282,3 @@ finished:
read_unlock(&vmlist_lock);
return buf - buf_start;
}
-
-long vwrite(char *buf, char *addr, unsigned long count)
-{
- struct vm_struct *tmp;
- char *vaddr, *buf_start = buf;
- unsigned long n;
-
- /* Don't allow overflow */
- if ((unsigned long) addr + count < count)
- count = -(unsigned long) addr;
-
- read_lock(&vmlist_lock);
- for (tmp = vmlist; tmp; tmp = tmp->next) {
- vaddr = (char *) tmp->addr;
- if (addr >= vaddr + tmp->size - PAGE_SIZE)
- continue;
- while (addr < vaddr) {
- if (count == 0)
- goto finished;
- buf++;
- addr++;
- count--;
- }
- n = vaddr + tmp->size - PAGE_SIZE - addr;
- do {
- if (count == 0)
- goto finished;
- *addr = *buf;
- buf++;
- addr++;
- count--;
- } while (--n > 0);
- }
-finished:
- read_unlock(&vmlist_lock);
- return buf - buf_start;
-}