diff options
| author | Andy Grover <agrover@groveronline.com> | 2003-03-20 18:45:08 -0800 |
|---|---|---|
| committer | Andy Grover <agrover@groveronline.com> | 2003-03-20 18:45:08 -0800 |
| commit | ff6e14381a7c1597c4ffbeb760e9802f3ebaebb2 (patch) | |
| tree | f5463b22c7b9b67342cde9e46f1d3a3068019ec8 /include | |
| parent | ecabd7d2dd8117b1ec4cc4b7303a7e8198843684 (diff) | |
| parent | aa43a933c82fe96479cd5e260a221b69409a553b (diff) | |
Merge groveronline.com:/root/bk/linux-2.5
into groveronline.com:/root/bk/linux-acpi
Diffstat (limited to 'include')
55 files changed, 847 insertions, 321 deletions
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 099223f882f5..6ff7a04f76b1 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -371,6 +371,10 @@ struct tss_struct { * pads the TSS to be cacheline-aligned (size is 0x100) */ unsigned long __cacheline_filler[5]; + /* + * .. and then another 0x100 bytes for emergency kernel stack + */ + unsigned long stack[64]; }; struct thread_struct { diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h index 7394563bd138..88e3c782275f 100644 --- a/include/asm-i386/uaccess.h +++ b/include/asm-i386/uaccess.h @@ -47,7 +47,13 @@ int __verify_write(const void *, unsigned long); #define __addr_ok(addr) ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg)) /* - * Uhhuh, this needs 33-bit arithmetic. We have a carry.. + * Test whether a block of memory is a valid user space address. + * Returns 0 if the range is valid, nonzero otherwise. + * + * This is equivalent to the following test: + * (u33)addr + (u33)size >= (u33)current->addr_limit.seg + * + * This needs 33-bit arithmetic. We have a carry... */ #define __range_ok(addr,size) ({ \ unsigned long flag,sum; \ @@ -58,6 +64,25 @@ int __verify_write(const void *, unsigned long); #ifdef CONFIG_X86_WP_WORKS_OK +/** + * access_ok: - Checks if a user space pointer is valid + * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that + * %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe + * to write to a block, it is always safe to read from it. + * @addr: User space pointer to start of block to check + * @size: Size of block to check + * + * Context: User context only. This function may sleep. + * + * Checks if a pointer to a block of memory in user space is valid. + * + * Returns true (nonzero) if the memory block may be valid, false (zero) + * if it is definitely invalid. + * + * Note that, depending on architecture, this function probably just + * checks that the pointer is in the user space range - after calling + * this function, memory access functions may still return -EFAULT. + */ #define access_ok(type,addr,size) (__range_ok(addr,size) == 0) #else @@ -68,6 +93,23 @@ int __verify_write(const void *, unsigned long); #endif +/** + * verify_area: - Obsolete, use access_ok() + * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE + * @addr: User space pointer to start of block to check + * @size: Size of block to check + * + * Context: User context only. This function may sleep. + * + * This function has been replaced by access_ok(). + * + * Checks if a pointer to a block of memory in user space is valid. + * + * Returns zero if the memory block may be valid, -EFAULT + * if it is definitely invalid. + * + * See access_ok() for more details. + */ static inline int verify_area(int type, const void * addr, unsigned long size) { return access_ok(type,addr,size) ? 0 : -EFAULT; @@ -118,7 +160,25 @@ extern void __get_user_4(void); :"=a" (ret),"=d" (x) \ :"0" (ptr)) + /* Careful: we have to cast the result to the type of the pointer for sign reasons */ +/** + * get_user: - Get a simple variable from user space. + * @x: Variable to store result. + * @ptr: Source address, in user space. + * + * Context: User context only. This function may sleep. + * + * This macro copies a single simple variable from user space to kernel + * space. It supports simple types like char and int, but not larger + * data types like structures or arrays. + * + * @ptr must have pointer-to-simple-variable type, and the result of + * dereferencing @ptr must be assignable to @x without a cast. + * + * Returns zero on success, or -EFAULT on error. + * On error, the variable @x is set to zero. + */ #define get_user(x,ptr) \ ({ int __ret_gu,__val_gu; \ switch(sizeof (*(ptr))) { \ @@ -138,11 +198,70 @@ extern void __put_user_8(void); extern void __put_user_bad(void); + +/** + * put_user: - Write a simple value into user space. + * @x: Value to copy to user space. + * @ptr: Destination address, in user space. + * + * Context: User context only. This function may sleep. + * + * This macro copies a single simple value from kernel space to user + * space. It supports simple types like char and int, but not larger + * data types like structures or arrays. + * + * @ptr must have pointer-to-simple-variable type, and @x must be assignable + * to the result of dereferencing @ptr. + * + * Returns zero on success, or -EFAULT on error. + */ #define put_user(x,ptr) \ __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) + +/** + * __get_user: - Get a simple variable from user space, with less checking. + * @x: Variable to store result. + * @ptr: Source address, in user space. + * + * Context: User context only. This function may sleep. + * + * This macro copies a single simple variable from user space to kernel + * space. It supports simple types like char and int, but not larger + * data types like structures or arrays. + * + * @ptr must have pointer-to-simple-variable type, and the result of + * dereferencing @ptr must be assignable to @x without a cast. + * + * Caller must check the pointer with access_ok() before calling this + * function. + * + * Returns zero on success, or -EFAULT on error. + * On error, the variable @x is set to zero. + */ #define __get_user(x,ptr) \ __get_user_nocheck((x),(ptr),sizeof(*(ptr))) + + +/** + * __put_user: - Write a simple value into user space, with less checking. + * @x: Value to copy to user space. + * @ptr: Destination address, in user space. + * + * Context: User context only. This function may sleep. + * + * This macro copies a single simple value from kernel space to user + * space. It supports simple types like char and int, but not larger + * data types like structures or arrays. + * + * @ptr must have pointer-to-simple-variable type, and @x must be assignable + * to the result of dereferencing @ptr. + * + * Caller must check the pointer with access_ok() before calling this + * function. + * + * Returns zero on success, or -EFAULT on error. + */ #define __put_user(x,ptr) \ __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) @@ -263,6 +382,21 @@ unsigned long __copy_from_user_ll(void *to, const void *from, unsigned long n); * If a store crosses a page boundary and gets a fault, the x86 will not write * anything, so this is accurate. */ + +/** + * __copy_to_user: - Copy a block of data into user space, with less checking. + * @to: Destination address, in user space. + * @from: Source address, in kernel space. + * @n: Number of bytes to copy. + * + * Context: User context only. This function may sleep. + * + * Copy data from kernel space to user space. Caller must check + * the specified block with access_ok() before calling this function. + * + * Returns number of bytes that could not be copied. + * On success, this will be zero. + */ static inline unsigned long __copy_to_user(void *to, const void *from, unsigned long n) { @@ -284,6 +418,23 @@ __copy_to_user(void *to, const void *from, unsigned long n) return __copy_to_user_ll(to, from, n); } +/** + * __copy_from_user: - Copy a block of data from user space, with less checking. + * @to: Destination address, in kernel space. + * @from: Source address, in user space. + * @n: Number of bytes to copy. + * + * Context: User context only. This function may sleep. + * + * Copy data from user space to kernel space. Caller must check + * the specified block with access_ok() before calling this function. + * + * Returns number of bytes that could not be copied. + * On success, this will be zero. + * + * If some data could not be copied, this function will pad the copied + * data to the requested size using zero bytes. + */ static inline unsigned long __copy_from_user(void *to, const void *from, unsigned long n) { @@ -305,6 +456,19 @@ __copy_from_user(void *to, const void *from, unsigned long n) return __copy_from_user_ll(to, from, n); } +/** + * copy_to_user: - Copy a block of data into user space. + * @to: Destination address, in user space. + * @from: Source address, in kernel space. + * @n: Number of bytes to copy. + * + * Context: User context only. This function may sleep. + * + * Copy data from kernel space to user space. + * + * Returns number of bytes that could not be copied. + * On success, this will be zero. + */ static inline unsigned long copy_to_user(void *to, const void *from, unsigned long n) { @@ -313,6 +477,22 @@ copy_to_user(void *to, const void *from, unsigned long n) return n; } +/** + * copy_from_user: - Copy a block of data from user space. + * @to: Destination address, in kernel space. + * @from: Source address, in user space. + * @n: Number of bytes to copy. + * + * Context: User context only. This function may sleep. + * + * Copy data from user space to kernel space. + * + * Returns number of bytes that could not be copied. + * On success, this will be zero. + * + * If some data could not be copied, this function will pad the copied + * data to the requested size using zero bytes. + */ static inline unsigned long copy_from_user(void *to, const void *from, unsigned long n) { @@ -323,7 +503,23 @@ copy_from_user(void *to, const void *from, unsigned long n) long strncpy_from_user(char *dst, const char *src, long count); long __strncpy_from_user(char *dst, const char *src, long count); + +/** + * strlen_user: - Get the size of a string in user space. + * @str: The string to measure. + * + * Context: User context only. This function may sleep. + * + * Get the size of a NULL-terminated string in user space. + * + * Returns the size of the string INCLUDING the terminating NULL. + * On exception, returns 0. + * + * If there is a limit on the length of a valid string, you may wish to + * consider using strnlen_user() instead. + */ #define strlen_user(str) strnlen_user(str, ~0UL >> 1) + long strnlen_user(const char *str, long n); unsigned long clear_user(void *mem, unsigned long len); unsigned long __clear_user(void *mem, unsigned long len); diff --git a/include/asm-m68k/amigahw.h b/include/asm-m68k/amigahw.h index 785e62601e2d..045f58fcd8b3 100644 --- a/include/asm-m68k/amigahw.h +++ b/include/asm-m68k/amigahw.h @@ -324,7 +324,7 @@ struct tod3000 { }; #define TOD3000_CNTRL1_HOLD 0 #define TOD3000_CNTRL1_FREE 9 -#define TOD_3000 ((struct tod3000 *)(zTwoBase+0xDC0000)) +#define tod_3000 ((*(volatile struct tod3000 *)(zTwoBase+0xDC0000))) struct tod2000 { unsigned int :28, second2:4; /* lower digit */ @@ -349,6 +349,6 @@ struct tod2000 { #define TOD2000_CNTRL1_BUSY (1<<1) #define TOD2000_CNTRL3_24HMODE (1<<2) #define TOD2000_HOUR1_PM (1<<2) -#define TOD_2000 ((struct tod2000 *)(zTwoBase+0xDC0000)) +#define tod_2000 ((*(volatile struct tod2000 *)(zTwoBase+0xDC0000))) #endif /* _M68K_AMIGAHW_H */ diff --git a/include/asm-m68k/apollohw.h b/include/asm-m68k/apollohw.h index e12a638ca487..f29992a3927d 100644 --- a/include/asm-m68k/apollohw.h +++ b/include/asm-m68k/apollohw.h @@ -101,9 +101,4 @@ extern u_long timer_physaddr; #define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE) -#define inb(addr) (*((volatile unsigned char *)(addr))) -#define outb(val,addr) (*((volatile unsigned char *)(addr)) = (val)) -#define inw(addr) (*((volatile unsigned short *)(addr))) -#define outw(val,addr) (*((volatile unsigned short *)(addr)) = (val)) - #endif diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h index cf88ccb5a47a..406a93da3f6b 100644 --- a/include/asm-m68k/io.h +++ b/include/asm-m68k/io.h @@ -162,7 +162,9 @@ static inline unsigned long isa_mtb(long addr) #ifdef CONFIG_GG2 case GG2_ISA: return GG2_ISA_MEM_B(addr); #endif - /* FIXME: any ISA mem mapping for PCMCIA? */ +#ifdef CONFIG_AMIGA_PCMCIA + case AG_ISA: return addr; +#endif default: return 0; /* avoid warnings, just in case */ } } @@ -176,6 +178,9 @@ static inline unsigned long isa_mtw(long addr) #ifdef CONFIG_GG2 case GG2_ISA: return GG2_ISA_MEM_W(addr); #endif +#ifdef CONFIG_AMIGA_PCMCIA + case AG_ISA: return addr; +#endif default: return 0; /* avoid warnings, just in case */ } } @@ -187,9 +192,9 @@ static inline unsigned long isa_mtw(long addr) #define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val))) #define isa_readb(p) in_8(isa_mtb(p)) -#define isa_readw(p) in_le16(isa_mtw(p)) +#define isa_readw(p) (ISA_SEX ? in_be16(isa_mtw(p)) : in_le16(isa_mtw(p))) #define isa_writeb(val,p) out_8(isa_mtb(p),(val)) -#define isa_writew(val,p) out_le16(isa_mtw(p),(val)) +#define isa_writew(val,p) (ISA_SEX ? out_be16(isa_mtw(p),(val)) : out_le16(isa_mtw(p),(val))) static inline void isa_delay(void) { diff --git a/include/asm-m68k/kmap_types.h b/include/asm-m68k/kmap_types.h index 3d43a7f936e8..5567afb1e623 100644 --- a/include/asm-m68k/kmap_types.h +++ b/include/asm-m68k/kmap_types.h @@ -15,6 +15,8 @@ enum km_type { KM_PTE1, KM_IRQ0, KM_IRQ1, + KM_SOFTIRQ0, + KM_SOFTIRQ1, KM_TYPE_NR }; diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h index f6c1eaf22a2c..8343b1344189 100644 --- a/include/asm-m68k/page.h +++ b/include/asm-m68k/page.h @@ -6,10 +6,13 @@ /* PAGE_SHIFT determines the page size */ #ifndef CONFIG_SUN3 #define PAGE_SHIFT (12) -#define PAGE_SIZE (4096) #else #define PAGE_SHIFT (13) -#define PAGE_SIZE (8192) +#endif +#ifdef __ASSEMBLY__ +#define PAGE_SIZE (1 << PAGE_SHIFT) +#else +#define PAGE_SIZE (1UL << PAGE_SHIFT) #endif #define PAGE_MASK (~(PAGE_SIZE-1)) @@ -142,7 +145,7 @@ static inline unsigned long ___pa(unsigned long x) { if(x == 0) return 0; - if(x > PAGE_OFFSET) + if(x >= PAGE_OFFSET) return (x-PAGE_OFFSET); else return (x+0x2000000); diff --git a/include/asm-m68k/rtc.h b/include/asm-m68k/rtc.h index 043d5f947618..2de18f80a563 100644 --- a/include/asm-m68k/rtc.h +++ b/include/asm-m68k/rtc.h @@ -14,23 +14,21 @@ #ifdef __KERNEL__ #include <linux/rtc.h> +#include <asm/errno.h> #include <asm/machdep.h> -/* a few implementation details for the emulation : */ - #define RTC_PIE 0x40 /* periodic interrupt enable */ #define RTC_AIE 0x20 /* alarm interrupt enable */ #define RTC_UIE 0x10 /* update-finished interrupt enable */ -extern void gen_rtc_interrupt(unsigned long); - /* some dummy definitions */ +#define RTC_BATT_BAD 0x100 /* battery bad */ #define RTC_SQWE 0x08 /* enable square-wave output */ #define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */ #define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ #define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ -static inline void get_rtc_time(struct rtc_time *time) +static inline unsigned int get_rtc_time(struct rtc_time *time) { /* * Only the values that we read from the RTC are set. We leave @@ -39,6 +37,7 @@ static inline void get_rtc_time(struct rtc_time *time) * by the RTC when initially set to a non-zero value. */ mach_hwclk(0, time); + return RTC_24H; } static inline int set_rtc_time(struct rtc_time *time) @@ -52,7 +51,7 @@ static inline unsigned int get_rtc_ss(void) return mach_get_ss(); else{ struct rtc_time h; - + get_rtc_time(&h); return h.tm_sec; } @@ -72,7 +71,6 @@ static inline int set_rtc_pll(struct rtc_pll_info *pll) else return -EINVAL; } - #endif /* __KERNEL__ */ #endif /* _ASM__RTC_H */ diff --git a/include/asm-m68k/siginfo.h b/include/asm-m68k/siginfo.h index bedd92cb4a9e..05a8d6d90b58 100644 --- a/include/asm-m68k/siginfo.h +++ b/include/asm-m68k/siginfo.h @@ -23,8 +23,11 @@ typedef struct siginfo { /* POSIX.1b timers */ struct { - unsigned int _timer1; - unsigned int _timer2; + timer_t _tid; /* timer id */ + int _overrun; /* overrun count */ + char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)]; + sigval_t _sigval; /* same as below */ + int _sys_private; /* not to be passed to user */ } _timer; /* POSIX.1b signals */ diff --git a/include/asm-m68k/sun3-head.h b/include/asm-m68k/sun3-head.h index d2c9f39da8fc..f799d95bad53 100644 --- a/include/asm-m68k/sun3-head.h +++ b/include/asm-m68k/sun3-head.h @@ -9,4 +9,4 @@ #define FC_SUPERD 5 #define FC_CPU 7 -#endif __SUN3_HEAD_H +#endif /* __SUN3_HEAD_H */ diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h index 112ea2a6a047..77ac69c31981 100644 --- a/include/asm-m68k/system.h +++ b/include/asm-m68k/system.h @@ -101,21 +101,24 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz case 1: tmp = *(u8 *)ptr; *(u8 *)ptr = x; + x = tmp; break; case 2: tmp = *(u16 *)ptr; *(u16 *)ptr = x; + x = tmp; break; case 4: tmp = *(u32 *)ptr; *(u32 *)ptr = x; + x = tmp; break; default: BUG(); } local_irq_restore(flags); - return tmp; + return x; } #else static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h index c99410180fe2..92e5a0c5d34b 100644 --- a/include/asm-m68k/unistd.h +++ b/include/asm-m68k/unistd.h @@ -239,7 +239,9 @@ #define __NR_fremovexattr 234 #define __NR_futex 235 -/* user-visible error numbers are in the range -1 - -122: see +#define NR_syscalls 236 + +/* user-visible error numbers are in the range -1 - -124: see <asm-m68k/errno.h> */ #define __syscall_return(type, res) \ diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h index f2423a38eee4..f708a38bf79e 100644 --- a/include/asm-sparc64/irq.h +++ b/include/asm-sparc64/irq.h @@ -117,8 +117,6 @@ static __inline__ char *__irq_itoa(unsigned int irq) extern void disable_irq(unsigned int); #define disable_irq_nosync disable_irq extern void enable_irq(unsigned int); -extern void sparc64_init_timers(void (*lvl10_irq)(int, void *, struct pt_regs *), - unsigned long *); extern unsigned int build_irq(int pil, int inofixup, unsigned long iclr, unsigned long imap); extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); extern unsigned int psycho_build_irq(void *psycho, int imap_off, int ino, int need_dma_sync); diff --git a/include/asm-sparc64/spitfire.h b/include/asm-sparc64/spitfire.h index f93e66aaa1ba..6ee83ff2fde3 100644 --- a/include/asm-sparc64/spitfire.h +++ b/include/asm-sparc64/spitfire.h @@ -45,8 +45,6 @@ enum ultra_tlb_layout { extern enum ultra_tlb_layout tlb_type; -#define SPARC64_USE_STICK (tlb_type != spitfire) - #define CHEETAH_HIGHEST_LOCKED_TLBENT (16 - 1) #define L1DCACHE_SIZE 0x4000 diff --git a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h index dcb4f8845a88..298ce3e9027d 100644 --- a/include/asm-sparc64/thread_info.h +++ b/include/asm-sparc64/thread_info.h @@ -97,7 +97,7 @@ struct thread_info { #define TI_PCR 0x00000490 #define TI_CEE_STUFF 0x00000498 #define TI_RESTART_BLOCK 0x000004a0 -#define TI_FPREGS 0x000004c0 +#define TI_FPREGS 0x00000500 /* We embed this in the uppermost byte of thread_info->flags */ #define FAULT_CODE_WRITE 0x01 /* Write access, implies D-TLB */ diff --git a/include/asm-sparc64/timer.h b/include/asm-sparc64/timer.h index 4aa85bedef9c..504087ee7295 100644 --- a/include/asm-sparc64/timer.h +++ b/include/asm-sparc64/timer.h @@ -50,6 +50,17 @@ struct sun5_timer { */ #define SUN5_HZ_TO_LIMIT(__hz) (1000000/(__hz)) +struct sparc64_tick_ops { + void (*init_tick)(unsigned long); + unsigned long (*get_tick)(void); + unsigned long (*get_compare)(void); + unsigned long (*add_tick)(unsigned long, unsigned long); + unsigned long (*add_compare)(unsigned long); + unsigned long softint_mask; +}; + +extern struct sparc64_tick_ops *tick_ops; + #ifdef CONFIG_SMP extern unsigned long timer_tick_offset; extern void timer_tick_interrupt(struct pt_regs *); diff --git a/include/linux/i2c.h b/include/linux/i2c.h index a8f482b94ba4..0ae665586de1 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -143,7 +143,10 @@ struct i2c_driver { * with the device. */ int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); + + struct device_driver driver; }; +#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) extern struct bus_type i2c_bus_type; diff --git a/include/linux/ide.h b/include/linux/ide.h index 7510ad7d1aa4..fb6473237d52 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -341,10 +341,7 @@ void ide_setup_ports( hw_regs_t *hw, #include <asm/ide.h> /* Currently only m68k, apus and m8xx need it */ -#ifdef IDE_ARCH_ACK_INTR -extern int ide_irq_lock; -# define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1) -#else +#ifndef IDE_ARCH_ACK_INTR # define ide_ack_intr(hwif) (1) #endif diff --git a/include/linux/in6.h b/include/linux/in6.h index ee7e68e39d9e..051db67aee69 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h @@ -65,6 +65,8 @@ struct ipv6_mreq { int ipv6mr_ifindex; }; +#define ipv6mr_acaddr ipv6mr_multiaddr + struct in6_flowlabel_req { struct in6_addr flr_dst; @@ -166,6 +168,8 @@ struct in6_flowlabel_req #define IPV6_MTU 24 #define IPV6_RECVERR 25 #define IPV6_V6ONLY 26 +#define IPV6_JOIN_ANYCAST 27 +#define IPV6_LEAVE_ANYCAST 28 /* IPV6_MTU_DISCOVER values */ #define IPV6_PMTUDISC_DONT 0 diff --git a/include/linux/ip.h b/include/linux/ip.h index f655ce138e78..1c26df3103a8 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h @@ -18,8 +18,6 @@ #define _LINUX_IP_H #include <asm/byteorder.h> -/* SOL_IP socket options */ - #define IPTOS_TOS_MASK 0x1E #define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) #define IPTOS_LOWDELAY 0x10 @@ -67,14 +65,6 @@ #define MAXTTL 255 #define IPDEFTTL 64 -/* struct timestamp, struct route and MAX_ROUTES are removed. - - REASONS: it is clear that nobody used them because: - - MAX_ROUTES value was wrong. - - "struct route" was wrong. - - "struct timestamp" had fatally misaligned bitfields and was completely unusable. - */ - #define IPOPT_OPTVAL 0 #define IPOPT_OLEN 1 #define IPOPT_OFFSET 2 diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 516bb7d6b447..647c40c96452 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -172,6 +172,7 @@ struct ipv6_pinfo { ipv6only:1; struct ipv6_mc_socklist *ipv6_mc_list; + struct ipv6_ac_socklist *ipv6_ac_list; struct ipv6_fl_socklist *ipv6_fl_list; __u32 dst_cookie; diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 20d73363c079..d1f308ccb7c1 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -90,6 +90,11 @@ struct vlan_group; #define MAX_HEADER (LL_MAX_HEADER + 48) #endif +/* Reserve 16byte aligned hard_header_len, but at least 16. + * Alternative is: dev->hard_header_len ? (dev->hard_header_len + 15)&~15 : 0 + */ +#define LL_RESERVED_SPACE(dev) (((dev)->hard_header_len&~15) + 16) + /* * Network device statistics. Akin to the 2.0 ether stats but * with byte counters. @@ -360,7 +365,6 @@ struct net_device #define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */ #define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ #define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */ -#define NETIF_F_DYNALLOC 16 /* Self-dectructable device. */ #define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */ #define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */ #define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */ @@ -469,6 +473,10 @@ extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); extern void dev_add_pack(struct packet_type *pt); extern void dev_remove_pack(struct packet_type *pt); extern int dev_get(const char *name); +extern struct net_device *dev_get_by_flags(unsigned short flags, + unsigned short mask); +extern struct net_device *__dev_get_by_flags(unsigned short flags, + unsigned short mask); extern struct net_device *dev_get_by_name(const char *name); extern struct net_device *__dev_get_by_name(const char *name); extern struct net_device *dev_alloc(const char *name, int *err); diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h index 99ad017569c7..3b6ac2013540 100644 --- a/include/linux/netfilter_ipv6/ip6_tables.h +++ b/include/linux/netfilter_ipv6/ip6_tables.h @@ -449,6 +449,9 @@ extern unsigned int ip6t_do_table(struct sk_buff **pskb, struct ip6t_table *table, void *userdata); +/* Check for an extension */ +extern int ip6t_ext_hdr(u8 nexthdr); + #define IP6T_ALIGN(s) (((s) + (__alignof__(struct ip6t_entry)-1)) & ~(__alignof__(struct ip6t_entry)-1)) #endif /*__KERNEL__*/ diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 0711d71bc858..27c38b240736 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -63,7 +63,7 @@ struct rtc_pll_info { }; /* - * ioctl calls that are permitted to the /dev/rtc interface, if + * ioctl calls that are permitted to the /dev/rtc interface, if * any of the RTC drivers are enabled. */ @@ -87,6 +87,7 @@ struct rtc_pll_info { #define RTC_WKALM_SET _IOW('p', 0x0f, struct rtc_wkalrm)/* Set wakeup alarm*/ #define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm)/* Get wakeup alarm*/ + #define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */ #define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */ diff --git a/include/linux/serialP.h b/include/linux/serialP.h index 73541f600528..eb81e4e9b181 100644 --- a/include/linux/serialP.h +++ b/include/linux/serialP.h @@ -22,6 +22,7 @@ #include <linux/config.h> #include <linux/termios.h> #include <linux/workqueue.h> +#include <linux/interrupt.h> #include <linux/circ_buf.h> #include <linux/wait.h> #if (LINUX_VERSION_CODE < 0x020300) @@ -87,6 +88,7 @@ struct async_struct { u16 iomem_reg_shift; int io_type; struct work_struct work; + struct tasklet_struct tlet; #ifdef DECLARE_WAITQUEUE wait_queue_head_t open_wait; wait_queue_head_t close_wait; diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 437935a2cfb3..eeb6322193d7 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -226,7 +226,7 @@ struct sk_buff { unsigned int len, data_len, csum; - unsigned char __unused, + unsigned char local_df, cloned, pkt_type, ip_summed; diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 3e43be408a06..da4be9ce631d 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -245,6 +245,7 @@ struct tcp_opt { __u16 mss_cache_std; /* Like mss_cache, but without TSO */ __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ + __u16 ext2_header_len;/* Options depending on route */ __u8 ca_state; /* State of fast-retransmit machine */ __u8 retransmits; /* Number of unrecovered RTO timeouts. */ diff --git a/include/net/addrconf.h b/include/net/addrconf.h index b2317313c76f..1da77eae6a9b 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -63,7 +63,15 @@ extern struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr, extern int ipv6_get_saddr(struct dst_entry *dst, struct in6_addr *daddr, struct in6_addr *saddr); +extern int ipv6_dev_get_saddr(struct net_device *dev, + struct in6_addr *daddr, + struct in6_addr *saddr, + int onlink); extern int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *); +extern void addrconf_join_solict(struct net_device *dev, + struct in6_addr *addr); +extern void addrconf_leave_solict(struct net_device *dev, + struct in6_addr *addr); /* * multicast prototypes (mcast.c) @@ -93,6 +101,26 @@ extern int ipv6_chk_mcast_addr(struct net_device *dev, extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len); +/* + * anycast prototypes (anycast.c) + */ +extern int ipv6_sock_ac_join(struct sock *sk, + int ifindex, + struct in6_addr *addr); +extern int ipv6_sock_ac_drop(struct sock *sk, + int ifindex, + struct in6_addr *addr); +extern void ipv6_sock_ac_close(struct sock *sk); +extern int inet6_ac_check(struct sock *sk, struct in6_addr *addr, int ifindex); + +extern int ipv6_dev_ac_inc(struct net_device *dev, + struct in6_addr *addr); +extern int ipv6_dev_ac_dec(struct net_device *dev, + struct in6_addr *addr); +extern int ipv6_chk_acast_addr(struct net_device *dev, + struct in6_addr *addr); + + /* Device notifier */ extern int register_inet6addr_notifier(struct notifier_block *nb); extern int unregister_inet6addr_notifier(struct notifier_block *nb); diff --git a/include/net/dst.h b/include/net/dst.h index 1dcd50ff5496..e43ae2bb92b1 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -50,7 +50,8 @@ struct dst_entry unsigned long lastuse; unsigned long expires; - unsigned header_len; /* more space at head required */ + unsigned short header_len; /* more space at head required */ + unsigned short trailer_len; /* space to reserve at tail */ u32 metrics[RTAX_MAX]; struct dst_entry *path; diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index 3a1be13f3d05..edf4185f9e7e 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h @@ -75,6 +75,25 @@ struct ifmcaddr6 spinlock_t mca_lock; }; +/* Anycast stuff */ + +struct ipv6_ac_socklist +{ + struct in6_addr acl_addr; + int acl_ifindex; + struct ipv6_ac_socklist *acl_next; +}; + +struct ifacaddr6 +{ + struct in6_addr aca_addr; + struct inet6_dev *aca_idev; + struct ifacaddr6 *aca_next; + int aca_users; + atomic_t aca_refcnt; + spinlock_t aca_lock; +}; + #define IFA_HOST IPV6_ADDR_LOOPBACK #define IFA_LINK IPV6_ADDR_LINKLOCAL #define IFA_SITE IPV6_ADDR_SITELOCAL @@ -108,6 +127,7 @@ struct inet6_dev struct inet6_ifaddr *addr_list; struct ifmcaddr6 *mc_list; + struct ifacaddr6 *ac_list; rwlock_t lock; atomic_t refcnt; __u32 if_flags; diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h index 6603202d91f7..f730dd55f5ad 100644 --- a/include/net/sctp/command.h +++ b/include/net/sctp/command.h @@ -110,13 +110,13 @@ typedef union { sctp_event_timeout_t to; sctp_counter_t counter; void *ptr; - sctp_chunk_t *chunk; - sctp_association_t *asoc; + struct sctp_chunk *chunk; + struct sctp_association *asoc; struct sctp_transport *transport; - sctp_bind_addr_t *bp; + struct sctp_bind_addr *bp; sctp_init_chunk_t *init; struct sctp_ulpevent *ulpevent; - sctp_packet_t *packet; + struct sctp_packet *packet; sctp_sackhdr_t *sackh; } sctp_arg_t; @@ -158,13 +158,13 @@ SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state) SCTP_ARG_CONSTRUCTOR(COUNTER, sctp_counter_t, counter) SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr) -SCTP_ARG_CONSTRUCTOR(CHUNK, sctp_chunk_t *, chunk) -SCTP_ARG_CONSTRUCTOR(ASOC, sctp_association_t *, asoc) +SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk) +SCTP_ARG_CONSTRUCTOR(ASOC, struct sctp_association *, asoc) SCTP_ARG_CONSTRUCTOR(TRANSPORT, struct sctp_transport *, transport) -SCTP_ARG_CONSTRUCTOR(BA, sctp_bind_addr_t *, bp) +SCTP_ARG_CONSTRUCTOR(BA, struct sctp_bind_addr *, bp) SCTP_ARG_CONSTRUCTOR(PEER_INIT, sctp_init_chunk_t *, init) SCTP_ARG_CONSTRUCTOR(ULPEVENT, struct sctp_ulpevent *, ulpevent) -SCTP_ARG_CONSTRUCTOR(PACKET, sctp_packet_t *, packet) +SCTP_ARG_CONSTRUCTOR(PACKET, struct sctp_packet *, packet) SCTP_ARG_CONSTRUCTOR(SACKH, sctp_sackhdr_t *, sackh) typedef struct { diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index 3cc94d900f95..8ddc88ed69fd 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h @@ -210,14 +210,19 @@ typedef enum { /* These are values for sk->state. * For a UDP-style SCTP socket, the states are defined as follows - * (at this point of time, may change later after more discussions: FIXME) - * A socket in SCTP_SS_UNCONNECTED state indicates that it is not willing - * to accept new associations, but it can initiate the creation of new - * ones. - * A socket in SCTP_SS_LISTENING state indicates that it is willing to - * accept new associations and can initiate the creation of new ones. - * A socket in SCTP_SS_ESTABLISHED state indicates that it is a peeled off - * socket with one association. + * - A socket in SCTP_SS_CLOSED state indicates that it is not willing to + * accept new associations, but it can initiate the creation of new ones. + * - A socket in SCTP_SS_LISTENING state indicates that it is willing to + * accept new associations and can initiate the creation of new ones. + * - A socket in SCTP_SS_ESTABLISHED state indicates that it is a peeled off + * socket with one association. + * For a TCP-style SCTP socket, the states are defined as follows + * - A socket in SCTP_SS_CLOSED state indicates that it is not willing to + * accept new associations, but it can initiate the creation of new ones. + * - A socket in SCTP_SS_LISTENING state indicates that it is willing to + * accept new associations, but cannot initiate the creation of new ones. + * - A socket in SCTP_SS_ESTABLISHED state indicates that it has a single + * association in ESTABLISHED state. */ typedef enum { SCTP_SS_CLOSED = TCP_CLOSE, @@ -345,6 +350,7 @@ typedef enum { SCTP_XMIT_PMTU_FULL, SCTP_XMIT_RWND_FULL, SCTP_XMIT_MUST_FRAG, + SCTP_XMIT_NAGLE_DELAY, } sctp_xmit_t; /* These are the commands for manipulating transports. */ diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index b2e19ebde563..27a69518c2f9 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -121,9 +121,10 @@ /* * sctp_protocol.c */ -extern sctp_protocol_t sctp_proto; +extern struct sctp_protocol sctp_proto; extern struct sock *sctp_get_ctl_sock(void); -extern int sctp_copy_local_addr_list(sctp_protocol_t *, sctp_bind_addr_t *, +extern int sctp_copy_local_addr_list(struct sctp_protocol *, + struct sctp_bind_addr *, sctp_scope_t, int priority, int flags); extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); extern int sctp_register_pf(struct sctp_pf *, sa_family_t); @@ -312,30 +313,21 @@ static inline void sctp_sysctl_unregister(void) { return; } #endif +/* Size of Supported Address Parameter for 'x' address types. */ +#define SCTP_SAT_LEN(x) (sizeof(struct sctp_paramhdr) + (x) * sizeof(__u16)) + #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) extern int sctp_v6_init(void); extern void sctp_v6_exit(void); - static inline int sctp_ipv6_addr_type(const struct in6_addr *addr) { return ipv6_addr_type((struct in6_addr*) addr); } -#define SCTP_SAT_LEN (sizeof(sctp_paramhdr_t) + 2 * sizeof(__u16)) - -/* Note: These V6 macros are obsolescent. */ -/* Use this macro to enclose code fragments which are V6-dependent. */ -#define SCTP_V6(m...) m -#define SCTP_V6_SUPPORT 1 - #else /* #ifdef defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ #define sctp_ipv6_addr_type(a) 0 -#define SCTP_SAT_LEN (sizeof(sctp_paramhdr_t) + 1 * sizeof(__u16)) -#define SCTP_V6(m...) /* Do nothing. */ -#undef SCTP_V6_SUPPORT - static inline int sctp_v6_init(void) { return 0; } static inline void sctp_v6_exit(void) { return; } @@ -348,25 +340,10 @@ static inline sctp_assoc_t sctp_assoc2id(const sctp_association_t *asoc) return (sctp_assoc_t) asoc; } + /* Look up the association by its id. */ -static inline sctp_association_t *sctp_id2assoc(const struct sock *sk, sctp_assoc_t id) -{ - sctp_association_t *asoc = NULL; - - /* First, verify that this is a kernel address. */ - if (sctp_is_valid_kaddr((unsigned long) id)) { - sctp_association_t *temp = (sctp_association_t *) id; - - /* Verify that this _is_ an sctp_association_t - * data structure and if so, that the socket matches. - */ - if ((SCTP_ASSOC_EYECATCHER == temp->eyecatcher) && - (temp->base.sk == sk)) - asoc = temp; - } +sctp_association_t *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); - return asoc; -} /* A macro to walk a list of skbs. */ #define sctp_skb_for_each(pos, head, tmp) \ @@ -494,7 +471,7 @@ extern void sctp_put_port(struct sock *sk); /* Static inline functions. */ /* Return the SCTP protocol structure. */ -static inline sctp_protocol_t *sctp_get_protocol(void) +static inline struct sctp_protocol *sctp_get_protocol(void) { return &sctp_proto; } @@ -523,21 +500,21 @@ static inline int ipver2af(__u8 ipver) /* This is the hash function for the SCTP port hash table. */ static inline int sctp_phashfn(__u16 lport) { - sctp_protocol_t *sctp_proto = sctp_get_protocol(); + struct sctp_protocol *sctp_proto = sctp_get_protocol(); return (lport & (sctp_proto->port_hashsize - 1)); } /* This is the hash function for the endpoint hash table. */ static inline int sctp_ep_hashfn(__u16 lport) { - sctp_protocol_t *sctp_proto = sctp_get_protocol(); + struct sctp_protocol *sctp_proto = sctp_get_protocol(); return (lport & (sctp_proto->ep_hashsize - 1)); } /* This is the hash function for the association hash table. */ static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) { - sctp_protocol_t *sctp_proto = sctp_get_protocol(); + struct sctp_protocol *sctp_proto = sctp_get_protocol(); int h = (lport << 16) + rport; h ^= h>>8; return (h & (sctp_proto->assoc_hashsize - 1)); @@ -549,7 +526,7 @@ static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) */ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag) { - sctp_protocol_t *sctp_proto = sctp_get_protocol(); + struct sctp_protocol *sctp_proto = sctp_get_protocol(); int h = (lport << 16) + rport; h ^= vtag; return (h & (sctp_proto->assoc_hashsize-1)); diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index 7b08e90a102a..16737eda8d8c 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h @@ -3,40 +3,40 @@ * Copyright (c) 1999-2001 Motorola, Inc. * Copyright (c) 2001 Intel Corp. * Copyright (c) 2001-2002 International Business Machines Corp. - * + * * This file is part of the SCTP kernel reference Implementation - * + * * This file is part of the implementation of the add-IP extension, * based on <draft-ietf-tsvwg-addip-sctp-02.txt> June 29, 2001, * for the SCTP kernel reference Implementation. - * + * * These are definitions needed by the state machine. - * - * The SCTP reference implementation is free software; - * you can redistribute it and/or modify it under the terms of + * + * The SCTP reference implementation is free software; + * you can redistribute it and/or modify it under the terms of * the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * - * The SCTP reference implementation is distributed in the hope that it + * + * The SCTP reference implementation is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied * ************************ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU CC; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * + * Boston, MA 02111-1307, USA. + * * Please send any bug reports or fixes you make to the * email addresses: * lksctp developers <lksctp-developers@lists.sourceforge.net> - * + * * Or submit a bug report through the following website: * http://www.sf.net/projects/lksctp * - * Written or modified by: + * Written or modified by: * La Monte H.P. Yarroll <piggy@acm.org> * Karl Knutson <karl@athena.chicago.il.us> * Xingang Guo <xingang.guo@intel.com> @@ -313,18 +313,18 @@ void sctp_generate_t3_rtx_event(unsigned long peer); void sctp_generate_heartbeat_event(unsigned long peer); sctp_sackhdr_t *sctp_sm_pull_sack(sctp_chunk_t *); -sctp_packet_t *sctp_abort_pkt_new(const sctp_endpoint_t *ep, - const sctp_association_t *asoc, - sctp_chunk_t *chunk, - const void *payload, - size_t paylen); -sctp_packet_t *sctp_ootb_pkt_new(const sctp_association_t *asoc, - const sctp_chunk_t *chunk); -void sctp_ootb_pkt_free(sctp_packet_t *packet); +struct sctp_packet *sctp_abort_pkt_new(const struct sctp_endpoint *, + const struct sctp_association *, + struct sctp_chunk *chunk, + const void *payload, + size_t paylen); +struct sctp_packet *sctp_ootb_pkt_new(const struct sctp_association *, + const struct sctp_chunk *); +void sctp_ootb_pkt_free(struct sctp_packet *); sctp_cookie_param_t * -sctp_pack_cookie(const sctp_endpoint_t *, const sctp_association_t *, - const sctp_chunk_t *, int *cookie_len, +sctp_pack_cookie(const struct sctp_endpoint *, const struct sctp_association *, + const struct sctp_chunk *, int *cookie_len, const __u8 *, int addrs_len); sctp_association_t *sctp_unpack_cookie(const sctp_endpoint_t *, const sctp_association_t *, diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index cf6cec92f88f..913c4769b343 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -86,10 +86,8 @@ struct sctp_opt; struct sctp_endpoint_common; struct sctp_ssnmap; -typedef struct sctp_protocol sctp_protocol_t; typedef struct sctp_endpoint sctp_endpoint_t; typedef struct sctp_association sctp_association_t; -typedef struct sctp_packet sctp_packet_t; typedef struct sctp_chunk sctp_chunk_t; typedef struct sctp_bind_addr sctp_bind_addr_t; typedef struct sctp_endpoint_common sctp_endpoint_common_t; @@ -222,7 +220,7 @@ struct sctp_af { void (*get_saddr) (struct sctp_association *asoc, struct dst_entry *dst, union sctp_addr *daddr, - union sctp_addr *saddr); + union sctp_addr *saddr); void (*copy_addrlist) (struct list_head *, struct net_device *); void (*dst_saddr) (union sctp_addr *saddr, @@ -262,6 +260,9 @@ struct sctp_pf { const union sctp_addr *, struct sctp_opt *); int (*bind_verify) (struct sctp_opt *, union sctp_addr *); + int (*supported_addrs)(const struct sctp_opt *, __u16 *); + struct sock *(*create_accept_sk) (struct sock *sk, + struct sctp_association *asoc); struct sctp_af *af; }; @@ -366,8 +367,6 @@ typedef struct sctp_signed_cookie { sctp_cookie_t c; } sctp_signed_cookie_t; - - /* This is another convenience type to allocate memory for address * params for the maximum size and pass such structures around * internally. @@ -604,26 +603,26 @@ struct sctp_packet { typedef int (sctp_outq_thandler_t)(struct sctp_outq *, void *); typedef int (sctp_outq_ehandler_t)(struct sctp_outq *); -typedef sctp_packet_t *(sctp_outq_ohandler_init_t) - (sctp_packet_t *, +typedef struct sctp_packet *(sctp_outq_ohandler_init_t) + (struct sctp_packet *, struct sctp_transport *, __u16 sport, __u16 dport); -typedef sctp_packet_t *(sctp_outq_ohandler_config_t) - (sctp_packet_t *, +typedef struct sctp_packet *(sctp_outq_ohandler_config_t) + (struct sctp_packet *, __u32 vtag, int ecn_capable, sctp_packet_phandler_t *get_prepend_chunk); -typedef sctp_xmit_t (sctp_outq_ohandler_t)(sctp_packet_t *, +typedef sctp_xmit_t (sctp_outq_ohandler_t)(struct sctp_packet *, sctp_chunk_t *); -typedef int (sctp_outq_ohandler_force_t)(sctp_packet_t *); +typedef int (sctp_outq_ohandler_force_t)(struct sctp_packet *); sctp_outq_ohandler_init_t sctp_packet_init; sctp_outq_ohandler_config_t sctp_packet_config; sctp_outq_ohandler_t sctp_packet_append_chunk; sctp_outq_ohandler_t sctp_packet_transmit_chunk; sctp_outq_ohandler_force_t sctp_packet_transmit; -void sctp_packet_free(sctp_packet_t *); +void sctp_packet_free(struct sctp_packet *); /* This represents a remote transport address. @@ -789,7 +788,7 @@ struct sctp_transport { struct list_head transmitted; /* We build bundle-able packets for this transport here. */ - sctp_packet_t packet; + struct sctp_packet packet; /* This is the list of transports that have chunks to send. */ struct list_head send_ready; @@ -865,12 +864,11 @@ void sctp_inq_set_th_handler(struct sctp_inq *, void (*)(void *), void *); struct sctp_outq { sctp_association_t *asoc; - /* BUG: This really should be an array of streams. - * This really holds a list of chunks (one stream). - * FIXME: If true, why so? - */ + /* Data pending that has never been transmitted. */ struct sk_buff_head out; + unsigned out_qlen; /* Total length of queued data chunks. */ + /* These are control chunks we want to send. */ struct sk_buff_head control; @@ -885,7 +883,7 @@ struct sctp_outq { struct list_head retransmit; /* Call these functions to send chunks down to the next lower - * layer. This is always SCTP_packet, but we separate the two + * layer. This is always sctp_packet, but we separate the two * structures to make testing simpler. */ sctp_outq_ohandler_init_t *init_output; @@ -1098,8 +1096,9 @@ static inline sctp_endpoint_t *sctp_ep(sctp_endpoint_common_t *base) } /* These are function signatures for manipulating endpoints. */ -sctp_endpoint_t *sctp_endpoint_new(sctp_protocol_t *, struct sock *, int); -sctp_endpoint_t *sctp_endpoint_init(sctp_endpoint_t *, sctp_protocol_t *, +sctp_endpoint_t *sctp_endpoint_new(struct sctp_protocol *, struct sock *, int); +sctp_endpoint_t *sctp_endpoint_init(struct sctp_endpoint *, + struct sctp_protocol *, struct sock *, int priority); void sctp_endpoint_free(sctp_endpoint_t *); void sctp_endpoint_put(sctp_endpoint_t *); @@ -1111,7 +1110,6 @@ sctp_association_t *sctp_endpoint_lookup_assoc(const sctp_endpoint_t *ep, int sctp_endpoint_is_peeled_off(sctp_endpoint_t *, const union sctp_addr *); sctp_endpoint_t *sctp_endpoint_is_match(sctp_endpoint_t *, const union sctp_addr *); - int sctp_has_association(const union sctp_addr *laddr, const union sctp_addr *paddr); @@ -1587,7 +1585,7 @@ struct sctp_transport *sctp_assoc_lookup_paddr(const sctp_association_t *, struct sctp_transport *sctp_assoc_add_peer(sctp_association_t *, const union sctp_addr *address, const int priority); -void sctp_assoc_control_transport(sctp_association_t *, +void sctp_assoc_control_transport(struct sctp_association *, struct sctp_transport *, sctp_transport_cmd_t, sctp_sn_error_t); struct sctp_transport *sctp_assoc_lookup_tsn(sctp_association_t *, __u32); @@ -1597,14 +1595,14 @@ struct sctp_transport *sctp_assoc_is_match(sctp_association_t *, void sctp_assoc_migrate(sctp_association_t *, struct sock *); void sctp_assoc_update(sctp_association_t *dst, sctp_association_t *src); -__u32 __sctp_association_get_next_tsn(sctp_association_t *); -__u32 __sctp_association_get_tsn_block(sctp_association_t *, int); -__u16 __sctp_association_get_next_ssn(sctp_association_t *, __u16 sid); - -void sctp_assoc_sync_pmtu(sctp_association_t *); -void sctp_assoc_rwnd_increase(sctp_association_t *, int); -void sctp_assoc_rwnd_decrease(sctp_association_t *, int); +__u32 sctp_association_get_next_tsn(struct sctp_association *); +__u32 sctp_association_get_tsn_block(struct sctp_association *, int); +void sctp_assoc_sync_pmtu(struct sctp_association *); +void sctp_assoc_rwnd_increase(struct sctp_association *, int); +void sctp_assoc_rwnd_decrease(struct sctp_association *, int); +void sctp_assoc_set_primary(struct sctp_association *, + struct sctp_transport *); int sctp_assoc_set_bind_addr_from_ep(sctp_association_t *, int); int sctp_assoc_set_bind_addr_from_cookie(sctp_association_t *, sctp_cookie_t *, int); diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index 3ca725e132bd..e8cf2aedec87 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h @@ -108,6 +108,8 @@ enum sctp_optname { #define SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ #define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS + SCTP_NODELAY, /* Get/set nodelay option. */ +#define SCTP_NODELAY SCTP_NODELAY }; diff --git a/include/net/tcp.h b/include/net/tcp.h index f1a634dfeb9b..b652650286fe 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -927,7 +927,8 @@ static __inline__ unsigned int tcp_current_mss(struct sock *sk, int large) if (dst) { u32 mtu = dst_pmtu(dst); - if (mtu != tp->pmtu_cookie) + if (mtu != tp->pmtu_cookie || + tp->ext2_header_len != dst->header_len) mss_now = tcp_sync_mss(sk, mtu); } if (tp->eff_sacks) diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 2279a0981812..fd99637a96bc 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -107,6 +107,7 @@ struct xfrm_state u16 family; xfrm_address_t saddr; int header_len; + int trailer_len; } props; struct xfrm_lifetime_cfg lft; @@ -255,6 +256,11 @@ static inline void xfrm_state_put(struct xfrm_state *x) __xfrm_state_destroy(x); } +static inline void xfrm_state_hold(struct xfrm_state *x) +{ + atomic_inc(&x->refcnt); +} + static inline int xfrm4_selector_match(struct xfrm_selector *sel, struct flowi *fl) { @@ -353,7 +359,7 @@ extern int __xfrm_sk_clone_policy(struct sock *sk); static inline int xfrm_sk_clone_policy(struct sock *sk) { if (unlikely(sk->policy[0] || sk->policy[1])) - return xfrm_sk_clone_policy(sk); + return __xfrm_sk_clone_policy(sk); return 0; } diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 159f282df20e..57415914c610 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h @@ -156,12 +156,30 @@ /* extended modem ID bit defines */ #define AC97_MEI_LINE1 0x0001 /* Line1 present */ #define AC97_MEI_LINE2 0x0002 /* Line2 present */ -#define AC97_MEI_HEADSET 0x0004 /* Headset present */ +#define AC97_MEI_HANDSET 0x0004 /* Handset present */ #define AC97_MEI_CID1 0x0008 /* caller ID decode for Line1 is supported */ #define AC97_MEI_CID2 0x0010 /* caller ID decode for Line2 is supported */ #define AC97_MEI_ADDR_MASK 0xc000 /* physical codec ID (address) */ #define AC97_MEI_ADDR_SHIFT 14 +/* extended modem status and control bit defines */ +#define AC97_MEA_GPIO 0x0001 /* GPIO is ready (ro) */ +#define AC97_MEA_MREF 0x0002 /* Vref is up to nominal level (ro) */ +#define AC97_MEA_ADC1 0x0004 /* ADC1 operational (ro) */ +#define AC97_MEA_DAC1 0x0008 /* DAC1 operational (ro) */ +#define AC97_MEA_ADC2 0x0010 /* ADC2 operational (ro) */ +#define AC97_MEA_DAC2 0x0020 /* DAC2 operational (ro) */ +#define AC97_MEA_HADC 0x0040 /* HADC operational (ro) */ +#define AC97_MEA_HDAC 0x0080 /* HDAC operational (ro) */ +#define AC97_MEA_PRA 0x0100 /* GPIO power down (high) */ +#define AC97_MEA_PRB 0x0200 /* reserved */ +#define AC97_MEA_PRC 0x0400 /* ADC1 power down (high) */ +#define AC97_MEA_PRD 0x0800 /* DAC1 power down (high) */ +#define AC97_MEA_PRE 0x1000 /* ADC2 power down (high) */ +#define AC97_MEA_PRF 0x2000 /* DAC2 power down (high) */ +#define AC97_MEA_PRG 0x4000 /* HADC power down (high) */ +#define AC97_MEA_PRH 0x8000 /* HDAC power down (high) */ + /* specific - SigmaTel */ #define AC97_SIGMATEL_ANALOG 0x6c /* Analog Special */ #define AC97_SIGMATEL_DAC2INVERT 0x6e @@ -268,6 +286,14 @@ struct _snd_ac97 { }; /* conditions */ +static inline int ac97_is_audio(ac97_t * ac97) +{ + return (ac97->scaps & AC97_SCAP_AUDIO); +} +static inline int ac97_is_modem(ac97_t * ac97) +{ + return (ac97->scaps & AC97_SCAP_MODEM); +} static inline int ac97_is_rev22(ac97_t * ac97) { return (ac97->ext_id & AC97_EI_REV_MASK) == AC97_EI_REV_22; @@ -278,7 +304,8 @@ static inline int ac97_can_amap(ac97_t * ac97) } /* functions */ -int snd_ac97_mixer(snd_card_t * card, ac97_t * _ac97, ac97_t ** rac97); +int snd_ac97_mixer(snd_card_t * card, ac97_t * _ac97, ac97_t ** rac97); /* create mixer controls */ +int snd_ac97_modem(snd_card_t * card, ac97_t * _ac97, ac97_t ** rac97); /* create modem controls */ void snd_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short value); unsigned short snd_ac97_read(ac97_t *ac97, unsigned short reg); @@ -296,6 +323,7 @@ enum { AC97_TUNE_HP_ONLY, AC97_TUNE_SWAP_HP }; struct ac97_quirk { unsigned short vendor; unsigned short device; + const char *name; int type; }; diff --git a/include/sound/asound.h b/include/sound/asound.h index 9e351ebaf847..53836234e31b 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -1,6 +1,6 @@ /* * Advanced Linux Sound Architecture - ALSA - Driver - * Copyright (c) 1994-2000 by Jaroslav Kysela <perex@suse.cz>, + * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@suse.cz>, * Abramo Bagnara <abramo@alsa-project.org> * * @@ -93,7 +93,7 @@ struct sndrv_aes_iec958 { * * ****************************************************************************/ -#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 0) +#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) enum sndrv_hwdep_iface { SNDRV_HWDEP_IFACE_OPL2 = 0, @@ -104,9 +104,10 @@ enum sndrv_hwdep_iface { SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */ SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */ SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */ + SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */ /* Don't forget to change the following: */ - SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_SSCAPE, + SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_VX, }; struct sndrv_hwdep_info { @@ -118,9 +119,29 @@ struct sndrv_hwdep_info { unsigned char reserved[64]; /* reserved for future */ }; +/* generic DSP loader */ +struct sndrv_hwdep_dsp_status { + unsigned int version; /* R: driver-specific version */ + unsigned char id[32]; /* R: driver-specific ID string */ + unsigned int num_dsps; /* R: number of DSP images to transfer */ + unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */ + unsigned int chip_ready; /* R: 1 = initialization finished */ + unsigned char reserved[16]; /* reserved for future use */ +}; + +struct sndrv_hwdep_dsp_image { + unsigned int index; /* W: DSP index */ + unsigned char name[64]; /* W: ID (e.g. file name) */ + unsigned char *image; /* W: binary image */ + size_t length; /* W: size of image in bytes */ + unsigned long driver_data; /* W: driver-specific data */ +}; + enum { SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int), SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct sndrv_hwdep_info), + SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct sndrv_hwdep_dsp_status), + SNDRV_HWDEP_IOCTL_DSP_LOAD = _IOW('H', 0x03, struct sndrv_hwdep_dsp_image) }; /***************************************************************************** @@ -129,7 +150,7 @@ enum { * * *****************************************************************************/ -#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3) +#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) typedef unsigned long sndrv_pcm_uframes_t; typedef long sndrv_pcm_sframes_t; @@ -377,8 +398,8 @@ struct sndrv_pcm_channel_info { struct sndrv_pcm_status { enum sndrv_pcm_state state; /* stream state */ - struct timeval trigger_tstamp; /* time when stream was started/stopped/paused */ - struct timeval tstamp; /* reference timestamp */ + struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ + struct timespec tstamp; /* reference timestamp */ sndrv_pcm_uframes_t appl_ptr; /* appl ptr */ sndrv_pcm_uframes_t hw_ptr; /* hw ptr */ sndrv_pcm_sframes_t delay; /* current delay in frames */ @@ -393,7 +414,7 @@ struct sndrv_pcm_mmap_status { enum sndrv_pcm_state state; /* RO: state - SNDRV_PCM_STATE_XXXX */ int pad1; /* Needed for 64 bit alignment */ sndrv_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ - struct timeval tstamp; /* Timestamp */ + struct timespec tstamp; /* Timestamp */ enum sndrv_pcm_state suspended_state; /* RO: suspended stream state */ }; @@ -417,6 +438,7 @@ struct sndrv_xfern { enum { SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int), SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct sndrv_pcm_info), + SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int), SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct sndrv_pcm_hw_params), SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct sndrv_pcm_hw_params), SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12), @@ -434,6 +456,7 @@ enum { SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, sndrv_pcm_uframes_t), SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47), SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48), + SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, sndrv_pcm_uframes_t), SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct sndrv_xferi), SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct sndrv_xferi), SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct sndrv_xfern), @@ -491,7 +514,7 @@ struct sndrv_rawmidi_params { struct sndrv_rawmidi_status { enum sndrv_rawmidi_stream stream; - struct timeval tstamp; /* Timestamp */ + struct timespec tstamp; /* Timestamp */ size_t avail; /* available bytes */ size_t xruns; /* count of overruns since last status (in bytes) */ unsigned char reserved[16]; /* reserved for future use */ @@ -510,7 +533,7 @@ enum { * Timer section - /dev/snd/timer */ -#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) +#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1) enum sndrv_timer_class { SNDRV_TIMER_CLASS_NONE = -1, @@ -534,6 +557,9 @@ enum sndrv_timer_slave_class { #define SNDRV_TIMER_GLOBAL_SYSTEM 0 #define SNDRV_TIMER_GLOBAL_RTC 1 +/* info flags */ +#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ + struct sndrv_timer_id { enum sndrv_timer_class dev_class; enum sndrv_timer_slave_class dev_sclass; @@ -542,36 +568,65 @@ struct sndrv_timer_id { int subdevice; }; +struct sndrv_timer_ginfo { + struct sndrv_timer_id tid; /* requested timer ID */ + unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ + int card; /* card number */ + unsigned char id[64]; /* timer identification */ + unsigned char name[80]; /* timer name */ + unsigned long reserved0; /* reserved for future use */ + unsigned long resolution; /* average period resolution in ns */ + unsigned long resolution_min; /* minimal period resolution in ns */ + unsigned long resolution_max; /* maximal period resolution in ns */ + unsigned int clients; /* active timer clients */ + unsigned char reserved[32]; +}; + +struct sndrv_timer_gparams { + struct sndrv_timer_id tid; /* requested timer ID */ + unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ + unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ + unsigned char reserved[32]; +}; + +struct sndrv_timer_gstatus { + struct sndrv_timer_id tid; /* requested timer ID */ + unsigned long resolution; /* current period resolution in ns */ + unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ + unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ + unsigned char reserved[32]; +}; + struct sndrv_timer_select { struct sndrv_timer_id id; /* bind to timer ID */ unsigned char reserved[32]; /* reserved */ }; -#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ - struct sndrv_timer_info { unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ - int card; /* R: card number */ + int card; /* card number */ unsigned char id[64]; /* timer identificator */ unsigned char name[80]; /* timer name */ - unsigned long ticks; /* maximum ticks */ - unsigned long resolution; /* average resolution */ + unsigned long reserved0; /* reserved for future use */ + unsigned long resolution; /* average period resolution in ns */ unsigned char reserved[64]; /* reserved */ }; -#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* supports auto start */ +#define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */ +#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ struct sndrv_timer_params { unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */ unsigned int ticks; /* requested resolution in ticks */ unsigned int queue_size; /* total size of queue (32-1024) */ unsigned int reserved0; /* reserved, was: failure locations */ - unsigned char reserved[64]; /* reserved */ + unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */ + unsigned char reserved[60]; /* reserved */ }; struct sndrv_timer_status { - struct timeval tstamp; /* Timestamp */ - unsigned int resolution; /* current resolution */ + struct timespec tstamp; /* Timestamp - last update */ + unsigned int resolution; /* current period resolution in ns */ unsigned int lost; /* counter of master tick lost */ unsigned int overrun; /* count of read queue overruns */ unsigned int queue; /* used queue size */ @@ -581,13 +636,18 @@ struct sndrv_timer_status { enum { SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int), SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct sndrv_timer_id), + SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int), + SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct sndrv_timer_ginfo), + SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct sndrv_timer_gparams), + SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct sndrv_timer_gstatus), SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct sndrv_timer_select), SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct sndrv_timer_info), SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct sndrv_timer_params), - SNDRV_TIMER_IOCTL_STATUS = _IOW('T', 0x14, struct sndrv_timer_status), + SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct sndrv_timer_status), SNDRV_TIMER_IOCTL_START = _IO('T', 0x20), SNDRV_TIMER_IOCTL_STOP = _IO('T', 0x21), SNDRV_TIMER_IOCTL_CONTINUE = _IO('T', 0x22), + SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0x23), }; struct sndrv_timer_read { @@ -595,13 +655,33 @@ struct sndrv_timer_read { unsigned int ticks; }; +enum sndrv_timer_event { + SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ + SNDRV_TIMER_EVENT_TICK, /* val = ticks */ + SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ + SNDRV_TIMER_EVENT_STOP, /* val = 0 */ + SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */ + SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */ + /* master timer events for slave timer instances */ + SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10, + SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10, + SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10, + SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10, +}; + +struct sndrv_timer_tread { + enum sndrv_timer_event event; + struct timespec tstamp; + unsigned int val; +}; + /**************************************************************************** * * * Section for driver control interface - /dev/snd/control? * * * ****************************************************************************/ -#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) +#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1) struct sndrv_ctl_card_info { int card; /* card number */ @@ -642,6 +722,7 @@ enum sndrv_ctl_elem_iface { #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ +#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<2) /* when was control changed */ #define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ #define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ #define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ @@ -722,7 +803,8 @@ struct sndrv_ctl_elem_value { } bytes; struct sndrv_aes_iec958 iec958; } value; /* RO */ - unsigned char reserved[128]; + struct timespec tstamp; + unsigned char reserved[128-sizeof(struct timespec)]; }; enum { diff --git a/include/sound/core.h b/include/sound/core.h index f8fe11831666..00f46338f964 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -27,7 +27,7 @@ #include <linux/rwsem.h> /* struct rw_semaphore */ /* Typedef's */ -typedef struct timeval snd_timestamp_t; +typedef struct timespec snd_timestamp_t; typedef struct sndrv_interval snd_interval_t; typedef enum sndrv_card_type snd_card_type; typedef struct sndrv_xferi snd_xferi_t; @@ -275,32 +275,6 @@ void snd_hidden_vfree(void *obj); #endif void *snd_kcalloc(size_t size, int flags); char *snd_kmalloc_strdup(const char *string, int flags); -void *snd_malloc_pages(unsigned long size, unsigned int dma_flags); -void *snd_malloc_pages_fallback(unsigned long size, unsigned int dma_flags, unsigned long *res_size); -void snd_free_pages(void *ptr, unsigned long size); -#ifdef CONFIG_PCI -void *snd_malloc_pci_pages(struct pci_dev *pci, unsigned long size, dma_addr_t *dma_addr); -void *snd_malloc_pci_pages_fallback(struct pci_dev *pci, unsigned long size, dma_addr_t *dma_addr, unsigned long *res_size); -void snd_free_pci_pages(struct pci_dev *pci, unsigned long size, void *ptr, dma_addr_t dma_addr); -void *snd_malloc_pci_page(struct pci_dev *pci, dma_addr_t *dma_addr); -#define snd_free_pci_page(pci,ptr,addr) snd_free_pci_pages(pci,PAGE_SIZE,ptr,addr) -#endif -#ifdef CONFIG_SBUS -void *snd_malloc_sbus_pages(struct sbus_dev *sdev, unsigned long size, dma_addr_t *dma_addr); -void *snd_malloc_sbus_pages_fallback(struct sbus_dev *sdev, unsigned long size, dma_addr_t *dma_addr, unsigned long *res_size); -void snd_free_sbus_pages(struct sbus_dev *sdev, unsigned long size, void *ptr, dma_addr_t dma_addr); -#endif -#ifdef CONFIG_ISA -#ifdef CONFIG_PCI -#define snd_malloc_isa_pages(size, dma_addr) snd_malloc_pci_pages(NULL, size, dma_addr) -#define snd_malloc_isa_pages_fallback(size, dma_addr, res_size) snd_malloc_pci_pages_fallback(NULL, size, dma_addr, res_size) -#define snd_free_isa_pages(size, ptr, dma_addr) snd_free_pci_pages(NULL, size, ptr, dma_addr) -#else /* !CONFIG_PCI */ -void *snd_malloc_isa_pages(unsigned long size, dma_addr_t *dma_addr); -void *snd_malloc_isa_pages_fallback(unsigned long size, dma_addr_t *dma_addr, unsigned long *res_size); -#define snd_free_isa_pages(size, ptr, dma_addr) snd_free_pages(ptr, size) -#endif /* CONFIG_PCI */ -#endif /* CONFIG_ISA */ int copy_to_user_fromio(void *dst, unsigned long src, size_t count); int copy_from_user_toio(unsigned long dst, const void *src, size_t count); @@ -450,9 +424,27 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...); #define snd_BUG() snd_assert(0, ) -#define snd_timestamp_now(tstamp) do_gettimeofday(tstamp) -#define snd_timestamp_zero(tstamp) do { (tstamp)->tv_sec = 0; (tstamp)->tv_usec = 0; } while (0) -#define snd_timestamp_null(tstamp) ((tstamp)->tv_sec == 0 && (tstamp)->tv_usec ==0) +static inline void snd_timestamp_now(struct timespec *tstamp, int timespec) +{ + struct timeval val; + /* FIXME: use a linear time source */ + do_gettimeofday(&val); + tstamp->tv_sec = val.tv_sec; + tstamp->tv_nsec = val.tv_usec; + if (timespec) + tstamp->tv_nsec *= 1000L; +} + +static inline void snd_timestamp_zero(struct timespec *tstamp) +{ + tstamp->tv_sec = 0; + tstamp->tv_nsec = 0; +} + +static inline int snd_timestamp_null(struct timespec *tstamp) +{ + return tstamp->tv_sec == 0 && tstamp->tv_nsec == 0; +} #define SNDRV_OSS_VERSION ((3<<16)|(8<<8)|(1<<4)|(0)) /* 3.8.1a */ diff --git a/include/sound/driver.h b/include/sound/driver.h index 6a7ff07236b0..84416da19845 100644 --- a/include/sound/driver.h +++ b/include/sound/driver.h @@ -49,20 +49,6 @@ * ========================================================================== */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) -#if defined(__i386__) || defined(__ppc__) || defined(__x86_64__) -/* - * Here a dirty hack for 2.4 kernels.. See sound/core/memory.c. - */ -#define HACK_PCI_ALLOC_CONSISTENT -#include <linux/pci.h> -void *snd_pci_hack_alloc_consistent(struct pci_dev *hwdev, size_t size, - dma_addr_t *dma_handle); -#undef pci_alloc_consistent -#define pci_alloc_consistent snd_pci_hack_alloc_consistent -#endif /* i386 or ppc */ -#endif /* 2.4.0 */ - #ifdef CONFIG_SND_DEBUG_MEMORY #include <linux/slab.h> #include <linux/vmalloc.h> diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index d5b57b2ccbdb..e412b1751aea 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h @@ -49,6 +49,8 @@ #define NUM_G 64 /* use all channels */ #define NUM_FXSENDS 4 +#define EMU10K1_DMA_MASK 0x1fffffffUL +#define AUDIGY_DMA_MASK 0xffffffffUL #define TMEMSIZE 256*1024 #define TMEMSIZEREG 4 @@ -232,6 +234,8 @@ #define A_GPINPUT_MASK 0xff00 #define A_GPOUTPUT_MASK 0x00ff #define A_IOCFG_GPOUT0 0x0044 /* analog/digital? */ +#define A_IOCFG_GPOUT1 0x0002 /* IR */ +#define A_IOCFG_GPOUT2 0x0001 /* IR */ #define TIMER 0x1a /* Timer terminal count register */ /* NOTE: After the rate is changed, a maximum */ @@ -936,6 +940,7 @@ struct _snd_emu10k1 { unsigned short model; /* subsystem id */ unsigned int card_type; /* EMU10K1_CARD_* */ unsigned int ecard_ctrl; /* ecard control bits */ + unsigned long dma_mask; /* PCI DMA mask */ int max_cache_pages; /* max memory size / PAGE_SIZE */ void *silent_page; /* silent page */ dma_addr_t silent_page_dmaaddr; diff --git a/include/sound/hwdep.h b/include/sound/hwdep.h index 7854716fef1c..5e72865bd4c1 100644 --- a/include/sound/hwdep.h +++ b/include/sound/hwdep.h @@ -27,6 +27,8 @@ typedef enum sndrv_hwdep_iface snd_hwdep_iface_t; typedef struct sndrv_hwdep_info snd_hwdep_info_t; +typedef struct sndrv_hwdep_dsp_status snd_hwdep_dsp_status_t; +typedef struct sndrv_hwdep_dsp_image snd_hwdep_dsp_image_t; typedef struct _snd_hwdep_ops { long long (*llseek) (snd_hwdep_t *hw, struct file * file, long long offset, int orig); @@ -37,6 +39,8 @@ typedef struct _snd_hwdep_ops { unsigned int (*poll) (snd_hwdep_t * hw, struct file * file, poll_table * wait); int (*ioctl) (snd_hwdep_t * hw, struct file * file, unsigned int cmd, unsigned long arg); int (*mmap) (snd_hwdep_t * hw, struct file * file, struct vm_area_struct * vma); + int (*dsp_status) (snd_hwdep_t * hw, snd_hwdep_dsp_status_t * status); + int (*dsp_load) (snd_hwdep_t * hw, snd_hwdep_dsp_image_t * image); } snd_hwdep_ops_t; struct _snd_hwdep { @@ -56,6 +60,11 @@ struct _snd_hwdep { wait_queue_head_t open_wait; void *private_data; void (*private_free) (snd_hwdep_t *hwdep); + + struct semaphore open_mutex; + int used; + unsigned int dsp_loaded; + unsigned int exclusive: 1; }; extern int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep); diff --git a/include/sound/initval.h b/include/sound/initval.h index 4cc972dd71ee..7ccacd52b015 100644 --- a/include/sound/initval.h +++ b/include/sound/initval.h @@ -67,7 +67,7 @@ static const char __module_generic_string_##name [] \ #define SNDRV_BOOLEAN_TRUE_DESC "allows:{{0,Disabled},{1,Enabled}},default:1,dialog:check" #define SNDRV_BOOLEAN_FALSE_DESC "allows:{{0,Disabled},{1,Enabled}},default:0,dialog:check" -#define SNDRV_ENABLED "enable:(snd_enable)" +#define SNDRV_ENABLED "enable:(enable)" #define SNDRV_INDEX_DESC SNDRV_ENABLED ",allows:{{0,7}},unique,skill:required,dialog:list" #define SNDRV_ID_DESC SNDRV_ENABLED ",unique" diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h new file mode 100644 index 000000000000..3871390993e2 --- /dev/null +++ b/include/sound/memalloc.h @@ -0,0 +1,193 @@ +/* + * Copyright (c) by Jaroslav Kysela <perex@suse.cz> + * Takashi Iwai <tiwai@suse.de> + * + * Generic memory allocators + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __SOUND_MEMALLOC_H +#define __SOUND_MEMALLOC_H + +#include <linux/pci.h> +#ifdef CONFIG_SBUS +#include <asm/sbus.h> +#endif + +/* + * buffer device info + */ +struct snd_dma_device { + int type; /* SNDRV_MEM_TYPE_XXX */ + union { + struct pci_dev *pci; /* for PCI and PCI-SG types */ + unsigned int flags; /* GFP_XXX for continous and ISA types */ +#ifdef CONFIG_SBUS + struct sbus_dev *sbus; /* for SBUS type */ +#endif + } dev; + unsigned int id; /* a unique ID */ +}; + +/* + * buffer types + */ +#define SNDRV_DMA_TYPE_UNKNOWN 0 /* not defined */ +#define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ +#define SNDRV_DMA_TYPE_ISA 2 /* ISA continuous */ +#define SNDRV_DMA_TYPE_PCI 3 /* PCI continuous */ +#define SNDRV_DMA_TYPE_SBUS 4 /* SBUS continuous */ +#define SNDRV_DMA_TYPE_PCI_SG 5 /* PCI SG-buffer */ + +#ifdef CONFIG_PCI +/* + * compose a snd_dma_device struct for the PCI device + */ +static inline void snd_dma_device_pci(struct snd_dma_device *dev, struct pci_dev *pci, unsigned int id) +{ + memset(dev, 0, sizeof(*dev)); + dev->type = SNDRV_DMA_TYPE_PCI; + dev->dev.pci = pci; + dev->id = id; +} +#endif + + +/* + * info for buffer allocation + */ +struct snd_dma_buffer { + unsigned char *area; /* virtual pointer */ + dma_addr_t addr; /* physical address */ + size_t bytes; /* buffer size in bytes */ + void *private_data; /* private for allocator; don't touch */ +}; + +/* allocate/release a buffer */ +int snd_dma_alloc_pages(const struct snd_dma_device *dev, size_t size, struct snd_dma_buffer *dmab); +void snd_dma_free_pages(const struct snd_dma_device *dev, struct snd_dma_buffer *dmab); + +/* buffer-preservation managements */ +size_t snd_dma_get_reserved(const struct snd_dma_device *dev, struct snd_dma_buffer *dmab); +int snd_dma_free_reserved(const struct snd_dma_device *dev); +int snd_dma_set_reserved(const struct snd_dma_device *dev, struct snd_dma_buffer *dmab); + + +/* + * Generic memory allocators + */ + +/* + * continuous pages + */ +void *snd_malloc_pages(size_t size, unsigned int gfp_flags); +void *snd_malloc_pages_fallback(size_t size, unsigned int gfp_flags, size_t *res_size); +void snd_free_pages(void *ptr, size_t size); + +#ifdef CONFIG_PCI +/* + * PCI continuous pages + */ +void *snd_malloc_pci_pages(struct pci_dev *pci, size_t size, dma_addr_t *dma_addr); +void *snd_malloc_pci_pages_fallback(struct pci_dev *pci, size_t size, dma_addr_t *dma_addr, size_t *res_size); +void snd_free_pci_pages(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t dma_addr); +/* one page allocation */ +void *snd_malloc_pci_page(struct pci_dev *pci, dma_addr_t *dma_addr); +#define snd_free_pci_page(pci,ptr,addr) snd_free_pci_pages(pci,PAGE_SIZE,ptr,addr) +#endif + +#ifdef CONFIG_SBUS +/* + * SBUS continuous pages + */ +void *snd_malloc_sbus_pages(struct sbus_dev *sdev, size_t size, dma_addr_t *dma_addr); +void *snd_malloc_sbus_pages_fallback(struct sbus_dev *sdev, size_t size, dma_addr_t *dma_addr, size_t *res_size); +void snd_free_sbus_pages(struct sbus_dev *sdev, size_t size, void *ptr, dma_addr_t dma_addr); +#endif + +#ifdef CONFIG_ISA +/* + * ISA continuous pages + */ +void *snd_malloc_isa_pages(size_t size, dma_addr_t *dma_addr); +void *snd_malloc_isa_pages_fallback(size_t size, dma_addr_t *dma_addr, size_t *res_size); +void snd_free_isa_pages(size_t size, void *ptr, dma_addr_t addr); +#ifdef CONFIG_PCI +#define snd_malloc_isa_pages(size, dma_addr) snd_malloc_pci_pages(NULL, size, dma_addr) +#define snd_malloc_isa_pages_fallback(size, dma_addr, res_size) snd_malloc_pci_pages_fallback(NULL, size, dma_addr, res_size) +#define snd_free_isa_pages(size, ptr, dma_addr) snd_free_pci_pages(NULL, size, ptr, dma_addr) +#else /* !CONFIG_PCI */ +#define snd_free_isa_pages(size, ptr, dma_addr) snd_free_pages(ptr, size) +#endif /* CONFIG_PCI */ +#endif /* CONFIG_ISA */ + +#ifdef CONFIG_PCI +/* + * Scatter-Gather PCI pages + */ +struct snd_sg_page { + void *buf; + dma_addr_t addr; +}; + +struct snd_sg_buf { + int size; /* allocated byte size */ + int pages; /* allocated pages */ + int tblsize; /* allocated table size */ + struct snd_sg_page *table; /* address table */ + struct page **page_table; /* page table (for vmap/vunmap) */ + struct pci_dev *pci; +}; + +void *snd_malloc_sgbuf_pages(struct pci_dev *pci, size_t size, struct snd_dma_buffer *dmab); +int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab); + +/* + * return the pages matching with the given byte size + */ +static inline unsigned int snd_sgbuf_aligned_pages(size_t size) +{ + return (size + PAGE_SIZE - 1) >> PAGE_SHIFT; +} + +/* + * return the physical address at the corresponding offset + */ +static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset) +{ + return sgbuf->table[offset >> PAGE_SHIFT].addr + offset % PAGE_SIZE; +} +#endif /* CONFIG_PCI */ + + +/* + * wrappers + */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) +#ifdef CONFIG_PCI +#if defined(__i386__) || defined(__ppc__) || defined(__x86_64__) +#define HACK_PCI_ALLOC_CONSISTENT +/* a hack for 2.4/5 kernels for better allocation of large buffers */ +void *snd_pci_hack_alloc_consistent(struct pci_dev *hwdev, size_t size, + dma_addr_t *dma_handle); +#endif /* arch */ +#endif /* CONFIG_PCI */ +#endif /* LINUX >= 2.4.0 */ + + +#endif /* __SOUND_MEMALLOC_H */ diff --git a/include/sound/mpu401.h b/include/sound/mpu401.h index 5ebec02cccd5..7cdbc79cb987 100644 --- a/include/sound/mpu401.h +++ b/include/sound/mpu401.h @@ -42,6 +42,7 @@ #define MPU401_HW_ALS4000 16 /* Avance Logic ALS4000 */ #define MPU401_HW_INTEL8X0 17 /* Intel8x0 driver */ #define MPU401_HW_PC98II 18 /* Roland PC98II */ +#define MPU401_HW_AUREAL 19 /* Aureal Vortex */ #define MPU401_MODE_BIT_INPUT 0 #define MPU401_MODE_BIT_OUTPUT 1 @@ -87,6 +88,9 @@ struct _snd_mpu401 { spinlock_t timer_lock; struct timer_list timer; + + void (*write) (mpu401_t * mpu, unsigned char data, unsigned long addr); + unsigned char (*read) (mpu401_t * mpu, unsigned long addr); }; /* I/O ports */ diff --git a/include/sound/pcm.h b/include/sound/pcm.h index e283dd68ac94..0c87ac501bff 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -24,6 +24,7 @@ */ #include <sound/asound.h> +#include <sound/memalloc.h> #include <linux/poll.h> #include <linux/bitops.h> @@ -49,6 +50,7 @@ typedef struct sndrv_pcm_status snd_pcm_status_t; typedef struct sndrv_pcm_mmap_status snd_pcm_mmap_status_t; typedef struct sndrv_pcm_mmap_control snd_pcm_mmap_control_t; typedef struct sndrv_mask snd_mask_t; +typedef struct snd_sg_buf snd_pcm_sgbuf_t; #define _snd_pcm_substream_chip(substream) ((substream)->private_data) #define snd_pcm_substream_chip(substream) snd_magic_cast1(chip_t, _snd_pcm_substream_chip(substream), return -ENXIO) @@ -97,6 +99,7 @@ typedef struct _snd_pcm_ops { int (*silence)(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos, snd_pcm_uframes_t count); struct page *(*page)(snd_pcm_substream_t *substream, unsigned long offset); + int (*ack)(snd_pcm_substream_t *substream); } snd_pcm_ops_t; /* @@ -120,13 +123,6 @@ typedef struct _snd_pcm_ops { #define SNDRV_PCM_TRIGGER_SUSPEND 5 #define SNDRV_PCM_TRIGGER_RESUME 6 -#define SNDRV_PCM_DMA_TYPE_UNKNOWN 0 /* not defined */ -#define SNDRV_PCM_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ -#define SNDRV_PCM_DMA_TYPE_ISA 2 /* ISA continuous */ -#define SNDRV_PCM_DMA_TYPE_PCI 3 /* PCI continuous */ -#define SNDRV_PCM_DMA_TYPE_SBUS 4 /* SBUS continuous */ -#define SNDRV_PCM_DMA_TYPE_PCI_SG 5 /* PCI SG-buffer */ - /* If you change this don't forget to change rates[] table in pcm_native.c */ #define SNDRV_PCM_RATE_5512 (1<<0) /* 5512Hz */ #define SNDRV_PCM_RATE_8000 (1<<1) /* 8000Hz */ @@ -281,13 +277,6 @@ typedef struct { unsigned int mask; } snd_pcm_hw_constraint_list_t; -struct snd_pcm_dma_buffer { - unsigned char *area; - dma_addr_t addr; - unsigned long bytes; - void *private_data; /* for allocator */ -}; - struct _snd_pcm_runtime { /* -- Status -- */ snd_pcm_substream_t *trigger_master; @@ -316,6 +305,7 @@ struct _snd_pcm_runtime { unsigned int rate_den; /* -- SW params -- */ + int tstamp_timespec; /* use timeval (0) or timespec (1) */ snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */ unsigned int period_step; unsigned int sleep_min; /* min ticks to sleep */ @@ -361,7 +351,7 @@ struct _snd_pcm_runtime { /* -- DMA -- */ unsigned char *dma_area; /* DMA area */ dma_addr_t dma_addr; /* physical bus address (not accessible from main CPU) */ - unsigned long dma_bytes; /* size of DMA area */ + size_t dma_bytes; /* size of DMA area */ void *dma_private; /* private DMA data for the memory allocator */ #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) @@ -378,17 +368,17 @@ struct _snd_pcm_substream { char name[32]; /* substream name */ int stream; /* stream (direction) */ size_t buffer_bytes_max; /* limit ring buffer size */ - int dma_type; - struct snd_pcm_dma_buffer dma_buffer; + struct snd_dma_device dma_device; + struct snd_dma_buffer dma_buffer; size_t dma_max; - void *dma_private; /* -- hardware operations -- */ + unsigned int open_flag: 1; /* lowlevel device has been opened */ snd_pcm_ops_t *ops; /* -- runtime information -- */ snd_pcm_runtime_t *runtime; /* -- timer section -- */ snd_timer_t *timer; /* timer */ - int timer_running; /* time is running */ + int timer_running: 1; /* time is running */ spinlock_t timer_lock; /* -- next substream -- */ snd_pcm_substream_t *next; @@ -879,7 +869,18 @@ int snd_pcm_lib_preallocate_pci_pages_for_all(struct pci_dev *pci, snd_pcm_t *pcm, size_t size, size_t max); +int snd_pcm_lib_preallocate_sg_pages(struct pci_dev *pci, + snd_pcm_substream_t *substream, + size_t size, size_t max); +int snd_pcm_lib_preallocate_sg_pages_for_all(struct pci_dev *pci, + snd_pcm_t *pcm, + size_t size, size_t max); +#define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_private) +#define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size) +#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs) +struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned long offset); #endif + #ifdef CONFIG_SBUS int snd_pcm_lib_preallocate_sbus_pages(struct sbus_dev *sdev, snd_pcm_substream_t *substream, diff --git a/include/sound/pcm_sgbuf.h b/include/sound/pcm_sgbuf.h index ad1b1eda6518..e69de29bb2d1 100644 --- a/include/sound/pcm_sgbuf.h +++ b/include/sound/pcm_sgbuf.h @@ -1,68 +0,0 @@ -#ifndef __SOUND_PCM_SGBUF_H -#define __SOUND_PCM_SGBUF_H - -/* - * Scatter-Gather PCM access - * - * Copyright (c) by Takashi Iwai <tiwai@suse.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -struct snd_sg_page { - void *buf; - dma_addr_t addr; -}; - -struct snd_sg_buf { - int size; /* allocated byte size (= runtime->dma_bytes) */ - int pages; /* allocated pages */ - int tblsize; /* allocated table size */ - struct snd_sg_page *table; - struct page **page_table; - struct pci_dev *pci; -}; - -typedef struct snd_sg_buf snd_pcm_sgbuf_t; /* for magic cast */ - -/* - * return the pages matching with the given byte size - */ -static inline unsigned int snd_pcm_sgbuf_pages(size_t size) -{ - return (size + PAGE_SIZE - 1) >> PAGE_SHIFT; -} - -/* - * return the physical address at the corresponding offset - */ -static inline dma_addr_t snd_pcm_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset) -{ - return sgbuf->table[offset >> PAGE_SHIFT].addr + offset % PAGE_SIZE; -} - -void *snd_pcm_sgbuf_alloc_pages(struct pci_dev *pci, size_t size, struct snd_pcm_dma_buffer *dmab); -int snd_pcm_sgbuf_free_pages(struct snd_pcm_dma_buffer *dmab); - -int snd_pcm_lib_preallocate_sg_pages(struct pci_dev *pci, snd_pcm_substream_t *substream, size_t size, size_t max); -int snd_pcm_lib_preallocate_sg_pages_for_all(struct pci_dev *pci, snd_pcm_t *pcm, size_t size, size_t max); - -#define _snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_private) -#define snd_pcm_substream_sgbuf(substream) snd_magic_cast(snd_pcm_sgbuf_t, _snd_pcm_substream_sgbuf(substream), return -ENXIO) - -struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned long offset); - -#endif /* __SOUND_PCM_SGBUF_H */ diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h index 347d7e9f3e74..2c10a8a6f599 100644 --- a/include/sound/seq_kernel.h +++ b/include/sound/seq_kernel.h @@ -174,7 +174,7 @@ snd_seq_port_callback_t *snd_port_alloc_callback(void); /* port attach/detach */ int snd_seq_event_port_attach(int client, snd_seq_port_callback_t *pcbp, - int cap, int type, int midi_channels, char *portname); + int cap, int type, int midi_channels, int midi_voices, char *portname); int snd_seq_event_port_detach(int client, int port); #endif /* __SOUND_SEQ_KERNEL_H */ diff --git a/include/sound/sndmagic.h b/include/sound/sndmagic.h index 3734c468875f..a9ab4fc30b6d 100644 --- a/include/sound/sndmagic.h +++ b/include/sound/sndmagic.h @@ -108,7 +108,7 @@ static inline int _snd_magic_bad(void *obj, unsigned long magic) #define snd_pcm_proc_private_t_magic 0xa15a0104 #define snd_pcm_oss_file_t_magic 0xa15a0105 #define snd_mixer_oss_t_magic 0xa15a0106 -#define snd_pcm_sgbuf_t_magic 0xa15a0107 +// #define snd_pcm_sgbuf_t_magic 0xa15a0107 #define snd_info_private_data_t_magic 0xa15a0201 #define snd_info_entry_t_magic 0xa15a0202 @@ -174,6 +174,7 @@ static inline int _snd_magic_bad(void *obj, unsigned long magic) #define m3_dma_t_magic 0xa15a3202 #define nm256_t_magic 0xa15a3301 #define nm256_dma_t_magic 0xa15a3302 +#define sam9407_t_magic 0xa15a3401 #define pmac_t_magic 0xa15a3501 #define ali_t_magic 0xa15a3601 #define mtpav_t_magic 0xa15a3701 @@ -190,6 +191,8 @@ static inline int _snd_magic_bad(void *obj, unsigned long magic) #define snd_usb_midi_t_magic 0xa15a3f01 #define snd_usb_midi_out_endpoint_t_magic 0xa15a3f02 #define snd_usb_midi_in_endpoint_t_magic 0xa15a3f03 +#define ak4117_t_magic 0xa15a4000 +#define psic_t_magic 0xa15a4100 #else diff --git a/include/sound/timer.h b/include/sound/timer.h index ecd1c0f5785c..6640f04a7965 100644 --- a/include/sound/timer.h +++ b/include/sound/timer.h @@ -3,7 +3,8 @@ /* * Timer abstract layer - * Copyright (c) by Jaroslav Kysela <perex@suse.cz> + * Copyright (c) by Jaroslav Kysela <perex@suse.cz>, + * Abramo Bagnara <abramo@alsa-project.org> * * * This program is free software; you can redistribute it and/or modify @@ -29,11 +30,15 @@ typedef enum sndrv_timer_class snd_timer_class_t; typedef enum sndrv_timer_slave_class snd_timer_slave_class_t; typedef enum sndrv_timer_global snd_timer_global_t; typedef struct sndrv_timer_id snd_timer_id_t; +typedef struct sndrv_timer_ginfo snd_timer_ginfo_t; +typedef struct sndrv_timer_gparams snd_timer_gparams_t; +typedef struct sndrv_timer_gstatus snd_timer_gstatus_t; typedef struct sndrv_timer_select snd_timer_select_t; typedef struct sndrv_timer_info snd_timer_info_t; typedef struct sndrv_timer_params snd_timer_params_t; typedef struct sndrv_timer_status snd_timer_status_t; typedef struct sndrv_timer_read snd_timer_read_t; +typedef struct sndrv_timer_tread snd_timer_tread_t; #define _snd_timer_chip(timer) ((timer)->private_data) #define snd_timer_chip(timer) snd_magic_cast1(chip_t, _snd_timer_chip(timer), return -ENXIO) @@ -54,16 +59,21 @@ typedef struct sndrv_timer_read snd_timer_read_t; #define SNDRV_TIMER_IFLG_AUTO 0x00000008 /* auto restart */ #define SNDRV_TIMER_IFLG_FAST 0x00000010 /* fast callback (do not use tasklet) */ #define SNDRV_TIMER_IFLG_CALLBACK 0x00000020 /* timer callback is active */ +#define SNDRV_TIMER_IFLG_EXCLUSIVE 0x00000040 /* exclusive owner - no more instances */ #define SNDRV_TIMER_FLG_CHANGE 0x00000001 #define SNDRV_TIMER_FLG_RESCHED 0x00000002 /* need reschedule */ typedef void (*snd_timer_callback_t) (snd_timer_instance_t * timeri, unsigned long ticks, unsigned long resolution); +typedef void (*snd_timer_ccallback_t) (snd_timer_instance_t * timeri, enum sndrv_timer_event event, + struct timespec * tstamp, unsigned long resolution); struct _snd_timer_hardware { /* -- must be filled with low-level driver */ unsigned int flags; /* various flags */ unsigned long resolution; /* average timer resolution for one tick in nsec */ + unsigned long resolution_min; /* minimal resolution */ + unsigned long resolution_max; /* maximal resolution */ unsigned long ticks; /* max timer ticks per interrupt */ /* -- low-level functions -- */ int (*open) (snd_timer_t * timer); @@ -71,6 +81,8 @@ struct _snd_timer_hardware { unsigned long (*c_resolution) (snd_timer_t * timer); int (*start) (snd_timer_t * timer); int (*stop) (snd_timer_t * timer); + int (*set_period) (snd_timer_t * timer, unsigned long period_num, unsigned long period_den); + int (*precise_resolution) (snd_timer_t * timer, unsigned long *num, unsigned long *den); }; struct _snd_timer { @@ -102,6 +114,7 @@ struct _snd_timer_instance { void *private_data; void (*private_free) (snd_timer_instance_t *ti); snd_timer_callback_t callback; + snd_timer_ccallback_t ccallback; void *callback_data; unsigned long ticks; /* auto-load ticks when expired */ unsigned long cticks; /* current ticks */ @@ -123,20 +136,19 @@ struct _snd_timer_instance { */ extern int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t ** rtimer); +extern void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct timespec *tstamp); extern int snd_timer_global_new(char *id, int device, snd_timer_t **rtimer); extern int snd_timer_global_free(snd_timer_t *timer); extern int snd_timer_global_register(snd_timer_t *timer); extern int snd_timer_global_unregister(snd_timer_t *timer); -extern snd_timer_instance_t *snd_timer_open(char *owner, snd_timer_id_t *tid, unsigned int slave_id); +extern int snd_timer_open(snd_timer_instance_t ** ti, char *owner, snd_timer_id_t *tid, unsigned int slave_id); extern int snd_timer_close(snd_timer_instance_t * timeri); -extern int snd_timer_set_owner(snd_timer_instance_t * timeri, pid_t pid, gid_t gid); -extern int snd_timer_reset_owner(snd_timer_instance_t * timeri); -extern int snd_timer_set_resolution(snd_timer_instance_t * timeri, unsigned long resolution); extern unsigned long snd_timer_resolution(snd_timer_instance_t * timeri); extern int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks); extern int snd_timer_stop(snd_timer_instance_t * timeri); extern int snd_timer_continue(snd_timer_instance_t * timeri); +extern int snd_timer_pause(snd_timer_instance_t * timeri); extern void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left); diff --git a/include/sound/trident.h b/include/sound/trident.h index f4f4042f6e7f..a2263766ed41 100644 --- a/include/sound/trident.h +++ b/include/sound/trident.h @@ -365,10 +365,16 @@ struct _snd_trident_voice { int running: 1, capture: 1, spdif: 1, - foldback: 1; + foldback: 1, + isync: 1, + isync2: 1, + isync3: 1; int foldback_chan; /* foldback subdevice number */ unsigned int stimer; /* global sample timer (to detect spurious interrupts) */ unsigned int spurious_threshold; /* spurious threshold */ + unsigned int isync_mark; + unsigned int isync_max; + unsigned int isync_ESO; /* --- */ @@ -448,6 +454,7 @@ struct _snd_trident { snd_seq_device_t *seq_dev; ac97_t *ac97; + ac97_t *ac97_sec; unsigned int musicvol_wavevol; snd_trident_pcm_mixer_t pcm_mixer[32]; diff --git a/include/sound/uda1341.h b/include/sound/uda1341.h index d5f3cf200e6f..fc696c356976 100644 --- a/include/sound/uda1341.h +++ b/include/sound/uda1341.h @@ -15,11 +15,16 @@ * features support */ -/* $Id: uda1341.h,v 1.2 2002/04/17 07:53:22 perex Exp $ */ +/* $Id: uda1341.h,v 1.4 2003/02/25 12:48:16 perex Exp $ */ #define UDA1341_ALSA_NAME "snd-uda1341" /* + * Default rate set after inicialization + */ +#define AUDIO_RATE_DEFAULT 44100 + +/* * UDA1341 L3 address and command types */ #define UDA1341_L3ADDR 5 diff --git a/include/sound/version.h b/include/sound/version.h index 1b4e776761b3..880f1b833833 100644 --- a/include/sound/version.h +++ b/include/sound/version.h @@ -1,3 +1,3 @@ /* include/version.h. Generated by configure. */ -#define CONFIG_SND_VERSION "0.9.0rc7" -#define CONFIG_SND_DATE " (Sat Feb 15 15:01:21 2003 UTC)" +#define CONFIG_SND_VERSION "0.9.2" +#define CONFIG_SND_DATE " (Thu Mar 20 13:31:57 2003 UTC)" |
