aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/atomic.h1
-rw-r--r--include/asm-alpha/bitops.h1
-rw-r--r--include/asm-alpha/dma-mapping.h2
-rw-r--r--include/asm-alpha/hardirq.h2
-rw-r--r--include/asm-alpha/mman.h1
-rw-r--r--include/asm-arm/arch-pxa/irq.h5
-rw-r--r--include/asm-arm/arch-pxa/ohci.h18
-rw-r--r--include/asm-arm/atomic.h1
-rw-r--r--include/asm-arm/bitops.h2
-rw-r--r--include/asm-arm/elf.h2
-rw-r--r--include/asm-arm/io.h6
-rw-r--r--include/asm-arm/memory.h1
-rw-r--r--include/asm-arm/mman.h1
-rw-r--r--include/asm-arm26/atomic.h1
-rw-r--r--include/asm-arm26/bitops.h1
-rw-r--r--include/asm-arm26/mman.h1
-rw-r--r--include/asm-cris/atomic.h1
-rw-r--r--include/asm-cris/bitops.h1
-rw-r--r--include/asm-cris/mman.h1
-rw-r--r--include/asm-frv/atomic.h1
-rw-r--r--include/asm-frv/bitops.h1
-rw-r--r--include/asm-frv/futex.h42
-rw-r--r--include/asm-frv/mman.h1
-rw-r--r--include/asm-frv/signal.h1
-rw-r--r--include/asm-generic/atomic.h116
-rw-r--r--include/asm-generic/bitops.h1
-rw-r--r--include/asm-generic/vmlinux.lds.h4
-rw-r--r--include/asm-h8300/atomic.h1
-rw-r--r--include/asm-h8300/bitops.h1
-rw-r--r--include/asm-h8300/irq.h5
-rw-r--r--include/asm-h8300/mman.h1
-rw-r--r--include/asm-i386/atomic.h1
-rw-r--r--include/asm-i386/bitops.h27
-rw-r--r--include/asm-i386/bugs.h23
-rw-r--r--include/asm-i386/cacheflush.h4
-rw-r--r--include/asm-i386/desc.h8
-rw-r--r--include/asm-i386/mach-bigsmp/mach_apic.h79
-rw-r--r--include/asm-i386/mach-bigsmp/mach_apicdef.h4
-rw-r--r--include/asm-i386/mman.h1
-rw-r--r--include/asm-i386/mmzone.h5
-rw-r--r--include/asm-i386/module.h4
-rw-r--r--include/asm-i386/mpspec_def.h2
-rw-r--r--include/asm-i386/param.h3
-rw-r--r--include/asm-i386/segment.h14
-rw-r--r--include/asm-i386/system.h31
-rw-r--r--include/asm-i386/unistd.h2
-rw-r--r--include/asm-ia64/atomic.h1
-rw-r--r--include/asm-ia64/bitops.h1
-rw-r--r--include/asm-ia64/delay.h10
-rw-r--r--include/asm-ia64/ia32.h2
-rw-r--r--include/asm-ia64/local.h4
-rw-r--r--include/asm-ia64/mman.h1
-rw-r--r--include/asm-ia64/sal.h3
-rw-r--r--include/asm-ia64/sn/pcidev.h20
-rw-r--r--include/asm-ia64/spinlock.h12
-rw-r--r--include/asm-ia64/topology.h2
-rw-r--r--include/asm-ia64/unistd.h2
-rw-r--r--include/asm-m32r/assembler.h10
-rw-r--r--include/asm-m32r/atomic.h1
-rw-r--r--include/asm-m32r/bitops.h1
-rw-r--r--include/asm-m32r/cacheflush.h2
-rw-r--r--include/asm-m32r/irq.h16
-rw-r--r--include/asm-m32r/m32102.h38
-rw-r--r--include/asm-m32r/m32104ut/m32104ut_pld.h163
-rw-r--r--include/asm-m32r/m32r.h8
-rw-r--r--include/asm-m32r/mman.h1
-rw-r--r--include/asm-m32r/system.h12
-rw-r--r--include/asm-m32r/unistd.h12
-rw-r--r--include/asm-m68k/atomic.h1
-rw-r--r--include/asm-m68k/bitops.h1
-rw-r--r--include/asm-m68k/irq.h2
-rw-r--r--include/asm-m68k/mman.h1
-rw-r--r--include/asm-m68knommu/atomic.h1
-rw-r--r--include/asm-m68knommu/bitops.h1
-rw-r--r--include/asm-m68knommu/irq.h6
-rw-r--r--include/asm-mips/.gitignore1
-rw-r--r--include/asm-mips/atomic.h1
-rw-r--r--include/asm-mips/bitops.h2
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_ide.h22
-rw-r--r--include/asm-mips/mman.h1
-rw-r--r--include/asm-mips/riscos-syscall.h979
-rw-r--r--include/asm-parisc/atomic.h1
-rw-r--r--include/asm-parisc/bitops.h1
-rw-r--r--include/asm-parisc/mman.h1
-rw-r--r--include/asm-powerpc/atomic.h1
-rw-r--r--include/asm-powerpc/bitops.h1
-rw-r--r--include/asm-powerpc/mman.h1
-rw-r--r--include/asm-powerpc/mmu.h3
-rw-r--r--include/asm-ppc/ibm_ocp.h1
-rw-r--r--include/asm-ppc/io.h2
-rw-r--r--include/asm-ppc/mpc52xx.h13
-rw-r--r--include/asm-ppc/ppc4xx_dma.h3
-rw-r--r--include/asm-s390/atomic.h174
-rw-r--r--include/asm-s390/bitops.h1
-rw-r--r--include/asm-s390/ccwdev.h3
-rw-r--r--include/asm-s390/mman.h1
-rw-r--r--include/asm-s390/qdio.h8
-rw-r--r--include/asm-s390/s390_rdev.h15
-rw-r--r--include/asm-s390/uaccess.h14
-rw-r--r--include/asm-s390/unistd.h2
-rw-r--r--include/asm-s390/vtoc.h24
-rw-r--r--include/asm-sh/atomic.h1
-rw-r--r--include/asm-sh/bitops.h1
-rw-r--r--include/asm-sh/mman.h1
-rw-r--r--include/asm-sh64/atomic.h1
-rw-r--r--include/asm-sh64/bitops.h1
-rw-r--r--include/asm-sparc/atomic.h1
-rw-r--r--include/asm-sparc/bitops.h1
-rw-r--r--include/asm-sparc/memreg.h2
-rw-r--r--include/asm-sparc/mman.h1
-rw-r--r--include/asm-sparc/pcic.h6
-rw-r--r--include/asm-sparc64/atomic.h1
-rw-r--r--include/asm-sparc64/bitops.h1
-rw-r--r--include/asm-sparc64/mman.h1
-rw-r--r--include/asm-v850/atomic.h1
-rw-r--r--include/asm-v850/bitops.h1
-rw-r--r--include/asm-v850/mman.h1
-rw-r--r--include/asm-x86_64/atomic.h1
-rw-r--r--include/asm-x86_64/bitops.h27
-rw-r--r--include/asm-x86_64/cacheflush.h4
-rw-r--r--include/asm-x86_64/mman.h1
-rw-r--r--include/asm-x86_64/mpspec.h2
-rw-r--r--include/asm-x86_64/param.h3
-rw-r--r--include/asm-x86_64/pgtable.h2
-rw-r--r--include/asm-x86_64/rwlock.h2
-rw-r--r--include/asm-x86_64/system.h2
-rw-r--r--include/asm-x86_64/topology.h2
-rw-r--r--include/asm-xtensa/atomic.h1
-rw-r--r--include/asm-xtensa/bitops.h1
-rw-r--r--include/asm-xtensa/mman.h1
-rw-r--r--include/keys/user-type.h1
-rw-r--r--include/linux/ata.h8
-rw-r--r--include/linux/bio.h2
-rw-r--r--include/linux/bitops.h9
-rw-r--r--include/linux/blkdev.h96
-rw-r--r--include/linux/bootmem.h46
-rw-r--r--include/linux/cache.h2
-rw-r--r--include/linux/cn_proc.h2
-rw-r--r--include/linux/configfs.h205
-rw-r--r--include/linux/cpufreq.h10
-rw-r--r--include/linux/dccp.h7
-rw-r--r--include/linux/device.h14
-rw-r--r--include/linux/dm-ioctl.h11
-rw-r--r--include/linux/dvb/audio.h28
-rw-r--r--include/linux/dvb/ca.h36
-rw-r--r--include/linux/dvb/dmx.h20
-rw-r--r--include/linux/dvb/osd.h58
-rw-r--r--include/linux/dvb/video.h44
-rw-r--r--include/linux/elevator.h1
-rw-r--r--include/linux/etherdevice.h3
-rw-r--r--include/linux/fb.h30
-rw-r--r--include/linux/filter.h2
-rw-r--r--include/linux/firmware.h2
-rw-r--r--include/linux/fs.h34
-rw-r--r--include/linux/fuse.h24
-rw-r--r--include/linux/hugetlb.h4
-rw-r--r--include/linux/hwmon-vid.h6
-rw-r--r--include/linux/i2c-id.h22
-rw-r--r--include/linux/i2c.h41
-rw-r--r--include/linux/i2o.h976
-rw-r--r--include/linux/ide.h131
-rw-r--r--include/linux/if_pppox.h3
-rw-r--r--include/linux/inet.h2
-rw-r--r--include/linux/inotify.h2
-rw-r--r--include/linux/input.h79
-rw-r--r--include/linux/ip.h131
-rw-r--r--include/linux/ipv6.h79
-rw-r--r--include/linux/ipv6_route.h1
-rw-r--r--include/linux/irq.h15
-rw-r--r--include/linux/jbd.h8
-rw-r--r--include/linux/key.h8
-rw-r--r--include/linux/kobject.h54
-rw-r--r--include/linux/kobject_uevent.h57
-rw-r--r--include/linux/kprobes.h8
-rw-r--r--include/linux/libata.h25
-rw-r--r--include/linux/list.h26
-rw-r--r--include/linux/lockd/lockd.h2
-rw-r--r--include/linux/mempolicy.h38
-rw-r--r--include/linux/mm.h57
-rw-r--r--include/linux/mmzone.h44
-rw-r--r--include/linux/moduleparam.h2
-rw-r--r--include/linux/mtd/onenand.h5
-rw-r--r--include/linux/n_r3964.h20
-rw-r--r--include/linux/nbd.h8
-rw-r--r--include/linux/net.h4
-rw-r--r--include/linux/netdevice.h11
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h5
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h6
-rw-r--r--include/linux/nfs_fs.h66
-rw-r--r--include/linux/nfs_idmap.h2
-rw-r--r--include/linux/nfs_page.h12
-rw-r--r--include/linux/nfs_xdr.h89
-rw-r--r--include/linux/nfsd/xdr.h3
-rw-r--r--include/linux/nfsd/xdr3.h1
-rw-r--r--include/linux/page-flags.h91
-rw-r--r--include/linux/parport.h1
-rw-r--r--include/linux/parport_pc.h6
-rw-r--r--include/linux/pci_ids.h17
-rw-r--r--include/linux/pfkeyv2.h13
-rw-r--r--include/linux/pkt_sched.h7
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pnp.h9
-rw-r--r--include/linux/preempt.h1
-rw-r--r--include/linux/raid/md.h4
-rw-r--r--include/linux/raid/md_k.h80
-rw-r--r--include/linux/raid/raid1.h14
-rw-r--r--include/linux/raid/raid10.h22
-rw-r--r--include/linux/raid/raid5.h7
-rw-r--r--include/linux/ramfs.h10
-rw-r--r--include/linux/random.h6
-rw-r--r--include/linux/rcupdate.h2
-rw-r--r--include/linux/relayfs_fs.h5
-rw-r--r--include/linux/rmap.h1
-rw-r--r--include/linux/rtnetlink.h4
-rw-r--r--include/linux/sched.h25
-rw-r--r--include/linux/security.h132
-rw-r--r--include/linux/skbuff.h5
-rw-r--r--include/linux/socket.h1
-rw-r--r--include/linux/spinlock.h3
-rw-r--r--include/linux/sunrpc/clnt.h5
-rw-r--r--include/linux/sunrpc/gss_spkm3.h2
-rw-r--r--include/linux/sunrpc/sched.h48
-rw-r--r--include/linux/sunrpc/xdr.h6
-rw-r--r--include/linux/sunrpc/xprt.h12
-rw-r--r--include/linux/suspend.h8
-rw-r--r--include/linux/swap.h2
-rw-r--r--include/linux/sysctl.h6
-rw-r--r--include/linux/tcp.h21
-rw-r--r--include/linux/time.h1
-rw-r--r--include/linux/udf_fs.h5
-rw-r--r--include/linux/udf_fs_i.h5
-rw-r--r--include/linux/udf_fs_sb.h5
-rw-r--r--include/linux/udp.h6
-rw-r--r--include/linux/usb.h35
-rw-r--r--include/linux/usb_usual.h126
-rw-r--r--include/linux/writeback.h15
-rw-r--r--include/linux/xfrm.h29
-rw-r--r--include/media/saa7146.h12
-rw-r--r--include/media/saa7146_vv.h10
-rw-r--r--include/media/tuner.h7
-rw-r--r--include/net/af_unix.h12
-rw-r--r--include/net/atmclip.h2
-rw-r--r--include/net/dn.h4
-rw-r--r--include/net/dst.h1
-rw-r--r--include/net/flow.h7
-rw-r--r--include/net/genetlink.h2
-rw-r--r--include/net/icmp.h9
-rw-r--r--include/net/ieee80211_crypt.h9
-rw-r--r--include/net/if_inet6.h2
-rw-r--r--include/net/inet6_connection_sock.h42
-rw-r--r--include/net/inet6_hashtables.h32
-rw-r--r--include/net/inet_common.h4
-rw-r--r--include/net/inet_connection_sock.h45
-rw-r--r--include/net/inet_ecn.h2
-rw-r--r--include/net/inet_hashtables.h24
-rw-r--r--include/net/inet_sock.h193
-rw-r--r--include/net/inet_timewait_sock.h8
-rw-r--r--include/net/inetpeer.h1
-rw-r--r--include/net/ip.h20
-rw-r--r--include/net/ip_fib.h2
-rw-r--r--include/net/ip_vs.h12
-rw-r--r--include/net/ipv6.h12
-rw-r--r--include/net/ndisc.h17
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/netfilter/nf_conntrack.h31
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h2
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h15
-rw-r--r--include/net/netfilter/nf_conntrack_protocol.h26
-rw-r--r--include/net/pkt_act.h1
-rw-r--r--include/net/protocol.h3
-rw-r--r--include/net/raw.h2
-rw-r--r--include/net/request_sock.h2
-rw-r--r--include/net/sctp/structs.h76
-rw-r--r--include/net/sctp/user.h30
-rw-r--r--include/net/sock.h36
-rw-r--r--include/net/tcp.h246
-rw-r--r--include/net/tcp_states.h16
-rw-r--r--include/net/timewait_sock.h31
-rw-r--r--include/net/transp_v6.h2
-rw-r--r--include/net/udp.h4
-rw-r--r--include/net/xfrm.h31
-rw-r--r--include/pcmcia/cs.h2
-rw-r--r--include/pcmcia/ds.h13
-rw-r--r--include/pcmcia/ss.h4
-rw-r--r--include/scsi/scsi_cmnd.h1
-rw-r--r--include/scsi/scsi_dbg.h1
-rw-r--r--include/scsi/scsi_device.h12
-rw-r--r--include/scsi/scsi_driver.h1
-rw-r--r--include/scsi/scsi_host.h7
-rw-r--r--include/scsi/scsi_transport_fc.h11
-rw-r--r--include/scsi/scsi_transport_spi.h4
-rw-r--r--include/sound/ac97_codec.h169
-rw-r--r--include/sound/ad1816a.h22
-rw-r--r--include/sound/ad1848.h33
-rw-r--r--include/sound/ainstr_fm.h28
-rw-r--r--include/sound/ainstr_gf1.h46
-rw-r--r--include/sound/ainstr_iw.h115
-rw-r--r--include/sound/ainstr_simple.h35
-rw-r--r--include/sound/ak4114.h30
-rw-r--r--include/sound/ak4117.h24
-rw-r--r--include/sound/ak4531_codec.h17
-rw-r--r--include/sound/ak4xxx-adda.h22
-rw-r--r--include/sound/asequencer.h378
-rw-r--r--include/sound/asound.h566
-rw-r--r--include/sound/asound_fm.h24
-rw-r--r--include/sound/control.h94
-rw-r--r--include/sound/core.h223
-rw-r--r--include/sound/cs4231.h113
-rw-r--r--include/sound/cs46xx.h89
-rw-r--r--include/sound/cs46xx_dsp_scb_types.h145
-rw-r--r--include/sound/cs46xx_dsp_spos.h119
-rw-r--r--include/sound/cs46xx_dsp_task_types.h35
-rw-r--r--include/sound/cs8403.h8
-rw-r--r--include/sound/cs8427.h17
-rw-r--r--include/sound/driver.h7
-rw-r--r--include/sound/emu10k1.h371
-rw-r--r--include/sound/emu10k1_synth.h6
-rw-r--r--include/sound/emu8000.h39
-rw-r--r--include/sound/emux_synth.h105
-rw-r--r--include/sound/es1688.h22
-rw-r--r--include/sound/gus.h379
-rw-r--r--include/sound/hdsp.h51
-rw-r--r--include/sound/hdspm.h45
-rw-r--r--include/sound/hwdep.h43
-rw-r--r--include/sound/i2c.h78
-rw-r--r--include/sound/info.h107
-rw-r--r--include/sound/initval.h14
-rw-r--r--include/sound/minors.h29
-rw-r--r--include/sound/mixer_oss.h54
-rw-r--r--include/sound/mpu401.h26
-rw-r--r--include/sound/opl3.h57
-rw-r--r--include/sound/opl4.h6
-rw-r--r--include/sound/pcm-indirect.h28
-rw-r--r--include/sound/pcm.h476
-rw-r--r--include/sound/pcm_oss.h41
-rw-r--r--include/sound/pcm_params.h86
-rw-r--r--include/sound/rawmidi.h125
-rw-r--r--include/sound/sb.h74
-rw-r--r--include/sound/sb16_csp.h52
-rw-r--r--include/sound/seq_device.h18
-rw-r--r--include/sound/seq_instr.h64
-rw-r--r--include/sound/seq_kernel.h125
-rw-r--r--include/sound/seq_midi_emul.h44
-rw-r--r--include/sound/seq_midi_event.h22
-rw-r--r--include/sound/seq_oss.h30
-rw-r--r--include/sound/seq_virmidi.h22
-rw-r--r--include/sound/sfnt_info.h36
-rw-r--r--include/sound/snd_wavefront.h20
-rw-r--r--include/sound/soundfont.h75
-rw-r--r--include/sound/tea575x-tuner.h12
-rw-r--r--include/sound/tea6330t.h17
-rw-r--r--include/sound/timer.h94
-rw-r--r--include/sound/trident.h153
-rw-r--r--include/sound/typedefs.h173
-rw-r--r--include/sound/uda1341.h109
-rw-r--r--include/sound/util_mem.h32
-rw-r--r--include/sound/version.h4
-rw-r--r--include/sound/vx_core.h131
-rw-r--r--include/sound/ymfpci.h112
359 files changed, 6588 insertions, 6147 deletions
diff --git a/include/asm-alpha/atomic.h b/include/asm-alpha/atomic.h
index 6183eab006d4..cb03bbe92cdf 100644
--- a/include/asm-alpha/atomic.h
+++ b/include/asm-alpha/atomic.h
@@ -216,4 +216,5 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
216#define smp_mb__before_atomic_inc() smp_mb() 216#define smp_mb__before_atomic_inc() smp_mb()
217#define smp_mb__after_atomic_inc() smp_mb() 217#define smp_mb__after_atomic_inc() smp_mb()
218 218
219#include <asm-generic/atomic.h>
219#endif /* _ALPHA_ATOMIC_H */ 220#endif /* _ALPHA_ATOMIC_H */
diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h
index 578ed3f1a607..302201f1a097 100644
--- a/include/asm-alpha/bitops.h
+++ b/include/asm-alpha/bitops.h
@@ -321,6 +321,7 @@ static inline int fls(int word)
321#else 321#else
322#define fls generic_fls 322#define fls generic_fls
323#endif 323#endif
324#define fls64 generic_fls64
324 325
325/* Compute powers of two for the given integer. */ 326/* Compute powers of two for the given integer. */
326static inline long floor_log2(unsigned long word) 327static inline long floor_log2(unsigned long word)
diff --git a/include/asm-alpha/dma-mapping.h b/include/asm-alpha/dma-mapping.h
index 680f7ecbb28f..9dc7256cf979 100644
--- a/include/asm-alpha/dma-mapping.h
+++ b/include/asm-alpha/dma-mapping.h
@@ -16,7 +16,7 @@
16#define dma_free_coherent(dev, size, va, addr) \ 16#define dma_free_coherent(dev, size, va, addr) \
17 pci_free_consistent(alpha_gendev_to_pci(dev), size, va, addr) 17 pci_free_consistent(alpha_gendev_to_pci(dev), size, va, addr)
18#define dma_map_page(dev, page, off, size, dir) \ 18#define dma_map_page(dev, page, off, size, dir) \
19 pci_map_single(alpha_gendev_to_pci(dev), page, off, size, dir) 19 pci_map_page(alpha_gendev_to_pci(dev), page, off, size, dir)
20#define dma_unmap_page(dev, addr, size, dir) \ 20#define dma_unmap_page(dev, addr, size, dir) \
21 pci_unmap_page(alpha_gendev_to_pci(dev), addr, size, dir) 21 pci_unmap_page(alpha_gendev_to_pci(dev), addr, size, dir)
22#define dma_map_sg(dev, sg, nents, dir) \ 22#define dma_map_sg(dev, sg, nents, dir) \
diff --git a/include/asm-alpha/hardirq.h b/include/asm-alpha/hardirq.h
index c0593f9b21e1..7bb6a36c96a1 100644
--- a/include/asm-alpha/hardirq.h
+++ b/include/asm-alpha/hardirq.h
@@ -13,6 +13,8 @@ typedef struct {
13 13
14#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ 14#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
15 15
16void ack_bad_irq(unsigned int irq);
17
16#define HARDIRQ_BITS 12 18#define HARDIRQ_BITS 12
17 19
18/* 20/*
diff --git a/include/asm-alpha/mman.h b/include/asm-alpha/mman.h
index eb9c279045ef..f6439532a262 100644
--- a/include/asm-alpha/mman.h
+++ b/include/asm-alpha/mman.h
@@ -42,6 +42,7 @@
42#define MADV_WILLNEED 3 /* will need these pages */ 42#define MADV_WILLNEED 3 /* will need these pages */
43#define MADV_SPACEAVAIL 5 /* ensure resources are available */ 43#define MADV_SPACEAVAIL 5 /* ensure resources are available */
44#define MADV_DONTNEED 6 /* don't need these pages */ 44#define MADV_DONTNEED 6 /* don't need these pages */
45#define MADV_REMOVE 7 /* remove these pages & resources */
45 46
46/* compatibility flags */ 47/* compatibility flags */
47#define MAP_ANON MAP_ANONYMOUS 48#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-arm/arch-pxa/irq.h b/include/asm-arm/arch-pxa/irq.h
index d770e4b37ae1..48c60f5eff6a 100644
--- a/include/asm-arm/arch-pxa/irq.h
+++ b/include/asm-arm/arch-pxa/irq.h
@@ -12,8 +12,3 @@
12 12
13#define fixup_irq(x) (x) 13#define fixup_irq(x) (x)
14 14
15/*
16 * This prototype is required for cascading of multiplexed interrupts.
17 * Since it doesn't exist elsewhere, we'll put it here for now.
18 */
19extern void do_IRQ(int irq, struct pt_regs *regs);
diff --git a/include/asm-arm/arch-pxa/ohci.h b/include/asm-arm/arch-pxa/ohci.h
new file mode 100644
index 000000000000..7da89569061e
--- /dev/null
+++ b/include/asm-arm/arch-pxa/ohci.h
@@ -0,0 +1,18 @@
1#ifndef ASMARM_ARCH_OHCI_H
2#define ASMARM_ARCH_OHCI_H
3
4struct device;
5
6struct pxaohci_platform_data {
7 int (*init)(struct device *);
8 void (*exit)(struct device *);
9
10 int port_mode;
11#define PMM_NPS_MODE 1
12#define PMM_GLOBAL_MODE 2
13#define PMM_PERPORT_MODE 3
14};
15
16extern void pxa_set_ohci_info(struct pxaohci_platform_data *info);
17
18#endif
diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h
index d586f65c8228..f72b63309bc5 100644
--- a/include/asm-arm/atomic.h
+++ b/include/asm-arm/atomic.h
@@ -205,5 +205,6 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
205#define smp_mb__before_atomic_inc() barrier() 205#define smp_mb__before_atomic_inc() barrier()
206#define smp_mb__after_atomic_inc() barrier() 206#define smp_mb__after_atomic_inc() barrier()
207 207
208#include <asm-generic/atomic.h>
208#endif 209#endif
209#endif 210#endif
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h
index 7399d431edfe..d02de721ecc1 100644
--- a/include/asm-arm/bitops.h
+++ b/include/asm-arm/bitops.h
@@ -332,6 +332,7 @@ static inline unsigned long __ffs(unsigned long word)
332 */ 332 */
333 333
334#define fls(x) generic_fls(x) 334#define fls(x) generic_fls(x)
335#define fls64(x) generic_fls64(x)
335 336
336/* 337/*
337 * ffs: find first bit set. This is defined the same way as 338 * ffs: find first bit set. This is defined the same way as
@@ -351,6 +352,7 @@ static inline unsigned long __ffs(unsigned long word)
351#define fls(x) \ 352#define fls(x) \
352 ( __builtin_constant_p(x) ? generic_fls(x) : \ 353 ( __builtin_constant_p(x) ? generic_fls(x) : \
353 ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) ) 354 ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) )
355#define fls64(x) generic_fls64(x)
354#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); }) 356#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
355#define __ffs(x) (ffs(x) - 1) 357#define __ffs(x) (ffs(x) - 1)
356#define ffz(x) __ffs( ~(x) ) 358#define ffz(x) __ffs( ~(x) )
diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h
index 7da97a937548..2d44b42d1847 100644
--- a/include/asm-arm/elf.h
+++ b/include/asm-arm/elf.h
@@ -22,6 +22,8 @@ typedef unsigned long elf_freg_t[3];
22#define R_ARM_NONE 0 22#define R_ARM_NONE 0
23#define R_ARM_PC24 1 23#define R_ARM_PC24 1
24#define R_ARM_ABS32 2 24#define R_ARM_ABS32 2
25#define R_ARM_CALL 28
26#define R_ARM_JUMP24 29
25 27
26#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) 28#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
27typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 29typedef elf_greg_t elf_gregset_t[ELF_NGREG];
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index ae69db4a1010..0cf4d4f99600 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -42,9 +42,9 @@ extern void __raw_writesb(void __iomem *addr, const void *data, int bytelen);
42extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen); 42extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen);
43extern void __raw_writesl(void __iomem *addr, const void *data, int longlen); 43extern void __raw_writesl(void __iomem *addr, const void *data, int longlen);
44 44
45extern void __raw_readsb(void __iomem *addr, void *data, int bytelen); 45extern void __raw_readsb(const void __iomem *addr, void *data, int bytelen);
46extern void __raw_readsw(void __iomem *addr, void *data, int wordlen); 46extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
47extern void __raw_readsl(void __iomem *addr, void *data, int longlen); 47extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
48 48
49#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a) = (v)) 49#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a) = (v))
50#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v)) 50#define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v))
diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h
index a547ee598c6c..3e572364ee73 100644
--- a/include/asm-arm/memory.h
+++ b/include/asm-arm/memory.h
@@ -122,6 +122,7 @@ static inline void *phys_to_virt(unsigned long x)
122 */ 122 */
123#define __pa(x) __virt_to_phys((unsigned long)(x)) 123#define __pa(x) __virt_to_phys((unsigned long)(x))
124#define __va(x) ((void *)__phys_to_virt((unsigned long)(x))) 124#define __va(x) ((void *)__phys_to_virt((unsigned long)(x)))
125#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
125 126
126/* 127/*
127 * Virtual <-> DMA view memory address translations 128 * Virtual <-> DMA view memory address translations
diff --git a/include/asm-arm/mman.h b/include/asm-arm/mman.h
index 8e4f69c4fa5f..f0bebca2ac21 100644
--- a/include/asm-arm/mman.h
+++ b/include/asm-arm/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-arm26/atomic.h b/include/asm-arm26/atomic.h
index a47cadc59686..3074b0e76343 100644
--- a/include/asm-arm26/atomic.h
+++ b/include/asm-arm26/atomic.h
@@ -118,5 +118,6 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
118#define smp_mb__before_atomic_inc() barrier() 118#define smp_mb__before_atomic_inc() barrier()
119#define smp_mb__after_atomic_inc() barrier() 119#define smp_mb__after_atomic_inc() barrier()
120 120
121#include <asm-generic/atomic.h>
121#endif 122#endif
122#endif 123#endif
diff --git a/include/asm-arm26/bitops.h b/include/asm-arm26/bitops.h
index 7d062fb2e343..15cc6f2da792 100644
--- a/include/asm-arm26/bitops.h
+++ b/include/asm-arm26/bitops.h
@@ -259,6 +259,7 @@ static inline unsigned long __ffs(unsigned long word)
259 */ 259 */
260 260
261#define fls(x) generic_fls(x) 261#define fls(x) generic_fls(x)
262#define fls64(x) generic_fls64(x)
262 263
263/* 264/*
264 * ffs: find first bit set. This is defined the same way as 265 * ffs: find first bit set. This is defined the same way as
diff --git a/include/asm-arm26/mman.h b/include/asm-arm26/mman.h
index cc27b8240265..0ed7780541fa 100644
--- a/include/asm-arm26/mman.h
+++ b/include/asm-arm26/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-cris/atomic.h b/include/asm-cris/atomic.h
index 683b05a57d88..2df2c7aa19b7 100644
--- a/include/asm-cris/atomic.h
+++ b/include/asm-cris/atomic.h
@@ -156,4 +156,5 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
156#define smp_mb__before_atomic_inc() barrier() 156#define smp_mb__before_atomic_inc() barrier()
157#define smp_mb__after_atomic_inc() barrier() 157#define smp_mb__after_atomic_inc() barrier()
158 158
159#include <asm-generic/atomic.h>
159#endif 160#endif
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h
index 1bddb3f3a289..d3eb0f1e4208 100644
--- a/include/asm-cris/bitops.h
+++ b/include/asm-cris/bitops.h
@@ -240,6 +240,7 @@ static inline int test_bit(int nr, const volatile unsigned long *addr)
240 */ 240 */
241 241
242#define fls(x) generic_fls(x) 242#define fls(x) generic_fls(x)
243#define fls64(x) generic_fls64(x)
243 244
244/* 245/*
245 * hweightN - returns the hamming weight of a N-bit word 246 * hweightN - returns the hamming weight of a N-bit word
diff --git a/include/asm-cris/mman.h b/include/asm-cris/mman.h
index 8570e72b9502..5a382b8bf3f7 100644
--- a/include/asm-cris/mman.h
+++ b/include/asm-cris/mman.h
@@ -37,6 +37,7 @@
37#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 37#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
38#define MADV_WILLNEED 0x3 /* pre-fault pages */ 38#define MADV_WILLNEED 0x3 /* pre-fault pages */
39#define MADV_DONTNEED 0x4 /* discard these pages */ 39#define MADV_DONTNEED 0x4 /* discard these pages */
40#define MADV_REMOVE 0x5 /* remove these pages & resources */
40 41
41/* compatibility flags */ 42/* compatibility flags */
42#define MAP_ANON MAP_ANONYMOUS 43#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-frv/atomic.h b/include/asm-frv/atomic.h
index f6539ff569c5..3f54fea2b051 100644
--- a/include/asm-frv/atomic.h
+++ b/include/asm-frv/atomic.h
@@ -426,4 +426,5 @@ extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new);
426}) 426})
427#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 427#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
428 428
429#include <asm-generic/atomic.h>
429#endif /* _ASM_ATOMIC_H */ 430#endif /* _ASM_ATOMIC_H */
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h
index b664bd5b6663..02be7b3a8a83 100644
--- a/include/asm-frv/bitops.h
+++ b/include/asm-frv/bitops.h
@@ -228,6 +228,7 @@ found_middle:
228 \ 228 \
229 bit ? 33 - bit : bit; \ 229 bit ? 33 - bit : bit; \
230}) 230})
231#define fls64(x) generic_fls64(x)
231 232
232/* 233/*
233 * Every architecture must define this function. It's the fastest 234 * Every architecture must define this function. It's the fastest
diff --git a/include/asm-frv/futex.h b/include/asm-frv/futex.h
index 9feff4ce1424..fca9d90e32c9 100644
--- a/include/asm-frv/futex.h
+++ b/include/asm-frv/futex.h
@@ -7,47 +7,7 @@
7#include <asm/errno.h> 7#include <asm/errno.h>
8#include <asm/uaccess.h> 8#include <asm/uaccess.h>
9 9
10static inline int 10extern int futex_atomic_op_inuser(int encoded_op, int __user *uaddr);
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51 11
52#endif 12#endif
53#endif 13#endif
diff --git a/include/asm-frv/mman.h b/include/asm-frv/mman.h
index c684720dfbdd..8af4a41c255e 100644
--- a/include/asm-frv/mman.h
+++ b/include/asm-frv/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-frv/signal.h b/include/asm-frv/signal.h
index d407bde57eca..67366894780f 100644
--- a/include/asm-frv/signal.h
+++ b/include/asm-frv/signal.h
@@ -151,7 +151,6 @@ typedef struct sigaltstack {
151 size_t ss_size; 151 size_t ss_size;
152} stack_t; 152} stack_t;
153 153
154extern int do_signal(struct pt_regs *regs, sigset_t *oldset);
155#define ptrace_signal_deliver(regs, cookie) do { } while (0) 154#define ptrace_signal_deliver(regs, cookie) do { } while (0)
156 155
157#ifdef __KERNEL__ 156#ifdef __KERNEL__
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
new file mode 100644
index 000000000000..e0a28b925ef0
--- /dev/null
+++ b/include/asm-generic/atomic.h
@@ -0,0 +1,116 @@
1#ifndef _ASM_GENERIC_ATOMIC_H
2#define _ASM_GENERIC_ATOMIC_H
3/*
4 * Copyright (C) 2005 Silicon Graphics, Inc.
5 * Christoph Lameter <clameter@sgi.com>
6 *
7 * Allows to provide arch independent atomic definitions without the need to
8 * edit all arch specific atomic.h files.
9 */
10
11
12/*
13 * Suppport for atomic_long_t
14 *
15 * Casts for parameters are avoided for existing atomic functions in order to
16 * avoid issues with cast-as-lval under gcc 4.x and other limitations that the
17 * macros of a platform may have.
18 */
19
20#if BITS_PER_LONG == 64
21
22typedef atomic64_t atomic_long_t;
23
24#define ATOMIC_LONG_INIT(i) ATOMIC64_INIT(i)
25
26static inline long atomic_long_read(atomic_long_t *l)
27{
28 atomic64_t *v = (atomic64_t *)l;
29
30 return (long)atomic64_read(v);
31}
32
33static inline void atomic_long_set(atomic_long_t *l, long i)
34{
35 atomic64_t *v = (atomic64_t *)l;
36
37 atomic_set(v, i);
38}
39
40static inline void atomic_long_inc(atomic_long_t *l)
41{
42 atomic64_t *v = (atomic64_t *)l;
43
44 atomic64_inc(v);
45}
46
47static inline void atomic_long_dec(atomic_long_t *l)
48{
49 atomic64_t *v = (atomic64_t *)l;
50
51 atomic64_dec(v);
52}
53
54static inline void atomic_long_add(long i, atomic_long_t *l)
55{
56 atomic64_t *v = (atomic64_t *)l;
57
58 atomic64_add(i, v);
59}
60
61static inline void atomic_long_sub(long i, atomic_long_t *l)
62{
63 atomic64_t *v = (atomic64_t *)l;
64
65 atomic64_sub(i, v);
66}
67
68#else
69
70typedef atomic_t atomic_long_t;
71
72#define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i)
73static inline long atomic_long_read(atomic_long_t *l)
74{
75 atomic_t *v = (atomic_t *)l;
76
77 return (long)atomic_read(v);
78}
79
80static inline void atomic_long_set(atomic_long_t *l, long i)
81{
82 atomic_t *v = (atomic_t *)l;
83
84 atomic_set(v, i);
85}
86
87static inline void atomic_long_inc(atomic_long_t *l)
88{
89 atomic_t *v = (atomic_t *)l;
90
91 atomic_inc(v);
92}
93
94static inline void atomic_long_dec(atomic_long_t *l)
95{
96 atomic_t *v = (atomic_t *)l;
97
98 atomic_dec(v);
99}
100
101static inline void atomic_long_add(long i, atomic_long_t *l)
102{
103 atomic_t *v = (atomic_t *)l;
104
105 atomic_add(i, v);
106}
107
108static inline void atomic_long_sub(long i, atomic_long_t *l)
109{
110 atomic_t *v = (atomic_t *)l;
111
112 atomic_sub(i, v);
113}
114
115#endif
116#endif
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h
index ce31b739fd80..0e6d9852008c 100644
--- a/include/asm-generic/bitops.h
+++ b/include/asm-generic/bitops.h
@@ -56,6 +56,7 @@ extern __inline__ int test_bit(int nr, const unsigned long * addr)
56 */ 56 */
57 57
58#define fls(x) generic_fls(x) 58#define fls(x) generic_fls(x)
59#define fls64(x) generic_fls64(x)
59 60
60#ifdef __KERNEL__ 61#ifdef __KERNEL__
61 62
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 094d4917c1a9..35de20cf8fac 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -10,6 +10,8 @@
10#define ALIGN_FUNCTION() . = ALIGN(8) 10#define ALIGN_FUNCTION() . = ALIGN(8)
11 11
12#define RODATA \ 12#define RODATA \
13 . = ALIGN(4096); \
14 __start_rodata = .; \
13 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ 15 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
14 *(.rodata) *(.rodata.*) \ 16 *(.rodata) *(.rodata.*) \
15 *(__vermagic) /* Kernel version magic */ \ 17 *(__vermagic) /* Kernel version magic */ \
@@ -74,6 +76,8 @@
74 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ 76 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
75 *(__ksymtab_strings) \ 77 *(__ksymtab_strings) \
76 } \ 78 } \
79 __end_rodata = .; \
80 . = ALIGN(4096); \
77 \ 81 \
78 /* Built-in module parameters. */ \ 82 /* Built-in module parameters. */ \
79 __param : AT(ADDR(__param) - LOAD_OFFSET) { \ 83 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
diff --git a/include/asm-h8300/atomic.h b/include/asm-h8300/atomic.h
index f23d86819ea8..d891541e89c3 100644
--- a/include/asm-h8300/atomic.h
+++ b/include/asm-h8300/atomic.h
@@ -137,4 +137,5 @@ static __inline__ void atomic_set_mask(unsigned long mask, unsigned long *v)
137#define smp_mb__before_atomic_inc() barrier() 137#define smp_mb__before_atomic_inc() barrier()
138#define smp_mb__after_atomic_inc() barrier() 138#define smp_mb__after_atomic_inc() barrier()
139 139
140#include <asm-generic/atomic.h>
140#endif /* __ARCH_H8300_ATOMIC __ */ 141#endif /* __ARCH_H8300_ATOMIC __ */
diff --git a/include/asm-h8300/bitops.h b/include/asm-h8300/bitops.h
index 5036f595f8c9..c0411ec9d651 100644
--- a/include/asm-h8300/bitops.h
+++ b/include/asm-h8300/bitops.h
@@ -406,5 +406,6 @@ found_middle:
406#endif /* __KERNEL__ */ 406#endif /* __KERNEL__ */
407 407
408#define fls(x) generic_fls(x) 408#define fls(x) generic_fls(x)
409#define fls64(x) generic_fls64(x)
409 410
410#endif /* _H8300_BITOPS_H */ 411#endif /* _H8300_BITOPS_H */
diff --git a/include/asm-h8300/irq.h b/include/asm-h8300/irq.h
index 5027181ed067..73065f5bda0e 100644
--- a/include/asm-h8300/irq.h
+++ b/include/asm-h8300/irq.h
@@ -61,11 +61,6 @@ static __inline__ int irq_canonicalize(int irq)
61 61
62extern void enable_irq(unsigned int); 62extern void enable_irq(unsigned int);
63extern void disable_irq(unsigned int); 63extern void disable_irq(unsigned int);
64
65/*
66 * Some drivers want these entry points
67 */
68#define enable_irq_nosync(x) enable_irq(x)
69#define disable_irq_nosync(x) disable_irq(x) 64#define disable_irq_nosync(x) disable_irq(x)
70 65
71struct irqaction; 66struct irqaction;
diff --git a/include/asm-h8300/mman.h b/include/asm-h8300/mman.h
index 63f727a59850..744a8fb485c2 100644
--- a/include/asm-h8300/mman.h
+++ b/include/asm-h8300/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h
index c68557aa04b2..7a5472d77091 100644
--- a/include/asm-i386/atomic.h
+++ b/include/asm-i386/atomic.h
@@ -254,4 +254,5 @@ __asm__ __volatile__(LOCK "orl %0,%1" \
254#define smp_mb__before_atomic_inc() barrier() 254#define smp_mb__before_atomic_inc() barrier()
255#define smp_mb__after_atomic_inc() barrier() 255#define smp_mb__after_atomic_inc() barrier()
256 256
257#include <asm-generic/atomic.h>
257#endif 258#endif
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
index ddf1739dc7fd..65679aca4b22 100644
--- a/include/asm-i386/bitops.h
+++ b/include/asm-i386/bitops.h
@@ -332,9 +332,9 @@ static inline unsigned long __ffs(unsigned long word)
332 * Returns the bit-number of the first set bit, not the number of the byte 332 * Returns the bit-number of the first set bit, not the number of the byte
333 * containing a bit. 333 * containing a bit.
334 */ 334 */
335static inline int find_first_bit(const unsigned long *addr, unsigned size) 335static inline unsigned find_first_bit(const unsigned long *addr, unsigned size)
336{ 336{
337 int x = 0; 337 unsigned x = 0;
338 338
339 while (x < size) { 339 while (x < size) {
340 unsigned long val = *addr++; 340 unsigned long val = *addr++;
@@ -367,11 +367,7 @@ static inline unsigned long ffz(unsigned long word)
367 return word; 367 return word;
368} 368}
369 369
370/* 370#define fls64(x) generic_fls64(x)
371 * fls: find last bit set.
372 */
373
374#define fls(x) generic_fls(x)
375 371
376#ifdef __KERNEL__ 372#ifdef __KERNEL__
377 373
@@ -414,6 +410,23 @@ static inline int ffs(int x)
414} 410}
415 411
416/** 412/**
413 * fls - find last bit set
414 * @x: the word to search
415 *
416 * This is defined the same way as ffs.
417 */
418static inline int fls(int x)
419{
420 int r;
421
422 __asm__("bsrl %1,%0\n\t"
423 "jnz 1f\n\t"
424 "movl $-1,%0\n"
425 "1:" : "=r" (r) : "rm" (x));
426 return r+1;
427}
428
429/**
417 * hweightN - returns the hamming weight of a N-bit word 430 * hweightN - returns the hamming weight of a N-bit word
418 * @x: the word to weigh 431 * @x: the word to weigh
419 * 432 *
diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h
index ea54540638d2..50233e0345fb 100644
--- a/include/asm-i386/bugs.h
+++ b/include/asm-i386/bugs.h
@@ -8,9 +8,6 @@
8 * <rreilova@ececs.uc.edu> 8 * <rreilova@ececs.uc.edu>
9 * - Channing Corn (tests & fixes), 9 * - Channing Corn (tests & fixes),
10 * - Andrew D. Balsa (code cleanup). 10 * - Andrew D. Balsa (code cleanup).
11 *
12 * Pentium III FXSR, SSE support
13 * Gareth Hughes <gareth@valinux.com>, May 2000
14 */ 11 */
15 12
16/* 13/*
@@ -76,25 +73,7 @@ static void __init check_fpu(void)
76 return; 73 return;
77 } 74 }
78 75
79/* Enable FXSR and company _before_ testing for FP problems. */ 76/* trap_init() enabled FXSR and company _before_ testing for FP problems here. */
80 /*
81 * Verify that the FXSAVE/FXRSTOR data will be 16-byte aligned.
82 */
83 if (offsetof(struct task_struct, thread.i387.fxsave) & 15) {
84 extern void __buggy_fxsr_alignment(void);
85 __buggy_fxsr_alignment();
86 }
87 if (cpu_has_fxsr) {
88 printk(KERN_INFO "Enabling fast FPU save and restore... ");
89 set_in_cr4(X86_CR4_OSFXSR);
90 printk("done.\n");
91 }
92 if (cpu_has_xmm) {
93 printk(KERN_INFO "Enabling unmasked SIMD FPU exception support... ");
94 set_in_cr4(X86_CR4_OSXMMEXCPT);
95 printk("done.\n");
96 }
97
98 /* Test for the divl bug.. */ 77 /* Test for the divl bug.. */
99 __asm__("fninit\n\t" 78 __asm__("fninit\n\t"
100 "fldl %1\n\t" 79 "fldl %1\n\t"
diff --git a/include/asm-i386/cacheflush.h b/include/asm-i386/cacheflush.h
index 2ea36dea37d9..7199f7b326f1 100644
--- a/include/asm-i386/cacheflush.h
+++ b/include/asm-i386/cacheflush.h
@@ -31,4 +31,8 @@ int change_page_attr(struct page *page, int numpages, pgprot_t prot);
31void kernel_map_pages(struct page *page, int numpages, int enable); 31void kernel_map_pages(struct page *page, int numpages, int enable);
32#endif 32#endif
33 33
34#ifdef CONFIG_DEBUG_RODATA
35void mark_rodata_ro(void);
36#endif
37
34#endif /* _I386_CACHEFLUSH_H */ 38#endif /* _I386_CACHEFLUSH_H */
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index 29b851a18c6e..494e73bca095 100644
--- a/include/asm-i386/desc.h
+++ b/include/asm-i386/desc.h
@@ -15,9 +15,6 @@
15#include <asm/mmu.h> 15#include <asm/mmu.h>
16 16
17extern struct desc_struct cpu_gdt_table[GDT_ENTRIES]; 17extern struct desc_struct cpu_gdt_table[GDT_ENTRIES];
18DECLARE_PER_CPU(struct desc_struct, cpu_gdt_table[GDT_ENTRIES]);
19
20#define get_cpu_gdt_table(_cpu) (per_cpu(cpu_gdt_table,_cpu))
21 18
22DECLARE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); 19DECLARE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]);
23 20
@@ -29,6 +26,11 @@ struct Xgt_desc_struct {
29 26
30extern struct Xgt_desc_struct idt_descr, cpu_gdt_descr[NR_CPUS]; 27extern struct Xgt_desc_struct idt_descr, cpu_gdt_descr[NR_CPUS];
31 28
29static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
30{
31 return ((struct desc_struct *)cpu_gdt_descr[cpu].address);
32}
33
32#define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) 34#define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8))
33#define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8)) 35#define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8))
34 36
diff --git a/include/asm-i386/mach-bigsmp/mach_apic.h b/include/asm-i386/mach-bigsmp/mach_apic.h
index ba936d4daedb..18b19a773440 100644
--- a/include/asm-i386/mach-bigsmp/mach_apic.h
+++ b/include/asm-i386/mach-bigsmp/mach_apic.h
@@ -1,17 +1,10 @@
1#ifndef __ASM_MACH_APIC_H 1#ifndef __ASM_MACH_APIC_H
2#define __ASM_MACH_APIC_H 2#define __ASM_MACH_APIC_H
3#include <asm/smp.h> 3
4 4
5#define SEQUENTIAL_APICID 5extern u8 bios_cpu_apicid[];
6#ifdef SEQUENTIAL_APICID 6
7#define xapic_phys_to_log_apicid(phys_apic) ( (1ul << ((phys_apic) & 0x3)) |\ 7#define xapic_phys_to_log_apicid(cpu) (bios_cpu_apicid[cpu])
8 ((phys_apic<<2) & (~0xf)) )
9#elif CLUSTERED_APICID
10#define xapic_phys_to_log_apicid(phys_apic) ( (1ul << ((phys_apic) & 0x3)) |\
11 ((phys_apic) & (~0xf)) )
12#endif
13
14#define NO_BALANCE_IRQ (1)
15#define esr_disable (1) 8#define esr_disable (1)
16 9
17static inline int apic_id_registered(void) 10static inline int apic_id_registered(void)
@@ -19,7 +12,6 @@ static inline int apic_id_registered(void)
19 return (1); 12 return (1);
20} 13}
21 14
22#define APIC_DFR_VALUE (APIC_DFR_CLUSTER)
23/* Round robin the irqs amoung the online cpus */ 15/* Round robin the irqs amoung the online cpus */
24static inline cpumask_t target_cpus(void) 16static inline cpumask_t target_cpus(void)
25{ 17{
@@ -32,29 +24,34 @@ static inline cpumask_t target_cpus(void)
32 } while (cpu >= NR_CPUS); 24 } while (cpu >= NR_CPUS);
33 return cpumask_of_cpu(cpu); 25 return cpumask_of_cpu(cpu);
34} 26}
35#define TARGET_CPUS (target_cpus())
36 27
37#define INT_DELIVERY_MODE dest_Fixed 28#undef APIC_DEST_LOGICAL
38#define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ 29#define APIC_DEST_LOGICAL 0
30#define TARGET_CPUS (target_cpus())
31#define APIC_DFR_VALUE (APIC_DFR_FLAT)
32#define INT_DELIVERY_MODE (dest_Fixed)
33#define INT_DEST_MODE (0) /* phys delivery to target proc */
34#define NO_BALANCE_IRQ (0)
35#define WAKE_SECONDARY_VIA_INIT
36
39 37
40static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) 38static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
41{ 39{
42 return 0; 40 return (0);
43} 41}
44 42
45/* we don't use the phys_cpu_present_map to indicate apicid presence */ 43static inline unsigned long check_apicid_present(int bit)
46static inline unsigned long check_apicid_present(int bit)
47{ 44{
48 return 1; 45 return (1);
49} 46}
50 47
51#define apicid_cluster(apicid) (apicid & 0xF0) 48static inline unsigned long calculate_ldr(int cpu)
52
53static inline unsigned long calculate_ldr(unsigned long old)
54{ 49{
55 unsigned long id; 50 unsigned long val, id;
56 id = xapic_phys_to_log_apicid(hard_smp_processor_id()); 51 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
57 return ((old & ~APIC_LDR_MASK) | SET_APIC_LOGICAL_ID(id)); 52 id = xapic_phys_to_log_apicid(cpu);
53 val |= SET_APIC_LOGICAL_ID(id);
54 return val;
58} 55}
59 56
60/* 57/*
@@ -67,37 +64,35 @@ static inline unsigned long calculate_ldr(unsigned long old)
67static inline void init_apic_ldr(void) 64static inline void init_apic_ldr(void)
68{ 65{
69 unsigned long val; 66 unsigned long val;
67 int cpu = smp_processor_id();
70 68
71 apic_write_around(APIC_DFR, APIC_DFR_VALUE); 69 apic_write_around(APIC_DFR, APIC_DFR_VALUE);
72 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; 70 val = calculate_ldr(cpu);
73 val = calculate_ldr(val);
74 apic_write_around(APIC_LDR, val); 71 apic_write_around(APIC_LDR, val);
75} 72}
76 73
77static inline void clustered_apic_check(void) 74static inline void clustered_apic_check(void)
78{ 75{
79 printk("Enabling APIC mode: %s. Using %d I/O APICs\n", 76 printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
80 "Cluster", nr_ioapics); 77 "Physflat", nr_ioapics);
81} 78}
82 79
83static inline int multi_timer_check(int apic, int irq) 80static inline int multi_timer_check(int apic, int irq)
84{ 81{
85 return 0; 82 return (0);
86} 83}
87 84
88static inline int apicid_to_node(int logical_apicid) 85static inline int apicid_to_node(int logical_apicid)
89{ 86{
90 return 0; 87 return (0);
91} 88}
92 89
93extern u8 bios_cpu_apicid[];
94
95static inline int cpu_present_to_apicid(int mps_cpu) 90static inline int cpu_present_to_apicid(int mps_cpu)
96{ 91{
97 if (mps_cpu < NR_CPUS) 92 if (mps_cpu < NR_CPUS)
98 return (int)bios_cpu_apicid[mps_cpu]; 93 return (int) bios_cpu_apicid[mps_cpu];
99 else 94
100 return BAD_APICID; 95 return BAD_APICID;
101} 96}
102 97
103static inline physid_mask_t apicid_to_cpu_present(int phys_apicid) 98static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
@@ -109,10 +104,10 @@ extern u8 cpu_2_logical_apicid[];
109/* Mapping from cpu number to logical apicid */ 104/* Mapping from cpu number to logical apicid */
110static inline int cpu_to_logical_apicid(int cpu) 105static inline int cpu_to_logical_apicid(int cpu)
111{ 106{
112 if (cpu >= NR_CPUS) 107 if (cpu >= NR_CPUS)
113 return BAD_APICID; 108 return BAD_APICID;
114 return (int)cpu_2_logical_apicid[cpu]; 109 return cpu_physical_id(cpu);
115 } 110}
116 111
117static inline int mpc_apic_id(struct mpc_config_processor *m, 112static inline int mpc_apic_id(struct mpc_config_processor *m,
118 struct mpc_config_translation *translation_record) 113 struct mpc_config_translation *translation_record)
@@ -128,11 +123,9 @@ static inline int mpc_apic_id(struct mpc_config_processor *m,
128static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) 123static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
129{ 124{
130 /* For clustered we don't have a good way to do this yet - hack */ 125 /* For clustered we don't have a good way to do this yet - hack */
131 return physids_promote(0xFUL); 126 return physids_promote(0xFFL);
132} 127}
133 128
134#define WAKE_SECONDARY_VIA_INIT
135
136static inline void setup_portio_remap(void) 129static inline void setup_portio_remap(void)
137{ 130{
138} 131}
diff --git a/include/asm-i386/mach-bigsmp/mach_apicdef.h b/include/asm-i386/mach-bigsmp/mach_apicdef.h
index 23e58b317c79..a58ab5a75c8c 100644
--- a/include/asm-i386/mach-bigsmp/mach_apicdef.h
+++ b/include/asm-i386/mach-bigsmp/mach_apicdef.h
@@ -1,11 +1,11 @@
1#ifndef __ASM_MACH_APICDEF_H 1#ifndef __ASM_MACH_APICDEF_H
2#define __ASM_MACH_APICDEF_H 2#define __ASM_MACH_APICDEF_H
3 3
4#define APIC_ID_MASK (0x0F<<24) 4#define APIC_ID_MASK (0xFF<<24)
5 5
6static inline unsigned get_apic_id(unsigned long x) 6static inline unsigned get_apic_id(unsigned long x)
7{ 7{
8 return (((x)>>24)&0x0F); 8 return (((x)>>24)&0xFF);
9} 9}
10 10
11#define GET_APIC_ID(x) get_apic_id(x) 11#define GET_APIC_ID(x) get_apic_id(x)
diff --git a/include/asm-i386/mman.h b/include/asm-i386/mman.h
index 196619a83854..ba4941e6f643 100644
--- a/include/asm-i386/mman.h
+++ b/include/asm-i386/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h
index 620a90641ea8..74f595d80579 100644
--- a/include/asm-i386/mmzone.h
+++ b/include/asm-i386/mmzone.h
@@ -76,11 +76,6 @@ static inline int pfn_to_nid(unsigned long pfn)
76 * Following are macros that each numa implmentation must define. 76 * Following are macros that each numa implmentation must define.
77 */ 77 */
78 78
79/*
80 * Given a kernel address, find the home node of the underlying memory.
81 */
82#define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
83
84#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) 79#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
85#define node_end_pfn(nid) \ 80#define node_end_pfn(nid) \
86({ \ 81({ \
diff --git a/include/asm-i386/module.h b/include/asm-i386/module.h
index eb7f2b4234aa..424661d25bd3 100644
--- a/include/asm-i386/module.h
+++ b/include/asm-i386/module.h
@@ -52,8 +52,10 @@ struct mod_arch_specific
52#define MODULE_PROC_FAMILY "CYRIXIII " 52#define MODULE_PROC_FAMILY "CYRIXIII "
53#elif defined CONFIG_MVIAC3_2 53#elif defined CONFIG_MVIAC3_2
54#define MODULE_PROC_FAMILY "VIAC3-2 " 54#define MODULE_PROC_FAMILY "VIAC3-2 "
55#elif CONFIG_MGEODEGX1 55#elif defined CONFIG_MGEODEGX1
56#define MODULE_PROC_FAMILY "GEODEGX1 " 56#define MODULE_PROC_FAMILY "GEODEGX1 "
57#elif defined CONFIG_MGEODE_LX
58#define MODULE_PROC_FAMILY "GEODE "
57#else 59#else
58#error unknown processor family 60#error unknown processor family
59#endif 61#endif
diff --git a/include/asm-i386/mpspec_def.h b/include/asm-i386/mpspec_def.h
index a961093dbf88..76feedf85a8a 100644
--- a/include/asm-i386/mpspec_def.h
+++ b/include/asm-i386/mpspec_def.h
@@ -75,7 +75,7 @@ struct mpc_config_bus
75{ 75{
76 unsigned char mpc_type; 76 unsigned char mpc_type;
77 unsigned char mpc_busid; 77 unsigned char mpc_busid;
78 unsigned char mpc_bustype[6] __attribute((packed)); 78 unsigned char mpc_bustype[6];
79}; 79};
80 80
81/* List of Bus Type string values, Intel MP Spec. */ 81/* List of Bus Type string values, Intel MP Spec. */
diff --git a/include/asm-i386/param.h b/include/asm-i386/param.h
index fa02e67ea86b..095580f3a45c 100644
--- a/include/asm-i386/param.h
+++ b/include/asm-i386/param.h
@@ -1,9 +1,8 @@
1#include <linux/config.h>
2
3#ifndef _ASMi386_PARAM_H 1#ifndef _ASMi386_PARAM_H
4#define _ASMi386_PARAM_H 2#define _ASMi386_PARAM_H
5 3
6#ifdef __KERNEL__ 4#ifdef __KERNEL__
5# include <linux/config.h>
7# define HZ CONFIG_HZ /* Internal kernel timer frequency */ 6# define HZ CONFIG_HZ /* Internal kernel timer frequency */
8# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ 7# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
9# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ 8# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
diff --git a/include/asm-i386/segment.h b/include/asm-i386/segment.h
index bb5ff5b2c02e..faf995307b9e 100644
--- a/include/asm-i386/segment.h
+++ b/include/asm-i386/segment.h
@@ -91,6 +91,20 @@
91#define GDT_ENTRY_BOOT_DS (GDT_ENTRY_BOOT_CS + 1) 91#define GDT_ENTRY_BOOT_DS (GDT_ENTRY_BOOT_CS + 1)
92#define __BOOT_DS (GDT_ENTRY_BOOT_DS * 8) 92#define __BOOT_DS (GDT_ENTRY_BOOT_DS * 8)
93 93
94/* The PnP BIOS entries in the GDT */
95#define GDT_ENTRY_PNPBIOS_CS32 (GDT_ENTRY_PNPBIOS_BASE + 0)
96#define GDT_ENTRY_PNPBIOS_CS16 (GDT_ENTRY_PNPBIOS_BASE + 1)
97#define GDT_ENTRY_PNPBIOS_DS (GDT_ENTRY_PNPBIOS_BASE + 2)
98#define GDT_ENTRY_PNPBIOS_TS1 (GDT_ENTRY_PNPBIOS_BASE + 3)
99#define GDT_ENTRY_PNPBIOS_TS2 (GDT_ENTRY_PNPBIOS_BASE + 4)
100
101/* The PnP BIOS selectors */
102#define PNP_CS32 (GDT_ENTRY_PNPBIOS_CS32 * 8) /* segment for calling fn */
103#define PNP_CS16 (GDT_ENTRY_PNPBIOS_CS16 * 8) /* code segment for BIOS */
104#define PNP_DS (GDT_ENTRY_PNPBIOS_DS * 8) /* data segment for BIOS */
105#define PNP_TS1 (GDT_ENTRY_PNPBIOS_TS1 * 8) /* transfer data segment */
106#define PNP_TS2 (GDT_ENTRY_PNPBIOS_TS2 * 8) /* another data segment */
107
94/* 108/*
95 * The interrupt descriptor table has room for 256 idt's, 109 * The interrupt descriptor table has room for 256 idt's,
96 * the global descriptor table is dependent on the number 110 * the global descriptor table is dependent on the number
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index 772f85da1206..9c0593b7a94e 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -54,23 +54,7 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
54 ); } while(0) 54 ); } while(0)
55 55
56#define set_base(ldt,base) _set_base( ((char *)&(ldt)) , (base) ) 56#define set_base(ldt,base) _set_base( ((char *)&(ldt)) , (base) )
57#define set_limit(ldt,limit) _set_limit( ((char *)&(ldt)) , ((limit)-1)>>12 ) 57#define set_limit(ldt,limit) _set_limit( ((char *)&(ldt)) , ((limit)-1) )
58
59static inline unsigned long _get_base(char * addr)
60{
61 unsigned long __base;
62 __asm__("movb %3,%%dh\n\t"
63 "movb %2,%%dl\n\t"
64 "shll $16,%%edx\n\t"
65 "movw %1,%%dx"
66 :"=&d" (__base)
67 :"m" (*((addr)+2)),
68 "m" (*((addr)+4)),
69 "m" (*((addr)+7)));
70 return __base;
71}
72
73#define get_base(ldt) _get_base( ((char *)&(ldt)) )
74 58
75/* 59/*
76 * Load a segment. Fall back on loading the zero 60 * Load a segment. Fall back on loading the zero
@@ -140,6 +124,19 @@ static inline unsigned long _get_base(char * addr)
140 :"=r" (__dummy)); \ 124 :"=r" (__dummy)); \
141 __dummy; \ 125 __dummy; \
142}) 126})
127
128#define read_cr4_safe() ({ \
129 unsigned int __dummy; \
130 /* This could fault if %cr4 does not exist */ \
131 __asm__("1: movl %%cr4, %0 \n" \
132 "2: \n" \
133 ".section __ex_table,\"a\" \n" \
134 ".long 1b,2b \n" \
135 ".previous \n" \
136 : "=r" (__dummy): "0" (0)); \
137 __dummy; \
138})
139
143#define write_cr4(x) \ 140#define write_cr4(x) \
144 __asm__ __volatile__("movl %0,%%cr4": :"r" (x)); 141 __asm__ __volatile__("movl %0,%%cr4": :"r" (x));
145#define stts() write_cr0(8 | read_cr0()) 142#define stts() write_cr0(8 | read_cr0())
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index 0f92e78dfea1..fe38b9a96233 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -256,7 +256,7 @@
256#define __NR_io_submit 248 256#define __NR_io_submit 248
257#define __NR_io_cancel 249 257#define __NR_io_cancel 249
258#define __NR_fadvise64 250 258#define __NR_fadvise64 250
259#define __NR_set_zone_reclaim 251 259/* 251 is available for reuse (was briefly sys_set_zone_reclaim) */
260#define __NR_exit_group 252 260#define __NR_exit_group 252
261#define __NR_lookup_dcookie 253 261#define __NR_lookup_dcookie 253
262#define __NR_epoll_create 254 262#define __NR_epoll_create 254
diff --git a/include/asm-ia64/atomic.h b/include/asm-ia64/atomic.h
index 2fbebf85c31d..15cf7984c48e 100644
--- a/include/asm-ia64/atomic.h
+++ b/include/asm-ia64/atomic.h
@@ -192,4 +192,5 @@ atomic64_add_negative (__s64 i, atomic64_t *v)
192#define smp_mb__before_atomic_inc() barrier() 192#define smp_mb__before_atomic_inc() barrier()
193#define smp_mb__after_atomic_inc() barrier() 193#define smp_mb__after_atomic_inc() barrier()
194 194
195#include <asm-generic/atomic.h>
195#endif /* _ASM_IA64_ATOMIC_H */ 196#endif /* _ASM_IA64_ATOMIC_H */
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h
index 7232528e2d0c..36d0fb95ea89 100644
--- a/include/asm-ia64/bitops.h
+++ b/include/asm-ia64/bitops.h
@@ -345,6 +345,7 @@ fls (int t)
345 x |= x >> 16; 345 x |= x >> 16;
346 return ia64_popcnt(x); 346 return ia64_popcnt(x);
347} 347}
348#define fls64(x) generic_fls64(x)
348 349
349/* 350/*
350 * ffs: find first bit set. This is defined the same way as the libc and compiler builtin 351 * ffs: find first bit set. This is defined the same way as the libc and compiler builtin
diff --git a/include/asm-ia64/delay.h b/include/asm-ia64/delay.h
index 57182d6f2b9a..bba702076391 100644
--- a/include/asm-ia64/delay.h
+++ b/include/asm-ia64/delay.h
@@ -84,14 +84,6 @@ __delay (unsigned long loops)
84 ia64_delay_loop (loops - 1); 84 ia64_delay_loop (loops - 1);
85} 85}
86 86
87static __inline__ void 87extern void udelay (unsigned long usecs);
88udelay (unsigned long usecs)
89{
90 unsigned long start = ia64_get_itc();
91 unsigned long cycles = usecs*local_cpu_data->cyc_per_usec;
92
93 while (ia64_get_itc() - start < cycles)
94 cpu_relax();
95}
96 88
97#endif /* _ASM_IA64_DELAY_H */ 89#endif /* _ASM_IA64_DELAY_H */
diff --git a/include/asm-ia64/ia32.h b/include/asm-ia64/ia32.h
index 8e746b2413a6..f8044a1169cd 100644
--- a/include/asm-ia64/ia32.h
+++ b/include/asm-ia64/ia32.h
@@ -13,6 +13,8 @@
13 13
14# ifdef CONFIG_IA32_SUPPORT 14# ifdef CONFIG_IA32_SUPPORT
15 15
16#define IA32_PAGE_OFFSET 0xc0000000
17
16extern void ia32_cpu_init (void); 18extern void ia32_cpu_init (void);
17extern void ia32_mem_init (void); 19extern void ia32_mem_init (void);
18extern void ia32_gdt_init (void); 20extern void ia32_gdt_init (void);
diff --git a/include/asm-ia64/local.h b/include/asm-ia64/local.h
index 1dbd584ad851..dc519092ef4d 100644
--- a/include/asm-ia64/local.h
+++ b/include/asm-ia64/local.h
@@ -17,8 +17,8 @@ typedef struct {
17#define local_set(l, i) atomic64_set(&(l)->val, i) 17#define local_set(l, i) atomic64_set(&(l)->val, i)
18#define local_inc(l) atomic64_inc(&(l)->val) 18#define local_inc(l) atomic64_inc(&(l)->val)
19#define local_dec(l) atomic64_dec(&(l)->val) 19#define local_dec(l) atomic64_dec(&(l)->val)
20#define local_add(l) atomic64_add(&(l)->val) 20#define local_add(i, l) atomic64_add((i), &(l)->val)
21#define local_sub(l) atomic64_sub(&(l)->val) 21#define local_sub(i, l) atomic64_sub((i), &(l)->val)
22 22
23/* Non-atomic variants, i.e., preemption disabled and won't be touched in interrupt, etc. */ 23/* Non-atomic variants, i.e., preemption disabled and won't be touched in interrupt, etc. */
24 24
diff --git a/include/asm-ia64/mman.h b/include/asm-ia64/mman.h
index 1c0a73af1461..828beb24a20e 100644
--- a/include/asm-ia64/mman.h
+++ b/include/asm-ia64/mman.h
@@ -43,6 +43,7 @@
43#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 43#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
44#define MADV_WILLNEED 0x3 /* pre-fault pages */ 44#define MADV_WILLNEED 0x3 /* pre-fault pages */
45#define MADV_DONTNEED 0x4 /* discard these pages */ 45#define MADV_DONTNEED 0x4 /* discard these pages */
46#define MADV_REMOVE 0x5 /* remove these pages & resources */
46 47
47/* compatibility flags */ 48/* compatibility flags */
48#define MAP_ANON MAP_ANONYMOUS 49#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h
index 29df88bdd2bc..313cad0628d0 100644
--- a/include/asm-ia64/sal.h
+++ b/include/asm-ia64/sal.h
@@ -320,7 +320,8 @@ typedef struct sal_log_timestamp {
320typedef struct sal_log_record_header { 320typedef struct sal_log_record_header {
321 u64 id; /* Unique monotonically increasing ID */ 321 u64 id; /* Unique monotonically increasing ID */
322 sal_log_revision_t revision; /* Major and Minor revision of header */ 322 sal_log_revision_t revision; /* Major and Minor revision of header */
323 u16 severity; /* Error Severity */ 323 u8 severity; /* Error Severity */
324 u8 validation_bits; /* 0: platform_guid, 1: !timestamp */
324 u32 len; /* Length of this error log in bytes */ 325 u32 len; /* Length of this error log in bytes */
325 sal_log_timestamp_t timestamp; /* Timestamp */ 326 sal_log_timestamp_t timestamp; /* Timestamp */
326 efi_guid_t platform_guid; /* Unique OEM Platform ID */ 327 efi_guid_t platform_guid; /* Unique OEM Platform ID */
diff --git a/include/asm-ia64/sn/pcidev.h b/include/asm-ia64/sn/pcidev.h
index 49711d00ad04..f65d222ca5e8 100644
--- a/include/asm-ia64/sn/pcidev.h
+++ b/include/asm-ia64/sn/pcidev.h
@@ -3,15 +3,27 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 1992 - 1997, 2000-2005 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8#ifndef _ASM_IA64_SN_PCI_PCIDEV_H 8#ifndef _ASM_IA64_SN_PCI_PCIDEV_H
9#define _ASM_IA64_SN_PCI_PCIDEV_H 9#define _ASM_IA64_SN_PCI_PCIDEV_H
10 10
11#include <linux/pci.h> 11#include <linux/pci.h>
12 12
13#define SN_PCIDEV_INFO(pci_dev) \ 13/*
14 ((struct pcidev_info *)(pci_dev)->sysdata) 14 * In ia64, pci_dev->sysdata must be a *pci_controller. To provide access to
15 * the pcidev_info structs for all devices under a controller, we extend the
16 * definition of pci_controller, via sn_pci_controller, to include a list
17 * of pcidev_info.
18 */
19struct sn_pci_controller {
20 struct pci_controller pci_controller;
21 struct list_head pcidev_info;
22};
23
24#define SN_PCI_CONTROLLER(dev) ((struct sn_pci_controller *) dev->sysdata)
25
26#define SN_PCIDEV_INFO(dev) sn_pcidev_info_get(dev)
15 27
16#define SN_PCIBUS_BUSSOFT_INFO(pci_bus) \ 28#define SN_PCIBUS_BUSSOFT_INFO(pci_bus) \
17 (struct pcibus_info *)((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data)) 29 (struct pcibus_info *)((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data))
@@ -53,11 +65,13 @@ struct pcidev_info {
53 struct sn_irq_info *pdi_sn_irq_info; 65 struct sn_irq_info *pdi_sn_irq_info;
54 struct sn_pcibus_provider *pdi_provider; /* sn pci ops */ 66 struct sn_pcibus_provider *pdi_provider; /* sn pci ops */
55 struct pci_dev *host_pci_dev; /* host bus link */ 67 struct pci_dev *host_pci_dev; /* host bus link */
68 struct list_head pdi_list; /* List of pcidev_info */
56}; 69};
57 70
58extern void sn_irq_fixup(struct pci_dev *pci_dev, 71extern void sn_irq_fixup(struct pci_dev *pci_dev,
59 struct sn_irq_info *sn_irq_info); 72 struct sn_irq_info *sn_irq_info);
60extern void sn_irq_unfixup(struct pci_dev *pci_dev); 73extern void sn_irq_unfixup(struct pci_dev *pci_dev);
74extern struct pcidev_info * sn_pcidev_info_get(struct pci_dev *);
61extern void sn_pci_controller_fixup(int segment, int busnum, 75extern void sn_pci_controller_fixup(int segment, int busnum,
62 struct pci_bus *bus); 76 struct pci_bus *bus);
63extern void sn_bus_store_sysdata(struct pci_dev *dev); 77extern void sn_bus_store_sysdata(struct pci_dev *dev);
diff --git a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h
index 5b78611411c3..0c91a76c5ea3 100644
--- a/include/asm-ia64/spinlock.h
+++ b/include/asm-ia64/spinlock.h
@@ -201,6 +201,16 @@ static inline void __raw_write_unlock(raw_rwlock_t *x)
201 201
202#endif /* !ASM_SUPPORTED */ 202#endif /* !ASM_SUPPORTED */
203 203
204#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) 204static inline int __raw_read_trylock(raw_rwlock_t *x)
205{
206 union {
207 raw_rwlock_t lock;
208 __u32 word;
209 } old, new;
210 old.lock = new.lock = *x;
211 old.lock.write_lock = new.lock.write_lock = 0;
212 ++new.lock.read_counter;
213 return (u32)ia64_cmpxchg4_acq((__u32 *)(x), new.word, old.word) == old.word;
214}
205 215
206#endif /* _ASM_IA64_SPINLOCK_H */ 216#endif /* _ASM_IA64_SPINLOCK_H */
diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h
index a9f738bf18a7..f7c330467e7e 100644
--- a/include/asm-ia64/topology.h
+++ b/include/asm-ia64/topology.h
@@ -38,7 +38,7 @@
38/* 38/*
39 * Returns the number of the first CPU on Node 'node'. 39 * Returns the number of the first CPU on Node 'node'.
40 */ 40 */
41#define node_to_first_cpu(node) (__ffs(node_to_cpumask(node))) 41#define node_to_first_cpu(node) (first_cpu(node_to_cpumask(node)))
42 42
43/* 43/*
44 * Determines the node for a given pci bus 44 * Determines the node for a given pci bus
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index 6d96a67439be..2bf543493cb8 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -265,7 +265,7 @@
265#define __NR_keyctl 1273 265#define __NR_keyctl 1273
266#define __NR_ioprio_set 1274 266#define __NR_ioprio_set 1274
267#define __NR_ioprio_get 1275 267#define __NR_ioprio_get 1275
268#define __NR_set_zone_reclaim 1276 268/* 1276 is available for reuse (was briefly sys_set_zone_reclaim) */
269#define __NR_inotify_init 1277 269#define __NR_inotify_init 1277
270#define __NR_inotify_add_watch 1278 270#define __NR_inotify_add_watch 1278
271#define __NR_inotify_rm_watch 1279 271#define __NR_inotify_rm_watch 1279
diff --git a/include/asm-m32r/assembler.h b/include/asm-m32r/assembler.h
index e1dff9d6baad..b7f4d8aaeb46 100644
--- a/include/asm-m32r/assembler.h
+++ b/include/asm-m32r/assembler.h
@@ -52,7 +52,7 @@
52 or3 \reg, \reg, #low(\x) 52 or3 \reg, \reg, #low(\x)
53 .endm 53 .endm
54 54
55#if !defined(CONFIG_CHIP_M32102) 55#if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
56#define STI(reg) STI_M reg 56#define STI(reg) STI_M reg
57 .macro STI_M reg 57 .macro STI_M reg
58 setpsw #0x40 -> nop 58 setpsw #0x40 -> nop
@@ -64,7 +64,7 @@
64 clrpsw #0x40 -> nop 64 clrpsw #0x40 -> nop
65 ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1). 65 ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1).
66 .endm 66 .endm
67#else /* CONFIG_CHIP_M32102 */ 67#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
68#define STI(reg) STI_M reg 68#define STI(reg) STI_M reg
69 .macro STI_M reg 69 .macro STI_M reg
70 mvfc \reg, psw 70 mvfc \reg, psw
@@ -191,12 +191,12 @@
191 and \reg, sp 191 and \reg, sp
192 .endm 192 .endm
193 193
194#if !defined(CONFIG_CHIP_M32102) 194#if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
195 .macro SWITCH_TO_KERNEL_STACK 195 .macro SWITCH_TO_KERNEL_STACK
196 ; switch to kernel stack (spi) 196 ; switch to kernel stack (spi)
197 clrpsw #0x80 -> nop 197 clrpsw #0x80 -> nop
198 .endm 198 .endm
199#else /* CONFIG_CHIP_M32102 */ 199#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
200 .macro SWITCH_TO_KERNEL_STACK 200 .macro SWITCH_TO_KERNEL_STACK
201 push r0 ; save r0 for working 201 push r0 ; save r0 for working
202 mvfc r0, psw 202 mvfc r0, psw
@@ -218,7 +218,7 @@
218 .fillinsn 218 .fillinsn
2192: 2192:
220 .endm 220 .endm
221#endif /* CONFIG_CHIP_M32102 */ 221#endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
222 222
223#endif /* __ASSEMBLY__ */ 223#endif /* __ASSEMBLY__ */
224 224
diff --git a/include/asm-m32r/atomic.h b/include/asm-m32r/atomic.h
index ef1fb8ea4726..70761278b6cb 100644
--- a/include/asm-m32r/atomic.h
+++ b/include/asm-m32r/atomic.h
@@ -313,4 +313,5 @@ static __inline__ void atomic_set_mask(unsigned long mask, atomic_t *addr)
313#define smp_mb__before_atomic_inc() barrier() 313#define smp_mb__before_atomic_inc() barrier()
314#define smp_mb__after_atomic_inc() barrier() 314#define smp_mb__after_atomic_inc() barrier()
315 315
316#include <asm-generic/atomic.h>
316#endif /* _ASM_M32R_ATOMIC_H */ 317#endif /* _ASM_M32R_ATOMIC_H */
diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h
index e78443981349..abea2fdd8689 100644
--- a/include/asm-m32r/bitops.h
+++ b/include/asm-m32r/bitops.h
@@ -465,6 +465,7 @@ static __inline__ unsigned long __ffs(unsigned long word)
465 * fls: find last bit set. 465 * fls: find last bit set.
466 */ 466 */
467#define fls(x) generic_fls(x) 467#define fls(x) generic_fls(x)
468#define fls64(x) generic_fls64(x)
468 469
469#ifdef __KERNEL__ 470#ifdef __KERNEL__
470 471
diff --git a/include/asm-m32r/cacheflush.h b/include/asm-m32r/cacheflush.h
index 46fc4c325108..e57427b6e249 100644
--- a/include/asm-m32r/cacheflush.h
+++ b/include/asm-m32r/cacheflush.h
@@ -7,7 +7,7 @@
7extern void _flush_cache_all(void); 7extern void _flush_cache_all(void);
8extern void _flush_cache_copyback_all(void); 8extern void _flush_cache_copyback_all(void);
9 9
10#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) 10#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
11#define flush_cache_all() do { } while (0) 11#define flush_cache_all() do { } while (0)
12#define flush_cache_mm(mm) do { } while (0) 12#define flush_cache_mm(mm) do { } while (0)
13#define flush_cache_range(vma, start, end) do { } while (0) 13#define flush_cache_range(vma, start, end) do { } while (0)
diff --git a/include/asm-m32r/irq.h b/include/asm-m32r/irq.h
index 8ed77968ecb4..ca943954572a 100644
--- a/include/asm-m32r/irq.h
+++ b/include/asm-m32r/irq.h
@@ -65,6 +65,22 @@
65#define NR_IRQS \ 65#define NR_IRQS \
66 (OPSPUT_NUM_CPU_IRQ + OPSPUT_NUM_PLD_IRQ \ 66 (OPSPUT_NUM_CPU_IRQ + OPSPUT_NUM_PLD_IRQ \
67 + OPSPUT_NUM_LCD_PLD_IRQ + OPSPUT_NUM_LAN_PLD_IRQ) 67 + OPSPUT_NUM_LCD_PLD_IRQ + OPSPUT_NUM_LAN_PLD_IRQ)
68
69#elif defined(CONFIG_PLAT_M32104UT)
70/*
71 * IRQ definitions for M32104UT
72 * M32104 Chip: 64 interrupts
73 * ICU of M32104UT-on-board PLD: 32 interrupts cascaded to INT1# chip pin
74 */
75#define M32104UT_NUM_CPU_IRQ (64)
76#define M32104UT_NUM_PLD_IRQ (32)
77#define M32104UT_IRQ_BASE 0
78#define M32104UT_CPU_IRQ_BASE M32104UT_IRQ_BASE
79#define M32104UT_PLD_IRQ_BASE (M32104UT_CPU_IRQ_BASE + M32104UT_NUM_CPU_IRQ)
80
81#define NR_IRQS \
82 (M32104UT_NUM_CPU_IRQ + M32104UT_NUM_PLD_IRQ)
83
68#else 84#else
69#define NR_IRQS 64 85#define NR_IRQS 64
70#endif 86#endif
diff --git a/include/asm-m32r/m32102.h b/include/asm-m32r/m32102.h
index cb98101f4f6e..a1f0d1fe9eb8 100644
--- a/include/asm-m32r/m32102.h
+++ b/include/asm-m32r/m32102.h
@@ -11,7 +11,11 @@
11/*======================================================================* 11/*======================================================================*
12 * Special Function Register 12 * Special Function Register
13 *======================================================================*/ 13 *======================================================================*/
14#if !defined(CONFIG_CHIP_M32104)
14#define M32R_SFR_OFFSET (0x00E00000) /* 0x00E00000-0x00EFFFFF 1[MB] */ 15#define M32R_SFR_OFFSET (0x00E00000) /* 0x00E00000-0x00EFFFFF 1[MB] */
16#else
17#define M32R_SFR_OFFSET (0x00700000) /* 0x00700000-0x007FFFFF 1[MB] */
18#endif
15 19
16/* 20/*
17 * Clock and Power Management registers. 21 * Clock and Power Management registers.
@@ -100,7 +104,7 @@
100#define M32R_MFT5RLD_PORTL (0x0C+M32R_MFT5_OFFSET) /* MFT4 reload */ 104#define M32R_MFT5RLD_PORTL (0x0C+M32R_MFT5_OFFSET) /* MFT4 reload */
101#define M32R_MFT5CMPRLD_PORTL (0x10+M32R_MFT5_OFFSET) /* MFT4 compare reload */ 105#define M32R_MFT5CMPRLD_PORTL (0x10+M32R_MFT5_OFFSET) /* MFT4 compare reload */
102 106
103#ifdef CONFIG_CHIP_M32700 107#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32104)
104#define M32R_MFTCR_MFT0MSK (1UL<<31) /* b0 */ 108#define M32R_MFTCR_MFT0MSK (1UL<<31) /* b0 */
105#define M32R_MFTCR_MFT1MSK (1UL<<30) /* b1 */ 109#define M32R_MFTCR_MFT1MSK (1UL<<30) /* b1 */
106#define M32R_MFTCR_MFT2MSK (1UL<<29) /* b2 */ 110#define M32R_MFTCR_MFT2MSK (1UL<<29) /* b2 */
@@ -113,7 +117,7 @@
113#define M32R_MFTCR_MFT3EN (1UL<<20) /* b11 */ 117#define M32R_MFTCR_MFT3EN (1UL<<20) /* b11 */
114#define M32R_MFTCR_MFT4EN (1UL<<19) /* b12 */ 118#define M32R_MFTCR_MFT4EN (1UL<<19) /* b12 */
115#define M32R_MFTCR_MFT5EN (1UL<<18) /* b13 */ 119#define M32R_MFTCR_MFT5EN (1UL<<18) /* b13 */
116#else /* not CONFIG_CHIP_M32700 */ 120#else /* not CONFIG_CHIP_M32700 && not CONFIG_CHIP_M32104 */
117#define M32R_MFTCR_MFT0MSK (1UL<<15) /* b16 */ 121#define M32R_MFTCR_MFT0MSK (1UL<<15) /* b16 */
118#define M32R_MFTCR_MFT1MSK (1UL<<14) /* b17 */ 122#define M32R_MFTCR_MFT1MSK (1UL<<14) /* b17 */
119#define M32R_MFTCR_MFT2MSK (1UL<<13) /* b18 */ 123#define M32R_MFTCR_MFT2MSK (1UL<<13) /* b18 */
@@ -126,7 +130,7 @@
126#define M32R_MFTCR_MFT3EN (1UL<<4) /* b27 */ 130#define M32R_MFTCR_MFT3EN (1UL<<4) /* b27 */
127#define M32R_MFTCR_MFT4EN (1UL<<3) /* b28 */ 131#define M32R_MFTCR_MFT4EN (1UL<<3) /* b28 */
128#define M32R_MFTCR_MFT5EN (1UL<<2) /* b29 */ 132#define M32R_MFTCR_MFT5EN (1UL<<2) /* b29 */
129#endif /* not CONFIG_CHIP_M32700 */ 133#endif /* not CONFIG_CHIP_M32700 && not CONFIG_CHIP_M32104 */
130 134
131#define M32R_MFTMOD_CC_MASK (1UL<<15) /* b16 */ 135#define M32R_MFTMOD_CC_MASK (1UL<<15) /* b16 */
132#define M32R_MFTMOD_TCCR (1UL<<13) /* b18 */ 136#define M32R_MFTMOD_TCCR (1UL<<13) /* b18 */
@@ -241,8 +245,24 @@
241#define M32R_IRQ_MFT1 (17) /* MFT1 */ 245#define M32R_IRQ_MFT1 (17) /* MFT1 */
242#define M32R_IRQ_MFT2 (18) /* MFT2 */ 246#define M32R_IRQ_MFT2 (18) /* MFT2 */
243#define M32R_IRQ_MFT3 (19) /* MFT3 */ 247#define M32R_IRQ_MFT3 (19) /* MFT3 */
244#define M32R_IRQ_MFT4 (20) /* MFT4 */ 248#ifdef CONFIG_CHIP_M32104
245#define M32R_IRQ_MFT5 (21) /* MFT5 */ 249#define M32R_IRQ_MFTX0 (24) /* MFTX0 */
250#define M32R_IRQ_MFTX1 (25) /* MFTX1 */
251#define M32R_IRQ_DMA0 (32) /* DMA0 */
252#define M32R_IRQ_DMA1 (33) /* DMA1 */
253#define M32R_IRQ_DMA2 (34) /* DMA2 */
254#define M32R_IRQ_DMA3 (35) /* DMA3 */
255#define M32R_IRQ_SIO0_R (40) /* SIO0 send */
256#define M32R_IRQ_SIO0_S (41) /* SIO0 receive */
257#define M32R_IRQ_SIO1_R (42) /* SIO1 send */
258#define M32R_IRQ_SIO1_S (43) /* SIO1 receive */
259#define M32R_IRQ_SIO2_R (44) /* SIO2 send */
260#define M32R_IRQ_SIO2_S (45) /* SIO2 receive */
261#define M32R_IRQ_SIO3_R (46) /* SIO3 send */
262#define M32R_IRQ_SIO3_S (47) /* SIO3 receive */
263#define M32R_IRQ_ADC (56) /* ADC */
264#define M32R_IRQ_PC (57) /* PC */
265#else /* ! M32104 */
246#define M32R_IRQ_DMA0 (32) /* DMA0 */ 266#define M32R_IRQ_DMA0 (32) /* DMA0 */
247#define M32R_IRQ_DMA1 (33) /* DMA1 */ 267#define M32R_IRQ_DMA1 (33) /* DMA1 */
248#define M32R_IRQ_SIO0_R (48) /* SIO0 send */ 268#define M32R_IRQ_SIO0_R (48) /* SIO0 send */
@@ -255,6 +275,7 @@
255#define M32R_IRQ_SIO3_S (55) /* SIO3 receive */ 275#define M32R_IRQ_SIO3_S (55) /* SIO3 receive */
256#define M32R_IRQ_SIO4_R (56) /* SIO4 send */ 276#define M32R_IRQ_SIO4_R (56) /* SIO4 send */
257#define M32R_IRQ_SIO4_S (57) /* SIO4 receive */ 277#define M32R_IRQ_SIO4_S (57) /* SIO4 receive */
278#endif /* ! M32104 */
258 279
259#ifdef CONFIG_SMP 280#ifdef CONFIG_SMP
260#define M32R_IRQ_IPI0 (56) 281#define M32R_IRQ_IPI0 (56)
@@ -281,15 +302,12 @@
281#define M32R_FPGA_VERSION0_PORTL (0x30+M32R_FPGA_TOP) 302#define M32R_FPGA_VERSION0_PORTL (0x30+M32R_FPGA_TOP)
282#define M32R_FPGA_VERSION1_PORTL (0x34+M32R_FPGA_TOP) 303#define M32R_FPGA_VERSION1_PORTL (0x34+M32R_FPGA_TOP)
283 304
305#endif /* CONFIG_SMP */
306
284#ifndef __ASSEMBLY__ 307#ifndef __ASSEMBLY__
285/* For NETDEV WATCHDOG */
286typedef struct { 308typedef struct {
287 unsigned long icucr; /* ICU Control Register */ 309 unsigned long icucr; /* ICU Control Register */
288} icu_data_t; 310} icu_data_t;
289
290extern icu_data_t icu_data[];
291#endif 311#endif
292 312
293#endif /* CONFIG_SMP */
294
295#endif /* _M32102_H_ */ 313#endif /* _M32102_H_ */
diff --git a/include/asm-m32r/m32104ut/m32104ut_pld.h b/include/asm-m32r/m32104ut/m32104ut_pld.h
new file mode 100644
index 000000000000..a4eac20553df
--- /dev/null
+++ b/include/asm-m32r/m32104ut/m32104ut_pld.h
@@ -0,0 +1,163 @@
1/*
2 * include/asm/m32104ut/m32104ut_pld.h
3 *
4 * Definitions for Programable Logic Device(PLD) on M32104UT board.
5 * Based on m32700ut_pld.h
6 *
7 * Copyright (c) 2002 Takeo Takahashi
8 * Copyright (c) 2005 Naoto Sugai
9 *
10 * This file is subject to the terms and conditions of the GNU General
11 * Public License. See the file "COPYING" in the main directory of
12 * this archive for more details.
13 */
14
15#ifndef _M32104UT_M32104UT_PLD_H
16#define _M32104UT_M32104UT_PLD_H
17
18#include <linux/config.h>
19
20#if defined(CONFIG_PLAT_M32104UT)
21#define PLD_PLAT_BASE 0x02c00000
22#else
23#error "no platform configuration"
24#endif
25
26#ifndef __ASSEMBLY__
27/*
28 * C functions use non-cache address.
29 */
30#define PLD_BASE (PLD_PLAT_BASE /* + NONCACHE_OFFSET */)
31#define __reg8 (volatile unsigned char *)
32#define __reg16 (volatile unsigned short *)
33#define __reg32 (volatile unsigned int *)
34#else
35#define PLD_BASE (PLD_PLAT_BASE + NONCACHE_OFFSET)
36#define __reg8
37#define __reg16
38#define __reg32
39#endif /* __ASSEMBLY__ */
40
41/* CFC */
42#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000)
43#define PLD_CFSTS __reg16(PLD_BASE + 0x0002)
44#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004)
45#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006)
46
47/* MMC */
48#define PLD_MMCCR __reg16(PLD_BASE + 0x4000)
49#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002)
50#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006)
51#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a)
52#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c)
53#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e)
54#define PLD_MMCDET __reg16(PLD_BASE + 0x4010)
55#define PLD_MMCWP __reg16(PLD_BASE + 0x4012)
56#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000)
57#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000)
58#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000)
59#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006)
60
61/* ICU
62 * ICUISTS: status register
63 * ICUIREQ0: request register
64 * ICUIREQ1: request register
65 * ICUCR3: control register for CFIREQ# interrupt
66 * ICUCR4: control register for CFC Card insert interrupt
67 * ICUCR5: control register for CFC Card eject interrupt
68 * ICUCR6: control register for external interrupt
69 * ICUCR11: control register for MMC Card insert/eject interrupt
70 * ICUCR13: control register for SC error interrupt
71 * ICUCR14: control register for SC receive interrupt
72 * ICUCR15: control register for SC send interrupt
73 */
74
75#define PLD_IRQ_INT0 (M32104UT_PLD_IRQ_BASE + 0) /* None */
76#define PLD_IRQ_CFIREQ (M32104UT_PLD_IRQ_BASE + 3) /* CF IREQ */
77#define PLD_IRQ_CFC_INSERT (M32104UT_PLD_IRQ_BASE + 4) /* CF Insert */
78#define PLD_IRQ_CFC_EJECT (M32104UT_PLD_IRQ_BASE + 5) /* CF Eject */
79#define PLD_IRQ_EXINT (M32104UT_PLD_IRQ_BASE + 6) /* EXINT */
80#define PLD_IRQ_MMCCARD (M32104UT_PLD_IRQ_BASE + 11) /* MMC Insert/Eject */
81#define PLD_IRQ_SC_ERROR (M32104UT_PLD_IRQ_BASE + 13) /* SC error */
82#define PLD_IRQ_SC_RCV (M32104UT_PLD_IRQ_BASE + 14) /* SC receive */
83#define PLD_IRQ_SC_SND (M32104UT_PLD_IRQ_BASE + 15) /* SC send */
84
85#define PLD_ICUISTS __reg16(PLD_BASE + 0x8002)
86#define PLD_ICUISTS_VECB_MASK (0xf000)
87#define PLD_ICUISTS_VECB(x) ((x) & PLD_ICUISTS_VECB_MASK)
88#define PLD_ICUISTS_ISN_MASK (0x07c0)
89#define PLD_ICUISTS_ISN(x) ((x) & PLD_ICUISTS_ISN_MASK)
90#define PLD_ICUCR3 __reg16(PLD_BASE + 0x8104)
91#define PLD_ICUCR4 __reg16(PLD_BASE + 0x8106)
92#define PLD_ICUCR5 __reg16(PLD_BASE + 0x8108)
93#define PLD_ICUCR6 __reg16(PLD_BASE + 0x810a)
94#define PLD_ICUCR11 __reg16(PLD_BASE + 0x8114)
95#define PLD_ICUCR13 __reg16(PLD_BASE + 0x8118)
96#define PLD_ICUCR14 __reg16(PLD_BASE + 0x811a)
97#define PLD_ICUCR15 __reg16(PLD_BASE + 0x811c)
98#define PLD_ICUCR_IEN (0x1000)
99#define PLD_ICUCR_IREQ (0x0100)
100#define PLD_ICUCR_ISMOD00 (0x0000) /* Low edge */
101#define PLD_ICUCR_ISMOD01 (0x0010) /* Low level */
102#define PLD_ICUCR_ISMOD02 (0x0020) /* High edge */
103#define PLD_ICUCR_ISMOD03 (0x0030) /* High level */
104#define PLD_ICUCR_ILEVEL0 (0x0000)
105#define PLD_ICUCR_ILEVEL1 (0x0001)
106#define PLD_ICUCR_ILEVEL2 (0x0002)
107#define PLD_ICUCR_ILEVEL3 (0x0003)
108#define PLD_ICUCR_ILEVEL4 (0x0004)
109#define PLD_ICUCR_ILEVEL5 (0x0005)
110#define PLD_ICUCR_ILEVEL6 (0x0006)
111#define PLD_ICUCR_ILEVEL7 (0x0007)
112
113/* Power Control of MMC and CF */
114#define PLD_CPCR __reg16(PLD_BASE + 0x14000)
115#define PLD_CPCR_CDP 0x0001
116
117/* LED Control
118 *
119 * 1: DIP swich side
120 * 2: Reset switch side
121 */
122#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002)
123#define PLD_IOLED_1_ON 0x001
124#define PLD_IOLED_1_OFF 0x000
125#define PLD_IOLED_2_ON 0x002
126#define PLD_IOLED_2_OFF 0x000
127
128/* DIP Switch
129 * 0: Write-protect of Flash Memory (0:protected, 1:non-protected)
130 * 1: -
131 * 2: -
132 * 3: -
133 */
134#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004)
135#define PLD_IOSWSTS_IOSW2 0x0200
136#define PLD_IOSWSTS_IOSW1 0x0100
137#define PLD_IOSWSTS_IOWP0 0x0001
138
139/* CRC */
140#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000)
141#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002)
142#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004)
143#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006)
144#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008)
145#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a)
146
147/* RTC */
148#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000)
149#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002)
150#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004)
151#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006)
152#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008)
153
154/* SIM Card */
155#define PLD_SCCR __reg16(PLD_BASE + 0x38000)
156#define PLD_SCMOD __reg16(PLD_BASE + 0x38004)
157#define PLD_SCSTS __reg16(PLD_BASE + 0x38006)
158#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008)
159#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a)
160#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c)
161#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e)
162
163#endif /* _M32104UT_M32104UT_PLD_H */
diff --git a/include/asm-m32r/m32r.h b/include/asm-m32r/m32r.h
index ec142be00862..b133ca61acf1 100644
--- a/include/asm-m32r/m32r.h
+++ b/include/asm-m32r/m32r.h
@@ -14,7 +14,7 @@
14#include <asm/m32r_mp_fpga.h> 14#include <asm/m32r_mp_fpga.h>
15#elif defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \ 15#elif defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \
16 || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ 16 || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \
17 || defined(CONFIG_CHIP_OPSP) 17 || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
18#include <asm/m32102.h> 18#include <asm/m32102.h>
19#endif 19#endif
20 20
@@ -43,6 +43,10 @@
43#include <asm/m32700ut/m32700ut_pld.h> 43#include <asm/m32700ut/m32700ut_pld.h>
44#endif 44#endif
45 45
46#if defined(CONFIG_PLAT_M32104UT)
47#include <asm/m32104ut/m32104ut_pld.h>
48#endif /* CONFIG_PLAT_M32104 */
49
46/* 50/*
47 * M32R Register 51 * M32R Register
48 */ 52 */
@@ -122,7 +126,7 @@
122 126
123#include <asm/page.h> 127#include <asm/page.h>
124#ifdef CONFIG_MMU 128#ifdef CONFIG_MMU
125#define NONCACHE_OFFSET __PAGE_OFFSET+0x20000000 129#define NONCACHE_OFFSET (__PAGE_OFFSET + 0x20000000)
126#else 130#else
127#define NONCACHE_OFFSET __PAGE_OFFSET 131#define NONCACHE_OFFSET __PAGE_OFFSET
128#endif /* CONFIG_MMU */ 132#endif /* CONFIG_MMU */
diff --git a/include/asm-m32r/mman.h b/include/asm-m32r/mman.h
index 011f6d9ec5cc..12e29747bc84 100644
--- a/include/asm-m32r/mman.h
+++ b/include/asm-m32r/mman.h
@@ -37,6 +37,7 @@
37#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 37#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
38#define MADV_WILLNEED 0x3 /* pre-fault pages */ 38#define MADV_WILLNEED 0x3 /* pre-fault pages */
39#define MADV_DONTNEED 0x4 /* discard these pages */ 39#define MADV_DONTNEED 0x4 /* discard these pages */
40#define MADV_REMOVE 0x5 /* remove these pages & resources */
40 41
41/* compatibility flags */ 42/* compatibility flags */
42#define MAP_ANON MAP_ANONYMOUS 43#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index 5eee832b73a0..dcf619a0a0b0 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -69,12 +69,12 @@
69} while(0) 69} while(0)
70 70
71/* Interrupt Control */ 71/* Interrupt Control */
72#if !defined(CONFIG_CHIP_M32102) 72#if !defined(CONFIG_CHIP_M32102) && !defined(CONFIG_CHIP_M32104)
73#define local_irq_enable() \ 73#define local_irq_enable() \
74 __asm__ __volatile__ ("setpsw #0x40 -> nop": : :"memory") 74 __asm__ __volatile__ ("setpsw #0x40 -> nop": : :"memory")
75#define local_irq_disable() \ 75#define local_irq_disable() \
76 __asm__ __volatile__ ("clrpsw #0x40 -> nop": : :"memory") 76 __asm__ __volatile__ ("clrpsw #0x40 -> nop": : :"memory")
77#else /* CONFIG_CHIP_M32102 */ 77#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
78static inline void local_irq_enable(void) 78static inline void local_irq_enable(void)
79{ 79{
80 unsigned long tmpreg; 80 unsigned long tmpreg;
@@ -96,7 +96,7 @@ static inline void local_irq_disable(void)
96 "mvtc %0, psw \n\t" 96 "mvtc %0, psw \n\t"
97 : "=&r" (tmpreg0), "=&r" (tmpreg1) : : "cbit", "memory"); 97 : "=&r" (tmpreg0), "=&r" (tmpreg1) : : "cbit", "memory");
98} 98}
99#endif /* CONFIG_CHIP_M32102 */ 99#endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
100 100
101#define local_save_flags(x) \ 101#define local_save_flags(x) \
102 __asm__ __volatile__("mvfc %0,psw" : "=r"(x) : /* no input */) 102 __asm__ __volatile__("mvfc %0,psw" : "=r"(x) : /* no input */)
@@ -105,13 +105,13 @@ static inline void local_irq_disable(void)
105 __asm__ __volatile__("mvtc %0,psw" : /* no outputs */ \ 105 __asm__ __volatile__("mvtc %0,psw" : /* no outputs */ \
106 : "r" (x) : "cbit", "memory") 106 : "r" (x) : "cbit", "memory")
107 107
108#if !defined(CONFIG_CHIP_M32102) 108#if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
109#define local_irq_save(x) \ 109#define local_irq_save(x) \
110 __asm__ __volatile__( \ 110 __asm__ __volatile__( \
111 "mvfc %0, psw; \n\t" \ 111 "mvfc %0, psw; \n\t" \
112 "clrpsw #0x40 -> nop; \n\t" \ 112 "clrpsw #0x40 -> nop; \n\t" \
113 : "=r" (x) : /* no input */ : "memory") 113 : "=r" (x) : /* no input */ : "memory")
114#else /* CONFIG_CHIP_M32102 */ 114#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
115#define local_irq_save(x) \ 115#define local_irq_save(x) \
116 ({ \ 116 ({ \
117 unsigned long tmpreg; \ 117 unsigned long tmpreg; \
@@ -124,7 +124,7 @@ static inline void local_irq_disable(void)
124 : "=r" (x), "=&r" (tmpreg) \ 124 : "=r" (x), "=&r" (tmpreg) \
125 : : "cbit", "memory"); \ 125 : : "cbit", "memory"); \
126 }) 126 })
127#endif /* CONFIG_CHIP_M32102 */ 127#endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
128 128
129#define irqs_disabled() \ 129#define irqs_disabled() \
130 ({ \ 130 ({ \
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h
index ac399e1f7bc0..39be87ca2a5a 100644
--- a/include/asm-m32r/unistd.h
+++ b/include/asm-m32r/unistd.h
@@ -319,7 +319,7 @@ type name(void) \
319register long __scno __asm__ ("r7") = __NR_##name; \ 319register long __scno __asm__ ("r7") = __NR_##name; \
320register long __res __asm__("r0"); \ 320register long __res __asm__("r0"); \
321__asm__ __volatile__ (\ 321__asm__ __volatile__ (\
322 "trap #" SYSCALL_VECTOR \ 322 "trap #" SYSCALL_VECTOR "|| nop"\
323 : "=r" (__res) \ 323 : "=r" (__res) \
324 : "r" (__scno) \ 324 : "r" (__scno) \
325 : "memory"); \ 325 : "memory"); \
@@ -332,7 +332,7 @@ type name(type1 arg1) \
332register long __scno __asm__ ("r7") = __NR_##name; \ 332register long __scno __asm__ ("r7") = __NR_##name; \
333register long __res __asm__ ("r0") = (long)(arg1); \ 333register long __res __asm__ ("r0") = (long)(arg1); \
334__asm__ __volatile__ (\ 334__asm__ __volatile__ (\
335 "trap #" SYSCALL_VECTOR \ 335 "trap #" SYSCALL_VECTOR "|| nop"\
336 : "=r" (__res) \ 336 : "=r" (__res) \
337 : "r" (__scno), "0" (__res) \ 337 : "r" (__scno), "0" (__res) \
338 : "memory"); \ 338 : "memory"); \
@@ -346,7 +346,7 @@ register long __scno __asm__ ("r7") = __NR_##name; \
346register long __arg2 __asm__ ("r1") = (long)(arg2); \ 346register long __arg2 __asm__ ("r1") = (long)(arg2); \
347register long __res __asm__ ("r0") = (long)(arg1); \ 347register long __res __asm__ ("r0") = (long)(arg1); \
348__asm__ __volatile__ (\ 348__asm__ __volatile__ (\
349 "trap #" SYSCALL_VECTOR \ 349 "trap #" SYSCALL_VECTOR "|| nop"\
350 : "=r" (__res) \ 350 : "=r" (__res) \
351 : "r" (__scno), "0" (__res), "r" (__arg2) \ 351 : "r" (__scno), "0" (__res), "r" (__arg2) \
352 : "memory"); \ 352 : "memory"); \
@@ -361,7 +361,7 @@ register long __arg3 __asm__ ("r2") = (long)(arg3); \
361register long __arg2 __asm__ ("r1") = (long)(arg2); \ 361register long __arg2 __asm__ ("r1") = (long)(arg2); \
362register long __res __asm__ ("r0") = (long)(arg1); \ 362register long __res __asm__ ("r0") = (long)(arg1); \
363__asm__ __volatile__ (\ 363__asm__ __volatile__ (\
364 "trap #" SYSCALL_VECTOR \ 364 "trap #" SYSCALL_VECTOR "|| nop"\
365 : "=r" (__res) \ 365 : "=r" (__res) \
366 : "r" (__scno), "0" (__res), "r" (__arg2), \ 366 : "r" (__scno), "0" (__res), "r" (__arg2), \
367 "r" (__arg3) \ 367 "r" (__arg3) \
@@ -378,7 +378,7 @@ register long __arg3 __asm__ ("r2") = (long)(arg3); \
378register long __arg2 __asm__ ("r1") = (long)(arg2); \ 378register long __arg2 __asm__ ("r1") = (long)(arg2); \
379register long __res __asm__ ("r0") = (long)(arg1); \ 379register long __res __asm__ ("r0") = (long)(arg1); \
380__asm__ __volatile__ (\ 380__asm__ __volatile__ (\
381 "trap #" SYSCALL_VECTOR \ 381 "trap #" SYSCALL_VECTOR "|| nop"\
382 : "=r" (__res) \ 382 : "=r" (__res) \
383 : "r" (__scno), "0" (__res), "r" (__arg2), \ 383 : "r" (__scno), "0" (__res), "r" (__arg2), \
384 "r" (__arg3), "r" (__arg4) \ 384 "r" (__arg3), "r" (__arg4) \
@@ -397,7 +397,7 @@ register long __arg3 __asm__ ("r2") = (long)(arg3); \
397register long __arg2 __asm__ ("r1") = (long)(arg2); \ 397register long __arg2 __asm__ ("r1") = (long)(arg2); \
398register long __res __asm__ ("r0") = (long)(arg1); \ 398register long __res __asm__ ("r0") = (long)(arg1); \
399__asm__ __volatile__ (\ 399__asm__ __volatile__ (\
400 "trap #" SYSCALL_VECTOR \ 400 "trap #" SYSCALL_VECTOR "|| nop"\
401 : "=r" (__res) \ 401 : "=r" (__res) \
402 : "r" (__scno), "0" (__res), "r" (__arg2), \ 402 : "r" (__scno), "0" (__res), "r" (__arg2), \
403 "r" (__arg3), "r" (__arg4), "r" (__arg5) \ 403 "r" (__arg3), "r" (__arg4), "r" (__arg5) \
diff --git a/include/asm-m68k/atomic.h b/include/asm-m68k/atomic.h
index e3c962eeabf3..b8a4e75d679d 100644
--- a/include/asm-m68k/atomic.h
+++ b/include/asm-m68k/atomic.h
@@ -157,4 +157,5 @@ static inline void atomic_set_mask(unsigned long mask, unsigned long *v)
157#define smp_mb__before_atomic_inc() barrier() 157#define smp_mb__before_atomic_inc() barrier()
158#define smp_mb__after_atomic_inc() barrier() 158#define smp_mb__after_atomic_inc() barrier()
159 159
160#include <asm-generic/atomic.h>
160#endif /* __ARCH_M68K_ATOMIC __ */ 161#endif /* __ARCH_M68K_ATOMIC __ */
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h
index b1bcf7c66516..13f4c0048463 100644
--- a/include/asm-m68k/bitops.h
+++ b/include/asm-m68k/bitops.h
@@ -310,6 +310,7 @@ static inline int fls(int x)
310 310
311 return 32 - cnt; 311 return 32 - cnt;
312} 312}
313#define fls64(x) generic_fls64(x)
313 314
314/* 315/*
315 * Every architecture must define this function. It's the fastest 316 * Every architecture must define this function. It's the fastest
diff --git a/include/asm-m68k/irq.h b/include/asm-m68k/irq.h
index 1f569905cb74..127ad190cf2d 100644
--- a/include/asm-m68k/irq.h
+++ b/include/asm-m68k/irq.h
@@ -70,8 +70,6 @@ static __inline__ int irq_canonicalize(int irq)
70 70
71extern void (*enable_irq)(unsigned int); 71extern void (*enable_irq)(unsigned int);
72extern void (*disable_irq)(unsigned int); 72extern void (*disable_irq)(unsigned int);
73
74#define disable_irq_nosync disable_irq
75#define enable_irq_nosync enable_irq 73#define enable_irq_nosync enable_irq
76 74
77struct pt_regs; 75struct pt_regs;
diff --git a/include/asm-m68k/mman.h b/include/asm-m68k/mman.h
index f831c4eeae6e..ea262ab88b3b 100644
--- a/include/asm-m68k/mman.h
+++ b/include/asm-m68k/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-m68knommu/atomic.h b/include/asm-m68knommu/atomic.h
index 3c1cc153c415..1702dbe9318c 100644
--- a/include/asm-m68knommu/atomic.h
+++ b/include/asm-m68knommu/atomic.h
@@ -143,4 +143,5 @@ static inline int atomic_sub_return(int i, atomic_t * v)
143#define atomic_dec_return(v) atomic_sub_return(1,(v)) 143#define atomic_dec_return(v) atomic_sub_return(1,(v))
144#define atomic_inc_return(v) atomic_add_return(1,(v)) 144#define atomic_inc_return(v) atomic_add_return(1,(v))
145 145
146#include <asm-generic/atomic.h>
146#endif /* __ARCH_M68KNOMMU_ATOMIC __ */ 147#endif /* __ARCH_M68KNOMMU_ATOMIC __ */
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h
index c42f88a9b9f9..4058dd086a02 100644
--- a/include/asm-m68knommu/bitops.h
+++ b/include/asm-m68knommu/bitops.h
@@ -499,5 +499,6 @@ found_middle:
499 * fls: find last bit set. 499 * fls: find last bit set.
500 */ 500 */
501#define fls(x) generic_fls(x) 501#define fls(x) generic_fls(x)
502#define fls64(x) generic_fls64(x)
502 503
503#endif /* _M68KNOMMU_BITOPS_H */ 504#endif /* _M68KNOMMU_BITOPS_H */
diff --git a/include/asm-m68knommu/irq.h b/include/asm-m68knommu/irq.h
index a08fa9b958da..20c48ec858a4 100644
--- a/include/asm-m68knommu/irq.h
+++ b/include/asm-m68knommu/irq.h
@@ -84,10 +84,8 @@ extern void (*mach_disable_irq)(unsigned int);
84/* 84/*
85 * Some drivers want these entry points 85 * Some drivers want these entry points
86 */ 86 */
87#define enable_irq(x) (mach_enable_irq ? (*mach_enable_irq)(x) : 0) 87#define enable_irq(x) 0
88#define disable_irq(x) (mach_disable_irq ? (*mach_disable_irq)(x) : 0) 88#define disable_irq(x) do { } while (0)
89
90#define enable_irq_nosync(x) enable_irq(x)
91#define disable_irq_nosync(x) disable_irq(x) 89#define disable_irq_nosync(x) disable_irq(x)
92 90
93struct irqaction; 91struct irqaction;
diff --git a/include/asm-mips/.gitignore b/include/asm-mips/.gitignore
deleted file mode 100644
index 4ec57ad5bc3c..000000000000
--- a/include/asm-mips/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
1asm_offsets.h
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h
index 55c37c106ef0..92256e43a938 100644
--- a/include/asm-mips/atomic.h
+++ b/include/asm-mips/atomic.h
@@ -713,4 +713,5 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
713#define smp_mb__before_atomic_inc() smp_mb() 713#define smp_mb__before_atomic_inc() smp_mb()
714#define smp_mb__after_atomic_inc() smp_mb() 714#define smp_mb__after_atomic_inc() smp_mb()
715 715
716#include <asm-generic/atomic.h>
716#endif /* _ASM_ATOMIC_H */ 717#endif /* _ASM_ATOMIC_H */
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 5496f9064a6a..3b0c8aaf6e8b 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -695,7 +695,7 @@ static inline unsigned long fls(unsigned long word)
695 695
696 return flz(~word) + 1; 696 return flz(~word) + 1;
697} 697}
698 698#define fls64(x) generic_fls64(x)
699 699
700/* 700/*
701 * find_next_zero_bit - find the first zero bit in a memory region 701 * find_next_zero_bit - find the first zero bit in a memory region
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h
index 33d275c3b84c..e867b4ef96d1 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_ide.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h
@@ -74,9 +74,6 @@ typedef struct
74 u8 white_list, black_list; 74 u8 white_list, black_list;
75 struct dbdma_cmd *dma_table_cpu; 75 struct dbdma_cmd *dma_table_cpu;
76 dma_addr_t dma_table_dma; 76 dma_addr_t dma_table_dma;
77 struct scatterlist *sg_table;
78 int sg_nents;
79 int sg_dma_direction;
80#endif 77#endif
81 struct device *dev; 78 struct device *dev;
82 int irq; 79 int irq;
@@ -87,11 +84,6 @@ typedef struct
87} _auide_hwif; 84} _auide_hwif;
88 85
89#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 86#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
90struct drive_list_entry {
91 const char * id_model;
92 const char * id_firmware;
93};
94
95/* HD white list */ 87/* HD white list */
96static const struct drive_list_entry dma_white_list [] = { 88static const struct drive_list_entry dma_white_list [] = {
97/* 89/*
@@ -167,13 +159,9 @@ int __init auide_probe(void);
167 * Multi-Word DMA + DbDMA functions 159 * Multi-Word DMA + DbDMA functions
168 */ 160 */
169#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 161#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
170
171 static int in_drive_list(struct hd_driveid *id,
172 const struct drive_list_entry *drive_table);
173 static int auide_build_sglist(ide_drive_t *drive, struct request *rq); 162 static int auide_build_sglist(ide_drive_t *drive, struct request *rq);
174 static int auide_build_dmatable(ide_drive_t *drive); 163 static int auide_build_dmatable(ide_drive_t *drive);
175 static int auide_dma_end(ide_drive_t *drive); 164 static int auide_dma_end(ide_drive_t *drive);
176 static void auide_dma_start(ide_drive_t *drive );
177 ide_startstop_t auide_dma_intr (ide_drive_t *drive); 165 ide_startstop_t auide_dma_intr (ide_drive_t *drive);
178 static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command); 166 static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command);
179 static int auide_dma_setup(ide_drive_t *drive); 167 static int auide_dma_setup(ide_drive_t *drive);
@@ -188,8 +176,6 @@ int __init auide_probe(void);
188 static void auide_ddma_rx_callback(int irq, void *param, 176 static void auide_ddma_rx_callback(int irq, void *param,
189 struct pt_regs *regs); 177 struct pt_regs *regs);
190 static int auide_dma_off_quietly(ide_drive_t *drive); 178 static int auide_dma_off_quietly(ide_drive_t *drive);
191 static int auide_dma_timeout(ide_drive_t *drive);
192
193#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ 179#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
194 180
195/******************************************************************************* 181/*******************************************************************************
@@ -299,3 +285,11 @@ int __init auide_probe(void);
299#define SBC_IDE_MDMA2_TPM (0x00<<6) 285#define SBC_IDE_MDMA2_TPM (0x00<<6)
300#define SBC_IDE_MDMA2_TA (0x12<<0) 286#define SBC_IDE_MDMA2_TA (0x12<<0)
301 287
288#define SBC_IDE_TIMING(mode) \
289 SBC_IDE_##mode##_TWCS | \
290 SBC_IDE_##mode##_TCSH | \
291 SBC_IDE_##mode##_TCSOFF | \
292 SBC_IDE_##mode##_TWP | \
293 SBC_IDE_##mode##_TCSW | \
294 SBC_IDE_##mode##_TPM | \
295 SBC_IDE_##mode##_TA
diff --git a/include/asm-mips/mman.h b/include/asm-mips/mman.h
index 62060957ba93..dd17c8bd62a1 100644
--- a/include/asm-mips/mman.h
+++ b/include/asm-mips/mman.h
@@ -65,6 +65,7 @@
65#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 65#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
66#define MADV_WILLNEED 0x3 /* pre-fault pages */ 66#define MADV_WILLNEED 0x3 /* pre-fault pages */
67#define MADV_DONTNEED 0x4 /* discard these pages */ 67#define MADV_DONTNEED 0x4 /* discard these pages */
68#define MADV_REMOVE 0x5 /* remove these pages & resources */
68 69
69/* compatibility flags */ 70/* compatibility flags */
70#define MAP_ANON MAP_ANONYMOUS 71#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-mips/riscos-syscall.h b/include/asm-mips/riscos-syscall.h
deleted file mode 100644
index 4d8eb15461eb..000000000000
--- a/include/asm-mips/riscos-syscall.h
+++ /dev/null
@@ -1,979 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995, 96, 97, 98, 99, 2000 by Ralf Baechle
7 */
8#ifndef _ASM_RISCOS_SYSCALL_H
9#define _ASM_RISCOS_SYSCALL_H
10
11/*
12 * The syscalls 0 - 3999 are reserved for a down to the root syscall
13 * compatibility with RISC/os and IRIX. We'll see how to deal with the
14 * various "real" BSD variants like Ultrix, NetBSD ...
15 */
16
17/*
18 * SVR4 syscalls are in the range from 1 to 999
19 */
20#define __NR_SVR4 0
21#define __NR_SVR4_syscall (__NR_SVR4 + 0)
22#define __NR_SVR4_exit (__NR_SVR4 + 1)
23#define __NR_SVR4_fork (__NR_SVR4 + 2)
24#define __NR_SVR4_read (__NR_SVR4 + 3)
25#define __NR_SVR4_write (__NR_SVR4 + 4)
26#define __NR_SVR4_open (__NR_SVR4 + 5)
27#define __NR_SVR4_close (__NR_SVR4 + 6)
28#define __NR_SVR4_wait (__NR_SVR4 + 7)
29#define __NR_SVR4_creat (__NR_SVR4 + 8)
30#define __NR_SVR4_link (__NR_SVR4 + 9)
31#define __NR_SVR4_unlink (__NR_SVR4 + 10)
32#define __NR_SVR4_exec (__NR_SVR4 + 11)
33#define __NR_SVR4_chdir (__NR_SVR4 + 12)
34#define __NR_SVR4_gtime (__NR_SVR4 + 13)
35#define __NR_SVR4_mknod (__NR_SVR4 + 14)
36#define __NR_SVR4_chmod (__NR_SVR4 + 15)
37#define __NR_SVR4_chown (__NR_SVR4 + 16)
38#define __NR_SVR4_sbreak (__NR_SVR4 + 17)
39#define __NR_SVR4_stat (__NR_SVR4 + 18)
40#define __NR_SVR4_lseek (__NR_SVR4 + 19)
41#define __NR_SVR4_getpid (__NR_SVR4 + 20)
42#define __NR_SVR4_mount (__NR_SVR4 + 21)
43#define __NR_SVR4_umount (__NR_SVR4 + 22)
44#define __NR_SVR4_setuid (__NR_SVR4 + 23)
45#define __NR_SVR4_getuid (__NR_SVR4 + 24)
46#define __NR_SVR4_stime (__NR_SVR4 + 25)
47#define __NR_SVR4_ptrace (__NR_SVR4 + 26)
48#define __NR_SVR4_alarm (__NR_SVR4 + 27)
49#define __NR_SVR4_fstat (__NR_SVR4 + 28)
50#define __NR_SVR4_pause (__NR_SVR4 + 29)
51#define __NR_SVR4_utime (__NR_SVR4 + 30)
52#define __NR_SVR4_stty (__NR_SVR4 + 31)
53#define __NR_SVR4_gtty (__NR_SVR4 + 32)
54#define __NR_SVR4_access (__NR_SVR4 + 33)
55#define __NR_SVR4_nice (__NR_SVR4 + 34)
56#define __NR_SVR4_statfs (__NR_SVR4 + 35)
57#define __NR_SVR4_sync (__NR_SVR4 + 36)
58#define __NR_SVR4_kill (__NR_SVR4 + 37)
59#define __NR_SVR4_fstatfs (__NR_SVR4 + 38)
60#define __NR_SVR4_setpgrp (__NR_SVR4 + 39)
61#define __NR_SVR4_cxenix (__NR_SVR4 + 40)
62#define __NR_SVR4_dup (__NR_SVR4 + 41)
63#define __NR_SVR4_pipe (__NR_SVR4 + 42)
64#define __NR_SVR4_times (__NR_SVR4 + 43)
65#define __NR_SVR4_profil (__NR_SVR4 + 44)
66#define __NR_SVR4_plock (__NR_SVR4 + 45)
67#define __NR_SVR4_setgid (__NR_SVR4 + 46)
68#define __NR_SVR4_getgid (__NR_SVR4 + 47)
69#define __NR_SVR4_sig (__NR_SVR4 + 48)
70#define __NR_SVR4_msgsys (__NR_SVR4 + 49)
71#define __NR_SVR4_sysmips (__NR_SVR4 + 50)
72#define __NR_SVR4_sysacct (__NR_SVR4 + 51)
73#define __NR_SVR4_shmsys (__NR_SVR4 + 52)
74#define __NR_SVR4_semsys (__NR_SVR4 + 53)
75#define __NR_SVR4_ioctl (__NR_SVR4 + 54)
76#define __NR_SVR4_uadmin (__NR_SVR4 + 55)
77#define __NR_SVR4_exch (__NR_SVR4 + 56)
78#define __NR_SVR4_utssys (__NR_SVR4 + 57)
79#define __NR_SVR4_fsync (__NR_SVR4 + 58)
80#define __NR_SVR4_exece (__NR_SVR4 + 59)
81#define __NR_SVR4_umask (__NR_SVR4 + 60)
82#define __NR_SVR4_chroot (__NR_SVR4 + 61)
83#define __NR_SVR4_fcntl (__NR_SVR4 + 62)
84#define __NR_SVR4_ulimit (__NR_SVR4 + 63)
85#define __NR_SVR4_reserved1 (__NR_SVR4 + 64)
86#define __NR_SVR4_reserved2 (__NR_SVR4 + 65)
87#define __NR_SVR4_reserved3 (__NR_SVR4 + 66)
88#define __NR_SVR4_reserved4 (__NR_SVR4 + 67)
89#define __NR_SVR4_reserved5 (__NR_SVR4 + 68)
90#define __NR_SVR4_reserved6 (__NR_SVR4 + 69)
91#define __NR_SVR4_advfs (__NR_SVR4 + 70)
92#define __NR_SVR4_unadvfs (__NR_SVR4 + 71)
93#define __NR_SVR4_unused1 (__NR_SVR4 + 72)
94#define __NR_SVR4_unused2 (__NR_SVR4 + 73)
95#define __NR_SVR4_rfstart (__NR_SVR4 + 74)
96#define __NR_SVR4_unused3 (__NR_SVR4 + 75)
97#define __NR_SVR4_rdebug (__NR_SVR4 + 76)
98#define __NR_SVR4_rfstop (__NR_SVR4 + 77)
99#define __NR_SVR4_rfsys (__NR_SVR4 + 78)
100#define __NR_SVR4_rmdir (__NR_SVR4 + 79)
101#define __NR_SVR4_mkdir (__NR_SVR4 + 80)
102#define __NR_SVR4_getdents (__NR_SVR4 + 81)
103#define __NR_SVR4_libattach (__NR_SVR4 + 82)
104#define __NR_SVR4_libdetach (__NR_SVR4 + 83)
105#define __NR_SVR4_sysfs (__NR_SVR4 + 84)
106#define __NR_SVR4_getmsg (__NR_SVR4 + 85)
107#define __NR_SVR4_putmsg (__NR_SVR4 + 86)
108#define __NR_SVR4_poll (__NR_SVR4 + 87)
109#define __NR_SVR4_lstat (__NR_SVR4 + 88)
110#define __NR_SVR4_symlink (__NR_SVR4 + 89)
111#define __NR_SVR4_readlink (__NR_SVR4 + 90)
112#define __NR_SVR4_setgroups (__NR_SVR4 + 91)
113#define __NR_SVR4_getgroups (__NR_SVR4 + 92)
114#define __NR_SVR4_fchmod (__NR_SVR4 + 93)
115#define __NR_SVR4_fchown (__NR_SVR4 + 94)
116#define __NR_SVR4_sigprocmask (__NR_SVR4 + 95)
117#define __NR_SVR4_sigsuspend (__NR_SVR4 + 96)
118#define __NR_SVR4_sigaltstack (__NR_SVR4 + 97)
119#define __NR_SVR4_sigaction (__NR_SVR4 + 98)
120#define __NR_SVR4_sigpending (__NR_SVR4 + 99)
121#define __NR_SVR4_setcontext (__NR_SVR4 + 100)
122#define __NR_SVR4_evsys (__NR_SVR4 + 101)
123#define __NR_SVR4_evtrapret (__NR_SVR4 + 102)
124#define __NR_SVR4_statvfs (__NR_SVR4 + 103)
125#define __NR_SVR4_fstatvfs (__NR_SVR4 + 104)
126#define __NR_SVR4_reserved7 (__NR_SVR4 + 105)
127#define __NR_SVR4_nfssys (__NR_SVR4 + 106)
128#define __NR_SVR4_waitid (__NR_SVR4 + 107)
129#define __NR_SVR4_sigsendset (__NR_SVR4 + 108)
130#define __NR_SVR4_hrtsys (__NR_SVR4 + 109)
131#define __NR_SVR4_acancel (__NR_SVR4 + 110)
132#define __NR_SVR4_async (__NR_SVR4 + 111)
133#define __NR_SVR4_priocntlset (__NR_SVR4 + 112)
134#define __NR_SVR4_pathconf (__NR_SVR4 + 113)
135#define __NR_SVR4_mincore (__NR_SVR4 + 114)
136#define __NR_SVR4_mmap (__NR_SVR4 + 115)
137#define __NR_SVR4_mprotect (__NR_SVR4 + 116)
138#define __NR_SVR4_munmap (__NR_SVR4 + 117)
139#define __NR_SVR4_fpathconf (__NR_SVR4 + 118)
140#define __NR_SVR4_vfork (__NR_SVR4 + 119)
141#define __NR_SVR4_fchdir (__NR_SVR4 + 120)
142#define __NR_SVR4_readv (__NR_SVR4 + 121)
143#define __NR_SVR4_writev (__NR_SVR4 + 122)
144#define __NR_SVR4_xstat (__NR_SVR4 + 123)
145#define __NR_SVR4_lxstat (__NR_SVR4 + 124)
146#define __NR_SVR4_fxstat (__NR_SVR4 + 125)
147#define __NR_SVR4_xmknod (__NR_SVR4 + 126)
148#define __NR_SVR4_clocal (__NR_SVR4 + 127)
149#define __NR_SVR4_setrlimit (__NR_SVR4 + 128)
150#define __NR_SVR4_getrlimit (__NR_SVR4 + 129)
151#define __NR_SVR4_lchown (__NR_SVR4 + 130)
152#define __NR_SVR4_memcntl (__NR_SVR4 + 131)
153#define __NR_SVR4_getpmsg (__NR_SVR4 + 132)
154#define __NR_SVR4_putpmsg (__NR_SVR4 + 133)
155#define __NR_SVR4_rename (__NR_SVR4 + 134)
156#define __NR_SVR4_nuname (__NR_SVR4 + 135)
157#define __NR_SVR4_setegid (__NR_SVR4 + 136)
158#define __NR_SVR4_sysconf (__NR_SVR4 + 137)
159#define __NR_SVR4_adjtime (__NR_SVR4 + 138)
160#define __NR_SVR4_sysinfo (__NR_SVR4 + 139)
161#define __NR_SVR4_reserved8 (__NR_SVR4 + 140)
162#define __NR_SVR4_seteuid (__NR_SVR4 + 141)
163#define __NR_SVR4_PYRAMID_statis (__NR_SVR4 + 142)
164#define __NR_SVR4_PYRAMID_tuning (__NR_SVR4 + 143)
165#define __NR_SVR4_PYRAMID_forcerr (__NR_SVR4 + 144)
166#define __NR_SVR4_PYRAMID_mpcntl (__NR_SVR4 + 145)
167#define __NR_SVR4_reserved9 (__NR_SVR4 + 146)
168#define __NR_SVR4_reserved10 (__NR_SVR4 + 147)
169#define __NR_SVR4_reserved11 (__NR_SVR4 + 148)
170#define __NR_SVR4_reserved12 (__NR_SVR4 + 149)
171#define __NR_SVR4_reserved13 (__NR_SVR4 + 150)
172#define __NR_SVR4_reserved14 (__NR_SVR4 + 151)
173#define __NR_SVR4_reserved15 (__NR_SVR4 + 152)
174#define __NR_SVR4_reserved16 (__NR_SVR4 + 153)
175#define __NR_SVR4_reserved17 (__NR_SVR4 + 154)
176#define __NR_SVR4_reserved18 (__NR_SVR4 + 155)
177#define __NR_SVR4_reserved19 (__NR_SVR4 + 156)
178#define __NR_SVR4_reserved20 (__NR_SVR4 + 157)
179#define __NR_SVR4_reserved21 (__NR_SVR4 + 158)
180#define __NR_SVR4_reserved22 (__NR_SVR4 + 159)
181#define __NR_SVR4_reserved23 (__NR_SVR4 + 160)
182#define __NR_SVR4_reserved24 (__NR_SVR4 + 161)
183#define __NR_SVR4_reserved25 (__NR_SVR4 + 162)
184#define __NR_SVR4_reserved26 (__NR_SVR4 + 163)
185#define __NR_SVR4_reserved27 (__NR_SVR4 + 164)
186#define __NR_SVR4_reserved28 (__NR_SVR4 + 165)
187#define __NR_SVR4_reserved29 (__NR_SVR4 + 166)
188#define __NR_SVR4_reserved30 (__NR_SVR4 + 167)
189#define __NR_SVR4_reserved31 (__NR_SVR4 + 168)
190#define __NR_SVR4_reserved32 (__NR_SVR4 + 169)
191#define __NR_SVR4_reserved33 (__NR_SVR4 + 170)
192#define __NR_SVR4_reserved34 (__NR_SVR4 + 171)
193#define __NR_SVR4_reserved35 (__NR_SVR4 + 172)
194#define __NR_SVR4_reserved36 (__NR_SVR4 + 173)
195#define __NR_SVR4_reserved37 (__NR_SVR4 + 174)
196#define __NR_SVR4_reserved38 (__NR_SVR4 + 175)
197#define __NR_SVR4_reserved39 (__NR_SVR4 + 176)
198#define __NR_SVR4_reserved40 (__NR_SVR4 + 177)
199#define __NR_SVR4_reserved41 (__NR_SVR4 + 178)
200#define __NR_SVR4_reserved42 (__NR_SVR4 + 179)
201#define __NR_SVR4_reserved43 (__NR_SVR4 + 180)
202#define __NR_SVR4_reserved44 (__NR_SVR4 + 181)
203#define __NR_SVR4_reserved45 (__NR_SVR4 + 182)
204#define __NR_SVR4_reserved46 (__NR_SVR4 + 183)
205#define __NR_SVR4_reserved47 (__NR_SVR4 + 184)
206#define __NR_SVR4_reserved48 (__NR_SVR4 + 185)
207#define __NR_SVR4_reserved49 (__NR_SVR4 + 186)
208#define __NR_SVR4_reserved50 (__NR_SVR4 + 187)
209#define __NR_SVR4_reserved51 (__NR_SVR4 + 188)
210#define __NR_SVR4_reserved52 (__NR_SVR4 + 189)
211#define __NR_SVR4_reserved53 (__NR_SVR4 + 190)
212#define __NR_SVR4_reserved54 (__NR_SVR4 + 191)
213#define __NR_SVR4_reserved55 (__NR_SVR4 + 192)
214#define __NR_SVR4_reserved56 (__NR_SVR4 + 193)
215#define __NR_SVR4_reserved57 (__NR_SVR4 + 194)
216#define __NR_SVR4_reserved58 (__NR_SVR4 + 195)
217#define __NR_SVR4_reserved59 (__NR_SVR4 + 196)
218#define __NR_SVR4_reserved60 (__NR_SVR4 + 197)
219#define __NR_SVR4_reserved61 (__NR_SVR4 + 198)
220#define __NR_SVR4_reserved62 (__NR_SVR4 + 199)
221#define __NR_SVR4_reserved63 (__NR_SVR4 + 200)
222#define __NR_SVR4_aread (__NR_SVR4 + 201)
223#define __NR_SVR4_awrite (__NR_SVR4 + 202)
224#define __NR_SVR4_listio (__NR_SVR4 + 203)
225#define __NR_SVR4_mips_acancel (__NR_SVR4 + 204)
226#define __NR_SVR4_astatus (__NR_SVR4 + 205)
227#define __NR_SVR4_await (__NR_SVR4 + 206)
228#define __NR_SVR4_areadv (__NR_SVR4 + 207)
229#define __NR_SVR4_awritev (__NR_SVR4 + 208)
230#define __NR_SVR4_MIPS_reserved1 (__NR_SVR4 + 209)
231#define __NR_SVR4_MIPS_reserved2 (__NR_SVR4 + 210)
232#define __NR_SVR4_MIPS_reserved3 (__NR_SVR4 + 211)
233#define __NR_SVR4_MIPS_reserved4 (__NR_SVR4 + 212)
234#define __NR_SVR4_MIPS_reserved5 (__NR_SVR4 + 213)
235#define __NR_SVR4_MIPS_reserved6 (__NR_SVR4 + 214)
236#define __NR_SVR4_MIPS_reserved7 (__NR_SVR4 + 215)
237#define __NR_SVR4_MIPS_reserved8 (__NR_SVR4 + 216)
238#define __NR_SVR4_MIPS_reserved9 (__NR_SVR4 + 217)
239#define __NR_SVR4_MIPS_reserved10 (__NR_SVR4 + 218)
240#define __NR_SVR4_MIPS_reserved11 (__NR_SVR4 + 219)
241#define __NR_SVR4_MIPS_reserved12 (__NR_SVR4 + 220)
242#define __NR_SVR4_CDC_reserved1 (__NR_SVR4 + 221)
243#define __NR_SVR4_CDC_reserved2 (__NR_SVR4 + 222)
244#define __NR_SVR4_CDC_reserved3 (__NR_SVR4 + 223)
245#define __NR_SVR4_CDC_reserved4 (__NR_SVR4 + 224)
246#define __NR_SVR4_CDC_reserved5 (__NR_SVR4 + 225)
247#define __NR_SVR4_CDC_reserved6 (__NR_SVR4 + 226)
248#define __NR_SVR4_CDC_reserved7 (__NR_SVR4 + 227)
249#define __NR_SVR4_CDC_reserved8 (__NR_SVR4 + 228)
250#define __NR_SVR4_CDC_reserved9 (__NR_SVR4 + 229)
251#define __NR_SVR4_CDC_reserved10 (__NR_SVR4 + 230)
252#define __NR_SVR4_CDC_reserved11 (__NR_SVR4 + 231)
253#define __NR_SVR4_CDC_reserved12 (__NR_SVR4 + 232)
254#define __NR_SVR4_CDC_reserved13 (__NR_SVR4 + 233)
255#define __NR_SVR4_CDC_reserved14 (__NR_SVR4 + 234)
256#define __NR_SVR4_CDC_reserved15 (__NR_SVR4 + 235)
257#define __NR_SVR4_CDC_reserved16 (__NR_SVR4 + 236)
258#define __NR_SVR4_CDC_reserved17 (__NR_SVR4 + 237)
259#define __NR_SVR4_CDC_reserved18 (__NR_SVR4 + 238)
260#define __NR_SVR4_CDC_reserved19 (__NR_SVR4 + 239)
261#define __NR_SVR4_CDC_reserved20 (__NR_SVR4 + 240)
262
263/*
264 * SYS V syscalls are in the range from 1000 to 1999
265 */
266#define __NR_SYSV 1000
267#define __NR_SYSV_syscall (__NR_SYSV + 0)
268#define __NR_SYSV_exit (__NR_SYSV + 1)
269#define __NR_SYSV_fork (__NR_SYSV + 2)
270#define __NR_SYSV_read (__NR_SYSV + 3)
271#define __NR_SYSV_write (__NR_SYSV + 4)
272#define __NR_SYSV_open (__NR_SYSV + 5)
273#define __NR_SYSV_close (__NR_SYSV + 6)
274#define __NR_SYSV_wait (__NR_SYSV + 7)
275#define __NR_SYSV_creat (__NR_SYSV + 8)
276#define __NR_SYSV_link (__NR_SYSV + 9)
277#define __NR_SYSV_unlink (__NR_SYSV + 10)
278#define __NR_SYSV_execv (__NR_SYSV + 11)
279#define __NR_SYSV_chdir (__NR_SYSV + 12)
280#define __NR_SYSV_time (__NR_SYSV + 13)
281#define __NR_SYSV_mknod (__NR_SYSV + 14)
282#define __NR_SYSV_chmod (__NR_SYSV + 15)
283#define __NR_SYSV_chown (__NR_SYSV + 16)
284#define __NR_SYSV_brk (__NR_SYSV + 17)
285#define __NR_SYSV_stat (__NR_SYSV + 18)
286#define __NR_SYSV_lseek (__NR_SYSV + 19)
287#define __NR_SYSV_getpid (__NR_SYSV + 20)
288#define __NR_SYSV_mount (__NR_SYSV + 21)
289#define __NR_SYSV_umount (__NR_SYSV + 22)
290#define __NR_SYSV_setuid (__NR_SYSV + 23)
291#define __NR_SYSV_getuid (__NR_SYSV + 24)
292#define __NR_SYSV_stime (__NR_SYSV + 25)
293#define __NR_SYSV_ptrace (__NR_SYSV + 26)
294#define __NR_SYSV_alarm (__NR_SYSV + 27)
295#define __NR_SYSV_fstat (__NR_SYSV + 28)
296#define __NR_SYSV_pause (__NR_SYSV + 29)
297#define __NR_SYSV_utime (__NR_SYSV + 30)
298#define __NR_SYSV_stty (__NR_SYSV + 31)
299#define __NR_SYSV_gtty (__NR_SYSV + 32)
300#define __NR_SYSV_access (__NR_SYSV + 33)
301#define __NR_SYSV_nice (__NR_SYSV + 34)
302#define __NR_SYSV_statfs (__NR_SYSV + 35)
303#define __NR_SYSV_sync (__NR_SYSV + 36)
304#define __NR_SYSV_kill (__NR_SYSV + 37)
305#define __NR_SYSV_fstatfs (__NR_SYSV + 38)
306#define __NR_SYSV_setpgrp (__NR_SYSV + 39)
307#define __NR_SYSV_syssgi (__NR_SYSV + 40)
308#define __NR_SYSV_dup (__NR_SYSV + 41)
309#define __NR_SYSV_pipe (__NR_SYSV + 42)
310#define __NR_SYSV_times (__NR_SYSV + 43)
311#define __NR_SYSV_profil (__NR_SYSV + 44)
312#define __NR_SYSV_plock (__NR_SYSV + 45)
313#define __NR_SYSV_setgid (__NR_SYSV + 46)
314#define __NR_SYSV_getgid (__NR_SYSV + 47)
315#define __NR_SYSV_sig (__NR_SYSV + 48)
316#define __NR_SYSV_msgsys (__NR_SYSV + 49)
317#define __NR_SYSV_sysmips (__NR_SYSV + 50)
318#define __NR_SYSV_acct (__NR_SYSV + 51)
319#define __NR_SYSV_shmsys (__NR_SYSV + 52)
320#define __NR_SYSV_semsys (__NR_SYSV + 53)
321#define __NR_SYSV_ioctl (__NR_SYSV + 54)
322#define __NR_SYSV_uadmin (__NR_SYSV + 55)
323#define __NR_SYSV_sysmp (__NR_SYSV + 56)
324#define __NR_SYSV_utssys (__NR_SYSV + 57)
325#define __NR_SYSV_USG_reserved1 (__NR_SYSV + 58)
326#define __NR_SYSV_execve (__NR_SYSV + 59)
327#define __NR_SYSV_umask (__NR_SYSV + 60)
328#define __NR_SYSV_chroot (__NR_SYSV + 61)
329#define __NR_SYSV_fcntl (__NR_SYSV + 62)
330#define __NR_SYSV_ulimit (__NR_SYSV + 63)
331#define __NR_SYSV_SAFARI4_reserved1 (__NR_SYSV + 64)
332#define __NR_SYSV_SAFARI4_reserved2 (__NR_SYSV + 65)
333#define __NR_SYSV_SAFARI4_reserved3 (__NR_SYSV + 66)
334#define __NR_SYSV_SAFARI4_reserved4 (__NR_SYSV + 67)
335#define __NR_SYSV_SAFARI4_reserved5 (__NR_SYSV + 68)
336#define __NR_SYSV_SAFARI4_reserved6 (__NR_SYSV + 69)
337#define __NR_SYSV_advfs (__NR_SYSV + 70)
338#define __NR_SYSV_unadvfs (__NR_SYSV + 71)
339#define __NR_SYSV_rmount (__NR_SYSV + 72)
340#define __NR_SYSV_rumount (__NR_SYSV + 73)
341#define __NR_SYSV_rfstart (__NR_SYSV + 74)
342#define __NR_SYSV_getrlimit64 (__NR_SYSV + 75)
343#define __NR_SYSV_setrlimit64 (__NR_SYSV + 76)
344#define __NR_SYSV_nanosleep (__NR_SYSV + 77)
345#define __NR_SYSV_lseek64 (__NR_SYSV + 78)
346#define __NR_SYSV_rmdir (__NR_SYSV + 79)
347#define __NR_SYSV_mkdir (__NR_SYSV + 80)
348#define __NR_SYSV_getdents (__NR_SYSV + 81)
349#define __NR_SYSV_sginap (__NR_SYSV + 82)
350#define __NR_SYSV_sgikopt (__NR_SYSV + 83)
351#define __NR_SYSV_sysfs (__NR_SYSV + 84)
352#define __NR_SYSV_getmsg (__NR_SYSV + 85)
353#define __NR_SYSV_putmsg (__NR_SYSV + 86)
354#define __NR_SYSV_poll (__NR_SYSV + 87)
355#define __NR_SYSV_sigreturn (__NR_SYSV + 88)
356#define __NR_SYSV_accept (__NR_SYSV + 89)
357#define __NR_SYSV_bind (__NR_SYSV + 90)
358#define __NR_SYSV_connect (__NR_SYSV + 91)
359#define __NR_SYSV_gethostid (__NR_SYSV + 92)
360#define __NR_SYSV_getpeername (__NR_SYSV + 93)
361#define __NR_SYSV_getsockname (__NR_SYSV + 94)
362#define __NR_SYSV_getsockopt (__NR_SYSV + 95)
363#define __NR_SYSV_listen (__NR_SYSV + 96)
364#define __NR_SYSV_recv (__NR_SYSV + 97)
365#define __NR_SYSV_recvfrom (__NR_SYSV + 98)
366#define __NR_SYSV_recvmsg (__NR_SYSV + 99)
367#define __NR_SYSV_select (__NR_SYSV + 100)
368#define __NR_SYSV_send (__NR_SYSV + 101)
369#define __NR_SYSV_sendmsg (__NR_SYSV + 102)
370#define __NR_SYSV_sendto (__NR_SYSV + 103)
371#define __NR_SYSV_sethostid (__NR_SYSV + 104)
372#define __NR_SYSV_setsockopt (__NR_SYSV + 105)
373#define __NR_SYSV_shutdown (__NR_SYSV + 106)
374#define __NR_SYSV_socket (__NR_SYSV + 107)
375#define __NR_SYSV_gethostname (__NR_SYSV + 108)
376#define __NR_SYSV_sethostname (__NR_SYSV + 109)
377#define __NR_SYSV_getdomainname (__NR_SYSV + 110)
378#define __NR_SYSV_setdomainname (__NR_SYSV + 111)
379#define __NR_SYSV_truncate (__NR_SYSV + 112)
380#define __NR_SYSV_ftruncate (__NR_SYSV + 113)
381#define __NR_SYSV_rename (__NR_SYSV + 114)
382#define __NR_SYSV_symlink (__NR_SYSV + 115)
383#define __NR_SYSV_readlink (__NR_SYSV + 116)
384#define __NR_SYSV_lstat (__NR_SYSV + 117)
385#define __NR_SYSV_nfsmount (__NR_SYSV + 118)
386#define __NR_SYSV_nfssvc (__NR_SYSV + 119)
387#define __NR_SYSV_getfh (__NR_SYSV + 120)
388#define __NR_SYSV_async_daemon (__NR_SYSV + 121)
389#define __NR_SYSV_exportfs (__NR_SYSV + 122)
390#define __NR_SYSV_setregid (__NR_SYSV + 123)
391#define __NR_SYSV_setreuid (__NR_SYSV + 124)
392#define __NR_SYSV_getitimer (__NR_SYSV + 125)
393#define __NR_SYSV_setitimer (__NR_SYSV + 126)
394#define __NR_SYSV_adjtime (__NR_SYSV + 127)
395#define __NR_SYSV_BSD_getime (__NR_SYSV + 128)
396#define __NR_SYSV_sproc (__NR_SYSV + 129)
397#define __NR_SYSV_prctl (__NR_SYSV + 130)
398#define __NR_SYSV_procblk (__NR_SYSV + 131)
399#define __NR_SYSV_sprocsp (__NR_SYSV + 132)
400#define __NR_SYSV_sgigsc (__NR_SYSV + 133)
401#define __NR_SYSV_mmap (__NR_SYSV + 134)
402#define __NR_SYSV_munmap (__NR_SYSV + 135)
403#define __NR_SYSV_mprotect (__NR_SYSV + 136)
404#define __NR_SYSV_msync (__NR_SYSV + 137)
405#define __NR_SYSV_madvise (__NR_SYSV + 138)
406#define __NR_SYSV_pagelock (__NR_SYSV + 139)
407#define __NR_SYSV_getpagesize (__NR_SYSV + 140)
408#define __NR_SYSV_quotactl (__NR_SYSV + 141)
409#define __NR_SYSV_libdetach (__NR_SYSV + 142)
410#define __NR_SYSV_BSDgetpgrp (__NR_SYSV + 143)
411#define __NR_SYSV_BSDsetpgrp (__NR_SYSV + 144)
412#define __NR_SYSV_vhangup (__NR_SYSV + 145)
413#define __NR_SYSV_fsync (__NR_SYSV + 146)
414#define __NR_SYSV_fchdir (__NR_SYSV + 147)
415#define __NR_SYSV_getrlimit (__NR_SYSV + 148)
416#define __NR_SYSV_setrlimit (__NR_SYSV + 149)
417#define __NR_SYSV_cacheflush (__NR_SYSV + 150)
418#define __NR_SYSV_cachectl (__NR_SYSV + 151)
419#define __NR_SYSV_fchown (__NR_SYSV + 152)
420#define __NR_SYSV_fchmod (__NR_SYSV + 153)
421#define __NR_SYSV_wait3 (__NR_SYSV + 154)
422#define __NR_SYSV_socketpair (__NR_SYSV + 155)
423#define __NR_SYSV_sysinfo (__NR_SYSV + 156)
424#define __NR_SYSV_nuname (__NR_SYSV + 157)
425#define __NR_SYSV_xstat (__NR_SYSV + 158)
426#define __NR_SYSV_lxstat (__NR_SYSV + 159)
427#define __NR_SYSV_fxstat (__NR_SYSV + 160)
428#define __NR_SYSV_xmknod (__NR_SYSV + 161)
429#define __NR_SYSV_ksigaction (__NR_SYSV + 162)
430#define __NR_SYSV_sigpending (__NR_SYSV + 163)
431#define __NR_SYSV_sigprocmask (__NR_SYSV + 164)
432#define __NR_SYSV_sigsuspend (__NR_SYSV + 165)
433#define __NR_SYSV_sigpoll (__NR_SYSV + 166)
434#define __NR_SYSV_swapctl (__NR_SYSV + 167)
435#define __NR_SYSV_getcontext (__NR_SYSV + 168)
436#define __NR_SYSV_setcontext (__NR_SYSV + 169)
437#define __NR_SYSV_waitsys (__NR_SYSV + 170)
438#define __NR_SYSV_sigstack (__NR_SYSV + 171)
439#define __NR_SYSV_sigaltstack (__NR_SYSV + 172)
440#define __NR_SYSV_sigsendset (__NR_SYSV + 173)
441#define __NR_SYSV_statvfs (__NR_SYSV + 174)
442#define __NR_SYSV_fstatvfs (__NR_SYSV + 175)
443#define __NR_SYSV_getpmsg (__NR_SYSV + 176)
444#define __NR_SYSV_putpmsg (__NR_SYSV + 177)
445#define __NR_SYSV_lchown (__NR_SYSV + 178)
446#define __NR_SYSV_priocntl (__NR_SYSV + 179)
447#define __NR_SYSV_ksigqueue (__NR_SYSV + 180)
448#define __NR_SYSV_readv (__NR_SYSV + 181)
449#define __NR_SYSV_writev (__NR_SYSV + 182)
450#define __NR_SYSV_truncate64 (__NR_SYSV + 183)
451#define __NR_SYSV_ftruncate64 (__NR_SYSV + 184)
452#define __NR_SYSV_mmap64 (__NR_SYSV + 185)
453#define __NR_SYSV_dmi (__NR_SYSV + 186)
454#define __NR_SYSV_pread (__NR_SYSV + 187)
455#define __NR_SYSV_pwrite (__NR_SYSV + 188)
456
457/*
458 * BSD 4.3 syscalls are in the range from 2000 to 2999
459 */
460#define __NR_BSD43 2000
461#define __NR_BSD43_syscall (__NR_BSD43 + 0)
462#define __NR_BSD43_exit (__NR_BSD43 + 1)
463#define __NR_BSD43_fork (__NR_BSD43 + 2)
464#define __NR_BSD43_read (__NR_BSD43 + 3)
465#define __NR_BSD43_write (__NR_BSD43 + 4)
466#define __NR_BSD43_open (__NR_BSD43 + 5)
467#define __NR_BSD43_close (__NR_BSD43 + 6)
468#define __NR_BSD43_wait (__NR_BSD43 + 7)
469#define __NR_BSD43_creat (__NR_BSD43 + 8)
470#define __NR_BSD43_link (__NR_BSD43 + 9)
471#define __NR_BSD43_unlink (__NR_BSD43 + 10)
472#define __NR_BSD43_exec (__NR_BSD43 + 11)
473#define __NR_BSD43_chdir (__NR_BSD43 + 12)
474#define __NR_BSD43_time (__NR_BSD43 + 13)
475#define __NR_BSD43_mknod (__NR_BSD43 + 14)
476#define __NR_BSD43_chmod (__NR_BSD43 + 15)
477#define __NR_BSD43_chown (__NR_BSD43 + 16)
478#define __NR_BSD43_sbreak (__NR_BSD43 + 17)
479#define __NR_BSD43_oldstat (__NR_BSD43 + 18)
480#define __NR_BSD43_lseek (__NR_BSD43 + 19)
481#define __NR_BSD43_getpid (__NR_BSD43 + 20)
482#define __NR_BSD43_oldmount (__NR_BSD43 + 21)
483#define __NR_BSD43_umount (__NR_BSD43 + 22)
484#define __NR_BSD43_setuid (__NR_BSD43 + 23)
485#define __NR_BSD43_getuid (__NR_BSD43 + 24)
486#define __NR_BSD43_stime (__NR_BSD43 + 25)
487#define __NR_BSD43_ptrace (__NR_BSD43 + 26)
488#define __NR_BSD43_alarm (__NR_BSD43 + 27)
489#define __NR_BSD43_oldfstat (__NR_BSD43 + 28)
490#define __NR_BSD43_pause (__NR_BSD43 + 29)
491#define __NR_BSD43_utime (__NR_BSD43 + 30)
492#define __NR_BSD43_stty (__NR_BSD43 + 31)
493#define __NR_BSD43_gtty (__NR_BSD43 + 32)
494#define __NR_BSD43_access (__NR_BSD43 + 33)
495#define __NR_BSD43_nice (__NR_BSD43 + 34)
496#define __NR_BSD43_ftime (__NR_BSD43 + 35)
497#define __NR_BSD43_sync (__NR_BSD43 + 36)
498#define __NR_BSD43_kill (__NR_BSD43 + 37)
499#define __NR_BSD43_stat (__NR_BSD43 + 38)
500#define __NR_BSD43_oldsetpgrp (__NR_BSD43 + 39)
501#define __NR_BSD43_lstat (__NR_BSD43 + 40)
502#define __NR_BSD43_dup (__NR_BSD43 + 41)
503#define __NR_BSD43_pipe (__NR_BSD43 + 42)
504#define __NR_BSD43_times (__NR_BSD43 + 43)
505#define __NR_BSD43_profil (__NR_BSD43 + 44)
506#define __NR_BSD43_msgsys (__NR_BSD43 + 45)
507#define __NR_BSD43_setgid (__NR_BSD43 + 46)
508#define __NR_BSD43_getgid (__NR_BSD43 + 47)
509#define __NR_BSD43_ssig (__NR_BSD43 + 48)
510#define __NR_BSD43_reserved1 (__NR_BSD43 + 49)
511#define __NR_BSD43_reserved2 (__NR_BSD43 + 50)
512#define __NR_BSD43_sysacct (__NR_BSD43 + 51)
513#define __NR_BSD43_phys (__NR_BSD43 + 52)
514#define __NR_BSD43_lock (__NR_BSD43 + 53)
515#define __NR_BSD43_ioctl (__NR_BSD43 + 54)
516#define __NR_BSD43_reboot (__NR_BSD43 + 55)
517#define __NR_BSD43_mpxchan (__NR_BSD43 + 56)
518#define __NR_BSD43_symlink (__NR_BSD43 + 57)
519#define __NR_BSD43_readlink (__NR_BSD43 + 58)
520#define __NR_BSD43_execve (__NR_BSD43 + 59)
521#define __NR_BSD43_umask (__NR_BSD43 + 60)
522#define __NR_BSD43_chroot (__NR_BSD43 + 61)
523#define __NR_BSD43_fstat (__NR_BSD43 + 62)
524#define __NR_BSD43_reserved3 (__NR_BSD43 + 63)
525#define __NR_BSD43_getpagesize (__NR_BSD43 + 64)
526#define __NR_BSD43_mremap (__NR_BSD43 + 65)
527#define __NR_BSD43_vfork (__NR_BSD43 + 66)
528#define __NR_BSD43_vread (__NR_BSD43 + 67)
529#define __NR_BSD43_vwrite (__NR_BSD43 + 68)
530#define __NR_BSD43_sbrk (__NR_BSD43 + 69)
531#define __NR_BSD43_sstk (__NR_BSD43 + 70)
532#define __NR_BSD43_mmap (__NR_BSD43 + 71)
533#define __NR_BSD43_vadvise (__NR_BSD43 + 72)
534#define __NR_BSD43_munmap (__NR_BSD43 + 73)
535#define __NR_BSD43_mprotect (__NR_BSD43 + 74)
536#define __NR_BSD43_madvise (__NR_BSD43 + 75)
537#define __NR_BSD43_vhangup (__NR_BSD43 + 76)
538#define __NR_BSD43_vlimit (__NR_BSD43 + 77)
539#define __NR_BSD43_mincore (__NR_BSD43 + 78)
540#define __NR_BSD43_getgroups (__NR_BSD43 + 79)
541#define __NR_BSD43_setgroups (__NR_BSD43 + 80)
542#define __NR_BSD43_getpgrp (__NR_BSD43 + 81)
543#define __NR_BSD43_setpgrp (__NR_BSD43 + 82)
544#define __NR_BSD43_setitimer (__NR_BSD43 + 83)
545#define __NR_BSD43_wait3 (__NR_BSD43 + 84)
546#define __NR_BSD43_swapon (__NR_BSD43 + 85)
547#define __NR_BSD43_getitimer (__NR_BSD43 + 86)
548#define __NR_BSD43_gethostname (__NR_BSD43 + 87)
549#define __NR_BSD43_sethostname (__NR_BSD43 + 88)
550#define __NR_BSD43_getdtablesize (__NR_BSD43 + 89)
551#define __NR_BSD43_dup2 (__NR_BSD43 + 90)
552#define __NR_BSD43_getdopt (__NR_BSD43 + 91)
553#define __NR_BSD43_fcntl (__NR_BSD43 + 92)
554#define __NR_BSD43_select (__NR_BSD43 + 93)
555#define __NR_BSD43_setdopt (__NR_BSD43 + 94)
556#define __NR_BSD43_fsync (__NR_BSD43 + 95)
557#define __NR_BSD43_setpriority (__NR_BSD43 + 96)
558#define __NR_BSD43_socket (__NR_BSD43 + 97)
559#define __NR_BSD43_connect (__NR_BSD43 + 98)
560#define __NR_BSD43_oldaccept (__NR_BSD43 + 99)
561#define __NR_BSD43_getpriority (__NR_BSD43 + 100)
562#define __NR_BSD43_send (__NR_BSD43 + 101)
563#define __NR_BSD43_recv (__NR_BSD43 + 102)
564#define __NR_BSD43_sigreturn (__NR_BSD43 + 103)
565#define __NR_BSD43_bind (__NR_BSD43 + 104)
566#define __NR_BSD43_setsockopt (__NR_BSD43 + 105)
567#define __NR_BSD43_listen (__NR_BSD43 + 106)
568#define __NR_BSD43_vtimes (__NR_BSD43 + 107)
569#define __NR_BSD43_sigvec (__NR_BSD43 + 108)
570#define __NR_BSD43_sigblock (__NR_BSD43 + 109)
571#define __NR_BSD43_sigsetmask (__NR_BSD43 + 110)
572#define __NR_BSD43_sigpause (__NR_BSD43 + 111)
573#define __NR_BSD43_sigstack (__NR_BSD43 + 112)
574#define __NR_BSD43_oldrecvmsg (__NR_BSD43 + 113)
575#define __NR_BSD43_oldsendmsg (__NR_BSD43 + 114)
576#define __NR_BSD43_vtrace (__NR_BSD43 + 115)
577#define __NR_BSD43_gettimeofday (__NR_BSD43 + 116)
578#define __NR_BSD43_getrusage (__NR_BSD43 + 117)
579#define __NR_BSD43_getsockopt (__NR_BSD43 + 118)
580#define __NR_BSD43_reserved4 (__NR_BSD43 + 119)
581#define __NR_BSD43_readv (__NR_BSD43 + 120)
582#define __NR_BSD43_writev (__NR_BSD43 + 121)
583#define __NR_BSD43_settimeofday (__NR_BSD43 + 122)
584#define __NR_BSD43_fchown (__NR_BSD43 + 123)
585#define __NR_BSD43_fchmod (__NR_BSD43 + 124)
586#define __NR_BSD43_oldrecvfrom (__NR_BSD43 + 125)
587#define __NR_BSD43_setreuid (__NR_BSD43 + 126)
588#define __NR_BSD43_setregid (__NR_BSD43 + 127)
589#define __NR_BSD43_rename (__NR_BSD43 + 128)
590#define __NR_BSD43_truncate (__NR_BSD43 + 129)
591#define __NR_BSD43_ftruncate (__NR_BSD43 + 130)
592#define __NR_BSD43_flock (__NR_BSD43 + 131)
593#define __NR_BSD43_semsys (__NR_BSD43 + 132)
594#define __NR_BSD43_sendto (__NR_BSD43 + 133)
595#define __NR_BSD43_shutdown (__NR_BSD43 + 134)
596#define __NR_BSD43_socketpair (__NR_BSD43 + 135)
597#define __NR_BSD43_mkdir (__NR_BSD43 + 136)
598#define __NR_BSD43_rmdir (__NR_BSD43 + 137)
599#define __NR_BSD43_utimes (__NR_BSD43 + 138)
600#define __NR_BSD43_sigcleanup (__NR_BSD43 + 139)
601#define __NR_BSD43_adjtime (__NR_BSD43 + 140)
602#define __NR_BSD43_oldgetpeername (__NR_BSD43 + 141)
603#define __NR_BSD43_gethostid (__NR_BSD43 + 142)
604#define __NR_BSD43_sethostid (__NR_BSD43 + 143)
605#define __NR_BSD43_getrlimit (__NR_BSD43 + 144)
606#define __NR_BSD43_setrlimit (__NR_BSD43 + 145)
607#define __NR_BSD43_killpg (__NR_BSD43 + 146)
608#define __NR_BSD43_shmsys (__NR_BSD43 + 147)
609#define __NR_BSD43_quota (__NR_BSD43 + 148)
610#define __NR_BSD43_qquota (__NR_BSD43 + 149)
611#define __NR_BSD43_oldgetsockname (__NR_BSD43 + 150)
612#define __NR_BSD43_sysmips (__NR_BSD43 + 151)
613#define __NR_BSD43_cacheflush (__NR_BSD43 + 152)
614#define __NR_BSD43_cachectl (__NR_BSD43 + 153)
615#define __NR_BSD43_debug (__NR_BSD43 + 154)
616#define __NR_BSD43_reserved5 (__NR_BSD43 + 155)
617#define __NR_BSD43_reserved6 (__NR_BSD43 + 156)
618#define __NR_BSD43_nfs_mount (__NR_BSD43 + 157)
619#define __NR_BSD43_nfs_svc (__NR_BSD43 + 158)
620#define __NR_BSD43_getdirentries (__NR_BSD43 + 159)
621#define __NR_BSD43_statfs (__NR_BSD43 + 160)
622#define __NR_BSD43_fstatfs (__NR_BSD43 + 161)
623#define __NR_BSD43_unmount (__NR_BSD43 + 162)
624#define __NR_BSD43_async_daemon (__NR_BSD43 + 163)
625#define __NR_BSD43_nfs_getfh (__NR_BSD43 + 164)
626#define __NR_BSD43_getdomainname (__NR_BSD43 + 165)
627#define __NR_BSD43_setdomainname (__NR_BSD43 + 166)
628#define __NR_BSD43_pcfs_mount (__NR_BSD43 + 167)
629#define __NR_BSD43_quotactl (__NR_BSD43 + 168)
630#define __NR_BSD43_oldexportfs (__NR_BSD43 + 169)
631#define __NR_BSD43_smount (__NR_BSD43 + 170)
632#define __NR_BSD43_mipshwconf (__NR_BSD43 + 171)
633#define __NR_BSD43_exportfs (__NR_BSD43 + 172)
634#define __NR_BSD43_nfsfh_open (__NR_BSD43 + 173)
635#define __NR_BSD43_libattach (__NR_BSD43 + 174)
636#define __NR_BSD43_libdetach (__NR_BSD43 + 175)
637#define __NR_BSD43_accept (__NR_BSD43 + 176)
638#define __NR_BSD43_reserved7 (__NR_BSD43 + 177)
639#define __NR_BSD43_reserved8 (__NR_BSD43 + 178)
640#define __NR_BSD43_recvmsg (__NR_BSD43 + 179)
641#define __NR_BSD43_recvfrom (__NR_BSD43 + 180)
642#define __NR_BSD43_sendmsg (__NR_BSD43 + 181)
643#define __NR_BSD43_getpeername (__NR_BSD43 + 182)
644#define __NR_BSD43_getsockname (__NR_BSD43 + 183)
645#define __NR_BSD43_aread (__NR_BSD43 + 184)
646#define __NR_BSD43_awrite (__NR_BSD43 + 185)
647#define __NR_BSD43_listio (__NR_BSD43 + 186)
648#define __NR_BSD43_acancel (__NR_BSD43 + 187)
649#define __NR_BSD43_astatus (__NR_BSD43 + 188)
650#define __NR_BSD43_await (__NR_BSD43 + 189)
651#define __NR_BSD43_areadv (__NR_BSD43 + 190)
652#define __NR_BSD43_awritev (__NR_BSD43 + 191)
653
654/*
655 * POSIX syscalls are in the range from 3000 to 3999
656 */
657#define __NR_POSIX 3000
658#define __NR_POSIX_syscall (__NR_POSIX + 0)
659#define __NR_POSIX_exit (__NR_POSIX + 1)
660#define __NR_POSIX_fork (__NR_POSIX + 2)
661#define __NR_POSIX_read (__NR_POSIX + 3)
662#define __NR_POSIX_write (__NR_POSIX + 4)
663#define __NR_POSIX_open (__NR_POSIX + 5)
664#define __NR_POSIX_close (__NR_POSIX + 6)
665#define __NR_POSIX_wait (__NR_POSIX + 7)
666#define __NR_POSIX_creat (__NR_POSIX + 8)
667#define __NR_POSIX_link (__NR_POSIX + 9)
668#define __NR_POSIX_unlink (__NR_POSIX + 10)
669#define __NR_POSIX_exec (__NR_POSIX + 11)
670#define __NR_POSIX_chdir (__NR_POSIX + 12)
671#define __NR_POSIX_gtime (__NR_POSIX + 13)
672#define __NR_POSIX_mknod (__NR_POSIX + 14)
673#define __NR_POSIX_chmod (__NR_POSIX + 15)
674#define __NR_POSIX_chown (__NR_POSIX + 16)
675#define __NR_POSIX_sbreak (__NR_POSIX + 17)
676#define __NR_POSIX_stat (__NR_POSIX + 18)
677#define __NR_POSIX_lseek (__NR_POSIX + 19)
678#define __NR_POSIX_getpid (__NR_POSIX + 20)
679#define __NR_POSIX_mount (__NR_POSIX + 21)
680#define __NR_POSIX_umount (__NR_POSIX + 22)
681#define __NR_POSIX_setuid (__NR_POSIX + 23)
682#define __NR_POSIX_getuid (__NR_POSIX + 24)
683#define __NR_POSIX_stime (__NR_POSIX + 25)
684#define __NR_POSIX_ptrace (__NR_POSIX + 26)
685#define __NR_POSIX_alarm (__NR_POSIX + 27)
686#define __NR_POSIX_fstat (__NR_POSIX + 28)
687#define __NR_POSIX_pause (__NR_POSIX + 29)
688#define __NR_POSIX_utime (__NR_POSIX + 30)
689#define __NR_POSIX_stty (__NR_POSIX + 31)
690#define __NR_POSIX_gtty (__NR_POSIX + 32)
691#define __NR_POSIX_access (__NR_POSIX + 33)
692#define __NR_POSIX_nice (__NR_POSIX + 34)
693#define __NR_POSIX_statfs (__NR_POSIX + 35)
694#define __NR_POSIX_sync (__NR_POSIX + 36)
695#define __NR_POSIX_kill (__NR_POSIX + 37)
696#define __NR_POSIX_fstatfs (__NR_POSIX + 38)
697#define __NR_POSIX_getpgrp (__NR_POSIX + 39)
698#define __NR_POSIX_syssgi (__NR_POSIX + 40)
699#define __NR_POSIX_dup (__NR_POSIX + 41)
700#define __NR_POSIX_pipe (__NR_POSIX + 42)
701#define __NR_POSIX_times (__NR_POSIX + 43)
702#define __NR_POSIX_profil (__NR_POSIX + 44)
703#define __NR_POSIX_lock (__NR_POSIX + 45)
704#define __NR_POSIX_setgid (__NR_POSIX + 46)
705#define __NR_POSIX_getgid (__NR_POSIX + 47)
706#define __NR_POSIX_sig (__NR_POSIX + 48)
707#define __NR_POSIX_msgsys (__NR_POSIX + 49)
708#define __NR_POSIX_sysmips (__NR_POSIX + 50)
709#define __NR_POSIX_sysacct (__NR_POSIX + 51)
710#define __NR_POSIX_shmsys (__NR_POSIX + 52)
711#define __NR_POSIX_semsys (__NR_POSIX + 53)
712#define __NR_POSIX_ioctl (__NR_POSIX + 54)
713#define __NR_POSIX_uadmin (__NR_POSIX + 55)
714#define __NR_POSIX_exch (__NR_POSIX + 56)
715#define __NR_POSIX_utssys (__NR_POSIX + 57)
716#define __NR_POSIX_USG_reserved1 (__NR_POSIX + 58)
717#define __NR_POSIX_exece (__NR_POSIX + 59)
718#define __NR_POSIX_umask (__NR_POSIX + 60)
719#define __NR_POSIX_chroot (__NR_POSIX + 61)
720#define __NR_POSIX_fcntl (__NR_POSIX + 62)
721#define __NR_POSIX_ulimit (__NR_POSIX + 63)
722#define __NR_POSIX_SAFARI4_reserved1 (__NR_POSIX + 64)
723#define __NR_POSIX_SAFARI4_reserved2 (__NR_POSIX + 65)
724#define __NR_POSIX_SAFARI4_reserved3 (__NR_POSIX + 66)
725#define __NR_POSIX_SAFARI4_reserved4 (__NR_POSIX + 67)
726#define __NR_POSIX_SAFARI4_reserved5 (__NR_POSIX + 68)
727#define __NR_POSIX_SAFARI4_reserved6 (__NR_POSIX + 69)
728#define __NR_POSIX_advfs (__NR_POSIX + 70)
729#define __NR_POSIX_unadvfs (__NR_POSIX + 71)
730#define __NR_POSIX_rmount (__NR_POSIX + 72)
731#define __NR_POSIX_rumount (__NR_POSIX + 73)
732#define __NR_POSIX_rfstart (__NR_POSIX + 74)
733#define __NR_POSIX_reserved1 (__NR_POSIX + 75)
734#define __NR_POSIX_rdebug (__NR_POSIX + 76)
735#define __NR_POSIX_rfstop (__NR_POSIX + 77)
736#define __NR_POSIX_rfsys (__NR_POSIX + 78)
737#define __NR_POSIX_rmdir (__NR_POSIX + 79)
738#define __NR_POSIX_mkdir (__NR_POSIX + 80)
739#define __NR_POSIX_getdents (__NR_POSIX + 81)
740#define __NR_POSIX_sginap (__NR_POSIX + 82)
741#define __NR_POSIX_sgikopt (__NR_POSIX + 83)
742#define __NR_POSIX_sysfs (__NR_POSIX + 84)
743#define __NR_POSIX_getmsg (__NR_POSIX + 85)
744#define __NR_POSIX_putmsg (__NR_POSIX + 86)
745#define __NR_POSIX_poll (__NR_POSIX + 87)
746#define __NR_POSIX_sigreturn (__NR_POSIX + 88)
747#define __NR_POSIX_accept (__NR_POSIX + 89)
748#define __NR_POSIX_bind (__NR_POSIX + 90)
749#define __NR_POSIX_connect (__NR_POSIX + 91)
750#define __NR_POSIX_gethostid (__NR_POSIX + 92)
751#define __NR_POSIX_getpeername (__NR_POSIX + 93)
752#define __NR_POSIX_getsockname (__NR_POSIX + 94)
753#define __NR_POSIX_getsockopt (__NR_POSIX + 95)
754#define __NR_POSIX_listen (__NR_POSIX + 96)
755#define __NR_POSIX_recv (__NR_POSIX + 97)
756#define __NR_POSIX_recvfrom (__NR_POSIX + 98)
757#define __NR_POSIX_recvmsg (__NR_POSIX + 99)
758#define __NR_POSIX_select (__NR_POSIX + 100)
759#define __NR_POSIX_send (__NR_POSIX + 101)
760#define __NR_POSIX_sendmsg (__NR_POSIX + 102)
761#define __NR_POSIX_sendto (__NR_POSIX + 103)
762#define __NR_POSIX_sethostid (__NR_POSIX + 104)
763#define __NR_POSIX_setsockopt (__NR_POSIX + 105)
764#define __NR_POSIX_shutdown (__NR_POSIX + 106)
765#define __NR_POSIX_socket (__NR_POSIX + 107)
766#define __NR_POSIX_gethostname (__NR_POSIX + 108)
767#define __NR_POSIX_sethostname (__NR_POSIX + 109)
768#define __NR_POSIX_getdomainname (__NR_POSIX + 110)
769#define __NR_POSIX_setdomainname (__NR_POSIX + 111)
770#define __NR_POSIX_truncate (__NR_POSIX + 112)
771#define __NR_POSIX_ftruncate (__NR_POSIX + 113)
772#define __NR_POSIX_rename (__NR_POSIX + 114)
773#define __NR_POSIX_symlink (__NR_POSIX + 115)
774#define __NR_POSIX_readlink (__NR_POSIX + 116)
775#define __NR_POSIX_lstat (__NR_POSIX + 117)
776#define __NR_POSIX_nfs_mount (__NR_POSIX + 118)
777#define __NR_POSIX_nfs_svc (__NR_POSIX + 119)
778#define __NR_POSIX_nfs_getfh (__NR_POSIX + 120)
779#define __NR_POSIX_async_daemon (__NR_POSIX + 121)
780#define __NR_POSIX_exportfs (__NR_POSIX + 122)
781#define __NR_POSIX_SGI_setregid (__NR_POSIX + 123)
782#define __NR_POSIX_SGI_setreuid (__NR_POSIX + 124)
783#define __NR_POSIX_getitimer (__NR_POSIX + 125)
784#define __NR_POSIX_setitimer (__NR_POSIX + 126)
785#define __NR_POSIX_adjtime (__NR_POSIX + 127)
786#define __NR_POSIX_SGI_bsdgettime (__NR_POSIX + 128)
787#define __NR_POSIX_SGI_sproc (__NR_POSIX + 129)
788#define __NR_POSIX_SGI_prctl (__NR_POSIX + 130)
789#define __NR_POSIX_SGI_blkproc (__NR_POSIX + 131)
790#define __NR_POSIX_SGI_reserved1 (__NR_POSIX + 132)
791#define __NR_POSIX_SGI_sgigsc (__NR_POSIX + 133)
792#define __NR_POSIX_SGI_mmap (__NR_POSIX + 134)
793#define __NR_POSIX_SGI_munmap (__NR_POSIX + 135)
794#define __NR_POSIX_SGI_mprotect (__NR_POSIX + 136)
795#define __NR_POSIX_SGI_msync (__NR_POSIX + 137)
796#define __NR_POSIX_SGI_madvise (__NR_POSIX + 138)
797#define __NR_POSIX_SGI_mpin (__NR_POSIX + 139)
798#define __NR_POSIX_SGI_getpagesize (__NR_POSIX + 140)
799#define __NR_POSIX_SGI_libattach (__NR_POSIX + 141)
800#define __NR_POSIX_SGI_libdetach (__NR_POSIX + 142)
801#define __NR_POSIX_SGI_getpgrp (__NR_POSIX + 143)
802#define __NR_POSIX_SGI_setpgrp (__NR_POSIX + 144)
803#define __NR_POSIX_SGI_reserved2 (__NR_POSIX + 145)
804#define __NR_POSIX_SGI_reserved3 (__NR_POSIX + 146)
805#define __NR_POSIX_SGI_reserved4 (__NR_POSIX + 147)
806#define __NR_POSIX_SGI_reserved5 (__NR_POSIX + 148)
807#define __NR_POSIX_SGI_reserved6 (__NR_POSIX + 149)
808#define __NR_POSIX_cacheflush (__NR_POSIX + 150)
809#define __NR_POSIX_cachectl (__NR_POSIX + 151)
810#define __NR_POSIX_fchown (__NR_POSIX + 152)
811#define __NR_POSIX_fchmod (__NR_POSIX + 153)
812#define __NR_POSIX_wait3 (__NR_POSIX + 154)
813#define __NR_POSIX_mmap (__NR_POSIX + 155)
814#define __NR_POSIX_munmap (__NR_POSIX + 156)
815#define __NR_POSIX_madvise (__NR_POSIX + 157)
816#define __NR_POSIX_BSD_getpagesize (__NR_POSIX + 158)
817#define __NR_POSIX_setreuid (__NR_POSIX + 159)
818#define __NR_POSIX_setregid (__NR_POSIX + 160)
819#define __NR_POSIX_setpgid (__NR_POSIX + 161)
820#define __NR_POSIX_getgroups (__NR_POSIX + 162)
821#define __NR_POSIX_setgroups (__NR_POSIX + 163)
822#define __NR_POSIX_gettimeofday (__NR_POSIX + 164)
823#define __NR_POSIX_getrusage (__NR_POSIX + 165)
824#define __NR_POSIX_getrlimit (__NR_POSIX + 166)
825#define __NR_POSIX_setrlimit (__NR_POSIX + 167)
826#define __NR_POSIX_waitpid (__NR_POSIX + 168)
827#define __NR_POSIX_dup2 (__NR_POSIX + 169)
828#define __NR_POSIX_reserved2 (__NR_POSIX + 170)
829#define __NR_POSIX_reserved3 (__NR_POSIX + 171)
830#define __NR_POSIX_reserved4 (__NR_POSIX + 172)
831#define __NR_POSIX_reserved5 (__NR_POSIX + 173)
832#define __NR_POSIX_reserved6 (__NR_POSIX + 174)
833#define __NR_POSIX_reserved7 (__NR_POSIX + 175)
834#define __NR_POSIX_reserved8 (__NR_POSIX + 176)
835#define __NR_POSIX_reserved9 (__NR_POSIX + 177)
836#define __NR_POSIX_reserved10 (__NR_POSIX + 178)
837#define __NR_POSIX_reserved11 (__NR_POSIX + 179)
838#define __NR_POSIX_reserved12 (__NR_POSIX + 180)
839#define __NR_POSIX_reserved13 (__NR_POSIX + 181)
840#define __NR_POSIX_reserved14 (__NR_POSIX + 182)
841#define __NR_POSIX_reserved15 (__NR_POSIX + 183)
842#define __NR_POSIX_reserved16 (__NR_POSIX + 184)
843#define __NR_POSIX_reserved17 (__NR_POSIX + 185)
844#define __NR_POSIX_reserved18 (__NR_POSIX + 186)
845#define __NR_POSIX_reserved19 (__NR_POSIX + 187)
846#define __NR_POSIX_reserved20 (__NR_POSIX + 188)
847#define __NR_POSIX_reserved21 (__NR_POSIX + 189)
848#define __NR_POSIX_reserved22 (__NR_POSIX + 190)
849#define __NR_POSIX_reserved23 (__NR_POSIX + 191)
850#define __NR_POSIX_reserved24 (__NR_POSIX + 192)
851#define __NR_POSIX_reserved25 (__NR_POSIX + 193)
852#define __NR_POSIX_reserved26 (__NR_POSIX + 194)
853#define __NR_POSIX_reserved27 (__NR_POSIX + 195)
854#define __NR_POSIX_reserved28 (__NR_POSIX + 196)
855#define __NR_POSIX_reserved29 (__NR_POSIX + 197)
856#define __NR_POSIX_reserved30 (__NR_POSIX + 198)
857#define __NR_POSIX_reserved31 (__NR_POSIX + 199)
858#define __NR_POSIX_reserved32 (__NR_POSIX + 200)
859#define __NR_POSIX_reserved33 (__NR_POSIX + 201)
860#define __NR_POSIX_reserved34 (__NR_POSIX + 202)
861#define __NR_POSIX_reserved35 (__NR_POSIX + 203)
862#define __NR_POSIX_reserved36 (__NR_POSIX + 204)
863#define __NR_POSIX_reserved37 (__NR_POSIX + 205)
864#define __NR_POSIX_reserved38 (__NR_POSIX + 206)
865#define __NR_POSIX_reserved39 (__NR_POSIX + 207)
866#define __NR_POSIX_reserved40 (__NR_POSIX + 208)
867#define __NR_POSIX_reserved41 (__NR_POSIX + 209)
868#define __NR_POSIX_reserved42 (__NR_POSIX + 210)
869#define __NR_POSIX_reserved43 (__NR_POSIX + 211)
870#define __NR_POSIX_reserved44 (__NR_POSIX + 212)
871#define __NR_POSIX_reserved45 (__NR_POSIX + 213)
872#define __NR_POSIX_reserved46 (__NR_POSIX + 214)
873#define __NR_POSIX_reserved47 (__NR_POSIX + 215)
874#define __NR_POSIX_reserved48 (__NR_POSIX + 216)
875#define __NR_POSIX_reserved49 (__NR_POSIX + 217)
876#define __NR_POSIX_reserved50 (__NR_POSIX + 218)
877#define __NR_POSIX_reserved51 (__NR_POSIX + 219)
878#define __NR_POSIX_reserved52 (__NR_POSIX + 220)
879#define __NR_POSIX_reserved53 (__NR_POSIX + 221)
880#define __NR_POSIX_reserved54 (__NR_POSIX + 222)
881#define __NR_POSIX_reserved55 (__NR_POSIX + 223)
882#define __NR_POSIX_reserved56 (__NR_POSIX + 224)
883#define __NR_POSIX_reserved57 (__NR_POSIX + 225)
884#define __NR_POSIX_reserved58 (__NR_POSIX + 226)
885#define __NR_POSIX_reserved59 (__NR_POSIX + 227)
886#define __NR_POSIX_reserved60 (__NR_POSIX + 228)
887#define __NR_POSIX_reserved61 (__NR_POSIX + 229)
888#define __NR_POSIX_reserved62 (__NR_POSIX + 230)
889#define __NR_POSIX_reserved63 (__NR_POSIX + 231)
890#define __NR_POSIX_reserved64 (__NR_POSIX + 232)
891#define __NR_POSIX_reserved65 (__NR_POSIX + 233)
892#define __NR_POSIX_reserved66 (__NR_POSIX + 234)
893#define __NR_POSIX_reserved67 (__NR_POSIX + 235)
894#define __NR_POSIX_reserved68 (__NR_POSIX + 236)
895#define __NR_POSIX_reserved69 (__NR_POSIX + 237)
896#define __NR_POSIX_reserved70 (__NR_POSIX + 238)
897#define __NR_POSIX_reserved71 (__NR_POSIX + 239)
898#define __NR_POSIX_reserved72 (__NR_POSIX + 240)
899#define __NR_POSIX_reserved73 (__NR_POSIX + 241)
900#define __NR_POSIX_reserved74 (__NR_POSIX + 242)
901#define __NR_POSIX_reserved75 (__NR_POSIX + 243)
902#define __NR_POSIX_reserved76 (__NR_POSIX + 244)
903#define __NR_POSIX_reserved77 (__NR_POSIX + 245)
904#define __NR_POSIX_reserved78 (__NR_POSIX + 246)
905#define __NR_POSIX_reserved79 (__NR_POSIX + 247)
906#define __NR_POSIX_reserved80 (__NR_POSIX + 248)
907#define __NR_POSIX_reserved81 (__NR_POSIX + 249)
908#define __NR_POSIX_reserved82 (__NR_POSIX + 250)
909#define __NR_POSIX_reserved83 (__NR_POSIX + 251)
910#define __NR_POSIX_reserved84 (__NR_POSIX + 252)
911#define __NR_POSIX_reserved85 (__NR_POSIX + 253)
912#define __NR_POSIX_reserved86 (__NR_POSIX + 254)
913#define __NR_POSIX_reserved87 (__NR_POSIX + 255)
914#define __NR_POSIX_reserved88 (__NR_POSIX + 256)
915#define __NR_POSIX_reserved89 (__NR_POSIX + 257)
916#define __NR_POSIX_reserved90 (__NR_POSIX + 258)
917#define __NR_POSIX_reserved91 (__NR_POSIX + 259)
918#define __NR_POSIX_netboot (__NR_POSIX + 260)
919#define __NR_POSIX_netunboot (__NR_POSIX + 261)
920#define __NR_POSIX_rdump (__NR_POSIX + 262)
921#define __NR_POSIX_setsid (__NR_POSIX + 263)
922#define __NR_POSIX_getmaxsig (__NR_POSIX + 264)
923#define __NR_POSIX_sigpending (__NR_POSIX + 265)
924#define __NR_POSIX_sigprocmask (__NR_POSIX + 266)
925#define __NR_POSIX_sigsuspend (__NR_POSIX + 267)
926#define __NR_POSIX_sigaction (__NR_POSIX + 268)
927#define __NR_POSIX_MIPS_reserved1 (__NR_POSIX + 269)
928#define __NR_POSIX_MIPS_reserved2 (__NR_POSIX + 270)
929#define __NR_POSIX_MIPS_reserved3 (__NR_POSIX + 271)
930#define __NR_POSIX_MIPS_reserved4 (__NR_POSIX + 272)
931#define __NR_POSIX_MIPS_reserved5 (__NR_POSIX + 273)
932#define __NR_POSIX_MIPS_reserved6 (__NR_POSIX + 274)
933#define __NR_POSIX_MIPS_reserved7 (__NR_POSIX + 275)
934#define __NR_POSIX_MIPS_reserved8 (__NR_POSIX + 276)
935#define __NR_POSIX_MIPS_reserved9 (__NR_POSIX + 277)
936#define __NR_POSIX_MIPS_reserved10 (__NR_POSIX + 278)
937#define __NR_POSIX_MIPS_reserved11 (__NR_POSIX + 279)
938#define __NR_POSIX_TANDEM_reserved1 (__NR_POSIX + 280)
939#define __NR_POSIX_TANDEM_reserved2 (__NR_POSIX + 281)
940#define __NR_POSIX_TANDEM_reserved3 (__NR_POSIX + 282)
941#define __NR_POSIX_TANDEM_reserved4 (__NR_POSIX + 283)
942#define __NR_POSIX_TANDEM_reserved5 (__NR_POSIX + 284)
943#define __NR_POSIX_TANDEM_reserved6 (__NR_POSIX + 285)
944#define __NR_POSIX_TANDEM_reserved7 (__NR_POSIX + 286)
945#define __NR_POSIX_TANDEM_reserved8 (__NR_POSIX + 287)
946#define __NR_POSIX_TANDEM_reserved9 (__NR_POSIX + 288)
947#define __NR_POSIX_TANDEM_reserved10 (__NR_POSIX + 289)
948#define __NR_POSIX_TANDEM_reserved11 (__NR_POSIX + 290)
949#define __NR_POSIX_TANDEM_reserved12 (__NR_POSIX + 291)
950#define __NR_POSIX_TANDEM_reserved13 (__NR_POSIX + 292)
951#define __NR_POSIX_TANDEM_reserved14 (__NR_POSIX + 293)
952#define __NR_POSIX_TANDEM_reserved15 (__NR_POSIX + 294)
953#define __NR_POSIX_TANDEM_reserved16 (__NR_POSIX + 295)
954#define __NR_POSIX_TANDEM_reserved17 (__NR_POSIX + 296)
955#define __NR_POSIX_TANDEM_reserved18 (__NR_POSIX + 297)
956#define __NR_POSIX_TANDEM_reserved19 (__NR_POSIX + 298)
957#define __NR_POSIX_TANDEM_reserved20 (__NR_POSIX + 299)
958#define __NR_POSIX_SGI_reserved7 (__NR_POSIX + 300)
959#define __NR_POSIX_SGI_reserved8 (__NR_POSIX + 301)
960#define __NR_POSIX_SGI_reserved9 (__NR_POSIX + 302)
961#define __NR_POSIX_SGI_reserved10 (__NR_POSIX + 303)
962#define __NR_POSIX_SGI_reserved11 (__NR_POSIX + 304)
963#define __NR_POSIX_SGI_reserved12 (__NR_POSIX + 305)
964#define __NR_POSIX_SGI_reserved13 (__NR_POSIX + 306)
965#define __NR_POSIX_SGI_reserved14 (__NR_POSIX + 307)
966#define __NR_POSIX_SGI_reserved15 (__NR_POSIX + 308)
967#define __NR_POSIX_SGI_reserved16 (__NR_POSIX + 309)
968#define __NR_POSIX_SGI_reserved17 (__NR_POSIX + 310)
969#define __NR_POSIX_SGI_reserved18 (__NR_POSIX + 311)
970#define __NR_POSIX_SGI_reserved19 (__NR_POSIX + 312)
971#define __NR_POSIX_SGI_reserved20 (__NR_POSIX + 313)
972#define __NR_POSIX_SGI_reserved21 (__NR_POSIX + 314)
973#define __NR_POSIX_SGI_reserved22 (__NR_POSIX + 315)
974#define __NR_POSIX_SGI_reserved23 (__NR_POSIX + 316)
975#define __NR_POSIX_SGI_reserved24 (__NR_POSIX + 317)
976#define __NR_POSIX_SGI_reserved25 (__NR_POSIX + 318)
977#define __NR_POSIX_SGI_reserved26 (__NR_POSIX + 319)
978
979#endif /* _ASM_RISCOS_SYSCALL_H */
diff --git a/include/asm-parisc/atomic.h b/include/asm-parisc/atomic.h
index 983e9a2b6042..64ebd086c40d 100644
--- a/include/asm-parisc/atomic.h
+++ b/include/asm-parisc/atomic.h
@@ -216,4 +216,5 @@ static __inline__ int atomic_read(const atomic_t *v)
216#define smp_mb__before_atomic_inc() smp_mb() 216#define smp_mb__before_atomic_inc() smp_mb()
217#define smp_mb__after_atomic_inc() smp_mb() 217#define smp_mb__after_atomic_inc() smp_mb()
218 218
219#include <asm-generic/atomic.h>
219#endif 220#endif
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h
index 55b98c67fd82..15d8c2b51584 100644
--- a/include/asm-parisc/bitops.h
+++ b/include/asm-parisc/bitops.h
@@ -263,6 +263,7 @@ static __inline__ int fls(int x)
263 263
264 return ret; 264 return ret;
265} 265}
266#define fls64(x) generic_fls64(x)
266 267
267/* 268/*
268 * hweightN: returns the hamming weight (i.e. the number 269 * hweightN: returns the hamming weight (i.e. the number
diff --git a/include/asm-parisc/mman.h b/include/asm-parisc/mman.h
index e829607eb8bc..736b0abcac05 100644
--- a/include/asm-parisc/mman.h
+++ b/include/asm-parisc/mman.h
@@ -38,6 +38,7 @@
38#define MADV_SPACEAVAIL 5 /* insure that resources are reserved */ 38#define MADV_SPACEAVAIL 5 /* insure that resources are reserved */
39#define MADV_VPS_PURGE 6 /* Purge pages from VM page cache */ 39#define MADV_VPS_PURGE 6 /* Purge pages from VM page cache */
40#define MADV_VPS_INHERIT 7 /* Inherit parents page size */ 40#define MADV_VPS_INHERIT 7 /* Inherit parents page size */
41#define MADV_REMOVE 8 /* remove these pages & resources */
41 42
42/* The range 12-64 is reserved for page size specification. */ 43/* The range 12-64 is reserved for page size specification. */
43#define MADV_4K_PAGES 12 /* Use 4K pages */ 44#define MADV_4K_PAGES 12 /* Use 4K pages */
diff --git a/include/asm-powerpc/atomic.h b/include/asm-powerpc/atomic.h
index ec4b14468959..ae395a0632a6 100644
--- a/include/asm-powerpc/atomic.h
+++ b/include/asm-powerpc/atomic.h
@@ -402,5 +402,6 @@ static __inline__ long atomic64_dec_if_positive(atomic64_t *v)
402 402
403#endif /* __powerpc64__ */ 403#endif /* __powerpc64__ */
404 404
405#include <asm-generic/atomic.h>
405#endif /* __KERNEL__ */ 406#endif /* __KERNEL__ */
406#endif /* _ASM_POWERPC_ATOMIC_H_ */ 407#endif /* _ASM_POWERPC_ATOMIC_H_ */
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
index 5727229b0444..1996eaa8aeae 100644
--- a/include/asm-powerpc/bitops.h
+++ b/include/asm-powerpc/bitops.h
@@ -310,6 +310,7 @@ static __inline__ int fls(unsigned int x)
310 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x)); 310 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
311 return 32 - lz; 311 return 32 - lz;
312} 312}
313#define fls64(x) generic_fls64(x)
313 314
314/* 315/*
315 * hweightN: returns the hamming weight (i.e. the number 316 * hweightN: returns the hamming weight (i.e. the number
diff --git a/include/asm-powerpc/mman.h b/include/asm-powerpc/mman.h
index f5e5342fcac5..a2e34c21b44f 100644
--- a/include/asm-powerpc/mman.h
+++ b/include/asm-powerpc/mman.h
@@ -44,6 +44,7 @@
44#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 44#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
45#define MADV_WILLNEED 0x3 /* pre-fault pages */ 45#define MADV_WILLNEED 0x3 /* pre-fault pages */
46#define MADV_DONTNEED 0x4 /* discard these pages */ 46#define MADV_DONTNEED 0x4 /* discard these pages */
47#define MADV_REMOVE 0x5 /* remove these pages & resources */
47 48
48/* compatibility flags */ 49/* compatibility flags */
49#define MAP_ANON MAP_ANONYMOUS 50#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index c1b4bbabbe97..29b0bb0086d3 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -220,7 +220,8 @@ extern int __hash_page_64K(unsigned long ea, unsigned long access,
220 unsigned int local); 220 unsigned int local);
221struct mm_struct; 221struct mm_struct;
222extern int hash_huge_page(struct mm_struct *mm, unsigned long access, 222extern int hash_huge_page(struct mm_struct *mm, unsigned long access,
223 unsigned long ea, unsigned long vsid, int local); 223 unsigned long ea, unsigned long vsid, int local,
224 unsigned long trap);
224 225
225extern void htab_finish_init(void); 226extern void htab_finish_init(void);
226extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend, 227extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
diff --git a/include/asm-ppc/ibm_ocp.h b/include/asm-ppc/ibm_ocp.h
index 9c21de1ff4ed..ddce616f765a 100644
--- a/include/asm-ppc/ibm_ocp.h
+++ b/include/asm-ppc/ibm_ocp.h
@@ -63,7 +63,6 @@ struct ocp_func_emac_data {
63 int wol_irq; /* WOL interrupt */ 63 int wol_irq; /* WOL interrupt */
64 int mdio_idx; /* EMAC idx of MDIO master or -1 */ 64 int mdio_idx; /* EMAC idx of MDIO master or -1 */
65 int tah_idx; /* TAH device index or -1 */ 65 int tah_idx; /* TAH device index or -1 */
66 int jumbo; /* Jumbo frames capable flag */
67 int phy_mode; /* PHY type or configurable mode */ 66 int phy_mode; /* PHY type or configurable mode */
68 u8 mac_addr[6]; /* EMAC mac address */ 67 u8 mac_addr[6]; /* EMAC mac address */
69 u32 phy_map; /* EMAC phy map */ 68 u32 phy_map; /* EMAC phy map */
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 84ac6e258eef..df9cf6ed189d 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -27,6 +27,8 @@
27 27
28#if defined(CONFIG_4xx) 28#if defined(CONFIG_4xx)
29#include <asm/ibm4xx.h> 29#include <asm/ibm4xx.h>
30#elif defined(CONFIG_PPC_MPC52xx)
31#include <asm/mpc52xx.h>
30#elif defined(CONFIG_8xx) 32#elif defined(CONFIG_8xx)
31#include <asm/mpc8xx.h> 33#include <asm/mpc8xx.h>
32#elif defined(CONFIG_8260) 34#elif defined(CONFIG_8260)
diff --git a/include/asm-ppc/mpc52xx.h b/include/asm-ppc/mpc52xx.h
index e5f80c22fbfc..a055e0756b9d 100644
--- a/include/asm-ppc/mpc52xx.h
+++ b/include/asm-ppc/mpc52xx.h
@@ -29,6 +29,17 @@ struct pt_regs;
29#endif /* __ASSEMBLY__ */ 29#endif /* __ASSEMBLY__ */
30 30
31 31
32#ifdef CONFIG_PCI
33#define _IO_BASE isa_io_base
34#define _ISA_MEM_BASE isa_mem_base
35#define PCI_DRAM_OFFSET pci_dram_offset
36#else
37#define _IO_BASE 0
38#define _ISA_MEM_BASE 0
39#define PCI_DRAM_OFFSET 0
40#endif
41
42
32/* ======================================================================== */ 43/* ======================================================================== */
33/* PPC Sys devices definition */ 44/* PPC Sys devices definition */
34/* ======================================================================== */ 45/* ======================================================================== */
@@ -107,7 +118,7 @@ enum ppc_sys_devices {
107#define MPC52xx_SDMA_IRQ_NUM 17 118#define MPC52xx_SDMA_IRQ_NUM 17
108#define MPC52xx_PERP_IRQ_NUM 23 119#define MPC52xx_PERP_IRQ_NUM 23
109 120
110#define MPC52xx_CRIT_IRQ_BASE 0 121#define MPC52xx_CRIT_IRQ_BASE 1
111#define MPC52xx_MAIN_IRQ_BASE (MPC52xx_CRIT_IRQ_BASE + MPC52xx_CRIT_IRQ_NUM) 122#define MPC52xx_MAIN_IRQ_BASE (MPC52xx_CRIT_IRQ_BASE + MPC52xx_CRIT_IRQ_NUM)
112#define MPC52xx_SDMA_IRQ_BASE (MPC52xx_MAIN_IRQ_BASE + MPC52xx_MAIN_IRQ_NUM) 123#define MPC52xx_SDMA_IRQ_BASE (MPC52xx_MAIN_IRQ_BASE + MPC52xx_MAIN_IRQ_NUM)
113#define MPC52xx_PERP_IRQ_BASE (MPC52xx_SDMA_IRQ_BASE + MPC52xx_SDMA_IRQ_NUM) 124#define MPC52xx_PERP_IRQ_BASE (MPC52xx_SDMA_IRQ_BASE + MPC52xx_SDMA_IRQ_NUM)
diff --git a/include/asm-ppc/ppc4xx_dma.h b/include/asm-ppc/ppc4xx_dma.h
index a415001165fa..46a086fff816 100644
--- a/include/asm-ppc/ppc4xx_dma.h
+++ b/include/asm-ppc/ppc4xx_dma.h
@@ -33,9 +33,6 @@
33 33
34#define MAX_PPC4xx_DMA_CHANNELS 4 34#define MAX_PPC4xx_DMA_CHANNELS 4
35 35
36/* in arch/ppc/kernel/setup.c -- Cort */
37extern unsigned long DMA_MODE_WRITE, DMA_MODE_READ;
38
39/* 36/*
40 * Function return status codes 37 * Function return status codes
41 * These values are used to indicate whether or not the function 38 * These values are used to indicate whether or not the function
diff --git a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h
index b3bd4f679f72..d82aedf616fe 100644
--- a/include/asm-s390/atomic.h
+++ b/include/asm-s390/atomic.h
@@ -5,7 +5,7 @@
5 * include/asm-s390/atomic.h 5 * include/asm-s390/atomic.h
6 * 6 *
7 * S390 version 7 * S390 version
8 * Copyright (C) 1999-2003 IBM Deutschland Entwicklung GmbH, IBM Corporation 8 * Copyright (C) 1999-2005 IBM Deutschland Entwicklung GmbH, IBM Corporation
9 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 9 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
10 * Denis Joseph Barrow, 10 * Denis Joseph Barrow,
11 * Arnd Bergmann (arndb@de.ibm.com) 11 * Arnd Bergmann (arndb@de.ibm.com)
@@ -45,59 +45,57 @@ typedef struct {
45#define atomic_read(v) ((v)->counter) 45#define atomic_read(v) ((v)->counter)
46#define atomic_set(v,i) (((v)->counter) = (i)) 46#define atomic_set(v,i) (((v)->counter) = (i))
47 47
48static __inline__ void atomic_add(int i, atomic_t * v)
49{
50 __CS_LOOP(v, i, "ar");
51}
52static __inline__ int atomic_add_return(int i, atomic_t * v) 48static __inline__ int atomic_add_return(int i, atomic_t * v)
53{ 49{
54 return __CS_LOOP(v, i, "ar"); 50 return __CS_LOOP(v, i, "ar");
55} 51}
56static __inline__ int atomic_add_negative(int i, atomic_t * v) 52#define atomic_add(_i, _v) atomic_add_return(_i, _v)
57{ 53#define atomic_add_negative(_i, _v) (atomic_add_return(_i, _v) < 0)
58 return __CS_LOOP(v, i, "ar") < 0; 54#define atomic_inc(_v) atomic_add_return(1, _v)
59} 55#define atomic_inc_return(_v) atomic_add_return(1, _v)
60static __inline__ void atomic_sub(int i, atomic_t * v) 56#define atomic_inc_and_test(_v) (atomic_add_return(1, _v) == 0)
61{ 57
62 __CS_LOOP(v, i, "sr");
63}
64static __inline__ int atomic_sub_return(int i, atomic_t * v) 58static __inline__ int atomic_sub_return(int i, atomic_t * v)
65{ 59{
66 return __CS_LOOP(v, i, "sr"); 60 return __CS_LOOP(v, i, "sr");
67} 61}
68static __inline__ void atomic_inc(volatile atomic_t * v) 62#define atomic_sub(_i, _v) atomic_sub_return(_i, _v)
69{ 63#define atomic_sub_and_test(_i, _v) (atomic_sub_return(_i, _v) == 0)
70 __CS_LOOP(v, 1, "ar"); 64#define atomic_dec(_v) atomic_sub_return(1, _v)
71} 65#define atomic_dec_return(_v) atomic_sub_return(1, _v)
72static __inline__ int atomic_inc_return(volatile atomic_t * v) 66#define atomic_dec_and_test(_v) (atomic_sub_return(1, _v) == 0)
73{
74 return __CS_LOOP(v, 1, "ar");
75}
76 67
77static __inline__ int atomic_inc_and_test(volatile atomic_t * v)
78{
79 return __CS_LOOP(v, 1, "ar") == 0;
80}
81static __inline__ void atomic_dec(volatile atomic_t * v)
82{
83 __CS_LOOP(v, 1, "sr");
84}
85static __inline__ int atomic_dec_return(volatile atomic_t * v)
86{
87 return __CS_LOOP(v, 1, "sr");
88}
89static __inline__ int atomic_dec_and_test(volatile atomic_t * v)
90{
91 return __CS_LOOP(v, 1, "sr") == 0;
92}
93static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t * v) 68static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t * v)
94{ 69{
95 __CS_LOOP(v, ~mask, "nr"); 70 __CS_LOOP(v, ~mask, "nr");
96} 71}
72
97static __inline__ void atomic_set_mask(unsigned long mask, atomic_t * v) 73static __inline__ void atomic_set_mask(unsigned long mask, atomic_t * v)
98{ 74{
99 __CS_LOOP(v, mask, "or"); 75 __CS_LOOP(v, mask, "or");
100} 76}
77
78static __inline__ int atomic_cmpxchg(atomic_t *v, int old, int new)
79{
80 __asm__ __volatile__(" cs %0,%3,0(%2)\n"
81 : "+d" (old), "=m" (v->counter)
82 : "a" (v), "d" (new), "m" (v->counter)
83 : "cc", "memory" );
84 return old;
85}
86
87static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
88{
89 int c, old;
90
91 c = atomic_read(v);
92 while (c != u && (old = atomic_cmpxchg(v, c, c + a)) != c)
93 c = old;
94 return c != u;
95}
96
97#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
98
101#undef __CS_LOOP 99#undef __CS_LOOP
102 100
103#ifdef __s390x__ 101#ifdef __s390x__
@@ -123,97 +121,67 @@ typedef struct {
123#define atomic64_read(v) ((v)->counter) 121#define atomic64_read(v) ((v)->counter)
124#define atomic64_set(v,i) (((v)->counter) = (i)) 122#define atomic64_set(v,i) (((v)->counter) = (i))
125 123
126static __inline__ void atomic64_add(long long i, atomic64_t * v)
127{
128 __CSG_LOOP(v, i, "agr");
129}
130static __inline__ long long atomic64_add_return(long long i, atomic64_t * v) 124static __inline__ long long atomic64_add_return(long long i, atomic64_t * v)
131{ 125{
132 return __CSG_LOOP(v, i, "agr"); 126 return __CSG_LOOP(v, i, "agr");
133} 127}
134static __inline__ long long atomic64_add_negative(long long i, atomic64_t * v) 128#define atomic64_add(_i, _v) atomic64_add_return(_i, _v)
135{ 129#define atomic64_add_negative(_i, _v) (atomic64_add_return(_i, _v) < 0)
136 return __CSG_LOOP(v, i, "agr") < 0; 130#define atomic64_inc(_v) atomic64_add_return(1, _v)
137} 131#define atomic64_inc_return(_v) atomic64_add_return(1, _v)
138static __inline__ void atomic64_sub(long long i, atomic64_t * v) 132#define atomic64_inc_and_test(_v) (atomic64_add_return(1, _v) == 0)
139{ 133
140 __CSG_LOOP(v, i, "sgr"); 134static __inline__ long long atomic64_sub_return(long long i, atomic64_t * v)
141}
142static __inline__ void atomic64_inc(volatile atomic64_t * v)
143{
144 __CSG_LOOP(v, 1, "agr");
145}
146static __inline__ long long atomic64_inc_return(volatile atomic64_t * v)
147{
148 return __CSG_LOOP(v, 1, "agr");
149}
150static __inline__ long long atomic64_inc_and_test(volatile atomic64_t * v)
151{
152 return __CSG_LOOP(v, 1, "agr") == 0;
153}
154static __inline__ void atomic64_dec(volatile atomic64_t * v)
155{
156 __CSG_LOOP(v, 1, "sgr");
157}
158static __inline__ long long atomic64_dec_return(volatile atomic64_t * v)
159{
160 return __CSG_LOOP(v, 1, "sgr");
161}
162static __inline__ long long atomic64_dec_and_test(volatile atomic64_t * v)
163{ 135{
164 return __CSG_LOOP(v, 1, "sgr") == 0; 136 return __CSG_LOOP(v, i, "sgr");
165} 137}
138#define atomic64_sub(_i, _v) atomic64_sub_return(_i, _v)
139#define atomic64_sub_and_test(_i, _v) (atomic64_sub_return(_i, _v) == 0)
140#define atomic64_dec(_v) atomic64_sub_return(1, _v)
141#define atomic64_dec_return(_v) atomic64_sub_return(1, _v)
142#define atomic64_dec_and_test(_v) (atomic64_sub_return(1, _v) == 0)
143
166static __inline__ void atomic64_clear_mask(unsigned long mask, atomic64_t * v) 144static __inline__ void atomic64_clear_mask(unsigned long mask, atomic64_t * v)
167{ 145{
168 __CSG_LOOP(v, ~mask, "ngr"); 146 __CSG_LOOP(v, ~mask, "ngr");
169} 147}
148
170static __inline__ void atomic64_set_mask(unsigned long mask, atomic64_t * v) 149static __inline__ void atomic64_set_mask(unsigned long mask, atomic64_t * v)
171{ 150{
172 __CSG_LOOP(v, mask, "ogr"); 151 __CSG_LOOP(v, mask, "ogr");
173} 152}
174 153
175#undef __CSG_LOOP 154static __inline__ long long atomic64_cmpxchg(atomic64_t *v,
176#endif 155 long long old, long long new)
177 156{
178/* 157 __asm__ __volatile__(" csg %0,%3,0(%2)\n"
179 returns 0 if expected_oldval==value in *v ( swap was successful ) 158 : "+d" (old), "=m" (v->counter)
180 returns 1 if unsuccessful. 159 : "a" (v), "d" (new), "m" (v->counter)
160 : "cc", "memory" );
161 return old;
162}
181 163
182 This is non-portable, use bitops or spinlocks instead! 164static __inline__ int atomic64_add_unless(atomic64_t *v,
183*/ 165 long long a, long long u)
184static __inline__ int
185atomic_compare_and_swap(int expected_oldval,int new_val,atomic_t *v)
186{ 166{
187 int retval; 167 long long c, old;
188 168
189 __asm__ __volatile__( 169 c = atomic64_read(v);
190 " lr %0,%3\n" 170 while (c != u && (old = atomic64_cmpxchg(v, c, c + a)) != c)
191 " cs %0,%4,0(%2)\n" 171 c = old;
192 " ipm %0\n" 172 return c != u;
193 " srl %0,28\n"
194 "0:"
195 : "=&d" (retval), "=m" (v->counter)
196 : "a" (v), "d" (expected_oldval) , "d" (new_val),
197 "m" (v->counter) : "cc", "memory" );
198 return retval;
199} 173}
200 174
201#define atomic_cmpxchg(v, o, n) (atomic_compare_and_swap((o), (n), &((v)->counter))) 175#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
202 176
203#define atomic_add_unless(v, a, u) \ 177#undef __CSG_LOOP
204({ \ 178#endif
205 int c, old; \
206 c = atomic_read(v); \
207 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \
208 c = old; \
209 c != (u); \
210})
211#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
212 179
213#define smp_mb__before_atomic_dec() smp_mb() 180#define smp_mb__before_atomic_dec() smp_mb()
214#define smp_mb__after_atomic_dec() smp_mb() 181#define smp_mb__after_atomic_dec() smp_mb()
215#define smp_mb__before_atomic_inc() smp_mb() 182#define smp_mb__before_atomic_inc() smp_mb()
216#define smp_mb__after_atomic_inc() smp_mb() 183#define smp_mb__after_atomic_inc() smp_mb()
217 184
185#include <asm-generic/atomic.h>
218#endif /* __KERNEL__ */ 186#endif /* __KERNEL__ */
219#endif /* __ARCH_S390_ATOMIC__ */ 187#endif /* __ARCH_S390_ATOMIC__ */
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index b07c578b22ea..61232760cc3b 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -839,6 +839,7 @@ static inline int sched_find_first_bit(unsigned long *b)
839 * fls: find last bit set. 839 * fls: find last bit set.
840 */ 840 */
841#define fls(x) generic_fls(x) 841#define fls(x) generic_fls(x)
842#define fls64(x) generic_fls64(x)
842 843
843/* 844/*
844 * hweightN: returns the hamming weight (i.e. the number 845 * hweightN: returns the hamming weight (i.e. the number
diff --git a/include/asm-s390/ccwdev.h b/include/asm-s390/ccwdev.h
index 3eb231af5d51..12456cb2f882 100644
--- a/include/asm-s390/ccwdev.h
+++ b/include/asm-s390/ccwdev.h
@@ -185,8 +185,5 @@ extern struct ccw_device *ccw_device_probe_console(void);
185extern int _ccw_device_get_device_number(struct ccw_device *); 185extern int _ccw_device_get_device_number(struct ccw_device *);
186extern int _ccw_device_get_subchannel_number(struct ccw_device *); 186extern int _ccw_device_get_subchannel_number(struct ccw_device *);
187 187
188extern struct device *s390_root_dev_register(const char *);
189extern void s390_root_dev_unregister(struct device *);
190
191extern void *ccw_device_get_chp_desc(struct ccw_device *, int); 188extern void *ccw_device_get_chp_desc(struct ccw_device *, int);
192#endif /* _S390_CCWDEV_H_ */ 189#endif /* _S390_CCWDEV_H_ */
diff --git a/include/asm-s390/mman.h b/include/asm-s390/mman.h
index ea86bd12204f..c8d5409b5d56 100644
--- a/include/asm-s390/mman.h
+++ b/include/asm-s390/mman.h
@@ -43,6 +43,7 @@
43#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 43#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
44#define MADV_WILLNEED 0x3 /* pre-fault pages */ 44#define MADV_WILLNEED 0x3 /* pre-fault pages */
45#define MADV_DONTNEED 0x4 /* discard these pages */ 45#define MADV_DONTNEED 0x4 /* discard these pages */
46#define MADV_REMOVE 0x5 /* remove these pages & resources */
46 47
47/* compatibility flags */ 48/* compatibility flags */
48#define MAP_ANON MAP_ANONYMOUS 49#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-s390/qdio.h b/include/asm-s390/qdio.h
index 0ddf0a8ef8de..7bc15f0231db 100644
--- a/include/asm-s390/qdio.h
+++ b/include/asm-s390/qdio.h
@@ -195,12 +195,14 @@ struct qdr {
195/* 195/*
196 * queue information block (QIB) 196 * queue information block (QIB)
197 */ 197 */
198#define QIB_AC_INBOUND_PCI_SUPPORTED 0x80 198#define QIB_AC_INBOUND_PCI_SUPPORTED 0x80
199#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40 199#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40
200#define QIB_RFLAGS_ENABLE_QEBSM 0x80
201
200struct qib { 202struct qib {
201 unsigned int qfmt : 8; /* queue format */ 203 unsigned int qfmt : 8; /* queue format */
202 unsigned int pfmt : 8; /* impl. dep. parameter format */ 204 unsigned int pfmt : 8; /* impl. dep. parameter format */
203 unsigned int res1 : 8; /* reserved */ 205 unsigned int rflags : 8; /* QEBSM */
204 unsigned int ac : 8; /* adapter characteristics */ 206 unsigned int ac : 8; /* adapter characteristics */
205 unsigned int res2; /* reserved */ 207 unsigned int res2; /* reserved */
206#ifdef QDIO_32_BIT 208#ifdef QDIO_32_BIT
diff --git a/include/asm-s390/s390_rdev.h b/include/asm-s390/s390_rdev.h
new file mode 100644
index 000000000000..3ad78f2b9c48
--- /dev/null
+++ b/include/asm-s390/s390_rdev.h
@@ -0,0 +1,15 @@
1/*
2 * include/asm-s390/ccwdev.h
3 *
4 * Copyright (C) 2002,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation
5 * Author(s): Cornelia Huck <cohuck@de.ibm.com>
6 * Carsten Otte <cotte@de.ibm.com>
7 *
8 * Interface for s390 root device
9 */
10
11#ifndef _S390_RDEV_H_
12#define _S390_RDEV_H_
13extern struct device *s390_root_dev_register(const char *);
14extern void s390_root_dev_unregister(struct device *);
15#endif /* _S390_RDEV_H_ */
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
index 10a619da4761..be104f21c70a 100644
--- a/include/asm-s390/uaccess.h
+++ b/include/asm-s390/uaccess.h
@@ -61,8 +61,10 @@
61#define segment_eq(a,b) ((a).ar4 == (b).ar4) 61#define segment_eq(a,b) ((a).ar4 == (b).ar4)
62 62
63 63
64#define __access_ok(addr,size) (1) 64static inline int __access_ok(const void *addr, unsigned long size)
65 65{
66 return 1;
67}
66#define access_ok(type,addr,size) __access_ok(addr,size) 68#define access_ok(type,addr,size) __access_ok(addr,size)
67 69
68/* 70/*
@@ -206,25 +208,25 @@ extern int __put_user_bad(void) __attribute__((noreturn));
206 case 1: { \ 208 case 1: { \
207 unsigned char __x; \ 209 unsigned char __x; \
208 __get_user_asm(__x, ptr, __gu_err); \ 210 __get_user_asm(__x, ptr, __gu_err); \
209 (x) = (__typeof__(*(ptr))) __x; \ 211 (x) = *(__typeof__(*(ptr)) *) &__x; \
210 break; \ 212 break; \
211 }; \ 213 }; \
212 case 2: { \ 214 case 2: { \
213 unsigned short __x; \ 215 unsigned short __x; \
214 __get_user_asm(__x, ptr, __gu_err); \ 216 __get_user_asm(__x, ptr, __gu_err); \
215 (x) = (__typeof__(*(ptr))) __x; \ 217 (x) = *(__typeof__(*(ptr)) *) &__x; \
216 break; \ 218 break; \
217 }; \ 219 }; \
218 case 4: { \ 220 case 4: { \
219 unsigned int __x; \ 221 unsigned int __x; \
220 __get_user_asm(__x, ptr, __gu_err); \ 222 __get_user_asm(__x, ptr, __gu_err); \
221 (x) = (__typeof__(*(ptr))) __x; \ 223 (x) = *(__typeof__(*(ptr)) *) &__x; \
222 break; \ 224 break; \
223 }; \ 225 }; \
224 case 8: { \ 226 case 8: { \
225 unsigned long long __x; \ 227 unsigned long long __x; \
226 __get_user_asm(__x, ptr, __gu_err); \ 228 __get_user_asm(__x, ptr, __gu_err); \
227 (x) = (__typeof__(*(ptr))) __x; \ 229 (x) = *(__typeof__(*(ptr)) *) &__x; \
228 break; \ 230 break; \
229 }; \ 231 }; \
230 default: \ 232 default: \
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index f97d92691f17..2861cdc243ad 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -539,7 +539,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
539#define __ARCH_WANT_SYS_SIGPENDING 539#define __ARCH_WANT_SYS_SIGPENDING
540#define __ARCH_WANT_SYS_SIGPROCMASK 540#define __ARCH_WANT_SYS_SIGPROCMASK
541#define __ARCH_WANT_SYS_RT_SIGACTION 541#define __ARCH_WANT_SYS_RT_SIGACTION
542# ifdef CONFIG_ARCH_S390_31 542# ifndef CONFIG_64BIT
543# define __ARCH_WANT_STAT64 543# define __ARCH_WANT_STAT64
544# define __ARCH_WANT_SYS_TIME 544# define __ARCH_WANT_SYS_TIME
545# endif 545# endif
diff --git a/include/asm-s390/vtoc.h b/include/asm-s390/vtoc.h
index 41d369f38b0e..d1de5b7ebb0b 100644
--- a/include/asm-s390/vtoc.h
+++ b/include/asm-s390/vtoc.h
@@ -176,4 +176,28 @@ struct vtoc_format7_label
176 struct vtoc_cchhb DS7PTRDS; /* pointer to next FMT7 DSCB */ 176 struct vtoc_cchhb DS7PTRDS; /* pointer to next FMT7 DSCB */
177} __attribute__ ((packed)); 177} __attribute__ ((packed));
178 178
179struct vtoc_cms_label {
180 u8 label_id[4]; /* Label identifier */
181 u8 vol_id[6]; /* Volid */
182 u16 version_id; /* Version identifier */
183 u32 block_size; /* Disk block size */
184 u32 origin_ptr; /* Disk origin pointer */
185 u32 usable_count; /* Number of usable cylinders/blocks */
186 u32 formatted_count; /* Maximum number of formatted cylinders/
187 * blocks */
188 u32 block_count; /* Disk size in CMS blocks */
189 u32 used_count; /* Number of CMS blocks in use */
190 u32 fst_size; /* File Status Table (FST) size */
191 u32 fst_count; /* Number of FSTs per CMS block */
192 u8 format_date[6]; /* Disk FORMAT date */
193 u8 reserved1[2];
194 u32 disk_offset; /* Disk offset when reserved*/
195 u32 map_block; /* Allocation Map Block with next hole */
196 u32 hblk_disp; /* Displacement into HBLK data of next hole */
197 u32 user_disp; /* Displacement into user part of Allocation
198 * map */
199 u8 reserved2[4];
200 u8 segment_name[8]; /* Name of shared segment */
201} __attribute__ ((packed));
202
179#endif /* _ASM_S390_VTOC_H */ 203#endif /* _ASM_S390_VTOC_H */
diff --git a/include/asm-sh/atomic.h b/include/asm-sh/atomic.h
index aabfd334462c..618d8e0de348 100644
--- a/include/asm-sh/atomic.h
+++ b/include/asm-sh/atomic.h
@@ -140,4 +140,5 @@ static __inline__ void atomic_set_mask(unsigned int mask, atomic_t *v)
140#define smp_mb__before_atomic_inc() barrier() 140#define smp_mb__before_atomic_inc() barrier()
141#define smp_mb__after_atomic_inc() barrier() 141#define smp_mb__after_atomic_inc() barrier()
142 142
143#include <asm-generic/atomic.h>
143#endif /* __ASM_SH_ATOMIC_H */ 144#endif /* __ASM_SH_ATOMIC_H */
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h
index 5163d1ff2f1b..1c5260860045 100644
--- a/include/asm-sh/bitops.h
+++ b/include/asm-sh/bitops.h
@@ -470,6 +470,7 @@ found_middle:
470 */ 470 */
471 471
472#define fls(x) generic_fls(x) 472#define fls(x) generic_fls(x)
473#define fls64(x) generic_fls64(x)
473 474
474#endif /* __KERNEL__ */ 475#endif /* __KERNEL__ */
475 476
diff --git a/include/asm-sh/mman.h b/include/asm-sh/mman.h
index 3ebab5f79db7..693bd55a3710 100644
--- a/include/asm-sh/mman.h
+++ b/include/asm-sh/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-sh64/atomic.h b/include/asm-sh64/atomic.h
index 927a2bc27b30..f3ce5c0df13a 100644
--- a/include/asm-sh64/atomic.h
+++ b/include/asm-sh64/atomic.h
@@ -152,4 +152,5 @@ static __inline__ void atomic_set_mask(unsigned int mask, atomic_t *v)
152#define smp_mb__before_atomic_inc() barrier() 152#define smp_mb__before_atomic_inc() barrier()
153#define smp_mb__after_atomic_inc() barrier() 153#define smp_mb__after_atomic_inc() barrier()
154 154
155#include <asm-generic/atomic.h>
155#endif /* __ASM_SH64_ATOMIC_H */ 156#endif /* __ASM_SH64_ATOMIC_H */
diff --git a/include/asm-sh64/bitops.h b/include/asm-sh64/bitops.h
index e1ff63e09227..ce9c3ad45fe0 100644
--- a/include/asm-sh64/bitops.h
+++ b/include/asm-sh64/bitops.h
@@ -510,6 +510,7 @@ found_middle:
510 510
511#define ffs(x) generic_ffs(x) 511#define ffs(x) generic_ffs(x)
512#define fls(x) generic_fls(x) 512#define fls(x) generic_fls(x)
513#define fls64(x) generic_fls64(x)
513 514
514#endif /* __KERNEL__ */ 515#endif /* __KERNEL__ */
515 516
diff --git a/include/asm-sparc/atomic.h b/include/asm-sparc/atomic.h
index 62bec7ad271c..accb4967e9d2 100644
--- a/include/asm-sparc/atomic.h
+++ b/include/asm-sparc/atomic.h
@@ -159,4 +159,5 @@ static inline int __atomic24_sub(int i, atomic24_t *v)
159 159
160#endif /* !(__KERNEL__) */ 160#endif /* !(__KERNEL__) */
161 161
162#include <asm-generic/atomic.h>
162#endif /* !(__ARCH_SPARC_ATOMIC__) */ 163#endif /* !(__ARCH_SPARC_ATOMIC__) */
diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h
index bfbd795a0a80..41722b5e45ef 100644
--- a/include/asm-sparc/bitops.h
+++ b/include/asm-sparc/bitops.h
@@ -298,6 +298,7 @@ static inline int ffs(int x)
298 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. 298 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
299 */ 299 */
300#define fls(x) generic_fls(x) 300#define fls(x) generic_fls(x)
301#define fls64(x) generic_fls64(x)
301 302
302/* 303/*
303 * hweightN: returns the hamming weight (i.e. the number 304 * hweightN: returns the hamming weight (i.e. the number
diff --git a/include/asm-sparc/memreg.h b/include/asm-sparc/memreg.h
index c0498d3baf93..5fb95c828da6 100644
--- a/include/asm-sparc/memreg.h
+++ b/include/asm-sparc/memreg.h
@@ -36,7 +36,7 @@
36 36
37/* Memory parity error register with associated bit constants. */ 37/* Memory parity error register with associated bit constants. */
38#ifndef __ASSEMBLY__ 38#ifndef __ASSEMBLY__
39extern __volatile__ unsigned long *sun4c_memerr_reg; 39extern __volatile__ unsigned long __iomem *sun4c_memerr_reg;
40#endif 40#endif
41 41
42#define SUN4C_MPE_ERROR 0x80 /* Parity error detected. (ro) */ 42#define SUN4C_MPE_ERROR 0x80 /* Parity error detected. (ro) */
diff --git a/include/asm-sparc/mman.h b/include/asm-sparc/mman.h
index 138eb81dd70d..98435ad8619e 100644
--- a/include/asm-sparc/mman.h
+++ b/include/asm-sparc/mman.h
@@ -54,6 +54,7 @@
54#define MADV_WILLNEED 0x3 /* pre-fault pages */ 54#define MADV_WILLNEED 0x3 /* pre-fault pages */
55#define MADV_DONTNEED 0x4 /* discard these pages */ 55#define MADV_DONTNEED 0x4 /* discard these pages */
56#define MADV_FREE 0x5 /* (Solaris) contents can be freed */ 56#define MADV_FREE 0x5 /* (Solaris) contents can be freed */
57#define MADV_REMOVE 0x6 /* remove these pages & resources */
57 58
58/* compatibility flags */ 59/* compatibility flags */
59#define MAP_ANON MAP_ANONYMOUS 60#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-sparc/pcic.h b/include/asm-sparc/pcic.h
index 301ae8022ddd..dedea14d87c8 100644
--- a/include/asm-sparc/pcic.h
+++ b/include/asm-sparc/pcic.h
@@ -16,10 +16,10 @@
16#include <asm/pbm.h> 16#include <asm/pbm.h>
17 17
18struct linux_pcic { 18struct linux_pcic {
19 void * __iomem pcic_regs; 19 void __iomem *pcic_regs;
20 unsigned long pcic_io; 20 unsigned long pcic_io;
21 void * __iomem pcic_config_space_addr; 21 void __iomem *pcic_config_space_addr;
22 void * __iomem pcic_config_space_data; 22 void __iomem *pcic_config_space_data;
23 struct resource pcic_res_regs; 23 struct resource pcic_res_regs;
24 struct resource pcic_res_io; 24 struct resource pcic_res_io;
25 struct resource pcic_res_cfg_addr; 25 struct resource pcic_res_cfg_addr;
diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h
index 3789fe315992..11f5aa5d108c 100644
--- a/include/asm-sparc64/atomic.h
+++ b/include/asm-sparc64/atomic.h
@@ -96,4 +96,5 @@ extern int atomic64_sub_ret(int, atomic64_t *);
96#define smp_mb__after_atomic_inc() barrier() 96#define smp_mb__after_atomic_inc() barrier()
97#endif 97#endif
98 98
99#include <asm-generic/atomic.h>
99#endif /* !(__ARCH_SPARC64_ATOMIC__) */ 100#endif /* !(__ARCH_SPARC64_ATOMIC__) */
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h
index 6388b8376c50..6efc0162fb09 100644
--- a/include/asm-sparc64/bitops.h
+++ b/include/asm-sparc64/bitops.h
@@ -119,6 +119,7 @@ static inline unsigned long __ffs(unsigned long word)
119 */ 119 */
120 120
121#define fls(x) generic_fls(x) 121#define fls(x) generic_fls(x)
122#define fls64(x) generic_fls64(x)
122 123
123#ifdef __KERNEL__ 124#ifdef __KERNEL__
124 125
diff --git a/include/asm-sparc64/mman.h b/include/asm-sparc64/mman.h
index 01cecf54357b..cb4b6156194d 100644
--- a/include/asm-sparc64/mman.h
+++ b/include/asm-sparc64/mman.h
@@ -54,6 +54,7 @@
54#define MADV_WILLNEED 0x3 /* pre-fault pages */ 54#define MADV_WILLNEED 0x3 /* pre-fault pages */
55#define MADV_DONTNEED 0x4 /* discard these pages */ 55#define MADV_DONTNEED 0x4 /* discard these pages */
56#define MADV_FREE 0x5 /* (Solaris) contents can be freed */ 56#define MADV_FREE 0x5 /* (Solaris) contents can be freed */
57#define MADV_REMOVE 0x6 /* remove these pages & resources */
57 58
58/* compatibility flags */ 59/* compatibility flags */
59#define MAP_ANON MAP_ANONYMOUS 60#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-v850/atomic.h b/include/asm-v850/atomic.h
index bede3172ce7f..f5b9ab6f4e70 100644
--- a/include/asm-v850/atomic.h
+++ b/include/asm-v850/atomic.h
@@ -126,4 +126,5 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
126#define smp_mb__before_atomic_inc() barrier() 126#define smp_mb__before_atomic_inc() barrier()
127#define smp_mb__after_atomic_inc() barrier() 127#define smp_mb__after_atomic_inc() barrier()
128 128
129#include <asm-generic/atomic.h>
129#endif /* __V850_ATOMIC_H__ */ 130#endif /* __V850_ATOMIC_H__ */
diff --git a/include/asm-v850/bitops.h b/include/asm-v850/bitops.h
index b91e799763fd..8955d2376ac8 100644
--- a/include/asm-v850/bitops.h
+++ b/include/asm-v850/bitops.h
@@ -276,6 +276,7 @@ found_middle:
276 276
277#define ffs(x) generic_ffs (x) 277#define ffs(x) generic_ffs (x)
278#define fls(x) generic_fls (x) 278#define fls(x) generic_fls (x)
279#define fls64(x) generic_fls64(x)
279#define __ffs(x) ffs(x) 280#define __ffs(x) ffs(x)
280 281
281 282
diff --git a/include/asm-v850/mman.h b/include/asm-v850/mman.h
index e2b90081b56f..edc79965193a 100644
--- a/include/asm-v850/mman.h
+++ b/include/asm-v850/mman.h
@@ -32,6 +32,7 @@
32#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 32#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
33#define MADV_WILLNEED 0x3 /* pre-fault pages */ 33#define MADV_WILLNEED 0x3 /* pre-fault pages */
34#define MADV_DONTNEED 0x4 /* discard these pages */ 34#define MADV_DONTNEED 0x4 /* discard these pages */
35#define MADV_REMOVE 0x5 /* remove these pages & resources */
35 36
36/* compatibility flags */ 37/* compatibility flags */
37#define MAP_ANON MAP_ANONYMOUS 38#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-x86_64/atomic.h b/include/asm-x86_64/atomic.h
index 50db9f39274f..72eb071488c7 100644
--- a/include/asm-x86_64/atomic.h
+++ b/include/asm-x86_64/atomic.h
@@ -424,4 +424,5 @@ __asm__ __volatile__(LOCK "orl %0,%1" \
424#define smp_mb__before_atomic_inc() barrier() 424#define smp_mb__before_atomic_inc() barrier()
425#define smp_mb__after_atomic_inc() barrier() 425#define smp_mb__after_atomic_inc() barrier()
426 426
427#include <asm-generic/atomic.h>
427#endif 428#endif
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
index 05a0d374404b..a4d5d0909453 100644
--- a/include/asm-x86_64/bitops.h
+++ b/include/asm-x86_64/bitops.h
@@ -340,6 +340,20 @@ static __inline__ unsigned long __ffs(unsigned long word)
340 return word; 340 return word;
341} 341}
342 342
343/*
344 * __fls: find last bit set.
345 * @word: The word to search
346 *
347 * Undefined if no zero exists, so code should check against ~0UL first.
348 */
349static __inline__ unsigned long __fls(unsigned long word)
350{
351 __asm__("bsrq %1,%0"
352 :"=r" (word)
353 :"rm" (word));
354 return word;
355}
356
343#ifdef __KERNEL__ 357#ifdef __KERNEL__
344 358
345static inline int sched_find_first_bit(const unsigned long *b) 359static inline int sched_find_first_bit(const unsigned long *b)
@@ -370,6 +384,19 @@ static __inline__ int ffs(int x)
370} 384}
371 385
372/** 386/**
387 * fls64 - find last bit set in 64 bit word
388 * @x: the word to search
389 *
390 * This is defined the same way as fls.
391 */
392static __inline__ int fls64(__u64 x)
393{
394 if (x == 0)
395 return 0;
396 return __fls(x) + 1;
397}
398
399/**
373 * hweightN - returns the hamming weight of a N-bit word 400 * hweightN - returns the hamming weight of a N-bit word
374 * @x: the word to weigh 401 * @x: the word to weigh
375 * 402 *
diff --git a/include/asm-x86_64/cacheflush.h b/include/asm-x86_64/cacheflush.h
index b3189fb229d1..d32f7f58752a 100644
--- a/include/asm-x86_64/cacheflush.h
+++ b/include/asm-x86_64/cacheflush.h
@@ -27,4 +27,8 @@ void global_flush_tlb(void);
27int change_page_attr(struct page *page, int numpages, pgprot_t prot); 27int change_page_attr(struct page *page, int numpages, pgprot_t prot);
28int change_page_attr_addr(unsigned long addr, int numpages, pgprot_t prot); 28int change_page_attr_addr(unsigned long addr, int numpages, pgprot_t prot);
29 29
30#ifdef CONFIG_DEBUG_RODATA
31void mark_rodata_ro(void);
32#endif
33
30#endif /* _X8664_CACHEFLUSH_H */ 34#endif /* _X8664_CACHEFLUSH_H */
diff --git a/include/asm-x86_64/mman.h b/include/asm-x86_64/mman.h
index 78e60a4fd4ee..d0e97b74f735 100644
--- a/include/asm-x86_64/mman.h
+++ b/include/asm-x86_64/mman.h
@@ -36,6 +36,7 @@
36#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 36#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
37#define MADV_WILLNEED 0x3 /* pre-fault pages */ 37#define MADV_WILLNEED 0x3 /* pre-fault pages */
38#define MADV_DONTNEED 0x4 /* discard these pages */ 38#define MADV_DONTNEED 0x4 /* discard these pages */
39#define MADV_REMOVE 0x5 /* remove these pages & resources */
39 40
40/* compatibility flags */ 41/* compatibility flags */
41#define MAP_ANON MAP_ANONYMOUS 42#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h
index ac59045e7bab..14fc3ddd9031 100644
--- a/include/asm-x86_64/mpspec.h
+++ b/include/asm-x86_64/mpspec.h
@@ -76,7 +76,7 @@ struct mpc_config_bus
76{ 76{
77 unsigned char mpc_type; 77 unsigned char mpc_type;
78 unsigned char mpc_busid; 78 unsigned char mpc_busid;
79 unsigned char mpc_bustype[6] __attribute((packed)); 79 unsigned char mpc_bustype[6];
80}; 80};
81 81
82/* List of Bus Type string values, Intel MP Spec. */ 82/* List of Bus Type string values, Intel MP Spec. */
diff --git a/include/asm-x86_64/param.h b/include/asm-x86_64/param.h
index 40b11937180d..5956b23b57c2 100644
--- a/include/asm-x86_64/param.h
+++ b/include/asm-x86_64/param.h
@@ -1,9 +1,8 @@
1#include <linux/config.h>
2
3#ifndef _ASMx86_64_PARAM_H 1#ifndef _ASMx86_64_PARAM_H
4#define _ASMx86_64_PARAM_H 2#define _ASMx86_64_PARAM_H
5 3
6#ifdef __KERNEL__ 4#ifdef __KERNEL__
5# include <linux/config.h>
7# define HZ CONFIG_HZ /* Internal kernel timer frequency */ 6# define HZ CONFIG_HZ /* Internal kernel timer frequency */
8# define USER_HZ 100 /* .. some user interfaces are in "ticks */ 7# define USER_HZ 100 /* .. some user interfaces are in "ticks */
9#define CLOCKS_PER_SEC (USER_HZ) /* like times() */ 8#define CLOCKS_PER_SEC (USER_HZ) /* like times() */
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index ecf58c7c1650..02888d7a496f 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -122,6 +122,8 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long
122 122
123#define pte_same(a, b) ((a).pte == (b).pte) 123#define pte_same(a, b) ((a).pte == (b).pte)
124 124
125#define pte_pgprot(a) (__pgprot((a).pte & ~PHYSICAL_PAGE_MASK))
126
125#define PMD_SIZE (1UL << PMD_SHIFT) 127#define PMD_SIZE (1UL << PMD_SHIFT)
126#define PMD_MASK (~(PMD_SIZE-1)) 128#define PMD_MASK (~(PMD_SIZE-1))
127#define PUD_SIZE (1UL << PUD_SHIFT) 129#define PUD_SIZE (1UL << PUD_SHIFT)
diff --git a/include/asm-x86_64/rwlock.h b/include/asm-x86_64/rwlock.h
index 8a78a4ace53c..9942cc393064 100644
--- a/include/asm-x86_64/rwlock.h
+++ b/include/asm-x86_64/rwlock.h
@@ -64,7 +64,7 @@
64 ::"a" (rw) : "memory") 64 ::"a" (rw) : "memory")
65 65
66#define __build_write_lock_const(rw, helper) \ 66#define __build_write_lock_const(rw, helper) \
67 asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \ 67 asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",%0\n\t" \
68 "jnz 2f\n" \ 68 "jnz 2f\n" \
69 "1:\n" \ 69 "1:\n" \
70 LOCK_SECTION_START("") \ 70 LOCK_SECTION_START("") \
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
index 85348e02ad2e..b34cc2ee222b 100644
--- a/include/asm-x86_64/system.h
+++ b/include/asm-x86_64/system.h
@@ -315,6 +315,8 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
315#define local_irq_enable() __asm__ __volatile__("sti": : :"memory") 315#define local_irq_enable() __asm__ __volatile__("sti": : :"memory")
316/* used in the idle loop; sti takes one instruction cycle to complete */ 316/* used in the idle loop; sti takes one instruction cycle to complete */
317#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory") 317#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory")
318/* used when interrupts are already enabled or to shutdown the processor */
319#define halt() __asm__ __volatile__("hlt": : :"memory")
318 320
319#define irqs_disabled() \ 321#define irqs_disabled() \
320({ \ 322({ \
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h
index d39ebd5263ed..7d82bc56b9fa 100644
--- a/include/asm-x86_64/topology.h
+++ b/include/asm-x86_64/topology.h
@@ -23,7 +23,7 @@ extern int __node_distance(int, int);
23 23
24#define cpu_to_node(cpu) (cpu_to_node[cpu]) 24#define cpu_to_node(cpu) (cpu_to_node[cpu])
25#define parent_node(node) (node) 25#define parent_node(node) (node)
26#define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) 26#define node_to_first_cpu(node) (first_cpu(node_to_cpumask[node]))
27#define node_to_cpumask(node) (node_to_cpumask[node]) 27#define node_to_cpumask(node) (node_to_cpumask[node])
28#define pcibus_to_node(bus) ((long)(bus->sysdata)) 28#define pcibus_to_node(bus) ((long)(bus->sysdata))
29#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)); 29#define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus));
diff --git a/include/asm-xtensa/atomic.h b/include/asm-xtensa/atomic.h
index 3670cc7695da..e2ce06b101ad 100644
--- a/include/asm-xtensa/atomic.h
+++ b/include/asm-xtensa/atomic.h
@@ -286,6 +286,7 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
286#define smp_mb__before_atomic_inc() barrier() 286#define smp_mb__before_atomic_inc() barrier()
287#define smp_mb__after_atomic_inc() barrier() 287#define smp_mb__after_atomic_inc() barrier()
288 288
289#include <asm-generic/atomic.h>
289#endif /* __KERNEL__ */ 290#endif /* __KERNEL__ */
290 291
291#endif /* _XTENSA_ATOMIC_H */ 292#endif /* _XTENSA_ATOMIC_H */
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h
index e76ee889e21d..0a2065f1a372 100644
--- a/include/asm-xtensa/bitops.h
+++ b/include/asm-xtensa/bitops.h
@@ -245,6 +245,7 @@ static __inline__ int fls (unsigned int x)
245{ 245{
246 return __cntlz(x); 246 return __cntlz(x);
247} 247}
248#define fls64(x) generic_fls64(x)
248 249
249static __inline__ int 250static __inline__ int
250find_next_bit(const unsigned long *addr, int size, int offset) 251find_next_bit(const unsigned long *addr, int size, int offset)
diff --git a/include/asm-xtensa/mman.h b/include/asm-xtensa/mman.h
index 9a95a45df996..082a7504925e 100644
--- a/include/asm-xtensa/mman.h
+++ b/include/asm-xtensa/mman.h
@@ -72,6 +72,7 @@
72#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 72#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
73#define MADV_WILLNEED 0x3 /* pre-fault pages */ 73#define MADV_WILLNEED 0x3 /* pre-fault pages */
74#define MADV_DONTNEED 0x4 /* discard these pages */ 74#define MADV_DONTNEED 0x4 /* discard these pages */
75#define MADV_REMOVE 0x5 /* remove these pages & resources */
75 76
76/* compatibility flags */ 77/* compatibility flags */
77#define MAP_ANON MAP_ANONYMOUS 78#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/keys/user-type.h b/include/keys/user-type.h
index 26f6ec38577a..a3dae1803f45 100644
--- a/include/keys/user-type.h
+++ b/include/keys/user-type.h
@@ -35,7 +35,6 @@ struct user_key_payload {
35extern struct key_type key_type_user; 35extern struct key_type key_type_user;
36 36
37extern int user_instantiate(struct key *key, const void *data, size_t datalen); 37extern int user_instantiate(struct key *key, const void *data, size_t datalen);
38extern int user_duplicate(struct key *key, const struct key *source);
39extern int user_update(struct key *key, const void *data, size_t datalen); 38extern int user_update(struct key *key, const void *data, size_t datalen);
40extern int user_match(const struct key *key, const void *criterion); 39extern int user_match(const struct key *key, const void *criterion);
41extern void user_destroy(struct key *key); 40extern void user_destroy(struct key *key);
diff --git a/include/linux/ata.h b/include/linux/ata.h
index d2873b732bb1..94f77cce27fa 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -129,6 +129,7 @@ enum {
129 ATA_CMD_READ_EXT = 0x25, 129 ATA_CMD_READ_EXT = 0x25,
130 ATA_CMD_WRITE = 0xCA, 130 ATA_CMD_WRITE = 0xCA,
131 ATA_CMD_WRITE_EXT = 0x35, 131 ATA_CMD_WRITE_EXT = 0x35,
132 ATA_CMD_WRITE_FUA_EXT = 0x3D,
132 ATA_CMD_PIO_READ = 0x20, 133 ATA_CMD_PIO_READ = 0x20,
133 ATA_CMD_PIO_READ_EXT = 0x24, 134 ATA_CMD_PIO_READ_EXT = 0x24,
134 ATA_CMD_PIO_WRITE = 0x30, 135 ATA_CMD_PIO_WRITE = 0x30,
@@ -137,10 +138,13 @@ enum {
137 ATA_CMD_READ_MULTI_EXT = 0x29, 138 ATA_CMD_READ_MULTI_EXT = 0x29,
138 ATA_CMD_WRITE_MULTI = 0xC5, 139 ATA_CMD_WRITE_MULTI = 0xC5,
139 ATA_CMD_WRITE_MULTI_EXT = 0x39, 140 ATA_CMD_WRITE_MULTI_EXT = 0x39,
141 ATA_CMD_WRITE_MULTI_FUA_EXT = 0xCE,
140 ATA_CMD_SET_FEATURES = 0xEF, 142 ATA_CMD_SET_FEATURES = 0xEF,
141 ATA_CMD_PACKET = 0xA0, 143 ATA_CMD_PACKET = 0xA0,
142 ATA_CMD_VERIFY = 0x40, 144 ATA_CMD_VERIFY = 0x40,
143 ATA_CMD_VERIFY_EXT = 0x42, 145 ATA_CMD_VERIFY_EXT = 0x42,
146 ATA_CMD_STANDBYNOW1 = 0xE0,
147 ATA_CMD_IDLEIMMEDIATE = 0xE1,
144 ATA_CMD_INIT_DEV_PARAMS = 0x91, 148 ATA_CMD_INIT_DEV_PARAMS = 0x91,
145 149
146 /* SETFEATURES stuff */ 150 /* SETFEATURES stuff */
@@ -192,6 +196,7 @@ enum {
192 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */ 196 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
193 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ 197 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
194 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ 198 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
199 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
195}; 200};
196 201
197enum ata_tf_protocols { 202enum ata_tf_protocols {
@@ -245,7 +250,8 @@ struct ata_taskfile {
245#define ata_id_is_sata(id) ((id)[93] == 0) 250#define ata_id_is_sata(id) ((id)[93] == 0)
246#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) 251#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
247#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) 252#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
248#define ata_id_has_flush(id) ((id)[83] & (1 << 12)) 253#define ata_id_has_fua(id) ((id)[84] & (1 << 6))
254#define ata_id_has_flush(id) ((id)[83] & (1 << 12))
249#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13)) 255#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13))
250#define ata_id_has_lba48(id) ((id)[83] & (1 << 10)) 256#define ata_id_has_lba48(id) ((id)[83] & (1 << 10))
251#define ata_id_has_wcache(id) ((id)[82] & (1 << 5)) 257#define ata_id_has_wcache(id) ((id)[82] & (1 << 5))
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 685fd3720df5..b60ffe32cd21 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -292,6 +292,8 @@ extern struct bio *bio_clone(struct bio *, gfp_t);
292extern void bio_init(struct bio *); 292extern void bio_init(struct bio *);
293 293
294extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); 294extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
295extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *,
296 unsigned int, unsigned int);
295extern int bio_get_nr_vecs(struct block_device *); 297extern int bio_get_nr_vecs(struct block_device *);
296extern struct bio *bio_map_user(struct request_queue *, struct block_device *, 298extern struct bio *bio_map_user(struct request_queue *, struct block_device *,
297 unsigned long, unsigned int, int); 299 unsigned long, unsigned int, int);
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 38c2fb7ebe09..6a2a19f14bb2 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -76,6 +76,15 @@ static __inline__ int generic_fls(int x)
76 */ 76 */
77#include <asm/bitops.h> 77#include <asm/bitops.h>
78 78
79
80static inline int generic_fls64(__u64 x)
81{
82 __u32 h = x >> 32;
83 if (h)
84 return fls(x) + 32;
85 return fls(x);
86}
87
79static __inline__ int get_bitmask_order(unsigned int count) 88static __inline__ int get_bitmask_order(unsigned int count)
80{ 89{
81 int order; 90 int order;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index a33a31e71bbc..fb0985377421 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -102,7 +102,7 @@ void copy_io_context(struct io_context **pdst, struct io_context **psrc);
102void swap_io_context(struct io_context **ioc1, struct io_context **ioc2); 102void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
103 103
104struct request; 104struct request;
105typedef void (rq_end_io_fn)(struct request *); 105typedef void (rq_end_io_fn)(struct request *, int);
106 106
107struct request_list { 107struct request_list {
108 int count[2]; 108 int count[2];
@@ -184,6 +184,7 @@ struct request {
184 void *sense; 184 void *sense;
185 185
186 unsigned int timeout; 186 unsigned int timeout;
187 int retries;
187 188
188 /* 189 /*
189 * For Power Management requests 190 * For Power Management requests
@@ -206,6 +207,7 @@ enum rq_flag_bits {
206 __REQ_SORTED, /* elevator knows about this request */ 207 __REQ_SORTED, /* elevator knows about this request */
207 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ 208 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
208 __REQ_HARDBARRIER, /* may not be passed by drive either */ 209 __REQ_HARDBARRIER, /* may not be passed by drive either */
210 __REQ_FUA, /* forced unit access */
209 __REQ_CMD, /* is a regular fs rw request */ 211 __REQ_CMD, /* is a regular fs rw request */
210 __REQ_NOMERGE, /* don't touch this for merging */ 212 __REQ_NOMERGE, /* don't touch this for merging */
211 __REQ_STARTED, /* drive already may have started this one */ 213 __REQ_STARTED, /* drive already may have started this one */
@@ -229,9 +231,7 @@ enum rq_flag_bits {
229 __REQ_PM_SUSPEND, /* suspend request */ 231 __REQ_PM_SUSPEND, /* suspend request */
230 __REQ_PM_RESUME, /* resume request */ 232 __REQ_PM_RESUME, /* resume request */
231 __REQ_PM_SHUTDOWN, /* shutdown request */ 233 __REQ_PM_SHUTDOWN, /* shutdown request */
232 __REQ_BAR_PREFLUSH, /* barrier pre-flush done */ 234 __REQ_ORDERED_COLOR, /* is before or after barrier */
233 __REQ_BAR_POSTFLUSH, /* barrier post-flush */
234 __REQ_BAR_FLUSH, /* rq is the flush request */
235 __REQ_NR_BITS, /* stops here */ 235 __REQ_NR_BITS, /* stops here */
236}; 236};
237 237
@@ -240,6 +240,7 @@ enum rq_flag_bits {
240#define REQ_SORTED (1 << __REQ_SORTED) 240#define REQ_SORTED (1 << __REQ_SORTED)
241#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) 241#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
242#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) 242#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
243#define REQ_FUA (1 << __REQ_FUA)
243#define REQ_CMD (1 << __REQ_CMD) 244#define REQ_CMD (1 << __REQ_CMD)
244#define REQ_NOMERGE (1 << __REQ_NOMERGE) 245#define REQ_NOMERGE (1 << __REQ_NOMERGE)
245#define REQ_STARTED (1 << __REQ_STARTED) 246#define REQ_STARTED (1 << __REQ_STARTED)
@@ -259,9 +260,7 @@ enum rq_flag_bits {
259#define REQ_PM_SUSPEND (1 << __REQ_PM_SUSPEND) 260#define REQ_PM_SUSPEND (1 << __REQ_PM_SUSPEND)
260#define REQ_PM_RESUME (1 << __REQ_PM_RESUME) 261#define REQ_PM_RESUME (1 << __REQ_PM_RESUME)
261#define REQ_PM_SHUTDOWN (1 << __REQ_PM_SHUTDOWN) 262#define REQ_PM_SHUTDOWN (1 << __REQ_PM_SHUTDOWN)
262#define REQ_BAR_PREFLUSH (1 << __REQ_BAR_PREFLUSH) 263#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
263#define REQ_BAR_POSTFLUSH (1 << __REQ_BAR_POSTFLUSH)
264#define REQ_BAR_FLUSH (1 << __REQ_BAR_FLUSH)
265 264
266/* 265/*
267 * State information carried for REQ_PM_SUSPEND and REQ_PM_RESUME 266 * State information carried for REQ_PM_SUSPEND and REQ_PM_RESUME
@@ -291,8 +290,7 @@ struct bio_vec;
291typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *); 290typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *);
292typedef void (activity_fn) (void *data, int rw); 291typedef void (activity_fn) (void *data, int rw);
293typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *); 292typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *);
294typedef int (prepare_flush_fn) (request_queue_t *, struct request *); 293typedef void (prepare_flush_fn) (request_queue_t *, struct request *);
295typedef void (end_flush_fn) (request_queue_t *, struct request *);
296 294
297enum blk_queue_state { 295enum blk_queue_state {
298 Queue_down, 296 Queue_down,
@@ -334,7 +332,6 @@ struct request_queue
334 activity_fn *activity_fn; 332 activity_fn *activity_fn;
335 issue_flush_fn *issue_flush_fn; 333 issue_flush_fn *issue_flush_fn;
336 prepare_flush_fn *prepare_flush_fn; 334 prepare_flush_fn *prepare_flush_fn;
337 end_flush_fn *end_flush_fn;
338 335
339 /* 336 /*
340 * Dispatch queue sorting 337 * Dispatch queue sorting
@@ -419,14 +416,11 @@ struct request_queue
419 /* 416 /*
420 * reserved for flush operations 417 * reserved for flush operations
421 */ 418 */
422 struct request *flush_rq; 419 unsigned int ordered, next_ordered, ordseq;
423 unsigned char ordered; 420 int orderr, ordcolor;
424}; 421 struct request pre_flush_rq, bar_rq, post_flush_rq;
425 422 struct request *orig_bar_rq;
426enum { 423 unsigned int bi_size;
427 QUEUE_ORDERED_NONE,
428 QUEUE_ORDERED_TAG,
429 QUEUE_ORDERED_FLUSH,
430}; 424};
431 425
432#define RQ_INACTIVE (-1) 426#define RQ_INACTIVE (-1)
@@ -444,12 +438,51 @@ enum {
444#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ 438#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */
445#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ 439#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */
446#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ 440#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */
447#define QUEUE_FLAG_FLUSH 9 /* doing barrier flush sequence */ 441
442enum {
443 /*
444 * Hardbarrier is supported with one of the following methods.
445 *
446 * NONE : hardbarrier unsupported
447 * DRAIN : ordering by draining is enough
448 * DRAIN_FLUSH : ordering by draining w/ pre and post flushes
449 * DRAIN_FUA : ordering by draining w/ pre flush and FUA write
450 * TAG : ordering by tag is enough
451 * TAG_FLUSH : ordering by tag w/ pre and post flushes
452 * TAG_FUA : ordering by tag w/ pre flush and FUA write
453 */
454 QUEUE_ORDERED_NONE = 0x00,
455 QUEUE_ORDERED_DRAIN = 0x01,
456 QUEUE_ORDERED_TAG = 0x02,
457
458 QUEUE_ORDERED_PREFLUSH = 0x10,
459 QUEUE_ORDERED_POSTFLUSH = 0x20,
460 QUEUE_ORDERED_FUA = 0x40,
461
462 QUEUE_ORDERED_DRAIN_FLUSH = QUEUE_ORDERED_DRAIN |
463 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH,
464 QUEUE_ORDERED_DRAIN_FUA = QUEUE_ORDERED_DRAIN |
465 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA,
466 QUEUE_ORDERED_TAG_FLUSH = QUEUE_ORDERED_TAG |
467 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH,
468 QUEUE_ORDERED_TAG_FUA = QUEUE_ORDERED_TAG |
469 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA,
470
471 /*
472 * Ordered operation sequence
473 */
474 QUEUE_ORDSEQ_STARTED = 0x01, /* flushing in progress */
475 QUEUE_ORDSEQ_DRAIN = 0x02, /* waiting for the queue to be drained */
476 QUEUE_ORDSEQ_PREFLUSH = 0x04, /* pre-flushing in progress */
477 QUEUE_ORDSEQ_BAR = 0x08, /* original barrier req in progress */
478 QUEUE_ORDSEQ_POSTFLUSH = 0x10, /* post-flushing in progress */
479 QUEUE_ORDSEQ_DONE = 0x20,
480};
448 481
449#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) 482#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
450#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 483#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
451#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 484#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
452#define blk_queue_flushing(q) test_bit(QUEUE_FLAG_FLUSH, &(q)->queue_flags) 485#define blk_queue_flushing(q) ((q)->ordseq)
453 486
454#define blk_fs_request(rq) ((rq)->flags & REQ_CMD) 487#define blk_fs_request(rq) ((rq)->flags & REQ_CMD)
455#define blk_pc_request(rq) ((rq)->flags & REQ_BLOCK_PC) 488#define blk_pc_request(rq) ((rq)->flags & REQ_BLOCK_PC)
@@ -465,8 +498,7 @@ enum {
465 498
466#define blk_sorted_rq(rq) ((rq)->flags & REQ_SORTED) 499#define blk_sorted_rq(rq) ((rq)->flags & REQ_SORTED)
467#define blk_barrier_rq(rq) ((rq)->flags & REQ_HARDBARRIER) 500#define blk_barrier_rq(rq) ((rq)->flags & REQ_HARDBARRIER)
468#define blk_barrier_preflush(rq) ((rq)->flags & REQ_BAR_PREFLUSH) 501#define blk_fua_rq(rq) ((rq)->flags & REQ_FUA)
469#define blk_barrier_postflush(rq) ((rq)->flags & REQ_BAR_POSTFLUSH)
470 502
471#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) 503#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
472 504
@@ -558,7 +590,8 @@ extern void blk_unregister_queue(struct gendisk *disk);
558extern void register_disk(struct gendisk *dev); 590extern void register_disk(struct gendisk *dev);
559extern void generic_make_request(struct bio *bio); 591extern void generic_make_request(struct bio *bio);
560extern void blk_put_request(struct request *); 592extern void blk_put_request(struct request *);
561extern void blk_end_sync_rq(struct request *rq); 593extern void __blk_put_request(request_queue_t *, struct request *);
594extern void blk_end_sync_rq(struct request *rq, int error);
562extern void blk_attempt_remerge(request_queue_t *, struct request *); 595extern void blk_attempt_remerge(request_queue_t *, struct request *);
563extern struct request *blk_get_request(request_queue_t *, int, gfp_t); 596extern struct request *blk_get_request(request_queue_t *, int, gfp_t);
564extern void blk_insert_request(request_queue_t *, struct request *, int, void *); 597extern void blk_insert_request(request_queue_t *, struct request *, int, void *);
@@ -579,6 +612,9 @@ extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned
579extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int); 612extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int);
580extern int blk_execute_rq(request_queue_t *, struct gendisk *, 613extern int blk_execute_rq(request_queue_t *, struct gendisk *,
581 struct request *, int); 614 struct request *, int);
615extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *,
616 struct request *, int, rq_end_io_fn *);
617
582static inline request_queue_t *bdev_get_queue(struct block_device *bdev) 618static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
583{ 619{
584 return bdev->bd_disk->queue; 620 return bdev->bd_disk->queue;
@@ -608,7 +644,7 @@ static inline void blk_run_address_space(struct address_space *mapping)
608 */ 644 */
609extern int end_that_request_first(struct request *, int, int); 645extern int end_that_request_first(struct request *, int, int);
610extern int end_that_request_chunk(struct request *, int, int); 646extern int end_that_request_chunk(struct request *, int, int);
611extern void end_that_request_last(struct request *); 647extern void end_that_request_last(struct request *, int);
612extern void end_request(struct request *req, int uptodate); 648extern void end_request(struct request *req, int uptodate);
613 649
614/* 650/*
@@ -659,11 +695,12 @@ extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn);
659extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *); 695extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *);
660extern void blk_queue_dma_alignment(request_queue_t *, int); 696extern void blk_queue_dma_alignment(request_queue_t *, int);
661extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 697extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
662extern void blk_queue_ordered(request_queue_t *, int); 698extern int blk_queue_ordered(request_queue_t *, unsigned, prepare_flush_fn *);
663extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *); 699extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *);
664extern struct request *blk_start_pre_flush(request_queue_t *,struct request *); 700extern int blk_do_ordered(request_queue_t *, struct request **);
665extern int blk_complete_barrier_rq(request_queue_t *, struct request *, int); 701extern unsigned blk_ordered_cur_seq(request_queue_t *);
666extern int blk_complete_barrier_rq_locked(request_queue_t *, struct request *, int); 702extern unsigned blk_ordered_req_seq(struct request *);
703extern void blk_ordered_complete_seq(request_queue_t *, unsigned, int);
667 704
668extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *); 705extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *);
669extern void blk_dump_rq_flags(struct request *, char *); 706extern void blk_dump_rq_flags(struct request *, char *);
@@ -696,7 +733,8 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *);
696 733
697#define MAX_PHYS_SEGMENTS 128 734#define MAX_PHYS_SEGMENTS 128
698#define MAX_HW_SEGMENTS 128 735#define MAX_HW_SEGMENTS 128
699#define MAX_SECTORS 255 736#define SAFE_MAX_SECTORS 255
737#define BLK_DEF_MAX_SECTORS 1024
700 738
701#define MAX_SEGMENT_SIZE 65536 739#define MAX_SEGMENT_SIZE 65536
702 740
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 3b03b0b868dd..993da8cc9706 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -43,50 +43,38 @@ typedef struct bootmem_data {
43extern unsigned long __init bootmem_bootmap_pages (unsigned long); 43extern unsigned long __init bootmem_bootmap_pages (unsigned long);
44extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend); 44extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend);
45extern void __init free_bootmem (unsigned long addr, unsigned long size); 45extern void __init free_bootmem (unsigned long addr, unsigned long size);
46extern void * __init __alloc_bootmem_limit (unsigned long size, unsigned long align, unsigned long goal, unsigned long limit); 46extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal);
47extern void * __init __alloc_bootmem_low(unsigned long size,
48 unsigned long align,
49 unsigned long goal);
50extern void * __init __alloc_bootmem_low_node(pg_data_t *pgdat,
51 unsigned long size,
52 unsigned long align,
53 unsigned long goal);
47#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 54#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
48extern void __init reserve_bootmem (unsigned long addr, unsigned long size); 55extern void __init reserve_bootmem (unsigned long addr, unsigned long size);
49#define alloc_bootmem(x) \ 56#define alloc_bootmem(x) \
50 __alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 57 __alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
51#define alloc_bootmem_low(x) \ 58#define alloc_bootmem_low(x) \
52 __alloc_bootmem((x), SMP_CACHE_BYTES, 0) 59 __alloc_bootmem_low((x), SMP_CACHE_BYTES, 0)
53#define alloc_bootmem_pages(x) \ 60#define alloc_bootmem_pages(x) \
54 __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 61 __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
55#define alloc_bootmem_low_pages(x) \ 62#define alloc_bootmem_low_pages(x) \
56 __alloc_bootmem((x), PAGE_SIZE, 0) 63 __alloc_bootmem_low((x), PAGE_SIZE, 0)
57
58#define alloc_bootmem_limit(x, limit) \
59 __alloc_bootmem_limit((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS), (limit))
60#define alloc_bootmem_low_limit(x, limit) \
61 __alloc_bootmem_limit((x), SMP_CACHE_BYTES, 0, (limit))
62#define alloc_bootmem_pages_limit(x, limit) \
63 __alloc_bootmem_limit((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS), (limit))
64#define alloc_bootmem_low_pages_limit(x, limit) \
65 __alloc_bootmem_limit((x), PAGE_SIZE, 0, (limit))
66
67#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 64#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
68extern unsigned long __init free_all_bootmem (void); 65extern unsigned long __init free_all_bootmem (void);
69 66extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal);
70extern unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn); 67extern unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn);
71extern void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size); 68extern void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size);
72extern void __init free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size); 69extern void __init free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size);
73extern unsigned long __init free_all_bootmem_node (pg_data_t *pgdat); 70extern unsigned long __init free_all_bootmem_node (pg_data_t *pgdat);
74extern void * __init __alloc_bootmem_node_limit (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal, unsigned long limit);
75#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 71#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
76#define alloc_bootmem_node(pgdat, x) \ 72#define alloc_bootmem_node(pgdat, x) \
77 __alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 73 __alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
78#define alloc_bootmem_pages_node(pgdat, x) \ 74#define alloc_bootmem_pages_node(pgdat, x) \
79 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 75 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
80#define alloc_bootmem_low_pages_node(pgdat, x) \ 76#define alloc_bootmem_low_pages_node(pgdat, x) \
81 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0) 77 __alloc_bootmem_low_node((pgdat), (x), PAGE_SIZE, 0)
82
83#define alloc_bootmem_node_limit(pgdat, x, limit) \
84 __alloc_bootmem_node_limit((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS), (limit))
85#define alloc_bootmem_pages_node_limit(pgdat, x, limit) \
86 __alloc_bootmem_node_limit((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS), (limit))
87#define alloc_bootmem_low_pages_node_limit(pgdat, x, limit) \
88 __alloc_bootmem_node_limit((pgdat), (x), PAGE_SIZE, 0, (limit))
89
90#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 78#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
91 79
92#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP 80#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
@@ -123,15 +111,5 @@ extern void *__init alloc_large_system_hash(const char *tablename,
123#endif 111#endif
124extern int __initdata hashdist; /* Distribute hashes across NUMA nodes? */ 112extern int __initdata hashdist; /* Distribute hashes across NUMA nodes? */
125 113
126static inline void *__alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal)
127{
128 return __alloc_bootmem_limit(size, align, goal, 0);
129}
130
131static inline void *__alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align,
132 unsigned long goal)
133{
134 return __alloc_bootmem_node_limit(pgdat, size, align, goal, 0);
135}
136 114
137#endif /* _LINUX_BOOTMEM_H */ 115#endif /* _LINUX_BOOTMEM_H */
diff --git a/include/linux/cache.h b/include/linux/cache.h
index f6b5a46c5f82..0b7ecf3af78a 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -13,7 +13,7 @@
13#define SMP_CACHE_BYTES L1_CACHE_BYTES 13#define SMP_CACHE_BYTES L1_CACHE_BYTES
14#endif 14#endif
15 15
16#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) 16#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64)
17#define __read_mostly __attribute__((__section__(".data.read_mostly"))) 17#define __read_mostly __attribute__((__section__(".data.read_mostly")))
18#else 18#else
19#define __read_mostly 19#define __read_mostly
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index c948f678e04e..1417de935057 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -26,6 +26,7 @@
26#define CN_PROC_H 26#define CN_PROC_H
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/time.h>
29#include <linux/connector.h> 30#include <linux/connector.h>
30 31
31/* 32/*
@@ -65,6 +66,7 @@ struct proc_event {
65 PROC_EVENT_EXIT = 0x80000000 66 PROC_EVENT_EXIT = 0x80000000
66 } what; 67 } what;
67 __u32 cpu; 68 __u32 cpu;
69 struct timespec timestamp;
68 union { /* must be last field of proc_event struct */ 70 union { /* must be last field of proc_event struct */
69 struct { 71 struct {
70 __u32 err; 72 __u32 err;
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
new file mode 100644
index 000000000000..acffb8c9073a
--- /dev/null
+++ b/include/linux/configfs.h
@@ -0,0 +1,205 @@
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * configfs.h - definitions for the device driver filesystem
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 021110-1307, USA.
20 *
21 * Based on sysfs:
22 * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
23 *
24 * Based on kobject.h:
25 * Copyright (c) 2002-2003 Patrick Mochel
26 * Copyright (c) 2002-2003 Open Source Development Labs
27 *
28 * configfs Copyright (C) 2005 Oracle. All rights reserved.
29 *
30 * Please read Documentation/filesystems/configfs.txt before using the
31 * configfs interface, ESPECIALLY the parts about reference counts and
32 * item destructors.
33 */
34
35#ifndef _CONFIGFS_H_
36#define _CONFIGFS_H_
37
38#ifdef __KERNEL__
39
40#include <linux/types.h>
41#include <linux/list.h>
42#include <linux/kref.h>
43
44#include <asm/atomic.h>
45#include <asm/semaphore.h>
46
47#define CONFIGFS_ITEM_NAME_LEN 20
48
49struct module;
50
51struct configfs_item_operations;
52struct configfs_group_operations;
53struct configfs_attribute;
54struct configfs_subsystem;
55
56struct config_item {
57 char *ci_name;
58 char ci_namebuf[CONFIGFS_ITEM_NAME_LEN];
59 struct kref ci_kref;
60 struct list_head ci_entry;
61 struct config_item *ci_parent;
62 struct config_group *ci_group;
63 struct config_item_type *ci_type;
64 struct dentry *ci_dentry;
65};
66
67extern int config_item_set_name(struct config_item *, const char *, ...);
68
69static inline char *config_item_name(struct config_item * item)
70{
71 return item->ci_name;
72}
73
74extern void config_item_init(struct config_item *);
75extern void config_item_init_type_name(struct config_item *item,
76 const char *name,
77 struct config_item_type *type);
78extern void config_item_cleanup(struct config_item *);
79
80extern struct config_item * config_item_get(struct config_item *);
81extern void config_item_put(struct config_item *);
82
83struct config_item_type {
84 struct module *ct_owner;
85 struct configfs_item_operations *ct_item_ops;
86 struct configfs_group_operations *ct_group_ops;
87 struct configfs_attribute **ct_attrs;
88};
89
90
91/**
92 * group - a group of config_items of a specific type, belonging
93 * to a specific subsystem.
94 */
95
96struct config_group {
97 struct config_item cg_item;
98 struct list_head cg_children;
99 struct configfs_subsystem *cg_subsys;
100 struct config_group **default_groups;
101};
102
103
104extern void config_group_init(struct config_group *group);
105extern void config_group_init_type_name(struct config_group *group,
106 const char *name,
107 struct config_item_type *type);
108
109
110static inline struct config_group *to_config_group(struct config_item *item)
111{
112 return item ? container_of(item,struct config_group,cg_item) : NULL;
113}
114
115static inline struct config_group *config_group_get(struct config_group *group)
116{
117 return group ? to_config_group(config_item_get(&group->cg_item)) : NULL;
118}
119
120static inline void config_group_put(struct config_group *group)
121{
122 config_item_put(&group->cg_item);
123}
124
125extern struct config_item *config_group_find_obj(struct config_group *, const char *);
126
127
128struct configfs_attribute {
129 char *ca_name;
130 struct module *ca_owner;
131 mode_t ca_mode;
132};
133
134
135/*
136 * If allow_link() exists, the item can symlink(2) out to other
137 * items. If the item is a group, it may support mkdir(2).
138 * Groups supply one of make_group() and make_item(). If the
139 * group supports make_group(), one can create group children. If it
140 * supports make_item(), one can create config_item children. If it has
141 * default_groups on group->default_groups, it has automatically created
142 * group children. default_groups may coexist alongsize make_group() or
143 * make_item(), but if the group wishes to have only default_groups
144 * children (disallowing mkdir(2)), it need not provide either function.
145 * If the group has commit(), it supports pending and commited (active)
146 * items.
147 */
148struct configfs_item_operations {
149 void (*release)(struct config_item *);
150 ssize_t (*show_attribute)(struct config_item *, struct configfs_attribute *,char *);
151 ssize_t (*store_attribute)(struct config_item *,struct configfs_attribute *,const char *, size_t);
152 int (*allow_link)(struct config_item *src, struct config_item *target);
153 int (*drop_link)(struct config_item *src, struct config_item *target);
154};
155
156struct configfs_group_operations {
157 struct config_item *(*make_item)(struct config_group *group, const char *name);
158 struct config_group *(*make_group)(struct config_group *group, const char *name);
159 int (*commit_item)(struct config_item *item);
160 void (*drop_item)(struct config_group *group, struct config_item *item);
161};
162
163
164
165/**
166 * Use these macros to make defining attributes easier. See include/linux/device.h
167 * for examples..
168 */
169
170#if 0
171#define __ATTR(_name,_mode,_show,_store) { \
172 .attr = {.ca_name = __stringify(_name), .ca_mode = _mode, .ca_owner = THIS_MODULE }, \
173 .show = _show, \
174 .store = _store, \
175}
176
177#define __ATTR_RO(_name) { \
178 .attr = { .ca_name = __stringify(_name), .ca_mode = 0444, .ca_owner = THIS_MODULE }, \
179 .show = _name##_show, \
180}
181
182#define __ATTR_NULL { .attr = { .name = NULL } }
183
184#define attr_name(_attr) (_attr).attr.name
185#endif
186
187
188struct configfs_subsystem {
189 struct config_group su_group;
190 struct semaphore su_sem;
191};
192
193static inline struct configfs_subsystem *to_configfs_subsystem(struct config_group *group)
194{
195 return group ?
196 container_of(group, struct configfs_subsystem, su_group) :
197 NULL;
198}
199
200int configfs_register_subsystem(struct configfs_subsystem *subsys);
201void configfs_unregister_subsystem(struct configfs_subsystem *subsys);
202
203#endif /* __KERNEL__ */
204
205#endif /* _CONFIGFS_H_ */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index d068176b7ad7..c31650df9241 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -256,6 +256,16 @@ int cpufreq_update_policy(unsigned int cpu);
256/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ 256/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */
257unsigned int cpufreq_get(unsigned int cpu); 257unsigned int cpufreq_get(unsigned int cpu);
258 258
259/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */
260#ifdef CONFIG_CPU_FREQ
261unsigned int cpufreq_quick_get(unsigned int cpu);
262#else
263static inline unsigned int cpufreq_quick_get(unsigned int cpu)
264{
265 return 0;
266}
267#endif
268
259 269
260/********************************************************************* 270/*********************************************************************
261 * CPUFREQ DEFAULT GOVERNOR * 271 * CPUFREQ DEFAULT GOVERNOR *
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 71fab4311e92..088529f54965 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -192,10 +192,9 @@ enum {
192#include <linux/workqueue.h> 192#include <linux/workqueue.h>
193 193
194#include <net/inet_connection_sock.h> 194#include <net/inet_connection_sock.h>
195#include <net/inet_sock.h>
195#include <net/inet_timewait_sock.h> 196#include <net/inet_timewait_sock.h>
196#include <net/sock.h>
197#include <net/tcp_states.h> 197#include <net/tcp_states.h>
198#include <net/tcp.h>
199 198
200enum dccp_state { 199enum dccp_state {
201 DCCP_OPEN = TCP_ESTABLISHED, 200 DCCP_OPEN = TCP_ESTABLISHED,
@@ -408,8 +407,6 @@ struct dccp_ackvec;
408 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss 407 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss
409 * @dccps_timestamp_time - time of latest TIMESTAMP option 408 * @dccps_timestamp_time - time of latest TIMESTAMP option
410 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option 409 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
411 * @dccps_ext_header_len - network protocol overhead (IP/IPv6 options)
412 * @dccps_pmtu_cookie - Last pmtu seen by socket
413 * @dccps_packet_size - Set thru setsockopt 410 * @dccps_packet_size - Set thru setsockopt
414 * @dccps_role - Role of this sock, one of %dccp_role 411 * @dccps_role - Role of this sock, one of %dccp_role
415 * @dccps_ndp_count - number of Non Data Packets since last data packet 412 * @dccps_ndp_count - number of Non Data Packets since last data packet
@@ -434,8 +431,6 @@ struct dccp_sock {
434 __u32 dccps_timestamp_echo; 431 __u32 dccps_timestamp_echo;
435 __u32 dccps_packet_size; 432 __u32 dccps_packet_size;
436 unsigned long dccps_ndp_count; 433 unsigned long dccps_ndp_count;
437 __u16 dccps_ext_header_len;
438 __u32 dccps_pmtu_cookie;
439 __u32 dccps_mss_cache; 434 __u32 dccps_mss_cache;
440 struct dccp_options dccps_options; 435 struct dccp_options dccps_options;
441 struct dccp_ackvec *dccps_hc_rx_ackvec; 436 struct dccp_ackvec *dccps_hc_rx_ackvec;
diff --git a/include/linux/device.h b/include/linux/device.h
index 17cbc6db67b4..0cdee78e5ce1 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -47,8 +47,8 @@ struct bus_type {
47 struct driver_attribute * drv_attrs; 47 struct driver_attribute * drv_attrs;
48 48
49 int (*match)(struct device * dev, struct device_driver * drv); 49 int (*match)(struct device * dev, struct device_driver * drv);
50 int (*hotplug) (struct device *dev, char **envp, 50 int (*uevent)(struct device *dev, char **envp,
51 int num_envp, char *buffer, int buffer_size); 51 int num_envp, char *buffer, int buffer_size);
52 int (*suspend)(struct device * dev, pm_message_t state); 52 int (*suspend)(struct device * dev, pm_message_t state);
53 int (*resume)(struct device * dev); 53 int (*resume)(struct device * dev);
54}; 54};
@@ -151,7 +151,7 @@ struct class {
151 struct class_attribute * class_attrs; 151 struct class_attribute * class_attrs;
152 struct class_device_attribute * class_dev_attrs; 152 struct class_device_attribute * class_dev_attrs;
153 153
154 int (*hotplug)(struct class_device *dev, char **envp, 154 int (*uevent)(struct class_device *dev, char **envp,
155 int num_envp, char *buffer, int buffer_size); 155 int num_envp, char *buffer, int buffer_size);
156 156
157 void (*release)(struct class_device *dev); 157 void (*release)(struct class_device *dev);
@@ -209,9 +209,9 @@ extern int class_device_create_file(struct class_device *,
209 * set, this will be called instead of the class specific release function. 209 * set, this will be called instead of the class specific release function.
210 * Only use this if you want to override the default release function, like 210 * Only use this if you want to override the default release function, like
211 * when you are nesting class_device structures. 211 * when you are nesting class_device structures.
212 * @hotplug: pointer to a hotplug function for this struct class_device. If 212 * @uevent: pointer to a uevent function for this struct class_device. If
213 * set, this will be called instead of the class specific hotplug function. 213 * set, this will be called instead of the class specific uevent function.
214 * Only use this if you want to override the default hotplug function, like 214 * Only use this if you want to override the default uevent function, like
215 * when you are nesting class_device structures. 215 * when you are nesting class_device structures.
216 */ 216 */
217struct class_device { 217struct class_device {
@@ -227,7 +227,7 @@ struct class_device {
227 struct class_device *parent; /* parent of this child device, if there is one */ 227 struct class_device *parent; /* parent of this child device, if there is one */
228 228
229 void (*release)(struct class_device *dev); 229 void (*release)(struct class_device *dev);
230 int (*hotplug)(struct class_device *dev, char **envp, 230 int (*uevent)(struct class_device *dev, char **envp,
231 int num_envp, char *buffer, int buffer_size); 231 int num_envp, char *buffer, int buffer_size);
232 char class_id[BUS_ID_SIZE]; /* unique to this class */ 232 char class_id[BUS_ID_SIZE]; /* unique to this class */
233}; 233};
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index f5eb6b6cd109..fa75ba0d635e 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -272,9 +272,9 @@ typedef char ioctl_struct[308];
272#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) 272#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
273 273
274#define DM_VERSION_MAJOR 4 274#define DM_VERSION_MAJOR 4
275#define DM_VERSION_MINOR 4 275#define DM_VERSION_MINOR 5
276#define DM_VERSION_PATCHLEVEL 0 276#define DM_VERSION_PATCHLEVEL 0
277#define DM_VERSION_EXTRA "-ioctl (2005-01-12)" 277#define DM_VERSION_EXTRA "-ioctl (2005-10-04)"
278 278
279/* Status bits */ 279/* Status bits */
280#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 280#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -301,8 +301,13 @@ typedef char ioctl_struct[308];
301#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */ 301#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */
302 302
303/* 303/*
304 * Set this to improve performance when you aren't going to use open_count 304 * Set this to improve performance when you aren't going to use open_count.
305 */ 305 */
306#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */ 306#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */
307 307
308/*
309 * Set this to avoid attempting to freeze any filesystem when suspending.
310 */
311#define DM_SKIP_LOCKFS_FLAG (1 << 10) /* In */
312
308#endif /* _LINUX_DM_IOCTL_H */ 313#endif /* _LINUX_DM_IOCTL_H */
diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h
index cc314443f1c4..2b8797084685 100644
--- a/include/linux/dvb/audio.h
+++ b/include/linux/dvb/audio.h
@@ -32,39 +32,39 @@
32 32
33 33
34typedef enum { 34typedef enum {
35 AUDIO_SOURCE_DEMUX, /* Select the demux as the main source */ 35 AUDIO_SOURCE_DEMUX, /* Select the demux as the main source */
36 AUDIO_SOURCE_MEMORY /* Select internal memory as the main source */ 36 AUDIO_SOURCE_MEMORY /* Select internal memory as the main source */
37} audio_stream_source_t; 37} audio_stream_source_t;
38 38
39 39
40typedef enum { 40typedef enum {
41 AUDIO_STOPPED, /* Device is stopped */ 41 AUDIO_STOPPED, /* Device is stopped */
42 AUDIO_PLAYING, /* Device is currently playing */ 42 AUDIO_PLAYING, /* Device is currently playing */
43 AUDIO_PAUSED /* Device is paused */ 43 AUDIO_PAUSED /* Device is paused */
44} audio_play_state_t; 44} audio_play_state_t;
45 45
46 46
47typedef enum { 47typedef enum {
48 AUDIO_STEREO, 48 AUDIO_STEREO,
49 AUDIO_MONO_LEFT, 49 AUDIO_MONO_LEFT,
50 AUDIO_MONO_RIGHT 50 AUDIO_MONO_RIGHT
51} audio_channel_select_t; 51} audio_channel_select_t;
52 52
53 53
54typedef struct audio_mixer { 54typedef struct audio_mixer {
55 unsigned int volume_left; 55 unsigned int volume_left;
56 unsigned int volume_right; 56 unsigned int volume_right;
57 // what else do we need? bass, pass-through, ... 57 // what else do we need? bass, pass-through, ...
58} audio_mixer_t; 58} audio_mixer_t;
59 59
60 60
61typedef struct audio_status { 61typedef struct audio_status {
62 int AV_sync_state; /* sync audio and video? */ 62 int AV_sync_state; /* sync audio and video? */
63 int mute_state; /* audio is muted */ 63 int mute_state; /* audio is muted */
64 audio_play_state_t play_state; /* current playback state */ 64 audio_play_state_t play_state; /* current playback state */
65 audio_stream_source_t stream_source; /* current stream source */ 65 audio_stream_source_t stream_source; /* current stream source */
66 audio_channel_select_t channel_select; /* currently selected channel */ 66 audio_channel_select_t channel_select; /* currently selected channel */
67 int bypass_mode; /* pass on audio data to */ 67 int bypass_mode; /* pass on audio data to */
68 audio_mixer_t mixer_state; /* current mixer state */ 68 audio_mixer_t mixer_state; /* current mixer state */
69} audio_status_t; /* separate decoder hardware */ 69} audio_status_t; /* separate decoder hardware */
70 70
@@ -74,8 +74,8 @@ struct audio_karaoke{ /* if Vocal1 or Vocal2 are non-zero, they get mixed */
74 int vocal1; /* into left and right t at 70% each */ 74 int vocal1; /* into left and right t at 70% each */
75 int vocal2; /* if both, Vocal1 and Vocal2 are non-zero, Vocal1 gets*/ 75 int vocal2; /* if both, Vocal1 and Vocal2 are non-zero, Vocal1 gets*/
76 int melody; /* mixed into the left channel and */ 76 int melody; /* mixed into the left channel and */
77 /* Vocal2 into the right channel at 100% each. */ 77 /* Vocal2 into the right channel at 100% each. */
78 /* if Melody is non-zero, the melody channel gets mixed*/ 78 /* if Melody is non-zero, the melody channel gets mixed*/
79} audio_karaoke_t; /* into left and right */ 79} audio_karaoke_t; /* into left and right */
80 80
81 81
diff --git a/include/linux/dvb/ca.h b/include/linux/dvb/ca.h
index 558af0cc7692..c18537f3e449 100644
--- a/include/linux/dvb/ca.h
+++ b/include/linux/dvb/ca.h
@@ -27,16 +27,16 @@
27/* slot interface types and info */ 27/* slot interface types and info */
28 28
29typedef struct ca_slot_info { 29typedef struct ca_slot_info {
30 int num; /* slot number */ 30 int num; /* slot number */
31 31
32 int type; /* CA interface this slot supports */ 32 int type; /* CA interface this slot supports */
33#define CA_CI 1 /* CI high level interface */ 33#define CA_CI 1 /* CI high level interface */
34#define CA_CI_LINK 2 /* CI link layer level interface */ 34#define CA_CI_LINK 2 /* CI link layer level interface */
35#define CA_CI_PHYS 4 /* CI physical layer level interface */ 35#define CA_CI_PHYS 4 /* CI physical layer level interface */
36#define CA_DESCR 8 /* built-in descrambler */ 36#define CA_DESCR 8 /* built-in descrambler */
37#define CA_SC 128 /* simple smart card interface */ 37#define CA_SC 128 /* simple smart card interface */
38 38
39 unsigned int flags; 39 unsigned int flags;
40#define CA_CI_MODULE_PRESENT 1 /* module (or card) inserted */ 40#define CA_CI_MODULE_PRESENT 1 /* module (or card) inserted */
41#define CA_CI_MODULE_READY 2 41#define CA_CI_MODULE_READY 2
42} ca_slot_info_t; 42} ca_slot_info_t;
@@ -45,37 +45,37 @@ typedef struct ca_slot_info {
45/* descrambler types and info */ 45/* descrambler types and info */
46 46
47typedef struct ca_descr_info { 47typedef struct ca_descr_info {
48 unsigned int num; /* number of available descramblers (keys) */ 48 unsigned int num; /* number of available descramblers (keys) */
49 unsigned int type; /* type of supported scrambling system */ 49 unsigned int type; /* type of supported scrambling system */
50#define CA_ECD 1 50#define CA_ECD 1
51#define CA_NDS 2 51#define CA_NDS 2
52#define CA_DSS 4 52#define CA_DSS 4
53} ca_descr_info_t; 53} ca_descr_info_t;
54 54
55typedef struct ca_caps { 55typedef struct ca_caps {
56 unsigned int slot_num; /* total number of CA card and module slots */ 56 unsigned int slot_num; /* total number of CA card and module slots */
57 unsigned int slot_type; /* OR of all supported types */ 57 unsigned int slot_type; /* OR of all supported types */
58 unsigned int descr_num; /* total number of descrambler slots (keys) */ 58 unsigned int descr_num; /* total number of descrambler slots (keys) */
59 unsigned int descr_type; /* OR of all supported types */ 59 unsigned int descr_type; /* OR of all supported types */
60} ca_caps_t; 60} ca_caps_t;
61 61
62/* a message to/from a CI-CAM */ 62/* a message to/from a CI-CAM */
63typedef struct ca_msg { 63typedef struct ca_msg {
64 unsigned int index; 64 unsigned int index;
65 unsigned int type; 65 unsigned int type;
66 unsigned int length; 66 unsigned int length;
67 unsigned char msg[256]; 67 unsigned char msg[256];
68} ca_msg_t; 68} ca_msg_t;
69 69
70typedef struct ca_descr { 70typedef struct ca_descr {
71 unsigned int index; 71 unsigned int index;
72 unsigned int parity; /* 0 == even, 1 == odd */ 72 unsigned int parity; /* 0 == even, 1 == odd */
73 unsigned char cw[8]; 73 unsigned char cw[8];
74} ca_descr_t; 74} ca_descr_t;
75 75
76typedef struct ca_pid { 76typedef struct ca_pid {
77 unsigned int pid; 77 unsigned int pid;
78 int index; /* -1 == disable*/ 78 int index; /* -1 == disable*/
79} ca_pid_t; 79} ca_pid_t;
80 80
81#define CA_RESET _IO('o', 128) 81#define CA_RESET _IO('o', 128)
diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h
index ce3f829da82c..2787b8a22ff1 100644
--- a/include/linux/dvb/dmx.h
+++ b/include/linux/dvb/dmx.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * dmx.h 2 * dmx.h
3 * 3 *
4 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> 4 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
@@ -38,10 +38,10 @@ typedef enum
38{ 38{
39 DMX_OUT_DECODER, /* Streaming directly to decoder. */ 39 DMX_OUT_DECODER, /* Streaming directly to decoder. */
40 DMX_OUT_TAP, /* Output going to a memory buffer */ 40 DMX_OUT_TAP, /* Output going to a memory buffer */
41 /* (to be retrieved via the read command).*/ 41 /* (to be retrieved via the read command).*/
42 DMX_OUT_TS_TAP /* Output multiplexed into a new TS */ 42 DMX_OUT_TS_TAP /* Output multiplexed into a new TS */
43 /* (to be retrieved by reading from the */ 43 /* (to be retrieved by reading from the */
44 /* logical DVR device). */ 44 /* logical DVR device). */
45} dmx_output_t; 45} dmx_output_t;
46 46
47 47
@@ -54,25 +54,25 @@ typedef enum
54 54
55typedef enum 55typedef enum
56{ 56{
57 DMX_PES_AUDIO0, 57 DMX_PES_AUDIO0,
58 DMX_PES_VIDEO0, 58 DMX_PES_VIDEO0,
59 DMX_PES_TELETEXT0, 59 DMX_PES_TELETEXT0,
60 DMX_PES_SUBTITLE0, 60 DMX_PES_SUBTITLE0,
61 DMX_PES_PCR0, 61 DMX_PES_PCR0,
62 62
63 DMX_PES_AUDIO1, 63 DMX_PES_AUDIO1,
64 DMX_PES_VIDEO1, 64 DMX_PES_VIDEO1,
65 DMX_PES_TELETEXT1, 65 DMX_PES_TELETEXT1,
66 DMX_PES_SUBTITLE1, 66 DMX_PES_SUBTITLE1,
67 DMX_PES_PCR1, 67 DMX_PES_PCR1,
68 68
69 DMX_PES_AUDIO2, 69 DMX_PES_AUDIO2,
70 DMX_PES_VIDEO2, 70 DMX_PES_VIDEO2,
71 DMX_PES_TELETEXT2, 71 DMX_PES_TELETEXT2,
72 DMX_PES_SUBTITLE2, 72 DMX_PES_SUBTITLE2,
73 DMX_PES_PCR2, 73 DMX_PES_PCR2,
74 74
75 DMX_PES_AUDIO3, 75 DMX_PES_AUDIO3,
76 DMX_PES_VIDEO3, 76 DMX_PES_VIDEO3,
77 DMX_PES_TELETEXT3, 77 DMX_PES_TELETEXT3,
78 DMX_PES_SUBTITLE3, 78 DMX_PES_SUBTITLE3,
@@ -90,8 +90,8 @@ typedef enum
90 90
91typedef enum 91typedef enum
92{ 92{
93 DMX_SCRAMBLING_EV, 93 DMX_SCRAMBLING_EV,
94 DMX_FRONTEND_EV 94 DMX_FRONTEND_EV
95} dmx_event_t; 95} dmx_event_t;
96 96
97 97
diff --git a/include/linux/dvb/osd.h b/include/linux/dvb/osd.h
index 0e1973d54a6b..880e68435832 100644
--- a/include/linux/dvb/osd.h
+++ b/include/linux/dvb/osd.h
@@ -98,43 +98,43 @@ typedef enum {
98} OSD_Command; 98} OSD_Command;
99 99
100typedef struct osd_cmd_s { 100typedef struct osd_cmd_s {
101 OSD_Command cmd; 101 OSD_Command cmd;
102 int x0; 102 int x0;
103 int y0; 103 int y0;
104 int x1; 104 int x1;
105 int y1; 105 int y1;
106 int color; 106 int color;
107 void __user *data; 107 void __user *data;
108} osd_cmd_t; 108} osd_cmd_t;
109 109
110/* OSD_OpenRaw: set 'color' to desired window type */ 110/* OSD_OpenRaw: set 'color' to desired window type */
111typedef enum { 111typedef enum {
112 OSD_BITMAP1, /* 1 bit bitmap */ 112 OSD_BITMAP1, /* 1 bit bitmap */
113 OSD_BITMAP2, /* 2 bit bitmap */ 113 OSD_BITMAP2, /* 2 bit bitmap */
114 OSD_BITMAP4, /* 4 bit bitmap */ 114 OSD_BITMAP4, /* 4 bit bitmap */
115 OSD_BITMAP8, /* 8 bit bitmap */ 115 OSD_BITMAP8, /* 8 bit bitmap */
116 OSD_BITMAP1HR, /* 1 Bit bitmap half resolution */ 116 OSD_BITMAP1HR, /* 1 Bit bitmap half resolution */
117 OSD_BITMAP2HR, /* 2 bit bitmap half resolution */ 117 OSD_BITMAP2HR, /* 2 bit bitmap half resolution */
118 OSD_BITMAP4HR, /* 4 bit bitmap half resolution */ 118 OSD_BITMAP4HR, /* 4 bit bitmap half resolution */
119 OSD_BITMAP8HR, /* 8 bit bitmap half resolution */ 119 OSD_BITMAP8HR, /* 8 bit bitmap half resolution */
120 OSD_YCRCB422, /* 4:2:2 YCRCB Graphic Display */ 120 OSD_YCRCB422, /* 4:2:2 YCRCB Graphic Display */
121 OSD_YCRCB444, /* 4:4:4 YCRCB Graphic Display */ 121 OSD_YCRCB444, /* 4:4:4 YCRCB Graphic Display */
122 OSD_YCRCB444HR, /* 4:4:4 YCRCB graphic half resolution */ 122 OSD_YCRCB444HR, /* 4:4:4 YCRCB graphic half resolution */
123 OSD_VIDEOTSIZE, /* True Size Normal MPEG Video Display */ 123 OSD_VIDEOTSIZE, /* True Size Normal MPEG Video Display */
124 OSD_VIDEOHSIZE, /* MPEG Video Display Half Resolution */ 124 OSD_VIDEOHSIZE, /* MPEG Video Display Half Resolution */
125 OSD_VIDEOQSIZE, /* MPEG Video Display Quarter Resolution */ 125 OSD_VIDEOQSIZE, /* MPEG Video Display Quarter Resolution */
126 OSD_VIDEODSIZE, /* MPEG Video Display Double Resolution */ 126 OSD_VIDEODSIZE, /* MPEG Video Display Double Resolution */
127 OSD_VIDEOTHSIZE, /* True Size MPEG Video Display Half Resolution */ 127 OSD_VIDEOTHSIZE, /* True Size MPEG Video Display Half Resolution */
128 OSD_VIDEOTQSIZE, /* True Size MPEG Video Display Quarter Resolution*/ 128 OSD_VIDEOTQSIZE, /* True Size MPEG Video Display Quarter Resolution*/
129 OSD_VIDEOTDSIZE, /* True Size MPEG Video Display Double Resolution */ 129 OSD_VIDEOTDSIZE, /* True Size MPEG Video Display Double Resolution */
130 OSD_VIDEONSIZE, /* Full Size MPEG Video Display */ 130 OSD_VIDEONSIZE, /* Full Size MPEG Video Display */
131 OSD_CURSOR /* Cursor */ 131 OSD_CURSOR /* Cursor */
132} osd_raw_window_t; 132} osd_raw_window_t;
133 133
134typedef struct osd_cap_s { 134typedef struct osd_cap_s {
135 int cmd; 135 int cmd;
136#define OSD_CAP_MEMSIZE 1 /* memory size */ 136#define OSD_CAP_MEMSIZE 1 /* memory size */
137 long val; 137 long val;
138} osd_cap_t; 138} osd_cap_t;
139 139
140 140
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
index 941045e9ab89..b1999bfeaa56 100644
--- a/include/linux/dvb/video.h
+++ b/include/linux/dvb/video.h
@@ -36,7 +36,7 @@
36 36
37typedef enum { 37typedef enum {
38 VIDEO_FORMAT_4_3, /* Select 4:3 format */ 38 VIDEO_FORMAT_4_3, /* Select 4:3 format */
39 VIDEO_FORMAT_16_9, /* Select 16:9 format. */ 39 VIDEO_FORMAT_16_9, /* Select 16:9 format. */
40 VIDEO_FORMAT_221_1 /* 2.21:1 */ 40 VIDEO_FORMAT_221_1 /* 2.21:1 */
41} video_format_t; 41} video_format_t;
42 42
@@ -54,7 +54,7 @@ typedef enum {
54 54
55 55
56typedef enum { 56typedef enum {
57 VIDEO_PAN_SCAN, /* use pan and scan format */ 57 VIDEO_PAN_SCAN, /* use pan and scan format */
58 VIDEO_LETTER_BOX, /* use letterbox format */ 58 VIDEO_LETTER_BOX, /* use letterbox format */
59 VIDEO_CENTER_CUT_OUT /* use center cut out format */ 59 VIDEO_CENTER_CUT_OUT /* use center cut out format */
60} video_displayformat_t; 60} video_displayformat_t;
@@ -66,7 +66,7 @@ typedef struct {
66} video_size_t; 66} video_size_t;
67 67
68typedef enum { 68typedef enum {
69 VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */ 69 VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
70 VIDEO_SOURCE_MEMORY /* If this source is selected, the stream 70 VIDEO_SOURCE_MEMORY /* If this source is selected, the stream
71 comes from the user through the write 71 comes from the user through the write
72 system call */ 72 system call */
@@ -75,35 +75,35 @@ typedef enum {
75 75
76typedef enum { 76typedef enum {
77 VIDEO_STOPPED, /* Video is stopped */ 77 VIDEO_STOPPED, /* Video is stopped */
78 VIDEO_PLAYING, /* Video is currently playing */ 78 VIDEO_PLAYING, /* Video is currently playing */
79 VIDEO_FREEZED /* Video is freezed */ 79 VIDEO_FREEZED /* Video is freezed */
80} video_play_state_t; 80} video_play_state_t;
81 81
82 82
83struct video_event { 83struct video_event {
84 int32_t type; 84 int32_t type;
85#define VIDEO_EVENT_SIZE_CHANGED 1 85#define VIDEO_EVENT_SIZE_CHANGED 1
86#define VIDEO_EVENT_FRAME_RATE_CHANGED 2 86#define VIDEO_EVENT_FRAME_RATE_CHANGED 2
87 time_t timestamp; 87 time_t timestamp;
88 union { 88 union {
89 video_size_t size; 89 video_size_t size;
90 unsigned int frame_rate; /* in frames per 1000sec */ 90 unsigned int frame_rate; /* in frames per 1000sec */
91 } u; 91 } u;
92}; 92};
93 93
94 94
95struct video_status { 95struct video_status {
96 int video_blank; /* blank video on freeze? */ 96 int video_blank; /* blank video on freeze? */
97 video_play_state_t play_state; /* current state of playback */ 97 video_play_state_t play_state; /* current state of playback */
98 video_stream_source_t stream_source; /* current source (demux/memory) */ 98 video_stream_source_t stream_source; /* current source (demux/memory) */
99 video_format_t video_format; /* current aspect ratio of stream*/ 99 video_format_t video_format; /* current aspect ratio of stream*/
100 video_displayformat_t display_format;/* selected cropping mode */ 100 video_displayformat_t display_format;/* selected cropping mode */
101}; 101};
102 102
103 103
104struct video_still_picture { 104struct video_still_picture {
105 char __user *iFrame; /* pointer to a single iframe in memory */ 105 char __user *iFrame; /* pointer to a single iframe in memory */
106 int32_t size; 106 int32_t size;
107}; 107};
108 108
109 109
@@ -111,19 +111,19 @@ typedef
111struct video_highlight { 111struct video_highlight {
112 int active; /* 1=show highlight, 0=hide highlight */ 112 int active; /* 1=show highlight, 0=hide highlight */
113 uint8_t contrast1; /* 7- 4 Pattern pixel contrast */ 113 uint8_t contrast1; /* 7- 4 Pattern pixel contrast */
114 /* 3- 0 Background pixel contrast */ 114 /* 3- 0 Background pixel contrast */
115 uint8_t contrast2; /* 7- 4 Emphasis pixel-2 contrast */ 115 uint8_t contrast2; /* 7- 4 Emphasis pixel-2 contrast */
116 /* 3- 0 Emphasis pixel-1 contrast */ 116 /* 3- 0 Emphasis pixel-1 contrast */
117 uint8_t color1; /* 7- 4 Pattern pixel color */ 117 uint8_t color1; /* 7- 4 Pattern pixel color */
118 /* 3- 0 Background pixel color */ 118 /* 3- 0 Background pixel color */
119 uint8_t color2; /* 7- 4 Emphasis pixel-2 color */ 119 uint8_t color2; /* 7- 4 Emphasis pixel-2 color */
120 /* 3- 0 Emphasis pixel-1 color */ 120 /* 3- 0 Emphasis pixel-1 color */
121 uint32_t ypos; /* 23-22 auto action mode */ 121 uint32_t ypos; /* 23-22 auto action mode */
122 /* 21-12 start y */ 122 /* 21-12 start y */
123 /* 9- 0 end y */ 123 /* 9- 0 end y */
124 uint32_t xpos; /* 23-22 button color number */ 124 uint32_t xpos; /* 23-22 button color number */
125 /* 21-12 start x */ 125 /* 21-12 start x */
126 /* 9- 0 end x */ 126 /* 9- 0 end x */
127} video_highlight_t; 127} video_highlight_t;
128 128
129 129
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index a74c27e460ba..fb80fa44c4dd 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -130,6 +130,7 @@ extern int elv_try_last_merge(request_queue_t *, struct bio *);
130#define ELEVATOR_INSERT_FRONT 1 130#define ELEVATOR_INSERT_FRONT 1
131#define ELEVATOR_INSERT_BACK 2 131#define ELEVATOR_INSERT_BACK 2
132#define ELEVATOR_INSERT_SORT 3 132#define ELEVATOR_INSERT_SORT 3
133#define ELEVATOR_INSERT_REQUEUE 4
133 134
134/* 135/*
135 * return values from elevator_may_queue_fn 136 * return values from elevator_may_queue_fn
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 5f49a30eb6f2..745c988359c0 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -63,10 +63,11 @@ static inline int is_zero_ether_addr(const u8 *addr)
63 * @addr: Pointer to a six-byte array containing the Ethernet address 63 * @addr: Pointer to a six-byte array containing the Ethernet address
64 * 64 *
65 * Return true if the address is a multicast address. 65 * Return true if the address is a multicast address.
66 * By definition the broadcast address is also a multicast address.
66 */ 67 */
67static inline int is_multicast_ether_addr(const u8 *addr) 68static inline int is_multicast_ether_addr(const u8 *addr)
68{ 69{
69 return ((addr[0] != 0xff) && (0x01 & addr[0])); 70 return (0x01 & addr[0]);
70} 71}
71 72
72/** 73/**
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 04a58f33ec53..a973be2cfe61 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -617,6 +617,12 @@ struct fb_ops {
617 617
618 /* perform fb specific mmap */ 618 /* perform fb specific mmap */
619 int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma); 619 int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma);
620
621 /* save current hardware state */
622 void (*fb_save_state)(struct fb_info *info);
623
624 /* restore saved state */
625 void (*fb_restore_state)(struct fb_info *info);
620}; 626};
621 627
622#ifdef CONFIG_FB_TILEBLITTING 628#ifdef CONFIG_FB_TILEBLITTING
@@ -726,6 +732,18 @@ struct fb_tile_ops {
726 from userspace */ 732 from userspace */
727#define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */ 733#define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */
728 734
735/* A driver may set this flag to indicate that it does want a set_par to be
736 * called every time when fbcon_switch is executed. The advantage is that with
737 * this flag set you can really be shure that set_par is always called before
738 * any of the functions dependant on the correct hardware state or altering
739 * that state, even if you are using some broken X releases. The disadvantage
740 * is that it introduces unwanted delays to every console switch if set_par
741 * is slow. It is a good idea to try this flag in the drivers initialization
742 * code whenever there is a bug report related to switching between X and the
743 * framebuffer console.
744 */
745#define FBINFO_MISC_ALWAYS_SETPAR 0x40000
746
729struct fb_info { 747struct fb_info {
730 int node; 748 int node;
731 int flags; 749 int flags;
@@ -817,6 +835,18 @@ struct fb_info {
817 835
818#endif 836#endif
819 837
838#if defined (__BIG_ENDIAN)
839#define FB_LEFT_POS(bpp) (32 - bpp)
840#define FB_SHIFT_HIGH(val, bits) ((val) >> (bits))
841#define FB_SHIFT_LOW(val, bits) ((val) << (bits))
842#define FB_BIT_NR(b) (7 - (b))
843#else
844#define FB_LEFT_POS(bpp) (0)
845#define FB_SHIFT_HIGH(val, bits) ((val) << (bits))
846#define FB_SHIFT_LOW(val, bits) ((val) >> (bits))
847#define FB_BIT_NR(b) (b)
848#endif
849
820 /* 850 /*
821 * `Generic' versions of the frame buffer device operations 851 * `Generic' versions of the frame buffer device operations
822 */ 852 */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 3ba843c46382..c6cb8f095088 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -143,7 +143,7 @@ static inline unsigned int sk_filter_len(struct sk_filter *fp)
143struct sk_buff; 143struct sk_buff;
144struct sock; 144struct sock;
145 145
146extern int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen); 146extern unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen);
147extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 147extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
148extern int sk_chk_filter(struct sock_filter *filter, int flen); 148extern int sk_chk_filter(struct sock_filter *filter, int flen);
149#endif /* __KERNEL__ */ 149#endif /* __KERNEL__ */
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 2063c0839d4f..2d716080be4a 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -14,7 +14,7 @@ struct device;
14int request_firmware(const struct firmware **fw, const char *name, 14int request_firmware(const struct firmware **fw, const char *name,
15 struct device *device); 15 struct device *device);
16int request_firmware_nowait( 16int request_firmware_nowait(
17 struct module *module, int hotplug, 17 struct module *module, int uevent,
18 const char *name, struct device *device, void *context, 18 const char *name, struct device *device, void *context,
19 void (*cont)(const struct firmware *fw, void *context)); 19 void (*cont)(const struct firmware *fw, void *context));
20 20
diff --git a/include/linux/fs.h b/include/linux/fs.h
index cc35b6ac778d..2c9c48d65630 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -302,6 +302,37 @@ struct iattr {
302 */ 302 */
303#include <linux/quota.h> 303#include <linux/quota.h>
304 304
305/**
306 * enum positive_aop_returns - aop return codes with specific semantics
307 *
308 * @AOP_WRITEPAGE_ACTIVATE: Informs the caller that page writeback has
309 * completed, that the page is still locked, and
310 * should be considered active. The VM uses this hint
311 * to return the page to the active list -- it won't
312 * be a candidate for writeback again in the near
313 * future. Other callers must be careful to unlock
314 * the page if they get this return. Returned by
315 * writepage();
316 *
317 * @AOP_TRUNCATED_PAGE: The AOP method that was handed a locked page has
318 * unlocked it and the page might have been truncated.
319 * The caller should back up to acquiring a new page and
320 * trying again. The aop will be taking reasonable
321 * precautions not to livelock. If the caller held a page
322 * reference, it should drop it before retrying. Returned
323 * by readpage(), prepare_write(), and commit_write().
324 *
325 * address_space_operation functions return these large constants to indicate
326 * special semantics to the caller. These are much larger than the bytes in a
327 * page to allow for functions that return the number of bytes operated on in a
328 * given page.
329 */
330
331enum positive_aop_returns {
332 AOP_WRITEPAGE_ACTIVATE = 0x80000,
333 AOP_TRUNCATED_PAGE = 0x80001,
334};
335
305/* 336/*
306 * oh the beauties of C type declarations. 337 * oh the beauties of C type declarations.
307 */ 338 */
@@ -729,7 +760,7 @@ extern struct file_lock *posix_test_lock(struct file *, struct file_lock *);
729extern int posix_lock_file(struct file *, struct file_lock *); 760extern int posix_lock_file(struct file *, struct file_lock *);
730extern int posix_lock_file_wait(struct file *, struct file_lock *); 761extern int posix_lock_file_wait(struct file *, struct file_lock *);
731extern void posix_block_lock(struct file_lock *, struct file_lock *); 762extern void posix_block_lock(struct file_lock *, struct file_lock *);
732extern void posix_unblock_lock(struct file *, struct file_lock *); 763extern int posix_unblock_lock(struct file *, struct file_lock *);
733extern int posix_locks_deadlock(struct file_lock *, struct file_lock *); 764extern int posix_locks_deadlock(struct file_lock *, struct file_lock *);
734extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 765extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
735extern int __break_lease(struct inode *inode, unsigned int flags); 766extern int __break_lease(struct inode *inode, unsigned int flags);
@@ -1019,6 +1050,7 @@ struct inode_operations {
1019 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); 1050 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
1020 ssize_t (*listxattr) (struct dentry *, char *, size_t); 1051 ssize_t (*listxattr) (struct dentry *, char *, size_t);
1021 int (*removexattr) (struct dentry *, const char *); 1052 int (*removexattr) (struct dentry *, const char *);
1053 void (*truncate_range)(struct inode *, loff_t, loff_t);
1022}; 1054};
1023 1055
1024struct seq_file; 1056struct seq_file;
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index b76b558b03d4..528959c52f1b 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -14,7 +14,7 @@
14#define FUSE_KERNEL_VERSION 7 14#define FUSE_KERNEL_VERSION 7
15 15
16/** Minor version number of this interface */ 16/** Minor version number of this interface */
17#define FUSE_KERNEL_MINOR_VERSION 3 17#define FUSE_KERNEL_MINOR_VERSION 5
18 18
19/** The node ID of the root inode */ 19/** The node ID of the root inode */
20#define FUSE_ROOT_ID 1 20#define FUSE_ROOT_ID 1
@@ -53,6 +53,9 @@ struct fuse_kstatfs {
53 __u64 ffree; 53 __u64 ffree;
54 __u32 bsize; 54 __u32 bsize;
55 __u32 namelen; 55 __u32 namelen;
56 __u32 frsize;
57 __u32 padding;
58 __u32 spare[6];
56}; 59};
57 60
58#define FATTR_MODE (1 << 0) 61#define FATTR_MODE (1 << 0)
@@ -105,12 +108,8 @@ enum fuse_opcode {
105 FUSE_CREATE = 35 108 FUSE_CREATE = 35
106}; 109};
107 110
108/* Conservative buffer size for the client */ 111/* The read buffer is required to be at least 8k, but may be much larger */
109#define FUSE_MAX_IN 8192 112#define FUSE_MIN_READ_BUFFER 8192
110
111#define FUSE_NAME_MAX 1024
112#define FUSE_SYMLINK_MAX 4096
113#define FUSE_XATTR_SIZE_MAX 4096
114 113
115struct fuse_entry_out { 114struct fuse_entry_out {
116 __u64 nodeid; /* Inode ID */ 115 __u64 nodeid; /* Inode ID */
@@ -213,6 +212,8 @@ struct fuse_write_out {
213 __u32 padding; 212 __u32 padding;
214}; 213};
215 214
215#define FUSE_COMPAT_STATFS_SIZE 48
216
216struct fuse_statfs_out { 217struct fuse_statfs_out {
217 struct fuse_kstatfs st; 218 struct fuse_kstatfs st;
218}; 219};
@@ -243,9 +244,16 @@ struct fuse_access_in {
243 __u32 padding; 244 __u32 padding;
244}; 245};
245 246
246struct fuse_init_in_out { 247struct fuse_init_in {
248 __u32 major;
249 __u32 minor;
250};
251
252struct fuse_init_out {
247 __u32 major; 253 __u32 major;
248 __u32 minor; 254 __u32 minor;
255 __u32 unused[3];
256 __u32 max_write;
249}; 257};
250 258
251struct fuse_in_header { 259struct fuse_in_header {
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 1056717ee501..68d82ad6b17c 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -22,7 +22,7 @@ int hugetlb_report_meminfo(char *);
22int hugetlb_report_node_meminfo(int, char *); 22int hugetlb_report_node_meminfo(int, char *);
23int is_hugepage_mem_enough(size_t); 23int is_hugepage_mem_enough(size_t);
24unsigned long hugetlb_total_pages(void); 24unsigned long hugetlb_total_pages(void);
25struct page *alloc_huge_page(void); 25struct page *alloc_huge_page(struct vm_area_struct *, unsigned long);
26void free_huge_page(struct page *); 26void free_huge_page(struct page *);
27int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, 27int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
28 unsigned long address, int write_access); 28 unsigned long address, int write_access);
@@ -97,7 +97,7 @@ static inline unsigned long hugetlb_total_pages(void)
97#define is_hugepage_only_range(mm, addr, len) 0 97#define is_hugepage_only_range(mm, addr, len) 0
98#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ 98#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \
99 do { } while (0) 99 do { } while (0)
100#define alloc_huge_page() ({ NULL; }) 100#define alloc_huge_page(vma, addr) ({ NULL; })
101#define free_huge_page(p) ({ (void)(p); BUG(); }) 101#define free_huge_page(p) ({ (void)(p); BUG(); })
102#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; }) 102#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; })
103 103
diff --git a/include/linux/hwmon-vid.h b/include/linux/hwmon-vid.h
index cd4b7a042b86..f346e4d5381c 100644
--- a/include/linux/hwmon-vid.h
+++ b/include/linux/hwmon-vid.h
@@ -23,14 +23,14 @@
23#ifndef _LINUX_HWMON_VID_H 23#ifndef _LINUX_HWMON_VID_H
24#define _LINUX_HWMON_VID_H 24#define _LINUX_HWMON_VID_H
25 25
26int vid_from_reg(int val, int vrm); 26int vid_from_reg(int val, u8 vrm);
27int vid_which_vrm(void); 27u8 vid_which_vrm(void);
28 28
29/* vrm is the VRM/VRD document version multiplied by 10. 29/* vrm is the VRM/VRD document version multiplied by 10.
30 val is in mV to avoid floating point in the kernel. 30 val is in mV to avoid floating point in the kernel.
31 Returned value is the 4-, 5- or 6-bit VID code. 31 Returned value is the 4-, 5- or 6-bit VID code.
32 Note that only VRM 9.x is supported for now. */ 32 Note that only VRM 9.x is supported for now. */
33static inline int vid_to_reg(int val, int vrm) 33static inline int vid_to_reg(int val, u8 vrm)
34{ 34{
35 switch (vrm) { 35 switch (vrm) {
36 case 91: /* VRM 9.1 */ 36 case 91: /* VRM 9.1 */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index ef3b5632e63a..fb46f8d56999 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -25,12 +25,6 @@
25 25
26/* 26/*
27 * ---- Driver types ----------------------------------------------------- 27 * ---- Driver types -----------------------------------------------------
28 * device id name + number function description, i2c address(es)
29 *
30 * Range 1000-1999 range is defined in sensors/sensors.h
31 * Range 0x100 - 0x1ff is for V4L2 Common Components
32 * Range 0xf000 - 0xffff is reserved for local experimentation, and should
33 * never be used in official drivers
34 */ 28 */
35 29
36#define I2C_DRIVERID_MSP3400 1 30#define I2C_DRIVERID_MSP3400 1
@@ -108,15 +102,9 @@
108#define I2C_DRIVERID_SAA7127 72 /* saa7124 video encoder */ 102#define I2C_DRIVERID_SAA7127 72 /* saa7124 video encoder */
109#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ 103#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
110#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ 104#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */
111#define I2C_DRIVERID_I2C_IR 75 /* I2C InfraRed on Video boards */ 105#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */
112
113#define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */
114#define I2C_DRIVERID_EXP1 0xF1
115#define I2C_DRIVERID_EXP2 0xF2
116#define I2C_DRIVERID_EXP3 0xF3
117 106
118#define I2C_DRIVERID_I2CDEV 900 107#define I2C_DRIVERID_I2CDEV 900
119#define I2C_DRIVERID_I2CPROC 901
120#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 108#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
121#define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */ 109#define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */
122 110
@@ -131,15 +119,12 @@
131#define I2C_DRIVERID_ADM1021 1008 119#define I2C_DRIVERID_ADM1021 1008
132#define I2C_DRIVERID_ADM9240 1009 120#define I2C_DRIVERID_ADM9240 1009
133#define I2C_DRIVERID_LTC1710 1010 121#define I2C_DRIVERID_LTC1710 1010
134#define I2C_DRIVERID_SIS5595 1011
135#define I2C_DRIVERID_ICSPLL 1012 122#define I2C_DRIVERID_ICSPLL 1012
136#define I2C_DRIVERID_BT869 1013 123#define I2C_DRIVERID_BT869 1013
137#define I2C_DRIVERID_MAXILIFE 1014 124#define I2C_DRIVERID_MAXILIFE 1014
138#define I2C_DRIVERID_MATORB 1015 125#define I2C_DRIVERID_MATORB 1015
139#define I2C_DRIVERID_GL520 1016 126#define I2C_DRIVERID_GL520 1016
140#define I2C_DRIVERID_THMC50 1017 127#define I2C_DRIVERID_THMC50 1017
141#define I2C_DRIVERID_DDCMON 1018
142#define I2C_DRIVERID_VIA686A 1019
143#define I2C_DRIVERID_ADM1025 1020 128#define I2C_DRIVERID_ADM1025 1020
144#define I2C_DRIVERID_LM87 1021 129#define I2C_DRIVERID_LM87 1021
145#define I2C_DRIVERID_PCF8574 1022 130#define I2C_DRIVERID_PCF8574 1022
@@ -151,21 +136,16 @@
151#define I2C_DRIVERID_FSCPOS 1028 136#define I2C_DRIVERID_FSCPOS 1028
152#define I2C_DRIVERID_FSCSCY 1029 137#define I2C_DRIVERID_FSCSCY 1029
153#define I2C_DRIVERID_PCF8591 1030 138#define I2C_DRIVERID_PCF8591 1030
154#define I2C_DRIVERID_SMSC47M1 1031
155#define I2C_DRIVERID_VT1211 1032
156#define I2C_DRIVERID_LM92 1033 139#define I2C_DRIVERID_LM92 1033
157#define I2C_DRIVERID_VT8231 1034
158#define I2C_DRIVERID_SMARTBATT 1035 140#define I2C_DRIVERID_SMARTBATT 1035
159#define I2C_DRIVERID_BMCSENSORS 1036 141#define I2C_DRIVERID_BMCSENSORS 1036
160#define I2C_DRIVERID_FS451 1037 142#define I2C_DRIVERID_FS451 1037
161#define I2C_DRIVERID_W83627HF 1038
162#define I2C_DRIVERID_LM85 1039 143#define I2C_DRIVERID_LM85 1039
163#define I2C_DRIVERID_LM83 1040 144#define I2C_DRIVERID_LM83 1040
164#define I2C_DRIVERID_LM90 1042 145#define I2C_DRIVERID_LM90 1042
165#define I2C_DRIVERID_ASB100 1043 146#define I2C_DRIVERID_ASB100 1043
166#define I2C_DRIVERID_FSCHER 1046 147#define I2C_DRIVERID_FSCHER 1046
167#define I2C_DRIVERID_W83L785TS 1047 148#define I2C_DRIVERID_W83L785TS 1047
168#define I2C_DRIVERID_SMSC47B397 1050
169 149
170/* 150/*
171 * ---- Adapter types ---------------------------------------------------- 151 * ---- Adapter types ----------------------------------------------------
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 5e19a7ba69b2..7863a59bd598 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -105,14 +105,14 @@ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
105 * A driver is capable of handling one or more physical devices present on 105 * A driver is capable of handling one or more physical devices present on
106 * I2C adapters. This information is used to inform the driver of adapter 106 * I2C adapters. This information is used to inform the driver of adapter
107 * events. 107 * events.
108 *
109 * The driver.owner field should be set to the module owner of this driver.
110 * The driver.name field should be set to the name of this driver.
108 */ 111 */
109 112
110struct i2c_driver { 113struct i2c_driver {
111 struct module *owner;
112 char name[32];
113 int id; 114 int id;
114 unsigned int class; 115 unsigned int class;
115 unsigned int flags; /* div., see below */
116 116
117 /* Notifies the driver that a new bus has appeared. This routine 117 /* Notifies the driver that a new bus has appeared. This routine
118 * can be used by the driver to test if the bus meets its conditions 118 * can be used by the driver to test if the bus meets its conditions
@@ -250,18 +250,7 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
250 dev_set_drvdata (&dev->dev, data); 250 dev_set_drvdata (&dev->dev, data);
251} 251}
252 252
253/*flags for the driver struct: */
254#define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */
255#if 0
256/* this flag is gone -- there is a (optional) driver->detach_adapter
257 * callback now which can be used instead */
258# define I2C_DF_DUMMY 0x02
259#endif
260
261/*flags for the client struct: */ 253/*flags for the client struct: */
262#define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */
263#define I2C_CLIENT_ALLOW_MULTIPLE_USE 0x02 /* Allow multiple access-locks */
264 /* on an i2c_client */
265#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ 254#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */
266#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ 255#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */
267 /* Must equal I2C_M_TEN below */ 256 /* Must equal I2C_M_TEN below */
@@ -302,26 +291,20 @@ struct i2c_client_address_data {
302extern int i2c_add_adapter(struct i2c_adapter *); 291extern int i2c_add_adapter(struct i2c_adapter *);
303extern int i2c_del_adapter(struct i2c_adapter *); 292extern int i2c_del_adapter(struct i2c_adapter *);
304 293
305extern int i2c_add_driver(struct i2c_driver *); 294extern int i2c_register_driver(struct module *, struct i2c_driver *);
306extern int i2c_del_driver(struct i2c_driver *); 295extern int i2c_del_driver(struct i2c_driver *);
307 296
297static inline int i2c_add_driver(struct i2c_driver *driver)
298{
299 return i2c_register_driver(THIS_MODULE, driver);
300}
301
308extern int i2c_attach_client(struct i2c_client *); 302extern int i2c_attach_client(struct i2c_client *);
309extern int i2c_detach_client(struct i2c_client *); 303extern int i2c_detach_client(struct i2c_client *);
310 304
311/* New function: This is to get an i2c_client-struct for controlling the 305/* Should be used to make sure that client-struct is valid and that it
312 client either by using i2c_control-function or having the 306 is okay to access the i2c-client.
313 client-module export functions that can be used with the i2c_client 307 returns -ENODEV if client has gone in the meantime */
314 -struct. */
315extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id,
316 struct i2c_client *prev);
317
318/* Should be used with new function
319 extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *);
320 to make sure that client-struct is valid and that it is okay to access
321 the i2c-client.
322 returns -EACCES if client doesn't allow use (default)
323 returns -EBUSY if client doesn't allow multiple use (default) and
324 usage_count >0 */
325extern int i2c_use_client(struct i2c_client *); 308extern int i2c_use_client(struct i2c_client *);
326extern int i2c_release_client(struct i2c_client *); 309extern int i2c_release_client(struct i2c_client *);
327 310
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index d79c8a4bc4f8..9ba806796667 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -30,6 +30,7 @@
30#include <linux/string.h> 30#include <linux/string.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/workqueue.h> /* work_struct */ 32#include <linux/workqueue.h> /* work_struct */
33#include <linux/mempool.h>
33 34
34#include <asm/io.h> 35#include <asm/io.h>
35#include <asm/semaphore.h> /* Needed for MUTEX init macros */ 36#include <asm/semaphore.h> /* Needed for MUTEX init macros */
@@ -38,6 +39,355 @@
38#define I2O_QUEUE_EMPTY 0xffffffff 39#define I2O_QUEUE_EMPTY 0xffffffff
39 40
40/* 41/*
42 * Cache strategies
43 */
44
45/* The NULL strategy leaves everything up to the controller. This tends to be a
46 * pessimal but functional choice.
47 */
48#define CACHE_NULL 0
49/* Prefetch data when reading. We continually attempt to load the next 32 sectors
50 * into the controller cache.
51 */
52#define CACHE_PREFETCH 1
53/* Prefetch data when reading. We sometimes attempt to load the next 32 sectors
54 * into the controller cache. When an I/O is less <= 8K we assume its probably
55 * not sequential and don't prefetch (default)
56 */
57#define CACHE_SMARTFETCH 2
58/* Data is written to the cache and then out on to the disk. The I/O must be
59 * physically on the medium before the write is acknowledged (default without
60 * NVRAM)
61 */
62#define CACHE_WRITETHROUGH 17
63/* Data is written to the cache and then out on to the disk. The controller
64 * is permitted to write back the cache any way it wants. (default if battery
65 * backed NVRAM is present). It can be useful to set this for swap regardless of
66 * battery state.
67 */
68#define CACHE_WRITEBACK 18
69/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
70 * write large I/O's directly to disk bypassing the cache to avoid the extra
71 * memory copy hits. Small writes are writeback cached
72 */
73#define CACHE_SMARTBACK 19
74/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
75 * write large I/O's directly to disk bypassing the cache to avoid the extra
76 * memory copy hits. Small writes are writethrough cached. Suitable for devices
77 * lacking battery backup
78 */
79#define CACHE_SMARTTHROUGH 20
80
81/*
82 * Ioctl structures
83 */
84
85#define BLKI2OGRSTRAT _IOR('2', 1, int)
86#define BLKI2OGWSTRAT _IOR('2', 2, int)
87#define BLKI2OSRSTRAT _IOW('2', 3, int)
88#define BLKI2OSWSTRAT _IOW('2', 4, int)
89
90/*
91 * I2O Function codes
92 */
93
94/*
95 * Executive Class
96 */
97#define I2O_CMD_ADAPTER_ASSIGN 0xB3
98#define I2O_CMD_ADAPTER_READ 0xB2
99#define I2O_CMD_ADAPTER_RELEASE 0xB5
100#define I2O_CMD_BIOS_INFO_SET 0xA5
101#define I2O_CMD_BOOT_DEVICE_SET 0xA7
102#define I2O_CMD_CONFIG_VALIDATE 0xBB
103#define I2O_CMD_CONN_SETUP 0xCA
104#define I2O_CMD_DDM_DESTROY 0xB1
105#define I2O_CMD_DDM_ENABLE 0xD5
106#define I2O_CMD_DDM_QUIESCE 0xC7
107#define I2O_CMD_DDM_RESET 0xD9
108#define I2O_CMD_DDM_SUSPEND 0xAF
109#define I2O_CMD_DEVICE_ASSIGN 0xB7
110#define I2O_CMD_DEVICE_RELEASE 0xB9
111#define I2O_CMD_HRT_GET 0xA8
112#define I2O_CMD_ADAPTER_CLEAR 0xBE
113#define I2O_CMD_ADAPTER_CONNECT 0xC9
114#define I2O_CMD_ADAPTER_RESET 0xBD
115#define I2O_CMD_LCT_NOTIFY 0xA2
116#define I2O_CMD_OUTBOUND_INIT 0xA1
117#define I2O_CMD_PATH_ENABLE 0xD3
118#define I2O_CMD_PATH_QUIESCE 0xC5
119#define I2O_CMD_PATH_RESET 0xD7
120#define I2O_CMD_STATIC_MF_CREATE 0xDD
121#define I2O_CMD_STATIC_MF_RELEASE 0xDF
122#define I2O_CMD_STATUS_GET 0xA0
123#define I2O_CMD_SW_DOWNLOAD 0xA9
124#define I2O_CMD_SW_UPLOAD 0xAB
125#define I2O_CMD_SW_REMOVE 0xAD
126#define I2O_CMD_SYS_ENABLE 0xD1
127#define I2O_CMD_SYS_MODIFY 0xC1
128#define I2O_CMD_SYS_QUIESCE 0xC3
129#define I2O_CMD_SYS_TAB_SET 0xA3
130
131/*
132 * Utility Class
133 */
134#define I2O_CMD_UTIL_NOP 0x00
135#define I2O_CMD_UTIL_ABORT 0x01
136#define I2O_CMD_UTIL_CLAIM 0x09
137#define I2O_CMD_UTIL_RELEASE 0x0B
138#define I2O_CMD_UTIL_PARAMS_GET 0x06
139#define I2O_CMD_UTIL_PARAMS_SET 0x05
140#define I2O_CMD_UTIL_EVT_REGISTER 0x13
141#define I2O_CMD_UTIL_EVT_ACK 0x14
142#define I2O_CMD_UTIL_CONFIG_DIALOG 0x10
143#define I2O_CMD_UTIL_DEVICE_RESERVE 0x0D
144#define I2O_CMD_UTIL_DEVICE_RELEASE 0x0F
145#define I2O_CMD_UTIL_LOCK 0x17
146#define I2O_CMD_UTIL_LOCK_RELEASE 0x19
147#define I2O_CMD_UTIL_REPLY_FAULT_NOTIFY 0x15
148
149/*
150 * SCSI Host Bus Adapter Class
151 */
152#define I2O_CMD_SCSI_EXEC 0x81
153#define I2O_CMD_SCSI_ABORT 0x83
154#define I2O_CMD_SCSI_BUSRESET 0x27
155
156/*
157 * Bus Adapter Class
158 */
159#define I2O_CMD_BUS_ADAPTER_RESET 0x85
160#define I2O_CMD_BUS_RESET 0x87
161#define I2O_CMD_BUS_SCAN 0x89
162#define I2O_CMD_BUS_QUIESCE 0x8b
163
164/*
165 * Random Block Storage Class
166 */
167#define I2O_CMD_BLOCK_READ 0x30
168#define I2O_CMD_BLOCK_WRITE 0x31
169#define I2O_CMD_BLOCK_CFLUSH 0x37
170#define I2O_CMD_BLOCK_MLOCK 0x49
171#define I2O_CMD_BLOCK_MUNLOCK 0x4B
172#define I2O_CMD_BLOCK_MMOUNT 0x41
173#define I2O_CMD_BLOCK_MEJECT 0x43
174#define I2O_CMD_BLOCK_POWER 0x70
175
176#define I2O_CMD_PRIVATE 0xFF
177
178/* Command status values */
179
180#define I2O_CMD_IN_PROGRESS 0x01
181#define I2O_CMD_REJECTED 0x02
182#define I2O_CMD_FAILED 0x03
183#define I2O_CMD_COMPLETED 0x04
184
185/* I2O API function return values */
186
187#define I2O_RTN_NO_ERROR 0
188#define I2O_RTN_NOT_INIT 1
189#define I2O_RTN_FREE_Q_EMPTY 2
190#define I2O_RTN_TCB_ERROR 3
191#define I2O_RTN_TRANSACTION_ERROR 4
192#define I2O_RTN_ADAPTER_ALREADY_INIT 5
193#define I2O_RTN_MALLOC_ERROR 6
194#define I2O_RTN_ADPTR_NOT_REGISTERED 7
195#define I2O_RTN_MSG_REPLY_TIMEOUT 8
196#define I2O_RTN_NO_STATUS 9
197#define I2O_RTN_NO_FIRM_VER 10
198#define I2O_RTN_NO_LINK_SPEED 11
199
200/* Reply message status defines for all messages */
201
202#define I2O_REPLY_STATUS_SUCCESS 0x00
203#define I2O_REPLY_STATUS_ABORT_DIRTY 0x01
204#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02
205#define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03
206#define I2O_REPLY_STATUS_ERROR_DIRTY 0x04
207#define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05
208#define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER 0x06
209#define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY 0x08
210#define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09
211#define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0A
212#define I2O_REPLY_STATUS_TRANSACTION_ERROR 0x0B
213#define I2O_REPLY_STATUS_PROGRESS_REPORT 0x80
214
215/* Status codes and Error Information for Parameter functions */
216
217#define I2O_PARAMS_STATUS_SUCCESS 0x00
218#define I2O_PARAMS_STATUS_BAD_KEY_ABORT 0x01
219#define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE 0x02
220#define I2O_PARAMS_STATUS_BUFFER_FULL 0x03
221#define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL 0x04
222#define I2O_PARAMS_STATUS_FIELD_UNREADABLE 0x05
223#define I2O_PARAMS_STATUS_FIELD_UNWRITEABLE 0x06
224#define I2O_PARAMS_STATUS_INSUFFICIENT_FIELDS 0x07
225#define I2O_PARAMS_STATUS_INVALID_GROUP_ID 0x08
226#define I2O_PARAMS_STATUS_INVALID_OPERATION 0x09
227#define I2O_PARAMS_STATUS_NO_KEY_FIELD 0x0A
228#define I2O_PARAMS_STATUS_NO_SUCH_FIELD 0x0B
229#define I2O_PARAMS_STATUS_NON_DYNAMIC_GROUP 0x0C
230#define I2O_PARAMS_STATUS_OPERATION_ERROR 0x0D
231#define I2O_PARAMS_STATUS_SCALAR_ERROR 0x0E
232#define I2O_PARAMS_STATUS_TABLE_ERROR 0x0F
233#define I2O_PARAMS_STATUS_WRONG_GROUP_TYPE 0x10
234
235/* DetailedStatusCode defines for Executive, DDM, Util and Transaction error
236 * messages: Table 3-2 Detailed Status Codes.*/
237
238#define I2O_DSC_SUCCESS 0x0000
239#define I2O_DSC_BAD_KEY 0x0002
240#define I2O_DSC_TCL_ERROR 0x0003
241#define I2O_DSC_REPLY_BUFFER_FULL 0x0004
242#define I2O_DSC_NO_SUCH_PAGE 0x0005
243#define I2O_DSC_INSUFFICIENT_RESOURCE_SOFT 0x0006
244#define I2O_DSC_INSUFFICIENT_RESOURCE_HARD 0x0007
245#define I2O_DSC_CHAIN_BUFFER_TOO_LARGE 0x0009
246#define I2O_DSC_UNSUPPORTED_FUNCTION 0x000A
247#define I2O_DSC_DEVICE_LOCKED 0x000B
248#define I2O_DSC_DEVICE_RESET 0x000C
249#define I2O_DSC_INAPPROPRIATE_FUNCTION 0x000D
250#define I2O_DSC_INVALID_INITIATOR_ADDRESS 0x000E
251#define I2O_DSC_INVALID_MESSAGE_FLAGS 0x000F
252#define I2O_DSC_INVALID_OFFSET 0x0010
253#define I2O_DSC_INVALID_PARAMETER 0x0011
254#define I2O_DSC_INVALID_REQUEST 0x0012
255#define I2O_DSC_INVALID_TARGET_ADDRESS 0x0013
256#define I2O_DSC_MESSAGE_TOO_LARGE 0x0014
257#define I2O_DSC_MESSAGE_TOO_SMALL 0x0015
258#define I2O_DSC_MISSING_PARAMETER 0x0016
259#define I2O_DSC_TIMEOUT 0x0017
260#define I2O_DSC_UNKNOWN_ERROR 0x0018
261#define I2O_DSC_UNKNOWN_FUNCTION 0x0019
262#define I2O_DSC_UNSUPPORTED_VERSION 0x001A
263#define I2O_DSC_DEVICE_BUSY 0x001B
264#define I2O_DSC_DEVICE_NOT_AVAILABLE 0x001C
265
266/* DetailedStatusCode defines for Block Storage Operation: Table 6-7 Detailed
267 Status Codes.*/
268
269#define I2O_BSA_DSC_SUCCESS 0x0000
270#define I2O_BSA_DSC_MEDIA_ERROR 0x0001
271#define I2O_BSA_DSC_ACCESS_ERROR 0x0002
272#define I2O_BSA_DSC_DEVICE_FAILURE 0x0003
273#define I2O_BSA_DSC_DEVICE_NOT_READY 0x0004
274#define I2O_BSA_DSC_MEDIA_NOT_PRESENT 0x0005
275#define I2O_BSA_DSC_MEDIA_LOCKED 0x0006
276#define I2O_BSA_DSC_MEDIA_FAILURE 0x0007
277#define I2O_BSA_DSC_PROTOCOL_FAILURE 0x0008
278#define I2O_BSA_DSC_BUS_FAILURE 0x0009
279#define I2O_BSA_DSC_ACCESS_VIOLATION 0x000A
280#define I2O_BSA_DSC_WRITE_PROTECTED 0x000B
281#define I2O_BSA_DSC_DEVICE_RESET 0x000C
282#define I2O_BSA_DSC_VOLUME_CHANGED 0x000D
283#define I2O_BSA_DSC_TIMEOUT 0x000E
284
285/* FailureStatusCodes, Table 3-3 Message Failure Codes */
286
287#define I2O_FSC_TRANSPORT_SERVICE_SUSPENDED 0x81
288#define I2O_FSC_TRANSPORT_SERVICE_TERMINATED 0x82
289#define I2O_FSC_TRANSPORT_CONGESTION 0x83
290#define I2O_FSC_TRANSPORT_FAILURE 0x84
291#define I2O_FSC_TRANSPORT_STATE_ERROR 0x85
292#define I2O_FSC_TRANSPORT_TIME_OUT 0x86
293#define I2O_FSC_TRANSPORT_ROUTING_FAILURE 0x87
294#define I2O_FSC_TRANSPORT_INVALID_VERSION 0x88
295#define I2O_FSC_TRANSPORT_INVALID_OFFSET 0x89
296#define I2O_FSC_TRANSPORT_INVALID_MSG_FLAGS 0x8A
297#define I2O_FSC_TRANSPORT_FRAME_TOO_SMALL 0x8B
298#define I2O_FSC_TRANSPORT_FRAME_TOO_LARGE 0x8C
299#define I2O_FSC_TRANSPORT_INVALID_TARGET_ID 0x8D
300#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_ID 0x8E
301#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_CONTEXT 0x8F
302#define I2O_FSC_TRANSPORT_UNKNOWN_FAILURE 0xFF
303
304/* Device Claim Types */
305#define I2O_CLAIM_PRIMARY 0x01000000
306#define I2O_CLAIM_MANAGEMENT 0x02000000
307#define I2O_CLAIM_AUTHORIZED 0x03000000
308#define I2O_CLAIM_SECONDARY 0x04000000
309
310/* Message header defines for VersionOffset */
311#define I2OVER15 0x0001
312#define I2OVER20 0x0002
313
314/* Default is 1.5 */
315#define I2OVERSION I2OVER15
316
317#define SGL_OFFSET_0 I2OVERSION
318#define SGL_OFFSET_4 (0x0040 | I2OVERSION)
319#define SGL_OFFSET_5 (0x0050 | I2OVERSION)
320#define SGL_OFFSET_6 (0x0060 | I2OVERSION)
321#define SGL_OFFSET_7 (0x0070 | I2OVERSION)
322#define SGL_OFFSET_8 (0x0080 | I2OVERSION)
323#define SGL_OFFSET_9 (0x0090 | I2OVERSION)
324#define SGL_OFFSET_10 (0x00A0 | I2OVERSION)
325#define SGL_OFFSET_11 (0x00B0 | I2OVERSION)
326#define SGL_OFFSET_12 (0x00C0 | I2OVERSION)
327#define SGL_OFFSET(x) (((x)<<4) | I2OVERSION)
328
329/* Transaction Reply Lists (TRL) Control Word structure */
330#define TRL_SINGLE_FIXED_LENGTH 0x00
331#define TRL_SINGLE_VARIABLE_LENGTH 0x40
332#define TRL_MULTIPLE_FIXED_LENGTH 0x80
333
334 /* msg header defines for MsgFlags */
335#define MSG_STATIC 0x0100
336#define MSG_64BIT_CNTXT 0x0200
337#define MSG_MULTI_TRANS 0x1000
338#define MSG_FAIL 0x2000
339#define MSG_FINAL 0x4000
340#define MSG_REPLY 0x8000
341
342 /* minimum size msg */
343#define THREE_WORD_MSG_SIZE 0x00030000
344#define FOUR_WORD_MSG_SIZE 0x00040000
345#define FIVE_WORD_MSG_SIZE 0x00050000
346#define SIX_WORD_MSG_SIZE 0x00060000
347#define SEVEN_WORD_MSG_SIZE 0x00070000
348#define EIGHT_WORD_MSG_SIZE 0x00080000
349#define NINE_WORD_MSG_SIZE 0x00090000
350#define TEN_WORD_MSG_SIZE 0x000A0000
351#define ELEVEN_WORD_MSG_SIZE 0x000B0000
352#define I2O_MESSAGE_SIZE(x) ((x)<<16)
353
354/* special TID assignments */
355#define ADAPTER_TID 0
356#define HOST_TID 1
357
358/* outbound queue defines */
359#define I2O_MAX_OUTBOUND_MSG_FRAMES 128
360#define I2O_OUTBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */
361
362/* inbound queue definitions */
363#define I2O_MSG_INPOOL_MIN 32
364#define I2O_INBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */
365
366#define I2O_POST_WAIT_OK 0
367#define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT
368
369#define I2O_CONTEXT_LIST_MIN_LENGTH 15
370#define I2O_CONTEXT_LIST_USED 0x01
371#define I2O_CONTEXT_LIST_DELETED 0x02
372
373/* timeouts */
374#define I2O_TIMEOUT_INIT_OUTBOUND_QUEUE 15
375#define I2O_TIMEOUT_MESSAGE_GET 5
376#define I2O_TIMEOUT_RESET 30
377#define I2O_TIMEOUT_STATUS_GET 5
378#define I2O_TIMEOUT_LCT_GET 360
379#define I2O_TIMEOUT_SCSI_SCB_ABORT 240
380
381/* retries */
382#define I2O_HRT_GET_TRIES 3
383#define I2O_LCT_GET_TRIES 3
384
385/* defines for max_sectors and max_phys_segments */
386#define I2O_MAX_SECTORS 1024
387#define I2O_MAX_SECTORS_LIMITED 128
388#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS
389
390/*
41 * Message structures 391 * Message structures
42 */ 392 */
43struct i2o_message { 393struct i2o_message {
@@ -58,6 +408,12 @@ struct i2o_message {
58 u32 body[0]; 408 u32 body[0];
59}; 409};
60 410
411/* MFA and I2O message used by mempool */
412struct i2o_msg_mfa {
413 u32 mfa; /* MFA returned by the controller */
414 struct i2o_message msg; /* I2O message */
415};
416
61/* 417/*
62 * Each I2O device entity has one of these. There is one per device. 418 * Each I2O device entity has one of these. There is one per device.
63 */ 419 */
@@ -130,6 +486,15 @@ struct i2o_dma {
130}; 486};
131 487
132/* 488/*
489 * Contains slab cache and mempool information
490 */
491struct i2o_pool {
492 char *name;
493 kmem_cache_t *slab;
494 mempool_t *mempool;
495};
496
497/*
133 * Contains IO mapped address information 498 * Contains IO mapped address information
134 */ 499 */
135struct i2o_io { 500struct i2o_io {
@@ -174,8 +539,6 @@ struct i2o_controller {
174 void __iomem *irq_status; /* Interrupt status register address */ 539 void __iomem *irq_status; /* Interrupt status register address */
175 void __iomem *irq_mask; /* Interrupt mask register address */ 540 void __iomem *irq_mask; /* Interrupt mask register address */
176 541
177 /* Dynamic LCT related data */
178
179 struct i2o_dma status; /* IOP status block */ 542 struct i2o_dma status; /* IOP status block */
180 543
181 struct i2o_dma hrt; /* HW Resource Table */ 544 struct i2o_dma hrt; /* HW Resource Table */
@@ -188,6 +551,8 @@ struct i2o_controller {
188 struct i2o_io in_queue; /* inbound message queue Host->IOP */ 551 struct i2o_io in_queue; /* inbound message queue Host->IOP */
189 struct i2o_dma out_queue; /* outbound message queue IOP->Host */ 552 struct i2o_dma out_queue; /* outbound message queue IOP->Host */
190 553
554 struct i2o_pool in_msg; /* mempool for inbound messages */
555
191 unsigned int battery:1; /* Has a battery backup */ 556 unsigned int battery:1; /* Has a battery backup */
192 unsigned int io_alloc:1; /* An I/O resource was allocated */ 557 unsigned int io_alloc:1; /* An I/O resource was allocated */
193 unsigned int mem_alloc:1; /* A memory resource was allocated */ 558 unsigned int mem_alloc:1; /* A memory resource was allocated */
@@ -196,7 +561,6 @@ struct i2o_controller {
196 struct resource mem_resource; /* Mem resource allocated to the IOP */ 561 struct resource mem_resource; /* Mem resource allocated to the IOP */
197 562
198 struct device device; 563 struct device device;
199 struct class_device *classdev; /* I2O controller class device */
200 struct i2o_device *exec; /* Executive */ 564 struct i2o_device *exec; /* Executive */
201#if BITS_PER_LONG == 64 565#if BITS_PER_LONG == 64
202 spinlock_t context_list_lock; /* lock for context_list */ 566 spinlock_t context_list_lock; /* lock for context_list */
@@ -247,16 +611,13 @@ struct i2o_sys_tbl {
247extern struct list_head i2o_controllers; 611extern struct list_head i2o_controllers;
248 612
249/* Message functions */ 613/* Message functions */
250static inline u32 i2o_msg_get(struct i2o_controller *, 614static inline struct i2o_message *i2o_msg_get(struct i2o_controller *);
251 struct i2o_message __iomem **); 615extern struct i2o_message *i2o_msg_get_wait(struct i2o_controller *, int);
252extern u32 i2o_msg_get_wait(struct i2o_controller *, 616static inline void i2o_msg_post(struct i2o_controller *, struct i2o_message *);
253 struct i2o_message __iomem **, int); 617static inline int i2o_msg_post_wait(struct i2o_controller *,
254static inline void i2o_msg_post(struct i2o_controller *, u32); 618 struct i2o_message *, unsigned long);
255static inline int i2o_msg_post_wait(struct i2o_controller *, u32, 619extern int i2o_msg_post_wait_mem(struct i2o_controller *, struct i2o_message *,
256 unsigned long); 620 unsigned long, struct i2o_dma *);
257extern int i2o_msg_post_wait_mem(struct i2o_controller *, u32, unsigned long,
258 struct i2o_dma *);
259extern void i2o_msg_nop(struct i2o_controller *, u32);
260static inline void i2o_flush_reply(struct i2o_controller *, u32); 621static inline void i2o_flush_reply(struct i2o_controller *, u32);
261 622
262/* IOP functions */ 623/* IOP functions */
@@ -384,10 +745,10 @@ static inline u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size)
384static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr, 745static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
385 size_t size, 746 size_t size,
386 enum dma_data_direction direction, 747 enum dma_data_direction direction,
387 u32 __iomem ** sg_ptr) 748 u32 ** sg_ptr)
388{ 749{
389 u32 sg_flags; 750 u32 sg_flags;
390 u32 __iomem *mptr = *sg_ptr; 751 u32 *mptr = *sg_ptr;
391 dma_addr_t dma_addr; 752 dma_addr_t dma_addr;
392 753
393 switch (direction) { 754 switch (direction) {
@@ -405,16 +766,16 @@ static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
405 if (!dma_mapping_error(dma_addr)) { 766 if (!dma_mapping_error(dma_addr)) {
406#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 767#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
407 if ((sizeof(dma_addr_t) > 4) && c->pae_support) { 768 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
408 writel(0x7C020002, mptr++); 769 *mptr++ = cpu_to_le32(0x7C020002);
409 writel(PAGE_SIZE, mptr++); 770 *mptr++ = cpu_to_le32(PAGE_SIZE);
410 } 771 }
411#endif 772#endif
412 773
413 writel(sg_flags | size, mptr++); 774 *mptr++ = cpu_to_le32(sg_flags | size);
414 writel(i2o_dma_low(dma_addr), mptr++); 775 *mptr++ = cpu_to_le32(i2o_dma_low(dma_addr));
415#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 776#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
416 if ((sizeof(dma_addr_t) > 4) && c->pae_support) 777 if ((sizeof(dma_addr_t) > 4) && c->pae_support)
417 writel(i2o_dma_high(dma_addr), mptr++); 778 *mptr++ = cpu_to_le32(i2o_dma_high(dma_addr));
418#endif 779#endif
419 *sg_ptr = mptr; 780 *sg_ptr = mptr;
420 } 781 }
@@ -439,10 +800,10 @@ static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
439static inline int i2o_dma_map_sg(struct i2o_controller *c, 800static inline int i2o_dma_map_sg(struct i2o_controller *c,
440 struct scatterlist *sg, int sg_count, 801 struct scatterlist *sg, int sg_count,
441 enum dma_data_direction direction, 802 enum dma_data_direction direction,
442 u32 __iomem ** sg_ptr) 803 u32 ** sg_ptr)
443{ 804{
444 u32 sg_flags; 805 u32 sg_flags;
445 u32 __iomem *mptr = *sg_ptr; 806 u32 *mptr = *sg_ptr;
446 807
447 switch (direction) { 808 switch (direction) {
448 case DMA_TO_DEVICE: 809 case DMA_TO_DEVICE:
@@ -461,19 +822,19 @@ static inline int i2o_dma_map_sg(struct i2o_controller *c,
461 822
462#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 823#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
463 if ((sizeof(dma_addr_t) > 4) && c->pae_support) { 824 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
464 writel(0x7C020002, mptr++); 825 *mptr++ = cpu_to_le32(0x7C020002);
465 writel(PAGE_SIZE, mptr++); 826 *mptr++ = cpu_to_le32(PAGE_SIZE);
466 } 827 }
467#endif 828#endif
468 829
469 while (sg_count-- > 0) { 830 while (sg_count-- > 0) {
470 if (!sg_count) 831 if (!sg_count)
471 sg_flags |= 0xC0000000; 832 sg_flags |= 0xC0000000;
472 writel(sg_flags | sg_dma_len(sg), mptr++); 833 *mptr++ = cpu_to_le32(sg_flags | sg_dma_len(sg));
473 writel(i2o_dma_low(sg_dma_address(sg)), mptr++); 834 *mptr++ = cpu_to_le32(i2o_dma_low(sg_dma_address(sg)));
474#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 835#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
475 if ((sizeof(dma_addr_t) > 4) && c->pae_support) 836 if ((sizeof(dma_addr_t) > 4) && c->pae_support)
476 writel(i2o_dma_high(sg_dma_address(sg)), mptr++); 837 *mptr++ = cpu_to_le32(i2o_dma_high(sg_dma_address(sg)));
477#endif 838#endif
478 sg++; 839 sg++;
479 } 840 }
@@ -563,6 +924,64 @@ static inline int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr,
563 return 0; 924 return 0;
564}; 925};
565 926
927/*
928 * i2o_pool_alloc - Allocate an slab cache and mempool
929 * @mempool: pointer to struct i2o_pool to write data into.
930 * @name: name which is used to identify cache
931 * @size: size of each object
932 * @min_nr: minimum number of objects
933 *
934 * First allocates a slab cache with name and size. Then allocates a
935 * mempool which uses the slab cache for allocation and freeing.
936 *
937 * Returns 0 on success or negative error code on failure.
938 */
939static inline int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
940 size_t size, int min_nr)
941{
942 pool->name = kmalloc(strlen(name) + 1, GFP_KERNEL);
943 if (!pool->name)
944 goto exit;
945 strcpy(pool->name, name);
946
947 pool->slab =
948 kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL,
949 NULL);
950 if (!pool->slab)
951 goto free_name;
952
953 pool->mempool =
954 mempool_create(min_nr, mempool_alloc_slab, mempool_free_slab,
955 pool->slab);
956 if (!pool->mempool)
957 goto free_slab;
958
959 return 0;
960
961 free_slab:
962 kmem_cache_destroy(pool->slab);
963
964 free_name:
965 kfree(pool->name);
966
967 exit:
968 return -ENOMEM;
969};
970
971/*
972 * i2o_pool_free - Free slab cache and mempool again
973 * @mempool: pointer to struct i2o_pool which should be freed
974 *
975 * Note that you have to return all objects to the mempool again before
976 * calling i2o_pool_free().
977 */
978static inline void i2o_pool_free(struct i2o_pool *pool)
979{
980 mempool_destroy(pool->mempool);
981 kmem_cache_destroy(pool->slab);
982 kfree(pool->name);
983};
984
566/* I2O driver (OSM) functions */ 985/* I2O driver (OSM) functions */
567extern int i2o_driver_register(struct i2o_driver *); 986extern int i2o_driver_register(struct i2o_driver *);
568extern void i2o_driver_unregister(struct i2o_driver *); 987extern void i2o_driver_unregister(struct i2o_driver *);
@@ -638,39 +1057,89 @@ extern int i2o_exec_lct_get(struct i2o_controller *);
638#define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj)) 1057#define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj))
639 1058
640/** 1059/**
1060 * i2o_out_to_virt - Turn an I2O message to a virtual address
1061 * @c: controller
1062 * @m: message engine value
1063 *
1064 * Turn a receive message from an I2O controller bus address into
1065 * a Linux virtual address. The shared page frame is a linear block
1066 * so we simply have to shift the offset. This function does not
1067 * work for sender side messages as they are ioremap objects
1068 * provided by the I2O controller.
1069 */
1070static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c,
1071 u32 m)
1072{
1073 BUG_ON(m < c->out_queue.phys
1074 || m >= c->out_queue.phys + c->out_queue.len);
1075
1076 return c->out_queue.virt + (m - c->out_queue.phys);
1077};
1078
1079/**
1080 * i2o_msg_in_to_virt - Turn an I2O message to a virtual address
1081 * @c: controller
1082 * @m: message engine value
1083 *
1084 * Turn a send message from an I2O controller bus address into
1085 * a Linux virtual address. The shared page frame is a linear block
1086 * so we simply have to shift the offset. This function does not
1087 * work for receive side messages as they are kmalloc objects
1088 * in a different pool.
1089 */
1090static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct
1091 i2o_controller *c,
1092 u32 m)
1093{
1094 return c->in_queue.virt + m;
1095};
1096
1097/**
641 * i2o_msg_get - obtain an I2O message from the IOP 1098 * i2o_msg_get - obtain an I2O message from the IOP
642 * @c: I2O controller 1099 * @c: I2O controller
643 * @msg: pointer to a I2O message pointer
644 * 1100 *
645 * This function tries to get a message slot. If no message slot is 1101 * This function tries to get a message frame. If no message frame is
646 * available do not wait until one is availabe (see also i2o_msg_get_wait). 1102 * available do not wait until one is availabe (see also i2o_msg_get_wait).
1103 * The returned pointer to the message frame is not in I/O memory, it is
1104 * allocated from a mempool. But because a MFA is allocated from the
1105 * controller too it is guaranteed that i2o_msg_post() will never fail.
647 * 1106 *
648 * On a success the message is returned and the pointer to the message is 1107 * On a success a pointer to the message frame is returned. If the message
649 * set in msg. The returned message is the physical page frame offset 1108 * queue is empty -EBUSY is returned and if no memory is available -ENOMEM
650 * address from the read port (see the i2o spec). If no message is 1109 * is returned.
651 * available returns I2O_QUEUE_EMPTY and msg is leaved untouched.
652 */ 1110 */
653static inline u32 i2o_msg_get(struct i2o_controller *c, 1111static inline struct i2o_message *i2o_msg_get(struct i2o_controller *c)
654 struct i2o_message __iomem ** msg)
655{ 1112{
656 u32 m = readl(c->in_port); 1113 struct i2o_msg_mfa *mmsg = mempool_alloc(c->in_msg.mempool, GFP_ATOMIC);
657 1114 if (!mmsg)
658 if (m != I2O_QUEUE_EMPTY) 1115 return ERR_PTR(-ENOMEM);
659 *msg = c->in_queue.virt + m; 1116
1117 mmsg->mfa = readl(c->in_port);
1118 if (mmsg->mfa == I2O_QUEUE_EMPTY) {
1119 mempool_free(mmsg, c->in_msg.mempool);
1120 return ERR_PTR(-EBUSY);
1121 }
660 1122
661 return m; 1123 return &mmsg->msg;
662}; 1124};
663 1125
664/** 1126/**
665 * i2o_msg_post - Post I2O message to I2O controller 1127 * i2o_msg_post - Post I2O message to I2O controller
666 * @c: I2O controller to which the message should be send 1128 * @c: I2O controller to which the message should be send
667 * @m: the message identifier 1129 * @msg: message returned by i2o_msg_get()
668 * 1130 *
669 * Post the message to the I2O controller. 1131 * Post the message to the I2O controller and return immediately.
670 */ 1132 */
671static inline void i2o_msg_post(struct i2o_controller *c, u32 m) 1133static inline void i2o_msg_post(struct i2o_controller *c,
1134 struct i2o_message *msg)
672{ 1135{
673 writel(m, c->in_port); 1136 struct i2o_msg_mfa *mmsg;
1137
1138 mmsg = container_of(msg, struct i2o_msg_mfa, msg);
1139 memcpy_toio(i2o_msg_in_to_virt(c, mmsg->mfa), msg,
1140 (le32_to_cpu(msg->u.head[0]) >> 16) << 2);
1141 writel(mmsg->mfa, c->in_port);
1142 mempool_free(mmsg, c->in_msg.mempool);
674}; 1143};
675 1144
676/** 1145/**
@@ -685,62 +1154,66 @@ static inline void i2o_msg_post(struct i2o_controller *c, u32 m)
685 * 1154 *
686 * Returns 0 on success or negative error code on failure. 1155 * Returns 0 on success or negative error code on failure.
687 */ 1156 */
688static inline int i2o_msg_post_wait(struct i2o_controller *c, u32 m, 1157static inline int i2o_msg_post_wait(struct i2o_controller *c,
1158 struct i2o_message *msg,
689 unsigned long timeout) 1159 unsigned long timeout)
690{ 1160{
691 return i2o_msg_post_wait_mem(c, m, timeout, NULL); 1161 return i2o_msg_post_wait_mem(c, msg, timeout, NULL);
692}; 1162};
693 1163
694/** 1164/**
695 * i2o_flush_reply - Flush reply from I2O controller 1165 * i2o_msg_nop_mfa - Returns a fetched MFA back to the controller
696 * @c: I2O controller 1166 * @c: I2O controller from which the MFA was fetched
697 * @m: the message identifier 1167 * @mfa: MFA which should be returned
698 * 1168 *
699 * The I2O controller must be informed that the reply message is not needed 1169 * This function must be used for preserved messages, because i2o_msg_nop()
700 * anymore. If you forget to flush the reply, the message frame can't be 1170 * also returns the allocated memory back to the msg_pool mempool.
701 * used by the controller anymore and is therefore lost.
702 */ 1171 */
703static inline void i2o_flush_reply(struct i2o_controller *c, u32 m) 1172static inline void i2o_msg_nop_mfa(struct i2o_controller *c, u32 mfa)
704{ 1173{
705 writel(m, c->out_port); 1174 struct i2o_message __iomem *msg;
1175 u32 nop[3] = {
1176 THREE_WORD_MSG_SIZE | SGL_OFFSET_0,
1177 I2O_CMD_UTIL_NOP << 24 | HOST_TID << 12 | ADAPTER_TID,
1178 0x00000000
1179 };
1180
1181 msg = i2o_msg_in_to_virt(c, mfa);
1182 memcpy_toio(msg, nop, sizeof(nop));
1183 writel(mfa, c->in_port);
706}; 1184};
707 1185
708/** 1186/**
709 * i2o_out_to_virt - Turn an I2O message to a virtual address 1187 * i2o_msg_nop - Returns a message which is not used
710 * @c: controller 1188 * @c: I2O controller from which the message was created
711 * @m: message engine value 1189 * @msg: message which should be returned
712 * 1190 *
713 * Turn a receive message from an I2O controller bus address into 1191 * If you fetch a message via i2o_msg_get, and can't use it, you must
714 * a Linux virtual address. The shared page frame is a linear block 1192 * return the message with this function. Otherwise the MFA is lost as well
715 * so we simply have to shift the offset. This function does not 1193 * as the allocated memory from the mempool.
716 * work for sender side messages as they are ioremap objects
717 * provided by the I2O controller.
718 */ 1194 */
719static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c, 1195static inline void i2o_msg_nop(struct i2o_controller *c,
720 u32 m) 1196 struct i2o_message *msg)
721{ 1197{
722 BUG_ON(m < c->out_queue.phys 1198 struct i2o_msg_mfa *mmsg;
723 || m >= c->out_queue.phys + c->out_queue.len); 1199 mmsg = container_of(msg, struct i2o_msg_mfa, msg);
724 1200
725 return c->out_queue.virt + (m - c->out_queue.phys); 1201 i2o_msg_nop_mfa(c, mmsg->mfa);
1202 mempool_free(mmsg, c->in_msg.mempool);
726}; 1203};
727 1204
728/** 1205/**
729 * i2o_msg_in_to_virt - Turn an I2O message to a virtual address 1206 * i2o_flush_reply - Flush reply from I2O controller
730 * @c: controller 1207 * @c: I2O controller
731 * @m: message engine value 1208 * @m: the message identifier
732 * 1209 *
733 * Turn a send message from an I2O controller bus address into 1210 * The I2O controller must be informed that the reply message is not needed
734 * a Linux virtual address. The shared page frame is a linear block 1211 * anymore. If you forget to flush the reply, the message frame can't be
735 * so we simply have to shift the offset. This function does not 1212 * used by the controller anymore and is therefore lost.
736 * work for receive side messages as they are kmalloc objects
737 * in a different pool.
738 */ 1213 */
739static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct 1214static inline void i2o_flush_reply(struct i2o_controller *c, u32 m)
740 i2o_controller *c,
741 u32 m)
742{ 1215{
743 return c->in_queue.virt + m; 1216 writel(m, c->out_port);
744}; 1217};
745 1218
746/* 1219/*
@@ -779,350 +1252,5 @@ extern void i2o_dump_message(struct i2o_message *);
779extern void i2o_dump_hrt(struct i2o_controller *c); 1252extern void i2o_dump_hrt(struct i2o_controller *c);
780extern void i2o_debug_state(struct i2o_controller *c); 1253extern void i2o_debug_state(struct i2o_controller *c);
781 1254
782/*
783 * Cache strategies
784 */
785
786/* The NULL strategy leaves everything up to the controller. This tends to be a
787 * pessimal but functional choice.
788 */
789#define CACHE_NULL 0
790/* Prefetch data when reading. We continually attempt to load the next 32 sectors
791 * into the controller cache.
792 */
793#define CACHE_PREFETCH 1
794/* Prefetch data when reading. We sometimes attempt to load the next 32 sectors
795 * into the controller cache. When an I/O is less <= 8K we assume its probably
796 * not sequential and don't prefetch (default)
797 */
798#define CACHE_SMARTFETCH 2
799/* Data is written to the cache and then out on to the disk. The I/O must be
800 * physically on the medium before the write is acknowledged (default without
801 * NVRAM)
802 */
803#define CACHE_WRITETHROUGH 17
804/* Data is written to the cache and then out on to the disk. The controller
805 * is permitted to write back the cache any way it wants. (default if battery
806 * backed NVRAM is present). It can be useful to set this for swap regardless of
807 * battery state.
808 */
809#define CACHE_WRITEBACK 18
810/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
811 * write large I/O's directly to disk bypassing the cache to avoid the extra
812 * memory copy hits. Small writes are writeback cached
813 */
814#define CACHE_SMARTBACK 19
815/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
816 * write large I/O's directly to disk bypassing the cache to avoid the extra
817 * memory copy hits. Small writes are writethrough cached. Suitable for devices
818 * lacking battery backup
819 */
820#define CACHE_SMARTTHROUGH 20
821
822/*
823 * Ioctl structures
824 */
825
826#define BLKI2OGRSTRAT _IOR('2', 1, int)
827#define BLKI2OGWSTRAT _IOR('2', 2, int)
828#define BLKI2OSRSTRAT _IOW('2', 3, int)
829#define BLKI2OSWSTRAT _IOW('2', 4, int)
830
831/*
832 * I2O Function codes
833 */
834
835/*
836 * Executive Class
837 */
838#define I2O_CMD_ADAPTER_ASSIGN 0xB3
839#define I2O_CMD_ADAPTER_READ 0xB2
840#define I2O_CMD_ADAPTER_RELEASE 0xB5
841#define I2O_CMD_BIOS_INFO_SET 0xA5
842#define I2O_CMD_BOOT_DEVICE_SET 0xA7
843#define I2O_CMD_CONFIG_VALIDATE 0xBB
844#define I2O_CMD_CONN_SETUP 0xCA
845#define I2O_CMD_DDM_DESTROY 0xB1
846#define I2O_CMD_DDM_ENABLE 0xD5
847#define I2O_CMD_DDM_QUIESCE 0xC7
848#define I2O_CMD_DDM_RESET 0xD9
849#define I2O_CMD_DDM_SUSPEND 0xAF
850#define I2O_CMD_DEVICE_ASSIGN 0xB7
851#define I2O_CMD_DEVICE_RELEASE 0xB9
852#define I2O_CMD_HRT_GET 0xA8
853#define I2O_CMD_ADAPTER_CLEAR 0xBE
854#define I2O_CMD_ADAPTER_CONNECT 0xC9
855#define I2O_CMD_ADAPTER_RESET 0xBD
856#define I2O_CMD_LCT_NOTIFY 0xA2
857#define I2O_CMD_OUTBOUND_INIT 0xA1
858#define I2O_CMD_PATH_ENABLE 0xD3
859#define I2O_CMD_PATH_QUIESCE 0xC5
860#define I2O_CMD_PATH_RESET 0xD7
861#define I2O_CMD_STATIC_MF_CREATE 0xDD
862#define I2O_CMD_STATIC_MF_RELEASE 0xDF
863#define I2O_CMD_STATUS_GET 0xA0
864#define I2O_CMD_SW_DOWNLOAD 0xA9
865#define I2O_CMD_SW_UPLOAD 0xAB
866#define I2O_CMD_SW_REMOVE 0xAD
867#define I2O_CMD_SYS_ENABLE 0xD1
868#define I2O_CMD_SYS_MODIFY 0xC1
869#define I2O_CMD_SYS_QUIESCE 0xC3
870#define I2O_CMD_SYS_TAB_SET 0xA3
871
872/*
873 * Utility Class
874 */
875#define I2O_CMD_UTIL_NOP 0x00
876#define I2O_CMD_UTIL_ABORT 0x01
877#define I2O_CMD_UTIL_CLAIM 0x09
878#define I2O_CMD_UTIL_RELEASE 0x0B
879#define I2O_CMD_UTIL_PARAMS_GET 0x06
880#define I2O_CMD_UTIL_PARAMS_SET 0x05
881#define I2O_CMD_UTIL_EVT_REGISTER 0x13
882#define I2O_CMD_UTIL_EVT_ACK 0x14
883#define I2O_CMD_UTIL_CONFIG_DIALOG 0x10
884#define I2O_CMD_UTIL_DEVICE_RESERVE 0x0D
885#define I2O_CMD_UTIL_DEVICE_RELEASE 0x0F
886#define I2O_CMD_UTIL_LOCK 0x17
887#define I2O_CMD_UTIL_LOCK_RELEASE 0x19
888#define I2O_CMD_UTIL_REPLY_FAULT_NOTIFY 0x15
889
890/*
891 * SCSI Host Bus Adapter Class
892 */
893#define I2O_CMD_SCSI_EXEC 0x81
894#define I2O_CMD_SCSI_ABORT 0x83
895#define I2O_CMD_SCSI_BUSRESET 0x27
896
897/*
898 * Bus Adapter Class
899 */
900#define I2O_CMD_BUS_ADAPTER_RESET 0x85
901#define I2O_CMD_BUS_RESET 0x87
902#define I2O_CMD_BUS_SCAN 0x89
903#define I2O_CMD_BUS_QUIESCE 0x8b
904
905/*
906 * Random Block Storage Class
907 */
908#define I2O_CMD_BLOCK_READ 0x30
909#define I2O_CMD_BLOCK_WRITE 0x31
910#define I2O_CMD_BLOCK_CFLUSH 0x37
911#define I2O_CMD_BLOCK_MLOCK 0x49
912#define I2O_CMD_BLOCK_MUNLOCK 0x4B
913#define I2O_CMD_BLOCK_MMOUNT 0x41
914#define I2O_CMD_BLOCK_MEJECT 0x43
915#define I2O_CMD_BLOCK_POWER 0x70
916
917#define I2O_CMD_PRIVATE 0xFF
918
919/* Command status values */
920
921#define I2O_CMD_IN_PROGRESS 0x01
922#define I2O_CMD_REJECTED 0x02
923#define I2O_CMD_FAILED 0x03
924#define I2O_CMD_COMPLETED 0x04
925
926/* I2O API function return values */
927
928#define I2O_RTN_NO_ERROR 0
929#define I2O_RTN_NOT_INIT 1
930#define I2O_RTN_FREE_Q_EMPTY 2
931#define I2O_RTN_TCB_ERROR 3
932#define I2O_RTN_TRANSACTION_ERROR 4
933#define I2O_RTN_ADAPTER_ALREADY_INIT 5
934#define I2O_RTN_MALLOC_ERROR 6
935#define I2O_RTN_ADPTR_NOT_REGISTERED 7
936#define I2O_RTN_MSG_REPLY_TIMEOUT 8
937#define I2O_RTN_NO_STATUS 9
938#define I2O_RTN_NO_FIRM_VER 10
939#define I2O_RTN_NO_LINK_SPEED 11
940
941/* Reply message status defines for all messages */
942
943#define I2O_REPLY_STATUS_SUCCESS 0x00
944#define I2O_REPLY_STATUS_ABORT_DIRTY 0x01
945#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02
946#define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03
947#define I2O_REPLY_STATUS_ERROR_DIRTY 0x04
948#define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05
949#define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER 0x06
950#define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY 0x08
951#define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09
952#define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0A
953#define I2O_REPLY_STATUS_TRANSACTION_ERROR 0x0B
954#define I2O_REPLY_STATUS_PROGRESS_REPORT 0x80
955
956/* Status codes and Error Information for Parameter functions */
957
958#define I2O_PARAMS_STATUS_SUCCESS 0x00
959#define I2O_PARAMS_STATUS_BAD_KEY_ABORT 0x01
960#define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE 0x02
961#define I2O_PARAMS_STATUS_BUFFER_FULL 0x03
962#define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL 0x04
963#define I2O_PARAMS_STATUS_FIELD_UNREADABLE 0x05
964#define I2O_PARAMS_STATUS_FIELD_UNWRITEABLE 0x06
965#define I2O_PARAMS_STATUS_INSUFFICIENT_FIELDS 0x07
966#define I2O_PARAMS_STATUS_INVALID_GROUP_ID 0x08
967#define I2O_PARAMS_STATUS_INVALID_OPERATION 0x09
968#define I2O_PARAMS_STATUS_NO_KEY_FIELD 0x0A
969#define I2O_PARAMS_STATUS_NO_SUCH_FIELD 0x0B
970#define I2O_PARAMS_STATUS_NON_DYNAMIC_GROUP 0x0C
971#define I2O_PARAMS_STATUS_OPERATION_ERROR 0x0D
972#define I2O_PARAMS_STATUS_SCALAR_ERROR 0x0E
973#define I2O_PARAMS_STATUS_TABLE_ERROR 0x0F
974#define I2O_PARAMS_STATUS_WRONG_GROUP_TYPE 0x10
975
976/* DetailedStatusCode defines for Executive, DDM, Util and Transaction error
977 * messages: Table 3-2 Detailed Status Codes.*/
978
979#define I2O_DSC_SUCCESS 0x0000
980#define I2O_DSC_BAD_KEY 0x0002
981#define I2O_DSC_TCL_ERROR 0x0003
982#define I2O_DSC_REPLY_BUFFER_FULL 0x0004
983#define I2O_DSC_NO_SUCH_PAGE 0x0005
984#define I2O_DSC_INSUFFICIENT_RESOURCE_SOFT 0x0006
985#define I2O_DSC_INSUFFICIENT_RESOURCE_HARD 0x0007
986#define I2O_DSC_CHAIN_BUFFER_TOO_LARGE 0x0009
987#define I2O_DSC_UNSUPPORTED_FUNCTION 0x000A
988#define I2O_DSC_DEVICE_LOCKED 0x000B
989#define I2O_DSC_DEVICE_RESET 0x000C
990#define I2O_DSC_INAPPROPRIATE_FUNCTION 0x000D
991#define I2O_DSC_INVALID_INITIATOR_ADDRESS 0x000E
992#define I2O_DSC_INVALID_MESSAGE_FLAGS 0x000F
993#define I2O_DSC_INVALID_OFFSET 0x0010
994#define I2O_DSC_INVALID_PARAMETER 0x0011
995#define I2O_DSC_INVALID_REQUEST 0x0012
996#define I2O_DSC_INVALID_TARGET_ADDRESS 0x0013
997#define I2O_DSC_MESSAGE_TOO_LARGE 0x0014
998#define I2O_DSC_MESSAGE_TOO_SMALL 0x0015
999#define I2O_DSC_MISSING_PARAMETER 0x0016
1000#define I2O_DSC_TIMEOUT 0x0017
1001#define I2O_DSC_UNKNOWN_ERROR 0x0018
1002#define I2O_DSC_UNKNOWN_FUNCTION 0x0019
1003#define I2O_DSC_UNSUPPORTED_VERSION 0x001A
1004#define I2O_DSC_DEVICE_BUSY 0x001B
1005#define I2O_DSC_DEVICE_NOT_AVAILABLE 0x001C
1006
1007/* DetailedStatusCode defines for Block Storage Operation: Table 6-7 Detailed
1008 Status Codes.*/
1009
1010#define I2O_BSA_DSC_SUCCESS 0x0000
1011#define I2O_BSA_DSC_MEDIA_ERROR 0x0001
1012#define I2O_BSA_DSC_ACCESS_ERROR 0x0002
1013#define I2O_BSA_DSC_DEVICE_FAILURE 0x0003
1014#define I2O_BSA_DSC_DEVICE_NOT_READY 0x0004
1015#define I2O_BSA_DSC_MEDIA_NOT_PRESENT 0x0005
1016#define I2O_BSA_DSC_MEDIA_LOCKED 0x0006
1017#define I2O_BSA_DSC_MEDIA_FAILURE 0x0007
1018#define I2O_BSA_DSC_PROTOCOL_FAILURE 0x0008
1019#define I2O_BSA_DSC_BUS_FAILURE 0x0009
1020#define I2O_BSA_DSC_ACCESS_VIOLATION 0x000A
1021#define I2O_BSA_DSC_WRITE_PROTECTED 0x000B
1022#define I2O_BSA_DSC_DEVICE_RESET 0x000C
1023#define I2O_BSA_DSC_VOLUME_CHANGED 0x000D
1024#define I2O_BSA_DSC_TIMEOUT 0x000E
1025
1026/* FailureStatusCodes, Table 3-3 Message Failure Codes */
1027
1028#define I2O_FSC_TRANSPORT_SERVICE_SUSPENDED 0x81
1029#define I2O_FSC_TRANSPORT_SERVICE_TERMINATED 0x82
1030#define I2O_FSC_TRANSPORT_CONGESTION 0x83
1031#define I2O_FSC_TRANSPORT_FAILURE 0x84
1032#define I2O_FSC_TRANSPORT_STATE_ERROR 0x85
1033#define I2O_FSC_TRANSPORT_TIME_OUT 0x86
1034#define I2O_FSC_TRANSPORT_ROUTING_FAILURE 0x87
1035#define I2O_FSC_TRANSPORT_INVALID_VERSION 0x88
1036#define I2O_FSC_TRANSPORT_INVALID_OFFSET 0x89
1037#define I2O_FSC_TRANSPORT_INVALID_MSG_FLAGS 0x8A
1038#define I2O_FSC_TRANSPORT_FRAME_TOO_SMALL 0x8B
1039#define I2O_FSC_TRANSPORT_FRAME_TOO_LARGE 0x8C
1040#define I2O_FSC_TRANSPORT_INVALID_TARGET_ID 0x8D
1041#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_ID 0x8E
1042#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_CONTEXT 0x8F
1043#define I2O_FSC_TRANSPORT_UNKNOWN_FAILURE 0xFF
1044
1045/* Device Claim Types */
1046#define I2O_CLAIM_PRIMARY 0x01000000
1047#define I2O_CLAIM_MANAGEMENT 0x02000000
1048#define I2O_CLAIM_AUTHORIZED 0x03000000
1049#define I2O_CLAIM_SECONDARY 0x04000000
1050
1051/* Message header defines for VersionOffset */
1052#define I2OVER15 0x0001
1053#define I2OVER20 0x0002
1054
1055/* Default is 1.5 */
1056#define I2OVERSION I2OVER15
1057
1058#define SGL_OFFSET_0 I2OVERSION
1059#define SGL_OFFSET_4 (0x0040 | I2OVERSION)
1060#define SGL_OFFSET_5 (0x0050 | I2OVERSION)
1061#define SGL_OFFSET_6 (0x0060 | I2OVERSION)
1062#define SGL_OFFSET_7 (0x0070 | I2OVERSION)
1063#define SGL_OFFSET_8 (0x0080 | I2OVERSION)
1064#define SGL_OFFSET_9 (0x0090 | I2OVERSION)
1065#define SGL_OFFSET_10 (0x00A0 | I2OVERSION)
1066#define SGL_OFFSET_11 (0x00B0 | I2OVERSION)
1067#define SGL_OFFSET_12 (0x00C0 | I2OVERSION)
1068#define SGL_OFFSET(x) (((x)<<4) | I2OVERSION)
1069
1070/* Transaction Reply Lists (TRL) Control Word structure */
1071#define TRL_SINGLE_FIXED_LENGTH 0x00
1072#define TRL_SINGLE_VARIABLE_LENGTH 0x40
1073#define TRL_MULTIPLE_FIXED_LENGTH 0x80
1074
1075 /* msg header defines for MsgFlags */
1076#define MSG_STATIC 0x0100
1077#define MSG_64BIT_CNTXT 0x0200
1078#define MSG_MULTI_TRANS 0x1000
1079#define MSG_FAIL 0x2000
1080#define MSG_FINAL 0x4000
1081#define MSG_REPLY 0x8000
1082
1083 /* minimum size msg */
1084#define THREE_WORD_MSG_SIZE 0x00030000
1085#define FOUR_WORD_MSG_SIZE 0x00040000
1086#define FIVE_WORD_MSG_SIZE 0x00050000
1087#define SIX_WORD_MSG_SIZE 0x00060000
1088#define SEVEN_WORD_MSG_SIZE 0x00070000
1089#define EIGHT_WORD_MSG_SIZE 0x00080000
1090#define NINE_WORD_MSG_SIZE 0x00090000
1091#define TEN_WORD_MSG_SIZE 0x000A0000
1092#define ELEVEN_WORD_MSG_SIZE 0x000B0000
1093#define I2O_MESSAGE_SIZE(x) ((x)<<16)
1094
1095/* special TID assignments */
1096#define ADAPTER_TID 0
1097#define HOST_TID 1
1098
1099/* outbound queue defines */
1100#define I2O_MAX_OUTBOUND_MSG_FRAMES 128
1101#define I2O_OUTBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */
1102
1103#define I2O_POST_WAIT_OK 0
1104#define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT
1105
1106#define I2O_CONTEXT_LIST_MIN_LENGTH 15
1107#define I2O_CONTEXT_LIST_USED 0x01
1108#define I2O_CONTEXT_LIST_DELETED 0x02
1109
1110/* timeouts */
1111#define I2O_TIMEOUT_INIT_OUTBOUND_QUEUE 15
1112#define I2O_TIMEOUT_MESSAGE_GET 5
1113#define I2O_TIMEOUT_RESET 30
1114#define I2O_TIMEOUT_STATUS_GET 5
1115#define I2O_TIMEOUT_LCT_GET 360
1116#define I2O_TIMEOUT_SCSI_SCB_ABORT 240
1117
1118/* retries */
1119#define I2O_HRT_GET_TRIES 3
1120#define I2O_LCT_GET_TRIES 3
1121
1122/* defines for max_sectors and max_phys_segments */
1123#define I2O_MAX_SECTORS 1024
1124#define I2O_MAX_SECTORS_LIMITED 256
1125#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS
1126
1127#endif /* __KERNEL__ */ 1255#endif /* __KERNEL__ */
1128#endif /* _I2O_H */ 1256#endif /* _I2O_H */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index a39c3c59789d..7b6a6a58e465 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -23,17 +23,6 @@
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/semaphore.h> 24#include <asm/semaphore.h>
25 25
26/*
27 * This is the multiple IDE interface driver, as evolved from hd.c.
28 * It supports up to four IDE interfaces, on one or more IRQs (usually 14 & 15).
29 * There can be up to two drives per interface, as per the ATA-2 spec.
30 *
31 * Primary i/f: ide0: major=3; (hda) minor=0; (hdb) minor=64
32 * Secondary i/f: ide1: major=22; (hdc or hd1a) minor=0; (hdd or hd1b) minor=64
33 * Tertiary i/f: ide2: major=33; (hde) minor=0; (hdf) minor=64
34 * Quaternary i/f: ide3: major=34; (hdg) minor=0; (hdh) minor=64
35 */
36
37/****************************************************************************** 26/******************************************************************************
38 * IDE driver configuration options (play with these as desired): 27 * IDE driver configuration options (play with these as desired):
39 * 28 *
@@ -193,11 +182,6 @@ typedef unsigned char byte; /* used everywhere */
193#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ 182#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */
194#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ 183#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */
195 184
196#define HOST(hwif,chipset) \
197{ \
198 return ((hwif)->chipset == chipset) ? 1 : 0; \
199}
200
201/* 185/*
202 * Check for an interrupt and acknowledge the interrupt status 186 * Check for an interrupt and acknowledge the interrupt status
203 */ 187 */
@@ -391,45 +375,6 @@ typedef union {
391} ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t; 375} ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t;
392 376
393/* 377/*
394 * ATA-IDE Error Register
395 *
396 * mark : Bad address mark
397 * tzero : Couldn't find track 0
398 * abrt : Aborted Command
399 * mcr : Media Change Request
400 * id : ID field not found
401 * mce : Media Change Event
402 * ecc : Uncorrectable ECC error
403 * bdd : dual meaing
404 */
405typedef union {
406 unsigned all :8;
407 struct {
408#if defined(__LITTLE_ENDIAN_BITFIELD)
409 unsigned mark :1;
410 unsigned tzero :1;
411 unsigned abrt :1;
412 unsigned mcr :1;
413 unsigned id :1;
414 unsigned mce :1;
415 unsigned ecc :1;
416 unsigned bdd :1;
417#elif defined(__BIG_ENDIAN_BITFIELD)
418 unsigned bdd :1;
419 unsigned ecc :1;
420 unsigned mce :1;
421 unsigned id :1;
422 unsigned mcr :1;
423 unsigned abrt :1;
424 unsigned tzero :1;
425 unsigned mark :1;
426#else
427#error "Please fix <asm/byteorder.h>"
428#endif
429 } b;
430} ata_error_t;
431
432/*
433 * ATA-IDE Select Register, aka Device-Head 378 * ATA-IDE Select Register, aka Device-Head
434 * 379 *
435 * head : always zeros here 380 * head : always zeros here
@@ -504,39 +449,6 @@ typedef union {
504} ata_status_t, atapi_status_t; 449} ata_status_t, atapi_status_t;
505 450
506/* 451/*
507 * ATA-IDE Control Register
508 *
509 * bit0 : Should be set to zero
510 * nIEN : device INTRQ to host
511 * SRST : host soft reset bit
512 * bit3 : ATA-2 thingy, Should be set to 1
513 * reserved456 : Reserved
514 * HOB : 48-bit address ordering, High Ordered Bit
515 */
516typedef union {
517 unsigned all : 8;
518 struct {
519#if defined(__LITTLE_ENDIAN_BITFIELD)
520 unsigned bit0 : 1;
521 unsigned nIEN : 1;
522 unsigned SRST : 1;
523 unsigned bit3 : 1;
524 unsigned reserved456 : 3;
525 unsigned HOB : 1;
526#elif defined(__BIG_ENDIAN_BITFIELD)
527 unsigned HOB : 1;
528 unsigned reserved456 : 3;
529 unsigned bit3 : 1;
530 unsigned SRST : 1;
531 unsigned nIEN : 1;
532 unsigned bit0 : 1;
533#else
534#error "Please fix <asm/byteorder.h>"
535#endif
536 } b;
537} ata_control_t;
538
539/*
540 * ATAPI Feature Register 452 * ATAPI Feature Register
541 * 453 *
542 * dma : Using DMA or PIO 454 * dma : Using DMA or PIO
@@ -618,39 +530,6 @@ typedef union {
618} atapi_error_t; 530} atapi_error_t;
619 531
620/* 532/*
621 * ATAPI floppy Drive Select Register
622 *
623 * sam_lun : Logical unit number
624 * reserved3 : Reserved
625 * drv : The responding drive will be drive 0 (0) or drive 1 (1)
626 * one5 : Should be set to 1
627 * reserved6 : Reserved
628 * one7 : Should be set to 1
629 */
630typedef union {
631 unsigned all :8;
632 struct {
633#if defined(__LITTLE_ENDIAN_BITFIELD)
634 unsigned sam_lun :3;
635 unsigned reserved3 :1;
636 unsigned drv :1;
637 unsigned one5 :1;
638 unsigned reserved6 :1;
639 unsigned one7 :1;
640#elif defined(__BIG_ENDIAN_BITFIELD)
641 unsigned one7 :1;
642 unsigned reserved6 :1;
643 unsigned one5 :1;
644 unsigned drv :1;
645 unsigned reserved3 :1;
646 unsigned sam_lun :3;
647#else
648#error "Please fix <asm/byteorder.h>"
649#endif
650 } b;
651} atapi_select_t;
652
653/*
654 * Status returned from various ide_ functions 533 * Status returned from various ide_ functions
655 */ 534 */
656typedef enum { 535typedef enum {
@@ -1101,10 +980,7 @@ typedef struct ide_driver_s {
1101 int (*end_request)(ide_drive_t *, int, int); 980 int (*end_request)(ide_drive_t *, int, int);
1102 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); 981 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8);
1103 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); 982 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq);
1104 int (*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long);
1105 ide_proc_entry_t *proc; 983 ide_proc_entry_t *proc;
1106 void (*ata_prebuilder)(ide_drive_t *);
1107 void (*atapi_prebuilder)(ide_drive_t *);
1108 struct device_driver gen_driver; 984 struct device_driver gen_driver;
1109} ide_driver_t; 985} ide_driver_t;
1110 986
@@ -1298,7 +1174,6 @@ extern int ide_spin_wait_hwgroup(ide_drive_t *);
1298extern void ide_timer_expiry(unsigned long); 1174extern void ide_timer_expiry(unsigned long);
1299extern irqreturn_t ide_intr(int irq, void *dev_id, struct pt_regs *regs); 1175extern irqreturn_t ide_intr(int irq, void *dev_id, struct pt_regs *regs);
1300extern void do_ide_request(request_queue_t *); 1176extern void do_ide_request(request_queue_t *);
1301extern void ide_init_subdrivers(void);
1302 1177
1303void ide_init_disk(struct gendisk *, ide_drive_t *); 1178void ide_init_disk(struct gendisk *, ide_drive_t *);
1304 1179
@@ -1371,6 +1246,12 @@ void ide_init_sg_cmd(ide_drive_t *, struct request *);
1371#define GOOD_DMA_DRIVE 1 1246#define GOOD_DMA_DRIVE 1
1372 1247
1373#ifdef CONFIG_BLK_DEV_IDEDMA 1248#ifdef CONFIG_BLK_DEV_IDEDMA
1249struct drive_list_entry {
1250 const char *id_model;
1251 const char *id_firmware;
1252};
1253
1254int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
1374int __ide_dma_bad_drive(ide_drive_t *); 1255int __ide_dma_bad_drive(ide_drive_t *);
1375int __ide_dma_good_drive(ide_drive_t *); 1256int __ide_dma_good_drive(ide_drive_t *);
1376int ide_use_dma(ide_drive_t *); 1257int ide_use_dma(ide_drive_t *);
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index e677f73f13dd..4fab3d0a4bce 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -157,8 +157,7 @@ struct pppox_proto {
157extern int register_pppox_proto(int proto_num, struct pppox_proto *pp); 157extern int register_pppox_proto(int proto_num, struct pppox_proto *pp);
158extern void unregister_pppox_proto(int proto_num); 158extern void unregister_pppox_proto(int proto_num);
159extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */ 159extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */
160extern int pppox_channel_ioctl(struct ppp_channel *pc, unsigned int cmd, 160extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
161 unsigned long arg);
162 161
163/* PPPoX socket states */ 162/* PPPoX socket states */
164enum { 163enum {
diff --git a/include/linux/inet.h b/include/linux/inet.h
index 3b5e9fdff872..6c5587af118d 100644
--- a/include/linux/inet.h
+++ b/include/linux/inet.h
@@ -45,6 +45,6 @@
45#ifdef __KERNEL__ 45#ifdef __KERNEL__
46#include <linux/types.h> 46#include <linux/types.h>
47 47
48extern __u32 in_aton(const char *str); 48extern __be32 in_aton(const char *str);
49#endif 49#endif
50#endif /* _LINUX_INET_H */ 50#endif /* _LINUX_INET_H */
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index ee5b239092ed..267c88b5f742 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -47,6 +47,8 @@ struct inotify_event {
47#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ 47#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */
48 48
49/* special flags */ 49/* special flags */
50#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */
51#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */
50#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */ 52#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */
51#define IN_ISDIR 0x40000000 /* event occurred against dir */ 53#define IN_ISDIR 0x40000000 /* event occurred against dir */
52#define IN_ONESHOT 0x80000000 /* only send event once */ 54#define IN_ONESHOT 0x80000000 /* only send event once */
diff --git a/include/linux/input.h b/include/linux/input.h
index 3c5823368ddb..6d4cc3c110d6 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -13,6 +13,7 @@
13#include <linux/time.h> 13#include <linux/time.h>
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/mod_devicetable.h>
16#else 17#else
17#include <sys/time.h> 18#include <sys/time.h>
18#include <sys/ioctl.h> 19#include <sys/ioctl.h>
@@ -511,6 +512,8 @@ struct input_absinfo {
511#define KEY_FN_S 0x1e3 512#define KEY_FN_S 0x1e3
512#define KEY_FN_B 0x1e4 513#define KEY_FN_B 0x1e4
513 514
515/* We avoid low common keys in module aliases so they don't get huge. */
516#define KEY_MIN_INTERESTING KEY_MUTE
514#define KEY_MAX 0x1ff 517#define KEY_MAX 0x1ff
515 518
516/* 519/*
@@ -793,6 +796,44 @@ struct ff_effect {
793 796
794#define FF_MAX 0x7f 797#define FF_MAX 0x7f
795 798
799struct input_device_id {
800
801 kernel_ulong_t flags;
802
803 struct input_id id;
804
805 kernel_ulong_t evbit[EV_MAX/BITS_PER_LONG+1];
806 kernel_ulong_t keybit[KEY_MAX/BITS_PER_LONG+1];
807 kernel_ulong_t relbit[REL_MAX/BITS_PER_LONG+1];
808 kernel_ulong_t absbit[ABS_MAX/BITS_PER_LONG+1];
809 kernel_ulong_t mscbit[MSC_MAX/BITS_PER_LONG+1];
810 kernel_ulong_t ledbit[LED_MAX/BITS_PER_LONG+1];
811 kernel_ulong_t sndbit[SND_MAX/BITS_PER_LONG+1];
812 kernel_ulong_t ffbit[FF_MAX/BITS_PER_LONG+1];
813 kernel_ulong_t swbit[SW_MAX/BITS_PER_LONG+1];
814
815 kernel_ulong_t driver_info;
816};
817
818/*
819 * Structure for hotplug & device<->driver matching.
820 */
821
822#define INPUT_DEVICE_ID_MATCH_BUS 1
823#define INPUT_DEVICE_ID_MATCH_VENDOR 2
824#define INPUT_DEVICE_ID_MATCH_PRODUCT 4
825#define INPUT_DEVICE_ID_MATCH_VERSION 8
826
827#define INPUT_DEVICE_ID_MATCH_EVBIT 0x010
828#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020
829#define INPUT_DEVICE_ID_MATCH_RELBIT 0x040
830#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080
831#define INPUT_DEVICE_ID_MATCH_MSCIT 0x100
832#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200
833#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400
834#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800
835#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
836
796#ifdef __KERNEL__ 837#ifdef __KERNEL__
797 838
798/* 839/*
@@ -901,49 +942,11 @@ struct input_dev {
901}; 942};
902#define to_input_dev(d) container_of(d, struct input_dev, cdev) 943#define to_input_dev(d) container_of(d, struct input_dev, cdev)
903 944
904/*
905 * Structure for hotplug & device<->driver matching.
906 */
907
908#define INPUT_DEVICE_ID_MATCH_BUS 1
909#define INPUT_DEVICE_ID_MATCH_VENDOR 2
910#define INPUT_DEVICE_ID_MATCH_PRODUCT 4
911#define INPUT_DEVICE_ID_MATCH_VERSION 8
912
913#define INPUT_DEVICE_ID_MATCH_EVBIT 0x010
914#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020
915#define INPUT_DEVICE_ID_MATCH_RELBIT 0x040
916#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080
917#define INPUT_DEVICE_ID_MATCH_MSCIT 0x100
918#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200
919#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400
920#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800
921#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
922
923#define INPUT_DEVICE_ID_MATCH_DEVICE\ 945#define INPUT_DEVICE_ID_MATCH_DEVICE\
924 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) 946 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
925#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\ 947#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\
926 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION) 948 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
927 949
928struct input_device_id {
929
930 unsigned long flags;
931
932 struct input_id id;
933
934 unsigned long evbit[NBITS(EV_MAX)];
935 unsigned long keybit[NBITS(KEY_MAX)];
936 unsigned long relbit[NBITS(REL_MAX)];
937 unsigned long absbit[NBITS(ABS_MAX)];
938 unsigned long mscbit[NBITS(MSC_MAX)];
939 unsigned long ledbit[NBITS(LED_MAX)];
940 unsigned long sndbit[NBITS(SND_MAX)];
941 unsigned long ffbit[NBITS(FF_MAX)];
942 unsigned long swbit[NBITS(SW_MAX)];
943
944 unsigned long driver_info;
945};
946
947struct input_handle; 950struct input_handle;
948 951
949struct input_handler { 952struct input_handler {
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 33e8a19a1a0f..4b55cf1df732 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -16,6 +16,7 @@
16 */ 16 */
17#ifndef _LINUX_IP_H 17#ifndef _LINUX_IP_H
18#define _LINUX_IP_H 18#define _LINUX_IP_H
19#include <linux/types.h>
19#include <asm/byteorder.h> 20#include <asm/byteorder.h>
20 21
21#define IPTOS_TOS_MASK 0x1E 22#define IPTOS_TOS_MASK 0x1E
@@ -78,126 +79,6 @@
78#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ 79#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
79#define IPOPT_TS_PRESPEC 3 /* specified modules only */ 80#define IPOPT_TS_PRESPEC 3 /* specified modules only */
80 81
81#ifdef __KERNEL__
82#include <linux/config.h>
83#include <linux/types.h>
84#include <net/request_sock.h>
85#include <net/sock.h>
86#include <linux/igmp.h>
87#include <net/flow.h>
88
89struct ip_options {
90 __u32 faddr; /* Saved first hop address */
91 unsigned char optlen;
92 unsigned char srr;
93 unsigned char rr;
94 unsigned char ts;
95 unsigned char is_setbyuser:1, /* Set by setsockopt? */
96 is_data:1, /* Options in __data, rather than skb */
97 is_strictroute:1, /* Strict source route */
98 srr_is_hit:1, /* Packet destination addr was our one */
99 is_changed:1, /* IP checksum more not valid */
100 rr_needaddr:1, /* Need to record addr of outgoing dev */
101 ts_needtime:1, /* Need to record timestamp */
102 ts_needaddr:1; /* Need to record addr of outgoing dev */
103 unsigned char router_alert;
104 unsigned char __pad1;
105 unsigned char __pad2;
106 unsigned char __data[0];
107};
108
109#define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
110
111struct inet_request_sock {
112 struct request_sock req;
113 u32 loc_addr;
114 u32 rmt_addr;
115 u16 rmt_port;
116 u16 snd_wscale : 4,
117 rcv_wscale : 4,
118 tstamp_ok : 1,
119 sack_ok : 1,
120 wscale_ok : 1,
121 ecn_ok : 1,
122 acked : 1;
123 struct ip_options *opt;
124};
125
126static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
127{
128 return (struct inet_request_sock *)sk;
129}
130
131struct ipv6_pinfo;
132
133struct inet_sock {
134 /* sk and pinet6 has to be the first two members of inet_sock */
135 struct sock sk;
136#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
137 struct ipv6_pinfo *pinet6;
138#endif
139 /* Socket demultiplex comparisons on incoming packets. */
140 __u32 daddr; /* Foreign IPv4 addr */
141 __u32 rcv_saddr; /* Bound local IPv4 addr */
142 __u16 dport; /* Destination port */
143 __u16 num; /* Local port */
144 __u32 saddr; /* Sending source */
145 __s16 uc_ttl; /* Unicast TTL */
146 __u16 cmsg_flags;
147 struct ip_options *opt;
148 __u16 sport; /* Source port */
149 __u16 id; /* ID counter for DF pkts */
150 __u8 tos; /* TOS */
151 __u8 mc_ttl; /* Multicasting TTL */
152 __u8 pmtudisc;
153 unsigned recverr : 1,
154 freebind : 1,
155 hdrincl : 1,
156 mc_loop : 1;
157 int mc_index; /* Multicast device index */
158 __u32 mc_addr;
159 struct ip_mc_socklist *mc_list; /* Group array */
160 /*
161 * Following members are used to retain the infomation to build
162 * an ip header on each ip fragmentation while the socket is corked.
163 */
164 struct {
165 unsigned int flags;
166 unsigned int fragsize;
167 struct ip_options *opt;
168 struct rtable *rt;
169 int length; /* Total length of all frames */
170 u32 addr;
171 struct flowi fl;
172 } cork;
173};
174
175#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */
176#define IPCORK_ALLFRAG 2 /* always fragment (for ipv6 for now) */
177
178static inline struct inet_sock *inet_sk(const struct sock *sk)
179{
180 return (struct inet_sock *)sk;
181}
182
183static inline void __inet_sk_copy_descendant(struct sock *sk_to,
184 const struct sock *sk_from,
185 const int ancestor_size)
186{
187 memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1,
188 sk_from->sk_prot->obj_size - ancestor_size);
189}
190#if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE))
191static inline void inet_sk_copy_descendant(struct sock *sk_to,
192 const struct sock *sk_from)
193{
194 __inet_sk_copy_descendant(sk_to, sk_from, sizeof(struct inet_sock));
195}
196#endif
197#endif
198
199extern int inet_sk_rebuild_header(struct sock *sk);
200
201struct iphdr { 82struct iphdr {
202#if defined(__LITTLE_ENDIAN_BITFIELD) 83#if defined(__LITTLE_ENDIAN_BITFIELD)
203 __u8 ihl:4, 84 __u8 ihl:4,
@@ -209,14 +90,14 @@ struct iphdr {
209#error "Please fix <asm/byteorder.h>" 90#error "Please fix <asm/byteorder.h>"
210#endif 91#endif
211 __u8 tos; 92 __u8 tos;
212 __u16 tot_len; 93 __be16 tot_len;
213 __u16 id; 94 __be16 id;
214 __u16 frag_off; 95 __be16 frag_off;
215 __u8 ttl; 96 __u8 ttl;
216 __u8 protocol; 97 __u8 protocol;
217 __u16 check; 98 __u16 check;
218 __u32 saddr; 99 __be32 saddr;
219 __u32 daddr; 100 __be32 daddr;
220 /*The options start here. */ 101 /*The options start here. */
221}; 102};
222 103
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index e0b922785d98..93bbed5c6cf4 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -171,12 +171,13 @@ enum {
171}; 171};
172 172
173#ifdef __KERNEL__ 173#ifdef __KERNEL__
174#include <linux/in6.h> /* struct sockaddr_in6 */
175#include <linux/icmpv6.h> 174#include <linux/icmpv6.h>
176#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
177#include <linux/tcp.h> 175#include <linux/tcp.h>
178#include <linux/udp.h> 176#include <linux/udp.h>
179 177
178#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
179#include <net/inet_sock.h>
180
180/* 181/*
181 This structure contains results of exthdrs parsing 182 This structure contains results of exthdrs parsing
182 as offsets from skb->nh. 183 as offsets from skb->nh.
@@ -199,18 +200,17 @@ static inline int inet6_iif(const struct sk_buff *skb)
199 return IP6CB(skb)->iif; 200 return IP6CB(skb)->iif;
200} 201}
201 202
202struct tcp6_request_sock { 203struct inet6_request_sock {
203 struct tcp_request_sock req;
204 struct in6_addr loc_addr; 204 struct in6_addr loc_addr;
205 struct in6_addr rmt_addr; 205 struct in6_addr rmt_addr;
206 struct sk_buff *pktopts; 206 struct sk_buff *pktopts;
207 int iif; 207 int iif;
208}; 208};
209 209
210static inline struct tcp6_request_sock *tcp6_rsk(const struct request_sock *sk) 210struct tcp6_request_sock {
211{ 211 struct tcp_request_sock tcp6rsk_tcp;
212 return (struct tcp6_request_sock *)sk; 212 struct inet6_request_sock tcp6rsk_inet6;
213} 213};
214 214
215/** 215/**
216 * struct ipv6_pinfo - ipv6 private area 216 * struct ipv6_pinfo - ipv6 private area
@@ -298,12 +298,36 @@ struct tcp6_sock {
298 struct ipv6_pinfo inet6; 298 struct ipv6_pinfo inet6;
299}; 299};
300 300
301extern int inet6_sk_rebuild_header(struct sock *sk);
302
301#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 303#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
302static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) 304static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
303{ 305{
304 return inet_sk(__sk)->pinet6; 306 return inet_sk(__sk)->pinet6;
305} 307}
306 308
309static inline struct inet6_request_sock *
310 inet6_rsk(const struct request_sock *rsk)
311{
312 return (struct inet6_request_sock *)(((u8 *)rsk) +
313 inet_rsk(rsk)->inet6_rsk_offset);
314}
315
316static inline u32 inet6_rsk_offset(struct request_sock *rsk)
317{
318 return rsk->rsk_ops->obj_size - sizeof(struct inet6_request_sock);
319}
320
321static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops)
322{
323 struct request_sock *req = reqsk_alloc(ops);
324
325 if (req != NULL)
326 inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req);
327
328 return req;
329}
330
307static inline struct raw6_sock *raw6_sk(const struct sock *sk) 331static inline struct raw6_sock *raw6_sk(const struct sock *sk)
308{ 332{
309 return (struct raw6_sock *)sk; 333 return (struct raw6_sock *)sk;
@@ -323,28 +347,37 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
323#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) 347#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only)
324#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) 348#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk))
325 349
326#include <linux/tcp.h> 350struct inet6_timewait_sock {
351 struct in6_addr tw_v6_daddr;
352 struct in6_addr tw_v6_rcv_saddr;
353};
327 354
328struct tcp6_timewait_sock { 355struct tcp6_timewait_sock {
329 struct tcp_timewait_sock tw_v6_sk; 356 struct tcp_timewait_sock tcp6tw_tcp;
330 struct in6_addr tw_v6_daddr; 357 struct inet6_timewait_sock tcp6tw_inet6;
331 struct in6_addr tw_v6_rcv_saddr;
332}; 358};
333 359
334static inline struct tcp6_timewait_sock *tcp6_twsk(const struct sock *sk) 360static inline u16 inet6_tw_offset(const struct proto *prot)
335{ 361{
336 return (struct tcp6_timewait_sock *)sk; 362 return prot->twsk_prot->twsk_obj_size -
363 sizeof(struct inet6_timewait_sock);
337} 364}
338 365
339static inline struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk) 366static inline struct inet6_timewait_sock *inet6_twsk(const struct sock *sk)
367{
368 return (struct inet6_timewait_sock *)(((u8 *)sk) +
369 inet_twsk(sk)->tw_ipv6_offset);
370}
371
372static inline struct in6_addr *__inet6_rcv_saddr(const struct sock *sk)
340{ 373{
341 return likely(sk->sk_state != TCP_TIME_WAIT) ? 374 return likely(sk->sk_state != TCP_TIME_WAIT) ?
342 &inet6_sk(sk)->rcv_saddr : &tcp6_twsk(sk)->tw_v6_rcv_saddr; 375 &inet6_sk(sk)->rcv_saddr : &inet6_twsk(sk)->tw_v6_rcv_saddr;
343} 376}
344 377
345static inline struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk) 378static inline struct in6_addr *inet6_rcv_saddr(const struct sock *sk)
346{ 379{
347 return sk->sk_family == AF_INET6 ? __tcp_v6_rcv_saddr(sk) : NULL; 380 return sk->sk_family == AF_INET6 ? __inet6_rcv_saddr(sk) : NULL;
348} 381}
349 382
350static inline int inet_v6_ipv6only(const struct sock *sk) 383static inline int inet_v6_ipv6only(const struct sock *sk)
@@ -361,13 +394,19 @@ static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
361 return NULL; 394 return NULL;
362} 395}
363 396
397static inline struct inet6_request_sock *
398 inet6_rsk(const struct request_sock *rsk)
399{
400 return NULL;
401}
402
364static inline struct raw6_sock *raw6_sk(const struct sock *sk) 403static inline struct raw6_sock *raw6_sk(const struct sock *sk)
365{ 404{
366 return NULL; 405 return NULL;
367} 406}
368 407
369#define __tcp_v6_rcv_saddr(__sk) NULL 408#define __inet6_rcv_saddr(__sk) NULL
370#define tcp_v6_rcv_saddr(__sk) NULL 409#define inet6_rcv_saddr(__sk) NULL
371#define tcp_twsk_ipv6only(__sk) 0 410#define tcp_twsk_ipv6only(__sk) 0
372#define inet_v6_ipv6only(__sk) 0 411#define inet_v6_ipv6only(__sk) 0
373#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 412#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
diff --git a/include/linux/ipv6_route.h b/include/linux/ipv6_route.h
index e2f935038013..d7c41d1d706a 100644
--- a/include/linux/ipv6_route.h
+++ b/include/linux/ipv6_route.h
@@ -18,6 +18,7 @@
18 fallback, no routers on link */ 18 fallback, no routers on link */
19#define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */ 19#define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */
20#define RTF_PREFIX_RT 0x00080000 /* A prefix only route - RA */ 20#define RTF_PREFIX_RT 0x00080000 /* A prefix only route - RA */
21#define RTF_ANYCAST 0x00100000 /* Anycast */
21 22
22#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */ 23#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */
23#define RTF_EXPIRES 0x00400000 24#define RTF_EXPIRES 0x00400000
diff --git a/include/linux/irq.h b/include/linux/irq.h
index c516382fbec2..6c5d4c898ccb 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -10,9 +10,9 @@
10 */ 10 */
11 11
12#include <linux/config.h> 12#include <linux/config.h>
13#include <asm/smp.h> /* cpu_online_map */ 13#include <linux/smp.h>
14 14
15#if !defined(CONFIG_ARCH_S390) 15#if !defined(CONFIG_S390)
16 16
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18#include <linux/cache.h> 18#include <linux/cache.h>
@@ -221,6 +221,17 @@ extern void note_interrupt(unsigned int irq, irq_desc_t *desc,
221extern int can_request_irq(unsigned int irq, unsigned long irqflags); 221extern int can_request_irq(unsigned int irq, unsigned long irqflags);
222 222
223extern void init_irq_proc(void); 223extern void init_irq_proc(void);
224
225#ifdef CONFIG_AUTO_IRQ_AFFINITY
226extern int select_smp_affinity(unsigned int irq);
227#else
228static inline int
229select_smp_affinity(unsigned int irq)
230{
231 return 1;
232}
233#endif
234
224#endif 235#endif
225 236
226extern hw_irq_controller no_irq_type; /* needed in every arch ? */ 237extern hw_irq_controller no_irq_type; /* needed in every arch ? */
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index dcde7adfdce5..558cb4c26ec9 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -498,6 +498,12 @@ struct transaction_s
498 struct journal_head *t_checkpoint_list; 498 struct journal_head *t_checkpoint_list;
499 499
500 /* 500 /*
501 * Doubly-linked circular list of all buffers submitted for IO while
502 * checkpointing. [j_list_lock]
503 */
504 struct journal_head *t_checkpoint_io_list;
505
506 /*
501 * Doubly-linked circular list of temporary buffers currently undergoing 507 * Doubly-linked circular list of temporary buffers currently undergoing
502 * IO in the log [j_list_lock] 508 * IO in the log [j_list_lock]
503 */ 509 */
@@ -843,7 +849,7 @@ extern void journal_commit_transaction(journal_t *);
843 849
844/* Checkpoint list management */ 850/* Checkpoint list management */
845int __journal_clean_checkpoint_list(journal_t *journal); 851int __journal_clean_checkpoint_list(journal_t *journal);
846void __journal_remove_checkpoint(struct journal_head *); 852int __journal_remove_checkpoint(struct journal_head *);
847void __journal_insert_checkpoint(struct journal_head *, transaction_t *); 853void __journal_insert_checkpoint(struct journal_head *, transaction_t *);
848 854
849/* Buffer IO */ 855/* Buffer IO */
diff --git a/include/linux/key.h b/include/linux/key.h
index 53513a3be53b..4d189e51bc6c 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -193,14 +193,6 @@ struct key_type {
193 */ 193 */
194 int (*instantiate)(struct key *key, const void *data, size_t datalen); 194 int (*instantiate)(struct key *key, const void *data, size_t datalen);
195 195
196 /* duplicate a key of this type (optional)
197 * - the source key will be locked against change
198 * - the new description will be attached
199 * - the quota will have been adjusted automatically from
200 * source->quotalen
201 */
202 int (*duplicate)(struct key *key, const struct key *source);
203
204 /* update a key of this type (optional) 196 /* update a key of this type (optional)
205 * - this method should call key_payload_reserve() to recalculate the 197 * - this method should call key_payload_reserve() to recalculate the
206 * quota consumption 198 * quota consumption
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 7f7403aa4a41..2a8d8da70961 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -23,14 +23,27 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/rwsem.h> 24#include <linux/rwsem.h>
25#include <linux/kref.h> 25#include <linux/kref.h>
26#include <linux/kobject_uevent.h>
27#include <linux/kernel.h> 26#include <linux/kernel.h>
28#include <asm/atomic.h> 27#include <asm/atomic.h>
29 28
30#define KOBJ_NAME_LEN 20 29#define KOBJ_NAME_LEN 20
30#define UEVENT_HELPER_PATH_LEN 256
31 31
32/* counter to tag the hotplug event, read only except for the kobject core */ 32/* path to the userspace helper executed on an event */
33extern u64 hotplug_seqnum; 33extern char uevent_helper[];
34
35/* counter to tag the uevent, read only except for the kobject core */
36extern u64 uevent_seqnum;
37
38/* the actions here must match the proper string in lib/kobject_uevent.c */
39typedef int __bitwise kobject_action_t;
40enum kobject_action {
41 KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */
42 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */
43 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */
44 KOBJ_OFFLINE = (__force kobject_action_t) 0x04, /* device offline */
45 KOBJ_ONLINE = (__force kobject_action_t) 0x05, /* device online */
46};
34 47
35struct kobject { 48struct kobject {
36 const char * k_name; 49 const char * k_name;
@@ -87,15 +100,14 @@ struct kobj_type {
87 * of object; multiple ksets can belong to one subsystem. All 100 * of object; multiple ksets can belong to one subsystem. All
88 * ksets of a subsystem share the subsystem's lock. 101 * ksets of a subsystem share the subsystem's lock.
89 * 102 *
90 * Each kset can support hotplugging; if it does, it will be given 103 * Each kset can support specific event variables; it can
91 * the opportunity to filter out specific kobjects from being 104 * supress the event generation or add subsystem specific
92 * reported, as well as to add its own "data" elements to the 105 * variables carried with the event.
93 * environment being passed to the hotplug helper.
94 */ 106 */
95struct kset_hotplug_ops { 107struct kset_uevent_ops {
96 int (*filter)(struct kset *kset, struct kobject *kobj); 108 int (*filter)(struct kset *kset, struct kobject *kobj);
97 const char *(*name)(struct kset *kset, struct kobject *kobj); 109 const char *(*name)(struct kset *kset, struct kobject *kobj);
98 int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp, 110 int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp,
99 int num_envp, char *buffer, int buffer_size); 111 int num_envp, char *buffer, int buffer_size);
100}; 112};
101 113
@@ -105,7 +117,7 @@ struct kset {
105 struct list_head list; 117 struct list_head list;
106 spinlock_t list_lock; 118 spinlock_t list_lock;
107 struct kobject kobj; 119 struct kobject kobj;
108 struct kset_hotplug_ops * hotplug_ops; 120 struct kset_uevent_ops * uevent_ops;
109}; 121};
110 122
111 123
@@ -153,20 +165,20 @@ struct subsystem {
153 struct rw_semaphore rwsem; 165 struct rw_semaphore rwsem;
154}; 166};
155 167
156#define decl_subsys(_name,_type,_hotplug_ops) \ 168#define decl_subsys(_name,_type,_uevent_ops) \
157struct subsystem _name##_subsys = { \ 169struct subsystem _name##_subsys = { \
158 .kset = { \ 170 .kset = { \
159 .kobj = { .name = __stringify(_name) }, \ 171 .kobj = { .name = __stringify(_name) }, \
160 .ktype = _type, \ 172 .ktype = _type, \
161 .hotplug_ops =_hotplug_ops, \ 173 .uevent_ops =_uevent_ops, \
162 } \ 174 } \
163} 175}
164#define decl_subsys_name(_varname,_name,_type,_hotplug_ops) \ 176#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
165struct subsystem _varname##_subsys = { \ 177struct subsystem _varname##_subsys = { \
166 .kset = { \ 178 .kset = { \
167 .kobj = { .name = __stringify(_name) }, \ 179 .kobj = { .name = __stringify(_name) }, \
168 .ktype = _type, \ 180 .ktype = _type, \
169 .hotplug_ops =_hotplug_ops, \ 181 .uevent_ops =_uevent_ops, \
170 } \ 182 } \
171} 183}
172 184
@@ -241,15 +253,17 @@ struct subsys_attribute {
241extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); 253extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);
242extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *); 254extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *);
243 255
244#ifdef CONFIG_HOTPLUG 256#if defined(CONFIG_HOTPLUG) & defined(CONFIG_NET)
245void kobject_hotplug(struct kobject *kobj, enum kobject_action action); 257void kobject_uevent(struct kobject *kobj, enum kobject_action action);
246int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, 258
259int add_uevent_var(char **envp, int num_envp, int *cur_index,
247 char *buffer, int buffer_size, int *cur_len, 260 char *buffer, int buffer_size, int *cur_len,
248 const char *format, ...) 261 const char *format, ...)
249 __attribute__((format (printf, 7, 8))); 262 __attribute__((format (printf, 7, 8)));
250#else 263#else
251static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { } 264static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { }
252static inline int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, 265
266static inline int add_uevent_var(char **envp, int num_envp, int *cur_index,
253 char *buffer, int buffer_size, int *cur_len, 267 char *buffer, int buffer_size, int *cur_len,
254 const char *format, ...) 268 const char *format, ...)
255{ return 0; } 269{ return 0; }
diff --git a/include/linux/kobject_uevent.h b/include/linux/kobject_uevent.h
deleted file mode 100644
index aa664fe7e561..000000000000
--- a/include/linux/kobject_uevent.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * kobject_uevent.h - list of kobject user events that can be generated
3 *
4 * Copyright (C) 2004 IBM Corp.
5 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
6 *
7 * This file is released under the GPLv2.
8 *
9 */
10
11#ifndef _KOBJECT_EVENT_H_
12#define _KOBJECT_EVENT_H_
13
14#define HOTPLUG_PATH_LEN 256
15
16/* path to the hotplug userspace helper executed on an event */
17extern char hotplug_path[];
18
19/*
20 * If you add an action here, you must also add the proper string to the
21 * lib/kobject_uevent.c file.
22 */
23typedef int __bitwise kobject_action_t;
24enum kobject_action {
25 KOBJ_ADD = (__force kobject_action_t) 0x01, /* add event, for hotplug */
26 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* remove event, for hotplug */
27 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* a sysfs attribute file has changed */
28 KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices */
29 KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices */
30 KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* offline event for hotplug devices */
31 KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* online event for hotplug devices */
32};
33
34
35#ifdef CONFIG_KOBJECT_UEVENT
36int kobject_uevent(struct kobject *kobj,
37 enum kobject_action action,
38 struct attribute *attr);
39int kobject_uevent_atomic(struct kobject *kobj,
40 enum kobject_action action,
41 struct attribute *attr);
42#else
43static inline int kobject_uevent(struct kobject *kobj,
44 enum kobject_action action,
45 struct attribute *attr)
46{
47 return 0;
48}
49static inline int kobject_uevent_atomic(struct kobject *kobj,
50 enum kobject_action action,
51 struct attribute *attr)
52{
53 return 0;
54}
55#endif
56
57#endif
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index e373c4a9de53..c03f2dc933de 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -37,6 +37,7 @@
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/rcupdate.h> 38#include <linux/rcupdate.h>
39 39
40#ifdef CONFIG_KPROBES
40#include <asm/kprobes.h> 41#include <asm/kprobes.h>
41 42
42/* kprobe_status settings */ 43/* kprobe_status settings */
@@ -147,7 +148,6 @@ struct kretprobe_instance {
147 struct task_struct *task; 148 struct task_struct *task;
148}; 149};
149 150
150#ifdef CONFIG_KPROBES
151extern spinlock_t kretprobe_lock; 151extern spinlock_t kretprobe_lock;
152extern int arch_prepare_kprobe(struct kprobe *p); 152extern int arch_prepare_kprobe(struct kprobe *p);
153extern void arch_copy_kprobe(struct kprobe *p); 153extern void arch_copy_kprobe(struct kprobe *p);
@@ -158,6 +158,7 @@ extern int arch_init_kprobes(void);
158extern void show_registers(struct pt_regs *regs); 158extern void show_registers(struct pt_regs *regs);
159extern kprobe_opcode_t *get_insn_slot(void); 159extern kprobe_opcode_t *get_insn_slot(void);
160extern void free_insn_slot(kprobe_opcode_t *slot); 160extern void free_insn_slot(kprobe_opcode_t *slot);
161extern void kprobes_inc_nmissed_count(struct kprobe *p);
161 162
162/* Get the kprobe at this addr (if any) - called with preemption disabled */ 163/* Get the kprobe at this addr (if any) - called with preemption disabled */
163struct kprobe *get_kprobe(void *addr); 164struct kprobe *get_kprobe(void *addr);
@@ -195,6 +196,11 @@ void add_rp_inst(struct kretprobe_instance *ri);
195void kprobe_flush_task(struct task_struct *tk); 196void kprobe_flush_task(struct task_struct *tk);
196void recycle_rp_inst(struct kretprobe_instance *ri); 197void recycle_rp_inst(struct kretprobe_instance *ri);
197#else /* CONFIG_KPROBES */ 198#else /* CONFIG_KPROBES */
199
200#define __kprobes /**/
201struct jprobe;
202struct kretprobe;
203
198static inline struct kprobe *kprobe_running(void) 204static inline struct kprobe *kprobe_running(void)
199{ 205{
200 return NULL; 206 return NULL;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index f2dbb684ce9e..a43c95f8f968 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -122,6 +122,9 @@ enum {
122 ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once 122 ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once
123 * proper HSM is in place. */ 123 * proper HSM is in place. */
124 ATA_FLAG_DEBUGMSG = (1 << 10), 124 ATA_FLAG_DEBUGMSG = (1 << 10),
125 ATA_FLAG_NO_ATAPI = (1 << 11), /* No ATAPI support */
126
127 ATA_FLAG_SUSPENDED = (1 << 12), /* port is suspended */
125 128
126 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ 129 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */
127 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ 130 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
@@ -135,6 +138,8 @@ enum {
135 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* hueristic */ 138 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* hueristic */
136 ATA_TMOUT_CDB = 30 * HZ, 139 ATA_TMOUT_CDB = 30 * HZ,
137 ATA_TMOUT_CDB_QUICK = 5 * HZ, 140 ATA_TMOUT_CDB_QUICK = 5 * HZ,
141 ATA_TMOUT_INTERNAL = 30 * HZ,
142 ATA_TMOUT_INTERNAL_QUICK = 5 * HZ,
138 143
139 /* ATA bus states */ 144 /* ATA bus states */
140 BUS_UNKNOWN = 0, 145 BUS_UNKNOWN = 0,
@@ -194,7 +199,7 @@ struct ata_port;
194struct ata_queued_cmd; 199struct ata_queued_cmd;
195 200
196/* typedefs */ 201/* typedefs */
197typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, unsigned int err_mask); 202typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc);
198 203
199struct ata_ioports { 204struct ata_ioports {
200 unsigned long cmd_addr; 205 unsigned long cmd_addr;
@@ -279,9 +284,9 @@ struct ata_queued_cmd {
279 /* DO NOT iterate over __sg manually, use ata_for_each_sg() */ 284 /* DO NOT iterate over __sg manually, use ata_for_each_sg() */
280 struct scatterlist *__sg; 285 struct scatterlist *__sg;
281 286
282 ata_qc_cb_t complete_fn; 287 unsigned int err_mask;
283 288
284 struct completion *waiting; 289 ata_qc_cb_t complete_fn;
285 290
286 void *private_data; 291 void *private_data;
287}; 292};
@@ -330,8 +335,6 @@ struct ata_port {
330 335
331 u8 ctl; /* cache of ATA control register */ 336 u8 ctl; /* cache of ATA control register */
332 u8 last_ctl; /* Cache last written value */ 337 u8 last_ctl; /* Cache last written value */
333 unsigned int bus_state;
334 unsigned int port_state;
335 unsigned int pio_mask; 338 unsigned int pio_mask;
336 unsigned int mwdma_mask; 339 unsigned int mwdma_mask;
337 unsigned int udma_mask; 340 unsigned int udma_mask;
@@ -435,6 +438,8 @@ extern void ata_std_ports(struct ata_ioports *ioaddr);
435extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, 438extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
436 unsigned int n_ports); 439 unsigned int n_ports);
437extern void ata_pci_remove_one (struct pci_dev *pdev); 440extern void ata_pci_remove_one (struct pci_dev *pdev);
441extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state);
442extern int ata_pci_device_resume(struct pci_dev *pdev);
438#endif /* CONFIG_PCI */ 443#endif /* CONFIG_PCI */
439extern int ata_device_add(const struct ata_probe_ent *ent); 444extern int ata_device_add(const struct ata_probe_ent *ent);
440extern void ata_host_set_remove(struct ata_host_set *host_set); 445extern void ata_host_set_remove(struct ata_host_set *host_set);
@@ -444,6 +449,10 @@ extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmn
444extern int ata_scsi_error(struct Scsi_Host *host); 449extern int ata_scsi_error(struct Scsi_Host *host);
445extern int ata_scsi_release(struct Scsi_Host *host); 450extern int ata_scsi_release(struct Scsi_Host *host);
446extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 451extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
452extern int ata_scsi_device_resume(struct scsi_device *);
453extern int ata_scsi_device_suspend(struct scsi_device *);
454extern int ata_device_resume(struct ata_port *, struct ata_device *);
455extern int ata_device_suspend(struct ata_port *, struct ata_device *);
447extern int ata_ratelimit(void); 456extern int ata_ratelimit(void);
448 457
449/* 458/*
@@ -477,9 +486,10 @@ extern void ata_bmdma_start (struct ata_queued_cmd *qc);
477extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 486extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
478extern u8 ata_bmdma_status(struct ata_port *ap); 487extern u8 ata_bmdma_status(struct ata_port *ap);
479extern void ata_bmdma_irq_clear(struct ata_port *ap); 488extern void ata_bmdma_irq_clear(struct ata_port *ap);
480extern void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask); 489extern void ata_qc_complete(struct ata_queued_cmd *qc);
481extern void ata_eng_timeout(struct ata_port *ap); 490extern void ata_eng_timeout(struct ata_port *ap);
482extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd, 491extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev,
492 struct scsi_cmnd *cmd,
483 void (*done)(struct scsi_cmnd *)); 493 void (*done)(struct scsi_cmnd *));
484extern int ata_std_bios_param(struct scsi_device *sdev, 494extern int ata_std_bios_param(struct scsi_device *sdev,
485 struct block_device *bdev, 495 struct block_device *bdev,
@@ -669,6 +679,7 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
669 qc->cursect = qc->cursg = qc->cursg_ofs = 0; 679 qc->cursect = qc->cursg = qc->cursg_ofs = 0;
670 qc->nsect = 0; 680 qc->nsect = 0;
671 qc->nbytes = qc->curbytes = 0; 681 qc->nbytes = qc->curbytes = 0;
682 qc->err_mask = 0;
672 683
673 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno); 684 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno);
674} 685}
diff --git a/include/linux/list.h b/include/linux/list.h
index fbfca73355a3..8e3388284530 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -202,12 +202,15 @@ static inline void list_del_rcu(struct list_head *entry)
202 * 202 *
203 * The old entry will be replaced with the new entry atomically. 203 * The old entry will be replaced with the new entry atomically.
204 */ 204 */
205static inline void list_replace_rcu(struct list_head *old, struct list_head *new){ 205static inline void list_replace_rcu(struct list_head *old,
206 struct list_head *new)
207{
206 new->next = old->next; 208 new->next = old->next;
207 new->prev = old->prev; 209 new->prev = old->prev;
208 smp_wmb(); 210 smp_wmb();
209 new->next->prev = new; 211 new->next->prev = new;
210 new->prev->next = new; 212 new->prev->next = new;
213 old->prev = LIST_POISON2;
211} 214}
212 215
213/** 216/**
@@ -578,6 +581,27 @@ static inline void hlist_del_init(struct hlist_node *n)
578 } 581 }
579} 582}
580 583
584/*
585 * hlist_replace_rcu - replace old entry by new one
586 * @old : the element to be replaced
587 * @new : the new element to insert
588 *
589 * The old entry will be replaced with the new entry atomically.
590 */
591static inline void hlist_replace_rcu(struct hlist_node *old,
592 struct hlist_node *new)
593{
594 struct hlist_node *next = old->next;
595
596 new->next = next;
597 new->pprev = old->pprev;
598 smp_wmb();
599 if (next)
600 new->next->pprev = &new->next;
601 *new->pprev = new;
602 old->pprev = LIST_POISON2;
603}
604
581static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) 605static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
582{ 606{
583 struct hlist_node *first = h->first; 607 struct hlist_node *first = h->first;
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 16d4e5a08e1d..95c8fea293ba 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -172,7 +172,7 @@ extern struct nlm_host *nlm_find_client(void);
172/* 172/*
173 * Server-side lock handling 173 * Server-side lock handling
174 */ 174 */
175int nlmsvc_async_call(struct nlm_rqst *, u32, rpc_action); 175int nlmsvc_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *);
176u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 176u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
177 struct nlm_lock *, int, struct nlm_cookie *); 177 struct nlm_lock *, int, struct nlm_cookie *);
178u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 178u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 8b67cf837ca9..ed00b278cb93 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -110,14 +110,6 @@ static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
110#define mpol_set_vma_default(vma) ((vma)->vm_policy = NULL) 110#define mpol_set_vma_default(vma) ((vma)->vm_policy = NULL)
111 111
112/* 112/*
113 * Hugetlb policy. i386 hugetlb so far works with node numbers
114 * instead of zone lists, so give it special interfaces for now.
115 */
116extern int mpol_first_node(struct vm_area_struct *vma, unsigned long addr);
117extern int mpol_node_valid(int nid, struct vm_area_struct *vma,
118 unsigned long addr);
119
120/*
121 * Tree of shared policies for a shared memory region. 113 * Tree of shared policies for a shared memory region.
122 * Maintain the policies in a pseudo mm that contains vmas. The vmas 114 * Maintain the policies in a pseudo mm that contains vmas. The vmas
123 * carry the policy. As a special twist the pseudo mm is indexed in pages, not 115 * carry the policy. As a special twist the pseudo mm is indexed in pages, not
@@ -156,6 +148,16 @@ extern void numa_default_policy(void);
156extern void numa_policy_init(void); 148extern void numa_policy_init(void);
157extern void numa_policy_rebind(const nodemask_t *old, const nodemask_t *new); 149extern void numa_policy_rebind(const nodemask_t *old, const nodemask_t *new);
158extern struct mempolicy default_policy; 150extern struct mempolicy default_policy;
151extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
152 unsigned long addr);
153
154extern int policy_zone;
155
156static inline void check_highest_zone(int k)
157{
158 if (k > policy_zone)
159 policy_zone = k;
160}
159 161
160#else 162#else
161 163
@@ -182,17 +184,6 @@ static inline struct mempolicy *mpol_copy(struct mempolicy *old)
182 return NULL; 184 return NULL;
183} 185}
184 186
185static inline int mpol_first_node(struct vm_area_struct *vma, unsigned long a)
186{
187 return numa_node_id();
188}
189
190static inline int
191mpol_node_valid(int nid, struct vm_area_struct *vma, unsigned long a)
192{
193 return 1;
194}
195
196struct shared_policy {}; 187struct shared_policy {};
197 188
198static inline int mpol_set_shared_policy(struct shared_policy *info, 189static inline int mpol_set_shared_policy(struct shared_policy *info,
@@ -232,6 +223,15 @@ static inline void numa_policy_rebind(const nodemask_t *old,
232{ 223{
233} 224}
234 225
226static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
227 unsigned long addr)
228{
229 return NODE_DATA(0)->node_zonelists + gfp_zone(GFP_HIGHUSER);
230}
231
232static inline void check_highest_zone(int k)
233{
234}
235#endif /* CONFIG_NUMA */ 235#endif /* CONFIG_NUMA */
236#endif /* __KERNEL__ */ 236#endif /* __KERNEL__ */
237 237
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 29f02d8513f6..bc01fff3aa01 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -163,7 +163,7 @@ extern unsigned int kobjsize(const void *objp);
163#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ 163#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
164#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ 164#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */
165#define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ 165#define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */
166#define VM_INCOMPLETE 0x02000000 /* Strange partial PFN mapping marker */ 166#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */
167 167
168#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 168#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
169#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 169#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
@@ -634,14 +634,38 @@ struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
634int shmem_lock(struct file *file, int lock, struct user_struct *user); 634int shmem_lock(struct file *file, int lock, struct user_struct *user);
635#else 635#else
636#define shmem_nopage filemap_nopage 636#define shmem_nopage filemap_nopage
637#define shmem_lock(a, b, c) ({0;}) /* always in memory, no need to lock */ 637
638#define shmem_set_policy(a, b) (0) 638static inline int shmem_lock(struct file *file, int lock,
639#define shmem_get_policy(a, b) (NULL) 639 struct user_struct *user)
640{
641 return 0;
642}
643
644static inline int shmem_set_policy(struct vm_area_struct *vma,
645 struct mempolicy *new)
646{
647 return 0;
648}
649
650static inline struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
651 unsigned long addr)
652{
653 return NULL;
654}
640#endif 655#endif
641struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags); 656struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags);
657extern int shmem_mmap(struct file *file, struct vm_area_struct *vma);
642 658
643int shmem_zero_setup(struct vm_area_struct *); 659int shmem_zero_setup(struct vm_area_struct *);
644 660
661#ifndef CONFIG_MMU
662extern unsigned long shmem_get_unmapped_area(struct file *file,
663 unsigned long addr,
664 unsigned long len,
665 unsigned long pgoff,
666 unsigned long flags);
667#endif
668
645static inline int can_do_mlock(void) 669static inline int can_do_mlock(void)
646{ 670{
647 if (capable(CAP_IPC_LOCK)) 671 if (capable(CAP_IPC_LOCK))
@@ -690,14 +714,31 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
690} 714}
691 715
692extern int vmtruncate(struct inode * inode, loff_t offset); 716extern int vmtruncate(struct inode * inode, loff_t offset);
717extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end);
693extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot); 718extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot);
694extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot); 719extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot);
695extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
696 720
697static inline int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, int write_access) 721#ifdef CONFIG_MMU
722extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma,
723 unsigned long address, int write_access);
724
725static inline int handle_mm_fault(struct mm_struct *mm,
726 struct vm_area_struct *vma, unsigned long address,
727 int write_access)
698{ 728{
699 return __handle_mm_fault(mm, vma, address, write_access) & (~VM_FAULT_WRITE); 729 return __handle_mm_fault(mm, vma, address, write_access) &
730 (~VM_FAULT_WRITE);
700} 731}
732#else
733static inline int handle_mm_fault(struct mm_struct *mm,
734 struct vm_area_struct *vma, unsigned long address,
735 int write_access)
736{
737 /* should never happen if there's no MMU */
738 BUG();
739 return VM_FAULT_SIGBUS;
740}
741#endif
701 742
702extern int make_pages_present(unsigned long addr, unsigned long end); 743extern int make_pages_present(unsigned long addr, unsigned long end);
703extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 744extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
@@ -896,6 +937,8 @@ extern unsigned long do_brk(unsigned long, unsigned long);
896/* filemap.c */ 937/* filemap.c */
897extern unsigned long page_unuse(struct page *); 938extern unsigned long page_unuse(struct page *);
898extern void truncate_inode_pages(struct address_space *, loff_t); 939extern void truncate_inode_pages(struct address_space *, loff_t);
940extern void truncate_inode_pages_range(struct address_space *,
941 loff_t lstart, loff_t lend);
899 942
900/* generic vm_area_ops exported for stackable file systems */ 943/* generic vm_area_ops exported for stackable file systems */
901extern struct page *filemap_nopage(struct vm_area_struct *, unsigned long, int *); 944extern struct page *filemap_nopage(struct vm_area_struct *, unsigned long, int *);
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 9f22090df7dd..c34f4a2c62f8 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -46,7 +46,6 @@ struct zone_padding {
46 46
47struct per_cpu_pages { 47struct per_cpu_pages {
48 int count; /* number of pages in the list */ 48 int count; /* number of pages in the list */
49 int low; /* low watermark, refill needed */
50 int high; /* high watermark, emptying needed */ 49 int high; /* high watermark, emptying needed */
51 int batch; /* chunk size for buddy add/remove */ 50 int batch; /* chunk size for buddy add/remove */
52 struct list_head list; /* the list of pages */ 51 struct list_head list; /* the list of pages */
@@ -389,6 +388,11 @@ static inline struct zone *next_zone(struct zone *zone)
389#define for_each_zone(zone) \ 388#define for_each_zone(zone) \
390 for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone)) 389 for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone))
391 390
391static inline int populated_zone(struct zone *zone)
392{
393 return (!!zone->present_pages);
394}
395
392static inline int is_highmem_idx(int idx) 396static inline int is_highmem_idx(int idx)
393{ 397{
394 return (idx == ZONE_HIGHMEM); 398 return (idx == ZONE_HIGHMEM);
@@ -398,6 +402,7 @@ static inline int is_normal_idx(int idx)
398{ 402{
399 return (idx == ZONE_NORMAL); 403 return (idx == ZONE_NORMAL);
400} 404}
405
401/** 406/**
402 * is_highmem - helper function to quickly check if a struct zone is a 407 * is_highmem - helper function to quickly check if a struct zone is a
403 * highmem zone or not. This is an attempt to keep references 408 * highmem zone or not. This is an attempt to keep references
@@ -414,6 +419,16 @@ static inline int is_normal(struct zone *zone)
414 return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL; 419 return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL;
415} 420}
416 421
422static inline int is_dma32(struct zone *zone)
423{
424 return zone == zone->zone_pgdat->node_zones + ZONE_DMA32;
425}
426
427static inline int is_dma(struct zone *zone)
428{
429 return zone == zone->zone_pgdat->node_zones + ZONE_DMA;
430}
431
417/* These two functions are used to setup the per zone pages min values */ 432/* These two functions are used to setup the per zone pages min values */
418struct ctl_table; 433struct ctl_table;
419struct file; 434struct file;
@@ -435,7 +450,6 @@ extern struct pglist_data contig_page_data;
435#define NODE_DATA(nid) (&contig_page_data) 450#define NODE_DATA(nid) (&contig_page_data)
436#define NODE_MEM_MAP(nid) mem_map 451#define NODE_MEM_MAP(nid) mem_map
437#define MAX_NODES_SHIFT 1 452#define MAX_NODES_SHIFT 1
438#define pfn_to_nid(pfn) (0)
439 453
440#else /* CONFIG_NEED_MULTIPLE_NODES */ 454#else /* CONFIG_NEED_MULTIPLE_NODES */
441 455
@@ -470,6 +484,10 @@ extern struct pglist_data contig_page_data;
470#define early_pfn_to_nid(nid) (0UL) 484#define early_pfn_to_nid(nid) (0UL)
471#endif 485#endif
472 486
487#ifdef CONFIG_FLATMEM
488#define pfn_to_nid(pfn) (0)
489#endif
490
473#define pfn_to_section_nr(pfn) ((pfn) >> PFN_SECTION_SHIFT) 491#define pfn_to_section_nr(pfn) ((pfn) >> PFN_SECTION_SHIFT)
474#define section_nr_to_pfn(sec) ((sec) << PFN_SECTION_SHIFT) 492#define section_nr_to_pfn(sec) ((sec) << PFN_SECTION_SHIFT)
475 493
@@ -564,11 +582,6 @@ static inline int valid_section_nr(unsigned long nr)
564 return valid_section(__nr_to_section(nr)); 582 return valid_section(__nr_to_section(nr));
565} 583}
566 584
567/*
568 * Given a kernel address, find the home node of the underlying memory.
569 */
570#define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
571
572static inline struct mem_section *__pfn_to_section(unsigned long pfn) 585static inline struct mem_section *__pfn_to_section(unsigned long pfn)
573{ 586{
574 return __nr_to_section(pfn_to_section_nr(pfn)); 587 return __nr_to_section(pfn_to_section_nr(pfn));
@@ -598,13 +611,14 @@ static inline int pfn_valid(unsigned long pfn)
598 * this restriction. 611 * this restriction.
599 */ 612 */
600#ifdef CONFIG_NUMA 613#ifdef CONFIG_NUMA
601#define pfn_to_nid early_pfn_to_nid 614#define pfn_to_nid(pfn) \
602#endif
603
604#define pfn_to_pgdat(pfn) \
605({ \ 615({ \
606 NODE_DATA(pfn_to_nid(pfn)); \ 616 unsigned long __pfn_to_nid_pfn = (pfn); \
617 page_to_nid(pfn_to_page(__pfn_to_nid_pfn)); \
607}) 618})
619#else
620#define pfn_to_nid(pfn) (0)
621#endif
608 622
609#define early_pfn_valid(pfn) pfn_valid(pfn) 623#define early_pfn_valid(pfn) pfn_valid(pfn)
610void sparse_init(void); 624void sparse_init(void);
@@ -613,12 +627,6 @@ void sparse_init(void);
613#define sparse_index_init(_sec, _nid) do {} while (0) 627#define sparse_index_init(_sec, _nid) do {} while (0)
614#endif /* CONFIG_SPARSEMEM */ 628#endif /* CONFIG_SPARSEMEM */
615 629
616#ifdef CONFIG_NODES_SPAN_OTHER_NODES
617#define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid))
618#else
619#define early_pfn_in_nid(pfn, nid) (1)
620#endif
621
622#ifndef early_pfn_valid 630#ifndef early_pfn_valid
623#define early_pfn_valid(pfn) (1) 631#define early_pfn_valid(pfn) (1)
624#endif 632#endif
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 368ec8e45bd0..b5c98c43779e 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -10,7 +10,7 @@
10#ifdef MODULE 10#ifdef MODULE
11#define MODULE_PARAM_PREFIX /* empty */ 11#define MODULE_PARAM_PREFIX /* empty */
12#else 12#else
13#define MODULE_PARAM_PREFIX __stringify(KBUILD_MODNAME) "." 13#define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
14#endif 14#endif
15 15
16#ifdef MODULE 16#ifdef MODULE
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index f1fd4215686a..7419b5fab133 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -17,7 +17,6 @@
17#include <linux/mtd/bbm.h> 17#include <linux/mtd/bbm.h>
18 18
19#define MAX_BUFFERRAM 2 19#define MAX_BUFFERRAM 2
20#define MAX_ONENAND_PAGESIZE (2048 + 64)
21 20
22/* Scan and identify a OneNAND device */ 21/* Scan and identify a OneNAND device */
23extern int onenand_scan(struct mtd_info *mtd, int max_chips); 22extern int onenand_scan(struct mtd_info *mtd, int max_chips);
@@ -110,6 +109,7 @@ struct onenand_chip {
110 spinlock_t chip_lock; 109 spinlock_t chip_lock;
111 wait_queue_head_t wq; 110 wait_queue_head_t wq;
112 onenand_state_t state; 111 onenand_state_t state;
112 unsigned char *page_buf;
113 113
114 struct nand_oobinfo *autooob; 114 struct nand_oobinfo *autooob;
115 115
@@ -134,13 +134,12 @@ struct onenand_chip {
134 * Options bits 134 * Options bits
135 */ 135 */
136#define ONENAND_CONT_LOCK (0x0001) 136#define ONENAND_CONT_LOCK (0x0001)
137 137#define ONENAND_PAGEBUF_ALLOC (0x1000)
138 138
139/* 139/*
140 * OneNAND Flash Manufacturer ID Codes 140 * OneNAND Flash Manufacturer ID Codes
141 */ 141 */
142#define ONENAND_MFR_SAMSUNG 0xec 142#define ONENAND_MFR_SAMSUNG 0xec
143#define ONENAND_MFR_UNKNOWN 0x00
144 143
145/** 144/**
146 * struct nand_manufacturers - NAND Flash Manufacturer ID Structure 145 * struct nand_manufacturers - NAND Flash Manufacturer ID Structure
diff --git a/include/linux/n_r3964.h b/include/linux/n_r3964.h
index 2352bcd31a06..db4f3776978a 100644
--- a/include/linux/n_r3964.h
+++ b/include/linux/n_r3964.h
@@ -13,6 +13,10 @@
13 * L. Haag 13 * L. Haag
14 * 14 *
15 * $Log: r3964.h,v $ 15 * $Log: r3964.h,v $
16 * Revision 1.4 2005/12/21 19:54:24 Kurt Huwig <kurt huwig de>
17 * Fixed HZ usage on 2.6 kernels
18 * Removed unnecessary include
19 *
16 * Revision 1.3 2001/03/18 13:02:24 dwmw2 20 * Revision 1.3 2001/03/18 13:02:24 dwmw2
17 * Fix timer usage, use spinlocks properly. 21 * Fix timer usage, use spinlocks properly.
18 * 22 *
@@ -45,9 +49,11 @@
45#define __LINUX_N_R3964_H__ 49#define __LINUX_N_R3964_H__
46 50
47/* line disciplines for r3964 protocol */ 51/* line disciplines for r3964 protocol */
48#include <asm/termios.h>
49 52
50#ifdef __KERNEL__ 53#ifdef __KERNEL__
54
55#include <linux/param.h>
56
51/* 57/*
52 * Common ascii handshake characters: 58 * Common ascii handshake characters:
53 */ 59 */
@@ -58,14 +64,14 @@
58#define NAK 0x15 64#define NAK 0x15
59 65
60/* 66/*
61 * Timeouts (msecs/10 msecs per timer interrupt): 67 * Timeouts (from milliseconds to jiffies)
62 */ 68 */
63 69
64#define R3964_TO_QVZ 550/10 70#define R3964_TO_QVZ ((550)*HZ/1000)
65#define R3964_TO_ZVZ 220/10 71#define R3964_TO_ZVZ ((220)*HZ/1000)
66#define R3964_TO_NO_BUF 400/10 72#define R3964_TO_NO_BUF ((400)*HZ/1000)
67#define R3964_NO_TX_ROOM 100/10 73#define R3964_NO_TX_ROOM ((100)*HZ/1000)
68#define R3964_TO_RX_PANIC 4000/10 74#define R3964_TO_RX_PANIC ((4000)*HZ/1000)
69#define R3964_MAX_RETRIES 5 75#define R3964_MAX_RETRIES 5
70 76
71#endif 77#endif
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 090e210e98f0..f95d51fae733 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -37,18 +37,26 @@ enum {
37/* userspace doesn't need the nbd_device structure */ 37/* userspace doesn't need the nbd_device structure */
38#ifdef __KERNEL__ 38#ifdef __KERNEL__
39 39
40#include <linux/wait.h>
41
40/* values for flags field */ 42/* values for flags field */
41#define NBD_READ_ONLY 0x0001 43#define NBD_READ_ONLY 0x0001
42#define NBD_WRITE_NOCHK 0x0002 44#define NBD_WRITE_NOCHK 0x0002
43 45
46struct request;
47
44struct nbd_device { 48struct nbd_device {
45 int flags; 49 int flags;
46 int harderror; /* Code of hard error */ 50 int harderror; /* Code of hard error */
47 struct socket * sock; 51 struct socket * sock;
48 struct file * file; /* If == NULL, device is not ready, yet */ 52 struct file * file; /* If == NULL, device is not ready, yet */
49 int magic; 53 int magic;
54
50 spinlock_t queue_lock; 55 spinlock_t queue_lock;
51 struct list_head queue_head;/* Requests are added here... */ 56 struct list_head queue_head;/* Requests are added here... */
57 struct request *active_req;
58 wait_queue_head_t active_wq;
59
52 struct semaphore tx_lock; 60 struct semaphore tx_lock;
53 struct gendisk *disk; 61 struct gendisk *disk;
54 int blksize; 62 int blksize;
diff --git a/include/linux/net.h b/include/linux/net.h
index d6a41e6577f6..28195a2d8ff0 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -107,7 +107,7 @@ enum sock_type {
107struct socket { 107struct socket {
108 socket_state state; 108 socket_state state;
109 unsigned long flags; 109 unsigned long flags;
110 struct proto_ops *ops; 110 const struct proto_ops *ops;
111 struct fasync_struct *fasync_list; 111 struct fasync_struct *fasync_list;
112 struct file *file; 112 struct file *file;
113 struct sock *sk; 113 struct sock *sk;
@@ -260,7 +260,7 @@ SOCKCALL_WRAP(name, recvmsg, (struct kiocb *iocb, struct socket *sock, struct ms
260SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \ 260SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \
261 (file, sock, vma)) \ 261 (file, sock, vma)) \
262 \ 262 \
263static struct proto_ops name##_ops = { \ 263static const struct proto_ops name##_ops = { \
264 .family = fam, \ 264 .family = fam, \
265 .owner = THIS_MODULE, \ 265 .owner = THIS_MODULE, \
266 .release = __lock_##name##_release, \ 266 .release = __lock_##name##_release, \
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 936f8b76114e..7fda03d338d1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -684,6 +684,7 @@ extern int netif_rx(struct sk_buff *skb);
684extern int netif_rx_ni(struct sk_buff *skb); 684extern int netif_rx_ni(struct sk_buff *skb);
685#define HAVE_NETIF_RECEIVE_SKB 1 685#define HAVE_NETIF_RECEIVE_SKB 1
686extern int netif_receive_skb(struct sk_buff *skb); 686extern int netif_receive_skb(struct sk_buff *skb);
687extern int dev_valid_name(const char *name);
687extern int dev_ioctl(unsigned int cmd, void __user *); 688extern int dev_ioctl(unsigned int cmd, void __user *);
688extern int dev_ethtool(struct ifreq *); 689extern int dev_ethtool(struct ifreq *);
689extern unsigned dev_get_flags(const struct net_device *); 690extern unsigned dev_get_flags(const struct net_device *);
@@ -801,12 +802,16 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
801 return (1 << debug_value) - 1; 802 return (1 << debug_value) - 1;
802} 803}
803 804
804/* Schedule rx intr now? */ 805/* Test if receive needs to be scheduled */
806static inline int __netif_rx_schedule_prep(struct net_device *dev)
807{
808 return !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state);
809}
805 810
811/* Test if receive needs to be scheduled but only if up */
806static inline int netif_rx_schedule_prep(struct net_device *dev) 812static inline int netif_rx_schedule_prep(struct net_device *dev)
807{ 813{
808 return netif_running(dev) && 814 return netif_running(dev) && __netif_rx_schedule_prep(dev);
809 !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state);
810} 815}
811 816
812/* Add interface to tail of rx poll list. This assumes that _prep has 817/* Add interface to tail of rx poll list. This assumes that _prep has
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 116fcaced909..668ec946c8e2 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -64,6 +64,9 @@ enum ctattr_l4proto {
64 CTA_PROTO_ICMP_ID, 64 CTA_PROTO_ICMP_ID,
65 CTA_PROTO_ICMP_TYPE, 65 CTA_PROTO_ICMP_TYPE,
66 CTA_PROTO_ICMP_CODE, 66 CTA_PROTO_ICMP_CODE,
67 CTA_PROTO_ICMPV6_ID,
68 CTA_PROTO_ICMPV6_TYPE,
69 CTA_PROTO_ICMPV6_CODE,
67 __CTA_PROTO_MAX 70 __CTA_PROTO_MAX
68}; 71};
69#define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1) 72#define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1)
@@ -128,6 +131,4 @@ enum ctattr_help {
128}; 131};
129#define CTA_HELP_MAX (__CTA_HELP_MAX - 1) 132#define CTA_HELP_MAX (__CTA_HELP_MAX - 1)
130 133
131#define CTA_HELP_MAXNAMESIZE 32
132
133#endif /* _IPCONNTRACK_NETLINK_H */ 134#endif /* _IPCONNTRACK_NETLINK_H */
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 2efc046d9e94..c163ba31aab7 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -474,7 +474,11 @@ extern unsigned int ip6t_do_table(struct sk_buff **pskb,
474extern int ip6t_ext_hdr(u8 nexthdr); 474extern int ip6t_ext_hdr(u8 nexthdr);
475/* find specified header and get offset to it */ 475/* find specified header and get offset to it */
476extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 476extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
477 u8 target); 477 int target, unsigned short *fragoff);
478
479extern int ip6_masked_addrcmp(const struct in6_addr *addr1,
480 const struct in6_addr *mask,
481 const struct in6_addr *addr2);
478 482
479#define IP6T_ALIGN(s) (((s) + (__alignof__(struct ip6t_entry)-1)) & ~(__alignof__(struct ip6t_entry)-1)) 483#define IP6T_ALIGN(s) (((s) + (__alignof__(struct ip6t_entry)-1)) & ~(__alignof__(struct ip6t_entry)-1))
480 484
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 12787a9b0259..547d649b274e 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -38,9 +38,6 @@
38# define NFS_DEBUG 38# define NFS_DEBUG
39#endif 39#endif
40 40
41#define NFS_MAX_FILE_IO_BUFFER_SIZE 32768
42#define NFS_DEF_FILE_IO_BUFFER_SIZE 4096
43
44/* Default timeout values */ 41/* Default timeout values */
45#define NFS_MAX_UDP_TIMEOUT (60*HZ) 42#define NFS_MAX_UDP_TIMEOUT (60*HZ)
46#define NFS_MAX_TCP_TIMEOUT (600*HZ) 43#define NFS_MAX_TCP_TIMEOUT (600*HZ)
@@ -65,6 +62,7 @@
65#define FLUSH_STABLE 4 /* commit to stable storage */ 62#define FLUSH_STABLE 4 /* commit to stable storage */
66#define FLUSH_LOWPRI 8 /* low priority background flush */ 63#define FLUSH_LOWPRI 8 /* low priority background flush */
67#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 64#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
65#define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */
68 66
69#ifdef __KERNEL__ 67#ifdef __KERNEL__
70 68
@@ -291,6 +289,7 @@ static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long
291/* 289/*
292 * linux/fs/nfs/inode.c 290 * linux/fs/nfs/inode.c
293 */ 291 */
292extern int nfs_sync_mapping(struct address_space *mapping);
294extern void nfs_zap_caches(struct inode *); 293extern void nfs_zap_caches(struct inode *);
295extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, 294extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
296 struct nfs_fattr *); 295 struct nfs_fattr *);
@@ -393,6 +392,17 @@ extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_
393extern struct inode_operations nfs_symlink_inode_operations; 392extern struct inode_operations nfs_symlink_inode_operations;
394 393
395/* 394/*
395 * linux/fs/nfs/sysctl.c
396 */
397#ifdef CONFIG_SYSCTL
398extern int nfs_register_sysctl(void);
399extern void nfs_unregister_sysctl(void);
400#else
401#define nfs_register_sysctl() do { } while(0)
402#define nfs_unregister_sysctl() do { } while(0)
403#endif
404
405/*
396 * linux/fs/nfs/unlink.c 406 * linux/fs/nfs/unlink.c
397 */ 407 */
398extern int nfs_async_unlink(struct dentry *); 408extern int nfs_async_unlink(struct dentry *);
@@ -405,10 +415,12 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
405extern int nfs_writepages(struct address_space *, struct writeback_control *); 415extern int nfs_writepages(struct address_space *, struct writeback_control *);
406extern int nfs_flush_incompatible(struct file *file, struct page *page); 416extern int nfs_flush_incompatible(struct file *file, struct page *page);
407extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 417extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
408extern void nfs_writeback_done(struct rpc_task *task); 418extern void nfs_writeback_done(struct rpc_task *task, void *data);
419extern void nfs_writedata_release(void *data);
409 420
410#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 421#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
411extern void nfs_commit_done(struct rpc_task *); 422extern void nfs_commit_done(struct rpc_task *, void *data);
423extern void nfs_commit_release(void *data);
412#endif 424#endif
413 425
414/* 426/*
@@ -459,18 +471,33 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page)
459 */ 471 */
460extern mempool_t *nfs_wdata_mempool; 472extern mempool_t *nfs_wdata_mempool;
461 473
462static inline struct nfs_write_data *nfs_writedata_alloc(void) 474static inline struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount)
463{ 475{
464 struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS); 476 struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS);
477
465 if (p) { 478 if (p) {
466 memset(p, 0, sizeof(*p)); 479 memset(p, 0, sizeof(*p));
467 INIT_LIST_HEAD(&p->pages); 480 INIT_LIST_HEAD(&p->pages);
481 if (pagecount < NFS_PAGEVEC_SIZE)
482 p->pagevec = &p->page_array[0];
483 else {
484 size_t size = ++pagecount * sizeof(struct page *);
485 p->pagevec = kmalloc(size, GFP_NOFS);
486 if (p->pagevec) {
487 memset(p->pagevec, 0, size);
488 } else {
489 mempool_free(p, nfs_wdata_mempool);
490 p = NULL;
491 }
492 }
468 } 493 }
469 return p; 494 return p;
470} 495}
471 496
472static inline void nfs_writedata_free(struct nfs_write_data *p) 497static inline void nfs_writedata_free(struct nfs_write_data *p)
473{ 498{
499 if (p && (p->pagevec != &p->page_array[0]))
500 kfree(p->pagevec);
474 mempool_free(p, nfs_wdata_mempool); 501 mempool_free(p, nfs_wdata_mempool);
475} 502}
476 503
@@ -480,28 +507,45 @@ static inline void nfs_writedata_free(struct nfs_write_data *p)
480extern int nfs_readpage(struct file *, struct page *); 507extern int nfs_readpage(struct file *, struct page *);
481extern int nfs_readpages(struct file *, struct address_space *, 508extern int nfs_readpages(struct file *, struct address_space *,
482 struct list_head *, unsigned); 509 struct list_head *, unsigned);
483extern void nfs_readpage_result(struct rpc_task *); 510extern void nfs_readpage_result(struct rpc_task *, void *);
511extern void nfs_readdata_release(void *data);
512
484 513
485/* 514/*
486 * Allocate and free nfs_read_data structures 515 * Allocate and free nfs_read_data structures
487 */ 516 */
488extern mempool_t *nfs_rdata_mempool; 517extern mempool_t *nfs_rdata_mempool;
489 518
490static inline struct nfs_read_data *nfs_readdata_alloc(void) 519static inline struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount)
491{ 520{
492 struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS); 521 struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS);
493 if (p) 522
523 if (p) {
494 memset(p, 0, sizeof(*p)); 524 memset(p, 0, sizeof(*p));
525 INIT_LIST_HEAD(&p->pages);
526 if (pagecount < NFS_PAGEVEC_SIZE)
527 p->pagevec = &p->page_array[0];
528 else {
529 size_t size = ++pagecount * sizeof(struct page *);
530 p->pagevec = kmalloc(size, GFP_NOFS);
531 if (p->pagevec) {
532 memset(p->pagevec, 0, size);
533 } else {
534 mempool_free(p, nfs_rdata_mempool);
535 p = NULL;
536 }
537 }
538 }
495 return p; 539 return p;
496} 540}
497 541
498static inline void nfs_readdata_free(struct nfs_read_data *p) 542static inline void nfs_readdata_free(struct nfs_read_data *p)
499{ 543{
544 if (p && (p->pagevec != &p->page_array[0]))
545 kfree(p->pagevec);
500 mempool_free(p, nfs_rdata_mempool); 546 mempool_free(p, nfs_rdata_mempool);
501} 547}
502 548
503extern void nfs_readdata_release(struct rpc_task *task);
504
505/* 549/*
506 * linux/fs/nfs3proc.c 550 * linux/fs/nfs3proc.c
507 */ 551 */
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index a0f1f25e0ead..102e56094296 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -71,6 +71,8 @@ int nfs_map_name_to_uid(struct nfs4_client *, const char *, size_t, __u32 *);
71int nfs_map_group_to_gid(struct nfs4_client *, const char *, size_t, __u32 *); 71int nfs_map_group_to_gid(struct nfs4_client *, const char *, size_t, __u32 *);
72int nfs_map_uid_to_name(struct nfs4_client *, __u32, char *); 72int nfs_map_uid_to_name(struct nfs4_client *, __u32, char *);
73int nfs_map_gid_to_group(struct nfs4_client *, __u32, char *); 73int nfs_map_gid_to_group(struct nfs4_client *, __u32, char *);
74
75extern unsigned int nfs_idmap_cache_timeout;
74#endif /* __KERNEL__ */ 76#endif /* __KERNEL__ */
75 77
76#endif /* NFS_IDMAP_H */ 78#endif /* NFS_IDMAP_H */
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index da2e077b65e2..66e2ed658527 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -79,9 +79,7 @@ extern void nfs_clear_page_writeback(struct nfs_page *req);
79static inline int 79static inline int
80nfs_lock_request_dontget(struct nfs_page *req) 80nfs_lock_request_dontget(struct nfs_page *req)
81{ 81{
82 if (test_and_set_bit(PG_BUSY, &req->wb_flags)) 82 return !test_and_set_bit(PG_BUSY, &req->wb_flags);
83 return 0;
84 return 1;
85} 83}
86 84
87/* 85/*
@@ -125,9 +123,7 @@ nfs_list_remove_request(struct nfs_page *req)
125static inline int 123static inline int
126nfs_defer_commit(struct nfs_page *req) 124nfs_defer_commit(struct nfs_page *req)
127{ 125{
128 if (test_and_set_bit(PG_NEED_COMMIT, &req->wb_flags)) 126 return !test_and_set_bit(PG_NEED_COMMIT, &req->wb_flags);
129 return 0;
130 return 1;
131} 127}
132 128
133static inline void 129static inline void
@@ -141,9 +137,7 @@ nfs_clear_commit(struct nfs_page *req)
141static inline int 137static inline int
142nfs_defer_reschedule(struct nfs_page *req) 138nfs_defer_reschedule(struct nfs_page *req)
143{ 139{
144 if (test_and_set_bit(PG_NEED_RESCHED, &req->wb_flags)) 140 return !test_and_set_bit(PG_NEED_RESCHED, &req->wb_flags);
145 return 0;
146 return 1;
147} 141}
148 142
149static inline void 143static inline void
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 40718669b9c8..6d6f69ec5675 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -4,6 +4,16 @@
4#include <linux/sunrpc/xprt.h> 4#include <linux/sunrpc/xprt.h>
5#include <linux/nfsacl.h> 5#include <linux/nfsacl.h>
6 6
7/*
8 * To change the maximum rsize and wsize supported by the NFS client, adjust
9 * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can
10 * support a megabyte or more. The default is left at 4096 bytes, which is
11 * reasonable for NFS over UDP.
12 */
13#define NFS_MAX_FILE_IO_SIZE (1048576U)
14#define NFS_DEF_FILE_IO_SIZE (4096U)
15#define NFS_MIN_FILE_IO_SIZE (1024U)
16
7struct nfs4_fsid { 17struct nfs4_fsid {
8 __u64 major; 18 __u64 major;
9 __u64 minor; 19 __u64 minor;
@@ -137,7 +147,7 @@ struct nfs_openres {
137 */ 147 */
138struct nfs_open_confirmargs { 148struct nfs_open_confirmargs {
139 const struct nfs_fh * fh; 149 const struct nfs_fh * fh;
140 nfs4_stateid stateid; 150 nfs4_stateid * stateid;
141 struct nfs_seqid * seqid; 151 struct nfs_seqid * seqid;
142}; 152};
143 153
@@ -165,66 +175,62 @@ struct nfs_closeres {
165 * * Arguments to the lock,lockt, and locku call. 175 * * Arguments to the lock,lockt, and locku call.
166 * */ 176 * */
167struct nfs_lowner { 177struct nfs_lowner {
168 __u64 clientid; 178 __u64 clientid;
169 u32 id; 179 u32 id;
170}; 180};
171 181
172struct nfs_lock_opargs { 182struct nfs_lock_args {
183 struct nfs_fh * fh;
184 struct file_lock * fl;
173 struct nfs_seqid * lock_seqid; 185 struct nfs_seqid * lock_seqid;
174 nfs4_stateid * lock_stateid; 186 nfs4_stateid * lock_stateid;
175 struct nfs_seqid * open_seqid; 187 struct nfs_seqid * open_seqid;
176 nfs4_stateid * open_stateid; 188 nfs4_stateid * open_stateid;
177 struct nfs_lowner lock_owner; 189 struct nfs_lowner lock_owner;
178 __u32 reclaim; 190 unsigned char block : 1;
179 __u32 new_lock_owner; 191 unsigned char reclaim : 1;
192 unsigned char new_lock_owner : 1;
180}; 193};
181 194
182struct nfs_locku_opargs { 195struct nfs_lock_res {
196 nfs4_stateid stateid;
197};
198
199struct nfs_locku_args {
200 struct nfs_fh * fh;
201 struct file_lock * fl;
183 struct nfs_seqid * seqid; 202 struct nfs_seqid * seqid;
184 nfs4_stateid * stateid; 203 nfs4_stateid * stateid;
185}; 204};
186 205
187struct nfs_lockargs { 206struct nfs_locku_res {
188 struct nfs_fh * fh; 207 nfs4_stateid stateid;
189 __u32 type;
190 __u64 offset;
191 __u64 length;
192 union {
193 struct nfs_lock_opargs *lock; /* LOCK */
194 struct nfs_lowner *lockt; /* LOCKT */
195 struct nfs_locku_opargs *locku; /* LOCKU */
196 } u;
197}; 208};
198 209
199struct nfs_lock_denied { 210struct nfs_lockt_args {
200 __u64 offset; 211 struct nfs_fh * fh;
201 __u64 length; 212 struct file_lock * fl;
202 __u32 type; 213 struct nfs_lowner lock_owner;
203 struct nfs_lowner owner;
204}; 214};
205 215
206struct nfs_lockres { 216struct nfs_lockt_res {
207 union { 217 struct file_lock * denied; /* LOCK, LOCKT failed */
208 nfs4_stateid stateid;/* LOCK success, LOCKU */
209 struct nfs_lock_denied denied; /* LOCK failed, LOCKT success */
210 } u;
211 const struct nfs_server * server;
212}; 218};
213 219
214struct nfs4_delegreturnargs { 220struct nfs4_delegreturnargs {
215 const struct nfs_fh *fhandle; 221 const struct nfs_fh *fhandle;
216 const nfs4_stateid *stateid; 222 const nfs4_stateid *stateid;
223 const u32 * bitmask;
224};
225
226struct nfs4_delegreturnres {
227 struct nfs_fattr * fattr;
228 const struct nfs_server *server;
217}; 229};
218 230
219/* 231/*
220 * Arguments to the read call. 232 * Arguments to the read call.
221 */ 233 */
222
223#define NFS_READ_MAXIOV (9U)
224#if (NFS_READ_MAXIOV > (MAX_IOVEC -2))
225#error "NFS_READ_MAXIOV is too large"
226#endif
227
228struct nfs_readargs { 234struct nfs_readargs {
229 struct nfs_fh * fh; 235 struct nfs_fh * fh;
230 struct nfs_open_context *context; 236 struct nfs_open_context *context;
@@ -243,11 +249,6 @@ struct nfs_readres {
243/* 249/*
244 * Arguments to the write call. 250 * Arguments to the write call.
245 */ 251 */
246#define NFS_WRITE_MAXIOV (9U)
247#if (NFS_WRITE_MAXIOV > (MAX_IOVEC -2))
248#error "NFS_WRITE_MAXIOV is too large"
249#endif
250
251struct nfs_writeargs { 252struct nfs_writeargs {
252 struct nfs_fh * fh; 253 struct nfs_fh * fh;
253 struct nfs_open_context *context; 254 struct nfs_open_context *context;
@@ -678,6 +679,8 @@ struct nfs4_server_caps_res {
678 679
679struct nfs_page; 680struct nfs_page;
680 681
682#define NFS_PAGEVEC_SIZE (8U)
683
681struct nfs_read_data { 684struct nfs_read_data {
682 int flags; 685 int flags;
683 struct rpc_task task; 686 struct rpc_task task;
@@ -686,13 +689,14 @@ struct nfs_read_data {
686 struct nfs_fattr fattr; /* fattr storage */ 689 struct nfs_fattr fattr; /* fattr storage */
687 struct list_head pages; /* Coalesced read requests */ 690 struct list_head pages; /* Coalesced read requests */
688 struct nfs_page *req; /* multi ops per nfs_page */ 691 struct nfs_page *req; /* multi ops per nfs_page */
689 struct page *pagevec[NFS_READ_MAXIOV]; 692 struct page **pagevec;
690 struct nfs_readargs args; 693 struct nfs_readargs args;
691 struct nfs_readres res; 694 struct nfs_readres res;
692#ifdef CONFIG_NFS_V4 695#ifdef CONFIG_NFS_V4
693 unsigned long timestamp; /* For lease renewal */ 696 unsigned long timestamp; /* For lease renewal */
694#endif 697#endif
695 void (*complete) (struct nfs_read_data *, int); 698 void (*complete) (struct nfs_read_data *, int);
699 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
696}; 700};
697 701
698struct nfs_write_data { 702struct nfs_write_data {
@@ -704,13 +708,14 @@ struct nfs_write_data {
704 struct nfs_writeverf verf; 708 struct nfs_writeverf verf;
705 struct list_head pages; /* Coalesced requests we wish to flush */ 709 struct list_head pages; /* Coalesced requests we wish to flush */
706 struct nfs_page *req; /* multi ops per nfs_page */ 710 struct nfs_page *req; /* multi ops per nfs_page */
707 struct page *pagevec[NFS_WRITE_MAXIOV]; 711 struct page **pagevec;
708 struct nfs_writeargs args; /* argument struct */ 712 struct nfs_writeargs args; /* argument struct */
709 struct nfs_writeres res; /* result struct */ 713 struct nfs_writeres res; /* result struct */
710#ifdef CONFIG_NFS_V4 714#ifdef CONFIG_NFS_V4
711 unsigned long timestamp; /* For lease renewal */ 715 unsigned long timestamp; /* For lease renewal */
712#endif 716#endif
713 void (*complete) (struct nfs_write_data *, int); 717 void (*complete) (struct nfs_write_data *, int);
718 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
714}; 719};
715 720
716struct nfs_access_entry; 721struct nfs_access_entry;
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
index 130d4f588a37..3f4f7142bbe3 100644
--- a/include/linux/nfsd/xdr.h
+++ b/include/linux/nfsd/xdr.h
@@ -88,10 +88,12 @@ struct nfsd_readdirargs {
88 88
89struct nfsd_attrstat { 89struct nfsd_attrstat {
90 struct svc_fh fh; 90 struct svc_fh fh;
91 struct kstat stat;
91}; 92};
92 93
93struct nfsd_diropres { 94struct nfsd_diropres {
94 struct svc_fh fh; 95 struct svc_fh fh;
96 struct kstat stat;
95}; 97};
96 98
97struct nfsd_readlinkres { 99struct nfsd_readlinkres {
@@ -101,6 +103,7 @@ struct nfsd_readlinkres {
101struct nfsd_readres { 103struct nfsd_readres {
102 struct svc_fh fh; 104 struct svc_fh fh;
103 unsigned long count; 105 unsigned long count;
106 struct kstat stat;
104}; 107};
105 108
106struct nfsd_readdirres { 109struct nfsd_readdirres {
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
index 3c2a71b43bac..a4322741f8b9 100644
--- a/include/linux/nfsd/xdr3.h
+++ b/include/linux/nfsd/xdr3.h
@@ -126,6 +126,7 @@ struct nfsd3_setaclargs {
126struct nfsd3_attrstat { 126struct nfsd3_attrstat {
127 __u32 status; 127 __u32 status;
128 struct svc_fh fh; 128 struct svc_fh fh;
129 struct kstat stat;
129}; 130};
130 131
131/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */ 132/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 343083fec258..d52999c43336 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -79,13 +79,23 @@
79/* 79/*
80 * Global page accounting. One instance per CPU. Only unsigned longs are 80 * Global page accounting. One instance per CPU. Only unsigned longs are
81 * allowed. 81 * allowed.
82 *
83 * - Fields can be modified with xxx_page_state and xxx_page_state_zone at
84 * any time safely (which protects the instance from modification by
85 * interrupt.
86 * - The __xxx_page_state variants can be used safely when interrupts are
87 * disabled.
88 * - The __xxx_page_state variants can be used if the field is only
89 * modified from process context, or only modified from interrupt context.
90 * In this case, the field should be commented here.
82 */ 91 */
83struct page_state { 92struct page_state {
84 unsigned long nr_dirty; /* Dirty writeable pages */ 93 unsigned long nr_dirty; /* Dirty writeable pages */
85 unsigned long nr_writeback; /* Pages under writeback */ 94 unsigned long nr_writeback; /* Pages under writeback */
86 unsigned long nr_unstable; /* NFS unstable pages */ 95 unsigned long nr_unstable; /* NFS unstable pages */
87 unsigned long nr_page_table_pages;/* Pages used for pagetables */ 96 unsigned long nr_page_table_pages;/* Pages used for pagetables */
88 unsigned long nr_mapped; /* mapped into pagetables */ 97 unsigned long nr_mapped; /* mapped into pagetables.
98 * only modified from process context */
89 unsigned long nr_slab; /* In slab */ 99 unsigned long nr_slab; /* In slab */
90#define GET_PAGE_STATE_LAST nr_slab 100#define GET_PAGE_STATE_LAST nr_slab
91 101
@@ -97,32 +107,40 @@ struct page_state {
97 unsigned long pgpgout; /* Disk writes */ 107 unsigned long pgpgout; /* Disk writes */
98 unsigned long pswpin; /* swap reads */ 108 unsigned long pswpin; /* swap reads */
99 unsigned long pswpout; /* swap writes */ 109 unsigned long pswpout; /* swap writes */
100 unsigned long pgalloc_high; /* page allocations */
101 110
111 unsigned long pgalloc_high; /* page allocations */
102 unsigned long pgalloc_normal; 112 unsigned long pgalloc_normal;
113 unsigned long pgalloc_dma32;
103 unsigned long pgalloc_dma; 114 unsigned long pgalloc_dma;
115
104 unsigned long pgfree; /* page freeings */ 116 unsigned long pgfree; /* page freeings */
105 unsigned long pgactivate; /* pages moved inactive->active */ 117 unsigned long pgactivate; /* pages moved inactive->active */
106 unsigned long pgdeactivate; /* pages moved active->inactive */ 118 unsigned long pgdeactivate; /* pages moved active->inactive */
107 119
108 unsigned long pgfault; /* faults (major+minor) */ 120 unsigned long pgfault; /* faults (major+minor) */
109 unsigned long pgmajfault; /* faults (major only) */ 121 unsigned long pgmajfault; /* faults (major only) */
122
110 unsigned long pgrefill_high; /* inspected in refill_inactive_zone */ 123 unsigned long pgrefill_high; /* inspected in refill_inactive_zone */
111 unsigned long pgrefill_normal; 124 unsigned long pgrefill_normal;
125 unsigned long pgrefill_dma32;
112 unsigned long pgrefill_dma; 126 unsigned long pgrefill_dma;
113 127
114 unsigned long pgsteal_high; /* total highmem pages reclaimed */ 128 unsigned long pgsteal_high; /* total highmem pages reclaimed */
115 unsigned long pgsteal_normal; 129 unsigned long pgsteal_normal;
130 unsigned long pgsteal_dma32;
116 unsigned long pgsteal_dma; 131 unsigned long pgsteal_dma;
132
117 unsigned long pgscan_kswapd_high;/* total highmem pages scanned */ 133 unsigned long pgscan_kswapd_high;/* total highmem pages scanned */
118 unsigned long pgscan_kswapd_normal; 134 unsigned long pgscan_kswapd_normal;
119 135 unsigned long pgscan_kswapd_dma32;
120 unsigned long pgscan_kswapd_dma; 136 unsigned long pgscan_kswapd_dma;
137
121 unsigned long pgscan_direct_high;/* total highmem pages scanned */ 138 unsigned long pgscan_direct_high;/* total highmem pages scanned */
122 unsigned long pgscan_direct_normal; 139 unsigned long pgscan_direct_normal;
140 unsigned long pgscan_direct_dma32;
123 unsigned long pgscan_direct_dma; 141 unsigned long pgscan_direct_dma;
124 unsigned long pginodesteal; /* pages reclaimed via inode freeing */
125 142
143 unsigned long pginodesteal; /* pages reclaimed via inode freeing */
126 unsigned long slabs_scanned; /* slab objects scanned */ 144 unsigned long slabs_scanned; /* slab objects scanned */
127 unsigned long kswapd_steal; /* pages reclaimed by kswapd */ 145 unsigned long kswapd_steal; /* pages reclaimed by kswapd */
128 unsigned long kswapd_inodesteal;/* reclaimed via kswapd inode freeing */ 146 unsigned long kswapd_inodesteal;/* reclaimed via kswapd inode freeing */
@@ -136,31 +154,54 @@ struct page_state {
136extern void get_page_state(struct page_state *ret); 154extern void get_page_state(struct page_state *ret);
137extern void get_page_state_node(struct page_state *ret, int node); 155extern void get_page_state_node(struct page_state *ret, int node);
138extern void get_full_page_state(struct page_state *ret); 156extern void get_full_page_state(struct page_state *ret);
139extern unsigned long __read_page_state(unsigned long offset); 157extern unsigned long read_page_state_offset(unsigned long offset);
140extern void __mod_page_state(unsigned long offset, unsigned long delta); 158extern void mod_page_state_offset(unsigned long offset, unsigned long delta);
159extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
141 160
142#define read_page_state(member) \ 161#define read_page_state(member) \
143 __read_page_state(offsetof(struct page_state, member)) 162 read_page_state_offset(offsetof(struct page_state, member))
144 163
145#define mod_page_state(member, delta) \ 164#define mod_page_state(member, delta) \
146 __mod_page_state(offsetof(struct page_state, member), (delta)) 165 mod_page_state_offset(offsetof(struct page_state, member), (delta))
147 166
148#define inc_page_state(member) mod_page_state(member, 1UL) 167#define __mod_page_state(member, delta) \
149#define dec_page_state(member) mod_page_state(member, 0UL - 1) 168 __mod_page_state_offset(offsetof(struct page_state, member), (delta))
150#define add_page_state(member,delta) mod_page_state(member, (delta)) 169
151#define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta)) 170#define inc_page_state(member) mod_page_state(member, 1UL)
152 171#define dec_page_state(member) mod_page_state(member, 0UL - 1)
153#define mod_page_state_zone(zone, member, delta) \ 172#define add_page_state(member,delta) mod_page_state(member, (delta))
154 do { \ 173#define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta))
155 unsigned offset; \ 174
156 if (is_highmem(zone)) \ 175#define __inc_page_state(member) __mod_page_state(member, 1UL)
157 offset = offsetof(struct page_state, member##_high); \ 176#define __dec_page_state(member) __mod_page_state(member, 0UL - 1)
158 else if (is_normal(zone)) \ 177#define __add_page_state(member,delta) __mod_page_state(member, (delta))
159 offset = offsetof(struct page_state, member##_normal); \ 178#define __sub_page_state(member,delta) __mod_page_state(member, 0UL - (delta))
160 else \ 179
161 offset = offsetof(struct page_state, member##_dma); \ 180#define page_state(member) (*__page_state(offsetof(struct page_state, member)))
162 __mod_page_state(offset, (delta)); \ 181
163 } while (0) 182#define state_zone_offset(zone, member) \
183({ \
184 unsigned offset; \
185 if (is_highmem(zone)) \
186 offset = offsetof(struct page_state, member##_high); \
187 else if (is_normal(zone)) \
188 offset = offsetof(struct page_state, member##_normal); \
189 else if (is_dma32(zone)) \
190 offset = offsetof(struct page_state, member##_dma32); \
191 else \
192 offset = offsetof(struct page_state, member##_dma); \
193 offset; \
194})
195
196#define __mod_page_state_zone(zone, member, delta) \
197 do { \
198 __mod_page_state_offset(state_zone_offset(zone, member), (delta)); \
199 } while (0)
200
201#define mod_page_state_zone(zone, member, delta) \
202 do { \
203 mod_page_state_offset(state_zone_offset(zone, member), (delta)); \
204 } while (0)
164 205
165/* 206/*
166 * Manipulation of page state flags 207 * Manipulation of page state flags
diff --git a/include/linux/parport.h b/include/linux/parport.h
index d2a4d9e1e6d1..f7ff0b0c4031 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -242,7 +242,6 @@ enum ieee1284_phase {
242 IEEE1284_PH_FWD_IDLE, 242 IEEE1284_PH_FWD_IDLE,
243 IEEE1284_PH_TERMINATE, 243 IEEE1284_PH_TERMINATE,
244 IEEE1284_PH_NEGOTIATION, 244 IEEE1284_PH_NEGOTIATION,
245 IEEE1284_PH_HBUSY_DNA,
246 IEEE1284_PH_REV_IDLE, 245 IEEE1284_PH_REV_IDLE,
247 IEEE1284_PH_HBUSY_DAVAIL, 246 IEEE1284_PH_HBUSY_DAVAIL,
248 IEEE1284_PH_REV_DATA, 247 IEEE1284_PH_REV_DATA,
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h
index 7825c76cbd00..1cc0f6b1a49a 100644
--- a/include/linux/parport_pc.h
+++ b/include/linux/parport_pc.h
@@ -79,14 +79,14 @@ static __inline__ unsigned char parport_pc_read_data(struct parport *p)
79} 79}
80 80
81#ifdef DEBUG_PARPORT 81#ifdef DEBUG_PARPORT
82extern __inline__ void dump_parport_state (char *str, struct parport *p) 82static inline void dump_parport_state (char *str, struct parport *p)
83{ 83{
84 /* here's hoping that reading these ports won't side-effect anything underneath */ 84 /* here's hoping that reading these ports won't side-effect anything underneath */
85 unsigned char ecr = inb (ECONTROL (p)); 85 unsigned char ecr = inb (ECONTROL (p));
86 unsigned char dcr = inb (CONTROL (p)); 86 unsigned char dcr = inb (CONTROL (p));
87 unsigned char dsr = inb (STATUS (p)); 87 unsigned char dsr = inb (STATUS (p));
88 static char *ecr_modes[] = {"SPP", "PS2", "PPFIFO", "ECP", "xXx", "yYy", "TST", "CFG"}; 88 static const char *const ecr_modes[] = {"SPP", "PS2", "PPFIFO", "ECP", "xXx", "yYy", "TST", "CFG"};
89 const struct parport_pc_private *priv = (parport_pc_private *)p->physport->private_data; 89 const struct parport_pc_private *priv = p->physport->private_data;
90 int i; 90 int i;
91 91
92 printk (KERN_DEBUG "*** parport state (%s): ecr=[%s", str, ecr_modes[(ecr & 0xe0) >> 5]); 92 printk (KERN_DEBUG "*** parport state (%s): ecr=[%s", str, ecr_modes[(ecr & 0xe0) >> 5]);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 1e737e269db9..a213e999de31 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -15,6 +15,7 @@
15#define PCI_CLASS_STORAGE_FLOPPY 0x0102 15#define PCI_CLASS_STORAGE_FLOPPY 0x0102
16#define PCI_CLASS_STORAGE_IPI 0x0103 16#define PCI_CLASS_STORAGE_IPI 0x0103
17#define PCI_CLASS_STORAGE_RAID 0x0104 17#define PCI_CLASS_STORAGE_RAID 0x0104
18#define PCI_CLASS_STORAGE_SAS 0x0107
18#define PCI_CLASS_STORAGE_OTHER 0x0180 19#define PCI_CLASS_STORAGE_OTHER 0x0180
19 20
20#define PCI_BASE_CLASS_NETWORK 0x02 21#define PCI_BASE_CLASS_NETWORK 0x02
@@ -376,6 +377,10 @@
376#define PCI_DEVICE_ID_NS_87560_USB 0x0012 377#define PCI_DEVICE_ID_NS_87560_USB 0x0012
377#define PCI_DEVICE_ID_NS_83815 0x0020 378#define PCI_DEVICE_ID_NS_83815 0x0020
378#define PCI_DEVICE_ID_NS_83820 0x0022 379#define PCI_DEVICE_ID_NS_83820 0x0022
380#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
381#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e
382#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f
383#define PCI_DEVICE_ID_NS_CS5535_VIDEO 0x0030
379#define PCI_DEVICE_ID_NS_SATURN 0x0035 384#define PCI_DEVICE_ID_NS_SATURN 0x0035
380#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500 385#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500
381#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501 386#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501
@@ -389,6 +394,13 @@
389#define PCI_DEVICE_ID_NS_87410 0xd001 394#define PCI_DEVICE_ID_NS_87410 0xd001
390#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d 395#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
391 396
397#define PCI_DEVICE_ID_NS_CS5535_HOST_BRIDGE 0x0028
398#define PCI_DEVICE_ID_NS_CS5535_ISA_BRIDGE 0x002b
399#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
400#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e
401#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f
402#define PCI_DEVICE_ID_NS_CS5535_VIDEO 0x0030
403
392#define PCI_VENDOR_ID_TSENG 0x100c 404#define PCI_VENDOR_ID_TSENG 0x100c
393#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202 405#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202
394#define PCI_DEVICE_ID_TSENG_W32P_b 0x3205 406#define PCI_DEVICE_ID_TSENG_W32P_b 0x3205
@@ -491,6 +503,9 @@
491 503
492#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A 504#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
493 505
506#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081
507#define PCI_DEVICE_ID_AMD_LX_AES 0x2082
508
494#define PCI_VENDOR_ID_TRIDENT 0x1023 509#define PCI_VENDOR_ID_TRIDENT 0x1023
495#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 510#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
496#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001 511#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001
@@ -971,6 +986,7 @@
971#define PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN 0x002a 986#define PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN 0x002a
972#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C 987#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C
973#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D 988#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D
989#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034
974#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035 990#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035
975#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036 991#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036
976#define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037 992#define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037
@@ -1244,6 +1260,7 @@
1244#define PCI_DEVICE_ID_VIA_8378_0 0x3205 1260#define PCI_DEVICE_ID_VIA_8378_0 0x3205
1245#define PCI_DEVICE_ID_VIA_8783_0 0x3208 1261#define PCI_DEVICE_ID_VIA_8783_0 0x3208
1246#define PCI_DEVICE_ID_VIA_8237 0x3227 1262#define PCI_DEVICE_ID_VIA_8237 0x3227
1263#define PCI_DEVICE_ID_VIA_8251 0x3287
1247#define PCI_DEVICE_ID_VIA_3296_0 0x0296 1264#define PCI_DEVICE_ID_VIA_3296_0 0x0296
1248#define PCI_DEVICE_ID_VIA_8231 0x8231 1265#define PCI_DEVICE_ID_VIA_8231 0x8231
1249#define PCI_DEVICE_ID_VIA_8231_4 0x8235 1266#define PCI_DEVICE_ID_VIA_8231_4 0x8235
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index 724066778aff..6351c4055ace 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -216,6 +216,16 @@ struct sadb_x_nat_t_port {
216} __attribute__((packed)); 216} __attribute__((packed));
217/* sizeof(struct sadb_x_nat_t_port) == 8 */ 217/* sizeof(struct sadb_x_nat_t_port) == 8 */
218 218
219/* Generic LSM security context */
220struct sadb_x_sec_ctx {
221 uint16_t sadb_x_sec_len;
222 uint16_t sadb_x_sec_exttype;
223 uint8_t sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */
224 uint8_t sadb_x_ctx_doi;
225 uint16_t sadb_x_ctx_len;
226} __attribute__((packed));
227/* sizeof(struct sadb_sec_ctx) = 8 */
228
219/* Message types */ 229/* Message types */
220#define SADB_RESERVED 0 230#define SADB_RESERVED 0
221#define SADB_GETSPI 1 231#define SADB_GETSPI 1
@@ -325,7 +335,8 @@ struct sadb_x_nat_t_port {
325#define SADB_X_EXT_NAT_T_SPORT 21 335#define SADB_X_EXT_NAT_T_SPORT 21
326#define SADB_X_EXT_NAT_T_DPORT 22 336#define SADB_X_EXT_NAT_T_DPORT 22
327#define SADB_X_EXT_NAT_T_OA 23 337#define SADB_X_EXT_NAT_T_OA 23
328#define SADB_EXT_MAX 23 338#define SADB_X_EXT_SEC_CTX 24
339#define SADB_EXT_MAX 24
329 340
330/* Identity Extension values */ 341/* Identity Extension values */
331#define SADB_IDENTTYPE_RESERVED 0 342#define SADB_IDENTTYPE_RESERVED 0
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index e87b233615b3..d10f35338507 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -429,6 +429,7 @@ enum
429 TCA_NETEM_CORR, 429 TCA_NETEM_CORR,
430 TCA_NETEM_DELAY_DIST, 430 TCA_NETEM_DELAY_DIST,
431 TCA_NETEM_REORDER, 431 TCA_NETEM_REORDER,
432 TCA_NETEM_CORRUPT,
432 __TCA_NETEM_MAX, 433 __TCA_NETEM_MAX,
433}; 434};
434 435
@@ -457,6 +458,12 @@ struct tc_netem_reorder
457 __u32 correlation; 458 __u32 correlation;
458}; 459};
459 460
461struct tc_netem_corrupt
462{
463 __u32 probability;
464 __u32 correlation;
465};
466
460#define NETEM_DIST_SCALE 8192 467#define NETEM_DIST_SCALE 8192
461 468
462#endif 469#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 17e336f40b47..782090c68932 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -41,6 +41,7 @@ extern struct platform_device *platform_device_alloc(const char *name, unsigned
41extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); 41extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num);
42extern int platform_device_add_data(struct platform_device *pdev, void *data, size_t size); 42extern int platform_device_add_data(struct platform_device *pdev, void *data, size_t size);
43extern int platform_device_add(struct platform_device *pdev); 43extern int platform_device_add(struct platform_device *pdev);
44extern void platform_device_del(struct platform_device *pdev);
44extern void platform_device_put(struct platform_device *pdev); 45extern void platform_device_put(struct platform_device *pdev);
45 46
46struct platform_driver { 47struct platform_driver {
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 584d57cb393a..93b0959eb40f 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -162,6 +162,7 @@ struct pnp_card_link {
162 struct pnp_card * card; 162 struct pnp_card * card;
163 struct pnp_card_driver * driver; 163 struct pnp_card_driver * driver;
164 void * driver_data; 164 void * driver_data;
165 pm_message_t pm_state;
165}; 166};
166 167
167static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard) 168static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard)
@@ -294,6 +295,8 @@ struct pnp_driver {
294 unsigned int flags; 295 unsigned int flags;
295 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); 296 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
296 void (*remove) (struct pnp_dev *dev); 297 void (*remove) (struct pnp_dev *dev);
298 int (*suspend) (struct pnp_dev *dev, pm_message_t state);
299 int (*resume) (struct pnp_dev *dev);
297 struct device_driver driver; 300 struct device_driver driver;
298}; 301};
299 302
@@ -306,6 +309,8 @@ struct pnp_card_driver {
306 unsigned int flags; 309 unsigned int flags;
307 int (*probe) (struct pnp_card_link *card, const struct pnp_card_device_id *card_id); 310 int (*probe) (struct pnp_card_link *card, const struct pnp_card_device_id *card_id);
308 void (*remove) (struct pnp_card_link *card); 311 void (*remove) (struct pnp_card_link *card);
312 int (*suspend) (struct pnp_card_link *card, pm_message_t state);
313 int (*resume) (struct pnp_card_link *card);
309 struct pnp_driver link; 314 struct pnp_driver link;
310}; 315};
311 316
@@ -380,6 +385,8 @@ void pnp_init_resource_table(struct pnp_resource_table *table);
380int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode); 385int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode);
381int pnp_auto_config_dev(struct pnp_dev *dev); 386int pnp_auto_config_dev(struct pnp_dev *dev);
382int pnp_validate_config(struct pnp_dev *dev); 387int pnp_validate_config(struct pnp_dev *dev);
388int pnp_start_dev(struct pnp_dev *dev);
389int pnp_stop_dev(struct pnp_dev *dev);
383int pnp_activate_dev(struct pnp_dev *dev); 390int pnp_activate_dev(struct pnp_dev *dev);
384int pnp_disable_dev(struct pnp_dev *dev); 391int pnp_disable_dev(struct pnp_dev *dev);
385void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size); 392void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size);
@@ -423,6 +430,8 @@ static inline void pnp_init_resource_table(struct pnp_resource_table *table) { }
423static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; } 430static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; }
424static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } 431static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; }
425static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; } 432static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; }
433static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
434static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
426static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } 435static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
427static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } 436static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
428static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { } 437static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { }
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index d9a2f5254a51..5769d14d1e6a 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -48,6 +48,7 @@ do { \
48#define preempt_enable() \ 48#define preempt_enable() \
49do { \ 49do { \
50 preempt_enable_no_resched(); \ 50 preempt_enable_no_resched(); \
51 barrier(); \
51 preempt_check_resched(); \ 52 preempt_check_resched(); \
52} while (0) 53} while (0)
53 54
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index 13e7c4b62367..b6e0bcad84e1 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -71,8 +71,8 @@
71 */ 71 */
72#define MD_PATCHLEVEL_VERSION 3 72#define MD_PATCHLEVEL_VERSION 3
73 73
74extern int register_md_personality (int p_num, mdk_personality_t *p); 74extern int register_md_personality (struct mdk_personality *p);
75extern int unregister_md_personality (int p_num); 75extern int unregister_md_personality (struct mdk_personality *p);
76extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev), 76extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev),
77 mddev_t *mddev, const char *name); 77 mddev_t *mddev, const char *name);
78extern void md_unregister_thread (mdk_thread_t *thread); 78extern void md_unregister_thread (mdk_thread_t *thread);
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 46629a275ba9..617b9506c760 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -18,62 +18,19 @@
18/* and dm-bio-list.h is not under include/linux because.... ??? */ 18/* and dm-bio-list.h is not under include/linux because.... ??? */
19#include "../../../drivers/md/dm-bio-list.h" 19#include "../../../drivers/md/dm-bio-list.h"
20 20
21#define MD_RESERVED 0UL
22#define LINEAR 1UL
23#define RAID0 2UL
24#define RAID1 3UL
25#define RAID5 4UL
26#define TRANSLUCENT 5UL
27#define HSM 6UL
28#define MULTIPATH 7UL
29#define RAID6 8UL
30#define RAID10 9UL
31#define FAULTY 10UL
32#define MAX_PERSONALITY 11UL
33
34#define LEVEL_MULTIPATH (-4) 21#define LEVEL_MULTIPATH (-4)
35#define LEVEL_LINEAR (-1) 22#define LEVEL_LINEAR (-1)
36#define LEVEL_FAULTY (-5) 23#define LEVEL_FAULTY (-5)
37 24
25/* we need a value for 'no level specified' and 0
26 * means 'raid0', so we need something else. This is
27 * for internal use only
28 */
29#define LEVEL_NONE (-1000000)
30
38#define MaxSector (~(sector_t)0) 31#define MaxSector (~(sector_t)0)
39#define MD_THREAD_NAME_MAX 14 32#define MD_THREAD_NAME_MAX 14
40 33
41static inline int pers_to_level (int pers)
42{
43 switch (pers) {
44 case FAULTY: return LEVEL_FAULTY;
45 case MULTIPATH: return LEVEL_MULTIPATH;
46 case HSM: return -3;
47 case TRANSLUCENT: return -2;
48 case LINEAR: return LEVEL_LINEAR;
49 case RAID0: return 0;
50 case RAID1: return 1;
51 case RAID5: return 5;
52 case RAID6: return 6;
53 case RAID10: return 10;
54 }
55 BUG();
56 return MD_RESERVED;
57}
58
59static inline int level_to_pers (int level)
60{
61 switch (level) {
62 case LEVEL_FAULTY: return FAULTY;
63 case LEVEL_MULTIPATH: return MULTIPATH;
64 case -3: return HSM;
65 case -2: return TRANSLUCENT;
66 case LEVEL_LINEAR: return LINEAR;
67 case 0: return RAID0;
68 case 1: return RAID1;
69 case 4:
70 case 5: return RAID5;
71 case 6: return RAID6;
72 case 10: return RAID10;
73 }
74 return MD_RESERVED;
75}
76
77typedef struct mddev_s mddev_t; 34typedef struct mddev_s mddev_t;
78typedef struct mdk_rdev_s mdk_rdev_t; 35typedef struct mdk_rdev_s mdk_rdev_t;
79 36
@@ -138,14 +95,16 @@ struct mdk_rdev_s
138 atomic_t read_errors; /* number of consecutive read errors that 95 atomic_t read_errors; /* number of consecutive read errors that
139 * we have tried to ignore. 96 * we have tried to ignore.
140 */ 97 */
98 atomic_t corrected_errors; /* number of corrected read errors,
99 * for reporting to userspace and storing
100 * in superblock.
101 */
141}; 102};
142 103
143typedef struct mdk_personality_s mdk_personality_t;
144
145struct mddev_s 104struct mddev_s
146{ 105{
147 void *private; 106 void *private;
148 mdk_personality_t *pers; 107 struct mdk_personality *pers;
149 dev_t unit; 108 dev_t unit;
150 int md_minor; 109 int md_minor;
151 struct list_head disks; 110 struct list_head disks;
@@ -164,6 +123,7 @@ struct mddev_s
164 int chunk_size; 123 int chunk_size;
165 time_t ctime, utime; 124 time_t ctime, utime;
166 int level, layout; 125 int level, layout;
126 char clevel[16];
167 int raid_disks; 127 int raid_disks;
168 int max_disks; 128 int max_disks;
169 sector_t size; /* used size of component devices */ 129 sector_t size; /* used size of component devices */
@@ -183,6 +143,11 @@ struct mddev_s
183 sector_t resync_mismatches; /* count of sectors where 143 sector_t resync_mismatches; /* count of sectors where
184 * parity/replica mismatch found 144 * parity/replica mismatch found
185 */ 145 */
146 /* if zero, use the system-wide default */
147 int sync_speed_min;
148 int sync_speed_max;
149
150 int ok_start_degraded;
186 /* recovery/resync flags 151 /* recovery/resync flags
187 * NEEDED: we might need to start a resync/recover 152 * NEEDED: we might need to start a resync/recover
188 * RUNNING: a thread is running, or about to be started 153 * RUNNING: a thread is running, or about to be started
@@ -265,9 +230,11 @@ static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sect
265 atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io); 230 atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io);
266} 231}
267 232
268struct mdk_personality_s 233struct mdk_personality
269{ 234{
270 char *name; 235 char *name;
236 int level;
237 struct list_head list;
271 struct module *owner; 238 struct module *owner;
272 int (*make_request)(request_queue_t *q, struct bio *bio); 239 int (*make_request)(request_queue_t *q, struct bio *bio);
273 int (*run)(mddev_t *mddev); 240 int (*run)(mddev_t *mddev);
@@ -305,8 +272,6 @@ static inline char * mdname (mddev_t * mddev)
305 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; 272 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";
306} 273}
307 274
308extern mdk_rdev_t * find_rdev_nr(mddev_t *mddev, int nr);
309
310/* 275/*
311 * iterates through some rdev ringlist. It's safe to remove the 276 * iterates through some rdev ringlist. It's safe to remove the
312 * current 'rdev'. Dont touch 'tmp' though. 277 * current 'rdev'. Dont touch 'tmp' though.
@@ -366,5 +331,10 @@ do { \
366 __wait_event_lock_irq(wq, condition, lock, cmd); \ 331 __wait_event_lock_irq(wq, condition, lock, cmd); \
367} while (0) 332} while (0)
368 333
334static inline void safe_put_page(struct page *p)
335{
336 if (p) put_page(p);
337}
338
369#endif 339#endif
370 340
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index 292b98f2b408..9d5494aaac0f 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -45,6 +45,8 @@ struct r1_private_data_s {
45 45
46 spinlock_t resync_lock; 46 spinlock_t resync_lock;
47 int nr_pending; 47 int nr_pending;
48 int nr_waiting;
49 int nr_queued;
48 int barrier; 50 int barrier;
49 sector_t next_resync; 51 sector_t next_resync;
50 int fullsync; /* set to 1 if a full sync is needed, 52 int fullsync; /* set to 1 if a full sync is needed,
@@ -52,11 +54,12 @@ struct r1_private_data_s {
52 * Cleared when a sync completes. 54 * Cleared when a sync completes.
53 */ 55 */
54 56
55 wait_queue_head_t wait_idle; 57 wait_queue_head_t wait_barrier;
56 wait_queue_head_t wait_resume;
57 58
58 struct pool_info *poolinfo; 59 struct pool_info *poolinfo;
59 60
61 struct page *tmppage;
62
60 mempool_t *r1bio_pool; 63 mempool_t *r1bio_pool;
61 mempool_t *r1buf_pool; 64 mempool_t *r1buf_pool;
62}; 65};
@@ -106,6 +109,13 @@ struct r1bio_s {
106 /* DO NOT PUT ANY NEW FIELDS HERE - bios array is contiguously alloced*/ 109 /* DO NOT PUT ANY NEW FIELDS HERE - bios array is contiguously alloced*/
107}; 110};
108 111
112/* when we get a read error on a read-only array, we redirect to another
113 * device without failing the first device, or trying to over-write to
114 * correct the read error. To keep track of bad blocks on a per-bio
115 * level, we store IO_BLOCKED in the appropriate 'bios' pointer
116 */
117#define IO_BLOCKED ((struct bio*)1)
118
109/* bits for r1bio.state */ 119/* bits for r1bio.state */
110#define R1BIO_Uptodate 0 120#define R1BIO_Uptodate 0
111#define R1BIO_IsSync 1 121#define R1BIO_IsSync 1
diff --git a/include/linux/raid/raid10.h b/include/linux/raid/raid10.h
index 60708789c8f9..b1103298a8c2 100644
--- a/include/linux/raid/raid10.h
+++ b/include/linux/raid/raid10.h
@@ -35,18 +35,26 @@ struct r10_private_data_s {
35 sector_t chunk_mask; 35 sector_t chunk_mask;
36 36
37 struct list_head retry_list; 37 struct list_head retry_list;
38 /* for use when syncing mirrors: */ 38 /* queue pending writes and submit them on unplug */
39 struct bio_list pending_bio_list;
40
39 41
40 spinlock_t resync_lock; 42 spinlock_t resync_lock;
41 int nr_pending; 43 int nr_pending;
44 int nr_waiting;
45 int nr_queued;
42 int barrier; 46 int barrier;
43 sector_t next_resync; 47 sector_t next_resync;
48 int fullsync; /* set to 1 if a full sync is needed,
49 * (fresh device added).
50 * Cleared when a sync completes.
51 */
44 52
45 wait_queue_head_t wait_idle; 53 wait_queue_head_t wait_barrier;
46 wait_queue_head_t wait_resume;
47 54
48 mempool_t *r10bio_pool; 55 mempool_t *r10bio_pool;
49 mempool_t *r10buf_pool; 56 mempool_t *r10buf_pool;
57 struct page *tmppage;
50}; 58};
51 59
52typedef struct r10_private_data_s conf_t; 60typedef struct r10_private_data_s conf_t;
@@ -96,8 +104,16 @@ struct r10bio_s {
96 } devs[0]; 104 } devs[0];
97}; 105};
98 106
107/* when we get a read error on a read-only array, we redirect to another
108 * device without failing the first device, or trying to over-write to
109 * correct the read error. To keep track of bad blocks on a per-bio
110 * level, we store IO_BLOCKED in the appropriate 'bios' pointer
111 */
112#define IO_BLOCKED ((struct bio*)1)
113
99/* bits for r10bio.state */ 114/* bits for r10bio.state */
100#define R10BIO_Uptodate 0 115#define R10BIO_Uptodate 0
101#define R10BIO_IsSync 1 116#define R10BIO_IsSync 1
102#define R10BIO_IsRecover 2 117#define R10BIO_IsRecover 2
118#define R10BIO_Degraded 3
103#endif 119#endif
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index f025ba6fb14c..394da8207b34 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -126,7 +126,7 @@
126 */ 126 */
127 127
128struct stripe_head { 128struct stripe_head {
129 struct stripe_head *hash_next, **hash_pprev; /* hash pointers */ 129 struct hlist_node hash;
130 struct list_head lru; /* inactive_list or handle_list */ 130 struct list_head lru; /* inactive_list or handle_list */
131 struct raid5_private_data *raid_conf; 131 struct raid5_private_data *raid_conf;
132 sector_t sector; /* sector of this row */ 132 sector_t sector; /* sector of this row */
@@ -152,7 +152,6 @@ struct stripe_head {
152#define R5_Insync 3 /* rdev && rdev->in_sync at start */ 152#define R5_Insync 3 /* rdev && rdev->in_sync at start */
153#define R5_Wantread 4 /* want to schedule a read */ 153#define R5_Wantread 4 /* want to schedule a read */
154#define R5_Wantwrite 5 154#define R5_Wantwrite 5
155#define R5_Syncio 6 /* this io need to be accounted as resync io */
156#define R5_Overlap 7 /* There is a pending overlapping request on this block */ 155#define R5_Overlap 7 /* There is a pending overlapping request on this block */
157#define R5_ReadError 8 /* seen a read error here recently */ 156#define R5_ReadError 8 /* seen a read error here recently */
158#define R5_ReWrite 9 /* have tried to over-write the readerror */ 157#define R5_ReWrite 9 /* have tried to over-write the readerror */
@@ -205,7 +204,7 @@ struct disk_info {
205}; 204};
206 205
207struct raid5_private_data { 206struct raid5_private_data {
208 struct stripe_head **stripe_hashtbl; 207 struct hlist_head *stripe_hashtbl;
209 mddev_t *mddev; 208 mddev_t *mddev;
210 struct disk_info *spare; 209 struct disk_info *spare;
211 int chunk_size, level, algorithm; 210 int chunk_size, level, algorithm;
@@ -228,6 +227,8 @@ struct raid5_private_data {
228 * Cleared when a sync completes. 227 * Cleared when a sync completes.
229 */ 228 */
230 229
230 struct page *spare_page; /* Used when checking P/Q in raid6 */
231
231 /* 232 /*
232 * Free stripes pool 233 * Free stripes pool
233 */ 234 */
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index e0a4faa9610c..953b6df5d037 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -5,6 +5,16 @@ struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev);
5struct super_block *ramfs_get_sb(struct file_system_type *fs_type, 5struct super_block *ramfs_get_sb(struct file_system_type *fs_type,
6 int flags, const char *dev_name, void *data); 6 int flags, const char *dev_name, void *data);
7 7
8#ifndef CONFIG_MMU
9extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
10 unsigned long addr,
11 unsigned long len,
12 unsigned long pgoff,
13 unsigned long flags);
14
15extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
16#endif
17
8extern struct file_operations ramfs_file_operations; 18extern struct file_operations ramfs_file_operations;
9extern struct vm_operations_struct generic_file_vm_ops; 19extern struct vm_operations_struct generic_file_vm_ops;
10 20
diff --git a/include/linux/random.h b/include/linux/random.h
index 7b2adb3322d5..5d6456bcdeba 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -52,9 +52,9 @@ extern void get_random_bytes(void *buf, int nbytes);
52void generate_random_uuid(unsigned char uuid_out[16]); 52void generate_random_uuid(unsigned char uuid_out[16]);
53 53
54extern __u32 secure_ip_id(__u32 daddr); 54extern __u32 secure_ip_id(__u32 daddr);
55extern u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport); 55extern u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport);
56extern u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, 56extern u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr,
57 __u16 dport); 57 __u16 dport);
58extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, 58extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr,
59 __u16 sport, __u16 dport); 59 __u16 sport, __u16 dport);
60extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, 60extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr,
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index cce25591eec2..a471f3bb713e 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -100,6 +100,7 @@ struct rcu_data {
100 struct rcu_head *donelist; 100 struct rcu_head *donelist;
101 struct rcu_head **donetail; 101 struct rcu_head **donetail;
102 int cpu; 102 int cpu;
103 struct rcu_head barrier;
103}; 104};
104 105
105DECLARE_PER_CPU(struct rcu_data, rcu_data); 106DECLARE_PER_CPU(struct rcu_data, rcu_data);
@@ -285,6 +286,7 @@ extern void FASTCALL(call_rcu_bh(struct rcu_head *head,
285extern __deprecated_for_modules void synchronize_kernel(void); 286extern __deprecated_for_modules void synchronize_kernel(void);
286extern void synchronize_rcu(void); 287extern void synchronize_rcu(void);
287void synchronize_idle(void); 288void synchronize_idle(void);
289extern void rcu_barrier(void);
288 290
289#endif /* __KERNEL__ */ 291#endif /* __KERNEL__ */
290#endif /* __LINUX_RCUPDATE_H */ 292#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/relayfs_fs.h b/include/linux/relayfs_fs.h
index cfafc3e76bc2..fb7e80737325 100644
--- a/include/linux/relayfs_fs.h
+++ b/include/linux/relayfs_fs.h
@@ -20,9 +20,9 @@
20#include <linux/kref.h> 20#include <linux/kref.h>
21 21
22/* 22/*
23 * Tracks changes to rchan_buf struct 23 * Tracks changes to rchan/rchan_buf structs
24 */ 24 */
25#define RELAYFS_CHANNEL_VERSION 5 25#define RELAYFS_CHANNEL_VERSION 6
26 26
27/* 27/*
28 * Per-cpu relay channel buffer 28 * Per-cpu relay channel buffer
@@ -60,6 +60,7 @@ struct rchan
60 struct rchan_callbacks *cb; /* client callbacks */ 60 struct rchan_callbacks *cb; /* client callbacks */
61 struct kref kref; /* channel refcount */ 61 struct kref kref; /* channel refcount */
62 void *private_data; /* for user-defined data */ 62 void *private_data; /* for user-defined data */
63 size_t last_toobig; /* tried to log event > subbuf size */
63 struct rchan_buf *buf[NR_CPUS]; /* per-cpu channel buffers */ 64 struct rchan_buf *buf[NR_CPUS]; /* per-cpu channel buffers */
64}; 65};
65 66
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 33261f1d2239..9d6fbeef2104 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -71,6 +71,7 @@ void __anon_vma_link(struct vm_area_struct *);
71 * rmap interfaces called when adding or removing pte of page 71 * rmap interfaces called when adding or removing pte of page
72 */ 72 */
73void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 73void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
74void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
74void page_add_file_rmap(struct page *); 75void page_add_file_rmap(struct page *);
75void page_remove_rmap(struct page *); 76void page_remove_rmap(struct page *);
76 77
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index c231e9a08f0b..d50482ba27fe 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -866,6 +866,7 @@ enum rtnetlink_groups {
866#define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE 866#define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE
867 RTNLGRP_IPV4_ROUTE, 867 RTNLGRP_IPV4_ROUTE,
868#define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE 868#define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE
869 RTNLGRP_NOP1,
869 RTNLGRP_IPV6_IFADDR, 870 RTNLGRP_IPV6_IFADDR,
870#define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR 871#define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR
871 RTNLGRP_IPV6_MROUTE, 872 RTNLGRP_IPV6_MROUTE,
@@ -876,8 +877,11 @@ enum rtnetlink_groups {
876#define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO 877#define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO
877 RTNLGRP_DECnet_IFADDR, 878 RTNLGRP_DECnet_IFADDR,
878#define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR 879#define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR
880 RTNLGRP_NOP2,
879 RTNLGRP_DECnet_ROUTE, 881 RTNLGRP_DECnet_ROUTE,
880#define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE 882#define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE
883 RTNLGRP_NOP3,
884 RTNLGRP_NOP4,
881 RTNLGRP_IPV6_PREFIX, 885 RTNLGRP_IPV6_PREFIX,
882#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX 886#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX
883 __RTNLGRP_MAX 887 __RTNLGRP_MAX
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b0ad6f30679e..7da33619d5d0 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -254,25 +254,12 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
254 * The mm counters are not protected by its page_table_lock, 254 * The mm counters are not protected by its page_table_lock,
255 * so must be incremented atomically. 255 * so must be incremented atomically.
256 */ 256 */
257#ifdef ATOMIC64_INIT 257#define set_mm_counter(mm, member, value) atomic_long_set(&(mm)->_##member, value)
258#define set_mm_counter(mm, member, value) atomic64_set(&(mm)->_##member, value) 258#define get_mm_counter(mm, member) ((unsigned long)atomic_long_read(&(mm)->_##member))
259#define get_mm_counter(mm, member) ((unsigned long)atomic64_read(&(mm)->_##member)) 259#define add_mm_counter(mm, member, value) atomic_long_add(value, &(mm)->_##member)
260#define add_mm_counter(mm, member, value) atomic64_add(value, &(mm)->_##member) 260#define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member)
261#define inc_mm_counter(mm, member) atomic64_inc(&(mm)->_##member) 261#define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member)
262#define dec_mm_counter(mm, member) atomic64_dec(&(mm)->_##member) 262typedef atomic_long_t mm_counter_t;
263typedef atomic64_t mm_counter_t;
264#else /* !ATOMIC64_INIT */
265/*
266 * The counters wrap back to 0 at 2^32 * PAGE_SIZE,
267 * that is, at 16TB if using 4kB page size.
268 */
269#define set_mm_counter(mm, member, value) atomic_set(&(mm)->_##member, value)
270#define get_mm_counter(mm, member) ((unsigned long)atomic_read(&(mm)->_##member))
271#define add_mm_counter(mm, member, value) atomic_add(value, &(mm)->_##member)
272#define inc_mm_counter(mm, member) atomic_inc(&(mm)->_##member)
273#define dec_mm_counter(mm, member) atomic_dec(&(mm)->_##member)
274typedef atomic_t mm_counter_t;
275#endif /* !ATOMIC64_INIT */
276 263
277#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 264#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
278/* 265/*
diff --git a/include/linux/security.h b/include/linux/security.h
index f7e0ae018712..ef753654daa5 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -59,6 +59,12 @@ struct sk_buff;
59struct sock; 59struct sock;
60struct sockaddr; 60struct sockaddr;
61struct socket; 61struct socket;
62struct flowi;
63struct dst_entry;
64struct xfrm_selector;
65struct xfrm_policy;
66struct xfrm_state;
67struct xfrm_user_sec_ctx;
62 68
63extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 69extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
64extern int cap_netlink_recv(struct sk_buff *skb); 70extern int cap_netlink_recv(struct sk_buff *skb);
@@ -788,6 +794,52 @@ struct swap_info_struct;
788 * which is used to copy security attributes between local stream sockets. 794 * which is used to copy security attributes between local stream sockets.
789 * @sk_free_security: 795 * @sk_free_security:
790 * Deallocate security structure. 796 * Deallocate security structure.
797 * @sk_getsid:
798 * Retrieve the LSM-specific sid for the sock to enable caching of network
799 * authorizations.
800 *
801 * Security hooks for XFRM operations.
802 *
803 * @xfrm_policy_alloc_security:
804 * @xp contains the xfrm_policy being added to Security Policy Database
805 * used by the XFRM system.
806 * @sec_ctx contains the security context information being provided by
807 * the user-level policy update program (e.g., setkey).
808 * Allocate a security structure to the xp->selector.security field.
809 * The security field is initialized to NULL when the xfrm_policy is
810 * allocated.
811 * Return 0 if operation was successful (memory to allocate, legal context)
812 * @xfrm_policy_clone_security:
813 * @old contains an existing xfrm_policy in the SPD.
814 * @new contains a new xfrm_policy being cloned from old.
815 * Allocate a security structure to the new->selector.security field
816 * that contains the information from the old->selector.security field.
817 * Return 0 if operation was successful (memory to allocate).
818 * @xfrm_policy_free_security:
819 * @xp contains the xfrm_policy
820 * Deallocate xp->selector.security.
821 * @xfrm_state_alloc_security:
822 * @x contains the xfrm_state being added to the Security Association
823 * Database by the XFRM system.
824 * @sec_ctx contains the security context information being provided by
825 * the user-level SA generation program (e.g., setkey or racoon).
826 * Allocate a security structure to the x->sel.security field. The
827 * security field is initialized to NULL when the xfrm_state is
828 * allocated.
829 * Return 0 if operation was successful (memory to allocate, legal context).
830 * @xfrm_state_free_security:
831 * @x contains the xfrm_state.
832 * Deallocate x>sel.security.
833 * @xfrm_policy_lookup:
834 * @xp contains the xfrm_policy for which the access control is being
835 * checked.
836 * @sk_sid contains the sock security label that is used to authorize
837 * access to the policy xp.
838 * @dir contains the direction of the flow (input or output).
839 * Check permission when a sock selects a xfrm_policy for processing
840 * XFRMs on a packet. The hook is called when selecting either a
841 * per-socket policy or a generic xfrm policy.
842 * Return 0 if permission is granted.
791 * 843 *
792 * Security hooks affecting all Key Management operations 844 * Security hooks affecting all Key Management operations
793 * 845 *
@@ -1237,8 +1289,18 @@ struct security_operations {
1237 int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); 1289 int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
1238 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); 1290 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
1239 void (*sk_free_security) (struct sock *sk); 1291 void (*sk_free_security) (struct sock *sk);
1292 unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir);
1240#endif /* CONFIG_SECURITY_NETWORK */ 1293#endif /* CONFIG_SECURITY_NETWORK */
1241 1294
1295#ifdef CONFIG_SECURITY_NETWORK_XFRM
1296 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx);
1297 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
1298 void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
1299 int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
1300 void (*xfrm_state_free_security) (struct xfrm_state *x);
1301 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir);
1302#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1303
1242 /* key management security hooks */ 1304 /* key management security hooks */
1243#ifdef CONFIG_KEYS 1305#ifdef CONFIG_KEYS
1244 int (*key_alloc)(struct key *key); 1306 int (*key_alloc)(struct key *key);
@@ -2679,6 +2741,11 @@ static inline void security_sk_free(struct sock *sk)
2679{ 2741{
2680 return security_ops->sk_free_security(sk); 2742 return security_ops->sk_free_security(sk);
2681} 2743}
2744
2745static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir)
2746{
2747 return security_ops->sk_getsid(sk, fl, dir);
2748}
2682#else /* CONFIG_SECURITY_NETWORK */ 2749#else /* CONFIG_SECURITY_NETWORK */
2683static inline int security_unix_stream_connect(struct socket * sock, 2750static inline int security_unix_stream_connect(struct socket * sock,
2684 struct socket * other, 2751 struct socket * other,
@@ -2795,8 +2862,73 @@ static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
2795static inline void security_sk_free(struct sock *sk) 2862static inline void security_sk_free(struct sock *sk)
2796{ 2863{
2797} 2864}
2865
2866static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir)
2867{
2868 return 0;
2869}
2798#endif /* CONFIG_SECURITY_NETWORK */ 2870#endif /* CONFIG_SECURITY_NETWORK */
2799 2871
2872#ifdef CONFIG_SECURITY_NETWORK_XFRM
2873static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
2874{
2875 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx);
2876}
2877
2878static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
2879{
2880 return security_ops->xfrm_policy_clone_security(old, new);
2881}
2882
2883static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
2884{
2885 security_ops->xfrm_policy_free_security(xp);
2886}
2887
2888static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
2889{
2890 return security_ops->xfrm_state_alloc_security(x, sec_ctx);
2891}
2892
2893static inline void security_xfrm_state_free(struct xfrm_state *x)
2894{
2895 security_ops->xfrm_state_free_security(x);
2896}
2897
2898static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
2899{
2900 return security_ops->xfrm_policy_lookup(xp, sk_sid, dir);
2901}
2902#else /* CONFIG_SECURITY_NETWORK_XFRM */
2903static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
2904{
2905 return 0;
2906}
2907
2908static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
2909{
2910 return 0;
2911}
2912
2913static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
2914{
2915}
2916
2917static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
2918{
2919 return 0;
2920}
2921
2922static inline void security_xfrm_state_free(struct xfrm_state *x)
2923{
2924}
2925
2926static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
2927{
2928 return 0;
2929}
2930#endif /* CONFIG_SECURITY_NETWORK_XFRM */
2931
2800#ifdef CONFIG_KEYS 2932#ifdef CONFIG_KEYS
2801#ifdef CONFIG_SECURITY 2933#ifdef CONFIG_SECURITY
2802static inline int security_key_alloc(struct key *key) 2934static inline int security_key_alloc(struct key *key)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 8c5d6001a923..483cfc47ec34 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -32,7 +32,6 @@
32 32
33#define HAVE_ALLOC_SKB /* For the drivers to know */ 33#define HAVE_ALLOC_SKB /* For the drivers to know */
34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ 34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
35#define SLAB_SKB /* Slabified skbuffs */
36 35
37#define CHECKSUM_NONE 0 36#define CHECKSUM_NONE 0
38#define CHECKSUM_HW 1 37#define CHECKSUM_HW 1
@@ -134,7 +133,7 @@ struct skb_frag_struct {
134 */ 133 */
135struct skb_shared_info { 134struct skb_shared_info {
136 atomic_t dataref; 135 atomic_t dataref;
137 unsigned int nr_frags; 136 unsigned short nr_frags;
138 unsigned short tso_size; 137 unsigned short tso_size;
139 unsigned short tso_segs; 138 unsigned short tso_segs;
140 unsigned short ufo_size; 139 unsigned short ufo_size;
@@ -1239,6 +1238,8 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1239 int hlen, 1238 int hlen,
1240 struct iovec *iov); 1239 struct iovec *iov);
1241extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1240extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1241extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1242 unsigned int flags);
1242extern unsigned int skb_checksum(const struct sk_buff *skb, int offset, 1243extern unsigned int skb_checksum(const struct sk_buff *skb, int offset,
1243 int len, unsigned int csum); 1244 int len, unsigned int csum);
1244extern int skb_copy_bits(const struct sk_buff *skb, int offset, 1245extern int skb_copy_bits(const struct sk_buff *skb, int offset,
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 1739c2d5b95b..9f4019156fd8 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -27,7 +27,6 @@ struct __kernel_sockaddr_storage {
27#include <linux/compiler.h> /* __user */ 27#include <linux/compiler.h> /* __user */
28 28
29extern int sysctl_somaxconn; 29extern int sysctl_somaxconn;
30extern void sock_init(void);
31#ifdef CONFIG_PROC_FS 30#ifdef CONFIG_PROC_FS
32struct seq_file; 31struct seq_file;
33extern void socket_seq_show(struct seq_file *seq); 32extern void socket_seq_show(struct seq_file *seq);
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 0e9682c9def5..799be6747944 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -59,8 +59,7 @@
59/* 59/*
60 * Must define these before including other files, inline functions need them 60 * Must define these before including other files, inline functions need them
61 */ 61 */
62#define LOCK_SECTION_NAME \ 62#define LOCK_SECTION_NAME ".text.lock."KBUILD_BASENAME
63 ".text.lock." __stringify(KBUILD_BASENAME)
64 63
65#define LOCK_SECTION_START(extra) \ 64#define LOCK_SECTION_START(extra) \
66 ".subsection 1\n\t" \ 65 ".subsection 1\n\t" \
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index ab151bbb66df..f147e6b84332 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -49,7 +49,6 @@ struct rpc_clnt {
49 49
50 unsigned int cl_softrtry : 1,/* soft timeouts */ 50 unsigned int cl_softrtry : 1,/* soft timeouts */
51 cl_intr : 1,/* interruptible */ 51 cl_intr : 1,/* interruptible */
52 cl_chatty : 1,/* be verbose */
53 cl_autobind : 1,/* use getport() */ 52 cl_autobind : 1,/* use getport() */
54 cl_oneshot : 1,/* dispose after use */ 53 cl_oneshot : 1,/* dispose after use */
55 cl_dead : 1;/* abandoned */ 54 cl_dead : 1;/* abandoned */
@@ -126,7 +125,8 @@ int rpc_register(u32, u32, int, unsigned short, int *);
126void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 125void rpc_call_setup(struct rpc_task *, struct rpc_message *, int);
127 126
128int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, 127int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg,
129 int flags, rpc_action callback, void *clntdata); 128 int flags, const struct rpc_call_ops *tk_ops,
129 void *calldata);
130int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, 130int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg,
131 int flags); 131 int flags);
132void rpc_restart_call(struct rpc_task *); 132void rpc_restart_call(struct rpc_task *);
@@ -134,6 +134,7 @@ void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset);
134void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset); 134void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset);
135void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); 135void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
136size_t rpc_max_payload(struct rpc_clnt *); 136size_t rpc_max_payload(struct rpc_clnt *);
137void rpc_force_rebind(struct rpc_clnt *);
137int rpc_ping(struct rpc_clnt *clnt, int flags); 138int rpc_ping(struct rpc_clnt *clnt, int flags);
138 139
139static __inline__ 140static __inline__
diff --git a/include/linux/sunrpc/gss_spkm3.h b/include/linux/sunrpc/gss_spkm3.h
index 0beb2cf00a84..336e218c2782 100644
--- a/include/linux/sunrpc/gss_spkm3.h
+++ b/include/linux/sunrpc/gss_spkm3.h
@@ -48,7 +48,7 @@ u32 spkm3_read_token(struct spkm3_ctx *ctx, struct xdr_netobj *read_token, struc
48#define CKSUMTYPE_RSA_MD5 0x0007 48#define CKSUMTYPE_RSA_MD5 0x0007
49 49
50s32 make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, 50s32 make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body,
51 struct xdr_netobj *cksum); 51 int body_offset, struct xdr_netobj *cksum);
52void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits); 52void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits);
53int decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, 53int decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen,
54 int explen); 54 int explen);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 4d77e90d0b30..8b25629accd8 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -27,6 +27,7 @@ struct rpc_message {
27 struct rpc_cred * rpc_cred; /* Credentials */ 27 struct rpc_cred * rpc_cred; /* Credentials */
28}; 28};
29 29
30struct rpc_call_ops;
30struct rpc_wait_queue; 31struct rpc_wait_queue;
31struct rpc_wait { 32struct rpc_wait {
32 struct list_head list; /* wait queue links */ 33 struct list_head list; /* wait queue links */
@@ -41,6 +42,7 @@ struct rpc_task {
41#ifdef RPC_DEBUG 42#ifdef RPC_DEBUG
42 unsigned long tk_magic; /* 0xf00baa */ 43 unsigned long tk_magic; /* 0xf00baa */
43#endif 44#endif
45 atomic_t tk_count; /* Reference count */
44 struct list_head tk_task; /* global list of tasks */ 46 struct list_head tk_task; /* global list of tasks */
45 struct rpc_clnt * tk_client; /* RPC client */ 47 struct rpc_clnt * tk_client; /* RPC client */
46 struct rpc_rqst * tk_rqstp; /* RPC request */ 48 struct rpc_rqst * tk_rqstp; /* RPC request */
@@ -50,8 +52,6 @@ struct rpc_task {
50 * RPC call state 52 * RPC call state
51 */ 53 */
52 struct rpc_message tk_msg; /* RPC call info */ 54 struct rpc_message tk_msg; /* RPC call info */
53 __u32 * tk_buffer; /* XDR buffer */
54 size_t tk_bufsize;
55 __u8 tk_garb_retry; 55 __u8 tk_garb_retry;
56 __u8 tk_cred_retry; 56 __u8 tk_cred_retry;
57 57
@@ -61,13 +61,12 @@ struct rpc_task {
61 * timeout_fn to be executed by timer bottom half 61 * timeout_fn to be executed by timer bottom half
62 * callback to be executed after waking up 62 * callback to be executed after waking up
63 * action next procedure for async tasks 63 * action next procedure for async tasks
64 * exit exit async task and report to caller 64 * tk_ops caller callbacks
65 */ 65 */
66 void (*tk_timeout_fn)(struct rpc_task *); 66 void (*tk_timeout_fn)(struct rpc_task *);
67 void (*tk_callback)(struct rpc_task *); 67 void (*tk_callback)(struct rpc_task *);
68 void (*tk_action)(struct rpc_task *); 68 void (*tk_action)(struct rpc_task *);
69 void (*tk_exit)(struct rpc_task *); 69 const struct rpc_call_ops *tk_ops;
70 void (*tk_release)(struct rpc_task *);
71 void * tk_calldata; 70 void * tk_calldata;
72 71
73 /* 72 /*
@@ -78,7 +77,6 @@ struct rpc_task {
78 struct timer_list tk_timer; /* kernel timer */ 77 struct timer_list tk_timer; /* kernel timer */
79 unsigned long tk_timeout; /* timeout for rpc_sleep() */ 78 unsigned long tk_timeout; /* timeout for rpc_sleep() */
80 unsigned short tk_flags; /* misc flags */ 79 unsigned short tk_flags; /* misc flags */
81 unsigned char tk_active : 1;/* Task has been activated */
82 unsigned char tk_priority : 2;/* Task priority */ 80 unsigned char tk_priority : 2;/* Task priority */
83 unsigned long tk_runstate; /* Task run status */ 81 unsigned long tk_runstate; /* Task run status */
84 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could 82 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could
@@ -111,6 +109,13 @@ struct rpc_task {
111 109
112typedef void (*rpc_action)(struct rpc_task *); 110typedef void (*rpc_action)(struct rpc_task *);
113 111
112struct rpc_call_ops {
113 void (*rpc_call_prepare)(struct rpc_task *, void *);
114 void (*rpc_call_done)(struct rpc_task *, void *);
115 void (*rpc_release)(void *);
116};
117
118
114/* 119/*
115 * RPC task flags 120 * RPC task flags
116 */ 121 */
@@ -129,7 +134,6 @@ typedef void (*rpc_action)(struct rpc_task *);
129#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 134#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
130#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) 135#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS)
131#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) 136#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED)
132#define RPC_IS_ACTIVATED(t) ((t)->tk_active)
133#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL) 137#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL)
134#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) 138#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT)
135#define RPC_TASK_UNINTERRUPTIBLE(t) ((t)->tk_flags & RPC_TASK_NOINTR) 139#define RPC_TASK_UNINTERRUPTIBLE(t) ((t)->tk_flags & RPC_TASK_NOINTR)
@@ -138,6 +142,7 @@ typedef void (*rpc_action)(struct rpc_task *);
138#define RPC_TASK_QUEUED 1 142#define RPC_TASK_QUEUED 1
139#define RPC_TASK_WAKEUP 2 143#define RPC_TASK_WAKEUP 2
140#define RPC_TASK_HAS_TIMER 3 144#define RPC_TASK_HAS_TIMER 3
145#define RPC_TASK_ACTIVE 4
141 146
142#define RPC_IS_RUNNING(t) (test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)) 147#define RPC_IS_RUNNING(t) (test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate))
143#define rpc_set_running(t) (set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)) 148#define rpc_set_running(t) (set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate))
@@ -168,6 +173,15 @@ typedef void (*rpc_action)(struct rpc_task *);
168 smp_mb__after_clear_bit(); \ 173 smp_mb__after_clear_bit(); \
169 } while (0) 174 } while (0)
170 175
176#define RPC_IS_ACTIVATED(t) (test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate))
177#define rpc_set_active(t) (set_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate))
178#define rpc_clear_active(t) \
179 do { \
180 smp_mb__before_clear_bit(); \
181 clear_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate); \
182 smp_mb__after_clear_bit(); \
183 } while(0)
184
171/* 185/*
172 * Task priorities. 186 * Task priorities.
173 * Note: if you change these, you must also change 187 * Note: if you change these, you must also change
@@ -228,11 +242,16 @@ struct rpc_wait_queue {
228/* 242/*
229 * Function prototypes 243 * Function prototypes
230 */ 244 */
231struct rpc_task *rpc_new_task(struct rpc_clnt *, rpc_action, int flags); 245struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags,
246 const struct rpc_call_ops *ops, void *data);
247struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
248 const struct rpc_call_ops *ops, void *data);
232struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent); 249struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent);
233void rpc_init_task(struct rpc_task *, struct rpc_clnt *, 250void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
234 rpc_action exitfunc, int flags); 251 int flags, const struct rpc_call_ops *ops,
252 void *data);
235void rpc_release_task(struct rpc_task *); 253void rpc_release_task(struct rpc_task *);
254void rpc_exit_task(struct rpc_task *);
236void rpc_killall_tasks(struct rpc_clnt *); 255void rpc_killall_tasks(struct rpc_clnt *);
237int rpc_execute(struct rpc_task *); 256int rpc_execute(struct rpc_task *);
238void rpc_run_child(struct rpc_task *parent, struct rpc_task *child, 257void rpc_run_child(struct rpc_task *parent, struct rpc_task *child,
@@ -247,9 +266,11 @@ struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
247void rpc_wake_up_status(struct rpc_wait_queue *, int); 266void rpc_wake_up_status(struct rpc_wait_queue *, int);
248void rpc_delay(struct rpc_task *, unsigned long); 267void rpc_delay(struct rpc_task *, unsigned long);
249void * rpc_malloc(struct rpc_task *, size_t); 268void * rpc_malloc(struct rpc_task *, size_t);
269void rpc_free(struct rpc_task *);
250int rpciod_up(void); 270int rpciod_up(void);
251void rpciod_down(void); 271void rpciod_down(void);
252void rpciod_wake_up(void); 272void rpciod_wake_up(void);
273int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *));
253#ifdef RPC_DEBUG 274#ifdef RPC_DEBUG
254void rpc_show_tasks(void); 275void rpc_show_tasks(void);
255#endif 276#endif
@@ -259,7 +280,12 @@ void rpc_destroy_mempool(void);
259static inline void rpc_exit(struct rpc_task *task, int status) 280static inline void rpc_exit(struct rpc_task *task, int status)
260{ 281{
261 task->tk_status = status; 282 task->tk_status = status;
262 task->tk_action = NULL; 283 task->tk_action = rpc_exit_task;
284}
285
286static inline int rpc_wait_for_completion_task(struct rpc_task *task)
287{
288 return __rpc_wait_for_completion_task(task, NULL);
263} 289}
264 290
265#ifdef RPC_DEBUG 291#ifdef RPC_DEBUG
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 5da968729cf8..84c35d42d250 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -91,7 +91,6 @@ struct xdr_buf {
91u32 * xdr_encode_opaque_fixed(u32 *p, const void *ptr, unsigned int len); 91u32 * xdr_encode_opaque_fixed(u32 *p, const void *ptr, unsigned int len);
92u32 * xdr_encode_opaque(u32 *p, const void *ptr, unsigned int len); 92u32 * xdr_encode_opaque(u32 *p, const void *ptr, unsigned int len);
93u32 * xdr_encode_string(u32 *p, const char *s); 93u32 * xdr_encode_string(u32 *p, const char *s);
94u32 * xdr_decode_string(u32 *p, char **sp, int *lenp, int maxlen);
95u32 * xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen); 94u32 * xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen);
96u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *); 95u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *);
97u32 * xdr_decode_netobj(u32 *p, struct xdr_netobj *); 96u32 * xdr_decode_netobj(u32 *p, struct xdr_netobj *);
@@ -135,11 +134,6 @@ xdr_adjust_iovec(struct kvec *iov, u32 *p)
135} 134}
136 135
137/* 136/*
138 * Maximum number of iov's we use.
139 */
140#define MAX_IOVEC (12)
141
142/*
143 * XDR buffer helper functions 137 * XDR buffer helper functions
144 */ 138 */
145extern void xdr_shift_buf(struct xdr_buf *, size_t); 139extern void xdr_shift_buf(struct xdr_buf *, size_t);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 3b8b6e823c70..6ef99b14ff09 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -79,21 +79,19 @@ struct rpc_rqst {
79 void (*rq_release_snd_buf)(struct rpc_rqst *); /* release rq_enc_pages */ 79 void (*rq_release_snd_buf)(struct rpc_rqst *); /* release rq_enc_pages */
80 struct list_head rq_list; 80 struct list_head rq_list;
81 81
82 __u32 * rq_buffer; /* XDR encode buffer */
83 size_t rq_bufsize;
84
82 struct xdr_buf rq_private_buf; /* The receive buffer 85 struct xdr_buf rq_private_buf; /* The receive buffer
83 * used in the softirq. 86 * used in the softirq.
84 */ 87 */
85 unsigned long rq_majortimeo; /* major timeout alarm */ 88 unsigned long rq_majortimeo; /* major timeout alarm */
86 unsigned long rq_timeout; /* Current timeout value */ 89 unsigned long rq_timeout; /* Current timeout value */
87 unsigned int rq_retries; /* # of retries */ 90 unsigned int rq_retries; /* # of retries */
88 /*
89 * For authentication (e.g. auth_des)
90 */
91 u32 rq_creddata[2];
92 91
93 /* 92 /*
94 * Partial send handling 93 * Partial send handling
95 */ 94 */
96
97 u32 rq_bytes_sent; /* Bytes we have sent */ 95 u32 rq_bytes_sent; /* Bytes we have sent */
98 96
99 unsigned long rq_xtime; /* when transmitted */ 97 unsigned long rq_xtime; /* when transmitted */
@@ -106,7 +104,10 @@ struct rpc_xprt_ops {
106 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); 104 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize);
107 int (*reserve_xprt)(struct rpc_task *task); 105 int (*reserve_xprt)(struct rpc_task *task);
108 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); 106 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task);
107 void (*set_port)(struct rpc_xprt *xprt, unsigned short port);
109 void (*connect)(struct rpc_task *task); 108 void (*connect)(struct rpc_task *task);
109 void * (*buf_alloc)(struct rpc_task *task, size_t size);
110 void (*buf_free)(struct rpc_task *task);
110 int (*send_request)(struct rpc_task *task); 111 int (*send_request)(struct rpc_task *task);
111 void (*set_retrans_timeout)(struct rpc_task *task); 112 void (*set_retrans_timeout)(struct rpc_task *task);
112 void (*timer)(struct rpc_task *task); 113 void (*timer)(struct rpc_task *task);
@@ -253,6 +254,7 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to);
253#define XPRT_LOCKED (0) 254#define XPRT_LOCKED (0)
254#define XPRT_CONNECTED (1) 255#define XPRT_CONNECTED (1)
255#define XPRT_CONNECTING (2) 256#define XPRT_CONNECTING (2)
257#define XPRT_CLOSE_WAIT (3)
256 258
257static inline void xprt_set_connected(struct rpc_xprt *xprt) 259static inline void xprt_set_connected(struct rpc_xprt *xprt)
258{ 260{
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index a61c04f804b2..5dc94e777fab 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -14,11 +14,7 @@
14typedef struct pbe { 14typedef struct pbe {
15 unsigned long address; /* address of the copy */ 15 unsigned long address; /* address of the copy */
16 unsigned long orig_address; /* original address of page */ 16 unsigned long orig_address; /* original address of page */
17 swp_entry_t swap_address; 17 struct pbe *next;
18
19 struct pbe *next; /* also used as scratch space at
20 * end of page (see link, diskpage)
21 */
22} suspend_pagedir_t; 18} suspend_pagedir_t;
23 19
24#define for_each_pbe(pbe, pblist) \ 20#define for_each_pbe(pbe, pblist) \
@@ -77,6 +73,6 @@ unsigned long get_safe_page(gfp_t gfp_mask);
77 * XXX: We try to keep some more pages free so that I/O operations succeed 73 * XXX: We try to keep some more pages free so that I/O operations succeed
78 * without paging. Might this be more? 74 * without paging. Might this be more?
79 */ 75 */
80#define PAGES_FOR_IO 512 76#define PAGES_FOR_IO 1024
81 77
82#endif /* _LINUX_SWSUSP_H */ 78#endif /* _LINUX_SWSUSP_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 508668f840b6..556617bcf7ac 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -172,7 +172,6 @@ extern void swap_setup(void);
172 172
173/* linux/mm/vmscan.c */ 173/* linux/mm/vmscan.c */
174extern int try_to_free_pages(struct zone **, gfp_t); 174extern int try_to_free_pages(struct zone **, gfp_t);
175extern int zone_reclaim(struct zone *, gfp_t, unsigned int);
176extern int shrink_all_memory(int); 175extern int shrink_all_memory(int);
177extern int vm_swappiness; 176extern int vm_swappiness;
178 177
@@ -210,6 +209,7 @@ extern unsigned int nr_swapfiles;
210extern struct swap_info_struct swap_info[]; 209extern struct swap_info_struct swap_info[];
211extern void si_swapinfo(struct sysinfo *); 210extern void si_swapinfo(struct sysinfo *);
212extern swp_entry_t get_swap_page(void); 211extern swp_entry_t get_swap_page(void);
212extern swp_entry_t get_swap_page_of_type(int type);
213extern int swap_duplicate(swp_entry_t); 213extern int swap_duplicate(swp_entry_t);
214extern int valid_swaphandles(swp_entry_t, unsigned long *); 214extern int valid_swaphandles(swp_entry_t, unsigned long *);
215extern void swap_free(swp_entry_t); 215extern void swap_free(swp_entry_t);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 6bc03c911a83..a9b80fc7f0f3 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -124,7 +124,7 @@ enum
124 KERN_OVERFLOWUID=46, /* int: overflow UID */ 124 KERN_OVERFLOWUID=46, /* int: overflow UID */
125 KERN_OVERFLOWGID=47, /* int: overflow GID */ 125 KERN_OVERFLOWGID=47, /* int: overflow GID */
126 KERN_SHMPATH=48, /* string: path to shm fs */ 126 KERN_SHMPATH=48, /* string: path to shm fs */
127 KERN_HOTPLUG=49, /* string: path to hotplug policy agent */ 127 KERN_HOTPLUG=49, /* string: path to uevent helper (deprecated) */
128 KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */ 128 KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */
129 KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */ 129 KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */
130 KERN_CORE_USES_PID=52, /* int: use core or core.%pid */ 130 KERN_CORE_USES_PID=52, /* int: use core or core.%pid */
@@ -390,6 +390,7 @@ enum
390 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, 390 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
391 NET_TCP_CONG_CONTROL=110, 391 NET_TCP_CONG_CONTROL=110,
392 NET_TCP_ABC=111, 392 NET_TCP_ABC=111,
393 NET_IPV4_IPFRAG_MAX_DIST=112,
393}; 394};
394 395
395enum { 396enum {
@@ -670,6 +671,9 @@ enum {
670 NET_DECNET_DST_GC_INTERVAL = 9, 671 NET_DECNET_DST_GC_INTERVAL = 9,
671 NET_DECNET_CONF = 10, 672 NET_DECNET_CONF = 10,
672 NET_DECNET_NO_FC_MAX_CWND = 11, 673 NET_DECNET_NO_FC_MAX_CWND = 11,
674 NET_DECNET_MEM = 12,
675 NET_DECNET_RMEM = 13,
676 NET_DECNET_WMEM = 14,
673 NET_DECNET_DEBUG_LEVEL = 255 677 NET_DECNET_DEBUG_LEVEL = 255
674}; 678};
675 679
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 0e1da6602e05..f2bb2396853f 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -55,22 +55,6 @@ struct tcphdr {
55 __u16 urg_ptr; 55 __u16 urg_ptr;
56}; 56};
57 57
58#define TCP_ACTION_FIN (1 << 7)
59
60enum {
61 TCPF_ESTABLISHED = (1 << 1),
62 TCPF_SYN_SENT = (1 << 2),
63 TCPF_SYN_RECV = (1 << 3),
64 TCPF_FIN_WAIT1 = (1 << 4),
65 TCPF_FIN_WAIT2 = (1 << 5),
66 TCPF_TIME_WAIT = (1 << 6),
67 TCPF_CLOSE = (1 << 7),
68 TCPF_CLOSE_WAIT = (1 << 8),
69 TCPF_LAST_ACK = (1 << 9),
70 TCPF_LISTEN = (1 << 10),
71 TCPF_CLOSING = (1 << 11)
72};
73
74/* 58/*
75 * The union cast uses a gcc extension to avoid aliasing problems 59 * The union cast uses a gcc extension to avoid aliasing problems
76 * (union is compatible to any of its members) 60 * (union is compatible to any of its members)
@@ -254,10 +238,9 @@ struct tcp_sock {
254 __u32 snd_wl1; /* Sequence for window update */ 238 __u32 snd_wl1; /* Sequence for window update */
255 __u32 snd_wnd; /* The window we expect to receive */ 239 __u32 snd_wnd; /* The window we expect to receive */
256 __u32 max_window; /* Maximal window ever seen from peer */ 240 __u32 max_window; /* Maximal window ever seen from peer */
257 __u32 pmtu_cookie; /* Last pmtu seen by socket */
258 __u32 mss_cache; /* Cached effective mss, not including SACKS */ 241 __u32 mss_cache; /* Cached effective mss, not including SACKS */
259 __u16 xmit_size_goal; /* Goal for segmenting output packets */ 242 __u16 xmit_size_goal; /* Goal for segmenting output packets */
260 __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ 243 /* XXX Two bytes hole, try to pack */
261 244
262 __u32 window_clamp; /* Maximal window to advertise */ 245 __u32 window_clamp; /* Maximal window to advertise */
263 __u32 rcv_ssthresh; /* Current window clamp */ 246 __u32 rcv_ssthresh; /* Current window clamp */
@@ -295,8 +278,6 @@ struct tcp_sock {
295 278
296 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 279 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
297 280
298 struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */
299
300 __u32 rcv_wnd; /* Current receiver window */ 281 __u32 rcv_wnd; /* Current receiver window */
301 __u32 rcv_wup; /* rcv_nxt on last window update sent */ 282 __u32 rcv_wup; /* rcv_nxt on last window update sent */
302 __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 283 __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
diff --git a/include/linux/time.h b/include/linux/time.h
index bfbe92d0767c..797ccd813bb0 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -95,6 +95,7 @@ struct itimerval;
95extern int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue); 95extern int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue);
96extern int do_getitimer(int which, struct itimerval *value); 96extern int do_getitimer(int which, struct itimerval *value);
97extern void getnstimeofday (struct timespec *tv); 97extern void getnstimeofday (struct timespec *tv);
98extern void getnstimestamp(struct timespec *ts);
98 99
99extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 100extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
100 101
diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h
index 46e2bb945353..36c684e1b110 100644
--- a/include/linux/udf_fs.h
+++ b/include/linux/udf_fs.h
@@ -13,11 +13,6 @@
13 * http://www.osta.org/ * http://www.ecma.ch/ 13 * http://www.osta.org/ * http://www.ecma.ch/
14 * http://www.iso.org/ 14 * http://www.iso.org/
15 * 15 *
16 * CONTACTS
17 * E-mail regarding any portion of the Linux UDF file system should be
18 * directed to the development team mailing list (run by majordomo):
19 * linux_udf@hpesjro.fc.hp.com
20 *
21 * COPYRIGHT 16 * COPYRIGHT
22 * This file is distributed under the terms of the GNU General Public 17 * This file is distributed under the terms of the GNU General Public
23 * License (GPL). Copies of the GPL can be obtained from: 18 * License (GPL). Copies of the GPL can be obtained from:
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h
index 62b15a4214e6..1e7508420fcf 100644
--- a/include/linux/udf_fs_i.h
+++ b/include/linux/udf_fs_i.h
@@ -3,11 +3,6 @@
3 * 3 *
4 * This file is intended for the Linux kernel/module. 4 * This file is intended for the Linux kernel/module.
5 * 5 *
6 * CONTACTS
7 * E-mail regarding any portion of the Linux UDF file system should be
8 * directed to the development team mailing list (run by majordomo):
9 * linux_udf@hpesjro.fc.hp.com
10 *
11 * COPYRIGHT 6 * COPYRIGHT
12 * This file is distributed under the terms of the GNU General Public 7 * This file is distributed under the terms of the GNU General Public
13 * License (GPL). Copies of the GPL can be obtained from: 8 * License (GPL). Copies of the GPL can be obtained from:
diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h
index 1966a6dbb4b6..b15ff2e99c91 100644
--- a/include/linux/udf_fs_sb.h
+++ b/include/linux/udf_fs_sb.h
@@ -3,11 +3,6 @@
3 * 3 *
4 * This include file is for the Linux kernel/module. 4 * This include file is for the Linux kernel/module.
5 * 5 *
6 * CONTACTS
7 * E-mail regarding any portion of the Linux UDF file system should be
8 * directed to the development team mailing list (run by majordomo):
9 * linux_udf@hpesjro.fc.hp.com
10 *
11 * COPYRIGHT 6 * COPYRIGHT
12 * This file is distributed under the terms of the GNU General Public 7 * This file is distributed under the terms of the GNU General Public
13 * License (GPL). Copies of the GPL can be obtained from: 8 * License (GPL). Copies of the GPL can be obtained from:
diff --git a/include/linux/udp.h b/include/linux/udp.h
index b60e0b4a25c4..85a55658831c 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -35,10 +35,10 @@ struct udphdr {
35#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ 35#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */
36 36
37#ifdef __KERNEL__ 37#ifdef __KERNEL__
38
39#include <linux/config.h> 38#include <linux/config.h>
40#include <net/sock.h> 39#include <linux/types.h>
41#include <linux/ip.h> 40
41#include <net/inet_sock.h>
42 42
43struct udp_sock { 43struct udp_sock {
44 /* inet_sock has to be the first member */ 44 /* inet_sock has to be the first member */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d81b050e5955..827cc6de5f5c 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -225,7 +225,7 @@ struct usb_interface_cache {
225 * Device drivers should not attempt to activate configurations. The choice 225 * Device drivers should not attempt to activate configurations. The choice
226 * of which configuration to install is a policy decision based on such 226 * of which configuration to install is a policy decision based on such
227 * considerations as available power, functionality provided, and the user's 227 * considerations as available power, functionality provided, and the user's
228 * desires (expressed through hotplug scripts). However, drivers can call 228 * desires (expressed through userspace tools). However, drivers can call
229 * usb_reset_configuration() to reinitialize the current configuration and 229 * usb_reset_configuration() to reinitialize the current configuration and
230 * all its interfaces. 230 * all its interfaces.
231 */ 231 */
@@ -329,8 +329,6 @@ struct usb_device {
329 struct usb_tt *tt; /* low/full speed dev, highspeed hub */ 329 struct usb_tt *tt; /* low/full speed dev, highspeed hub */
330 int ttport; /* device port on that tt hub */ 330 int ttport; /* device port on that tt hub */
331 331
332 struct semaphore serialize;
333
334 unsigned int toggle[2]; /* one bit for each endpoint 332 unsigned int toggle[2]; /* one bit for each endpoint
335 * ([0] = IN, [1] = OUT) */ 333 * ([0] = IN, [1] = OUT) */
336 334
@@ -349,6 +347,9 @@ struct usb_device {
349 347
350 char **rawdescriptors; /* Raw descriptors for each config */ 348 char **rawdescriptors; /* Raw descriptors for each config */
351 349
350 unsigned short bus_mA; /* Current available from the bus */
351 u8 portnum; /* Parent port number (origin 1) */
352
352 int have_langid; /* whether string_langid is valid */ 353 int have_langid; /* whether string_langid is valid */
353 int string_langid; /* language ID for strings */ 354 int string_langid; /* language ID for strings */
354 355
@@ -377,11 +378,12 @@ struct usb_device {
377extern struct usb_device *usb_get_dev(struct usb_device *dev); 378extern struct usb_device *usb_get_dev(struct usb_device *dev);
378extern void usb_put_dev(struct usb_device *dev); 379extern void usb_put_dev(struct usb_device *dev);
379 380
380extern void usb_lock_device(struct usb_device *udev); 381/* USB device locking */
381extern int usb_trylock_device(struct usb_device *udev); 382#define usb_lock_device(udev) down(&(udev)->dev.sem)
383#define usb_unlock_device(udev) up(&(udev)->dev.sem)
384#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem)
382extern int usb_lock_device_for_reset(struct usb_device *udev, 385extern int usb_lock_device_for_reset(struct usb_device *udev,
383 struct usb_interface *iface); 386 struct usb_interface *iface);
384extern void usb_unlock_device(struct usb_device *udev);
385 387
386/* USB port reset for device reinitialization */ 388/* USB port reset for device reinitialization */
387extern int usb_reset_device(struct usb_device *dev); 389extern int usb_reset_device(struct usb_device *dev);
@@ -529,10 +531,13 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
529 531
530/* ----------------------------------------------------------------------- */ 532/* ----------------------------------------------------------------------- */
531 533
534struct usb_dynids {
535 spinlock_t lock;
536 struct list_head list;
537};
538
532/** 539/**
533 * struct usb_driver - identifies USB driver to usbcore 540 * struct usb_driver - identifies USB driver to usbcore
534 * @owner: Pointer to the module owner of this driver; initialize
535 * it using THIS_MODULE.
536 * @name: The driver name should be unique among USB drivers, 541 * @name: The driver name should be unique among USB drivers,
537 * and should normally be the same as the module name. 542 * and should normally be the same as the module name.
538 * @probe: Called to see if the driver is willing to manage a particular 543 * @probe: Called to see if the driver is willing to manage a particular
@@ -553,7 +558,11 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
553 * @id_table: USB drivers use ID table to support hotplugging. 558 * @id_table: USB drivers use ID table to support hotplugging.
554 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set 559 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set
555 * or your driver's probe function will never get called. 560 * or your driver's probe function will never get called.
561 * @dynids: used internally to hold the list of dynamically added device
562 * ids for this driver.
556 * @driver: the driver model core driver structure. 563 * @driver: the driver model core driver structure.
564 * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be
565 * added to this driver by preventing the sysfs file from being created.
557 * 566 *
558 * USB drivers must provide a name, probe() and disconnect() methods, 567 * USB drivers must provide a name, probe() and disconnect() methods,
559 * and an id_table. Other driver fields are optional. 568 * and an id_table. Other driver fields are optional.
@@ -571,8 +580,6 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
571 * them as necessary, and blocking until the unlinks complete). 580 * them as necessary, and blocking until the unlinks complete).
572 */ 581 */
573struct usb_driver { 582struct usb_driver {
574 struct module *owner;
575
576 const char *name; 583 const char *name;
577 584
578 int (*probe) (struct usb_interface *intf, 585 int (*probe) (struct usb_interface *intf,
@@ -588,7 +595,9 @@ struct usb_driver {
588 595
589 const struct usb_device_id *id_table; 596 const struct usb_device_id *id_table;
590 597
598 struct usb_dynids dynids;
591 struct device_driver driver; 599 struct device_driver driver;
600 unsigned int no_dynamic_id:1;
592}; 601};
593#define to_usb_driver(d) container_of(d, struct usb_driver, driver) 602#define to_usb_driver(d) container_of(d, struct usb_driver, driver)
594 603
@@ -614,7 +623,11 @@ struct usb_class_driver {
614 * use these in module_init()/module_exit() 623 * use these in module_init()/module_exit()
615 * and don't forget MODULE_DEVICE_TABLE(usb, ...) 624 * and don't forget MODULE_DEVICE_TABLE(usb, ...)
616 */ 625 */
617extern int usb_register(struct usb_driver *); 626int usb_register_driver(struct usb_driver *, struct module *);
627static inline int usb_register(struct usb_driver *driver)
628{
629 return usb_register_driver(driver, THIS_MODULE);
630}
618extern void usb_deregister(struct usb_driver *); 631extern void usb_deregister(struct usb_driver *);
619 632
620extern int usb_register_dev(struct usb_interface *intf, 633extern int usb_register_dev(struct usb_interface *intf,
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
new file mode 100644
index 000000000000..b2d08984a9f7
--- /dev/null
+++ b/include/linux/usb_usual.h
@@ -0,0 +1,126 @@
1/*
2 * Interface to the libusual.
3 *
4 * Copyright (c) 2005 Pete Zaitcev <zaitcev@redhat.com>
5 * Copyright (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
6 * Copyright (c) 1999 Michael Gee (michael@linuxspecific.com)
7 */
8
9#ifndef __LINUX_USB_USUAL_H
10#define __LINUX_USB_USUAL_H
11
12#include <linux/config.h>
13
14/* We should do this for cleanliness... But other usb_foo.h do not do this. */
15/* #include <linux/usb.h> */
16
17/*
18 * The flags field, which we store in usb_device_id.driver_info.
19 * It is compatible with the old usb-storage flags in lower 24 bits.
20 */
21
22/*
23 * Static flag definitions. We use this roundabout technique so that the
24 * proc_info() routine can automatically display a message for each flag.
25 */
26#define US_DO_ALL_FLAGS \
27 US_FLAG(SINGLE_LUN, 0x00000001) \
28 /* allow access to only LUN 0 */ \
29 US_FLAG(NEED_OVERRIDE, 0x00000002) \
30 /* unusual_devs entry is necessary */ \
31 US_FLAG(SCM_MULT_TARG, 0x00000004) \
32 /* supports multiple targets */ \
33 US_FLAG(FIX_INQUIRY, 0x00000008) \
34 /* INQUIRY response needs faking */ \
35 US_FLAG(FIX_CAPACITY, 0x00000010) \
36 /* READ CAPACITY response too big */ \
37 US_FLAG(IGNORE_RESIDUE, 0x00000020) \
38 /* reported residue is wrong */ \
39 US_FLAG(BULK32, 0x00000040) \
40 /* Uses 32-byte CBW length */ \
41 US_FLAG(NOT_LOCKABLE, 0x00000080) \
42 /* PREVENT/ALLOW not supported */ \
43 US_FLAG(GO_SLOW, 0x00000100) \
44 /* Need delay after Command phase */ \
45 US_FLAG(NO_WP_DETECT, 0x00000200) \
46 /* Don't check for write-protect */ \
47
48#define US_FLAG(name, value) US_FL_##name = value ,
49enum { US_DO_ALL_FLAGS };
50#undef US_FLAG
51
52/*
53 * The bias field for libusual and friends.
54 */
55#define USB_US_TYPE_NONE 0
56#define USB_US_TYPE_STOR 1 /* usb-storage */
57#define USB_US_TYPE_UB 2 /* ub */
58
59#define USB_US_TYPE(flags) (((flags) >> 24) & 0xFF)
60#define USB_US_ORIG_FLAGS(flags) ((flags) & 0x00FFFFFF)
61
62/*
63 * This is probably not the best place to keep these constants, conceptually.
64 * But it's the only header included into all places which need them.
65 */
66
67/* Sub Classes */
68
69#define US_SC_RBC 0x01 /* Typically, flash devices */
70#define US_SC_8020 0x02 /* CD-ROM */
71#define US_SC_QIC 0x03 /* QIC-157 Tapes */
72#define US_SC_UFI 0x04 /* Floppy */
73#define US_SC_8070 0x05 /* Removable media */
74#define US_SC_SCSI 0x06 /* Transparent */
75#define US_SC_ISD200 0x07 /* ISD200 ATA */
76#define US_SC_MIN US_SC_RBC
77#define US_SC_MAX US_SC_ISD200
78
79#define US_SC_DEVICE 0xff /* Use device's value */
80
81/* Protocols */
82
83#define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */
84#define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */
85#define US_PR_BULK 0x50 /* bulk only */
86#ifdef CONFIG_USB_STORAGE_USBAT
87#define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */
88#endif
89#ifdef CONFIG_USB_STORAGE_SDDR09
90#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
91#endif
92#ifdef CONFIG_USB_STORAGE_SDDR55
93#define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */
94#endif
95#define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
96#ifdef CONFIG_USB_STORAGE_FREECOM
97#define US_PR_FREECOM 0xf1 /* Freecom */
98#endif
99#ifdef CONFIG_USB_STORAGE_DATAFAB
100#define US_PR_DATAFAB 0xf2 /* Datafab chipsets */
101#endif
102#ifdef CONFIG_USB_STORAGE_JUMPSHOT
103#define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
104#endif
105#ifdef CONFIG_USB_STORAGE_ALAUDA
106#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
107#endif
108
109#define US_PR_DEVICE 0xff /* Use device's value */
110
111/*
112 */
113#ifdef CONFIG_USB_LIBUSUAL
114
115extern struct usb_device_id storage_usb_ids[];
116extern void usb_usual_set_present(int type);
117extern void usb_usual_clear_present(int type);
118extern int usb_usual_check_type(const struct usb_device_id *, int type);
119#else
120
121#define usb_usual_set_present(t) do { } while(0)
122#define usb_usual_clear_present(t) do { } while(0)
123#define usb_usual_check_type(id, t) (0)
124#endif /* CONFIG_USB_LIBUSUAL */
125
126#endif /* __LINUX_USB_USUAL_H */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 343d883d69c5..b096159086e8 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -53,19 +53,14 @@ struct writeback_control {
53 loff_t start; 53 loff_t start;
54 loff_t end; 54 loff_t end;
55 55
56 unsigned nonblocking:1; /* Don't get stuck on request queues */ 56 unsigned nonblocking:1; /* Don't get stuck on request queues */
57 unsigned encountered_congestion:1; /* An output: a queue is full */ 57 unsigned encountered_congestion:1; /* An output: a queue is full */
58 unsigned for_kupdate:1; /* A kupdate writeback */ 58 unsigned for_kupdate:1; /* A kupdate writeback */
59 unsigned for_reclaim:1; /* Invoked from the page allocator */ 59 unsigned for_reclaim:1; /* Invoked from the page allocator */
60 unsigned for_writepages:1; /* This is a writepages() call */
60}; 61};
61 62
62/* 63/*
63 * ->writepage() return values (make these much larger than a pagesize, in
64 * case some fs is returning number-of-bytes-written from writepage)
65 */
66#define WRITEPAGE_ACTIVATE 0x80000 /* IO was not started: activate page */
67
68/*
69 * fs/fs-writeback.c 64 * fs/fs-writeback.c
70 */ 65 */
71void writeback_inodes(struct writeback_control *wbc); 66void writeback_inodes(struct writeback_control *wbc);
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 0fb077d68441..82fbb758e28f 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -27,6 +27,22 @@ struct xfrm_id
27 __u8 proto; 27 __u8 proto;
28}; 28};
29 29
30struct xfrm_sec_ctx {
31 __u8 ctx_doi;
32 __u8 ctx_alg;
33 __u16 ctx_len;
34 __u32 ctx_sid;
35 char ctx_str[0];
36};
37
38/* Security Context Domains of Interpretation */
39#define XFRM_SC_DOI_RESERVED 0
40#define XFRM_SC_DOI_LSM 1
41
42/* Security Context Algorithms */
43#define XFRM_SC_ALG_RESERVED 0
44#define XFRM_SC_ALG_SELINUX 1
45
30/* Selector, used as selector both on policy rules (SPD) and SAs. */ 46/* Selector, used as selector both on policy rules (SPD) and SAs. */
31 47
32struct xfrm_selector 48struct xfrm_selector
@@ -146,6 +162,18 @@ enum {
146 162
147#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) 163#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE)
148 164
165/*
166 * Generic LSM security context for comunicating to user space
167 * NOTE: Same format as sadb_x_sec_ctx
168 */
169struct xfrm_user_sec_ctx {
170 __u16 len;
171 __u16 exttype;
172 __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */
173 __u8 ctx_doi;
174 __u16 ctx_len;
175};
176
149struct xfrm_user_tmpl { 177struct xfrm_user_tmpl {
150 struct xfrm_id id; 178 struct xfrm_id id;
151 __u16 family; 179 __u16 family;
@@ -176,6 +204,7 @@ enum xfrm_attr_type_t {
176 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ 204 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */
177 XFRMA_SA, 205 XFRMA_SA,
178 XFRMA_POLICY, 206 XFRMA_POLICY,
207 XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */
179 __XFRMA_MAX 208 __XFRMA_MAX
180 209
181#define XFRMA_MAX (__XFRMA_MAX - 1) 210#define XFRMA_MAX (__XFRMA_MAX - 1)
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index 2a897c3a6a9a..2bc634fcb7bb 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -14,21 +14,21 @@
14#include <linux/vmalloc.h> /* for vmalloc() */ 14#include <linux/vmalloc.h> /* for vmalloc() */
15#include <linux/mm.h> /* for vmalloc_to_page() */ 15#include <linux/mm.h> /* for vmalloc_to_page() */
16 16
17#define SAA7146_VERSION_CODE 0x000500 /* 0.5.0 */ 17#define SAA7146_VERSION_CODE 0x000500 /* 0.5.0 */
18 18
19#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr))) 19#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr)))
20#define saa7146_read(sxy,adr) readl(sxy->mem+(adr)) 20#define saa7146_read(sxy,adr) readl(sxy->mem+(adr))
21 21
22extern unsigned int saa7146_debug; 22extern unsigned int saa7146_debug;
23 23
24//#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),__stringify(KBUILD_MODNAME),__FUNCTION__) 24//#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),KBUILD_MODNAME,__FUNCTION__)
25 25
26#ifndef DEBUG_VARIABLE 26#ifndef DEBUG_VARIABLE
27 #define DEBUG_VARIABLE saa7146_debug 27 #define DEBUG_VARIABLE saa7146_debug
28#endif 28#endif
29 29
30#define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_MODNAME),__FUNCTION__) 30#define DEBUG_PROLOG printk("%s: %s(): ",KBUILD_MODNAME,__FUNCTION__)
31#define INFO(x) { printk("%s: ",__stringify(KBUILD_MODNAME)); printk x; } 31#define INFO(x) { printk("%s: ",KBUILD_MODNAME); printk x; }
32 32
33#define ERR(x) { DEBUG_PROLOG; printk x; } 33#define ERR(x) { DEBUG_PROLOG; printk x; }
34 34
@@ -112,7 +112,7 @@ struct saa7146_dev
112 112
113 /* different device locks */ 113 /* different device locks */
114 spinlock_t slock; 114 spinlock_t slock;
115 struct semaphore lock; 115 struct semaphore lock;
116 116
117 unsigned char __iomem *mem; /* pointer to mapped IO memory */ 117 unsigned char __iomem *mem; /* pointer to mapped IO memory */
118 int revision; /* chip revision; needed for bug-workarounds*/ 118 int revision; /* chip revision; needed for bug-workarounds*/
@@ -133,7 +133,7 @@ struct saa7146_dev
133 void (*vv_callback)(struct saa7146_dev *dev, unsigned long status); 133 void (*vv_callback)(struct saa7146_dev *dev, unsigned long status);
134 134
135 /* i2c-stuff */ 135 /* i2c-stuff */
136 struct semaphore i2c_lock; 136 struct semaphore i2c_lock;
137 u32 i2c_bitrate; 137 u32 i2c_bitrate;
138 struct saa7146_dma d_i2c; /* pointer to i2c memory */ 138 struct saa7146_dma d_i2c; /* pointer to i2c memory */
139 wait_queue_head_t i2c_wq; 139 wait_queue_head_t i2c_wq;
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 64691753721e..16af9299315f 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -113,7 +113,7 @@ struct saa7146_vv
113 /* vbi capture */ 113 /* vbi capture */
114 struct saa7146_dmaqueue vbi_q; 114 struct saa7146_dmaqueue vbi_q;
115 /* vbi workaround interrupt queue */ 115 /* vbi workaround interrupt queue */
116 wait_queue_head_t vbi_wq; 116 wait_queue_head_t vbi_wq;
117 int vbi_fieldcount; 117 int vbi_fieldcount;
118 struct saa7146_fh *vbi_streaming; 118 struct saa7146_fh *vbi_streaming;
119 119
@@ -181,10 +181,10 @@ struct saa7146_ext_vv
181}; 181};
182 182
183struct saa7146_use_ops { 183struct saa7146_use_ops {
184 void (*init)(struct saa7146_dev *, struct saa7146_vv *); 184 void (*init)(struct saa7146_dev *, struct saa7146_vv *);
185 int(*open)(struct saa7146_dev *, struct file *); 185 int(*open)(struct saa7146_dev *, struct file *);
186 void (*release)(struct saa7146_dev *, struct file *); 186 void (*release)(struct saa7146_dev *, struct file *);
187 void (*irq_done)(struct saa7146_dev *, unsigned long status); 187 void (*irq_done)(struct saa7146_dev *, unsigned long status);
188 ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); 188 ssize_t (*read)(struct file *, char __user *, size_t, loff_t *);
189}; 189};
190 190
diff --git a/include/media/tuner.h b/include/media/tuner.h
index faa0f8e3091b..b37cde606692 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -218,14 +218,15 @@ extern int default_tuner_init(struct i2c_client *c);
218extern int tea5767_autodetection(struct i2c_client *c); 218extern int tea5767_autodetection(struct i2c_client *c);
219 219
220#define tuner_warn(fmt, arg...) do {\ 220#define tuner_warn(fmt, arg...) do {\
221 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \ 221 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
222 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) 222 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0)
223#define tuner_info(fmt, arg...) do {\ 223#define tuner_info(fmt, arg...) do {\
224 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->name, \ 224 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
225 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) 225 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0)
226#define tuner_dbg(fmt, arg...) do {\ 226#define tuner_dbg(fmt, arg...) do {\
227 if (tuner_debug) \ 227 if (tuner_debug) \
228 printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->name, \ 228 printk(KERN_DEBUG "%s %d-%04x: " fmt, \
229 t->i2c.driver->driver.name, \
229 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) 230 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0)
230 231
231#endif /* __KERNEL__ */ 232#endif /* __KERNEL__ */
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index b5d785ab4a0e..bfc1779fc753 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -13,7 +13,7 @@ extern void unix_gc(void);
13#define UNIX_HASH_SIZE 256 13#define UNIX_HASH_SIZE 256
14 14
15extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; 15extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
16extern rwlock_t unix_table_lock; 16extern spinlock_t unix_table_lock;
17 17
18extern atomic_t unix_tot_inflight; 18extern atomic_t unix_tot_inflight;
19 19
@@ -58,10 +58,10 @@ struct unix_skb_parms {
58#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) 58#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb))
59#define UNIXCREDS(skb) (&UNIXCB((skb)).creds) 59#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
60 60
61#define unix_state_rlock(s) read_lock(&unix_sk(s)->lock) 61#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock)
62#define unix_state_runlock(s) read_unlock(&unix_sk(s)->lock) 62#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock)
63#define unix_state_wlock(s) write_lock(&unix_sk(s)->lock) 63#define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock)
64#define unix_state_wunlock(s) write_unlock(&unix_sk(s)->lock) 64#define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock)
65 65
66#ifdef __KERNEL__ 66#ifdef __KERNEL__
67/* The AF_UNIX socket */ 67/* The AF_UNIX socket */
@@ -76,7 +76,7 @@ struct unix_sock {
76 struct sock *other; 76 struct sock *other;
77 struct sock *gc_tree; 77 struct sock *gc_tree;
78 atomic_t inflight; 78 atomic_t inflight;
79 rwlock_t lock; 79 spinlock_t lock;
80 wait_queue_head_t peer_wait; 80 wait_queue_head_t peer_wait;
81}; 81};
82#define unix_sk(__sk) ((struct unix_sock *)__sk) 82#define unix_sk(__sk) ((struct unix_sock *)__sk)
diff --git a/include/net/atmclip.h b/include/net/atmclip.h
index 47048b1d179a..90fcc98e676f 100644
--- a/include/net/atmclip.h
+++ b/include/net/atmclip.h
@@ -7,7 +7,6 @@
7#define _ATMCLIP_H 7#define _ATMCLIP_H
8 8
9#include <linux/netdevice.h> 9#include <linux/netdevice.h>
10#include <linux/skbuff.h>
11#include <linux/atm.h> 10#include <linux/atm.h>
12#include <linux/atmdev.h> 11#include <linux/atmdev.h>
13#include <linux/atmarp.h> 12#include <linux/atmarp.h>
@@ -18,6 +17,7 @@
18#define CLIP_VCC(vcc) ((struct clip_vcc *) ((vcc)->user_back)) 17#define CLIP_VCC(vcc) ((struct clip_vcc *) ((vcc)->user_back))
19#define NEIGH2ENTRY(neigh) ((struct atmarp_entry *) (neigh)->primary_key) 18#define NEIGH2ENTRY(neigh) ((struct atmarp_entry *) (neigh)->primary_key)
20 19
20struct sk_buff;
21 21
22struct clip_vcc { 22struct clip_vcc {
23 struct atm_vcc *vcc; /* VCC descriptor */ 23 struct atm_vcc *vcc; /* VCC descriptor */
diff --git a/include/net/dn.h b/include/net/dn.h
index c1dbbd222793..a4b6168e1e25 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -234,4 +234,8 @@ extern int decnet_di_count;
234extern int decnet_dr_count; 234extern int decnet_dr_count;
235extern int decnet_no_fc_max_cwnd; 235extern int decnet_no_fc_max_cwnd;
236 236
237extern int sysctl_decnet_mem[3];
238extern int sysctl_decnet_wmem[3];
239extern int sysctl_decnet_rmem[3];
240
237#endif /* _NET_DN_H */ 241#endif /* _NET_DN_H */
diff --git a/include/net/dst.h b/include/net/dst.h
index 6c196a5baf24..bee8b84d329d 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -9,6 +9,7 @@
9#define _NET_DST_H 9#define _NET_DST_H
10 10
11#include <linux/config.h> 11#include <linux/config.h>
12#include <linux/netdevice.h>
12#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
13#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
14#include <linux/jiffies.h> 15#include <linux/jiffies.h>
diff --git a/include/net/flow.h b/include/net/flow.h
index 9a5c94b1a0ec..ec7eb86eb203 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -84,11 +84,12 @@ struct flowi {
84#define FLOW_DIR_OUT 1 84#define FLOW_DIR_OUT 1
85#define FLOW_DIR_FWD 2 85#define FLOW_DIR_FWD 2
86 86
87typedef void (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir, 87struct sock;
88typedef void (*flow_resolve_t)(struct flowi *key, u32 sk_sid, u16 family, u8 dir,
88 void **objp, atomic_t **obj_refp); 89 void **objp, atomic_t **obj_refp);
89 90
90extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir, 91extern void *flow_cache_lookup(struct flowi *key, u32 sk_sid, u16 family, u8 dir,
91 flow_resolve_t resolver); 92 flow_resolve_t resolver);
92extern void flow_cache_flush(void); 93extern void flow_cache_flush(void);
93extern atomic_t flow_cache_genid; 94extern atomic_t flow_cache_genid;
94 95
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 52d8b1a73d52..c5b96b2b8155 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -60,7 +60,7 @@ struct genl_info
60 */ 60 */
61struct genl_ops 61struct genl_ops
62{ 62{
63 unsigned int cmd; 63 u8 cmd;
64 unsigned int flags; 64 unsigned int flags;
65 struct nla_policy *policy; 65 struct nla_policy *policy;
66 int (*doit)(struct sk_buff *skb, 66 int (*doit)(struct sk_buff *skb,
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 6cdebeee5f96..e7c3f20fbafc 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -20,12 +20,9 @@
20 20
21#include <linux/config.h> 21#include <linux/config.h>
22#include <linux/icmp.h> 22#include <linux/icmp.h>
23#include <linux/skbuff.h>
24 23
25#include <net/sock.h> 24#include <net/inet_sock.h>
26#include <net/protocol.h>
27#include <net/snmp.h> 25#include <net/snmp.h>
28#include <linux/ip.h>
29 26
30struct icmp_err { 27struct icmp_err {
31 int errno; 28 int errno;
@@ -38,6 +35,10 @@ DECLARE_SNMP_STAT(struct icmp_mib, icmp_statistics);
38#define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmp_statistics, field) 35#define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmp_statistics, field)
39#define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmp_statistics, field) 36#define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmp_statistics, field)
40 37
38struct dst_entry;
39struct net_proto_family;
40struct sk_buff;
41
41extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info); 42extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info);
42extern int icmp_rcv(struct sk_buff *skb); 43extern int icmp_rcv(struct sk_buff *skb);
43extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); 44extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h
index 225fc751d464..03b766afdc39 100644
--- a/include/net/ieee80211_crypt.h
+++ b/include/net/ieee80211_crypt.h
@@ -23,12 +23,17 @@
23#ifndef IEEE80211_CRYPT_H 23#ifndef IEEE80211_CRYPT_H
24#define IEEE80211_CRYPT_H 24#define IEEE80211_CRYPT_H
25 25
26#include <linux/skbuff.h> 26#include <linux/types.h>
27#include <linux/list.h>
28#include <asm/atomic.h>
27 29
28enum { 30enum {
29 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), 31 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0),
30}; 32};
31 33
34struct sk_buff;
35struct module;
36
32struct ieee80211_crypto_ops { 37struct ieee80211_crypto_ops {
33 const char *name; 38 const char *name;
34 struct list_head list; 39 struct list_head list;
@@ -87,6 +92,8 @@ struct ieee80211_crypt_data {
87 atomic_t refcnt; 92 atomic_t refcnt;
88}; 93};
89 94
95struct ieee80211_device;
96
90int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); 97int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
91int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); 98int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
92struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); 99struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name);
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index e97a9accb71d..eb8afe3499a9 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -24,6 +24,7 @@
24#define IF_RA_MANAGED 0x40 24#define IF_RA_MANAGED 0x40
25#define IF_RA_RCVD 0x20 25#define IF_RA_RCVD 0x20
26#define IF_RS_SENT 0x10 26#define IF_RS_SENT 0x10
27#define IF_READY 0x80000000
27 28
28/* prefix flags */ 29/* prefix flags */
29#define IF_PREFIX_ONLINK 0x01 30#define IF_PREFIX_ONLINK 0x01
@@ -82,6 +83,7 @@ struct ipv6_mc_socklist
82 struct in6_addr addr; 83 struct in6_addr addr;
83 int ifindex; 84 int ifindex;
84 struct ipv6_mc_socklist *next; 85 struct ipv6_mc_socklist *next;
86 rwlock_t sflock;
85 unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */ 87 unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */
86 struct ip6_sf_socklist *sflist; 88 struct ip6_sf_socklist *sflist;
87}; 89};
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
new file mode 100644
index 000000000000..b33b438bffcc
--- /dev/null
+++ b/include/net/inet6_connection_sock.h
@@ -0,0 +1,42 @@
1/*
2 * NET Generic infrastructure for INET6 connection oriented protocols.
3 *
4 * Authors: Many people, see the TCPv6 sources
5 *
6 * From code originally in TCPv6
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#ifndef _INET6_CONNECTION_SOCK_H
14#define _INET6_CONNECTION_SOCK_H
15
16#include <linux/types.h>
17
18struct in6_addr;
19struct inet_bind_bucket;
20struct request_sock;
21struct sk_buff;
22struct sock;
23struct sockaddr;
24
25extern int inet6_csk_bind_conflict(const struct sock *sk,
26 const struct inet_bind_bucket *tb);
27
28extern struct request_sock *inet6_csk_search_req(const struct sock *sk,
29 struct request_sock ***prevp,
30 const __u16 rport,
31 const struct in6_addr *raddr,
32 const struct in6_addr *laddr,
33 const int iif);
34
35extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
36 struct request_sock *req,
37 const unsigned long timeout);
38
39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
40
41extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok);
42#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 5a2beed5a770..25f708ff020e 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -48,6 +48,32 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
48 return inet6_ehashfn(laddr, lport, faddr, fport); 48 return inet6_ehashfn(laddr, lport, faddr, fport);
49} 49}
50 50
51static inline void __inet6_hash(struct inet_hashinfo *hashinfo,
52 struct sock *sk)
53{
54 struct hlist_head *list;
55 rwlock_t *lock;
56
57 BUG_TRAP(sk_unhashed(sk));
58
59 if (sk->sk_state == TCP_LISTEN) {
60 list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)];
61 lock = &hashinfo->lhash_lock;
62 inet_listen_wlock(hashinfo);
63 } else {
64 unsigned int hash;
65 sk->sk_hash = hash = inet6_sk_ehashfn(sk);
66 hash &= (hashinfo->ehash_size - 1);
67 list = &hashinfo->ehash[hash].chain;
68 lock = &hashinfo->ehash[hash].lock;
69 write_lock(lock);
70 }
71
72 __sk_add_node(sk, list);
73 sock_prot_inc_use(sk->sk_prot);
74 write_unlock(lock);
75}
76
51/* 77/*
52 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so 78 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
53 * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM 79 * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM
@@ -84,10 +110,10 @@ static inline struct sock *
84 110
85 if(*((__u32 *)&(tw->tw_dport)) == ports && 111 if(*((__u32 *)&(tw->tw_dport)) == ports &&
86 sk->sk_family == PF_INET6) { 112 sk->sk_family == PF_INET6) {
87 const struct tcp6_timewait_sock *tcp6tw = tcp6_twsk(sk); 113 const struct inet6_timewait_sock *tw6 = inet6_twsk(sk);
88 114
89 if (ipv6_addr_equal(&tcp6tw->tw_v6_daddr, saddr) && 115 if (ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) &&
90 ipv6_addr_equal(&tcp6tw->tw_v6_rcv_saddr, daddr) && 116 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) &&
91 (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif)) 117 (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif))
92 goto hit; 118 goto hit;
93 } 119 }
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index f943306ce5ff..227adcbdfec8 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -1,8 +1,8 @@
1#ifndef _INET_COMMON_H 1#ifndef _INET_COMMON_H
2#define _INET_COMMON_H 2#define _INET_COMMON_H
3 3
4extern struct proto_ops inet_stream_ops; 4extern const struct proto_ops inet_stream_ops;
5extern struct proto_ops inet_dgram_ops; 5extern const struct proto_ops inet_dgram_ops;
6 6
7/* 7/*
8 * INET4 prototypes used by INET6 8 * INET4 prototypes used by INET6
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index b0c99060b78d..50234fa56a68 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -15,9 +15,11 @@
15#ifndef _INET_CONNECTION_SOCK_H 15#ifndef _INET_CONNECTION_SOCK_H
16#define _INET_CONNECTION_SOCK_H 16#define _INET_CONNECTION_SOCK_H
17 17
18#include <linux/ip.h> 18#include <linux/compiler.h>
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/timer.h> 20#include <linux/timer.h>
21
22#include <net/inet_sock.h>
21#include <net/request_sock.h> 23#include <net/request_sock.h>
22 24
23#define INET_CSK_DEBUG 1 25#define INET_CSK_DEBUG 1
@@ -29,6 +31,29 @@ struct inet_bind_bucket;
29struct inet_hashinfo; 31struct inet_hashinfo;
30struct tcp_congestion_ops; 32struct tcp_congestion_ops;
31 33
34/*
35 * Pointers to address related TCP functions
36 * (i.e. things that depend on the address family)
37 */
38struct inet_connection_sock_af_ops {
39 int (*queue_xmit)(struct sk_buff *skb, int ipfragok);
40 void (*send_check)(struct sock *sk, int len,
41 struct sk_buff *skb);
42 int (*rebuild_header)(struct sock *sk);
43 int (*conn_request)(struct sock *sk, struct sk_buff *skb);
44 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb,
45 struct request_sock *req,
46 struct dst_entry *dst);
47 int (*remember_stamp)(struct sock *sk);
48 __u16 net_header_len;
49 int (*setsockopt)(struct sock *sk, int level, int optname,
50 char __user *optval, int optlen);
51 int (*getsockopt)(struct sock *sk, int level, int optname,
52 char __user *optval, int __user *optlen);
53 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
54 int sockaddr_len;
55};
56
32/** inet_connection_sock - INET connection oriented sock 57/** inet_connection_sock - INET connection oriented sock
33 * 58 *
34 * @icsk_accept_queue: FIFO of established children 59 * @icsk_accept_queue: FIFO of established children
@@ -36,13 +61,16 @@ struct tcp_congestion_ops;
36 * @icsk_timeout: Timeout 61 * @icsk_timeout: Timeout
37 * @icsk_retransmit_timer: Resend (no ack) 62 * @icsk_retransmit_timer: Resend (no ack)
38 * @icsk_rto: Retransmit timeout 63 * @icsk_rto: Retransmit timeout
64 * @icsk_pmtu_cookie Last pmtu seen by socket
39 * @icsk_ca_ops Pluggable congestion control hook 65 * @icsk_ca_ops Pluggable congestion control hook
66 * @icsk_af_ops Operations which are AF_INET{4,6} specific
40 * @icsk_ca_state: Congestion control state 67 * @icsk_ca_state: Congestion control state
41 * @icsk_retransmits: Number of unrecovered [RTO] timeouts 68 * @icsk_retransmits: Number of unrecovered [RTO] timeouts
42 * @icsk_pending: Scheduled timer event 69 * @icsk_pending: Scheduled timer event
43 * @icsk_backoff: Backoff 70 * @icsk_backoff: Backoff
44 * @icsk_syn_retries: Number of allowed SYN (or equivalent) retries 71 * @icsk_syn_retries: Number of allowed SYN (or equivalent) retries
45 * @icsk_probes_out: unanswered 0 window probes 72 * @icsk_probes_out: unanswered 0 window probes
73 * @icsk_ext_hdr_len: Network protocol overhead (IP/IPv6 options)
46 * @icsk_ack: Delayed ACK control data 74 * @icsk_ack: Delayed ACK control data
47 */ 75 */
48struct inet_connection_sock { 76struct inet_connection_sock {
@@ -54,14 +82,17 @@ struct inet_connection_sock {
54 struct timer_list icsk_retransmit_timer; 82 struct timer_list icsk_retransmit_timer;
55 struct timer_list icsk_delack_timer; 83 struct timer_list icsk_delack_timer;
56 __u32 icsk_rto; 84 __u32 icsk_rto;
85 __u32 icsk_pmtu_cookie;
57 struct tcp_congestion_ops *icsk_ca_ops; 86 struct tcp_congestion_ops *icsk_ca_ops;
87 struct inet_connection_sock_af_ops *icsk_af_ops;
88 unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu);
58 __u8 icsk_ca_state; 89 __u8 icsk_ca_state;
59 __u8 icsk_retransmits; 90 __u8 icsk_retransmits;
60 __u8 icsk_pending; 91 __u8 icsk_pending;
61 __u8 icsk_backoff; 92 __u8 icsk_backoff;
62 __u8 icsk_syn_retries; 93 __u8 icsk_syn_retries;
63 __u8 icsk_probes_out; 94 __u8 icsk_probes_out;
64 /* 2 BYTES HOLE, TRY TO PACK! */ 95 __u16 icsk_ext_hdr_len;
65 struct { 96 struct {
66 __u8 pending; /* ACK is pending */ 97 __u8 pending; /* ACK is pending */
67 __u8 quick; /* Scheduled number of quick acks */ 98 __u8 quick; /* Scheduled number of quick acks */
@@ -192,8 +223,12 @@ extern struct request_sock *inet_csk_search_req(const struct sock *sk,
192 const __u16 rport, 223 const __u16 rport,
193 const __u32 raddr, 224 const __u32 raddr,
194 const __u32 laddr); 225 const __u32 laddr);
226extern int inet_csk_bind_conflict(const struct sock *sk,
227 const struct inet_bind_bucket *tb);
195extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, 228extern int inet_csk_get_port(struct inet_hashinfo *hashinfo,
196 struct sock *sk, unsigned short snum); 229 struct sock *sk, unsigned short snum,
230 int (*bind_conflict)(const struct sock *sk,
231 const struct inet_bind_bucket *tb));
197 232
198extern struct dst_entry* inet_csk_route_req(struct sock *sk, 233extern struct dst_entry* inet_csk_route_req(struct sock *sk,
199 const struct request_sock *req); 234 const struct request_sock *req);
@@ -207,7 +242,7 @@ static inline void inet_csk_reqsk_queue_add(struct sock *sk,
207 242
208extern void inet_csk_reqsk_queue_hash_add(struct sock *sk, 243extern void inet_csk_reqsk_queue_hash_add(struct sock *sk,
209 struct request_sock *req, 244 struct request_sock *req,
210 const unsigned timeout); 245 unsigned long timeout);
211 246
212static inline void inet_csk_reqsk_queue_removed(struct sock *sk, 247static inline void inet_csk_reqsk_queue_removed(struct sock *sk,
213 struct request_sock *req) 248 struct request_sock *req)
@@ -273,4 +308,6 @@ static inline unsigned int inet_csk_listen_poll(const struct sock *sk)
273extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries); 308extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries);
274extern void inet_csk_listen_stop(struct sock *sk); 309extern void inet_csk_listen_stop(struct sock *sk);
275 310
311extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
312
276#endif /* _INET_CONNECTION_SOCK_H */ 313#endif /* _INET_CONNECTION_SOCK_H */
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index b0c47e2eccf1..d599c6bfbb86 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/ip.h> 4#include <linux/ip.h>
5#include <linux/skbuff.h> 5#include <linux/skbuff.h>
6
7#include <net/inet_sock.h>
6#include <net/dsfield.h> 8#include <net/dsfield.h>
7 9
8enum { 10enum {
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 07840baa9341..135d80fd658e 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -26,6 +26,7 @@
26#include <linux/wait.h> 26#include <linux/wait.h>
27 27
28#include <net/inet_connection_sock.h> 28#include <net/inet_connection_sock.h>
29#include <net/inet_sock.h>
29#include <net/route.h> 30#include <net/route.h>
30#include <net/sock.h> 31#include <net/sock.h>
31#include <net/tcp_states.h> 32#include <net/tcp_states.h>
@@ -128,26 +129,6 @@ struct inet_hashinfo {
128 kmem_cache_t *bind_bucket_cachep; 129 kmem_cache_t *bind_bucket_cachep;
129}; 130};
130 131
131static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
132 const __u32 faddr, const __u16 fport)
133{
134 unsigned int h = (laddr ^ lport) ^ (faddr ^ fport);
135 h ^= h >> 16;
136 h ^= h >> 8;
137 return h;
138}
139
140static inline int inet_sk_ehashfn(const struct sock *sk)
141{
142 const struct inet_sock *inet = inet_sk(sk);
143 const __u32 laddr = inet->rcv_saddr;
144 const __u16 lport = inet->num;
145 const __u32 faddr = inet->daddr;
146 const __u16 fport = inet->dport;
147
148 return inet_ehashfn(laddr, lport, faddr, fport);
149}
150
151static inline struct inet_ehash_bucket *inet_ehash_bucket( 132static inline struct inet_ehash_bucket *inet_ehash_bucket(
152 struct inet_hashinfo *hashinfo, 133 struct inet_hashinfo *hashinfo,
153 unsigned int hash) 134 unsigned int hash)
@@ -434,4 +415,7 @@ static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo,
434 415
435 return sk; 416 return sk;
436} 417}
418
419extern int inet_hash_connect(struct inet_timewait_death_row *death_row,
420 struct sock *sk);
437#endif /* _INET_HASHTABLES_H */ 421#endif /* _INET_HASHTABLES_H */
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
new file mode 100644
index 000000000000..883eb529ef8e
--- /dev/null
+++ b/include/net/inet_sock.h
@@ -0,0 +1,193 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for inet_sock
7 *
8 * Authors: Many, reorganised here by
9 * Arnaldo Carvalho de Melo <acme@mandriva.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16#ifndef _INET_SOCK_H
17#define _INET_SOCK_H
18
19#include <linux/config.h>
20
21#include <linux/string.h>
22#include <linux/types.h>
23
24#include <net/flow.h>
25#include <net/sock.h>
26#include <net/request_sock.h>
27
28/** struct ip_options - IP Options
29 *
30 * @faddr - Saved first hop address
31 * @is_setbyuser - Set by setsockopt?
32 * @is_data - Options in __data, rather than skb
33 * @is_strictroute - Strict source route
34 * @srr_is_hit - Packet destination addr was our one
35 * @is_changed - IP checksum more not valid
36 * @rr_needaddr - Need to record addr of outgoing dev
37 * @ts_needtime - Need to record timestamp
38 * @ts_needaddr - Need to record addr of outgoing dev
39 */
40struct ip_options {
41 __u32 faddr;
42 unsigned char optlen;
43 unsigned char srr;
44 unsigned char rr;
45 unsigned char ts;
46 unsigned char is_setbyuser:1,
47 is_data:1,
48 is_strictroute:1,
49 srr_is_hit:1,
50 is_changed:1,
51 rr_needaddr:1,
52 ts_needtime:1,
53 ts_needaddr:1;
54 unsigned char router_alert;
55 unsigned char __pad1;
56 unsigned char __pad2;
57 unsigned char __data[0];
58};
59
60#define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
61
62struct inet_request_sock {
63 struct request_sock req;
64#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
65 u16 inet6_rsk_offset;
66 /* 2 bytes hole, try to pack */
67#endif
68 u32 loc_addr;
69 u32 rmt_addr;
70 u16 rmt_port;
71 u16 snd_wscale : 4,
72 rcv_wscale : 4,
73 tstamp_ok : 1,
74 sack_ok : 1,
75 wscale_ok : 1,
76 ecn_ok : 1,
77 acked : 1;
78 struct ip_options *opt;
79};
80
81static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
82{
83 return (struct inet_request_sock *)sk;
84}
85
86struct ip_mc_socklist;
87struct ipv6_pinfo;
88struct rtable;
89
90/** struct inet_sock - representation of INET sockets
91 *
92 * @sk - ancestor class
93 * @pinet6 - pointer to IPv6 control block
94 * @daddr - Foreign IPv4 addr
95 * @rcv_saddr - Bound local IPv4 addr
96 * @dport - Destination port
97 * @num - Local port
98 * @saddr - Sending source
99 * @uc_ttl - Unicast TTL
100 * @sport - Source port
101 * @id - ID counter for DF pkts
102 * @tos - TOS
103 * @mc_ttl - Multicasting TTL
104 * @is_icsk - is this an inet_connection_sock?
105 * @mc_index - Multicast device index
106 * @mc_list - Group array
107 * @cork - info to build ip hdr on each ip frag while socket is corked
108 */
109struct inet_sock {
110 /* sk and pinet6 has to be the first two members of inet_sock */
111 struct sock sk;
112#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
113 struct ipv6_pinfo *pinet6;
114#endif
115 /* Socket demultiplex comparisons on incoming packets. */
116 __u32 daddr;
117 __u32 rcv_saddr;
118 __u16 dport;
119 __u16 num;
120 __u32 saddr;
121 __s16 uc_ttl;
122 __u16 cmsg_flags;
123 struct ip_options *opt;
124 __u16 sport;
125 __u16 id;
126 __u8 tos;
127 __u8 mc_ttl;
128 __u8 pmtudisc;
129 __u8 recverr:1,
130 is_icsk:1,
131 freebind:1,
132 hdrincl:1,
133 mc_loop:1;
134 int mc_index;
135 __u32 mc_addr;
136 struct ip_mc_socklist *mc_list;
137 struct {
138 unsigned int flags;
139 unsigned int fragsize;
140 struct ip_options *opt;
141 struct rtable *rt;
142 int length; /* Total length of all frames */
143 u32 addr;
144 struct flowi fl;
145 } cork;
146};
147
148#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */
149#define IPCORK_ALLFRAG 2 /* always fragment (for ipv6 for now) */
150
151static inline struct inet_sock *inet_sk(const struct sock *sk)
152{
153 return (struct inet_sock *)sk;
154}
155
156static inline void __inet_sk_copy_descendant(struct sock *sk_to,
157 const struct sock *sk_from,
158 const int ancestor_size)
159{
160 memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1,
161 sk_from->sk_prot->obj_size - ancestor_size);
162}
163#if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE))
164static inline void inet_sk_copy_descendant(struct sock *sk_to,
165 const struct sock *sk_from)
166{
167 __inet_sk_copy_descendant(sk_to, sk_from, sizeof(struct inet_sock));
168}
169#endif
170
171extern int inet_sk_rebuild_header(struct sock *sk);
172
173static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
174 const __u32 faddr, const __u16 fport)
175{
176 unsigned int h = (laddr ^ lport) ^ (faddr ^ fport);
177 h ^= h >> 16;
178 h ^= h >> 8;
179 return h;
180}
181
182static inline int inet_sk_ehashfn(const struct sock *sk)
183{
184 const struct inet_sock *inet = inet_sk(sk);
185 const __u32 laddr = inet->rcv_saddr;
186 const __u16 lport = inet->num;
187 const __u32 faddr = inet->daddr;
188 const __u16 fport = inet->dport;
189
190 return inet_ehashfn(laddr, lport, faddr, fport);
191}
192
193#endif /* _INET_SOCK_H */
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 28f7b2103505..1da294c47522 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -17,15 +17,16 @@
17 17
18#include <linux/config.h> 18#include <linux/config.h>
19 19
20#include <linux/ip.h>
21#include <linux/list.h> 20#include <linux/list.h>
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/timer.h> 22#include <linux/timer.h>
24#include <linux/types.h> 23#include <linux/types.h>
25#include <linux/workqueue.h> 24#include <linux/workqueue.h>
26 25
26#include <net/inet_sock.h>
27#include <net/sock.h> 27#include <net/sock.h>
28#include <net/tcp_states.h> 28#include <net/tcp_states.h>
29#include <net/timewait_sock.h>
29 30
30#include <asm/atomic.h> 31#include <asm/atomic.h>
31 32
@@ -127,7 +128,8 @@ struct inet_timewait_sock {
127 __u16 tw_num; 128 __u16 tw_num;
128 /* And these are ours. */ 129 /* And these are ours. */
129 __u8 tw_ipv6only:1; 130 __u8 tw_ipv6only:1;
130 /* 31 bits hole, try to pack */ 131 /* 15 bits hole, try to pack */
132 __u16 tw_ipv6_offset;
131 int tw_timeout; 133 int tw_timeout;
132 unsigned long tw_ttd; 134 unsigned long tw_ttd;
133 struct inet_bind_bucket *tw_tb; 135 struct inet_bind_bucket *tw_tb;
@@ -199,7 +201,7 @@ static inline void inet_twsk_put(struct inet_timewait_sock *tw)
199 printk(KERN_DEBUG "%s timewait_sock %p released\n", 201 printk(KERN_DEBUG "%s timewait_sock %p released\n",
200 tw->tw_prot->name, tw); 202 tw->tw_prot->name, tw);
201#endif 203#endif
202 kmem_cache_free(tw->tw_prot->twsk_slab, tw); 204 kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw);
203 module_put(owner); 205 module_put(owner);
204 } 206 }
205} 207}
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 7fda471002b6..0965515f40cf 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -25,6 +25,7 @@ struct inet_peer
25 __u32 v4daddr; /* peer's address */ 25 __u32 v4daddr; /* peer's address */
26 __u16 avl_height; 26 __u16 avl_height;
27 __u16 ip_id_count; /* IP ID for the next packet */ 27 __u16 ip_id_count; /* IP ID for the next packet */
28 atomic_t rid; /* Frag reception counter */
28 __u32 tcp_ts; 29 __u32 tcp_ts;
29 unsigned long tcp_ts_stamp; 30 unsigned long tcp_ts_stamp;
30}; 31};
diff --git a/include/net/ip.h b/include/net/ip.h
index e4563bbee6ea..7bb5804847f2 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -24,14 +24,10 @@
24 24
25#include <linux/config.h> 25#include <linux/config.h>
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/socket.h>
28#include <linux/ip.h> 27#include <linux/ip.h>
29#include <linux/in.h> 28#include <linux/in.h>
30#include <linux/netdevice.h> 29
31#include <linux/inetdevice.h> 30#include <net/inet_sock.h>
32#include <linux/in_route.h>
33#include <net/route.h>
34#include <net/arp.h>
35#include <net/snmp.h> 31#include <net/snmp.h>
36 32
37struct sock; 33struct sock;
@@ -45,6 +41,7 @@ struct inet_skb_parm
45#define IPSKB_TRANSLATED 2 41#define IPSKB_TRANSLATED 2
46#define IPSKB_FORWARDED 4 42#define IPSKB_FORWARDED 4
47#define IPSKB_XFRM_TUNNEL_SIZE 8 43#define IPSKB_XFRM_TUNNEL_SIZE 8
44#define IPSKB_FRAG_COMPLETE 16
48}; 45};
49 46
50struct ipcm_cookie 47struct ipcm_cookie
@@ -74,6 +71,13 @@ extern rwlock_t ip_ra_lock;
74 71
75#define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */ 72#define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */
76 73
74struct msghdr;
75struct net_device;
76struct packet_type;
77struct rtable;
78struct sk_buff;
79struct sockaddr;
80
77extern void ip_mc_dropsocket(struct sock *); 81extern void ip_mc_dropsocket(struct sock *);
78extern void ip_mc_dropdevice(struct net_device *dev); 82extern void ip_mc_dropdevice(struct net_device *dev);
79extern int igmp_mc_proc_init(void); 83extern int igmp_mc_proc_init(void);
@@ -168,6 +172,7 @@ extern int sysctl_ipfrag_high_thresh;
168extern int sysctl_ipfrag_low_thresh; 172extern int sysctl_ipfrag_low_thresh;
169extern int sysctl_ipfrag_time; 173extern int sysctl_ipfrag_time;
170extern int sysctl_ipfrag_secret_interval; 174extern int sysctl_ipfrag_secret_interval;
175extern int sysctl_ipfrag_max_dist;
171 176
172/* From inetpeer.c */ 177/* From inetpeer.c */
173extern int inet_peer_threshold; 178extern int inet_peer_threshold;
@@ -182,6 +187,8 @@ extern int sysctl_ip_dynaddr;
182extern void ipfrag_init(void); 187extern void ipfrag_init(void);
183 188
184#ifdef CONFIG_INET 189#ifdef CONFIG_INET
190#include <net/dst.h>
191
185/* The function in 2.2 was invalid, producing wrong result for 192/* The function in 2.2 was invalid, producing wrong result for
186 * check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */ 193 * check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */
187static inline 194static inline
@@ -310,7 +317,6 @@ enum ip_defrag_users
310 IP_DEFRAG_CALL_RA_CHAIN, 317 IP_DEFRAG_CALL_RA_CHAIN,
311 IP_DEFRAG_CONNTRACK_IN, 318 IP_DEFRAG_CONNTRACK_IN,
312 IP_DEFRAG_CONNTRACK_OUT, 319 IP_DEFRAG_CONNTRACK_OUT,
313 IP_DEFRAG_NAT_OUT,
314 IP_DEFRAG_VS_IN, 320 IP_DEFRAG_VS_IN,
315 IP_DEFRAG_VS_OUT, 321 IP_DEFRAG_VS_OUT,
316 IP_DEFRAG_VS_FWD 322 IP_DEFRAG_VS_FWD
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 14de4ebd1211..e000fa2cd5f6 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -238,6 +238,8 @@ extern int fib_validate_source(u32 src, u32 dst, u8 tos, int oif,
238 struct net_device *dev, u32 *spec_dst, u32 *itag); 238 struct net_device *dev, u32 *spec_dst, u32 *itag);
239extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); 239extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
240 240
241struct rtentry;
242
241/* Exported by fib_semantics.c */ 243/* Exported by fib_semantics.c */
242extern int ip_fib_check_default(u32 gw, struct net_device *dev); 244extern int ip_fib_check_default(u32 gw, struct net_device *dev);
243extern int fib_sync_down(u32 local, struct net_device *dev, int force); 245extern int fib_sync_down(u32 local, struct net_device *dev, int force);
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 3b5559a023a4..7d2674fde19a 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -251,16 +251,15 @@ struct ip_vs_daemon_user {
251#include <linux/config.h> 251#include <linux/config.h>
252#include <linux/list.h> /* for struct list_head */ 252#include <linux/list.h> /* for struct list_head */
253#include <linux/spinlock.h> /* for struct rwlock_t */ 253#include <linux/spinlock.h> /* for struct rwlock_t */
254#include <linux/skbuff.h> /* for struct sk_buff */
255#include <linux/ip.h> /* for struct iphdr */
256#include <asm/atomic.h> /* for struct atomic_t */ 254#include <asm/atomic.h> /* for struct atomic_t */
257#include <linux/netdevice.h> /* for struct neighbour */
258#include <net/dst.h> /* for struct dst_entry */
259#include <net/udp.h>
260#include <linux/compiler.h> 255#include <linux/compiler.h>
256#include <linux/timer.h>
261 257
258#include <net/checksum.h>
262 259
263#ifdef CONFIG_IP_VS_DEBUG 260#ifdef CONFIG_IP_VS_DEBUG
261#include <linux/net.h>
262
264extern int ip_vs_get_debug_level(void); 263extern int ip_vs_get_debug_level(void);
265#define IP_VS_DBG(level, msg...) \ 264#define IP_VS_DBG(level, msg...) \
266 do { \ 265 do { \
@@ -429,8 +428,11 @@ struct ip_vs_stats
429 spinlock_t lock; /* spin lock */ 428 spinlock_t lock; /* spin lock */
430}; 429};
431 430
431struct dst_entry;
432struct iphdr;
432struct ip_vs_conn; 433struct ip_vs_conn;
433struct ip_vs_app; 434struct ip_vs_app;
435struct sk_buff;
434 436
435struct ip_vs_protocol { 437struct ip_vs_protocol {
436 struct ip_vs_protocol *next; 438 struct ip_vs_protocol *next;
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 0a2ad51cff82..860bbac4c4ee 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -240,6 +240,8 @@ extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_t
240struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, 240struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
241 struct ipv6_txoptions *opt); 241 struct ipv6_txoptions *opt);
242 242
243extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb);
244
243extern int ip6_frag_nqueues; 245extern int ip6_frag_nqueues;
244extern atomic_t ip6_frag_mem; 246extern atomic_t ip6_frag_mem;
245 247
@@ -525,6 +527,9 @@ extern int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
525extern int inet6_ioctl(struct socket *sock, unsigned int cmd, 527extern int inet6_ioctl(struct socket *sock, unsigned int cmd,
526 unsigned long arg); 528 unsigned long arg);
527 529
530extern int inet6_hash_connect(struct inet_timewait_death_row *death_row,
531 struct sock *sk);
532
528/* 533/*
529 * reassembly.c 534 * reassembly.c
530 */ 535 */
@@ -533,8 +538,11 @@ extern int sysctl_ip6frag_low_thresh;
533extern int sysctl_ip6frag_time; 538extern int sysctl_ip6frag_time;
534extern int sysctl_ip6frag_secret_interval; 539extern int sysctl_ip6frag_secret_interval;
535 540
536extern struct proto_ops inet6_stream_ops; 541extern const struct proto_ops inet6_stream_ops;
537extern struct proto_ops inet6_dgram_ops; 542extern const struct proto_ops inet6_dgram_ops;
543
544struct group_source_req;
545struct group_filter;
538 546
539extern int ip6_mc_source(int add, int omode, struct sock *sk, 547extern int ip6_mc_source(int add, int omode, struct sock *sk,
540 struct group_source_req *pgsr); 548 struct group_source_req *pgsr);
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index f85d6e4b7442..bbac87eeb422 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -35,11 +35,20 @@ enum {
35 35
36#ifdef __KERNEL__ 36#ifdef __KERNEL__
37 37
38#include <linux/skbuff.h> 38#include <linux/config.h>
39#include <linux/netdevice.h> 39#include <linux/compiler.h>
40#include <linux/icmpv6.h> 40#include <linux/icmpv6.h>
41#include <linux/in6.h>
42#include <linux/types.h>
43
41#include <net/neighbour.h> 44#include <net/neighbour.h>
42#include <asm/atomic.h> 45
46struct ctl_table;
47struct file;
48struct inet6_dev;
49struct net_device;
50struct net_proto_family;
51struct sk_buff;
43 52
44extern struct neigh_table nd_tbl; 53extern struct neigh_table nd_tbl;
45 54
@@ -108,7 +117,7 @@ extern int igmp6_event_report(struct sk_buff *skb);
108extern void igmp6_cleanup(void); 117extern void igmp6_cleanup(void);
109 118
110#ifdef CONFIG_SYSCTL 119#ifdef CONFIG_SYSCTL
111extern int ndisc_ifinfo_sysctl_change(ctl_table *ctl, 120extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
112 int write, 121 int write,
113 struct file * filp, 122 struct file * filp,
114 void __user *buffer, 123 void __user *buffer,
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 34c07731933d..6fa9ae190741 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -49,8 +49,8 @@
49#ifdef __KERNEL__ 49#ifdef __KERNEL__
50 50
51#include <asm/atomic.h> 51#include <asm/atomic.h>
52#include <linux/skbuff.h>
53#include <linux/netdevice.h> 52#include <linux/netdevice.h>
53#include <linux/skbuff.h>
54#include <linux/rcupdate.h> 54#include <linux/rcupdate.h>
55#include <linux/seq_file.h> 55#include <linux/seq_file.h>
56 56
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index cc4825610795..64b82b74a650 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -94,6 +94,9 @@ struct nf_conn
94 /* Current number of expected connections */ 94 /* Current number of expected connections */
95 unsigned int expecting; 95 unsigned int expecting;
96 96
97 /* Unique ID that identifies this conntrack*/
98 unsigned int id;
99
97 /* Helper. if any */ 100 /* Helper. if any */
98 struct nf_conntrack_helper *helper; 101 struct nf_conntrack_helper *helper;
99 102
@@ -140,6 +143,9 @@ struct nf_conntrack_expect
140 /* Usage count. */ 143 /* Usage count. */
141 atomic_t use; 144 atomic_t use;
142 145
146 /* Unique ID */
147 unsigned int id;
148
143 /* Flags */ 149 /* Flags */
144 unsigned int flags; 150 unsigned int flags;
145 151
@@ -190,6 +196,31 @@ static inline void nf_ct_put(struct nf_conn *ct)
190 nf_conntrack_put(&ct->ct_general); 196 nf_conntrack_put(&ct->ct_general);
191} 197}
192 198
199extern struct nf_conntrack_tuple_hash *
200__nf_conntrack_find(const struct nf_conntrack_tuple *tuple,
201 const struct nf_conn *ignored_conntrack);
202
203extern void nf_conntrack_hash_insert(struct nf_conn *ct);
204
205extern struct nf_conntrack_expect *
206__nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
207
208extern struct nf_conntrack_expect *
209nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
210
211extern void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
212
213extern void nf_ct_remove_expectations(struct nf_conn *ct);
214
215extern void nf_conntrack_flush(void);
216
217extern struct nf_conntrack_helper *
218nf_ct_helper_find_get( const struct nf_conntrack_tuple *tuple);
219extern void nf_ct_helper_put(struct nf_conntrack_helper *helper);
220
221extern struct nf_conntrack_helper *
222__nf_conntrack_helper_find_byname(const char *name);
223
193/* call to create an explicit dependency on nf_conntrack. */ 224/* call to create an explicit dependency on nf_conntrack. */
194extern void need_nf_conntrack(void); 225extern void need_nf_conntrack(void);
195 226
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 5a66b2a3a623..86ec8174ad02 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -33,6 +33,8 @@ struct nf_conntrack_helper
33 unsigned int protoff, 33 unsigned int protoff,
34 struct nf_conn *ct, 34 struct nf_conn *ct,
35 enum ip_conntrack_info conntrackinfo); 35 enum ip_conntrack_info conntrackinfo);
36
37 int (*to_nfattr)(struct sk_buff *skb, const struct nf_conn *ct);
36}; 38};
37 39
38extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 40extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 01663e5b33df..67856eb93b43 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -14,6 +14,8 @@
14#include <linux/seq_file.h> 14#include <linux/seq_file.h>
15#include <net/netfilter/nf_conntrack.h> 15#include <net/netfilter/nf_conntrack.h>
16 16
17struct nfattr;
18
17struct nf_conntrack_l3proto 19struct nf_conntrack_l3proto
18{ 20{
19 /* Next pointer. */ 21 /* Next pointer. */
@@ -70,6 +72,12 @@ struct nf_conntrack_l3proto
70 72
71 u_int32_t (*get_features)(const struct nf_conntrack_tuple *tuple); 73 u_int32_t (*get_features)(const struct nf_conntrack_tuple *tuple);
72 74
75 int (*tuple_to_nfattr)(struct sk_buff *skb,
76 const struct nf_conntrack_tuple *t);
77
78 int (*nfattr_to_tuple)(struct nfattr *tb[],
79 struct nf_conntrack_tuple *t);
80
73 /* Module (if any) which this is connected to. */ 81 /* Module (if any) which this is connected to. */
74 struct module *me; 82 struct module *me;
75}; 83};
@@ -81,11 +89,16 @@ extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto);
81extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); 89extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto);
82 90
83static inline struct nf_conntrack_l3proto * 91static inline struct nf_conntrack_l3proto *
84nf_ct_find_l3proto(u_int16_t l3proto) 92__nf_ct_l3proto_find(u_int16_t l3proto)
85{ 93{
86 return nf_ct_l3protos[l3proto]; 94 return nf_ct_l3protos[l3proto];
87} 95}
88 96
97extern struct nf_conntrack_l3proto *
98nf_ct_l3proto_find_get(u_int16_t l3proto);
99
100extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
101
89/* Existing built-in protocols */ 102/* Existing built-in protocols */
90extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4; 103extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4;
91extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6; 104extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6;
diff --git a/include/net/netfilter/nf_conntrack_protocol.h b/include/net/netfilter/nf_conntrack_protocol.h
index b3afda35397a..1f33737fcea5 100644
--- a/include/net/netfilter/nf_conntrack_protocol.h
+++ b/include/net/netfilter/nf_conntrack_protocol.h
@@ -12,6 +12,7 @@
12#include <net/netfilter/nf_conntrack.h> 12#include <net/netfilter/nf_conntrack.h>
13 13
14struct seq_file; 14struct seq_file;
15struct nfattr;
15 16
16struct nf_conntrack_protocol 17struct nf_conntrack_protocol
17{ 18{
@@ -66,6 +67,18 @@ struct nf_conntrack_protocol
66 enum ip_conntrack_info *ctinfo, 67 enum ip_conntrack_info *ctinfo,
67 int pf, unsigned int hooknum); 68 int pf, unsigned int hooknum);
68 69
70 /* convert protoinfo to nfnetink attributes */
71 int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa,
72 const struct nf_conn *ct);
73
74 /* convert nfnetlink attributes to protoinfo */
75 int (*from_nfattr)(struct nfattr *tb[], struct nf_conn *ct);
76
77 int (*tuple_to_nfattr)(struct sk_buff *skb,
78 const struct nf_conntrack_tuple *t);
79 int (*nfattr_to_tuple)(struct nfattr *tb[],
80 struct nf_conntrack_tuple *t);
81
69 /* Module (if any) which this is connected to. */ 82 /* Module (if any) which this is connected to. */
70 struct module *me; 83 struct module *me;
71}; 84};
@@ -80,12 +93,23 @@ extern struct nf_conntrack_protocol nf_conntrack_generic_protocol;
80extern struct nf_conntrack_protocol **nf_ct_protos[PF_MAX]; 93extern struct nf_conntrack_protocol **nf_ct_protos[PF_MAX];
81 94
82extern struct nf_conntrack_protocol * 95extern struct nf_conntrack_protocol *
83nf_ct_find_proto(u_int16_t l3proto, u_int8_t protocol); 96__nf_ct_proto_find(u_int16_t l3proto, u_int8_t protocol);
97
98extern struct nf_conntrack_protocol *
99nf_ct_proto_find_get(u_int16_t l3proto, u_int8_t protocol);
100
101extern void nf_ct_proto_put(struct nf_conntrack_protocol *p);
84 102
85/* Protocol registration. */ 103/* Protocol registration. */
86extern int nf_conntrack_protocol_register(struct nf_conntrack_protocol *proto); 104extern int nf_conntrack_protocol_register(struct nf_conntrack_protocol *proto);
87extern void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol *proto); 105extern void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol *proto);
88 106
107/* Generic netlink helpers */
108extern int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb,
109 const struct nf_conntrack_tuple *tuple);
110extern int nf_ct_port_nfattr_to_tuple(struct nfattr *tb[],
111 struct nf_conntrack_tuple *t);
112
89/* Log invalid packets */ 113/* Log invalid packets */
90extern unsigned int nf_ct_log_invalid; 114extern unsigned int nf_ct_log_invalid;
91 115
diff --git a/include/net/pkt_act.h b/include/net/pkt_act.h
index bd08964b72c0..b225d8472b7e 100644
--- a/include/net/pkt_act.h
+++ b/include/net/pkt_act.h
@@ -15,7 +15,6 @@
15#include <linux/in.h> 15#include <linux/in.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/netdevice.h>
19#include <linux/skbuff.h> 18#include <linux/skbuff.h>
20#include <linux/rtnetlink.h> 19#include <linux/rtnetlink.h>
21#include <linux/module.h> 20#include <linux/module.h>
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 357691f6a45f..63f7db99c2a6 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -65,7 +65,7 @@ struct inet_protosw {
65 int protocol; /* This is the L4 protocol number. */ 65 int protocol; /* This is the L4 protocol number. */
66 66
67 struct proto *prot; 67 struct proto *prot;
68 struct proto_ops *ops; 68 const struct proto_ops *ops;
69 69
70 int capability; /* Which (if any) capability do 70 int capability; /* Which (if any) capability do
71 * we need to use this socket 71 * we need to use this socket
@@ -76,6 +76,7 @@ struct inet_protosw {
76}; 76};
77#define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */ 77#define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */
78#define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */ 78#define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */
79#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */
79 80
80extern struct net_protocol *inet_protocol_base; 81extern struct net_protocol *inet_protocol_base;
81extern struct net_protocol *inet_protos[MAX_INET_PROTOS]; 82extern struct net_protocol *inet_protos[MAX_INET_PROTOS];
diff --git a/include/net/raw.h b/include/net/raw.h
index f47917469b12..e67b28a0248c 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -19,6 +19,8 @@
19 19
20#include <linux/config.h> 20#include <linux/config.h>
21 21
22#include <net/protocol.h>
23
22extern struct proto raw_prot; 24extern struct proto raw_prot;
23 25
24extern void raw_err(struct sock *, struct sk_buff *, u32 info); 26extern void raw_err(struct sock *, struct sk_buff *, u32 info);
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index b52cc52ffe39..11641c9384f7 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -244,7 +244,7 @@ static inline int reqsk_queue_is_full(const struct request_sock_queue *queue)
244 244
245static inline void reqsk_queue_hash_req(struct request_sock_queue *queue, 245static inline void reqsk_queue_hash_req(struct request_sock_queue *queue,
246 u32 hash, struct request_sock *req, 246 u32 hash, struct request_sock *req,
247 unsigned timeout) 247 unsigned long timeout)
248{ 248{
249 struct listen_sock *lopt = queue->listen_opt; 249 struct listen_sock *lopt = queue->listen_opt;
250 250
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 8e7794ee27ff..f5c22d77feab 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -277,6 +277,24 @@ struct sctp_sock {
277 __u32 default_context; 277 __u32 default_context;
278 __u32 default_timetolive; 278 __u32 default_timetolive;
279 279
280 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
281 * the destination address every heartbeat interval. This value
282 * will be inherited by all new associations.
283 */
284 __u32 hbinterval;
285
286 /* This is the max_retrans value for new associations. */
287 __u16 pathmaxrxt;
288
289 /* The initial Path MTU to use for new associations. */
290 __u32 pathmtu;
291
292 /* The default SACK delay timeout for new associations. */
293 __u32 sackdelay;
294
295 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
296 __u32 param_flags;
297
280 struct sctp_initmsg initmsg; 298 struct sctp_initmsg initmsg;
281 struct sctp_rtoinfo rtoinfo; 299 struct sctp_rtoinfo rtoinfo;
282 struct sctp_paddrparams paddrparam; 300 struct sctp_paddrparams paddrparam;
@@ -845,9 +863,6 @@ struct sctp_transport {
845 /* Data that has been sent, but not acknowledged. */ 863 /* Data that has been sent, but not acknowledged. */
846 __u32 flight_size; 864 __u32 flight_size;
847 865
848 /* PMTU : The current known path MTU. */
849 __u32 pmtu;
850
851 /* Destination */ 866 /* Destination */
852 struct dst_entry *dst; 867 struct dst_entry *dst;
853 /* Source address. */ 868 /* Source address. */
@@ -862,7 +877,22 @@ struct sctp_transport {
862 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to 877 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
863 * the destination address every heartbeat interval. 878 * the destination address every heartbeat interval.
864 */ 879 */
865 int hb_interval; 880 __u32 hbinterval;
881
882 /* This is the max_retrans value for the transport and will
883 * be initialized from the assocs value. This can be changed
884 * using SCTP_SET_PEER_ADDR_PARAMS socket option.
885 */
886 __u16 pathmaxrxt;
887
888 /* PMTU : The current known path MTU. */
889 __u32 pathmtu;
890
891 /* SACK delay timeout */
892 __u32 sackdelay;
893
894 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
895 __u32 param_flags;
866 896
867 /* When was the last time (in jiffies) that we heard from this 897 /* When was the last time (in jiffies) that we heard from this
868 * transport? We use this to pick new active and retran paths. 898 * transport? We use this to pick new active and retran paths.
@@ -882,22 +912,11 @@ struct sctp_transport {
882 */ 912 */
883 int state; 913 int state;
884 914
885 /* hb_allowed : The current heartbeat state of this destination,
886 * : i.e. ALLOW-HB, NO-HEARTBEAT, etc.
887 */
888 int hb_allowed;
889
890 /* These are the error stats for this destination. */ 915 /* These are the error stats for this destination. */
891 916
892 /* Error count : The current error count for this destination. */ 917 /* Error count : The current error count for this destination. */
893 unsigned short error_count; 918 unsigned short error_count;
894 919
895 /* This is the max_retrans value for the transport and will
896 * be initialized to proto.max_retrans.path. This can be changed
897 * using SCTP_SET_PEER_ADDR_PARAMS socket option.
898 */
899 int max_retrans;
900
901 /* Per : A timer used by each destination. 920 /* Per : A timer used by each destination.
902 * Destination : 921 * Destination :
903 * Timer : 922 * Timer :
@@ -1502,6 +1521,28 @@ struct sctp_association {
1502 /* The largest timeout or RTO value to use in attempting an INIT */ 1521 /* The largest timeout or RTO value to use in attempting an INIT */
1503 __u16 max_init_timeo; 1522 __u16 max_init_timeo;
1504 1523
1524 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
1525 * the destination address every heartbeat interval. This value
1526 * will be inherited by all new transports.
1527 */
1528 __u32 hbinterval;
1529
1530 /* This is the max_retrans value for new transports in the
1531 * association.
1532 */
1533 __u16 pathmaxrxt;
1534
1535 /* Association : The smallest PMTU discovered for all of the
1536 * PMTU : peer's transport addresses.
1537 */
1538 __u32 pathmtu;
1539
1540 /* SACK delay timeout */
1541 __u32 sackdelay;
1542
1543 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
1544 __u32 param_flags;
1545
1505 int timeouts[SCTP_NUM_TIMEOUT_TYPES]; 1546 int timeouts[SCTP_NUM_TIMEOUT_TYPES];
1506 struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES]; 1547 struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES];
1507 1548
@@ -1571,11 +1612,6 @@ struct sctp_association {
1571 */ 1612 */
1572 wait_queue_head_t wait; 1613 wait_queue_head_t wait;
1573 1614
1574 /* Association : The smallest PMTU discovered for all of the
1575 * PMTU : peer's transport addresses.
1576 */
1577 __u32 pmtu;
1578
1579 /* The message size at which SCTP fragmentation will occur. */ 1615 /* The message size at which SCTP fragmentation will occur. */
1580 __u32 frag_point; 1616 __u32 frag_point;
1581 1617
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index f1c3bc54526a..8a6bef6f91eb 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -93,6 +93,8 @@ enum sctp_optname {
93#define SCTP_STATUS SCTP_STATUS 93#define SCTP_STATUS SCTP_STATUS
94 SCTP_GET_PEER_ADDR_INFO, 94 SCTP_GET_PEER_ADDR_INFO,
95#define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO 95#define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO
96 SCTP_DELAYED_ACK_TIME,
97#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME
96 98
97 /* Internal Socket Options. Some of the sctp library functions are 99 /* Internal Socket Options. Some of the sctp library functions are
98 * implemented using these socket options. 100 * implemented using these socket options.
@@ -503,13 +505,41 @@ struct sctp_setadaption {
503 * unreachable. The following structure is used to access and modify an 505 * unreachable. The following structure is used to access and modify an
504 * address's parameters: 506 * address's parameters:
505 */ 507 */
508enum sctp_spp_flags {
509 SPP_HB_ENABLE = 1, /*Enable heartbeats*/
510 SPP_HB_DISABLE = 2, /*Disable heartbeats*/
511 SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
512 SPP_HB_DEMAND = 4, /*Send heartbeat immediately*/
513 SPP_PMTUD_ENABLE = 8, /*Enable PMTU discovery*/
514 SPP_PMTUD_DISABLE = 16, /*Disable PMTU discovery*/
515 SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
516 SPP_SACKDELAY_ENABLE = 32, /*Enable SACK*/
517 SPP_SACKDELAY_DISABLE = 64, /*Disable SACK*/
518 SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
519};
520
506struct sctp_paddrparams { 521struct sctp_paddrparams {
507 sctp_assoc_t spp_assoc_id; 522 sctp_assoc_t spp_assoc_id;
508 struct sockaddr_storage spp_address; 523 struct sockaddr_storage spp_address;
509 __u32 spp_hbinterval; 524 __u32 spp_hbinterval;
510 __u16 spp_pathmaxrxt; 525 __u16 spp_pathmaxrxt;
526 __u32 spp_pathmtu;
527 __u32 spp_sackdelay;
528 __u32 spp_flags;
511} __attribute__((packed, aligned(4))); 529} __attribute__((packed, aligned(4)));
512 530
531/* 7.1.24. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME)
532 *
533 * This options will get or set the delayed ack timer. The time is set
534 * in milliseconds. If the assoc_id is 0, then this sets or gets the
535 * endpoints default delayed ack timer value. If the assoc_id field is
536 * non-zero, then the set or get effects the specified association.
537 */
538struct sctp_assoc_value {
539 sctp_assoc_t assoc_id;
540 uint32_t assoc_value;
541};
542
513/* 543/*
514 * 7.2.2 Peer Address Information 544 * 7.2.2 Peer Address Information
515 * 545 *
diff --git a/include/net/sock.h b/include/net/sock.h
index 982b4ecd187b..1806e5b61419 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -493,6 +493,7 @@ extern void sk_stream_kill_queues(struct sock *sk);
493extern int sk_wait_data(struct sock *sk, long *timeo); 493extern int sk_wait_data(struct sock *sk, long *timeo);
494 494
495struct request_sock_ops; 495struct request_sock_ops;
496struct timewait_sock_ops;
496 497
497/* Networking protocol blocks we attach to sockets. 498/* Networking protocol blocks we attach to sockets.
498 * socket layer -> transport layer interface 499 * socket layer -> transport layer interface
@@ -557,11 +558,10 @@ struct proto {
557 kmem_cache_t *slab; 558 kmem_cache_t *slab;
558 unsigned int obj_size; 559 unsigned int obj_size;
559 560
560 kmem_cache_t *twsk_slab;
561 unsigned int twsk_obj_size;
562 atomic_t *orphan_count; 561 atomic_t *orphan_count;
563 562
564 struct request_sock_ops *rsk_prot; 563 struct request_sock_ops *rsk_prot;
564 struct timewait_sock_ops *twsk_prot;
565 565
566 struct module *owner; 566 struct module *owner;
567 567
@@ -856,8 +856,8 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb, int needlock)
856 856
857 filter = sk->sk_filter; 857 filter = sk->sk_filter;
858 if (filter) { 858 if (filter) {
859 int pkt_len = sk_run_filter(skb, filter->insns, 859 unsigned int pkt_len = sk_run_filter(skb, filter->insns,
860 filter->len); 860 filter->len);
861 if (!pkt_len) 861 if (!pkt_len)
862 err = -EPERM; 862 err = -EPERM;
863 else 863 else
@@ -926,6 +926,29 @@ static inline void sock_put(struct sock *sk)
926 sk_free(sk); 926 sk_free(sk);
927} 927}
928 928
929static inline int sk_receive_skb(struct sock *sk, struct sk_buff *skb)
930{
931 int rc = NET_RX_SUCCESS;
932
933 if (sk_filter(sk, skb, 0))
934 goto discard_and_relse;
935
936 skb->dev = NULL;
937
938 bh_lock_sock(sk);
939 if (!sock_owned_by_user(sk))
940 rc = sk->sk_backlog_rcv(sk, skb);
941 else
942 sk_add_backlog(sk, skb);
943 bh_unlock_sock(sk);
944out:
945 sock_put(sk);
946 return rc;
947discard_and_relse:
948 kfree_skb(skb);
949 goto out;
950}
951
929/* Detach socket from process context. 952/* Detach socket from process context.
930 * Announce socket dead, detach it from wait queue and inode. 953 * Announce socket dead, detach it from wait queue and inode.
931 * Note that parent inode held reference count on this struct sock, 954 * Note that parent inode held reference count on this struct sock,
@@ -1166,7 +1189,10 @@ static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
1166 1189
1167static inline int sock_error(struct sock *sk) 1190static inline int sock_error(struct sock *sk)
1168{ 1191{
1169 int err = xchg(&sk->sk_err, 0); 1192 int err;
1193 if (likely(!sk->sk_err))
1194 return 0;
1195 err = xchg(&sk->sk_err, 0);
1170 return -err; 1196 return -err;
1171} 1197}
1172 1198
diff --git a/include/net/tcp.h b/include/net/tcp.h
index d78025f9fbea..77f21c65bbca 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -225,53 +225,6 @@ extern atomic_t tcp_sockets_allocated;
225extern int tcp_memory_pressure; 225extern int tcp_memory_pressure;
226 226
227/* 227/*
228 * Pointers to address related TCP functions
229 * (i.e. things that depend on the address family)
230 */
231
232struct tcp_func {
233 int (*queue_xmit) (struct sk_buff *skb,
234 int ipfragok);
235
236 void (*send_check) (struct sock *sk,
237 struct tcphdr *th,
238 int len,
239 struct sk_buff *skb);
240
241 int (*rebuild_header) (struct sock *sk);
242
243 int (*conn_request) (struct sock *sk,
244 struct sk_buff *skb);
245
246 struct sock * (*syn_recv_sock) (struct sock *sk,
247 struct sk_buff *skb,
248 struct request_sock *req,
249 struct dst_entry *dst);
250
251 int (*remember_stamp) (struct sock *sk);
252
253 __u16 net_header_len;
254
255 int (*setsockopt) (struct sock *sk,
256 int level,
257 int optname,
258 char __user *optval,
259 int optlen);
260
261 int (*getsockopt) (struct sock *sk,
262 int level,
263 int optname,
264 char __user *optval,
265 int __user *optlen);
266
267
268 void (*addr2sockaddr) (struct sock *sk,
269 struct sockaddr *);
270
271 int sockaddr_len;
272};
273
274/*
275 * The next routines deal with comparing 32 bit unsigned ints 228 * The next routines deal with comparing 32 bit unsigned ints
276 * and worry about wraparound (automatic with unsigned arithmetic). 229 * and worry about wraparound (automatic with unsigned arithmetic).
277 */ 230 */
@@ -334,6 +287,9 @@ extern int tcp_rcv_established(struct sock *sk,
334 287
335extern void tcp_rcv_space_adjust(struct sock *sk); 288extern void tcp_rcv_space_adjust(struct sock *sk);
336 289
290extern int tcp_twsk_unique(struct sock *sk,
291 struct sock *sktw, void *twp);
292
337static inline void tcp_dec_quickack_mode(struct sock *sk, 293static inline void tcp_dec_quickack_mode(struct sock *sk,
338 const unsigned int pkts) 294 const unsigned int pkts)
339{ 295{
@@ -405,8 +361,7 @@ extern void tcp_parse_options(struct sk_buff *skb,
405 * TCP v4 functions exported for the inet6 API 361 * TCP v4 functions exported for the inet6 API
406 */ 362 */
407 363
408extern void tcp_v4_send_check(struct sock *sk, 364extern void tcp_v4_send_check(struct sock *sk, int len,
409 struct tcphdr *th, int len,
410 struct sk_buff *skb); 365 struct sk_buff *skb);
411 366
412extern int tcp_v4_conn_request(struct sock *sk, 367extern int tcp_v4_conn_request(struct sock *sk,
@@ -490,34 +445,16 @@ typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *,
490extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, 445extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
491 sk_read_actor_t recv_actor); 446 sk_read_actor_t recv_actor);
492 447
493/* Initialize RCV_MSS value. 448extern void tcp_initialize_rcv_mss(struct sock *sk);
494 * RCV_MSS is an our guess about MSS used by the peer.
495 * We haven't any direct information about the MSS.
496 * It's better to underestimate the RCV_MSS rather than overestimate.
497 * Overestimations make us ACKing less frequently than needed.
498 * Underestimations are more easy to detect and fix by tcp_measure_rcv_mss().
499 */
500 449
501static inline void tcp_initialize_rcv_mss(struct sock *sk) 450static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
502{
503 struct tcp_sock *tp = tcp_sk(sk);
504 unsigned int hint = min_t(unsigned int, tp->advmss, tp->mss_cache);
505
506 hint = min(hint, tp->rcv_wnd/2);
507 hint = min(hint, TCP_MIN_RCVMSS);
508 hint = max(hint, TCP_MIN_MSS);
509
510 inet_csk(sk)->icsk_ack.rcv_mss = hint;
511}
512
513static __inline__ void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
514{ 451{
515 tp->pred_flags = htonl((tp->tcp_header_len << 26) | 452 tp->pred_flags = htonl((tp->tcp_header_len << 26) |
516 ntohl(TCP_FLAG_ACK) | 453 ntohl(TCP_FLAG_ACK) |
517 snd_wnd); 454 snd_wnd);
518} 455}
519 456
520static __inline__ void tcp_fast_path_on(struct tcp_sock *tp) 457static inline void tcp_fast_path_on(struct tcp_sock *tp)
521{ 458{
522 __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); 459 __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale);
523} 460}
@@ -535,7 +472,7 @@ static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp)
535 * Rcv_nxt can be after the window if our peer push more data 472 * Rcv_nxt can be after the window if our peer push more data
536 * than the offered window. 473 * than the offered window.
537 */ 474 */
538static __inline__ u32 tcp_receive_window(const struct tcp_sock *tp) 475static inline u32 tcp_receive_window(const struct tcp_sock *tp)
539{ 476{
540 s32 win = tp->rcv_wup + tp->rcv_wnd - tp->rcv_nxt; 477 s32 win = tp->rcv_wup + tp->rcv_wnd - tp->rcv_nxt;
541 478
@@ -707,6 +644,7 @@ extern void tcp_cleanup_congestion_control(struct sock *sk);
707extern int tcp_set_default_congestion_control(const char *name); 644extern int tcp_set_default_congestion_control(const char *name);
708extern void tcp_get_default_congestion_control(char *name); 645extern void tcp_get_default_congestion_control(char *name);
709extern int tcp_set_congestion_control(struct sock *sk, const char *name); 646extern int tcp_set_congestion_control(struct sock *sk, const char *name);
647extern void tcp_slow_start(struct tcp_sock *tp);
710 648
711extern struct tcp_congestion_ops tcp_init_congestion_ops; 649extern struct tcp_congestion_ops tcp_init_congestion_ops;
712extern u32 tcp_reno_ssthresh(struct sock *sk); 650extern u32 tcp_reno_ssthresh(struct sock *sk);
@@ -746,7 +684,7 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
746 * "Packets left network, but not honestly ACKed yet" PLUS 684 * "Packets left network, but not honestly ACKed yet" PLUS
747 * "Packets fast retransmitted" 685 * "Packets fast retransmitted"
748 */ 686 */
749static __inline__ unsigned int tcp_packets_in_flight(const struct tcp_sock *tp) 687static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
750{ 688{
751 return (tp->packets_out - tp->left_out + tp->retrans_out); 689 return (tp->packets_out - tp->left_out + tp->retrans_out);
752} 690}
@@ -766,33 +704,6 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
766 (tp->snd_cwnd >> 2))); 704 (tp->snd_cwnd >> 2)));
767} 705}
768 706
769/*
770 * Linear increase during slow start
771 */
772static inline void tcp_slow_start(struct tcp_sock *tp)
773{
774 if (sysctl_tcp_abc) {
775 /* RFC3465: Slow Start
776 * TCP sender SHOULD increase cwnd by the number of
777 * previously unacknowledged bytes ACKed by each incoming
778 * acknowledgment, provided the increase is not more than L
779 */
780 if (tp->bytes_acked < tp->mss_cache)
781 return;
782
783 /* We MAY increase by 2 if discovered delayed ack */
784 if (sysctl_tcp_abc > 1 && tp->bytes_acked > 2*tp->mss_cache) {
785 if (tp->snd_cwnd < tp->snd_cwnd_clamp)
786 tp->snd_cwnd++;
787 }
788 }
789 tp->bytes_acked = 0;
790
791 if (tp->snd_cwnd < tp->snd_cwnd_clamp)
792 tp->snd_cwnd++;
793}
794
795
796static inline void tcp_sync_left_out(struct tcp_sock *tp) 707static inline void tcp_sync_left_out(struct tcp_sock *tp)
797{ 708{
798 if (tp->rx_opt.sack_ok && 709 if (tp->rx_opt.sack_ok &&
@@ -801,34 +712,7 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp)
801 tp->left_out = tp->sacked_out + tp->lost_out; 712 tp->left_out = tp->sacked_out + tp->lost_out;
802} 713}
803 714
804/* Set slow start threshold and cwnd not falling to slow start */ 715extern void tcp_enter_cwr(struct sock *sk);
805static inline void __tcp_enter_cwr(struct sock *sk)
806{
807 const struct inet_connection_sock *icsk = inet_csk(sk);
808 struct tcp_sock *tp = tcp_sk(sk);
809
810 tp->undo_marker = 0;
811 tp->snd_ssthresh = icsk->icsk_ca_ops->ssthresh(sk);
812 tp->snd_cwnd = min(tp->snd_cwnd,
813 tcp_packets_in_flight(tp) + 1U);
814 tp->snd_cwnd_cnt = 0;
815 tp->high_seq = tp->snd_nxt;
816 tp->snd_cwnd_stamp = tcp_time_stamp;
817 TCP_ECN_queue_cwr(tp);
818}
819
820static inline void tcp_enter_cwr(struct sock *sk)
821{
822 struct tcp_sock *tp = tcp_sk(sk);
823
824 tp->prior_ssthresh = 0;
825 tp->bytes_acked = 0;
826 if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) {
827 __tcp_enter_cwr(sk);
828 tcp_set_ca_state(sk, TCP_CA_CWR);
829 }
830}
831
832extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); 716extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst);
833 717
834/* Slow start with delack produces 3 packets of burst, so that 718/* Slow start with delack produces 3 packets of burst, so that
@@ -860,14 +744,14 @@ static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight)
860 return left <= tcp_max_burst(tp); 744 return left <= tcp_max_burst(tp);
861} 745}
862 746
863static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss, 747static inline void tcp_minshall_update(struct tcp_sock *tp, int mss,
864 const struct sk_buff *skb) 748 const struct sk_buff *skb)
865{ 749{
866 if (skb->len < mss) 750 if (skb->len < mss)
867 tp->snd_sml = TCP_SKB_CB(skb)->end_seq; 751 tp->snd_sml = TCP_SKB_CB(skb)->end_seq;
868} 752}
869 753
870static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) 754static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp)
871{ 755{
872 const struct inet_connection_sock *icsk = inet_csk(sk); 756 const struct inet_connection_sock *icsk = inet_csk(sk);
873 if (!tp->packets_out && !icsk->icsk_pending) 757 if (!tp->packets_out && !icsk->icsk_pending)
@@ -875,18 +759,18 @@ static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *t
875 icsk->icsk_rto, TCP_RTO_MAX); 759 icsk->icsk_rto, TCP_RTO_MAX);
876} 760}
877 761
878static __inline__ void tcp_push_pending_frames(struct sock *sk, 762static inline void tcp_push_pending_frames(struct sock *sk,
879 struct tcp_sock *tp) 763 struct tcp_sock *tp)
880{ 764{
881 __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); 765 __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle);
882} 766}
883 767
884static __inline__ void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) 768static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq)
885{ 769{
886 tp->snd_wl1 = seq; 770 tp->snd_wl1 = seq;
887} 771}
888 772
889static __inline__ void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) 773static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq)
890{ 774{
891 tp->snd_wl1 = seq; 775 tp->snd_wl1 = seq;
892} 776}
@@ -894,19 +778,19 @@ static __inline__ void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq)
894/* 778/*
895 * Calculate(/check) TCP checksum 779 * Calculate(/check) TCP checksum
896 */ 780 */
897static __inline__ u16 tcp_v4_check(struct tcphdr *th, int len, 781static inline u16 tcp_v4_check(struct tcphdr *th, int len,
898 unsigned long saddr, unsigned long daddr, 782 unsigned long saddr, unsigned long daddr,
899 unsigned long base) 783 unsigned long base)
900{ 784{
901 return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base); 785 return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base);
902} 786}
903 787
904static __inline__ int __tcp_checksum_complete(struct sk_buff *skb) 788static inline int __tcp_checksum_complete(struct sk_buff *skb)
905{ 789{
906 return __skb_checksum_complete(skb); 790 return __skb_checksum_complete(skb);
907} 791}
908 792
909static __inline__ int tcp_checksum_complete(struct sk_buff *skb) 793static inline int tcp_checksum_complete(struct sk_buff *skb)
910{ 794{
911 return skb->ip_summed != CHECKSUM_UNNECESSARY && 795 return skb->ip_summed != CHECKSUM_UNNECESSARY &&
912 __tcp_checksum_complete(skb); 796 __tcp_checksum_complete(skb);
@@ -914,7 +798,7 @@ static __inline__ int tcp_checksum_complete(struct sk_buff *skb)
914 798
915/* Prequeue for VJ style copy to user, combined with checksumming. */ 799/* Prequeue for VJ style copy to user, combined with checksumming. */
916 800
917static __inline__ void tcp_prequeue_init(struct tcp_sock *tp) 801static inline void tcp_prequeue_init(struct tcp_sock *tp)
918{ 802{
919 tp->ucopy.task = NULL; 803 tp->ucopy.task = NULL;
920 tp->ucopy.len = 0; 804 tp->ucopy.len = 0;
@@ -930,7 +814,7 @@ static __inline__ void tcp_prequeue_init(struct tcp_sock *tp)
930 * 814 *
931 * NOTE: is this not too big to inline? 815 * NOTE: is this not too big to inline?
932 */ 816 */
933static __inline__ int tcp_prequeue(struct sock *sk, struct sk_buff *skb) 817static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
934{ 818{
935 struct tcp_sock *tp = tcp_sk(sk); 819 struct tcp_sock *tp = tcp_sk(sk);
936 820
@@ -971,7 +855,7 @@ static const char *statename[]={
971}; 855};
972#endif 856#endif
973 857
974static __inline__ void tcp_set_state(struct sock *sk, int state) 858static inline void tcp_set_state(struct sock *sk, int state)
975{ 859{
976 int oldstate = sk->sk_state; 860 int oldstate = sk->sk_state;
977 861
@@ -1005,7 +889,7 @@ static __inline__ void tcp_set_state(struct sock *sk, int state)
1005#endif 889#endif
1006} 890}
1007 891
1008static __inline__ void tcp_done(struct sock *sk) 892static inline void tcp_done(struct sock *sk)
1009{ 893{
1010 tcp_set_state(sk, TCP_CLOSE); 894 tcp_set_state(sk, TCP_CLOSE);
1011 tcp_clear_xmit_timers(sk); 895 tcp_clear_xmit_timers(sk);
@@ -1018,81 +902,13 @@ static __inline__ void tcp_done(struct sock *sk)
1018 inet_csk_destroy_sock(sk); 902 inet_csk_destroy_sock(sk);
1019} 903}
1020 904
1021static __inline__ void tcp_sack_reset(struct tcp_options_received *rx_opt) 905static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
1022{ 906{
1023 rx_opt->dsack = 0; 907 rx_opt->dsack = 0;
1024 rx_opt->eff_sacks = 0; 908 rx_opt->eff_sacks = 0;
1025 rx_opt->num_sacks = 0; 909 rx_opt->num_sacks = 0;
1026} 910}
1027 911
1028static __inline__ void tcp_build_and_update_options(__u32 *ptr, struct tcp_sock *tp, __u32 tstamp)
1029{
1030 if (tp->rx_opt.tstamp_ok) {
1031 *ptr++ = __constant_htonl((TCPOPT_NOP << 24) |
1032 (TCPOPT_NOP << 16) |
1033 (TCPOPT_TIMESTAMP << 8) |
1034 TCPOLEN_TIMESTAMP);
1035 *ptr++ = htonl(tstamp);
1036 *ptr++ = htonl(tp->rx_opt.ts_recent);
1037 }
1038 if (tp->rx_opt.eff_sacks) {
1039 struct tcp_sack_block *sp = tp->rx_opt.dsack ? tp->duplicate_sack : tp->selective_acks;
1040 int this_sack;
1041
1042 *ptr++ = __constant_htonl((TCPOPT_NOP << 24) |
1043 (TCPOPT_NOP << 16) |
1044 (TCPOPT_SACK << 8) |
1045 (TCPOLEN_SACK_BASE +
1046 (tp->rx_opt.eff_sacks * TCPOLEN_SACK_PERBLOCK)));
1047 for(this_sack = 0; this_sack < tp->rx_opt.eff_sacks; this_sack++) {
1048 *ptr++ = htonl(sp[this_sack].start_seq);
1049 *ptr++ = htonl(sp[this_sack].end_seq);
1050 }
1051 if (tp->rx_opt.dsack) {
1052 tp->rx_opt.dsack = 0;
1053 tp->rx_opt.eff_sacks--;
1054 }
1055 }
1056}
1057
1058/* Construct a tcp options header for a SYN or SYN_ACK packet.
1059 * If this is every changed make sure to change the definition of
1060 * MAX_SYN_SIZE to match the new maximum number of options that you
1061 * can generate.
1062 */
1063static inline void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sack,
1064 int offer_wscale, int wscale, __u32 tstamp, __u32 ts_recent)
1065{
1066 /* We always get an MSS option.
1067 * The option bytes which will be seen in normal data
1068 * packets should timestamps be used, must be in the MSS
1069 * advertised. But we subtract them from tp->mss_cache so
1070 * that calculations in tcp_sendmsg are simpler etc.
1071 * So account for this fact here if necessary. If we
1072 * don't do this correctly, as a receiver we won't
1073 * recognize data packets as being full sized when we
1074 * should, and thus we won't abide by the delayed ACK
1075 * rules correctly.
1076 * SACKs don't matter, we never delay an ACK when we
1077 * have any of those going out.
1078 */
1079 *ptr++ = htonl((TCPOPT_MSS << 24) | (TCPOLEN_MSS << 16) | mss);
1080 if (ts) {
1081 if(sack)
1082 *ptr++ = __constant_htonl((TCPOPT_SACK_PERM << 24) | (TCPOLEN_SACK_PERM << 16) |
1083 (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
1084 else
1085 *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
1086 (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
1087 *ptr++ = htonl(tstamp); /* TSVAL */
1088 *ptr++ = htonl(ts_recent); /* TSECR */
1089 } else if(sack)
1090 *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
1091 (TCPOPT_SACK_PERM << 8) | TCPOLEN_SACK_PERM);
1092 if (offer_wscale)
1093 *ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_WINDOW << 16) | (TCPOLEN_WINDOW << 8) | (wscale));
1094}
1095
1096/* Determine a window scaling and initial window to offer. */ 912/* Determine a window scaling and initial window to offer. */
1097extern void tcp_select_initial_window(int __space, __u32 mss, 913extern void tcp_select_initial_window(int __space, __u32 mss,
1098 __u32 *rcv_wnd, __u32 *window_clamp, 914 __u32 *rcv_wnd, __u32 *window_clamp,
@@ -1117,9 +933,9 @@ static inline int tcp_full_space(const struct sock *sk)
1117 return tcp_win_from_space(sk->sk_rcvbuf); 933 return tcp_win_from_space(sk->sk_rcvbuf);
1118} 934}
1119 935
1120static __inline__ void tcp_openreq_init(struct request_sock *req, 936static inline void tcp_openreq_init(struct request_sock *req,
1121 struct tcp_options_received *rx_opt, 937 struct tcp_options_received *rx_opt,
1122 struct sk_buff *skb) 938 struct sk_buff *skb)
1123{ 939{
1124 struct inet_request_sock *ireq = inet_rsk(req); 940 struct inet_request_sock *ireq = inet_rsk(req);
1125 941
diff --git a/include/net/tcp_states.h b/include/net/tcp_states.h
index b9d4176b2d15..b0b645988bd8 100644
--- a/include/net/tcp_states.h
+++ b/include/net/tcp_states.h
@@ -31,4 +31,20 @@ enum {
31 31
32#define TCP_STATE_MASK 0xF 32#define TCP_STATE_MASK 0xF
33 33
34#define TCP_ACTION_FIN (1 << 7)
35
36enum {
37 TCPF_ESTABLISHED = (1 << 1),
38 TCPF_SYN_SENT = (1 << 2),
39 TCPF_SYN_RECV = (1 << 3),
40 TCPF_FIN_WAIT1 = (1 << 4),
41 TCPF_FIN_WAIT2 = (1 << 5),
42 TCPF_TIME_WAIT = (1 << 6),
43 TCPF_CLOSE = (1 << 7),
44 TCPF_CLOSE_WAIT = (1 << 8),
45 TCPF_LAST_ACK = (1 << 9),
46 TCPF_LISTEN = (1 << 10),
47 TCPF_CLOSING = (1 << 11)
48};
49
34#endif /* _LINUX_TCP_STATES_H */ 50#endif /* _LINUX_TCP_STATES_H */
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h
new file mode 100644
index 000000000000..2544281e1d5e
--- /dev/null
+++ b/include/net/timewait_sock.h
@@ -0,0 +1,31 @@
1/*
2 * NET Generic infrastructure for Network protocols.
3 *
4 * Authors: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#ifndef _TIMEWAIT_SOCK_H
12#define _TIMEWAIT_SOCK_H
13
14#include <linux/slab.h>
15#include <net/sock.h>
16
17struct timewait_sock_ops {
18 kmem_cache_t *twsk_slab;
19 unsigned int twsk_obj_size;
20 int (*twsk_unique)(struct sock *sk,
21 struct sock *sktw, void *twp);
22};
23
24static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
25{
26 if (sk->sk_prot->twsk_prot->twsk_unique != NULL)
27 return sk->sk_prot->twsk_prot->twsk_unique(sk, sktw, twp);
28 return 0;
29}
30
31#endif /* _TIMEWAIT_SOCK_H */
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 4e86f2de6638..61f724c1036f 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -44,7 +44,7 @@ extern int datagram_send_ctl(struct msghdr *msg,
44/* 44/*
45 * address family specific functions 45 * address family specific functions
46 */ 46 */
47extern struct tcp_func ipv4_specific; 47extern struct inet_connection_sock_af_ops ipv4_specific;
48 48
49extern int inet6_destroy_sock(struct sock *sk); 49extern int inet6_destroy_sock(struct sock *sk);
50 50
diff --git a/include/net/udp.h b/include/net/udp.h
index 107b9d791a1f..766fba1369ce 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -22,9 +22,8 @@
22#ifndef _UDP_H 22#ifndef _UDP_H
23#define _UDP_H 23#define _UDP_H
24 24
25#include <linux/udp.h>
26#include <linux/ip.h>
27#include <linux/list.h> 25#include <linux/list.h>
26#include <net/inet_sock.h>
28#include <net/sock.h> 27#include <net/sock.h>
29#include <net/snmp.h> 28#include <net/snmp.h>
30#include <linux/seq_file.h> 29#include <linux/seq_file.h>
@@ -62,6 +61,7 @@ static inline int udp_lport_inuse(u16 num)
62 61
63extern struct proto udp_prot; 62extern struct proto udp_prot;
64 63
64struct sk_buff;
65 65
66extern void udp_err(struct sk_buff *, u32); 66extern void udp_err(struct sk_buff *, u32);
67 67
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 5beae1ccd574..07d7b50cdd76 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -2,11 +2,12 @@
2#define _NET_XFRM_H 2#define _NET_XFRM_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/in.h>
5#include <linux/xfrm.h> 6#include <linux/xfrm.h>
6#include <linux/spinlock.h> 7#include <linux/spinlock.h>
7#include <linux/list.h> 8#include <linux/list.h>
8#include <linux/skbuff.h> 9#include <linux/skbuff.h>
9#include <linux/netdevice.h> 10#include <linux/socket.h>
10#include <linux/crypto.h> 11#include <linux/crypto.h>
11#include <linux/pfkeyv2.h> 12#include <linux/pfkeyv2.h>
12#include <linux/in6.h> 13#include <linux/in6.h>
@@ -144,6 +145,9 @@ struct xfrm_state
144 * transformer. */ 145 * transformer. */
145 struct xfrm_type *type; 146 struct xfrm_type *type;
146 147
148 /* Security context */
149 struct xfrm_sec_ctx *security;
150
147 /* Private data of this transformer, format is opaque, 151 /* Private data of this transformer, format is opaque,
148 * interpreted by xfrm_type methods. */ 152 * interpreted by xfrm_type methods. */
149 void *data; 153 void *data;
@@ -298,6 +302,7 @@ struct xfrm_policy
298 __u8 flags; 302 __u8 flags;
299 __u8 dead; 303 __u8 dead;
300 __u8 xfrm_nr; 304 __u8 xfrm_nr;
305 struct xfrm_sec_ctx *security;
301 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 306 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
302}; 307};
303 308
@@ -510,6 +515,25 @@ xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl,
510 return 0; 515 return 0;
511} 516}
512 517
518#ifdef CONFIG_SECURITY_NETWORK_XFRM
519/* If neither has a context --> match
520 * Otherwise, both must have a context and the sids, doi, alg must match
521 */
522static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2)
523{
524 return ((!s1 && !s2) ||
525 (s1 && s2 &&
526 (s1->ctx_sid == s2->ctx_sid) &&
527 (s1->ctx_doi == s2->ctx_doi) &&
528 (s1->ctx_alg == s2->ctx_alg)));
529}
530#else
531static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2)
532{
533 return 1;
534}
535#endif
536
513/* A struct encoding bundle of transformations to apply to some set of flow. 537/* A struct encoding bundle of transformations to apply to some set of flow.
514 * 538 *
515 * dst->child points to the next element of bundle. 539 * dst->child points to the next element of bundle.
@@ -878,8 +902,8 @@ static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsig
878struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); 902struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp);
879extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *); 903extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *);
880int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 904int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
881struct xfrm_policy *xfrm_policy_bysel(int dir, struct xfrm_selector *sel, 905struct xfrm_policy *xfrm_policy_bysel_ctx(int dir, struct xfrm_selector *sel,
882 int delete); 906 struct xfrm_sec_ctx *ctx, int delete);
883struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete); 907struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete);
884void xfrm_policy_flush(void); 908void xfrm_policy_flush(void);
885u32 xfrm_get_acqseq(void); 909u32 xfrm_get_acqseq(void);
@@ -890,6 +914,7 @@ struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto,
890extern void xfrm_policy_flush(void); 914extern void xfrm_policy_flush(void);
891extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 915extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
892extern int xfrm_flush_bundles(void); 916extern int xfrm_flush_bundles(void);
917extern void xfrm_flush_all_bundles(void);
893extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family); 918extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family);
894extern void xfrm_init_pmtu(struct dst_entry *dst); 919extern void xfrm_init_pmtu(struct dst_entry *dst);
895 920
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index 2cab39f49eb2..52660f32663d 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -382,7 +382,6 @@ enum service {
382struct pcmcia_socket; 382struct pcmcia_socket;
383 383
384int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg); 384int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg);
385int pcmcia_deregister_client(struct pcmcia_device *p_dev);
386int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config); 385int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config);
387int pcmcia_get_first_window(window_handle_t *win, win_req_t *req); 386int pcmcia_get_first_window(window_handle_t *win, win_req_t *req);
388int pcmcia_get_next_window(window_handle_t *win, win_req_t *req); 387int pcmcia_get_next_window(window_handle_t *win, win_req_t *req);
@@ -390,7 +389,6 @@ int pcmcia_get_status(struct pcmcia_device *p_dev, cs_status_t *status);
390int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); 389int pcmcia_get_mem_page(window_handle_t win, memreq_t *req);
391int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); 390int pcmcia_map_mem_page(window_handle_t win, memreq_t *req);
392int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); 391int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod);
393int pcmcia_register_client(client_handle_t *handle, client_reg_t *req);
394int pcmcia_release_configuration(struct pcmcia_device *p_dev); 392int pcmcia_release_configuration(struct pcmcia_device *p_dev);
395int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req); 393int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req);
396int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req); 394int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req);
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index cb8b6e6ce66c..8e2a96396478 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -133,10 +133,12 @@ typedef struct dev_link_t {
133struct pcmcia_socket; 133struct pcmcia_socket;
134 134
135struct pcmcia_driver { 135struct pcmcia_driver {
136 dev_link_t *(*attach)(void); 136 int (*probe) (struct pcmcia_device *dev);
137 int (*event) (event_t event, int priority, 137 void (*remove) (struct pcmcia_device *dev);
138 event_callback_args_t *); 138
139 void (*detach)(dev_link_t *); 139 int (*suspend) (struct pcmcia_device *dev);
140 int (*resume) (struct pcmcia_device *dev);
141
140 struct module *owner; 142 struct module *owner;
141 struct pcmcia_device_id *id_table; 143 struct pcmcia_device_id *id_table;
142 struct device_driver drv; 144 struct device_driver drv;
@@ -164,7 +166,6 @@ struct pcmcia_device {
164 /* deprecated, a cleaned up version will be moved into this 166 /* deprecated, a cleaned up version will be moved into this
165 struct soon */ 167 struct soon */
166 dev_link_t *instance; 168 dev_link_t *instance;
167 event_callback_args_t event_callback_args;
168 u_int state; 169 u_int state;
169 170
170 /* information about this device */ 171 /* information about this device */
@@ -193,6 +194,8 @@ struct pcmcia_device {
193#define handle_to_pdev(handle) (handle) 194#define handle_to_pdev(handle) (handle)
194#define handle_to_dev(handle) (handle->dev) 195#define handle_to_dev(handle) (handle->dev)
195 196
197#define dev_to_instance(dev) (dev->instance)
198
196/* error reporting */ 199/* error reporting */
197void cs_error(client_handle_t handle, int func, int ret); 200void cs_error(client_handle_t handle, int func, int ret);
198 201
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index e788bbc5657d..2889a69a7a8f 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -118,16 +118,14 @@ struct pcmcia_socket;
118struct pccard_operations { 118struct pccard_operations {
119 int (*init)(struct pcmcia_socket *sock); 119 int (*init)(struct pcmcia_socket *sock);
120 int (*suspend)(struct pcmcia_socket *sock); 120 int (*suspend)(struct pcmcia_socket *sock);
121 int (*register_callback)(struct pcmcia_socket *sock, void (*handler)(void *, unsigned int), void * info);
122 int (*get_status)(struct pcmcia_socket *sock, u_int *value); 121 int (*get_status)(struct pcmcia_socket *sock, u_int *value);
123 int (*get_socket)(struct pcmcia_socket *sock, socket_state_t *state);
124 int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state); 122 int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state);
125 int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io); 123 int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io);
126 int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem); 124 int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem);
127}; 125};
128 126
129struct pccard_resource_ops { 127struct pccard_resource_ops {
130 void (*validate_mem) (struct pcmcia_socket *s); 128 int (*validate_mem) (struct pcmcia_socket *s);
131 int (*adjust_io_region) (struct resource *res, 129 int (*adjust_io_region) (struct resource *res,
132 unsigned long r_start, 130 unsigned long r_start,
133 unsigned long r_end, 131 unsigned long r_end,
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 7529f4388bb4..41cfc29be899 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -151,5 +151,6 @@ extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
151extern void scsi_put_command(struct scsi_cmnd *); 151extern void scsi_put_command(struct scsi_cmnd *);
152extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int); 152extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int);
153extern void scsi_finish_command(struct scsi_cmnd *cmd); 153extern void scsi_finish_command(struct scsi_cmnd *cmd);
154extern void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd);
154 155
155#endif /* _SCSI_SCSI_CMND_H */ 156#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index b090a11d7e1c..4d69dee66d4d 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -16,7 +16,6 @@ extern void __scsi_print_sense(const char *name,
16extern void scsi_print_driverbyte(int); 16extern void scsi_print_driverbyte(int);
17extern void scsi_print_hostbyte(int); 17extern void scsi_print_hostbyte(int);
18extern void scsi_print_status(unsigned char); 18extern void scsi_print_status(unsigned char);
19extern int scsi_print_msg(const unsigned char *);
20extern const char *scsi_sense_key_string(unsigned char); 19extern const char *scsi_sense_key_string(unsigned char);
21extern const char *scsi_extd_sense_format(unsigned char, unsigned char); 20extern const char *scsi_extd_sense_format(unsigned char, unsigned char);
22 21
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 85cfd88461c8..e94ca4d36035 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -79,9 +79,9 @@ struct scsi_device {
79 char inq_periph_qual; /* PQ from INQUIRY data */ 79 char inq_periph_qual; /* PQ from INQUIRY data */
80 unsigned char inquiry_len; /* valid bytes in 'inquiry' */ 80 unsigned char inquiry_len; /* valid bytes in 'inquiry' */
81 unsigned char * inquiry; /* INQUIRY response data */ 81 unsigned char * inquiry; /* INQUIRY response data */
82 char * vendor; /* [back_compat] point into 'inquiry' ... */ 82 const char * vendor; /* [back_compat] point into 'inquiry' ... */
83 char * model; /* ... after scan; point to static string */ 83 const char * model; /* ... after scan; point to static string */
84 char * rev; /* ... "nullnullnullnull" before scan */ 84 const char * rev; /* ... "nullnullnullnull" before scan */
85 unsigned char current_tag; /* current tag */ 85 unsigned char current_tag; /* current tag */
86 struct scsi_target *sdev_target; /* used only for single_lun */ 86 struct scsi_target *sdev_target; /* used only for single_lun */
87 87
@@ -274,6 +274,12 @@ extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
274extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, 274extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
275 int data_direction, void *buffer, unsigned bufflen, 275 int data_direction, void *buffer, unsigned bufflen,
276 struct scsi_sense_hdr *, int timeout, int retries); 276 struct scsi_sense_hdr *, int timeout, int retries);
277extern int scsi_execute_async(struct scsi_device *sdev,
278 const unsigned char *cmd, int data_direction,
279 void *buffer, unsigned bufflen, int use_sg,
280 int timeout, int retries, void *privdata,
281 void (*done)(void *, char *, int, int),
282 gfp_t gfp);
277 283
278static inline unsigned int sdev_channel(struct scsi_device *sdev) 284static inline unsigned int sdev_channel(struct scsi_device *sdev)
279{ 285{
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
index 850dfa877fda..02e26c1672bf 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -15,7 +15,6 @@ struct scsi_driver {
15 void (*rescan)(struct device *); 15 void (*rescan)(struct device *);
16 int (*issue_flush)(struct device *, sector_t *); 16 int (*issue_flush)(struct device *, sector_t *);
17 int (*prepare_flush)(struct request_queue *, struct request *); 17 int (*prepare_flush)(struct request_queue *, struct request *);
18 void (*end_flush)(struct request_queue *, struct request *);
19}; 18};
20#define to_scsi_driver(drv) \ 19#define to_scsi_driver(drv) \
21 container_of((drv), struct scsi_driver, gendrv) 20 container_of((drv), struct scsi_driver, gendrv)
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 6cbb1982ed03..230bc55c0bfa 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -296,6 +296,12 @@ struct scsi_host_template {
296 int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int); 296 int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int);
297 297
298 /* 298 /*
299 * suspend support
300 */
301 int (*resume)(struct scsi_device *);
302 int (*suspend)(struct scsi_device *);
303
304 /*
299 * Name of proc directory 305 * Name of proc directory
300 */ 306 */
301 char *proc_name; 307 char *proc_name;
@@ -392,7 +398,6 @@ struct scsi_host_template {
392 /* 398 /*
393 * ordered write support 399 * ordered write support
394 */ 400 */
395 unsigned ordered_flush:1;
396 unsigned ordered_tag:1; 401 unsigned ordered_tag:1;
397 402
398 /* 403 /*
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index fac547d32a98..394f14a5b7cb 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -79,6 +79,7 @@ enum fc_port_state {
79 FC_PORTSTATE_LINKDOWN, 79 FC_PORTSTATE_LINKDOWN,
80 FC_PORTSTATE_ERROR, 80 FC_PORTSTATE_ERROR,
81 FC_PORTSTATE_LOOPBACK, 81 FC_PORTSTATE_LOOPBACK,
82 FC_PORTSTATE_DELETED,
82}; 83};
83 84
84 85
@@ -325,8 +326,14 @@ struct fc_host_attrs {
325 struct list_head rport_bindings; 326 struct list_head rport_bindings;
326 u32 next_rport_number; 327 u32 next_rport_number;
327 u32 next_target_id; 328 u32 next_target_id;
329 u8 flags;
330 struct work_struct rport_del_work;
328}; 331};
329 332
333/* values for struct fc_host_attrs "flags" field: */
334#define FC_SHOST_RPORT_DEL_SCHEDULED 0x01
335
336
330#define fc_host_node_name(x) \ 337#define fc_host_node_name(x) \
331 (((struct fc_host_attrs *)(x)->shost_data)->node_name) 338 (((struct fc_host_attrs *)(x)->shost_data)->node_name)
332#define fc_host_port_name(x) \ 339#define fc_host_port_name(x) \
@@ -365,6 +372,10 @@ struct fc_host_attrs {
365 (((struct fc_host_attrs *)(x)->shost_data)->next_rport_number) 372 (((struct fc_host_attrs *)(x)->shost_data)->next_rport_number)
366#define fc_host_next_target_id(x) \ 373#define fc_host_next_target_id(x) \
367 (((struct fc_host_attrs *)(x)->shost_data)->next_target_id) 374 (((struct fc_host_attrs *)(x)->shost_data)->next_target_id)
375#define fc_host_flags(x) \
376 (((struct fc_host_attrs *)(x)->shost_data)->flags)
377#define fc_host_rport_del_work(x) \
378 (((struct fc_host_attrs *)(x)->shost_data)->rport_del_work)
368 379
369 380
370/* The functions by which the transport class and the driver communicate */ 381/* The functions by which the transport class and the driver communicate */
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
index 6bdc4afb2483..54a89611e9c5 100644
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -24,6 +24,9 @@
24#include <linux/transport_class.h> 24#include <linux/transport_class.h>
25 25
26struct scsi_transport_template; 26struct scsi_transport_template;
27struct scsi_target;
28struct scsi_device;
29struct Scsi_Host;
27 30
28struct spi_transport_attrs { 31struct spi_transport_attrs {
29 int period; /* value in the PPR/SDTR command */ 32 int period; /* value in the PPR/SDTR command */
@@ -143,5 +146,6 @@ void spi_release_transport(struct scsi_transport_template *);
143void spi_schedule_dv_device(struct scsi_device *); 146void spi_schedule_dv_device(struct scsi_device *);
144void spi_dv_device(struct scsi_device *); 147void spi_dv_device(struct scsi_device *);
145void spi_display_xfer_agreement(struct scsi_target *); 148void spi_display_xfer_agreement(struct scsi_target *);
149int spi_print_msg(const unsigned char *);
146 150
147#endif /* SCSI_TRANSPORT_SPI_H */ 151#endif /* SCSI_TRANSPORT_SPI_H */
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 7f0ca79d6c98..b0b3ea7b365e 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -391,65 +391,35 @@
391 * 391 *
392 */ 392 */
393 393
394typedef struct _snd_ac97_bus ac97_bus_t; 394struct snd_ac97;
395typedef struct _snd_ac97_bus_ops ac97_bus_ops_t;
396typedef struct _snd_ac97_template ac97_template_t;
397typedef struct _snd_ac97 ac97_t;
398
399enum ac97_pcm_cfg {
400 AC97_PCM_CFG_FRONT = 2,
401 AC97_PCM_CFG_REAR = 10, /* alias surround */
402 AC97_PCM_CFG_LFE = 11, /* center + lfe */
403 AC97_PCM_CFG_40 = 4, /* front + rear */
404 AC97_PCM_CFG_51 = 6, /* front + rear + center/lfe */
405 AC97_PCM_CFG_SPDIF = 20
406};
407
408/* PCM allocation */
409struct ac97_pcm {
410 ac97_bus_t *bus;
411 unsigned int stream: 1, /* stream type: 1 = capture */
412 exclusive: 1, /* exclusive mode, don't override with other pcms */
413 copy_flag: 1, /* lowlevel driver must fill all entries */
414 spdif: 1; /* spdif pcm */
415 unsigned short aslots; /* active slots */
416 unsigned int rates; /* available rates */
417 struct {
418 unsigned short slots; /* driver input: requested AC97 slot numbers */
419 unsigned short rslots[4]; /* allocated slots per codecs */
420 unsigned char rate_table[4];
421 ac97_t *codec[4]; /* allocated codecs */
422 } r[2]; /* 0 = standard rates, 1 = double rates */
423 unsigned long private_value; /* used by the hardware driver */
424};
425 395
426struct snd_ac97_build_ops { 396struct snd_ac97_build_ops {
427 int (*build_3d) (ac97_t *ac97); 397 int (*build_3d) (struct snd_ac97 *ac97);
428 int (*build_specific) (ac97_t *ac97); 398 int (*build_specific) (struct snd_ac97 *ac97);
429 int (*build_spdif) (ac97_t *ac97); 399 int (*build_spdif) (struct snd_ac97 *ac97);
430 int (*build_post_spdif) (ac97_t *ac97); 400 int (*build_post_spdif) (struct snd_ac97 *ac97);
431#ifdef CONFIG_PM 401#ifdef CONFIG_PM
432 void (*suspend) (ac97_t *ac97); 402 void (*suspend) (struct snd_ac97 *ac97);
433 void (*resume) (ac97_t *ac97); 403 void (*resume) (struct snd_ac97 *ac97);
434#endif 404#endif
435 void (*update_jacks) (ac97_t *ac97); /* for jack-sharing */ 405 void (*update_jacks) (struct snd_ac97 *ac97); /* for jack-sharing */
436}; 406};
437 407
438struct _snd_ac97_bus_ops { 408struct snd_ac97_bus_ops {
439 void (*reset) (ac97_t *ac97); 409 void (*reset) (struct snd_ac97 *ac97);
440 void (*write) (ac97_t *ac97, unsigned short reg, unsigned short val); 410 void (*write) (struct snd_ac97 *ac97, unsigned short reg, unsigned short val);
441 unsigned short (*read) (ac97_t *ac97, unsigned short reg); 411 unsigned short (*read) (struct snd_ac97 *ac97, unsigned short reg);
442 void (*wait) (ac97_t *ac97); 412 void (*wait) (struct snd_ac97 *ac97);
443 void (*init) (ac97_t *ac97); 413 void (*init) (struct snd_ac97 *ac97);
444}; 414};
445 415
446struct _snd_ac97_bus { 416struct snd_ac97_bus {
447 /* -- lowlevel (hardware) driver specific -- */ 417 /* -- lowlevel (hardware) driver specific -- */
448 ac97_bus_ops_t *ops; 418 struct snd_ac97_bus_ops *ops;
449 void *private_data; 419 void *private_data;
450 void (*private_free) (ac97_bus_t *bus); 420 void (*private_free) (struct snd_ac97_bus *bus);
451 /* --- */ 421 /* --- */
452 snd_card_t *card; 422 struct snd_card *card;
453 unsigned short num; /* bus number */ 423 unsigned short num; /* bus number */
454 unsigned short no_vra: 1, /* bridge doesn't support VRA */ 424 unsigned short no_vra: 1, /* bridge doesn't support VRA */
455 dra: 1, /* bridge supports double rate */ 425 dra: 1, /* bridge supports double rate */
@@ -459,13 +429,13 @@ struct _snd_ac97_bus {
459 unsigned short used_slots[2][4]; /* actually used PCM slots */ 429 unsigned short used_slots[2][4]; /* actually used PCM slots */
460 unsigned short pcms_count; /* count of PCMs */ 430 unsigned short pcms_count; /* count of PCMs */
461 struct ac97_pcm *pcms; 431 struct ac97_pcm *pcms;
462 ac97_t *codec[4]; 432 struct snd_ac97 *codec[4];
463 snd_info_entry_t *proc; 433 struct snd_info_entry *proc;
464}; 434};
465 435
466struct _snd_ac97_template { 436struct snd_ac97_template {
467 void *private_data; 437 void *private_data;
468 void (*private_free) (ac97_t *ac97); 438 void (*private_free) (struct snd_ac97 *ac97);
469 struct pci_dev *pci; /* assigned PCI device - used for quirks */ 439 struct pci_dev *pci; /* assigned PCI device - used for quirks */
470 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ 440 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */
471 unsigned short addr; /* physical address of codec [0-3] */ 441 unsigned short addr; /* physical address of codec [0-3] */
@@ -474,16 +444,16 @@ struct _snd_ac97_template {
474 DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */ 444 DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */
475}; 445};
476 446
477struct _snd_ac97 { 447struct snd_ac97 {
478 /* -- lowlevel (hardware) driver specific -- */ 448 /* -- lowlevel (hardware) driver specific -- */
479 struct snd_ac97_build_ops * build_ops; 449 struct snd_ac97_build_ops * build_ops;
480 void *private_data; 450 void *private_data;
481 void (*private_free) (ac97_t *ac97); 451 void (*private_free) (struct snd_ac97 *ac97);
482 /* --- */ 452 /* --- */
483 ac97_bus_t *bus; 453 struct snd_ac97_bus *bus;
484 struct pci_dev *pci; /* assigned PCI device - used for quirks */ 454 struct pci_dev *pci; /* assigned PCI device - used for quirks */
485 snd_info_entry_t *proc; 455 struct snd_info_entry *proc;
486 snd_info_entry_t *proc_regs; 456 struct snd_info_entry *proc_regs;
487 unsigned short subsystem_vendor; 457 unsigned short subsystem_vendor;
488 unsigned short subsystem_device; 458 unsigned short subsystem_device;
489 struct semaphore reg_mutex; 459 struct semaphore reg_mutex;
@@ -517,43 +487,47 @@ struct _snd_ac97 {
517 struct device dev; 487 struct device dev;
518}; 488};
519 489
520#define to_ac97_t(d) container_of(d, struct _snd_ac97, dev) 490#define to_ac97_t(d) container_of(d, struct snd_ac97, dev)
521 491
522/* conditions */ 492/* conditions */
523static inline int ac97_is_audio(ac97_t * ac97) 493static inline int ac97_is_audio(struct snd_ac97 * ac97)
524{ 494{
525 return (ac97->scaps & AC97_SCAP_AUDIO); 495 return (ac97->scaps & AC97_SCAP_AUDIO);
526} 496}
527static inline int ac97_is_modem(ac97_t * ac97) 497static inline int ac97_is_modem(struct snd_ac97 * ac97)
528{ 498{
529 return (ac97->scaps & AC97_SCAP_MODEM); 499 return (ac97->scaps & AC97_SCAP_MODEM);
530} 500}
531static inline int ac97_is_rev22(ac97_t * ac97) 501static inline int ac97_is_rev22(struct snd_ac97 * ac97)
532{ 502{
533 return (ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_22; 503 return (ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_22;
534} 504}
535static inline int ac97_can_amap(ac97_t * ac97) 505static inline int ac97_can_amap(struct snd_ac97 * ac97)
536{ 506{
537 return (ac97->ext_id & AC97_EI_AMAP) != 0; 507 return (ac97->ext_id & AC97_EI_AMAP) != 0;
538} 508}
539static inline int ac97_can_spdif(ac97_t * ac97) 509static inline int ac97_can_spdif(struct snd_ac97 * ac97)
540{ 510{
541 return (ac97->ext_id & AC97_EI_SPDIF) != 0; 511 return (ac97->ext_id & AC97_EI_SPDIF) != 0;
542} 512}
543 513
544/* functions */ 514/* functions */
545int snd_ac97_bus(snd_card_t *card, int num, ac97_bus_ops_t *ops, void *private_data, ac97_bus_t **rbus); /* create new AC97 bus */ 515/* create new AC97 bus */
546int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97); /* create mixer controls */ 516int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops,
547const char *snd_ac97_get_short_name(ac97_t *ac97); 517 void *private_data, struct snd_ac97_bus **rbus);
548 518/* create mixer controls */
549void snd_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short value); 519int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
550unsigned short snd_ac97_read(ac97_t *ac97, unsigned short reg); 520 struct snd_ac97 **rac97);
551void snd_ac97_write_cache(ac97_t *ac97, unsigned short reg, unsigned short value); 521const char *snd_ac97_get_short_name(struct snd_ac97 *ac97);
552int snd_ac97_update(ac97_t *ac97, unsigned short reg, unsigned short value); 522
553int snd_ac97_update_bits(ac97_t *ac97, unsigned short reg, unsigned short mask, unsigned short value); 523void snd_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
524unsigned short snd_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
525void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
526int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
527int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value);
554#ifdef CONFIG_PM 528#ifdef CONFIG_PM
555void snd_ac97_suspend(ac97_t *ac97); 529void snd_ac97_suspend(struct snd_ac97 *ac97);
556void snd_ac97_resume(ac97_t *ac97); 530void snd_ac97_resume(struct snd_ac97 *ac97);
557#endif 531#endif
558 532
559/* quirk types */ 533/* quirk types */
@@ -567,6 +541,7 @@ enum {
567 AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */ 541 AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */
568 AC97_TUNE_INV_EAPD, /* inverted EAPD implementation */ 542 AC97_TUNE_INV_EAPD, /* inverted EAPD implementation */
569 AC97_TUNE_MUTE_LED, /* EAPD bit works as mute LED */ 543 AC97_TUNE_MUTE_LED, /* EAPD bit works as mute LED */
544 AC97_TUNE_HP_MUTE_LED, /* EAPD bit works as mute LED, use headphone control as master */
570}; 545};
571 546
572struct ac97_quirk { 547struct ac97_quirk {
@@ -578,24 +553,46 @@ struct ac97_quirk {
578 int type; /* quirk type above */ 553 int type; /* quirk type above */
579}; 554};
580 555
581int snd_ac97_tune_hardware(ac97_t *ac97, struct ac97_quirk *quirk, const char *override); 556int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, const char *override);
582int snd_ac97_set_rate(ac97_t *ac97, int reg, unsigned int rate); 557int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate);
558
559/*
560 * PCM allocation
561 */
562
563enum ac97_pcm_cfg {
564 AC97_PCM_CFG_FRONT = 2,
565 AC97_PCM_CFG_REAR = 10, /* alias surround */
566 AC97_PCM_CFG_LFE = 11, /* center + lfe */
567 AC97_PCM_CFG_40 = 4, /* front + rear */
568 AC97_PCM_CFG_51 = 6, /* front + rear + center/lfe */
569 AC97_PCM_CFG_SPDIF = 20
570};
571
572struct ac97_pcm {
573 struct snd_ac97_bus *bus;
574 unsigned int stream: 1, /* stream type: 1 = capture */
575 exclusive: 1, /* exclusive mode, don't override with other pcms */
576 copy_flag: 1, /* lowlevel driver must fill all entries */
577 spdif: 1; /* spdif pcm */
578 unsigned short aslots; /* active slots */
579 unsigned int rates; /* available rates */
580 struct {
581 unsigned short slots; /* driver input: requested AC97 slot numbers */
582 unsigned short rslots[4]; /* allocated slots per codecs */
583 unsigned char rate_table[4];
584 struct snd_ac97 *codec[4]; /* allocated codecs */
585 } r[2]; /* 0 = standard rates, 1 = double rates */
586 unsigned long private_value; /* used by the hardware driver */
587};
583 588
584int snd_ac97_pcm_assign(ac97_bus_t *ac97, 589int snd_ac97_pcm_assign(struct snd_ac97_bus *ac97,
585 unsigned short pcms_count, 590 unsigned short pcms_count,
586 const struct ac97_pcm *pcms); 591 const struct ac97_pcm *pcms);
587int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate, 592int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
588 enum ac97_pcm_cfg cfg, unsigned short slots); 593 enum ac97_pcm_cfg cfg, unsigned short slots);
589int snd_ac97_pcm_close(struct ac97_pcm *pcm); 594int snd_ac97_pcm_close(struct ac97_pcm *pcm);
590int snd_ac97_pcm_double_rate_rules(snd_pcm_runtime_t *runtime); 595int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);
591
592struct ac97_enum {
593 unsigned char reg;
594 unsigned char shift_l;
595 unsigned char shift_r;
596 unsigned short mask;
597 const char **texts;
598};
599 596
600/* ad hoc AC97 device driver access */ 597/* ad hoc AC97 device driver access */
601extern struct bus_type ac97_bus_type; 598extern struct bus_type ac97_bus_type;
diff --git a/include/sound/ad1816a.h b/include/sound/ad1816a.h
index ca2e0e4fa937..b3aa62ee3c8d 100644
--- a/include/sound/ad1816a.h
+++ b/include/sound/ad1816a.h
@@ -123,9 +123,7 @@
123#define AD1816A_CAPTURE_NOT_EQUAL 0x1000 123#define AD1816A_CAPTURE_NOT_EQUAL 0x1000
124#define AD1816A_WSS_ENABLE 0x8000 124#define AD1816A_WSS_ENABLE 0x8000
125 125
126typedef struct _snd_ad1816a ad1816a_t; 126struct snd_ad1816a {
127
128struct _snd_ad1816a {
129 unsigned long port; 127 unsigned long port;
130 struct resource *res_port; 128 struct resource *res_port;
131 int irq; 129 int irq;
@@ -140,15 +138,15 @@ struct _snd_ad1816a {
140 unsigned short mode; 138 unsigned short mode;
141 unsigned int clock_freq; 139 unsigned int clock_freq;
142 140
143 snd_card_t *card; 141 struct snd_card *card;
144 snd_pcm_t *pcm; 142 struct snd_pcm *pcm;
145 143
146 snd_pcm_substream_t *playback_substream; 144 struct snd_pcm_substream *playback_substream;
147 snd_pcm_substream_t *capture_substream; 145 struct snd_pcm_substream *capture_substream;
148 unsigned int p_dma_size; 146 unsigned int p_dma_size;
149 unsigned int c_dma_size; 147 unsigned int c_dma_size;
150 148
151 snd_timer_t *timer; 149 struct snd_timer *timer;
152}; 150};
153 151
154 152
@@ -165,11 +163,11 @@ struct _snd_ad1816a {
165 AD1816A_MODE_TIMER) 163 AD1816A_MODE_TIMER)
166 164
167 165
168extern int snd_ad1816a_create(snd_card_t *card, unsigned long port, 166extern int snd_ad1816a_create(struct snd_card *card, unsigned long port,
169 int irq, int dma1, int dma2, 167 int irq, int dma1, int dma2,
170 ad1816a_t **chip); 168 struct snd_ad1816a **chip);
171 169
172extern int snd_ad1816a_pcm(ad1816a_t *chip, int device, snd_pcm_t **rpcm); 170extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm);
173extern int snd_ad1816a_mixer(ad1816a_t *chip); 171extern int snd_ad1816a_mixer(struct snd_ad1816a *chip);
174 172
175#endif /* __SOUND_AD1816A_H */ 173#endif /* __SOUND_AD1816A_H */
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
index 7e33b11037f2..1a2759f3a292 100644
--- a/include/sound/ad1848.h
+++ b/include/sound/ad1848.h
@@ -127,7 +127,7 @@
127#define AD1848_THINKPAD_CTL_PORT2 0x15e9 127#define AD1848_THINKPAD_CTL_PORT2 0x15e9
128#define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02 128#define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02
129 129
130struct _snd_ad1848 { 130struct snd_ad1848 {
131 unsigned long port; /* i/o port */ 131 unsigned long port; /* i/o port */
132 struct resource *res_port; 132 struct resource *res_port;
133 int irq; /* IRQ line */ 133 int irq; /* IRQ line */
@@ -137,10 +137,10 @@ struct _snd_ad1848 {
137 unsigned short hardware; /* see to AD1848_HW_XXXX */ 137 unsigned short hardware; /* see to AD1848_HW_XXXX */
138 unsigned short single_dma:1; /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ 138 unsigned short single_dma:1; /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */
139 139
140 snd_pcm_t *pcm; 140 struct snd_pcm *pcm;
141 snd_pcm_substream_t *playback_substream; 141 struct snd_pcm_substream *playback_substream;
142 snd_pcm_substream_t *capture_substream; 142 struct snd_pcm_substream *capture_substream;
143 snd_card_t *card; 143 struct snd_card *card;
144 144
145 unsigned char image[32]; /* SGalaxy needs an access to extended registers */ 145 unsigned char image[32]; /* SGalaxy needs an access to extended registers */
146 int mce_bit; 146 int mce_bit;
@@ -148,25 +148,28 @@ struct _snd_ad1848 {
148 int dma_size; 148 int dma_size;
149 int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */ 149 int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */
150 150
151#ifdef CONFIG_PM
152 void (*suspend)(struct snd_ad1848 *chip);
153 void (*resume)(struct snd_ad1848 *chip);
154#endif
155
151 spinlock_t reg_lock; 156 spinlock_t reg_lock;
152 struct semaphore open_mutex; 157 struct semaphore open_mutex;
153}; 158};
154 159
155typedef struct _snd_ad1848 ad1848_t;
156
157/* exported functions */ 160/* exported functions */
158 161
159void snd_ad1848_out(ad1848_t *chip, unsigned char reg, unsigned char value); 162void snd_ad1848_out(struct snd_ad1848 *chip, unsigned char reg, unsigned char value);
160 163
161int snd_ad1848_create(snd_card_t * card, 164int snd_ad1848_create(struct snd_card *card,
162 unsigned long port, 165 unsigned long port,
163 int irq, int dma, 166 int irq, int dma,
164 unsigned short hardware, 167 unsigned short hardware,
165 ad1848_t ** chip); 168 struct snd_ad1848 ** chip);
166 169
167int snd_ad1848_pcm(ad1848_t * chip, int device, snd_pcm_t **rpcm); 170int snd_ad1848_pcm(struct snd_ad1848 * chip, int device, struct snd_pcm **rpcm);
168const snd_pcm_ops_t *snd_ad1848_get_pcm_ops(int direction); 171const struct snd_pcm_ops *snd_ad1848_get_pcm_ops(int direction);
169int snd_ad1848_mixer(ad1848_t * chip); 172int snd_ad1848_mixer(struct snd_ad1848 * chip);
170 173
171/* exported mixer stuffs */ 174/* exported mixer stuffs */
172enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE }; 175enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE };
@@ -176,7 +179,7 @@ enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE };
176#define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \ 179#define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \
177 ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22)) 180 ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22))
178 181
179int snd_ad1848_add_ctl(ad1848_t *chip, const char *name, int index, int type, unsigned long value); 182int snd_ad1848_add_ctl(struct snd_ad1848 *chip, const char *name, int index, int type, unsigned long value);
180 183
181/* for ease of use */ 184/* for ease of use */
182struct ad1848_mix_elem { 185struct ad1848_mix_elem {
@@ -198,7 +201,7 @@ struct ad1848_mix_elem {
198 .type = AD1848_MIX_DOUBLE, \ 201 .type = AD1848_MIX_DOUBLE, \
199 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) } 202 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) }
200 203
201static inline int snd_ad1848_add_ctl_elem(ad1848_t *chip, const struct ad1848_mix_elem *c) 204static inline int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, const struct ad1848_mix_elem *c)
202{ 205{
203 return snd_ad1848_add_ctl(chip, c->name, c->index, c->type, c->private_value); 206 return snd_ad1848_add_ctl(chip, c->name, c->index, c->type, c->private_value);
204} 207}
diff --git a/include/sound/ainstr_fm.h b/include/sound/ainstr_fm.h
index 0ec02953815a..c4afb1f121fe 100644
--- a/include/sound/ainstr_fm.h
+++ b/include/sound/ainstr_fm.h
@@ -39,13 +39,13 @@
39 * FM operator 39 * FM operator
40 */ 40 */
41 41
42typedef struct fm_operator { 42struct fm_operator {
43 unsigned char am_vib; 43 unsigned char am_vib;
44 unsigned char ksl_level; 44 unsigned char ksl_level;
45 unsigned char attack_decay; 45 unsigned char attack_decay;
46 unsigned char sustain_release; 46 unsigned char sustain_release;
47 unsigned char wave_select; 47 unsigned char wave_select;
48} fm_operator_t; 48};
49 49
50/* 50/*
51 * Instrument 51 * Instrument
@@ -54,11 +54,11 @@ typedef struct fm_operator {
54#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */ 54#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */
55#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */ 55#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */
56 56
57typedef struct { 57struct fm_instrument {
58 unsigned int share_id[4]; /* share id - zero = no sharing */ 58 unsigned int share_id[4]; /* share id - zero = no sharing */
59 unsigned char type; /* instrument type */ 59 unsigned char type; /* instrument type */
60 60
61 fm_operator_t op[4]; 61 struct fm_operator op[4];
62 unsigned char feedback_connection[2]; 62 unsigned char feedback_connection[2];
63 63
64 unsigned char echo_delay; 64 unsigned char echo_delay;
@@ -68,7 +68,7 @@ typedef struct {
68 unsigned char fix_dur; 68 unsigned char fix_dur;
69 unsigned char modes; 69 unsigned char modes;
70 unsigned char fix_key; 70 unsigned char fix_key;
71} fm_instrument_t; 71};
72 72
73/* 73/*
74 * 74 *
@@ -88,25 +88,25 @@ typedef struct {
88 * FM operator 88 * FM operator
89 */ 89 */
90 90
91typedef struct fm_xoperator { 91struct fm_xoperator {
92 __u8 am_vib; 92 __u8 am_vib;
93 __u8 ksl_level; 93 __u8 ksl_level;
94 __u8 attack_decay; 94 __u8 attack_decay;
95 __u8 sustain_release; 95 __u8 sustain_release;
96 __u8 wave_select; 96 __u8 wave_select;
97} fm_xoperator_t; 97};
98 98
99/* 99/*
100 * Instrument 100 * Instrument
101 */ 101 */
102 102
103typedef struct fm_xinstrument { 103struct fm_xinstrument {
104 __u32 stype; /* structure type */ 104 __u32 stype; /* structure type */
105 105
106 __u32 share_id[4]; /* share id - zero = no sharing */ 106 __u32 share_id[4]; /* share id - zero = no sharing */
107 __u8 type; /* instrument type */ 107 __u8 type; /* instrument type */
108 108
109 fm_xoperator_t op[4]; /* fm operators */ 109 struct fm_xoperator op[4]; /* fm operators */
110 __u8 feedback_connection[2]; 110 __u8 feedback_connection[2];
111 111
112 __u8 echo_delay; 112 __u8 echo_delay;
@@ -116,15 +116,19 @@ typedef struct fm_xinstrument {
116 __u8 fix_dur; 116 __u8 fix_dur;
117 __u8 modes; 117 __u8 modes;
118 __u8 fix_key; 118 __u8 fix_key;
119} fm_xinstrument_t; 119};
120 120
121#ifdef __KERNEL__ 121#ifdef __KERNEL__
122 122
123#include "seq_instr.h" 123#include "seq_instr.h"
124 124
125int snd_seq_fm_init(snd_seq_kinstr_ops_t * ops, 125int snd_seq_fm_init(struct snd_seq_kinstr_ops * ops,
126 snd_seq_kinstr_ops_t * next); 126 struct snd_seq_kinstr_ops * next);
127 127
128#endif 128#endif
129 129
130/* typedefs for compatibility to user-space */
131typedef struct fm_xoperator fm_xoperator_t;
132typedef struct fm_xinstrument fm_xinstrument_t;
133
130#endif /* __SOUND_AINSTR_FM_H */ 134#endif /* __SOUND_AINSTR_FM_H */
diff --git a/include/sound/ainstr_gf1.h b/include/sound/ainstr_gf1.h
index ae2ddda63971..47726fe0f46d 100644
--- a/include/sound/ainstr_gf1.h
+++ b/include/sound/ainstr_gf1.h
@@ -52,7 +52,7 @@
52 * Wavetable definitions 52 * Wavetable definitions
53 */ 53 */
54 54
55typedef struct gf1_wave { 55struct gf1_wave {
56 unsigned int share_id[4]; /* share id - zero = no sharing */ 56 unsigned int share_id[4]; /* share id - zero = no sharing */
57 unsigned int format; /* wave format */ 57 unsigned int format; /* wave format */
58 58
@@ -88,7 +88,7 @@ typedef struct gf1_wave {
88 unsigned short scale_factor; /* 0-2048 or 0-2 */ 88 unsigned short scale_factor; /* 0-2048 or 0-2 */
89 89
90 struct gf1_wave *next; 90 struct gf1_wave *next;
91} gf1_wave_t; 91};
92 92
93/* 93/*
94 * Instrument 94 * Instrument
@@ -103,7 +103,7 @@ typedef struct gf1_wave {
103#define IWFFFF_EFFECT_CHORUS 2 103#define IWFFFF_EFFECT_CHORUS 2
104#define IWFFFF_EFFECT_ECHO 3 104#define IWFFFF_EFFECT_ECHO 3
105 105
106typedef struct { 106struct gf1_instrument {
107 unsigned short exclusion; 107 unsigned short exclusion;
108 unsigned short exclusion_group; /* 0 - none, 1-65535 */ 108 unsigned short exclusion_group; /* 0 - none, 1-65535 */
109 109
@@ -112,8 +112,8 @@ typedef struct {
112 unsigned char effect2; /* effect 2 */ 112 unsigned char effect2; /* effect 2 */
113 unsigned char effect2_depth; /* 0-127 */ 113 unsigned char effect2_depth; /* 0-127 */
114 114
115 gf1_wave_t *wave; /* first waveform */ 115 struct gf1_wave *wave; /* first waveform */
116} gf1_instrument_t; 116};
117 117
118/* 118/*
119 * 119 *
@@ -135,7 +135,7 @@ typedef struct {
135 * Wavetable definitions 135 * Wavetable definitions
136 */ 136 */
137 137
138typedef struct gf1_xwave { 138struct gf1_xwave {
139 __u32 stype; /* structure type */ 139 __u32 stype; /* structure type */
140 140
141 __u32 share_id[4]; /* share id - zero = no sharing */ 141 __u32 share_id[4]; /* share id - zero = no sharing */
@@ -165,13 +165,13 @@ typedef struct gf1_xwave {
165 __u8 vibrato_depth; 165 __u8 vibrato_depth;
166 __u16 scale_frequency; 166 __u16 scale_frequency;
167 __u16 scale_factor; /* 0-2048 or 0-2 */ 167 __u16 scale_factor; /* 0-2048 or 0-2 */
168} gf1_xwave_t; 168};
169 169
170/* 170/*
171 * Instrument 171 * Instrument
172 */ 172 */
173 173
174typedef struct gf1_xinstrument { 174struct gf1_xinstrument {
175 __u32 stype; 175 __u32 stype;
176 176
177 __u16 exclusion; 177 __u16 exclusion;
@@ -181,7 +181,7 @@ typedef struct gf1_xinstrument {
181 __u8 effect1_depth; /* 0-127 */ 181 __u8 effect1_depth; /* 0-127 */
182 __u8 effect2; /* effect 2 */ 182 __u8 effect2; /* effect 2 */
183 __u8 effect2_depth; /* 0-127 */ 183 __u8 effect2_depth; /* 0-127 */
184} gf1_xinstrument_t; 184};
185 185
186/* 186/*
187 * Instrument info 187 * Instrument info
@@ -191,35 +191,39 @@ typedef struct gf1_xinstrument {
191#define GF1_INFO_TREMOLO (1<<1) 191#define GF1_INFO_TREMOLO (1<<1)
192#define GF1_INFO_VIBRATO (1<<2) 192#define GF1_INFO_VIBRATO (1<<2)
193 193
194typedef struct gf1_info { 194struct gf1_info {
195 unsigned char flags; /* supported wave flags */ 195 unsigned char flags; /* supported wave flags */
196 unsigned char pad[3]; 196 unsigned char pad[3];
197 unsigned int features; /* supported features */ 197 unsigned int features; /* supported features */
198 unsigned int max8_len; /* maximum 8-bit wave length */ 198 unsigned int max8_len; /* maximum 8-bit wave length */
199 unsigned int max16_len; /* maximum 16-bit wave length */ 199 unsigned int max16_len; /* maximum 16-bit wave length */
200} gf1_info_t; 200};
201 201
202#ifdef __KERNEL__ 202#ifdef __KERNEL__
203 203
204#include "seq_instr.h" 204#include "seq_instr.h"
205 205
206typedef struct { 206struct snd_gf1_ops {
207 void *private_data; 207 void *private_data;
208 int (*info)(void *private_data, gf1_info_t *info); 208 int (*info)(void *private_data, struct gf1_info *info);
209 int (*put_sample)(void *private_data, gf1_wave_t *wave, 209 int (*put_sample)(void *private_data, struct gf1_wave *wave,
210 char __user *data, long len, int atomic); 210 char __user *data, long len, int atomic);
211 int (*get_sample)(void *private_data, gf1_wave_t *wave, 211 int (*get_sample)(void *private_data, struct gf1_wave *wave,
212 char __user *data, long len, int atomic); 212 char __user *data, long len, int atomic);
213 int (*remove_sample)(void *private_data, gf1_wave_t *wave, 213 int (*remove_sample)(void *private_data, struct gf1_wave *wave,
214 int atomic); 214 int atomic);
215 void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); 215 void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
216 snd_seq_kinstr_ops_t kops; 216 struct snd_seq_kinstr_ops kops;
217} snd_gf1_ops_t; 217};
218 218
219int snd_seq_gf1_init(snd_gf1_ops_t *ops, 219int snd_seq_gf1_init(struct snd_gf1_ops *ops,
220 void *private_data, 220 void *private_data,
221 snd_seq_kinstr_ops_t *next); 221 struct snd_seq_kinstr_ops *next);
222 222
223#endif 223#endif
224 224
225/* typedefs for compatibility to user-space */
226typedef struct gf1_xwave gf1_xwave_t;
227typedef struct gf1_xinstrument gf1_xinstrument_t;
228
225#endif /* __SOUND_AINSTR_GF1_H */ 229#endif /* __SOUND_AINSTR_GF1_H */
diff --git a/include/sound/ainstr_iw.h b/include/sound/ainstr_iw.h
index 8adf744926ff..251feaf1b388 100644
--- a/include/sound/ainstr_iw.h
+++ b/include/sound/ainstr_iw.h
@@ -54,7 +54,7 @@
54 * Wavetable definitions 54 * Wavetable definitions
55 */ 55 */
56 56
57typedef struct iwffff_wave { 57struct iwffff_wave {
58 unsigned int share_id[4]; /* share id - zero = no sharing */ 58 unsigned int share_id[4]; /* share id - zero = no sharing */
59 unsigned int format; /* wave format */ 59 unsigned int format; /* wave format */
60 60
@@ -76,7 +76,7 @@ typedef struct iwffff_wave {
76 unsigned char pad; 76 unsigned char pad;
77 77
78 struct iwffff_wave *next; 78 struct iwffff_wave *next;
79} iwffff_wave_t; 79};
80 80
81/* 81/*
82 * Layer 82 * Layer
@@ -85,13 +85,13 @@ typedef struct iwffff_wave {
85#define IWFFFF_LFO_SHAPE_TRIANGLE 0 85#define IWFFFF_LFO_SHAPE_TRIANGLE 0
86#define IWFFFF_LFO_SHAPE_POSTRIANGLE 1 86#define IWFFFF_LFO_SHAPE_POSTRIANGLE 1
87 87
88typedef struct iwffff_lfo { 88struct iwffff_lfo {
89 unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */ 89 unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */
90 signed short depth; /* volume +- (0-255) 0.48675dB/step */ 90 signed short depth; /* volume +- (0-255) 0.48675dB/step */
91 signed short sweep; /* 0 - 950 deciseconds */ 91 signed short sweep; /* 0 - 950 deciseconds */
92 unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */ 92 unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */
93 unsigned char delay; /* 0 - 255 deciseconds */ 93 unsigned char delay; /* 0 - 255 deciseconds */
94} iwffff_lfo_t; 94};
95 95
96#define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */ 96#define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */
97 97
@@ -102,12 +102,12 @@ typedef struct iwffff_lfo {
102#define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */ 102#define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */
103#define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */ 103#define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */
104 104
105typedef struct iwffff_env_point { 105struct iwffff_env_point {
106 unsigned short offset; 106 unsigned short offset;
107 unsigned short rate; 107 unsigned short rate;
108} iwffff_env_point_t; 108};
109 109
110typedef struct iwffff_env_record { 110struct iwffff_env_record {
111 unsigned short nattack; 111 unsigned short nattack;
112 unsigned short nrelease; 112 unsigned short nrelease;
113 unsigned short sustain_offset; 113 unsigned short sustain_offset;
@@ -118,15 +118,15 @@ typedef struct iwffff_env_record {
118 struct iwffff_env_record *next; 118 struct iwffff_env_record *next;
119 /* points are stored here */ 119 /* points are stored here */
120 /* count of points = nattack + nrelease */ 120 /* count of points = nattack + nrelease */
121} iwffff_env_record_t; 121};
122 122
123typedef struct iwffff_env { 123struct iwffff_env {
124 unsigned char flags; 124 unsigned char flags;
125 unsigned char mode; 125 unsigned char mode;
126 unsigned char index; 126 unsigned char index;
127 unsigned char pad; 127 unsigned char pad;
128 struct iwffff_env_record *record; 128 struct iwffff_env_record *record;
129} iwffff_env_t; 129};
130 130
131#define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */ 131#define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */
132 132
@@ -138,7 +138,7 @@ typedef struct iwffff_env {
138#define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */ 138#define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */
139#define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */ 139#define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */
140 140
141typedef struct iwffff_layer { 141struct iwffff_layer {
142 unsigned char flags; 142 unsigned char flags;
143 unsigned char velocity_mode; 143 unsigned char velocity_mode;
144 unsigned char layer_event; 144 unsigned char layer_event;
@@ -147,17 +147,17 @@ typedef struct iwffff_layer {
147 unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */ 147 unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */
148 unsigned char pan_freq_scale; /* position based on frequency (0-127) */ 148 unsigned char pan_freq_scale; /* position based on frequency (0-127) */
149 unsigned char attenuation; /* 0-127 (no corresponding midi controller) */ 149 unsigned char attenuation; /* 0-127 (no corresponding midi controller) */
150 iwffff_lfo_t tremolo; /* tremolo effect */ 150 struct iwffff_lfo tremolo; /* tremolo effect */
151 iwffff_lfo_t vibrato; /* vibrato effect */ 151 struct iwffff_lfo vibrato; /* vibrato effect */
152 unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */ 152 unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
153 unsigned char freq_center; /* center for keyboard frequency scaling */ 153 unsigned char freq_center; /* center for keyboard frequency scaling */
154 unsigned char pad; 154 unsigned char pad;
155 iwffff_env_t penv; /* pitch envelope */ 155 struct iwffff_env penv; /* pitch envelope */
156 iwffff_env_t venv; /* volume envelope */ 156 struct iwffff_env venv; /* volume envelope */
157 157
158 iwffff_wave_t *wave; 158 struct iwffff_wave *wave;
159 struct iwffff_layer *next; 159 struct iwffff_layer *next;
160} iwffff_layer_t; 160};
161 161
162/* 162/*
163 * Instrument 163 * Instrument
@@ -177,7 +177,7 @@ typedef struct iwffff_layer {
177#define IWFFFF_EFFECT_CHORUS 2 177#define IWFFFF_EFFECT_CHORUS 2
178#define IWFFFF_EFFECT_ECHO 3 178#define IWFFFF_EFFECT_ECHO 3
179 179
180typedef struct { 180struct iwffff_instrument {
181 unsigned short exclusion; 181 unsigned short exclusion;
182 unsigned short layer_type; 182 unsigned short layer_type;
183 unsigned short exclusion_group; /* 0 - none, 1-65535 */ 183 unsigned short exclusion_group; /* 0 - none, 1-65535 */
@@ -187,8 +187,8 @@ typedef struct {
187 unsigned char effect2; /* effect 2 */ 187 unsigned char effect2; /* effect 2 */
188 unsigned char effect2_depth; /* 0-127 */ 188 unsigned char effect2_depth; /* 0-127 */
189 189
190 iwffff_layer_t *layer; /* first layer */ 190 struct iwffff_layer *layer; /* first layer */
191} iwffff_instrument_t; 191};
192 192
193/* 193/*
194 * 194 *
@@ -216,7 +216,7 @@ typedef struct {
216 * Wavetable definitions 216 * Wavetable definitions
217 */ 217 */
218 218
219typedef struct iwffff_xwave { 219struct iwffff_xwave {
220 __u32 stype; /* structure type */ 220 __u32 stype; /* structure type */
221 221
222 __u32 share_id[4]; /* share id - zero = no sharing */ 222 __u32 share_id[4]; /* share id - zero = no sharing */
@@ -234,26 +234,26 @@ typedef struct iwffff_xwave {
234 __u8 low_note; /* lower frequency range for this waveform */ 234 __u8 low_note; /* lower frequency range for this waveform */
235 __u8 high_note; /* higher frequency range for this waveform */ 235 __u8 high_note; /* higher frequency range for this waveform */
236 __u8 pad; 236 __u8 pad;
237} iwffff_xwave_t; 237};
238 238
239/* 239/*
240 * Layer 240 * Layer
241 */ 241 */
242 242
243typedef struct iwffff_xlfo { 243struct iwffff_xlfo {
244 __u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */ 244 __u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */
245 __s16 depth; /* volume +- (0-255) 0.48675dB/step */ 245 __s16 depth; /* volume +- (0-255) 0.48675dB/step */
246 __s16 sweep; /* 0 - 950 deciseconds */ 246 __s16 sweep; /* 0 - 950 deciseconds */
247 __u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */ 247 __u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */
248 __u8 delay; /* 0 - 255 deciseconds */ 248 __u8 delay; /* 0 - 255 deciseconds */
249} iwffff_xlfo_t; 249};
250 250
251typedef struct iwffff_xenv_point { 251struct iwffff_xenv_point {
252 __u16 offset; 252 __u16 offset;
253 __u16 rate; 253 __u16 rate;
254} iwffff_xenv_point_t; 254};
255 255
256typedef struct iwffff_xenv_record { 256struct iwffff_xenv_record {
257 __u32 stype; 257 __u32 stype;
258 __u16 nattack; 258 __u16 nattack;
259 __u16 nrelease; 259 __u16 nrelease;
@@ -264,16 +264,16 @@ typedef struct iwffff_xenv_record {
264 __u8 pad; 264 __u8 pad;
265 /* points are stored here.. */ 265 /* points are stored here.. */
266 /* count of points = nattack + nrelease */ 266 /* count of points = nattack + nrelease */
267} iwffff_xenv_record_t; 267};
268 268
269typedef struct iwffff_xenv { 269struct iwffff_xenv {
270 __u8 flags; 270 __u8 flags;
271 __u8 mode; 271 __u8 mode;
272 __u8 index; 272 __u8 index;
273 __u8 pad; 273 __u8 pad;
274} iwffff_xenv_t; 274};
275 275
276typedef struct iwffff_xlayer { 276struct iwffff_xlayer {
277 __u32 stype; 277 __u32 stype;
278 __u8 flags; 278 __u8 flags;
279 __u8 velocity_mode; 279 __u8 velocity_mode;
@@ -283,20 +283,20 @@ typedef struct iwffff_xlayer {
283 __u8 pan; /* pan offset from CC1 (0 left - 127 right) */ 283 __u8 pan; /* pan offset from CC1 (0 left - 127 right) */
284 __u8 pan_freq_scale; /* position based on frequency (0-127) */ 284 __u8 pan_freq_scale; /* position based on frequency (0-127) */
285 __u8 attenuation; /* 0-127 (no corresponding midi controller) */ 285 __u8 attenuation; /* 0-127 (no corresponding midi controller) */
286 iwffff_xlfo_t tremolo; /* tremolo effect */ 286 struct iwffff_xlfo tremolo; /* tremolo effect */
287 iwffff_xlfo_t vibrato; /* vibrato effect */ 287 struct iwffff_xlfo vibrato; /* vibrato effect */
288 __u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */ 288 __u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
289 __u8 freq_center; /* center for keyboard frequency scaling */ 289 __u8 freq_center; /* center for keyboard frequency scaling */
290 __u8 pad; 290 __u8 pad;
291 iwffff_xenv_t penv; /* pitch envelope */ 291 struct iwffff_xenv penv; /* pitch envelope */
292 iwffff_xenv_t venv; /* volume envelope */ 292 struct iwffff_xenv venv; /* volume envelope */
293} iwffff_xlayer_t; 293};
294 294
295/* 295/*
296 * Instrument 296 * Instrument
297 */ 297 */
298 298
299typedef struct iwffff_xinstrument { 299struct iwffff_xinstrument {
300 __u32 stype; 300 __u32 stype;
301 301
302 __u16 exclusion; 302 __u16 exclusion;
@@ -307,7 +307,7 @@ typedef struct iwffff_xinstrument {
307 __u8 effect1_depth; /* 0-127 */ 307 __u8 effect1_depth; /* 0-127 */
308 __u8 effect2; /* effect 2 */ 308 __u8 effect2; /* effect 2 */
309 __u8 effect2_depth; /* 0-127 */ 309 __u8 effect2_depth; /* 0-127 */
310} iwffff_xinstrument_t; 310};
311 311
312/* 312/*
313 * ROM support 313 * ROM support
@@ -316,7 +316,7 @@ typedef struct iwffff_xinstrument {
316 316
317#define IWFFFF_ROM_HDR_SIZE 512 317#define IWFFFF_ROM_HDR_SIZE 512
318 318
319typedef struct { 319struct iwffff_rom_header {
320 __u8 iwave[8]; 320 __u8 iwave[8];
321 __u8 revision; 321 __u8 revision;
322 __u8 series_number; 322 __u8 series_number;
@@ -328,7 +328,7 @@ typedef struct {
328 __u8 copyright[128]; 328 __u8 copyright[128];
329 __u8 vendor_name[64]; 329 __u8 vendor_name[64];
330 __u8 description[128]; 330 __u8 description[128];
331} iwffff_rom_header_t; 331};
332 332
333/* 333/*
334 * Instrument info 334 * Instrument info
@@ -339,35 +339,46 @@ typedef struct {
339#define IWFFFF_INFO_LFO_TREMOLO (1<<2) 339#define IWFFFF_INFO_LFO_TREMOLO (1<<2)
340#define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3) 340#define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3)
341 341
342typedef struct iwffff_info { 342struct iwffff_info {
343 unsigned int format; /* supported format bits */ 343 unsigned int format; /* supported format bits */
344 unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */ 344 unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */
345 unsigned int lfos; /* LFO effects */ 345 unsigned int lfos; /* LFO effects */
346 unsigned int max8_len; /* maximum 8-bit wave length */ 346 unsigned int max8_len; /* maximum 8-bit wave length */
347 unsigned int max16_len; /* maximum 16-bit wave length */ 347 unsigned int max16_len; /* maximum 16-bit wave length */
348} iwffff_info_t; 348};
349 349
350#ifdef __KERNEL__ 350#ifdef __KERNEL__
351 351
352#include "seq_instr.h" 352#include "seq_instr.h"
353 353
354typedef struct { 354struct snd_iwffff_ops {
355 void *private_data; 355 void *private_data;
356 int (*info)(void *private_data, iwffff_info_t *info); 356 int (*info)(void *private_data, struct iwffff_info *info);
357 int (*put_sample)(void *private_data, iwffff_wave_t *wave, 357 int (*put_sample)(void *private_data, struct iwffff_wave *wave,
358 char __user *data, long len, int atomic); 358 char __user *data, long len, int atomic);
359 int (*get_sample)(void *private_data, iwffff_wave_t *wave, 359 int (*get_sample)(void *private_data, struct iwffff_wave *wave,
360 char __user *data, long len, int atomic); 360 char __user *data, long len, int atomic);
361 int (*remove_sample)(void *private_data, iwffff_wave_t *wave, 361 int (*remove_sample)(void *private_data, struct iwffff_wave *wave,
362 int atomic); 362 int atomic);
363 void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); 363 void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
364 snd_seq_kinstr_ops_t kops; 364 struct snd_seq_kinstr_ops kops;
365} snd_iwffff_ops_t; 365};
366 366
367int snd_seq_iwffff_init(snd_iwffff_ops_t *ops, 367int snd_seq_iwffff_init(struct snd_iwffff_ops *ops,
368 void *private_data, 368 void *private_data,
369 snd_seq_kinstr_ops_t *next); 369 struct snd_seq_kinstr_ops *next);
370 370
371#endif 371#endif
372 372
373/* typedefs for compatibility to user-space */
374typedef struct iwffff_xwave iwffff_xwave_t;
375typedef struct iwffff_xlfo iwffff_xlfo_t;
376typedef struct iwffff_xenv_point iwffff_xenv_point_t;
377typedef struct iwffff_xenv_record iwffff_xenv_record_t;
378typedef struct iwffff_xenv iwffff_xenv_t;
379typedef struct iwffff_xlayer iwffff_xlayer_t;
380typedef struct iwffff_xinstrument iwffff_xinstrument_t;
381typedef struct iwffff_rom_header iwffff_rom_header_t;
382typedef struct iwffff_info iwffff_info_t;
383
373#endif /* __SOUND_AINSTR_IW_H */ 384#endif /* __SOUND_AINSTR_IW_H */
diff --git a/include/sound/ainstr_simple.h b/include/sound/ainstr_simple.h
index 40824b4ab23d..5eead12e58ae 100644
--- a/include/sound/ainstr_simple.h
+++ b/include/sound/ainstr_simple.h
@@ -61,18 +61,18 @@
61 * instrument info 61 * instrument info
62 */ 62 */
63 63
64typedef struct simple_instrument_info { 64struct simple_instrument_info {
65 unsigned int format; /* supported format bits */ 65 unsigned int format; /* supported format bits */
66 unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */ 66 unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */
67 unsigned int max8_len; /* maximum 8-bit wave length */ 67 unsigned int max8_len; /* maximum 8-bit wave length */
68 unsigned int max16_len; /* maximum 16-bit wave length */ 68 unsigned int max16_len; /* maximum 16-bit wave length */
69} simple_instrument_info_t; 69};
70 70
71/* 71/*
72 * Instrument 72 * Instrument
73 */ 73 */
74 74
75typedef struct { 75struct simple_instrument {
76 unsigned int share_id[4]; /* share id - zero = no sharing */ 76 unsigned int share_id[4]; /* share id - zero = no sharing */
77 unsigned int format; /* wave format */ 77 unsigned int format; /* wave format */
78 78
@@ -92,7 +92,7 @@ typedef struct {
92 unsigned char effect1_depth; /* 0-127 */ 92 unsigned char effect1_depth; /* 0-127 */
93 unsigned char effect2; /* effect 2 */ 93 unsigned char effect2; /* effect 2 */
94 unsigned char effect2_depth; /* 0-127 */ 94 unsigned char effect2_depth; /* 0-127 */
95} simple_instrument_t; 95};
96 96
97/* 97/*
98 * 98 *
@@ -112,7 +112,7 @@ typedef struct {
112 * Instrument 112 * Instrument
113 */ 113 */
114 114
115typedef struct simple_xinstrument { 115struct simple_xinstrument {
116 __u32 stype; 116 __u32 stype;
117 117
118 __u32 share_id[4]; /* share id - zero = no sharing */ 118 __u32 share_id[4]; /* share id - zero = no sharing */
@@ -128,29 +128,32 @@ typedef struct simple_xinstrument {
128 __u8 effect1_depth; /* 0-127 */ 128 __u8 effect1_depth; /* 0-127 */
129 __u8 effect2; /* effect 2 */ 129 __u8 effect2; /* effect 2 */
130 __u8 effect2_depth; /* 0-127 */ 130 __u8 effect2_depth; /* 0-127 */
131} simple_xinstrument_t; 131};
132 132
133#ifdef __KERNEL__ 133#ifdef __KERNEL__
134 134
135#include "seq_instr.h" 135#include "seq_instr.h"
136 136
137typedef struct { 137struct snd_simple_ops {
138 void *private_data; 138 void *private_data;
139 int (*info)(void *private_data, simple_instrument_info_t *info); 139 int (*info)(void *private_data, struct simple_instrument_info *info);
140 int (*put_sample)(void *private_data, simple_instrument_t *instr, 140 int (*put_sample)(void *private_data, struct simple_instrument *instr,
141 char __user *data, long len, int atomic); 141 char __user *data, long len, int atomic);
142 int (*get_sample)(void *private_data, simple_instrument_t *instr, 142 int (*get_sample)(void *private_data, struct simple_instrument *instr,
143 char __user *data, long len, int atomic); 143 char __user *data, long len, int atomic);
144 int (*remove_sample)(void *private_data, simple_instrument_t *instr, 144 int (*remove_sample)(void *private_data, struct simple_instrument *instr,
145 int atomic); 145 int atomic);
146 void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); 146 void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
147 snd_seq_kinstr_ops_t kops; 147 struct snd_seq_kinstr_ops kops;
148} snd_simple_ops_t; 148};
149 149
150int snd_seq_simple_init(snd_simple_ops_t *ops, 150int snd_seq_simple_init(struct snd_simple_ops *ops,
151 void *private_data, 151 void *private_data,
152 snd_seq_kinstr_ops_t *next); 152 struct snd_seq_kinstr_ops *next);
153 153
154#endif 154#endif
155 155
156/* typedefs for compatibility to user-space */
157typedef struct simple_xinstrument simple_xinstrument_t;
158
156#endif /* __SOUND_AINSTR_SIMPLE_H */ 159#endif /* __SOUND_AINSTR_SIMPLE_H */
diff --git a/include/sound/ak4114.h b/include/sound/ak4114.h
index f3f2c3e5ae51..11702aa0bea9 100644
--- a/include/sound/ak4114.h
+++ b/include/sound/ak4114.h
@@ -163,10 +163,8 @@
163typedef void (ak4114_write_t)(void *private_data, unsigned char addr, unsigned char data); 163typedef void (ak4114_write_t)(void *private_data, unsigned char addr, unsigned char data);
164typedef unsigned char (ak4114_read_t)(void *private_data, unsigned char addr); 164typedef unsigned char (ak4114_read_t)(void *private_data, unsigned char addr);
165 165
166typedef struct ak4114 ak4114_t;
167
168struct ak4114 { 166struct ak4114 {
169 snd_card_t * card; 167 struct snd_card *card;
170 ak4114_write_t * write; 168 ak4114_write_t * write;
171 ak4114_read_t * read; 169 ak4114_read_t * read;
172 void * private_data; 170 void * private_data;
@@ -174,9 +172,9 @@ struct ak4114 {
174 spinlock_t lock; 172 spinlock_t lock;
175 unsigned char regmap[7]; 173 unsigned char regmap[7];
176 unsigned char txcsb[5]; 174 unsigned char txcsb[5];
177 snd_kcontrol_t *kctls[AK4114_CONTROLS]; 175 struct snd_kcontrol *kctls[AK4114_CONTROLS];
178 snd_pcm_substream_t *playback_substream; 176 struct snd_pcm_substream *playback_substream;
179 snd_pcm_substream_t *capture_substream; 177 struct snd_pcm_substream *capture_substream;
180 unsigned long parity_errors; 178 unsigned long parity_errors;
181 unsigned long v_bit_errors; 179 unsigned long v_bit_errors;
182 unsigned long qcrc_errors; 180 unsigned long qcrc_errors;
@@ -186,20 +184,20 @@ struct ak4114 {
186 struct workqueue_struct *workqueue; 184 struct workqueue_struct *workqueue;
187 struct work_struct work; 185 struct work_struct work;
188 void *change_callback_private; 186 void *change_callback_private;
189 void (*change_callback)(ak4114_t *ak4114, unsigned char c0, unsigned char c1); 187 void (*change_callback)(struct ak4114 *ak4114, unsigned char c0, unsigned char c1);
190}; 188};
191 189
192int snd_ak4114_create(snd_card_t *card, 190int snd_ak4114_create(struct snd_card *card,
193 ak4114_read_t *read, ak4114_write_t *write, 191 ak4114_read_t *read, ak4114_write_t *write,
194 unsigned char pgm[7], unsigned char txcsb[5], 192 unsigned char pgm[7], unsigned char txcsb[5],
195 void *private_data, ak4114_t **r_ak4114); 193 void *private_data, struct ak4114 **r_ak4114);
196void snd_ak4114_reg_write(ak4114_t *ak4114, unsigned char reg, unsigned char mask, unsigned char val); 194void snd_ak4114_reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char mask, unsigned char val);
197void snd_ak4114_reinit(ak4114_t *ak4114); 195void snd_ak4114_reinit(struct ak4114 *ak4114);
198int snd_ak4114_build(ak4114_t *ak4114, 196int snd_ak4114_build(struct ak4114 *ak4114,
199 snd_pcm_substream_t *playback_substream, 197 struct snd_pcm_substream *playback_substream,
200 snd_pcm_substream_t *capture_substream); 198 struct snd_pcm_substream *capture_substream);
201int snd_ak4114_external_rate(ak4114_t *ak4114); 199int snd_ak4114_external_rate(struct ak4114 *ak4114);
202int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags); 200int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags);
203 201
204#endif /* __SOUND_AK4114_H */ 202#endif /* __SOUND_AK4114_H */
205 203
diff --git a/include/sound/ak4117.h b/include/sound/ak4117.h
index 9e1dab17c33e..2b96c32f06fd 100644
--- a/include/sound/ak4117.h
+++ b/include/sound/ak4117.h
@@ -155,18 +155,16 @@
155typedef void (ak4117_write_t)(void *private_data, unsigned char addr, unsigned char data); 155typedef void (ak4117_write_t)(void *private_data, unsigned char addr, unsigned char data);
156typedef unsigned char (ak4117_read_t)(void *private_data, unsigned char addr); 156typedef unsigned char (ak4117_read_t)(void *private_data, unsigned char addr);
157 157
158typedef struct ak4117 ak4117_t;
159
160struct ak4117 { 158struct ak4117 {
161 snd_card_t * card; 159 struct snd_card *card;
162 ak4117_write_t * write; 160 ak4117_write_t * write;
163 ak4117_read_t * read; 161 ak4117_read_t * read;
164 void * private_data; 162 void * private_data;
165 unsigned int init: 1; 163 unsigned int init: 1;
166 spinlock_t lock; 164 spinlock_t lock;
167 unsigned char regmap[5]; 165 unsigned char regmap[5];
168 snd_kcontrol_t *kctls[AK4117_CONTROLS]; 166 struct snd_kcontrol *kctls[AK4117_CONTROLS];
169 snd_pcm_substream_t *substream; 167 struct snd_pcm_substream *substream;
170 unsigned long parity_errors; 168 unsigned long parity_errors;
171 unsigned long v_bit_errors; 169 unsigned long v_bit_errors;
172 unsigned long qcrc_errors; 170 unsigned long qcrc_errors;
@@ -176,16 +174,16 @@ struct ak4117 {
176 unsigned char rcs2; 174 unsigned char rcs2;
177 struct timer_list timer; /* statistic timer */ 175 struct timer_list timer; /* statistic timer */
178 void *change_callback_private; 176 void *change_callback_private;
179 void (*change_callback)(ak4117_t *ak4117, unsigned char c0, unsigned char c1); 177 void (*change_callback)(struct ak4117 *ak4117, unsigned char c0, unsigned char c1);
180}; 178};
181 179
182int snd_ak4117_create(snd_card_t *card, ak4117_read_t *read, ak4117_write_t *write, 180int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t *write,
183 unsigned char pgm[5], void *private_data, ak4117_t **r_ak4117); 181 unsigned char pgm[5], void *private_data, struct ak4117 **r_ak4117);
184void snd_ak4117_reg_write(ak4117_t *ak4117, unsigned char reg, unsigned char mask, unsigned char val); 182void snd_ak4117_reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char mask, unsigned char val);
185void snd_ak4117_reinit(ak4117_t *ak4117); 183void snd_ak4117_reinit(struct ak4117 *ak4117);
186int snd_ak4117_build(ak4117_t *ak4117, snd_pcm_substream_t *capture_substream); 184int snd_ak4117_build(struct ak4117 *ak4117, struct snd_pcm_substream *capture_substream);
187int snd_ak4117_external_rate(ak4117_t *ak4117); 185int snd_ak4117_external_rate(struct ak4117 *ak4117);
188int snd_ak4117_check_rate_and_errors(ak4117_t *ak4117, unsigned int flags); 186int snd_ak4117_check_rate_and_errors(struct ak4117 *ak4117, unsigned int flags);
189 187
190#endif /* __SOUND_AK4117_H */ 188#endif /* __SOUND_AK4117_H */
191 189
diff --git a/include/sound/ak4531_codec.h b/include/sound/ak4531_codec.h
index 8b18992376d5..edf04070ce7c 100644
--- a/include/sound/ak4531_codec.h
+++ b/include/sound/ak4531_codec.h
@@ -64,17 +64,22 @@
64#define AK4531_AD_IN 0x18 /* AD input select */ 64#define AK4531_AD_IN 0x18 /* AD input select */
65#define AK4531_MIC_GAIN 0x19 /* MIC amplified gain */ 65#define AK4531_MIC_GAIN 0x19 /* MIC amplified gain */
66 66
67typedef struct _snd_ak4531 ak4531_t; 67struct snd_ak4531 {
68 68 void (*write) (struct snd_ak4531 *ak4531, unsigned short reg,
69struct _snd_ak4531 { 69 unsigned short val);
70 void (*write) (ak4531_t *ak4531, unsigned short reg, unsigned short val);
71 void *private_data; 70 void *private_data;
72 void (*private_free) (ak4531_t *ak4531); 71 void (*private_free) (struct snd_ak4531 *ak4531);
73 /* --- */ 72 /* --- */
74 unsigned char regs[0x20]; 73 unsigned char regs[0x20];
75 struct semaphore reg_mutex; 74 struct semaphore reg_mutex;
76}; 75};
77 76
78int snd_ak4531_mixer(snd_card_t * card, ak4531_t * _ak4531, ak4531_t ** rak4531); 77int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531,
78 struct snd_ak4531 **rak4531);
79
80#ifdef CONFIG_PM
81void snd_ak4531_suspend(struct snd_ak4531 *ak4531);
82void snd_ak4531_resume(struct snd_ak4531 *ak4531);
83#endif
79 84
80#endif /* __SOUND_AK4531_CODEC_H */ 85#endif /* __SOUND_AK4531_CODEC_H */
diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h
index e94ac0282318..3bf5911fe827 100644
--- a/include/sound/ak4xxx-adda.h
+++ b/include/sound/ak4xxx-adda.h
@@ -27,20 +27,20 @@
27#define AK4XXX_MAX_CHIPS 4 27#define AK4XXX_MAX_CHIPS 4
28#endif 28#endif
29 29
30typedef struct snd_akm4xxx akm4xxx_t; 30struct snd_akm4xxx;
31 31
32struct snd_ak4xxx_ops { 32struct snd_ak4xxx_ops {
33 void (*lock)(akm4xxx_t *ak, int chip); 33 void (*lock)(struct snd_akm4xxx *ak, int chip);
34 void (*unlock)(akm4xxx_t *ak, int chip); 34 void (*unlock)(struct snd_akm4xxx *ak, int chip);
35 void (*write)(akm4xxx_t *ak, int chip, unsigned char reg, unsigned char val); 35 void (*write)(struct snd_akm4xxx *ak, int chip, unsigned char reg, unsigned char val);
36 // unsigned char (*read)(akm4xxx_t *ak, int chip, unsigned char reg); 36 // unsigned char (*read)(struct snd_akm4xxx *ak, int chip, unsigned char reg);
37 void (*set_rate_val)(akm4xxx_t *ak, unsigned int rate); 37 void (*set_rate_val)(struct snd_akm4xxx *ak, unsigned int rate);
38}; 38};
39 39
40#define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */ 40#define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */
41 41
42struct snd_akm4xxx { 42struct snd_akm4xxx {
43 snd_card_t *card; 43 struct snd_card *card;
44 unsigned int num_adcs; /* AK4524 or AK4528 ADCs */ 44 unsigned int num_adcs; /* AK4524 or AK4528 ADCs */
45 unsigned int num_dacs; /* AK4524 or AK4528 DACs */ 45 unsigned int num_dacs; /* AK4524 or AK4528 DACs */
46 unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */ 46 unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */
@@ -56,10 +56,10 @@ struct snd_akm4xxx {
56 struct snd_ak4xxx_ops ops; 56 struct snd_ak4xxx_ops ops;
57}; 57};
58 58
59void snd_akm4xxx_write(akm4xxx_t *ak, int chip, unsigned char reg, unsigned char val); 59void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg, unsigned char val);
60void snd_akm4xxx_reset(akm4xxx_t *ak, int state); 60void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state);
61void snd_akm4xxx_init(akm4xxx_t *ak); 61void snd_akm4xxx_init(struct snd_akm4xxx *ak);
62int snd_akm4xxx_build_controls(akm4xxx_t *ak); 62int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak);
63 63
64#define snd_akm4xxx_get(ak,chip,reg) (ak)->images[(chip) * 16 + (reg)] 64#define snd_akm4xxx_get(ak,chip,reg) (ak)->images[(chip) * 16 + (reg)]
65#define snd_akm4xxx_set(ak,chip,reg,val) ((ak)->images[(chip) * 16 + (reg)] = (val)) 65#define snd_akm4xxx_set(ak,chip,reg,val) ((ak)->images[(chip) * 16 + (reg)] = (val))
diff --git a/include/sound/asequencer.h b/include/sound/asequencer.h
index 728efd504262..6691e4aa4ea7 100644
--- a/include/sound/asequencer.h
+++ b/include/sound/asequencer.h
@@ -22,11 +22,10 @@
22#ifndef __SOUND_ASEQUENCER_H 22#ifndef __SOUND_ASEQUENCER_H
23#define __SOUND_ASEQUENCER_H 23#define __SOUND_ASEQUENCER_H
24 24
25#ifndef __KERNEL__ 25#ifdef __KERNEL__
26#include <linux/ioctl.h> 26#include <linux/ioctl.h>
27#endif
28
29#include <sound/asound.h> 27#include <sound/asound.h>
28#endif
30 29
31/** version of the sequencer */ 30/** version of the sequencer */
32#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1) 31#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
@@ -36,13 +35,13 @@
36 */ 35 */
37 36
38/** system messages 37/** system messages
39 * event data type = #sndrv_seq_result_t 38 * event data type = #snd_seq_result
40 */ 39 */
41#define SNDRV_SEQ_EVENT_SYSTEM 0 40#define SNDRV_SEQ_EVENT_SYSTEM 0
42#define SNDRV_SEQ_EVENT_RESULT 1 41#define SNDRV_SEQ_EVENT_RESULT 1
43 42
44/** note messages (channel specific) 43/** note messages (channel specific)
45 * event data type = #sndrv_seq_ev_note 44 * event data type = #snd_seq_ev_note
46 */ 45 */
47#define SNDRV_SEQ_EVENT_NOTE 5 46#define SNDRV_SEQ_EVENT_NOTE 5
48#define SNDRV_SEQ_EVENT_NOTEON 6 47#define SNDRV_SEQ_EVENT_NOTEON 6
@@ -50,7 +49,7 @@
50#define SNDRV_SEQ_EVENT_KEYPRESS 8 49#define SNDRV_SEQ_EVENT_KEYPRESS 8
51 50
52/** control messages (channel specific) 51/** control messages (channel specific)
53 * event data type = #sndrv_seq_ev_ctrl 52 * event data type = #snd_seq_ev_ctrl
54 */ 53 */
55#define SNDRV_SEQ_EVENT_CONTROLLER 10 54#define SNDRV_SEQ_EVENT_CONTROLLER 10
56#define SNDRV_SEQ_EVENT_PGMCHANGE 11 55#define SNDRV_SEQ_EVENT_PGMCHANGE 11
@@ -61,7 +60,7 @@
61#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ 60#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
62 61
63/** synchronisation messages 62/** synchronisation messages
64 * event data type = #sndrv_seq_ev_ctrl 63 * event data type = #snd_seq_ev_ctrl
65 */ 64 */
66#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ 65#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
67#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ 66#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
@@ -70,7 +69,7 @@
70#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ 69#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
71 70
72/** timer messages 71/** timer messages
73 * event data type = sndrv_seq_ev_queue_control_t 72 * event data type = snd_seq_ev_queue_control
74 */ 73 */
75#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ 74#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
76#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ 75#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
@@ -96,7 +95,7 @@
96#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ 95#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
97 96
98/** system status messages (broadcast for subscribers) 97/** system status messages (broadcast for subscribers)
99 * event data type = sndrv_seq_addr_t 98 * event data type = snd_seq_addr
100 */ 99 */
101#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ 100#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
102#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ 101#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
@@ -106,13 +105,13 @@
106#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ 105#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
107 106
108/** port connection changes 107/** port connection changes
109 * event data type = sndrv_seq_connect_t 108 * event data type = snd_seq_connect
110 */ 109 */
111#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ 110#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
112#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ 111#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
113 112
114/** synthesizer events 113/** synthesizer events
115 * event data type = sndrv_seq_eve_sample_control_t 114 * event data type = snd_seq_eve_sample_control
116 */ 115 */
117#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */ 116#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */
118#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */ 117#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */
@@ -163,7 +162,7 @@
163/* 119-129: reserved */ 162/* 119-129: reserved */
164 163
165/* 130-139: variable length events 164/* 130-139: variable length events
166 * event data type = sndrv_seq_ev_ext 165 * event data type = snd_seq_ev_ext
167 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) 166 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
168 */ 167 */
169#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ 168#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
@@ -187,18 +186,18 @@
187#define SNDRV_SEQ_EVENT_NONE 255 186#define SNDRV_SEQ_EVENT_NONE 255
188 187
189 188
190typedef unsigned char sndrv_seq_event_type_t; 189typedef unsigned char snd_seq_event_type_t;
191 190
192/** event address */ 191/** event address */
193struct sndrv_seq_addr { 192struct snd_seq_addr {
194 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ 193 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
195 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ 194 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
196}; 195};
197 196
198/** port connection */ 197/** port connection */
199struct sndrv_seq_connect { 198struct snd_seq_connect {
200 struct sndrv_seq_addr sender; 199 struct snd_seq_addr sender;
201 struct sndrv_seq_addr dest; 200 struct snd_seq_addr dest;
202}; 201};
203 202
204 203
@@ -227,7 +226,7 @@ struct sndrv_seq_connect {
227 226
228 227
229 /* note event */ 228 /* note event */
230struct sndrv_seq_ev_note { 229struct snd_seq_ev_note {
231 unsigned char channel; 230 unsigned char channel;
232 unsigned char note; 231 unsigned char note;
233 unsigned char velocity; 232 unsigned char velocity;
@@ -236,7 +235,7 @@ struct sndrv_seq_ev_note {
236}; 235};
237 236
238 /* controller event */ 237 /* controller event */
239struct sndrv_seq_ev_ctrl { 238struct snd_seq_ev_ctrl {
240 unsigned char channel; 239 unsigned char channel;
241 unsigned char unused1, unused2, unused3; /* pad */ 240 unsigned char unused1, unused2, unused3; /* pad */
242 unsigned int param; 241 unsigned int param;
@@ -244,59 +243,59 @@ struct sndrv_seq_ev_ctrl {
244}; 243};
245 244
246 /* generic set of bytes (12x8 bit) */ 245 /* generic set of bytes (12x8 bit) */
247struct sndrv_seq_ev_raw8 { 246struct snd_seq_ev_raw8 {
248 unsigned char d[12]; /* 8 bit value */ 247 unsigned char d[12]; /* 8 bit value */
249}; 248};
250 249
251 /* generic set of integers (3x32 bit) */ 250 /* generic set of integers (3x32 bit) */
252struct sndrv_seq_ev_raw32 { 251struct snd_seq_ev_raw32 {
253 unsigned int d[3]; /* 32 bit value */ 252 unsigned int d[3]; /* 32 bit value */
254}; 253};
255 254
256 /* external stored data */ 255 /* external stored data */
257struct sndrv_seq_ev_ext { 256struct snd_seq_ev_ext {
258 unsigned int len; /* length of data */ 257 unsigned int len; /* length of data */
259 void *ptr; /* pointer to data (note: maybe 64-bit) */ 258 void *ptr; /* pointer to data (note: maybe 64-bit) */
260} __attribute__((packed)); 259} __attribute__((packed));
261 260
262/* Instrument cluster type */ 261/* Instrument cluster type */
263typedef unsigned int sndrv_seq_instr_cluster_t; 262typedef unsigned int snd_seq_instr_cluster_t;
264 263
265/* Instrument type */ 264/* Instrument type */
266struct sndrv_seq_instr { 265struct snd_seq_instr {
267 sndrv_seq_instr_cluster_t cluster; 266 snd_seq_instr_cluster_t cluster;
268 unsigned int std; /* the upper byte means a private instrument (owner - client #) */ 267 unsigned int std; /* the upper byte means a private instrument (owner - client #) */
269 unsigned short bank; 268 unsigned short bank;
270 unsigned short prg; 269 unsigned short prg;
271}; 270};
272 271
273 /* sample number */ 272 /* sample number */
274struct sndrv_seq_ev_sample { 273struct snd_seq_ev_sample {
275 unsigned int std; 274 unsigned int std;
276 unsigned short bank; 275 unsigned short bank;
277 unsigned short prg; 276 unsigned short prg;
278}; 277};
279 278
280 /* sample cluster */ 279 /* sample cluster */
281struct sndrv_seq_ev_cluster { 280struct snd_seq_ev_cluster {
282 sndrv_seq_instr_cluster_t cluster; 281 snd_seq_instr_cluster_t cluster;
283}; 282};
284 283
285 /* sample position */ 284 /* sample position */
286typedef unsigned int sndrv_seq_position_t; /* playback position (in samples) * 16 */ 285typedef unsigned int snd_seq_position_t; /* playback position (in samples) * 16 */
287 286
288 /* sample stop mode */ 287 /* sample stop mode */
289enum sndrv_seq_stop_mode { 288enum {
290 SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */ 289 SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */
291 SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */ 290 SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */
292 SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */ 291 SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */
293}; 292};
294 293
295 /* sample frequency */ 294 /* sample frequency */
296typedef int sndrv_seq_frequency_t; /* playback frequency in HZ * 16 */ 295typedef int snd_seq_frequency_t; /* playback frequency in HZ * 16 */
297 296
298 /* sample volume control; if any value is set to -1 == do not change */ 297 /* sample volume control; if any value is set to -1 == do not change */
299struct sndrv_seq_ev_volume { 298struct snd_seq_ev_volume {
300 signed short volume; /* range: 0-16383 */ 299 signed short volume; /* range: 0-16383 */
301 signed short lr; /* left-right balance; range: 0-16383 */ 300 signed short lr; /* left-right balance; range: 0-16383 */
302 signed short fr; /* front-rear balance; range: 0-16383 */ 301 signed short fr; /* front-rear balance; range: 0-16383 */
@@ -304,22 +303,22 @@ struct sndrv_seq_ev_volume {
304}; 303};
305 304
306 /* simple loop redefinition */ 305 /* simple loop redefinition */
307struct sndrv_seq_ev_loop { 306struct snd_seq_ev_loop {
308 unsigned int start; /* loop start (in samples) * 16 */ 307 unsigned int start; /* loop start (in samples) * 16 */
309 unsigned int end; /* loop end (in samples) * 16 */ 308 unsigned int end; /* loop end (in samples) * 16 */
310}; 309};
311 310
312struct sndrv_seq_ev_sample_control { 311struct snd_seq_ev_sample_control {
313 unsigned char channel; 312 unsigned char channel;
314 unsigned char unused1, unused2, unused3; /* pad */ 313 unsigned char unused1, unused2, unused3; /* pad */
315 union { 314 union {
316 struct sndrv_seq_ev_sample sample; 315 struct snd_seq_ev_sample sample;
317 struct sndrv_seq_ev_cluster cluster; 316 struct snd_seq_ev_cluster cluster;
318 sndrv_seq_position_t position; 317 snd_seq_position_t position;
319 enum sndrv_seq_stop_mode stop_mode; 318 int stop_mode;
320 sndrv_seq_frequency_t frequency; 319 snd_seq_frequency_t frequency;
321 struct sndrv_seq_ev_volume volume; 320 struct snd_seq_ev_volume volume;
322 struct sndrv_seq_ev_loop loop; 321 struct snd_seq_ev_loop loop;
323 unsigned char raw8[8]; 322 unsigned char raw8[8];
324 } param; 323 } param;
325}; 324};
@@ -327,82 +326,82 @@ struct sndrv_seq_ev_sample_control {
327 326
328 327
329/* INSTR_BEGIN event */ 328/* INSTR_BEGIN event */
330struct sndrv_seq_ev_instr_begin { 329struct snd_seq_ev_instr_begin {
331 int timeout; /* zero = forever, otherwise timeout in ms */ 330 int timeout; /* zero = forever, otherwise timeout in ms */
332}; 331};
333 332
334struct sndrv_seq_result { 333struct snd_seq_result {
335 int event; /* processed event type */ 334 int event; /* processed event type */
336 int result; 335 int result;
337}; 336};
338 337
339 338
340struct sndrv_seq_real_time { 339struct snd_seq_real_time {
341 unsigned int tv_sec; /* seconds */ 340 unsigned int tv_sec; /* seconds */
342 unsigned int tv_nsec; /* nanoseconds */ 341 unsigned int tv_nsec; /* nanoseconds */
343}; 342};
344 343
345typedef unsigned int sndrv_seq_tick_time_t; /* midi ticks */ 344typedef unsigned int snd_seq_tick_time_t; /* midi ticks */
346 345
347union sndrv_seq_timestamp { 346union snd_seq_timestamp {
348 sndrv_seq_tick_time_t tick; 347 snd_seq_tick_time_t tick;
349 struct sndrv_seq_real_time time; 348 struct snd_seq_real_time time;
350}; 349};
351 350
352struct sndrv_seq_queue_skew { 351struct snd_seq_queue_skew {
353 unsigned int value; 352 unsigned int value;
354 unsigned int base; 353 unsigned int base;
355}; 354};
356 355
357 /* queue timer control */ 356 /* queue timer control */
358struct sndrv_seq_ev_queue_control { 357struct snd_seq_ev_queue_control {
359 unsigned char queue; /* affected queue */ 358 unsigned char queue; /* affected queue */
360 unsigned char pad[3]; /* reserved */ 359 unsigned char pad[3]; /* reserved */
361 union { 360 union {
362 signed int value; /* affected value (e.g. tempo) */ 361 signed int value; /* affected value (e.g. tempo) */
363 union sndrv_seq_timestamp time; /* time */ 362 union snd_seq_timestamp time; /* time */
364 unsigned int position; /* sync position */ 363 unsigned int position; /* sync position */
365 struct sndrv_seq_queue_skew skew; 364 struct snd_seq_queue_skew skew;
366 unsigned int d32[2]; 365 unsigned int d32[2];
367 unsigned char d8[8]; 366 unsigned char d8[8];
368 } param; 367 } param;
369}; 368};
370 369
371 /* quoted event - inside the kernel only */ 370 /* quoted event - inside the kernel only */
372struct sndrv_seq_ev_quote { 371struct snd_seq_ev_quote {
373 struct sndrv_seq_addr origin; /* original sender */ 372 struct snd_seq_addr origin; /* original sender */
374 unsigned short value; /* optional data */ 373 unsigned short value; /* optional data */
375 struct sndrv_seq_event *event; /* quoted event */ 374 struct snd_seq_event *event; /* quoted event */
376} __attribute__((packed)); 375} __attribute__((packed));
377 376
378 377
379 /* sequencer event */ 378 /* sequencer event */
380struct sndrv_seq_event { 379struct snd_seq_event {
381 sndrv_seq_event_type_t type; /* event type */ 380 snd_seq_event_type_t type; /* event type */
382 unsigned char flags; /* event flags */ 381 unsigned char flags; /* event flags */
383 char tag; 382 char tag;
384 383
385 unsigned char queue; /* schedule queue */ 384 unsigned char queue; /* schedule queue */
386 union sndrv_seq_timestamp time; /* schedule time */ 385 union snd_seq_timestamp time; /* schedule time */
387 386
388 387
389 struct sndrv_seq_addr source; /* source address */ 388 struct snd_seq_addr source; /* source address */
390 struct sndrv_seq_addr dest; /* destination address */ 389 struct snd_seq_addr dest; /* destination address */
391 390
392 union { /* event data... */ 391 union { /* event data... */
393 struct sndrv_seq_ev_note note; 392 struct snd_seq_ev_note note;
394 struct sndrv_seq_ev_ctrl control; 393 struct snd_seq_ev_ctrl control;
395 struct sndrv_seq_ev_raw8 raw8; 394 struct snd_seq_ev_raw8 raw8;
396 struct sndrv_seq_ev_raw32 raw32; 395 struct snd_seq_ev_raw32 raw32;
397 struct sndrv_seq_ev_ext ext; 396 struct snd_seq_ev_ext ext;
398 struct sndrv_seq_ev_queue_control queue; 397 struct snd_seq_ev_queue_control queue;
399 union sndrv_seq_timestamp time; 398 union snd_seq_timestamp time;
400 struct sndrv_seq_addr addr; 399 struct snd_seq_addr addr;
401 struct sndrv_seq_connect connect; 400 struct snd_seq_connect connect;
402 struct sndrv_seq_result result; 401 struct snd_seq_result result;
403 struct sndrv_seq_ev_instr_begin instr_begin; 402 struct snd_seq_ev_instr_begin instr_begin;
404 struct sndrv_seq_ev_sample_control sample; 403 struct snd_seq_ev_sample_control sample;
405 struct sndrv_seq_ev_quote quote; 404 struct snd_seq_ev_quote quote;
406 } data; 405 } data;
407}; 406};
408 407
@@ -410,72 +409,77 @@ struct sndrv_seq_event {
410/* 409/*
411 * bounce event - stored as variable size data 410 * bounce event - stored as variable size data
412 */ 411 */
413struct sndrv_seq_event_bounce { 412struct snd_seq_event_bounce {
414 int err; 413 int err;
415 struct sndrv_seq_event event; 414 struct snd_seq_event event;
416 /* external data follows here. */ 415 /* external data follows here. */
417}; 416};
418 417
419#define sndrv_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(sndrv_seq_event_bounce_t))) 418#ifdef __KERNEL__
419
420/* helper macro */
421#define snd_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(struct snd_seq_event_bounce)))
420 422
421/* 423/*
422 * type check macros 424 * type check macros
423 */ 425 */
424/* result events: 0-4 */ 426/* result events: 0-4 */
425#define sndrv_seq_ev_is_result_type(ev) ((ev)->type < 5) 427#define snd_seq_ev_is_result_type(ev) ((ev)->type < 5)
426/* channel specific events: 5-19 */ 428/* channel specific events: 5-19 */
427#define sndrv_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20) 429#define snd_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20)
428/* note events: 5-9 */ 430/* note events: 5-9 */
429#define sndrv_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10) 431#define snd_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10)
430/* control events: 10-19 */ 432/* control events: 10-19 */
431#define sndrv_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20) 433#define snd_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20)
432/* queue control events: 30-39 */ 434/* queue control events: 30-39 */
433#define sndrv_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40) 435#define snd_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40)
434/* system status messages */ 436/* system status messages */
435#define sndrv_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69) 437#define snd_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69)
436/* sample messages */ 438/* sample messages */
437#define sndrv_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79) 439#define snd_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79)
438/* user-defined messages */ 440/* user-defined messages */
439#define sndrv_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99) 441#define snd_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
440/* fixed length events: 0-99 */ 442/* fixed length events: 0-99 */
441#define sndrv_seq_ev_is_fixed_type(ev) ((ev)->type < 100) 443#define snd_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
442/* instrument layer events: 100-129 */ 444/* instrument layer events: 100-129 */
443#define sndrv_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130) 445#define snd_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130)
444/* variable length events: 130-139 */ 446/* variable length events: 130-139 */
445#define sndrv_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140) 447#define snd_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
446/* reserved for kernel */ 448/* reserved for kernel */
447#define sndrv_seq_ev_is_reserved(ev) ((ev)->type >= 150) 449#define snd_seq_ev_is_reserved(ev) ((ev)->type >= 150)
448 450
449/* direct dispatched events */ 451/* direct dispatched events */
450#define sndrv_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT) 452#define snd_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT)
451 453
452/* 454/*
453 * macros to check event flags 455 * macros to check event flags
454 */ 456 */
455/* prior events */ 457/* prior events */
456#define sndrv_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH) 458#define snd_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH)
457 459
458/* event length type */ 460/* event length type */
459#define sndrv_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) 461#define snd_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK)
460#define sndrv_seq_ev_is_fixed(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED) 462#define snd_seq_ev_is_fixed(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED)
461#define sndrv_seq_ev_is_variable(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE) 463#define snd_seq_ev_is_variable(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
462#define sndrv_seq_ev_is_varusr(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR) 464#define snd_seq_ev_is_varusr(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR)
463 465
464/* time-stamp type */ 466/* time-stamp type */
465#define sndrv_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK) 467#define snd_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK)
466#define sndrv_seq_ev_is_tick(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK) 468#define snd_seq_ev_is_tick(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK)
467#define sndrv_seq_ev_is_real(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL) 469#define snd_seq_ev_is_real(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL)
468 470
469/* time-mode type */ 471/* time-mode type */
470#define sndrv_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK) 472#define snd_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK)
471#define sndrv_seq_ev_is_abstime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS) 473#define snd_seq_ev_is_abstime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS)
472#define sndrv_seq_ev_is_reltime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL) 474#define snd_seq_ev_is_reltime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL)
473 475
474/* queue sync port */ 476/* queue sync port */
475#define sndrv_seq_queue_sync_port(q) ((q) + 16) 477#define snd_seq_queue_sync_port(q) ((q) + 16)
478
479#endif /* __KERNEL__ */
476 480
477 /* system information */ 481 /* system information */
478struct sndrv_seq_system_info { 482struct snd_seq_system_info {
479 int queues; /* maximum queues count */ 483 int queues; /* maximum queues count */
480 int clients; /* maximum clients count */ 484 int clients; /* maximum clients count */
481 int ports; /* maximum ports per client */ 485 int ports; /* maximum ports per client */
@@ -487,7 +491,7 @@ struct sndrv_seq_system_info {
487 491
488 492
489 /* system running information */ 493 /* system running information */
490struct sndrv_seq_running_info { 494struct snd_seq_running_info {
491 unsigned char client; /* client id */ 495 unsigned char client; /* client id */
492 unsigned char big_endian; /* 1 = big-endian */ 496 unsigned char big_endian; /* 1 = big-endian */
493 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ 497 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
@@ -498,16 +502,16 @@ struct sndrv_seq_running_info {
498 502
499 /* known client numbers */ 503 /* known client numbers */
500#define SNDRV_SEQ_CLIENT_SYSTEM 0 504#define SNDRV_SEQ_CLIENT_SYSTEM 0
501#define SNDRV_SEQ_CLIENT_DUMMY 62 /* dummy ports */ 505 /* internal client numbers */
502#define SNDRV_SEQ_CLIENT_OSS 63 /* oss sequencer emulator */ 506#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */
507#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */
503 508
504 509
505 /* client types */ 510 /* client types */
506enum sndrv_seq_client_type { 511typedef int __bitwise snd_seq_client_type_t;
507 NO_CLIENT = 0, 512#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
508 USER_CLIENT = 1, 513#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
509 KERNEL_CLIENT = 2 514#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
510};
511 515
512 /* event filter flags */ 516 /* event filter flags */
513#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ 517#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
@@ -515,9 +519,9 @@ enum sndrv_seq_client_type {
515#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ 519#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
516#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ 520#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
517 521
518struct sndrv_seq_client_info { 522struct snd_seq_client_info {
519 int client; /* client number to inquire */ 523 int client; /* client number to inquire */
520 enum sndrv_seq_client_type type; /* client type */ 524 snd_seq_client_type_t type; /* client type */
521 char name[64]; /* client name */ 525 char name[64]; /* client name */
522 unsigned int filter; /* filter flags */ 526 unsigned int filter; /* filter flags */
523 unsigned char multicast_filter[8]; /* multicast filter bitmap */ 527 unsigned char multicast_filter[8]; /* multicast filter bitmap */
@@ -529,7 +533,7 @@ struct sndrv_seq_client_info {
529 533
530 534
531/* client pool size */ 535/* client pool size */
532struct sndrv_seq_client_pool { 536struct snd_seq_client_pool {
533 int client; /* client number to inquire */ 537 int client; /* client number to inquire */
534 int output_pool; /* outgoing (write) pool size */ 538 int output_pool; /* outgoing (write) pool size */
535 int input_pool; /* incoming (read) pool size */ 539 int input_pool; /* incoming (read) pool size */
@@ -553,13 +557,13 @@ struct sndrv_seq_client_pool {
553#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ 557#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
554#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ 558#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
555 559
556struct sndrv_seq_remove_events { 560struct snd_seq_remove_events {
557 unsigned int remove_mode; /* Flags that determine what gets removed */ 561 unsigned int remove_mode; /* Flags that determine what gets removed */
558 562
559 union sndrv_seq_timestamp time; 563 union snd_seq_timestamp time;
560 564
561 unsigned char queue; /* Queue for REMOVE_DEST */ 565 unsigned char queue; /* Queue for REMOVE_DEST */
562 struct sndrv_seq_addr dest; /* Address for REMOVE_DEST */ 566 struct snd_seq_addr dest; /* Address for REMOVE_DEST */
563 unsigned char channel; /* Channel for REMOVE_DEST */ 567 unsigned char channel; /* Channel for REMOVE_DEST */
564 568
565 int type; /* For REMOVE_EVENT_TYPE */ 569 int type; /* For REMOVE_EVENT_TYPE */
@@ -608,8 +612,8 @@ struct sndrv_seq_remove_events {
608#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) 612#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
609#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) 613#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
610 614
611struct sndrv_seq_port_info { 615struct snd_seq_port_info {
612 struct sndrv_seq_addr addr; /* client/port numbers */ 616 struct snd_seq_addr addr; /* client/port numbers */
613 char name[64]; /* port name */ 617 char name[64]; /* port name */
614 618
615 unsigned int capability; /* port capability bits */ 619 unsigned int capability; /* port capability bits */
@@ -632,7 +636,7 @@ struct sndrv_seq_port_info {
632#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ 636#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
633 637
634/* queue information */ 638/* queue information */
635struct sndrv_seq_queue_info { 639struct snd_seq_queue_info {
636 int queue; /* queue id */ 640 int queue; /* queue id */
637 641
638 /* 642 /*
@@ -648,11 +652,11 @@ struct sndrv_seq_queue_info {
648}; 652};
649 653
650/* queue info/status */ 654/* queue info/status */
651struct sndrv_seq_queue_status { 655struct snd_seq_queue_status {
652 int queue; /* queue id */ 656 int queue; /* queue id */
653 int events; /* read-only - queue size */ 657 int events; /* read-only - queue size */
654 sndrv_seq_tick_time_t tick; /* current tick */ 658 snd_seq_tick_time_t tick; /* current tick */
655 struct sndrv_seq_real_time time; /* current time */ 659 struct snd_seq_real_time time; /* current time */
656 int running; /* running state of queue */ 660 int running; /* running state of queue */
657 int flags; /* various flags */ 661 int flags; /* various flags */
658 char reserved[64]; /* for the future */ 662 char reserved[64]; /* for the future */
@@ -660,7 +664,7 @@ struct sndrv_seq_queue_status {
660 664
661 665
662/* queue tempo */ 666/* queue tempo */
663struct sndrv_seq_queue_tempo { 667struct snd_seq_queue_tempo {
664 int queue; /* sequencer queue */ 668 int queue; /* sequencer queue */
665 unsigned int tempo; /* current tempo, us/tick */ 669 unsigned int tempo; /* current tempo, us/tick */
666 int ppq; /* time resolution, ticks/quarter */ 670 int ppq; /* time resolution, ticks/quarter */
@@ -676,12 +680,12 @@ struct sndrv_seq_queue_tempo {
676#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ 680#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
677 681
678/* queue timer info */ 682/* queue timer info */
679struct sndrv_seq_queue_timer { 683struct snd_seq_queue_timer {
680 int queue; /* sequencer queue */ 684 int queue; /* sequencer queue */
681 int type; /* source timer type */ 685 int type; /* source timer type */
682 union { 686 union {
683 struct { 687 struct {
684 struct sndrv_timer_id id; /* ALSA's timer ID */ 688 struct snd_timer_id id; /* ALSA's timer ID */
685 unsigned int resolution; /* resolution in Hz */ 689 unsigned int resolution; /* resolution in Hz */
686 } alsa; 690 } alsa;
687 } u; 691 } u;
@@ -689,7 +693,7 @@ struct sndrv_seq_queue_timer {
689}; 693};
690 694
691 695
692struct sndrv_seq_queue_client { 696struct snd_seq_queue_client {
693 int queue; /* sequencer queue */ 697 int queue; /* sequencer queue */
694 int client; /* sequencer client */ 698 int client; /* sequencer client */
695 int used; /* queue is used with this client 699 int used; /* queue is used with this client
@@ -703,9 +707,9 @@ struct sndrv_seq_queue_client {
703#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) 707#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
704#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) 708#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
705 709
706struct sndrv_seq_port_subscribe { 710struct snd_seq_port_subscribe {
707 struct sndrv_seq_addr sender; /* sender address */ 711 struct snd_seq_addr sender; /* sender address */
708 struct sndrv_seq_addr dest; /* destination address */ 712 struct snd_seq_addr dest; /* destination address */
709 unsigned int voices; /* number of voices to be allocated (0 = don't care) */ 713 unsigned int voices; /* number of voices to be allocated (0 = don't care) */
710 unsigned int flags; /* modes */ 714 unsigned int flags; /* modes */
711 unsigned char queue; /* input time-stamp queue (optional) */ 715 unsigned char queue; /* input time-stamp queue (optional) */
@@ -717,12 +721,12 @@ struct sndrv_seq_port_subscribe {
717#define SNDRV_SEQ_QUERY_SUBS_READ 0 721#define SNDRV_SEQ_QUERY_SUBS_READ 0
718#define SNDRV_SEQ_QUERY_SUBS_WRITE 1 722#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
719 723
720struct sndrv_seq_query_subs { 724struct snd_seq_query_subs {
721 struct sndrv_seq_addr root; /* client/port id to be searched */ 725 struct snd_seq_addr root; /* client/port id to be searched */
722 int type; /* READ or WRITE */ 726 int type; /* READ or WRITE */
723 int index; /* 0..N-1 */ 727 int index; /* 0..N-1 */
724 int num_subs; /* R/O: number of subscriptions on this port */ 728 int num_subs; /* R/O: number of subscriptions on this port */
725 struct sndrv_seq_addr addr; /* R/O: result */ 729 struct snd_seq_addr addr; /* R/O: result */
726 unsigned char queue; /* R/O: result */ 730 unsigned char queue; /* R/O: result */
727 unsigned int flags; /* R/O: result */ 731 unsigned int flags; /* R/O: result */
728 char reserved[64]; /* for future use */ 732 char reserved[64]; /* for future use */
@@ -779,72 +783,72 @@ struct sndrv_seq_query_subs {
779#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3 783#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3
780 784
781/* size of ROM/RAM */ 785/* size of ROM/RAM */
782typedef unsigned int sndrv_seq_instr_size_t; 786typedef unsigned int snd_seq_instr_size_t;
783 787
784/* INSTR_INFO */ 788/* INSTR_INFO */
785 789
786struct sndrv_seq_instr_info { 790struct snd_seq_instr_info {
787 int result; /* operation result */ 791 int result; /* operation result */
788 unsigned int formats[8]; /* bitmap of supported formats */ 792 unsigned int formats[8]; /* bitmap of supported formats */
789 int ram_count; /* count of RAM banks */ 793 int ram_count; /* count of RAM banks */
790 sndrv_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */ 794 snd_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */
791 int rom_count; /* count of ROM banks */ 795 int rom_count; /* count of ROM banks */
792 sndrv_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */ 796 snd_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */
793 char reserved[128]; 797 char reserved[128];
794}; 798};
795 799
796/* INSTR_STATUS */ 800/* INSTR_STATUS */
797 801
798struct sndrv_seq_instr_status { 802struct snd_seq_instr_status {
799 int result; /* operation result */ 803 int result; /* operation result */
800 sndrv_seq_instr_size_t free_ram[16]; /* free RAM in banks */ 804 snd_seq_instr_size_t free_ram[16]; /* free RAM in banks */
801 int instrument_count; /* count of downloaded instruments */ 805 int instrument_count; /* count of downloaded instruments */
802 char reserved[128]; 806 char reserved[128];
803}; 807};
804 808
805/* INSTR_FORMAT_INFO */ 809/* INSTR_FORMAT_INFO */
806 810
807struct sndrv_seq_instr_format_info { 811struct snd_seq_instr_format_info {
808 char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */ 812 char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
809 unsigned int len; /* max data length (without this structure) */ 813 unsigned int len; /* max data length (without this structure) */
810}; 814};
811 815
812struct sndrv_seq_instr_format_info_result { 816struct snd_seq_instr_format_info_result {
813 int result; /* operation result */ 817 int result; /* operation result */
814 char format[16]; /* format identifier */ 818 char format[16]; /* format identifier */
815 unsigned int len; /* filled data length (without this structure) */ 819 unsigned int len; /* filled data length (without this structure) */
816}; 820};
817 821
818/* instrument data */ 822/* instrument data */
819struct sndrv_seq_instr_data { 823struct snd_seq_instr_data {
820 char name[32]; /* instrument name */ 824 char name[32]; /* instrument name */
821 char reserved[16]; /* for the future use */ 825 char reserved[16]; /* for the future use */
822 int type; /* instrument type */ 826 int type; /* instrument type */
823 union { 827 union {
824 char format[16]; /* format identifier */ 828 char format[16]; /* format identifier */
825 struct sndrv_seq_instr alias; 829 struct snd_seq_instr alias;
826 } data; 830 } data;
827}; 831};
828 832
829/* INSTR_PUT/GET, data are stored in one block (extended), header + data */ 833/* INSTR_PUT/GET, data are stored in one block (extended), header + data */
830 834
831struct sndrv_seq_instr_header { 835struct snd_seq_instr_header {
832 union { 836 union {
833 struct sndrv_seq_instr instr; 837 struct snd_seq_instr instr;
834 sndrv_seq_instr_cluster_t cluster; 838 snd_seq_instr_cluster_t cluster;
835 } id; /* instrument identifier */ 839 } id; /* instrument identifier */
836 unsigned int cmd; /* get/put/free command */ 840 unsigned int cmd; /* get/put/free command */
837 unsigned int flags; /* query flags (only for get) */ 841 unsigned int flags; /* query flags (only for get) */
838 unsigned int len; /* real instrument data length (without header) */ 842 unsigned int len; /* real instrument data length (without header) */
839 int result; /* operation result */ 843 int result; /* operation result */
840 char reserved[16]; /* for the future */ 844 char reserved[16]; /* for the future */
841 struct sndrv_seq_instr_data data; /* instrument data (for put/get result) */ 845 struct snd_seq_instr_data data; /* instrument data (for put/get result) */
842}; 846};
843 847
844/* INSTR_CLUSTER_SET */ 848/* INSTR_CLUSTER_SET */
845 849
846struct sndrv_seq_instr_cluster_set { 850struct snd_seq_instr_cluster_set {
847 sndrv_seq_instr_cluster_t cluster; /* cluster identifier */ 851 snd_seq_instr_cluster_t cluster; /* cluster identifier */
848 char name[32]; /* cluster name */ 852 char name[32]; /* cluster name */
849 int priority; /* cluster priority */ 853 int priority; /* cluster priority */
850 char reserved[64]; /* for the future use */ 854 char reserved[64]; /* for the future use */
@@ -852,8 +856,8 @@ struct sndrv_seq_instr_cluster_set {
852 856
853/* INSTR_CLUSTER_GET */ 857/* INSTR_CLUSTER_GET */
854 858
855struct sndrv_seq_instr_cluster_get { 859struct snd_seq_instr_cluster_get {
856 sndrv_seq_instr_cluster_t cluster; /* cluster identifier */ 860 snd_seq_instr_cluster_t cluster; /* cluster identifier */
857 char name[32]; /* cluster name */ 861 char name[32]; /* cluster name */
858 int priority; /* cluster priority */ 862 int priority; /* cluster priority */
859 char reserved[64]; /* for the future use */ 863 char reserved[64]; /* for the future use */
@@ -865,44 +869,44 @@ struct sndrv_seq_instr_cluster_get {
865 869
866#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) 870#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
867#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) 871#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
868#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct sndrv_seq_system_info) 872#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
869#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct sndrv_seq_running_info) 873#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
870 874
871#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct sndrv_seq_client_info) 875#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
872#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct sndrv_seq_client_info) 876#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
873 877
874#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct sndrv_seq_port_info) 878#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
875#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct sndrv_seq_port_info) 879#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
876#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct sndrv_seq_port_info) 880#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
877#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct sndrv_seq_port_info) 881#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
878 882
879#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct sndrv_seq_port_subscribe) 883#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
880#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct sndrv_seq_port_subscribe) 884#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
881 885
882#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct sndrv_seq_queue_info) 886#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
883#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct sndrv_seq_queue_info) 887#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
884#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct sndrv_seq_queue_info) 888#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
885#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct sndrv_seq_queue_info) 889#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
886#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct sndrv_seq_queue_info) 890#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
887#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct sndrv_seq_queue_status) 891#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
888#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct sndrv_seq_queue_tempo) 892#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
889#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct sndrv_seq_queue_tempo) 893#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
890#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct sndrv_seq_queue_owner) 894#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct snd_seq_queue_owner)
891#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct sndrv_seq_queue_owner) 895#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct snd_seq_queue_owner)
892#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct sndrv_seq_queue_timer) 896#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
893#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct sndrv_seq_queue_timer) 897#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
894/* XXX 898/* XXX
895#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct sndrv_seq_queue_sync) 899#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync)
896#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct sndrv_seq_queue_sync) 900#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync)
897*/ 901*/
898#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct sndrv_seq_queue_client) 902#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
899#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct sndrv_seq_queue_client) 903#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
900#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct sndrv_seq_client_pool) 904#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
901#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct sndrv_seq_client_pool) 905#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
902#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct sndrv_seq_remove_events) 906#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
903#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct sndrv_seq_query_subs) 907#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
904#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct sndrv_seq_port_subscribe) 908#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
905#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct sndrv_seq_client_info) 909#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
906#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct sndrv_seq_port_info) 910#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
907 911
908#endif /* __SOUND_ASEQUENCER_H */ 912#endif /* __SOUND_ASEQUENCER_H */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 8e552d627fa5..9cc021c7ee11 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -23,12 +23,8 @@
23#ifndef __SOUND_ASOUND_H 23#ifndef __SOUND_ASOUND_H
24#define __SOUND_ASOUND_H 24#define __SOUND_ASOUND_H
25 25
26#if defined(LINUX) || defined(__LINUX__) || defined(__linux__)
27
28#include <linux/ioctl.h>
29
30#ifdef __KERNEL__ 26#ifdef __KERNEL__
31 27#include <linux/ioctl.h>
32#include <linux/types.h> 28#include <linux/types.h>
33#include <linux/time.h> 29#include <linux/time.h>
34#include <asm/byteorder.h> 30#include <asm/byteorder.h>
@@ -43,25 +39,7 @@
43#endif 39#endif
44#endif 40#endif
45 41
46#else /* !__KERNEL__ */ 42#endif /* __KERNEL__ **/
47
48#include <endian.h>
49#if __BYTE_ORDER == __LITTLE_ENDIAN
50#define SNDRV_LITTLE_ENDIAN
51#elif __BYTE_ORDER == __BIG_ENDIAN
52#define SNDRV_BIG_ENDIAN
53#else
54#error "Unsupported endian..."
55#endif
56
57#endif /* __KERNEL **/
58
59#endif /* LINUX */
60
61#ifndef __KERNEL__
62#include <sys/time.h>
63#include <sys/types.h>
64#endif
65 43
66/* 44/*
67 * protocol version 45 * protocol version
@@ -82,7 +60,7 @@
82 * * 60 * *
83 ****************************************************************************/ 61 ****************************************************************************/
84 62
85struct sndrv_aes_iec958 { 63struct snd_aes_iec958 {
86 unsigned char status[24]; /* AES/IEC958 channel status bits */ 64 unsigned char status[24]; /* AES/IEC958 channel status bits */
87 unsigned char subcode[147]; /* AES/IEC958 subcode bits */ 65 unsigned char subcode[147]; /* AES/IEC958 subcode bits */
88 unsigned char pad; /* nothing */ 66 unsigned char pad; /* nothing */
@@ -97,7 +75,7 @@ struct sndrv_aes_iec958 {
97 75
98#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) 76#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
99 77
100enum sndrv_hwdep_iface { 78enum {
101 SNDRV_HWDEP_IFACE_OPL2 = 0, 79 SNDRV_HWDEP_IFACE_OPL2 = 0,
102 SNDRV_HWDEP_IFACE_OPL3, 80 SNDRV_HWDEP_IFACE_OPL3,
103 SNDRV_HWDEP_IFACE_OPL4, 81 SNDRV_HWDEP_IFACE_OPL4,
@@ -119,17 +97,17 @@ enum sndrv_hwdep_iface {
119 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_SB_RC 97 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_SB_RC
120}; 98};
121 99
122struct sndrv_hwdep_info { 100struct snd_hwdep_info {
123 unsigned int device; /* WR: device number */ 101 unsigned int device; /* WR: device number */
124 int card; /* R: card number */ 102 int card; /* R: card number */
125 unsigned char id[64]; /* ID (user selectable) */ 103 unsigned char id[64]; /* ID (user selectable) */
126 unsigned char name[80]; /* hwdep name */ 104 unsigned char name[80]; /* hwdep name */
127 enum sndrv_hwdep_iface iface; /* hwdep interface */ 105 int iface; /* hwdep interface */
128 unsigned char reserved[64]; /* reserved for future */ 106 unsigned char reserved[64]; /* reserved for future */
129}; 107};
130 108
131/* generic DSP loader */ 109/* generic DSP loader */
132struct sndrv_hwdep_dsp_status { 110struct snd_hwdep_dsp_status {
133 unsigned int version; /* R: driver-specific version */ 111 unsigned int version; /* R: driver-specific version */
134 unsigned char id[32]; /* R: driver-specific ID string */ 112 unsigned char id[32]; /* R: driver-specific ID string */
135 unsigned int num_dsps; /* R: number of DSP images to transfer */ 113 unsigned int num_dsps; /* R: number of DSP images to transfer */
@@ -138,7 +116,7 @@ struct sndrv_hwdep_dsp_status {
138 unsigned char reserved[16]; /* reserved for future use */ 116 unsigned char reserved[16]; /* reserved for future use */
139}; 117};
140 118
141struct sndrv_hwdep_dsp_image { 119struct snd_hwdep_dsp_image {
142 unsigned int index; /* W: DSP index */ 120 unsigned int index; /* W: DSP index */
143 unsigned char name[64]; /* W: ID (e.g. file name) */ 121 unsigned char name[64]; /* W: ID (e.g. file name) */
144 unsigned char __user *image; /* W: binary image */ 122 unsigned char __user *image; /* W: binary image */
@@ -148,9 +126,9 @@ struct sndrv_hwdep_dsp_image {
148 126
149enum { 127enum {
150 SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int), 128 SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int),
151 SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct sndrv_hwdep_info), 129 SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct snd_hwdep_info),
152 SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct sndrv_hwdep_dsp_status), 130 SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct snd_hwdep_dsp_status),
153 SNDRV_HWDEP_IOCTL_DSP_LOAD = _IOW('H', 0x03, struct sndrv_hwdep_dsp_image) 131 SNDRV_HWDEP_IOCTL_DSP_LOAD = _IOW('H', 0x03, struct snd_hwdep_dsp_image)
154}; 132};
155 133
156/***************************************************************************** 134/*****************************************************************************
@@ -161,10 +139,10 @@ enum {
161 139
162#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) 140#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
163 141
164typedef unsigned long sndrv_pcm_uframes_t; 142typedef unsigned long snd_pcm_uframes_t;
165typedef long sndrv_pcm_sframes_t; 143typedef signed long snd_pcm_sframes_t;
166 144
167enum sndrv_pcm_class { 145enum {
168 SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */ 146 SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */
169 SNDRV_PCM_CLASS_MULTI, /* multichannel device */ 147 SNDRV_PCM_CLASS_MULTI, /* multichannel device */
170 SNDRV_PCM_CLASS_MODEM, /* software modem class */ 148 SNDRV_PCM_CLASS_MODEM, /* software modem class */
@@ -173,97 +151,94 @@ enum sndrv_pcm_class {
173 SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER, 151 SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
174}; 152};
175 153
176enum sndrv_pcm_subclass { 154enum {
177 SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */ 155 SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
178 SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */ 156 SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */
179 /* Don't forget to change the following: */ 157 /* Don't forget to change the following: */
180 SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX, 158 SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
181}; 159};
182 160
183enum sndrv_pcm_stream { 161enum {
184 SNDRV_PCM_STREAM_PLAYBACK = 0, 162 SNDRV_PCM_STREAM_PLAYBACK = 0,
185 SNDRV_PCM_STREAM_CAPTURE, 163 SNDRV_PCM_STREAM_CAPTURE,
186 SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE, 164 SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
187}; 165};
188 166
189enum sndrv_pcm_access { 167typedef int __bitwise snd_pcm_access_t;
190 SNDRV_PCM_ACCESS_MMAP_INTERLEAVED = 0, /* interleaved mmap */ 168#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */
191 SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED, /* noninterleaved mmap */ 169#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
192 SNDRV_PCM_ACCESS_MMAP_COMPLEX, /* complex mmap */ 170#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */
193 SNDRV_PCM_ACCESS_RW_INTERLEAVED, /* readi/writei */ 171#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */
194 SNDRV_PCM_ACCESS_RW_NONINTERLEAVED, /* readn/writen */ 172#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */
195 SNDRV_PCM_ACCESS_LAST = SNDRV_PCM_ACCESS_RW_NONINTERLEAVED, 173#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
196}; 174
197 175typedef int __bitwise snd_pcm_format_t;
198enum sndrv_pcm_format { 176#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0)
199 SNDRV_PCM_FORMAT_S8 = 0, 177#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1)
200 SNDRV_PCM_FORMAT_U8, 178#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
201 SNDRV_PCM_FORMAT_S16_LE, 179#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
202 SNDRV_PCM_FORMAT_S16_BE, 180#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
203 SNDRV_PCM_FORMAT_U16_LE, 181#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
204 SNDRV_PCM_FORMAT_U16_BE, 182#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */
205 SNDRV_PCM_FORMAT_S24_LE, /* low three bytes */ 183#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
206 SNDRV_PCM_FORMAT_S24_BE, /* low three bytes */ 184#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
207 SNDRV_PCM_FORMAT_U24_LE, /* low three bytes */ 185#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
208 SNDRV_PCM_FORMAT_U24_BE, /* low three bytes */ 186#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
209 SNDRV_PCM_FORMAT_S32_LE, 187#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
210 SNDRV_PCM_FORMAT_S32_BE, 188#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
211 SNDRV_PCM_FORMAT_U32_LE, 189#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
212 SNDRV_PCM_FORMAT_U32_BE, 190#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
213 SNDRV_PCM_FORMAT_FLOAT_LE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ 191#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
214 SNDRV_PCM_FORMAT_FLOAT_BE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ 192#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
215 SNDRV_PCM_FORMAT_FLOAT64_LE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ 193#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
216 SNDRV_PCM_FORMAT_FLOAT64_BE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ 194#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
217 SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, /* IEC-958 subframe, Little Endian */ 195#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
218 SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, /* IEC-958 subframe, Big Endian */ 196#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20)
219 SNDRV_PCM_FORMAT_MU_LAW, 197#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21)
220 SNDRV_PCM_FORMAT_A_LAW, 198#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22)
221 SNDRV_PCM_FORMAT_IMA_ADPCM, 199#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23)
222 SNDRV_PCM_FORMAT_MPEG, 200#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24)
223 SNDRV_PCM_FORMAT_GSM, 201#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31)
224 SNDRV_PCM_FORMAT_SPECIAL = 31, 202#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */
225 SNDRV_PCM_FORMAT_S24_3LE = 32, /* in three bytes */ 203#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */
226 SNDRV_PCM_FORMAT_S24_3BE, /* in three bytes */ 204#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */
227 SNDRV_PCM_FORMAT_U24_3LE, /* in three bytes */ 205#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */
228 SNDRV_PCM_FORMAT_U24_3BE, /* in three bytes */ 206#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */
229 SNDRV_PCM_FORMAT_S20_3LE, /* in three bytes */ 207#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */
230 SNDRV_PCM_FORMAT_S20_3BE, /* in three bytes */ 208#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */
231 SNDRV_PCM_FORMAT_U20_3LE, /* in three bytes */ 209#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */
232 SNDRV_PCM_FORMAT_U20_3BE, /* in three bytes */ 210#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */
233 SNDRV_PCM_FORMAT_S18_3LE, /* in three bytes */ 211#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */
234 SNDRV_PCM_FORMAT_S18_3BE, /* in three bytes */ 212#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */
235 SNDRV_PCM_FORMAT_U18_3LE, /* in three bytes */ 213#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */
236 SNDRV_PCM_FORMAT_U18_3BE, /* in three bytes */ 214#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_U18_3BE
237 SNDRV_PCM_FORMAT_LAST = SNDRV_PCM_FORMAT_U18_3BE,
238 215
239#ifdef SNDRV_LITTLE_ENDIAN 216#ifdef SNDRV_LITTLE_ENDIAN
240 SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_LE, 217#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
241 SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_LE, 218#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE
242 SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_LE, 219#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE
243 SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_LE, 220#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE
244 SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_LE, 221#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE
245 SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_LE, 222#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE
246 SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_LE, 223#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE
247 SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_LE, 224#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE
248 SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, 225#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
249#endif 226#endif
250#ifdef SNDRV_BIG_ENDIAN 227#ifdef SNDRV_BIG_ENDIAN
251 SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_BE, 228#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE
252 SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_BE, 229#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE
253 SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_BE, 230#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE
254 SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_BE, 231#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE
255 SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_BE, 232#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE
256 SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_BE, 233#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE
257 SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_BE, 234#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE
258 SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_BE, 235#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE
259 SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, 236#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
260#endif 237#endif
261};
262 238
263enum sndrv_pcm_subformat { 239typedef int __bitwise snd_pcm_subformat_t;
264 SNDRV_PCM_SUBFORMAT_STD = 0, 240#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0)
265 SNDRV_PCM_SUBFORMAT_LAST = SNDRV_PCM_SUBFORMAT_STD, 241#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
266};
267 242
268#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */ 243#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
269#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */ 244#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
@@ -280,18 +255,17 @@ enum sndrv_pcm_subformat {
280#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ 255#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
281#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ 256#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
282 257
283enum sndrv_pcm_state { 258typedef int __bitwise snd_pcm_state_t;
284 SNDRV_PCM_STATE_OPEN = 0, /* stream is open */ 259#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
285 SNDRV_PCM_STATE_SETUP, /* stream has a setup */ 260#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */
286 SNDRV_PCM_STATE_PREPARED, /* stream is ready to start */ 261#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */
287 SNDRV_PCM_STATE_RUNNING, /* stream is running */ 262#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */
288 SNDRV_PCM_STATE_XRUN, /* stream reached an xrun */ 263#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */
289 SNDRV_PCM_STATE_DRAINING, /* stream is draining */ 264#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */
290 SNDRV_PCM_STATE_PAUSED, /* stream is paused */ 265#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */
291 SNDRV_PCM_STATE_SUSPENDED, /* hardware is suspended */ 266#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */
292 SNDRV_PCM_STATE_DISCONNECTED, /* hardware is disconnected */ 267#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */
293 SNDRV_PCM_STATE_LAST = SNDRV_PCM_STATE_DISCONNECTED, 268#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
294};
295 269
296enum { 270enum {
297 SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, 271 SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
@@ -299,55 +273,53 @@ enum {
299 SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000, 273 SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
300}; 274};
301 275
302union sndrv_pcm_sync_id { 276union snd_pcm_sync_id {
303 unsigned char id[16]; 277 unsigned char id[16];
304 unsigned short id16[8]; 278 unsigned short id16[8];
305 unsigned int id32[4]; 279 unsigned int id32[4];
306}; 280};
307 281
308struct sndrv_pcm_info { 282struct snd_pcm_info {
309 unsigned int device; /* RO/WR (control): device number */ 283 unsigned int device; /* RO/WR (control): device number */
310 unsigned int subdevice; /* RO/WR (control): subdevice number */ 284 unsigned int subdevice; /* RO/WR (control): subdevice number */
311 enum sndrv_pcm_stream stream; /* RO/WR (control): stream number */ 285 int stream; /* RO/WR (control): stream direction */
312 int card; /* R: card number */ 286 int card; /* R: card number */
313 unsigned char id[64]; /* ID (user selectable) */ 287 unsigned char id[64]; /* ID (user selectable) */
314 unsigned char name[80]; /* name of this device */ 288 unsigned char name[80]; /* name of this device */
315 unsigned char subname[32]; /* subdevice name */ 289 unsigned char subname[32]; /* subdevice name */
316 enum sndrv_pcm_class dev_class; /* SNDRV_PCM_CLASS_* */ 290 int dev_class; /* SNDRV_PCM_CLASS_* */
317 enum sndrv_pcm_subclass dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ 291 int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
318 unsigned int subdevices_count; 292 unsigned int subdevices_count;
319 unsigned int subdevices_avail; 293 unsigned int subdevices_avail;
320 union sndrv_pcm_sync_id sync; /* hardware synchronization ID */ 294 union snd_pcm_sync_id sync; /* hardware synchronization ID */
321 unsigned char reserved[64]; /* reserved for future... */ 295 unsigned char reserved[64]; /* reserved for future... */
322}; 296};
323 297
324enum sndrv_pcm_hw_param { 298typedef int __bitwise snd_pcm_hw_param_t;
325 SNDRV_PCM_HW_PARAM_ACCESS = 0, /* Access type */ 299#define SNDRV_PCM_HW_PARAM_ACCESS ((__force snd_pcm_hw_param_t) 0) /* Access type */
326 SNDRV_PCM_HW_PARAM_FIRST_MASK = SNDRV_PCM_HW_PARAM_ACCESS, 300#define SNDRV_PCM_HW_PARAM_FORMAT ((__force snd_pcm_hw_param_t) 1) /* Format */
327 SNDRV_PCM_HW_PARAM_FORMAT, /* Format */ 301#define SNDRV_PCM_HW_PARAM_SUBFORMAT ((__force snd_pcm_hw_param_t) 2) /* Subformat */
328 SNDRV_PCM_HW_PARAM_SUBFORMAT, /* Subformat */ 302#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS
329 SNDRV_PCM_HW_PARAM_LAST_MASK = SNDRV_PCM_HW_PARAM_SUBFORMAT, 303#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT
330 304
331 SNDRV_PCM_HW_PARAM_SAMPLE_BITS = 8, /* Bits per sample */ 305#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS ((__force snd_pcm_hw_param_t) 8) /* Bits per sample */
332 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL = SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 306#define SNDRV_PCM_HW_PARAM_FRAME_BITS ((__force snd_pcm_hw_param_t) 9) /* Bits per frame */
333 SNDRV_PCM_HW_PARAM_FRAME_BITS, /* Bits per frame */ 307#define SNDRV_PCM_HW_PARAM_CHANNELS ((__force snd_pcm_hw_param_t) 10) /* Channels */
334 SNDRV_PCM_HW_PARAM_CHANNELS, /* Channels */ 308#define SNDRV_PCM_HW_PARAM_RATE ((__force snd_pcm_hw_param_t) 11) /* Approx rate */
335 SNDRV_PCM_HW_PARAM_RATE, /* Approx rate */ 309#define SNDRV_PCM_HW_PARAM_PERIOD_TIME ((__force snd_pcm_hw_param_t) 12) /* Approx distance between interrupts in us */
336 SNDRV_PCM_HW_PARAM_PERIOD_TIME, /* Approx distance between interrupts 310#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE ((__force snd_pcm_hw_param_t) 13) /* Approx frames between interrupts */
337 in us */ 311#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES ((__force snd_pcm_hw_param_t) 14) /* Approx bytes between interrupts */
338 SNDRV_PCM_HW_PARAM_PERIOD_SIZE, /* Approx frames between interrupts */ 312#define SNDRV_PCM_HW_PARAM_PERIODS ((__force snd_pcm_hw_param_t) 15) /* Approx interrupts per buffer */
339 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, /* Approx bytes between interrupts */ 313#define SNDRV_PCM_HW_PARAM_BUFFER_TIME ((__force snd_pcm_hw_param_t) 16) /* Approx duration of buffer in us */
340 SNDRV_PCM_HW_PARAM_PERIODS, /* Approx interrupts per buffer */ 314#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE ((__force snd_pcm_hw_param_t) 17) /* Size of buffer in frames */
341 SNDRV_PCM_HW_PARAM_BUFFER_TIME, /* Approx duration of buffer in us */ 315#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES ((__force snd_pcm_hw_param_t) 18) /* Size of buffer in bytes */
342 SNDRV_PCM_HW_PARAM_BUFFER_SIZE, /* Size of buffer in frames */ 316#define SNDRV_PCM_HW_PARAM_TICK_TIME ((__force snd_pcm_hw_param_t) 19) /* Approx tick duration in us */
343 SNDRV_PCM_HW_PARAM_BUFFER_BYTES, /* Size of buffer in bytes */ 317#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS
344 SNDRV_PCM_HW_PARAM_TICK_TIME, /* Approx tick duration in us */ 318#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME
345 SNDRV_PCM_HW_PARAM_LAST_INTERVAL = SNDRV_PCM_HW_PARAM_TICK_TIME
346};
347 319
348#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ 320#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
349 321
350struct sndrv_interval { 322struct snd_interval {
351 unsigned int min, max; 323 unsigned int min, max;
352 unsigned int openmin:1, 324 unsigned int openmin:1,
353 openmax:1, 325 openmax:1,
@@ -357,137 +329,137 @@ struct sndrv_interval {
357 329
358#define SNDRV_MASK_MAX 256 330#define SNDRV_MASK_MAX 256
359 331
360struct sndrv_mask { 332struct snd_mask {
361 u_int32_t bits[(SNDRV_MASK_MAX+31)/32]; 333 u_int32_t bits[(SNDRV_MASK_MAX+31)/32];
362}; 334};
363 335
364struct sndrv_pcm_hw_params { 336struct snd_pcm_hw_params {
365 unsigned int flags; 337 unsigned int flags;
366 struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 338 struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
367 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; 339 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
368 struct sndrv_mask mres[5]; /* reserved masks */ 340 struct snd_mask mres[5]; /* reserved masks */
369 struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - 341 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
370 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; 342 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
371 struct sndrv_interval ires[9]; /* reserved intervals */ 343 struct snd_interval ires[9]; /* reserved intervals */
372 unsigned int rmask; /* W: requested masks */ 344 unsigned int rmask; /* W: requested masks */
373 unsigned int cmask; /* R: changed masks */ 345 unsigned int cmask; /* R: changed masks */
374 unsigned int info; /* R: Info flags for returned setup */ 346 unsigned int info; /* R: Info flags for returned setup */
375 unsigned int msbits; /* R: used most significant bits */ 347 unsigned int msbits; /* R: used most significant bits */
376 unsigned int rate_num; /* R: rate numerator */ 348 unsigned int rate_num; /* R: rate numerator */
377 unsigned int rate_den; /* R: rate denominator */ 349 unsigned int rate_den; /* R: rate denominator */
378 sndrv_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ 350 snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
379 unsigned char reserved[64]; /* reserved for future */ 351 unsigned char reserved[64]; /* reserved for future */
380}; 352};
381 353
382enum sndrv_pcm_tstamp { 354enum {
383 SNDRV_PCM_TSTAMP_NONE = 0, 355 SNDRV_PCM_TSTAMP_NONE = 0,
384 SNDRV_PCM_TSTAMP_MMAP, 356 SNDRV_PCM_TSTAMP_MMAP,
385 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_MMAP, 357 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_MMAP,
386}; 358};
387 359
388struct sndrv_pcm_sw_params { 360struct snd_pcm_sw_params {
389 enum sndrv_pcm_tstamp tstamp_mode; /* timestamp mode */ 361 int tstamp_mode; /* timestamp mode */
390 unsigned int period_step; 362 unsigned int period_step;
391 unsigned int sleep_min; /* min ticks to sleep */ 363 unsigned int sleep_min; /* min ticks to sleep */
392 sndrv_pcm_uframes_t avail_min; /* min avail frames for wakeup */ 364 snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
393 sndrv_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ 365 snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
394 sndrv_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ 366 snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
395 sndrv_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ 367 snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */
396 sndrv_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ 368 snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
397 sndrv_pcm_uframes_t silence_size; /* silence block size */ 369 snd_pcm_uframes_t silence_size; /* silence block size */
398 sndrv_pcm_uframes_t boundary; /* pointers wrap point */ 370 snd_pcm_uframes_t boundary; /* pointers wrap point */
399 unsigned char reserved[64]; /* reserved for future */ 371 unsigned char reserved[64]; /* reserved for future */
400}; 372};
401 373
402struct sndrv_pcm_channel_info { 374struct snd_pcm_channel_info {
403 unsigned int channel; 375 unsigned int channel;
404 off_t offset; /* mmap offset */ 376 off_t offset; /* mmap offset */
405 unsigned int first; /* offset to first sample in bits */ 377 unsigned int first; /* offset to first sample in bits */
406 unsigned int step; /* samples distance in bits */ 378 unsigned int step; /* samples distance in bits */
407}; 379};
408 380
409struct sndrv_pcm_status { 381struct snd_pcm_status {
410 enum sndrv_pcm_state state; /* stream state */ 382 snd_pcm_state_t state; /* stream state */
411 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ 383 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
412 struct timespec tstamp; /* reference timestamp */ 384 struct timespec tstamp; /* reference timestamp */
413 sndrv_pcm_uframes_t appl_ptr; /* appl ptr */ 385 snd_pcm_uframes_t appl_ptr; /* appl ptr */
414 sndrv_pcm_uframes_t hw_ptr; /* hw ptr */ 386 snd_pcm_uframes_t hw_ptr; /* hw ptr */
415 sndrv_pcm_sframes_t delay; /* current delay in frames */ 387 snd_pcm_sframes_t delay; /* current delay in frames */
416 sndrv_pcm_uframes_t avail; /* number of frames available */ 388 snd_pcm_uframes_t avail; /* number of frames available */
417 sndrv_pcm_uframes_t avail_max; /* max frames available on hw since last status */ 389 snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */
418 sndrv_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ 390 snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
419 enum sndrv_pcm_state suspended_state; /* suspended stream state */ 391 snd_pcm_state_t suspended_state; /* suspended stream state */
420 unsigned char reserved[60]; /* must be filled with zero */ 392 unsigned char reserved[60]; /* must be filled with zero */
421}; 393};
422 394
423struct sndrv_pcm_mmap_status { 395struct snd_pcm_mmap_status {
424 enum sndrv_pcm_state state; /* RO: state - SNDRV_PCM_STATE_XXXX */ 396 snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
425 int pad1; /* Needed for 64 bit alignment */ 397 int pad1; /* Needed for 64 bit alignment */
426 sndrv_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ 398 snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
427 struct timespec tstamp; /* Timestamp */ 399 struct timespec tstamp; /* Timestamp */
428 enum sndrv_pcm_state suspended_state; /* RO: suspended stream state */ 400 snd_pcm_state_t suspended_state; /* RO: suspended stream state */
429}; 401};
430 402
431struct sndrv_pcm_mmap_control { 403struct snd_pcm_mmap_control {
432 sndrv_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ 404 snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
433 sndrv_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ 405 snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
434}; 406};
435 407
436#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */ 408#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */
437#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ 409#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */
438#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ 410#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */
439 411
440struct sndrv_pcm_sync_ptr { 412struct snd_pcm_sync_ptr {
441 unsigned int flags; 413 unsigned int flags;
442 union { 414 union {
443 struct sndrv_pcm_mmap_status status; 415 struct snd_pcm_mmap_status status;
444 unsigned char reserved[64]; 416 unsigned char reserved[64];
445 } s; 417 } s;
446 union { 418 union {
447 struct sndrv_pcm_mmap_control control; 419 struct snd_pcm_mmap_control control;
448 unsigned char reserved[64]; 420 unsigned char reserved[64];
449 } c; 421 } c;
450}; 422};
451 423
452struct sndrv_xferi { 424struct snd_xferi {
453 sndrv_pcm_sframes_t result; 425 snd_pcm_sframes_t result;
454 void __user *buf; 426 void __user *buf;
455 sndrv_pcm_uframes_t frames; 427 snd_pcm_uframes_t frames;
456}; 428};
457 429
458struct sndrv_xfern { 430struct snd_xfern {
459 sndrv_pcm_sframes_t result; 431 snd_pcm_sframes_t result;
460 void __user * __user *bufs; 432 void __user * __user *bufs;
461 sndrv_pcm_uframes_t frames; 433 snd_pcm_uframes_t frames;
462}; 434};
463 435
464enum { 436enum {
465 SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int), 437 SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int),
466 SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct sndrv_pcm_info), 438 SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct snd_pcm_info),
467 SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int), 439 SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int),
468 SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct sndrv_pcm_hw_params), 440 SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct snd_pcm_hw_params),
469 SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct sndrv_pcm_hw_params), 441 SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct snd_pcm_hw_params),
470 SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12), 442 SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12),
471 SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct sndrv_pcm_sw_params), 443 SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct snd_pcm_sw_params),
472 SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct sndrv_pcm_status), 444 SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct snd_pcm_status),
473 SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, sndrv_pcm_sframes_t), 445 SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, snd_pcm_sframes_t),
474 SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22), 446 SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22),
475 SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct sndrv_pcm_sync_ptr), 447 SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct snd_pcm_sync_ptr),
476 SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct sndrv_pcm_channel_info), 448 SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct snd_pcm_channel_info),
477 SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40), 449 SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40),
478 SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41), 450 SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41),
479 SNDRV_PCM_IOCTL_START = _IO('A', 0x42), 451 SNDRV_PCM_IOCTL_START = _IO('A', 0x42),
480 SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43), 452 SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43),
481 SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44), 453 SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44),
482 SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int), 454 SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int),
483 SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, sndrv_pcm_uframes_t), 455 SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, snd_pcm_uframes_t),
484 SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47), 456 SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47),
485 SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48), 457 SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48),
486 SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, sndrv_pcm_uframes_t), 458 SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, snd_pcm_uframes_t),
487 SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct sndrv_xferi), 459 SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct snd_xferi),
488 SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct sndrv_xferi), 460 SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct snd_xferi),
489 SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct sndrv_xfern), 461 SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct snd_xfern),
490 SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct sndrv_xfern), 462 SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct snd_xfern),
491 SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int), 463 SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int),
492 SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61), 464 SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61),
493}; 465};
@@ -507,7 +479,7 @@ enum {
507 479
508#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) 480#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
509 481
510enum sndrv_rawmidi_stream { 482enum {
511 SNDRV_RAWMIDI_STREAM_OUTPUT = 0, 483 SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
512 SNDRV_RAWMIDI_STREAM_INPUT, 484 SNDRV_RAWMIDI_STREAM_INPUT,
513 SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT, 485 SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
@@ -517,10 +489,10 @@ enum sndrv_rawmidi_stream {
517#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002 489#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
518#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004 490#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
519 491
520struct sndrv_rawmidi_info { 492struct snd_rawmidi_info {
521 unsigned int device; /* RO/WR (control): device number */ 493 unsigned int device; /* RO/WR (control): device number */
522 unsigned int subdevice; /* RO/WR (control): subdevice number */ 494 unsigned int subdevice; /* RO/WR (control): subdevice number */
523 enum sndrv_rawmidi_stream stream; /* WR: stream */ 495 int stream; /* WR: stream */
524 int card; /* R: card number */ 496 int card; /* R: card number */
525 unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */ 497 unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */
526 unsigned char id[64]; /* ID (user selectable) */ 498 unsigned char id[64]; /* ID (user selectable) */
@@ -531,16 +503,16 @@ struct sndrv_rawmidi_info {
531 unsigned char reserved[64]; /* reserved for future use */ 503 unsigned char reserved[64]; /* reserved for future use */
532}; 504};
533 505
534struct sndrv_rawmidi_params { 506struct snd_rawmidi_params {
535 enum sndrv_rawmidi_stream stream; 507 int stream;
536 size_t buffer_size; /* queue size in bytes */ 508 size_t buffer_size; /* queue size in bytes */
537 size_t avail_min; /* minimum avail bytes for wakeup */ 509 size_t avail_min; /* minimum avail bytes for wakeup */
538 unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */ 510 unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
539 unsigned char reserved[16]; /* reserved for future use */ 511 unsigned char reserved[16]; /* reserved for future use */
540}; 512};
541 513
542struct sndrv_rawmidi_status { 514struct snd_rawmidi_status {
543 enum sndrv_rawmidi_stream stream; 515 int stream;
544 struct timespec tstamp; /* Timestamp */ 516 struct timespec tstamp; /* Timestamp */
545 size_t avail; /* available bytes */ 517 size_t avail; /* available bytes */
546 size_t xruns; /* count of overruns since last status (in bytes) */ 518 size_t xruns; /* count of overruns since last status (in bytes) */
@@ -549,9 +521,9 @@ struct sndrv_rawmidi_status {
549 521
550enum { 522enum {
551 SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int), 523 SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int),
552 SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct sndrv_rawmidi_info), 524 SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct snd_rawmidi_info),
553 SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct sndrv_rawmidi_params), 525 SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct snd_rawmidi_params),
554 SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct sndrv_rawmidi_status), 526 SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct snd_rawmidi_status),
555 SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int), 527 SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int),
556 SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int), 528 SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int),
557}; 529};
@@ -562,7 +534,7 @@ enum {
562 534
563#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) 535#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5)
564 536
565enum sndrv_timer_class { 537enum {
566 SNDRV_TIMER_CLASS_NONE = -1, 538 SNDRV_TIMER_CLASS_NONE = -1,
567 SNDRV_TIMER_CLASS_SLAVE = 0, 539 SNDRV_TIMER_CLASS_SLAVE = 0,
568 SNDRV_TIMER_CLASS_GLOBAL, 540 SNDRV_TIMER_CLASS_GLOBAL,
@@ -572,7 +544,7 @@ enum sndrv_timer_class {
572}; 544};
573 545
574/* slave timer classes */ 546/* slave timer classes */
575enum sndrv_timer_slave_class { 547enum {
576 SNDRV_TIMER_SCLASS_NONE = 0, 548 SNDRV_TIMER_SCLASS_NONE = 0,
577 SNDRV_TIMER_SCLASS_APPLICATION, 549 SNDRV_TIMER_SCLASS_APPLICATION,
578 SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */ 550 SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */
@@ -588,16 +560,16 @@ enum sndrv_timer_slave_class {
588/* info flags */ 560/* info flags */
589#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ 561#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
590 562
591struct sndrv_timer_id { 563struct snd_timer_id {
592 enum sndrv_timer_class dev_class; 564 int dev_class;
593 enum sndrv_timer_slave_class dev_sclass; 565 int dev_sclass;
594 int card; 566 int card;
595 int device; 567 int device;
596 int subdevice; 568 int subdevice;
597}; 569};
598 570
599struct sndrv_timer_ginfo { 571struct snd_timer_ginfo {
600 struct sndrv_timer_id tid; /* requested timer ID */ 572 struct snd_timer_id tid; /* requested timer ID */
601 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ 573 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
602 int card; /* card number */ 574 int card; /* card number */
603 unsigned char id[64]; /* timer identification */ 575 unsigned char id[64]; /* timer identification */
@@ -610,27 +582,27 @@ struct sndrv_timer_ginfo {
610 unsigned char reserved[32]; 582 unsigned char reserved[32];
611}; 583};
612 584
613struct sndrv_timer_gparams { 585struct snd_timer_gparams {
614 struct sndrv_timer_id tid; /* requested timer ID */ 586 struct snd_timer_id tid; /* requested timer ID */
615 unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ 587 unsigned long period_num; /* requested precise period duration (in seconds) - numerator */
616 unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ 588 unsigned long period_den; /* requested precise period duration (in seconds) - denominator */
617 unsigned char reserved[32]; 589 unsigned char reserved[32];
618}; 590};
619 591
620struct sndrv_timer_gstatus { 592struct snd_timer_gstatus {
621 struct sndrv_timer_id tid; /* requested timer ID */ 593 struct snd_timer_id tid; /* requested timer ID */
622 unsigned long resolution; /* current period resolution in ns */ 594 unsigned long resolution; /* current period resolution in ns */
623 unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ 595 unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */
624 unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ 596 unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */
625 unsigned char reserved[32]; 597 unsigned char reserved[32];
626}; 598};
627 599
628struct sndrv_timer_select { 600struct snd_timer_select {
629 struct sndrv_timer_id id; /* bind to timer ID */ 601 struct snd_timer_id id; /* bind to timer ID */
630 unsigned char reserved[32]; /* reserved */ 602 unsigned char reserved[32]; /* reserved */
631}; 603};
632 604
633struct sndrv_timer_info { 605struct snd_timer_info {
634 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ 606 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
635 int card; /* card number */ 607 int card; /* card number */
636 unsigned char id[64]; /* timer identificator */ 608 unsigned char id[64]; /* timer identificator */
@@ -644,7 +616,7 @@ struct sndrv_timer_info {
644#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ 616#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */
645#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ 617#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */
646 618
647struct sndrv_timer_params { 619struct snd_timer_params {
648 unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */ 620 unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */
649 unsigned int ticks; /* requested resolution in ticks */ 621 unsigned int ticks; /* requested resolution in ticks */
650 unsigned int queue_size; /* total size of queue (32-1024) */ 622 unsigned int queue_size; /* total size of queue (32-1024) */
@@ -653,7 +625,7 @@ struct sndrv_timer_params {
653 unsigned char reserved[60]; /* reserved */ 625 unsigned char reserved[60]; /* reserved */
654}; 626};
655 627
656struct sndrv_timer_status { 628struct snd_timer_status {
657 struct timespec tstamp; /* Timestamp - last update */ 629 struct timespec tstamp; /* Timestamp - last update */
658 unsigned int resolution; /* current period resolution in ns */ 630 unsigned int resolution; /* current period resolution in ns */
659 unsigned int lost; /* counter of master tick lost */ 631 unsigned int lost; /* counter of master tick lost */
@@ -664,15 +636,15 @@ struct sndrv_timer_status {
664 636
665enum { 637enum {
666 SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int), 638 SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int),
667 SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct sndrv_timer_id), 639 SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct snd_timer_id),
668 SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int), 640 SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int),
669 SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct sndrv_timer_ginfo), 641 SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct snd_timer_ginfo),
670 SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct sndrv_timer_gparams), 642 SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct snd_timer_gparams),
671 SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct sndrv_timer_gstatus), 643 SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct snd_timer_gstatus),
672 SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct sndrv_timer_select), 644 SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct snd_timer_select),
673 SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct sndrv_timer_info), 645 SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct snd_timer_info),
674 SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct sndrv_timer_params), 646 SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct snd_timer_params),
675 SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct sndrv_timer_status), 647 SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct snd_timer_status),
676 /* The following four ioctls are changed since 1.0.9 due to confliction */ 648 /* The following four ioctls are changed since 1.0.9 due to confliction */
677 SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0), 649 SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0),
678 SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1), 650 SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1),
@@ -680,12 +652,12 @@ enum {
680 SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3), 652 SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3),
681}; 653};
682 654
683struct sndrv_timer_read { 655struct snd_timer_read {
684 unsigned int resolution; 656 unsigned int resolution;
685 unsigned int ticks; 657 unsigned int ticks;
686}; 658};
687 659
688enum sndrv_timer_event { 660enum {
689 SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ 661 SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
690 SNDRV_TIMER_EVENT_TICK, /* val = ticks */ 662 SNDRV_TIMER_EVENT_TICK, /* val = ticks */
691 SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ 663 SNDRV_TIMER_EVENT_START, /* val = resolution in ns */
@@ -704,8 +676,8 @@ enum sndrv_timer_event {
704 SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, 676 SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
705}; 677};
706 678
707struct sndrv_timer_tread { 679struct snd_timer_tread {
708 enum sndrv_timer_event event; 680 int event;
709 struct timespec tstamp; 681 struct timespec tstamp;
710 unsigned int val; 682 unsigned int val;
711}; 683};
@@ -718,7 +690,7 @@ struct sndrv_timer_tread {
718 690
719#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3) 691#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3)
720 692
721struct sndrv_ctl_card_info { 693struct snd_ctl_card_info {
722 int card; /* card number */ 694 int card; /* card number */
723 int pad; /* reserved for future (was type) */ 695 int pad; /* reserved for future (was type) */
724 unsigned char id[16]; /* ID of card (user selectable) */ 696 unsigned char id[16]; /* ID of card (user selectable) */
@@ -731,27 +703,25 @@ struct sndrv_ctl_card_info {
731 unsigned char reserved[48]; /* reserved for future */ 703 unsigned char reserved[48]; /* reserved for future */
732}; 704};
733 705
734enum sndrv_ctl_elem_type { 706typedef int __bitwise snd_ctl_elem_type_t;
735 SNDRV_CTL_ELEM_TYPE_NONE = 0, /* invalid */ 707#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */
736 SNDRV_CTL_ELEM_TYPE_BOOLEAN, /* boolean type */ 708#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */
737 SNDRV_CTL_ELEM_TYPE_INTEGER, /* integer type */ 709#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */
738 SNDRV_CTL_ELEM_TYPE_ENUMERATED, /* enumerated type */ 710#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */
739 SNDRV_CTL_ELEM_TYPE_BYTES, /* byte array */ 711#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */
740 SNDRV_CTL_ELEM_TYPE_IEC958, /* IEC958 (S/PDIF) setup */ 712#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
741 SNDRV_CTL_ELEM_TYPE_INTEGER64, /* 64-bit integer type */ 713#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
742 SNDRV_CTL_ELEM_TYPE_LAST = SNDRV_CTL_ELEM_TYPE_INTEGER64, 714#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64
743}; 715
744 716typedef int __bitwise snd_ctl_elem_iface_t;
745enum sndrv_ctl_elem_iface { 717#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */
746 SNDRV_CTL_ELEM_IFACE_CARD = 0, /* global control */ 718#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
747 SNDRV_CTL_ELEM_IFACE_HWDEP, /* hardware dependent device */ 719#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
748 SNDRV_CTL_ELEM_IFACE_MIXER, /* virtual mixer device */ 720#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */
749 SNDRV_CTL_ELEM_IFACE_PCM, /* PCM device */ 721#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
750 SNDRV_CTL_ELEM_IFACE_RAWMIDI, /* RawMidi device */ 722#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */
751 SNDRV_CTL_ELEM_IFACE_TIMER, /* timer device */ 723#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
752 SNDRV_CTL_ELEM_IFACE_SEQUENCER, /* sequencer client */ 724#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER
753 SNDRV_CTL_ELEM_IFACE_LAST = SNDRV_CTL_ELEM_IFACE_SEQUENCER,
754};
755 725
756#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0) 726#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0)
757#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) 727#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
@@ -773,27 +743,27 @@ enum sndrv_ctl_elem_iface {
773#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ 743#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */
774#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ 744#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */
775 745
776struct sndrv_ctl_elem_id { 746struct snd_ctl_elem_id {
777 unsigned int numid; /* numeric identifier, zero = invalid */ 747 unsigned int numid; /* numeric identifier, zero = invalid */
778 enum sndrv_ctl_elem_iface iface; /* interface identifier */ 748 snd_ctl_elem_iface_t iface; /* interface identifier */
779 unsigned int device; /* device/client number */ 749 unsigned int device; /* device/client number */
780 unsigned int subdevice; /* subdevice (substream) number */ 750 unsigned int subdevice; /* subdevice (substream) number */
781 unsigned char name[44]; /* ASCII name of item */ 751 unsigned char name[44]; /* ASCII name of item */
782 unsigned int index; /* index of item */ 752 unsigned int index; /* index of item */
783}; 753};
784 754
785struct sndrv_ctl_elem_list { 755struct snd_ctl_elem_list {
786 unsigned int offset; /* W: first element ID to get */ 756 unsigned int offset; /* W: first element ID to get */
787 unsigned int space; /* W: count of element IDs to get */ 757 unsigned int space; /* W: count of element IDs to get */
788 unsigned int used; /* R: count of element IDs set */ 758 unsigned int used; /* R: count of element IDs set */
789 unsigned int count; /* R: count of all elements */ 759 unsigned int count; /* R: count of all elements */
790 struct sndrv_ctl_elem_id __user *pids; /* R: IDs */ 760 struct snd_ctl_elem_id __user *pids; /* R: IDs */
791 unsigned char reserved[50]; 761 unsigned char reserved[50];
792}; 762};
793 763
794struct sndrv_ctl_elem_info { 764struct snd_ctl_elem_info {
795 struct sndrv_ctl_elem_id id; /* W: element ID */ 765 struct snd_ctl_elem_id id; /* W: element ID */
796 enum sndrv_ctl_elem_type type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ 766 snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
797 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ 767 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
798 unsigned int count; /* count of values */ 768 unsigned int count; /* count of values */
799 pid_t owner; /* owner's PID of this control */ 769 pid_t owner; /* owner's PID of this control */
@@ -822,8 +792,8 @@ struct sndrv_ctl_elem_info {
822 unsigned char reserved[64-4*sizeof(unsigned short)]; 792 unsigned char reserved[64-4*sizeof(unsigned short)];
823}; 793};
824 794
825struct sndrv_ctl_elem_value { 795struct snd_ctl_elem_value {
826 struct sndrv_ctl_elem_id id; /* W: element ID */ 796 struct snd_ctl_elem_id id; /* W: element ID */
827 unsigned int indirect: 1; /* W: use indirect pointer (xxx_ptr member) */ 797 unsigned int indirect: 1; /* W: use indirect pointer (xxx_ptr member) */
828 union { 798 union {
829 union { 799 union {
@@ -842,7 +812,7 @@ struct sndrv_ctl_elem_value {
842 unsigned char data[512]; 812 unsigned char data[512];
843 unsigned char *data_ptr; 813 unsigned char *data_ptr;
844 } bytes; 814 } bytes;
845 struct sndrv_aes_iec958 iec958; 815 struct snd_aes_iec958 iec958;
846 } value; /* RO */ 816 } value; /* RO */
847 struct timespec tstamp; 817 struct timespec tstamp;
848 unsigned char reserved[128-sizeof(struct timespec)]; 818 unsigned char reserved[128-sizeof(struct timespec)];
@@ -850,24 +820,24 @@ struct sndrv_ctl_elem_value {
850 820
851enum { 821enum {
852 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int), 822 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int),
853 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct sndrv_ctl_card_info), 823 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info),
854 SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct sndrv_ctl_elem_list), 824 SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct snd_ctl_elem_list),
855 SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct sndrv_ctl_elem_info), 825 SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct snd_ctl_elem_info),
856 SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct sndrv_ctl_elem_value), 826 SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct snd_ctl_elem_value),
857 SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct sndrv_ctl_elem_value), 827 SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct snd_ctl_elem_value),
858 SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct sndrv_ctl_elem_id), 828 SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct snd_ctl_elem_id),
859 SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct sndrv_ctl_elem_id), 829 SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct snd_ctl_elem_id),
860 SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int), 830 SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int),
861 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct sndrv_ctl_elem_info), 831 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info),
862 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct sndrv_ctl_elem_info), 832 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info),
863 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct sndrv_ctl_elem_id), 833 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id),
864 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), 834 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int),
865 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct sndrv_hwdep_info), 835 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info),
866 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), 836 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int),
867 SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct sndrv_pcm_info), 837 SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct snd_pcm_info),
868 SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int), 838 SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int),
869 SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int), 839 SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int),
870 SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct sndrv_rawmidi_info), 840 SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct snd_rawmidi_info),
871 SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int), 841 SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int),
872 SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int), 842 SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int),
873 SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int), 843 SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int),
@@ -887,12 +857,12 @@ enum sndrv_ctl_event_type {
887#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ 857#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */
888#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ 858#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */
889 859
890struct sndrv_ctl_event { 860struct snd_ctl_event {
891 enum sndrv_ctl_event_type type; /* event type - SNDRV_CTL_EVENT_* */ 861 int type; /* event type - SNDRV_CTL_EVENT_* */
892 union { 862 union {
893 struct { 863 struct {
894 unsigned int mask; 864 unsigned int mask;
895 struct sndrv_ctl_elem_id id; 865 struct snd_ctl_elem_id id;
896 } elem; 866 } elem;
897 unsigned char data8[60]; 867 unsigned char data8[60];
898 } data; 868 } data;
@@ -920,14 +890,14 @@ struct sndrv_ctl_event {
920 * 890 *
921 */ 891 */
922 892
923struct sndrv_xferv { 893struct snd_xferv {
924 const struct iovec *vector; 894 const struct iovec *vector;
925 unsigned long count; 895 unsigned long count;
926}; 896};
927 897
928enum { 898enum {
929 SNDRV_IOCTL_READV = _IOW('K', 0x00, struct sndrv_xferv), 899 SNDRV_IOCTL_READV = _IOW('K', 0x00, struct snd_xferv),
930 SNDRV_IOCTL_WRITEV = _IOW('K', 0x01, struct sndrv_xferv), 900 SNDRV_IOCTL_WRITEV = _IOW('K', 0x01, struct snd_xferv),
931}; 901};
932 902
933#endif /* __SOUND_ASOUND_H */ 903#endif /* __SOUND_ASOUND_H */
diff --git a/include/sound/asound_fm.h b/include/sound/asound_fm.h
index b0da677f8f75..956fdc23c595 100644
--- a/include/sound/asound_fm.h
+++ b/include/sound/asound_fm.h
@@ -29,16 +29,16 @@
29#define SNDRV_DM_FM_MODE_OPL2 0x00 29#define SNDRV_DM_FM_MODE_OPL2 0x00
30#define SNDRV_DM_FM_MODE_OPL3 0x01 30#define SNDRV_DM_FM_MODE_OPL3 0x01
31 31
32typedef struct snd_dm_fm_info { 32struct snd_dm_fm_info {
33 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ 33 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
34 unsigned char rhythm; /* percussion mode flag */ 34 unsigned char rhythm; /* percussion mode flag */
35} snd_dm_fm_info_t; 35};
36 36
37/* 37/*
38 * Data structure composing an FM "note" or sound event. 38 * Data structure composing an FM "note" or sound event.
39 */ 39 */
40 40
41typedef struct snd_dm_fm_voice { 41struct snd_dm_fm_voice {
42 unsigned char op; /* operator cell (0 or 1) */ 42 unsigned char op; /* operator cell (0 or 1) */
43 unsigned char voice; /* FM voice (0 to 17) */ 43 unsigned char voice; /* FM voice (0 to 17) */
44 44
@@ -60,25 +60,25 @@ typedef struct snd_dm_fm_voice {
60 unsigned char left; /* stereo left */ 60 unsigned char left; /* stereo left */
61 unsigned char right; /* stereo right */ 61 unsigned char right; /* stereo right */
62 unsigned char waveform; /* 3 bits: waveform shape */ 62 unsigned char waveform; /* 3 bits: waveform shape */
63} snd_dm_fm_voice_t; 63};
64 64
65/* 65/*
66 * This describes an FM note by its voice, octave, frequency number (10bit) 66 * This describes an FM note by its voice, octave, frequency number (10bit)
67 * and key on/off. 67 * and key on/off.
68 */ 68 */
69 69
70typedef struct snd_dm_fm_note { 70struct snd_dm_fm_note {
71 unsigned char voice; /* 0-17 voice channel */ 71 unsigned char voice; /* 0-17 voice channel */
72 unsigned char octave; /* 3 bits: what octave to play */ 72 unsigned char octave; /* 3 bits: what octave to play */
73 unsigned int fnum; /* 10 bits: frequency number */ 73 unsigned int fnum; /* 10 bits: frequency number */
74 unsigned char key_on; /* set for active, clear for silent */ 74 unsigned char key_on; /* set for active, clear for silent */
75} snd_dm_fm_note_t; 75};
76 76
77/* 77/*
78 * FM parameters that apply globally to all voices, and thus are not "notes" 78 * FM parameters that apply globally to all voices, and thus are not "notes"
79 */ 79 */
80 80
81typedef struct snd_dm_fm_params { 81struct snd_dm_fm_params {
82 unsigned char am_depth; /* amplitude modulation depth (1=hi) */ 82 unsigned char am_depth; /* amplitude modulation depth (1=hi) */
83 unsigned char vib_depth; /* vibrato depth (1=hi) */ 83 unsigned char vib_depth; /* vibrato depth (1=hi) */
84 unsigned char kbd_split; /* keyboard split */ 84 unsigned char kbd_split; /* keyboard split */
@@ -90,17 +90,17 @@ typedef struct snd_dm_fm_params {
90 unsigned char tomtom; 90 unsigned char tomtom;
91 unsigned char cymbal; 91 unsigned char cymbal;
92 unsigned char hihat; 92 unsigned char hihat;
93} snd_dm_fm_params_t; 93};
94 94
95/* 95/*
96 * FM mode ioctl settings 96 * FM mode ioctl settings
97 */ 97 */
98 98
99#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, snd_dm_fm_info_t) 99#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
100#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) 100#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
101#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, snd_dm_fm_note_t) 101#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
102#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, snd_dm_fm_voice_t) 102#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
103#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, snd_dm_fm_params_t) 103#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
104#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) 104#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
105/* for OPL3 only */ 105/* for OPL3 only */
106#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) 106#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
diff --git a/include/sound/control.h b/include/sound/control.h
index ef7903c7a327..2489b1eb0110 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -24,24 +24,14 @@
24 24
25#include <sound/asound.h> 25#include <sound/asound.h>
26 26
27typedef struct sndrv_aes_iec958 snd_aes_iec958_t;
28typedef struct sndrv_ctl_card_info snd_ctl_card_info_t;
29typedef enum sndrv_ctl_elem_type snd_ctl_elem_type_t;
30typedef enum sndrv_ctl_elem_iface snd_ctl_elem_iface_t;
31typedef struct sndrv_ctl_elem_id snd_ctl_elem_id_t;
32typedef struct sndrv_ctl_elem_list snd_ctl_elem_list_t;
33typedef struct sndrv_ctl_elem_info snd_ctl_elem_info_t;
34typedef struct sndrv_ctl_elem_value snd_ctl_elem_value_t;
35typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
36typedef struct sndrv_ctl_event snd_ctl_event_t;
37
38#define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data) 27#define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data)
39 28
40typedef int (snd_kcontrol_info_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo); 29struct snd_kcontrol;
41typedef int (snd_kcontrol_get_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 30typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo);
42typedef int (snd_kcontrol_put_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 31typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
32typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
43 33
44typedef struct _snd_kcontrol_new { 34struct snd_kcontrol_new {
45 snd_ctl_elem_iface_t iface; /* interface identifier */ 35 snd_ctl_elem_iface_t iface; /* interface identifier */
46 unsigned int device; /* device/client number */ 36 unsigned int device; /* device/client number */
47 unsigned int subdevice; /* subdevice (substream) number */ 37 unsigned int subdevice; /* subdevice (substream) number */
@@ -53,40 +43,40 @@ typedef struct _snd_kcontrol_new {
53 snd_kcontrol_get_t *get; 43 snd_kcontrol_get_t *get;
54 snd_kcontrol_put_t *put; 44 snd_kcontrol_put_t *put;
55 unsigned long private_value; 45 unsigned long private_value;
56} snd_kcontrol_new_t; 46};
57 47
58typedef struct _snd_kcontrol_volatile { 48struct snd_kcontrol_volatile {
59 snd_ctl_file_t *owner; /* locked */ 49 struct snd_ctl_file *owner; /* locked */
60 pid_t owner_pid; 50 pid_t owner_pid;
61 unsigned int access; /* access rights */ 51 unsigned int access; /* access rights */
62} snd_kcontrol_volatile_t; 52};
63 53
64struct _snd_kcontrol { 54struct snd_kcontrol {
65 struct list_head list; /* list of controls */ 55 struct list_head list; /* list of controls */
66 snd_ctl_elem_id_t id; 56 struct snd_ctl_elem_id id;
67 unsigned int count; /* count of same elements */ 57 unsigned int count; /* count of same elements */
68 snd_kcontrol_info_t *info; 58 snd_kcontrol_info_t *info;
69 snd_kcontrol_get_t *get; 59 snd_kcontrol_get_t *get;
70 snd_kcontrol_put_t *put; 60 snd_kcontrol_put_t *put;
71 unsigned long private_value; 61 unsigned long private_value;
72 void *private_data; 62 void *private_data;
73 void (*private_free)(snd_kcontrol_t *kcontrol); 63 void (*private_free)(struct snd_kcontrol *kcontrol);
74 snd_kcontrol_volatile_t vd[0]; /* volatile data */ 64 struct snd_kcontrol_volatile vd[0]; /* volatile data */
75}; 65};
76 66
77#define snd_kcontrol(n) list_entry(n, snd_kcontrol_t, list) 67#define snd_kcontrol(n) list_entry(n, struct snd_kcontrol, list)
78 68
79typedef struct _snd_kctl_event { 69struct snd_kctl_event {
80 struct list_head list; /* list of events */ 70 struct list_head list; /* list of events */
81 snd_ctl_elem_id_t id; 71 struct snd_ctl_elem_id id;
82 unsigned int mask; 72 unsigned int mask;
83} snd_kctl_event_t; 73};
84 74
85#define snd_kctl_event(n) list_entry(n, snd_kctl_event_t, list) 75#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)
86 76
87struct _snd_ctl_file { 77struct snd_ctl_file {
88 struct list_head list; /* list of all control files */ 78 struct list_head list; /* list of all control files */
89 snd_card_t *card; 79 struct snd_card *card;
90 pid_t pid; 80 pid_t pid;
91 int prefer_pcm_subdevice; 81 int prefer_pcm_subdevice;
92 int prefer_rawmidi_subdevice; 82 int prefer_rawmidi_subdevice;
@@ -97,25 +87,25 @@ struct _snd_ctl_file {
97 struct list_head events; /* waiting events for read */ 87 struct list_head events; /* waiting events for read */
98}; 88};
99 89
100#define snd_ctl_file(n) list_entry(n, snd_ctl_file_t, list) 90#define snd_ctl_file(n) list_entry(n, struct snd_ctl_file, list)
101 91
102typedef int (*snd_kctl_ioctl_func_t) (snd_card_t * card, 92typedef int (*snd_kctl_ioctl_func_t) (struct snd_card * card,
103 snd_ctl_file_t * control, 93 struct snd_ctl_file * control,
104 unsigned int cmd, unsigned long arg); 94 unsigned int cmd, unsigned long arg);
105 95
106void snd_ctl_notify(snd_card_t * card, unsigned int mask, snd_ctl_elem_id_t * id); 96void snd_ctl_notify(struct snd_card * card, unsigned int mask, struct snd_ctl_elem_id * id);
107 97
108snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * kcontrol, unsigned int access); 98struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol * kcontrol, unsigned int access);
109snd_kcontrol_t *snd_ctl_new1(const snd_kcontrol_new_t * kcontrolnew, void * private_data); 99struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new * kcontrolnew, void * private_data);
110void snd_ctl_free_one(snd_kcontrol_t * kcontrol); 100void snd_ctl_free_one(struct snd_kcontrol * kcontrol);
111int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol); 101int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol);
112int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol); 102int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol);
113int snd_ctl_remove_id(snd_card_t * card, snd_ctl_elem_id_t *id); 103int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id);
114int snd_ctl_rename_id(snd_card_t * card, snd_ctl_elem_id_t *src_id, snd_ctl_elem_id_t *dst_id); 104int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id);
115snd_kcontrol_t *snd_ctl_find_numid(snd_card_t * card, unsigned int numid); 105struct snd_kcontrol *snd_ctl_find_numid(struct snd_card * card, unsigned int numid);
116snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id); 106struct snd_kcontrol *snd_ctl_find_id(struct snd_card * card, struct snd_ctl_elem_id *id);
117 107
118int snd_ctl_create(snd_card_t *card); 108int snd_ctl_create(struct snd_card *card);
119 109
120int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn); 110int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn);
121int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn); 111int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn);
@@ -127,20 +117,20 @@ int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn);
127#define snd_ctl_unregister_ioctl_compat(fcn) 117#define snd_ctl_unregister_ioctl_compat(fcn)
128#endif 118#endif
129 119
130int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *control); 120int snd_ctl_elem_read(struct snd_card *card, struct snd_ctl_elem_value *control);
131int snd_ctl_elem_write(snd_card_t *card, snd_ctl_file_t *file, snd_ctl_elem_value_t *control); 121int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file, struct snd_ctl_elem_value *control);
132 122
133static inline unsigned int snd_ctl_get_ioffnum(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) 123static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
134{ 124{
135 return id->numid - kctl->id.numid; 125 return id->numid - kctl->id.numid;
136} 126}
137 127
138static inline unsigned int snd_ctl_get_ioffidx(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) 128static inline unsigned int snd_ctl_get_ioffidx(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
139{ 129{
140 return id->index - kctl->id.index; 130 return id->index - kctl->id.index;
141} 131}
142 132
143static inline unsigned int snd_ctl_get_ioff(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) 133static inline unsigned int snd_ctl_get_ioff(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
144{ 134{
145 if (id->numid) { 135 if (id->numid) {
146 return snd_ctl_get_ioffnum(kctl, id); 136 return snd_ctl_get_ioffnum(kctl, id);
@@ -149,8 +139,8 @@ static inline unsigned int snd_ctl_get_ioff(snd_kcontrol_t *kctl, snd_ctl_elem_i
149 } 139 }
150} 140}
151 141
152static inline snd_ctl_elem_id_t *snd_ctl_build_ioff(snd_ctl_elem_id_t *dst_id, 142static inline struct snd_ctl_elem_id *snd_ctl_build_ioff(struct snd_ctl_elem_id *dst_id,
153 snd_kcontrol_t *src_kctl, 143 struct snd_kcontrol *src_kctl,
154 unsigned int offset) 144 unsigned int offset)
155{ 145{
156 *dst_id = src_kctl->id; 146 *dst_id = src_kctl->id;
diff --git a/include/sound/core.h b/include/sound/core.h
index 2be65ad2fd83..90ac6132ea3b 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -28,13 +28,6 @@
28#include <linux/workqueue.h> /* struct workqueue_struct */ 28#include <linux/workqueue.h> /* struct workqueue_struct */
29#include <linux/pm.h> /* pm_message_t */ 29#include <linux/pm.h> /* pm_message_t */
30 30
31/* Typedef's */
32typedef struct sndrv_interval snd_interval_t;
33typedef enum sndrv_card_type snd_card_type;
34typedef struct sndrv_xferi snd_xferi_t;
35typedef struct sndrv_xfern snd_xfern_t;
36typedef struct sndrv_xferv snd_xferv_t;
37
38/* forward declarations */ 31/* forward declarations */
39#ifdef CONFIG_PCI 32#ifdef CONFIG_PCI
40struct pci_dev; 33struct pci_dev;
@@ -47,76 +40,50 @@ struct sbus_dev;
47 40
48#define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000 41#define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000
49 42
50typedef enum { 43typedef int __bitwise snd_device_type_t;
51 SNDRV_DEV_TOPLEVEL = (0*SNDRV_DEV_TYPE_RANGE_SIZE), 44#define SNDRV_DEV_TOPLEVEL ((__force snd_device_type_t) 0)
52 SNDRV_DEV_CONTROL, 45#define SNDRV_DEV_CONTROL ((__force snd_device_type_t) 1)
53 SNDRV_DEV_LOWLEVEL_PRE, 46#define SNDRV_DEV_LOWLEVEL_PRE ((__force snd_device_type_t) 2)
54 SNDRV_DEV_LOWLEVEL_NORMAL = (1*SNDRV_DEV_TYPE_RANGE_SIZE), 47#define SNDRV_DEV_LOWLEVEL_NORMAL ((__force snd_device_type_t) 0x1000)
55 SNDRV_DEV_PCM, 48#define SNDRV_DEV_PCM ((__force snd_device_type_t) 0x1001)
56 SNDRV_DEV_RAWMIDI, 49#define SNDRV_DEV_RAWMIDI ((__force snd_device_type_t) 0x1002)
57 SNDRV_DEV_TIMER, 50#define SNDRV_DEV_TIMER ((__force snd_device_type_t) 0x1003)
58 SNDRV_DEV_SEQUENCER, 51#define SNDRV_DEV_SEQUENCER ((__force snd_device_type_t) 0x1004)
59 SNDRV_DEV_HWDEP, 52#define SNDRV_DEV_HWDEP ((__force snd_device_type_t) 0x1005)
60 SNDRV_DEV_INFO, 53#define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006)
61 SNDRV_DEV_BUS, 54#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007)
62 SNDRV_DEV_CODEC, 55#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008)
63 SNDRV_DEV_LOWLEVEL = (2*SNDRV_DEV_TYPE_RANGE_SIZE) 56#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000)
64} snd_device_type_t; 57
65 58typedef int __bitwise snd_device_state_t;
66typedef enum { 59#define SNDRV_DEV_BUILD ((__force snd_device_state_t) 0)
67 SNDRV_DEV_BUILD, 60#define SNDRV_DEV_REGISTERED ((__force snd_device_state_t) 1)
68 SNDRV_DEV_REGISTERED, 61#define SNDRV_DEV_DISCONNECTED ((__force snd_device_state_t) 2)
69 SNDRV_DEV_DISCONNECTED 62
70} snd_device_state_t; 63typedef int __bitwise snd_device_cmd_t;
71 64#define SNDRV_DEV_CMD_PRE ((__force snd_device_cmd_t) 0)
72typedef enum { 65#define SNDRV_DEV_CMD_NORMAL ((__force snd_device_cmd_t) 1)
73 SNDRV_DEV_CMD_PRE = 0, 66#define SNDRV_DEV_CMD_POST ((__force snd_device_cmd_t) 2)
74 SNDRV_DEV_CMD_NORMAL = 1, 67
75 SNDRV_DEV_CMD_POST = 2 68struct snd_device;
76} snd_device_cmd_t; 69
77 70struct snd_device_ops {
78typedef struct _snd_card snd_card_t; 71 int (*dev_free)(struct snd_device *dev);
79typedef struct _snd_device snd_device_t; 72 int (*dev_register)(struct snd_device *dev);
80 73 int (*dev_disconnect)(struct snd_device *dev);
81typedef int (snd_dev_free_t)(snd_device_t *device); 74 int (*dev_unregister)(struct snd_device *dev);
82typedef int (snd_dev_register_t)(snd_device_t *device); 75};
83typedef int (snd_dev_disconnect_t)(snd_device_t *device); 76
84typedef int (snd_dev_unregister_t)(snd_device_t *device); 77struct snd_device {
85
86typedef struct {
87 snd_dev_free_t *dev_free;
88 snd_dev_register_t *dev_register;
89 snd_dev_disconnect_t *dev_disconnect;
90 snd_dev_unregister_t *dev_unregister;
91} snd_device_ops_t;
92
93struct _snd_device {
94 struct list_head list; /* list of registered devices */ 78 struct list_head list; /* list of registered devices */
95 snd_card_t *card; /* card which holds this device */ 79 struct snd_card *card; /* card which holds this device */
96 snd_device_state_t state; /* state of the device */ 80 snd_device_state_t state; /* state of the device */
97 snd_device_type_t type; /* device type */ 81 snd_device_type_t type; /* device type */
98 void *device_data; /* device structure */ 82 void *device_data; /* device structure */
99 snd_device_ops_t *ops; /* operations */ 83 struct snd_device_ops *ops; /* operations */
100}; 84};
101 85
102#define snd_device(n) list_entry(n, snd_device_t, list) 86#define snd_device(n) list_entry(n, struct snd_device, list)
103
104/* various typedefs */
105
106typedef struct snd_info_entry snd_info_entry_t;
107typedef struct _snd_pcm snd_pcm_t;
108typedef struct _snd_pcm_str snd_pcm_str_t;
109typedef struct _snd_pcm_substream snd_pcm_substream_t;
110typedef struct _snd_mixer snd_kmixer_t;
111typedef struct _snd_rawmidi snd_rawmidi_t;
112typedef struct _snd_ctl_file snd_ctl_file_t;
113typedef struct _snd_kcontrol snd_kcontrol_t;
114typedef struct _snd_timer snd_timer_t;
115typedef struct _snd_timer_instance snd_timer_instance_t;
116typedef struct _snd_hwdep snd_hwdep_t;
117#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
118typedef struct _snd_oss_mixer snd_mixer_oss_t;
119#endif
120 87
121/* monitor files for graceful shutdown (hotplug) */ 88/* monitor files for graceful shutdown (hotplug) */
122 89
@@ -129,7 +96,7 @@ struct snd_shutdown_f_ops; /* define it later in init.c */
129 96
130/* main structure for soundcard */ 97/* main structure for soundcard */
131 98
132struct _snd_card { 99struct snd_card {
133 int number; /* number of soundcard (index to 100 int number; /* number of soundcard (index to
134 snd_cards) */ 101 snd_cards) */
135 102
@@ -143,7 +110,7 @@ struct _snd_card {
143 struct module *module; /* top-level module */ 110 struct module *module; /* top-level module */
144 111
145 void *private_data; /* private data for soundcard */ 112 void *private_data; /* private data for soundcard */
146 void (*private_free) (snd_card_t *card); /* callback for freeing of 113 void (*private_free) (struct snd_card *card); /* callback for freeing of
147 private data */ 114 private data */
148 struct list_head devices; /* devices */ 115 struct list_head devices; /* devices */
149 116
@@ -155,8 +122,8 @@ struct _snd_card {
155 struct list_head controls; /* all controls for this card */ 122 struct list_head controls; /* all controls for this card */
156 struct list_head ctl_files; /* active control files */ 123 struct list_head ctl_files; /* active control files */
157 124
158 snd_info_entry_t *proc_root; /* root for soundcard specific files */ 125 struct snd_info_entry *proc_root; /* root for soundcard specific files */
159 snd_info_entry_t *proc_id; /* the card id */ 126 struct snd_info_entry *proc_id; /* the card id */
160 struct proc_dir_entry *proc_root_link; /* number link to real id */ 127 struct proc_dir_entry *proc_root_link; /* number link to real id */
161 128
162 struct snd_monitor_file *files; /* all files associated to this card */ 129 struct snd_monitor_file *files; /* all files associated to this card */
@@ -167,92 +134,64 @@ struct _snd_card {
167 wait_queue_head_t shutdown_sleep; 134 wait_queue_head_t shutdown_sleep;
168 struct work_struct free_workq; /* for free in workqueue */ 135 struct work_struct free_workq; /* for free in workqueue */
169 struct device *dev; 136 struct device *dev;
170#ifdef CONFIG_SND_GENERIC_DRIVER
171 struct snd_generic_device *generic_dev;
172#endif
173 137
174#ifdef CONFIG_PM 138#ifdef CONFIG_PM
175 int (*pm_suspend)(snd_card_t *card, pm_message_t state);
176 int (*pm_resume)(snd_card_t *card);
177 void *pm_private_data;
178 unsigned int power_state; /* power state */ 139 unsigned int power_state; /* power state */
179 struct semaphore power_lock; /* power lock */ 140 struct semaphore power_lock; /* power lock */
180 wait_queue_head_t power_sleep; 141 wait_queue_head_t power_sleep;
181#endif 142#endif
182 143
183#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 144#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
184 snd_mixer_oss_t *mixer_oss; 145 struct snd_mixer_oss *mixer_oss;
185 int mixer_oss_change_count; 146 int mixer_oss_change_count;
186#endif 147#endif
187}; 148};
188 149
189#ifdef CONFIG_PM 150#ifdef CONFIG_PM
190static inline void snd_power_lock(snd_card_t *card) 151static inline void snd_power_lock(struct snd_card *card)
191{ 152{
192 down(&card->power_lock); 153 down(&card->power_lock);
193} 154}
194 155
195static inline void snd_power_unlock(snd_card_t *card) 156static inline void snd_power_unlock(struct snd_card *card)
196{ 157{
197 up(&card->power_lock); 158 up(&card->power_lock);
198} 159}
199 160
200static inline unsigned int snd_power_get_state(snd_card_t *card) 161static inline unsigned int snd_power_get_state(struct snd_card *card)
201{ 162{
202 return card->power_state; 163 return card->power_state;
203} 164}
204 165
205static inline void snd_power_change_state(snd_card_t *card, unsigned int state) 166static inline void snd_power_change_state(struct snd_card *card, unsigned int state)
206{ 167{
207 card->power_state = state; 168 card->power_state = state;
208 wake_up(&card->power_sleep); 169 wake_up(&card->power_sleep);
209} 170}
210 171
211/* init.c */ 172/* init.c */
212int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file); 173int snd_power_wait(struct snd_card *card, unsigned int power_state, struct file *file);
213
214int snd_card_set_pm_callback(snd_card_t *card,
215 int (*suspend)(snd_card_t *, pm_message_t),
216 int (*resume)(snd_card_t *),
217 void *private_data);
218int snd_card_set_generic_pm_callback(snd_card_t *card,
219 int (*suspend)(snd_card_t *, pm_message_t),
220 int (*resume)(snd_card_t *),
221 void *private_data);
222#define snd_card_set_isa_pm_callback(card,suspend,resume,data) \
223 snd_card_set_generic_pm_callback(card, suspend, resume, data)
224struct pci_dev;
225int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state);
226int snd_card_pci_resume(struct pci_dev *dev);
227#define SND_PCI_PM_CALLBACKS \
228 .suspend = snd_card_pci_suspend, .resume = snd_card_pci_resume
229 174
230#else /* ! CONFIG_PM */ 175#else /* ! CONFIG_PM */
231 176
232#define snd_power_lock(card) do { (void)(card); } while (0) 177#define snd_power_lock(card) do { (void)(card); } while (0)
233#define snd_power_unlock(card) do { (void)(card); } while (0) 178#define snd_power_unlock(card) do { (void)(card); } while (0)
234static inline int snd_power_wait(snd_card_t *card, unsigned int state, struct file *file) { return 0; } 179static inline int snd_power_wait(struct snd_card *card, unsigned int state, struct file *file) { return 0; }
235#define snd_power_get_state(card) SNDRV_CTL_POWER_D0 180#define snd_power_get_state(card) SNDRV_CTL_POWER_D0
236#define snd_power_change_state(card, state) do { (void)(card); } while (0) 181#define snd_power_change_state(card, state) do { (void)(card); } while (0)
237#define snd_card_set_pm_callback(card,suspend,resume,data)
238#define snd_card_set_generic_pm_callback(card,suspend,resume,data)
239#define snd_card_set_isa_pm_callback(card,suspend,resume,data)
240#define SND_PCI_PM_CALLBACKS
241 182
242#endif /* CONFIG_PM */ 183#endif /* CONFIG_PM */
243 184
244struct _snd_minor { 185struct snd_minor {
245 struct list_head list; /* list of all minors per card */ 186 int type; /* SNDRV_DEVICE_TYPE_XXX */
246 int number; /* minor number */ 187 int card; /* card number */
247 int device; /* device number */ 188 int device; /* device number */
248 const char *comment; /* for /proc/asound/devices */
249 struct file_operations *f_ops; /* file operations */ 189 struct file_operations *f_ops; /* file operations */
190 void *private_data; /* private data for f_ops->open */
250 char name[0]; /* device name (keep at the end of 191 char name[0]; /* device name (keep at the end of
251 structure) */ 192 structure) */
252}; 193};
253 194
254typedef struct _snd_minor snd_minor_t;
255
256/* sound.c */ 195/* sound.c */
257 196
258extern int snd_major; 197extern int snd_major;
@@ -260,12 +199,18 @@ extern int snd_ecards_limit;
260 199
261void snd_request_card(int card); 200void snd_request_card(int card);
262 201
263int snd_register_device(int type, snd_card_t *card, int dev, snd_minor_t *reg, const char *name); 202int snd_register_device(int type, struct snd_card *card, int dev,
264int snd_unregister_device(int type, snd_card_t *card, int dev); 203 struct file_operations *f_ops, void *private_data,
204 const char *name);
205int snd_unregister_device(int type, struct snd_card *card, int dev);
206void *snd_lookup_minor_data(unsigned int minor, int type);
265 207
266#ifdef CONFIG_SND_OSSEMUL 208#ifdef CONFIG_SND_OSSEMUL
267int snd_register_oss_device(int type, snd_card_t *card, int dev, snd_minor_t *reg, const char *name); 209int snd_register_oss_device(int type, struct snd_card *card, int dev,
268int snd_unregister_oss_device(int type, snd_card_t *card, int dev); 210 struct file_operations *f_ops, void *private_data,
211 const char *name);
212int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
213void *snd_lookup_oss_minor_data(unsigned int minor, int type);
269#endif 214#endif
270 215
271int snd_minor_info_init(void); 216int snd_minor_info_init(void);
@@ -276,11 +221,9 @@ int snd_minor_info_done(void);
276#ifdef CONFIG_SND_OSSEMUL 221#ifdef CONFIG_SND_OSSEMUL
277int snd_minor_info_oss_init(void); 222int snd_minor_info_oss_init(void);
278int snd_minor_info_oss_done(void); 223int snd_minor_info_oss_done(void);
279int snd_oss_init_module(void);
280#else 224#else
281#define snd_minor_info_oss_init() /*NOP*/ 225#define snd_minor_info_oss_init() /*NOP*/
282#define snd_minor_info_oss_done() /*NOP*/ 226#define snd_minor_info_oss_done() /*NOP*/
283#define snd_oss_init_module() 0
284#endif 227#endif
285 228
286/* memory.c */ 229/* memory.c */
@@ -291,43 +234,41 @@ int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size
291/* init.c */ 234/* init.c */
292 235
293extern unsigned int snd_cards_lock; 236extern unsigned int snd_cards_lock;
294extern snd_card_t *snd_cards[SNDRV_CARDS]; 237extern struct snd_card *snd_cards[SNDRV_CARDS];
295extern rwlock_t snd_card_rwlock; 238extern rwlock_t snd_card_rwlock;
296#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 239#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
297#define SND_MIXER_OSS_NOTIFY_REGISTER 0 240#define SND_MIXER_OSS_NOTIFY_REGISTER 0
298#define SND_MIXER_OSS_NOTIFY_DISCONNECT 1 241#define SND_MIXER_OSS_NOTIFY_DISCONNECT 1
299#define SND_MIXER_OSS_NOTIFY_FREE 2 242#define SND_MIXER_OSS_NOTIFY_FREE 2
300extern int (*snd_mixer_oss_notify_callback)(snd_card_t *card, int cmd); 243extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
301#endif 244#endif
302 245
303snd_card_t *snd_card_new(int idx, const char *id, 246struct snd_card *snd_card_new(int idx, const char *id,
304 struct module *module, int extra_size); 247 struct module *module, int extra_size);
305int snd_card_disconnect(snd_card_t *card); 248int snd_card_disconnect(struct snd_card *card);
306int snd_card_free(snd_card_t *card); 249int snd_card_free(struct snd_card *card);
307int snd_card_free_in_thread(snd_card_t *card); 250int snd_card_free_in_thread(struct snd_card *card);
308int snd_card_register(snd_card_t *card); 251int snd_card_register(struct snd_card *card);
309int snd_card_info_init(void); 252int snd_card_info_init(void);
310int snd_card_info_done(void); 253int snd_card_info_done(void);
311int snd_component_add(snd_card_t *card, const char *component); 254int snd_component_add(struct snd_card *card, const char *component);
312int snd_card_file_add(snd_card_t *card, struct file *file); 255int snd_card_file_add(struct snd_card *card, struct file *file);
313int snd_card_file_remove(snd_card_t *card, struct file *file); 256int snd_card_file_remove(struct snd_card *card, struct file *file);
314 257
315#ifndef snd_card_set_dev 258#ifndef snd_card_set_dev
316#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr)) 259#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr))
317#endif 260#endif
318/* register a generic device (for ISA, etc) */
319int snd_card_set_generic_dev(snd_card_t *card);
320 261
321/* device.c */ 262/* device.c */
322 263
323int snd_device_new(snd_card_t *card, snd_device_type_t type, 264int snd_device_new(struct snd_card *card, snd_device_type_t type,
324 void *device_data, snd_device_ops_t *ops); 265 void *device_data, struct snd_device_ops *ops);
325int snd_device_register(snd_card_t *card, void *device_data); 266int snd_device_register(struct snd_card *card, void *device_data);
326int snd_device_register_all(snd_card_t *card); 267int snd_device_register_all(struct snd_card *card);
327int snd_device_disconnect(snd_card_t *card, void *device_data); 268int snd_device_disconnect(struct snd_card *card, void *device_data);
328int snd_device_disconnect_all(snd_card_t *card); 269int snd_device_disconnect_all(struct snd_card *card);
329int snd_device_free(snd_card_t *card, void *device_data); 270int snd_device_free(struct snd_card *card, void *device_data);
330int snd_device_free_all(snd_card_t *card, snd_device_cmd_t cmd); 271int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd);
331 272
332/* isadma.c */ 273/* isadma.c */
333 274
@@ -443,4 +384,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
443#endif 384#endif
444#endif 385#endif
445 386
387#include "typedefs.h"
388
446#endif /* __SOUND_CORE_H */ 389#endif /* __SOUND_CORE_H */
diff --git a/include/sound/cs4231.h b/include/sound/cs4231.h
index d7f90823778a..ac6a5d882088 100644
--- a/include/sound/cs4231.h
+++ b/include/sound/cs4231.h
@@ -26,21 +26,6 @@
26#include "pcm.h" 26#include "pcm.h"
27#include "timer.h" 27#include "timer.h"
28 28
29#ifdef CONFIG_SBUS
30#define SBUS_SUPPORT
31#include <asm/sbus.h>
32#endif
33
34#if defined(CONFIG_PCI) && defined(CONFIG_SPARC64)
35#define EBUS_SUPPORT
36#include <linux/pci.h>
37#include <asm/ebus.h>
38#endif
39
40#if !defined(SBUS_SUPPORT) && !defined(EBUS_SUPPORT)
41#define LEGACY_SUPPORT
42#endif
43
44/* IO ports */ 29/* IO ports */
45 30
46#define CS4231P(x) (c_d_c_CS4231##x) 31#define CS4231P(x) (c_d_c_CS4231##x)
@@ -232,18 +217,14 @@
232#define CS4231_HWSHARE_DMA1 (1<<1) 217#define CS4231_HWSHARE_DMA1 (1<<1)
233#define CS4231_HWSHARE_DMA2 (1<<2) 218#define CS4231_HWSHARE_DMA2 (1<<2)
234 219
235typedef struct _snd_cs4231 cs4231_t; 220struct snd_cs4231 {
236
237struct _snd_cs4231 {
238 unsigned long port; /* base i/o port */ 221 unsigned long port; /* base i/o port */
239#ifdef LEGACY_SUPPORT
240 struct resource *res_port; 222 struct resource *res_port;
241 unsigned long cport; /* control base i/o port (CS4236) */ 223 unsigned long cport; /* control base i/o port (CS4236) */
242 struct resource *res_cport; 224 struct resource *res_cport;
243 int irq; /* IRQ line */ 225 int irq; /* IRQ line */
244 int dma1; /* playback DMA */ 226 int dma1; /* playback DMA */
245 int dma2; /* record DMA */ 227 int dma2; /* record DMA */
246#endif
247 unsigned short version; /* version of CODEC chip */ 228 unsigned short version; /* version of CODEC chip */
248 unsigned short mode; /* see to CS4231_MODE_XXXX */ 229 unsigned short mode; /* see to CS4231_MODE_XXXX */
249 unsigned short hardware; /* see to CS4231_HW_XXXX */ 230 unsigned short hardware; /* see to CS4231_HW_XXXX */
@@ -251,29 +232,11 @@ struct _snd_cs4231 {
251 unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ 232 unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */
252 ebus_flag:1; /* SPARC: EBUS present */ 233 ebus_flag:1; /* SPARC: EBUS present */
253 234
254#ifdef EBUS_SUPPORT 235 struct snd_card *card;
255 struct ebus_dma_info eb2c; 236 struct snd_pcm *pcm;
256 struct ebus_dma_info eb2p; 237 struct snd_pcm_substream *playback_substream;
257#endif 238 struct snd_pcm_substream *capture_substream;
258 239 struct snd_timer *timer;
259#if defined(SBUS_SUPPORT) || defined(EBUS_SUPPORT)
260 union {
261#ifdef SBUS_SUPPORT
262 struct sbus_dev *sdev;
263#endif
264#ifdef EBUS_SUPPORT
265 struct pci_dev *pdev;
266#endif
267 } dev_u;
268 unsigned int p_periods_sent;
269 unsigned int c_periods_sent;
270#endif
271
272 snd_card_t *card;
273 snd_pcm_t *pcm;
274 snd_pcm_substream_t *playback_substream;
275 snd_pcm_substream_t *capture_substream;
276 snd_timer_t *timer;
277 240
278 unsigned char image[32]; /* registers image */ 241 unsigned char image[32]; /* registers image */
279 unsigned char eimage[32]; /* extended registers image */ 242 unsigned char eimage[32]; /* extended registers image */
@@ -281,63 +244,59 @@ struct _snd_cs4231 {
281 int mce_bit; 244 int mce_bit;
282 int calibrate_mute; 245 int calibrate_mute;
283 int sw_3d_bit; 246 int sw_3d_bit;
284#ifdef LEGACY_SUPPORT
285 unsigned int p_dma_size; 247 unsigned int p_dma_size;
286 unsigned int c_dma_size; 248 unsigned int c_dma_size;
287#endif
288 249
289 spinlock_t reg_lock; 250 spinlock_t reg_lock;
290 struct semaphore mce_mutex; 251 struct semaphore mce_mutex;
291 struct semaphore open_mutex; 252 struct semaphore open_mutex;
292 253
293 int (*rate_constraint) (snd_pcm_runtime_t *runtime); 254 int (*rate_constraint) (struct snd_pcm_runtime *runtime);
294 void (*set_playback_format) (cs4231_t *chip, snd_pcm_hw_params_t *hw_params, unsigned char pdfr); 255 void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr);
295 void (*set_capture_format) (cs4231_t *chip, snd_pcm_hw_params_t *hw_params, unsigned char cdfr); 256 void (*set_capture_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char cdfr);
296 void (*trigger) (cs4231_t *chip, unsigned int what, int start); 257 void (*trigger) (struct snd_cs4231 *chip, unsigned int what, int start);
297#ifdef CONFIG_PM 258#ifdef CONFIG_PM
298 void (*suspend) (cs4231_t *chip); 259 void (*suspend) (struct snd_cs4231 *chip);
299 void (*resume) (cs4231_t *chip); 260 void (*resume) (struct snd_cs4231 *chip);
300#endif 261#endif
301 void *dma_private_data; 262 void *dma_private_data;
302#ifdef LEGACY_SUPPORT 263 int (*claim_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma);
303 int (*claim_dma) (cs4231_t *chip, void *dma_private_data, int dma); 264 int (*release_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma);
304 int (*release_dma) (cs4231_t *chip, void *dma_private_data, int dma);
305#endif
306}; 265};
307 266
308/* exported functions */ 267/* exported functions */
309 268
310void snd_cs4231_out(cs4231_t *chip, unsigned char reg, unsigned char val); 269void snd_cs4231_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val);
311unsigned char snd_cs4231_in(cs4231_t *chip, unsigned char reg); 270unsigned char snd_cs4231_in(struct snd_cs4231 *chip, unsigned char reg);
312void snd_cs4236_ext_out(cs4231_t *chip, unsigned char reg, unsigned char val); 271void snd_cs4236_ext_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val);
313unsigned char snd_cs4236_ext_in(cs4231_t *chip, unsigned char reg); 272unsigned char snd_cs4236_ext_in(struct snd_cs4231 *chip, unsigned char reg);
314void snd_cs4231_mce_up(cs4231_t *chip); 273void snd_cs4231_mce_up(struct snd_cs4231 *chip);
315void snd_cs4231_mce_down(cs4231_t *chip); 274void snd_cs4231_mce_down(struct snd_cs4231 *chip);
316 275
317irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id, struct pt_regs *regs); 276irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id, struct pt_regs *regs);
318 277
319const char *snd_cs4231_chip_id(cs4231_t *chip); 278const char *snd_cs4231_chip_id(struct snd_cs4231 *chip);
320 279
321int snd_cs4231_create(snd_card_t * card, 280int snd_cs4231_create(struct snd_card *card,
322 unsigned long port, 281 unsigned long port,
323 unsigned long cport, 282 unsigned long cport,
324 int irq, int dma1, int dma2, 283 int irq, int dma1, int dma2,
325 unsigned short hardware, 284 unsigned short hardware,
326 unsigned short hwshare, 285 unsigned short hwshare,
327 cs4231_t ** rchip); 286 struct snd_cs4231 ** rchip);
328int snd_cs4231_pcm(cs4231_t * chip, int device, snd_pcm_t **rpcm); 287int snd_cs4231_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm);
329int snd_cs4231_timer(cs4231_t * chip, int device, snd_timer_t **rtimer); 288int snd_cs4231_timer(struct snd_cs4231 * chip, int device, struct snd_timer **rtimer);
330int snd_cs4231_mixer(cs4231_t * chip); 289int snd_cs4231_mixer(struct snd_cs4231 * chip);
331 290
332int snd_cs4236_create(snd_card_t * card, 291int snd_cs4236_create(struct snd_card *card,
333 unsigned long port, 292 unsigned long port,
334 unsigned long cport, 293 unsigned long cport,
335 int irq, int dma1, int dma2, 294 int irq, int dma1, int dma2,
336 unsigned short hardware, 295 unsigned short hardware,
337 unsigned short hwshare, 296 unsigned short hwshare,
338 cs4231_t ** rchip); 297 struct snd_cs4231 ** rchip);
339int snd_cs4236_pcm(cs4231_t * chip, int device, snd_pcm_t **rpcm); 298int snd_cs4236_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm);
340int snd_cs4236_mixer(cs4231_t * chip); 299int snd_cs4236_mixer(struct snd_cs4231 * chip);
341 300
342/* 301/*
343 * mixer library 302 * mixer library
@@ -349,9 +308,9 @@ int snd_cs4236_mixer(cs4231_t * chip);
349 .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \ 308 .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \
350 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } 309 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
351 310
352int snd_cs4231_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo); 311int snd_cs4231_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
353int snd_cs4231_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 312int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
354int snd_cs4231_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 313int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
355 314
356#define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ 315#define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
357{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ 316{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
@@ -359,8 +318,8 @@ int snd_cs4231_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucon
359 .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \ 318 .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \
360 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } 319 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
361 320
362int snd_cs4231_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo); 321int snd_cs4231_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
363int snd_cs4231_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 322int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
364int snd_cs4231_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 323int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
365 324
366#endif /* __SOUND_CS4231_H */ 325#endif /* __SOUND_CS4231_H */
diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h
index b0c0e192eb56..199b5098ff7e 100644
--- a/include/sound/cs46xx.h
+++ b/include/sound/cs46xx.h
@@ -1631,42 +1631,41 @@
1631#define CS46XX_MIXER_SPDIF_INPUT_ELEMENT 1 1631#define CS46XX_MIXER_SPDIF_INPUT_ELEMENT 1
1632#define CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT 2 1632#define CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT 2
1633 1633
1634typedef struct _snd_cs46xx cs46xx_t;
1635 1634
1636typedef struct _snd_cs46xx_pcm_t { 1635struct snd_cs46xx_pcm {
1637 struct snd_dma_buffer hw_buf; 1636 struct snd_dma_buffer hw_buf;
1638 1637
1639 unsigned int ctl; 1638 unsigned int ctl;
1640 unsigned int shift; /* Shift count to trasform frames in bytes */ 1639 unsigned int shift; /* Shift count to trasform frames in bytes */
1641 snd_pcm_indirect_t pcm_rec; 1640 struct snd_pcm_indirect pcm_rec;
1642 snd_pcm_substream_t *substream; 1641 struct snd_pcm_substream *substream;
1643 1642
1644 pcm_channel_descriptor_t * pcm_channel; 1643 struct dsp_pcm_channel_descriptor * pcm_channel;
1645 1644
1646 int pcm_channel_id; /* Fron Rear, Center Lfe ... */ 1645 int pcm_channel_id; /* Fron Rear, Center Lfe ... */
1647} cs46xx_pcm_t; 1646};
1648 1647
1649typedef struct { 1648struct snd_cs46xx_region {
1650 char name[24]; 1649 char name[24];
1651 unsigned long base; 1650 unsigned long base;
1652 void __iomem *remap_addr; 1651 void __iomem *remap_addr;
1653 unsigned long size; 1652 unsigned long size;
1654 struct resource *resource; 1653 struct resource *resource;
1655} snd_cs46xx_region_t; 1654};
1656 1655
1657struct _snd_cs46xx { 1656struct snd_cs46xx {
1658 int irq; 1657 int irq;
1659 unsigned long ba0_addr; 1658 unsigned long ba0_addr;
1660 unsigned long ba1_addr; 1659 unsigned long ba1_addr;
1661 union { 1660 union {
1662 struct { 1661 struct {
1663 snd_cs46xx_region_t ba0; 1662 struct snd_cs46xx_region ba0;
1664 snd_cs46xx_region_t data0; 1663 struct snd_cs46xx_region data0;
1665 snd_cs46xx_region_t data1; 1664 struct snd_cs46xx_region data1;
1666 snd_cs46xx_region_t pmem; 1665 struct snd_cs46xx_region pmem;
1667 snd_cs46xx_region_t reg; 1666 struct snd_cs46xx_region reg;
1668 } name; 1667 } name;
1669 snd_cs46xx_region_t idx[5]; 1668 struct snd_cs46xx_region idx[5];
1670 } region; 1669 } region;
1671 1670
1672 unsigned int mode; 1671 unsigned int mode;
@@ -1676,34 +1675,34 @@ struct _snd_cs46xx {
1676 1675
1677 unsigned int ctl; 1676 unsigned int ctl;
1678 unsigned int shift; /* Shift count to trasform frames in bytes */ 1677 unsigned int shift; /* Shift count to trasform frames in bytes */
1679 snd_pcm_indirect_t pcm_rec; 1678 struct snd_pcm_indirect pcm_rec;
1680 snd_pcm_substream_t *substream; 1679 struct snd_pcm_substream *substream;
1681 } capt; 1680 } capt;
1682 1681
1683 1682
1684 int nr_ac97_codecs; 1683 int nr_ac97_codecs;
1685 ac97_bus_t *ac97_bus; 1684 struct snd_ac97_bus *ac97_bus;
1686 ac97_t *ac97[MAX_NR_AC97]; 1685 struct snd_ac97 *ac97[MAX_NR_AC97];
1687 1686
1688 struct pci_dev *pci; 1687 struct pci_dev *pci;
1689 snd_card_t *card; 1688 struct snd_card *card;
1690 snd_pcm_t *pcm; 1689 struct snd_pcm *pcm;
1691 1690
1692 snd_rawmidi_t *rmidi; 1691 struct snd_rawmidi *rmidi;
1693 snd_rawmidi_substream_t *midi_input; 1692 struct snd_rawmidi_substream *midi_input;
1694 snd_rawmidi_substream_t *midi_output; 1693 struct snd_rawmidi_substream *midi_output;
1695 1694
1696 spinlock_t reg_lock; 1695 spinlock_t reg_lock;
1697 unsigned int midcr; 1696 unsigned int midcr;
1698 unsigned int uartm; 1697 unsigned int uartm;
1699 1698
1700 int amplifier; 1699 int amplifier;
1701 void (*amplifier_ctrl)(cs46xx_t *, int); 1700 void (*amplifier_ctrl)(struct snd_cs46xx *, int);
1702 void (*active_ctrl)(cs46xx_t *, int); 1701 void (*active_ctrl)(struct snd_cs46xx *, int);
1703 void (*mixer_init)(cs46xx_t *); 1702 void (*mixer_init)(struct snd_cs46xx *);
1704 1703
1705 int acpi_port; 1704 int acpi_port;
1706 snd_kcontrol_t *eapd_switch; /* for amplifier hack */ 1705 struct snd_kcontrol *eapd_switch; /* for amplifier hack */
1707 int accept_valid; /* accept mmap valid (for OSS) */ 1706 int accept_valid; /* accept mmap valid (for OSS) */
1708 1707
1709 struct gameport *gameport; 1708 struct gameport *gameport;
@@ -1714,29 +1713,31 @@ struct _snd_cs46xx {
1714#ifdef CONFIG_SND_CS46XX_NEW_DSP 1713#ifdef CONFIG_SND_CS46XX_NEW_DSP
1715 struct semaphore spos_mutex; 1714 struct semaphore spos_mutex;
1716 1715
1717 dsp_spos_instance_t * dsp_spos_instance; 1716 struct dsp_spos_instance * dsp_spos_instance;
1718 1717
1719 snd_pcm_t *pcm_rear; 1718 struct snd_pcm *pcm_rear;
1720 snd_pcm_t *pcm_center_lfe; 1719 struct snd_pcm *pcm_center_lfe;
1721 snd_pcm_t *pcm_iec958; 1720 struct snd_pcm *pcm_iec958;
1722#else /* for compatibility */ 1721#else /* for compatibility */
1723 cs46xx_pcm_t *playback_pcm; 1722 struct snd_cs46xx_pcm *playback_pcm;
1724 unsigned int play_ctl; 1723 unsigned int play_ctl;
1725#endif 1724#endif
1726}; 1725};
1727 1726
1728int snd_cs46xx_create(snd_card_t *card, 1727int snd_cs46xx_create(struct snd_card *card,
1729 struct pci_dev *pci, 1728 struct pci_dev *pci,
1730 int external_amp, int thinkpad, 1729 int external_amp, int thinkpad,
1731 cs46xx_t **rcodec); 1730 struct snd_cs46xx **rcodec);
1732 1731int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state);
1733int snd_cs46xx_pcm(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1732int snd_cs46xx_resume(struct pci_dev *pci);
1734int snd_cs46xx_pcm_rear(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1733
1735int snd_cs46xx_pcm_iec958(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1734int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
1736int snd_cs46xx_pcm_center_lfe(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1735int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
1737int snd_cs46xx_mixer(cs46xx_t *chip, int spdif_device); 1736int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
1738int snd_cs46xx_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rmidi); 1737int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
1739int snd_cs46xx_start_dsp(cs46xx_t *chip); 1738int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device);
1740int snd_cs46xx_gameport(cs46xx_t *chip); 1739int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rmidi);
1740int snd_cs46xx_start_dsp(struct snd_cs46xx *chip);
1741int snd_cs46xx_gameport(struct snd_cs46xx *chip);
1741 1742
1742#endif /* __SOUND_CS46XX_H */ 1743#endif /* __SOUND_CS46XX_H */
diff --git a/include/sound/cs46xx_dsp_scb_types.h b/include/sound/cs46xx_dsp_scb_types.h
index 3f990a3a6903..9cb6c7d09567 100644
--- a/include/sound/cs46xx_dsp_scb_types.h
+++ b/include/sound/cs46xx_dsp_scb_types.h
@@ -41,7 +41,7 @@
41 41
42/* This structs are used internally by the SP */ 42/* This structs are used internally by the SP */
43 43
44typedef struct _basic_dma_req_t { 44struct dsp_basic_dma_req {
45 /* DMA Requestor Word 0 (DCW) fields: 45 /* DMA Requestor Word 0 (DCW) fields:
46 46
47 31 [30-28]27 [26:24] 23 22 21 20 [19:18] [17:16] 15 14 13 12 11 10 9 8 7 6 [5:0] 47 31 [30-28]27 [26:24] 23 22 21 20 [19:18] [17:16] 15 14 13 12 11 10 9 8 7 6 [5:0]
@@ -53,9 +53,9 @@ typedef struct _basic_dma_req_t {
53 u32 dmw; /* DMA Mode Word */ 53 u32 dmw; /* DMA Mode Word */
54 u32 saw; /* Source Address Word */ 54 u32 saw; /* Source Address Word */
55 u32 daw; /* Destination Address Word */ 55 u32 daw; /* Destination Address Word */
56} basic_dma_req_t; 56};
57 57
58typedef struct _scatter_gather_ext_t { 58struct dsp_scatter_gather_ext {
59 u32 npaw; /* Next-Page Address Word */ 59 u32 npaw; /* Next-Page Address Word */
60 60
61 /* DMA Requestor Word 5 (NPCW) fields: 61 /* DMA Requestor Word 5 (NPCW) fields:
@@ -69,9 +69,9 @@ typedef struct _scatter_gather_ext_t {
69 u32 lbaw; /* Loop-Begin Address Word */ 69 u32 lbaw; /* Loop-Begin Address Word */
70 u32 nplbaw; /* Next-Page after Loop-Begin Address Word */ 70 u32 nplbaw; /* Next-Page after Loop-Begin Address Word */
71 u32 sgaw; /* Scatter/Gather Address Word */ 71 u32 sgaw; /* Scatter/Gather Address Word */
72} scatter_gather_ext_t; 72};
73 73
74typedef struct _volume_control_t { 74struct dsp_volume_control {
75 ___DSP_DUAL_16BIT_ALLOC( 75 ___DSP_DUAL_16BIT_ALLOC(
76 rightTarg, /* Target volume for left & right channels */ 76 rightTarg, /* Target volume for left & right channels */
77 leftTarg 77 leftTarg
@@ -80,10 +80,10 @@ typedef struct _volume_control_t {
80 rightVol, /* Current left & right channel volumes */ 80 rightVol, /* Current left & right channel volumes */
81 leftVol 81 leftVol
82 ) 82 )
83} volume_control_t; 83};
84 84
85/* Generic stream control block (SCB) structure definition */ 85/* Generic stream control block (SCB) structure definition */
86typedef struct _generic_scb_t { 86struct dsp_generic_scb {
87 /* For streaming I/O, the DSP should never alter any words in the DMA 87 /* For streaming I/O, the DSP should never alter any words in the DMA
88 requestor or the scatter/gather extension. Only ad hoc DMA request 88 requestor or the scatter/gather extension. Only ad hoc DMA request
89 streams are free to alter the requestor (currently only occur in the 89 streams are free to alter the requestor (currently only occur in the
@@ -99,13 +99,13 @@ typedef struct _generic_scb_t {
99 99
100 /* Initialized by the host, only modified by DMA 100 /* Initialized by the host, only modified by DMA
101 R/O for the DSP task */ 101 R/O for the DSP task */
102 basic_dma_req_t basic_req; /* Optional */ 102 struct dsp_basic_dma_req basic_req; /* Optional */
103 103
104 /* Scatter/gather DMA requestor extension (5 ints) 104 /* Scatter/gather DMA requestor extension (5 ints)
105 Initialized by the host, only modified by DMA 105 Initialized by the host, only modified by DMA
106 DSP task never needs to even read these. 106 DSP task never needs to even read these.
107 */ 107 */
108 scatter_gather_ext_t sg_ext; /* Optional */ 108 struct dsp_scatter_gather_ext sg_ext; /* Optional */
109 109
110 /* Sublist pointer & next stream control block (SCB) link. 110 /* Sublist pointer & next stream control block (SCB) link.
111 Initialized & modified by the host R/O for the DSP task 111 Initialized & modified by the host R/O for the DSP task
@@ -179,11 +179,11 @@ typedef struct _generic_scb_t {
179 179
180 These two 32-bit words are redefined for wavetable & 3-D voices. 180 These two 32-bit words are redefined for wavetable & 3-D voices.
181 */ 181 */
182 volume_control_t vol_ctrl_t; /* Optional */ 182 struct dsp_volume_control vol_ctrl_t; /* Optional */
183} generic_scb_t; 183};
184 184
185 185
186typedef struct _spos_control_block_t { 186struct dsp_spos_control_block {
187 /* WARNING: Certain items in this structure are modified by the host 187 /* WARNING: Certain items in this structure are modified by the host
188 Any dword that can be modified by the host, must not be 188 Any dword that can be modified by the host, must not be
189 modified by the SP as the host can only do atomic dword 189 modified by the SP as the host can only do atomic dword
@@ -273,10 +273,10 @@ typedef struct _spos_control_block_t {
273 u32 r32_save_for_spurious_int; 273 u32 r32_save_for_spurious_int;
274 u32 r32_save_for_trap; 274 u32 r32_save_for_trap;
275 u32 r32_save_for_HFG; 275 u32 r32_save_for_HFG;
276} spos_control_block_t; 276};
277 277
278/* SPB for MIX_TO_OSTREAM algorithm family */ 278/* SPB for MIX_TO_OSTREAM algorithm family */
279typedef struct _mix2_ostream_spb_t 279struct dsp_mix2_ostream_spb
280{ 280{
281 /* 16b.16b integer.frac approximation to the 281 /* 16b.16b integer.frac approximation to the
282 number of 3 sample triplets to output each 282 number of 3 sample triplets to output each
@@ -290,13 +290,13 @@ typedef struct _mix2_ostream_spb_t
290 output triplets since the start of group 290 output triplets since the start of group
291 */ 291 */
292 u32 accumOutTriplets; 292 u32 accumOutTriplets;
293} mix2_ostream_spb_t; 293};
294 294
295/* SCB for Timing master algorithm */ 295/* SCB for Timing master algorithm */
296typedef struct _timing_master_scb_t { 296struct dsp_timing_master_scb {
297 /* First 12 dwords from generic_scb_t */ 297 /* First 12 dwords from generic_scb_t */
298 basic_dma_req_t basic_req; /* Optional */ 298 struct dsp_basic_dma_req basic_req; /* Optional */
299 scatter_gather_ext_t sg_ext; /* Optional */ 299 struct dsp_scatter_gather_ext sg_ext; /* Optional */
300 ___DSP_DUAL_16BIT_ALLOC( 300 ___DSP_DUAL_16BIT_ALLOC(
301 next_scb, /* REQUIRED */ 301 next_scb, /* REQUIRED */
302 sub_list_ptr /* REQUIRED */ 302 sub_list_ptr /* REQUIRED */
@@ -358,13 +358,13 @@ typedef struct _timing_master_scb_t {
358 number of samples to output each frame. 358 number of samples to output each frame.
359 (approximation must be floor, to insure */ 359 (approximation must be floor, to insure */
360 u32 nsamp_per_frm_q15; 360 u32 nsamp_per_frm_q15;
361} timing_master_scb_t; 361};
362 362
363/* SCB for CODEC output algorithm */ 363/* SCB for CODEC output algorithm */
364typedef struct _codec_output_scb_t { 364struct dsp_codec_output_scb {
365 /* First 13 dwords from generic_scb_t */ 365 /* First 13 dwords from generic_scb_t */
366 basic_dma_req_t basic_req; /* Optional */ 366 struct dsp_basic_dma_req basic_req; /* Optional */
367 scatter_gather_ext_t sg_ext; /* Optional */ 367 struct dsp_scatter_gather_ext sg_ext; /* Optional */
368 ___DSP_DUAL_16BIT_ALLOC( 368 ___DSP_DUAL_16BIT_ALLOC(
369 next_scb, /* REQUIRED */ 369 next_scb, /* REQUIRED */
370 sub_list_ptr /* REQUIRED */ 370 sub_list_ptr /* REQUIRED */
@@ -422,13 +422,13 @@ typedef struct _codec_output_scb_t {
422 reserved, 422 reserved,
423 last_sub_ptr 423 last_sub_ptr
424 ) 424 )
425} codec_output_scb_t; 425};
426 426
427/* SCB for CODEC input algorithm */ 427/* SCB for CODEC input algorithm */
428typedef struct _codec_input_scb_t { 428struct dsp_codec_input_scb {
429 /* First 13 dwords from generic_scb_t */ 429 /* First 13 dwords from generic_scb_t */
430 basic_dma_req_t basic_req; /* Optional */ 430 struct dsp_basic_dma_req basic_req; /* Optional */
431 scatter_gather_ext_t sg_ext; /* Optional */ 431 struct dsp_scatter_gather_ext sg_ext; /* Optional */
432 ___DSP_DUAL_16BIT_ALLOC( 432 ___DSP_DUAL_16BIT_ALLOC(
433 next_scb, /* REQUIRED */ 433 next_scb, /* REQUIRED */
434 sub_list_ptr /* REQUIRED */ 434 sub_list_ptr /* REQUIRED */
@@ -479,13 +479,13 @@ typedef struct _codec_input_scb_t {
479 ) 479 )
480 480
481 u32 reserved2; 481 u32 reserved2;
482} codec_input_scb_t; 482};
483 483
484 484
485typedef struct _pcm_serial_input_scb_t { 485struct dsp_pcm_serial_input_scb {
486 /* First 13 dwords from generic_scb_t */ 486 /* First 13 dwords from generic_scb_t */
487 basic_dma_req_t basic_req; /* Optional */ 487 struct dsp_basic_dma_req basic_req; /* Optional */
488 scatter_gather_ext_t sg_ext; /* Optional */ 488 struct dsp_scatter_gather_ext sg_ext; /* Optional */
489 ___DSP_DUAL_16BIT_ALLOC( 489 ___DSP_DUAL_16BIT_ALLOC(
490 next_scb, /* REQUIRED */ 490 next_scb, /* REQUIRED */
491 sub_list_ptr /* REQUIRED */ 491 sub_list_ptr /* REQUIRED */
@@ -512,11 +512,11 @@ typedef struct _pcm_serial_input_scb_t {
512 ) 512 )
513 513
514 /* Initialized by the host (host updates target volumes) */ 514 /* Initialized by the host (host updates target volumes) */
515 volume_control_t psi_vol_ctrl; 515 struct dsp_volume_control psi_vol_ctrl;
516 516
517} pcm_serial_input_scb_t; 517};
518 518
519typedef struct _src_task_scb_t { 519struct dsp_src_task_scb {
520 ___DSP_DUAL_16BIT_ALLOC( 520 ___DSP_DUAL_16BIT_ALLOC(
521 frames_left_in_gof, 521 frames_left_in_gof,
522 gofs_left_in_sec 522 gofs_left_in_sec
@@ -571,10 +571,10 @@ typedef struct _src_task_scb_t {
571 571
572 u32 phiIncr6int_26frac; 572 u32 phiIncr6int_26frac;
573 573
574 volume_control_t src_vol_ctrl; 574 struct dsp_volume_control src_vol_ctrl;
575} src_task_scb_t; 575};
576 576
577typedef struct _decimate_by_pow2_scb_t { 577struct dsp_decimate_by_pow2_scb {
578 /* decimationFactor = 2, 4, or 8 (larger factors waste too much memory 578 /* decimationFactor = 2, 4, or 8 (larger factors waste too much memory
579 when compared to cascading decimators) 579 when compared to cascading decimators)
580 */ 580 */
@@ -648,10 +648,10 @@ typedef struct _decimate_by_pow2_scb_t {
648 648
649 u32 dec2_reserved4; 649 u32 dec2_reserved4;
650 650
651 volume_control_t dec2_vol_ctrl; /* Not used! */ 651 struct dsp_volume_control dec2_vol_ctrl; /* Not used! */
652} decimate_by_pow2_scb_t; 652};
653 653
654typedef struct _vari_decimate_scb_t { 654struct dsp_vari_decimate_scb {
655 ___DSP_DUAL_16BIT_ALLOC( 655 ___DSP_DUAL_16BIT_ALLOC(
656 vdec_frames_left_in_gof, 656 vdec_frames_left_in_gof,
657 vdec_gofs_left_in_sec 657 vdec_gofs_left_in_sec
@@ -711,15 +711,15 @@ typedef struct _vari_decimate_scb_t {
711 711
712 u32 vdec_phi_incr_6int_26frac; 712 u32 vdec_phi_incr_6int_26frac;
713 713
714 volume_control_t vdec_vol_ctrl; 714 struct dsp_volume_control vdec_vol_ctrl;
715} vari_decimate_scb_t; 715};
716 716
717 717
718/* SCB for MIX_TO_OSTREAM algorithm family */ 718/* SCB for MIX_TO_OSTREAM algorithm family */
719typedef struct _mix2_ostream_scb_t { 719struct dsp_mix2_ostream_scb {
720 /* First 13 dwords from generic_scb_t */ 720 /* First 13 dwords from generic_scb_t */
721 basic_dma_req_t basic_req; /* Optional */ 721 struct dsp_basic_dma_req basic_req; /* Optional */
722 scatter_gather_ext_t sg_ext; /* Optional */ 722 struct dsp_scatter_gather_ext sg_ext; /* Optional */
723 ___DSP_DUAL_16BIT_ALLOC( 723 ___DSP_DUAL_16BIT_ALLOC(
724 next_scb, /* REQUIRED */ 724 next_scb, /* REQUIRED */
725 sub_list_ptr /* REQUIRED */ 725 sub_list_ptr /* REQUIRED */
@@ -758,14 +758,14 @@ typedef struct _mix2_ostream_scb_t {
758 const_FFFF, 758 const_FFFF,
759 const_zero 759 const_zero
760 ) 760 )
761} mix2_ostream_scb_t; 761};
762 762
763 763
764/* SCB for S16_MIX algorithm */ 764/* SCB for S16_MIX algorithm */
765typedef struct _mix_only_scb_t { 765struct dsp_mix_only_scb {
766 /* First 13 dwords from generic_scb_t */ 766 /* First 13 dwords from generic_scb_t */
767 basic_dma_req_t basic_req; /* Optional */ 767 struct dsp_basic_dma_req basic_req; /* Optional */
768 scatter_gather_ext_t sg_ext; /* Optional */ 768 struct dsp_scatter_gather_ext sg_ext; /* Optional */
769 ___DSP_DUAL_16BIT_ALLOC( 769 ___DSP_DUAL_16BIT_ALLOC(
770 next_scb, /* REQUIRED */ 770 next_scb, /* REQUIRED */
771 sub_list_ptr /* REQUIRED */ 771 sub_list_ptr /* REQUIRED */
@@ -780,11 +780,11 @@ typedef struct _mix_only_scb_t {
780 u32 strm_buf_ptr; /* REQUIRED */ 780 u32 strm_buf_ptr; /* REQUIRED */
781 781
782 u32 reserved; 782 u32 reserved;
783 volume_control_t vol_ctrl; 783 struct dsp_volume_control vol_ctrl;
784} mix_only_scb_t; 784};
785 785
786/* SCB for the async. CODEC input algorithm */ 786/* SCB for the async. CODEC input algorithm */
787typedef struct _async_codec_input_scb_t { 787struct dsp_async_codec_input_scb {
788 u32 io_free2; 788 u32 io_free2;
789 789
790 u32 io_current_total; 790 u32 io_current_total;
@@ -837,11 +837,11 @@ typedef struct _async_codec_input_scb_t {
837 ) 837 )
838 838
839 u32 i_free; 839 u32 i_free;
840} async_codec_input_scb_t; 840};
841 841
842 842
843/* SCB for the SP/DIF CODEC input and output */ 843/* SCB for the SP/DIF CODEC input and output */
844typedef struct _spdifiscb_t { 844struct dsp_spdifiscb {
845 ___DSP_DUAL_16BIT_ALLOC( 845 ___DSP_DUAL_16BIT_ALLOC(
846 status_ptr, 846 status_ptr,
847 status_start_ptr 847 status_start_ptr
@@ -895,12 +895,11 @@ typedef struct _spdifiscb_t {
895 ) 895 )
896 896
897 u32 free1; 897 u32 free1;
898} spdifiscb_t; 898};
899 899
900 900
901/* SCB for the SP/DIF CODEC input and output */ 901/* SCB for the SP/DIF CODEC input and output */
902typedef struct _spdifoscb_t { 902struct dsp_spdifoscb {
903
904 903
905 u32 free2; 904 u32 free2;
906 905
@@ -941,11 +940,10 @@ typedef struct _spdifoscb_t {
941 ) 940 )
942 941
943 u32 free1; 942 u32 free1;
944} spdifoscb_t; 943};
945
946 944
947 945
948typedef struct _asynch_fg_rx_scb_t { 946struct dsp_asynch_fg_rx_scb {
949 ___DSP_DUAL_16BIT_ALLOC( 947 ___DSP_DUAL_16BIT_ALLOC(
950 bot_buf_mask, 948 bot_buf_mask,
951 buf_Mask 949 buf_Mask
@@ -993,11 +991,10 @@ typedef struct _asynch_fg_rx_scb_t {
993 right_vol, 991 right_vol,
994 left_vol 992 left_vol
995 ) 993 )
996} asynch_fg_rx_scb_t; 994};
997
998 995
999 996
1000typedef struct _asynch_fg_tx_scb_t { 997struct dsp_asynch_fg_tx_scb {
1001 ___DSP_DUAL_16BIT_ALLOC( 998 ___DSP_DUAL_16BIT_ALLOC(
1002 not_buf_mask, 999 not_buf_mask,
1003 buf_mask 1000 buf_mask
@@ -1052,13 +1049,13 @@ typedef struct _asynch_fg_tx_scb_t {
1052 unused_right_vol, 1049 unused_right_vol,
1053 unused_left_vol 1050 unused_left_vol
1054 ) 1051 )
1055} asynch_fg_tx_scb_t; 1052};
1056 1053
1057 1054
1058typedef struct _output_snoop_scb_t { 1055struct dsp_output_snoop_scb {
1059 /* First 13 dwords from generic_scb_t */ 1056 /* First 13 dwords from generic_scb_t */
1060 basic_dma_req_t basic_req; /* Optional */ 1057 struct dsp_basic_dma_req basic_req; /* Optional */
1061 scatter_gather_ext_t sg_ext; /* Optional */ 1058 struct dsp_scatter_gather_ext sg_ext; /* Optional */
1062 ___DSP_DUAL_16BIT_ALLOC( 1059 ___DSP_DUAL_16BIT_ALLOC(
1063 next_scb, /* REQUIRED */ 1060 next_scb, /* REQUIRED */
1064 sub_list_ptr /* REQUIRED */ 1061 sub_list_ptr /* REQUIRED */
@@ -1083,9 +1080,9 @@ typedef struct _output_snoop_scb_t {
1083 reserved, 1080 reserved,
1084 input_scb 1081 input_scb
1085 ) 1082 )
1086} output_snoop_scb_t; 1083};
1087 1084
1088typedef struct _spio_write_scb_t { 1085struct dsp_spio_write_scb {
1089 ___DSP_DUAL_16BIT_ALLOC( 1086 ___DSP_DUAL_16BIT_ALLOC(
1090 address1, 1087 address1,
1091 address2 1088 address2
@@ -1122,9 +1119,9 @@ typedef struct _spio_write_scb_t {
1122 ) 1119 )
1123 1120
1124 u32 unused3[5]; 1121 u32 unused3[5];
1125} spio_write_scb_t; 1122};
1126 1123
1127typedef struct _magic_snoop_task_t { 1124struct dsp_magic_snoop_task {
1128 u32 i0; 1125 u32 i0;
1129 u32 i1; 1126 u32 i1;
1130 1127
@@ -1155,11 +1152,11 @@ typedef struct _magic_snoop_task_t {
1155 1152
1156 u32 i8; 1153 u32 i8;
1157 1154
1158 volume_control_t vdec_vol_ctrl; 1155 struct dsp_volume_control vdec_vol_ctrl;
1159} magic_snoop_task_t; 1156};
1160 1157
1161 1158
1162typedef struct _filter_scb_t { 1159struct dsp_filter_scb {
1163 ___DSP_DUAL_16BIT_ALLOC( 1160 ___DSP_DUAL_16BIT_ALLOC(
1164 a0_right, /* 0x00 */ 1161 a0_right, /* 0x00 */
1165 a0_left 1162 a0_left
@@ -1212,5 +1209,5 @@ typedef struct _filter_scb_t {
1212 b2_right, /* 0x0F */ 1209 b2_right, /* 0x0F */
1213 b2_left 1210 b2_left
1214 ) 1211 )
1215} filter_scb_t; 1212};
1216#endif /* __DSP_SCB_TYPES_H__ */ 1213#endif /* __DSP_SCB_TYPES_H__ */
diff --git a/include/sound/cs46xx_dsp_spos.h b/include/sound/cs46xx_dsp_spos.h
index 10014cb62423..da934def31e9 100644
--- a/include/sound/cs46xx_dsp_spos.h
+++ b/include/sound/cs46xx_dsp_spos.h
@@ -65,133 +65,130 @@
65#define DSP_SPDIF_STATUS_HW_ENABLED 4 65#define DSP_SPDIF_STATUS_HW_ENABLED 4
66#define DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED 8 66#define DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED 8
67 67
68struct _dsp_module_desc_t; 68struct dsp_symbol_entry {
69
70typedef struct _symbol_entry_t {
71 u32 address; 69 u32 address;
72 char symbol_name[DSP_MAX_SYMBOL_NAME]; 70 char symbol_name[DSP_MAX_SYMBOL_NAME];
73 int symbol_type; 71 int symbol_type;
74 72
75 /* initialized by driver */ 73 /* initialized by driver */
76 struct _dsp_module_desc_t * module; 74 struct dsp_module_desc * module;
77 int deleted; 75 int deleted;
78} symbol_entry_t; 76};
79 77
80typedef struct _symbol_desc_t { 78struct dsp_symbol_desc {
81 int nsymbols; 79 int nsymbols;
82 80
83 symbol_entry_t * symbols; 81 struct dsp_symbol_entry *symbols;
84 82
85 /* initialized by driver */ 83 /* initialized by driver */
86 int highest_frag_index; 84 int highest_frag_index;
87} symbol_desc_t; 85};
88
89 86
90typedef struct _segment_desc_t { 87struct dsp_segment_desc {
91 int segment_type; 88 int segment_type;
92 u32 offset; 89 u32 offset;
93 u32 size; 90 u32 size;
94 u32 * data; 91 u32 * data;
95} segment_desc_t; 92};
96 93
97typedef struct _dsp_module_desc_t { 94struct dsp_module_desc {
98 char * module_name; 95 char * module_name;
99 symbol_desc_t symbol_table; 96 struct dsp_symbol_desc symbol_table;
100 int nsegments; 97 int nsegments;
101 segment_desc_t * segments; 98 struct dsp_segment_desc * segments;
102 99
103 /* initialized by driver */ 100 /* initialized by driver */
104 u32 overlay_begin_address; 101 u32 overlay_begin_address;
105 u32 load_address; 102 u32 load_address;
106 int nfixups; 103 int nfixups;
107} dsp_module_desc_t; 104};
108 105
109typedef struct _dsp_scb_descriptor_t { 106struct dsp_scb_descriptor {
110 char scb_name[DSP_MAX_SCB_NAME]; 107 char scb_name[DSP_MAX_SCB_NAME];
111 u32 address; 108 u32 address;
112 int index; 109 int index;
113 110
114 struct _dsp_scb_descriptor_t * sub_list_ptr; 111 struct dsp_scb_descriptor * sub_list_ptr;
115 struct _dsp_scb_descriptor_t * next_scb_ptr; 112 struct dsp_scb_descriptor * next_scb_ptr;
116 struct _dsp_scb_descriptor_t * parent_scb_ptr; 113 struct dsp_scb_descriptor * parent_scb_ptr;
117 114
118 symbol_entry_t * task_entry; 115 struct dsp_symbol_entry * task_entry;
119 symbol_entry_t * scb_symbol; 116 struct dsp_symbol_entry * scb_symbol;
120 117
121 snd_info_entry_t *proc_info; 118 struct snd_info_entry *proc_info;
122 int ref_count; 119 int ref_count;
123 spinlock_t lock; 120 spinlock_t lock;
124 121
125 int deleted; 122 int deleted;
126} dsp_scb_descriptor_t; 123};
127 124
128typedef struct _dsp_task_descriptor_t { 125struct dsp_task_descriptor {
129 char task_name[DSP_MAX_TASK_NAME]; 126 char task_name[DSP_MAX_TASK_NAME];
130 int size; 127 int size;
131 u32 address; 128 u32 address;
132 int index; 129 int index;
133} dsp_task_descriptor_t; 130};
134 131
135typedef struct _pcm_channel_descriptor_t { 132struct dsp_pcm_channel_descriptor {
136 int active; 133 int active;
137 int src_slot; 134 int src_slot;
138 int pcm_slot; 135 int pcm_slot;
139 u32 sample_rate; 136 u32 sample_rate;
140 u32 unlinked; 137 u32 unlinked;
141 dsp_scb_descriptor_t * pcm_reader_scb; 138 struct dsp_scb_descriptor * pcm_reader_scb;
142 dsp_scb_descriptor_t * src_scb; 139 struct dsp_scb_descriptor * src_scb;
143 dsp_scb_descriptor_t * mixer_scb; 140 struct dsp_scb_descriptor * mixer_scb;
144 141
145 void * private_data; 142 void * private_data;
146} pcm_channel_descriptor_t; 143};
147 144
148typedef struct _dsp_spos_instance_t { 145struct dsp_spos_instance {
149 symbol_desc_t symbol_table; /* currently availble loaded symbols in SP */ 146 struct dsp_symbol_desc symbol_table; /* currently availble loaded symbols in SP */
150 147
151 int nmodules; 148 int nmodules;
152 dsp_module_desc_t * modules; /* modules loaded into SP */ 149 struct dsp_module_desc * modules; /* modules loaded into SP */
153 150
154 segment_desc_t code; 151 struct dsp_segment_desc code;
155 152
156 /* Main PCM playback mixer */ 153 /* Main PCM playback mixer */
157 dsp_scb_descriptor_t * master_mix_scb; 154 struct dsp_scb_descriptor * master_mix_scb;
158 u16 dac_volume_right; 155 u16 dac_volume_right;
159 u16 dac_volume_left; 156 u16 dac_volume_left;
160 157
161 /* Rear/surround PCM playback mixer */ 158 /* Rear/surround PCM playback mixer */
162 dsp_scb_descriptor_t * rear_mix_scb; 159 struct dsp_scb_descriptor * rear_mix_scb;
163 160
164 /* Center/LFE mixer */ 161 /* Center/LFE mixer */
165 dsp_scb_descriptor_t * center_lfe_mix_scb; 162 struct dsp_scb_descriptor * center_lfe_mix_scb;
166 163
167 int npcm_channels; 164 int npcm_channels;
168 int nsrc_scb; 165 int nsrc_scb;
169 pcm_channel_descriptor_t pcm_channels[DSP_MAX_PCM_CHANNELS]; 166 struct dsp_pcm_channel_descriptor pcm_channels[DSP_MAX_PCM_CHANNELS];
170 int src_scb_slots[DSP_MAX_SRC_NR]; 167 int src_scb_slots[DSP_MAX_SRC_NR];
171 168
172 /* cache this symbols */ 169 /* cache this symbols */
173 symbol_entry_t * null_algorithm; /* used by PCMreaderSCB's */ 170 struct dsp_symbol_entry * null_algorithm; /* used by PCMreaderSCB's */
174 symbol_entry_t * s16_up; /* used by SRCtaskSCB's */ 171 struct dsp_symbol_entry * s16_up; /* used by SRCtaskSCB's */
175 172
176 /* proc fs */ 173 /* proc fs */
177 snd_card_t * snd_card; 174 struct snd_card *snd_card;
178 snd_info_entry_t * proc_dsp_dir; 175 struct snd_info_entry * proc_dsp_dir;
179 snd_info_entry_t * proc_sym_info_entry; 176 struct snd_info_entry * proc_sym_info_entry;
180 snd_info_entry_t * proc_modules_info_entry; 177 struct snd_info_entry * proc_modules_info_entry;
181 snd_info_entry_t * proc_parameter_dump_info_entry; 178 struct snd_info_entry * proc_parameter_dump_info_entry;
182 snd_info_entry_t * proc_sample_dump_info_entry; 179 struct snd_info_entry * proc_sample_dump_info_entry;
183 180
184 /* SCB's descriptors */ 181 /* SCB's descriptors */
185 int nscb; 182 int nscb;
186 int scb_highest_frag_index; 183 int scb_highest_frag_index;
187 dsp_scb_descriptor_t scbs[DSP_MAX_SCB_DESC]; 184 struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC];
188 snd_info_entry_t * proc_scb_info_entry; 185 struct snd_info_entry * proc_scb_info_entry;
189 dsp_scb_descriptor_t * the_null_scb; 186 struct dsp_scb_descriptor * the_null_scb;
190 187
191 /* Task's descriptors */ 188 /* Task's descriptors */
192 int ntask; 189 int ntask;
193 dsp_task_descriptor_t tasks[DSP_MAX_TASK_DESC]; 190 struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC];
194 snd_info_entry_t * proc_task_info_entry; 191 struct snd_info_entry * proc_task_info_entry;
195 192
196 /* SPDIF status */ 193 /* SPDIF status */
197 int spdif_status_out; 194 int spdif_status_out;
@@ -204,30 +201,30 @@ typedef struct _dsp_spos_instance_t {
204 unsigned int spdif_csuv_stream; 201 unsigned int spdif_csuv_stream;
205 202
206 /* SPDIF input sample rate converter */ 203 /* SPDIF input sample rate converter */
207 dsp_scb_descriptor_t * spdif_in_src; 204 struct dsp_scb_descriptor * spdif_in_src;
208 /* SPDIF input asynch. receiver */ 205 /* SPDIF input asynch. receiver */
209 dsp_scb_descriptor_t * asynch_rx_scb; 206 struct dsp_scb_descriptor * asynch_rx_scb;
210 207
211 /* Capture record mixer SCB */ 208 /* Capture record mixer SCB */
212 dsp_scb_descriptor_t * record_mixer_scb; 209 struct dsp_scb_descriptor * record_mixer_scb;
213 210
214 /* CODEC input SCB */ 211 /* CODEC input SCB */
215 dsp_scb_descriptor_t * codec_in_scb; 212 struct dsp_scb_descriptor * codec_in_scb;
216 213
217 /* reference snooper */ 214 /* reference snooper */
218 dsp_scb_descriptor_t * ref_snoop_scb; 215 struct dsp_scb_descriptor * ref_snoop_scb;
219 216
220 /* SPDIF output PCM reference */ 217 /* SPDIF output PCM reference */
221 dsp_scb_descriptor_t * spdif_pcm_input_scb; 218 struct dsp_scb_descriptor * spdif_pcm_input_scb;
222 219
223 /* asynch TX task */ 220 /* asynch TX task */
224 dsp_scb_descriptor_t * asynch_tx_scb; 221 struct dsp_scb_descriptor * asynch_tx_scb;
225 222
226 /* record sources */ 223 /* record sources */
227 dsp_scb_descriptor_t * pcm_input; 224 struct dsp_scb_descriptor * pcm_input;
228 dsp_scb_descriptor_t * adc_input; 225 struct dsp_scb_descriptor * adc_input;
229 226
230 int spdif_in_sample_rate; 227 int spdif_in_sample_rate;
231} dsp_spos_instance_t; 228};
232 229
233#endif /* __DSP_SPOS_H__ */ 230#endif /* __DSP_SPOS_H__ */
diff --git a/include/sound/cs46xx_dsp_task_types.h b/include/sound/cs46xx_dsp_task_types.h
index 5dd3bf69cb03..b3076c487de6 100644
--- a/include/sound/cs46xx_dsp_task_types.h
+++ b/include/sound/cs46xx_dsp_task_types.h
@@ -71,7 +71,7 @@ Ptr____Call (c)
71 at the end of BG */ 71 at the end of BG */
72 72
73/* Minimal context save area for Hyper Forground */ 73/* Minimal context save area for Hyper Forground */
74typedef struct _hf_save_area_t { 74struct dsp_hf_save_area {
75 u32 r10_save; 75 u32 r10_save;
76 u32 r54_save; 76 u32 r54_save;
77 u32 r98_save; 77 u32 r98_save;
@@ -96,11 +96,11 @@ typedef struct _hf_save_area_t {
96 rsa2Save 96 rsa2Save
97 ) 97 )
98 /* saved as part of HFG context */ 98 /* saved as part of HFG context */
99} hf_save_area_t; 99};
100 100
101 101
102/* Task link data structure */ 102/* Task link data structure */
103typedef struct _tree_link_t { 103struct dsp_tree_link {
104 ___DSP_DUAL_16BIT_ALLOC( 104 ___DSP_DUAL_16BIT_ALLOC(
105 /* Pointer to sibling task control block */ 105 /* Pointer to sibling task control block */
106 next_scb, 106 next_scb,
@@ -114,10 +114,10 @@ typedef struct _tree_link_t {
114 /* Pointer to local data */ 114 /* Pointer to local data */
115 this_spb 115 this_spb
116 ) 116 )
117} tree_link_t; 117};
118 118
119 119
120typedef struct _task_tree_data_t { 120struct dsp_task_tree_data {
121 ___DSP_DUAL_16BIT_ALLOC( 121 ___DSP_DUAL_16BIT_ALLOC(
122 /* Initial tock count; controls task tree execution rate */ 122 /* Initial tock count; controls task tree execution rate */
123 tock_count_limit, 123 tock_count_limit,
@@ -155,11 +155,10 @@ typedef struct _task_tree_data_t {
155 data_stack_base_ptr 155 data_stack_base_ptr
156 ) 156 )
157 157
158} task_tree_data_t; 158};
159 159
160 160
161 161struct dsp_interval_timer_data
162typedef struct _interval_timer_data_t
163{ 162{
164 /* These data items have the same relative locations to those */ 163 /* These data items have the same relative locations to those */
165 ___DSP_DUAL_16BIT_ALLOC( 164 ___DSP_DUAL_16BIT_ALLOC(
@@ -172,12 +171,12 @@ typedef struct _interval_timer_data_t
172 num_FG_ticks_this_interval, 171 num_FG_ticks_this_interval,
173 num_intervals 172 num_intervals
174 ) 173 )
175} interval_timer_data_t; 174};
176 175
177 176
178/* This structure contains extra storage for the task tree 177/* This structure contains extra storage for the task tree
179 Currently, this additional data is related only to a full context save */ 178 Currently, this additional data is related only to a full context save */
180typedef struct _task_tree_context_block_t { 179struct dsp_task_tree_context_block {
181 /* Up to 10 values are saved onto the stack. 8 for the task tree, 1 for 180 /* Up to 10 values are saved onto the stack. 8 for the task tree, 1 for
182 The access to the context switch (call or interrupt), and 1 spare that 181 The access to the context switch (call or interrupt), and 1 spare that
183 users should never use. This last may be required by the system */ 182 users should never use. This last may be required by the system */
@@ -238,16 +237,16 @@ typedef struct _task_tree_context_block_t {
238 u32 saveaux2xaux3x; 237 u32 saveaux2xaux3x;
239 u32 savershouthl; 238 u32 savershouthl;
240 u32 savershoutxmacmode; 239 u32 savershoutxmacmode;
241} task_tree_context_block_t; 240};
242 241
243 242
244typedef struct _task_tree_control_block_t { 243struct dsp_task_tree_control_block {
245 hf_save_area_t context; 244 struct dsp_hf_save_area context;
246 tree_link_t links; 245 struct dsp_tree_link links;
247 task_tree_data_t data; 246 struct dsp_task_tree_data data;
248 task_tree_context_block_t context_blk; 247 struct dsp_task_tree_context_block context_blk;
249 interval_timer_data_t int_timer; 248 struct dsp_interval_timer_data int_timer;
250} task_tree_control_block_t; 249};
251 250
252 251
253#endif /* __DSP_TASK_TYPES_H__ */ 252#endif /* __DSP_TASK_TYPES_H__ */
diff --git a/include/sound/cs8403.h b/include/sound/cs8403.h
index 0b7d216e24f1..c6c3f9f0da78 100644
--- a/include/sound/cs8403.h
+++ b/include/sound/cs8403.h
@@ -36,7 +36,7 @@
36#endif 36#endif
37 37
38 38
39SND_CS8403_DECL void SND_CS8403_DECODE(snd_aes_iec958_t *diga, unsigned char bits) 39SND_CS8403_DECL void SND_CS8403_DECODE(struct snd_aes_iec958 *diga, unsigned char bits)
40{ 40{
41 if (bits & 0x01) { /* consumer */ 41 if (bits & 0x01) { /* consumer */
42 if (!(bits & 0x02)) 42 if (!(bits & 0x02))
@@ -79,7 +79,7 @@ SND_CS8403_DECL void SND_CS8403_DECODE(snd_aes_iec958_t *diga, unsigned char bit
79 } 79 }
80} 80}
81 81
82SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(snd_aes_iec958_t *diga) 82SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(struct snd_aes_iec958 *diga)
83{ 83{
84 unsigned char bits; 84 unsigned char bits;
85 85
@@ -166,7 +166,7 @@ SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(snd_aes_iec958_t *diga)
166#endif 166#endif
167 167
168 168
169SND_CS8404_DECL void SND_CS8404_DECODE(snd_aes_iec958_t *diga, unsigned char bits) 169SND_CS8404_DECL void SND_CS8404_DECODE(struct snd_aes_iec958 *diga, unsigned char bits)
170{ 170{
171 if (bits & 0x10) { /* consumer */ 171 if (bits & 0x10) { /* consumer */
172 if (!(bits & 0x20)) 172 if (!(bits & 0x20))
@@ -205,7 +205,7 @@ SND_CS8404_DECL void SND_CS8404_DECODE(snd_aes_iec958_t *diga, unsigned char bit
205 } 205 }
206} 206}
207 207
208SND_CS8404_DECL unsigned char SND_CS8404_ENCODE(snd_aes_iec958_t *diga) 208SND_CS8404_DECL unsigned char SND_CS8404_ENCODE(struct snd_aes_iec958 *diga)
209{ 209{
210 unsigned char bits; 210 unsigned char bits;
211 211
diff --git a/include/sound/cs8427.h b/include/sound/cs8427.h
index e725b7049a53..97fd9acf8028 100644
--- a/include/sound/cs8427.h
+++ b/include/sound/cs8427.h
@@ -186,11 +186,16 @@
186#define CS8427_VERSHIFT 0 186#define CS8427_VERSHIFT 0
187#define CS8427_VER8427A 0x71 187#define CS8427_VER8427A 0x71
188 188
189int snd_cs8427_create(snd_i2c_bus_t *bus, unsigned char addr, 189struct snd_pcm_substream;
190 unsigned int reset_timeout, snd_i2c_device_t **r_cs8427); 190
191int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned char val); 191int snd_cs8427_create(struct snd_i2c_bus *bus, unsigned char addr,
192int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427, snd_pcm_substream_t *playback_substream, snd_pcm_substream_t *capture_substream); 192 unsigned int reset_timeout, struct snd_i2c_device **r_cs8427);
193int snd_cs8427_iec958_active(snd_i2c_device_t *cs8427, int active); 193int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg,
194int snd_cs8427_iec958_pcm(snd_i2c_device_t *cs8427, unsigned int rate); 194 unsigned char val);
195int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427,
196 struct snd_pcm_substream *playback_substream,
197 struct snd_pcm_substream *capture_substream);
198int snd_cs8427_iec958_active(struct snd_i2c_device *cs8427, int active);
199int snd_cs8427_iec958_pcm(struct snd_i2c_device *cs8427, unsigned int rate);
195 200
196#endif /* __SOUND_CS8427_H */ 201#endif /* __SOUND_CS8427_H */
diff --git a/include/sound/driver.h b/include/sound/driver.h
index 3f0416ac24d9..89c6a73f3920 100644
--- a/include/sound/driver.h
+++ b/include/sound/driver.h
@@ -28,7 +28,12 @@
28 28
29#include <linux/config.h> 29#include <linux/config.h>
30 30
31#define SNDRV_CARDS 8 /* number of supported soundcards - don't change - minor numbers */ 31/* number of supported soundcards */
32#ifdef CONFIG_SND_DYNAMIC_MINORS
33#define SNDRV_CARDS 32
34#else
35#define SNDRV_CARDS 8 /* don't change - minor numbers */
36#endif
32 37
33#ifndef CONFIG_SND_MAJOR /* standard configuration */ 38#ifndef CONFIG_SND_MAJOR /* standard configuration */
34#define CONFIG_SND_MAJOR 116 39#define CONFIG_SND_MAJOR 116
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 8411c7ef6f11..951e40d720d9 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -887,47 +887,45 @@
887 887
888/* ------------------- STRUCTURES -------------------- */ 888/* ------------------- STRUCTURES -------------------- */
889 889
890typedef struct _snd_emu10k1 emu10k1_t; 890enum {
891typedef struct _snd_emu10k1_voice emu10k1_voice_t;
892typedef struct _snd_emu10k1_pcm emu10k1_pcm_t;
893
894typedef enum {
895 EMU10K1_EFX, 891 EMU10K1_EFX,
896 EMU10K1_PCM, 892 EMU10K1_PCM,
897 EMU10K1_SYNTH, 893 EMU10K1_SYNTH,
898 EMU10K1_MIDI 894 EMU10K1_MIDI
899} emu10k1_voice_type_t; 895};
896
897struct snd_emu10k1;
900 898
901struct _snd_emu10k1_voice { 899struct snd_emu10k1_voice {
902 emu10k1_t *emu; 900 struct snd_emu10k1 *emu;
903 int number; 901 int number;
904 unsigned int use: 1, 902 unsigned int use: 1,
905 pcm: 1, 903 pcm: 1,
906 efx: 1, 904 efx: 1,
907 synth: 1, 905 synth: 1,
908 midi: 1; 906 midi: 1;
909 void (*interrupt)(emu10k1_t *emu, emu10k1_voice_t *pvoice); 907 void (*interrupt)(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
910 908
911 emu10k1_pcm_t *epcm; 909 struct snd_emu10k1_pcm *epcm;
912}; 910};
913 911
914typedef enum { 912enum {
915 PLAYBACK_EMUVOICE, 913 PLAYBACK_EMUVOICE,
916 PLAYBACK_EFX, 914 PLAYBACK_EFX,
917 CAPTURE_AC97ADC, 915 CAPTURE_AC97ADC,
918 CAPTURE_AC97MIC, 916 CAPTURE_AC97MIC,
919 CAPTURE_EFX 917 CAPTURE_EFX
920} snd_emu10k1_pcm_type_t; 918};
921 919
922struct _snd_emu10k1_pcm { 920struct snd_emu10k1_pcm {
923 emu10k1_t *emu; 921 struct snd_emu10k1 *emu;
924 snd_emu10k1_pcm_type_t type; 922 int type;
925 snd_pcm_substream_t *substream; 923 struct snd_pcm_substream *substream;
926 emu10k1_voice_t *voices[NUM_EFX_PLAYBACK]; 924 struct snd_emu10k1_voice *voices[NUM_EFX_PLAYBACK];
927 emu10k1_voice_t *extra; 925 struct snd_emu10k1_voice *extra;
928 unsigned short running; 926 unsigned short running;
929 unsigned short first_ptr; 927 unsigned short first_ptr;
930 snd_util_memblk_t *memblk; 928 struct snd_util_memblk *memblk;
931 unsigned int start_addr; 929 unsigned int start_addr;
932 unsigned int ccca_start_addr; 930 unsigned int ccca_start_addr;
933 unsigned int capture_ipr; /* interrupt acknowledge mask */ 931 unsigned int capture_ipr; /* interrupt acknowledge mask */
@@ -941,13 +939,13 @@ struct _snd_emu10k1_pcm {
941 unsigned int capture_bufsize; /* buffer size in bytes */ 939 unsigned int capture_bufsize; /* buffer size in bytes */
942}; 940};
943 941
944typedef struct { 942struct snd_emu10k1_pcm_mixer {
945 /* mono, left, right x 8 sends (4 on emu10k1) */ 943 /* mono, left, right x 8 sends (4 on emu10k1) */
946 unsigned char send_routing[3][8]; 944 unsigned char send_routing[3][8];
947 unsigned char send_volume[3][8]; 945 unsigned char send_volume[3][8];
948 unsigned short attn[3]; 946 unsigned short attn[3];
949 emu10k1_pcm_t *epcm; 947 struct snd_emu10k1_pcm *epcm;
950} emu10k1_pcm_mixer_t; 948};
951 949
952#define snd_emu10k1_compose_send_routing(route) \ 950#define snd_emu10k1_compose_send_routing(route) \
953((route[0] | (route[1] << 4) | (route[2] << 8) | (route[3] << 12)) << 16) 951((route[0] | (route[1] << 4) | (route[2] << 8) | (route[3] << 12)) << 16)
@@ -958,20 +956,20 @@ typedef struct {
958#define snd_emu10k1_compose_audigy_fxrt2(route) \ 956#define snd_emu10k1_compose_audigy_fxrt2(route) \
959((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24)) 957((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24))
960 958
961typedef struct snd_emu10k1_memblk { 959struct snd_emu10k1_memblk {
962 snd_util_memblk_t mem; 960 struct snd_util_memblk mem;
963 /* private part */ 961 /* private part */
964 int first_page, last_page, pages, mapped_page; 962 int first_page, last_page, pages, mapped_page;
965 unsigned int map_locked; 963 unsigned int map_locked;
966 struct list_head mapped_link; 964 struct list_head mapped_link;
967 struct list_head mapped_order_link; 965 struct list_head mapped_order_link;
968} emu10k1_memblk_t; 966};
969 967
970#define snd_emu10k1_memblk_offset(blk) (((blk)->mapped_page << PAGE_SHIFT) | ((blk)->mem.offset & (PAGE_SIZE - 1))) 968#define snd_emu10k1_memblk_offset(blk) (((blk)->mapped_page << PAGE_SHIFT) | ((blk)->mem.offset & (PAGE_SIZE - 1)))
971 969
972#define EMU10K1_MAX_TRAM_BLOCKS_PER_CODE 16 970#define EMU10K1_MAX_TRAM_BLOCKS_PER_CODE 16
973 971
974typedef struct { 972struct snd_emu10k1_fx8010_ctl {
975 struct list_head list; /* list link container */ 973 struct list_head list; /* list link container */
976 unsigned int vcount; 974 unsigned int vcount;
977 unsigned int count; /* count of GPR (1..16) */ 975 unsigned int count; /* count of GPR (1..16) */
@@ -980,19 +978,19 @@ typedef struct {
980 unsigned int min; /* minimum range */ 978 unsigned int min; /* minimum range */
981 unsigned int max; /* maximum range */ 979 unsigned int max; /* maximum range */
982 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ 980 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
983 snd_kcontrol_t *kcontrol; 981 struct snd_kcontrol *kcontrol;
984} snd_emu10k1_fx8010_ctl_t; 982};
985 983
986typedef void (snd_fx8010_irq_handler_t)(emu10k1_t *emu, void *private_data); 984typedef void (snd_fx8010_irq_handler_t)(struct snd_emu10k1 *emu, void *private_data);
987 985
988typedef struct _snd_emu10k1_fx8010_irq { 986struct snd_emu10k1_fx8010_irq {
989 struct _snd_emu10k1_fx8010_irq *next; 987 struct snd_emu10k1_fx8010_irq *next;
990 snd_fx8010_irq_handler_t *handler; 988 snd_fx8010_irq_handler_t *handler;
991 unsigned short gpr_running; 989 unsigned short gpr_running;
992 void *private_data; 990 void *private_data;
993} snd_emu10k1_fx8010_irq_t; 991};
994 992
995typedef struct { 993struct snd_emu10k1_fx8010_pcm {
996 unsigned int valid: 1, 994 unsigned int valid: 1,
997 opened: 1, 995 opened: 1,
998 active: 1; 996 active: 1;
@@ -1006,13 +1004,13 @@ typedef struct {
1006 unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */ 1004 unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */
1007 unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */ 1005 unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */
1008 unsigned char etram[32]; /* external TRAM address & data */ 1006 unsigned char etram[32]; /* external TRAM address & data */
1009 snd_pcm_indirect_t pcm_rec; 1007 struct snd_pcm_indirect pcm_rec;
1010 unsigned int tram_pos; 1008 unsigned int tram_pos;
1011 unsigned int tram_shift; 1009 unsigned int tram_shift;
1012 snd_emu10k1_fx8010_irq_t *irq; 1010 struct snd_emu10k1_fx8010_irq *irq;
1013} snd_emu10k1_fx8010_pcm_t; 1011};
1014 1012
1015typedef struct { 1013struct snd_emu10k1_fx8010 {
1016 unsigned short fxbus_mask; /* used FX buses (bitmask) */ 1014 unsigned short fxbus_mask; /* used FX buses (bitmask) */
1017 unsigned short extin_mask; /* used external inputs (bitmask) */ 1015 unsigned short extin_mask; /* used external inputs (bitmask) */
1018 unsigned short extout_mask; /* used external outputs (bitmask) */ 1016 unsigned short extout_mask; /* used external outputs (bitmask) */
@@ -1025,18 +1023,18 @@ typedef struct {
1025 int gpr_count; /* count of used kcontrols */ 1023 int gpr_count; /* count of used kcontrols */
1026 struct list_head gpr_ctl; /* GPR controls */ 1024 struct list_head gpr_ctl; /* GPR controls */
1027 struct semaphore lock; 1025 struct semaphore lock;
1028 snd_emu10k1_fx8010_pcm_t pcm[8]; 1026 struct snd_emu10k1_fx8010_pcm pcm[8];
1029 spinlock_t irq_lock; 1027 spinlock_t irq_lock;
1030 snd_emu10k1_fx8010_irq_t *irq_handlers; 1028 struct snd_emu10k1_fx8010_irq *irq_handlers;
1031} snd_emu10k1_fx8010_t; 1029};
1032 1030
1033#define emu10k1_gpr_ctl(n) list_entry(n, snd_emu10k1_fx8010_ctl_t, list) 1031#define emu10k1_gpr_ctl(n) list_entry(n, struct snd_emu10k1_fx8010_ctl, list)
1034 1032
1035typedef struct { 1033struct snd_emu10k1_midi {
1036 struct _snd_emu10k1 *emu; 1034 struct snd_emu10k1 *emu;
1037 snd_rawmidi_t *rmidi; 1035 struct snd_rawmidi *rmidi;
1038 snd_rawmidi_substream_t *substream_input; 1036 struct snd_rawmidi_substream *substream_input;
1039 snd_rawmidi_substream_t *substream_output; 1037 struct snd_rawmidi_substream *substream_output;
1040 unsigned int midi_mode; 1038 unsigned int midi_mode;
1041 spinlock_t input_lock; 1039 spinlock_t input_lock;
1042 spinlock_t output_lock; 1040 spinlock_t output_lock;
@@ -1044,10 +1042,10 @@ typedef struct {
1044 int tx_enable, rx_enable; 1042 int tx_enable, rx_enable;
1045 int port; 1043 int port;
1046 int ipr_tx, ipr_rx; 1044 int ipr_tx, ipr_rx;
1047 void (*interrupt)(emu10k1_t *emu, unsigned int status); 1045 void (*interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1048} emu10k1_midi_t; 1046};
1049 1047
1050typedef struct { 1048struct snd_emu_chip_details {
1051 u32 vendor; 1049 u32 vendor;
1052 u32 device; 1050 u32 device;
1053 u32 subsystem; 1051 u32 subsystem;
@@ -1063,18 +1061,23 @@ typedef struct {
1063 unsigned char spdif_bug; /* Has Spdif phasing bug */ 1061 unsigned char spdif_bug; /* Has Spdif phasing bug */
1064 unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */ 1062 unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */
1065 unsigned char ecard; /* APS EEPROM */ 1063 unsigned char ecard; /* APS EEPROM */
1064 unsigned char emu1212m; /* EMU 1212m card */
1065 unsigned char spi_dac; /* SPI interface for DAC */
1066 unsigned char i2c_adc; /* I2C interface for ADC */
1066 const char *driver; 1067 const char *driver;
1067 const char *name; 1068 const char *name;
1068 const char *id; /* for backward compatibility - can be NULL if not needed */ 1069 const char *id; /* for backward compatibility - can be NULL if not needed */
1069} emu_chip_details_t; 1070};
1070 1071
1071struct _snd_emu10k1 { 1072struct snd_emu10k1 {
1072 int irq; 1073 int irq;
1073 1074
1074 unsigned long port; /* I/O port number */ 1075 unsigned long port; /* I/O port number */
1075 unsigned int tos_link: 1, /* tos link detected */ 1076 unsigned int tos_link: 1, /* tos link detected */
1076 rear_ac97: 1; /* rear channels are on AC'97 */ 1077 rear_ac97: 1, /* rear channels are on AC'97 */
1077 const emu_chip_details_t *card_capabilities; /* Contains profile of card capabilities */ 1078 enable_ir: 1;
1079 /* Contains profile of card capabilities */
1080 const struct snd_emu_chip_details *card_capabilities;
1078 unsigned int audigy; /* is Audigy? */ 1081 unsigned int audigy; /* is Audigy? */
1079 unsigned int revision; /* chip revision */ 1082 unsigned int revision; /* chip revision */
1080 unsigned int serial; /* serial number */ 1083 unsigned int serial; /* serial number */
@@ -1088,8 +1091,8 @@ struct _snd_emu10k1 {
1088 struct snd_dma_device p16v_dma_dev; 1091 struct snd_dma_device p16v_dma_dev;
1089 struct snd_dma_buffer p16v_buffer; 1092 struct snd_dma_buffer p16v_buffer;
1090 1093
1091 snd_util_memhdr_t *memhdr; /* page allocation list */ 1094 struct snd_util_memhdr *memhdr; /* page allocation list */
1092 emu10k1_memblk_t *reserved_page; /* reserved page */ 1095 struct snd_emu10k1_memblk *reserved_page; /* reserved page */
1093 1096
1094 struct list_head mapped_link_head; 1097 struct list_head mapped_link_head;
1095 struct list_head mapped_order_link_head; 1098 struct list_head mapped_order_link_head;
@@ -1099,142 +1102,169 @@ struct _snd_emu10k1 {
1099 1102
1100 unsigned int spdif_bits[3]; /* s/pdif out setup */ 1103 unsigned int spdif_bits[3]; /* s/pdif out setup */
1101 1104
1102 snd_emu10k1_fx8010_t fx8010; /* FX8010 info */ 1105 struct snd_emu10k1_fx8010 fx8010; /* FX8010 info */
1103 int gpr_base; 1106 int gpr_base;
1104 1107
1105 ac97_t *ac97; 1108 struct snd_ac97 *ac97;
1106 1109
1107 struct pci_dev *pci; 1110 struct pci_dev *pci;
1108 snd_card_t *card; 1111 struct snd_card *card;
1109 snd_pcm_t *pcm; 1112 struct snd_pcm *pcm;
1110 snd_pcm_t *pcm_mic; 1113 struct snd_pcm *pcm_mic;
1111 snd_pcm_t *pcm_efx; 1114 struct snd_pcm *pcm_efx;
1112 snd_pcm_t *pcm_p16v; 1115 struct snd_pcm *pcm_multi;
1116 struct snd_pcm *pcm_p16v;
1113 1117
1114 spinlock_t synth_lock; 1118 spinlock_t synth_lock;
1115 void *synth; 1119 void *synth;
1116 int (*get_synth_voice)(emu10k1_t *emu); 1120 int (*get_synth_voice)(struct snd_emu10k1 *emu);
1117 1121
1118 spinlock_t reg_lock; 1122 spinlock_t reg_lock;
1119 spinlock_t emu_lock; 1123 spinlock_t emu_lock;
1120 spinlock_t voice_lock; 1124 spinlock_t voice_lock;
1121 struct semaphore ptb_lock; 1125 struct semaphore ptb_lock;
1122 1126
1123 emu10k1_voice_t voices[NUM_G]; 1127 struct snd_emu10k1_voice voices[NUM_G];
1124 emu10k1_voice_t p16v_voices[4]; 1128 struct snd_emu10k1_voice p16v_voices[4];
1125 emu10k1_voice_t p16v_capture_voice; 1129 struct snd_emu10k1_voice p16v_capture_voice;
1126 int p16v_device_offset; 1130 int p16v_device_offset;
1127 u32 p16v_capture_source; 1131 u32 p16v_capture_source;
1128 u32 p16v_capture_channel; 1132 u32 p16v_capture_channel;
1129 emu10k1_pcm_mixer_t pcm_mixer[32]; 1133 struct snd_emu10k1_pcm_mixer pcm_mixer[32];
1130 emu10k1_pcm_mixer_t efx_pcm_mixer[NUM_EFX_PLAYBACK]; 1134 struct snd_emu10k1_pcm_mixer efx_pcm_mixer[NUM_EFX_PLAYBACK];
1131 snd_kcontrol_t *ctl_send_routing; 1135 struct snd_kcontrol *ctl_send_routing;
1132 snd_kcontrol_t *ctl_send_volume; 1136 struct snd_kcontrol *ctl_send_volume;
1133 snd_kcontrol_t *ctl_attn; 1137 struct snd_kcontrol *ctl_attn;
1134 snd_kcontrol_t *ctl_efx_send_routing; 1138 struct snd_kcontrol *ctl_efx_send_routing;
1135 snd_kcontrol_t *ctl_efx_send_volume; 1139 struct snd_kcontrol *ctl_efx_send_volume;
1136 snd_kcontrol_t *ctl_efx_attn; 1140 struct snd_kcontrol *ctl_efx_attn;
1137 1141
1138 void (*hwvol_interrupt)(emu10k1_t *emu, unsigned int status); 1142 void (*hwvol_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1139 void (*capture_interrupt)(emu10k1_t *emu, unsigned int status); 1143 void (*capture_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1140 void (*capture_mic_interrupt)(emu10k1_t *emu, unsigned int status); 1144 void (*capture_mic_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1141 void (*capture_efx_interrupt)(emu10k1_t *emu, unsigned int status); 1145 void (*capture_efx_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1142 void (*spdif_interrupt)(emu10k1_t *emu, unsigned int status); 1146 void (*spdif_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1143 void (*dsp_interrupt)(emu10k1_t *emu); 1147 void (*dsp_interrupt)(struct snd_emu10k1 *emu);
1144 1148
1145 snd_pcm_substream_t *pcm_capture_substream; 1149 struct snd_pcm_substream *pcm_capture_substream;
1146 snd_pcm_substream_t *pcm_capture_mic_substream; 1150 struct snd_pcm_substream *pcm_capture_mic_substream;
1147 snd_pcm_substream_t *pcm_capture_efx_substream; 1151 struct snd_pcm_substream *pcm_capture_efx_substream;
1148 snd_pcm_substream_t *pcm_playback_efx_substream; 1152 struct snd_pcm_substream *pcm_playback_efx_substream;
1149 1153
1150 snd_timer_t *timer; 1154 struct snd_timer *timer;
1151 1155
1152 emu10k1_midi_t midi; 1156 struct snd_emu10k1_midi midi;
1153 emu10k1_midi_t midi2; /* for audigy */ 1157 struct snd_emu10k1_midi midi2; /* for audigy */
1154 1158
1155 unsigned int efx_voices_mask[2]; 1159 unsigned int efx_voices_mask[2];
1156 unsigned int next_free_voice; 1160 unsigned int next_free_voice;
1161
1162#ifdef CONFIG_PM
1163 unsigned int *saved_ptr;
1164 unsigned int *saved_gpr;
1165 unsigned int *tram_val_saved;
1166 unsigned int *tram_addr_saved;
1167 unsigned int *saved_icode;
1168 unsigned int *p16v_saved;
1169 unsigned int saved_a_iocfg, saved_hcfg;
1170#endif
1171
1157}; 1172};
1158 1173
1159int snd_emu10k1_create(snd_card_t * card, 1174int snd_emu10k1_create(struct snd_card *card,
1160 struct pci_dev *pci, 1175 struct pci_dev *pci,
1161 unsigned short extin_mask, 1176 unsigned short extin_mask,
1162 unsigned short extout_mask, 1177 unsigned short extout_mask,
1163 long max_cache_bytes, 1178 long max_cache_bytes,
1164 int enable_ir, 1179 int enable_ir,
1165 uint subsystem, 1180 uint subsystem,
1166 emu10k1_t ** remu); 1181 struct snd_emu10k1 ** remu);
1167 1182
1168int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1183int snd_emu10k1_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1169int snd_emu10k1_pcm_mic(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1184int snd_emu10k1_pcm_mic(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1170int snd_emu10k1_pcm_efx(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1185int snd_emu10k1_pcm_efx(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1171int snd_p16v_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1186int snd_p16v_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1172int snd_p16v_free(emu10k1_t * emu); 1187int snd_p16v_free(struct snd_emu10k1 * emu);
1173int snd_p16v_mixer(emu10k1_t * emu); 1188int snd_p16v_mixer(struct snd_emu10k1 * emu);
1174int snd_emu10k1_pcm_multi(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1189int snd_emu10k1_pcm_multi(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1175int snd_emu10k1_fx8010_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1190int snd_emu10k1_fx8010_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1176int snd_emu10k1_mixer(emu10k1_t * emu, int pcm_device, int multi_device); 1191int snd_emu10k1_mixer(struct snd_emu10k1 * emu, int pcm_device, int multi_device);
1177int snd_emu10k1_timer(emu10k1_t * emu, int device); 1192int snd_emu10k1_timer(struct snd_emu10k1 * emu, int device);
1178int snd_emu10k1_fx8010_new(emu10k1_t *emu, int device, snd_hwdep_t ** rhwdep); 1193int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, struct snd_hwdep ** rhwdep);
1179 1194
1180irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs); 1195irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs);
1181 1196
1182/* initialization */ 1197void snd_emu10k1_voice_init(struct snd_emu10k1 * emu, int voice);
1183void snd_emu10k1_voice_init(emu10k1_t * emu, int voice); 1198int snd_emu10k1_init_efx(struct snd_emu10k1 *emu);
1184int snd_emu10k1_init_efx(emu10k1_t *emu); 1199void snd_emu10k1_free_efx(struct snd_emu10k1 *emu);
1185void snd_emu10k1_free_efx(emu10k1_t *emu); 1200int snd_emu10k1_fx8010_tram_setup(struct snd_emu10k1 *emu, u32 size);
1186int snd_emu10k1_fx8010_tram_setup(emu10k1_t *emu, u32 size); 1201int snd_emu10k1_done(struct snd_emu10k1 * emu);
1187 1202
1188/* I/O functions */ 1203/* I/O functions */
1189unsigned int snd_emu10k1_ptr_read(emu10k1_t * emu, unsigned int reg, unsigned int chn); 1204unsigned int snd_emu10k1_ptr_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn);
1190void snd_emu10k1_ptr_write(emu10k1_t *emu, unsigned int reg, unsigned int chn, unsigned int data); 1205void snd_emu10k1_ptr_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data);
1191unsigned int snd_emu10k1_ptr20_read(emu10k1_t * emu, unsigned int reg, unsigned int chn); 1206unsigned int snd_emu10k1_ptr20_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn);
1192void snd_emu10k1_ptr20_write(emu10k1_t *emu, unsigned int reg, unsigned int chn, unsigned int data); 1207void snd_emu10k1_ptr20_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data);
1193unsigned int snd_emu10k1_efx_read(emu10k1_t *emu, unsigned int pc); 1208int snd_emu10k1_spi_write(struct snd_emu10k1 * emu, unsigned int data);
1194void snd_emu10k1_intr_enable(emu10k1_t *emu, unsigned int intrenb); 1209unsigned int snd_emu10k1_efx_read(struct snd_emu10k1 *emu, unsigned int pc);
1195void snd_emu10k1_intr_disable(emu10k1_t *emu, unsigned int intrenb); 1210void snd_emu10k1_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb);
1196void snd_emu10k1_voice_intr_enable(emu10k1_t *emu, unsigned int voicenum); 1211void snd_emu10k1_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb);
1197void snd_emu10k1_voice_intr_disable(emu10k1_t *emu, unsigned int voicenum); 1212void snd_emu10k1_voice_intr_enable(struct snd_emu10k1 *emu, unsigned int voicenum);
1198void snd_emu10k1_voice_intr_ack(emu10k1_t *emu, unsigned int voicenum); 1213void snd_emu10k1_voice_intr_disable(struct snd_emu10k1 *emu, unsigned int voicenum);
1199void snd_emu10k1_voice_half_loop_intr_enable(emu10k1_t *emu, unsigned int voicenum); 1214void snd_emu10k1_voice_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum);
1200void snd_emu10k1_voice_half_loop_intr_disable(emu10k1_t *emu, unsigned int voicenum); 1215void snd_emu10k1_voice_half_loop_intr_enable(struct snd_emu10k1 *emu, unsigned int voicenum);
1201void snd_emu10k1_voice_half_loop_intr_ack(emu10k1_t *emu, unsigned int voicenum); 1216void snd_emu10k1_voice_half_loop_intr_disable(struct snd_emu10k1 *emu, unsigned int voicenum);
1202void snd_emu10k1_voice_set_loop_stop(emu10k1_t *emu, unsigned int voicenum); 1217void snd_emu10k1_voice_half_loop_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum);
1203void snd_emu10k1_voice_clear_loop_stop(emu10k1_t *emu, unsigned int voicenum); 1218void snd_emu10k1_voice_set_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum);
1204void snd_emu10k1_wait(emu10k1_t *emu, unsigned int wait); 1219void snd_emu10k1_voice_clear_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum);
1205static inline unsigned int snd_emu10k1_wc(emu10k1_t *emu) { return (inl(emu->port + WC) >> 6) & 0xfffff; } 1220void snd_emu10k1_wait(struct snd_emu10k1 *emu, unsigned int wait);
1206unsigned short snd_emu10k1_ac97_read(ac97_t *ac97, unsigned short reg); 1221static inline unsigned int snd_emu10k1_wc(struct snd_emu10k1 *emu) { return (inl(emu->port + WC) >> 6) & 0xfffff; }
1207void snd_emu10k1_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short data); 1222unsigned short snd_emu10k1_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
1223void snd_emu10k1_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short data);
1208unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate); 1224unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate);
1209 1225
1226#ifdef CONFIG_PM
1227void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu);
1228void snd_emu10k1_resume_init(struct snd_emu10k1 *emu);
1229void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu);
1230int snd_emu10k1_efx_alloc_pm_buffer(struct snd_emu10k1 *emu);
1231void snd_emu10k1_efx_free_pm_buffer(struct snd_emu10k1 *emu);
1232void snd_emu10k1_efx_suspend(struct snd_emu10k1 *emu);
1233void snd_emu10k1_efx_resume(struct snd_emu10k1 *emu);
1234int snd_p16v_alloc_pm_buffer(struct snd_emu10k1 *emu);
1235void snd_p16v_free_pm_buffer(struct snd_emu10k1 *emu);
1236void snd_p16v_suspend(struct snd_emu10k1 *emu);
1237void snd_p16v_resume(struct snd_emu10k1 *emu);
1238#endif
1239
1210/* memory allocation */ 1240/* memory allocation */
1211snd_util_memblk_t *snd_emu10k1_alloc_pages(emu10k1_t *emu, snd_pcm_substream_t *substream); 1241struct snd_util_memblk *snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *substream);
1212int snd_emu10k1_free_pages(emu10k1_t *emu, snd_util_memblk_t *blk); 1242int snd_emu10k1_free_pages(struct snd_emu10k1 *emu, struct snd_util_memblk *blk);
1213snd_util_memblk_t *snd_emu10k1_synth_alloc(emu10k1_t *emu, unsigned int size); 1243struct snd_util_memblk *snd_emu10k1_synth_alloc(struct snd_emu10k1 *emu, unsigned int size);
1214int snd_emu10k1_synth_free(emu10k1_t *emu, snd_util_memblk_t *blk); 1244int snd_emu10k1_synth_free(struct snd_emu10k1 *emu, struct snd_util_memblk *blk);
1215int snd_emu10k1_synth_bzero(emu10k1_t *emu, snd_util_memblk_t *blk, int offset, int size); 1245int snd_emu10k1_synth_bzero(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, int offset, int size);
1216int snd_emu10k1_synth_copy_from_user(emu10k1_t *emu, snd_util_memblk_t *blk, int offset, const char __user *data, int size); 1246int snd_emu10k1_synth_copy_from_user(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, int offset, const char __user *data, int size);
1217int snd_emu10k1_memblk_map(emu10k1_t *emu, emu10k1_memblk_t *blk); 1247int snd_emu10k1_memblk_map(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk);
1218 1248
1219/* voice allocation */ 1249/* voice allocation */
1220int snd_emu10k1_voice_alloc(emu10k1_t *emu, emu10k1_voice_type_t type, int pair, emu10k1_voice_t **rvoice); 1250int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int pair, struct snd_emu10k1_voice **rvoice);
1221int snd_emu10k1_voice_free(emu10k1_t *emu, emu10k1_voice_t *pvoice); 1251int snd_emu10k1_voice_free(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
1222 1252
1223/* MIDI uart */ 1253/* MIDI uart */
1224int snd_emu10k1_midi(emu10k1_t * emu); 1254int snd_emu10k1_midi(struct snd_emu10k1 * emu);
1225int snd_emu10k1_audigy_midi(emu10k1_t * emu); 1255int snd_emu10k1_audigy_midi(struct snd_emu10k1 * emu);
1226 1256
1227/* proc interface */ 1257/* proc interface */
1228int snd_emu10k1_proc_init(emu10k1_t * emu); 1258int snd_emu10k1_proc_init(struct snd_emu10k1 * emu);
1229 1259
1230/* fx8010 irq handler */ 1260/* fx8010 irq handler */
1231int snd_emu10k1_fx8010_register_irq_handler(emu10k1_t *emu, 1261int snd_emu10k1_fx8010_register_irq_handler(struct snd_emu10k1 *emu,
1232 snd_fx8010_irq_handler_t *handler, 1262 snd_fx8010_irq_handler_t *handler,
1233 unsigned char gpr_running, 1263 unsigned char gpr_running,
1234 void *private_data, 1264 void *private_data,
1235 snd_emu10k1_fx8010_irq_t **r_irq); 1265 struct snd_emu10k1_fx8010_irq **r_irq);
1236int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu, 1266int snd_emu10k1_fx8010_unregister_irq_handler(struct snd_emu10k1 *emu,
1237 snd_emu10k1_fx8010_irq_t *irq); 1267 struct snd_emu10k1_fx8010_irq *irq);
1238 1268
1239#endif /* __KERNEL__ */ 1269#endif /* __KERNEL__ */
1240 1270
@@ -1469,14 +1499,14 @@ int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu,
1469#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */ 1499#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */
1470#endif 1500#endif
1471 1501
1472typedef struct { 1502struct snd_emu10k1_fx8010_info {
1473 unsigned int internal_tram_size; /* in samples */ 1503 unsigned int internal_tram_size; /* in samples */
1474 unsigned int external_tram_size; /* in samples */ 1504 unsigned int external_tram_size; /* in samples */
1475 char fxbus_names[16][32]; /* names of FXBUSes */ 1505 char fxbus_names[16][32]; /* names of FXBUSes */
1476 char extin_names[16][32]; /* names of external inputs */ 1506 char extin_names[16][32]; /* names of external inputs */
1477 char extout_names[32][32]; /* names of external outputs */ 1507 char extout_names[32][32]; /* names of external outputs */
1478 unsigned int gpr_controls; /* count of GPR controls */ 1508 unsigned int gpr_controls; /* count of GPR controls */
1479} emu10k1_fx8010_info_t; 1509};
1480 1510
1481#define EMU10K1_GPR_TRANSLATION_NONE 0 1511#define EMU10K1_GPR_TRANSLATION_NONE 0
1482#define EMU10K1_GPR_TRANSLATION_TABLE100 1 1512#define EMU10K1_GPR_TRANSLATION_TABLE100 1
@@ -1484,8 +1514,8 @@ typedef struct {
1484#define EMU10K1_GPR_TRANSLATION_TREBLE 3 1514#define EMU10K1_GPR_TRANSLATION_TREBLE 3
1485#define EMU10K1_GPR_TRANSLATION_ONOFF 4 1515#define EMU10K1_GPR_TRANSLATION_ONOFF 4
1486 1516
1487typedef struct { 1517struct snd_emu10k1_fx8010_control_gpr {
1488 snd_ctl_elem_id_t id; /* full control ID definition */ 1518 struct snd_ctl_elem_id id; /* full control ID definition */
1489 unsigned int vcount; /* visible count */ 1519 unsigned int vcount; /* visible count */
1490 unsigned int count; /* count of GPR (1..16) */ 1520 unsigned int count; /* count of GPR (1..16) */
1491 unsigned short gpr[32]; /* GPR number(s) */ 1521 unsigned short gpr[32]; /* GPR number(s) */
@@ -1493,23 +1523,23 @@ typedef struct {
1493 unsigned int min; /* minimum range */ 1523 unsigned int min; /* minimum range */
1494 unsigned int max; /* maximum range */ 1524 unsigned int max; /* maximum range */
1495 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ 1525 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
1496} emu10k1_fx8010_control_gpr_t; 1526};
1497 1527
1498typedef struct { 1528struct snd_emu10k1_fx8010_code {
1499 char name[128]; 1529 char name[128];
1500 1530
1501 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ 1531 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
1502 u_int32_t __user *gpr_map; /* initializers */ 1532 u_int32_t __user *gpr_map; /* initializers */
1503 1533
1504 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ 1534 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
1505 emu10k1_fx8010_control_gpr_t __user *gpr_add_controls; /* GPR controls to add/replace */ 1535 struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */
1506 1536
1507 unsigned int gpr_del_control_count; /* count of GPR controls to remove */ 1537 unsigned int gpr_del_control_count; /* count of GPR controls to remove */
1508 snd_ctl_elem_id_t __user *gpr_del_controls; /* IDs of GPR controls to remove */ 1538 struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */
1509 1539
1510 unsigned int gpr_list_control_count; /* count of GPR controls to list */ 1540 unsigned int gpr_list_control_count; /* count of GPR controls to list */
1511 unsigned int gpr_list_control_total; /* total count of GPR controls */ 1541 unsigned int gpr_list_control_total; /* total count of GPR controls */
1512 emu10k1_fx8010_control_gpr_t __user *gpr_list_controls; /* listed GPR controls */ 1542 struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
1513 1543
1514 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ 1544 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
1515 u_int32_t __user *tram_data_map; /* data initializers */ 1545 u_int32_t __user *tram_data_map; /* data initializers */
@@ -1517,16 +1547,16 @@ typedef struct {
1517 1547
1518 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ 1548 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
1519 u_int32_t __user *code; /* one instruction - 64 bits */ 1549 u_int32_t __user *code; /* one instruction - 64 bits */
1520} emu10k1_fx8010_code_t; 1550};
1521 1551
1522typedef struct { 1552struct snd_emu10k1_fx8010_tram {
1523 unsigned int address; /* 31.bit == 1 -> external TRAM */ 1553 unsigned int address; /* 31.bit == 1 -> external TRAM */
1524 unsigned int size; /* size in samples (4 bytes) */ 1554 unsigned int size; /* size in samples (4 bytes) */
1525 unsigned int *samples; /* pointer to samples (20-bit) */ 1555 unsigned int *samples; /* pointer to samples (20-bit) */
1526 /* NULL->clear memory */ 1556 /* NULL->clear memory */
1527} emu10k1_fx8010_tram_t; 1557};
1528 1558
1529typedef struct { 1559struct snd_emu10k1_fx8010_pcm_rec {
1530 unsigned int substream; /* substream number */ 1560 unsigned int substream; /* substream number */
1531 unsigned int res1; /* reserved */ 1561 unsigned int res1; /* reserved */
1532 unsigned int channels; /* 16-bit channels count, zero = remove this substream */ 1562 unsigned int channels; /* 16-bit channels count, zero = remove this substream */
@@ -1541,20 +1571,27 @@ typedef struct {
1541 unsigned char pad; /* reserved */ 1571 unsigned char pad; /* reserved */
1542 unsigned char etram[32]; /* external TRAM address & data (one per channel) */ 1572 unsigned char etram[32]; /* external TRAM address & data (one per channel) */
1543 unsigned int res2; /* reserved */ 1573 unsigned int res2; /* reserved */
1544} emu10k1_fx8010_pcm_t; 1574};
1545 1575
1546#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, emu10k1_fx8010_info_t) 1576#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
1547#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, emu10k1_fx8010_code_t) 1577#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
1548#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, emu10k1_fx8010_code_t) 1578#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
1549#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int) 1579#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
1550#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, emu10k1_fx8010_tram_t) 1580#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)
1551#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, emu10k1_fx8010_tram_t) 1581#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
1552#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, emu10k1_fx8010_pcm_t) 1582#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
1553#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, emu10k1_fx8010_pcm_t) 1583#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
1554#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80) 1584#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
1555#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81) 1585#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
1556#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82) 1586#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
1557#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) 1587#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
1558#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) 1588#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
1559 1589
1590/* typedefs for compatibility to user-space */
1591typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
1592typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
1593typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
1594typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
1595typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
1596
1560#endif /* __SOUND_EMU10K1_H */ 1597#endif /* __SOUND_EMU10K1_H */
diff --git a/include/sound/emu10k1_synth.h b/include/sound/emu10k1_synth.h
index df0df1d09552..6ef61c420935 100644
--- a/include/sound/emu10k1_synth.h
+++ b/include/sound/emu10k1_synth.h
@@ -27,12 +27,12 @@
27#define SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH "emu10k1-synth" 27#define SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH "emu10k1-synth"
28 28
29/* argument for snd_seq_device_new */ 29/* argument for snd_seq_device_new */
30typedef struct snd_emu10k1_synth_arg { 30struct snd_emu10k1_synth_arg {
31 emu10k1_t *hwptr; /* chip */ 31 struct snd_emu10k1 *hwptr; /* chip */
32 int index; /* sequencer client index */ 32 int index; /* sequencer client index */
33 int seq_ports; /* number of sequencer ports to be created */ 33 int seq_ports; /* number of sequencer ports to be created */
34 int max_voices; /* maximum number of voices for wavetable */ 34 int max_voices; /* maximum number of voices for wavetable */
35} snd_emu10k1_synth_arg_t; 35};
36 36
37#define EMU10K1_MAX_MEMSIZE (32 * 1024 * 1024) /* 32MB */ 37#define EMU10K1_MAX_MEMSIZE (32 * 1024 * 1024) /* 32MB */
38 38
diff --git a/include/sound/emu8000.h b/include/sound/emu8000.h
index 4362c54e09d0..c8f66bde6d95 100644
--- a/include/sound/emu8000.h
+++ b/include/sound/emu8000.h
@@ -56,9 +56,9 @@ enum {
56 * some of the channels may be used for other things so max_channels is 56 * some of the channels may be used for other things so max_channels is
57 * the number in use for wave voices. 57 * the number in use for wave voices.
58 */ 58 */
59typedef struct snd_emu8000 { 59struct snd_emu8000 {
60 60
61 snd_emux_t *emu; 61 struct snd_emux *emu;
62 62
63 int index; /* sequencer client index */ 63 int index; /* sequencer client index */
64 int seq_ports; /* number of sequencer ports */ 64 int seq_ports; /* number of sequencer ports */
@@ -77,44 +77,45 @@ typedef struct snd_emu8000 {
77 77
78 int dram_checked; 78 int dram_checked;
79 79
80 snd_card_t *card; /* The card that this belongs to */ 80 struct snd_card *card; /* The card that this belongs to */
81 81
82 int chorus_mode; 82 int chorus_mode;
83 int reverb_mode; 83 int reverb_mode;
84 int bass_level; 84 int bass_level;
85 int treble_level; 85 int treble_level;
86 86
87 snd_util_memhdr_t *memhdr; 87 struct snd_util_memhdr *memhdr;
88 88
89 spinlock_t control_lock; 89 spinlock_t control_lock;
90 snd_kcontrol_t *controls[EMU8000_NUM_CONTROLS]; 90 struct snd_kcontrol *controls[EMU8000_NUM_CONTROLS];
91 91
92 snd_pcm_t *pcm; /* pcm on emu8000 wavetable */ 92 struct snd_pcm *pcm; /* pcm on emu8000 wavetable */
93 93
94} emu8000_t; 94};
95 95
96/* sequencer device id */ 96/* sequencer device id */
97#define SNDRV_SEQ_DEV_ID_EMU8000 "emu8000-synth" 97#define SNDRV_SEQ_DEV_ID_EMU8000 "emu8000-synth"
98 98
99 99
100/* exported functions */ 100/* exported functions */
101int snd_emu8000_new(snd_card_t *card, int device, long port, int seq_ports, snd_seq_device_t **ret); 101int snd_emu8000_new(struct snd_card *card, int device, long port, int seq_ports,
102void snd_emu8000_poke(emu8000_t *emu, unsigned int port, unsigned int reg, 102 struct snd_seq_device **ret);
103void snd_emu8000_poke(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
103 unsigned int val); 104 unsigned int val);
104unsigned short snd_emu8000_peek(emu8000_t *emu, unsigned int port, 105unsigned short snd_emu8000_peek(struct snd_emu8000 *emu, unsigned int port,
105 unsigned int reg); 106 unsigned int reg);
106void snd_emu8000_poke_dw(emu8000_t *emu, unsigned int port, unsigned int reg, 107void snd_emu8000_poke_dw(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
107 unsigned int val); 108 unsigned int val);
108unsigned int snd_emu8000_peek_dw(emu8000_t *emu, unsigned int port, 109unsigned int snd_emu8000_peek_dw(struct snd_emu8000 *emu, unsigned int port,
109 unsigned int reg); 110 unsigned int reg);
110void snd_emu8000_dma_chan(emu8000_t *emu, int ch, int mode); 111void snd_emu8000_dma_chan(struct snd_emu8000 *emu, int ch, int mode);
111 112
112void snd_emu8000_init_fm(emu8000_t *emu); 113void snd_emu8000_init_fm(struct snd_emu8000 *emu);
113 114
114void snd_emu8000_update_chorus_mode(emu8000_t *emu); 115void snd_emu8000_update_chorus_mode(struct snd_emu8000 *emu);
115void snd_emu8000_update_reverb_mode(emu8000_t *emu); 116void snd_emu8000_update_reverb_mode(struct snd_emu8000 *emu);
116void snd_emu8000_update_equalizer(emu8000_t *emu); 117void snd_emu8000_update_equalizer(struct snd_emu8000 *emu);
117int snd_emu8000_load_chorus_fx(emu8000_t *emu, int mode, const void __user *buf, long len); 118int snd_emu8000_load_chorus_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
118int snd_emu8000_load_reverb_fx(emu8000_t *emu, int mode, const void __user *buf, long len); 119int snd_emu8000_load_reverb_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
119 120
120#endif /* __SOUND_EMU8000_H */ 121#endif /* __SOUND_EMU8000_H */
diff --git a/include/sound/emux_synth.h b/include/sound/emux_synth.h
index c6970aac9bdc..b2d6b2acc7c7 100644
--- a/include/sound/emux_synth.h
+++ b/include/sound/emux_synth.h
@@ -36,39 +36,40 @@
36 */ 36 */
37#define SNDRV_EMUX_USE_RAW_EFFECT 37#define SNDRV_EMUX_USE_RAW_EFFECT
38 38
39 39struct snd_emux;
40/* 40struct snd_emux_port;
41 * typedefs 41struct snd_emux_voice;
42 */ 42struct snd_emux_effect_table;
43typedef struct snd_emux_effect_table snd_emux_effect_table_t;
44typedef struct snd_emux_port snd_emux_port_t;
45typedef struct snd_emux_voice snd_emux_voice_t;
46typedef struct snd_emux snd_emux_t;
47
48 43
49/* 44/*
50 * operators 45 * operators
51 */ 46 */
52typedef struct snd_emux_operators { 47struct snd_emux_operators {
53 struct module *owner; 48 struct module *owner;
54 snd_emux_voice_t *(*get_voice)(snd_emux_t *emu, snd_emux_port_t *port); 49 struct snd_emux_voice *(*get_voice)(struct snd_emux *emu,
55 int (*prepare)(snd_emux_voice_t *vp); 50 struct snd_emux_port *port);
56 void (*trigger)(snd_emux_voice_t *vp); 51 int (*prepare)(struct snd_emux_voice *vp);
57 void (*release)(snd_emux_voice_t *vp); 52 void (*trigger)(struct snd_emux_voice *vp);
58 void (*update)(snd_emux_voice_t *vp, int update); 53 void (*release)(struct snd_emux_voice *vp);
59 void (*terminate)(snd_emux_voice_t *vp); 54 void (*update)(struct snd_emux_voice *vp, int update);
60 void (*free_voice)(snd_emux_voice_t *vp); 55 void (*terminate)(struct snd_emux_voice *vp);
61 void (*reset)(snd_emux_t *emu, int ch); 56 void (*free_voice)(struct snd_emux_voice *vp);
62 /* the first parameters are snd_emux_t */ 57 void (*reset)(struct snd_emux *emu, int ch);
63 int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void __user *data, long count); 58 /* the first parameters are struct snd_emux */
64 int (*sample_free)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr); 59 int (*sample_new)(struct snd_emux *emu, struct snd_sf_sample *sp,
65 void (*sample_reset)(snd_emux_t *emu); 60 struct snd_util_memhdr *hdr,
66 int (*load_fx)(snd_emux_t *emu, int type, int arg, const void __user *data, long count); 61 const void __user *data, long count);
67 void (*sysex)(snd_emux_t *emu, char *buf, int len, int parsed, snd_midi_channel_set_t *chset); 62 int (*sample_free)(struct snd_emux *emu, struct snd_sf_sample *sp,
63 struct snd_util_memhdr *hdr);
64 void (*sample_reset)(struct snd_emux *emu);
65 int (*load_fx)(struct snd_emux *emu, int type, int arg,
66 const void __user *data, long count);
67 void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed,
68 struct snd_midi_channel_set *chset);
68#ifdef CONFIG_SND_SEQUENCER_OSS 69#ifdef CONFIG_SND_SEQUENCER_OSS
69 int (*oss_ioctl)(snd_emux_t *emu, int cmd, int p1, int p2); 70 int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2);
70#endif 71#endif
71} snd_emux_operators_t; 72};
72 73
73 74
74/* 75/*
@@ -90,46 +91,46 @@ typedef struct snd_emux_operators {
90 */ 91 */
91struct snd_emux { 92struct snd_emux {
92 93
93 snd_card_t *card; /* assigned card */ 94 struct snd_card *card; /* assigned card */
94 95
95 /* following should be initialized before registration */ 96 /* following should be initialized before registration */
96 int max_voices; /* Number of voices */ 97 int max_voices; /* Number of voices */
97 int mem_size; /* memory size (in byte) */ 98 int mem_size; /* memory size (in byte) */
98 int num_ports; /* number of ports to be created */ 99 int num_ports; /* number of ports to be created */
99 int pitch_shift; /* pitch shift value (for Emu10k1) */ 100 int pitch_shift; /* pitch shift value (for Emu10k1) */
100 snd_emux_operators_t ops; /* operators */ 101 struct snd_emux_operators ops; /* operators */
101 void *hw; /* hardware */ 102 void *hw; /* hardware */
102 unsigned long flags; /* other conditions */ 103 unsigned long flags; /* other conditions */
103 int midi_ports; /* number of virtual midi devices */ 104 int midi_ports; /* number of virtual midi devices */
104 int midi_devidx; /* device offset of virtual midi */ 105 int midi_devidx; /* device offset of virtual midi */
105 unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */ 106 unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */
106 int hwdep_idx; /* hwdep device index */ 107 int hwdep_idx; /* hwdep device index */
107 snd_hwdep_t *hwdep; /* hwdep device */ 108 struct snd_hwdep *hwdep; /* hwdep device */
108 109
109 /* private */ 110 /* private */
110 int num_voices; /* current number of voices */ 111 int num_voices; /* current number of voices */
111 snd_sf_list_t *sflist; /* root of SoundFont list */ 112 struct snd_sf_list *sflist; /* root of SoundFont list */
112 snd_emux_voice_t *voices; /* Voices (EMU 'channel') */ 113 struct snd_emux_voice *voices; /* Voices (EMU 'channel') */
113 int use_time; /* allocation counter */ 114 int use_time; /* allocation counter */
114 spinlock_t voice_lock; /* Lock for voice access */ 115 spinlock_t voice_lock; /* Lock for voice access */
115 struct semaphore register_mutex; 116 struct semaphore register_mutex;
116 int client; /* For the sequencer client */ 117 int client; /* For the sequencer client */
117 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */ 118 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */
118 snd_emux_port_t *portptrs[SNDRV_EMUX_MAX_PORTS]; 119 struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS];
119 int used; /* use counter */ 120 int used; /* use counter */
120 char *name; /* name of the device (internal) */ 121 char *name; /* name of the device (internal) */
121 snd_rawmidi_t **vmidi; 122 struct snd_rawmidi **vmidi;
122 struct timer_list tlist; /* for pending note-offs */ 123 struct timer_list tlist; /* for pending note-offs */
123 int timer_active; 124 int timer_active;
124 125
125 snd_util_memhdr_t *memhdr; /* memory chunk information */ 126 struct snd_util_memhdr *memhdr; /* memory chunk information */
126 127
127#ifdef CONFIG_PROC_FS 128#ifdef CONFIG_PROC_FS
128 snd_info_entry_t *proc; 129 struct snd_info_entry *proc;
129#endif 130#endif
130 131
131#ifdef CONFIG_SND_SEQUENCER_OSS 132#ifdef CONFIG_SND_SEQUENCER_OSS
132 snd_seq_device_t *oss_synth; 133 struct snd_seq_device *oss_synth;
133#endif 134#endif
134}; 135};
135 136
@@ -139,18 +140,18 @@ struct snd_emux {
139 */ 140 */
140struct snd_emux_port { 141struct snd_emux_port {
141 142
142 snd_midi_channel_set_t chset; 143 struct snd_midi_channel_set chset;
143 snd_emux_t *emu; 144 struct snd_emux *emu;
144 145
145 char port_mode; /* operation mode */ 146 char port_mode; /* operation mode */
146 int volume_atten; /* emuX raw attenuation */ 147 int volume_atten; /* emuX raw attenuation */
147 unsigned long drum_flags; /* drum bitmaps */ 148 unsigned long drum_flags; /* drum bitmaps */
148 int ctrls[EMUX_MD_END]; /* control parameters */ 149 int ctrls[EMUX_MD_END]; /* control parameters */
149#ifdef SNDRV_EMUX_USE_RAW_EFFECT 150#ifdef SNDRV_EMUX_USE_RAW_EFFECT
150 snd_emux_effect_table_t *effect; 151 struct snd_emux_effect_table *effect;
151#endif 152#endif
152#ifdef CONFIG_SND_SEQUENCER_OSS 153#ifdef CONFIG_SND_SEQUENCER_OSS
153 snd_seq_oss_arg_t *oss_arg; 154 struct snd_seq_oss_arg *oss_arg;
154#endif 155#endif
155}; 156};
156 157
@@ -179,16 +180,16 @@ struct snd_emux_voice {
179 unsigned char key; 180 unsigned char key;
180 unsigned char velocity; /* Velocity of current note */ 181 unsigned char velocity; /* Velocity of current note */
181 182
182 snd_sf_zone_t *zone; /* Zone assigned to this note */ 183 struct snd_sf_zone *zone; /* Zone assigned to this note */
183 void *block; /* sample block pointer (optional) */ 184 void *block; /* sample block pointer (optional) */
184 snd_midi_channel_t *chan; /* Midi channel for this note */ 185 struct snd_midi_channel *chan; /* Midi channel for this note */
185 snd_emux_port_t *port; /* associated port */ 186 struct snd_emux_port *port; /* associated port */
186 snd_emux_t *emu; /* assigned root info */ 187 struct snd_emux *emu; /* assigned root info */
187 void *hw; /* hardware pointer (emu8000_t or emu10k1_t) */ 188 void *hw; /* hardware pointer (emu8000 or emu10k1) */
188 unsigned long ontime; /* jiffies at note triggered */ 189 unsigned long ontime; /* jiffies at note triggered */
189 190
190 /* Emu8k/Emu10k1 registers */ 191 /* Emu8k/Emu10k1 registers */
191 soundfont_voice_info_t reg; 192 struct soundfont_voice_info reg;
192 193
193 /* additional registers */ 194 /* additional registers */
194 int avol; /* volume attenuation */ 195 int avol; /* volume attenuation */
@@ -229,15 +230,15 @@ struct snd_emux_effect_table {
229/* 230/*
230 * prototypes - interface to Emu10k1 and Emu8k routines 231 * prototypes - interface to Emu10k1 and Emu8k routines
231 */ 232 */
232int snd_emux_new(snd_emux_t **remu); 233int snd_emux_new(struct snd_emux **remu);
233int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name); 234int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name);
234int snd_emux_free(snd_emux_t *emu); 235int snd_emux_free(struct snd_emux *emu);
235 236
236/* 237/*
237 * exported functions 238 * exported functions
238 */ 239 */
239void snd_emux_terminate_all(snd_emux_t *emu); 240void snd_emux_terminate_all(struct snd_emux *emu);
240void snd_emux_lock_voice(snd_emux_t *emu, int voice); 241void snd_emux_lock_voice(struct snd_emux *emu, int voice);
241void snd_emux_unlock_voice(snd_emux_t *emu, int voice); 242void snd_emux_unlock_voice(struct snd_emux *emu, int voice);
242 243
243#endif /* __SOUND_EMUX_SYNTH_H */ 244#endif /* __SOUND_EMUX_SYNTH_H */
diff --git a/include/sound/es1688.h b/include/sound/es1688.h
index 604f495bc8b1..fc1c47dae3da 100644
--- a/include/sound/es1688.h
+++ b/include/sound/es1688.h
@@ -30,7 +30,7 @@
30#define ES1688_HW_688 0x0001 30#define ES1688_HW_688 0x0001
31#define ES1688_HW_1688 0x0002 31#define ES1688_HW_1688 0x0002
32 32
33struct _snd_es1688 { 33struct snd_es1688 {
34 unsigned long port; /* port of ESS chip */ 34 unsigned long port; /* port of ESS chip */
35 struct resource *res_port; 35 struct resource *res_port;
36 unsigned long mpu_port; /* MPU-401 port of ESS chip */ 36 unsigned long mpu_port; /* MPU-401 port of ESS chip */
@@ -44,17 +44,15 @@ struct _snd_es1688 {
44 unsigned char pad; 44 unsigned char pad;
45 unsigned int dma_size; 45 unsigned int dma_size;
46 46
47 snd_card_t *card; 47 struct snd_card *card;
48 snd_pcm_t *pcm; 48 struct snd_pcm *pcm;
49 snd_pcm_substream_t *playback_substream; 49 struct snd_pcm_substream *playback_substream;
50 snd_pcm_substream_t *capture_substream; 50 struct snd_pcm_substream *capture_substream;
51 51
52 spinlock_t reg_lock; 52 spinlock_t reg_lock;
53 spinlock_t mixer_lock; 53 spinlock_t mixer_lock;
54}; 54};
55 55
56typedef struct _snd_es1688 es1688_t;
57
58/* I/O ports */ 56/* I/O ports */
59 57
60#define ES1688P(codec, x) ((codec)->port + e_s_s_ESS1688##x) 58#define ES1688P(codec, x) ((codec)->port + e_s_s_ESS1688##x)
@@ -107,17 +105,17 @@ typedef struct _snd_es1688 es1688_t;
107 105
108 */ 106 */
109 107
110void snd_es1688_mixer_write(es1688_t *chip, unsigned char reg, unsigned char data); 108void snd_es1688_mixer_write(struct snd_es1688 *chip, unsigned char reg, unsigned char data);
111 109
112int snd_es1688_create(snd_card_t * card, 110int snd_es1688_create(struct snd_card *card,
113 unsigned long port, 111 unsigned long port,
114 unsigned long mpu_port, 112 unsigned long mpu_port,
115 int irq, 113 int irq,
116 int mpu_irq, 114 int mpu_irq,
117 int dma8, 115 int dma8,
118 unsigned short hardware, 116 unsigned short hardware,
119 es1688_t ** rchip); 117 struct snd_es1688 ** rchip);
120int snd_es1688_pcm(es1688_t *chip, int device, snd_pcm_t ** rpcm); 118int snd_es1688_pcm(struct snd_es1688 *chip, int device, struct snd_pcm ** rpcm);
121int snd_es1688_mixer(es1688_t *chip); 119int snd_es1688_mixer(struct snd_es1688 *chip);
122 120
123#endif /* __SOUND_ES1688_H */ 121#endif /* __SOUND_ES1688_H */
diff --git a/include/sound/gus.h b/include/sound/gus.h
index 7000d9d9199d..63da50fae773 100644
--- a/include/sound/gus.h
+++ b/include/sound/gus.h
@@ -49,32 +49,32 @@
49#define SNDRV_g_u_s_IRQSTAT (0x226-0x220) 49#define SNDRV_g_u_s_IRQSTAT (0x226-0x220)
50#define SNDRV_g_u_s_TIMERCNTRL (0x228-0x220) 50#define SNDRV_g_u_s_TIMERCNTRL (0x228-0x220)
51#define SNDRV_g_u_s_TIMERDATA (0x229-0x220) 51#define SNDRV_g_u_s_TIMERDATA (0x229-0x220)
52#define SNDRV_g_u_s_DRAM (0x327-0x220) 52#define SNDRV_g_u_s_DRAM (0x327-0x220)
53#define SNDRV_g_u_s_MIXCNTRLREG (0x220-0x220) 53#define SNDRV_g_u_s_MIXCNTRLREG (0x220-0x220)
54#define SNDRV_g_u_s_IRQDMACNTRLREG (0x22b-0x220) 54#define SNDRV_g_u_s_IRQDMACNTRLREG (0x22b-0x220)
55#define SNDRV_g_u_s_REGCNTRLS (0x22f-0x220) 55#define SNDRV_g_u_s_REGCNTRLS (0x22f-0x220)
56#define SNDRV_g_u_s_BOARDVERSION (0x726-0x220) 56#define SNDRV_g_u_s_BOARDVERSION (0x726-0x220)
57#define SNDRV_g_u_s_MIXCNTRLPORT (0x726-0x220) 57#define SNDRV_g_u_s_MIXCNTRLPORT (0x726-0x220)
58#define SNDRV_g_u_s_IVER (0x325-0x220) 58#define SNDRV_g_u_s_IVER (0x325-0x220)
59#define SNDRV_g_u_s_MIXDATAPORT (0x326-0x220) 59#define SNDRV_g_u_s_MIXDATAPORT (0x326-0x220)
60#define SNDRV_g_u_s_MAXCNTRLPORT (0x326-0x220) 60#define SNDRV_g_u_s_MAXCNTRLPORT (0x326-0x220)
61 61
62/* GF1 registers */ 62/* GF1 registers */
63 63
64/* global registers */ 64/* global registers */
65#define SNDRV_GF1_GB_ACTIVE_VOICES 0x0e 65#define SNDRV_GF1_GB_ACTIVE_VOICES 0x0e
66#define SNDRV_GF1_GB_VOICES_IRQ 0x0f 66#define SNDRV_GF1_GB_VOICES_IRQ 0x0f
67#define SNDRV_GF1_GB_GLOBAL_MODE 0x19 67#define SNDRV_GF1_GB_GLOBAL_MODE 0x19
68#define SNDRV_GF1_GW_LFO_BASE 0x1a 68#define SNDRV_GF1_GW_LFO_BASE 0x1a
69#define SNDRV_GF1_GB_VOICES_IRQ_READ 0x1f 69#define SNDRV_GF1_GB_VOICES_IRQ_READ 0x1f
70#define SNDRV_GF1_GB_DRAM_DMA_CONTROL 0x41 70#define SNDRV_GF1_GB_DRAM_DMA_CONTROL 0x41
71#define SNDRV_GF1_GW_DRAM_DMA_LOW 0x42 71#define SNDRV_GF1_GW_DRAM_DMA_LOW 0x42
72#define SNDRV_GF1_GW_DRAM_IO_LOW 0x43 72#define SNDRV_GF1_GW_DRAM_IO_LOW 0x43
73#define SNDRV_GF1_GB_DRAM_IO_HIGH 0x44 73#define SNDRV_GF1_GB_DRAM_IO_HIGH 0x44
74#define SNDRV_GF1_GB_SOUND_BLASTER_CONTROL 0x45 74#define SNDRV_GF1_GB_SOUND_BLASTER_CONTROL 0x45
75#define SNDRV_GF1_GB_ADLIB_TIMER_1 0x46 75#define SNDRV_GF1_GB_ADLIB_TIMER_1 0x46
76#define SNDRV_GF1_GB_ADLIB_TIMER_2 0x47 76#define SNDRV_GF1_GB_ADLIB_TIMER_2 0x47
77#define SNDRV_GF1_GB_RECORD_RATE 0x48 77#define SNDRV_GF1_GB_RECORD_RATE 0x48
78#define SNDRV_GF1_GB_REC_DMA_CONTROL 0x49 78#define SNDRV_GF1_GB_REC_DMA_CONTROL 0x49
79#define SNDRV_GF1_GB_JOYSTICK_DAC_LEVEL 0x4b 79#define SNDRV_GF1_GB_JOYSTICK_DAC_LEVEL 0x4b
80#define SNDRV_GF1_GB_RESET 0x4c 80#define SNDRV_GF1_GB_RESET 0x4c
@@ -83,7 +83,7 @@
83#define SNDRV_GF1_GW_MEMORY_CONFIG 0x52 83#define SNDRV_GF1_GW_MEMORY_CONFIG 0x52
84#define SNDRV_GF1_GB_MEMORY_CONTROL 0x53 84#define SNDRV_GF1_GB_MEMORY_CONTROL 0x53
85#define SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR 0x54 85#define SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR 0x54
86#define SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR 0x55 86#define SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR 0x55
87#define SNDRV_GF1_GW_FIFO_SIZE 0x56 87#define SNDRV_GF1_GW_FIFO_SIZE 0x56
88#define SNDRV_GF1_GW_INTERLEAVE 0x57 88#define SNDRV_GF1_GW_INTERLEAVE 0x57
89#define SNDRV_GF1_GB_COMPATIBILITY 0x59 89#define SNDRV_GF1_GB_COMPATIBILITY 0x59
@@ -100,39 +100,39 @@
100#define SNDRV_GF1_VA_START SNDRV_GF1_VW_START_HIGH 100#define SNDRV_GF1_VA_START SNDRV_GF1_VW_START_HIGH
101#define SNDRV_GF1_VW_END_HIGH 0x04 101#define SNDRV_GF1_VW_END_HIGH 0x04
102#define SNDRV_GF1_VW_END_LOW 0x05 102#define SNDRV_GF1_VW_END_LOW 0x05
103#define SNDRV_GF1_VA_END SNDRV_GF1_VW_END_HIGH 103#define SNDRV_GF1_VA_END SNDRV_GF1_VW_END_HIGH
104#define SNDRV_GF1_VB_VOLUME_RATE 0x06 104#define SNDRV_GF1_VB_VOLUME_RATE 0x06
105#define SNDRV_GF1_VB_VOLUME_START 0x07 105#define SNDRV_GF1_VB_VOLUME_START 0x07
106#define SNDRV_GF1_VB_VOLUME_END 0x08 106#define SNDRV_GF1_VB_VOLUME_END 0x08
107#define SNDRV_GF1_VW_VOLUME 0x09 107#define SNDRV_GF1_VW_VOLUME 0x09
108#define SNDRV_GF1_VW_CURRENT_HIGH 0x0a 108#define SNDRV_GF1_VW_CURRENT_HIGH 0x0a
109#define SNDRV_GF1_VW_CURRENT_LOW 0x0b 109#define SNDRV_GF1_VW_CURRENT_LOW 0x0b
110#define SNDRV_GF1_VA_CURRENT SNDRV_GF1_VW_CURRENT_HIGH 110#define SNDRV_GF1_VA_CURRENT SNDRV_GF1_VW_CURRENT_HIGH
111#define SNDRV_GF1_VB_PAN 0x0c 111#define SNDRV_GF1_VB_PAN 0x0c
112#define SNDRV_GF1_VW_OFFSET_RIGHT 0x0c 112#define SNDRV_GF1_VW_OFFSET_RIGHT 0x0c
113#define SNDRV_GF1_VB_VOLUME_CONTROL 0x0d 113#define SNDRV_GF1_VB_VOLUME_CONTROL 0x0d
114#define SNDRV_GF1_VB_UPPER_ADDRESS 0x10 114#define SNDRV_GF1_VB_UPPER_ADDRESS 0x10
115#define SNDRV_GF1_VW_EFFECT_HIGH 0x11 115#define SNDRV_GF1_VW_EFFECT_HIGH 0x11
116#define SNDRV_GF1_VW_EFFECT_LOW 0x12 116#define SNDRV_GF1_VW_EFFECT_LOW 0x12
117#define SNDRV_GF1_VA_EFFECT SNDRV_GF1_VW_EFFECT_HIGH 117#define SNDRV_GF1_VA_EFFECT SNDRV_GF1_VW_EFFECT_HIGH
118#define SNDRV_GF1_VW_OFFSET_LEFT 0x13 118#define SNDRV_GF1_VW_OFFSET_LEFT 0x13
119#define SNDRV_GF1_VB_ACCUMULATOR 0x14 119#define SNDRV_GF1_VB_ACCUMULATOR 0x14
120#define SNDRV_GF1_VB_MODE 0x15 120#define SNDRV_GF1_VB_MODE 0x15
121#define SNDRV_GF1_VW_EFFECT_VOLUME 0x16 121#define SNDRV_GF1_VW_EFFECT_VOLUME 0x16
122#define SNDRV_GF1_VB_FREQUENCY_LFO 0x17 122#define SNDRV_GF1_VB_FREQUENCY_LFO 0x17
123#define SNDRV_GF1_VB_VOLUME_LFO 0x18 123#define SNDRV_GF1_VB_VOLUME_LFO 0x18
124#define SNDRV_GF1_VW_OFFSET_RIGHT_FINAL 0x1b 124#define SNDRV_GF1_VW_OFFSET_RIGHT_FINAL 0x1b
125#define SNDRV_GF1_VW_OFFSET_LEFT_FINAL 0x1c 125#define SNDRV_GF1_VW_OFFSET_LEFT_FINAL 0x1c
126#define SNDRV_GF1_VW_EFFECT_VOLUME_FINAL 0x1d 126#define SNDRV_GF1_VW_EFFECT_VOLUME_FINAL 0x1d
127 127
128/* ICS registers */ 128/* ICS registers */
129 129
130#define SNDRV_ICS_MIC_DEV 0 130#define SNDRV_ICS_MIC_DEV 0
131#define SNDRV_ICS_LINE_DEV 1 131#define SNDRV_ICS_LINE_DEV 1
132#define SNDRV_ICS_CD_DEV 2 132#define SNDRV_ICS_CD_DEV 2
133#define SNDRV_ICS_GF1_DEV 3 133#define SNDRV_ICS_GF1_DEV 3
134#define SNDRV_ICS_NONE_DEV 4 134#define SNDRV_ICS_NONE_DEV 4
135#define SNDRV_ICS_MASTER_DEV 5 135#define SNDRV_ICS_MASTER_DEV 5
136 136
137/* LFO */ 137/* LFO */
138 138
@@ -143,7 +143,7 @@
143 143
144#define SNDRV_GF1_DMA_UNSIGNED 0x80 144#define SNDRV_GF1_DMA_UNSIGNED 0x80
145#define SNDRV_GF1_DMA_16BIT 0x40 145#define SNDRV_GF1_DMA_16BIT 0x40
146#define SNDRV_GF1_DMA_IRQ 0x20 146#define SNDRV_GF1_DMA_IRQ 0x20
147#define SNDRV_GF1_DMA_WIDTH16 0x04 147#define SNDRV_GF1_DMA_WIDTH16 0x04
148#define SNDRV_GF1_DMA_READ 0x02 /* read from GUS's DRAM */ 148#define SNDRV_GF1_DMA_READ 0x02 /* read from GUS's DRAM */
149#define SNDRV_GF1_DMA_ENABLE 0x01 149#define SNDRV_GF1_DMA_ENABLE 0x01
@@ -159,7 +159,7 @@
159 159
160/* defines for memory manager */ 160/* defines for memory manager */
161 161
162#define SNDRV_GF1_MEM_BLOCK_16BIT 0x0001 162#define SNDRV_GF1_MEM_BLOCK_16BIT 0x0001
163 163
164#define SNDRV_GF1_MEM_OWNER_DRIVER 0x0001 164#define SNDRV_GF1_MEM_OWNER_DRIVER 0x0001
165#define SNDRV_GF1_MEM_OWNER_WAVE_SIMPLE 0x0002 165#define SNDRV_GF1_MEM_OWNER_WAVE_SIMPLE 0x0002
@@ -169,9 +169,9 @@
169/* constants for interrupt handlers */ 169/* constants for interrupt handlers */
170 170
171#define SNDRV_GF1_HANDLER_MIDI_OUT 0x00010000 171#define SNDRV_GF1_HANDLER_MIDI_OUT 0x00010000
172#define SNDRV_GF1_HANDLER_MIDI_IN 0x00020000 172#define SNDRV_GF1_HANDLER_MIDI_IN 0x00020000
173#define SNDRV_GF1_HANDLER_TIMER1 0x00040000 173#define SNDRV_GF1_HANDLER_TIMER1 0x00040000
174#define SNDRV_GF1_HANDLER_TIMER2 0x00080000 174#define SNDRV_GF1_HANDLER_TIMER2 0x00080000
175#define SNDRV_GF1_HANDLER_VOICE 0x00100000 175#define SNDRV_GF1_HANDLER_VOICE 0x00100000
176#define SNDRV_GF1_HANDLER_DMA_WRITE 0x00200000 176#define SNDRV_GF1_HANDLER_DMA_WRITE 0x00200000
177#define SNDRV_GF1_HANDLER_DMA_READ 0x00400000 177#define SNDRV_GF1_HANDLER_DMA_READ 0x00400000
@@ -183,17 +183,16 @@
183 183
184/* --- */ 184/* --- */
185 185
186struct _snd_gus_card; 186struct snd_gus_card;
187typedef struct _snd_gus_card snd_gus_card_t;
188 187
189/* GF1 specific structure */ 188/* GF1 specific structure */
190 189
191typedef struct _snd_gf1_bank_info { 190struct snd_gf1_bank_info {
192 unsigned int address; 191 unsigned int address;
193 unsigned int size; 192 unsigned int size;
194} snd_gf1_bank_info_t; 193};
195 194
196typedef struct _snd_gf1_mem_block { 195struct snd_gf1_mem_block {
197 unsigned short flags; /* flags - SNDRV_GF1_MEM_BLOCK_XXXX */ 196 unsigned short flags; /* flags - SNDRV_GF1_MEM_BLOCK_XXXX */
198 unsigned short owner; /* owner - SNDRV_GF1_MEM_OWNER_XXXX */ 197 unsigned short owner; /* owner - SNDRV_GF1_MEM_OWNER_XXXX */
199 unsigned int share; /* share count */ 198 unsigned int share; /* share count */
@@ -201,68 +200,68 @@ typedef struct _snd_gf1_mem_block {
201 unsigned int ptr; 200 unsigned int ptr;
202 unsigned int size; 201 unsigned int size;
203 char *name; 202 char *name;
204 struct _snd_gf1_mem_block *next; 203 struct snd_gf1_mem_block *next;
205 struct _snd_gf1_mem_block *prev; 204 struct snd_gf1_mem_block *prev;
206} snd_gf1_mem_block_t; 205};
207 206
208typedef struct _snd_gf1_mem { 207struct snd_gf1_mem {
209 snd_gf1_bank_info_t banks_8[4]; 208 struct snd_gf1_bank_info banks_8[4];
210 snd_gf1_bank_info_t banks_16[4]; 209 struct snd_gf1_bank_info banks_16[4];
211 snd_gf1_mem_block_t *first; 210 struct snd_gf1_mem_block *first;
212 snd_gf1_mem_block_t *last; 211 struct snd_gf1_mem_block *last;
213 struct semaphore memory_mutex; 212 struct semaphore memory_mutex;
214} snd_gf1_mem_t; 213};
215 214
216typedef struct snd_gf1_dma_block { 215struct snd_gf1_dma_block {
217 void *buffer; /* buffer in computer's RAM */ 216 void *buffer; /* buffer in computer's RAM */
218 unsigned long buf_addr; /* buffer address */ 217 unsigned long buf_addr; /* buffer address */
219 unsigned int addr; /* address in onboard memory */ 218 unsigned int addr; /* address in onboard memory */
220 unsigned int count; /* count in bytes */ 219 unsigned int count; /* count in bytes */
221 unsigned int cmd; /* DMA command (format) */ 220 unsigned int cmd; /* DMA command (format) */
222 void (*ack)(snd_gus_card_t * gus, void *private_data); 221 void (*ack)(struct snd_gus_card * gus, void *private_data);
223 void *private_data; 222 void *private_data;
224 struct snd_gf1_dma_block *next; 223 struct snd_gf1_dma_block *next;
225} snd_gf1_dma_block_t; 224};
226 225
227typedef struct { 226struct snd_gus_port {
228 snd_midi_channel_set_t * chset; 227 struct snd_midi_channel_set * chset;
229 snd_gus_card_t * gus; 228 struct snd_gus_card * gus;
230 int mode; /* operation mode */ 229 int mode; /* operation mode */
231 int client; /* sequencer client number */ 230 int client; /* sequencer client number */
232 int port; /* sequencer port number */ 231 int port; /* sequencer port number */
233 unsigned int midi_has_voices: 1; 232 unsigned int midi_has_voices: 1;
234} snd_gus_port_t; 233};
235 234
236typedef struct _snd_gus_voice snd_gus_voice_t; 235struct snd_gus_voice;
237 236
238typedef struct { 237struct snd_gus_sample_ops {
239 void (*sample_start)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_position_t position); 238 void (*sample_start)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position);
240 void (*sample_stop)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_stop_mode_t mode); 239 void (*sample_stop)(struct snd_gus_card *gus, struct snd_gus_voice *voice, int mode);
241 void (*sample_freq)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_frequency_t freq); 240 void (*sample_freq)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_frequency_t freq);
242 void (*sample_volume)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_ev_volume_t *volume); 241 void (*sample_volume)(struct snd_gus_card *gus, struct snd_gus_voice *voice, struct snd_seq_ev_volume *volume);
243 void (*sample_loop)(snd_gus_card_t *card, snd_gus_voice_t *voice, snd_seq_ev_loop_t *loop); 242 void (*sample_loop)(struct snd_gus_card *card, struct snd_gus_voice *voice, struct snd_seq_ev_loop *loop);
244 void (*sample_pos)(snd_gus_card_t *card, snd_gus_voice_t *voice, snd_seq_position_t position); 243 void (*sample_pos)(struct snd_gus_card *card, struct snd_gus_voice *voice, snd_seq_position_t position);
245 void (*sample_private1)(snd_gus_card_t *card, snd_gus_voice_t *voice, unsigned char *data); 244 void (*sample_private1)(struct snd_gus_card *card, struct snd_gus_voice *voice, unsigned char *data);
246} snd_gus_sample_ops_t; 245};
247 246
248#define SNDRV_GF1_VOICE_TYPE_PCM 0 247#define SNDRV_GF1_VOICE_TYPE_PCM 0
249#define SNDRV_GF1_VOICE_TYPE_SYNTH 1 248#define SNDRV_GF1_VOICE_TYPE_SYNTH 1
250#define SNDRV_GF1_VOICE_TYPE_MIDI 2 249#define SNDRV_GF1_VOICE_TYPE_MIDI 2
251 250
252#define SNDRV_GF1_VFLG_RUNNING (1<<0) 251#define SNDRV_GF1_VFLG_RUNNING (1<<0)
253#define SNDRV_GF1_VFLG_EFFECT_TIMER1 (1<<1) 252#define SNDRV_GF1_VFLG_EFFECT_TIMER1 (1<<1)
254#define SNDRV_GF1_VFLG_PAN (1<<2) 253#define SNDRV_GF1_VFLG_PAN (1<<2)
255 254
256typedef enum { 255enum snd_gus_volume_state {
257 VENV_BEFORE, 256 VENV_BEFORE,
258 VENV_ATTACK, 257 VENV_ATTACK,
259 VENV_SUSTAIN, 258 VENV_SUSTAIN,
260 VENV_RELEASE, 259 VENV_RELEASE,
261 VENV_DONE, 260 VENV_DONE,
262 VENV_VOLUME 261 VENV_VOLUME
263} snd_gus_volume_state_t; 262};
264 263
265struct _snd_gus_voice { 264struct snd_gus_voice {
266 int number; 265 int number;
267 unsigned int use: 1, 266 unsigned int use: 1,
268 pcm: 1, 267 pcm: 1,
@@ -278,18 +277,18 @@ struct _snd_gus_voice {
278 unsigned int interrupt_stat_wave; 277 unsigned int interrupt_stat_wave;
279 unsigned int interrupt_stat_volume; 278 unsigned int interrupt_stat_volume;
280#endif 279#endif
281 void (*handler_wave) (snd_gus_card_t * gus, snd_gus_voice_t * voice); 280 void (*handler_wave) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
282 void (*handler_volume) (snd_gus_card_t * gus, snd_gus_voice_t * voice); 281 void (*handler_volume) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
283 void (*handler_effect) (snd_gus_card_t * gus, snd_gus_voice_t * voice); 282 void (*handler_effect) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
284 void (*volume_change) (snd_gus_card_t * gus); 283 void (*volume_change) (struct snd_gus_card * gus);
285 284
286 snd_gus_sample_ops_t *sample_ops; 285 struct snd_gus_sample_ops *sample_ops;
287 286
288 snd_seq_instr_t instr; 287 struct snd_seq_instr instr;
289 288
290 /* running status / registers */ 289 /* running status / registers */
291 290
292 snd_seq_ev_volume_t sample_volume; 291 struct snd_seq_ev_volume sample_volume;
293 292
294 unsigned short fc_register; 293 unsigned short fc_register;
295 unsigned short fc_lfo; 294 unsigned short fc_lfo;
@@ -300,8 +299,8 @@ struct _snd_gus_voice {
300 unsigned char effect_accumulator; 299 unsigned char effect_accumulator;
301 unsigned char volume_control; 300 unsigned char volume_control;
302 unsigned char venv_value_next; 301 unsigned char venv_value_next;
303 snd_gus_volume_state_t venv_state; 302 enum snd_gus_volume_state venv_state;
304 snd_gus_volume_state_t venv_state_prev; 303 enum snd_gus_volume_state venv_state_prev;
305 unsigned short vlo; 304 unsigned short vlo;
306 unsigned short vro; 305 unsigned short vro;
307 unsigned short gf1_effect_volume; 306 unsigned short gf1_effect_volume;
@@ -309,10 +308,10 @@ struct _snd_gus_voice {
309 /* --- */ 308 /* --- */
310 309
311 void *private_data; 310 void *private_data;
312 void (*private_free)(snd_gus_voice_t *voice); 311 void (*private_free)(struct snd_gus_voice *voice);
313}; 312};
314 313
315struct _snd_gf1 { 314struct snd_gf1 {
316 315
317 unsigned int enh_mode:1, /* enhanced mode (GFA1) */ 316 unsigned int enh_mode:1, /* enhanced mode (GFA1) */
318 hw_lfo:1, /* use hardware LFO */ 317 hw_lfo:1, /* use hardware LFO */
@@ -330,7 +329,7 @@ struct _snd_gf1 {
330 unsigned int rom_present; /* bitmask */ 329 unsigned int rom_present; /* bitmask */
331 unsigned int rom_banks; /* GUS's ROM banks */ 330 unsigned int rom_banks; /* GUS's ROM banks */
332 331
333 snd_gf1_mem_t mem_alloc; 332 struct snd_gf1_mem mem_alloc;
334 333
335 /* registers */ 334 /* registers */
336 unsigned short reg_page; 335 unsigned short reg_page;
@@ -347,7 +346,7 @@ struct _snd_gf1 {
347 unsigned char active_voices; /* active voices */ 346 unsigned char active_voices; /* active voices */
348 unsigned char active_voice; /* selected voice (GF1PAGE register) */ 347 unsigned char active_voice; /* selected voice (GF1PAGE register) */
349 348
350 snd_gus_voice_t voices[32]; /* GF1 voices */ 349 struct snd_gus_voice voices[32]; /* GF1 voices */
351 350
352 unsigned int default_voice_address; 351 unsigned int default_voice_address;
353 352
@@ -362,12 +361,12 @@ struct _snd_gf1 {
362 361
363 /* interrupt handlers */ 362 /* interrupt handlers */
364 363
365 void (*interrupt_handler_midi_out) (snd_gus_card_t * gus); 364 void (*interrupt_handler_midi_out) (struct snd_gus_card * gus);
366 void (*interrupt_handler_midi_in) (snd_gus_card_t * gus); 365 void (*interrupt_handler_midi_in) (struct snd_gus_card * gus);
367 void (*interrupt_handler_timer1) (snd_gus_card_t * gus); 366 void (*interrupt_handler_timer1) (struct snd_gus_card * gus);
368 void (*interrupt_handler_timer2) (snd_gus_card_t * gus); 367 void (*interrupt_handler_timer2) (struct snd_gus_card * gus);
369 void (*interrupt_handler_dma_write) (snd_gus_card_t * gus); 368 void (*interrupt_handler_dma_write) (struct snd_gus_card * gus);
370 void (*interrupt_handler_dma_read) (snd_gus_card_t * gus); 369 void (*interrupt_handler_dma_read) (struct snd_gus_card * gus);
371 370
372#ifdef CONFIG_SND_DEBUG 371#ifdef CONFIG_SND_DEBUG
373 unsigned int interrupt_stat_midi_out; 372 unsigned int interrupt_stat_midi_out;
@@ -382,17 +381,17 @@ struct _snd_gf1 {
382 /* synthesizer */ 381 /* synthesizer */
383 382
384 int seq_client; 383 int seq_client;
385 snd_gus_port_t seq_ports[4]; 384 struct snd_gus_port seq_ports[4];
386 snd_seq_kinstr_list_t *ilist; 385 struct snd_seq_kinstr_list *ilist;
387 snd_iwffff_ops_t iwffff_ops; 386 struct snd_iwffff_ops iwffff_ops;
388 snd_gf1_ops_t gf1_ops; 387 struct snd_gf1_ops gf1_ops;
389 snd_simple_ops_t simple_ops; 388 struct snd_simple_ops simple_ops;
390 389
391 /* timer */ 390 /* timer */
392 391
393 unsigned short timer_enabled; 392 unsigned short timer_enabled;
394 snd_timer_t *timer1; 393 struct snd_timer *timer1;
395 snd_timer_t *timer2; 394 struct snd_timer *timer2;
396 395
397 /* midi */ 396 /* midi */
398 397
@@ -404,11 +403,11 @@ struct _snd_gf1 {
404 403
405 unsigned int dma_flags; 404 unsigned int dma_flags;
406 unsigned int dma_shared; 405 unsigned int dma_shared;
407 snd_gf1_dma_block_t *dma_data_pcm; 406 struct snd_gf1_dma_block *dma_data_pcm;
408 snd_gf1_dma_block_t *dma_data_pcm_last; 407 struct snd_gf1_dma_block *dma_data_pcm_last;
409 snd_gf1_dma_block_t *dma_data_synth; 408 struct snd_gf1_dma_block *dma_data_synth;
410 snd_gf1_dma_block_t *dma_data_synth_last; 409 struct snd_gf1_dma_block *dma_data_synth_last;
411 void (*dma_ack)(snd_gus_card_t * gus, void *private_data); 410 void (*dma_ack)(struct snd_gus_card * gus, void *private_data);
412 void *dma_private_data; 411 void *dma_private_data;
413 412
414 /* pcm */ 413 /* pcm */
@@ -425,8 +424,8 @@ struct _snd_gf1 {
425 424
426/* main structure for GUS card */ 425/* main structure for GUS card */
427 426
428struct _snd_gus_card { 427struct snd_gus_card {
429 snd_card_t *card; 428 struct snd_card *card;
430 429
431 unsigned int 430 unsigned int
432 initialized: 1, /* resources were initialized */ 431 initialized: 1, /* resources were initialized */
@@ -448,18 +447,18 @@ struct _snd_gus_card {
448 unsigned short joystick_dac; /* joystick DAC level */ 447 unsigned short joystick_dac; /* joystick DAC level */
449 int timer_dev; /* timer device */ 448 int timer_dev; /* timer device */
450 449
451 struct _snd_gf1 gf1; /* gf1 specific variables */ 450 struct snd_gf1 gf1; /* gf1 specific variables */
452 snd_pcm_t *pcm; 451 struct snd_pcm *pcm;
453 snd_pcm_substream_t *pcm_cap_substream; 452 struct snd_pcm_substream *pcm_cap_substream;
454 unsigned int c_dma_size; 453 unsigned int c_dma_size;
455 unsigned int c_period_size; 454 unsigned int c_period_size;
456 unsigned int c_pos; 455 unsigned int c_pos;
457 456
458 snd_rawmidi_t *midi_uart; 457 struct snd_rawmidi *midi_uart;
459 snd_rawmidi_substream_t *midi_substream_output; 458 struct snd_rawmidi_substream *midi_substream_output;
460 snd_rawmidi_substream_t *midi_substream_input; 459 struct snd_rawmidi_substream *midi_substream_input;
461 460
462 snd_seq_device_t *seq_dev; 461 struct snd_seq_device *seq_dev;
463 462
464 spinlock_t reg_lock; 463 spinlock_t reg_lock;
465 spinlock_t voice_alloc; 464 spinlock_t voice_alloc;
@@ -474,7 +473,7 @@ struct _snd_gus_card {
474 473
475/* I/O functions for GF1/InterWave chip - gus_io.c */ 474/* I/O functions for GF1/InterWave chip - gus_io.c */
476 475
477static inline void snd_gf1_select_voice(snd_gus_card_t * gus, int voice) 476static inline void snd_gf1_select_voice(struct snd_gus_card * gus, int voice)
478{ 477{
479 unsigned long flags; 478 unsigned long flags;
480 479
@@ -486,63 +485,63 @@ static inline void snd_gf1_select_voice(snd_gus_card_t * gus, int voice)
486 spin_unlock_irqrestore(&gus->active_voice_lock, flags); 485 spin_unlock_irqrestore(&gus->active_voice_lock, flags);
487} 486}
488 487
489static inline void snd_gf1_uart_cmd(snd_gus_card_t * gus, unsigned char b) 488static inline void snd_gf1_uart_cmd(struct snd_gus_card * gus, unsigned char b)
490{ 489{
491 outb(gus->gf1.uart_cmd = b, GUSP(gus, MIDICTRL)); 490 outb(gus->gf1.uart_cmd = b, GUSP(gus, MIDICTRL));
492} 491}
493 492
494static inline unsigned char snd_gf1_uart_stat(snd_gus_card_t * gus) 493static inline unsigned char snd_gf1_uart_stat(struct snd_gus_card * gus)
495{ 494{
496 return inb(GUSP(gus, MIDISTAT)); 495 return inb(GUSP(gus, MIDISTAT));
497} 496}
498 497
499static inline void snd_gf1_uart_put(snd_gus_card_t * gus, unsigned char b) 498static inline void snd_gf1_uart_put(struct snd_gus_card * gus, unsigned char b)
500{ 499{
501 outb(b, GUSP(gus, MIDIDATA)); 500 outb(b, GUSP(gus, MIDIDATA));
502} 501}
503 502
504static inline unsigned char snd_gf1_uart_get(snd_gus_card_t * gus) 503static inline unsigned char snd_gf1_uart_get(struct snd_gus_card * gus)
505{ 504{
506 return inb(GUSP(gus, MIDIDATA)); 505 return inb(GUSP(gus, MIDIDATA));
507} 506}
508 507
509extern void snd_gf1_delay(snd_gus_card_t * gus); 508extern void snd_gf1_delay(struct snd_gus_card * gus);
510 509
511extern void snd_gf1_ctrl_stop(snd_gus_card_t * gus, unsigned char reg); 510extern void snd_gf1_ctrl_stop(struct snd_gus_card * gus, unsigned char reg);
512 511
513extern void snd_gf1_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data); 512extern void snd_gf1_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
514extern unsigned char snd_gf1_look8(snd_gus_card_t * gus, unsigned char reg); 513extern unsigned char snd_gf1_look8(struct snd_gus_card * gus, unsigned char reg);
515static inline unsigned char snd_gf1_read8(snd_gus_card_t * gus, unsigned char reg) 514static inline unsigned char snd_gf1_read8(struct snd_gus_card * gus, unsigned char reg)
516{ 515{
517 return snd_gf1_look8(gus, reg | 0x80); 516 return snd_gf1_look8(gus, reg | 0x80);
518} 517}
519extern void snd_gf1_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data); 518extern void snd_gf1_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data);
520extern unsigned short snd_gf1_look16(snd_gus_card_t * gus, unsigned char reg); 519extern unsigned short snd_gf1_look16(struct snd_gus_card * gus, unsigned char reg);
521static inline unsigned short snd_gf1_read16(snd_gus_card_t * gus, unsigned char reg) 520static inline unsigned short snd_gf1_read16(struct snd_gus_card * gus, unsigned char reg)
522{ 521{
523 return snd_gf1_look16(gus, reg | 0x80); 522 return snd_gf1_look16(gus, reg | 0x80);
524} 523}
525extern void snd_gf1_adlib_write(snd_gus_card_t * gus, unsigned char reg, unsigned char data); 524extern void snd_gf1_adlib_write(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
526extern void snd_gf1_dram_addr(snd_gus_card_t * gus, unsigned int addr); 525extern void snd_gf1_dram_addr(struct snd_gus_card * gus, unsigned int addr);
527extern void snd_gf1_poke(snd_gus_card_t * gus, unsigned int addr, unsigned char data); 526extern void snd_gf1_poke(struct snd_gus_card * gus, unsigned int addr, unsigned char data);
528extern unsigned char snd_gf1_peek(snd_gus_card_t * gus, unsigned int addr); 527extern unsigned char snd_gf1_peek(struct snd_gus_card * gus, unsigned int addr);
529extern void snd_gf1_write_addr(snd_gus_card_t * gus, unsigned char reg, unsigned int addr, short w_16bit); 528extern void snd_gf1_write_addr(struct snd_gus_card * gus, unsigned char reg, unsigned int addr, short w_16bit);
530extern unsigned int snd_gf1_read_addr(snd_gus_card_t * gus, unsigned char reg, short w_16bit); 529extern unsigned int snd_gf1_read_addr(struct snd_gus_card * gus, unsigned char reg, short w_16bit);
531extern void snd_gf1_i_ctrl_stop(snd_gus_card_t * gus, unsigned char reg); 530extern void snd_gf1_i_ctrl_stop(struct snd_gus_card * gus, unsigned char reg);
532extern void snd_gf1_i_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data); 531extern void snd_gf1_i_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
533extern unsigned char snd_gf1_i_look8(snd_gus_card_t * gus, unsigned char reg); 532extern unsigned char snd_gf1_i_look8(struct snd_gus_card * gus, unsigned char reg);
534extern void snd_gf1_i_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data); 533extern void snd_gf1_i_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data);
535static inline unsigned char snd_gf1_i_read8(snd_gus_card_t * gus, unsigned char reg) 534static inline unsigned char snd_gf1_i_read8(struct snd_gus_card * gus, unsigned char reg)
536{ 535{
537 return snd_gf1_i_look8(gus, reg | 0x80); 536 return snd_gf1_i_look8(gus, reg | 0x80);
538} 537}
539extern unsigned short snd_gf1_i_look16(snd_gus_card_t * gus, unsigned char reg); 538extern unsigned short snd_gf1_i_look16(struct snd_gus_card * gus, unsigned char reg);
540static inline unsigned short snd_gf1_i_read16(snd_gus_card_t * gus, unsigned char reg) 539static inline unsigned short snd_gf1_i_read16(struct snd_gus_card * gus, unsigned char reg)
541{ 540{
542 return snd_gf1_i_look16(gus, reg | 0x80); 541 return snd_gf1_i_look16(gus, reg | 0x80);
543} 542}
544 543
545extern void snd_gf1_select_active_voices(snd_gus_card_t * gus); 544extern void snd_gf1_select_active_voices(struct snd_gus_card * gus);
546 545
547/* gus_lfo.c */ 546/* gus_lfo.c */
548 547
@@ -555,98 +554,98 @@ struct _SND_IW_LFO_PROGRAM {
555}; 554};
556 555
557#if 0 556#if 0
558extern irqreturn_t snd_gf1_lfo_effect_interrupt(snd_gus_card_t * gus, snd_gf1_voice_t * voice); 557extern irqreturn_t snd_gf1_lfo_effect_interrupt(struct snd_gus_card * gus, snd_gf1_voice_t * voice);
559#endif 558#endif
560extern void snd_gf1_lfo_init(snd_gus_card_t * gus); 559extern void snd_gf1_lfo_init(struct snd_gus_card * gus);
561extern void snd_gf1_lfo_done(snd_gus_card_t * gus); 560extern void snd_gf1_lfo_done(struct snd_gus_card * gus);
562extern void snd_gf1_lfo_program(snd_gus_card_t * gus, int voice, int lfo_type, struct _SND_IW_LFO_PROGRAM *program); 561extern void snd_gf1_lfo_program(struct snd_gus_card * gus, int voice, int lfo_type, struct _SND_IW_LFO_PROGRAM *program);
563extern void snd_gf1_lfo_enable(snd_gus_card_t * gus, int voice, int lfo_type); 562extern void snd_gf1_lfo_enable(struct snd_gus_card * gus, int voice, int lfo_type);
564extern void snd_gf1_lfo_disable(snd_gus_card_t * gus, int voice, int lfo_type); 563extern void snd_gf1_lfo_disable(struct snd_gus_card * gus, int voice, int lfo_type);
565extern void snd_gf1_lfo_change_freq(snd_gus_card_t * gus, int voice, int lfo_type, int freq); 564extern void snd_gf1_lfo_change_freq(struct snd_gus_card * gus, int voice, int lfo_type, int freq);
566extern void snd_gf1_lfo_change_depth(snd_gus_card_t * gus, int voice, int lfo_type, int depth); 565extern void snd_gf1_lfo_change_depth(struct snd_gus_card * gus, int voice, int lfo_type, int depth);
567extern void snd_gf1_lfo_setup(snd_gus_card_t * gus, int voice, int lfo_type, int freq, int current_depth, int depth, int sweep, int shape); 566extern void snd_gf1_lfo_setup(struct snd_gus_card * gus, int voice, int lfo_type, int freq, int current_depth, int depth, int sweep, int shape);
568extern void snd_gf1_lfo_shutdown(snd_gus_card_t * gus, int voice, int lfo_type); 567extern void snd_gf1_lfo_shutdown(struct snd_gus_card * gus, int voice, int lfo_type);
569#if 0 568#if 0
570extern void snd_gf1_lfo_command(snd_gus_card_t * gus, int voice, unsigned char *command); 569extern void snd_gf1_lfo_command(struct snd_gus_card * gus, int voice, unsigned char *command);
571#endif 570#endif
572 571
573/* gus_mem.c */ 572/* gus_mem.c */
574 573
575void snd_gf1_mem_lock(snd_gf1_mem_t * alloc, int xup); 574void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup);
576int snd_gf1_mem_xfree(snd_gf1_mem_t * alloc, snd_gf1_mem_block_t * block); 575int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * block);
577snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner, 576struct snd_gf1_mem_block *snd_gf1_mem_alloc(struct snd_gf1_mem * alloc, int owner,
578 char *name, int size, int w_16, 577 char *name, int size, int w_16,
579 int align, unsigned int *share_id); 578 int align, unsigned int *share_id);
580int snd_gf1_mem_free(snd_gf1_mem_t * alloc, unsigned int address); 579int snd_gf1_mem_free(struct snd_gf1_mem * alloc, unsigned int address);
581int snd_gf1_mem_free_owner(snd_gf1_mem_t * alloc, int owner); 580int snd_gf1_mem_free_owner(struct snd_gf1_mem * alloc, int owner);
582int snd_gf1_mem_init(snd_gus_card_t * gus); 581int snd_gf1_mem_init(struct snd_gus_card * gus);
583int snd_gf1_mem_done(snd_gus_card_t * gus); 582int snd_gf1_mem_done(struct snd_gus_card * gus);
584 583
585/* gus_mem_proc.c */ 584/* gus_mem_proc.c */
586 585
587int snd_gf1_mem_proc_init(snd_gus_card_t * gus); 586int snd_gf1_mem_proc_init(struct snd_gus_card * gus);
588 587
589/* gus_dma.c */ 588/* gus_dma.c */
590 589
591int snd_gf1_dma_init(snd_gus_card_t * gus); 590int snd_gf1_dma_init(struct snd_gus_card * gus);
592int snd_gf1_dma_done(snd_gus_card_t * gus); 591int snd_gf1_dma_done(struct snd_gus_card * gus);
593int snd_gf1_dma_transfer_block(snd_gus_card_t * gus, 592int snd_gf1_dma_transfer_block(struct snd_gus_card * gus,
594 snd_gf1_dma_block_t * block, 593 struct snd_gf1_dma_block * block,
595 int atomic, 594 int atomic,
596 int synth); 595 int synth);
597 596
598/* gus_volume.c */ 597/* gus_volume.c */
599 598
600unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol); 599unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol);
601unsigned short snd_gf1_translate_freq(snd_gus_card_t * gus, unsigned int freq2); 600unsigned short snd_gf1_translate_freq(struct snd_gus_card * gus, unsigned int freq2);
602 601
603/* gus_reset.c */ 602/* gus_reset.c */
604 603
605void snd_gf1_set_default_handlers(snd_gus_card_t * gus, unsigned int what); 604void snd_gf1_set_default_handlers(struct snd_gus_card * gus, unsigned int what);
606void snd_gf1_smart_stop_voice(snd_gus_card_t * gus, unsigned short voice); 605void snd_gf1_smart_stop_voice(struct snd_gus_card * gus, unsigned short voice);
607void snd_gf1_stop_voice(snd_gus_card_t * gus, unsigned short voice); 606void snd_gf1_stop_voice(struct snd_gus_card * gus, unsigned short voice);
608void snd_gf1_stop_voices(snd_gus_card_t * gus, unsigned short v_min, unsigned short v_max); 607void snd_gf1_stop_voices(struct snd_gus_card * gus, unsigned short v_min, unsigned short v_max);
609snd_gus_voice_t *snd_gf1_alloc_voice(snd_gus_card_t * gus, int type, int client, int port); 608struct snd_gus_voice *snd_gf1_alloc_voice(struct snd_gus_card * gus, int type, int client, int port);
610void snd_gf1_free_voice(snd_gus_card_t * gus, snd_gus_voice_t *voice); 609void snd_gf1_free_voice(struct snd_gus_card * gus, struct snd_gus_voice *voice);
611int snd_gf1_start(snd_gus_card_t * gus); 610int snd_gf1_start(struct snd_gus_card * gus);
612int snd_gf1_stop(snd_gus_card_t * gus); 611int snd_gf1_stop(struct snd_gus_card * gus);
613 612
614/* gus_mixer.c */ 613/* gus_mixer.c */
615 614
616int snd_gf1_new_mixer(snd_gus_card_t * gus); 615int snd_gf1_new_mixer(struct snd_gus_card * gus);
617 616
618/* gus_pcm.c */ 617/* gus_pcm.c */
619 618
620int snd_gf1_pcm_new(snd_gus_card_t * gus, int pcm_dev, int control_index, snd_pcm_t ** rpcm); 619int snd_gf1_pcm_new(struct snd_gus_card * gus, int pcm_dev, int control_index, struct snd_pcm ** rpcm);
621 620
622#ifdef CONFIG_SND_DEBUG 621#ifdef CONFIG_SND_DEBUG
623extern void snd_gf1_print_voice_registers(snd_gus_card_t * gus); 622extern void snd_gf1_print_voice_registers(struct snd_gus_card * gus);
624#endif 623#endif
625 624
626/* gus.c */ 625/* gus.c */
627 626
628int snd_gus_use_inc(snd_gus_card_t * gus); 627int snd_gus_use_inc(struct snd_gus_card * gus);
629void snd_gus_use_dec(snd_gus_card_t * gus); 628void snd_gus_use_dec(struct snd_gus_card * gus);
630int snd_gus_create(snd_card_t * card, 629int snd_gus_create(struct snd_card *card,
631 unsigned long port, 630 unsigned long port,
632 int irq, int dma1, int dma2, 631 int irq, int dma1, int dma2,
633 int timer_dev, 632 int timer_dev,
634 int voices, 633 int voices,
635 int pcm_channels, 634 int pcm_channels,
636 int effect, 635 int effect,
637 snd_gus_card_t ** rgus); 636 struct snd_gus_card ** rgus);
638int snd_gus_initialize(snd_gus_card_t * gus); 637int snd_gus_initialize(struct snd_gus_card * gus);
639 638
640/* gus_irq.c */ 639/* gus_irq.c */
641 640
642irqreturn_t snd_gus_interrupt(int irq, void *dev_id, struct pt_regs *regs); 641irqreturn_t snd_gus_interrupt(int irq, void *dev_id, struct pt_regs *regs);
643#ifdef CONFIG_SND_DEBUG 642#ifdef CONFIG_SND_DEBUG
644void snd_gus_irq_profile_init(snd_gus_card_t *gus); 643void snd_gus_irq_profile_init(struct snd_gus_card *gus);
645#endif 644#endif
646 645
647/* gus_uart.c */ 646/* gus_uart.c */
648 647
649int snd_gf1_rawmidi_new(snd_gus_card_t * gus, int device, snd_rawmidi_t **rrawmidi); 648int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi **rrawmidi);
650 649
651#if 0 650#if 0
652extern void snd_engine_instrument_register(unsigned short mode, 651extern void snd_engine_instrument_register(unsigned short mode,
@@ -657,37 +656,37 @@ extern int snd_engine_instrument_register_ask(unsigned short mode);
657#endif 656#endif
658 657
659/* gus_dram.c */ 658/* gus_dram.c */
660int snd_gus_dram_write(snd_gus_card_t *gus, char __user *ptr, 659int snd_gus_dram_write(struct snd_gus_card *gus, char __user *ptr,
661 unsigned int addr, unsigned int size); 660 unsigned int addr, unsigned int size);
662int snd_gus_dram_read(snd_gus_card_t *gus, char __user *ptr, 661int snd_gus_dram_read(struct snd_gus_card *gus, char __user *ptr,
663 unsigned int addr, unsigned int size, int rom); 662 unsigned int addr, unsigned int size, int rom);
664 663
665#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 664#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
666 665
667/* gus_sample.c */ 666/* gus_sample.c */
668void snd_gus_sample_event(snd_seq_event_t *ev, snd_gus_port_t *p); 667void snd_gus_sample_event(struct snd_seq_event *ev, struct snd_gus_port *p);
669 668
670/* gus_simple.c */ 669/* gus_simple.c */
671void snd_gf1_simple_init(snd_gus_voice_t *voice); 670void snd_gf1_simple_init(struct snd_gus_voice *voice);
672 671
673/* gus_instr.c */ 672/* gus_instr.c */
674int snd_gus_iwffff_put_sample(void *private_data, iwffff_wave_t *wave, 673int snd_gus_iwffff_put_sample(void *private_data, struct iwffff_wave *wave,
675 char __user *data, long len, int atomic); 674 char __user *data, long len, int atomic);
676int snd_gus_iwffff_get_sample(void *private_data, iwffff_wave_t *wave, 675int snd_gus_iwffff_get_sample(void *private_data, struct iwffff_wave *wave,
677 char __user *data, long len, int atomic); 676 char __user *data, long len, int atomic);
678int snd_gus_iwffff_remove_sample(void *private_data, iwffff_wave_t *wave, 677int snd_gus_iwffff_remove_sample(void *private_data, struct iwffff_wave *wave,
679 int atomic); 678 int atomic);
680int snd_gus_gf1_put_sample(void *private_data, gf1_wave_t *wave, 679int snd_gus_gf1_put_sample(void *private_data, struct gf1_wave *wave,
681 char __user *data, long len, int atomic); 680 char __user *data, long len, int atomic);
682int snd_gus_gf1_get_sample(void *private_data, gf1_wave_t *wave, 681int snd_gus_gf1_get_sample(void *private_data, struct gf1_wave *wave,
683 char __user *data, long len, int atomic); 682 char __user *data, long len, int atomic);
684int snd_gus_gf1_remove_sample(void *private_data, gf1_wave_t *wave, 683int snd_gus_gf1_remove_sample(void *private_data, struct gf1_wave *wave,
685 int atomic); 684 int atomic);
686int snd_gus_simple_put_sample(void *private_data, simple_instrument_t *instr, 685int snd_gus_simple_put_sample(void *private_data, struct simple_instrument *instr,
687 char __user *data, long len, int atomic); 686 char __user *data, long len, int atomic);
688int snd_gus_simple_get_sample(void *private_data, simple_instrument_t *instr, 687int snd_gus_simple_get_sample(void *private_data, struct simple_instrument *instr,
689 char __user *data, long len, int atomic); 688 char __user *data, long len, int atomic);
690int snd_gus_simple_remove_sample(void *private_data, simple_instrument_t *instr, 689int snd_gus_simple_remove_sample(void *private_data, struct simple_instrument *instr,
691 int atomic); 690 int atomic);
692 691
693#endif /* CONFIG_SND_SEQUENCER */ 692#endif /* CONFIG_SND_SEQUENCER */
diff --git a/include/sound/hdsp.h b/include/sound/hdsp.h
index 7ce3aa67e5d6..25e1951a9955 100644
--- a/include/sound/hdsp.h
+++ b/include/sound/hdsp.h
@@ -21,17 +21,15 @@
21 21
22#define HDSP_MATRIX_MIXER_SIZE 2048 22#define HDSP_MATRIX_MIXER_SIZE 2048
23 23
24typedef enum { 24enum HDSP_IO_Type {
25 Digiface, 25 Digiface,
26 Multiface, 26 Multiface,
27 H9652, 27 H9652,
28 H9632, 28 H9632,
29 Undefined, 29 Undefined,
30} HDSP_IO_Type; 30};
31
32typedef struct _snd_hdsp_peak_rms hdsp_peak_rms_t;
33 31
34struct _snd_hdsp_peak_rms { 32struct hdsp_peak_rms {
35 u32 input_peaks[26]; 33 u32 input_peaks[26];
36 u32 playback_peaks[26]; 34 u32 playback_peaks[26];
37 u32 output_peaks[28]; 35 u32 output_peaks[28];
@@ -41,11 +39,9 @@ struct _snd_hdsp_peak_rms {
41 u64 output_rms[26]; 39 u64 output_rms[26];
42}; 40};
43 41
44#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, hdsp_peak_rms_t) 42#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms)
45 43
46typedef struct _snd_hdsp_config_info hdsp_config_info_t; 44struct hdsp_config_info {
47
48struct _snd_hdsp_config_info {
49 unsigned char pref_sync_ref; 45 unsigned char pref_sync_ref;
50 unsigned char wordclock_sync_check; 46 unsigned char wordclock_sync_check;
51 unsigned char spdif_sync_check; 47 unsigned char spdif_sync_check;
@@ -71,40 +67,41 @@ struct _snd_hdsp_config_info {
71 unsigned char analog_extension_board; 67 unsigned char analog_extension_board;
72}; 68};
73 69
74#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, hdsp_config_info_t) 70#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info)
75
76typedef struct _snd_hdsp_firmware hdsp_firmware_t;
77 71
78struct _snd_hdsp_firmware { 72struct hdsp_firmware {
79 void __user *firmware_data; /* 24413 x 4 bytes */ 73 void __user *firmware_data; /* 24413 x 4 bytes */
80}; 74};
81 75
82#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, hdsp_firmware_t) 76#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware)
83 77
84typedef struct _snd_hdsp_version hdsp_version_t; 78struct hdsp_version {
85 79 enum HDSP_IO_Type io_type;
86struct _snd_hdsp_version {
87 HDSP_IO_Type io_type;
88 unsigned short firmware_rev; 80 unsigned short firmware_rev;
89}; 81};
90 82
91#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, hdsp_version_t) 83#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version)
92
93typedef struct _snd_hdsp_mixer hdsp_mixer_t;
94 84
95struct _snd_hdsp_mixer { 85struct hdsp_mixer {
96 unsigned short matrix[HDSP_MATRIX_MIXER_SIZE]; 86 unsigned short matrix[HDSP_MATRIX_MIXER_SIZE];
97}; 87};
98 88
99#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, hdsp_mixer_t) 89#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer)
100 90
101typedef struct _snd_hdsp_9632_aeb hdsp_9632_aeb_t; 91struct hdsp_9632_aeb {
102
103struct _snd_hdsp_9632_aeb {
104 int aebi; 92 int aebi;
105 int aebo; 93 int aebo;
106}; 94};
107 95
108#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, hdsp_9632_aeb_t) 96#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb)
97
98/* typedefs for compatibility to user-space */
99typedef enum HDSP_IO_Type HDSP_IO_Type;
100typedef struct hdsp_peak_rms hdsp_peak_rms_t;
101typedef struct hdsp_config_info hdsp_config_info_t;
102typedef struct hdsp_firmware hdsp_firmware_t;
103typedef struct hdsp_version hdsp_version_t;
104typedef struct hdsp_mixer hdsp_mixer_t;
105typedef struct hdsp_9632_aeb hdsp_9632_aeb_t;
109 106
110#endif /* __SOUND_HDSP_H */ 107#endif /* __SOUND_HDSP_H */
diff --git a/include/sound/hdspm.h b/include/sound/hdspm.h
index c34427ccd0b3..c3c854d99c28 100644
--- a/include/sound/hdspm.h
+++ b/include/sound/hdspm.h
@@ -25,8 +25,6 @@
25 25
26/* -------------------- IOCTL Peak/RMS Meters -------------------- */ 26/* -------------------- IOCTL Peak/RMS Meters -------------------- */
27 27
28typedef struct _snd_hdspm_peak_rms hdspm_peak_rms_t;
29
30/* peam rms level structure like we get from hardware 28/* peam rms level structure like we get from hardware
31 29
32 maybe in future we can memory map it so I just copy it 30 maybe in future we can memory map it so I just copy it
@@ -36,7 +34,7 @@ typedef struct _snd_hdspm_peak_rms hdspm_peak_rms_t;
36 (i asume so from the code) 34 (i asume so from the code)
37*/ 35*/
38 36
39struct _snd_hdspm_peak_rms { 37struct hdspm_peak_rms {
40 38
41 unsigned int level_offset[1024]; 39 unsigned int level_offset[1024];
42 40
@@ -58,18 +56,16 @@ struct _snd_hdspm_peak_rms {
58 unsigned int xxx_rms_h[64]; /* not used */ 56 unsigned int xxx_rms_h[64]; /* not used */
59}; 57};
60 58
61struct sndrv_hdspm_peak_rms_ioctl { 59struct hdspm_peak_rms_ioctl {
62 hdspm_peak_rms_t *peak; 60 struct hdspm_peak_rms *peak;
63}; 61};
64 62
65/* use indirect access due to the limit of ioctl bit size */ 63/* use indirect access due to the limit of ioctl bit size */
66#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct sndrv_hdspm_peak_rms_ioctl) 64#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdspm_peak_rms_ioctl)
67 65
68/* ------------ CONFIG block IOCTL ---------------------- */ 66/* ------------ CONFIG block IOCTL ---------------------- */
69 67
70typedef struct _snd_hdspm_config_info hdspm_config_info_t; 68struct hdspm_config_info {
71
72struct _snd_hdspm_config_info {
73 unsigned char pref_sync_ref; 69 unsigned char pref_sync_ref;
74 unsigned char wordclock_sync_check; 70 unsigned char wordclock_sync_check;
75 unsigned char madi_sync_check; 71 unsigned char madi_sync_check;
@@ -83,18 +79,16 @@ struct _snd_hdspm_config_info {
83 unsigned int analog_out; 79 unsigned int analog_out;
84}; 80};
85 81
86#define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, hdspm_config_info_t) 82#define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdspm_config_info)
87 83
88 84
89/* get Soundcard Version */ 85/* get Soundcard Version */
90 86
91typedef struct _snd_hdspm_version hdspm_version_t; 87struct hdspm_version {
92
93struct _snd_hdspm_version {
94 unsigned short firmware_rev; 88 unsigned short firmware_rev;
95}; 89};
96 90
97#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, hdspm_version_t) 91#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdspm_version)
98 92
99 93
100/* ------------- get Matrix Mixer IOCTL --------------- */ 94/* ------------- get Matrix Mixer IOCTL --------------- */
@@ -108,24 +102,27 @@ struct _snd_hdspm_version {
108 102
109#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS 103#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
110 104
111typedef struct _snd_hdspm_channelfader snd_hdspm_channelfader_t; 105struct hdspm_channelfader {
112
113struct _snd_hdspm_channelfader {
114 unsigned int in[HDSPM_MIXER_CHANNELS]; 106 unsigned int in[HDSPM_MIXER_CHANNELS];
115 unsigned int pb[HDSPM_MIXER_CHANNELS]; 107 unsigned int pb[HDSPM_MIXER_CHANNELS];
116}; 108};
117 109
118typedef struct _snd_hdspm_mixer hdspm_mixer_t; 110struct hdspm_mixer {
119 111 struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS];
120struct _snd_hdspm_mixer {
121 snd_hdspm_channelfader_t ch[HDSPM_MIXER_CHANNELS];
122}; 112};
123 113
124struct sndrv_hdspm_mixer_ioctl { 114struct hdspm_mixer_ioctl {
125 hdspm_mixer_t *mixer; 115 struct hdspm_mixer *mixer;
126}; 116};
127 117
128/* use indirect access due to the limit of ioctl bit size */ 118/* use indirect access due to the limit of ioctl bit size */
129#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct sndrv_hdspm_mixer_ioctl) 119#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
120
121/* typedefs for compatibility to user-space */
122typedef struct hdspm_peak_rms hdspm_peak_rms_t;
123typedef struct hdspm_config_info hdspm_config_info_t;
124typedef struct hdspm_version hdspm_version_t;
125typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
126typedef struct hdspm_mixer hdspm_mixer_t;
130 127
131#endif /* __SOUND_HDSPM_H */ 128#endif /* __SOUND_HDSPM_H */
diff --git a/include/sound/hwdep.h b/include/sound/hwdep.h
index 043876348fa1..c679e5b31111 100644
--- a/include/sound/hwdep.h
+++ b/include/sound/hwdep.h
@@ -25,27 +25,25 @@
25#include <sound/asound.h> 25#include <sound/asound.h>
26#include <linux/poll.h> 26#include <linux/poll.h>
27 27
28typedef enum sndrv_hwdep_iface snd_hwdep_iface_t; 28struct snd_hwdep;
29typedef struct sndrv_hwdep_info snd_hwdep_info_t;
30typedef struct sndrv_hwdep_dsp_status snd_hwdep_dsp_status_t;
31typedef struct sndrv_hwdep_dsp_image snd_hwdep_dsp_image_t;
32 29
33typedef struct _snd_hwdep_ops { 30struct snd_hwdep_ops {
34 long long (*llseek) (snd_hwdep_t *hw, struct file * file, long long offset, int orig); 31 long long (*llseek) (struct snd_hwdep *hw, struct file * file, long long offset, int orig);
35 long (*read) (snd_hwdep_t * hw, char __user *buf, long count, loff_t *offset); 32 long (*read) (struct snd_hwdep *hw, char __user *buf, long count, loff_t *offset);
36 long (*write) (snd_hwdep_t * hw, const char __user *buf, long count, loff_t *offset); 33 long (*write) (struct snd_hwdep *hw, const char __user *buf, long count, loff_t *offset);
37 int (*open) (snd_hwdep_t * hw, struct file * file); 34 int (*open) (struct snd_hwdep * hw, struct file * file);
38 int (*release) (snd_hwdep_t * hw, struct file * file); 35 int (*release) (struct snd_hwdep *hw, struct file * file);
39 unsigned int (*poll) (snd_hwdep_t * hw, struct file * file, poll_table * wait); 36 unsigned int (*poll) (struct snd_hwdep *hw, struct file * file, poll_table * wait);
40 int (*ioctl) (snd_hwdep_t * hw, struct file * file, unsigned int cmd, unsigned long arg); 37 int (*ioctl) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg);
41 int (*ioctl_compat) (snd_hwdep_t * hw, struct file * file, unsigned int cmd, unsigned long arg); 38 int (*ioctl_compat) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg);
42 int (*mmap) (snd_hwdep_t * hw, struct file * file, struct vm_area_struct * vma); 39 int (*mmap) (struct snd_hwdep *hw, struct file * file, struct vm_area_struct * vma);
43 int (*dsp_status) (snd_hwdep_t * hw, snd_hwdep_dsp_status_t * status); 40 int (*dsp_status) (struct snd_hwdep *hw, struct snd_hwdep_dsp_status *status);
44 int (*dsp_load) (snd_hwdep_t * hw, snd_hwdep_dsp_image_t * image); 41 int (*dsp_load) (struct snd_hwdep *hw, struct snd_hwdep_dsp_image *image);
45} snd_hwdep_ops_t; 42};
46 43
47struct _snd_hwdep { 44struct snd_hwdep {
48 snd_card_t *card; 45 struct snd_card *card;
46 struct list_head list;
49 int device; 47 int device;
50 char id[32]; 48 char id[32];
51 char name[80]; 49 char name[80];
@@ -57,10 +55,10 @@ struct _snd_hwdep {
57 int ossreg; 55 int ossreg;
58#endif 56#endif
59 57
60 snd_hwdep_ops_t ops; 58 struct snd_hwdep_ops ops;
61 wait_queue_head_t open_wait; 59 wait_queue_head_t open_wait;
62 void *private_data; 60 void *private_data;
63 void (*private_free) (snd_hwdep_t *hwdep); 61 void (*private_free) (struct snd_hwdep *hwdep);
64 62
65 struct semaphore open_mutex; 63 struct semaphore open_mutex;
66 int used; 64 int used;
@@ -68,6 +66,7 @@ struct _snd_hwdep {
68 unsigned int exclusive: 1; 66 unsigned int exclusive: 1;
69}; 67};
70 68
71extern int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep); 69extern int snd_hwdep_new(struct snd_card *card, char *id, int device,
70 struct snd_hwdep **rhwdep);
72 71
73#endif /* __SOUND_HWDEP_H */ 72#endif /* __SOUND_HWDEP_H */
diff --git a/include/sound/i2c.h b/include/sound/i2c.h
index a665ddf9c146..81eb23ed761f 100644
--- a/include/sound/i2c.h
+++ b/include/sound/i2c.h
@@ -21,82 +21,84 @@
21 * 21 *
22 */ 22 */
23 23
24typedef struct _snd_i2c_device snd_i2c_device_t;
25typedef struct _snd_i2c_bus snd_i2c_bus_t;
26
27#define SND_I2C_DEVICE_ADDRTEN (1<<0) /* 10-bit I2C address */ 24#define SND_I2C_DEVICE_ADDRTEN (1<<0) /* 10-bit I2C address */
28 25
29struct _snd_i2c_device { 26struct snd_i2c_device {
30 struct list_head list; 27 struct list_head list;
31 snd_i2c_bus_t *bus; /* I2C bus */ 28 struct snd_i2c_bus *bus; /* I2C bus */
32 char name[32]; /* some useful device name */ 29 char name[32]; /* some useful device name */
33 unsigned short flags; /* device flags */ 30 unsigned short flags; /* device flags */
34 unsigned short addr; /* device address (might be 10-bit) */ 31 unsigned short addr; /* device address (might be 10-bit) */
35 unsigned long private_value; 32 unsigned long private_value;
36 void *private_data; 33 void *private_data;
37 void (*private_free)(snd_i2c_device_t *device); 34 void (*private_free)(struct snd_i2c_device *device);
35};
36
37#define snd_i2c_device(n) list_entry(n, struct snd_i2c_device, list)
38
39struct snd_i2c_bit_ops {
40 void (*start)(struct snd_i2c_bus *bus); /* transfer start */
41 void (*stop)(struct snd_i2c_bus *bus); /* transfer stop */
42 void (*direction)(struct snd_i2c_bus *bus, int clock, int data); /* set line direction (0 = write, 1 = read) */
43 void (*setlines)(struct snd_i2c_bus *bus, int clock, int data);
44 int (*getclock)(struct snd_i2c_bus *bus);
45 int (*getdata)(struct snd_i2c_bus *bus, int ack);
38}; 46};
39 47
40#define snd_i2c_device(n) list_entry(n, snd_i2c_device_t, list) 48struct snd_i2c_ops {
41 49 int (*sendbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count);
42typedef struct _snd_i2c_bit_ops { 50 int (*readbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count);
43 void (*start)(snd_i2c_bus_t *bus); /* transfer start */ 51 int (*probeaddr)(struct snd_i2c_bus *bus, unsigned short addr);
44 void (*stop)(snd_i2c_bus_t *bus); /* transfer stop */ 52};
45 void (*direction)(snd_i2c_bus_t *bus, int clock, int data); /* set line direction (0 = write, 1 = read) */ 53
46 void (*setlines)(snd_i2c_bus_t *bus, int clock, int data); 54struct snd_i2c_bus {
47 int (*getclock)(snd_i2c_bus_t *bus); 55 struct snd_card *card; /* card which I2C belongs to */
48 int (*getdata)(snd_i2c_bus_t *bus, int ack);
49} snd_i2c_bit_ops_t;
50
51typedef struct _snd_i2c_ops {
52 int (*sendbytes)(snd_i2c_device_t *device, unsigned char *bytes, int count);
53 int (*readbytes)(snd_i2c_device_t *device, unsigned char *bytes, int count);
54 int (*probeaddr)(snd_i2c_bus_t *bus, unsigned short addr);
55} snd_i2c_ops_t;
56
57struct _snd_i2c_bus {
58 snd_card_t *card; /* card which I2C belongs to */
59 char name[32]; /* some useful label */ 56 char name[32]; /* some useful label */
60 57
61 struct semaphore lock_mutex; 58 struct semaphore lock_mutex;
62 59
63 snd_i2c_bus_t *master; /* master bus when SCK/SCL is shared */ 60 struct snd_i2c_bus *master; /* master bus when SCK/SCL is shared */
64 struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */ 61 struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */
65 62
66 struct list_head devices; /* attached devices to this bus */ 63 struct list_head devices; /* attached devices to this bus */
67 64
68 union { 65 union {
69 snd_i2c_bit_ops_t *bit; 66 struct snd_i2c_bit_ops *bit;
70 void *ops; 67 void *ops;
71 } hw_ops; /* lowlevel operations */ 68 } hw_ops; /* lowlevel operations */
72 snd_i2c_ops_t *ops; /* midlevel operations */ 69 struct snd_i2c_ops *ops; /* midlevel operations */
73 70
74 unsigned long private_value; 71 unsigned long private_value;
75 void *private_data; 72 void *private_data;
76 void (*private_free)(snd_i2c_bus_t *bus); 73 void (*private_free)(struct snd_i2c_bus *bus);
77}; 74};
78 75
79#define snd_i2c_slave_bus(n) list_entry(n, snd_i2c_bus_t, buses) 76#define snd_i2c_slave_bus(n) list_entry(n, struct snd_i2c_bus, buses)
80 77
81int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master, snd_i2c_bus_t **ri2c); 78int snd_i2c_bus_create(struct snd_card *card, const char *name,
82int snd_i2c_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char addr, snd_i2c_device_t **rdevice); 79 struct snd_i2c_bus *master, struct snd_i2c_bus **ri2c);
83int snd_i2c_device_free(snd_i2c_device_t *device); 80int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name,
81 unsigned char addr, struct snd_i2c_device **rdevice);
82int snd_i2c_device_free(struct snd_i2c_device *device);
84 83
85static inline void snd_i2c_lock(snd_i2c_bus_t *bus) { 84static inline void snd_i2c_lock(struct snd_i2c_bus *bus)
85{
86 if (bus->master) 86 if (bus->master)
87 down(&bus->master->lock_mutex); 87 down(&bus->master->lock_mutex);
88 else 88 else
89 down(&bus->lock_mutex); 89 down(&bus->lock_mutex);
90} 90}
91static inline void snd_i2c_unlock(snd_i2c_bus_t *bus) { 91
92static inline void snd_i2c_unlock(struct snd_i2c_bus *bus)
93{
92 if (bus->master) 94 if (bus->master)
93 up(&bus->master->lock_mutex); 95 up(&bus->master->lock_mutex);
94 else 96 else
95 up(&bus->lock_mutex); 97 up(&bus->lock_mutex);
96} 98}
97 99
98int snd_i2c_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); 100int snd_i2c_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count);
99int snd_i2c_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); 101int snd_i2c_readbytes(struct snd_i2c_device *device, unsigned char *bytes, int count);
100int snd_i2c_probeaddr(snd_i2c_bus_t *bus, unsigned short addr); 102int snd_i2c_probeaddr(struct snd_i2c_bus *bus, unsigned short addr);
101 103
102#endif /* __SOUND_I2C_H */ 104#endif /* __SOUND_I2C_H */
diff --git a/include/sound/info.h b/include/sound/info.h
index 1d76bf3cb05e..8ea5c7497c03 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -34,8 +34,6 @@ struct snd_info_buffer {
34 int error; /* error code */ 34 int error; /* error code */
35}; 35};
36 36
37typedef struct snd_info_buffer snd_info_buffer_t;
38
39#define SNDRV_INFO_CONTENT_TEXT 0 37#define SNDRV_INFO_CONTENT_TEXT 0
40#define SNDRV_INFO_CONTENT_DATA 1 38#define SNDRV_INFO_CONTENT_DATA 1
41 39
@@ -44,28 +42,28 @@ struct snd_info_entry;
44struct snd_info_entry_text { 42struct snd_info_entry_text {
45 unsigned long read_size; 43 unsigned long read_size;
46 unsigned long write_size; 44 unsigned long write_size;
47 void (*read) (snd_info_entry_t *entry, snd_info_buffer_t * buffer); 45 void (*read) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
48 void (*write) (snd_info_entry_t *entry, snd_info_buffer_t * buffer); 46 void (*write) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
49}; 47};
50 48
51struct snd_info_entry_ops { 49struct snd_info_entry_ops {
52 int (*open) (snd_info_entry_t *entry, 50 int (*open) (struct snd_info_entry *entry,
53 unsigned short mode, void **file_private_data); 51 unsigned short mode, void **file_private_data);
54 int (*release) (snd_info_entry_t * entry, 52 int (*release) (struct snd_info_entry * entry,
55 unsigned short mode, void *file_private_data); 53 unsigned short mode, void *file_private_data);
56 long (*read) (snd_info_entry_t *entry, void *file_private_data, 54 long (*read) (struct snd_info_entry *entry, void *file_private_data,
57 struct file * file, char __user *buf, 55 struct file * file, char __user *buf,
58 unsigned long count, unsigned long pos); 56 unsigned long count, unsigned long pos);
59 long (*write) (snd_info_entry_t *entry, void *file_private_data, 57 long (*write) (struct snd_info_entry *entry, void *file_private_data,
60 struct file * file, const char __user *buf, 58 struct file * file, const char __user *buf,
61 unsigned long count, unsigned long pos); 59 unsigned long count, unsigned long pos);
62 long long (*llseek) (snd_info_entry_t *entry, void *file_private_data, 60 long long (*llseek) (struct snd_info_entry *entry, void *file_private_data,
63 struct file * file, long long offset, int orig); 61 struct file * file, long long offset, int orig);
64 unsigned int (*poll) (snd_info_entry_t *entry, void *file_private_data, 62 unsigned int (*poll) (struct snd_info_entry *entry, void *file_private_data,
65 struct file * file, poll_table * wait); 63 struct file * file, poll_table * wait);
66 int (*ioctl) (snd_info_entry_t *entry, void *file_private_data, 64 int (*ioctl) (struct snd_info_entry *entry, void *file_private_data,
67 struct file * file, unsigned int cmd, unsigned long arg); 65 struct file * file, unsigned int cmd, unsigned long arg);
68 int (*mmap) (snd_info_entry_t *entry, void *file_private_data, 66 int (*mmap) (struct snd_info_entry *entry, void *file_private_data,
69 struct inode * inode, struct file * file, 67 struct inode * inode, struct file * file,
70 struct vm_area_struct * vma); 68 struct vm_area_struct * vma);
71}; 69};
@@ -80,20 +78,18 @@ struct snd_info_entry {
80 struct snd_info_entry_text text; 78 struct snd_info_entry_text text;
81 struct snd_info_entry_ops *ops; 79 struct snd_info_entry_ops *ops;
82 } c; 80 } c;
83 snd_info_entry_t *parent; 81 struct snd_info_entry *parent;
84 snd_card_t *card; 82 struct snd_card *card;
85 struct module *module; 83 struct module *module;
86 void *private_data; 84 void *private_data;
87 void (*private_free)(snd_info_entry_t *entry); 85 void (*private_free)(struct snd_info_entry *entry);
88 struct proc_dir_entry *p; 86 struct proc_dir_entry *p;
89 struct semaphore access; 87 struct semaphore access;
90}; 88};
91 89
92extern int snd_info_check_reserved_words(const char *str);
93
94#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) 90#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
95extern int snd_info_minor_register(void); 91int snd_info_minor_register(void);
96extern int snd_info_minor_unregister(void); 92int snd_info_minor_unregister(void);
97#else 93#else
98#define snd_info_minor_register() /* NOP */ 94#define snd_info_minor_register() /* NOP */
99#define snd_info_minor_unregister() /* NOP */ 95#define snd_info_minor_unregister() /* NOP */
@@ -102,72 +98,79 @@ extern int snd_info_minor_unregister(void);
102 98
103#ifdef CONFIG_PROC_FS 99#ifdef CONFIG_PROC_FS
104 100
105extern snd_info_entry_t *snd_seq_root; 101extern struct snd_info_entry *snd_seq_root;
106#ifdef CONFIG_SND_OSSEMUL 102#ifdef CONFIG_SND_OSSEMUL
107extern snd_info_entry_t *snd_oss_root; 103extern struct snd_info_entry *snd_oss_root;
108#else 104#else
109#define snd_oss_root NULL 105#define snd_oss_root NULL
110#endif 106#endif
111 107
112int snd_iprintf(snd_info_buffer_t * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3))); 108int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3)));
113int snd_info_init(void); 109int snd_info_init(void);
114int snd_info_done(void); 110int snd_info_done(void);
115 111
116int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len); 112int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len);
117char *snd_info_get_str(char *dest, char *src, int len); 113char *snd_info_get_str(char *dest, char *src, int len);
118snd_info_entry_t *snd_info_create_module_entry(struct module * module, 114struct snd_info_entry *snd_info_create_module_entry(struct module * module,
119 const char *name, 115 const char *name,
120 snd_info_entry_t * parent); 116 struct snd_info_entry * parent);
121snd_info_entry_t *snd_info_create_card_entry(snd_card_t * card, 117struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card,
122 const char *name, 118 const char *name,
123 snd_info_entry_t * parent); 119 struct snd_info_entry * parent);
124void snd_info_free_entry(snd_info_entry_t * entry); 120void snd_info_free_entry(struct snd_info_entry * entry);
125int snd_info_store_text(snd_info_entry_t * entry); 121int snd_info_store_text(struct snd_info_entry * entry);
126int snd_info_restore_text(snd_info_entry_t * entry); 122int snd_info_restore_text(struct snd_info_entry * entry);
127 123
128int snd_info_card_create(snd_card_t * card); 124int snd_info_card_create(struct snd_card * card);
129int snd_info_card_register(snd_card_t * card); 125int snd_info_card_register(struct snd_card * card);
130int snd_info_card_free(snd_card_t * card); 126int snd_info_card_free(struct snd_card * card);
131int snd_info_register(snd_info_entry_t * entry); 127int snd_info_register(struct snd_info_entry * entry);
132int snd_info_unregister(snd_info_entry_t * entry); 128int snd_info_unregister(struct snd_info_entry * entry);
133 129
134/* for card drivers */ 130/* for card drivers */
135int snd_card_proc_new(snd_card_t *card, const char *name, snd_info_entry_t **entryp); 131int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp);
136 132
137static inline void snd_info_set_text_ops(snd_info_entry_t *entry, 133static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
138 void *private_data, 134 void *private_data,
139 long read_size, 135 long read_size,
140 void (*read)(snd_info_entry_t *, snd_info_buffer_t *)) 136 void (*read)(struct snd_info_entry *, struct snd_info_buffer *))
141{ 137{
142 entry->private_data = private_data; 138 entry->private_data = private_data;
143 entry->c.text.read_size = read_size; 139 entry->c.text.read_size = read_size;
144 entry->c.text.read = read; 140 entry->c.text.read = read;
145} 141}
146 142
143int snd_info_check_reserved_words(const char *str);
147 144
148#else 145#else
149 146
150#define snd_seq_root NULL 147#define snd_seq_root NULL
151#define snd_oss_root NULL 148#define snd_oss_root NULL
152 149
153static inline int snd_iprintf(snd_info_buffer_t * buffer, char *fmt,...) { return 0; } 150static inline int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) { return 0; }
154static inline int snd_info_init(void) { return 0; } 151static inline int snd_info_init(void) { return 0; }
155static inline int snd_info_done(void) { return 0; } 152static inline int snd_info_done(void) { return 0; }
156 153
157static inline int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len) { return 0; } 154static inline int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len) { return 0; }
158static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; } 155static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; }
159static inline snd_info_entry_t *snd_info_create_module_entry(struct module * module, const char *name, snd_info_entry_t * parent) { return NULL; } 156static inline struct snd_info_entry *snd_info_create_module_entry(struct module * module, const char *name, struct snd_info_entry * parent) { return NULL; }
160static inline snd_info_entry_t *snd_info_create_card_entry(snd_card_t * card, const char *name, snd_info_entry_t * parent) { return NULL; } 157static inline struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card, const char *name, struct snd_info_entry * parent) { return NULL; }
161static inline void snd_info_free_entry(snd_info_entry_t * entry) { ; } 158static inline void snd_info_free_entry(struct snd_info_entry * entry) { ; }
162 159
163static inline int snd_info_card_create(snd_card_t * card) { return 0; } 160static inline int snd_info_card_create(struct snd_card * card) { return 0; }
164static inline int snd_info_card_register(snd_card_t * card) { return 0; } 161static inline int snd_info_card_register(struct snd_card * card) { return 0; }
165static inline int snd_info_card_free(snd_card_t * card) { return 0; } 162static inline int snd_info_card_free(struct snd_card * card) { return 0; }
166static inline int snd_info_register(snd_info_entry_t * entry) { return 0; } 163static inline int snd_info_register(struct snd_info_entry * entry) { return 0; }
167static inline int snd_info_unregister(snd_info_entry_t * entry) { return 0; } 164static inline int snd_info_unregister(struct snd_info_entry * entry) { return 0; }
165
166static inline int snd_card_proc_new(struct snd_card *card, const char *name,
167 struct snd_info_entry **entryp) { return -EINVAL; }
168static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)),
169 void *private_data,
170 long read_size,
171 void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {}
168 172
169#define snd_card_proc_new(card,name,entryp) 0 /* always success */ 173static inline int snd_info_check_reserved_words(const char *str) { return 1; }
170#define snd_info_set_text_ops(entry,private_data,read_size,read) /*NOP*/
171 174
172#endif 175#endif
173 176
@@ -185,7 +188,7 @@ static inline int snd_info_unregister(snd_info_entry_t * entry) { return 0; }
185 188
186#define SNDRV_OSS_INFO_DEV_COUNT 6 189#define SNDRV_OSS_INFO_DEV_COUNT 6
187 190
188extern int snd_oss_info_register(int dev, int num, char *string); 191int snd_oss_info_register(int dev, int num, char *string);
189#define snd_oss_info_unregister(dev, num) snd_oss_info_register(dev, num, NULL) 192#define snd_oss_info_unregister(dev, num) snd_oss_info_register(dev, num, NULL)
190 193
191#endif /* CONFIG_SND_OSSEMUL && CONFIG_PROC_FS */ 194#endif /* CONFIG_SND_OSSEMUL && CONFIG_PROC_FS */
diff --git a/include/sound/initval.h b/include/sound/initval.h
index 2bf1508825a4..d29e3d31d149 100644
--- a/include/sound/initval.h
+++ b/include/sound/initval.h
@@ -50,20 +50,6 @@
50#define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE } 50#define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
51#define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR 51#define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR
52 52
53#ifdef SNDRV_LEGACY_AUTO_PROBE
54static int snd_legacy_auto_probe(unsigned long *ports, int (*probe)(unsigned long port))
55{
56 int result = 0; /* number of detected cards */
57
58 while ((signed long)*ports != -1) {
59 if (probe(*ports) >= 0)
60 result++;
61 ports++;
62 }
63 return result;
64}
65#endif
66
67#ifdef SNDRV_LEGACY_FIND_FREE_IRQ 53#ifdef SNDRV_LEGACY_FIND_FREE_IRQ
68#include <linux/interrupt.h> 54#include <linux/interrupt.h>
69 55
diff --git a/include/sound/minors.h b/include/sound/minors.h
index a17b5c9961bb..46bcd2023ed8 100644
--- a/include/sound/minors.h
+++ b/include/sound/minors.h
@@ -26,18 +26,20 @@
26#define SNDRV_MINOR_DEVICE(minor) ((minor) & 0x001f) 26#define SNDRV_MINOR_DEVICE(minor) ((minor) & 0x001f)
27#define SNDRV_MINOR(card, dev) (((card) << 5) | (dev)) 27#define SNDRV_MINOR(card, dev) (((card) << 5) | (dev))
28 28
29#define SNDRV_MINOR_CONTROL 0 /* 0 - 0 */ 29/* these minors can still be used for autoloading devices (/dev/aload*) */
30#define SNDRV_MINOR_CONTROL 0 /* 0 */
30#define SNDRV_MINOR_GLOBAL 1 /* 1 */ 31#define SNDRV_MINOR_GLOBAL 1 /* 1 */
31#define SNDRV_MINOR_SEQUENCER (SNDRV_MINOR_GLOBAL + 0 * 32) 32#define SNDRV_MINOR_SEQUENCER (SNDRV_MINOR_GLOBAL + 0 * 32)
32#define SNDRV_MINOR_TIMER (SNDRV_MINOR_GLOBAL + 1 * 32) 33#define SNDRV_MINOR_TIMER (SNDRV_MINOR_GLOBAL + 1 * 32)
34
35#ifndef CONFIG_SND_DYNAMIC_MINORS
36 /* 2 - 3 (reserved) */
33#define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */ 37#define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */
34#define SNDRV_MINOR_HWDEPS 4
35#define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */ 38#define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */
36#define SNDRV_MINOR_RAWMIDIS 8
37#define SNDRV_MINOR_PCM_PLAYBACK 16 /* 16 - 23 */ 39#define SNDRV_MINOR_PCM_PLAYBACK 16 /* 16 - 23 */
38#define SNDRV_MINOR_PCM_CAPTURE 24 /* 24 - 31 */ 40#define SNDRV_MINOR_PCM_CAPTURE 24 /* 24 - 31 */
39#define SNDRV_MINOR_PCMS 8
40 41
42/* same as first respective minor number to make minor allocation easier */
41#define SNDRV_DEVICE_TYPE_CONTROL SNDRV_MINOR_CONTROL 43#define SNDRV_DEVICE_TYPE_CONTROL SNDRV_MINOR_CONTROL
42#define SNDRV_DEVICE_TYPE_HWDEP SNDRV_MINOR_HWDEP 44#define SNDRV_DEVICE_TYPE_HWDEP SNDRV_MINOR_HWDEP
43#define SNDRV_DEVICE_TYPE_RAWMIDI SNDRV_MINOR_RAWMIDI 45#define SNDRV_DEVICE_TYPE_RAWMIDI SNDRV_MINOR_RAWMIDI
@@ -46,6 +48,25 @@
46#define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER 48#define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER
47#define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER 49#define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER
48 50
51#else /* CONFIG_SND_DYNAMIC_MINORS */
52
53enum {
54 SNDRV_DEVICE_TYPE_CONTROL,
55 SNDRV_DEVICE_TYPE_SEQUENCER,
56 SNDRV_DEVICE_TYPE_TIMER,
57 SNDRV_DEVICE_TYPE_HWDEP,
58 SNDRV_DEVICE_TYPE_RAWMIDI,
59 SNDRV_DEVICE_TYPE_PCM_PLAYBACK,
60 SNDRV_DEVICE_TYPE_PCM_CAPTURE,
61};
62
63#endif /* CONFIG_SND_DYNAMIC_MINORS */
64
65#define SNDRV_MINOR_HWDEPS 4
66#define SNDRV_MINOR_RAWMIDIS 8
67#define SNDRV_MINOR_PCMS 8
68
69
49#ifdef CONFIG_SND_OSSEMUL 70#ifdef CONFIG_SND_OSSEMUL
50 71
51#define SNDRV_MINOR_OSS_DEVICES 16 72#define SNDRV_MINOR_OSS_DEVICES 16
diff --git a/include/sound/mixer_oss.h b/include/sound/mixer_oss.h
index ed75b2fb00ab..ca5b4822b62c 100644
--- a/include/sound/mixer_oss.h
+++ b/include/sound/mixer_oss.h
@@ -24,51 +24,53 @@
24 24
25#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 25#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
26 26
27typedef struct _snd_oss_mixer_slot snd_mixer_oss_slot_t;
28typedef struct _snd_oss_file snd_mixer_oss_file_t;
29
30typedef int (*snd_mixer_oss_get_volume_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int *left, int *right);
31typedef int (*snd_mixer_oss_put_volume_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int left, int right);
32typedef int (*snd_mixer_oss_get_recsrc_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int *active);
33typedef int (*snd_mixer_oss_put_recsrc_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int active);
34typedef int (*snd_mixer_oss_get_recsrce_t)(snd_mixer_oss_file_t *fmixer, unsigned int *active_index);
35typedef int (*snd_mixer_oss_put_recsrce_t)(snd_mixer_oss_file_t *fmixer, unsigned int active_index);
36
37#define SNDRV_OSS_MAX_MIXERS 32 27#define SNDRV_OSS_MAX_MIXERS 32
38 28
39struct _snd_oss_mixer_slot { 29struct snd_mixer_oss_file;
30
31struct snd_mixer_oss_slot {
40 int number; 32 int number;
41 unsigned int stereo: 1; 33 unsigned int stereo: 1;
42 snd_mixer_oss_get_volume_t get_volume; 34 int (*get_volume)(struct snd_mixer_oss_file *fmixer,
43 snd_mixer_oss_put_volume_t put_volume; 35 struct snd_mixer_oss_slot *chn,
44 snd_mixer_oss_get_recsrc_t get_recsrc; 36 int *left, int *right);
45 snd_mixer_oss_put_recsrc_t put_recsrc; 37 int (*put_volume)(struct snd_mixer_oss_file *fmixer,
38 struct snd_mixer_oss_slot *chn,
39 int left, int right);
40 int (*get_recsrc)(struct snd_mixer_oss_file *fmixer,
41 struct snd_mixer_oss_slot *chn,
42 int *active);
43 int (*put_recsrc)(struct snd_mixer_oss_file *fmixer,
44 struct snd_mixer_oss_slot *chn,
45 int active);
46 unsigned long private_value; 46 unsigned long private_value;
47 void *private_data; 47 void *private_data;
48 void (*private_free)(snd_mixer_oss_slot_t *slot); 48 void (*private_free)(struct snd_mixer_oss_slot *slot);
49 int volume[2]; 49 int volume[2];
50}; 50};
51 51
52struct _snd_oss_mixer { 52struct snd_mixer_oss {
53 snd_card_t *card; 53 struct snd_card *card;
54 char id[16]; 54 char id[16];
55 char name[32]; 55 char name[32];
56 snd_mixer_oss_slot_t slots[SNDRV_OSS_MAX_MIXERS]; /* OSS mixer slots */ 56 struct snd_mixer_oss_slot slots[SNDRV_OSS_MAX_MIXERS]; /* OSS mixer slots */
57 unsigned int mask_recsrc; /* exclusive recsrc mask */ 57 unsigned int mask_recsrc; /* exclusive recsrc mask */
58 snd_mixer_oss_get_recsrce_t get_recsrc; 58 int (*get_recsrc)(struct snd_mixer_oss_file *fmixer,
59 snd_mixer_oss_put_recsrce_t put_recsrc; 59 unsigned int *active_index);
60 int (*put_recsrc)(struct snd_mixer_oss_file *fmixer,
61 unsigned int active_index);
60 void *private_data_recsrc; 62 void *private_data_recsrc;
61 void (*private_free_recsrc)(snd_mixer_oss_t *mixer); 63 void (*private_free_recsrc)(struct snd_mixer_oss *mixer);
62 struct semaphore reg_mutex; 64 struct semaphore reg_mutex;
63 snd_info_entry_t *proc_entry; 65 struct snd_info_entry *proc_entry;
64 int oss_dev_alloc; 66 int oss_dev_alloc;
65 /* --- */ 67 /* --- */
66 int oss_recsrc; 68 int oss_recsrc;
67}; 69};
68 70
69struct _snd_oss_file { 71struct snd_mixer_oss_file {
70 snd_card_t *card; 72 struct snd_card *card;
71 snd_mixer_oss_t *mixer; 73 struct snd_mixer_oss *mixer;
72}; 74};
73 75
74#endif /* CONFIG_SND_MIXER_OSS */ 76#endif /* CONFIG_SND_MIXER_OSS */
diff --git a/include/sound/mpu401.h b/include/sound/mpu401.h
index ae39e38bf996..8e97ace78f16 100644
--- a/include/sound/mpu401.h
+++ b/include/sound/mpu401.h
@@ -58,10 +58,8 @@
58#define MPU401_MODE_INPUT_TIMER (1<<0) 58#define MPU401_MODE_INPUT_TIMER (1<<0)
59#define MPU401_MODE_OUTPUT_TIMER (1<<1) 59#define MPU401_MODE_OUTPUT_TIMER (1<<1)
60 60
61typedef struct _snd_mpu401 mpu401_t; 61struct snd_mpu401 {
62 62 struct snd_rawmidi *rmidi;
63struct _snd_mpu401 {
64 snd_rawmidi_t *rmidi;
65 63
66 unsigned short hardware; /* MPU401_HW_XXXX */ 64 unsigned short hardware; /* MPU401_HW_XXXX */
67 unsigned long port; /* base port of MPU-401 chip */ 65 unsigned long port; /* base port of MPU-401 chip */
@@ -73,14 +71,14 @@ struct _snd_mpu401 {
73 unsigned long mode; /* MPU401_MODE_XXXX */ 71 unsigned long mode; /* MPU401_MODE_XXXX */
74 int timer_invoked; 72 int timer_invoked;
75 73
76 int (*open_input) (mpu401_t * mpu); 74 int (*open_input) (struct snd_mpu401 * mpu);
77 void (*close_input) (mpu401_t * mpu); 75 void (*close_input) (struct snd_mpu401 * mpu);
78 int (*open_output) (mpu401_t * mpu); 76 int (*open_output) (struct snd_mpu401 * mpu);
79 void (*close_output) (mpu401_t * mpu); 77 void (*close_output) (struct snd_mpu401 * mpu);
80 void *private_data; 78 void *private_data;
81 79
82 snd_rawmidi_substream_t *substream_input; 80 struct snd_rawmidi_substream *substream_input;
83 snd_rawmidi_substream_t *substream_output; 81 struct snd_rawmidi_substream *substream_output;
84 82
85 spinlock_t input_lock; 83 spinlock_t input_lock;
86 spinlock_t output_lock; 84 spinlock_t output_lock;
@@ -88,8 +86,8 @@ struct _snd_mpu401 {
88 86
89 struct timer_list timer; 87 struct timer_list timer;
90 88
91 void (*write) (mpu401_t * mpu, unsigned char data, unsigned long addr); 89 void (*write) (struct snd_mpu401 * mpu, unsigned char data, unsigned long addr);
92 unsigned char (*read) (mpu401_t * mpu, unsigned long addr); 90 unsigned char (*read) (struct snd_mpu401 *mpu, unsigned long addr);
93}; 91};
94 92
95/* I/O ports */ 93/* I/O ports */
@@ -103,13 +101,13 @@ struct _snd_mpu401 {
103 101
104irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs); 102irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs);
105 103
106int snd_mpu401_uart_new(snd_card_t * card, 104int snd_mpu401_uart_new(struct snd_card *card,
107 int device, 105 int device,
108 unsigned short hardware, 106 unsigned short hardware,
109 unsigned long port, 107 unsigned long port,
110 int integrated, 108 int integrated,
111 int irq, 109 int irq,
112 int irq_flags, 110 int irq_flags,
113 snd_rawmidi_t ** rrawmidi); 111 struct snd_rawmidi ** rrawmidi);
114 112
115#endif /* __SOUND_MPU401_H */ 113#endif /* __SOUND_MPU401_H */
diff --git a/include/sound/opl3.h b/include/sound/opl3.h
index 19f657d4fc06..83392641cb47 100644
--- a/include/sound/opl3.h
+++ b/include/sound/opl3.h
@@ -237,12 +237,12 @@
237#define MAX_OPL2_VOICES 9 237#define MAX_OPL2_VOICES 9
238#define MAX_OPL3_VOICES 18 238#define MAX_OPL3_VOICES 18
239 239
240typedef struct snd_opl3 opl3_t; 240struct snd_opl3;
241 241
242/* 242/*
243 * A structure to keep track of each hardware voice 243 * A structure to keep track of each hardware voice
244 */ 244 */
245typedef struct snd_opl3_voice { 245struct snd_opl3_voice {
246 int state; /* status */ 246 int state; /* status */
247#define SNDRV_OPL3_ST_OFF 0 /* Not playing */ 247#define SNDRV_OPL3_ST_OFF 0 /* Not playing */
248#define SNDRV_OPL3_ST_ON_2OP 1 /* 2op voice is allocated */ 248#define SNDRV_OPL3_ST_ON_2OP 1 /* 2op voice is allocated */
@@ -257,8 +257,8 @@ typedef struct snd_opl3_voice {
257 257
258 unsigned char keyon_reg; /* KON register shadow */ 258 unsigned char keyon_reg; /* KON register shadow */
259 259
260 snd_midi_channel_t *chan; /* Midi channel for this note */ 260 struct snd_midi_channel *chan; /* Midi channel for this note */
261} snd_opl3_voice_t; 261};
262 262
263struct snd_opl3 { 263struct snd_opl3 {
264 unsigned long l_port; 264 unsigned long l_port;
@@ -267,18 +267,18 @@ struct snd_opl3 {
267 struct resource *res_r_port; 267 struct resource *res_r_port;
268 unsigned short hardware; 268 unsigned short hardware;
269 /* hardware access */ 269 /* hardware access */
270 void (*command) (opl3_t * opl3, unsigned short cmd, unsigned char val); 270 void (*command) (struct snd_opl3 * opl3, unsigned short cmd, unsigned char val);
271 unsigned short timer_enable; 271 unsigned short timer_enable;
272 int seq_dev_num; /* sequencer device number */ 272 int seq_dev_num; /* sequencer device number */
273 snd_timer_t *timer1; 273 struct snd_timer *timer1;
274 snd_timer_t *timer2; 274 struct snd_timer *timer2;
275 spinlock_t timer_lock; 275 spinlock_t timer_lock;
276 276
277 void *private_data; 277 void *private_data;
278 void (*private_free)(opl3_t *); 278 void (*private_free)(struct snd_opl3 *);
279 279
280 spinlock_t reg_lock; 280 spinlock_t reg_lock;
281 snd_card_t *card; /* The card that this belongs to */ 281 struct snd_card *card; /* The card that this belongs to */
282 int used; /* usage flag - exclusive */ 282 int used; /* usage flag - exclusive */
283 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ 283 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
284 unsigned char rhythm; /* percussion mode flag */ 284 unsigned char rhythm; /* percussion mode flag */
@@ -289,18 +289,18 @@ struct snd_opl3 {
289 int synth_mode; /* synth mode */ 289 int synth_mode; /* synth mode */
290 int seq_client; 290 int seq_client;
291 291
292 snd_seq_device_t *seq_dev; /* sequencer device */ 292 struct snd_seq_device *seq_dev; /* sequencer device */
293 snd_midi_channel_set_t * chset; 293 struct snd_midi_channel_set * chset;
294 294
295#ifdef CONFIG_SND_SEQUENCER_OSS 295#ifdef CONFIG_SND_SEQUENCER_OSS
296 snd_seq_device_t *oss_seq_dev; /* OSS sequencer device */ 296 struct snd_seq_device *oss_seq_dev; /* OSS sequencer device */
297 snd_midi_channel_set_t * oss_chset; 297 struct snd_midi_channel_set * oss_chset;
298#endif 298#endif
299 299
300 snd_seq_kinstr_ops_t fm_ops; 300 struct snd_seq_kinstr_ops fm_ops;
301 snd_seq_kinstr_list_t *ilist; 301 struct snd_seq_kinstr_list *ilist;
302 302
303 snd_opl3_voice_t voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */ 303 struct snd_opl3_voice voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */
304 int use_time; /* allocation counter */ 304 int use_time; /* allocation counter */
305 305
306 unsigned short connection_reg; /* connection reg shadow */ 306 unsigned short connection_reg; /* connection reg shadow */
@@ -316,24 +316,25 @@ struct snd_opl3 {
316}; 316};
317 317
318/* opl3.c */ 318/* opl3.c */
319void snd_opl3_interrupt(snd_hwdep_t * hw); 319void snd_opl3_interrupt(struct snd_hwdep * hw);
320int snd_opl3_new(snd_card_t *card, unsigned short hardware, opl3_t **ropl3); 320int snd_opl3_new(struct snd_card *card, unsigned short hardware,
321int snd_opl3_init(opl3_t *opl3); 321 struct snd_opl3 **ropl3);
322int snd_opl3_create(snd_card_t * card, 322int snd_opl3_init(struct snd_opl3 *opl3);
323int snd_opl3_create(struct snd_card *card,
323 unsigned long l_port, unsigned long r_port, 324 unsigned long l_port, unsigned long r_port,
324 unsigned short hardware, 325 unsigned short hardware,
325 int integrated, 326 int integrated,
326 opl3_t ** opl3); 327 struct snd_opl3 ** opl3);
327int snd_opl3_timer_new(opl3_t * opl3, int timer1_dev, int timer2_dev); 328int snd_opl3_timer_new(struct snd_opl3 * opl3, int timer1_dev, int timer2_dev);
328int snd_opl3_hwdep_new(opl3_t * opl3, int device, int seq_device, 329int snd_opl3_hwdep_new(struct snd_opl3 * opl3, int device, int seq_device,
329 snd_hwdep_t ** rhwdep); 330 struct snd_hwdep ** rhwdep);
330 331
331/* opl3_synth */ 332/* opl3_synth */
332int snd_opl3_open(snd_hwdep_t * hw, struct file *file); 333int snd_opl3_open(struct snd_hwdep * hw, struct file *file);
333int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, 334int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file,
334 unsigned int cmd, unsigned long arg); 335 unsigned int cmd, unsigned long arg);
335int snd_opl3_release(snd_hwdep_t * hw, struct file *file); 336int snd_opl3_release(struct snd_hwdep * hw, struct file *file);
336 337
337void snd_opl3_reset(opl3_t * opl3); 338void snd_opl3_reset(struct snd_opl3 * opl3);
338 339
339#endif /* __SOUND_OPL3_H */ 340#endif /* __SOUND_OPL3_H */
diff --git a/include/sound/opl4.h b/include/sound/opl4.h
index 20c04428b139..60ae8454b3ce 100644
--- a/include/sound/opl4.h
+++ b/include/sound/opl4.h
@@ -22,11 +22,11 @@
22 22
23#include <sound/opl3.h> 23#include <sound/opl3.h>
24 24
25typedef struct opl4 opl4_t; 25struct snd_opl4;
26 26
27extern int snd_opl4_create(snd_card_t *card, 27extern int snd_opl4_create(struct snd_card *card,
28 unsigned long fm_port, unsigned long pcm_port, 28 unsigned long fm_port, unsigned long pcm_port,
29 int seq_device, 29 int seq_device,
30 opl3_t **opl3, opl4_t **opl4); 30 struct snd_opl3 **opl3, struct snd_opl4 **opl4);
31 31
32#endif /* __SOUND_OPL4_H */ 32#endif /* __SOUND_OPL4_H */
diff --git a/include/sound/pcm-indirect.h b/include/sound/pcm-indirect.h
index 31fa7a54508a..7003d7702e26 100644
--- a/include/sound/pcm-indirect.h
+++ b/include/sound/pcm-indirect.h
@@ -24,7 +24,7 @@
24 24
25#include <sound/pcm.h> 25#include <sound/pcm.h>
26 26
27typedef struct sndrv_pcm_indirect { 27struct snd_pcm_indirect {
28 unsigned int hw_buffer_size; /* Byte size of hardware buffer */ 28 unsigned int hw_buffer_size; /* Byte size of hardware buffer */
29 unsigned int hw_queue_size; /* Max queue size of hw buffer (0 = buffer size) */ 29 unsigned int hw_queue_size; /* Max queue size of hw buffer (0 = buffer size) */
30 unsigned int hw_data; /* Offset to next dst (or src) in hw ring buffer */ 30 unsigned int hw_data; /* Offset to next dst (or src) in hw ring buffer */
@@ -35,20 +35,20 @@ typedef struct sndrv_pcm_indirect {
35 unsigned int sw_io; /* Current software pointer in bytes */ 35 unsigned int sw_io; /* Current software pointer in bytes */
36 int sw_ready; /* Bytes ready to be transferred to/from hw */ 36 int sw_ready; /* Bytes ready to be transferred to/from hw */
37 snd_pcm_uframes_t appl_ptr; /* Last seen appl_ptr */ 37 snd_pcm_uframes_t appl_ptr; /* Last seen appl_ptr */
38} snd_pcm_indirect_t; 38};
39 39
40typedef void (*snd_pcm_indirect_copy_t)(snd_pcm_substream_t *substream, 40typedef void (*snd_pcm_indirect_copy_t)(struct snd_pcm_substream *substream,
41 snd_pcm_indirect_t *rec, size_t bytes); 41 struct snd_pcm_indirect *rec, size_t bytes);
42 42
43/* 43/*
44 * helper function for playback ack callback 44 * helper function for playback ack callback
45 */ 45 */
46static inline void 46static inline void
47snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream, 47snd_pcm_indirect_playback_transfer(struct snd_pcm_substream *substream,
48 snd_pcm_indirect_t *rec, 48 struct snd_pcm_indirect *rec,
49 snd_pcm_indirect_copy_t copy) 49 snd_pcm_indirect_copy_t copy)
50{ 50{
51 snd_pcm_runtime_t *runtime = substream->runtime; 51 struct snd_pcm_runtime *runtime = substream->runtime;
52 snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr; 52 snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
53 snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr; 53 snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
54 int qsize; 54 int qsize;
@@ -89,8 +89,8 @@ snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream,
89 * ptr = current byte pointer 89 * ptr = current byte pointer
90 */ 90 */
91static inline snd_pcm_uframes_t 91static inline snd_pcm_uframes_t
92snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream, 92snd_pcm_indirect_playback_pointer(struct snd_pcm_substream *substream,
93 snd_pcm_indirect_t *rec, unsigned int ptr) 93 struct snd_pcm_indirect *rec, unsigned int ptr)
94{ 94{
95 int bytes = ptr - rec->hw_io; 95 int bytes = ptr - rec->hw_io;
96 if (bytes < 0) 96 if (bytes < 0)
@@ -110,11 +110,11 @@ snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream,
110 * helper function for capture ack callback 110 * helper function for capture ack callback
111 */ 111 */
112static inline void 112static inline void
113snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream, 113snd_pcm_indirect_capture_transfer(struct snd_pcm_substream *substream,
114 snd_pcm_indirect_t *rec, 114 struct snd_pcm_indirect *rec,
115 snd_pcm_indirect_copy_t copy) 115 snd_pcm_indirect_copy_t copy)
116{ 116{
117 snd_pcm_runtime_t *runtime = substream->runtime; 117 struct snd_pcm_runtime *runtime = substream->runtime;
118 snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr; 118 snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
119 snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr; 119 snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
120 120
@@ -154,8 +154,8 @@ snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream,
154 * ptr = current byte pointer 154 * ptr = current byte pointer
155 */ 155 */
156static inline snd_pcm_uframes_t 156static inline snd_pcm_uframes_t
157snd_pcm_indirect_capture_pointer(snd_pcm_substream_t *substream, 157snd_pcm_indirect_capture_pointer(struct snd_pcm_substream *substream,
158 snd_pcm_indirect_t *rec, unsigned int ptr) 158 struct snd_pcm_indirect *rec, unsigned int ptr)
159{ 159{
160 int qsize; 160 int qsize;
161 int bytes = ptr - rec->hw_io; 161 int bytes = ptr - rec->hw_io;
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index acc4fa9d5abe..314268a11048 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -28,36 +28,9 @@
28#include <linux/poll.h> 28#include <linux/poll.h>
29#include <linux/bitops.h> 29#include <linux/bitops.h>
30 30
31typedef sndrv_pcm_uframes_t snd_pcm_uframes_t;
32typedef sndrv_pcm_sframes_t snd_pcm_sframes_t;
33typedef enum sndrv_pcm_class snd_pcm_class_t;
34typedef enum sndrv_pcm_subclass snd_pcm_subclass_t;
35typedef enum sndrv_pcm_stream snd_pcm_stream_t;
36typedef enum sndrv_pcm_access snd_pcm_access_t;
37typedef enum sndrv_pcm_format snd_pcm_format_t;
38typedef enum sndrv_pcm_subformat snd_pcm_subformat_t;
39typedef enum sndrv_pcm_state snd_pcm_state_t;
40typedef union sndrv_pcm_sync_id snd_pcm_sync_id_t;
41typedef struct sndrv_pcm_info snd_pcm_info_t;
42typedef enum sndrv_pcm_hw_param snd_pcm_hw_param_t;
43typedef struct sndrv_pcm_hw_params snd_pcm_hw_params_t;
44typedef enum sndrv_pcm_start snd_pcm_start_t;
45typedef enum sndrv_pcm_xrun snd_pcm_xrun_t;
46typedef enum sndrv_pcm_tstamp snd_pcm_tstamp_t;
47typedef struct sndrv_pcm_sw_params snd_pcm_sw_params_t;
48typedef struct sndrv_pcm_channel_info snd_pcm_channel_info_t;
49typedef struct sndrv_pcm_status snd_pcm_status_t;
50typedef struct sndrv_pcm_mmap_status snd_pcm_mmap_status_t;
51typedef struct sndrv_pcm_mmap_control snd_pcm_mmap_control_t;
52typedef struct sndrv_mask snd_mask_t;
53typedef struct snd_sg_buf snd_pcm_sgbuf_t;
54
55#define snd_pcm_substream_chip(substream) ((substream)->private_data) 31#define snd_pcm_substream_chip(substream) ((substream)->private_data)
56#define snd_pcm_chip(pcm) ((pcm)->private_data) 32#define snd_pcm_chip(pcm) ((pcm)->private_data)
57 33
58typedef struct _snd_pcm_file snd_pcm_file_t;
59typedef struct _snd_pcm_runtime snd_pcm_runtime_t;
60
61#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 34#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
62#include "pcm_oss.h" 35#include "pcm_oss.h"
63#endif 36#endif
@@ -66,7 +39,7 @@ typedef struct _snd_pcm_runtime snd_pcm_runtime_t;
66 * Hardware (lowlevel) section 39 * Hardware (lowlevel) section
67 */ 40 */
68 41
69typedef struct _snd_pcm_hardware { 42struct snd_pcm_hardware {
70 unsigned int info; /* SNDRV_PCM_INFO_* */ 43 unsigned int info; /* SNDRV_PCM_INFO_* */
71 u64 formats; /* SNDRV_PCM_FMTBIT_* */ 44 u64 formats; /* SNDRV_PCM_FMTBIT_* */
72 unsigned int rates; /* SNDRV_PCM_RATE_* */ 45 unsigned int rates; /* SNDRV_PCM_RATE_* */
@@ -80,26 +53,29 @@ typedef struct _snd_pcm_hardware {
80 unsigned int periods_min; /* min # of periods */ 53 unsigned int periods_min; /* min # of periods */
81 unsigned int periods_max; /* max # of periods */ 54 unsigned int periods_max; /* max # of periods */
82 size_t fifo_size; /* fifo size in bytes */ 55 size_t fifo_size; /* fifo size in bytes */
83} snd_pcm_hardware_t; 56};
84 57
85typedef struct _snd_pcm_ops { 58struct snd_pcm_ops {
86 int (*open)(snd_pcm_substream_t *substream); 59 int (*open)(struct snd_pcm_substream *substream);
87 int (*close)(snd_pcm_substream_t *substream); 60 int (*close)(struct snd_pcm_substream *substream);
88 int (*ioctl)(snd_pcm_substream_t * substream, 61 int (*ioctl)(struct snd_pcm_substream * substream,
89 unsigned int cmd, void *arg); 62 unsigned int cmd, void *arg);
90 int (*hw_params)(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * params); 63 int (*hw_params)(struct snd_pcm_substream *substream,
91 int (*hw_free)(snd_pcm_substream_t *substream); 64 struct snd_pcm_hw_params *params);
92 int (*prepare)(snd_pcm_substream_t * substream); 65 int (*hw_free)(struct snd_pcm_substream *substream);
93 int (*trigger)(snd_pcm_substream_t * substream, int cmd); 66 int (*prepare)(struct snd_pcm_substream *substream);
94 snd_pcm_uframes_t (*pointer)(snd_pcm_substream_t * substream); 67 int (*trigger)(struct snd_pcm_substream *substream, int cmd);
95 int (*copy)(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos, 68 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
69 int (*copy)(struct snd_pcm_substream *substream, int channel,
70 snd_pcm_uframes_t pos,
96 void __user *buf, snd_pcm_uframes_t count); 71 void __user *buf, snd_pcm_uframes_t count);
97 int (*silence)(snd_pcm_substream_t *substream, int channel, 72 int (*silence)(struct snd_pcm_substream *substream, int channel,
98 snd_pcm_uframes_t pos, snd_pcm_uframes_t count); 73 snd_pcm_uframes_t pos, snd_pcm_uframes_t count);
99 struct page *(*page)(snd_pcm_substream_t *substream, unsigned long offset); 74 struct page *(*page)(struct snd_pcm_substream *substream,
100 int (*mmap)(snd_pcm_substream_t *substream, struct vm_area_struct *vma); 75 unsigned long offset);
101 int (*ack)(snd_pcm_substream_t *substream); 76 int (*mmap)(struct snd_pcm_substream *substream, struct vm_area_struct *vma);
102} snd_pcm_ops_t; 77 int (*ack)(struct snd_pcm_substream *substream);
78};
103 79
104/* 80/*
105 * 81 *
@@ -212,17 +188,16 @@ typedef struct _snd_pcm_ops {
212#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE 188#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE
213#endif 189#endif
214 190
215struct _snd_pcm_file { 191struct snd_pcm_file {
216 snd_pcm_substream_t * substream; 192 struct snd_pcm_substream *substream;
217 struct _snd_pcm_file * next; 193 struct snd_pcm_file *next;
218}; 194};
219 195
220typedef struct _snd_pcm_hw_rule snd_pcm_hw_rule_t; 196struct snd_pcm_hw_rule;
197typedef int (*snd_pcm_hw_rule_func_t)(struct snd_pcm_hw_params *params,
198 struct snd_pcm_hw_rule *rule);
221 199
222typedef int (*snd_pcm_hw_rule_func_t)(snd_pcm_hw_params_t *params, 200struct snd_pcm_hw_rule {
223 snd_pcm_hw_rule_t *rule);
224
225struct _snd_pcm_hw_rule {
226 unsigned int cond; 201 unsigned int cond;
227 snd_pcm_hw_rule_func_t func; 202 snd_pcm_hw_rule_func_t func;
228 int var; 203 int var;
@@ -230,57 +205,57 @@ struct _snd_pcm_hw_rule {
230 void *private; 205 void *private;
231}; 206};
232 207
233typedef struct _snd_pcm_hw_constraints { 208struct snd_pcm_hw_constraints {
234 snd_mask_t masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 209 struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
235 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; 210 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
236 snd_interval_t intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - 211 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
237 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; 212 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
238 unsigned int rules_num; 213 unsigned int rules_num;
239 unsigned int rules_all; 214 unsigned int rules_all;
240 snd_pcm_hw_rule_t *rules; 215 struct snd_pcm_hw_rule *rules;
241} snd_pcm_hw_constraints_t; 216};
242 217
243static inline snd_mask_t *constrs_mask(snd_pcm_hw_constraints_t *constrs, 218static inline struct snd_mask *constrs_mask(struct snd_pcm_hw_constraints *constrs,
244 snd_pcm_hw_param_t var) 219 snd_pcm_hw_param_t var)
245{ 220{
246 return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; 221 return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
247} 222}
248 223
249static inline snd_interval_t *constrs_interval(snd_pcm_hw_constraints_t *constrs, 224static inline struct snd_interval *constrs_interval(struct snd_pcm_hw_constraints *constrs,
250 snd_pcm_hw_param_t var) 225 snd_pcm_hw_param_t var)
251{ 226{
252 return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; 227 return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
253} 228}
254 229
255typedef struct { 230struct snd_ratnum {
256 unsigned int num; 231 unsigned int num;
257 unsigned int den_min, den_max, den_step; 232 unsigned int den_min, den_max, den_step;
258} ratnum_t; 233};
259 234
260typedef struct { 235struct snd_ratden {
261 unsigned int num_min, num_max, num_step; 236 unsigned int num_min, num_max, num_step;
262 unsigned int den; 237 unsigned int den;
263} ratden_t; 238};
264 239
265typedef struct { 240struct snd_pcm_hw_constraint_ratnums {
266 int nrats; 241 int nrats;
267 ratnum_t *rats; 242 struct snd_ratnum *rats;
268} snd_pcm_hw_constraint_ratnums_t; 243};
269 244
270typedef struct { 245struct snd_pcm_hw_constraint_ratdens {
271 int nrats; 246 int nrats;
272 ratden_t *rats; 247 struct snd_ratden *rats;
273} snd_pcm_hw_constraint_ratdens_t; 248};
274 249
275typedef struct { 250struct snd_pcm_hw_constraint_list {
276 unsigned int count; 251 unsigned int count;
277 unsigned int *list; 252 unsigned int *list;
278 unsigned int mask; 253 unsigned int mask;
279} snd_pcm_hw_constraint_list_t; 254};
280 255
281struct _snd_pcm_runtime { 256struct snd_pcm_runtime {
282 /* -- Status -- */ 257 /* -- Status -- */
283 snd_pcm_substream_t *trigger_master; 258 struct snd_pcm_substream *trigger_master;
284 struct timespec trigger_tstamp; /* trigger timestamp */ 259 struct timespec trigger_tstamp; /* trigger timestamp */
285 int overrange; 260 int overrange;
286 snd_pcm_uframes_t avail_max; 261 snd_pcm_uframes_t avail_max;
@@ -306,7 +281,7 @@ struct _snd_pcm_runtime {
306 unsigned int rate_den; 281 unsigned int rate_den;
307 282
308 /* -- SW params -- */ 283 /* -- SW params -- */
309 snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */ 284 int tstamp_mode; /* mmap timestamp is updated */
310 unsigned int period_step; 285 unsigned int period_step;
311 unsigned int sleep_min; /* min ticks to sleep */ 286 unsigned int sleep_min; /* min ticks to sleep */
312 snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ 287 snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
@@ -320,11 +295,11 @@ struct _snd_pcm_runtime {
320 snd_pcm_uframes_t silence_start; /* starting pointer to silence area */ 295 snd_pcm_uframes_t silence_start; /* starting pointer to silence area */
321 snd_pcm_uframes_t silence_filled; /* size filled with silence */ 296 snd_pcm_uframes_t silence_filled; /* size filled with silence */
322 297
323 snd_pcm_sync_id_t sync; /* hardware synchronization ID */ 298 union snd_pcm_sync_id sync; /* hardware synchronization ID */
324 299
325 /* -- mmap -- */ 300 /* -- mmap -- */
326 volatile snd_pcm_mmap_status_t *status; 301 volatile struct snd_pcm_mmap_status *status;
327 volatile snd_pcm_mmap_control_t *control; 302 volatile struct snd_pcm_mmap_control *control;
328 atomic_t mmap_count; 303 atomic_t mmap_count;
329 304
330 /* -- locking / scheduling -- */ 305 /* -- locking / scheduling -- */
@@ -334,15 +309,15 @@ struct _snd_pcm_runtime {
334 309
335 /* -- private section -- */ 310 /* -- private section -- */
336 void *private_data; 311 void *private_data;
337 void (*private_free)(snd_pcm_runtime_t *runtime); 312 void (*private_free)(struct snd_pcm_runtime *runtime);
338 313
339 /* -- hardware description -- */ 314 /* -- hardware description -- */
340 snd_pcm_hardware_t hw; 315 struct snd_pcm_hardware hw;
341 snd_pcm_hw_constraints_t hw_constraints; 316 struct snd_pcm_hw_constraints hw_constraints;
342 317
343 /* -- interrupt callbacks -- */ 318 /* -- interrupt callbacks -- */
344 void (*transfer_ack_begin)(snd_pcm_substream_t *substream); 319 void (*transfer_ack_begin)(struct snd_pcm_substream *substream);
345 void (*transfer_ack_end)(snd_pcm_substream_t *substream); 320 void (*transfer_ack_end)(struct snd_pcm_substream *substream);
346 321
347 /* -- timer -- */ 322 /* -- timer -- */
348 unsigned int timer_resolution; /* timer resolution */ 323 unsigned int timer_resolution; /* timer resolution */
@@ -356,19 +331,19 @@ struct _snd_pcm_runtime {
356 331
357#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 332#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
358 /* -- OSS things -- */ 333 /* -- OSS things -- */
359 snd_pcm_oss_runtime_t oss; 334 struct snd_pcm_oss_runtime oss;
360#endif 335#endif
361}; 336};
362 337
363typedef struct _snd_pcm_group { /* keep linked substreams */ 338struct snd_pcm_group { /* keep linked substreams */
364 spinlock_t lock; 339 spinlock_t lock;
365 struct list_head substreams; 340 struct list_head substreams;
366 int count; 341 int count;
367} snd_pcm_group_t; 342};
368 343
369struct _snd_pcm_substream { 344struct snd_pcm_substream {
370 snd_pcm_t *pcm; 345 struct snd_pcm *pcm;
371 snd_pcm_str_t *pstr; 346 struct snd_pcm_str *pstr;
372 void *private_data; /* copied from pcm->private_data */ 347 void *private_data; /* copied from pcm->private_data */
373 int number; 348 int number;
374 char name[32]; /* substream name */ 349 char name[32]; /* substream name */
@@ -378,32 +353,32 @@ struct _snd_pcm_substream {
378 unsigned int dma_buf_id; 353 unsigned int dma_buf_id;
379 size_t dma_max; 354 size_t dma_max;
380 /* -- hardware operations -- */ 355 /* -- hardware operations -- */
381 snd_pcm_ops_t *ops; 356 struct snd_pcm_ops *ops;
382 /* -- runtime information -- */ 357 /* -- runtime information -- */
383 snd_pcm_runtime_t *runtime; 358 struct snd_pcm_runtime *runtime;
384 /* -- timer section -- */ 359 /* -- timer section -- */
385 snd_timer_t *timer; /* timer */ 360 struct snd_timer *timer; /* timer */
386 unsigned timer_running: 1; /* time is running */ 361 unsigned timer_running: 1; /* time is running */
387 spinlock_t timer_lock; 362 spinlock_t timer_lock;
388 /* -- next substream -- */ 363 /* -- next substream -- */
389 snd_pcm_substream_t *next; 364 struct snd_pcm_substream *next;
390 /* -- linked substreams -- */ 365 /* -- linked substreams -- */
391 struct list_head link_list; /* linked list member */ 366 struct list_head link_list; /* linked list member */
392 snd_pcm_group_t self_group; /* fake group for non linked substream (with substream lock inside) */ 367 struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */
393 snd_pcm_group_t *group; /* pointer to current group */ 368 struct snd_pcm_group *group; /* pointer to current group */
394 /* -- assigned files -- */ 369 /* -- assigned files -- */
395 snd_pcm_file_t *file; 370 struct snd_pcm_file *file;
396 struct file *ffile; 371 struct file *ffile;
397#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 372#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
398 /* -- OSS things -- */ 373 /* -- OSS things -- */
399 snd_pcm_oss_substream_t oss; 374 struct snd_pcm_oss_substream oss;
400#endif 375#endif
401 snd_info_entry_t *proc_root; 376 struct snd_info_entry *proc_root;
402 snd_info_entry_t *proc_info_entry; 377 struct snd_info_entry *proc_info_entry;
403 snd_info_entry_t *proc_hw_params_entry; 378 struct snd_info_entry *proc_hw_params_entry;
404 snd_info_entry_t *proc_sw_params_entry; 379 struct snd_info_entry *proc_sw_params_entry;
405 snd_info_entry_t *proc_status_entry; 380 struct snd_info_entry *proc_status_entry;
406 snd_info_entry_t *proc_prealloc_entry; 381 struct snd_info_entry *proc_prealloc_entry;
407 /* misc flags */ 382 /* misc flags */
408 unsigned int no_mmap_ctrl: 1; 383 unsigned int no_mmap_ctrl: 1;
409}; 384};
@@ -415,65 +390,64 @@ struct _snd_pcm_substream {
415#endif 390#endif
416 391
417 392
418struct _snd_pcm_str { 393struct snd_pcm_str {
419 int stream; /* stream (direction) */ 394 int stream; /* stream (direction) */
420 snd_pcm_t *pcm; 395 struct snd_pcm *pcm;
421 /* -- substreams -- */ 396 /* -- substreams -- */
422 unsigned int substream_count; 397 unsigned int substream_count;
423 unsigned int substream_opened; 398 unsigned int substream_opened;
424 snd_pcm_substream_t *substream; 399 struct snd_pcm_substream *substream;
425#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 400#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
426 /* -- OSS things -- */ 401 /* -- OSS things -- */
427 snd_pcm_oss_stream_t oss; 402 struct snd_pcm_oss_stream oss;
428#endif 403#endif
429 snd_pcm_file_t *files; 404 struct snd_pcm_file *files;
430 snd_minor_t *reg; 405 struct snd_info_entry *proc_root;
431 snd_info_entry_t *proc_root; 406 struct snd_info_entry *proc_info_entry;
432 snd_info_entry_t *proc_info_entry;
433#ifdef CONFIG_SND_DEBUG 407#ifdef CONFIG_SND_DEBUG
434 unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */ 408 unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */
435 snd_info_entry_t *proc_xrun_debug_entry; 409 struct snd_info_entry *proc_xrun_debug_entry;
436#endif 410#endif
437}; 411};
438 412
439struct _snd_pcm { 413struct snd_pcm {
440 snd_card_t *card; 414 struct snd_card *card;
415 struct list_head list;
441 unsigned int device; /* device number */ 416 unsigned int device; /* device number */
442 unsigned int info_flags; 417 unsigned int info_flags;
443 unsigned short dev_class; 418 unsigned short dev_class;
444 unsigned short dev_subclass; 419 unsigned short dev_subclass;
445 char id[64]; 420 char id[64];
446 char name[80]; 421 char name[80];
447 snd_pcm_str_t streams[2]; 422 struct snd_pcm_str streams[2];
448 struct semaphore open_mutex; 423 struct semaphore open_mutex;
449 wait_queue_head_t open_wait; 424 wait_queue_head_t open_wait;
450 void *private_data; 425 void *private_data;
451 void (*private_free) (snd_pcm_t *pcm); 426 void (*private_free) (struct snd_pcm *pcm);
452#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 427#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
453 snd_pcm_oss_t oss; 428 struct snd_pcm_oss oss;
454#endif 429#endif
455}; 430};
456 431
457typedef struct _snd_pcm_notify { 432struct snd_pcm_notify {
458 int (*n_register) (snd_pcm_t * pcm); 433 int (*n_register) (struct snd_pcm * pcm);
459 int (*n_disconnect) (snd_pcm_t * pcm); 434 int (*n_disconnect) (struct snd_pcm * pcm);
460 int (*n_unregister) (snd_pcm_t * pcm); 435 int (*n_unregister) (struct snd_pcm * pcm);
461 struct list_head list; 436 struct list_head list;
462} snd_pcm_notify_t; 437};
463 438
464/* 439/*
465 * Registering 440 * Registering
466 */ 441 */
467 442
468extern snd_pcm_t *snd_pcm_devices[]; 443extern struct file_operations snd_pcm_f_ops[2];
469extern snd_minor_t snd_pcm_reg[2];
470 444
471int snd_pcm_new(snd_card_t * card, char *id, int device, 445int snd_pcm_new(struct snd_card *card, char *id, int device,
472 int playback_count, int capture_count, 446 int playback_count, int capture_count,
473 snd_pcm_t **rpcm); 447 struct snd_pcm **rpcm);
474int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count); 448int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
475 449
476int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree); 450int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree);
477 451
478/* 452/*
479 * Native I/O 453 * Native I/O
@@ -481,24 +455,26 @@ int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree);
481 455
482extern rwlock_t snd_pcm_link_rwlock; 456extern rwlock_t snd_pcm_link_rwlock;
483 457
484int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info); 458int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info);
485int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user *info); 459int snd_pcm_info_user(struct snd_pcm_substream *substream,
486int snd_pcm_status(snd_pcm_substream_t * substream, snd_pcm_status_t *status); 460 struct snd_pcm_info __user *info);
487int snd_pcm_prepare(snd_pcm_substream_t *substream); 461int snd_pcm_status(struct snd_pcm_substream *substream,
488int snd_pcm_start(snd_pcm_substream_t *substream); 462 struct snd_pcm_status *status);
489int snd_pcm_stop(snd_pcm_substream_t *substream, int status); 463int snd_pcm_prepare(struct snd_pcm_substream *substream);
490int snd_pcm_drain_done(snd_pcm_substream_t *substream); 464int snd_pcm_start(struct snd_pcm_substream *substream);
465int snd_pcm_stop(struct snd_pcm_substream *substream, int status);
466int snd_pcm_drain_done(struct snd_pcm_substream *substream);
491#ifdef CONFIG_PM 467#ifdef CONFIG_PM
492int snd_pcm_suspend(snd_pcm_substream_t *substream); 468int snd_pcm_suspend(struct snd_pcm_substream *substream);
493int snd_pcm_suspend_all(snd_pcm_t *pcm); 469int snd_pcm_suspend_all(struct snd_pcm *pcm);
494#endif 470#endif
495int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); 471int snd_pcm_kernel_playback_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
496int snd_pcm_kernel_capture_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); 472int snd_pcm_kernel_capture_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
497int snd_pcm_kernel_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); 473int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
498int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, snd_pcm_substream_t **rsubstream); 474int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct snd_pcm_substream **rsubstream);
499void snd_pcm_release_substream(snd_pcm_substream_t *substream); 475void snd_pcm_release_substream(struct snd_pcm_substream *substream);
500void snd_pcm_vma_notify_data(void *client, void *data); 476void snd_pcm_vma_notify_data(void *client, void *data);
501int snd_pcm_mmap_data(snd_pcm_substream_t *substream, struct file *file, struct vm_area_struct *area); 477int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area);
502 478
503#if BITS_PER_LONG >= 64 479#if BITS_PER_LONG >= 64
504 480
@@ -578,30 +554,30 @@ static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
578 * PCM library 554 * PCM library
579 */ 555 */
580 556
581static inline int snd_pcm_stream_linked(snd_pcm_substream_t *substream) 557static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream)
582{ 558{
583 return substream->group != &substream->self_group; 559 return substream->group != &substream->self_group;
584} 560}
585 561
586static inline void snd_pcm_stream_lock(snd_pcm_substream_t *substream) 562static inline void snd_pcm_stream_lock(struct snd_pcm_substream *substream)
587{ 563{
588 read_lock(&snd_pcm_link_rwlock); 564 read_lock(&snd_pcm_link_rwlock);
589 spin_lock(&substream->self_group.lock); 565 spin_lock(&substream->self_group.lock);
590} 566}
591 567
592static inline void snd_pcm_stream_unlock(snd_pcm_substream_t *substream) 568static inline void snd_pcm_stream_unlock(struct snd_pcm_substream *substream)
593{ 569{
594 spin_unlock(&substream->self_group.lock); 570 spin_unlock(&substream->self_group.lock);
595 read_unlock(&snd_pcm_link_rwlock); 571 read_unlock(&snd_pcm_link_rwlock);
596} 572}
597 573
598static inline void snd_pcm_stream_lock_irq(snd_pcm_substream_t *substream) 574static inline void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream)
599{ 575{
600 read_lock_irq(&snd_pcm_link_rwlock); 576 read_lock_irq(&snd_pcm_link_rwlock);
601 spin_lock(&substream->self_group.lock); 577 spin_lock(&substream->self_group.lock);
602} 578}
603 579
604static inline void snd_pcm_stream_unlock_irq(snd_pcm_substream_t *substream) 580static inline void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream)
605{ 581{
606 spin_unlock(&substream->self_group.lock); 582 spin_unlock(&substream->self_group.lock);
607 read_unlock_irq(&snd_pcm_link_rwlock); 583 read_unlock_irq(&snd_pcm_link_rwlock);
@@ -623,56 +599,56 @@ do { \
623 list_for_each(pos, &substream->group->substreams) 599 list_for_each(pos, &substream->group->substreams)
624 600
625#define snd_pcm_group_substream_entry(pos) \ 601#define snd_pcm_group_substream_entry(pos) \
626 list_entry(pos, snd_pcm_substream_t, link_list) 602 list_entry(pos, struct snd_pcm_substream, link_list)
627 603
628static inline int snd_pcm_running(snd_pcm_substream_t *substream) 604static inline int snd_pcm_running(struct snd_pcm_substream *substream)
629{ 605{
630 return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING || 606 return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING ||
631 (substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING && 607 (substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING &&
632 substream->stream == SNDRV_PCM_STREAM_PLAYBACK)); 608 substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
633} 609}
634 610
635static inline ssize_t bytes_to_samples(snd_pcm_runtime_t *runtime, ssize_t size) 611static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size)
636{ 612{
637 return size * 8 / runtime->sample_bits; 613 return size * 8 / runtime->sample_bits;
638} 614}
639 615
640static inline snd_pcm_sframes_t bytes_to_frames(snd_pcm_runtime_t *runtime, ssize_t size) 616static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size)
641{ 617{
642 return size * 8 / runtime->frame_bits; 618 return size * 8 / runtime->frame_bits;
643} 619}
644 620
645static inline ssize_t samples_to_bytes(snd_pcm_runtime_t *runtime, ssize_t size) 621static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size)
646{ 622{
647 return size * runtime->sample_bits / 8; 623 return size * runtime->sample_bits / 8;
648} 624}
649 625
650static inline ssize_t frames_to_bytes(snd_pcm_runtime_t *runtime, snd_pcm_sframes_t size) 626static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size)
651{ 627{
652 return size * runtime->frame_bits / 8; 628 return size * runtime->frame_bits / 8;
653} 629}
654 630
655static inline int frame_aligned(snd_pcm_runtime_t *runtime, ssize_t bytes) 631static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes)
656{ 632{
657 return bytes % runtime->byte_align == 0; 633 return bytes % runtime->byte_align == 0;
658} 634}
659 635
660static inline size_t snd_pcm_lib_buffer_bytes(snd_pcm_substream_t *substream) 636static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream)
661{ 637{
662 snd_pcm_runtime_t *runtime = substream->runtime; 638 struct snd_pcm_runtime *runtime = substream->runtime;
663 return frames_to_bytes(runtime, runtime->buffer_size); 639 return frames_to_bytes(runtime, runtime->buffer_size);
664} 640}
665 641
666static inline size_t snd_pcm_lib_period_bytes(snd_pcm_substream_t *substream) 642static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream)
667{ 643{
668 snd_pcm_runtime_t *runtime = substream->runtime; 644 struct snd_pcm_runtime *runtime = substream->runtime;
669 return frames_to_bytes(runtime, runtime->period_size); 645 return frames_to_bytes(runtime, runtime->period_size);
670} 646}
671 647
672/* 648/*
673 * result is: 0 ... (boundary - 1) 649 * result is: 0 ... (boundary - 1)
674 */ 650 */
675static inline snd_pcm_uframes_t snd_pcm_playback_avail(snd_pcm_runtime_t *runtime) 651static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime)
676{ 652{
677 snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr; 653 snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr;
678 if (avail < 0) 654 if (avail < 0)
@@ -685,7 +661,7 @@ static inline snd_pcm_uframes_t snd_pcm_playback_avail(snd_pcm_runtime_t *runtim
685/* 661/*
686 * result is: 0 ... (boundary - 1) 662 * result is: 0 ... (boundary - 1)
687 */ 663 */
688static inline snd_pcm_uframes_t snd_pcm_capture_avail(snd_pcm_runtime_t *runtime) 664static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime)
689{ 665{
690 snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr; 666 snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr;
691 if (avail < 0) 667 if (avail < 0)
@@ -693,12 +669,12 @@ static inline snd_pcm_uframes_t snd_pcm_capture_avail(snd_pcm_runtime_t *runtime
693 return avail; 669 return avail;
694} 670}
695 671
696static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(snd_pcm_runtime_t *runtime) 672static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime)
697{ 673{
698 return runtime->buffer_size - snd_pcm_playback_avail(runtime); 674 return runtime->buffer_size - snd_pcm_playback_avail(runtime);
699} 675}
700 676
701static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(snd_pcm_runtime_t *runtime) 677static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime)
702{ 678{
703 return runtime->buffer_size - snd_pcm_capture_avail(runtime); 679 return runtime->buffer_size - snd_pcm_capture_avail(runtime);
704} 680}
@@ -711,9 +687,9 @@ static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(snd_pcm_runtime_t *runt
711 * 687 *
712 * Returns non-zero if available, or zero if not. 688 * Returns non-zero if available, or zero if not.
713 */ 689 */
714static inline int snd_pcm_playback_ready(snd_pcm_substream_t *substream) 690static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream)
715{ 691{
716 snd_pcm_runtime_t *runtime = substream->runtime; 692 struct snd_pcm_runtime *runtime = substream->runtime;
717 return snd_pcm_playback_avail(runtime) >= runtime->control->avail_min; 693 return snd_pcm_playback_avail(runtime) >= runtime->control->avail_min;
718} 694}
719 695
@@ -725,9 +701,9 @@ static inline int snd_pcm_playback_ready(snd_pcm_substream_t *substream)
725 * 701 *
726 * Returns non-zero if available, or zero if not. 702 * Returns non-zero if available, or zero if not.
727 */ 703 */
728static inline int snd_pcm_capture_ready(snd_pcm_substream_t *substream) 704static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream)
729{ 705{
730 snd_pcm_runtime_t *runtime = substream->runtime; 706 struct snd_pcm_runtime *runtime = substream->runtime;
731 return snd_pcm_capture_avail(runtime) >= runtime->control->avail_min; 707 return snd_pcm_capture_avail(runtime) >= runtime->control->avail_min;
732} 708}
733 709
@@ -740,9 +716,9 @@ static inline int snd_pcm_capture_ready(snd_pcm_substream_t *substream)
740 * 716 *
741 * Returns non-zero if exists, or zero if not. 717 * Returns non-zero if exists, or zero if not.
742 */ 718 */
743static inline int snd_pcm_playback_data(snd_pcm_substream_t *substream) 719static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream)
744{ 720{
745 snd_pcm_runtime_t *runtime = substream->runtime; 721 struct snd_pcm_runtime *runtime = substream->runtime;
746 722
747 if (runtime->stop_threshold >= runtime->boundary) 723 if (runtime->stop_threshold >= runtime->boundary)
748 return 1; 724 return 1;
@@ -757,9 +733,9 @@ static inline int snd_pcm_playback_data(snd_pcm_substream_t *substream)
757 * 733 *
758 * Returns non-zero if empty, or zero if not. 734 * Returns non-zero if empty, or zero if not.
759 */ 735 */
760static inline int snd_pcm_playback_empty(snd_pcm_substream_t *substream) 736static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream)
761{ 737{
762 snd_pcm_runtime_t *runtime = substream->runtime; 738 struct snd_pcm_runtime *runtime = substream->runtime;
763 return snd_pcm_playback_avail(runtime) >= runtime->buffer_size; 739 return snd_pcm_playback_avail(runtime) >= runtime->buffer_size;
764} 740}
765 741
@@ -771,14 +747,14 @@ static inline int snd_pcm_playback_empty(snd_pcm_substream_t *substream)
771 * 747 *
772 * Returns non-zero if empty, or zero if not. 748 * Returns non-zero if empty, or zero if not.
773 */ 749 */
774static inline int snd_pcm_capture_empty(snd_pcm_substream_t *substream) 750static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream)
775{ 751{
776 snd_pcm_runtime_t *runtime = substream->runtime; 752 struct snd_pcm_runtime *runtime = substream->runtime;
777 return snd_pcm_capture_avail(runtime) == 0; 753 return snd_pcm_capture_avail(runtime) == 0;
778} 754}
779 755
780static inline void snd_pcm_trigger_done(snd_pcm_substream_t *substream, 756static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream,
781 snd_pcm_substream_t *master) 757 struct snd_pcm_substream *master)
782{ 758{
783 substream->runtime->trigger_master = master; 759 substream->runtime->trigger_master = master;
784} 760}
@@ -795,28 +771,28 @@ static inline int hw_is_interval(int var)
795 var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; 771 var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL;
796} 772}
797 773
798static inline snd_mask_t *hw_param_mask(snd_pcm_hw_params_t *params, 774static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params,
799 snd_pcm_hw_param_t var) 775 snd_pcm_hw_param_t var)
800{ 776{
801 return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; 777 return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
802} 778}
803 779
804static inline snd_interval_t *hw_param_interval(snd_pcm_hw_params_t *params, 780static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params,
805 snd_pcm_hw_param_t var) 781 snd_pcm_hw_param_t var)
806{ 782{
807 return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; 783 return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
808} 784}
809 785
810static inline const snd_mask_t *hw_param_mask_c(const snd_pcm_hw_params_t *params, 786static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params,
811 snd_pcm_hw_param_t var) 787 snd_pcm_hw_param_t var)
812{ 788{
813 return (const snd_mask_t *)hw_param_mask((snd_pcm_hw_params_t*) params, var); 789 return (const struct snd_mask *)hw_param_mask((struct snd_pcm_hw_params*) params, var);
814} 790}
815 791
816static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_t *params, 792static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params,
817 snd_pcm_hw_param_t var) 793 snd_pcm_hw_param_t var)
818{ 794{
819 return (const snd_interval_t *)hw_param_interval((snd_pcm_hw_params_t*) params, var); 795 return (const struct snd_interval *)hw_param_interval((struct snd_pcm_hw_params*) params, var);
820} 796}
821 797
822#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)) 798#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS))
@@ -832,66 +808,66 @@ static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_
832#define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min 808#define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min
833 809
834 810
835int snd_interval_refine(snd_interval_t *i, const snd_interval_t *v); 811int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v);
836void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); 812void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
837void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); 813void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
838void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b, 814void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b,
839 unsigned int k, snd_interval_t *c); 815 unsigned int k, struct snd_interval *c);
840void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k, 816void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
841 const snd_interval_t *b, snd_interval_t *c); 817 const struct snd_interval *b, struct snd_interval *c);
842int snd_interval_list(snd_interval_t *i, unsigned int count, unsigned int *list, unsigned int mask); 818int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask);
843int snd_interval_ratnum(snd_interval_t *i, 819int snd_interval_ratnum(struct snd_interval *i,
844 unsigned int rats_count, ratnum_t *rats, 820 unsigned int rats_count, struct snd_ratnum *rats,
845 unsigned int *nump, unsigned int *denp); 821 unsigned int *nump, unsigned int *denp);
846 822
847void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params); 823void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params);
848void _snd_pcm_hw_param_setempty(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var); 824void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var);
849int snd_pcm_hw_param_near(snd_pcm_substream_t *substream, 825int snd_pcm_hw_param_near(struct snd_pcm_substream *substream,
850 snd_pcm_hw_params_t *params, 826 struct snd_pcm_hw_params *params,
851 snd_pcm_hw_param_t var, 827 snd_pcm_hw_param_t var,
852 unsigned int val, int *dir); 828 unsigned int val, int *dir);
853int snd_pcm_hw_param_set(snd_pcm_substream_t *pcm, 829int snd_pcm_hw_param_set(struct snd_pcm_substream *pcm,
854 snd_pcm_hw_params_t *params, 830 struct snd_pcm_hw_params *params,
855 snd_pcm_hw_param_t var, 831 snd_pcm_hw_param_t var,
856 unsigned int val, int dir); 832 unsigned int val, int dir);
857int snd_pcm_hw_params_choose(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); 833int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
858 834
859int snd_pcm_hw_refine(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); 835int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
860 836
861int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream); 837int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream);
862int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream); 838int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream);
863 839
864int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 840int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
865 u_int32_t mask); 841 u_int32_t mask);
866int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 842int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
867 u_int64_t mask); 843 u_int64_t mask);
868int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 844int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
869 unsigned int min, unsigned int max); 845 unsigned int min, unsigned int max);
870int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var); 846int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var);
871int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime, 847int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime,
872 unsigned int cond, 848 unsigned int cond,
873 snd_pcm_hw_param_t var, 849 snd_pcm_hw_param_t var,
874 snd_pcm_hw_constraint_list_t *l); 850 struct snd_pcm_hw_constraint_list *l);
875int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime, 851int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime,
876 unsigned int cond, 852 unsigned int cond,
877 snd_pcm_hw_param_t var, 853 snd_pcm_hw_param_t var,
878 snd_pcm_hw_constraint_ratnums_t *r); 854 struct snd_pcm_hw_constraint_ratnums *r);
879int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime, 855int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime,
880 unsigned int cond, 856 unsigned int cond,
881 snd_pcm_hw_param_t var, 857 snd_pcm_hw_param_t var,
882 snd_pcm_hw_constraint_ratdens_t *r); 858 struct snd_pcm_hw_constraint_ratdens *r);
883int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime, 859int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime,
884 unsigned int cond, 860 unsigned int cond,
885 unsigned int width, 861 unsigned int width,
886 unsigned int msbits); 862 unsigned int msbits);
887int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime, 863int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime,
888 unsigned int cond, 864 unsigned int cond,
889 snd_pcm_hw_param_t var, 865 snd_pcm_hw_param_t var,
890 unsigned long step); 866 unsigned long step);
891int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime, 867int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime,
892 unsigned int cond, 868 unsigned int cond,
893 snd_pcm_hw_param_t var); 869 snd_pcm_hw_param_t var);
894int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, 870int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime,
895 unsigned int cond, 871 unsigned int cond,
896 int var, 872 int var,
897 snd_pcm_hw_rule_func_t func, void *private, 873 snd_pcm_hw_rule_func_t func, void *private,
@@ -925,37 +901,37 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int
925snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian); 901snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian);
926const char *snd_pcm_format_name(snd_pcm_format_t format); 902const char *snd_pcm_format_name(snd_pcm_format_t format);
927 903
928void snd_pcm_set_ops(snd_pcm_t * pcm, int direction, snd_pcm_ops_t *ops); 904void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops);
929void snd_pcm_set_sync(snd_pcm_substream_t * substream); 905void snd_pcm_set_sync(struct snd_pcm_substream *substream);
930int snd_pcm_lib_interleave_len(snd_pcm_substream_t *substream); 906int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);
931int snd_pcm_lib_ioctl(snd_pcm_substream_t *substream, 907int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
932 unsigned int cmd, void *arg); 908 unsigned int cmd, void *arg);
933int snd_pcm_update_hw_ptr(snd_pcm_substream_t *substream); 909int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);
934int snd_pcm_playback_xrun_check(snd_pcm_substream_t *substream); 910int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream);
935int snd_pcm_capture_xrun_check(snd_pcm_substream_t *substream); 911int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream);
936int snd_pcm_playback_xrun_asap(snd_pcm_substream_t *substream); 912int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream);
937int snd_pcm_capture_xrun_asap(snd_pcm_substream_t *substream); 913int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream);
938void snd_pcm_playback_silence(snd_pcm_substream_t *substream, snd_pcm_uframes_t new_hw_ptr); 914void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr);
939void snd_pcm_tick_prepare(snd_pcm_substream_t *substream); 915void snd_pcm_tick_prepare(struct snd_pcm_substream *substream);
940void snd_pcm_tick_set(snd_pcm_substream_t *substream, unsigned long ticks); 916void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks);
941void snd_pcm_tick_elapsed(snd_pcm_substream_t *substream); 917void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream);
942void snd_pcm_period_elapsed(snd_pcm_substream_t *substream); 918void snd_pcm_period_elapsed(struct snd_pcm_substream *substream);
943snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, 919snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream,
944 const void __user *buf, 920 const void __user *buf,
945 snd_pcm_uframes_t frames); 921 snd_pcm_uframes_t frames);
946snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, 922snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream,
947 void __user *buf, snd_pcm_uframes_t frames); 923 void __user *buf, snd_pcm_uframes_t frames);
948snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, 924snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream,
949 void __user **bufs, snd_pcm_uframes_t frames); 925 void __user **bufs, snd_pcm_uframes_t frames);
950snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, 926snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream,
951 void __user **bufs, snd_pcm_uframes_t frames); 927 void __user **bufs, snd_pcm_uframes_t frames);
952 928
953int snd_pcm_limit_hw_rates(snd_pcm_runtime_t *runtime); 929int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime);
954 930
955static inline void snd_pcm_set_runtime_buffer(snd_pcm_substream_t *substream, 931static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream,
956 struct snd_dma_buffer *bufp) 932 struct snd_dma_buffer *bufp)
957{ 933{
958 snd_pcm_runtime_t *runtime = substream->runtime; 934 struct snd_pcm_runtime *runtime = substream->runtime;
959 if (bufp) { 935 if (bufp) {
960 runtime->dma_buffer_p = bufp; 936 runtime->dma_buffer_p = bufp;
961 runtime->dma_area = bufp->area; 937 runtime->dma_area = bufp->area;
@@ -973,47 +949,47 @@ static inline void snd_pcm_set_runtime_buffer(snd_pcm_substream_t *substream,
973 * Timer interface 949 * Timer interface
974 */ 950 */
975 951
976void snd_pcm_timer_resolution_change(snd_pcm_substream_t *substream); 952void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
977void snd_pcm_timer_init(snd_pcm_substream_t * substream); 953void snd_pcm_timer_init(struct snd_pcm_substream *substream);
978void snd_pcm_timer_done(snd_pcm_substream_t * substream); 954void snd_pcm_timer_done(struct snd_pcm_substream *substream);
979 955
980/* 956/*
981 * Memory 957 * Memory
982 */ 958 */
983 959
984int snd_pcm_lib_preallocate_free(snd_pcm_substream_t *substream); 960int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream);
985int snd_pcm_lib_preallocate_free_for_all(snd_pcm_t *pcm); 961int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm);
986int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream, 962int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,
987 int type, struct device *data, 963 int type, struct device *data,
988 size_t size, size_t max); 964 size_t size, size_t max);
989int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm, 965int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
990 int type, void *data, 966 int type, void *data,
991 size_t size, size_t max); 967 size_t size, size_t max);
992int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size); 968int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size);
993int snd_pcm_lib_free_pages(snd_pcm_substream_t *substream); 969int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream);
994 970
995#define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data) 971#define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data)
996#define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size) 972#define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size)
997#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs) 973#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs)
998struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned long offset); 974struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset);
999 975
1000/* handle mmap counter - PCM mmap callback should handle this counter properly */ 976/* handle mmap counter - PCM mmap callback should handle this counter properly */
1001static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) 977static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
1002{ 978{
1003 snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; 979 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
1004 atomic_inc(&substream->runtime->mmap_count); 980 atomic_inc(&substream->runtime->mmap_count);
1005} 981}
1006 982
1007static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area) 983static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area)
1008{ 984{
1009 snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; 985 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
1010 atomic_dec(&substream->runtime->mmap_count); 986 atomic_dec(&substream->runtime->mmap_count);
1011} 987}
1012 988
1013/* mmap for io-memory area */ 989/* mmap for io-memory area */
1014#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA) 990#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA)
1015#define SNDRV_PCM_INFO_MMAP_IOMEM SNDRV_PCM_INFO_MMAP 991#define SNDRV_PCM_INFO_MMAP_IOMEM SNDRV_PCM_INFO_MMAP
1016int snd_pcm_lib_mmap_iomem(snd_pcm_substream_t *substream, struct vm_area_struct *area); 992int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_struct *area);
1017#else 993#else
1018#define SNDRV_PCM_INFO_MMAP_IOMEM 0 994#define SNDRV_PCM_INFO_MMAP_IOMEM 0
1019#define snd_pcm_lib_mmap_iomem NULL 995#define snd_pcm_lib_mmap_iomem NULL
diff --git a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h
index 0b67c9d105af..fddaddde47b4 100644
--- a/include/sound/pcm_oss.h
+++ b/include/sound/pcm_oss.h
@@ -22,10 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25typedef struct _snd_pcm_plugin snd_pcm_plugin_t; 25struct snd_pcm_oss_setup {
26typedef struct _snd_pcm_oss_setup snd_pcm_oss_setup_t;
27
28struct _snd_pcm_oss_setup {
29 char *task_name; 26 char *task_name;
30 unsigned int disable:1, 27 unsigned int disable:1,
31 direct:1, 28 direct:1,
@@ -36,10 +33,10 @@ struct _snd_pcm_oss_setup {
36 buggyptr:1; 33 buggyptr:1;
37 unsigned int periods; 34 unsigned int periods;
38 unsigned int period_size; 35 unsigned int period_size;
39 snd_pcm_oss_setup_t *next; 36 struct snd_pcm_oss_setup *next;
40}; 37};
41 38
42typedef struct _snd_pcm_oss_runtime { 39struct snd_pcm_oss_runtime {
43 unsigned params: 1, /* format/parameter change */ 40 unsigned params: 1, /* format/parameter change */
44 prepare: 1, /* need to prepare the operation */ 41 prepare: 1, /* need to prepare the operation */
45 trigger: 1, /* trigger flag */ 42 trigger: 1, /* trigger flag */
@@ -59,30 +56,30 @@ typedef struct _snd_pcm_oss_runtime {
59 size_t mmap_bytes; 56 size_t mmap_bytes;
60 char *buffer; /* vmallocated period */ 57 char *buffer; /* vmallocated period */
61 size_t buffer_used; /* used length from period buffer */ 58 size_t buffer_used; /* used length from period buffer */
62 snd_pcm_plugin_t *plugin_first; 59 struct snd_pcm_plugin *plugin_first;
63 snd_pcm_plugin_t *plugin_last; 60 struct snd_pcm_plugin *plugin_last;
64 unsigned int prev_hw_ptr_interrupt; 61 unsigned int prev_hw_ptr_interrupt;
65} snd_pcm_oss_runtime_t; 62};
66 63
67typedef struct _snd_pcm_oss_file { 64struct snd_pcm_oss_file {
68 snd_pcm_substream_t *streams[2]; 65 struct snd_pcm_substream *streams[2];
69} snd_pcm_oss_file_t; 66};
70 67
71typedef struct _snd_pcm_oss_substream { 68struct snd_pcm_oss_substream {
72 unsigned oss: 1; /* oss mode */ 69 unsigned oss: 1; /* oss mode */
73 snd_pcm_oss_setup_t *setup; /* active setup */ 70 struct snd_pcm_oss_setup *setup; /* active setup */
74 snd_pcm_oss_file_t *file; 71 struct snd_pcm_oss_file *file;
75} snd_pcm_oss_substream_t; 72};
76 73
77typedef struct _snd_pcm_oss_stream { 74struct snd_pcm_oss_stream {
78 snd_pcm_oss_setup_t *setup_list; /* setup list */ 75 struct snd_pcm_oss_setup *setup_list; /* setup list */
79 struct semaphore setup_mutex; 76 struct semaphore setup_mutex;
80 snd_info_entry_t *proc_entry; 77 struct snd_info_entry *proc_entry;
81} snd_pcm_oss_stream_t; 78};
82 79
83typedef struct _snd_pcm_oss { 80struct snd_pcm_oss {
84 int reg; 81 int reg;
85 unsigned int reg_mask; 82 unsigned int reg_mask;
86} snd_pcm_oss_t; 83};
87 84
88#endif /* __SOUND_PCM_OSS_H */ 85#endif /* __SOUND_PCM_OSS_H */
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
index 60b0e92e26f3..fb18aef77341 100644
--- a/include/sound/pcm_params.h
+++ b/include/sound/pcm_params.h
@@ -22,17 +22,17 @@
22 * 22 *
23 */ 23 */
24 24
25extern int snd_pcm_hw_param_mask(snd_pcm_substream_t *pcm, snd_pcm_hw_params_t *params, 25extern int snd_pcm_hw_param_mask(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params,
26 snd_pcm_hw_param_t var, const snd_mask_t *val); 26 snd_pcm_hw_param_t var, const struct snd_mask *val);
27extern unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params, 27extern unsigned int snd_pcm_hw_param_value_min(const struct snd_pcm_hw_params *params,
28 snd_pcm_hw_param_t var, int *dir); 28 snd_pcm_hw_param_t var, int *dir);
29extern unsigned int snd_pcm_hw_param_value_max(const snd_pcm_hw_params_t *params, 29extern unsigned int snd_pcm_hw_param_value_max(const struct snd_pcm_hw_params *params,
30 snd_pcm_hw_param_t var, int *dir); 30 snd_pcm_hw_param_t var, int *dir);
31extern int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params, 31extern int _snd_pcm_hw_param_min(struct snd_pcm_hw_params *params,
32 snd_pcm_hw_param_t var, unsigned int val, int dir); 32 snd_pcm_hw_param_t var, unsigned int val, int dir);
33extern int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params, 33extern int _snd_pcm_hw_param_setinteger(struct snd_pcm_hw_params *params,
34 snd_pcm_hw_param_t var); 34 snd_pcm_hw_param_t var);
35extern int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params, 35extern int _snd_pcm_hw_param_set(struct snd_pcm_hw_params *params,
36 snd_pcm_hw_param_t var, unsigned int val, int dir); 36 snd_pcm_hw_param_t var, unsigned int val, int dir);
37 37
38/* To share the same code we have alsa-lib */ 38/* To share the same code we have alsa-lib */
@@ -71,20 +71,20 @@ INLINE unsigned int ld2(u_int32_t v)
71 71
72INLINE size_t snd_mask_sizeof(void) 72INLINE size_t snd_mask_sizeof(void)
73{ 73{
74 return sizeof(snd_mask_t); 74 return sizeof(struct snd_mask);
75} 75}
76 76
77INLINE void snd_mask_none(snd_mask_t *mask) 77INLINE void snd_mask_none(struct snd_mask *mask)
78{ 78{
79 memset(mask, 0, sizeof(*mask)); 79 memset(mask, 0, sizeof(*mask));
80} 80}
81 81
82INLINE void snd_mask_any(snd_mask_t *mask) 82INLINE void snd_mask_any(struct snd_mask *mask)
83{ 83{
84 memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t)); 84 memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t));
85} 85}
86 86
87INLINE int snd_mask_empty(const snd_mask_t *mask) 87INLINE int snd_mask_empty(const struct snd_mask *mask)
88{ 88{
89 int i; 89 int i;
90 for (i = 0; i < SNDRV_MASK_SIZE; i++) 90 for (i = 0; i < SNDRV_MASK_SIZE; i++)
@@ -93,7 +93,7 @@ INLINE int snd_mask_empty(const snd_mask_t *mask)
93 return 1; 93 return 1;
94} 94}
95 95
96INLINE unsigned int snd_mask_min(const snd_mask_t *mask) 96INLINE unsigned int snd_mask_min(const struct snd_mask *mask)
97{ 97{
98 int i; 98 int i;
99 assert(!snd_mask_empty(mask)); 99 assert(!snd_mask_empty(mask));
@@ -104,7 +104,7 @@ INLINE unsigned int snd_mask_min(const snd_mask_t *mask)
104 return 0; 104 return 0;
105} 105}
106 106
107INLINE unsigned int snd_mask_max(const snd_mask_t *mask) 107INLINE unsigned int snd_mask_max(const struct snd_mask *mask)
108{ 108{
109 int i; 109 int i;
110 assert(!snd_mask_empty(mask)); 110 assert(!snd_mask_empty(mask));
@@ -115,19 +115,19 @@ INLINE unsigned int snd_mask_max(const snd_mask_t *mask)
115 return 0; 115 return 0;
116} 116}
117 117
118INLINE void snd_mask_set(snd_mask_t *mask, unsigned int val) 118INLINE void snd_mask_set(struct snd_mask *mask, unsigned int val)
119{ 119{
120 assert(val <= SNDRV_MASK_BITS); 120 assert(val <= SNDRV_MASK_BITS);
121 mask->bits[MASK_OFS(val)] |= MASK_BIT(val); 121 mask->bits[MASK_OFS(val)] |= MASK_BIT(val);
122} 122}
123 123
124INLINE void snd_mask_reset(snd_mask_t *mask, unsigned int val) 124INLINE void snd_mask_reset(struct snd_mask *mask, unsigned int val)
125{ 125{
126 assert(val <= SNDRV_MASK_BITS); 126 assert(val <= SNDRV_MASK_BITS);
127 mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val); 127 mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val);
128} 128}
129 129
130INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int to) 130INLINE void snd_mask_set_range(struct snd_mask *mask, unsigned int from, unsigned int to)
131{ 131{
132 unsigned int i; 132 unsigned int i;
133 assert(to <= SNDRV_MASK_BITS && from <= to); 133 assert(to <= SNDRV_MASK_BITS && from <= to);
@@ -135,7 +135,7 @@ INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int
135 mask->bits[MASK_OFS(i)] |= MASK_BIT(i); 135 mask->bits[MASK_OFS(i)] |= MASK_BIT(i);
136} 136}
137 137
138INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned int to) 138INLINE void snd_mask_reset_range(struct snd_mask *mask, unsigned int from, unsigned int to)
139{ 139{
140 unsigned int i; 140 unsigned int i;
141 assert(to <= SNDRV_MASK_BITS && from <= to); 141 assert(to <= SNDRV_MASK_BITS && from <= to);
@@ -143,7 +143,7 @@ INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned i
143 mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i); 143 mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i);
144} 144}
145 145
146INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val) 146INLINE void snd_mask_leave(struct snd_mask *mask, unsigned int val)
147{ 147{
148 unsigned int v; 148 unsigned int v;
149 assert(val <= SNDRV_MASK_BITS); 149 assert(val <= SNDRV_MASK_BITS);
@@ -152,30 +152,30 @@ INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val)
152 mask->bits[MASK_OFS(val)] = v; 152 mask->bits[MASK_OFS(val)] = v;
153} 153}
154 154
155INLINE void snd_mask_intersect(snd_mask_t *mask, const snd_mask_t *v) 155INLINE void snd_mask_intersect(struct snd_mask *mask, const struct snd_mask *v)
156{ 156{
157 int i; 157 int i;
158 for (i = 0; i < SNDRV_MASK_SIZE; i++) 158 for (i = 0; i < SNDRV_MASK_SIZE; i++)
159 mask->bits[i] &= v->bits[i]; 159 mask->bits[i] &= v->bits[i];
160} 160}
161 161
162INLINE int snd_mask_eq(const snd_mask_t *mask, const snd_mask_t *v) 162INLINE int snd_mask_eq(const struct snd_mask *mask, const struct snd_mask *v)
163{ 163{
164 return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t)); 164 return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t));
165} 165}
166 166
167INLINE void snd_mask_copy(snd_mask_t *mask, const snd_mask_t *v) 167INLINE void snd_mask_copy(struct snd_mask *mask, const struct snd_mask *v)
168{ 168{
169 *mask = *v; 169 *mask = *v;
170} 170}
171 171
172INLINE int snd_mask_test(const snd_mask_t *mask, unsigned int val) 172INLINE int snd_mask_test(const struct snd_mask *mask, unsigned int val)
173{ 173{
174 assert(val <= SNDRV_MASK_BITS); 174 assert(val <= SNDRV_MASK_BITS);
175 return mask->bits[MASK_OFS(val)] & MASK_BIT(val); 175 return mask->bits[MASK_OFS(val)] & MASK_BIT(val);
176} 176}
177 177
178INLINE int snd_mask_single(const snd_mask_t *mask) 178INLINE int snd_mask_single(const struct snd_mask *mask)
179{ 179{
180 int i, c = 0; 180 int i, c = 0;
181 assert(!snd_mask_empty(mask)); 181 assert(!snd_mask_empty(mask));
@@ -191,9 +191,9 @@ INLINE int snd_mask_single(const snd_mask_t *mask)
191 return 1; 191 return 1;
192} 192}
193 193
194INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v) 194INLINE int snd_mask_refine(struct snd_mask *mask, const struct snd_mask *v)
195{ 195{
196 snd_mask_t old; 196 struct snd_mask old;
197 assert(!snd_mask_empty(mask)); 197 assert(!snd_mask_empty(mask));
198 snd_mask_copy(&old, mask); 198 snd_mask_copy(&old, mask);
199 snd_mask_intersect(mask, v); 199 snd_mask_intersect(mask, v);
@@ -202,7 +202,7 @@ INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v)
202 return !snd_mask_eq(mask, &old); 202 return !snd_mask_eq(mask, &old);
203} 203}
204 204
205INLINE int snd_mask_refine_first(snd_mask_t *mask) 205INLINE int snd_mask_refine_first(struct snd_mask *mask)
206{ 206{
207 assert(!snd_mask_empty(mask)); 207 assert(!snd_mask_empty(mask));
208 if (snd_mask_single(mask)) 208 if (snd_mask_single(mask))
@@ -211,7 +211,7 @@ INLINE int snd_mask_refine_first(snd_mask_t *mask)
211 return 1; 211 return 1;
212} 212}
213 213
214INLINE int snd_mask_refine_last(snd_mask_t *mask) 214INLINE int snd_mask_refine_last(struct snd_mask *mask)
215{ 215{
216 assert(!snd_mask_empty(mask)); 216 assert(!snd_mask_empty(mask));
217 if (snd_mask_single(mask)) 217 if (snd_mask_single(mask))
@@ -220,7 +220,7 @@ INLINE int snd_mask_refine_last(snd_mask_t *mask)
220 return 1; 220 return 1;
221} 221}
222 222
223INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val) 223INLINE int snd_mask_refine_min(struct snd_mask *mask, unsigned int val)
224{ 224{
225 assert(!snd_mask_empty(mask)); 225 assert(!snd_mask_empty(mask));
226 if (snd_mask_min(mask) >= val) 226 if (snd_mask_min(mask) >= val)
@@ -231,7 +231,7 @@ INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val)
231 return 1; 231 return 1;
232} 232}
233 233
234INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val) 234INLINE int snd_mask_refine_max(struct snd_mask *mask, unsigned int val)
235{ 235{
236 assert(!snd_mask_empty(mask)); 236 assert(!snd_mask_empty(mask));
237 if (snd_mask_max(mask) <= val) 237 if (snd_mask_max(mask) <= val)
@@ -242,7 +242,7 @@ INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val)
242 return 1; 242 return 1;
243} 243}
244 244
245INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val) 245INLINE int snd_mask_refine_set(struct snd_mask *mask, unsigned int val)
246{ 246{
247 int changed; 247 int changed;
248 assert(!snd_mask_empty(mask)); 248 assert(!snd_mask_empty(mask));
@@ -253,13 +253,13 @@ INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val)
253 return changed; 253 return changed;
254} 254}
255 255
256INLINE int snd_mask_value(const snd_mask_t *mask) 256INLINE int snd_mask_value(const struct snd_mask *mask)
257{ 257{
258 assert(!snd_mask_empty(mask)); 258 assert(!snd_mask_empty(mask));
259 return snd_mask_min(mask); 259 return snd_mask_min(mask);
260} 260}
261 261
262INLINE void snd_interval_any(snd_interval_t *i) 262INLINE void snd_interval_any(struct snd_interval *i)
263{ 263{
264 i->min = 0; 264 i->min = 0;
265 i->openmin = 0; 265 i->openmin = 0;
@@ -269,42 +269,42 @@ INLINE void snd_interval_any(snd_interval_t *i)
269 i->empty = 0; 269 i->empty = 0;
270} 270}
271 271
272INLINE void snd_interval_none(snd_interval_t *i) 272INLINE void snd_interval_none(struct snd_interval *i)
273{ 273{
274 i->empty = 1; 274 i->empty = 1;
275} 275}
276 276
277INLINE int snd_interval_checkempty(const snd_interval_t *i) 277INLINE int snd_interval_checkempty(const struct snd_interval *i)
278{ 278{
279 return (i->min > i->max || 279 return (i->min > i->max ||
280 (i->min == i->max && (i->openmin || i->openmax))); 280 (i->min == i->max && (i->openmin || i->openmax)));
281} 281}
282 282
283INLINE int snd_interval_empty(const snd_interval_t *i) 283INLINE int snd_interval_empty(const struct snd_interval *i)
284{ 284{
285 return i->empty; 285 return i->empty;
286} 286}
287 287
288INLINE int snd_interval_single(const snd_interval_t *i) 288INLINE int snd_interval_single(const struct snd_interval *i)
289{ 289{
290 assert(!snd_interval_empty(i)); 290 assert(!snd_interval_empty(i));
291 return (i->min == i->max || 291 return (i->min == i->max ||
292 (i->min + 1 == i->max && i->openmax)); 292 (i->min + 1 == i->max && i->openmax));
293} 293}
294 294
295INLINE int snd_interval_value(const snd_interval_t *i) 295INLINE int snd_interval_value(const struct snd_interval *i)
296{ 296{
297 assert(snd_interval_single(i)); 297 assert(snd_interval_single(i));
298 return i->min; 298 return i->min;
299} 299}
300 300
301INLINE int snd_interval_min(const snd_interval_t *i) 301INLINE int snd_interval_min(const struct snd_interval *i)
302{ 302{
303 assert(!snd_interval_empty(i)); 303 assert(!snd_interval_empty(i));
304 return i->min; 304 return i->min;
305} 305}
306 306
307INLINE int snd_interval_max(const snd_interval_t *i) 307INLINE int snd_interval_max(const struct snd_interval *i)
308{ 308{
309 unsigned int v; 309 unsigned int v;
310 assert(!snd_interval_empty(i)); 310 assert(!snd_interval_empty(i));
@@ -314,18 +314,18 @@ INLINE int snd_interval_max(const snd_interval_t *i)
314 return v; 314 return v;
315} 315}
316 316
317INLINE int snd_interval_test(const snd_interval_t *i, unsigned int val) 317INLINE int snd_interval_test(const struct snd_interval *i, unsigned int val)
318{ 318{
319 return !((i->min > val || (i->min == val && i->openmin) || 319 return !((i->min > val || (i->min == val && i->openmin) ||
320 i->max < val || (i->max == val && i->openmax))); 320 i->max < val || (i->max == val && i->openmax)));
321} 321}
322 322
323INLINE void snd_interval_copy(snd_interval_t *d, const snd_interval_t *s) 323INLINE void snd_interval_copy(struct snd_interval *d, const struct snd_interval *s)
324{ 324{
325 *d = *s; 325 *d = *s;
326} 326}
327 327
328INLINE int snd_interval_setinteger(snd_interval_t *i) 328INLINE int snd_interval_setinteger(struct snd_interval *i)
329{ 329{
330 if (i->integer) 330 if (i->integer)
331 return 0; 331 return 0;
@@ -335,7 +335,7 @@ INLINE int snd_interval_setinteger(snd_interval_t *i)
335 return 1; 335 return 1;
336} 336}
337 337
338INLINE int snd_interval_eq(const snd_interval_t *i1, const snd_interval_t *i2) 338INLINE int snd_interval_eq(const struct snd_interval *i1, const struct snd_interval *i2)
339{ 339{
340 if (i1->empty) 340 if (i1->empty)
341 return i2->empty; 341 return i2->empty;
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index 3f9db510dee3..d19bddfbf995 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -36,11 +36,6 @@
36 * Raw MIDI interface 36 * Raw MIDI interface
37 */ 37 */
38 38
39typedef enum sndrv_rawmidi_stream snd_rawmidi_stream_t;
40typedef struct sndrv_rawmidi_info snd_rawmidi_info_t;
41typedef struct sndrv_rawmidi_params snd_rawmidi_params_t;
42typedef struct sndrv_rawmidi_status snd_rawmidi_status_t;
43
44#define SNDRV_RAWMIDI_DEVICES 8 39#define SNDRV_RAWMIDI_DEVICES 8
45 40
46#define SNDRV_RAWMIDI_LFLG_OUTPUT (1<<0) 41#define SNDRV_RAWMIDI_LFLG_OUTPUT (1<<0)
@@ -49,23 +44,22 @@ typedef struct sndrv_rawmidi_status snd_rawmidi_status_t;
49#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2) 44#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2)
50#define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3) 45#define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3)
51 46
52typedef struct _snd_rawmidi_runtime snd_rawmidi_runtime_t; 47struct snd_rawmidi;
53typedef struct _snd_rawmidi_substream snd_rawmidi_substream_t; 48struct snd_rawmidi_substream;
54typedef struct _snd_rawmidi_str snd_rawmidi_str_t;
55 49
56typedef struct _snd_rawmidi_ops { 50struct snd_rawmidi_ops {
57 int (*open) (snd_rawmidi_substream_t * substream); 51 int (*open) (struct snd_rawmidi_substream * substream);
58 int (*close) (snd_rawmidi_substream_t * substream); 52 int (*close) (struct snd_rawmidi_substream * substream);
59 void (*trigger) (snd_rawmidi_substream_t * substream, int up); 53 void (*trigger) (struct snd_rawmidi_substream * substream, int up);
60 void (*drain) (snd_rawmidi_substream_t * substream); 54 void (*drain) (struct snd_rawmidi_substream * substream);
61} snd_rawmidi_ops_t; 55};
62 56
63typedef struct _snd_rawmidi_global_ops { 57struct snd_rawmidi_global_ops {
64 int (*dev_register) (snd_rawmidi_t * rmidi); 58 int (*dev_register) (struct snd_rawmidi * rmidi);
65 int (*dev_unregister) (snd_rawmidi_t * rmidi); 59 int (*dev_unregister) (struct snd_rawmidi * rmidi);
66} snd_rawmidi_global_ops_t; 60};
67 61
68struct _snd_rawmidi_runtime { 62struct snd_rawmidi_runtime {
69 unsigned int drain: 1, /* drain stage */ 63 unsigned int drain: 1, /* drain stage */
70 oss: 1; /* OSS compatible mode */ 64 oss: 1; /* OSS compatible mode */
71 /* midi stream buffer */ 65 /* midi stream buffer */
@@ -80,15 +74,15 @@ struct _snd_rawmidi_runtime {
80 spinlock_t lock; 74 spinlock_t lock;
81 wait_queue_head_t sleep; 75 wait_queue_head_t sleep;
82 /* event handler (new bytes, input only) */ 76 /* event handler (new bytes, input only) */
83 void (*event)(snd_rawmidi_substream_t *substream); 77 void (*event)(struct snd_rawmidi_substream *substream);
84 /* defers calls to event [input] or ops->trigger [output] */ 78 /* defers calls to event [input] or ops->trigger [output] */
85 struct tasklet_struct tasklet; 79 struct tasklet_struct tasklet;
86 /* private data */ 80 /* private data */
87 void *private_data; 81 void *private_data;
88 void (*private_free)(snd_rawmidi_substream_t *substream); 82 void (*private_free)(struct snd_rawmidi_substream *substream);
89}; 83};
90 84
91struct _snd_rawmidi_substream { 85struct snd_rawmidi_substream {
92 struct list_head list; /* list of all substream for given stream */ 86 struct list_head list; /* list of all substream for given stream */
93 int stream; /* direction */ 87 int stream; /* direction */
94 int number; /* substream number */ 88 int number; /* substream number */
@@ -97,29 +91,29 @@ struct _snd_rawmidi_substream {
97 active_sensing: 1; /* send active sensing when close */ 91 active_sensing: 1; /* send active sensing when close */
98 int use_count; /* use counter (for output) */ 92 int use_count; /* use counter (for output) */
99 size_t bytes; 93 size_t bytes;
100 snd_rawmidi_t *rmidi; 94 struct snd_rawmidi *rmidi;
101 snd_rawmidi_str_t *pstr; 95 struct snd_rawmidi_str *pstr;
102 char name[32]; 96 char name[32];
103 snd_rawmidi_runtime_t *runtime; 97 struct snd_rawmidi_runtime *runtime;
104 /* hardware layer */ 98 /* hardware layer */
105 snd_rawmidi_ops_t *ops; 99 struct snd_rawmidi_ops *ops;
106}; 100};
107 101
108typedef struct _snd_rawmidi_file { 102struct snd_rawmidi_file {
109 snd_rawmidi_t *rmidi; 103 struct snd_rawmidi *rmidi;
110 snd_rawmidi_substream_t *input; 104 struct snd_rawmidi_substream *input;
111 snd_rawmidi_substream_t *output; 105 struct snd_rawmidi_substream *output;
112} snd_rawmidi_file_t; 106};
113 107
114struct _snd_rawmidi_str { 108struct snd_rawmidi_str {
115 unsigned int substream_count; 109 unsigned int substream_count;
116 unsigned int substream_opened; 110 unsigned int substream_opened;
117 struct list_head substreams; 111 struct list_head substreams;
118}; 112};
119 113
120struct _snd_rawmidi { 114struct snd_rawmidi {
121 snd_card_t *card; 115 struct snd_card *card;
122 116 struct list_head list;
123 unsigned int device; /* device number */ 117 unsigned int device; /* device number */
124 unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */ 118 unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */
125 char id[64]; 119 char id[64];
@@ -129,52 +123,61 @@ struct _snd_rawmidi {
129 int ossreg; 123 int ossreg;
130#endif 124#endif
131 125
132 snd_rawmidi_global_ops_t *ops; 126 struct snd_rawmidi_global_ops *ops;
133 127
134 snd_rawmidi_str_t streams[2]; 128 struct snd_rawmidi_str streams[2];
135 129
136 void *private_data; 130 void *private_data;
137 void (*private_free) (snd_rawmidi_t *rmidi); 131 void (*private_free) (struct snd_rawmidi *rmidi);
138 132
139 struct semaphore open_mutex; 133 struct semaphore open_mutex;
140 wait_queue_head_t open_wait; 134 wait_queue_head_t open_wait;
141 135
142 snd_info_entry_t *dev; 136 struct snd_info_entry *dev;
143 snd_info_entry_t *proc_entry; 137 struct snd_info_entry *proc_entry;
144 138
145#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 139#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
146 snd_seq_device_t *seq_dev; 140 struct snd_seq_device *seq_dev;
147#endif 141#endif
148}; 142};
149 143
150/* main rawmidi functions */ 144/* main rawmidi functions */
151 145
152int snd_rawmidi_new(snd_card_t * card, char *id, int device, 146int snd_rawmidi_new(struct snd_card *card, char *id, int device,
153 int output_count, int input_count, 147 int output_count, int input_count,
154 snd_rawmidi_t ** rmidi); 148 struct snd_rawmidi **rmidi);
155void snd_rawmidi_set_ops(snd_rawmidi_t * rmidi, int stream, snd_rawmidi_ops_t * ops); 149void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
150 struct snd_rawmidi_ops *ops);
156 151
157/* callbacks */ 152/* callbacks */
158 153
159void snd_rawmidi_receive_reset(snd_rawmidi_substream_t * substream); 154void snd_rawmidi_receive_reset(struct snd_rawmidi_substream *substream);
160int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char *buffer, int count); 155int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
161void snd_rawmidi_transmit_reset(snd_rawmidi_substream_t * substream); 156 const unsigned char *buffer, int count);
162int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream); 157void snd_rawmidi_transmit_reset(struct snd_rawmidi_substream *substream);
163int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); 158int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream);
164int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count); 159int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
165int snd_rawmidi_transmit(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); 160 unsigned char *buffer, int count);
161int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count);
162int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream,
163 unsigned char *buffer, int count);
166 164
167/* main midi functions */ 165/* main midi functions */
168 166
169int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info); 167int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info);
170int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, int mode, snd_rawmidi_file_t * rfile); 168int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice,
171int snd_rawmidi_kernel_release(snd_rawmidi_file_t * rfile); 169 int mode, struct snd_rawmidi_file *rfile);
172int snd_rawmidi_output_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); 170int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile);
173int snd_rawmidi_input_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); 171int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,
174int snd_rawmidi_drop_output(snd_rawmidi_substream_t * substream); 172 struct snd_rawmidi_params *params);
175int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream); 173int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
176int snd_rawmidi_drain_input(snd_rawmidi_substream_t * substream); 174 struct snd_rawmidi_params *params);
177long snd_rawmidi_kernel_read(snd_rawmidi_substream_t * substream, unsigned char *buf, long count); 175int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream);
178long snd_rawmidi_kernel_write(snd_rawmidi_substream_t * substream, const unsigned char *buf, long count); 176int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream);
177int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream);
178long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
179 unsigned char *buf, long count);
180long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream,
181 const unsigned char *buf, long count);
179 182
180#endif /* __SOUND_RAWMIDI_H */ 183#endif /* __SOUND_RAWMIDI_H */
diff --git a/include/sound/sb.h b/include/sound/sb.h
index 7960452445e6..431d06675e36 100644
--- a/include/sound/sb.h
+++ b/include/sound/sb.h
@@ -60,7 +60,7 @@ enum sb_hw_type {
60 60
61#define SB_MPU_INPUT 1 61#define SB_MPU_INPUT 1
62 62
63struct _snd_sb { 63struct snd_sb {
64 unsigned long port; /* base port of DSP chip */ 64 unsigned long port; /* base port of DSP chip */
65 struct resource *res_port; 65 struct resource *res_port;
66 unsigned long mpu_port; /* MPU port for SB DSP 4.0+ */ 66 unsigned long mpu_port; /* MPU port for SB DSP 4.0+ */
@@ -92,24 +92,26 @@ struct _snd_sb {
92 92
93 void *csp; /* used only when CONFIG_SND_SB16_CSP is set */ 93 void *csp; /* used only when CONFIG_SND_SB16_CSP is set */
94 94
95 snd_card_t *card; 95 struct snd_card *card;
96 snd_pcm_t *pcm; 96 struct snd_pcm *pcm;
97 snd_pcm_substream_t *playback_substream; 97 struct snd_pcm_substream *playback_substream;
98 snd_pcm_substream_t *capture_substream; 98 struct snd_pcm_substream *capture_substream;
99 99
100 snd_rawmidi_t *rmidi; 100 struct snd_rawmidi *rmidi;
101 snd_rawmidi_substream_t *midi_substream_input; 101 struct snd_rawmidi_substream *midi_substream_input;
102 snd_rawmidi_substream_t *midi_substream_output; 102 struct snd_rawmidi_substream *midi_substream_output;
103 irqreturn_t (*rmidi_callback)(int irq, void *dev_id, struct pt_regs *regs); 103 irqreturn_t (*rmidi_callback)(int irq, void *dev_id, struct pt_regs *regs);
104 104
105 spinlock_t reg_lock; 105 spinlock_t reg_lock;
106 spinlock_t open_lock; 106 spinlock_t open_lock;
107 spinlock_t midi_input_lock; 107 spinlock_t midi_input_lock;
108 108
109 snd_info_entry_t *proc_entry; 109 struct snd_info_entry *proc_entry;
110};
111 110
112typedef struct _snd_sb sb_t; 111#ifdef CONFIG_PM
112 unsigned char saved_regs[0x20];
113#endif
114};
113 115
114/* I/O ports */ 116/* I/O ports */
115 117
@@ -267,48 +269,52 @@ typedef struct _snd_sb sb_t;
267 * 269 *
268 */ 270 */
269 271
270static inline void snd_sb_ack_8bit(sb_t *chip) 272static inline void snd_sb_ack_8bit(struct snd_sb *chip)
271{ 273{
272 inb(SBP(chip, DATA_AVAIL)); 274 inb(SBP(chip, DATA_AVAIL));
273} 275}
274 276
275static inline void snd_sb_ack_16bit(sb_t *chip) 277static inline void snd_sb_ack_16bit(struct snd_sb *chip)
276{ 278{
277 inb(SBP(chip, DATA_AVAIL_16)); 279 inb(SBP(chip, DATA_AVAIL_16));
278} 280}
279 281
280/* sb_common.c */ 282/* sb_common.c */
281int snd_sbdsp_command(sb_t *chip, unsigned char val); 283int snd_sbdsp_command(struct snd_sb *chip, unsigned char val);
282int snd_sbdsp_get_byte(sb_t *chip); 284int snd_sbdsp_get_byte(struct snd_sb *chip);
283int snd_sbdsp_reset(sb_t *chip); 285int snd_sbdsp_reset(struct snd_sb *chip);
284int snd_sbdsp_create(snd_card_t *card, 286int snd_sbdsp_create(struct snd_card *card,
285 unsigned long port, 287 unsigned long port,
286 int irq, 288 int irq,
287 irqreturn_t (*irq_handler)(int, void *, struct pt_regs *), 289 irqreturn_t (*irq_handler)(int, void *, struct pt_regs *),
288 int dma8, int dma16, 290 int dma8, int dma16,
289 unsigned short hardware, 291 unsigned short hardware,
290 sb_t **r_chip); 292 struct snd_sb **r_chip);
291/* sb_mixer.c */ 293/* sb_mixer.c */
292void snd_sbmixer_write(sb_t *chip, unsigned char reg, unsigned char data); 294void snd_sbmixer_write(struct snd_sb *chip, unsigned char reg, unsigned char data);
293unsigned char snd_sbmixer_read(sb_t *chip, unsigned char reg); 295unsigned char snd_sbmixer_read(struct snd_sb *chip, unsigned char reg);
294int snd_sbmixer_new(sb_t *chip); 296int snd_sbmixer_new(struct snd_sb *chip);
297#ifdef CONFIG_PM
298void snd_sbmixer_suspend(struct snd_sb *chip);
299void snd_sbmixer_resume(struct snd_sb *chip);
300#endif
295 301
296/* sb8_init.c */ 302/* sb8_init.c */
297int snd_sb8dsp_pcm(sb_t *chip, int device, snd_pcm_t ** rpcm); 303int snd_sb8dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm);
298/* sb8.c */ 304/* sb8.c */
299irqreturn_t snd_sb8dsp_interrupt(sb_t *chip); 305irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip);
300int snd_sb8_playback_open(snd_pcm_substream_t *substream); 306int snd_sb8_playback_open(struct snd_pcm_substream *substream);
301int snd_sb8_capture_open(snd_pcm_substream_t *substream); 307int snd_sb8_capture_open(struct snd_pcm_substream *substream);
302int snd_sb8_playback_close(snd_pcm_substream_t *substream); 308int snd_sb8_playback_close(struct snd_pcm_substream *substream);
303int snd_sb8_capture_close(snd_pcm_substream_t *substream); 309int snd_sb8_capture_close(struct snd_pcm_substream *substream);
304/* midi8.c */ 310/* midi8.c */
305irqreturn_t snd_sb8dsp_midi_interrupt(sb_t *chip); 311irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb *chip);
306int snd_sb8dsp_midi(sb_t *chip, int device, snd_rawmidi_t ** rrawmidi); 312int snd_sb8dsp_midi(struct snd_sb *chip, int device, struct snd_rawmidi ** rrawmidi);
307 313
308/* sb16_init.c */ 314/* sb16_init.c */
309int snd_sb16dsp_pcm(sb_t *chip, int device, snd_pcm_t ** rpcm); 315int snd_sb16dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm);
310const snd_pcm_ops_t *snd_sb16dsp_get_pcm_ops(int direction); 316const struct snd_pcm_ops *snd_sb16dsp_get_pcm_ops(int direction);
311int snd_sb16dsp_configure(sb_t *chip); 317int snd_sb16dsp_configure(struct snd_sb *chip);
312/* sb16.c */ 318/* sb16.c */
313irqreturn_t snd_sb16dsp_interrupt(int irq, void *dev_id, struct pt_regs *regs); 319irqreturn_t snd_sb16dsp_interrupt(int irq, void *dev_id, struct pt_regs *regs);
314 320
@@ -328,7 +334,7 @@ enum {
328#define SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) \ 334#define SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) \
329 ((reg1) | ((reg2) << 8) | ((left_shift) << 16) | ((right_shift) << 24)) 335 ((reg1) | ((reg2) << 8) | ((left_shift) << 16) | ((right_shift) << 24))
330 336
331int snd_sbmixer_add_ctl(sb_t *chip, const char *name, int index, int type, unsigned long value); 337int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int type, unsigned long value);
332 338
333/* for ease of use */ 339/* for ease of use */
334struct sbmix_elem { 340struct sbmix_elem {
@@ -352,7 +358,7 @@ struct sbmix_elem {
352 .type = SB_MIX_INPUT_SW, \ 358 .type = SB_MIX_INPUT_SW, \
353 .private_value = SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) } 359 .private_value = SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) }
354 360
355static inline int snd_sbmixer_add_ctl_elem(sb_t *chip, const struct sbmix_elem *c) 361static inline int snd_sbmixer_add_ctl_elem(struct snd_sb *chip, const struct sbmix_elem *c)
356{ 362{
357 return snd_sbmixer_add_ctl(chip, c->name, 0, c->type, c->private_value); 363 return snd_sbmixer_add_ctl(chip, c->name, 0, c->type, c->private_value);
358} 364}
diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h
index eb8368b56b16..3b44d4b370f5 100644
--- a/include/sound/sb16_csp.h
+++ b/include/sound/sb16_csp.h
@@ -63,25 +63,25 @@
63#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000 63#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
64 64
65/* microcode header */ 65/* microcode header */
66typedef struct snd_sb_csp_mc_header { 66struct snd_sb_csp_mc_header {
67 char codec_name[16]; /* id name of codec */ 67 char codec_name[16]; /* id name of codec */
68 unsigned short func_req; /* requested function */ 68 unsigned short func_req; /* requested function */
69} snd_sb_csp_mc_header_t; 69};
70 70
71/* microcode to be loaded */ 71/* microcode to be loaded */
72typedef struct snd_sb_csp_microcode { 72struct snd_sb_csp_microcode {
73 snd_sb_csp_mc_header_t info; 73 struct snd_sb_csp_mc_header info;
74 unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE]; 74 unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
75} snd_sb_csp_microcode_t; 75};
76 76
77/* start CSP with sample_width in mono/stereo */ 77/* start CSP with sample_width in mono/stereo */
78typedef struct snd_sb_csp_start { 78struct snd_sb_csp_start {
79 int sample_width; /* sample width, look above */ 79 int sample_width; /* sample width, look above */
80 int channels; /* channels, look above */ 80 int channels; /* channels, look above */
81} snd_sb_csp_start_t; 81};
82 82
83/* CSP information */ 83/* CSP information */
84typedef struct snd_sb_csp_info { 84struct snd_sb_csp_info {
85 char codec_name[16]; /* id name of codec */ 85 char codec_name[16]; /* id name of codec */
86 unsigned short func_nr; /* function number */ 86 unsigned short func_nr; /* function number */
87 unsigned int acc_format; /* accepted PCM formats */ 87 unsigned int acc_format; /* accepted PCM formats */
@@ -93,17 +93,17 @@ typedef struct snd_sb_csp_info {
93 unsigned short run_width; /* current sample width */ 93 unsigned short run_width; /* current sample width */
94 unsigned short version; /* version id: 0x10 - 0x1f */ 94 unsigned short version; /* version id: 0x10 - 0x1f */
95 unsigned short state; /* state bits */ 95 unsigned short state; /* state bits */
96} snd_sb_csp_info_t; 96};
97 97
98/* HWDEP controls */ 98/* HWDEP controls */
99/* get CSP information */ 99/* get CSP information */
100#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, snd_sb_csp_info_t) 100#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info)
101/* load microcode to CSP */ 101/* load microcode to CSP */
102#define SNDRV_SB_CSP_IOCTL_LOAD_CODE _IOW('H', 0x11, snd_sb_csp_microcode_t) 102#define SNDRV_SB_CSP_IOCTL_LOAD_CODE _IOW('H', 0x11, struct snd_sb_csp_microcode)
103/* unload microcode from CSP */ 103/* unload microcode from CSP */
104#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12) 104#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
105/* start CSP */ 105/* start CSP */
106#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, snd_sb_csp_start_t) 106#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start)
107/* stop CSP */ 107/* stop CSP */
108#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14) 108#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
109/* pause CSP and DMA transfer */ 109/* pause CSP and DMA transfer */
@@ -115,25 +115,25 @@ typedef struct snd_sb_csp_info {
115#include "sb.h" 115#include "sb.h"
116#include "hwdep.h" 116#include "hwdep.h"
117 117
118typedef struct snd_sb_csp snd_sb_csp_t; 118struct snd_sb_csp;
119 119
120/* 120/*
121 * CSP operators 121 * CSP operators
122 */ 122 */
123typedef struct { 123struct snd_sb_csp_ops {
124 int (*csp_use) (snd_sb_csp_t * p); 124 int (*csp_use) (struct snd_sb_csp * p);
125 int (*csp_unuse) (snd_sb_csp_t * p); 125 int (*csp_unuse) (struct snd_sb_csp * p);
126 int (*csp_autoload) (snd_sb_csp_t * p, int pcm_sfmt, int play_rec_mode); 126 int (*csp_autoload) (struct snd_sb_csp * p, int pcm_sfmt, int play_rec_mode);
127 int (*csp_start) (snd_sb_csp_t * p, int sample_width, int channels); 127 int (*csp_start) (struct snd_sb_csp * p, int sample_width, int channels);
128 int (*csp_stop) (snd_sb_csp_t * p); 128 int (*csp_stop) (struct snd_sb_csp * p);
129 int (*csp_qsound_transfer) (snd_sb_csp_t * p); 129 int (*csp_qsound_transfer) (struct snd_sb_csp * p);
130} snd_sb_csp_ops_t; 130};
131 131
132/* 132/*
133 * CSP private data 133 * CSP private data
134 */ 134 */
135struct snd_sb_csp { 135struct snd_sb_csp {
136 sb_t *chip; /* SB16 DSP */ 136 struct snd_sb *chip; /* SB16 DSP */
137 int used; /* usage flag - exclusive */ 137 int used; /* usage flag - exclusive */
138 char codec_name[16]; /* name of codec */ 138 char codec_name[16]; /* name of codec */
139 unsigned short func_nr; /* function number */ 139 unsigned short func_nr; /* function number */
@@ -147,7 +147,7 @@ struct snd_sb_csp {
147 int version; /* CSP version (0x10 - 0x1f) */ 147 int version; /* CSP version (0x10 - 0x1f) */
148 int running; /* running state */ 148 int running; /* running state */
149 149
150 snd_sb_csp_ops_t ops; /* operators */ 150 struct snd_sb_csp_ops ops; /* operators */
151 151
152 spinlock_t q_lock; /* locking */ 152 spinlock_t q_lock; /* locking */
153 int q_enabled; /* enabled flag */ 153 int q_enabled; /* enabled flag */
@@ -155,13 +155,13 @@ struct snd_sb_csp {
155 int qpos_right; /* right position */ 155 int qpos_right; /* right position */
156 int qpos_changed; /* position changed flag */ 156 int qpos_changed; /* position changed flag */
157 157
158 snd_kcontrol_t *qsound_switch; 158 struct snd_kcontrol *qsound_switch;
159 snd_kcontrol_t *qsound_space; 159 struct snd_kcontrol *qsound_space;
160 160
161 struct semaphore access_mutex; /* locking */ 161 struct semaphore access_mutex; /* locking */
162}; 162};
163 163
164int snd_sb_csp_new(sb_t *chip, int device, snd_hwdep_t ** rhwdep); 164int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
165#endif 165#endif
166 166
167#endif /* __SOUND_SB16_CSP */ 167#endif /* __SOUND_SB16_CSP */
diff --git a/include/sound/seq_device.h b/include/sound/seq_device.h
index 204ca540c28e..2b5f24cc7548 100644
--- a/include/sound/seq_device.h
+++ b/include/sound/seq_device.h
@@ -21,9 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24typedef struct snd_seq_device snd_seq_device_t;
25typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
26
27/* 24/*
28 * registered device information 25 * registered device information
29 */ 26 */
@@ -36,7 +33,7 @@ typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
36 33
37struct snd_seq_device { 34struct snd_seq_device {
38 /* device info */ 35 /* device info */
39 snd_card_t *card; /* sound card */ 36 struct snd_card *card; /* sound card */
40 int device; /* device number */ 37 int device; /* device number */
41 char id[ID_LEN]; /* driver id */ 38 char id[ID_LEN]; /* driver id */
42 char name[80]; /* device name */ 39 char name[80]; /* device name */
@@ -44,7 +41,7 @@ struct snd_seq_device {
44 void *driver_data; /* private data for driver */ 41 void *driver_data; /* private data for driver */
45 int status; /* flag - read only */ 42 int status; /* flag - read only */
46 void *private_data; /* private data for the caller */ 43 void *private_data; /* private data for the caller */
47 void (*private_free)(snd_seq_device_t *device); 44 void (*private_free)(struct snd_seq_device *device);
48 struct list_head list; /* link to next device */ 45 struct list_head list; /* link to next device */
49}; 46};
50 47
@@ -63,19 +60,19 @@ struct snd_seq_device {
63 * Typically, call snd_device_free(dev->card, dev->driver_data) 60 * Typically, call snd_device_free(dev->card, dev->driver_data)
64 */ 61 */
65struct snd_seq_dev_ops { 62struct snd_seq_dev_ops {
66 int (*init_device)(snd_seq_device_t *dev); 63 int (*init_device)(struct snd_seq_device *dev);
67 int (*free_device)(snd_seq_device_t *dev); 64 int (*free_device)(struct snd_seq_device *dev);
68}; 65};
69 66
70/* 67/*
71 * prototypes 68 * prototypes
72 */ 69 */
73void snd_seq_device_load_drivers(void); 70void snd_seq_device_load_drivers(void);
74int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, snd_seq_device_t **result); 71int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result);
75int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsize); 72int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize);
76int snd_seq_device_unregister_driver(char *id); 73int snd_seq_device_unregister_driver(char *id);
77 74
78#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(snd_seq_device_t)) 75#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
79 76
80 77
81/* 78/*
@@ -84,5 +81,4 @@ int snd_seq_device_unregister_driver(char *id);
84#define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi" 81#define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi"
85#define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth" 82#define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth"
86 83
87
88#endif /* __SOUND_SEQ_DEVICE_H */ 84#endif /* __SOUND_SEQ_DEVICE_H */
diff --git a/include/sound/seq_instr.h b/include/sound/seq_instr.h
index 1a654df4aa97..db764f09efb7 100644
--- a/include/sound/seq_instr.h
+++ b/include/sound/seq_instr.h
@@ -24,29 +24,27 @@
24#include "seq_kernel.h" 24#include "seq_kernel.h"
25 25
26/* Instrument cluster */ 26/* Instrument cluster */
27typedef struct _snd_seq_kcluster { 27struct snd_seq_kcluster {
28 snd_seq_instr_cluster_t cluster; 28 snd_seq_instr_cluster_t cluster;
29 char name[32]; 29 char name[32];
30 int priority; 30 int priority;
31 struct _snd_seq_kcluster *next; 31 struct snd_seq_kcluster *next;
32} snd_seq_kcluster_t; 32};
33 33
34/* return pointer to private data */ 34/* return pointer to private data */
35#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(snd_seq_kinstr_t)) 35#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(struct snd_seq_kinstr))
36
37typedef struct snd_seq_kinstr_ops snd_seq_kinstr_ops_t;
38 36
39/* Instrument structure */ 37/* Instrument structure */
40typedef struct _snd_seq_kinstr { 38struct snd_seq_kinstr {
41 snd_seq_instr_t instr; 39 struct snd_seq_instr instr;
42 char name[32]; 40 char name[32];
43 int type; /* instrument type */ 41 int type; /* instrument type */
44 int use; /* use count */ 42 int use; /* use count */
45 int busy; /* not useable */ 43 int busy; /* not useable */
46 int add_len; /* additional length */ 44 int add_len; /* additional length */
47 snd_seq_kinstr_ops_t *ops; /* operations */ 45 struct snd_seq_kinstr_ops *ops; /* operations */
48 struct _snd_seq_kinstr *next; 46 struct snd_seq_kinstr *next;
49} snd_seq_kinstr_t; 47};
50 48
51#define SNDRV_SEQ_INSTR_HASH_SIZE 32 49#define SNDRV_SEQ_INSTR_HASH_SIZE 32
52 50
@@ -54,11 +52,11 @@ typedef struct _snd_seq_kinstr {
54#define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */ 52#define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */
55 53
56/* List of all instruments */ 54/* List of all instruments */
57typedef struct { 55struct snd_seq_kinstr_list {
58 snd_seq_kinstr_t *hash[SNDRV_SEQ_INSTR_HASH_SIZE]; 56 struct snd_seq_kinstr *hash[SNDRV_SEQ_INSTR_HASH_SIZE];
59 int count; /* count of all instruments */ 57 int count; /* count of all instruments */
60 58
61 snd_seq_kcluster_t *chash[SNDRV_SEQ_INSTR_HASH_SIZE]; 59 struct snd_seq_kcluster *chash[SNDRV_SEQ_INSTR_HASH_SIZE];
62 int ccount; /* count of all clusters */ 60 int ccount; /* count of all clusters */
63 61
64 int owner; /* current owner of the instrument list */ 62 int owner; /* current owner of the instrument list */
@@ -68,7 +66,7 @@ typedef struct {
68 spinlock_t ops_lock; 66 spinlock_t ops_lock;
69 struct semaphore ops_mutex; 67 struct semaphore ops_mutex;
70 unsigned long ops_flags; 68 unsigned long ops_flags;
71} snd_seq_kinstr_list_t; 69};
72 70
73#define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0 71#define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0
74#define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1 72#define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1
@@ -78,33 +76,33 @@ struct snd_seq_kinstr_ops {
78 long add_len; /* additional length */ 76 long add_len; /* additional length */
79 char *instr_type; 77 char *instr_type;
80 int (*info)(void *private_data, char *info_data, long len); 78 int (*info)(void *private_data, char *info_data, long len);
81 int (*put)(void *private_data, snd_seq_kinstr_t *kinstr, 79 int (*put)(void *private_data, struct snd_seq_kinstr *kinstr,
82 char __user *instr_data, long len, int atomic, int cmd); 80 char __user *instr_data, long len, int atomic, int cmd);
83 int (*get)(void *private_data, snd_seq_kinstr_t *kinstr, 81 int (*get)(void *private_data, struct snd_seq_kinstr *kinstr,
84 char __user *instr_data, long len, int atomic, int cmd); 82 char __user *instr_data, long len, int atomic, int cmd);
85 int (*get_size)(void *private_data, snd_seq_kinstr_t *kinstr, long *size); 83 int (*get_size)(void *private_data, struct snd_seq_kinstr *kinstr, long *size);
86 int (*remove)(void *private_data, snd_seq_kinstr_t *kinstr, int atomic); 84 int (*remove)(void *private_data, struct snd_seq_kinstr *kinstr, int atomic);
87 void (*notify)(void *private_data, snd_seq_kinstr_t *kinstr, int what); 85 void (*notify)(void *private_data, struct snd_seq_kinstr *kinstr, int what);
88 struct snd_seq_kinstr_ops *next; 86 struct snd_seq_kinstr_ops *next;
89}; 87};
90 88
91 89
92/* instrument operations */ 90/* instrument operations */
93snd_seq_kinstr_list_t *snd_seq_instr_list_new(void); 91struct snd_seq_kinstr_list *snd_seq_instr_list_new(void);
94void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list); 92void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list);
95int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list, 93int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list,
96 snd_seq_instr_header_t *ifree, 94 struct snd_seq_instr_header *ifree,
97 int client, 95 int client,
98 int atomic); 96 int atomic);
99snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list, 97struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list,
100 snd_seq_instr_t *instr, 98 struct snd_seq_instr *instr,
101 int exact, 99 int exact,
102 int follow_alias); 100 int follow_alias);
103void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list, 101void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list,
104 snd_seq_kinstr_t *instr); 102 struct snd_seq_kinstr *instr);
105int snd_seq_instr_event(snd_seq_kinstr_ops_t *ops, 103int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops,
106 snd_seq_kinstr_list_t *list, 104 struct snd_seq_kinstr_list *list,
107 snd_seq_event_t *ev, 105 struct snd_seq_event *ev,
108 int client, 106 int client,
109 int atomic, 107 int atomic,
110 int hop); 108 int hop);
diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h
index 4beca1952c76..f023c1b97f8c 100644
--- a/include/sound/seq_kernel.h
+++ b/include/sound/seq_kernel.h
@@ -24,62 +24,8 @@
24#include <linux/time.h> 24#include <linux/time.h>
25#include "asequencer.h" 25#include "asequencer.h"
26 26
27typedef sndrv_seq_tick_time_t snd_seq_tick_time_t; 27typedef struct snd_seq_real_time snd_seq_real_time_t;
28typedef sndrv_seq_position_t snd_seq_position_t; 28typedef union snd_seq_timestamp snd_seq_timestamp_t;
29typedef sndrv_seq_frequency_t snd_seq_frequency_t;
30typedef sndrv_seq_instr_cluster_t snd_seq_instr_cluster_t;
31typedef enum sndrv_seq_client_type snd_seq_client_type_t;
32typedef enum sndrv_seq_stop_mode snd_seq_stop_mode_t;
33typedef struct sndrv_seq_port_info snd_seq_port_info_t;
34typedef struct sndrv_seq_port_subscribe snd_seq_port_subscribe_t;
35typedef struct sndrv_seq_event snd_seq_event_t;
36typedef struct sndrv_seq_addr snd_seq_addr_t;
37typedef struct sndrv_seq_ev_volume snd_seq_ev_volume_t;
38typedef struct sndrv_seq_ev_loop snd_seq_ev_loop_t;
39typedef struct sndrv_seq_remove_events snd_seq_remove_events_t;
40typedef struct sndrv_seq_query_subs snd_seq_query_subs_t;
41typedef struct sndrv_seq_real_time snd_seq_real_time_t;
42typedef struct sndrv_seq_system_info snd_seq_system_info_t;
43typedef struct sndrv_seq_client_info snd_seq_client_info_t;
44typedef struct sndrv_seq_queue_info snd_seq_queue_info_t;
45typedef struct sndrv_seq_queue_status snd_seq_queue_status_t;
46typedef struct sndrv_seq_queue_tempo snd_seq_queue_tempo_t;
47typedef struct sndrv_seq_queue_owner snd_seq_queue_owner_t;
48typedef struct sndrv_seq_queue_timer snd_seq_queue_timer_t;
49typedef struct sndrv_seq_queue_client snd_seq_queue_client_t;
50typedef struct sndrv_seq_client_pool snd_seq_client_pool_t;
51typedef struct sndrv_seq_instr snd_seq_instr_t;
52typedef struct sndrv_seq_instr_data snd_seq_instr_data_t;
53typedef struct sndrv_seq_instr_header snd_seq_instr_header_t;
54typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
55
56#define snd_seq_event_bounce_ext_data sndrv_seq_event_bounce_ext_data
57#define snd_seq_ev_is_result_type sndrv_seq_ev_is_result_type
58#define snd_seq_ev_is_channel_type sndrv_seq_ev_is_channel_type
59#define snd_seq_ev_is_note_type sndrv_seq_ev_is_note_type
60#define snd_seq_ev_is_control_type sndrv_seq_ev_is_control_type
61#define snd_seq_ev_is_queue_type sndrv_seq_ev_is_queue_type
62#define snd_seq_ev_is_message_type sndrv_seq_ev_is_message_type
63#define snd_seq_ev_is_sample_type sndrv_seq_ev_is_sample_type
64#define snd_seq_ev_is_user_type sndrv_seq_ev_is_user_type
65#define snd_seq_ev_is_fixed_type sndrv_seq_ev_is_fixed_type
66#define snd_seq_ev_is_instr_type sndrv_seq_ev_is_instr_type
67#define snd_seq_ev_is_variable_type sndrv_seq_ev_is_variable_type
68#define snd_seq_ev_is_reserved sndrv_seq_ev_is_reserved
69#define snd_seq_ev_is_direct sndrv_seq_ev_is_direct
70#define snd_seq_ev_is_prior sndrv_seq_ev_is_prior
71#define snd_seq_ev_length_type sndrv_seq_ev_length_type
72#define snd_seq_ev_is_fixed sndrv_seq_ev_is_fixed
73#define snd_seq_ev_is_variable sndrv_seq_ev_is_variable
74#define snd_seq_ev_is_varusr sndrv_seq_ev_is_varusr
75#define snd_seq_ev_timestamp_type sndrv_seq_ev_timestamp_type
76#define snd_seq_ev_is_tick sndrv_seq_ev_is_tick
77#define snd_seq_ev_is_real sndrv_seq_ev_is_real
78#define snd_seq_ev_timemode_type sndrv_seq_ev_timemode_type
79#define snd_seq_ev_is_abstime sndrv_seq_ev_is_abstime
80#define snd_seq_ev_is_reltime sndrv_seq_ev_is_reltime
81#define snd_seq_queue_sync_port sndrv_seq_queue_sync_port
82#define snd_seq_queue_owner sndrv_seq_queue_owner
83 29
84/* maximum number of events dequeued per schedule interval */ 30/* maximum number of events dequeued per schedule interval */
85#define SNDRV_SEQ_MAX_DEQUEUE 50 31#define SNDRV_SEQ_MAX_DEQUEUE 50
@@ -114,69 +60,48 @@ typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
114/* max size of event size */ 60/* max size of event size */
115#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff 61#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
116 62
117/* typedefs */
118struct _snd_seq_user_client;
119struct _snd_seq_kernel_client;
120struct _snd_seq_client;
121struct _snd_seq_queue;
122
123typedef struct _snd_seq_user_client user_client_t;
124typedef struct _snd_seq_kernel_client kernel_client_t;
125typedef struct _snd_seq_client client_t;
126typedef struct _snd_seq_queue queue_t;
127
128/* call-backs for kernel client */
129
130typedef struct {
131 void *private_data;
132 unsigned allow_input: 1,
133 allow_output: 1;
134 /*...*/
135} snd_seq_client_callback_t;
136
137/* call-backs for kernel port */ 63/* call-backs for kernel port */
138typedef int (snd_seq_kernel_port_open_t)(void *private_data, snd_seq_port_subscribe_t *info); 64struct snd_seq_port_callback {
139typedef int (snd_seq_kernel_port_close_t)(void *private_data, snd_seq_port_subscribe_t *info);
140typedef int (snd_seq_kernel_port_input_t)(snd_seq_event_t *ev, int direct, void *private_data, int atomic, int hop);
141typedef void (snd_seq_kernel_port_private_free_t)(void *private_data);
142
143typedef struct {
144 struct module *owner; 65 struct module *owner;
145 void *private_data; 66 void *private_data;
146 snd_seq_kernel_port_open_t *subscribe; 67 int (*subscribe)(void *private_data, struct snd_seq_port_subscribe *info);
147 snd_seq_kernel_port_close_t *unsubscribe; 68 int (*unsubscribe)(void *private_data, struct snd_seq_port_subscribe *info);
148 snd_seq_kernel_port_open_t *use; 69 int (*use)(void *private_data, struct snd_seq_port_subscribe *info);
149 snd_seq_kernel_port_close_t *unuse; 70 int (*unuse)(void *private_data, struct snd_seq_port_subscribe *info);
150 snd_seq_kernel_port_input_t *event_input; 71 int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop);
151 snd_seq_kernel_port_private_free_t *private_free; 72 void (*private_free)(void *private_data);
152 unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */ 73 unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */
153 /*...*/ 74 /*...*/
154} snd_seq_port_callback_t; 75};
155 76
156/* interface for kernel client */ 77/* interface for kernel client */
157extern int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_client_callback_t *callback); 78int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
158extern int snd_seq_delete_kernel_client(int client); 79 const char *name_fmt, ...)
159extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop); 80 __attribute__ ((format (printf, 3, 4)));
160extern int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t *ev, int atomic, int hop); 81int snd_seq_delete_kernel_client(int client);
161extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg); 82int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
83int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
84int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
162 85
163#define SNDRV_SEQ_EXT_MASK 0xc0000000 86#define SNDRV_SEQ_EXT_MASK 0xc0000000
164#define SNDRV_SEQ_EXT_USRPTR 0x80000000 87#define SNDRV_SEQ_EXT_USRPTR 0x80000000
165#define SNDRV_SEQ_EXT_CHAINED 0x40000000 88#define SNDRV_SEQ_EXT_CHAINED 0x40000000
166 89
167typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count); 90typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count);
168int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, int in_kernel, int size_aligned); 91int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
169int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t func, void *private_data); 92 int in_kernel, int size_aligned);
93int snd_seq_dump_var_event(const struct snd_seq_event *event,
94 snd_seq_dump_func_t func, void *private_data);
170 95
171/* interface for OSS emulation */ 96/* interface for OSS emulation */
172int snd_seq_set_queue_tempo(int client, snd_seq_queue_tempo_t *tempo); 97int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo);
173 98
174/* port callback routines */ 99/* port callback routines */
175void snd_port_init_callback(snd_seq_port_callback_t *p); 100void snd_port_init_callback(struct snd_seq_port_callback *p);
176snd_seq_port_callback_t *snd_port_alloc_callback(void); 101struct snd_seq_port_callback *snd_port_alloc_callback(void);
177 102
178/* port attach/detach */ 103/* port attach/detach */
179int snd_seq_event_port_attach(int client, snd_seq_port_callback_t *pcbp, 104int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
180 int cap, int type, int midi_channels, int midi_voices, char *portname); 105 int cap, int type, int midi_channels, int midi_voices, char *portname);
181int snd_seq_event_port_detach(int client, int port); 106int snd_seq_event_port_detach(int client, int port);
182 107
diff --git a/include/sound/seq_midi_emul.h b/include/sound/seq_midi_emul.h
index e58ca45bc73b..d6c4615901b9 100644
--- a/include/sound/seq_midi_emul.h
+++ b/include/sound/seq_midi_emul.h
@@ -29,7 +29,7 @@
29 * channel. All drivers for hardware that does not understand midi 29 * channel. All drivers for hardware that does not understand midi
30 * directly will probably need to use this structure. 30 * directly will probably need to use this structure.
31 */ 31 */
32typedef struct snd_midi_channel { 32struct snd_midi_channel {
33 void *private; /* A back pointer to driver data */ 33 void *private; /* A back pointer to driver data */
34 int number; /* The channel number */ 34 int number; /* The channel number */
35 int client; /* The client associated with this channel */ 35 int client; /* The client associated with this channel */
@@ -53,41 +53,43 @@ typedef struct snd_midi_channel {
53 short gm_rpn_fine_tuning; /* Master fine tuning */ 53 short gm_rpn_fine_tuning; /* Master fine tuning */
54 short gm_rpn_coarse_tuning; /* Master coarse tuning */ 54 short gm_rpn_coarse_tuning; /* Master coarse tuning */
55 55
56} snd_midi_channel_t; 56};
57 57
58/* 58/*
59 * A structure that represets a set of channels bound to a port. There 59 * A structure that represets a set of channels bound to a port. There
60 * would usually be 16 channels per port. But fewer could be used for 60 * would usually be 16 channels per port. But fewer could be used for
61 * particular cases. 61 * particular cases.
62 * The channel set consists of information describing the client and 62 * The channel set consists of information describing the client and
63 * port for this midi synth and an array of snd_midi_channel_t structures. 63 * port for this midi synth and an array of snd_midi_channel structures.
64 * A driver that had no need for snd_midi_channel_t could still use the 64 * A driver that had no need for snd_midi_channel could still use the
65 * channel set type if it wished with the channel array null. 65 * channel set type if it wished with the channel array null.
66 */ 66 */
67typedef struct snd_midi_channel_set { 67struct snd_midi_channel_set {
68 void *private_data; /* Driver data */ 68 void *private_data; /* Driver data */
69 int client; /* Client for this port */ 69 int client; /* Client for this port */
70 int port; /* The port number */ 70 int port; /* The port number */
71 71
72 int max_channels; /* Size of the channels array */ 72 int max_channels; /* Size of the channels array */
73 snd_midi_channel_t *channels; 73 struct snd_midi_channel *channels;
74 74
75 unsigned char midi_mode; /* MIDI operating mode */ 75 unsigned char midi_mode; /* MIDI operating mode */
76 unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */ 76 unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */
77 unsigned char gs_chorus_mode; 77 unsigned char gs_chorus_mode;
78 unsigned char gs_reverb_mode; 78 unsigned char gs_reverb_mode;
79 79
80} snd_midi_channel_set_t; 80};
81 81
82typedef struct snd_seq_midi_op { 82struct snd_midi_op {
83 void (*note_on)(void *private_data, int note, int vel, snd_midi_channel_t *chan); 83 void (*note_on)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
84 void (*note_off)(void *private_data,int note, int vel, snd_midi_channel_t *chan); /* release note */ 84 void (*note_off)(void *private_data,int note, int vel, struct snd_midi_channel *chan); /* release note */
85 void (*key_press)(void *private_data, int note, int vel, snd_midi_channel_t *chan); 85 void (*key_press)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
86 void (*note_terminate)(void *private_data, int note, snd_midi_channel_t *chan); /* terminate note immediately */ 86 void (*note_terminate)(void *private_data, int note, struct snd_midi_channel *chan); /* terminate note immediately */
87 void (*control)(void *private_data, int type, snd_midi_channel_t *chan); 87 void (*control)(void *private_data, int type, struct snd_midi_channel *chan);
88 void (*nrpn)(void *private_data, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); 88 void (*nrpn)(void *private_data, struct snd_midi_channel *chan,
89 void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset); 89 struct snd_midi_channel_set *chset);
90} snd_midi_op_t; 90 void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed,
91 struct snd_midi_channel_set *chset);
92};
91 93
92/* 94/*
93 * These defines are used so that pitchbend, aftertouch etc, can be 95 * These defines are used so that pitchbend, aftertouch etc, can be
@@ -186,10 +188,10 @@ enum {
186}; 188};
187 189
188/* Prototypes for midi_process.c */ 190/* Prototypes for midi_process.c */
189void snd_midi_process_event(snd_midi_op_t *ops, snd_seq_event_t *ev, 191void snd_midi_process_event(struct snd_midi_op *ops, struct snd_seq_event *ev,
190 snd_midi_channel_set_t *chanset); 192 struct snd_midi_channel_set *chanset);
191void snd_midi_channel_set_clear(snd_midi_channel_set_t *chset); 193void snd_midi_channel_set_clear(struct snd_midi_channel_set *chset);
192snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n); 194struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n);
193void snd_midi_channel_free_set(snd_midi_channel_set_t *chset); 195void snd_midi_channel_free_set(struct snd_midi_channel_set *chset);
194 196
195#endif /* __SOUND_SEQ_MIDI_EMUL_H */ 197#endif /* __SOUND_SEQ_MIDI_EMUL_H */
diff --git a/include/sound/seq_midi_event.h b/include/sound/seq_midi_event.h
index 8857e2bd31a5..dd789e7cdb20 100644
--- a/include/sound/seq_midi_event.h
+++ b/include/sound/seq_midi_event.h
@@ -26,10 +26,8 @@
26 26
27#define MAX_MIDI_EVENT_BUF 256 27#define MAX_MIDI_EVENT_BUF 256
28 28
29typedef struct snd_midi_event_t snd_midi_event_t;
30
31/* midi status */ 29/* midi status */
32struct snd_midi_event_t { 30struct snd_midi_event {
33 int qlen; /* queue length */ 31 int qlen; /* queue length */
34 int read; /* chars read */ 32 int read; /* chars read */
35 int type; /* current event type */ 33 int type; /* current event type */
@@ -40,15 +38,17 @@ struct snd_midi_event_t {
40 spinlock_t lock; 38 spinlock_t lock;
41}; 39};
42 40
43int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev); 41int snd_midi_event_new(int bufsize, struct snd_midi_event **rdev);
44void snd_midi_event_free(snd_midi_event_t *dev); 42void snd_midi_event_free(struct snd_midi_event *dev);
45void snd_midi_event_reset_encode(snd_midi_event_t *dev); 43void snd_midi_event_reset_encode(struct snd_midi_event *dev);
46void snd_midi_event_reset_decode(snd_midi_event_t *dev); 44void snd_midi_event_reset_decode(struct snd_midi_event *dev);
47void snd_midi_event_no_status(snd_midi_event_t *dev, int on); 45void snd_midi_event_no_status(struct snd_midi_event *dev, int on);
48/* encode from byte stream - return number of written bytes if success */ 46/* encode from byte stream - return number of written bytes if success */
49long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); 47long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count,
50int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev); 48 struct snd_seq_event *ev);
49int snd_midi_event_encode_byte(struct snd_midi_event *dev, int c, struct snd_seq_event *ev);
51/* decode from event to bytes - return number of written bytes if success */ 50/* decode from event to bytes - return number of written bytes if success */
52long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); 51long snd_midi_event_decode(struct snd_midi_event *dev, unsigned char *buf, long count,
52 struct snd_seq_event *ev);
53 53
54#endif /* __SOUND_SEQ_MIDI_EVENT_H */ 54#endif /* __SOUND_SEQ_MIDI_EVENT_H */
diff --git a/include/sound/seq_oss.h b/include/sound/seq_oss.h
index bd7e57322ab6..9b060bbd6e02 100644
--- a/include/sound/seq_oss.h
+++ b/include/sound/seq_oss.h
@@ -25,22 +25,16 @@
25#include "seq_kernel.h" 25#include "seq_kernel.h"
26 26
27/* 27/*
28 * type definitions
29 */
30typedef struct snd_seq_oss_arg_t snd_seq_oss_arg_t;
31typedef struct snd_seq_oss_callback_t snd_seq_oss_callback_t;
32
33/*
34 * argument structure for synthesizer operations 28 * argument structure for synthesizer operations
35 */ 29 */
36struct snd_seq_oss_arg_t { 30struct snd_seq_oss_arg {
37 /* given by OSS sequencer */ 31 /* given by OSS sequencer */
38 int app_index; /* application unique index */ 32 int app_index; /* application unique index */
39 int file_mode; /* file mode - see below */ 33 int file_mode; /* file mode - see below */
40 int seq_mode; /* sequencer mode - see below */ 34 int seq_mode; /* sequencer mode - see below */
41 35
42 /* following must be initialized in open callback */ 36 /* following must be initialized in open callback */
43 snd_seq_addr_t addr; /* opened port address */ 37 struct snd_seq_addr addr; /* opened port address */
44 void *private_data; /* private data for lowlevel drivers */ 38 void *private_data; /* private data for lowlevel drivers */
45 39
46 /* note-on event passing mode: initially given by OSS seq, 40 /* note-on event passing mode: initially given by OSS seq,
@@ -53,14 +47,14 @@ struct snd_seq_oss_arg_t {
53/* 47/*
54 * synthesizer operation callbacks 48 * synthesizer operation callbacks
55 */ 49 */
56struct snd_seq_oss_callback_t { 50struct snd_seq_oss_callback {
57 struct module *owner; 51 struct module *owner;
58 int (*open)(snd_seq_oss_arg_t *p, void *closure); 52 int (*open)(struct snd_seq_oss_arg *p, void *closure);
59 int (*close)(snd_seq_oss_arg_t *p); 53 int (*close)(struct snd_seq_oss_arg *p);
60 int (*ioctl)(snd_seq_oss_arg_t *p, unsigned int cmd, unsigned long arg); 54 int (*ioctl)(struct snd_seq_oss_arg *p, unsigned int cmd, unsigned long arg);
61 int (*load_patch)(snd_seq_oss_arg_t *p, int format, const char __user *buf, int offs, int count); 55 int (*load_patch)(struct snd_seq_oss_arg *p, int format, const char __user *buf, int offs, int count);
62 int (*reset)(snd_seq_oss_arg_t *p); 56 int (*reset)(struct snd_seq_oss_arg *p);
63 int (*raw_event)(snd_seq_oss_arg_t *p, unsigned char *data); 57 int (*raw_event)(struct snd_seq_oss_arg *p, unsigned char *data);
64}; 58};
65 59
66/* flag: file_mode */ 60/* flag: file_mode */
@@ -88,13 +82,13 @@ struct snd_seq_oss_callback_t {
88/* 82/*
89 * data pointer to snd_seq_register_device 83 * data pointer to snd_seq_register_device
90 */ 84 */
91typedef struct snd_seq_oss_reg { 85struct snd_seq_oss_reg {
92 int type; 86 int type;
93 int subtype; 87 int subtype;
94 int nvoices; 88 int nvoices;
95 snd_seq_oss_callback_t oper; 89 struct snd_seq_oss_callback oper;
96 void *private_data; 90 void *private_data;
97} snd_seq_oss_reg_t; 91};
98 92
99/* device id */ 93/* device id */
100#define SNDRV_SEQ_DEV_ID_OSS "seq-oss" 94#define SNDRV_SEQ_DEV_ID_OSS "seq-oss"
diff --git a/include/sound/seq_virmidi.h b/include/sound/seq_virmidi.h
index 1ad27e859af3..8d5aea76d7c3 100644
--- a/include/sound/seq_virmidi.h
+++ b/include/sound/seq_virmidi.h
@@ -25,25 +25,23 @@
25#include "rawmidi.h" 25#include "rawmidi.h"
26#include "seq_midi_event.h" 26#include "seq_midi_event.h"
27 27
28typedef struct _snd_virmidi_dev snd_virmidi_dev_t;
29
30/* 28/*
31 * device file instance: 29 * device file instance:
32 * This instance is created at each time the midi device file is 30 * This instance is created at each time the midi device file is
33 * opened. Each instance has its own input buffer and MIDI parser 31 * opened. Each instance has its own input buffer and MIDI parser
34 * (buffer), and is associated with the device instance. 32 * (buffer), and is associated with the device instance.
35 */ 33 */
36typedef struct _snd_virmidi { 34struct snd_virmidi {
37 struct list_head list; 35 struct list_head list;
38 int seq_mode; 36 int seq_mode;
39 int client; 37 int client;
40 int port; 38 int port;
41 unsigned int trigger: 1; 39 unsigned int trigger: 1;
42 snd_midi_event_t *parser; 40 struct snd_midi_event *parser;
43 snd_seq_event_t event; 41 struct snd_seq_event event;
44 snd_virmidi_dev_t *rdev; 42 struct snd_virmidi_dev *rdev;
45 snd_rawmidi_substream_t *substream; 43 struct snd_rawmidi_substream *substream;
46} snd_virmidi_t; 44};
47 45
48#define SNDRV_VIRMIDI_SUBSCRIBE (1<<0) 46#define SNDRV_VIRMIDI_SUBSCRIBE (1<<0)
49#define SNDRV_VIRMIDI_USE (1<<1) 47#define SNDRV_VIRMIDI_USE (1<<1)
@@ -53,9 +51,9 @@ typedef struct _snd_virmidi {
53 * Each virtual midi device has one device instance. It contains 51 * Each virtual midi device has one device instance. It contains
54 * common information and the linked-list of opened files, 52 * common information and the linked-list of opened files,
55 */ 53 */
56struct _snd_virmidi_dev { 54struct snd_virmidi_dev {
57 snd_card_t *card; /* associated card */ 55 struct snd_card *card; /* associated card */
58 snd_rawmidi_t *rmidi; /* rawmidi device */ 56 struct snd_rawmidi *rmidi; /* rawmidi device */
59 int seq_mode; /* SNDRV_VIRMIDI_XXX */ 57 int seq_mode; /* SNDRV_VIRMIDI_XXX */
60 int device; /* sequencer device */ 58 int device; /* sequencer device */
61 int client; /* created/attached client */ 59 int client; /* created/attached client */
@@ -78,6 +76,6 @@ struct _snd_virmidi_dev {
78#define SNDRV_VIRMIDI_SEQ_ATTACH 1 76#define SNDRV_VIRMIDI_SEQ_ATTACH 1
79#define SNDRV_VIRMIDI_SEQ_DISPATCH 2 77#define SNDRV_VIRMIDI_SEQ_DISPATCH 2
80 78
81int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi); 79int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi);
82 80
83#endif /* __SOUND_SEQ_VIRMIDI */ 81#endif /* __SOUND_SEQ_VIRMIDI */
diff --git a/include/sound/sfnt_info.h b/include/sound/sfnt_info.h
index 674585f88a31..5d1ab9c4950f 100644
--- a/include/sound/sfnt_info.h
+++ b/include/sound/sfnt_info.h
@@ -35,7 +35,7 @@
35#endif 35#endif
36 36
37/* patch interface header: 16 bytes */ 37/* patch interface header: 16 bytes */
38typedef struct soundfont_patch_info_t { 38struct soundfont_patch_info {
39 unsigned short key; /* use the key below */ 39 unsigned short key; /* use the key below */
40#define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07) 40#define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07)
41 41
@@ -59,7 +59,7 @@ typedef struct soundfont_patch_info_t {
59 short reserved; /* word alignment data */ 59 short reserved; /* word alignment data */
60 60
61 /* the actual patch data begins after this */ 61 /* the actual patch data begins after this */
62} soundfont_patch_info_t; 62};
63 63
64 64
65/* 65/*
@@ -68,7 +68,7 @@ typedef struct soundfont_patch_info_t {
68 68
69#define SNDRV_SFNT_PATCH_NAME_LEN 32 69#define SNDRV_SFNT_PATCH_NAME_LEN 32
70 70
71typedef struct soundfont_open_parm_t { 71struct soundfont_open_parm {
72 unsigned short type; /* sample type */ 72 unsigned short type; /* sample type */
73#define SNDRV_SFNT_PAT_TYPE_MISC 0 73#define SNDRV_SFNT_PAT_TYPE_MISC 0
74#define SNDRV_SFNT_PAT_TYPE_GUS 6 74#define SNDRV_SFNT_PAT_TYPE_GUS 6
@@ -78,7 +78,7 @@ typedef struct soundfont_open_parm_t {
78 78
79 short reserved; 79 short reserved;
80 char name[SNDRV_SFNT_PATCH_NAME_LEN]; 80 char name[SNDRV_SFNT_PATCH_NAME_LEN];
81} soundfont_open_parm_t; 81};
82 82
83 83
84/* 84/*
@@ -86,7 +86,7 @@ typedef struct soundfont_open_parm_t {
86 */ 86 */
87 87
88/* wave table envelope & effect parameters to control EMU8000 */ 88/* wave table envelope & effect parameters to control EMU8000 */
89typedef struct soundfont_voice_parm_t { 89struct soundfont_voice_parm {
90 unsigned short moddelay; /* modulation delay (0x8000) */ 90 unsigned short moddelay; /* modulation delay (0x8000) */
91 unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ 91 unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */
92 unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ 92 unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */
@@ -108,11 +108,11 @@ typedef struct soundfont_voice_parm_t {
108 unsigned char chorus; /* chorus send (0x00) */ 108 unsigned char chorus; /* chorus send (0x00) */
109 unsigned char reverb; /* reverb send (0x00) */ 109 unsigned char reverb; /* reverb send (0x00) */
110 unsigned short reserved[4]; /* not used */ 110 unsigned short reserved[4]; /* not used */
111} soundfont_voice_parm_t; 111};
112 112
113 113
114/* wave table parameters: 92 bytes */ 114/* wave table parameters: 92 bytes */
115typedef struct soundfont_voice_info_t { 115struct soundfont_voice_info {
116 unsigned short sf_id; /* file id (should be zero) */ 116 unsigned short sf_id; /* file id (should be zero) */
117 unsigned short sample; /* sample id */ 117 unsigned short sample; /* sample id */
118 int start, end; /* sample offset correction */ 118 int start, end; /* sample offset correction */
@@ -135,13 +135,13 @@ typedef struct soundfont_voice_info_t {
135 unsigned char amplitude; /* sample volume (127 max) */ 135 unsigned char amplitude; /* sample volume (127 max) */
136 unsigned char attenuation; /* attenuation (0.375dB) */ 136 unsigned char attenuation; /* attenuation (0.375dB) */
137 short scaleTuning; /* pitch scale tuning(%), normally 100 */ 137 short scaleTuning; /* pitch scale tuning(%), normally 100 */
138 soundfont_voice_parm_t parm; /* voice envelope parameters */ 138 struct soundfont_voice_parm parm; /* voice envelope parameters */
139 unsigned short sample_mode; /* sample mode_flag (set by driver) */ 139 unsigned short sample_mode; /* sample mode_flag (set by driver) */
140} soundfont_voice_info_t; 140};
141 141
142 142
143/* instrument info header: 4 bytes */ 143/* instrument info header: 4 bytes */
144typedef struct soundfont_voice_rec_hdr_t { 144struct soundfont_voice_rec_hdr {
145 unsigned char bank; /* midi bank number */ 145 unsigned char bank; /* midi bank number */
146 unsigned char instr; /* midi preset number */ 146 unsigned char instr; /* midi preset number */
147 char nvoices; /* number of voices */ 147 char nvoices; /* number of voices */
@@ -149,7 +149,7 @@ typedef struct soundfont_voice_rec_hdr_t {
149#define SNDRV_SFNT_WR_APPEND 0 /* append anyway */ 149#define SNDRV_SFNT_WR_APPEND 0 /* append anyway */
150#define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */ 150#define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */
151#define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */ 151#define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */
152} soundfont_voice_rec_hdr_t; 152};
153 153
154 154
155/* 155/*
@@ -157,7 +157,7 @@ typedef struct soundfont_voice_rec_hdr_t {
157 */ 157 */
158 158
159/* wave table sample header: 32 bytes */ 159/* wave table sample header: 32 bytes */
160typedef struct soundfont_sample_info_t { 160struct soundfont_sample_info {
161 unsigned short sf_id; /* file id (should be zero) */ 161 unsigned short sf_id; /* file id (should be zero) */
162 unsigned short sample; /* sample id */ 162 unsigned short sample; /* sample id */
163 int start, end; /* start & end offset */ 163 int start, end; /* start & end offset */
@@ -174,17 +174,17 @@ typedef struct soundfont_sample_info_t {
174#define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ 174#define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */
175#define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ 175#define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */
176 unsigned int truesize; /* used memory size (set by driver) */ 176 unsigned int truesize; /* used memory size (set by driver) */
177} soundfont_sample_info_t; 177};
178 178
179 179
180/* 180/*
181 * voice preset mapping (aliasing) 181 * voice preset mapping (aliasing)
182 */ 182 */
183 183
184typedef struct soundfont_voice_map_t { 184struct soundfont_voice_map {
185 int map_bank, map_instr, map_key; /* key = -1 means all keys */ 185 int map_bank, map_instr, map_key; /* key = -1 means all keys */
186 int src_bank, src_instr, src_key; 186 int src_bank, src_instr, src_key;
187} soundfont_voice_map_t; 187};
188 188
189 189
190/* 190/*
@@ -195,7 +195,7 @@ typedef struct soundfont_voice_map_t {
195 195
196#define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */ 196#define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */
197 197
198struct sndrv_emux_misc_mode { 198struct snd_emux_misc_mode {
199 int port; /* -1 = all */ 199 int port; /* -1 = all */
200 int mode; 200 int mode;
201 int value; 201 int value;
@@ -204,11 +204,11 @@ struct sndrv_emux_misc_mode {
204 204
205enum { 205enum {
206 SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int), 206 SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int),
207 SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, soundfont_patch_info_t), 207 SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, struct soundfont_patch_info),
208 SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82), 208 SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82),
209 SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83), 209 SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83),
210 SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int), 210 SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int),
211 SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct sndrv_emux_misc_mode), 211 SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct snd_emux_misc_mode),
212}; 212};
213 213
214#endif /* __SOUND_SFNT_INFO_H */ 214#endif /* __SOUND_SFNT_INFO_H */
diff --git a/include/sound/snd_wavefront.h b/include/sound/snd_wavefront.h
index 4b0b2b9370b9..0b9e5de94ff1 100644
--- a/include/sound/snd_wavefront.h
+++ b/include/sound/snd_wavefront.h
@@ -26,8 +26,8 @@ struct _snd_wavefront_midi {
26 snd_wavefront_mpu_id output_mpu; /* most-recently-used */ 26 snd_wavefront_mpu_id output_mpu; /* most-recently-used */
27 snd_wavefront_mpu_id input_mpu; /* most-recently-used */ 27 snd_wavefront_mpu_id input_mpu; /* most-recently-used */
28 unsigned int mode[2]; /* MPU401_MODE_XXX */ 28 unsigned int mode[2]; /* MPU401_MODE_XXX */
29 snd_rawmidi_substream_t *substream_output[2]; 29 struct snd_rawmidi_substream *substream_output[2];
30 snd_rawmidi_substream_t *substream_input[2]; 30 struct snd_rawmidi_substream *substream_input[2];
31 struct timer_list timer; 31 struct timer_list timer;
32 spinlock_t open; 32 spinlock_t open;
33 spinlock_t virtual; /* protects isvirtual */ 33 spinlock_t virtual; /* protects isvirtual */
@@ -38,8 +38,8 @@ struct _snd_wavefront_midi {
38#define MPU_ACK 0xFE 38#define MPU_ACK 0xFE
39#define UART_MODE_ON 0x3F 39#define UART_MODE_ON 0x3F
40 40
41extern snd_rawmidi_ops_t snd_wavefront_midi_output; 41extern struct snd_rawmidi_ops snd_wavefront_midi_output;
42extern snd_rawmidi_ops_t snd_wavefront_midi_input; 42extern struct snd_rawmidi_ops snd_wavefront_midi_input;
43 43
44extern void snd_wavefront_midi_enable_virtual (snd_wavefront_card_t *); 44extern void snd_wavefront_midi_enable_virtual (snd_wavefront_card_t *);
45extern void snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *); 45extern void snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *);
@@ -116,23 +116,23 @@ extern int snd_wavefront_config_midi (snd_wavefront_t *dev) ;
116extern int snd_wavefront_cmd (snd_wavefront_t *, int, unsigned char *, 116extern int snd_wavefront_cmd (snd_wavefront_t *, int, unsigned char *,
117 unsigned char *); 117 unsigned char *);
118 118
119extern int snd_wavefront_synth_ioctl (snd_hwdep_t *, 119extern int snd_wavefront_synth_ioctl (struct snd_hwdep *,
120 struct file *, 120 struct file *,
121 unsigned int cmd, 121 unsigned int cmd,
122 unsigned long arg); 122 unsigned long arg);
123extern int snd_wavefront_synth_open (snd_hwdep_t *, struct file *); 123extern int snd_wavefront_synth_open (struct snd_hwdep *, struct file *);
124extern int snd_wavefront_synth_release (snd_hwdep_t *, struct file *); 124extern int snd_wavefront_synth_release (struct snd_hwdep *, struct file *);
125 125
126/* FX processor - see also yss225.[ch] */ 126/* FX processor - see also yss225.[ch] */
127 127
128extern int snd_wavefront_fx_start (snd_wavefront_t *); 128extern int snd_wavefront_fx_start (snd_wavefront_t *);
129extern int snd_wavefront_fx_detect (snd_wavefront_t *); 129extern int snd_wavefront_fx_detect (snd_wavefront_t *);
130extern int snd_wavefront_fx_ioctl (snd_hwdep_t *, 130extern int snd_wavefront_fx_ioctl (struct snd_hwdep *,
131 struct file *, 131 struct file *,
132 unsigned int cmd, 132 unsigned int cmd,
133 unsigned long arg); 133 unsigned long arg);
134extern int snd_wavefront_fx_open (snd_hwdep_t *, struct file *); 134extern int snd_wavefront_fx_open (struct snd_hwdep *, struct file *);
135extern int snd_wavefront_fx_release (snd_hwdep_t *, struct file *); 135extern int snd_wavefront_fx_release (struct snd_hwdep *, struct file *);
136 136
137/* prefix in all snd_printk() delivered messages */ 137/* prefix in all snd_printk() delivered messages */
138 138
diff --git a/include/sound/soundfont.h b/include/sound/soundfont.h
index c992958f5e3c..61a010c65d02 100644
--- a/include/sound/soundfont.h
+++ b/include/sound/soundfont.h
@@ -29,94 +29,93 @@
29#define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */ 29#define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */
30#define SF_IS_DRUM_BANK(z) ((z) == 128) 30#define SF_IS_DRUM_BANK(z) ((z) == 128)
31 31
32typedef struct snd_sf_zone { 32struct snd_sf_zone {
33 struct snd_sf_zone *next; /* Link to next */ 33 struct snd_sf_zone *next; /* Link to next */
34 unsigned char bank; /* Midi bank for this zone */ 34 unsigned char bank; /* Midi bank for this zone */
35 unsigned char instr; /* Midi program for this zone */ 35 unsigned char instr; /* Midi program for this zone */
36 unsigned char mapped; /* True if mapped to something else */ 36 unsigned char mapped; /* True if mapped to something else */
37 37
38 soundfont_voice_info_t v; /* All the soundfont parameters */ 38 struct soundfont_voice_info v; /* All the soundfont parameters */
39 int counter; 39 int counter;
40 struct snd_sf_sample *sample; /* Link to sample */ 40 struct snd_sf_sample *sample; /* Link to sample */
41 41
42 /* The following deals with preset numbers (programs) */ 42 /* The following deals with preset numbers (programs) */
43 struct snd_sf_zone *next_instr; /* Next zone of this instrument */ 43 struct snd_sf_zone *next_instr; /* Next zone of this instrument */
44 struct snd_sf_zone *next_zone; /* Next zone in play list */ 44 struct snd_sf_zone *next_zone; /* Next zone in play list */
45} snd_sf_zone_t; 45};
46 46
47typedef struct snd_sf_sample { 47struct snd_sf_sample {
48 soundfont_sample_info_t v; 48 struct soundfont_sample_info v;
49 int counter; 49 int counter;
50 snd_util_memblk_t *block; /* allocated data block */ 50 struct snd_util_memblk *block; /* allocated data block */
51 struct snd_sf_sample *next; 51 struct snd_sf_sample *next;
52} snd_sf_sample_t; 52};
53 53
54/* 54/*
55 * This represents all the information relating to a soundfont. 55 * This represents all the information relating to a soundfont.
56 */ 56 */
57typedef struct snd_soundfont { 57struct snd_soundfont {
58 struct snd_soundfont *next; /* Link to next */ 58 struct snd_soundfont *next; /* Link to next */
59 /*struct snd_soundfont *prev;*/ /* Link to previous */ 59 /*struct snd_soundfont *prev;*/ /* Link to previous */
60 short id; /* file id */ 60 short id; /* file id */
61 short type; /* font type */ 61 short type; /* font type */
62 unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */ 62 unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */
63 snd_sf_zone_t *zones; /* Font information */ 63 struct snd_sf_zone *zones; /* Font information */
64 snd_sf_sample_t *samples; /* The sample headers */ 64 struct snd_sf_sample *samples; /* The sample headers */
65} snd_soundfont_t; 65};
66 66
67/* 67/*
68 * Type of the sample access callback 68 * Type of the sample access callback
69 */ 69 */
70typedef int (*snd_sf_sample_new_t)(void *private_data, snd_sf_sample_t *sp, 70struct snd_sf_callback {
71 snd_util_memhdr_t *hdr, const void __user *buf, long count);
72typedef int (*snd_sf_sample_free_t)(void *private_data, snd_sf_sample_t *sp,
73 snd_util_memhdr_t *hdr);
74typedef void (*snd_sf_sample_reset_t)(void *private);
75
76typedef struct snd_sf_callback {
77 void *private_data; 71 void *private_data;
78 snd_sf_sample_new_t sample_new; 72 int (*sample_new)(void *private_data, struct snd_sf_sample *sp,
79 snd_sf_sample_free_t sample_free; 73 struct snd_util_memhdr *hdr,
80 snd_sf_sample_reset_t sample_reset; 74 const void __user *buf, long count);
81} snd_sf_callback_t; 75 int (*sample_free)(void *private_data, struct snd_sf_sample *sp,
76 struct snd_util_memhdr *hdr);
77 void (*sample_reset)(void *private);
78};
82 79
83/* 80/*
84 * List of soundfonts. 81 * List of soundfonts.
85 */ 82 */
86typedef struct snd_sf_list { 83struct snd_sf_list {
87 snd_soundfont_t *currsf; /* The currently open soundfont */ 84 struct snd_soundfont *currsf; /* The currently open soundfont */
88 int open_client; /* client pointer for lock */ 85 int open_client; /* client pointer for lock */
89 int mem_used; /* used memory size */ 86 int mem_used; /* used memory size */
90 snd_sf_zone_t *presets[SF_MAX_PRESETS]; 87 struct snd_sf_zone *presets[SF_MAX_PRESETS];
91 snd_soundfont_t *fonts; /* The list of soundfonts */ 88 struct snd_soundfont *fonts; /* The list of soundfonts */
92 int fonts_size; /* number of fonts allocated */ 89 int fonts_size; /* number of fonts allocated */
93 int zone_counter; /* last allocated time for zone */ 90 int zone_counter; /* last allocated time for zone */
94 int sample_counter; /* last allocated time for sample */ 91 int sample_counter; /* last allocated time for sample */
95 int zone_locked; /* locked time for zone */ 92 int zone_locked; /* locked time for zone */
96 int sample_locked; /* locked time for sample */ 93 int sample_locked; /* locked time for sample */
97 snd_sf_callback_t callback; /* callback functions */ 94 struct snd_sf_callback callback; /* callback functions */
98 int presets_locked; 95 int presets_locked;
99 struct semaphore presets_mutex; 96 struct semaphore presets_mutex;
100 spinlock_t lock; 97 spinlock_t lock;
101 snd_util_memhdr_t *memhdr; 98 struct snd_util_memhdr *memhdr;
102} snd_sf_list_t; 99};
103 100
104/* Prototypes for soundfont.c */ 101/* Prototypes for soundfont.c */
105int snd_soundfont_load(snd_sf_list_t *sflist, const void __user *data, long count, int client); 102int snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
106int snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data, 103 long count, int client);
104int snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data,
107 long count, int client); 105 long count, int client);
108int snd_soundfont_close_check(snd_sf_list_t *sflist, int client); 106int snd_soundfont_close_check(struct snd_sf_list *sflist, int client);
109 107
110snd_sf_list_t *snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr); 108struct snd_sf_list *snd_sf_new(struct snd_sf_callback *callback,
111void snd_sf_free(snd_sf_list_t *sflist); 109 struct snd_util_memhdr *hdr);
110void snd_sf_free(struct snd_sf_list *sflist);
112 111
113int snd_soundfont_remove_samples(snd_sf_list_t *sflist); 112int snd_soundfont_remove_samples(struct snd_sf_list *sflist);
114int snd_soundfont_remove_unlocked(snd_sf_list_t *sflist); 113int snd_soundfont_remove_unlocked(struct snd_sf_list *sflist);
115 114
116int snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel, 115int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel,
117 int preset, int bank, 116 int preset, int bank,
118 int def_preset, int def_bank, 117 int def_preset, int def_bank,
119 snd_sf_zone_t **table, int max_layers); 118 struct snd_sf_zone **table, int max_layers);
120 119
121/* Parameter conversions */ 120/* Parameter conversions */
122int snd_sf_calc_parm_hold(int msec); 121int snd_sf_calc_parm_hold(int msec);
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index b82e408e758f..a4f554520197 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -24,15 +24,15 @@
24 24
25#include <linux/videodev.h> 25#include <linux/videodev.h>
26 26
27typedef struct snd_tea575x tea575x_t; 27struct snd_tea575x;
28 28
29struct snd_tea575x_ops { 29struct snd_tea575x_ops {
30 void (*write)(tea575x_t *tea, unsigned int val); 30 void (*write)(struct snd_tea575x *tea, unsigned int val);
31 unsigned int (*read)(tea575x_t *tea); 31 unsigned int (*read)(struct snd_tea575x *tea);
32}; 32};
33 33
34struct snd_tea575x { 34struct snd_tea575x {
35 snd_card_t *card; 35 struct snd_card *card;
36 struct video_device vd; /* video device */ 36 struct video_device vd; /* video device */
37 struct file_operations fops; 37 struct file_operations fops;
38 int dev_nr; /* requested device number + 1 */ 38 int dev_nr; /* requested device number + 1 */
@@ -45,7 +45,7 @@ struct snd_tea575x {
45 void *private_data; 45 void *private_data;
46}; 46};
47 47
48void snd_tea575x_init(tea575x_t *tea); 48void snd_tea575x_init(struct snd_tea575x *tea);
49void snd_tea575x_exit(tea575x_t *tea); 49void snd_tea575x_exit(struct snd_tea575x *tea);
50 50
51#endif /* __SOUND_TEA575X_TUNER_H */ 51#endif /* __SOUND_TEA575X_TUNER_H */
diff --git a/include/sound/tea6330t.h b/include/sound/tea6330t.h
index 3896c0a50907..51b282b76896 100644
--- a/include/sound/tea6330t.h
+++ b/include/sound/tea6330t.h
@@ -22,21 +22,10 @@
22 * 22 *
23 */ 23 */
24 24
25#include "control.h"
26#include "i2c.h" /* generic i2c support */ 25#include "i2c.h" /* generic i2c support */
27 26
28typedef struct { 27int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer);
29 snd_i2c_device_t *device; 28int snd_tea6330t_update_mixer(struct snd_card *card, struct snd_i2c_bus *bus,
30 snd_i2c_bus_t *bus; 29 int equalizer, int fader);
31 int equalizer;
32 int fader;
33 unsigned char regs[8];
34 unsigned char mleft, mright;
35 unsigned char bass, treble;
36 unsigned char max_bass, max_treble;
37} tea6330t_t;
38
39extern int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer);
40extern int snd_tea6330t_update_mixer(snd_card_t * card, snd_i2c_bus_t * bus, int equalizer, int fader);
41 30
42#endif /* __SOUND_TEA6330T_H */ 31#endif /* __SOUND_TEA6330T_H */
diff --git a/include/sound/timer.h b/include/sound/timer.h
index b55f38ae56e1..5ece2bf541dc 100644
--- a/include/sound/timer.h
+++ b/include/sound/timer.h
@@ -26,20 +26,6 @@
26#include <sound/asound.h> 26#include <sound/asound.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28 28
29typedef enum sndrv_timer_class snd_timer_class_t;
30typedef enum sndrv_timer_slave_class snd_timer_slave_class_t;
31typedef enum sndrv_timer_global snd_timer_global_t;
32typedef struct sndrv_timer_id snd_timer_id_t;
33typedef struct sndrv_timer_ginfo snd_timer_ginfo_t;
34typedef struct sndrv_timer_gparams snd_timer_gparams_t;
35typedef struct sndrv_timer_gstatus snd_timer_gstatus_t;
36typedef struct sndrv_timer_select snd_timer_select_t;
37typedef struct sndrv_timer_info snd_timer_info_t;
38typedef struct sndrv_timer_params snd_timer_params_t;
39typedef struct sndrv_timer_status snd_timer_status_t;
40typedef struct sndrv_timer_read snd_timer_read_t;
41typedef struct sndrv_timer_tread snd_timer_tread_t;
42
43#define snd_timer_chip(timer) ((timer)->private_data) 29#define snd_timer_chip(timer) ((timer)->private_data)
44 30
45#define SNDRV_TIMER_DEVICES 16 31#define SNDRV_TIMER_DEVICES 16
@@ -64,11 +50,9 @@ typedef struct sndrv_timer_tread snd_timer_tread_t;
64#define SNDRV_TIMER_FLG_CHANGE 0x00000001 50#define SNDRV_TIMER_FLG_CHANGE 0x00000001
65#define SNDRV_TIMER_FLG_RESCHED 0x00000002 /* need reschedule */ 51#define SNDRV_TIMER_FLG_RESCHED 0x00000002 /* need reschedule */
66 52
67typedef void (*snd_timer_callback_t) (snd_timer_instance_t * timeri, unsigned long ticks, unsigned long resolution); 53struct snd_timer;
68typedef void (*snd_timer_ccallback_t) (snd_timer_instance_t * timeri, enum sndrv_timer_event event,
69 struct timespec * tstamp, unsigned long resolution);
70 54
71struct _snd_timer_hardware { 55struct snd_timer_hardware {
72 /* -- must be filled with low-level driver */ 56 /* -- must be filled with low-level driver */
73 unsigned int flags; /* various flags */ 57 unsigned int flags; /* various flags */
74 unsigned long resolution; /* average timer resolution for one tick in nsec */ 58 unsigned long resolution; /* average timer resolution for one tick in nsec */
@@ -76,18 +60,18 @@ struct _snd_timer_hardware {
76 unsigned long resolution_max; /* maximal resolution */ 60 unsigned long resolution_max; /* maximal resolution */
77 unsigned long ticks; /* max timer ticks per interrupt */ 61 unsigned long ticks; /* max timer ticks per interrupt */
78 /* -- low-level functions -- */ 62 /* -- low-level functions -- */
79 int (*open) (snd_timer_t * timer); 63 int (*open) (struct snd_timer * timer);
80 int (*close) (snd_timer_t * timer); 64 int (*close) (struct snd_timer * timer);
81 unsigned long (*c_resolution) (snd_timer_t * timer); 65 unsigned long (*c_resolution) (struct snd_timer * timer);
82 int (*start) (snd_timer_t * timer); 66 int (*start) (struct snd_timer * timer);
83 int (*stop) (snd_timer_t * timer); 67 int (*stop) (struct snd_timer * timer);
84 int (*set_period) (snd_timer_t * timer, unsigned long period_num, unsigned long period_den); 68 int (*set_period) (struct snd_timer * timer, unsigned long period_num, unsigned long period_den);
85 int (*precise_resolution) (snd_timer_t * timer, unsigned long *num, unsigned long *den); 69 int (*precise_resolution) (struct snd_timer * timer, unsigned long *num, unsigned long *den);
86}; 70};
87 71
88struct _snd_timer { 72struct snd_timer {
89 snd_timer_class_t tmr_class; 73 int tmr_class;
90 snd_card_t *card; 74 struct snd_card *card;
91 struct module *module; 75 struct module *module;
92 int tmr_device; 76 int tmr_device;
93 int tmr_subdevice; 77 int tmr_subdevice;
@@ -97,8 +81,8 @@ struct _snd_timer {
97 int running; /* running instances */ 81 int running; /* running instances */
98 unsigned long sticks; /* schedule ticks */ 82 unsigned long sticks; /* schedule ticks */
99 void *private_data; 83 void *private_data;
100 void (*private_free) (snd_timer_t *timer); 84 void (*private_free) (struct snd_timer *timer);
101 struct _snd_timer_hardware hw; 85 struct snd_timer_hardware hw;
102 spinlock_t lock; 86 spinlock_t lock;
103 struct list_head device_list; 87 struct list_head device_list;
104 struct list_head open_list_head; 88 struct list_head open_list_head;
@@ -108,49 +92,53 @@ struct _snd_timer {
108 struct tasklet_struct task_queue; 92 struct tasklet_struct task_queue;
109}; 93};
110 94
111struct _snd_timer_instance { 95struct snd_timer_instance {
112 snd_timer_t * timer; 96 struct snd_timer *timer;
113 char *owner; 97 char *owner;
114 unsigned int flags; 98 unsigned int flags;
115 void *private_data; 99 void *private_data;
116 void (*private_free) (snd_timer_instance_t *ti); 100 void (*private_free) (struct snd_timer_instance *ti);
117 snd_timer_callback_t callback; 101 void (*callback) (struct snd_timer_instance *timeri,
118 snd_timer_ccallback_t ccallback; 102 unsigned long ticks, unsigned long resolution);
103 void (*ccallback) (struct snd_timer_instance * timeri,
104 int event,
105 struct timespec * tstamp,
106 unsigned long resolution);
119 void *callback_data; 107 void *callback_data;
120 unsigned long ticks; /* auto-load ticks when expired */ 108 unsigned long ticks; /* auto-load ticks when expired */
121 unsigned long cticks; /* current ticks */ 109 unsigned long cticks; /* current ticks */
122 unsigned long pticks; /* accumulated ticks for callback */ 110 unsigned long pticks; /* accumulated ticks for callback */
123 unsigned long resolution; /* current resolution for tasklet */ 111 unsigned long resolution; /* current resolution for tasklet */
124 unsigned long lost; /* lost ticks */ 112 unsigned long lost; /* lost ticks */
125 snd_timer_slave_class_t slave_class; 113 int slave_class;
126 unsigned int slave_id; 114 unsigned int slave_id;
127 struct list_head open_list; 115 struct list_head open_list;
128 struct list_head active_list; 116 struct list_head active_list;
129 struct list_head ack_list; 117 struct list_head ack_list;
130 struct list_head slave_list_head; 118 struct list_head slave_list_head;
131 struct list_head slave_active_head; 119 struct list_head slave_active_head;
132 snd_timer_instance_t *master; 120 struct snd_timer_instance *master;
133}; 121};
134 122
135/* 123/*
136 * Registering 124 * Registering
137 */ 125 */
138 126
139extern int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t ** rtimer); 127int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, struct snd_timer **rtimer);
140extern void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct timespec *tstamp); 128void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstamp);
141extern int snd_timer_global_new(char *id, int device, snd_timer_t **rtimer); 129int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer);
142extern int snd_timer_global_free(snd_timer_t *timer); 130int snd_timer_global_free(struct snd_timer *timer);
143extern int snd_timer_global_register(snd_timer_t *timer); 131int snd_timer_global_register(struct snd_timer *timer);
144extern int snd_timer_global_unregister(snd_timer_t *timer); 132int snd_timer_global_unregister(struct snd_timer *timer);
145 133
146extern int snd_timer_open(snd_timer_instance_t ** ti, char *owner, snd_timer_id_t *tid, unsigned int slave_id); 134int snd_timer_open(struct snd_timer_instance **ti, char *owner, struct snd_timer_id *tid, unsigned int slave_id);
147extern int snd_timer_close(snd_timer_instance_t * timeri); 135int snd_timer_close(struct snd_timer_instance *timeri);
148extern unsigned long snd_timer_resolution(snd_timer_instance_t * timeri); 136unsigned long snd_timer_resolution(struct snd_timer_instance *timeri);
149extern int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks); 137int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks);
150extern int snd_timer_stop(snd_timer_instance_t * timeri); 138int snd_timer_stop(struct snd_timer_instance *timeri);
151extern int snd_timer_continue(snd_timer_instance_t * timeri); 139int snd_timer_continue(struct snd_timer_instance *timeri);
152extern int snd_timer_pause(snd_timer_instance_t * timeri); 140int snd_timer_pause(struct snd_timer_instance *timeri);
153 141
154extern void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left); 142void snd_timer_interrupt(struct snd_timer *timer, unsigned long ticks_left);
155 143
156#endif /* __SOUND_TIMER_H */ 144#endif /* __SOUND_TIMER_H */
diff --git a/include/sound/trident.h b/include/sound/trident.h
index a408d3925050..9752243241e5 100644
--- a/include/sound/trident.h
+++ b/include/sound/trident.h
@@ -253,43 +253,43 @@ enum serial_intf_ctrl_bits {
253#define T4D_DEFAULT_PCM_RVOL 127 /* 0 - 127 */ 253#define T4D_DEFAULT_PCM_RVOL 127 /* 0 - 127 */
254#define T4D_DEFAULT_PCM_CVOL 127 /* 0 - 127 */ 254#define T4D_DEFAULT_PCM_CVOL 127 /* 0 - 127 */
255 255
256typedef struct _snd_trident trident_t; 256struct snd_trident;
257typedef struct _snd_trident_voice snd_trident_voice_t; 257struct snd_trident_voice;
258typedef struct _snd_trident_pcm_mixer snd_trident_pcm_mixer_t; 258struct snd_trident_pcm_mixer;
259 259
260typedef struct { 260struct snd_trident_sample_ops {
261 void (*sample_start)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_position_t position); 261 void (*sample_start)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_position_t position);
262 void (*sample_stop)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_stop_mode_t mode); 262 void (*sample_stop)(struct snd_trident *gus, struct snd_trident_voice *voice, int mode);
263 void (*sample_freq)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_frequency_t freq); 263 void (*sample_freq)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_frequency_t freq);
264 void (*sample_volume)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_ev_volume_t *volume); 264 void (*sample_volume)(struct snd_trident *gus, struct snd_trident_voice *voice, struct snd_seq_ev_volume *volume);
265 void (*sample_loop)(trident_t *card, snd_trident_voice_t *voice, snd_seq_ev_loop_t *loop); 265 void (*sample_loop)(struct snd_trident *card, struct snd_trident_voice *voice, struct snd_seq_ev_loop *loop);
266 void (*sample_pos)(trident_t *card, snd_trident_voice_t *voice, snd_seq_position_t position); 266 void (*sample_pos)(struct snd_trident *card, struct snd_trident_voice *voice, snd_seq_position_t position);
267 void (*sample_private1)(trident_t *card, snd_trident_voice_t *voice, unsigned char *data); 267 void (*sample_private1)(struct snd_trident *card, struct snd_trident_voice *voice, unsigned char *data);
268} snd_trident_sample_ops_t; 268};
269 269
270typedef struct { 270struct snd_trident_port {
271 snd_midi_channel_set_t * chset; 271 struct snd_midi_channel_set * chset;
272 trident_t * trident; 272 struct snd_trident * trident;
273 int mode; /* operation mode */ 273 int mode; /* operation mode */
274 int client; /* sequencer client number */ 274 int client; /* sequencer client number */
275 int port; /* sequencer port number */ 275 int port; /* sequencer port number */
276 unsigned int midi_has_voices: 1; 276 unsigned int midi_has_voices: 1;
277} snd_trident_port_t; 277};
278 278
279typedef struct snd_trident_memblk_arg { 279struct snd_trident_memblk_arg {
280 short first_page, last_page; 280 short first_page, last_page;
281} snd_trident_memblk_arg_t; 281};
282 282
283typedef struct { 283struct snd_trident_tlb {
284 unsigned int * entries; /* 16k-aligned TLB table */ 284 unsigned int * entries; /* 16k-aligned TLB table */
285 dma_addr_t entries_dmaaddr; /* 16k-aligned PCI address to TLB table */ 285 dma_addr_t entries_dmaaddr; /* 16k-aligned PCI address to TLB table */
286 unsigned long * shadow_entries; /* shadow entries with virtual addresses */ 286 unsigned long * shadow_entries; /* shadow entries with virtual addresses */
287 struct snd_dma_buffer buffer; 287 struct snd_dma_buffer buffer;
288 snd_util_memhdr_t * memhdr; /* page allocation list */ 288 struct snd_util_memhdr * memhdr; /* page allocation list */
289 struct snd_dma_buffer silent_page; 289 struct snd_dma_buffer silent_page;
290} snd_trident_tlb_t; 290};
291 291
292struct _snd_trident_voice { 292struct snd_trident_voice {
293 unsigned int number; 293 unsigned int number;
294 unsigned int use: 1, 294 unsigned int use: 1,
295 pcm: 1, 295 pcm: 1,
@@ -300,8 +300,8 @@ struct _snd_trident_voice {
300 unsigned char port; 300 unsigned char port;
301 unsigned char index; 301 unsigned char index;
302 302
303 snd_seq_instr_t instr; 303 struct snd_seq_instr instr;
304 snd_trident_sample_ops_t *sample_ops; 304 struct snd_trident_sample_ops *sample_ops;
305 305
306 /* channel parameters */ 306 /* channel parameters */
307 unsigned int CSO; /* 24 bits (16 on DX) */ 307 unsigned int CSO; /* 24 bits (16 on DX) */
@@ -323,13 +323,13 @@ struct _snd_trident_voice {
323 323
324 unsigned int negCSO; /* nonzero - use negative CSO */ 324 unsigned int negCSO; /* nonzero - use negative CSO */
325 325
326 snd_util_memblk_t *memblk; /* memory block if TLB enabled */ 326 struct snd_util_memblk *memblk; /* memory block if TLB enabled */
327 327
328 /* PCM data */ 328 /* PCM data */
329 329
330 trident_t *trident; 330 struct snd_trident *trident;
331 snd_pcm_substream_t *substream; 331 struct snd_pcm_substream *substream;
332 snd_trident_voice_t *extra; /* extra PCM voice (acts as interrupt generator) */ 332 struct snd_trident_voice *extra; /* extra PCM voice (acts as interrupt generator) */
333 unsigned int running: 1, 333 unsigned int running: 1,
334 capture: 1, 334 capture: 1,
335 spdif: 1, 335 spdif: 1,
@@ -347,25 +347,25 @@ struct _snd_trident_voice {
347 /* --- */ 347 /* --- */
348 348
349 void *private_data; 349 void *private_data;
350 void (*private_free)(snd_trident_voice_t *voice); 350 void (*private_free)(struct snd_trident_voice *voice);
351}; 351};
352 352
353struct _snd_4dwave { 353struct snd_4dwave {
354 int seq_client; 354 int seq_client;
355 355
356 snd_trident_port_t seq_ports[4]; 356 struct snd_trident_port seq_ports[4];
357 snd_simple_ops_t simple_ops; 357 struct snd_simple_ops simple_ops;
358 snd_seq_kinstr_list_t *ilist; 358 struct snd_seq_kinstr_list *ilist;
359 359
360 snd_trident_voice_t voices[64]; 360 struct snd_trident_voice voices[64];
361 361
362 int ChanSynthCount; /* number of allocated synth channels */ 362 int ChanSynthCount; /* number of allocated synth channels */
363 int max_size; /* maximum synth memory size in bytes */ 363 int max_size; /* maximum synth memory size in bytes */
364 int current_size; /* current allocated synth mem in bytes */ 364 int current_size; /* current allocated synth mem in bytes */
365}; 365};
366 366
367struct _snd_trident_pcm_mixer { 367struct snd_trident_pcm_mixer {
368 snd_trident_voice_t *voice; /* active voice */ 368 struct snd_trident_voice *voice; /* active voice */
369 unsigned short vol; /* front volume */ 369 unsigned short vol; /* front volume */
370 unsigned char pan; /* pan control */ 370 unsigned char pan; /* pan control */
371 unsigned char rvol; /* rear volume */ 371 unsigned char rvol; /* rear volume */
@@ -373,7 +373,7 @@ struct _snd_trident_pcm_mixer {
373 unsigned char pad; 373 unsigned char pad;
374}; 374};
375 375
376struct _snd_trident { 376struct snd_trident {
377 int irq; 377 int irq;
378 378
379 unsigned int device; /* device ID */ 379 unsigned int device; /* device ID */
@@ -386,13 +386,13 @@ struct _snd_trident {
386 unsigned int spurious_irq_count; 386 unsigned int spurious_irq_count;
387 unsigned int spurious_irq_max_delta; 387 unsigned int spurious_irq_max_delta;
388 388
389 snd_trident_tlb_t tlb; /* TLB entries for NX cards */ 389 struct snd_trident_tlb tlb; /* TLB entries for NX cards */
390 390
391 unsigned char spdif_ctrl; 391 unsigned char spdif_ctrl;
392 unsigned char spdif_pcm_ctrl; 392 unsigned char spdif_pcm_ctrl;
393 unsigned int spdif_bits; 393 unsigned int spdif_bits;
394 unsigned int spdif_pcm_bits; 394 unsigned int spdif_pcm_bits;
395 snd_kcontrol_t *spdif_pcm_ctl; /* S/PDIF settings */ 395 struct snd_kcontrol *spdif_pcm_ctl; /* S/PDIF settings */
396 unsigned int ac97_ctrl; 396 unsigned int ac97_ctrl;
397 397
398 unsigned int ChanMap[2]; /* allocation map for hardware channels */ 398 unsigned int ChanMap[2]; /* allocation map for hardware channels */
@@ -403,7 +403,7 @@ struct _snd_trident {
403 unsigned int ac97_detect: 1; /* 1 = AC97 in detection phase */ 403 unsigned int ac97_detect: 1; /* 1 = AC97 in detection phase */
404 unsigned int in_suspend: 1; /* 1 during suspend/resume */ 404 unsigned int in_suspend: 1; /* 1 during suspend/resume */
405 405
406 struct _snd_4dwave synth; /* synth specific variables */ 406 struct snd_4dwave synth; /* synth specific variables */
407 407
408 spinlock_t event_lock; 408 spinlock_t event_lock;
409 spinlock_t voice_alloc; 409 spinlock_t voice_alloc;
@@ -411,52 +411,57 @@ struct _snd_trident {
411 struct snd_dma_device dma_dev; 411 struct snd_dma_device dma_dev;
412 412
413 struct pci_dev *pci; 413 struct pci_dev *pci;
414 snd_card_t *card; 414 struct snd_card *card;
415 snd_pcm_t *pcm; /* ADC/DAC PCM */ 415 struct snd_pcm *pcm; /* ADC/DAC PCM */
416 snd_pcm_t *foldback; /* Foldback PCM */ 416 struct snd_pcm *foldback; /* Foldback PCM */
417 snd_pcm_t *spdif; /* SPDIF PCM */ 417 struct snd_pcm *spdif; /* SPDIF PCM */
418 snd_rawmidi_t *rmidi; 418 struct snd_rawmidi *rmidi;
419 snd_seq_device_t *seq_dev; 419 struct snd_seq_device *seq_dev;
420 420
421 ac97_bus_t *ac97_bus; 421 struct snd_ac97_bus *ac97_bus;
422 ac97_t *ac97; 422 struct snd_ac97 *ac97;
423 ac97_t *ac97_sec; 423 struct snd_ac97 *ac97_sec;
424 424
425 unsigned int musicvol_wavevol; 425 unsigned int musicvol_wavevol;
426 snd_trident_pcm_mixer_t pcm_mixer[32]; 426 struct snd_trident_pcm_mixer pcm_mixer[32];
427 snd_kcontrol_t *ctl_vol; /* front volume */ 427 struct snd_kcontrol *ctl_vol; /* front volume */
428 snd_kcontrol_t *ctl_pan; /* pan */ 428 struct snd_kcontrol *ctl_pan; /* pan */
429 snd_kcontrol_t *ctl_rvol; /* rear volume */ 429 struct snd_kcontrol *ctl_rvol; /* rear volume */
430 snd_kcontrol_t *ctl_cvol; /* center volume */ 430 struct snd_kcontrol *ctl_cvol; /* center volume */
431 431
432 spinlock_t reg_lock; 432 spinlock_t reg_lock;
433 433
434 struct gameport *gameport; 434 struct gameport *gameport;
435}; 435};
436 436
437int snd_trident_create(snd_card_t * card, 437int snd_trident_create(struct snd_card *card,
438 struct pci_dev *pci, 438 struct pci_dev *pci,
439 int pcm_streams, 439 int pcm_streams,
440 int pcm_spdif_device, 440 int pcm_spdif_device,
441 int max_wavetable_size, 441 int max_wavetable_size,
442 trident_t ** rtrident); 442 struct snd_trident ** rtrident);
443int snd_trident_create_gameport(trident_t *trident); 443int snd_trident_create_gameport(struct snd_trident *trident);
444 444
445int snd_trident_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); 445int snd_trident_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm);
446int snd_trident_foldback_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); 446int snd_trident_foldback_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm);
447int snd_trident_spdif_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); 447int snd_trident_spdif_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm);
448int snd_trident_attach_synthesizer(trident_t * trident); 448int snd_trident_attach_synthesizer(struct snd_trident * trident);
449snd_trident_voice_t *snd_trident_alloc_voice(trident_t * trident, int type, int client, int port); 449struct snd_trident_voice *snd_trident_alloc_voice(struct snd_trident * trident, int type,
450void snd_trident_free_voice(trident_t * trident, snd_trident_voice_t *voice); 450 int client, int port);
451void snd_trident_start_voice(trident_t * trident, unsigned int voice); 451void snd_trident_free_voice(struct snd_trident * trident, struct snd_trident_voice *voice);
452void snd_trident_stop_voice(trident_t * trident, unsigned int voice); 452void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice);
453void snd_trident_write_voice_regs(trident_t * trident, snd_trident_voice_t *voice); 453void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice);
454void snd_trident_write_voice_regs(struct snd_trident * trident, struct snd_trident_voice *voice);
455int snd_trident_suspend(struct pci_dev *pci, pm_message_t state);
456int snd_trident_resume(struct pci_dev *pci);
454 457
455/* TLB memory allocation */ 458/* TLB memory allocation */
456snd_util_memblk_t *snd_trident_alloc_pages(trident_t *trident, snd_pcm_substream_t *substream); 459struct snd_util_memblk *snd_trident_alloc_pages(struct snd_trident *trident,
457int snd_trident_free_pages(trident_t *trident, snd_util_memblk_t *blk); 460 struct snd_pcm_substream *substream);
458snd_util_memblk_t *snd_trident_synth_alloc(trident_t *trident, unsigned int size); 461int snd_trident_free_pages(struct snd_trident *trident, struct snd_util_memblk *blk);
459int snd_trident_synth_free(trident_t *trident, snd_util_memblk_t *blk); 462struct snd_util_memblk *snd_trident_synth_alloc(struct snd_trident *trident, unsigned int size);
460int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char __user *data, int size); 463int snd_trident_synth_free(struct snd_trident *trident, struct snd_util_memblk *blk);
464int snd_trident_synth_copy_from_user(struct snd_trident *trident, struct snd_util_memblk *blk,
465 int offset, const char __user *data, int size);
461 466
462#endif /* __SOUND_TRIDENT_H */ 467#endif /* __SOUND_TRIDENT_H */
diff --git a/include/sound/typedefs.h b/include/sound/typedefs.h
new file mode 100644
index 000000000000..f454b0206b93
--- /dev/null
+++ b/include/sound/typedefs.h
@@ -0,0 +1,173 @@
1/*
2 * Typedef's for backward compatibility (for out-of-kernel drivers)
3 *
4 * This file will be removed soon in future
5 */
6
7/* core stuff */
8typedef struct snd_card snd_card_t;
9typedef struct snd_device snd_device_t;
10typedef struct snd_device_ops snd_device_ops_t;
11typedef enum snd_card_type snd_card_type_t;
12typedef struct snd_minor snd_minor_t;
13
14/* info */
15typedef struct snd_info_entry snd_info_entry_t;
16typedef struct snd_info_buffer snd_info_buffer_t;
17
18/* control */
19typedef struct snd_ctl_file snd_ctl_file_t;
20typedef struct snd_kcontrol snd_kcontrol_t;
21typedef struct snd_kcontrol_new snd_kcontrol_new_t;
22typedef struct snd_kcontrol_volatile snd_kcontrol_volatile_t;
23typedef struct snd_kctl_event snd_kctl_event_t;
24typedef struct snd_aes_iec958 snd_aes_iec958_t;
25typedef struct snd_ctl_card_info snd_ctl_card_info_t;
26typedef struct snd_ctl_elem_id snd_ctl_elem_id_t;
27typedef struct snd_ctl_elem_list snd_ctl_elem_list_t;
28typedef struct snd_ctl_elem_info snd_ctl_elem_info_t;
29typedef struct snd_ctl_elem_value snd_ctl_elem_value_t;
30typedef struct snd_ctl_event snd_ctl_event_t;
31#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
32typedef struct snd_mixer_oss snd_mixer_oss_t;
33#endif
34
35/* timer */
36typedef struct snd_timer snd_timer_t;
37typedef struct snd_timer_instance snd_timer_instance_t;
38typedef struct snd_timer_id snd_timer_id_t;
39typedef struct snd_timer_ginfo snd_timer_ginfo_t;
40typedef struct snd_timer_gparams snd_timer_gparams_t;
41typedef struct snd_timer_gstatus snd_timer_gstatus_t;
42typedef struct snd_timer_select snd_timer_select_t;
43typedef struct snd_timer_info snd_timer_info_t;
44typedef struct snd_timer_params snd_timer_params_t;
45typedef struct snd_timer_status snd_timer_status_t;
46typedef struct snd_timer_read snd_timer_read_t;
47typedef struct snd_timer_tread snd_timer_tread_t;
48
49/* PCM */
50typedef struct snd_pcm snd_pcm_t;
51typedef struct snd_pcm_str snd_pcm_str_t;
52typedef struct snd_pcm_substream snd_pcm_substream_t;
53typedef struct snd_pcm_info snd_pcm_info_t;
54typedef struct snd_pcm_hw_params snd_pcm_hw_params_t;
55typedef struct snd_pcm_sw_params snd_pcm_sw_params_t;
56typedef struct snd_pcm_channel_info snd_pcm_channel_info_t;
57typedef struct snd_pcm_status snd_pcm_status_t;
58typedef struct snd_pcm_mmap_status snd_pcm_mmap_status_t;
59typedef struct snd_pcm_mmap_control snd_pcm_mmap_control_t;
60typedef struct snd_mask snd_mask_t;
61typedef struct snd_sg_buf snd_pcm_sgbuf_t;
62
63typedef struct snd_interval snd_interval_t;
64typedef struct snd_xferi snd_xferi_t;
65typedef struct snd_xfern snd_xfern_t;
66typedef struct snd_xferv snd_xferv_t;
67
68typedef struct snd_pcm_file snd_pcm_file_t;
69typedef struct snd_pcm_runtime snd_pcm_runtime_t;
70typedef struct snd_pcm_hardware snd_pcm_hardware_t;
71typedef struct snd_pcm_ops snd_pcm_ops_t;
72typedef struct snd_pcm_hw_rule snd_pcm_hw_rule_t;
73typedef struct snd_pcm_hw_constraints snd_pcm_hw_constraints_t;
74typedef struct snd_ratnum ratnum_t;
75typedef struct snd_ratden ratden_t;
76typedef struct snd_pcm_hw_constraint_ratnums snd_pcm_hw_constraint_ratnums_t;
77typedef struct snd_pcm_hw_constraint_ratdens snd_pcm_hw_constraint_ratdens_t;
78typedef struct snd_pcm_hw_constraint_list snd_pcm_hw_constraint_list_t;
79typedef struct snd_pcm_group snd_pcm_group_t;
80typedef struct snd_pcm_notify snd_pcm_notify_t;
81
82/* rawmidi */
83typedef struct snd_rawmidi snd_rawmidi_t;
84typedef struct snd_rawmidi_info snd_rawmidi_info_t;
85typedef struct snd_rawmidi_params snd_rawmidi_params_t;
86typedef struct snd_rawmidi_status snd_rawmidi_status_t;
87typedef struct snd_rawmidi_runtime snd_rawmidi_runtime_t;
88typedef struct snd_rawmidi_substream snd_rawmidi_substream_t;
89typedef struct snd_rawmidi_str snd_rawmidi_str_t;
90typedef struct snd_rawmidi_ops snd_rawmidi_ops_t;
91typedef struct snd_rawmidi_global_ops snd_rawmidi_global_ops_t;
92typedef struct snd_rawmidi_file snd_rawmidi_file_t;
93
94/* hwdep */
95typedef struct snd_hwdep snd_hwdep_t;
96typedef struct snd_hwdep_info snd_hwdep_info_t;
97typedef struct snd_hwdep_dsp_status snd_hwdep_dsp_status_t;
98typedef struct snd_hwdep_dsp_image snd_hwdep_dsp_image_t;
99typedef struct snd_hwdep_ops snd_hwdep_ops_t;
100
101/* sequencer */
102typedef struct snd_seq_port_info snd_seq_port_info_t;
103typedef struct snd_seq_port_subscribe snd_seq_port_subscribe_t;
104typedef struct snd_seq_event snd_seq_event_t;
105typedef struct snd_seq_addr snd_seq_addr_t;
106typedef struct snd_seq_ev_volume snd_seq_ev_volume_t;
107typedef struct snd_seq_ev_loop snd_seq_ev_loop_t;
108typedef struct snd_seq_remove_events snd_seq_remove_events_t;
109typedef struct snd_seq_query_subs snd_seq_query_subs_t;
110typedef struct snd_seq_system_info snd_seq_system_info_t;
111typedef struct snd_seq_client_info snd_seq_client_info_t;
112typedef struct snd_seq_queue_info snd_seq_queue_info_t;
113typedef struct snd_seq_queue_status snd_seq_queue_status_t;
114typedef struct snd_seq_queue_tempo snd_seq_queue_tempo_t;
115typedef struct snd_seq_queue_owner snd_seq_queue_owner_t;
116typedef struct snd_seq_queue_timer snd_seq_queue_timer_t;
117typedef struct snd_seq_queue_client snd_seq_queue_client_t;
118typedef struct snd_seq_client_pool snd_seq_client_pool_t;
119typedef struct snd_seq_instr snd_seq_instr_t;
120typedef struct snd_seq_instr_data snd_seq_instr_data_t;
121typedef struct snd_seq_instr_header snd_seq_instr_header_t;
122
123typedef struct snd_seq_user_client user_client_t;
124typedef struct snd_seq_kernel_client kernel_client_t;
125typedef struct snd_seq_client client_t;
126typedef struct snd_seq_queue queue_t;
127
128/* seq_device */
129typedef struct snd_seq_device snd_seq_device_t;
130typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
131
132/* seq_midi */
133typedef struct snd_midi_event snd_midi_event_t;
134
135/* seq_midi_emul */
136typedef struct snd_midi_channel snd_midi_channel_t;
137typedef struct snd_midi_channel_set snd_midi_channel_set_t;
138typedef struct snd_midi_op snd_midi_op_t;
139
140/* seq_oss */
141typedef struct snd_seq_oss_arg snd_seq_oss_arg_t;
142typedef struct snd_seq_oss_callback snd_seq_oss_callback_t;
143typedef struct snd_seq_oss_reg snd_seq_oss_reg_t;
144
145/* virmidi */
146typedef struct snd_virmidi_dev snd_virmidi_dev_t;
147typedef struct snd_virmidi snd_virmidi_t;
148
149/* seq_instr */
150typedef struct snd_seq_kcluster snd_seq_kcluster_t;
151typedef struct snd_seq_kinstr_ops snd_seq_kinstr_ops_t;
152typedef struct snd_seq_kinstr snd_seq_kinstr_t;
153typedef struct snd_seq_kinstr_list snd_seq_kinstr_list_t;
154
155/* ac97 */
156typedef struct snd_ac97_bus ac97_bus_t;
157typedef struct snd_ac97_bus_ops ac97_bus_ops_t;
158typedef struct snd_ac97_template ac97_template_t;
159typedef struct snd_ac97 ac97_t;
160
161/* opl3/4 */
162typedef struct snd_opl3 opl3_t;
163typedef struct snd_opl4 opl4_t;
164
165/* mpu401 */
166typedef struct snd_mpu401 mpu401_t;
167
168/* i2c */
169typedef struct snd_i2c_device snd_i2c_device_t;
170typedef struct snd_i2c_bus snd_i2c_bus_t;
171
172typedef struct snd_ak4531 ak4531_t;
173
diff --git a/include/sound/uda1341.h b/include/sound/uda1341.h
index 61ff65a628bc..2e564bfb37fe 100644
--- a/include/sound/uda1341.h
+++ b/include/sound/uda1341.h
@@ -15,7 +15,7 @@
15 * features support 15 * features support
16 */ 16 */
17 17
18/* $Id: uda1341.h,v 1.6 2004/05/03 17:36:50 tiwai Exp $ */ 18/* $Id: uda1341.h,v 1.8 2005/11/17 14:17:21 tiwai Exp $ */
19 19
20#define UDA1341_ALSA_NAME "snd-uda1341" 20#define UDA1341_ALSA_NAME "snd-uda1341"
21 21
@@ -37,11 +37,6 @@ enum uda1341_onoff {
37 ON, 37 ON,
38}; 38};
39 39
40const char *onoff_names[] = {
41 "Off",
42 "On",
43};
44
45enum uda1341_format { 40enum uda1341_format {
46 I2S=0, 41 I2S=0,
47 LSB16, 42 LSB16,
@@ -53,17 +48,6 @@ enum uda1341_format {
53 LSB20MSB, 48 LSB20MSB,
54}; 49};
55 50
56const char *format_names[] = {
57 "I2S-bus",
58 "LSB 16bits",
59 "LSB 18bits",
60 "LSB 20bits",
61 "MSB",
62 "in LSB 16bits/out MSB",
63 "in LSB 18bits/out MSB",
64 "in LSB 20bits/out MSB",
65};
66
67enum uda1341_fs { 51enum uda1341_fs {
68 F512=0, 52 F512=0,
69 F384, 53 F384,
@@ -71,23 +55,11 @@ enum uda1341_fs {
71 Funused, 55 Funused,
72}; 56};
73 57
74const char *fs_names[] = {
75 "512*fs",
76 "384*fs",
77 "256*fs",
78 "Unused - bad value!",
79};
80
81enum uda1341_peak { 58enum uda1341_peak {
82 BEFORE=0, 59 BEFORE=0,
83 AFTER, 60 AFTER,
84}; 61};
85 62
86const char *peak_names[] = {
87 "before",
88 "after",
89};
90
91enum uda1341_filter { 63enum uda1341_filter {
92 FLAT=0, 64 FLAT=0,
93 MIN, 65 MIN,
@@ -95,24 +67,6 @@ enum uda1341_filter {
95 MAX, 67 MAX,
96}; 68};
97 69
98const char *filter_names[] = {
99 "flat",
100 "min",
101 "min",
102 "max",
103};
104
105const char*bass_values[][16] = {
106 {"0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB",
107 "0 dB", "0 dB", "0 dB", "0 dB", "undefined", }, //flat
108 {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB",
109 "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min
110 {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB",
111 "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min
112 {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "20 dB",
113 "22 dB", "24 dB", "24 dB", "24 dB", "undefined",}, // max
114};
115
116enum uda1341_mixer { 70enum uda1341_mixer {
117 DOUBLE, 71 DOUBLE,
118 LINE, 72 LINE,
@@ -120,13 +74,6 @@ enum uda1341_mixer {
120 MIXER, 74 MIXER,
121}; 75};
122 76
123const char *mixer_names[] = {
124 "double differential",
125 "input channel 1 (line in)",
126 "input channel 2 (microphone)",
127 "digital mixer",
128};
129
130enum uda1341_deemp { 77enum uda1341_deemp {
131 NONE, 78 NONE,
132 D32, 79 D32,
@@ -134,58 +81,6 @@ enum uda1341_deemp {
134 D48, 81 D48,
135}; 82};
136 83
137const char *deemp_names[] = {
138 "none",
139 "32 kHz",
140 "44.1 kHz",
141 "48 kHz",
142};
143
144const char *mic_sens_value[] = {
145 "-3 dB", "0 dB", "3 dB", "9 dB", "15 dB", "21 dB", "27 dB", "not used",
146};
147
148const unsigned short AGC_atime[] = {
149 11, 16, 11, 16, 21, 11, 16, 21,
150};
151
152const unsigned short AGC_dtime[] = {
153 100, 100, 200, 200, 200, 400, 400, 400,
154};
155
156const char *AGC_level[] = {
157 "-9.0", "-11.5", "-15.0", "-17.5",
158};
159
160const char *ig_small_value[] = {
161 "-3.0", "-2.5", "-2.0", "-1.5", "-1.0", "-0.5",
162};
163
164/*
165 * this was computed as peak_value[i] = pow((63-i)*1.42,1.013)
166 *
167 * UDA1341 datasheet on page 21: Peak value (dB) = (Peak level - 63.5)*5*log2
168 * There is an table with these values [level]=value: [3]=-90.31, [7]=-84.29
169 * [61]=-2.78, [62] = -1.48, [63] = 0.0
170 * I tried to compute it, but using but even using logarithm with base either 10 or 2
171 * i was'n able to get values in the table from the formula. So I constructed another
172 * formula (see above) to interpolate the values as good as possible. If there is some
173 * mistake, please contact me on tomas.kasparek@seznam.cz. Thanks.
174 * UDA1341TS datasheet is available at:
175 * http://www-us9.semiconductors.com/acrobat/datasheets/UDA1341TS_3.pdf
176 */
177const char *peak_value[] = {
178 "-INF dB", "N.A.", "N.A", "90.31 dB", "N.A.", "N.A.", "N.A.", "-84.29 dB",
179 "-82.65 dB", "-81.13 dB", "-79.61 dB", "-78.09 dB", "-76.57 dB", "-75.05 dB", "-73.53 dB",
180 "-72.01 dB", "-70.49 dB", "-68.97 dB", "-67.45 dB", "-65.93 dB", "-64.41 dB", "-62.90 dB",
181 "-61.38 dB", "-59.86 dB", "-58.35 dB", "-56.83 dB", "-55.32 dB", "-53.80 dB", "-52.29 dB",
182 "-50.78 dB", "-49.26 dB", "-47.75 dB", "-46.24 dB", "-44.73 dB", "-43.22 dB", "-41.71 dB",
183 "-40.20 dB", "-38.69 dB", "-37.19 dB", "-35.68 dB", "-34.17 dB", "-32.67 dB", "-31.17 dB",
184 "-29.66 dB", "-28.16 dB", "-26.66 dB", "-25.16 dB", "-23.66 dB", "-22.16 dB", "-20.67 dB",
185 "-19.17 dB", "-17.68 dB", "-16.19 dB", "-14.70 dB", "-13.21 dB", "-11.72 dB", "-10.24 dB",
186 "-8.76 dB", "-7.28 dB", "-5.81 dB", "-4.34 dB", "-2.88 dB", "-1.43 dB", "0.00 dB",
187};
188
189enum uda1341_config { 84enum uda1341_config {
190 CMD_READ_REG = 0, 85 CMD_READ_REG = 0,
191 CMD_RESET, 86 CMD_RESET,
@@ -224,7 +119,7 @@ enum write_through {
224 FLUSH, 119 FLUSH,
225}; 120};
226 121
227int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clnt); 122int __init snd_chip_uda1341_mixer_new(struct snd_card *card, struct l3_client **clnt);
228 123
229/* 124/*
230 * Local variables: 125 * Local variables:
diff --git a/include/sound/util_mem.h b/include/sound/util_mem.h
index 9d2cdfa0c42a..69944bbb5445 100644
--- a/include/sound/util_mem.h
+++ b/include/sound/util_mem.h
@@ -20,29 +20,25 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23typedef struct snd_util_memblk snd_util_memblk_t;
24typedef struct snd_util_memhdr snd_util_memhdr_t;
25typedef unsigned int snd_util_unit_t;
26
27/* 23/*
28 * memory block 24 * memory block
29 */ 25 */
30struct snd_util_memblk { 26struct snd_util_memblk {
31 snd_util_unit_t size; /* size of this block */ 27 unsigned int size; /* size of this block */
32 snd_util_unit_t offset; /* zero-offset of this block */ 28 unsigned int offset; /* zero-offset of this block */
33 struct list_head list; /* link */ 29 struct list_head list; /* link */
34}; 30};
35 31
36#define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(snd_util_memblk_t)) 32#define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(struct snd_util_memblk))
37 33
38/* 34/*
39 * memory management information 35 * memory management information
40 */ 36 */
41struct snd_util_memhdr { 37struct snd_util_memhdr {
42 snd_util_unit_t size; /* size of whole data */ 38 unsigned int size; /* size of whole data */
43 struct list_head block; /* block linked-list header */ 39 struct list_head block; /* block linked-list header */
44 int nblocks; /* # of allocated blocks */ 40 int nblocks; /* # of allocated blocks */
45 snd_util_unit_t used; /* used memory size */ 41 unsigned int used; /* used memory size */
46 int block_extra_size; /* extra data size of chunk */ 42 int block_extra_size; /* extra data size of chunk */
47 struct semaphore block_mutex; /* lock */ 43 struct semaphore block_mutex; /* lock */
48}; 44};
@@ -50,15 +46,17 @@ struct snd_util_memhdr {
50/* 46/*
51 * prototypes 47 * prototypes
52 */ 48 */
53snd_util_memhdr_t *snd_util_memhdr_new(int memsize); 49struct snd_util_memhdr *snd_util_memhdr_new(int memsize);
54void snd_util_memhdr_free(snd_util_memhdr_t *hdr); 50void snd_util_memhdr_free(struct snd_util_memhdr *hdr);
55snd_util_memblk_t *snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); 51struct snd_util_memblk *snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size);
56int snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); 52int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk);
57int snd_util_mem_avail(snd_util_memhdr_t *hdr); 53int snd_util_mem_avail(struct snd_util_memhdr *hdr);
58 54
59/* functions without mutex */ 55/* functions without mutex */
60snd_util_memblk_t *__snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); 56struct snd_util_memblk *__snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size);
61void __snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); 57void __snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk);
62snd_util_memblk_t *__snd_util_memblk_new(snd_util_memhdr_t *hdr, snd_util_unit_t units, struct list_head *prev); 58struct snd_util_memblk *__snd_util_memblk_new(struct snd_util_memhdr *hdr,
59 unsigned int units,
60 struct list_head *prev);
63 61
64#endif /* __SOUND_UTIL_MEM_H */ 62#endif /* __SOUND_UTIL_MEM_H */
diff --git a/include/sound/version.h b/include/sound/version.h
index d1bd3b723967..919da0dd001c 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by configure. */ 1/* include/version.h. Generated by configure. */
2#define CONFIG_SND_VERSION "1.0.10rc3" 2#define CONFIG_SND_VERSION "1.0.11rc2"
3#define CONFIG_SND_DATE " (Mon Nov 07 13:30:21 2005 UTC)" 3#define CONFIG_SND_DATE " (Wed Jan 04 08:57:20 2006 UTC)"
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index 7a60a3888667..5fd6f3305e0d 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -36,9 +36,6 @@
36struct firmware; 36struct firmware;
37struct device; 37struct device;
38 38
39typedef struct snd_vx_core vx_core_t;
40typedef struct vx_pipe vx_pipe_t;
41
42#define VX_DRIVER_VERSION 0x010000 /* 1.0.0 */ 39#define VX_DRIVER_VERSION 0x010000 /* 1.0.0 */
43 40
44/* 41/*
@@ -76,7 +73,7 @@ struct vx_pipe {
76 int channels; 73 int channels;
77 unsigned int differed_type; 74 unsigned int differed_type;
78 pcx_time_t pcx_time; 75 pcx_time_t pcx_time;
79 snd_pcm_substream_t *substream; 76 struct snd_pcm_substream *substream;
80 77
81 int hbuf_size; /* H-buffer size in bytes */ 78 int hbuf_size; /* H-buffer size in bytes */
82 int buffer_bytes; /* the ALSA pcm buffer size in bytes */ 79 int buffer_bytes; /* the ALSA pcm buffer size in bytes */
@@ -88,36 +85,38 @@ struct vx_pipe {
88 u64 cur_count; /* current sample position (for playback) */ 85 u64 cur_count; /* current sample position (for playback) */
89 86
90 unsigned int references; /* an output pipe may be used for monitoring and/or playback */ 87 unsigned int references; /* an output pipe may be used for monitoring and/or playback */
91 vx_pipe_t *monitoring_pipe; /* pointer to the monitoring pipe (capture pipe only)*/ 88 struct vx_pipe *monitoring_pipe; /* pointer to the monitoring pipe (capture pipe only)*/
92 89
93 struct tasklet_struct start_tq; 90 struct tasklet_struct start_tq;
94}; 91};
95 92
93struct vx_core;
94
96struct snd_vx_ops { 95struct snd_vx_ops {
97 /* low-level i/o */ 96 /* low-level i/o */
98 unsigned char (*in8)(vx_core_t *chip, int reg); 97 unsigned char (*in8)(struct vx_core *chip, int reg);
99 unsigned int (*in32)(vx_core_t *chip, int reg); 98 unsigned int (*in32)(struct vx_core *chip, int reg);
100 void (*out8)(vx_core_t *chip, int reg, unsigned char val); 99 void (*out8)(struct vx_core *chip, int reg, unsigned char val);
101 void (*out32)(vx_core_t *chip, int reg, unsigned int val); 100 void (*out32)(struct vx_core *chip, int reg, unsigned int val);
102 /* irq */ 101 /* irq */
103 int (*test_and_ack)(vx_core_t *chip); 102 int (*test_and_ack)(struct vx_core *chip);
104 void (*validate_irq)(vx_core_t *chip, int enable); 103 void (*validate_irq)(struct vx_core *chip, int enable);
105 /* codec */ 104 /* codec */
106 void (*write_codec)(vx_core_t *chip, int codec, unsigned int data); 105 void (*write_codec)(struct vx_core *chip, int codec, unsigned int data);
107 void (*akm_write)(vx_core_t *chip, int reg, unsigned int data); 106 void (*akm_write)(struct vx_core *chip, int reg, unsigned int data);
108 void (*reset_codec)(vx_core_t *chip); 107 void (*reset_codec)(struct vx_core *chip);
109 void (*change_audio_source)(vx_core_t *chip, int src); 108 void (*change_audio_source)(struct vx_core *chip, int src);
110 void (*set_clock_source)(vx_core_t *chp, int src); 109 void (*set_clock_source)(struct vx_core *chp, int src);
111 /* chip init */ 110 /* chip init */
112 int (*load_dsp)(vx_core_t *chip, int idx, const struct firmware *fw); 111 int (*load_dsp)(struct vx_core *chip, int idx, const struct firmware *fw);
113 void (*reset_dsp)(vx_core_t *chip); 112 void (*reset_dsp)(struct vx_core *chip);
114 void (*reset_board)(vx_core_t *chip, int cold_reset); 113 void (*reset_board)(struct vx_core *chip, int cold_reset);
115 int (*add_controls)(vx_core_t *chip); 114 int (*add_controls)(struct vx_core *chip);
116 /* pcm */ 115 /* pcm */
117 void (*dma_write)(vx_core_t *chip, snd_pcm_runtime_t *runtime, 116 void (*dma_write)(struct vx_core *chip, struct snd_pcm_runtime *runtime,
118 vx_pipe_t *pipe, int count); 117 struct vx_pipe *pipe, int count);
119 void (*dma_read)(vx_core_t *chip, snd_pcm_runtime_t *runtime, 118 void (*dma_read)(struct vx_core *chip, struct snd_pcm_runtime *runtime,
120 vx_pipe_t *pipe, int count); 119 struct vx_pipe *pipe, int count);
121}; 120};
122 121
123struct snd_vx_hardware { 122struct snd_vx_hardware {
@@ -158,10 +157,10 @@ enum {
158/* min/max values for analog output for old codecs */ 157/* min/max values for analog output for old codecs */
159#define VX_ANALOG_OUT_LEVEL_MAX 0xe3 158#define VX_ANALOG_OUT_LEVEL_MAX 0xe3
160 159
161struct snd_vx_core { 160struct vx_core {
162 /* ALSA stuff */ 161 /* ALSA stuff */
163 snd_card_t *card; 162 struct snd_card *card;
164 snd_pcm_t *pcm[VX_MAX_CODECS]; 163 struct snd_pcm *pcm[VX_MAX_CODECS];
165 int type; /* VX_TYPE_XXX */ 164 int type; /* VX_TYPE_XXX */
166 165
167 int irq; 166 int irq;
@@ -179,7 +178,7 @@ struct snd_vx_core {
179 unsigned int pcm_running; 178 unsigned int pcm_running;
180 179
181 struct device *dev; 180 struct device *dev;
182 snd_hwdep_t *hwdep; 181 struct snd_hwdep *hwdep;
183 182
184 struct vx_rmh irq_rmh; /* RMH used in interrupts */ 183 struct vx_rmh irq_rmh; /* RMH used in interrupts */
185 184
@@ -216,14 +215,14 @@ struct snd_vx_core {
216/* 215/*
217 * constructor 216 * constructor
218 */ 217 */
219vx_core_t *snd_vx_create(snd_card_t *card, struct snd_vx_hardware *hw, 218struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw,
220 struct snd_vx_ops *ops, int extra_size); 219 struct snd_vx_ops *ops, int extra_size);
221int snd_vx_setup_firmware(vx_core_t *chip); 220int snd_vx_setup_firmware(struct vx_core *chip);
222int snd_vx_load_boot_image(vx_core_t *chip, const struct firmware *dsp); 221int snd_vx_load_boot_image(struct vx_core *chip, const struct firmware *dsp);
223int snd_vx_dsp_boot(vx_core_t *chip, const struct firmware *dsp); 222int snd_vx_dsp_boot(struct vx_core *chip, const struct firmware *dsp);
224int snd_vx_dsp_load(vx_core_t *chip, const struct firmware *dsp); 223int snd_vx_dsp_load(struct vx_core *chip, const struct firmware *dsp);
225 224
226void snd_vx_free_firmware(vx_core_t *chip); 225void snd_vx_free_firmware(struct vx_core *chip);
227 226
228/* 227/*
229 * interrupt handler; exported for pcmcia 228 * interrupt handler; exported for pcmcia
@@ -233,37 +232,37 @@ irqreturn_t snd_vx_irq_handler(int irq, void *dev, struct pt_regs *regs);
233/* 232/*
234 * lowlevel functions 233 * lowlevel functions
235 */ 234 */
236static inline int vx_test_and_ack(vx_core_t *chip) 235static inline int vx_test_and_ack(struct vx_core *chip)
237{ 236{
238 snd_assert(chip->ops->test_and_ack, return -ENXIO); 237 snd_assert(chip->ops->test_and_ack, return -ENXIO);
239 return chip->ops->test_and_ack(chip); 238 return chip->ops->test_and_ack(chip);
240} 239}
241 240
242static inline void vx_validate_irq(vx_core_t *chip, int enable) 241static inline void vx_validate_irq(struct vx_core *chip, int enable)
243{ 242{
244 snd_assert(chip->ops->validate_irq, return); 243 snd_assert(chip->ops->validate_irq, return);
245 chip->ops->validate_irq(chip, enable); 244 chip->ops->validate_irq(chip, enable);
246} 245}
247 246
248static inline unsigned char snd_vx_inb(vx_core_t *chip, int reg) 247static inline unsigned char snd_vx_inb(struct vx_core *chip, int reg)
249{ 248{
250 snd_assert(chip->ops->in8, return 0); 249 snd_assert(chip->ops->in8, return 0);
251 return chip->ops->in8(chip, reg); 250 return chip->ops->in8(chip, reg);
252} 251}
253 252
254static inline unsigned int snd_vx_inl(vx_core_t *chip, int reg) 253static inline unsigned int snd_vx_inl(struct vx_core *chip, int reg)
255{ 254{
256 snd_assert(chip->ops->in32, return 0); 255 snd_assert(chip->ops->in32, return 0);
257 return chip->ops->in32(chip, reg); 256 return chip->ops->in32(chip, reg);
258} 257}
259 258
260static inline void snd_vx_outb(vx_core_t *chip, int reg, unsigned char val) 259static inline void snd_vx_outb(struct vx_core *chip, int reg, unsigned char val)
261{ 260{
262 snd_assert(chip->ops->out8, return); 261 snd_assert(chip->ops->out8, return);
263 chip->ops->out8(chip, reg, val); 262 chip->ops->out8(chip, reg, val);
264} 263}
265 264
266static inline void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val) 265static inline void snd_vx_outl(struct vx_core *chip, int reg, unsigned int val)
267{ 266{
268 snd_assert(chip->ops->out32, return); 267 snd_assert(chip->ops->out32, return);
269 chip->ops->out32(chip, reg, val); 268 chip->ops->out32(chip, reg, val);
@@ -274,27 +273,25 @@ static inline void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val)
274#define vx_inl(chip,reg) snd_vx_inl(chip, VX_##reg) 273#define vx_inl(chip,reg) snd_vx_inl(chip, VX_##reg)
275#define vx_outl(chip,reg,val) snd_vx_outl(chip, VX_##reg,val) 274#define vx_outl(chip,reg,val) snd_vx_outl(chip, VX_##reg,val)
276 275
277void snd_vx_delay(vx_core_t *chip, int msec); 276static inline void vx_reset_dsp(struct vx_core *chip)
278
279static inline void vx_reset_dsp(vx_core_t *chip)
280{ 277{
281 snd_assert(chip->ops->reset_dsp, return); 278 snd_assert(chip->ops->reset_dsp, return);
282 chip->ops->reset_dsp(chip); 279 chip->ops->reset_dsp(chip);
283} 280}
284 281
285int vx_send_msg(vx_core_t *chip, struct vx_rmh *rmh); 282int vx_send_msg(struct vx_core *chip, struct vx_rmh *rmh);
286int vx_send_msg_nolock(vx_core_t *chip, struct vx_rmh *rmh); 283int vx_send_msg_nolock(struct vx_core *chip, struct vx_rmh *rmh);
287int vx_send_rih(vx_core_t *chip, int cmd); 284int vx_send_rih(struct vx_core *chip, int cmd);
288int vx_send_rih_nolock(vx_core_t *chip, int cmd); 285int vx_send_rih_nolock(struct vx_core *chip, int cmd);
289 286
290void vx_reset_codec(vx_core_t *chip, int cold_reset); 287void vx_reset_codec(struct vx_core *chip, int cold_reset);
291 288
292/* 289/*
293 * check the bit on the specified register 290 * check the bit on the specified register
294 * returns zero if a bit matches, or a negative error code. 291 * returns zero if a bit matches, or a negative error code.
295 * exported for vxpocket driver 292 * exported for vxpocket driver
296 */ 293 */
297int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time); 294int snd_vx_check_reg_bit(struct vx_core *chip, int reg, int mask, int bit, int time);
298#define vx_check_isr(chip,mask,bit,time) snd_vx_check_reg_bit(chip, VX_ISR, mask, bit, time) 295#define vx_check_isr(chip,mask,bit,time) snd_vx_check_reg_bit(chip, VX_ISR, mask, bit, time)
299#define vx_wait_isr_bit(chip,bit) vx_check_isr(chip, bit, bit, 200) 296#define vx_wait_isr_bit(chip,bit) vx_check_isr(chip, bit, bit, 200)
300#define vx_wait_for_rx_full(chip) vx_wait_isr_bit(chip, ISR_RX_FULL) 297#define vx_wait_for_rx_full(chip) vx_wait_isr_bit(chip, ISR_RX_FULL)
@@ -303,15 +300,15 @@ int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time);
303/* 300/*
304 * pseudo-DMA transfer 301 * pseudo-DMA transfer
305 */ 302 */
306static inline void vx_pseudo_dma_write(vx_core_t *chip, snd_pcm_runtime_t *runtime, 303static inline void vx_pseudo_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime,
307 vx_pipe_t *pipe, int count) 304 struct vx_pipe *pipe, int count)
308{ 305{
309 snd_assert(chip->ops->dma_write, return); 306 snd_assert(chip->ops->dma_write, return);
310 chip->ops->dma_write(chip, runtime, pipe, count); 307 chip->ops->dma_write(chip, runtime, pipe, count);
311} 308}
312 309
313static inline void vx_pseudo_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtime, 310static inline void vx_pseudo_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime,
314 vx_pipe_t *pipe, int count) 311 struct vx_pipe *pipe, int count)
315{ 312{
316 snd_assert(chip->ops->dma_read, return); 313 snd_assert(chip->ops->dma_read, return);
317 chip->ops->dma_read(chip, runtime, pipe, count); 314 chip->ops->dma_read(chip, runtime, pipe, count);
@@ -329,27 +326,33 @@ static inline void vx_pseudo_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtim
329/* 326/*
330 * pcm stuff 327 * pcm stuff
331 */ 328 */
332int snd_vx_pcm_new(vx_core_t *chip); 329int snd_vx_pcm_new(struct vx_core *chip);
333void vx_pcm_update_intr(vx_core_t *chip, unsigned int events); 330void vx_pcm_update_intr(struct vx_core *chip, unsigned int events);
334 331
335/* 332/*
336 * mixer stuff 333 * mixer stuff
337 */ 334 */
338int snd_vx_mixer_new(vx_core_t *chip); 335int snd_vx_mixer_new(struct vx_core *chip);
339void vx_toggle_dac_mute(vx_core_t *chip, int mute); 336void vx_toggle_dac_mute(struct vx_core *chip, int mute);
340int vx_sync_audio_source(vx_core_t *chip); 337int vx_sync_audio_source(struct vx_core *chip);
341int vx_set_monitor_level(vx_core_t *chip, int audio, int level, int active); 338int vx_set_monitor_level(struct vx_core *chip, int audio, int level, int active);
342 339
343/* 340/*
344 * IEC958 & clock stuff 341 * IEC958 & clock stuff
345 */ 342 */
346void vx_set_iec958_status(vx_core_t *chip, unsigned int bits); 343void vx_set_iec958_status(struct vx_core *chip, unsigned int bits);
347int vx_set_clock(vx_core_t *chip, unsigned int freq); 344int vx_set_clock(struct vx_core *chip, unsigned int freq);
348void vx_set_internal_clock(vx_core_t *chip, unsigned int freq); 345void vx_set_internal_clock(struct vx_core *chip, unsigned int freq);
349int vx_change_frequency(vx_core_t *chip); 346int vx_change_frequency(struct vx_core *chip);
350 347
351 348
352/* 349/*
350 * PM
351 */
352int snd_vx_suspend(struct vx_core *card, pm_message_t state);
353int snd_vx_resume(struct vx_core *card);
354
355/*
353 * hardware constants 356 * hardware constants
354 */ 357 */
355 358
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
index c3bccbfd8d4c..d567bfdbf513 100644
--- a/include/sound/ymfpci.h
+++ b/include/sound/ymfpci.h
@@ -184,7 +184,7 @@
184 * 184 *
185 */ 185 */
186 186
187typedef struct _snd_ymfpci_playback_bank { 187struct snd_ymfpci_playback_bank {
188 u32 format; 188 u32 format;
189 u32 loop_default; 189 u32 loop_default;
190 u32 base; /* 32-bit address */ 190 u32 base; /* 32-bit address */
@@ -215,46 +215,45 @@ typedef struct _snd_ymfpci_playback_bank {
215 u32 eff3_gain; 215 u32 eff3_gain;
216 u32 lpfD1; 216 u32 lpfD1;
217 u32 lpfD2; 217 u32 lpfD2;
218} snd_ymfpci_playback_bank_t; 218 };
219 219
220typedef struct _snd_ymfpci_capture_bank { 220struct snd_ymfpci_capture_bank {
221 u32 base; /* 32-bit address */ 221 u32 base; /* 32-bit address */
222 u32 loop_end; /* 32-bit offset */ 222 u32 loop_end; /* 32-bit offset */
223 u32 start; /* 32-bit offset */ 223 u32 start; /* 32-bit offset */
224 u32 num_of_loops; /* counter */ 224 u32 num_of_loops; /* counter */
225} snd_ymfpci_capture_bank_t; 225};
226 226
227typedef struct _snd_ymfpci_effect_bank { 227struct snd_ymfpci_effect_bank {
228 u32 base; /* 32-bit address */ 228 u32 base; /* 32-bit address */
229 u32 loop_end; /* 32-bit offset */ 229 u32 loop_end; /* 32-bit offset */
230 u32 start; /* 32-bit offset */ 230 u32 start; /* 32-bit offset */
231 u32 temp; 231 u32 temp;
232} snd_ymfpci_effect_bank_t; 232};
233 233
234typedef struct _snd_ymfpci_voice ymfpci_voice_t; 234struct snd_ymfpci_pcm;
235typedef struct _snd_ymfpci_pcm ymfpci_pcm_t; 235struct snd_ymfpci;
236typedef struct _snd_ymfpci ymfpci_t;
237 236
238typedef enum { 237enum snd_ymfpci_voice_type {
239 YMFPCI_PCM, 238 YMFPCI_PCM,
240 YMFPCI_SYNTH, 239 YMFPCI_SYNTH,
241 YMFPCI_MIDI 240 YMFPCI_MIDI
242} ymfpci_voice_type_t; 241};
243 242
244struct _snd_ymfpci_voice { 243struct snd_ymfpci_voice {
245 ymfpci_t *chip; 244 struct snd_ymfpci *chip;
246 int number; 245 int number;
247 unsigned int use: 1, 246 unsigned int use: 1,
248 pcm: 1, 247 pcm: 1,
249 synth: 1, 248 synth: 1,
250 midi: 1; 249 midi: 1;
251 snd_ymfpci_playback_bank_t *bank; 250 struct snd_ymfpci_playback_bank *bank;
252 dma_addr_t bank_addr; 251 dma_addr_t bank_addr;
253 void (*interrupt)(ymfpci_t *chip, ymfpci_voice_t *voice); 252 void (*interrupt)(struct snd_ymfpci *chip, struct snd_ymfpci_voice *voice);
254 ymfpci_pcm_t *ypcm; 253 struct snd_ymfpci_pcm *ypcm;
255}; 254};
256 255
257typedef enum { 256enum snd_ymfpci_pcm_type {
258 PLAYBACK_VOICE, 257 PLAYBACK_VOICE,
259 CAPTURE_REC, 258 CAPTURE_REC,
260 CAPTURE_AC97, 259 CAPTURE_AC97,
@@ -263,13 +262,13 @@ typedef enum {
263 EFFECT_EFF1, 262 EFFECT_EFF1,
264 EFFECT_EFF2, 263 EFFECT_EFF2,
265 EFFECT_EFF3 264 EFFECT_EFF3
266} snd_ymfpci_pcm_type_t; 265};
267 266
268struct _snd_ymfpci_pcm { 267struct snd_ymfpci_pcm {
269 ymfpci_t *chip; 268 struct snd_ymfpci *chip;
270 snd_ymfpci_pcm_type_t type; 269 enum snd_ymfpci_pcm_type type;
271 snd_pcm_substream_t *substream; 270 struct snd_pcm_substream *substream;
272 ymfpci_voice_t *voices[2]; /* playback only */ 271 struct snd_ymfpci_voice *voices[2]; /* playback only */
273 unsigned int running: 1; 272 unsigned int running: 1;
274 unsigned int output_front: 1; 273 unsigned int output_front: 1;
275 unsigned int output_rear: 1; 274 unsigned int output_rear: 1;
@@ -282,7 +281,7 @@ struct _snd_ymfpci_pcm {
282 u32 shift; 281 u32 shift;
283}; 282};
284 283
285struct _snd_ymfpci { 284struct snd_ymfpci {
286 int irq; 285 int irq;
287 286
288 unsigned int device_id; /* PCI device ID */ 287 unsigned int device_id; /* PCI device ID */
@@ -316,47 +315,47 @@ struct _snd_ymfpci {
316 struct snd_dma_buffer ac3_tmp_base; 315 struct snd_dma_buffer ac3_tmp_base;
317 316
318 u32 *ctrl_playback; 317 u32 *ctrl_playback;
319 snd_ymfpci_playback_bank_t *bank_playback[YDSXG_PLAYBACK_VOICES][2]; 318 struct snd_ymfpci_playback_bank *bank_playback[YDSXG_PLAYBACK_VOICES][2];
320 snd_ymfpci_capture_bank_t *bank_capture[YDSXG_CAPTURE_VOICES][2]; 319 struct snd_ymfpci_capture_bank *bank_capture[YDSXG_CAPTURE_VOICES][2];
321 snd_ymfpci_effect_bank_t *bank_effect[YDSXG_EFFECT_VOICES][2]; 320 struct snd_ymfpci_effect_bank *bank_effect[YDSXG_EFFECT_VOICES][2];
322 321
323 int start_count; 322 int start_count;
324 323
325 u32 active_bank; 324 u32 active_bank;
326 ymfpci_voice_t voices[64]; 325 struct snd_ymfpci_voice voices[64];
327 326
328 ac97_bus_t *ac97_bus; 327 struct snd_ac97_bus *ac97_bus;
329 ac97_t *ac97; 328 struct snd_ac97 *ac97;
330 snd_rawmidi_t *rawmidi; 329 struct snd_rawmidi *rawmidi;
331 snd_timer_t *timer; 330 struct snd_timer *timer;
332 331
333 struct pci_dev *pci; 332 struct pci_dev *pci;
334 snd_card_t *card; 333 struct snd_card *card;
335 snd_pcm_t *pcm; 334 struct snd_pcm *pcm;
336 snd_pcm_t *pcm2; 335 struct snd_pcm *pcm2;
337 snd_pcm_t *pcm_spdif; 336 struct snd_pcm *pcm_spdif;
338 snd_pcm_t *pcm_4ch; 337 struct snd_pcm *pcm_4ch;
339 snd_pcm_substream_t *capture_substream[YDSXG_CAPTURE_VOICES]; 338 struct snd_pcm_substream *capture_substream[YDSXG_CAPTURE_VOICES];
340 snd_pcm_substream_t *effect_substream[YDSXG_EFFECT_VOICES]; 339 struct snd_pcm_substream *effect_substream[YDSXG_EFFECT_VOICES];
341 snd_kcontrol_t *ctl_vol_recsrc; 340 struct snd_kcontrol *ctl_vol_recsrc;
342 snd_kcontrol_t *ctl_vol_adcrec; 341 struct snd_kcontrol *ctl_vol_adcrec;
343 snd_kcontrol_t *ctl_vol_spdifrec; 342 struct snd_kcontrol *ctl_vol_spdifrec;
344 unsigned short spdif_bits, spdif_pcm_bits; 343 unsigned short spdif_bits, spdif_pcm_bits;
345 snd_kcontrol_t *spdif_pcm_ctl; 344 struct snd_kcontrol *spdif_pcm_ctl;
346 int mode_dup4ch; 345 int mode_dup4ch;
347 int rear_opened; 346 int rear_opened;
348 int spdif_opened; 347 int spdif_opened;
349 struct { 348 struct {
350 u16 left; 349 u16 left;
351 u16 right; 350 u16 right;
352 snd_kcontrol_t *ctl; 351 struct snd_kcontrol *ctl;
353 } pcm_mixer[32]; 352 } pcm_mixer[32];
354 353
355 spinlock_t reg_lock; 354 spinlock_t reg_lock;
356 spinlock_t voice_lock; 355 spinlock_t voice_lock;
357 wait_queue_head_t interrupt_sleep; 356 wait_queue_head_t interrupt_sleep;
358 atomic_t interrupt_sleep_count; 357 atomic_t interrupt_sleep_count;
359 snd_info_entry_t *proc_entry; 358 struct snd_info_entry *proc_entry;
360 359
361#ifdef CONFIG_PM 360#ifdef CONFIG_PM
362 u32 *saved_regs; 361 u32 *saved_regs;
@@ -364,17 +363,20 @@ struct _snd_ymfpci {
364#endif 363#endif
365}; 364};
366 365
367int snd_ymfpci_create(snd_card_t * card, 366int snd_ymfpci_create(struct snd_card *card,
368 struct pci_dev *pci, 367 struct pci_dev *pci,
369 unsigned short old_legacy_ctrl, 368 unsigned short old_legacy_ctrl,
370 ymfpci_t ** rcodec); 369 struct snd_ymfpci ** rcodec);
371void snd_ymfpci_free_gameport(ymfpci_t *chip); 370void snd_ymfpci_free_gameport(struct snd_ymfpci *chip);
372 371
373int snd_ymfpci_pcm(ymfpci_t *chip, int device, snd_pcm_t **rpcm); 372int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state);
374int snd_ymfpci_pcm2(ymfpci_t *chip, int device, snd_pcm_t **rpcm); 373int snd_ymfpci_resume(struct pci_dev *pci);
375int snd_ymfpci_pcm_spdif(ymfpci_t *chip, int device, snd_pcm_t **rpcm); 374
376int snd_ymfpci_pcm_4ch(ymfpci_t *chip, int device, snd_pcm_t **rpcm); 375int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
377int snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch); 376int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
378int snd_ymfpci_timer(ymfpci_t *chip, int device); 377int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
378int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
379int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch);
380int snd_ymfpci_timer(struct snd_ymfpci *chip, int device);
379 381
380#endif /* __SOUND_YMFPCI_H */ 382#endif /* __SOUND_YMFPCI_H */