summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cam.ac.uk>2002-03-18 23:29:13 +0000
committerAnton Altaparmakov <aia21@drop.stormcorp.org>2002-03-18 23:29:13 +0000
commitc1a6eca6a59514fd735f428abe416e8ea4b91aa2 (patch)
tree35c1cbff6ac0904035385c0fca62b4332bf0f9fc
parent3cc589c414b4e08b6f967d41cbd4e65df14ef5e3 (diff)
parent085c9a18acd4003fa77cf852aa770e52b2ce6a71 (diff)
Merge cam.ac.uk:/usr/src/bklinux-2.5
into cam.ac.uk:/usr/src/bkntfs-tng-2.5
-rw-r--r--Documentation/sound/alsa/serial-u16550.txt84
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/config.in1
-rw-r--r--arch/alpha/defconfig1
-rw-r--r--arch/arm/config.in1
-rw-r--r--arch/arm/def-configs/footbridge1
-rw-r--r--arch/arm/def-configs/iq803101
-rw-r--r--arch/cris/config.in1
-rw-r--r--arch/i386/config.in1
-rw-r--r--arch/i386/defconfig1
-rw-r--r--arch/ia64/config.in1
-rw-r--r--arch/ia64/defconfig1
-rw-r--r--arch/ia64/sn/configs/sn1/defconfig-bigsur-mp1
-rw-r--r--arch/ia64/sn/configs/sn1/defconfig-bigsur-sp1
-rw-r--r--arch/m68k/config.in1
-rw-r--r--arch/mips/config.in1
-rw-r--r--arch/mips/defconfig-ddb54761
-rw-r--r--arch/mips/defconfig-it81721
-rw-r--r--arch/mips64/config.in1
-rw-r--r--arch/ppc/config.in1
-rw-r--r--arch/ppc/configs/common_defconfig1
-rw-r--r--arch/ppc/configs/k2_defconfig1
-rw-r--r--arch/ppc/configs/menf1_defconfig1
-rw-r--r--arch/ppc/configs/mvme5100_defconfig1
-rw-r--r--arch/ppc/configs/pmac_defconfig1
-rw-r--r--arch/ppc/configs/pplus_defconfig1
-rw-r--r--arch/ppc/configs/sandpoint_defconfig1
-rw-r--r--arch/ppc/defconfig1
-rw-r--r--arch/ppc/kernel/align.c2
-rw-r--r--arch/ppc/kernel/prom_init.c16
-rw-r--r--arch/ppc/platforms/pmac_feature.c10
-rw-r--r--arch/ppc64/config.in1
-rw-r--r--arch/sh/config.in1
-rw-r--r--arch/sparc/config.in3
-rw-r--r--arch/sparc64/config.in1
-rw-r--r--arch/sparc64/defconfig1
-rw-r--r--arch/x86_64/config.in1
-rw-r--r--drivers/block/block_ioctl.c1
-rw-r--r--drivers/ide/Config.help73
-rw-r--r--drivers/ide/Config.in37
-rw-r--r--drivers/ide/Makefile1
-rw-r--r--drivers/ide/amd74xx.c41
-rw-r--r--drivers/ide/ide-disk.c128
-rw-r--r--drivers/ide/ide-pci.c37
-rw-r--r--drivers/ide/ide-proc.c12
-rw-r--r--drivers/ide/ide-taskfile.c312
-rw-r--r--drivers/ide/pdc4030.c8
-rw-r--r--drivers/ide/piix.c901
-rw-r--r--drivers/ide/slc90e66.c384
-rw-r--r--drivers/pci/pci.c55
-rw-r--r--drivers/pci/pci.ids47
-rw-r--r--drivers/pnp/isapnp.c56
-rw-r--r--drivers/usb/Config.help1
-rw-r--r--drivers/usb/catc.c291
-rw-r--r--drivers/usb/hid-core.c72
-rw-r--r--drivers/usb/hid.h3
-rw-r--r--drivers/usb/hiddev.c116
-rw-r--r--drivers/usb/printer.c603
-rw-r--r--drivers/usb/serial/cyberjack.c8
-rw-r--r--drivers/usb/serial/digi_acceleport.c14
-rw-r--r--drivers/usb/serial/empeg.c8
-rw-r--r--drivers/usb/serial/ftdi_sio.c4
-rw-r--r--drivers/usb/serial/io_edgeport.c18
-rw-r--r--drivers/usb/serial/ipaq.c4
-rw-r--r--drivers/usb/serial/ir-usb.c4
-rw-r--r--drivers/usb/serial/keyspan.c14
-rw-r--r--drivers/usb/serial/keyspan_pda.c4
-rw-r--r--drivers/usb/serial/kl5kusb105.c8
-rw-r--r--drivers/usb/serial/mct_u232.c2
-rw-r--r--drivers/usb/serial/omninet.c4
-rw-r--r--drivers/usb/serial/pl2303.c8
-rw-r--r--drivers/usb/serial/usbserial.c4
-rw-r--r--drivers/usb/serial/visor.c10
-rw-r--r--drivers/usb/serial/whiteheat.c2
-rw-r--r--fs/affs/amigaffs.c4
-rw-r--r--fs/affs/bitmap.c108
-rw-r--r--fs/affs/dir.c2
-rw-r--r--fs/affs/file.c22
-rw-r--r--fs/affs/inode.c45
-rw-r--r--fs/affs/namei.c14
-rw-r--r--fs/affs/super.c130
-rw-r--r--fs/affs/symlink.c2
-rw-r--r--fs/cramfs/uncompress.c18
-rw-r--r--fs/filesystems.c223
-rw-r--r--fs/hfs/super.c16
-rw-r--r--fs/inflate_fs/Makefile33
-rw-r--r--fs/inflate_fs/adler32.c48
-rw-r--r--fs/inflate_fs/infblock.c355
-rw-r--r--fs/inflate_fs/infblock.h44
-rw-r--r--fs/inflate_fs/infcodes.c204
-rw-r--r--fs/inflate_fs/infcodes.h33
-rw-r--r--fs/inflate_fs/inffast.c161
-rw-r--r--fs/inflate_fs/inffast.h17
-rw-r--r--fs/inflate_fs/inffixed.h151
-rw-r--r--fs/inflate_fs/inflate.c293
-rw-r--r--fs/inflate_fs/inflate_syms.c22
-rw-r--r--fs/inflate_fs/inftrees.c391
-rw-r--r--fs/inflate_fs/inftrees.h63
-rw-r--r--fs/inflate_fs/infutil.c87
-rw-r--r--fs/inflate_fs/infutil.h197
-rw-r--r--fs/inflate_fs/zutil.h70
-rw-r--r--fs/isofs/compress.c10
-rw-r--r--fs/isofs/dir.c17
-rw-r--r--fs/isofs/inode.c157
-rw-r--r--fs/isofs/joliet.c4
-rw-r--r--fs/isofs/namei.c13
-rw-r--r--fs/isofs/rock.c26
-rw-r--r--fs/jffs2/os-linux.h6
-rw-r--r--fs/jffs2/super.c202
-rw-r--r--fs/msdos/msdosfs_syms.c1
-rw-r--r--fs/msdos/namei.c12
-rw-r--r--fs/super.c225
-rw-r--r--fs/udf/super.c9
-rw-r--r--fs/udf/udf_sb.h6
-rw-r--r--fs/udf/udfdecl.h4
-rw-r--r--fs/umsdos/inode.c2
-rw-r--r--fs/vfat/namei.c2
-rw-r--r--include/asm-ppc/siginfo.h2
-rw-r--r--include/asm-ppc/thread_info.h9
-rw-r--r--include/linux/affs_fs.h1
-rw-r--r--include/linux/affs_fs_sb.h5
-rw-r--r--include/linux/amigaffs.h10
-rw-r--r--include/linux/fs.h12
-rw-r--r--include/linux/hfs_fs.h7
-rw-r--r--include/linux/hiddev.h12
-rw-r--r--include/linux/ide.h11
-rw-r--r--include/linux/if_wanpipe.h1
-rw-r--r--include/linux/iso_fs.h7
-rw-r--r--include/linux/jffs2_fs_sb.h5
-rw-r--r--include/linux/msdos_fs.h59
-rw-r--r--include/linux/msdos_fs_sb.h1
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/zlib_fs.h36
-rw-r--r--include/sound/asoundef.h6
-rw-r--r--include/sound/cs46xx.h4
-rw-r--r--include/sound/emu10k1.h13
-rw-r--r--include/sound/rawmidi.h2
-rw-r--r--include/sound/sndmagic.h1
-rw-r--r--include/sound/trident.h9
-rw-r--r--include/sound/version.h2
-rw-r--r--ipc/shm.c1
-rw-r--r--mm/shmem.c47
-rw-r--r--net/ipv4/netfilter/ip_conntrack_standalone.c2
-rw-r--r--net/wanrouter/af_wanpipe.c55
-rw-r--r--sound/core/Config.in6
-rw-r--r--sound/core/Makefile3
-rw-r--r--sound/core/ioctl32/Makefile3
-rw-r--r--sound/core/ioctl32/hwdep32.c4
-rw-r--r--sound/core/ioctl32/ioctl32.c28
-rw-r--r--sound/core/ioctl32/pcm32.c36
-rw-r--r--sound/core/ioctl32/rawmidi32.c9
-rw-r--r--sound/core/ioctl32/seq32.c64
-rw-r--r--sound/core/ioctl32/timer32.c9
-rw-r--r--sound/core/misc.c2
-rw-r--r--sound/core/oss/pcm_oss.c6
-rw-r--r--sound/core/pcm_native.c18
-rw-r--r--sound/core/rawmidi.c15
-rw-r--r--sound/core/rtctimer.c4
-rw-r--r--sound/core/seq/Makefile4
-rw-r--r--sound/core/seq/oss/seq_oss_init.c2
-rw-r--r--sound/core/seq/oss/seq_oss_midi.c2
-rw-r--r--sound/core/seq/oss/seq_oss_synth.c2
-rw-r--r--sound/core/seq/seq_device.c2
-rw-r--r--sound/core/seq/seq_dtl.c193
-rw-r--r--sound/core/seq/seq_midi_clock.c91
-rw-r--r--sound/core/seq/seq_mtc.c252
-rw-r--r--sound/core/seq/seq_queue.c58
-rw-r--r--sound/core/seq/seq_queue.h13
-rw-r--r--sound/core/seq/seq_sync.c1006
-rw-r--r--sound/core/seq/seq_sync.h79
-rw-r--r--sound/core/seq/seq_timer.h10
-rw-r--r--sound/drivers/serial-u16550.c99
-rw-r--r--sound/isa/ad1816a/ad1816a.c2
-rw-r--r--sound/isa/als100.c2
-rw-r--r--sound/isa/azt2320.c2
-rw-r--r--sound/isa/cmi8330.c2
-rw-r--r--sound/isa/cs423x/cs4236.c2
-rw-r--r--sound/isa/dt0197h.c2
-rw-r--r--sound/isa/es1688/es1688.c2
-rw-r--r--sound/isa/es18xx.c4
-rw-r--r--sound/isa/gus/gusclassic.c2
-rw-r--r--sound/isa/gus/gusextreme.c2
-rw-r--r--sound/isa/gus/gusmax.c2
-rw-r--r--sound/isa/gus/interwave.c4
-rw-r--r--sound/isa/opl3sa2.c2
-rw-r--r--sound/isa/sb/emu8000.c52
-rw-r--r--sound/isa/sb/es968.c2
-rw-r--r--sound/isa/sb/sb16.c4
-rw-r--r--sound/isa/sb/sb16_main.c7
-rw-r--r--sound/isa/sb/sb8.c2
-rw-r--r--sound/isa/sb/sb_common.c13
-rw-r--r--sound/isa/wavefront/Makefile12
-rw-r--r--sound/isa/wavefront/wavefront.c7
-rw-r--r--sound/isa/wavefront/wavefront_fx.c28
-rw-r--r--sound/isa/wavefront/wavefront_midi.c2
-rw-r--r--sound/isa/wavefront/wavefront_synth.c50
-rw-r--r--sound/pci/ac97/ac97_codec.c2
-rw-r--r--sound/pci/ali5451/ali5451.c2
-rw-r--r--sound/pci/als4000.c2
-rw-r--r--sound/pci/cmipci.c22
-rw-r--r--sound/pci/cs4281.c210
-rw-r--r--sound/pci/cs46xx/cs46xx.c17
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c122
-rw-r--r--sound/pci/emu10k1/Makefile2
-rw-r--r--sound/pci/emu10k1/emu10k1.c2
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c2
-rw-r--r--sound/pci/emu10k1/emupcm.c35
-rw-r--r--sound/pci/emu10k1/emuproc.c7
-rw-r--r--sound/pci/ens1370.c2
-rw-r--r--sound/pci/es1938.c2
-rw-r--r--sound/pci/es1968.c6
-rw-r--r--sound/pci/fm801.c2
-rw-r--r--sound/pci/ice1712.c6
-rw-r--r--sound/pci/intel8x0.c14
-rw-r--r--sound/pci/korg1212/korg1212.c2
-rw-r--r--sound/pci/maestro3.c32
-rw-r--r--sound/pci/nm256/nm256.c2
-rw-r--r--sound/pci/rme96.c2
-rw-r--r--sound/pci/rme9652/rme9652.c2
-rw-r--r--sound/pci/sonicvibes.c2
-rw-r--r--sound/pci/trident/trident.c4
-rw-r--r--sound/pci/trident/trident_main.c103
-rw-r--r--sound/pci/via686.c18
-rw-r--r--sound/pci/via8233.c10
-rw-r--r--sound/pci/ymfpci/ymfpci.c19
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c8
-rw-r--r--sound/ppc/pmac.c16
227 files changed, 3416 insertions, 6703 deletions
diff --git a/Documentation/sound/alsa/serial-u16550.txt b/Documentation/sound/alsa/serial-u16550.txt
new file mode 100644
index 000000000000..038e0d5a7ee4
--- /dev/null
+++ b/Documentation/sound/alsa/serial-u16550.txt
@@ -0,0 +1,84 @@
+
+ Serial UART 16450/16550 MIDI driver
+ ===================================
+
+The snd_adaptor module parameter allows you to select either:
+
+ 0 - Roland Soundcanvas support (default)
+ 1 - Midiator MS-124T support (1)
+ 2 - Midiator MS-124W S/A mode (2)
+ 3 - MS-124W M/B mode support (3)
+
+For the Midiator MS-124W, you must set the physical M-S and A-B
+switches on the Midiator to match the driver mode you select.
+
+In Roland Soundcanvas mode, multiple ALSA raw MIDI substreams are supported
+(midiCnD0-midiCnD15). Whenever you write to a different substream, the driver
+sends the nonstandard MIDI command sequence F5 NN, where NN is the substream
+number plus 1. Roland modules use this command to switch between different
+"parts", so this feature lets you treat each part as a distinct raw MIDI
+substream. The driver provides no way to send F5 00 (no selection) or to not
+send the F5 NN command sequence at all; perhaps it ought to.
+
+Usage example for simple serial converter:
+
+ /sbin/setserial /dev/ttyS0 none
+ /sbin/modprobe snd-serial-u16550 snd_port=0x3f8 snd_irq=4 \
+ snd_speed=115200
+
+Usage example for Roland SoundCanvas with 4 MIDI ports:
+
+ /sbin/setserial /dev/ttyS0 none
+ /sbin/modprobe snd-serial-u16550 snd_port=0x3f8 snd_irq=4 snd_outs=4
+
+In MS-124T mode, one raw MIDI substream is supported (midiCnD0); the snd_outs
+module parameter is automatically set to 1. The driver sends the same data to
+all four MIDI Out connectors. Set the A-B switch and the snd_speed module
+parameter to match (A=19200, B=9600).
+
+Usage example for MS-124T, with A-B switch in A position:
+
+ /sbin/setserial /dev/ttyS0 none
+ /sbin/modprobe snd-serial-u16550 snd_port=0x3f8 snd_irq=4 \
+ snd_adaptor=1 snd_speed=19200
+
+In MS-124W S/A mode, one raw MIDI substream is supported (midiCnD0);
+the snd_outs module parameter is automatically set to 1. The driver sends
+the same data to all four MIDI Out connectors at full MIDI speed.
+
+Usage example for S/A mode:
+
+ /sbin/setserial /dev/ttyS0 none
+ /sbin/modprobe snd-serial-u16550 snd_port=0x3f8 snd_irq=4 \
+ snd_adaptor=2
+
+In MS-124W M/B mode, the driver supports 16 ALSA raw MIDI substreams;
+the snd_outs module parameter is automatically set to 16. The substream
+number gives a bitmask of which MIDI Out connectors the data should be
+sent to, with midiCnD1 sending to Out 1, midiCnD2 to Out 2, midiCnD4 to
+Out 3, and midiCnD8 to Out 4. Thus midiCnD15 sends the data to all 4 ports.
+As a special case, midiCnD0 also sends to all ports, since it is not useful
+to send the data to no ports. M/B mode has extra overhead to select the MIDI
+Out for each byte, so the aggregate data rate across all four MIDI Outs is
+at most one byte every 520 us, as compared with the full MIDI data rate of
+one byte every 320 us per port.
+
+Usage example for M/B mode:
+
+ /sbin/setserial /dev/ttyS0 none
+ /sbin/modprobe snd-serial-u16550 snd_port=0x3f8 snd_irq=4 \
+ snd_adaptor=3
+
+The MS-124W hardware's M/A mode is currently not supported. This mode allows
+the MIDI Outs to act independently at double the aggregate throughput of M/B,
+but does not allow sending the same byte simultaneously to multiple MIDI Outs.
+The M/A protocol requires the driver to twiddle the modem control lines under
+timing constraints, so it would be a bit more complicated to implement than
+the other modes.
+
+Midiator models other than MS-124W and MS-124T are currently not supported.
+Note that the suffix letter is significant; the MS-124 and MS-124B are not
+compatible, nor are the other known models MS-101, MS-101B, MS-103, and MS-114.
+I do have documentation (tim.mann@compaq.com) that partially covers these models,
+but no units to experiment with. The MS-124W support is tested with a real unit.
+The MS-124T support is untested, but should work.
diff --git a/Makefile b/Makefile
index a9a6575bc261..b3aef7bd7c3a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
VERSION = 2
PATCHLEVEL = 5
SUBLEVEL = 7
-EXTRAVERSION =-pre2
+EXTRAVERSION =
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
diff --git a/arch/alpha/config.in b/arch/alpha/config.in
index b843c52b8abb..2a31630248eb 100644
--- a/arch/alpha/config.in
+++ b/arch/alpha/config.in
@@ -290,7 +290,6 @@ tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
diff --git a/arch/alpha/defconfig b/arch/alpha/defconfig
index 59cd01db28c2..dd9ee4b566bb 100644
--- a/arch/alpha/defconfig
+++ b/arch/alpha/defconfig
@@ -274,7 +274,6 @@ CONFIG_BLK_DEV_CY82C693=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_IDE_CHIPSETS is not set
diff --git a/arch/arm/config.in b/arch/arm/config.in
index f69db6f8608e..544f39b44176 100644
--- a/arch/arm/config.in
+++ b/arch/arm/config.in
@@ -564,7 +564,6 @@ tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
diff --git a/arch/arm/def-configs/footbridge b/arch/arm/def-configs/footbridge
index 255c99945604..4e3e73f066db 100644
--- a/arch/arm/def-configs/footbridge
+++ b/arch/arm/def-configs/footbridge
@@ -429,7 +429,6 @@ CONFIG_BLK_DEV_PDC202XX=y
# CONFIG_PDC202XX_BURST is not set
# CONFIG_BLK_DEV_OSB4 is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
CONFIG_BLK_DEV_SL82C105=y
diff --git a/arch/arm/def-configs/iq80310 b/arch/arm/def-configs/iq80310
index d6c12dc3fc54..25fe045db605 100644
--- a/arch/arm/def-configs/iq80310
+++ b/arch/arm/def-configs/iq80310
@@ -478,7 +478,6 @@ CONFIG_BLK_DEV_CMD64X=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_BLK_DEV_SL82C105 is not set
diff --git a/arch/cris/config.in b/arch/cris/config.in
index a221b5a37a66..9dccc71cc89e 100644
--- a/arch/cris/config.in
+++ b/arch/cris/config.in
@@ -149,7 +149,6 @@ tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
diff --git a/arch/i386/config.in b/arch/i386/config.in
index da4d7c67840f..b3109591a1d9 100644
--- a/arch/i386/config.in
+++ b/arch/i386/config.in
@@ -305,7 +305,6 @@ tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index e0e4c0b764a2..2c7f6ed01ddb 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -285,7 +285,6 @@ CONFIG_PIIX_TUNING=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_IDE_CHIPSETS is not set
diff --git a/arch/ia64/config.in b/arch/ia64/config.in
index 7baef59260a3..51043891a3ed 100644
--- a/arch/ia64/config.in
+++ b/arch/ia64/config.in
@@ -131,7 +131,6 @@ tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig
index 2544fd6f7881..50a7d883cbe3 100644
--- a/arch/ia64/defconfig
+++ b/arch/ia64/defconfig
@@ -248,7 +248,6 @@ CONFIG_BLK_DEV_PIIX=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_IDE_CHIPSETS is not set
diff --git a/arch/ia64/sn/configs/sn1/defconfig-bigsur-mp b/arch/ia64/sn/configs/sn1/defconfig-bigsur-mp
index 1967955d0957..2c67f771e32e 100644
--- a/arch/ia64/sn/configs/sn1/defconfig-bigsur-mp
+++ b/arch/ia64/sn/configs/sn1/defconfig-bigsur-mp
@@ -235,7 +235,6 @@ CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_IDE_CHIPSETS is not set
diff --git a/arch/ia64/sn/configs/sn1/defconfig-bigsur-sp b/arch/ia64/sn/configs/sn1/defconfig-bigsur-sp
index 529d9462ee5f..c85ebdcd23e0 100644
--- a/arch/ia64/sn/configs/sn1/defconfig-bigsur-sp
+++ b/arch/ia64/sn/configs/sn1/defconfig-bigsur-sp
@@ -235,7 +235,6 @@ CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_IDE_CHIPSETS is not set
diff --git a/arch/m68k/config.in b/arch/m68k/config.in
index b6aa81d768f1..748682f87329 100644
--- a/arch/m68k/config.in
+++ b/arch/m68k/config.in
@@ -161,7 +161,6 @@ tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
diff --git a/arch/mips/config.in b/arch/mips/config.in
index 13776792c008..bdbe88279e01 100644
--- a/arch/mips/config.in
+++ b/arch/mips/config.in
@@ -350,7 +350,6 @@ if [ "$CONFIG_SGI_IP22" != "y" -a \
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
diff --git a/arch/mips/defconfig-ddb5476 b/arch/mips/defconfig-ddb5476
index c828106e7ac1..d9131599751d 100644
--- a/arch/mips/defconfig-ddb5476
+++ b/arch/mips/defconfig-ddb5476
@@ -248,7 +248,6 @@ CONFIG_BLK_DEV_IDEPCI=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_IDE_CHIPSETS is not set
diff --git a/arch/mips/defconfig-it8172 b/arch/mips/defconfig-it8172
index cfecefc32251..0ec9b23be7b5 100644
--- a/arch/mips/defconfig-it8172
+++ b/arch/mips/defconfig-it8172
@@ -317,7 +317,6 @@ CONFIG_IT8172_TUNING=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
CONFIG_IDE_CHIPSETS=y
diff --git a/arch/mips64/config.in b/arch/mips64/config.in
index 097257e962d3..f3794f954ca3 100644
--- a/arch/mips64/config.in
+++ b/arch/mips64/config.in
@@ -147,7 +147,6 @@ tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
diff --git a/arch/ppc/config.in b/arch/ppc/config.in
index 0ce770f31088..56236405a6c0 100644
--- a/arch/ppc/config.in
+++ b/arch/ppc/config.in
@@ -425,7 +425,6 @@ tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
diff --git a/arch/ppc/configs/common_defconfig b/arch/ppc/configs/common_defconfig
index 02baf6399542..d826a338ac4c 100644
--- a/arch/ppc/configs/common_defconfig
+++ b/arch/ppc/configs/common_defconfig
@@ -276,7 +276,6 @@ CONFIG_BLK_DEV_CMD64X=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
CONFIG_BLK_DEV_SL82C105=y
diff --git a/arch/ppc/configs/k2_defconfig b/arch/ppc/configs/k2_defconfig
index 2f70360bf6e2..92c8e9aa463d 100644
--- a/arch/ppc/configs/k2_defconfig
+++ b/arch/ppc/configs/k2_defconfig
@@ -259,7 +259,6 @@ CONFIG_BLK_DEV_ALI15X3=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_BLK_DEV_SL82C105 is not set
diff --git a/arch/ppc/configs/menf1_defconfig b/arch/ppc/configs/menf1_defconfig
index c65a35dc92e1..6f925a89e365 100644
--- a/arch/ppc/configs/menf1_defconfig
+++ b/arch/ppc/configs/menf1_defconfig
@@ -263,7 +263,6 @@ CONFIG_BLK_DEV_IDEPCI=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_BLK_DEV_SL82C105 is not set
diff --git a/arch/ppc/configs/mvme5100_defconfig b/arch/ppc/configs/mvme5100_defconfig
index 66bbeaebd59f..3d4dd9d56dae 100644
--- a/arch/ppc/configs/mvme5100_defconfig
+++ b/arch/ppc/configs/mvme5100_defconfig
@@ -256,7 +256,6 @@ CONFIG_BLK_DEV_IDEPCI=y
# CONFIG_PDC202XX_BURST is not set
# CONFIG_BLK_DEV_OSB4 is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_BLK_DEV_SL82C105 is not set
diff --git a/arch/ppc/configs/pmac_defconfig b/arch/ppc/configs/pmac_defconfig
index faf18d017581..d25fef453815 100644
--- a/arch/ppc/configs/pmac_defconfig
+++ b/arch/ppc/configs/pmac_defconfig
@@ -266,7 +266,6 @@ CONFIG_BLK_DEV_CMD64X=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
CONFIG_BLK_DEV_SL82C105=y
diff --git a/arch/ppc/configs/pplus_defconfig b/arch/ppc/configs/pplus_defconfig
index 0f5312e8ce74..c70ce05e5d00 100644
--- a/arch/ppc/configs/pplus_defconfig
+++ b/arch/ppc/configs/pplus_defconfig
@@ -270,7 +270,6 @@ CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
CONFIG_BLK_DEV_VIA82CXXX=y
CONFIG_BLK_DEV_SL82C105=y
diff --git a/arch/ppc/configs/sandpoint_defconfig b/arch/ppc/configs/sandpoint_defconfig
index 797d68953bd5..405039e6b5a7 100644
--- a/arch/ppc/configs/sandpoint_defconfig
+++ b/arch/ppc/configs/sandpoint_defconfig
@@ -233,7 +233,6 @@ CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
CONFIG_BLK_DEV_SL82C105=y
diff --git a/arch/ppc/defconfig b/arch/ppc/defconfig
index 02baf6399542..d826a338ac4c 100644
--- a/arch/ppc/defconfig
+++ b/arch/ppc/defconfig
@@ -276,7 +276,6 @@ CONFIG_BLK_DEV_CMD64X=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
CONFIG_BLK_DEV_SL82C105=y
diff --git a/arch/ppc/kernel/align.c b/arch/ppc/kernel/align.c
index 0f8dbd1cb585..ed023aace203 100644
--- a/arch/ppc/kernel/align.c
+++ b/arch/ppc/kernel/align.c
@@ -28,7 +28,7 @@ struct aligninfo {
#define OPCD(inst) (((inst) & 0xFC000000) >> 26)
#define RS(inst) (((inst) & 0x03E00000) >> 21)
#define RA(inst) (((inst) & 0x001F0000) >> 16)
-#define IS_DFORM(code) ((code) >= 32 && (code) <= 47)
+#define IS_DFORM(code) ((code) >= 32 && (code) <= 55)
#endif
#define INVALID { 0, 0 }
diff --git a/arch/ppc/kernel/prom_init.c b/arch/ppc/kernel/prom_init.c
index fea41427aa29..96f43675dae8 100644
--- a/arch/ppc/kernel/prom_init.c
+++ b/arch/ppc/kernel/prom_init.c
@@ -50,7 +50,7 @@
#define FB_MAX 8
#endif
-#define ALIGN(x) (((x) + sizeof(unsigned long)-1) & -sizeof(unsigned long))
+#define ALIGNUL(x) (((x) + sizeof(unsigned long)-1) & -sizeof(unsigned long))
struct prom_args {
const char *service;
@@ -376,7 +376,7 @@ try_again:
}
}
- return ALIGN(mem);
+ return ALIGNUL(mem);
}
/* This function will enable the early boot text when doing OF booting. This
@@ -457,7 +457,7 @@ copy_device_tree(unsigned long mem_start, unsigned long mem_end)
prom_exit();
}
allnextp = &allnodes;
- mem_start = ALIGN(mem_start);
+ mem_start = ALIGNUL(mem_start);
new_start = inspect_node(root, 0, mem_start, mem_end, &allnextp);
*allnextp = 0;
return new_start;
@@ -501,7 +501,7 @@ inspect_node(phandle node, struct device_node *dad,
if ((int) call_prom("nextprop", 3, 1, node, prev_name,
namep) <= 0)
break;
- mem_start = ALIGN((unsigned long)namep + strlen(namep) + 1);
+ mem_start = ALIGNUL((unsigned long)namep + strlen(namep) + 1);
prev_name = namep;
valp = (unsigned char *) mem_start;
pp->value = PTRUNRELOC(valp);
@@ -514,7 +514,7 @@ inspect_node(phandle node, struct device_node *dad,
if (pp->length > MAX_PROPERTY_LENGTH)
continue; /* ignore this property */
#endif
- mem_start = ALIGN(mem_start + pp->length);
+ mem_start = ALIGNUL(mem_start + pp->length);
*prev_propp = PTRUNRELOC(pp);
prev_propp = &pp->next;
}
@@ -526,7 +526,7 @@ inspect_node(phandle node, struct device_node *dad,
namep = (char *) (pp + 1);
pp->name = PTRUNRELOC(namep);
strcpy(namep, "linux,phandle");
- mem_start = ALIGN((unsigned long)namep + strlen(namep) + 1);
+ mem_start = ALIGNUL((unsigned long)namep + strlen(namep) + 1);
pp->value = (unsigned char *) PTRUNRELOC(&np->node);
pp->length = sizeof(np->node);
}
@@ -538,7 +538,7 @@ inspect_node(phandle node, struct device_node *dad,
if (l >= 0) {
np->full_name = PTRUNRELOC((char *) mem_start);
*(char *)(mem_start + l) = 0;
- mem_start = ALIGN(mem_start + l + 1);
+ mem_start = ALIGNUL(mem_start + l + 1);
}
/* do all our children */
@@ -741,7 +741,7 @@ prom_init(int r3, int r4, prom_entry pp)
*d = 0;
call_prom("canon", 3, 1, p, d, 1<<20);
bootdevice = PTRUNRELOC(d);
- mem = ALIGN(mem + strlen(d) + 1);
+ mem = ALIGNUL(mem + strlen(d) + 1);
}
prom_instantiate_rtas();
diff --git a/arch/ppc/platforms/pmac_feature.c b/arch/ppc/platforms/pmac_feature.c
index 3a930be3e77d..ee134a1b84cf 100644
--- a/arch/ppc/platforms/pmac_feature.c
+++ b/arch/ppc/platforms/pmac_feature.c
@@ -400,13 +400,17 @@ heathrow_modem_enable(struct device_node* node, int param, int value)
LOCK(flags);
MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio | 1);
(void)MACIO_IN8(HRW_GPIO_MODEM_RESET);
- UNLOCK(flags); mdelay(250); LOCK(flags);
+ UNLOCK(flags);
+ mdelay(250);
+ LOCK(flags);
MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio);
(void)MACIO_IN8(HRW_GPIO_MODEM_RESET);
- UNLOCK(flags); mdelay(250); LOCK(flags);
+ UNLOCK(flags);
+ mdelay(250);
+ LOCK(flags);
MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio | 1);
(void)MACIO_IN8(HRW_GPIO_MODEM_RESET);
- UNLOCK(flags); mdelay(250); LOCK(flags);
+ UNLOCK(flags);
}
return 0;
}
diff --git a/arch/ppc64/config.in b/arch/ppc64/config.in
index c57c274513c6..e85963d01ace 100644
--- a/arch/ppc64/config.in
+++ b/arch/ppc64/config.in
@@ -92,7 +92,6 @@ tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
diff --git a/arch/sh/config.in b/arch/sh/config.in
index 6ad267cc0359..136513eeb6e5 100644
--- a/arch/sh/config.in
+++ b/arch/sh/config.in
@@ -218,7 +218,6 @@ tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
diff --git a/arch/sparc/config.in b/arch/sparc/config.in
index 68e5d2cd37b8..7b2e49484672 100644
--- a/arch/sparc/config.in
+++ b/arch/sparc/config.in
@@ -110,14 +110,11 @@ if [ "$CONFIG_PCI" = "y" ]; then
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
else
-
define_bool CONFIG_IDE n
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
diff --git a/arch/sparc64/config.in b/arch/sparc64/config.in
index ca9aad5a622e..a1d3657e1f33 100644
--- a/arch/sparc64/config.in
+++ b/arch/sparc64/config.in
@@ -112,7 +112,6 @@ tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index 0be67d861dde..98b73d973b4a 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -311,7 +311,6 @@ CONFIG_BLK_DEV_NS87415=y
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_IDE_CHIPSETS is not set
diff --git a/arch/x86_64/config.in b/arch/x86_64/config.in
index fecd3945c0d1..6949d6a68688 100644
--- a/arch/x86_64/config.in
+++ b/arch/x86_64/config.in
@@ -122,7 +122,6 @@ tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
if [ "$CONFIG_IDE" != "n" ]; then
source drivers/ide/Config.in
else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
define_bool CONFIG_BLK_DEV_HD n
fi
endmenu
diff --git a/drivers/block/block_ioctl.c b/drivers/block/block_ioctl.c
index e206157da22d..60b2fb3c0c64 100644
--- a/drivers/block/block_ioctl.c
+++ b/drivers/block/block_ioctl.c
@@ -27,6 +27,7 @@
#include <linux/smp_lock.h>
#include <linux/module.h>
#include <linux/blk.h>
+#include <linux/completion.h>
#include <linux/cdrom.h>
diff --git a/drivers/ide/Config.help b/drivers/ide/Config.help
index e8bc233729fd..248d80742c20 100644
--- a/drivers/ide/Config.help
+++ b/drivers/ide/Config.help
@@ -352,19 +352,10 @@ CONFIG_WDC_ALI15X3
SAY N!
CONFIG_BLK_DEV_AMD74XX
- This driver ensures (U)DMA support for the AMD756/760 Viper
- chipsets.
-
- If you say Y here, you also need to say Y to "Use DMA by default
- when available", above.
- Please read the comments at the top of <file:drivers/ide/amd74xx.c>.
-
- If unsure, say N.
-
-CONFIG_AMD74XX_OVERRIDE
- This option auto-forces the ata66 flag.
- This effect can be also invoked by calling "idex=ata66"
- If unsure, say N.
+ This driver adds explicit support for AMD-7xx and AMD-8111 chips
+ and also for the nVidia nForce chip. This allows the kernel to
+ change PIO, DMA and UDMA speeds and to configure the chip to
+ optimum performance.
CONFIG_BLK_DEV_CMD64X
Say Y here if you have an IDE controller which uses any of these
@@ -435,28 +426,10 @@ CONFIG_BLK_DEV_SVWKS
chipsets.
CONFIG_BLK_DEV_PIIX
- This driver adds PIO mode setting and tuning for all PIIX IDE
- controllers by Intel. Since the BIOS can sometimes improperly tune
- PIO 0-4 mode settings, this allows dynamic tuning of the chipset
- via the standard end-user tool 'hdparm'.
-
- Please read the comments at the top of <file:drivers/ide/piix.c>.
-
- If you say Y here, you should also say Y to "PIIXn Tuning support",
- below.
-
- If unsure, say N.
-
-CONFIG_PIIX_TUNING
- This driver extension adds DMA mode setting and tuning for all PIIX
- IDE controllers by Intel. Since the BIOS can sometimes improperly
- set up the device/adapter combination and speed limits, it has
- become a necessity to back/forward speed devices as needed.
-
- Case 430HX/440FX PIIX3 need speed limits to reduce UDMA to DMA mode
- 2 if the BIOS can not perform this task at initialization.
-
- If unsure, say N.
+ This driver adds explicit support for Intel PIIX and ICH chips
+ and also for the Efar Victory66 (slc90e66) chip. This allows
+ the kernel to change PIO, DMA and UDMA speeds and to configure
+ the chip to optimum performance.
CONFIG_BLK_DEV_PDC202XX
Promise Ultra33 or PDC20246
@@ -513,19 +486,6 @@ CONFIG_BLK_DEV_SIS5513
Please read the comments at the top of <file:drivers/ide/sis5513.c>.
-CONFIG_BLK_DEV_SLC90E66
- This driver ensures (U)DMA support for Victroy66 SouthBridges for
- SMsC with Intel NorthBridges. This is an Ultra66 based chipset.
- The nice thing about it is that you can mix Ultra/DMA/PIO devices
- and it will handle timing cycles. Since this is an improved
- look-a-like to the PIIX4 it should be a nice addition.
-
- If you say Y here, you need to say Y to "Use DMA by default when
- available" as well.
-
- Please read the comments at the top of
- <file:drivers/ide/slc90e66.c>.
-
CONFIG_BLK_DEV_SL82C105
If you have a Winbond SL82c105 IDE controller, say Y here to enable
special configuration for this chip. This is common on various CHRP
@@ -538,20 +498,9 @@ CONFIG_BLK_DEV_TRM290
Please read the comments at the top of <file:drivers/ide/trm290.c>.
CONFIG_BLK_DEV_VIA82CXXX
- This allows you to configure your chipset for a better use while
- running PIO/(U)DMA, it will allow you to enable efficiently the
- second channel dma usage, as it may not be set by BIOS. It will try
- to set fifo configuration at its best. It will allow you to get
- information from /proc/ide/via provided you enabled "/proc file
- system" support.
-
- Please read the comments at the top of
- <file:drivers/ide/via82cxxx.c>.
-
- If you say Y here, then say Y to "Use DMA by default when available"
- as well.
-
- If unsure, say N.
+ This driver adds explicit support for VIA BusMastering IDE chips.
+ This allows the kernel to change PIO, DMA and UDMA speeds and to
+ configure the chip to optimum performance.
CONFIG_BLK_DEV_IDE_RAPIDE
Say Y here if you want to support the Yellowstone RapIDE controller
diff --git a/drivers/ide/Config.in b/drivers/ide/Config.in
index ffbc8697a02e..342d76d0073d 100644
--- a/drivers/ide/Config.in
+++ b/drivers/ide/Config.in
@@ -53,18 +53,14 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then
dep_mbool ' AEC62XX Tuning support' CONFIG_AEC62XX_TUNING $CONFIG_BLK_DEV_AEC62XX
dep_bool ' ALI M15x3 chipset support' CONFIG_BLK_DEV_ALI15X3 $CONFIG_BLK_DEV_IDEDMA_PCI
dep_mbool ' ALI M15x3 WDC support (DANGEROUS)' CONFIG_WDC_ALI15X3 $CONFIG_BLK_DEV_ALI15X3
- dep_bool ' AMD Viper support' CONFIG_BLK_DEV_AMD74XX $CONFIG_BLK_DEV_IDEDMA_PCI
- dep_mbool ' AMD Viper ATA-66 Override (WIP)' CONFIG_AMD74XX_OVERRIDE $CONFIG_BLK_DEV_AMD74XX $CONFIG_IDEDMA_PCI_WIP
+ dep_bool ' AMD and nVidia chipset support' CONFIG_BLK_DEV_AMD74XX $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' CMD64X chipset support' CONFIG_BLK_DEV_CMD64X $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' CY82C693 chipset support' CONFIG_BLK_DEV_CY82C693 $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' Cyrix CS5530 MediaGX chipset support' CONFIG_BLK_DEV_CS5530 $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool ' HPT34X chipset support' CONFIG_BLK_DEV_HPT34X $CONFIG_BLK_DEV_IDEDMA_PCI
dep_mbool ' HPT34X AUTODMA support (WIP)' CONFIG_HPT34X_AUTODMA $CONFIG_BLK_DEV_HPT34X $CONFIG_IDEDMA_PCI_WIP
dep_bool ' HPT366 chipset support' CONFIG_BLK_DEV_HPT366 $CONFIG_BLK_DEV_IDEDMA_PCI
- if [ "$CONFIG_X86" = "y" -o "$CONFIG_IA64" = "y" ]; then
- dep_mbool ' Intel PIIXn chipsets support' CONFIG_BLK_DEV_PIIX $CONFIG_BLK_DEV_IDEDMA_PCI
- dep_mbool ' PIIXn Tuning support' CONFIG_PIIX_TUNING $CONFIG_BLK_DEV_PIIX $CONFIG_IDEDMA_PCI_AUTO
- fi
+ dep_bool ' Intel and Efar (SMsC) chipset support' CONFIG_BLK_DEV_PIIX $CONFIG_BLK_DEV_IDEDMA_PCI
if [ "$CONFIG_MIPS_ITE8172" = "y" -o "$CONFIG_MIPS_IVR" = "y" ]; then
dep_mbool ' IT8172 IDE support' CONFIG_BLK_DEV_IT8172 $CONFIG_BLK_DEV_IDEDMA_PCI
dep_mbool ' IT8172 IDE Tuning support' CONFIG_IT8172_TUNING $CONFIG_BLK_DEV_IT8172 $CONFIG_IDEDMA_PCI_AUTO
@@ -77,9 +73,8 @@ if [ "$CONFIG_BLK_DEV_IDE" != "n" ]; then
dep_bool ' Special FastTrak Feature' CONFIG_PDC202XX_FORCE $CONFIG_BLK_DEV_PDC202XX
dep_bool ' ServerWorks OSB4/CSB5 chipsets support' CONFIG_BLK_DEV_SVWKS $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_X86
dep_bool ' SiS5513 chipset support' CONFIG_BLK_DEV_SIS5513 $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_X86
- dep_bool ' SLC90E66 chipset support' CONFIG_BLK_DEV_SLC90E66 $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_X86
dep_bool ' Tekram TRM290 chipset support (EXPERIMENTAL)' CONFIG_BLK_DEV_TRM290 $CONFIG_BLK_DEV_IDEDMA_PCI
- dep_bool ' VIA82CXXX chipset support' CONFIG_BLK_DEV_VIA82CXXX $CONFIG_BLK_DEV_IDEDMA_PCI
+ dep_bool ' VIA chipset support' CONFIG_BLK_DEV_VIA82CXXX $CONFIG_BLK_DEV_IDEDMA_PCI
fi
if [ "$CONFIG_PPC" = "y" -o "$CONFIG_ARM" = "y" ]; then
@@ -167,32 +162,6 @@ else
define_bool CONFIG_DMA_NONPCI n
fi
-if [ "$CONFIG_IDE_CHIPSETS" = "y" -o \
- "$CONFIG_BLK_DEV_AEC62XX" = "y" -o \
- "$CONFIG_BLK_DEV_ALI15X3" = "y" -o \
- "$CONFIG_BLK_DEV_AMD74XX" = "y" -o \
- "$CONFIG_BLK_DEV_CMD640" = "y" -o \
- "$CONFIG_BLK_DEV_CMD64X" = "y" -o \
- "$CONFIG_BLK_DEV_CS5530" = "y" -o \
- "$CONFIG_BLK_DEV_CY82C693" = "y" -o \
- "$CONFIG_BLK_DEV_HPT34X" = "y" -o \
- "$CONFIG_BLK_DEV_HPT366" = "y" -o \
- "$CONFIG_BLK_DEV_IDE_PMAC" = "y" -o \
- "$CONFIG_BLK_DEV_OPTI621" = "y" -o \
- "$CONFIG_BLK_DEV_SVWKS" = "y" -o \
- "$CONFIG_BLK_DEV_PDC202XX" = "y" -o \
- "$CONFIG_BLK_DEV_PIIX" = "y" -o \
- "$CONFIG_BLK_DEV_IT8172" = "y" -o \
- "$CONFIG_BLK_DEV_SIS5513" = "y" -o \
- "$CONFIG_BLK_DEV_SLC90E66" = "y" -o \
- "$CONFIG_BLK_DEV_SL82C105" = "y" -o \
- "$CONFIG_BLK_DEV_VIA82CXXX" = "y" -o \
- "$CONFIG_BLK_DEV_MPC8xx_IDE" = "y" ]; then
- define_bool CONFIG_BLK_DEV_IDE_MODES y
-else
- define_bool CONFIG_BLK_DEV_IDE_MODES n
-fi
-
dep_tristate 'Support for IDE Raid controllers' CONFIG_BLK_DEV_ATARAID $CONFIG_BLK_DEV_IDE $CONFIG_EXPERIMENTAL
dep_tristate ' Support Promise software RAID (Fasttrak(tm))' CONFIG_BLK_DEV_ATARAID_PDC $CONFIG_BLK_DEV_IDE $CONFIG_EXPERIMENTAL $CONFIG_BLK_DEV_ATARAID
dep_tristate ' Highpoint 370 software RAID' CONFIG_BLK_DEV_ATARAID_HPT $CONFIG_BLK_DEV_IDE $CONFIG_EXPERIMENTAL $CONFIG_BLK_DEV_ATARAID
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile
index b72a5bedd157..3142a91f6f01 100644
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -60,7 +60,6 @@ ide-obj-$(CONFIG_BLK_DEV_QD65XX) += qd65xx.o
ide-obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o
ide-obj-$(CONFIG_BLK_DEV_RZ1000) += rz1000.o
ide-obj-$(CONFIG_BLK_DEV_SIS5513) += sis5513.o
-ide-obj-$(CONFIG_BLK_DEV_SLC90E66) += slc90e66.o
ide-obj-$(CONFIG_BLK_DEV_SL82C105) += sl82c105.o
ide-obj-$(CONFIG_BLK_DEV_TRM290) += trm290.o
ide-obj-$(CONFIG_BLK_DEV_UMC8672) += umc8672.o
diff --git a/drivers/ide/amd74xx.c b/drivers/ide/amd74xx.c
index df0532a881c6..c1c036e36fb4 100644
--- a/drivers/ide/amd74xx.c
+++ b/drivers/ide/amd74xx.c
@@ -1,5 +1,5 @@
/*
- * $Id: amd74xx.c,v 2.7 2002/09/01 17:37:00 vojtech Exp $
+ * $Id: amd74xx.c,v 2.8 2002/03/14 11:52:20 vojtech Exp $
*
* Copyright (c) 2000-2002 Vojtech Pavlik
*
@@ -46,13 +46,13 @@
#include "ata-timing.h"
-#define AMD_IDE_ENABLE 0x40
-#define AMD_IDE_CONFIG 0x41
-#define AMD_CABLE_DETECT 0x42
-#define AMD_DRIVE_TIMING 0x48
-#define AMD_8BIT_TIMING 0x4e
-#define AMD_ADDRESS_SETUP 0x4c
-#define AMD_UDMA_TIMING 0x50
+#define AMD_IDE_ENABLE (0x00 + amd_config->base)
+#define AMD_IDE_CONFIG (0x01 + amd_config->base)
+#define AMD_CABLE_DETECT (0x02 + amd_config->base)
+#define AMD_DRIVE_TIMING (0x08 + amd_config->base)
+#define AMD_8BIT_TIMING (0x0e + amd_config->base)
+#define AMD_ADDRESS_SETUP (0x0c + amd_config->base)
+#define AMD_UDMA_TIMING (0x10 + amd_config->base)
#define AMD_UDMA 0x07
#define AMD_UDMA_33 0x01
@@ -66,18 +66,19 @@
*/
static struct amd_ide_chip {
- char *name;
unsigned short id;
unsigned char rev;
+ unsigned int base;
unsigned char flags;
} amd_ide_chips[] = {
- { "8111", PCI_DEVICE_ID_AMD_8111_IDE, 0x00, AMD_UDMA_100 },
- { "768 Opus", PCI_DEVICE_ID_AMD_OPUS_7441, 0x00, AMD_UDMA_100 },
- { "766 Viper", PCI_DEVICE_ID_AMD_VIPER_7411, 0x00, AMD_UDMA_100 | AMD_BAD_FIFO },
- { "756/c4+ Viper", PCI_DEVICE_ID_AMD_VIPER_7409, 0x07, AMD_UDMA_66 },
- { "756 Viper", PCI_DEVICE_ID_AMD_VIPER_7409, 0x00, AMD_UDMA_66 | AMD_BAD_SWDMA },
- { "755 Cobra", PCI_DEVICE_ID_AMD_COBRA_7401, 0x00, AMD_UDMA_33 | AMD_BAD_SWDMA },
- { NULL }
+ { PCI_DEVICE_ID_AMD_8111_IDE, 0x00, 0x40, AMD_UDMA_100 }, /* AMD-8111 */
+ { PCI_DEVICE_ID_AMD_OPUS_7441, 0x00, 0x40, AMD_UDMA_100 }, /* AMD-768 Opus */
+ { PCI_DEVICE_ID_AMD_VIPER_7411, 0x00, 0x40, AMD_UDMA_100 | AMD_BAD_FIFO }, /* AMD-766 Viper */
+ { PCI_DEVICE_ID_AMD_VIPER_7409, 0x07, 0x40, AMD_UDMA_66 }, /* AMD-756/c4+ Viper */
+ { PCI_DEVICE_ID_AMD_VIPER_7409, 0x00, 0x40, AMD_UDMA_66 | AMD_BAD_SWDMA }, /* AMD-756 Viper */
+ { PCI_DEVICE_ID_AMD_COBRA_7401, 0x00, 0x40, AMD_UDMA_33 | AMD_BAD_SWDMA }, /* AMD-755 Cobra */
+ { PCI_DEVICE_ID_NVIDIA_NFORCE_IDE, 0x00, 0x50, AMD_UDMA_100 }, /* nVidia nForce */
+ { 0 }
};
static struct amd_ide_chip *amd_config;
@@ -119,8 +120,8 @@ static int amd_get_info(char *buffer, char **addr, off_t offset, int count)
amd_print("----------AMD BusMastering IDE Configuration----------------");
- amd_print("Driver Version: 2.7");
- amd_print("South Bridge: AMD-%s", amd_config->name);
+ amd_print("Driver Version: 2.8");
+ amd_print("South Bridge: %s", bmide_dev->name);
pci_read_config_byte(dev, PCI_REVISION_ID, &t);
amd_print("Revision: IDE %#x", t);
@@ -389,8 +390,8 @@ unsigned int __init pci_init_amd74xx(struct pci_dev *dev, const char *name)
*/
pci_read_config_byte(dev, PCI_REVISION_ID, &t);
- printk(KERN_INFO "AMD_IDE: AMD-%s (rev %02x) IDE %s controller on pci%s\n",
- amd_config->name, t, amd_dma[amd_config->flags & AMD_UDMA], dev->slot_name);
+ printk(KERN_INFO "AMD_IDE: %s (rev %02x) %s controller on pci%s\n",
+ dev->name, t, amd_dma[amd_config->flags & AMD_UDMA], dev->slot_name);
/*
* Register /proc/ide/amd74xx entry
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index f218a1916a17..5f598354bd6a 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -106,40 +106,51 @@ static int lba_capacity_is_ok (struct hd_driveid *id)
return 0; /* lba_capacity value may be bad */
}
-static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block);
-static ide_startstop_t lba_28_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block);
-static ide_startstop_t lba_48_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long long block);
+static ide_startstop_t chs_do_request(ide_drive_t *drive, struct request *rq, unsigned long block);
+static ide_startstop_t lba28_do_request(ide_drive_t *drive, struct request *rq, unsigned long block);
+static ide_startstop_t lba48_do_request(ide_drive_t *drive, struct request *rq, unsigned long long block);
/*
- * do_rw_disk() issues READ and WRITE commands to a disk,
- * using LBA if supported, or CHS otherwise, to address sectors.
- * It also takes care of issuing special DRIVE_CMDs.
+ * Issue a READ or WRITE command to a disk, using LBA if supported, or CHS
+ * otherwise, to address sectors. It also takes care of issuing special
+ * DRIVE_CMDs.
*/
-static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
+static ide_startstop_t idedisk_do_request(ide_drive_t *drive, struct request *rq, unsigned long block)
{
- if (drive->blocked)
- panic("ide: Request while drive blocked? You don't like your data intact?");
+ /*
+ * Wait until all request have bin finished.
+ */
+
+ while (drive->blocked) {
+ yield();
+ // panic("ide: Request while drive blocked?");
+ }
+
if (!(rq->flags & REQ_CMD)) {
- blk_dump_rq_flags(rq, "do_rw_disk, bad command");
+ blk_dump_rq_flags(rq, "idedisk_do_request - bad command");
ide_end_request(drive, 0);
return ide_stopped;
}
if (IS_PDC4030_DRIVE) {
extern ide_startstop_t promise_rw_disk(ide_drive_t *, struct request *, unsigned long);
+
return promise_rw_disk(drive, rq, block);
}
- if ((drive->id->cfs_enable_2 & 0x0400) && (drive->addressing)) /* 48-bit LBA */
- return lba_48_rw_disk(drive, rq, block);
- if (drive->select.b.lba) /* 28-bit LBA */
- return lba_28_rw_disk(drive, rq, block);
+ /* 48-bit LBA */
+ if ((drive->id->cfs_enable_2 & 0x0400) && (drive->addressing))
+ return lba48_do_request(drive, rq, block);
+
+ /* 28-bit LBA */
+ if (drive->select.b.lba)
+ return lba28_do_request(drive, rq, block);
- /* 28-bit CHS : DIE DIE DIE piece of legacy crap!!! */
- return chs_rw_disk(drive, rq, block);
+ /* 28-bit CHS */
+ return chs_do_request(drive, rq, block);
}
-static task_ioreg_t get_command (ide_drive_t *drive, int cmd)
+static task_ioreg_t get_command(ide_drive_t *drive, int cmd)
{
int lba48bit = (drive->id->cfs_enable_2 & 0x0400) ? 1 : 0;
@@ -147,23 +158,25 @@ static task_ioreg_t get_command (ide_drive_t *drive, int cmd)
lba48bit = drive->addressing;
#endif
- if ((cmd == READ) && (drive->using_dma))
- return (lba48bit) ? WIN_READDMA_EXT : WIN_READDMA;
- else if ((cmd == READ) && (drive->mult_count))
- return (lba48bit) ? WIN_MULTREAD_EXT : WIN_MULTREAD;
- else if (cmd == READ)
- return (lba48bit) ? WIN_READ_EXT : WIN_READ;
- else if ((cmd == WRITE) && (drive->using_dma))
- return (lba48bit) ? WIN_WRITEDMA_EXT : WIN_WRITEDMA;
- else if ((cmd == WRITE) && (drive->mult_count))
- return (lba48bit) ? WIN_MULTWRITE_EXT : WIN_MULTWRITE;
- else if (cmd == WRITE)
- return (lba48bit) ? WIN_WRITE_EXT : WIN_WRITE;
- else
- return WIN_NOP;
+ if (cmd == READ) {
+ if (drive->using_dma)
+ return (lba48bit) ? WIN_READDMA_EXT : WIN_READDMA;
+ else if (drive->mult_count)
+ return (lba48bit) ? WIN_MULTREAD_EXT : WIN_MULTREAD;
+ else
+ return (lba48bit) ? WIN_READ_EXT : WIN_READ;
+ } else if (cmd == WRITE) {
+ if (drive->using_dma)
+ return (lba48bit) ? WIN_WRITEDMA_EXT : WIN_WRITEDMA;
+ else if (drive->mult_count)
+ return (lba48bit) ? WIN_MULTWRITE_EXT : WIN_MULTWRITE;
+ else
+ return (lba48bit) ? WIN_WRITE_EXT : WIN_WRITE;
+ }
+ return WIN_NOP;
}
-static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
+static ide_startstop_t chs_do_request(ide_drive_t *drive, struct request *rq, unsigned long block)
{
struct hd_drive_task_hdr taskfile;
struct hd_drive_hob_hdr hobfile;
@@ -203,19 +216,15 @@ static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct request *rq, unsi
memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
- args.command_type = ide_cmd_type_parser(&args);
- args.prehandler = ide_pre_handler_parser(&taskfile, &hobfile);
- args.handler = ide_handler_parser(&taskfile, &hobfile);
- args.posthandler = NULL;
- args.rq = (struct request *) rq;
- args.block = block;
- rq->special = NULL;
- rq->special = (ide_task_t *)&args;
+ ide_cmd_type_parser(&args);
+ args.rq = rq;
+ args.block = block;
+ rq->special = &args;
return do_rw_taskfile(drive, &args);
}
-static ide_startstop_t lba_28_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
+static ide_startstop_t lba28_do_request(ide_drive_t *drive, struct request *rq, unsigned long block)
{
struct hd_drive_task_hdr taskfile;
struct hd_drive_hob_hdr hobfile;
@@ -250,14 +259,10 @@ static ide_startstop_t lba_28_rw_disk (ide_drive_t *drive, struct request *rq, u
memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
- args.command_type = ide_cmd_type_parser(&args);
- args.prehandler = ide_pre_handler_parser(&taskfile, &hobfile);
- args.handler = ide_handler_parser(&taskfile, &hobfile);
- args.posthandler = NULL;
- args.rq = (struct request *) rq;
- args.block = block;
- rq->special = NULL;
- rq->special = (ide_task_t *)&args;
+ ide_cmd_type_parser(&args);
+ args.rq = rq;
+ args.block = block;
+ rq->special = &args;
return do_rw_taskfile(drive, &args);
}
@@ -268,7 +273,7 @@ static ide_startstop_t lba_28_rw_disk (ide_drive_t *drive, struct request *rq, u
* 1073741822 == 549756 MB or 48bit addressing fake drive
*/
-static ide_startstop_t lba_48_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long long block)
+static ide_startstop_t lba48_do_request(ide_drive_t *drive, struct request *rq, unsigned long long block)
{
struct hd_drive_task_hdr taskfile;
struct hd_drive_hob_hdr hobfile;
@@ -314,13 +319,10 @@ static ide_startstop_t lba_48_rw_disk (ide_drive_t *drive, struct request *rq, u
memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
memcpy(args.hobRegister, &hobfile, sizeof(struct hd_drive_hob_hdr));
- args.command_type = ide_cmd_type_parser(&args);
- args.prehandler = ide_pre_handler_parser(&taskfile, &hobfile);
- args.handler = ide_handler_parser(&taskfile, &hobfile);
- args.posthandler = NULL;
- args.rq = (struct request *) rq;
- args.block = block;
- rq->special = (ide_task_t *)&args;
+ ide_cmd_type_parser(&args);
+ args.rq = rq;
+ args.block = block;
+ rq->special = &args;
return do_rw_taskfile(drive, &args);
}
@@ -637,9 +639,9 @@ static ide_startstop_t idedisk_special (ide_drive_t *drive)
taskfile.high_cylinder = drive->cyl>>8;
taskfile.device_head = ((drive->head-1)|drive->select.all)&0xBF;
if (!IS_PDC4030_DRIVE) {
- taskfile.sector_count = drive->sect;
- taskfile.command = WIN_SPECIFY;
- handler = ide_handler_parser(&taskfile, &hobfile);
+ taskfile.sector_count = drive->sect;
+ taskfile.command = WIN_SPECIFY;
+ handler = set_geometry_intr;;
}
do_taskfile(drive, &taskfile, &hobfile, handler);
} else if (s->b.recalibrate) {
@@ -651,7 +653,7 @@ static ide_startstop_t idedisk_special (ide_drive_t *drive)
memset(&hobfile, 0, sizeof(struct hd_drive_hob_hdr));
taskfile.sector_count = drive->sect;
taskfile.command = WIN_RESTORE;
- do_taskfile(drive, &taskfile, &hobfile, ide_handler_parser(&taskfile, &hobfile));
+ do_taskfile(drive, &taskfile, &hobfile, recal_intr);
}
} else if (s->b.set_multmode) {
s->b.set_multmode = 0;
@@ -1089,7 +1091,7 @@ static struct ata_operations idedisk_driver = {
owner: THIS_MODULE,
cleanup: idedisk_cleanup,
standby: idedisk_standby,
- do_request: do_rw_disk,
+ do_request: idedisk_do_request,
end_request: NULL,
ioctl: NULL,
open: idedisk_open,
@@ -1127,7 +1129,7 @@ int idedisk_init (void)
{
ide_drive_t *drive;
int failed = 0;
-
+
MOD_INC_USE_COUNT;
while ((drive = ide_scan_devices(ATA_DISK, "ide-disk", NULL, failed++)) != NULL) {
if (ide_register_subdriver (drive, &idedisk_driver)) {
diff --git a/drivers/ide/ide-pci.c b/drivers/ide/ide-pci.c
index a1f65de568f5..d8c32aca8a7b 100644
--- a/drivers/ide/ide-pci.c
+++ b/drivers/ide/ide-pci.c
@@ -119,6 +119,7 @@ extern void ide_init_pdc202xx(ide_hwif_t *);
extern unsigned int pci_init_piix(struct pci_dev *);
extern unsigned int ata66_piix(ide_hwif_t *);
extern void ide_init_piix(ide_hwif_t *);
+extern void ide_dmacapable_piix(ide_hwif_t *, unsigned long);
#endif
#ifdef CONFIG_BLK_DEV_IT8172
@@ -142,12 +143,6 @@ extern unsigned int ata66_sis5513(ide_hwif_t *);
extern void ide_init_sis5513(ide_hwif_t *);
#endif
-#ifdef CONFIG_BLK_DEV_SLC90E66
-extern unsigned int pci_init_slc90e66(struct pci_dev *);
-extern unsigned int ata66_slc90e66(ide_hwif_t *);
-extern void ide_init_slc90e66(ide_hwif_t *);
-#endif
-
#ifdef CONFIG_BLK_DEV_SL82C105
extern unsigned int pci_init_sl82c105(struct pci_dev *);
extern void dma_init_sl82c105(ide_hwif_t *, unsigned long);
@@ -197,19 +192,18 @@ typedef struct ide_pci_device_s {
static ide_pci_device_t pci_chipsets[] __initdata = {
#ifdef CONFIG_BLK_DEV_PIIX
- {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371FB_0, NULL, NULL, ide_init_piix, NULL, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
- {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371FB_1, NULL, NULL, ide_init_piix, NULL, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
- {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371MX, NULL, NULL, ide_init_piix, NULL, {{0x6D,0x80,0x80}, {0x6F,0x80,0x80}}, ON_BOARD, 0, ATA_F_NODMA },
- {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371SB_1, pci_init_piix, NULL, ide_init_piix, NULL, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
- {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB, pci_init_piix, NULL, ide_init_piix, NULL, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
- {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_1, pci_init_piix, NULL, ide_init_piix, NULL, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
- {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_1, pci_init_piix, NULL, ide_init_piix, NULL, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
- {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_1, pci_init_piix, ata66_piix, ide_init_piix, NULL, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
- {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82372FB_1, pci_init_piix, ata66_piix, ide_init_piix, NULL, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
- {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82451NX, pci_init_piix, NULL, ide_init_piix, NULL, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, ATA_F_NOADMA },
- {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_9, pci_init_piix, ata66_piix, ide_init_piix, NULL, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
- {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_8, pci_init_piix, ata66_piix, ide_init_piix, NULL, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
- {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_10, pci_init_piix, ata66_piix, ide_init_piix, NULL, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371FB_1, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371SB_1, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_1, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82372FB_1, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_1, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_1, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_9, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_8, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_10, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_11, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1, pci_init_piix, ata66_piix, ide_init_piix, ide_dmacapable_piix, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
#endif
#ifdef CONFIG_BLK_DEV_VIA82CXXX
{PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576_1, pci_init_via82cxxx, ata66_via82cxxx, ide_init_via82cxxx, ide_dmacapable_via82cxxx, {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, ON_BOARD, 0, ATA_F_NOADMA },
@@ -289,13 +283,11 @@ static ide_pci_device_t pci_chipsets[] __initdata = {
{PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7411, pci_init_amd74xx, ata66_amd74xx, ide_init_amd74xx, ide_dmacapable_amd74xx, {{0x40,0x01,0x01}, {0x40,0x02,0x02}}, ON_BOARD, 0, 0 },
{PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_OPUS_7441, pci_init_amd74xx, ata66_amd74xx, ide_init_amd74xx, ide_dmacapable_amd74xx, {{0x40,0x01,0x01}, {0x40,0x02,0x02}}, ON_BOARD, 0, 0 },
{PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_IDE, pci_init_amd74xx, ata66_amd74xx, ide_init_amd74xx, ide_dmacapable_amd74xx, {{0x40,0x01,0x01}, {0x40,0x02,0x02}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_IDE, pci_init_amd74xx, ata66_amd74xx, ide_init_amd74xx, ide_dmacapable_amd74xx, {{0x50,0x01,0x01}, {0x50,0x02,0x02}}, ON_BOARD, 0, 0 },
#endif
#ifdef CONFIG_BLK_DEV_PDC_ADMA
{PCI_VENDOR_ID_PDC, PCI_DEVICE_ID_PDC_1841, pci_init_pdcadma, ata66_pdcadma, ide_init_pdcadma, ide_dmacapable_pdcadma, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, OFF_BOARD, 0, ATA_F_NODMA },
#endif
-#ifdef CONFIG_BLK_DEV_SLC90E66
- {PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1, pci_init_slc90e66, ata66_slc90e66, ide_init_slc90e66, NULL, {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, ON_BOARD, 0, 0 },
-#endif
#ifdef CONFIG_BLK_DEV_SVWKS
{PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, pci_init_svwks, ata66_svwks, ide_init_svwks, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_DMA },
{PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, pci_init_svwks, ata66_svwks, ide_init_svwks, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, 0 },
@@ -311,6 +303,7 @@ static ide_pci_device_t pci_chipsets[] __initdata = {
{PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87410, NULL, NULL, NULL, NULL, {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, ON_BOARD, 0, 0 },
{PCI_VENDOR_ID_HINT, PCI_DEVICE_ID_HINT, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, 0 },
{PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_6565, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, 0 },
+ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371MX, NULL, NULL, NULL, NULL, {{0x6D,0x80,0x80}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_NODMA },
{PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8673F, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_FIXIRQ },
{PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886A, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_FIXIRQ },
{PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, NULL, NULL, NULL, NULL, {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, ON_BOARD, 0, ATA_F_FIXIRQ },
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index 0891bcc1e2c4..83f517e2ae5c 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -118,10 +118,6 @@ int (*svwks_display_info)(char *, char **, off_t, int) = NULL;
extern byte sis_proc;
int (*sis_display_info)(char *, char **, off_t, int) = NULL;
#endif /* CONFIG_BLK_DEV_SIS5513 */
-#ifdef CONFIG_BLK_DEV_SLC90E66
-extern byte slc90e66_proc;
-int (*slc90e66_display_info)(char *, char **, off_t, int) = NULL;
-#endif /* CONFIG_BLK_DEV_SLC90E66 */
#ifdef CONFIG_BLK_DEV_VIA82CXXX
extern byte via_proc;
int (*via_display_info)(char *, char **, off_t, int) = NULL;
@@ -593,10 +589,6 @@ void proc_ide_create(void)
if ((sis_display_info) && (sis_proc))
create_proc_info_entry("sis", 0, proc_ide_root, sis_display_info);
#endif /* CONFIG_BLK_DEV_SIS5513 */
-#ifdef CONFIG_BLK_DEV_SLC90E66
- if ((slc90e66_display_info) && (slc90e66_proc))
- create_proc_info_entry("slc90e66", 0, proc_ide_root, slc90e66_display_info);
-#endif /* CONFIG_BLK_DEV_SLC90E66 */
#ifdef CONFIG_BLK_DEV_VIA82CXXX
if ((via_display_info) && (via_proc))
create_proc_info_entry("via", 0, proc_ide_root, via_display_info);
@@ -653,10 +645,6 @@ void proc_ide_destroy(void)
if ((sis_display_info) && (sis_proc))
remove_proc_entry("ide/sis", 0);
#endif /* CONFIG_BLK_DEV_SIS5513 */
-#ifdef CONFIG_BLK_DEV_SLC90E66
- if ((slc90e66_display_info) && (slc90e66_proc))
- remove_proc_entry("ide/slc90e66",0);
-#endif /* CONFIG_BLK_DEV_SLC90E66 */
#ifdef CONFIG_BLK_DEV_VIA82CXXX
if ((via_display_info) && (via_proc))
remove_proc_entry("ide/via",0);
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 138d5e7fdae7..29ccab91a897 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -38,6 +38,8 @@
#define DTF(x...)
#endif
+#define SUPPORT_VLB_SYNC 1
+
/*
* for now, taskfile requests are special :/
*/
@@ -56,7 +58,7 @@ static inline void ide_unmap_rq(struct request *rq, char *to,
bio_kunmap_irq(to, flags);
}
-static void ata_bswap_data (void *buffer, int wcount)
+static void bswap_data (void *buffer, int wcount)
{
u16 *p = buffer;
@@ -74,18 +76,20 @@ static void ata_bswap_data (void *buffer, int wcount)
* of the sector count register location, with interrupts disabled
* to ensure that the reads all happen together.
*/
-static inline void task_vlb_sync(ide_ioreg_t port)
+static inline void task_vlb_sync(ide_drive_t *drive)
{
- IN_BYTE (port);
- IN_BYTE (port);
- IN_BYTE (port);
+ ide_ioreg_t port = IDE_NSECTOR_REG;
+
+ IN_BYTE(port);
+ IN_BYTE(port);
+ IN_BYTE(port);
}
#endif
/*
* This is used for most PIO data transfers *from* the IDE interface
*/
-void ata_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
+void ata_input_data(ide_drive_t *drive, void *buffer, unsigned int wcount)
{
byte io_32bit;
@@ -107,7 +111,7 @@ void ata_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
unsigned long flags;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
- task_vlb_sync(IDE_NSECTOR_REG);
+ task_vlb_sync(drive);
insl(IDE_DATA_REG, buffer, wcount);
__restore_flags(flags); /* local CPU only */
} else
@@ -130,7 +134,7 @@ void ata_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
/*
* This is used for most PIO data transfers *to* the IDE interface
*/
-void ata_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
+void ata_output_data(ide_drive_t *drive, void *buffer, unsigned int wcount)
{
byte io_32bit;
@@ -147,7 +151,7 @@ void ata_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
unsigned long flags;
__save_flags(flags); /* local CPU only */
__cli(); /* local CPU only */
- task_vlb_sync(IDE_NSECTOR_REG);
+ task_vlb_sync(drive);
outsl(IDE_DATA_REG, buffer, wcount);
__restore_flags(flags); /* local CPU only */
} else
@@ -188,7 +192,7 @@ void atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount
insw_swapw(IDE_DATA_REG, buffer, bytecount / 2);
return;
}
-#endif /* CONFIG_ATARI */
+#endif
ata_input_data (drive, buffer, bytecount / 4);
if ((bytecount & 0x03) >= 2)
insw (IDE_DATA_REG, ((byte *)buffer) + (bytecount & ~0x03), 1);
@@ -208,25 +212,25 @@ void atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecoun
outsw_swapw(IDE_DATA_REG, buffer, bytecount / 2);
return;
}
-#endif /* CONFIG_ATARI */
+#endif
ata_output_data (drive, buffer, bytecount / 4);
if ((bytecount & 0x03) >= 2)
- outsw (IDE_DATA_REG, ((byte *)buffer) + (bytecount & ~0x03), 1);
+ outsw(IDE_DATA_REG, ((byte *)buffer) + (bytecount & ~0x03), 1);
}
-void taskfile_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
+void taskfile_input_data(ide_drive_t *drive, void *buffer, unsigned int wcount)
{
ata_input_data(drive, buffer, wcount);
if (drive->bswap)
- ata_bswap_data(buffer, wcount);
+ bswap_data(buffer, wcount);
}
-void taskfile_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
+void taskfile_output_data(ide_drive_t *drive, void *buffer, unsigned int wcount)
{
if (drive->bswap) {
- ata_bswap_data(buffer, wcount);
+ bswap_data(buffer, wcount);
ata_output_data(drive, buffer, wcount);
- ata_bswap_data(buffer, wcount);
+ bswap_data(buffer, wcount);
} else {
ata_output_data(drive, buffer, wcount);
}
@@ -235,7 +239,7 @@ void taskfile_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount
/*
* Needed for PCI irq sharing
*/
-int drive_is_ready (ide_drive_t *drive)
+int drive_is_ready(ide_drive_t *drive)
{
byte stat = 0;
if (drive->waiting_for_dma)
@@ -255,7 +259,7 @@ int drive_is_ready (ide_drive_t *drive)
if (IDE_CONTROL_REG)
stat = GET_ALTSTAT();
else
-#endif /* CONFIG_IDEPCI_SHARE_IRQ */
+#endif
stat = GET_STAT(); /* Note: this may clear a pending IRQ!! */
if (stat & BUSY_STAT)
@@ -291,7 +295,7 @@ static ide_startstop_t bio_mulout_intr(ide_drive_t *drive);
* Called directly from execute_drive_cmd for the first bunch of sectors,
* afterwards only by the ISR
*/
-static ide_startstop_t task_mulout_intr (ide_drive_t *drive)
+static ide_startstop_t task_mulout_intr(ide_drive_t *drive)
{
unsigned int msect, nsect;
byte stat = GET_STAT();
@@ -314,6 +318,7 @@ static ide_startstop_t task_mulout_intr (ide_drive_t *drive)
* necessary
*/
ide_end_request(drive, 1);
+
return ide_stopped;
}
@@ -341,13 +346,14 @@ static ide_startstop_t task_mulout_intr (ide_drive_t *drive)
ide_unmap_rq(rq, pBuf, &flags);
drive->io_32bit = io_32bit;
rq->errors = 0;
+ /* Are we sure that this as all been already transfered? */
rq->current_nr_sectors -= nsect;
if (hwgroup->handler == NULL)
ide_set_handler(drive, &task_mulout_intr, WAIT_CMD, NULL);
return ide_started;
}
-ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
+ide_startstop_t do_rw_taskfile(ide_drive_t *drive, ide_task_t *task)
{
task_struct_t *taskfile = (task_struct_t *) task->tfRegister;
hob_struct_t *hobfile = (hob_struct_t *) task->hobRegister;
@@ -399,7 +405,9 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
return ide_started;
}
-void do_taskfile (ide_drive_t *drive, struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile, ide_handler_t *handler)
+void do_taskfile(ide_drive_t *drive, struct hd_drive_task_hdr *taskfile,
+ struct hd_drive_hob_hdr *hobfile,
+ ide_handler_t *handler)
{
struct hd_driveid *id = drive->id;
byte HIHI = (drive->addressing) ? 0xE0 : 0xEF;
@@ -440,10 +448,6 @@ void do_taskfile (ide_drive_t *drive, struct hd_drive_task_hdr *taskfile, struct
}
/*
- * Handler for special commands without a data phase from ide-disk
- */
-
-/*
* This is invoked on completion of a WIN_SETMULT cmd.
*/
ide_startstop_t set_multmode_intr (ide_drive_t *drive)
@@ -463,7 +467,7 @@ ide_startstop_t set_multmode_intr (ide_drive_t *drive)
/*
* This is invoked on completion of a WIN_SPECIFY cmd.
*/
-static ide_startstop_t set_geometry_intr (ide_drive_t *drive)
+ide_startstop_t set_geometry_intr (ide_drive_t *drive)
{
byte stat;
@@ -480,7 +484,7 @@ static ide_startstop_t set_geometry_intr (ide_drive_t *drive)
/*
* This is invoked on completion of a WIN_RESTORE (recalibrate) cmd.
*/
-static ide_startstop_t recal_intr (ide_drive_t *drive)
+ide_startstop_t recal_intr(ide_drive_t *drive)
{
byte stat = GET_STAT();
@@ -713,37 +717,6 @@ static ide_startstop_t bio_mulout_intr (ide_drive_t *drive)
return ide_started;
}
-/* Called by internal to feature out type of command being called */
-ide_pre_handler_t * ide_pre_handler_parser (struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile)
-{
- switch(taskfile->command) {
- /* IDE_DRIVE_TASK_RAW_WRITE */
- /* IDE_DRIVE_TASK_OUT */
- case WIN_WRITE:
- case WIN_WRITE_EXT:
- case WIN_WRITE_VERIFY:
- case WIN_WRITE_BUFFER:
- case CFA_WRITE_SECT_WO_ERASE:
- case WIN_DOWNLOAD_MICROCODE:
- return &pre_task_out_intr;
- case CFA_WRITE_MULTI_WO_ERASE:
- case WIN_MULTWRITE:
- case WIN_MULTWRITE_EXT:
- return &pre_bio_out_intr;
- case WIN_SMART:
- if (taskfile->feature == SMART_WRITE_LOG_SECTOR)
- return &pre_task_out_intr;
- case WIN_WRITEDMA:
- case WIN_WRITEDMA_QUEUED:
- case WIN_WRITEDMA_EXT:
- case WIN_WRITEDMA_QUEUED_EXT:
- /* IDE_DRIVE_TASK_OUT */
- default:
- break;
- }
- return(NULL);
-}
-
/*
* Handler for command with Read Multiple
*/
@@ -798,154 +771,85 @@ static ide_startstop_t task_mulin_intr(ide_drive_t *drive)
return ide_started;
}
-/* Called by internal to feature out type of command being called */
-ide_handler_t * ide_handler_parser (struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile)
-{
- switch(taskfile->command) {
- case WIN_IDENTIFY:
- case WIN_PIDENTIFY:
- case CFA_TRANSLATE_SECTOR:
- case WIN_READ_BUFFER:
- case WIN_READ:
- case WIN_READ_EXT:
- return &task_in_intr;
- case WIN_SECURITY_DISABLE:
- case WIN_SECURITY_ERASE_UNIT:
- case WIN_SECURITY_SET_PASS:
- case WIN_SECURITY_UNLOCK:
- case WIN_DOWNLOAD_MICROCODE:
- case CFA_WRITE_SECT_WO_ERASE:
- case WIN_WRITE_BUFFER:
- case WIN_WRITE_VERIFY:
- case WIN_WRITE:
- case WIN_WRITE_EXT:
- return &task_out_intr;
- case WIN_MULTREAD:
- case WIN_MULTREAD_EXT:
- return &task_mulin_intr;
- case CFA_WRITE_MULTI_WO_ERASE:
- case WIN_MULTWRITE:
- case WIN_MULTWRITE_EXT:
- return &bio_mulout_intr;
- case WIN_SMART:
- switch(taskfile->feature) {
- case SMART_READ_VALUES:
- case SMART_READ_THRESHOLDS:
- case SMART_READ_LOG_SECTOR:
- return &task_in_intr;
- case SMART_WRITE_LOG_SECTOR:
- return &task_out_intr;
- default:
- return &task_no_data_intr;
- }
- case CFA_REQ_EXT_ERROR_CODE:
- case CFA_ERASE_SECTORS:
- case WIN_VERIFY:
- case WIN_VERIFY_EXT:
- case WIN_SEEK:
- return &task_no_data_intr;
- case WIN_SPECIFY:
- return &set_geometry_intr;
- case WIN_RESTORE:
- return &recal_intr;
- case WIN_DIAGNOSE:
- case WIN_FLUSH_CACHE:
- case WIN_FLUSH_CACHE_EXT:
- case WIN_STANDBYNOW1:
- case WIN_STANDBYNOW2:
- case WIN_SLEEPNOW1:
- case WIN_SLEEPNOW2:
- case WIN_SETIDLE1:
- case WIN_CHECKPOWERMODE1:
- case WIN_CHECKPOWERMODE2:
- case WIN_GETMEDIASTATUS:
- case WIN_MEDIAEJECT:
- return &task_no_data_intr;
- case WIN_SETMULT:
- return &set_multmode_intr;
- case WIN_READ_NATIVE_MAX:
- case WIN_SET_MAX:
- case WIN_READ_NATIVE_MAX_EXT:
- case WIN_SET_MAX_EXT:
- case WIN_SECURITY_ERASE_PREPARE:
- case WIN_SECURITY_FREEZE_LOCK:
- case WIN_DOORLOCK:
- case WIN_DOORUNLOCK:
- case WIN_SETFEATURES:
- return &task_no_data_intr;
- case DISABLE_SEAGATE:
- case EXABYTE_ENABLE_NEST:
- return &task_no_data_intr;
-#ifdef CONFIG_BLK_DEV_IDEDMA
- case WIN_READDMA:
- case WIN_IDENTIFY_DMA:
- case WIN_READDMA_QUEUED:
- case WIN_READDMA_EXT:
- case WIN_READDMA_QUEUED_EXT:
- case WIN_WRITEDMA:
- case WIN_WRITEDMA_QUEUED:
- case WIN_WRITEDMA_EXT:
- case WIN_WRITEDMA_QUEUED_EXT:
-#endif
- case WIN_FORMAT:
- case WIN_INIT:
- case WIN_DEVICE_RESET:
- case WIN_QUEUED_SERVICE:
- case WIN_PACKETCMD:
- default:
- return NULL;
- }
-}
-
/* Called by ioctl to feature out type of command being called */
-int ide_cmd_type_parser (ide_task_t *args)
+void ide_cmd_type_parser(ide_task_t *args)
{
struct hd_drive_task_hdr *taskfile = (struct hd_drive_task_hdr *) args->tfRegister;
- struct hd_drive_hob_hdr *hobfile = (struct hd_drive_hob_hdr *) args->hobRegister;
- args->prehandler = ide_pre_handler_parser(taskfile, hobfile);
- args->handler = ide_handler_parser(taskfile, hobfile);
+ args->prehandler = NULL;
+ args->handler = NULL;
switch(args->tfRegister[IDE_COMMAND_OFFSET]) {
case WIN_IDENTIFY:
case WIN_PIDENTIFY:
- return IDE_DRIVE_TASK_IN;
+ args->handler = task_in_intr;
+ args->command_type = IDE_DRIVE_TASK_IN;
+ return;
+
case CFA_TRANSLATE_SECTOR:
case WIN_READ:
case WIN_READ_EXT:
case WIN_READ_BUFFER:
- return IDE_DRIVE_TASK_IN;
+ args->handler = task_in_intr;
+ args->command_type = IDE_DRIVE_TASK_IN;
+ return;
+
case WIN_WRITE:
case WIN_WRITE_EXT:
case WIN_WRITE_VERIFY:
case WIN_WRITE_BUFFER:
case CFA_WRITE_SECT_WO_ERASE:
case WIN_DOWNLOAD_MICROCODE:
- return IDE_DRIVE_TASK_RAW_WRITE;
+ args->prehandler = pre_task_out_intr;
+ args->handler = task_out_intr;
+ args->command_type = IDE_DRIVE_TASK_RAW_WRITE;
+ return;
+
case WIN_MULTREAD:
case WIN_MULTREAD_EXT:
- return IDE_DRIVE_TASK_IN;
+ args->handler = task_mulin_intr;
+ args->command_type = IDE_DRIVE_TASK_IN;
+ return;
+
case CFA_WRITE_MULTI_WO_ERASE:
case WIN_MULTWRITE:
case WIN_MULTWRITE_EXT:
- return IDE_DRIVE_TASK_RAW_WRITE;
+ args->prehandler = pre_bio_out_intr;
+ args->handler = bio_mulout_intr;
+ args->command_type = IDE_DRIVE_TASK_RAW_WRITE;
+ return;
+
case WIN_SECURITY_DISABLE:
case WIN_SECURITY_ERASE_UNIT:
case WIN_SECURITY_SET_PASS:
case WIN_SECURITY_UNLOCK:
- return IDE_DRIVE_TASK_OUT;
+ args->handler = task_out_intr;
+ args->command_type = IDE_DRIVE_TASK_OUT;
+ return;
+
case WIN_SMART:
+ if (taskfile->feature == SMART_WRITE_LOG_SECTOR)
+ args->prehandler = pre_task_out_intr;
args->tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS;
args->tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS;
switch(args->tfRegister[IDE_FEATURE_OFFSET]) {
case SMART_READ_VALUES:
case SMART_READ_THRESHOLDS:
case SMART_READ_LOG_SECTOR:
- return IDE_DRIVE_TASK_IN;
+ args->handler = task_in_intr;
+ args->command_type = IDE_DRIVE_TASK_IN;
+ return;
+
case SMART_WRITE_LOG_SECTOR:
- return IDE_DRIVE_TASK_OUT;
+ args->handler = task_out_intr;
+ args->command_type = IDE_DRIVE_TASK_OUT;
+ return;
+
default:
- return IDE_DRIVE_TASK_NO_DATA;
+ args->handler = task_no_data_intr;
+ args->command_type = IDE_DRIVE_TASK_NO_DATA;
+ return;
+
}
#ifdef CONFIG_BLK_DEV_IDEDMA
case WIN_READDMA:
@@ -953,17 +857,23 @@ int ide_cmd_type_parser (ide_task_t *args)
case WIN_READDMA_QUEUED:
case WIN_READDMA_EXT:
case WIN_READDMA_QUEUED_EXT:
- return IDE_DRIVE_TASK_IN;
+ args->command_type = IDE_DRIVE_TASK_IN;
+ return;
+
case WIN_WRITEDMA:
case WIN_WRITEDMA_QUEUED:
case WIN_WRITEDMA_EXT:
case WIN_WRITEDMA_QUEUED_EXT:
- return IDE_DRIVE_TASK_RAW_WRITE;
+ args->command_type = IDE_DRIVE_TASK_RAW_WRITE;
+ return;
+
#endif
case WIN_SETFEATURES:
+ args->handler = task_no_data_intr;
switch(args->tfRegister[IDE_FEATURE_OFFSET]) {
case SETFEATURES_XFER:
- return IDE_DRIVE_TASK_SET_XFER;
+ args->command_type = IDE_DRIVE_TASK_SET_XFER;
+ return;
case SETFEATURES_DIS_DEFECT:
case SETFEATURES_EN_APM:
case SETFEATURES_DIS_MSN:
@@ -980,16 +890,20 @@ int ide_cmd_type_parser (ide_task_t *args)
case SETFEATURES_DIS_RI:
case SETFEATURES_DIS_SI:
default:
- return IDE_DRIVE_TASK_NO_DATA;
+ args->command_type = IDE_DRIVE_TASK_NO_DATA;
+ return;
}
- case WIN_NOP:
- case CFA_REQ_EXT_ERROR_CODE:
- case CFA_ERASE_SECTORS:
- case WIN_VERIFY:
- case WIN_VERIFY_EXT:
- case WIN_SEEK:
+
case WIN_SPECIFY:
+ args->handler = set_geometry_intr;
+ args->command_type = IDE_DRIVE_TASK_NO_DATA;
+ return;
+
case WIN_RESTORE:
+ args->handler = recal_intr;
+ args->command_type = IDE_DRIVE_TASK_NO_DATA;
+ return;
+
case WIN_DIAGNOSE:
case WIN_FLUSH_CACHE:
case WIN_FLUSH_CACHE_EXT:
@@ -998,29 +912,48 @@ int ide_cmd_type_parser (ide_task_t *args)
case WIN_SLEEPNOW1:
case WIN_SLEEPNOW2:
case WIN_SETIDLE1:
- case DISABLE_SEAGATE:
case WIN_CHECKPOWERMODE1:
case WIN_CHECKPOWERMODE2:
case WIN_GETMEDIASTATUS:
case WIN_MEDIAEJECT:
- case WIN_SETMULT:
+ case CFA_REQ_EXT_ERROR_CODE:
+ case CFA_ERASE_SECTORS:
+ case WIN_VERIFY:
+ case WIN_VERIFY_EXT:
+ case WIN_SEEK:
case WIN_READ_NATIVE_MAX:
case WIN_SET_MAX:
case WIN_READ_NATIVE_MAX_EXT:
case WIN_SET_MAX_EXT:
case WIN_SECURITY_ERASE_PREPARE:
case WIN_SECURITY_FREEZE_LOCK:
- case EXABYTE_ENABLE_NEST:
case WIN_DOORLOCK:
case WIN_DOORUNLOCK:
- return IDE_DRIVE_TASK_NO_DATA;
+ case DISABLE_SEAGATE:
+ case EXABYTE_ENABLE_NEST:
+
+ args->handler = task_no_data_intr;
+ args->command_type = IDE_DRIVE_TASK_NO_DATA;
+ return;
+
+ case WIN_SETMULT:
+ args->handler = set_multmode_intr;
+ args->command_type = IDE_DRIVE_TASK_NO_DATA;
+ return;
+
+ case WIN_NOP:
+
+ args->command_type = IDE_DRIVE_TASK_NO_DATA;
+ return;
+
case WIN_FORMAT:
case WIN_INIT:
case WIN_DEVICE_RESET:
case WIN_QUEUED_SERVICE:
case WIN_PACKETCMD:
default:
- return IDE_DRIVE_TASK_INVALID;
+ args->command_type = IDE_DRIVE_TASK_INVALID;
+ return;
}
}
@@ -1067,7 +1000,7 @@ int ide_wait_taskfile(ide_drive_t *drive, struct hd_drive_task_hdr *taskfile, st
ide_init_drive_taskfile(&rq);
/* This is kept for internal use only !!! */
- args.command_type = ide_cmd_type_parser (&args);
+ ide_cmd_type_parser(&args);
if (args.command_type != IDE_DRIVE_TASK_NO_DATA)
rq.current_nr_sectors = rq.nr_sectors = (hobfile->sector_count << 8) | taskfile->sector_count;
@@ -1232,14 +1165,13 @@ EXPORT_SYMBOL(taskfile_output_data);
EXPORT_SYMBOL(do_rw_taskfile);
EXPORT_SYMBOL(do_taskfile);
+EXPORT_SYMBOL(recal_intr);
+EXPORT_SYMBOL(set_geometry_intr);
EXPORT_SYMBOL(set_multmode_intr);
-
EXPORT_SYMBOL(task_no_data_intr);
EXPORT_SYMBOL(ide_wait_taskfile);
EXPORT_SYMBOL(ide_raw_taskfile);
-EXPORT_SYMBOL(ide_pre_handler_parser);
-EXPORT_SYMBOL(ide_handler_parser);
EXPORT_SYMBOL(ide_cmd_type_parser);
EXPORT_SYMBOL(ide_cmd_ioctl);
EXPORT_SYMBOL(ide_task_ioctl);
diff --git a/drivers/ide/pdc4030.c b/drivers/ide/pdc4030.c
index 16758e96f042..04e6ad2871bd 100644
--- a/drivers/ide/pdc4030.c
+++ b/drivers/ide/pdc4030.c
@@ -654,14 +654,14 @@ ide_startstop_t promise_rw_disk (ide_drive_t *drive, struct request *rq, unsigne
memcpy(args.tfRegister, &taskfile, sizeof(struct hd_drive_task_hdr));
memcpy(args.hobRegister, NULL, sizeof(struct hd_drive_hob_hdr));
- args.command_type = ide_cmd_type_parser(&args);
+ ide_cmd_type_parser(&args);
+ /* We don't use the generic inerrupt handlers here? */
args.prehandler = NULL;
args.handler = NULL;
- args.posthandler = NULL;
- args.rq = (struct request *) rq;
+ args.rq = rq;
args.block = block;
rq->special = NULL;
- rq->special = (ide_task_t *)&args;
+ rq->special = &args;
return do_pdc4030_io(drive, &args);
}
diff --git a/drivers/ide/piix.c b/drivers/ide/piix.c
index de7f2e74d32e..384ea0b2380a 100644
--- a/drivers/ide/piix.c
+++ b/drivers/ide/piix.c
@@ -1,499 +1,578 @@
/*
- * linux/drivers/ide/piix.c Version 0.32 June 9, 2000
+ * $Id: piix.c,v 1.2 2002/03/13 22:50:43 vojtech Exp $
*
- * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
- * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
- * May be copied or modified under the terms of the GNU General Public License
+ * Copyright (c) 2000-2002 Vojtech Pavlik
*
- * PIO mode setting function for Intel chipsets.
- * For use instead of BIOS settings.
+ * Based on the work of:
+ * Andrzej Krzysztofowicz
+ * Andre Hedrick
*
- * 40-41
- * 42-43
- *
- * 41
- * 43
- *
- * | PIO 0 | c0 | 80 | 0 | piix_tune_drive(drive, 0);
- * | PIO 2 | SW2 | d0 | 90 | 4 | piix_tune_drive(drive, 2);
- * | PIO 3 | MW1 | e1 | a1 | 9 | piix_tune_drive(drive, 3);
- * | PIO 4 | MW2 | e3 | a3 | b | piix_tune_drive(drive, 4);
- *
- * sitre = word40 & 0x4000; primary
- * sitre = word42 & 0x4000; secondary
- *
- * 44 8421|8421 hdd|hdb
- *
- * 48 8421 hdd|hdc|hdb|hda udma enabled
- *
- * 0001 hda
- * 0010 hdb
- * 0100 hdc
- * 1000 hdd
- *
- * 4a 84|21 hdb|hda
- * 4b 84|21 hdd|hdc
+ * Thanks to Daniela Egbert for advice on PIIX bugs.
+ */
+
+/*
+ * Intel PIIX/ICH and Efar Victory66 IDE driver for Linux.
*
- * ata-33/82371AB
- * ata-33/82371EB
- * ata-33/82801AB ata-66/82801AA
- * 00|00 udma 0 00|00 reserved
- * 01|01 udma 1 01|01 udma 3
- * 10|10 udma 2 10|10 udma 4
- * 11|11 reserved 11|11 reserved
+ * UDMA66 and higher modes are autoenabled only in case the BIOS has detected a
+ * 80 wire cable. To ignore the BIOS data and assume the cable is present, use
+ * 'ide0=ata66' or 'ide1=ata66' on the kernel command line.
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * 54 8421|8421 ata66 drive|ata66 enable
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * pci_read_config_word(HWIF(drive)->pci_dev, 0x40, &reg40);
- * pci_read_config_word(HWIF(drive)->pci_dev, 0x42, &reg42);
- * pci_read_config_word(HWIF(drive)->pci_dev, 0x44, &reg44);
- * pci_read_config_word(HWIF(drive)->pci_dev, 0x48, &reg48);
- * pci_read_config_word(HWIF(drive)->pci_dev, 0x4a, &reg4a);
- * pci_read_config_word(HWIF(drive)->pci_dev, 0x54, &reg54);
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
+ * Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/
#include <linux/config.h>
-#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
+#include <linux/blkdev.h>
#include <linux/pci.h>
-#include <linux/hdreg.h>
-#include <linux/ide.h>
-#include <linux/delay.h>
#include <linux/init.h>
-
+#include <linux/ide.h>
#include <asm/io.h>
#include "ata-timing.h"
-#define PIIX_DEBUG_DRIVE_INFO 0
+#define PIIX_IDETIM0 0x40
+#define PIIX_IDETIM1 0x42
+#define PIIX_SIDETIM 0x44
+#define PIIX_IDESTAT 0x47
+#define PIIX_UDMACTL 0x48
+#define PIIX_UDMATIM 0x4a
+#define PIIX_IDECFG 0x54
+
+#define PIIX_UDMA 0x07
+#define PIIX_UDMA_NONE 0x00
+#define PIIX_UDMA_33 0x01
+#define PIIX_UDMA_66 0x02
+#define PIIX_UDMA_V66 0x03
+#define PIIX_UDMA_100 0x04
+#define PIIX_NO_SITRE 0x08 /* Chip doesn't have separate slave timing */
+#define PIIX_PINGPONG 0x10 /* Enable ping-pong buffers */
+#define PIIX_VICTORY 0x20 /* Efar Victory66 has a different UDMA setup */
+#define PIIX_CHECK_REV 0x40 /* May be a buggy revision of PIIX */
+#define PIIX_NODMA 0x80 /* Don't do DMA with this chip */
+
+/*
+ * Intel IDE chips
+ */
+
+static struct piix_ide_chip {
+ unsigned short id;
+ unsigned char flags;
+} piix_ide_chips[] = {
+ { PCI_DEVICE_ID_INTEL_82801CA_11, PIIX_UDMA_100 | PIIX_PINGPONG }, /* Intel 82801CA ICH3 */
+ { PCI_DEVICE_ID_INTEL_82801CA_10, PIIX_UDMA_100 | PIIX_PINGPONG }, /* Intel 82801CAM ICH3-M */
+ { PCI_DEVICE_ID_INTEL_82801BA_9, PIIX_UDMA_100 | PIIX_PINGPONG }, /* Intel 82801BA ICH2 */
+ { PCI_DEVICE_ID_INTEL_82801BA_8, PIIX_UDMA_100 | PIIX_PINGPONG }, /* Intel 82801BAM ICH2-M */
+ { PCI_DEVICE_ID_INTEL_82801AB_1, PIIX_UDMA_33 | PIIX_PINGPONG }, /* Intel 82801AB ICH0 */
+ { PCI_DEVICE_ID_INTEL_82801AA_1, PIIX_UDMA_66 | PIIX_PINGPONG }, /* Intel 82801AA ICH */
+ { PCI_DEVICE_ID_INTEL_82372FB_1, PIIX_UDMA_66 }, /* Intel 82372FB PIIX5 */
+ { PCI_DEVICE_ID_INTEL_82443MX_1, PIIX_UDMA_33 }, /* Intel 82443MX MPIIX4 */
+ { PCI_DEVICE_ID_INTEL_82371AB, PIIX_UDMA_33 }, /* Intel 82371AB/EB PIIX4/4E */
+ { PCI_DEVICE_ID_INTEL_82371SB_1, PIIX_UDMA_NONE }, /* Intel 82371SB PIIX3 */
+ { PCI_DEVICE_ID_INTEL_82371FB_1, PIIX_UDMA_NONE | PIIX_NO_SITRE | PIIX_CHECK_REV }, /* Intel 82371FB PIIX */
+ { PCI_DEVICE_ID_EFAR_SLC90E66_1, PIIX_UDMA_V66 | PIIX_VICTORY }, /* Efar Victory66 */
+ { 0 }
+};
+
+static struct piix_ide_chip *piix_config;
+static unsigned char piix_enabled;
+static unsigned int piix_80w;
+static unsigned int piix_clock;
+
+static char *piix_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA66", "UDMA100" };
+
+/*
+ * PIIX/ICH /proc entry.
+ */
-#define DISPLAY_PIIX_TIMINGS
+#ifdef CONFIG_PROC_FS
-#if defined(DISPLAY_PIIX_TIMINGS) && defined(CONFIG_PROC_FS)
#include <linux/stat.h>
#include <linux/proc_fs.h>
-static int piix_get_info(char *, char **, off_t, int);
-extern int (*piix_display_info)(char *, char **, off_t, int); /* ide-proc.c */
+byte piix_proc;
+int piix_base;
static struct pci_dev *bmide_dev;
+extern int (*piix_display_info)(char *, char **, off_t, int); /* ide-proc.c */
+
+#define piix_print(format, arg...) p += sprintf(p, format "\n" , ## arg)
+#define piix_print_drive(name, format, arg...)\
+ p += sprintf(p, name); for (i = 0; i < 4; i++) p += sprintf(p, format, ## arg); p += sprintf(p, "\n");
-static int piix_get_info (char *buffer, char **addr, off_t offset, int count)
+static int piix_get_info(char *buffer, char **addr, off_t offset, int count)
{
+ int speed[4], cycle[4], active[4], recover[4], dmaen[4], uen[4], udma[4], umul;
+ struct pci_dev *dev = bmide_dev;
+ unsigned int i, u;
+ unsigned short c, d, e;
+ unsigned char t;
char *p = buffer;
- u32 bibma = pci_resource_start(bmide_dev, 4);
- u16 reg40 = 0, psitre = 0, reg42 = 0, ssitre = 0;
- u8 c0 = 0, c1 = 0;
- u8 reg44 = 0, reg48 = 0, reg4a = 0, reg4b = 0, reg54 = 0, reg55 = 0;
-
- if (bmide_dev->device == PCI_DEVICE_ID_INTEL_82371MX) {
- p += sprintf(p, "\n Intel MPIIX Chipset.\n");
- return p-buffer; /* => must be less than 4k! */
- }
- pci_read_config_word(bmide_dev, 0x40, &reg40);
- pci_read_config_word(bmide_dev, 0x42, &reg42);
- pci_read_config_byte(bmide_dev, 0x44, &reg44);
- pci_read_config_byte(bmide_dev, 0x48, &reg48);
- pci_read_config_byte(bmide_dev, 0x4a, &reg4a);
- pci_read_config_byte(bmide_dev, 0x4b, &reg4b);
- pci_read_config_byte(bmide_dev, 0x54, &reg54);
- pci_read_config_byte(bmide_dev, 0x55, &reg55);
-
- psitre = (reg40 & 0x4000) ? 1 : 0;
- ssitre = (reg42 & 0x4000) ? 1 : 0;
-
- /*
- * at that point bibma+0x2 et bibma+0xa are byte registers
- * to investigate:
- */
- c0 = inb_p((unsigned short)bibma + 0x02);
- c1 = inb_p((unsigned short)bibma + 0x0a);
-
- p += sprintf(p, "\n %s Chipset.\n", bmide_dev->name);
- p += sprintf(p, "--------------- Primary Channel ---------------- Secondary Channel -------------\n");
- p += sprintf(p, " %sabled %sabled\n",
- (c0&0x80) ? "dis" : " en",
- (c1&0x80) ? "dis" : " en");
- p += sprintf(p, "--------------- drive0 --------- drive1 -------- drive0 ---------- drive1 ------\n");
- p += sprintf(p, "DMA enabled: %s %s %s %s\n",
- (c0&0x20) ? "yes" : "no ",
- (c0&0x40) ? "yes" : "no ",
- (c1&0x20) ? "yes" : "no ",
- (c1&0x40) ? "yes" : "no " );
- p += sprintf(p, "UDMA enabled: %s %s %s %s\n",
- (reg48&0x01) ? "yes" : "no ",
- (reg48&0x02) ? "yes" : "no ",
- (reg48&0x04) ? "yes" : "no ",
- (reg48&0x08) ? "yes" : "no " );
- p += sprintf(p, "UDMA enabled: %s %s %s %s\n",
- ((reg54&0x11) && (reg55&0x10) && (reg4a&0x01)) ? "5" :
- ((reg54&0x11) && (reg4a&0x02)) ? "4" :
- ((reg54&0x11) && (reg4a&0x01)) ? "3" :
- (reg4a&0x02) ? "2" :
- (reg4a&0x01) ? "1" :
- (reg4a&0x00) ? "0" : "X",
- ((reg54&0x22) && (reg55&0x20) && (reg4a&0x10)) ? "5" :
- ((reg54&0x22) && (reg4a&0x20)) ? "4" :
- ((reg54&0x22) && (reg4a&0x10)) ? "3" :
- (reg4a&0x20) ? "2" :
- (reg4a&0x10) ? "1" :
- (reg4a&0x00) ? "0" : "X",
- ((reg54&0x44) && (reg55&0x40) && (reg4b&0x03)) ? "5" :
- ((reg54&0x44) && (reg4b&0x02)) ? "4" :
- ((reg54&0x44) && (reg4b&0x01)) ? "3" :
- (reg4b&0x02) ? "2" :
- (reg4b&0x01) ? "1" :
- (reg4b&0x00) ? "0" : "X",
- ((reg54&0x88) && (reg55&0x80) && (reg4b&0x30)) ? "5" :
- ((reg54&0x88) && (reg4b&0x20)) ? "4" :
- ((reg54&0x88) && (reg4b&0x10)) ? "3" :
- (reg4b&0x20) ? "2" :
- (reg4b&0x10) ? "1" :
- (reg4b&0x00) ? "0" : "X");
-
- p += sprintf(p, "UDMA\n");
- p += sprintf(p, "DMA\n");
- p += sprintf(p, "PIO\n");
+ piix_print("----------PIIX BusMastering IDE Configuration---------------");
-/*
- * FIXME.... Add configuration junk data....blah blah......
- */
+ piix_print("Driver Version: 1.2");
+ piix_print("South Bridge: %s", bmide_dev->name);
- return p-buffer; /* => must be less than 4k! */
-}
-#endif /* defined(DISPLAY_PIIX_TIMINGS) && defined(CONFIG_PROC_FS) */
+ pci_read_config_byte(dev, PCI_REVISION_ID, &t);
+ piix_print("Revision: IDE %#x", t);
+ piix_print("Highest DMA rate: %s", piix_config->flags & PIIX_NODMA ? "No DMA"
+ : piix_dma[piix_config->flags & PIIX_UDMA]);
-/*
- * Used to set Fifo configuration via kernel command line:
- */
+ piix_print("BM-DMA base: %#x", piix_base);
+ piix_print("PCI clock: %d.%dMHz", piix_clock / 1000, piix_clock / 100 % 10);
-byte piix_proc = 0;
+ piix_print("-----------------------Primary IDE-------Secondary IDE------");
-extern char *ide_xfer_verbose (byte xfer_rate);
+ pci_read_config_word(dev, PIIX_IDETIM0, &d);
+ pci_read_config_word(dev, PIIX_IDETIM1, &e);
+ piix_print("Enabled: %10s%20s", (d & 0x8000) ? "yes" : "no", (e & 0x8000) ? "yes" : "no");
-#if defined(CONFIG_BLK_DEV_IDEDMA) && defined(CONFIG_PIIX_TUNING)
-/*
- *
- */
-static byte piix_dma_2_pio (byte xfer_rate) {
- switch(xfer_rate) {
- case XFER_UDMA_5:
- case XFER_UDMA_4:
- case XFER_UDMA_3:
- case XFER_UDMA_2:
- case XFER_UDMA_1:
- case XFER_UDMA_0:
- case XFER_MW_DMA_2:
- case XFER_PIO_4:
- return 4;
- case XFER_MW_DMA_1:
- case XFER_PIO_3:
- return 3;
- case XFER_SW_DMA_2:
- case XFER_PIO_2:
- return 2;
- case XFER_MW_DMA_0:
- case XFER_SW_DMA_1:
- case XFER_SW_DMA_0:
- case XFER_PIO_1:
- case XFER_PIO_0:
- case XFER_PIO_SLOW:
- default:
- return 0;
+ c = inb(piix_base + 0x02) | (inb(piix_base + 0x0a) << 8);
+ piix_print("Simplex only: %10s%20s", (c & 0x80) ? "yes" : "no", (c & 0x8000) ? "yes" : "no");
+
+ piix_print("Cable Type: %10s%20s", (piix_80w & 1) ? "80w" : "40w", (piix_80w & 2) ? "80w" : "40w");
+
+ if (!piix_clock)
+ return p - buffer;
+
+ piix_print("-------------------drive0----drive1----drive2----drive3-----");
+
+ piix_print_drive("Prefetch+Post: ", "%10s", (((i & 2) ? d : e) & (1 << (2 + ((i & 1) << 2)))) ? "yes" : "no");
+
+ for (i = 0; i < 4; i++) {
+
+ pci_read_config_word(dev, PIIX_IDETIM0 + (i & 2), &d);
+ if (~piix_config->flags & PIIX_NO_SITRE)
+ pci_read_config_byte(dev, PIIX_SIDETIM, &t);
+
+ umul = 4;
+ udma[i] = uen[i] = 0;
+ active[i] = 12;
+ recover[i] = 18;
+
+ switch (i & 1) {
+ case 1: if (~d & 0x10) break;
+ if ((~piix_config->flags & PIIX_NO_SITRE) && (d & 0x4000)) {
+ active[i] = 5 - ((t >> (((i & 2) << 1) + 2)) & 3);
+ recover[i] = 4 - ((t >> (((i & 2) << 1) + 0)) & 3);
+ break;
+ }
+
+ case 0: if (~d & 0x01) break;
+ active[i] = 5 - ((d >> 12) & 3);
+ recover[i] = 4 - ((d >> 8) & 3);
+ }
+
+ dmaen[i] = (c & ((i & 1) ? 0x40 : 0x20) << ((i & 2) << 2));
+ cycle[i] = 1000000 / piix_clock * (active[i] + recover[i]);
+ speed[i] = 2 * piix_clock / (active[i] + recover[i]);
+
+ if (!(piix_config->flags & PIIX_UDMA))
+ continue;
+
+ pci_read_config_byte(dev, PIIX_UDMACTL, &t);
+ uen[i] = (t & (1 << i)) ? dmaen[i] : 0;
+
+ if (!uen[i])
+ continue;
+
+ pci_read_config_word(dev, PIIX_UDMATIM, &e);
+ pci_read_config_dword(dev, PIIX_IDECFG, &u);
+
+ if (~piix_config->flags & PIIX_VICTORY) {
+ if ((piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_66 && (u & (1 << i))) umul = 2;
+ if ((piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_100 && (u & ((1 << i) + 12))) umul = 1;
+ udma[i] = (4 - ((e >> (i << 2)) & 3)) * umul;
+ } else udma[i] = (8 - ((e >> (i << 2)) & 7)) * 2;
+
+ speed[i] = 8 * piix_clock / udma[i];
+ cycle[i] = 250000 * udma[i] / piix_clock;
}
+
+ piix_print_drive("Transfer Mode: ", "%10s", dmaen[i] ? (uen[i] ? "UDMA" : "DMA") : "PIO");
+
+ piix_print_drive("Address Setup: ", "%8dns", (1000000 / piix_clock) * 3);
+ piix_print_drive("Cmd Active: ", "%8dns", (1000000 / piix_clock) * 12);
+ piix_print_drive("Cmd Recovery: ", "%8dns", (1000000 / piix_clock) * 18);
+ piix_print_drive("Data Active: ", "%8dns", (1000000 / piix_clock) * active[i]);
+ piix_print_drive("Data Recovery: ", "%8dns", (1000000 / piix_clock) * recover[i]);
+ piix_print_drive("Cycle Time: ", "%8dns", cycle[i]);
+ piix_print_drive("Transfer Rate: ", "%4d.%dMB/s", speed[i] / 1000, speed[i] / 100 % 10);
+
+ return p - buffer; /* hoping it is less than 4K... */
}
-#endif /* defined(CONFIG_BLK_DEV_IDEDMA) && (CONFIG_PIIX_TUNING) */
+
+#endif
/*
- * Based on settings done by AMI BIOS
- * (might be useful if drive is not registered in CMOS for any reason).
+ * piix_set_speed() writes timing values to the chipset registers
*/
-static void piix_tune_drive (ide_drive_t *drive, byte pio)
-{
- unsigned long flags;
- u16 master_data;
- u8 slave_data;
- int is_slave = (&HWIF(drive)->drives[1] == drive);
- int master_port = HWIF(drive)->index ? 0x42 : 0x40;
- int slave_port = 0x44;
- /* ISP RTC */
- byte timings[][2] = { { 0, 0 },
- { 0, 0 },
- { 1, 0 },
- { 2, 1 },
- { 2, 3 }, };
-
- if (pio == 255)
- pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
- else
- pio = min_t(byte, pio, 4);
-
- pci_read_config_word(HWIF(drive)->pci_dev, master_port, &master_data);
- if (is_slave) {
- master_data = master_data | 0x4000;
- if (pio > 1)
- /* enable PPE, IE and TIME */
- master_data = master_data | 0x0070;
- pci_read_config_byte(HWIF(drive)->pci_dev, slave_port, &slave_data);
- slave_data = slave_data & (HWIF(drive)->index ? 0x0f : 0xf0);
- slave_data = slave_data | (((timings[pio][0] << 2) | timings[pio][1])
- << (HWIF(drive)->index ? 4 : 0));
- } else {
- master_data = master_data & 0xccf8;
- if (pio > 1)
- /* enable PPE, IE and TIME */
- master_data = master_data | 0x0007;
- master_data = master_data | (timings[pio][0] << 12) |
- (timings[pio][1] << 8);
- }
- save_flags(flags);
- cli();
- pci_write_config_word(HWIF(drive)->pci_dev, master_port, master_data);
- if (is_slave)
- pci_write_config_byte(HWIF(drive)->pci_dev, slave_port, slave_data);
- restore_flags(flags);
-}
-#if defined(CONFIG_BLK_DEV_IDEDMA) && defined(CONFIG_PIIX_TUNING)
-static int piix_tune_chipset (ide_drive_t *drive, byte speed)
+static void piix_set_speed(struct pci_dev *dev, unsigned char dn, struct ata_timing *timing, int umul)
{
- ide_hwif_t *hwif = HWIF(drive);
- struct pci_dev *dev = hwif->pci_dev;
- byte maslave = hwif->channel ? 0x42 : 0x40;
- int a_speed = 3 << (drive->dn * 4);
- int u_flag = 1 << drive->dn;
- int v_flag = 0x01 << drive->dn;
- int w_flag = 0x10 << drive->dn;
- int u_speed = 0;
- int err = 0;
- int sitre;
- short reg4042, reg44, reg48, reg4a, reg54;
- byte reg55;
-
- pci_read_config_word(dev, maslave, &reg4042);
- sitre = (reg4042 & 0x4000) ? 1 : 0;
- pci_read_config_word(dev, 0x44, &reg44);
- pci_read_config_word(dev, 0x48, &reg48);
- pci_read_config_word(dev, 0x4a, &reg4a);
- pci_read_config_word(dev, 0x54, &reg54);
- pci_read_config_byte(dev, 0x55, &reg55);
-
- switch(speed) {
- case XFER_UDMA_4:
- case XFER_UDMA_2: u_speed = 2 << (drive->dn * 4); break;
- case XFER_UDMA_5:
- case XFER_UDMA_3:
- case XFER_UDMA_1: u_speed = 1 << (drive->dn * 4); break;
- case XFER_UDMA_0: u_speed = 0 << (drive->dn * 4); break;
- case XFER_MW_DMA_2:
- case XFER_MW_DMA_1:
- case XFER_SW_DMA_2: break;
- default: return -1;
+ unsigned short t;
+ unsigned char u;
+ unsigned int c;
+
+ pci_read_config_word(dev, PIIX_IDETIM0 + (dn & 2), &t);
+
+ switch (dn & 1) {
+
+ case 1:
+ if (timing->cycle > 9) {
+ t &= ~0x30;
+ break;
+ }
+
+ if (~piix_config->flags & PIIX_NO_SITRE) {
+ pci_read_config_byte(dev, PIIX_SIDETIM, &u);
+ u &= ~(0xf << ((dn & 2) << 1));
+ t |= 0x30;
+ u |= (4 - FIT(timing->recover, 1, 4)) << ((dn & 2) << 1);
+ u |= (5 - FIT(timing->active, 2, 5)) << (((dn & 2) << 1) + 2);
+ pci_write_config_byte(dev, PIIX_SIDETIM, u);
+ break;
+ }
+
+ case 0:
+ if ((~dn & 1) && timing->cycle > 9) {
+ t &= ~0x03;
+ break;
+ }
+
+ t &= 0xccff;
+ t |= 0x03 << ((dn & 1) << 2);
+ t |= (4 - FIT(timing->recover, 1, 4)) << 8;
+ t |= (5 - FIT(timing->active, 2, 5)) << 12;
}
- if (speed >= XFER_UDMA_0) {
- if (!(reg48 & u_flag))
- pci_write_config_word(dev, 0x48, reg48|u_flag);
- if (speed == XFER_UDMA_5) {
- pci_write_config_byte(dev, 0x55, (byte) reg55|w_flag);
+ pci_write_config_word(dev, PIIX_IDETIM0 + (dn & 2), t);
+
+ if (!(piix_config->flags & PIIX_UDMA)) return;
+
+ pci_read_config_byte(dev, PIIX_UDMACTL, &u);
+ u &= ~(1 << dn);
+
+ if (timing->udma) {
+
+ u |= 1 << dn;
+
+ pci_read_config_word(dev, PIIX_UDMATIM, &t);
+
+ if (piix_config->flags & PIIX_VICTORY) {
+ t &= ~(0x07 << (dn << 2));
+ t |= (8 - FIT(timing->udma, 2, 8)) << (dn << 2);
} else {
- pci_write_config_byte(dev, 0x55, (byte) reg55 & ~w_flag);
- }
- if (!(reg4a & u_speed)) {
- pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
- pci_write_config_word(dev, 0x4a, reg4a|u_speed);
+ t &= ~(0x03 << (dn << 2));
+ t |= (4 - FIT(timing->udma, 2, 4)) << (dn << 2);
}
- if (speed > XFER_UDMA_2) {
- if (!(reg54 & v_flag)) {
- pci_write_config_word(dev, 0x54, reg54|v_flag);
+
+ pci_write_config_word(dev, PIIX_UDMATIM, t);
+
+ if ((piix_config->flags & PIIX_UDMA) > PIIX_UDMA_33
+ && ~piix_config->flags & PIIX_VICTORY) {
+
+ pci_read_config_dword(dev, PIIX_IDECFG, &c);
+
+ if ((piix_config->flags & PIIX_UDMA) > PIIX_UDMA_66)
+ c &= ~(1 << (dn + 12));
+ c &= ~(1 << dn);
+
+ switch (umul) {
+ case 2: c |= 1 << dn; break;
+ case 4: c |= 1 << (dn + 12); break;
}
- } else {
- pci_write_config_word(dev, 0x54, reg54 & ~v_flag);
+
+ pci_write_config_dword(dev, PIIX_IDECFG, c);
}
}
- if (speed < XFER_UDMA_0) {
- if (reg48 & u_flag)
- pci_write_config_word(dev, 0x48, reg48 & ~u_flag);
- if (reg4a & a_speed)
- pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
- if (reg54 & v_flag)
- pci_write_config_word(dev, 0x54, reg54 & ~v_flag);
- if (reg55 & w_flag)
- pci_write_config_byte(dev, 0x55, (byte) reg55 & ~w_flag);
+
+ pci_write_config_byte(dev, PIIX_UDMACTL, u);
+}
+
+/*
+ * piix_set_drive() computes timing values configures the drive and
+ * the chipset to a desired transfer mode. It also can be called
+ * by upper layers.
+ */
+
+static int piix_set_drive(ide_drive_t *drive, unsigned char speed)
+{
+ ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1);
+ struct ata_timing t, p;
+ int err, T, UT, umul;
+
+ if (speed != XFER_PIO_SLOW && speed != drive->current_speed)
+ if ((err = ide_config_drive_speed(drive, speed)))
+ return err;
+
+ umul = min((speed > XFER_UDMA_4) ? 4 : ((speed > XFER_UDMA_2) ? 2 : 1),
+ piix_config->flags & PIIX_UDMA);
+
+ if (piix_config->flags & PIIX_VICTORY)
+ umul = 2;
+
+ T = 1000000000 / piix_clock;
+ UT = T / umul;
+
+ ata_timing_compute(drive, speed, &t, T, UT);
+
+ if ((piix_config->flags & PIIX_NO_SITRE) && peer->present) {
+ ata_timing_compute(peer, peer->current_speed, &p, T, UT);
+ if (t.cycle <= 9 && p.cycle <= 9)
+ ata_timing_merge(&p, &t, &t, IDE_TIMING_ALL);
}
- piix_tune_drive(drive, piix_dma_2_pio(speed));
+ piix_set_speed(HWIF(drive)->pci_dev, drive->dn, &t, umul);
-#if PIIX_DEBUG_DRIVE_INFO
- printk("%s: %s drive%d\n", drive->name, ide_xfer_verbose(speed), drive->dn);
-#endif /* PIIX_DEBUG_DRIVE_INFO */
- if (!drive->init_speed)
+ if (!drive->init_speed)
drive->init_speed = speed;
- err = ide_config_drive_speed(drive, speed);
drive->current_speed = speed;
- return err;
+
+ return 0;
}
-static int piix_config_drive_for_dma (ide_drive_t *drive)
+/*
+ * piix_tune_drive() is a callback from upper layers for
+ * PIO-only tuning.
+ */
+
+static void piix_tune_drive(ide_drive_t *drive, unsigned char pio)
{
- struct hd_driveid *id = drive->id;
- ide_hwif_t *hwif = HWIF(drive);
- struct pci_dev *dev = hwif->pci_dev;
- byte speed;
-
- byte udma_66 = eighty_ninty_three(drive);
- int ultra100 = ((dev->device == PCI_DEVICE_ID_INTEL_82801BA_8) ||
- (dev->device == PCI_DEVICE_ID_INTEL_82801BA_9) ||
- (dev->device == PCI_DEVICE_ID_INTEL_82801CA_10)) ? 1 : 0;
- int ultra66 = ((ultra100) ||
- (dev->device == PCI_DEVICE_ID_INTEL_82801AA_1) ||
- (dev->device == PCI_DEVICE_ID_INTEL_82372FB_1)) ? 1 : 0;
- int ultra = ((ultra66) ||
- (dev->device == PCI_DEVICE_ID_INTEL_82371AB) ||
- (dev->device == PCI_DEVICE_ID_INTEL_82443MX_1) ||
- (dev->device == PCI_DEVICE_ID_INTEL_82451NX) ||
- (dev->device == PCI_DEVICE_ID_INTEL_82801AB_1)) ? 1 : 0;
-
- speed = ata_timing_mode(drive, XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA
- | (ultra ? XFER_UDMA : 0) | ((udma_66 & ultra66) ? XFER_UDMA_66 : 0)
- | ((udma_66 & ultra100) ? XFER_UDMA_100 : 0));
-
- (void) piix_tune_chipset(drive, speed);
-
- return ((int) ((id->dma_ultra >> 11) & 7) ? ide_dma_on :
- ((id->dma_ultra >> 8) & 7) ? ide_dma_on :
- ((id->dma_mword >> 8) & 7) ? ide_dma_on :
- ((id->dma_1word >> 8) & 7) ? ide_dma_on :
- ide_dma_off_quietly);
+ if (!((piix_enabled >> HWIF(drive)->channel) & 1))
+ return;
+
+ if (pio == 255) {
+ piix_set_drive(drive, ata_timing_mode(drive, XFER_PIO | XFER_EPIO));
+ return;
+ }
+
+ piix_set_drive(drive, XFER_PIO_0 + min_t(byte, pio, 5));
}
-static void config_chipset_for_pio (ide_drive_t *drive)
+#ifdef CONFIG_BLK_DEV_IDEDMA
+
+/*
+ * piix_dmaproc() is a callback from upper layers that can do
+ * a lot, but we use it for DMA/PIO tuning only, delegating everything
+ * else to the default ide_dmaproc().
+ */
+
+int piix_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
{
- piix_tune_drive(drive, ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0);
+
+ if (func == ide_dma_check) {
+
+ short w80 = HWIF(drive)->udma_four;
+
+ short speed = ata_timing_mode(drive,
+ XFER_PIO | XFER_EPIO |
+ (piix_config->flags & PIIX_NODMA ? 0 : (XFER_SWDMA | XFER_MWDMA |
+ (piix_config->flags & PIIX_UDMA ? XFER_UDMA : 0) |
+ (w80 && (piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_66 ? XFER_UDMA_66 : 0) |
+ (w80 && (piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_100 ? XFER_UDMA_100 : 0))));
+
+ piix_set_drive(drive, speed);
+
+ func = (HWIF(drive)->autodma && (speed & XFER_MODE) != XFER_PIO)
+ ? ide_dma_on : ide_dma_off_quietly;
+
+ }
+
+ return ide_dmaproc(func, drive);
}
-static int config_drive_xfer_rate (ide_drive_t *drive)
+#endif /* CONFIG_BLK_DEV_IDEDMA */
+
+/*
+ * The initialization callback. Here we determine the IDE chip type
+ * and initialize its drive independent registers.
+ */
+
+unsigned int __init pci_init_piix(struct pci_dev *dev, const char *name)
{
- struct hd_driveid *id = drive->id;
- ide_dma_action_t dma_func = ide_dma_on;
-
- if (id && (id->capability & 1) && HWIF(drive)->autodma) {
- /* Consult the list of known "bad" drives */
- if (ide_dmaproc(ide_dma_bad_drive, drive)) {
- dma_func = ide_dma_off;
- goto fast_ata_pio;
- }
- dma_func = ide_dma_off_quietly;
- if (id->field_valid & 4) {
- if (id->dma_ultra & 0x003F) {
- /* Force if Capable UltraDMA */
- dma_func = piix_config_drive_for_dma(drive);
- if ((id->field_valid & 2) &&
- (dma_func != ide_dma_on))
- goto try_dma_modes;
- }
- } else if (id->field_valid & 2) {
-try_dma_modes:
- if ((id->dma_mword & 0x0007) ||
- (id->dma_1word & 0x007)) {
- /* Force if Capable regular DMA modes */
- dma_func = piix_config_drive_for_dma(drive);
- if (dma_func != ide_dma_on)
- goto no_dma_set;
+ unsigned int u;
+ unsigned short w;
+ unsigned char t;
+ int i;
+
+/*
+ * Find out which Intel IDE this is.
+ */
+
+ for (piix_config = piix_ide_chips; piix_config->id != 0; ++piix_config)
+ if (dev->device == piix_config->id)
+ break;
+
+ if (!piix_config->id) {
+ printk(KERN_WARNING "PIIX: Unknown PIIX/ICH chip %#x, contact Vojtech Pavlik <vojtech@ucw.cz>\n", dev->device);
+ return -ENODEV;
+ }
+
+/*
+ * Check for possibly broken DMA configs.
+ */
+
+ {
+ struct pci_dev *orion = NULL;
+
+ if (piix_config->flags & PIIX_CHECK_REV) {
+ pci_read_config_byte(dev, PCI_REVISION_ID, &t);
+ if (t < 2) {
+ printk(KERN_INFO "PIIX: Found buggy old PIIX rev %#x, disabling DMA\n", t);
+ piix_config->flags |= PIIX_NODMA;
}
- } else if (ide_dmaproc(ide_dma_good_drive, drive)) {
- if (id->eide_dma_time > 150) {
- goto no_dma_set;
+ }
+
+ if ((orion = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, NULL))) {
+ pci_read_config_byte(orion, PCI_REVISION_ID, &t);
+ if (t < 4) {
+ printk(KERN_INFO "PIIX: Found buggy 82454GX Orion bridge rev %#x, disabling DMA\n", t);
+ piix_config->flags |= PIIX_NODMA;
}
- /* Consult the list of known "good" drives */
- dma_func = piix_config_drive_for_dma(drive);
- if (dma_func != ide_dma_on)
- goto no_dma_set;
- } else {
- goto fast_ata_pio;
}
- } else if ((id->capability & 8) || (id->field_valid & 2)) {
-fast_ata_pio:
- dma_func = ide_dma_off_quietly;
-no_dma_set:
- config_chipset_for_pio(drive);
}
- return HWIF(drive)->dmaproc(dma_func, drive);
-}
-static int piix_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
-{
- switch (func) {
- case ide_dma_check:
- return config_drive_xfer_rate(drive);
- default :
+/*
+ * Check 80-wire cable presence.
+ */
+
+ switch (piix_config->flags & PIIX_UDMA) {
+
+ case PIIX_UDMA_66:
+ case PIIX_UDMA_100:
+ pci_read_config_dword(dev, PIIX_IDECFG, &u);
+ piix_80w = ((u & 0x30) ? 1 : 0) | ((u & 0xc0) ? 2 : 0);
+ break;
+
+ case PIIX_UDMA_V66:
+ pci_read_config_byte(dev, PIIX_IDESTAT, &t);
+ piix_80w = ((t & 2) ? 1 : 0) | ((t & 1) ? 2 : 0);
break;
}
- /* Other cases are done by generic IDE-DMA code. */
- return ide_dmaproc(func, drive);
-}
-#endif /* defined(CONFIG_BLK_DEV_IDEDMA) && (CONFIG_PIIX_TUNING) */
-unsigned int __init pci_init_piix(struct pci_dev *dev)
-{
-#if defined(DISPLAY_PIIX_TIMINGS) && defined(CONFIG_PROC_FS)
+/*
+ * Enable ping-pong buffers where applicable.
+ */
+
+ if (piix_config->flags & PIIX_PINGPONG) {
+ pci_read_config_dword(dev, PIIX_IDECFG, &u);
+ u |= 0x400;
+ pci_write_config_dword(dev, PIIX_IDECFG, u);
+ }
+
+/*
+ * Detect enabled interfaces, enable slave separate timing if possible.
+ */
+
+ for (i = 0; i < 2; i++) {
+ pci_read_config_word(dev, PIIX_IDETIM0 + (i << 1), &w);
+ piix_enabled |= (w & 0x8000) ? (1 << i) : 0;
+ w &= 0x8c00;
+ if (~piix_config->flags & PIIX_NO_SITRE) w |= 0x4000;
+ w |= 0x44;
+ pci_write_config_word(dev, PIIX_IDETIM0 + (i << 1), w);
+ }
+
+/*
+ * Determine the system bus clock.
+ */
+
+ piix_clock = system_bus_speed * 1000;
+
+ switch (piix_clock) {
+ case 33000: piix_clock = 33333; break;
+ case 37000: piix_clock = 37500; break;
+ case 41000: piix_clock = 41666; break;
+ }
+
+ if (piix_clock < 20000 || piix_clock > 50000) {
+ printk(KERN_WARNING "PIIX: User given PCI clock speed impossible (%d), using 33 MHz instead.\n", piix_clock);
+ printk(KERN_WARNING "PIIX: Use ide0=ata66 if you want to assume 80-wire cable\n");
+ piix_clock = 33333;
+ }
+
+/*
+ * Print the boot message.
+ */
+
+ printk(KERN_INFO "PIIX: %s %s controller on pci%s\n",
+ dev->name, piix_dma[piix_config->flags & PIIX_UDMA], dev->slot_name);
+
+/*
+ * Register /proc/ide/piix entry
+ */
+
+#ifdef CONFIG_PROC_FS
if (!piix_proc) {
- piix_proc = 1;
+ piix_base = pci_resource_start(dev, 4);
bmide_dev = dev;
piix_display_info = &piix_get_info;
+ piix_proc = 1;
}
-#endif /* DISPLAY_PIIX_TIMINGS && CONFIG_PROC_FS */
+#endif
+
return 0;
}
-/*
- * Sheesh, someone at Intel needs to go read the ATA-4/5 T13 standards.
- * It does not specify device detection, but channel!!!
- * You determine later if bit 13 of word93 is set...
- */
-unsigned int __init ata66_piix (ide_hwif_t *hwif)
+unsigned int __init ata66_piix(ide_hwif_t *hwif)
{
- byte reg54h = 0, reg55h = 0, ata66 = 0;
- byte mask = hwif->channel ? 0xc0 : 0x30;
-
- pci_read_config_byte(hwif->pci_dev, 0x54, &reg54h);
- pci_read_config_byte(hwif->pci_dev, 0x55, &reg55h);
-
- ata66 = (reg54h & mask) ? 1 : 0;
-
- return ata66;
+ return ((piix_enabled & piix_80w) >> hwif->channel) & 1;
}
-void __init ide_init_piix (ide_hwif_t *hwif)
+void __init ide_init_piix(ide_hwif_t *hwif)
{
-#ifndef CONFIG_IA64
- if (!hwif->irq)
- hwif->irq = hwif->channel ? 15 : 14;
-#endif /* CONFIG_IA64 */
+ int i;
- if (hwif->pci_dev->device == PCI_DEVICE_ID_INTEL_82371MX) {
- /* This is a painful system best to let it self tune for now */
- return;
+ hwif->tuneproc = &piix_tune_drive;
+ hwif->speedproc = &piix_set_drive;
+ hwif->autodma = 0;
+
+ for (i = 0; i < 2; i++) {
+ hwif->drives[i].io_32bit = 1;
+ hwif->drives[i].unmask = 1;
+ hwif->drives[i].autotune = 1;
+ hwif->drives[i].dn = hwif->channel * 2 + i;
}
- hwif->tuneproc = &piix_tune_drive;
- hwif->drives[0].autotune = 1;
- hwif->drives[1].autotune = 1;
+#ifdef CONFIG_BLK_DEV_IDEDMA
+ if (hwif->dma_base) {
+ hwif->highmem = 1;
+ hwif->dmaproc = &piix_dmaproc;
+#ifdef CONFIG_IDEDMA_AUTO
+ if (!noautodma)
+ hwif->autodma = 1;
+#endif
+ }
+#endif /* CONFIG_BLK_DEV_IDEDMA */
+}
- if (!hwif->dma_base)
- return;
+/*
+ * We allow the BM-DMA driver only work on enabled interfaces,
+ * and only if DMA is safe with the chip and bridge.
+ */
- hwif->highmem = 1;
-#ifndef CONFIG_BLK_DEV_IDEDMA
- hwif->autodma = 0;
-#else /* CONFIG_BLK_DEV_IDEDMA */
-#ifdef CONFIG_PIIX_TUNING
- if (!noautodma)
- hwif->autodma = 1;
- hwif->dmaproc = &piix_dmaproc;
- hwif->speedproc = &piix_tune_chipset;
-#endif /* CONFIG_PIIX_TUNING */
-#endif /* !CONFIG_BLK_DEV_IDEDMA */
+void __init ide_dmacapable_piix(ide_hwif_t *hwif, unsigned long dmabase)
+{
+ if (((piix_enabled >> hwif->channel) & 1)
+ && !(piix_config->flags & PIIX_NODMA))
+ ide_setup_dma(hwif, dmabase, 8);
}
diff --git a/drivers/ide/slc90e66.c b/drivers/ide/slc90e66.c
deleted file mode 100644
index 95159248e95f..000000000000
--- a/drivers/ide/slc90e66.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * linux/drivers/ide/slc90e66.c Version 0.10 October 4, 2000
- *
- * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
- * May be copied or modified under the terms of the GNU General Public License
- *
- * 00:07.1 IDE interface: EFAR Microsystems:
- * Unknown device 9130 (prog-if 8a [Master SecP PriP])
- * Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV-
- * VGASnoop- ParErr- Stepping- SERR- FastB2B-
- * Status: Cap- 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium
- * >TAbort- <TAbort- <MAbort- >SERR- <PERR-
- * Latency: 64
- * Interrupt: pin A routed to IRQ 255
- * Region 4: I/O ports at 1050
- *
- * 00: 55 10 30 91 05 00 00 02 00 8a 01 01 00 40 00 00
- * 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- * 20: 51 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- * 30: 00 00 00 00 00 00 00 00 00 00 00 00 ff 01 00 00
- * 40: 37 e3 33 e3 b9 55 01 00 0d 00 04 22 00 00 00 00
- * 50: 00 00 ff a0 00 00 00 08 40 00 00 00 00 00 00 00
- * 60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- * 70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- * 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- * 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- * a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- * b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- * c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- * d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- * e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- * f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- *
- * This a look-a-like variation of the ICH0 PIIX4 Ultra-66,
- * but this keeps the ISA-Bridge and slots alive.
- *
- */
-
-#include <linux/config.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/ioport.h>
-#include <linux/pci.h>
-#include <linux/hdreg.h>
-#include <linux/ide.h>
-#include <linux/delay.h>
-#include <linux/init.h>
-
-#include <asm/io.h>
-
-#include "ata-timing.h"
-
-#define SLC90E66_DEBUG_DRIVE_INFO 0
-
-#define DISPLAY_SLC90E66_TIMINGS
-
-#if defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS)
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
-
-static int slc90e66_get_info(char *, char **, off_t, int);
-extern int (*slc90e66_display_info)(char *, char **, off_t, int); /* ide-proc.c */
-static struct pci_dev *bmide_dev;
-
-static int slc90e66_get_info (char *buffer, char **addr, off_t offset, int count)
-{
- char *p = buffer;
- u32 bibma = pci_resource_start(bmide_dev, 4);
- u16 reg40 = 0, psitre = 0, reg42 = 0, ssitre = 0;
- u8 c0 = 0, c1 = 0;
- u8 reg44 = 0, reg47 = 0, reg48 = 0, reg4a = 0, reg4b = 0;
-
- pci_read_config_word(bmide_dev, 0x40, &reg40);
- pci_read_config_word(bmide_dev, 0x42, &reg42);
- pci_read_config_byte(bmide_dev, 0x44, &reg44);
- pci_read_config_byte(bmide_dev, 0x47, &reg47);
- pci_read_config_byte(bmide_dev, 0x48, &reg48);
- pci_read_config_byte(bmide_dev, 0x4a, &reg4a);
- pci_read_config_byte(bmide_dev, 0x4b, &reg4b);
-
- psitre = (reg40 & 0x4000) ? 1 : 0;
- ssitre = (reg42 & 0x4000) ? 1 : 0;
-
- /*
- * at that point bibma+0x2 et bibma+0xa are byte registers
- * to investigate:
- */
-#ifdef __mips__ /* only for mips? */
- c0 = inb_p(bibma + 0x02);
- c1 = inb_p(bibma + 0x0a);
-#else
- c0 = inb_p((unsigned short)bibma + 0x02);
- c1 = inb_p((unsigned short)bibma + 0x0a);
-#endif
-
- p += sprintf(p, " SLC90E66 Chipset.\n");
- p += sprintf(p, "--------------- Primary Channel ---------------- Secondary Channel -------------\n");
- p += sprintf(p, " %sabled %sabled\n",
- (c0&0x80) ? "dis" : " en",
- (c1&0x80) ? "dis" : " en");
- p += sprintf(p, "--------------- drive0 --------- drive1 -------- drive0 ---------- drive1 ------\n");
- p += sprintf(p, "DMA enabled: %s %s %s %s\n",
- (c0&0x20) ? "yes" : "no ",
- (c0&0x40) ? "yes" : "no ",
- (c1&0x20) ? "yes" : "no ",
- (c1&0x40) ? "yes" : "no " );
- p += sprintf(p, "UDMA enabled: %s %s %s %s\n",
- (reg48&0x01) ? "yes" : "no ",
- (reg48&0x02) ? "yes" : "no ",
- (reg48&0x04) ? "yes" : "no ",
- (reg48&0x08) ? "yes" : "no " );
- p += sprintf(p, "UDMA enabled: %s %s %s %s\n",
- ((reg4a&0x04)==0x04) ? "4" :
- ((reg4a&0x03)==0x03) ? "3" :
- (reg4a&0x02) ? "2" :
- (reg4a&0x01) ? "1" :
- (reg4a&0x00) ? "0" : "X",
- ((reg4a&0x40)==0x40) ? "4" :
- ((reg4a&0x30)==0x30) ? "3" :
- (reg4a&0x20) ? "2" :
- (reg4a&0x10) ? "1" :
- (reg4a&0x00) ? "0" : "X",
- ((reg4b&0x04)==0x04) ? "4" :
- ((reg4b&0x03)==0x03) ? "3" :
- (reg4b&0x02) ? "2" :
- (reg4b&0x01) ? "1" :
- (reg4b&0x00) ? "0" : "X",
- ((reg4b&0x40)==0x40) ? "4" :
- ((reg4b&0x30)==0x30) ? "3" :
- (reg4b&0x20) ? "2" :
- (reg4b&0x10) ? "1" :
- (reg4b&0x00) ? "0" : "X");
-
- p += sprintf(p, "UDMA\n");
- p += sprintf(p, "DMA\n");
- p += sprintf(p, "PIO\n");
-
-/*
- * FIXME.... Add configuration junk data....blah blah......
- */
-
- return p-buffer; /* => must be less than 4k! */
-}
-#endif /* defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS) */
-
-/*
- * Used to set Fifo configuration via kernel command line:
- */
-
-byte slc90e66_proc = 0;
-
-extern char *ide_xfer_verbose (byte xfer_rate);
-
-#ifdef CONFIG_BLK_DEV_IDEDMA
-/*
- *
- */
-static byte slc90e66_dma_2_pio (byte xfer_rate) {
- switch(xfer_rate) {
- case XFER_UDMA_4:
- case XFER_UDMA_3:
- case XFER_UDMA_2:
- case XFER_UDMA_1:
- case XFER_UDMA_0:
- case XFER_MW_DMA_2:
- case XFER_PIO_4:
- return 4;
- case XFER_MW_DMA_1:
- case XFER_PIO_3:
- return 3;
- case XFER_SW_DMA_2:
- case XFER_PIO_2:
- return 2;
- case XFER_MW_DMA_0:
- case XFER_SW_DMA_1:
- case XFER_SW_DMA_0:
- case XFER_PIO_1:
- case XFER_PIO_0:
- case XFER_PIO_SLOW:
- default:
- return 0;
- }
-}
-#endif /* CONFIG_BLK_DEV_IDEDMA */
-
-/*
- * Based on settings done by AMI BIOS
- * (might be useful if drive is not registered in CMOS for any reason).
- */
-static void slc90e66_tune_drive (ide_drive_t *drive, byte pio)
-{
- unsigned long flags;
- u16 master_data;
- byte slave_data;
- int is_slave = (&HWIF(drive)->drives[1] == drive);
- int master_port = HWIF(drive)->index ? 0x42 : 0x40;
- int slave_port = 0x44;
- /* ISP RTC */
- byte timings[][2] = { { 0, 0 },
- { 0, 0 },
- { 1, 0 },
- { 2, 1 },
- { 2, 3 }, };
-
- if (pio == 255)
- pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
- else
- pio = min_t(byte, pio, 4);
-
- pci_read_config_word(HWIF(drive)->pci_dev, master_port, &master_data);
- if (is_slave) {
- master_data = master_data | 0x4000;
- if (pio > 1)
- /* enable PPE, IE and TIME */
- master_data = master_data | 0x0070;
- pci_read_config_byte(HWIF(drive)->pci_dev, slave_port, &slave_data);
- slave_data = slave_data & (HWIF(drive)->index ? 0x0f : 0xf0);
- slave_data = slave_data | ((timings[pio][0] << 2) | (timings[pio][1]
- << (HWIF(drive)->index ? 4 : 0)));
- } else {
- master_data = master_data & 0xccf8;
- if (pio > 1)
- /* enable PPE, IE and TIME */
- master_data = master_data | 0x0007;
- master_data = master_data | (timings[pio][0] << 12) |
- (timings[pio][1] << 8);
- }
- save_flags(flags);
- cli();
- pci_write_config_word(HWIF(drive)->pci_dev, master_port, master_data);
- if (is_slave)
- pci_write_config_byte(HWIF(drive)->pci_dev, slave_port, slave_data);
- restore_flags(flags);
-}
-
-#ifdef CONFIG_BLK_DEV_IDEDMA
-static int slc90e66_tune_chipset (ide_drive_t *drive, byte speed)
-{
- ide_hwif_t *hwif = HWIF(drive);
- struct pci_dev *dev = hwif->pci_dev;
- byte maslave = hwif->channel ? 0x42 : 0x40;
- int a_speed = 7 << (drive->dn * 4);
- int u_flag = 1 << drive->dn;
- int u_speed = 0;
- int err = 0;
- int sitre;
- short reg4042, reg44, reg48, reg4a;
-
- pci_read_config_word(dev, maslave, &reg4042);
- sitre = (reg4042 & 0x4000) ? 1 : 0;
- pci_read_config_word(dev, 0x44, &reg44);
- pci_read_config_word(dev, 0x48, &reg48);
- pci_read_config_word(dev, 0x4a, &reg4a);
-
- switch(speed) {
- case XFER_UDMA_4: u_speed = 4 << (drive->dn * 4); break;
- case XFER_UDMA_3: u_speed = 3 << (drive->dn * 4); break;
- case XFER_UDMA_2: u_speed = 2 << (drive->dn * 4); break;
- case XFER_UDMA_1: u_speed = 1 << (drive->dn * 4); break;
- case XFER_UDMA_0: u_speed = 0 << (drive->dn * 4); break;
- case XFER_MW_DMA_2:
- case XFER_MW_DMA_1:
- case XFER_SW_DMA_2: break;
-#if 0 /* allow PIO modes */
- default: return -1;
-#endif
- }
-
- if (speed >= XFER_UDMA_0) {
- if (!(reg48 & u_flag))
- pci_write_config_word(dev, 0x48, reg48|u_flag);
- if ((reg4a & u_speed) != u_speed) {
- pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
- pci_read_config_word(dev, 0x4a, &reg4a);
- pci_write_config_word(dev, 0x4a, reg4a|u_speed);
- }
- }
- if (speed < XFER_UDMA_0) {
- if (reg48 & u_flag)
- pci_write_config_word(dev, 0x48, reg48 & ~u_flag);
- if (reg4a & a_speed)
- pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
- }
-
- slc90e66_tune_drive(drive, slc90e66_dma_2_pio(speed));
-
-#if SLC90E66_DEBUG_DRIVE_INFO
- printk("%s: %s drive%d\n", drive->name, ide_xfer_verbose(speed), drive->dn);
-#endif /* SLC90E66_DEBUG_DRIVE_INFO */
- if (!drive->init_speed)
- drive->init_speed = speed;
- err = ide_config_drive_speed(drive, speed);
- drive->current_speed = speed;
- return err;
-}
-
-static int slc90e66_config_drive_for_dma (ide_drive_t *drive)
-{
- struct hd_driveid *id = drive->id;
- int ultra = 1;
- byte speed = 0;
- byte udma_66 = eighty_ninty_three(drive);
-
-#if 1 /* allow PIO modes */
- if (!HWIF(drive)->autodma) {
- speed = ata_timing_mode(drive, XFER_PIO | XFER_EPIO);
- (void) slc90e66_tune_chipset(drive, speed);
- return ((int) ide_dma_off_quietly);
- }
-#endif
-
- speed = ata_timing_mode(drive, XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA
- | (ultra ? XFER_UDMA : 0) | ((ultra && udma_66) ? XFER_UDMA_66 : 0));
-
- (void) slc90e66_tune_chipset(drive, speed);
-
- return ((int) ((id->dma_ultra >> 11) & 7) ? ide_dma_on :
- ((id->dma_ultra >> 8) & 7) ? ide_dma_on :
- ((id->dma_mword >> 8) & 7) ? ide_dma_on :
- ((id->dma_1word >> 8) & 7) ? ide_dma_on :
- ide_dma_off_quietly);
-}
-
-static int slc90e66_dmaproc(ide_dma_action_t func, ide_drive_t *drive)
-{
- switch (func) {
- case ide_dma_check:
- return ide_dmaproc((ide_dma_action_t) slc90e66_config_drive_for_dma(drive), drive);
- default :
- break;
- }
- /* Other cases are done by generic IDE-DMA code. */
- return ide_dmaproc(func, drive);
-}
-#endif /* CONFIG_BLK_DEV_IDEDMA */
-
-unsigned int __init pci_init_slc90e66(struct pci_dev *dev)
-{
-#if defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS)
- if (!slc90e66_proc) {
- slc90e66_proc = 1;
- bmide_dev = dev;
- slc90e66_display_info = &slc90e66_get_info;
- }
-#endif /* DISPLAY_SLC90E66_TIMINGS && CONFIG_PROC_FS */
- return 0;
-}
-
-unsigned int __init ata66_slc90e66 (ide_hwif_t *hwif)
-{
-#if 1
- byte reg47 = 0, ata66 = 0;
- byte mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */
-
- pci_read_config_byte(hwif->pci_dev, 0x47, &reg47);
-
- ata66 = (reg47 & mask) ? 0 : 1; /* bit[0(1)]: 0:80, 1:40 */
-#else
- byte ata66 = 0;
-#endif
- return ata66;
-}
-
-void __init ide_init_slc90e66 (ide_hwif_t *hwif)
-{
- if (!hwif->irq)
- hwif->irq = hwif->channel ? 15 : 14;
-
- hwif->tuneproc = &slc90e66_tune_drive;
- hwif->drives[0].autotune = 1;
- hwif->drives[1].autotune = 1;
-
- if (!hwif->dma_base)
- return;
-
- hwif->autodma = 0;
- hwif->highmem = 1;
-#ifdef CONFIG_BLK_DEV_IDEDMA
- if (!noautodma)
- hwif->autodma = 1;
- hwif->dmaproc = &slc90e66_dmaproc;
- hwif->speedproc = &slc90e66_tune_chipset;
-#endif /* !CONFIG_BLK_DEV_IDEDMA */
-}
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 890ca713c999..a8fa051737f8 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1710,7 +1710,6 @@ struct pci_pool { /* the pool */
spinlock_t lock;
size_t blocks_per_page;
size_t size;
- int flags;
struct pci_dev *dev;
size_t allocation;
char name [32];
@@ -1727,8 +1726,6 @@ struct pci_page { /* cacheable header for 'allocation' bytes */
#define POOL_TIMEOUT_JIFFIES ((100 /* msec */ * HZ) / 1000)
#define POOL_POISON_BYTE 0xa7
-// #define CONFIG_PCIPOOL_DEBUG
-
/**
* pci_pool_create - Creates a pool of pci consistent memory blocks, for dma.
@@ -1737,7 +1734,7 @@ struct pci_page { /* cacheable header for 'allocation' bytes */
* @size: size of the blocks in this pool.
* @align: alignment requirement for blocks; must be a power of two
* @allocation: returned blocks won't cross this boundary (or zero)
- * @flags: SLAB_* flags (not all are supported).
+ * @mem_flags: SLAB_* flags.
*
* Returns a pci allocation pool with the requested characteristics, or
* null if one can't be created. Given one of these pools, pci_pool_alloc()
@@ -1753,7 +1750,7 @@ struct pci_page { /* cacheable header for 'allocation' bytes */
*/
struct pci_pool *
pci_pool_create (const char *name, struct pci_dev *pdev,
- size_t size, size_t align, size_t allocation, int flags)
+ size_t size, size_t align, size_t allocation, int mem_flags)
{
struct pci_pool *retval;
@@ -1777,13 +1774,9 @@ pci_pool_create (const char *name, struct pci_dev *pdev,
} else if (allocation < size)
return 0;
- if (!(retval = kmalloc (sizeof *retval, flags)))
+ if (!(retval = kmalloc (sizeof *retval, mem_flags)))
return retval;
-#ifdef CONFIG_PCIPOOL_DEBUG
- flags |= SLAB_POISON;
-#endif
-
strncpy (retval->name, name, sizeof retval->name);
retval->name [sizeof retval->name - 1] = 0;
@@ -1791,17 +1784,10 @@ pci_pool_create (const char *name, struct pci_dev *pdev,
INIT_LIST_HEAD (&retval->page_list);
spin_lock_init (&retval->lock);
retval->size = size;
- retval->flags = flags;
retval->allocation = allocation;
retval->blocks_per_page = allocation / size;
init_waitqueue_head (&retval->waitq);
-#ifdef CONFIG_PCIPOOL_DEBUG
- printk (KERN_DEBUG "pcipool create %s/%s size %d, %d/page (%d alloc)\n",
- pdev ? pdev->slot_name : NULL, retval->name, size,
- retval->blocks_per_page, allocation);
-#endif
-
return retval;
}
@@ -1824,8 +1810,9 @@ pool_alloc_page (struct pci_pool *pool, int mem_flags)
&page->dma);
if (page->vaddr) {
memset (page->bitmap, 0xff, mapsize); // bit set == free
- if (pool->flags & SLAB_POISON)
- memset (page->vaddr, POOL_POISON_BYTE, pool->allocation);
+#ifdef CONFIG_DEBUG_SLAB
+ memset (page->vaddr, POOL_POISON_BYTE, pool->allocation);
+#endif
list_add (&page->page_list, &pool->page_list);
} else {
kfree (page);
@@ -1851,8 +1838,9 @@ pool_free_page (struct pci_pool *pool, struct pci_page *page)
{
dma_addr_t dma = page->dma;
- if (pool->flags & SLAB_POISON)
- memset (page->vaddr, POOL_POISON_BYTE, pool->allocation);
+#ifdef CONFIG_DEBUG_SLAB
+ memset (page->vaddr, POOL_POISON_BYTE, pool->allocation);
+#endif
pci_free_consistent (pool->dev, pool->allocation, page->vaddr, dma);
list_del (&page->page_list);
kfree (page);
@@ -1871,12 +1859,6 @@ pci_pool_destroy (struct pci_pool *pool)
{
unsigned long flags;
-#ifdef CONFIG_PCIPOOL_DEBUG
- printk (KERN_DEBUG "pcipool destroy %s/%s\n",
- pool->dev ? pool->dev->slot_name : NULL,
- pool->name);
-#endif
-
spin_lock_irqsave (&pool->lock, flags);
while (!list_empty (&pool->page_list)) {
struct pci_page *page;
@@ -2010,30 +1992,27 @@ pci_pool_free (struct pci_pool *pool, void *vaddr, dma_addr_t dma)
pool->name, vaddr, (unsigned long) dma);
return;
}
-#ifdef CONFIG_PCIPOOL_DEBUG
- if (((dma - page->dma) + (void *)page->vaddr) != vaddr) {
- printk (KERN_ERR "pci_pool_free %s/%s, %p (bad vaddr)/%lx\n",
- pool->dev ? pool->dev->slot_name : NULL,
- pool->name, vaddr, (unsigned long) dma);
- return;
- }
-#endif
block = dma - page->dma;
block /= pool->size;
map = block / BITS_PER_LONG;
block %= BITS_PER_LONG;
-#ifdef CONFIG_PCIPOOL_DEBUG
+#ifdef CONFIG_DEBUG_SLAB
+ if (((dma - page->dma) + (void *)page->vaddr) != vaddr) {
+ printk (KERN_ERR "pci_pool_free %s/%s, %p (bad vaddr)/%lx\n",
+ pool->dev ? pool->dev->slot_name : NULL,
+ pool->name, vaddr, (unsigned long) dma);
+ return;
+ }
if (page->bitmap [map] & (1UL << block)) {
printk (KERN_ERR "pci_pool_free %s/%s, dma %x already free\n",
pool->dev ? pool->dev->slot_name : NULL,
pool->name, dma);
return;
}
+ memset (vaddr, POOL_POISON_BYTE, pool->size);
#endif
- if (pool->flags & SLAB_POISON)
- memset (vaddr, POOL_POISON_BYTE, pool->size);
spin_lock_irqsave (&pool->lock, flags);
set_bit (block, &page->bitmap [map]);
diff --git a/drivers/pci/pci.ids b/drivers/pci/pci.ids
index 9c67a2796b87..29a97f2b8138 100644
--- a/drivers/pci/pci.ids
+++ b/drivers/pci/pci.ids
@@ -526,8 +526,10 @@
2040 79c974
7006 AMD-751 [Irongate] System Controller
7007 AMD-751 [Irongate] AGP Bridge
- 700e AMD-760 [Irongate] System Controller
- 700f AMD-760 [Irongate] AGP Bridge
+ 700c AMD-760 MP [IGD4-2P] System Controller
+ 700d AMD-760 MP [IGD4-2P] AGP Bridge
+ 700e AMD-760 [IGD4-1P] System Controller
+ 700f AMD-760 [IGD4-1P] AGP Bridge
7400 AMD-755 [Cobra] ISA
7401 AMD-755 [Cobra] IDE
7403 AMD-755 [Cobra] ACPI
@@ -540,11 +542,21 @@
7411 AMD-765 [Viper] IDE
7413 AMD-765 [Viper] ACPI
7414 AMD-765 [Viper] USB
- 7440 AMD-768 [??] ISA
- 7441 AMD-768 [??] IDE
- 7443 AMD-768 [??] ACPI
- 7448 AMD-768 [??] PCI
- 7449 AMD-768 [??] USB
+ 7440 AMD-768 [Opus] ISA
+ 7441 AMD-768 [Opus] IDE
+ 7443 AMD-768 [Opus] ACPI
+ 7448 AMD-768 [Opus] PCI
+ 7449 AMD-768 [Opus] USB
+ 7454 AMD-8151 System Controller
+ 7455 AMD-8151 AGP Bridge
+ 7460 AMD-8111 PCI
+ 7461 AMD-8111 USB
+ 7462 AMD-8111 Ethernet
+ 7468 AMD-8111 LPC
+ 7469 AMD-8111 IDE
+ 746a AMD-8111 SMBus 2.0
+ 746b AMD-8111 ACPI
+ 746d AMD-8111 AC97 Audio
1023 Trident Microsystems
0194 82C194
2000 4DWave DX
@@ -1055,11 +1067,11 @@
1052 ?Young Micro Systems
1053 Young Micro Systems
1054 Hitachi, Ltd
-1055 EFAR Microsystems
- 9130 EIDE Controller
- 9460 PCI to ISA Bridge
- 9462 USB Universal Host Controller [OHCI]
- 9463 Power Management Controller [Bridge]
+1055 Efar Microsystems
+ 9130 slc90e66 [Victory66] IDE
+ 9460 slc90e66 [Victory66] ISA
+ 9462 slc90e66 [Victory66] USB
+ 9463 slc90e66 [Victory66] ACPI
1056 ICL
# Motorola made a mistake and used 1507 instead of 1057 in some chips. Please look at the 1507 entry as well when updating this.
1057 Motorola
@@ -1925,6 +1937,7 @@
0151 NV15 DDR (GeForce2 GTS)
0152 NV15 Bladerunner (GeForce2 Ultra)
0153 NV15 GL (Quadro2 Pro)
+ 01bc nForce IDE
0200 NV20 (GeForce3)
0203 Quadro DCC
10df Emulex Corporation
@@ -5066,6 +5079,8 @@
244c 82820 820 (Camino 2) Chipset ISA Bridge (ICH2-M)
244e 82820 820 (Camino 2) Chipset PCI
2485 AC'97 Audio Controller
+ 248a 82801CAM ICH3-M IDE
+ 248b 82801CA ICH3 IDE
2500 82820 820 (Camino) Chipset Host Bridge (MCH)
1043 801c P3C-2000 system chipset
2501 82820 820 (Camino) Chipset Host Bridge (MCH)
@@ -5118,10 +5133,10 @@
71a0 440GX - 82443GX Host bridge
71a1 440GX - 82443GX AGP bridge
71a2 440GX - 82443GX Host bridge (AGP disabled)
- 7600 82372FB PCI to ISA Bridge
- 7601 82372FB PIIX4 IDE
- 7602 82372FB [PCI-to-USB UHCI]
- 7603 82372FB System Management Bus Controller
+ 7600 82372FB PIIX5 ISA
+ 7601 82372FB PIIX5 IDE
+ 7602 82372FB PIIX5 USB
+ 7603 82372FB PIIX5 SMBus
7800 i740
1092 0100 Stealth II G460
8086 0100 Intel740 Graphics Accelerator
diff --git a/drivers/pnp/isapnp.c b/drivers/pnp/isapnp.c
index 2b23cf559079..d81324484ff8 100644
--- a/drivers/pnp/isapnp.c
+++ b/drivers/pnp/isapnp.c
@@ -2273,6 +2273,39 @@ EXPORT_SYMBOL(isapnp_resource_change);
EXPORT_SYMBOL(isapnp_register_driver);
EXPORT_SYMBOL(isapnp_unregister_driver);
+static struct device_driver isapnp_device_driver = {};
+
+static inline int isapnp_init_device_tree(void)
+{
+ struct pci_bus *card;
+ struct pci_dev *parent = pci_find_class(PCI_CLASS_BRIDGE_ISA << 8, NULL);
+
+ isapnp_for_each_card(card) {
+ struct list_head *devlist;
+
+ card->dev = isapnp_alloc(sizeof(*card->dev));
+ if (!card->dev)
+ break;
+ snprintf(card->dev->name, sizeof(card->dev->name), "%s", card->name);
+ sprintf(card->dev->bus_id, "isapnp%d", card->number);
+ card->dev->parent = parent ? &parent->dev : NULL;
+ card->dev->driver = &isapnp_device_driver;
+ device_register(card->dev);
+
+ for (devlist = card->devices.next; devlist != &card->devices; devlist = devlist->next) {
+ struct pci_dev *dev = pci_dev_b(devlist);
+
+ snprintf(dev->dev.name, sizeof(dev->dev.name), "%s", dev->name);
+ sprintf(dev->dev.bus_id, "%d", dev->devfn);
+ dev->dev.parent = card->dev;
+ dev->dev.driver = &isapnp_device_driver;
+ device_register(&dev->dev);
+ }
+ }
+
+ return 0;
+}
+
int __init isapnp_init(void)
{
int cards;
@@ -2351,6 +2384,9 @@ int __init isapnp_init(void)
} else {
printk(KERN_INFO "isapnp: No Plug & Play card found\n");
}
+
+ isapnp_init_device_tree();
+
#ifdef CONFIG_PROC_FS
isapnp_proc_init();
#endif
@@ -2361,10 +2397,28 @@ subsys_initcall(isapnp_init);
#ifdef MODULE
+static inline void isapnp_cleanup_device_tree(void)
+{
+ struct pci_bus *card;
+
+ isapnp_for_each_card(card) {
+ struct list_head *devlist;
+
+ for (devlist = card->devices.next; devlist != &card->devices; devlist = devlist->next) {
+ struct pci_dev *dev = pci_dev_b(devlist);
+
+ put_device(&dev->dev);
+ }
+ put_device(card->dev);
+ }
+}
+
void cleanup_module(void)
{
- if (isapnp_detected)
+ if (isapnp_detected) {
+ isapnp_cleanup_device_tree();
isapnp_free_all_resources();
+ }
}
#else
diff --git a/drivers/usb/Config.help b/drivers/usb/Config.help
index f76202f07b7a..28a88d96a72c 100644
--- a/drivers/usb/Config.help
+++ b/drivers/usb/Config.help
@@ -382,6 +382,7 @@ CONFIG_USB_KAWETH
CONFIG_USB_CATC
Say Y if you want to use one of the following 10Mbps USB Ethernet
device based on the EL1210A chip. Supported devices are:
+ Belkin F5U011
Belkin F5U111
CATC NetMate
CATC NetMate II
diff --git a/drivers/usb/catc.c b/drivers/usb/catc.c
index 3bea97a3c04e..37a300d9e2d0 100644
--- a/drivers/usb/catc.c
+++ b/drivers/usb/catc.c
@@ -7,6 +7,9 @@
*
* Based on the work of
* Donald Becker
+ *
+ * Old chipset support added by Simon Evans <spse@secret.org.uk> 2002
+ * - adds support for Belkin F5U011
*/
/*
@@ -70,6 +73,7 @@ MODULE_LICENSE("GPL");
#define RX_MAX_BURST 15 /* Max packets per rx buffer (> 0, < 16) */
#define TX_MAX_BURST 15 /* Max full sized packets per tx buffer (> 0) */
#define CTRL_QUEUE 16 /* Max control requests in flight (power of two) */
+#define RX_PKT_SZ 1600 /* Max size of receive packet for F5U011 */
/*
* Control requests.
@@ -80,6 +84,7 @@ enum control_requests {
GetMac = 0xf2,
Reset = 0xf4,
SetMac = 0xf5,
+ SetRxMode = 0xf5, /* F5U011 only */
WriteROM = 0xf8,
SetReg = 0xfa,
GetReg = 0xfb,
@@ -127,6 +132,7 @@ enum rx_filter_bits {
RxForceOK = 0x04,
RxMultiCast = 0x08,
RxPromisc = 0x10,
+ AltRxPromisc = 0x20, /* F5U011 uses different bit */
};
enum led_values {
@@ -137,6 +143,12 @@ enum led_values {
LEDLink = 0x08,
};
+enum link_status {
+ LinkNoChange = 0,
+ LinkGood = 1,
+ LinkBad = 2
+};
+
/*
* The catc struct.
*/
@@ -180,6 +192,10 @@ struct catc {
} ctrl_queue[CTRL_QUEUE];
struct urb *tx_urb, *rx_urb, *irq_urb, *ctrl_urb;
+
+ u8 is_f5u011; /* Set if device is an F5U011 */
+ u8 rxmode[2]; /* Used for F5U011 */
+ atomic_t recq_sz; /* Used for F5U011 - counter of waiting rx packets */
};
/*
@@ -193,6 +209,10 @@ struct catc {
#define catc_write_mem(catc, addr, buf, size) catc_ctrl_msg(catc, USB_DIR_OUT, WriteMem, 0, addr, buf, size)
#define catc_read_mem(catc, addr, buf, size) catc_ctrl_msg(catc, USB_DIR_IN, ReadMem, 0, addr, buf, size)
+#define f5u011_rxmode(catc, rxmode) catc_ctrl_msg(catc, USB_DIR_OUT, SetRxMode, 0, 1, rxmode, 2)
+#define f5u011_rxmode_async(catc, rxmode) catc_ctrl_async(catc, USB_DIR_OUT, SetRxMode, 0, 1, &rxmode, 2, NULL)
+#define f5u011_mchash_async(catc, hash) catc_ctrl_async(catc, USB_DIR_OUT, SetRxMode, 0, 2, &hash, 8, NULL)
+
#define catc_set_reg_async(catc, reg, val) catc_ctrl_async(catc, USB_DIR_OUT, SetReg, val, reg, NULL, 0, NULL)
#define catc_get_reg_async(catc, reg, cb) catc_ctrl_async(catc, USB_DIR_IN, GetReg, 0, reg, NULL, 1, cb)
#define catc_write_mem_async(catc, addr, buf, size) catc_ctrl_async(catc, USB_DIR_OUT, WriteMem, 0, addr, buf, size, NULL)
@@ -206,9 +226,12 @@ static void catc_rx_done(struct urb *urb)
struct catc *catc = urb->context;
u8 *pkt_start = urb->transfer_buffer;
struct sk_buff *skb;
- int pkt_len;
+ int pkt_len, pkt_offset = 0;
- clear_bit(RX_RUNNING, &catc->flags);
+ if (!catc->is_f5u011) {
+ clear_bit(RX_RUNNING, &catc->flags);
+ pkt_offset = 2;
+ }
if (urb->status) {
dbg("rx_done, status %d, length %d", urb->status, urb->actual_length);
@@ -216,19 +239,22 @@ static void catc_rx_done(struct urb *urb)
}
do {
- pkt_len = le16_to_cpup((u16*)pkt_start);
-
- if (pkt_len > urb->actual_length) {
- catc->stats.rx_length_errors++;
- catc->stats.rx_errors++;
- break;
+ if(!catc->is_f5u011) {
+ pkt_len = le16_to_cpup((u16*)pkt_start);
+ if (pkt_len > urb->actual_length) {
+ catc->stats.rx_length_errors++;
+ catc->stats.rx_errors++;
+ break;
+ }
+ } else {
+ pkt_len = urb->actual_length;
}
if (!(skb = dev_alloc_skb(pkt_len)))
return;
skb->dev = catc->netdev;
- eth_copy_and_sum(skb, pkt_start + 2, pkt_len, 0);
+ eth_copy_and_sum(skb, pkt_start + pkt_offset, pkt_len, 0);
skb_put(skb, pkt_len);
skb->protocol = eth_type_trans(skb, catc->netdev);
@@ -237,11 +263,28 @@ static void catc_rx_done(struct urb *urb)
catc->stats.rx_packets++;
catc->stats.rx_bytes += pkt_len;
+ /* F5U011 only does one packet per RX */
+ if (catc->is_f5u011)
+ break;
pkt_start += (((pkt_len + 1) >> 6) + 1) << 6;
} while (pkt_start - (u8 *) urb->transfer_buffer < urb->actual_length);
catc->netdev->last_rx = jiffies;
+
+ if (catc->is_f5u011) {
+ if (atomic_read(&catc->recq_sz)) {
+ int status;
+ atomic_dec(&catc->recq_sz);
+ dbg("getting extra packet");
+ urb->dev = catc->usbdev;
+ if ((status = usb_submit_urb(urb, GFP_KERNEL)) < 0) {
+ dbg("submit(rx_urb) status %d", status);
+ }
+ } else {
+ clear_bit(RX_RUNNING, &catc->flags);
+ }
+ }
}
static void catc_irq_done(struct urb *urb)
@@ -249,29 +292,48 @@ static void catc_irq_done(struct urb *urb)
struct catc *catc = urb->context;
u8 *data = urb->transfer_buffer;
int status;
+ unsigned int hasdata = 0, linksts = LinkNoChange;
+
+ if (!catc->is_f5u011) {
+ hasdata = data[1] & 0x80;
+ if (data[1] & 0x40)
+ linksts = LinkGood;
+ else if (data[1] & 0x20)
+ linksts = LinkBad;
+ } else {
+ hasdata = (unsigned int)(be16_to_cpup((u16*)data) & 0x0fff);
+ if (data[0] == 0x90)
+ linksts = LinkGood;
+ else if (data[0] == 0xA0)
+ linksts = LinkBad;
+ }
if (urb->status) {
dbg("irq_done, status %d, data %02x %02x.", urb->status, data[0], data[1]);
return;
}
- if ((data[1] & 0x80) && !test_and_set_bit(RX_RUNNING, &catc->flags)) {
- catc->rx_urb->dev = catc->usbdev;
- if ((status = usb_submit_urb(catc->rx_urb, GFP_KERNEL)) < 0) {
- err("submit(rx_urb) status %d", status);
- return;
- }
- }
-
- if (data[1] & 0x40) {
+ if (linksts == LinkGood) {
netif_carrier_on(catc->netdev);
dbg("link ok");
}
- if (data[1] & 0x20) {
+ if (linksts == LinkBad) {
netif_carrier_off(catc->netdev);
dbg("link bad");
}
+
+ if (hasdata) {
+ if (test_and_set_bit(RX_RUNNING, &catc->flags)) {
+ if (catc->is_f5u011)
+ atomic_inc(&catc->recq_sz);
+ } else {
+ catc->rx_urb->dev = catc->usbdev;
+ if ((status = usb_submit_urb(catc->rx_urb, GFP_KERNEL)) < 0) {
+ err("submit(rx_urb) status %d", status);
+ }
+ }
+ }
}
/*
@@ -282,6 +344,9 @@ static void catc_tx_run(struct catc *catc)
{
int status;
+ if (catc->is_f5u011)
+ catc->tx_ptr = (catc->tx_ptr + 63) & ~63;
+
catc->tx_urb->transfer_buffer_length = catc->tx_ptr;
catc->tx_urb->transfer_buffer = catc->tx_buf[catc->tx_idx];
catc->tx_urb->dev = catc->usbdev;
@@ -338,14 +403,15 @@ static int catc_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev)
catc->tx_ptr = (((catc->tx_ptr - 1) >> 6) + 1) << 6;
tx_buf = catc->tx_buf[catc->tx_idx] + catc->tx_ptr;
- *((u16*)tx_buf) = cpu_to_le16((u16)skb->len);
+ *((u16*)tx_buf) = (catc->is_f5u011) ? cpu_to_be16((u16)skb->len) : cpu_to_le16((u16)skb->len);
memcpy(tx_buf + 2, skb->data, skb->len);
catc->tx_ptr += skb->len + 2;
if (!test_and_set_bit(TX_RUNNING, &catc->flags))
catc_tx_run(catc);
- if (catc->tx_ptr >= ((TX_MAX_BURST - 1) * (PKT_SZ + 2)))
+ if ((catc->is_f5u011 && catc->tx_ptr)
+ || (catc->tx_ptr >= ((TX_MAX_BURST - 1) * (PKT_SZ + 2))))
netif_stop_queue(netdev);
spin_unlock_irqrestore(&catc->tx_lock, flags);
@@ -554,17 +620,32 @@ static void catc_set_multicast_list(struct net_device *netdev)
if (netdev->flags & IFF_PROMISC) {
memset(catc->multicast, 0xff, 64);
- rx |= RxPromisc;
+ rx |= (!catc->is_f5u011) ? RxPromisc : AltRxPromisc;
}
- if (netdev->flags & IFF_ALLMULTI)
+ if (netdev->flags & IFF_ALLMULTI) {
memset(catc->multicast, 0xff, 64);
-
- for (i = 0, mc = netdev->mc_list; mc && i < netdev->mc_count; i++, mc = mc->next)
- catc_multicast(mc->dmi_addr, catc->multicast);
-
- catc_set_reg_async(catc, RxUnit, rx);
- catc_write_mem_async(catc, 0xfa80, catc->multicast, 64);
+ } else {
+ for (i = 0, mc = netdev->mc_list; mc && i < netdev->mc_count; i++, mc = mc->next) {
+ u32 crc = ether_crc_le(6, mc->dmi_addr);
+ if (!catc->is_f5u011) {
+ catc->multicast[(crc >> 3) & 0x3f] |= 1 << (crc & 7);
+ } else {
+ catc->multicast[7-(crc >> 29)] |= 1 << ((crc >> 26) & 7);
+ }
+ }
+ }
+ if (!catc->is_f5u011) {
+ catc_set_reg_async(catc, RxUnit, rx);
+ catc_write_mem_async(catc, 0xfa80, catc->multicast, 64);
+ } else {
+ f5u011_mchash_async(catc, catc->multicast);
+ if (catc->rxmode[0] != rx) {
+ catc->rxmode[0] = rx;
+ dbg("Setting RX mode to %2.2X %2.2X", catc->rxmode[0], catc->rxmode[1]);
+ f5u011_rxmode_async(catc, catc->rxmode);
+ }
+ }
}
/*
@@ -591,6 +672,29 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
return -EFAULT;
return 0;
}
+
+ /* get settings */
+ case ETHTOOL_GSET:
+ if (catc->is_f5u011) {
+ struct ethtool_cmd ecmd = { ETHTOOL_GSET,
+ SUPPORTED_10baseT_Half | SUPPORTED_TP,
+ ADVERTISED_10baseT_Half | ADVERTISED_TP,
+ SPEED_10,
+ DUPLEX_HALF,
+ PORT_TP,
+ 0,
+ XCVR_INTERNAL,
+ AUTONEG_DISABLE,
+ 1,
+ 1
+ };
+ if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
+ return -EFAULT;
+ return 0;
+ } else {
+ return -EOPNOTSUPP;
+ }
+
/* get link status */
case ETHTOOL_GLINK: {
struct ethtool_value edata = {ETHTOOL_GLINK};
@@ -632,7 +736,8 @@ static int catc_open(struct net_device *netdev)
netif_start_queue(netdev);
- mod_timer(&catc->timer, jiffies + STATS_UPDATE);
+ if (!catc->is_f5u011)
+ mod_timer(&catc->timer, jiffies + STATS_UPDATE);
return 0;
}
@@ -643,7 +748,8 @@ static int catc_stop(struct net_device *netdev)
netif_stop_queue(netdev);
- del_timer_sync(&catc->timer);
+ if (!catc->is_f5u011)
+ del_timer_sync(&catc->timer);
usb_unlink_urb(catc->rx_urb);
usb_unlink_urb(catc->tx_urb);
@@ -662,7 +768,7 @@ static void *catc_probe(struct usb_device *usbdev, unsigned int ifnum, const str
struct net_device *netdev;
struct catc *catc;
u8 broadcast[6];
- int i;
+ int i, pktsz;
if (usb_set_interface(usbdev, ifnum, 1)) {
err("Can't set altsetting 1.");
@@ -670,9 +776,16 @@ static void *catc_probe(struct usb_device *usbdev, unsigned int ifnum, const str
}
catc = kmalloc(sizeof(struct catc), GFP_KERNEL);
+ if (!catc)
+ return NULL;
+
memset(catc, 0, sizeof(struct catc));
netdev = init_etherdev(0, 0);
+ if (!netdev) {
+ kfree(catc);
+ return NULL;
+ }
netdev->open = catc_open;
netdev->hard_start_xmit = catc_hard_start_xmit;
@@ -701,9 +814,26 @@ static void *catc_probe(struct usb_device *usbdev, unsigned int ifnum, const str
if ((!catc->ctrl_urb) || (!catc->tx_urb) ||
(!catc->rx_urb) || (!catc->irq_urb)) {
err("No free urbs available.");
+ if (catc->ctrl_urb) usb_free_urb(catc->ctrl_urb);
+ if (catc->tx_urb) usb_free_urb(catc->tx_urb);
+ if (catc->rx_urb) usb_free_urb(catc->rx_urb);
+ if (catc->irq_urb) usb_free_urb(catc->irq_urb);
+ kfree(netdev);
+ kfree(catc);
return NULL;
}
+ /* The F5U011 has the same vendor/product as the netmate but a device version of 0x130 */
+ if (usbdev->descriptor.idVendor == 0x0423 && usbdev->descriptor.idProduct == 0xa &&
+ catc->usbdev->descriptor.bcdDevice == 0x0130 ) {
+ dbg("Testing for f5u011");
+ catc->is_f5u011 = 1;
+ atomic_set(&catc->recq_sz, 0);
+ pktsz = RX_PKT_SZ;
+ } else {
+ pktsz = RX_MAX_BURST * (PKT_SZ + 2);
+ }
+
FILL_CONTROL_URB(catc->ctrl_urb, usbdev, usb_sndctrlpipe(usbdev, 0),
NULL, NULL, 0, catc_ctrl_done, catc);
@@ -711,20 +841,21 @@ static void *catc_probe(struct usb_device *usbdev, unsigned int ifnum, const str
NULL, 0, catc_tx_done, catc);
FILL_BULK_URB(catc->rx_urb, usbdev, usb_rcvbulkpipe(usbdev, 1),
- catc->rx_buf, RX_MAX_BURST * (PKT_SZ + 2), catc_rx_done, catc);
+ catc->rx_buf, pktsz, catc_rx_done, catc);
FILL_INT_URB(catc->irq_urb, usbdev, usb_rcvintpipe(usbdev, 2),
catc->irq_buf, 2, catc_irq_done, catc, 1);
- dbg("Checking memory size\n");
-
- i = 0x12345678;
- catc_write_mem(catc, 0x7a80, &i, 4);
- i = 0x87654321;
- catc_write_mem(catc, 0xfa80, &i, 4);
- catc_read_mem(catc, 0x7a80, &i, 4);
+ if (!catc->is_f5u011) {
+ dbg("Checking memory size\n");
- switch (i) {
+ i = 0x12345678;
+ catc_write_mem(catc, 0x7a80, &i, 4);
+ i = 0x87654321;
+ catc_write_mem(catc, 0xfa80, &i, 4);
+ catc_read_mem(catc, 0x7a80, &i, 4);
+
+ switch (i) {
case 0x12345678:
catc_set_reg(catc, TxBufCount, 8);
catc_set_reg(catc, RxBufCount, 32);
@@ -737,44 +868,52 @@ static void *catc_probe(struct usb_device *usbdev, unsigned int ifnum, const str
catc_set_reg(catc, RxBufCount, 16);
dbg("32k Memory\n");
break;
+ }
+
+ dbg("Getting MAC from SEEROM.");
+
+ catc_get_mac(catc, netdev->dev_addr);
+
+ dbg("Setting MAC into registers.");
+
+ for (i = 0; i < 6; i++)
+ catc_set_reg(catc, StationAddr0 - i, netdev->dev_addr[i]);
+
+ dbg("Filling the multicast list.");
+
+ memset(broadcast, 0xff, 6);
+ catc_multicast(broadcast, catc->multicast);
+ catc_multicast(netdev->dev_addr, catc->multicast);
+ catc_write_mem(catc, 0xfa80, catc->multicast, 64);
+
+ dbg("Clearing error counters.");
+
+ for (i = 0; i < 8; i++)
+ catc_set_reg(catc, EthStats + i, 0);
+ catc->last_stats = jiffies;
+
+ dbg("Enabling.");
+
+ catc_set_reg(catc, MaxBurst, RX_MAX_BURST);
+ catc_set_reg(catc, OpModes, OpTxMerge | OpRxMerge | OpLenInclude | Op3MemWaits);
+ catc_set_reg(catc, LEDCtrl, LEDLink);
+ catc_set_reg(catc, RxUnit, RxEnable | RxPolarity | RxMultiCast);
+ } else {
+ dbg("Performing reset\n");
+ catc_reset(catc);
+ catc_get_mac(catc, netdev->dev_addr);
+
+ dbg("Setting RX Mode");
+ catc->rxmode[0] = RxEnable | RxPolarity | RxMultiCast;
+ catc->rxmode[1] = 0;
+ f5u011_rxmode(catc, catc->rxmode);
}
-
- dbg("Getting MAC from SEEROM.");
-
- catc_get_mac(catc, netdev->dev_addr);
-
- dbg("Setting MAC into registers.");
-
- for (i = 0; i < 6; i++)
- catc_set_reg(catc, StationAddr0 - i, netdev->dev_addr[i]);
-
- dbg("Filling the multicast list.");
-
- memset(broadcast, 0xff, 8);
- catc_multicast(broadcast, catc->multicast);
- catc_multicast(netdev->dev_addr, catc->multicast);
- catc_write_mem(catc, 0xfa80, catc->multicast, 64);
-
- dbg("Clearing error counters.");
-
- for (i = 0; i < 8; i++)
- catc_set_reg(catc, EthStats + i, 0);
- catc->last_stats = jiffies;
-
- dbg("Enabling.");
-
- catc_set_reg(catc, MaxBurst, RX_MAX_BURST);
- catc_set_reg(catc, OpModes, OpTxMerge | OpRxMerge | OpLenInclude | Op3MemWaits);
- catc_set_reg(catc, LEDCtrl, LEDLink);
- catc_set_reg(catc, RxUnit, RxEnable | RxPolarity | RxMultiCast);
-
dbg("Init done.");
-
- printk(KERN_INFO "%s: CATC EL1210A NetMate USB Ethernet at usb%d:%d.%d, ",
- netdev->name, usbdev->bus->busnum, usbdev->devnum, ifnum);
+ printk(KERN_INFO "%s: %s USB Ethernet at usb%d:%d.%d, ",
+ netdev->name, (catc->is_f5u011) ? "Belkin F5U011" : "CATC EL1210A NetMate",
+ usbdev->bus->busnum, usbdev->devnum, ifnum);
for (i = 0; i < 5; i++) printk("%2.2x:", netdev->dev_addr[i]);
printk("%2.2x.\n", netdev->dev_addr[i]);
-
return catc;
}
@@ -795,7 +934,7 @@ static void catc_disconnect(struct usb_device *usbdev, void *dev_ptr)
*/
static struct usb_device_id catc_id_table [] = {
- { USB_DEVICE(0x0423, 0xa) }, /* CATC Netmate */
+ { USB_DEVICE(0x0423, 0xa) }, /* CATC Netmate, Belkin F5U011 */
{ USB_DEVICE(0x0423, 0xc) }, /* CATC Netmate II, Belkin F5U111 */
{ USB_DEVICE(0x08d1, 0x1) }, /* smartBridges smartNIC */
{ }
diff --git a/drivers/usb/hid-core.c b/drivers/usb/hid-core.c
index 5b3f0c64273e..0bb17425bc39 100644
--- a/drivers/usb/hid-core.c
+++ b/drivers/usb/hid-core.c
@@ -110,10 +110,11 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned
memset(field, 0, sizeof(struct hid_field) + usages * sizeof(struct hid_usage)
+ values * sizeof(unsigned));
- report->field[report->maxfield++] = field;
+ report->field[report->maxfield] = field;
field->usage = (struct hid_usage *)(field + 1);
field->value = (unsigned *)(field->usage + usages);
field->report = report;
+ field->index = report->maxfield++;
return field;
}
@@ -741,8 +742,20 @@ static void hid_process_event(struct hid_device *hid, struct hid_field *field, s
if (hid->claimed & HID_CLAIMED_INPUT)
hidinput_hid_event(hid, field, usage, value);
#ifdef CONFIG_USB_HIDDEV
- if (hid->claimed & HID_CLAIMED_HIDDEV)
- hiddev_hid_event(hid, usage->hid, value);
+ if (hid->claimed & HID_CLAIMED_HIDDEV) {
+ struct hiddev_usage_ref uref;
+ unsigned type = field->report_type;
+ uref.report_type =
+ (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
+ ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
+ ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));
+ uref.report_id = field->report->id;
+ uref.field_index = field->index;
+ uref.usage_index = (usage - field->usage);
+ uref.usage_code = usage->hid;
+ uref.value = value;
+ hiddev_hid_event(hid, &uref);
+ }
#endif
}
@@ -839,6 +852,21 @@ static int hid_input_report(int type, struct urb *urb)
return -1;
}
+#ifdef CONFIG_USB_HIDDEV
+ /* Notify listeners that a report has been received */
+ if (hid->claimed & HID_CLAIMED_HIDDEV) {
+ struct hiddev_usage_ref uref;
+ memset(&uref, 0, sizeof(uref));
+ uref.report_type =
+ (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
+ ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
+ ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));
+ uref.report_id = report->id;
+ uref.field_index = HID_FIELD_INDEX_NONE;
+ hiddev_hid_event(hid, &uref);
+ }
+#endif
+
size = ((report->size - 1) >> 3) + 1;
if (len < size) {
@@ -1096,6 +1124,9 @@ void hid_submit_report(struct hid_device *hid, struct hid_report *report, unsign
int head;
unsigned long flags;
+ if ((hid->quirks & HID_QUIRK_NOGET) && dir == USB_DIR_IN)
+ return;
+
if (hid->urbout && dir == USB_DIR_OUT && report->type == HID_OUTPUT_REPORT) {
spin_lock_irqsave(&hid->outlock, flags);
@@ -1238,18 +1269,27 @@ void hid_init_reports(struct hid_device *hid)
#define USB_DEVICE_ID_POWERMATE 0x0410
#define USB_DEVICE_ID_SOUNDKNOB 0x04AA
+#define USB_VENDOR_ID_ATEN 0x0557
+#define USB_DEVICE_ID_ATEN_UC100KM 0x2004
+#define USB_DEVICE_ID_ATEN_CS124U 0x2202
+#define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204
+
struct hid_blacklist {
__u16 idVendor;
__u16 idProduct;
+ unsigned quirks;
} hid_blacklist[] = {
- { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE },
- { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS },
- { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 1},
- { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 2},
- { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 3},
- { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 4},
- { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE },
- { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB },
+ { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE, HID_QUIRK_IGNORE },
+ { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS, HID_QUIRK_IGNORE },
+ { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 1, HID_QUIRK_IGNORE },
+ { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 2, HID_QUIRK_IGNORE },
+ { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 3, HID_QUIRK_IGNORE },
+ { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 4, HID_QUIRK_IGNORE },
+ { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE },
+ { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE },
+ { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET },
+ { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET },
+ { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET },
{ 0, 0 }
};
@@ -1258,13 +1298,17 @@ static struct hid_device *usb_hid_configure(struct usb_device *dev, int ifnum)
struct usb_interface_descriptor *interface = dev->actconfig->interface[ifnum].altsetting + 0;
struct hid_descriptor *hdesc;
struct hid_device *hid;
- unsigned rsize = 0;
+ unsigned quirks = 0, rsize = 0;
char *buf;
int n;
for (n = 0; hid_blacklist[n].idVendor; n++)
if ((hid_blacklist[n].idVendor == dev->descriptor.idVendor) &&
- (hid_blacklist[n].idProduct == dev->descriptor.idProduct)) return NULL;
+ (hid_blacklist[n].idProduct == dev->descriptor.idProduct))
+ quirks = hid_blacklist[n].quirks;
+
+ if (quirks & HID_QUIRK_IGNORE)
+ return NULL;
if (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) && ((!interface->bNumEndpoints) ||
usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) {
@@ -1302,6 +1346,8 @@ static struct hid_device *usb_hid_configure(struct usb_device *dev, int ifnum)
}
}
+ hid->quirks = quirks;
+
for (n = 0; n < interface->bNumEndpoints; n++) {
struct usb_endpoint_descriptor *endpoint = &interface->endpoint[n];
diff --git a/drivers/usb/hid.h b/drivers/usb/hid.h
index 77a656f2bcc9..ed72dc6acfd1 100644
--- a/drivers/usb/hid.h
+++ b/drivers/usb/hid.h
@@ -203,6 +203,8 @@ struct hid_item {
#define HID_QUIRK_INVERT 0x01
#define HID_QUIRK_NOTOUCH 0x02
+#define HID_QUIRK_IGNORE 0x04
+#define HID_QUIRK_NOGET 0x08
/*
* This is the global enviroment of the parser. This information is
@@ -276,6 +278,7 @@ struct hid_field {
__s32 unit_exponent;
unsigned unit;
struct hid_report *report; /* associated report */
+ unsigned index; /* index into report->field[] */
};
#define HID_MAX_FIELDS 64
diff --git a/drivers/usb/hiddev.c b/drivers/usb/hiddev.c
index 886a30825a92..5d4029259899 100644
--- a/drivers/usb/hiddev.c
+++ b/drivers/usb/hiddev.c
@@ -50,9 +50,10 @@ struct hiddev {
};
struct hiddev_list {
- struct hiddev_event buffer[HIDDEV_BUFFER_SIZE];
+ struct hiddev_usage_ref buffer[HIDDEV_BUFFER_SIZE];
int head;
int tail;
+ unsigned flags;
struct fasync_struct *fasync;
struct hiddev *hiddev;
struct hiddev_list *next;
@@ -146,17 +147,19 @@ hiddev_lookup_usage(struct hid_device *hid, struct hiddev_usage_ref *uref)
* This is where hid.c calls into hiddev to pass an event that occurred over
* the interrupt pipe
*/
-void hiddev_hid_event(struct hid_device *hid, unsigned int usage, int value)
+void hiddev_hid_event(struct hid_device *hid, struct hiddev_usage_ref *uref)
{
struct hiddev *hiddev = hid->hiddev;
struct hiddev_list *list = hiddev->list;
while (list) {
- list->buffer[list->head].hid = usage;
- list->buffer[list->head].value = value;
- list->head = (list->head + 1) & (HIDDEV_BUFFER_SIZE - 1);
-
- kill_fasync(&list->fasync, SIGIO, POLL_IN);
+ if (uref->field_index != HID_FIELD_INDEX_NONE ||
+ (list->flags & HIDDEV_FLAG_REPORT) != 0) {
+ list->buffer[list->head] = *uref;
+ list->head = (list->head + 1) &
+ (HIDDEV_BUFFER_SIZE - 1);
+ kill_fasync(&list->fasync, SIGIO, POLL_IN);
+ }
list = list->next;
}
@@ -257,43 +260,67 @@ static ssize_t hiddev_read(struct file * file, char * buffer, size_t count,
{
DECLARE_WAITQUEUE(wait, current);
struct hiddev_list *list = file->private_data;
+ int event_size;
int retval = 0;
- if (list->head == list->tail) {
-
- add_wait_queue(&list->hiddev->wait, &wait);
- set_current_state(TASK_INTERRUPTIBLE);
+ event_size = ((list->flags & HIDDEV_FLAG_UREF) != 0) ?
+ sizeof(struct hiddev_usage_ref) : sizeof(struct hiddev_event);
- while (list->head == list->tail) {
+ if (count < event_size) return 0;
- if (file->f_flags & O_NONBLOCK) {
- retval = -EAGAIN;
- break;
- }
- if (signal_pending(current)) {
- retval = -ERESTARTSYS;
- break;
- }
- if (!list->hiddev->exist) {
- retval = -EIO;
- break;
+ while (retval == 0) {
+ if (list->head == list->tail) {
+ add_wait_queue(&list->hiddev->wait, &wait);
+ set_current_state(TASK_INTERRUPTIBLE);
+
+ while (list->head == list->tail) {
+ if (file->f_flags & O_NONBLOCK) {
+ retval = -EAGAIN;
+ break;
+ }
+ if (signal_pending(current)) {
+ retval = -ERESTARTSYS;
+ break;
+ }
+ if (!list->hiddev->exist) {
+ retval = -EIO;
+ break;
+ }
+
+ schedule();
}
- schedule();
+ set_current_state(TASK_RUNNING);
+ remove_wait_queue(&list->hiddev->wait, &wait);
}
- set_current_state(TASK_RUNNING);
- remove_wait_queue(&list->hiddev->wait, &wait);
- }
-
- if (retval)
- return retval;
+ if (retval)
+ return retval;
+
+
+ while (list->head != list->tail &&
+ retval + event_size <= count) {
+ if ((list->flags & HIDDEV_FLAG_UREF) == 0) {
+ if (list->buffer[list->tail].field_index !=
+ HID_FIELD_INDEX_NONE) {
+ struct hiddev_event event;
+ event.hid = list->buffer[list->tail].usage_code;
+ event.value = list->buffer[list->tail].value;
+ if (copy_to_user(buffer + retval, &event, sizeof(struct hiddev_event)))
+ return -EFAULT;
+ retval += sizeof(struct hiddev_event);
+ }
+ } else {
+ if (list->buffer[list->tail].field_index != HID_FIELD_INDEX_NONE ||
+ (list->flags & HIDDEV_FLAG_REPORT) != 0) {
+ if (copy_to_user(buffer + retval, list->buffer + list->tail, sizeof(struct hiddev_usage_ref)))
+ return -EFAULT;
+ retval += sizeof(struct hiddev_usage_ref);
+ }
+ }
+ list->tail = (list->tail + 1) & (HIDDEV_BUFFER_SIZE - 1);
+ }
- while (list->head != list->tail && retval + sizeof(struct hiddev_event) <= count) {
- if (copy_to_user(buffer + retval, list->buffer + list->tail,
- sizeof(struct hiddev_event))) return -EFAULT;
- list->tail = (list->tail + 1) & (HIDDEV_BUFFER_SIZE - 1);
- retval += sizeof(struct hiddev_event);
}
return retval;
@@ -358,6 +385,25 @@ static int hiddev_ioctl(struct inode *inode, struct file *file,
return copy_to_user((void *) arg, &dinfo, sizeof(dinfo));
}
+ case HIDIOCGFLAG:
+ return put_user(list->flags, (int *) arg);
+
+ case HIDIOCSFLAG:
+ {
+ int newflags;
+ if (get_user(newflags, (int *) arg))
+ return -EFAULT;
+
+ if ((newflags & ~HIDDEV_FLAGS) != 0 ||
+ ((newflags & HIDDEV_FLAG_REPORT) != 0 &&
+ (newflags & HIDDEV_FLAG_UREF) == 0))
+ return -EINVAL;
+
+ list->flags = newflags;
+
+ return 0;
+ }
+
case HIDIOCGSTRING:
{
int idx, len;
diff --git a/drivers/usb/printer.c b/drivers/usb/printer.c
index 6025a0176103..00ea80dfca00 100644
--- a/drivers/usb/printer.c
+++ b/drivers/usb/printer.c
@@ -1,10 +1,12 @@
/*
- * printer.c Version 0.8
+ * printer.c Version 0.12
*
* Copyright (c) 1999 Michael Gee <michael@linuxspecific.com>
* Copyright (c) 1999 Pavel Machek <pavel@suse.cz>
* Copyright (c) 2000 Randy Dunlap <randy.dunlap@intel.com>
* Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz>
+ # Copyright (c) 2001 Pete Zaitcev <zaitcev@redhat.com>
+ # Copyright (c) 2001 David Paschal <paschal@rcsis.com>
*
* USB Printer Device Class driver for USB printers and printer cables
*
@@ -17,10 +19,12 @@
* v0.4 - fixes in unidirectional mode
* v0.5 - add DEVICE_ID string support
* v0.6 - never time out
- * v0.7 - fixed bulk-IN read and poll (David Paschal, paschal@rcsis.com)
+ * v0.7 - fixed bulk-IN read and poll (David Paschal)
* v0.8 - add devfs support
* v0.9 - fix unplug-while-open paths
* v0.10- remove sleep_on, fix error on oom (oliver@neukum.org)
+ * v0.11 - add proto_bias option (Pete Zaitcev)
+ * v0.12 - add hpoj.sourceforge.net ioctls (David Paschal)
*/
/*
@@ -55,16 +59,36 @@
/*
* Version Information
*/
-#define DRIVER_VERSION "v0.10"
-#define DRIVER_AUTHOR "Michael Gee, Pavel Machek, Vojtech Pavlik, Randy Dunlap"
+#define DRIVER_VERSION "v0.12"
+#define DRIVER_AUTHOR "Michael Gee, Pavel Machek, Vojtech Pavlik, Randy Dunlap, Pete Zaitcev, David Paschal"
#define DRIVER_DESC "USB Printer Device Class driver"
#define USBLP_BUF_SIZE 8192
#define DEVICE_ID_SIZE 1024
-#define IOCNR_GET_DEVICE_ID 1
-#define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len) /* get device_id string */
+/* ioctls: */
#define LPGETSTATUS 0x060b /* same as in drivers/char/lp.c */
+#define IOCNR_GET_DEVICE_ID 1
+#define IOCNR_GET_PROTOCOLS 2
+#define IOCNR_SET_PROTOCOL 3
+#define IOCNR_HP_SET_CHANNEL 4
+#define IOCNR_GET_BUS_ADDRESS 5
+#define IOCNR_GET_VID_PID 6
+/* Get device_id string: */
+#define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
+/* The following ioctls were added for http://hpoj.sourceforge.net: */
+/* Get two-int array:
+ * [0]=current protocol (1=7/1/1, 2=7/1/2, 3=7/1/3),
+ * [1]=supported protocol mask (mask&(1<<n)!=0 means 7/1/n supported): */
+#define LPIOC_GET_PROTOCOLS(len) _IOC(_IOC_READ, 'P', IOCNR_GET_PROTOCOLS, len)
+/* Set protocol (arg: 1=7/1/1, 2=7/1/2, 3=7/1/3): */
+#define LPIOC_SET_PROTOCOL _IOC(_IOC_WRITE, 'P', IOCNR_SET_PROTOCOL, 0)
+/* Set channel number (HP Vendor-specific command): */
+#define LPIOC_HP_SET_CHANNEL _IOC(_IOC_WRITE, 'P', IOCNR_HP_SET_CHANNEL, 0)
+/* Get two-int array: [0]=bus number, [1]=device address: */
+#define LPIOC_GET_BUS_ADDRESS(len) _IOC(_IOC_READ, 'P', IOCNR_GET_BUS_ADDRESS, len)
+/* Get two-int array: [0]=vendor ID, [1]=product ID: */
+#define LPIOC_GET_VID_PID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_VID_PID, len)
/*
* A DEVICE_ID string may include the printer's serial number.
@@ -78,26 +102,40 @@ MFG:HEWLETT-PACKARD;MDL:DESKJET 970C;CMD:MLC,PCL,PML;CLASS:PRINTER;DESCRIPTION:H
* USB Printer Requests
*/
-#define USBLP_REQ_GET_ID 0x00
-#define USBLP_REQ_GET_STATUS 0x01
-#define USBLP_REQ_RESET 0x02
+#define USBLP_REQ_GET_ID 0x00
+#define USBLP_REQ_GET_STATUS 0x01
+#define USBLP_REQ_RESET 0x02
+#define USBLP_REQ_HP_CHANNEL_CHANGE_REQUEST 0x00 /* HP Vendor-specific */
#define USBLP_MINORS 16
#define USBLP_MINOR_BASE 0
#define USBLP_WRITE_TIMEOUT (5*HZ) /* 5 seconds */
+#define USBLP_FIRST_PROTOCOL 1
+#define USBLP_LAST_PROTOCOL 3
+#define USBLP_MAX_PROTOCOLS (USBLP_LAST_PROTOCOL+1)
+
struct usblp {
struct usb_device *dev; /* USB device */
devfs_handle_t devfs; /* devfs device */
struct semaphore sem; /* locks this struct, especially "dev" */
+ char *buf; /* writeurb->transfer_buffer */
struct urb *readurb, *writeurb; /* The urbs */
wait_queue_head_t wait; /* Zzzzz ... */
int readcount; /* Counter for reads */
int ifnum; /* Interface number */
+ /* Alternate-setting numbers and endpoints for each protocol
+ * (7/1/{index=1,2,3}) that the device supports: */
+ struct {
+ int alt_setting;
+ struct usb_endpoint_descriptor *epwrite;
+ struct usb_endpoint_descriptor *epread;
+ } protocol[USBLP_MAX_PROTOCOLS];
+ int current_protocol;
int minor; /* minor number of device */
int wcomplete; /* writing is completed */
- int rcomplete; /* reading is completed */
+ int rcomplete; /* reading is completed */
unsigned int quirks; /* quirks flags */
unsigned char used; /* True if open */
unsigned char bidir; /* interface is bidirectional */
@@ -105,6 +143,35 @@ struct usblp {
/* first 2 bytes are (big-endian) length */
};
+#ifdef DEBUG
+static void usblp_dump(struct usblp *usblp) {
+ int p;
+
+ dbg("usblp=0x%p", usblp);
+ dbg("dev=0x%p", usblp->dev);
+ dbg("devfs=0x%p", usblp->devfs);
+ dbg("buf=0x%p", usblp->buf);
+ dbg("readcount=%d", usblp->readcount);
+ dbg("ifnum=%d", usblp->ifnum);
+ for (p = USBLP_FIRST_PROTOCOL; p <= USBLP_LAST_PROTOCOL; p++) {
+ dbg("protocol[%d].alt_setting=%d", p, usblp->protocol[p].alt_setting);
+ dbg("protocol[%d].epwrite=%p", p, usblp->protocol[p].epwrite);
+ dbg("protocol[%d].epread=%p", p, usblp->protocol[p].epread);
+ }
+ dbg("current_protocol=%d", usblp->current_protocol);
+ dbg("minor=%d", usblp->minor);
+ dbg("wcomplete=%d", usblp->wcomplete);
+ dbg("rcomplete=%d", usblp->rcomplete);
+ dbg("quirks=%d", usblp->quirks);
+ dbg("used=%d", usblp->used);
+ dbg("bidir=%d", usblp->bidir);
+ dbg("device_id_string=\"%s\"",
+ usblp->device_id_string ?
+ usblp->device_id_string + 2 :
+ (unsigned char *)"(null)");
+}
+#endif
+
extern devfs_handle_t usb_devfs_handle; /* /dev/usb dir. */
static struct usblp *usblp_table[USBLP_MINORS];
@@ -126,29 +193,45 @@ static struct quirk_printer_struct quirk_printers[] = {
{ 0x03f0, 0x0204, USBLP_QUIRK_BIDIR }, /* HP DeskJet 815C */
{ 0x03f0, 0x0304, USBLP_QUIRK_BIDIR }, /* HP DeskJet 810C/812C */
{ 0x03f0, 0x0404, USBLP_QUIRK_BIDIR }, /* HP DeskJet 830C */
+ { 0x0409, 0xefbe, USBLP_QUIRK_BIDIR }, /* NEC Picty900 (HP OEM) */
{ 0, 0 }
};
+static int usblp_select_alts(struct usblp *usblp);
+static int usblp_set_protocol(struct usblp *usblp, int protocol);
+static int usblp_cache_device_id_string(struct usblp *usblp);
+
+
/*
* Functions for usblp control messages.
*/
-static int usblp_ctrl_msg(struct usblp *usblp, int request, int dir, int recip, int value, void *buf, int len)
+static int usblp_ctrl_msg(struct usblp *usblp, int request, int type, int dir, int recip, int value, void *buf, int len)
{
int retval = usb_control_msg(usblp->dev,
dir ? usb_rcvctrlpipe(usblp->dev, 0) : usb_sndctrlpipe(usblp->dev, 0),
- request, USB_TYPE_CLASS | dir | recip, value, usblp->ifnum, buf, len, HZ * 5);
+ request, type | dir | recip, value, usblp->ifnum, buf, len, USBLP_WRITE_TIMEOUT);
dbg("usblp_control_msg: rq: 0x%02x dir: %d recip: %d value: %d len: %#x result: %d",
request, !!dir, recip, value, len, retval);
return retval < 0 ? retval : 0;
}
#define usblp_read_status(usblp, status)\
- usblp_ctrl_msg(usblp, USBLP_REQ_GET_STATUS, USB_DIR_IN, USB_RECIP_INTERFACE, 0, status, 1)
+ usblp_ctrl_msg(usblp, USBLP_REQ_GET_STATUS, USB_TYPE_CLASS, USB_DIR_IN, USB_RECIP_INTERFACE, 0, status, 1)
#define usblp_get_id(usblp, config, id, maxlen)\
- usblp_ctrl_msg(usblp, USBLP_REQ_GET_ID, USB_DIR_IN, USB_RECIP_INTERFACE, config, id, maxlen)
+ usblp_ctrl_msg(usblp, USBLP_REQ_GET_ID, USB_TYPE_CLASS, USB_DIR_IN, USB_RECIP_INTERFACE, config, id, maxlen)
#define usblp_reset(usblp)\
- usblp_ctrl_msg(usblp, USBLP_REQ_RESET, USB_DIR_OUT, USB_RECIP_OTHER, 0, NULL, 0)
+ usblp_ctrl_msg(usblp, USBLP_REQ_RESET, USB_TYPE_CLASS, USB_DIR_OUT, USB_RECIP_OTHER, 0, NULL, 0)
+
+#define usblp_hp_channel_change_request(usblp, channel, buffer) \
+ usblp_ctrl_msg(usblp, USBLP_REQ_HP_CHANNEL_CHANGE_REQUEST, USB_TYPE_VENDOR, USB_DIR_IN, USB_RECIP_INTERFACE, channel, buffer, 1)
+
+/*
+ * See the description for usblp_select_alts() below for the usage
+ * explanation. Look into your /proc/bus/usb/devices and dmesg in
+ * case of any trouble.
+ */
+static int proto_bias = -1;
/*
* URB callback.
@@ -276,7 +359,7 @@ static void usblp_cleanup (struct usblp *usblp)
{
devfs_unregister (usblp->devfs);
usblp_table [usblp->minor] = NULL;
- info ("usblp%d: removed", usblp->minor);
+ info("usblp%d: removed", usblp->minor);
kfree (usblp->writeurb->transfer_buffer);
kfree (usblp->device_id_string);
@@ -285,6 +368,13 @@ static void usblp_cleanup (struct usblp *usblp)
kfree (usblp);
}
+static void usblp_unlink_urbs(struct usblp *usblp)
+{
+ usb_unlink_urb(usblp->writeurb);
+ if (usblp->bidir)
+ usb_unlink_urb(usblp->readurb);
+}
+
static int usblp_release(struct inode *inode, struct file *file)
{
struct usblp *usblp = file->private_data;
@@ -293,9 +383,7 @@ static int usblp_release(struct inode *inode, struct file *file)
lock_kernel();
usblp->used = 0;
if (usblp->dev) {
- if (usblp->bidir)
- usb_unlink_urb(usblp->readurb);
- usb_unlink_urb(usblp->writeurb);
+ usblp_unlink_urbs(usblp);
up(&usblp->sem);
} else /* finish cleanup from disconnect */
usblp_cleanup (usblp);
@@ -315,8 +403,9 @@ static unsigned int usblp_poll(struct file *file, struct poll_table_struct *wait
static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
struct usblp *usblp = file->private_data;
- int length, err;
- unsigned char status;
+ int length, err, i;
+ unsigned char status, newChannel;
+ int twoints[2];
int retval = 0;
down (&usblp->sem);
@@ -335,32 +424,128 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
goto done;
}
- err = usblp_get_id(usblp, 0, usblp->device_id_string, DEVICE_ID_SIZE - 1);
+ length = usblp_cache_device_id_string(usblp);
+ if (length < 0) {
+ retval = length;
+ goto done;
+ }
+ if (length > _IOC_SIZE(cmd))
+ length = _IOC_SIZE(cmd); /* truncate */
+
+ if (copy_to_user((unsigned char *) arg,
+ usblp->device_id_string,
+ (unsigned long) length)) {
+ retval = -EFAULT;
+ goto done;
+ }
+
+ break;
+
+ case IOCNR_GET_PROTOCOLS:
+ if (_IOC_DIR(cmd) != _IOC_READ ||
+ _IOC_SIZE(cmd) < sizeof(twoints)) {
+ retval = -EINVAL;
+ goto done;
+ }
+
+ twoints[0] = usblp->current_protocol;
+ twoints[1] = 0;
+ for (i = USBLP_FIRST_PROTOCOL;
+ i <= USBLP_LAST_PROTOCOL; i++) {
+ if (usblp->protocol[i].alt_setting >= 0)
+ twoints[1] |= (1<<i);
+ }
+
+ if (copy_to_user((unsigned char *)arg,
+ (unsigned char *)twoints,
+ sizeof(twoints))) {
+ retval = -EFAULT;
+ goto done;
+ }
+
+ break;
+
+ case IOCNR_SET_PROTOCOL:
+ if (_IOC_DIR(cmd) != _IOC_WRITE) {
+ retval = -EINVAL;
+ goto done;
+ }
+
+#ifdef DEBUG
+ if (arg == -10) {
+ usblp_dump(usblp);
+ break;
+ }
+#endif
+
+ usblp_unlink_urbs(usblp);
+ retval = usblp_set_protocol(usblp, arg);
+ if (retval < 0) {
+ usblp_set_protocol(usblp,
+ usblp->current_protocol);
+ }
+ break;
+
+ case IOCNR_HP_SET_CHANNEL:
+ if (_IOC_DIR(cmd) != _IOC_WRITE ||
+ usblp->dev->descriptor.idVendor != 0x03F0 ||
+ usblp->quirks & USBLP_QUIRK_BIDIR) {
+ retval = -EINVAL;
+ goto done;
+ }
+
+ err = usblp_hp_channel_change_request(usblp,
+ arg, &newChannel);
if (err < 0) {
- dbg ("usblp%d: error = %d reading IEEE-1284 Device ID string",
+ err("usblp%d: error = %d setting "
+ "HP channel",
usblp->minor, err);
- usblp->device_id_string[0] = usblp->device_id_string[1] = '\0';
retval = -EIO;
goto done;
}
- length = (usblp->device_id_string[0] << 8) + usblp->device_id_string[1]; /* big-endian */
- if (length < DEVICE_ID_SIZE)
- usblp->device_id_string[length] = '\0';
- else
- usblp->device_id_string[DEVICE_ID_SIZE - 1] = '\0';
+ dbg("usblp%d requested/got HP channel %ld/%d",
+ usblp->minor, arg, newChannel);
+ break;
- dbg ("usblp%d Device ID string [%d/max %d]='%s'",
- usblp->minor, length, _IOC_SIZE(cmd), &usblp->device_id_string[2]);
+ case IOCNR_GET_BUS_ADDRESS:
+ if (_IOC_DIR(cmd) != _IOC_READ ||
+ _IOC_SIZE(cmd) < sizeof(twoints)) {
+ retval = -EINVAL;
+ goto done;
+ }
- if (length > _IOC_SIZE(cmd)) length = _IOC_SIZE(cmd); /* truncate */
+ twoints[0] = usblp->dev->bus->busnum;
+ twoints[1] = usblp->dev->devnum;
+ if (copy_to_user((unsigned char *)arg,
+ (unsigned char *)twoints,
+ sizeof(twoints))) {
+ retval = -EFAULT;
+ goto done;
+ }
- if (copy_to_user((unsigned char *) arg,
- usblp->device_id_string, (unsigned long) length)) {
+ dbg("usblp%d is bus=%d, device=%d",
+ usblp->minor, twoints[0], twoints[1]);
+ break;
+
+ case IOCNR_GET_VID_PID:
+ if (_IOC_DIR(cmd) != _IOC_READ ||
+ _IOC_SIZE(cmd) < sizeof(twoints)) {
+ retval = -EINVAL;
+ goto done;
+ }
+
+ twoints[0] = usblp->dev->descriptor.idVendor;
+ twoints[1] = usblp->dev->descriptor.idProduct;
+ if (copy_to_user((unsigned char *)arg,
+ (unsigned char *)twoints,
+ sizeof(twoints))) {
retval = -EFAULT;
goto done;
}
+ dbg("usblp%d is VID=0x%4.4X, PID=0x%4.4X",
+ usblp->minor, twoints[0], twoints[1]);
break;
default:
@@ -593,155 +778,268 @@ static struct file_operations usblp_fops = {
static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
{
- struct usb_interface_descriptor *interface;
- struct usb_endpoint_descriptor *epread, *epwrite;
- struct usblp *usblp;
- int minor, i, bidir = 0, quirks;
- int alts = dev->actconfig->interface[ifnum].act_altsetting;
- int length, err;
- char *buf;
+ struct usblp *usblp = 0;
+ int protocol;
char name[6];
- /* If a bidirectional interface exists, use it. */
- for (i = 0; i < dev->actconfig->interface[ifnum].num_altsetting; i++) {
-
- interface = &dev->actconfig->interface[ifnum].altsetting[i];
-
- if (interface->bInterfaceClass != 7 || interface->bInterfaceSubClass != 1 ||
- interface->bInterfaceProtocol < 1 || interface->bInterfaceProtocol > 3 ||
- (interface->bInterfaceProtocol > 1 && interface->bNumEndpoints < 2))
- continue;
-
- if (interface->bInterfaceProtocol > 1) {
- bidir = 1;
- alts = i;
- break;
- }
- }
-
- interface = &dev->actconfig->interface[ifnum].altsetting[alts];
- if (usb_set_interface(dev, ifnum, alts))
- err("can't set desired altsetting %d on interface %d", alts, ifnum);
-
- epwrite = interface->endpoint + 0;
- epread = bidir ? interface->endpoint + 1 : NULL;
-
- if ((epwrite->bEndpointAddress & 0x80) == 0x80) {
- if (interface->bNumEndpoints == 1)
- return NULL;
- epwrite = interface->endpoint + 1;
- epread = bidir ? interface->endpoint + 0 : NULL;
- }
-
- if ((epwrite->bEndpointAddress & 0x80) == 0x80)
- return NULL;
-
- if (bidir && (epread->bEndpointAddress & 0x80) != 0x80)
- return NULL;
-
- for (minor = 0; minor < USBLP_MINORS && usblp_table[minor]; minor++);
- if (usblp_table[minor]) {
- err("no more free usblp devices");
- return NULL;
- }
-
+ /* Malloc and start initializing usblp structure so we can use it
+ * directly. */
if (!(usblp = kmalloc(sizeof(struct usblp), GFP_KERNEL))) {
- err("out of memory");
- return NULL;
+ err("out of memory for usblp");
+ goto abort;
}
memset(usblp, 0, sizeof(struct usblp));
- init_MUTEX (&usblp->sem);
-
- /* lookup quirks for this printer */
- quirks = usblp_quirks(dev->descriptor.idVendor, dev->descriptor.idProduct);
-
- if (bidir && (quirks & USBLP_QUIRK_BIDIR)) {
- bidir = 0;
- epread = NULL;
- info ("Disabling reads from problem bidirectional printer on usblp%d",
- minor);
- }
-
usblp->dev = dev;
+ init_MUTEX (&usblp->sem);
+ init_waitqueue_head(&usblp->wait);
usblp->ifnum = ifnum;
- usblp->minor = minor;
- usblp->bidir = bidir;
- usblp->quirks = quirks;
- init_waitqueue_head(&usblp->wait);
+ /* Look for a free usblp_table entry. */
+ while (usblp_table[usblp->minor]) {
+ usblp->minor++;
+ if (usblp->minor >= USBLP_MINORS) {
+ err("no more free usblp devices");
+ goto abort;
+ }
+ }
usblp->writeurb = usb_alloc_urb(0, GFP_KERNEL);
if (!usblp->writeurb) {
err("out of memory");
- kfree(usblp);
- return NULL;
+ goto abort;
}
usblp->readurb = usb_alloc_urb(0, GFP_KERNEL);
if (!usblp->readurb) {
err("out of memory");
- usb_free_urb(usblp->writeurb);
- kfree(usblp);
- return NULL;
+ goto abort;
}
- if (!(buf = kmalloc(USBLP_BUF_SIZE * (bidir ? 2 : 1), GFP_KERNEL))) {
- err("out of memory");
- usb_free_urb(usblp->writeurb);
- usb_free_urb(usblp->readurb);
- kfree(usblp);
- return NULL;
+ /* Malloc device ID string buffer to the largest expected length,
+ * since we can re-query it on an ioctl and a dynamic string
+ * could change in length. */
+ if (!(usblp->device_id_string = kmalloc(DEVICE_ID_SIZE, GFP_KERNEL))) {
+ err("out of memory for device_id_string");
+ goto abort;
}
- if (!(usblp->device_id_string = kmalloc(DEVICE_ID_SIZE, GFP_KERNEL))) {
- err("out of memory");
- usb_free_urb(usblp->writeurb);
- usb_free_urb(usblp->readurb);
- kfree(usblp);
- kfree(buf);
- return NULL;
+ /* Malloc write/read buffers in one chunk. We somewhat wastefully
+ * malloc both regardless of bidirectionality, because the
+ * alternate setting can be changed later via an ioctl. */
+ if (!(usblp->buf = kmalloc(2 * USBLP_BUF_SIZE, GFP_KERNEL))) {
+ err("out of memory for buf");
+ goto abort;
}
- FILL_BULK_URB(usblp->writeurb, dev, usb_sndbulkpipe(dev, epwrite->bEndpointAddress),
- buf, 0, usblp_bulk_write, usblp);
+ /* Lookup quirks for this printer. */
+ usblp->quirks = usblp_quirks(
+ dev->descriptor.idVendor,
+ dev->descriptor.idProduct);
+
+ /* Analyze and pick initial alternate settings and endpoints. */
+ protocol = usblp_select_alts(usblp);
+ if (protocol < 0) {
+ dbg("incompatible printer-class device 0x%4.4X/0x%4.4X",
+ dev->descriptor.idVendor,
+ dev->descriptor.idProduct);
+ goto abort;
+ }
- if (bidir)
- FILL_BULK_URB(usblp->readurb, dev, usb_rcvbulkpipe(dev, epread->bEndpointAddress),
- buf + USBLP_BUF_SIZE, USBLP_BUF_SIZE, usblp_bulk_read, usblp);
+ /* Setup the selected alternate setting and endpoints. */
+ if (usblp_set_protocol(usblp, protocol) < 0)
+ goto abort;
- /* Get the device_id string if possible. FIXME: Could make this kmalloc(length). */
- err = usblp_get_id(usblp, 0, usblp->device_id_string, DEVICE_ID_SIZE - 1);
- if (err >= 0) {
- length = (usblp->device_id_string[0] << 8) + usblp->device_id_string[1]; /* big-endian */
- if (length < DEVICE_ID_SIZE)
- usblp->device_id_string[length] = '\0';
- else
- usblp->device_id_string[DEVICE_ID_SIZE - 1] = '\0';
- dbg ("usblp%d Device ID string [%d]=%s",
- minor, length, &usblp->device_id_string[2]);
- }
- else {
- err ("usblp%d: error = %d reading IEEE-1284 Device ID string",
- minor, err);
- usblp->device_id_string[0] = usblp->device_id_string[1] = '\0';
- }
+ /* Retrieve and store the device ID string. */
+ usblp_cache_device_id_string(usblp);
#ifdef DEBUG
usblp_check_status(usblp, 0);
#endif
- sprintf(name, "lp%d", minor);
-
- /* if we have devfs, create with perms=660 */
+ /* If we have devfs, create with perms=660. */
+ sprintf(name, "lp%d", usblp->minor);
usblp->devfs = devfs_register(usb_devfs_handle, name,
DEVFS_FL_DEFAULT, USB_MAJOR,
- USBLP_MINOR_BASE + minor,
+ USBLP_MINOR_BASE + usblp->minor,
S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP |
S_IWGRP, &usblp_fops, NULL);
- info("usblp%d: USB %sdirectional printer dev %d if %d alt %d",
- minor, bidir ? "Bi" : "Uni", dev->devnum, ifnum, alts);
+ info("usblp%d: USB %sdirectional printer dev %d "
+ "if %d alt %d proto %d vid 0x%4.4X pid 0x%4.4X",
+ usblp->minor, usblp->bidir ? "Bi" : "Uni", dev->devnum, ifnum,
+ usblp->protocol[usblp->current_protocol].alt_setting,
+ usblp->current_protocol, usblp->dev->descriptor.idVendor,
+ usblp->dev->descriptor.idProduct);
- return usblp_table[minor] = usblp;
+ return usblp_table[usblp->minor] = usblp;
+
+abort:
+ if (usblp) {
+ usb_free_urb(usblp->writeurb);
+ usb_free_urb(usblp->readurb);
+ if (usblp->buf) kfree(usblp->buf);
+ if (usblp->device_id_string) kfree(usblp->device_id_string);
+ kfree(usblp);
+ }
+ return NULL;
+}
+
+/*
+ * We are a "new" style driver with usb_device_id table,
+ * but our requirements are too intricate for simple match to handle.
+ *
+ * The "proto_bias" option may be used to specify the preferred protocol
+ * for all USB printers (1=7/1/1, 2=7/1/2, 3=7/1/3). If the device
+ * supports the preferred protocol, then we bind to it.
+ *
+ * The best interface for us is 7/1/2, because it is compatible
+ * with a stream of characters. If we find it, we bind to it.
+ *
+ * Note that the people from hpoj.sourceforge.net need to be able to
+ * bind to 7/1/3 (MLC/1284.4), so we provide them ioctls for this purpose.
+ *
+ * Failing 7/1/2, we look for 7/1/3, even though it's probably not
+ * stream-compatible, because this matches the behaviour of the old code.
+ *
+ * If nothing else, we bind to 7/1/1 - the unidirectional interface.
+ */
+static int usblp_select_alts(struct usblp *usblp)
+{
+ struct usb_interface *if_alt;
+ struct usb_interface_descriptor *ifd;
+ struct usb_endpoint_descriptor *epd, *epwrite, *epread;
+ int p, i, e;
+
+ if_alt = &usblp->dev->actconfig->interface[usblp->ifnum];
+
+ for (p = 0; p < USBLP_MAX_PROTOCOLS; p++)
+ usblp->protocol[p].alt_setting = -1;
+
+ /* Find out what we have. */
+ for (i = 0; i < if_alt->num_altsetting; i++) {
+ ifd = &if_alt->altsetting[i];
+
+ if (ifd->bInterfaceClass != 7 || ifd->bInterfaceSubClass != 1)
+ continue;
+
+ if (ifd->bInterfaceProtocol < USBLP_FIRST_PROTOCOL ||
+ ifd->bInterfaceProtocol > USBLP_LAST_PROTOCOL)
+ continue;
+
+ /* Look for bulk OUT and IN endpoints. */
+ epwrite = epread = 0;
+ for (e = 0; e < ifd->bNumEndpoints; e++) {
+ epd = &ifd->endpoint[e];
+
+ if ((epd->bmAttributes&USB_ENDPOINT_XFERTYPE_MASK)!=
+ USB_ENDPOINT_XFER_BULK)
+ continue;
+
+ if (!(epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK)) {
+ if (!epwrite) epwrite=epd;
+
+ } else {
+ if (!epread) epread=epd;
+ }
+ }
+
+ /* Ignore buggy hardware without the right endpoints. */
+ if (!epwrite || (ifd->bInterfaceProtocol > 1 && !epread))
+ continue;
+
+ /* Turn off reads for 7/1/1 (unidirectional) interfaces
+ * and buggy bidirectional printers. */
+ if (ifd->bInterfaceProtocol == 1) {
+ epread = NULL;
+ } else if (usblp->quirks & USBLP_QUIRK_BIDIR) {
+ info("Disabling reads from problem bidirectional "
+ "printer on usblp%d", usblp->minor);
+ epread = NULL;
+ }
+
+ usblp->protocol[ifd->bInterfaceProtocol].alt_setting = i;
+ usblp->protocol[ifd->bInterfaceProtocol].epwrite = epwrite;
+ usblp->protocol[ifd->bInterfaceProtocol].epread = epread;
+ }
+
+ /* If our requested protocol is supported, then use it. */
+ if (proto_bias >= USBLP_FIRST_PROTOCOL &&
+ proto_bias <= USBLP_LAST_PROTOCOL &&
+ usblp->protocol[proto_bias].alt_setting != -1)
+ return proto_bias;
+
+ /* Ordering is important here. */
+ if (usblp->protocol[2].alt_setting != -1) return 2;
+ if (usblp->protocol[1].alt_setting != -1) return 1;
+ if (usblp->protocol[3].alt_setting != -1) return 3;
+
+ /* If nothing is available, then don't bind to this device. */
+ return -1;
+}
+
+static int usblp_set_protocol(struct usblp *usblp, int protocol)
+{
+ int r, alts;
+
+ if (protocol < USBLP_FIRST_PROTOCOL || protocol > USBLP_LAST_PROTOCOL)
+ return -EINVAL;
+
+ alts = usblp->protocol[protocol].alt_setting;
+ if (alts < 0) return -EINVAL;
+ r = usb_set_interface(usblp->dev, usblp->ifnum, alts);
+ if (r < 0) {
+ err("can't set desired altsetting %d on interface %d",
+ alts, usblp->ifnum);
+ return r;
+ }
+
+ FILL_BULK_URB(usblp->writeurb, usblp->dev,
+ usb_sndbulkpipe(usblp->dev,
+ usblp->protocol[protocol].epwrite->bEndpointAddress),
+ usblp->buf, 0,
+ usblp_bulk_write, usblp);
+
+ usblp->bidir = (usblp->protocol[protocol].epread != 0);
+ if (usblp->bidir)
+ FILL_BULK_URB(usblp->readurb, usblp->dev,
+ usb_rcvbulkpipe(usblp->dev,
+ usblp->protocol[protocol].epread->bEndpointAddress),
+ usblp->buf + USBLP_BUF_SIZE, USBLP_BUF_SIZE,
+ usblp_bulk_read, usblp);
+
+ usblp->current_protocol = protocol;
+ dbg("usblp%d set protocol %d", usblp->minor, protocol);
+ return 0;
+}
+
+/* Retrieves and caches device ID string.
+ * Returns length, including length bytes but not null terminator.
+ * On error, returns a negative errno value. */
+static int usblp_cache_device_id_string(struct usblp *usblp)
+{
+ int err, length;
+
+ err = usblp_get_id(usblp, 0, usblp->device_id_string, DEVICE_ID_SIZE - 1);
+ if (err < 0) {
+ dbg("usblp%d: error = %d reading IEEE-1284 Device ID string",
+ usblp->minor, err);
+ usblp->device_id_string[0] = usblp->device_id_string[1] = '\0';
+ return -EIO;
+ }
+
+ /* First two bytes are length in big-endian.
+ * They count themselves, and we copy them into
+ * the user's buffer. */
+ length = (usblp->device_id_string[0] << 8) + usblp->device_id_string[1];
+ if (length < 2)
+ length = 2;
+ else if (length >= DEVICE_ID_SIZE)
+ length = DEVICE_ID_SIZE - 1;
+ usblp->device_id_string[length] = '\0';
+
+ dbg("usblp%d Device ID string [len=%d]=\"%s\"",
+ usblp->minor, length, &usblp->device_id_string[2]);
+
+ return length;
}
static void usblp_disconnect(struct usb_device *dev, void *ptr)
@@ -757,9 +1055,7 @@ static void usblp_disconnect(struct usb_device *dev, void *ptr)
lock_kernel();
usblp->dev = NULL;
- usb_unlink_urb(usblp->writeurb);
- if (usblp->bidir)
- usb_unlink_urb(usblp->readurb);
+ usblp_unlink_urbs(usblp);
if (!usblp->used)
usblp_cleanup (usblp);
@@ -794,7 +1090,7 @@ static int __init usblp_init(void)
{
if (usb_register(&usblp_driver))
return -1;
- info(DRIVER_VERSION ":" DRIVER_DESC);
+ info(DRIVER_VERSION ": " DRIVER_DESC);
return 0;
}
@@ -808,5 +1104,6 @@ module_exit(usblp_exit);
MODULE_AUTHOR( DRIVER_AUTHOR );
MODULE_DESCRIPTION( DRIVER_DESC );
+MODULE_PARM(proto_bias, "i");
+MODULE_PARM_DESC(proto_bias, "Favourite protocol number");
MODULE_LICENSE("GPL");
-
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
index f185987c6541..812726b110fa 100644
--- a/drivers/usb/serial/cyberjack.c
+++ b/drivers/usb/serial/cyberjack.c
@@ -262,7 +262,7 @@ static int cyberjack_write (struct usb_serial_port *port, int from_user, const u
port);
/* send the data out the bulk port */
- result = usb_submit_urb(port->write_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) {
err(__FUNCTION__ " - failed submitting write urb, error %d", result);
/* Throw away data. No better idea what to do with it. */
@@ -331,7 +331,7 @@ static void cyberjack_read_int_callback( struct urb *urb )
if( !old_rdtodo ) {
port->read_urb->dev = port->serial->dev;
- result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if( result )
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
dbg(__FUNCTION__ " - usb_submit_urb(read urb)");
@@ -387,7 +387,7 @@ static void cyberjack_read_bulk_callback (struct urb *urb)
/* Continue to read if we have still urbs to do. */
if( priv->rdtodo /* || (urb->actual_length==port->bulk_in_endpointAddress)*/ ) {
port->read_urb->dev = port->serial->dev;
- result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
dbg(__FUNCTION__ " - usb_submit_urb(read urb)");
@@ -440,7 +440,7 @@ static void cyberjack_write_bulk_callback (struct urb *urb)
port);
/* send the data out the bulk port */
- result = usb_submit_urb(port->write_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) {
err(__FUNCTION__ " - failed submitting write urb, error %d", result);
/* Throw away data. No better idea what to do with it. */
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index 621af4d63ebc..a03c9b4a9a1d 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -676,7 +676,7 @@ dbg( "digi_write_oob_command: TOP: port=%d, count=%d", oob_priv->dp_port_num, co
oob_port->write_urb->transfer_buffer_length = len;
oob_port->write_urb->dev = port->serial->dev;
- if( (ret=usb_submit_urb(oob_port->write_urb, GFP_KERNEL)) == 0 ) {
+ if( (ret=usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0 ) {
oob_priv->dp_write_urb_in_use = 1;
count -= len;
buf += len;
@@ -764,7 +764,7 @@ count );
}
port->write_urb->dev = port->serial->dev;
- if( (ret=usb_submit_urb(port->write_urb, GFP_KERNEL)) == 0 ) {
+ if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) {
priv->dp_write_urb_in_use = 1;
priv->dp_out_buf_len = 0;
count -= len;
@@ -841,7 +841,7 @@ port_priv->dp_port_num, modem_signals );
oob_port->write_urb->transfer_buffer_length = 8;
oob_port->write_urb->dev = port->serial->dev;
- if( (ret=usb_submit_urb(oob_port->write_urb, GFP_KERNEL)) == 0 ) {
+ if( (ret=usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0 ) {
oob_priv->dp_write_urb_in_use = 1;
port_priv->dp_modem_signals =
(port_priv->dp_modem_signals&~(TIOCM_DTR|TIOCM_RTS))
@@ -962,7 +962,7 @@ dbg( "digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num );
/* restart read chain */
if( priv->dp_throttle_restart ) {
port->read_urb->dev = port->serial->dev;
- ret = usb_submit_urb( port->read_urb, GFP_KERNEL );
+ ret = usb_submit_urb( port->read_urb, GFP_ATOMIC );
}
/* turn throttle off */
@@ -1323,7 +1323,7 @@ priv->dp_port_num, count, from_user, in_interrupt() );
/* copy in new data */
memcpy( data, from_user ? user_buf : buf, new_len );
- if( (ret=usb_submit_urb(port->write_urb, GFP_KERNEL)) == 0 ) {
+ if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) {
priv->dp_write_urb_in_use = 1;
ret = new_len;
priv->dp_out_buf_len = 0;
@@ -1399,7 +1399,7 @@ dbg( "digi_write_bulk_callback: TOP, urb->status=%d", urb->status );
memcpy( port->write_urb->transfer_buffer+2, priv->dp_out_buf,
priv->dp_out_buf_len );
- if( (ret=usb_submit_urb(port->write_urb, GFP_KERNEL)) == 0 ) {
+ if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) {
priv->dp_write_urb_in_use = 1;
priv->dp_out_buf_len = 0;
}
@@ -1837,7 +1837,7 @@ dbg( "digi_read_bulk_callback: TOP" );
/* continue read */
urb->dev = port->serial->dev;
- if( (ret=usb_submit_urb(urb, GFP_KERNEL)) != 0 ) {
+ if( (ret=usb_submit_urb(urb, GFP_ATOMIC)) != 0 ) {
err( __FUNCTION__ ": failed resubmitting urb, ret=%d, port=%d",
ret, priv->dp_port_num );
}
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
index 3a636d7a4740..fa390d5c32cc 100644
--- a/drivers/usb/serial/empeg.c
+++ b/drivers/usb/serial/empeg.c
@@ -256,7 +256,7 @@ static int empeg_write (struct usb_serial_port *port, int from_user, const unsig
}
if (urb->transfer_buffer == NULL) {
- urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
+ urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC);
if (urb->transfer_buffer == NULL) {
err(__FUNCTION__" no more kernel memory...");
goto exit;
@@ -288,7 +288,7 @@ static int empeg_write (struct usb_serial_port *port, int from_user, const unsig
urb->transfer_flags |= USB_QUEUE_BULK;
/* send it down the pipe */
- status = usb_submit_urb(urb, GFP_KERNEL);
+ status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) {
err(__FUNCTION__ " - usb_submit_urb(write bulk) failed with status = %d", status);
bytes_sent = status;
@@ -441,7 +441,7 @@ static void empeg_read_bulk_callback (struct urb *urb)
port->read_urb->transfer_flags |= USB_QUEUE_BULK;
- result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
@@ -466,7 +466,7 @@ static void empeg_unthrottle (struct usb_serial_port *port)
port->read_urb->dev = port->serial->dev;
- result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed submitting read urb, error %d", result);
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 911d3ac53f94..fc07f8f67835 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -469,7 +469,7 @@ static int ftdi_sio_write (struct usb_serial_port *port, int from_user,
port->write_urb->transfer_buffer, count,
ftdi_sio_write_bulk_callback, port);
- result = usb_submit_urb(port->write_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) {
err(__FUNCTION__ " - failed submitting write urb, error %d", result);
return 0;
@@ -631,7 +631,7 @@ static void ftdi_sio_read_bulk_callback (struct urb *urb)
port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
ftdi_sio_read_bulk_callback, port);
- result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 60194ede19d8..393fbafd21e2 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -790,7 +790,7 @@ static void edge_interrupt_callback (struct urb *urb)
/* we have pending bytes on the bulk in pipe, send a request */
edge_serial->read_urb->dev = edge_serial->serial->dev;
- result = usb_submit_urb(edge_serial->read_urb, GFP_KERNEL);
+ result = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC);
if (result) {
dbg(__FUNCTION__" - usb_submit_urb(read bulk) failed with result = %d", result);
}
@@ -867,7 +867,7 @@ static void edge_bulk_in_callback (struct urb *urb)
/* there is, so resubmit our urb */
edge_serial->read_urb->dev = edge_serial->serial->dev;
- status = usb_submit_urb(edge_serial->read_urb, GFP_KERNEL);
+ status = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC);
if (status) {
err(__FUNCTION__" - usb_submit_urb(read bulk) failed, status = %d", status);
}
@@ -1435,7 +1435,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge
/* build the data header for the buffer and port that we are about to send out */
count = fifo->count;
- buffer = kmalloc (count+2, GFP_KERNEL);
+ buffer = kmalloc (count+2, GFP_ATOMIC);
if (buffer == NULL) {
err(__FUNCTION__" - no more kernel memory...");
edge_port->write_in_progress = FALSE;
@@ -1474,7 +1474,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge
urb->transfer_flags |= USB_QUEUE_BULK;
urb->dev = edge_serial->serial->dev;
- status = usb_submit_urb(urb, GFP_KERNEL);
+ status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) {
/* something went wrong */
dbg(__FUNCTION__" - usb_submit_urb(write bulk) failed");
@@ -2431,7 +2431,7 @@ static int send_iosp_ext_cmd (struct edgeport_port *edge_port, __u8 command, __u
dbg(__FUNCTION__" - %d, %d", command, param);
- buffer = kmalloc (10, GFP_KERNEL);
+ buffer = kmalloc (10, GFP_ATOMIC);
if (!buffer) {
err(__FUNCTION__" - kmalloc(%d) failed.\n", 10);
return -ENOMEM;
@@ -2467,7 +2467,7 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer
usb_serial_debug_data (__FILE__, __FUNCTION__, length, buffer);
/* Allocate our next urb */
- urb = usb_alloc_urb (0, GFP_KERNEL);
+ urb = usb_alloc_urb (0, GFP_ATOMIC);
if (!urb)
return -ENOMEM;
@@ -2482,7 +2482,7 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer
urb->transfer_flags |= USB_QUEUE_BULK;
edge_port->commandPending = TRUE;
- status = usb_submit_urb(urb, GFP_KERNEL);
+ status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) {
/* something went wrong */
@@ -2532,7 +2532,7 @@ static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRa
}
// Alloc memory for the string of commands.
- cmdBuffer = kmalloc (0x100, GFP_KERNEL);
+ cmdBuffer = kmalloc (0x100, GFP_ATOMIC);
if (!cmdBuffer) {
err(__FUNCTION__" - kmalloc(%d) failed.\n", 0x100);
return -ENOMEM;
@@ -2618,7 +2618,7 @@ static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 r
dbg (__FUNCTION__" - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", regValue);
// Alloc memory for the string of commands.
- cmdBuffer = kmalloc (0x10, GFP_KERNEL);
+ cmdBuffer = kmalloc (0x10, GFP_ATOMIC);
if (cmdBuffer == NULL ) {
return -ENOMEM;
}
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index c839920d236a..c3e9c8791fa9 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -297,7 +297,7 @@ static void ipaq_read_bulk_callback(struct urb *urb)
usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
ipaq_read_bulk_callback, port);
- result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
return;
@@ -412,7 +412,7 @@ static int ipaq_write_flush(struct usb_serial_port *port)
usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress),
port->write_urb->transfer_buffer, count, ipaq_write_bulk_callback,
port);
- result = usb_submit_urb(urb, GFP_KERNEL);
+ result = usb_submit_urb(urb, GFP_ATOMIC);
if (result) {
err(__FUNCTION__ " - failed submitting write urb, error %d", result);
}
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index f44ae514529a..5a8f68918b67 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -405,7 +405,7 @@ static int ir_write (struct usb_serial_port *port, int from_user, const unsigned
= USB_QUEUE_BULK
| USB_ZERO_PACKET;
- result = usb_submit_urb (port->write_urb, GFP_KERNEL);
+ result = usb_submit_urb (port->write_urb, GFP_ATOMIC);
if (result)
err("%s - failed submitting write urb, error %d", __FUNCTION__, result);
else
@@ -515,7 +515,7 @@ static void ir_read_bulk_callback (struct urb *urb)
port->read_urb->transfer_flags = USB_QUEUE_BULK;
- result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
err("%s - failed resubmitting read urb, error %d",
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index d8d8a2e83bb2..2879204149e1 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -378,7 +378,7 @@ static int keyspan_write(struct usb_serial_port *port, int from_user,
this_urb->transfer_flags &= ~USB_ASYNC_UNLINK;
this_urb->dev = port->serial->dev;
- if ((err = usb_submit_urb(this_urb, GFP_KERNEL)) != 0) {
+ if ((err = usb_submit_urb(this_urb, GFP_ATOMIC)) != 0) {
dbg("usb_submit_urb(write bulk) failed (%d)\n", err);
}
p_priv->tx_start_time[flip] = jiffies;
@@ -436,7 +436,7 @@ static void usa26_indat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */
urb->dev = port->serial->dev;
- if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) {
+ if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err);
}
return;
@@ -535,7 +535,7 @@ static void usa26_instat_callback(struct urb *urb)
exit:
/* Resubmit urb so we continue receiving */
urb->dev = serial->dev;
- if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) {
+ if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err);
}
}
@@ -586,7 +586,7 @@ static void usa28_indat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */
urb->dev = port->serial->dev;
- if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) {
+ if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n",
err);
}
@@ -671,7 +671,7 @@ static void usa28_instat_callback(struct urb *urb)
exit:
/* Resubmit urb so we continue receiving */
urb->dev = serial->dev;
- if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) {
+ if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err);
}
}
@@ -764,7 +764,7 @@ exit:
/* Resubmit urb so we continue receiving */
urb->dev = serial->dev;
- if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) {
+ if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err);
}
}
@@ -819,7 +819,7 @@ static void usa49_indat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */
urb->dev = port->serial->dev;
- if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) {
+ if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err);
}
}
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index ae37c1ff9b86..54b09b26e43c 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -292,7 +292,7 @@ static void keyspan_pda_rx_unthrottle (struct usb_serial_port *port)
/* just restart the receive interrupt URB */
dbg("keyspan_pda_rx_unthrottle port %d", port->number);
port->interrupt_in_urb->dev = port->serial->dev;
- if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL))
+ if (usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC))
dbg(" usb_submit_urb(read urb) failed");
return;
}
@@ -584,7 +584,7 @@ static int keyspan_pda_write(struct usb_serial_port *port, int from_user,
priv->tx_room -= count;
port->write_urb->dev = port->serial->dev;
- rc = usb_submit_urb(port->write_urb, GFP_KERNEL);
+ rc = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (rc) {
dbg(" usb_submit_urb(write bulk) failed");
goto exit;
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index 3aa9c40e2c61..5b0e1b944dcb 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -519,7 +519,7 @@ static int klsi_105_write (struct usb_serial_port *port, int from_user,
}
if (urb->transfer_buffer == NULL) {
- urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
+ urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC);
if (urb->transfer_buffer == NULL) {
err(__FUNCTION__ " - no more kernel memory...");
goto exit;
@@ -555,7 +555,7 @@ static int klsi_105_write (struct usb_serial_port *port, int from_user,
/* send the data out the bulk port */
- result = usb_submit_urb(urb, GFP_KERNEL);
+ result = usb_submit_urb(urb, GFP_ATOMIC);
if (result) {
err(__FUNCTION__
" - failed submitting write urb, error %d", result);
@@ -721,7 +721,7 @@ static void klsi_105_read_bulk_callback (struct urb *urb)
port->read_urb->transfer_buffer_length,
klsi_105_read_bulk_callback,
port);
- rc = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ rc = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (rc)
err(__FUNCTION__
" - failed resubmitting read urb, error %d", rc);
@@ -1019,7 +1019,7 @@ static void klsi_105_unthrottle (struct usb_serial_port *port)
dbg(__FUNCTION__ " - port %d", port->number);
port->read_urb->dev = port->serial->dev;
- result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed submitting read urb, error %d",
result);
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 1151d0d2170a..125c4a647ab3 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -470,7 +470,7 @@ static int mct_u232_write (struct usb_serial_port *port, int from_user,
port);
/* send the data out the bulk port */
- result = usb_submit_urb(port->write_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) {
err(__FUNCTION__
" - failed submitting write urb, error %d", result);
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index 2eb34c553790..457984644e9b 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -265,7 +265,7 @@ static void omninet_read_bulk_callback (struct urb *urb)
usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
urb->transfer_buffer, urb->transfer_buffer_length,
omninet_read_bulk_callback, port);
- result = usb_submit_urb(urb, GFP_KERNEL);
+ result = usb_submit_urb(urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
@@ -316,7 +316,7 @@ static int omninet_write (struct usb_serial_port *port, int from_user, const uns
wport->write_urb->transfer_buffer_length = 64;
wport->write_urb->dev = serial->dev;
- result = usb_submit_urb(wport->write_urb, GFP_KERNEL);
+ result = usb_submit_urb(wport->write_urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed submitting write urb, error %d", result);
else
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 57dedd00441c..23adb9024f46 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -195,7 +195,7 @@ static int pl2303_write (struct usb_serial_port *port, int from_user, const uns
port->write_urb->transfer_buffer_length = count;
port->write_urb->dev = port->serial->dev;
- result = usb_submit_urb (port->write_urb, GFP_KERNEL);
+ result = usb_submit_urb (port->write_urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed submitting write urb, error %d", result);
else
@@ -643,7 +643,7 @@ static void pl2303_read_bulk_callback (struct urb *urb)
dbg (__FUNCTION__ " - caught -EPROTO, resubmitting the urb");
urb->status = 0;
urb->dev = serial->dev;
- result = usb_submit_urb(urb, GFP_KERNEL);
+ result = usb_submit_urb(urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
return;
@@ -668,7 +668,7 @@ static void pl2303_read_bulk_callback (struct urb *urb)
/* Schedule the next read _if_ we are still open */
if (port->open_count) {
urb->dev = serial->dev;
- result = usb_submit_urb(urb, GFP_KERNEL);
+ result = usb_submit_urb(urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
}
@@ -697,7 +697,7 @@ static void pl2303_write_bulk_callback (struct urb *urb)
dbg (__FUNCTION__ " - nonzero write bulk status received: %d", urb->status);
port->write_urb->transfer_buffer_length = 1;
port->write_urb->dev = port->serial->dev;
- result = usb_submit_urb (port->write_urb, GFP_KERNEL);
+ result = usb_submit_urb (port->write_urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed resubmitting write urb, error %d", result);
diff --git a/drivers/usb/serial/usbserial.c b/drivers/usb/serial/usbserial.c
index 4746b8107f45..6271ade640d6 100644
--- a/drivers/usb/serial/usbserial.c
+++ b/drivers/usb/serial/usbserial.c
@@ -899,7 +899,7 @@ static int generic_write (struct usb_serial_port *port, int from_user, const uns
generic_write_bulk_callback), port);
/* send the data out the bulk port */
- result = usb_submit_urb(port->write_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed submitting write urb, error %d", result);
else
@@ -989,7 +989,7 @@ static void generic_read_bulk_callback (struct urb *urb)
((serial->type->read_bulk_callback) ?
serial->type->read_bulk_callback :
generic_read_bulk_callback), port);
- result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
}
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 2ac4489b92d8..29415d2e2fb1 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -344,13 +344,13 @@ static int visor_write (struct usb_serial_port *port, int from_user, const unsig
dbg(__FUNCTION__ " - port %d", port->number);
- buffer = kmalloc (count, GFP_KERNEL);
+ buffer = kmalloc (count, GFP_ATOMIC);
if (!buffer) {
err ("out of memory");
return -ENOMEM;
}
- urb = usb_alloc_urb(0, GFP_KERNEL);
+ urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) {
err ("no more free urbs");
kfree (buffer);
@@ -377,7 +377,7 @@ static int visor_write (struct usb_serial_port *port, int from_user, const unsig
urb->transfer_flags |= USB_QUEUE_BULK;
/* send it down the pipe */
- status = usb_submit_urb(urb, GFP_KERNEL);
+ status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) {
err(__FUNCTION__ " - usb_submit_urb(write bulk) failed with status = %d", status);
count = status;
@@ -491,7 +491,7 @@ static void visor_read_bulk_callback (struct urb *urb)
port->read_urb->transfer_buffer,
port->read_urb->transfer_buffer_length,
visor_read_bulk_callback, port);
- result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
return;
@@ -512,7 +512,7 @@ static void visor_unthrottle (struct usb_serial_port *port)
dbg(__FUNCTION__ " - port %d", port->number);
port->read_urb->dev = port->serial->dev;
- result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
err(__FUNCTION__ " - failed submitting read urb, error %d", result);
}
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 4485b3d26936..3a1dcf663a3a 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -240,7 +240,7 @@ static void command_port_read_callback (struct urb *urb)
usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
command_port_read_callback, port);
- result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
dbg(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
}
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index d0532a67af60..bc229488cfbf 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -246,7 +246,7 @@ affs_empty_dir(struct inode *inode)
goto done;
retval = -ENOTEMPTY;
- for (size = AFFS_SB->s_hashsize - 1; size >= 0; size--)
+ for (size = AFFS_SB(sb)->s_hashsize - 1; size >= 0; size--)
if (AFFS_HEAD(bh)->table[size])
goto not_empty;
retval = 0;
@@ -458,7 +458,7 @@ affs_error(struct super_block *sb, const char *function, const char *fmt, ...)
if (!(sb->s_flags & MS_RDONLY))
printk(KERN_WARNING "AFFS: Remounting filesystem read-only\n");
sb->s_flags |= MS_RDONLY;
- AFFS_SB->s_flags |= SF_READONLY; /* Don't allow to remount rw */
+ AFFS_SB(sb)->s_flags |= SF_READONLY; /* Don't allow to remount rw */
}
void
diff --git a/fs/affs/bitmap.c b/fs/affs/bitmap.c
index 1726db8a09a8..c0e48f698ee7 100644
--- a/fs/affs/bitmap.c
+++ b/fs/affs/bitmap.c
@@ -53,14 +53,14 @@ affs_count_free_blocks(struct super_block *sb)
if (sb->s_flags & MS_RDONLY)
return 0;
- down(&AFFS_SB->s_bmlock);
+ down(&AFFS_SB(sb)->s_bmlock);
- bm = AFFS_SB->s_bitmap;
+ bm = AFFS_SB(sb)->s_bitmap;
free = 0;
- for (i = AFFS_SB->s_bmap_count; i > 0; bm++, i--)
+ for (i = AFFS_SB(sb)->s_bmap_count; i > 0; bm++, i--)
free += bm->bm_free;
- up(&AFFS_SB->s_bmlock);
+ up(&AFFS_SB(sb)->s_bmlock);
return free;
}
@@ -68,6 +68,7 @@ affs_count_free_blocks(struct super_block *sb)
void
affs_free_block(struct super_block *sb, u32 block)
{
+ struct affs_sb_info *sbi = AFFS_SB(sb);
struct affs_bm_info *bm;
struct buffer_head *bh;
u32 blk, bmap, bit, mask, tmp;
@@ -75,24 +76,24 @@ affs_free_block(struct super_block *sb, u32 block)
pr_debug("AFFS: free_block(%u)\n", block);
- if (block > AFFS_SB->s_partition_size)
+ if (block > sbi->s_partition_size)
goto err_range;
- blk = block - AFFS_SB->s_reserved;
- bmap = blk / AFFS_SB->s_bmap_bits;
- bit = blk % AFFS_SB->s_bmap_bits;
- bm = &AFFS_SB->s_bitmap[bmap];
+ blk = block - sbi->s_reserved;
+ bmap = blk / sbi->s_bmap_bits;
+ bit = blk % sbi->s_bmap_bits;
+ bm = &sbi->s_bitmap[bmap];
- down(&AFFS_SB->s_bmlock);
+ down(&sbi->s_bmlock);
- bh = AFFS_SB->s_bmap_bh;
- if (AFFS_SB->s_last_bmap != bmap) {
+ bh = sbi->s_bmap_bh;
+ if (sbi->s_last_bmap != bmap) {
affs_brelse(bh);
bh = affs_bread(sb, bm->bm_key);
if (!bh)
goto err_bh_read;
- AFFS_SB->s_bmap_bh = bh;
- AFFS_SB->s_last_bmap = bmap;
+ sbi->s_bmap_bh = bh;
+ sbi->s_last_bmap = bmap;
}
mask = 1 << (bit & 31);
@@ -112,19 +113,19 @@ affs_free_block(struct super_block *sb, u32 block)
sb->s_dirt = 1;
bm->bm_free++;
- up(&AFFS_SB->s_bmlock);
+ up(&sbi->s_bmlock);
return;
err_free:
affs_warning(sb,"affs_free_block","Trying to free block %u which is already free", block);
- up(&AFFS_SB->s_bmlock);
+ up(&sbi->s_bmlock);
return;
err_bh_read:
affs_error(sb,"affs_free_block","Cannot read bitmap block %u", bm->bm_key);
- AFFS_SB->s_bmap_bh = NULL;
- AFFS_SB->s_last_bmap = ~0;
- up(&AFFS_SB->s_bmlock);
+ sbi->s_bmap_bh = NULL;
+ sbi->s_last_bmap = ~0;
+ up(&sbi->s_bmlock);
return;
err_range:
@@ -145,6 +146,7 @@ u32
affs_alloc_block(struct inode *inode, u32 goal)
{
struct super_block *sb;
+ struct affs_sb_info *sbi;
struct affs_bm_info *bm;
struct buffer_head *bh;
u32 *data, *enddata;
@@ -152,6 +154,7 @@ affs_alloc_block(struct inode *inode, u32 goal)
int i;
sb = inode->i_sb;
+ sbi = AFFS_SB(sb);
pr_debug("AFFS: balloc(inode=%lu,goal=%u): ", inode->i_ino, goal);
@@ -161,53 +164,53 @@ affs_alloc_block(struct inode *inode, u32 goal)
return ++AFFS_I(inode)->i_lastalloc;
}
- if (!goal || goal > AFFS_SB->s_partition_size) {
+ if (!goal || goal > sbi->s_partition_size) {
if (goal)
affs_warning(sb, "affs_balloc", "invalid goal %d", goal);
//if (!AFFS_I(inode)->i_last_block)
// affs_warning(sb, "affs_balloc", "no last alloc block");
- goal = AFFS_SB->s_reserved;
+ goal = sbi->s_reserved;
}
- blk = goal - AFFS_SB->s_reserved;
- bmap = blk / AFFS_SB->s_bmap_bits;
- bm = &AFFS_SB->s_bitmap[bmap];
+ blk = goal - sbi->s_reserved;
+ bmap = blk / sbi->s_bmap_bits;
+ bm = &sbi->s_bitmap[bmap];
- down(&AFFS_SB->s_bmlock);
+ down(&sbi->s_bmlock);
if (bm->bm_free)
goto find_bmap_bit;
find_bmap:
/* search for the next bmap buffer with free bits */
- i = AFFS_SB->s_bmap_count;
+ i = sbi->s_bmap_count;
do {
bmap++;
bm++;
- if (bmap < AFFS_SB->s_bmap_count)
+ if (bmap < sbi->s_bmap_count)
continue;
/* restart search at zero */
bmap = 0;
- bm = AFFS_SB->s_bitmap;
+ bm = sbi->s_bitmap;
if (--i <= 0)
goto err_full;
} while (!bm->bm_free);
- blk = bmap * AFFS_SB->s_bmap_bits;
+ blk = bmap * sbi->s_bmap_bits;
find_bmap_bit:
- bh = AFFS_SB->s_bmap_bh;
- if (AFFS_SB->s_last_bmap != bmap) {
+ bh = sbi->s_bmap_bh;
+ if (sbi->s_last_bmap != bmap) {
affs_brelse(bh);
bh = affs_bread(sb, bm->bm_key);
if (!bh)
goto err_bh_read;
- AFFS_SB->s_bmap_bh = bh;
- AFFS_SB->s_last_bmap = bmap;
+ sbi->s_bmap_bh = bh;
+ sbi->s_last_bmap = bmap;
}
/* find an unused block in this bitmap block */
- bit = blk % AFFS_SB->s_bmap_bits;
+ bit = blk % sbi->s_bmap_bits;
data = (u32 *)bh->b_data + bit / 32 + 1;
enddata = (u32 *)((u8 *)bh->b_data + sb->s_blocksize);
mask = ~0UL << (bit & 31);
@@ -231,7 +234,7 @@ find_bmap_bit:
find_bit:
/* finally look for a free bit in the word */
bit = ffs(tmp) - 1;
- blk += bit + AFFS_SB->s_reserved;
+ blk += bit + sbi->s_reserved;
mask2 = mask = 1 << (bit & 31);
AFFS_I(inode)->i_lastalloc = blk;
@@ -253,18 +256,18 @@ find_bit:
mark_buffer_dirty(bh);
sb->s_dirt = 1;
- up(&AFFS_SB->s_bmlock);
+ up(&sbi->s_bmlock);
pr_debug("%d\n", blk);
return blk;
err_bh_read:
affs_error(sb,"affs_read_block","Cannot read bitmap block %u", bm->bm_key);
- AFFS_SB->s_bmap_bh = NULL;
- AFFS_SB->s_last_bmap = ~0;
+ sbi->s_bmap_bh = NULL;
+ sbi->s_last_bmap = ~0;
err_full:
pr_debug("failed\n");
- up(&AFFS_SB->s_bmlock);
+ up(&sbi->s_bmlock);
return 0;
}
@@ -276,35 +279,36 @@ affs_init_bitmap(struct super_block *sb)
u32 *bmap_blk;
u32 size, blk, end, offset, mask;
int i, res = 0;
+ struct affs_sb_info *sbi = AFFS_SB(sb);
if (sb->s_flags & MS_RDONLY)
return 0;
- if (!AFFS_ROOT_TAIL(sb, AFFS_SB->s_root_bh)->bm_flag) {
+ if (!AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag) {
printk(KERN_NOTICE "AFFS: Bitmap invalid - mounting %s read only\n",
sb->s_id);
sb->s_flags |= MS_RDONLY;
return 0;
}
- AFFS_SB->s_last_bmap = ~0;
- AFFS_SB->s_bmap_bh = NULL;
- AFFS_SB->s_bmap_bits = sb->s_blocksize * 8 - 32;
- AFFS_SB->s_bmap_count = (AFFS_SB->s_partition_size - AFFS_SB->s_reserved +
- AFFS_SB->s_bmap_bits - 1) / AFFS_SB->s_bmap_bits;
- size = AFFS_SB->s_bmap_count * sizeof(struct affs_bm_info);
- bm = AFFS_SB->s_bitmap = kmalloc(size, GFP_KERNEL);
- if (!AFFS_SB->s_bitmap) {
+ sbi->s_last_bmap = ~0;
+ sbi->s_bmap_bh = NULL;
+ sbi->s_bmap_bits = sb->s_blocksize * 8 - 32;
+ sbi->s_bmap_count = (sbi->s_partition_size - sbi->s_reserved +
+ sbi->s_bmap_bits - 1) / sbi->s_bmap_bits;
+ size = sbi->s_bmap_count * sizeof(struct affs_bm_info);
+ bm = sbi->s_bitmap = kmalloc(size, GFP_KERNEL);
+ if (!sbi->s_bitmap) {
printk(KERN_ERR "AFFS: Bitmap allocation failed\n");
return 1;
}
- memset(AFFS_SB->s_bitmap, 0, size);
+ memset(sbi->s_bitmap, 0, size);
- bmap_blk = (u32 *)AFFS_SB->s_root_bh->b_data;
+ bmap_blk = (u32 *)sbi->s_root_bh->b_data;
blk = sb->s_blocksize / 4 - 49;
end = blk + 25;
- for (i = AFFS_SB->s_bmap_count; i > 0; bm++, i--) {
+ for (i = sbi->s_bmap_count; i > 0; bm++, i--) {
affs_brelse(bh);
bm->bm_key = be32_to_cpu(bmap_blk[blk]);
@@ -341,7 +345,7 @@ affs_init_bitmap(struct super_block *sb)
end = sb->s_blocksize / 4 - 1;
}
- offset = (AFFS_SB->s_partition_size - AFFS_SB->s_reserved) % AFFS_SB->s_bmap_bits;
+ offset = (sbi->s_partition_size - sbi->s_reserved) % sbi->s_bmap_bits;
mask = ~(0xFFFFFFFFU << (offset & 31));
pr_debug("last word: %d %d %d\n", offset, offset / 32 + 1, mask);
offset = offset / 32 + 1;
diff --git a/fs/affs/dir.c b/fs/affs/dir.c
index 460f8926d102..aa69197ba0ab 100644
--- a/fs/affs/dir.c
+++ b/fs/affs/dir.c
@@ -122,7 +122,7 @@ affs_readdir(struct file *filp, void *dirent, filldir_t filldir)
goto inside;
hash_pos++;
- for (; hash_pos < AFFS_SB->s_hashsize; hash_pos++) {
+ for (; hash_pos < AFFS_SB(sb)->s_hashsize; hash_pos++) {
ino = be32_to_cpu(AFFS_HEAD(dir_bh)->table[hash_pos]);
if (!ino)
continue;
diff --git a/fs/affs/file.c b/fs/affs/file.c
index 4d7d470d209a..465d34cede28 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -350,8 +350,8 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul
//lock cache
affs_lock_ext(inode);
- ext = block / AFFS_SB->s_hashsize;
- block -= ext * AFFS_SB->s_hashsize;
+ ext = block / AFFS_SB(sb)->s_hashsize;
+ block -= ext * AFFS_SB(sb)->s_hashsize;
ext_bh = affs_get_extblock(inode, ext);
if (IS_ERR(ext_bh))
goto err_ext;
@@ -362,7 +362,7 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul
if (!blocknr)
goto err_alloc;
bh_result->b_state |= (1UL << BH_New);
- AFFS_I(inode)->mmu_private += AFFS_SB->s_data_blksize;
+ AFFS_I(inode)->mmu_private += AFFS_SB(sb)->s_data_blksize;
AFFS_I(inode)->i_blkcnt++;
/* store new block */
@@ -516,7 +516,7 @@ affs_do_readpage_ofs(struct file *file, struct page *page, unsigned from, unsign
pr_debug("AFFS: read_page(%u, %ld, %d, %d)\n", (u32)inode->i_ino, page->index, from, to);
data = page_address(page);
- bsize = AFFS_SB->s_data_blksize;
+ bsize = AFFS_SB(sb)->s_data_blksize;
tmp = (page->index << PAGE_CACHE_SHIFT) + from;
bidx = tmp / bsize;
boff = tmp % bsize;
@@ -546,7 +546,7 @@ affs_extent_file_ofs(struct file *file, u32 newsize)
u32 tmp;
pr_debug("AFFS: extent_file(%u, %d)\n", (u32)inode->i_ino, newsize);
- bsize = AFFS_SB->s_data_blksize;
+ bsize = AFFS_SB(sb)->s_data_blksize;
bh = NULL;
size = inode->i_size;
bidx = size / bsize;
@@ -670,7 +670,7 @@ static int affs_commit_write_ofs(struct file *file, struct page *page, unsigned
int written;
pr_debug("AFFS: commit_write(%u, %ld, %d, %d)\n", (u32)inode->i_ino, page->index, from, to);
- bsize = AFFS_SB->s_data_blksize;
+ bsize = AFFS_SB(sb)->s_data_blksize;
data = page_address(page);
bh = NULL;
@@ -811,8 +811,8 @@ affs_truncate(struct inode *inode)
last_blk = 0;
ext = 0;
if (inode->i_size) {
- last_blk = ((u32)inode->i_size - 1) / AFFS_SB->s_data_blksize;
- ext = last_blk / AFFS_SB->s_hashsize;
+ last_blk = ((u32)inode->i_size - 1) / AFFS_SB(sb)->s_data_blksize;
+ ext = last_blk / AFFS_SB(sb)->s_hashsize;
}
if (inode->i_size > AFFS_I(inode)->mmu_private) {
@@ -857,11 +857,11 @@ affs_truncate(struct inode *inode)
i = 0;
blk = last_blk;
if (inode->i_size) {
- i = last_blk % AFFS_SB->s_hashsize + 1;
+ i = last_blk % AFFS_SB(sb)->s_hashsize + 1;
blk++;
} else
AFFS_HEAD(ext_bh)->first_data = 0;
- size = AFFS_SB->s_hashsize;
+ size = AFFS_SB(sb)->s_hashsize;
if (size > blkcnt - blk + i)
size = blkcnt - blk + i;
for (; i < size; i++, blk++) {
@@ -885,7 +885,7 @@ affs_truncate(struct inode *inode)
while (ext_key) {
ext_bh = affs_bread(sb, ext_key);
- size = AFFS_SB->s_hashsize;
+ size = AFFS_SB(sb)->s_hashsize;
if (size > blkcnt - blk)
size = blkcnt - blk;
for (i = 0; i < size; i++, blk++)
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 33e2241a9944..2a75344cd54c 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -38,6 +38,7 @@ void
affs_read_inode(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
+ struct affs_sb_info *sbi = AFFS_SB(sb);
struct buffer_head *bh;
struct affs_head *head;
struct affs_tail *tail;
@@ -83,35 +84,35 @@ affs_read_inode(struct inode *inode)
AFFS_I(inode)->i_lastalloc = 0;
AFFS_I(inode)->i_pa_cnt = 0;
- if (AFFS_SB->s_flags & SF_SETMODE)
- inode->i_mode = AFFS_SB->s_mode;
+ if (sbi->s_flags & SF_SETMODE)
+ inode->i_mode = sbi->s_mode;
else
inode->i_mode = prot_to_mode(prot);
id = be16_to_cpu(tail->uid);
- if (id == 0 || AFFS_SB->s_flags & SF_SETUID)
- inode->i_uid = AFFS_SB->s_uid;
- else if (id == 0xFFFF && AFFS_SB->s_flags & SF_MUFS)
+ if (id == 0 || sbi->s_flags & SF_SETUID)
+ inode->i_uid = sbi->s_uid;
+ else if (id == 0xFFFF && sbi->s_flags & SF_MUFS)
inode->i_uid = 0;
else
inode->i_uid = id;
id = be16_to_cpu(tail->gid);
- if (id == 0 || AFFS_SB->s_flags & SF_SETGID)
- inode->i_gid = AFFS_SB->s_gid;
- else if (id == 0xFFFF && AFFS_SB->s_flags & SF_MUFS)
+ if (id == 0 || sbi->s_flags & SF_SETGID)
+ inode->i_gid = sbi->s_gid;
+ else if (id == 0xFFFF && sbi->s_flags & SF_MUFS)
inode->i_gid = 0;
else
inode->i_gid = id;
switch (be32_to_cpu(tail->stype)) {
case ST_ROOT:
- inode->i_uid = AFFS_SB->s_uid;
- inode->i_gid = AFFS_SB->s_gid;
+ inode->i_uid = sbi->s_uid;
+ inode->i_gid = sbi->s_gid;
/* fall through */
case ST_USERDIR:
if (be32_to_cpu(tail->stype) == ST_USERDIR ||
- AFFS_SB->s_flags & SF_SETMODE) {
+ sbi->s_flags & SF_SETMODE) {
if (inode->i_mode & S_IRUSR)
inode->i_mode |= S_IXUSR;
if (inode->i_mode & S_IRGRP)
@@ -147,13 +148,13 @@ affs_read_inode(struct inode *inode)
AFFS_I(inode)->mmu_private = inode->i_size = size;
if (inode->i_size) {
AFFS_I(inode)->i_blkcnt = (size - 1) /
- AFFS_SB->s_data_blksize + 1;
+ sbi->s_data_blksize + 1;
AFFS_I(inode)->i_extcnt = (AFFS_I(inode)->i_blkcnt - 1) /
- AFFS_SB->s_hashsize + 1;
+ sbi->s_hashsize + 1;
}
if (tail->link_chain)
inode->i_nlink = 2;
- inode->i_mapping->a_ops = (AFFS_SB->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops;
+ inode->i_mapping->a_ops = (sbi->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops;
inode->i_op = &affs_file_inode_operations;
inode->i_fop = &affs_file_operations;
break;
@@ -207,18 +208,18 @@ affs_write_inode(struct inode *inode, int unused)
tail->protect = cpu_to_be32(AFFS_I(inode)->i_protect);
tail->size = cpu_to_be32(inode->i_size);
secs_to_datestamp(inode->i_mtime,&tail->change);
- if (!(inode->i_ino == AFFS_SB->s_root_block)) {
+ if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) {
uid = inode->i_uid;
gid = inode->i_gid;
- if (sb->u.affs_sb.s_flags & SF_MUFS) {
+ if (AFFS_SB(sb)->s_flags & SF_MUFS) {
if (inode->i_uid == 0 || inode->i_uid == 0xFFFF)
uid = inode->i_uid ^ ~0;
if (inode->i_gid == 0 || inode->i_gid == 0xFFFF)
gid = inode->i_gid ^ ~0;
}
- if (!(sb->u.affs_sb.s_flags & SF_SETUID))
+ if (!(AFFS_SB(sb)->s_flags & SF_SETUID))
tail->uid = cpu_to_be16(uid);
- if (!(sb->u.affs_sb.s_flags & SF_SETGID))
+ if (!(AFFS_SB(sb)->s_flags & SF_SETGID))
tail->gid = cpu_to_be16(gid);
}
}
@@ -240,11 +241,11 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr)
if (error)
goto out;
- if (((attr->ia_valid & ATTR_UID) && (inode->i_sb->u.affs_sb.s_flags & SF_SETUID)) ||
- ((attr->ia_valid & ATTR_GID) && (inode->i_sb->u.affs_sb.s_flags & SF_SETGID)) ||
+ if (((attr->ia_valid & ATTR_UID) && (AFFS_SB(inode->i_sb)->s_flags & SF_SETUID)) ||
+ ((attr->ia_valid & ATTR_GID) && (AFFS_SB(inode->i_sb)->s_flags & SF_SETGID)) ||
((attr->ia_valid & ATTR_MODE) &&
- (inode->i_sb->u.affs_sb.s_flags & (SF_SETMODE | SF_IMMUTABLE)))) {
- if (!(inode->i_sb->u.affs_sb.s_flags & SF_QUIET))
+ (AFFS_SB(inode->i_sb)->s_flags & (SF_SETMODE | SF_IMMUTABLE)))) {
+ if (!(AFFS_SB(inode->i_sb)->s_flags & SF_QUIET))
error = -EPERM;
goto out;
}
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index 495a5481514a..80578e97be18 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -64,7 +64,7 @@ affs_intl_toupper(int ch)
static inline toupper_t
affs_get_toupper(struct super_block *sb)
{
- return AFFS_SB->s_flags & SF_INTL ? affs_intl_toupper : affs_toupper;
+ return AFFS_SB(sb)->s_flags & SF_INTL ? affs_intl_toupper : affs_toupper;
}
/*
@@ -177,7 +177,7 @@ affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len)
for (; len > 0; len--)
hash = (hash * 13 + toupper(*name++)) & 0x7ff;
- return hash % AFFS_SB->s_hashsize;
+ return hash % AFFS_SB(sb)->s_hashsize;
}
static struct buffer_head *
@@ -244,7 +244,7 @@ affs_lookup(struct inode *dir, struct dentry *dentry)
return ERR_PTR(-EACCES);
}
}
- dentry->d_op = AFFS_SB->s_flags & SF_INTL ? &affs_intl_dentry_operations : &affs_dentry_operations;
+ dentry->d_op = AFFS_SB(sb)->s_flags & SF_INTL ? &affs_intl_dentry_operations : &affs_dentry_operations;
unlock_kernel();
d_add(dentry, inode);
return NULL;
@@ -289,7 +289,7 @@ affs_create(struct inode *dir, struct dentry *dentry, int mode)
inode->i_op = &affs_file_inode_operations;
inode->i_fop = &affs_file_operations;
- inode->i_mapping->a_ops = (AFFS_SB->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops;
+ inode->i_mapping->a_ops = (AFFS_SB(sb)->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops;
error = affs_add_entry(dir, inode, dentry, ST_FILE);
if (error) {
inode->i_nlink = 0;
@@ -367,7 +367,7 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
(int)dentry->d_name.len,dentry->d_name.name,symname);
lock_kernel();
- maxlen = AFFS_SB->s_hashsize * sizeof(u32) - 1;
+ maxlen = AFFS_SB(sb)->s_hashsize * sizeof(u32) - 1;
error = -ENOSPC;
inode = affs_new_inode(dir);
if (!inode) {
@@ -390,8 +390,8 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
if (*symname == '/') {
while (*symname == '/')
symname++;
- while (AFFS_SB->s_volume[i]) /* Cannot overflow */
- *p++ = AFFS_SB->s_volume[i++];
+ while (AFFS_SB(sb)->s_volume[i]) /* Cannot overflow */
+ *p++ = AFFS_SB(sb)->s_volume[i++];
}
while (i < maxlen && (c = *symname++)) {
if (c == '.' && lc == '/' && *symname == '.' && symname[1] == '/') {
diff --git a/fs/affs/super.c b/fs/affs/super.c
index feb7cc918841..adfefd10ff90 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -38,21 +38,25 @@ static int affs_remount (struct super_block *sb, int *flags, char *data);
static void
affs_put_super(struct super_block *sb)
{
+ struct affs_sb_info *sbi = AFFS_SB(sb);
+
pr_debug("AFFS: put_super()\n");
if (!(sb->s_flags & MS_RDONLY)) {
- AFFS_ROOT_TAIL(sb, AFFS_SB->s_root_bh)->bm_flag = be32_to_cpu(1);
+ AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = be32_to_cpu(1);
secs_to_datestamp(CURRENT_TIME,
- &AFFS_ROOT_TAIL(sb, AFFS_SB->s_root_bh)->disk_change);
- affs_fix_checksum(sb, AFFS_SB->s_root_bh);
- mark_buffer_dirty(AFFS_SB->s_root_bh);
+ &AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->disk_change);
+ affs_fix_checksum(sb, sbi->s_root_bh);
+ mark_buffer_dirty(sbi->s_root_bh);
}
- affs_brelse(AFFS_SB->s_bmap_bh);
- if (AFFS_SB->s_prefix)
- kfree(AFFS_SB->s_prefix);
- kfree(AFFS_SB->s_bitmap);
- affs_brelse(AFFS_SB->s_root_bh);
+ affs_brelse(sbi->s_bmap_bh);
+ if (sbi->s_prefix)
+ kfree(sbi->s_prefix);
+ kfree(sbi->s_bitmap);
+ affs_brelse(sbi->s_root_bh);
+ kfree(sbi);
+ sb->u.generic_sbp = NULL;
return;
}
@@ -61,16 +65,17 @@ static void
affs_write_super(struct super_block *sb)
{
int clean = 2;
+ struct affs_sb_info *sbi = AFFS_SB(sb);
if (!(sb->s_flags & MS_RDONLY)) {
- // if (AFFS_SB->s_bitmap[i].bm_bh) {
- // if (buffer_dirty(AFFS_SB->s_bitmap[i].bm_bh)) {
+ // if (sbi->s_bitmap[i].bm_bh) {
+ // if (buffer_dirty(sbi->s_bitmap[i].bm_bh)) {
// clean = 0;
- AFFS_ROOT_TAIL(sb, AFFS_SB->s_root_bh)->bm_flag = be32_to_cpu(clean);
+ AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = be32_to_cpu(clean);
secs_to_datestamp(CURRENT_TIME,
- &AFFS_ROOT_TAIL(sb, AFFS_SB->s_root_bh)->disk_change);
- affs_fix_checksum(sb, AFFS_SB->s_root_bh);
- mark_buffer_dirty(AFFS_SB->s_root_bh);
+ &AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->disk_change);
+ affs_fix_checksum(sb, sbi->s_root_bh);
+ mark_buffer_dirty(sbi->s_root_bh);
sb->s_dirt = !clean; /* redo until bitmap synced */
} else
sb->s_dirt = 0;
@@ -267,6 +272,7 @@ out_inv_arg:
static int affs_fill_super(struct super_block *sb, void *data, int silent)
{
+ struct affs_sb_info *sbi;
struct buffer_head *root_bh = NULL;
struct buffer_head *boot_bh;
struct inode *root_inode = NULL;
@@ -285,22 +291,27 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_magic = AFFS_SUPER_MAGIC;
sb->s_op = &affs_sops;
- memset(AFFS_SB, 0, sizeof(struct affs_sb_info));
- init_MUTEX(&AFFS_SB->s_bmlock);
+
+ sbi = kmalloc(sizeof(struct affs_sb_info), GFP_KERNEL);
+ if (!sbi)
+ return -ENOMEM;
+ sb->u.generic_sbp = sbi;
+ memset(sbi, 0, sizeof(struct affs_sb_info));
+ init_MUTEX(&sbi->s_bmlock);
if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block,
- &blocksize,&AFFS_SB->s_prefix,
- AFFS_SB->s_volume, &mount_flags)) {
+ &blocksize,&sbi->s_prefix,
+ sbi->s_volume, &mount_flags)) {
printk(KERN_ERR "AFFS: Error parsing options\n");
return -EINVAL;
}
/* N.B. after this point s_prefix must be released */
- AFFS_SB->s_flags = mount_flags;
- AFFS_SB->s_mode = i;
- AFFS_SB->s_uid = uid;
- AFFS_SB->s_gid = gid;
- AFFS_SB->s_reserved= reserved;
+ sbi->s_flags = mount_flags;
+ sbi->s_mode = i;
+ sbi->s_uid = uid;
+ sbi->s_gid = gid;
+ sbi->s_reserved= reserved;
/* Get the size of the device in 512-byte blocks.
* If we later see that the partition uses bigger
@@ -320,12 +331,12 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
size = size / (blocksize / 512);
}
for (blocksize = i, key = 0; blocksize <= j; blocksize <<= 1, size >>= 1) {
- AFFS_SB->s_root_block = root_block;
+ sbi->s_root_block = root_block;
if (root_block < 0)
- AFFS_SB->s_root_block = (reserved + size - 1) / 2;
+ sbi->s_root_block = (reserved + size - 1) / 2;
pr_debug("AFFS: setting blocksize to %d\n", blocksize);
affs_set_blocksize(sb, blocksize);
- AFFS_SB->s_partition_size = size;
+ sbi->s_partition_size = size;
/* The root block location that was calculated above is not
* correct if the partition size is an odd number of 512-
@@ -341,16 +352,16 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
pr_debug("AFFS: Dev %s, trying root=%u, bs=%d, "
"size=%d, reserved=%d\n",
sb->s_id,
- AFFS_SB->s_root_block + num_bm,
+ sbi->s_root_block + num_bm,
blocksize, size, reserved);
- root_bh = affs_bread(sb, AFFS_SB->s_root_block + num_bm);
+ root_bh = affs_bread(sb, sbi->s_root_block + num_bm);
if (!root_bh)
continue;
if (!affs_checksum_block(sb, root_bh) &&
be32_to_cpu(AFFS_ROOT_HEAD(root_bh)->ptype) == T_SHORT &&
be32_to_cpu(AFFS_ROOT_TAIL(sb, root_bh)->stype) == ST_ROOT) {
- AFFS_SB->s_hashsize = blocksize / 4 - 56;
- AFFS_SB->s_root_block += num_bm;
+ sbi->s_hashsize = blocksize / 4 - 56;
+ sbi->s_root_block += num_bm;
key = 1;
goto got_root;
}
@@ -365,7 +376,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
/* N.B. after this point bh must be released */
got_root:
- root_block = AFFS_SB->s_root_block;
+ root_block = sbi->s_root_block;
/* Find out which kind of FS we have */
boot_bh = sb_bread(sb, 0);
@@ -385,36 +396,36 @@ got_root:
printk(KERN_NOTICE "AFFS: Dircache FS - mounting %s read only\n",
sb->s_id);
sb->s_flags |= MS_RDONLY;
- AFFS_SB->s_flags |= SF_READONLY;
+ sbi->s_flags |= SF_READONLY;
}
switch (chksum) {
case MUFS_FS:
case MUFS_INTLFFS:
case MUFS_DCFFS:
- AFFS_SB->s_flags |= SF_MUFS;
+ sbi->s_flags |= SF_MUFS;
/* fall thru */
case FS_INTLFFS:
case FS_DCFFS:
- AFFS_SB->s_flags |= SF_INTL;
+ sbi->s_flags |= SF_INTL;
break;
case MUFS_FFS:
- AFFS_SB->s_flags |= SF_MUFS;
+ sbi->s_flags |= SF_MUFS;
break;
case FS_FFS:
break;
case MUFS_OFS:
- AFFS_SB->s_flags |= SF_MUFS;
+ sbi->s_flags |= SF_MUFS;
/* fall thru */
case FS_OFS:
- AFFS_SB->s_flags |= SF_OFS;
+ sbi->s_flags |= SF_OFS;
sb->s_flags |= MS_NOEXEC;
break;
case MUFS_DCOFS:
case MUFS_INTLOFS:
- AFFS_SB->s_flags |= SF_MUFS;
+ sbi->s_flags |= SF_MUFS;
case FS_DCOFS:
case FS_INTLOFS:
- AFFS_SB->s_flags |= SF_INTL | SF_OFS;
+ sbi->s_flags |= SF_INTL | SF_OFS;
sb->s_flags |= MS_NOEXEC;
break;
default:
@@ -433,12 +444,12 @@ got_root:
sb->s_flags |= MS_NODEV | MS_NOSUID;
- AFFS_SB->s_data_blksize = sb->s_blocksize;
- if (AFFS_SB->s_flags & SF_OFS)
- AFFS_SB->s_data_blksize -= 24;
+ sbi->s_data_blksize = sb->s_blocksize;
+ if (sbi->s_flags & SF_OFS)
+ sbi->s_data_blksize -= 24;
/* Keep super block in cache */
- AFFS_SB->s_root_bh = root_bh;
+ sbi->s_root_bh = root_bh;
/* N.B. after this point s_root_bh must be released */
if (affs_init_bitmap(sb))
@@ -463,17 +474,20 @@ got_root:
out_error:
if (root_inode)
iput(root_inode);
- if (AFFS_SB->s_bitmap)
- kfree(AFFS_SB->s_bitmap);
+ if (sbi->s_bitmap)
+ kfree(sbi->s_bitmap);
affs_brelse(root_bh);
- if (AFFS_SB->s_prefix)
- kfree(AFFS_SB->s_prefix);
+ if (sbi->s_prefix)
+ kfree(sbi->s_prefix);
+ kfree(sbi);
+ sb->u.generic_sbp = NULL;
return -EINVAL;
}
static int
affs_remount(struct super_block *sb, int *flags, char *data)
{
+ struct affs_sb_info *sbi = AFFS_SB(sb);
int blocksize;
uid_t uid;
gid_t gid;
@@ -481,17 +495,17 @@ affs_remount(struct super_block *sb, int *flags, char *data)
int reserved;
int root_block;
unsigned long mount_flags;
- unsigned long read_only = AFFS_SB->s_flags & SF_READONLY;
+ unsigned long read_only = sbi->s_flags & SF_READONLY;
pr_debug("AFFS: remount(flags=0x%x,opts=\"%s\")\n",*flags,data);
if (!parse_options(data,&uid,&gid,&mode,&reserved,&root_block,
- &blocksize,&AFFS_SB->s_prefix,AFFS_SB->s_volume,&mount_flags))
+ &blocksize,&sbi->s_prefix,sbi->s_volume,&mount_flags))
return -EINVAL;
- AFFS_SB->s_flags = mount_flags | read_only;
- AFFS_SB->s_mode = mode;
- AFFS_SB->s_uid = uid;
- AFFS_SB->s_gid = gid;
+ sbi->s_flags = mount_flags | read_only;
+ sbi->s_mode = mode;
+ sbi->s_uid = uid;
+ sbi->s_gid = gid;
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
return 0;
@@ -500,7 +514,7 @@ affs_remount(struct super_block *sb, int *flags, char *data)
while (sb->s_dirt)
affs_write_super(sb);
sb->s_flags |= MS_RDONLY;
- } else if (!(AFFS_SB->s_flags & SF_READONLY)) {
+ } else if (!(sbi->s_flags & SF_READONLY)) {
sb->s_flags &= ~MS_RDONLY;
} else {
affs_warning(sb,"remount","Cannot remount fs read/write because of errors");
@@ -514,13 +528,13 @@ affs_statfs(struct super_block *sb, struct statfs *buf)
{
int free;
- pr_debug("AFFS: statfs() partsize=%d, reserved=%d\n",AFFS_SB->s_partition_size,
- AFFS_SB->s_reserved);
+ pr_debug("AFFS: statfs() partsize=%d, reserved=%d\n",AFFS_SB(sb)->s_partition_size,
+ AFFS_SB(sb)->s_reserved);
free = affs_count_free_blocks(sb);
buf->f_type = AFFS_SUPER_MAGIC;
buf->f_bsize = sb->s_blocksize;
- buf->f_blocks = AFFS_SB->s_partition_size - AFFS_SB->s_reserved;
+ buf->f_blocks = AFFS_SB(sb)->s_partition_size - AFFS_SB(sb)->s_reserved;
buf->f_bfree = free;
buf->f_bavail = free;
return 0;
diff --git a/fs/affs/symlink.c b/fs/affs/symlink.c
index f8eedba6fdd3..b4c2e20e07e1 100644
--- a/fs/affs/symlink.c
+++ b/fs/affs/symlink.c
@@ -40,7 +40,7 @@ static int affs_symlink_readpage(struct file *file, struct page *page)
j = 0;
lf = (struct slink_front *)bh->b_data;
lc = 0;
- pf = inode->i_sb->u.affs_sb.s_prefix ? inode->i_sb->u.affs_sb.s_prefix : "/";
+ pf = AFFS_SB(inode->i_sb)->s_prefix ? AFFS_SB(inode->i_sb)->s_prefix : "/";
if (strchr(lf->symname,':')) { /* Handle assign or volume name */
while (i < 1023 && (c = pf[i]))
diff --git a/fs/cramfs/uncompress.c b/fs/cramfs/uncompress.c
index e5359b03e783..5034365b06a8 100644
--- a/fs/cramfs/uncompress.c
+++ b/fs/cramfs/uncompress.c
@@ -18,7 +18,7 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/vmalloc.h>
-#include <linux/zlib_fs.h>
+#include <linux/zlib.h>
static z_stream stream;
static int initialized;
@@ -34,14 +34,14 @@ int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen)
stream.next_out = dst;
stream.avail_out = dstlen;
- err = zlib_fs_inflateReset(&stream);
+ err = zlib_inflateReset(&stream);
if (err != Z_OK) {
- printk("zlib_fs_inflateReset error %d\n", err);
- zlib_fs_inflateEnd(&stream);
- zlib_fs_inflateInit(&stream);
+ printk("zlib_inflateReset error %d\n", err);
+ zlib_inflateEnd(&stream);
+ zlib_inflateInit(&stream);
}
- err = zlib_fs_inflate(&stream, Z_FINISH);
+ err = zlib_inflate(&stream, Z_FINISH);
if (err != Z_STREAM_END)
goto err;
return stream.total_out;
@@ -55,14 +55,14 @@ err:
int cramfs_uncompress_init(void)
{
if (!initialized++) {
- stream.workspace = vmalloc(zlib_fs_inflate_workspacesize());
+ stream.workspace = vmalloc(zlib_inflate_workspacesize());
if ( !stream.workspace ) {
initialized = 0;
return -ENOMEM;
}
stream.next_in = NULL;
stream.avail_in = 0;
- zlib_fs_inflateInit(&stream);
+ zlib_inflateInit(&stream);
}
return 0;
}
@@ -70,7 +70,7 @@ int cramfs_uncompress_init(void)
int cramfs_uncompress_exit(void)
{
if (!--initialized) {
- zlib_fs_inflateEnd(&stream);
+ zlib_inflateEnd(&stream);
vfree(stream.workspace);
}
return 0;
diff --git a/fs/filesystems.c b/fs/filesystems.c
index 76eda773d051..9d924215e12c 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -6,7 +6,226 @@
* table of configured filesystems
*/
+#include <linux/config.h>
+#include <linux/slab.h>
+#include <linux/kmod.h>
+#define __NO_VERSION__
+#include <linux/module.h>
+#include <asm/uaccess.h>
+
+/*
+ * Handling of filesystem drivers list.
+ * Rules:
+ * Inclusion to/removals from/scanning of list are protected by spinlock.
+ * During the unload module must call unregister_filesystem().
+ * We can access the fields of list element if:
+ * 1) spinlock is held or
+ * 2) we hold the reference to the module.
+ * The latter can be guaranteed by call of try_inc_mod_count(); if it
+ * returned 0 we must skip the element, otherwise we got the reference.
+ * Once the reference is obtained we can drop the spinlock.
+ */
+
+static struct file_system_type *file_systems;
+static rwlock_t file_systems_lock = RW_LOCK_UNLOCKED;
+
+/* WARNING: This can be used only if we _already_ own a reference */
+void get_filesystem(struct file_system_type *fs)
+{
+ if (fs->owner)
+ __MOD_INC_USE_COUNT(fs->owner);
+}
+
+void put_filesystem(struct file_system_type *fs)
+{
+ if (fs->owner)
+ __MOD_DEC_USE_COUNT(fs->owner);
+}
+
+static struct file_system_type **find_filesystem(const char *name)
+{
+ struct file_system_type **p;
+ for (p=&file_systems; *p; p=&(*p)->next)
+ if (strcmp((*p)->name,name) == 0)
+ break;
+ return p;
+}
+
+/**
+ * register_filesystem - register a new filesystem
+ * @fs: the file system structure
+ *
+ * Adds the file system passed to the list of file systems the kernel
+ * is aware of for mount and other syscalls. Returns 0 on success,
+ * or a negative errno code on an error.
+ *
+ * The &struct file_system_type that is passed is linked into the kernel
+ * structures and must not be freed until the file system has been
+ * unregistered.
+ */
+
+int register_filesystem(struct file_system_type * fs)
+{
+ int res = 0;
+ struct file_system_type ** p;
+
+ if (!fs)
+ return -EINVAL;
+ if (fs->next)
+ return -EBUSY;
+ INIT_LIST_HEAD(&fs->fs_supers);
+ write_lock(&file_systems_lock);
+ p = find_filesystem(fs->name);
+ if (*p)
+ res = -EBUSY;
+ else
+ *p = fs;
+ write_unlock(&file_systems_lock);
+ return res;
+}
+
+/**
+ * unregister_filesystem - unregister a file system
+ * @fs: filesystem to unregister
+ *
+ * Remove a file system that was previously successfully registered
+ * with the kernel. An error is returned if the file system is not found.
+ * Zero is returned on a success.
+ *
+ * Once this function has returned the &struct file_system_type structure
+ * may be freed or reused.
+ */
+
+int unregister_filesystem(struct file_system_type * fs)
+{
+ struct file_system_type ** tmp;
+
+ write_lock(&file_systems_lock);
+ tmp = &file_systems;
+ while (*tmp) {
+ if (fs == *tmp) {
+ *tmp = fs->next;
+ fs->next = NULL;
+ write_unlock(&file_systems_lock);
+ return 0;
+ }
+ tmp = &(*tmp)->next;
+ }
+ write_unlock(&file_systems_lock);
+ return -EINVAL;
+}
+
+static int fs_index(const char * __name)
+{
+ struct file_system_type * tmp;
+ char * name;
+ int err, index;
+
+ name = getname(__name);
+ err = PTR_ERR(name);
+ if (IS_ERR(name))
+ return err;
+
+ err = -EINVAL;
+ read_lock(&file_systems_lock);
+ for (tmp=file_systems, index=0 ; tmp ; tmp=tmp->next, index++) {
+ if (strcmp(tmp->name,name) == 0) {
+ err = index;
+ break;
+ }
+ }
+ read_unlock(&file_systems_lock);
+ putname(name);
+ return err;
+}
+
+static int fs_name(unsigned int index, char * buf)
+{
+ struct file_system_type * tmp;
+ int len, res;
+
+ read_lock(&file_systems_lock);
+ for (tmp = file_systems; tmp; tmp = tmp->next, index--)
+ if (index <= 0 && try_inc_mod_count(tmp->owner))
+ break;
+ read_unlock(&file_systems_lock);
+ if (!tmp)
+ return -EINVAL;
+
+ /* OK, we got the reference, so we can safely block */
+ len = strlen(tmp->name) + 1;
+ res = copy_to_user(buf, tmp->name, len) ? -EFAULT : 0;
+ put_filesystem(tmp);
+ return res;
+}
+
+static int fs_maxindex(void)
+{
+ struct file_system_type * tmp;
+ int index;
+
+ read_lock(&file_systems_lock);
+ for (tmp = file_systems, index = 0 ; tmp ; tmp = tmp->next, index++)
+ ;
+ read_unlock(&file_systems_lock);
+ return index;
+}
+
/*
- * Code will move here from fs/super.c and yes, it will be fs type handling
- * stuff.
+ * Whee.. Weird sysv syscall.
*/
+asmlinkage long sys_sysfs(int option, unsigned long arg1, unsigned long arg2)
+{
+ int retval = -EINVAL;
+
+ switch (option) {
+ case 1:
+ retval = fs_index((const char *) arg1);
+ break;
+
+ case 2:
+ retval = fs_name(arg1, (char *) arg2);
+ break;
+
+ case 3:
+ retval = fs_maxindex();
+ break;
+ }
+ return retval;
+}
+
+int get_filesystem_list(char * buf)
+{
+ int len = 0;
+ struct file_system_type * tmp;
+
+ read_lock(&file_systems_lock);
+ tmp = file_systems;
+ while (tmp && len < PAGE_SIZE - 80) {
+ len += sprintf(buf+len, "%s\t%s\n",
+ (tmp->fs_flags & FS_REQUIRES_DEV) ? "" : "nodev",
+ tmp->name);
+ tmp = tmp->next;
+ }
+ read_unlock(&file_systems_lock);
+ return len;
+}
+
+struct file_system_type *get_fs_type(const char *name)
+{
+ struct file_system_type *fs;
+
+ read_lock(&file_systems_lock);
+ fs = *(find_filesystem(name));
+ if (fs && !try_inc_mod_count(fs->owner))
+ fs = NULL;
+ read_unlock(&file_systems_lock);
+ if (!fs && (request_module(name) == 0)) {
+ read_lock(&file_systems_lock);
+ fs = *(find_filesystem(name));
+ if (fs && !try_inc_mod_count(fs->owner))
+ fs = NULL;
+ read_unlock(&file_systems_lock);
+ }
+ return fs;
+}
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index 5330f3325da6..934310f4f35c 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -178,6 +178,9 @@ static void hfs_put_super(struct super_block *sb)
/* restore default blocksize for the device */
set_blocksize(sb->s_dev, BLOCK_SIZE);
+
+ kfree(sb->u.generic_sbp);
+ sb->u.generic_sbp = NULL;
}
/*
@@ -443,6 +446,7 @@ done:
*/
int hfs_fill_super(struct super_block *s, void *data, int silent)
{
+ struct hfs_sb_info *sbi;
struct hfs_mdb *mdb;
struct hfs_cat_key key;
kdev_t dev = s->s_dev;
@@ -450,7 +454,13 @@ int hfs_fill_super(struct super_block *s, void *data, int silent)
struct inode *root_inode;
int part;
- if (!parse_options((char *)data, HFS_SB(s), &part)) {
+ sbi = kmalloc(sizeof(struct hfs_sb_info), GFP_KERNEL);
+ if (!sbi)
+ return -ENOMEM;
+ s->u.generic_sbp = sbi;
+ memset(sbi, 0, sizeof(struct hfs_sb_info));
+
+ if (!parse_options((char *)data, sbi, &part)) {
hfs_warn("hfs_fs: unable to parse mount options.\n");
goto bail3;
}
@@ -485,7 +495,7 @@ int hfs_fill_super(struct super_block *s, void *data, int silent)
goto bail2;
}
- HFS_SB(s)->s_mdb = mdb;
+ sbi->s_mdb = mdb;
if (HFS_ITYPE(mdb->next_id) != 0) {
hfs_warn("hfs_fs: too many files.\n");
goto bail1;
@@ -522,6 +532,8 @@ bail1:
bail2:
set_blocksize(dev, BLOCK_SIZE);
bail3:
+ kfree(sbi);
+ sb->u.generic_sbp = NULL;
return -EINVAL;
}
diff --git a/fs/inflate_fs/Makefile b/fs/inflate_fs/Makefile
deleted file mode 100644
index fe78778a7031..000000000000
--- a/fs/inflate_fs/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# This is a modified version of zlib, which does all memory
-# allocation ahead of time.
-#
-# Currently only decompression is supported.
-#
-# Decompression needs to be serialized for each memory
-# allocation.
-#
-#
-# (The upsides of the simplification is that you can't get in
-# any nasty situations wrt memory management, and that the
-# uncompression can be done without blocking on allocation).
-#
-# The modules are named *_fs.o to distinguish from other modified
-# compression libraries, like the one used by ppp.
-#
-# It is expected that when a deflate module is added it will be
-# a separate module in a deflate_fs directory, to avoid having to
-# load the deflate code for readonly filesystems.
-#
-
-O_TARGET := inflate_fs.o
-
-export-objs := inflate_syms.o
-
-obj-y := adler32.o infblock.o infcodes.o inffast.o inflate.o \
- inftrees.o infutil.o inflate_syms.o
-obj-m := $(O_TARGET)
-
-EXTRA_CFLAGS += -I $(TOPDIR)/fs/inflate_fs
-
-include $(TOPDIR)/Rules.make
diff --git a/fs/inflate_fs/adler32.c b/fs/inflate_fs/adler32.c
deleted file mode 100644
index 2d84f67b405e..000000000000
--- a/fs/inflate_fs/adler32.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* adler32.c -- compute the Adler-32 checksum of a data stream
- * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#include <linux/zlib_fs.h>
-
-#define BASE 65521L /* largest prime smaller than 65536 */
-#define NMAX 5552
-/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
-
-#define DO1(buf,i) {s1 += buf[i]; s2 += s1;}
-#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
-#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
-#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
-#define DO16(buf) DO8(buf,0); DO8(buf,8);
-
-/* ========================================================================= */
-uLong ZEXPORT zlib_fs_adler32(adler, buf, len)
- uLong adler;
- const Bytef *buf;
- uInt len;
-{
- unsigned long s1 = adler & 0xffff;
- unsigned long s2 = (adler >> 16) & 0xffff;
- int k;
-
- if (buf == Z_NULL) return 1L;
-
- while (len > 0) {
- k = len < NMAX ? len : NMAX;
- len -= k;
- while (k >= 16) {
- DO16(buf);
- buf += 16;
- k -= 16;
- }
- if (k != 0) do {
- s1 += *buf++;
- s2 += s1;
- } while (--k);
- s1 %= BASE;
- s2 %= BASE;
- }
- return (s2 << 16) | s1;
-}
diff --git a/fs/inflate_fs/infblock.c b/fs/inflate_fs/infblock.c
deleted file mode 100644
index d11794fc15e1..000000000000
--- a/fs/inflate_fs/infblock.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/* infblock.c -- interpret and process block types to last block
- * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "infblock.h"
-#include "inftrees.h"
-#include "infcodes.h"
-#include "infutil.h"
-
-struct inflate_codes_state;
-
-/* simplify the use of the inflate_huft type with some defines */
-#define exop word.what.Exop
-#define bits word.what.Bits
-
-/* Table for deflate from PKZIP's appnote.txt. */
-local const uInt border[] = { /* Order of the bit length code lengths */
- 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
-/*
- Notes beyond the 1.93a appnote.txt:
-
- 1. Distance pointers never point before the beginning of the output
- stream.
- 2. Distance pointers can point back across blocks, up to 32k away.
- 3. There is an implied maximum of 7 bits for the bit length table and
- 15 bits for the actual data.
- 4. If only one code exists, then it is encoded using one bit. (Zero
- would be more efficient, but perhaps a little confusing.) If two
- codes exist, they are coded using one bit each (0 and 1).
- 5. There is no way of sending zero distance codes--a dummy must be
- sent if there are none. (History: a pre 2.0 version of PKZIP would
- store blocks with no distance codes, but this was discovered to be
- too harsh a criterion.) Valid only for 1.93a. 2.04c does allow
- zero distance codes, which is sent as one code of zero bits in
- length.
- 6. There are up to 286 literal/length codes. Code 256 represents the
- end-of-block. Note however that the static length tree defines
- 288 codes just to fill out the Huffman codes. Codes 286 and 287
- cannot be used though, since there is no length base or extra bits
- defined for them. Similarily, there are up to 30 distance codes.
- However, static trees define 32 codes (all 5 bits) to fill out the
- Huffman codes, but the last two had better not show up in the data.
- 7. Unzip can check dynamic Huffman blocks for complete code sets.
- The exception is that a single code would not be complete (see #4).
- 8. The five bits following the block type is really the number of
- literal codes sent minus 257.
- 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits
- (1+6+6). Therefore, to output three times the length, you output
- three codes (1+1+1), whereas to output four times the same length,
- you only need two codes (1+3). Hmm.
- 10. In the tree reconstruction algorithm, Code = Code + Increment
- only if BitLength(i) is not zero. (Pretty obvious.)
- 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19)
- 12. Note: length code 284 can represent 227-258, but length code 285
- really is 258. The last length deserves its own, short code
- since it gets used a lot in very redundant files. The length
- 258 is special since 258 - 3 (the min match length) is 255.
- 13. The literal/length and distance code bit lengths are read as a
- single stream of lengths. It is possible (and advantageous) for
- a repeat code (16, 17, or 18) to go across the boundary between
- the two sets of lengths.
- */
-
-
-void zlib_fs_inflate_blocks_reset(s, z, c)
-inflate_blocks_statef *s;
-z_streamp z;
-uLongf *c;
-{
- if (c != Z_NULL)
- *c = s->check;
- if (s->mode == CODES)
- zlib_fs_inflate_codes_free(s->sub.decode.codes, z);
- s->mode = TYPE;
- s->bitk = 0;
- s->bitb = 0;
- s->read = s->write = s->window;
- if (s->checkfn != Z_NULL)
- z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0);
-}
-
-inflate_blocks_statef *zlib_fs_inflate_blocks_new(z, c, w)
-z_streamp z;
-check_func c;
-uInt w;
-{
- inflate_blocks_statef *s;
-
- s = &WS(z)->working_blocks_state;
- s->hufts = WS(z)->working_hufts;
- s->window = WS(z)->working_window;
- s->end = s->window + w;
- s->checkfn = c;
- s->mode = TYPE;
- zlib_fs_inflate_blocks_reset(s, z, Z_NULL);
- return s;
-}
-
-
-int zlib_fs_inflate_blocks(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
-{
- uInt t; /* temporary storage */
- uLong b; /* bit buffer */
- uInt k; /* bits in bit buffer */
- Bytef *p; /* input data pointer */
- uInt n; /* bytes available there */
- Bytef *q; /* output window write pointer */
- uInt m; /* bytes to end of window or read pointer */
-
- /* copy input/output information to locals (UPDATE macro restores) */
- LOAD
-
- /* process input based on current state */
- while (1) switch (s->mode)
- {
- case TYPE:
- NEEDBITS(3)
- t = (uInt)b & 7;
- s->last = t & 1;
- switch (t >> 1)
- {
- case 0: /* stored */
- DUMPBITS(3)
- t = k & 7; /* go to byte boundary */
- DUMPBITS(t)
- s->mode = LENS; /* get length of stored block */
- break;
- case 1: /* fixed */
- {
- uInt bl, bd;
- inflate_huft *tl, *td;
-
- zlib_fs_inflate_trees_fixed(&bl, &bd, &tl, &td, z);
- s->sub.decode.codes = zlib_fs_inflate_codes_new(bl, bd, tl, td, z);
- if (s->sub.decode.codes == Z_NULL)
- {
- r = Z_MEM_ERROR;
- LEAVE
- }
- }
- DUMPBITS(3)
- s->mode = CODES;
- break;
- case 2: /* dynamic */
- DUMPBITS(3)
- s->mode = TABLE;
- break;
- case 3: /* illegal */
- DUMPBITS(3)
- s->mode = B_BAD;
- z->msg = (char*)"invalid block type";
- r = Z_DATA_ERROR;
- LEAVE
- }
- break;
- case LENS:
- NEEDBITS(32)
- if ((((~b) >> 16) & 0xffff) != (b & 0xffff))
- {
- s->mode = B_BAD;
- z->msg = (char*)"invalid stored block lengths";
- r = Z_DATA_ERROR;
- LEAVE
- }
- s->sub.left = (uInt)b & 0xffff;
- b = k = 0; /* dump bits */
- s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE);
- break;
- case STORED:
- if (n == 0)
- LEAVE
- NEEDOUT
- t = s->sub.left;
- if (t > n) t = n;
- if (t > m) t = m;
- memcpy(q, p, t);
- p += t; n -= t;
- q += t; m -= t;
- if ((s->sub.left -= t) != 0)
- break;
- s->mode = s->last ? DRY : TYPE;
- break;
- case TABLE:
- NEEDBITS(14)
- s->sub.trees.table = t = (uInt)b & 0x3fff;
-#ifndef PKZIP_BUG_WORKAROUND
- if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29)
- {
- s->mode = B_BAD;
- z->msg = (char*)"too many length or distance symbols";
- r = Z_DATA_ERROR;
- LEAVE
- }
-#endif
- {
- s->sub.trees.blens = WS(z)->working_blens;
- }
- DUMPBITS(14)
- s->sub.trees.index = 0;
- s->mode = BTREE;
- case BTREE:
- while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))
- {
- NEEDBITS(3)
- s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7;
- DUMPBITS(3)
- }
- while (s->sub.trees.index < 19)
- s->sub.trees.blens[border[s->sub.trees.index++]] = 0;
- s->sub.trees.bb = 7;
- t = zlib_fs_inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb,
- &s->sub.trees.tb, s->hufts, z);
- if (t != Z_OK)
- {
- r = t;
- if (r == Z_DATA_ERROR)
- s->mode = B_BAD;
- LEAVE
- }
- s->sub.trees.index = 0;
- s->mode = DTREE;
- case DTREE:
- while (t = s->sub.trees.table,
- s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))
- {
- inflate_huft *h;
- uInt i, j, c;
-
- t = s->sub.trees.bb;
- NEEDBITS(t)
- h = s->sub.trees.tb + ((uInt)b & zlib_fs_inflate_mask[t]);
- t = h->bits;
- c = h->base;
- if (c < 16)
- {
- DUMPBITS(t)
- s->sub.trees.blens[s->sub.trees.index++] = c;
- }
- else /* c == 16..18 */
- {
- i = c == 18 ? 7 : c - 14;
- j = c == 18 ? 11 : 3;
- NEEDBITS(t + i)
- DUMPBITS(t)
- j += (uInt)b & zlib_fs_inflate_mask[i];
- DUMPBITS(i)
- i = s->sub.trees.index;
- t = s->sub.trees.table;
- if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) ||
- (c == 16 && i < 1))
- {
- s->mode = B_BAD;
- z->msg = (char*)"invalid bit length repeat";
- r = Z_DATA_ERROR;
- LEAVE
- }
- c = c == 16 ? s->sub.trees.blens[i - 1] : 0;
- do {
- s->sub.trees.blens[i++] = c;
- } while (--j);
- s->sub.trees.index = i;
- }
- }
- s->sub.trees.tb = Z_NULL;
- {
- uInt bl, bd;
- inflate_huft *tl, *td;
- inflate_codes_statef *c;
-
- bl = 9; /* must be <= 9 for lookahead assumptions */
- bd = 6; /* must be <= 9 for lookahead assumptions */
- t = s->sub.trees.table;
- t = zlib_fs_inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
- s->sub.trees.blens, &bl, &bd, &tl, &td,
- s->hufts, z);
- if (t != Z_OK)
- {
- if (t == (uInt)Z_DATA_ERROR)
- s->mode = B_BAD;
- r = t;
- LEAVE
- }
- if ((c = zlib_fs_inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)
- {
- r = Z_MEM_ERROR;
- LEAVE
- }
- s->sub.decode.codes = c;
- }
- s->mode = CODES;
- case CODES:
- UPDATE
- if ((r = zlib_fs_inflate_codes(s, z, r)) != Z_STREAM_END)
- return zlib_fs_inflate_flush(s, z, r);
- r = Z_OK;
- zlib_fs_inflate_codes_free(s->sub.decode.codes, z);
- LOAD
- if (!s->last)
- {
- s->mode = TYPE;
- break;
- }
- s->mode = DRY;
- case DRY:
- FLUSH
- if (s->read != s->write)
- LEAVE
- s->mode = B_DONE;
- case B_DONE:
- r = Z_STREAM_END;
- LEAVE
- case B_BAD:
- r = Z_DATA_ERROR;
- LEAVE
- default:
- r = Z_STREAM_ERROR;
- LEAVE
- }
-}
-
-
-int zlib_fs_inflate_blocks_free(s, z)
-inflate_blocks_statef *s;
-z_streamp z;
-{
- zlib_fs_inflate_blocks_reset(s, z, Z_NULL);
- return Z_OK;
-}
-
-
-void zlib_fs_inflate_set_dictionary(s, d, n)
-inflate_blocks_statef *s;
-const Bytef *d;
-uInt n;
-{
- memcpy(s->window, d, n);
- s->read = s->write = s->window + n;
-}
-
-
-/* Returns true if inflate is currently at the end of a block generated
- * by Z_SYNC_FLUSH or Z_FULL_FLUSH.
- * IN assertion: s != Z_NULL
- */
-int zlib_fs_inflate_blocks_sync_point(s)
-inflate_blocks_statef *s;
-{
- return s->mode == LENS;
-}
diff --git a/fs/inflate_fs/infblock.h b/fs/inflate_fs/infblock.h
deleted file mode 100644
index 8ad07f35f25c..000000000000
--- a/fs/inflate_fs/infblock.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* infblock.h -- header to use infblock.c
- * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-#ifndef _INFBLOCK_H
-#define _INFBLOCK_H
-
-struct inflate_blocks_state;
-typedef struct inflate_blocks_state FAR inflate_blocks_statef;
-
-extern inflate_blocks_statef * zlib_fs_inflate_blocks_new OF((
- z_streamp z,
- check_func c, /* check function */
- uInt w)); /* window size */
-
-extern int zlib_fs_inflate_blocks OF((
- inflate_blocks_statef *,
- z_streamp ,
- int)); /* initial return code */
-
-extern void zlib_fs_inflate_blocks_reset OF((
- inflate_blocks_statef *,
- z_streamp ,
- uLongf *)); /* check value on output */
-
-extern int zlib_fs_inflate_blocks_free OF((
- inflate_blocks_statef *,
- z_streamp));
-
-extern void zlib_fs_inflate_set_dictionary OF((
- inflate_blocks_statef *s,
- const Bytef *d, /* dictionary */
- uInt n)); /* dictionary length */
-
-extern int zlib_fs_inflate_blocks_sync_point OF((
- inflate_blocks_statef *s));
-
-#endif /* _INFBLOCK_H */
diff --git a/fs/inflate_fs/infcodes.c b/fs/inflate_fs/infcodes.c
deleted file mode 100644
index 80789a3b61c6..000000000000
--- a/fs/inflate_fs/infcodes.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/* infcodes.c -- process literals and length/distance pairs
- * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "infblock.h"
-#include "infcodes.h"
-#include "infutil.h"
-#include "inffast.h"
-
-/* simplify the use of the inflate_huft type with some defines */
-#define exop word.what.Exop
-#define bits word.what.Bits
-
-inflate_codes_statef *zlib_fs_inflate_codes_new(bl, bd, tl, td, z)
-uInt bl, bd;
-inflate_huft *tl;
-inflate_huft *td; /* need separate declaration for Borland C++ */
-z_streamp z;
-{
- inflate_codes_statef *c;
-
- c = &WS(z)->working_state;
- {
- c->mode = START;
- c->lbits = (Byte)bl;
- c->dbits = (Byte)bd;
- c->ltree = tl;
- c->dtree = td;
- }
- return c;
-}
-
-
-int zlib_fs_inflate_codes(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
-{
- uInt j; /* temporary storage */
- inflate_huft *t; /* temporary pointer */
- uInt e; /* extra bits or operation */
- uLong b; /* bit buffer */
- uInt k; /* bits in bit buffer */
- Bytef *p; /* input data pointer */
- uInt n; /* bytes available there */
- Bytef *q; /* output window write pointer */
- uInt m; /* bytes to end of window or read pointer */
- Bytef *f; /* pointer to copy strings from */
- inflate_codes_statef *c = s->sub.decode.codes; /* codes state */
-
- /* copy input/output information to locals (UPDATE macro restores) */
- LOAD
-
- /* process input and output based on current state */
- while (1) switch (c->mode)
- { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
- case START: /* x: set up for LEN */
-#ifndef SLOW
- if (m >= 258 && n >= 10)
- {
- UPDATE
- r = zlib_fs_inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z);
- LOAD
- if (r != Z_OK)
- {
- c->mode = r == Z_STREAM_END ? WASH : BADCODE;
- break;
- }
- }
-#endif /* !SLOW */
- c->sub.code.need = c->lbits;
- c->sub.code.tree = c->ltree;
- c->mode = LEN;
- case LEN: /* i: get length/literal/eob next */
- j = c->sub.code.need;
- NEEDBITS(j)
- t = c->sub.code.tree + ((uInt)b & zlib_fs_inflate_mask[j]);
- DUMPBITS(t->bits)
- e = (uInt)(t->exop);
- if (e == 0) /* literal */
- {
- c->sub.lit = t->base;
- c->mode = LIT;
- break;
- }
- if (e & 16) /* length */
- {
- c->sub.copy.get = e & 15;
- c->len = t->base;
- c->mode = LENEXT;
- break;
- }
- if ((e & 64) == 0) /* next table */
- {
- c->sub.code.need = e;
- c->sub.code.tree = t + t->base;
- break;
- }
- if (e & 32) /* end of block */
- {
- c->mode = WASH;
- break;
- }
- c->mode = BADCODE; /* invalid code */
- z->msg = (char*)"invalid literal/length code";
- r = Z_DATA_ERROR;
- LEAVE
- case LENEXT: /* i: getting length extra (have base) */
- j = c->sub.copy.get;
- NEEDBITS(j)
- c->len += (uInt)b & zlib_fs_inflate_mask[j];
- DUMPBITS(j)
- c->sub.code.need = c->dbits;
- c->sub.code.tree = c->dtree;
- c->mode = DIST;
- case DIST: /* i: get distance next */
- j = c->sub.code.need;
- NEEDBITS(j)
- t = c->sub.code.tree + ((uInt)b & zlib_fs_inflate_mask[j]);
- DUMPBITS(t->bits)
- e = (uInt)(t->exop);
- if (e & 16) /* distance */
- {
- c->sub.copy.get = e & 15;
- c->sub.copy.dist = t->base;
- c->mode = DISTEXT;
- break;
- }
- if ((e & 64) == 0) /* next table */
- {
- c->sub.code.need = e;
- c->sub.code.tree = t + t->base;
- break;
- }
- c->mode = BADCODE; /* invalid code */
- z->msg = (char*)"invalid distance code";
- r = Z_DATA_ERROR;
- LEAVE
- case DISTEXT: /* i: getting distance extra */
- j = c->sub.copy.get;
- NEEDBITS(j)
- c->sub.copy.dist += (uInt)b & zlib_fs_inflate_mask[j];
- DUMPBITS(j)
- c->mode = COPY;
- case COPY: /* o: copying bytes in window, waiting for space */
-#ifndef __TURBOC__ /* Turbo C bug for following expression */
- f = (uInt)(q - s->window) < c->sub.copy.dist ?
- s->end - (c->sub.copy.dist - (q - s->window)) :
- q - c->sub.copy.dist;
-#else
- f = q - c->sub.copy.dist;
- if ((uInt)(q - s->window) < c->sub.copy.dist)
- f = s->end - (c->sub.copy.dist - (uInt)(q - s->window));
-#endif
- while (c->len)
- {
- NEEDOUT
- OUTBYTE(*f++)
- if (f == s->end)
- f = s->window;
- c->len--;
- }
- c->mode = START;
- break;
- case LIT: /* o: got literal, waiting for output space */
- NEEDOUT
- OUTBYTE(c->sub.lit)
- c->mode = START;
- break;
- case WASH: /* o: got eob, possibly more output */
- if (k > 7) /* return unused byte, if any */
- {
- k -= 8;
- n++;
- p--; /* can always return one */
- }
- FLUSH
- if (s->read != s->write)
- LEAVE
- c->mode = END;
- case END:
- r = Z_STREAM_END;
- LEAVE
- case BADCODE: /* x: got error */
- r = Z_DATA_ERROR;
- LEAVE
- default:
- r = Z_STREAM_ERROR;
- LEAVE
- }
-#ifdef NEED_DUMMY_RETURN
- return Z_STREAM_ERROR; /* Some dumb compilers complain without this */
-#endif
-}
-
-
-void zlib_fs_inflate_codes_free(c, z)
-inflate_codes_statef *c;
-z_streamp z;
-{
-}
diff --git a/fs/inflate_fs/infcodes.h b/fs/inflate_fs/infcodes.h
deleted file mode 100644
index f646d2ee2cb8..000000000000
--- a/fs/inflate_fs/infcodes.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* infcodes.h -- header to use infcodes.c
- * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-#ifndef _INFCODES_H
-#define _INFCODES_H
-
-#include "infblock.h"
-
-struct inflate_codes_state;
-typedef struct inflate_codes_state FAR inflate_codes_statef;
-
-extern inflate_codes_statef *zlib_fs_inflate_codes_new OF((
- uInt, uInt,
- inflate_huft *, inflate_huft *,
- z_streamp ));
-
-extern int zlib_fs_inflate_codes OF((
- inflate_blocks_statef *,
- z_streamp ,
- int));
-
-extern void zlib_fs_inflate_codes_free OF((
- inflate_codes_statef *,
- z_streamp ));
-
-#endif /* _INFCODES_H */
diff --git a/fs/inflate_fs/inffast.c b/fs/inflate_fs/inffast.c
deleted file mode 100644
index f9dc7519fc64..000000000000
--- a/fs/inflate_fs/inffast.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* inffast.c -- process literals and length/distance pairs fast
- * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "infblock.h"
-#include "infcodes.h"
-#include "infutil.h"
-#include "inffast.h"
-
-struct inflate_codes_state;
-
-/* simplify the use of the inflate_huft type with some defines */
-#define exop word.what.Exop
-#define bits word.what.Bits
-
-/* macros for bit input with no checking and for returning unused bytes */
-#define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}}
-#define UNGRAB {c=z->avail_in-n;c=(k>>3)<c?k>>3:c;n+=c;p-=c;k-=c<<3;}
-
-/* Called with number of bytes left to write in window at least 258
- (the maximum string length) and number of input bytes available
- at least ten. The ten bytes are six bytes for the longest length/
- distance pair plus four bytes for overloading the bit buffer. */
-
-int zlib_fs_inflate_fast(bl, bd, tl, td, s, z)
-uInt bl, bd;
-inflate_huft *tl;
-inflate_huft *td; /* need separate declaration for Borland C++ */
-inflate_blocks_statef *s;
-z_streamp z;
-{
- inflate_huft *t; /* temporary pointer */
- uInt e; /* extra bits or operation */
- uLong b; /* bit buffer */
- uInt k; /* bits in bit buffer */
- Bytef *p; /* input data pointer */
- uInt n; /* bytes available there */
- Bytef *q; /* output window write pointer */
- uInt m; /* bytes to end of window or read pointer */
- uInt ml; /* mask for literal/length tree */
- uInt md; /* mask for distance tree */
- uInt c; /* bytes to copy */
- uInt d; /* distance back to copy from */
- Bytef *r; /* copy source pointer */
-
- /* load input, output, bit values */
- LOAD
-
- /* initialize masks */
- ml = zlib_fs_inflate_mask[bl];
- md = zlib_fs_inflate_mask[bd];
-
- /* do until not enough input or output space for fast loop */
- do { /* assume called with m >= 258 && n >= 10 */
- /* get literal/length code */
- GRABBITS(20) /* max bits for literal/length code */
- if ((e = (t = tl + ((uInt)b & ml))->exop) == 0)
- {
- DUMPBITS(t->bits)
- *q++ = (Byte)t->base;
- m--;
- continue;
- }
- do {
- DUMPBITS(t->bits)
- if (e & 16)
- {
- /* get extra bits for length */
- e &= 15;
- c = t->base + ((uInt)b & zlib_fs_inflate_mask[e]);
- DUMPBITS(e)
-
- /* decode distance base of block to copy */
- GRABBITS(15); /* max bits for distance code */
- e = (t = td + ((uInt)b & md))->exop;
- do {
- DUMPBITS(t->bits)
- if (e & 16)
- {
- /* get extra bits to add to distance base */
- e &= 15;
- GRABBITS(e) /* get extra bits (up to 13) */
- d = t->base + ((uInt)b & zlib_fs_inflate_mask[e]);
- DUMPBITS(e)
-
- /* do the copy */
- m -= c;
- if ((uInt)(q - s->window) >= d) /* offset before dest */
- { /* just copy */
- r = q - d;
- *q++ = *r++; c--; /* minimum count is three, */
- *q++ = *r++; c--; /* so unroll loop a little */
- }
- else /* else offset after destination */
- {
- e = d - (uInt)(q - s->window); /* bytes from offset to end */
- r = s->end - e; /* pointer to offset */
- if (c > e) /* if source crosses, */
- {
- c -= e; /* copy to end of window */
- do {
- *q++ = *r++;
- } while (--e);
- r = s->window; /* copy rest from start of window */
- }
- }
- do { /* copy all or what's left */
- *q++ = *r++;
- } while (--c);
- break;
- }
- else if ((e & 64) == 0)
- {
- t += t->base;
- e = (t += ((uInt)b & zlib_fs_inflate_mask[e]))->exop;
- }
- else
- {
- z->msg = (char*)"invalid distance code";
- UNGRAB
- UPDATE
- return Z_DATA_ERROR;
- }
- } while (1);
- break;
- }
- if ((e & 64) == 0)
- {
- t += t->base;
- if ((e = (t += ((uInt)b & zlib_fs_inflate_mask[e]))->exop) == 0)
- {
- DUMPBITS(t->bits)
- *q++ = (Byte)t->base;
- m--;
- break;
- }
- }
- else if (e & 32)
- {
- UNGRAB
- UPDATE
- return Z_STREAM_END;
- }
- else
- {
- z->msg = (char*)"invalid literal/length code";
- UNGRAB
- UPDATE
- return Z_DATA_ERROR;
- }
- } while (1);
- } while (m >= 258 && n >= 10);
-
- /* not enough input or output--restore pointers and return */
- UNGRAB
- UPDATE
- return Z_OK;
-}
diff --git a/fs/inflate_fs/inffast.h b/fs/inflate_fs/inffast.h
deleted file mode 100644
index a9111552a54f..000000000000
--- a/fs/inflate_fs/inffast.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* inffast.h -- header to use inffast.c
- * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-extern int zlib_fs_inflate_fast OF((
- uInt,
- uInt,
- inflate_huft *,
- inflate_huft *,
- inflate_blocks_statef *,
- z_streamp ));
diff --git a/fs/inflate_fs/inffixed.h b/fs/inflate_fs/inffixed.h
deleted file mode 100644
index 77f7e7631452..000000000000
--- a/fs/inflate_fs/inffixed.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* inffixed.h -- table for decoding fixed codes
- * Generated automatically by the maketree.c program
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-local uInt fixed_bl = 9;
-local uInt fixed_bd = 5;
-local inflate_huft fixed_tl[] = {
- {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
- {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192},
- {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160},
- {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224},
- {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144},
- {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208},
- {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176},
- {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240},
- {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
- {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200},
- {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168},
- {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232},
- {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152},
- {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216},
- {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184},
- {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248},
- {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
- {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196},
- {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164},
- {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228},
- {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148},
- {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212},
- {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180},
- {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244},
- {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
- {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204},
- {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172},
- {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236},
- {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156},
- {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220},
- {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188},
- {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252},
- {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
- {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194},
- {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162},
- {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226},
- {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146},
- {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210},
- {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178},
- {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242},
- {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
- {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202},
- {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170},
- {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234},
- {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154},
- {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218},
- {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186},
- {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250},
- {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
- {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198},
- {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166},
- {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230},
- {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150},
- {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214},
- {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182},
- {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246},
- {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
- {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206},
- {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174},
- {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238},
- {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158},
- {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222},
- {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190},
- {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254},
- {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
- {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193},
- {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161},
- {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225},
- {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145},
- {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209},
- {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177},
- {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241},
- {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
- {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201},
- {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169},
- {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233},
- {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153},
- {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217},
- {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185},
- {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249},
- {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
- {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197},
- {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165},
- {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229},
- {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149},
- {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213},
- {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181},
- {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245},
- {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
- {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205},
- {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173},
- {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237},
- {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157},
- {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221},
- {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189},
- {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253},
- {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
- {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195},
- {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163},
- {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227},
- {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147},
- {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211},
- {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179},
- {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243},
- {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
- {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203},
- {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171},
- {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235},
- {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155},
- {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219},
- {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187},
- {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251},
- {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
- {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199},
- {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167},
- {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231},
- {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151},
- {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215},
- {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183},
- {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247},
- {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
- {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207},
- {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175},
- {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239},
- {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159},
- {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223},
- {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191},
- {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255}
- };
-local inflate_huft fixed_td[] = {
- {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097},
- {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385},
- {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193},
- {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577},
- {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145},
- {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577},
- {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289},
- {{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577}
- };
diff --git a/fs/inflate_fs/inflate.c b/fs/inflate_fs/inflate.c
deleted file mode 100644
index baf3cf25b76e..000000000000
--- a/fs/inflate_fs/inflate.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/* inflate.c -- zlib interface to inflate modules
- * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include <linux/module.h>
-#include "zutil.h"
-#include "infblock.h"
-#include "infutil.h"
-
-int ZEXPORT zlib_fs_inflate_workspacesize(void)
-{
- return sizeof(struct inflate_workspace);
-}
-
-
-int ZEXPORT zlib_fs_inflateReset(z)
-z_streamp z;
-{
- if (z == Z_NULL || z->state == Z_NULL || z->workspace == Z_NULL)
- return Z_STREAM_ERROR;
- z->total_in = z->total_out = 0;
- z->msg = Z_NULL;
- z->state->mode = z->state->nowrap ? BLOCKS : METHOD;
- zlib_fs_inflate_blocks_reset(z->state->blocks, z, Z_NULL);
- return Z_OK;
-}
-
-
-int ZEXPORT zlib_fs_inflateEnd(z)
-z_streamp z;
-{
- if (z == Z_NULL || z->state == Z_NULL || z->workspace == Z_NULL)
- return Z_STREAM_ERROR;
- if (z->state->blocks != Z_NULL)
- zlib_fs_inflate_blocks_free(z->state->blocks, z);
- z->state = Z_NULL;
- return Z_OK;
-}
-
-
-int ZEXPORT zlib_fs_inflateInit2_(z, w, version, stream_size)
-z_streamp z;
-int w;
-const char *version;
-int stream_size;
-{
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
- stream_size != sizeof(z_stream) || z->workspace == Z_NULL)
- return Z_VERSION_ERROR;
-
- /* initialize state */
- if (z == Z_NULL)
- return Z_STREAM_ERROR;
- z->msg = Z_NULL;
- z->state = &WS(z)->internal_state;
- z->state->blocks = Z_NULL;
-
- /* handle undocumented nowrap option (no zlib header or check) */
- z->state->nowrap = 0;
- if (w < 0)
- {
- w = - w;
- z->state->nowrap = 1;
- }
-
- /* set window size */
- if (w < 8 || w > 15)
- {
- zlib_fs_inflateEnd(z);
- return Z_STREAM_ERROR;
- }
- z->state->wbits = (uInt)w;
-
- /* create inflate_blocks state */
- if ((z->state->blocks =
- zlib_fs_inflate_blocks_new(z, z->state->nowrap ? Z_NULL : zlib_fs_adler32, (uInt)1 << w))
- == Z_NULL)
- {
- zlib_fs_inflateEnd(z);
- return Z_MEM_ERROR;
- }
-
- /* reset state */
- zlib_fs_inflateReset(z);
- return Z_OK;
-}
-
-
-int ZEXPORT zlib_fs_inflateInit_(z, version, stream_size)
-z_streamp z;
-const char *version;
-int stream_size;
-{
- return zlib_fs_inflateInit2_(z, DEF_WBITS, version, stream_size);
-}
-
-#undef NEEDBYTE
-#undef NEXTBYTE
-#define NEEDBYTE {if(z->avail_in==0)return r;r=f;}
-#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
-
-int ZEXPORT zlib_fs_inflate(z, f)
-z_streamp z;
-int f;
-{
- int r;
- uInt b;
-
- if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL)
- return Z_STREAM_ERROR;
- f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK;
- r = Z_BUF_ERROR;
- while (1) switch (z->state->mode)
- {
- case METHOD:
- NEEDBYTE
- if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED)
- {
- z->state->mode = I_BAD;
- z->msg = (char*)"unknown compression method";
- z->state->sub.marker = 5; /* can't try inflateSync */
- break;
- }
- if ((z->state->sub.method >> 4) + 8 > z->state->wbits)
- {
- z->state->mode = I_BAD;
- z->msg = (char*)"invalid window size";
- z->state->sub.marker = 5; /* can't try inflateSync */
- break;
- }
- z->state->mode = FLAG;
- case FLAG:
- NEEDBYTE
- b = NEXTBYTE;
- if (((z->state->sub.method << 8) + b) % 31)
- {
- z->state->mode = I_BAD;
- z->msg = (char*)"incorrect header check";
- z->state->sub.marker = 5; /* can't try inflateSync */
- break;
- }
- if (!(b & PRESET_DICT))
- {
- z->state->mode = BLOCKS;
- break;
- }
- z->state->mode = DICT4;
- case DICT4:
- NEEDBYTE
- z->state->sub.check.need = (uLong)NEXTBYTE << 24;
- z->state->mode = DICT3;
- case DICT3:
- NEEDBYTE
- z->state->sub.check.need += (uLong)NEXTBYTE << 16;
- z->state->mode = DICT2;
- case DICT2:
- NEEDBYTE
- z->state->sub.check.need += (uLong)NEXTBYTE << 8;
- z->state->mode = DICT1;
- case DICT1:
- NEEDBYTE
- z->state->sub.check.need += (uLong)NEXTBYTE;
- z->adler = z->state->sub.check.need;
- z->state->mode = DICT0;
- return Z_NEED_DICT;
- case DICT0:
- z->state->mode = I_BAD;
- z->msg = (char*)"need dictionary";
- z->state->sub.marker = 0; /* can try inflateSync */
- return Z_STREAM_ERROR;
- case BLOCKS:
- r = zlib_fs_inflate_blocks(z->state->blocks, z, r);
- if (r == Z_DATA_ERROR)
- {
- z->state->mode = I_BAD;
- z->state->sub.marker = 0; /* can try inflateSync */
- break;
- }
- if (r == Z_OK)
- r = f;
- if (r != Z_STREAM_END)
- return r;
- r = f;
- zlib_fs_inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was);
- if (z->state->nowrap)
- {
- z->state->mode = I_DONE;
- break;
- }
- z->state->mode = CHECK4;
- case CHECK4:
- NEEDBYTE
- z->state->sub.check.need = (uLong)NEXTBYTE << 24;
- z->state->mode = CHECK3;
- case CHECK3:
- NEEDBYTE
- z->state->sub.check.need += (uLong)NEXTBYTE << 16;
- z->state->mode = CHECK2;
- case CHECK2:
- NEEDBYTE
- z->state->sub.check.need += (uLong)NEXTBYTE << 8;
- z->state->mode = CHECK1;
- case CHECK1:
- NEEDBYTE
- z->state->sub.check.need += (uLong)NEXTBYTE;
-
- if (z->state->sub.check.was != z->state->sub.check.need)
- {
- z->state->mode = I_BAD;
- z->msg = (char*)"incorrect data check";
- z->state->sub.marker = 5; /* can't try inflateSync */
- break;
- }
- z->state->mode = I_DONE;
- case I_DONE:
- return Z_STREAM_END;
- case I_BAD:
- return Z_DATA_ERROR;
- default:
- return Z_STREAM_ERROR;
- }
-#ifdef NEED_DUMMY_RETURN
- return Z_STREAM_ERROR; /* Some dumb compilers complain without this */
-#endif
-}
-
-
-int ZEXPORT zlib_fs_inflateSync(z)
-z_streamp z;
-{
- uInt n; /* number of bytes to look at */
- Bytef *p; /* pointer to bytes */
- uInt m; /* number of marker bytes found in a row */
- uLong r, w; /* temporaries to save total_in and total_out */
-
- /* set up */
- if (z == Z_NULL || z->state == Z_NULL)
- return Z_STREAM_ERROR;
- if (z->state->mode != I_BAD)
- {
- z->state->mode = I_BAD;
- z->state->sub.marker = 0;
- }
- if ((n = z->avail_in) == 0)
- return Z_BUF_ERROR;
- p = z->next_in;
- m = z->state->sub.marker;
-
- /* search */
- while (n && m < 4)
- {
- static const Byte mark[4] = {0, 0, 0xff, 0xff};
- if (*p == mark[m])
- m++;
- else if (*p)
- m = 0;
- else
- m = 4 - m;
- p++, n--;
- }
-
- /* restore */
- z->total_in += p - z->next_in;
- z->next_in = p;
- z->avail_in = n;
- z->state->sub.marker = m;
-
- /* return no joy or set up to restart on a new block */
- if (m != 4)
- return Z_DATA_ERROR;
- r = z->total_in; w = z->total_out;
- zlib_fs_inflateReset(z);
- z->total_in = r; z->total_out = w;
- z->state->mode = BLOCKS;
- return Z_OK;
-}
-
-
-/* Returns true if inflate is currently at the end of a block generated
- * by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
- * implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH
- * but removes the length bytes of the resulting empty stored block. When
- * decompressing, PPP checks that at the end of input packet, inflate is
- * waiting for these length bytes.
- */
-int ZEXPORT zlib_fs_inflateSyncPoint(z)
-z_streamp z;
-{
- if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL)
- return Z_STREAM_ERROR;
- return zlib_fs_inflate_blocks_sync_point(z->state->blocks);
-}
diff --git a/fs/inflate_fs/inflate_syms.c b/fs/inflate_fs/inflate_syms.c
deleted file mode 100644
index 891b3bbf2582..000000000000
--- a/fs/inflate_fs/inflate_syms.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * linux/fs/zlib/inflate_syms.c
- *
- * Exported symbols for the inflate functionality.
- *
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-
-#include <linux/zlib_fs.h>
-
-EXPORT_SYMBOL(zlib_fs_inflate_workspacesize);
-EXPORT_SYMBOL(zlib_fs_inflate);
-EXPORT_SYMBOL(zlib_fs_inflateInit_);
-EXPORT_SYMBOL(zlib_fs_inflateInit2_);
-EXPORT_SYMBOL(zlib_fs_inflateEnd);
-EXPORT_SYMBOL(zlib_fs_inflateSync);
-EXPORT_SYMBOL(zlib_fs_inflateReset);
-EXPORT_SYMBOL(zlib_fs_adler32);
-EXPORT_SYMBOL(zlib_fs_inflateSyncPoint);
-MODULE_LICENSE("GPL");
diff --git a/fs/inflate_fs/inftrees.c b/fs/inflate_fs/inftrees.c
deleted file mode 100644
index 3b6f65b33464..000000000000
--- a/fs/inflate_fs/inftrees.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "infutil.h"
-
-static const char inflate_copyright[] =
- " inflate 1.1.3 Copyright 1995-1998 Mark Adler ";
-/*
- If you use the zlib library in a product, an acknowledgment is welcome
- in the documentation of your product. If for some reason you cannot
- include such an acknowledgment, I would appreciate that you keep this
- copyright string in the executable of your product.
- */
-struct internal_state;
-
-/* simplify the use of the inflate_huft type with some defines */
-#define exop word.what.Exop
-#define bits word.what.Bits
-
-
-local int huft_build OF((
- uIntf *, /* code lengths in bits */
- uInt, /* number of codes */
- uInt, /* number of "simple" codes */
- const uIntf *, /* list of base values for non-simple codes */
- const uIntf *, /* list of extra bits for non-simple codes */
- inflate_huft * FAR*,/* result: starting table */
- uIntf *, /* maximum lookup bits (returns actual) */
- inflate_huft *, /* space for trees */
- uInt *, /* hufts used in space */
- uIntf * )); /* space for values */
-
-/* Tables for deflate from PKZIP's appnote.txt. */
-local const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
- /* see note #13 above about 258 */
-local const uInt cplext[31] = { /* Extra bits for literal codes 257..285 */
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
- 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */
-local const uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
- 8193, 12289, 16385, 24577};
-local const uInt cpdext[30] = { /* Extra bits for distance codes */
- 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
- 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
- 12, 12, 13, 13};
-
-/*
- Huffman code decoding is performed using a multi-level table lookup.
- The fastest way to decode is to simply build a lookup table whose
- size is determined by the longest code. However, the time it takes
- to build this table can also be a factor if the data being decoded
- is not very long. The most common codes are necessarily the
- shortest codes, so those codes dominate the decoding time, and hence
- the speed. The idea is you can have a shorter table that decodes the
- shorter, more probable codes, and then point to subsidiary tables for
- the longer codes. The time it costs to decode the longer codes is
- then traded against the time it takes to make longer tables.
-
- This results of this trade are in the variables lbits and dbits
- below. lbits is the number of bits the first level table for literal/
- length codes can decode in one step, and dbits is the same thing for
- the distance codes. Subsequent tables are also less than or equal to
- those sizes. These values may be adjusted either when all of the
- codes are shorter than that, in which case the longest code length in
- bits is used, or when the shortest code is *longer* than the requested
- table size, in which case the length of the shortest code in bits is
- used.
-
- There are two different values for the two tables, since they code a
- different number of possibilities each. The literal/length table
- codes 286 possible values, or in a flat code, a little over eight
- bits. The distance table codes 30 possible values, or a little less
- than five bits, flat. The optimum values for speed end up being
- about one bit more than those, so lbits is 8+1 and dbits is 5+1.
- The optimum values may differ though from machine to machine, and
- possibly even between compilers. Your mileage may vary.
- */
-
-
-/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
-#define BMAX 15 /* maximum bit length of any code */
-
-local int huft_build(b, n, s, d, e, t, m, hp, hn, v)
-uIntf *b; /* code lengths in bits (all assumed <= BMAX) */
-uInt n; /* number of codes (assumed <= 288) */
-uInt s; /* number of simple-valued codes (0..s-1) */
-const uIntf *d; /* list of base values for non-simple codes */
-const uIntf *e; /* list of extra bits for non-simple codes */
-inflate_huft * FAR *t; /* result: starting table */
-uIntf *m; /* maximum lookup bits, returns actual */
-inflate_huft *hp; /* space for trees */
-uInt *hn; /* hufts used in space */
-uIntf *v; /* working area: values in order of bit length */
-/* Given a list of code lengths and a maximum table size, make a set of
- tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR
- if the given code set is incomplete (the tables are still built in this
- case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of
- lengths), or Z_MEM_ERROR if not enough memory. */
-{
-
- uInt a; /* counter for codes of length k */
- uInt c[BMAX+1]; /* bit length count table */
- uInt f; /* i repeats in table every f entries */
- int g; /* maximum code length */
- int h; /* table level */
- register uInt i; /* counter, current code */
- register uInt j; /* counter */
- register int k; /* number of bits in current code */
- int l; /* bits per table (returned in m) */
- uInt mask; /* (1 << w) - 1, to avoid cc -O bug on HP */
- register uIntf *p; /* pointer into c[], b[], or v[] */
- inflate_huft *q; /* points to current table */
- struct inflate_huft_s r; /* table entry for structure assignment */
- inflate_huft *u[BMAX]; /* table stack */
- register int w; /* bits before this table == (l * h) */
- uInt x[BMAX+1]; /* bit offsets, then code stack */
- uIntf *xp; /* pointer into x */
- int y; /* number of dummy codes added */
- uInt z; /* number of entries in current table */
-
-
- /* Generate counts for each bit length */
- p = c;
-#define C0 *p++ = 0;
-#define C2 C0 C0 C0 C0
-#define C4 C2 C2 C2 C2
- C4 /* clear c[]--assume BMAX+1 is 16 */
- p = b; i = n;
- do {
- c[*p++]++; /* assume all entries <= BMAX */
- } while (--i);
- if (c[0] == n) /* null input--all zero length codes */
- {
- *t = (inflate_huft *)Z_NULL;
- *m = 0;
- return Z_OK;
- }
-
-
- /* Find minimum and maximum length, bound *m by those */
- l = *m;
- for (j = 1; j <= BMAX; j++)
- if (c[j])
- break;
- k = j; /* minimum code length */
- if ((uInt)l < j)
- l = j;
- for (i = BMAX; i; i--)
- if (c[i])
- break;
- g = i; /* maximum code length */
- if ((uInt)l > i)
- l = i;
- *m = l;
-
-
- /* Adjust last length count to fill out codes, if needed */
- for (y = 1 << j; j < i; j++, y <<= 1)
- if ((y -= c[j]) < 0)
- return Z_DATA_ERROR;
- if ((y -= c[i]) < 0)
- return Z_DATA_ERROR;
- c[i] += y;
-
-
- /* Generate starting offsets into the value table for each length */
- x[1] = j = 0;
- p = c + 1; xp = x + 2;
- while (--i) { /* note that i == g from above */
- *xp++ = (j += *p++);
- }
-
-
- /* Make a table of values in order of bit lengths */
- p = b; i = 0;
- do {
- if ((j = *p++) != 0)
- v[x[j]++] = i;
- } while (++i < n);
- n = x[g]; /* set n to length of v */
-
-
- /* Generate the Huffman codes and for each, make the table entries */
- x[0] = i = 0; /* first Huffman code is zero */
- p = v; /* grab values in bit order */
- h = -1; /* no tables yet--level -1 */
- w = -l; /* bits decoded == (l * h) */
- u[0] = (inflate_huft *)Z_NULL; /* just to keep compilers happy */
- q = (inflate_huft *)Z_NULL; /* ditto */
- z = 0; /* ditto */
-
- /* go through the bit lengths (k already is bits in shortest code) */
- for (; k <= g; k++)
- {
- a = c[k];
- while (a--)
- {
- /* here i is the Huffman code of length k bits for value *p */
- /* make tables up to required level */
- while (k > w + l)
- {
- h++;
- w += l; /* previous table always l bits */
-
- /* compute minimum size table less than or equal to l bits */
- z = g - w;
- z = z > (uInt)l ? l : z; /* table size upper limit */
- if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */
- { /* too few codes for k-w bit table */
- f -= a + 1; /* deduct codes from patterns left */
- xp = c + k;
- if (j < z)
- while (++j < z) /* try smaller tables up to z bits */
- {
- if ((f <<= 1) <= *++xp)
- break; /* enough codes to use up j bits */
- f -= *xp; /* else deduct codes from patterns */
- }
- }
- z = 1 << j; /* table entries for j-bit table */
-
- /* allocate new table */
- if (*hn + z > MANY) /* (note: doesn't matter for fixed) */
- return Z_MEM_ERROR; /* not enough memory */
- u[h] = q = hp + *hn;
- *hn += z;
-
- /* connect to last table, if there is one */
- if (h)
- {
- x[h] = i; /* save pattern for backing up */
- r.bits = (Byte)l; /* bits to dump before this table */
- r.exop = (Byte)j; /* bits in this table */
- j = i >> (w - l);
- r.base = (uInt)(q - u[h-1] - j); /* offset to this table */
- u[h-1][j] = r; /* connect to last table */
- }
- else
- *t = q; /* first table is returned result */
- }
-
- /* set up table entry in r */
- r.bits = (Byte)(k - w);
- if (p >= v + n)
- r.exop = 128 + 64; /* out of values--invalid code */
- else if (*p < s)
- {
- r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */
- r.base = *p++; /* simple code is just the value */
- }
- else
- {
- r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */
- r.base = d[*p++ - s];
- }
-
- /* fill code-like entries with r */
- f = 1 << (k - w);
- for (j = i >> w; j < z; j += f)
- q[j] = r;
-
- /* backwards increment the k-bit code i */
- for (j = 1 << (k - 1); i & j; j >>= 1)
- i ^= j;
- i ^= j;
-
- /* backup over finished tables */
- mask = (1 << w) - 1; /* needed on HP, cc -O bug */
- while ((i & mask) != x[h])
- {
- h--; /* don't need to update q */
- w -= l;
- mask = (1 << w) - 1;
- }
- }
- }
-
-
- /* Return Z_BUF_ERROR if we were given an incomplete table */
- return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;
-}
-
-
-int zlib_fs_inflate_trees_bits(c, bb, tb, hp, z)
-uIntf *c; /* 19 code lengths */
-uIntf *bb; /* bits tree desired/actual depth */
-inflate_huft * FAR *tb; /* bits tree result */
-inflate_huft *hp; /* space for trees */
-z_streamp z; /* for messages */
-{
- int r;
- uInt hn = 0; /* hufts used in space */
- uIntf *v; /* work area for huft_build */
-
- v = WS(z)->tree_work_area_1;
- r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL,
- tb, bb, hp, &hn, v);
- if (r == Z_DATA_ERROR)
- z->msg = (char*)"oversubscribed dynamic bit lengths tree";
- else if (r == Z_BUF_ERROR || *bb == 0)
- {
- z->msg = (char*)"incomplete dynamic bit lengths tree";
- r = Z_DATA_ERROR;
- }
- return r;
-}
-
-int zlib_fs_inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z)
-uInt nl; /* number of literal/length codes */
-uInt nd; /* number of distance codes */
-uIntf *c; /* that many (total) code lengths */
-uIntf *bl; /* literal desired/actual bit depth */
-uIntf *bd; /* distance desired/actual bit depth */
-inflate_huft * FAR *tl; /* literal/length tree result */
-inflate_huft * FAR *td; /* distance tree result */
-inflate_huft *hp; /* space for trees */
-z_streamp z; /* for messages */
-{
- int r;
- uInt hn = 0; /* hufts used in space */
- uIntf *v; /* work area for huft_build */
-
- /* allocate work area */
- v = WS(z)->tree_work_area_2;
-
- /* build literal/length tree */
- r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v);
- if (r != Z_OK || *bl == 0)
- {
- if (r == Z_DATA_ERROR)
- z->msg = (char*)"oversubscribed literal/length tree";
- else if (r != Z_MEM_ERROR)
- {
- z->msg = (char*)"incomplete literal/length tree";
- r = Z_DATA_ERROR;
- }
- return r;
- }
-
- /* build distance tree */
- r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v);
- if (r != Z_OK || (*bd == 0 && nl > 257))
- {
- if (r == Z_DATA_ERROR)
- z->msg = (char*)"oversubscribed distance tree";
- else if (r == Z_BUF_ERROR) {
-#ifdef PKZIP_BUG_WORKAROUND
- r = Z_OK;
- }
-#else
- z->msg = (char*)"incomplete distance tree";
- r = Z_DATA_ERROR;
- }
- else if (r != Z_MEM_ERROR)
- {
- z->msg = (char*)"empty distance tree with lengths";
- r = Z_DATA_ERROR;
- }
- return r;
-#endif
- }
-
- /* done */
- return Z_OK;
-}
-
-
-/* build fixed tables only once--keep them here */
-#include "inffixed.h"
-
-
-int zlib_fs_inflate_trees_fixed(bl, bd, tl, td, z)
-uIntf *bl; /* literal desired/actual bit depth */
-uIntf *bd; /* distance desired/actual bit depth */
-inflate_huft * FAR *tl; /* literal/length tree result */
-inflate_huft * FAR *td; /* distance tree result */
-z_streamp z; /* for memory allocation */
-{
- *bl = fixed_bl;
- *bd = fixed_bd;
- *tl = fixed_tl;
- *td = fixed_td;
- return Z_OK;
-}
diff --git a/fs/inflate_fs/inftrees.h b/fs/inflate_fs/inftrees.h
deleted file mode 100644
index a5f95fd71b23..000000000000
--- a/fs/inflate_fs/inftrees.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* inftrees.h -- header to use inftrees.c
- * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* Huffman code lookup table entry--this entry is four bytes for machines
- that have 16-bit pointers (e.g. PC's in the small or medium model). */
-
-#ifndef _INFTREES_H
-#define _INFTREES_H
-
-typedef struct inflate_huft_s FAR inflate_huft;
-
-struct inflate_huft_s {
- union {
- struct {
- Byte Exop; /* number of extra bits or operation */
- Byte Bits; /* number of bits in this code or subcode */
- } what;
- uInt pad; /* pad structure to a power of 2 (4 bytes for */
- } word; /* 16-bit, 8 bytes for 32-bit int's) */
- uInt base; /* literal, length base, distance base,
- or table offset */
-};
-
-/* Maximum size of dynamic tree. The maximum found in a long but non-
- exhaustive search was 1004 huft structures (850 for length/literals
- and 154 for distances, the latter actually the result of an
- exhaustive search). The actual maximum is not known, but the
- value below is more than safe. */
-#define MANY 1440
-
-extern int zlib_fs_inflate_trees_bits OF((
- uIntf *, /* 19 code lengths */
- uIntf *, /* bits tree desired/actual depth */
- inflate_huft * FAR *, /* bits tree result */
- inflate_huft *, /* space for trees */
- z_streamp)); /* for messages */
-
-extern int zlib_fs_inflate_trees_dynamic OF((
- uInt, /* number of literal/length codes */
- uInt, /* number of distance codes */
- uIntf *, /* that many (total) code lengths */
- uIntf *, /* literal desired/actual bit depth */
- uIntf *, /* distance desired/actual bit depth */
- inflate_huft * FAR *, /* literal/length tree result */
- inflate_huft * FAR *, /* distance tree result */
- inflate_huft *, /* space for trees */
- z_streamp)); /* for messages */
-
-extern int zlib_fs_inflate_trees_fixed OF((
- uIntf *, /* literal desired/actual bit depth */
- uIntf *, /* distance desired/actual bit depth */
- inflate_huft * FAR *, /* literal/length tree result */
- inflate_huft * FAR *, /* distance tree result */
- z_streamp)); /* for memory allocation */
-
-#endif /* _INFTREES_H */
diff --git a/fs/inflate_fs/infutil.c b/fs/inflate_fs/infutil.c
deleted file mode 100644
index 75724c16a620..000000000000
--- a/fs/inflate_fs/infutil.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* inflate_util.c -- data and routines common to blocks and codes
- * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "infblock.h"
-#include "inftrees.h"
-#include "infcodes.h"
-#include "infutil.h"
-
-struct inflate_codes_state;
-
-/* And'ing with mask[n] masks the lower n bits */
-uInt zlib_fs_inflate_mask[17] = {
- 0x0000,
- 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
- 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
-};
-
-
-/* copy as much as possible from the sliding window to the output area */
-int zlib_fs_inflate_flush(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
-{
- uInt n;
- Bytef *p;
- Bytef *q;
-
- /* local copies of source and destination pointers */
- p = z->next_out;
- q = s->read;
-
- /* compute number of bytes to copy as far as end of window */
- n = (uInt)((q <= s->write ? s->write : s->end) - q);
- if (n > z->avail_out) n = z->avail_out;
- if (n && r == Z_BUF_ERROR) r = Z_OK;
-
- /* update counters */
- z->avail_out -= n;
- z->total_out += n;
-
- /* update check information */
- if (s->checkfn != Z_NULL)
- z->adler = s->check = (*s->checkfn)(s->check, q, n);
-
- /* copy as far as end of window */
- memcpy(p, q, n);
- p += n;
- q += n;
-
- /* see if more to copy at beginning of window */
- if (q == s->end)
- {
- /* wrap pointers */
- q = s->window;
- if (s->write == s->end)
- s->write = s->window;
-
- /* compute bytes to copy */
- n = (uInt)(s->write - q);
- if (n > z->avail_out) n = z->avail_out;
- if (n && r == Z_BUF_ERROR) r = Z_OK;
-
- /* update counters */
- z->avail_out -= n;
- z->total_out += n;
-
- /* update check information */
- if (s->checkfn != Z_NULL)
- z->adler = s->check = (*s->checkfn)(s->check, q, n);
-
- /* copy */
- memcpy(p, q, n);
- p += n;
- q += n;
- }
-
- /* update pointers */
- z->next_out = p;
- s->read = q;
-
- /* done */
- return r;
-}
diff --git a/fs/inflate_fs/infutil.h b/fs/inflate_fs/infutil.h
deleted file mode 100644
index 5c90a27598de..000000000000
--- a/fs/inflate_fs/infutil.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* infutil.h -- types and macros common to blocks and codes
- * Copyright (C) 1995-1998 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-#ifndef _INFUTIL_H
-#define _INFUTIL_H
-
-#include <linux/zconf.h>
-#include "inftrees.h"
-#include "infcodes.h"
-
-typedef enum {
- TYPE, /* get type bits (3, including end bit) */
- LENS, /* get lengths for stored */
- STORED, /* processing stored block */
- TABLE, /* get table lengths */
- BTREE, /* get bit lengths tree for a dynamic block */
- DTREE, /* get length, distance trees for a dynamic block */
- CODES, /* processing fixed or dynamic block */
- DRY, /* output remaining window bytes */
- B_DONE, /* finished last block, done */
- B_BAD} /* got a data error--stuck here */
-inflate_block_mode;
-
-/* inflate blocks semi-private state */
-struct inflate_blocks_state {
-
- /* mode */
- inflate_block_mode mode; /* current inflate_block mode */
-
- /* mode dependent information */
- union {
- uInt left; /* if STORED, bytes left to copy */
- struct {
- uInt table; /* table lengths (14 bits) */
- uInt index; /* index into blens (or border) */
- uIntf *blens; /* bit lengths of codes */
- uInt bb; /* bit length tree depth */
- inflate_huft *tb; /* bit length decoding tree */
- } trees; /* if DTREE, decoding info for trees */
- struct {
- inflate_codes_statef
- *codes;
- } decode; /* if CODES, current state */
- } sub; /* submode */
- uInt last; /* true if this block is the last block */
-
- /* mode independent information */
- uInt bitk; /* bits in bit buffer */
- uLong bitb; /* bit buffer */
- inflate_huft *hufts; /* single malloc for tree space */
- Bytef *window; /* sliding window */
- Bytef *end; /* one byte after sliding window */
- Bytef *read; /* window read pointer */
- Bytef *write; /* window write pointer */
- check_func checkfn; /* check function */
- uLong check; /* check on output */
-
-};
-
-
-/* defines for inflate input/output */
-/* update pointers and return */
-#define UPDBITS {s->bitb=b;s->bitk=k;}
-#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}
-#define UPDOUT {s->write=q;}
-#define UPDATE {UPDBITS UPDIN UPDOUT}
-#define LEAVE {UPDATE return zlib_fs_inflate_flush(s,z,r);}
-/* get bytes and bits */
-#define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}
-#define NEEDBYTE {if(n)r=Z_OK;else LEAVE}
-#define NEXTBYTE (n--,*p++)
-#define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}}
-#define DUMPBITS(j) {b>>=(j);k-=(j);}
-/* output bytes */
-#define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q)
-#define LOADOUT {q=s->write;m=(uInt)WAVAIL;}
-#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}
-#define FLUSH {UPDOUT r=zlib_fs_inflate_flush(s,z,r); LOADOUT}
-#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}
-#define OUTBYTE(a) {*q++=(Byte)(a);m--;}
-/* load local pointers */
-#define LOAD {LOADIN LOADOUT}
-
-/* masks for lower bits (size given to avoid silly warnings with Visual C++) */
-extern uInt zlib_fs_inflate_mask[17];
-
-/* copy as much as possible from the sliding window to the output area */
-extern int zlib_fs_inflate_flush OF((
- inflate_blocks_statef *,
- z_streamp ,
- int));
-
-/* inflate private state */
-typedef enum {
- METHOD, /* waiting for method byte */
- FLAG, /* waiting for flag byte */
- DICT4, /* four dictionary check bytes to go */
- DICT3, /* three dictionary check bytes to go */
- DICT2, /* two dictionary check bytes to go */
- DICT1, /* one dictionary check byte to go */
- DICT0, /* waiting for inflateSetDictionary */
- BLOCKS, /* decompressing blocks */
- CHECK4, /* four check bytes to go */
- CHECK3, /* three check bytes to go */
- CHECK2, /* two check bytes to go */
- CHECK1, /* one check byte to go */
- I_DONE, /* finished check, done */
- I_BAD} /* got an error--stay here */
-inflate_mode;
-
-struct internal_state {
-
- /* mode */
- inflate_mode mode; /* current inflate mode */
-
- /* mode dependent information */
- union {
- uInt method; /* if FLAGS, method byte */
- struct {
- uLong was; /* computed check value */
- uLong need; /* stream check value */
- } check; /* if CHECK, check values to compare */
- uInt marker; /* if BAD, inflateSync's marker bytes count */
- } sub; /* submode */
-
- /* mode independent information */
- int nowrap; /* flag for no wrapper */
- uInt wbits; /* log2(window size) (8..15, defaults to 15) */
- inflate_blocks_statef
- *blocks; /* current inflate_blocks state */
-
-};
-
-/* inflate codes private state */
-typedef enum { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
- START, /* x: set up for LEN */
- LEN, /* i: get length/literal/eob next */
- LENEXT, /* i: getting length extra (have base) */
- DIST, /* i: get distance next */
- DISTEXT, /* i: getting distance extra */
- COPY, /* o: copying bytes in window, waiting for space */
- LIT, /* o: got literal, waiting for output space */
- WASH, /* o: got eob, possibly still output waiting */
- END, /* x: got eob and all data flushed */
- BADCODE} /* x: got error */
-inflate_codes_mode;
-
-struct inflate_codes_state {
-
- /* mode */
- inflate_codes_mode mode; /* current inflate_codes mode */
-
- /* mode dependent information */
- uInt len;
- union {
- struct {
- inflate_huft *tree; /* pointer into tree */
- uInt need; /* bits needed */
- } code; /* if LEN or DIST, where in tree */
- uInt lit; /* if LIT, literal */
- struct {
- uInt get; /* bits to get for extra */
- uInt dist; /* distance back to copy from */
- } copy; /* if EXT or COPY, where and how much */
- } sub; /* submode */
-
- /* mode independent information */
- Byte lbits; /* ltree bits decoded per branch */
- Byte dbits; /* dtree bits decoder per branch */
- inflate_huft *ltree; /* literal/length/eob tree */
- inflate_huft *dtree; /* distance tree */
-
-};
-
-/* memory allocation for inflation */
-
-struct inflate_workspace {
- inflate_codes_statef working_state;
- struct inflate_blocks_state working_blocks_state;
- struct internal_state internal_state;
- unsigned int tree_work_area_1[19];
- unsigned int tree_work_area_2[288];
- unsigned working_blens[258 + 0x1f + 0x1f];
- inflate_huft working_hufts[MANY];
- unsigned char working_window[1 << MAX_WBITS];
-};
-
-#define WS(z) ((struct inflate_workspace *)(z->workspace))
-
-#endif
diff --git a/fs/inflate_fs/zutil.h b/fs/inflate_fs/zutil.h
deleted file mode 100644
index fec7eb8c3481..000000000000
--- a/fs/inflate_fs/zutil.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* zutil.h -- internal interface and configuration of the compression library
- * Copyright (C) 1995-1998 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* @(#) $Id: zutil.h,v 1.1 2000/01/01 03:32:23 davem Exp $ */
-
-#ifndef _Z_UTIL_H
-#define _Z_UTIL_H
-
-#include <linux/zlib_fs.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-
-#ifndef local
-# define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-typedef unsigned char uch;
-typedef uch FAR uchf;
-typedef unsigned short ush;
-typedef ush FAR ushf;
-typedef unsigned long ulg;
-
- /* common constants */
-
-#ifndef DEF_WBITS
-# define DEF_WBITS MAX_WBITS
-#endif
-/* default windowBits for decompression. MAX_WBITS is for compression only */
-
-#if MAX_MEM_LEVEL >= 8
-# define DEF_MEM_LEVEL 8
-#else
-# define DEF_MEM_LEVEL MAX_MEM_LEVEL
-#endif
-/* default memLevel */
-
-#define STORED_BLOCK 0
-#define STATIC_TREES 1
-#define DYN_TREES 2
-/* The three kinds of block type */
-
-#define MIN_MATCH 3
-#define MAX_MATCH 258
-/* The minimum and maximum match lengths */
-
-#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
-
- /* target dependencies */
-
- /* Common defaults */
-
-#ifndef OS_CODE
-# define OS_CODE 0x03 /* assume Unix */
-#endif
-
- /* functions */
-
-typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
- uInt len));
-
-#endif /* _Z_UTIL_H */
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c
index b0b6414c7c65..62650e9a2bd3 100644
--- a/fs/isofs/compress.c
+++ b/fs/isofs/compress.c
@@ -36,7 +36,7 @@
#include <linux/smp_lock.h>
#include <linux/blkdev.h>
#include <linux/vmalloc.h>
-#include <linux/zlib_fs.h>
+#include <linux/zlib.h>
#include <asm/system.h>
#include <asm/uaccess.h>
@@ -209,7 +209,7 @@ static int zisofs_readpage(struct file *file, struct page *page)
stream.workspace = zisofs_zlib_workspace;
down(&zisofs_zlib_semaphore);
- zerr = zlib_fs_inflateInit(&stream);
+ zerr = zlib_inflateInit(&stream);
if ( zerr != Z_OK ) {
if ( err && zerr == Z_MEM_ERROR )
err = -ENOMEM;
@@ -250,7 +250,7 @@ static int zisofs_readpage(struct file *file, struct page *page)
}
}
ao = stream.avail_out; ai = stream.avail_in;
- zerr = zlib_fs_inflate(&stream, Z_SYNC_FLUSH);
+ zerr = zlib_inflate(&stream, Z_SYNC_FLUSH);
left_out = stream.avail_out;
if ( zerr == Z_BUF_ERROR && stream.avail_in == 0 )
continue;
@@ -291,7 +291,7 @@ static int zisofs_readpage(struct file *file, struct page *page)
fpage++;
}
}
- zlib_fs_inflateEnd(&stream);
+ zlib_inflateEnd(&stream);
z_eio:
up(&zisofs_zlib_semaphore);
@@ -339,7 +339,7 @@ int __init zisofs_init(void)
return 0;
}
- zisofs_zlib_workspace = vmalloc(zlib_fs_inflate_workspacesize());
+ zisofs_zlib_workspace = vmalloc(zlib_inflate_workspacesize());
if ( !zisofs_zlib_workspace )
return -ENOMEM;
init_MUTEX(&zisofs_zlib_semaphore);
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index 583ade0421c0..bef27095249e 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -110,14 +110,13 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
struct buffer_head *bh = NULL;
int len;
int map;
- int high_sierra;
int first_de = 1;
char *p = NULL; /* Quiet GCC */
struct iso_directory_record *de;
+ struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb);
offset = filp->f_pos & (bufsize - 1);
block = filp->f_pos >> bufbits;
- high_sierra = inode->i_sb->u.isofs_sb.s_high_sierra;
while (filp->f_pos < inode->i_size) {
int de_len;
@@ -166,7 +165,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
de = tmpde;
}
- if (de->flags[-high_sierra] & 0x80) {
+ if (de->flags[-sbi->s_high_sierra] & 0x80) {
first_de = 0;
filp->f_pos += de_len;
continue;
@@ -194,16 +193,16 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
/* Handle everything else. Do name translation if there
is no Rock Ridge NM field. */
- if (inode->i_sb->u.isofs_sb.s_unhide == 'n') {
+ if (sbi->s_unhide == 'n') {
/* Do not report hidden or associated files */
- if (de->flags[-high_sierra] & 5) {
+ if (de->flags[-sbi->s_high_sierra] & 5) {
filp->f_pos += de_len;
continue;
}
}
map = 1;
- if (inode->i_sb->u.isofs_sb.s_rock) {
+ if (sbi->s_rock) {
len = get_rock_ridge_filename(de, tmpname, inode);
if (len != 0) { /* may be -1 */
p = tmpname;
@@ -212,16 +211,16 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp,
}
if (map) {
#ifdef CONFIG_JOLIET
- if (inode->i_sb->u.isofs_sb.s_joliet_level) {
+ if (sbi->s_joliet_level) {
len = get_joliet_filename(de, tmpname, inode);
p = tmpname;
} else
#endif
- if (inode->i_sb->u.isofs_sb.s_mapping == 'a') {
+ if (sbi->s_mapping == 'a') {
len = get_acorn_filename(de, tmpname, inode);
p = tmpname;
} else
- if (inode->i_sb->u.isofs_sb.s_mapping == 'n') {
+ if (sbi->s_mapping == 'n') {
len = isofs_name_translate(de, tmpname, inode);
p = tmpname;
} else {
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index d1bec1eae0a0..31174ae2bede 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -60,10 +60,11 @@ static int isofs_dentry_cmp_ms(struct dentry *dentry, struct qstr *a, struct qst
static void isofs_put_super(struct super_block *sb)
{
+ struct isofs_sb_info *sbi = ISOFS_SB(sb);
#ifdef CONFIG_JOLIET
- if (sb->u.isofs_sb.s_nls_iocharset) {
- unload_nls(sb->u.isofs_sb.s_nls_iocharset);
- sb->u.isofs_sb.s_nls_iocharset = NULL;
+ if (sbi->s_nls_iocharset) {
+ unload_nls(sbi->s_nls_iocharset);
+ sbi->s_nls_iocharset = NULL;
}
#endif
@@ -72,6 +73,8 @@ static void isofs_put_super(struct super_block *sb)
check_malloc, check_bread);
#endif
+ kfree(sbi);
+ sb->u.generic_sbp = NULL;
return;
}
@@ -518,7 +521,6 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
struct iso_supplementary_descriptor *sec = NULL;
struct iso_directory_record * rootp;
int joliet_level = 0;
- int high_sierra;
int iso_blknum, block;
int orig_zonesize;
int table;
@@ -526,9 +528,16 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
unsigned long first_data_zone;
struct inode * inode;
struct iso9660_options opt;
+ struct isofs_sb_info * sbi;
+
+ sbi = kmalloc(sizeof(struct isofs_sb_info), GFP_KERNEL);
+ if (!sbi)
+ return -ENOMEM;
+ s->u.generic_sbp = sbi;
+ memset(sbi, 0, sizeof(struct isofs_sb_info));
if (!parse_options((char *) data, &opt))
- goto out_unlock;
+ goto out_freesbi;
#if 0
printk("map = %c\n", opt.map);
@@ -554,7 +563,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
*/
opt.blocksize = sb_min_blocksize(s, opt.blocksize);
- s->u.isofs_sb.s_high_sierra = high_sierra = 0; /* default is iso9660 */
+ sbi->s_high_sierra = 0; /* default is iso9660 */
vol_desc_start = (opt.sbsector != -1) ?
opt.sbsector : isofs_get_last_session(s,opt.session);
@@ -614,8 +623,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
if (isonum_711 (hdp->type) != ISO_VD_PRIMARY)
goto out_freebh;
- s->u.isofs_sb.s_high_sierra = 1;
- high_sierra = 1;
+ sbi->s_high_sierra = 1;
opt.rock = 'n';
h_pri = (struct hs_primary_descriptor *)vdp;
goto root_found;
@@ -646,29 +654,29 @@ root_found:
pri = (struct iso_primary_descriptor *) sec;
}
- if(high_sierra){
+ if(sbi->s_high_sierra){
rootp = (struct iso_directory_record *) h_pri->root_directory_record;
#ifndef IGNORE_WRONG_MULTI_VOLUME_SPECS
if (isonum_723 (h_pri->volume_set_size) != 1)
goto out_no_support;
#endif /* IGNORE_WRONG_MULTI_VOLUME_SPECS */
- s->u.isofs_sb.s_nzones = isonum_733 (h_pri->volume_space_size);
- s->u.isofs_sb.s_log_zone_size = isonum_723 (h_pri->logical_block_size);
- s->u.isofs_sb.s_max_size = isonum_733(h_pri->volume_space_size);
+ sbi->s_nzones = isonum_733 (h_pri->volume_space_size);
+ sbi->s_log_zone_size = isonum_723 (h_pri->logical_block_size);
+ sbi->s_max_size = isonum_733(h_pri->volume_space_size);
} else {
rootp = (struct iso_directory_record *) pri->root_directory_record;
#ifndef IGNORE_WRONG_MULTI_VOLUME_SPECS
if (isonum_723 (pri->volume_set_size) != 1)
goto out_no_support;
#endif /* IGNORE_WRONG_MULTI_VOLUME_SPECS */
- s->u.isofs_sb.s_nzones = isonum_733 (pri->volume_space_size);
- s->u.isofs_sb.s_log_zone_size = isonum_723 (pri->logical_block_size);
- s->u.isofs_sb.s_max_size = isonum_733(pri->volume_space_size);
+ sbi->s_nzones = isonum_733 (pri->volume_space_size);
+ sbi->s_log_zone_size = isonum_723 (pri->logical_block_size);
+ sbi->s_max_size = isonum_733(pri->volume_space_size);
}
- s->u.isofs_sb.s_ninodes = 0; /* No way to figure this out easily */
+ sbi->s_ninodes = 0; /* No way to figure this out easily */
- orig_zonesize = s -> u.isofs_sb.s_log_zone_size;
+ orig_zonesize = sbi->s_log_zone_size;
/*
* If the zone size is smaller than the hardware sector size,
* this is a fatal error. This would occur if the disc drive
@@ -680,10 +688,10 @@ root_found:
goto out_bad_size;
/* RDE: convert log zone size to bit shift */
- switch (s -> u.isofs_sb.s_log_zone_size)
- { case 512: s -> u.isofs_sb.s_log_zone_size = 9; break;
- case 1024: s -> u.isofs_sb.s_log_zone_size = 10; break;
- case 2048: s -> u.isofs_sb.s_log_zone_size = 11; break;
+ switch (sbi->s_log_zone_size)
+ { case 512: sbi->s_log_zone_size = 9; break;
+ case 1024: sbi->s_log_zone_size = 10; break;
+ case 2048: sbi->s_log_zone_size = 11; break;
default:
goto out_bad_zone_size;
@@ -705,16 +713,16 @@ root_found:
first_data_zone = ((isonum_733 (rootp->extent) +
isonum_711 (rootp->ext_attr_length))
- << s -> u.isofs_sb.s_log_zone_size);
- s->u.isofs_sb.s_firstdatazone = first_data_zone;
+ << sbi->s_log_zone_size);
+ sbi->s_firstdatazone = first_data_zone;
#ifndef BEQUIET
printk(KERN_DEBUG "Max size:%ld Log zone size:%ld\n",
- s->u.isofs_sb.s_max_size,
- 1UL << s->u.isofs_sb.s_log_zone_size);
+ sbi->s_max_size,
+ 1UL << sbi->s_log_zone_size);
printk(KERN_DEBUG "First datazone:%ld Root inode number:%ld\n",
- s->u.isofs_sb.s_firstdatazone >> s -> u.isofs_sb.s_log_zone_size,
- s->u.isofs_sb.s_firstdatazone);
- if(high_sierra)
+ sbi->s_firstdatazone >> sbi->s_log_zone_size,
+ sbi->s_firstdatazone);
+ if(sbi->s_high_sierra)
printk(KERN_DEBUG "Disc in High Sierra format.\n");
#endif
@@ -732,7 +740,7 @@ root_found:
pri->root_directory_record;
first_data_zone = ((isonum_733 (rootp->extent) +
isonum_711 (rootp->ext_attr_length))
- << s -> u.isofs_sb.s_log_zone_size);
+ << sbi->s_log_zone_size);
}
/*
@@ -761,43 +769,43 @@ root_found:
*/
sb_set_blocksize(s, orig_zonesize);
- s->u.isofs_sb.s_nls_iocharset = NULL;
+ sbi->s_nls_iocharset = NULL;
#ifdef CONFIG_JOLIET
if (joliet_level && opt.utf8 == 0) {
char * p = opt.iocharset ? opt.iocharset : "iso8859-1";
- s->u.isofs_sb.s_nls_iocharset = load_nls(p);
- if (! s->u.isofs_sb.s_nls_iocharset) {
+ sbi->s_nls_iocharset = load_nls(p);
+ if (! sbi->s_nls_iocharset) {
/* Fail only if explicit charset specified */
if (opt.iocharset)
- goto out_unlock;
- s->u.isofs_sb.s_nls_iocharset = load_nls_default();
+ goto out_freesbi;
+ sbi->s_nls_iocharset = load_nls_default();
}
}
#endif
s->s_op = &isofs_sops;
- s->u.isofs_sb.s_mapping = opt.map;
- s->u.isofs_sb.s_rock = (opt.rock == 'y' ? 2 : 0);
- s->u.isofs_sb.s_rock_offset = -1; /* initial offset, will guess until SP is found*/
- s->u.isofs_sb.s_cruft = opt.cruft;
- s->u.isofs_sb.s_unhide = opt.unhide;
- s->u.isofs_sb.s_uid = opt.uid;
- s->u.isofs_sb.s_gid = opt.gid;
- s->u.isofs_sb.s_utf8 = opt.utf8;
- s->u.isofs_sb.s_nocompress = opt.nocompress;
+ sbi->s_mapping = opt.map;
+ sbi->s_rock = (opt.rock == 'y' ? 2 : 0);
+ sbi->s_rock_offset = -1; /* initial offset, will guess until SP is found*/
+ sbi->s_cruft = opt.cruft;
+ sbi->s_unhide = opt.unhide;
+ sbi->s_uid = opt.uid;
+ sbi->s_gid = opt.gid;
+ sbi->s_utf8 = opt.utf8;
+ sbi->s_nocompress = opt.nocompress;
/*
* It would be incredibly stupid to allow people to mark every file
* on the disk as suid, so we merely allow them to set the default
* permissions.
*/
- s->u.isofs_sb.s_mode = opt.mode & 0777;
+ sbi->s_mode = opt.mode & 0777;
/*
* Read the root inode, which _may_ result in changing
* the s_rock flag. Once we have the final s_rock value,
* we then decide whether to use the Joliet descriptor.
*/
- inode = iget(s, s->u.isofs_sb.s_firstdatazone);
+ inode = iget(s, sbi->s_firstdatazone);
/*
* If this disk has both Rock Ridge and Joliet on it, then we
@@ -807,16 +815,16 @@ root_found:
* CD with Unicode names. Until someone sees such a beast, it
* will not be supported.
*/
- if (s->u.isofs_sb.s_rock == 1) {
+ if (sbi->s_rock == 1) {
joliet_level = 0;
} else if (joliet_level) {
- s->u.isofs_sb.s_rock = 0;
- if (s->u.isofs_sb.s_firstdatazone != first_data_zone) {
- s->u.isofs_sb.s_firstdatazone = first_data_zone;
+ sbi->s_rock = 0;
+ if (sbi->s_firstdatazone != first_data_zone) {
+ sbi->s_firstdatazone = first_data_zone;
printk(KERN_DEBUG
"ISOFS: changing to secondary root\n");
iput(inode);
- inode = iget(s, s->u.isofs_sb.s_firstdatazone);
+ inode = iget(s, sbi->s_firstdatazone);
}
}
@@ -825,7 +833,7 @@ root_found:
if (joliet_level) opt.check = 'r';
else opt.check = 's';
}
- s->u.isofs_sb.s_joliet_level = joliet_level;
+ sbi->s_joliet_level = joliet_level;
/* check the root inode */
if (!inode)
@@ -855,18 +863,18 @@ out_no_root:
out_iput:
iput(inode);
#ifdef CONFIG_JOLIET
- if (s->u.isofs_sb.s_nls_iocharset)
- unload_nls(s->u.isofs_sb.s_nls_iocharset);
+ if (sbi->s_nls_iocharset)
+ unload_nls(sbi->s_nls_iocharset);
#endif
- goto out_unlock;
+ goto out_freesbi;
out_no_read:
printk(KERN_WARNING "isofs_fill_super: "
"bread failed, dev=%s, iso_blknum=%d, block=%d\n",
s->s_id, iso_blknum, block);
- goto out_unlock;
+ goto out_freesbi;
out_bad_zone_size:
printk(KERN_WARNING "Bad logical zone size %ld\n",
- s->u.isofs_sb.s_log_zone_size);
+ sbi->s_log_zone_size);
goto out_freebh;
out_bad_size:
printk(KERN_WARNING "Logical zone size(%d) < hardware blocksize(%u)\n",
@@ -883,7 +891,9 @@ out_unknown_format:
out_freebh:
brelse(bh);
-out_unlock:
+out_freesbi:
+ kfree(sbi);
+ s->u.generic_sbp = NULL;
return -EINVAL;
}
@@ -891,11 +901,11 @@ static int isofs_statfs (struct super_block *sb, struct statfs *buf)
{
buf->f_type = ISOFS_SUPER_MAGIC;
buf->f_bsize = sb->s_blocksize;
- buf->f_blocks = (sb->u.isofs_sb.s_nzones
- << (sb->u.isofs_sb.s_log_zone_size - sb->s_blocksize_bits));
+ buf->f_blocks = (ISOFS_SB(sb)->s_nzones
+ << (ISOFS_SB(sb)->s_log_zone_size - sb->s_blocksize_bits));
buf->f_bfree = 0;
buf->f_bavail = 0;
- buf->f_files = sb->u.isofs_sb.s_ninodes;
+ buf->f_files = ISOFS_SB(sb)->s_ninodes;
buf->f_ffree = 0;
buf->f_namelen = NAME_MAX;
return 0;
@@ -1058,7 +1068,7 @@ static int isofs_read_level3_size(struct inode * inode)
{
unsigned long f_pos = inode->i_ino;
unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
- int high_sierra = inode->i_sb->u.isofs_sb.s_high_sierra;
+ int high_sierra = ISOFS_SB(inode->i_sb)->s_high_sierra;
struct buffer_head * bh = NULL;
unsigned long block, offset;
int i = 0;
@@ -1157,9 +1167,10 @@ out_toomany:
static void isofs_read_inode(struct inode * inode)
{
struct super_block *sb = inode->i_sb;
+ struct isofs_sb_info *sbi = ISOFS_SB(sb);
unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
int block = inode->i_ino >> ISOFS_BUFFER_BITS(inode);
- int high_sierra = sb->u.isofs_sb.s_high_sierra;
+ int high_sierra = sbi->s_high_sierra;
struct buffer_head * bh = NULL;
struct iso_directory_record * de;
struct iso_directory_record * tmpde = NULL;
@@ -1205,7 +1216,7 @@ static void isofs_read_inode(struct inode * inode)
do it the hard way. */
} else {
/* Everybody gets to read the file. */
- inode->i_mode = inode->i_sb->u.isofs_sb.s_mode;
+ inode->i_mode = sbi->s_mode;
inode->i_nlink = 1;
inode->i_mode |= S_IFREG;
/* If there are no periods in the name,
@@ -1217,8 +1228,8 @@ static void isofs_read_inode(struct inode * inode)
if(i == de->name_len[0] || de->name[i] == ';')
inode->i_mode |= S_IXUGO; /* execute permission */
}
- inode->i_uid = inode->i_sb->u.isofs_sb.s_uid;
- inode->i_gid = inode->i_sb->u.isofs_sb.s_gid;
+ inode->i_uid = sbi->s_uid;
+ inode->i_gid = sbi->s_gid;
inode->i_blocks = inode->i_blksize = 0;
ei->i_format_parm[0] = 0;
@@ -1241,10 +1252,10 @@ static void isofs_read_inode(struct inode * inode)
* legal. Do not prevent to use DVD's schilling@fokus.gmd.de
*/
if ((inode->i_size < 0 || inode->i_size > 0x7FFFFFFE) &&
- inode->i_sb->u.isofs_sb.s_cruft == 'n') {
+ sbi->s_cruft == 'n') {
printk(KERN_WARNING "Warning: defective CD-ROM. "
"Enabling \"cruft\" mount option.\n");
- inode->i_sb->u.isofs_sb.s_cruft = 'y';
+ sbi->s_cruft = 'y';
}
/*
@@ -1254,7 +1265,7 @@ static void isofs_read_inode(struct inode * inode)
* on the CDROM.
*/
- if (inode->i_sb->u.isofs_sb.s_cruft == 'y' &&
+ if (sbi->s_cruft == 'y' &&
inode->i_size & 0xff000000) {
inode->i_size &= 0x00ffffff;
}
@@ -1298,8 +1309,8 @@ static void isofs_read_inode(struct inode * inode)
if (!high_sierra) {
parse_rock_ridge_inode(de, inode);
/* if we want uid/gid set, override the rock ridge setting */
- test_and_set_uid(&inode->i_uid, inode->i_sb->u.isofs_sb.s_uid);
- test_and_set_gid(&inode->i_gid, inode->i_sb->u.isofs_sb.s_gid);
+ test_and_set_uid(&inode->i_uid, sbi->s_uid);
+ test_and_set_gid(&inode->i_gid, sbi->s_gid);
}
/* get the volume sequence number */
@@ -1311,17 +1322,17 @@ static void isofs_read_inode(struct inode * inode)
* of which is limiting the file size to 16Mb. Thus we silently allow
* volume numbers of 0 to go through without complaining.
*/
- if (inode->i_sb->u.isofs_sb.s_cruft == 'n' &&
+ if (sbi->s_cruft == 'n' &&
(volume_seq_no != 0) && (volume_seq_no != 1)) {
printk(KERN_WARNING "Warning: defective CD-ROM "
"(volume sequence number %d). "
"Enabling \"cruft\" mount option.\n", volume_seq_no);
- inode->i_sb->u.isofs_sb.s_cruft = 'y';
+ sbi->s_cruft = 'y';
}
/* Install the inode operations vector */
#ifndef IGNORE_WRONG_MULTI_VOLUME_SPECS
- if (inode->i_sb->u.isofs_sb.s_cruft != 'y' &&
+ if (sbi->s_cruft != 'y' &&
(volume_seq_no != 0) && (volume_seq_no != 1)) {
printk(KERN_WARNING "Multi-volume CD somehow got mounted.\n");
} else
diff --git a/fs/isofs/joliet.c b/fs/isofs/joliet.c
index 15d2370bda3f..86c50e22fc87 100644
--- a/fs/isofs/joliet.c
+++ b/fs/isofs/joliet.c
@@ -77,8 +77,8 @@ get_joliet_filename(struct iso_directory_record * de, unsigned char *outname, st
struct nls_table *nls;
unsigned char len = 0;
- utf8 = inode->i_sb->u.isofs_sb.s_utf8;
- nls = inode->i_sb->u.isofs_sb.s_nls_iocharset;
+ utf8 = ISOFS_SB(inode->i_sb)->s_utf8;
+ nls = ISOFS_SB(inode->i_sb)->s_nls_iocharset;
if (utf8) {
len = wcsntombs_be(outname, de->name,
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index 485bb7023fe2..cbdf44b0164e 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -65,6 +65,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
unsigned char bufbits = ISOFS_BUFFER_BITS(dir);
unsigned int block, f_pos, offset;
struct buffer_head * bh = NULL;
+ struct isofs_sb_info *sbi = ISOFS_SB(dir->i_sb);
if (!ISOFS_I(dir)->i_first_extent)
return 0;
@@ -120,19 +121,19 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
dlen = de->name_len[0];
dpnt = de->name;
- if (dir->i_sb->u.isofs_sb.s_rock &&
+ if (sbi->s_rock &&
((i = get_rock_ridge_filename(de, tmpname, dir)))) {
dlen = i; /* possibly -1 */
dpnt = tmpname;
#ifdef CONFIG_JOLIET
- } else if (dir->i_sb->u.isofs_sb.s_joliet_level) {
+ } else if (sbi->s_joliet_level) {
dlen = get_joliet_filename(de, tmpname, dir);
dpnt = tmpname;
#endif
- } else if (dir->i_sb->u.isofs_sb.s_mapping == 'a') {
+ } else if (sbi->s_mapping == 'a') {
dlen = get_acorn_filename(de, tmpname, dir);
dpnt = tmpname;
- } else if (dir->i_sb->u.isofs_sb.s_mapping == 'n') {
+ } else if (sbi->s_mapping == 'n') {
dlen = isofs_name_translate(de, tmpname, dir);
dpnt = tmpname;
}
@@ -142,8 +143,8 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
*/
match = 0;
if (dlen > 0 &&
- (!(de->flags[-dir->i_sb->u.isofs_sb.s_high_sierra] & 5)
- || dir->i_sb->u.isofs_sb.s_unhide == 'y'))
+ (!(de->flags[-sbi->s_high_sierra] & 5)
+ || sbi->s_unhide == 'y'))
{
match = (isofs_cmp(dentry,dpnt,dlen) == 0);
}
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 5065d2fdccc6..17b2bb5e6908 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -32,7 +32,7 @@
#define CHECK_SP(FAIL) \
if(rr->u.SP.magic[0] != 0xbe) FAIL; \
if(rr->u.SP.magic[1] != 0xef) FAIL; \
- inode->i_sb->u.isofs_sb.s_rock_offset=rr->u.SP.skip;
+ ISOFS_SB(inode->i_sb)->s_rock_offset=rr->u.SP.skip;
/* We define a series of macros because each function must do exactly the
same thing in certain places. We use the macros to ensure that everything
is done correctly */
@@ -51,10 +51,10 @@
if(LEN & 1) LEN++; \
CHR = ((unsigned char *) DE) + LEN; \
LEN = *((unsigned char *) DE) - LEN; \
- if (inode->i_sb->u.isofs_sb.s_rock_offset!=-1) \
+ if (ISOFS_SB(inode->i_sb)->s_rock_offset!=-1) \
{ \
- LEN-=inode->i_sb->u.isofs_sb.s_rock_offset; \
- CHR+=inode->i_sb->u.isofs_sb.s_rock_offset; \
+ LEN-=ISOFS_SB(inode->i_sb)->s_rock_offset; \
+ CHR+=ISOFS_SB(inode->i_sb)->s_rock_offset; \
if (LEN<0) LEN=0; \
} \
}
@@ -102,7 +102,7 @@ int find_rock_ridge_relocation(struct iso_directory_record * de,
/* Return value if we do not find appropriate record. */
retval = isonum_733 (de->extent);
- if (!inode->i_sb->u.isofs_sb.s_rock) return retval;
+ if (!ISOFS_SB(inode->i_sb)->s_rock) return retval;
SETUP_ROCK_RIDGE(de, chr, len);
repeat:
@@ -162,7 +162,7 @@ int get_rock_ridge_filename(struct iso_directory_record * de,
CONTINUE_DECLS;
int retnamlen = 0, truncate=0;
- if (!inode->i_sb->u.isofs_sb.s_rock) return 0;
+ if (!ISOFS_SB(inode->i_sb)->s_rock) return 0;
*retname = 0;
SETUP_ROCK_RIDGE(de, chr, len);
@@ -234,7 +234,7 @@ int parse_rock_ridge_inode_internal(struct iso_directory_record * de,
int symlink_len = 0;
CONTINUE_DECLS;
- if (!inode->i_sb->u.isofs_sb.s_rock) return 0;
+ if (!ISOFS_SB(inode->i_sb)->s_rock) return 0;
SETUP_ROCK_RIDGE(de, chr, len);
if (regard_xa)
@@ -272,7 +272,7 @@ int parse_rock_ridge_inode_internal(struct iso_directory_record * de,
CHECK_CE;
break;
case SIG('E','R'):
- inode->i_sb->u.isofs_sb.s_rock = 1;
+ ISOFS_SB(inode->i_sb)->s_rock = 1;
printk(KERN_DEBUG "ISO 9660 Extensions: ");
{ int p;
for(p=0;p<rr->u.ER.len_id;p++) printk("%c",rr->u.ER.data[p]);
@@ -368,7 +368,7 @@ int parse_rock_ridge_inode_internal(struct iso_directory_record * de,
ISOFS_I(inode)->i_first_extent = isonum_733(rr->u.CL.location);
reloc = iget(inode->i_sb,
(ISOFS_I(inode)->i_first_extent <<
- inode -> i_sb -> u.isofs_sb.s_log_zone_size));
+ ISOFS_SB(inode->i_sb)->s_log_zone_size));
if (!reloc)
goto out;
inode->i_mode = reloc->i_mode;
@@ -385,7 +385,7 @@ int parse_rock_ridge_inode_internal(struct iso_directory_record * de,
break;
#ifdef CONFIG_ZISOFS
case SIG('Z','F'):
- if ( !inode->i_sb->u.isofs_sb.s_nocompress ) {
+ if ( !ISOFS_SB(inode->i_sb)->s_nocompress ) {
int algo;
algo = isonum_721(rr->u.ZF.algorithm);
if ( algo == SIG('p','z') ) {
@@ -478,8 +478,8 @@ int parse_rock_ridge_inode(struct iso_directory_record * de,
int result=parse_rock_ridge_inode_internal(de,inode,0);
/* if rockridge flag was reset and we didn't look for attributes
* behind eventual XA attributes, have a look there */
- if ((inode->i_sb->u.isofs_sb.s_rock_offset==-1)
- &&(inode->i_sb->u.isofs_sb.s_rock==2))
+ if ((ISOFS_SB(inode->i_sb)->s_rock_offset==-1)
+ &&(ISOFS_SB(inode->i_sb)->s_rock==2))
{
result=parse_rock_ridge_inode_internal(de,inode,14);
};
@@ -506,7 +506,7 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page)
unsigned char *chr;
struct rock_ridge *rr;
- if (!inode->i_sb->u.isofs_sb.s_rock)
+ if (!ISOFS_SB(inode->i_sb)->s_rock)
panic ("Cannot have symlink with high sierra variant of iso filesystem\n");
block = inode->i_ino >> bufbits;
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index 4b3fae61ff08..cad48eb13278 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -31,7 +31,7 @@
* provisions above, a recipient may use your version of this file
* under either the RHEPL or the GPL.
*
- * $Id: os-linux.h,v 1.15 2002/03/08 11:31:48 dwmw2 Exp $
+ * $Id: os-linux.h,v 1.16 2002/03/17 10:18:42 dwmw2 Exp $
*
*/
@@ -42,8 +42,8 @@
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,2)
#define JFFS2_INODE_INFO(i) (list_entry(i, struct jffs2_inode_info, vfs_inode))
#define OFNI_EDONI_2SFFJ(f) (&(f)->vfs_inode)
-#define JFFS2_SB_INFO(sb) (&sb->u.jffs2_sb)
-#define OFNI_BS_2SFFJ(c) ((struct super_block *) ( ((char *)c) - ((char *)(&((struct super_block *)NULL)->u)) ) )
+#define JFFS2_SB_INFO(sb) (sb->u.generic_sbp)
+#define OFNI_BS_2SFFJ(c) ((struct super_block *)c->os_priv)
#elif defined(JFFS2_OUT_OF_KERNEL)
#define JFFS2_INODE_INFO(i) ((struct jffs2_inode_info *) &(i)->u)
#define OFNI_EDONI_2SFFJ(f) ((struct inode *) ( ((char *)f) - ((char *)(&((struct inode *)NULL)->u)) ) )
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 0603521256e5..48f0cf4b7283 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -31,7 +31,7 @@
* provisions above, a recipient may use your version of this file
* under either the RHEPL or the GPL.
*
- * $Id: super.c,v 1.62 2002/03/12 16:23:41 dwmw2 Exp $
+ * $Id: super.c,v 1.64 2002/03/17 10:18:42 dwmw2 Exp $
*
*/
@@ -47,6 +47,7 @@
#include <linux/pagemap.h>
#include <linux/mtd/mtd.h>
#include <linux/interrupt.h>
+#include <linux/ctype.h>
#include "nodelist.h"
void jffs2_put_super (struct super_block *);
@@ -91,46 +92,194 @@ static struct super_operations jffs2_super_operations =
clear_inode: jffs2_clear_inode
};
+static int jffs2_sb_compare(struct super_block *sb, void *data)
+{
+ struct mtd_info *mtd = data;
+ struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
+
+ /* The superblocks are considered to be equivalent if the underlying MTD
+ device is the same one */
+ if (c->mtd == mtd) {
+ D1(printk(KERN_DEBUG "jffs2_sb_compare: match on device %d (\"%s\")\n", mtd->index, mtd->name));
+ return 1;
+ } else {
+ D1(printk(KERN_DEBUG "jffs2_sb_compare: No match, device %d (\"%s\"), device %d (\"%s\")\n",
+ c->mtd->index, c->mtd->name, mtd->index, mtd->name));
+ return 0;
+ }
+}
-static int jffs2_blk_fill_super(struct super_block *sb, void *data, int silent)
+static int jffs2_sb_set(struct super_block *sb, void *data)
{
+ struct mtd_info *mtd = data;
+
+ /* For persistence of NFS exports etc. we use the same s_dev
+ each time we mount the device, don't just use an anonymous
+ device */
+ sb->s_dev = mk_kdev(MTD_BLOCK_MAJOR, mtd->index);
+
+ return 0;
+}
+
+static struct super_block *jffs2_get_sb_mtd(struct file_system_type *fs_type,
+ int flags, char *dev_name,
+ void *data, struct mtd_info *mtd)
+{
+ struct super_block *sb;
struct jffs2_sb_info *c;
int ret;
- D1(printk(KERN_DEBUG "jffs2: blk_read_super for device %s\n", sb->s_id));
+ sb = sget(fs_type, jffs2_sb_compare, jffs2_sb_set, mtd);
- if (major(sb->s_dev) != MTD_BLOCK_MAJOR) {
- if (!silent)
- printk(KERN_NOTICE "jffs2: attempt to mount non-MTD device %s\n",
- sb->s_id);
- return -EINVAL;
+ if (IS_ERR(sb))
+ goto out_put;
+
+ if (sb->s_root) {
+ /* New mountpoint for JFFS2 which is already mounted */
+ D1(printk(KERN_DEBUG "jffs2_get_sb_mtd(): Device %d (\"%s\") is already mounted\n",
+ mtd->index, mtd->name));
+ goto out_put;
}
- c = JFFS2_SB_INFO(sb);
- memset(c, 0, sizeof(*c));
-
+ D1(printk(KERN_DEBUG "jffs2_get_sb_mtd(): New superblock for device %d (\"%s\")\n",
+ mtd->index, mtd->name));
+
+ c = kmalloc(sizeof(*c), GFP_KERNEL);
+ if (!c) {
+ sb = ERR_PTR(-ENOMEM);
+ goto out_put;
+ }
+
+ sb->u.generic_sbp = c;
sb->s_op = &jffs2_super_operations;
- c->mtd = get_mtd_device(NULL, minor(sb->s_dev));
- if (!c->mtd) {
- D1(printk(KERN_DEBUG "jffs2: MTD device #%u doesn't appear to exist\n", minor(sb->s_dev)));
- return -EINVAL;
+ memset(c, 0, sizeof(*c));
+ c->os_priv = sb;
+ c->mtd = mtd;
+
+ ret = jffs2_do_fill_super(sb, data, (flags&MS_VERBOSE)?1:0);
+
+ if (ret) {
+ /* Failure case... */
+ up_write(&sb->s_umount);
+ deactivate_super(sb);
+ sb = ERR_PTR(ret);
+ goto out_put;
}
- ret = jffs2_do_fill_super(sb, data, silent);
- if (ret)
- put_mtd_device(c->mtd);
+ sb->s_flags |= MS_ACTIVE;
+ return sb;
- return ret;
+ out_put:
+ put_mtd_device(mtd);
+
+ return sb;
}
+static struct super_block *jffs2_get_sb_mtdnr(struct file_system_type *fs_type,
+ int flags, char *dev_name,
+ void *data, int mtdnr)
+{
+ struct mtd_info *mtd;
+
+ mtd = get_mtd_device(NULL, mtdnr);
+ if (!mtd) {
+ D1(printk(KERN_DEBUG "jffs2: MTD device #%u doesn't appear to exist\n", mtdnr));
+ return ERR_PTR(-EINVAL);
+ }
+
+ return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd);
+}
+
+static struct super_block *jffs2_get_sb(struct file_system_type *fs_type,
+ int flags, char *dev_name, void *data)
+{
+ int err;
+ struct nameidata nd;
+ int mtdnr;
+ kdev_t dev;
+
+ if (!dev_name)
+ return ERR_PTR(-EINVAL);
+
+ D1(printk(KERN_DEBUG "jffs2_get_sb(): dev_name \"%s\"\n", dev_name));
+
+ /* The preferred way of mounting in future; especially when
+ CONFIG_BLK_DEV is implemented - we specify the underlying
+ MTD device by number or by name, so that we don't require
+ block device support to be present in the kernel. */
+
+ /* FIXME: How to do the root fs this way? */
+
+ if (dev_name[0] == 'm' && dev_name[1] == 't' && dev_name[2] == 'd') {
+ /* Probably mounting without the blkdev crap */
+ if (dev_name[3] == ':') {
+ struct mtd_info *mtd;
+
+ /* Mount by MTD device name */
+ D1(printk(KERN_DEBUG "jffs2_get_sb(): mtd:%%s, name \"%s\"\n", dev_name+4));
+ for (mtdnr = 0; mtdnr < MAX_MTD_DEVICES; mtdnr++) {
+ mtd = get_mtd_device(NULL, mtdnr);
+ if (mtd) {
+ if (!strcmp(mtd->name, dev_name+4))
+ return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd);
+ put_mtd_device(mtd);
+ }
+ }
+ printk(KERN_NOTICE "jffs2_get_sb(): MTD device with name \"%s\" not found.\n", dev_name+4);
+ } else if (isdigit(dev_name[3])) {
+ /* Mount by MTD device number name */
+ char *endptr;
+
+ mtdnr = simple_strtoul(dev_name+3, &endptr, 0);
+ if (!*endptr) {
+ /* It was a valid number */
+ D1(printk(KERN_DEBUG "jffs2_get_sb(): mtd%%d, mtdnr %d\n", mtdnr));
+ return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr);
+ }
+ }
+ }
+
+ /* Try the old way - the hack where we allowed users to mount
+ /dev/mtdblock$(n) but didn't actually _use_ the blkdev */
+
+ err = path_lookup(dev_name, LOOKUP_FOLLOW, &nd);
+
+ D1(printk(KERN_DEBUG "jffs2_get_sb(): path_lookup() returned %d, inode %p\n",
+ err, nd.dentry->d_inode));
+
+ if (err)
+ return ERR_PTR(err);
+
+ if (!S_ISBLK(nd.dentry->d_inode->i_mode)) {
+ path_release(&nd);
+ return ERR_PTR(-EINVAL);
+ }
+ if (nd.mnt->mnt_flags & MNT_NODEV) {
+ path_release(&nd);
+ return ERR_PTR(-EACCES);
+ }
+
+ dev = nd.dentry->d_inode->i_rdev;
+ path_release(&nd);
+
+ if (major(dev) != MTD_BLOCK_MAJOR) {
+ if (!(flags & MS_VERBOSE)) /* Yes I mean this. Strangely */
+ printk(KERN_NOTICE "Attempt to mount non-MTD device \"%s\" as JFFS2\n",
+ dev_name);
+ return ERR_PTR(-EINVAL);
+ }
+
+ return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, minor(dev));
+}
+
+
void jffs2_put_super (struct super_block *sb)
{
struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
D2(printk(KERN_DEBUG "jffs2: jffs2_put_super()\n"));
-
if (!(sb->s_flags & MS_RDONLY))
jffs2_stop_garbage_collect_thread(c);
jffs2_flush_wbuf(c, 1);
@@ -140,22 +289,17 @@ void jffs2_put_super (struct super_block *sb)
if (c->mtd->sync)
c->mtd->sync(c->mtd);
put_mtd_device(c->mtd);
-
- D1(printk(KERN_DEBUG "jffs2_put_super returning\n"));
-}
-static struct super_block *jffs2_get_sb(struct file_system_type *fs_type,
- int flags, char *dev_name, void *data)
-{
- return get_sb_bdev(fs_type, flags, dev_name, data, jffs2_blk_fill_super);
+ kfree(c);
+
+ D1(printk(KERN_DEBUG "jffs2_put_super returning\n"));
}
static struct file_system_type jffs2_fs_type = {
owner: THIS_MODULE,
name: "jffs2",
get_sb: jffs2_get_sb,
- kill_sb: kill_block_super,
- fs_flags: FS_REQUIRES_DEV,
+ kill_sb: generic_shutdown_super
};
diff --git a/fs/msdos/msdosfs_syms.c b/fs/msdos/msdosfs_syms.c
index 32676ff470fe..c821f820a967 100644
--- a/fs/msdos/msdosfs_syms.c
+++ b/fs/msdos/msdosfs_syms.c
@@ -23,7 +23,6 @@ EXPORT_SYMBOL(msdos_mkdir);
EXPORT_SYMBOL(msdos_rename);
EXPORT_SYMBOL(msdos_rmdir);
EXPORT_SYMBOL(msdos_unlink);
-EXPORT_SYMBOL(msdos_put_super);
static struct super_block *msdos_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
diff --git a/fs/msdos/namei.c b/fs/msdos/namei.c
index a61b26a8086f..c15445776017 100644
--- a/fs/msdos/namei.c
+++ b/fs/msdos/namei.c
@@ -6,8 +6,6 @@
* Rewritten for constant inumbers 1999 by Al Viro
*/
-
-#define __NO_VERSION__
#include <linux/module.h>
#include <linux/time.h>
@@ -23,8 +21,8 @@ static const char *reserved_names[] = {
"CON ","PRN ","NUL ","AUX ",
"LPT1 ","LPT2 ","LPT3 ","LPT4 ",
"COM1 ","COM2 ","COM3 ","COM4 ",
- NULL };
-
+ NULL
+};
/* Characters that are undesirable in an MS-DOS file name */
@@ -33,12 +31,6 @@ static char bad_if_strict_pc[] = "+=,; ";
static char bad_if_strict_atari[] = " "; /* GEMDOS is less restrictive */
#define bad_if_strict(opts) ((opts)->atari ? bad_if_strict_atari : bad_if_strict_pc)
-/* Must die */
-void msdos_put_super(struct super_block *sb)
-{
- fat_put_super(sb);
-}
-
/***** Formats an MS-DOS file name. Rejects invalid names. */
static int msdos_format_name(const char *name,int len,
char *res,struct fat_mount_options *opts)
diff --git a/fs/super.c b/fs/super.c
index 66a6274d1b71..1a2d66737e08 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -25,235 +25,16 @@
#include <linux/locks.h>
#include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.h>
-#include <linux/major.h>
#include <linux/acct.h>
-
#include <asm/uaccess.h>
-#include <linux/kmod.h>
-#define __NO_VERSION__
-#include <linux/module.h>
+void get_filesystem(struct file_system_type *fs);
+void put_filesystem(struct file_system_type *fs);
+struct file_system_type *get_fs_type(const char *name);
LIST_HEAD(super_blocks);
spinlock_t sb_lock = SPIN_LOCK_UNLOCKED;
-/*
- * Handling of filesystem drivers list.
- * Rules:
- * Inclusion to/removals from/scanning of list are protected by spinlock.
- * During the unload module must call unregister_filesystem().
- * We can access the fields of list element if:
- * 1) spinlock is held or
- * 2) we hold the reference to the module.
- * The latter can be guaranteed by call of try_inc_mod_count(); if it
- * returned 0 we must skip the element, otherwise we got the reference.
- * Once the reference is obtained we can drop the spinlock.
- */
-
-static struct file_system_type *file_systems;
-static rwlock_t file_systems_lock = RW_LOCK_UNLOCKED;
-
-/* WARNING: This can be used only if we _already_ own a reference */
-static void get_filesystem(struct file_system_type *fs)
-{
- if (fs->owner)
- __MOD_INC_USE_COUNT(fs->owner);
-}
-
-static void put_filesystem(struct file_system_type *fs)
-{
- if (fs->owner)
- __MOD_DEC_USE_COUNT(fs->owner);
-}
-
-static struct file_system_type **find_filesystem(const char *name)
-{
- struct file_system_type **p;
- for (p=&file_systems; *p; p=&(*p)->next)
- if (strcmp((*p)->name,name) == 0)
- break;
- return p;
-}
-
-/**
- * register_filesystem - register a new filesystem
- * @fs: the file system structure
- *
- * Adds the file system passed to the list of file systems the kernel
- * is aware of for mount and other syscalls. Returns 0 on success,
- * or a negative errno code on an error.
- *
- * The &struct file_system_type that is passed is linked into the kernel
- * structures and must not be freed until the file system has been
- * unregistered.
- */
-
-int register_filesystem(struct file_system_type * fs)
-{
- int res = 0;
- struct file_system_type ** p;
-
- if (!fs)
- return -EINVAL;
- if (fs->next)
- return -EBUSY;
- INIT_LIST_HEAD(&fs->fs_supers);
- write_lock(&file_systems_lock);
- p = find_filesystem(fs->name);
- if (*p)
- res = -EBUSY;
- else
- *p = fs;
- write_unlock(&file_systems_lock);
- return res;
-}
-
-/**
- * unregister_filesystem - unregister a file system
- * @fs: filesystem to unregister
- *
- * Remove a file system that was previously successfully registered
- * with the kernel. An error is returned if the file system is not found.
- * Zero is returned on a success.
- *
- * Once this function has returned the &struct file_system_type structure
- * may be freed or reused.
- */
-
-int unregister_filesystem(struct file_system_type * fs)
-{
- struct file_system_type ** tmp;
-
- write_lock(&file_systems_lock);
- tmp = &file_systems;
- while (*tmp) {
- if (fs == *tmp) {
- *tmp = fs->next;
- fs->next = NULL;
- write_unlock(&file_systems_lock);
- return 0;
- }
- tmp = &(*tmp)->next;
- }
- write_unlock(&file_systems_lock);
- return -EINVAL;
-}
-
-static int fs_index(const char * __name)
-{
- struct file_system_type * tmp;
- char * name;
- int err, index;
-
- name = getname(__name);
- err = PTR_ERR(name);
- if (IS_ERR(name))
- return err;
-
- err = -EINVAL;
- read_lock(&file_systems_lock);
- for (tmp=file_systems, index=0 ; tmp ; tmp=tmp->next, index++) {
- if (strcmp(tmp->name,name) == 0) {
- err = index;
- break;
- }
- }
- read_unlock(&file_systems_lock);
- putname(name);
- return err;
-}
-
-static int fs_name(unsigned int index, char * buf)
-{
- struct file_system_type * tmp;
- int len, res;
-
- read_lock(&file_systems_lock);
- for (tmp = file_systems; tmp; tmp = tmp->next, index--)
- if (index <= 0 && try_inc_mod_count(tmp->owner))
- break;
- read_unlock(&file_systems_lock);
- if (!tmp)
- return -EINVAL;
-
- /* OK, we got the reference, so we can safely block */
- len = strlen(tmp->name) + 1;
- res = copy_to_user(buf, tmp->name, len) ? -EFAULT : 0;
- put_filesystem(tmp);
- return res;
-}
-
-static int fs_maxindex(void)
-{
- struct file_system_type * tmp;
- int index;
-
- read_lock(&file_systems_lock);
- for (tmp = file_systems, index = 0 ; tmp ; tmp = tmp->next, index++)
- ;
- read_unlock(&file_systems_lock);
- return index;
-}
-
-/*
- * Whee.. Weird sysv syscall.
- */
-asmlinkage long sys_sysfs(int option, unsigned long arg1, unsigned long arg2)
-{
- int retval = -EINVAL;
-
- switch (option) {
- case 1:
- retval = fs_index((const char *) arg1);
- break;
-
- case 2:
- retval = fs_name(arg1, (char *) arg2);
- break;
-
- case 3:
- retval = fs_maxindex();
- break;
- }
- return retval;
-}
-
-int get_filesystem_list(char * buf)
-{
- int len = 0;
- struct file_system_type * tmp;
-
- read_lock(&file_systems_lock);
- tmp = file_systems;
- while (tmp && len < PAGE_SIZE - 80) {
- len += sprintf(buf+len, "%s\t%s\n",
- (tmp->fs_flags & FS_REQUIRES_DEV) ? "" : "nodev",
- tmp->name);
- tmp = tmp->next;
- }
- read_unlock(&file_systems_lock);
- return len;
-}
-
-struct file_system_type *get_fs_type(const char *name)
-{
- struct file_system_type *fs;
-
- read_lock(&file_systems_lock);
- fs = *(find_filesystem(name));
- if (fs && !try_inc_mod_count(fs->owner))
- fs = NULL;
- read_unlock(&file_systems_lock);
- if (!fs && (request_module(name) == 0)) {
- read_lock(&file_systems_lock);
- fs = *(find_filesystem(name));
- if (fs && !try_inc_mod_count(fs->owner))
- fs = NULL;
- read_unlock(&file_systems_lock);
- }
- return fs;
-}
-
/**
* alloc_super - create new superblock
*
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 0e668a01a592..2edd4015fb61 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1413,12 +1413,17 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
struct inode *inode=NULL;
struct udf_options uopt;
lb_addr rootdir, fileset;
+ struct udf_sb_info *sbi;
uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT);
uopt.uid = -1;
uopt.gid = -1;
uopt.umask = 0;
+ sbi = kmalloc(sizeof(struct udf_sb_info), GFP_KERNEL);
+ if (!sbi)
+ return -ENOMEM;
+ sb->u.generic_sbp = sbi;
memset(UDF_SB(sb), 0x00, sizeof(struct udf_sb_info));
#if UDFFS_RW != 1
@@ -1607,6 +1612,8 @@ error_out:
udf_close_lvid(sb);
udf_release_data(UDF_SB_LVIDBH(sb));
UDF_SB_FREE(sb);
+ kfree(sbi);
+ sb->u.generic_sbp = NULL;
return -EINVAL;
}
@@ -1697,6 +1704,8 @@ udf_put_super(struct super_block *sb)
udf_close_lvid(sb);
udf_release_data(UDF_SB_LVIDBH(sb));
UDF_SB_FREE(sb);
+ kfree(sb->u.generic_sbp);
+ sb->u.generic_sbp = NULL;
}
/*
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
index 0dde99415c97..2b264e1cf49a 100644
--- a/fs/udf/udf_sb.h
+++ b/fs/udf/udf_sb.h
@@ -30,6 +30,11 @@
#define UDF_PART_FLAG_REWRITABLE 0x0040
#define UDF_PART_FLAG_OVERWRITABLE 0x0080
+static inline struct udf_sb_info *UDF_SB(struct super_block *sb)
+{
+ return sb->u.generic_sbp;
+}
+
#define UDF_SB_FREE(X)\
{\
if (UDF_SB(X))\
@@ -39,7 +44,6 @@
UDF_SB_PARTMAPS(X) = NULL;\
}\
}
-#define UDF_SB(X) (&((X)->u.udf_sb))
#define UDF_SB_ALLOC_PARTMAPS(X,Y)\
{\
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index 836aef50cded..1b4d5a5d1401 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -8,6 +8,8 @@
#include <linux/fs.h>
#include <linux/config.h>
#include <linux/types.h>
+#include <linux/udf_fs_i.h>
+#include <linux/udf_fs_sb.h>
#ifndef LINUX_VERSION_CODE
#include <linux/version.h>
@@ -15,8 +17,6 @@
#if !defined(CONFIG_UDF_FS) && !defined(CONFIG_UDF_FS_MODULE)
#define CONFIG_UDF_FS_MODULE
-#include <linux/udf_fs_i.h>
-#include <linux/udf_fs_sb.h>
#endif
#include "udfend.h"
diff --git a/fs/umsdos/inode.c b/fs/umsdos/inode.c
index ad0104d26056..fbd0b9f3ed28 100644
--- a/fs/umsdos/inode.c
+++ b/fs/umsdos/inode.c
@@ -55,7 +55,7 @@ void UMSDOS_put_super (struct super_block *sb)
saved_root = NULL;
pseudo_root = NULL;
}
- msdos_put_super (sb);
+ fat_put_super (sb);
}
diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c
index 3e5c175b50d2..e44b87116be1 100644
--- a/fs/vfat/namei.c
+++ b/fs/vfat/namei.c
@@ -1073,7 +1073,7 @@ static void vfat_remove_entry(struct inode *dir,struct vfat_slot_info *sinfo,
if (fat_get_entry(dir, &offset, &bh, &de, &ino) < 0)
continue;
de->name[0] = DELETED_FLAG;
- de->attr = 0;
+ de->attr = ATTR_NONE;
fat_mark_buffer_dirty(sb, bh);
}
if (bh) fat_brelse(sb, bh);
diff --git a/include/asm-ppc/siginfo.h b/include/asm-ppc/siginfo.h
index 684ad91eb8d7..597b234d1b44 100644
--- a/include/asm-ppc/siginfo.h
+++ b/include/asm-ppc/siginfo.h
@@ -99,7 +99,6 @@ typedef struct siginfo {
/*
* si_code values
- * Digital reserves positive values for kernel-generated signals.
*/
#define SI_USER 0 /* sent by kill, sigsend, raise */
#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
@@ -109,6 +108,7 @@ typedef struct siginfo {
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
#define SI_TKILL -6 /* sent by tkill system call */
+#define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
diff --git a/include/asm-ppc/thread_info.h b/include/asm-ppc/thread_info.h
index 0ea0afd7e48e..b98527161019 100644
--- a/include/asm-ppc/thread_info.h
+++ b/include/asm-ppc/thread_info.h
@@ -18,10 +18,11 @@
* If you change this, change the TI_* offsets below to match.
*/
struct thread_info {
- struct task_struct *task; /* main task structure */
- struct exec_domain *exec_domain; /* execution domain */
- unsigned long flags; /* low level flags */
- int cpu; /* cpu we're on */
+ struct task_struct *task; /* main task structure */
+ struct exec_domain *exec_domain; /* execution domain */
+ unsigned long flags; /* low level flags */
+ int cpu; /* cpu we're on */
+ int preempt_count; /* not used at present */
};
/*
diff --git a/include/linux/affs_fs.h b/include/linux/affs_fs.h
index 7859a5e1883c..47ed05c8b744 100644
--- a/include/linux/affs_fs.h
+++ b/include/linux/affs_fs.h
@@ -7,6 +7,7 @@
#include <linux/types.h>
#include <linux/affs_fs_i.h>
+#include <linux/affs_fs_sb.h>
#define AFFS_SUPER_MAGIC 0xadff
diff --git a/include/linux/affs_fs_sb.h b/include/linux/affs_fs_sb.h
index 5a0485e97fd9..1f39cd806800 100644
--- a/include/linux/affs_fs_sb.h
+++ b/include/linux/affs_fs_sb.h
@@ -50,6 +50,9 @@ struct affs_sb_info {
#define SF_READONLY 0x1000 /* Don't allow to remount rw */
/* short cut to get to the affs specific sb data */
-#define AFFS_SB (&sb->u.affs_sb)
+static inline struct affs_sb_info *AFFS_SB(struct super_block *sb)
+{
+ return sb->u.generic_sbp;
+}
#endif
diff --git a/include/linux/amigaffs.h b/include/linux/amigaffs.h
index b4b1d430c306..342ab37e0c2e 100644
--- a/include/linux/amigaffs.h
+++ b/include/linux/amigaffs.h
@@ -18,7 +18,7 @@
#define GET_END_PTR(st,p,sz) ((st *)((char *)(p)+((sz)-sizeof(st))))
#define AFFS_GET_HASHENTRY(data,hashkey) be32_to_cpu(((struct dir_front *)data)->hashtable[hashkey])
-#define AFFS_BLOCK(sb, bh, blk) (AFFS_HEAD(bh)->table[(sb)->u.affs_sb.s_hashsize-1-(blk)])
+#define AFFS_BLOCK(sb, bh, blk) (AFFS_HEAD(bh)->table[AFFS_SB(sb)->s_hashsize-1-(blk)])
static inline void
affs_set_blocksize(struct super_block *sb, int size)
@@ -29,7 +29,7 @@ static inline struct buffer_head *
affs_bread(struct super_block *sb, int block)
{
pr_debug(KERN_DEBUG "affs_bread: %d\n", block);
- if (block >= AFFS_SB->s_reserved && block < AFFS_SB->s_partition_size)
+ if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size)
return sb_bread(sb, block);
return NULL;
}
@@ -37,7 +37,7 @@ static inline struct buffer_head *
affs_getblk(struct super_block *sb, int block)
{
pr_debug(KERN_DEBUG "affs_getblk: %d\n", block);
- if (block >= AFFS_SB->s_reserved && block < AFFS_SB->s_partition_size)
+ if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size)
return sb_getblk(sb, block);
return NULL;
}
@@ -46,7 +46,7 @@ affs_getzeroblk(struct super_block *sb, int block)
{
struct buffer_head *bh;
pr_debug(KERN_DEBUG "affs_getzeroblk: %d\n", block);
- if (block >= AFFS_SB->s_reserved && block < AFFS_SB->s_partition_size) {
+ if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) {
bh = sb_getblk(sb, block);
lock_buffer(bh);
memset(bh->b_data, 0 , sb->s_blocksize);
@@ -61,7 +61,7 @@ affs_getemptyblk(struct super_block *sb, int block)
{
struct buffer_head *bh;
pr_debug(KERN_DEBUG "affs_getemptyblk: %d\n", block);
- if (block >= AFFS_SB->s_reserved && block < AFFS_SB->s_partition_size) {
+ if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) {
bh = sb_getblk(sb, block);
wait_on_buffer(bh);
mark_buffer_uptodate(bh, 1);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index dc0d9a84bf27..375d53dd69e9 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -471,7 +471,6 @@ static inline struct inode *SOCK_INODE(struct socket *socket)
return &list_entry(socket, struct socket_alloc, socket)->vfs_inode;
}
-#include <linux/shmem_fs.h>
/* will die */
#include <linux/coda_fs_i.h>
#include <linux/ext3_fs_i.h>
@@ -647,17 +646,12 @@ struct quota_mount_options
#include <linux/ext3_fs_sb.h>
#include <linux/hpfs_fs_sb.h>
-#include <linux/iso_fs_sb.h>
#include <linux/sysv_fs_sb.h>
-#include <linux/affs_fs_sb.h>
#include <linux/ufs_fs_sb.h>
#include <linux/romfs_fs_sb.h>
-#include <linux/hfs_fs_sb.h>
#include <linux/adfs_fs_sb.h>
#include <linux/reiserfs_fs_sb.h>
#include <linux/bfs_fs_sb.h>
-#include <linux/udf_fs_sb.h>
-#include <linux/jffs2_fs_sb.h>
extern struct list_head super_blocks;
extern spinlock_t sb_lock;
@@ -695,18 +689,12 @@ struct super_block {
union {
struct ext3_sb_info ext3_sb;
struct hpfs_sb_info hpfs_sb;
- struct isofs_sb_info isofs_sb;
struct sysv_sb_info sysv_sb;
- struct affs_sb_info affs_sb;
struct ufs_sb_info ufs_sb;
- struct shmem_sb_info shmem_sb;
struct romfs_sb_info romfs_sb;
- struct hfs_sb_info hfs_sb;
struct adfs_sb_info adfs_sb;
struct reiserfs_sb_info reiserfs_sb;
struct bfs_sb_info bfs_sb;
- struct udf_sb_info udf_sb;
- struct jffs2_sb_info jffs2_sb;
void *generic_sbp;
} u;
/*
diff --git a/include/linux/hfs_fs.h b/include/linux/hfs_fs.h
index f6272708f041..c0acee5f5f4b 100644
--- a/include/linux/hfs_fs.h
+++ b/include/linux/hfs_fs.h
@@ -318,12 +318,17 @@ extern int hfs_mac2triv(char *, const struct hfs_name *);
extern void hfs_tolower(unsigned char *, int);
#include <linux/hfs_fs_i.h>
+#include <linux/hfs_fs_sb.h>
static inline struct hfs_inode_info *HFS_I(struct inode *inode)
{
return list_entry(inode, struct hfs_inode_info, vfs_inode);
}
-#define HFS_SB(X) (&((X)->u.hfs_sb))
+
+static inline struct hfs_sb_info *HFS_SB(struct super_block *sb)
+{
+ return sb->u.generic_sbp;
+}
static inline void hfs_nameout(struct inode *dir, struct hfs_name *out,
const char *in, int len) {
diff --git a/include/linux/hiddev.h b/include/linux/hiddev.h
index cffc0323325d..4f57c1174598 100644
--- a/include/linux/hiddev.h
+++ b/include/linux/hiddev.h
@@ -119,6 +119,7 @@ struct hiddev_usage_ref {
__s32 value;
};
+#define HID_FIELD_INDEX_NONE 0xffffffff
/*
* Protocol version.
@@ -143,6 +144,15 @@ struct hiddev_usage_ref {
#define HIDIOCGUSAGE _IOWR('H', 0x0B, struct hiddev_usage_ref)
#define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref)
#define HIDIOCGUCODE _IOWR('H', 0x0D, struct hiddev_usage_ref)
+#define HIDIOCGFLAG _IOR('H', 0x0E, int)
+#define HIDIOCSFLAG _IOW('H', 0x0F, int)
+
+/*
+ * Flags to be used in HIDIOCSFLAG
+ */
+#define HIDDEV_FLAG_UREF 0x1
+#define HIDDEV_FLAG_REPORT 0x2
+#define HIDDEV_FLAGS 0x3
/* To traverse the input report descriptor info for a HID device, perform the
* following:
@@ -179,7 +189,7 @@ struct hiddev_usage_ref {
#ifdef CONFIG_USB_HIDDEV
int hiddev_connect(struct hid_device *);
void hiddev_disconnect(struct hid_device *);
-void hiddev_hid_event(struct hid_device *, unsigned int usage, int value);
+void hiddev_hid_event(struct hid_device *, struct hiddev_usage_ref *ref);
int __init hiddev_init(void);
void __exit hiddev_exit(void);
#else
diff --git a/include/linux/ide.h b/include/linux/ide.h
index aa3d9c39913f..6dafc47697ff 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -815,7 +815,6 @@ typedef struct ide_task_s {
int command_type;
ide_pre_handler_t *prehandler;
ide_handler_t *handler;
- ide_post_handler_t *posthandler;
void *special; /* valid_t generally */
struct request *rq; /* copy of request */
unsigned long block; /* copy of block */
@@ -842,17 +841,17 @@ void do_taskfile (ide_drive_t *drive, struct hd_drive_task_hdr *taskfile, struct
* Special Flagged Register Validation Caller
*/
-ide_startstop_t set_multmode_intr (ide_drive_t *drive);
-ide_startstop_t task_no_data_intr (ide_drive_t *drive);
+extern ide_startstop_t recal_intr(ide_drive_t *drive);
+extern ide_startstop_t set_geometry_intr(ide_drive_t *drive);
+extern ide_startstop_t set_multmode_intr(ide_drive_t *drive);
+extern ide_startstop_t task_no_data_intr(ide_drive_t *drive);
int ide_wait_taskfile (ide_drive_t *drive, struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile, byte *buf);
int ide_raw_taskfile (ide_drive_t *drive, ide_task_t *cmd, byte *buf);
-ide_pre_handler_t * ide_pre_handler_parser (struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile);
-ide_handler_t * ide_handler_parser (struct hd_drive_task_hdr *taskfile, struct hd_drive_hob_hdr *hobfile);
/* Expects args is a full set of TF registers and parses the command type */
-int ide_cmd_type_parser (ide_task_t *args);
+extern void ide_cmd_type_parser(ide_task_t *args);
int ide_cmd_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
int ide_task_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
diff --git a/include/linux/if_wanpipe.h b/include/linux/if_wanpipe.h
index 544d818d9f73..c4cd29a162fe 100644
--- a/include/linux/if_wanpipe.h
+++ b/include/linux/if_wanpipe.h
@@ -122,6 +122,7 @@ struct wanpipe_opt
unsigned poll_cnt;
unsigned char force; /* Used to force sock release */
atomic_t packet_sent;
+ unsigned short num;
};
#define wp_sk(__sk) ((struct wanpipe_opt *)(__sk)->protinfo)
diff --git a/include/linux/iso_fs.h b/include/linux/iso_fs.h
index b235c3ea9f23..3520e22a2af8 100644
--- a/include/linux/iso_fs.h
+++ b/include/linux/iso_fs.h
@@ -160,7 +160,6 @@ struct iso_directory_record {
#define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize)
#define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits)
-#define ISOFS_ZONE_BITS(INODE) ((INODE)->i_sb->u.isofs_sb.s_log_zone_size)
#define ISOFS_SUPER_MAGIC 0x9660
@@ -171,6 +170,12 @@ struct iso_directory_record {
#include <asm/byteorder.h>
#include <asm/unaligned.h>
#include <linux/iso_fs_i.h>
+#include <linux/iso_fs_sb.h>
+
+static inline struct isofs_sb_info *ISOFS_SB(struct super_block *sb)
+{
+ return sb->u.generic_sbp;
+}
static inline struct iso_inode_info *ISOFS_I(struct inode *inode)
{
diff --git a/include/linux/jffs2_fs_sb.h b/include/linux/jffs2_fs_sb.h
index c424eb13103c..129a4c31dee1 100644
--- a/include/linux/jffs2_fs_sb.h
+++ b/include/linux/jffs2_fs_sb.h
@@ -1,4 +1,4 @@
-/* $Id: jffs2_fs_sb.h,v 1.25 2002/03/08 15:11:24 dwmw2 Exp $ */
+/* $Id: jffs2_fs_sb.h,v 1.26 2002/03/17 10:18:42 dwmw2 Exp $ */
#ifndef _JFFS2_FS_SB
#define _JFFS2_FS_SB
@@ -81,6 +81,9 @@ struct jffs2_sb_info {
uint32_t wbuf_ofs;
uint32_t wbuf_len;
uint32_t wbuf_pagesize;
+
+ /* OS-private pointer for getting back to master superblock info */
+ void *os_priv;
};
#endif /* _JFFS2_FB_SB */
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 022e7a89d98a..17435be46bcc 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -4,19 +4,17 @@
/*
* The MS-DOS filesystem constants/structures
*/
-#include <linux/msdos_fs_i.h>
-#include <linux/msdos_fs_sb.h>
-
#include <asm/byteorder.h>
-#define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */
-#define SECTOR_SIZE 512 /* sector size (bytes) */
-#define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */
-#define MSDOS_DPB (MSDOS_DPS) /* dir entries per block */
-#define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */
-#define MSDOS_DPS (SECTOR_SIZE/sizeof(struct msdos_dir_entry))
-#define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */
-#define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */
+#define SECTOR_SIZE 512 /* sector size (bytes) */
+#define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */
+#define MSDOS_DPB (MSDOS_DPS) /* dir entries per block */
+#define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */
+#define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry))
+#define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */
+
+#define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */
+#define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */
/* directory limit */
#define FAT_MAX_DIR_ENTRIES (65536)
@@ -26,6 +24,7 @@
#define FAT_CACHE 8 /* FAT cache size */
+#define ATTR_NONE 0 /* no attribute bits */
#define ATTR_RO 1 /* read-only */
#define ATTR_HIDDEN 2 /* hidden */
#define ATTR_SYS 4 /* system */
@@ -33,18 +32,11 @@
#define ATTR_DIR 16 /* directory */
#define ATTR_ARCH 32 /* archived */
-#define ATTR_NONE 0 /* no attribute bits */
#define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN)
/* attribute bits that are copied "as is" */
#define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME)
/* bits that are used by the Windows 95/Windows NT extended FAT */
-#define ATTR_DIR_READ_BOTH 512 /* read both short and long names from the
- * vfat filesystem. This is used by Samba
- * to export the vfat filesystem with correct
- * shortnames. */
-#define ATTR_DIR_READ_SHORT 1024
-
#define CASE_LOWER_BASE 8 /* base is lower case */
#define CASE_LOWER_EXT 16 /* extension is lower case */
@@ -54,16 +46,6 @@
#define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)
/* valid file mode bits */
-static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb)
-{
- return sb->u.generic_sbp;
-}
-
-static inline struct msdos_inode_info *MSDOS_I(struct inode *inode)
-{
- return list_entry(inode, struct msdos_inode_info, vfs_inode);
-}
-
#define MSDOS_NAME 11 /* maximum name length */
#define MSDOS_LONGNAME 256 /* maximum name length */
#define MSDOS_SLOTS 21 /* max # of slots needed for short and long names */
@@ -84,11 +66,6 @@ static inline struct msdos_inode_info *MSDOS_I(struct inode *inode)
&& CF_LE_L((x)->signature2) == FAT_FSINFO_SIG2)
/*
- * Inode flags
- */
-#define FAT_BINARY_FL 0x00000001 /* File contains binary data */
-
-/*
* ioctl commands
*/
#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct dirent [2])
@@ -178,11 +155,8 @@ struct msdos_dir_slot {
};
struct vfat_slot_info {
- int is_long; /* was the found entry long */
int long_slots; /* number of long slots in filename */
- int total_slots; /* total slots (long and short) */
loff_t longname_offset; /* dir offset for longname start */
- loff_t shortname_offset; /* dir offset for shortname start */
int ino; /* ino for the file */
};
@@ -196,6 +170,18 @@ struct vfat_slot_info {
#ifdef __KERNEL__
#include <linux/nls.h>
+#include <linux/msdos_fs_i.h>
+#include <linux/msdos_fs_sb.h>
+
+static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb)
+{
+ return sb->u.generic_sbp;
+}
+
+static inline struct msdos_inode_info *MSDOS_I(struct inode *inode)
+{
+ return list_entry(inode, struct msdos_inode_info, vfs_inode);
+}
struct fat_cache {
struct super_block *sb; /* fs in question. NULL means unused */
@@ -326,7 +312,6 @@ extern int fat_scan(struct inode *dir, const char *name,
struct msdos_dir_entry **res_de, int *ino);
/* msdos/namei.c - these are for Umsdos */
-extern void msdos_put_super(struct super_block *sb);
extern struct dentry *msdos_lookup(struct inode *dir, struct dentry *);
extern int msdos_create(struct inode *dir, struct dentry *dentry, int mode);
extern int msdos_rmdir(struct inode *dir, struct dentry *dentry);
diff --git a/include/linux/msdos_fs_sb.h b/include/linux/msdos_fs_sb.h
index e622a038c7d5..d855d76a71bf 100644
--- a/include/linux/msdos_fs_sb.h
+++ b/include/linux/msdos_fs_sb.h
@@ -25,7 +25,6 @@ struct fat_mount_options {
posixfs:1, /* Allow names like makefile and Makefile to coexist */
numtail:1, /* Does first alias have a numeric '~1' type tail? */
atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */
- fat32:1, /* Is this a FAT32 partition? */
nocase:1; /* Does this need case conversion? 0=need case conversion*/
};
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 30c965801c10..41eed9cd438e 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -865,6 +865,7 @@
#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS2 0x0151
#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_ULTRA 0x0152
#define PCI_DEVICE_ID_NVIDIA_QUADRO2_PRO 0x0153
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE 0x01bc
#define PCI_VENDOR_ID_IMS 0x10e0
#define PCI_DEVICE_ID_IMS_8849 0x8849
diff --git a/include/linux/zlib_fs.h b/include/linux/zlib_fs.h
deleted file mode 100644
index 923e1ae55182..000000000000
--- a/include/linux/zlib_fs.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* zlib_fs.h -- A compatability file mapping the zlib functions to zlib_fs
- functions. This will go away. */
-#ifndef _ZLIB_FS_H
-#define _ZLIB_FS_H
-
-#include <linux/zlib.h>
-
-#define zlib_fs_inflate_workspacesize zlib_inflate_workspacesize
-#define zlib_fs_deflate_workspacesize zlib_deflate_workspacesize
-#define zlib_fs_zlibVersion zlib_zlibVersion
-#define zlib_fs_deflate zlib_deflate
-#define zlib_fs_deflateEnd zlib_deflateEnd
-#define zlib_fs_inflate zlib_inflate
-#define zlib_fs_inflateEnd zlib_inflateEnd
-#define zlib_fs_deflateSetDictionary zlib_deflateSetDictionary
-#define zlib_fs_deflateCopy zlib_deflateCopy
-#define zlib_fs_deflateReset zlib_deflateReset
-#define zlib_fs_deflateParams zlib_deflateParams
-#define zlib_fs_inflateIncomp zlib_inflateIncomp
-#define zlib_fs_inflateSetDictionary zlib_inflateSetDictionary
-#define zlib_fs_inflateSync zlib_inflateSync
-#define zlib_fs_inflateReset zlib_inflateReset
-#define zlib_fs_adler32 zlib_adler32
-#define zlib_fs_crc32 zlib_crc32
-#define zlib_fs_deflateInit(strm, level) \
- zlib_deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
-#define zlib_fs_inflateInit(strm) \
- zlib_inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
-#define zlib_fs_deflateInit2(strm, level, method, windowBits, memLevel, strategy)\
- zlib_deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
- (strategy), ZLIB_VERSION, sizeof(z_stream))
-#define zlib_fs_inflateInit2(strm, windowBits) \
- zlib_inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
- sizeof(z_stream))
-
-#endif /* _ZLIB_FS_H */
diff --git a/include/sound/asoundef.h b/include/sound/asoundef.h
index d52f2416b709..e8b894586387 100644
--- a/include/sound/asoundef.h
+++ b/include/sound/asoundef.h
@@ -155,7 +155,7 @@
#define MIDI_CTL_MSB_MODWHEEL 0x01
#define MIDI_CTL_MSB_BREATH 0x02
#define MIDI_CTL_MSB_FOOT 0x04
-#define MIDI_CTL_MSB_PORTNAMENTO_TIME 0x05
+#define MIDI_CTL_MSB_PORTAMENTO_TIME 0x05
#define MIDI_CTL_MSB_DATA_ENTRY 0x06
#define MIDI_CTL_MSB_MAIN_VOLUME 0x07
#define MIDI_CTL_MSB_BALANCE 0x08
@@ -171,7 +171,7 @@
#define MIDI_CTL_LSB_MODWHEEL 0x21
#define MIDI_CTL_LSB_BREATH 0x22
#define MIDI_CTL_LSB_FOOT 0x24
-#define MIDI_CTL_LSB_PORTNAMENTO_TIME 0x25
+#define MIDI_CTL_LSB_PORTAMENTO_TIME 0x25
#define MIDI_CTL_LSB_DATA_ENTRY 0x26
#define MIDI_CTL_LSB_MAIN_VOLUME 0x27
#define MIDI_CTL_LSB_BALANCE 0x28
@@ -203,7 +203,7 @@
#define MIDI_CTL_GENERAL_PURPOSE6 0x51
#define MIDI_CTL_GENERAL_PURPOSE7 0x52
#define MIDI_CTL_GENERAL_PURPOSE8 0x53
-#define MIDI_CTL_PORNAMENTO_CONTROL 0x54
+#define MIDI_CTL_PORTAMENTO_CONTROL 0x54
#define MIDI_CTL_E1_REVERB_DEPTH 0x5b
#define MIDI_CTL_E2_TREMOLO_DEPTH 0x5c
#define MIDI_CTL_E3_CHORUS_DEPTH 0x5d
diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h
index f900efa6b8c4..08f62c25df32 100644
--- a/include/sound/cs46xx.h
+++ b/include/sound/cs46xx.h
@@ -1697,6 +1697,9 @@ struct _snd_cs46xx {
struct pci_dev *acpi_dev;
int acpi_port;
snd_kcontrol_t *eapd_switch; /* for amplifier hack */
+ int accept_valid; /* accept mmap valid (for OSS) */
+
+ struct snd_cs46xx_gameport *gameport;
#ifdef CONFIG_PM
struct pm_dev *pm_dev;
@@ -1711,6 +1714,7 @@ int snd_cs46xx_create(snd_card_t *card,
int snd_cs46xx_pcm(cs46xx_t *chip, int device, snd_pcm_t **rpcm);
int snd_cs46xx_mixer(cs46xx_t *chip);
int snd_cs46xx_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rmidi);
+void snd_cs46xx_gameport(cs46xx_t *chip);
#ifdef CONFIG_PM
void snd_cs46xx_suspend(cs46xx_t *chip);
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 3f03bec0cf41..96a3185ccba0 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -687,6 +687,12 @@
#define A_MUCMD2 0x73
#define A_MUSTAT2 A_MUCMD2
+/* The next two are the Audigy equivalent of FXWC */
+/* the Audigy can record any output (16bit, 48kHz, up to 64 channel simultaneously) */
+/* Each bit selects a channel for recording */
+#define A_FXWC1 0x74 /* Selects 0x7f-0x60 for FX recording */
+#define A_FXWC2 0x75 /* Selects 0x9f-0x80 for FX recording */
+
#define A_SPDIF_SAMPLERATE 0x76 /* Set the sample rate of SPDIF output */
#define A_SPDIF_48000 0x00000080
#define A_SPDIF_44100 0x00000000
@@ -797,6 +803,7 @@ struct _snd_emu10k1_pcm {
unsigned int capture_bs_reg; /* buffer size register */
unsigned int capture_idx_reg; /* buffer index register */
unsigned int capture_cr_val; /* control value */
+ unsigned int capture_cr_val2; /* control value2 (for audigy) */
unsigned int capture_bs_val; /* buffer size value */
unsigned int capture_bufsize; /* buffer size in bytes */
};
@@ -982,7 +989,7 @@ struct _snd_emu10k1 {
emu10k1_midi_t midi;
emu10k1_midi_t midi2; /* for audigy */
- unsigned int efx_voices_mask;
+ unsigned int efx_voices_mask[2];
snd_info_entry_t *proc_entry;
snd_info_entry_t *proc_entry_fx8010_gpr;
@@ -1209,8 +1216,8 @@ int snd_emu10k1_proc_done(emu10k1_t * emu);
#define A_EXTOUT_AREAR_R 0x0f /* right */
#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */
#define A_EXTOUT_AC97_R 0x11 /* right */
-#define A_EXTOUT_ADC_CAP_L 0x12 /* ADC capture buffer left */
-#define A_EXTOUT_ADC_CAP_R 0x13 /* right */
+#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */
+#define A_EXTOUT_ADC_CAP_R 0x17 /* right */
/* Audigy constants */
#define A_C_00000000 0xc0
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index 34bbf0c21801..1cb793e55594 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -158,7 +158,7 @@ int snd_rawmidi_control_ioctl(snd_card_t * card,
/* callbacks */
void snd_rawmidi_receive_reset(snd_rawmidi_substream_t * substream);
-int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count);
+int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char *buffer, int count);
void snd_rawmidi_transmit_reset(snd_rawmidi_substream_t * substream);
int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream);
int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count);
diff --git a/include/sound/sndmagic.h b/include/sound/sndmagic.h
index 760651da578f..c2398e775e07 100644
--- a/include/sound/sndmagic.h
+++ b/include/sound/sndmagic.h
@@ -131,6 +131,7 @@ static inline int _snd_magic_bad(void *obj, unsigned long magic)
#define mtpav_port_t_magic 0xa15a3702
#define korg1212_t_magic 0xa15a3800
#define opl3sa2_t_magic 0xa15a3900
+#define serialmidi_t_magic 0xa15a3a00
#else
diff --git a/include/sound/trident.h b/include/sound/trident.h
index 1d8b1c3d7931..56bf20a14a03 100644
--- a/include/sound/trident.h
+++ b/include/sound/trident.h
@@ -161,6 +161,12 @@ enum miscint_bits {
#define NX_SPESO 0x2c
#define NX_SPCSTATUS 0x64
+/* Joystick */
+#define GAMEPORT_GCR 0x30
+#define GAMEPORT_MODE_ADC 0x80
+#define GAMEPORT_LEGACY 0x31
+#define GAMEPORT_AXES 0x34
+
/* NX Specific Registers */
#define NX_TLBC 0x6c
@@ -437,6 +443,8 @@ struct _snd_trident {
spinlock_t reg_lock;
snd_info_entry_t *proc_entry;
+
+ struct snd_trident_gameport *gameport;
};
int snd_trident_create(snd_card_t * card,
@@ -446,6 +454,7 @@ int snd_trident_create(snd_card_t * card,
int max_wavetable_size,
trident_t ** rtrident);
int snd_trident_free(trident_t *trident);
+void snd_trident_gameport(trident_t *trident);
int snd_trident_pcm(trident_t * trident, int device, snd_pcm_t **rpcm);
int snd_trident_foldback_pcm(trident_t * trident, int device, snd_pcm_t **rpcm);
diff --git a/include/sound/version.h b/include/sound/version.h
index 21ced3f5bc47..f3f1456b8567 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
/* include/version.h. Generated automatically by configure. */
#define CONFIG_SND_VERSION "0.9.0beta12"
-#define CONFIG_SND_DATE " (Wed Mar 06 07:56:20 2002 UTC)"
+#define CONFIG_SND_DATE " (Mon Mar 18 15:44:40 2002 UTC)"
diff --git a/ipc/shm.c b/ipc/shm.c
index 7a1335327179..6d7f6b364294 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -23,6 +23,7 @@
#include <linux/file.h>
#include <linux/mman.h>
#include <linux/proc_fs.h>
+#include <linux/shmem_fs.h>
#include <asm/uaccess.h>
#include "util.h"
diff --git a/mm/shmem.c b/mm/shmem.c
index b230b331b462..b2b19b905116 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -28,6 +28,7 @@
#include <linux/locks.h>
#include <linux/slab.h>
#include <linux/smp_lock.h>
+#include <linux/shmem_fs.h>
#include <asm/uaccess.h>
@@ -36,7 +37,10 @@
#define ENTRIES_PER_PAGE (PAGE_CACHE_SIZE/sizeof(unsigned long))
-#define SHMEM_SB(sb) (&sb->u.shmem_sb)
+static inline struct shmem_sb_info *SHMEM_SB(struct super_block *sb)
+{
+ return sb->u.generic_sbp;
+}
static struct super_operations shmem_ops;
static struct address_space_operations shmem_aops;
@@ -1261,7 +1265,7 @@ bad_val:
static int shmem_remount_fs (struct super_block *sb, int *flags, char *data)
{
- struct shmem_sb_info *sbinfo = &sb->u.shmem_sb;
+ struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
unsigned long max_blocks = sbinfo->max_blocks;
unsigned long max_inodes = sbinfo->max_inodes;
@@ -1284,8 +1288,15 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent)
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 shmem_sb_info *sbinfo;
struct sysinfo si;
+ int err;
+
+ sbinfo = kmalloc(sizeof(struct shmem_sb_info), GFP_KERNEL);
+ if (!sbinfo)
+ return -ENOMEM;
+ sb->u.generic_sbp = sbinfo;
+ memset(sbinfo, 0, sizeof(struct shmem_sb_info));
/*
* Per default we only allow half of the physical ram per
@@ -1295,8 +1306,10 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent)
blocks = inodes = si.totalram / 2;
#ifdef CONFIG_TMPFS
- if (shmem_parse_options (data, &mode, &uid, &gid, &blocks, &inodes))
- return -EINVAL;
+ if (shmem_parse_options (data, &mode, &uid, &gid, &blocks, &inodes)) {
+ err = -EINVAL;
+ goto failed;
+ }
#endif
spin_lock_init (&sbinfo->stat_lock);
@@ -1310,18 +1323,33 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent)
sb->s_magic = TMPFS_MAGIC;
sb->s_op = &shmem_ops;
inode = shmem_get_inode(sb, S_IFDIR | mode, 0);
- if (!inode)
- return -ENOMEM;
+ if (!inode) {
+ err = -ENOMEM;
+ goto failed;
+ }
inode->i_uid = uid;
inode->i_gid = gid;
root = d_alloc_root(inode);
if (!root) {
- iput(inode);
- return -ENOMEM;
+ err = -ENOMEM;
+ goto failed_iput;
}
sb->s_root = root;
return 0;
+
+failed_iput:
+ iput(inode);
+failed:
+ kfree(sbinfo);
+ sb->u.generic_sbp = NULL;
+ return err;
+}
+
+static void shmem_put_super(struct super_block *sb)
+{
+ kfree(sb->u.generic_sbp);
+ sb->u.generic_sbp = NULL;
}
static kmem_cache_t * shmem_inode_cachep;
@@ -1407,6 +1435,7 @@ static struct super_operations shmem_ops = {
#endif
delete_inode: shmem_delete_inode,
put_inode: force_delete,
+ put_super: shmem_put_super,
};
static struct vm_operations_struct shmem_vm_ops = {
diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c
index 5fa94340daf9..b93dd0167679 100644
--- a/net/ipv4/netfilter/ip_conntrack_standalone.c
+++ b/net/ipv4/netfilter/ip_conntrack_standalone.c
@@ -38,7 +38,7 @@ MODULE_LICENSE("GPL");
static int kill_proto(const struct ip_conntrack *i, void *data)
{
- return (i->tuplehash[IP_CT_DIR_ORIGINAL].dst.protonum ==
+ return (i->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum ==
*((u_int8_t *) data));
}
diff --git a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c
index 88a4e1356ed3..0a9f62073788 100644
--- a/net/wanrouter/af_wanpipe.c
+++ b/net/wanrouter/af_wanpipe.c
@@ -19,6 +19,7 @@
* Alan Cox.
* X25 socket Author: Jonathan Naylor.
* ============================================================================
+* Mar 15, 2002 Arnaldo C. Melo o Use wp_sk()->num, as it isnt anymore in sock
* Apr 25, 2000 Nenad Corbic o Added the ability to send zero length packets.
* Mar 13, 2000 Nenad Corbic o Added a tx buffer check via ioctl call.
* Mar 06, 2000 Nenad Corbic o Fixed the corrupt sock lcn problem.
@@ -164,11 +165,11 @@ static void dbg_kfree(void * v, int line) {
/* List of all wanpipe sockets. */
-struct sock * wanpipe_sklist = NULL;
+struct sock* wanpipe_sklist;
static rwlock_t wanpipe_sklist_lock = RW_LOCK_UNLOCKED;
atomic_t wanpipe_socks_nr;
-static unsigned long wanpipe_tx_critical=0;
+static unsigned long wanpipe_tx_critical;
#if 0
/* Private wanpipe socket structures. */
@@ -187,9 +188,9 @@ struct wanpipe_opt
};
#endif
-static int sk_count=0;
+static int sk_count;
extern struct proto_ops wanpipe_ops;
-static unsigned long find_free_critical=0;
+static unsigned long find_free_critical;
static void wanpipe_unlink_driver (struct sock *);
static void wanpipe_link_driver (netdevice_t *,struct sock *sk);
@@ -400,9 +401,9 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk)
card->u.x.svc_to_dev_map[(chan->lcn%MAX_X25_LCN)] = dev;
newsk->zapped=0;
- newsk->num = htons(X25_PROT);
+ newwp->num = htons(X25_PROT);
- if (wanpipe_do_bind(newsk,dev,newsk->num)){
+ if (wanpipe_do_bind(newsk, dev, newwp->num)) {
wanpipe_kill_sock_irq (newsk);
release_device(dev);
return -EINVAL;
@@ -470,7 +471,7 @@ static struct sock *wanpipe_make_new(struct sock *osk)
sk->socket = osk->socket;
sk->priority = osk->priority;
sk->protocol = osk->protocol;
- sk->num = osk->num;
+ wp_sk(sk)->num = wp_sk(osk)->num;
sk->rcvbuf = osk->rcvbuf;
sk->sndbuf = osk->sndbuf;
sk->debug = osk->debug;
@@ -566,9 +567,11 @@ static int wanpipe_sendmsg(struct socket *sock, struct msghdr *msg, int len,
if (len < sizeof(x25api_hdr_t))
return -EINVAL;
+ wp = wp_sk(sk);
+
if (saddr == NULL) {
ifindex = sk->bound_dev_if;
- proto = sk->num;
+ proto = wp->num;
addr = NULL;
}else{
@@ -648,7 +651,6 @@ static int wanpipe_sendmsg(struct socket *sock, struct msghdr *msg, int len,
}
skb_queue_tail(&sk->write_queue,skb);
- wp = wp_sk(sk);
atomic_inc(&wp->packet_sent);
if (!(test_and_set_bit(0, &wp->timer))){
@@ -998,7 +1000,8 @@ static int wanpipe_release(struct socket *sock, struct socket *peersock)
* Unhook packet receive handler.
*/
- if (sk->num == htons(X25_PROT) && sk->state != WANSOCK_DISCONNECTED && sk->zapped){
+ if (wp->num == htons(X25_PROT) &&
+ sk->state != WANSOCK_DISCONNECTED && sk->zapped) {
netdevice_t *dev = dev_get_by_index(sk->bound_dev_if);
wanpipe_common_t *chan;
if (dev){
@@ -1206,7 +1209,8 @@ static void wanpipe_kill_sock_timer (unsigned long data)
write_unlock(&wanpipe_sklist_lock);
- if (sk->num == htons(X25_PROT) && sk->state != WANSOCK_DISCONNECTED){
+ if (wp_sk(sk)->num == htons(X25_PROT) &&
+ sk->state != WANSOCK_DISCONNECTED){
netdevice_t *dev = dev_get_by_index(sk->bound_dev_if);
wanpipe_common_t *chan;
if (dev){
@@ -1352,6 +1356,7 @@ static void wanpipe_kill_sock_irq (struct sock *sk)
static int wanpipe_do_bind(struct sock *sk, netdevice_t *dev, int protocol)
{
+ wanpipe_opt *wp = wp_sk(sk);
wanpipe_common_t *chan=NULL;
int err=0;
@@ -1360,7 +1365,7 @@ static int wanpipe_do_bind(struct sock *sk, netdevice_t *dev, int protocol)
goto bind_unlock_exit;
}
- sk->num = protocol;
+ wp->num = protocol;
if (protocol == 0){
release_device(dev);
@@ -1373,7 +1378,7 @@ static int wanpipe_do_bind(struct sock *sk, netdevice_t *dev, int protocol)
chan=dev->priv;
sk->state = chan->state;
- if (sk->num == htons(X25_PROT) &&
+ if (wp->num == htons(X25_PROT) &&
sk->state != WANSOCK_DISCONNECTED &&
sk->state != WANSOCK_CONNECTING){
DBG_PRINTK(KERN_INFO
@@ -1388,7 +1393,7 @@ static int wanpipe_do_bind(struct sock *sk, netdevice_t *dev, int protocol)
sk->bound_dev_if = dev->ifindex;
/* X25 Specific option */
- if (sk->num == htons(X25_PROT))
+ if (wp->num == htons(X25_PROT))
wp_sk(sk)->svc = chan->svc;
} else {
@@ -1421,6 +1426,7 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le
{
struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)uaddr;
struct sock *sk=sock->sk;
+ wanpipe_opt *wp = wp_sk(sk);
netdevice_t *dev = NULL;
sdla_t *card=NULL;
char name[15];
@@ -1462,7 +1468,7 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le
return err;
if (sll->sll_protocol)
- sk->num = sll->sll_protocol;
+ wp->num = sll->sll_protocol;
sk->state = WANSOCK_BIND_LISTEN;
return 0;
@@ -1509,7 +1515,7 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le
return -EINVAL;
}
- return wanpipe_do_bind(sk, dev, sll->sll_protocol ? : sk->num);
+ return wanpipe_do_bind(sk, dev, sll->sll_protocol ? : wp->num);
}
/*============================================================
@@ -1613,7 +1619,7 @@ static int wanpipe_create(struct socket *sock, int protocol)
sk->zapped=0;
sk->family = PF_WANPIPE;
- sk->num = protocol;
+ wp_sk(sk)->num = protocol;
sk->state = WANSOCK_DISCONNECTED;
sk->ack_backlog = 0;
sk->bound_dev_if=0;
@@ -1774,7 +1780,7 @@ static int wanpipe_getname(struct socket *sock, struct sockaddr *uaddr,
sll->sll_family = AF_WANPIPE;
sll->sll_ifindex = sk->bound_dev_if;
- sll->sll_protocol = sk->num;
+ sll->sll_protocol = wp_sk(sk)->num;
dev = dev_get_by_index(sk->bound_dev_if);
if (dev) {
sll->sll_hatype = dev->type;
@@ -1836,7 +1842,8 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void
}
break;
case NETDEV_UP:
- if (dev->ifindex == sk->bound_dev_if && sk->num && !sk->zapped) {
+ if (dev->ifindex == sk->bound_dev_if &&
+ po->num && !sk->zapped) {
printk(KERN_INFO "wansock: Registering Device: %s\n",
dev->name);
wanpipe_link_driver(dev,sk);
@@ -2242,7 +2249,7 @@ unsigned int wanpipe_poll(struct file * file, struct socket *sock, poll_table *w
* where multiple packets can be pending in the socket
* transmit queue */
- if (sk->num == htons(X25_PROT)){
+ if (wp_sk(sk)->num == htons(X25_PROT)) {
if (atomic_read(&wp_sk(sk)->packet_sent))
return mask;
}
@@ -2274,7 +2281,7 @@ static int wanpipe_listen(struct socket *sock, int backlog)
/* This is x25 specific area if protocol doesn't
* match, return error */
- if (sk->num != htons(X25_PROT))
+ if (wp_sk(sk)->num != htons(X25_PROT))
return -EINVAL;
if (sk->state == WANSOCK_BIND_LISTEN) {
@@ -2352,7 +2359,7 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags)
/* This is x25 specific area if protocol doesn't
* match, return error */
- if (sk->num != htons(X25_PROT))
+ if (wp->num != htons(X25_PROT))
return -EINVAL;
@@ -2535,7 +2542,7 @@ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags
if (sk->state != WANSOCK_LISTEN)
return -EINVAL;
- if (sk->num != htons(X25_PROT))
+ if (wp_sk(sk)->num != htons(X25_PROT))
return -EINVAL;
add_wait_queue(sk->sleep,&wait);
@@ -2628,7 +2635,7 @@ static int wanpipe_connect(struct socket *sock, struct sockaddr *uaddr, int addr
netdevice_t *dev;
int err;
- if (sk->num != htons(X25_PROT))
+ if (wp_sk(sk)->num != htons(X25_PROT))
return -EINVAL;
if (sk->state == WANSOCK_CONNECTED)
diff --git a/sound/core/Config.in b/sound/core/Config.in
index 38c93ed8bb1c..369789768f12 100644
--- a/sound/core/Config.in
+++ b/sound/core/Config.in
@@ -1,13 +1,13 @@
# ALSA soundcard-configuration
if [ "$CONFIG_X86_64" = "y" -a "$CONFIG_IA32_EMULATION" = "y" ]; then
- dep_tristate ' Emulation for 32-bit applications' CONFIG_SND_BIT32_EMUL
+ dep_tristate ' Emulation for 32-bit applications' CONFIG_SND_BIT32_EMUL $CONFIG_SND
fi
if [ "$CONFIG_PPC64" = "y" ]; then
- dep_tristate ' Emulation for 32-bit applications' CONFIG_SND_BIT32_EMUL
+ dep_tristate ' Emulation for 32-bit applications' CONFIG_SND_BIT32_EMUL $CONFIG_SND
fi
if [ "$CONFIG_SPARC64" = "y" ]; then
- dep_tristate ' Emulation for 32-bit applications' CONFIG_SND_BIT32_EMUL
+ dep_tristate ' Emulation for 32-bit applications' CONFIG_SND_BIT32_EMUL $CONFIG_SND
fi
dep_tristate ' Sequencer support' CONFIG_SND_SEQUENCER $CONFIG_SND
if [ "$CONFIG_SND_SEQUENCER" != "n" ]; then
diff --git a/sound/core/Makefile b/sound/core/Makefile
index 83f5d792b5e7..8835af24216c 100644
--- a/sound/core/Makefile
+++ b/sound/core/Makefile
@@ -37,6 +37,8 @@ ifeq ($(filter $(subdir-y),oss),oss)
obj-y += oss/oss.o
endif
+obj-$(CONFIG_SND_PCM_OSS) += snd-pcm.o
+
subdir-$(CONFIG_SND_SEQUENCER) += seq
ifeq ($(CONFIG_SND_SEQUENCER),y)
subdir-m += seq
@@ -53,6 +55,7 @@ endif
# Toplevel Module Dependency
obj-$(CONFIG_SND_DUMMY) += snd-pcm.o snd-timer.o snd.o
obj-$(CONFIG_SND_VIRMIDI) += snd-rawmidi.o snd.o snd-timer.o
+obj-$(CONFIG_SND_SERIAL_U16550) += snd-rawmidi.o snd.o snd-timer.o
obj-$(CONFIG_SND_MTPAV) += snd-rawmidi.o snd.o snd-timer.o
obj-$(CONFIG_SND_MPU401) += snd-rawmidi.o snd.o snd-timer.o
obj-$(CONFIG_SND_ALS100) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o
diff --git a/sound/core/ioctl32/Makefile b/sound/core/ioctl32/Makefile
index ddd94bfd3dfd..33377a3c4d10 100644
--- a/sound/core/ioctl32/Makefile
+++ b/sound/core/ioctl32/Makefile
@@ -8,6 +8,9 @@ O_TARGET := _ioctl32.o
list-multi := snd-ioctl32.o
snd-ioctl32-objs := ioctl32.o pcm32.o rawmidi32.o timer32.o hwdep32.o
+ifeq ($(CONFIG_SND_SEQUENCER),y)
+ snd-ioctl32-objs += seq32.o
+endif
obj-$(CONFIG_SND_BIT32_EMUL) += snd-ioctl32.o
diff --git a/sound/core/ioctl32/hwdep32.c b/sound/core/ioctl32/hwdep32.c
index 5d0eb0cc3ee0..a136640ef4c0 100644
--- a/sound/core/ioctl32/hwdep32.c
+++ b/sound/core/ioctl32/hwdep32.c
@@ -1,5 +1,5 @@
/*
- * 32bit -> 64bit ioctl wrapper for timer API
+ * 32bit -> 64bit ioctl wrapper for hwdep API
* Copyright (c) by Takashi Iwai <tiwai@suse.de>
*
* This program is free software; you can redistribute it and/or modify
@@ -26,8 +26,6 @@
#include <asm/uaccess.h>
#include "ioctl32.h"
-#define AP(x) snd_ioctl32_##x
-
struct ioctl32_mapper hwdep_mappers[] = {
{ SNDRV_HWDEP_IOCTL_PVERSION, NULL },
{ SNDRV_HWDEP_IOCTL_INFO, NULL },
diff --git a/sound/core/ioctl32/ioctl32.c b/sound/core/ioctl32/ioctl32.c
index cb22362f40b9..a2adb2f8c59b 100644
--- a/sound/core/ioctl32/ioctl32.c
+++ b/sound/core/ioctl32/ioctl32.c
@@ -286,14 +286,21 @@ static int snd_ioctl32_ctl_elem_value(unsigned int fd, unsigned int cmd, unsigne
#define AP(x) snd_ioctl32_##x
+enum {
+ SNDRV_CTL_IOCTL_ELEM_LIST32 = _IOWR('U', 0x10, struct sndrv_ctl_elem_list32),
+ SNDRV_CTL_IOCTL_ELEM_INFO32 = _IOWR('U', 0x11, struct sndrv_ctl_elem_info32),
+ SNDRV_CTL_IOCTL_ELEM_READ32 = _IOWR('U', 0x12, struct sndrv_ctl_elem_value32),
+ SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct sndrv_ctl_elem_value32),
+};
+
static struct ioctl32_mapper control_mappers[] = {
/* controls (without rawmidi, hwdep, timer releated ones) */
{ SNDRV_CTL_IOCTL_PVERSION, NULL },
{ SNDRV_CTL_IOCTL_CARD_INFO , NULL },
- { SNDRV_CTL_IOCTL_ELEM_LIST, AP(ctl_elem_list) },
- { SNDRV_CTL_IOCTL_ELEM_INFO, AP(ctl_elem_info) },
- { SNDRV_CTL_IOCTL_ELEM_READ, AP(ctl_elem_value) },
- { SNDRV_CTL_IOCTL_ELEM_WRITE, AP(ctl_elem_value) },
+ { SNDRV_CTL_IOCTL_ELEM_LIST32, AP(ctl_elem_list) },
+ { SNDRV_CTL_IOCTL_ELEM_INFO32, AP(ctl_elem_info) },
+ { SNDRV_CTL_IOCTL_ELEM_READ32, AP(ctl_elem_value) },
+ { SNDRV_CTL_IOCTL_ELEM_WRITE32, AP(ctl_elem_value) },
{ SNDRV_CTL_IOCTL_ELEM_LOCK, NULL },
{ SNDRV_CTL_IOCTL_ELEM_UNLOCK, NULL },
{ SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS, NULL },
@@ -314,9 +321,15 @@ extern struct ioctl32_mapper pcm_mappers[];
extern struct ioctl32_mapper rawmidi_mappers[];
extern struct ioctl32_mapper timer_mappers[];
extern struct ioctl32_mapper hwdep_mappers[];
+#ifdef CONFIG_SND_SEQUENCER
+extern struct ioctl32_mapper seq_mappers[];
+#endif
static void snd_ioctl32_done(void)
{
+#ifdef CONFIG_SND_SEQUENCER
+ snd_ioctl32_unregister(seq_mappers);
+#endif
snd_ioctl32_unregister(hwdep_mappers);
snd_ioctl32_unregister(timer_mappers);
snd_ioctl32_unregister(rawmidi_mappers);
@@ -351,6 +364,13 @@ static int __init snd_ioctl32_init(void)
snd_ioctl32_done();
return err;
}
+#ifdef CONFIG_SND_SEQUENCER
+ err = snd_ioctl32_register(seq_mappers);
+ if (err < 0) {
+ snd_ioctl32_done();
+ return err;
+ }
+#endif
}
module_init(snd_ioctl32_init)
diff --git a/sound/core/ioctl32/pcm32.c b/sound/core/ioctl32/pcm32.c
index 3aa994c7bc74..e15dc2ac60ac 100644
--- a/sound/core/ioctl32/pcm32.c
+++ b/sound/core/ioctl32/pcm32.c
@@ -262,29 +262,43 @@ static int snd_ioctl32_xfern(unsigned int fd, unsigned int cmd, unsigned long ar
#define AP(x) snd_ioctl32_##x
+enum {
+ SNDRV_PCM_IOCTL_HW_REFINE32 = _IOWR('A', 0x10, struct sndrv_pcm_hw_params32),
+ SNDRV_PCM_IOCTL_HW_PARAMS32 = _IOWR('A', 0x11, struct sndrv_pcm_hw_params32),
+ SNDRV_PCM_IOCTL_SW_PARAMS32 = _IOWR('A', 0x13, struct sndrv_pcm_sw_params32),
+ SNDRV_PCM_IOCTL_STATUS32 = _IOR('A', 0x20, struct sndrv_pcm_status32),
+ SNDRV_PCM_IOCTL_DELAY32 = _IOR('A', 0x21, s32),
+ SNDRV_PCM_IOCTL_CHANNEL_INFO32 = _IOR('A', 0x32, struct sndrv_pcm_channel_info32),
+ SNDRV_PCM_IOCTL_REWIND32 = _IOW('A', 0x46, u32),
+ SNDRV_PCM_IOCTL_WRITEI_FRAMES32 = _IOW('A', 0x50, struct sndrv_xferi32),
+ SNDRV_PCM_IOCTL_READI_FRAMES32 = _IOR('A', 0x51, struct sndrv_xferi32),
+ SNDRV_PCM_IOCTL_WRITEN_FRAMES32 = _IOW('A', 0x52, struct sndrv_xfern32),
+ SNDRV_PCM_IOCTL_READN_FRAMES32 = _IOR('A', 0x53, struct sndrv_xfern32),
+};
+
struct ioctl32_mapper pcm_mappers[] = {
{ SNDRV_PCM_IOCTL_PVERSION, NULL },
{ SNDRV_PCM_IOCTL_INFO, NULL },
- { SNDRV_PCM_IOCTL_HW_REFINE, AP(pcm_hw_params) },
- { SNDRV_PCM_IOCTL_HW_PARAMS, AP(pcm_hw_params) },
+ { SNDRV_PCM_IOCTL_HW_REFINE32, AP(pcm_hw_params) },
+ { SNDRV_PCM_IOCTL_HW_PARAMS32, AP(pcm_hw_params) },
{ SNDRV_PCM_IOCTL_HW_FREE, NULL },
- { SNDRV_PCM_IOCTL_SW_PARAMS, AP(pcm_sw_params) },
- { SNDRV_PCM_IOCTL_STATUS, AP(pcm_status) },
- { SNDRV_PCM_IOCTL_DELAY, AP(pcm_sframes_str) },
- { SNDRV_PCM_IOCTL_CHANNEL_INFO, AP(pcm_channel_info) },
+ { SNDRV_PCM_IOCTL_SW_PARAMS32, AP(pcm_sw_params) },
+ { SNDRV_PCM_IOCTL_STATUS32, AP(pcm_status) },
+ { SNDRV_PCM_IOCTL_DELAY32, AP(pcm_sframes_str) },
+ { SNDRV_PCM_IOCTL_CHANNEL_INFO32, AP(pcm_channel_info) },
{ SNDRV_PCM_IOCTL_PREPARE, NULL },
{ SNDRV_PCM_IOCTL_RESET, NULL },
{ SNDRV_PCM_IOCTL_START, NULL },
{ SNDRV_PCM_IOCTL_DROP, NULL },
{ SNDRV_PCM_IOCTL_DRAIN, NULL },
{ SNDRV_PCM_IOCTL_PAUSE, NULL },
- { SNDRV_PCM_IOCTL_REWIND, AP(pcm_uframes_str) },
+ { SNDRV_PCM_IOCTL_REWIND32, AP(pcm_uframes_str) },
{ SNDRV_PCM_IOCTL_RESUME, NULL },
{ SNDRV_PCM_IOCTL_XRUN, NULL },
- { SNDRV_PCM_IOCTL_WRITEI_FRAMES, AP(xferi) },
- { SNDRV_PCM_IOCTL_READI_FRAMES, AP(xferi) },
- { SNDRV_PCM_IOCTL_WRITEN_FRAMES, AP(xfern) },
- { SNDRV_PCM_IOCTL_READN_FRAMES, AP(xfern) },
+ { SNDRV_PCM_IOCTL_WRITEI_FRAMES32, AP(xferi) },
+ { SNDRV_PCM_IOCTL_READI_FRAMES32, AP(xferi) },
+ { SNDRV_PCM_IOCTL_WRITEN_FRAMES32, AP(xfern) },
+ { SNDRV_PCM_IOCTL_READN_FRAMES32, AP(xfern) },
{ SNDRV_PCM_IOCTL_LINK, NULL },
{ SNDRV_PCM_IOCTL_UNLINK, NULL },
diff --git a/sound/core/ioctl32/rawmidi32.c b/sound/core/ioctl32/rawmidi32.c
index d5e89ffd9f98..d8ed82222a3b 100644
--- a/sound/core/ioctl32/rawmidi32.c
+++ b/sound/core/ioctl32/rawmidi32.c
@@ -70,11 +70,16 @@ DEFINE_ALSA_IOCTL(rawmidi_status);
#define AP(x) snd_ioctl32_##x
+enum {
+ SNDRV_RAWMIDI_IOCTL_PARAMS32 = _IOWR('W', 0x10, struct sndrv_rawmidi_params32),
+ SNDRV_RAWMIDI_IOCTL_STATUS32 = _IOWR('W', 0x20, struct sndrv_rawmidi_status32),
+};
+
struct ioctl32_mapper rawmidi_mappers[] = {
{ SNDRV_RAWMIDI_IOCTL_PVERSION, NULL },
{ SNDRV_RAWMIDI_IOCTL_INFO, NULL },
- { SNDRV_RAWMIDI_IOCTL_PARAMS, AP(rawmidi_params) },
- { SNDRV_RAWMIDI_IOCTL_STATUS, AP(rawmidi_status) },
+ { SNDRV_RAWMIDI_IOCTL_PARAMS32, AP(rawmidi_params) },
+ { SNDRV_RAWMIDI_IOCTL_STATUS32, AP(rawmidi_status) },
{ SNDRV_RAWMIDI_IOCTL_DROP, NULL },
{ SNDRV_RAWMIDI_IOCTL_DRAIN, NULL },
diff --git a/sound/core/ioctl32/seq32.c b/sound/core/ioctl32/seq32.c
new file mode 100644
index 000000000000..d8ce91c477e7
--- /dev/null
+++ b/sound/core/ioctl32/seq32.c
@@ -0,0 +1,64 @@
+/*
+ * 32bit -> 64bit ioctl wrapper for sequencer API
+ * Copyright (c) by Takashi Iwai <tiwai@suse.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#define __NO_VERSION__
+#include <sound/driver.h>
+#include <linux/time.h>
+#include <sound/core.h>
+#include <sound/timer.h>
+#include <asm/uaccess.h>
+#include <sound/asequencer.h>
+#include "ioctl32.h"
+
+struct ioctl32_mapper seq_mappers[] = {
+ { SNDRV_SEQ_IOCTL_PVERSION, NULL },
+ { SNDRV_SEQ_IOCTL_CLIENT_ID, NULL },
+ { SNDRV_SEQ_IOCTL_SYSTEM_INFO, NULL },
+ { SNDRV_SEQ_IOCTL_GET_CLIENT_INFO, NULL },
+ { SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, NULL },
+ { SNDRV_SEQ_IOCTL_CREATE_PORT, NULL },
+ { SNDRV_SEQ_IOCTL_DELETE_PORT, NULL },
+ { SNDRV_SEQ_IOCTL_GET_PORT_INFO, NULL },
+ { SNDRV_SEQ_IOCTL_SET_PORT_INFO, NULL },
+ { SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT, NULL },
+ { SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT, NULL },
+ { SNDRV_SEQ_IOCTL_CREATE_QUEUE, NULL },
+ { SNDRV_SEQ_IOCTL_DELETE_QUEUE, NULL },
+ { SNDRV_SEQ_IOCTL_GET_QUEUE_INFO, NULL },
+ { SNDRV_SEQ_IOCTL_SET_QUEUE_INFO, NULL },
+ { SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE, NULL },
+ { SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS, NULL },
+ { SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO, NULL },
+ { SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO, NULL },
+ { SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER, NULL },
+ { SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER, NULL },
+ { SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER, NULL },
+ { SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER, NULL },
+ { SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT, NULL },
+ { SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT, NULL },
+ { SNDRV_SEQ_IOCTL_GET_CLIENT_POOL, NULL },
+ { SNDRV_SEQ_IOCTL_SET_CLIENT_POOL, NULL },
+ { SNDRV_SEQ_IOCTL_REMOVE_EVENTS, NULL },
+ { SNDRV_SEQ_IOCTL_QUERY_SUBS, NULL },
+ { SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION, NULL },
+ { SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT, NULL },
+ { SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT, NULL },
+ { 0 },
+};
diff --git a/sound/core/ioctl32/timer32.c b/sound/core/ioctl32/timer32.c
index 4e657f7a309f..40ee60843825 100644
--- a/sound/core/ioctl32/timer32.c
+++ b/sound/core/ioctl32/timer32.c
@@ -79,13 +79,18 @@ DEFINE_ALSA_IOCTL(timer_status);
#define AP(x) snd_ioctl32_##x
+enum {
+ SNDRV_TIMER_IOCTL_INFO32 = _IOR('T', 0x11, struct sndrv_timer_info32),
+ SNDRV_TIMER_IOCTL_STATUS32 = _IOW('T', 0x14, struct sndrv_timer_status32),
+};
+
struct ioctl32_mapper timer_mappers[] = {
{ SNDRV_TIMER_IOCTL_PVERSION, NULL },
{ SNDRV_TIMER_IOCTL_NEXT_DEVICE, NULL },
{ SNDRV_TIMER_IOCTL_SELECT, NULL },
- { SNDRV_TIMER_IOCTL_INFO, AP(timer_info) },
+ { SNDRV_TIMER_IOCTL_INFO32, AP(timer_info) },
{ SNDRV_TIMER_IOCTL_PARAMS, NULL },
- { SNDRV_TIMER_IOCTL_STATUS, AP(timer_status) },
+ { SNDRV_TIMER_IOCTL_STATUS32, AP(timer_status) },
{ SNDRV_TIMER_IOCTL_START, NULL },
{ SNDRV_TIMER_IOCTL_STOP, NULL },
{ SNDRV_TIMER_IOCTL_CONTINUE, NULL },
diff --git a/sound/core/misc.c b/sound/core/misc.c
index 2e393982fdd9..b64656fe73c3 100644
--- a/sound/core/misc.c
+++ b/sound/core/misc.c
@@ -41,7 +41,7 @@ int snd_task_name(struct task_struct *task, char *name, size_t size)
int snd_verbose_printk(const char *file, int line, const char *format)
{
if (format[0] == '<' && format[1] >= '0' && format[1] <= '9' && format[2] == '>') {
- char tmp[] = "<0>ALSA %s:%d: ";
+ char tmp[] = "<0>";
tmp[1] = format[1];
printk("%sALSA %s:%d: ", tmp, file, line);
return 1;
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 03cc8bce04b2..8b58b0e74fce 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -39,7 +39,7 @@
static int snd_dsp_map[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 0};
static int snd_adsp_map[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 1};
-static int snd_nonblock_open = 0;
+static int snd_nonblock_open;
MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, Abramo Bagnara <abramo@alsa-project.org>");
MODULE_DESCRIPTION("PCM OSS emulation for ALSA.");
@@ -1650,7 +1650,8 @@ static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file,
pcm_oss_file = snd_magic_cast(snd_pcm_oss_file_t, file->private_data, return -ENXIO);
if (cmd == OSS_GETVERSION)
return put_user(SNDRV_OSS_VERSION, (int *)arg) ? -EFAULT : 0;
- if (((cmd >> 8) & 0xff) == 'M') { /* mixer ioctl - for OSS (grrr) compatibility */
+#if defined(CONFIG_SND_MIXER_OSS) || (defined(MODULE) && defined(CONFIG_SND_MIXER_OSS_MODULE))
+ if (((cmd >> 8) & 0xff) == 'M') { /* mixer ioctl - for OSS compatibility */
snd_pcm_substream_t *substream;
int idx;
for (idx = 0; idx < 2; ++idx) {
@@ -1661,6 +1662,7 @@ static int snd_pcm_oss_ioctl(struct inode *inode, struct file *file,
snd_assert(substream != NULL, return -ENXIO);
return snd_mixer_oss_ioctl_card(substream->pcm->card, cmd, arg);
}
+#endif
if (((cmd >> 8) & 0xff) != 'P')
return -EINVAL;
switch (cmd) {
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 88381f81154b..68018ea0c7c6 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -32,7 +32,7 @@
#include <sound/pcm_params.h>
#include <sound/minors.h>
-spinlock_t pcm_link_lock = SPIN_LOCK_UNLOCKED;
+static rwlock_t pcm_link_lock = RW_LOCK_UNLOCKED;
static inline mm_segment_t snd_enter_user(void)
{
@@ -569,7 +569,7 @@ static void snd_pcm_trigger_time(snd_pcm_substream_t *substream)
#define _SND_PCM_ACTION(aname, substream, state, res, check_master) { \
snd_pcm_substream_t *s; \
res = 0; \
- spin_lock(&pcm_link_lock); \
+ read_lock(&pcm_link_lock); \
s = substream; \
do { \
if (s != substream) \
@@ -606,7 +606,7 @@ static void snd_pcm_trigger_time(snd_pcm_substream_t *substream)
s = s->link_next; \
} while (s != substream); \
_end: \
- spin_unlock(&pcm_link_lock); \
+ read_unlock(&pcm_link_lock); \
}
#define SND_PCM_ACTION(aname, substream, state) { \
@@ -965,7 +965,7 @@ int snd_pcm_prepare(snd_pcm_substream_t *substream)
static void snd_pcm_change_state(snd_pcm_substream_t *substream, int state)
{
snd_pcm_substream_t *s;
- spin_lock(&pcm_link_lock);
+ read_lock(&pcm_link_lock);
s = substream->link_next;
while (s != substream) {
spin_lock(&s->runtime->lock);
@@ -979,7 +979,7 @@ static void snd_pcm_change_state(snd_pcm_substream_t *substream, int state)
spin_unlock(&runtime->lock);
s = s->link_next;
} while (s != substream);
- spin_unlock(&pcm_link_lock);
+ read_unlock(&pcm_link_lock);
}
static int snd_pcm_playback_drop(snd_pcm_substream_t *substream);
@@ -1277,7 +1277,7 @@ static int snd_pcm_link(snd_pcm_substream_t *substream, int fd)
return -EBADFD;
pcm_file = snd_magic_cast(snd_pcm_file_t, file->private_data, return -ENXIO);
substream1 = pcm_file->substream;
- spin_lock_irq(&pcm_link_lock);
+ write_lock_irq(&pcm_link_lock);
if (substream->runtime->status->state != substream1->runtime->status->state) {
res = -EBADFD;
goto _end;
@@ -1295,19 +1295,19 @@ static int snd_pcm_link(snd_pcm_substream_t *substream, int fd)
substream->link_next = substream1;
substream1->link_prev = substream;
_end:
- spin_unlock_irq(&pcm_link_lock);
+ write_unlock_irq(&pcm_link_lock);
fput(file);
return res;
}
static int snd_pcm_unlink(snd_pcm_substream_t *substream)
{
- spin_lock_irq(&pcm_link_lock);
+ write_lock_irq(&pcm_link_lock);
substream->link_prev->link_next = substream->link_next;
substream->link_next->link_prev = substream->link_prev;
substream->link_prev = substream;
substream->link_next = substream;
- spin_unlock_irq(&pcm_link_lock);
+ write_unlock_irq(&pcm_link_lock);
return 0;
}
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 9c6a7c0a979f..96be7fd0a615 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -143,6 +143,7 @@ int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream)
break;
}
if (runtime->avail < runtime->buffer_size && !timeout) {
+ snd_printk(KERN_WARNING "rawmidi drain error (avail = %li, buffer_size = %li)\n", runtime->avail, runtime->buffer_size);
err = -EIO;
break;
}
@@ -335,10 +336,14 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
return 0;
__error:
- if (input != NULL)
+ if (input != NULL) {
+ snd_rawmidi_done_buffer(input);
kfree(input);
- if (output != NULL)
+ }
+ if (output != NULL) {
+ snd_rawmidi_done_buffer(output);
kfree(output);
+ }
dec_mod_count(rmidi->card->module);
up(&rmidi->open_mutex);
__error1:
@@ -820,7 +825,7 @@ void snd_rawmidi_receive_reset(snd_rawmidi_substream_t * substream)
/* TODO: reset current state */
}
-int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count)
+int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char *buffer, int count)
{
unsigned long flags;
int result = 0, count1;
@@ -1100,8 +1105,10 @@ static long snd_rawmidi_kernel_write1(snd_rawmidi_substream_t * substream, const
__end:
if (result > 0)
runtime->trigger = 1;
+ count1 = runtime->avail < runtime->buffer_size;
spin_unlock_irqrestore(&runtime->lock, flags);
- substream->ops->trigger(substream, 1);
+ if (count1)
+ substream->ops->trigger(substream, 1);
return result;
}
diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c
index b4610de3d099..68e4f7cb6587 100644
--- a/sound/core/rtctimer.c
+++ b/sound/core/rtctimer.c
@@ -76,7 +76,9 @@ static struct tasklet_struct rtc_tq;
static int
rtctimer_open(snd_timer_t *t)
{
- int err = rtc_register(&rtc_task);
+ int err;
+
+ err = rtc_register(&rtc_task);
if (err < 0)
return err;
t->private_data = &rtc_task;
diff --git a/sound/core/seq/Makefile b/sound/core/seq/Makefile
index 569cd0ae110f..07481aa792c6 100644
--- a/sound/core/seq/Makefile
+++ b/sound/core/seq/Makefile
@@ -23,8 +23,7 @@ export-objs := seq_device.o seq.o seq_ports.o seq_instr.o seq_midi_emul.o \
snd-seq-device-objs := seq_device.o
snd-seq-objs := seq.o seq_lock.o seq_clientmgr.o seq_memory.o seq_queue.o \
seq_fifo.o seq_prioq.o seq_timer.o \
- seq_system.o seq_ports.o seq_info.o seq_sync.o \
- seq_midi_clock.o seq_mtc.o seq_dtl.o
+ seq_system.o seq_ports.o seq_info.o
snd-seq-midi-objs := seq_midi.o
snd-seq-midi-emul-objs := seq_midi_emul.o
snd-seq-midi-event-objs := seq_midi_event.o
@@ -38,6 +37,7 @@ obj-$(CONFIG_SND_SEQ_DUMMY) += snd-seq-dummy.o
# Toplevel Module Dependency
obj-$(CONFIG_SND_VIRMIDI) += snd-seq-virmidi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o
+obj-$(CONFIG_SND_SERIAL_U16550) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o
obj-$(CONFIG_SND_MTPAV) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o
obj-$(CONFIG_SND_MPU401) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o
obj-$(CONFIG_SND_ALS100) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o
diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
index 0026ff223678..7070a4093c81 100644
--- a/sound/core/seq/oss/seq_oss_init.c
+++ b/sound/core/seq/oss/seq_oss_init.c
@@ -40,7 +40,7 @@ static int system_client = -1; /* ALSA sequencer client number */
static int system_port = -1;
int maxqlen = SNDRV_SEQ_OSS_MAX_QLEN;
-static int num_clients = 0;
+static int num_clients;
static seq_oss_devinfo_t *client_table[SNDRV_SEQ_OSS_MAX_CLIENTS];
diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c
index fe3bfff2a868..274909b3cf49 100644
--- a/sound/core/seq/oss/seq_oss_midi.c
+++ b/sound/core/seq/oss/seq_oss_midi.c
@@ -54,7 +54,7 @@ struct seq_oss_midi_t {
/*
* midi device table
*/
-static int max_midi_devs = 0;
+static int max_midi_devs;
static seq_oss_midi_t *midi_devs[SNDRV_SEQ_OSS_MAX_MIDI_DEVS];
static spinlock_t register_lock = SPIN_LOCK_UNLOCKED;
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c
index 26a6924aaee3..d07708363a4c 100644
--- a/sound/core/seq/oss/seq_oss_synth.c
+++ b/sound/core/seq/oss/seq_oss_synth.c
@@ -66,7 +66,7 @@ struct seq_oss_synth_t {
/*
* device table
*/
-static int max_synth_devs = 0;
+static int max_synth_devs;
static seq_oss_synth_t *synth_devs[SNDRV_SEQ_OSS_MAX_SYNTH_DEVS];
static seq_oss_synth_t midi_synth_dev = {
-1, /* seq_device */
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c
index 1798f2a6ec0c..31b384d14118 100644
--- a/sound/core/seq/seq_device.c
+++ b/sound/core/seq/seq_device.c
@@ -82,7 +82,7 @@ struct ops_list {
static LIST_HEAD(opslist);
-static int num_ops = 0;
+static int num_ops;
static DECLARE_MUTEX(ops_mutex);
static snd_info_entry_t *info_entry = NULL;
diff --git a/sound/core/seq/seq_dtl.c b/sound/core/seq/seq_dtl.c
deleted file mode 100644
index c41c97835674..000000000000
--- a/sound/core/seq/seq_dtl.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * DTL(e) event converter
- *
- * Copyright (c) 2000 by Takashi Iwai <tiwai@suse.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#define __NO_VERSION__
-#include <sound/driver.h>
-#include <sound/core.h>
-#include "seq_queue.h"
-
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
-
-typedef struct dtl_out {
- int out_mtp_network;
- unsigned int time_format;
- unsigned int full_frame_count;
- unsigned char sysex[11];
-} dtl_out_t;
-
-typedef struct dtl_in {
- unsigned int time_format;
- unsigned int cur_pos;
-} dtl_in_t;
-
-
-static int dtl_open_out(queue_sync_t *sync_info, seq_sync_arg_t *retp)
-{
- dtl_out_t *arg;
-
- if (sync_info->time_format >= 4)
- return -EINVAL;
- if ((arg = kmalloc(sizeof(*arg), GFP_KERNEL)) == NULL)
- return -ENOMEM;
- arg->out_mtp_network = sync_info->opt_info[0];
- arg->full_frame_count = sync_info->opt_info[1];
- arg->time_format = sync_info->time_format;
- sync_info->param.time.subframes = 1; /* MTC uses quarter frame */
- sync_info->param.time.resolution = snd_seq_get_smpte_resolution(arg->time_format);
- *retp = arg;
- return 0;
-}
-
-static int dtl_open_in(queue_sync_t *sync_info, seq_sync_arg_t *retp)
-{
- dtl_in_t *arg;
-
- if (sync_info->time_format >= 4)
- return -EINVAL;
- if ((arg = kmalloc(sizeof(*arg), GFP_KERNEL)) == NULL)
- return -ENOMEM;
- arg->time_format = sync_info->time_format;
- arg->cur_pos = 0;
- sync_info->param.time.subframes = 1; /* MTC uses quarter frame */
- sync_info->param.time.resolution = snd_seq_get_smpte_resolution(arg->time_format);
- *retp = arg;
- return 0;
-}
-
-
-/* decode sync position */
-static int sync_pos_out(dtl_out_t *arg, const snd_seq_event_t *src, snd_seq_event_t *ev)
-{
- sndrv_seq_time_frame_t cur_out;
- unsigned char *buf = arg->sysex;
-
- if (arg->time_format != src->data.queue.sync_time_format)
- return -EINVAL;
-
- cur_out = snd_seq_position_to_time_frame(arg->time_format, 1, src->data.queue.param.position);
- buf[0] = 0xf0; /* SYSEX */
- buf[1] = 0x00; /* MOTU */
- buf[2] = 0x33; /* MOTU */
- buf[3] = 0x7f;
- buf[4] = 0x0c; /* DTL full frame */
- buf[5] = arg->out_mtp_network; /* 0x00 or 0x08 */
- buf[6] = cur_out.hour | (arg->time_format << 5);
- buf[7] = cur_out.min;
- buf[8] = cur_out.sec;
- buf[9] = cur_out.frame;
- buf[10] = 0xf7;
-
- ev->type = SNDRV_SEQ_EVENT_SYSEX;
- ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK;
- ev->flags |= SNDRV_SEQ_EVENT_LENGTH_VARIABLE;
- ev->data.ext.len = 11;
- ev->data.ext.ptr = buf;
-
- return 1;
-}
-
-/* decode sync signal */
-static int sync_out(dtl_out_t *arg, const snd_seq_event_t *src, snd_seq_event_t *ev)
-{
- unsigned int pos;
-
- if (arg->time_format != src->data.queue.sync_time_format)
- return -EINVAL;
- pos = src->data.queue.param.position;
- if (arg->full_frame_count &&
- (pos % arg->full_frame_count) == 0)
- /* send full frame */
- return sync_pos_out(arg, src, ev);
- ev->type = SNDRV_SEQ_EVENT_CLOCK;
- return 1;
-}
-
-static int dtl_sync_out(seq_sync_arg_t _arg, const snd_seq_event_t *src, snd_seq_event_t *ev)
-{
- dtl_out_t *arg = _arg;
- switch (src->type) {
- case SNDRV_SEQ_EVENT_SYNC:
- return sync_out(arg, src, ev);
- case SNDRV_SEQ_EVENT_SYNC_POS:
- return sync_pos_out(arg, src, ev);
- }
- return 0;
-}
-
-/* decode sync position */
-static int sync_pos_in(dtl_in_t *arg, const snd_seq_event_t *src, snd_seq_event_t *ev)
-{
- unsigned time_format;
- static unsigned char id[] = {
- 0xf0, 0x00, 0x33, 0x7f, 0x0c,
- };
- sndrv_seq_time_frame_t cur_in;
- char buf[11];
-
- if (snd_seq_expand_var_event(src, 11, buf, 1, 0) != 11)
- return 0;
- if (memcmp(buf, id, sizeof(id)) != 0)
- return 0;
- time_format = (buf[6] >> 5) & 3;
- if (time_format != arg->time_format)
- return -EINVAL;
- cur_in.hour = buf[6] & 0x1f;
- cur_in.min = buf[7];
- cur_in.sec = buf[8];
- cur_in.frame = buf[9];
- arg->cur_pos = snd_seq_time_frame_to_position(time_format, 1, &cur_in);
-
- ev->type = SNDRV_SEQ_EVENT_SYNC_POS;
- ev->data.queue.sync_time_format = time_format;
- ev->data.queue.param.position = arg->cur_pos;
-
- return 1;
-}
-
-static int dtl_sync_in(seq_sync_arg_t _arg, const snd_seq_event_t *src, snd_seq_event_t *ev)
-{
- dtl_in_t *arg = _arg;
- switch (src->type) {
- case SNDRV_SEQ_EVENT_CLOCK:
- arg->cur_pos++;
- ev->type = SNDRV_SEQ_EVENT_SYNC;
- ev->data.queue.param.position = arg->cur_pos;
- return 1;
- case SNDRV_SEQ_EVENT_SYSEX:
- return sync_pos_in(arg, src, ev);
- }
- return 0;
-}
-
-/* exported */
-seq_sync_parser_t snd_seq_dtl_parser = {
- format: SNDRV_SEQ_SYNC_FMT_DTL,
- in: {
- open: dtl_open_in,
- sync: dtl_sync_in,
- },
- out: {
- open: dtl_open_out,
- sync: dtl_sync_out,
- },
-};
-
-#endif /* SNDRV_SEQ_SYNC_SUPPORT */
diff --git a/sound/core/seq/seq_midi_clock.c b/sound/core/seq/seq_midi_clock.c
deleted file mode 100644
index f27ad5a0bb04..000000000000
--- a/sound/core/seq/seq_midi_clock.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * MIDI clock event converter
- *
- * Copyright (c) 2000 by Takashi Iwai <tiwai@suse.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#define __NO_VERSION__
-#include <sound/driver.h>
-#include <sound/core.h>
-#include "seq_queue.h"
-
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
-
-typedef struct midi_clock {
- unsigned int cur_pos;
-} midi_clock_t;
-
-static int midi_open(queue_sync_t *sync_info, seq_sync_arg_t *retp)
-{
- midi_clock_t *arg;
-
- if ((arg = kmalloc(sizeof(*arg), GFP_KERNEL)) == NULL)
- return -ENOMEM;
- sync_info->param.tick.ppq = 24;
- sync_info->param.tick.ticks = 1;
- arg->cur_pos = 0;
- *retp = arg;
- return 0;
-}
-
-static int midi_sync_out(seq_sync_arg_t _arg, const snd_seq_event_t *src, snd_seq_event_t *ev)
-{
- switch (src->type) {
- case SNDRV_SEQ_EVENT_SYNC:
- ev->type = SNDRV_SEQ_EVENT_CLOCK;
- return 1;
- case SNDRV_SEQ_EVENT_SYNC_POS:
- ev->type = SNDRV_SEQ_EVENT_SONGPOS;
- ev->data.control.value = src->data.queue.param.position / 6;
- return 1;
- }
- return 0;
-}
-
-static int midi_sync_in(seq_sync_arg_t _arg, const snd_seq_event_t *src, snd_seq_event_t *ev)
-{
- midi_clock_t *arg = _arg;
- switch (src->type) {
- case SNDRV_SEQ_EVENT_CLOCK:
- ev->type = SNDRV_SEQ_EVENT_SYNC;
- ev->data.queue.param.position = arg->cur_pos;
- arg->cur_pos++;
- return 1;
- case SNDRV_SEQ_EVENT_SONGPOS:
- ev->type = SNDRV_SEQ_EVENT_SYNC_POS;
- arg->cur_pos = src->data.control.value * 6;
- ev->data.queue.param.position = arg->cur_pos;
- return 1;
- }
- return 0;
-}
-
-/* exported */
-seq_sync_parser_t snd_seq_midi_clock_parser = {
- format: SNDRV_SEQ_SYNC_FMT_MIDI_CLOCK,
- in: {
- open: midi_open,
- sync: midi_sync_in,
- },
- out: {
- open: midi_open,
- sync: midi_sync_out,
- },
-};
-
-#endif /* SNDRV_SEQ_SYNC_SUPPORT */
diff --git a/sound/core/seq/seq_mtc.c b/sound/core/seq/seq_mtc.c
deleted file mode 100644
index 25e1d609da6a..000000000000
--- a/sound/core/seq/seq_mtc.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * MTC event converter
- *
- * Copyright (c) 2000 by Takashi Iwai <tiwai@suse.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#define __NO_VERSION__
-#include <sound/driver.h>
-#include <sound/core.h>
-#include "seq_queue.h"
-
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
-
-typedef struct mtc_out {
- int out_channel;
- unsigned int time_format;
- sndrv_seq_time_frame_t cur_time;
- unsigned int decode_offset;
- unsigned char sysex[10];
-} mtc_out_t;
-
-typedef struct mtc_in {
- unsigned int time_format;
- sndrv_seq_time_frame_t cur_time;
- unsigned int cur_pos;
- int prev_in_offset;
-} mtc_in_t;
-
-
-static int mtc_open_out(queue_sync_t *sync_info, seq_sync_arg_t *retp)
-{
- mtc_out_t *arg;
-
- if (sync_info->time_format >= 4)
- return -EINVAL;
- if ((arg = kmalloc(sizeof(*arg), GFP_KERNEL)) == NULL)
- return -ENOMEM;
- arg->out_channel = sync_info->opt_info[0];
- if (arg->out_channel == 0)
- arg->out_channel = 127;
- arg->time_format = sync_info->time_format;
- sync_info->param.time.subframes = 4; /* MTC uses quarter frame */
- sync_info->param.time.resolution = snd_seq_get_smpte_resolution(arg->time_format);
- memset(&arg->cur_time, 0, sizeof(arg->cur_time));
- *retp = arg;
- return 0;
-}
-
-static int mtc_open_in(queue_sync_t *sync_info, seq_sync_arg_t *retp)
-{
- mtc_in_t *arg;
-
- if (sync_info->time_format >= 4)
- return -EINVAL;
- if ((arg = kmalloc(sizeof(*arg), GFP_KERNEL)) == NULL)
- return -ENOMEM;
- arg->time_format = sync_info->time_format;
- memset(&arg->cur_time, 0, sizeof(arg->cur_time));
- arg->cur_pos = 0;
- arg->prev_in_offset = -1;
- sync_info->param.time.subframes = 4; /* MTC uses quarter frame */
- sync_info->param.time.resolution = snd_seq_get_smpte_resolution(arg->time_format);
- *retp = arg;
- return 0;
-}
-
-
-/* decode sync signal */
-static int sync_out(mtc_out_t *arg, const snd_seq_event_t *src, snd_seq_event_t *ev)
-{
- int val, offset;
-
- if (arg->time_format != src->data.queue.sync_time_format)
- return -EINVAL;
- offset = (src->data.queue.param.position + arg->decode_offset) % 8;
- if (offset == 0) {
- /* convert and remember the current time
- for the following 7 MTC quarter frames */
- arg->cur_time = snd_seq_position_to_time_frame(arg->time_format, 4, src->data.queue.param.position);
- }
- switch (offset) {
- case 0: val = arg->cur_time.frame & 0x0f; break;
- case 1: val = (arg->cur_time.frame >> 4) & 0x0f; break;
- case 2: val = arg->cur_time.sec & 0x0f; break;
- case 3: val = (arg->cur_time.sec >> 4) & 0x0f; break;
- case 4: val = arg->cur_time.min & 0x0f; break;
- case 5: val = (arg->cur_time.min >> 4) & 0x0f; break;
- case 6: val = arg->cur_time.hour & 0x0f; break;
- case 7:
- default:
- val = ((arg->cur_time.hour >> 4) & 0x01) | (arg->time_format << 1);
- break;
- }
- val |= (offset << 4);
- ev->type = SNDRV_SEQ_EVENT_QFRAME;
- ev->data.control.value = val;
- return 1;
-}
-
-/* decode sync position */
-static int sync_pos_out(mtc_out_t *arg, const snd_seq_event_t *src, snd_seq_event_t *ev)
-{
- unsigned int pos;
- unsigned char *buf = arg->sysex;
-
- if (arg->time_format != src->data.queue.sync_time_format)
- return -EINVAL;
-
- pos = src->data.queue.param.position; /* quarter frames */
- arg->decode_offset = pos & 4;
- pos /= 4;
- arg->cur_time = snd_seq_position_to_time_frame(arg->time_format, 4, pos);
-
- buf[0] = 0xf0; /* SYSEX */
- buf[1] = 0x7f;
- buf[2] = arg->out_channel;
- buf[3] = 0x01;
- buf[4] = 0x01;
- buf[5] = arg->cur_time.hour | (arg->time_format << 5);
- buf[6] = arg->cur_time.min;
- buf[7] = arg->cur_time.sec;
- buf[8] = arg->cur_time.frame;
- buf[9] = 0xf7;
-
- ev->type = SNDRV_SEQ_EVENT_SYSEX;
- ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK;
- ev->flags |= SNDRV_SEQ_EVENT_LENGTH_VARIABLE;
- ev->data.ext.len = 10;
- ev->data.ext.ptr = buf;
-
- return 1;
-}
-
-static int mtc_sync_out(seq_sync_arg_t _arg, const snd_seq_event_t *src, snd_seq_event_t *ev)
-{
- mtc_out_t *arg = _arg;
- switch (src->type) {
- case SNDRV_SEQ_EVENT_SYNC:
- return sync_out(arg, src, ev);
- case SNDRV_SEQ_EVENT_SYNC_POS:
- return sync_pos_out(arg, src, ev);
- }
- return 0;
-}
-
-/* decode sync signal */
-static int sync_in(mtc_in_t *arg, const snd_seq_event_t *src, snd_seq_event_t *ev)
-{
- int val, offset;
- unsigned int time_format;
-
- offset = (src->data.control.value & 0x70) >> 4;
- val = src->data.control.value & 0x0f;
- if (offset > 0 && offset != arg->prev_in_offset + 1) {
- /* bad quarter frame message - something missing.. */
- arg->prev_in_offset = -1; /* wait for next 0 */
- return -EINVAL;
- }
- switch (offset) {
- case 0: arg->cur_time.frame = val; break;
- case 1: arg->cur_time.frame |= (val << 4); break;
- case 2: arg->cur_time.sec = val; break;
- case 3: arg->cur_time.sec |= (val << 4); break;
- case 4: arg->cur_time.min = val; break;
- case 5: arg->cur_time.min |= (val << 4); break;
- case 6: arg->cur_time.hour = val; break;
- case 7:
- default:
- arg->cur_time.hour |= (val & 1) << 4;
- time_format = (val >> 1) & 3;
- if (time_format != arg->time_format)
- return -EINVAL;
- arg->cur_pos = snd_seq_time_frame_to_position(time_format, 4, &arg->cur_time);
- arg->cur_pos += 7; /* correct the receive time */
- break;
- }
-
- ev->type = SNDRV_SEQ_EVENT_SYNC;
- ev->data.queue.sync_time_format = arg->time_format;
- ev->data.queue.param.position = arg->cur_pos;
- arg->cur_pos++;
-
- return 1; /* composed */
-}
-
-/* decode sync position */
-static int sync_pos_in(mtc_in_t *arg, const snd_seq_event_t *src, snd_seq_event_t *ev)
-{
- unsigned time_format;
- char buf[10];
-
- if (snd_seq_expand_var_event(src, 10, buf, 1, 0) != 10)
- return 0;
- if (buf[1] != 0x7f || buf[3] != 0x01 || buf[4] != 0x01)
- return 0;
- time_format = (buf[5] >> 5) & 3;
- if (time_format != arg->time_format)
- return -EINVAL;
- arg->cur_time.hour = buf[5] & 0x1f;
- arg->cur_time.min = buf[6];
- arg->cur_time.sec = buf[7];
- arg->cur_time.frame = buf[8];
- arg->cur_pos = snd_seq_time_frame_to_position(time_format, 4, &arg->cur_time);
-
- ev->type = SNDRV_SEQ_EVENT_SYNC_POS;
- ev->data.queue.sync_time_format = time_format;
- ev->data.queue.param.position = arg->cur_pos;
-
- return 1; /* composed */
-}
-
-static int mtc_sync_in(seq_sync_arg_t _arg, const snd_seq_event_t *src, snd_seq_event_t *ev)
-{
- mtc_in_t *arg = _arg;
- switch (src->type) {
- case SNDRV_SEQ_EVENT_QFRAME:
- return sync_in(arg, src, ev);
- case SNDRV_SEQ_EVENT_SYSEX:
- return sync_pos_in(arg, src, ev);
- }
- return 0;
-}
-
-/* exported */
-seq_sync_parser_t snd_seq_mtc_parser = {
- format: SNDRV_SEQ_SYNC_FMT_MTC,
- in: {
- open: mtc_open_in,
- sync: mtc_sync_in,
- },
- out: {
- open: mtc_open_out,
- sync: mtc_sync_out,
- },
-};
-
-#endif /* SNDRV_SEQ_SYNC_SUPPORT */
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
index 52993503185a..7cd9beb91909 100644
--- a/sound/core/seq/seq_queue.c
+++ b/sound/core/seq/seq_queue.c
@@ -48,18 +48,13 @@
#include "seq_timer.h"
#include "seq_info.h"
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
-/* FIXME: this should be in a header file */
-void snd_seq_sync_info_read(queue_t *q, snd_info_buffer_t *buffer);
-#endif
-
static void snd_seq_check_queue_in_tasklet(unsigned long private_data);
/* list of allocated queues */
static queue_t *queue_list[SNDRV_SEQ_MAX_QUEUES];
static spinlock_t queue_list_lock = SPIN_LOCK_UNLOCKED;
/* number of queues allocated */
-static int num_queues = 0;
+static int num_queues;
int snd_seq_queue_get_cur_queues(void)
{
@@ -147,23 +142,12 @@ static queue_t *queue_new(int owner, int locked)
q->locked = locked;
q->klocked = 0;
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- q->master_lock = RW_LOCK_UNLOCKED;
- q->slave_lock = RW_LOCK_UNLOCKED;
- INIT_LIST_HEAD(&q->master_head);
- q->slave.format = 0;
-#endif
-
return q;
}
/* delete queue (destructor) */
static void queue_delete(queue_t *q)
{
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- if (q->info_flags & SNDRV_SEQ_QUEUE_FLG_SYNC)
- snd_seq_sync_delete_port(q);
-#endif
/* stop and release the timer */
snd_seq_timer_stop(q->timer);
snd_seq_timer_close(q);
@@ -218,12 +202,6 @@ int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags)
return -ENOMEM;
}
snd_seq_queue_use(q->queue, client, 1); /* use this queue */
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- if (q->info_flags & SNDRV_SEQ_QUEUE_FLG_SYNC) {
- if (snd_seq_sync_create_port(q) < 0)
- q->info_flags &= ~SNDRV_SEQ_QUEUE_FLG_SYNC;
- }
-#endif
return q->queue;
}
@@ -547,9 +525,6 @@ int snd_seq_queue_timer_set_tempo(int queueid, int client, snd_seq_queue_tempo_t
result = snd_seq_timer_set_ppq(q->timer, info->ppq);
if (result >= 0 && info->skew_base > 0)
result = snd_seq_timer_set_skew(q->timer, info->skew_value, info->skew_base);
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- snd_seq_sync_update_tempo(q);
-#endif
queue_access_unlock(q);
queuefree(q);
return result;
@@ -724,14 +699,6 @@ static void queue_broadcast_event(queue_t *q, snd_seq_event_t *ev, int from_time
sev.dest.client = SNDRV_SEQ_ADDRESS_SUBSCRIBERS;
snd_seq_kernel_client_dispatch(SNDRV_SEQ_CLIENT_SYSTEM, &sev, atomic, hop);
}
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- if (q->info_flags & SNDRV_SEQ_QUEUE_FLG_SYNC) {
- /* broadcast events also to slave clients */
- sev.source = q->sync_port;
- sev.dest.client = SNDRV_SEQ_ADDRESS_SUBSCRIBERS;
- snd_seq_kernel_client_dispatch(SNDRV_SEQ_CLIENT_SYSTEM, &sev, atomic, hop);
- }
-#endif
}
/*
@@ -744,24 +711,13 @@ void snd_seq_queue_process_event(queue_t *q, snd_seq_event_t *ev, int from_timer
case SNDRV_SEQ_EVENT_START:
snd_seq_prioq_leave(q->tickq, ev->source.client, 1);
snd_seq_prioq_leave(q->timeq, ev->source.client, 1);
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- snd_seq_sync_clear(q);
-#endif
snd_seq_timer_start(q->timer);
queue_broadcast_event(q, ev, from_timer_port, atomic, hop);
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- q->flags &= ~SNDRV_SEQ_QUEUE_FLG_SYNC_LOST;
- snd_seq_sync_check(q, 0, atomic, hop); /* trigger the first signal */
-#endif
break;
case SNDRV_SEQ_EVENT_CONTINUE:
snd_seq_timer_continue(q->timer);
queue_broadcast_event(q, ev, from_timer_port, atomic, hop);
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- q->flags &= ~SNDRV_SEQ_QUEUE_FLG_SYNC_LOST;
- snd_seq_sync_check(q, 0, atomic, hop);
-#endif
break;
case SNDRV_SEQ_EVENT_STOP:
@@ -771,26 +727,17 @@ void snd_seq_queue_process_event(queue_t *q, snd_seq_event_t *ev, int from_timer
case SNDRV_SEQ_EVENT_TEMPO:
snd_seq_timer_set_tempo(q->timer, ev->data.queue.param.value);
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- snd_seq_sync_update_tempo(q);
-#endif
queue_broadcast_event(q, ev, from_timer_port, atomic, hop);
break;
case SNDRV_SEQ_EVENT_SETPOS_TICK:
if (snd_seq_timer_set_position_tick(q->timer, ev->data.queue.param.time.tick) == 0) {
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- snd_seq_sync_update_tick(q, 0, atomic, hop);
-#endif
queue_broadcast_event(q, ev, from_timer_port, atomic, hop);
}
break;
case SNDRV_SEQ_EVENT_SETPOS_TIME:
if (snd_seq_timer_set_position_time(q->timer, ev->data.queue.param.time.time) == 0) {
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- snd_seq_sync_update_time(q, 0, atomic, hop);
-#endif
queue_broadcast_event(q, ev, from_timer_port, atomic, hop);
}
break;
@@ -864,9 +811,6 @@ void snd_seq_info_queues_read(snd_info_entry_t *entry,
snd_iprintf(buffer, "current time : %d.%09d s\n", tmr->cur_time.tv_sec, tmr->cur_time.tv_nsec);
snd_iprintf(buffer, "current tick : %d\n", tmr->tick.cur_tick);
snd_iprintf(buffer, "\n");
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- snd_seq_sync_info_read(q, buffer);
-#endif
queuefree(q);
}
}
diff --git a/sound/core/seq/seq_queue.h b/sound/core/seq/seq_queue.h
index 4783d6e43ace..82139c43e9bf 100644
--- a/sound/core/seq/seq_queue.h
+++ b/sound/core/seq/seq_queue.h
@@ -24,9 +24,6 @@
#include "seq_prioq.h"
#include "seq_timer.h"
#include "seq_lock.h"
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
-#include "seq_sync.h"
-#endif
#include <linux/interrupt.h>
#include <linux/list.h>
@@ -61,16 +58,6 @@ struct _snd_seq_queue {
snd_use_lock_t use_lock;
struct tasklet_struct taskq;
-
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- struct list_head master_head; /* list of masters */
- queue_sync_t slave; /* slave (exclusive) */
-
- rwlock_t master_lock;
- rwlock_t slave_lock;
-
- snd_seq_addr_t sync_port; /* address of the attached sync port */
-#endif
};
diff --git a/sound/core/seq/seq_sync.c b/sound/core/seq/seq_sync.c
deleted file mode 100644
index a2c19bbc4051..000000000000
--- a/sound/core/seq/seq_sync.c
+++ /dev/null
@@ -1,1006 +0,0 @@
-/*
- * ALSA sequencer queue synchronization routine
- *
- * Copyright (c) 2000 by Takashi Iwai <tiwai@suse.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#define __NO_VERSION__
-#include <sound/driver.h>
-#include <sound/core.h>
-
-#include "seq_memory.h"
-#include "seq_queue.h"
-#include "seq_clientmgr.h"
-#include "seq_fifo.h"
-#include "seq_timer.h"
-#include "seq_info.h"
-
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
-
-#define FOR_EACH_LIST(var,list) \
-for (var = (list)->next; var != list; var = var->next)
-
-/*
- * callbacks
- */
-static int event_input_sync(snd_seq_event_t * ev, int direct, void *private_data, int atomic, int hop);
-static int queue_master_add(void *private_data, snd_seq_port_subscribe_t *subs);
-static int queue_master_remove(void *private_data, snd_seq_port_subscribe_t *subs);
-static void queue_delete_all_masters(queue_t *q);
-static int queue_slave_set(void *private_data, snd_seq_port_subscribe_t *subs);
-static int queue_slave_reset(void *private_data, snd_seq_port_subscribe_t *subs);
-static void queue_sync_close_parser(queue_sync_t *sync, int slave);
-
-/*
- * pre-defined event parsers
- */
-
-extern seq_sync_parser_t snd_seq_midi_clock_parser; /* seq_midi_clock.c */
-extern seq_sync_parser_t snd_seq_mtc_parser; /* seq_mtc.c */
-extern seq_sync_parser_t snd_seq_dtl_parser; /* seq_dtl.c */
-
-static seq_sync_parser_t *event_parsers[] = {
- &snd_seq_midi_clock_parser,
- &snd_seq_mtc_parser,
- &snd_seq_dtl_parser,
- NULL
-};
-
-/*
- * create a sync port corresponding to the specified queue
- */
-int snd_seq_sync_create_port(queue_t *queue)
-{
- snd_seq_port_info_t port;
- snd_seq_port_callback_t pcallbacks;
-
- memset(&pcallbacks, 0, sizeof(pcallbacks));
- memset(&port, 0, sizeof(port));
- pcallbacks.owner = THIS_MODULE;
- pcallbacks.event_input = event_input_sync;
- pcallbacks.subscribe = queue_master_add;
- pcallbacks.unsubscribe = queue_master_remove;
- pcallbacks.use = queue_slave_set;
- pcallbacks.unuse = queue_slave_reset;
- pcallbacks.private_data = queue;
- pcallbacks.callback_all = 1; /* call callbacks at each subscription */
- port.capability = SNDRV_SEQ_PORT_CAP_READ|SNDRV_SEQ_PORT_CAP_SUBS_READ|
- SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_SUBS_WRITE|
- SNDRV_SEQ_PORT_CAP_DUPLEX|
- SNDRV_SEQ_PORT_CAP_SYNC_READ|SNDRV_SEQ_PORT_CAP_SYNC_WRITE;
- port.type = 0;
- sprintf(port.name, "Sync Queue %d", queue->queue);
- port.kernel = &pcallbacks;
- port.flags = SNDRV_SEQ_PORT_FLG_GIVEN_PORT;
- port.port = snd_seq_queue_sync_port(queue->queue);
- if (snd_seq_kernel_client_ctl(SNDRV_SEQ_CLIENT_SYSTEM, SNDRV_SEQ_IOCTL_CREATE_PORT, &port) < 0)
- return -ENOMEM;
- queue->sync_port.client = SNDRV_SEQ_CLIENT_SYSTEM;
- queue->sync_port.port = port.port;
- return 0;
-}
-
-/*
- * delete attached sync port to the queue
- */
-int snd_seq_sync_delete_port(queue_t *queue)
-{
- snd_seq_port_info_t port;
-
- memset(&port, 0, sizeof(port));
- port.client = queue->sync_port.client;
- port.port = queue->sync_port.port;
- if (snd_seq_kernel_client_ctl(SNDRV_SEQ_CLIENT_SYSTEM, SNDRV_SEQ_IOCTL_DELETE_PORT, &port) < 0)
- return -ENOMEM;
- queue_delete_all_masters(queue);
- queue_sync_close_parser(&queue->slave, 1);
- return 0;
-}
-
-
-/*
- * send a sync signal to the sync slave client
- */
-static void queue_send_sync_event(queue_t *q, queue_sync_t *master, int type, int atomic, int hop)
-{
- snd_seq_event_t event;
-
- memset(&event, 0, sizeof(event));
-
- event.flags = SNDRV_SEQ_TIME_MODE_ABS;
- /* since we use direct delivery, we have to convert time stamp here.. */
- switch (master->format & SNDRV_SEQ_SYNC_MODE) {
- case SNDRV_SEQ_SYNC_TICK:
- event.flags |= SNDRV_SEQ_TIME_STAMP_TICK;
- event.time.tick = q->timer->tick.cur_tick;
- break;
- case SNDRV_SEQ_SYNC_TIME:
- event.flags |= SNDRV_SEQ_TIME_STAMP_REAL;
- event.time.time = q->timer->cur_time;
- break;
- }
- event.type = type;
- event.data.queue.queue = q->queue;
- event.data.queue.sync_format = master->format;
- event.data.queue.sync_time_format = master->time_format;
- event.data.queue.param.position = master->counter;
- event.source = q->sync_port;
- event.dest = master->addr;
- if (master->parser) {
- snd_seq_event_t newev;
- newev = event;
- if (master->parser->out.sync(master->parser_arg, &event, &newev) > 0) {
- snd_seq_kernel_client_dispatch(SNDRV_SEQ_CLIENT_SYSTEM, &newev, atomic, hop);
- return;
- }
- }
- snd_seq_kernel_client_dispatch(SNDRV_SEQ_CLIENT_SYSTEM, &event, atomic, hop);
-}
-
-/*
- * initialize the sync position
- */
-static void queue_sync_clear(queue_sync_t *sync)
-{
- memset(&sync->cur_time, 0, sizeof(sync->cur_time));
- sync->counter = 0;
- sync->sync_tick.cur_tick = 0;
- sync->sync_tick.fraction = 0;
-}
-
-/*
- * initialize all sync positions
- */
-void snd_seq_sync_clear(queue_t *q)
-{
- struct list_head *head;
-
- /* clear master positions */
- read_lock(&q->master_lock);
- FOR_EACH_LIST(head, &q->master_head) {
- queue_sync_t *master = list_entry(head, queue_sync_t, list);
- queue_sync_clear(master);
- }
- read_unlock(&q->master_lock);
- read_lock(&q->slave_lock);
- queue_sync_clear(&q->slave);
- read_unlock(&q->slave_lock);
-}
-
-
-/*
- * change tick resolution of sync master/slave
- */
-static void queue_sync_set_tick_resolution(queue_t *q, queue_sync_t *sync)
-{
- unsigned int tempo, ppq;
- tempo = q->timer->tempo;
- if (sync->param.tick.ppq == 0)
- ppq = q->timer->ppq;
- else
- ppq = sync->param.tick.ppq;
- snd_seq_timer_set_tick_resolution(&sync->sync_tick, tempo, ppq, sync->param.tick.ticks);
-}
-
-
-/*
- * update sync-master resolutions
- */
-void snd_seq_sync_update_tempo(queue_t *q)
-{
- struct list_head *head;
-
- read_lock(&q->master_lock);
- FOR_EACH_LIST(head, &q->master_head) {
- queue_sync_t *master = list_entry(head, queue_sync_t, list);
- if (master->format & SNDRV_SEQ_SYNC_TICK)
- queue_sync_set_tick_resolution(q, master);
- }
- read_unlock(&q->master_lock);
- read_lock(&q->slave_lock);
- if (q->slave.format & SNDRV_SEQ_SYNC_TICK)
- queue_sync_set_tick_resolution(q, &q->slave);
- read_unlock(&q->slave_lock);
-}
-
-
-/*
- * change the tick position from the current tick of the queue
- */
-static void queue_sync_change_tick(queue_t *q, queue_sync_t *sync)
-{
- if (sync->param.tick.ppq == 0)
- sync->counter = q->timer->tick.cur_tick;
- else
- sync->counter = (q->timer->tick.cur_tick * sync->param.tick.ppq) / q->timer->ppq;
- sync->counter /= sync->param.tick.ticks;
- sync->sync_tick.cur_tick = sync->counter;
- sync->sync_tick.fraction = 0;
-}
-
-/*
- * change the time position from the current time of the queue
- */
-static void queue_sync_change_time(queue_t *q, queue_sync_t *sync)
-{
- /* we need 64bit calculation here.. */
- u64 nsec;
-
- nsec = q->timer->cur_time.tv_sec;
- nsec *= 1000000000UL;
- nsec += q->timer->cur_time.tv_nsec;
- u64_div(nsec, sync->param.time.resolution, sync->counter);
- sync->counter *= sync->param.time.subframes;
- sync->cur_time = q->timer->cur_time;
-}
-
-
-/*
- * update the tick position of all sync
- */
-void snd_seq_sync_update_tick(queue_t *q, int master_only, int atomic, int hop)
-{
- struct list_head *head;
-
- read_lock(&q->master_lock);
- FOR_EACH_LIST(head, &q->master_head) {
- queue_sync_t *master = list_entry(head, queue_sync_t, list);
- if (master->format & SNDRV_SEQ_SYNC_TICK) {
- queue_sync_change_tick(q, master);
- queue_send_sync_event(q, master, SNDRV_SEQ_EVENT_SYNC_POS, atomic, hop); /* broadcast to client */
- }
- }
- read_unlock(&q->master_lock);
- if (master_only)
- return;
- read_lock(&q->slave_lock);
- if (q->slave.format & SNDRV_SEQ_SYNC_TICK)
- queue_sync_change_tick(q, &q->slave);
- read_unlock(&q->slave_lock);
-}
-
-/*
- * update the time position of all sync
- */
-void snd_seq_sync_update_time(queue_t *q, int master_only, int atomic, int hop)
-{
- struct list_head *head;
-
- read_lock(&q->master_lock);
- FOR_EACH_LIST(head, &q->master_head) {
- queue_sync_t *master = list_entry(head, queue_sync_t, list);
- if (master->format & SNDRV_SEQ_SYNC_TIME) {
- queue_sync_change_time(q, master);
- queue_send_sync_event(q, master, SNDRV_SEQ_EVENT_SYNC_POS, atomic, hop);
- }
- }
- read_unlock(&q->master_lock);
- if (master_only)
- return;
- read_lock(&q->slave_lock);
- if (q->slave.format & SNDRV_SEQ_SYNC_TIME)
- queue_sync_change_time(q, &q->slave);
- read_unlock(&q->slave_lock);
-}
-
-
-/*
- * check the current timer value and send sync messages if the sync
- * time is elapsed
- */
-static void queue_master_check(queue_t *q, unsigned long ticks, int atomic, int hop)
-{
- struct list_head *head;
-
- read_lock(&q->master_lock);
- FOR_EACH_LIST(head, &q->master_head) {
- queue_sync_t *master = list_entry(head, queue_sync_t, list);
- switch (master->format & SNDRV_SEQ_SYNC_MODE) {
- case SNDRV_SEQ_SYNC_TICK:
- snd_seq_timer_update_tick(&master->sync_tick, ticks);
- while (master->sync_tick.cur_tick >= master->counter) {
- queue_send_sync_event(q, master, SNDRV_SEQ_EVENT_SYNC, atomic, hop);
- master->counter++;
- }
- break;
- case SNDRV_SEQ_SYNC_TIME:
- while (snd_seq_compare_real_time(&q->timer->cur_time, &master->cur_time)) {
- queue_send_sync_event(q, master, SNDRV_SEQ_EVENT_SYNC, atomic, hop);
- snd_seq_inc_time_nsec(&master->cur_time, master->resolution);
- master->counter++;
- }
- break;
- }
- }
- read_unlock(&q->master_lock);
-}
-
-
-/*
- * slave stuff
- */
-
-/*
- * update tick
- */
-static void queue_slave_check(queue_t *q, unsigned long ticks)
-{
- switch (q->slave.format & SNDRV_SEQ_SYNC_MODE) {
- case SNDRV_SEQ_SYNC_TICK:
- snd_seq_timer_update_tick(&q->slave.sync_tick, ticks);
- break;
- case SNDRV_SEQ_SYNC_TIME:
- /* nothing */
- break;
- }
-}
-
-/*
- * slave synchronization in real-time unit
- */
-static int queue_slave_sync_time(queue_t *q, unsigned int position)
-{
- struct timeval tm;
- long diff_time, new_period;
- queue_sync_t *sync = &q->slave;
- sndrv_seq_queue_time_sync_t *p = &sync->param.time;
- seq_timer_t *tmr = q->timer;
- u64 external_counter, tmp;
-
- do_gettimeofday(&tm);
- if (tmr->sync_start) {
- /* XXX: we should use 64bit for diff_time, too. */
- diff_time = (tm.tv_sec - tmr->sync_last_tm.tv_sec) * 1000000 +
- ((long)tm.tv_usec - (long)tmr->sync_last_tm.tv_usec);
- diff_time = (p->x0 * tmr->sync_time_diff + p->x1 * (diff_time * 1000)) / (p->x0 + p->x1);
-#define MIN_DIFF_TIME 1000 /* 1ms minimum */
- if (diff_time < MIN_DIFF_TIME)
- diff_time = MIN_DIFF_TIME;
- tmr->sync_time_diff = diff_time;
- tmp = (u64)tmr->base_period * (u64)sync->resolution;
- u64_div(tmp, diff_time, new_period);
-
- /* phase adjustment */
- external_counter = position;
- external_counter *= sync->resolution;
-
- /* calculate current time */
- tmp = snd_seq_timer_get_cur_nsec(tmr, &tm);
-
- if (external_counter > tmp) {
- tmp = external_counter - tmp;
- if (tmp < p->max_time_diff) {
- /* locked */
- int hz = p->phase_correct_time / tmr->base_period;
- diff_time = (u32)tmp;
- diff_time /= hz;
- new_period += diff_time;
- q->flags &= ~SNDRV_SEQ_QUEUE_FLG_SYNC_LOST;
- }
- } else {
- tmp = tmp - external_counter;
- if (tmp == 0)
- q->flags &= ~SNDRV_SEQ_QUEUE_FLG_SYNC_LOST;
- else if (tmp < p->max_time_diff) {
- /* locked */
- int hz = p->phase_correct_time / tmr->base_period;
- diff_time = (u32)tmp;
- diff_time /= hz;
- if (new_period - diff_time > MIN_DIFF_TIME) {
- new_period -= diff_time;
- q->flags &= ~SNDRV_SEQ_QUEUE_FLG_SYNC_LOST;
- } else
- q->flags |= SNDRV_SEQ_QUEUE_FLG_SYNC_LOST;
- }
- }
- tmr->period = new_period;
- } else {
- tmr->sync_start = 1;
- tmr->sync_time_diff = sync->resolution;
- }
- tmr->sync_last_tm = tm;
- sync->counter = position;
-
- return 0;
-}
-
-/*
- * slave synchronization in tick unit
- */
-static int queue_slave_sync_tick(queue_t *q, unsigned int position)
-{
- struct timeval tm;
- long diff_time, tick_diff;
- unsigned int tick_time;
- queue_sync_t *sync = &q->slave;
- seq_timer_t *tmr = q->timer;
- sndrv_seq_queue_tick_sync_t *p = &sync->param.tick;
-
- do_gettimeofday(&tm);
- if (tmr->sync_start) {
- /* XXX: diff_time should be 64bit for enough long sync period.. */
- diff_time = (tm.tv_sec - tmr->sync_last_tm.tv_sec) * 1000000 +
- ((long)tm.tv_usec - (long)tmr->sync_last_tm.tv_usec);
- diff_time *= 1000; /* in nsec */
- tick_time = (p->x0 * sync->sync_tick.resolution +
- p->x1 * diff_time) / (p->x0 + p->x1);
- /* phase adjustment */
- tick_diff = (long)position - (long)sync->sync_tick.cur_tick;
- if (tick_diff != 0) {
- if (tick_diff >= -p->max_tick_diff &&
- tick_diff <= p->max_tick_diff) {
- /* locked */
- q->flags &= ~SNDRV_SEQ_QUEUE_FLG_SYNC_LOST;
- tick_time = (tick_time * p->max_tick_diff2) /
- (p->max_tick_diff2 + tick_diff);
- } else {
- /* sync lost.. freewheeling */
- q->flags |= SNDRV_SEQ_QUEUE_FLG_SYNC_LOST;
- }
- } else
- q->flags &= ~SNDRV_SEQ_QUEUE_FLG_SYNC_LOST;
-
-#define MIN_TICK_TIME 1000 /* 1ms */
- if (tick_time < MIN_TICK_TIME)
- tick_time = MIN_TICK_TIME;
-
- sync->sync_tick.resolution = tick_time;
- snd_seq_timer_update_tick(&sync->sync_tick, 0);
- if (p->ppq)
- tmr->tick.resolution = (tick_time * p->ppq) / tmr->ppq;
- else
- tmr->tick.resolution = tick_time;
- snd_seq_timer_update_tick(&tmr->tick, 0);
- tmr->tempo = (tmr->tick.resolution * tmr->ppq) / 1000;
-
- } else
- tmr->sync_start = 1;
- tmr->sync_last_tm = tm;
-
- sync->counter = position;
-
- return 0;
-}
-
-
-/*
- */
-static void queue_slave_jump_to_time(queue_t *q, unsigned int position, int atomic, int hop)
-{
- u64 nsec;
- queue_sync_t *sync = &q->slave;
-
- q->slave.counter = position;
- nsec = sync->counter;
- nsec *= sync->resolution;
- u64_divmod(nsec, 1000000000, sync->cur_time.tv_sec, sync->cur_time.tv_nsec);
- q->timer->cur_time = sync->cur_time;
-
- /* update master */
- snd_seq_sync_update_time(q, 1, atomic, hop);
-}
-
-static void queue_slave_jump_to_tick(queue_t *q, unsigned int position, int atomic, int hop)
-{
- unsigned int tick;
- queue_sync_t *sync = &q->slave;
-
- sync->counter = position;
- sync->sync_tick.cur_tick = sync->counter;
- sync->sync_tick.fraction = 0;
-
- /* update queue timer */
- if (sync->param.tick.ppq == 0)
- tick = sync->counter;
- else
- tick = sync->counter * q->timer->ppq / sync->param.tick.ppq;
- q->timer->tick.cur_tick = tick * sync->param.tick.ticks;
- q->timer->tick.fraction = 0;
-
- /* update master */
- snd_seq_sync_update_tick(q, 1, atomic, hop);
-}
-
-
-/*
- * event input callback
- */
-static int event_input_sync(snd_seq_event_t * ev, int direct, void *private_data, int atomic, int hop)
-{
- queue_t *q = private_data;
- unsigned long flags;
- snd_seq_event_t newev;
-
- snd_assert(q != NULL, return -ENXIO);
-
- /* lock the queue owner access.. */
- spin_lock_irqsave(&q->owner_lock, flags);
- q->klocked = 1;
- spin_unlock_irqrestore(&q->owner_lock, flags);
-
- read_lock(&q->slave_lock);
- if (q->slave.format) {
- if (q->slave.parser) {
- memset(&newev, 0, sizeof(newev));
- if (q->slave.parser->in.sync(q->slave.parser_arg, ev, &newev) > 0)
- ev = &newev;
- }
- }
- if (ev->type == SNDRV_SEQ_EVENT_SYNC) {
- /* slave signal received */
- switch (q->slave.format & SNDRV_SEQ_SYNC_MODE) {
- case SNDRV_SEQ_SYNC_TICK:
- queue_slave_sync_tick(q, ev->data.queue.param.position);
- break;
- case SNDRV_SEQ_SYNC_TIME:
- queue_slave_sync_time(q, ev->data.queue.param.position);
- break;
- }
- } else if (ev->type == SNDRV_SEQ_EVENT_SYNC_POS) {
- /* jump to position */
- switch (q->slave.format & SNDRV_SEQ_SYNC_MODE) {
- case SNDRV_SEQ_SYNC_TICK:
- if (q->timer->running)
- queue_slave_sync_tick(q, ev->data.queue.param.position);
- else
- queue_slave_jump_to_tick(q, ev->data.queue.param.position, atomic, hop);
- break;
- case SNDRV_SEQ_SYNC_TIME:
- if (q->timer->running)
- queue_slave_sync_time(q, ev->data.queue.param.position);
- else
- queue_slave_jump_to_time(q, ev->data.queue.param.position, atomic, hop);
- break;
- }
- } else {
- /* control queue */
- snd_seq_queue_process_event(q, ev, 0, atomic, hop);
- }
- read_unlock(&q->slave_lock);
-
- /* unlock */
- spin_lock_irqsave(&q->owner_lock, flags);
- q->klocked = 0;
- spin_unlock_irqrestore(&q->owner_lock, flags);
-
- return 0;
-}
-
-
-/*
- * initialize sync parameters
- */
-static int queue_param_init(queue_t *q, queue_sync_t *sync,
- snd_seq_addr_t *addr, sndrv_seq_queue_sync_t *info,
- int slave)
-{
- seq_sync_parser_t *parser, **list;
-
- sync->format = info->format;
- sync->time_format = info->time_format;
- *sync->opt_info = *info->info;
- sync->addr = *addr;
- /* copy params */
- if (info->format&SNDRV_SEQ_SYNC_TICK)
- sync->param.tick=info->param.tick;
- else
- sync->param.time=info->param.time;
-
- sync->parser = NULL;
- sync->parser_arg = NULL;
- for (list = event_parsers; (parser = *list) != NULL; list++) {
- if (parser->format == sync->format) {
- int err;
- if (slave)
- err = parser->in.open(sync, &sync->parser_arg);
- else
- err = parser->out.open(sync, &sync->parser_arg);
- if (err < 0)
- return err;
- sync->parser = parser;
- break;
- }
- }
-
- switch (sync->format & SNDRV_SEQ_SYNC_MODE) {
- case SNDRV_SEQ_SYNC_TICK:
- if (sync->param.tick.ppq > 200)
- goto __error;
- if (sync->param.tick.ticks == 0)
- sync->param.tick.ticks = 1;
- queue_sync_set_tick_resolution(q, sync);
- /* sync slave parameters -- will be configurable */
- sync->param.tick.x0 = 4;
- sync->param.tick.x1 = 1;
- sync->param.tick.max_tick_diff = 50;
- sync->param.tick.max_tick_diff2 = sync->param.tick.max_tick_diff * 2;
- break;
- case SNDRV_SEQ_SYNC_TIME:
- sync->resolution = sync->param.time.resolution;
- if (sync->param.time.subframes == 0)
- goto __error;
- sync->resolution /= sync->param.time.subframes;
- if (sync->resolution < 1000000) /* minimum = 1ms */
- goto __error;
- /* sync slave parameters -- will be configurable */
- sync->param.time.x0 = 2;
- sync->param.time.x1 = 1;
- sync->param.time.max_time_diff = 1000000000UL; /* 1s */
- sync->param.time.phase_correct_time = 100000000UL; /* 0.1s */
- break;
- default:
- snd_printd("seq_sync: invalid format %x\n", sync->format);
- goto __error;
- }
- return 0;
-
-__error:
- queue_sync_close_parser(sync, slave);
- return -EINVAL;
-}
-
-
-/*
- * close event parser if exists
- */
-static void queue_sync_close_parser(queue_sync_t *sync, int slave)
-{
- if (sync->parser == NULL)
- return;
- if (slave) {
- if (sync->parser->in.close)
- sync->parser->in.close(sync->parser_arg);
- else if (sync->parser_arg)
- kfree(sync->parser_arg);
- } else {
- if (sync->parser->out.close)
- sync->parser->out.close(sync->parser_arg);
- else if (sync->parser_arg)
- kfree(sync->parser_arg);
- }
- sync->parser = NULL;
- sync->parser_arg = NULL;
-}
-
-
-/*
- * add to master list
- */
-static int queue_master_add(void *private_data, snd_seq_port_subscribe_t *subs)
-{
- queue_t *q = private_data;
- queue_sync_t *master;
- unsigned long flags;
- int err;
-
- snd_assert(q != NULL, return -EINVAL);
- if (! subs->sync)
- return -EINVAL;
- master = snd_kcalloc(sizeof(*master), GFP_KERNEL);
- if (master == NULL)
- return -ENOMEM;
- err = queue_param_init(q, master, &subs->dest, &subs->opt.sync_info, 0);
- if (err < 0) {
- kfree(master);
- return err;
- }
- write_lock_irqsave(&q->master_lock, flags);
- list_add(&master->list, &q->master_head);
- write_unlock_irqrestore(&q->master_lock, flags);
-
- return 0;
-}
-
-/*
- * remove master
- */
-static int queue_master_remove(void *private_data, snd_seq_port_subscribe_t *subs)
-{
- queue_t *q = private_data;
- sndrv_seq_queue_sync_t *info;
- snd_seq_addr_t *addr;
- struct list_head *head;
- unsigned long flags;
-
- snd_assert(q != NULL, return -EINVAL);
- if (! subs->sync)
- return -EINVAL;
- info = &subs->opt.sync_info;
- addr = &subs->dest;
-
- write_lock_irqsave(&q->master_lock, flags);
- FOR_EACH_LIST(head, &q->master_head) {
- queue_sync_t *master = list_entry(head, queue_sync_t, list);
- if (master->format == info->format &&
- master->addr.client == addr->client &&
- master->addr.port == addr->port) {
- list_del(&master->list);
- write_unlock_irqrestore(&q->master_lock, flags);
- queue_sync_close_parser(master, 0);
- kfree(master);
- return 0;
- }
- }
- write_unlock_irqrestore(&q->master_lock, flags);
- snd_printd("seq_queue: can't find master from %d.%d format %0x\n", addr->client, addr->port, info->format);
- return -ENXIO;
-}
-
-/* remove all master connections if any exist */
-static void queue_delete_all_masters(queue_t *q)
-{
- struct list_head *head;
- unsigned long flags;
-
- write_lock_irqsave(&q->master_lock, flags);
- FOR_EACH_LIST(head, &q->master_head) {
- queue_sync_t *master = list_entry(head, queue_sync_t, list);
- list_del(&master->list);
- queue_sync_close_parser(master, 0);
- kfree(master);
- }
- write_unlock_irqrestore(&q->master_lock, flags);
-}
-
-/*
- * set slave mode
- */
-static int queue_slave_set(void *private_data, snd_seq_port_subscribe_t *subs)
-{
- queue_t *q = private_data;
- unsigned long flags;
- int err;
-
- snd_assert(q != NULL, return -EINVAL);
- if (! subs->sync)
- return -EINVAL;
- write_lock_irqsave(&q->slave_lock, flags);
- if (q->slave.format) {
- write_unlock_irqrestore(&q->slave_lock, flags);
- return -EBUSY;
- }
- err = queue_param_init(q, &q->slave, &subs->sender,
- &subs->opt.sync_info, 1);
- if (err < 0) {
- q->slave.format = 0;
- write_unlock_irqrestore(&q->slave_lock, flags);
- return err;
- }
- write_unlock_irqrestore(&q->slave_lock, flags);
- return 0;
-}
-
-/*
- * remove slave mode
- */
-static int queue_slave_reset(void *private_data, snd_seq_port_subscribe_t *subs)
-{
- queue_t *q = private_data;
- unsigned long flags;
-
- snd_assert(q != NULL, return -EINVAL);
- if (! subs->sync)
- return -EINVAL;
- write_lock_irqsave(&q->slave_lock, flags);
- if (q->slave.addr.client == subs->sender.client &&
- q->slave.addr.port == subs->sender.port) {
- q->slave.format = 0;
- queue_sync_close_parser(&q->slave, 1);
- write_unlock_irqrestore(&q->slave_lock, flags);
- return 0;
- }
- write_unlock_irqrestore(&q->slave_lock, flags);
- snd_printd("seq_queue: can't match slave condition\n");
- return -ENXIO;
-}
-
-
-/*
- * sync check
- * this function is called at each timer interrupt.
- */
-
-void snd_seq_sync_check(queue_t *q, unsigned long resolution, int atomic, int hop)
-{
- queue_master_check(q, resolution, atomic, hop);
- queue_slave_check(q, resolution);
-}
-
-
-/*
- * support functions for SMPTE time frame
- */
-static unsigned int linear_time_to_position(sndrv_seq_time_frame_t time,
- int nframes, int nsubs)
-{
- unsigned int count;
- count = time.hour * 60 + time.min;
- count = count * 60 + time.sec;
- count = count * nframes + time.frame;
- count = count * nsubs + time.subframe;
- return count;
-}
-
-static sndrv_seq_time_frame_t linear_position_to_time(unsigned int count,
- int nframes, int nsubs)
-{
- sndrv_seq_time_frame_t time;
- time.subframe = count % nsubs;
- count /= nsubs;
- time.hour = count / (3600 * nframes);
- count %= 3600 * nframes;
- time.min = count / (60 * nframes);
- count %= 60 * nframes;
- time.sec = count / nframes;
- time.frame = count % nframes;
- return time;
-}
-
-/* drop frame - only 30fps */
-#define NFRAMES 30
-#define FRAMES_PER_MIN (NFRAMES * 60 - 2)
-#define FRAMES_PER_10MIN (FRAMES_PER_MIN * 10 + 2)
-#define FRAMES_PER_HOUR (FRAMES_PER_10MIN * 6)
-
-static unsigned int drop_time_to_position(sndrv_seq_time_frame_t time, int nsubs)
-{
- unsigned int count, min;
-
- min = time.min % 10;
- count = time.frame;
- if (min > 0) {
- if (time.sec == 0 && time.frame < 2)
- count = 2;
- }
- count += time.sec * NFRAMES;
- count += min * FRAMES_PER_MIN;
- count += (time.min / 10) * FRAMES_PER_10MIN;
- count += time.hour * (FRAMES_PER_HOUR);
- count *= nsubs;
- count += time.subframe;
-
- return count;
-}
-
-static sndrv_seq_time_frame_t drop_position_to_time(int count, int nsubs)
-{
- unsigned int min10;
- sndrv_seq_time_frame_t time;
-
- time.subframe = count % nsubs;
- count /= nsubs;
- min10 = count / FRAMES_PER_10MIN;
- time.hour = min10 / 6;
- min10 %= 6;
- count %= FRAMES_PER_10MIN;
- if (count < 2) {
- time.min = min10 * 10;
- time.sec = 0;
- } else {
- count -= 2;
- time.min = count / FRAMES_PER_MIN;
- time.min += min10 * 10;
- count %= FRAMES_PER_MIN;
- count += 2;
- time.sec = count / NFRAMES;
- count %= NFRAMES;
- }
- time.frame = count;
-
- return time;
-}
-
-/* convert from position counter to time frame */
-sndrv_seq_time_frame_t snd_seq_position_to_time_frame(int format, unsigned int nsubs, unsigned int pos)
-{
- switch (format) {
- case SNDRV_SEQ_SYNC_FPS_24:
- return linear_position_to_time(pos, 24, nsubs);
- case SNDRV_SEQ_SYNC_FPS_25:
- return linear_position_to_time(pos, 25, nsubs);
- case SNDRV_SEQ_SYNC_FPS_30_NDP:
- return linear_position_to_time(pos, 30, nsubs);
- case SNDRV_SEQ_SYNC_FPS_30_DP:
- default:
- return drop_position_to_time(pos, nsubs);
- }
-}
-
-/* convert from position counter to time frame */
-unsigned int snd_seq_time_frame_to_position(int format, unsigned int nsubs, sndrv_seq_time_frame_t *rtime)
-{
- switch (format) {
- case SNDRV_SEQ_SYNC_FPS_24:
- return linear_time_to_position(*rtime, 24, nsubs);
- case SNDRV_SEQ_SYNC_FPS_25:
- return linear_time_to_position(*rtime, 25, nsubs);
- case SNDRV_SEQ_SYNC_FPS_30_NDP:
- return linear_time_to_position(*rtime, 30, nsubs);
- case SNDRV_SEQ_SYNC_FPS_30_DP:
- default:
- return drop_time_to_position(*rtime, nsubs);
- }
-}
-
-/* resolution in nsec */
-unsigned long snd_seq_get_smpte_resolution(int time_format)
-{
- switch (time_format) {
- case SNDRV_SEQ_SYNC_FPS_24:
- return 1000000000UL / 24;
- case SNDRV_SEQ_SYNC_FPS_25:
- return 1000000000UL / 25;
- case SNDRV_SEQ_SYNC_FPS_30_DP:
- case SNDRV_SEQ_SYNC_FPS_30_NDP:
- return (unsigned long)(1000000000.0/29.97);
- }
- return 0;
-}
-
-
-/*
- * proc interface
- */
-
-static void print_sync_info(snd_info_buffer_t *buffer, queue_sync_t *sync)
-{
- snd_iprintf(buffer, " [%s] ==> %d:%d\n",
- (sync->format & SNDRV_SEQ_SYNC_TICK ? "tick" : "time"),
- sync->addr.client, sync->addr.port);
- snd_iprintf(buffer, " format 0x%0x / time_format %d\n",
- sync->format, sync->time_format);
- switch (sync->format & SNDRV_SEQ_SYNC_MODE) {
- case SNDRV_SEQ_SYNC_TICK:
- snd_iprintf(buffer, " ppq: %d, ticks: %d\n",
- sync->param.tick.ppq, sync->param.tick.ticks);
- snd_iprintf(buffer, " resolution: %ld ns, position: %d\n",
- sync->sync_tick.resolution,
- sync->counter);
- break;
- case SNDRV_SEQ_SYNC_TIME:
- snd_iprintf(buffer, " subframes %d, resolution: %ld ns, position: %d\n",
- sync->param.time.subframes,
- sync->resolution,
- sync->counter);
- break;
- }
-}
-
-void snd_seq_sync_info_read(queue_t *q, snd_info_buffer_t *buffer)
-{
- struct list_head *head;
- int count = 0;
-
- read_lock(&q->master_lock);
- FOR_EACH_LIST(head, &q->master_head) {
- queue_sync_t *master = list_entry(head, queue_sync_t, list);
- snd_iprintf(buffer, "master %d", count);
- print_sync_info(buffer, master);
- count++;
- }
- read_unlock(&q->master_lock);
- if (q->slave.format) {
- snd_iprintf(buffer, "slave");
- print_sync_info(buffer, &q->slave);
- count++;
- }
- if (count)
- snd_iprintf(buffer, "\n");
-}
-
-#endif /* SNDRV_SEQ_SYNC_SUPPORT */
diff --git a/sound/core/seq/seq_sync.h b/sound/core/seq/seq_sync.h
deleted file mode 100644
index 19d4b4d30a60..000000000000
--- a/sound/core/seq/seq_sync.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Synchronization of ALSA sequencer queues
- *
- * Copyright (c) 2000 by Takashi Iwai <tiwai@suse.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-#ifndef __SND_SEQ_SYNC_H
-#define __SND_SEQ_SYNC_H
-
-typedef struct snd_queue_sync queue_sync_t;
-typedef struct snd_seq_sync_parser seq_sync_parser_t;
-typedef void *seq_sync_arg_t;
-
-struct snd_queue_sync {
- unsigned char format;
- unsigned char time_format;
- unsigned char opt_info[6]; /* optional info */
- snd_seq_addr_t addr; /* master/slave address */
-
- unsigned int counter; /* current position */
- unsigned long resolution; /* resolution for time */
- snd_seq_real_time_t cur_time; /* current time */
- seq_timer_tick_t sync_tick; /* tick info */
-
- union {
- struct sndrv_seq_queue_tick_sync tick;
- struct sndrv_seq_queue_time_sync time;
- } param;
-
- seq_sync_parser_t *parser;
- seq_sync_arg_t parser_arg;
-
- struct list_head list;
-};
-
-
-struct seq_sync_parser_ops {
- int (*open)(queue_sync_t *sync_info, seq_sync_arg_t *retp);
- int (*sync)(seq_sync_arg_t arg, const snd_seq_event_t *src, snd_seq_event_t *ev);
- int (*close)(seq_sync_arg_t arg);
-};
-
-struct snd_seq_sync_parser {
- unsigned int format; /* supported format */
- struct seq_sync_parser_ops in; /* sync-in (slave) */
- struct seq_sync_parser_ops out; /* sync-out (mastering) */
-};
-
-/*
- * prototypes
- */
-int snd_seq_sync_create_port(queue_t *queue);
-int snd_seq_sync_delete_port(queue_t *queue);
-void snd_seq_sync_clear(queue_t *q);
-void snd_seq_sync_update_tempo(queue_t *q);
-void snd_seq_sync_update_tick(queue_t *q, int master_only, int atomic, int hop);
-void snd_seq_sync_update_time(queue_t *q, int master_only, int atomic, int hop);
-void snd_seq_sync_check(queue_t *q, unsigned long resolution, int atomic, int hop);
-
-sndrv_seq_time_frame_t snd_seq_position_to_time_frame(int format, unsigned int nsubs, unsigned int pos);
-unsigned int snd_seq_time_frame_to_position(int format, unsigned int nsubs, sndrv_seq_time_frame_t *rtime);
-unsigned long snd_seq_get_smpte_resolution(int time_format);
-
-
-#endif
diff --git a/sound/core/seq/seq_timer.h b/sound/core/seq/seq_timer.h
index 3012aa9391ad..e181aaf32ae9 100644
--- a/sound/core/seq/seq_timer.h
+++ b/sound/core/seq/seq_timer.h
@@ -52,12 +52,6 @@ typedef struct {
unsigned int skew;
unsigned int skew_base;
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
- int sync_start;
- struct timeval sync_last_tm;
- unsigned int sync_time_diff;
-#endif
-
struct timeval last_update; /* time of last clock update, used for interpolation */
spinlock_t lock;
@@ -144,8 +138,4 @@ int snd_seq_timer_set_skew(seq_timer_t *tmr, unsigned int skew, unsigned int bas
snd_seq_real_time_t snd_seq_timer_get_cur_time(seq_timer_t *tmr);
snd_seq_tick_time_t snd_seq_timer_get_cur_tick(seq_timer_t *tmr);
-#ifdef SNDRV_SEQ_SYNC_SUPPORT
-u64 snd_seq_timer_get_cur_nsec(seq_timer_t *tmr, struct timeval *tm);
-#endif
-
#endif
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c
index b2ff32b30623..4b3bd1ca47d5 100644
--- a/sound/drivers/serial-u16550.c
+++ b/sound/drivers/serial-u16550.c
@@ -7,85 +7,6 @@
*
* This code is based on the code from ALSA 0.5.9, but heavily rewritten.
*
- * Sat Mar 31 17:27:57 PST 2001 tim.mann@compaq.com
- * Added support for the Midiator MS-124T and for the MS-124W in
- * Single Addressed (S/A) or Multiple Burst (M/B) mode, with
- * power derived either parasitically from the serial port or
- * from a separate power supply.
- *
- * The new snd_adaptor module parameter allows you to select
- * either the default Roland Soundcanvas support (0), which was
- * previously included in this driver but was not documented,
- * Midiator MS-124T support (1), Midiator MS-124W S/A mode
- * support (2), or MS-124W M/B mode support (3). For the
- * Midiator MS-124W, you must set the physical M-S and A-B
- * switches on the Midiator to match the driver mode you select.
- *
- * - In Roland Soundcanvas mode, multiple ALSA raw MIDI
- * substreams are supported (midiCnD0-midiCnD15). Whenever you
- * write to a different substream, the driver sends the
- * nonstandard MIDI command sequence F5 NN, where NN is the
- * substream number plus 1. Roland modules use this command to
- * switch between different "parts", so this feature lets you
- * treat each part as a distinct raw MIDI substream. The driver
- * provides no way to send F5 00 (no selection) or to not send
- * the F5 NN command sequence at all; perhaps it ought to.
- *
- * - In MS-124T mode, one raw MIDI substream is supported
- * (midiCnD0); the snd_outs module parameter is automatically set
- * to 1. The driver sends the same data to all four MIDI Out
- * connectors. Set the A-B switch and the snd_speed module
- * parameter to match (A=19200, B=9600).
- *
- * Usage example for MS-124T, with A-B switch in A position:
- * setserial /dev/ttyS0 uart none
- * /sbin/modprobe snd-serial-u16550 snd_port=0x3f8 snd_irq=4 \
- * snd_adaptor=1 snd_speed=19200
- *
- * - In MS-124W S/A mode, one raw MIDI substream is supported
- * (midiCnD0); the snd_outs module parameter is automatically set
- * to 1. The driver sends the same data to all four MIDI Out
- * connectors at full MIDI speed.
- *
- * Usage example for S/A mode:
- * setserial /dev/ttyS0 uart none
- * /sbin/modprobe snd-serial-u16550 snd_port=0x3f8 snd_irq=4 \
- * snd_adaptor=2
- *
- * - In MS-124W M/B mode, the driver supports 16 ALSA raw MIDI
- * substreams; the snd_outs module parameter is automatically set
- * to 16. The substream number gives a bitmask of which MIDI Out
- * connectors the data should be sent to, with midiCnD1 sending
- * to Out 1, midiCnD2 to Out 2, midiCnD4 to Out 3, and midiCnD8
- * to Out 4. Thus midiCnD15 sends the data to all 4 ports. As a
- * special case, midiCnD0 also sends to all ports, since it is
- * not useful to send the data to no ports. M/B mode has extra
- * overhead to select the MIDI Out for each byte, so the
- * aggregate data rate across all four MIDI Outs is at most one
- * byte every 520 us, as compared with the full MIDI data rate of
- * one byte every 320 us per port.
- *
- * Usage example for M/B mode:
- * setserial /dev/ttyS0 uart none
- * /sbin/insmod snd-serial-u16550 snd_port=0x3f8 snd_irq=4 \
- * snd_adaptor=3
- *
- * - The MS-124W hardware's M/A mode is currently not supported.
- * This mode allows the MIDI Outs to act independently at double
- * the aggregate throughput of M/B, but does not allow sending
- * the same byte simultaneously to multiple MIDI Outs. The M/A
- * protocol requires the driver to twiddle the modem control
- * lines under timing constraints, so it would be a bit more
- * complicated to implement than the other modes.
- *
- * - Midiator models other than MS-124W and MS-124T are currently
- * not supported. Note that the suffix letter is significant;
- * the MS-124 and MS-124B are not compatible, nor are the other
- * known models MS-101, MS-101B, MS-103, and MS-114. I do have
- * documentation that partially covers these models, but no units
- * to experiment with. The MS-124W support is tested with a real
- * unit. The MS-124T support is untested, but should work.
- *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -100,6 +21,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
+ * Sat Mar 31 17:27:57 PST 2001 tim.mann@compaq.com
+ * Added support for the Midiator MS-124T and for the MS-124W in
+ * Single Addressed (S/A) or Multiple Burst (M/B) mode, with
+ * power derived either parasitically from the serial port or
+ * from a separate power supply.
+ *
+ * More documentation can be found in serial-u16550.txt.
*/
#include <sound/driver.h>
@@ -115,10 +43,10 @@
#include <linux/serial_reg.h>
EXPORT_NO_SYMBOLS;
-MODULE_DESCRIPTION("MIDI serial");
+MODULE_DESCRIPTION("MIDI serial u16550");
MODULE_LICENSE("GPL");
MODULE_CLASSES("{sound}");
-MODULE_DEVICES("{{ALSA, MIDI serial}}");
+MODULE_DEVICES("{{ALSA, MIDI serial u16550}}");
#define SNDRV_SERIAL_SOUNDCANVAS 0 /* Roland Soundcanvas; F5 NN selects part */
#define SNDRV_SERIAL_MS124T 1 /* Midiator MS-124T */
@@ -134,12 +62,12 @@ static char *adaptor_names[] = {
static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
-static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
-static long snd_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x3f8,0x2f8,0x3e8,0x2e8 */
-static int snd_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 3,4,5,7,9,10,11,14,15 */
+static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
+static long snd_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x3f8,0x2f8,0x3e8,0x2e8 */
+static int snd_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 3,4,5,7,9,10,11,14,15 */
static int snd_speed[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 38400}; /* 9600,19200,38400,57600,115200 */
static int snd_base[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 115200}; /* baud base */
-static int snd_outs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; /* 1 to 16 */
+static int snd_outs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; /* 1 to 16 */
static int snd_adaptor[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = SNDRV_SERIAL_SOUNDCANVAS};
MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
@@ -165,6 +93,7 @@ MODULE_PARM_DESC(snd_base, "Base for divisor in bauds.");
MODULE_PARM_SYNTAX(snd_base, SNDRV_ENABLED ",allows:{57600,115200,230400,460800},dialog:list");
MODULE_PARM(snd_outs, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
MODULE_PARM_DESC(snd_outs, "Number of MIDI outputs.");
+
MODULE_PARM_SYNTAX(snd_outs, SNDRV_ENABLED ",allows:{{1,16}},dialog:list");
MODULE_PARM(snd_adaptor, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
MODULE_PARM_DESC(snd_adaptor, "Type of adaptor.");
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
index 29a62ca2d39e..bb3de44073a7 100644
--- a/sound/isa/ad1816a/ad1816a.c
+++ b/sound/isa/ad1816a/ad1816a.c
@@ -323,7 +323,7 @@ static int __init snd_card_ad1816a_probe(int dev)
static int __init snd_ad1816a_isapnp_detect(struct isapnp_card *card,
const struct isapnp_card_id *id)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/als100.c b/sound/isa/als100.c
index 72e52883fbc4..d6f0af9f90a9 100644
--- a/sound/isa/als100.c
+++ b/sound/isa/als100.c
@@ -347,7 +347,7 @@ static int __init snd_card_als100_probe(int dev)
static int __init snd_als100_isapnp_detect(struct isapnp_card *card,
const struct isapnp_card_id *id)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c
index 8e84e21628be..fc2a4925081d 100644
--- a/sound/isa/azt2320.c
+++ b/sound/isa/azt2320.c
@@ -370,7 +370,7 @@ static int __init snd_card_azt2320_probe(int dev)
static int __init snd_azt2320_isapnp_detect(struct isapnp_card *card,
const struct isapnp_card_id *id)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index d49c82efa0c1..3a8bb131de0a 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -450,7 +450,7 @@ static void __exit alsa_card_cmi8330_exit(void)
static int __init snd_cmi8330_isapnp_detect(struct isapnp_card *card,
const struct isapnp_card_id *id)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 3e155d84cdbe..12945e26c4e7 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -538,7 +538,7 @@ static int __init snd_card_cs4236_probe(int dev)
static int __init snd_cs4236_isapnp_detect(struct isapnp_card *card,
const struct isapnp_card_id *id)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/dt0197h.c b/sound/isa/dt0197h.c
index e3c30768d1b8..eb55ed0a2599 100644
--- a/sound/isa/dt0197h.c
+++ b/sound/isa/dt0197h.c
@@ -318,7 +318,7 @@ static int __init snd_card_dt0197h_probe(int dev)
static int __init snd_dt0197h_isapnp_detect(struct isapnp_card *card,
const struct isapnp_card_id *id)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
index 8f2d23e0a270..a4e91321be66 100644
--- a/sound/isa/es1688/es1688.c
+++ b/sound/isa/es1688/es1688.c
@@ -165,7 +165,7 @@ static int __init snd_audiodrive_probe(int dev)
static int __init snd_audiodrive_legacy_auto_probe(unsigned long port)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index f54735518223..b2b17a5cef72 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -2194,7 +2194,7 @@ static int __init snd_audiodrive_probe(int dev)
static int __init snd_audiodrive_probe_legacy_port(unsigned long port)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
@@ -2218,7 +2218,7 @@ static int __init snd_audiodrive_probe_legacy_port(unsigned long port)
static int __init snd_audiodrive_isapnp_detect(struct isapnp_card *card,
const struct isapnp_card_id *id)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c
index 2c161f9797a2..3b96090dbc4b 100644
--- a/sound/isa/gus/gusclassic.c
+++ b/sound/isa/gus/gusclassic.c
@@ -222,7 +222,7 @@ static int __init snd_gusclassic_probe(int dev)
static int __init snd_gusclassic_legacy_auto_probe(unsigned long port)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index 3d6593e8e6f3..582c565ed93a 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -347,7 +347,7 @@ static int __init snd_gusextreme_probe(int dev)
static int __init snd_gusextreme_legacy_auto_probe(unsigned long port)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index eadc412dd5dc..67a7338a7ff1 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -358,7 +358,7 @@ static int __init snd_gusmax_probe(int dev)
static int __init snd_gusmax_legacy_auto_probe(unsigned long port)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index a28db1cd25aa..357d2ebc1f02 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -886,7 +886,7 @@ static int __init snd_interwave_probe(int dev)
static int __init snd_interwave_probe_legacy_port(unsigned long port)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
@@ -910,7 +910,7 @@ static int __init snd_interwave_probe_legacy_port(unsigned long port)
static int __init snd_interwave_isapnp_detect(struct isapnp_card *card,
const struct isapnp_card_id *id)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 1c8ca4ac6857..338c130b4fbb 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -856,7 +856,7 @@ static int __init snd_opl3sa2_probe(int dev)
static int __init snd_opl3sa2_isapnp_detect(struct isapnp_card *card,
const struct isapnp_card_id *id)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 01f06bf66086..f14713e510cb 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -35,13 +35,6 @@
#include <sound/control.h>
#include <sound/initval.h>
-#if 0
-MODULE_AUTHOR("Takashi Iwai, Steve Ratcliffe");
-MODULE_DESCRIPTION("Routines for control of EMU8000 chip");
-MODULE_LICENSE("GPL");
-MODULE_CLASSES("{sound}");
-#endif
-
/*
* emu8000 register controls
*/
@@ -136,7 +129,7 @@ snd_emu8000_dma_chan(emu8000_t *emu, int ch, int mode)
/*
*/
-static void /*__init*/
+static void __init
snd_emu8000_read_wait(emu8000_t *emu)
{
while ((EMU8000_SMALR_READ(emu) & 0x80000000) != 0) {
@@ -149,7 +142,7 @@ snd_emu8000_read_wait(emu8000_t *emu)
/*
*/
-static void /*__init*/
+static void __init
snd_emu8000_write_wait(emu8000_t *emu)
{
while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) {
@@ -163,7 +156,7 @@ snd_emu8000_write_wait(emu8000_t *emu)
/*
* detect a card at the given port
*/
-static int /*__init*/
+static int __init
snd_emu8000_detect(emu8000_t *emu)
{
/* Initialise */
@@ -189,7 +182,7 @@ snd_emu8000_detect(emu8000_t *emu)
/*
* intiailize audio channels
*/
-static void /*__init*/
+static void __init
init_audio(emu8000_t *emu)
{
int ch;
@@ -230,7 +223,7 @@ init_audio(emu8000_t *emu)
/*
* initialize DMA address
*/
-static void /*__init*/
+static void __init
init_dma(emu8000_t *emu)
{
EMU8000_SMALR_WRITE(emu, 0);
@@ -334,7 +327,7 @@ static unsigned short init4[128] /*__devinitdata*/ = {
* Taken from the oss driver, not obvious from the doc how this
* is meant to work
*/
-static void /*__init*/
+static void __init
send_array(emu8000_t *emu, unsigned short *data, int size)
{
int i;
@@ -358,7 +351,7 @@ send_array(emu8000_t *emu, unsigned short *data, int size)
* Send initialization arrays to start up, this just follows the
* initialisation sequence in the adip.
*/
-static void /*__init*/
+static void __init
init_arrays(emu8000_t *emu)
{
send_array(emu, init1, NELEM(init1)/4);
@@ -385,7 +378,7 @@ init_arrays(emu8000_t *emu)
* seems that the only way to do this is to use the one channel and keep
* reallocating between read and write.
*/
-static void /*__init*/
+static void __init
size_dram(emu8000_t *emu)
{
int i, size;
@@ -511,7 +504,7 @@ snd_emu8000_init_fm(emu8000_t *emu)
/*
* The main initialization routine.
*/
-static void /*__init*/
+static void __init
snd_emu8000_init_hw(emu8000_t *emu)
{
int i;
@@ -665,7 +658,7 @@ snd_emu8000_load_chorus_fx(emu8000_t *emu, int mode, const void *buf, long len)
{
soundfont_chorus_fx_t rec;
if (mode < SNDRV_EMU8000_CHORUS_PREDEFINED || mode >= SNDRV_EMU8000_CHORUS_NUMBERS) {
- snd_printk("illegal chorus mode %d for uploading\n", mode);
+ snd_printk(KERN_WARNING "illegal chorus mode %d for uploading\n", mode);
return -EINVAL;
}
if (len < sizeof(rec) || copy_from_user(&rec, buf, sizeof(rec)))
@@ -793,7 +786,7 @@ snd_emu8000_load_reverb_fx(emu8000_t *emu, int mode, const void *buf, long len)
soundfont_reverb_fx_t rec;
if (mode < SNDRV_EMU8000_REVERB_PREDEFINED || mode >= SNDRV_EMU8000_REVERB_NUMBERS) {
- snd_printk("illegal reverb mode %d for uploading\n", mode);
+ snd_printk(KERN_WARNING "illegal reverb mode %d for uploading\n", mode);
return -EINVAL;
}
if (len < sizeof(rec) || copy_from_user(&rec, buf, sizeof(rec)))
@@ -1032,7 +1025,7 @@ static snd_kcontrol_new_t *mixer_defs[EMU8000_NUM_CONTROLS] = {
/*
* create and attach mixer elements for WaveTable treble/bass controls
*/
-static int /*__init*/
+static int __init
snd_emu8000_create_mixer(snd_card_t *card, emu8000_t *emu)
{
int i, err = 0;
@@ -1089,7 +1082,7 @@ static int snd_emu8000_dev_free(snd_device_t *device)
/*
* initialize and register emu8000 synth device.
*/
-/*exported*/ int
+int __init
snd_emu8000_new(snd_card_t *card, int index, long port, int seq_ports, snd_seq_device_t **awe_ret)
{
snd_seq_device_t *awe;
@@ -1160,7 +1153,6 @@ snd_emu8000_new(snd_card_t *card, int index, long port, int seq_ports, snd_seq_d
* exported stuff
*/
-EXPORT_SYMBOL(snd_emu8000_new);
EXPORT_SYMBOL(snd_emu8000_poke);
EXPORT_SYMBOL(snd_emu8000_peek);
EXPORT_SYMBOL(snd_emu8000_poke_dw);
@@ -1172,21 +1164,3 @@ EXPORT_SYMBOL(snd_emu8000_load_reverb_fx);
EXPORT_SYMBOL(snd_emu8000_update_chorus_mode);
EXPORT_SYMBOL(snd_emu8000_update_reverb_mode);
EXPORT_SYMBOL(snd_emu8000_update_equalizer);
-
-#if 0
-/*
- * INIT part
- */
-
-static int __init alsa_emu8000_init(void)
-{
- return 0;
-}
-
-static void __exit alsa_emu8000_exit(void)
-{
-}
-
-module_init(alsa_emu8000_init)
-module_exit(alsa_emu8000_exit)
-#endif
diff --git a/sound/isa/sb/es968.c b/sound/isa/sb/es968.c
index bd9bace2c2b0..6be4cbf44654 100644
--- a/sound/isa/sb/es968.c
+++ b/sound/isa/sb/es968.c
@@ -231,7 +231,7 @@ static int __init snd_card_es968_probe(int dev)
static int __init snd_es968_isapnp_detect(struct isapnp_card *card,
const struct isapnp_card_id *id)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 30f5c3d762da..a8e895946d6f 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -556,7 +556,7 @@ static int __init snd_sb16_probe(int dev)
static int __init snd_sb16_probe_legacy_port(unsigned long port)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
@@ -580,7 +580,7 @@ static int __init snd_sb16_probe_legacy_port(unsigned long port)
static int __init snd_sb16_isapnp_detect(struct isapnp_card *card,
const struct isapnp_card_id *id)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/sb/sb16_main.c b/sound/isa/sb/sb16_main.c
index bd3ddcf38e68..01ad20cd4c5d 100644
--- a/sound/isa/sb/sb16_main.c
+++ b/sound/isa/sb/sb16_main.c
@@ -778,7 +778,7 @@ int snd_sb16dsp_configure(sb_t * chip)
return -EINVAL;
}
}
- if (chip->dma16 >= 0) {
+ if (chip->dma16 >= 0 && chip->dma16 != chip->dma8) {
switch (chip->dma16) {
case 5:
dmareg |= SB_DMASETUP_DMA5;
@@ -869,7 +869,10 @@ int snd_sb16dsp_pcm(sb_t * chip, int device, snd_pcm_t ** rpcm)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sb16_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb16_capture_ops);
- snd_ctl_add(card, snd_ctl_new1(&snd_sb16_dma_control, chip));
+ if (chip->dma16 >= 0 && chip->dma8 != chip->dma16)
+ snd_ctl_add(card, snd_ctl_new1(&snd_sb16_dma_control, chip));
+ else
+ pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;
snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 128*1024);
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index 1cbf406d389f..f2bf2e5c1bbb 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -183,7 +183,7 @@ static int __init snd_sb8_probe(int dev)
static int __init snd_card_sb8_legacy_auto_probe(unsigned long port)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c
index 3f7a796773a0..ef6c1c5f7bed 100644
--- a/sound/isa/sb/sb_common.c
+++ b/sound/isa/sb/sb_common.c
@@ -191,7 +191,7 @@ static int snd_sbdsp_free(sb_t *chip)
disable_dma(chip->dma8);
free_dma(chip->dma8);
}
- if (chip->dma16 >= 0) {
+ if (chip->dma16 >= 0 && chip->dma16 != chip->dma8) {
disable_dma(chip->dma16);
free_dma(chip->dma16);
}
@@ -257,9 +257,14 @@ int snd_sbdsp_create(snd_card_t *card,
return -EBUSY;
}
chip->dma8 = dma8;
- if (dma16 >= 0 && request_dma(dma16, "SoundBlaster - 16bit")) {
- snd_sbdsp_free(chip);
- return -EBUSY;
+ if (dma16 >= 0) {
+ if (dma16 < 5 || dma16 > 7) {
+ /* Vibra has no 16bit DMA - no duplex */
+ dma16 = dma8;
+ } else if (request_dma(dma16, "SoundBlaster - 16bit")) {
+ snd_sbdsp_free(chip);
+ return -EBUSY;
+ }
}
chip->dma16 = dma16;
#endif
diff --git a/sound/isa/wavefront/Makefile b/sound/isa/wavefront/Makefile
index 230f389b1867..633ca2ee5127 100644
--- a/sound/isa/wavefront/Makefile
+++ b/sound/isa/wavefront/Makefile
@@ -5,14 +5,8 @@
O_TARGET := _wavefront.o
-#list-multi := snd-wavefront-fx.o snd-wavefront-synth.o snd-wavefront.o
list-multi := snd-wavefront.o
-#export-objs := wavefront_fx.o wavefront_synth.o
-
-#snd-wavefront-fx-objs := wavefront_fx.o
-#snd-wavefront-synth-objs := wavefront_synth.o wavefront_midi.o
-#snd-wavefront-objs := wavefront.o
snd-wavefront-objs := wavefront.o wavefront_fx.o wavefront_synth.o wavefront_midi.o
# Toplevel Module Dependency
@@ -20,11 +14,5 @@ obj-$(CONFIG_SND_WAVEFRONT) += snd-wavefront.o
include $(TOPDIR)/Rules.make
-snd-wavefront-fx.o: $(snd-wavefront-fx-objs)
- $(LD) $(LD_RFLAG) -r -o $@ $(snd-wavefront-fx-objs)
-
-snd-wavefront-synth.o: $(snd-wavefront-synth-objs)
- $(LD) $(LD_RFLAG) -r -o $@ $(snd-wavefront-synth-objs)
-
snd-wavefront.o: $(snd-wavefront-objs)
$(LD) $(LD_RFLAG) -r -o $@ $(snd-wavefront-objs)
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 0e0ae3c795c9..e52c8e0ce5e9 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -58,7 +58,8 @@ static int snd_dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */
static int snd_use_cs4232_midi[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
-MODULE_PARM_SYNTAX(snd_index, "Index value for WaveFront soundcard.");
+MODULE_PARM_DESC(snd_index, "Index value for WaveFront soundcard.");
+MODULE_PARM_SYNTAX(snd_index, SNDRV_INDEX_DESC);
MODULE_PARM(snd_id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
MODULE_PARM_DESC(snd_id, "ID string for WaveFront soundcard.");
MODULE_PARM_SYNTAX(snd_id, SNDRV_ID_DESC);
@@ -99,7 +100,7 @@ MODULE_PARM_DESC(snd_fm_port, "FM port #.");
MODULE_PARM_SYNTAX(snd_fm_port, SNDRV_PORT12_DESC);
MODULE_PARM(snd_use_cs4232_midi, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
MODULE_PARM_DESC(snd_use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)");
-MODULE_PARM_SYNTAX(snd_use_cs4232_midi, SNDRV_ENABLED ",allows use of CS4323 MPU-401 interface");
+MODULE_PARM_SYNTAX(snd_use_cs4232_midi, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
static snd_card_t *snd_wavefront_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
@@ -701,7 +702,7 @@ snd_wavefront_probe (int dev)
static int __init snd_wavefront_isapnp_detect(struct isapnp_card *card,
const struct isapnp_card_id *id)
{
- static int dev = 0;
+ static int dev;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c
index 12e1cacb8225..578333e7cae6 100644
--- a/sound/isa/wavefront/wavefront_fx.c
+++ b/sound/isa/wavefront/wavefront_fx.c
@@ -27,13 +27,6 @@
#include <sound/yss225.h>
#include <sound/initval.h>
-#if 0
-MODULE_AUTHOR("Paul Davis <pbd@op.net>");
-MODULE_DESCRIPTION("ALSA driver for Turtle Beach Tropez+ YSS225 FX Processor");
-MODULE_LICENSE("GPL");
-MODULE_CLASSES("{sound}");
-#endif
-
/* Control bits for the Load Control Register
*/
@@ -256,7 +249,7 @@ snd_wavefront_fx_ioctl (snd_hwdep_t *sdev, struct file *file,
*/
-int
+int __init
snd_wavefront_fx_start (snd_wavefront_t *dev)
{
@@ -1031,22 +1024,3 @@ static unsigned char coefficients3[] __initdata = {
0x0f, 0xd7, 0x0f, 0xd7, 0x0f, 0xff, 0x0f, 0xff
};
-#if 0
-EXPORT_SYMBOL(snd_wavefront_fx_start);
-EXPORT_SYMBOL(snd_wavefront_fx_detect);
-EXPORT_SYMBOL(snd_wavefront_fx_ioctl);
-EXPORT_SYMBOL(snd_wavefront_fx_open);
-EXPORT_SYMBOL(snd_wavefront_fx_release);
-
-static int __init alsa_wavefront_fx_init(void)
-{
- return 0;
-}
-
-static void __exit alsa_wavefront_fx_exit(void)
-{
-}
-
-module_init(alsa_wavefront_fx_init)
-module_exit(alsa_wavefront_fx_exit)
-#endif
diff --git a/sound/isa/wavefront/wavefront_midi.c b/sound/isa/wavefront/wavefront_midi.c
index b54c7171c280..74dfa45eaf69 100644
--- a/sound/isa/wavefront/wavefront_midi.c
+++ b/sound/isa/wavefront/wavefront_midi.c
@@ -478,7 +478,7 @@ snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *card)
spin_unlock_irqrestore (&card->wavefront.midi.virtual, flags);
}
-int
+int __init
snd_wavefront_midi_start (snd_wavefront_card_t *card)
{
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
index 777bb390fc0d..7eada978a69a 100644
--- a/sound/isa/wavefront/wavefront_synth.c
+++ b/sound/isa/wavefront/wavefront_synth.c
@@ -84,12 +84,6 @@ int ramcheck_time = 20; /* time in seconds to wait while ROM code
int osrun_time = 10; /* time in seconds we wait for the OS to
start running.
*/
-#if 0
-MODULE_AUTHOR("Paul Barton-Davis <pbd@op.net>");
-MODULE_DESCRIPTION("ALSA driver for Turtle Beach WaveFront ICS2215 Synth");
-MODULE_LICENSE("GPL");
-MODULE_CLASSES("{sound}");
-#endif
MODULE_PARM(wf_raw,"i");
MODULE_PARM_DESC(wf_raw, "if non-zero, assume that we need to boot the OS");
MODULE_PARM(fx_raw,"i");
@@ -1729,7 +1723,7 @@ snd_wavefront_internal_interrupt (snd_wavefront_card_t *card)
7 Unused
*/
-int
+int __init
snd_wavefront_interrupt_bits (int irq)
{
@@ -1757,7 +1751,7 @@ snd_wavefront_interrupt_bits (int irq)
return bits;
}
-static void
+static void __init
wavefront_should_cause_interrupt (snd_wavefront_t *dev,
int val, int port, int timeout)
@@ -1772,7 +1766,7 @@ wavefront_should_cause_interrupt (snd_wavefront_t *dev,
restore_flags (flags);
}
-static int
+static int __init
wavefront_reset_to_cleanliness (snd_wavefront_t *dev)
{
@@ -1932,7 +1926,7 @@ wavefront_reset_to_cleanliness (snd_wavefront_t *dev)
static int errno;
-static int
+static int __init
wavefront_download_firmware (snd_wavefront_t *dev, char *path)
{
@@ -2027,7 +2021,7 @@ wavefront_download_firmware (snd_wavefront_t *dev, char *path)
}
-static int
+static int __init
wavefront_do_reset (snd_wavefront_t *dev)
{
@@ -2116,7 +2110,7 @@ wavefront_do_reset (snd_wavefront_t *dev)
return 1;
}
-int
+int __init
snd_wavefront_start (snd_wavefront_t *dev)
{
@@ -2158,7 +2152,7 @@ snd_wavefront_start (snd_wavefront_t *dev)
return (0);
}
-int
+int __init
snd_wavefront_detect (snd_wavefront_card_t *card)
{
@@ -2212,33 +2206,3 @@ snd_wavefront_detect (snd_wavefront_card_t *card)
return 0;
}
-
-#if 0
-EXPORT_SYMBOL(snd_wavefront_synth_ioctl);
-EXPORT_SYMBOL(snd_wavefront_synth_open);
-EXPORT_SYMBOL(snd_wavefront_synth_release);
-EXPORT_SYMBOL(snd_wavefront_internal_interrupt);
-EXPORT_SYMBOL(snd_wavefront_interrupt_bits);
-EXPORT_SYMBOL(snd_wavefront_start);
-EXPORT_SYMBOL(snd_wavefront_detect);
-EXPORT_SYMBOL(snd_wavefront_cmd);
- /* wavefront_midi.c */
-EXPORT_SYMBOL(snd_wavefront_midi_interrupt);
-EXPORT_SYMBOL(snd_wavefront_midi_enable_virtual);
-EXPORT_SYMBOL(snd_wavefront_midi_disable_virtual);
-EXPORT_SYMBOL(snd_wavefront_midi_start);
-EXPORT_SYMBOL(snd_wavefront_midi_input);
-EXPORT_SYMBOL(snd_wavefront_midi_output);
-
-static int __init alsa_wavefront_init(void)
-{
- return 0;
-}
-
-static void __exit alsa_wavefront_exit(void)
-{
-}
-
-module_init(alsa_wavefront_init)
-module_exit(alsa_wavefront_exit)
-#endif
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index e722c3c1f759..7b6a98b6ec1a 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -36,7 +36,7 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
MODULE_DESCRIPTION("Universal interface for Audio Codec '97");
MODULE_LICENSE("GPL");
-static int enable_loopback = 0;
+static int enable_loopback;
MODULE_PARM(enable_loopback, "i");
MODULE_PARM_DESC(enable_loopback, "Enable AC97 ADC/DAC Loopback Control");
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 224d39d5d909..655413335419 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -2177,7 +2177,7 @@ static int __devinit snd_ali_create(snd_card_t * card,
static int __devinit snd_ali_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
ali_t *codec;
int err;
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 0e937020dfbc..95da106ea22f 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -558,7 +558,7 @@ static void snd_card_als4k_free( snd_card_t *card )
static int __devinit snd_card_als4k_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
snd_card_als4000_t *acard;
unsigned long gcr;
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 926b5705b01a..7a6ed6279386 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -1485,9 +1485,10 @@ static int snd_cmipci_playback_spdif_open(snd_pcm_substream_t *substream)
if ((err = open_device_check(cm, CM_OPEN_SPDIF_PLAYBACK, substream)) < 0) /* use channel A */
return err;
runtime->hw = snd_cmipci_playback_spdif;
- if (cm->can_ac3_hw) {
+#ifdef DO_SOFT_AC3
+ if (cm->can_ac3_hw)
+#endif
runtime->hw.info |= SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID;
- }
snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 0, 0x40000);
cm->dig_pcm_status = cm->dig_status;
return 0;
@@ -2461,8 +2462,11 @@ static int snd_cmipci_free(cmipci_t *cm)
snd_cmipci_proc_done(cm);
if (cm->irq >= 0) {
+ snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN);
+ snd_cmipci_clear_bit(cm, CM_REG_LEGACY_CTRL, CM_ENSPDOUT);
snd_cmipci_write(cm, CM_REG_INT_HLDCLR, 0); /* disable ints */
snd_cmipci_write(cm, CM_REG_FUNCTRL0, 0); /* disable channels */
+ snd_cmipci_write(cm, CM_REG_FUNCTRL1, 0);
/* reset mixer */
snd_cmipci_mixer_write(cm, 0, 0);
@@ -2597,12 +2601,20 @@ static int __devinit snd_cmipci_create(snd_card_t *card,
if (snd_opl3_create(card, iosynth, iosynth + 2,
OPL3_HW_OPL3, 0, &cm->opl3) < 0) {
- printk(KERN_ERR "cmipci: no OPL device at 0x%lx\n", iosynth);
+ printk(KERN_ERR "cmipci: no OPL device at 0x%lx, skipping...\n", iosynth);
+ iosynth = 0;
} else {
- if ((err = snd_opl3_hwdep_new(cm->opl3, 0, 1, &cm->opl3hwdep)) < 0)
+ if ((err = snd_opl3_hwdep_new(cm->opl3, 0, 1, &cm->opl3hwdep)) < 0) {
printk(KERN_ERR "cmipci: cannot create OPL3 hwdep\n");
+ return err;
+ }
}
}
+ if (! iosynth) {
+ /* disable FM */
+ snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val & ~CM_FMSEL_MASK);
+ snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN);
+ }
/* reset mixer */
snd_cmipci_mixer_write(cm, 0, 0);
@@ -2658,7 +2670,7 @@ MODULE_DEVICE_TABLE(pci, snd_cmipci_ids);
static int __devinit snd_cmipci_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
cmipci_t *cm;
int err;
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index 5aad9f4f905d..0b3a68d6d3cd 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -35,16 +35,9 @@
#include <sound/initval.h>
#ifndef LINUX_2_2
-#if defined(CONFIG_INPUT_GAMEPORT) || defined(CONFIG_INPUT_GAMEPORT_MODULE)
-#define HAVE_GAMEPORT_SUPPORT
-#endif
-#endif
-
-#ifdef HAVE_GAMEPORT_SUPPORT
#include <linux/gameport.h>
#endif
-
EXPORT_NO_SYMBOLS;
MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
@@ -469,13 +462,6 @@ struct snd_cs4281_dma {
int frag; /* period number */
};
-#ifdef HAVE_GAMEPORT_SUPPORT
-typedef struct snd_cs4281_gameport {
- struct gameport info;
- cs4281_t *chip;
-} cs4281_gameport_t;
-#endif
-
struct snd_cs4281 {
int irq;
@@ -513,9 +499,7 @@ struct snd_cs4281 {
unsigned int uartm;
snd_info_entry_t *proc_entry;
-#ifdef HAVE_GAMEPORT_SUPPORT
- cs4281_gameport_t *gameport;
-#endif
+ struct snd_cs4281_gameport *gameport;
};
static void snd_cs4281_interrupt(int irq, void *dev_id, struct pt_regs *regs);
@@ -1192,12 +1176,109 @@ static void snd_cs4281_proc_done(cs4281_t * chip)
}
/*
+ * joystick support
+ */
+
+#ifndef LINUX_2_2
+
+typedef struct snd_cs4281_gameport {
+ struct gameport info;
+ cs4281_t *chip;
+} cs4281_gameport_t;
+
+static void snd_cs4281_gameport_trigger(struct gameport *gameport)
+{
+ cs4281_gameport_t *gp = (cs4281_gameport_t *)gameport;
+ cs4281_t *chip;
+ snd_assert(gp, return);
+ chip = snd_magic_cast(cs4281_t, gp->chip, return);
+ snd_cs4281_pokeBA0(chip, BA0_JSPT, 0xff);
+}
+
+static unsigned char snd_cs4281_gameport_read(struct gameport *gameport)
+{
+ cs4281_gameport_t *gp = (cs4281_gameport_t *)gameport;
+ cs4281_t *chip;
+ snd_assert(gp, return 0);
+ chip = snd_magic_cast(cs4281_t, gp->chip, return 0);
+ return snd_cs4281_peekBA0(chip, BA0_JSPT);
+}
+
+#ifdef COOKED_MODE
+static int snd_cs4281_gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons)
+{
+ cs4281_gameport_t *gp = (cs4281_gameport_t *)gameport;
+ cs4281_t *chip;
+ unsigned js1, js2, jst;
+
+ snd_assert(gp, return 0);
+ chip = snd_magic_cast(cs4281_t, gp->chip, return 0);
+
+ js1 = snd_cs4281_peekBA0(chip, BA0_JSC1);
+ js2 = snd_cs4281_peekBA0(chip, BA0_JSC2);
+ jst = snd_cs4281_peekBA0(chip, BA0_JSPT);
+
+ *buttons = (~jst >> 4) & 0x0F;
+
+ axes[0] = ((js1 & JSC1_Y1V_MASK) >> JSC1_Y1V_SHIFT) & 0xFFFF;
+ axes[1] = ((js1 & JSC1_X1V_MASK) >> JSC1_X1V_SHIFT) & 0xFFFF;
+ axes[2] = ((js2 & JSC2_Y2V_MASK) >> JSC2_Y2V_SHIFT) & 0xFFFF;
+ axes[3] = ((js2 & JSC2_X2V_MASK) >> JSC2_X2V_SHIFT) & 0xFFFF;
+
+ for(jst=0;jst<4;++jst)
+ if(axes[jst]==0xFFFF) axes[jst] = -1;
+ return 0;
+}
+#endif
+
+static int snd_cs4281_gameport_open(struct gameport *gameport, int mode)
+{
+ switch (mode) {
+#ifdef COOKED_MODE
+ case GAMEPORT_MODE_COOKED:
+ return 0;
+#endif
+ case GAMEPORT_MODE_RAW:
+ return 0;
+ default:
+ return -1;
+ }
+ return 0;
+}
+
+static void __devinit snd_cs4281_gameport(cs4281_t *chip)
+{
+ cs4281_gameport_t *gp;
+ gp = kmalloc(sizeof(*gp), GFP_KERNEL);
+ if (! gp) {
+ snd_printk("cannot allocate gameport area\n");
+ return;
+ }
+ memset(gp, 0, sizeof(*gp));
+ gp->info.open = snd_cs4281_gameport_open;
+ gp->info.read = snd_cs4281_gameport_read;
+ gp->info.trigger = snd_cs4281_gameport_trigger;
+#ifdef COOKED_MODE
+ gp->info.cooked_read = snd_cs4281_gameport_cooked_read;
+#endif
+ gp->chip = chip;
+ chip->gameport = gp;
+
+ snd_cs4281_pokeBA0(chip, BA0_JSIO, 0xFF); // ?
+ snd_cs4281_pokeBA0(chip, BA0_JSCTL, JSCTL_SP_MEDIUM_SLOW);
+ gameport_register_port(&gp->info);
+}
+
+#endif /* !LINUX_2_2 */
+
+
+/*
*/
static int snd_cs4281_free(cs4281_t *chip)
{
-#ifdef HAVE_GAMEPORT_SUPPORT
+#ifndef LINUX_2_2
if (chip->gameport) {
gameport_unregister_port(&chip->gameport->info);
kfree(chip->gameport);
@@ -1733,100 +1814,11 @@ static void snd_cs4281_interrupt(int irq, void *dev_id, struct pt_regs *regs)
snd_cs4281_pokeBA0(chip, BA0_HICR, BA0_HICR_EOI);
}
-#ifdef HAVE_GAMEPORT_SUPPORT
-/*
- * joystick support
- */
-static void snd_cs4281_gameport_trigger(struct gameport *gameport)
-{
- cs4281_gameport_t *gp = (cs4281_gameport_t *)gameport;
- cs4281_t *chip;
- snd_assert(gp, return);
- chip = snd_magic_cast(cs4281_t, gp->chip, return);
- snd_cs4281_pokeBA0(chip, BA0_JSPT, 0xff);
-}
-
-static unsigned char snd_cs4281_gameport_read(struct gameport *gameport)
-{
- cs4281_gameport_t *gp = (cs4281_gameport_t *)gameport;
- cs4281_t *chip;
- snd_assert(gp, return 0);
- chip = snd_magic_cast(cs4281_t, gp->chip, return 0);
- return snd_cs4281_peekBA0(chip, BA0_JSPT);
-}
-
-#ifdef COOKED_MODE
-static int snd_cs4281_gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons)
-{
- cs4281_gameport_t *gp = (cs4281_gameport_t *)gameport;
- cs4281_t *chip;
- unsigned js1, js2, jst;
-
- snd_assert(gp, return);
- chip = snd_magic_cast(cs4281_t, gp->chip, return);
-
- js1 = snd_cs4281_peekBA0(chip, BA0_JSC1);
- js2 = snd_cs4281_peekBA0(chip, BA0_JSC2);
- jst = snd_cs4281_peekBA0(chip, BA0_JSPT);
-
- *buttons = (~jst >> 4) & 0x0F;
-
- axes[0] = ((js1 & JSC1_Y1V_MASK) >> JSC1_Y1V_SHIFT) & 0xFFFF;
- axes[1] = ((js1 & JSC1_X1V_MASK) >> JSC1_X1V_SHIFT) & 0xFFFF;
- axes[2] = ((js2 & JSC2_Y2V_MASK) >> JSC2_Y2V_SHIFT) & 0xFFFF;
- axes[3] = ((js2 & JSC2_X2V_MASK) >> JSC2_X2V_SHIFT) & 0xFFFF;
-
- for(jst=0;jst<4;++jst)
- if(axes[jst]==0xFFFF) axes[jst] = -1;
- return 0;
-}
-#endif
-
-static int snd_cs4281_gameport_open(struct gameport *gameport, int mode)
-{
- switch (mode) {
-#ifdef COOKED_MODE
- case GAMEPORT_MODE_COOKED:
- return 0;
-#endif
- case GAMEPORT_MODE_RAW:
- return 0;
- default:
- return -1;
- }
- return 0;
-}
-
-static void __devinit snd_cs4281_gameport(cs4281_t *chip)
-{
- cs4281_gameport_t *gp;
- gp = kmalloc(sizeof(*gp), GFP_KERNEL);
- if (! gp) {
- snd_printk("cannot allocate gameport area\n");
- return;
- }
- memset(gp, 0, sizeof(*gp));
- gp->info.open = snd_cs4281_gameport_open;
- gp->info.read = snd_cs4281_gameport_read;
- gp->info.trigger = snd_cs4281_gameport_trigger;
-#ifdef COOKED_MODE
- gp->info.cooked_read = snd_cs4281_gameport_cooked_read;
-#endif
- gp->chip = chip;
- chip->gameport = gp;
-
- snd_cs4281_pokeBA0(chip, BA0_JSIO, 0xFF); // ?
- snd_cs4281_pokeBA0(chip, BA0_JSCTL, JSCTL_SP_MEDIUM_SLOW);
- gameport_register_port(&gp->info);
-}
-
-#endif /* HAVE_GAMEPORT_SUPPORT */
-
static int __devinit snd_cs4281_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
cs4281_t *chip;
opl3_t *opl3;
@@ -1871,7 +1863,7 @@ static int __devinit snd_cs4281_probe(struct pci_dev *pci,
snd_card_free(card);
return err;
}
-#ifdef HAVE_GAMEPORT_SUPPORT
+#ifndef LINUX_2_2
snd_cs4281_gameport(chip);
#endif
strcpy(card->driver, "CS4281");
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c
index 61a2120e8743..0d0f8493aefe 100644
--- a/sound/pci/cs46xx/cs46xx.c
+++ b/sound/pci/cs46xx/cs46xx.c
@@ -51,6 +51,9 @@ static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
static int snd_external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
static int snd_thinkpad[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
+#ifndef CONFIG_SND_CS46XX_ACCEPT_VALID
+static int snd_mmap_valid[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
+#endif
MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
MODULE_PARM_DESC(snd_index, "Index value for the CS46xx soundcard.");
@@ -67,6 +70,11 @@ MODULE_PARM_SYNTAX(snd_external_amp, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC)
MODULE_PARM(snd_thinkpad, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
MODULE_PARM_DESC(snd_thinkpad, "Force to enable Thinkpad's CLKRUN control.");
MODULE_PARM_SYNTAX(snd_thinkpad, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
+#ifndef CONFIG_SND_CS46XX_ACCEPT_VALID
+MODULE_PARM(snd_mmap_valid, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+MODULE_PARM_DESC(snd_mmap_valid, "Support OSS mmap.");
+MODULE_PARM_SYNTAX(snd_mmap_valid, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
+#endif
static struct pci_device_id snd_cs46xx_ids[] __devinitdata = {
{ 0x1013, 0x6001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* CS4280 */
@@ -80,7 +88,7 @@ MODULE_DEVICE_TABLE(pci, snd_cs46xx_ids);
static int __devinit snd_card_cs46xx_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
cs46xx_t *chip;
int err;
@@ -101,6 +109,11 @@ static int __devinit snd_card_cs46xx_probe(struct pci_dev *pci,
snd_card_free(card);
return err;
}
+#ifdef CONFIG_SND_CS46XX_ACCEPT_VALID
+ chip->accept_valid = 1;
+#else
+ chip->accept_valid = snd_mmap_valid[dev];
+#endif
if ((err = snd_cs46xx_pcm(chip, 0, NULL)) < 0) {
snd_card_free(card);
return err;
@@ -113,6 +126,8 @@ static int __devinit snd_card_cs46xx_probe(struct pci_dev *pci,
snd_card_free(card);
return err;
}
+ snd_cs46xx_gameport(chip);
+
strcpy(card->driver, "CS46xx");
strcpy(card->shortname, "Sound Fusion CS46xx");
sprintf(card->longname, "%s at 0x%lx/0x%lx, irq %i",
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 083a2b7236be..6f7ffc33efac 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -41,6 +41,9 @@
#include <sound/control.h>
#include <sound/info.h>
#include <sound/cs46xx.h>
+#ifndef LINUX_2_2
+#include <linux/gameport.h>
+#endif
#define chip_t cs46xx_t
@@ -48,10 +51,6 @@
* constants
*/
-#if 0
-#define SND_CONFIG_CS46XX_ACCEPT_VALID /* REQUIRED ONLY FOR OSS EMULATION */
-#endif
-
#define CS46XX_BA0_SIZE 0x1000
#define CS46XX_BA1_DATA0_SIZE 0x3000
#define CS46XX_BA1_DATA1_SIZE 0x3800
@@ -1049,10 +1048,6 @@ static void snd_cs46xx_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static snd_pcm_hardware_t snd_cs46xx_playback =
{
info: (SNDRV_PCM_INFO_MMAP |
-#ifdef SND_CONFIG_CS46XX_ACCEPT_VALID
- /* NOT TRUE!!! OSS REQUIRES IT */
- SNDRV_PCM_INFO_MMAP_VALID |
-#endif
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_RESUME),
@@ -1075,10 +1070,6 @@ static snd_pcm_hardware_t snd_cs46xx_playback =
static snd_pcm_hardware_t snd_cs46xx_capture =
{
info: (SNDRV_PCM_INFO_MMAP |
-#ifdef SND_CONFIG_CS46XX_ACCEPT_VALID
- /* NOT TRUE!!! OSS REQUIRES IT */
- SNDRV_PCM_INFO_MMAP_VALID |
-#endif
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_RESUME),
@@ -1104,6 +1095,8 @@ static int snd_cs46xx_playback_open(snd_pcm_substream_t * substream)
return -ENOMEM;
chip->play.substream = substream;
substream->runtime->hw = snd_cs46xx_playback;
+ if (chip->accept_valid)
+ substream->runtime->hw.info |= SNDRV_PCM_INFO_MMAP_VALID;
chip->active_ctrl(chip, 1);
chip->amplifier_ctrl(chip, 1);
return 0;
@@ -1117,6 +1110,8 @@ static int snd_cs46xx_capture_open(snd_pcm_substream_t * substream)
return -ENOMEM;
chip->capt.substream = substream;
substream->runtime->hw = snd_cs46xx_capture;
+ if (chip->accept_valid)
+ substream->runtime->hw.info |= SNDRV_PCM_INFO_MMAP_VALID;
chip->active_ctrl(chip, 1);
chip->amplifier_ctrl(chip, 1);
return 0;
@@ -1501,6 +1496,103 @@ int __devinit snd_cs46xx_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rrawmi
return 0;
}
+
+/*
+ * gameport interface
+ */
+
+#ifndef LINUX_2_2
+
+typedef struct snd_cs46xx_gameport {
+ struct gameport info;
+ cs46xx_t *chip;
+} cs46xx_gameport_t;
+
+static void snd_cs46xx_gameport_trigger(struct gameport *gameport)
+{
+ cs46xx_gameport_t *gp = (cs46xx_gameport_t *)gameport;
+ cs46xx_t *chip;
+ snd_assert(gp, return);
+ chip = snd_magic_cast(cs46xx_t, gp->chip, return);
+ snd_cs46xx_pokeBA0(chip, BA0_JSPT, 0xFF); //outb(gameport->io, 0xFF);
+}
+
+static unsigned char snd_cs46xx_gameport_read(struct gameport *gameport)
+{
+ cs46xx_gameport_t *gp = (cs46xx_gameport_t *)gameport;
+ cs46xx_t *chip;
+ snd_assert(gp, return 0);
+ chip = snd_magic_cast(cs46xx_t, gp->chip, return 0);
+ return snd_cs46xx_peekBA0(chip, BA0_JSPT); //inb(gameport->io);
+}
+
+static int snd_cs46xx_gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons)
+{
+ cs46xx_gameport_t *gp = (cs46xx_gameport_t *)gameport;
+ cs46xx_t *chip;
+ unsigned js1, js2, jst;
+
+ snd_assert(gp, return 0);
+ chip = snd_magic_cast(cs46xx_t, gp->chip, return 0);
+
+ js1 = snd_cs46xx_peekBA0(chip, BA0_JSC1);
+ js2 = snd_cs46xx_peekBA0(chip, BA0_JSC2);
+ jst = snd_cs46xx_peekBA0(chip, BA0_JSPT);
+
+ *buttons = (~jst >> 4) & 0x0F;
+
+ axes[0] = ((js1 & JSC1_Y1V_MASK) >> JSC1_Y1V_SHIFT) & 0xFFFF;
+ axes[1] = ((js1 & JSC1_X1V_MASK) >> JSC1_X1V_SHIFT) & 0xFFFF;
+ axes[2] = ((js2 & JSC2_Y2V_MASK) >> JSC2_Y2V_SHIFT) & 0xFFFF;
+ axes[3] = ((js2 & JSC2_X2V_MASK) >> JSC2_X2V_SHIFT) & 0xFFFF;
+
+ for(jst=0;jst<4;++jst)
+ if(axes[jst]==0xFFFF) axes[jst] = -1;
+ return 0;
+}
+
+static int snd_cs46xx_gameport_open(struct gameport *gameport, int mode)
+{
+ switch (mode) {
+ case GAMEPORT_MODE_COOKED:
+ return 0;
+ case GAMEPORT_MODE_RAW:
+ return 0;
+ default:
+ return -1;
+ }
+ return 0;
+}
+
+void __devinit snd_cs46xx_gameport(cs46xx_t *chip)
+{
+ cs46xx_gameport_t *gp;
+ gp = kmalloc(sizeof(*gp), GFP_KERNEL);
+ if (! gp) {
+ snd_printk("cannot allocate gameport area\n");
+ return;
+ }
+ memset(gp, 0, sizeof(*gp));
+ gp->info.open = snd_cs46xx_gameport_open;
+ gp->info.read = snd_cs46xx_gameport_read;
+ gp->info.trigger = snd_cs46xx_gameport_trigger;
+ gp->info.cooked_read = snd_cs46xx_gameport_cooked_read;
+ gp->chip = chip;
+ chip->gameport = gp;
+
+ snd_cs46xx_pokeBA0(chip, BA0_JSIO, 0xFF); // ?
+ snd_cs46xx_pokeBA0(chip, BA0_JSCTL, JSCTL_SP_MEDIUM_SLOW);
+ gameport_register_port(&gp->info);
+}
+
+#else /* LINUX_2_2 */
+
+void __devinit snd_cs46xx_gameport(cs46xx_t *chip)
+{
+}
+
+#endif /* !LINUX_2_2 */
+
/*
* proc interface
*/
@@ -1635,6 +1727,12 @@ static int snd_cs46xx_free(cs46xx_t *chip)
if (chip->active_ctrl)
chip->active_ctrl(chip, 1);
+#ifndef LINUX_2_2
+ if (chip->gameport) {
+ gameport_unregister_port(&chip->gameport->info);
+ kfree(chip->gameport);
+ }
+#endif
#ifdef CONFIG_PM
if (chip->pm_dev)
pm_unregister(chip->pm_dev);
diff --git a/sound/pci/emu10k1/Makefile b/sound/pci/emu10k1/Makefile
index fb6a5b0a6737..854541e5e73a 100644
--- a/sound/pci/emu10k1/Makefile
+++ b/sound/pci/emu10k1/Makefile
@@ -17,7 +17,7 @@ snd-emu10k1-synth-objs := emu10k1_synth.o emu10k1_callback.o emu10k1_patch.o
# Toplevel Module Dependency
obj-$(CONFIG_SND_EMU10K1) += snd-emu10k1.o
ifeq ($(subst m,y,$(CONFIG_SND_SEQUENCER)),y)
- obj-$(CONFIG_SND_EMU10K1) += snd-emu10k1.o snd-emu10k1-synth.o
+ obj-$(CONFIG_SND_EMU10K1) += snd-emu10k1-synth.o
endif
include $(TOPDIR)/Rules.make
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index 84e0f8fbfbab..1bcbf5b05b10 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -88,7 +88,7 @@ MODULE_DEVICE_TABLE(pci, snd_emu10k1_ids);
static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
emu10k1_t *emu;
#ifdef ENABLE_SYNTH
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 25e08303ecbf..851f97b03593 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -547,7 +547,7 @@ int __devinit snd_emu10k1_create(snd_card_t * card,
snd_printk("architecture does not support 31bit PCI busmaster DMA\n");
return -ENXIO;
}
- if (pci->driver_data)
+ if (pci_get_drvdata(pci))
pci_set_dma_mask(pci, 0xffffffff); /* audigy */
else
pci_set_dma_mask(pci, 0x7fffffff);
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 3e92d39c8659..4995ab708ab3 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -617,7 +617,6 @@ static int snd_emu10k1_capture_trigger(snd_pcm_substream_t * substream,
break;
case CAPTURE_EFX:
snd_emu10k1_ptr_write(emu, FXWC, 0, epcm->capture_cr_val);
- printk(">> FXWC = 0x%x\n", snd_emu10k1_ptr_read(emu, FXWC, 0));
break;
default:
break;
@@ -888,6 +887,7 @@ static int snd_emu10k1_capture_efx_open(snd_pcm_substream_t * substream)
emu10k1_pcm_t *epcm;
snd_pcm_runtime_t *runtime = substream->runtime;
unsigned long flags;
+ int nefx = emu->audigy ? 64 : 32;
int idx;
epcm = snd_magic_kcalloc(emu10k1_pcm_t, 0, GFP_KERNEL);
@@ -908,13 +908,14 @@ static int snd_emu10k1_capture_efx_open(snd_pcm_substream_t * substream)
runtime->hw.rate_min = runtime->hw.rate_max = 48000;
spin_lock_irqsave(&emu->reg_lock, flags);
runtime->hw.channels_min = runtime->hw.channels_max = 0;
- for (idx = 0; idx < 32; idx++) {
- if (emu->efx_voices_mask & (1 << idx)) {
+ for (idx = 0; idx < nefx; idx++) {
+ if (emu->efx_voices_mask[idx/32] & (1 << (idx%32))) {
runtime->hw.channels_min++;
runtime->hw.channels_max++;
}
}
- epcm->capture_cr_val = emu->efx_voices_mask;
+ epcm->capture_cr_val = emu->efx_voices_mask[0];
+ epcm->capture_cr_val2 = emu->efx_voices_mask[1];
spin_unlock_irqrestore(&emu->reg_lock, flags);
emu->capture_efx_interrupt = snd_emu10k1_pcm_efx_interrupt;
emu->pcm_capture_efx_substream = substream;
@@ -1037,8 +1038,10 @@ int __devinit snd_emu10k1_pcm_mic(emu10k1_t * emu, int device, snd_pcm_t ** rpcm
static int snd_emu10k1_pcm_efx_voices_mask_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
{
+ emu10k1_t *emu = snd_kcontrol_chip(kcontrol);
+ int nefx = emu->audigy ? 64 : 32;
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
- uinfo->count = 32;
+ uinfo->count = nefx;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 1;
return 0;
@@ -1048,11 +1051,12 @@ static int snd_emu10k1_pcm_efx_voices_mask_get(snd_kcontrol_t * kcontrol, snd_ct
{
emu10k1_t *emu = snd_kcontrol_chip(kcontrol);
unsigned long flags;
+ int nefx = emu->audigy ? 64 : 32;
int idx;
spin_lock_irqsave(&emu->reg_lock, flags);
- for (idx = 0; idx < 32; idx++)
- ucontrol->value.integer.value[idx] = (emu->efx_voices_mask & (1 << idx)) ? 1 : 0;
+ for (idx = 0; idx < nefx; idx++)
+ ucontrol->value.integer.value[idx] = (emu->efx_voices_mask[idx / 32] & (1 << (idx % 32))) ? 1 : 0;
spin_unlock_irqrestore(&emu->reg_lock, flags);
return 0;
}
@@ -1061,19 +1065,23 @@ static int snd_emu10k1_pcm_efx_voices_mask_put(snd_kcontrol_t * kcontrol, snd_ct
{
emu10k1_t *emu = snd_kcontrol_chip(kcontrol);
unsigned long flags;
- unsigned int nval, bits;
+ unsigned int nval[2], bits;
+ int nefx = emu->audigy ? 64 : 32;
int change, idx;
- for (idx = 0, nval = bits = 0; idx < 32; idx++)
+ nval[0] = nval[1] = 0;
+ for (idx = 0, bits = 0; idx < nefx; idx++)
if (ucontrol->value.integer.value[idx]) {
- nval |= 1 << idx;
+ nval[idx / 32] |= 1 << (idx % 32);
bits++;
}
if (bits != 1 && bits != 2 && bits != 4 && bits != 8)
return -EINVAL;
spin_lock_irqsave(&emu->reg_lock, flags);
- change = nval != emu->efx_voices_mask;
- emu->efx_voices_mask = nval;
+ change = (nval[0] != emu->efx_voices_mask[0]) ||
+ (nval[1] != emu->efx_voices_mask[1]);
+ emu->efx_voices_mask[0] = nval[0];
+ emu->efx_voices_mask[1] = nval[1];
spin_unlock_irqrestore(&emu->reg_lock, flags);
return change;
}
@@ -1126,7 +1134,8 @@ int __devinit snd_emu10k1_pcm_efx(emu10k1_t * emu, int device, snd_pcm_t ** rpcm
if (rpcm)
*rpcm = pcm;
- emu->efx_voices_mask = FXWC_DEFAULTROUTE_C | FXWC_DEFAULTROUTE_A;
+ emu->efx_voices_mask[0] = FXWC_DEFAULTROUTE_C | FXWC_DEFAULTROUTE_A;
+ emu->efx_voices_mask[1] = 0;
snd_ctl_add(emu->card, snd_ctl_new1(&snd_emu10k1_pcm_efx_voices_mask, emu));
snd_pcm_lib_preallocate_pci_pages_for_all(emu->pci, pcm, 64*1024, 64*1024);
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
index a522736355b5..5e0b08a008a0 100644
--- a/sound/pci/emu10k1/emuproc.c
+++ b/sound/pci/emu10k1/emuproc.c
@@ -107,6 +107,7 @@ static void snd_emu10k1_proc_read(snd_info_entry_t *entry,
};
emu10k1_t *emu = snd_magic_cast(emu10k1_t, entry->private_data, return);
unsigned int val;
+ int nefx = emu->audigy ? 64 : 32;
int idx;
snd_iprintf(buffer, "EMU10K1\n\n");
@@ -132,9 +133,9 @@ static void snd_emu10k1_proc_read(snd_info_entry_t *entry,
(val >> 28) & 0x0f);
}
snd_iprintf(buffer, "\nCaptured FX Outputs :\n");
- for (idx = 0; idx < 32; idx++) {
- if (emu->efx_voices_mask & (1 << idx))
- snd_iprintf(buffer, " Output %02i [%s]\n", idx, outputs[idx]);
+ for (idx = 0; idx < nefx; idx++) {
+ if (emu->efx_voices_mask[idx/32] & (1 << (idx%32)))
+ snd_iprintf(buffer, " Output %02i [%s]\n", idx, outputs[idx%32]);
}
snd_iprintf(buffer, "\nAll FX Outputs :\n");
for (idx = 0; idx < 32; idx++)
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 64e94e63a398..3e8ab6870712 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -1961,7 +1961,7 @@ static void snd_audiopci_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static int __devinit snd_audiopci_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
ensoniq_t *ensoniq;
int err, pcm_devs[2];
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 0aaa38c0f18f..e112b7171a37 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -1583,7 +1583,7 @@ static int __init snd_es1938_mixer(snd_pcm_t *pcm)
static int __devinit snd_es1938_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
es1938_t *chip;
snd_pcm_t *pcm;
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 905e176d272d..0552bdcfc186 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -1939,11 +1939,11 @@ static void snd_es1968_update_pcm(es1968_t *chip, esschan_t *es)
es->hwptr = hwptr;
es->count += diff;
- while (es->count > es->frag_size) {
+ if (es->count > es->frag_size) {
spin_unlock(&chip->substream_lock);
snd_pcm_period_elapsed(subs);
spin_lock(&chip->substream_lock);
- es->count -= es->frag_size;
+ es->count %= es->frag_size;
}
}
@@ -2663,7 +2663,7 @@ static snd_kcontrol_new_t snd_es1968_control_switches[] __devinitdata = {
static int __devinit snd_es1968_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
es1968_t *chip;
int i, err;
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index c8432ef99477..b646dfe259fa 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1025,7 +1025,7 @@ static int __devinit snd_fm801_create(snd_card_t * card,
static int __devinit snd_card_fm801_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
fm801_t *chip;
opl3_t *opl3;
diff --git a/sound/pci/ice1712.c b/sound/pci/ice1712.c
index 6cf4a16cac2e..2fff96764285 100644
--- a/sound/pci/ice1712.c
+++ b/sound/pci/ice1712.c
@@ -98,6 +98,7 @@ MODULE_PARM_SYNTAX(snd_omni, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
#define ICE1712_SUBDEVICE_DELTA66 0x121432d6
#define ICE1712_SUBDEVICE_DELTA44 0x121433d6
#define ICE1712_SUBDEVICE_AUDIOPHILE 0x121434d6
+#define ICE1712_SUBDEVICE_DELTA1010LT 0x12143bd6
#define ICE1712_SUBDEVICE_EWX2496 0x3b153011
#define ICE1712_SUBDEVICE_EWS88MT 0x3b151511
#define ICE1712_SUBDEVICE_EWS88D 0x3b152b11
@@ -4196,7 +4197,7 @@ static int __devinit snd_ice1712_create(snd_card_t * card,
static int __devinit snd_ice1712_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
ice1712_t *ice;
int pcm_dev = 0, err;
@@ -4266,6 +4267,9 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
case ICE1712_SUBDEVICE_AUDIOPHILE:
strcpy(card->shortname, "M Audio Audiophile 24/96");
break;
+ case ICE1712_SUBDEVICE_DELTA1010LT:
+ strcpy(card->shortname, "M Audio Delta 1010LT");
+ break;
case ICE1712_SUBDEVICE_EWX2496:
strcpy(card->shortname, "TerraTec EWX 24/96");
break;
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 26bc53ed12cd..b971fa91fefe 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -51,7 +51,9 @@ MODULE_DEVICES("{{Intel,82801AA},"
"{Intel,ICH3},"
"{Intel,MX440},"
"{SiS,SI7012},"
- "{NVidia,NForce Audio}}");
+ "{NVidia,NForce Audio},"
+ "{AMD,AMD768},"
+ "{AMD,AMD8111}}");
#define SUPPORT_JOYSTICK 1
#define SUPPORT_MIDI 1
@@ -285,7 +287,8 @@ static struct pci_device_id snd_intel8x0_ids[] __devinitdata = {
{ 0x8086, 0x7195, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 440MX */
{ 0x1039, 0x7012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_SIS }, /* SI7012 */
{ 0x10de, 0x01b1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* NFORCE */
- { 0x764d, 0x1022, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* AMD8111 */
+ { 0x1022, 0x764d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* AMD8111 */
+ { 0x1022, 0x7445, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* AMD768 */
{ 0, }
};
@@ -1392,14 +1395,15 @@ static struct shortname_table {
{ PCI_DEVICE_ID_INTEL_ICH3, "Intel ICH3" },
{ PCI_DEVICE_ID_SI_7012, "SiS SI7012" },
{ PCI_DEVICE_ID_NVIDIA_MCP_AUDIO, "NVidia NForce" },
- { 0x1022, "AMD-8111" },
+ { 0x764d, "AMD AMD8111" },
+ { 0x7445, "AMD AMD768" },
{ 0, 0 },
};
static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
intel8x0_t *chip;
int pcm_dev = 0, err;
@@ -1498,7 +1502,7 @@ static struct pci_driver driver = {
static int __devinit snd_intel8x0_joystick_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
if (dev >= SNDRV_CARDS)
return -ENODEV;
if (!snd_enable[dev]) {
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 655b36921451..7ba21b339789 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -2249,7 +2249,7 @@ static int __devinit
snd_korg1212_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
korg1212_t *korg1212;
snd_card_t *card;
int err;
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 310ec07efff0..de7e47180ef4 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -888,14 +888,22 @@ struct snd_m3 {
#endif
static struct pci_device_id snd_m3_ids[] __devinitdata = {
- {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
- {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
- {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_CANYON3D_2LE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
- {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_CANYON3D_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
- {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_MAESTRO3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
- {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_MAESTRO3_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
- {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_MAESTRO3_HW, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
- {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_MAESTRO3_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+ {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO_1, PCI_ANY_ID, PCI_ANY_ID,
+ PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0},
+ {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO, PCI_ANY_ID, PCI_ANY_ID,
+ PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0},
+ {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_CANYON3D_2LE, PCI_ANY_ID, PCI_ANY_ID,
+ PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0},
+ {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_CANYON3D_2, PCI_ANY_ID, PCI_ANY_ID,
+ PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0},
+ {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_MAESTRO3, PCI_ANY_ID, PCI_ANY_ID,
+ PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0},
+ {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_MAESTRO3_1, PCI_ANY_ID, PCI_ANY_ID,
+ PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0},
+ {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_MAESTRO3_HW, PCI_ANY_ID, PCI_ANY_ID,
+ PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0},
+ {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_MAESTRO3_2, PCI_ANY_ID, PCI_ANY_ID,
+ PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0},
{0,},
};
@@ -1481,8 +1489,8 @@ static void snd_m3_update_ptr(m3_t *chip, m3_dma_t *s)
diff = (s->dma_size + hwptr - s->hwptr) % s->dma_size;
s->hwptr = hwptr;
s->count += diff;
- while (s->count >= (signed)s->period_size) {
- s->count -= s->period_size;
+ if (s->count >= (signed)s->period_size) {
+ s->count %= s->period_size;
spin_unlock(&chip->reg_lock);
snd_pcm_period_elapsed(subs);
spin_lock(&chip->reg_lock);
@@ -2595,14 +2603,14 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci,
static int __devinit
snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
m3_t *chip;
int err;
/* don't pick up modems */
if (((pci->class >> 8) & 0xffff) != PCI_CLASS_MULTIMEDIA_AUDIO)
- return 0;
+ return -ENODEV;
if (dev >= SNDRV_CARDS)
return -ENODEV;
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 8912c62b6fe0..8d603123ec95 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -1554,7 +1554,7 @@ __error:
static int __devinit snd_nm256_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
nm256_t *chip;
int err;
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 18891a006530..ea37f1eb9713 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -2410,7 +2410,7 @@ static int __devinit
snd_rme96_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
rme96_t *rme96;
snd_card_t *card;
int err;
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index c4c716252834..0712b26692f4 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -2663,7 +2663,7 @@ static void snd_rme9652_card_free(snd_card_t *card)
static int __devinit snd_rme9652_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
rme9652_t *rme9652;
snd_card_t *card;
int err;
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index d204ae0b7953..006b1ecce989 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -1453,7 +1453,7 @@ static int __devinit snd_sonicvibes_midi(sonicvibes_t * sonic, snd_rawmidi_t * r
static int __devinit snd_sonic_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
sonicvibes_t *sonic;
snd_rawmidi_t *midi_uart;
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c
index 127b0513a93e..8309cbc74166 100644
--- a/sound/pci/trident/trident.c
+++ b/sound/pci/trident/trident.c
@@ -80,7 +80,7 @@ MODULE_DEVICE_TABLE(pci, snd_trident_ids);
static int __devinit snd_trident_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
trident_t *trident;
const char *str;
@@ -138,6 +138,8 @@ static int __devinit snd_trident_probe(struct pci_dev *pci,
}
#endif
+ snd_trident_gameport(trident);
+
switch (trident->device) {
case TRIDENT_DEVICE_ID_DX:
str = "TRID4DWAVEDX";
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index afeeeb1f1526..a5248050c6f8 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -37,6 +37,9 @@
#include <sound/control.h>
#include <sound/trident.h>
#include <sound/asoundef.h>
+#ifndef LINUX_2_2
+#include <linux/gameport.h>
+#endif
#define chip_t trident_t
@@ -2946,6 +2949,100 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device
return 0;
}
+/*
+ * gameport interface
+ */
+#ifndef LINUX_2_2
+
+typedef struct snd_trident_gameport {
+ struct gameport info;
+ trident_t *chip;
+} trident_gameport_t;
+
+static unsigned char snd_trident_gameport_read(struct gameport *gameport)
+{
+ trident_gameport_t *gp = (trident_gameport_t *)gameport;
+ trident_t *chip;
+ snd_assert(gp, return 0);
+ chip = snd_magic_cast(trident_t, gp->chip, return 0);
+ return inb(TRID_REG(chip, GAMEPORT_LEGACY));
+}
+
+static void snd_trident_gameport_trigger(struct gameport *gameport)
+{
+ trident_gameport_t *gp = (trident_gameport_t *)gameport;
+ trident_t *chip;
+ snd_assert(gp, return);
+ chip = snd_magic_cast(trident_t, gp->chip, return);
+ outb(0xff, TRID_REG(chip, GAMEPORT_LEGACY));
+}
+
+static int snd_trident_gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons)
+{
+ trident_gameport_t *gp = (trident_gameport_t *)gameport;
+ trident_t *chip;
+ int i;
+
+ snd_assert(gp, return 0);
+ chip = snd_magic_cast(trident_t, gp->chip, return 0);
+
+ *buttons = (~inb(TRID_REG(chip, GAMEPORT_LEGACY)) >> 4) & 0xf;
+
+ for (i = 0; i < 4; i++) {
+ axes[i] = inw(TRID_REG(chip, GAMEPORT_AXES + i * 2));
+ if (axes[i] == 0xffff) axes[i] = -1;
+ }
+
+ return 0;
+}
+
+static int snd_trident_gameport_open(struct gameport *gameport, int mode)
+{
+ trident_gameport_t *gp = (trident_gameport_t *)gameport;
+ trident_t *chip;
+ snd_assert(gp, return -1);
+ chip = snd_magic_cast(trident_t, gp->chip, return -1);
+
+ switch (mode) {
+ case GAMEPORT_MODE_COOKED:
+ outb(GAMEPORT_MODE_ADC, TRID_REG(chip, GAMEPORT_GCR));
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ schedule_timeout(1 + 20 * HZ / 1000); /* 20msec */
+ return 0;
+ case GAMEPORT_MODE_RAW:
+ outb(0, TRID_REG(chip, GAMEPORT_GCR));
+ return 0;
+ default:
+ return -1;
+ }
+}
+
+void __devinit snd_trident_gameport(trident_t *chip)
+{
+ trident_gameport_t *gp;
+ gp = kmalloc(sizeof(*gp), GFP_KERNEL);
+ if (! gp) {
+ snd_printk("cannot allocate gameport area\n");
+ return;
+ }
+ memset(gp, 0, sizeof(*gp));
+ gp->chip = chip;
+ gp->info.fuzz = 64;
+ gp->info.read = snd_trident_gameport_read;
+ gp->info.trigger = snd_trident_gameport_trigger;
+ gp->info.cooked_read = snd_trident_gameport_cooked_read;
+ gp->info.open = snd_trident_gameport_open;
+ chip->gameport = gp;
+
+ gameport_register_port(&gp->info);
+}
+
+#else
+void __devinit snd_trident_gameport(trident_t *chip)
+{
+}
+#endif
+
/*
* /proc interface
*/
@@ -3319,6 +3416,12 @@ int __devinit snd_trident_create(snd_card_t * card,
int snd_trident_free(trident_t *trident)
{
+#ifndef LINUX_2_2
+ if (trident->gameport) {
+ gameport_unregister_port(&trident->gameport->info);
+ kfree(trident->gameport);
+ }
+#endif
snd_trident_disable_eso(trident);
// Disable S/PDIF out
if (trident->device == TRIDENT_DEVICE_ID_NX)
diff --git a/sound/pci/via686.c b/sound/pci/via686.c
index a0fe9c1617d2..cd77658c2484 100644
--- a/sound/pci/via686.c
+++ b/sound/pci/via686.c
@@ -188,7 +188,6 @@ struct _snd_via686a {
unsigned int ac97_secondary; /* secondary AC'97 codec is present */
spinlock_t reg_lock;
- spinlock_t ac97_lock;
snd_info_entry_t *proc_entry;
void *tables;
@@ -267,10 +266,10 @@ static void snd_via686a_codec_write(ac97_t *ac97,
xval <<= VIA_REG_AC97_CODEC_ID_SHIFT;
xval |= reg << VIA_REG_AC97_CMD_SHIFT;
xval |= val << VIA_REG_AC97_DATA_SHIFT;
- spin_lock(&chip->ac97_lock);
+ spin_lock(&chip->reg_lock);
snd_via686a_codec_xwrite(chip, xval);
snd_via686a_codec_ready(chip, ac97->num);
- spin_unlock(&chip->ac97_lock);
+ spin_unlock(&chip->reg_lock);
}
static unsigned short snd_via686a_codec_read(ac97_t *ac97, unsigned short reg)
@@ -284,10 +283,10 @@ static unsigned short snd_via686a_codec_read(ac97_t *ac97, unsigned short reg)
xval = (!ac97->num ? VIA_REG_AC97_PRIMARY_VALID : VIA_REG_AC97_SECONDARY_VALID);
xval |= VIA_REG_AC97_READ;
xval |= reg << VIA_REG_AC97_CMD_SHIFT;
- spin_lock(&chip->ac97_lock);
+ spin_lock(&chip->reg_lock);
while (1) {
if (again++ > 3) {
- spin_unlock(&chip->ac97_lock);
+ spin_unlock(&chip->reg_lock);
return 0xffff;
}
snd_via686a_codec_xwrite(chip, xval);
@@ -299,7 +298,7 @@ static unsigned short snd_via686a_codec_read(ac97_t *ac97, unsigned short reg)
break;
}
}
- spin_unlock(&chip->ac97_lock);
+ spin_unlock(&chip->reg_lock);
return val & 0xffff;
}
@@ -481,7 +480,6 @@ static int snd_via686a_capture_prepare(snd_pcm_substream_t * substream)
static inline unsigned int snd_via686a_cur_ptr(via686a_t *chip, viadev_t *viadev)
{
unsigned int val, ptr, count;
- // unsigned int tmp;
ptr = inl(VIAREG(chip, OFFSET_CURR_PTR) + viadev->reg_offset);
count = inl(VIAREG(chip, OFFSET_CURR_COUNT) + viadev->reg_offset);
@@ -489,13 +487,12 @@ static inline unsigned int snd_via686a_cur_ptr(via686a_t *chip, viadev_t *viadev
ptr += 8;
if (!(inb(VIAREG(chip, OFFSET_STATUS) + viadev->reg_offset) & VIA_REG_STAT_ACTIVE))
return 0;
- // tmp =
val = (((unsigned int)(ptr - viadev->table_addr) / 8) - 1) % viadev->frags;
val *= viadev->fragsize;
val += viadev->fragsize - count;
viadev->lastptr = ptr;
viadev->lastcount = count;
- // printk("pointer: ptr = 0x%x (%i), count = 0x%x, val = 0x%x\n", ptr, tmp, count, val);
+ // printk("pointer: ptr = 0x%x (%i), count = 0x%x, val = 0x%x\n", ptr, count, val);
return val;
}
@@ -1041,7 +1038,6 @@ static int __devinit snd_via686a_create(snd_card_t * card,
chip->old_legacy_cfg = old_legacy_cfg;
spin_lock_init(&chip->reg_lock);
- spin_lock_init(&chip->ac97_lock);
chip->card = card;
chip->pci = pci;
chip->irq = -1;
@@ -1100,7 +1096,7 @@ static int __devinit snd_via686a_create(snd_card_t * card,
static int __devinit snd_via686a_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
via686a_t *chip;
int pcm_dev = 0;
diff --git a/sound/pci/via8233.c b/sound/pci/via8233.c
index 61409bfb8b74..461d3a761fdc 100644
--- a/sound/pci/via8233.c
+++ b/sound/pci/via8233.c
@@ -1,8 +1,8 @@
/*
* ALSA driver for VIA VT8233 (South Bridge)
*
- * Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz>,
- * Tjeerd.Mulder@fujitsu-siemens.com
+ * Copyright (c) 2000 Tjeerd.Mulder@fujitsu-siemens.com
+ * This driver is based on VIA686 code by Jaroslav Kysela <perex@suse.cz>
*
* 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
@@ -175,7 +175,6 @@ struct _snd_via8233 {
unsigned int ac97_clock;
spinlock_t reg_lock;
- spinlock_t update_lock;
snd_info_entry_t *proc_entry;
void *tables;
@@ -417,8 +416,6 @@ static int snd_via8233_playback_prepare(snd_pcm_substream_t * substream)
snd_pcm_runtime_t *runtime = substream->runtime;
unsigned long tmp;
- if (inb(VIAREG(chip, PLAYBACK_STATUS)) & VIA_REG_STAT_ACTIVE)
- return 0;
snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE, runtime->rate);
snd_via8233_setup_periods(chip, &chip->playback, substream);
/* I don't understand this stuff but its from the documentation and this way it works */
@@ -746,7 +743,6 @@ static int __devinit snd_via8233_create(snd_card_t * card,
return -ENOMEM;
spin_lock_init(&chip->reg_lock);
- spin_lock_init(&chip->update_lock);
chip->card = card;
chip->pci = pci;
chip->irq = -1;
@@ -808,7 +804,7 @@ static int __devinit snd_via8233_create(snd_card_t * card,
static int __devinit snd_via8233_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
via8233_t *chip;
int pcm_dev = 0;
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 9d9df8f76c5a..c60028dd5b84 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -79,7 +79,7 @@ MODULE_DEVICE_TABLE(pci, snd_ymfpci_ids);
static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
- static int dev = 0;
+ static int dev;
snd_card_t *card;
ymfpci_t *chip;
opl3_t *opl3;
@@ -127,7 +127,7 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
if (snd_mpu_port[dev] >= 0) {
legacy_ctrl |= 8;
pci_write_config_word(pci, PCIR_DSXG_MPU401BASE, snd_mpu_port[dev]);
- snd_printd("MPU401 supported on 0x%lx\n", snd_mpu_port[dev]);
+ //snd_printd("MPU401 supported on 0x%lx\n", snd_mpu_port[dev]);
}
} else {
switch (snd_fm_port[dev]) {
@@ -151,7 +151,7 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
default: snd_mpu_port[dev] = -1; break;
}
if (snd_mpu_port[dev] > 0 && check_region(snd_mpu_port[dev], 2) == 0) {
- snd_printd("MPU401 supported on 0x%lx\n", snd_mpu_port[dev]);
+ //snd_printd("MPU401 supported on 0x%lx\n", snd_mpu_port[dev]);
legacy_ctrl |= 8;
} else {
legacy_ctrl2 &= ~(3 << 4);
@@ -159,7 +159,8 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
}
}
if (snd_mpu_port[dev] > 0) {
- legacy_ctrl |= 0x10; /* MPU401 irq enable */
+ // this bit is for legacy mpu irqs
+ // legacy_ctrl |= 0x10; /* MPU401 irq enable */
legacy_ctrl2 |= 1 << 15; /* IMOD */
}
pci_read_config_word(pci, PCIR_DSXG_LEGACY, &old_legacy_ctrl);
@@ -198,9 +199,10 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
snd_mpu_port[dev], 0,
pci->irq, 0, &chip->rawmidi)) < 0) {
printk(KERN_WARNING "ymfpci: cannot initialize MPU401 at 0x%lx, skipping...\n", snd_mpu_port[dev]);
- } else {
- legacy_ctrl &= ~0x10; /* disable MPU401 irq */
- pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
+ snd_mpu_port[dev] = 0;
+ // only for legacy mpu irqs
+ // legacy_ctrl &= ~0x10; /* disable MPU401 irq */
+ // pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
}
}
if (snd_fm_port[dev] > 0) {
@@ -209,6 +211,9 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
snd_fm_port[dev] + 2,
OPL3_HW_OPL3, 0, &opl3)) < 0) {
printk(KERN_WARNING "ymfpci: cannot initialize FM OPL3 at 0x%lx, skipping...\n", snd_fm_port[dev]);
+ snd_fm_port[dev] = 0;
+ legacy_ctrl &= ~2;
+ pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
} else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
snd_card_free(card);
snd_printk("cannot create opl3 hwdep\n");
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 4c6dd27f3306..ababc0a695fd 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -313,12 +313,12 @@ static void snd_ymfpci_pcm_interrupt(ymfpci_t *chip, ymfpci_voice_t *voice)
delta = pos - ypcm->last_pos;
ypcm->period_pos += delta;
ypcm->last_pos = pos;
- while (ypcm->period_pos >= ypcm->period_size) {
+ if (ypcm->period_pos >= ypcm->period_size) {
// printk("done - active_bank = 0x%x, start = 0x%x\n", chip->active_bank, voice->bank[chip->active_bank].start);
+ ypcm->period_pos %= ypcm->period_size;
spin_unlock(&chip->reg_lock);
snd_pcm_period_elapsed(ypcm->substream);
spin_lock(&chip->reg_lock);
- ypcm->period_pos -= ypcm->period_size;
}
}
spin_unlock(&chip->reg_lock);
@@ -340,8 +340,8 @@ static void snd_ymfpci_pcm_capture_interrupt(snd_pcm_substream_t *substream)
delta = pos - ypcm->last_pos;
ypcm->period_pos += delta;
ypcm->last_pos = pos;
- while (ypcm->period_pos >= ypcm->period_size) {
- ypcm->period_pos = 0;
+ if (ypcm->period_pos >= ypcm->period_size) {
+ ypcm->period_pos %= ypcm->period_size;
// printk("done - active_bank = 0x%x, start = 0x%x\n", chip->active_bank, voice->bank[chip->active_bank].start);
spin_unlock(&chip->reg_lock);
snd_pcm_period_elapsed(substream);
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 36ca68f07ff4..a82dcf5337ad 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -1302,12 +1302,12 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return)
* Save state when going to sleep, restore it afterwards.
*/
-static void snd_pmac_suspend(pmac_t *chip, int can_schedule)
+static void snd_pmac_suspend(pmac_t *chip)
{
unsigned long flags;
snd_card_t *card = chip->card;
- snd_power_lock(card, can_schedule);
+ snd_power_lock(card);
if (card->power_state == SNDRV_CTL_POWER_D3hot)
goto __skip;
@@ -1327,11 +1327,11 @@ static void snd_pmac_suspend(pmac_t *chip, int can_schedule)
snd_power_unlock(card);
}
-static void snd_pmac_resume(pmac_t *chip, int can_schedule)
+static void snd_pmac_resume(pmac_t *chip)
{
snd_card_t *card = chip->card;
- snd_power_lock(card, can_schedule);
+ snd_power_lock(card);
if (card->power_state == SNDRV_CTL_POWER_D0)
goto __skip;
@@ -1370,10 +1370,10 @@ static int snd_pmac_sleep_notify(struct pmu_sleep_notifier *self, int when)
switch (when) {
case PBOOK_SLEEP_NOW:
- snd_pmac_suspend(chip, 0);
+ snd_pmac_suspend(chip);
break;
case PBOOK_WAKE:
- snd_pmac_resume(chip, 0);
+ snd_pmac_resume(chip);
break;
}
return PBOOK_SLEEP_OK;
@@ -1416,11 +1416,11 @@ static int snd_pmac_set_power_state(snd_card_t *card, unsigned int power_state)
case SNDRV_CTL_POWER_D0:
case SNDRV_CTL_POWER_D1:
case SNDRV_CTL_POWER_D2:
- snd_pmac_resume(chip, 1);
+ snd_pmac_resume(chip);
break;
case SNDRV_CTL_POWER_D3hot:
case SNDRV_CTL_POWER_D3cold:
- snd_pmac_suspend(chip, 1);
+ snd_pmac_suspend(chip);
break;
default:
return -EINVAL;