diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-04-12 02:21:00 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-04-12 02:21:00 -0700 |
| commit | 0d61fc5ea78015def4d2fcf9b598ecfe25210cdd (patch) | |
| tree | a45aa0f67c6bbd200dc2a328e560042810307b1b /include | |
| parent | f2eb250f07ba4695c2474cb8b6edbf64b5457d65 (diff) | |
| parent | eb880e5457f8b4a61ff7fd36d47dd14fe51cb030 (diff) | |
Merge bk://bk.arm.linux.org.uk/linux-2.6-rmk
into ppc970.osdl.org:/home/torvalds/v2.6/linux
Diffstat (limited to 'include')
166 files changed, 2171 insertions, 1029 deletions
diff --git a/include/asm-alpha/irq.h b/include/asm-alpha/irq.h index 551c7308c642..566db720000a 100644 --- a/include/asm-alpha/irq.h +++ b/include/asm-alpha/irq.h @@ -93,5 +93,8 @@ extern void enable_irq(unsigned int); struct pt_regs; extern void (*perf_irq)(unsigned long, struct pt_regs *); +struct irqaction; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif /* _ALPHA_IRQ_H */ diff --git a/include/asm-alpha/pgalloc.h b/include/asm-alpha/pgalloc.h index b34194c3d96c..2ef3066df665 100644 --- a/include/asm-alpha/pgalloc.h +++ b/include/asm-alpha/pgalloc.h @@ -63,7 +63,10 @@ pte_free_kernel(pte_t *pte) static inline struct page * pte_alloc_one(struct mm_struct *mm, unsigned long addr) { - return virt_to_page(pte_alloc_one_kernel(mm, addr)); + pte_t *pte = pte_alloc_one_kernel(mm, addr); + if (pte) + return virt_to_page(pte); + return 0; } static inline void diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h index b5aa5686ec59..9a950ec8de4d 100644 --- a/include/asm-arm/cacheflush.h +++ b/include/asm-arm/cacheflush.h @@ -283,23 +283,19 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr) * flush_dcache_page is used when the kernel has written to the page * cache page at virtual address page->virtual. * - * If this page isn't mapped (ie, page->mapping = NULL), or it has - * userspace mappings (page->mapping->i_mmap or page->mapping->i_mmap_shared) - * then we _must_ always clean + invalidate the dcache entries associated - * with the kernel mapping. + * If this page isn't mapped (ie, page_mapping == NULL), or it might + * have userspace mappings, then we _must_ always clean + invalidate + * the dcache entries associated with the kernel mapping. * * Otherwise we can defer the operation, and clean the cache when we are * about to change to user space. This is the same method as used on SPARC64. * See update_mmu_cache for the user space part. */ -#define mapping_mapped(map) (!list_empty(&(map)->i_mmap) || \ - !list_empty(&(map)->i_mmap_shared)) - extern void __flush_dcache_page(struct page *); static inline void flush_dcache_page(struct page *page) { - if (page->mapping && !mapping_mapped(page->mapping)) + if (page_mapping(page) && !mapping_mapped(page->mapping)) set_bit(PG_dcache_dirty, &page->flags); else __flush_dcache_page(page); diff --git a/include/asm-arm/irq.h b/include/asm-arm/irq.h index a89f7345ed39..286be7cf7c63 100644 --- a/include/asm-arm/irq.h +++ b/include/asm-arm/irq.h @@ -44,5 +44,9 @@ void disable_irq_wake(unsigned int irq); void enable_irq_wake(unsigned int irq); int setup_irq(unsigned int, struct irqaction *); +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif diff --git a/include/asm-arm26/irq.h b/include/asm-arm26/irq.h index 68712e576c6f..06bd5a543d13 100644 --- a/include/asm-arm26/irq.h +++ b/include/asm-arm26/irq.h @@ -45,6 +45,8 @@ extern void enable_irq(unsigned int); int set_irq_type(unsigned int irq, unsigned int type); int setup_irq(unsigned int, struct irqaction *); +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); #endif diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h index 10de1ccd1e01..f7401036610e 100644 --- a/include/asm-cris/bitops.h +++ b/include/asm-cris/bitops.h @@ -169,7 +169,7 @@ extern inline int __test_and_clear_bit(int nr, void *addr) return retval; } /** - * test_and_change_bit - Change a bit and return its new value + * test_and_change_bit - Change a bit and return its old value * @nr: Bit to change * @addr: Address to count from * diff --git a/include/asm-cris/irq.h b/include/asm-cris/irq.h index caa45facb1b2..87f342517bb1 100644 --- a/include/asm-cris/irq.h +++ b/include/asm-cris/irq.h @@ -14,6 +14,10 @@ extern void enable_irq(unsigned int); #define disable_irq_nosync disable_irq #define enable_irq_nosync enable_irq +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif /* _ASM_IRQ_H */ diff --git a/include/asm-generic/cpumask_array.h b/include/asm-generic/cpumask_array.h index bd5c49133c6c..c7e2db29dc53 100644 --- a/include/asm-generic/cpumask_array.h +++ b/include/asm-generic/cpumask_array.h @@ -16,7 +16,7 @@ #define cpus_and(dst,src1,src2) bitmap_and((dst).mask,(src1).mask, (src2).mask, NR_CPUS) #define cpus_or(dst,src1,src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, NR_CPUS) -#define cpus_clear(map) bitmap_clear((map).mask, NR_CPUS) +#define cpus_clear(map) bitmap_zero((map).mask, NR_CPUS) #define cpus_complement(map) bitmap_complement((map).mask, NR_CPUS) #define cpus_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, NR_CPUS) #define cpus_empty(map) bitmap_empty(map.mask, NR_CPUS) diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h index 54b0f7b71e95..04a28e6dd366 100644 --- a/include/asm-generic/dma-mapping.h +++ b/include/asm-generic/dma-mapping.h @@ -7,6 +7,10 @@ #ifndef _ASM_GENERIC_DMA_MAPPING_H #define _ASM_GENERIC_DMA_MAPPING_H +#include <linux/config.h> + +#ifdef CONFIG_PCI + /* we implement the API below in terms of the existing PCI one, * so include it */ #include <linux/pci.h> @@ -146,6 +150,119 @@ dma_mapping_error(dma_addr_t dma_addr) return pci_dma_mapping_error(dma_addr); } + +#else + +static inline int +dma_supported(struct device *dev, u64 mask) +{ + return 0; +} + +static inline int +dma_set_mask(struct device *dev, u64 dma_mask) +{ + BUG(); + return 0; +} + +static inline void * +dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, + int flag) +{ + BUG(); + return NULL; +} + +static inline void +dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, + dma_addr_t dma_handle) +{ + BUG(); +} + +static inline dma_addr_t +dma_map_single(struct device *dev, void *cpu_addr, size_t size, + enum dma_data_direction direction) +{ + BUG(); + return 0; +} + +static inline void +dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, + enum dma_data_direction direction) +{ + BUG(); +} + +static inline dma_addr_t +dma_map_page(struct device *dev, struct page *page, + unsigned long offset, size_t size, + enum dma_data_direction direction) +{ + BUG(); + return 0; +} + +static inline void +dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, + enum dma_data_direction direction) +{ + BUG(); +} + +static inline int +dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, + enum dma_data_direction direction) +{ + BUG(); + return 0; +} + +static inline void +dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, + enum dma_data_direction direction) +{ + BUG(); +} + +static inline void +dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, + enum dma_data_direction direction) +{ + BUG(); +} + +static inline void +dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, + enum dma_data_direction direction) +{ + BUG(); +} + +static inline void +dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, + enum dma_data_direction direction) +{ + BUG(); +} + +static inline void +dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, + enum dma_data_direction direction) +{ + BUG(); +} + +static inline int +dma_error(dma_addr_t dma_addr) +{ + return 0; +} + +#endif + /* Now for the API extensions over the pci_ one */ #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h index e95efd9e00c6..fe02b1a4d286 100644 --- a/include/asm-generic/siginfo.h +++ b/include/asm-generic/siginfo.h @@ -123,6 +123,7 @@ typedef struct siginfo { #define __SI_FAULT (3 << 16) #define __SI_CHLD (4 << 16) #define __SI_RT (5 << 16) +#define __SI_MESGQ (6 << 16) #define __SI_CODE(T,N) ((T) | ((N) & 0xffff)) #else #define __SI_KILL 0 @@ -131,6 +132,7 @@ typedef struct siginfo { #define __SI_FAULT 0 #define __SI_CHLD 0 #define __SI_RT 0 +#define __SI_MESGQ 0 #define __SI_CODE(T,N) (N) #endif @@ -142,7 +144,7 @@ typedef struct siginfo { #define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ #define SI_QUEUE -1 /* sent by sigqueue */ #define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */ -#define SI_MESGQ -3 /* sent by real time mesq state change */ +#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3) /* sent by real time mesq state change */ #define SI_ASYNCIO -4 /* sent by AIO completion */ #define SI_SIGIO -5 /* sent by queued SIGIO */ #define SI_TKILL -6 /* sent by tkill system call */ diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 59c2b950e8b8..a4b6c768cf49 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -51,3 +51,8 @@ *(.security_initcall.init) \ __security_initcall_end = .; \ } + +#define SCHED_TEXT \ + __scheduling_functions_start_here = .; \ + *(.sched.text) \ + __scheduling_functions_end_here = .; diff --git a/include/asm-h8300/io.h b/include/asm-h8300/io.h index 2962f9030413..662ca869856a 100644 --- a/include/asm-h8300/io.h +++ b/include/asm-h8300/io.h @@ -9,7 +9,7 @@ #if defined(CONFIG_H83007) || defined(CONFIG_H83068) #include <asm/regs306x.h> #elif defined(CONFIG_H8S2678) -#include <asm/regs2678.h> +#include <asm/regs267x.h> #else #error UNKNOWN CPU TYPE #endif @@ -73,7 +73,7 @@ static inline unsigned int _swapl(volatile unsigned long v) static inline int h8300_buswidth(unsigned int addr) { - return (*(volatile unsigned char *)ABWCR & (1 << (addr >> 21) & 7)) == 0; + return (*(volatile unsigned char *)ABWCR & (1 << ((addr >> 21) & 7))) == 0; } static inline void io_outsb(unsigned int addr, void *buf, int len) @@ -145,10 +145,10 @@ static inline void io_insl(unsigned int addr, void *buf, int len) #define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) #define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) -#define inb(addr) ((h8300_buswidth(addr))?readb(addr ^ 1) & 0xff:readb(addr)) +#define inb(addr) ((h8300_buswidth(addr))?readb((addr) ^ 1) & 0xff:readb(addr)) #define inw(addr) _swapw(readw(addr)) #define inl(addr) _swapl(readl(addr)) -#define outb(x,addr) ((void)((h8300_buswidth(addr) && (addr & 1))?writew(x,addr):writeb(x,addr))) +#define outb(x,addr) ((void)((h8300_buswidth(addr) && ((addr) & 1))?writew(x,addr):writeb(x,addr))) #define outw(x,addr) ((void) writew(_swapw(x),addr)) #define outl(x,addr) ((void) writel(_swapl(x),addr)) diff --git a/include/asm-h8300/irq.h b/include/asm-h8300/irq.h index fabde1dd34a1..5027181ed067 100644 --- a/include/asm-h8300/irq.h +++ b/include/asm-h8300/irq.h @@ -68,4 +68,8 @@ extern void disable_irq(unsigned int); #define enable_irq_nosync(x) enable_irq(x) #define disable_irq_nosync(x) disable_irq(x) +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif /* _H8300_IRQ_H_ */ diff --git a/include/asm-h8300/processor.h b/include/asm-h8300/processor.h index 7154a6a9d9c3..31494109a13e 100644 --- a/include/asm-h8300/processor.h +++ b/include/asm-h8300/processor.h @@ -51,16 +51,19 @@ extern inline void wrusp(unsigned long usp) { #define MCA_bus 0 struct thread_struct { - unsigned long ksp; /* kernel stack pointer */ - unsigned long usp; /* user stack pointer */ - unsigned long ccr; /* saved status register */ - unsigned long esp0; /* points to SR of stack frame */ - unsigned long debugreg[8]; /* debug info */ + unsigned long ksp; /* kernel stack pointer */ + unsigned long usp; /* user stack pointer */ + unsigned long ccr; /* saved status register */ + unsigned long esp0; /* points to SR of stack frame */ + struct { + unsigned short *addr; + unsigned short inst; + } breakinfo; }; #define INIT_THREAD { \ sizeof(init_stack) + (unsigned long) init_stack, 0, \ - PS_S, \ + PS_S, 0, {(unsigned short *)-1, 0}, \ } /* diff --git a/include/asm-h8300/ptrace.h b/include/asm-h8300/ptrace.h index abf25cf74dc7..5effc8d14b0d 100644 --- a/include/asm-h8300/ptrace.h +++ b/include/asm-h8300/ptrace.h @@ -14,6 +14,7 @@ #define PT_CCR 8 #define PT_PC 9 #define PT_USP 10 +#define PT_EXR 12 /* this struct defines the way the registers are stored on the stack during a system call. */ @@ -44,6 +45,16 @@ struct pt_regs { #define PS_S (0x10) #endif +#if defined(__H8300H__) +#define H8300_REGS_NO 11 +#endif +#if defined(__H8300S__) +#define H8300_REGS_NO 12 +#endif + +/* Find the stack offset for a register, relative to thread.esp0. */ +#define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg) + #define user_mode(regs) (!((regs)->ccr & PS_S)) #define instruction_pointer(regs) ((regs)->pc) extern void show_regs(struct pt_regs *); diff --git a/include/asm-h8300/regs306x.h b/include/asm-h8300/regs306x.h index b8ff8d1f56d7..027dd633fa25 100644 --- a/include/asm-h8300/regs306x.h +++ b/include/asm-h8300/regs306x.h @@ -125,8 +125,8 @@ #define RDR2 0xFFFFC5 #define SCMR2 0xFFFFC6 -#define MDCR 0xFEE000 -#define SYSCR 0xFEE001 +#define MDCR 0xFEE011 +#define SYSCR 0xFEE012 #define DIVCR 0xFEE01B #define MSTCRH 0xFEE01C #define MSTCRL 0xFEE01D diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index c39edc67d111..114ac7ac3680 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h @@ -212,7 +212,7 @@ static __inline__ int __test_and_change_bit(int nr, volatile unsigned long *addr } /** - * test_and_change_bit - Change a bit and return its new value + * test_and_change_bit - Change a bit and return its old value * @nr: Bit to change * @addr: Address to count from * diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h index b8166a30fbe1..2875fe7bcedd 100644 --- a/include/asm-i386/hw_irq.h +++ b/include/asm-i386/hw_irq.h @@ -27,6 +27,7 @@ extern u8 irq_vector[NR_IRQ_VECTORS]; #define IO_APIC_VECTOR(irq) (irq_vector[irq]) +#define AUTO_ASSIGN -1 extern void (*interrupt[NR_IRQS])(void); diff --git a/include/asm-i386/irq.h b/include/asm-i386/irq.h index 69cb661b012a..5649b4a79bb2 100644 --- a/include/asm-i386/irq.h +++ b/include/asm-i386/irq.h @@ -14,6 +14,7 @@ #include <linux/sched.h> /* include comes from machine specific directory */ #include "irq_vectors.h" +#include <asm/thread_info.h> static __inline__ int irq_canonicalize(int irq) { @@ -30,4 +31,28 @@ extern int can_request_irq(unsigned int, unsigned long flags); #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ #endif +#ifdef CONFIG_4KSTACKS +/* + * per-CPU IRQ handling contexts (thread information and stack) + */ +union irq_ctx { + struct thread_info tinfo; + u32 stack[THREAD_SIZE/sizeof(u32)]; +}; + +extern union irq_ctx *hardirq_ctx[NR_CPUS]; +extern union irq_ctx *softirq_ctx[NR_CPUS]; + +extern void irq_ctx_init(int cpu); + +#define __ARCH_HAS_DO_SOFTIRQ +#else +#define irq_ctx_init(cpu) do { ; } while (0) +#endif + +struct irqaction; +struct pt_regs; +asmlinkage int handle_IRQ_event(unsigned int, struct pt_regs *, + struct irqaction *); + #endif /* _ASM_IRQ_H */ diff --git a/include/asm-i386/mach-default/irq_vectors.h b/include/asm-i386/mach-default/irq_vectors.h index 8381e7e6197b..881c63ca61ad 100644 --- a/include/asm-i386/mach-default/irq_vectors.h +++ b/include/asm-i386/mach-default/irq_vectors.h @@ -84,22 +84,7 @@ */ #define NR_VECTORS 256 -#ifdef CONFIG_PCI_USE_VECTOR -#define NR_IRQS FIRST_SYSTEM_VECTOR -#define NR_IRQ_VECTORS NR_IRQS -#else -#ifdef CONFIG_X86_IO_APIC -#define NR_IRQS 224 -# if (224 >= 32 * NR_CPUS) -# define NR_IRQ_VECTORS NR_IRQS -# else -# define NR_IRQ_VECTORS (32 * NR_CPUS) -# endif -#else -#define NR_IRQS 16 -#define NR_IRQ_VECTORS NR_IRQS -#endif -#endif +#include "irq_vectors_limits.h" #define FPU_IRQ 13 diff --git a/include/asm-i386/mach-default/irq_vectors_limits.h b/include/asm-i386/mach-default/irq_vectors_limits.h new file mode 100644 index 000000000000..78c30cbcede4 --- /dev/null +++ b/include/asm-i386/mach-default/irq_vectors_limits.h @@ -0,0 +1,21 @@ +#ifndef _ASM_IRQ_VECTORS_LIMITS_H +#define _ASM_IRQ_VECTORS_LIMITS_H + +#ifdef CONFIG_PCI_USE_VECTOR +#define NR_IRQS FIRST_SYSTEM_VECTOR +#define NR_IRQ_VECTORS NR_IRQS +#else +#ifdef CONFIG_X86_IO_APIC +#define NR_IRQS 224 +# if (224 >= 32 * NR_CPUS) +# define NR_IRQ_VECTORS NR_IRQS +# else +# define NR_IRQ_VECTORS (32 * NR_CPUS) +# endif +#else +#define NR_IRQS 16 +#define NR_IRQ_VECTORS NR_IRQS +#endif +#endif + +#endif /* _ASM_IRQ_VECTORS_LIMITS_H */ diff --git a/include/asm-i386/mach-default/mach_resources.h b/include/asm-i386/mach-default/mach_resources.h deleted file mode 100644 index b37858d0d0bd..000000000000 --- a/include/asm-i386/mach-default/mach_resources.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * include/asm-i386/mach-default/mach_resources.h - * - * Machine specific resource allocation for generic. - * Split out from setup.c by Osamu Tomita <tomita@cinet.co.jp> - */ -#ifndef _MACH_RESOURCES_H -#define _MACH_RESOURCES_H - -struct resource standard_io_resources[] = { - { "dma1", 0x00, 0x1f, IORESOURCE_BUSY }, - { "pic1", 0x20, 0x21, IORESOURCE_BUSY }, - { "timer", 0x40, 0x5f, IORESOURCE_BUSY }, - { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY }, - { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY }, - { "pic2", 0xa0, 0xa1, IORESOURCE_BUSY }, - { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY }, - { "fpu", 0xf0, 0xff, IORESOURCE_BUSY } -}; - -#define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource)) - -static struct resource vram_resource = { "Video RAM area", 0xa0000, 0xbffff, IORESOURCE_BUSY }; - -/* System ROM resources */ -#define MAXROMS 6 -static struct resource rom_resources[MAXROMS] = { - { "System ROM", 0xF0000, 0xFFFFF, IORESOURCE_BUSY }, - { "Video ROM", 0xc0000, 0xc7fff, IORESOURCE_BUSY } -}; - -#define romsignature(x) (*(unsigned short *)(x) == 0xaa55) - -static inline void probe_video_rom(int roms) -{ - unsigned long base; - unsigned char *romstart; - - - /* Video ROM is standard at C000:0000 - C7FF:0000, check signature */ - for (base = 0xC0000; base < 0xE0000; base += 2048) { - romstart = isa_bus_to_virt(base); - if (!romsignature(romstart)) - continue; - request_resource(&iomem_resource, rom_resources + roms); - roms++; - break; - } -} - -static inline void probe_extension_roms(int roms) -{ - unsigned long base; - unsigned char *romstart; - - /* Extension roms at C800:0000 - DFFF:0000 */ - for (base = 0xC8000; base < 0xE0000; base += 2048) { - unsigned long length; - - romstart = isa_bus_to_virt(base); - if (!romsignature(romstart)) - continue; - length = romstart[2] * 512; - if (length) { - unsigned int i; - unsigned char chksum; - - chksum = 0; - for (i = 0; i < length; i++) - chksum += romstart[i]; - - /* Good checksum? */ - if (!chksum) { - rom_resources[roms].start = base; - rom_resources[roms].end = base + length - 1; - rom_resources[roms].name = "Extension ROM"; - rom_resources[roms].flags = IORESOURCE_BUSY; - - request_resource(&iomem_resource, rom_resources + roms); - roms++; - if (roms >= MAXROMS) - return; - } - } - } - - /* Final check for motherboard extension rom at E000:0000 */ - base = 0xE0000; - romstart = isa_bus_to_virt(base); - - if (romsignature(romstart)) { - rom_resources[roms].start = base; - rom_resources[roms].end = base + 65535; - rom_resources[roms].name = "Extension ROM"; - rom_resources[roms].flags = IORESOURCE_BUSY; - - request_resource(&iomem_resource, rom_resources + roms); - } -} - -static inline void request_graphics_resource(void) -{ - request_resource(&iomem_resource, &vram_resource); -} - -#endif /* !_MACH_RESOURCES_H */ diff --git a/include/asm-i386/mach-generic/irq_vectors_limits.h b/include/asm-i386/mach-generic/irq_vectors_limits.h new file mode 100644 index 000000000000..890ce3f5e09a --- /dev/null +++ b/include/asm-i386/mach-generic/irq_vectors_limits.h @@ -0,0 +1,14 @@ +#ifndef _ASM_IRQ_VECTORS_LIMITS_H +#define _ASM_IRQ_VECTORS_LIMITS_H + +/* + * For Summit or generic (i.e. installer) kernels, we have lots of I/O APICs, + * even with uni-proc kernels, so use a big array. + * + * This value should be the same in both the generic and summit subarches. + * Change one, change 'em both. + */ +#define NR_IRQS 224 +#define NR_IRQ_VECTORS 1024 + +#endif /* _ASM_IRQ_VECTORS_LIMITS_H */ diff --git a/include/asm-i386/mach-generic/mach_mpspec.h b/include/asm-i386/mach-generic/mach_mpspec.h index ef10cd205575..fbb6a40ffd91 100644 --- a/include/asm-i386/mach-generic/mach_mpspec.h +++ b/include/asm-i386/mach-generic/mach_mpspec.h @@ -8,6 +8,8 @@ #define MAX_IRQ_SOURCES 256 -#define MAX_MP_BUSSES 32 +/* Summit or generic (i.e. installer) kernels need lots of bus entries. */ +/* Maximum 256 PCI busses, plus 1 ISA bus in each of 4 cabinets. */ +#define MAX_MP_BUSSES 260 #endif /* __ASM_MACH_MPSPEC_H */ diff --git a/include/asm-i386/mach-pc9800/mach_resources.h b/include/asm-i386/mach-pc9800/mach_resources.h deleted file mode 100644 index bf1b2c470aec..000000000000 --- a/include/asm-i386/mach-pc9800/mach_resources.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * include/asm-i386/mach-pc9800/mach_resources.h - * - * Machine specific resource allocation for PC-9800. - * Written by Osamu Tomita <tomita@cinet.co.jp> - */ -#ifndef _MACH_RESOURCES_H -#define _MACH_RESOURCES_H - -static char str_pic1[] = "pic1"; -static char str_dma[] = "dma"; -static char str_pic2[] = "pic2"; -static char str_calender_clock[] = "calender clock"; -static char str_system[] = "system"; -static char str_nmi_control[] = "nmi control"; -static char str_kanji_rom[] = "kanji rom"; -static char str_keyboard[] = "keyboard"; -static char str_text_gdc[] = "text gdc"; -static char str_crtc[] = "crtc"; -static char str_timer[] = "timer"; -static char str_graphic_gdc[] = "graphic gdc"; -static char str_dma_ex_bank[] = "dma ex. bank"; -static char str_beep_freq[] = "beep freq."; -static char str_mouse_pio[] = "mouse pio"; -struct resource standard_io_resources[] = { - { str_pic1, 0x00, 0x00, IORESOURCE_BUSY }, - { str_dma, 0x01, 0x01, IORESOURCE_BUSY }, - { str_pic1, 0x02, 0x02, IORESOURCE_BUSY }, - { str_dma, 0x03, 0x03, IORESOURCE_BUSY }, - { str_dma, 0x05, 0x05, IORESOURCE_BUSY }, - { str_dma, 0x07, 0x07, IORESOURCE_BUSY }, - { str_pic2, 0x08, 0x08, IORESOURCE_BUSY }, - { str_dma, 0x09, 0x09, IORESOURCE_BUSY }, - { str_pic2, 0x0a, 0x0a, IORESOURCE_BUSY }, - { str_dma, 0x0b, 0x0b, IORESOURCE_BUSY }, - { str_dma, 0x0d, 0x0d, IORESOURCE_BUSY }, - { str_dma, 0x0f, 0x0f, IORESOURCE_BUSY }, - { str_dma, 0x11, 0x11, IORESOURCE_BUSY }, - { str_dma, 0x13, 0x13, IORESOURCE_BUSY }, - { str_dma, 0x15, 0x15, IORESOURCE_BUSY }, - { str_dma, 0x17, 0x17, IORESOURCE_BUSY }, - { str_dma, 0x19, 0x19, IORESOURCE_BUSY }, - { str_dma, 0x1b, 0x1b, IORESOURCE_BUSY }, - { str_dma, 0x1d, 0x1d, IORESOURCE_BUSY }, - { str_dma, 0x1f, 0x1f, IORESOURCE_BUSY }, - { str_calender_clock, 0x20, 0x20, 0 }, - { str_dma, 0x21, 0x21, IORESOURCE_BUSY }, - { str_calender_clock, 0x22, 0x22, 0 }, - { str_dma, 0x23, 0x23, IORESOURCE_BUSY }, - { str_dma, 0x25, 0x25, IORESOURCE_BUSY }, - { str_dma, 0x27, 0x27, IORESOURCE_BUSY }, - { str_dma, 0x29, 0x29, IORESOURCE_BUSY }, - { str_dma, 0x2b, 0x2b, IORESOURCE_BUSY }, - { str_dma, 0x2d, 0x2d, IORESOURCE_BUSY }, - { str_system, 0x31, 0x31, IORESOURCE_BUSY }, - { str_system, 0x33, 0x33, IORESOURCE_BUSY }, - { str_system, 0x35, 0x35, IORESOURCE_BUSY }, - { str_system, 0x37, 0x37, IORESOURCE_BUSY }, - { str_nmi_control, 0x50, 0x50, IORESOURCE_BUSY }, - { str_nmi_control, 0x52, 0x52, IORESOURCE_BUSY }, - { "time stamp", 0x5c, 0x5f, IORESOURCE_BUSY }, - { str_kanji_rom, 0xa1, 0xa1, IORESOURCE_BUSY }, - { str_kanji_rom, 0xa3, 0xa3, IORESOURCE_BUSY }, - { str_kanji_rom, 0xa5, 0xa5, IORESOURCE_BUSY }, - { str_kanji_rom, 0xa7, 0xa7, IORESOURCE_BUSY }, - { str_kanji_rom, 0xa9, 0xa9, IORESOURCE_BUSY }, - { str_keyboard, 0x41, 0x41, IORESOURCE_BUSY }, - { str_keyboard, 0x43, 0x43, IORESOURCE_BUSY }, - { str_text_gdc, 0x60, 0x60, IORESOURCE_BUSY }, - { str_text_gdc, 0x62, 0x62, IORESOURCE_BUSY }, - { str_text_gdc, 0x64, 0x64, IORESOURCE_BUSY }, - { str_text_gdc, 0x66, 0x66, IORESOURCE_BUSY }, - { str_text_gdc, 0x68, 0x68, IORESOURCE_BUSY }, - { str_text_gdc, 0x6a, 0x6a, IORESOURCE_BUSY }, - { str_text_gdc, 0x6c, 0x6c, IORESOURCE_BUSY }, - { str_text_gdc, 0x6e, 0x6e, IORESOURCE_BUSY }, - { str_crtc, 0x70, 0x70, IORESOURCE_BUSY }, - { str_crtc, 0x72, 0x72, IORESOURCE_BUSY }, - { str_crtc, 0x74, 0x74, IORESOURCE_BUSY }, - { str_crtc, 0x74, 0x74, IORESOURCE_BUSY }, - { str_crtc, 0x76, 0x76, IORESOURCE_BUSY }, - { str_crtc, 0x78, 0x78, IORESOURCE_BUSY }, - { str_crtc, 0x7a, 0x7a, IORESOURCE_BUSY }, - { str_timer, 0x71, 0x71, IORESOURCE_BUSY }, - { str_timer, 0x73, 0x73, IORESOURCE_BUSY }, - { str_timer, 0x75, 0x75, IORESOURCE_BUSY }, - { str_timer, 0x77, 0x77, IORESOURCE_BUSY }, - { str_graphic_gdc, 0xa0, 0xa0, IORESOURCE_BUSY }, - { str_graphic_gdc, 0xa2, 0xa2, IORESOURCE_BUSY }, - { str_graphic_gdc, 0xa4, 0xa4, IORESOURCE_BUSY }, - { str_graphic_gdc, 0xa6, 0xa6, IORESOURCE_BUSY }, - { "cpu", 0xf0, 0xf7, IORESOURCE_BUSY }, - { "fpu", 0xf8, 0xff, IORESOURCE_BUSY }, - { str_dma_ex_bank, 0x0e05, 0x0e05, 0 }, - { str_dma_ex_bank, 0x0e07, 0x0e07, 0 }, - { str_dma_ex_bank, 0x0e09, 0x0e09, 0 }, - { str_dma_ex_bank, 0x0e0b, 0x0e0b, 0 }, - { str_beep_freq, 0x3fd9, 0x3fd9, IORESOURCE_BUSY }, - { str_beep_freq, 0x3fdb, 0x3fdb, IORESOURCE_BUSY }, - { str_beep_freq, 0x3fdd, 0x3fdd, IORESOURCE_BUSY }, - { str_beep_freq, 0x3fdf, 0x3fdf, IORESOURCE_BUSY }, - /* All PC-9800 have (exactly) one mouse interface. */ - { str_mouse_pio, 0x7fd9, 0x7fd9, 0 }, - { str_mouse_pio, 0x7fdb, 0x7fdb, 0 }, - { str_mouse_pio, 0x7fdd, 0x7fdd, 0 }, - { str_mouse_pio, 0x7fdf, 0x7fdf, 0 }, - { "mouse timer", 0xbfdb, 0xbfdb, 0 }, - { "mouse irq", 0x98d7, 0x98d7, 0 }, -}; - -#define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource)) - -static struct resource tvram_resource = { "Text VRAM/CG window", 0xa0000, 0xa4fff, IORESOURCE_BUSY }; -static struct resource gvram_brg_resource = { "Graphic VRAM (B/R/G)", 0xa8000, 0xbffff, IORESOURCE_BUSY }; -static struct resource gvram_e_resource = { "Graphic VRAM (E)", 0xe0000, 0xe7fff, IORESOURCE_BUSY }; - -/* System ROM resources */ -#define MAXROMS 6 -static struct resource rom_resources[MAXROMS] = { - { "System ROM", 0xe8000, 0xfffff, IORESOURCE_BUSY } -}; - -static inline void probe_video_rom(int roms) -{ - /* PC-9800 has no video ROM */ -} - -static inline void probe_extension_roms(int roms) -{ - int i; - __u8 *xrom_id; - - xrom_id = (__u8 *) isa_bus_to_virt(PC9800SCA_XROM_ID + 0x10); - - for (i = 0; i < 16; i++) { - if (xrom_id[i] & 0x80) { - int j; - - for (j = i + 1; j < 16 && (xrom_id[j] & 0x80); j++) - ; - rom_resources[roms].start = 0x0d0000 + i * 0x001000; - rom_resources[roms].end = 0x0d0000 + j * 0x001000 - 1; - rom_resources[roms].name = "Extension ROM"; - rom_resources[roms].flags = IORESOURCE_BUSY; - - request_resource(&iomem_resource, - rom_resources + roms); - if (++roms >= MAXROMS) - return; - } - } -} - -static inline void request_graphics_resource(void) -{ - int i; - - if (PC9800_HIGHRESO_P()) { - tvram_resource.start = 0xe0000; - tvram_resource.end = 0xe4fff; - gvram_brg_resource.name = "Graphic VRAM"; - gvram_brg_resource.start = 0xc0000; - gvram_brg_resource.end = 0xdffff; - } - - request_resource(&iomem_resource, &tvram_resource); - request_resource(&iomem_resource, &gvram_brg_resource); - if (!PC9800_HIGHRESO_P()) - request_resource(&iomem_resource, &gvram_e_resource); - - if (PC9800_HIGHRESO_P() || PC9800_9821_P()) { - static char graphics[] = "graphics"; - static struct resource graphics_resources[] = { - { graphics, 0x9a0, 0x9a0, 0 }, - { graphics, 0x9a2, 0x9a2, 0 }, - { graphics, 0x9a4, 0x9a4, 0 }, - { graphics, 0x9a6, 0x9a6, 0 }, - { graphics, 0x9a8, 0x9a8, 0 }, - { graphics, 0x9aa, 0x9aa, 0 }, - { graphics, 0x9ac, 0x9ac, 0 }, - { graphics, 0x9ae, 0x9ae, 0 }, - }; - -#define GRAPHICS_RESOURCES (sizeof(graphics_resources)/sizeof(struct resource)) - - for (i = 0; i < GRAPHICS_RESOURCES; i++) - request_resource(&ioport_resource, graphics_resources + i); - } -} - -#endif /* !_MACH_RESOURCES_H */ diff --git a/include/asm-i386/mach-summit/irq_vectors_limits.h b/include/asm-i386/mach-summit/irq_vectors_limits.h new file mode 100644 index 000000000000..890ce3f5e09a --- /dev/null +++ b/include/asm-i386/mach-summit/irq_vectors_limits.h @@ -0,0 +1,14 @@ +#ifndef _ASM_IRQ_VECTORS_LIMITS_H +#define _ASM_IRQ_VECTORS_LIMITS_H + +/* + * For Summit or generic (i.e. installer) kernels, we have lots of I/O APICs, + * even with uni-proc kernels, so use a big array. + * + * This value should be the same in both the generic and summit subarches. + * Change one, change 'em both. + */ +#define NR_IRQS 224 +#define NR_IRQ_VECTORS 1024 + +#endif /* _ASM_IRQ_VECTORS_LIMITS_H */ diff --git a/include/asm-i386/mach-summit/mach_mpspec.h b/include/asm-i386/mach-summit/mach_mpspec.h index ef10cd205575..bc8f7177dc10 100644 --- a/include/asm-i386/mach-summit/mach_mpspec.h +++ b/include/asm-i386/mach-summit/mach_mpspec.h @@ -8,6 +8,7 @@ #define MAX_IRQ_SOURCES 256 -#define MAX_MP_BUSSES 32 +/* Maximum 256 PCI busses, plus 1 ISA bus in each of 4 cabinets. */ +#define MAX_MP_BUSSES 260 #endif /* __ASM_MACH_MPSPEC_H */ diff --git a/include/asm-i386/module.h b/include/asm-i386/module.h index 76fc36f60ebe..8ec1dae638cb 100644 --- a/include/asm-i386/module.h +++ b/include/asm-i386/module.h @@ -60,6 +60,12 @@ struct mod_arch_specific #define MODULE_REGPARM "" #endif -#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_REGPARM +#ifdef CONFIG_4KSTACKS +#define MODULE_STACKSIZE "4KSTACKS " +#else +#define MODULE_STACKSIZE "" +#endif + +#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_REGPARM MODULE_STACKSIZE #endif /* _ASM_I386_MODULE_H */ diff --git a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h index 78bd12b7ae42..b376b093749c 100644 --- a/include/asm-i386/mpspec.h +++ b/include/asm-i386/mpspec.h @@ -52,7 +52,7 @@ typedef struct physid_mask physid_mask_t; #define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS) #define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS) -#define physids_clear(map) bitmap_clear((map).mask, MAX_APICS) +#define physids_clear(map) bitmap_zero((map).mask, MAX_APICS) #define physids_complement(map) bitmap_complement((map).mask, MAX_APICS) #define physids_empty(map) bitmap_empty((map).mask, MAX_APICS) #define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS) diff --git a/include/asm-i386/msi.h b/include/asm-i386/msi.h new file mode 100644 index 000000000000..e7047ef3a8fd --- /dev/null +++ b/include/asm-i386/msi.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2003-2004 Intel + * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) + */ + +#ifndef ASM_MSI_H +#define ASM_MSI_H + +#include <asm/desc.h> +#include <mach_apic.h> + +#define LAST_DEVICE_VECTOR 232 +#define MSI_DEST_MODE MSI_LOGICAL_MODE +#define MSI_TARGET_CPU_SHIFT 12 + +#ifdef CONFIG_SMP +#define MSI_TARGET_CPU logical_smp_processor_id() +#else +#define MSI_TARGET_CPU TARGET_CPUS +#endif + +#endif /* ASM_MSI_H */ diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h index 147acd8530e2..0ca6393cbe4c 100644 --- a/include/asm-i386/pgtable-3level.h +++ b/include/asm-i386/pgtable-3level.h @@ -123,4 +123,6 @@ static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot) #define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) }) #define PTE_FILE_MAX_BITS 32 +extern struct kmem_cache_s *pae_pgd_cachep; + #endif /* _I386_PGTABLE_3LEVEL_H */ diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 8fd1e78fc14c..1c0c38375349 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -21,27 +21,15 @@ #include <asm/bitops.h> #endif -#include <linux/slab.h> -#include <linux/list.h> -#include <linux/spinlock.h> +extern pgd_t swapper_pg_dir[1024]; +extern void paging_init(void); /* * ZERO_PAGE is a global shared page that is always zero: used * for zero-mapped memory areas etc.. */ -#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) extern unsigned long empty_zero_page[1024]; -extern pgd_t swapper_pg_dir[1024]; -extern kmem_cache_t *pgd_cache; -extern kmem_cache_t *pmd_cache; -extern spinlock_t pgd_lock; -extern struct list_head pgd_list; - -void pmd_ctor(void *, kmem_cache_t *, unsigned long); -void pgd_ctor(void *, kmem_cache_t *, unsigned long); -void pgd_dtor(void *, kmem_cache_t *, unsigned long); -void pgtable_cache_init(void); -void paging_init(void); +#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) #endif /* !__ASSEMBLY__ */ @@ -53,8 +41,20 @@ void paging_init(void); #ifndef __ASSEMBLY__ #ifdef CONFIG_X86_PAE # include <asm/pgtable-3level.h> + +/* + * Need to initialise the X86 PAE caches + */ +extern void pgtable_cache_init(void); + #else # include <asm/pgtable-2level.h> + +/* + * No page table caches to initialise + */ +#define pgtable_cache_init() do { } while (0) + #endif #endif @@ -107,6 +107,9 @@ void paging_init(void); #define _PAGE_BIT_DIRTY 6 #define _PAGE_BIT_PSE 7 /* 4 MB (or 2MB) page, Pentium+, if present.. */ #define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */ +#define _PAGE_BIT_UNUSED1 9 /* available for programmer */ +#define _PAGE_BIT_UNUSED2 10 +#define _PAGE_BIT_UNUSED3 11 #define _PAGE_PRESENT 0x001 #define _PAGE_RW 0x002 @@ -117,6 +120,9 @@ void paging_init(void); #define _PAGE_DIRTY 0x040 #define _PAGE_PSE 0x080 /* 4 MB (or 2MB) page, Pentium+, if present.. */ #define _PAGE_GLOBAL 0x100 /* Global TLB entry PPro+ */ +#define _PAGE_UNUSED1 0x200 /* available for programmer */ +#define _PAGE_UNUSED2 0x400 +#define _PAGE_UNUSED3 0x800 #define _PAGE_FILE 0x040 /* set:pagecache unset:swap */ #define _PAGE_PROTNONE 0x080 /* If not present */ diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 3a5e0ff2a20c..0ebe1aa1afb0 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -403,6 +403,8 @@ struct tss_struct { unsigned long stack[64]; } __attribute__((packed)); +#define ARCH_MIN_TASKALIGN 16 + struct thread_struct { /* cached TLS descriptors. */ struct desc_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; diff --git a/include/asm-i386/std_resources.h b/include/asm-i386/std_resources.h new file mode 100644 index 000000000000..53733988dabd --- /dev/null +++ b/include/asm-i386/std_resources.h @@ -0,0 +1,14 @@ +/* + * include/asm-i386/std_resources.h + */ + +#ifndef __ASM_I386_STD_RESOURCES_H +#define __ASM_I386_STD_RESOURCES_H + +#include <linux/init.h> + +void probe_roms(void) __init; +void request_graphics_resource(void) __init; +void request_standard_io_resources(void) __init; + +#endif diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h index 75f940011daa..6f59e1fe345b 100644 --- a/include/asm-i386/thread_info.h +++ b/include/asm-i386/thread_info.h @@ -9,6 +9,9 @@ #ifdef __KERNEL__ +#include <linux/config.h> +#include <asm/page.h> + #ifndef __ASSEMBLY__ #include <asm/processor.h> #endif @@ -29,12 +32,16 @@ struct thread_info { __u32 cpu; /* current CPU */ __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ + mm_segment_t addr_limit; /* thread address space: 0-0xBFFFFFFF for user-thead 0-0xFFFFFFFF for kernel-thread */ struct restart_block restart_block; + unsigned long previous_esp; /* ESP of the previous stack in case + of nested (IRQ) stacks + */ __u8 supervisor_stack[0]; }; @@ -53,7 +60,13 @@ struct thread_info { #endif #define PREEMPT_ACTIVE 0x4000000 +#ifdef CONFIG_4KSTACKS +#define THREAD_SIZE (4096) +#else +#define THREAD_SIZE (8192) +#endif +#define STACK_WARN (THREAD_SIZE/8) /* * macros/functions for gaining access to the thread information structure * @@ -77,7 +90,6 @@ struct thread_info { #define init_thread_info (init_thread_union.thread_info) #define init_stack (init_thread_union.stack) -#define THREAD_SIZE (2*PAGE_SIZE) /* how to get the thread information struct from C */ static inline struct thread_info *current_thread_info(void) @@ -87,6 +99,14 @@ static inline struct thread_info *current_thread_info(void) return ti; } +/* how to get the current stack pointer from C */ +static inline unsigned long current_stack_pointer(void) +{ + unsigned long ti; + __asm__("movl %%esp,%0; ":"=r" (ti) : ); + return ti; +} + /* thread information allocation */ #ifdef CONFIG_DEBUG_STACK_USAGE #define alloc_thread_info(tsk) \ @@ -108,8 +128,6 @@ static inline struct thread_info *current_thread_info(void) #else /* !__ASSEMBLY__ */ -#define THREAD_SIZE 8192 - /* how to get the thread information struct from ASM */ #define GET_THREAD_INFO(reg) \ movl $-THREAD_SIZE, reg; \ @@ -133,6 +151,7 @@ static inline struct thread_info *current_thread_info(void) #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ #define TIF_IRET 5 /* return with iret */ +#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) @@ -141,9 +160,12 @@ static inline struct thread_info *current_thread_info(void) #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) #define _TIF_IRET (1<<TIF_IRET) +#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) -#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ +/* work to do on interrupt/exception return */ +#define _TIF_WORK_MASK \ + (0x0000FFFF & ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)) #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ /* diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index a2d58a99491e..620a232084f3 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -279,8 +279,17 @@ #define __NR_utimes 271 #define __NR_fadvise64_64 272 #define __NR_vserver 273 +#define __NR_mbind 274 +#define __NR_get_mempolicy 275 +#define __NR_set_mempolicy 276 +#define __NR_mq_open 277 +#define __NR_mq_unlink (__NR_mq_open+1) +#define __NR_mq_timedsend (__NR_mq_open+2) +#define __NR_mq_timedreceive (__NR_mq_open+3) +#define __NR_mq_notify (__NR_mq_open+4) +#define __NR_mq_getsetattr (__NR_mq_open+5) -#define NR_syscalls 274 +#define NR_syscalls 283 /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */ diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h index 502f51a1a0ee..bd39859c2d2a 100644 --- a/include/asm-ia64/bitops.h +++ b/include/asm-ia64/bitops.h @@ -236,7 +236,7 @@ __test_and_clear_bit(int nr, volatile void * addr) } /** - * test_and_change_bit - Change a bit and return its new value + * test_and_change_bit - Change a bit and return its old value * @nr: Bit to set * @addr: Address to count from * diff --git a/include/asm-ia64/hw_irq.h b/include/asm-ia64/hw_irq.h index be653c915f21..a72134370811 100644 --- a/include/asm-ia64/hw_irq.h +++ b/include/asm-ia64/hw_irq.h @@ -34,6 +34,8 @@ typedef u8 ia64_vector; #define IA64_MAX_VECTORED_IRQ 255 #define IA64_NUM_VECTORS 256 +#define AUTO_ASSIGN -1 + #define IA64_SPURIOUS_INT_VECTOR 0x0f /* @@ -80,7 +82,7 @@ extern unsigned long ipi_base_addr; extern struct hw_interrupt_type irq_type_ia64_lsapic; /* CPU-internal interrupt controller */ -extern int ia64_alloc_vector (void); /* allocate a free vector */ +extern int assign_irq_vector (int irq); /* allocate a free vector */ extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect); extern void register_percpu_irq (ia64_vector vec, struct irqaction *action); diff --git a/include/asm-ia64/irq.h b/include/asm-ia64/irq.h index 8e664a0d80f7..5d930fdc0bea 100644 --- a/include/asm-ia64/irq.h +++ b/include/asm-ia64/irq.h @@ -12,6 +12,7 @@ */ #define NR_IRQS 256 +#define NR_IRQ_VECTORS NR_IRQS static __inline__ int irq_canonicalize (int irq) @@ -29,4 +30,8 @@ extern void disable_irq_nosync (unsigned int); extern void enable_irq (unsigned int); extern void set_irq_affinity_info (unsigned int irq, int dest, int redir); +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif /* _ASM_IA64_IRQ_H */ diff --git a/include/asm-ia64/msi.h b/include/asm-ia64/msi.h new file mode 100644 index 000000000000..c6145776b87f --- /dev/null +++ b/include/asm-ia64/msi.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2003-2004 Intel + * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) + */ + +#ifndef ASM_MSI_H +#define ASM_MSI_H + +#define FIRST_DEVICE_VECTOR IA64_FIRST_DEVICE_VECTOR +#define LAST_DEVICE_VECTOR IA64_LAST_DEVICE_VECTOR +static inline void set_intr_gate (int nr, void *func) {} +#define IO_APIC_VECTOR(irq) (irq) +#define ack_APIC_irq ia64_eoi +#define irq_desc _irq_desc +#define cpu_mask_to_apicid(mask) cpu_physical_id(first_cpu(mask)) +#define MSI_DEST_MODE MSI_PHYSICAL_MODE +#define MSI_TARGET_CPU ((ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff) +#define MSI_TARGET_CPU_SHIFT 4 + +#endif /* ASM_MSI_H */ diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h index 86d7f7f91bfb..bec5c8cd0079 100644 --- a/include/asm-ia64/pgtable.h +++ b/include/asm-ia64/pgtable.h @@ -119,7 +119,8 @@ #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_A) #define PAGE_SHARED __pgprot(__ACCESS_BITS | _PAGE_PL_3 | _PAGE_AR_RW) #define PAGE_READONLY __pgprot(__ACCESS_BITS | _PAGE_PL_3 | _PAGE_AR_R) -#define PAGE_COPY __pgprot(__ACCESS_BITS | _PAGE_PL_3 | _PAGE_AR_RX) +#define PAGE_COPY __pgprot(__ACCESS_BITS | _PAGE_PL_3 | _PAGE_AR_R) +#define PAGE_COPY_EXEC __pgprot(__ACCESS_BITS | _PAGE_PL_3 | _PAGE_AR_RX) #define PAGE_GATE __pgprot(__ACCESS_BITS | _PAGE_PL_0 | _PAGE_AR_X_RX) #define PAGE_KERNEL __pgprot(__DIRTY_BITS | _PAGE_PL_0 | _PAGE_AR_RWX) #define PAGE_KERNELRX __pgprot(__ACCESS_BITS | _PAGE_PL_0 | _PAGE_AR_RX) diff --git a/include/asm-m68k/irq.h b/include/asm-m68k/irq.h index 02855ca536b0..5889bc919e80 100644 --- a/include/asm-m68k/irq.h +++ b/include/asm-m68k/irq.h @@ -124,4 +124,8 @@ extern volatile unsigned int num_spurious; */ extern irq_node_t *new_irq_node(void); +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif /* _M68K_IRQ_H_ */ diff --git a/include/asm-m68knommu/coldfire.h b/include/asm-m68knommu/coldfire.h index 628c93704142..8d8861b930f6 100644 --- a/include/asm-m68knommu/coldfire.h +++ b/include/asm-m68knommu/coldfire.h @@ -54,6 +54,8 @@ #define MCF_CLK 54000000 #elif defined(CONFIG_CLOCK_60MHz) #define MCF_CLK 60000000 +#elif defined(CONFIG_CLOCK_64MHz) +#define MCF_CLK 64000000 #elif defined(CONFIG_CLOCK_66MHz) #define MCF_CLK 66000000 #elif defined(CONFIG_CLOCK_70MHz) diff --git a/include/asm-m68knommu/dma-mapping.h b/include/asm-m68knommu/dma-mapping.h index e7e16901f686..a6c42ba48da6 100644 --- a/include/asm-m68knommu/dma-mapping.h +++ b/include/asm-m68knommu/dma-mapping.h @@ -1 +1,10 @@ +#ifndef _M68KNOMMU_DMA_MAPPING_H +#define _M68KNOMMU_DMA_MAPPING_H + +#include <linux/config.h> + +#ifdef CONFIG_PCI #include <asm-generic/dma-mapping.h> +#endif + +#endif /* _M68KNOMMU_DMA_MAPPING_H */ diff --git a/include/asm-m68knommu/irq.h b/include/asm-m68knommu/irq.h index 4c66ba93201a..208ccd969e4b 100644 --- a/include/asm-m68knommu/irq.h +++ b/include/asm-m68knommu/irq.h @@ -121,4 +121,8 @@ extern irq_node_t *new_irq_node(void); #define enable_irq_nosync(x) enable_irq(x) #define disable_irq_nosync(x) disable_irq(x) +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif /* _M68K_IRQ_H_ */ diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index 8a3d1a32505b..cb06e891d0aa 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h @@ -296,7 +296,7 @@ static inline int __test_and_clear_bit(unsigned long nr, } /* - * test_and_change_bit - Change a bit and return its new value + * test_and_change_bit - Change a bit and return its old value * @nr: Bit to change * @addr: Address to count from * @@ -567,7 +567,7 @@ static inline int __test_and_clear_bit(unsigned long nr, } /* - * test_and_change_bit - Change a bit and return its new value + * test_and_change_bit - Change a bit and return its old value * @nr: Bit to change * @addr: Address to count from * diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h index 90b4ae1258a8..d9667a8fbbfb 100644 --- a/include/asm-mips/irq.h +++ b/include/asm-mips/irq.h @@ -31,4 +31,7 @@ extern asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs); extern void init_generic_irq(void); +struct irqaction; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif /* _ASM_IRQ_H */ diff --git a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h index 52b0c6a96aea..7a77986e3738 100644 --- a/include/asm-parisc/cacheflush.h +++ b/include/asm-parisc/cacheflush.h @@ -69,8 +69,7 @@ extern void __flush_dcache_page(struct page *page); static inline void flush_dcache_page(struct page *page) { - if (page->mapping && list_empty(&page->mapping->i_mmap) && - list_empty(&page->mapping->i_mmap_shared)) { + if (page_mapping(page) && !mapping_mapped(page->mapping)) { set_bit(PG_dcache_dirty, &page->flags); } else { __flush_dcache_page(page); diff --git a/include/asm-parisc/irq.h b/include/asm-parisc/irq.h index 39db70230740..b7acca7de670 100644 --- a/include/asm-parisc/irq.h +++ b/include/asm-parisc/irq.h @@ -96,4 +96,7 @@ extern unsigned long txn_alloc_addr(int); /* soft power switch support (power.c) */ extern struct tasklet_struct power_tasklet; +struct irqaction; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif /* _ASM_PARISC_IRQ_H */ diff --git a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h index bfa3de404d27..df5b76306f7a 100644 --- a/include/asm-ppc/irq.h +++ b/include/asm-ppc/irq.h @@ -211,5 +211,9 @@ extern unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; extern unsigned long ppc_lost_interrupts[NR_MASK_WORDS]; extern atomic_t ppc_n_lost_interrupts; +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif /* _ASM_IRQ_H */ #endif /* __KERNEL__ */ diff --git a/include/asm-ppc/page.h b/include/asm-ppc/page.h index e47e77327ee5..57838e8e00f1 100644 --- a/include/asm-ppc/page.h +++ b/include/asm-ppc/page.h @@ -84,7 +84,8 @@ typedef unsigned long pgprot_t; #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) struct page; -extern void clear_page(void *page); +extern void clear_pages(void *page, int order); +static inline void clear_page(void *page) { clear_pages(page, 0); } extern void copy_page(void *to, void *from); extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); extern void copy_user_page(void *to, void *from, unsigned long vaddr, diff --git a/include/asm-ppc64/cacheflush.h b/include/asm-ppc64/cacheflush.h index 7d958ac381b0..d6f24f9a1fed 100644 --- a/include/asm-ppc64/cacheflush.h +++ b/include/asm-ppc64/cacheflush.h @@ -1,8 +1,8 @@ #ifndef _PPC64_CACHEFLUSH_H #define _PPC64_CACHEFLUSH_H -/* Keep includes the same across arches. */ #include <linux/mm.h> +#include <asm/cputable.h> /* * No cache flushing is required when address mappings are @@ -18,7 +18,7 @@ #define flush_cache_vunmap(start, end) do { } while (0) extern void flush_dcache_page(struct page *page); -extern void flush_icache_range(unsigned long, unsigned long); +extern void __flush_icache_range(unsigned long, unsigned long); extern void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, unsigned long addr, int len); @@ -35,4 +35,10 @@ do { memcpy(dst, src, len); \ extern void __flush_dcache_icache(void *page_va); +static inline void flush_icache_range(unsigned long start, unsigned long stop) +{ + if (!(cur_cpu_spec->cpu_features & CPU_FTR_COHERENT_ICACHE)) + __flush_icache_range(start, stop); +} + #endif /* _PPC64_CACHEFLUSH_H */ diff --git a/include/asm-ppc64/cputable.h b/include/asm-ppc64/cputable.h index 99c3abfba704..abca635f9f9b 100644 --- a/include/asm-ppc64/cputable.h +++ b/include/asm-ppc64/cputable.h @@ -125,8 +125,12 @@ extern firmware_feature_t firmware_features_table[]; #define CPU_FTR_TLBIEL 0x0000000400000000 #define CPU_FTR_NOEXECUTE 0x0000000800000000 #define CPU_FTR_NODSISRALIGN 0x0000001000000000 -#define CPU_FTR_DABR 0x0000002000000000 -#define CPU_FTR_IABR 0x0000004000000000 +#define CPU_FTR_IABR 0x0000002000000000 +#define CPU_FTR_MMCRA 0x0000004000000000 +#define CPU_FTR_PMC8 0x0000008000000000 +#define CPU_FTR_SMT 0x0000010000000000 +#define CPU_FTR_COHERENT_ICACHE 0x0000020000000000 +#define CPU_FTR_LOCKLESS_TLBIE 0x0000040000000000 /* Platform firmware features */ #define FW_FTR_ 0x0000000000000001 diff --git a/include/asm-ppc64/dma-mapping.h b/include/asm-ppc64/dma-mapping.h index e12753cf8861..0cdc5346f6f8 100644 --- a/include/asm-ppc64/dma-mapping.h +++ b/include/asm-ppc64/dma-mapping.h @@ -36,10 +36,43 @@ extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction); extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, enum dma_data_direction direction); -extern void dma_sync_single(struct device *dev, dma_addr_t dma_handle, - size_t size, enum dma_data_direction direction); -extern void dma_sync_sg(struct device *dev, struct scatterlist *sg, int nelems, - enum dma_data_direction direction); + +static inline void +dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, + enum dma_data_direction direction) +{ + BUG_ON(direction == DMA_NONE); + /* nothing to do */ +} + +static inline void +dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, + enum dma_data_direction direction) +{ + BUG_ON(direction == DMA_NONE); + /* nothing to do */ +} + +static inline void +dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, + enum dma_data_direction direction) +{ + BUG_ON(direction == DMA_NONE); + /* nothing to do */ +} + +static inline void +dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, + enum dma_data_direction direction) +{ + BUG_ON(direction == DMA_NONE); + /* nothing to do */ +} + +static inline int dma_mapping_error(dma_addr_t dma_addr) +{ + return (dma_addr == DMA_ERROR_CODE); +} /* Now for the API extensions over the pci_ one */ @@ -56,27 +89,29 @@ dma_get_cache_alignment(void) } static inline void -dma_sync_single_range(struct device *dev, dma_addr_t dma_handle, - unsigned long offset, size_t size, - enum dma_data_direction direction) +dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle, + unsigned long offset, size_t size, + enum dma_data_direction direction) { - /* just sync everything, that's all the pci API can do */ - dma_sync_single(dev, dma_handle, offset+size, direction); + BUG_ON(direction == DMA_NONE); + /* nothing to do */ } static inline void -dma_cache_sync(void *vaddr, size_t size, - enum dma_data_direction direction) +dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle, + unsigned long offset, size_t size, + enum dma_data_direction direction) { - /* could define this in terms of the dma_cache ... operations, - * but if you get this on a platform, you should convert the platform - * to using the generic device DMA API */ - BUG(); + BUG_ON(direction == DMA_NONE); + /* nothing to do */ } -static inline int dma_mapping_error(dma_addr_t dma_addr) +static inline void +dma_cache_sync(void *vaddr, size_t size, + enum dma_data_direction direction) { - return (dma_addr == DMA_ERROR_CODE); + BUG_ON(direction == DMA_NONE); + /* nothing to do */ } #endif /* _ASM_DMA_MAPPING_H */ diff --git a/include/asm-ppc64/eeh.h b/include/asm-ppc64/eeh.h index d426126ddab1..4ccf43666ee5 100644 --- a/include/asm-ppc64/eeh.h +++ b/include/asm-ppc64/eeh.h @@ -199,74 +199,71 @@ static inline void eeh_memcpy_toio(void *dest, void *src, unsigned long n) { memcpy(vdest, src, n); } -/* The I/O macros must handle ISA ports as well as PCI I/O bars. - * ISA does not implement EEH and ISA may not exist in the system. - * For PCI we check for EEH failures. - */ -#define _IO_IS_ISA(port) ((port) < 0x10000) -#define _IO_HAS_ISA_BUS (isa_io_base != 0) +#define MAX_ISA_PORT 0x10000 +extern unsigned long io_page_mask; +#define _IO_IS_VALID(port) ((port) >= MAX_ISA_PORT || (1 << (port>>PAGE_SHIFT)) & io_page_mask) static inline u8 eeh_inb(unsigned long port) { u8 val; - if (_IO_IS_ISA(port) && !_IO_HAS_ISA_BUS) + if (!_IO_IS_VALID(port)) return ~0; val = in_8((u8 *)(port+pci_io_base)); - if (!_IO_IS_ISA(port) && EEH_POSSIBLE_IO_ERROR(val, u8)) + if (EEH_POSSIBLE_IO_ERROR(val, u8)) return eeh_check_failure((void*)(port), val); return val; } static inline void eeh_outb(u8 val, unsigned long port) { - if (!_IO_IS_ISA(port) || _IO_HAS_ISA_BUS) + if (_IO_IS_VALID(port)) return out_8((u8 *)(port+pci_io_base), val); } static inline u16 eeh_inw(unsigned long port) { u16 val; - if (_IO_IS_ISA(port) && !_IO_HAS_ISA_BUS) + if (!_IO_IS_VALID(port)) return ~0; val = in_le16((u16 *)(port+pci_io_base)); - if (!_IO_IS_ISA(port) && EEH_POSSIBLE_IO_ERROR(val, u16)) + if (EEH_POSSIBLE_IO_ERROR(val, u16)) return eeh_check_failure((void*)(port), val); return val; } static inline void eeh_outw(u16 val, unsigned long port) { - if (!_IO_IS_ISA(port) || _IO_HAS_ISA_BUS) + if (_IO_IS_VALID(port)) return out_le16((u16 *)(port+pci_io_base), val); } static inline u32 eeh_inl(unsigned long port) { u32 val; - if (_IO_IS_ISA(port) && !_IO_HAS_ISA_BUS) + if (!_IO_IS_VALID(port)) return ~0; val = in_le32((u32 *)(port+pci_io_base)); - if (!_IO_IS_ISA(port) && EEH_POSSIBLE_IO_ERROR(val, u32)) + if (EEH_POSSIBLE_IO_ERROR(val, u32)) return eeh_check_failure((void*)(port), val); return val; } static inline void eeh_outl(u32 val, unsigned long port) { - if (!_IO_IS_ISA(port) || _IO_HAS_ISA_BUS) + if (_IO_IS_VALID(port)) return out_le32((u32 *)(port+pci_io_base), val); } /* in-string eeh macros */ static inline void eeh_insb(unsigned long port, void * buf, int ns) { _insb((u8 *)(port+pci_io_base), buf, ns); - if (!_IO_IS_ISA(port) && EEH_POSSIBLE_IO_ERROR((*(((u8*)buf)+ns-1)), u8)) + if (EEH_POSSIBLE_IO_ERROR((*(((u8*)buf)+ns-1)), u8)) eeh_check_failure((void*)(port), *(u8*)buf); } static inline void eeh_insw_ns(unsigned long port, void * buf, int ns) { _insw_ns((u16 *)(port+pci_io_base), buf, ns); - if (!_IO_IS_ISA(port) && EEH_POSSIBLE_IO_ERROR((*(((u16*)buf)+ns-1)), u16)) + if (EEH_POSSIBLE_IO_ERROR((*(((u16*)buf)+ns-1)), u16)) eeh_check_failure((void*)(port), *(u16*)buf); } static inline void eeh_insl_ns(unsigned long port, void * buf, int nl) { _insl_ns((u32 *)(port+pci_io_base), buf, nl); - if (!_IO_IS_ISA(port) && EEH_POSSIBLE_IO_ERROR((*(((u32*)buf)+nl-1)), u32)) + if (EEH_POSSIBLE_IO_ERROR((*(((u32*)buf)+nl-1)), u32)) eeh_check_failure((void*)(port), *(u32*)buf); } diff --git a/include/asm-ppc64/hw_irq.h b/include/asm-ppc64/hw_irq.h index 8db7a1a70756..baea40e695ec 100644 --- a/include/asm-ppc64/hw_irq.h +++ b/include/asm-ppc64/hw_irq.h @@ -75,9 +75,24 @@ static inline void __do_save_and_cli(unsigned long *flags) #endif /* CONFIG_PPC_ISERIES */ -#define mask_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->disable) irq_desc[irq].handler->disable(irq);}) -#define unmask_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->enable) irq_desc[irq].handler->enable(irq);}) -#define ack_irq(irq) ({if (irq_desc[irq].handler && irq_desc[irq].handler->ack) irq_desc[irq].handler->ack(irq);}) +#define mask_irq(irq) \ + ({ \ + irq_desc_t *desc = get_irq_desc(irq); \ + if (desc->handler && desc->handler->disable) \ + desc->handler->disable(irq); \ + }) +#define unmask_irq(irq) \ + ({ \ + irq_desc_t *desc = get_irq_desc(irq); \ + if (desc->handler && desc->handler->enable) \ + desc->handler->enable(irq); \ + }) +#define ack_irq(irq) \ + ({ \ + irq_desc_t *desc = get_irq_desc(irq); \ + if (desc->handler && desc->handler->ack) \ + desc->handler->ack(irq); \ + }) /* Should we handle this via lost interrupts and IPIs or should we don't care like * we do now ? --BenH. diff --git a/include/asm-ppc64/iommu.h b/include/asm-ppc64/iommu.h index 3aeadc38d5f3..689b6adf383e 100644 --- a/include/asm-ppc64/iommu.h +++ b/include/asm-ppc64/iommu.h @@ -19,12 +19,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _PCI_DMA_H -#define _PCI_DMA_H +#ifndef _ASM_IOMMU_H +#define _ASM_IOMMU_H #include <asm/types.h> #include <linux/spinlock.h> #include <linux/device.h> +#include <linux/dma-mapping.h> /* * IOMAP_MAX_ORDER defines the largest contiguous block @@ -130,19 +131,20 @@ extern void iommu_devnode_init(struct iSeries_Device_Node *dn); */ extern struct iommu_table *iommu_init_table(struct iommu_table * tbl); -/* allocates a range of tces and sets them to the pages */ -extern dma_addr_t iommu_alloc(struct iommu_table *, void *page, - unsigned int numPages, int direction); -extern void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr, - unsigned int npages); - -/* same with sg lists */ -extern int iommu_alloc_sg(struct iommu_table *table, struct device *dev, - struct scatterlist *sglist, int nelems, - int direction); -extern void iommu_free_sg(struct iommu_table *tbl, struct scatterlist *sglist, - int nelems); - +extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl, + struct scatterlist *sglist, int nelems, + enum dma_data_direction direction); +extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, + int nelems, enum dma_data_direction direction); + +extern void *iommu_alloc_consistent(struct iommu_table *tbl, size_t size, + dma_addr_t *dma_handle); +extern void iommu_free_consistent(struct iommu_table *tbl, size_t size, + void *vaddr, dma_addr_t dma_handle); +extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, + size_t size, enum dma_data_direction direction); +extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, + size_t size, enum dma_data_direction direction); extern void tce_init_pSeries(void); extern void tce_init_iSeries(void); @@ -152,4 +154,4 @@ extern void pci_dma_init_direct(void); extern int ppc64_iommu_off; -#endif +#endif /* _ASM_IOMMU_H */ diff --git a/include/asm-ppc64/irq.h b/include/asm-ppc64/irq.h index f4ed6fe326dd..2cd77b4935fb 100644 --- a/include/asm-ppc64/irq.h +++ b/include/asm-ppc64/irq.h @@ -11,6 +11,11 @@ #include <asm/atomic.h> +/* + * Maximum number of interrupt sources that we can handle. + */ +#define NR_IRQS 512 + extern void disable_irq(unsigned int); extern void disable_irq_nosync(unsigned int); extern void enable_irq(unsigned int); @@ -18,12 +23,11 @@ extern void enable_irq(unsigned int); /* this number is used when no interrupt has been assigned */ #define NO_IRQ (-1) -/* - * this is the maximum number of virtual irqs we will use. - */ -#define NR_IRQS 512 +#define get_irq_desc(irq) (&irq_desc[(irq)]) -#define NUM_8259_INTERRUPTS 16 +/* Define a way to iterate across irqs. */ +#define for_each_irq(i) \ + for ((i) = 0; (i) < NR_IRQS; ++(i)) /* Interrupt numbers are virtual in case they are sparsely * distributed by the hardware. @@ -41,12 +45,39 @@ static inline unsigned int virt_irq_to_real(unsigned int virt_irq) return virt_irq_to_real_map[virt_irq]; } +/* + * Because many systems have two overlapping names spaces for + * interrupts (ISA and XICS for example), and the ISA interrupts + * have historically not been easy to renumber, we allow ISA + * interrupts to take values 0 - 15, and shift up the remaining + * interrupts by 0x10. + */ +#define NUM_ISA_INTERRUPTS 0x10 +extern int __irq_offset_value; + +static inline int irq_offset_up(int irq) +{ + return(irq + __irq_offset_value); +} + +static inline int irq_offset_down(int irq) +{ + return(irq - __irq_offset_value); +} + +static inline int irq_offset_value(void) +{ + return __irq_offset_value; +} + static __inline__ int irq_canonicalize(int irq) { return irq; } -#define NR_MASK_WORDS ((NR_IRQS + 63) / 64) +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); #endif /* _ASM_IRQ_H */ #endif /* __KERNEL__ */ diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h index a4d181d79c21..bb961a029fae 100644 --- a/include/asm-ppc64/machdep.h +++ b/include/asm-ppc64/machdep.h @@ -11,6 +11,7 @@ #include <linux/config.h> #include <linux/seq_file.h> +#include <linux/dma-mapping.h> struct pt_regs; struct pci_bus; @@ -57,7 +58,7 @@ struct machdep_calls { long index, long npages, unsigned long uaddr, - int direction); + enum dma_data_direction direction); void (*tce_free)(struct iommu_table *tbl, long index, long npages); @@ -79,6 +80,7 @@ struct machdep_calls { void (*restart)(char *cmd); void (*power_off)(void); void (*halt)(void); + void (*panic)(char *str); int (*set_rtc_time)(struct rtc_time *); void (*get_rtc_time)(struct rtc_time *); diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h index a68e47f717e7..b42d9a4db08f 100644 --- a/include/asm-ppc64/mmu.h +++ b/include/asm-ppc64/mmu.h @@ -23,12 +23,12 @@ typedef unsigned long mm_context_id_t; typedef struct { mm_context_id_t id; #ifdef CONFIG_HUGETLB_PAGE - int low_hpages; + u16 htlb_segs; /* bitmask */ #endif } mm_context_t; #ifdef CONFIG_HUGETLB_PAGE -#define KERNEL_LOW_HPAGES .low_hpages = 0, +#define KERNEL_LOW_HPAGES .htlb_segs = 0, #else #define KERNEL_LOW_HPAGES #endif diff --git a/include/asm-ppc64/mmzone.h b/include/asm-ppc64/mmzone.h index 7338bbb055a8..4182c647f4e6 100644 --- a/include/asm-ppc64/mmzone.h +++ b/include/asm-ppc64/mmzone.h @@ -19,13 +19,13 @@ extern struct pglist_data node_data[]; */ extern int numa_cpu_lookup_table[]; -extern int numa_memory_lookup_table[]; +extern char *numa_memory_lookup_table; extern cpumask_t numa_cpumask_lookup_table[]; extern int nr_cpus_in_node[]; #define MAX_MEMORY (1UL << 41) -/* 256MB regions */ -#define MEMORY_INCREMENT_SHIFT 28 +/* 16MB regions */ +#define MEMORY_INCREMENT_SHIFT 24 #define MEMORY_INCREMENT (1UL << MEMORY_INCREMENT_SHIFT) /* NUMA debugging, will not work on a DLPAR machine */ diff --git a/include/asm-ppc64/naca.h b/include/asm-ppc64/naca.h index b93cdf160dd3..a50189402420 100644 --- a/include/asm-ppc64/naca.h +++ b/include/asm-ppc64/naca.h @@ -37,12 +37,10 @@ struct naca_struct { u32 dCacheL1LinesPerPage; /* L1 d-cache lines / page 0x64 */ u32 iCacheL1LogLineSize; /* L1 i-cache line size Log2 0x68 */ u32 iCacheL1LinesPerPage; /* L1 i-cache lines / page 0x6c */ - u64 smt_snooze_delay; /* Delay (in usec) before 0x70 */ - /* entering ST mode */ - u8 smt_state; /* 0 = SMT off 0x78 */ + u8 smt_state; /* 0 = SMT off 0x70 */ /* 1 = SMT on */ /* 2 = SMT dynamic */ - u8 resv0[7]; /* Reserved 0x70 - 0x7F */ + u8 resv0[15]; /* Reserved 0x71 - 0x7F */ }; extern struct naca_struct *naca; diff --git a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h index 24a2e99faae1..d368afedd735 100644 --- a/include/asm-ppc64/paca.h +++ b/include/asm-ppc64/paca.h @@ -64,13 +64,13 @@ struct paca_struct { u16 xHwProcNum; /* Physical processor number 0x1A */ u32 default_decr; /* Default decrementer value 0x1c */ u64 xKsave; /* Saved Kernel stack addr or zero 0x20 */ - struct ItLpQueue *lpQueuePtr; /* LpQueue handled by this processor 0x30 */ - u64 xTOC; /* Kernel TOC address 0x38 */ - STAB xStab_data; /* Segment table information 0x40,0x48,0x50 */ - u8 *exception_sp; /* 0x58 */ - u8 xProcEnabled; /* 0x59 */ - u8 prof_enabled; /* 1=iSeries profiling enabled 0x60 */ - u8 resv1[38]; /* 0x61-0x7F */ + struct ItLpQueue *lpQueuePtr; /* LpQueue handled by this processor 0x28 */ + u64 xTOC; /* Kernel TOC address 0x30 */ + STAB xStab_data; /* Segment table information 0x38,0x40,0x48 */ + u8 *exception_sp; /* 0x50 */ + u8 xProcEnabled; /* 0x58 */ + u8 prof_enabled; /* 1=iSeries profiling enabled 0x59 */ + u8 resv1[38]; /* 0x5a-0x7f*/ /*===================================================================================== * CACHE_LINE_2 0x0080 - 0x00FF diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h index fd707bb57da5..984602ae4fcc 100644 --- a/include/asm-ppc64/page.h +++ b/include/asm-ppc64/page.h @@ -22,6 +22,10 @@ #define PAGE_MASK (~(PAGE_SIZE-1)) #define PAGE_OFFSET_MASK (PAGE_SIZE-1) +#define SID_SHIFT 28 +#define SID_MASK 0xfffffffff +#define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) + #ifdef CONFIG_HUGETLB_PAGE #define HPAGE_SHIFT 24 @@ -33,30 +37,36 @@ #define TASK_HPAGE_BASE (0x0000010000000000UL) #define TASK_HPAGE_END (0x0000018000000000UL) -/* For 32-bit processes the hugepage range is 2-3G */ -#define TASK_HPAGE_BASE_32 (0x80000000UL) -#define TASK_HPAGE_END_32 (0xc0000000UL) +#define LOW_ESID_MASK(addr, len) (((1U << (GET_ESID(addr+len-1)+1)) \ + - (1U << GET_ESID(addr))) & 0xffff) #define ARCH_HAS_HUGEPAGE_ONLY_RANGE #define ARCH_HAS_PREPARE_HUGEPAGE_RANGE -#define is_hugepage_low_range(addr, len) \ - (((addr) > (TASK_HPAGE_BASE_32-(len))) && ((addr) < TASK_HPAGE_END_32)) -#define is_hugepage_high_range(addr, len) \ +#define touches_hugepage_low_range(addr, len) \ + (LOW_ESID_MASK((addr), (len)) & current->mm->context.htlb_segs) +#define touches_hugepage_high_range(addr, len) \ (((addr) > (TASK_HPAGE_BASE-(len))) && ((addr) < TASK_HPAGE_END)) +#define __within_hugepage_low_range(addr, len, segmask) \ + ((LOW_ESID_MASK((addr), (len)) | (segmask)) == (segmask)) +#define within_hugepage_low_range(addr, len) \ + __within_hugepage_low_range((addr), (len), \ + current->mm->context.htlb_segs) +#define within_hugepage_high_range(addr, len) (((addr) >= TASK_HPAGE_BASE) \ + && ((addr)+(len) <= TASK_HPAGE_END) && ((addr)+(len) >= (addr))) + #define is_hugepage_only_range(addr, len) \ - (is_hugepage_high_range((addr), (len)) || \ - (current->mm->context.low_hpages \ - && is_hugepage_low_range((addr), (len)))) + (touches_hugepage_high_range((addr), (len)) || \ + touches_hugepage_low_range((addr), (len))) #define hugetlb_free_pgtables free_pgtables #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA #define in_hugepage_area(context, addr) \ ((cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE) && \ - ((((addr) >= TASK_HPAGE_BASE) && ((addr) < TASK_HPAGE_END)) || \ - ((context).low_hpages && \ - (((addr) >= TASK_HPAGE_BASE_32) && ((addr) < TASK_HPAGE_END_32))))) + ( (((addr) >= TASK_HPAGE_BASE) && ((addr) < TASK_HPAGE_END)) || \ + ( ((addr) < 0x100000000L) && \ + ((1 << GET_ESID(addr)) & (context).htlb_segs) ) ) ) #else /* !CONFIG_HUGETLB_PAGE */ @@ -64,10 +74,6 @@ #endif /* !CONFIG_HUGETLB_PAGE */ -#define SID_SHIFT 28 -#define SID_MASK 0xfffffffff -#define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) - /* align addr on a size boundary - adjust address up/down if needed */ #define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1))) #define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1))) diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h index a092b9cae621..08ba3f2b89ba 100644 --- a/include/asm-ppc64/pci-bridge.h +++ b/include/asm-ppc64/pci-bridge.h @@ -2,6 +2,8 @@ #ifndef _ASM_PCI_BRIDGE_H #define _ASM_PCI_BRIDGE_H +#include <linux/pci.h> + /* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h index 9186c7d55e9d..032a2e6e8224 100644 --- a/include/asm-ppc64/pci.h +++ b/include/asm-ppc64/pci.h @@ -64,13 +64,13 @@ struct pci_dma_ops { void *vaddr, dma_addr_t dma_handle); dma_addr_t (*pci_map_single)(struct pci_dev *hwdev, void *ptr, - size_t size, int direction); + size_t size, enum dma_data_direction direction); void (*pci_unmap_single)(struct pci_dev *hwdev, dma_addr_t dma_addr, - size_t size, int direction); + size_t size, enum dma_data_direction direction); int (*pci_map_sg)(struct pci_dev *hwdev, struct scatterlist *sg, - int nents, int direction); + int nents, enum dma_data_direction direction); void (*pci_unmap_sg)(struct pci_dev *hwdev, struct scatterlist *sg, - int nents, int direction); + int nents, enum dma_data_direction direction); int (*pci_dma_supported)(struct pci_dev *hwdev, u64 mask); int (*pci_dac_dma_supported)(struct pci_dev *hwdev, u64 mask); }; @@ -92,25 +92,29 @@ static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size, static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction) { - return pci_dma_ops.pci_map_single(hwdev, ptr, size, direction); + return pci_dma_ops.pci_map_single(hwdev, ptr, size, + (enum dma_data_direction)direction); } static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int direction) { - pci_dma_ops.pci_unmap_single(hwdev, dma_addr, size, direction); + pci_dma_ops.pci_unmap_single(hwdev, dma_addr, size, + (enum dma_data_direction)direction); } static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction) { - return pci_dma_ops.pci_map_sg(hwdev, sg, nents, direction); + return pci_dma_ops.pci_map_sg(hwdev, sg, nents, + (enum dma_data_direction)direction); } static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction) { - pci_dma_ops.pci_unmap_sg(hwdev, sg, nents, direction); + pci_dma_ops.pci_unmap_sg(hwdev, sg, nents, + (enum dma_data_direction)direction); } static inline void pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, diff --git a/include/asm-ppc64/ppc32.h b/include/asm-ppc64/ppc32.h index 53865a8c4f8d..7338ea298a19 100644 --- a/include/asm-ppc64/ppc32.h +++ b/include/asm-ppc64/ppc32.h @@ -141,20 +141,6 @@ struct ucontext32 { struct mcontext32 uc_mcontext; }; -typedef struct compat_sigevent { - compat_sigval_t sigev_value; - int sigev_signo; - int sigev_notify; - union { - int _pad[SIGEV_PAD_SIZE]; - int _tid; - struct { - compat_uptr_t _function; - compat_uptr_t _attribute; - } _sigev_thread; - } _sigev_un; -} compat_sigevent_t; - struct ipc_kludge_32 { unsigned int msgp; int msgtyp; diff --git a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h index b8c7d26b947b..ea8bf67f7007 100644 --- a/include/asm-ppc64/processor.h +++ b/include/asm-ppc64/processor.h @@ -235,8 +235,6 @@ #define SPRN_IMMR 0x27E /* Internal Memory Map Register */ #define SPRN_L2CR 0x3F9 /* Level 2 Cache Control Regsiter */ #define SPRN_LR 0x008 /* Link Register */ -#define SPRN_MMCR0 0x3B8 /* Monitor Mode Control Register 0 */ -#define SPRN_MMCR1 0x3BC /* Monitor Mode Control Register 1 */ #define SPRN_PBL1 0x3FC /* Protection Bound Lower 1 */ #define SPRN_PBL2 0x3FE /* Protection Bound Lower 2 */ #define SPRN_PBU1 0x3FD /* Protection Bound Upper 1 */ @@ -244,10 +242,7 @@ #define SPRN_PID 0x3B1 /* Process ID */ #define SPRN_PIR 0x3FF /* Processor Identification Register */ #define SPRN_PIT 0x3DB /* Programmable Interval Timer */ -#define SPRN_PMC1 0x3B9 /* Performance Counter Register 1 */ -#define SPRN_PMC2 0x3BA /* Performance Counter Register 2 */ -#define SPRN_PMC3 0x3BD /* Performance Counter Register 3 */ -#define SPRN_PMC4 0x3BE /* Performance Counter Register 4 */ +#define SPRN_PURR 0x135 /* Processor Utilization of Resources Register */ #define SPRN_PVR 0x11F /* Processor Version Register */ #define SPRN_RPA 0x3D6 /* Required Physical Address Register */ #define SPRN_SDA 0x3BF /* Sampled Data Address Register */ @@ -307,17 +302,26 @@ #define WRS_SYSTEM 3 /* WDT forced system reset */ #define TSR_PIS 0x08000000 /* PIT Interrupt Status */ #define TSR_FIS 0x04000000 /* FIT Interrupt Status */ -#define SPRN_UMMCR0 0x3A8 /* User Monitor Mode Control Register 0 */ -#define SPRN_UMMCR1 0x3AC /* User Monitor Mode Control Register 0 */ -#define SPRN_UPMC1 0x3A9 /* User Performance Counter Register 1 */ -#define SPRN_UPMC2 0x3AA /* User Performance Counter Register 2 */ -#define SPRN_UPMC3 0x3AD /* User Performance Counter Register 3 */ -#define SPRN_UPMC4 0x3AE /* User Performance Counter Register 4 */ #define SPRN_USIA 0x3AB /* User Sampled Instruction Address Register */ #define SPRN_XER 0x001 /* Fixed Point Exception Register */ #define SPRN_ZPR 0x3B0 /* Zone Protection Register */ #define SPRN_VRSAVE 0x100 /* Vector save */ +/* Performance monitor SPRs */ +#define SPRN_SIAR 780 +#define SPRN_SDAR 781 +#define SPRN_MMCRA 786 +#define SPRN_PMC1 787 +#define SPRN_PMC2 788 +#define SPRN_PMC3 789 +#define SPRN_PMC4 790 +#define SPRN_PMC5 791 +#define SPRN_PMC6 792 +#define SPRN_PMC7 793 +#define SPRN_PMC8 794 +#define SPRN_MMCR0 795 +#define SPRN_MMCR1 798 + /* Short-hand versions for a number of the above SPRNs */ #define CTR SPRN_CTR /* Counter Register */ @@ -343,6 +347,7 @@ #define __LR SPRN_LR #define PVR SPRN_PVR /* Processor Version */ #define PIR SPRN_PIR /* Processor ID */ +#define PURR SPRN_PURR /* Processor Utilization of Resource Register */ #define RPA SPRN_RPA /* Required Physical Address Register */ #define SDR1 SPRN_SDR1 /* MMU hash base register */ #define SPR0 SPRN_SPRG0 /* Supervisor Private Registers */ diff --git a/include/asm-ppc64/rtas.h b/include/asm-ppc64/rtas.h index 5ce76143dce1..47232af7b278 100644 --- a/include/asm-ppc64/rtas.h +++ b/include/asm-ppc64/rtas.h @@ -169,12 +169,11 @@ extern struct rtas_t rtas; extern void enter_rtas(struct rtas_args *); extern int rtas_token(const char *service); extern long rtas_call(int token, int, int, unsigned long *, ...); -extern void phys_call_rtas(int, int, int, ...); -extern void phys_call_rtas_display_status(char); extern void call_rtas_display_status(char); extern void rtas_restart(char *cmd); extern void rtas_power_off(void); extern void rtas_halt(void); +extern void rtas_os_term(char *str); extern int rtas_get_sensor(int sensor, int index, int *state); extern int rtas_get_power_level(int powerdomain, int *level); extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); @@ -198,7 +197,7 @@ extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal); /* All the types and not flags */ #define ERR_TYPE_MASK (ERR_TYPE_RTAS_LOG | ERR_TYPE_KERNEL_PANIC) -#define RTAS_ERR KERN_ERR "RTAS: " +#define RTAS_DEBUG KERN_DEBUG "RTAS: " #define RTAS_ERROR_LOG_MAX 2048 @@ -219,6 +218,8 @@ extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal); extern spinlock_t rtas_data_buf_lock; extern char rtas_data_buf[RTAS_DATA_BUF_SIZE]; +extern void rtas_stop_self(void); + /* RMO buffer reserved for user-space RTAS use */ extern unsigned long rtas_rmo_buf; diff --git a/include/asm-ppc64/smp.h b/include/asm-ppc64/smp.h index 22fc412bcfc9..3d7e3d7c7663 100644 --- a/include/asm-ppc64/smp.h +++ b/include/asm-ppc64/smp.h @@ -67,9 +67,14 @@ extern cpumask_t cpu_available_map; #endif #define PPC_MSG_DEBUGGER_BREAK 3 +extern cpumask_t irq_affinity[]; + void smp_init_iSeries(void); void smp_init_pSeries(void); +extern int __cpu_disable(void); +extern void __cpu_die(unsigned int cpu); +extern void cpu_die(void) __attribute__((noreturn)); #endif /* !(CONFIG_SMP) */ #define get_hard_smp_processor_id(CPU) (paca[(CPU)].xHwProcNum) diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h index 9d732aa1256e..152a59acbc35 100644 --- a/include/asm-ppc64/system.h +++ b/include/asm-ppc64/system.h @@ -94,7 +94,12 @@ static inline int debugger_dabr_match(struct pt_regs *regs) { return 0; } static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; } #endif +extern int fix_alignment(struct pt_regs *regs); +extern void bad_page_fault(struct pt_regs *regs, unsigned long address, + int sig); extern void show_regs(struct pt_regs * regs); +extern int die(const char *str, struct pt_regs *regs, long err); + extern void flush_instruction_cache(void); extern int _get_PVR(void); extern void giveup_fpu(struct task_struct *); diff --git a/include/asm-ppc64/thread_info.h b/include/asm-ppc64/thread_info.h index 5b74b149f04f..297c974bf220 100644 --- a/include/asm-ppc64/thread_info.h +++ b/include/asm-ppc64/thread_info.h @@ -97,6 +97,7 @@ static inline struct thread_info *current_thread_info(void) #define TIF_32BIT 5 /* 32 bit binary */ #define TIF_RUN_LIGHT 6 /* iSeries run light */ #define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */ +#define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */ /* as above, but as bit values */ #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) @@ -107,6 +108,8 @@ static inline struct thread_info *current_thread_info(void) #define _TIF_32BIT (1<<TIF_32BIT) #define _TIF_RUN_LIGHT (1<<TIF_RUN_LIGHT) #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) +#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) +#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) #define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \ _TIF_NEED_RESCHED) diff --git a/include/asm-ppc64/vio.h b/include/asm-ppc64/vio.h index d70eeb87dfd9..1ef9a270e7f7 100644 --- a/include/asm-ppc64/vio.h +++ b/include/asm-ppc64/vio.h @@ -17,7 +17,6 @@ #include <linux/init.h> #include <linux/errno.h> #include <linux/device.h> -#include <linux/pci.h> #include <linux/dma-mapping.h> #include <asm/hvcall.h> #include <asm/prom.h> @@ -58,13 +57,13 @@ int vio_enable_interrupts(struct vio_dev *dev); int vio_disable_interrupts(struct vio_dev *dev); dma_addr_t vio_map_single(struct vio_dev *dev, void *vaddr, - size_t size, int direction); + size_t size, enum dma_data_direction direction); void vio_unmap_single(struct vio_dev *dev, dma_addr_t dma_handle, - size_t size, int direction); + size_t size, enum dma_data_direction direction); int vio_map_sg(struct vio_dev *vdev, struct scatterlist *sglist, - int nelems, int direction); + int nelems, enum dma_data_direction direction); void vio_unmap_sg(struct vio_dev *vdev, struct scatterlist *sglist, - int nelems, int direction); + int nelems, enum dma_data_direction direction); void *vio_alloc_consistent(struct vio_dev *dev, size_t size, dma_addr_t *dma_handle); void vio_free_consistent(struct vio_dev *dev, size_t size, void *vaddr, @@ -79,23 +78,10 @@ static inline int vio_dma_supported(struct vio_dev *hwdev, u64 mask) vio_map_single(dev, (page_address(page) + (off)), size, dir) #define vio_unmap_page(dev,addr,sz,dir) vio_unmap_single(dev,addr,sz,dir) - -static inline void vio_dma_sync_single(struct vio_dev *hwdev, - dma_addr_t dma_handle, - size_t size, int direction) -{ - BUG_ON(direction == PCI_DMA_NONE); - /* nothing to do */ -} - -static inline void vio_dma_sync_sg(struct vio_dev *hwdev, - struct scatterlist *sg, - int nelems, int direction) +static inline int vio_set_dma_mask(struct vio_dev *dev, u64 mask) { - BUG_ON(direction == PCI_DMA_NONE); - /* nothing to do */ + return -EIO; } -static inline int vio_set_dma_mask(struct vio_dev *dev, u64 mask) { return -EIO; } extern struct bus_type vio_bus_type; @@ -138,9 +124,4 @@ static inline struct vio_dev *to_vio_dev(struct device *dev) return container_of(dev, struct vio_dev, dev); } -static inline int vio_dma_mapping_error(dma_addr_t dma_addr) -{ - return dma_mapping_error(dma_addr); -} - #endif /* _ASM_VIO_H */ diff --git a/include/asm-s390/irq.h b/include/asm-s390/irq.h index 25f1808531cc..cac6b3080725 100644 --- a/include/asm-s390/irq.h +++ b/include/asm-s390/irq.h @@ -21,6 +21,10 @@ enum interruption_class { #define touch_nmi_watchdog() do { } while(0) +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif /* __KERNEL__ */ #endif diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h index ec34d58cf463..90308137c8e6 100644 --- a/include/asm-s390/pgalloc.h +++ b/include/asm-s390/pgalloc.h @@ -139,7 +139,10 @@ pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr) static inline struct page * pte_alloc_one(struct mm_struct *mm, unsigned long vmaddr) { - return virt_to_page(pte_alloc_one_kernel(mm, vmaddr)); + pte_t *pte = pte_alloc_one_kernel(mm, vmaddr); + if (pte) + return virt_to_page(pte); + return 0; } static inline void pte_free_kernel(pte_t *pte) diff --git a/include/asm-s390/qeth.h b/include/asm-s390/qeth.h new file mode 100644 index 000000000000..8868027f3e5c --- /dev/null +++ b/include/asm-s390/qeth.h @@ -0,0 +1,60 @@ +/* + * include/asm-s390/qeth.h + * + * ioctl definitions for qeth driver + * + * Copyright (C) 2004 IBM Corporation + * + * Author(s): Thomas Spatzier <tspat@de.ibm.com> + * + */ +#ifndef __ASM_S390_IOCTL_H__ +#define __ASM_S390_IOCTL_H__ +#include <linux/ioctl.h> + +#define QETH_IOCTL_LETTER 'Q' + +#define SIOC_QETH_ARP_SET_NO_ENTRIES _IOWR(QETH_IOCTL_LETTER, 1, int) +#define SIOC_QETH_ARP_QUERY_INFO _IOWR(QETH_IOCTL_LETTER, 2, int) +#define SIOC_QETH_ARP_ADD_ENTRY _IOWR(QETH_IOCTL_LETTER, 3, int) +#define SIOC_QETH_ARP_REMOVE_ENTRY _IOWR(QETH_IOCTL_LETTER, 4, int) +#define SIOC_QETH_ARP_FLUSH_CACHE _IOWR(QETH_IOCTL_LETTER, 5, int) +#define SIOC_QETH_ADP_SET_SNMP_CONTROL _IOWR(QETH_IOCTL_LETTER, 6, int) +#define SIOC_QETH_GET_CARD_TYPE _IOWR(QETH_IOCTL_LETTER, 7, int) + +struct qeth_arp_cache_entry { + __u8 macaddr[6]; + __u8 reserved1[2]; + __u8 ipaddr[16]; /* for both IPv4 and IPv6 */ + __u8 reserved2[32]; +} __attribute__ ((packed)); + +struct qeth_arp_qi_entry7 { + __u8 media_specific[32]; + __u8 macaddr_type; + __u8 ipaddr_type; + __u8 macaddr[6]; + __u8 ipaddr[4]; +} __attribute__((packed)); + +struct qeth_arp_qi_entry5 { + __u8 media_specific[32]; + __u8 macaddr_type; + __u8 ipaddr_type; + __u8 ipaddr[4]; +} __attribute__((packed)); + +/* data sent to user space as result of query arp ioctl */ +#define QETH_QARP_USER_DATA_SIZE 20000 +#define QETH_QARP_MASK_OFFSET 4 +#define QETH_QARP_ENTRIES_OFFSET 6 +struct qeth_arp_query_user_data { + union { + __u32 data_len; /* set by user space program */ + __u32 no_entries; /* set by kernel */ + } u; + __u16 mask_bits; + char *entries; +} __attribute__((packed)); + +#endif /* __ASM_S390_IOCTL_H__ */ diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h index 12da8b06104b..4c3b6aadbefd 100644 --- a/include/asm-s390/spinlock.h +++ b/include/asm-s390/spinlock.h @@ -70,11 +70,9 @@ extern inline void _raw_spin_lock(spinlock_t *lp) extern inline int _raw_spin_trylock(spinlock_t *lp) { -#ifndef __s390x__ - unsigned long result, reg; -#else /* __s390x__ */ - unsigned int result, reg; -#endif /* __s390x__ */ + unsigned long reg; + unsigned int result; + __asm__ __volatile(" basr %1,0\n" "0: cs %0,%1,0(%3)" : "=d" (result), "=&d" (reg), "=m" (lp->lock) @@ -226,7 +224,7 @@ extern inline int _raw_write_trylock(rwlock_t *rw) "0: csg %0,%1,0(%3)\n" #endif /* __s390x__ */ : "=d" (result), "=&d" (reg), "=m" (rw->lock) - : "a" (&rw->lock), "m" (rw->lock), "0" (0) + : "a" (&rw->lock), "m" (rw->lock), "0" (0UL) : "cc", "memory" ); return result == 0; } diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h index f470f758057a..7dd2a5ae10b5 100644 --- a/include/asm-sh/irq.h +++ b/include/asm-sh/irq.h @@ -329,4 +329,8 @@ static inline int generic_irq_demux(int irq) #define irq_canonicalize(irq) (irq) #define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq)) +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif /* __ASM_SH_IRQ_H */ diff --git a/include/asm-sh/pgalloc.h b/include/asm-sh/pgalloc.h index bd02728a69d5..4584c9e37a75 100644 --- a/include/asm-sh/pgalloc.h +++ b/include/asm-sh/pgalloc.h @@ -101,8 +101,8 @@ static inline pte_t ptep_get_and_clear(pte_t *ptep) unsigned long pfn = pte_pfn(pte); if (pfn_valid(pfn)) { page = pfn_to_page(pfn); - if (!page->mapping - || list_empty(&page->mapping->i_mmap_shared)) + if (!page_mapping(page) || + !mapping_writably_mapped(page->mapping)) __clear_bit(PG_mapped, &page->flags); } } diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h index 5423905ffb40..cee356b0dae3 100644 --- a/include/asm-sparc/irq.h +++ b/include/asm-sparc/irq.h @@ -184,4 +184,8 @@ extern struct sun4m_intregs *sun4m_interrupts; #define SUN4M_INT_SBUS(x) (1 << (x+7)) #define SUN4M_INT_VME(x) (1 << (x)) +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h index e3ba6bc2cc3e..3aef0ca67750 100644 --- a/include/asm-sparc64/irq.h +++ b/include/asm-sparc64/irq.h @@ -150,4 +150,8 @@ static __inline__ unsigned long get_softint(void) return retval; } +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif diff --git a/include/asm-sparc64/pgalloc.h b/include/asm-sparc64/pgalloc.h index 0081d1b7408e..8354a057ba88 100644 --- a/include/asm-sparc64/pgalloc.h +++ b/include/asm-sparc64/pgalloc.h @@ -189,7 +189,15 @@ static __inline__ void free_pmd_slow(pmd_t *pmd) pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE)) extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address); -#define pte_alloc_one(MM,ADDR) virt_to_page(pte_alloc_one_kernel(MM,ADDR)) + +static inline struct page * +pte_alloc_one(struct mm_struct *mm, unsigned long addr) +{ + pte_t *pte = pte_alloc_one_kernel(mm, addr); + if (pte) + return virt_to_page(pte); + return 0; +} static __inline__ pte_t *pte_alloc_one_fast(struct mm_struct *mm, unsigned long address) { diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index c41ddfc89a2b..c03b2d9d59e7 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h @@ -205,8 +205,10 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \ "ldx [%%g6 + %7], %%g4\n\t" \ "wrpr %%g0, 0x96, %%pstate\n\t" \ "andcc %%o7, %6, %%g0\n\t" \ - "bne,pn %%icc, ret_from_syscall\n\t" \ + "beq,pn %%icc, 1f\n\t" \ " mov %%g5, %0\n\t" \ + "b,a ret_from_syscall\n\t" \ + "1:\n\t" \ : "=&r" (last) \ : "0" (next->thread_info), \ "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_FLAGS), "i" (TI_CWP), \ diff --git a/include/asm-um/irq.h b/include/asm-um/irq.h index cd580acadc71..8300c209a1bc 100644 --- a/include/asm-um/irq.h +++ b/include/asm-um/irq.h @@ -32,4 +32,9 @@ extern int um_request_irq(unsigned int irq, int fd, int type, void (*handler)(int, void *, struct pt_regs *), unsigned long irqflags, const char * devname, void *dev_id); + +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif diff --git a/include/asm-v850/bitops.h b/include/asm-v850/bitops.h index 3cee89697086..c837ea08c611 100644 --- a/include/asm-v850/bitops.h +++ b/include/asm-v850/bitops.h @@ -1,8 +1,8 @@ /* * include/asm-v850/bitops.h -- Bit operations * - * Copyright (C) 2001,02,03 NEC Electronics Corporation - * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org> + * Copyright (C) 2001,02,03,04 NEC Electronics Corporation + * Copyright (C) 2001,02,03,04 Miles Bader <miles@gnu.org> * Copyright (C) 1992 Linus Torvalds. * * This file is subject to the terms and conditions of the GNU General @@ -84,24 +84,26 @@ extern __inline__ unsigned long ffz (unsigned long word) #define change_bit __change_bit -#define __const_tns_bit_op(op, nr, addr) \ - ({ int __tns_res; \ - __asm__ ("tst1 (%1 - 0x123), %2; setf nz, %0; " op " (%1 - 0x123), %2" \ - : "=&r" (__tns_res) \ - : "g" (((nr) & 0x7) + 0x123), \ - "m" (*((char *)(addr) + ((nr) >> 3))) \ - : "memory"); \ - __tns_res; \ +#define __const_tns_bit_op(op, nr, addr) \ + ({ int __tns_res; \ + __asm__ __volatile__ ( \ + "tst1 (%1 - 0x123), %2; setf nz, %0; " op " (%1 - 0x123), %2" \ + : "=&r" (__tns_res) \ + : "g" (((nr) & 0x7) + 0x123), \ + "m" (*((char *)(addr) + ((nr) >> 3))) \ + : "memory"); \ + __tns_res; \ }) -#define __var_tns_bit_op(op, nr, addr) \ - ({ int __nr = (nr); \ - int __tns_res; \ - __asm__ ("tst1 %1, [%2]; setf nz, %0; " op " %1, [%2]" \ - : "=&r" (__tns_res) \ - : "r" (__nr & 0x7), \ - "r" ((char *)(addr) + (__nr >> 3)) \ - : "memory"); \ - __tns_res; \ +#define __var_tns_bit_op(op, nr, addr) \ + ({ int __nr = (nr); \ + int __tns_res; \ + __asm__ __volatile__ ( \ + "tst1 %1, [%2]; setf nz, %0; " op " %1, [%2]" \ + : "=&r" (__tns_res) \ + : "r" (__nr & 0x7), \ + "r" ((char *)(addr) + (__nr >> 3)) \ + : "memory"); \ + __tns_res; \ }) #define __tns_bit_op(op, nr, addr) \ ((__builtin_constant_p (nr) && (unsigned)(nr) <= 0x7FFFF) \ diff --git a/include/asm-v850/dma-mapping.h b/include/asm-v850/dma-mapping.h index e7e16901f686..c63fb50ec9ef 100644 --- a/include/asm-v850/dma-mapping.h +++ b/include/asm-v850/dma-mapping.h @@ -1 +1,12 @@ +#ifndef __V850_DMA_MAPPING_H__ +#define __V850_DMA_MAPPING_H__ + +#include <linux/config.h> + +#ifdef CONFIG_PCI #include <asm-generic/dma-mapping.h> +#else +#include <asm-generic/dma-mapping-broken.h> +#endif + +#endif /* __V850_DMA_MAPPING_H__ */ diff --git a/include/asm-v850/irq.h b/include/asm-v850/irq.h index 63e682d70de1..90c83aa053c8 100644 --- a/include/asm-v850/irq.h +++ b/include/asm-v850/irq.h @@ -65,4 +65,8 @@ extern void disable_irq_nosync (unsigned int irq); #endif /* !__ASSEMBLY__ */ +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif /* __V850_IRQ_H__ */ diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h index 3a32c1452a89..8ba1d6ef13b2 100644 --- a/include/asm-x86_64/apicdef.h +++ b/include/asm-x86_64/apicdef.h @@ -370,4 +370,6 @@ struct local_apic { #undef u32 +#define BAD_APICID 0xFFu + #endif diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h index bb086405d2d4..5ce5dcef4f35 100644 --- a/include/asm-x86_64/bitops.h +++ b/include/asm-x86_64/bitops.h @@ -204,7 +204,7 @@ static __inline__ int __test_and_change_bit(int nr, volatile void * addr) } /** - * test_and_change_bit - Change a bit and return its new value + * test_and_change_bit - Change a bit and return its old value * @nr: Bit to change * @addr: Address to count from * diff --git a/include/asm-x86_64/bootsetup.h b/include/asm-x86_64/bootsetup.h index b4644415575a..ee1557748b0e 100644 --- a/include/asm-x86_64/bootsetup.h +++ b/include/asm-x86_64/bootsetup.h @@ -26,6 +26,9 @@ extern char x86_boot_params[2048]; #define INITRD_START (*(unsigned int *) (PARAM+0x218)) #define INITRD_SIZE (*(unsigned int *) (PARAM+0x21c)) #define EDID_INFO (*(struct edid_info *) (PARAM+0x440)) +#define DISK80_SIGNATURE (*(unsigned int*) (PARAM+DISK80_SIG_BUFFER)) +#define EDD_NR (*(unsigned char *) (PARAM+EDDNR)) +#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF)) #define COMMAND_LINE saved_command_line #define COMMAND_LINE_SIZE 256 diff --git a/include/asm-x86_64/irq.h b/include/asm-x86_64/irq.h index ad5445ee7460..37c9fd65c97f 100644 --- a/include/asm-x86_64/irq.h +++ b/include/asm-x86_64/irq.h @@ -53,4 +53,8 @@ extern int can_request_irq(unsigned int, unsigned long flags); #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ #endif +struct irqaction; +struct pt_regs; +int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); + #endif /* _ASM_IRQ_H */ diff --git a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h index 896b99f11cec..cbe6058e9270 100644 --- a/include/asm-x86_64/mpspec.h +++ b/include/asm-x86_64/mpspec.h @@ -211,7 +211,7 @@ typedef struct physid_mask physid_mask_t; #define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS) #define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS) -#define physids_clear(map) bitmap_clear((map).mask, MAX_APICS) +#define physids_clear(map) bitmap_zero((map).mask, MAX_APICS) #define physids_complement(map) bitmap_complement((map).mask, MAX_APICS) #define physids_empty(map) bitmap_empty((map).mask, MAX_APICS) #define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS) diff --git a/include/asm-x86_64/msi.h b/include/asm-x86_64/msi.h new file mode 100644 index 000000000000..727b911f29ca --- /dev/null +++ b/include/asm-x86_64/msi.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2003-2004 Intel + * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) + */ + +#ifndef ASM_MSI_H +#define ASM_MSI_H + +#include <asm/desc.h> + +#define LAST_DEVICE_VECTOR 232 +#define MSI_DEST_MODE MSI_LOGICAL_MODE +#define MSI_TARGET_CPU_SHIFT 12 + +#ifdef CONFIG_SMP +#define MSI_TARGET_CPU logical_smp_processor_id() +#else +#define MSI_TARGET_CPU TARGET_CPUS +#endif + +#endif /* ASM_MSI_H */ diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h index 3e40884b0b19..ac9e9581d0a3 100644 --- a/include/asm-x86_64/pci.h +++ b/include/asm-x86_64/pci.h @@ -357,8 +357,9 @@ static inline void pcibios_add_platform_entries(struct pci_dev *dev) #endif /* __KERNEL__ */ /* generic pci stuff */ +#ifdef CONFIG_PCI #include <asm-generic/pci.h> - #include <linux/dma-mapping.h> +#endif #endif /* __x8664_PCI_H */ diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index 14bab87d299b..a0ecd64a6a89 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h @@ -59,6 +59,7 @@ struct cpuinfo_x86 { char x86_model_id[64]; int x86_cache_size; /* in KB */ int x86_clflush_size; + int x86_cache_alignment; int x86_tlbsize; /* number of 4K pages in DTLB/ITLB combined(in pages)*/ __u8 x86_virt_bits, x86_phys_bits; __u32 x86_power; @@ -453,6 +454,6 @@ static inline void __mwait(unsigned long eax, unsigned long ecx) ti->task; \ }) -#define cache_line_size() (boot_cpu_data.x86_clflush_size) +#define cache_line_size() (boot_cpu_data.x86_cache_alignment) #endif /* __ASM_X86_64_PROCESSOR_H */ diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h index 693f1a022314..5b0c38182172 100644 --- a/include/asm-x86_64/proto.h +++ b/include/asm-x86_64/proto.h @@ -101,6 +101,8 @@ extern int acpi_disabled; extern int fallback_aper_order; extern int fallback_aper_force; extern int iommu_aperture; +extern int iommu_aperture_disabled; +extern int iommu_aperture_allowed; extern void smp_local_timer_interrupt(struct pt_regs * regs); diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h index 97a19c35864f..e82b6a9884fb 100644 --- a/include/asm-x86_64/smp.h +++ b/include/asm-x86_64/smp.h @@ -80,10 +80,30 @@ extern __inline int hard_smp_processor_id(void) * the real APIC ID <-> CPU # mapping. * AK: why is this volatile? */ -extern volatile char x86_apicid_to_cpu[NR_CPUS]; extern volatile char x86_cpu_to_apicid[NR_CPUS]; -#define safe_smp_processor_id() (disable_apic ? 0 : x86_apicid_to_cpu[hard_smp_processor_id()]) +static inline char x86_apicid_to_cpu(char apicid) +{ + int i; + + for (i = 0; i < NR_CPUS; ++i) + if (x86_cpu_to_apicid[i] == apicid) + return i; + + return -1; +} + +#define safe_smp_processor_id() (disable_apic ? 0 : x86_apicid_to_cpu(hard_smp_processor_id())) + +extern u8 bios_cpu_apicid[]; + +static inline int cpu_present_to_apicid(int mps_cpu) +{ + if (mps_cpu < NR_CPUS) + return (int)bios_cpu_apicid[mps_cpu]; + else + return BAD_APICID; +} #define cpu_online(cpu) cpu_isset(cpu, cpu_online_map) #endif /* !ASSEMBLY */ diff --git a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h index 0145da994590..73e4fa13ed0c 100644 --- a/include/asm-x86_64/thread_info.h +++ b/include/asm-x86_64/thread_info.h @@ -101,6 +101,7 @@ static inline struct thread_info *stack_thread_info(void) #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ #define TIF_SINGLESTEP 4 /* reenable singlestep on user return*/ #define TIF_IRET 5 /* force IRET */ +#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ #define TIF_IA32 17 /* 32bit process */ #define TIF_FORK 18 /* ret_from_fork */ @@ -112,13 +113,15 @@ static inline struct thread_info *stack_thread_info(void) #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) #define _TIF_IRET (1<<TIF_IRET) +#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) #define _TIF_IA32 (1<<TIF_IA32) #define _TIF_FORK (1<<TIF_FORK) #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) /* work to do on interrupt/exception return */ -#define _TIF_WORK_MASK (0x0000FFFF & ~(_TIF_SYSCALL_TRACE|_TIF_SINGLESTEP)) +#define _TIF_WORK_MASK \ + (0x0000FFFF & ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP)) /* work to do on any return to user space */ #define _TIF_ALLWORK_MASK 0x0000FFFF diff --git a/include/asm-x86_64/types.h b/include/asm-x86_64/types.h index b7c4d2fb9509..c86c2e6793e2 100644 --- a/include/asm-x86_64/types.h +++ b/include/asm-x86_64/types.h @@ -33,8 +33,6 @@ typedef unsigned long long __u64; #ifndef __ASSEMBLY__ -#include <linux/config.h> - typedef signed char s8; typedef unsigned char u8; @@ -50,10 +48,8 @@ typedef unsigned long long u64; typedef u64 dma64_addr_t; typedef u64 dma_addr_t; -#ifdef CONFIG_LBD typedef u64 sector_t; #define HAVE_SECTOR_T -#endif #endif /* __ASSEMBLY__ */ diff --git a/include/linux/audit.h b/include/linux/audit.h new file mode 100644 index 000000000000..d766482451af --- /dev/null +++ b/include/linux/audit.h @@ -0,0 +1,211 @@ +/* audit.h -- Auditing support -*- linux-c -*- + * + * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. + * All Rights Reserved. + * + * 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 + * + * Written by Rickard E. (Rik) Faith <faith@redhat.com> + * + */ + +#ifndef _LINUX_AUDIT_H_ +#define _LINUX_AUDIT_H_ + +/* Request and reply types */ +#define AUDIT_GET 1000 /* Get status */ +#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ +#define AUDIT_LIST 1002 /* List filtering rules */ +#define AUDIT_ADD 1003 /* Add filtering rule */ +#define AUDIT_DEL 1004 /* Delete filtering rule */ +#define AUDIT_USER 1005 /* Send a message from user-space */ +#define AUDIT_LOGIN 1006 /* Define the login id and informaiton */ +#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ + +/* Rule flags */ +#define AUDIT_PER_TASK 0x01 /* Apply rule at task creation (not syscall) */ +#define AUDIT_AT_ENTRY 0x02 /* Apply rule at syscall entry */ +#define AUDIT_AT_EXIT 0x04 /* Apply rule at syscall exit */ +#define AUDIT_PREPEND 0x10 /* Prepend to front of list */ + +/* Rule actions */ +#define AUDIT_NEVER 0 /* Do not build context if rule matches */ +#define AUDIT_POSSIBLE 1 /* Build context if rule matches */ +#define AUDIT_ALWAYS 2 /* Generate audit record if rule matches */ + +/* Rule structure sizes -- if these change, different AUDIT_ADD and + * AUDIT_LIST commands must be implemented. */ +#define AUDIT_MAX_FIELDS 64 +#define AUDIT_BITMASK_SIZE 64 +#define AUDIT_WORD(nr) ((__u32)((nr)/32)) +#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) + +/* Rule fields */ + /* These are useful when checking the + * task structure at task creation time + * (AUDIT_PER_TASK). */ +#define AUDIT_PID 0 +#define AUDIT_UID 1 +#define AUDIT_EUID 2 +#define AUDIT_SUID 3 +#define AUDIT_FSUID 4 +#define AUDIT_GID 5 +#define AUDIT_EGID 6 +#define AUDIT_SGID 7 +#define AUDIT_FSGID 8 +#define AUDIT_LOGINUID 9 +#define AUDIT_PERS 10 + + /* These are ONLY useful when checking + * at syscall exit time (AUDIT_AT_EXIT). */ +#define AUDIT_DEVMAJOR 100 +#define AUDIT_DEVMINOR 101 +#define AUDIT_INODE 102 +#define AUDIT_EXIT 103 +#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */ + +#define AUDIT_ARG0 200 +#define AUDIT_ARG1 (AUDIT_ARG0+1) +#define AUDIT_ARG2 (AUDIT_ARG0+2) +#define AUDIT_ARG3 (AUDIT_ARG0+3) + +#define AUDIT_NEGATE 0x80000000 + + +/* Status symbols */ + /* Mask values */ +#define AUDIT_STATUS_ENABLED 0x0001 +#define AUDIT_STATUS_FAILURE 0x0002 +#define AUDIT_STATUS_PID 0x0004 +#define AUDIT_STATUS_RATE_LIMIT 0x0008 +#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010 + /* Failure-to-log actions */ +#define AUDIT_FAIL_SILENT 0 +#define AUDIT_FAIL_PRINTK 1 +#define AUDIT_FAIL_PANIC 2 + +#ifndef __KERNEL__ +struct audit_message { + struct nlmsghdr nlh; + char data[1200]; +}; +#endif + +struct audit_status { + __u32 mask; /* Bit mask for valid entries */ + __u32 enabled; /* 1 = enabled, 0 = disbaled */ + __u32 failure; /* Failure-to-log action */ + __u32 pid; /* pid of auditd process */ + __u32 rate_limit; /* messages rate limit (per second) */ + __u32 backlog_limit; /* waiting messages limit */ + __u32 lost; /* messages lost */ + __u32 backlog; /* messages waiting in queue */ +}; + +struct audit_login { + __u32 loginuid; + int msglen; + char msg[1024]; +}; + +struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */ + __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */ + __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */ + __u32 field_count; + __u32 mask[AUDIT_BITMASK_SIZE]; + __u32 fields[AUDIT_MAX_FIELDS]; + __u32 values[AUDIT_MAX_FIELDS]; +}; + +#ifdef __KERNEL__ + +#ifdef CONFIG_AUDIT +struct audit_buffer; +struct audit_context; +#endif + +#ifdef CONFIG_AUDITSYSCALL +/* These are defined in auditsc.c */ + /* Public API */ +extern int audit_alloc(struct task_struct *task); +extern void audit_free(struct task_struct *task); +extern void audit_syscall_entry(struct task_struct *task, + int major, unsigned long a0, unsigned long a1, + unsigned long a2, unsigned long a3); +extern void audit_syscall_exit(struct task_struct *task, int return_code); +extern void audit_getname(const char *name); +extern void audit_putname(const char *name); +extern void audit_inode(const char *name, unsigned long ino, dev_t rdev); + + /* Private API (for audit.c only) */ +extern int audit_receive_filter(int type, int pid, int uid, int seq, + void *data); +extern void audit_get_stamp(struct audit_context *ctx, + struct timespec *t, int *serial); +extern int audit_set_loginuid(struct audit_context *ctx, uid_t loginuid); +#else +#define audit_alloc(t) ({ 0; }) +#define audit_free(t) do { ; } while (0) +#define audit_syscall_entry(t,a,b,c,d,e) do { ; } while (0) +#define audit_syscall_exit(t,r) do { ; } while (0) +#define audit_getname(n) do { ; } while (0) +#define audit_putname(n) do { ; } while (0) +#define audit_inode(n,i,d) do { ; } while (0) +#endif + +#ifdef CONFIG_AUDIT +/* These are defined in audit.c */ + /* Public API */ +extern void audit_log(struct audit_context *ctx, + const char *fmt, ...) + __attribute__((format(printf,2,3))); + +extern struct audit_buffer *audit_log_start(struct audit_context *ctx); +extern void audit_log_format(struct audit_buffer *ab, + const char *fmt, ...) + __attribute__((format(printf,2,3))); +extern void audit_log_end(struct audit_buffer *ab); +extern void audit_log_end_fast(struct audit_buffer *ab); +extern void audit_log_end_irq(struct audit_buffer *ab); +extern void audit_log_d_path(struct audit_buffer *ab, + const char *prefix, + struct dentry *dentry, + struct vfsmount *vfsmnt); +extern int audit_set_rate_limit(int limit); +extern int audit_set_backlog_limit(int limit); +extern int audit_set_enabled(int state); +extern int audit_set_failure(int state); + + /* Private API (for auditsc.c only) */ +extern void audit_send_reply(int pid, int seq, int type, + int done, int multi, + void *payload, int size); +extern void audit_log_lost(const char *message); +#else +#define audit_log(t,f,...) do { ; } while (0) +#define audit_log_start(t) ({ NULL; }) +#define audit_log_vformat(b,f,a) do { ; } while (0) +#define audit_log_format(b,f,...) do { ; } while (0) +#define audit_log_end(b) do { ; } while (0) +#define audit_log_end_fast(b) do { ; } while (0) +#define audit_log_end_irq(b) do { ; } while (0) +#define audit_log_d_path(b,p,d,v) do { ; } while (0) +#define audit_set_rate_limit(l) do { ; } while (0) +#define audit_set_backlog_limit(l) do { ; } while (0) +#define audit_set_enabled(s) do { ; } while (0) +#define audit_set_failure(s) do { ; } while (0) +#endif +#endif +#endif diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 94c93c9c5f66..00371734995c 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -20,26 +20,46 @@ enum bdi_state { BDI_unused, /* Available bits start here */ }; +typedef int (congested_fn)(void *, int); + struct backing_dev_info { unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ unsigned long state; /* Always use atomic bitops on this */ int memory_backed; /* Cannot clean pages with writepage */ + congested_fn *congested_fn; /* Function pointer if device is md/dm */ + void *congested_data; /* Pointer to aux data for congested func */ + void (*unplug_io_fn)(struct backing_dev_info *); + void *unplug_io_data; }; extern struct backing_dev_info default_backing_dev_info; +void default_unplug_io_fn(struct backing_dev_info *bdi); int writeback_acquire(struct backing_dev_info *bdi); int writeback_in_progress(struct backing_dev_info *bdi); void writeback_release(struct backing_dev_info *bdi); +static inline int bdi_congested(struct backing_dev_info *bdi, int bdi_bits) +{ + if (bdi->congested_fn) + return bdi->congested_fn(bdi->congested_data, bdi_bits); + return (bdi->state & bdi_bits); +} + static inline int bdi_read_congested(struct backing_dev_info *bdi) { - return test_bit(BDI_read_congested, &bdi->state); + return bdi_congested(bdi, 1 << BDI_read_congested); } static inline int bdi_write_congested(struct backing_dev_info *bdi) { - return test_bit(BDI_write_congested, &bdi->state); + return bdi_congested(bdi, 1 << BDI_write_congested); +} + +static inline int bdi_rw_congested(struct backing_dev_info *bdi) +{ + return bdi_congested(bdi, (1 << BDI_read_congested)| + (1 << BDI_write_congested)); } #endif /* _LINUX_BACKING_DEV_H */ diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 3d9a86eff6ab..60726b29603c 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -58,7 +58,13 @@ extern int prepare_binprm(struct linux_binprm *); extern void remove_arg_zero(struct linux_binprm *); extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); extern int flush_old_exec(struct linux_binprm * bprm); -extern int setup_arg_pages(struct linux_binprm * bprm); + +/* Stack area protections */ +#define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */ +#define EXSTACK_DISABLE_X 1 /* Disable executable stacks */ +#define EXSTACK_ENABLE_X 2 /* Enable executable stacks */ + +extern int setup_arg_pages(struct linux_binprm * bprm, int executable_stack); extern int copy_strings(int argc,char __user * __user * argv,struct linux_binprm *bprm); extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); extern void compute_creds(struct linux_binprm *binprm); diff --git a/include/linux/bio.h b/include/linux/bio.h index c421c46bfbb2..c4dd287dd1c8 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -119,11 +119,13 @@ struct bio { * bit 1 -- rw-ahead when set * bit 2 -- barrier * bit 3 -- fail fast, don't want low level driver retries + * bit 4 -- synchronous I/O hint: the block layer will unplug immediately */ #define BIO_RW 0 #define BIO_RW_AHEAD 1 #define BIO_RW_BARRIER 2 #define BIO_RW_FAILFAST 3 +#define BIO_RW_SYNC 4 /* * various member access, note that bio_data should of course not be used @@ -138,6 +140,7 @@ struct bio { #define bio_cur_sectors(bio) (bio_iovec(bio)->bv_len >> 9) #define bio_data(bio) (page_address(bio_page((bio))) + bio_offset((bio))) #define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) +#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) /* * will die diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 2ad5fb97fa26..81e73cdc1a62 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h @@ -16,9 +16,9 @@ int bitmap_equal(const unsigned long *bitmap1, unsigned long *bitmap2, int bits); void bitmap_complement(unsigned long *bitmap, int bits); -static inline void bitmap_clear(unsigned long *bitmap, int bits) +static inline void bitmap_zero(unsigned long *bitmap, int bits) { - CLEAR_BITMAP((unsigned long *)bitmap, bits); + memset(bitmap, 0, BITS_TO_LONGS(bits)*sizeof(unsigned long)); } static inline void bitmap_fill(unsigned long *bitmap, int bits) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 1a521e16b398..44c722d4b67b 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -243,7 +243,7 @@ typedef int (merge_requests_fn) (request_queue_t *, struct request *, typedef void (request_fn_proc) (request_queue_t *q); typedef int (make_request_fn) (request_queue_t *q, struct bio *bio); typedef int (prep_rq_fn) (request_queue_t *, struct request *); -typedef void (unplug_fn) (void *q); +typedef void (unplug_fn) (request_queue_t *); struct bio_vec; typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *); @@ -315,8 +315,6 @@ struct request_queue unsigned long bounce_pfn; int bounce_gfp; - struct list_head plug_list; - /* * various queue flags, see QUEUE_* below */ @@ -350,6 +348,8 @@ struct request_queue atomic_t refcnt; + unsigned int in_flight; + /* * sg stuff */ @@ -370,14 +370,18 @@ struct request_queue #define QUEUE_FLAG_WRITEFULL 4 /* read queue has been filled */ #define QUEUE_FLAG_DEAD 5 /* queue being torn down */ #define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ +#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ -#define blk_queue_plugged(q) !list_empty(&(q)->plug_list) +#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) #define blk_fs_request(rq) ((rq)->flags & REQ_CMD) #define blk_pc_request(rq) ((rq)->flags & REQ_BLOCK_PC) #define blk_noretry_request(rq) ((rq)->flags & REQ_FAILFAST) +#define blk_rq_started(rq) ((rq)->flags & REQ_STARTED) + +#define blk_account_rq(rq) (blk_rq_started(rq) && blk_fs_request(rq)) #define blk_pm_suspend_request(rq) ((rq)->flags & REQ_PM_SUSPEND) #define blk_pm_resume_request(rq) ((rq)->flags & REQ_PM_RESUME) @@ -515,7 +519,7 @@ extern int scsi_cmd_ioctl(struct gendisk *, unsigned int, unsigned long); extern void blk_start_queue(request_queue_t *q); extern void blk_stop_queue(request_queue_t *q); extern void __blk_stop_queue(request_queue_t *q); -extern void blk_run_queue(request_queue_t *q); +extern void blk_run_queue(request_queue_t *); extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *); extern struct request *blk_rq_map_user(request_queue_t *, int, void __user *, unsigned int); extern int blk_rq_unmap_user(struct request *, void __user *, unsigned int); @@ -526,6 +530,18 @@ static inline request_queue_t *bdev_get_queue(struct block_device *bdev) return bdev->bd_disk->queue; } +static inline void blk_run_backing_dev(struct backing_dev_info *bdi) +{ + if (bdi && bdi->unplug_io_fn) + bdi->unplug_io_fn(bdi); +} + +static inline void blk_run_address_space(struct address_space *mapping) +{ + if (mapping) + blk_run_backing_dev(mapping->backing_dev_info); +} + /* * end_request() and friends. Must be called with the request queue spinlock * acquired. All functions called within end_request() _must_be_ atomic. @@ -572,7 +588,7 @@ extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bd extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *); extern void blk_dump_rq_flags(struct request *, char *); -extern void generic_unplug_device(void *); +extern void generic_unplug_device(request_queue_t *); extern long nr_blockdev_pages(void); int blk_get_queue(request_queue_t *); diff --git a/include/linux/compat.h b/include/linux/compat.h index 7b82209ab4ab..796204f59bd9 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -13,6 +13,7 @@ #include <linux/sem.h> #include <asm/compat.h> +#include <asm/siginfo.h> #define compat_jiffies_to_clock_t(x) \ (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) @@ -90,6 +91,22 @@ typedef union compat_sigval { compat_uptr_t sival_ptr; } compat_sigval_t; +typedef struct compat_sigevent { + compat_sigval_t sigev_value; + compat_int_t sigev_signo; + compat_int_t sigev_notify; + union { + compat_int_t _pad[SIGEV_PAD_SIZE]; + compat_int_t _tid; + + struct { + compat_uptr_t _function; + compat_uptr_t _attribute; + } _sigev_thread; + } _sigev_un; +} compat_sigevent_t; + + long compat_sys_semctl(int first, int second, int third, void __user *uptr); long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); long compat_sys_msgrcv(int first, int second, int msgtyp, int third, diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h index c472cac3029d..265dad4c3cb4 100644 --- a/include/linux/compiler-gcc3.h +++ b/include/linux/compiler-gcc3.h @@ -3,7 +3,7 @@ /* These definitions are for GCC v3.x. */ #include <linux/compiler-gcc.h> -#if __GNUC_MINOR__ >= 1 +#if __GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 4 # define inline __inline__ __attribute__((always_inline)) # define __inline__ __inline__ __attribute__((always_inline)) # define __inline __inline__ __attribute__((always_inline)) diff --git a/include/linux/devfs_fs.h b/include/linux/devfs_fs.h index 48da59012021..de236f431877 100644 --- a/include/linux/devfs_fs.h +++ b/include/linux/devfs_fs.h @@ -22,22 +22,20 @@ #define DEVFSD_NOTIFY_CREATE 6 #define DEVFSD_NOTIFY_DELETE 7 -#define DEVFS_PATHLEN 1024 /* Never change this otherwise the - binary interface will change */ - -struct devfsd_notify_struct -{ /* Use native C types to ensure same types in kernel and user space */ - unsigned int type; /* DEVFSD_NOTIFY_* value */ - unsigned int mode; /* Mode of the inode or device entry */ - unsigned int major; /* Major number of device entry */ - unsigned int minor; /* Minor number of device entry */ - unsigned int uid; /* Uid of process, inode or device entry */ - unsigned int gid; /* Gid of process, inode or device entry */ - unsigned int overrun_count; /* Number of lost events */ - unsigned int namelen; /* Number of characters not including '\0' */ - /* The device name MUST come last */ - char devname[DEVFS_PATHLEN]; /* This will be '\0' terminated */ +#define DEVFS_PATHLEN 1024 /* Never change this otherwise the + binary interface will change */ + +struct devfsd_notify_struct { /* Use native C types to ensure same types in kernel and user space */ + unsigned int type; /* DEVFSD_NOTIFY_* value */ + unsigned int mode; /* Mode of the inode or device entry */ + unsigned int major; /* Major number of device entry */ + unsigned int minor; /* Minor number of device entry */ + unsigned int uid; /* Uid of process, inode or device entry */ + unsigned int gid; /* Gid of process, inode or device entry */ + unsigned int overrun_count; /* Number of lost events */ + unsigned int namelen; /* Number of characters not including '\0' */ + /* The device name MUST come last */ + char devname[DEVFS_PATHLEN]; /* This will be '\0' terminated */ }; - -#endif /* _LINUX_DEVFS_FS_H */ +#endif /* _LINUX_DEVFS_FS_H */ diff --git a/include/linux/devfs_fs_kernel.h b/include/linux/devfs_fs_kernel.h index 16c78f54f427..89810e73d256 100644 --- a/include/linux/devfs_fs_kernel.h +++ b/include/linux/devfs_fs_kernel.h @@ -12,18 +12,18 @@ #ifdef CONFIG_DEVFS_FS extern int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...) - __attribute__((format (printf, 3, 4))); + __attribute__ ((format(printf, 3, 4))); extern int devfs_mk_cdev(dev_t dev, umode_t mode, const char *fmt, ...) - __attribute__((format (printf, 3, 4))); + __attribute__ ((format(printf, 3, 4))); extern int devfs_mk_symlink(const char *name, const char *link); extern int devfs_mk_dir(const char *fmt, ...) - __attribute__((format (printf, 1, 2))); + __attribute__ ((format(printf, 1, 2))); extern void devfs_remove(const char *fmt, ...) - __attribute__((format (printf, 1, 2))); + __attribute__ ((format(printf, 1, 2))); extern int devfs_register_tape(const char *name); extern void devfs_unregister_tape(int num); extern void mount_devfs_fs(void); -#else /* CONFIG_DEVFS_FS */ +#else /* CONFIG_DEVFS_FS */ static inline int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...) { return 0; @@ -32,9 +32,9 @@ static inline int devfs_mk_cdev(dev_t dev, umode_t mode, const char *fmt, ...) { return 0; } -static inline int devfs_mk_symlink (const char *name, const char *link) +static inline int devfs_mk_symlink(const char *name, const char *link) { - return 0; + return 0; } static inline int devfs_mk_dir(const char *fmt, ...) { @@ -43,16 +43,16 @@ static inline int devfs_mk_dir(const char *fmt, ...) static inline void devfs_remove(const char *fmt, ...) { } -static inline int devfs_register_tape (const char *name) +static inline int devfs_register_tape(const char *name) { - return -1; + return -1; } static inline void devfs_unregister_tape(int num) { } -static inline void mount_devfs_fs (void) +static inline void mount_devfs_fs(void) { - return; + return; } -#endif /* CONFIG_DEVFS_FS */ -#endif /* _LINUX_DEVFS_FS_KERNEL_H */ +#endif /* CONFIG_DEVFS_FS */ +#endif /* _LINUX_DEVFS_FS_KERNEL_H */ diff --git a/include/linux/device.h b/include/linux/device.h index 28e101a77070..9bc07b556eea 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -17,7 +17,6 @@ #include <linux/list.h> #include <linux/spinlock.h> #include <linux/types.h> -#include <linux/ioport.h> #include <linux/module.h> #include <linux/pm.h> #include <asm/semaphore.h> diff --git a/include/linux/elevator.h b/include/linux/elevator.h index ce58f47126c1..27e8183f4776 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h @@ -94,6 +94,11 @@ extern elevator_t iosched_deadline; */ extern elevator_t iosched_as; +/* + * completely fair queueing I/O scheduler + */ +extern elevator_t iosched_cfq; + extern int elevator_init(request_queue_t *, elevator_t *); extern void elevator_exit(request_queue_t *); extern int elv_rq_merge_ok(struct request *, struct bio *); diff --git a/include/linux/elf.h b/include/linux/elf.h index 2f8005729fb6..7f21bfaa2e71 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h @@ -35,6 +35,8 @@ typedef __s64 Elf64_Sxword; #define PT_HIPROC 0x7fffffff #define PT_GNU_EH_FRAME 0x6474e550 +#define PT_GNU_STACK (PT_LOOS + 0x474e551) + /* These constants define the different elf file types */ #define ET_NONE 0 #define ET_REL 1 diff --git a/include/linux/fd.h b/include/linux/fd.h index 187785b83958..cbbd0f876585 100644 --- a/include/linux/fd.h +++ b/include/linux/fd.h @@ -17,6 +17,7 @@ struct floppy_struct { stretch; /* !=0 means double track steps */ #define FD_STRETCH 1 #define FD_SWAPSIDES 2 +#define FD_ZEROBASED 4 unsigned char gap, /* gap1 size */ diff --git a/include/linux/fs.h b/include/linux/fs.h index e47f6360f74c..3d7c320d675e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -20,6 +20,7 @@ #include <linux/radix-tree.h> #include <linux/kobject.h> #include <asm/atomic.h> +#include <linux/audit.h> struct iovec; struct nameidata; @@ -82,6 +83,8 @@ extern int leases_enable, dir_notify_enable, lease_break_time; #define WRITE 1 #define READA 2 /* read-ahead - don't block if no resources */ #define SPECIAL 4 /* For non-blockdevice requests in request queue */ +#define READ_SYNC (READ | (1 << BIO_RW_SYNC)) +#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) #define SEL_IN 1 #define SEL_OUT 2 @@ -322,12 +325,9 @@ struct backing_dev_info; struct address_space { struct inode *host; /* owner: inode, block_device */ struct radix_tree_root page_tree; /* radix tree of all pages */ - spinlock_t page_lock; /* and spinlock protecting it */ - struct list_head clean_pages; /* list of clean pages */ - struct list_head dirty_pages; /* list of dirty pages */ - struct list_head locked_pages; /* list of locked pages */ - struct list_head io_pages; /* being prepared for I/O */ + spinlock_t tree_lock; /* and spinlock protecting it */ unsigned long nrpages; /* number of total pages */ + pgoff_t writeback_index;/* writeback starts here */ struct address_space_operations *a_ops; /* methods */ struct list_head i_mmap; /* list of private mappings */ struct list_head i_mmap_shared; /* list of shared mappings */ @@ -365,6 +365,35 @@ struct block_device { }; /* + * Radix-tre tags, for tagging dirty and writeback pages within the pagecache + * radix trees + */ +#define PAGECACHE_TAG_DIRTY 0 +#define PAGECACHE_TAG_WRITEBACK 1 + +int mapping_tagged(struct address_space *mapping, int tag); + +/* + * Might pages of this file be mapped into userspace? + */ +static inline int mapping_mapped(struct address_space *mapping) +{ + return !list_empty(&mapping->i_mmap) || + !list_empty(&mapping->i_mmap_shared); +} + +/* + * Might pages of this file have been modified in userspace? + * Note that i_mmap_shared holds all the VM_SHARED vmas: do_mmap_pgoff + * marks vma as VM_SHARED if it is shared, and the file was opened for + * writing i.e. vma may be mprotected writable even if now readonly. + */ +static inline int mapping_writably_mapped(struct address_space *mapping) +{ + return !list_empty(&mapping->i_mmap_shared); +} + +/* * Use sequence counter to get consistent i_size on 32-bit processors. */ #if BITS_PER_LONG==32 && defined(CONFIG_SMP) @@ -397,13 +426,16 @@ struct inode { unsigned short i_bytes; spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ struct semaphore i_sem; + struct rw_semaphore i_alloc_sem; struct inode_operations *i_op; struct file_operations *i_fop; /* former ->i_op->default_file_ops */ struct super_block *i_sb; struct file_lock *i_flock; struct address_space *i_mapping; struct address_space i_data; +#ifdef CONFIG_QUOTA struct dquot *i_dquot[MAXQUOTAS]; +#endif /* These three should probably be a union */ struct list_head i_devices; struct pipe_inode_info *i_pipe; @@ -621,6 +653,9 @@ extern struct list_head file_lock_list; #include <linux/fcntl.h> +extern long generic_file_fcntl(int fd, unsigned int cmd, + unsigned long arg, struct file *filp); + extern int fcntl_getlk(struct file *, struct flock __user *); extern int fcntl_setlk(struct file *, unsigned int, struct flock __user *); @@ -830,6 +865,8 @@ struct file_operations { ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void __user *); ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); + long (*fcntl)(int fd, unsigned int cmd, + unsigned long arg, struct file *filp); }; struct inode_operations { @@ -925,6 +962,7 @@ static inline void file_accessed(struct file *file) touch_atime(file->f_vfsmnt, file->f_dentry); } +int sync_inode(struct inode *inode, struct writeback_control *wbc); /** * &export_operations - for nfsd to communicate with file systems @@ -1144,7 +1182,18 @@ extern char * getname(const char __user *); extern void vfs_caches_init(unsigned long); #define __getname() kmem_cache_alloc(names_cachep, SLAB_KERNEL) -#define putname(name) kmem_cache_free(names_cachep, (void *)(name)) +#define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) +#ifndef CONFIG_AUDITSYSCALL +#define putname(name) __putname(name) +#else +#define putname(name) \ + do { \ + if (unlikely(current->audit_context)) \ + audit_putname(name); \ + else \ + __putname(name); \ + } while (0) +#endif extern int register_blkdev(unsigned int, const char *); extern int unregister_blkdev(unsigned int, const char *); @@ -1227,6 +1276,7 @@ extern void write_inode_now(struct inode *, int); extern int filemap_fdatawrite(struct address_space *); extern int filemap_flush(struct address_space *); extern int filemap_fdatawait(struct address_space *); +extern int filemap_write_and_wait(struct address_space *mapping); extern void sync_supers(void); extern void sync_filesystems(int wait); extern void emergency_sync(void); @@ -1339,9 +1389,6 @@ extern void file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); extern ssize_t generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs); -extern int blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, - struct block_device *bdev, const struct iovec *iov, loff_t offset, - unsigned long nr_segs, get_blocks_t *get_blocks, dio_iodone_t *end_io); extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov, unsigned long nr_segs, loff_t *ppos); ssize_t generic_file_writev(struct file *filp, const struct iovec *iov, @@ -1363,6 +1410,32 @@ static inline void do_generic_file_read(struct file * filp, loff_t *ppos, actor); } +int __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, + struct block_device *bdev, const struct iovec *iov, loff_t offset, + unsigned long nr_segs, get_blocks_t get_blocks, dio_iodone_t end_io, + int needs_special_locking); + +/* + * For filesystems which need locking between buffered and direct access + */ +static inline int blockdev_direct_IO(int rw, struct kiocb *iocb, + struct inode *inode, struct block_device *bdev, const struct iovec *iov, + loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, + dio_iodone_t end_io) +{ + return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, + nr_segs, get_blocks, end_io, 1); +} + +static inline int blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, + struct inode *inode, struct block_device *bdev, const struct iovec *iov, + loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, + dio_iodone_t end_io) +{ + return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, + nr_segs, get_blocks, end_io, 0); +} + extern struct file_operations generic_ro_fops; #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index c9695427a435..679fc963f842 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -32,10 +32,16 @@ #define __GFP_NOFAIL 0x800 /* Retry for ever. Cannot fail */ #define __GFP_NORETRY 0x1000 /* Do not retry. Might fail */ #define __GFP_NO_GROW 0x2000 /* Slab internal usage */ +#define __GFP_COMP 0x4000 /* Add compound page metadata */ #define __GFP_BITS_SHIFT 16 /* Room for 16 __GFP_FOO bits */ #define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1) +/* if you forget to add the bitmask here kernel will crash, period */ +#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ + __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ + __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP) + #define GFP_ATOMIC (__GFP_HIGH) #define GFP_NOIO (__GFP_WAIT) #define GFP_NOFS (__GFP_WAIT | __GFP_IO) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index da3fc826a0de..b0e98cfe15f9 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -28,8 +28,11 @@ struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, pmd_t *pmd, int write); int is_aligned_hugepage_range(unsigned long addr, unsigned long len); int pmd_huge(pmd_t pmd); +struct page *alloc_huge_page(void); +void free_huge_page(struct page *); -extern int htlbpage_max; +extern unsigned long max_huge_pages; +extern const unsigned long hugetlb_zero, hugetlb_infinity; static inline void mark_mm_hugetlb(struct mm_struct *mm, struct vm_area_struct *vma) @@ -78,6 +81,8 @@ static inline unsigned long hugetlb_total_pages(void) #define pmd_huge(x) 0 #define is_hugepage_only_range(addr, len) 0 #define hugetlb_free_pgtables(tlb, prev, start, end) do { } while (0) +#define alloc_huge_page() ({ NULL; }) +#define free_huge_page(p) ({ (void)(p); BUG(); }) #ifndef HPAGE_MASK #define HPAGE_MASK 0 /* Keep the compiler happy */ diff --git a/include/linux/init.h b/include/linux/init.h index 45069e275b3d..c6842477243c 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -46,6 +46,8 @@ #define __exitdata __attribute__ ((__section__(".exit.data"))) #define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) +#define __sched __attribute__((__section__(".sched.text"))) + #ifdef MODULE #define __exit __attribute__ ((__section__(".exit.text"))) #else diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 5c4843a08917..29189706ea57 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -49,6 +49,7 @@ .shared_pending = { \ .list = LIST_HEAD_INIT(sig.shared_pending.list), \ .signal = {{0}}}, \ + .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \ } #define INIT_SIGHAND(sighand) { \ @@ -107,7 +108,6 @@ extern struct group_info init_groups; .list = LIST_HEAD_INIT(tsk.pending.list), \ .signal = {{0}}}, \ .blocked = {{0}}, \ - .posix_timers = LIST_HEAD_INIT(tsk.posix_timers), \ .alloc_lock = SPIN_LOCK_UNLOCKED, \ .proc_lock = SPIN_LOCK_UNLOCKED, \ .switch_lock = SPIN_LOCK_UNLOCKED, \ diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index 9479a550b924..75311f205806 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h @@ -109,6 +109,35 @@ struct ipmi_ipmb_addr unsigned char lun; }; +/* + * A LAN Address. This is an address to/from a LAN interface bridged + * by the BMC, not an address actually out on the LAN. + * + * A concious decision was made here to deviate slightly from the IPMI + * spec. We do not use rqSWID and rsSWID like it shows in the + * message. Instead, we use remote_SWID and local_SWID. This means + * that any message (a request or response) from another device will + * always have exactly the same address. If you didn't do this, + * requests and responses from the same device would have different + * addresses, and that's not too cool. + * + * In this address, the remote_SWID is always the SWID the remote + * message came from, or the SWID we are sending the message to. + * local_SWID is always our SWID. Note that having our SWID in the + * message is a little wierd, but this is required. + */ +#define IPMI_LAN_ADDR_TYPE 0x04 +struct ipmi_lan_addr +{ + int addr_type; + short channel; + unsigned char privilege; + unsigned char session_handle; + unsigned char remote_SWID; + unsigned char local_SWID; + unsigned char lun; +}; + /* * Channel for talking directly with the BMC. When using this @@ -145,10 +174,20 @@ struct ipmi_msg * Receive types for messages coming from the receive interface. This * is used for the receive in-kernel interface and in the receive * IOCTL. + * + * The "IPMI_RESPONSE_RESPNOSE_TYPE" is a little strange sounding, but + * it allows you to get the message results when you send a response + * message. */ #define IPMI_RESPONSE_RECV_TYPE 1 /* A response to a command */ #define IPMI_ASYNC_EVENT_RECV_TYPE 2 /* Something from the event queue */ #define IPMI_CMD_RECV_TYPE 3 /* A command from somewhere else */ +#define IPMI_RESPONSE_RESPONSE_TYPE 4 /* The response for + a sent response, giving any + error status for sending the + response. When you send a + response message, this will + be returned. */ /* Note that async events and received commands do not have a completion code as the first byte of the incoming data, unlike a response. */ @@ -160,6 +199,7 @@ struct ipmi_msg * The in-kernel interface. */ #include <linux/list.h> +#include <linux/module.h> /* Opaque type for a IPMI message user. One of these is needed to send and receive messages. */ @@ -185,6 +225,12 @@ struct ipmi_recv_msg long msgid; struct ipmi_msg msg; + /* The user_msg_data is the data supplied when a message was + sent, if this is a response to a sent message. If this is + not a response to a sent message, then user_msg_data will + be NULL. */ + void *user_msg_data; + /* Call this when done with the message. It will presumably free the message and do any other necessary cleanup. */ void (*done)(struct ipmi_recv_msg *msg); @@ -206,9 +252,10 @@ struct ipmi_user_hndl /* Routine type to call when a message needs to be routed to the upper layer. This will be called with some locks held, the only IPMI routines that can be called are ipmi_request - and the alloc/free operations. */ + and the alloc/free operations. The handler_data is the + variable supplied when the receive handler was registered. */ void (*ipmi_recv_hndl)(struct ipmi_recv_msg *msg, - void *handler_data); + void *user_msg_data); /* Called when the interface detects a watchdog pre-timeout. If this is NULL, it will be ignored for the user. */ @@ -221,7 +268,12 @@ int ipmi_create_user(unsigned int if_num, void *handler_data, ipmi_user_t *user); -/* Destroy the given user of the IPMI layer. */ +/* Destroy the given user of the IPMI layer. Note that after this + function returns, the system is guaranteed to not call any + callbacks for the user. Thus as long as you destroy all the users + before you unload a module, you will be safe. And if you destroy + the users before you destroy the callback structures, it should be + safe, too. */ int ipmi_destroy_user(ipmi_user_t user); /* Get the IPMI version of the BMC we are talking to. */ @@ -253,20 +305,51 @@ unsigned char ipmi_get_my_LUN(ipmi_user_t user); * in the msgid field of the received command. If the priority is > * 0, the message will go into a high-priority queue and be sent * first. Otherwise, it goes into a normal-priority queue. + * The user_msg_data field will be returned in any response to this + * message. + * + * Note that if you send a response (with the netfn lower bit set), + * you *will* get back a SEND_MSG response telling you what happened + * when the response was sent. You will not get back a response to + * the message itself. */ int ipmi_request(ipmi_user_t user, struct ipmi_addr *addr, long msgid, struct ipmi_msg *msg, + void *user_msg_data, int priority); /* + * Like ipmi_request, but lets you specify the number of retries and + * the retry time. The retries is the number of times the message + * will be resent if no reply is received. If set to -1, the default + * value will be used. The retry time is the time in milliseconds + * between retries. If set to zero, the default value will be + * used. + * + * Don't use this unless you *really* have to. It's primarily for the + * IPMI over LAN converter; since the LAN stuff does its own retries, + * it makes no sense to do it here. However, this can be used if you + * have unusual requirements. + */ +int ipmi_request_settime(ipmi_user_t user, + struct ipmi_addr *addr, + long msgid, + struct ipmi_msg *msg, + void *user_msg_data, + int priority, + int max_retries, + unsigned int retry_time_ms); + +/* * Like ipmi_request, but lets you specify the slave return address. */ int ipmi_request_with_source(ipmi_user_t user, struct ipmi_addr *addr, long msgid, struct ipmi_msg *msg, + void *user_msg_data, int priority, unsigned char source_address, unsigned char source_lun); @@ -284,6 +367,7 @@ int ipmi_request_supply_msgs(ipmi_user_t user, struct ipmi_addr *addr, long msgid, struct ipmi_msg *msg, + void *user_msg_data, void *supplied_smi, struct ipmi_recv_msg *supplied_recv, int priority); @@ -331,6 +415,10 @@ struct ipmi_smi_watcher { struct list_head link; + /* You must set the owner to the current module, if you are in + a module (generally just set it to "THIS_MODULE"). */ + struct module *owner; + /* These two are called with read locks held for the interface the watcher list. So you can add and remove users from the IPMI interface, send messages, etc., but you cannot add @@ -422,6 +510,29 @@ struct ipmi_req #define IPMICTL_SEND_COMMAND _IOR(IPMI_IOC_MAGIC, 13, \ struct ipmi_req) +/* Messages sent to the interface with timing parameters are this + format. */ +struct ipmi_req_settime +{ + struct ipmi_req req; + + /* See ipmi_request_settime() above for details on these + values. */ + int retries; + unsigned int retry_time_ms; +}; +/* + * Send a message to the interfaces with timing parameters. error values + * are: + * - EFAULT - an address supplied was invalid. + * - EINVAL - The address supplied was not valid, or the command + * was not allowed. + * - EMSGSIZE - The message to was too large. + * - ENOMEM - Buffers could not be allocated for the command. + */ +#define IPMICTL_SEND_COMMAND_SETTIME _IOR(IPMI_IOC_MAGIC, 21, \ + struct ipmi_req_settime) + /* Messages received from the interface are this format. */ struct ipmi_recv { @@ -513,4 +624,18 @@ struct ipmi_cmdspec #define IPMICTL_SET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 19, unsigned int) #define IPMICTL_GET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 20, unsigned int) +/* + * Get/set the default timing values for an interface. You shouldn't + * generally mess with these. + */ +struct ipmi_timing_parms +{ + int retries; + unsigned int retry_time_ms; +}; +#define IPMICTL_SET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 22, \ + struct ipmi_timing_parms) +#define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, \ + struct ipmi_timing_parms) + #endif /* __LINUX_IPMI_H */ diff --git a/include/linux/ipmi_msgdefs.h b/include/linux/ipmi_msgdefs.h index ccdb9386faed..40ed591fd84b 100644 --- a/include/linux/ipmi_msgdefs.h +++ b/include/linux/ipmi_msgdefs.h @@ -53,6 +53,7 @@ #define IPMI_SET_BMC_GLOBAL_ENABLES_CMD 0x2e #define IPMI_GET_BMC_GLOBAL_ENABLES_CMD 0x2f #define IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35 +#define IPMI_GET_CHANNEL_INFO_CMD 0x42 #define IPMI_NETFN_STORAGE_REQUEST 0x0a #define IPMI_NETFN_STORAGE_RESPONSE 0x0b @@ -61,8 +62,39 @@ /* The default slave address */ #define IPMI_BMC_SLAVE_ADDR 0x20 -#define IPMI_MAX_MSG_LENGTH 80 +/* The BT interface on high-end HP systems supports up to 255 bytes in + * one transfer. Its "virtual" BMC supports some commands that are longer + * than 128 bytes. Use the full 256, plus NetFn/LUN, Cmd, cCode, plus + * some overhead. It would be nice to base this on the "BT Capabilities" + * but that's too hard to propogate to the rest of the driver. */ +#define IPMI_MAX_MSG_LENGTH 272 /* multiple of 16 */ -#define IPMI_CC_NO_ERROR 0 +#define IPMI_CC_NO_ERROR 0x00 +#define IPMI_NODE_BUSY_ERR 0xc0 +#define IPMI_ERR_MSG_TRUNCATED 0xc6 +#define IPMI_LOST_ARBITRATION_ERR 0x81 +#define IPMI_ERR_UNSPECIFIED 0xff + +#define IPMI_CHANNEL_PROTOCOL_IPMB 1 +#define IPMI_CHANNEL_PROTOCOL_ICMB 2 +#define IPMI_CHANNEL_PROTOCOL_SMBUS 4 +#define IPMI_CHANNEL_PROTOCOL_KCS 5 +#define IPMI_CHANNEL_PROTOCOL_SMIC 6 +#define IPMI_CHANNEL_PROTOCOL_BT10 7 +#define IPMI_CHANNEL_PROTOCOL_BT15 8 +#define IPMI_CHANNEL_PROTOCOL_TMODE 9 + +#define IPMI_CHANNEL_MEDIUM_IPMB 1 +#define IPMI_CHANNEL_MEDIUM_ICMB10 2 +#define IPMI_CHANNEL_MEDIUM_ICMB09 3 +#define IPMI_CHANNEL_MEDIUM_8023LAN 4 +#define IPMI_CHANNEL_MEDIUM_ASYNC 5 +#define IPMI_CHANNEL_MEDIUM_OTHER_LAN 6 +#define IPMI_CHANNEL_MEDIUM_PCI_SMBUS 7 +#define IPMI_CHANNEL_MEDIUM_SMBUS1 8 +#define IPMI_CHANNEL_MEDIUM_SMBUS2 9 +#define IPMI_CHANNEL_MEDIUM_USB1 10 +#define IPMI_CHANNEL_MEDIUM_USB2 11 +#define IPMI_CHANNEL_MEDIUM_SYSINTF 12 #endif /* __LINUX_IPMI_MSGDEFS_H */ diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index f18187b00c05..6b42943ac3a3 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h @@ -35,6 +35,8 @@ #define __LINUX_IPMI_SMI_H #include <linux/ipmi_msgdefs.h> +#include <linux/proc_fs.h> +#include <linux/module.h> /* This files describes the interface for IPMI system management interface drivers to bind into the IPMI message handler. */ @@ -48,7 +50,7 @@ typedef struct ipmi_smi *ipmi_smi_t; * been received, it will report this same data structure back up to * the upper layer. If an error occurs, it should fill in the * response with an error code in the completion code location. When - * asyncronous data is received, one of these is allocated, the + * asynchronous data is received, one of these is allocated, the * data_size is set to zero and the response holds the data from the * get message or get event command that the interface initiated. * Note that it is the interfaces responsibility to detect @@ -62,9 +64,6 @@ struct ipmi_smi_msg long msgid; void *user_data; - /* If 0, add to the end of the queue. If 1, add to the beginning. */ - int prio; - int data_size; unsigned char data[IPMI_MAX_MSG_LENGTH]; @@ -134,4 +133,11 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg) msg->done(msg); } +/* Allow the lower layer to add things to the proc filesystem + directory for this interface. Note that the entry will + automatically be dstroyed when the interface is destroyed. */ +int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, + read_proc_t *read_proc, write_proc_t *write_proc, + void *data, struct module *owner); + #endif /* __LINUX_IPMI_SMI_H */ diff --git a/include/linux/irq.h b/include/linux/irq.h index fa03b836c29a..5bc740d9bc47 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -71,7 +71,6 @@ extern irq_desc_t irq_desc [NR_IRQS]; #include <asm/hw_irq.h> /* the arch dependent stuff */ -extern int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); extern int setup_irq(unsigned int , struct irqaction * ); extern hw_irq_controller no_irq_type; /* needed in every arch ? */ diff --git a/include/linux/jbd.h b/include/linux/jbd.h index eb154bafe1e4..0a625c3cd38b 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h @@ -42,6 +42,11 @@ */ #undef JBD_PARANOID_IOFAIL +/* + * The default maximum commit age, in seconds. + */ +#define JBD_DEFAULT_MAX_COMMIT_AGE 5 + #ifdef CONFIG_JBD_DEBUG /* * Define JBD_EXPENSIVE_CHECKING to enable more expensive internal @@ -300,6 +305,10 @@ BUFFER_FNS(JBD, jbd) BUFFER_FNS(JWrite, jwrite) BUFFER_FNS(JBDDirty, jbddirty) TAS_BUFFER_FNS(JBDDirty, jbddirty) +BUFFER_FNS(Revoked, revoked) +TAS_BUFFER_FNS(Revoked, revoked) +BUFFER_FNS(RevokeValid, revokevalid) +TAS_BUFFER_FNS(RevokeValid, revokevalid) BUFFER_FNS(Freed, freed) static inline struct buffer_head *jh2bh(struct journal_head *jh) @@ -487,6 +496,12 @@ struct transaction_s struct journal_head *t_reserved_list; /* + * Doubly-linked circular list of all buffers under writeout during + * commit [j_list_lock] + */ + struct journal_head *t_locked_list; + + /* * Doubly-linked circular list of all metadata buffers owned by this * transaction [j_list_lock] */ @@ -1001,10 +1016,10 @@ extern int cleanup_journal_tail(journal_t *); /* Debugging code only: */ #define jbd_ENOSYS() \ -do { \ - printk (KERN_ERR "JBD unimplemented function " __FUNCTION__); \ - current->state = TASK_UNINTERRUPTIBLE; \ - schedule(); \ +do { \ + printk (KERN_ERR "JBD unimplemented function %s\n", __FUNCTION__); \ + current->state = TASK_UNINTERRUPTIBLE; \ + schedule(); \ } while (1) /* @@ -1079,7 +1094,8 @@ static inline int jbd_space_needed(journal_t *journal) #define BJ_Shadow 5 /* Buffer contents being shadowed to the log */ #define BJ_LogCtl 6 /* Buffer contains log descriptors */ #define BJ_Reserved 7 /* Buffer is reserved for access by journal */ -#define BJ_Types 8 +#define BJ_Locked 8 /* Locked for I/O during commit */ +#define BJ_Types 9 extern int jbd_blocks_per_page(struct inode *inode); diff --git a/include/linux/kernel.h b/include/linux/kernel.h index e11e79199357..c1171e77c76b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -109,9 +109,15 @@ static inline void console_verbose(void) extern void bust_spinlocks(int yes); extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ extern int panic_on_oops; -extern int system_running; +extern int system_state; /* See values below */ extern int tainted; extern const char *print_tainted(void); + +/* Values used for system_state */ +#define SYSTEM_BOOTING 0 +#define SYSTEM_RUNNING 1 +#define SYSTEM_SHUTDOWN 2 + #define TAINT_PROPRIETARY_MODULE (1<<0) #define TAINT_FORCED_MODULE (1<<1) #define TAINT_UNSAFE_SMP (1<<2) diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h index b982d5b77ae9..1d4b1b15d0b8 100644 --- a/include/linux/kernelcapi.h +++ b/include/linux/kernelcapi.h @@ -10,10 +10,8 @@ #ifndef __KERNELCAPI_H__ #define __KERNELCAPI_H__ -#include <linux/list.h> - -#define CAPI_MAXAPPL 128 /* maximum number of applications */ -#define CAPI_MAXCONTR 16 /* maximum number of controller */ +#define CAPI_MAXAPPL 240 /* maximum number of applications */ +#define CAPI_MAXCONTR 32 /* maximum number of controller */ #define CAPI_MAXDATAWINDOW 8 @@ -47,6 +45,7 @@ typedef struct kcapi_carddef { #ifdef __KERNEL__ +#include <linux/list.h> #include <linux/skbuff.h> #define KCI_CONTRUP 0 /* arg: struct capi_profile */ @@ -63,6 +62,10 @@ struct capi20_appl { unsigned long nrecvdatapkt; unsigned long nsentctlpkt; unsigned long nsentdatapkt; + struct semaphore recv_sem; + struct sk_buff_head recv_queue; + struct work_struct recv_work; + int release_in_progress; /* ugly hack to allow for notification of added/removed * controllers. The Right Way (tm) is known. XXX diff --git a/include/linux/list.h b/include/linux/list.h index 5388098449cc..34fd74e050df 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -39,7 +39,7 @@ struct list_head { } while (0) /* - * Insert a new entry between two known consecutive entries. + * Insert a new entry between two known consecutive entries. * * This is only for internal list manipulation where we know * the prev/next entries already! @@ -81,14 +81,13 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head) } /* - * Insert a new entry between two known consecutive entries. + * Insert a new entry between two known consecutive entries. * * This is only for internal list manipulation where we know * the prev/next entries already! */ -static __inline__ void __list_add_rcu(struct list_head * new, - struct list_head * prev, - struct list_head * next) +static inline void __list_add_rcu(struct list_head * new, + struct list_head * prev, struct list_head * next) { new->next = next; new->prev = prev; @@ -104,8 +103,16 @@ static __inline__ void __list_add_rcu(struct list_head * new, * * Insert a new entry after the specified head. * This is good for implementing stacks. - */ -static __inline__ void list_add_rcu(struct list_head *new, struct list_head *head) + * + * The caller must take whatever precautions are necessary + * (such as holding appropriate locks) to avoid racing + * with another list-mutation primitive, such as list_add_rcu() + * or list_del_rcu(), running on this same list. + * However, it is perfectly legal to run concurrently with + * the _rcu list-traversal primitives, such as + * list_for_each_entry_rcu(). + */ +static inline void list_add_rcu(struct list_head *new, struct list_head *head) { __list_add_rcu(new, head, head->next); } @@ -117,8 +124,17 @@ static __inline__ void list_add_rcu(struct list_head *new, struct list_head *hea * * Insert a new entry before the specified head. * This is useful for implementing queues. - */ -static __inline__ void list_add_tail_rcu(struct list_head *new, struct list_head *head) + * + * The caller must take whatever precautions are necessary + * (such as holding appropriate locks) to avoid racing + * with another list-mutation primitive, such as list_add_tail_rcu() + * or list_del_rcu(), running on this same list. + * However, it is perfectly legal to run concurrently with + * the _rcu list-traversal primitives, such as + * list_for_each_entry_rcu(). + */ +static inline void list_add_tail_rcu(struct list_head *new, + struct list_head *head) { __list_add_rcu(new, head->prev, head); } @@ -153,12 +169,25 @@ static inline void list_del(struct list_head *entry) * list_del_rcu - deletes entry from list without re-initialization * @entry: the element to delete from the list. * - * Note: list_empty on entry does not return true after this, + * Note: list_empty on entry does not return true after this, * the entry is in an undefined state. It is useful for RCU based * lockfree traversal. * - * In particular, it means that we can not poison the forward + * In particular, it means that we can not poison the forward * pointers that may still be used for walking the list. + * + * The caller must take whatever precautions are necessary + * (such as holding appropriate locks) to avoid racing + * with another list-mutation primitive, such as list_del_rcu() + * or list_add_rcu(), running on this same list. + * However, it is perfectly legal to run concurrently with + * the _rcu list-traversal primitives, such as + * list_for_each_entry_rcu(). + * + * Note that the caller is not permitted to immediately free + * the newly deleted entry. Instead, either synchronize_kernel() + * or call_rcu() must be used to defer freeing until an RCU + * grace period has elapsed. */ static inline void list_del_rcu(struct list_head *entry) { @@ -173,7 +202,7 @@ static inline void list_del_rcu(struct list_head *entry) static inline void list_del_init(struct list_head *entry) { __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); + INIT_LIST_HEAD(entry); } /** @@ -306,7 +335,7 @@ static inline void list_splice_init(struct list_head *list, #define list_for_each_prev(pos, head) \ for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \ pos = pos->prev, prefetch(pos->prev)) - + /** * list_for_each_safe - iterate over a list safe against removal of list entry * @pos: the &struct list_head to use as a loop counter. @@ -384,21 +413,29 @@ static inline void list_splice_init(struct list_head *list, * list_for_each_rcu - iterate over an rcu-protected list * @pos: the &struct list_head to use as a loop counter. * @head: the head for your list. + * + * This list-traversal primitive may safely run concurrently with + * the _rcu list-mutation primitives such as list_add_rcu() + * as long as the traversal is guarded by rcu_read_lock(). */ #define list_for_each_rcu(pos, head) \ for (pos = (head)->next, prefetch(pos->next); pos != (head); \ pos = pos->next, ({ smp_read_barrier_depends(); 0;}), prefetch(pos->next)) - + #define __list_for_each_rcu(pos, head) \ for (pos = (head)->next; pos != (head); \ pos = pos->next, ({ smp_read_barrier_depends(); 0;})) - + /** * list_for_each_safe_rcu - iterate over an rcu-protected list safe * against removal of list entry * @pos: the &struct list_head to use as a loop counter. * @n: another &struct list_head to use as temporary storage * @head: the head for your list. + * + * This list-traversal primitive may safely run concurrently with + * the _rcu list-mutation primitives such as list_add_rcu() + * as long as the traversal is guarded by rcu_read_lock(). */ #define list_for_each_safe_rcu(pos, n, head) \ for (pos = (head)->next, n = pos->next; pos != (head); \ @@ -409,6 +446,10 @@ static inline void list_splice_init(struct list_head *list, * @pos: the type * to use as a loop counter. * @head: the head for your list. * @member: the name of the list_struct within the struct. + * + * This list-traversal primitive may safely run concurrently with + * the _rcu list-mutation primitives such as list_add_rcu() + * as long as the traversal is guarded by rcu_read_lock(). */ #define list_for_each_entry_rcu(pos, head, member) \ for (pos = list_entry((head)->next, typeof(*pos), member), \ @@ -420,55 +461,59 @@ static inline void list_splice_init(struct list_head *list, /** - * list_for_each_continue_rcu - iterate over an rcu-protected list + * list_for_each_continue_rcu - iterate over an rcu-protected list * continuing after existing point. * @pos: the &struct list_head to use as a loop counter. * @head: the head for your list. + * + * This list-traversal primitive may safely run concurrently with + * the _rcu list-mutation primitives such as list_add_rcu() + * as long as the traversal is guarded by rcu_read_lock(). */ #define list_for_each_continue_rcu(pos, head) \ for ((pos) = (pos)->next, prefetch((pos)->next); (pos) != (head); \ (pos) = (pos)->next, ({ smp_read_barrier_depends(); 0;}), prefetch((pos)->next)) -/* - * Double linked lists with a single pointer list head. - * Mostly useful for hash tables where the two pointer list head is +/* + * Double linked lists with a single pointer list head. + * Mostly useful for hash tables where the two pointer list head is * too wasteful. * You lose the ability to access the tail in O(1). - */ + */ -struct hlist_head { - struct hlist_node *first; -}; +struct hlist_head { + struct hlist_node *first; +}; -struct hlist_node { - struct hlist_node *next, **pprev; -}; +struct hlist_node { + struct hlist_node *next, **pprev; +}; -#define HLIST_HEAD_INIT { .first = NULL } +#define HLIST_HEAD_INIT { .first = NULL } #define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } -#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) +#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) #define INIT_HLIST_NODE(ptr) ((ptr)->next = NULL, (ptr)->pprev = NULL) -static __inline__ int hlist_unhashed(const struct hlist_node *h) -{ +static inline int hlist_unhashed(const struct hlist_node *h) +{ return !h->pprev; -} +} -static __inline__ int hlist_empty(const struct hlist_head *h) -{ +static inline int hlist_empty(const struct hlist_head *h) +{ return !h->first; -} +} -static __inline__ void __hlist_del(struct hlist_node *n) +static inline void __hlist_del(struct hlist_node *n) { struct hlist_node *next = n->next; struct hlist_node **pprev = n->pprev; - *pprev = next; - if (next) + *pprev = next; + if (next) next->pprev = pprev; -} +} -static __inline__ void hlist_del(struct hlist_node *n) +static inline void hlist_del(struct hlist_node *n) { __hlist_del(n); n->next = LIST_POISON1; @@ -479,12 +524,20 @@ static __inline__ void hlist_del(struct hlist_node *n) * hlist_del_rcu - deletes entry from hash list without re-initialization * @n: the element to delete from the hash list. * - * Note: list_unhashed() on entry does not return true after this, + * Note: list_unhashed() on entry does not return true after this, * the entry is in an undefined state. It is useful for RCU based * lockfree traversal. * * In particular, it means that we can not poison the forward * pointers that may still be used for walking the hash list. + * + * The caller must take whatever precautions are necessary + * (such as holding appropriate locks) to avoid racing + * with another list-mutation primitive, such as hlist_add_head_rcu() + * or hlist_del_rcu(), running on this same list. + * However, it is perfectly legal to run concurrently with + * the _rcu list-traversal primitives, such as + * hlist_for_each_entry(). */ static inline void hlist_del_rcu(struct hlist_node *n) { @@ -492,48 +545,70 @@ static inline void hlist_del_rcu(struct hlist_node *n) n->pprev = LIST_POISON2; } -static __inline__ void hlist_del_init(struct hlist_node *n) +static inline void hlist_del_init(struct hlist_node *n) { if (n->pprev) { __hlist_del(n); INIT_HLIST_NODE(n); } -} +} #define hlist_del_rcu_init hlist_del_init -static __inline__ void hlist_add_head(struct hlist_node *n, struct hlist_head *h) -{ +static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) +{ struct hlist_node *first = h->first; - n->next = first; - if (first) + n->next = first; + if (first) first->pprev = &n->next; - h->first = n; - n->pprev = &h->first; -} + h->first = n; + n->pprev = &h->first; +} + -static __inline__ void hlist_add_head_rcu(struct hlist_node *n, struct hlist_head *h) -{ +/** + * hlist_add_head_rcu - adds the specified element to the specified hlist, + * while permitting racing traversals. + * @n: the element to add to the hash list. + * @h: the list to add to. + * + * The caller must take whatever precautions are necessary + * (such as holding appropriate locks) to avoid racing + * with another list-mutation primitive, such as hlist_add_head_rcu() + * or hlist_del_rcu(), running on this same list. + * However, it is perfectly legal to run concurrently with + * the _rcu list-traversal primitives, such as + * hlist_for_each_entry(), but only if smp_read_barrier_depends() + * is used to prevent memory-consistency problems on Alpha CPUs. + * Regardless of the type of CPU, the list-traversal primitive + * must be guarded by rcu_read_lock(). + * + * OK, so why don't we have an hlist_for_each_entry_rcu()??? + */ +static inline void hlist_add_head_rcu(struct hlist_node *n, + struct hlist_head *h) +{ struct hlist_node *first = h->first; n->next = first; - n->pprev = &h->first; + n->pprev = &h->first; smp_wmb(); - if (first) + if (first) first->pprev = &n->next; - h->first = n; -} + h->first = n; +} /* next must be != NULL */ -static __inline__ void hlist_add_before(struct hlist_node *n, struct hlist_node *next) +static inline void hlist_add_before(struct hlist_node *n, + struct hlist_node *next) { n->pprev = next->pprev; - n->next = next; - next->pprev = &n->next; + n->next = next; + next->pprev = &n->next; *(n->pprev) = n; } -static __inline__ void hlist_add_after(struct hlist_node *n, - struct hlist_node *next) +static inline void hlist_add_after(struct hlist_node *n, + struct hlist_node *next) { next->next = n->next; *(next->pprev) = n; @@ -545,7 +620,7 @@ static __inline__ void hlist_add_after(struct hlist_node *n, /* Cannot easily do prefetch unfortunately */ #define hlist_for_each(pos, head) \ for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \ - pos = pos->next) + pos = pos->next) #define hlist_for_each_safe(pos, n, head) \ for (pos = (head)->first; n = pos ? pos->next : 0, pos; \ diff --git a/include/linux/mm.h b/include/linux/mm.h index fbd569b35b4f..d453a0ab62a7 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -180,9 +180,8 @@ struct page { page_flags_t flags; /* atomic flags, some possibly updated asynchronously */ atomic_t count; /* Usage count, see below. */ - struct list_head list; /* ->mapping has some page lists. */ struct address_space *mapping; /* The inode (or ...) we belong to. */ - unsigned long index; /* Our offset within mapping. */ + pgoff_t index; /* Our offset within mapping. */ struct list_head lru; /* Pageout list, eg. active_list; protected by zone->lru_lock !! */ union { @@ -190,8 +189,11 @@ struct page { * protected by PG_chainlock */ pte_addr_t direct; } pte; - unsigned long private; /* mapping-private opaque data */ - + unsigned long private; /* Mapping-private opaque data: + * usually used for buffer_heads + * if PagePrivate set; used for + * swp_entry_t if PageSwapCache + */ /* * On machines where all RAM is mapped into kernel address space, * we can simply calculate the virtual address. On machines with @@ -242,24 +244,24 @@ extern void FASTCALL(__page_cache_release(struct page *)); static inline int page_count(struct page *p) { if (PageCompound(p)) - p = (struct page *)p->lru.next; + p = (struct page *)p->private; return atomic_read(&(p)->count); } static inline void get_page(struct page *page) { - if (PageCompound(page)) - page = (struct page *)page->lru.next; + if (unlikely(PageCompound(page))) + page = (struct page *)page->private; atomic_inc(&page->count); } static inline void put_page(struct page *page) { - if (PageCompound(page)) { - page = (struct page *)page->lru.next; + if (unlikely(PageCompound(page))) { + page = (struct page *)page->private; if (put_page_testzero(page)) { - if (page->lru.prev) { /* destructor? */ - (*(void (*)(struct page *))page->lru.prev)(page); + if (page[1].mapping) { /* destructor? */ + (*(void (*)(struct page *))page[1].mapping)(page); } else { __page_cache_release(page); } @@ -349,7 +351,7 @@ static inline unsigned long page_zonenum(struct page *page) { return (page->flags >> NODEZONE_SHIFT) & (~(~0UL << ZONES_SHIFT)); } -static inline unsigned long page_nodenum(struct page *page) +static inline unsigned long page_to_nid(struct page *page) { return (page->flags >> (NODEZONE_SHIFT + ZONES_SHIFT)); } @@ -404,6 +406,19 @@ void page_address_init(void); #endif /* + * On an anonymous page mapped into a user virtual memory area, + * page->mapping points to its anon_vma, not to a struct address_space. + * + * Please note that, confusingly, "page_mapping" refers to the inode + * address_space which maps the page from disk; whereas "page_mapped" + * refers to user virtual address space into which the page is mapped. + */ +static inline struct address_space *page_mapping(struct page *page) +{ + return PageAnon(page)? NULL: page->mapping; +} + +/* * Return true if this page is mapped into pagetables. Subtle: test pte.direct * rather than pte.chain. Because sometimes pte.direct is 64-bit, and .chain * is only 32-bit. @@ -472,7 +487,9 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long int __set_page_dirty_buffers(struct page *page); int __set_page_dirty_nobuffers(struct page *page); +int FASTCALL(set_page_dirty(struct page *page)); int set_page_dirty_lock(struct page *page); +int clear_page_dirty_for_io(struct page *page); /* * Prototype to add a shrinker callback for ageable caches. @@ -498,23 +515,6 @@ extern struct shrinker *set_shrinker(int, shrinker_t); extern void remove_shrinker(struct shrinker *shrinker); /* - * If the mapping doesn't provide a set_page_dirty a_op, then - * just fall through and assume that it wants buffer_heads. - * FIXME: make the method unconditional. - */ -static inline int set_page_dirty(struct page *page) -{ - if (page->mapping) { - int (*spd)(struct page *); - - spd = page->mapping->a_ops->set_page_dirty; - if (spd) - return (*spd)(page); - } - return __set_page_dirty_buffers(page); -} - -/* * On a two-level page table, this ends up being trivial. Thus the * inlining and the symmetry break with pte_alloc_map() that does all * of this out-of-line. @@ -541,6 +541,9 @@ extern void si_meminfo_node(struct sysinfo *val, int nid); extern void insert_vm_struct(struct mm_struct *, struct vm_area_struct *); extern void __vma_link_rb(struct mm_struct *, struct vm_area_struct *, struct rb_node **, struct rb_node *); +extern struct vm_area_struct *copy_vma(struct vm_area_struct *, + unsigned long addr, unsigned long len, unsigned long pgoff); +extern void vma_relink_file(struct vm_area_struct *, struct vm_area_struct *); extern void exit_mmap(struct mm_struct *); extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index b5398fa7be88..51b8f3f67741 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -54,6 +54,15 @@ struct per_cpu_pageset { struct per_cpu_pages pcp[2]; /* 0: hot. 1: cold */ } ____cacheline_aligned_in_smp; +#define ZONE_DMA 0 +#define ZONE_NORMAL 1 +#define ZONE_HIGHMEM 2 + +#define MAX_NR_ZONES 3 /* Sync this with ZONES_SHIFT */ +#define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */ + +#define GFP_ZONEMASK 0x03 + /* * On machines where it is needed (eg PCs) we divide physical memory * into multiple physical zones. On a PC we have 3 zones: @@ -70,6 +79,19 @@ struct zone { spinlock_t lock; unsigned long free_pages; unsigned long pages_min, pages_low, pages_high; + /* + * protection[] is a pre-calculated number of extra pages that must be + * available in a zone in order for __alloc_pages() to allocate memory + * from the zone. i.e., for a GFP_KERNEL alloc of "order" there must + * be "(1<<order) + protection[ZONE_NORMAL]" free pages in the zone + * for us to choose to allocate the page from that zone. + * + * It uses both min_free_kbytes and sysctl_lower_zone_protection. + * The protection values are recalculated if either of these values + * change. The array elements are in zonelist order: + * [0] == GFP_DMA, [1] == GFP_KERNEL, [2] == GFP_HIGHMEM. + */ + unsigned long protection[MAX_NR_ZONES]; ZONE_PADDING(_pad1_) @@ -157,14 +179,6 @@ struct zone { unsigned long present_pages; /* amount of memory (excluding holes) */ } ____cacheline_maxaligned_in_smp; -#define ZONE_DMA 0 -#define ZONE_NORMAL 1 -#define ZONE_HIGHMEM 2 - -#define MAX_NR_ZONES 3 /* Sync this with ZONES_SHIFT */ -#define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */ - -#define GFP_ZONEMASK 0x03 /* * The "priority" of VM scanning is how much of the queues we will scan in one @@ -228,6 +242,11 @@ void get_zone_counts(unsigned long *active, unsigned long *inactive, void build_all_zonelists(void); void wakeup_kswapd(struct zone *zone); +/* + * zone_idx() returns 0 for the ZONE_DMA zone, 1 for the ZONE_NORMAL zone, etc. + */ +#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones) + /** * for_each_pgdat - helper macro to iterate over all nodes * @pgdat - pointer to a pg_data_t variable @@ -299,7 +318,9 @@ static inline int is_normal(struct zone *zone) struct ctl_table; struct file; int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *, - void __user *, size_t *); + void __user *, size_t *); +int lower_zone_protection_sysctl_handler(struct ctl_table *, int, struct file *, + void __user *, size_t *); #include <linux/topology.h> /* Returns the number of the current Node. */ diff --git a/include/linux/module.h b/include/linux/module.h index 4c9b53d5d51c..0a86652fb1cb 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -70,6 +70,7 @@ static const char __module_cat(name,__LINE__)[] \ extern const struct gtype##_id __mod_##gtype##_table \ __attribute__ ((unused, alias(__stringify(name)))) +extern struct module __this_module; #define THIS_MODULE (&__this_module) #else /* !MODULE */ @@ -481,21 +482,6 @@ static inline int unregister_module_notifier(struct notifier_block * nb) #endif /* CONFIG_MODULES */ -#ifdef MODULE -extern struct module __this_module; -#ifdef KBUILD_MODNAME -/* We make the linker do some of the work. */ -struct module __this_module -__attribute__((section(".gnu.linkonce.this_module"))) = { - .name = __stringify(KBUILD_MODNAME), - .init = init_module, -#ifdef CONFIG_MODULE_UNLOAD - .exit = cleanup_module, -#endif -}; -#endif /* KBUILD_MODNAME */ -#endif /* MODULE */ - #define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x) /* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */ diff --git a/include/linux/mqueue.h b/include/linux/mqueue.h new file mode 100644 index 000000000000..fc40b774b913 --- /dev/null +++ b/include/linux/mqueue.h @@ -0,0 +1,53 @@ +/* Copyright (C) 2003 Krzysztof Benedyczak & Michal Wronski + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + It 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this software; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LINUX_MQUEUE_H +#define _LINUX_MQUEUE_H + +#include <linux/types.h> + +#define MQ_PRIO_MAX 32768 + +struct mq_attr { + long mq_flags; /* message queue flags */ + long mq_maxmsg; /* maximum number of messages */ + long mq_msgsize; /* maximum message size */ + long mq_curmsgs; /* number of messages currently queued */ + long __reserved[4]; /* ignored for input, zeroed for output */ +}; + +/* + * SIGEV_THREAD implementation: + * SIGEV_THREAD must be implemented in user space. If SIGEV_THREAD is passed + * to mq_notify, then + * - sigev_signo must be the file descriptor of an AF_NETLINK socket. It's not + * necessary that the socket is bound. + * - sigev_value.sival_ptr must point to a cookie that is NOTIFY_COOKIE_LEN + * bytes long. + * If the notification is triggered, then the cookie is sent to the netlink + * socket. The last byte of the cookie is replaced with the NOTIFY_?? codes: + * NOTIFY_WOKENUP if the notification got triggered, NOTIFY_REMOVED if it was + * removed, either due to a close() on the message queue fd or due to a + * mq_notify() that removed the notification. + */ +#define NOTIFY_NONE 0 +#define NOTIFY_WOKENUP 1 +#define NOTIFY_REMOVED 2 + +#define NOTIFY_COOKIE_LEN 32 + +#endif diff --git a/include/linux/msg.h b/include/linux/msg.h index b235e862a3dd..2c4c6aa643ff 100644 --- a/include/linux/msg.h +++ b/include/linux/msg.h @@ -74,9 +74,6 @@ struct msg_msg { /* the actual message follows immediately */ }; -#define DATALEN_MSG (PAGE_SIZE-sizeof(struct msg_msg)) -#define DATALEN_SEG (PAGE_SIZE-sizeof(struct msg_msgseg)) - /* one msq_queue structure for each present queue on the system */ struct msg_queue { struct kern_ipc_perm q_perm; diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 4e5ea27305a2..5adca479de6e 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -13,6 +13,7 @@ #define NETLINK_XFRM 6 /* ipsec */ #define NETLINK_SELINUX 7 /* SELinux event notifications */ #define NETLINK_ARPD 8 +#define NETLINK_AUDIT 9 /* auditing */ #define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ #define NETLINK_IP6_FW 13 #define NETLINK_DNRTMSG 14 /* DECnet routing messages */ @@ -119,6 +120,13 @@ extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); extern int netlink_register_notifier(struct notifier_block *nb); extern int netlink_unregister_notifier(struct notifier_block *nb); +/* finegrained unicast helpers: */ +struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid); +struct sock *netlink_getsockbyfilp(struct file *filp); +int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo); +void netlink_detachskb(struct sock *sk, struct sk_buff *skb); +int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol); + /* * skb should fit one page. This choice is good for headerless malloc. * diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index e8ea2239a213..520545881a52 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h @@ -274,6 +274,7 @@ enum lock_type4 { #define FATTR4_WORD1_TIME_METADATA (1 << 20) #define FATTR4_WORD1_TIME_MODIFY (1 << 21) #define FATTR4_WORD1_TIME_MODIFY_SET (1 << 22) +#define FATTR4_WORD1_MOUNTED_ON_FILEID (1 << 23) #define NFSPROC4_NULL 0 #define NFSPROC4_COMPOUND 1 diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 6e6a66208308..418356558209 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h @@ -278,7 +278,7 @@ static inline int is_fsid(struct svc_fh *fh, struct knfsd_fh *reffh) | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \ | FATTR4_WORD1_SPACE_USED | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_ACCESS_SET \ | FATTR4_WORD1_TIME_CREATE | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \ - | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET) + | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID) /* These will return ERR_INVAL if specified in GETATTR or READDIR. */ #define NFSD_WRITEONLY_ATTRS_WORD1 \ diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index f58c9e68d3d8..6959827c9f62 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -69,12 +69,14 @@ #define PG_private 12 /* Has something at ->private */ #define PG_writeback 13 /* Page is under writeback */ #define PG_nosave 14 /* Used for system suspend/resume */ -#define PG_chainlock 15 /* lock bit for ->pte_chain */ +#define PG_maplock 15 /* Lock bit for rmap to ptes */ #define PG_direct 16 /* ->pte_chain points directly at pte */ #define PG_mappedtodisk 17 /* Has blocks allocated on-disk */ #define PG_reclaim 18 /* To be reclaimed asap */ #define PG_compound 19 /* Part of a compound page */ +#define PG_anon 20 /* Anonymous page: anon_vma in mapping*/ +#define PG_swapcache 21 /* Swap page: swp_entry_t in private */ /* @@ -298,24 +300,33 @@ extern void get_full_page_state(struct page_state *ret); #define SetPageCompound(page) set_bit(PG_compound, &(page)->flags) #define ClearPageCompound(page) clear_bit(PG_compound, &(page)->flags) -/* - * The PageSwapCache predicate doesn't use a PG_flag at this time, - * but it may again do so one day. - */ +#define PageAnon(page) test_bit(PG_anon, &(page)->flags) +#define SetPageAnon(page) set_bit(PG_anon, &(page)->flags) +#define ClearPageAnon(page) clear_bit(PG_anon, &(page)->flags) + #ifdef CONFIG_SWAP -extern struct address_space swapper_space; -#define PageSwapCache(page) ((page)->mapping == &swapper_space) +#define PageSwapCache(page) test_bit(PG_swapcache, &(page)->flags) +#define SetPageSwapCache(page) set_bit(PG_swapcache, &(page)->flags) +#define ClearPageSwapCache(page) clear_bit(PG_swapcache, &(page)->flags) #else -#define PageSwapCache(page) 0 +#define PageSwapCache(page) 0 #endif struct page; /* forward declaration */ int test_clear_page_dirty(struct page *page); +int __clear_page_dirty(struct page *page); +int test_clear_page_writeback(struct page *page); +int test_set_page_writeback(struct page *page); static inline void clear_page_dirty(struct page *page) { test_clear_page_dirty(page); } +static inline void set_page_writeback(struct page *page) +{ + test_set_page_writeback(page); +} + #endif /* PAGE_FLAGS_H */ diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index e552cb04a0ed..5585675ab842 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -69,9 +69,10 @@ extern struct page * find_trylock_page(struct address_space *mapping, unsigned long index); extern struct page * find_or_create_page(struct address_space *mapping, unsigned long index, unsigned int gfp_mask); -extern unsigned int find_get_pages(struct address_space *mapping, - pgoff_t start, unsigned int nr_pages, - struct page **pages); +unsigned find_get_pages(struct address_space *mapping, pgoff_t start, + unsigned int nr_pages, struct page **pages); +unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index, + int tag, unsigned int nr_pages, struct page **pages); /* * Returns locked page at given index in given cache, creating it if needed. @@ -141,7 +142,6 @@ static inline unsigned long get_page_cache_size(void) static inline void ___add_to_page_cache(struct page *page, struct address_space *mapping, unsigned long index) { - list_add(&page->list, &mapping->clean_pages); page->mapping = mapping; page->index = index; diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h index 2a332eed3d82..e6e43ce82b55 100644 --- a/include/linux/pagevec.h +++ b/include/linux/pagevec.h @@ -22,8 +22,11 @@ void __pagevec_free(struct pagevec *pvec); void __pagevec_lru_add(struct pagevec *pvec); void __pagevec_lru_add_active(struct pagevec *pvec); void pagevec_strip(struct pagevec *pvec); -unsigned int pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, - pgoff_t start, unsigned int nr_pages); +unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, + pgoff_t start, unsigned nr_pages); +unsigned pagevec_lookup_tag(struct pagevec *pvec, + struct address_space *mapping, pgoff_t *index, int tag, + unsigned nr_pages); static inline void pagevec_init(struct pagevec *pvec, int cold) { diff --git a/include/linux/posix_types.h b/include/linux/posix_types.h index 3ee2ed9de1db..f04c98cf44f3 100644 --- a/include/linux/posix_types.h +++ b/include/linux/posix_types.h @@ -42,6 +42,7 @@ typedef void (*__kernel_sighandler_t)(int); /* Type of a SYSV IPC key. */ typedef int __kernel_key_t; +typedef int __kernel_mqd_t; #include <asm/posix_types.h> diff --git a/include/linux/prefetch.h b/include/linux/prefetch.h index 73c4a344156b..fc86f274147f 100644 --- a/include/linux/prefetch.h +++ b/include/linux/prefetch.h @@ -10,6 +10,7 @@ #ifndef _LINUX_PREFETCH_H #define _LINUX_PREFETCH_H +#include <linux/types.h> #include <asm/processor.h> #include <asm/cache.h> @@ -54,4 +55,15 @@ static inline void prefetchw(const void *x) {;} #define PREFETCH_STRIDE (4*L1_CACHE_BYTES) #endif +static inline void prefetch_range(void *addr, size_t len) +{ +#ifdef ARCH_HAS_PREFETCH + char *cp; + char *end = addr + len; + + for (cp = addr; cp < end; cp += PREFETCH_STRIDE) + prefetch(cp); +#endif +} + #endif diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 155c9a2af016..e5a9e6bed751 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h @@ -64,11 +64,8 @@ static __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA) return 1; } - else { - spin_lock(&dq_data_lock); + else inode_add_bytes(inode, nr); - spin_unlock(&dq_data_lock); - } return 0; } @@ -87,11 +84,8 @@ static __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA) return 1; } - else { - spin_lock(&dq_data_lock); + else inode_add_bytes(inode, nr); - spin_unlock(&dq_data_lock); - } return 0; } @@ -117,11 +111,8 @@ static __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) { if (sb_any_quota_enabled(inode->i_sb)) inode->i_sb->dq_op->free_space(inode, nr); - else { - spin_lock(&dq_data_lock); + else inode_sub_bytes(inode, nr); - spin_unlock(&dq_data_lock); - } } static __inline__ void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index c32a45fd1f0d..8081a281fa5e 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h @@ -20,8 +20,7 @@ #define _LINUX_RADIX_TREE_H #include <linux/preempt.h> - -struct radix_tree_node; +#include <linux/types.h> struct radix_tree_root { unsigned int height; @@ -29,25 +28,40 @@ struct radix_tree_root { struct radix_tree_node *rnode; }; -#define RADIX_TREE_INIT(mask) {0, (mask), NULL} +#define RADIX_TREE_INIT(mask) { \ + .height = 0, \ + .gfp_mask = (mask), \ + .rnode = NULL, \ +} #define RADIX_TREE(name, mask) \ struct radix_tree_root name = RADIX_TREE_INIT(mask) -#define INIT_RADIX_TREE(root, mask) \ -do { \ - (root)->height = 0; \ - (root)->gfp_mask = (mask); \ - (root)->rnode = NULL; \ +#define INIT_RADIX_TREE(root, mask) \ +do { \ + (root)->height = 0; \ + (root)->gfp_mask = (mask); \ + (root)->rnode = NULL; \ } while (0) -extern int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); -extern void *radix_tree_lookup(struct radix_tree_root *, unsigned long); -extern void *radix_tree_delete(struct radix_tree_root *, unsigned long); -extern unsigned int +int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); +void *radix_tree_lookup(struct radix_tree_root *, unsigned long); +void *radix_tree_delete(struct radix_tree_root *, unsigned long); +unsigned int radix_tree_gang_lookup(struct radix_tree_root *root, void **results, unsigned long first_index, unsigned int max_items); int radix_tree_preload(int gfp_mask); +void radix_tree_init(void); +void *radix_tree_tag_set(struct radix_tree_root *root, + unsigned long index, int tag); +void *radix_tree_tag_clear(struct radix_tree_root *root, + unsigned long index, int tag); +int radix_tree_tag_get(struct radix_tree_root *root, + unsigned long index, int tag); +unsigned int +radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, + unsigned long first_index, unsigned int max_items, int tag); +int radix_tree_tagged(struct radix_tree_root *root, int tag); static inline void radix_tree_preload_end(void) { diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h index 240dc450dcd3..9c06e776cfc2 100644 --- a/include/linux/raid/md.h +++ b/include/linux/raid/md.h @@ -76,6 +76,7 @@ extern void md_handle_safemode(mddev_t *mddev); extern void md_done_sync(mddev_t *mddev, int blocks, int ok); extern void md_sync_acct(mdk_rdev_t *rdev, unsigned long nr_sectors); extern void md_error (mddev_t *mddev, mdk_rdev_t *rdev); +extern void md_unplug_mddev(mddev_t *mddev); extern void md_print_devices (void); diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index bea64b0fb6c1..0b6b5e6f34eb 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h @@ -315,7 +315,7 @@ typedef struct mdk_thread_s { #define THREAD_WAKEUP 0 -#define __wait_event_lock_irq(wq, condition, lock) \ +#define __wait_event_lock_irq(wq, condition, lock, cmd) \ do { \ wait_queue_t __wait; \ init_waitqueue_entry(&__wait, current); \ @@ -326,7 +326,7 @@ do { \ if (condition) \ break; \ spin_unlock_irq(&lock); \ - blk_run_queues(); \ + cmd; \ schedule(); \ spin_lock_irq(&lock); \ } \ @@ -334,36 +334,11 @@ do { \ remove_wait_queue(&wq, &__wait); \ } while (0) -#define wait_event_lock_irq(wq, condition, lock) \ +#define wait_event_lock_irq(wq, condition, lock, cmd) \ do { \ if (condition) \ break; \ - __wait_event_lock_irq(wq, condition, lock); \ -} while (0) - - -#define __wait_disk_event(wq, condition) \ -do { \ - wait_queue_t __wait; \ - init_waitqueue_entry(&__wait, current); \ - \ - add_wait_queue(&wq, &__wait); \ - for (;;) { \ - set_current_state(TASK_UNINTERRUPTIBLE); \ - if (condition) \ - break; \ - blk_run_queues(); \ - schedule(); \ - } \ - current->state = TASK_RUNNING; \ - remove_wait_queue(&wq, &__wait); \ -} while (0) - -#define wait_disk_event(wq, condition) \ -do { \ - if (condition) \ - break; \ - __wait_disk_event(wq, condition); \ + __wait_event_lock_irq(wq, condition, lock, cmd); \ } while (0) #endif diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 4e2b898a8d98..dfb46b513712 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h @@ -1702,45 +1702,90 @@ struct reiserfs_journal_header { (((block)<<(JBH_HASH_SHIFT - 6)) ^ ((block) >> 13) ^ ((block) << (JBH_HASH_SHIFT - 12)))) #define journal_hash(t,sb,block) ((t)[_jhashfn((sb),(block)) & JBH_HASH_MASK]) -/* finds n'th buffer with 0 being the start of this commit. Needs to go away, j_ap_blocks has changed -** since I created this. One chunk of code in journal.c needs changing before deleting it -*/ -#define JOURNAL_BUFFER(j,n) ((j)->j_ap_blocks[((j)->j_start + (n)) % JOURNAL_BLOCK_COUNT]) - // We need these to make journal.c code more readable #define journal_find_get_block(s, block) __find_get_block(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) #define journal_getblk(s, block) __getblk(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) #define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) +enum reiserfs_bh_state_bits { + BH_JDirty = BH_PrivateStart, + BH_JDirty_wait, + BH_JNew, + BH_JPrepared, + BH_JRestore_dirty, + BH_JTest, // debugging only will go away +}; + +/* +** transaction handle which is passed around for all journal calls +*/ +struct reiserfs_transaction_handle { + struct super_block *t_super ; /* super for this FS when journal_begin was + called. saves calls to reiserfs_get_super + also used by nested transactions to make + sure they are nesting on the right FS + _must_ be first in the handle + */ + int t_refcount; + int t_blocks_logged ; /* number of blocks this writer has logged */ + int t_blocks_allocated ; /* number of blocks this writer allocated */ + unsigned long t_trans_id ; /* sanity check, equals the current trans id */ + void *t_handle_save ; /* save existing current->journal_info */ + int displace_new_blocks:1; /* if new block allocation occurres, that block + should be displaced from others */ +} ; + +/* used to keep track of ordered and tail writes, attached to the buffer + * head through b_journal_head. + */ +struct reiserfs_jh { + struct reiserfs_journal_list *jl; + struct buffer_head *bh; + struct list_head list; +}; + +void reiserfs_free_jh(struct buffer_head *bh); +int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh); +int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh); +int journal_mark_dirty(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ; + +static inline int reiserfs_transaction_running(struct super_block *s) { + struct reiserfs_transaction_handle *th = current->journal_info ; + if (th && th->t_super == s) + return 1 ; + if (th && th->t_super == NULL) + BUG(); + return 0 ; +} + +int reiserfs_async_progress_wait(struct super_block *s); + +struct reiserfs_transaction_handle * +reiserfs_persistent_transaction(struct super_block *, int count); +int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *); +int reiserfs_commit_page(struct inode *inode, struct page *page, + unsigned from, unsigned to); +int reiserfs_flush_old_commits(struct super_block *); void reiserfs_commit_for_inode(struct inode *) ; void reiserfs_update_inode_transaction(struct inode *) ; void reiserfs_wait_on_write_block(struct super_block *s) ; void reiserfs_block_writes(struct reiserfs_transaction_handle *th) ; void reiserfs_allow_writes(struct super_block *s) ; void reiserfs_check_lock_depth(char *caller) ; -void reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, int wait) ; +int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, int wait) ; void reiserfs_restore_prepared_buffer(struct super_block *, struct buffer_head *bh) ; int journal_init(struct super_block *, const char * j_dev_name, int old_format, unsigned int) ; int journal_release(struct reiserfs_transaction_handle*, struct super_block *) ; int journal_release_error(struct reiserfs_transaction_handle*, struct super_block *) ; int journal_end(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ; int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ; -int journal_mark_dirty_nolog(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ; int journal_mark_freed(struct reiserfs_transaction_handle *, struct super_block *, b_blocknr_t blocknr) ; -int push_journal_writer(char *w) ; -int pop_journal_writer(int windex) ; int journal_transaction_should_end(struct reiserfs_transaction_handle *, int) ; int reiserfs_in_journal(struct super_block *p_s_sb, int bmap_nr, int bit_nr, int searchall, b_blocknr_t *next) ; int journal_begin(struct reiserfs_transaction_handle *, struct super_block *p_s_sb, unsigned long) ; -void flush_async_commits(struct super_block *p_s_sb) ; int buffer_journaled(const struct buffer_head *bh) ; int mark_buffer_journal_new(struct buffer_head *bh) ; -int reiserfs_add_page_to_flush_list(struct reiserfs_transaction_handle *, - struct inode *, struct buffer_head *) ; -int reiserfs_remove_page_from_flush_list(struct reiserfs_transaction_handle *, - struct inode *) ; - int reiserfs_allocate_list_bitmaps(struct super_block *s, struct reiserfs_list_bitmap *, int) ; /* why is this kerplunked right here? */ @@ -1983,8 +2028,17 @@ extern struct address_space_operations reiserfs_address_space_operations ; void * reiserfs_kmalloc (size_t size, int flags, struct super_block * s); void reiserfs_kfree (const void * vp, size_t size, struct super_block * s); #else -#define reiserfs_kmalloc(x, y, z) kmalloc(x, y) -#define reiserfs_kfree(x, y, z) kfree(x) +static inline void *reiserfs_kmalloc(size_t size, int flags, + struct super_block *s) +{ + return kmalloc(size, flags); +} + +static inline void reiserfs_kfree(const void *vp, size_t size, + struct super_block *s) +{ + kfree(vp); +} #endif int fix_nodes (int n_op_mode, struct tree_balance * p_s_tb, diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h index 87e1b74e1125..e689a12bcb9b 100644 --- a/include/linux/reiserfs_fs_i.h +++ b/include/linux/reiserfs_fs_i.h @@ -3,6 +3,8 @@ #include <linux/list.h> +struct reiserfs_journal_list; + /** bitmasks for i_flags field in reiserfs-specific part of inode */ typedef enum { /** this says what format of key do all items (but stat data) of @@ -48,7 +50,7 @@ struct reiserfs_inode_info { ** needs to be committed in order for this inode to be properly ** flushed */ unsigned long i_trans_id ; - unsigned long i_trans_index ; + struct reiserfs_journal_list *i_jl; struct inode vfs_inode; }; diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index 4c675f30a8ae..3248dcf369f2 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h @@ -106,21 +106,6 @@ typedef enum { #define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */ #define JOURNAL_HASH_SIZE 8192 #define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */ -#define JOURNAL_LIST_COUNT 64 - -/* these are bh_state bit flag offset numbers, for use in the buffer head */ - -#define BH_JDirty 16 /* journal data needs to be written before buffer can be marked dirty */ -#define BH_JDirty_wait 18 /* commit is done, buffer marked dirty */ -#define BH_JNew 19 /* buffer allocated during this transaction, no need to write if freed during this trans too */ - -/* ugly. metadata blocks must be prepared before they can be logged. -** prepared means unlocked and cleaned. If the block is prepared, but not -** logged for some reason, any bits cleared while preparing it must be -** set again. -*/ -#define BH_JPrepared 20 /* block has been prepared for the log */ -#define BH_JRestore_dirty 22 /* restore the dirty bit later */ /* One of these for every block in every transaction ** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a @@ -154,22 +139,6 @@ struct reiserfs_list_bitmap { } ; /* -** transaction handle which is passed around for all journal calls -*/ -struct reiserfs_transaction_handle { - /* ifdef it. -Hans */ - char *t_caller ; /* debugging use */ - int t_blocks_logged ; /* number of blocks this writer has logged */ - int t_blocks_allocated ; /* number of blocks this writer allocated */ - unsigned long t_trans_id ; /* sanity check, equals the current trans id */ - struct super_block *t_super ; /* super for this FS when journal_begin was - called. saves calls to reiserfs_get_super */ - int displace_new_blocks:1; /* if new block allocation occurres, that block - should be displaced from others */ - -} ; - -/* ** one of these for each transaction. The most important part here is the j_realblock. ** this list of cnodes is used to hash all the blocks in all the commits, to mark all the ** real buffer heads dirty once all the commits hit the disk, @@ -177,23 +146,30 @@ struct reiserfs_transaction_handle { ** to be overwritten */ struct reiserfs_journal_list { unsigned long j_start ; + unsigned long j_state; unsigned long j_len ; atomic_t j_nonzerolen ; atomic_t j_commit_left ; - atomic_t j_flushing ; - atomic_t j_commit_flushing ; atomic_t j_older_commits_done ; /* all commits older than this on disk*/ + struct semaphore j_commit_lock; unsigned long j_trans_id ; time_t j_timestamp ; struct reiserfs_list_bitmap *j_list_bitmap ; struct buffer_head *j_commit_bh ; /* commit buffer head */ struct reiserfs_journal_cnode *j_realblock ; struct reiserfs_journal_cnode *j_freedlist ; /* list of buffers that were freed during this trans. free each of these on flush */ - wait_queue_head_t j_commit_wait ; /* wait for all the commit blocks to be flushed */ - wait_queue_head_t j_flush_wait ; /* wait for all the real blocks to be flushed */ -} ; + /* time ordered list of all active transactions */ + struct list_head j_list; + + /* time ordered list of all transactions we haven't tried to flush yet */ + struct list_head j_working_list; -struct reiserfs_page_list ; /* defined in reiserfs_fs.h */ + /* list of tail conversion targets in need of flush before commit */ + struct list_head j_tail_bh_list; + /* list of data=ordered buffers in need of flush before commit */ + struct list_head j_bh_list; + int j_refcount; +} ; struct reiserfs_journal { struct buffer_head ** j_ap_blocks ; /* journal blocks on disk */ @@ -216,16 +192,11 @@ struct reiserfs_journal { unsigned long j_last_flush_trans_id ; /* last fully flushed journal timestamp */ struct buffer_head *j_header_bh ; - /* j_flush_pages must be flushed before the current transaction can - ** commit - */ - struct reiserfs_page_list *j_flush_pages ; time_t j_trans_start_time ; /* time this transaction started */ - wait_queue_head_t j_wait ; /* wait journal_end to finish I/O */ - atomic_t j_wlock ; /* lock for j_wait */ + struct semaphore j_lock; + struct semaphore j_flush_sem; wait_queue_head_t j_join_wait ; /* wait for current transaction to finish before starting new one */ atomic_t j_jlock ; /* lock for j_join_wait */ - int j_journal_list_index ; /* journal list number of the current trans */ int j_list_bitmap_index ; /* number of next list bitmap to use */ int j_must_wait ; /* no more journal begins allowed. MUST sleep on j_join_wait */ int j_next_full_flush ; /* next journal_end will flush all journal list */ @@ -242,19 +213,39 @@ struct reiserfs_journal { struct reiserfs_journal_cnode *j_cnode_free_list ; struct reiserfs_journal_cnode *j_cnode_free_orig ; /* orig pointer returned from vmalloc */ + struct reiserfs_journal_list *j_current_jl; int j_free_bitmap_nodes ; int j_used_bitmap_nodes ; + + int j_num_lists; /* total number of active transactions */ + int j_num_work_lists; /* number that need attention from kreiserfsd */ + + /* debugging to make sure things are flushed in order */ + int j_last_flush_id; + + /* debugging to make sure things are committed in order */ + int j_last_commit_id; + struct list_head j_bitmap_nodes ; struct list_head j_dirty_buffers ; spinlock_t j_dirty_buffers_lock ; /* protects j_dirty_buffers */ + + /* list of all active transactions */ + struct list_head j_journal_list; + /* lists that haven't been touched by writeback attempts */ + struct list_head j_working_list; + struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS] ; /* array of bitmaps to record the deleted blocks */ - struct reiserfs_journal_list j_journal_list[JOURNAL_LIST_COUNT] ; /* array of all the journal lists */ struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for real buffer heads in current trans */ struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for all the real buffer heads in all the transactions */ struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ unsigned long j_max_trans_size ; unsigned long j_max_batch_size ; + + /* when flushing ordered buffers, throttle new ordered writers */ + struct work_struct j_work; + atomic_t j_async_throttle; }; #define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */ @@ -409,12 +400,12 @@ struct reiserfs_sb_info #define REISERFS_3_5 0 #define REISERFS_3_6 1 +enum reiserfs_mount_options { /* Mount options */ -#define REISERFS_LARGETAIL 0 /* large tails will be created in a session */ -#define REISERFS_SMALLTAIL 17 /* small (for files less than block size) tails will be created in a session */ -#define REPLAYONLY 3 /* replay journal and return 0. Use by fsck */ -#define REISERFS_NOLOG 4 /* -o nolog: turn journalling off */ -#define REISERFS_CONVERT 5 /* -o conv: causes conversion of old + REISERFS_LARGETAIL, /* large tails will be created in a session */ + REISERFS_SMALLTAIL, /* small (for files less than block size) tails will be created in a session */ + REPLAYONLY, /* replay journal and return 0. Use by fsck */ + REISERFS_CONVERT, /* -o conv: causes conversion of old format super block to the new format. If not specified - old partition will be dealt with in a @@ -428,26 +419,29 @@ struct reiserfs_sb_info ** the existing hash on the FS, so if you have a tea hash disk, and mount ** with -o hash=rupasov, the mount will fail. */ -#define FORCE_TEA_HASH 6 /* try to force tea hash on mount */ -#define FORCE_RUPASOV_HASH 7 /* try to force rupasov hash on mount */ -#define FORCE_R5_HASH 8 /* try to force rupasov hash on mount */ -#define FORCE_HASH_DETECT 9 /* try to detect hash function on mount */ + FORCE_TEA_HASH, /* try to force tea hash on mount */ + FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */ + FORCE_R5_HASH, /* try to force rupasov hash on mount */ + FORCE_HASH_DETECT, /* try to detect hash function on mount */ + REISERFS_DATA_LOG, + REISERFS_DATA_ORDERED, + REISERFS_DATA_WRITEBACK, /* used for testing experimental features, makes benchmarking new features with and without more convenient, should never be used by users in any code shipped to users (ideally) */ -#define REISERFS_NO_BORDER 11 -#define REISERFS_NO_UNHASHED_RELOCATION 12 -#define REISERFS_HASHED_RELOCATION 13 - -#define REISERFS_ATTRS 15 + REISERFS_NO_BORDER, + REISERFS_NO_UNHASHED_RELOCATION, + REISERFS_HASHED_RELOCATION, + REISERFS_ATTRS, -#define REISERFS_TEST1 11 -#define REISERFS_TEST2 12 -#define REISERFS_TEST3 13 -#define REISERFS_TEST4 14 + REISERFS_TEST1, + REISERFS_TEST2, + REISERFS_TEST3, + REISERFS_TEST4, +}; #define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH)) #define reiserfs_rupasov_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_RUPASOV_HASH)) @@ -461,17 +455,15 @@ struct reiserfs_sb_info #define have_large_tails(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_LARGETAIL)) #define have_small_tails(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_SMALLTAIL)) #define replay_only(s) (REISERFS_SB(s)->s_mount_opt & (1 << REPLAYONLY)) -#define reiserfs_dont_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_NOLOG)) #define reiserfs_attrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ATTRS)) #define old_format_only(s) (REISERFS_SB(s)->s_properties & (1 << REISERFS_3_5)) #define convert_reiserfs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_CONVERT)) - +#define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG)) +#define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) +#define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) void reiserfs_file_buffer (struct buffer_head * bh, int list); extern struct file_system_type reiserfs_fs_type; -int journal_mark_dirty(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ; -int flush_old_commits(struct super_block *s, int) ; -int show_reiserfs_locks(void) ; int reiserfs_resize(struct super_block *, unsigned long) ; #define CARRY_ON 0 @@ -481,8 +473,6 @@ int reiserfs_resize(struct super_block *, unsigned long) ; #define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh) #define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal) #define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block) -#define SB_JOURNAL_LIST(s) (SB_JOURNAL(s)->j_journal_list) -#define SB_JOURNAL_LIST_INDEX(s) (SB_JOURNAL(s)->j_journal_list_index) #define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free) #define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap) diff --git a/include/linux/rmap-locking.h b/include/linux/rmap-locking.h deleted file mode 100644 index cb30ed470cf6..000000000000 --- a/include/linux/rmap-locking.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * include/linux/rmap-locking.h - * - * Locking primitives for exclusive access to a page's reverse-mapping - * pte chain. - */ - -#include <linux/slab.h> - -struct pte_chain; -extern kmem_cache_t *pte_chain_cache; - -#define pte_chain_lock(page) bit_spin_lock(PG_chainlock, (unsigned long *)&page->flags) -#define pte_chain_unlock(page) bit_spin_unlock(PG_chainlock, (unsigned long *)&page->flags) - -struct pte_chain *pte_chain_alloc(int gfp_flags); -void __pte_chain_free(struct pte_chain *pte_chain); - -static inline void pte_chain_free(struct pte_chain *pte_chain) -{ - if (pte_chain) - __pte_chain_free(pte_chain); -} diff --git a/include/linux/rmap.h b/include/linux/rmap.h new file mode 100644 index 000000000000..5f9b35f2fa65 --- /dev/null +++ b/include/linux/rmap.h @@ -0,0 +1,52 @@ +#ifndef _LINUX_RMAP_H +#define _LINUX_RMAP_H +/* + * Declarations for Reverse Mapping functions in mm/rmap.c + * Its structures are declared within that file. + */ + +#include <linux/config.h> +#include <linux/linkage.h> + +#define rmap_lock(page) \ + bit_spin_lock(PG_maplock, (unsigned long *)&(page)->flags) +#define rmap_unlock(page) \ + bit_spin_unlock(PG_maplock, (unsigned long *)&(page)->flags) + +#ifdef CONFIG_MMU + +struct pte_chain; +struct pte_chain *pte_chain_alloc(int gfp_flags); +void __pte_chain_free(struct pte_chain *pte_chain); + +static inline void pte_chain_free(struct pte_chain *pte_chain) +{ + if (pte_chain) + __pte_chain_free(pte_chain); +} + +struct pte_chain * fastcall + page_add_rmap(struct page *, pte_t *, struct pte_chain *); +void fastcall page_remove_rmap(struct page *, pte_t *); + +/* + * Called from mm/vmscan.c to handle paging out + */ +int fastcall page_referenced(struct page *); +int fastcall try_to_unmap(struct page *); + +#else /* !CONFIG_MMU */ + +#define page_referenced(page) TestClearPageReferenced(page) +#define try_to_unmap(page) SWAP_FAIL + +#endif /* CONFIG_MMU */ + +/* + * Return values of try_to_unmap + */ +#define SWAP_SUCCESS 0 +#define SWAP_AGAIN 1 +#define SWAP_FAIL 2 + +#endif /* _LINUX_RMAP_H */ diff --git a/include/linux/sched.h b/include/linux/sched.h index f5fa0c07a7f8..17bbedd6bb3d 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -170,6 +170,8 @@ extern void update_one_process(struct task_struct *p, unsigned long user, unsigned long system, int cpu); extern void scheduler_tick(int user_tick, int system); extern unsigned long cache_decay_ticks; +extern const unsigned long scheduling_functions_start_here; +extern const unsigned long scheduling_functions_end_here; #define MAX_SCHEDULE_TIMEOUT LONG_MAX @@ -267,6 +269,18 @@ struct signal_struct { /* thread group stop support, overloads group_exit_code too */ int group_stop_count; + + /* POSIX.1b Interval Timers */ + struct list_head posix_timers; + + /* job control IDs */ + pid_t pgrp; + pid_t tty_old_pgrp; + pid_t session; + /* boolean value for session group leader */ + int leader; + + struct tty_struct *tty; /* NULL if no tty */ }; /* @@ -360,6 +374,8 @@ int set_current_groups(struct group_info *group_info); ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK]) +struct audit_context; /* See audit.c */ + struct task_struct { volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ struct thread_info *thread_info; @@ -396,12 +412,7 @@ struct task_struct { unsigned long personality; int did_exec:1; pid_t pid; - pid_t __pgrp; /* Accessed via process_group() */ - pid_t tty_old_pgrp; - pid_t session; pid_t tgid; - /* boolean value for session group leader */ - int leader; /* * pointers to (original) parent process, youngest child, younger sibling, * older sibling, respectively. (p->father can be replaced with @@ -425,12 +436,11 @@ struct task_struct { unsigned long it_real_value, it_prof_value, it_virt_value; unsigned long it_real_incr, it_prof_incr, it_virt_incr; struct timer_list real_timer; - struct list_head posix_timers; /* POSIX.1b Interval Timers */ unsigned long utime, stime, cutime, cstime; unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; /* context switch counts */ u64 start_time; /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ - unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap; + unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; /* process credentials */ uid_t uid,euid,suid,fsuid; gid_t gid,egid,sgid,fsgid; @@ -444,7 +454,6 @@ struct task_struct { char comm[16]; /* file system info */ int link_count, total_link_count; - struct tty_struct *tty; /* NULL if no tty */ /* ipc stuff */ struct sysv_sem sysvsem; /* CPU-specific state of this task */ @@ -469,6 +478,7 @@ struct task_struct { sigset_t *notifier_mask; void *security; + struct audit_context *audit_context; /* Thread group tracking */ u32 parent_exec_id; @@ -497,7 +507,7 @@ struct task_struct { static inline pid_t process_group(struct task_struct *tsk) { - return tsk->group_leader->__pgrp; + return tsk->signal->pgrp; } extern void __put_task_struct(struct task_struct *tsk); @@ -720,7 +730,7 @@ extern void exit_signal(struct task_struct *); extern void __exit_signal(struct task_struct *); extern void exit_sighand(struct task_struct *); extern void __exit_sighand(struct task_struct *); -extern void exit_itimers(struct task_struct *); +extern void exit_itimers(struct signal_struct *); extern NORET_TYPE void do_group_exit(int); diff --git a/include/linux/sem.h b/include/linux/sem.h index b337c509ac29..aaf45764a56e 100644 --- a/include/linux/sem.h +++ b/include/linux/sem.h @@ -134,7 +134,22 @@ struct sysv_sem { struct sem_undo_list *undo_list; }; -void exit_sem(struct task_struct *p); +#ifdef CONFIG_SYSVIPC + +extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk); +extern void exit_sem(struct task_struct *tsk); + +#else +static inline int copy_semundo(unsigned long clone_flags, struct task_struct *tsk) +{ + return 0; +} + +static inline void exit_sem(struct task_struct *tsk) +{ + return; +} +#endif #endif /* __KERNEL__ */ diff --git a/include/linux/slab.h b/include/linux/slab.h index 69be5b308a11..806cc52abd3a 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -25,9 +25,7 @@ typedef struct kmem_cache_s kmem_cache_t; #define SLAB_KERNEL GFP_KERNEL #define SLAB_DMA GFP_DMA -#define SLAB_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS|\ - __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT|\ - __GFP_NOFAIL|__GFP_NORETRY) +#define SLAB_LEVEL_MASK GFP_LEVEL_MASK #define SLAB_NO_GROW __GFP_NO_GROW /* don't grow a cache */ diff --git a/include/linux/sunrpc/name_lookup.h b/include/linux/sunrpc/name_lookup.h deleted file mode 100644 index 0c97ec324ada..000000000000 --- a/include/linux/sunrpc/name_lookup.h +++ /dev/null @@ -1,38 +0,0 @@ - -/* - * map between user/group name and id for a given 'client' - */ - -struct name_ent { - char name[20]; -}; -static inline int name_get_user(int uid, struct name_ent **namep) -{ - struct name_ent *n = kmalloc(sizeof(*n),GFP_KERNEL); - if (n) sprintf(n->name, "%d",uid); - *namep = n; - return n ? 0 : -ENOMEM; -} -static inline int name_get_group(int uid, struct name_ent **namep) -{ - struct name_ent *n = kmalloc(sizeof(*n),GFP_KERNEL); - if (n) sprintf(n->name, "%d",uid); - *namep = n; - return n ? 0 : -ENOMEM; -} -static inline int name_get_uid(char *name, int name_len, int *uidp) -{ - *uidp = simple_strtoul(name, NULL, 0); - return 0; -} - -static inline int name_get_gid(char *name, int name_len, int *gidp) -{ - *gidp = simple_strtoul(name, NULL, 0); - return 0; -} - -static inline void name_put(struct name_ent *ent) -{ - kfree(ent); -} diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h index 73ca6ef2c4a8..a444c9edb9e9 100644 --- a/include/linux/sunrpc/svcauth_gss.h +++ b/include/linux/sunrpc/svcauth_gss.h @@ -22,14 +22,5 @@ int gss_svc_init(void); int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); - -struct gss_svc_data { - /* decoded gss client cred: */ - struct rpc_gss_wire_cred clcred; - /* pointer to the beginning of the procedure-specific results, which - * may be encrypted/checksummed in svcauth_gss_release: */ - u32 *body_start; -}; - #endif /* __KERNEL__ */ #endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */ diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 0ccaff2cdee2..2b334dc19962 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h @@ -145,6 +145,7 @@ extern void _copy_from_pages(char *, struct page **, size_t, size_t); extern void xdr_buf_from_iov(struct iovec *, struct xdr_buf *); extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, int, int); extern int xdr_buf_read_netobj(struct xdr_buf *, struct xdr_netobj *, int); +extern int read_bytes_from_xdr_buf(struct xdr_buf *buf, int base, void *obj, int len); /* * Helper structure for copying from an sk_buff. diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 810947658d59..7e4409b7c55b 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -24,7 +24,7 @@ typedef struct pbe { #define SWAP_FILENAME_MAXLENGTH 32 struct suspend_header { - __u32 version_code; + u32 version_code; unsigned long num_physpages; char machine[8]; char version[20]; diff --git a/include/linux/swap.h b/include/linux/swap.h index b000c56803b8..f911d8afb8a5 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -76,7 +76,6 @@ struct reclaim_state { #ifdef __KERNEL__ struct address_space; -struct pte_chain; struct sysinfo; struct writeback_control; struct zone; @@ -177,25 +176,12 @@ extern int try_to_free_pages(struct zone **, unsigned int, unsigned int); extern int shrink_all_memory(int); extern int vm_swappiness; -/* linux/mm/rmap.c */ #ifdef CONFIG_MMU -int FASTCALL(page_referenced(struct page *)); -struct pte_chain *FASTCALL(page_add_rmap(struct page *, pte_t *, - struct pte_chain *)); -void FASTCALL(page_remove_rmap(struct page *, pte_t *)); -int FASTCALL(try_to_unmap(struct page *)); - /* linux/mm/shmem.c */ extern int shmem_unuse(swp_entry_t entry, struct page *page); -#else -#define page_referenced(page) TestClearPageReferenced(page) -#define try_to_unmap(page) SWAP_FAIL #endif /* CONFIG_MMU */ -/* return values of try_to_unmap */ -#define SWAP_SUCCESS 0 -#define SWAP_AGAIN 1 -#define SWAP_FAIL 2 +extern void swap_unplug_io_fn(struct backing_dev_info *); #ifdef CONFIG_SWAP /* linux/mm/page_io.c */ @@ -232,6 +218,7 @@ extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t); extern struct swap_info_struct *get_swap_info_struct(unsigned); extern int can_share_swap_page(struct page *); extern int remove_exclusive_swap_page(struct page *); +struct backing_dev_info; extern struct swap_list_t swap_list; extern spinlock_t swaplock; diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index aaf87aeacafb..89ffe55898f2 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -48,6 +48,7 @@ struct timex; struct timezone; struct tms; struct utimbuf; +struct mq_attr; #include <linux/config.h> #include <linux/types.h> @@ -450,6 +451,13 @@ asmlinkage long sys_shmget(key_t key, size_t size, int flag); asmlinkage long sys_shmdt(char __user *shmaddr); asmlinkage long sys_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); +asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr); +asmlinkage long sys_mq_unlink(const char __user *name); +asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout); +asmlinkage ssize_t sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout); +asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification); +asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat); + asmlinkage long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn); asmlinkage long sys_pciconfig_read(unsigned long bus, unsigned long dfn, unsigned long off, unsigned long len, diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 3767428df94d..d2224f6617f9 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -159,6 +159,8 @@ enum VM_LOWER_ZONE_PROTECTION=20,/* Amount of protection of lower zones */ VM_MIN_FREE_KBYTES=21, /* Minimum free kilobytes to maintain */ VM_MAX_MAP_COUNT=22, /* int: Maximum number of mmaps/address-space */ + VM_LAPTOP_MODE=23, /* vm laptop mode */ + VM_BLOCK_DUMP=24, /* block dump mode */ }; diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index b34de79dcf3b..de2083939b74 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -18,6 +18,12 @@ struct attribute { mode_t mode; }; +struct attribute_group { + char * name; + struct attribute ** attrs; +}; + + struct bin_attribute { struct attribute attr; size_t size; @@ -25,14 +31,13 @@ struct bin_attribute { ssize_t (*write)(struct kobject *, char *, loff_t, size_t); }; -int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr); -int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr); - struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *,char *); ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); }; +#ifdef CONFIG_SYSFS + extern int sysfs_create_dir(struct kobject *); @@ -57,13 +62,75 @@ sysfs_create_link(struct kobject * kobj, struct kobject * target, char * name); extern void sysfs_remove_link(struct kobject *, char * name); - -struct attribute_group { - char * name; - struct attribute ** attrs; -}; +int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr); +int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr); int sysfs_create_group(struct kobject *, const struct attribute_group *); void sysfs_remove_group(struct kobject *, const struct attribute_group *); +#else /* CONFIG_SYSFS */ + +static inline int sysfs_create_dir(struct kobject * k) +{ + return 0; +} + +static inline void sysfs_remove_dir(struct kobject * k) +{ + ; +} + +static inline void sysfs_rename_dir(struct kobject * k, const char *new_name) +{ + ; +} + +static inline int sysfs_create_file(struct kobject * k, const struct attribute * a) +{ + return 0; +} + +static inline int sysfs_update_file(struct kobject * k, const struct attribute * a) +{ + return 0; +} + +static inline void sysfs_remove_file(struct kobject * k, const struct attribute * a) +{ + ; +} + +static inline int sysfs_create_link(struct kobject * k, struct kobject * t, char * n) +{ + return 0; +} + +static inline void sysfs_remove_link(struct kobject * k, char * name) +{ + ; +} + + +static inline int sysfs_create_bin_file(struct kobject * k, struct bin_attribute * a) +{ + return 0; +} + +static inline int sysfs_remove_bin_file(struct kobject * k, struct bin_attribute * a) +{ + return 0; +} + +static inline int sysfs_create_group(struct kobject * k, const struct attribute_group *g) +{ + return 0; +} + +static inline void sysfs_remove_group(struct kobject * k, const struct attribute_group * g) +{ + ; +} + +#endif /* CONFIG_SYSFS */ + #endif /* _SYSFS_H_ */ diff --git a/include/linux/tty.h b/include/linux/tty.h index fbcc401e8b28..6e61f3b27157 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -363,6 +363,9 @@ extern void tty_flip_buffer_push(struct tty_struct *tty); extern int tty_get_baud_rate(struct tty_struct *tty); extern int tty_termios_baud_rate(struct termios *termios); +struct semaphore; +extern struct semaphore tty_sem; + /* n_tty.c */ extern struct tty_ldisc tty_ldisc_N_TTY; diff --git a/include/linux/types.h b/include/linux/types.h index 3b407b06b48f..23c414f11cbe 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -8,8 +8,6 @@ (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG) #define DECLARE_BITMAP(name,bits) \ unsigned long name[BITS_TO_LONGS(bits)] -#define CLEAR_BITMAP(name,bits) \ - memset(name, 0, BITS_TO_LONGS(bits)*sizeof(unsigned long)) #endif #include <linux/posix_types.h> @@ -31,6 +29,7 @@ typedef __kernel_key_t key_t; typedef __kernel_suseconds_t suseconds_t; typedef __kernel_timer_t timer_t; typedef __kernel_clockid_t clockid_t; +typedef __kernel_mqd_t mqd_t; #ifdef __KERNEL__ typedef __kernel_uid32_t uid_t; diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 4e421d3d25ed..cfcf6f1cd0e2 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -430,6 +430,7 @@ struct video_code #define VID_HARDWARE_VICAM 34 #define VID_HARDWARE_SF16FMR2 35 #define VID_HARDWARE_W9968CF 36 +#define VID_HARDWARE_SAA7114H 37 #endif /* __LINUX_VIDEODEV_H */ /* diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 1bfc45a4a430..a4ab8e826bbe 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -869,7 +869,7 @@ struct v4l2_streamparm #define VIDIOC_S_MODULATOR _IOW ('V', 55, struct v4l2_modulator) #define VIDIOC_G_FREQUENCY _IOWR ('V', 56, struct v4l2_frequency) #define VIDIOC_S_FREQUENCY _IOW ('V', 57, struct v4l2_frequency) -#define VIDIOC_CROPCAP _IOR ('V', 58, struct v4l2_cropcap) +#define VIDIOC_CROPCAP _IOWR ('V', 58, struct v4l2_cropcap) #define VIDIOC_G_CROP _IOWR ('V', 59, struct v4l2_crop) #define VIDIOC_S_CROP _IOW ('V', 60, struct v4l2_crop) #define VIDIOC_G_JPEGCOMP _IOR ('V', 61, struct v4l2_jpegcompression) @@ -887,6 +887,7 @@ struct v4l2_streamparm #define VIDIOC_S_CTRL_OLD _IOW ('V', 28, struct v4l2_control) #define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) #define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) +#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) #define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 1424811e1eab..f557b55e8b0a 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -39,6 +39,7 @@ struct writeback_control { older than this */ long nr_to_write; /* Write this many pages, and decrement this for each page written */ + long pages_skipped; /* Pages which were not written */ int nonblocking; /* Don't get stuck on request queues */ int encountered_congestion; /* An output: a queue is full */ int for_kupdate; /* A kupdate writeback */ @@ -71,12 +72,16 @@ static inline void wait_on_inode(struct inode *inode) * mm/page-writeback.c */ int wakeup_bdflush(long nr_pages); +void laptop_io_completion(void); +void laptop_sync_completion(void); -/* These 5 are exported to sysctl. */ +/* These are exported to sysctl. */ extern int dirty_background_ratio; extern int vm_dirty_ratio; extern int dirty_writeback_centisecs; extern int dirty_expire_centisecs; +extern int block_dump; +extern int laptop_mode; struct ctl_table; struct file; diff --git a/include/media/audiochip.h b/include/media/audiochip.h index 1fbc90e53232..fadc32dab628 100644 --- a/include/media/audiochip.h +++ b/include/media/audiochip.h @@ -15,6 +15,8 @@ #define AUDIO_INTERN 0x03 #define AUDIO_OFF 0x04 #define AUDIO_ON 0x05 +#define AUDIO_EXTERN_1 AUDIO_EXTERN +#define AUDIO_EXTERN_2 0x06 #define AUDIO_MUTE 0x80 #define AUDIO_UNMUTE 0x81 diff --git a/include/sound/es1688.h b/include/sound/es1688.h index 104bb9b022cc..d390c64768f5 100644 --- a/include/sound/es1688.h +++ b/include/sound/es1688.h @@ -55,6 +55,8 @@ struct _snd_es1688 { typedef struct _snd_es1688 es1688_t; +#define chip_t es1688_t + /* I/O ports */ #define ES1688P(codec, x) ((codec)->port + e_s_s_ESS1688##x) |
