diff options
Diffstat (limited to 'include')
166 files changed, 2305 insertions, 1528 deletions
diff --git a/include/asm-alpha/elf.h b/include/asm-alpha/elf.h index 8d614e38f..26b2b27a7 100644 --- a/include/asm-alpha/elf.h +++ b/include/asm-alpha/elf.h @@ -127,8 +127,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; #ifdef __KERNEL__ #define SET_PERSONALITY(EX, IBCS2) \ - current->personality = \ - ((EX).e_flags & EF_ALPHA_32BIT \ + set_personality((EX).e_flags & EF_ALPHA_32BIT \ ? PER_LINUX_32BIT : (IBCS2) ? PER_SVR4 : PER_LINUX) #endif diff --git a/include/asm-arm/arch-arc/hardware.h b/include/asm-arm/arch-arc/hardware.h index 5a47717ab..9a9313fa4 100644 --- a/include/asm-arm/arch-arc/hardware.h +++ b/include/asm-arm/arch-arc/hardware.h @@ -43,10 +43,8 @@ * Screen mapping information */ #define SCREEN_START 0x02000000 -#define SCREEN2_END 0x02078000 -#define SCREEN2_BASE 0x02000000 -#define SCREEN1_END 0x02000000 -#define SCREEN1_BASE 0x01f88000 +#define SCREEN_END 0x02078000 +#define SCREEN_BASE 0x02000000 #ifndef __ASSEMBLY__ diff --git a/include/asm-arm/arch-cl7500/hardware.h b/include/asm-arm/arch-cl7500/hardware.h index 69ce419cc..76978f79b 100644 --- a/include/asm-arm/arch-cl7500/hardware.h +++ b/include/asm-arm/arch-cl7500/hardware.h @@ -44,10 +44,8 @@ /* Let's define SCREEN_START for CL7500, even though it's a lie. */ #define SCREEN_START 0x02000000 /* VRAM */ -#define SCREEN2_END 0xe0000000 -#define SCREEN2_BASE 0xd8000000 -#define SCREEN1_END 0xd8000000 -#define SCREEN1_BASE 0xd0000000 +#define SCREEN_END 0xdfc00000 +#define SCREEN_BASE 0xdf800000 #define FLUSH_BASE 0xdf000000 diff --git a/include/asm-arm/arch-cl7500/vmalloc.h b/include/asm-arm/arch-cl7500/vmalloc.h index 98f3604dd..1654e6c3f 100644 --- a/include/asm-arm/arch-cl7500/vmalloc.h +++ b/include/asm-arm/arch-cl7500/vmalloc.h @@ -13,4 +13,4 @@ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_VMADDR(x) ((unsigned long)(x)) -#define VMALLOC_END (PAGE_OFFSET + 0x10000000) +#define VMALLOC_END (PAGE_OFFSET + 0x1c000000) diff --git a/include/asm-arm/arch-ebsa110/hardware.h b/include/asm-arm/arch-ebsa110/hardware.h index c8ebe67c3..08723718c 100644 --- a/include/asm-arm/arch-ebsa110/hardware.h +++ b/include/asm-arm/arch-ebsa110/hardware.h @@ -1,7 +1,7 @@ /* * linux/include/asm-arm/arch-ebsa110/hardware.h * - * Copyright (C) 1996-1999 Russell King. + * Copyright (C) 1996-2000 Russell King. * * This file contains the hardware definitions of the EBSA-110. */ @@ -27,7 +27,6 @@ * RAM definitions */ #define FLUSH_BASE_PHYS 0x40000000 -#define UNCACHEABLE_ADDR 0xf3000000 #else /* __ASSEMBLY__ */ @@ -41,6 +40,8 @@ #define FLUSH_BASE 0xdf000000 #define PCIO_BASE 0xf0000000 +#define UNCACHEABLE_ADDR 0xf3000000 + #define PARAMS_BASE (PAGE_OFFSET + 0x400) #endif diff --git a/include/asm-arm/arch-ebsa285/irq.h b/include/asm-arm/arch-ebsa285/irq.h index 3a4faaf24..9dcfa9480 100644 --- a/include/asm-arm/arch-ebsa285/irq.h +++ b/include/asm-arm/arch-ebsa285/irq.h @@ -212,5 +212,14 @@ static __inline__ void irq_init_irq(void) request_resource(&ioport_resource, &pic2_resource); setup_arm_irq(IRQ_ISA_CASCADE, &irq_cascade); setup_arm_irq(isa_irq, &irq_cascade); + + /* + * On the NetWinder, don't automatically + * enable ISA IRQ11 when it is requested. + * There appears to be a missing pull-up + * resistor on this line. + */ + if (machine_is_netwinder()) + irq_desc[_ISA_IRQ(11)].noautoenable = 1; } } diff --git a/include/asm-arm/arch-ebsa285/time.h b/include/asm-arm/arch-ebsa285/time.h index a837d8b0f..cc28f3449 100644 --- a/include/asm-arm/arch-ebsa285/time.h +++ b/include/asm-arm/arch-ebsa285/time.h @@ -270,5 +270,5 @@ extern __inline__ void setup_timer(void) timer_irq.handler = isa_timer_interrupt; irq = IRQ_ISA_TIMER; } - setup_arm_irq(IRQ_ISA_TIMER, &timer_irq); + setup_arm_irq(irq, &timer_irq); } diff --git a/include/asm-arm/arch-ebsa285/timex.h b/include/asm-arm/arch-ebsa285/timex.h index de5bffba8..f269d439b 100644 --- a/include/asm-arm/arch-ebsa285/timex.h +++ b/include/asm-arm/arch-ebsa285/timex.h @@ -11,4 +11,4 @@ * divided by a 4-bit prescaler. Other boards use an * ISA derived timer, and this is unused. */ -#define CLOCK_TICK_RATE (50000000 / 16) +#define CLOCK_TICK_RATE (mem_fclk_21285 / 16) diff --git a/include/asm-arm/arch-rpc/hardware.h b/include/asm-arm/arch-rpc/hardware.h index 80cca92e7..222419960 100644 --- a/include/asm-arm/arch-rpc/hardware.h +++ b/include/asm-arm/arch-rpc/hardware.h @@ -33,10 +33,8 @@ #define IO_BASE 0xe0000000 #define SCREEN_START 0x02000000 /* VRAM */ -#define SCREEN2_END 0xe0000000 -#define SCREEN2_BASE 0xd8000000 -#define SCREEN1_END 0xd8000000 -#define SCREEN1_BASE 0xd0000000 +#define SCREEN_END 0xdfc00000 +#define SCREEN_BASE 0xdf800000 #define FLUSH_BASE 0xdf000000 #define UNCACHEABLE_ADDR 0xdf010000 diff --git a/include/asm-arm/arch-rpc/vmalloc.h b/include/asm-arm/arch-rpc/vmalloc.h index 828869fc7..60f72ec84 100644 --- a/include/asm-arm/arch-rpc/vmalloc.h +++ b/include/asm-arm/arch-rpc/vmalloc.h @@ -13,4 +13,4 @@ #define VMALLOC_OFFSET (8*1024*1024) #define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_VMADDR(x) ((unsigned long)(x)) -#define VMALLOC_END (PAGE_OFFSET + 0x10000000) +#define VMALLOC_END (PAGE_OFFSET + 0x1c000000) diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h index e19eea07c..d5dfe4f91 100644 --- a/include/asm-arm/atomic.h +++ b/include/asm-arm/atomic.h @@ -12,12 +12,12 @@ #ifndef __ASM_ARM_ATOMIC_H #define __ASM_ARM_ATOMIC_H -#ifdef __SMP__ +#include <linux/config.h> + +#ifdef CONFIG_SMP #error SMP not supported #endif -#include <linux/config.h> - #ifdef CONFIG_ARCH_CO285 typedef struct { volatile int counter; } atomic_t; #else diff --git a/include/asm-arm/hardirq.h b/include/asm-arm/hardirq.h index 399ba566d..77a36a2a4 100644 --- a/include/asm-arm/hardirq.h +++ b/include/asm-arm/hardirq.h @@ -1,6 +1,7 @@ #ifndef __ASM_HARDIRQ_H #define __ASM_HARDIRQ_H +#include <linux/config.h> #include <linux/threads.h> extern unsigned int local_irq_count[NR_CPUS]; @@ -14,7 +15,7 @@ extern unsigned int local_irq_count[NR_CPUS]; #define in_irq() (local_irq_count[smp_processor_id()] != 0) -#ifndef __SMP__ +#ifndef CONFIG_SMP #define hardirq_trylock(cpu) (local_irq_count[cpu] == 0) #define hardirq_endlock(cpu) do { } while (0) @@ -26,6 +27,6 @@ extern unsigned int local_irq_count[NR_CPUS]; #else #error SMP not supported -#endif /* __SMP__ */ +#endif /* CONFIG_SMP */ #endif /* __ASM_HARDIRQ_H */ diff --git a/include/asm-arm/pci.h b/include/asm-arm/pci.h index c835f4c17..8ed8ebf3c 100644 --- a/include/asm-arm/pci.h +++ b/include/asm-arm/pci.h @@ -51,7 +51,7 @@ pci_free_consistent(struct pci_dev *hwdev, size_t size, void *vaddr, extern inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction) { - consistent_sync(ptr, size, 3); + consistent_sync(ptr, size, direction); return virt_to_bus(ptr); } @@ -89,7 +89,7 @@ pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int directi int i; for (i = 0; i < nents; i++, sg++) - consistent_sync(sg->address, sg->length, 3); + consistent_sync(sg->address, sg->length, direction); return nents; } @@ -116,7 +116,7 @@ pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direc extern inline void pci_dma_sync_single(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction) { - consistent_sync(bus_to_virt(dma_handle), size, 3); + consistent_sync(bus_to_virt(dma_handle), size, direction); } /* Make physical memory consistent for a set of streaming diff --git a/include/asm-arm/pgalloc.h b/include/asm-arm/pgalloc.h index 12b2f3390..c0548236b 100644 --- a/include/asm-arm/pgalloc.h +++ b/include/asm-arm/pgalloc.h @@ -25,9 +25,9 @@ extern __inline__ void flush_tlb_pgtables(struct mm_struct *mm, */ #ifndef CONFIG_NO_PGT_CACHE -#ifdef __SMP__ +#ifdef CONFIG_SMP #error Pgtable caches have to be per-CPU, so that no locking is needed. -#endif /* __SMP__ */ +#endif /* CONFIG_SMP */ extern struct pgtable_cache_struct { unsigned long *pgd_cache; diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h index dad099ff9..5a05e2ef2 100644 --- a/include/asm-arm/pgtable.h +++ b/include/asm-arm/pgtable.h @@ -83,9 +83,9 @@ extern void __handle_bad_pmd_kernel(pmd_t *pmd); #define pmd_clear(pmdp) set_pmd(pmdp, __pmd(0)) /* - * Permanent address of a page. + * Permanent address of a page. We never have highmem, so this is trivial. */ -#define page_address(page) ({ if (!(page)->virtual) BUG(); (page)->virtual; }) +#define page_address(page) ((page)->virtual) #define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) #define pte_page(x) (mem_map + pte_pagenr(x)) @@ -100,13 +100,12 @@ extern __inline__ pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) return pte; } -#define mk_pte(page,pgprot) \ -({ \ - pte_t __pte; \ - pte_val(__pte) = PHYS_OFFSET + \ - (((page) - mem_map) << PAGE_SHIFT) + \ - pgprot_val(pgprot); \ - __pte; \ +#define mk_pte(page,pgprot) \ +({ \ + pte_t __pte; \ + pte_val(__pte) = __pa(page_address(page)) + \ + pgprot_val(pgprot); \ + __pte; \ }) /* diff --git a/include/asm-arm/proc-armo/elf.h b/include/asm-arm/proc-armo/elf.h index 1fc5e957e..b5901f767 100644 --- a/include/asm-arm/proc-armo/elf.h +++ b/include/asm-arm/proc-armo/elf.h @@ -10,7 +10,6 @@ #define ELF_PROC_OK(x) \ ((x)->e_flags & EF_ARM_APCS26) -#define SET_PERSONALITY(ex,ibcs2) \ - current->personality = PER_LINUX +#define SET_PERSONALITY(ex,ibcs2) set_personality(PER_LINUX) #endif diff --git a/include/asm-arm/proc-armo/system.h b/include/asm-arm/proc-armo/system.h index 1cc3fc606..bc113ae6e 100644 --- a/include/asm-arm/proc-armo/system.h +++ b/include/asm-arm/proc-armo/system.h @@ -9,6 +9,7 @@ extern const char xchg_str[]; +#include <linux/config.h> #include <asm/proc-fns.h> extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int size) @@ -113,7 +114,7 @@ extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int #define local_irq_disable() __cli() #define local_irq_enable() __sti() -#ifdef __SMP__ +#ifdef CONFIG_SMP #error SMP not supported #else diff --git a/include/asm-arm/proc-armv/elf.h b/include/asm-arm/proc-armv/elf.h index a865dce68..3c41d577b 100644 --- a/include/asm-arm/proc-armv/elf.h +++ b/include/asm-arm/proc-armv/elf.h @@ -17,7 +17,6 @@ there is no other ELF system currently supported by iBCS. @@ Could print a warning message to encourage users to upgrade. */ #define SET_PERSONALITY(ex,ibcs2) \ - current->personality = (ex.e_flags & EF_ARM_APCS26) ? \ - PER_LINUX : PER_LINUX_32BIT + set_personality((ex).e_flags&EF_ARM_APCS26 ?PER_LINUX :PER_LINUX_32BIT) #endif diff --git a/include/asm-arm/proc-armv/pgtable.h b/include/asm-arm/proc-armv/pgtable.h index d4a57d8a2..b5d53a59e 100644 --- a/include/asm-arm/proc-armv/pgtable.h +++ b/include/asm-arm/proc-armv/pgtable.h @@ -79,7 +79,7 @@ extern __inline__ unsigned long pmd_page(pmd_t pmd) * PTE functions * ****************/ -/* PTE types (actially level 2 descriptor) */ +/* PTE types (actually level 2 descriptor) */ #define PTE_TYPE_MASK 0x0003 #define PTE_TYPE_FAULT 0x0000 #define PTE_TYPE_LARGE 0x0001 @@ -122,12 +122,12 @@ extern __inline__ unsigned long pmd_page(pmd_t pmd) * The following macros handle the cache and bufferable bits... */ #define _L_PTE_DEFAULT L_PTE_PRESENT | L_PTE_YOUNG -#define _L_PTE_READ L_PTE_USER | L_PTE_CACHEABLE +#define _L_PTE_READ L_PTE_USER | L_PTE_CACHEABLE | L_PTE_BUFFERABLE #define PAGE_NONE __pgprot(_L_PTE_DEFAULT) -#define PAGE_COPY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ | L_PTE_BUFFERABLE) -#define PAGE_SHARED __pgprot(_L_PTE_DEFAULT | _L_PTE_READ | L_PTE_BUFFERABLE | L_PTE_WRITE) -#define PAGE_READONLY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ | L_PTE_BUFFERABLE) +#define PAGE_COPY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ) +#define PAGE_SHARED __pgprot(_L_PTE_DEFAULT | _L_PTE_READ | L_PTE_WRITE) +#define PAGE_READONLY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ) #define PAGE_KERNEL __pgprot(_L_PTE_DEFAULT | L_PTE_CACHEABLE | L_PTE_BUFFERABLE | L_PTE_DIRTY | L_PTE_WRITE) #define _PAGE_CHG_MASK (PAGE_MASK | L_PTE_DIRTY | L_PTE_YOUNG) diff --git a/include/asm-arm/proc-armv/system.h b/include/asm-arm/proc-armv/system.h index d0e334813..3b35be309 100644 --- a/include/asm-arm/proc-armv/system.h +++ b/include/asm-arm/proc-armv/system.h @@ -7,6 +7,8 @@ #ifndef __ASM_PROC_SYSTEM_H #define __ASM_PROC_SYSTEM_H +#include <linux/config.h> + extern const char xchg_str[]; extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int size) @@ -106,7 +108,7 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */ #define local_irq_disable() __cli() #define local_irq_enable() __sti() -#ifdef __SMP__ +#ifdef CONFIG_SMP #error SMP not supported #else diff --git a/include/asm-arm/setup.h b/include/asm-arm/setup.h index 2fe6424b8..90e7f6efe 100644 --- a/include/asm-arm/setup.h +++ b/include/asm-arm/setup.h @@ -49,6 +49,7 @@ struct param_struct { unsigned long system_rev; /* 76 */ unsigned long system_serial_low; /* 80 */ unsigned long system_serial_high; /* 84 */ + unsigned long mem_fclk_21285; /* 88 */ } s; char unused[256]; } u1; diff --git a/include/asm-arm/smp.h b/include/asm-arm/smp.h index 9776bf66d..5ca771631 100644 --- a/include/asm-arm/smp.h +++ b/include/asm-arm/smp.h @@ -1,7 +1,9 @@ #ifndef __ASM_SMP_H #define __ASM_SMP_H -#ifdef __SMP__ +#include <linux/config.h> + +#ifdef CONFIG_SMP #error SMP not supported #endif diff --git a/include/asm-arm/string.h b/include/asm-arm/string.h index 72b89fa70..dfe4cd9ac 100644 --- a/include/asm-arm/string.h +++ b/include/asm-arm/string.h @@ -15,6 +15,8 @@ extern char * strchr(const char * s, int c); #define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMMOVE #define __HAVE_ARCH_MEMCHR +extern void * memchr(const void *cs, int c, size_t count); + #define __HAVE_ARCH_MEMZERO #define __HAVE_ARCH_MEMSET diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index a33b9e08b..40ab75a29 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h @@ -11,11 +11,12 @@ extern unsigned int system_rev; extern unsigned int system_serial_low; extern unsigned int system_serial_high; +extern unsigned int mem_fclk_21285; /* The type of machine we're running on */ extern unsigned int __machine_arch_type; -/* see arch/arm/kernel/setup.c for a description of these */ +/* see arch/arm/kernel/arch.c for a description of these */ #define MACH_TYPE_EBSA110 0 #define MACH_TYPE_RISCPC 1 #define MACH_TYPE_NEXUSPCI 3 @@ -31,8 +32,13 @@ extern unsigned int __machine_arch_type; #define MACH_TYPE_LACIE_NAS 13 #define MACH_TYPE_CLPS7500 14 #define MACH_TYPE_SHARK 15 -#define MACH_TYPE_SA1100 16 +#define MACH_TYPE_BRUTUS 16 #define MACH_TYPE_PERSONAL_SERVER 17 +#define MACH_TYPE_BITSY 22 +#define MACH_TYPE_THINCLIENT 24 +#define MACH_TYPE_ASSABET 25 +#define MACH_TYPE_VICTOR 26 +#define MACH_TYPE_LART 27 /* * Sort out a definition for machine_arch_type @@ -168,16 +174,16 @@ extern unsigned int __machine_arch_type; # define machine_is_shark() (0) #endif -#ifdef CONFIG_ARCH_SA1100 +#ifdef CONFIG_SA1100_BRUTUS # ifdef machine_arch_type # undef machine_arch_type # define machine_arch_type __machine_arch_type # else -# define machine_arch_type MACH_TYPE_SA1100 +# define machine_arch_type MACH_TYPE_BRUTUS # endif -# define machine_is_sa1100() (machine_arch_type == MACH_TYPE_SA1100) +# define machine_is_brutus() (machine_arch_type == MACH_TYPE_BRUTUS) #else -# define machine_is_sa1100() (0) +# define machine_is_brutus() (0) #endif #ifdef CONFIG_ARCH_PERSONAL_SERVER @@ -192,6 +198,126 @@ extern unsigned int __machine_arch_type; # define machine_is_personal_server() (0) #endif +#ifdef CONFIG_SA1100_ITSY +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_ITSY +# endif +# define machine_is_itsy() (machine_arch_type == MACH_TYPE_ITSY) +#else +# define machine_is_itsy() (0) +#endif + +#ifdef CONFIG_SA1100_EMPEG +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_EMPEG +# endif +# define machine_is_empeg() (machine_arch_type == MACH_TYPE_EMPEG) +#else +# define machine_is_empeg() (0) +#endif + +#ifdef CONFIG_SA1100_ASSABET +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_ASSABET +# endif +# define machine_is_assabet() (machine_arch_type == MACH_TYPE_ASSABET) +#else +# define machine_is_assabet() (0) +#endif + +#ifdef CONFIG_SA1100_VICTOR +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_VICTOR +# endif +# define machine_is_victor() (machine_arch_type == MACH_TYPE_VICTOR) +#else +# define machine_is_victor() (0) +#endif + +#ifdef CONFIG_SA1100_LART +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_LART +# endif +# define machine_is_lart() (machine_arch_type == MACH_TYPE_LART) +#else +# define machine_is_lart() (0) +#endif + +#ifdef CONFIG_SA1100_BITSY +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_BITSY +# endif +# define machine_is_bitsy() (machine_arch_type == MACH_TYPE_BITSY) +#else +# define machine_is_bitsy() (0) +#endif + +#ifdef CONFIG_SA1100_TIFON +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_TIFON +# endif +# define machine_is_tifon() (machine_arch_type == MACH_TYPE_TIFON) +#else +# define machine_is_tifon() (0) +#endif + +#ifdef CONFIG_SA1100_PLEB +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_PLEB +# endif +# define machine_is_pleb() (machine_arch_type == MACH_TYPE_PLEB) +#else +# define machine_is_pleb() (0) +#endif + +#ifdef CONFIG_SA1100_THINCLIENT +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_THINCLIENT +# endif +# define machine_is_thinclient() (machine_arch_type == MACH_TYPE_THINCLIENT) +#else +# define machine_is_thinclient() (0) +#endif + +#ifdef CONFIG_SA1100_PENNY +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_PENNY +# endif +# define machine_is_penny() (machine_arch_type == MACH_TYPE_PENNY) +#else +# define machine_is_penny() (0) +#endif + #ifndef machine_arch_type #define machine_arch_type __machine_arch_type #endif diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h index 3c6e6aa4b..9ee236336 100644 --- a/include/asm-i386/apic.h +++ b/include/asm-i386/apic.h @@ -3,6 +3,7 @@ #include <linux/config.h> #include <asm/apicdef.h> +#include <asm/system.h> #define APIC_DEBUG 1 @@ -20,7 +21,12 @@ extern __inline void apic_write(unsigned long reg, unsigned long v) { - *((volatile unsigned long *)(APIC_BASE+reg))=v; + *((volatile unsigned long *)(APIC_BASE+reg)) = v; +} + +extern __inline void apic_write_atomic(unsigned long reg, unsigned long v) +{ + xchg((volatile unsigned long *)(APIC_BASE+reg), v); } extern __inline unsigned long apic_read(unsigned long reg) @@ -32,30 +38,33 @@ extern unsigned int apic_timer_irqs [NR_CPUS]; #ifdef CONFIG_X86_GOOD_APIC # define FORCE_READ_AROUND_WRITE 0 -# define apic_readaround(x) +# define apic_read_around(x) +# define apic_write_around(x,y) apic_write((x),(y)) #else # define FORCE_READ_AROUND_WRITE 1 -# define apic_readaround(x) apic_read(x) +# define apic_read_around(x) apic_read(x) +# define apic_write_around(x,y) apic_write_atomic((x),(y)) #endif -#define apic_write_around(x,y) \ - do { apic_readaround(x); apic_write(x,y); } while (0) - extern inline void ack_APIC_irq(void) { - /* Clear the IPI */ - - apic_readaround(APIC_EOI); /* - * on P6+ cores (CONFIG_X86_GOOD_APIC) ack_APIC_irq() actually - * gets compiled as a single instruction ... yummie. + * ack_APIC_irq() actually gets compiled as a single instruction: + * - a single rmw on Pentium/82489DX + * - a single write on P6+ cores (CONFIG_X86_GOOD_APIC) + * ... yummie. */ - apic_write(APIC_EOI, 0); /* Docs say use 0 for future compatibility */ + + /* Docs say use 0 for future compatibility */ + apic_write_around(APIC_EOI, 0); } extern int get_maxlvt(void); +extern void connect_bsp_APIC (void); +extern void disconnect_bsp_APIC (void); extern void disable_local_APIC (void); extern void cache_APIC_registers (void); +extern void sync_Arb_IDs(void); extern void setup_local_APIC (void); extern void init_apic_mappings(void); extern void smp_local_timer_interrupt(struct pt_regs * regs); diff --git a/include/asm-i386/apicdef.h b/include/asm-i386/apicdef.h index c47395384..2f0e2d3c3 100644 --- a/include/asm-i386/apicdef.h +++ b/include/asm-i386/apicdef.h @@ -29,8 +29,6 @@ #define SET_APIC_LOGICAL_ID(x) (((x)<<24)) #define APIC_ALL_CPUS 0xFF #define APIC_DFR 0xE0 -#define GET_APIC_DFR(x) (((x)>>28)&0x0F) -#define SET_APIC_DFR(x) ((x)<<28) #define APIC_SPIV 0xF0 #define APIC_ISR 0x100 #define APIC_TMR 0x180 @@ -47,22 +45,23 @@ #define APIC_DEST_SELF 0x40000 #define APIC_DEST_ALLINC 0x80000 #define APIC_DEST_ALLBUT 0xC0000 -#define APIC_DEST_RR_MASK 0x30000 -#define APIC_DEST_RR_INVALID 0x00000 -#define APIC_DEST_RR_INPROG 0x10000 -#define APIC_DEST_RR_VALID 0x20000 -#define APIC_DEST_LEVELTRIG 0x08000 -#define APIC_DEST_ASSERT 0x04000 -#define APIC_DEST_BUSY 0x01000 +#define APIC_ICR_RR_MASK 0x30000 +#define APIC_ICR_RR_INVALID 0x00000 +#define APIC_ICR_RR_INPROG 0x10000 +#define APIC_ICR_RR_VALID 0x20000 +#define APIC_INT_LEVELTRIG 0x08000 +#define APIC_INT_ASSERT 0x04000 +#define APIC_ICR_BUSY 0x01000 #define APIC_DEST_LOGICAL 0x00800 -#define APIC_DEST_DM_FIXED 0x00000 -#define APIC_DEST_DM_LOWEST 0x00100 -#define APIC_DEST_DM_SMI 0x00200 -#define APIC_DEST_DM_REMRD 0x00300 -#define APIC_DEST_DM_NMI 0x00400 -#define APIC_DEST_DM_INIT 0x00500 -#define APIC_DEST_DM_STARTUP 0x00600 -#define APIC_DEST_VECTOR_MASK 0x000FF +#define APIC_DM_FIXED 0x00000 +#define APIC_DM_LOWEST 0x00100 +#define APIC_DM_SMI 0x00200 +#define APIC_DM_REMRD 0x00300 +#define APIC_DM_NMI 0x00400 +#define APIC_DM_INIT 0x00500 +#define APIC_DM_STARTUP 0x00600 +#define APIC_DM_EXTINT 0x00700 +#define APIC_VECTOR_MASK 0x000FF #define APIC_ICR2 0x310 #define GET_APIC_DEST_FIELD(x) (((x)>>24)&0xFF) #define SET_APIC_DEST_FIELD(x) ((x)<<24) diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h index 51805488f..945ab9b5d 100644 --- a/include/asm-i386/atomic.h +++ b/include/asm-i386/atomic.h @@ -1,12 +1,14 @@ #ifndef __ARCH_I386_ATOMIC__ #define __ARCH_I386_ATOMIC__ +#include <linux/config.h> + /* * Atomic operations that C can't guarantee us. Useful for * resource counting etc.. */ -#ifdef __SMP__ +#ifdef CONFIG_SMP #define LOCK "lock ; " #else #define LOCK "" @@ -19,7 +21,7 @@ */ #define __atomic_fool_gcc(x) (*(volatile struct { int a[100]; } *)x) -#ifdef __SMP__ +#ifdef CONFIG_SMP typedef struct { volatile int counter; } atomic_t; #else typedef struct { int counter; } atomic_t; diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index 86068d069..e8c859dd4 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h @@ -5,6 +5,8 @@ * Copyright 1992, Linus Torvalds. */ +#include <linux/config.h> + /* * These have to be done with inline assembly: that way the bit-setting * is guaranteed to be atomic. All bit operations return 0 if the bit @@ -13,7 +15,7 @@ * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). */ -#ifdef __SMP__ +#ifdef CONFIG_SMP #define LOCK_PREFIX "lock ; " #else #define LOCK_PREFIX "" diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h index dbaa8d261..34df19c05 100644 --- a/include/asm-i386/bugs.h +++ b/include/asm-i386/bugs.h @@ -21,8 +21,6 @@ #include <asm/processor.h> #include <asm/msr.h> -#define CONFIG_BUGi386 - static int __init no_halt(char *s) { boot_cpu_data.hlt_works_ok = 0; @@ -370,16 +368,18 @@ static void __init check_cyrix_coma(void) } /* - * Check wether we are able to run this kernel safely on SMP. + * Check whether we are able to run this kernel safely on SMP. * * - In order to run on a i386, we need to be compiled for i386 * (for due to lack of "invlpg" and working WP on a i386) * - In order to run on anything without a TSC, we need to be * compiled for a i486. - * - In order to work on a Pentium/SMP machine, we need to be - * compiled for a Pentium or lower, as a PPro config implies - * a properly working local APIC without the need to do extra - * reads from the APIC. + * - In order to support the local APIC on a buggy Pentium machine, + * we need to be compiled with CONFIG_X86_GOOD_APIC disabled, + * which happens implicitly if compiled for a Pentium or lower + * (unless an advanced selection of CPU features is used) as an + * otherwise config implies a properly working local APIC without + * the need to do extra reads from the APIC. */ static void __init check_config(void) @@ -411,11 +411,18 @@ static void __init check_config(void) #endif /* - * If we were told we had a good APIC for SMP, we'd better be a PPro + * If we were told we had a good local APIC, check for buggy Pentia, + * i.e. all B steppings and the C2 stepping of P54C when using their + * integrated APIC (see 11AP erratum in "Pentium Processor + * Specification Update"). */ -#if defined(CONFIG_X86_GOOD_APIC) && defined(CONFIG_SMP) - if (smp_found_config && boot_cpu_data.x86 <= 5) - panic("Kernel compiled for PPro+, assumes local APIC without read-before-write bug"); +#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_GOOD_APIC) + if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL + && boot_cpu_data.x86_capability & X86_FEATURE_APIC + && boot_cpu_data.x86 == 5 + && boot_cpu_data.x86_model == 2 + && (boot_cpu_data.x86_mask < 6 || boot_cpu_data.x86_mask == 11)) + panic("Kernel compiled for PPro+, assumes a local APIC without the read-before-write bug!"); #endif } @@ -425,7 +432,7 @@ static void __init check_bugs(void) identify_cpu(&boot_cpu_data); check_cx686_cpuid(); check_cx686_slop(); -#ifndef __SMP__ +#ifndef CONFIG_SMP printk("CPU: "); print_cpu_info(&boot_cpu_data); #endif diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h index dacd01b99..0083b3f20 100644 --- a/include/asm-i386/elf.h +++ b/include/asm-i386/elf.h @@ -94,8 +94,7 @@ typedef struct user_i387_struct elf_fpregset_t; #define ELF_PLATFORM ("i386\0i486\0i586\0i686"+((boot_cpu_data.x86-3)*5)) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex, ibcs2) \ - current->personality = (ibcs2 ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #endif diff --git a/include/asm-i386/hardirq.h b/include/asm-i386/hardirq.h index fb0c3e5d4..e6fa12909 100644 --- a/include/asm-i386/hardirq.h +++ b/include/asm-i386/hardirq.h @@ -1,6 +1,7 @@ #ifndef __ASM_HARDIRQ_H #define __ASM_HARDIRQ_H +#include <linux/config.h> #include <linux/threads.h> #include <linux/irq.h> @@ -29,7 +30,7 @@ extern irq_cpustat_t irq_stat [NR_CPUS]; #define in_irq() (local_irq_count(smp_processor_id()) != 0) -#ifndef __SMP__ +#ifndef CONFIG_SMP #define hardirq_trylock(cpu) (local_irq_count(cpu) == 0) #define hardirq_endlock(cpu) do { } while (0) @@ -89,6 +90,6 @@ static inline int hardirq_trylock(int cpu) extern void synchronize_irq(void); -#endif /* __SMP__ */ +#endif /* CONFIG_SMP */ #endif /* __ASM_HARDIRQ_H */ diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h index b371bd79f..413a98c55 100644 --- a/include/asm-i386/hw_irq.h +++ b/include/asm-i386/hw_irq.h @@ -12,6 +12,7 @@ * <tomsoft@informatik.tu-chemnitz.de> */ +#include <linux/config.h> #include <asm/irq.h> /* @@ -211,7 +212,7 @@ static inline void x86_do_profile (unsigned long eip) atomic_inc((atomic_t *)&prof_buffer[eip]); } -#ifdef __SMP__ /*more of this file should probably be ifdefed SMP */ +#ifdef CONFIG_SMP /*more of this file should probably be ifdefed SMP */ static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) { if (IO_APIC_IRQ(i)) send_IPI_self(IO_APIC_VECTOR(i)); diff --git a/include/asm-i386/mca_dma.h b/include/asm-i386/mca_dma.h index fb42da38d..a9e780cc4 100644 --- a/include/asm-i386/mca_dma.h +++ b/include/asm-i386/mca_dma.h @@ -178,18 +178,18 @@ static __inline__ void mca_set_dma_io(unsigned int dmanr, unsigned int io_addr) /** * mca_set_dma_mode - set the DMA mode * @dmanr: DMA channel - * @mode: The mode to set + * @mode: mode to set * * The DMA controller supports several modes. The mode values you can - * set are + * set are : * - * MCA_DMA_MODE_READ when reading from the DMA device. + * %MCA_DMA_MODE_READ when reading from the DMA device. * - * MCA_DMA_MODE_WRITE to writing to the DMA device. + * %MCA_DMA_MODE_WRITE to writing to the DMA device. * - * MCA_DMA_MODE_IO to do DMA to or from an I/O port. + * %MCA_DMA_MODE_IO to do DMA to or from an I/O port. * - * MCA_DMA_MODE_16 to do 16bit transfers. + * %MCA_DMA_MODE_16 to do 16bit transfers. * */ diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h index 1d9248632..e02aff08d 100644 --- a/include/asm-i386/mmu_context.h +++ b/include/asm-i386/mmu_context.h @@ -12,7 +12,7 @@ #define destroy_context(mm) do { } while(0) #define init_new_context(tsk,mm) do { } while (0) -#ifdef __SMP__ +#ifdef CONFIG_SMP static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu) { @@ -42,7 +42,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, str asm volatile("movl %0,%%cr3": :"r" (__pa(next->pgd))); clear_bit(cpu, &prev->cpu_vm_mask); } -#ifdef __SMP__ +#ifdef CONFIG_SMP else { int old_state = cpu_tlbstate[cpu].state; cpu_tlbstate[cpu].state = TLBSTATE_OK; diff --git a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h index eaa803cb0..2956def6b 100644 --- a/include/asm-i386/mpspec.h +++ b/include/asm-i386/mpspec.h @@ -13,6 +13,11 @@ #define SMP_MAGIC_IDENT (('_'<<24)|('P'<<16)|('M'<<8)|'_') +/* + * a maximum of 16 APICs with the current APIC ID architecture. + */ +#define MAX_APICS 16 + struct intel_mp_floating { char mpf_signature[4]; /* "_MP_" */ @@ -144,7 +149,8 @@ struct mpc_config_lintsrc enum mp_bustype { MP_BUS_ISA, MP_BUS_EISA, - MP_BUS_PCI + MP_BUS_PCI, + MP_BUS_MCA }; extern int mp_bus_id_to_type [MAX_MP_BUSSES]; extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; @@ -155,7 +161,7 @@ extern int smp_found_config; extern void find_smp_config (void); extern void get_smp_config (void); extern int nr_ioapics; -extern int apic_version [NR_CPUS]; +extern int apic_version [MAX_APICS]; extern int mp_bus_id_to_type [MAX_MP_BUSSES]; extern int mp_irq_entries; extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES]; diff --git a/include/asm-i386/mtrr.h b/include/asm-i386/mtrr.h index e6d130c9a..cc28a42c7 100644 --- a/include/asm-i386/mtrr.h +++ b/include/asm-i386/mtrr.h @@ -95,7 +95,7 @@ static __inline__ int mtrr_del (int reg, unsigned long base, /* The following functions are for initialisation: don't use them! */ extern int mtrr_init (void); -# if defined(__SMP__) && defined(CONFIG_MTRR) +# if defined(CONFIG_SMP) && defined(CONFIG_MTRR) extern void mtrr_init_boot_cpu (void); extern void mtrr_init_secondary_cpu (void); # endif diff --git a/include/asm-i386/pgalloc.h b/include/asm-i386/pgalloc.h index 5cb20763d..78a229362 100644 --- a/include/asm-i386/pgalloc.h +++ b/include/asm-i386/pgalloc.h @@ -156,7 +156,7 @@ extern inline void set_pgdir(unsigned long address, pgd_t entry) { struct task_struct * p; pgd_t *pgd; -#ifdef __SMP__ +#ifdef CONFIG_SMP int i; #endif @@ -167,7 +167,7 @@ extern inline void set_pgdir(unsigned long address, pgd_t entry) *pgd_offset(p->mm,address) = entry; } read_unlock(&tasklist_lock); -#ifndef __SMP__ +#ifndef CONFIG_SMP for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) pgd[address >> PGDIR_SHIFT] = entry; #else @@ -193,7 +193,7 @@ extern inline void set_pgdir(unsigned long address, pgd_t entry) * and page-granular flushes are available only on i486 and up. */ -#ifndef __SMP__ +#ifndef CONFIG_SMP #define flush_tlb() __flush_tlb() #define flush_tlb_all() __flush_tlb_all() diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 9f594ab5d..41f386716 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -12,6 +12,7 @@ #include <asm/segment.h> #include <asm/page.h> #include <asm/types.h> +#include <linux/config.h> #include <linux/threads.h> /* @@ -100,7 +101,7 @@ struct cpuinfo_x86 { extern struct cpuinfo_x86 boot_cpu_data; extern struct tss_struct init_tss[NR_CPUS]; -#ifdef __SMP__ +#ifdef CONFIG_SMP extern struct cpuinfo_x86 cpu_data[]; #define current_cpu_data cpu_data[smp_processor_id()] #else @@ -356,7 +357,7 @@ struct thread_struct { } #define start_thread(regs, new_eip, new_esp) do { \ - __asm__("movl %w0,%%fs ; movl %w0,%%gs": :"r" (0)); \ + __asm__("movl %0,%%fs ; movl %0,%%gs": :"r" (0)); \ set_fs(USER_DS); \ regs->xds = __USER_DS; \ regs->xes = __USER_DS; \ diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h index e187026a2..234e79275 100644 --- a/include/asm-i386/spinlock.h +++ b/include/asm-i386/spinlock.h @@ -33,7 +33,7 @@ typedef struct { #define SPINLOCK_MAGIC_INIT /* */ #endif -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 SPINLOCK_MAGIC_INIT } +#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 SPINLOCK_MAGIC_INIT } #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) /* @@ -43,32 +43,39 @@ typedef struct { * We make no fairness assumptions. They have a cost. */ -#define spin_unlock_wait(x) do { barrier(); } while(((volatile spinlock_t *)(x))->lock) -#define spin_is_locked(x) ((x)->lock != 0) +#define spin_is_locked(x) (*(volatile char *)(&(x)->lock) <= 0) +#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) #define spin_lock_string \ "\n1:\t" \ - "lock ; btsl $0,%0\n\t" \ - "jc 2f\n" \ + "lock ; decb %0\n\t" \ + "js 2f\n" \ ".section .text.lock,\"ax\"\n" \ "2:\t" \ - "testb $1,%0\n\t" \ + "cmpb $0,%0\n\t" \ "rep;nop\n\t" \ - "jne 2b\n\t" \ + "jle 2b\n\t" \ "jmp 1b\n" \ ".previous" /* - * Sadly, some early PPro chips require the locked access, - * otherwise we could just always simply do - * - * #define spin_unlock_string \ - * "movb $0,%0" - * - * Which is noticeably faster. + * This works. Despite all the confusion. */ #define spin_unlock_string \ - "lock ; btrl $0,%0" + "movb $1,%0" + +/* + * Won't work on i386-SMP. Does anybody care? + */ +static inline int spin_trylock(spinlock_t *lock) +{ + char oldval; + __asm__ __volatile__( + "lock ; cmpxchg %b2,%1" + :"=a" (oldval), "=m" (__dummy_lock(lock)) + :"q" (0), "0" (1)); + return oldval > 0; +} extern inline void spin_lock(spinlock_t *lock) { @@ -90,7 +97,7 @@ extern inline void spin_unlock(spinlock_t *lock) #if SPINLOCK_DEBUG if (lock->magic != SPINLOCK_MAGIC) BUG(); - if (!lock->lock) + if (!spin_is_locked(lock)) BUG(); #endif __asm__ __volatile__( @@ -98,8 +105,6 @@ extern inline void spin_unlock(spinlock_t *lock) :"=m" (__dummy_lock(lock))); } -#define spin_trylock(lock) ({ !test_and_set_bit(0,(lock)); }) - /* * Read-write spinlocks, allowing multiple readers * but only one writer. diff --git a/include/asm-i386/string.h b/include/asm-i386/string.h index ef0dd75d8..5db9768d0 100644 --- a/include/asm-i386/string.h +++ b/include/asm-i386/string.h @@ -452,6 +452,36 @@ return __res; } /* end of additional stuff */ +#define __HAVE_ARCH_STRSTR +extern inline char * strstr(const char * cs,const char * ct) +{ +int d0, d1; +register char * __res; +__asm__ __volatile__( + "movl %6,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */ + "movl %%ecx,%%edx\n" + "1:\tmovl %6,%%edi\n\t" + "movl %%esi,%%eax\n\t" + "movl %%edx,%%ecx\n\t" + "repe\n\t" + "cmpsb\n\t" + "je 2f\n\t" /* also works for empty string, see above */ + "xchgl %%eax,%%esi\n\t" + "incl %%esi\n\t" + "cmpb $0,-1(%%eax)\n\t" + "jne 1b\n\t" + "xorl %%eax,%%eax\n\t" + "2:" + :"=a" (__res), "=&c" (d0), "=&S" (d1) + :"0" (0), "1" (0xffffffff), "2" (cs), "g" (ct) + :"dx", "di"); +return __res; +} + /* * This looks horribly ugly, but the compiler can optimize it totally, * as we by now know that both pattern and count is constant.. diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 75e04e938..ec9f33ba6 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -289,7 +289,7 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, #define local_irq_disable() __asm__ __volatile__("cli": : :"memory") #define local_irq_enable() __asm__ __volatile__("sti": : :"memory") -#ifdef __SMP__ +#ifdef CONFIG_SMP extern void __global_cli(void); extern void __global_sti(void); diff --git a/include/asm-ia64/atomic.h b/include/asm-ia64/atomic.h index 5230bcc15..43a44f4ad 100644 --- a/include/asm-ia64/atomic.h +++ b/include/asm-ia64/atomic.h @@ -44,7 +44,7 @@ ia64_atomic_add (int i, atomic_t *v) CMPXCHG_BUGCHECK(v); old = atomic_read(v); new = old + i; - } while (ia64_cmpxchg(v, old, old + i, sizeof(atomic_t)) != old); + } while (ia64_cmpxchg("acq", v, old, old + i, sizeof(atomic_t)) != old); return new; } @@ -58,7 +58,7 @@ ia64_atomic_sub (int i, atomic_t *v) CMPXCHG_BUGCHECK(v); old = atomic_read(v); new = old - i; - } while (ia64_cmpxchg(v, old, new, sizeof(atomic_t)) != old); + } while (ia64_cmpxchg("acq", v, old, new, sizeof(atomic_t)) != old); return new; } diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h index c10d745e7..13b9dcbdc 100644 --- a/include/asm-ia64/bitops.h +++ b/include/asm-ia64/bitops.h @@ -33,7 +33,7 @@ set_bit (int nr, volatile void *addr) CMPXCHG_BUGCHECK(m); old = *m; new = old | bit; - } while (cmpxchg(m, old, new) != old); + } while (cmpxchg_acq(m, old, new) != old); } extern __inline__ void @@ -49,7 +49,7 @@ clear_bit (int nr, volatile void *addr) CMPXCHG_BUGCHECK(m); old = *m; new = old & mask; - } while (cmpxchg(m, old, new) != old); + } while (cmpxchg_acq(m, old, new) != old); } extern __inline__ void @@ -65,7 +65,7 @@ change_bit (int nr, volatile void *addr) CMPXCHG_BUGCHECK(m); old = *m; new = old ^ bit; - } while (cmpxchg(m, old, new) != old); + } while (cmpxchg_acq(m, old, new) != old); } extern __inline__ int @@ -81,7 +81,7 @@ test_and_set_bit (int nr, volatile void *addr) CMPXCHG_BUGCHECK(m); old = *m; new = old | bit; - } while (cmpxchg(m, old, new) != old); + } while (cmpxchg_acq(m, old, new) != old); return (old & bit) != 0; } @@ -98,7 +98,7 @@ test_and_clear_bit (int nr, volatile void *addr) CMPXCHG_BUGCHECK(m); old = *m; new = old & mask; - } while (cmpxchg(m, old, new) != old); + } while (cmpxchg_acq(m, old, new) != old); return (old & ~mask) != 0; } @@ -115,7 +115,7 @@ test_and_change_bit (int nr, volatile void *addr) CMPXCHG_BUGCHECK(m); old = *m; new = old ^ bit; - } while (cmpxchg(m, old, new) != old); + } while (cmpxchg_acq(m, old, new) != old); return (old & bit) != 0; } diff --git a/include/asm-ia64/cache.h b/include/asm-ia64/cache.h index aa1040e13..15035374f 100644 --- a/include/asm-ia64/cache.h +++ b/include/asm-ia64/cache.h @@ -1,12 +1,28 @@ #ifndef _ASM_IA64_CACHE_H #define _ASM_IA64_CACHE_H +#include <linux/config.h> + /* - * Copyright (C) 1998, 1999 Hewlett-Packard Co - * Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com> + * Copyright (C) 1998-2000 Hewlett-Packard Co + * Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com> */ /* Bytes per L1 (data) cache line. */ -#define L1_CACHE_BYTES 64 +#define LOG_L1_CACHE_BYTES 6 +#define L1_CACHE_BYTES (1 << LOG_L1_CACHE_BYTES) + +#ifdef CONFIG_SMP +# define SMP_LOG_CACHE_BYTES LOG_L1_CACHE_BYTES +# define SMP_CACHE_BYTES L1_CACHE_BYTES +#else + /* + * The "aligned" directive can only _increase_ alignment, so this is + * safe and provides an easy way to avoid wasting space on a + * uni-processor: + */ +# define SMP_LOG_CACHE_BYTES 3 +# define SMP_CACHE_BYTES (1 << 3) +#endif #endif /* _ASM_IA64_CACHE_H */ diff --git a/include/asm-ia64/current.h b/include/asm-ia64/current.h index 29aa54e6c..3d4f232f3 100644 --- a/include/asm-ia64/current.h +++ b/include/asm-ia64/current.h @@ -2,8 +2,8 @@ #define _ASM_IA64_CURRENT_H /* - * Copyright (C) 1998, 1999 Hewlett-Packard Co - * Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com> + * Copyright (C) 1998-2000 Hewlett-Packard Co + * Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com> */ /* In kernel mode, thread pointer (r13) is used to point to the diff --git a/include/asm-ia64/elf.h b/include/asm-ia64/elf.h index 8176841d1..c0ae62524 100644 --- a/include/asm-ia64/elf.h +++ b/include/asm-ia64/elf.h @@ -82,8 +82,7 @@ extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst); #define ELF_PLATFORM 0 #ifdef __KERNEL__ -# define SET_PERSONALITY(EX,IBCS2) \ - (current->personality = (IBCS2) ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #endif /* _ASM_IA64_ELF_H */ diff --git a/include/asm-ia64/hardirq.h b/include/asm-ia64/hardirq.h index cd256f403..ab7dad947 100644 --- a/include/asm-ia64/hardirq.h +++ b/include/asm-ia64/hardirq.h @@ -54,8 +54,8 @@ extern irq_cpustat_t irq_stat[NR_CPUS]; #include <asm/atomic.h> #include <asm/smp.h> -extern unsigned char global_irq_holder; -extern unsigned volatile int global_irq_lock; +extern unsigned int global_irq_holder; +extern volatile unsigned int global_irq_lock; static inline int irqs_running (void) { diff --git a/include/asm-ia64/hw_irq.h b/include/asm-ia64/hw_irq.h index b897bea30..e4dd5c1ee 100644 --- a/include/asm-ia64/hw_irq.h +++ b/include/asm-ia64/hw_irq.h @@ -11,8 +11,7 @@ #include <linux/types.h> #include <asm/ptrace.h> - -#define NR_ISA_IRQS 16 +#include <asm/smp.h> /* * 0 special @@ -42,6 +41,8 @@ /* IA64 inter-cpu interrupt related definitions */ +#define IPI_DEFAULT_BASE_ADDR 0xfee00000 + /* Delivery modes for inter-cpu interrupts */ enum { IA64_IPI_DM_INT = 0x0, /* pend an external interrupt */ @@ -57,20 +58,26 @@ enum { extern __u8 isa_irq_to_vector_map[16]; #define isa_irq_to_vector(x) isa_irq_to_vector_map[(x)] -extern struct hw_interrupt_type irq_type_ia64_internal; /* CPU-internal interrupt controller */ +extern unsigned long ipi_base_addr; -extern void ipi_send (int cpu, int vector, int delivery_mode); +extern struct hw_interrupt_type irq_type_ia64_sapic; /* CPU-internal interrupt controller */ -#ifdef CONFIG_SMP -extern void handle_IPI(int irq, void *dev_id, struct pt_regs *regs); +extern void ipi_send (int cpu, int vector, int delivery_mode, int redirect); static inline void -hw_resend_irq (struct hw_interrupt_type *h, unsigned int i) +hw_resend_irq (struct hw_interrupt_type *h, unsigned int vector) { - send_IPI_self(i); -} + int my_cpu_id; + +#ifdef CONFIG_SMP + my_cpu_id = smp_processor_id(); #else -# define hw_resend_irq(h,i) + __u64 lid; + + __asm__ ("mov %0=cr.lid" : "=r"(lid)); + my_cpu_id = (lid >> 24) & 0xff; /* extract id (ignore eid) */ #endif + ipi_send(my_cpu_id, vector, IA64_IPI_DM_INT, 0); +} #endif /* _ASM_IA64_HW_IRQ_H */ diff --git a/include/asm-ia64/ia32.h b/include/asm-ia64/ia32.h index d76ce8b58..7870762ba 100644 --- a/include/asm-ia64/ia32.h +++ b/include/asm-ia64/ia32.h @@ -90,7 +90,7 @@ struct sigcontext_ia32 { unsigned int eflags; unsigned int esp_at_signal; unsigned short ss, __ssh; - struct _fpstate_ia32 * fpstate; + unsigned int fpstate; /* really (struct _fpstate_ia32 *) */ unsigned int oldmask; unsigned int cr2; }; @@ -221,8 +221,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; #define ELF_PLATFORM 0 #ifdef __KERNEL__ -# define SET_PERSONALITY(EX,IBCS2) \ - (current->personality = (IBCS2) ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #define IA32_EFLAG 0x200 @@ -288,9 +287,14 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; * IA32 floating point control registers starting values */ -#define IA32_FSR_DEFAULT 0x555500000 /* set all tag bits */ +#define IA32_FSR_DEFAULT 0x55550000 /* set all tag bits */ #define IA32_FCR_DEFAULT 0x33f /* single precision, all masks */ +#define IA32_PTRACE_GETREGS 12 +#define IA32_PTRACE_SETREGS 13 +#define IA32_PTRACE_GETFPREGS 14 +#define IA32_PTRACE_SETFPREGS 15 + #define ia32_start_thread(regs,new_ip,new_sp) do { \ set_fs(USER_DS); \ ia64_psr(regs)->cpl = 3; /* set user mode */ \ @@ -303,10 +307,11 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; } while (0) extern void ia32_gdt_init (void); -extern long ia32_setup_frame1 (int sig, struct k_sigaction *ka, siginfo_t *info, +extern int ia32_setup_frame1 (int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set, struct pt_regs *regs); extern void ia32_init_addr_space (struct pt_regs *regs); extern int ia32_setup_arg_pages (struct linux_binprm *bprm); +extern int ia32_exception (struct pt_regs *regs, unsigned long isr); #endif /* !CONFIG_IA32_SUPPORT */ diff --git a/include/asm-ia64/ide.h b/include/asm-ia64/ide.h index 023203dc3..4ea799861 100644 --- a/include/asm-ia64/ide.h +++ b/include/asm-ia64/ide.h @@ -15,6 +15,8 @@ #include <linux/config.h> +#include <linux/irq.h> + #ifndef MAX_HWIFS # ifdef CONFIG_BLK_DEV_IDEPCI #define MAX_HWIFS 10 @@ -29,12 +31,12 @@ static __inline__ int ide_default_irq (ide_ioreg_t base) { switch (base) { - case 0x1f0: return 14; - case 0x170: return 15; - case 0x1e8: return 11; - case 0x168: return 10; - case 0x1e0: return 8; - case 0x160: return 12; + case 0x1f0: return isa_irq_to_vector(14); + case 0x170: return isa_irq_to_vector(15); + case 0x1e8: return isa_irq_to_vector(11); + case 0x168: return isa_irq_to_vector(10); + case 0x1e0: return isa_irq_to_vector(8); + case 0x160: return isa_irq_to_vector(12); default: return 0; } diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h index ad532b26b..a371f1361 100644 --- a/include/asm-ia64/io.h +++ b/include/asm-ia64/io.h @@ -13,8 +13,8 @@ * over and over again with slight variations and possibly making a * mistake somewhere. * - * Copyright (C) 1998, 1999 Hewlett-Packard Co - * Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com> + * Copyright (C) 1998-2000 Hewlett-Packard Co + * Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com> * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com> * Copyright (C) 1999 Don Dugger <don.dugger@intel.com> */ @@ -253,66 +253,66 @@ __outsl (unsigned long port, void *src, unsigned long count) /* * The address passed to these functions are ioremap()ped already. */ -extern inline unsigned long -__readb (unsigned long addr) +extern inline unsigned char +__readb (void *addr) { return *(volatile unsigned char *)addr; } -extern inline unsigned long -__readw (unsigned long addr) +extern inline unsigned short +__readw (void *addr) { return *(volatile unsigned short *)addr; } -extern inline unsigned long -__readl (unsigned long addr) +extern inline unsigned int +__readl (void *addr) { return *(volatile unsigned int *) addr; } extern inline unsigned long -__readq (unsigned long addr) +__readq (void *addr) { return *(volatile unsigned long *) addr; } extern inline void -__writeb (unsigned char val, unsigned long addr) +__writeb (unsigned char val, void *addr) { *(volatile unsigned char *) addr = val; } extern inline void -__writew (unsigned short val, unsigned long addr) +__writew (unsigned short val, void *addr) { *(volatile unsigned short *) addr = val; } extern inline void -__writel (unsigned int val, unsigned long addr) +__writel (unsigned int val, void *addr) { *(volatile unsigned int *) addr = val; } extern inline void -__writeq (unsigned long val, unsigned long addr) +__writeq (unsigned long val, void *addr) { *(volatile unsigned long *) addr = val; } -#define readb __readb -#define readw __readw -#define readl __readl -#define readq __readqq +#define readb(a) __readb((void *)(a)) +#define readw(a) __readw((void *)(a)) +#define readl(a) __readl((void *)(a)) +#define readq(a) __readqq((void *)(a)) #define __raw_readb readb #define __raw_readw readw #define __raw_readl readl #define __raw_readq readq -#define writeb __writeb -#define writew __writew -#define writel __writel -#define writeq __writeq +#define writeb(v,a) __writeb((v), (void *) (a)) +#define writew(v,a) __writew((v), (void *) (a)) +#define writel(v,a) __writel((v), (void *) (a)) +#define writeq(v,a) __writeq((v), (void *) (a)) #define __raw_writeb writeb #define __raw_writew writew #define __raw_writeq writeq diff --git a/include/asm-ia64/kdbsupport.h b/include/asm-ia64/kdbsupport.h deleted file mode 100644 index beb846f79..000000000 --- a/include/asm-ia64/kdbsupport.h +++ /dev/null @@ -1,252 +0,0 @@ -#ifndef _ASM_IA64_KDBSUPPORT_H -#define _ASM_IA64_KDBSUPPORT_H - -/* - * Kernel Debugger Breakpoint Handler - * - * Copyright 1999, Silicon Graphics, Inc. - * - * Written March 1999 by Scott Lurndal at Silicon Graphics, Inc. - */ - -#include <asm/ptrace.h> - - /* - * This file provides definitions for functions that - * are dependent upon the product into which kdb is - * linked. - * - * This version is for linux. - */ -typedef void (*handler_t)(struct pt_regs *); -typedef unsigned long k_machreg_t; - -unsigned long show_cur_stack_frame(struct pt_regs *, int, unsigned long *) ; - -extern char* kbd_getstr(char *, size_t, char *); -extern int kdbinstalltrap(int, handler_t, handler_t*); -extern int kdbinstalldbreg(kdb_bp_t *); -extern void kdbremovedbreg(kdb_bp_t *); -extern void kdb_initbptab(void); -extern int kdbgetregcontents(const char *, struct pt_regs *, unsigned long *); -extern int kdbsetregcontents(const char *, struct pt_regs *, unsigned long); -extern int kdbdumpregs(struct pt_regs *, const char *, const char *); - -typedef int kdbintstate_t; - -extern void kdb_disableint(kdbintstate_t *); -extern void kdb_restoreint(kdbintstate_t *); - -extern k_machreg_t kdb_getpc(struct pt_regs *); -extern int kdb_setpc(struct pt_regs *, k_machreg_t); - -extern int kdb_putword(unsigned long, unsigned long); -extern int kdb_getcurrentframe(struct pt_regs *); - -/* - * kdb_db_trap is a processor dependent routine invoked - * from kdb() via the #db trap handler. It handles breakpoints involving - * the processor debug registers and handles single step traps - * using the processor trace flag. - */ - -#define KDB_DB_BPT 0 /* Straight breakpoint */ -#define KDB_DB_SS 1 /* Single Step trap */ -#define KDB_DB_SSB 2 /* Single Step, caller should continue */ - -extern int kdb_db_trap(struct pt_regs *, int); - -extern int kdb_allocdbreg(kdb_bp_t *); -extern void kdb_freedbreg(kdb_bp_t *); -extern void kdb_initdbregs(void); - -extern void kdb_setsinglestep(struct pt_regs *); - - /* - * Support for ia32 architecture debug registers. - */ -#define KDB_DBREGS 4 -extern k_machreg_t dbregs[]; - -#define DR6_BT 0x00008000 -#define DR6_BS 0x00004000 -#define DR6_BD 0x00002000 - -#define DR6_B3 0x00000008 -#define DR6_B2 0x00000004 -#define DR6_B1 0x00000002 -#define DR6_B0 0x00000001 - -#define DR7_RW_VAL(dr, drnum) \ - (((dr) >> (16 + (4 * (drnum)))) & 0x3) - -#define DR7_RW_SET(dr, drnum, rw) \ - do { \ - (dr) &= ~(0x3 << (16 + (4 * (drnum)))); \ - (dr) |= (((rw) & 0x3) << (16 + (4 * (drnum)))); \ - } while (0) - -#define DR7_RW0(dr) DR7_RW_VAL(dr, 0) -#define DR7_RW0SET(dr,rw) DR7_RW_SET(dr, 0, rw) -#define DR7_RW1(dr) DR7_RW_VAL(dr, 1) -#define DR7_RW1SET(dr,rw) DR7_RW_SET(dr, 1, rw) -#define DR7_RW2(dr) DR7_RW_VAL(dr, 2) -#define DR7_RW2SET(dr,rw) DR7_RW_SET(dr, 2, rw) -#define DR7_RW3(dr) DR7_RW_VAL(dr, 3) -#define DR7_RW3SET(dr,rw) DR7_RW_SET(dr, 3, rw) - - -#define DR7_LEN_VAL(dr, drnum) \ - (((dr) >> (18 + (4 * (drnum)))) & 0x3) - -#define DR7_LEN_SET(dr, drnum, rw) \ - do { \ - (dr) &= ~(0x3 << (18 + (4 * (drnum)))); \ - (dr) |= (((rw) & 0x3) << (18 + (4 * (drnum)))); \ - } while (0) - -#define DR7_LEN0(dr) DR7_LEN_VAL(dr, 0) -#define DR7_LEN0SET(dr,len) DR7_LEN_SET(dr, 0, len) -#define DR7_LEN1(dr) DR7_LEN_VAL(dr, 1) -#define DR7_LEN1SET(dr,len) DR7_LEN_SET(dr, 1, len) -#define DR7_LEN2(dr) DR7_LEN_VAL(dr, 2) -#define DR7_LEN2SET(dr,len) DR7_LEN_SET(dr, 2, len) -#define DR7_LEN3(dr) DR7_LEN_VAL(dr, 3) -#define DR7_LEN3SET(dr,len) DR7_LEN_SET(dr, 3, len) - -#define DR7_G0(dr) (((dr)>>1)&0x1) -#define DR7_G0SET(dr) ((dr) |= 0x2) -#define DR7_G0CLR(dr) ((dr) &= ~0x2) -#define DR7_G1(dr) (((dr)>>3)&0x1) -#define DR7_G1SET(dr) ((dr) |= 0x8) -#define DR7_G1CLR(dr) ((dr) &= ~0x8) -#define DR7_G2(dr) (((dr)>>5)&0x1) -#define DR7_G2SET(dr) ((dr) |= 0x20) -#define DR7_G2CLR(dr) ((dr) &= ~0x20) -#define DR7_G3(dr) (((dr)>>7)&0x1) -#define DR7_G3SET(dr) ((dr) |= 0x80) -#define DR7_G3CLR(dr) ((dr) &= ~0x80) - -#define DR7_L0(dr) (((dr))&0x1) -#define DR7_L0SET(dr) ((dr) |= 0x1) -#define DR7_L0CLR(dr) ((dr) &= ~0x1) -#define DR7_L1(dr) (((dr)>>2)&0x1) -#define DR7_L1SET(dr) ((dr) |= 0x4) -#define DR7_L1CLR(dr) ((dr) &= ~0x4) -#define DR7_L2(dr) (((dr)>>4)&0x1) -#define DR7_L2SET(dr) ((dr) |= 0x10) -#define DR7_L2CLR(dr) ((dr) &= ~0x10) -#define DR7_L3(dr) (((dr)>>6)&0x1) -#define DR7_L3SET(dr) ((dr) |= 0x40) -#define DR7_L3CLR(dr) ((dr) &= ~0x40) - -#define DR7_GD 0x00002000 /* General Detect Enable */ -#define DR7_GE 0x00000200 /* Global exact */ -#define DR7_LE 0x00000100 /* Local exact */ - -extern k_machreg_t kdb_getdr6(void); -extern void kdb_putdr6(k_machreg_t); - -extern k_machreg_t kdb_getdr7(void); -extern void kdb_putdr7(k_machreg_t); - -extern k_machreg_t kdb_getdr(int); -extern void kdb_putdr(int, k_machreg_t); - -extern k_machreg_t kdb_getcr(int); - -extern void kdb_bp_install(void); -extern void kdb_bp_remove(void); - -/* - * Support for setjmp/longjmp - */ -#define JB_BX 0 -#define JB_SI 1 -#define JB_DI 2 -#define JB_BP 3 -#define JB_SP 4 -#define JB_PC 5 - -typedef struct __kdb_jmp_buf { - unsigned long regs[6]; -} kdb_jmp_buf; - -extern int kdb_setjmp(kdb_jmp_buf *); -extern void kdb_longjmp(kdb_jmp_buf *, int); - -extern kdb_jmp_buf kdbjmpbuf; - -#define getprsregs(regs) ((struct switch_stack *)regs -1) - -#define BITMASK(bp,value) (value << bp) - -/* bkpt support using break inst instead of IBP reg */ - -/* - * Define certain specific instructions - */ -#define BREAK_INSTR (0x00000080100L << 11) -#define INST_SLOT0_MASK (0x1ffffffffffL << 5) - -#if 0 -#define MAX_BREAKPOINTS 40 -#define PSR_SS 40 -#endif - -/** - * IA-64 instruction format structures - */ -typedef union bundle { - struct { - long low8; - long high8; - } lform; - struct { - int low_low4; - int low_high4; - long high8; - } iform; -} bundle_t; - -#define BKPTMODE_DATAR 3 -#define BKPTMODE_IO 2 -#define BKPTMODE_DATAW 1 -#define BKPTMODE_INST 0 - -/* Some of the fault registers needed by kdb but not passed with - * regs or switch stack. - */ -typedef struct fault_regs { - unsigned long isr ; - unsigned long ifa ; - unsigned long iim ; - unsigned long itir ; -} fault_regs_t ; - -/* - * State of kdb - */ - -typedef struct kdb_state { - int cmd_given ; - int reason_for_entry ; - int bkpt_handling_state ; - int kdb_action ; -} kdb_state_t ; - -#define BKPTSTATE_NOT_HANDLED 0 -#define BKPTSTATE_HANDLED 1 - -#define CMDGIVEN_UNKNOWN 0 -#define CMDGIVEN_SSTEP 1 -#define CMDGIVEN_GO 2 - -#define ENTRYREASON_GO 0 -#define ENTRYREASON_SSTEP 1 - -#define ACTION_UNKNOWN 0 -#define ACTION_NOBPINSTALL 1 -#define ACTION_NOPROMPT 2 - -#endif /* _ASM_IA64_KDBSUPPORT_H */ diff --git a/include/asm-ia64/keyboard.h b/include/asm-ia64/keyboard.h index 38dbbc7bb..9259e163c 100644 --- a/include/asm-ia64/keyboard.h +++ b/include/asm-ia64/keyboard.h @@ -11,7 +11,7 @@ # ifdef __KERNEL__ -#include <linux/config.h> +#include <linux/irq.h> #define KEYBOARD_IRQ isa_irq_to_vector(1) #define DISABLE_KBD_DURING_INTERRUPTS 0 @@ -38,9 +38,6 @@ extern unsigned char pckbd_sysrq_xlate[128]; #define INIT_KBD #define SYSRQ_KEY 0x54 -#if defined(CONFIG_KDB) -#define E1_PAUSE 119 /* PAUSE key */ -#endif /* resource allocation */ #define kbd_request_region() diff --git a/include/asm-ia64/mca.h b/include/asm-ia64/mca.h index 0b9df0dcd..054b999f8 100644 --- a/include/asm-ia64/mca.h +++ b/include/asm-ia64/mca.h @@ -6,9 +6,14 @@ * Copyright (C) Vijay Chander (vijay@engr.sgi.com) * Copyright (C) Srinivasa Thirumalachar (sprasad@engr.sgi.com) */ + +/* XXX use this temporary define for MP systems trying to INIT */ +#define SAL_MPINIT_WORKAROUND + #ifndef _ASM_IA64_MCA_H #define _ASM_IA64_MCA_H +#if !defined(__ASSEMBLY__) #include <linux/types.h> #include <asm/param.h> #include <asm/sal.h> @@ -119,7 +124,7 @@ typedef struct ia64_mca_os_to_sal_state_s { typedef int (*prfunc_t)(const char * fmt, ...); -extern void mca_init(void); +extern void ia64_mca_init(void); extern void ia64_os_mca_dispatch(void); extern void ia64_os_mca_dispatch_end(void); extern void ia64_mca_ucmc_handler(void); @@ -134,10 +139,12 @@ extern void ia64_log_print(int,int,prfunc_t); #undef MCA_TEST -#if defined(MCA_TEST) -# define MCA_DEBUG printk +#define IA64_MCA_DEBUG_INFO 1 + +#if defined(IA64_MCA_DEBUG_INFO) +# define IA64_MCA_DEBUG printk #else -# define MCA_DEBUG +# define IA64_MCA_DEBUG #endif - +#endif /* !__ASSEMBLY__ */ #endif /* _ASM_IA64_MCA_H */ diff --git a/include/asm-ia64/mca_asm.h b/include/asm-ia64/mca_asm.h index 97f36e587..030c1969b 100644 --- a/include/asm-ia64/mca_asm.h +++ b/include/asm-ia64/mca_asm.h @@ -3,7 +3,9 @@ * * Copyright (C) 1999 Silicon Graphics, Inc. * Copyright (C) Vijay Chander (vijay@engr.sgi.com) - * Copyright (C) Srinivasa Thirumalachar (sprasad@engr.sgi.com) + * Copyright (C) Srinivasa Thirumalachar <sprasad@engr.sgi.com> + * Copyright (C) 2000 Hewlett-Packard Co. + * Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com> */ #ifndef _ASM_IA64_MCA_ASM_H #define _ASM_IA64_MCA_ASM_H @@ -70,25 +72,26 @@ ;; \ dep old_psr = 0, old_psr, 32, 32; \ \ - mov ar##.##rsc = r0 ; \ + mov ar.rsc = r0 ; \ ;; \ - mov temp2 = ar##.##bspstore; \ + mov temp2 = ar.bspstore; \ ;; \ DATA_VA_TO_PA(temp2); \ ;; \ - mov temp1 = ar##.##rnat; \ + mov temp1 = ar.rnat; \ ;; \ - mov ar##.##bspstore = temp2; \ + mov ar.bspstore = temp2; \ ;; \ - mov ar##.##rnat = temp1; \ + mov ar.rnat = temp1; \ mov temp1 = psr; \ mov temp2 = psr; \ ;; \ \ dep temp2 = 0, temp2, PSR_IC, 2; \ ;; \ - mov psr##.##l = temp2; \ - \ + mov psr.l = temp2; \ + ;; \ + srlz.d; \ dep temp1 = 0, temp1, 32, 32; \ ;; \ dep temp1 = 0, temp1, PSR_IT, 1; \ @@ -100,15 +103,16 @@ dep temp1 = 0, temp1, PSR_I, 1; \ ;; \ movl temp2 = start_addr; \ - mov cr##.##ipsr = temp1; \ + mov cr.ipsr = temp1; \ ;; \ INST_VA_TO_PA(temp2); \ - mov cr##.##iip = temp2; \ - mov cr##.##ifs = r0; \ + ;; \ + mov cr.iip = temp2; \ + mov cr.ifs = r0; \ DATA_VA_TO_PA(sp) \ DATA_VA_TO_PA(gp) \ ;; \ - srlz##.##i; \ + srlz.i; \ ;; \ nop 1; \ nop 2; \ @@ -143,18 +147,19 @@ ;; \ dep temp2 = 0, temp2, PSR_IC, 2; \ ;; \ - mov psr##.##l = temp2; \ - mov ar##.##rsc = r0 ; \ + mov psr.l = temp2; \ + mov ar.rsc = r0; \ ;; \ - mov temp2 = ar##.##bspstore; \ + srlz.d; \ + mov temp2 = ar.bspstore; \ ;; \ DATA_PA_TO_VA(temp2,temp1); \ ;; \ - mov temp1 = ar##.##rnat; \ + mov temp1 = ar.rnat; \ ;; \ - mov ar##.##bspstore = temp2; \ + mov ar.bspstore = temp2; \ ;; \ - mov ar##.##rnat = temp1; \ + mov ar.rnat = temp1; \ ;; \ mov temp1 = old_psr; \ ;; \ @@ -172,12 +177,12 @@ dep temp1 = temp2, temp1, PSR_BN, 1; \ ;; \ \ - mov cr##.##ipsr = temp1; \ + mov cr.ipsr = temp1; \ movl temp2 = start_addr; \ ;; \ - mov cr##.##iip = temp2; \ + mov cr.iip = temp2; \ DATA_PA_TO_VA(sp, temp1); \ - DATA_PA_TO_VA(gp, temp1); \ + DATA_PA_TO_VA(gp, temp2); \ ;; \ nop 1; \ nop 2; \ @@ -226,19 +231,19 @@ */ #define rse_switch_context(temp,p_stackframe,p_bspstore) \ ;; \ - mov temp=ar##.##rsc;; \ + mov temp=ar.rsc;; \ st8 [p_stackframe]=temp,8;; \ - mov temp=ar##.##pfs;; \ + mov temp=ar.pfs;; \ st8 [p_stackframe]=temp,8; \ cover ;; \ - mov temp=cr##.##ifs;; \ + mov temp=cr.ifs;; \ st8 [p_stackframe]=temp,8;; \ - mov temp=ar##.##bspstore;; \ + mov temp=ar.bspstore;; \ st8 [p_stackframe]=temp,8;; \ - mov temp=ar##.##rnat;; \ + mov temp=ar.rnat;; \ st8 [p_stackframe]=temp,8; \ - mov ar##.##bspstore=p_bspstore;; \ - mov temp=ar##.##bsp;; \ + mov ar.bspstore=p_bspstore;; \ + mov temp=ar.bsp;; \ sub temp=temp,p_bspstore;; \ st8 [p_stackframe]=temp,8 @@ -262,23 +267,23 @@ add p_stackframe=rse_ndirty_offset,p_stackframe;; \ ld8 temp=[p_stackframe];; \ shl temp=temp,16;; \ - mov ar##.##rsc=temp;; \ + mov ar.rsc=temp;; \ loadrs;; \ add p_stackframe=-rse_ndirty_offset+rse_bspstore_offset,p_stackframe;;\ ld8 temp=[p_stackframe];; \ - mov ar##.##bspstore=temp;; \ + mov ar.bspstore=temp;; \ add p_stackframe=-rse_bspstore_offset+rse_rnat_offset,p_stackframe;;\ ld8 temp=[p_stackframe];; \ - mov ar##.##rnat=temp;; \ + mov ar.rnat=temp;; \ add p_stackframe=-rse_rnat_offset+rse_pfs_offset,p_stackframe;; \ ld8 temp=[p_stackframe];; \ - mov ar##.##pfs=temp; \ + mov ar.pfs=temp; \ add p_stackframe=-rse_pfs_offset+rse_ifs_offset,p_stackframe;; \ ld8 temp=[p_stackframe];; \ - mov cr##.##ifs=temp; \ + mov cr.ifs=temp; \ add p_stackframe=-rse_ifs_offset+rse_rsc_offset,p_stackframe;; \ ld8 temp=[p_stackframe];; \ - mov ar##.##rsc=temp ; \ + mov ar.rsc=temp ; \ add p_stackframe=-rse_rsc_offset,p_stackframe; \ mov temp=cr.ipsr;; \ st8 [p_stackframe]=temp,8; \ diff --git a/include/asm-ia64/mman.h b/include/asm-ia64/mman.h index 93e73d77b..8687682f9 100644 --- a/include/asm-ia64/mman.h +++ b/include/asm-ia64/mman.h @@ -2,8 +2,8 @@ #define _ASM_IA64_MMAN_H /* - * Copyright (C) 1998, 1999 Hewlett-Packard Co - * Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com> + * Copyright (C) 1998-2000 Hewlett-Packard Co + * Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com> */ #define PROT_READ 0x1 /* page can be read */ @@ -31,6 +31,12 @@ #define MCL_CURRENT 1 /* lock all current mappings */ #define MCL_FUTURE 2 /* lock all future mappings */ +#define MADV_NORMAL 0x0 /* default page-in behavior */ +#define MADV_RANDOM 0x1 /* page-in minimum required */ +#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ +#define MADV_WILLNEED 0x3 /* pre-fault pages */ +#define MADV_DONTNEED 0x4 /* discard these pages */ + /* compatibility flags */ #define MAP_ANON MAP_ANONYMOUS #define MAP_FILE 0 diff --git a/include/asm-ia64/offsets.h b/include/asm-ia64/offsets.h index 72eccbc24..de309ee56 100644 --- a/include/asm-ia64/offsets.h +++ b/include/asm-ia64/offsets.h @@ -10,7 +10,7 @@ #define PF_PTRACED_BIT 4 -#define IA64_TASK_SIZE 2800 /* 0xaf0 */ +#define IA64_TASK_SIZE 2816 /* 0xb00 */ #define IA64_PT_REGS_SIZE 400 /* 0x190 */ #define IA64_SWITCH_STACK_SIZE 560 /* 0x230 */ #define IA64_SIGINFO_SIZE 136 /* 0x88 */ @@ -21,6 +21,7 @@ #define IA64_TASK_PROCESSOR_OFFSET 108 /* 0x6c */ #define IA64_TASK_THREAD_OFFSET 928 /* 0x3a0 */ #define IA64_TASK_THREAD_KSP_OFFSET 928 /* 0x3a0 */ +#define IA64_TASK_THREAD_SIGMASK_OFFSET 2656 /* 0xa60 */ #define IA64_TASK_PID_OFFSET 188 /* 0xbc */ #define IA64_TASK_MM_OFFSET 88 /* 0x58 */ #define IA64_PT_REGS_CR_IPSR_OFFSET 0 /* 0x0 */ @@ -34,5 +35,7 @@ #define IA64_SIGCONTEXT_FLAGS_OFFSET 0 /* 0x0 */ #define IA64_SIGCONTEXT_CFM_OFFSET 48 /* 0x30 */ #define IA64_SIGCONTEXT_FR6_OFFSET 560 /* 0x230 */ +#define IA64_CLONE_VFORK 16384 /* 0x4000 */ +#define IA64_CLONE_VM 256 /* 0x100 */ #endif /* _ASM_IA64_OFFSETS_H */ diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h index 1289930fc..afae33050 100644 --- a/include/asm-ia64/pal.h +++ b/include/asm-ia64/pal.h @@ -15,6 +15,7 @@ * * 99/10/01 davidm Make sure we pass zero for reserved parameters. * 00/03/07 davidm Updated pal_cache_flush() to be in sync with PAL v2.6. + * 00/03/23 cfleck Modified processor min-state save area to match updated PAL & SAL info */ /* @@ -595,18 +596,27 @@ typedef union pal_mc_error_info_u { #define pmci_bus_external_error pme_bus.eb #define pmci_bus_mc pme_bus.mc +/* + * NOTE: this min_state_save area struct only includes the 1KB + * architectural state save area. The other 3 KB is scratch space + * for PAL. + */ typedef struct pal_min_state_area_s { - u64 pmsa_reserved[26]; - u64 pmsa_xfs; - u64 pmsa_xpsr; - u64 pmsa_xip; - u64 pmsa_rsc; - u64 pmsa_br0; - u64 pmsa_pr; - u64 pmsa_bank0_gr[16]; - u64 pmsa_gr[16]; - u64 pmsa_nat_bits; + u64 pmsa_nat_bits; /* nat bits for saved GRs */ + u64 pmsa_gr[15]; /* GR1 - GR15 */ + u64 pmsa_bank0_gr[16]; /* GR16 - GR31 */ + u64 pmsa_bank1_gr[16]; /* GR16 - GR31 */ + u64 pmsa_pr; /* predicate registers */ + u64 pmsa_br0; /* branch register 0 */ + u64 pmsa_rsc; /* ar.rsc */ + u64 pmsa_iip; /* cr.iip */ + u64 pmsa_ipsr; /* cr.ipsr */ + u64 pmsa_ifs; /* cr.ifs */ + u64 pmsa_xip; /* previous iip */ + u64 pmsa_xpsr; /* previous psr */ + u64 pmsa_xfs; /* previous ifs */ + u64 pmsa_reserved[71]; /* pal_min_state_area should total to 1KB */ } pal_min_state_area_t; diff --git a/include/asm-ia64/pgalloc.h b/include/asm-ia64/pgalloc.h index b26321422..7c35de4bc 100644 --- a/include/asm-ia64/pgalloc.h +++ b/include/asm-ia64/pgalloc.h @@ -139,6 +139,9 @@ free_pte_fast (pte_t *pte) #define pmd_free(pmd) free_pmd_fast(pmd) #define pgd_free(pgd) free_pgd_fast(pgd) +extern void __handle_bad_pgd (pgd_t *pgd); +extern void __handle_bad_pmd (pmd_t *pmd); + extern __inline__ pte_t* pte_alloc (pmd_t *pmd, unsigned long vmaddr) { @@ -242,11 +245,6 @@ extern void flush_tlb_range (struct mm_struct *mm, unsigned long start, unsigned /* * Page-granular tlb flush. - * - * do a tbisd (type = 2) normally, and a tbis (type = 3) - * if it is an executable mapping. We want to avoid the - * itlb flush, because that potentially also does a - * icache flush. */ static __inline__ void flush_tlb_page (struct vm_area_struct *vma, unsigned long addr) diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h index 7c3fbdd95..a7f5ceb56 100644 --- a/include/asm-ia64/pgtable.h +++ b/include/asm-ia64/pgtable.h @@ -8,16 +8,24 @@ * This hopefully works with any (fixed) ia-64 page-size, as defined * in <asm/page.h> (currently 8192). * - * Copyright (C) 1998, 1999 Hewlett-Packard Co - * Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com> + * Copyright (C) 1998-2000 Hewlett-Packard Co + * Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com> */ +#include <linux/config.h> + #include <asm/mman.h> #include <asm/page.h> #include <asm/types.h> -/* Size of physical address space: */ -#define IA64_PHYS_BITS 50 /* EAS2.5 defines 50 bits of ppn */ +/* Size of virtuaql and physical address spaces: */ +#ifdef CONFIG_ITANIUM +# define IA64_IMPL_VA_MSB 50 +# define IA64_PHYS_BITS 44 /* Itanium PRM defines 44 bits of ppn */ +#else +# define IA64_IMPL_VA_MSB 60 /* maximum value (bits 61-63 are region bits) */ +# define IA64_PHYS_BITS 50 /* EAS2.6 allows up to 50 bits of ppn */ +#endif #define IA64_PHYS_SIZE (__IA64_UL(1) << IA64_PHYS_BITS) /* Is ADDR a valid kernel address? */ @@ -338,10 +346,6 @@ pgd_offset (struct mm_struct *mm, unsigned long address) ((pte_t *) pmd_page(*(dir)) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) -extern void __handle_bad_pgd (pgd_t *pgd); -extern void __handle_bad_pmd (pmd_t *pmd); - - extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; extern void paging_init (void); diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h index d31d746fa..d702b7f0c 100644 --- a/include/asm-ia64/processor.h +++ b/include/asm-ia64/processor.h @@ -62,6 +62,8 @@ #define IA64_PSR_TB_BIT 26 #define IA64_PSR_RT_BIT 27 /* The following are not affected by save_flags()/restore_flags(): */ +#define IA64_PSR_CPL0_BIT 32 +#define IA64_PSR_CPL1_BIT 33 #define IA64_PSR_IS_BIT 34 #define IA64_PSR_MC_BIT 35 #define IA64_PSR_IT_BIT 36 @@ -151,6 +153,7 @@ #define IA64_THREAD_DBG_VALID (__IA64_UL(1) << 1) /* debug registers valid? */ #define IA64_THREAD_UAC_NOPRINT (__IA64_UL(1) << 2) /* don't log unaligned accesses */ #define IA64_THREAD_UAC_SIGBUS (__IA64_UL(1) << 3) /* generate SIGBUS on unaligned acc. */ +#define IA64_THREAD_KRBS_SYNCED (__IA64_UL(1) << 4) /* krbs synced with process vm? */ #define IA64_KERNEL_DEATH (__IA64_UL(1) << 63) /* see die_if_kernel()... */ #define IA64_THREAD_UAC_SHIFT 2 @@ -270,6 +273,8 @@ typedef struct { (int *) (addr)); \ }) +struct siginfo; + struct thread_struct { __u64 ksp; /* kernel stack pointer */ unsigned long flags; /* various flags */ @@ -278,14 +283,19 @@ struct thread_struct { __u64 ibr[IA64_NUM_DBG_REGS]; __u64 map_base; /* base address for mmap() */ #ifdef CONFIG_IA32_SUPPORT + __u64 eflag; /* IA32 EFLAGS reg */ __u64 fsr; /* IA32 floating pt status reg */ __u64 fcr; /* IA32 floating pt control reg */ __u64 fir; /* IA32 fp except. instr. reg */ __u64 fdr; /* IA32 fp except. data reg */ -# define INIT_THREAD_IA32 , 0, 0, 0, 0 + union { + __u64 sigmask; /* aligned mask for sigsuspend scall */ + } un; +# define INIT_THREAD_IA32 , 0, 0, 0, 0, 0, {0} #else # define INIT_THREAD_IA32 #endif /* CONFIG_IA32_SUPPORT */ + struct siginfo *siginfo; /* current siginfo struct for ptrace() */ }; #define INIT_MMAP { \ @@ -300,7 +310,8 @@ struct thread_struct { {0, }, /* dbr */ \ {0, }, /* ibr */ \ 0x2000000000000000 /* map_base */ \ - INIT_THREAD_IA32 \ + INIT_THREAD_IA32, \ + 0 /* siginfo */ \ } #define start_thread(regs,new_ip,new_sp) do { \ diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h index d50ce82e7..caae43a3d 100644 --- a/include/asm-ia64/ptrace.h +++ b/include/asm-ia64/ptrace.h @@ -232,9 +232,11 @@ struct switch_stack { #endif /* !__ASSEMBLY__ */ /* - * The number chosen here is somewhat arbitrary but absolutely MUST + * The numbers chosen here are somewhat arbitrary but absolutely MUST * not overlap with any of the number assigned in <linux/ptrace.h>. */ #define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */ +#define PTRACE_GETSIGINFO 13 /* get child's siginfo structure */ +#define PTRACE_SETSIGINFO 14 /* set child's siginfo structure */ #endif /* _ASM_IA64_PTRACE_H */ diff --git a/include/asm-ia64/ptrace_offsets.h b/include/asm-ia64/ptrace_offsets.h index 46e8bccb1..fbbe9bff4 100644 --- a/include/asm-ia64/ptrace_offsets.h +++ b/include/asm-ia64/ptrace_offsets.h @@ -13,9 +13,9 @@ * struct ia64_fpreg fph[96]; // f32-f127 * struct switch_stack sw; * struct pt_regs pt; - * unsigned long rsvd1[358]; + * unsigned long rsvd1[712]; * unsigned long dbr[8]; - * unsigned long rsvd2[252]; + * unsigned long rsvd2[504]; * unsigned long ibr[8]; * } */ @@ -165,7 +165,8 @@ /* pt_regs */ #define PT_CR_IPSR 0x0830 #define PT_CR_IIP 0x0838 -#define PT_CR_IFS 0x0840 +#define PT_CFM 0x0840 +#define PT_CR_IFS PT_CFM /* Use of PT_CR_IFS is deprecated */ #define PT_AR_UNAT 0x0848 #define PT_AR_PFS 0x0850 #define PT_AR_RSC 0x0858 diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h index e26091a94..5fadec55f 100644 --- a/include/asm-ia64/sal.h +++ b/include/asm-ia64/sal.h @@ -12,6 +12,8 @@ * Copyright (C) 1999 Srinivasa Prasad Thirumalachar <sprasad@sprasad.engr.sgi.com> * * 99/09/29 davidm Updated for SAL 2.6. + * 00/03/29 cfleck Updated SAL Error Logging info for processor (SAL 2.6) + * (plus examples of platform error info structures from smariset @ Intel) */ #include <linux/config.h> @@ -274,8 +276,6 @@ typedef struct sal_log_processor_info_s { } slpi_bus_check_info[MAX_BUS_ERRORS]; pal_min_state_area_t slpi_min_state_area; - u64 slpi_bank1_gr[16]; - u64 slpi_bank1_nat_bits; u64 slpi_br[8]; u64 slpi_cr[128]; u64 slpi_ar[128]; @@ -283,6 +283,87 @@ typedef struct sal_log_processor_info_s { u64 slpi_fr[128]; } sal_log_processor_info_t; +/* platform error log structures */ +typedef struct platerr_logheader { + u64 nextlog; /* next log offset if present */ + u64 loglength; /* log length */ + u64 logsubtype; /* log subtype memory/bus/component */ + u64 eseverity; /* error severity */ +} ehdr_t; + +typedef struct sysmem_errlog { + ehdr_t lhdr; /* header */ + u64 vflag; /* valid bits for each field in the log */ + u64 addr; /* memory address */ + u64 data; /* memory data */ + u64 cmd; /* command bus value if any */ + u64 ctrl; /* control bus value if any */ + u64 addrsyndrome; /* memory address ecc/parity syndrome bits */ + u64 datasyndrome; /* data ecc/parity syndrome */ + u64 cacheinfo; /* platform cache info as defined in pal spec. table 7-34 */ +} merrlog_t; + +typedef struct sysbus_errlog { + ehdr_t lhdr; /* linkded list header */ + u64 vflag; /* valid bits for each field in the log */ + u64 busnum; /* bus number in error */ + u64 reqaddr; /* requestor address */ + u64 resaddr; /* responder address */ + u64 taraddr; /* target address */ + u64 data; /* requester r/w data */ + u64 cmd; /* bus commands */ + u64 ctrl; /* bus controls (be# &-0) */ + u64 addrsyndrome; /* addr bus ecc/parity bits */ + u64 datasyndrome; /* data bus ecc/parity bits */ + u64 cmdsyndrome; /* command bus ecc/parity bits */ + u64 ctrlsyndrome; /* control bus ecc/parity bits */ +} berrlog_t; + +/* platform error log structures */ +typedef struct syserr_chdr { /* one header per component */ + u64 busnum; /* bus number on which the component resides */ + u64 devnum; /* same as device select */ + u64 funcid; /* function id of the device */ + u64 devid; /* pci device id */ + u64 classcode; /* pci class code for the device */ + u64 cmdreg; /* pci command reg value */ + u64 statreg; /* pci status reg value */ +} chdr_t; + +typedef struct cfginfo { + u64 cfgaddr; + u64 cfgval; +} cfginfo_t; + +typedef struct sys_comperr { /* per component */ + ehdr_t lhdr; /* linked list header */ + u64 vflag; /* valid bits for each field in the log */ + chdr_t scomphdr; + u64 numregpair; /* number of reg addr/value pairs */ + cfginfo_t cfginfo; +} cerrlog_t; + +typedef struct sel_records { + ehdr_t lhdr; + u64 seldata; +} isel_t; + +typedef struct plat_errlog { + u64 mbcsvalid; /* valid bits for each type of log */ + merrlog_t smemerrlog; /* platform memory error logs */ + berrlog_t sbuserrlog; /* platform bus error logs */ + cerrlog_t scomperrlog; /* platform chipset error logs */ + isel_t selrecord; /* ipmi sel record */ +} platforminfo_t; + +/* over all log structure (processor+platform) */ + +typedef union udev_specific_log { + sal_log_processor_info_t proclog; + platforminfo_t platlog; +} devicelog_t; + + #define sal_log_processor_info_psi_valid slpi_valid.spli_psi #define sal_log_processor_info_cache_check_valid slpi_valid.spli_cache_check #define sal_log_processor_info_tlb_check_valid slpi_valid.spli_tlb_check @@ -303,15 +384,14 @@ typedef struct sal_log_header_s { ushort slh_log_type; /* Type of log (0 - cpu ,1 - platform) */ ushort slh_log_sub_type; /* SGI specific sub type */ sal_log_timestamp_t slh_log_timestamp; /* Timestamp */ - u64 slh_log_dev_spec_info; /* For processor log this field will - * contain an area architected for all - * IA-64 processors. For platform log - * this field will contain information - * specific to the hardware - * implementation. - */ } sal_log_header_t; +/* SAL PSI log structure */ +typedef struct psilog +{ + sal_log_header_t sal_elog_header; + devicelog_t devlog; +} ia64_psilog_t; /* * Now define a couple of inline functions for improved type checking diff --git a/include/asm-ia64/semaphore.h b/include/asm-ia64/semaphore.h index a50ee01e3..c42aff9ad 100644 --- a/include/asm-ia64/semaphore.h +++ b/include/asm-ia64/semaphore.h @@ -230,7 +230,7 @@ down_write (struct rw_semaphore *sem) do { old_count = sem->count; new_count = old_count - RW_LOCK_BIAS; - } while (cmpxchg(&sem->count, old_count, new_count) != old_count); + } while (cmpxchg_acq(&sem->count, old_count, new_count) != old_count); if (new_count != 0) __down_write_failed(sem, new_count); @@ -279,7 +279,7 @@ __up_write (struct rw_semaphore *sem) do { old_count = sem->count; new_count = old_count + RW_LOCK_BIAS; - } while (cmpxchg(&sem->count, old_count, new_count) != old_count); + } while (cmpxchg_rel(&sem->count, old_count, new_count) != old_count); /* * Note: new_count <u RW_LOCK_BIAS <=> old_count < 0 && new_count >= 0. diff --git a/include/asm-ia64/siginfo.h b/include/asm-ia64/siginfo.h index d3b71ccaf..9e04b129b 100644 --- a/include/asm-ia64/siginfo.h +++ b/include/asm-ia64/siginfo.h @@ -152,7 +152,8 @@ typedef struct siginfo { #define TRAP_BRKPT 1 /* process breakpoint */ #define TRAP_TRACE 2 /* process trace trap */ #define TRAP_BRANCH 3 /* process taken branch trap */ -#define NSIGTRAP 3 +#define TRAP_HWBKPT 4 /* hardware breakpoint or watchpoint */ +#define NSIGTRAP 4 /* * SIGCHLD si_codes diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h index 0fd137267..6175de538 100644 --- a/include/asm-ia64/smp.h +++ b/include/asm-ia64/smp.h @@ -18,10 +18,17 @@ #include <asm/ptrace.h> #include <asm/io.h> -#define IPI_DEFAULT_BASE_ADDR 0xfee00000 #define XTP_OFFSET 0x1e0008 -#define smp_processor_id() (current->processor) +#define SMP_IRQ_REDIRECTION (1 << 0) +#define SMP_IPI_REDIRECTION (1 << 1) + +#define smp_processor_id() (current->processor) + +struct smp_boot_data { + int cpu_count; + int cpu_map[NR_CPUS]; +}; extern unsigned long cpu_present_map; extern unsigned long cpu_online_map; @@ -29,52 +36,43 @@ extern unsigned long ipi_base_addr; extern int bootstrap_processor; extern volatile int __cpu_number_map[NR_CPUS]; extern volatile int __cpu_logical_map[NR_CPUS]; +extern unsigned char smp_int_redirect; +extern char no_int_routing; #define cpu_number_map(i) __cpu_number_map[i] #define cpu_logical_map(i) __cpu_logical_map[i] -#if defined(CONFIG_KDB) -extern volatile unsigned long smp_kdb_wait; -#endif /* CONFIG_KDB */ - extern unsigned long ap_wakeup_vector; /* * XTP control functions: * min_xtp : route all interrupts to this CPU * normal_xtp: nominal XTP value - * raise_xtp : Route all interrupts away from this CPU * max_xtp : never deliver interrupts to this CPU. */ -/* - * This turns off XTP based interrupt routing. There is a bug in the handling of - * IRQ_INPROGRESS when the same vector appears on more than one CPU. - */ -extern int use_xtp; - extern __inline void min_xtp(void) { - if (use_xtp) - writeb(0x80, ipi_base_addr | XTP_OFFSET); /* XTP to min */ + if (smp_int_redirect & SMP_IRQ_REDIRECTION) + writeb(0x00, ipi_base_addr | XTP_OFFSET); /* XTP to min */ } extern __inline void normal_xtp(void) { - if (use_xtp) - writeb(0x8e, ipi_base_addr | XTP_OFFSET); /* XTP normal */ + if (smp_int_redirect & SMP_IRQ_REDIRECTION) + writeb(0x08, ipi_base_addr | XTP_OFFSET); /* XTP normal */ } extern __inline void max_xtp(void) { - if (use_xtp) - writeb(0x8f, ipi_base_addr | XTP_OFFSET); /* Set XTP to max... */ + if (smp_int_redirect & SMP_IRQ_REDIRECTION) + writeb(0x0f, ipi_base_addr | XTP_OFFSET); /* Set XTP to max */ } -extern __inline unsigned int +extern __inline__ unsigned int hard_smp_processor_id(void) { struct { @@ -84,18 +82,19 @@ hard_smp_processor_id(void) unsigned long ignored : 32; } lid; - __asm__ __volatile__ ("mov %0=cr.lid" : "=r" (lid)); + __asm__ ("mov %0=cr.lid" : "=r" (lid)); - /* - * Damn. IA64 CPU ID's are 16 bits long, Linux expect the hard id to be - * in the range 0..31. So, return the low-order bits of the bus-local ID - * only and hope it's less than 32. This needs to be fixed... - */ - return (lid.id & 0x0f); +#ifdef LARGE_CPU_ID_OK + return lid.eid << 8 | lid.id; +#else + if (((lid.id << 8) | lid.eid) > NR_CPUS) + printk("WARNING: SMP ID %d > NR_CPUS\n", (lid.id << 8) | lid.eid); + return lid.id; +#endif } -#define NO_PROC_ID 0xffffffff -#define PROC_CHANGE_PENALTY 20 +#define NO_PROC_ID (-1) +#define PROC_CHANGE_PENALTY 20 extern void __init init_smp_config (void); extern void smp_do_timer (struct pt_regs *regs); diff --git a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h index ec10fb794..97a9511e8 100644 --- a/include/asm-ia64/spinlock.h +++ b/include/asm-ia64/spinlock.h @@ -2,8 +2,8 @@ #define _ASM_IA64_SPINLOCK_H /* - * Copyright (C) 1998, 1999 Hewlett-Packard Co - * Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com> + * Copyright (C) 1998-2000 Hewlett-Packard Co + * Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com> * Copyright (C) 1999 Walt Drummond <drummond@valinux.com> * * This file is used for SMP configurations only. @@ -16,29 +16,58 @@ typedef struct { volatile unsigned int lock; } spinlock_t; + #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } #define spin_lock_init(x) ((x)->lock = 0) -/* Streamlined test_and_set_bit(0, (x)) */ +/* + * Streamlined test_and_set_bit(0, (x)). We use test-and-test-and-set + * rather than a simple xchg to avoid writing the cache-line when + * there is contention. + */ +#if 1 /* Bad code generation? */ #define spin_lock(x) __asm__ __volatile__ ( \ - "mov ar.ccv = r0\n" \ - "mov r29 = 1\n" \ - ";;\n" \ - "1:\n" \ - "ld4 r2 = [%0]\n" \ - ";;\n" \ - "cmp4.eq p0,p7 = r0,r2\n" \ - "(p7) br.cond.dptk.few 1b \n" \ - "cmpxchg4.acq r2 = [%0], r29, ar.ccv\n" \ - ";;\n" \ - "cmp4.eq p0,p7 = r0, r2\n" \ - "(p7) br.cond.dptk.few 1b\n" \ - ";;\n" \ - :: "m" __atomic_fool_gcc((x)) : "r2", "r29") + "mov ar.ccv = r0\n" \ + "mov r29 = 1\n" \ + ";;\n" \ + "1:\n" \ + "ld4 r2 = %0\n" \ + ";;\n" \ + "cmp4.eq p0,p7 = r0,r2\n" \ + "(p7) br.cond.spnt.few 1b \n" \ + "cmpxchg4.acq r2 = %0, r29, ar.ccv\n" \ + ";;\n" \ + "cmp4.eq p0,p7 = r0, r2\n" \ + "(p7) br.cond.spnt.few 1b\n" \ + ";;\n" \ + :: "m" __atomic_fool_gcc((x)) : "r2", "r29") + +#else +#define spin_lock(x) \ +{ \ + spinlock_t *__x = (x); \ + \ + do { \ + while (__x->lock); \ + } while (cmpxchg_acq(&__x->lock, 0, 1)); \ +} +#endif -#define spin_unlock(x) __asm__ __volatile__ ("st4.rel [%0] = r0;;" : "=m" (__atomic_fool_gcc((x)))) +#define spin_is_locked(x) ((x)->lock != 0) -#define spin_trylock(x) (!test_and_set_bit(0, (x))) +#define spin_unlock(x) (((spinlock_t *) x)->lock = 0) + +/* Streamlined !test_and_set_bit(0, (x)) */ +#define spin_trylock(x) \ +({ \ + spinlock_t *__x = (x); \ + __u32 old; \ + \ + do { \ + old = __x->lock; \ + } while (cmpxchg_acq(&__x->lock, old, 1) != old); \ + old == 0; \ +}) #define spin_unlock_wait(x) \ ({ do { barrier(); } while(((volatile spinlock_t *)x)->lock); }) @@ -49,47 +78,43 @@ typedef struct { } rwlock_t; #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 } -#define read_lock(rw) \ -do { \ - int tmp = 0; \ - __asm__ __volatile__ ("1:\tfetchadd4.acq %0 = %1, 1\n" \ - ";;\n" \ - "tbit.nz p6,p0 = %0, 31\n" \ - "(p6) br.cond.sptk.few 2f\n" \ - ".section .text.lock,\"ax\"\n" \ - "2:\tfetchadd4.rel %0 = %1, -1\n" \ - ";;\n" \ - "3:\tld4.acq %0 = %1\n" \ - ";;\n" \ - "tbit.nz p6,p0 = %0, 31\n" \ - "(p6) br.cond.sptk.few 3b\n" \ - "br.cond.sptk.few 1b\n" \ - ";;\n" \ - ".previous\n": "=r" (tmp), "=m" (__atomic_fool_gcc(rw))); \ +#define read_lock(rw) \ +do { \ + int tmp = 0; \ + __asm__ __volatile__ ("1:\tfetchadd4.acq %0 = %1, 1\n" \ + ";;\n" \ + "tbit.nz p6,p0 = %0, 31\n" \ + "(p6) br.cond.sptk.few 2f\n" \ + ".section .text.lock,\"ax\"\n" \ + "2:\tfetchadd4.rel %0 = %1, -1\n" \ + ";;\n" \ + "3:\tld4.acq %0 = %1\n" \ + ";;\n" \ + "tbit.nz p6,p0 = %0, 31\n" \ + "(p6) br.cond.sptk.few 3b\n" \ + "br.cond.sptk.few 1b\n" \ + ";;\n" \ + ".previous\n": "=r" (tmp), "=m" (__atomic_fool_gcc(rw))); \ } while(0) -#define read_unlock(rw) \ -do { \ - int tmp = 0; \ - __asm__ __volatile__ ("fetchadd4.rel %0 = %1, -1\n" \ - : "=r" (tmp) : "m" (__atomic_fool_gcc(rw))); \ +#define read_unlock(rw) \ +do { \ + int tmp = 0; \ + __asm__ __volatile__ ("fetchadd4.rel %0 = %1, -1\n" \ + : "=r" (tmp) : "m" (__atomic_fool_gcc(rw))); \ } while(0) -/* - * These may need to be rewhacked in asm(). - * XXX FIXME SDV - This may have a race on real hardware but is sufficient for SoftSDV - */ -#define write_lock(rw) \ -while(1) {\ - do { \ - } while (!test_and_set_bit(31, (rw))); \ - if ((rw)->read_counter) { \ - clear_bit(31, (rw)); \ - while ((rw)->read_counter) \ - ; \ - } else { \ - break; \ - } \ +#define write_lock(rw) \ +while(1) { \ + do { \ + } while (!test_and_set_bit(31, (rw))); \ + if ((rw)->read_counter) { \ + clear_bit(31, (rw)); \ + while ((rw)->read_counter) \ + ; \ + } else { \ + break; \ + } \ } #define write_unlock(x) (clear_bit(31, (x))) diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h index 53dc2d2e5..a7ba6daf7 100644 --- a/include/asm-ia64/system.h +++ b/include/asm-ia64/system.h @@ -323,7 +323,7 @@ extern long __cmpxchg_called_with_bad_pointer(void); struct __xchg_dummy { unsigned long a[100]; }; #define __xg(x) (*(struct __xchg_dummy *)(x)) -#define ia64_cmpxchg(ptr,old,new,size) \ +#define ia64_cmpxchg(sem,ptr,old,new,size) \ ({ \ __typeof__(ptr) _p_ = (ptr); \ __typeof__(new) _n_ = (new); \ @@ -336,28 +336,28 @@ struct __xchg_dummy { unsigned long a[100]; }; case 8: _o_ = (__u64) (old); break; \ default: \ } \ - __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "r"(_o_)); \ + __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(_o_)); \ switch (size) { \ case 1: \ - __asm__ __volatile__ ("cmpxchg1.rel %0=%2,%3,ar.ccv" \ + __asm__ __volatile__ ("cmpxchg1."sem" %0=%2,%3,ar.ccv" \ : "=r"(_r_), "=m"(__xg(_p_)) \ : "m"(__xg(_p_)), "r"(_n_)); \ break; \ \ case 2: \ - __asm__ __volatile__ ("cmpxchg2.rel %0=%2,%3,ar.ccv" \ + __asm__ __volatile__ ("cmpxchg2."sem" %0=%2,%3,ar.ccv" \ : "=r"(_r_), "=m"(__xg(_p_)) \ : "m"(__xg(_p_)), "r"(_n_)); \ break; \ \ case 4: \ - __asm__ __volatile__ ("cmpxchg4.rel %0=%2,%3,ar.ccv" \ + __asm__ __volatile__ ("cmpxchg4."sem" %0=%2,%3,ar.ccv" \ : "=r"(_r_), "=m"(__xg(_p_)) \ : "m"(__xg(_p_)), "r"(_n_)); \ break; \ \ case 8: \ - __asm__ __volatile__ ("cmpxchg8.rel %0=%2,%3,ar.ccv" \ + __asm__ __volatile__ ("cmpxchg8."sem" %0=%2,%3,ar.ccv" \ : "=r"(_r_), "=m"(__xg(_p_)) \ : "m"(__xg(_p_)), "r"(_n_)); \ break; \ @@ -369,7 +369,11 @@ struct __xchg_dummy { unsigned long a[100]; }; (__typeof__(old)) _r_; \ }) -#define cmpxchg(ptr,o,n) ia64_cmpxchg((ptr), (o), (n), sizeof(*(ptr))) +#define cmpxchg_acq(ptr,o,n) ia64_cmpxchg("acq", (ptr), (o), (n), sizeof(*(ptr))) +#define cmpxchg_rel(ptr,o,n) ia64_cmpxchg("rel", (ptr), (o), (n), sizeof(*(ptr))) + +/* for compatibility with other platforms: */ +#define cmpxchg(ptr,o,n) cmpxchg_acq(ptr,o,n) #ifdef CONFIG_IA64_DEBUG_CMPXCHG # define CMPXCHG_BUGCHECK_DECL int _cmpxchg_bugcheck_count = 128; @@ -396,24 +400,24 @@ extern void ia64_load_debug_regs (unsigned long *save_area); #define prepare_to_switch() do { } while(0) #ifdef CONFIG_IA32_SUPPORT -# define TASK_TO_PTREGS(t) \ - ((struct pt_regs *)(((unsigned long)(t) + IA64_STK_OFFSET - IA64_PT_REGS_SIZE))) # define IS_IA32_PROCESS(regs) (ia64_psr(regs)->is != 0) -# define IA32_FP_STATE(prev,next) \ - if (IS_IA32_PROCESS(TASK_TO_PTREGS(prev))) { \ +# define IA32_STATE(prev,next) \ + if (IS_IA32_PROCESS(ia64_task_regs(prev))) { \ + __asm__ __volatile__("mov %0=ar.eflag":"=r"((prev)->thread.eflag)); \ __asm__ __volatile__("mov %0=ar.fsr":"=r"((prev)->thread.fsr)); \ __asm__ __volatile__("mov %0=ar.fcr":"=r"((prev)->thread.fcr)); \ __asm__ __volatile__("mov %0=ar.fir":"=r"((prev)->thread.fir)); \ __asm__ __volatile__("mov %0=ar.fdr":"=r"((prev)->thread.fdr)); \ } \ - if (IS_IA32_PROCESS(TASK_TO_PTREGS(next))) { \ + if (IS_IA32_PROCESS(ia64_task_regs(next))) { \ + __asm__ __volatile__("mov ar.eflag=%0"::"r"((next)->thread.eflag)); \ __asm__ __volatile__("mov ar.fsr=%0"::"r"((next)->thread.fsr)); \ __asm__ __volatile__("mov ar.fcr=%0"::"r"((next)->thread.fcr)); \ __asm__ __volatile__("mov ar.fir=%0"::"r"((next)->thread.fir)); \ __asm__ __volatile__("mov ar.fdr=%0"::"r"((next)->thread.fdr)); \ } #else /* !CONFIG_IA32_SUPPORT */ -# define IA32_FP_STATE(prev,next) +# define IA32_STATE(prev,next) # define IS_IA32_PROCESS(regs) 0 #endif /* CONFIG_IA32_SUPPORT */ @@ -436,7 +440,7 @@ extern struct task_struct *ia64_switch_to (void *next_task); if ((next)->thread.flags & IA64_THREAD_DBG_VALID) { \ ia64_load_debug_regs(&(next)->thread.dbr[0]); \ } \ - IA32_FP_STATE(prev,next); \ + IA32_STATE(prev,next); \ (last) = ia64_switch_to((next)); \ } while (0) diff --git a/include/asm-ia64/types.h b/include/asm-ia64/types.h index d4b1732e2..aee357781 100644 --- a/include/asm-ia64/types.h +++ b/include/asm-ia64/types.h @@ -13,10 +13,10 @@ */ #ifdef __ASSEMBLY__ -# define __IA64_UL(x) x +# define __IA64_UL(x) (x) # define __IA64_UL_CONST(x) x #else -# define __IA64_UL(x) ((unsigned long)x) +# define __IA64_UL(x) ((unsigned long)(x)) # define __IA64_UL_CONST(x) x##UL #endif diff --git a/include/asm-ia64/uaccess.h b/include/asm-ia64/uaccess.h index dffc5879f..e530e7f35 100644 --- a/include/asm-ia64/uaccess.h +++ b/include/asm-ia64/uaccess.h @@ -71,10 +71,6 @@ verify_area (int type, const void *addr, unsigned long size) * These are the main single-value transfer routines. They automatically * use the right size if we just have the right pointer type. * - * As the alpha uses the same address space for kernel and user - * data, we can just do these as direct assignments. (Of course, the - * exception handling means that it's no longer "just"...) - * * Careful to not * (a) re-use the arguments for side effects (sizeof/typeof is ok) * (b) require any knowledge of processes at this stage diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h index b20e42686..5be533112 100644 --- a/include/asm-ia64/unistd.h +++ b/include/asm-ia64/unistd.h @@ -197,6 +197,8 @@ #define __NR_sendmsg 1205 #define __NR_recvmsg 1206 #define __NR_sys_pivot_root 1207 +#define __NR_mincore 1208 +#define __NR_madvise 1209 #if !defined(__ASSEMBLY__) && !defined(ASSEMBLER) diff --git a/include/asm-m68k/elf.h b/include/asm-m68k/elf.h index 28dce0967..7456c3114 100644 --- a/include/asm-m68k/elf.h +++ b/include/asm-m68k/elf.h @@ -89,8 +89,7 @@ typedef struct user_m68kfp_struct elf_fpregset_t; #define ELF_PLATFORM (NULL) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex, ibcs2) \ - current->personality = (ibcs2 ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #endif diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h index eb89b6317..31f455d9d 100644 --- a/include/asm-mips/elf.h +++ b/include/asm-mips/elf.h @@ -75,8 +75,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex,ibcs2) \ - current->personality = (ibcs2 ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #endif /* __ASM_MIPS_ELF_H */ diff --git a/include/asm-mips64/elf.h b/include/asm-mips64/elf.h index 80e08fa5e..0c549baf0 100644 --- a/include/asm-mips64/elf.h +++ b/include/asm-mips64/elf.h @@ -91,9 +91,9 @@ do { if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \ else \ current->thread.mflags &= ~MF_32BIT; \ if (ibcs2) \ - current->personality = PER_SVR4; \ + set_personality(PER_SVR4); \ else if (current->personality != PER_LINUX32) \ - current->personality = PER_LINUX; \ + set_personality(PER_LINUX); \ } while (0) #endif diff --git a/include/asm-ppc/atomic.h b/include/asm-ppc/atomic.h index 01911bee9..c9103a393 100644 --- a/include/asm-ppc/atomic.h +++ b/include/asm-ppc/atomic.h @@ -5,7 +5,9 @@ #ifndef _ASM_PPC_ATOMIC_H_ #define _ASM_PPC_ATOMIC_H_ -#ifdef __SMP__ +#include <linux/config.h> + +#ifdef CONFIG_SMP typedef struct { volatile int counter; } atomic_t; #else typedef struct { int counter; } atomic_t; diff --git a/include/asm-ppc/elf.h b/include/asm-ppc/elf.h index 758e1a93c..a175e8061 100644 --- a/include/asm-ppc/elf.h +++ b/include/asm-ppc/elf.h @@ -66,8 +66,7 @@ typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG]; #define ELF_PLATFORM (NULL) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex, ibcs2) \ - current->personality = (ibcs2 ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #endif diff --git a/include/asm-ppc/hardirq.h b/include/asm-ppc/hardirq.h index c2c58315e..0c5a1090d 100644 --- a/include/asm-ppc/hardirq.h +++ b/include/asm-ppc/hardirq.h @@ -15,7 +15,7 @@ extern unsigned int local_irq_count[NR_CPUS]; #define in_irq() (local_irq_count[smp_processor_id()] != 0) -#ifndef __SMP__ +#ifndef CONFIG_SMP #define hardirq_trylock(cpu) (local_irq_count[cpu] == 0) #define hardirq_endlock(cpu) do { } while (0) @@ -25,7 +25,7 @@ extern unsigned int local_irq_count[NR_CPUS]; #define synchronize_irq() do { } while (0) -#else /* __SMP__ */ +#else /* CONFIG_SMP */ #include <asm/atomic.h> @@ -80,6 +80,6 @@ static inline int hardirq_trylock(int cpu) extern void synchronize_irq(void); -#endif /* __SMP__ */ +#endif /* CONFIG_SMP */ #endif /* __ASM_HARDIRQ_H */ diff --git a/include/asm-ppc/pgalloc.h b/include/asm-ppc/pgalloc.h index 869a0e143..6166a1bfb 100644 --- a/include/asm-ppc/pgalloc.h +++ b/include/asm-ppc/pgalloc.h @@ -1,6 +1,7 @@ #ifndef _PPC_PGALLOC_H #define _PPC_PGALLOC_H +#include <linux/config.h> #include <linux/threads.h> #include <asm/processor.h> @@ -18,7 +19,7 @@ * I need to generalize this so we can use it for other arch's as well. * -- Cort */ -#ifdef __SMP__ +#ifdef CONFIG_SMP #define quicklists cpu_data[smp_processor_id()] #else extern struct pgtable_cache_struct { @@ -54,7 +55,7 @@ extern inline void set_pgdir(unsigned long address, pgd_t entry) { struct task_struct * p; pgd_t *pgd; -#ifdef __SMP__ +#ifdef CONFIG_SMP int i; #endif @@ -65,7 +66,7 @@ extern inline void set_pgdir(unsigned long address, pgd_t entry) *pgd_offset(p->mm,address) = entry; } read_unlock(&tasklist_lock); -#ifndef __SMP__ +#ifndef CONFIG_SMP for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) pgd[address >> PGDIR_SHIFT] = entry; #else diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index 56bb212f4..9218c665b 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h @@ -230,7 +230,7 @@ extern unsigned long ioremap_bot, ioremap_base; #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) -#ifdef __SMP__ +#ifdef CONFIG_SMP #define _PAGE_BASE _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT #else #define _PAGE_BASE _PAGE_PRESENT | _PAGE_ACCESSED diff --git a/include/asm-ppc/smp.h b/include/asm-ppc/smp.h index 156d8db72..af62f7b5a 100644 --- a/include/asm-ppc/smp.h +++ b/include/asm-ppc/smp.h @@ -6,9 +6,10 @@ #ifndef _PPC_SMP_H #define _PPC_SMP_H +#include <linux/config.h> #include <linux/kernel.h> -#ifdef __SMP__ +#ifdef CONFIG_SMP #ifndef __ASSEMBLY__ @@ -50,8 +51,8 @@ extern struct klock_info_struct klock_info; #endif /* __ASSEMBLY__ */ -#else /* !(__SMP__) */ +#else /* !(CONFIG_SMP) */ -#endif /* !(__SMP__) */ +#endif /* !(CONFIG_SMP) */ #endif /* !(_PPC_SMP_H) */ diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h index cd4d055bb..162a09a1d 100644 --- a/include/asm-ppc/system.h +++ b/include/asm-ppc/system.h @@ -6,6 +6,7 @@ #ifndef __PPC_SYSTEM_H #define __PPC_SYSTEM_H +#include <linux/config.h> #include <linux/kdev_t.h> #include <asm/processor.h> @@ -86,7 +87,7 @@ extern unsigned int rtas_data; struct pt_regs; extern void dump_regs(struct pt_regs *); -#ifndef __SMP__ +#ifndef CONFIG_SMP #define cli() __cli() #define sti() __sti() @@ -94,7 +95,7 @@ extern void dump_regs(struct pt_regs *); #define restore_flags(flags) __restore_flags(flags) #define save_and_cli(flags) __save_and_cli(flags) -#else /* __SMP__ */ +#else /* CONFIG_SMP */ extern void __global_cli(void); extern void __global_sti(void); @@ -105,7 +106,7 @@ extern void __global_restore_flags(unsigned long); #define save_flags(x) ((x)=__global_save_flags()) #define restore_flags(x) __global_restore_flags(x) -#endif /* !__SMP__ */ +#endif /* !CONFIG_SMP */ #define local_irq_disable() __cli() #define local_irq_enable() __sti() diff --git a/include/asm-ppc/timex.h b/include/asm-ppc/timex.h index 4fac4ea39..df7a8749d 100644 --- a/include/asm-ppc/timex.h +++ b/include/asm-ppc/timex.h @@ -6,6 +6,8 @@ #ifndef _ASMppc_TIMEX_H #define _ASMppc_TIMEX_H +#include <linux/config.h> + #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ #define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ #define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \ @@ -26,7 +28,7 @@ extern cycles_t cacheflush_time; static inline cycles_t get_cycles(void) { -#ifdef __SMP__ +#ifdef CONFIG_SMP cycles_t ret; __asm__("mftb %0" : "=r" (ret) : ); diff --git a/include/asm-sh/atomic.h b/include/asm-sh/atomic.h index 7f580a9aa..e46fdc7bc 100644 --- a/include/asm-sh/atomic.h +++ b/include/asm-sh/atomic.h @@ -7,7 +7,9 @@ * */ -#ifdef __SMP__ +#include <linux/config.h> + +#ifdef CONFIG_SMP typedef struct { volatile int counter; } atomic_t; #else typedef struct { int counter; } atomic_t; diff --git a/include/asm-sh/current.h b/include/asm-sh/current.h index 3bd231173..355a2cd14 100644 --- a/include/asm-sh/current.h +++ b/include/asm-sh/current.h @@ -12,10 +12,9 @@ static __inline__ struct task_struct * get_current(void) { struct task_struct *current; - __asm__("stc $r4_bank, %0\n\t" - "add %1, %0" - :"=&r" (current) - :"r" (-8192)); + __asm__("stc $r7_bank, %0" + :"=r" (current)); + return current; } diff --git a/include/asm-sh/delay.h b/include/asm-sh/delay.h index 3e25684fe..f8cb1d0bc 100644 --- a/include/asm-sh/delay.h +++ b/include/asm-sh/delay.h @@ -5,6 +5,8 @@ * Copyright (C) 1999 Kaz Kojima */ +#include <linux/config.h> + extern __inline__ void __delay(unsigned long loops) { __asm__ __volatile__( @@ -28,7 +30,7 @@ extern __inline__ void __udelay(unsigned long usecs, unsigned long lps) } -#ifdef __SMP__ +#ifdef CONFIG_SMP #define __udelay_val cpu_data[smp_processor_id()].udelay_val #else #define __udelay_val loops_per_sec diff --git a/include/asm-sh/elf.h b/include/asm-sh/elf.h index 72b78b813..22a6f4c0c 100644 --- a/include/asm-sh/elf.h +++ b/include/asm-sh/elf.h @@ -66,11 +66,11 @@ typedef struct user_fpu_struct elf_fpregset_t; do { _r->regs[0]=0; _r->regs[1]=0; _r->regs[2]=0; _r->regs[3]=0; \ _r->regs[4]=0; _r->regs[5]=0; _r->regs[6]=0; _r->regs[7]=0; \ _r->regs[8]=0; _r->regs[9]=0; _r->regs[10]=0; _r->regs[11]=0; \ - _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0; } while (0) + _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0; \ + _r->sr = SR_FD; } while (0) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex, ibcs2) \ - current->personality = PER_LINUX_32BIT +#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) #endif #endif /* __ASM_SH_ELF_H */ diff --git a/include/asm-sh/hardirq.h b/include/asm-sh/hardirq.h index 40ae80f51..e57d0e31a 100644 --- a/include/asm-sh/hardirq.h +++ b/include/asm-sh/hardirq.h @@ -1,14 +1,22 @@ #ifndef __ASM_SH_HARDIRQ_H #define __ASM_SH_HARDIRQ_H +#include <linux/config.h> #include <linux/threads.h> extern unsigned int local_irq_count[NR_CPUS]; -#define in_interrupt() (local_irq_count[smp_processor_id()] != 0) +extern unsigned int local_bh_count[NR_CPUS]; + +/* + * Are we in an interrupt context? Either doing bottom half + * or hardware interrupt processing? + */ +#define in_interrupt() ({ int __cpu = smp_processor_id(); \ + (local_irq_count[__cpu] + local_bh_count[__cpu] != 0); }) #define in_irq() (local_irq_count[smp_processor_id()] != 0) -#ifndef __SMP__ +#ifndef CONFIG_SMP #define hardirq_trylock(cpu) (local_irq_count[cpu] == 0) #define hardirq_endlock(cpu) do { } while (0) @@ -22,5 +30,5 @@ extern unsigned int local_irq_count[NR_CPUS]; #error Super-H SMP is not available -#endif /* __SMP__ */ +#endif /* CONFIG_SMP */ #endif /* __ASM_SH_HARDIRQ_H */ diff --git a/include/asm-sh/ptrace.h b/include/asm-sh/ptrace.h index 369fc23bb..a61cd3aba 100644 --- a/include/asm-sh/ptrace.h +++ b/include/asm-sh/ptrace.h @@ -7,19 +7,23 @@ */ /* - * As GCC does: - * 0 - 15 are integer registers - * 17 - 22 are control/special registers - * 24 - 39 fp registers - * 40 - 47 xd registers - * 48 - fpscr register + * GCC defines register number like this: * ----------------------------- - * Not as GCC: - * 16 --- program counter PC - * 23 --- syscall # + * 0 - 15 are integer registers + * 17 - 22 are control/special registers + * 24 - 39 fp registers + * 40 - 47 xd registers + * 48 - fpscr register + * ----------------------------- + * + * We follows above, except: + * 16 --- program counter (PC) + * 22 --- syscall # + * 23 --- floating point communication register */ #define REG_REG0 0 #define REG_REG15 15 + #define REG_PC 16 #define REG_PR 17 @@ -27,9 +31,10 @@ #define REG_GBR 19 #define REG_MACH 20 #define REG_MACL 21 -#define REG_FPUL 22 -#define REG_SYSCALL 23 +#define REG_SYSCALL 22 + +#define REG_FPUL 23 #define REG_FPREG0 24 #define REG_FPREG15 39 @@ -42,14 +47,14 @@ * kernel stack during a system call or other kernel entry. */ struct pt_regs { - long syscall_nr; - unsigned long sr; unsigned long regs[16]; + unsigned long pc; + unsigned long pr; + unsigned long sr; unsigned long gbr; unsigned long mach; unsigned long macl; - unsigned long pr; - unsigned long pc; + long syscall_nr; }; #ifdef __KERNEL__ @@ -60,18 +65,17 @@ extern void show_regs(struct pt_regs *); /* User Break Controller */ #if defined(__sh3__) -/* The value is for sh4, please fix... */ -#define UBC_BARA 0xff200000 -#define UBC_BAMRA 0xff200004 -#define UBC_BBRA 0xff200008 -#define UBC_BASRA 0xff000014 -#define UBC_BARB 0xff20000c -#define UBC_BAMRB 0xff200010 -#define UBC_BBRB 0xff200014 -#define UBC_BASRB 0xff000018 -#define UBC_BDRB 0xff200018 -#define UBC_BDMRB 0xff20001c -#define UBC_BRCR 0xff200020 +#define UBC_BARA 0xffffffb0 +#define UBC_BAMRA 0xffffffb4 +#define UBC_BBRA 0xffffffb8 +#define UBC_BASRA 0xffffffe4 +#define UBC_BARB 0xffffffa0 +#define UBC_BAMRB 0xffffffa4 +#define UBC_BBRB 0xffffffa8 +#define UBC_BASRB 0xffffffe8 +#define UBC_BDRB 0xffffff90 +#define UBC_BDMRB 0xffffff94 +#define UBC_BRCR 0xffffff98 #elif defined(__SH4__) #define UBC_BARA 0xff200000 #define UBC_BAMRA 0xff200004 diff --git a/include/asm-sh/sigcontext.h b/include/asm-sh/sigcontext.h index 6f61ed38c..1378ba93c 100644 --- a/include/asm-sh/sigcontext.h +++ b/include/asm-sh/sigcontext.h @@ -6,12 +6,12 @@ struct sigcontext { /* CPU registers */ unsigned long sc_regs[16]; + unsigned long sc_pc; + unsigned long sc_pr; + unsigned long sc_sr; unsigned long sc_gbr; unsigned long sc_mach; unsigned long sc_macl; - unsigned long sc_pr; - unsigned long sc_sr; - unsigned long sc_pc; #if defined(__SH4__) /* FPU registers */ diff --git a/include/asm-sh/smplock.h b/include/asm-sh/smplock.h index 29495778e..6f71b8bba 100644 --- a/include/asm-sh/smplock.h +++ b/include/asm-sh/smplock.h @@ -7,7 +7,9 @@ * for more details. */ -#ifndef __SMP__ +#include <linux/config.h> + +#ifndef CONFIG_SMP #define lock_kernel() do { } while(0) #define unlock_kernel() do { } while(0) @@ -65,6 +67,6 @@ do { \ spin_lock(&kernel_flag); \ } while (0) -#endif /* __SMP__ */ +#endif /* CONFIG_SMP */ #endif /* __ASM_SH_SMPLOCK_H */ diff --git a/include/asm-sh/softirq.h b/include/asm-sh/softirq.h index fdc6afc61..9f0a9ff96 100644 --- a/include/asm-sh/softirq.h +++ b/include/asm-sh/softirq.h @@ -4,8 +4,6 @@ #include <asm/atomic.h> #include <asm/hardirq.h> -extern unsigned int local_bh_count[NR_CPUS]; - #define cpu_bh_disable(cpu) do { local_bh_count[(cpu)]++; barrier(); } while (0) #define cpu_bh_enable(cpu) do { barrier(); local_bh_count[(cpu)]--; } while (0) diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h index 130800b47..ab5383e0a 100644 --- a/include/asm-sh/system.h +++ b/include/asm-sh/system.h @@ -5,6 +5,8 @@ * Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima */ +#include <linux/config.h> + /* * switch_to() should switch tasks to task nr n, first */ @@ -13,7 +15,7 @@ typedef struct { unsigned long seg; } mm_segment_t; -#ifdef __SMP__ +#ifdef CONFIG_SMP #error no SMP SuperH #else #define prepare_to_switch() do { } while(0) @@ -97,11 +99,11 @@ extern __inline__ void __sti(void) __asm__ __volatile__("stc $sr, %0\n\t" "and %1, %0\n\t" - "stc $r5_bank, %1\n\t" + "stc $r6_bank, %1\n\t" "or %1, %0\n\t" "ldc %0, $sr" : "=&r" (__dummy0), "=r" (__dummy1) - : "1" (~0xf0) + : "1" (~0x000000f0) : "memory"); } @@ -137,17 +139,8 @@ x = (__extension__ ({ unsigned long __dummy,__sr; \ : "memory"); (__sr & 0x000000f0); })) #define __restore_flags(x) do { \ - unsigned long __dummy0, __dummy1; \ - if (x != 0xf0) /* not CLI-ed? */ \ - __asm__ __volatile__( \ - "stc $sr, %0\n\t" \ - "and %1, %0\n\t" \ - "stc $r5_bank, %1\n\t" \ - "or %1, %0\n\t" \ - "ldc %0, $sr" \ - : "=&r" (__dummy0), "=r" (__dummy1) \ - : "1" (0xffffff0f) \ - : "memory"); \ + if (x != 0x000000f0) /* not CLI-ed? */ \ + __sti(); \ } while (0) /* @@ -192,7 +185,7 @@ do { \ #define local_irq_disable() __cli() #define local_irq_enable() __sti() -#ifdef __SMP__ +#ifdef CONFIG_SMP extern void __global_cli(void); extern void __global_sti(void); diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h index baaff1798..f927716b2 100644 --- a/include/asm-sh/unistd.h +++ b/include/asm-sh/unistd.h @@ -248,8 +248,8 @@ do { \ #define _syscall0(type,name) \ type name(void) \ { \ -register long __sc0 __asm__ ("$r0") = __NR_##name; \ -__asm__ __volatile__ ("trapa #0" \ +register long __sc0 __asm__ ("$r3") = __NR_##name; \ +__asm__ __volatile__ ("trapa #0x10" \ : "=z" (__sc0) \ : "0" (__sc0) \ : "memory" ); \ @@ -259,9 +259,9 @@ __syscall_return(type,__sc0); \ #define _syscall1(type,name,type1,arg1) \ type name(type1 arg1) \ { \ -register long __sc0 __asm__ ("$r0") = __NR_##name; \ +register long __sc0 __asm__ ("$r3") = __NR_##name; \ register long __sc4 __asm__ ("$r4") = (long) arg1; \ -__asm__ __volatile__ ("trapa #0" \ +__asm__ __volatile__ ("trapa #0x11" \ : "=z" (__sc0) \ : "0" (__sc0), "r" (__sc4) \ : "memory"); \ @@ -271,10 +271,10 @@ __syscall_return(type,__sc0); \ #define _syscall2(type,name,type1,arg1,type2,arg2) \ type name(type1 arg1,type2 arg2) \ { \ -register long __sc0 __asm__ ("$r0") = __NR_##name; \ +register long __sc0 __asm__ ("$r3") = __NR_##name; \ register long __sc4 __asm__ ("$r4") = (long) arg1; \ register long __sc5 __asm__ ("$r5") = (long) arg2; \ -__asm__ __volatile__ ("trapa #0" \ +__asm__ __volatile__ ("trapa #0x12" \ : "=z" (__sc0) \ : "0" (__sc0), "r" (__sc4), "r" (__sc5) \ : "memory"); \ @@ -284,11 +284,11 @@ __syscall_return(type,__sc0); \ #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ type name(type1 arg1,type2 arg2,type3 arg3) \ { \ -register long __sc0 __asm__ ("$r0") = __NR_##name; \ +register long __sc0 __asm__ ("$r3") = __NR_##name; \ register long __sc4 __asm__ ("$r4") = (long) arg1; \ register long __sc5 __asm__ ("$r5") = (long) arg2; \ register long __sc6 __asm__ ("$r6") = (long) arg3; \ -__asm__ __volatile__ ("trapa #0" \ +__asm__ __volatile__ ("trapa #0x13" \ : "=z" (__sc0) \ : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6) \ : "memory"); \ @@ -298,12 +298,12 @@ __syscall_return(type,__sc0); \ #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ { \ -register long __sc0 __asm__ ("$r0") = __NR_##name; \ +register long __sc0 __asm__ ("$r3") = __NR_##name; \ register long __sc4 __asm__ ("$r4") = (long) arg1; \ register long __sc5 __asm__ ("$r5") = (long) arg2; \ register long __sc6 __asm__ ("$r6") = (long) arg3; \ register long __sc7 __asm__ ("$r7") = (long) arg4; \ -__asm__ __volatile__ ("trapa #0" \ +__asm__ __volatile__ ("trapa #0x14" \ : "=z" (__sc0) \ : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), \ "r" (__sc7) \ @@ -314,16 +314,16 @@ __syscall_return(type,__sc0); \ #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ { \ -register long __sc0 __asm__ ("$r0") = __NR_##name; \ +register long __sc0 __asm__ ("$r3") = __NR_##name; \ register long __sc4 __asm__ ("$r4") = (long) arg1; \ register long __sc5 __asm__ ("$r5") = (long) arg2; \ register long __sc6 __asm__ ("$r6") = (long) arg3; \ register long __sc7 __asm__ ("$r7") = (long) arg4; \ -__asm__ __volatile__ ("mov.l %2, @-$r15\n\t" \ - "trapa #0" \ +register long __sc2 __asm__ ("$r0") = (long) arg5; \ +__asm__ __volatile__ ("trapa #0x15" \ : "=z" (__sc0) \ - : "0" (__sc0), "r" (arg5), \ - "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7) \ + : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \ + "r" (__sc7), "r" (__sc2) \ : "memory" ); \ __syscall_return(type,__sc0); \ } diff --git a/include/asm-sparc/asm_offsets.h b/include/asm-sparc/asm_offsets.h index 57c2ffd9b..66ebe6e4c 100644 --- a/include/asm-sparc/asm_offsets.h +++ b/include/asm-sparc/asm_offsets.h @@ -228,21 +228,25 @@ #define ASIZ_mm_env_start 0x00000004 #define AOFF_mm_env_end 0x0000006c #define ASIZ_mm_env_end 0x00000004 -#define AOFF_mm_rss 0x00000070 +#define AOFF_mm_min_flt 0x00000070 +#define ASIZ_mm_min_flt 0x00000004 +#define AOFF_mm_maj_flt 0x00000074 +#define ASIZ_mm_maj_flt 0x00000004 +#define AOFF_mm_rss 0x00000078 #define ASIZ_mm_rss 0x00000004 -#define AOFF_mm_total_vm 0x00000074 +#define AOFF_mm_total_vm 0x0000007c #define ASIZ_mm_total_vm 0x00000004 -#define AOFF_mm_locked_vm 0x00000078 +#define AOFF_mm_locked_vm 0x00000080 #define ASIZ_mm_locked_vm 0x00000004 -#define AOFF_mm_def_flags 0x0000007c +#define AOFF_mm_def_flags 0x00000084 #define ASIZ_mm_def_flags 0x00000004 -#define AOFF_mm_cpu_vm_mask 0x00000080 +#define AOFF_mm_cpu_vm_mask 0x00000088 #define ASIZ_mm_cpu_vm_mask 0x00000004 -#define AOFF_mm_swap_cnt 0x00000084 +#define AOFF_mm_swap_cnt 0x0000008c #define ASIZ_mm_swap_cnt 0x00000004 -#define AOFF_mm_swap_address 0x00000088 +#define AOFF_mm_swap_address 0x00000090 #define ASIZ_mm_swap_address 0x00000004 -#define AOFF_mm_segments 0x0000008c +#define AOFF_mm_segments 0x00000094 #define ASIZ_mm_segments 0x00000004 #define AOFF_thread_uwinmask 0x00000000 #define ASIZ_thread_uwinmask 0x00000004 @@ -509,21 +513,25 @@ #define ASIZ_mm_env_start 0x00000004 #define AOFF_mm_env_end 0x00000074 #define ASIZ_mm_env_end 0x00000004 -#define AOFF_mm_rss 0x00000078 +#define AOFF_mm_min_flt 0x00000078 +#define ASIZ_mm_min_flt 0x00000004 +#define AOFF_mm_maj_flt 0x0000007c +#define ASIZ_mm_maj_flt 0x00000004 +#define AOFF_mm_rss 0x00000080 #define ASIZ_mm_rss 0x00000004 -#define AOFF_mm_total_vm 0x0000007c +#define AOFF_mm_total_vm 0x00000084 #define ASIZ_mm_total_vm 0x00000004 -#define AOFF_mm_locked_vm 0x00000080 +#define AOFF_mm_locked_vm 0x00000088 #define ASIZ_mm_locked_vm 0x00000004 -#define AOFF_mm_def_flags 0x00000084 +#define AOFF_mm_def_flags 0x0000008c #define ASIZ_mm_def_flags 0x00000004 -#define AOFF_mm_cpu_vm_mask 0x00000088 +#define AOFF_mm_cpu_vm_mask 0x00000090 #define ASIZ_mm_cpu_vm_mask 0x00000004 -#define AOFF_mm_swap_cnt 0x0000008c +#define AOFF_mm_swap_cnt 0x00000094 #define ASIZ_mm_swap_cnt 0x00000004 -#define AOFF_mm_swap_address 0x00000090 +#define AOFF_mm_swap_address 0x00000098 #define ASIZ_mm_swap_address 0x00000004 -#define AOFF_mm_segments 0x00000094 +#define AOFF_mm_segments 0x0000009c #define ASIZ_mm_segments 0x00000004 #define AOFF_thread_uwinmask 0x00000000 #define ASIZ_thread_uwinmask 0x00000004 diff --git a/include/asm-sparc/elf.h b/include/asm-sparc/elf.h index acc8f418e..c2f54c150 100644 --- a/include/asm-sparc/elf.h +++ b/include/asm-sparc/elf.h @@ -1,4 +1,4 @@ -/* $Id: elf.h,v 1.20 1998/09/14 09:11:10 davem Exp $ */ +/* $Id: elf.h,v 1.21 2000/04/14 09:59:04 davem Exp $ */ #ifndef __ASMSPARC_ELF_H #define __ASMSPARC_ELF_H @@ -105,8 +105,7 @@ typedef struct { #define ELF_PLATFORM (NULL) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex, ibcs2) \ - current->personality = (ibcs2 ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #endif /* !(__ASMSPARC_ELF_H) */ diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h index cafd68674..a32ce08fe 100644 --- a/include/asm-sparc/io.h +++ b/include/asm-sparc/io.h @@ -1,5 +1,5 @@ /* - * $Id: io.h,v 1.26 2000/03/30 01:43:26 davem Exp $ + * $Id: io.h,v 1.27 2000/04/13 04:45:59 davem Exp $ */ #ifndef __SPARC_IO_H #define __SPARC_IO_H @@ -169,6 +169,7 @@ static inline void *sbus_memset_io(void *__dst, int c, __kernel_size_t n) * This is why we have no bus number argument to ioremap(). */ extern void *ioremap(unsigned long offset, unsigned long size); +#define ioremap_nocache(X,Y) ioremap((X),(Y)) extern void iounmap(void *addr); /* P3: talk davem into dropping "name" argument in favor of res->name */ diff --git a/include/asm-sparc/jsflash.h b/include/asm-sparc/jsflash.h index 2842049b2..3457f29bd 100644 --- a/include/asm-sparc/jsflash.h +++ b/include/asm-sparc/jsflash.h @@ -36,4 +36,4 @@ struct jsflash_program_arg { __u32 size; }; -#endif /* _SPARC_IDE_H */ +#endif /* _SPARC_JSFLASH_H */ diff --git a/include/asm-sparc/namei.h b/include/asm-sparc/namei.h index 18430c8d1..3ac97a41b 100644 --- a/include/asm-sparc/namei.h +++ b/include/asm-sparc/namei.h @@ -1,4 +1,4 @@ -/* $Id: namei.h,v 1.14 1999/06/10 05:23:12 davem Exp $ +/* $Id: namei.h,v 1.16 2000/04/13 00:55:54 davem Exp $ * linux/include/asm-sparc/namei.h * * Routines to handle famous /usr/gnemul/s*. @@ -14,7 +14,7 @@ static inline char * __emul_prefix(void) { switch (current->personality) { - case PER_BSD: + case PER_SUNOS: return SPARC_BSD_EMUL; case PER_SVR4: return SPARC_SOL_EMUL; diff --git a/include/asm-sparc64/asm_offsets.h b/include/asm-sparc64/asm_offsets.h index 8a5eb1246..f04220ee6 100644 --- a/include/asm-sparc64/asm_offsets.h +++ b/include/asm-sparc64/asm_offsets.h @@ -235,23 +235,27 @@ #define ASIZ_mm_env_start 0x00000008 #define AOFF_mm_env_end 0x000000c8 #define ASIZ_mm_env_end 0x00000008 -#define AOFF_mm_rss 0x000000d0 +#define AOFF_mm_min_flt 0x000000d0 +#define ASIZ_mm_min_flt 0x00000008 +#define AOFF_mm_maj_flt 0x000000d8 +#define ASIZ_mm_maj_flt 0x00000008 +#define AOFF_mm_rss 0x000000e0 #define ASIZ_mm_rss 0x00000008 -#define AOFF_mm_total_vm 0x000000d8 +#define AOFF_mm_total_vm 0x000000e8 #define ASIZ_mm_total_vm 0x00000008 -#define AOFF_mm_locked_vm 0x000000e0 +#define AOFF_mm_locked_vm 0x000000f0 #define ASIZ_mm_locked_vm 0x00000008 -#define AOFF_mm_def_flags 0x000000e8 +#define AOFF_mm_def_flags 0x000000f8 #define ASIZ_mm_def_flags 0x00000008 -#define AOFF_mm_cpu_vm_mask 0x000000f0 +#define AOFF_mm_cpu_vm_mask 0x00000100 #define ASIZ_mm_cpu_vm_mask 0x00000008 -#define AOFF_mm_swap_cnt 0x000000f8 +#define AOFF_mm_swap_cnt 0x00000108 #define ASIZ_mm_swap_cnt 0x00000008 -#define AOFF_mm_swap_address 0x00000100 +#define AOFF_mm_swap_address 0x00000110 #define ASIZ_mm_swap_address 0x00000008 -#define AOFF_mm_segments 0x00000108 +#define AOFF_mm_segments 0x00000118 #define ASIZ_mm_segments 0x00000008 -#define ASIZ_mm 0x00000110 +#define ASIZ_mm 0x00000120 #define AOFF_thread_ksp 0x00000000 #define ASIZ_thread_ksp 0x00000008 #define AOFF_thread_wstate 0x00000008 @@ -529,23 +533,27 @@ #define ASIZ_mm_env_start 0x00000008 #define AOFF_mm_env_end 0x000000c8 #define ASIZ_mm_env_end 0x00000008 -#define AOFF_mm_rss 0x000000d0 +#define AOFF_mm_min_flt 0x000000d0 +#define ASIZ_mm_min_flt 0x00000008 +#define AOFF_mm_maj_flt 0x000000d8 +#define ASIZ_mm_maj_flt 0x00000008 +#define AOFF_mm_rss 0x000000e0 #define ASIZ_mm_rss 0x00000008 -#define AOFF_mm_total_vm 0x000000d8 +#define AOFF_mm_total_vm 0x000000e8 #define ASIZ_mm_total_vm 0x00000008 -#define AOFF_mm_locked_vm 0x000000e0 +#define AOFF_mm_locked_vm 0x000000f0 #define ASIZ_mm_locked_vm 0x00000008 -#define AOFF_mm_def_flags 0x000000e8 +#define AOFF_mm_def_flags 0x000000f8 #define ASIZ_mm_def_flags 0x00000008 -#define AOFF_mm_cpu_vm_mask 0x000000f0 +#define AOFF_mm_cpu_vm_mask 0x00000100 #define ASIZ_mm_cpu_vm_mask 0x00000008 -#define AOFF_mm_swap_cnt 0x000000f8 +#define AOFF_mm_swap_cnt 0x00000108 #define ASIZ_mm_swap_cnt 0x00000008 -#define AOFF_mm_swap_address 0x00000100 +#define AOFF_mm_swap_address 0x00000110 #define ASIZ_mm_swap_address 0x00000008 -#define AOFF_mm_segments 0x00000108 +#define AOFF_mm_segments 0x00000118 #define ASIZ_mm_segments 0x00000008 -#define ASIZ_mm 0x00000110 +#define ASIZ_mm 0x00000120 #define AOFF_thread_ksp 0x00000000 #define ASIZ_thread_ksp 0x00000008 #define AOFF_thread_wstate 0x00000008 @@ -821,23 +829,27 @@ #define ASIZ_mm_env_start 0x00000008 #define AOFF_mm_env_end 0x000000d8 #define ASIZ_mm_env_end 0x00000008 -#define AOFF_mm_rss 0x000000e0 +#define AOFF_mm_min_flt 0x000000e0 +#define ASIZ_mm_min_flt 0x00000008 +#define AOFF_mm_maj_flt 0x000000e8 +#define ASIZ_mm_maj_flt 0x00000008 +#define AOFF_mm_rss 0x000000f0 #define ASIZ_mm_rss 0x00000008 -#define AOFF_mm_total_vm 0x000000e8 +#define AOFF_mm_total_vm 0x000000f8 #define ASIZ_mm_total_vm 0x00000008 -#define AOFF_mm_locked_vm 0x000000f0 +#define AOFF_mm_locked_vm 0x00000100 #define ASIZ_mm_locked_vm 0x00000008 -#define AOFF_mm_def_flags 0x000000f8 +#define AOFF_mm_def_flags 0x00000108 #define ASIZ_mm_def_flags 0x00000008 -#define AOFF_mm_cpu_vm_mask 0x00000100 +#define AOFF_mm_cpu_vm_mask 0x00000110 #define ASIZ_mm_cpu_vm_mask 0x00000008 -#define AOFF_mm_swap_cnt 0x00000108 +#define AOFF_mm_swap_cnt 0x00000118 #define ASIZ_mm_swap_cnt 0x00000008 -#define AOFF_mm_swap_address 0x00000110 +#define AOFF_mm_swap_address 0x00000120 #define ASIZ_mm_swap_address 0x00000008 -#define AOFF_mm_segments 0x00000118 +#define AOFF_mm_segments 0x00000128 #define ASIZ_mm_segments 0x00000008 -#define ASIZ_mm 0x00000120 +#define ASIZ_mm 0x00000130 #define AOFF_thread_ksp 0x00000000 #define ASIZ_thread_ksp 0x00000008 #define AOFF_thread_wstate 0x00000008 diff --git a/include/asm-sparc64/delay.h b/include/asm-sparc64/delay.h index 1df90bce6..6d93fde96 100644 --- a/include/asm-sparc64/delay.h +++ b/include/asm-sparc64/delay.h @@ -1,4 +1,4 @@ -/* $Id: delay.h,v 1.7 1997/11/07 18:24:31 mj Exp $ +/* $Id: delay.h,v 1.8 2000/04/13 04:45:59 davem Exp $ * delay.h: Linux delay routines on the V9. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu). @@ -8,6 +8,7 @@ #define __SPARC64_DELAY_H #ifdef __SMP__ +#include <linux/sched.h> #include <asm/smp.h> #endif diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h index e99eea697..ec946e414 100644 --- a/include/asm-sparc64/elf.h +++ b/include/asm-sparc64/elf.h @@ -1,4 +1,4 @@ -/* $Id: elf.h,v 1.23 1999/12/15 14:19:06 davem Exp $ */ +/* $Id: elf.h,v 1.24 2000/04/14 09:59:04 davem Exp $ */ #ifndef __ASM_SPARC64_ELF_H #define __ASM_SPARC64_ELF_H @@ -96,9 +96,9 @@ do { unsigned char flags = current->thread.flags; \ } \ \ if (ibcs2) \ - current->personality = PER_SVR4; \ + set_personality(PER_SVR4); \ else if (current->personality != PER_LINUX32) \ - current->personality = PER_LINUX; \ + set_personality(PER_LINUX); \ } while (0) #endif diff --git a/include/asm-sparc64/hardirq.h b/include/asm-sparc64/hardirq.h index 58597a028..fac8894e1 100644 --- a/include/asm-sparc64/hardirq.h +++ b/include/asm-sparc64/hardirq.h @@ -7,11 +7,17 @@ #define __SPARC64_HARDIRQ_H #include <linux/threads.h> +#include <linux/brlock.h> +#include <linux/spinlock.h> #ifndef __SMP__ extern unsigned int local_irq_count; +#define irq_enter(cpu, irq) (local_irq_count++) +#define irq_exit(cpu, irq) (local_irq_count--) #else -#define local_irq_count (cpu_data[smp_processor_id()].irq_count) +#define local_irq_count (__brlock_array[smp_processor_id()][BR_GLOBALIRQ_LOCK]) +#define irq_enter(cpu, irq) br_read_lock(BR_GLOBALIRQ_LOCK) +#define irq_exit(cpu, irq) br_read_unlock(BR_GLOBALIRQ_LOCK) #endif /* @@ -35,42 +41,33 @@ extern unsigned int local_irq_count; #else /* (__SMP__) */ -#include <asm/atomic.h> -#include <linux/spinlock.h> -#include <asm/system.h> -#include <asm/smp.h> +static __inline__ int irqs_running(void) +{ + enum brlock_indices idx = BR_GLOBALIRQ_LOCK; + int i, count = 0; + + for (i = 0; i < smp_num_cpus; i++) + count += (__brlock_array[cpu_logical_map(i)][idx] != 0); + + return count; +} extern unsigned char global_irq_holder; -extern spinlock_t global_irq_lock; -extern atomic_t global_irq_count; static inline void release_irqlock(int cpu) { /* if we didn't own the irq lock, just ignore... */ if(global_irq_holder == (unsigned char) cpu) { global_irq_holder = NO_PROC_ID; - spin_unlock(&global_irq_lock); + br_write_unlock(BR_GLOBALIRQ_LOCK); } } -static inline void hardirq_enter(int cpu) -{ - ++(cpu_data[cpu].irq_count); - atomic_inc(&global_irq_count); - membar("#StoreLoad | #StoreStore"); -} - -static inline void hardirq_exit(int cpu) -{ - membar("#StoreStore | #LoadStore"); - atomic_dec(&global_irq_count); - --(cpu_data[cpu].irq_count); -} - static inline int hardirq_trylock(int cpu) { - return (! atomic_read(&global_irq_count) && - ! spin_is_locked (&global_irq_lock)); + spinlock_t *lock = &__br_write_locks[BR_GLOBALIRQ_LOCK].lock; + + return (!irqs_running() && !spin_is_locked(lock)); } #define hardirq_endlock(cpu) do { (void)(cpu); } while (0) diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h index 2ca3b4693..d829b7c53 100644 --- a/include/asm-sparc64/io.h +++ b/include/asm-sparc64/io.h @@ -1,4 +1,4 @@ -/* $Id: io.h,v 1.34 2000/03/30 01:40:54 davem Exp $ */ +/* $Id: io.h,v 1.35 2000/04/13 04:45:59 davem Exp $ */ #ifndef __SPARC64_IO_H #define __SPARC64_IO_H @@ -367,6 +367,7 @@ out: * using physically addressed loads and stores, so this does nothing. */ #define ioremap(__offset, __size) ((void *)(__offset)) +#define ioremap_nocache(X,Y) ioremap((X),(Y)) #define iounmap(__addr) do { } while(0) /* Similarly for SBUS. */ diff --git a/include/asm-sparc64/namei.h b/include/asm-sparc64/namei.h index 7f6dd9495..25429ad72 100644 --- a/include/asm-sparc64/namei.h +++ b/include/asm-sparc64/namei.h @@ -1,4 +1,4 @@ -/* $Id: namei.h,v 1.15 1999/06/10 05:23:17 davem Exp $ +/* $Id: namei.h,v 1.17 2000/04/13 00:55:54 davem Exp $ * linux/include/asm-sparc64/namei.h * * Routines to handle famous /usr/gnemul/s*. @@ -14,7 +14,7 @@ static inline char * __emul_prefix(void) { switch (current->personality) { - case PER_BSD: + case PER_SUNOS: return SPARC_BSD_EMUL; case PER_SVR4: return SPARC_SOL_EMUL; diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h index 7211c7d81..79f4d7448 100644 --- a/include/asm-sparc64/page.h +++ b/include/asm-sparc64/page.h @@ -1,4 +1,4 @@ -/* $Id: page.h,v 1.33 2000/03/22 02:48:04 davem Exp $ */ +/* $Id: page.h,v 1.35 2000/04/13 04:45:59 davem Exp $ */ #ifndef _SPARC64_PAGE_H #define _SPARC64_PAGE_H @@ -21,8 +21,10 @@ #define BUG() __builtin_trap() #define PAGE_BUG(page) BUG() -extern void clear_page(void *page); -extern void copy_page(void *to, void *from); +extern void _clear_page(void *page); +extern void _copy_page(void *to, void *from); +#define clear_page(X) _clear_page((void *)(X)) +#define copy_page(X,Y) _copy_page((void *)(X), (void *)(Y)) extern void clear_user_page(void *page, unsigned long vaddr); extern void copy_user_page(void *to, void *from, unsigned long vaddr); @@ -103,7 +105,7 @@ register unsigned long PAGE_OFFSET asm("g4"); #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) -#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT) +#define MAP_NR(addr) ((__pa(addr)-phys_base) >> PAGE_SHIFT) #define virt_to_phys __pa #define phys_to_virt __va @@ -119,8 +121,8 @@ register unsigned long PAGE_OFFSET asm("g4"); */ struct sparc_phys_banks { - unsigned long base_addr; - unsigned long num_bytes; + unsigned long base_addr; + unsigned long num_bytes; }; #define SPARC_PHYS_BANKS 32 diff --git a/include/asm-sparc64/pgalloc.h b/include/asm-sparc64/pgalloc.h index 697dc6fbc..9a0d67494 100644 --- a/include/asm-sparc64/pgalloc.h +++ b/include/asm-sparc64/pgalloc.h @@ -153,11 +153,11 @@ extern __inline__ pgd_t *get_pgd_fast(void) ret = (struct page *)(__page_address(ret) + off); pgd_cache_size--; } else { - ret = (struct page *) __get_free_page(GFP_KERNEL); - if(ret) { - struct page *page = mem_map + MAP_NR(ret); - - memset(ret, 0, PAGE_SIZE); + struct page *page = alloc_page(GFP_KERNEL); + + if (page) { + ret = (struct page *)page_address(page); + clear_page(ret); (unsigned long)page->pprev_hash = 2; (unsigned long *)page->next_hash = pgd_quicklist; pgd_quicklist = (unsigned long *)page; diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index 0d49e700e..f368d64b3 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.124 2000/03/27 10:38:56 davem Exp $ +/* $Id: pgtable.h,v 1.125 2000/04/12 08:10:26 davem Exp $ * pgtable.h: SpitFire page table operations. * * Copyright 1996,1997 David S. Miller (davem@caip.rutgers.edu) @@ -152,16 +152,13 @@ extern pte_t __bad_page(void); #define BAD_PAGE __bad_page() -/* First physical page can be anywhere, the following is needed so that - * va-->pa and vice versa conversions work properly without performance - * hit for all __pa()/__va() operations. - */ extern unsigned long phys_base; -#define ZERO_PAGE(vaddr) (mem_map + (phys_base>>PAGE_SHIFT)) + +#define ZERO_PAGE(vaddr) (mem_map) /* Warning: These take pointers to page structs now... */ #define mk_pte(page, pgprot) \ - __pte(((page - mem_map) << PAGE_SHIFT) | pgprot_val(pgprot)) + __pte((((page - mem_map) << PAGE_SHIFT)+phys_base) | pgprot_val(pgprot)) #define page_pte_prot(page, prot) mk_pte(page, prot) #define page_pte(page) page_pte_prot(page, __pgprot(0)) @@ -180,7 +177,7 @@ extern inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot) (pmd_val(*(pmdp)) = (__pa((unsigned long) (ptep)) >> 11UL)) #define pgd_set(pgdp, pmdp) \ (pgd_val(*(pgdp)) = (__pa((unsigned long) (pmdp)) >> 11UL)) -#define pte_pagenr(pte) ((unsigned long) ((pte_val(pte)&~PAGE_OFFSET)>>PAGE_SHIFT)) +#define pte_pagenr(pte) (((unsigned long) ((pte_val(pte)&~PAGE_OFFSET)-phys_base)>>PAGE_SHIFT)) #define pmd_page(pmd) ((unsigned long) __va((pmd_val(pmd)<<11UL))) #define pgd_page(pgd) ((unsigned long) __va((pgd_val(pgd)<<11UL))) #define pte_none(pte) (!pte_val(pte)) diff --git a/include/asm-sparc64/sab82532.h b/include/asm-sparc64/sab82532.h index 8cb99a22f..0467f944d 100644 --- a/include/asm-sparc64/sab82532.h +++ b/include/asm-sparc64/sab82532.h @@ -1,4 +1,4 @@ -/* $Id: sab82532.h,v 1.5 1999/05/12 11:21:22 davem Exp $ +/* $Id: sab82532.h,v 1.6 2000/04/13 07:22:35 ecd Exp $ * sab82532.h: Register Definitions for the Siemens SAB82532 DUSCC * * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) @@ -144,6 +144,8 @@ struct sab82532 { int recv_fifo_size; int custom_divisor; int baud; + unsigned int cec_timeout; + unsigned int tec_timeout; int x_char; int close_delay; unsigned short closing_wait; diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h index 116fe903e..7bb2b3250 100644 --- a/include/asm-sparc64/smp.h +++ b/include/asm-sparc64/smp.h @@ -33,12 +33,11 @@ extern struct prom_cpuinfo linux_cpus[64]; /* Keep this a multiple of 64-bytes for cache reasons. */ struct cpuinfo_sparc { /* Dcache line 1 */ - unsigned int irq_count; unsigned int bh_count; unsigned int multiplier; unsigned int counter; unsigned int idle_volume; - unsigned int __pad; + unsigned int __pad[2]; unsigned long udelay_val; /* Dcache line 2 */ diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h index cb03301a4..e69f74eac 100644 --- a/include/asm-sparc64/ttable.h +++ b/include/asm-sparc64/ttable.h @@ -1,4 +1,4 @@ -/* $Id: ttable.h,v 1.14 1999/10/13 11:48:58 jj Exp $ */ +/* $Id: ttable.h,v 1.15 2000/04/03 10:36:42 davem Exp $ */ #ifndef _SPARC64_TTABLE_H #define _SPARC64_TTABLE_H @@ -85,7 +85,7 @@ sethi %hi(109f), %g7; \ ba,pt %xcc, scetrap; \ 109: or %g7, %lo(109b), %g7; \ - call routine; \ + ba,pt %xcc, routine; \ sethi %hi(systbl), %l7; \ nop; nop; nop; diff --git a/include/asm-sparc64/vga.h b/include/asm-sparc64/vga.h index b637522eb..b54712119 100644 --- a/include/asm-sparc64/vga.h +++ b/include/asm-sparc64/vga.h @@ -7,6 +7,8 @@ #ifndef _LINUX_ASM_VGA_H_ #define _LINUX_ASM_VGA_H_ +#include <asm/types.h> + #define VT_BUF_HAVE_RW static inline void scr_writew(u16 val, u16 *addr) diff --git a/include/linux/ac97_codec.h b/include/linux/ac97_codec.h index da8730aef..81f463cd5 100644 --- a/include/linux/ac97_codec.h +++ b/include/linux/ac97_codec.h @@ -32,7 +32,7 @@ #define AC97_PCM_FRONT_DAC_RATE 0x002C /* PCM Front DAC Rate */ #define AC97_PCM_SURR_DAC_RATE 0x002E /* PCM Surround DAC Rate */ #define AC97_PCM_LFE_DAC_RATE 0x0030 /* PCM LFE DAC Rate */ -#define AC97_PCM_LR_DAC_RATE 0x0032 /* PCM LR DAC Rate */ +#define AC97_PCM_LR_ADC_RATE 0x0032 /* PCM LR ADC Rate */ #define AC97_PCM_MIC_ADC_RATE 0x0034 /* PCM MIC ADC Rate */ #define AC97_CENTER_LFE_MASTER 0x0036 /* Center + LFE Master Volume */ #define AC97_SURROUND_MASTER 0x0038 /* Surround (Rear) Master Volume */ diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index 0a9eb9762..4d5ada52b 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h @@ -257,7 +257,7 @@ enum { #define ATM_ATMOPT_CLP 1 /* set CLP bit */ -typedef struct { unsigned short bits; } atm_vcc_flags_t; +typedef struct { unsigned int bits; } atm_vcc_flags_t; struct atm_vcc { @@ -286,7 +286,6 @@ struct atm_vcc { struct sk_buff_head recvq; /* receive queue */ struct k_atm_aal_stats *stats; /* pointer to AAL stats group */ wait_queue_head_t sleep; /* if socket is busy */ - wait_queue_head_t wsleep; /* if waiting for write buffer space */ struct sock *sk; /* socket backpointer */ struct atm_vcc *prev,*next; /* SVC part --- may move later ------------------------------------- */ diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 04e9963de..0644ae74c 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -54,6 +54,7 @@ extern int copy_strings(int argc,char ** 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); extern int do_coredump(long signr, struct pt_regs * regs); +extern void set_binfmt(struct linux_binfmt *new); #if 0 diff --git a/include/linux/blk.h b/include/linux/blk.h index fd9e46712..777469870 100644 --- a/include/linux/blk.h +++ b/include/linux/blk.h @@ -53,6 +53,7 @@ extern int nbd_init(void); extern int ez_init(void); extern int bpcd_init(void); extern int ps2esdi_init(void); +extern int jsfd_init(void); #if defined(CONFIG_ARCH_S390) extern int mdisk_init(void); diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index a1d9b2939..00c3df0cc 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -905,7 +905,7 @@ struct cdrom_mechstat_header { #endif __u8 curlba[3]; __u8 nslots; - __u8 short slot_tablelen; + __u16 slot_tablelen; }; struct cdrom_slot { diff --git a/include/linux/dcache.h b/include/linux/dcache.h index f28b3bd9e..9ed7e0726 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -177,8 +177,8 @@ extern void d_rehash(struct dentry *); * @entry: dentry to add * @inode: The inode to attach to this dentry * - * This adds the entry to the hash queues and initializes "d_inode". - * The entry was actually filled in earlier during "d_alloc()" + * This adds the entry to the hash queues and initializes @inode. + * The entry was actually filled in earlier during d_alloc(). */ static __inline__ void d_add(struct dentry * entry, struct inode * inode) @@ -207,9 +207,9 @@ extern char * __d_path(struct dentry *, struct vfsmount *, struct dentry *, /** * dget - get a reference to a dentry - * @dentry: dentry to get a reference too + * @dentry: dentry to get a reference to * - * Given a dentry or NULL pointer increment the reference count + * Given a dentry or %NULL pointer increment the reference count * if appropriate and return the dentry. A dentry will not be * destroyed when it has references. */ @@ -225,7 +225,7 @@ static __inline__ struct dentry * dget(struct dentry *dentry) * d_unhashed - is dentry hashed * @dentry: entry to check * - * Returns true if the dentry passed is not currently hashed + * Returns true if the dentry passed is not currently hashed. */ static __inline__ int d_unhashed(struct dentry *dentry) diff --git a/include/linux/file.h b/include/linux/file.h index 1a11904b6..a6998496c 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -33,12 +33,12 @@ extern inline struct file * fcheck(unsigned int fd) return file; } -extern inline struct file * frip(unsigned int fd) +extern inline struct file * frip(struct files_struct *files, unsigned int fd) { struct file * file = NULL; - if (fd < current->files->max_fds) - file = xchg(¤t->files->fd[fd], NULL); + if (fd < files->max_fds) + file = xchg(&files->fd[fd], NULL); return file; } diff --git a/include/linux/fs.h b/include/linux/fs.h index 57bade5c6..3f135fa01 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -20,7 +20,6 @@ #include <linux/stat.h> #include <linux/cache.h> #include <linux/stddef.h> -#include <linux/string.h> #include <asm/atomic.h> #include <asm/bitops.h> @@ -99,6 +98,7 @@ extern int max_super_blocks, nr_super_blocks; #define MS_ODD_RENAME 32768 /* Temporary stuff; will go away as soon * as nfs_rename() will be cleaned up */ +#define S_DEAD (1<<16) /* removed, but still open directory */ /* * Flags that can be altered by MS_REMOUNT @@ -141,6 +141,7 @@ extern int max_super_blocks, nr_super_blocks; #define IS_NOATIME(inode) __IS_FLG(inode, MS_NOATIME) #define IS_NODIRATIME(inode) __IS_FLG(inode, MS_NODIRATIME) +#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) /* the read-only stuff doesn't really belong here, but any other place is probably as bad and I don't want to create yet another include file. */ @@ -172,6 +173,7 @@ extern int max_super_blocks, nr_super_blocks; #ifdef __KERNEL__ +#include <linux/string.h> #include <asm/semaphore.h> #include <asm/byteorder.h> @@ -179,9 +181,9 @@ extern void update_atime (struct inode *); #define UPDATE_ATIME(inode) update_atime (inode) extern void buffer_init(unsigned long); -extern void inode_init(void); +extern void inode_init(unsigned long); extern void file_table_init(void); -extern void dcache_init(void); +extern void dcache_init(unsigned long); /* bh state bits */ #define BH_Uptodate 0 /* 1 if the buffer contains valid data */ @@ -336,8 +338,9 @@ struct page; struct address_space; struct address_space_operations { - int (*writepage) (struct dentry *, struct page *); + int (*writepage)(struct file *, struct dentry *, struct page *); int (*readpage)(struct dentry *, struct page *); + int (*sync_page)(struct page *); int (*prepare_write)(struct file *, struct page *, unsigned, unsigned); int (*commit_write)(struct file *, struct page *, unsigned, unsigned); /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ @@ -551,6 +554,8 @@ struct nameidata { struct dentry *dentry; struct vfsmount *mnt; struct qstr last; + unsigned int flags; + int last_type; }; #define FASYNC_MAGIC 0x4601 @@ -689,6 +694,11 @@ struct block_device_operations { int (*revalidate) (kdev_t); }; +/* + * NOTE: + * read, write, poll, fsync, readv, writev can be called + * without the big kernel lock held in all filesystems. + */ struct file_operations { loff_t (*llseek) (struct file *, loff_t, int); ssize_t (*read) (struct file *, char *, size_t, loff_t *); @@ -841,7 +851,8 @@ asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */ extern int do_close(unsigned int, int); /* yes, it's really unsigned */ extern int do_truncate(struct dentry *, loff_t start); extern int get_unused_fd(void); -extern void put_unused_fd(unsigned int); +extern void __put_unused_fd(struct files_struct *, unsigned int); /* locked outside */ +extern void put_unused_fd(unsigned int); /* locked inside */ extern struct file *filp_open(const char *, int, int); extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); @@ -857,6 +868,7 @@ extern int unregister_blkdev(unsigned int, const char *); extern struct block_device *bdget(dev_t); extern void bdput(struct block_device *); extern int blkdev_open(struct inode *, struct file *); +extern int blkdev_close(struct inode * inode, struct file * filp); extern struct file_operations def_blk_fops; extern struct file_operations def_fifo_fops; extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); @@ -878,7 +890,6 @@ extern void init_special_inode(struct inode *, umode_t, int); extern void make_bad_inode(struct inode *); extern int is_bad_inode(struct inode *); -extern struct file_operations connecting_fifo_fops; extern struct file_operations read_fifo_fops; extern struct file_operations write_fifo_fops; extern struct file_operations rdwr_fifo_fops; @@ -947,7 +958,6 @@ extern void invalidate_inode_pages(struct inode *); #define invalidate_buffers(dev) __invalidate_buffers((dev), 0) #define destroy_buffers(dev) __invalidate_buffers((dev), 1) extern void __invalidate_buffers(kdev_t dev, int); -extern int floppy_is_wp(int); extern void sync_inodes(kdev_t); extern void write_inode_now(struct inode *); extern void sync_dev(kdev_t); @@ -991,10 +1001,14 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *); */ #define LOOKUP_FOLLOW (1) #define LOOKUP_DIRECTORY (2) -#define LOOKUP_SLASHOK (4) -#define LOOKUP_CONTINUE (8) -#define LOOKUP_POSITIVE (16) -#define LOOKUP_PARENT (32) +#define LOOKUP_CONTINUE (4) +#define LOOKUP_POSITIVE (8) +#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 }; /* * "descriptor" for what we're up to with a read for sendfile(). @@ -1014,9 +1028,12 @@ typedef struct { typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long); +/* needed for stackable file system support */ +extern loff_t default_llseek(struct file *file, loff_t offset, int origin); + extern struct dentry * lookup_dentry(const char *, unsigned int); extern int walk_init(const char *, unsigned, struct nameidata *); -extern int walk_name(const char *, unsigned, struct nameidata *); +extern int walk_name(const char *, struct nameidata *); extern struct dentry * lookup_one(const char *, struct dentry *); extern struct dentry * __namei(const char *, unsigned int); @@ -1071,12 +1088,15 @@ typedef int (get_block_t)(struct inode*,long,struct buffer_head*,int); /* Generic buffer handling for block filesystems.. */ extern int block_flushpage(struct page *, unsigned long); +extern int block_fsync(struct file *filp, struct dentry *dentry); extern int block_symlink(struct inode *, const char *, int); extern int block_write_full_page(struct page*, get_block_t*); extern int block_read_full_page(struct page*, get_block_t*); extern int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*); extern int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*, unsigned long *); +extern int block_sync_page(struct page *); + int generic_block_bmap(struct address_space *, long, get_block_t *); int generic_commit_write(struct file *, struct page *, unsigned, unsigned); diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h new file mode 100644 index 000000000..e9c32f386 --- /dev/null +++ b/include/linux/fs_struct.h @@ -0,0 +1,59 @@ +#ifndef _LINUX_FS_STRUCT_H +#define _LINUX_FS_STRUCT_H +#ifdef __KERNEL__ + +struct fs_struct { + atomic_t count; + int umask; + struct dentry * root, * pwd, * altroot; + struct vfsmount * rootmnt, * pwdmnt, * altrootmnt; +}; + +#define INIT_FS { \ + ATOMIC_INIT(1), \ + 0022, \ + NULL, NULL, NULL, NULL, NULL, NULL \ +} + +extern void exit_fs(struct task_struct *); +extern void set_fs_altroot(void); + +/* + * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values. + * It can block. Requires the big lock held. + */ + +static inline void set_fs_root(struct fs_struct *fs, + struct vfsmount *mnt, + struct dentry *dentry) +{ + struct dentry *old_root = fs->root; + struct vfsmount *old_rootmnt = fs->rootmnt; + fs->rootmnt = mntget(mnt); + fs->root = dget(dentry); + dput(old_root); + mntput(old_rootmnt); +} + +/* + * Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values. + * It can block. Requires the big lock held. + */ + +static inline void set_fs_pwd(struct fs_struct *fs, + struct vfsmount *mnt, + struct dentry *dentry) +{ + struct dentry *old_pwd = fs->pwd; + struct vfsmount *old_pwdmnt = fs->pwdmnt; + fs->pwdmnt = mntget(mnt); + fs->pwd = dget(dentry); + dput(old_pwd); + mntput(old_pwdmnt); +} + +struct fs_struct *copy_fs_struct(struct fs_struct *old); +void put_fs_struct(struct fs_struct *fs); + +#endif +#endif diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h index 70635b491..e28f6bfff 100644 --- a/include/linux/hdreg.h +++ b/include/linux/hdreg.h @@ -96,6 +96,8 @@ #define SMART_AUTOSAVE 0xd2 #define SMART_SAVE 0xd3 #define SMART_IMMEDIATE_OFFLINE 0xd4 +#define SMART_READ_LOG_SECTOR 0xd5 +#define SMART_WRITE_LOG_SECTOR 0xd6 #define SMART_ENABLE 0xd8 #define SMART_DISABLE 0xd9 #define SMART_STATUS 0xda diff --git a/include/linux/hdsmart.h b/include/linux/hdsmart.h index 10bd7249d..509b591d2 100644 --- a/include/linux/hdsmart.h +++ b/include/linux/hdsmart.h @@ -1,61 +1,139 @@ +/* + * linux/include/linux/hdsmart.h + * + * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org> + * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> + * + * 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, or (at your option) + * any later version. + * + * You should have received a copy of the GNU General Public License + * (for example /usr/src/linux/COPYING); if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + #ifndef _LINUX_HDSMART_H #define _LINUX_HDSMART_H -/* - * This file contains some defines for the AT-hd-controller. - * Various sources. - */ +/* smart_attribute is the vendor specific in SFF-8035 spec */ +struct ata_smart_attribute { + unsigned char id; + unsigned short status_flag; + unsigned char normalized; + unsigned char worse_normal; + unsigned char raw[6]; + unsigned char reserv; +} __attribute__ ((packed)); + +/* smart_values is format of the read drive Atrribute command */ +struct ata_smart_values { + unsigned short revnumber; + struct ata_smart_attribute vendor_attributes [30]; + unsigned char offline_data_collection_status; + unsigned char self_test_exec_status; + unsigned short total_time_to_complete_off_line; + unsigned char vendor_specific_366; + unsigned char offline_data_collection_capability; + unsigned short smart_capability; + unsigned char errorlog_capability; + unsigned char vendor_specific_371; + unsigned char short_test_completion_time; + unsigned char extend_test_completion_time; + unsigned char reserved_374_385 [12]; + unsigned char vendor_specific_386_509 [125]; + unsigned char chksum; +} __attribute__ ((packed)); + +/* Smart Threshold data structures */ +/* Vendor attribute of SMART Threshold */ +struct ata_smart_threshold_entry { + unsigned char id; + unsigned char normalized_threshold; + unsigned char reserved[10]; +} __attribute__ ((packed)); + +/* Format of Read SMART THreshold Command */ +struct ata_smart_thresholds { + unsigned short revnumber; + struct ata_smart_threshold_entry thres_entries[30]; + unsigned char reserved[149]; + unsigned char chksum; +} __attribute__ ((packed)); + +struct ata_smart_errorlog_command_struct { + unsigned char devicecontrolreg; + unsigned char featuresreg; + unsigned char sector_count; + unsigned char sector_number; + unsigned char cylinder_low; + unsigned char cylinder_high; + unsigned char drive_head; + unsigned char commandreg; + unsigned int timestamp; +} __attribute__ ((packed)); -#define NR_ATTRIBUTES 30 - -typedef struct threshold_s { - unsigned char id; - unsigned char threshold; - unsigned char reserved[10]; -} __attribute__ ((packed)) threshold_t; - -typedef struct thresholds_s { - unsigned short revision; - threshold_t thresholds[NR_ATTRIBUTES]; - unsigned char reserved[18]; - unsigned char vendor[131]; - unsigned char checksum; -} __attribute__ ((packed)) thresholds_t; - -typedef struct value_s { - unsigned char id; - unsigned short status; - unsigned char value; - unsigned char vendor[8]; -} __attribute__ ((packed)) value_t; - -typedef struct values_s { - unsigned short revision; - value_t values[NR_ATTRIBUTES]; - unsigned char offline_status; - unsigned char vendor1; - unsigned short offline_timeout; - unsigned char vendor2; - unsigned char offline_capability; - unsigned short smart_capability; - unsigned char reserved[16]; - unsigned char vendor[125]; - unsigned char checksum; -} __attribute__ ((packed)) values_t; +struct ata_smart_errorlog_error_struct { + unsigned char error_condition; + unsigned char extended_error[14]; + unsigned char state; + unsigned short timestamp; +} __attribute__ ((packed)); + +struct ata_smart_errorlog_struct { + struct ata_smart_errorlog_command_struct commands[6]; + struct ata_smart_errorlog_error_struct error_struct; +} __attribute__ ((packed)); + +struct ata_smart_errorlog { + unsigned char revnumber; + unsigned char error_log_pointer; + struct ata_smart_errorlog_struct errorlog_struct[5]; + unsigned short ata_error_count; + unsigned short non_fatal_count; + unsigned short drive_timeout_count; + unsigned char reserved[53]; +} __attribute__ ((packed)); + +struct ata_smart_selftestlog_struct { + unsigned char selftestnumber; + unsigned char selfteststatus; + unsigned short timestamp; + unsigned char selftestfailurecheckpoint; + unsigned int lbafirstfailure; + unsigned char vendorspecific[15]; +} __attribute__ ((packed)); + +struct ata_smart_selftestlog { + unsigned short revnumber; + struct ata_smart_selftestlog_struct selftest_struct[21]; + unsigned char vendorspecific[2]; + unsigned char mostrecenttest; + unsigned char resevered[2]; + unsigned char chksum; +} __attribute__ ((packed)); #if !defined(__KERNEL__) || defined(_IDE_DISK_C) - -#define NR_OFFLINE_TEXTS 5 -struct { - unsigned char value; - char *text; -} offline_status_text[NR_OFFLINE_TEXTS] = { - { 0x00, "NeverStarted" }, - { 0x02, "Completed" }, - { 0x04, "Suspended" }, - { 0x05, "Aborted" }, - { 0x06, "Failed" } -}; +/* smartctl version number */ +#define VERSION_MAJOR 1 +#define VERSION_MINOR 2 + +/* Number of ata device to scan */ +int numdevices; + +/* how often SMART is checks in seconds */ +int checktime = 1800; + +typedef struct atadevices_s { + int fd; + char devicename[14]; + int selftest; + struct hd_driveid drive; + struct ata_smart_values smartval; + struct ata_smart_thresholds smartthres; +} atadevices_t; + #endif /* !defined(__KERNEL__) || defined(_IDE_DISK_C) */ #endif /* _LINUX_HDSMART_H */ diff --git a/include/linux/i2o-dev.h b/include/linux/i2o-dev.h new file mode 100644 index 000000000..5ac8d9cef --- /dev/null +++ b/include/linux/i2o-dev.h @@ -0,0 +1,397 @@ +/* + * I2O user space accessible structures/APIs + * + * (c) Copyright 1999, 2000 Red Hat Software + * + * 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 header file defines the I2O APIs that are available to both + * the kernel and user level applications. Kernel specific structures + * are defined in i2o_osm. OSMs should include _only_ i2o_osm.h which + * automatically includs this file. + * + */ + +#ifndef _I2O_DEV_H +#define _I2O_DEV_H + +/* How many controllers are we allowing */ +#define MAX_I2O_CONTROLLERS 32 + +#include <linux/ioctl.h> + +/* + * I2O Control IOCTLs and structures + */ +#define I2O_MAGIC_NUMBER 'i' +#define I2OGETIOPS _IOR(I2O_MAGIC_NUMBER,0,u8[MAX_I2O_CONTROLLERS]) +#define I2OHRTGET _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct) +#define I2OLCTGET _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct) +#define I2OPARMSET _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget) +#define I2OPARMGET _IOWR(I2O_MAGIC_NUMBER,4,struct i2o_cmd_psetget) +#define I2OSWDL _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer) +#define I2OSWUL _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer) +#define I2OSWDEL _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer) +#define I2OVALIDATE _IOR(I2O_MAGIC_NUMBER,8,u32) +#define I2OHTML _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html) +#define I2OEVTREG _IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id) +#define I2OEVTGET _IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info) + +struct i2o_cmd_hrtlct +{ + unsigned int iop; /* IOP unit number */ + void *resbuf; /* Buffer for result */ + unsigned int *reslen; /* Buffer length in bytes */ +}; + +struct i2o_cmd_psetget +{ + unsigned int iop; /* IOP unit number */ + unsigned int tid; /* Target device TID */ + void *opbuf; /* Operation List buffer */ + unsigned int oplen; /* Operation List buffer length in bytes */ + void *resbuf; /* Result List buffer */ + unsigned int *reslen; /* Result List buffer length in bytes */ +}; + +struct i2o_sw_xfer +{ + unsigned int iop; /* IOP unit number */ + unsigned char flags; /* Flags field */ + unsigned char sw_type; /* Software type */ + unsigned int sw_id; /* Software ID */ + void *buf; /* Pointer to software buffer */ + unsigned int *swlen; /* Length of software data */ + unsigned int *maxfrag; /* Maximum fragment count */ + unsigned int *curfrag; /* Current fragment count */ +}; + +struct i2o_html +{ + unsigned int iop; /* IOP unit number */ + unsigned int tid; /* Target device ID */ + unsigned int page; /* HTML page */ + void *resbuf; /* Buffer for reply HTML page */ + unsigned int *reslen; /* Length in bytes of reply buffer */ + void *qbuf; /* Pointer to HTTP query string */ + unsigned int qlen; /* Length in bytes of query string buffer */ +}; + +#define I2O_EVT_Q_LEN 32 + +struct i2o_evt_id +{ + unsigned int iop; + unsigned int tid; + unsigned int evt_mask; +}; + +/* Event data size = frame size - message header + evt indicator */ +#define I2O_EVT_DATA_SIZE 88 + +struct i2o_evt_info +{ + struct i2o_evt_id id; + unsigned char evt_data[I2O_EVT_DATA_SIZE]; + unsigned int data_size; +}; + +struct i2o_evt_get +{ + struct i2o_evt_info info; + int pending; + int lost; +}; + + +/************************************************************************** + * HRT related constants and structures + **************************************************************************/ +#define I2O_BUS_LOCAL 0 +#define I2O_BUS_ISA 1 +#define I2O_BUS_EISA 2 +#define I2O_BUS_MCA 3 +#define I2O_BUS_PCI 4 +#define I2O_BUS_PCMCIA 5 +#define I2O_BUS_NUBUS 6 +#define I2O_BUS_CARDBUS 7 +#define I2O_BUS_UNKNOWN 0x80 + +#ifndef __KERNEL__ + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; + +#endif /* __KERNEL__ */ + +typedef struct _i2o_pci_bus { + u8 PciFunctionNumber; + u8 PciDeviceNumber; + u8 PciBusNumber; + u8 reserved; + u16 PciVendorID; + u16 PciDeviceID; +} i2o_pci_bus; + +typedef struct _i2o_local_bus { + u16 LbBaseIOPort; + u16 reserved; + u32 LbBaseMemoryAddress; +} i2o_local_bus; + +typedef struct _i2o_isa_bus { + u16 IsaBaseIOPort; + u8 CSN; + u8 reserved; + u32 IsaBaseMemoryAddress; +} i2o_isa_bus; + +typedef struct _i2o_eisa_bus_info { + u16 EisaBaseIOPort; + u8 reserved; + u8 EisaSlotNumber; + u32 EisaBaseMemoryAddress; +} i2o_eisa_bus; + +typedef struct _i2o_mca_bus { + u16 McaBaseIOPort; + u8 reserved; + u8 McaSlotNumber; + u32 McaBaseMemoryAddress; +} i2o_mca_bus; + +typedef struct _i2o_other_bus { + u16 BaseIOPort; + u16 reserved; + u32 BaseMemoryAddress; +} i2o_other_bus; + +typedef struct _i2o_hrt_entry { + u32 adapter_id; + u32 parent_tid:12; + u32 state:4; + u32 bus_num:8; + u32 bus_type:8; + union { + i2o_pci_bus pci_bus; + i2o_local_bus local_bus; + i2o_isa_bus isa_bus; + i2o_eisa_bus eisa_bus; + i2o_mca_bus mca_bus; + i2o_other_bus other_bus; + } bus; +} i2o_hrt_entry; + +typedef struct _i2o_hrt { + u16 num_entries; + u8 entry_len; + u8 hrt_version; + u32 change_ind; + i2o_hrt_entry hrt_entry[1]; +} i2o_hrt; + +typedef struct _i2o_lct_entry { + u32 entry_size:16; + u32 tid:12; + u32 reserved:4; + u32 change_ind; + u32 device_flags; + u32 class_id:12; + u32 version:4; + u32 vendor_id:16; + u32 sub_class; + u32 user_tid:12; + u32 parent_tid:12; + u32 bios_info:8; + u8 identity_tag[8]; + u32 event_capabilities; +} i2o_lct_entry; + +typedef struct _i2o_lct { + u32 table_size:16; + u32 boot_tid:12; + u32 lct_ver:4; + u32 iop_flags; + u32 change_ind; + i2o_lct_entry lct_entry[1]; +} i2o_lct; + +typedef struct _i2o_status_block { + u16 org_id; + u16 reserved; + u16 iop_id:12; + u16 reserved1:4; + u16 host_unit_id; + u16 segment_number:12; + u16 i2o_version:4; + u8 iop_state; + u8 msg_type; + u16 inbound_frame_size; + u8 init_code; + u8 reserved2; + u32 max_inbound_frames; + u32 cur_inbound_frames; + u32 max_outbound_frames; + char product_id[24]; + u32 expected_lct_size; + u32 iop_capabilities; + u32 desired_mem_size; + u32 current_mem_size; + u32 current_mem_base; + u32 desired_io_size; + u32 current_io_size; + u32 current_io_base; + u32 reserved3:24; + u32 cmd_status:8; +} i2o_status_block; + +/* Event indicator mask flags */ +#define I2O_EVT_IND_STATE_CHANGE 0x80000000 +#define I2O_EVT_IND_GENERAL_WARNING 0x40000000 +#define I2O_EVT_IND_CONFIGURATION_FLAG 0x20000000 +#define I2O_EVT_IND_LOCK_RELEASE 0x10000000 +#define I2O_EVT_IND_CAPABILITY_CHANGE 0x08000000 +#define I2O_EVT_IND_DEVICE_RESET 0x04000000 +#define I2O_EVT_IND_EVT_MASK_MODIFIED 0x02000000 +#define I2O_EVT_IND_FIELD_MODIFIED 0x01000000 +#define I2O_EVT_IND_VENDOR_EVT 0x00800000 +#define I2O_EVT_IND_DEVICE_STATE 0x00400000 + +/* Executive event indicitors */ +#define I2O_EVT_IND_EXEC_RESOURCE_LIMITS 0x00000001 +#define I2O_EVT_IND_EXEC_CONNECTION_FAIL 0x00000002 +#define I2O_EVT_IND_EXEC_ADAPTER_FAULT 0x00000004 +#define I2O_EVT_IND_EXEC_POWER_FAIL 0x00000008 +#define I2O_EVT_IND_EXEC_RESET_PENDING 0x00000010 +#define I2O_EVT_IND_EXEC_RESET_IMMINENT 0x00000020 +#define I2O_EVT_IND_EXEC_HW_FAIL 0x00000040 +#define I2O_EVT_IND_EXEC_XCT_CHANGE 0x00000080 +#define I2O_EVT_IND_EXEC_NEW_LCT_ENTRY 0x00000100 +#define I2O_EVT_IND_EXEC_MODIFIED_LCT 0x00000200 +#define I2O_EVT_IND_EXEC_DDM_AVAILABILITY 0x00000400 + +/* Random Block Storage Event Indicators */ +#define I2O_EVT_IND_BSA_VOLUME_LOAD 0x00000001 +#define I2O_EVT_IND_BSA_VOLUME_UNLOAD 0x00000002 +#define I2O_EVT_IND_BSA_VOLUME_UNLOAD_REQ 0x00000004 +#define I2O_EVT_IND_BSA_CAPACITY_CHANGE 0x00000008 +#define I2O_EVT_IND_BSA_SCSI_SMART 0x00000010 + +/* Event data for generic events */ +#define I2O_EVT_STATE_CHANGE_NORMAL 0x00 +#define I2O_EVT_STATE_CHANGE_SUSPENDED 0x01 +#define I2O_EVT_STATE_CHANGE_RESTART 0x02 +#define I2O_EVT_STATE_CHANGE_NA_RECOVER 0x03 +#define I2O_EVT_STATE_CHANGE_NA_NO_RECOVER 0x04 +#define I2O_EVT_STATE_CHANGE_QUIESCE_REQUEST 0x05 +#define I2O_EVT_STATE_CHANGE_FAILED 0x10 +#define I2O_EVT_STATE_CHANGE_FAULTED 0x11 + +#define I2O_EVT_GEN_WARNING_NORMAL 0x00 +#define I2O_EVT_GEN_WARNING_ERROR_THRESHOLD 0x01 +#define I2O_EVT_GEN_WARNING_MEDIA_FAULT 0x02 + +#define I2O_EVT_CAPABILITY_OTHER 0x01 +#define I2O_EVT_CAPABILITY_CHANGED 0x02 + +#define I2O_EVT_SENSOR_STATE_CHANGED 0x01 + +/* + * I2O classes / subclasses + */ + +/* Class ID and Code Assignments + * (LCT.ClassID.Version field) + */ +#define I2O_CLASS_VERSION_10 0x00 +#define I2O_CLASS_VERSION_11 0x01 + +/* Class code names + * (from v1.5 Table 6-1 Class Code Assignments.) + */ + +#define I2O_CLASS_EXECUTIVE 0x000 +#define I2O_CLASS_DDM 0x001 +#define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010 +#define I2O_CLASS_SEQUENTIAL_STORAGE 0x011 +#define I2O_CLASS_LAN 0x020 +#define I2O_CLASS_WAN 0x030 +#define I2O_CLASS_FIBRE_CHANNEL_PORT 0x040 +#define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x041 +#define I2O_CLASS_SCSI_PERIPHERAL 0x051 +#define I2O_CLASS_ATE_PORT 0x060 +#define I2O_CLASS_ATE_PERIPHERAL 0x061 +#define I2O_CLASS_FLOPPY_CONTROLLER 0x070 +#define I2O_CLASS_FLOPPY_DEVICE 0x071 +#define I2O_CLASS_BUS_ADAPTER_PORT 0x080 +#define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090 +#define I2O_CLASS_PEER_TRANSPORT 0x091 + +/* + * Rest of 0x092 - 0x09f reserved for peer-to-peer classes + */ + +#define I2O_CLASS_MATCH_ANYCLASS 0xffffffff + +/* + * Subclasses + */ + +#define I2O_SUBCLASS_i960 0x001 +#define I2O_SUBCLASS_HDM 0x020 +#define I2O_SUBCLASS_ISM 0x021 + +/* Operation functions */ + +#define I2O_PARAMS_FIELD_GET 0x0001 +#define I2O_PARAMS_LIST_GET 0x0002 +#define I2O_PARAMS_MORE_GET 0x0003 +#define I2O_PARAMS_SIZE_GET 0x0004 +#define I2O_PARAMS_TABLE_GET 0x0005 +#define I2O_PARAMS_FIELD_SET 0x0006 +#define I2O_PARAMS_LIST_SET 0x0007 +#define I2O_PARAMS_ROW_ADD 0x0008 +#define I2O_PARAMS_ROW_DELETE 0x0009 +#define I2O_PARAMS_TABLE_CLEAR 0x000A + +/* + * I2O serial number conventions / formats + * (circa v1.5) + */ + +#define I2O_SNFORMAT_UNKNOWN 0 +#define I2O_SNFORMAT_BINARY 1 +#define I2O_SNFORMAT_ASCII 2 +#define I2O_SNFORMAT_UNICODE 3 +#define I2O_SNFORMAT_LAN48_MAC 4 +#define I2O_SNFORMAT_WAN 5 + +/* + * Plus new in v2.0 (Yellowstone pdf doc) + */ + +#define I2O_SNFORMAT_LAN64_MAC 6 +#define I2O_SNFORMAT_DDM 7 +#define I2O_SNFORMAT_IEEE_REG64 8 +#define I2O_SNFORMAT_IEEE_REG128 9 +#define I2O_SNFORMAT_UNKNOWN2 0xff + +/* + * I2O Get Status State values + */ + +#define ADAPTER_STATE_INITIALIZING 0x01 +#define ADAPTER_STATE_RESET 0x02 +#define ADAPTER_STATE_HOLD 0x04 +#define ADAPTER_STATE_READY 0x05 +#define ADAPTER_STATE_OPERATIONAL 0x08 +#define ADAPTER_STATE_FAILED 0x10 +#define ADAPTER_STATE_FAULTED 0x11 + +#endif /* _I2O_DEV_H */ diff --git a/include/linux/i2o.h b/include/linux/i2o.h index b73ca4732..f55c5de88 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h @@ -1,281 +1,33 @@ +/* + * I2O kernel space accessible structures/APIs + * + * (c) Copyright 1999, 2000 Red Hat Software + * + * 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 header file defined the I2O APIs/structures for use by + * the I2O kernel modules. + * + */ + #ifndef _I2O_H #define _I2O_H +#ifdef __KERNEL__ /* This file to be included by kernel only */ -/* - * Tunable parameters first - */ +#include <linux/i2o-dev.h> /* How many different OSM's are we allowing */ #define MAX_I2O_MODULES 64 -/* How many controllers are we allowing */ -#define MAX_I2O_CONTROLLERS 32 - -#include <linux/ioctl.h> - -/* - * I2O Control IOCTLs and structures - */ -#define I2O_MAGIC_NUMBER 'i' -#define I2OGETIOPS _IOR(I2O_MAGIC_NUMBER,0,u8[MAX_I2O_CONTROLLERS]) -#define I2OHRTGET _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct) -#define I2OLCTGET _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct) -#define I2OPARMSET _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget) -#define I2OPARMGET _IOWR(I2O_MAGIC_NUMBER,4,struct i2o_cmd_psetget) -#define I2OSWDL _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer) -#define I2OSWUL _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer) -#define I2OSWDEL _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer) -#define I2OVALIDATE _IOR(I2O_MAGIC_NUMBER,8,u32) -#define I2OHTML _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html) -#define I2OEVTREG _IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id) -#define I2OEVTGET _IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info) - -struct i2o_cmd_hrtlct -{ - unsigned int iop; /* IOP unit number */ - void *resbuf; /* Buffer for result */ - unsigned int *reslen; /* Buffer length in bytes */ -}; - -struct i2o_cmd_psetget -{ - unsigned int iop; /* IOP unit number */ - unsigned int tid; /* Target device TID */ - void *opbuf; /* Operation List buffer */ - unsigned int oplen; /* Operation List buffer length in bytes */ - void *resbuf; /* Result List buffer */ - unsigned int *reslen; /* Result List buffer length in bytes */ -}; - -struct i2o_sw_xfer -{ - unsigned int iop; /* IOP unit number */ - unsigned char flags; /* Flags field */ - unsigned char sw_type; /* Software type */ - unsigned int sw_id; /* Software ID */ - void *buf; /* Pointer to software buffer */ - unsigned int *swlen; /* Length of software data */ - unsigned int *maxfrag; /* Maximum fragment count */ - unsigned int *curfrag; /* Current fragment count */ -}; - -struct i2o_html -{ - unsigned int iop; /* IOP unit number */ - unsigned int tid; /* Target device ID */ - unsigned int page; /* HTML page */ - void *resbuf; /* Buffer for reply HTML page */ - unsigned int *reslen; /* Length in bytes of reply buffer */ - void *qbuf; /* Pointer to HTTP query string */ - unsigned int qlen; /* Length in bytes of query string buffer */ -}; - -#define I2O_EVT_Q_LEN 32 - -struct i2o_evt_id -{ - unsigned int iop; - unsigned int tid; - unsigned int evt_mask; -}; - -// -// Event data size = frame size - message header + evt indicator -#define I2O_EVT_DATA_SIZE 88 - -struct i2o_evt_info -{ - struct i2o_evt_id id; - unsigned char evt_data[I2O_EVT_DATA_SIZE]; - unsigned int data_size; -}; - -struct i2o_evt_get -{ - struct i2o_evt_info info; - int pending; - int lost; -}; - - -/************************************************************************** - * HRT related constants and structures - **************************************************************************/ -#define I2O_BUS_LOCAL 0 -#define I2O_BUS_ISA 1 -#define I2O_BUS_EISA 2 -#define I2O_BUS_MCA 3 -#define I2O_BUS_PCI 4 -#define I2O_BUS_PCMCIA 5 -#define I2O_BUS_NUBUS 6 -#define I2O_BUS_CARDBUS 7 -#define I2O_BUS_UNKNOWN 0x80 - -#ifndef __KERNEL__ -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -#endif /* __KERNEL__ */ - -typedef struct _i2o_pci_bus { - u8 PciFunctionNumber; - u8 PciDeviceNumber; - u8 PciBusNumber; - u8 reserved; - u16 PciVendorID; - u16 PciDeviceID; -} i2o_pci_bus; - -typedef struct _i2o_local_bus { - u16 LbBaseIOPort; - u16 reserved; - u32 LbBaseMemoryAddress; -} i2o_local_bus; - -typedef struct _i2o_isa_bus { - u16 IsaBaseIOPort; - u8 CSN; - u8 reserved; - u32 IsaBaseMemoryAddress; -} i2o_isa_bus; - -typedef struct _i2o_eisa_bus_info { - u16 EisaBaseIOPort; - u8 reserved; - u8 EisaSlotNumber; - u32 EisaBaseMemoryAddress; -} i2o_eisa_bus; - -typedef struct _i2o_mca_bus { - u16 McaBaseIOPort; - u8 reserved; - u8 McaSlotNumber; - u32 McaBaseMemoryAddress; -} i2o_mca_bus; - -typedef struct _i2o_other_bus { - u16 BaseIOPort; - u16 reserved; - u32 BaseMemoryAddress; -} i2o_other_bus; - -typedef struct _i2o_hrt_entry { - u32 adapter_id; - u32 parent_tid:12; - u32 state:4; - u32 bus_num:8; - u32 bus_type:8; - union { - i2o_pci_bus pci_bus; - i2o_local_bus local_bus; - i2o_isa_bus isa_bus; - i2o_eisa_bus eisa_bus; - i2o_mca_bus mca_bus; - i2o_other_bus other_bus; - } bus; -} i2o_hrt_entry; - -typedef struct _i2o_hrt { - u16 num_entries; - u8 entry_len; - u8 hrt_version; - u32 change_ind; - i2o_hrt_entry hrt_entry[1]; -} i2o_hrt; - -typedef struct _i2o_lct_entry { - u32 entry_size:16; - u32 tid:12; - u32 reserved:4; - u32 change_ind; - u32 device_flags; - u32 class_id:12; - u32 version:4; - u32 vendor_id:16; - u32 sub_class; - u32 user_tid:12; - u32 parent_tid:12; - u32 bios_info:8; - u8 identity_tag[8]; - u32 event_capabilities; -} i2o_lct_entry; - -typedef struct _i2o_lct { - u32 table_size:16; - u32 boot_tid:12; - u32 lct_ver:4; - u32 iop_flags; - u32 current_change_ind; - i2o_lct_entry lct_entry[1]; -} i2o_lct; - -typedef struct _i2o_status_block { - u16 org_id; - u16 reserved; - u16 iop_id:12; - u16 reserved1:4; - u16 host_unit_id; - u16 segment_number:12; - u16 i2o_version:4; - u8 iop_state; - u8 msg_type; - u16 inbound_frame_size; - u8 init_code; - u8 reserved2; - u32 max_inbound_frames; - u32 cur_inbound_frames; - u32 max_outbound_frames; - char product_id[24]; - u32 expected_lct_size; - u32 iop_capabilities; - u32 desired_mem_size; - u32 current_mem_size; - u32 current_mem_base; - u32 desired_io_size; - u32 current_io_size; - u32 current_io_base; - u32 reserved3:24; - u32 cmd_status:8; -} i2o_status_block; - -/* Event indicator mask flags */ -#define I2O_EVT_IND_STATE_CHANGE 0x80000000 -#define I2O_EVT_IND_GENERAL_WARNING 0x40000000 -#define I2O_EVT_IND_CONFIGURATION_FLAG 0x20000000 -#define I2O_EVT_IND_LOCK_RELEASE 0x10000000 -#define I2O_EVT_IND_CAPABILITY_CHANGE 0x08000000 -#define I2O_EVT_IND_DEVICE_RESET 0x04000000 -#define I2O_EVT_IND_EVT_MASK_MODIFIED 0x02000000 -#define I2O_EVT_IND_FIELD_MODIFIED 0x01000000 -#define I2O_EVT_IND_VENDOR_EVT 0x00800000 -#define I2O_EVT_IND_DEVICE_STATE 0x00400000 - -/* Event data for generic events */ -#define I2O_EVT_STATE_CHANGE_NORMAL 0x00 -#define I2O_EVT_STATE_CHANGE_SUSPENDED 0x01 -#define I2O_EVT_STATE_CHANGE_RESTART 0x02 -#define I2O_EVT_STATE_CHANGE_NA_RECOVER 0x03 -#define I2O_EVT_STATE_CHANGE_NA_NO_RECOVER 0x04 -#define I2O_EVT_STATE_CHANGE_QUIESCE_REQUEST 0x05 -#define I2O_EVT_STATE_CHANGE_FAILED 0x10 -#define I2O_EVT_STATE_CHANGE_FAULTED 0x11 - -#define I2O_EVT_GEN_WARNING_NORMAL 0x00 -#define I2O_EVT_GEN_WARNING_ERROR_THRESHOLD 0x01 -#define I2O_EVT_GEN_WARNING_MEDIA_FAULT 0x02 - -#define I2O_EVT_CAPABILITY_OTHER 0x01 -#define I2O_EVT_CAPABILITY_CHANGED 0x02 - -#define I2O_EVT_SENSOR_STATE_CHANGED 0x01 - -#ifdef __KERNEL__ /* ioctl stuff only thing exported to users */ +/* How many OSMs can register themselves for device status updates? */ #define I2O_MAX_MANAGERS 4 -/* - * I2O Interface Objects - */ - +#include <asm/semaphore.h> /* Needed for MUTEX init macros */ #include <linux/config.h> #include <linux/notifier.h> #include <asm/atomic.h> @@ -283,7 +35,6 @@ typedef struct _i2o_status_block { /* * message structures */ - struct i2o_message { u8 version_offset; @@ -298,12 +49,11 @@ struct i2o_message /* * Each I2O device entity has one or more of these. There is one - * per device. *FIXME* how to handle multiple types on one unit. + * per device. */ - struct i2o_device { - i2o_lct_entry *lct_data;/* Device LCT information */ + i2o_lct_entry lct_data; /* Device LCT information */ u32 flags; int i2oversion; /* I2O version supported. Actually there * should be high and low version */ @@ -329,15 +79,20 @@ struct i2o_pci { int irq; #ifdef CONFIG_MTRR - int mtrr_reg; + int mtrr_reg0; + int mtrr_reg1; #endif }; +/* + * Transport types supported by I2O stack + */ +#define I2O_TYPE_PCI 0x01 /* PCI I2O controller */ + /* - * Each I2O controller has one of these objects + * Each I2O controller has one of these objects */ - struct i2o_controller { char name[16]; @@ -345,40 +100,43 @@ struct i2o_controller int type; int enabled; -#define I2O_TYPE_PCI 0x01 /* PCI I2O controller */ - struct notifier_block *event_notifer; /* Events */ atomic_t users; struct i2o_device *devices; /* I2O device chain */ struct i2o_controller *next; /* Controller chain */ - volatile u32 *post_port; /* Messaging ports */ - volatile u32 *reply_port; - volatile u32 *irq_mask; /* Interrupt port */ + volatile u32 *post_port; /* Inbout port */ + volatile u32 *reply_port; /* Outbound port */ + volatile u32 *irq_mask; /* Interrupt register */ + + /* Dynamic LCT related data */ + struct semaphore lct_sem; + int lct_pid; + int lct_running; i2o_status_block *status_block; /* IOP status block */ - i2o_lct *lct; - i2o_hrt *hrt; + i2o_lct *lct; /* Logical Config Table */ + i2o_lct *dlct; /* Temp LCT */ + i2o_hrt *hrt; /* HW Resource Table */ u32 mem_offset; /* MFA offset */ u32 mem_phys; /* MFA physical */ - u32 priv_mem; - u32 priv_mem_size; - u32 priv_io; - u32 priv_io_size; - struct proc_dir_entry* proc_entry; /* /proc dir */ union { /* Bus information */ struct i2o_pci pci; } bus; + /* Bus specific destructor */ void (*destructor)(struct i2o_controller *); + /* Bus specific attach/detach */ int (*bind)(struct i2o_controller *, struct i2o_device *); + /* Bus specific initiator */ int (*unbind)(struct i2o_controller *, struct i2o_device *); + /* Bus specific enable/disable */ void (*bus_enable)(struct i2o_controller *c); void (*bus_disable)(struct i2o_controller *c); @@ -387,12 +145,32 @@ struct i2o_controller int inbound_size; /* Inbound queue size */ }; +/* + * OSM resgistration block + * + * Each OSM creates at least one of these and registers it with the + * I2O core through i2o_register_handler. An OSM may want to + * register more than one if it wants a fast path to a reply + * handler by having a separate initiator context for each + * class function. + */ struct i2o_handler { + /* Message reply handler */ void (*reply)(struct i2o_handler *, struct i2o_controller *, struct i2o_message *); - char *name; - int context; /* Low 8 bits of the transaction info */ - u32 class; /* I2O classes that this driver handles */ + + /* New device notification handler */ + void (*new_dev_notify)(struct i2o_controller *, struct i2o_device *); + + /* Device deltion handler */ + void (*dev_del_notify)(struct i2o_controller *, struct i2o_device *); + + /* Reboot notification handler */ + void (*reboot_notify)(void); + + char *name; /* OSM name */ + int context; /* Low 8 bits of the transaction info */ + u32 class; /* I2O classes that this driver handles */ /* User data follows */ }; @@ -416,10 +194,14 @@ struct i2o_core_func_table void (*run_queue)(struct i2o_controller *c); int (*delete)(struct i2o_controller *); }; -#endif +#endif // MODULE /* * I2O System table entry + * + * The system table contains information about all the IOPs in the + * system. It is sent to all IOPs so that they can create peer2peer + * connections between them. */ struct i2o_sys_tbl_entry { @@ -498,130 +280,55 @@ extern inline void i2o_flush_reply(struct i2o_controller *c, u32 m) I2O_REPLY_WRITE32(c,m); } -extern int i2o_install_controller(struct i2o_controller *); -extern int i2o_delete_controller(struct i2o_controller *); -extern void i2o_unlock_controller(struct i2o_controller *); extern struct i2o_controller *i2o_find_controller(int); -extern int i2o_status_get(struct i2o_controller *); +extern void i2o_unlock_controller(struct i2o_controller *); +extern struct i2o_controller *i2o_controller_chain; extern int i2o_num_controllers; +extern int i2o_status_get(struct i2o_controller *); extern int i2o_install_handler(struct i2o_handler *); extern int i2o_remove_handler(struct i2o_handler *); -extern int i2o_claim_device(struct i2o_device *, struct i2o_handler *, u32); -extern int i2o_release_device(struct i2o_device *, struct i2o_handler *, u32); +extern int i2o_claim_device(struct i2o_device *, struct i2o_handler *); +extern int i2o_release_device(struct i2o_device *, struct i2o_handler *); +extern int i2o_device_notify_on(struct i2o_device *, struct i2o_handler *); +extern int i2o_device_notify_off(struct i2o_device *, struct i2o_handler *); extern int i2o_post_this(struct i2o_controller *, u32 *, int); extern int i2o_post_wait(struct i2o_controller *, u32 *, int, int); -extern int i2o_issue_params(int, struct i2o_controller *, int, void *, - int, void *, int); extern int i2o_query_scalar(struct i2o_controller *, int, int, int, void *, int); extern int i2o_set_scalar(struct i2o_controller *, int, int, int, void *, int); - extern int i2o_query_table(int, struct i2o_controller *, int, int, int, void *, int, void *, int); extern int i2o_clear_table(struct i2o_controller *, int, int); extern int i2o_row_add_table(struct i2o_controller *, int, int, int, void *, int); +extern int i2o_row_delete_table(struct i2o_controller *, int, int, int, void *, + int); +extern int i2o_issue_params(int, struct i2o_controller *, int, void *, + int, void *, int); -extern int i2o_event_register(struct i2o_controller *, int, int, u32); -extern int i2o_event_ack(struct i2o_controller *, int, int, u32, void *, int); +extern int i2o_event_register(struct i2o_controller *, u32, u32, u32, u32); +extern int i2o_event_ack(struct i2o_controller *, u32 *); -extern void i2o_run_queue(struct i2o_controller *); extern void i2o_report_status(const char *, const char *, u32 *); extern void i2o_dump_message(u32 *); - extern const char *i2o_get_class_name(int); +extern int i2o_install_controller(struct i2o_controller *); +extern int i2o_activate_controller(struct i2o_controller *); +extern void i2o_run_queue(struct i2o_controller *); +extern int i2o_delete_controller(struct i2o_controller *); -/* - * I2O classes / subclasses - */ - -/* Class ID and Code Assignments - * (LCT.ClassID.Version field) - */ -#define I2O_CLASS_VERSION_10 0x00 -#define I2O_CLASS_VERSION_11 0x01 - -/* Class code names - * (from v1.5 Table 6-1 Class Code Assignments.) - */ - -#define I2O_CLASS_EXECUTIVE 0x000 -#define I2O_CLASS_DDM 0x001 -#define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010 -#define I2O_CLASS_SEQUENTIAL_STORAGE 0x011 -#define I2O_CLASS_LAN 0x020 -#define I2O_CLASS_WAN 0x030 -#define I2O_CLASS_FIBRE_CHANNEL_PORT 0x040 -#define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x041 -#define I2O_CLASS_SCSI_PERIPHERAL 0x051 -#define I2O_CLASS_ATE_PORT 0x060 -#define I2O_CLASS_ATE_PERIPHERAL 0x061 -#define I2O_CLASS_FLOPPY_CONTROLLER 0x070 -#define I2O_CLASS_FLOPPY_DEVICE 0x071 -#define I2O_CLASS_BUS_ADAPTER_PORT 0x080 -#define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090 -#define I2O_CLASS_PEER_TRANSPORT 0x091 - -/* Rest of 0x092 - 0x09f reserved for peer-to-peer classes - */ - -#define I2O_CLASS_MATCH_ANYCLASS 0xffffffff - -/* Subclasses - */ - -#define I2O_SUBCLASS_i960 0x001 -#define I2O_SUBCLASS_HDM 0x020 -#define I2O_SUBCLASS_ISM 0x021 - -/* Operation functions */ - -#define I2O_PARAMS_FIELD_GET 0x0001 -#define I2O_PARAMS_LIST_GET 0x0002 -#define I2O_PARAMS_MORE_GET 0x0003 -#define I2O_PARAMS_SIZE_GET 0x0004 -#define I2O_PARAMS_TABLE_GET 0x0005 -#define I2O_PARAMS_FIELD_SET 0x0006 -#define I2O_PARAMS_LIST_SET 0x0007 -#define I2O_PARAMS_ROW_ADD 0x0008 -#define I2O_PARAMS_ROW_DELETE 0x0009 -#define I2O_PARAMS_TABLE_CLEAR 0x000A /* - * I2O serial number conventions / formats - * (circa v1.5) + * I2O Function codes */ -#define I2O_SNFORMAT_UNKNOWN 0 -#define I2O_SNFORMAT_BINARY 1 -#define I2O_SNFORMAT_ASCII 2 -#define I2O_SNFORMAT_UNICODE 3 -#define I2O_SNFORMAT_LAN48_MAC 4 -#define I2O_SNFORMAT_WAN 5 - -/* Plus new in v2.0 (Yellowstone pdf doc) - */ - -#define I2O_SNFORMAT_LAN64_MAC 6 -#define I2O_SNFORMAT_DDM 7 -#define I2O_SNFORMAT_IEEE_REG64 8 -#define I2O_SNFORMAT_IEEE_REG128 9 -#define I2O_SNFORMAT_UNKNOWN2 0xff - -/* Transaction Reply Lists (TRL) Control Word structure */ - -#define TRL_SINGLE_FIXED_LENGTH 0x00 -#define TRL_SINGLE_VARIABLE_LENGTH 0x40 -#define TRL_MULTIPLE_FIXED_LENGTH 0x80 - /* - * Messaging API values - */ - + * Executive Class + */ #define I2O_CMD_ADAPTER_ASSIGN 0xB3 #define I2O_CMD_ADAPTER_READ 0xB2 #define I2O_CMD_ADAPTER_RELEASE 0xB5 @@ -656,6 +363,9 @@ extern const char *i2o_get_class_name(int); #define I2O_CMD_SYS_QUIESCE 0xC3 #define I2O_CMD_SYS_TAB_SET 0xA3 +/* + * Utility Class + */ #define I2O_CMD_UTIL_NOP 0x00 #define I2O_CMD_UTIL_ABORT 0x01 #define I2O_CMD_UTIL_CLAIM 0x09 @@ -671,10 +381,16 @@ extern const char *i2o_get_class_name(int); #define I2O_CMD_UTIL_LOCK_RELEASE 0x19 #define I2O_CMD_UTIL_REPLY_FAULT_NOTIFY 0x15 +/* + * SCSI Host Bus Adapter Class + */ #define I2O_CMD_SCSI_EXEC 0x81 #define I2O_CMD_SCSI_ABORT 0x83 #define I2O_CMD_SCSI_BUSRESET 0x27 +/* + * Random Block Storage Class + */ #define I2O_CMD_BLOCK_READ 0x30 #define I2O_CMD_BLOCK_WRITE 0x31 #define I2O_CMD_BLOCK_CFLUSH 0x37 @@ -688,24 +404,11 @@ extern const char *i2o_get_class_name(int); /* * Init Outbound Q status */ - #define I2O_CMD_OUTBOUND_INIT_IN_PROGRESS 0x01 #define I2O_CMD_OUTBOUND_INIT_REJECTED 0x02 #define I2O_CMD_OUTBOUND_INIT_FAILED 0x03 #define I2O_CMD_OUTBOUND_INIT_COMPLETE 0x04 -/* - * I2O Get Status State values - */ - -#define ADAPTER_STATE_INITIALIZING 0x01 -#define ADAPTER_STATE_RESET 0x02 -#define ADAPTER_STATE_HOLD 0x04 -#define ADAPTER_STATE_READY 0x05 -#define ADAPTER_STATE_OPERATIONAL 0x08 -#define ADAPTER_STATE_FAILED 0x10 -#define ADAPTER_STATE_FAULTED 0x11 - /* I2O API function return values */ #define I2O_RTN_NO_ERROR 0 @@ -796,8 +499,10 @@ extern const char *i2o_get_class_name(int); /* Message header defines for VersionOffset */ #define I2OVER15 0x0001 #define I2OVER20 0x0002 + /* Default is 1.5, FIXME: Need support for both 1.5 and 2.0 */ #define I2OVERSION I2OVER15 + #define SGL_OFFSET_0 I2OVERSION #define SGL_OFFSET_4 (0x0040 | I2OVERSION) #define SGL_OFFSET_5 (0x0050 | I2OVERSION) @@ -810,6 +515,12 @@ extern const char *i2o_get_class_name(int); #define TRL_OFFSET_5 (0x0050 | I2OVERSION) #define TRL_OFFSET_6 (0x0060 | I2OVERSION) +/* Transaction Reply Lists (TRL) Control Word structure */ +#define TRL_SINGLE_FIXED_LENGTH 0x00 +#define TRL_SINGLE_VARIABLE_LENGTH 0x40 +#define TRL_MULTIPLE_FIXED_LENGTH 0x80 + + /* msg header defines for MsgFlags */ #define MSG_STATIC 0x0100 #define MSG_64BIT_CNTXT 0x0200 @@ -844,5 +555,4 @@ extern const char *i2o_get_class_name(int); #define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT #endif /* __KERNEL__ */ - #endif /* _I2O_H */ diff --git a/include/linux/ide.h b/include/linux/ide.h index bdb72ef5f..ea395aaa8 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -300,13 +300,6 @@ typedef struct ide_drive_s { struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ void *settings; /* /proc/ide/ drive settings */ char driver_req[10]; /* requests specific driver */ -#if 1 - struct thresholds_s *smart_thresholds; - struct values_s *smart_values; -#else - thresholds_t smart_thresholds; - values_t smart_values; -#endif int last_lun; /* last logical unit */ int forced_lun; /* if hdxlun was given at boot */ } ide_drive_t; @@ -538,6 +531,7 @@ typedef int (ide_ioctl_proc)(ide_drive_t *, struct inode *, struct file *, unsi typedef int (ide_open_proc)(struct inode *, struct file *, ide_drive_t *); typedef void (ide_release_proc)(struct inode *, struct file *, ide_drive_t *); typedef int (ide_check_media_change_proc)(ide_drive_t *); +typedef void (ide_revalidate_proc)(ide_drive_t *); typedef void (ide_pre_reset_proc)(ide_drive_t *); typedef unsigned long (ide_capacity_proc)(ide_drive_t *); typedef ide_startstop_t (ide_special_proc)(ide_drive_t *); @@ -557,6 +551,7 @@ typedef struct ide_driver_s { ide_open_proc *open; ide_release_proc *release; ide_check_media_change_proc *media_change; + ide_revalidate_proc *revalidate; ide_pre_reset_proc *pre_reset; ide_capacity_proc *capacity; ide_special_proc *special; @@ -735,6 +730,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err); int ide_wait_cmd (ide_drive_t *drive, int cmd, int nsect, int feature, int sectors, byte *buf); void ide_delay_50ms (void); +int system_bus_clock(void); int ide_driveid_update (ide_drive_t *drive); int ide_ata66_check (ide_drive_t *drive, int cmd, int nsect, int feature); diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 96974638a..2995d563d 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -2,6 +2,7 @@ #ifndef _LINUX_INTERRUPT_H #define _LINUX_INTERRUPT_H +#include <linux/config.h> #include <linux/kernel.h> #include <linux/smp.h> #include <linux/cache.h> @@ -154,7 +155,7 @@ struct tasklet_head extern struct tasklet_head tasklet_vec[NR_CPUS]; extern struct tasklet_head tasklet_hi_vec[NR_CPUS]; -#ifdef __SMP__ +#ifdef CONFIG_SMP #define tasklet_trylock(t) (!test_and_set_bit(TASKLET_STATE_RUN, &(t)->state)) #define tasklet_unlock_wait(t) while (test_bit(TASKLET_STATE_RUN, &(t)->state)) { /* NOTHING */ } #define tasklet_unlock(t) clear_bit(TASKLET_STATE_RUN, &(t)->state) @@ -213,7 +214,7 @@ extern void tasklet_kill(struct tasklet_struct *t); extern void tasklet_init(struct tasklet_struct *t, void (*func)(unsigned long), unsigned long data); -#ifdef __SMP__ +#ifdef CONFIG_SMP #define SMP_TIMER_NAME(name) name##__thr @@ -224,12 +225,12 @@ static void name (unsigned long dummy) \ tasklet_schedule(&(task)); \ } -#else /* __SMP__ */ +#else /* CONFIG_SMP */ #define SMP_TIMER_NAME(name) name #define SMP_TIMER_DEFINE(name, task) -#endif /* __SMP__ */ +#endif /* CONFIG_SMP */ /* Old BH definitions */ diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 02341868d..11a85411f 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -83,6 +83,12 @@ asmlinkage int printk(const char * fmt, ...) ((unsigned char *)&addr)[2], \ ((unsigned char *)&addr)[3] +#define HIPQUAD(addr) \ + ((unsigned char *)&addr)[3], \ + ((unsigned char *)&addr)[2], \ + ((unsigned char *)&addr)[1], \ + ((unsigned char *)&addr)[0] + #endif /* __KERNEL__ */ #define SI_LOAD_SHIFT 16 diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 8c58edf5e..2491372a9 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h @@ -1,6 +1,7 @@ #ifndef _LINUX_KERNEL_STAT_H #define _LINUX_KERNEL_STAT_H +#include <linux/config.h> #include <asm/irq.h> #include <linux/smp.h> #include <linux/threads.h> @@ -25,7 +26,9 @@ struct kernel_stat { unsigned int dk_drive_wblk[DK_NDRIVE]; unsigned int pgpgin, pgpgout; unsigned int pswpin, pswpout; +#if !defined(CONFIG_ARCH_S390) unsigned int irqs[NR_CPUS][NR_IRQS]; +#endif unsigned int ipackets, opackets; unsigned int ierrors, oerrors; unsigned int collisions; @@ -34,6 +37,7 @@ struct kernel_stat { extern struct kernel_stat kstat; +#if !defined(CONFIG_ARCH_S390) /* * Number of interrupts per specific IRQ source, since bootup */ @@ -46,5 +50,6 @@ extern inline int kstat_irqs (int irq) return sum; } +#endif #endif /* _LINUX_KERNEL_STAT_H */ diff --git a/include/linux/major.h b/include/linux/major.h index fc6e616ac..0338e266a 100644 --- a/include/linux/major.h +++ b/include/linux/major.h @@ -119,6 +119,8 @@ #define AURORA_MAJOR 79 +#define JSFD_MAJOR 99 + #define PHONE_MAJOR 100 #define LVM_CHAR_MAJOR 109 /* Logical Volume Manager */ diff --git a/include/linux/mm.h b/include/linux/mm.h index 453b31d7c..278eb959b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -15,6 +15,7 @@ extern unsigned long max_mapnr; extern unsigned long num_physpages; extern void * high_memory; extern int page_cluster; +extern struct list_head lru_cache; #include <asm/page.h> #include <asm/pgtable.h> @@ -89,6 +90,8 @@ struct vm_area_struct { #define VM_SEQ_READ 0x00008000 /* App will access data sequentially */ #define VM_RAND_READ 0x00010000 /* App will not benefit from clustered reads */ +#define VM_DONTCOPY 0x00020000 /* Do not copy this vma on fork */ + #define VM_STACK_FLAGS 0x00000177 #define VM_READHINTMASK (VM_SEQ_READ | VM_RAND_READ) @@ -400,7 +403,7 @@ extern int remap_page_range(unsigned long from, unsigned long to, unsigned long extern int zeromap_page_range(unsigned long from, unsigned long size, pgprot_t prot); extern void vmtruncate(struct inode * inode, loff_t offset); -extern int handle_mm_fault(struct task_struct *tsk,struct vm_area_struct *vma, unsigned long address, int write_access); +extern int handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access); extern int make_pages_present(unsigned long addr, unsigned long end); extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char *dst, int len); @@ -443,7 +446,8 @@ out: return ret; } -extern int do_munmap(unsigned long, size_t); +extern int do_munmap(struct mm_struct *, unsigned long, size_t); + extern unsigned long do_brk(unsigned long, unsigned long); struct zone_t; @@ -538,7 +542,7 @@ static inline struct vm_area_struct * find_vma_intersection(struct mm_struct * m return vma; } -extern struct vm_area_struct *find_extend_vma(struct task_struct *tsk, unsigned long addr); +extern struct vm_area_struct *find_extend_vma(struct mm_struct *mm, unsigned long addr); #define buffer_under_min() (atomic_read(&buffermem_pages) * 100 < \ buffer_mem.min_percent * num_physpages) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 05a846297..61f672a3c 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -31,7 +31,6 @@ typedef struct zone_struct { char low_on_memory; char zone_wake_kswapd; unsigned long pages_min, pages_low, pages_high; - struct list_head lru_cache; /* * free areas of different sizes diff --git a/include/linux/mount.h b/include/linux/mount.h index 547163d2e..ddd2cad4d 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h @@ -17,7 +17,7 @@ struct vfsmount char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ char *mnt_dirname; /* Name of directory mounted on */ struct super_block *mnt_sb; /* pointer to superblock */ - struct vfsmount *mnt_next; /* pointer to next in linkedlist */ + struct list_head mnt_list; }; /* MOUNT_REWRITE: fill these */ diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index adcfb751d..f2f822b12 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h @@ -293,7 +293,6 @@ extern unsigned char fat_uni2esc[]; extern unsigned char fat_esc2uni[]; /* fatfs_syms.c */ -extern int init_fat_fs(void); extern void cleanup_fat_fs(void); /* nls.c */ diff --git a/include/linux/net.h b/include/linux/net.h index 0269a037e..16d0859cc 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -104,8 +104,6 @@ struct proto_ops { char *optval, int optlen); int (*getsockopt) (struct socket *sock, int level, int optname, char *optval, int *optlen); - int (*fcntl) (struct socket *sock, unsigned int cmd, - unsigned long arg); int (*sendmsg) (struct socket *sock, struct msghdr *m, int total_len, struct scm_cookie *scm); int (*recvmsg) (struct socket *sock, struct msghdr *m, int total_len, int flags, struct scm_cookie *scm); int (*mmap) (struct file *file, struct socket *sock, struct vm_area_struct * vma); @@ -194,8 +192,6 @@ SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \ char *optval, int optlen), (sock, level, optname, optval, optlen)) \ SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \ char *optval, int *optlen), (sock, level, optname, optval, optlen)) \ -SOCKCALL_WRAP(name, fcntl, (struct socket *sock, unsigned int cmd, \ - unsigned long arg), (sock, cmd, arg)) \ SOCKCALL_WRAP(name, sendmsg, (struct socket *sock, struct msghdr *m, int len, struct scm_cookie *scm), \ (sock, m, len, scm)) \ SOCKCALL_WRAP(name, recvmsg, (struct socket *sock, struct msghdr *m, int len, int flags, struct scm_cookie *scm), \ @@ -203,25 +199,24 @@ SOCKCALL_WRAP(name, recvmsg, (struct socket *sock, struct msghdr *m, int len, in SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \ (file, sock, vma)) \ \ -static struct proto_ops name##_ops = { \ - fam, \ - \ - __lock_##name##_release, \ - __lock_##name##_bind, \ - __lock_##name##_connect, \ - __lock_##name##_socketpair, \ - __lock_##name##_accept, \ - __lock_##name##_getname, \ - __lock_##name##_poll, \ - __lock_##name##_ioctl, \ - __lock_##name##_listen, \ - __lock_##name##_shutdown, \ - __lock_##name##_setsockopt, \ - __lock_##name##_getsockopt, \ - __lock_##name##_fcntl, \ - __lock_##name##_sendmsg, \ - __lock_##name##_recvmsg, \ - __lock_##name##_mmap, \ +static struct proto_ops name##_ops = { \ + family: fam, \ + \ + release: __lock_##name##_release, \ + bind: __lock_##name##_bind, \ + connect: __lock_##name##_connect, \ + socketpair: __lock_##name##_socketpair, \ + accept: __lock_##name##_accept, \ + getname: __lock_##name##_getname, \ + poll: __lock_##name##_poll, \ + ioctl: __lock_##name##_ioctl, \ + listen: __lock_##name##_listen, \ + shutdown: __lock_##name##_shutdown, \ + setsockopt: __lock_##name##_setsockopt, \ + getsockopt: __lock_##name##_getsockopt, \ + sendmsg: __lock_##name##_sendmsg, \ + recvmsg: __lock_##name##_recvmsg, \ + mmap: __lock_##name##_mmap, \ }; #endif diff --git a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h index 3c1b4a4c6..f5fd96690 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h @@ -37,10 +37,10 @@ struct ip_conntrack_protocol struct iphdr *iph, size_t len, enum ip_conntrack_info ctinfo); - /* Called when a new connection for this protocol found; returns - * TRUE if it's OK. If so, packet() called next. */ - int (*new)(struct ip_conntrack *conntrack, - struct iphdr *iph, size_t len); + /* Called when a new connection for this protocol found; + * returns timeout. If so, packet() called next. */ + unsigned long (*new)(struct ip_conntrack *conntrack, + struct iphdr *iph, size_t len); /* Module (if any) which this is connected to. */ struct module *me; diff --git a/include/linux/netfilter_ipv4/ipt_state.h b/include/linux/netfilter_ipv4/ipt_state.h index ad11d316a..e298baf17 100644 --- a/include/linux/netfilter_ipv4/ipt_state.h +++ b/include/linux/netfilter_ipv4/ipt_state.h @@ -1,8 +1,7 @@ #ifndef _IPT_STATE_H #define _IPT_STATE_H -#define _IPT_STATE_BIT(ctinfo) (1 << ((ctinfo)+1)) -#define IPT_STATE_BIT(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? _IPT_STATE_BIT((ctinfo)-IP_CT_IS_REPLY) : _IPT_STATE_BIT(ctinfo)) +#define IPT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) #define IPT_STATE_INVALID (1 << 0) struct ipt_state_info diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 5f9a5dded..653e6045b 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -45,6 +45,7 @@ * The upper limit on timeouts for the exponential backoff algorithm. */ #define NFS_MAX_RPC_TIMEOUT (6*HZ) +#define NFS_READ_DELAY (2*HZ) #define NFS_WRITEBACK_DELAY (5*HZ) #define NFS_WRITEBACK_LOCKDELAY (60*HZ) #define NFS_COMMIT_DELAY (5*HZ) @@ -174,12 +175,9 @@ extern int nfs_lock(struct file *, int, struct file_lock *); /* * linux/fs/nfs/write.c */ -extern int nfs_writepage(struct dentry *, struct page *); -extern int nfs_check_failed_request(struct inode *); -extern struct nfs_page* nfs_find_request(struct inode *, struct page *); -extern void nfs_release_request(struct nfs_page *req); +extern int nfs_writepage(struct file *file, struct dentry *, struct page *); extern int nfs_flush_incompatible(struct file *file, struct page *page); -extern int nfs_updatepage(struct file *, struct page *, unsigned long, unsigned int); +extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); /* * Try to write back everything synchronously (but check the * return value!) @@ -193,6 +191,12 @@ extern int nfs_commit_timeout(struct inode *, int); #endif static inline int +nfs_have_read(struct inode *inode) +{ + return !list_empty(&inode->u.nfs_i.read); +} + +static inline int nfs_have_writebacks(struct inode *inode) { return !list_empty(&inode->u.nfs_i.writeback); @@ -229,6 +233,8 @@ nfs_wb_file(struct inode *inode, struct file *file) * linux/fs/nfs/read.c */ extern int nfs_readpage(struct dentry *, struct page *); +extern int nfs_pagein_inode(struct inode *, unsigned long, unsigned int); +extern int nfs_pagein_timeout(struct inode *); /* * linux/fs/mount_clnt.c @@ -275,7 +281,7 @@ nfs_time_to_secs(__u64 time) /* NFS root */ -extern int nfs_root_mount(struct super_block *sb); +extern void * nfs_root_data(void); #define nfs_wait_event(clnt, wq, condition) \ ({ \ diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h index 05e259900..2e10b1963 100644 --- a/include/linux/nfs_fs_i.h +++ b/include/linux/nfs_fs_i.h @@ -53,11 +53,13 @@ struct nfs_inode_info { /* * This is the list of dirty unwritten pages. */ + struct list_head read; struct list_head dirty; struct list_head commit; struct list_head writeback; - unsigned int ndirty, + unsigned int nread, + ndirty, ncommit, npages; diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index da76c1d62..c1e835d3a 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -9,7 +9,9 @@ struct nfs_server { struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */ int flags; /* various flags */ unsigned int rsize; /* read size */ + unsigned int rpages; /* read size (in pages) */ unsigned int wsize; /* write size */ + unsigned int wpages; /* write size (in pages) */ unsigned int dtsize; /* readdir size */ unsigned int bsize; /* server block size */ unsigned int acregmin; /* attr cache timeouts */ diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h new file mode 100644 index 000000000..475fced7c --- /dev/null +++ b/include/linux/nfs_page.h @@ -0,0 +1,102 @@ +/* + * linux/include/linux/nfs_page.h + * + * Copyright (C) 2000 Trond Myklebust + * + * NFS page cache wrapper. + */ + +#ifndef _LINUX_NFS_PAGE_H +#define _LINUX_NFS_PAGE_H + + +#include <linux/list.h> +#include <linux/mm.h> +#include <linux/wait.h> +#include <linux/sunrpc/auth.h> +#include <linux/nfs_xdr.h> + +/* + * Valid flags for a dirty buffer + */ +#define PG_BUSY 0x0001 + +struct nfs_page { + struct list_head wb_hash, /* Inode */ + wb_list, /* Defines state of page: */ + *wb_list_head; /* read/write/commit */ + struct file *wb_file; + struct dentry *wb_dentry; + struct rpc_cred *wb_cred; + struct page *wb_page; /* page to read in/write out */ + wait_queue_head_t wb_wait; /* wait queue */ + unsigned long wb_timeout; /* when to read/write/commit */ + unsigned int wb_offset, /* Offset of read/write */ + wb_bytes, /* Length of request */ + wb_count, /* reference count */ + wb_flags; + struct nfs_writeverf wb_verf; /* Commit cookie */ +}; + +#define NFS_WBACK_BUSY(req) ((req)->wb_flags & PG_BUSY) + +extern struct nfs_page *nfs_create_request(struct dentry *dentry, + struct page *page, + unsigned int offset, + unsigned int count); +extern void nfs_release_request(struct nfs_page *req); + + +extern void nfs_list_add_request(struct nfs_page *req, + struct list_head *head); +extern void nfs_list_remove_request(struct nfs_page *req); + +extern int nfs_scan_list_timeout(struct list_head *head, + struct list_head *dst, + struct inode *inode); +extern int nfs_scan_list(struct list_head *src, struct list_head *dst, + struct file *file, unsigned long idx_start, + unsigned int npages); +extern int nfs_coalesce_requests(struct list_head *src, struct list_head *dst, + unsigned int maxpages); + +extern spinlock_t nfs_wreq_lock; + +/* + * Lock the page of an asynchronous request + */ +static __inline__ int +nfs_lock_request(struct nfs_page *req) +{ + if (NFS_WBACK_BUSY(req)) + return 0; + req->wb_count++; + req->wb_flags |= PG_BUSY; + return 1; +} + +static __inline__ void +nfs_unlock_request(struct nfs_page *req) +{ + if (!NFS_WBACK_BUSY(req)) { + printk(KERN_ERR "NFS: Invalid unlock attempted\n"); + return; + } + req->wb_flags &= ~PG_BUSY; + wake_up(&req->wb_wait); + nfs_release_request(req); +} + +static __inline__ struct nfs_page * +nfs_list_entry(struct list_head *head) +{ + return list_entry(head, struct nfs_page, wb_list); +} + +static __inline__ struct nfs_page * +nfs_inode_wb_entry(struct list_head *head) +{ + return list_entry(head, struct nfs_page, wb_hash); +} + +#endif /* _LINUX_NFS_PAGE_H */ diff --git a/include/linux/parport.h b/include/linux/parport.h index f228dc42e..0597addd4 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h @@ -380,8 +380,26 @@ extern int parport_claim_or_block(struct pardevice *dev); extern void parport_release(struct pardevice *dev); -/* parport_yield relinquishes the port if it would be helpful to other - drivers. The return value is the same as for parport_claim. */ +/** + * parport_yield - relinquish a parallel port temporarily + * @dev: a device on the parallel port + * + * This function relinquishes the port if it would be helpful to other + * drivers to do so. Afterwards it tries to reclaim the port using + * parport_claim(), and the return value is the same as for + * parport_claim(). If it fails, the port is left unclaimed and it is + * the driver's responsibility to reclaim the port. + * + * The parport_yield() and parport_yield_blocking() functions are for + * marking points in the driver at which other drivers may claim the + * port and use their devices. Yielding the port is similar to + * releasing it and reclaiming it, but is more efficient because no + * action is taken if there are no other devices needing the port. In + * fact, nothing is done even if there are other devices waiting but + * the current device is still within its "timeslice". The default + * timeslice is half a second, but it can be adjusted via the /proc + * interface. + **/ extern __inline__ int parport_yield(struct pardevice *dev) { unsigned long int timeslip = (jiffies - dev->time); @@ -391,8 +409,15 @@ extern __inline__ int parport_yield(struct pardevice *dev) return parport_claim(dev); } -/* parport_yield_blocking is the same but uses parport_claim_or_block - instead of parport_claim. */ +/** + * parport_yield_blocking - relinquish a parallel port temporarily + * @dev: a device on the parallel port + * + * This function relinquishes the port if it would be helpful to other + * drivers to do so. Afterwards it tries to reclaim the port using + * parport_claim_or_block(), and the return value is the same as for + * parport_claim_or_block(). + **/ extern __inline__ int parport_yield_blocking(struct pardevice *dev) { unsigned long int timeslip = (jiffies - dev->time); diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 2b37bcf20..e5c5b723b 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -808,6 +808,8 @@ #define PCI_VENDOR_ID_ARTOP 0x1191 #define PCI_DEVICE_ID_ARTOP_ATP8400 0x0004 #define PCI_DEVICE_ID_ARTOP_ATP850UF 0x0005 +#define PCI_DEVICE_ID_ARTOP_ATP860 0x0006 +#define PCI_DEVICE_ID_ARTOP_ATP860R 0x0007 #define PCI_VENDOR_ID_ZEITNET 0x1193 #define PCI_DEVICE_ID_ZEITNET_1221 0x0001 diff --git a/include/linux/personality.h b/include/linux/personality.h index 7607cf6ff..58cab509e 100644 --- a/include/linux/personality.h +++ b/include/linux/personality.h @@ -3,7 +3,7 @@ #include <linux/linkage.h> #include <linux/ptrace.h> - +#include <asm/current.h> /* Flags for bug emulation. These occupy the top three bytes. */ #define STICKY_TIMEOUTS 0x4000000 @@ -22,6 +22,7 @@ #define PER_WYSEV386 (0x0004 | STICKY_TIMEOUTS) #define PER_ISCR4 (0x0005 | STICKY_TIMEOUTS) #define PER_BSD (0x0006) +#define PER_SUNOS (PER_BSD | STICKY_TIMEOUTS) #define PER_XENIX (0x0007 | STICKY_TIMEOUTS) #define PER_LINUX32 (0x0008) #define PER_IRIX32 (0x0009 | STICKY_TIMEOUTS) /* IRIX5 32-bit */ @@ -51,11 +52,17 @@ struct exec_domain { extern struct exec_domain default_exec_domain; -extern struct exec_domain *lookup_exec_domain(unsigned long personality); extern int register_exec_domain(struct exec_domain *it); extern int unregister_exec_domain(struct exec_domain *it); #define put_exec_domain(it) \ if (it && it->module) __MOD_DEC_USE_COUNT(it->module); +#define get_exec_domain(it) \ + if (it && it->module) __MOD_INC_USE_COUNT(it->module); +extern void __set_personality(unsigned long personality); +#define set_personality(pers) do { \ + if (current->personality != pers) \ + __set_personality(pers); \ +} while (0) asmlinkage long sys_personality(unsigned long personality); #endif /* _PERSONALITY_H */ diff --git a/include/linux/raid/md_u.h b/include/linux/raid/md_u.h index 6ba4ebbcd..9478513f9 100644 --- a/include/linux/raid/md_u.h +++ b/include/linux/raid/md_u.h @@ -17,12 +17,6 @@ /* ioctls */ -/* compat */ -#define REGISTER_DEV _IO (MD_MAJOR, 1) -#define START_MD _IO (MD_MAJOR, 2) -#define STOP_MD _IO (MD_MAJOR, 3) - - /* status */ #define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t) #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t) diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 55510558c..ea2226d1f 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -28,6 +28,17 @@ struct rtc_time { }; /* + * This data structure is inspired by the EFI (v0.92) wakeup + * alarm API. + */ +struct rtc_wkalrm { + unsigned char enabled; /* 0 = alarm disable, 1 = alarm disabled */ + unsigned char pending; /* 0 = alarm pending, 1 = alarm not pending */ + struct rtc_time time; /* time the alarm is set to */ +}; + + +/* * ioctl calls that are permitted to the /dev/rtc interface, if * CONFIG_RTC/CONFIG_EFI_RTC was enabled. */ @@ -50,4 +61,7 @@ struct rtc_time { #define RTC_EPOCH_READ _IOR('p', 0x0d, unsigned long) /* Read epoch */ #define RTC_EPOCH_SET _IOW('p', 0x0e, unsigned long) /* Set epoch */ +#define RTC_WKALM_SET _IOW('p', 0x0f, struct rtc_wkalrm)/* Set wakeup alarm*/ +#define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm)/* Get wakeup alarm*/ + #endif /* _LINUX_RTC_H_ */ diff --git a/include/linux/sched.h b/include/linux/sched.h index aa30e2cc1..d249961e3 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -5,6 +5,7 @@ extern unsigned long event; +#include <linux/config.h> #include <linux/binfmts.h> #include <linux/personality.h> #include <linux/threads.h> @@ -23,6 +24,7 @@ extern unsigned long event; #include <linux/sem.h> #include <linux/signal.h> #include <linux/securebits.h> +#include <linux/fs_struct.h> /* * cloning flags: @@ -84,7 +86,7 @@ extern int last_pid; #define __set_task_state(tsk, state_value) \ do { (tsk)->state = (state_value); } while (0) -#ifdef __SMP__ +#ifdef CONFIG_SMP #define set_task_state(tsk, state_value) \ set_mb((tsk)->state, (state_value)) #else @@ -94,7 +96,7 @@ extern int last_pid; #define __set_current_state(state_value) \ do { current->state = (state_value); } while (0) -#ifdef __SMP__ +#ifdef CONFIG_SMP #define set_current_state(state_value) \ set_mb(current->state, (state_value)) #else @@ -181,19 +183,6 @@ struct files_struct { { NULL, } \ } -struct fs_struct { - atomic_t count; - int umask; - struct dentry * root, * pwd; - struct vfsmount * rootmnt, * pwdmnt; -}; - -#define INIT_FS { \ - ATOMIC_INIT(1), \ - 0022, \ - NULL, NULL, NULL, NULL \ -} - /* Maximum number of active map areas.. This is a random (large) number */ #define MAX_MAP_COUNT (65536) @@ -214,7 +203,7 @@ struct mm_struct { unsigned long start_code, end_code, start_data, end_data; unsigned long start_brk, brk, start_stack; unsigned long arg_start, arg_end, env_start, env_end; - unsigned long rss, total_vm, locked_vm; + unsigned long min_flt, maj_flt, rss, total_vm, locked_vm; unsigned long def_flags; unsigned long cpu_vm_mask; unsigned long swap_cnt; /* number of pages to swap on next pass */ @@ -236,7 +225,7 @@ struct mm_struct { 0, 0, 0, 0, \ 0, 0, 0, \ 0, 0, 0, 0, \ - 0, 0, 0, \ + 0, 0, 0, 0, 0, \ 0, 0, 0, 0, NULL } struct signal_struct { @@ -321,6 +310,7 @@ struct task_struct { /* 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; int swappable:1; + int hog:1; /* process credentials */ uid_t uid,euid,suid,fsuid; gid_t gid,egid,sgid,fsgid; @@ -711,7 +701,6 @@ extern void flush_thread(void); extern void exit_thread(void); extern void exit_mm(struct task_struct *); -extern void exit_fs(struct task_struct *); extern void exit_files(struct task_struct *); extern void exit_sighand(struct task_struct *); diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index f229d4f82..20029fd67 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -99,6 +99,12 @@ struct sk_buff { struct dst_entry *dst; + /* + * This is the control buffer. It is free to use for every + * layer. Please put your private variables there. If you + * want to keep them across layers you have to do a skb_clone() + * first. This is owned by whoever has the skb queued ATM. + */ char cb[48]; unsigned int len; /* Length of actual data */ @@ -130,13 +136,6 @@ struct sk_buff { unsigned int nf_debug; #endif #endif /*CONFIG_NETFILTER*/ -#if defined(CONFIG_SHAPER) || defined(CONFIG_SHAPER_MODULE) - __u32 shapelatency; /* Latency on frame */ - __u32 shapeclock; /* Time it should go out */ - __u32 shapelen; /* Frame length in clocks */ - __u32 shapestamp; /* Stamp for shaper */ - __u16 shapepend; /* Pending */ -#endif #if defined(CONFIG_HIPPI) union{ @@ -211,7 +210,7 @@ extern __inline__ atomic_t *skb_datarefp(struct sk_buff *skb) * skb_queue_empty - check if a queue is empty * @list: queue head * - * Returns true if the queue is empty, false otherwise + * Returns true if the queue is empty, false otherwise. */ extern __inline__ int skb_queue_empty(struct sk_buff_head *list) @@ -240,7 +239,7 @@ extern __inline__ struct sk_buff *skb_get(struct sk_buff *skb) /** * kfree_skb - free an sk_buff - * @skb: The buffer to free + * @skb: buffer to free * * Drop a reference to the buffer and free it if the usage count has * hit zero. @@ -261,9 +260,9 @@ extern __inline__ void kfree_skb_fast(struct sk_buff *skb) /** * skb_cloned - is the buffer a clone - * @skb: Buffer to check + * @skb: buffer to check * - * Returns true if the buffer was generated with skb_clone and is + * Returns true if the buffer was generated with skb_clone() and is * one of multiple shared copies of the buffer. Cloned buffers are * shared data so must not be written to under normal circumstances. */ @@ -328,9 +327,9 @@ extern __inline__ struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) * copy of the data, drops a reference count on the old copy and returns * the new copy with the reference count at 1. If the buffer is not a clone * the original buffer is returned. When called with a spinlock held or - * from interrupt state pri must be GFP_ATOMIC + * from interrupt state @pri must be %GFP_ATOMIC * - * NULL is returned on a memory allocation failure. + * %NULL is returned on a memory allocation failure. */ extern __inline__ struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) @@ -347,12 +346,12 @@ extern __inline__ struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) * skb_peek * @list_: list to peek at * - * Peek an sk_buff. Unlike most other operations you _MUST_ + * Peek an &sk_buff. Unlike most other operations you _MUST_ * be careful with this one. A peek leaves the buffer on the * list and someone else may run off with it. You must hold * the appropriate locks or have a private queue to do this. * - * Returns NULL for an empty list or a pointer to the head element. + * Returns %NULL for an empty list or a pointer to the head element. * The reference count is not incremented and the reference is therefore * volatile. Use with caution. */ @@ -369,12 +368,12 @@ extern __inline__ struct sk_buff *skb_peek(struct sk_buff_head *list_) * skb_peek_tail * @list_: list to peek at * - * Peek an sk_buff. Unlike most other operations you _MUST_ + * Peek an &sk_buff. Unlike most other operations you _MUST_ * be careful with this one. A peek leaves the buffer on the * list and someone else may run off with it. You must hold * the appropriate locks or have a private queue to do this. * - * Returns NULL for an empty list or a pointer to the tail element. + * Returns %NULL for an empty list or a pointer to the tail element. * The reference count is not incremented and the reference is therefore * volatile. Use with caution. */ @@ -391,7 +390,7 @@ extern __inline__ struct sk_buff *skb_peek_tail(struct sk_buff_head *list_) * skb_queue_len - get queue length * @list_: list to measure * - * Return the length of an sk_buff queue. + * Return the length of an &sk_buff queue. */ extern __inline__ __u32 skb_queue_len(struct sk_buff_head *list_) @@ -446,7 +445,7 @@ extern __inline__ void __skb_queue_head(struct sk_buff_head *list, struct sk_buf * @newsk: buffer to queue * * Queue a buffer at the start of the list. This function takes the - * list lock and can be used safely with other locking sk_buff functions + * list lock and can be used safely with other locking &sk_buff functions * safely. * * A buffer cannot be placed on two lists at the same time. @@ -493,7 +492,7 @@ extern __inline__ void __skb_queue_tail(struct sk_buff_head *list, struct sk_buf * @newsk: buffer to queue * * Queue a buffer at the tail of the list. This function takes the - * list lock and can be used safely with other locking sk_buff functions + * list lock and can be used safely with other locking &sk_buff functions * safely. * * A buffer cannot be placed on two lists at the same time. @@ -514,7 +513,7 @@ extern __inline__ void skb_queue_tail(struct sk_buff_head *list, struct sk_buff * * Remove the head of the list. This function does not take any locks * so must be used with appropriate locks held only. The head item is - * returned or NULL if the list is empty. + * returned or %NULL if the list is empty. */ extern __inline__ struct sk_buff *__skb_dequeue(struct sk_buff_head *list) @@ -543,7 +542,7 @@ extern __inline__ struct sk_buff *__skb_dequeue(struct sk_buff_head *list) * * Remove the head of the list. The list lock is taken so the function * may be used safely with other locking list functions. The head item is - * returned or NULL if the list is empty. + * returned or %NULL if the list is empty. */ extern __inline__ struct sk_buff *skb_dequeue(struct sk_buff_head *list) @@ -675,7 +674,7 @@ extern __inline__ void skb_unlink(struct sk_buff *skb) * * Remove the tail of the list. This function does not take any locks * so must be used with appropriate locks held only. The tail item is - * returned or NULL if the list is empty. + * returned or %NULL if the list is empty. */ extern __inline__ struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) @@ -692,7 +691,7 @@ extern __inline__ struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) * * Remove the head of the list. The list lock is taken so the function * may be used safely with other locking list functions. The tail item is - * returned or NULL if the list is empty. + * returned or %NULL if the list is empty. */ extern __inline__ struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list) @@ -725,7 +724,7 @@ extern __inline__ unsigned char *__skb_put(struct sk_buff *skb, unsigned int len * * This function extends the used data area of the buffer. If this would * exceed the total buffer size the kernel will panic. A pointer to the - * first byte of the extra data is returned + * first byte of the extra data is returned. */ extern __inline__ unsigned char *skb_put(struct sk_buff *skb, unsigned int len) @@ -752,8 +751,8 @@ extern __inline__ unsigned char *__skb_push(struct sk_buff *skb, unsigned int le * @len: amount of data to add * * This function extends the used data area of the buffer at the buffer - * start. If this would exceed the total buffer headroom the kernel will - * panic. A pointer to the first byte of the extra data is returned + * start. If this would exceed the total buffer headroom the kernel will + * panic. A pointer to the first byte of the extra data is returned. */ extern __inline__ unsigned char *skb_push(struct sk_buff *skb, unsigned int len) @@ -777,10 +776,10 @@ extern __inline__ char *__skb_pull(struct sk_buff *skb, unsigned int len) * @skb: buffer to use * @len: amount of data to remove * - * This function removes data from the start of a buffer, returning + * This function removes data from the start of a buffer, returning * the memory to the headroom. A pointer to the next data in the buffer * is returned. Once the data has been pulled future pushes will overwrite - * the old data + * the old data. */ extern __inline__ unsigned char * skb_pull(struct sk_buff *skb, unsigned int len) @@ -794,7 +793,7 @@ extern __inline__ unsigned char * skb_pull(struct sk_buff *skb, unsigned int len * skb_headroom - bytes at buffer head * @skb: buffer to check * - * Return the number of bytes of free space at the head of an sk_buff + * Return the number of bytes of free space at the head of an &sk_buff. */ extern __inline__ int skb_headroom(const struct sk_buff *skb) @@ -819,7 +818,7 @@ extern __inline__ int skb_tailroom(const struct sk_buff *skb) * @skb: buffer to alter * @len: bytes to move * - * Increase the headroom of an empty sk_buff by reducing the tail + * Increase the headroom of an empty &sk_buff by reducing the tail * room. This is only allowed for an empty buffer. */ @@ -856,8 +855,8 @@ extern __inline__ void skb_trim(struct sk_buff *skb, unsigned int len) * skb_orphan - orphan a buffer * @skb: buffer to orphan * - * If a buffer currently has an owner then we call the owners - * destructor function and make the skb unowned. The buffer continues + * If a buffer currently has an owner then we call the owner's + * destructor function and make the @skb unowned. The buffer continues * to exist but is no longer charged to its former owner. */ @@ -874,7 +873,7 @@ extern __inline__ void skb_orphan(struct sk_buff *skb) * skb_purge - empty a list * @list: list to empty * - * Delete all buffers on an sk_buff list. Each buffer is removed from + * Delete all buffers on an &sk_buff list. Each buffer is removed from * the list and one reference dropped. This function takes the list * lock and is atomic with respect to other list locking functions. */ @@ -891,7 +890,7 @@ extern __inline__ void skb_queue_purge(struct sk_buff_head *list) * __skb_purge - empty a list * @list: list to empty * - * Delete all buffers on an sk_buff list. Each buffer is removed from + * Delete all buffers on an &sk_buff list. Each buffer is removed from * the list and one reference dropped. This function does not take the * list lock and the caller must hold the relevant locks to use it. */ @@ -908,12 +907,12 @@ extern __inline__ void __skb_queue_purge(struct sk_buff_head *list) * dev_alloc_skb - allocate an skbuff for sending * @length: length to allocate * - * Allocate a new sk_buff and assign it a usage count of one. The + * Allocate a new &sk_buff and assign it a usage count of one. The * buffer has unspecified headroom built in. Users should allocate * the headroom they think they need without accounting for the * built in space. The built in space is used for optimisations. * - * NULL is returned in there is no free memory. Although this function + * %NULL is returned in there is no free memory. Although this function * allocates memory it can be called from an interrupt. */ @@ -934,7 +933,7 @@ extern __inline__ struct sk_buff *dev_alloc_skb(unsigned int length) * * If the buffer passed lacks sufficient headroom or is a clone then * it is copied and the additional headroom made available. If there - * is no free memory NULL is returned. The new buffer is returned if + * is no free memory %NULL is returned. The new buffer is returned if * a copy was made (and the old one dropped a reference). The existing * buffer is returned otherwise. * diff --git a/include/linux/smp.h b/include/linux/smp.h index 5f8a10198..6b0617caf 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -6,7 +6,9 @@ * Alan Cox. <alan@redhat.com> */ -#ifdef __SMP__ +#include <linux/config.h> + +#ifdef CONFIG_SMP #include <asm/smp.h> diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h index 320c69612..d1bb03872 100644 --- a/include/linux/smp_lock.h +++ b/include/linux/smp_lock.h @@ -1,7 +1,9 @@ #ifndef __LINUX_SMPLOCK_H #define __LINUX_SMPLOCK_H -#ifndef __SMP__ +#include <linux/config.h> + +#ifndef CONFIG_SMP #define lock_kernel() do { } while(0) #define unlock_kernel() do { } while(0) @@ -13,6 +15,6 @@ #include <asm/smplock.h> -#endif /* __SMP__ */ +#endif /* CONFIG_SMP */ #endif diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index ff319aaa1..b4a190d65 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -1,6 +1,8 @@ #ifndef __LINUX_SPINLOCK_H #define __LINUX_SPINLOCK_H +#include <linux/config.h> + /* * These are the generic versions of the spinlocks and read-write * locks.. @@ -29,7 +31,7 @@ #define write_unlock_irq(lock) do { write_unlock(lock); local_irq_enable(); } while (0) #define write_unlock_bh(lock) do { write_unlock(lock); local_bh_enable(); } while (0) -#ifdef __SMP__ +#ifdef CONFIG_SMP #include <asm/spinlock.h> #else /* !SMP */ diff --git a/include/linux/string.h b/include/linux/string.h index e5002746b..88eb21c28 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -31,6 +31,7 @@ extern void * memcpy(void *,const void *,__kernel_size_t); extern void * memmove(void *,const void *,__kernel_size_t); extern void * memscan(void *,int,__kernel_size_t); extern int memcmp(const void *,const void *,__kernel_size_t); +extern void * memchr(const void *,int,__kernel_size_t); /* * Include machine specific inline routines diff --git a/include/linux/swap.h b/include/linux/swap.h index d24ff0e0a..5d5f97cdb 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -51,6 +51,7 @@ struct swap_info_struct { kdev_t swap_device; spinlock_t sdev_lock; struct dentry * swap_file; + struct vfsmount *swap_vfsmnt; unsigned short * swap_map; unsigned int lowest_bit; unsigned int highest_bit; @@ -86,6 +87,7 @@ extern void swap_setup (void); /* linux/mm/vmscan.c */ extern int try_to_free_pages(unsigned int gfp_mask, zone_t *zone); +extern int swap_out(unsigned int gfp_mask, int priority); /* linux/mm/page_io.c */ extern void rw_swap_page(int, struct page *, int); @@ -166,7 +168,7 @@ extern spinlock_t pagemap_lru_lock; #define lru_cache_add(page) \ do { \ spin_lock(&pagemap_lru_lock); \ - list_add(&(page)->lru, &page->zone->lru_cache); \ + list_add(&(page)->lru, &lru_cache); \ nr_lru_pages++; \ spin_unlock(&pagemap_lru_lock); \ } while (0) diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index eb51e575f..92e44456b 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -119,7 +119,7 @@ enum enum { VM_SWAPCTL=1, /* struct: Set vm swapping control */ - VM_SWAPOUT=2, /* int: Background pageout interval */ + VM_SWAPOUT=2, /* int: Linear or sqrt() swapout for hogs */ VM_FREEPG=3, /* struct: Set free page thresholds */ VM_BDFLUSH=4, /* struct: Control buffer cache flushing */ VM_OVERCOMMIT_MEMORY=5, /* Turn off the virtual memory safety limit */ diff --git a/include/linux/threads.h b/include/linux/threads.h index f1f502eb6..b6ed9116c 100644 --- a/include/linux/threads.h +++ b/include/linux/threads.h @@ -1,12 +1,14 @@ #ifndef _LINUX_THREADS_H #define _LINUX_THREADS_H +#include <linux/config.h> + /* * The default limit for the nr of threads is now in * /proc/sys/kernel/max-threads. */ -#ifdef __SMP__ +#ifdef CONFIG_SMP #define NR_CPUS 32 /* Max processors that can be running in SMP */ #else #define NR_CPUS 1 diff --git a/include/linux/timer.h b/include/linux/timer.h index f9e7efdaa..e6eb00da0 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -1,6 +1,8 @@ #ifndef _LINUX_TIMER_H #define _LINUX_TIMER_H +#include <linux/config.h> + /* * Old-style timers. Please don't use for any new code. * @@ -69,7 +71,7 @@ extern inline void init_timer(struct timer_list * timer) { timer->next = NULL; timer->prev = NULL; -#ifdef __SMP__ +#ifdef CONFIG_SMP timer->running = 0; #endif } @@ -79,17 +81,17 @@ extern inline int timer_pending(const struct timer_list * timer) return timer->prev != NULL; } -#ifdef __SMP__ +#ifdef CONFIG_SMP #define timer_exit(t) do { (t)->running = 0; mb(); } while (0) #define timer_set_running(t) do { (t)->running = 1; mb(); } while (0) #define timer_is_running(t) ((t)->running != 0) #define timer_synchronize(t) while (timer_is_running(t)) barrier() extern int del_timer_sync(struct timer_list * timer); #else -#define timer_exit(t) do { } while (0) -#define timer_set_running(t) do { } while (0) +#define timer_exit(t) (void)(t) +#define timer_set_running(t) (void)(t) #define timer_is_running(t) (0) -#define timer_synchronize(t) barrier() +#define timer_synchronize(t) do { (void)(t); barrier(); } while(0) #define del_timer_sync(t) del_timer(t) #endif diff --git a/include/linux/usb.h b/include/linux/usb.h index b9db220f2..e67e96bdc 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -160,7 +160,7 @@ typedef struct wait_queue *wait_queue_head_t; #define __set_current_state(state_value) \ do { current->state = state_value; } while (0) -#ifdef __SMP__ +#ifdef CONFIG_SMP #define set_current_state(state_value) \ set_mb(current->state, state_value) #else @@ -618,7 +618,7 @@ int usb_get_current_frame_number (struct usb_device *usb_dev); * - current Data0/1 state (1 bit) * - direction (1 bit) * - speed (1 bit) - * - max packet size (2 bits: 8, 16, 32 or 64) + * - max packet size (2 bits: 8, 16, 32 or 64) [Historical; now gone.] * - pipe type (2 bits: control, interrupt, bulk, isochronous) * * That's 18 bits. Really. Nothing more. And the USB people have @@ -628,7 +628,7 @@ int usb_get_current_frame_number (struct usb_device *usb_dev); * Let's not fall in that trap. We'll just encode it as a simple * unsigned int. The encoding is: * - * - max size: bits 0-1 (00 = 8, 01 = 16, 10 = 32, 11 = 64) + * - max size: bits 0-1 (00 = 8, 01 = 16, 10 = 32, 11 = 64) [Historical; now gone.] * - direction: bit 7 (0 = Host-to-Device [Out], 1 = Device-to-Host [In]) * - device: bits 8-14 * - endpoint: bits 15-18 @@ -647,11 +647,6 @@ int usb_get_current_frame_number (struct usb_device *usb_dev); #define PIPE_CONTROL 2 #define PIPE_BULK 3 -#define USB_ISOCHRONOUS 0 -#define USB_INTERRUPT 1 -#define USB_CONTROL 2 -#define USB_BULK 3 - #define usb_maxpacket(dev, pipe, out) (out \ ? (dev)->epmaxpacketout[usb_pipeendpoint(pipe)] \ : (dev)->epmaxpacketin [usb_pipeendpoint(pipe)] ) diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 682620995..7a73db598 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -373,6 +373,7 @@ struct video_code #define VID_HARDWARE_ZR36120 25 /* Zoran ZR36120/ZR36125 */ #define VID_HARDWARE_ZR36067 26 /* Zoran ZR36067/36060 */ #define VID_HARDWARE_OV511 27 +#define VID_HARDWARE_ZR356700 28 /* Zoran 36700 series */ /* * Initialiser list diff --git a/include/linux/wanpipe.h b/include/linux/wanpipe.h index 830e48e43..dffdc0b2c 100644 --- a/include/linux/wanpipe.h +++ b/include/linux/wanpipe.h @@ -35,7 +35,9 @@ #ifndef _WANPIPE_H #define _WANPIPE_H -#ifdef __SMP__ +#include <linux/config.h> + +#ifdef CONFIG_SMP #include <asm/spinlock.h> /* Support for SMP Locking */ #endif @@ -251,7 +253,7 @@ typedef struct sdla unsigned short force_enable_irq; char TracingEnabled; /* flag for enabling trace */ global_stats_t statistics; /* global statistics */ -#ifdef __SMP__ +#ifdef CONFIG_SMP spinlock_t lock; /* Support for SMP Locking */ #endif void* mbox; /* -> mailbox */ diff --git a/include/linux/x25.h b/include/linux/x25.h index 6f3f300b0..49bb2a4b3 100644 --- a/include/linux/x25.h +++ b/include/linux/x25.h @@ -1,5 +1,9 @@ /* * These are the public elements of the Linux kernel X.25 implementation. + * + * History + * mar/20/00 Daniela Squassoni Disabling/enabling of facilities + * negotiation. */ #ifndef X25_KERNEL_H @@ -49,12 +53,27 @@ struct sockaddr_x25 { /* * DTE/DCE subscription options. + * + * As this is missing lots of options, user should expect major + * changes of this structure in 2.5.x which might break compatibilty. + * The somewhat ugly dimension 200-sizeof() is needed to maintain + * backward compatibility. */ struct x25_subscrip_struct { - char device[200]; + char device[200-sizeof(unsigned long)]; + unsigned long global_facil_mask; /* 0 to disable negotiation */ unsigned int extended; }; +/* values for above global_facil_mask */ + +#define X25_MASK_REVERSE 0x01 +#define X25_MASK_THROUGHPUT 0x02 +#define X25_MASK_PACKET_SIZE 0x04 +#define X25_MASK_WINDOW_SIZE 0x08 + + + /* * Routing table control structure. */ diff --git a/include/net/af_unix.h b/include/net/af_unix.h index f8603212a..818df92a3 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h @@ -1,7 +1,6 @@ #ifndef __LINUX_NET_AFUNIX_H #define __LINUX_NET_AFUNIX_H extern void unix_proto_init(struct net_proto *pro); -extern struct proto_ops unix_proto_ops; extern void unix_inflight(struct file *fp); extern void unix_notinflight(struct file *fp); typedef struct sock unix_socket; diff --git a/include/net/dn.h b/include/net/dn.h index f8d48def6..c1d4854de 100644 --- a/include/net/dn.h +++ b/include/net/dn.h @@ -180,7 +180,7 @@ static __inline__ void dn_dn2eth(unsigned char *ethaddr, dn_address addr) extern struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr); extern struct sock *dn_find_by_skb(struct sk_buff *skb); -#define DN_ASCBUF_LEN 7 +#define DN_ASCBUF_LEN 9 extern char *dn_addr2asc(dn_address, char *); extern int dn_destroy_timer(struct sock *sk); diff --git a/include/net/sock.h b/include/net/sock.h index 9b7720969..afeb31bea 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -356,7 +356,10 @@ struct tcp_opt { */ rwlock_t syn_wait_lock; struct tcp_listen_opt *listen_opt; - struct open_request *accept_queue; /* Established children */ + + /* FIFO of established children */ + struct open_request *accept_queue; + struct open_request *accept_queue_tail; int write_pending; /* A write to socket waits to start. */ @@ -597,7 +600,6 @@ struct sock { /* This part is used for the timeout functions. */ - spinlock_t timer_lock; /* Required until timer in core is repaired */ struct timer_list timer; /* This is the sock cleanup timer. */ struct timeval stamp; @@ -818,7 +820,7 @@ extern int sock_no_sendmsg(struct socket *, struct msghdr *, int, struct scm_cookie *); extern int sock_no_recvmsg(struct socket *, - struct msghdr *, int, + struct msghdr *, int, int, struct scm_cookie *); extern int sock_no_mmap(struct file *file, struct socket *sock, diff --git a/include/net/tcp.h b/include/net/tcp.h index 02b320842..aeae81501 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1383,8 +1383,13 @@ extern __inline__ void tcp_acceptq_queue(struct sock *sk, struct open_request *r req->sk = child; tcp_acceptq_added(sk); - req->dl_next = tp->accept_queue; - tp->accept_queue = req; + if (!tp->accept_queue_tail) { + tp->accept_queue = req; + } else { + tp->accept_queue_tail->dl_next = req; + } + tp->accept_queue_tail = req; + req->dl_next = NULL; } struct tcp_listen_opt @@ -1486,10 +1491,8 @@ static inline void tcp_clear_xmit_timer(struct sock *sk, int what) return; }; - spin_lock_bh(&sk->timer_lock); - if (timer->prev != NULL && del_timer(timer)) + if (timer_pending(timer) && del_timer(timer)) __sock_put(sk); - spin_unlock_bh(&sk->timer_lock); } /* This function does not return reliable answer. Use it only as advice. diff --git a/include/net/x25.h b/include/net/x25.h index 3b28c58ce..66575c464 100644 --- a/include/net/x25.h +++ b/include/net/x25.h @@ -1,7 +1,10 @@ /* * Declarations of X.25 Packet Layer type objects. * - * Jonathan Naylor 17/11/96 + * History + * nov/17/96 Jonathan Naylor Initial version. + * mar/20/00 Daniela Squassoni Disabling/enabling of facilities + * negotiation. */ #ifndef _X25_H @@ -113,6 +116,7 @@ struct x25_neigh { struct sk_buff_head queue; unsigned long t20; struct timer_list t20timer; + unsigned long global_facil_mask; }; typedef struct { @@ -132,6 +136,7 @@ typedef struct { struct x25_causediag causediag; struct x25_facilities facilities; struct x25_calluserdata calluserdata; + unsigned long vc_facil_mask; /* inc_call facilities mask */ } x25_cb; /* af_x25.c */ @@ -159,8 +164,8 @@ extern void x25_establish_link(struct x25_neigh *); extern void x25_terminate_link(struct x25_neigh *); /* x25_facilities.c */ -extern int x25_parse_facilities(struct sk_buff *, struct x25_facilities *); -extern int x25_create_facilities(unsigned char *, struct x25_facilities *); +extern int x25_parse_facilities(struct sk_buff *, struct x25_facilities *, unsigned long *); +extern int x25_create_facilities(unsigned char *, struct x25_facilities *, unsigned long); extern int x25_negotiate_facilities(struct sk_buff *, struct sock *, struct x25_facilities *); extern void x25_limit_facilities(struct x25_facilities *, struct x25_neigh *); diff --git a/include/video/fbcon.h b/include/video/fbcon.h index 7ceb380ab..796b8f96b 100644 --- a/include/video/fbcon.h +++ b/include/video/fbcon.h @@ -192,6 +192,43 @@ extern int set_all_vcs(int fbidx, struct fb_ops *fb, #define SCROLL_YNOPARTIAL __SCROLL_YNOPARTIAL +#if defined(__sparc__) + +/* We map all of our framebuffers such that big-endian accesses + * are what we want, so the following is sufficient. + */ + +#define fb_readb sbus_readb +#define fb_readw sbus_readw +#define fb_readl sbus_readl +#define fb_writeb sbus_writeb +#define fb_writew sbus_writew +#define fb_writel sbus_writel +#define fb_memset sbus_memset_io + +#elif defined(__i386__) || defined(__alpha__) + +#define fb_readb __raw_readb +#define fb_readw __raw_readw +#define fb_readl __raw_readl +#define fb_writeb __raw_writeb +#define fb_writew __raw_writew +#define fb_writel __raw_writel +#define fb_memset memset_io + +#else + +#define fb_readb(addr) (*(volatile u8 *) (addr)) +#define fb_readw(addr) (*(volatile u16 *) (addr)) +#define fb_readl(addr) (*(volatile u32 *) (addr)) +#define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b)) +#define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b)) +#define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b)) +#define fb_memset memset + +#endif + + extern void fbcon_redraw_bmove(struct display *, int, int, int, int, int, int); @@ -489,17 +526,68 @@ static __inline__ void *fb_memmove(char *dst, const char *src, size_t size) static __inline__ void *fb_memclear_small(void *s, size_t count) { - return(memset(s, 0, count)); + char *xs = (char *) s; + + while (count--) + fb_writeb(0, xs++); + + return s; } static __inline__ void *fb_memclear(void *s, size_t count) { - return(memset(s, 0, count)); + unsigned long xs = (unsigned long) s; + + if (count < 8) + goto rest; + + if (xs & 1) { + fb_writeb(0, xs++); + count--; + } + if (xs & 2) { + fb_writew(0, xs); + xs += 2; + count -= 2; + } + while (count > 3) { + fb_writel(0, xs); + xs += 4; + count -= 4; + } +rest: + while (count--) + fb_writeb(0, xs++); + + return s; } static __inline__ void *fb_memset255(void *s, size_t count) { - return(memset(s, 255, count)); + unsigned long xs = (unsigned long) s; + + if (count < 8) + goto rest; + + if (xs & 1) { + fb_writeb(0xff, xs++); + count--; + } + if (xs & 2) { + fb_writew(0xffff, xs); + xs += 2; + count -= 2; + } + while (count > 3) { + fb_writel(0xffffffff, xs); + xs += 4; + count -= 4; + } +rest: + while (count--) + fb_writeb(0xff, xs++); + + return s; } #if defined(__i386__) @@ -553,7 +641,7 @@ static __inline__ void *fb_memmove(char *dst, const char *src, size_t size) return dst; } -#else /* !i386 */ +#else /* !__i386__ */ /* * Anyone who'd like to write asm functions for other CPUs? @@ -562,53 +650,130 @@ static __inline__ void *fb_memmove(char *dst, const char *src, size_t size) static __inline__ void *fb_memmove(void *d, const void *s, size_t count) { - return(memmove(d, s, count)); -} - -static __inline__ void fast_memmove(char *dst, const char *src, size_t size) -{ - memmove(dst, src, size); -} - -#endif /* !i386 */ - -#endif - - -#if defined(__sparc__) + unsigned long dst, src; -/* We map all of our framebuffers such that big-endian accesses - * are what we want, so the following is sufficient. - */ - -#define fb_readb sbus_readb -#define fb_readw sbus_readw -#define fb_readl sbus_readl -#define fb_writeb sbus_writeb -#define fb_writew sbus_writew -#define fb_writel sbus_writel -#define fb_memset sbus_memset_io + if (d < s) { + dst = (unsigned long) d; + src = (unsigned long) s; + + if ((count < 8) || ((dst ^ src) & 3)) + goto restup; + + if (dst & 1) { + fb_writeb(fb_readb(src++), dst++); + count--; + } + if (dst & 2) { + fb_writew(fb_readw(src), dst); + src += 2; + dst += 2; + count -= 2; + } + while (count > 3) { + fb_writel(fb_readl(src), dst); + src += 4; + dst += 4; + count -= 4; + } + + restup: + while (count--) + fb_writeb(fb_readb(src++), dst++); + } else { + dst = (unsigned long) d + count - 1; + src = (unsigned long) s + count - 1; + + if ((count < 8) || ((dst ^ src) & 3)) + goto restdown; + + if (dst & 1) { + fb_writeb(fb_readb(src--), dst--); + count--; + } + if (dst & 2) { + fb_writew(fb_readw(src), dst); + src -= 2; + dst -= 2; + count -= 2; + } + while (count > 3) { + fb_writel(fb_readl(src), dst); + src -= 4; + dst -= 4; + count -= 4; + } + + restdown: + while (count--) + fb_writeb(fb_readb(src--), dst--); + } -#elif defined(__i386__) || defined(__alpha__) + return d; +} -#define fb_readb __raw_readb -#define fb_readw __raw_readw -#define fb_readl __raw_readl -#define fb_writeb __raw_writeb -#define fb_writew __raw_writew -#define fb_writel __raw_writel -#define fb_memset memset_io +static __inline__ void fast_memmove(char *d, const char *s, size_t count) +{ + unsigned long dst, src; -#else + if (d < s) { + dst = (unsigned long) d; + src = (unsigned long) s; + + if ((count < 8) || ((dst ^ src) & 3)) + goto restup; + + if (dst & 1) { + fb_writeb(fb_readb(src++), dst++); + count--; + } + if (dst & 2) { + fb_writew(fb_readw(src), dst); + src += 2; + dst += 2; + count -= 2; + } + while (count > 3) { + fb_writel(fb_readl(src), dst); + src += 4; + dst += 4; + count -= 4; + } + + restup: + while (count--) + fb_writeb(fb_readb(src++), dst++); + } else { + dst = (unsigned long) d + count - 1; + src = (unsigned long) s + count - 1; + + if ((count < 8) || ((dst ^ src) & 3)) + goto restdown; + + if (dst & 1) { + fb_writeb(fb_readb(src--), dst--); + count--; + } + if (dst & 2) { + fb_writew(fb_readw(src), dst); + src -= 2; + dst -= 2; + count -= 2; + } + while (count > 3) { + fb_writel(fb_readl(src), dst); + src -= 4; + dst -= 4; + count -= 4; + } + + restdown: + while (count--) + fb_writeb(fb_readb(src--), dst--); + } +} -#define fb_readb(addr) (*(volatile u8 *) (addr)) -#define fb_readw(addr) (*(volatile u16 *) (addr)) -#define fb_readl(addr) (*(volatile u32 *) (addr)) -#define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b)) -#define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b)) -#define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b)) -#define fb_memset memset +#endif /* !__i386__ */ -#endif +#endif /* !__mc68000__ */ #endif /* _VIDEO_FBCON_H */ |