diff options
Diffstat (limited to 'include')
51 files changed, 893 insertions, 471 deletions
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h index 1428fd95b987..23ac5227b702 100644 --- a/include/asm-generic/bitops.h +++ b/include/asm-generic/bitops.h @@ -51,6 +51,12 @@ extern __inline__ int test_bit(int nr, long * addr) return ((mask & *addr) != 0); } +/* + * fls: find last bit set. + */ + +#define fls(x) generic_fls(x) + #ifdef __KERNEL__ /* diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 778990a36b41..f6a028acdebd 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -16,8 +16,17 @@ #include <linux/config.h> #include <asm/tlbflush.h> -/* aim for something that fits in the L1 cache */ -#define FREE_PTE_NR 508 +/* + * For UP we don't need to worry about TLB flush + * and page free order so much.. + */ +#ifdef CONFIG_SMP + #define FREE_PTE_NR 507 + #define tlb_fast_mode(tlb) ((tlb)->nr == ~0UL) +#else + #define FREE_PTE_NR 1 + #define tlb_fast_mode(tlb) 1 +#endif /* mmu_gather_t is an opaque type used by the mm code for passing around any * data needed by arch specific code for tlb_remove_page. This structure can @@ -34,10 +43,6 @@ typedef struct free_pte_ctx { /* Users of the generic TLB shootdown code must declare this storage space. */ extern mmu_gather_t mmu_gathers[NR_CPUS]; -/* Do me later */ -#define tlb_start_vma(tlb, vma) do { } while (0) -#define tlb_end_vma(tlb, vma) do { } while (0) - /* tlb_gather_mmu * Return a pointer to an initialized mmu_gather_t. */ @@ -57,9 +62,9 @@ static inline void tlb_flush_mmu(mmu_gather_t *tlb, unsigned long start, unsigne { unsigned long nr; - flush_tlb_mm(tlb->mm); + tlb_flush(tlb); nr = tlb->nr; - if (nr != ~0UL) { + if (!tlb_fast_mode(tlb)) { unsigned long i; tlb->nr = 0; for (i=0; i < nr; i++) @@ -81,6 +86,9 @@ static inline void tlb_finish_mmu(mmu_gather_t *tlb, unsigned long start, unsign freed = rss; mm->rss = rss - freed; tlb_flush_mmu(tlb, start, end); + + /* keep the page table cache within bounds */ + check_pgt_cache(); } @@ -91,8 +99,7 @@ static inline void tlb_finish_mmu(mmu_gather_t *tlb, unsigned long start, unsign */ static inline void tlb_remove_page(mmu_gather_t *tlb, struct page *page) { - /* Handle the common case fast, first. */\ - if (tlb->nr == ~0UL) { + if (tlb_fast_mode(tlb)) { free_page_and_swap_cache(page); return; } diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index 4e1b7c04df41..4cf9d29ef4ad 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h @@ -414,6 +414,12 @@ static __inline__ unsigned long __ffs(unsigned long word) return word; } +/* + * fls: find last bit set. + */ + +#define fls(x) generic_fls(x) + #ifdef __KERNEL__ /* diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h index c34d242f4ea0..1deae4309f86 100644 --- a/include/asm-i386/bugs.h +++ b/include/asm-i386/bugs.h @@ -186,7 +186,7 @@ static void __init check_config(void) */ #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_GOOD_APIC) if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL - && test_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability) + && cpu_has_apic && boot_cpu_data.x86 == 5 && boot_cpu_data.x86_model == 2 && (boot_cpu_data.x86_mask < 6 || boot_cpu_data.x86_mask == 11)) diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h index 3104bc340061..f0becf88e4a0 100644 --- a/include/asm-i386/cpufeature.h +++ b/include/asm-i386/cpufeature.h @@ -7,9 +7,6 @@ #ifndef __ASM_I386_CPUFEATURE_H #define __ASM_I386_CPUFEATURE_H -/* Sample usage: CPU_FEATURE_P(cpu.x86_capability, FPU) */ -#define CPU_FEATURE_P(CAP, FEATURE) test_bit(CAP, X86_FEATURE_##FEATURE ##_BIT) - #define NCAPINTS 4 /* Currently we have 4 32-bit words worth of info */ /* Intel-defined CPU features, CPUID level 0x00000001, word 0 */ @@ -65,6 +62,28 @@ #define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */ #define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */ + +#define cpu_has(c, bit) test_bit(bit, (c)->x86_capability) +#define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability) + +#define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU) +#define cpu_has_vme boot_cpu_has(X86_FEATURE_VME) +#define cpu_has_de boot_cpu_has(X86_FEATURE_DE) +#define cpu_has_pse boot_cpu_has(X86_FEATURE_PSE) +#define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC) +#define cpu_has_pae boot_cpu_has(X86_FEATURE_PAE) +#define cpu_has_pge boot_cpu_has(X86_FEATURE_PGE) +#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC) +#define cpu_has_mtrr boot_cpu_has(X86_FEATURE_MTRR) +#define cpu_has_mmx boot_cpu_has(X86_FEATURE_MMX) +#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR) +#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM) +#define cpu_has_ht boot_cpu_has(X86_FEATURE_HT) +#define cpu_has_mp boot_cpu_has(X86_FEATURE_MP) +#define cpu_has_k6_mtrr boot_cpu_has(X86_FEATURE_K6_MTRR) +#define cpu_has_cyrix_arr boot_cpu_has(X86_FEATURE_CYRIX_ARR) +#define cpu_has_centaur_mcr boot_cpu_has(X86_FEATURE_CENTAUR_MCR) + #endif /* __ASM_I386_CPUFEATURE_H */ /* diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h index 4b9c0b312206..417f2378659d 100644 --- a/include/asm-i386/mmu_context.h +++ b/include/asm-i386/mmu_context.h @@ -38,7 +38,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, str set_bit(cpu, &next->cpu_vm_mask); /* Re-load page tables */ - asm volatile("movl %0,%%cr3": :"r" (__pa(next->pgd))); + load_cr3(next->pgd); /* load_LDT, if either the previous or next thread * has a non-default LDT. @@ -53,9 +53,9 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, str BUG(); if(!test_and_set_bit(cpu, &next->cpu_vm_mask)) { /* We were in lazy tlb mode and leave_mm disabled - * tlb flush IPI delivery. We must flush our tlb. + * tlb flush IPI delivery. We must reload %cr3. */ - local_flush_tlb(); + load_cr3(next->pgd); load_LDT(&next->context); } } diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 21fab1d41018..0e72ad90e1e9 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -77,18 +77,6 @@ extern struct cpuinfo_x86 cpu_data[]; #define current_cpu_data boot_cpu_data #endif -#define cpu_has_pge (test_bit(X86_FEATURE_PGE, boot_cpu_data.x86_capability)) -#define cpu_has_pse (test_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability)) -#define cpu_has_pae (test_bit(X86_FEATURE_PAE, boot_cpu_data.x86_capability)) -#define cpu_has_tsc (test_bit(X86_FEATURE_TSC, boot_cpu_data.x86_capability)) -#define cpu_has_de (test_bit(X86_FEATURE_DE, boot_cpu_data.x86_capability)) -#define cpu_has_vme (test_bit(X86_FEATURE_VME, boot_cpu_data.x86_capability)) -#define cpu_has_fxsr (test_bit(X86_FEATURE_FXSR, boot_cpu_data.x86_capability)) -#define cpu_has_xmm (test_bit(X86_FEATURE_XMM, boot_cpu_data.x86_capability)) -#define cpu_has_fpu (test_bit(X86_FEATURE_FPU, boot_cpu_data.x86_capability)) -#define cpu_has_apic (test_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability)) -#define cpu_has_mp (test_bit(X86_FEATURE_MP, boot_cpu_data.x86_capability)) - extern char ignore_irq13; extern void identify_cpu(struct cpuinfo_x86 *); @@ -173,6 +161,10 @@ static inline unsigned int cpuid_edx(unsigned int op) return edx; } +#define load_cr3(pgdir) \ + asm volatile("movl %0,%%cr3": :"r" (__pa(pgdir))) + + /* * Intel CPU features in CR4 */ diff --git a/include/asm-i386/suspend.h b/include/asm-i386/suspend.h new file mode 100644 index 000000000000..0bf90bb1c806 --- /dev/null +++ b/include/asm-i386/suspend.h @@ -0,0 +1,304 @@ +#ifndef __ASM_I386_SUSPEND_H +#define __ASM_I386_SUSPEND_H +#endif + +/* + * Copyright 2001-2002 Pavel Machek <pavel@suse.cz> + * Based on code + * Copyright 2001 Patrick Mochel <mochel@osdl.org> + */ +#if defined(SUSPEND_C) || defined(ACPI_C) +#include <asm/desc.h> +#include <asm/i387.h> + +static inline void +arch_prepare_suspend(void) +{ + if (!cpu_has_pse) + panic("pse required"); +} + +/* image of the saved processor state */ +struct saved_context { + u32 eax, ebx, ecx, edx; + u32 esp, ebp, esi, edi; + u16 es, fs, gs, ss; + u32 cr0, cr2, cr3, cr4; + u16 gdt_pad; + u16 gdt_limit; + u32 gdt_base; + u16 idt_pad; + u16 idt_limit; + u32 idt_base; + u16 ldt; + u16 tss; + u32 tr; + u32 safety; + u32 return_address; + u32 eflags; +} __attribute__((packed)); + +static struct saved_context saved_context; + +#define loaddebug(thread,register) \ + __asm__("movl %0,%%db" #register \ + : /* no output */ \ + :"r" ((thread)->debugreg[register])) + + +/* + * save_processor_context + * + * Save the state of the processor before we go to sleep. + * + * return_stack is the value of the stack pointer (%esp) as the caller sees it. + * A good way could not be found to obtain it from here (don't want to make _too_ + * many assumptions about the layout of the stack this far down.) Also, the + * handy little __builtin_frame_pointer(level) where level > 0, is blatantly + * buggy - it returns the value of the stack at the proper location, not the + * location, like it should (as of gcc 2.91.66) + * + * Note that the context and timing of this function is pretty critical. + * With a minimal amount of things going on in the caller and in here, gcc + * does a good job of being just a dumb compiler. Watch the assembly output + * if anything changes, though, and make sure everything is going in the right + * place. + */ +static inline void save_processor_context (void) +{ + kernel_fpu_begin(); + + /* + * descriptor tables + */ + asm volatile ("sgdt (%0)" : "=m" (saved_context.gdt_limit)); + asm volatile ("sidt (%0)" : "=m" (saved_context.idt_limit)); + asm volatile ("sldt (%0)" : "=m" (saved_context.ldt)); + asm volatile ("str (%0)" : "=m" (saved_context.tr)); + + /* + * save the general registers. + * note that gcc has constructs to specify output of certain registers, + * but they're not used here, because it assumes that you want to modify + * those registers, so it tries to be smart and save them beforehand. + * It's really not necessary, and kinda fishy (check the assembly output), + * so it's avoided. + */ + asm volatile ("movl %%esp, (%0)" : "=m" (saved_context.esp)); + asm volatile ("movl %%eax, (%0)" : "=m" (saved_context.eax)); + asm volatile ("movl %%ebx, (%0)" : "=m" (saved_context.ebx)); + asm volatile ("movl %%ecx, (%0)" : "=m" (saved_context.ecx)); + asm volatile ("movl %%edx, (%0)" : "=m" (saved_context.edx)); + asm volatile ("movl %%ebp, (%0)" : "=m" (saved_context.ebp)); + asm volatile ("movl %%esi, (%0)" : "=m" (saved_context.esi)); + asm volatile ("movl %%edi, (%0)" : "=m" (saved_context.edi)); + + /* + * segment registers + */ + asm volatile ("movw %%es, %0" : "=r" (saved_context.es)); + asm volatile ("movw %%fs, %0" : "=r" (saved_context.fs)); + asm volatile ("movw %%gs, %0" : "=r" (saved_context.gs)); + asm volatile ("movw %%ss, %0" : "=r" (saved_context.ss)); + + /* + * control registers + */ + asm volatile ("movl %%cr0, %0" : "=r" (saved_context.cr0)); + asm volatile ("movl %%cr2, %0" : "=r" (saved_context.cr2)); + asm volatile ("movl %%cr3, %0" : "=r" (saved_context.cr3)); + asm volatile ("movl %%cr4, %0" : "=r" (saved_context.cr4)); + + /* + * eflags + */ + asm volatile ("pushfl ; popl (%0)" : "=m" (saved_context.eflags)); +} + +static void fix_processor_context(void) +{ + int nr = smp_processor_id(); + struct tss_struct * t = &init_tss[nr]; + + set_tss_desc(nr,t); /* This just modifies memory; should not be neccessary. But... This is neccessary, because 386 hardware has concept of busy tsc or some similar stupidity. */ + gdt_table[__TSS(nr)].b &= 0xfffffdff; + + load_TR(nr); /* This does ltr */ + + load_LDT(¤t->mm->context); /* This does lldt */ + + /* + * Now maybe reload the debug registers + */ + if (current->thread.debugreg[7]){ + loaddebug(¤t->thread, 0); + loaddebug(¤t->thread, 1); + loaddebug(¤t->thread, 2); + loaddebug(¤t->thread, 3); + /* no 4 and 5 */ + loaddebug(¤t->thread, 6); + loaddebug(¤t->thread, 7); + } + +} + +static void +do_fpu_end(void) +{ + /* restore FPU regs if necessary */ + /* Do it out of line so that gcc does not move cr0 load to some stupid place */ + kernel_fpu_end(); +} + +/* + * restore_processor_context + * + * Restore the processor context as it was before we went to sleep + * - descriptor tables + * - control registers + * - segment registers + * - flags + * + * Note that it is critical that this function is declared inline. + * It was separated out from restore_state to make that function + * a little clearer, but it needs to be inlined because we won't have a + * stack when we get here (so we can't push a return address). + */ +static inline void restore_processor_context (void) +{ + /* + * first restore %ds, so we can access our data properly + */ + asm volatile (".align 4"); + asm volatile ("movw %0, %%ds" :: "r" ((u16)__KERNEL_DS)); + + + /* + * control registers + */ + asm volatile ("movl %0, %%cr4" :: "r" (saved_context.cr4)); + asm volatile ("movl %0, %%cr3" :: "r" (saved_context.cr3)); + asm volatile ("movl %0, %%cr2" :: "r" (saved_context.cr2)); + asm volatile ("movl %0, %%cr0" :: "r" (saved_context.cr0)); + + /* + * segment registers + */ + asm volatile ("movw %0, %%es" :: "r" (saved_context.es)); + asm volatile ("movw %0, %%fs" :: "r" (saved_context.fs)); + asm volatile ("movw %0, %%gs" :: "r" (saved_context.gs)); + asm volatile ("movw %0, %%ss" :: "r" (saved_context.ss)); + + /* + * the other general registers + * + * note that even though gcc has constructs to specify memory + * input into certain registers, it will try to be too smart + * and save them at the beginning of the function. This is esp. + * bad since we don't have a stack set up when we enter, and we + * want to preserve the values on exit. So, we set them manually. + */ + asm volatile ("movl %0, %%esp" :: "m" (saved_context.esp)); + asm volatile ("movl %0, %%ebp" :: "m" (saved_context.ebp)); + asm volatile ("movl %0, %%eax" :: "m" (saved_context.eax)); + asm volatile ("movl %0, %%ebx" :: "m" (saved_context.ebx)); + asm volatile ("movl %0, %%ecx" :: "m" (saved_context.ecx)); + asm volatile ("movl %0, %%edx" :: "m" (saved_context.edx)); + asm volatile ("movl %0, %%esi" :: "m" (saved_context.esi)); + asm volatile ("movl %0, %%edi" :: "m" (saved_context.edi)); + + /* + * now restore the descriptor tables to their proper values + */ + asm volatile ("lgdt (%0)" :: "m" (saved_context.gdt_limit)); + asm volatile ("lidt (%0)" :: "m" (saved_context.idt_limit)); + asm volatile ("lldt (%0)" :: "m" (saved_context.ldt)); + +#if 0 + asm volatile ("ltr (%0)" :: "m" (saved_context.tr)); +#endif + + fix_processor_context(); + + /* + * the flags + */ + asm volatile ("pushl %0 ; popfl" :: "m" (saved_context.eflags)); + + do_fpu_end(); +} + +#endif +#ifdef SUSPEND_C +#if 1 +/* Local variables for do_magic */ +static int loop __nosavedata = 0; +static int loop2 __nosavedata = 0; + +/* + * (KG): Since we affect stack here, we make this function as flat and easy + * as possible in order to not provoke gcc to use local variables on the stack. + * Note that on resume, all (expect nosave) variables will have the state from + * the time of writing (suspend_save_image) and the registers (including the + * stack pointer, but excluding the instruction pointer) will be loaded with + * the values saved at save_processor_context() time. + */ +static void do_magic(int resume) +{ + /* DANGER WILL ROBINSON! + * + * If this function is too difficult for gcc to optimize, it will crash and burn! + * see above. + * + * DO NOT TOUCH. + */ + + if (!resume) { + do_magic_suspend_1(); + save_processor_context(); /* We need to capture registers and memory at "same time" */ + do_magic_suspend_2(); /* If everything goes okay, this function does not return */ + return; + } + + /* We want to run from swapper_pg_dir, since swapper_pg_dir is stored in constant + * place in memory + */ + + __asm__( "movl %%ecx,%%cr3\n" ::"c"(__pa(swapper_pg_dir))); + +/* + * Final function for resuming: after copying the pages to their original + * position, it restores the register state. + */ + + do_magic_resume_1(); + + /* Critical section here: noone should touch memory from now */ + /* This works, because nr_copy_pages, pagedir_nosave, loop and loop2 are nosavedata */ + for (loop=0; loop < nr_copy_pages; loop++) { + /* You may not call something (like copy_page) here: + We may absolutely not use stack at this point */ + for (loop2=0; loop2 < PAGE_SIZE; loop2++) { + *(((char *)((pagedir_nosave+loop)->orig_address))+loop2) = + *(((char *)((pagedir_nosave+loop)->address))+loop2); + __flush_tlb(); + } + } +/* FIXME: What about page tables? Writing data pages may toggle + accessed/dirty bits in our page tables. That should be no problems + with 4MB page tables. That's why we require have_pse. */ + +/* Danger: previous loop probably destroyed our current stack. Better hope it did not use + any stack space, itself. + + When this function is entered at resume time, we move stack to _old_ place. + This is means that this function must use no stack and no local variables in registers. +*/ + restore_processor_context(); +/* Ahah, we now run with our old stack, and with registers copied from suspend time */ + + do_magic_resume_2(); +} +#endif +#endif + diff --git a/include/asm-i386/tlb.h b/include/asm-i386/tlb.h index 69c0faa93194..b91e6abd1fd4 100644 --- a/include/asm-i386/tlb.h +++ b/include/asm-i386/tlb.h @@ -1 +1,20 @@ +#ifndef _I386_TLB_H +#define _I386_TLB_H + +/* + * x86 doesn't need any special per-pte or + * per-vma handling.. + */ +#define tlb_start_vma(tlb, vma, start, end) do { } while (0) +#define tlb_end_vma(tlb, vma, start, end) do { } while (0) +#define tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) + +/* + * .. because we flush the whole mm when it + * fills up. + */ +#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) + #include <asm-generic/tlb.h> + +#endif diff --git a/include/asm-i386/xor.h b/include/asm-i386/xor.h index 1e90675975e1..4647afdcdf3d 100644 --- a/include/asm-i386/xor.h +++ b/include/asm-i386/xor.h @@ -839,8 +839,6 @@ static struct xor_block_template xor_block_pIII_sse = { /* Also try the generic routines. */ #include <asm-generic/xor.h> -#define cpu_has_mmx (test_bit(X86_FEATURE_MMX, boot_cpu_data.x86_capability)) - #undef XOR_TRY_TEMPLATES #define XOR_TRY_TEMPLATES \ do { \ diff --git a/include/asm-m68k/motorola_pgalloc.h b/include/asm-m68k/motorola_pgalloc.h index df57aa48cf4f..0c75827ae0c3 100644 --- a/include/asm-m68k/motorola_pgalloc.h +++ b/include/asm-m68k/motorola_pgalloc.h @@ -1,175 +1,111 @@ #ifndef _MOTOROLA_PGALLOC_H #define _MOTOROLA_PGALLOC_H -#include <asm/tlbflush.h> - -extern struct pgtable_cache_struct { - unsigned long *pmd_cache; - unsigned long *pte_cache; -/* This counts in units of pointer tables, of which can be eight per page. */ - unsigned long pgtable_cache_sz; -} quicklists; - -#define pgd_quicklist ((unsigned long *)0) -#define pmd_quicklist (quicklists.pmd_cache) -#define pte_quicklist (quicklists.pte_cache) -/* This isn't accurate because of fragmentation of allocated pages for - pointer tables, but that should not be a problem. */ -#define pgtable_cache_size ((quicklists.pgtable_cache_sz+7)/8) - -extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long offset); -extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long offset); +#include <asm/tlb.h> extern pmd_t *get_pointer_table(void); extern int free_pointer_table(pmd_t *); -extern inline pte_t *get_pte_fast(void) +static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) { - unsigned long *ret; - - ret = pte_quicklist; - if (ret) { - pte_quicklist = (unsigned long *)*ret; - ret[0] = 0; - quicklists.pgtable_cache_sz -= 8; - } - return (pte_t *)ret; -} -#define pte_alloc_one_fast(mm,addr) get_pte_fast() - -static inline pte_t *pte_alloc_one(struct mm_struct *mm, unsigned long address) -{ - pte_t *pte; + pte_t *pte; pte = (pte_t *) __get_free_page(GFP_KERNEL); if (pte) { - clear_page(pte); - __flush_page_to_ram((unsigned long)pte); - flush_tlb_kernel_page((unsigned long)pte); - nocache_page((unsigned long)pte); - } + clear_page(pte); + __flush_page_to_ram((unsigned long)pte); + flush_tlb_kernel_page((unsigned long)pte); + nocache_page((unsigned long)pte); + } return pte; } - -extern __inline__ pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) -{ - return get_pointer_table(); -} - - -extern inline void free_pte_fast(pte_t *pte) -{ - *(unsigned long *)pte = (unsigned long)pte_quicklist; - pte_quicklist = (unsigned long *)pte; - quicklists.pgtable_cache_sz += 8; -} - -extern inline void free_pte_slow(pte_t *pte) +static inline void pte_free_kernel(pte_t *pte) { cache_page((unsigned long)pte); free_page((unsigned long) pte); } -extern inline pmd_t *get_pmd_fast(void) +static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) { - unsigned long *ret; + struct page *page = alloc_pages(GFP_KERNEL, 0); + pte_t *pte; + + if(!page) + return NULL; - ret = pmd_quicklist; - if (ret) { - pmd_quicklist = (unsigned long *)*ret; - ret[0] = 0; - quicklists.pgtable_cache_sz--; + pte = kmap(page); + if (pte) { + clear_page(pte); + __flush_page_to_ram((unsigned long)pte); + flush_tlb_kernel_page((unsigned long)pte); + nocache_page((unsigned long)pte); } - return (pmd_t *)ret; -} -#define pmd_alloc_one_fast(mm,addr) get_pmd_fast() + kunmap(pte); -extern inline void free_pmd_fast(pmd_t *pmd) -{ - *(unsigned long *)pmd = (unsigned long)pmd_quicklist; - pmd_quicklist = (unsigned long *) pmd; - quicklists.pgtable_cache_sz++; + return page; } -extern inline int free_pmd_slow(pmd_t *pmd) +static inline void pte_free(struct page *page) { - return free_pointer_table(pmd); + cache_page((unsigned long)kmap(page)); + kunmap(page); + __free_page(page); } -/* The pgd cache is folded into the pmd cache, so these are dummy routines. */ -extern inline pgd_t *get_pgd_fast(void) +static inline void pte_free_tlb(mmu_gather_t *tlb, struct page *page) { - return (pgd_t *)0; + cache_page((unsigned long)kmap(page)); + kunmap(page); + __free_page(page); } -extern inline void free_pgd_fast(pgd_t *pgd) -{ -} -extern inline void free_pgd_slow(pgd_t *pgd) +static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) { + return get_pointer_table(); } -extern void __bad_pte(pmd_t *pmd); -extern void __bad_pmd(pgd_t *pgd); - -extern inline void pte_free(pte_t *pte) +static inline int pmd_free(pmd_t *pmd) { - free_pte_fast(pte); + return free_pointer_table(pmd); } -extern inline void pmd_free(pmd_t *pmd) +static inline int pmd_free_tlb(mmu_gather_t *tlb, pmd_t *pmd) { - free_pmd_fast(pmd); + return free_pointer_table(pmd); } -extern inline void pte_free_kernel(pte_t *pte) +static inline void pgd_free(pgd_t *pgd) { - free_pte_fast(pte); + pmd_free((pmd_t *)pgd); } -extern inline pte_t *pte_alloc_kernel(pmd_t *pmd, unsigned long address) +static inline pgd_t *pgd_alloc(struct mm_struct *mm) { - return pte_alloc(&init_mm,pmd, address); + return (pgd_t *)get_pointer_table(); } -extern inline void pmd_free_kernel(pmd_t *pmd) -{ - free_pmd_fast(pmd); -} -extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) +static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) { - return pmd_alloc(&init_mm,pgd, address); + pmd_set(pmd, pte); } -extern inline void pgd_free(pgd_t *pgd) +static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page) { - free_pmd_fast((pmd_t *)pgd); + pmd_set(pmd, page_address(page)); } -extern inline pgd_t *pgd_alloc(struct mm_struct *mm) +static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd) { - pgd_t *pgd = (pgd_t *)get_pmd_fast(); - if (!pgd) - pgd = (pgd_t *)get_pointer_table(); - return pgd; + pgd_set(pgd, pmd); } -#define pmd_populate(MM, PMD, PTE) pmd_set(PMD, PTE) -#define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD) - - -extern int do_check_pgt_cache(int, int); - -extern inline void set_pgdir(unsigned long address, pgd_t entry) -{ -} - +#define check_pgt_cache() do { } while (0) #endif /* _MOTOROLA_PGALLOC_H */ diff --git a/include/asm-m68k/sun3_pgalloc.h b/include/asm-m68k/sun3_pgalloc.h index 31c32a96c11d..75e735e8c12c 100644 --- a/include/asm-m68k/sun3_pgalloc.h +++ b/include/asm-m68k/sun3_pgalloc.h @@ -1,88 +1,43 @@ /* sun3_pgalloc.h -- * reorganization around 2.3.39, routines moved from sun3_pgtable.h * + * + * 02/27/2002 -- Modified to support "highpte" implementation in 2.5.5 (Sam) + * * moved 1/26/2000 Sam Creasey */ #ifndef _SUN3_PGALLOC_H #define _SUN3_PGALLOC_H -/* Pagetable caches. */ -//todo: should implement for at least ptes. --m -#define pgd_quicklist ((unsigned long *) 0) -#define pmd_quicklist ((unsigned long *) 0) -#define pte_quicklist ((unsigned long *) 0) -#define pgtable_cache_size (0L) - -/* Allocation and deallocation of various flavours of pagetables. */ -extern inline int free_pmd_fast (pmd_t *pmdp) { return 0; } -extern inline int free_pmd_slow (pmd_t *pmdp) { return 0; } -extern inline pmd_t *get_pmd_fast (void) { return (pmd_t *) 0; } - -//todo: implement the following properly. -#define get_pte_fast() ((pte_t *) 0) -#define get_pte_slow pte_alloc -#define free_pte_fast(pte) -#define free_pte_slow pte_free +#include <asm/tlb.h> /* FIXME - when we get this compiling */ /* erm, now that it's compiling, what do we do with it? */ #define _KERNPG_TABLE 0 -extern inline void pte_free_kernel(pte_t * pte) -{ - free_page((unsigned long) pte); -} - extern const char bad_pmd_string[]; -extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - pte_t * page = (pte_t *) get_free_page(GFP_KERNEL); - if (pmd_none(*pmd)) { - if (page) { - pmd_val(*pmd) = _KERNPG_TABLE + __pa(page); - return page + address; - } - pmd_val(*pmd) = _KERNPG_TABLE + __pa((unsigned long)BAD_PAGETABLE); - return NULL; - } - free_page((unsigned long) page); - } - if (pmd_bad(*pmd)) { - printk(bad_pmd_string, pmd_val(*pmd)); - printk("at kernel pgd off %08x\n", (unsigned int)pmd); - pmd_val(*pmd) = _KERNPG_TABLE + __pa((unsigned long)BAD_PAGETABLE); - return NULL; - } - return (pte_t *) __pmd_page(*pmd) + address; -} +#define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -extern inline void pmd_free_kernel(pmd_t * pmd) + +static inline void pte_free_kernel(pte_t * pte) { -// pmd_val(*pmd) = 0; + free_page((unsigned long) pte); } -extern inline pmd_t * pmd_alloc_kernel(pgd_t * pgd, unsigned long address) +static inline void pte_free(struct page *page) { - return (pmd_t *) pgd; + __free_page(page); } -#define pmd_alloc_one_fast(mm, address) ({ BUG(); ((pmd_t *)1); }) -#define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) - -extern inline void pte_free(pte_t * pte) +static inline void pte_free_tlb(mmu_gather_t *tlb, struct page *page) { - free_page((unsigned long) pte); + tlb_remove_page(tlb, page); } -static inline pte_t *pte_alloc_one(struct mm_struct *mm, unsigned long address) +static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, + unsigned long address) { unsigned long page = __get_free_page(GFP_KERNEL); @@ -90,30 +45,45 @@ static inline pte_t *pte_alloc_one(struct mm_struct *mm, unsigned long address) return NULL; memset((void *)page, 0, PAGE_SIZE); -// pmd_val(*pmd) = SUN3_PMD_MAGIC + __pa(page); -/* pmd_val(*pmd) = __pa(page); */ return (pte_t *) (page); } -#define pte_alloc_one_fast(mm,addr) pte_alloc_one(mm,addr) +static inline struct page *pte_alloc_one(struct mm_struct *mm, + unsigned long address) +{ + struct page *page = alloc_pages(GFP_KERNEL, 0); + + if (page == NULL) + return NULL; + + clear_highpage(page); + return page; + +} + +static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) +{ + pmd_val(*pmd) = __pa((unsigned long)pte); +} -#define pmd_populate(mm, pmd, pte) (pmd_val(*pmd) = __pa((unsigned long)pte)) +static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page) +{ + pmd_val(*pmd) = __pa((unsigned long)page_address(page)); +} /* * allocating and freeing a pmd is trivial: the 1-entry pmd is * inside the pgd, so has no extra memory associated with it. */ -extern inline void pmd_free(pmd_t * pmd) -{ - pmd_val(*pmd) = 0; -} +#define pmd_free(x) do { } while (0) +#define pmd_free_tlb(tlb, x) do { } while (0) -extern inline void pgd_free(pgd_t * pgd) +static inline void pgd_free(pgd_t * pgd) { free_page((unsigned long) pgd); } -extern inline pgd_t * pgd_alloc(struct mm_struct *mm) +static inline pgd_t * pgd_alloc(struct mm_struct *mm) { pgd_t *new_pgd; @@ -125,14 +95,6 @@ extern inline pgd_t * pgd_alloc(struct mm_struct *mm) #define pgd_populate(mm, pmd, pte) BUG() -/* FIXME: the sun3 doesn't have a page table cache! - (but the motorola routine should just return 0) */ - -extern int do_check_pgt_cache(int, int); - -extern inline void set_pgdir(unsigned long address, pgd_t entry) -{ -} /* Reserved PMEGs. */ extern char sun3_reserved_pmeg[SUN3_PMEGS_NUM]; @@ -141,5 +103,6 @@ extern unsigned char pmeg_alloc[SUN3_PMEGS_NUM]; extern unsigned char pmeg_ctx[SUN3_PMEGS_NUM]; +#define check_pgt_cache() do { } while (0) #endif /* SUN3_PGALLOC_H */ diff --git a/include/asm-m68k/tlb.h b/include/asm-m68k/tlb.h index 69c0faa93194..51cfcd3c4855 100644 --- a/include/asm-m68k/tlb.h +++ b/include/asm-m68k/tlb.h @@ -1 +1,20 @@ +#ifndef _M68K_TLB_H +#define _M68K_TLB_H + +/* + * m68k doesn't need any special per-pte or + * per-vma handling.. + */ +#define tlb_start_vma(tlb, vma) do { } while (0) +#define tlb_end_vma(tlb, vma) do { } while (0) +#define tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) + +/* + * .. because we flush the whole mm when it + * fills up. + */ +#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) + #include <asm-generic/tlb.h> + +#endif /* _M68K_TLB_H */ diff --git a/include/asm-sparc/pgalloc.h b/include/asm-sparc/pgalloc.h index f55ef69a3d88..0a620fbbeb69 100644 --- a/include/asm-sparc/pgalloc.h +++ b/include/asm-sparc/pgalloc.h @@ -117,7 +117,6 @@ BTFIXUPDEF_CALL(void, free_pgd_fast, pgd_t *) static __inline__ pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) { - BUG(); return 0; } diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h index d26fd0326a03..6a95593c2d52 100644 --- a/include/asm-sparc/sbus.h +++ b/include/asm-sparc/sbus.h @@ -112,13 +112,13 @@ extern void sbus_free_consistent(struct sbus_dev *, long, void *, u32); #define SBUS_DMA_NONE 3 /* All the rest use streaming mode mappings. */ -extern u32 sbus_map_single(struct sbus_dev *, void *, long, int); -extern void sbus_unmap_single(struct sbus_dev *, u32, long, int); +extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int); +extern void sbus_unmap_single(struct sbus_dev *, dma_addr_t, size_t, int); extern int sbus_map_sg(struct sbus_dev *, struct scatterlist *, int, int); extern void sbus_unmap_sg(struct sbus_dev *, struct scatterlist *, int, int); /* Finally, allow explicit synchronization of streamable mappings. */ -extern void sbus_dma_sync_single(struct sbus_dev *, u32, long, int); +extern void sbus_dma_sync_single(struct sbus_dev *, dma_addr_t, size_t, int); extern void sbus_dma_sync_sg(struct sbus_dev *, struct scatterlist *, int, int); #endif /* !(_SPARC_SBUS_H) */ diff --git a/include/asm-sparc64/tlb.h b/include/asm-sparc64/tlb.h index 69c0faa93194..f0e011119b40 100644 --- a/include/asm-sparc64/tlb.h +++ b/include/asm-sparc64/tlb.h @@ -1 +1,18 @@ +#ifndef _SPARC64_TLB_H +#define _SPARC64_TLB_H + +#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) + +#define tlb_start_vma(tlb, vma, start, end) \ + flush_cache_range(vma, start, end) +#define tlb_end_vma(tlb, vma, start, end) \ + flush_tlb_range(vma, start, end) + +#define tlb_remove_tlb_entry(tlb, pte, address) do { } while (0) + #include <asm-generic/tlb.h> + +#define pmd_free_tlb(tlb, pmd) pmd_free(pmd) +#define pte_free_tlb(tlb, pte) pte_free(pte) + +#endif /* _SPARC64_TLB_H */ diff --git a/include/asm-sparc64/tlbflush.h b/include/asm-sparc64/tlbflush.h index 4b0241d94e40..e618167d79f3 100644 --- a/include/asm-sparc64/tlbflush.h +++ b/include/asm-sparc64/tlbflush.h @@ -36,6 +36,16 @@ do { if(CTX_VALID((__vma)->vm_mm->context)) { \ } \ } while(0) +#define flush_tlb_vpte_range(__mm, start, end) \ +do { if(CTX_VALID((__mm)->context)) { \ + unsigned long __start = (start)&PAGE_MASK; \ + unsigned long __end = PAGE_ALIGN(end); \ + __flush_tlb_range(CTX_HWBITS((__mm)->context), __start, \ + SECONDARY_CONTEXT, __end, PAGE_SIZE, \ + (__end - __start)); \ + } \ +} while(0) + #define flush_tlb_page(vma, page) \ do { struct mm_struct *__mm = (vma)->vm_mm; \ if(CTX_VALID(__mm->context)) \ @@ -43,11 +53,18 @@ do { struct mm_struct *__mm = (vma)->vm_mm; \ SECONDARY_CONTEXT); \ } while(0) +#define flush_tlb_vpte_page(mm, addr) \ +do { struct mm_struct *__mm = (mm); \ + if(CTX_VALID(__mm->context)) \ + __flush_tlb_page(CTX_HWBITS(__mm->context), (addr)&PAGE_MASK, \ + SECONDARY_CONTEXT); \ +} while(0) + #else /* CONFIG_SMP */ extern void smp_flush_tlb_all(void); extern void smp_flush_tlb_mm(struct mm_struct *mm); -extern void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, +extern void smp_flush_tlb_range(struct mm_struct *mm, unsigned long start, unsigned long end); extern void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end); extern void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page); @@ -56,11 +73,15 @@ extern void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page); #define flush_tlb_all() smp_flush_tlb_all() #define flush_tlb_mm(mm) smp_flush_tlb_mm(mm) #define flush_tlb_range(vma, start, end) \ - smp_flush_tlb_range(vma, start, end) + smp_flush_tlb_range((vma)->vm_mm, start, end) +#define flush_tlb_vpte_range(mm, start, end) \ + smp_flush_tlb_range(mm, start, end) #define flush_tlb_kernel_range(start, end) \ smp_flush_tlb_kernel_range(start, end) #define flush_tlb_page(vma, page) \ smp_flush_tlb_page((vma)->vm_mm, page) +#define flush_tlb_vpte_page(mm, page) \ + smp_flush_tlb_page((mm), page) #endif /* ! CONFIG_SMP */ @@ -81,13 +102,10 @@ static __inline__ void flush_tlb_pgtables(struct mm_struct *mm, unsigned long st vpte_base = (tlb_type == spitfire ? VPTE_BASE_SPITFIRE : VPTE_BASE_CHEETAH); - { - struct vm_area_struct vma; - vma.vm_mm = mm; - flush_tlb_range(&vma, - vpte_base + (s >> (PAGE_SHIFT - 3)), - vpte_base + (e >> (PAGE_SHIFT - 3))); - } + + flush_tlb_vpte_range(mm, + vpte_base + (s >> (PAGE_SHIFT - 3)), + vpte_base + (e >> (PAGE_SHIFT - 3))); } #endif /* _SPARC64_TLBFLUSH_H */ diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index 3c1d4e2c4d36..b2b7f22d1618 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h @@ -91,6 +91,7 @@ extern struct cpuinfo_x86 cpu_data[]; #define cpu_has_de 1 #define cpu_has_vme 1 #define cpu_has_fxsr 1 +#define cpu_has_mmx 1 #define cpu_has_xmm 1 #define cpu_has_apic 1 diff --git a/include/linux/atapi.h b/include/linux/atapi.h new file mode 100644 index 000000000000..6a6e2e36a6ff --- /dev/null +++ b/include/linux/atapi.h @@ -0,0 +1,65 @@ +/**** vi:set ts=8 sts=8 sw=8:************************************************ + * + * Copyright (C) 2002 Marcin Dalecki <martin@dalecki.de> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + * + * 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. + */ + +/* + * With each packet command, we allocate a buffer. + * This is used for several packet + * commands (Not for READ/WRITE commands). + */ +#define IDEFLOPPY_PC_BUFFER_SIZE 256 +#define IDETAPE_PC_BUFFER_SIZE 256 + +/* This struct get's shared between different drivers. + */ +struct atapi_packet_command { + u8 c[12]; /* Actual packet bytes */ + char *buffer; /* Data buffer */ + int buffer_size; /* Size of our data buffer */ + char *current_position; /* Pointer into the above buffer */ + int request_transfer; /* Bytes to transfer */ + int actually_transferred; /* Bytes actually transferred */ + + unsigned long flags; /* Status/Action bit flags: long for set_bit */ + + /* FIXME: the following is ugly as hell, but the only way we can start + * actually to unify the code. + */ + /* driver specific data. */ + /* floppy/tape */ + int retries; /* On each retry, we increment retries */ + int error; /* Error code */ + char *b_data; /* Pointer which runs on the buffers */ + unsigned int b_count; /* Missing/Available data on the current buffer */ + u8 pc_buffer[IDEFLOPPY_PC_BUFFER_SIZE]; /* Temporary buffer */ + /* Called when this packet command is completed */ + void (*callback) (struct ata_device *, struct request *); + + /* only tape */ + struct bio *bio; + + /* only scsi */ + struct { + unsigned int b_count; /* Bytes transferred from current entry */ + struct scatterlist *sg; /* Scatter gather table */ + struct scsi_cmnd *scsi_cmd; /* SCSI command */ + void (*done)(struct scsi_cmnd *); /* Scsi completion routine */ + unsigned long timeout; /* Command timeout */ + } s; +}; + + +extern void atapi_discard_data(struct ata_device *drive, unsigned int bcount); +extern void atapi_write_zeros(struct ata_device *drive, unsigned int bcount); + +extern void atapi_init_pc(struct atapi_packet_command *pc); diff --git a/include/linux/bfs_fs.h b/include/linux/bfs_fs.h index 0c6349eec459..f7f0913cd110 100644 --- a/include/linux/bfs_fs.h +++ b/include/linux/bfs_fs.h @@ -6,9 +6,6 @@ #ifndef _LINUX_BFS_FS_H #define _LINUX_BFS_FS_H -#include <linux/bfs_fs_i.h> -#include <linux/bfs_fs_sb.h> - #define BFS_BSIZE_BITS 9 #define BFS_BSIZE (1<<BFS_BSIZE_BITS) @@ -79,26 +76,4 @@ struct bfs_super_block { #define BFS_UNCLEAN(bfs_sb, sb) \ ((bfs_sb->s_from != -1) && (bfs_sb->s_to != -1) && !(sb->s_flags & MS_RDONLY)) -#ifdef __KERNEL__ - -/* file.c */ -extern struct inode_operations bfs_file_inops; -extern struct file_operations bfs_file_operations; -extern struct address_space_operations bfs_aops; - -/* dir.c */ -extern struct inode_operations bfs_dir_inops; -extern struct file_operations bfs_dir_operations; - -static inline struct bfs_sb_info *BFS_SB(struct super_block *sb) -{ - return sb->u.generic_sbp; -} - -static inline struct bfs_inode_info *BFS_I(struct inode *inode) -{ - return list_entry(inode, struct bfs_inode_info, vfs_inode); -} - -#endif /* __KERNEL__ */ #endif /* _LINUX_BFS_FS_H */ diff --git a/include/linux/bfs_fs_i.h b/include/linux/bfs_fs_i.h deleted file mode 100644 index 5a85f1dc143f..000000000000 --- a/include/linux/bfs_fs_i.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * include/linux/bfs_fs_i.h - * Copyright (C) 1999 Tigran Aivazian <tigran@veritas.com> - */ - -#ifndef _LINUX_BFS_FS_I -#define _LINUX_BFS_FS_I - -#include <linux/fs.h> - -/* - * BFS file system in-core inode info - */ -struct bfs_inode_info { - unsigned long i_dsk_ino; /* inode number from the disk, can be 0 */ - unsigned long i_sblock; - unsigned long i_eblock; - struct inode vfs_inode; -}; - -#endif /* _LINUX_BFS_FS_I */ diff --git a/include/linux/bfs_fs_sb.h b/include/linux/bfs_fs_sb.h deleted file mode 100644 index efdc30ec7241..000000000000 --- a/include/linux/bfs_fs_sb.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * include/linux/bfs_fs_sb.h - * Copyright (C) 1999 Tigran Aivazian <tigran@veritas.com> - */ - -#ifndef _LINUX_BFS_FS_SB -#define _LINUX_BFS_FS_SB - -/* - * BFS file system in-core superblock info - */ -struct bfs_sb_info { - unsigned long si_blocks; - unsigned long si_freeb; - unsigned long si_freei; - unsigned long si_lf_ioff; - unsigned long si_lf_sblk; - unsigned long si_lf_eblk; - unsigned long si_lasti; - char * si_imap; - struct buffer_head * si_sbh; /* buffer header w/superblock */ - struct bfs_super_block * si_bfs_sb; /* superblock in si_sbh->b_data */ -}; - -#endif /* _LINUX_BFS_FS_SB */ diff --git a/include/linux/bitops.h b/include/linux/bitops.h index b155b779696b..39f3b34a75d5 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -1,6 +1,6 @@ #ifndef _LINUX_BITOPS_H #define _LINUX_BITOPS_H - +#include <asm/bitops.h> /* * ffs: find first bit set. This is defined the same way as @@ -38,6 +38,47 @@ static inline int generic_ffs(int x) } /* + * fls: find last bit set. + */ + +extern __inline__ int generic_fls(int x) +{ + int r = 32; + + if (!x) + return 0; + if (!(x & 0xffff0000)) { + x <<= 16; + r -= 16; + } + if (!(x & 0xff000000)) { + x <<= 8; + r -= 8; + } + if (!(x & 0xf0000000)) { + x <<= 4; + r -= 4; + } + if (!(x & 0xc0000000)) { + x <<= 2; + r -= 2; + } + if (!(x & 0x80000000)) { + x <<= 1; + r -= 1; + } + return r; +} + +extern __inline__ int get_bitmask_order(unsigned int count) +{ + int order; + + order = fls(count); + return order; /* We could be slightly more clever with -1 here... */ +} + +/* * hweightN: returns the hamming weight (i.e. the number * of bits set) of a N-bit word */ diff --git a/include/linux/blk.h b/include/linux/blk.h index 62d37b2b4c17..290e30367b8e 100644 --- a/include/linux/blk.h +++ b/include/linux/blk.h @@ -313,22 +313,11 @@ static void (*DEVICE_INTR)(void) = NULL; #define SET_INTR(x) (DEVICE_INTR = (x)) -#ifdef DEVICE_INTR -#define CLEAR_INTR SET_INTR(NULL) -#else -#define CLEAR_INTR -#endif - -#define INIT_REQUEST \ - if (QUEUE_EMPTY) { \ - CLEAR_INTR; \ - return; \ - } \ - if (major(CURRENT->rq_dev) != MAJOR_NR) \ - panic(DEVICE_NAME ": request list destroyed"); \ - if (!CURRENT->bio) \ - panic(DEVICE_NAME ": no bio"); \ - +# ifdef DEVICE_INTR +# define CLEAR_INTR SET_INTR(NULL) +# else +# define CLEAR_INTR +# endif #endif /* !defined(IDE_DRIVER) */ /* diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index ac373e6a2454..32729e1e3c5b 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -303,7 +303,6 @@ extern void blk_recount_segments(request_queue_t *, struct bio *); extern inline int blk_phys_contig_segment(request_queue_t *q, struct bio *, struct bio *); extern inline int blk_hw_contig_segment(request_queue_t *q, struct bio *, struct bio *); extern int block_ioctl(struct block_device *, unsigned int, unsigned long); -extern int ll_10byte_cmd_build(request_queue_t *, struct request *); /* * get ready for proper ref counting diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h index ff5363b19923..0847c29a9175 100644 --- a/include/linux/coda_linux.h +++ b/include/linux/coda_linux.h @@ -40,7 +40,8 @@ int coda_flush(struct file *f); int coda_release(struct inode *i, struct file *f); int coda_permission(struct inode *inode, int mask); int coda_revalidate_inode(struct dentry *); -int coda_notify_change(struct dentry *, struct iattr *); +int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *); +int coda_setattr(struct dentry *, struct iattr *); int coda_isnullfid(ViceFid *fid); /* global variables */ diff --git a/include/linux/fs.h b/include/linux/fs.h index ab0a05dc8e26..95cd02771592 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -27,6 +27,7 @@ #include <asm/atomic.h> struct poll_table_struct; +struct nameidata; /* @@ -605,16 +606,6 @@ extern void kill_fasync(struct fasync_struct **, int, int); /* only for net: no internal synchronization */ extern void __kill_fasync(struct fasync_struct *, int, int); -struct nameidata { - struct dentry *dentry; - struct vfsmount *mnt; - struct qstr last; - unsigned int flags; - int last_type; - struct dentry *old_dentry; - struct vfsmount *old_mnt; -}; - /* * Umount options */ @@ -707,9 +698,6 @@ extern int vfs_rmdir(struct inode *, struct dentry *); extern int vfs_unlink(struct inode *, struct dentry *); extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); -extern struct dentry *lock_rename(struct dentry *, struct dentry *); -extern void unlock_rename(struct dentry *, struct dentry *); - /* * File types */ @@ -781,9 +769,8 @@ struct inode_operations { int (*follow_link) (struct dentry *, struct nameidata *); void (*truncate) (struct inode *); int (*permission) (struct inode *, int); - int (*revalidate) (struct dentry *); int (*setattr) (struct dentry *, struct iattr *); - int (*getattr) (struct dentry *, struct iattr *); + int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); int (*setxattr) (struct dentry *, const char *, void *, size_t, int); ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); ssize_t (*listxattr) (struct dentry *, char *, size_t); @@ -1168,25 +1155,6 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *); #include <linux/err.h> /* - * The bitmask for a lookup event: - * - follow links at the end - * - require a directory - * - ending slashes ok even for nonexistent files - * - internal "there are more path compnents" flag - * - locked when lookup done with dcache_lock held - */ -#define LOOKUP_FOLLOW (1) -#define LOOKUP_DIRECTORY (2) -#define LOOKUP_CONTINUE (4) -#define LOOKUP_PARENT (16) -#define LOOKUP_NOALT (32) - -/* - * Type of the last component on LOOKUP_PARENT - */ -enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; - -/* * "descriptor" for what we're up to with a read for sendfile(). * This allows us to use the same read code yet * have multiple different users of the data that @@ -1207,19 +1175,6 @@ typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, u /* needed for stackable file system support */ extern loff_t default_llseek(struct file *file, loff_t offset, int origin); -extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *)); -extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *)); -extern int FASTCALL(path_walk(const char *, struct nameidata *)); -extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *)); -extern int FASTCALL(link_path_walk(const char *, struct nameidata *)); -extern void path_release(struct nameidata *); -extern int follow_down(struct vfsmount **, struct dentry **); -extern int follow_up(struct vfsmount **, struct dentry **); -extern struct dentry * lookup_one_len(const char *, struct dentry *, int); -extern struct dentry * lookup_hash(struct qstr *, struct dentry *); -#define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW, nd) -#define user_path_walk_link(name,nd) __user_walk(name, 0, nd) - extern void inode_init_once(struct inode *); extern void iput(struct inode *); extern void force_delete(struct inode *); @@ -1283,6 +1238,7 @@ extern int vfs_follow_link(struct nameidata *, const char *); extern int page_readlink(struct dentry *, char *, int); extern int page_follow_link(struct dentry *, struct nameidata *); extern struct inode_operations page_symlink_inode_operations; +extern void generic_fillattr(struct inode *, struct kstat *); extern int vfs_readdir(struct file *, filldir_t, void *); @@ -1296,6 +1252,9 @@ extern void drop_super(struct super_block *sb); extern kdev_t ROOT_DEV; extern char root_device_name[]; +extern int dcache_dir_open(struct inode *, struct file *); +extern int dcache_dir_close(struct inode *, struct file *); +extern loff_t dcache_dir_lseek(struct file *, loff_t, int); extern int dcache_readdir(struct file *, void *, filldir_t); extern int simple_statfs(struct super_block *, struct statfs *); extern struct dentry *simple_lookup(struct inode *, struct dentry *); diff --git a/include/linux/futex.h b/include/linux/futex.h index 5ebcc879b4c0..d913c30590df 100644 --- a/include/linux/futex.h +++ b/include/linux/futex.h @@ -2,7 +2,7 @@ #define _LINUX_FUTEX_H /* Second argument to futex syscall */ -#define FUTEX_UP (0) -#define FUTEX_DOWN (1) +#define FUTEX_WAIT (0) +#define FUTEX_WAKE (1) #endif diff --git a/include/linux/ide.h b/include/linux/ide.h index a66146efd024..16b7c97aff33 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -40,9 +40,6 @@ /* Right now this is only needed by a promise controlled. */ -#ifndef DISK_RECOVERY_TIME /* off=0; on=access_delay_time */ -# define DISK_RECOVERY_TIME 0 /* for hardware that needs it */ -#endif #ifndef OK_TO_RESET_CONTROLLER /* 1 needed for good error recovery */ # define OK_TO_RESET_CONTROLLER 0 /* 0 for use with AH2372A/B interface */ #endif @@ -202,7 +199,8 @@ typedef enum { ide_cmd646, ide_cy82c693, ide_pmac, - ide_etrax100 + ide_etrax100, + ide_acorn } hwif_chipset_t; @@ -447,6 +445,7 @@ struct ata_channel { * between differen queues sharing the same irq line. */ spinlock_t *lock; + unsigned long *active; /* active processing request */ ide_startstop_t (*handler)(struct ata_device *, struct request *); /* irq handler, if active */ struct timer_list timer; /* failsafe timer */ @@ -454,7 +453,6 @@ struct ata_channel { unsigned long poll_timeout; /* timeout value during polled operations */ struct ata_device *drive; /* last serviced drive */ - unsigned long active; /* active processing request */ ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */ hw_regs_t hw; /* hardware info */ @@ -547,10 +545,6 @@ struct ata_channel { unsigned slow : 1; /* flag: slow data port */ unsigned io_32bit : 1; /* 0=16-bit, 1=32-bit */ unsigned char bus_state; /* power state of the IDE bus */ - -#if (DISK_RECOVERY_TIME > 0) - unsigned long last_time; /* time when previous rq was done */ -#endif }; /* @@ -642,7 +636,7 @@ extern int noautodma; #define LOCAL_END_REQUEST /* Don't generate end_request in blk.h */ #include <linux/blk.h> -extern int __ide_end_request(struct ata_device *, struct request *, int, int); +extern int __ide_end_request(struct ata_device *, struct request *, int, unsigned int); extern int ide_end_request(struct ata_device *drive, struct request *, int); /* @@ -784,11 +778,9 @@ void ide_init_subdrivers (void); extern struct block_device_operations ide_fops[]; -#ifdef CONFIG_BLK_DEV_IDE /* Probe for devices attached to the systems host controllers. */ -extern int ideprobe_init (void); -#endif +extern int ideprobe_init(void); #ifdef CONFIG_BLK_DEV_IDEDISK extern int idedisk_init (void); #endif @@ -863,6 +855,15 @@ static inline void udma_irq_lost(struct ata_device *drive) #ifdef CONFIG_BLK_DEV_IDEDMA +void udma_pci_enable(struct ata_device *drive, int on, int verbose); +int udma_pci_start(struct ata_device *drive, struct request *rq); +int udma_pci_stop(struct ata_device *drive); +int udma_pci_read(struct ata_device *drive, struct request *rq); +int udma_pci_write(struct ata_device *drive, struct request *rq); +int udma_pci_irq_status(struct ata_device *drive); +void udma_pci_timeout(struct ata_device *drive); +void udma_pci_irq_lost(struct ata_device *); + extern int udma_new_table(struct ata_channel *, struct request *); extern void udma_destroy_table(struct ata_channel *); extern void udma_print(struct ata_device *); diff --git a/include/linux/init.h b/include/linux/init.h index 142ec2f3aa68..ca7e75f37883 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -169,6 +169,9 @@ typedef void (*__cleanup_module_func_t)(void); #endif +/* Data marked not to be saved by software_suspend() */ +#define __nosavedata __attribute__ ((__section__ (".data.nosave"))) + #ifdef CONFIG_HOTPLUG #define __devinit #define __devinitdata diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 67bce357a7a1..90446b0d75e5 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -124,14 +124,6 @@ enum TASKLET_STATE_RUN /* Tasklet is running (SMP only) */ }; -struct tasklet_head -{ - struct tasklet_struct *list; -} __attribute__ ((__aligned__(SMP_CACHE_BYTES))); - -extern struct tasklet_head tasklet_vec[NR_CPUS]; -extern struct tasklet_head tasklet_hi_vec[NR_CPUS]; - #ifdef CONFIG_SMP static inline int tasklet_trylock(struct tasklet_struct *t) { diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h new file mode 100644 index 000000000000..a33b2bcfc625 --- /dev/null +++ b/include/linux/jiffies.h @@ -0,0 +1,30 @@ +#ifndef _LINUX_JIFFIES_H +#define _LINUX_JIFFIES_H + +/* + * The 64-bit value is not volatile - you MUST NOT read it + * without holding read_lock_irq(&xtime_lock) + */ +extern u64 jiffies_64; +extern unsigned long volatile jiffies; + +/* + * These inlines deal with timer wrapping correctly. You are + * strongly encouraged to use them + * 1. Because people otherwise forget + * 2. Because if the timer wrap changes in future you wont have to + * alter your driver code. + * + * time_after(a,b) returns true if the time a is after time b. + * + * Do this with "<0" and ">=0" to only test the sign of the result. A + * good compiler would generate better code (and a really good compiler + * wouldn't care). Gcc is currently neither. + */ +#define time_after(a,b) ((long)(b) - (long)(a) < 0) +#define time_before(a,b) time_after(b,a) + +#define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0) +#define time_before_eq(a,b) time_after_eq(b,a) + +#endif diff --git a/include/linux/namei.h b/include/linux/namei.h new file mode 100644 index 000000000000..2c789cf0d4fc --- /dev/null +++ b/include/linux/namei.h @@ -0,0 +1,56 @@ +#ifndef _LINUX_NAMEI_H +#define _LINUX_NAMEI_H + +struct vfsmount; + +struct nameidata { + struct dentry *dentry; + struct vfsmount *mnt; + struct qstr last; + unsigned int flags; + int last_type; + struct dentry *old_dentry; + struct vfsmount *old_mnt; +}; + +/* + * Type of the last component on LOOKUP_PARENT + */ +enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; + +/* + * The bitmask for a lookup event: + * - follow links at the end + * - require a directory + * - ending slashes ok even for nonexistent files + * - internal "there are more path compnents" flag + * - locked when lookup done with dcache_lock held + */ +#define LOOKUP_FOLLOW 1 +#define LOOKUP_DIRECTORY 2 +#define LOOKUP_CONTINUE 4 +#define LOOKUP_PARENT 16 +#define LOOKUP_NOALT 32 + + +extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *)); +#define user_path_walk(name,nd) \ + __user_walk(name, LOOKUP_FOLLOW, nd) +#define user_path_walk_link(name,nd) \ + __user_walk(name, 0, nd) +extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *)); +extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *)); +extern int FASTCALL(path_walk(const char *, struct nameidata *)); +extern int FASTCALL(link_path_walk(const char *, struct nameidata *)); +extern void path_release(struct nameidata *); + +extern struct dentry * lookup_one_len(const char *, struct dentry *, int); +extern struct dentry * lookup_hash(struct qstr *, struct dentry *); + +extern int follow_down(struct vfsmount **, struct dentry **); +extern int follow_up(struct vfsmount **, struct dentry **); + +extern struct dentry *lock_rename(struct dentry *, struct dentry *); +extern void unlock_rename(struct dentry *, struct dentry *); + +#endif /* _LINUX_NAMEI_H */ diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 46c2b72e33f3..5899abd26a44 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -158,26 +158,5 @@ extern void nf_invalidate_cache(int pf); #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) #endif /*CONFIG_NETFILTER*/ -/* From arch/i386/kernel/smp.c: - * - * Why isn't this somewhere standard ?? - * - * Maybe because this procedure is horribly buggy, and does - * not deserve to live. Think about signedness issues for five - * seconds to see why. - Linus - */ - -/* Two signed, return a signed. */ -#define SMAX(a,b) ((ssize_t)(a)>(ssize_t)(b) ? (ssize_t)(a) : (ssize_t)(b)) -#define SMIN(a,b) ((ssize_t)(a)<(ssize_t)(b) ? (ssize_t)(a) : (ssize_t)(b)) - -/* Two unsigned, return an unsigned. */ -#define UMAX(a,b) ((size_t)(a)>(size_t)(b) ? (size_t)(a) : (size_t)(b)) -#define UMIN(a,b) ((size_t)(a)<(size_t)(b) ? (size_t)(a) : (size_t)(b)) - -/* Two unsigned, return a signed. */ -#define SUMAX(a,b) ((size_t)(a)>(size_t)(b) ? (ssize_t)(a) : (ssize_t)(b)) -#define SUMIN(a,b) ((size_t)(a)<(size_t)(b) ? (ssize_t)(a) : (ssize_t)(b)) #endif /*__KERNEL__*/ - #endif /*__LINUX_NETFILTER_H*/ diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index a8a2259a8343..027986b2f336 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -234,12 +234,12 @@ extern int nfs_inode_is_stale(struct inode *, struct nfs_fh *, extern struct inode *nfs_fhget(struct dentry *, struct nfs_fh *, struct nfs_fattr *); extern int __nfs_refresh_inode(struct inode *, struct nfs_fattr *); -extern int nfs_revalidate(struct dentry *); +extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); extern int nfs_permission(struct inode *, int); extern int nfs_open(struct inode *, struct file *); extern int nfs_release(struct inode *, struct file *); extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); -extern int nfs_notify_change(struct dentry *, struct iattr *); +extern int nfs_setattr(struct dentry *, struct iattr *); /* * linux/fs/nfs/file.c diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 52b7117c4f64..23d6e6208432 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -64,6 +64,7 @@ #define PG_private 12 /* Has something at ->private */ #define PG_writeback 13 /* Page is under writeback */ +#define PG_nosave 15 /* Used for system suspend/resume */ /* * Global page accounting. One instance per CPU. @@ -207,6 +208,12 @@ extern void get_page_state(struct page_state *ret); ret; \ }) +#define PageNosave(page) test_bit(PG_nosave, &(page)->flags) +#define SetPageNosave(page) set_bit(PG_nosave, &(page)->flags) +#define TestSetPageNosave(page) test_and_set_bit(PG_nosave, &(page)->flags) +#define ClearPageNosave(page) clear_bit(PG_nosave, &(page)->flags) +#define TestClearPageNosave(page) test_and_clear_bit(PG_nosave, &(page)->flags) + /* * The PageSwapCache predicate doesn't use a PG_flag at this time, * but it may again do so one day. diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index bebaee7edb52..67a697940471 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -1551,6 +1551,7 @@ #define PCI_VENDOR_ID_ALTIMA 0x173b #define PCI_DEVICE_ID_ALTIMA_AC1000 0x03e8 +#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea #define PCI_VENDOR_ID_SYMPHONY 0x1c1c #define PCI_DEVICE_ID_SYMPHONY_101 0x0001 diff --git a/include/linux/quota.h b/include/linux/quota.h index 0a36a5e59caf..1a9d178c57bc 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h @@ -184,20 +184,22 @@ extern inline void mark_info_dirty(struct mem_dqinfo *info) #define sb_dqopt(sb) (&(sb)->s_dquot) -extern int nr_dquots, nr_free_dquots; - -struct dqstats { - __u32 lookups; - __u32 drops; - __u32 reads; - __u32 writes; - __u32 cache_hits; - __u32 allocated_dquots; - __u32 free_dquots; - __u32 syncs; +/* + * Statistics about disc quota. + */ +enum { + DQSTATS_LOOKUPS, + DQSTATS_DROPS, + DQSTATS_READS, + DQSTATS_WRITES, + DQSTATS_CACHE_HITS, + DQSTATS_ALLOCATED, + DQSTATS_FREE, + DQSTATS_SYNCS, + DQSTATS_SIZE }; -extern struct dqstats dqstats; +extern __u32 dqstats_array[DQSTATS_SIZE]; #define NR_DQHASH 43 /* Just an arbitrary number */ diff --git a/include/linux/reboot.h b/include/linux/reboot.h index 5f128a952550..4c8b4276c957 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h @@ -20,6 +20,7 @@ * CAD_OFF Ctrl-Alt-Del sequence sends SIGINT to init task. * POWER_OFF Stop OS and remove all power from system, if possible. * RESTART2 Restart system using given command string. + * SW_SUSPEND Suspend system using Software Suspend if compiled in */ #define LINUX_REBOOT_CMD_RESTART 0x01234567 @@ -28,6 +29,7 @@ #define LINUX_REBOOT_CMD_CAD_OFF 0x00000000 #define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC #define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4 +#define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2 #ifdef __KERNEL__ @@ -46,6 +48,13 @@ extern void machine_restart(char *cmd); extern void machine_halt(void); extern void machine_power_off(void); +/* + * Architecture-independent suspend facility + */ + +extern void software_suspend(void); +extern unsigned char software_suspend_enabled; + #endif #endif /* _LINUX_REBOOT_H */ diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 173279f6ff0a..abe55b91a328 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h @@ -1342,6 +1342,13 @@ struct virtual_node struct virtual_item * vn_vi; /* array of items (including a new one, excluding item to be deleted) */ }; +/* used by directory items when creating virtual nodes */ +struct direntry_uarea { + int flags; + __u16 entry_count; + __u16 entry_sizes[1]; +} __attribute__ ((__packed__)) ; + /***************************************************************************/ /* TREE BALANCE */ diff --git a/include/linux/sched.h b/include/linux/sched.h index 2ad9171a66b7..743b1aea2aca 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -13,6 +13,7 @@ extern unsigned long event; #include <linux/types.h> #include <linux/times.h> #include <linux/timex.h> +#include <linux/jiffies.h> #include <linux/rbtree.h> #include <linux/thread_info.h> @@ -388,6 +389,11 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0) #define PF_FLUSHER 0x00004000 /* responsible for disk writeback */ #define PF_RADIX_TREE 0x00008000 /* debug: performing radix tree alloc */ +#define PF_FREEZE 0x00010000 /* this task should be frozen for suspend */ +#define PF_IOTHREAD 0x00020000 /* this thread is needed for doing I/O to swap */ +#define PF_KERNTHREAD 0x00040000 /* this thread is a kernel thread that cannot be sent signals to */ +#define PF_FROZEN 0x00080000 /* frozen for system suspend */ + /* * Ptrace flags */ @@ -476,12 +482,6 @@ extern void free_uid(struct user_struct *); #include <asm/current.h> -/* - * The 64-bit value is not volatile - you MUST NOT read it - * without holding read_lock_irq(&xtime_lock) - */ -extern u64 jiffies_64; -extern unsigned long volatile jiffies; extern unsigned long itimer_ticks; extern unsigned long itimer_next; extern void do_timer(struct pt_regs *); diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index a1b29efb0666..ab12d2608f53 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -58,5 +58,7 @@ static inline int seq_puts(struct seq_file *m, const char *s) int seq_printf(struct seq_file *, const char *, ...) __attribute__ ((format (printf,2,3))); +int single_open(struct file *, int (*)(struct seq_file *, void *), void *); +int single_release(struct inode *, struct file *); #endif #endif diff --git a/include/linux/smp.h b/include/linux/smp.h index 85c6273694c9..b61435d369c8 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -96,5 +96,9 @@ static inline void smp_send_reschedule_all(void) { } #define per_cpu(var, cpu) var #define this_cpu(var) var -#endif -#endif +#endif /* !SMP */ + +#define get_cpu() ({ preempt_disable(); smp_processor_id(); }) +#define put_cpu() preempt_enable() + +#endif /* __LINUX_SMP_H */ diff --git a/include/linux/suspend.h b/include/linux/suspend.h new file mode 100644 index 000000000000..3ede8ad27270 --- /dev/null +++ b/include/linux/suspend.h @@ -0,0 +1,67 @@ +#ifndef _LINUX_SWSUSP_H +#define _LINUX_SWSUSP_H + +#include <asm/suspend.h> +#include <linux/swap.h> +#include <linux/notifier.h> +#include <linux/config.h> + +extern unsigned char software_suspend_enabled; + +#define NORESUME 1 +#define RESUME_SPECIFIED 2 + +#ifdef CONFIG_SOFTWARE_SUSPEND +/* page backup entry */ +typedef struct pbe { + unsigned long address; /* address of the copy */ + unsigned long orig_address; /* original address of page */ + swp_entry_t swap_address; + swp_entry_t dummy; /* we need scratch space at + * end of page (see link, diskpage) + */ +} suspend_pagedir_t; + +#define SWAP_FILENAME_MAXLENGTH 32 + +struct suspend_header { + __u32 version_code; + unsigned long num_physpages; + char machine[8]; + char version[20]; + int num_cpus; + int page_size; + unsigned long suspend_pagedir; + unsigned int num_pbes; + struct swap_location { + char filename[SWAP_FILENAME_MAXLENGTH]; + } swap_location[MAX_SWAPFILES]; +}; + +#define SUSPEND_PD_PAGES(x) (((x)*sizeof(struct pbe))/PAGE_SIZE+1) + +extern struct tq_struct suspend_tq; + +/* mm/vmscan.c */ +extern int shrink_mem(void); + +/* kernel/suspend.c */ +extern void software_suspend(void); +extern void software_resume(void); +extern int resume_setup(char *str); + +extern int register_suspend_notifier(struct notifier_block *); +extern int unregister_suspend_notifier(struct notifier_block *); +extern void refrigerator(unsigned long); + +#else +#define software_suspend() do { } while(0) +#define software_resume() do { } while(0) +#define register_suspend_notifier(a) do { } while(0) +#define unregister_suspend_notifier(a) do { } while(0) +#define refrigerator(a) do { BUG(); } while(0) +#define freeze_processes() do { panic("You need CONFIG_SOFTWARE_SUSPEND to do sleeps."); } while(0) +#define thaw_processes() do { } while(0) +#endif + +#endif /* _LINUX_SWSUSP_H */ diff --git a/include/linux/swap.h b/include/linux/swap.h index 3a376842c21c..3d87e4334851 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -102,12 +102,8 @@ extern unsigned long totalhigh_pages; extern unsigned int nr_free_pages(void); extern unsigned int nr_free_buffer_pages(void); extern unsigned int nr_free_pagecache_pages(void); -extern unsigned long nr_buffermem_pages(void); extern int nr_active_pages; extern int nr_inactive_pages; -extern atomic_t nr_async_pages; -extern atomic_t buffermem_pages; -extern spinlock_t pagecache_lock; extern void __remove_inode_page(struct page *); /* Incomplete types for prototype declarations: */ diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 2f25df04d925..373d20b4c4a7 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -544,6 +544,7 @@ enum FS_LEASES=13, /* int: leases enabled */ FS_DIR_NOTIFY=14, /* int: directory notification enabled */ FS_LEASE_TIME=15, /* int: maximum time to wait for a lease break */ + FS_DQSTATS=16, /* int: disc quota suage statistics */ }; /* CTL_DEBUG names: */ diff --git a/include/linux/timer.h b/include/linux/timer.h index c4f01ada5975..d6f0ce5f8740 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -52,23 +52,4 @@ static inline int timer_pending (const struct timer_list * timer) return timer->list.next != NULL; } -/* - * These inlines deal with timer wrapping correctly. You are - * strongly encouraged to use them - * 1. Because people otherwise forget - * 2. Because if the timer wrap changes in future you wont have to - * alter your driver code. - * - * time_after(a,b) returns true if the time a is after time b. - * - * Do this with "<0" and ">=0" to only test the sign of the result. A - * good compiler would generate better code (and a really good compiler - * wouldn't care). Gcc is currently neither. - */ -#define time_after(a,b) ((long)(b) - (long)(a) < 0) -#define time_before(a,b) time_after(b,a) - -#define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0) -#define time_before_eq(a,b) time_after_eq(b,a) - #endif diff --git a/include/linux/tqueue.h b/include/linux/tqueue.h index 5c518e91a8be..516108dcdbbf 100644 --- a/include/linux/tqueue.h +++ b/include/linux/tqueue.h @@ -66,7 +66,7 @@ typedef struct list_head task_queue; #define DECLARE_TASK_QUEUE(q) LIST_HEAD(q) #define TQ_ACTIVE(q) (!list_empty(&q)) -extern task_queue tq_timer, tq_immediate, tq_disk; +extern task_queue tq_timer, tq_immediate, tq_disk, tq_bdflush; /* * To implement your own list of active bottom halfs, use the following diff --git a/include/linux/usb.h b/include/linux/usb.h index 7a62399fd5e8..8e8f953ed2c7 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -767,7 +767,6 @@ typedef void (*usb_complete_t)(struct urb *); /** * struct urb - USB Request Block * @urb_list: For use by current owner of the URB. - * @next: Used to link ISO requests into rings. * @pipe: Holds endpoint number, direction, type, and max packet size. * Create these values with the eight macros available; * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the type is "ctrl" @@ -827,7 +826,7 @@ typedef void (*usb_complete_t)(struct urb *); * * Initialization: * - * All URBs submitted must initialize dev, pipe, next (may be null), + * All URBs submitted must initialize dev, pipe, * transfer_flags (may be zero), complete, timeout (may be zero). * The USB_ASYNC_UNLINK transfer flag affects later invocations of * the usb_unlink_urb() routine. @@ -873,7 +872,9 @@ typedef void (*usb_complete_t)(struct urb *); * the quality of service is only "best effort". Callers provide specially * allocated URBs, with number_of_packets worth of iso_frame_desc structures * at the end. Each such packet is an individual ISO transfer. Isochronous - * URBs are normally submitted with urb->next fields set up as a ring, so + * URBs are normally queued (no flag like USB_BULK_QUEUE is needed) so that + * transfers are at least double buffered, and then explicitly resubmitted + * in completion handlers, so * that data (such as audio or video) streams at as constant a rate as the * host controller scheduler can support. * @@ -891,14 +892,15 @@ typedef void (*usb_complete_t)(struct urb *); * When completion callback is invoked for non-isochronous URBs, the * actual_length field tells how many bytes were transferred. * - * For interrupt and isochronous URBs, the URB provided to the callback + * For interrupt URBs, the URB provided to the callback * function is still "owned" by the USB core subsystem unless the status * indicates that the URB has been unlinked. Completion handlers should * not modify such URBs until they have been unlinked. * * ISO transfer status is reported in the status and actual_length fields * of the iso_frame_desc array, and the number of errors is reported in - * error_count. + * error_count. Completion callbacks for ISO transfers will normally + * (re)submit URBs to ensure a constant transfer rate. */ struct urb { @@ -906,7 +908,6 @@ struct urb atomic_t count; /* reference count of the URB */ void *hcpriv; /* private data for host controller */ struct list_head urb_list; /* list pointer to all active urbs */ - struct urb *next; /* (in) pointer to next URB */ struct usb_device *dev; /* (in) pointer to associated device */ unsigned int pipe; /* (in) pipe information */ int status; /* (return) non-ISO status */ diff --git a/include/linux/uts.h b/include/linux/uts.h index 39e09ae10135..73eb1ed36ec4 100644 --- a/include/linux/uts.h +++ b/include/linux/uts.h @@ -8,10 +8,6 @@ #define UTS_SYSNAME "Linux" #endif -#ifndef UTS_MACHINE -#define UTS_MACHINE "unknown" -#endif - #ifndef UTS_NODENAME #define UTS_NODENAME "(none)" /* set by sethostname() */ #endif diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index f71621990094..33105051f304 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h @@ -11,7 +11,7 @@ #include <linux/types.h> #include <linux/init.h> -#include <linux/sched.h> +#include <linux/jiffies.h> #include <linux/spinlock.h> #include <asm/atomic.h> |
