diff options
Diffstat (limited to 'include')
252 files changed, 7581 insertions, 3606 deletions
diff --git a/include/asm-alpha/cache.h b/include/asm-alpha/cache.h index b7662d726..5e46073a8 100644 --- a/include/asm-alpha/cache.h +++ b/include/asm-alpha/cache.h @@ -10,6 +10,4 @@ #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) #define SMP_CACHE_BYTES L1_CACHE_BYTES -#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES))) - #endif diff --git a/include/asm-alpha/core_irongate.h b/include/asm-alpha/core_irongate.h new file mode 100644 index 000000000..be1964f8d --- /dev/null +++ b/include/asm-alpha/core_irongate.h @@ -0,0 +1,563 @@ +#ifndef __ALPHA_IRONGATE__H__ +#define __ALPHA_IRONGATE__H__ + +#include <linux/types.h> +#include <asm/compiler.h> + +/* + * IRONGATE is the internal name for the AMD-751 K7 core logic chipset + * which provides memory controller and PCI access for NAUTILUS-based + * EV6 (21264) systems. + * + * This file is based on: + * + * IronGate management library, (c) 1999 Alpha Processor, Inc. + * Begun 19 January 1999 by Stig Telfer, Alpha Processor, Inc. + */ + +/* + * The 21264 supports, and internally recognizes, a 44-bit physical + * address space that is divided equally between memory address space + * and I/O address space. Memory address space resides in the lower + * half of the physical address space (PA[43]=0) and I/O address space + * resides in the upper half of the physical address space (PA[43]=1). + * + */ + +/* Eh? Not offset from memory? */ +#define IRONGATE_DMA_WIN_BASE (0U) +#define IRONGATE_DMA_WIN_SIZE (0U) + +/* + * Irongate CSR map. Some of the CSRs are 8 or 16 bits, but all access + * through the routines given is 32-bit. + * + * The first 0x40 bytes are standard as per the PCI spec. + */ + +typedef volatile __u32 igcsr32; + +typedef struct { + igcsr32 dev_vendor; /* 0x00 - device ID, vendor ID */ + igcsr32 stat_cmd; /* 0x04 - status, command */ + igcsr32 class; /* 0x08 - class code, rev ID */ + igcsr32 latency; /* 0x0C - header type, PCI latency */ + igcsr32 bar0; /* 0x10 - BAR0 - AGP */ + igcsr32 bar1; /* 0x14 - BAR1 - GART */ + igcsr32 bar2; /* 0x18 - Power Management reg block */ + + igcsr32 rsrvd0[6]; /* 0x1C-0x33 reserved */ + + igcsr32 capptr; /* 0x34 - Capabilities pointer */ + + igcsr32 rsrvd1[2]; /* 0x38-0x3F reserved */ + + igcsr32 bacsr10; /* 0x40 - base address chip selects */ + igcsr32 bacsr32; /* 0x44 - base address chip selects */ + igcsr32 bacsr54; /* 0x48 - base address chip selects */ + + igcsr32 rsrvd2[1]; /* 0x4C-0x4F reserved */ + + igcsr32 drammap; /* 0x50 - address mapping control */ + igcsr32 dramtm; /* 0x54 - timing, driver strength */ + igcsr32 dramms; /* 0x58 - ECC, mode/status */ + + igcsr32 rsrvd3[1]; /* 0x5C-0x5F reserved */ + + igcsr32 biu0; /* 0x60 - bus interface unit */ + igcsr32 biusip; /* 0x64 - Serial initialisation pkt */ + + igcsr32 rsrvd4[2]; /* 0x68-0x6F reserved */ + + igcsr32 mro; /* 0x70 - memory request optimiser */ + + igcsr32 rsrvd5[3]; /* 0x74-0x7F reserved */ + + igcsr32 whami; /* 0x80 - who am I */ + igcsr32 pciarb; /* 0x84 - PCI arbitration control */ + igcsr32 pcicfg; /* 0x88 - PCI config status */ + + igcsr32 rsrvd6[5]; /* 0x8C-0x9F reserved */ + + /* AGP (bus 1) control registers */ + igcsr32 agpcap; /* 0xA0 - AGP Capability Identifier */ + igcsr32 agpstat; /* 0xA4 - AGP status register */ + igcsr32 agpcmd; /* 0xA8 - AGP control register */ + igcsr32 agpva; /* 0xAC - AGP Virtual Address Space */ + igcsr32 agpmode; /* 0xB0 - AGP/GART mode control */ +} Irongate0; + +/* Bitfield and mask register definitions */ + +/* Device, vendor IDs - offset 0x00 */ + +typedef union { + igcsr32 i; /* integer value of CSR */ + struct { + unsigned v : 16; + unsigned d : 16; + } r; /* structured interpretation */ +} ig_dev_vendor_t; + + +/* Status, command registers - offset 0x04 */ + +typedef union { + igcsr32 i; + struct { + unsigned command; + unsigned status; + } s; + struct { + /* command register fields */ + unsigned iospc : 1; /* always reads zero */ + unsigned memspc : 1; /* PCI memory space accesses? */ + unsigned iten : 1; /* always 1: can be bus initiator */ + unsigned scmon : 1; /* always 0 special cycles not chckd */ + unsigned mwic : 1; /* always 0 - no mem write & invalid */ + unsigned vgaps : 1; /* always 0 - palette rds not special */ + unsigned per : 1; /* parity error resp: always 0 */ + unsigned step : 1; /* address/data stepping : always 0 */ + unsigned serre : 1; /* 1 = sys err output driver enable */ + unsigned fbbce : 1; /* fast back-back cycle : always 0 */ + unsigned zero1 : 6; /* must be zero */ + + /* status register fields */ + unsigned zero2 : 4; /* must be zero */ + unsigned cl : 1; /* config space capa list: always 1 */ + unsigned pci66 : 1; /* 66 MHz PCI support - always 0 */ + unsigned udf : 1; /* user defined features - always 0 */ + unsigned fbbc : 1; /* back-back transactions - always 0 */ + unsigned ppe : 1; /* PCI parity error detected (0) */ + unsigned devsel : 2; /* DEVSEL timing (always 01) */ + unsigned sta : 1; /* signalled target abort (0) */ + unsigned rta : 1; /* recvd target abort */ + unsigned ria : 1; /* recvd initiator abort */ + unsigned serr : 1; /* SERR has been asserted */ + unsigned dpe : 1; /* DRAM parity error (0) */ + } r; +} ig_stat_cmd_t; + + +/* Revision ID, Programming interface, subclass, baseclass - offset 0x08 */ + +typedef union { + igcsr32 i; + struct { + /* revision ID */ + unsigned step : 4; /* stepping Revision ID */ + unsigned die : 4; /* die Revision ID */ + unsigned pif : 8; /* programming interface (0x00) */ + unsigned sub : 8; /* subclass code (0x00) */ + unsigned base: 8; /* baseclass code (0x06) */ + } r; +} ig_class_t; + + +/* Latency Timer, PCI Header type - offset 0x0C */ + +typedef union { + igcsr32 i; + struct { + unsigned zero1:8; /* reserved */ + unsigned lat : 8; /* latency in PCI bus clocks */ + unsigned hdr : 8; /* PCI header type */ + unsigned zero2:8; /* reserved */ + } r; +} ig_latency_t; + + +/* Base Address Register 0 - offset 0x10 */ + +typedef union { + igcsr32 i; + struct { + unsigned mem : 1; /* Reg pts to memory (always 0) */ + unsigned type: 2; /* 32 bit register = 0b00 */ + unsigned pref: 1; /* graphics mem prefetchable=1 */ + unsigned baddrl : 21; /* 32M = minimum alloc -> all zero */ + unsigned size : 6; /* size requirements for AGP */ + unsigned zero : 1; /* reserved=0 */ + } r; +} ig_bar0_t; + + +/* Base Address Register 1 - offset 0x14 */ + +typedef union { + igcsr32 i; + struct { + unsigned mem : 1; /* BAR0 maps to memory -> 0 */ + unsigned type : 2; /* BAR1 is 32-bit -> 0b00 */ + unsigned pref : 1; /* graphics mem prefetchable=1 */ + unsigned baddrl : 8; /* 4K alloc for AGP CSRs -> 0b00 */ + unsigned baddrh : 20; /* base addr of AGP CSRs A[30:11] */ + } r; +} ig_bar1_t; + + +/* Base Address Register 2 - offset 0x18 */ + +typedef union { + igcsr32 i; + struct { + unsigned io : 1; /* BAR2 maps to I/O space -> 1 */ + unsigned zero1: 1; /* reserved */ + unsigned addr : 22; /* BAR2[31:10] - PM2_BLK base */ + unsigned zero2: 8; /* reserved */ + } r; +} ig_bar2_t; + + +/* Capabilities Pointer - offset 0x34 */ + +typedef union { + igcsr32 i; + struct { + unsigned cap : 8; /* =0xA0, offset of AGP ctrl regs */ + unsigned zero: 24; /* reserved */ + } r; +} ig_capptr_t; + + +/* Base Address Chip Select Register 1,0 - offset 0x40 */ +/* Base Address Chip Select Register 3,2 - offset 0x44 */ +/* Base Address Chip Select Register 5,4 - offset 0x48 */ + +typedef union { + + igcsr32 i; + struct { + /* lower bank */ + unsigned en0 : 1; /* memory bank enabled */ + unsigned mask0 : 6; /* Address mask for A[28:23] */ + unsigned base0 : 9; /* Bank Base Address A[31:23] */ + + /* upper bank */ + unsigned en1 : 1; /* memory bank enabled */ + unsigned mask1 : 6; /* Address mask for A[28:23] */ + unsigned base1 : 9; /* Bank Base Address A[31:23] */ + } r; +} ig_bacsr_t, ig_bacsr10_t, ig_bacsr32_t, ig_bacsr54_t; + + +/* SDRAM Address Mapping Control Register - offset 0x50 */ + +typedef union { + igcsr32 i; + struct { + unsigned z1 : 1; /* reserved */ + unsigned bnks0: 1; /* 0->2 banks in chip select 0 */ + unsigned am0 : 1; /* row/column addressing */ + unsigned z2 : 1; /* reserved */ + + unsigned z3 : 1; /* reserved */ + unsigned bnks1: 1; /* 0->2 banks in chip select 1 */ + unsigned am1 : 1; /* row/column addressing */ + unsigned z4 : 1; /* reserved */ + + unsigned z5 : 1; /* reserved */ + unsigned bnks2: 1; /* 0->2 banks in chip select 2 */ + unsigned am2 : 1; /* row/column addressing */ + unsigned z6 : 1; /* reserved */ + + unsigned z7 : 1; /* reserved */ + unsigned bnks3: 1; /* 0->2 banks in chip select 3 */ + unsigned am3 : 1; /* row/column addressing */ + unsigned z8 : 1; /* reserved */ + + unsigned z9 : 1; /* reserved */ + unsigned bnks4: 1; /* 0->2 banks in chip select 4 */ + unsigned am4 : 1; /* row/column addressing */ + unsigned z10 : 1; /* reserved */ + + unsigned z11 : 1; /* reserved */ + unsigned bnks5: 1; /* 0->2 banks in chip select 5 */ + unsigned am5 : 1; /* row/column addressing */ + unsigned z12 : 1; /* reserved */ + + unsigned rsrvd: 8; /* reserved */ + } r; +} ig_drammap_t; + + +/* DRAM timing and driver strength register - offset 0x54 */ + +typedef union { + igcsr32 i; + struct { + /* DRAM timing parameters */ + unsigned trcd : 2; + unsigned tcl : 2; + unsigned tras: 3; + unsigned trp : 2; + unsigned trc : 3; + unsigned icl: 2; + unsigned ph : 2; + + /* Chipselect driver strength */ + unsigned adra : 1; + unsigned adrb : 1; + unsigned ctrl : 3; + unsigned dqm : 1; + unsigned cs : 1; + unsigned clk: 1; + unsigned rsrvd:8; + } r; +} ig_dramtm_t; + + +/* DRAM Mode / Status and ECC Register - offset 0x58 */ + +typedef union { + igcsr32 i; + struct { + unsigned chipsel : 6; /* failing ECC chip select */ + unsigned zero1 : 2; /* always reads zero */ + unsigned status : 2; /* ECC Detect logic status */ + unsigned zero2 : 6; /* always reads zero */ + + unsigned cycles : 2; /* cycles per refresh, see table */ + unsigned en : 1; /* ECC enable */ + unsigned r : 1; /* Large burst enable (=0) */ + unsigned bre : 1; /* Burst refresh enable */ + unsigned zero3 : 2; /* reserved = 0 */ + unsigned mwe : 1; /* Enable writes to DRAM mode reg */ + unsigned type : 1; /* SDRAM = 0, default */ + unsigned sdraminit : 1; /* SDRAM init - set params first! */ + unsigned zero4 : 6; /* reserved = 0 */ + } r; +} ig_dramms_t; + + +/* + * Memory spaces: + */ + +/* ??? the following probably needs fixing */ +/* Irongate is consistent with a subset of the Tsunami memory map */ +/* XXX: Do we need to conditionalize on this? */ +#ifdef USE_48_BIT_KSEG +#define IRONGATE_BIAS 0x80000000000UL +#else +#define IRONGATE_BIAS 0x10000000000UL +#endif + + +#define IRONGATE_MEM (IDENT_ADDR | IRONGATE_BIAS | 0x000000000UL) +#define IRONGATE_IACK_SC (IDENT_ADDR | IRONGATE_BIAS | 0x1F8000000UL) +#define IRONGATE_IO (IDENT_ADDR | IRONGATE_BIAS | 0x1FC000000UL) +#define IRONGATE_CONF (IDENT_ADDR | IRONGATE_BIAS | 0x1FE000000UL) + + +#define IRONGATE0 ((Irongate0 *) IRONGATE_CONF) + +/* + * Data structure for handling IRONGATE machine checks: + * This is the standard OSF logout frame + */ + +#define SCB_Q_SYSERR 0x620 /* OSF definitions */ +#define SCB_Q_PROCERR 0x630 +#define SCB_Q_SYSMCHK 0x660 +#define SCB_Q_PROCMCHK 0x670 + +struct el_IRONGATE_sysdata_mcheck { + __u32 FrameSize; /* Bytes, including this field */ + __u32 FrameFlags; /* <31> = Retry, <30> = Second Error */ + __u32 CpuOffset; /* Offset to CPU-specific into */ + __u32 SystemOffset; /* Offset to system-specific info */ + __u32 MCHK_Code; + __u32 MCHK_Frame_Rev; + __u64 I_STAT; + __u64 DC_STAT; + __u64 C_ADDR; + __u64 DC1_SYNDROME; + __u64 DC0_SYNDROME; + __u64 C_STAT; + __u64 C_STS; + __u64 RESERVED0; + __u64 EXC_ADDR; + __u64 IER_CM; + __u64 ISUM; + __u64 MM_STAT; + __u64 PAL_BASE; + __u64 I_CTL; + __u64 PCTX; +}; + + +#ifdef __KERNEL__ + +#ifndef __EXTERN_INLINE +#define __EXTERN_INLINE extern inline +#define __IO_EXTERN_INLINE +#endif + +/* + * Translate physical memory address as seen on (PCI) bus into + * a kernel virtual address and vv. + */ + +__EXTERN_INLINE unsigned long irongate_virt_to_bus(void * address) +{ + return virt_to_phys(address) + IRONGATE_DMA_WIN_BASE; +} + +__EXTERN_INLINE void * irongate_bus_to_virt(unsigned long address) +{ + return phys_to_virt(address - IRONGATE_DMA_WIN_BASE); +} + +/* + * I/O functions: + * + * IRONGATE (AMD-751) PCI/memory support chip for the EV6 (21264) and + * K7 can only use linear accesses to get at PCI memory and I/O spaces. + */ + +#define vucp volatile unsigned char * +#define vusp volatile unsigned short * +#define vuip volatile unsigned int * +#define vulp volatile unsigned long * + +__EXTERN_INLINE unsigned int irongate_inb(unsigned long addr) +{ + return __kernel_ldbu(*(vucp)(addr + IRONGATE_IO)); +} + +__EXTERN_INLINE void irongate_outb(unsigned char b, unsigned long addr) +{ + __kernel_stb(b, *(vucp)(addr + IRONGATE_IO)); + mb(); +} + +__EXTERN_INLINE unsigned int irongate_inw(unsigned long addr) +{ + return __kernel_ldwu(*(vusp)(addr + IRONGATE_IO)); +} + +__EXTERN_INLINE void irongate_outw(unsigned short b, unsigned long addr) +{ + __kernel_stw(b, *(vusp)(addr + IRONGATE_IO)); + mb(); +} + +__EXTERN_INLINE unsigned int irongate_inl(unsigned long addr) +{ + return *(vuip)(addr + IRONGATE_IO); +} + +__EXTERN_INLINE void irongate_outl(unsigned int b, unsigned long addr) +{ + *(vuip)(addr + IRONGATE_IO) = b; + mb(); +} + +/* + * Memory functions. All accesses are done through linear space. + */ + +__EXTERN_INLINE unsigned long irongate_readb(unsigned long addr) +{ + return __kernel_ldbu(*(vucp)addr); +} + +__EXTERN_INLINE unsigned long irongate_readw(unsigned long addr) +{ + return __kernel_ldwu(*(vusp)addr); +} + +__EXTERN_INLINE unsigned long irongate_readl(unsigned long addr) +{ + return *(vuip)addr; +} + +__EXTERN_INLINE unsigned long irongate_readq(unsigned long addr) +{ + return *(vulp)addr; +} + +__EXTERN_INLINE void irongate_writeb(unsigned char b, unsigned long addr) +{ + __kernel_stb(b, *(vucp)addr); +} + +__EXTERN_INLINE void irongate_writew(unsigned short b, unsigned long addr) +{ + __kernel_stw(b, *(vusp)addr); +} + +__EXTERN_INLINE void irongate_writel(unsigned int b, unsigned long addr) +{ + *(vuip)addr = b; +} + +__EXTERN_INLINE void irongate_writeq(unsigned long b, unsigned long addr) +{ + *(vulp)addr = b; +} + +__EXTERN_INLINE unsigned long irongate_ioremap(unsigned long addr) +{ + return addr + IRONGATE_MEM; +} + +__EXTERN_INLINE int irongate_is_ioaddr(unsigned long addr) +{ + return addr >= IRONGATE_MEM; +} + +#undef vucp +#undef vusp +#undef vuip +#undef vulp + +#ifdef __WANT_IO_DEF + +#define virt_to_bus irongate_virt_to_bus +#define bus_to_virt irongate_bus_to_virt + +#define __inb irongate_inb +#define __inw irongate_inw +#define __inl irongate_inl +#define __outb irongate_outb +#define __outw irongate_outw +#define __outl irongate_outl +#define __readb irongate_readb +#define __readw irongate_readw +#define __writeb irongate_writeb +#define __writew irongate_writew +#define __readl irongate_readl +#define __readq irongate_readq +#define __writel irongate_writel +#define __writeq irongate_writeq +#define __ioremap irongate_ioremap +#define __is_ioaddr irongate_is_ioaddr + +#define inb(port) __inb((port)) +#define inw(port) __inw((port)) +#define inl(port) __inl((port)) +#define outb(v, port) __outb((v),(port)) +#define outw(v, port) __outw((v),(port)) +#define outl(v, port) __outl((v),(port)) + +#define __raw_readb(a) __readb((unsigned long)(a)) +#define __raw_readw(a) __readw((unsigned long)(a)) +#define __raw_readl(a) __readl((unsigned long)(a)) +#define __raw_readq(a) __readq((unsigned long)(a)) +#define __raw_writeb(v,a) __writeb((v),(unsigned long)(a)) +#define __raw_writew(v,a) __writew((v),(unsigned long)(a)) +#define __raw_writel(v,a) __writel((v),(unsigned long)(a)) +#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a)) + +#endif /* __WANT_IO_DEF */ + +#ifdef __IO_EXTERN_INLINE +#undef __EXTERN_INLINE +#undef __IO_EXTERN_INLINE +#endif + +#endif /* __KERNEL__ */ + +#endif /* __ALPHA_IRONGATE__H__ */ diff --git a/include/asm-alpha/core_tsunami.h b/include/asm-alpha/core_tsunami.h index 14bc80e2d..5bfa4d658 100644 --- a/include/asm-alpha/core_tsunami.h +++ b/include/asm-alpha/core_tsunami.h @@ -291,6 +291,8 @@ union TPchipPERRMASK { #define TSUNAMI_IO_BIAS TSUNAMI_IO(0) #define TSUNAMI_MEM_BIAS TSUNAMI_MEM(0) +/* The IO address space is larger than 0xffff */ +#define TSUNAMI_IO_SPACE (TSUNAMI_CONF(0) - TSUNAMI_IO(0)) /* * Data structure for handling TSUNAMI machine checks: diff --git a/include/asm-alpha/div64.h b/include/asm-alpha/div64.h index 6260adb75..080dcd480 100644 --- a/include/asm-alpha/div64.h +++ b/include/asm-alpha/div64.h @@ -7,8 +7,8 @@ */ #define do_div(n,base) ({ \ int __res; \ - __res = ((unsigned long) n) % (unsigned) base; \ - n = ((unsigned long) n) / (unsigned) base; \ + __res = ((unsigned long) (n)) % (unsigned) (base); \ + (n) = ((unsigned long) (n)) / (unsigned) (base); \ __res; }) #endif diff --git a/include/asm-alpha/dma.h b/include/asm-alpha/dma.h index 28762e674..e6d667144 100644 --- a/include/asm-alpha/dma.h +++ b/include/asm-alpha/dma.h @@ -91,6 +91,7 @@ */ #define ALPHA_XL_MAX_DMA_ADDRESS (IDENT_ADDR+0x3000000UL) #define ALPHA_RUFFIAN_MAX_DMA_ADDRESS (IDENT_ADDR+0x1000000UL) +#define ALPHA_NAUTILUS_MAX_DMA_ADDRESS (IDENT_ADDR+0x1000000UL) #define ALPHA_MAX_DMA_ADDRESS (~0UL) #ifdef CONFIG_ALPHA_GENERIC @@ -100,6 +101,8 @@ # define MAX_DMA_ADDRESS ALPHA_XL_MAX_DMA_ADDRESS # elif defined(CONFIG_ALPHA_RUFFIAN) # define MAX_DMA_ADDRESS ALPHA_RUFFIAN_MAX_DMA_ADDRESS +# elif defined(CONFIG_ALPHA_NAUTILUS) +# define MAX_DMA_ADDRESS ALPHA_NAUTILUS_MAX_DMA_ADDRESS # else # define MAX_DMA_ADDRESS ALPHA_MAX_DMA_ADDRESS # endif diff --git a/include/asm-alpha/floppy.h b/include/asm-alpha/floppy.h index 8203920b9..a08aa973c 100644 --- a/include/asm-alpha/floppy.h +++ b/include/asm-alpha/floppy.h @@ -64,7 +64,7 @@ static int FDC2 = -1; #ifdef CONFIG_ALPHA_GENERIC # define CROSS_64KB(a,s) (__CROSS_64KB(a,s) && ~alpha_mv.max_dma_address) #else -# if defined(CONFIG_ALPHA_XL) || defined(CONFIG_ALPHA_RUFFIAN) +# if defined(CONFIG_ALPHA_XL) || defined(CONFIG_ALPHA_RUFFIAN) || defined(CONFIG_ALPHA_NAUTILUS) # define CROSS_64KB(a,s) __CROSS_64KB(a,s) # else # define CROSS_64KB(a,s) (0) diff --git a/include/asm-alpha/fpu.h b/include/asm-alpha/fpu.h index 5e56e7db2..118941b3c 100644 --- a/include/asm-alpha/fpu.h +++ b/include/asm-alpha/fpu.h @@ -4,6 +4,8 @@ /* * Alpha floating-point control register defines: */ +#define FPCR_DNOD (1UL<<47) /* denorm INV trap disable */ +#define FPCR_DNZ (1UL<<48) /* denorms to zero */ #define FPCR_INVD (1UL<<49) /* invalid op disable (opt.) */ #define FPCR_DZED (1UL<<50) /* division by zero disable (opt.) */ #define FPCR_OVFD (1UL<<51) /* overflow disable (optional) */ @@ -42,9 +44,16 @@ #define IEEE_TRAP_ENABLE_OVF (1UL<<3) /* overflow */ #define IEEE_TRAP_ENABLE_UNF (1UL<<4) /* underflow */ #define IEEE_TRAP_ENABLE_INE (1UL<<5) /* inexact */ +#define IEEE_TRAP_ENABLE_DNO (1UL<<6) /* denorm */ #define IEEE_TRAP_ENABLE_MASK (IEEE_TRAP_ENABLE_INV | IEEE_TRAP_ENABLE_DZE |\ IEEE_TRAP_ENABLE_OVF | IEEE_TRAP_ENABLE_UNF |\ - IEEE_TRAP_ENABLE_INE) + IEEE_TRAP_ENABLE_INE | IEEE_TRAP_ENABLE_DNO) + +/* Denorm and Underflow flushing */ +#define IEEE_MAP_DMZ (1UL<<12) /* Map denorm inputs to zero */ +#define IEEE_MAP_UMZ (1UL<<13) /* Map underflowed outputs to zero */ + +#define IEEE_MAP_MASK (IEEE_MAP_DMZ | IEEE_MAP_UMZ) /* status bits coming from fpcr: */ #define IEEE_STATUS_INV (1UL<<17) @@ -52,12 +61,16 @@ #define IEEE_STATUS_OVF (1UL<<19) #define IEEE_STATUS_UNF (1UL<<20) #define IEEE_STATUS_INE (1UL<<21) +#define IEEE_STATUS_DNO (1UL<<22) #define IEEE_STATUS_MASK (IEEE_STATUS_INV | IEEE_STATUS_DZE | \ IEEE_STATUS_OVF | IEEE_STATUS_UNF | \ - IEEE_STATUS_INE) + IEEE_STATUS_INE | IEEE_STATUS_DNO) + +#define IEEE_SW_MASK (IEEE_TRAP_ENABLE_MASK | IEEE_STATUS_MASK | IEEE_MAP_MASK) -#define IEEE_SW_MASK (IEEE_TRAP_ENABLE_MASK | IEEE_STATUS_MASK) +#define IEEE_CURRENT_RM_SHIFT 32 +#define IEEE_CURRENT_RM_MASK (3UL<<IEEE_CURRENT_RM_SHIFT) #define IEEE_STATUS_TO_EXCSUM_SHIFT 16 @@ -78,6 +91,7 @@ ieee_swcr_to_fpcr(unsigned long sw) | IEEE_TRAP_ENABLE_DZE | IEEE_TRAP_ENABLE_OVF)) << 48; fp |= (~sw & (IEEE_TRAP_ENABLE_UNF | IEEE_TRAP_ENABLE_INE)) << 57; + fp |= (~sw & IEEE_TRAP_ENABLE_DNO) << 41; return fp; } @@ -90,6 +104,7 @@ ieee_fpcr_to_swcr(unsigned long fp) | IEEE_TRAP_ENABLE_DZE | IEEE_TRAP_ENABLE_OVF); sw |= (~fp >> 57) & (IEEE_TRAP_ENABLE_UNF | IEEE_TRAP_ENABLE_INE); + sw |= (~fp >> 41) & IEEE_TRAP_ENABLE_DNO; return sw; } @@ -124,6 +139,8 @@ static inline void wrfpcr(unsigned long val) extern unsigned long alpha_read_fp_reg (unsigned long reg); extern void alpha_write_fp_reg (unsigned long reg, unsigned long val); +extern unsigned long alpha_read_fp_reg_s (unsigned long reg); +extern void alpha_write_fp_reg_s (unsigned long reg, unsigned long val); #endif /* __KERNEL__ */ diff --git a/include/asm-alpha/hardirq.h b/include/asm-alpha/hardirq.h index 31cdbac06..67544e13d 100644 --- a/include/asm-alpha/hardirq.h +++ b/include/asm-alpha/hardirq.h @@ -28,8 +28,8 @@ extern int __local_irq_count; #define hardirq_trylock(cpu) (local_irq_count(cpu) == 0) #define hardirq_endlock(cpu) ((void) 0) -#define hardirq_enter(cpu, irq) (local_irq_count(cpu)++) -#define hardirq_exit(cpu, irq) (local_irq_count(cpu)--) +#define irq_enter(cpu, irq) (local_irq_count(cpu)++) +#define irq_exit(cpu, irq) (local_irq_count(cpu)--) #define synchronize_irq() barrier() @@ -52,13 +52,16 @@ static inline void release_irqlock(int cpu) } } -static inline void hardirq_enter(int cpu, int irq) +static inline void irq_enter(int cpu, int irq) { ++local_irq_count(cpu); atomic_inc(&global_irq_count); + + while (spin_is_locked(&global_irq_lock)) + barrier(); } -static inline void hardirq_exit(int cpu, int irq) +static inline void irq_exit(int cpu, int irq) { atomic_dec(&global_irq_count); --local_irq_count(cpu); @@ -66,11 +69,10 @@ static inline void hardirq_exit(int cpu, int irq) static inline int hardirq_trylock(int cpu) { - return (!atomic_read(&global_irq_count) - && !spin_is_locked(&global_irq_lock)); + return !local_irq_count(cpu) && !spin_is_locked(&global_irq_lock); } -#define hardirq_endlock(cpu) ((void)0) +#define hardirq_endlock(cpu) do { } while (0) extern void synchronize_irq(void); diff --git a/include/asm-alpha/hw_irq.h b/include/asm-alpha/hw_irq.h new file mode 100644 index 000000000..c6af57999 --- /dev/null +++ b/include/asm-alpha/hw_irq.h @@ -0,0 +1,91 @@ +#ifndef _ALPHA_HW_IRQ_H +#define _ALPHA_HW_IRQ_H +/* + * linux/arch/alpha/kernel/irq.h + * + * Copyright (C) 1995 Linus Torvalds + * Copyright (C) 1998 Richard Henderson + * + * This file contains declarations and inline functions for interfacing + * with the IRQ handling routines in irq.c. + */ + +#include <linux/config.h> + +#define STANDARD_INIT_IRQ_PROLOG \ + outb(0, DMA1_RESET_REG); \ + outb(0, DMA2_RESET_REG); \ + outb(0, DMA1_CLR_MASK_REG); \ + outb(0, DMA2_CLR_MASK_REG) + +extern unsigned long _alpha_irq_masks[2]; +#define alpha_irq_mask _alpha_irq_masks[0] + +extern void common_ack_irq(unsigned long irq); +extern void isa_device_interrupt(unsigned long vector, struct pt_regs * regs); +extern void srm_device_interrupt(unsigned long vector, struct pt_regs * regs); + +extern void handle_irq(int irq, int ack, struct pt_regs * regs); + +#define RTC_IRQ 8 +#ifdef CONFIG_RTC +#define TIMER_IRQ 0 /* timer is the pit */ +#else +#define TIMER_IRQ RTC_IRQ /* timer is the rtc */ +#endif + +/* + * PROBE_MASK is the bitset of irqs that we consider for autoprobing. + */ + +/* NOTE: we only handle the first 64 IRQs in this code. */ + +/* The normal mask includes all the IRQs except timer IRQ 0. */ +#define _PROBE_MASK(nr_irqs) \ + (((nr_irqs > 63) ? ~0UL : ((1UL << (nr_irqs & 63)) - 1)) & ~1UL) + +/* Mask out unused timer irq 0 and RTC irq 8. */ +#define P2K_PROBE_MASK (_PROBE_MASK(16) & ~0x101UL) + +/* Mask out unused timer irq 0, "irqs" 20-30, and the EISA cascade. */ +#define ALCOR_PROBE_MASK (_PROBE_MASK(48) & ~0xfff000000001UL) + +/* Leave timer IRQ 0 in the mask. */ +#define RUFFIAN_PROBE_MASK (_PROBE_MASK(48) | 1UL) + +/* Do not probe/enable beyond the PCI devices. */ +#define TSUNAMI_PROBE_MASK _PROBE_MASK(48) + +#if defined(CONFIG_ALPHA_GENERIC) +# define PROBE_MASK alpha_mv.irq_probe_mask +#elif defined(CONFIG_ALPHA_P2K) +# define PROBE_MASK P2K_PROBE_MASK +#elif defined(CONFIG_ALPHA_ALCOR) || defined(CONFIG_ALPHA_XLT) +# define PROBE_MASK ALCOR_PROBE_MASK +#elif defined(CONFIG_ALPHA_RUFFIAN) +# define PROBE_MASK RUFFIAN_PROBE_MASK +#elif defined(CONFIG_ALPHA_DP264) +# define PROBE_MASK TSUNAMI_PROBE_MASK +#else +# define PROBE_MASK _PROBE_MASK(NR_IRQS) +#endif + + +extern char _stext; +static inline void alpha_do_profile (unsigned long pc) +{ + if (prof_buffer && current->pid) { + pc -= (unsigned long) &_stext; + pc >>= prof_shift; + /* + * Don't ignore out-of-bounds PC values silently, + * put them into the last histogram slot, so if + * present, they will show up as a sharp peak. + */ + if (pc > prof_len - 1) + pc = prof_len - 1; + atomic_inc((atomic_t *)&prof_buffer[pc]); + } +} + +#endif diff --git a/include/asm-alpha/hwrpb.h b/include/asm-alpha/hwrpb.h index 69823af35..ec710c9c8 100644 --- a/include/asm-alpha/hwrpb.h +++ b/include/asm-alpha/hwrpb.h @@ -55,11 +55,16 @@ #define ST_DEC_TSUNAMI 34 /* Tsunami systype */ #define ST_DEC_WILDFIRE 35 /* Wildfire systype */ #define ST_DEC_CUSCO 36 /* CUSCO systype */ +#define ST_DEC_EIGER 37 /* Eiger systype */ /* UNOFFICIAL!!! */ #define ST_UNOFFICIAL_BIAS 100 #define ST_DTI_RUFFIAN 101 /* RUFFIAN systype */ +/* Alpha Processor, Inc. systems */ +#define ST_API_BIAS 200 /* Offset for API systems */ +#define ST_API_NAUTILUS (ST_API_BIAS + 1) /* Nautilus systype */ + struct pcb_struct { unsigned long ksp; unsigned long usp; diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h index 8505e47c8..e8ed0baa1 100644 --- a/include/asm-alpha/io.h +++ b/include/asm-alpha/io.h @@ -132,20 +132,22 @@ extern void _sethae (unsigned long addr); /* cached version */ # include <asm/core_apecs.h> #elif defined(CONFIG_ALPHA_CIA) # include <asm/core_cia.h> +#elif defined(CONFIG_ALPHA_IRONGATE) +# include <asm/core_irongate.h> +#elif defined(CONFIG_ALPHA_JENSEN) +# include <asm/jensen.h> #elif defined(CONFIG_ALPHA_LCA) # include <asm/core_lca.h> #elif defined(CONFIG_ALPHA_MCPCIA) # include <asm/core_mcpcia.h> +#elif defined(CONFIG_ALPHA_POLARIS) +# include <asm/core_polaris.h> #elif defined(CONFIG_ALPHA_PYXIS) # include <asm/core_pyxis.h> #elif defined(CONFIG_ALPHA_T2) # include <asm/core_t2.h> #elif defined(CONFIG_ALPHA_TSUNAMI) # include <asm/core_tsunami.h> -#elif defined(CONFIG_ALPHA_JENSEN) -# include <asm/jensen.h> -#elif defined(CONFIG_ALPHA_POLARIS) -# include <asm/core_polaris.h> #else #error "What system is this?" #endif @@ -224,6 +226,8 @@ extern void _writeq(unsigned long b, unsigned long addr); # define outl_p outl #endif +#define IO_SPACE_LIMIT 0xffff + #else /* Userspace declarations. */ diff --git a/include/asm-alpha/irq.h b/include/asm-alpha/irq.h index ad1c917a3..f9b4d9f12 100644 --- a/include/asm-alpha/irq.h +++ b/include/asm-alpha/irq.h @@ -16,7 +16,7 @@ many places throughout the kernel to size static arrays. That's ok, we'll use alpha_mv.nr_irqs when we want the real thing. */ -# define NR_IRQS 64 +# define NR_IRQS 128 #elif defined(CONFIG_ALPHA_CABRIOLET) || \ defined(CONFIG_ALPHA_EB66P) || \ @@ -43,45 +43,17 @@ # define NR_IRQS 40 #elif defined(CONFIG_ALPHA_DP264) || \ - defined(CONFIG_ALPHA_RAWHIDE) + defined(CONFIG_ALPHA_EIGER) # define NR_IRQS 64 -#elif defined(CONFIG_ALPHA_TAKARA) -# define NR_IRQS 20 +#elif defined(CONFIG_ALPHA_RAWHIDE) || \ + defined(CONFIG_ALPHA_TAKARA) +# define NR_IRQS 128 #else /* everyone else */ # define NR_IRQS 16 #endif -/* - * PROBE_MASK is the bitset of irqs that we consider for autoprobing. - */ - -/* The normal mask includes all the IRQs except the timer. */ -#define _PROBE_MASK(nr_irqs) (((1UL << (nr_irqs & 63)) - 1) & ~1UL) - -/* Mask out unused timer irq 0 and RTC irq 8. */ -#define P2K_PROBE_MASK (_PROBE_MASK(16) & ~0x101UL) - -/* Mask out unused timer irq 0, "irqs" 20-30, and the EISA cascade. */ -#define ALCOR_PROBE_MASK (_PROBE_MASK(48) & ~0xfff000000001UL) - -/* Leave timer irq 0 in the mask. */ -#define RUFFIAN_PROBE_MASK (_PROBE_MASK(48) | 1UL) - -#if defined(CONFIG_ALPHA_GENERIC) -# define PROBE_MASK alpha_mv.irq_probe_mask -#elif defined(CONFIG_ALPHA_P2K) -# define PROBE_MASK P2K_PROBE_MASK -#elif defined(CONFIG_ALPHA_ALCOR) || defined(CONFIG_ALPHA_XLT) -# define PROBE_MASK ALCOR_PROBE_MASK -#elif defined(CONFIG_ALPHA_RUFFIAN) -# define PROBE_MASK RUFFIAN_PROBE_MASK -#else -# define PROBE_MASK _PROBE_MASK(NR_IRQS) -#endif - - static __inline__ int irq_cannonicalize(int irq) { /* @@ -95,9 +67,6 @@ extern void disable_irq(unsigned int); extern void disable_irq_nosync(unsigned int); extern void enable_irq(unsigned int); -extern void irq_enter(int cpu, int irq); -extern void irq_exit(int cpu, int irq); - struct pt_regs; extern void (*perf_irq)(unsigned long, struct pt_regs *); diff --git a/include/asm-alpha/machvec.h b/include/asm-alpha/machvec.h index 14be8d58b..2c2f82bbd 100644 --- a/include/asm-alpha/machvec.h +++ b/include/asm-alpha/machvec.h @@ -78,11 +78,11 @@ struct alpha_machine_vector void (*device_interrupt)(unsigned long vector, struct pt_regs *regs); void (*machine_check)(u64 vector, u64 la, struct pt_regs *regs); - void (*init_arch)(unsigned long *, unsigned long *); + void (*init_arch)(void); void (*init_irq)(void); void (*init_pit)(void); void (*init_pci)(void); - void (*kill_arch)(int, char *); + void (*kill_arch)(int); u8 (*pci_swizzle)(struct pci_dev *, u8 *); int (*pci_map_irq)(struct pci_dev *, u8, u8); diff --git a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h index 64d550938..18e316751 100644 --- a/include/asm-alpha/mmu_context.h +++ b/include/asm-alpha/mmu_context.h @@ -160,6 +160,8 @@ ev4_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm, long cpu) current->thread.ptbr = ((unsigned long) next_mm->pgd - IDENT_ADDR) >> PAGE_SHIFT; + + __reload_thread(¤t->thread); } __EXTERN_INLINE void diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h index 8011c5859..17c61130a 100644 --- a/include/asm-alpha/page.h +++ b/include/asm-alpha/page.h @@ -19,7 +19,7 @@ * results in clearer kernel profiles as we see _who_ is * doing page clearing or copying. */ -static inline void clear_page(unsigned long page) +static inline void clear_page(void * page) { unsigned long count = PAGE_SIZE/64; unsigned long *ptr = (unsigned long *)page; @@ -38,7 +38,7 @@ static inline void clear_page(unsigned long page) } while (count); } -static inline void copy_page(unsigned long _to, unsigned long _from) +static inline void copy_page(void * _to, void * _from) { unsigned long count = PAGE_SIZE/64; unsigned long *to = (unsigned long *)_to; diff --git a/include/asm-alpha/pgalloc.h b/include/asm-alpha/pgalloc.h new file mode 100644 index 000000000..5ea0193be --- /dev/null +++ b/include/asm-alpha/pgalloc.h @@ -0,0 +1,337 @@ +#ifndef _ALPHA_PGALLOC_H +#define _ALPHA_PGALLOC_H + +#include <linux/config.h> + +/* Caches aren't brain-dead on the Alpha. */ +#define flush_cache_all() do { } while (0) +#define flush_cache_mm(mm) do { } while (0) +#define flush_cache_range(mm, start, end) do { } while (0) +#define flush_cache_page(vma, vmaddr) do { } while (0) +#define flush_page_to_ram(page) do { } while (0) +#define flush_icache_range(start, end) do { } while (0) + +/* + * Use a few helper functions to hide the ugly broken ASN + * numbers on early Alphas (ev4 and ev45) + */ + +#ifndef __EXTERN_INLINE +#define __EXTERN_INLINE extern inline +#define __MMU_EXTERN_INLINE +#endif + +__EXTERN_INLINE void +ev4_flush_tlb_current(struct mm_struct *mm) +{ + tbiap(); +} + +__EXTERN_INLINE void +ev4_flush_tlb_other(struct mm_struct *mm) +{ +} + +extern void ev5_flush_tlb_current(struct mm_struct *mm); + +__EXTERN_INLINE void +ev5_flush_tlb_other(struct mm_struct *mm) +{ + mm->context = 0; +} + +/* + * Flush just one page in the current TLB set. + * We need to be very careful about the icache here, there + * is no way to invalidate a specific icache page.. + */ + +__EXTERN_INLINE void +ev4_flush_tlb_current_page(struct mm_struct * mm, + struct vm_area_struct *vma, + unsigned long addr) +{ + tbi(2 + ((vma->vm_flags & VM_EXEC) != 0), addr); +} + +__EXTERN_INLINE void +ev5_flush_tlb_current_page(struct mm_struct * mm, + struct vm_area_struct *vma, + unsigned long addr) +{ + if (vma->vm_flags & VM_EXEC) + ev5_flush_tlb_current(mm); + else + tbi(2, addr); +} + + +#ifdef CONFIG_ALPHA_GENERIC +# define flush_tlb_current alpha_mv.mv_flush_tlb_current +# define flush_tlb_other alpha_mv.mv_flush_tlb_other +# define flush_tlb_current_page alpha_mv.mv_flush_tlb_current_page +#else +# ifdef CONFIG_ALPHA_EV4 +# define flush_tlb_current ev4_flush_tlb_current +# define flush_tlb_other ev4_flush_tlb_other +# define flush_tlb_current_page ev4_flush_tlb_current_page +# else +# define flush_tlb_current ev5_flush_tlb_current +# define flush_tlb_other ev5_flush_tlb_other +# define flush_tlb_current_page ev5_flush_tlb_current_page +# endif +#endif + +#ifdef __MMU_EXTERN_INLINE +#undef __EXTERN_INLINE +#undef __MMU_EXTERN_INLINE +#endif + +/* + * Flush current user mapping. + */ +static inline void flush_tlb(void) +{ + flush_tlb_current(current->mm); +} + +#ifndef __SMP__ +/* + * Flush everything (kernel mapping may also have + * changed due to vmalloc/vfree) + */ +static inline void flush_tlb_all(void) +{ + tbia(); +} + +/* + * Flush a specified user mapping + */ +static inline void flush_tlb_mm(struct mm_struct *mm) +{ + if (mm != current->mm) + flush_tlb_other(mm); + else + flush_tlb_current(mm); +} + +/* + * 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) +{ + struct mm_struct * mm = vma->vm_mm; + + if (mm != current->mm) + flush_tlb_other(mm); + else + flush_tlb_current_page(mm, vma, addr); +} + +/* + * Flush a specified range of user mapping: on the + * Alpha we flush the whole user tlb. + */ +static inline void flush_tlb_range(struct mm_struct *mm, + unsigned long start, unsigned long end) +{ + flush_tlb_mm(mm); +} + +#else /* __SMP__ */ + +extern void flush_tlb_all(void); +extern void flush_tlb_mm(struct mm_struct *); +extern void flush_tlb_page(struct vm_area_struct *, unsigned long); +extern void flush_tlb_range(struct mm_struct *, unsigned long, unsigned long); + +#endif /* __SMP__ */ + +/* + * Allocate and free page tables. The xxx_kernel() versions are + * used to allocate a kernel page table - this turns on ASN bits + * if any. + */ +#ifndef __SMP__ +extern struct pgtable_cache_struct { + unsigned long *pgd_cache; + unsigned long *pte_cache; + unsigned long pgtable_cache_sz; +} quicklists; +#else +#include <asm/smp.h> +#define quicklists cpu_data[smp_processor_id()] +#endif +#define pgd_quicklist (quicklists.pgd_cache) +#define pmd_quicklist ((unsigned long *)0) +#define pte_quicklist (quicklists.pte_cache) +#define pgtable_cache_size (quicklists.pgtable_cache_sz) + +extern __inline__ pgd_t *get_pgd_slow(void) +{ + pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL), *init; + + if (ret) { + init = pgd_offset(&init_mm, 0UL); + memset (ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); + memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, + (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); + + pgd_val(ret[PTRS_PER_PGD]) + = pte_val(mk_pte(mem_map + MAP_NR(ret), PAGE_KERNEL)); + } + return ret; +} + +extern __inline__ pgd_t *get_pgd_fast(void) +{ + unsigned long *ret; + + if((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } else + ret = (unsigned long *)get_pgd_slow(); + return (pgd_t *)ret; +} + +extern __inline__ void free_pgd_fast(pgd_t *pgd) +{ + *(unsigned long *)pgd = (unsigned long) pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + pgtable_cache_size++; +} + +extern __inline__ void free_pgd_slow(pgd_t *pgd) +{ + free_page((unsigned long)pgd); +} + +extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long address_premasked); + +extern __inline__ pmd_t *get_pmd_fast(void) +{ + unsigned long *ret; + + if((ret = (unsigned long *)pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } + return (pmd_t *)ret; +} + +extern __inline__ void free_pmd_fast(pmd_t *pmd) +{ + *(unsigned long *)pmd = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pmd; + pgtable_cache_size++; +} + +extern __inline__ void free_pmd_slow(pmd_t *pmd) +{ + free_page((unsigned long)pmd); +} + +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); + +extern __inline__ pte_t *get_pte_fast(void) +{ + unsigned long *ret; + + if((ret = (unsigned long *)pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } + return (pte_t *)ret; +} + +extern __inline__ void free_pte_fast(pte_t *pte) +{ + *(unsigned long *)pte = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pte; + pgtable_cache_size++; +} + +extern __inline__ void free_pte_slow(pte_t *pte) +{ + free_page((unsigned long)pte); +} + +extern void __bad_pte(pmd_t *pmd); +extern void __bad_pmd(pgd_t *pgd); + +#define pte_free_kernel(pte) free_pte_fast(pte) +#define pte_free(pte) free_pte_fast(pte) +#define pmd_free_kernel(pmd) free_pmd_fast(pmd) +#define pmd_free(pmd) free_pmd_fast(pmd) +#define pgd_free(pgd) free_pgd_fast(pgd) +#define pgd_alloc() get_pgd_fast() + +extern inline pte_t * pte_alloc(pmd_t *pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + if (pmd_none(*pmd)) { + pte_t *page = get_pte_fast(); + + if (!page) + return get_pte_slow(pmd, address); + pmd_set(pmd, page); + return page + address; + } + if (pmd_bad(*pmd)) { + __bad_pte(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} + +extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) +{ + address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); + if (pgd_none(*pgd)) { + pmd_t *page = get_pmd_fast(); + + if (!page) + return get_pmd_slow(pgd, address); + pgd_set(pgd, page); + return page + address; + } + if (pgd_bad(*pgd)) { + __bad_pmd(pgd); + return NULL; + } + return (pmd_t *) pgd_page(*pgd) + address; +} + +#define pte_alloc_kernel pte_alloc +#define pmd_alloc_kernel pmd_alloc + +extern int do_check_pgt_cache(int, int); + +extern inline void set_pgdir(unsigned long address, pgd_t entry) +{ + struct task_struct * p; + pgd_t *pgd; + + read_lock(&tasklist_lock); + for_each_task(p) { + if (!p->mm) + continue; + *pgd_offset(p->mm,address) = entry; + } + read_unlock(&tasklist_lock); + for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[(address >> PGDIR_SHIFT) & (PTRS_PER_PAGE - 1)] = entry; +} + +#endif /* _ALPHA_PGALLOC_H */ diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h index cc59d36df..a627d50ba 100644 --- a/include/asm-alpha/pgtable.h +++ b/include/asm-alpha/pgtable.h @@ -9,165 +9,11 @@ * in <asm/page.h> (currently 8192). */ #include <linux/config.h> -#include <linux/spinlock.h> /* For the task lock */ -#include <asm/system.h> +#include <asm/page.h> #include <asm/processor.h> /* For TASK_SIZE */ -#include <asm/mmu_context.h> #include <asm/machvec.h> - -/* Caches aren't brain-dead on the Alpha. */ -#define flush_cache_all() do { } while (0) -#define flush_cache_mm(mm) do { } while (0) -#define flush_cache_range(mm, start, end) do { } while (0) -#define flush_cache_page(vma, vmaddr) do { } while (0) -#define flush_page_to_ram(page) do { } while (0) -#define flush_icache_range(start, end) do { } while (0) - -/* - * Use a few helper functions to hide the ugly broken ASN - * numbers on early Alphas (ev4 and ev45) - */ - -#ifndef __EXTERN_INLINE -#define __EXTERN_INLINE extern inline -#define __MMU_EXTERN_INLINE -#endif - -__EXTERN_INLINE void -ev4_flush_tlb_current(struct mm_struct *mm) -{ - tbiap(); -} - -__EXTERN_INLINE void -ev4_flush_tlb_other(struct mm_struct *mm) -{ -} - -extern void ev5_flush_tlb_current(struct mm_struct *mm); - -__EXTERN_INLINE void -ev5_flush_tlb_other(struct mm_struct *mm) -{ - mm->context = 0; -} - -/* - * Flush just one page in the current TLB set. - * We need to be very careful about the icache here, there - * is no way to invalidate a specific icache page.. - */ - -__EXTERN_INLINE void -ev4_flush_tlb_current_page(struct mm_struct * mm, - struct vm_area_struct *vma, - unsigned long addr) -{ - tbi(2 + ((vma->vm_flags & VM_EXEC) != 0), addr); -} - -__EXTERN_INLINE void -ev5_flush_tlb_current_page(struct mm_struct * mm, - struct vm_area_struct *vma, - unsigned long addr) -{ - if (vma->vm_flags & VM_EXEC) - ev5_flush_tlb_current(mm); - else - tbi(2, addr); -} - - -#ifdef CONFIG_ALPHA_GENERIC -# define flush_tlb_current alpha_mv.mv_flush_tlb_current -# define flush_tlb_other alpha_mv.mv_flush_tlb_other -# define flush_tlb_current_page alpha_mv.mv_flush_tlb_current_page -#else -# ifdef CONFIG_ALPHA_EV4 -# define flush_tlb_current ev4_flush_tlb_current -# define flush_tlb_other ev4_flush_tlb_other -# define flush_tlb_current_page ev4_flush_tlb_current_page -# else -# define flush_tlb_current ev5_flush_tlb_current -# define flush_tlb_other ev5_flush_tlb_other -# define flush_tlb_current_page ev5_flush_tlb_current_page -# endif -#endif - -#ifdef __MMU_EXTERN_INLINE -#undef __EXTERN_INLINE -#undef __MMU_EXTERN_INLINE -#endif - -/* - * Flush current user mapping. - */ -static inline void flush_tlb(void) -{ - flush_tlb_current(current->mm); -} - -#ifndef __SMP__ -/* - * Flush everything (kernel mapping may also have - * changed due to vmalloc/vfree) - */ -static inline void flush_tlb_all(void) -{ - tbia(); -} - -/* - * Flush a specified user mapping - */ -static inline void flush_tlb_mm(struct mm_struct *mm) -{ - if (mm != current->mm) - flush_tlb_other(mm); - else - flush_tlb_current(mm); -} - -/* - * 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) -{ - struct mm_struct * mm = vma->vm_mm; - - if (mm != current->mm) - flush_tlb_other(mm); - else - flush_tlb_current_page(mm, vma, addr); -} - -/* - * Flush a specified range of user mapping: on the - * Alpha we flush the whole user tlb. - */ -static inline void flush_tlb_range(struct mm_struct *mm, - unsigned long start, unsigned long end) -{ - flush_tlb_mm(mm); -} - -#else /* __SMP__ */ - -extern void flush_tlb_all(void); -extern void flush_tlb_mm(struct mm_struct *); -extern void flush_tlb_page(struct vm_area_struct *, unsigned long); -extern void flush_tlb_range(struct mm_struct *, unsigned long, unsigned long); - -#endif /* __SMP__ */ - /* Certain architectures need to do special things when PTEs * within a page table are directly modified. Thus, the following * hook is made available. @@ -293,7 +139,7 @@ extern unsigned long __zero_page(void); #define BAD_PAGETABLE __bad_pagetable() #define BAD_PAGE __bad_page() -#define ZERO_PAGE(vaddr) (PAGE_OFFSET+0x30A000) +#define ZERO_PAGE(vaddr) (mem_map + MAP_NR(ZERO_PGE)) /* number of bits that fit into a memory pointer */ #define BITS_PER_PTR (8*sizeof(unsigned long)) @@ -330,8 +176,14 @@ extern unsigned long __zero_page(void); * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ -extern inline pte_t mk_pte(unsigned long page, pgprot_t pgprot) -{ pte_t pte; pte_val(pte) = ((page-PAGE_OFFSET) << (32-PAGE_SHIFT)) | pgprot_val(pgprot); return pte; } +#define mk_pte(page, pgprot) \ +({ \ + pte_t pte; \ + \ + pte_val(pte) = ((unsigned long)(page - mem_map) << 32) | \ + pgprot_val(pgprot); \ + pte; \ +}) extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) { pte_t pte; pte_val(pte) = (PHYS_TWIDDLE(physpage) << (32-PAGE_SHIFT)) | pgprot_val(pgprot); return pte; } @@ -345,8 +197,8 @@ extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep) extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) { pgd_val(*pgdp) = _PAGE_TABLE | ((((unsigned long) pmdp) - PAGE_OFFSET) << (32-PAGE_SHIFT)); } -extern inline unsigned long pte_page(pte_t pte) -{ return PAGE_OFFSET + ((pte_val(pte) & _PFN_MASK) >> (32-PAGE_SHIFT)); } +#define pte_pagenr(x) ((unsigned long)((pte_val(x) >> 32))) +#define pte_page(x) (mem_map+pte_pagenr(x)) extern inline unsigned long pmd_page(pmd_t pmd) { return PAGE_OFFSET + ((pmd_val(pmd) & _PFN_MASK) >> (32-PAGE_SHIFT)); } @@ -368,6 +220,8 @@ extern inline int pgd_bad(pgd_t pgd) { return (pgd_val(pgd) & ~_PFN_MASK) != _P extern inline int pgd_present(pgd_t pgd) { return pgd_val(pgd) & _PAGE_VALID; } extern inline void pgd_clear(pgd_t * pgdp) { pgd_val(*pgdp) = 0; } +#define page_address(page) ((page)->virtual) + /* * The following only work if pte_present() is true. * Undefined behaviour if not.. @@ -395,10 +249,8 @@ extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; retu #define pgd_offset_k(address) pgd_offset(&init_mm, address) /* to find an entry in a page-table-directory. */ -extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) -{ - return mm->pgd + ((address >> PGDIR_SHIFT) & (PTRS_PER_PAGE - 1)); -} +#define __pgd_offset(address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) +#define pgd_offset(mm, address) ((mm)->pgd+__pgd_offset(address)) /* Find an entry in the second-level page table.. */ extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) @@ -412,186 +264,6 @@ extern inline pte_t * pte_offset(pmd_t * dir, unsigned long address) return (pte_t *) pmd_page(*dir) + ((address >> PAGE_SHIFT) & (PTRS_PER_PAGE - 1)); } -/* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any. - */ -#ifndef __SMP__ -extern struct pgtable_cache_struct { - unsigned long *pgd_cache; - unsigned long *pte_cache; - unsigned long pgtable_cache_sz; -} quicklists; -#else -#include <asm/smp.h> -#define quicklists cpu_data[smp_processor_id()] -#endif -#define pgd_quicklist (quicklists.pgd_cache) -#define pmd_quicklist ((unsigned long *)0) -#define pte_quicklist (quicklists.pte_cache) -#define pgtable_cache_size (quicklists.pgtable_cache_sz) - -extern __inline__ pgd_t *get_pgd_slow(void) -{ - pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL), *init; - - if (ret) { - init = pgd_offset(&init_mm, 0); - memset (ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); - memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, - (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); - - pgd_val(ret[PTRS_PER_PGD]) - = pte_val(mk_pte((unsigned long)ret, PAGE_KERNEL)); - } - return ret; -} - -extern __inline__ pgd_t *get_pgd_fast(void) -{ - unsigned long *ret; - - if((ret = pgd_quicklist) != NULL) { - pgd_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } else - ret = (unsigned long *)get_pgd_slow(); - return (pgd_t *)ret; -} - -extern __inline__ void free_pgd_fast(pgd_t *pgd) -{ - *(unsigned long *)pgd = (unsigned long) pgd_quicklist; - pgd_quicklist = (unsigned long *) pgd; - pgtable_cache_size++; -} - -extern __inline__ void free_pgd_slow(pgd_t *pgd) -{ - free_page((unsigned long)pgd); -} - -extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long address_premasked); - -extern __inline__ pmd_t *get_pmd_fast(void) -{ - unsigned long *ret; - - if((ret = (unsigned long *)pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } - return (pmd_t *)ret; -} - -extern __inline__ void free_pmd_fast(pmd_t *pmd) -{ - *(unsigned long *)pmd = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pmd; - pgtable_cache_size++; -} - -extern __inline__ void free_pmd_slow(pmd_t *pmd) -{ - free_page((unsigned long)pmd); -} - -extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); - -extern __inline__ pte_t *get_pte_fast(void) -{ - unsigned long *ret; - - if((ret = (unsigned long *)pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } - return (pte_t *)ret; -} - -extern __inline__ void free_pte_fast(pte_t *pte) -{ - *(unsigned long *)pte = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pte; - pgtable_cache_size++; -} - -extern __inline__ void free_pte_slow(pte_t *pte) -{ - free_page((unsigned long)pte); -} - -extern void __bad_pte(pmd_t *pmd); -extern void __bad_pmd(pgd_t *pgd); - -#define pte_free_kernel(pte) free_pte_fast(pte) -#define pte_free(pte) free_pte_fast(pte) -#define pmd_free_kernel(pmd) free_pmd_fast(pmd) -#define pmd_free(pmd) free_pmd_fast(pmd) -#define pgd_free(pgd) free_pgd_fast(pgd) -#define pgd_alloc() get_pgd_fast() - -extern inline pte_t * pte_alloc(pmd_t *pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - pte_t *page = get_pte_fast(); - - if (!page) - return get_pte_slow(pmd, address); - pmd_set(pmd, page); - return page + address; - } - if (pmd_bad(*pmd)) { - __bad_pte(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} - -extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) -{ - address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); - if (pgd_none(*pgd)) { - pmd_t *page = get_pmd_fast(); - - if (!page) - return get_pmd_slow(pgd, address); - pgd_set(pgd, page); - return page + address; - } - if (pgd_bad(*pgd)) { - __bad_pmd(pgd); - return NULL; - } - return (pmd_t *) pgd_page(*pgd) + address; -} - -#define pte_alloc_kernel pte_alloc -#define pmd_alloc_kernel pmd_alloc - -extern int do_check_pgt_cache(int, int); - -extern inline void set_pgdir(unsigned long address, pgd_t entry) -{ - struct task_struct * p; - pgd_t *pgd; - - read_lock(&tasklist_lock); - for_each_task(p) { - if (!p->mm) - continue; - *pgd_offset(p->mm,address) = entry; - } - read_unlock(&tasklist_lock); - for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[(address >> PGDIR_SHIFT) & (PTRS_PER_PAGE - 1)] = entry; -} - extern pgd_t swapper_pg_dir[1024]; /* @@ -610,9 +282,11 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma, extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) { pte_t pte; pte_val(pte) = (type << 32) | (offset << 40); return pte; } -#define SWP_TYPE(entry) (((entry) >> 32) & 0xff) -#define SWP_OFFSET(entry) ((entry) >> 40) -#define SWP_ENTRY(type,offset) pte_val(mk_swap_pte((type),(offset))) +#define SWP_TYPE(x) (((x).val >> 32) & 0xff) +#define SWP_OFFSET(x) ((x).val >> 40) +#define SWP_ENTRY(type, offset) ((swp_entry_t) { pte_val(mk_swap_pte((type),(offset))) }) +#define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) +#define swp_entry_to_pte(x) ((pte_t) { (x).val }) #define module_map vmalloc #define module_unmap vfree @@ -624,4 +298,11 @@ extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) #define io_remap_page_range(start, busaddr, size, prot) \ remap_page_range(start, virt_to_phys(__ioremap(busaddr)), size, prot) +#define pte_ERROR(e) \ + printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e)) +#define pmd_ERROR(e) \ + printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e)) +#define pgd_ERROR(e) \ + printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e)) + #endif /* _ALPHA_PGTABLE_H */ diff --git a/include/asm-alpha/posix_types.h b/include/asm-alpha/posix_types.h index 50967ef96..357a44704 100644 --- a/include/asm-alpha/posix_types.h +++ b/include/asm-alpha/posix_types.h @@ -12,6 +12,7 @@ typedef unsigned int __kernel_ino_t; typedef unsigned int __kernel_mode_t; typedef unsigned int __kernel_nlink_t; typedef long __kernel_off_t; +typedef long __kernel_loff_t; typedef int __kernel_pid_t; typedef int __kernel_ipc_pid_t; typedef unsigned int __kernel_uid_t; @@ -26,10 +27,6 @@ typedef int __kernel_daddr_t; typedef char * __kernel_caddr_t; typedef unsigned long __kernel_sigset_t; /* at least 32 bits */ -#ifdef __GNUC__ -typedef long long __kernel_loff_t; -#endif - typedef struct { int val[2]; } __kernel_fsid_t; diff --git a/include/asm-alpha/processor.h b/include/asm-alpha/processor.h index 9f55ea0c3..092f96fab 100644 --- a/include/asm-alpha/processor.h +++ b/include/asm-alpha/processor.h @@ -127,13 +127,18 @@ extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); #define forget_segments() do { } while (0) unsigned long get_wchan(struct task_struct *p); -/* -* See arch/alpha/kernel/ptrace.c for details. -*/ -#define PT_REG(reg) (PAGE_SIZE - sizeof(struct pt_regs) \ - + (long)&((struct pt_regs *)0)->reg) + +/* See arch/alpha/kernel/ptrace.c for details. */ +#define PT_REG(reg) (PAGE_SIZE*2 - sizeof(struct pt_regs) \ + + (long)&((struct pt_regs *)0)->reg) + +#define SW_REG(reg) (PAGE_SIZE*2 - sizeof(struct pt_regs) \ + - sizeof(struct switch_stack) \ + + (long)&((struct switch_stack *)0)->reg) + #define KSTK_EIP(tsk) \ - (*(unsigned long *)(PT_REG(pc) + PAGE_SIZE + (unsigned long)(tsk))) + (*(unsigned long *)(PT_REG(pc) + (unsigned long)(tsk))) + #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) /* NOTE: The task struct and the stack go together! */ diff --git a/include/asm-alpha/resource.h b/include/asm-alpha/resource.h index 234cbfa2f..0f2ddd20c 100644 --- a/include/asm-alpha/resource.h +++ b/include/asm-alpha/resource.h @@ -18,6 +18,13 @@ #define RLIM_NLIMITS 10 +/* + * SuS says limits have to be unsigned. Fine, it's unsigned, but + * we retain the old value for compatibility, especially with DU. + * When you run into the 2^63 barrier, you call me. + */ +#define RLIM_INFINITY 0x7ffffffffffffffful + #ifdef __KERNEL__ #define INIT_RLIMITS \ diff --git a/include/asm-alpha/sfp-machine.h b/include/asm-alpha/sfp-machine.h new file mode 100644 index 000000000..8adc0e74c --- /dev/null +++ b/include/asm-alpha/sfp-machine.h @@ -0,0 +1,84 @@ +/* Machine-dependent software floating-point definitions. + Alpha kernel version. + Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com), + Jakub Jelinek (jakub@redhat.com) and + David S. Miller (davem@redhat.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _SFP_MACHINE_H +#define _SFP_MACHINE_H + +#define _FP_W_TYPE_SIZE 64 +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long + +#define _FP_MUL_MEAT_S(R,X,Y) \ + _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y) +#define _FP_MUL_MEAT_D(R,X,Y) \ + _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_Q(R,X,Y) \ + _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) + +#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) +#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv(D,R,X,Y) +#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) + +#define _FP_NANFRAC_S _FP_QNANBIT_S +#define _FP_NANFRAC_D _FP_QNANBIT_D +#define _FP_NANFRAC_Q _FP_QNANBIT_Q +#define _FP_NANSIGN_S 1 +#define _FP_NANSIGN_D 1 +#define _FP_NANSIGN_Q 1 + +#define _FP_KEEPNANFRACP 1 + +/* Alpha Architecture Handbook, 4.7.10.4 sais that + * we should prefer any type of NaN in Fb, then Fa. + */ +#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ + do { \ + R##_s = Y##_s; \ + _FP_FRAC_COPY_##wc(R,X); \ + R##_c = FP_CLS_NAN; \ + } while (0) + +/* Obtain the current rounding mode. */ +#define FP_ROUNDMODE mode +#define FP_RND_NEAREST (FPCR_DYN_NORMAL >> FPCR_DYN_SHIFT) +#define FP_RND_ZERO (FPCR_DYN_CHOPPED >> FPCR_DYN_SHIFT) +#define FP_RND_PINF (FPCR_DYN_PLUS >> FPCR_DYN_SHIFT) +#define FP_RND_MINF (FPCR_DYN_MINUS >> FPCR_DYN_SHIFT) + +/* Exception flags. */ +#define FP_EX_INVALID IEEE_TRAP_ENABLE_INV +#define FP_EX_OVERFLOW IEEE_TRAP_ENABLE_OVF +#define FP_EX_UNDERFLOW IEEE_TRAP_ENABLE_UNF +#define FP_EX_DIVZERO IEEE_TRAP_ENABLE_DZE +#define FP_EX_INEXACT IEEE_TRAP_ENABLE_INE +#define FP_EX_DENORM IEEE_TRAP_ENABLE_DNO + +#define FP_DENORM_ZERO (fpcw & IEEE_MAP_DMZ) + +#define FP_HANDLE_EXCEPTIONS return _fex + +/* We write the results always */ +#define FP_INHIBIT_RESULTS 0 + +#endif diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h index 880f0f4bb..d298c51db 100644 --- a/include/asm-alpha/system.h +++ b/include/asm-alpha/system.h @@ -86,6 +86,30 @@ struct el_common_EV5_uncorrectable_mcheck { unsigned long ld_lock; /* Contents of EV5 LD_LOCK register*/ }; +struct el_common_EV6_mcheck { + unsigned int FrameSize; /* Bytes, including this field */ + unsigned int FrameFlags; /* <31> = Retry, <30> = Second Error */ + unsigned int CpuOffset; /* Offset to CPU-specific info */ + unsigned int SystemOffset; /* Offset to system-specific info */ + unsigned int MCHK_Code; + unsigned int MCHK_Frame_Rev; + unsigned long I_STAT; /* EV6 Internal Processor Registers */ + unsigned long DC_STAT; /* (See the 21264 Spec) */ + unsigned long C_ADDR; + unsigned long DC1_SYNDROME; + unsigned long DC0_SYNDROME; + unsigned long C_STAT; + unsigned long C_STS; + unsigned long RESERVED0; + unsigned long EXC_ADDR; + unsigned long IER_CM; + unsigned long ISUM; + unsigned long MM_STAT; + unsigned long PAL_BASE; + unsigned long I_CTL; + unsigned long PCTX; +}; + extern void halt(void) __attribute__((noreturn)); #define prepare_to_switch() do { } while(0) @@ -293,12 +317,11 @@ extern void __global_restore_flags(unsigned long flags); #define tbia() __tbi(-2, /* no second argument */) /* - * Give prototypes to shut up gcc. + * Atomic exchange. */ -extern __inline__ unsigned long xchg_u32(volatile int *m, unsigned long val); -extern __inline__ unsigned long xchg_u64(volatile long *m, unsigned long val); -extern __inline__ unsigned long xchg_u32(volatile int *m, unsigned long val) +extern __inline__ unsigned long +__xchg_u32(volatile int *m, unsigned long val) { unsigned long dummy; @@ -317,7 +340,8 @@ extern __inline__ unsigned long xchg_u32(volatile int *m, unsigned long val) return val; } -extern __inline__ unsigned long xchg_u64(volatile long * m, unsigned long val) +extern __inline__ unsigned long +__xchg_u64(volatile long *m, unsigned long val) { unsigned long dummy; @@ -336,33 +360,109 @@ extern __inline__ unsigned long xchg_u64(volatile long * m, unsigned long val) return val; } -/* - * This function doesn't exist, so you'll get a linker error - * if something tries to do an invalid xchg(). - * - * This only works if the compiler isn't horribly bad at optimizing. - * gcc-2.5.8 reportedly can't handle this, but as that doesn't work - * too well on the alpha anyway.. - */ +/* This function doesn't exist, so you'll get a linker error + if something tries to do an invalid xchg(). */ extern void __xchg_called_with_bad_pointer(void); static __inline__ unsigned long -__xchg(unsigned long x, volatile void * ptr, int size) +__xchg(volatile void *ptr, unsigned long x, int size) { switch (size) { case 4: - return xchg_u32(ptr, x); + return __xchg_u32(ptr, x); case 8: - return xchg_u64(ptr, x); + return __xchg_u64(ptr, x); } __xchg_called_with_bad_pointer(); return x; } -#define xchg(ptr,x) \ - ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) +#define xchg(ptr,x) \ + ({ \ + __typeof__(*(ptr)) _x_ = (x); \ + (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \ + }) + #define tas(ptr) (xchg((ptr),1)) + +/* + * Atomic compare and exchange. Compare OLD with MEM, if identical, + * store NEW in MEM. Return the initial value in MEM. Success is + * indicated by comparing RETURN with OLD. + */ + +#define __HAVE_ARCH_CMPXCHG 1 + +extern __inline__ unsigned long +__cmpxchg_u32(volatile int *m, int old, int new) +{ + unsigned long prev, cmp; + + __asm__ __volatile__( + "1: ldl_l %0,%2\n" + " cmpeq %0,%3,%1\n" + " beq %1,2f\n" + " mov %4,%1\n" + " stl_c %1,%2\n" + " beq %1,3f\n" + "2: mb\n" + ".section .text2,\"ax\"\n" + "3: br 1b\n" + ".previous" + : "=&r"(prev), "=&r"(cmp), "=m"(*m) + : "r"((long) old), "r"(new), "m"(*m)); + + return prev; +} + +extern __inline__ unsigned long +__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) +{ + unsigned long prev, cmp; + + __asm__ __volatile__( + "1: ldq_l %0,%2\n" + " cmpeq %0,%3,%1\n" + " beq %1,2f\n" + " mov %4,%1\n" + " stq_c %1,%2\n" + " beq %1,3f\n" + "2: mb\n" + ".section .text2,\"ax\"\n" + "3: br 1b\n" + ".previous" + : "=&r"(prev), "=&r"(cmp), "=m"(*m) + : "r"((long) old), "r"(new), "m"(*m)); + + return prev; +} + +/* This function doesn't exist, so you'll get a linker error + if something tries to do an invalid cmpxchg(). */ +extern void __cmpxchg_called_with_bad_pointer(void); + +static __inline__ unsigned long +__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) +{ + switch (size) { + case 4: + return __cmpxchg_u32(ptr, old, new); + case 8: + return __cmpxchg_u64(ptr, old, new); + } + __cmpxchg_called_with_bad_pointer(); + return old; +} + +#define cmpxchg(ptr,o,n) \ + ({ \ + __typeof__(*(ptr)) _o_ = (o); \ + __typeof__(*(ptr)) _n_ = (n); \ + (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ + (unsigned long)_n_, sizeof(*(ptr))); \ + }) + #endif /* __ASSEMBLY__ */ #endif diff --git a/include/asm-alpha/vga.h b/include/asm-alpha/vga.h index 17e164742..44b6abcc0 100644 --- a/include/asm-alpha/vga.h +++ b/include/asm-alpha/vga.h @@ -11,6 +11,7 @@ #define VT_BUF_HAVE_RW #define VT_BUF_HAVE_MEMSETW +#define VT_BUF_HAVE_MEMCPYW #define VT_BUF_HAVE_MEMCPYF extern inline void scr_writew(u16 val, u16 *addr) @@ -37,15 +38,10 @@ extern inline void scr_memsetw(u16 *s, u16 c, unsigned int count) memsetw(s, c, count); } -extern inline void scr_memcpyw_from(u16 *d, const u16 *s, unsigned int count) -{ - memcpy_fromio(d, s, count); -} - -extern inline void scr_memcpyw_to(u16 *d, const u16 *s, unsigned int count) -{ - memcpy_toio(d, s, count); -} +/* Do not trust that the usage will be correct; analyze the arguments. */ +extern void scr_memcpyw(u16 *d, const u16 *s, unsigned int count); +#define scr_memcpyw_from scr_memcpyw +#define scr_memcpyw_to scr_memcpyw /* ??? These are currently only used for downloading character sets. As such, they don't need memory barriers. Is this all they are intended diff --git a/include/asm-arm/arch-arc/io.h b/include/asm-arm/arch-arc/io.h index 4e984bd3c..c7d6b9e2b 100644 --- a/include/asm-arm/arch-arc/io.h +++ b/include/asm-arm/arch-arc/io.h @@ -9,11 +9,7 @@ #ifndef __ASM_ARM_ARCH_IO_H #define __ASM_ARM_ARCH_IO_H -/* - * This architecture does not require any delayed IO, and - * has the constant-optimised IO - */ -#undef ARCH_IO_DELAY +#define IO_SPACE_LIMIT 0xffffffff /* * We use two different types of addressing - PC style addresses, and ARM @@ -196,6 +192,14 @@ DECLARE_IO(long,l,"") addr; \ }) +#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p)) +#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p)) +#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p)) +#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p)) +#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p)) +#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p)) +#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p)) + /* * Translated address IO functions * diff --git a/include/asm-arm/arch-arc/serial.h b/include/asm-arm/arch-arc/serial.h index 763954175..c068ac62f 100644 --- a/include/asm-arm/arch-arc/serial.h +++ b/include/asm-arm/arch-arc/serial.h @@ -23,30 +23,24 @@ #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define RS_TABLE_SIZE 16 + #if defined(CONFIG_ARCH_A5K) /* UART CLK PORT IRQ FLAGS */ -#define SERIAL_PORT_DFNS \ + +#define STD_SERIAL_PORT_DEFNS { 0, BASE_BAUD, 0x3F8, 10, STD_COM_FLAGS }, /* ttyS0 */ \ - { 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS }, /* ttyS1 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS2 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS3 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS4 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS5 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS6 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS7 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS8 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS9 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS10 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS11 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS12 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS13 */ + { 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS }, /* ttyS1 */ -#elif defined(CONFIG_ARCH_ARC) +#else - /* UART CLK PORT IRQ FLAGS */ -#define SERIAL_PORT_DFNS \ +#define STD_SERIAL_PORT_DEFNS { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS0 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS1 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS1 */ + +#endif + +#define EXTRA_SERIAL_PORT_DEFNS \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS2 */ \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS3 */ \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS4 */ \ @@ -61,4 +55,3 @@ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS13 */ #endif -#endif diff --git a/include/asm-arm/arch-cl7500/acornfb.h b/include/asm-arm/arch-cl7500/acornfb.h new file mode 100644 index 000000000..567d53973 --- /dev/null +++ b/include/asm-arm/arch-cl7500/acornfb.h @@ -0,0 +1,34 @@ +#include <linux/config.h> +#define acornfb_valid_pixrate(rate) (rate >= 39325 && rate <= 40119) + +static inline void +acornfb_vidc20_find_rates(struct vidc_timing *vidc, + struct fb_var_screeninfo *var) +{ + u_int bandwidth; + + vidc->control |= VIDC20_CTRL_PIX_CK; + + /* Calculate bandwidth */ + bandwidth = var->pixclock * 8 / var->bits_per_pixel; + + /* Encode bandwidth as VIDC20 setting */ + if (bandwidth > 16667*2) + vidc->control |= VIDC20_CTRL_FIFO_16; + else if (bandwidth > 13333*2) + vidc->control |= VIDC20_CTRL_FIFO_20; + else if (bandwidth > 11111*2) + vidc->control |= VIDC20_CTRL_FIFO_24; + else + vidc->control |= VIDC20_CTRL_FIFO_28; + + vidc->pll_ctl = 0x2020; +} + +#ifdef CONFIG_CHRONTEL_7003 +#define acornfb_default_control() VIDC20_CTRL_PIX_HCLK +#else +#define acornfb_default_control() VIDC20_CTRL_PIX_VCLK +#endif + +#define acornfb_default_econtrol() VIDC20_ECTL_DAC | VIDC20_ECTL_REG(3) | VIDC20_ECTL_ECK diff --git a/include/asm-arm/arch-cl7500/dma.h b/include/asm-arm/arch-cl7500/dma.h new file mode 100644 index 000000000..fb31f5db9 --- /dev/null +++ b/include/asm-arm/arch-cl7500/dma.h @@ -0,0 +1,21 @@ +/* + * linux/include/asm-arm/arch-cl7500/dma.h + * + * Copyright (C) 1999 Nexus Electronics Ltd. + */ + +#ifndef __ASM_ARCH_DMA_H +#define __ASM_ARCH_DMA_H + +/* + * This is the maximum DMA address that can be DMAd to. + * There should not be more than (0xd0000000 - 0xc0000000) + * bytes of RAM. + */ +#define MAX_DMA_ADDRESS 0xd0000000 + +#define MAX_DMA_CHANNELS 1 + +#define DMA_S0 0 + +#endif /* _ASM_ARCH_DMA_H */ diff --git a/include/asm-arm/arch-cl7500/hardware.h b/include/asm-arm/arch-cl7500/hardware.h new file mode 100644 index 000000000..b155e6933 --- /dev/null +++ b/include/asm-arm/arch-cl7500/hardware.h @@ -0,0 +1,97 @@ +/* + * linux/include/asm-arm/arch-cl7500/hardware.h + * + * Copyright (C) 1996-1999 Russell King. + * Copyright (C) 1999 Nexus Electronics Ltd. + * + * This file contains the hardware definitions of the + * CL7500 evaluation board. + */ +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +#include <asm/arch/memory.h> +#include <asm/iomd.h> + +/* + * What hardware must be present + */ +#define HAS_IOMD +#define HAS_VIDC20 + +/* Hardware addresses of major areas. + * *_START is the physical address + * *_SIZE is the size of the region + * *_BASE is the virtual address + */ + +#define IO_START 0x03000000 /* I/O */ +#define IO_SIZE 0x01000000 +#define IO_BASE 0xe0000000 + +#define ISA_START 0x0c000000 /* ISA */ +#define ISA_SIZE 0x00010000 +#define ISA_BASE 0xe1000000 + +#define FLASH_START 0x01000000 /* XXX */ +#define FLASH_SIZE 0x01000000 +#define FLASH_BASE 0xe2000000 + +#define LED_START 0x0302B000 +#define LED_SIZE 0x00001000 +#define LED_BASE 0xe3000000 +#define LED_ADDRESS (LED_BASE + 0xa00) + +/* 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 FLUSH_BASE 0xdf000000 + + +#ifndef __ASSEMBLER__ + +/* + * for use with inb/outb + */ +#define IO_VIDC_AUDIO_BASE 0x80140000 +#define IO_VIDC_BASE 0x80100000 +#define IO_IOMD_BASE 0x80080000 +#define IOC_BASE 0x80080000 + +/* + * IO definitions + */ +#define EXPMASK_BASE ((volatile unsigned char *)0xe0360000) +#define IOEB_BASE ((volatile unsigned char *)0xe0350050) +#define PCIO_FLOPPYDMABASE ((volatile unsigned char *)0xe002a000) +#define PCIO_BASE 0xe0010000 + +/* + * RAM definitions + */ +#define GET_MEMORY_END(p) (PAGE_OFFSET + p->u1.s.page_size * \ + (p->u1.s.pages_in_bank[0] + \ + p->u1.s.pages_in_bank[1] + \ + p->u1.s.pages_in_bank[2] + \ + p->u1.s.pages_in_bank[3])) + +#define PARAMS_BASE 0 + +#define FLUSH_BASE_PHYS 0x00000000 /* ROM */ + +#else + +#define VIDC_SND_BASE 0xe0500000 +#define VIDC_BASE 0xe0400000 +#define IOMD_BASE 0xe0200000 +#define IOC_BASE 0xe0200000 +#define PCIO_FLOPPYDMABASE 0xe002a000 +#define PCIO_BASE 0xe0010000 + +#endif +#endif + diff --git a/include/asm-arm/arch-cl7500/ide.h b/include/asm-arm/arch-cl7500/ide.h new file mode 100644 index 000000000..590579747 --- /dev/null +++ b/include/asm-arm/arch-cl7500/ide.h @@ -0,0 +1,38 @@ +/* + * linux/include/asm-arm/arch-cl7500/ide.h + * + * Copyright (c) 1997 Russell King + * + * Modifications: + * 29-07-1998 RMK Major re-work of IDE architecture specific code + */ +#include <asm/irq.h> + +/* + * Set up a hw structure for a specified data port, control port and IRQ. + * This should follow whatever the default interface uses. + */ +static __inline__ void +ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int irq) +{ + ide_ioreg_t reg = (ide_ioreg_t) data_port; + int i; + + memset(hw, 0, sizeof(*hw)); + + for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { + hw->io_ports[i] = reg; + reg += 1; + } + hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port; + hw->irq = irq; +} + +/* + * This registers the standard ports for this architecture with the IDE + * driver. + */ +static __inline__ void +ide_init_default_hwifs(void) +{ +} diff --git a/include/asm-arm/arch-cl7500/io.h b/include/asm-arm/arch-cl7500/io.h new file mode 100644 index 000000000..bdbbefce3 --- /dev/null +++ b/include/asm-arm/arch-cl7500/io.h @@ -0,0 +1,214 @@ +/* + * linux/include/asm-arm/arch-cl7500/io.h + * from linux/include/asm-arm/arch-rpc/io.h + * + * Copyright (C) 1997 Russell King + * + * Modifications: + * 06-Dec-1997 RMK Created. + */ +#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_H + +#define IO_SPACE_LIMIT 0xffffffff + +/* + * We use two different types of addressing - PC style addresses, and ARM + * addresses. PC style accesses the PC hardware with the normal PC IO + * addresses, eg 0x3f8 for serial#1. ARM addresses are 0x80000000+ + * and are translated to the start of IO. Note that all addresses are + * shifted left! + */ +#define __PORT_PCIO(x) (!((x) & 0x80000000)) + +/* + * Dynamic IO functions - let the compiler + * optimize the expressions + */ +extern __inline__ void __outb (unsigned int value, unsigned int port) +{ + unsigned long temp; + __asm__ __volatile__( + "tst %2, #0x80000000\n\t" + "mov %0, %4\n\t" + "addeq %0, %0, %3\n\t" + "strb %1, [%0, %2, lsl #2] @ outb" + : "=&r" (temp) + : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) + : "cc"); +} + +extern __inline__ void __outw (unsigned int value, unsigned int port) +{ + unsigned long temp; + __asm__ __volatile__( + "tst %2, #0x80000000\n\t" + "mov %0, %4\n\t" + "addeq %0, %0, %3\n\t" + "str %1, [%0, %2, lsl #2] @ outw" + : "=&r" (temp) + : "r" (value|value<<16), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) + : "cc"); +} + +extern __inline__ void __outl (unsigned int value, unsigned int port) +{ + unsigned long temp; + __asm__ __volatile__( + "tst %2, #0x80000000\n\t" + "mov %0, %4\n\t" + "addeq %0, %0, %3\n\t" + "str %1, [%0, %2, lsl #2] @ outl" + : "=&r" (temp) + : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) + : "cc"); +} + +#define DECLARE_DYN_IN(sz,fnsuffix,instr) \ +extern __inline__ unsigned sz __in##fnsuffix (unsigned int port) \ +{ \ + unsigned long temp, value; \ + __asm__ __volatile__( \ + "tst %2, #0x80000000\n\t" \ + "mov %0, %4\n\t" \ + "addeq %0, %0, %3\n\t" \ + "ldr" ##instr## " %1, [%0, %2, lsl #2] @ in"###fnsuffix \ + : "=&r" (temp), "=r" (value) \ + : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \ + : "cc"); \ + return (unsigned sz)value; \ +} + +extern __inline__ unsigned int __ioaddr (unsigned int port) \ +{ \ + if (__PORT_PCIO(port)) \ + return (unsigned int)(PCIO_BASE + (port << 2)); \ + else \ + return (unsigned int)(IO_BASE + (port << 2)); \ +} + +#define DECLARE_IO(sz,fnsuffix,instr) \ + DECLARE_DYN_IN(sz,fnsuffix,instr) + +DECLARE_IO(char,b,"b") +DECLARE_IO(short,w,"") +DECLARE_IO(long,l,"") + +#undef DECLARE_IO +#undef DECLARE_DYN_IN + +/* + * Constant address IO functions + * + * These have to be macros for the 'J' constraint to work - + * +/-4096 immediate operand. + */ +#define __outbc(value,port) \ +({ \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "strb %0, [%1, %2] @ outbc" \ + : : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ + else \ + __asm__ __volatile__( \ + "strb %0, [%1, %2] @ outbc" \ + : : "r" (value), "r" (IO_BASE), "r" ((port) << 2)); \ +}) + +#define __inbc(port) \ +({ \ + unsigned char result; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "ldrb %0, [%1, %2] @ inbc" \ + : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ + else \ + __asm__ __volatile__( \ + "ldrb %0, [%1, %2] @ inbc" \ + : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ + result; \ +}) + +#define __outwc(value,port) \ +({ \ + unsigned long v = value; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "str %0, [%1, %2] @ outwc" \ + : : "r" (v|v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ + else \ + __asm__ __volatile__( \ + "str %0, [%1, %2] @ outwc" \ + : : "r" (v|v<<16), "r" (IO_BASE), "r" ((port) << 2)); \ +}) + +#define __inwc(port) \ +({ \ + unsigned short result; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "ldr %0, [%1, %2] @ inwc" \ + : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ + else \ + __asm__ __volatile__( \ + "ldr %0, [%1, %2] @ inwc" \ + : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ + result & 0xffff; \ +}) + +#define __outlc(value,port) \ +({ \ + unsigned long v = value; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "str %0, [%1, %2] @ outlc" \ + : : "r" (v), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ + else \ + __asm__ __volatile__( \ + "str %0, [%1, %2] @ outlc" \ + : : "r" (v), "r" (IO_BASE), "r" ((port) << 2)); \ +}) + +#define __inlc(port) \ +({ \ + unsigned long result; \ + if (__PORT_PCIO((port))) \ + __asm__ __volatile__( \ + "ldr %0, [%1, %2] @ inlc" \ + : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ + else \ + __asm__ __volatile__( \ + "ldr %0, [%1, %2] @ inlc" \ + : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ + result; \ +}) + +#define __ioaddrc(port) \ + (__PORT_PCIO((port)) ? PCIO_BASE + ((port) << 2) : IO_BASE + ((port) << 2)) + +#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p)) +#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p)) +#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p)) +#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p)) +#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p)) +#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p)) +#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p)) + +/* + * Translated address IO functions + * + * IO address has already been translated to a virtual address + */ +#define outb_t(v,p) \ + (*(volatile unsigned char *)(p) = (v)) + +#define inb_t(p) \ + (*(volatile unsigned char *)(p)) + +#define outl_t(v,p) \ + (*(volatile unsigned long *)(p) = (v)) + +#define inl_t(p) \ + (*(volatile unsigned long *)(p)) + +#endif diff --git a/include/asm-arm/arch-cl7500/irq.h b/include/asm-arm/arch-cl7500/irq.h new file mode 100644 index 000000000..3621c08f7 --- /dev/null +++ b/include/asm-arm/arch-cl7500/irq.h @@ -0,0 +1,267 @@ +/* + * include/asm-arm/arch-cl7500/irq.h + * + * Copyright (C) 1996 Russell King + * Copyright (C) 1999 Nexus Electronics Ltd. + * + * Changelog: + * 10-10-1996 RMK Brought up to date with arch-sa110eval + * 22-08-1998 RMK Restructured IRQ routines + * 11-08-1999 PJB Created ARM7500 version, derived from RiscPC code + */ +#include <asm/iomd.h> + +static inline int fixup_irq(unsigned int irq) +{ + if (irq == IRQ_ISA) { + int isabits = *((volatile unsigned int *)0xe002b700); + if (isabits == 0) { + printk("Spurious ISA IRQ!\n"); + return irq; + } + irq = 40; + while (!(isabits & 1)) { + irq++; + isabits >>= 1; + } + } + + return irq; +} + +static void cl7500_mask_irq_ack_a(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]\n" +" strb %1, [%3]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKA)), + "r" (ioaddr(IOMD_IRQCLRA))); +} + +static void cl7500_mask_irq_a(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKA))); +} + +static void cl7500_unmask_irq_a(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" orr %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKA))); +} + +static void cl7500_mask_irq_b(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKB))); +} + +static void cl7500_unmask_irq_b(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" orr %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKB))); +} + +static void cl7500_mask_irq_c(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKC))); +} + +static void cl7500_unmask_irq_c(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" orr %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKC))); +} + + +static void cl7500_mask_irq_d(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKD))); +} + +static void cl7500_unmask_irq_d(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" orr %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_IRQMASKD))); +} + +static void cl7500_mask_irq_dma(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_DMAMASK))); +} + +static void cl7500_unmask_irq_dma(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" orr %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_DMAMASK))); +} + +static void cl7500_mask_irq_fiq(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" bic %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_FIQMASK))); +} + +static void cl7500_unmask_irq_fiq(unsigned int irq) +{ + unsigned int temp; + + __asm__ __volatile__( + "ldrb %0, [%2]\n" +" orr %0, %0, %1\n" +" strb %0, [%2]" + : "=&r" (temp) + : "r" (1 << (irq & 7)), "r" (ioaddr(IOMD_FIQMASK))); +} + +static void no_action(int cpl, void *dev_id, struct pt_regs *regs) +{ +} + +static struct irqaction irq_isa = { no_action, 0, 0, "isa", NULL, NULL }; + +static __inline__ void irq_init_irq(void) +{ + extern void ecard_disableirq(unsigned int irq); + extern void ecard_enableirq(unsigned int irq); + int irq; + + outb(0, IOMD_IRQMASKA); + outb(0, IOMD_IRQMASKB); + outb(0, IOMD_FIQMASK); + outb(0, IOMD_DMAMASK); + + for (irq = 0; irq < NR_IRQS; irq++) { + switch (irq) { + case 0 ... 6: + irq_desc[irq].probe_ok = 1; + case 7: + irq_desc[irq].valid = 1; + irq_desc[irq].mask_ack = cl7500_mask_irq_ack_a; + irq_desc[irq].mask = cl7500_mask_irq_a; + irq_desc[irq].unmask = cl7500_unmask_irq_a; + break; + + case 9 ... 15: + irq_desc[irq].probe_ok = 1; + case 8: + irq_desc[irq].valid = 1; + irq_desc[irq].mask_ack = cl7500_mask_irq_b; + irq_desc[irq].mask = cl7500_mask_irq_b; + irq_desc[irq].unmask = cl7500_unmask_irq_b; + break; + + case 16 ... 22: + irq_desc[irq].valid = 1; + irq_desc[irq].mask_ack = cl7500_mask_irq_dma; + irq_desc[irq].mask = cl7500_mask_irq_dma; + irq_desc[irq].unmask = cl7500_unmask_irq_dma; + break; + + case 24 ... 31: + irq_desc[irq].valid = 1; + irq_desc[irq].mask_ack = cl7500_mask_irq_c; + irq_desc[irq].mask = cl7500_mask_irq_c; + irq_desc[irq].unmask = cl7500_unmask_irq_c; + break; + + case 32 ... 39: + irq_desc[irq].valid = 1; + irq_desc[irq].mask_ack = cl7500_mask_irq_d; + irq_desc[irq].mask = cl7500_mask_irq_d; + irq_desc[irq].unmask = cl7500_unmask_irq_d; + break; + + case 40 ... 47: + irq_desc[irq].valid = 1; + irq_desc[irq].probe_ok = 1; + irq_desc[irq].mask_ack = no_action; + irq_desc[irq].mask = no_action; + irq_desc[irq].unmask = no_action; + break; + + case 64 ... 72: + irq_desc[irq].valid = 1; + irq_desc[irq].mask_ack = cl7500_mask_irq_fiq; + irq_desc[irq].mask = cl7500_mask_irq_fiq; + irq_desc[irq].unmask = cl7500_unmask_irq_fiq; + break; + } + } + + setup_arm_irq(IRQ_ISA, &irq_isa); +} diff --git a/include/asm-arm/arch-cl7500/irqs.h b/include/asm-arm/arch-cl7500/irqs.h new file mode 100644 index 000000000..22c9ab23a --- /dev/null +++ b/include/asm-arm/arch-cl7500/irqs.h @@ -0,0 +1,59 @@ +/* + * linux/include/asm-arm/arch-cl7500/irqs.h + * + * Copyright (C) 1999 Nexus Electronics Ltd + */ + +#define IRQ_INT2 0 +#define IRQ_INT1 2 +#define IRQ_VSYNCPULSE 3 +#define IRQ_POWERON 4 +#define IRQ_TIMER0 5 +#define IRQ_TIMER1 6 +#define IRQ_FORCE 7 +#define IRQ_INT8 8 +#define IRQ_ISA 9 +#define IRQ_INT6 10 +#define IRQ_INT5 11 +#define IRQ_INT4 12 +#define IRQ_INT3 13 +#define IRQ_KEYBOARDTX 14 +#define IRQ_KEYBOARDRX 15 + +#define IRQ_DMA0 16 +#define IRQ_DMA1 17 +#define IRQ_DMA2 18 +#define IRQ_DMA3 19 +#define IRQ_DMAS0 20 +#define IRQ_DMAS1 21 + +#define IRQ_IOP0 24 +#define IRQ_IOP1 25 +#define IRQ_IOP2 26 +#define IRQ_IOP3 27 +#define IRQ_IOP4 28 +#define IRQ_IOP5 29 +#define IRQ_IOP6 30 +#define IRQ_IOP7 31 +#define IRQ_MOUSERX 32 +#define IRQ_MOUSETX 33 +#define IRQ_ADC 34 +#define IRQ_EVENT1 35 +#define IRQ_EVENT2 36 + +#define IRQ_ISA_3 40 +#define IRQ_ISA_4 41 +#define IRQ_ISA_5 42 +#define IRQ_ISA_7 43 +#define IRQ_ISA_9 44 +#define IRQ_ISA_10 45 +#define IRQ_ISA_11 46 +#define IRQ_ISA_14 47 + +#define FIQ_INT9 0 +#define FIQ_INT5 1 +#define FIQ_INT6 4 +#define FIQ_INT8 6 +#define FIQ_FORCE 7 + +#define IRQ_TIMER IRQ_TIMER0 diff --git a/include/asm-arm/arch-cl7500/keyboard.h b/include/asm-arm/arch-cl7500/keyboard.h new file mode 100644 index 000000000..21bd69974 --- /dev/null +++ b/include/asm-arm/arch-cl7500/keyboard.h @@ -0,0 +1,29 @@ +/* + * linux/include/asm-arm/arch-cl7500/keyboard.h + * from linux/include/asm-arm/arch-rpc/keyboard.h + * + * Keyboard driver definitions for CL7500 architecture + * + * (C) 1998 Russell King + */ + +#include <asm/irq.h> + +#define NR_SCANCODES 128 + +extern void ps2kbd_leds(unsigned char leds); +extern void ps2kbd_init_hw(void); +extern unsigned char ps2kbd_sysrq_xlate[NR_SCANCODES]; + +#define kbd_setkeycode(sc,kc) (-EINVAL) +#define kbd_getkeycode(sc) (-EINVAL) + +#define kbd_translate(sc, kcp, rm) ({ *(kcp) = (sc); 1; }) +#define kbd_unexpected_up(kc) (0200) +#define kbd_leds(leds) ps2kbd_leds(leds) +#define kbd_init_hw() ps2kbd_init_hw() +#define kbd_sysrq_xlate ps2kbd_sysrq_xlate +#define kbd_disable_irq() disable_irq(IRQ_KEYBOARDRX) +#define kbd_enable_irq() enable_irq(IRQ_KEYBOARDRX) + +#define SYSRQ_KEY 13 diff --git a/include/asm-arm/arch-cl7500/memory.h b/include/asm-arm/arch-cl7500/memory.h new file mode 100644 index 000000000..ecd1aa035 --- /dev/null +++ b/include/asm-arm/arch-cl7500/memory.h @@ -0,0 +1,41 @@ +/* + * linux/include/asm-arm/arch-cl7500/memory.h + * + * Copyright (c) 1996,1997,1998 Russell King. + * + * Changelog: + * 20-Oct-1996 RMK Created + * 31-Dec-1997 RMK Fixed definitions to reduce warnings + * 11-Jan-1998 RMK Uninlined to reduce hits on cache + * 08-Feb-1998 RMK Added __virt_to_bus and __bus_to_virt + * 21-Mar-1999 RMK Renamed to memory.h + * RMK Added TASK_SIZE and PAGE_OFFSET + */ +#ifndef __ASM_ARCH_MMU_H +#define __ASM_ARCH_MMU_H + +/* + * Task size: 3GB + */ +#define TASK_SIZE (0xc0000000UL) + +/* + * Page offset: 3GB + */ +#define PAGE_OFFSET (0xc0000000UL) + +#ifndef __ASSEMBLY__ +extern unsigned long __virt_to_phys(unsigned long vpage); +extern unsigned long __phys_to_virt(unsigned long ppage); +#endif + +/* + * These are exactly the same on the RiscPC as the + * physical memory view. + */ +#define __virt_to_bus__is_a_macro +#define __virt_to_bus(x) __virt_to_phys(x) +#define __bus_to_virt__is_a_macro +#define __bus_to_virt(x) __phys_to_virt(x) + +#endif diff --git a/include/asm-arm/arch-cl7500/param.h b/include/asm-arm/arch-cl7500/param.h new file mode 100644 index 000000000..46c223599 --- /dev/null +++ b/include/asm-arm/arch-cl7500/param.h @@ -0,0 +1,5 @@ +/* + * linux/include/asm-arm/arch-cl7500/param.h + * + * Copyright (C) 1999 Nexus Electronics Ltd + */ diff --git a/include/asm-arm/arch-cl7500/processor.h b/include/asm-arm/arch-cl7500/processor.h new file mode 100644 index 000000000..41bf0451f --- /dev/null +++ b/include/asm-arm/arch-cl7500/processor.h @@ -0,0 +1,29 @@ +/* + * linux/include/asm-arm/arch-cl7500/processor.h + * + * Copyright (c) 1996-1999 Russell King. + * + * Changelog: + * 10-Sep-1996 RMK Created + * 21-Mar-1999 RMK Added asm/arch/memory.h + */ + +#ifndef __ASM_ARCH_PROCESSOR_H +#define __ASM_ARCH_PROCESSOR_H + +#include <asm/arch/memory.h> + +/* + * Bus types + */ +#define EISA_bus 0 +#define EISA_bus__is_a_macro /* for versions in ksyms.c */ +#define MCA_bus 0 +#define MCA_bus__is_a_macro /* for versions in ksyms.c */ + +/* This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + +#endif diff --git a/include/asm-arm/arch-cl7500/serial.h b/include/asm-arm/arch-cl7500/serial.h new file mode 100644 index 000000000..4132273cc --- /dev/null +++ b/include/asm-arm/arch-cl7500/serial.h @@ -0,0 +1,42 @@ +/* + * linux/include/asm-arm/arch-cl7500/serial.h + * + * Copyright (c) 1996 Russell King. + * Copyright (C) 1999 Nexus Electronics Ltd. + * + * Changelog: + * 15-10-1996 RMK Created + * 10-08-1999 PJB Added COM3/COM4 for CL7500 + */ +#ifndef __ASM_ARCH_SERIAL_H +#define __ASM_ARCH_SERIAL_H + +/* + * This assumes you have a 1.8432 MHz clock for your UART. + * + * It'd be nice if someone built a serial card with a 24.576 MHz + * clock, since the 16550A is capable of handling a top speed of 1.5 + * megabits/second; but this requires the faster clock. + */ +#define BASE_BAUD (1843200 / 16) + +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) + + /* UART CLK PORT IRQ FLAGS */ +#define SERIAL_PORT_DFNS \ + { 0, BASE_BAUD, 0x3F8, 10, STD_COM_FLAGS }, /* ttyS0 */ \ + { 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS }, /* ttyS1 */ \ + { 0, BASE_BAUD, 0x804002e8, 41, STD_COM_FLAGS }, /* ttyS2 */ \ + { 0, BASE_BAUD, 0x804003e8, 40, STD_COM_FLAGS }, /* ttyS3 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS4 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS5 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS6 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS7 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS8 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS9 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS10 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS11 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS12 */ \ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS13 */ + +#endif diff --git a/include/asm-arm/arch-cl7500/shmparam.h b/include/asm-arm/arch-cl7500/shmparam.h new file mode 100644 index 000000000..9c718858e --- /dev/null +++ b/include/asm-arm/arch-cl7500/shmparam.h @@ -0,0 +1,8 @@ +/* + * linux/include/asm-arm/arch-cl7500/shmparam.h + * + * Copyright (c) 1999 Nexus Electronics Ltd + */ + +/* The processor-centric definitions are OK. */ + diff --git a/include/asm-arm/arch-cl7500/system.h b/include/asm-arm/arch-cl7500/system.h new file mode 100644 index 000000000..767730a4c --- /dev/null +++ b/include/asm-arm/arch-cl7500/system.h @@ -0,0 +1,27 @@ +/* + * linux/include/asm-arm/arch-cl7500/system.h + * + * Copyright (c) 1999 Nexus Electronics Ltd. + */ +#ifndef __ASM_ARCH_SYSTEM_H +#define __ASM_ARCH_SYSTEM_H + +#include <asm/iomd.h> + +#define arch_reset(mode) { \ + outb (0, IOMD_ROMCR0); \ + cli(); \ + __asm__ __volatile__( \ + "mcr p15, 0, %0, c1, c0, 0;" \ + "mov pc, #0" \ + : \ + : "r" (cpu_reset())); \ + } + +/* + * We can wait for an interrupt... + */ +#define arch_do_idle() \ + outb(0, IOMD_SUSMODE) + +#endif diff --git a/include/asm-arm/arch-cl7500/time.h b/include/asm-arm/arch-cl7500/time.h new file mode 100644 index 000000000..19b388682 --- /dev/null +++ b/include/asm-arm/arch-cl7500/time.h @@ -0,0 +1,123 @@ +/* + * linux/include/asm-arm/arch-cl7500/time.h + * + * Copyright (c) 1996 Russell King. + * Copyright (C) 1999 Nexus Electronics Ltd. + * + * Changelog: + * 24-Sep-1996 RMK Created + * 10-Oct-1996 RMK Brought up to date with arch-sa110eval + * 04-Dec-1997 RMK Updated for new arch/arm/time.c + * 10-Aug-1999 PJB Converted for CL7500 + */ +#include <asm/iomd.h> + +static long last_rtc_update = 0; /* last time the cmos clock got updated */ + +extern __inline__ unsigned long gettimeoffset (void) +{ + unsigned long offset = 0; + unsigned int count1, count2, status1, status2; + + status1 = IOMD_IRQREQA; + barrier (); + outb(0, IOMD_T0LATCH); + barrier (); + count1 = inb(IOMD_T0CNTL) | (inb(IOMD_T0CNTH) << 8); + barrier (); + status2 = inb(IOMD_IRQREQA); + barrier (); + outb(0, IOMD_T0LATCH); + barrier (); + count2 = inb(IOMD_T0CNTL) | (inb(IOMD_T0CNTH) << 8); + + if (count2 < count1) { + /* + * This means that we haven't just had an interrupt + * while reading into status2. + */ + if (status2 & (1 << 5)) + offset = tick; + count1 = count2; + } else if (count2 > count1) { + /* + * We have just had another interrupt while reading + * status2. + */ + offset += tick; + count1 = count2; + } + + count1 = LATCH - count1; + /* + * count1 = number of clock ticks since last interrupt + */ + offset += count1 * tick / LATCH; + return offset; +} + +extern __inline__ unsigned long get_rtc_time(void) +{ + return mktime(1976, 06, 24, 0, 0, 0); +} + +static int set_rtc_time(unsigned long nowtime) +{ + return 0; +} + +static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) +{ + do_timer(regs); + + /* If we have an externally synchronized linux clock, then update + * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be + * called as close as possible to 500 ms before the new second starts. + */ + if ((time_status & STA_UNSYNC) == 0 && + xtime.tv_sec > last_rtc_update + 660 && + xtime.tv_usec >= 50000 - (tick >> 1) && + xtime.tv_usec < 50000 + (tick >> 1)) { + if (set_rtc_time(xtime.tv_sec) == 0) + last_rtc_update = xtime.tv_sec; + else + last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ + } + + { + /* Twinkle the lights. */ + static int count, bit = 8, dir = 1; + if (count-- == 0) { + bit += dir; + if (bit == 8 || bit == 15) dir = -dir; + count = 5; + *((volatile unsigned int *)(0xe002ba00)) = 1 << bit; + } + } + + if (!user_mode(regs)) + do_profile(instruction_pointer(regs)); +} + +static struct irqaction timerirq = { + timer_interrupt, + 0, + 0, + "timer", + NULL, + NULL +}; + +/* + * Set up timer interrupt, and return the current time in seconds. + */ +extern __inline__ void setup_timer(void) +{ + outb(LATCH & 255, IOMD_T0LTCHL); + outb(LATCH >> 8, IOMD_T0LTCHH); + outb(0, IOMD_T0GO); + + xtime.tv_sec = get_rtc_time(); + + setup_arm_irq(IRQ_TIMER, &timerirq); +} diff --git a/include/asm-arm/arch-cl7500/timex.h b/include/asm-arm/arch-cl7500/timex.h new file mode 100644 index 000000000..8a4175fc0 --- /dev/null +++ b/include/asm-arm/arch-cl7500/timex.h @@ -0,0 +1,13 @@ +/* + * linux/include/asm-arm/arch-cl7500/timex.h + * + * CL7500 architecture timex specifications + * + * Copyright (C) 1999 Nexus Electronics Ltd + */ + +/* + * On the ARM7500, the clock ticks at 2MHz. + */ +#define CLOCK_TICK_RATE 2000000 + diff --git a/include/asm-arm/arch-cl7500/uncompress.h b/include/asm-arm/arch-cl7500/uncompress.h new file mode 100644 index 000000000..0585c8318 --- /dev/null +++ b/include/asm-arm/arch-cl7500/uncompress.h @@ -0,0 +1,42 @@ +/* + * linux/include/asm-arm/arch-cl7500/uncompress.h + * + * Copyright (C) 1999 Nexus Electronics Ltd. + */ + +#define BASE 0x03010000 + +static __inline__ void putc(char c) +{ + while (!(*((volatile unsigned int *)(BASE + 0xbf4)) & 0x20)); + *((volatile unsigned int *)(BASE + 0xbe0)) = c; +} + +/* + * This does not append a newline + */ +static void puts(const char *s) +{ + while (*s) { + putc(*s); + if (*s == '\n') + putc('\r'); + s++; + } +} + +static __inline__ void arch_decomp_setup(void) +{ + int baud = 3686400 / (9600 * 16); + + *((volatile unsigned int *)(BASE + 0xBEC)) = 0x80; + *((volatile unsigned int *)(BASE + 0xBE0)) = baud & 0xff; + *((volatile unsigned int *)(BASE + 0xBE4)) = (baud & 0xff00) >> 8; + *((volatile unsigned int *)(BASE + 0xBEC)) = 3; /* 8 bits */ + *((volatile unsigned int *)(BASE + 0xBF0)) = 3; /* DTR, RTS */ +} + +/* + * nothing to do + */ +#define arch_decomp_wdog() diff --git a/include/asm-arm/arch-ebsa110/io.h b/include/asm-arm/arch-ebsa110/io.h index 32fc49c1a..4f936f0e9 100644 --- a/include/asm-arm/arch-ebsa110/io.h +++ b/include/asm-arm/arch-ebsa110/io.h @@ -9,11 +9,7 @@ #ifndef __ASM_ARM_ARCH_IO_H #define __ASM_ARM_ARCH_IO_H -/* - * This architecture does not require any delayed IO, and - * has the constant-optimised IO - */ -#undef ARCH_IO_DELAY +#define IO_SPACE_LIMIT 0xffffffff /* * We use two different types of addressing - PC style addresses, and ARM @@ -173,6 +169,14 @@ DECLARE_IO(long,l,"") addr; \ }) +#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p)) +#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p)) +#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p)) +#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p)) +#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p)) +#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p)) +#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p)) + /* * Translated address IO functions * diff --git a/include/asm-arm/arch-ebsa110/serial.h b/include/asm-arm/arch-ebsa110/serial.h index 7388f813b..d2133c6d1 100644 --- a/include/asm-arm/arch-ebsa110/serial.h +++ b/include/asm-arm/arch-ebsa110/serial.h @@ -20,22 +20,14 @@ #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define RS_TABLE_SIZE 2 + /* UART CLK PORT IRQ FLAGS */ -#define SERIAL_PORT_DFNS \ +#define STD_SERIAL_PORT_DEFNS \ { 0, BASE_BAUD, 0x3F8, 1, STD_COM_FLAGS }, /* ttyS0 */ \ - { 0, BASE_BAUD, 0x2F8, 2, STD_COM_FLAGS }, /* ttyS1 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS2 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS3 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS4 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS5 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS6 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS7 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS8 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS9 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS10 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS11 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS12 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS13 */ + { 0, BASE_BAUD, 0x2F8, 2, STD_COM_FLAGS } /* ttyS1 */ + +#define EXTRA_SERIAL_PORT_DEFNS #endif diff --git a/include/asm-arm/arch-ebsa110/system.h b/include/asm-arm/arch-ebsa110/system.h index 064227627..05e2be707 100644 --- a/include/asm-arm/arch-ebsa110/system.h +++ b/include/asm-arm/arch-ebsa110/system.h @@ -6,7 +6,16 @@ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H -#define arch_do_idle() do { } while (0) -#define arch_reset(mode) do { } while (0) +#define arch_do_idle() cpu_do_idle() + +extern __inline__ void arch_reset(char mode) +{ + if (mode == 's') { + __asm__ volatile( + "mcr p15, 0, %0, c1, c0, 0 @ MMU off + mov pc, #0x80000000 @ jump to flash" + : : "r" (cpu_reset()) : "cc"); + } +} #endif diff --git a/include/asm-arm/arch-ebsa285/hardware.h b/include/asm-arm/arch-ebsa285/hardware.h index ebc42770c..9aeaf6712 100644 --- a/include/asm-arm/arch-ebsa285/hardware.h +++ b/include/asm-arm/arch-ebsa285/hardware.h @@ -12,47 +12,53 @@ #include <asm/arch/memory.h> #ifdef CONFIG_HOST_FOOTBRIDGE -/* Virtual Physical - * 0xfff00000 0x40000000 X-Bus - * 0xff000000 0x7c000000 PCI I/O space +/* Virtual Physical Size + * 0xff800000 0x40000000 1MB X-Bus + * 0xff000000 0x7c000000 1MB PCI I/O space * - * 0xfe000000 0x42000000 CSR - * 0xfd000000 0x78000000 Outbound write flush - * 0xfc000000 0x79000000 PCI IACK/special space + * 0xfe000000 0x42000000 1MB CSR + * 0xfd000000 0x78000000 1MB Outbound write flush (not supported) + * 0xfc000000 0x79000000 1MB PCI IACK/special space * - * 0xf9000000 0x7a000000 PCI Config type 1 - * 0xf8000000 0x7b000000 PCI Config type 0 - * + * 0xfb000000 0x7a000000 16MB PCI Config type 1 + * 0xfa000000 0x7b000000 16MB PCI Config type 0 + * + * 0xf9000000 0x50000000 1MB Cache flush + * 0xf8000000 0x41000000 16MB Flash memory + * + * 0xe1000000 unmapped (to catch bad ISA/PCI) + * + * 0xe0000000 0x80000000 16MB ISA memory */ #define XBUS_SIZE 0x00100000 -#define XBUS_BASE 0xfff00000 +#define XBUS_BASE 0xff800000 #define PCIO_SIZE 0x00100000 #define PCIO_BASE 0xff000000 -#define ARMCSR_SIZE 0x01000000 +#define ARMCSR_SIZE 0x00100000 #define ARMCSR_BASE 0xfe000000 -#define WFLUSH_SIZE 0x01000000 +#define WFLUSH_SIZE 0x00100000 #define WFLUSH_BASE 0xfd000000 -#define PCIIACK_SIZE 0x01000000 +#define PCIIACK_SIZE 0x00100000 #define PCIIACK_BASE 0xfc000000 #define PCICFG1_SIZE 0x01000000 -#define PCICFG1_BASE 0xf9000000 +#define PCICFG1_BASE 0xfb000000 #define PCICFG0_SIZE 0x01000000 -#define PCICFG0_BASE 0xf8000000 - -#define PCIMEM_SIZE 0x18000000 -#define PCIMEM_BASE 0xe0000000 +#define PCICFG0_BASE 0xfa000000 #define FLUSH_SIZE 0x00100000 -#define FLUSH_BASE 0xdf000000 +#define FLUSH_BASE 0xf9000000 -#define FLASH_SIZE 0x00400000 -#define FLASH_BASE 0xd8000000 +#define FLASH_SIZE 0x01000000 +#define FLASH_BASE 0xf8000000 + +#define PCIMEM_SIZE 0x01000000 +#define PCIMEM_BASE 0xe0000000 #elif defined(CONFIG_ARCH_CO285) diff --git a/include/asm-arm/arch-ebsa285/io.h b/include/asm-arm/arch-ebsa285/io.h index a9cc3afe0..7861f8470 100644 --- a/include/asm-arm/arch-ebsa285/io.h +++ b/include/asm-arm/arch-ebsa285/io.h @@ -10,92 +10,91 @@ #ifndef __ASM_ARM_ARCH_IO_H #define __ASM_ARM_ARCH_IO_H -#include <asm/dec21285.h> +#define IO_SPACE_LIMIT 0xffff /* - * This architecture does not require any delayed IO, and - * has the constant-optimised IO + * Translation of various region addresses to virtual addresses */ -#undef ARCH_IO_DELAY -#define ARCH_READWRITE +#define __io_pci(a) (PCIO_BASE + (a)) +#if 0 +#define __mem_pci(a) ((unsigned long)(a)) +#define __mem_isa(a) (PCIMEM_BASE + (unsigned long)(a)) +#else -#define __pci_io_addr(x) (PCIO_BASE + (unsigned int)(x)) +extern __inline__ unsigned long ___mem_pci(unsigned long a) +{ + if (a <= 0xc0000000 || a >= 0xe0000000) + BUG(); + return a; +} -#define __inb(p) (*(volatile unsigned char *)__pci_io_addr(p)) -#define __inl(p) (*(volatile unsigned long *)__pci_io_addr(p)) +extern __inline__ unsigned long ___mem_isa(unsigned long a) +{ + if (a >= 16*1048576) + BUG(); + return PCIMEM_BASE + a; +} +#define __mem_pci(a) ___mem_pci((unsigned long)(a)) +#define __mem_isa(a) ___mem_isa((unsigned long)(a)) +#endif + +/* the following macro is depreciated */ +#define __ioaddr(p) __io_pci(p) -extern __inline__ unsigned int __inw(unsigned int port) +/* + * Generic virtual read/write + */ +#define __arch_getb(a) (*(volatile unsigned char *)(a)) +#define __arch_getl(a) (*(volatile unsigned long *)(a)) + +extern __inline__ unsigned int __arch_getw(unsigned long a) { unsigned int value; - __asm__ __volatile__( - "ldr%?h %0, [%1, %2] @ inw" - : "=&r" (value) - : "r" (PCIO_BASE), "r" (port)); + __asm__ __volatile__("ldr%?h %0, [%1, #0] @ getw" + : "=&r" (value) + : "r" (a)); return value; } -#define __outb(v,p) (*(volatile unsigned char *)__pci_io_addr(p) = (v)) -#define __outl(v,p) (*(volatile unsigned long *)__pci_io_addr(p) = (v)) +#define __arch_putb(v,a) (*(volatile unsigned char *)(a) = (v)) +#define __arch_putl(v,a) (*(volatile unsigned long *)(a) = (v)) -extern __inline__ void __outw(unsigned int value, unsigned int port) +extern __inline__ void __arch_putw(unsigned int value, unsigned long a) { - __asm__ __volatile__( - "str%?h %0, [%1, %2] @ outw" - : : "r" (value), "r" (PCIO_BASE), "r" (port)); + __asm__ __volatile__("str%?h %0, [%1, #0] @ putw" + : : "r" (value), "r" (a)); } -#define __ioaddr(p) __pci_io_addr(p) +#define inb(p) __arch_getb(__io_pci(p)) +#define inw(p) __arch_getw(__io_pci(p)) +#define inl(p) __arch_getl(__io_pci(p)) + +#define outb(v,p) __arch_putb(v,__io_pci(p)) +#define outw(v,p) __arch_putw(v,__io_pci(p)) +#define outl(v,p) __arch_putl(v,__io_pci(p)) + +#include <asm/dec21285.h> /* * ioremap support - validate a PCI memory address, * and convert a PCI memory address to a physical * address for the page tables. */ -#define valid_ioaddr(iomem,size) ((iomem) < 0x80000000 && (iomem) + (size) <= 0x80000000) -#define io_to_phys(iomem) ((iomem) + DC21285_PCI_MEM) - -/* - * Fudge up IO addresses by this much. Once we're confident that nobody - * is using read*() and so on with addresses they didn't get from ioremap - * this can go away. - */ -#define IO_FUDGE_FACTOR PCIMEM_BASE - -#define __pci_mem_addr(x) ((void *)(IO_FUDGE_FACTOR + (unsigned long)(x))) +#define valid_ioaddr(off,sz) ((off) < 0x80000000 && (off) + (sz) <= 0x80000000) +#define io_to_phys(off) ((off) + DC21285_PCI_MEM) /* * ioremap takes a PCI memory address, as specified in * linux/Documentation/IO-mapping.txt */ -#define ioremap(iomem_addr,size) \ -({ \ - unsigned long _addr = (iomem_addr), _size = (size); \ - void *_ret = NULL; \ - if (valid_ioaddr(_addr, _size)) { \ - _addr = io_to_phys(_addr); \ - _ret = __ioremap(_addr, _size, 0); \ - if (_ret) \ - _ret = (void *)((int) _ret - IO_FUDGE_FACTOR); \ - } \ - _ret; }) - -#define ioremap_nocache(iomem_addr,size) ioremap((iomem_addr),(size)) - -#define iounmap(_addr) do { __iounmap(__pci_mem_addr((_addr))); } while (0) - -#define readb(addr) (*(volatile unsigned char *)__pci_mem_addr(addr)) -#define readw(addr) (*(volatile unsigned short *)__pci_mem_addr(addr)) -#define readl(addr) (*(volatile unsigned long *)__pci_mem_addr(addr)) - -#define writeb(b,addr) (*(volatile unsigned char *)__pci_mem_addr(addr) = (b)) -#define writew(b,addr) (*(volatile unsigned short *)__pci_mem_addr(addr) = (b)) -#define writel(b,addr) (*(volatile unsigned long *)__pci_mem_addr(addr) = (b)) - -#define memset_io(a,b,c) memset(__pci_mem_addr(a),(b),(c)) -#define memcpy_fromio(a,b,c) memcpy((a),__pci_mem_addr(b),(c)) -#define memcpy_toio(a,b,c) memcpy(__pci_mem_addr(a),(b),(c)) - -#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),__pci_mem_addr(b),(c),(d)) +#define __arch_ioremap(off,size,nocache) \ +({ \ + unsigned long _off = (off), _size = (size); \ + void *_ret = NULL; \ + if (valid_ioaddr(_off, _size)) \ + _ret = __ioremap(io_to_phys(_off), _size, 0); \ + _ret; \ +}) #endif diff --git a/include/asm-arm/arch-ebsa285/irq.h b/include/asm-arm/arch-ebsa285/irq.h index d97490079..195aad743 100644 --- a/include/asm-arm/arch-ebsa285/irq.h +++ b/include/asm-arm/arch-ebsa285/irq.h @@ -11,6 +11,7 @@ * 16-Mar-1999 RMK Added autodetect of ISA PICs */ /* no need for config.h - arch/arm/kernel/irq.c does this for us */ +#include <linux/config.h> #include <asm/hardware.h> #include <asm/dec21285.h> #include <asm/irq.h> diff --git a/include/asm-arm/arch-ebsa285/serial.h b/include/asm-arm/arch-ebsa285/serial.h index 63a699e66..0efc4c849 100644 --- a/include/asm-arm/arch-ebsa285/serial.h +++ b/include/asm-arm/arch-ebsa285/serial.h @@ -24,23 +24,15 @@ #define _SER_IRQ0 IRQ_ISA_UART #define _SER_IRQ1 IRQ_ISA_UART2 +#define RS_TABLE_SIZE 16 + #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) /* UART CLK PORT IRQ FLAGS */ -#define SERIAL_PORT_DFNS \ +#define STD_SERIAL_PORT_DEFNS \ { 0, BASE_BAUD, 0x3F8, _SER_IRQ0, STD_COM_FLAGS }, /* ttyS0 */ \ - { 0, BASE_BAUD, 0x2F8, _SER_IRQ1, STD_COM_FLAGS }, /* ttyS1 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS2 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS3 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS4 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS5 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS6 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS7 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS8 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS9 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS10 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS11 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS12 */ \ - { 0, BASE_BAUD, 0 , 0 , STD_COM_FLAGS }, /* ttyS13 */ + { 0, BASE_BAUD, 0x2F8, _SER_IRQ1, STD_COM_FLAGS }, /* ttyS1 */ + +#define EXTRA_SERIAL_PORT_DEFNS #endif diff --git a/include/asm-arm/arch-ebsa285/system.h b/include/asm-arm/arch-ebsa285/system.h index 24a22d31c..ee7573804 100644 --- a/include/asm-arm/arch-ebsa285/system.h +++ b/include/asm-arm/arch-ebsa285/system.h @@ -14,9 +14,9 @@ extern __inline__ void arch_reset(char mode) { if (mode == 's') { __asm__ volatile ( - "mov lr, #0x41000000 @ prepare to jump to ROM - mcr p15, 0, %0, c1, c0, 0 @ MMU off - mov pc, lr" : : "r" (cpu_reset()) : "cc"); + "mcr p15, 0, %0, c1, c0, 0 @ MMU off + mov pc, #0x41000000 @ jump to ROM" : : + "r" (cpu_reset()) : "cc"); } else { if (machine_is_netwinder()) { /* open up the SuperIO chip diff --git a/include/asm-arm/arch-nexuspci/io.h b/include/asm-arm/arch-nexuspci/io.h index 5142e9126..f70fbadbd 100644 --- a/include/asm-arm/arch-nexuspci/io.h +++ b/include/asm-arm/arch-nexuspci/io.h @@ -1,5 +1,5 @@ /* - * linux/include/asm-arm/arch-ebsa110/io.h + * linux/include/asm-arm/arch-nexuspci/io.h * * Copyright (C) 1997,1998 Russell King * @@ -9,11 +9,7 @@ #ifndef __ASM_ARM_ARCH_IO_H #define __ASM_ARM_ARCH_IO_H -/* - * This architecture does not require any delayed IO, and - * has the constant-optimised IO - */ -#undef ARCH_IO_DELAY +#define IO_SPACE_LIMIT 0xffffffff /* * Dynamic IO functions - let the compiler @@ -123,6 +119,14 @@ DECLARE_IO(long,l,"","Jr") addr; \ }) +#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p)) +#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p)) +#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p)) +#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p)) +#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p)) +#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p)) +#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p)) + /* * Translated address IO functions * diff --git a/include/asm-arm/arch-rpc/io.h b/include/asm-arm/arch-rpc/io.h index 740fa30c0..2e093217c 100644 --- a/include/asm-arm/arch-rpc/io.h +++ b/include/asm-arm/arch-rpc/io.h @@ -9,11 +9,7 @@ #ifndef __ASM_ARM_ARCH_IO_H #define __ASM_ARM_ARCH_IO_H -/* - * This architecture does not require any delayed IO, and - * has the constant-optimised IO - */ -#undef ARCH_IO_DELAY +#define IO_SPACE_LIMIT 0xffffffff /* * We use two different types of addressing - PC style addresses, and ARM @@ -25,8 +21,7 @@ #define __PORT_PCIO(x) (!((x) & 0x80000000)) /* - * Dynamic IO functions - let the compiler - * optimize the expressions + * Dynamic IO functions. */ extern __inline__ void __outb (unsigned int value, unsigned int port) { @@ -189,6 +184,14 @@ DECLARE_IO(long,l,"") #define __ioaddrc(port) \ (__PORT_PCIO((port)) ? PCIO_BASE + ((port) << 2) : IO_BASE + ((port) << 2)) +#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p)) +#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p)) +#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p)) +#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p)) +#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p)) +#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p)) +#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p)) + /* * Translated address IO functions * diff --git a/include/asm-arm/arch-rpc/serial.h b/include/asm-arm/arch-rpc/serial.h index 8c33a7964..87e81c609 100644 --- a/include/asm-arm/arch-rpc/serial.h +++ b/include/asm-arm/arch-rpc/serial.h @@ -20,8 +20,10 @@ #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define RS_TABLE_SIZE 16 + /* UART CLK PORT IRQ FLAGS */ -#define SERIAL_PORT_DFNS \ +#define STD_SERIAL_PORT_DEFNS \ { 0, BASE_BAUD, 0x3F8, 10, STD_COM_FLAGS }, /* ttyS0 */ \ { 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS }, /* ttyS1 */ \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS2 */ \ @@ -35,6 +37,8 @@ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS10 */ \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS11 */ \ { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS12 */ \ - { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS }, /* ttyS13 */ + { 0, BASE_BAUD, 0 , 0, STD_COM_FLAGS } /* ttyS13 */ + +#define EXTRA_SERIAL_PORT_DEFNS #endif diff --git a/include/asm-arm/arch-sa1100/io.h b/include/asm-arm/arch-sa1100/io.h index 6c8d3711a..3e0001a1a 100644 --- a/include/asm-arm/arch-sa1100/io.h +++ b/include/asm-arm/arch-sa1100/io.h @@ -1,5 +1,5 @@ /* - * linux/include/asm-arm/arch-ebsa285/io.h + * linux/include/asm-arm/arch-sa1100/io.h * * Copyright (C) 1997-1999 Russell King * @@ -10,37 +10,43 @@ #ifndef __ASM_ARM_ARCH_IO_H #define __ASM_ARM_ARCH_IO_H -/* - * This architecture does not require any delayed IO - */ -#undef ARCH_IO_DELAY +#define IO_SPACE_LIMIT 0xffffffff + +#define __io_pci(a) (PCIO_BASE + (a)) -#define __pci_io_addr(x) (PCIO_BASE + (unsigned int)(x)) +#define __ioaddr(p) __io_pci(p) -#define __inb(p) (*(volatile unsigned char *)__pci_io_addr(p)) -#define __inl(p) (*(volatile unsigned long *)__pci_io_addr(p)) +/* + * Generic virtual read/write + */ +#define __arch_getb(a) (*(volatile unsigned char *)(a)) +#define __arch_getl(a) (*(volatile unsigned long *)(a)) -extern __inline__ unsigned int __inw(unsigned int port) +extern __inline__ unsigned int __arch_getw(unsigned long a) { unsigned int value; - __asm__ __volatile__( - "ldr%?h %0, [%1, %2] @ inw" - : "=&r" (value) - : "r" (PCIO_BASE), "r" (port)); + __asm__ __volatile__("ldr%?h %0, [%1, #0] @ getw" + : "=&r" (value) + : "r" (a)); return value; } -#define __outb(v,p) (*(volatile unsigned char *)__pci_io_addr(p) = (v)) -#define __outl(v,p) (*(volatile unsigned long *)__pci_io_addr(p) = (v)) +#define __arch_putb(v,a) (*(volatile unsigned char *)(a) = (v)) +#define __arch_putl(v,a) (*(volatile unsigned long *)(a) = (v)) -extern __inline__ void __outw(unsigned int value, unsigned int port) +extern __inline__ void __arch_putw(unsigned int value, unsigned long a) { - __asm__ __volatile__( - "str%?h %0, [%1, %2] @ outw" - : : "r" (value), "r" (PCIO_BASE), "r" (port)); + __asm__ __volatile__("str%?h %0, [%1, #0] @ putw" + : : "r" (value), "r" (a)); } -#define __ioaddr(p) __pci_io_addr(p) +#define inb(p) __arch_getb(__io_pci(p)) +#define inw(p) __arch_getw(__io_pci(p)) +#define inl(p) __arch_getl(__io_pci(p)) + +#define outb(v,p) __arch_putb(v,__io_pci(p)) +#define outw(v,p) __arch_putw(v,__io_pci(p)) +#define outl(v,p) __arch_putl(v,__io_pci(p)) #endif diff --git a/include/asm-arm/arch-sa1100/irq.h b/include/asm-arm/arch-sa1100/irq.h index e81a99910..3289801ac 100644 --- a/include/asm-arm/arch-sa1100/irq.h +++ b/include/asm-arm/arch-sa1100/irq.h @@ -12,6 +12,8 @@ * 11-08-1999 PD SA1101 support added * 25-09-1999 RMK Merged into main ARM tree, cleaned up */ +#include <linux/config.h> + static inline unsigned int fixup_irq(unsigned int irq) { #ifdef CONFIG_SA1101 diff --git a/include/asm-arm/arch-sa1100/irqs.h b/include/asm-arm/arch-sa1100/irqs.h index f09145c77..246ad9344 100644 --- a/include/asm-arm/arch-sa1100/irqs.h +++ b/include/asm-arm/arch-sa1100/irqs.h @@ -4,6 +4,7 @@ * Copyright (C) 1996 Russell King * Copyright (C) 1998 Deborah Wallach (updates for SA1100/Brutus). */ +#include <linux/config.h> #ifdef CONFIG_SA1101 #define NR_IRQS 95 diff --git a/include/asm-arm/arch-sa1100/serial.h b/include/asm-arm/arch-sa1100/serial.h index ad7766ace..f57de7f4a 100644 --- a/include/asm-arm/arch-sa1100/serial.h +++ b/include/asm-arm/arch-sa1100/serial.h @@ -20,11 +20,13 @@ /* Standard COM flags */ #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define RS_TABLE_SIZE 4 + #define STD_SERIAL_PORT_DEFNS \ /* UART CLK PORT IRQ FLAGS */ \ { 0, BASE_BAUD, 0x3F8, IRQ_GPIO3, STD_COM_FLAGS }, /* ttyS0 */ \ { 0, BASE_BAUD, 0x2F8, IRQ_GPIO3, STD_COM_FLAGS }, /* ttyS1 */ \ { 0, BASE_BAUD, 0x3E8, IRQ_GPIO3, STD_COM_FLAGS }, /* ttyS2 */ \ - { 0, BASE_BAUD, 0x2E8, IRQ_GPIO3, STD_COM4_FLAGS }, /* ttyS3 */ + { 0, BASE_BAUD, 0x2E8, IRQ_GPIO3, STD_COM4_FLAGS } /* ttyS3 */ diff --git a/include/asm-arm/arch-sa1100/system.h b/include/asm-arm/arch-sa1100/system.h index 90dbe88f9..24072c298 100644 --- a/include/asm-arm/arch-sa1100/system.h +++ b/include/asm-arm/arch-sa1100/system.h @@ -3,6 +3,8 @@ * * Copyright (c) 1999 Nicolas Pitre <nico@visuaide.com> */ +#include <linux/config.h> + #ifdef CONFIG_SA1100_VICTOR #define arch_reset( x ) { \ @@ -14,10 +16,10 @@ #else -#define arch_reset( x ) { \ +#define arch_reset(x) { \ __asm__ volatile ( \ " mcr p15, 0, %0, c1, c0 @ MMU off\n" \ -" mov pc, #0\n" : : "r" (cpu_reset())); \ +" mov pc, #0\n" : : "r" (cpu_reset()) : "cc"); \ } #endif diff --git a/include/asm-arm/div64.h b/include/asm-arm/div64.h new file mode 100644 index 000000000..fc473b6f0 --- /dev/null +++ b/include/asm-arm/div64.h @@ -0,0 +1,33 @@ +#ifndef __ASM_ARM_DIV64 +#define __ASM_ARM_DIV64 + +/* + * unsigned long long division. Yuck Yuck! What is Linux coming to? + * This is 100% disgusting + */ +#define do_div(n,base) \ +({ \ + unsigned long __low, __low2, __high, __rem; \ + __low = (n) & 0xffffffff; \ + __high = (n) >> 32; \ + if (__high) { \ + __rem = __high % (unsigned long)base; \ + __high = __high / (unsigned long)base; \ + __low2 = __low >> 16; \ + __low2 += __rem << 16; \ + __rem = __low2 % (unsigned long)base; \ + __low2 = __low2 / (unsigned long)base; \ + __low = __low & 0xffff; \ + __low += __rem << 16; \ + __rem = __low % (unsigned long)base; \ + __low = __low / (unsigned long)base; \ + n = __low + (__low2 << 16) + (__high << 32); \ + } else { \ + __rem = __low % (unsigned long)base; \ + n = (__low / (unsigned long)base); \ + } \ + __rem; \ +}) + +#endif + diff --git a/include/asm-arm/fcntl.h b/include/asm-arm/fcntl.h index 9a3678193..60f155085 100644 --- a/include/asm-arm/fcntl.h +++ b/include/asm-arm/fcntl.h @@ -3,21 +3,23 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 #define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECTORY 040000 /* must be a directory */ +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECTORY 040000 /* must be a directory */ #define O_NOFOLLOW 0100000 /* don't follow links */ +#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ +#define O_LARGEFILE 0400000 #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get f_flags */ @@ -33,6 +35,10 @@ #define F_SETSIG 10 /* for sockets. */ #define F_GETSIG 11 /* for sockets. */ +#define F_GETLK64 12 /* using 'struct flock64' */ +#define F_SETLK64 13 +#define F_SETLKW64 14 + /* for F_[GET|SET]FL */ #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ @@ -60,4 +66,12 @@ struct flock { pid_t l_pid; }; +struct flock64 { + short l_type; + short l_whence; + loff_t l_start; + loff_t l_len; + pid_t l_pid; +}; + #endif diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h index a726d7afa..96dc9883d 100644 --- a/include/asm-arm/io.h +++ b/include/asm-arm/io.h @@ -1,7 +1,7 @@ /* * linux/include/asm-arm/io.h * - * Copyright (C) 1996 Russell King + * Copyright (C) 1996-1999 Russell King * * Modifications: * 16-Sep-1996 RMK Inlined the inx/outx functions & optimised for both @@ -10,217 +10,160 @@ * specific IO header files. * 27-Mar-1999 PJB Second parameter of memcpy_toio is const.. * 04-Apr-1999 PJB Added check_signature. + * 12-Dec-1999 RMK More cleanups */ #ifndef __ASM_ARM_IO_H #define __ASM_ARM_IO_H +#include <asm/arch/hardware.h> +#include <asm/arch/io.h> +#include <asm/proc/io.h> + +#define outb_p(val,port) outb((val),(port)) +#define outw_p(val,port) outw((val),(port)) +#define outl_p(val,port) outl((val),(port)) +#define inb_p(port) inb((port)) +#define inw_p(port) inw((port)) +#define inl_p(port) inl((port)) + +extern void outsb(unsigned int port, const void *from, int len); +extern void outsw(unsigned int port, const void *from, int len); +extern void outsl(unsigned int port, const void *from, int len); +extern void insb(unsigned int port, void *from, int len); +extern void insw(unsigned int port, void *from, int len); +extern void insl(unsigned int port, void *from, int len); + +#define outsb_p(port,from,len) outsb(port,from,len) +#define outsw_p(port,from,len) outsw(port,from,len) +#define outsl_p(port,from,len) outsl(port,from,len) +#define insb_p(port,to,len) insb(port,to,len) +#define insw_p(port,to,len) insw(port,to,len) +#define insl_p(port,to,len) insl(port,to,len) + #ifdef __KERNEL__ #ifndef NULL #define NULL ((void *) 0) #endif -extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); -extern void __iounmap(void *addr); - -#endif - -#include <asm/arch/hardware.h> #include <asm/arch/memory.h> -#include <asm/arch/io.h> -#include <asm/proc/io.h> -/* unsigned long virt_to_phys(void *x) */ -#define virt_to_phys(x) (__virt_to_phys((unsigned long)(x))) - -/* void *phys_to_virt(unsigned long x) */ -#define phys_to_virt(x) ((void *)(__phys_to_virt((unsigned long)(x)))) +extern __inline__ unsigned long virt_to_phys(volatile void *x) +{ + return __virt_to_phys((unsigned long)(x)); +} -/* - * Virtual view <-> DMA view memory address translations - * virt_to_bus: Used to translate the virtual address to an - * address suitable to be passed to set_dma_addr - * bus_to_virt: Used to convert an address for DMA operations - * to an address that the kernel can use. - */ -#define virt_to_bus(x) (__virt_to_bus((unsigned long)(x))) -#define bus_to_virt(x) ((void *)(__bus_to_virt((unsigned long)(x)))) +extern __inline__ void *phys_to_virt(unsigned long x) +{ + return (void *)(__phys_to_virt((unsigned long)(x))); +} /* - * These macros actually build the multi-value IO function prototypes + * Virtual <-> DMA view memory address translations */ -#define __OUTS(s,i,x) extern void outs##s(unsigned int port, const void *from, int len); -#define __INS(s,i,x) extern void ins##s(unsigned int port, void *to, int len); +#define virt_to_bus(x) (__virt_to_bus((unsigned long)(x))) +#define bus_to_virt(x) ((void *)(__bus_to_virt((unsigned long)(x)))) -#define __IO(s,i,x) \ - __OUTS(s,i,x) \ - __INS(s,i,x) - -__IO(b,"b",char) -__IO(w,"h",short) -__IO(l,"",long) +/* the following macro is depreciated */ +#define ioaddr(port) __ioaddr((port)) /* - * Note that due to the way __builtin_constant_t() works, you - * - can't use it inside an inline function (it will never be true) - * - you don't have to worry about side effects withing the __builtin.. + * ioremap and friends */ -#ifdef __outbc -#define outb(val,port) \ - (__builtin_constant_p((port)) ? __outbc((val),(port)) : __outb((val),(port))) -#else -#define outb(val,port) __outb((val),(port)) -#endif - -#ifdef __outwc -#define outw(val,port) \ - (__builtin_constant_p((port)) ? __outwc((val),(port)) : __outw((val),(port))) -#else -#define outw(val,port) __outw((val),(port)) -#endif - -#ifdef __outlc -#define outl(val,port) \ - (__builtin_constant_p((port)) ? __outlc((val),(port)) : __outl((val),(port))) -#else -#define outl(val,port) __outl((val),(port)) -#endif - -#ifdef __inbc -#define inb(port) \ - (__builtin_constant_p((port)) ? __inbc((port)) : __inb((port))) -#else -#define inb(port) __inb((port)) -#endif - -#ifdef __inwc -#define inw(port) \ - (__builtin_constant_p((port)) ? __inwc((port)) : __inw((port))) -#else -#define inw(port) __inw((port)) -#endif +extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); +extern void __iounmap(void *addr); -#ifdef __inlc -#define inl(port) \ - (__builtin_constant_p((port)) ? __inlc((port)) : __inl((port))) -#else -#define inl(port) __inl((port)) -#endif +#define ioremap(off,sz) __arch_ioremap((off),(sz),0) +#define ioremap_nocache(off,sz) __arch_ioremap((off),(sz),1) +#define iounmap(_addr) __iounmap(_addr) -/* - * This macro will give you the translated IO address for this particular - * architecture, which can be used with the out_t... functions. - */ -#ifdef __ioaddrc -#define ioaddr(port) \ - (__builtin_constant_p((port)) ? __ioaddrc((port)) : __ioaddr((port))) -#else -#define ioaddr(port) __ioaddr((port)) -#endif +extern void __readwrite_bug(const char *fn); -#ifndef ARCH_IO_DELAY /* - * This architecture does not require any delayed IO. - * It is handled in the hardware. + * String version of IO memory access ops: */ -#define outb_p(val,port) outb((val),(port)) -#define outw_p(val,port) outw((val),(port)) -#define outl_p(val,port) outl((val),(port)) -#define inb_p(port) inb((port)) -#define inw_p(port) inw((port)) -#define inl_p(port) inl((port)) -#define outsb_p(port,from,len) outsb(port,from,len) -#define outsw_p(port,from,len) outsw(port,from,len) -#define outsl_p(port,from,len) outsl(port,from,len) -#define insb_p(port,to,len) insb(port,to,len) -#define insw_p(port,to,len) insw(port,to,len) -#define insl_p(port,to,len) insl(port,to,len) - -#else +extern void _memcpy_fromio(void *, unsigned long, unsigned long); +extern void _memcpy_toio(unsigned long, const void *, unsigned long); +extern void _memset_io(unsigned long, int, unsigned long); /* - * We have to delay the IO... + * If this architecture has PCI memory IO, then define the read/write + * macros. */ -#ifdef __outbc_p -#define outb_p(val,port) \ - (__builtin_constant_p((port)) ? __outbc_p((val),(port)) : __outb_p((val),(port))) -#else -#define outb_p(val,port) __outb_p((val),(port)) -#endif - -#ifdef __outwc_p -#define outw_p(val,port) \ - (__builtin_constant_p((port)) ? __outwc_p((val),(port)) : __outw_p((val),(port))) -#else -#define outw_p(val,port) __outw_p((val),(port)) -#endif +#ifdef __mem_pci -#ifdef __outlc_p -#define outl_p(val,port) \ - (__builtin_constant_p((port)) ? __outlc_p((val),(port)) : __outl_p((val),(port))) -#else -#define outl_p(val,port) __outl_p((val),(port)) -#endif +#define readb(addr) __arch_getb(__mem_pci(addr)) +#define readw(addr) __arch_getw(__mem_pci(addr)) +#define readl(addr) __arch_getl(__mem_pci(addr)) +#define writeb(val,addr) __arch_putb(val,__mem_pci(addr)) +#define writew(val,addr) __arch_putw(val,__mem_pci(addr)) +#define writel(val,addr) __arch_putl(val,__mem_pci(addr)) -#ifdef __inbc_p -#define inb_p(port) \ - (__builtin_constant_p((port)) ? __inbc_p((port)) : __inb_p((port))) -#else -#define inb_p(port) __inb_p((port)) -#endif +#define memset_io(a,b,c) _memset_io(__mem_pci(a),(b),(c)) +#define memcpy_fromio(a,b,c) _memcpy_fromio((a),__mem_pci(b),(c)) +#define memcpy_toio(a,b,c) _memcpy_toio(__mem_pci(a),(b),(c)) -#ifdef __inwc_p -#define inw_p(port) \ - (__builtin_constant_p((port)) ? __inwc_p((port)) : __inw_p((port))) -#else -#define inw_p(port) __inw_p((port)) -#endif - -#ifdef __inlc_p -#define inl_p(port) \ - (__builtin_constant_p((port)) ? __inlc_p((port)) : __inl_p((port))) -#else -#define inl_p(port) __inl_p((port)) -#endif +#define eth_io_copy_and_sum(a,b,c,d) \ + eth_copy_and_sum((a),__mem_pci(b),(c),(d)) -#endif - -extern void __readwrite_bug(const char *fn); +static inline int +check_signature(unsigned long io_addr, const unsigned char *signature, + int length) +{ + int retval = 0; + do { + if (readb(io_addr) != *signature) + goto out; + io_addr++; + signature++; + length--; + } while (length); + retval = 1; +out: + return retval; +} -#ifndef ARCH_READWRITE +#else /* __mem_pci */ -#define readb(p) (__readwrite_bug("readb"),0) -#define readw(p) (__readwrite_bug("readw"),0) -#define readl(p) (__readwrite_bug("readl"),0) -#define writeb(v,p) __readwrite_bug("writeb") -#define writew(v,p) __readwrite_bug("writew") -#define writel(v,p) __readwrite_bug("writel") +#define readb(addr) (__readwrite_bug("readb"),0) +#define readw(addr) (__readwrite_bug("readw"),0) +#define readl(addr) (__readwrite_bug("readl"),0) +#define writeb(v,addr) __readwrite_bug("writeb") +#define writew(v,addr) __readwrite_bug("writew") +#define writel(v,addr) __readwrite_bug("writel") -#endif +#define eth_io_copy_and_sum(a,b,c,d) __readwrite_bug("eth_io_copy_and_sum") -#ifndef memcpy_fromio -/* - * String version of IO memory access ops: - */ -extern void _memcpy_fromio(void *, unsigned long, unsigned long); -extern void _memcpy_toio(unsigned long, const void *, unsigned long); -extern void _memset_io(unsigned long, int, unsigned long); +#define check_signature(io,sig,len) (0) -#define memcpy_fromio(to,from,len) _memcpy_fromio((to),(unsigned long)(from),(len)) -#define memcpy_toio(to,from,len) _memcpy_toio((unsigned long)(to),(from),(len)) -#define memset_io(addr,c,len) _memset_io((unsigned long)(addr),(c),(len)) -#endif +#endif /* __mem_pci */ /* - * This isn't especially architecture dependent so it seems like it - * might as well go here as anywhere. + * If this architecture has ISA IO, then define the isa_read/isa_write + * macros. */ -static inline int check_signature(unsigned long io_addr, - const unsigned char *signature, int length) +#ifdef __mem_isa + +#define isa_readb(addr) __arch_getb(__mem_isa(addr)) +#define isa_readw(addr) __arch_getw(__mem_isa(addr)) +#define isa_readl(addr) __arch_getl(__mem_isa(addr)) +#define isa_writeb(val,addr) __arch_putb(val,__mem_isa(addr)) +#define isa_writew(val,addr) __arch_putw(val,__mem_isa(addr)) +#define isa_writel(val,addr) __arch_putl(val,__mem_isa(addr)) +#define isa_memset_io(a,b,c) _memset_io(__mem_isa(a),(b),(c)) +#define isa_memcpy_fromio(a,b,c) _memcpy_fromio((a),__mem_isa((b)),(c)) +#define isa_memcpy_toio(a,b,c) _memcpy_toio(__mem_isa((a)),(b),(c)) + +#define isa_eth_io_copy_and_sum(a,b,c,d) \ + eth_copy_and_sum((a),__mem_isa((b),(c),(d)) + +static inline int +isa_check_signature(unsigned long io_addr, const unsigned char *signature, + int length) { int retval = 0; do { - if (readb(io_addr) != *signature) + if (isa_readb(io_addr) != *signature) goto out; io_addr++; signature++; @@ -231,9 +174,23 @@ out: return retval; } -#undef ARCH_READWRITE -#undef ARCH_IO_DELAY -#undef ARCH_IO_CONSTANT +#else /* __mem_isa */ -#endif +#define isa_readb(addr) (__readwrite_bug("isa_readb"),0) +#define isa_readw(addr) (__readwrite_bug("isa_readw"),0) +#define isa_readl(addr) (__readwrite_bug("isa_readl"),0) +#define isa_writeb(val,addr) __readwrite_bug("isa_writeb") +#define isa_writew(val,addr) __readwrite_bug("isa_writew") +#define isa_writel(val,addr) __readwrite_bug("isa_writel") +#define isa_memset_io(a,b,c) __readwrite_bug("isa_memset_io") +#define isa_memcpy_fromio(a,b,c) __readwrite_bug("isa_memcpy_fromio") +#define isa_memcpy_toio(a,b,c) __readwrite_bug("isa_memcpy_toio") + +#define isa_eth_io_copy_and_sum(a,b,c,d) \ + __readwrite_bug("isa_eth_io_copy_and_sum") + +#define isa_check_signature(io,sig,len) (0) +#endif /* __mem_isa */ +#endif /* __KERNEL__ */ +#endif /* __ASM_ARM_IO_H */ diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h index 20edac085..7ea5157ec 100644 --- a/include/asm-arm/page.h +++ b/include/asm-arm/page.h @@ -69,9 +69,9 @@ extern void __bug(const char *file, int line, void *data); #include <asm/arch/memory.h> -#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 __pa(x) ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET) +#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET)) +#define MAP_NR(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> PAGE_SHIFT) #endif diff --git a/include/asm-arm/pgalloc.h b/include/asm-arm/pgalloc.h new file mode 100644 index 000000000..841855ef8 --- /dev/null +++ b/include/asm-arm/pgalloc.h @@ -0,0 +1,205 @@ +/* + * linux/include/asm-arm/pgalloc.h + */ +#ifndef _ASMARM_PGALLOC_H +#define _ASMARM_PGALLOC_H + +#include <linux/config.h> +#include <linux/threads.h> + +#include <asm/processor.h> + +/* + * Get the cache handling stuff now. + */ +#include <asm/proc/cache.h> + +/* + * Page table cache stuff + */ +#ifndef CONFIG_NO_PGT_CACHE + +#ifdef __SMP__ +#error Pgtable caches have to be per-CPU, so that no locking is needed. +#endif /* __SMP__ */ + +extern struct pgtable_cache_struct { + unsigned long *pgd_cache; + unsigned long *pte_cache; + unsigned long pgtable_cache_sz; +} quicklists; + +#define pgd_quicklist (quicklists.pgd_cache) +#define pmd_quicklist ((unsigned long *)0) +#define pte_quicklist (quicklists.pte_cache) +#define pgtable_cache_size (quicklists.pgtable_cache_sz) + +/* used for quicklists */ +#define __pgd_next(pgd) (((unsigned long *)pgd)[1]) +#define __pte_next(pte) (((unsigned long *)pte)[0]) + +extern __inline__ pgd_t *get_pgd_fast(void) +{ + unsigned long *ret; + + if ((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)__pgd_next(ret); + ret[1] = ret[2]; + clean_cache_area(ret + 1, 4); + pgtable_cache_size--; + } + return (pgd_t *)ret; +} + +extern __inline__ void free_pgd_fast(pgd_t *pgd) +{ + __pgd_next(pgd) = (unsigned long) pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + pgtable_cache_size++; +} + +/* We don't use pmd cache, so this is a dummy routine */ +#define get_pmd_fast() ((pmd_t *)0) + +extern __inline__ void free_pmd_fast(pmd_t *pmd) +{ +} + +extern __inline__ pte_t *get_pte_fast(void) +{ + unsigned long *ret; + + if((ret = pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)__pte_next(ret); + ret[0] = ret[1]; + clean_cache_area(ret, 4); + pgtable_cache_size--; + } + return (pte_t *)ret; +} + +extern __inline__ void free_pte_fast(pte_t *pte) +{ + __pte_next(pte) = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pte; + pgtable_cache_size++; +} + +#else /* CONFIG_NO_PGT_CACHE */ + +#define pgd_quicklist ((unsigned long *)0) +#define pmd_quicklist ((unsigned long *)0) +#define pte_quicklist ((unsigned long *)0) + +#define get_pgd_fast() ((pgd_t *)0) +#define get_pmd_fast() ((pmd_t *)0) +#define get_pte_fast() ((pte_t *)0) + +#define free_pgd_fast(pgd) free_pgd_slow(pgd) +#define free_pmd_fast(pmd) free_pmd_slow(pmd) +#define free_pte_fast(pte) free_pte_slow(pte) + +#endif /* CONFIG_NO_PGT_CACHE */ + +extern pgd_t *get_pgd_slow(void); +extern void free_pgd_slow(pgd_t *pgd); + +#define free_pmd_slow(pmd) do { } while (0) + +extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long addr_preadjusted); +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long addr_preadjusted); +extern void free_pte_slow(pte_t *pte); + +/* + * Allocate and free page tables. The xxx_kernel() versions are + * used to allocate a kernel page table - this turns on ASN bits + * if any. + */ +#define pte_free_kernel(pte) free_pte_fast(pte) +#define pte_free(pte) free_pte_fast(pte) + +#ifndef pte_alloc_kernel +extern __inline__ pte_t * pte_alloc_kernel(pmd_t *pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + if (pmd_none(*pmd)) { + pte_t *page = (pte_t *) get_pte_fast(); + + if (!page) + return get_pte_kernel_slow(pmd, address); + set_pmd(pmd, mk_kernel_pmd(page)); + return page + address; + } + if (pmd_bad(*pmd)) { + __handle_bad_pmd_kernel(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} +#endif + +extern __inline__ pte_t *pte_alloc(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + if (pmd_none(*pmd)) { + pte_t *page = (pte_t *) get_pte_fast(); + + if (!page) + return get_pte_slow(pmd, address); + set_pmd(pmd, mk_user_pmd(page)); + return page + address; + } + if (pmd_bad(*pmd)) { + __handle_bad_pmd(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} + +#define pmd_free_kernel pmd_free +#define pmd_free(pmd) do { } while (0) + +#define pmd_alloc_kernel pmd_alloc +extern __inline__ pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address) +{ + return (pmd_t *) pgd; +} + +#define pgd_free(pgd) free_pgd_fast(pgd) + +extern __inline__ pgd_t *pgd_alloc(void) +{ + pgd_t *pgd; + + pgd = get_pgd_fast(); + if (!pgd) + pgd = get_pgd_slow(); + + return pgd; +} + +extern int do_check_pgt_cache(int, int); + +extern __inline__ void set_pgdir(unsigned long address, pgd_t entry) +{ + struct task_struct * p; + + read_lock(&tasklist_lock); + for_each_task(p) { + if (!p->mm) + continue; + *pgd_offset(p->mm,address) = entry; + } + read_unlock(&tasklist_lock); + +#ifndef CONFIG_NO_PGT_CACHE + { + pgd_t *pgd; + for (pgd = (pgd_t *)pgd_quicklist; pgd; + pgd = (pgd_t *)__pgd_next(pgd)) + pgd[address >> PGDIR_SHIFT] = entry; + } +#endif +} + +#endif diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h index b9fb442d7..033541764 100644 --- a/include/asm-arm/pgtable.h +++ b/include/asm-arm/pgtable.h @@ -4,8 +4,6 @@ #ifndef _ASMARM_PGTABLE_H #define _ASMARM_PGTABLE_H -#include <linux/config.h> - #include <asm/arch/memory.h> #include <asm/proc-fns.h> #include <asm/system.h> @@ -67,7 +65,7 @@ extern void __pgd_error(const char *file, int line, unsigned long val); * ZERO_PAGE is a global shared page that is always zero: used * for zero-mapped memory areas etc.. */ -struct page *empty_zero_page; +extern struct page *empty_zero_page; #define ZERO_PAGE(vaddr) (empty_zero_page) /* @@ -86,21 +84,11 @@ extern void __handle_bad_pmd_kernel(pmd_t *pmd); /* * Permanent address of a page. */ -#define page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) +#define page_address(page) ({ if (!(page)->virtual) BUG(); (page)->virtual; }) #define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) #define pte_page(x) (mem_map + pte_pagenr(x)) /* - * The "pgd_xxx()" functions here are trivial for a folded two-level - * setup: the pgd is never bad, and a pmd always exists (as it's folded - * into the pgd entry) - */ -#define pgd_none(pgd) (0) -#define pgd_bad(pgd) (0) -#define pgd_present(pgd) (1) -#define pgd_clear(pgdp) - -/* * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ @@ -111,12 +99,24 @@ extern __inline__ pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) return pte; } -extern __inline__ pte_t mk_pte(struct page *page, pgprot_t pgprot) -{ - pte_t pte; - pte_val(pte) = (PHYS_OFFSET + ((page - mem_map) << PAGE_SHIFT)) | pgprot_val(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; \ +}) + +/* + * The "pgd_xxx()" functions here are trivial for a folded two-level + * setup: the pgd is never bad, and a pmd always exists (as it's folded + * into the pgd entry) + */ +#define pgd_none(pgd) (0) +#define pgd_bad(pgd) (0) +#define pgd_present(pgd) (1) +#define pgd_clear(pgdp) #define page_pte_prot(page,prot) mk_pte(page, prot) #define page_pte(page) mk_pte(page, __pgprot(0)) @@ -136,107 +136,6 @@ extern __inline__ pte_t mk_pte(struct page *page, pgprot_t pgprot) #define __pte_offset(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) #define pte_offset(dir, addr) ((pte_t *)pmd_page(*(dir)) + __pte_offset(addr)) -/* - * Get the cache handling stuff now. - */ -#include <asm/proc/cache.h> - -/* - * Page table cache stuff - */ -#ifndef CONFIG_NO_PGT_CACHE - -#ifdef __SMP__ -#error Pgtable caches have to be per-CPU, so that no locking is needed. -#endif /* __SMP__ */ - -extern struct pgtable_cache_struct { - unsigned long *pgd_cache; - unsigned long *pte_cache; - unsigned long pgtable_cache_sz; -} quicklists; - -#define pgd_quicklist (quicklists.pgd_cache) -#define pmd_quicklist ((unsigned long *)0) -#define pte_quicklist (quicklists.pte_cache) -#define pgtable_cache_size (quicklists.pgtable_cache_sz) - -/* used for quicklists */ -#define __pgd_next(pgd) (((unsigned long *)pgd)[1]) -#define __pte_next(pte) (((unsigned long *)pte)[0]) - -extern __inline__ pgd_t *get_pgd_fast(void) -{ - unsigned long *ret; - - if ((ret = pgd_quicklist) != NULL) { - pgd_quicklist = (unsigned long *)__pgd_next(ret); - ret[1] = ret[2]; - clean_cache_area(ret + 1, 4); - pgtable_cache_size--; - } - return (pgd_t *)ret; -} - -extern __inline__ void free_pgd_fast(pgd_t *pgd) -{ - __pgd_next(pgd) = (unsigned long) pgd_quicklist; - pgd_quicklist = (unsigned long *) pgd; - pgtable_cache_size++; -} - -/* We don't use pmd cache, so this is a dummy routine */ -#define get_pmd_fast() ((pmd_t *)0) - -extern __inline__ void free_pmd_fast(pmd_t *pmd) -{ -} - -extern __inline__ pte_t *get_pte_fast(void) -{ - unsigned long *ret; - - if((ret = pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)__pte_next(ret); - ret[0] = ret[1]; - clean_cache_area(ret, 4); - pgtable_cache_size--; - } - return (pte_t *)ret; -} - -extern __inline__ void free_pte_fast(pte_t *pte) -{ - __pte_next(pte) = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pte; - pgtable_cache_size++; -} - -#else /* CONFIG_NO_PGT_CACHE */ - -#define pgd_quicklist ((unsigned long *)0) -#define pmd_quicklist ((unsigned long *)0) -#define pte_quicklist ((unsigned long *)0) - -#define get_pgd_fast() ((pgd_t *)0) -#define get_pmd_fast() ((pmd_t *)0) -#define get_pte_fast() ((pte_t *)0) - -#define free_pgd_fast(pgd) free_pgd_slow(pgd) -#define free_pmd_fast(pmd) free_pmd_slow(pmd) -#define free_pte_fast(pte) free_pte_slow(pte) - -#endif /* CONFIG_NO_PGT_CACHE */ - -extern pgd_t *get_pgd_slow(void); -extern void free_pgd_slow(pgd_t *pgd); - -#define free_pmd_slow(pmd) do { } while (0) - -extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long addr_preadjusted); -extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long addr_preadjusted); -extern void free_pte_slow(pte_t *pte); - #include <asm/proc/pgtable.h> extern __inline__ pte_t pte_modify(pte_t pte, pgprot_t newprot) @@ -245,131 +144,25 @@ extern __inline__ pte_t pte_modify(pte_t pte, pgprot_t newprot) return pte; } -/* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any. - */ -#define pte_free_kernel(pte) free_pte_fast(pte) -#define pte_free(pte) free_pte_fast(pte) - -#ifndef pte_alloc_kernel -extern __inline__ pte_t * pte_alloc_kernel(pmd_t *pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - pte_t *page = (pte_t *) get_pte_fast(); - - if (!page) - return get_pte_kernel_slow(pmd, address); - set_pmd(pmd, mk_kernel_pmd(page)); - return page + address; - } - if (pmd_bad(*pmd)) { - __handle_bad_pmd_kernel(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} -#endif - -extern __inline__ pte_t *pte_alloc(pmd_t * pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - pte_t *page = (pte_t *) get_pte_fast(); - - if (!page) - return get_pte_slow(pmd, address); - set_pmd(pmd, mk_user_pmd(page)); - return page + address; - } - if (pmd_bad(*pmd)) { - __handle_bad_pmd(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} - -#define pmd_free_kernel pmd_free -#define pmd_free(pmd) do { } while (0) - -#define pmd_alloc_kernel pmd_alloc -extern __inline__ pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address) -{ - return (pmd_t *) pgd; -} - -#define pgd_free(pgd) free_pgd_fast(pgd) - -extern __inline__ pgd_t *pgd_alloc(void) -{ - pgd_t *pgd; - - pgd = get_pgd_fast(); - if (!pgd) - pgd = get_pgd_slow(); - - return pgd; -} - -extern int do_check_pgt_cache(int, int); - -extern __inline__ void set_pgdir(unsigned long address, pgd_t entry) -{ - struct task_struct * p; - - read_lock(&tasklist_lock); - for_each_task(p) { - if (!p->mm) - continue; - *pgd_offset(p->mm,address) = entry; - } - read_unlock(&tasklist_lock); - -#ifndef CONFIG_NO_PGT_CACHE - { - pgd_t *pgd; - for (pgd = (pgd_t *)pgd_quicklist; pgd; - pgd = (pgd_t *)__pgd_next(pgd)) - pgd[address >> PGDIR_SHIFT] = entry; - } -#endif -} - extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; -#define update_mmu_cache(vma,address,pte) +#define update_mmu_cache(vma,address,pte) do { } while (0) -/* +/* Encode and decode a swap entry. + * * We support up to 32GB of swap on 4k machines */ -#define SWP_TYPE(entry) (((pte_val(entry)) >> 2) & 0x7f) -#define SWP_OFFSET(entry) ((pte_val(entry)) >> 9) -#define SWP_ENTRY(type,offset) __pte((((type) << 2) | ((offset) << 9))) +#define SWP_TYPE(x) (((x).val >> 2) & 0x7f) +#define SWP_OFFSET(x) ((x).val >> 9) +#define SWP_ENTRY(type,offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 9) }) +#define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) +#define swp_entry_to_pte(swp) ((pte_t) { (swp).val }) #define module_map vmalloc #define module_unmap vfree -/* - * We rely on GCC optimising this code away for - * architectures which it doesn't apply to. Note - * that `addr' is checked against PAGE_OFFSET and - * end_mem by the calling code. - */ -#define __kern_valid_idx(a) (((a) - PAGE_OFFSET) >> 20) - -extern __inline__ int __kern_valid_addr(unsigned long addr) -{ - extern unsigned long *valid_addr_bitmap; - unsigned int idx = __kern_valid_idx(addr); - - return test_bit(idx, valid_addr_bitmap); -} - /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ #define PageSkip(page) (machine_is_riscpc() && test_bit(PG_skip, &(page)->flags)) -#define kern_addr_valid(addr) (!machine_is_riscpc() || __kern_valid_addr(addr)) #define io_remap_page_range remap_page_range diff --git a/include/asm-arm/proc-armo/processor.h b/include/asm-arm/proc-armo/processor.h index 049e2c054..6562ee712 100644 --- a/include/asm-arm/proc-armo/processor.h +++ b/include/asm-arm/proc-armo/processor.h @@ -67,6 +67,9 @@ extern uaccess_t uaccess_user, uaccess_kernel; regs->ARM_r0 = stack[0]; /* r0 (argc) */ \ }) +#define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022]) +#define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1020]) + /* Allocation and freeing of basic task resources. */ /* * NOTE! The task struct and the stack go together @@ -74,8 +77,6 @@ extern uaccess_t uaccess_user, uaccess_kernel; extern unsigned long get_page_8k(int priority); extern void free_page_8k(unsigned long page); -#define THREAD_SIZE (8192) - #define ll_alloc_task_struct() ((struct task_struct *)get_page_8k(GFP_KERNEL)) #define ll_free_task_struct(p) free_page_8k((unsigned long)(p)) diff --git a/include/asm-arm/proc-armv/cache.h b/include/asm-arm/proc-armv/cache.h index 5e700bfad..ac136d6ef 100644 --- a/include/asm-arm/proc-armv/cache.h +++ b/include/asm-arm/proc-armv/cache.h @@ -56,8 +56,7 @@ */ static __inline__ void flush_page_to_ram(struct page *page) { - unsigned long virt = page_address(page); - cpu_flush_ram_page(virt); + cpu_flush_ram_page(page_address(page)); } /* diff --git a/include/asm-arm/proc-armv/processor.h b/include/asm-arm/proc-armv/processor.h index 48b57243a..9ddfd0028 100644 --- a/include/asm-arm/proc-armv/processor.h +++ b/include/asm-arm/proc-armv/processor.h @@ -57,11 +57,13 @@ struct context_save_struct { regs->ARM_r0 = stack[0]; /* r0 (argc) */ \ }) +#define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1021]) +#define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019]) + /* Allocation and freeing of basic task resources. */ /* * NOTE! The task struct and the stack go together */ -#define THREAD_SIZE (PAGE_SIZE * 2) #define ll_alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1)) #define ll_free_task_struct(p) free_pages((unsigned long)(p),1) diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h index bac831217..ce080d4ad 100644 --- a/include/asm-arm/processor.h +++ b/include/asm-arm/processor.h @@ -34,6 +34,7 @@ typedef unsigned long mm_segment_t; /* domain register */ #define NR_DEBUGS 5 +#include <asm/atomic.h> #include <asm/ptrace.h> #include <asm/arch/memory.h> #include <asm/arch/processor.h> @@ -48,6 +49,7 @@ struct debug_info { }; struct thread_struct { + atomic_t refcount; /* fault info */ unsigned long address; unsigned long trap_no; @@ -65,6 +67,7 @@ struct thread_struct { { &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } #define INIT_THREAD { \ + ATOMIC_INIT(1), \ 0, \ 0, \ 0, \ @@ -109,16 +112,17 @@ extern void release_thread(struct task_struct *); unsigned long get_wchan(struct task_struct *p); -#ifdef CONFIG_CPU_26 -# define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022]) -# define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1020]) -#else -# define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1021]) -# define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019]) -#endif +#define THREAD_SIZE (8192) extern struct task_struct *alloc_task_struct(void); -extern void free_task_struct(struct task_struct *); +extern void __free_task_struct(struct task_struct *); +#define get_task_struct(p) atomic_inc(&(p)->thread.refcount) +#define put_task_struct(p) free_task_struct(p) +#define free_task_struct(p) \ + do { \ + if (atomic_dec_and_test(&(p)->thread.refcount)) \ + __free_task_struct((p)); \ + } while (0) #define init_task (init_task_union.task) #define init_stack (init_task_union.stack) diff --git a/include/asm-arm/resource.h b/include/asm-arm/resource.h index b5c6ccc6f..aea5122a0 100644 --- a/include/asm-arm/resource.h +++ b/include/asm-arm/resource.h @@ -18,6 +18,12 @@ #define RLIM_NLIMITS 10 +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + */ +#define RLIM_INFINITY (~0UL) + #ifdef __KERNEL__ #define INIT_RLIMITS \ diff --git a/include/asm-arm/serial.h b/include/asm-arm/serial.h index 3e1513a45..88d57fe07 100644 --- a/include/asm-arm/serial.h +++ b/include/asm-arm/serial.h @@ -12,4 +12,8 @@ #include <asm/arch/serial.h> +#define SERIAL_PORT_DFNS \ + STD_SERIAL_PORT_DEFNS \ + EXTRA_SERIAL_PORT_DEFNS + #endif diff --git a/include/asm-arm/signal.h b/include/asm-arm/signal.h index 12ec642aa..afca084cb 100644 --- a/include/asm-arm/signal.h +++ b/include/asm-arm/signal.h @@ -63,6 +63,7 @@ typedef unsigned long sigset_t; #define SIGLOST 29 */ #define SIGPWR 30 +#define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ diff --git a/include/asm-arm/vga.h b/include/asm-arm/vga.h index 19c454396..926e5ee12 100644 --- a/include/asm-arm/vga.h +++ b/include/asm-arm/vga.h @@ -6,7 +6,7 @@ #define VGA_MAP_MEM(x) (PCIMEM_BASE + (x)) -#define vga_readb(x) (*(x)) -#define vga_writeb(x,y) (*(y) = (x)) +#define vga_readb(x) (*((volatile unsigned char *)x)) +#define vga_writeb(x,y) (*((volatile unsigned char *)y) = (x)) #endif diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h index 6346f91d1..0112f9b35 100644 --- a/include/asm-i386/atomic.h +++ b/include/asm-i386/atomic.h @@ -46,6 +46,17 @@ static __inline__ void atomic_sub(int i, volatile atomic_t *v) :"ir" (i), "m" (__atomic_fool_gcc(v))); } +static __inline__ int atomic_sub_and_test(int i, volatile atomic_t *v) +{ + unsigned char c; + + __asm__ __volatile__( + LOCK "subl %2,%0; sete %1" + :"=m" (__atomic_fool_gcc(v)), "=qm" (c) + :"ir" (i), "m" (__atomic_fool_gcc(v))); + return c; +} + static __inline__ void atomic_inc(volatile atomic_t *v) { __asm__ __volatile__( diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index 08df0f278..86068d069 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h @@ -132,8 +132,7 @@ extern __inline__ int find_first_zero_bit(void * addr, unsigned size) if (!size) return 0; - __asm__("cld\n\t" - "movl $-1,%%eax\n\t" + __asm__("movl $-1,%%eax\n\t" "xorl %%edx,%%edx\n\t" "repe; scasl\n\t" "je 1f\n\t" diff --git a/include/asm-i386/cache.h b/include/asm-i386/cache.h index 379568491..7260b50e4 100644 --- a/include/asm-i386/cache.h +++ b/include/asm-i386/cache.h @@ -11,16 +11,4 @@ #define L1_CACHE_BYTES 16 #endif -#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) - -#define SMP_CACHE_BYTES L1_CACHE_BYTES - -#ifdef MODULE -#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES))) -#else -#define __cacheline_aligned \ - __attribute__((__aligned__(L1_CACHE_BYTES), \ - __section__(".data.cacheline_aligned"))) -#endif - #endif diff --git a/include/asm-i386/e820.h b/include/asm-i386/e820.h index 50b708d91..47cd4856c 100644 --- a/include/asm-i386/e820.h +++ b/include/asm-i386/e820.h @@ -18,7 +18,8 @@ #define E820_RAM 1 #define E820_RESERVED 2 -#define E820_ACPI 3 +#define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ +#define E820_NVS 4 #define HIGH_MEMORY (1024*1024) diff --git a/include/asm-i386/hardirq.h b/include/asm-i386/hardirq.h index f96faa806..4679cb3ef 100644 --- a/include/asm-i386/hardirq.h +++ b/include/asm-i386/hardirq.h @@ -17,8 +17,8 @@ extern unsigned int local_irq_count[NR_CPUS]; #define hardirq_trylock(cpu) (local_irq_count[cpu] == 0) #define hardirq_endlock(cpu) do { } while (0) -#define hardirq_enter(cpu) (local_irq_count[cpu]++) -#define hardirq_exit(cpu) (local_irq_count[cpu]--) +#define irq_enter(cpu, irq) (local_irq_count[cpu]++) +#define irq_exit(cpu, irq) (local_irq_count[cpu]--) #define synchronize_irq() barrier() @@ -39,13 +39,17 @@ static inline void release_irqlock(int cpu) } } -static inline void hardirq_enter(int cpu) +static inline void irq_enter(int cpu, int irq) { ++local_irq_count[cpu]; atomic_inc(&global_irq_count); + + while (test_bit(0,&global_irq_lock)) { + /* nothing */; + } } -static inline void hardirq_exit(int cpu) +static inline void irq_exit(int cpu, int irq) { atomic_dec(&global_irq_count); --local_irq_count[cpu]; diff --git a/include/asm-i386/highmem.h b/include/asm-i386/highmem.h index d17d108c7..0964c435d 100644 --- a/include/asm-i386/highmem.h +++ b/include/asm-i386/highmem.h @@ -20,6 +20,7 @@ #ifdef __KERNEL__ +#include <linux/config.h> #include <linux/init.h> #include <linux/interrupt.h> #include <asm/kmap_types.h> @@ -37,7 +38,20 @@ extern pte_t *pkmap_page_table; extern void kmap_init(void) __init; -#define PKMAP_BASE (0xff000000UL) +/* + * Right now we initialize only a single pte table. It can be extended + * easily, subsequent pte tables have to be allocated in one physical + * chunk of RAM. + */ +#define PKMAP_BASE (0xfe000000UL) +#ifdef CONFIG_X86_PAE +#define LAST_PKMAP 512 +#else +#define LAST_PKMAP 1024 +#endif +#define LAST_PKMAP_MASK (LAST_PKMAP-1) +#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) +#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) extern unsigned long FASTCALL(kmap_high(struct page *page)); extern void FASTCALL(kunmap_high(struct page *page)); diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h index 894055a7d..0a2e01c36 100644 --- a/include/asm-i386/hw_irq.h +++ b/include/asm-i386/hw_irq.h @@ -79,10 +79,10 @@ extern void init_8259A(int aeoi); extern void FASTCALL(send_IPI_self(int vector)); extern void init_VISWS_APIC_irqs(void); extern void setup_IO_APIC(void); +extern void disable_IO_APIC(void); +extern void print_IO_APIC(void); extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn); extern void send_IPI(int dest, int vector); -extern void init_pic_mode(void); -extern void print_IO_APIC(void); extern unsigned long io_apic_irqs; extern volatile unsigned long irq_err_count; diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h index 75cfb939b..7a4e9facc 100644 --- a/include/asm-i386/io.h +++ b/include/asm-i386/io.h @@ -71,12 +71,12 @@ __IN1(s##_p) __IN2(s,s1,"w") __FULL_SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i #define __INS(s) \ extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \ -{ __asm__ __volatile__ ("cld ; rep ; ins" #s \ +{ __asm__ __volatile__ ("rep ; ins" #s \ : "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } #define __OUTS(s) \ extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ -{ __asm__ __volatile__ ("cld ; rep ; outs" #s \ +{ __asm__ __volatile__ ("rep ; outs" #s \ : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } #define RETURN_TYPE unsigned char @@ -101,9 +101,10 @@ __OUTS(b) __OUTS(w) __OUTS(l) +#define IO_SPACE_LIMIT 0xffff + #ifdef __KERNEL__ -#include <asm/page.h> #include <linux/vmalloc.h> /* @@ -228,6 +229,22 @@ out: return retval; } +static inline int isa_check_signature(unsigned long io_addr, + const unsigned char *signature, int length) +{ + int retval = 0; + do { + if (isa_readb(io_addr) != *signature) + goto out; + io_addr++; + signature++; + length--; + } while (length); + retval = 1; +out: + return retval; +} + /* Nothing to do */ #define dma_cache_inv(_start,_size) do { } while (0) diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h index cd142e995..fb3af63ae 100644 --- a/include/asm-i386/mmu_context.h +++ b/include/asm-i386/mmu_context.h @@ -3,6 +3,7 @@ #include <asm/desc.h> #include <asm/atomic.h> +#include <asm/pgalloc.h> /* * possibly do the LDT unload here? @@ -10,9 +11,12 @@ #define destroy_context(mm) do { } while(0) #define init_new_context(tsk,mm) do { } while (0) +#ifdef __SMP__ +extern unsigned int cpu_tlbbad[NR_CPUS]; +#endif + static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu) { - if (prev != next) { /* * Re-load LDT if necessary @@ -24,6 +28,13 @@ 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__ + else { + if(cpu_tlbbad[cpu]) + local_flush_tlb(); + } + cpu_tlbbad[cpu] = 0; +#endif set_bit(cpu, &next->cpu_vm_mask); } diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h index 301db5816..c5e36bdf5 100644 --- a/include/asm-i386/page.h +++ b/include/asm-i386/page.h @@ -50,6 +50,9 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define pgd_val(x) ((x).pgd) #define pgprot_val(x) ((x).pgprot) +#define __pte(x) ((pte_t) { (x) } ) +#define __pmd(x) ((pmd_t) { (x) } ) +#define __pgd(x) ((pgd_t) { (x) } ) #define __pgprot(x) ((pgprot_t) { (x) } ) #endif /* !__ASSEMBLY__ */ diff --git a/include/asm-i386/pgalloc-2level.h b/include/asm-i386/pgalloc-2level.h new file mode 100644 index 000000000..4ff5ce3b7 --- /dev/null +++ b/include/asm-i386/pgalloc-2level.h @@ -0,0 +1,23 @@ +#ifndef _I386_PGALLOC_2LEVEL_H +#define _I386_PGALLOC_2LEVEL_H + +/* + * traditional i386 two-level paging, page table allocation routines: + */ + +extern __inline__ pmd_t *get_pmd_fast(void) +{ + return (pmd_t *)0; +} + +extern __inline__ void free_pmd_fast(pmd_t *pmd) { } +extern __inline__ void free_pmd_slow(pmd_t *pmd) { } + +extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) +{ + if (!pgd) + BUG(); + return (pmd_t *) pgd; +} + +#endif /* _I386_PGALLOC_2LEVEL_H */ diff --git a/include/asm-i386/pgalloc-3level.h b/include/asm-i386/pgalloc-3level.h new file mode 100644 index 000000000..30099a755 --- /dev/null +++ b/include/asm-i386/pgalloc-3level.h @@ -0,0 +1,68 @@ +#ifndef _I386_PGALLOC_3LEVEL_H +#define _I386_PGALLOC_3LEVEL_H + +/* + * Intel Physical Address Extension (PAE) Mode - three-level page + * tables on PPro+ CPUs. Page-table allocation routines. + * + * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> + */ + +extern __inline__ pmd_t *get_pmd_slow(void) +{ + pmd_t *ret = (pmd_t *)__get_free_page(GFP_KERNEL); + + if (ret) + memset(ret, 0, PAGE_SIZE); + return ret; +} + +extern __inline__ pmd_t *get_pmd_fast(void) +{ + unsigned long *ret; + + if ((ret = pmd_quicklist) != NULL) { + pmd_quicklist = (unsigned long *)(*ret); + ret[0] = 0; + pgtable_cache_size--; + } else + ret = (unsigned long *)get_pmd_slow(); + return (pmd_t *)ret; +} + +extern __inline__ void free_pmd_fast(pmd_t *pmd) +{ + *(unsigned long *)pmd = (unsigned long) pmd_quicklist; + pmd_quicklist = (unsigned long *) pmd; + pgtable_cache_size++; +} + +extern __inline__ void free_pmd_slow(pmd_t *pmd) +{ + free_page((unsigned long)pmd); +} + +extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) +{ + if (!pgd) + BUG(); + address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); + if (pgd_none(*pgd)) { + pmd_t *page = get_pmd_fast(); + + if (!page) + page = get_pmd_slow(); + if (page) { + if (pgd_none(*pgd)) { + set_pgd(pgd, __pgd(1 + __pa(page))); + __flush_tlb(); + return page + address; + } else + free_pmd_fast(page); + } else + return NULL; + } + return (pmd_t *)pgd_page(*pgd) + address; +} + +#endif /* _I386_PGALLOC_3LEVEL_H */ diff --git a/include/asm-i386/pgalloc.h b/include/asm-i386/pgalloc.h new file mode 100644 index 000000000..3cdfac12f --- /dev/null +++ b/include/asm-i386/pgalloc.h @@ -0,0 +1,264 @@ +#ifndef _I386_PGALLOC_H +#define _I386_PGALLOC_H + +#include <linux/config.h> +#include <asm/processor.h> +#include <asm/fixmap.h> +#include <linux/threads.h> + +#define pgd_quicklist (current_cpu_data.pgd_quick) +#define pmd_quicklist (current_cpu_data.pmd_quick) +#define pte_quicklist (current_cpu_data.pte_quick) +#define pgtable_cache_size (current_cpu_data.pgtable_cache_sz) + +#if CONFIG_X86_PAE +# include <asm/pgalloc-3level.h> +#else +# include <asm/pgalloc-2level.h> +#endif + +/* + * Allocate and free page tables. The xxx_kernel() versions are + * used to allocate a kernel page table - this turns on ASN bits + * if any. + */ + +extern __inline__ pgd_t *get_pgd_slow(void) +{ + pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL); + + if (ret) { +#if CONFIG_X86_PAE + int i; + for (i = 0; i < USER_PTRS_PER_PGD; i++) + __pgd_clear(ret + i); +#else + memset(ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); +#endif + memcpy(ret + USER_PTRS_PER_PGD, swapper_pg_dir + USER_PTRS_PER_PGD, (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); + } + return ret; +} + +extern __inline__ pgd_t *get_pgd_fast(void) +{ + unsigned long *ret; + + if ((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)(*ret); + ret[0] = 0; + pgtable_cache_size--; + } else + ret = (unsigned long *)get_pgd_slow(); + return (pgd_t *)ret; +} + +extern __inline__ void free_pgd_fast(pgd_t *pgd) +{ + *(unsigned long *)pgd = (unsigned long) pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + pgtable_cache_size++; +} + +extern __inline__ void free_pgd_slow(pgd_t *pgd) +{ + free_page((unsigned long)pgd); +} + +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); +extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted); + +extern __inline__ pte_t *get_pte_fast(void) +{ + unsigned long *ret; + + if((ret = (unsigned long *)pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } + return (pte_t *)ret; +} + +extern __inline__ void free_pte_fast(pte_t *pte) +{ + *(unsigned long *)pte = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pte; + pgtable_cache_size++; +} + +extern __inline__ void free_pte_slow(pte_t *pte) +{ + free_page((unsigned long)pte); +} + +#define pte_free_kernel(pte) free_pte_slow(pte) +#define pte_free(pte) free_pte_slow(pte) +#define pgd_free(pgd) free_pgd_slow(pgd) +#define pgd_alloc() get_pgd_fast() + +extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) +{ + if (!pmd) + BUG(); + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + if (pmd_none(*pmd)) { + pte_t * page = (pte_t *) get_pte_fast(); + + if (!page) + return get_pte_kernel_slow(pmd, address); + set_pmd(pmd, __pmd(_KERNPG_TABLE + __pa(page))); + return page + address; + } + if (pmd_bad(*pmd)) { + __handle_bad_pmd_kernel(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} + +extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + + if (pmd_none(*pmd)) + goto getnew; + if (pmd_bad(*pmd)) + goto fix; + return (pte_t *)pmd_page(*pmd) + address; +getnew: +{ + unsigned long page = (unsigned long) get_pte_fast(); + + if (!page) + return get_pte_slow(pmd, address); + set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(page))); + return (pte_t *)page + address; +} +fix: + __handle_bad_pmd(pmd); + return NULL; +} + +/* + * allocating and freeing a pmd is trivial: the 1-entry pmd is + * inside the pgd, so has no extra memory associated with it. + * (In the PAE case we free the page.) + */ +#define pmd_free(pmd) free_pmd_slow(pmd) + +#define pmd_free_kernel pmd_free +#define pmd_alloc_kernel pmd_alloc + +extern int do_check_pgt_cache(int, int); + +extern inline void set_pgdir(unsigned long address, pgd_t entry) +{ + struct task_struct * p; + pgd_t *pgd; +#ifdef __SMP__ + int i; +#endif + + read_lock(&tasklist_lock); + for_each_task(p) { + if (!p->mm) + continue; + *pgd_offset(p->mm,address) = entry; + } + read_unlock(&tasklist_lock); +#ifndef __SMP__ + for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[address >> PGDIR_SHIFT] = entry; +#else + /* To pgd_alloc/pgd_free, one holds master kernel lock and so does our callee, so we can + modify pgd caches of other CPUs as well. -jj */ + for (i = 0; i < NR_CPUS; i++) + for (pgd = (pgd_t *)cpu_data[i].pgd_quick; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[address >> PGDIR_SHIFT] = entry; +#endif +} + +/* + * TLB flushing: + * + * - flush_tlb() flushes the current mm struct TLBs + * - flush_tlb_all() flushes all processes TLBs + * - flush_tlb_mm(mm) flushes the specified mm context TLB's + * - flush_tlb_page(vma, vmaddr) flushes one page + * - flush_tlb_range(mm, start, end) flushes a range of pages + * + * ..but the i386 has somewhat limited tlb flushing capabilities, + * and page-granular flushes are available only on i486 and up. + */ + +#ifndef __SMP__ + +#define flush_tlb() __flush_tlb() +#define flush_tlb_all() __flush_tlb() +#define local_flush_tlb() __flush_tlb() + +static inline void flush_tlb_mm(struct mm_struct *mm) +{ + if (mm == current->active_mm) + __flush_tlb(); +} + +static inline void flush_tlb_page(struct vm_area_struct *vma, + unsigned long addr) +{ + if (vma->vm_mm == current->active_mm) + __flush_tlb_one(addr); +} + +static inline void flush_tlb_range(struct mm_struct *mm, + unsigned long start, unsigned long end) +{ + if (mm == current->active_mm) + __flush_tlb(); +} + +#else + +/* + * We aren't very clever about this yet - SMP could certainly + * avoid some global flushes.. + */ + +#include <asm/smp.h> + +#define local_flush_tlb() \ + __flush_tlb() + +extern void flush_tlb_all(void); +extern void flush_tlb_current_task(void); +extern void flush_tlb_mm(struct mm_struct *); +extern void flush_tlb_page(struct vm_area_struct *, unsigned long); + +#define flush_tlb() flush_tlb_current_task() + +static inline void flush_tlb_range(struct mm_struct * mm, unsigned long start, unsigned long end) +{ + flush_tlb_mm(mm); +} + +extern volatile unsigned long smp_invalidate_needed; +extern unsigned int cpu_tlbbad[NR_CPUS]; + +static inline void do_flush_tlb_local(void) +{ + unsigned long cpu = smp_processor_id(); + struct mm_struct *mm = current->mm; + + clear_bit(cpu, &smp_invalidate_needed); + if (mm) { + set_bit(cpu, &mm->cpu_vm_mask); + local_flush_tlb(); + } else { + cpu_tlbbad[cpu] = 1; + } +} + +#endif + +#endif /* _I386_PGALLOC_H */ diff --git a/include/asm-i386/pgtable-2level.h b/include/asm-i386/pgtable-2level.h index 3ca3551d3..dbb12f801 100644 --- a/include/asm-i386/pgtable-2level.h +++ b/include/asm-i386/pgtable-2level.h @@ -34,6 +34,19 @@ extern inline int pgd_bad(pgd_t pgd) { return 0; } extern inline int pgd_present(pgd_t pgd) { return 1; } #define pgd_clear(xp) do { } while (0) +/* + * Certain architectures need to do special things when PTEs + * within a page table are directly modified. Thus, the following + * hook is made available. + */ +#define set_pte(pteptr, pteval) (*(pteptr) = pteval) +/* + * (pmds are folded into pgds so this doesnt get actually called, + * but the define is needed for a generic inline function.) + */ +#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) +#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) + #define pgd_page(pgd) \ ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) @@ -42,19 +55,4 @@ extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) return (pmd_t *) dir; } -extern __inline__ pmd_t *get_pmd_fast(void) -{ - return (pmd_t *)0; -} - -extern __inline__ void free_pmd_fast(pmd_t *pmd) { } -extern __inline__ void free_pmd_slow(pmd_t *pmd) { } - -extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) -{ - if (!pgd) - BUG(); - return (pmd_t *) pgd; -} - #endif /* _I386_PGTABLE_2LEVEL_H */ diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h index d9e813def..5ee848ef3 100644 --- a/include/asm-i386/pgtable-3level.h +++ b/include/asm-i386/pgtable-3level.h @@ -27,19 +27,31 @@ #define PTRS_PER_PTE 512 #define pte_ERROR(e) \ - printk("%s:%d: bad pte %016Lx.\n", __FILE__, __LINE__, pte_val(e)) + printk("%s:%d: bad pte %p(%016Lx).\n", __FILE__, __LINE__, &(e), pte_val(e)) #define pmd_ERROR(e) \ - printk("%s:%d: bad pmd %016Lx.\n", __FILE__, __LINE__, pmd_val(e)) + printk("%s:%d: bad pmd %p(%016Lx).\n", __FILE__, __LINE__, &(e), pmd_val(e)) #define pgd_ERROR(e) \ - printk("%s:%d: bad pgd %016Lx.\n", __FILE__, __LINE__, pgd_val(e)) + printk("%s:%d: bad pgd %p(%016Lx).\n", __FILE__, __LINE__, &(e), pgd_val(e)) /* * Subtle, in PAE mode we cannot have zeroes in the top level - * page directory, the CPU enforces this. + * page directory, the CPU enforces this. (ie. the PGD entry + * always has to have the present bit set.) The CPU caches + * the 4 pgd entries internally, so there is no extra memory + * load on TLB miss, despite one more level of indirection. */ -#define pgd_none(x) (pgd_val(x) == 1ULL) +#define EMPTY_PGD (__pa(empty_zero_page) + 1) +#define pgd_none(x) (pgd_val(x) == EMPTY_PGD) extern inline int pgd_bad(pgd_t pgd) { return 0; } extern inline int pgd_present(pgd_t pgd) { return !pgd_none(pgd); } + +#define set_pte(pteptr,pteval) \ + set_64bit((unsigned long long *)(pteptr),pte_val(pteval)) +#define set_pmd(pmdptr,pmdval) \ + set_64bit((unsigned long long *)(pmdptr),pmd_val(pmdval)) +#define set_pgd(pgdptr,pgdval) \ + set_64bit((unsigned long long *)(pgdptr),pgd_val(pgdval)) + /* * Pentium-II errata A13: in PAE mode we explicitly have to flush * the TLB via cr3 if the top-level pgd is changed... This was one tough @@ -48,7 +60,7 @@ extern inline int pgd_present(pgd_t pgd) { return !pgd_none(pgd); } */ extern inline void __pgd_clear (pgd_t * pgd) { - pgd_val(*pgd) = 1; // no zero allowed! + set_pgd(pgd, __pgd(EMPTY_PGD)); } extern inline void pgd_clear (pgd_t * pgd) @@ -64,61 +76,4 @@ extern inline void pgd_clear (pgd_t * pgd) #define pmd_offset(dir, address) ((pmd_t *) pgd_page(*(dir)) + \ __pmd_offset(address)) -extern __inline__ pmd_t *get_pmd_slow(void) -{ - pmd_t *ret = (pmd_t *)__get_free_page(GFP_KERNEL); - - if (ret) - memset(ret, 0, PAGE_SIZE); - return ret; -} - -extern __inline__ pmd_t *get_pmd_fast(void) -{ - unsigned long *ret; - - if ((ret = pmd_quicklist) != NULL) { - pmd_quicklist = (unsigned long *)(*ret); - ret[0] = 0; - pgtable_cache_size--; - } else - ret = (unsigned long *)get_pmd_slow(); - return (pmd_t *)ret; -} - -extern __inline__ void free_pmd_fast(pmd_t *pmd) -{ - *(unsigned long *)pmd = (unsigned long) pmd_quicklist; - pmd_quicklist = (unsigned long *) pmd; - pgtable_cache_size++; -} - -extern __inline__ void free_pmd_slow(pmd_t *pmd) -{ - free_page((unsigned long)pmd); -} - -extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) -{ - if (!pgd) - BUG(); - address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); - if (pgd_none(*pgd)) { - pmd_t *page = get_pmd_fast(); - - if (!page) - page = get_pmd_slow(); - if (page) { - if (pgd_none(*pgd)) { - pgd_val(*pgd) = 1 + __pa(page); - __flush_tlb(); - return page + address; - } else - free_pmd_fast(page); - } else - return NULL; - } - return (pmd_t *)pgd_page(*pgd) + address; -} - #endif /* _I386_PGTABLE_3LEVEL_H */ diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 9138abfc3..336c27c67 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -27,19 +27,6 @@ extern pgd_t swapper_pg_dir[1024]; #define flush_page_to_ram(page) do { } while (0) #define flush_icache_range(start, end) do { } while (0) -/* - * TLB flushing: - * - * - flush_tlb() flushes the current mm struct TLBs - * - flush_tlb_all() flushes all processes TLBs - * - flush_tlb_mm(mm) flushes the specified mm context TLB's - * - flush_tlb_page(vma, vmaddr) flushes one page - * - flush_tlb_range(mm, start, end) flushes a range of pages - * - * ..but the i386 has somewhat limited tlb flushing capabilities, - * and page-granular flushes are available only on i486 and up. - */ - #define __flush_tlb() \ do { unsigned long tmpreg; __asm__ __volatile__("movl %%cr3,%0\n\tmovl %0,%%cr3":"=r" (tmpreg) : :"memory"); } while (0) @@ -49,65 +36,16 @@ do { unsigned long tmpreg; __asm__ __volatile__("movl %%cr3,%0\n\tmovl %0,%%cr3" #define __flush_tlb_one(addr) \ __asm__ __volatile__("invlpg %0": :"m" (*(char *) addr)) #endif - -#ifndef __SMP__ - -#define flush_tlb() __flush_tlb() -#define flush_tlb_all() __flush_tlb() -#define local_flush_tlb() __flush_tlb() - -static inline void flush_tlb_mm(struct mm_struct *mm) -{ - if (mm == current->active_mm) - __flush_tlb(); -} - -static inline void flush_tlb_page(struct vm_area_struct *vma, - unsigned long addr) -{ - if (vma->vm_mm == current->active_mm) - __flush_tlb_one(addr); -} - -static inline void flush_tlb_range(struct mm_struct *mm, - unsigned long start, unsigned long end) -{ - if (mm == current->active_mm) - __flush_tlb(); -} - -#else /* - * We aren't very clever about this yet - SMP could certainly - * avoid some global flushes.. + * ZERO_PAGE is a global shared page that is always zero: used + * for zero-mapped memory areas etc.. */ +extern unsigned long empty_zero_page[1024]; +#define ZERO_PAGE(vaddr) (mem_map + MAP_NR(empty_zero_page)) -#include <asm/smp.h> - -#define local_flush_tlb() \ - __flush_tlb() - -extern void flush_tlb_all(void); -extern void flush_tlb_current_task(void); -extern void flush_tlb_mm(struct mm_struct *); -extern void flush_tlb_page(struct vm_area_struct *, unsigned long); - -#define flush_tlb() flush_tlb_current_task() - -static inline void flush_tlb_range(struct mm_struct * mm, unsigned long start, unsigned long end) -{ - flush_tlb_mm(mm); -} - -#endif #endif /* !__ASSEMBLY__ */ -#define pgd_quicklist (current_cpu_data.pgd_quick) -#define pmd_quicklist (current_cpu_data.pmd_quick) -#define pte_quicklist (current_cpu_data.pte_quick) -#define pgtable_cache_size (current_cpu_data.pgtable_cache_sz) - /* * The Linux x86 paging architecture is 'compile-time dual-mode', it * implements both the traditional 2-level x86 page tables and the @@ -121,13 +59,6 @@ static inline void flush_tlb_range(struct mm_struct * mm, unsigned long start, u #endif #endif -/* - * Certain architectures need to do special things when PTEs - * within a page table are directly modified. Thus, the following - * hook is made available. - */ -#define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval)) - #define __beep() asm("movb $0x3,%al; outb %al,$0x61") #define PMD_SIZE (1UL << PMD_SHIFT) @@ -221,13 +152,6 @@ static inline void flush_tlb_range(struct mm_struct * mm, unsigned long start, u extern unsigned long pg0[1024]; /* - * ZERO_PAGE is a global shared page that is always zero: used - * for zero-mapped memory areas etc.. - */ -extern unsigned long empty_zero_page[1024]; -#define ZERO_PAGE(vaddr) (mem_map + MAP_NR(empty_zero_page)) - -/* * Handling allocation failures during page table setup. */ extern void __handle_bad_pmd(pmd_t * pmd); @@ -235,19 +159,19 @@ extern void __handle_bad_pmd_kernel(pmd_t * pmd); #define pte_none(x) (!pte_val(x)) #define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE)) -#define pte_clear(xp) do { pte_val(*(xp)) = 0; } while (0) +#define pte_clear(xp) do { set_pte(xp, __pte(0)); } while (0) #define pte_pagenr(x) ((unsigned long)((pte_val(x) >> PAGE_SHIFT))) #define pmd_none(x) (!pmd_val(x)) -#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) -#define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0) +#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) +#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) /* * Permanent address of a page. Obviously must never be * called on a highmem page. */ -#define page_address(page) ({ if (PageHighMem(page)) BUG(); PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT); }) +#define page_address(page) ({ if (!(page)->virtual) BUG(); (page)->virtual; }) #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) #define pte_page(x) (mem_map+pte_pagenr(x)) @@ -261,37 +185,37 @@ extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } -extern inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_USER; return pte; } -extern inline pte_t pte_exprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_USER; return pte; } -extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } -extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } -extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_RW; return pte; } -extern inline pte_t pte_mkread(pte_t pte) { pte_val(pte) |= _PAGE_USER; return pte; } -extern inline pte_t pte_mkexec(pte_t pte) { pte_val(pte) |= _PAGE_USER; return pte; } -extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } -extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } -extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pte; } +extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } +extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } +extern inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } +extern inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } +extern inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } +extern inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } +extern inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } +extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } +extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } +extern inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } /* * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ -extern inline pte_t mk_pte(struct page *page, pgprot_t pgprot) -{ - pte_t __pte; - - pte_val(__pte) = (page-mem_map)*(unsigned long long)PAGE_SIZE + - pgprot_val(pgprot); - return __pte; -} +#define mk_pte(page,pgprot) \ +({ \ + pte_t __pte; \ + \ + set_pte(&__pte, __pte(((page)-mem_map) * \ + (unsigned long long)PAGE_SIZE + pgprot_val(pgprot))); \ + __pte; \ +}) /* This takes a physical page address that is used by the remapping functions */ #define mk_pte_phys(physpage, pgprot) \ -({ pte_t __pte; pte_val(__pte) = physpage + pgprot_val(pgprot); __pte; }) +({ pte_t __pte; set_pte(&__pte, __pte(physpage + pgprot_val(pgprot))); __pte; }) extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) -{ pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; } +{ set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; } #define page_pte(page) page_pte_prot(page, __pgprot(0)) @@ -317,182 +241,10 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) __pte_offset(address)) /* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any. - */ - -extern __inline__ pgd_t *get_pgd_slow(void) -{ - pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL); - - if (ret) { -#if 0 - /* - * On PAE allocating a whole page is overkill - we will - * either embedd this in mm_struct, or do a SLAB cache. - */ - memcpy(ret, swapper_pg_dir, PTRS_PER_PGD * sizeof(pgd_t)); -#endif -#if CONFIG_X86_PAE - int i; - for (i = 0; i < USER_PTRS_PER_PGD; i++) - __pgd_clear(ret + i); -#else - memset(ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); -#endif - memcpy(ret + USER_PTRS_PER_PGD, swapper_pg_dir + USER_PTRS_PER_PGD, (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); - } - return ret; -} - -extern __inline__ pgd_t *get_pgd_fast(void) -{ - unsigned long *ret; - - if ((ret = pgd_quicklist) != NULL) { - pgd_quicklist = (unsigned long *)(*ret); - ret[0] = 0; - pgtable_cache_size--; - } else - ret = (unsigned long *)get_pgd_slow(); - return (pgd_t *)ret; -} - -extern __inline__ void free_pgd_fast(pgd_t *pgd) -{ - *(unsigned long *)pgd = (unsigned long) pgd_quicklist; - pgd_quicklist = (unsigned long *) pgd; - pgtable_cache_size++; -} - -extern __inline__ void free_pgd_slow(pgd_t *pgd) -{ - free_page((unsigned long)pgd); -} - -extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); -extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted); - -extern __inline__ pte_t *get_pte_fast(void) -{ - unsigned long *ret; - - if((ret = (unsigned long *)pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } - return (pte_t *)ret; -} - -extern __inline__ void free_pte_fast(pte_t *pte) -{ - *(unsigned long *)pte = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pte; - pgtable_cache_size++; -} - -extern __inline__ void free_pte_slow(pte_t *pte) -{ - free_page((unsigned long)pte); -} - -#define pte_free_kernel(pte) free_pte_slow(pte) -#define pte_free(pte) free_pte_slow(pte) -#define pgd_free(pgd) free_pgd_slow(pgd) -#define pgd_alloc() get_pgd_fast() - -extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) -{ - if (!pmd) - BUG(); - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - pte_t * page = (pte_t *) get_pte_fast(); - - if (!page) - return get_pte_kernel_slow(pmd, address); - pmd_val(*pmd) = _KERNPG_TABLE + __pa(page); - return page + address; - } - if (pmd_bad(*pmd)) { - __handle_bad_pmd_kernel(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} - -extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - - if (pmd_none(*pmd)) - goto getnew; - if (pmd_bad(*pmd)) - goto fix; - return (pte_t *)pmd_page(*pmd) + address; -getnew: -{ - unsigned long page = (unsigned long) get_pte_fast(); - - if (!page) - return get_pte_slow(pmd, address); - pmd_val(*pmd) = _PAGE_TABLE + __pa(page); - return (pte_t *)page + address; -} -fix: - __handle_bad_pmd(pmd); - return NULL; -} - -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - * (In the PAE case we free the page.) - */ -#define pmd_free(pmd) free_pmd_slow(pmd) - -#define pmd_free_kernel pmd_free -#define pmd_alloc_kernel pmd_alloc - -extern int do_check_pgt_cache(int, int); - -extern inline void set_pgdir(unsigned long address, pgd_t entry) -{ - struct task_struct * p; - pgd_t *pgd; -#ifdef __SMP__ - int i; -#endif - - read_lock(&tasklist_lock); - for_each_task(p) { - if (!p->mm) - continue; - *pgd_offset(p->mm,address) = entry; - } - read_unlock(&tasklist_lock); -#ifndef __SMP__ - for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[address >> PGDIR_SHIFT] = entry; -#else - /* To pgd_alloc/pgd_free, one holds master kernel lock and so does our callee, so we can - modify pgd caches of other CPUs as well. -jj */ - for (i = 0; i < NR_CPUS; i++) - for (pgd = (pgd_t *)cpu_data[i].pgd_quick; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[address >> PGDIR_SHIFT] = entry; -#endif -} - -/* * The i386 doesn't have any external MMU info: the kernel page * tables contain all the necessary information. */ -extern inline void update_mmu_cache(struct vm_area_struct * vma, - unsigned long address, pte_t pte) -{ -} +#define update_mmu_cache(vma,address,pte) do { } while (0) /* Encode and de-code a swap entry */ #define SWP_TYPE(x) (((x).val >> 1) & 0x3f) diff --git a/include/asm-i386/resource.h b/include/asm-i386/resource.h index 0f43dba41..e49c5b8c3 100644 --- a/include/asm-i386/resource.h +++ b/include/asm-i386/resource.h @@ -18,6 +18,12 @@ #define RLIM_NLIMITS 10 +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + */ +#define RLIM_INFINITY (~0UL) + #ifdef __KERNEL__ #define INIT_RLIMITS \ diff --git a/include/asm-i386/rwlock.h b/include/asm-i386/rwlock.h new file mode 100644 index 000000000..ac9e8f36b --- /dev/null +++ b/include/asm-i386/rwlock.h @@ -0,0 +1,86 @@ +/* include/asm-i386/rwlock.h + * + * Helpers used by both rw spinlocks and rw semaphores. + * + * Based in part on code from semaphore.h and + * spinlock.h Copyright 1996 Linus Torvalds. + * + * Copyright 1999 Red Hat, Inc. + * + * Written by Benjamin LaHaise. + * + * 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. + */ +#ifndef _ASM_I386_RWLOCK_H +#define _ASM_I386_RWLOCK_H + +typedef struct { unsigned long a[100]; } __dummy_lock_t; +#define __dummy_lock(lock) (*(__dummy_lock_t *)(lock)) + +#define RW_LOCK_BIAS 0x01000000 +#define RW_LOCK_BIAS_STR "0x01000000" + +#define __build_read_lock_ptr(rw, helper) \ + asm volatile(LOCK "subl $1,(%0)\n\t" \ + "js 2f\n" \ + "1:\n" \ + ".section .text.lock,\"ax\"\n" \ + "2:\tcall " helper "\n\t" \ + "jmp 1b\n" \ + ".previous" \ + ::"a" (rw) : "memory") + +#define __build_read_lock_const(rw, helper) \ + asm volatile(LOCK "subl $1,%0\n\t" \ + "js 2f\n" \ + "1:\n" \ + ".section .text.lock,\"ax\"\n" \ + "2:\tpushl %%eax\n\t" \ + "leal %0,%%eax\n\t" \ + "call " helper "\n\t" \ + "popl %%eax\n\t" \ + "jmp 1b\n" \ + ".previous" \ + :"=m" (__dummy_lock(rw))) + +#define __build_read_lock(rw, helper) do { \ + if (__builtin_constant_p(rw)) \ + __build_read_lock_const(rw, helper); \ + else \ + __build_read_lock_ptr(rw, helper); \ + } while (0) + +#define __build_write_lock_ptr(rw, helper) \ + asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \ + "jnz 2f\n" \ + "1:\n" \ + ".section .text.lock,\"ax\"\n" \ + "2:\tcall " helper "\n\t" \ + "jmp 1b\n" \ + ".previous" \ + ::"a" (rw) : "memory") + +#define __build_write_lock_const(rw, helper) \ + asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \ + "jnz 2f\n" \ + "1:\n" \ + ".section .text.lock,\"ax\"\n" \ + "2:\tpushl %%eax\n\t" \ + "leal %0,%%eax\n\t" \ + "call " helper "\n\t" \ + "popl %%eax\n\t" \ + "jmp 1b\n" \ + ".previous" \ + :"=m" (__dummy_lock(rw))) + +#define __build_write_lock(rw, helper) do { \ + if (__builtin_constant_p(rw)) \ + __build_write_lock_const(rw, helper); \ + else \ + __build_write_lock_ptr(rw, helper); \ + } while (0) + +#endif diff --git a/include/asm-i386/semaphore.h b/include/asm-i386/semaphore.h index 7b0cddf96..3cdb0f6cd 100644 --- a/include/asm-i386/semaphore.h +++ b/include/asm-i386/semaphore.h @@ -30,7 +30,7 @@ #include <asm/system.h> #include <asm/atomic.h> -#include <linux/spinlock.h> +#include <asm/rwlock.h> #include <linux/wait.h> struct semaphore { @@ -111,10 +111,7 @@ extern inline void down(struct semaphore * sem) __asm__ __volatile__( "# atomic down operation\n\t" -#ifdef __SMP__ - "lock ; " -#endif - "decl (%0)\n\t" /* --sem->count */ + LOCK "decl (%0)\n\t" /* --sem->count */ "js 2f\n" "1:\n" ".section .text.lock,\"ax\"\n" @@ -136,10 +133,7 @@ extern inline int down_interruptible(struct semaphore * sem) __asm__ __volatile__( "# atomic interruptible down operation\n\t" -#ifdef __SMP__ - "lock ; " -#endif - "decl (%1)\n\t" /* --sem->count */ + LOCK "decl (%1)\n\t" /* --sem->count */ "js 2f\n\t" "xorl %0,%0\n" "1:\n" @@ -163,10 +157,7 @@ extern inline int down_trylock(struct semaphore * sem) __asm__ __volatile__( "# atomic interruptible down operation\n\t" -#ifdef __SMP__ - "lock ; " -#endif - "decl (%1)\n\t" /* --sem->count */ + LOCK "decl (%1)\n\t" /* --sem->count */ "js 2f\n\t" "xorl %0,%0\n" "1:\n" @@ -193,10 +184,7 @@ extern inline void up(struct semaphore * sem) #endif __asm__ __volatile__( "# atomic up operation\n\t" -#ifdef __SMP__ - "lock ; " -#endif - "incl (%0)\n\t" /* ++sem->count */ + LOCK "incl (%0)\n\t" /* ++sem->count */ "jle 2f\n" "1:\n" ".section .text.lock,\"ax\"\n" @@ -208,4 +196,173 @@ extern inline void up(struct semaphore * sem) :"memory"); } +/* rw mutexes (should that be mutices? =) -- throw rw + * spinlocks and semaphores together, and this is what we + * end up with... + * + * The lock is initialized to BIAS. This way, a writer + * subtracts BIAS ands gets 0 for the case of an uncontended + * lock. Readers decrement by 1 and see a positive value + * when uncontended, negative if there are writers waiting + * (in which case it goes to sleep). + * + * The value 0x01000000 supports up to 128 processors and + * lots of processes. BIAS must be chosen such that subl'ing + * BIAS once per CPU will result in the long remaining + * negative. + * + * In terms of fairness, this should result in the lock + * flopping back and forth between readers and writers + * under heavy use. + * + * -ben + */ +struct rw_semaphore { + atomic_t count; + volatile unsigned char write_bias_granted; + volatile unsigned char read_bias_granted; + volatile unsigned char pad1; + volatile unsigned char pad2; + wait_queue_head_t wait; + wait_queue_head_t write_bias_wait; +#if WAITQUEUE_DEBUG + long __magic; + atomic_t readers; + atomic_t writers; +#endif +}; + +#if WAITQUEUE_DEBUG +#define __RWSEM_DEBUG_INIT , ATOMIC_INIT(0), ATOMIC_INIT(0) +#else +#define __RWSEM_DEBUG_INIT /* */ +#endif + +#define __RWSEM_INITIALIZER(name) \ +{ ATOMIC_INIT(RW_LOCK_BIAS), 0, 0, 0, 0, __WAIT_QUEUE_HEAD_INITIALIZER((name).wait), \ + __WAIT_QUEUE_HEAD_INITIALIZER((name).write_bias_wait) \ + __SEM_DEBUG_INIT(name) __RWSEM_DEBUG_INIT } + +extern inline void init_rwsem(struct rw_semaphore *sem) +{ + atomic_set(&sem->count, RW_LOCK_BIAS); + sem->read_bias_granted = 0; + sem->write_bias_granted = 0; + init_waitqueue_head(&sem->wait); + init_waitqueue_head(&sem->write_bias_wait); +#if WAITQUEUE_DEBUG + sem->__magic = (long)&sem->__magic; + atomic_set(&sem->readers, 0); + atomic_set(&sem->writers, 0); +#endif +} + +/* we use FASTCALL convention for the helpers */ +extern struct rw_semaphore *FASTCALL(down_read_failed(struct rw_semaphore *sem)); +extern struct rw_semaphore *FASTCALL(down_write_failed(struct rw_semaphore *sem)); +extern struct rw_semaphore *FASTCALL(rwsem_wake(struct rw_semaphore *sem)); + +extern inline void down_read(struct rw_semaphore *sem) +{ +#if WAITQUEUE_DEBUG + if (sem->__magic != (long)&sem->__magic) + BUG(); +#endif + __build_read_lock(sem, "__down_read_failed"); +#if WAITQUEUE_DEBUG + if (sem->write_bias_granted) + BUG(); + if (atomic_read(&sem->writers)) + BUG(); + atomic_inc(&sem->readers); +#endif +} + +extern inline void down_write(struct rw_semaphore *sem) +{ +#if WAITQUEUE_DEBUG + if (sem->__magic != (long)&sem->__magic) + BUG(); +#endif + __build_write_lock(sem, "__down_write_failed"); +#if WAITQUEUE_DEBUG + if (atomic_read(&sem->writers)) + BUG(); + if (atomic_read(&sem->readers)) + BUG(); + if (sem->read_bias_granted) + BUG(); + if (sem->write_bias_granted) + BUG(); + atomic_inc(&sem->writers); +#endif +} + +/* When a reader does a release, the only significant + * case is when there was a writer waiting, and we've + * bumped the count to 0: we must wake the writer up. + */ +extern inline void __up_read(struct rw_semaphore *sem) +{ + __asm__ __volatile__( + "# up_read\n\t" + LOCK "incl (%%eax)\n\t" + "jz 2f\n" /* only do the wake if result == 0 (ie, a writer) */ + "1:\n\t" + ".section .text.lock,\"ax\"\n" + "2:\tcall __rwsem_wake\n\t" + "jmp 1b\n" + ".previous" + ::"a" (sem) + :"memory" + ); +} + +/* releasing the writer is easy -- just release it and + * wake up any sleepers. + */ +extern inline void __up_write(struct rw_semaphore *sem) +{ + __asm__ __volatile__( + "# up_write\n\t" + LOCK "addl $" RW_LOCK_BIAS_STR ",(%%eax)\n" + "jc 2f\n" /* only do the wake if the result was -'ve to 0/+'ve */ + "1:\n\t" + ".section .text.lock,\"ax\"\n" + "2:\tcall __rwsem_wake\n\t" + "jmp 1b\n" + ".previous" + ::"a" (sem) + :"memory" + ); +} + +extern inline void up_read(struct rw_semaphore *sem) +{ +#if WAITQUEUE_DEBUG + if (sem->write_bias_granted) + BUG(); + if (atomic_read(&sem->writers)) + BUG(); + atomic_dec(&sem->readers); +#endif + __up_read(sem); +} + +extern inline void up_write(struct rw_semaphore *sem) +{ +#if WAITQUEUE_DEBUG + if (sem->read_bias_granted) + BUG(); + if (sem->write_bias_granted) + BUG(); + if (atomic_read(&sem->readers)) + BUG(); + if (atomic_read(&sem->writers) != 1) + BUG(); + atomic_dec(&sem->writers); +#endif + __up_write(sem); +} + #endif diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h index fc1244493..ae25cc427 100644 --- a/include/asm-i386/setup.h +++ b/include/asm-i386/setup.h @@ -2,3 +2,9 @@ * Just a place holder. We don't want to have to test x86 before * we include stuff */ + +#ifndef _i386_SETUP_H +#define _i386_SETUP_H + + +#endif /* _i386_SETUP_H */ diff --git a/include/asm-i386/signal.h b/include/asm-i386/signal.h index b6823738b..b2b8a76f0 100644 --- a/include/asm-i386/signal.h +++ b/include/asm-i386/signal.h @@ -63,6 +63,7 @@ typedef unsigned long sigset_t; #define SIGLOST 29 */ #define SIGPWR 30 +#define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h index 2aa6aec4e..3425c2cd1 100644 --- a/include/asm-i386/smp.h +++ b/include/asm-i386/smp.h @@ -174,6 +174,7 @@ extern volatile unsigned long smp_invalidate_needed; extern int pic_mode; extern void smp_flush_tlb(void); extern int get_maxlvt(void); +extern void disable_local_APIC (void); extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs); extern void smp_send_reschedule(int cpu); extern void smp_invalidate_rcv(void); /* Process an NMI */ diff --git a/include/asm-i386/smplock.h b/include/asm-i386/smplock.h index 152c1a9fa..ed5c58254 100644 --- a/include/asm-i386/smplock.h +++ b/include/asm-i386/smplock.h @@ -38,6 +38,10 @@ do { \ */ extern __inline__ void lock_kernel(void) { +#if 1 + if (!++current->lock_depth) + spin_lock(&kernel_flag); +#else __asm__ __volatile__( "incl %1\n\t" "jne 9f" @@ -45,12 +49,17 @@ extern __inline__ void lock_kernel(void) "\n9:" :"=m" (__dummy_lock(&kernel_flag)), "=m" (current->lock_depth)); +#endif } extern __inline__ void unlock_kernel(void) { if (current->lock_depth < 0) BUG(); +#if 1 + if (--current->lock_depth < 0) + spin_unlock(&kernel_flag); +#else __asm__ __volatile__( "decl %1\n\t" "jns 9f\n\t" @@ -58,4 +67,5 @@ extern __inline__ void unlock_kernel(void) "\n9:" :"=m" (__dummy_lock(&kernel_flag)), "=m" (current->lock_depth)); +#endif } diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h index a10ed9c5c..5cf17b846 100644 --- a/include/asm-i386/spinlock.h +++ b/include/asm-i386/spinlock.h @@ -1,17 +1,41 @@ #ifndef __ASM_SPINLOCK_H #define __ASM_SPINLOCK_H +#include <asm/atomic.h> +#include <asm/rwlock.h> +#include <asm/page.h> + +extern int printk(const char * fmt, ...) + __attribute__ ((format (printf, 1, 2))); + +/* It seems that people are forgetting to + * initialize their spinlocks properly, tsk tsk. + * Remember to turn this off in 2.4. -ben + */ +#define SPINLOCK_DEBUG 1 + /* * Your basic SMP spinlocks, allowing only a single CPU anywhere */ typedef struct { volatile unsigned int lock; +#if SPINLOCK_DEBUG + unsigned magic; +#endif } spinlock_t; -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } +#define SPINLOCK_MAGIC 0xdead4ead -#define spin_lock_init(x) do { (x)->lock = 0; } while(0) +#if SPINLOCK_DEBUG +#define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC +#else +#define SPINLOCK_MAGIC_INIT /* */ +#endif + +#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 SPINLOCK_MAGIC_INIT } + +#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) /* * Simple spin lock operations. There are two variants, one clears IRQ's * on the local processor, one does not. @@ -21,9 +45,6 @@ typedef struct { #define spin_unlock_wait(x) do { barrier(); } while(((volatile spinlock_t *)(x))->lock) -typedef struct { unsigned long a[100]; } __dummy_lock_t; -#define __dummy_lock(lock) (*(__dummy_lock_t *)(lock)) - #define spin_lock_string \ "\n1:\t" \ "lock ; btsl $0,%0\n\t" \ @@ -35,18 +56,45 @@ typedef struct { unsigned long a[100]; } __dummy_lock_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. + */ #define spin_unlock_string \ "lock ; btrl $0,%0" -#define spin_lock(lock) \ -__asm__ __volatile__( \ - spin_lock_string \ - :"=m" (__dummy_lock(lock))) - -#define spin_unlock(lock) \ -__asm__ __volatile__( \ - spin_unlock_string \ - :"=m" (__dummy_lock(lock))) +extern inline void spin_lock(spinlock_t *lock) +{ +#if SPINLOCK_DEBUG + __label__ here; +here: + if (lock->magic != SPINLOCK_MAGIC) { +printk("eip: %p\n", &&here); + BUG(); + } +#endif + __asm__ __volatile__( + spin_lock_string + :"=m" (__dummy_lock(lock))); +} + +extern inline void spin_unlock(spinlock_t *lock) +{ +#if SPINLOCK_DEBUG + if (lock->magic != SPINLOCK_MAGIC) + BUG(); + if (!lock->lock) + BUG(); +#endif + __asm__ __volatile__( + spin_unlock_string + :"=m" (__dummy_lock(lock))); +} #define spin_trylock(lock) (!test_and_set_bit(0,(lock))) @@ -62,47 +110,60 @@ __asm__ __volatile__( \ */ typedef struct { volatile unsigned int lock; +#if SPINLOCK_DEBUG + unsigned magic; +#endif } rwlock_t; -#define RW_LOCK_UNLOCKED (rwlock_t) { 0 } +#define RWLOCK_MAGIC 0xdeaf1eed + +#if SPINLOCK_DEBUG +#define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC +#else +#define RWLOCK_MAGIC_INIT /* */ +#endif + +#define RW_LOCK_UNLOCKED (rwlock_t) { RW_LOCK_BIAS RWLOCK_MAGIC_INIT } /* * On x86, we implement read-write locks as a 32-bit counter - * with the high bit (sign) being the "write" bit. + * with the high bit (sign) being the "contended" bit. * * The inline assembly is non-obvious. Think about it. + * + * Changed to use the same technique as rw semaphores. See + * semaphore.h for details. -ben */ -#define read_lock(rw) \ - asm volatile("\n1:\t" \ - "lock ; incl %0\n\t" \ - "js 2f\n" \ - ".section .text.lock,\"ax\"\n" \ - "2:\tlock ; decl %0\n" \ - "3:\tcmpl $0,%0\n\t" \ - "js 3b\n\t" \ - "jmp 1b\n" \ - ".previous" \ - :"=m" (__dummy_lock(&(rw)->lock))) - -#define read_unlock(rw) \ - asm volatile("lock ; decl %0" \ - :"=m" (__dummy_lock(&(rw)->lock))) - -#define write_lock(rw) \ - asm volatile("\n1:\t" \ - "lock ; btsl $31,%0\n\t" \ - "jc 4f\n" \ - "2:\ttestl $0x7fffffff,%0\n\t" \ - "jne 3f\n" \ - ".section .text.lock,\"ax\"\n" \ - "3:\tlock ; btrl $31,%0\n" \ - "4:\tcmp $0,%0\n\t" \ - "jne 4b\n\t" \ - "jmp 1b\n" \ - ".previous" \ - :"=m" (__dummy_lock(&(rw)->lock))) - -#define write_unlock(rw) \ - asm volatile("lock ; btrl $31,%0":"=m" (__dummy_lock(&(rw)->lock))) +/* the spinlock helpers are in arch/i386/kernel/semaphore.S */ + +extern inline void read_lock(rwlock_t *rw) +{ +#if SPINLOCK_DEBUG + if (rw->magic != RWLOCK_MAGIC) + BUG(); +#endif + __build_read_lock(rw, "__read_lock_failed"); +} + +extern inline void write_lock(rwlock_t *rw) +{ +#if SPINLOCK_DEBUG + if (rw->magic != RWLOCK_MAGIC) + BUG(); +#endif + __build_write_lock(rw, "__write_lock_failed"); +} + +#define read_unlock(rw) asm volatile("lock ; incl %0" :"=m" (__dummy_lock(&(rw)->lock))) +#define write_unlock(rw) asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0":"=m" (__dummy_lock(&(rw)->lock))) + +extern inline int write_trylock(rwlock_t *lock) +{ + atomic_t *count = (atomic_t *)lock; + if (atomic_sub_and_test(RW_LOCK_BIAS, count)) + return 1; + atomic_add(RW_LOCK_BIAS, count); + return 0; +} #endif /* __ASM_SPINLOCK_H */ diff --git a/include/asm-i386/string-486.h b/include/asm-i386/string-486.h index 4c2531712..7c3ee1a1b 100644 --- a/include/asm-i386/string-486.h +++ b/include/asm-i386/string-486.h @@ -187,7 +187,6 @@ extern inline char * strrchr(const char * s, int c) int d0, d1; register char * __res; __asm__ __volatile__( - "cld\n\t" "movb %%al,%%ah\n" "1:\tlodsb\n\t" "cmpb %%ah,%%al\n\t" @@ -206,7 +205,6 @@ extern inline size_t strspn(const char * cs, const char * ct) int d0, d1; register char * __res; __asm__ __volatile__( - "cld\n\t" "movl %6,%%edi\n\t" "repne\n\t" "scasb\n\t" @@ -234,7 +232,6 @@ extern inline size_t strcspn(const char * cs, const char * ct) int d0, d1; register char * __res; __asm__ __volatile__( - "cld\n\t" "movl %6,%%edi\n\t" "repne\n\t" "scasb\n\t" @@ -263,7 +260,6 @@ extern inline char * strpbrk(const char * cs,const char * ct) int d0, d1; register char * __res; __asm__ __volatile__( - "cld\n\t" "movl %6,%%edi\n\t" "repne\n\t" "scasb\n\t" @@ -296,7 +292,6 @@ extern inline char * strstr(const char * cs,const char * ct) int d0, d1; register char * __res; __asm__ __volatile__( - "cld\n\t" \ "movl %6,%%edi\n\t" "repne\n\t" "scasb\n\t" @@ -378,7 +373,6 @@ __asm__ __volatile__( "1:\txorl %0,%0\n\t" "movl $-1,%%ecx\n\t" "xorl %%eax,%%eax\n\t" - "cld\n\t" "movl %4,%%edi\n\t" "repne\n\t" "scasb\n\t" @@ -474,7 +468,6 @@ extern inline void * __memcpy_g(void * to, const void * from, size_t n) int d0, d1, d2; register void *tmp = (void *)to; __asm__ __volatile__ ( - "cld\n\t" "shrl $1,%%ecx\n\t" "jnc 1f\n\t" "movsb\n" @@ -554,7 +547,6 @@ int d0, d1, d2; register void *tmp = (void *)dest; if (dest<src) __asm__ __volatile__ ( - "cld\n\t" "rep\n\t" "movsb" :"=&c" (d0), "=&S" (d1), "=&D" (d2) @@ -577,7 +569,6 @@ extern inline int memcmp(const void * cs,const void * ct,size_t count) int d0, d1, d2; register int __res; __asm__ __volatile__( - "cld\n\t" "repe\n\t" "cmpsb\n\t" "je 1f\n\t" @@ -597,7 +588,6 @@ register void * __res; if (!count) return NULL; __asm__ __volatile__( - "cld\n\t" "repne\n\t" "scasb\n\t" "je 1f\n\t" @@ -753,8 +743,7 @@ extern inline void * memscan(void * addr, int c, size_t size) { if (!size) return addr; - __asm__("cld - repnz; scasb + __asm__("repnz; scasb jnz 1f dec %%edi 1: " diff --git a/include/asm-i386/string.h b/include/asm-i386/string.h index ea2e9f85d..515ffa7d5 100644 --- a/include/asm-i386/string.h +++ b/include/asm-i386/string.h @@ -1,6 +1,7 @@ #ifndef _I386_STRING_H_ #define _I386_STRING_H_ +#ifdef __KERNEL__ /* * On a 486 or Pentium, we are better off not using the * byte string operations. But on a 386 or a PPro the @@ -32,7 +33,6 @@ extern inline char * strcpy(char * dest,const char *src) { int d0, d1, d2; __asm__ __volatile__( - "cld\n" "1:\tlodsb\n\t" "stosb\n\t" "testb %%al,%%al\n\t" @@ -47,7 +47,6 @@ extern inline char * strncpy(char * dest,const char *src,size_t count) { int d0, d1, d2, d3; __asm__ __volatile__( - "cld\n" "1:\tdecl %2\n\t" "js 2f\n\t" "lodsb\n\t" @@ -67,7 +66,6 @@ extern inline char * strcat(char * dest,const char * src) { int d0, d1, d2, d3; __asm__ __volatile__( - "cld\n\t" "repne\n\t" "scasb\n\t" "decl %1\n" @@ -85,7 +83,6 @@ extern inline char * strncat(char * dest,const char * src,size_t count) { int d0, d1, d2, d3; __asm__ __volatile__( - "cld\n\t" "repne\n\t" "scasb\n\t" "decl %1\n\t" @@ -110,7 +107,6 @@ extern inline int strcmp(const char * cs,const char * ct) int d0, d1; register int __res; __asm__ __volatile__( - "cld\n" "1:\tlodsb\n\t" "scasb\n\t" "jne 2f\n\t" @@ -132,7 +128,6 @@ extern inline int strncmp(const char * cs,const char * ct,size_t count) register int __res; int d0, d1, d2; __asm__ __volatile__( - "cld\n" "1:\tdecl %3\n\t" "js 2f\n\t" "lodsb\n\t" @@ -156,7 +151,6 @@ extern inline char * strchr(const char * s, int c) int d0; register char * __res; __asm__ __volatile__( - "cld\n\t" "movb %%al,%%ah\n" "1:\tlodsb\n\t" "cmpb %%ah,%%al\n\t" @@ -176,7 +170,6 @@ extern inline char * strrchr(const char * s, int c) int d0, d1; register char * __res; __asm__ __volatile__( - "cld\n\t" "movb %%al,%%ah\n" "1:\tlodsb\n\t" "cmpb %%ah,%%al\n\t" @@ -194,7 +187,6 @@ extern inline size_t strlen(const char * s) int d0; register int __res; __asm__ __volatile__( - "cld\n\t" "repne\n\t" "scasb\n\t" "notl %0\n\t" @@ -207,7 +199,6 @@ extern inline void * __memcpy(void * to, const void * from, size_t n) { int d0, d1, d2; __asm__ __volatile__( - "cld\n\t" "rep ; movsl\n\t" "testb $2,%b4\n\t" "je 1f\n\t" @@ -273,7 +264,6 @@ extern inline void * __constant_memcpy(void * to, const void * from, size_t n) } #define COMMON(x) \ __asm__ __volatile__( \ - "cld\n\t" \ "rep ; movsl" \ x \ : "=&c" (d0), "=&D" (d1), "=&S" (d2) \ @@ -343,13 +333,28 @@ extern __inline__ void *__memcpy3d(void *to, const void *from, size_t len) #endif +/* + * struct_cpy(x,y), copy structure *x into (matching structure) *y. + * + * We get link-time errors if the structure sizes do not match. + * There is no runtime overhead, it's all optimized away at + * compile time. + */ +extern void __struct_cpy_bug (void); + +#define struct_cpy(x,y) \ +({ \ + if (sizeof(*(x)) != sizeof(*(y))) \ + __struct_cpy_bug; \ + memcpy(x, y, sizeof(*(x))); \ +}) + #define __HAVE_ARCH_MEMMOVE extern inline void * memmove(void * dest,const void * src, size_t n) { int d0, d1, d2; if (dest<src) __asm__ __volatile__( - "cld\n\t" "rep\n\t" "movsb" : "=&c" (d0), "=&S" (d1), "=&D" (d2) @@ -379,7 +384,6 @@ register void * __res; if (!count) return NULL; __asm__ __volatile__( - "cld\n\t" "repne\n\t" "scasb\n\t" "je 1f\n\t" @@ -393,7 +397,6 @@ extern inline void * __memset_generic(void * s, char c,size_t count) { int d0, d1; __asm__ __volatile__( - "cld\n\t" "rep\n\t" "stosb" : "=&c" (d0), "=&D" (d1) @@ -414,7 +417,6 @@ extern inline void * __constant_c_memset(void * s, unsigned long c, size_t count { int d0, d1; __asm__ __volatile__( - "cld\n\t" "rep ; stosl\n\t" "testb $2,%b3\n\t" "je 1f\n\t" @@ -475,7 +477,7 @@ extern inline void * __constant_c_and_count_memset(void * s, unsigned long patte return s; } #define COMMON(x) \ -__asm__ __volatile__("cld\n\t" \ +__asm__ __volatile__( \ "rep ; stosl" \ x \ : "=&c" (d0), "=&D" (d1) \ @@ -518,8 +520,7 @@ extern inline void * memscan(void * addr, int c, size_t size) { if (!size) return addr; - __asm__("cld - repnz; scasb + __asm__("repnz; scasb jnz 1f dec %%edi 1: " @@ -528,5 +529,7 @@ extern inline void * memscan(void * addr, int c, size_t size) return addr; } +#endif /* __KERNEL__ */ + #endif #endif diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index f2ccae723..ac0ff6e1e 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -3,6 +3,7 @@ #include <linux/kernel.h> #include <asm/segment.h> +#include <linux/bitops.h> /* for LOCK_PREFIX */ #ifdef __KERNEL__ @@ -122,12 +123,62 @@ static inline unsigned long get_limit(unsigned long segment) #define nop() __asm__ __volatile__ ("nop") -#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) +#define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr)))) + #define tas(ptr) (xchg((ptr),1)) struct __xchg_dummy { unsigned long a[100]; }; #define __xg(x) ((struct __xchg_dummy *)(x)) + +/* + * The semantics of XCHGCMP8B are a bit strange, this is why + * there is a loop and the loading of %%eax and %%edx has to + * be inside. This inlines well in most cases, the cached + * cost is around ~38 cycles. (in the future we might want + * to do an SIMD/3DNOW!/MMX/FPU 64-bit store here, but that + * might have an implicit FPU-save as a cost, so it's not + * clear which path to go.) + */ +extern inline void __set_64bit (unsigned long long * ptr, + unsigned int low, unsigned int high) +{ +__asm__ __volatile__ ( + "1: movl (%0), %%eax; + movl 4(%0), %%edx; + cmpxchg8b (%0); + jnz 1b" + :: "D"(ptr), + "b"(low), + "c"(high) + : + "ax","dx","memory"); +} + +extern void inline __set_64bit_constant (unsigned long long *ptr, + unsigned long long value) +{ + __set_64bit(ptr,(unsigned int)(value), (unsigned int)((value)>>32ULL)); +} +#define ll_low(x) *(((unsigned int*)&(x))+0) +#define ll_high(x) *(((unsigned int*)&(x))+1) + +extern void inline __set_64bit_var (unsigned long long *ptr, + unsigned long long value) +{ + __set_64bit(ptr,ll_low(value), ll_high(value)); +} + +#define set_64bit(ptr,value) \ +(__builtin_constant_p(value) ? \ + __set_64bit_constant(ptr, value) : \ + __set_64bit_var(ptr, value) ) + +#define _set_64bit(ptr,value) \ +(__builtin_constant_p(value) ? \ + __set_64bit(ptr, (unsigned int)(value), (unsigned int)((value)>>32ULL) ) : \ + __set_64bit(ptr, ll_low(value), ll_high(value)) ) + /* * Note: no "lock" prefix even on SMP: xchg always implies lock anyway * Note 2: xchg has side effect, so that attribute volatile is necessary, @@ -159,6 +210,50 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz } /* + * Atomic compare and exchange. Compare OLD with MEM, if identical, + * store NEW in MEM. Return the initial value in MEM. Success is + * indicated by comparing RETURN with OLD. + */ + +#if CPU != 386 +#define __HAVE_ARCH_CMPXCHG 1 + +static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, + unsigned long new, int size) +{ + unsigned long prev; + switch (size) { + case 1: + __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 2: + __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 4: + __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + } + return old; +} + +#define cmpxchg(ptr,o,n)\ + ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ + (unsigned long)(n),sizeof(*(ptr)))) + +#else +/* Compiling for a 386 proper. Is it worth implementing via cli/sti? */ +#endif + +/* * Force strict CPU ordering. * And yes, this is required on UP too when we're talking * to devices. diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index b3cb91024..8678dc583 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -196,6 +196,9 @@ #define __NR_putpmsg 189 /* some people actually want streams */ #define __NR_vfork 190 #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ +#define __NR_mmap2 192 +#define __NR_truncate64 193 +#define __NR_ftruncate64 194 /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */ @@ -273,6 +276,19 @@ __asm__ volatile ("int $0x80" \ __syscall_return(type,__res); \ } +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ +{ \ +long __res; \ +__asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; pop %%ebp" \ + : "=a" (__res) \ + : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ + "0" ((long)(arg6))); \ +__syscall_return(type,__res); \ +} + #ifdef __KERNEL_SYSCALLS__ /* diff --git a/include/asm-m68k/dvma.h b/include/asm-m68k/dvma.h index 4f7875def..b350911c6 100644 --- a/include/asm-m68k/dvma.h +++ b/include/asm-m68k/dvma.h @@ -9,6 +9,8 @@ #ifndef __M68K_DVMA_H #define __M68K_DVMA_H +#include <linux/config.h> + #ifdef CONFIG_SUN3 /* sun3 dvma page support */ diff --git a/include/asm-m68k/elf.h b/include/asm-m68k/elf.h index 8799724e6..28dce0967 100644 --- a/include/asm-m68k/elf.h +++ b/include/asm-m68k/elf.h @@ -5,6 +5,7 @@ * ELF register definitions.. */ +#include <linux/config.h> #include <asm/ptrace.h> #include <asm/user.h> diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h index 9257711dc..b8057d1ec 100644 --- a/include/asm-m68k/io.h +++ b/include/asm-m68k/io.h @@ -47,6 +47,8 @@ #define outb(x,addr) ((void) writeb(x,addr)) #define outb_p(x,addr) outb(x,addr) +#define IO_SPACE_LIMIT 0xffff + /* Values for nocacheflag and cmode */ #define IOMAP_FULL_CACHING 0 diff --git a/include/asm-m68k/mmu_context.h b/include/asm-m68k/mmu_context.h index 6a41f82e7..a8a1dfc61 100644 --- a/include/asm-m68k/mmu_context.h +++ b/include/asm-m68k/mmu_context.h @@ -1,6 +1,8 @@ #ifndef __M68K_MMU_CONTEXT_H #define __M68K_MMU_CONTEXT_H +#include <linux/config.h> + #ifndef CONFIG_SUN3 #include <asm/setup.h> diff --git a/include/asm-m68k/openprom.h b/include/asm-m68k/openprom.h index f855a5f09..7d8451338 100644 --- a/include/asm-m68k/openprom.h +++ b/include/asm-m68k/openprom.h @@ -8,6 +8,8 @@ * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) */ +#include <linux/config.h> + /* Empirical constants... */ #ifdef CONFIG_SUN3 #define KADB_DEBUGGER_BEGVM 0x0fee0000 /* There is no kadb yet but...*/ diff --git a/include/asm-m68k/param.h b/include/asm-m68k/param.h index af023b547..4b11fdf97 100644 --- a/include/asm-m68k/param.h +++ b/include/asm-m68k/param.h @@ -1,6 +1,8 @@ #ifndef _M68K_PARAM_H #define _M68K_PARAM_H +#include <linux/config.h> + #ifndef HZ #define HZ 100 #define HZ_TO_STD(a) (a) diff --git a/include/asm-m68k/processor.h b/include/asm-m68k/processor.h index 7b7c9e094..62240f8c5 100644 --- a/include/asm-m68k/processor.h +++ b/include/asm-m68k/processor.h @@ -13,6 +13,7 @@ */ #define current_text_addr() ({ __label__ _l; _l: &&_l;}) +#include <linux/config.h> #include <asm/segment.h> #include <asm/fpu.h> #include <asm/ptrace.h> diff --git a/include/asm-m68k/resource.h b/include/asm-m68k/resource.h index 11376a494..f2a6f0f41 100644 --- a/include/asm-m68k/resource.h +++ b/include/asm-m68k/resource.h @@ -18,6 +18,12 @@ #define RLIM_NLIMITS 10 +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + */ +#define RLIM_INFINITY (~0UL) + #ifdef __KERNEL__ #define INIT_RLIMITS \ diff --git a/include/asm-m68k/shm.h b/include/asm-m68k/shm.h index 6e5bdf131..3fa2f368f 100644 --- a/include/asm-m68k/shm.h +++ b/include/asm-m68k/shm.h @@ -1,6 +1,8 @@ #ifndef _M68K_SHM_H #define _M68K_SHM_H +#include <linux/config.h> + /* format of page table entries that correspond to shared memory pages currently out in swap space (see also mm/swap.c): bits 0-1 (PAGE_PRESENT) is = 0 diff --git a/include/asm-m68k/signal.h b/include/asm-m68k/signal.h index 3524a0bf3..228e95c97 100644 --- a/include/asm-m68k/signal.h +++ b/include/asm-m68k/signal.h @@ -63,6 +63,7 @@ typedef unsigned long sigset_t; #define SIGLOST 29 */ #define SIGPWR 30 +#define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ diff --git a/include/asm-m68k/sun3ints.h b/include/asm-m68k/sun3ints.h index 2ea17900d..3f05def62 100644 --- a/include/asm-m68k/sun3ints.h +++ b/include/asm-m68k/sun3ints.h @@ -11,7 +11,6 @@ #ifndef SUN3INTS_H #define SUN3INTS_H -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/include/asm-mips/cache.h b/include/asm-mips/cache.h index 6cf5ce00b..8def356dc 100644 --- a/include/asm-mips/cache.h +++ b/include/asm-mips/cache.h @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: cache.h,v 1.3 1999/10/09 00:01:42 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -10,19 +10,12 @@ #ifndef _ASM_CACHE_H #define _ASM_CACHE_H -/* bytes per L1 cache line */ -#define L1_CACHE_BYTES 32 /* a guess */ +#include <linux/config.h> -#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) - -#define SMP_CACHE_BYTES L1_CACHE_BYTES - -#ifdef MODULE -#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES))) +#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_R6000) +#define L1_CACHE_BYTES 16 #else -#define __cacheline_aligned \ - __attribute__((__aligned__(L1_CACHE_BYTES), \ - __section__(".data.cacheline_aligned"))) +#define L1_CACHE_BYTES 32 /* A guess */ #endif #endif /* _ASM_CACHE_H */ diff --git a/include/asm-mips/hardirq.h b/include/asm-mips/hardirq.h index 2ab5b95ba..167818a8c 100644 --- a/include/asm-mips/hardirq.h +++ b/include/asm-mips/hardirq.h @@ -1,4 +1,4 @@ -/* $Id: hardirq.h,v 1.4 1998/09/19 19:19:37 ralf Exp $ +/* $Id: hardirq.h,v 1.5 1999/10/09 00:01:42 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -26,8 +26,8 @@ extern unsigned int local_irq_count[NR_CPUS]; #define hardirq_trylock(cpu) (local_irq_count[cpu] == 0) #define hardirq_endlock(cpu) do { } while (0) -#define hardirq_enter(cpu) (local_irq_count[cpu]++) -#define hardirq_exit(cpu) (local_irq_count[cpu]--) +#define irq_enter(cpu) (local_irq_count[cpu]++) +#define irq_exit(cpu) (local_irq_count[cpu]--) #define synchronize_irq() barrier(); diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h index f4d11cec5..a881f2b06 100644 --- a/include/asm-mips/io.h +++ b/include/asm-mips/io.h @@ -1,4 +1,4 @@ -/* $Id: io.h,v 1.9 2000/01/27 23:45:30 ralf Exp $ +/* $Id: io.h,v 1.10 2000/01/29 01:42:28 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -216,6 +216,7 @@ static inline int check_signature(unsigned long io_addr, out: return retval; } +#define isa_check_signature(io, s, l) check_signature(i,s,l) /* * Talk about misusing macros.. @@ -414,6 +415,8 @@ __OUTS(w,l,4) __inslc((port),(addr),(count)) : \ __insl((port),(addr),(count))) +#define IO_SPACE_LIMIT 0xffff + /* * The caches on some architectures aren't dma-coherent and have need to * handle this in software. There are three types of operations that diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h index 41ffde38d..68051accf 100644 --- a/include/asm-mips/mmu_context.h +++ b/include/asm-mips/mmu_context.h @@ -1,4 +1,4 @@ -/* $Id: mmu_context.h,v 1.5 1999/10/09 00:01:43 ralf Exp $ +/* $Id: mmu_context.h,v 1.6 1999/12/04 03:59:12 ralf Exp $ * * Switch a MMU context. * @@ -13,6 +13,7 @@ #define _ASM_MMU_CONTEXT_H #include <linux/config.h> +#include <asm/pgalloc.h> /* Fuck. The f-word is here so you can grep for it :-) */ extern unsigned long asid_cache; diff --git a/include/asm-mips/pgalloc.h b/include/asm-mips/pgalloc.h new file mode 100644 index 000000000..75f00ca7f --- /dev/null +++ b/include/asm-mips/pgalloc.h @@ -0,0 +1,224 @@ +/* $Id: pgalloc.h,v 1.1 2000/02/01 16:57:23 ralf Exp $ + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1994 - 2000 by Ralf Baechle at alii + * Copyright (C) 1999, 2000 Silicon Graphics, Inc. + */ +#ifndef _ASM_PGALLOC_H +#define _ASM_PGALLOC_H + +/* Cache flushing: + * + * - flush_cache_all() flushes entire cache + * - flush_cache_mm(mm) flushes the specified mm context's cache lines + * - flush_cache_page(mm, vmaddr) flushes a single page + * - flush_cache_range(mm, start, end) flushes a range of pages + * - flush_page_to_ram(page) write back kernel page to ram + */ +extern void (*flush_cache_all)(void); +extern void (*flush_cache_mm)(struct mm_struct *mm); +extern void (*flush_cache_range)(struct mm_struct *mm, unsigned long start, + unsigned long end); +extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page); +extern void (*flush_cache_sigtramp)(unsigned long addr); +extern void (*flush_page_to_ram)(struct page * page); +#define flush_icache_range(start, end) flush_cache_all() + +/* TLB flushing: + * + * - flush_tlb_all() flushes all processes TLB entries + * - flush_tlb_mm(mm) flushes the specified mm context TLB entries + * - flush_tlb_page(mm, vmaddr) flushes a single page + * - flush_tlb_range(mm, start, end) flushes a range of pages + */ +extern void (*flush_tlb_all)(void); +extern void (*flush_tlb_mm)(struct mm_struct *mm); +extern void (*flush_tlb_range)(struct mm_struct *mm, unsigned long start, + unsigned long end); +extern void (*flush_tlb_page)(struct vm_area_struct *vma, unsigned long page); + +/* + * Allocate and free page tables. The xxx_kernel() versions are + * used to allocate a kernel page table - this turns on ASN bits + * if any. + */ + +#define pgd_quicklist (current_cpu_data.pgd_quick) +#define pmd_quicklist ((unsigned long *)0) +#define pte_quicklist (current_cpu_data.pte_quick) +#define pgtable_cache_size (current_cpu_data.pgtable_cache_sz) + +extern __inline__ pgd_t *get_pgd_slow(void) +{ + pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL), *init; + + if (ret) { + init = pgd_offset(&init_mm, 0); + pgd_init((unsigned long)ret); + memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, + (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); + } + return ret; +} + +extern __inline__ pgd_t *get_pgd_fast(void) +{ + unsigned long *ret; + + if((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } else + ret = (unsigned long *)get_pgd_slow(); + return (pgd_t *)ret; +} + +extern __inline__ void free_pgd_fast(pgd_t *pgd) +{ + *(unsigned long *)pgd = (unsigned long) pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + pgtable_cache_size++; +} + +extern __inline__ void free_pgd_slow(pgd_t *pgd) +{ + free_page((unsigned long)pgd); +} + +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); +extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted); + +extern __inline__ pte_t *get_pte_fast(void) +{ + unsigned long *ret; + + if((ret = (unsigned long *)pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } + return (pte_t *)ret; +} + +extern __inline__ void free_pte_fast(pte_t *pte) +{ + *(unsigned long *)pte = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pte; + pgtable_cache_size++; +} + +extern __inline__ void free_pte_slow(pte_t *pte) +{ + free_page((unsigned long)pte); +} + +/* We don't use pmd cache, so these are dummy routines */ +extern __inline__ pmd_t *get_pmd_fast(void) +{ + return (pmd_t *)0; +} + +extern __inline__ void free_pmd_fast(pmd_t *pmd) +{ +} + +extern __inline__ void free_pmd_slow(pmd_t *pmd) +{ +} + +extern void __bad_pte(pmd_t *pmd); +extern void __bad_pte_kernel(pmd_t *pmd); + +#define pte_free_kernel(pte) free_pte_fast(pte) +#define pte_free(pte) free_pte_fast(pte) +#define pgd_free(pgd) free_pgd_fast(pgd) +#define pgd_alloc() get_pgd_fast() + +extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + + if (pmd_none(*pmd)) { + pte_t *page = get_pte_fast(); + if (page) { + pmd_val(*pmd) = (unsigned long)page; + return page + address; + } + return get_pte_kernel_slow(pmd, address); + } + if (pmd_bad(*pmd)) { + __bad_pte_kernel(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} + +extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + + if (pmd_none(*pmd)) { + pte_t *page = get_pte_fast(); + if (page) { + pmd_val(*pmd) = (unsigned long)page; + return page + address; + } + return get_pte_slow(pmd, address); + } + if (pmd_bad(*pmd)) { + __bad_pte(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} + +/* + * allocating and freeing a pmd is trivial: the 1-entry pmd is + * inside the pgd, so has no extra memory associated with it. + */ +extern inline void pmd_free(pmd_t * pmd) +{ +} + +extern inline pmd_t * pmd_alloc(pgd_t * pgd, unsigned long address) +{ + return (pmd_t *) pgd; +} + +#define pmd_free_kernel pmd_free +#define pmd_alloc_kernel pmd_alloc + +extern int do_check_pgt_cache(int, int); + +extern inline void set_pgdir(unsigned long address, pgd_t entry) +{ + struct task_struct * p; + pgd_t *pgd; +#ifdef __SMP__ + int i; +#endif + + read_lock(&tasklist_lock); + for_each_task(p) { + if (!p->mm) + continue; + *pgd_offset(p->mm,address) = entry; + } + read_unlock(&tasklist_lock); +#ifndef __SMP__ + for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[address >> PGDIR_SHIFT] = entry; +#else + /* To pgd_alloc/pgd_free, one holds master kernel lock and so does our + callee, so we can modify pgd caches of other CPUs as well. -jj */ + for (i = 0; i < NR_CPUS; i++) + for (pgd = (pgd_t *)cpu_data[i].pgd_quick; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[address >> PGDIR_SHIFT] = entry; +#endif +} + +#endif /* _ASM_PGALLOC_H */ diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index 42ce0bdca..d28144839 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.26 2000/01/27 01:05:37 ralf Exp $ +/* $Id: pgtable.h,v 1.27 2000/01/29 01:42:28 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -11,6 +11,7 @@ #define _ASM_PGTABLE_H #include <asm/addrspace.h> +#include <asm/page.h> #ifndef _LANGUAGE_ASSEMBLY @@ -18,36 +19,6 @@ #include <asm/cachectl.h> #include <linux/config.h> -/* Cache flushing: - * - * - flush_cache_all() flushes entire cache - * - flush_cache_mm(mm) flushes the specified mm context's cache lines - * - flush_cache_page(mm, vmaddr) flushes a single page - * - flush_cache_range(mm, start, end) flushes a range of pages - * - flush_page_to_ram(page) write back kernel page to ram - */ -extern void (*flush_cache_all)(void); -extern void (*flush_cache_mm)(struct mm_struct *mm); -extern void (*flush_cache_range)(struct mm_struct *mm, unsigned long start, - unsigned long end); -extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page); -extern void (*flush_cache_sigtramp)(unsigned long addr); -extern void (*flush_page_to_ram)(struct page * page); -#define flush_icache_range(start, end) flush_cache_all() - -/* TLB flushing: - * - * - flush_tlb_all() flushes all processes TLB entries - * - flush_tlb_mm(mm) flushes the specified mm context TLB entries - * - flush_tlb_page(mm, vmaddr) flushes a single page - * - flush_tlb_range(mm, start, end) flushes a range of pages - */ -extern void flush_tlb_all(void); -extern void flush_tlb_mm(struct mm_struct *mm); -extern void flush_tlb_range(struct mm_struct *mm, unsigned long start, - unsigned long end); -extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page); - /* * - add_wired_entry() add a fixed TLB entry, and move wired register */ @@ -267,8 +238,6 @@ extern inline void pte_clear(pte_t *ptep) set_pte(ptep, __pte(0)); } -#define pte_pagenr(x) ((unsigned long)((pte_val(x) >> PAGE_SHIFT))) - /* * Empty pgd/pmd entries point to the invalid_pte_table. */ @@ -306,12 +275,10 @@ extern inline void pgd_clear(pgd_t *pgdp) { } /* * Permanent address of a page. On MIPS64 we never have highmem, so this * is simple. - * called on a highmem page. */ -#define page_address(page) \ - (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) -#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) /* Unused? */ -#define pte_page(x) (mem_map+pte_pagenr(x)) +#define page_address(page) ((page)->virtual) +#define pte_pagenr(x) ((unsigned long)((pte_val(x) >> PAGE_SHIFT))) +#define pte_page(x) (mem_map+pte_pagenr(x)) /* * The following only work if pte_present() is true. @@ -382,15 +349,15 @@ extern inline pte_t pte_mkyoung(pte_t pte) * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ -extern inline pte_t mk_pte(struct page * page, pgprot_t pgprot) -{ - pte_t __pte; - - pte_val(__pte) = ((unsigned long)(page - mem_map) << PAGE_SHIFT) | - pgprot_val(pgprot); - - return __pte; -} +#define mk_pte(page, pgprot) \ +({ \ + pte_t __pte; \ + \ + pte_val(__pte) = ((unsigned long)(page - mem_map) << PAGE_SHIFT) | \ + pgprot_val(pgprot); \ + \ + __pte; \ +}) extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) { @@ -431,96 +398,6 @@ extern inline pte_t *pte_offset(pmd_t * dir, unsigned long address) */ extern void pgd_init(unsigned long page); -/* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any. - */ - -#define pgd_quicklist (current_cpu_data.pgd_quick) -#define pmd_quicklist ((unsigned long *)0) -#define pte_quicklist (current_cpu_data.pte_quick) -#define pgtable_cache_size (current_cpu_data.pgtable_cache_sz) - -extern __inline__ pgd_t *get_pgd_slow(void) -{ - pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL), *init; - - if (ret) { - init = pgd_offset(&init_mm, 0); - pgd_init((unsigned long)ret); - memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, - (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); - } - return ret; -} - -extern __inline__ pgd_t *get_pgd_fast(void) -{ - unsigned long *ret; - - if((ret = pgd_quicklist) != NULL) { - pgd_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } else - ret = (unsigned long *)get_pgd_slow(); - return (pgd_t *)ret; -} - -extern __inline__ void free_pgd_fast(pgd_t *pgd) -{ - *(unsigned long *)pgd = (unsigned long) pgd_quicklist; - pgd_quicklist = (unsigned long *) pgd; - pgtable_cache_size++; -} - -extern __inline__ void free_pgd_slow(pgd_t *pgd) -{ - free_page((unsigned long)pgd); -} - -extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); -extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted); - -extern __inline__ pte_t *get_pte_fast(void) -{ - unsigned long *ret; - - if((ret = (unsigned long *)pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } - return (pte_t *)ret; -} - -extern __inline__ void free_pte_fast(pte_t *pte) -{ - *(unsigned long *)pte = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pte; - pgtable_cache_size++; -} - -extern __inline__ void free_pte_slow(pte_t *pte) -{ - free_page((unsigned long)pte); -} - -/* We don't use pmd cache, so these are dummy routines */ -extern __inline__ pmd_t *get_pmd_fast(void) -{ - return (pmd_t *)0; -} - -extern __inline__ void free_pmd_fast(pmd_t *pmd) -{ -} - -extern __inline__ void free_pmd_slow(pmd_t *pmd) -{ -} - extern void __bad_pte(pmd_t *pmd); extern void __bad_pte_kernel(pmd_t *pmd); @@ -529,89 +406,8 @@ extern void __bad_pte_kernel(pmd_t *pmd); #define pgd_free(pgd) free_pgd_fast(pgd) #define pgd_alloc() get_pgd_fast() -extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - - if (pmd_none(*pmd)) { - pte_t *page = get_pte_fast(); - if (page) { - pmd_val(*pmd) = (unsigned long)page; - return page + address; - } - return get_pte_kernel_slow(pmd, address); - } - if (pmd_bad(*pmd)) { - __bad_pte_kernel(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} - -extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - - if (pmd_none(*pmd)) { - pte_t *page = get_pte_fast(); - if (page) { - pmd_val(*pmd) = (unsigned long)page; - return page + address; - } - return get_pte_slow(pmd, address); - } - if (pmd_bad(*pmd)) { - __bad_pte(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} - -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -extern inline void pmd_free(pmd_t * pmd) -{ -} - -extern inline pmd_t * pmd_alloc(pgd_t * pgd, unsigned long address) -{ - return (pmd_t *) pgd; -} - -#define pmd_free_kernel pmd_free -#define pmd_alloc_kernel pmd_alloc - extern int do_check_pgt_cache(int, int); -extern inline void set_pgdir(unsigned long address, pgd_t entry) -{ - struct task_struct * p; - pgd_t *pgd; -#ifdef __SMP__ - int i; -#endif - - read_lock(&tasklist_lock); - for_each_task(p) { - if (!p->mm) - continue; - *pgd_offset(p->mm,address) = entry; - } - read_unlock(&tasklist_lock); -#ifndef __SMP__ - for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[address >> PGDIR_SHIFT] = entry; -#else - /* To pgd_alloc/pgd_free, one holds master kernel lock and so does our - callee, so we can modify pgd caches of other CPUs as well. -jj */ - for (i = 0; i < NR_CPUS; i++) - for (pgd = (pgd_t *)cpu_data[i].pgd_quick; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[address >> PGDIR_SHIFT] = entry; -#endif -} - extern pgd_t swapper_pg_dir[1024]; extern void update_mmu_cache(struct vm_area_struct *vma, diff --git a/include/asm-mips/resource.h b/include/asm-mips/resource.h index c628852f1..af41618ba 100644 --- a/include/asm-mips/resource.h +++ b/include/asm-mips/resource.h @@ -1,4 +1,4 @@ -/* $Id: resource.h,v 1.3 1999/10/09 00:01:43 ralf Exp $ +/* $Id: resource.h,v 1.4 2000/01/27 23:45:30 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -25,6 +25,12 @@ #define RLIM_NLIMITS 10 /* Number of limit flavors. */ +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + */ +#define RLIM_INFINITY 0x7fffffffUL + #ifdef __KERNEL__ #define INIT_RLIMITS \ diff --git a/include/asm-mips/serial.h b/include/asm-mips/serial.h index 445e6a32d..3fbefe683 100644 --- a/include/asm-mips/serial.h +++ b/include/asm-mips/serial.h @@ -1,6 +1,7 @@ -/* $Id: serial.h,v 1.6 2000/01/26 00:07:45 ralf Exp $ +/* $Id: serial.h,v 1.7 2000/01/31 03:44:29 ralf Exp $ * - * include/asm-mips/serial.h + * Copyright (C) 1999 by Ralf Baechle + * Copyright (C) 1999, 2000 Silicon Graphics, Inc. */ #include <linux/config.h> #include <asm/bootinfo.h> @@ -16,8 +17,8 @@ #define BASE_BAUD ( 1843200 / 16 ) #ifndef CONFIG_OLIVETTI_M700 -/* Some Jazz machines seem to have an 8MHz crystal clock but I don't know - exactly which ones ... XXX */ + /* Some Jazz machines seem to have an 8MHz crystal clock but I don't know + exactly which ones ... XXX */ #define JAZZ_BASE_BAUD ( 8000000 / 16 ) /* ( 3072000 / 16) */ #else /* but the M700 isn't such a strange beast */ @@ -60,12 +61,13 @@ #define C_P(card,port) (((card)<<6|(port)<<3) + 1) #ifdef CONFIG_MIPS_JAZZ -#define JAZZ_SERIAL_PORT_DEFNS \ - /* UART CLK PORT IRQ FLAGS */ \ - { 0, JAZZ_BASE_BAUD, JAZZ_SERIAL1_BASE, /* ttyS0 */ \ - JAZZ_SERIAL1_IRQ, STD_COM_FLAGS }, \ - { 0, JAZZ_BASE_BAUD, JAZZ_SERIAL2_BASE, /* ttyS1 */ \ - JAZZ_SERIAL2_IRQ, STD_COM_FLAGS }, +#define _JAZZ_SERIAL_INIT(int, base) \ + { baud_base: JAZZ_BASE_BAUD, irq: int, flags: STD_COM_FLAGS, \ + iomem_base: (u8 *) base, iomem_reg_shift: 0, \ + io_type: SERIAL_IO_MEM } +#define JAZZ_SERIAL_PORT_DEFNS \ + _JAZZ_SERIAL_INIT(JAZZ_SERIAL1_IRQ, JAZZ_SERIAL1_BASE), \ + _JAZZ_SERIAL_INIT(JAZZ_SERIAL2_IRQ, JAZZ_SERIAL2_BASE), #else #define JAZZ_SERIAL_PORT_DEFNS #endif diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h index 5b8dbbf28..3a2f5a3b2 100644 --- a/include/asm-mips/unistd.h +++ b/include/asm-mips/unistd.h @@ -1,4 +1,4 @@ -/* $Id: unistd.h,v 1.16 1999/10/09 00:01:43 ralf Exp $ +/* $Id: unistd.h,v 1.17 2000/01/29 01:42:28 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -1196,12 +1196,14 @@ #define __NR_sendfile (__NR_Linux + 207) #define __NR_getpmsg (__NR_Linux + 208) #define __NR_putpmsg (__NR_Linux + 209) -#define __NR_ugetrlimit (__NR_Linux + 210) +#define __NR_mmap2 (__NR_Linux + 210) +#define __NR_truncate64 (__NR_Linux + 211) +#define __NR_ftruncate64 (__NR_Linux + 212) /* * Offset of the last Linux flavoured syscall */ -#define __NR_Linux_syscalls 210 +#define __NR_Linux_syscalls 212 #ifndef _LANGUAGE_ASSEMBLY diff --git a/include/asm-mips64/cache.h b/include/asm-mips64/cache.h index 3317887ea..1327f2b1f 100644 --- a/include/asm-mips64/cache.h +++ b/include/asm-mips64/cache.h @@ -1,4 +1,4 @@ -/* $Id: cache.h,v 1.1 1999/08/18 23:37:50 ralf Exp $ +/* $Id: cache.h,v 1.2 1999/10/09 00:01:43 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -11,18 +11,6 @@ #define _ASM_CACHE_H /* bytes per L1 cache line */ -#define L1_CACHE_BYTES 32 /* a guess */ - -#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) - -#define SMP_CACHE_BYTES L1_CACHE_BYTES - -#ifdef MODULE -#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES))) -#else -#define __cacheline_aligned \ - __attribute__((__aligned__(L1_CACHE_BYTES), \ - __section__(".data.cacheline_aligned"))) -#endif +#define L1_CACHE_BYTES 32 /* A guess */ #endif /* _ASM_CACHE_H */ diff --git a/include/asm-mips64/hardirq.h b/include/asm-mips64/hardirq.h index ed8895b7e..7f3adeb68 100644 --- a/include/asm-mips64/hardirq.h +++ b/include/asm-mips64/hardirq.h @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: hardirq.h,v 1.2 1999/12/04 03:59:12 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -26,8 +26,8 @@ extern unsigned int local_irq_count[NR_CPUS]; #define hardirq_trylock(cpu) (local_irq_count[cpu] == 0) #define hardirq_endlock(cpu) do { } while (0) -#define hardirq_enter(cpu) (local_irq_count[cpu]++) -#define hardirq_exit(cpu) (local_irq_count[cpu]--) +#define irq_enter(cpu) (local_irq_count[cpu]++) +#define irq_exit(cpu) (local_irq_count[cpu]--) #define synchronize_irq() barrier(); diff --git a/include/asm-mips64/io.h b/include/asm-mips64/io.h index 6fc3355e4..8afd3873d 100644 --- a/include/asm-mips64/io.h +++ b/include/asm-mips64/io.h @@ -1,4 +1,4 @@ -/* $Id: io.h,v 1.7 2000/01/29 01:42:28 ralf Exp $ +/* $Id: io.h,v 1.8 2000/01/31 21:34:07 kanoj Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -15,32 +15,62 @@ #include <asm/addrspace.h> #include <asm/page.h> +#ifdef CONFIG_SGI_IP22 +#include <asm/sgi/io.h> +#endif + +#ifdef CONFIG_SGI_IP27 +#include <asm/sn/io.h> +#endif + /* * Slowdown I/O port space accesses for antique hardware. */ #undef CONF_SLOWDOWN_IO /* - * This file contains the definitions for the MIPS counterpart of the - * x86 in/out instructions. This heap of macros and C results in much - * better code than the approach of doing it in plain C. The macros - * result in code that is to fast for certain hardware. On the other - * side the performance of the string functions should be improved for - * sake of certain devices like EIDE disks that do highspeed polled I/O. - * - * Ralf - * - * This file contains the definitions for the x86 IO instructions - * inb/inw/inl/outb/outw/outl and the "string versions" of the same - * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing" - * versions of the single-IO instructions (inb_p/inw_p/..). + * On MIPS, we have the whole physical address space mapped at all + * times, so "ioremap()" and "iounmap()" do not need to do anything. * - * This file is not meant to be obfuscating: it's just complicated - * to (a) handle it all in a way that makes gcc able to optimize it - * as well as possible and (b) trying to avoid writing the same thing - * over and over again with slight variations and possibly making a - * mistake somewhere. + * We cheat a bit and always return uncachable areas until we've fixed + * the drivers to handle caching properly. */ +extern inline void * +ioremap(unsigned long offset, unsigned long size) +{ + return (void *) (IO_SPACE_BASE | offset); +} + +/* This one maps high address device memory and turns off caching for that + * area. It's useful if some control registers are in such an area and write + * combining or read caching is not desirable. + */ +extern inline void * +ioremap_nocache (unsigned long offset, unsigned long size) +{ + return (void *) (IO_SPACE_BASE | offset); +} + +extern inline void iounmap(void *addr) +{ +} + +/* + * This assumes sane hardware. The Origin is. + */ +#define readb(addr) (*(volatile unsigned char *) (addr)) +#define readw(addr) (*(volatile unsigned short *) (addr)) +#define readl(addr) (*(volatile unsigned int *) (addr)) + +#define writeb(b,addr) (*(volatile unsigned char *) (addr) = (b)) +#define writew(b,addr) (*(volatile unsigned short *) (addr) = (b)) +#define writel(b,addr) (*(volatile unsigned int *) (addr) = (b)) + +#define memset_io(a,b,c) memset((void *) a,(b),(c)) +#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) +#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) + +/* The ISA versions are supplied by system specific code */ /* * On MIPS I/O ports are memory mapped, so we access them using normal @@ -81,9 +111,6 @@ extern inline void * phys_to_virt(unsigned long address) return (void *)(address + PAGE_OFFSET); } -extern void * ioremap(unsigned long phys_addr, unsigned long size); -extern void iounmap(void *addr); - #define BRIDGE_DIRECT_MAPPED_BASE 0xa200000000000000ull /* @@ -108,84 +135,10 @@ extern inline void * bus_to_virt(unsigned long address) extern unsigned long isa_slot_offset; /* - * readX/writeX() are used to access memory mapped devices. On some - * architectures the memory mapped IO stuff needs to be accessed - * differently. On the x86 architecture, we just read/write the - * memory location directly. - * - * On MIPS, we have the whole physical address space mapped at all - * times, so "ioremap()" and "iounmap()" do not need to do anything. - * (This isn't true for all machines but we still handle these cases - * with wired TLB entries anyway ...) - * - * We cheat a bit and always return uncachable areas until we've fixed - * the drivers to handle caching properly. - */ -extern inline void * -ioremap(unsigned long offset, unsigned long size) -{ - return (void *) KSEG1ADDR(offset); -} - -/* This one maps high address device memory and turns off caching for that - area. It's useful if some control registers are in such an area and write - combining or read caching is not desirable. */ -extern inline void * -ioremap_nocache (unsigned long offset, unsigned long size) -{ - return (void *) KSEG1ADDR(offset); -} - -extern inline void iounmap(void *addr) -{ -} - -/* - * XXX We need system specific versions of these to handle EISA address bits - * 24-31 on SNI. - * XXX more SNI hacks. - */ -#define readb(addr) (*(volatile unsigned char *) (0xa0000000 + (unsigned long)(addr))) -#define readw(addr) (*(volatile unsigned short *) (0xa0000000 + (unsigned long)(addr))) -#define readl(addr) (*(volatile unsigned int *) (0xa0000000 + (unsigned long)(addr))) - -#define writeb(b,addr) (*(volatile unsigned char *) (0xa0000000 + (unsigned long)(addr)) = (b)) -#define writew(b,addr) (*(volatile unsigned short *) (0xa0000000 + (unsigned long)(addr)) = (b)) -#define writel(b,addr) (*(volatile unsigned int *) (0xa0000000 + (unsigned long)(addr)) = (b)) - -#define memset_io(a,b,c) memset((void *)(0xa0000000 + (unsigned long)a),(b),(c)) -#define memcpy_fromio(a,b,c) memcpy((a),(void *)(0xa0000000 + (unsigned long)(b)),(c)) -#define memcpy_toio(a,b,c) memcpy((void *)(0xa0000000 + (unsigned long)(a)),(b),(c)) - -/* END SNI HACKS ... */ - -/* - * ISA space is 'always mapped' on currently supported MIPS systems, no need - * to explicitly ioremap() it. The fact that the ISA IO space is mapped - * to PAGE_OFFSET is pure coincidence - it does not mean ISA values - * are physical addresses. The following constant pointer can be - * used as the IO-area pointer (it can be iounmapped as well, so the - * analogy with PCI is quite large): - */ -#define __ISA_IO_base ((char *)(PAGE_OFFSET)) - -#define isa_readb(a) readb(a) -#define isa_readw(a) readw(a) -#define isa_readl(a) readl(a) -#define isa_writeb(b,a) writeb(b,a) -#define isa_writew(w,a) writew(w,a) -#define isa_writel(l,a) writel(l,a) - -#define isa_memset_io(a,b,c) memset_io((a),(b),(c)) -#define isa_memcpy_fromio(a,b,c) memcpy_fromio((a),(b),(c)) -#define isa_memcpy_toio(a,b,c) memcpy_toio((a),(b),(c)) - -/* * We don't have csum_partial_copy_fromio() yet, so we cheat here and * just copy it. The net code will then do the checksum later. */ #define eth_io_copy_and_sum(skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len)) -#define isa_eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(b),(c),(d)) static inline int check_signature(unsigned long io_addr, const unsigned char *signature, diff --git a/include/asm-mips64/mmu_context.h b/include/asm-mips64/mmu_context.h index 03df39e4b..d81818f88 100644 --- a/include/asm-mips64/mmu_context.h +++ b/include/asm-mips64/mmu_context.h @@ -1,4 +1,4 @@ -/* $Id: mmu_context.h,v 1.3 1999/11/19 20:35:49 ralf Exp $ +/* $Id: mmu_context.h,v 1.2 1999/12/04 03:59:12 ralf Exp $ * * Switch a MMU context. * @@ -13,6 +13,7 @@ #define _ASM_MMU_CONTEXT_H #include <linux/config.h> +#include <asm/pgalloc.h> /* Fuck. The f-word is here so you can grep for it :-) */ extern unsigned long asid_cache; diff --git a/include/asm-mips64/paccess.h b/include/asm-mips64/paccess.h index 115da0cf2..a4e14ab58 100644 --- a/include/asm-mips64/paccess.h +++ b/include/asm-mips64/paccess.h @@ -1,4 +1,4 @@ -/* $Id: paccess.h,v 1.1 2000/01/20 22:50:32 ralf Exp $ +/* $Id: paccess.h,v 1.2 2000/01/21 22:34:07 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -20,7 +20,7 @@ #define get_dbe(x,ptr) __get_dbe((x),(ptr),sizeof(*(ptr))) struct __large_pstruct { unsigned long buf[100]; }; -#define __m(x) (*(struct __large_pstruct *)(x)) +#define __mp(x) (*(struct __large_pstruct *)(x)) #define __get_dbe(x,ptr,size) ({ \ long __gu_err; \ @@ -52,7 +52,7 @@ __asm__ __volatile__( \ ".dword\t1b,3b\n\t" \ ".previous" \ :"=r" (__gu_err), "=r" (__gu_val) \ - :"o" (__m(__gu_addr)), "i" (-EFAULT)); }) + :"o" (__mp(__gu_addr)), "i" (-EFAULT)); }) extern void __get_dbe_unknown(void); @@ -85,7 +85,7 @@ __asm__ __volatile__( \ ".dword\t1b,3b\n\t" \ ".previous" \ :"=r" (__pu_err) \ - :"r" (__pu_val), "o" (__m(__pu_addr)), "i" (-EFAULT)); }) + :"r" (__pu_val), "o" (__mp(__pu_addr)), "i" (-EFAULT)); }) extern void __put_dbe_unknown(void); diff --git a/include/asm-mips64/pgalloc.h b/include/asm-mips64/pgalloc.h new file mode 100644 index 000000000..963a996f1 --- /dev/null +++ b/include/asm-mips64/pgalloc.h @@ -0,0 +1,237 @@ +/* $Id$ + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1994 - 2000 by Ralf Baechle at alii + * Copyright (C) 1999, 2000 Silicon Graphics, Inc. + */ +#ifndef _ASM_PGALLOC_H +#define _ASM_PGALLOC_H + +/* Cache flushing: + * + * - flush_cache_all() flushes entire cache + * - flush_cache_mm(mm) flushes the specified mm context's cache lines + * - flush_cache_page(mm, vmaddr) flushes a single page + * - flush_cache_range(mm, start, end) flushes a range of pages + * - flush_page_to_ram(page) write back kernel page to ram + */ +extern void (*flush_cache_all)(void); +extern void (*flush_cache_mm)(struct mm_struct *mm); +extern void (*flush_cache_range)(struct mm_struct *mm, unsigned long start, + unsigned long end); +extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page); +extern void (*flush_cache_sigtramp)(unsigned long addr); +extern void (*flush_page_to_ram)(struct page * page); +#define flush_icache_range(start, end) flush_cache_all() + +/* TLB flushing: + * + * - flush_tlb_all() flushes all processes TLB entries + * - flush_tlb_mm(mm) flushes the specified mm context TLB entries + * - flush_tlb_page(mm, vmaddr) flushes a single page + * - flush_tlb_range(mm, start, end) flushes a range of pages + */ +extern void (*flush_tlb_all)(void); +extern void (*flush_tlb_mm)(struct mm_struct *mm); +extern void (*flush_tlb_range)(struct mm_struct *mm, unsigned long start, + unsigned long end); +extern void (*flush_tlb_page)(struct vm_area_struct *vma, unsigned long page); + +/* + * Allocate and free page tables. The xxx_kernel() versions are + * used to allocate a kernel page table - this turns on ASN bits + * if any. + */ + +#define pgd_quicklist (current_cpu_data.pgd_quick) +#define pmd_quicklist (current_cpu_data.pmd_quick) +#define pte_quicklist (current_cpu_data.pte_quick) +#define pgtable_cache_size (current_cpu_data.pgtable_cache_sz) + +extern pgd_t *get_pgd_slow(void); + +extern inline pgd_t *get_pgd_fast(void) +{ + unsigned long *ret; + + if((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + return (pgd_t *)ret; + } + + ret = (unsigned long *) get_pgd_slow(); + return (pgd_t *)ret; +} + +extern inline void free_pgd_fast(pgd_t *pgd) +{ + *(unsigned long *)pgd = (unsigned long) pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + pgtable_cache_size++; +} + +extern inline void free_pgd_slow(pgd_t *pgd) +{ + free_pages((unsigned long)pgd, 1); +} + +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); +extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted); + +extern inline pte_t *get_pte_fast(void) +{ + unsigned long *ret; + + if((ret = (unsigned long *)pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + } + return (pte_t *)ret; +} + +extern inline void free_pte_fast(pte_t *pte) +{ + *(unsigned long *)pte = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pte; + pgtable_cache_size++; +} + +extern inline void free_pte_slow(pte_t *pte) +{ + free_pages((unsigned long)pte, 0); +} + +extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long address_preadjusted); +extern pmd_t *get_pmd_kernel_slow(pgd_t *pgd, unsigned long address_preadjusted); + +extern inline pmd_t *get_pmd_fast(void) +{ + unsigned long *ret; + + if ((ret = (unsigned long *)pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)(*ret); + ret[0] = ret[1]; + pgtable_cache_size--; + return (pmd_t *)ret; + } + + return (pmd_t *)ret; +} + +extern inline void free_pmd_fast(pmd_t *pmd) +{ + *(unsigned long *)pmd = (unsigned long) pte_quicklist; + pte_quicklist = (unsigned long *) pmd; + pgtable_cache_size++; +} + +extern inline void free_pmd_slow(pmd_t *pmd) +{ + free_pages((unsigned long)pmd, 1); +} + +extern void __bad_pte(pmd_t *pmd); +extern void __bad_pte_kernel(pmd_t *pmd); +extern void __bad_pmd(pgd_t *pgd); + +#define pte_free_kernel(pte) free_pte_fast(pte) +#define pte_free(pte) free_pte_fast(pte) +#define pmd_free_kernel(pte) free_pmd_fast(pte) +#define pmd_free(pte) free_pmd_fast(pte) +#define pgd_free(pgd) free_pgd_fast(pgd) +#define pgd_alloc() get_pgd_fast() + +extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + + if (pmd_none(*pmd)) { + pte_t *page = get_pte_fast(); + if (page) { + pmd_val(*pmd) = (unsigned long) page; + return page + address; + } + return get_pte_kernel_slow(pmd, address); + } + if (pmd_bad(*pmd)) { + __bad_pte_kernel(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} + +extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + + if (pmd_none(*pmd)) { + pte_t *page = get_pte_fast(); + if (page) { + pmd_val(*pmd) = (unsigned long) page; + return page + address; + } + return get_pte_slow(pmd, address); + } + if (pmd_bad(*pmd)) { + __bad_pte(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} + +extern inline pmd_t *pmd_alloc(pgd_t * pgd, unsigned long address) +{ + address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); + if (pgd_none(*pgd)) { + pmd_t *page = get_pmd_fast(); + + if (!page) + return get_pmd_slow(pgd, address); + pgd_set(pgd, page); + return page + address; + } + if (pgd_bad(*pgd)) { + __bad_pmd(pgd); + return NULL; + } + return (pmd_t *) pgd_page(*pgd) + address; +} + +#define pmd_alloc_kernel pmd_alloc + +extern int do_check_pgt_cache(int, int); + +extern inline void set_pgdir(unsigned long address, pgd_t entry) +{ + struct task_struct * p; + pgd_t *pgd; +#ifdef __SMP__ + int i; +#endif + + read_lock(&tasklist_lock); + for_each_task(p) { + if (!p->mm) + continue; + *pgd_offset(p->mm, address) = entry; + } + read_unlock(&tasklist_lock); +#ifndef __SMP__ + for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[address >> PGDIR_SHIFT] = entry; +#else + /* To pgd_alloc/pgd_free, one holds master kernel lock and so does our + callee, so we can modify pgd caches of other CPUs as well. -jj */ + for (i = 0; i < NR_CPUS; i++) + for (pgd = (pgd_t *)cpu_data[i].pgd_quick; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[address >> PGDIR_SHIFT] = entry; +#endif +} + +#endif /* _ASM_PGALLOC_H */ diff --git a/include/asm-mips64/pgtable.h b/include/asm-mips64/pgtable.h index f45b89b1f..7e2988cfc 100644 --- a/include/asm-mips64/pgtable.h +++ b/include/asm-mips64/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.5 2000/01/27 01:05:37 ralf Exp $ +/* $Id: pgtable.h,v 1.6 2000/01/29 01:42:28 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -17,37 +17,6 @@ #include <linux/linkage.h> #include <asm/cachectl.h> -/* Cache flushing: - * - * - flush_cache_all() flushes entire cache - * - flush_cache_mm(mm) flushes the specified mm context's cache lines - * - flush_cache_page(mm, vmaddr) flushes a single page - * - flush_cache_range(mm, start, end) flushes a range of pages - * - flush_page_to_ram(page) write back kernel page to ram - */ -extern void (*flush_cache_all)(void); -extern void (*flush_cache_mm)(struct mm_struct *mm); -extern void (*flush_cache_range)(struct mm_struct *mm, unsigned long start, - unsigned long end); -extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page); -extern void (*flush_cache_sigtramp)(unsigned long addr); -extern void (*flush_page_to_ram)(struct page * page); -#define flush_icache_range(start, end) flush_cache_all() - -/* TLB flushing: - * - * - flush_tlb_all() flushes all processes TLB entries - * - flush_tlb_mm(mm) flushes the specified mm context TLB entries - * - flush_tlb_page(mm, vmaddr) flushes a single page - * - flush_tlb_range(mm, start, end) flushes a range of pages - */ -extern void (*flush_tlb_all)(void); -extern void (*flush_tlb_mm)(struct mm_struct *mm); -extern void (*flush_tlb_range)(struct mm_struct *mm, unsigned long start, - unsigned long end); -extern void (*flush_tlb_page)(struct vm_area_struct *vma, unsigned long page); - - /* Basically we have the same two-level (which is the logical three level * Linux page table layout folded) page tables as the i386. Some day * when we have proper page coloring support we can have a 1% quicker @@ -261,8 +230,6 @@ extern inline void pte_clear(pte_t *ptep) set_pte(ptep, __pte(0)); } -#define pte_pagenr(x) ((unsigned long)((pte_val(x) >> PAGE_SHIFT))) - /* * Empty pmd entries point to the invalid_pte_table. */ @@ -316,10 +283,9 @@ extern inline void pgd_clear(pgd_t *pgdp) * is simple. * called on a highmem page. */ -#define page_address(page) \ - (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) -#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) /* Unused? */ -#define pte_page(x) (mem_map+pte_pagenr(x)) +#define page_address(page) ((page)->virtual) +#define pte_pagenr(x) ((unsigned long)((pte_val(x) >> PAGE_SHIFT))) +#define pte_page(x) (mem_map+pte_pagenr(x)) /* * The following only work if pte_present() is true. @@ -405,15 +371,15 @@ extern inline pte_t pte_mkyoung(pte_t pte) * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ -extern inline pte_t mk_pte(struct page * page, pgprot_t pgprot) -{ - pte_t __pte; - - pte_val(__pte) = ((unsigned long)(page - mem_map) << PAGE_SHIFT) | - pgprot_val(pgprot); - - return __pte; -} +#define mk_pte(page, pgprot) \ +({ \ + pte_t __pte; \ + \ + pte_val(__pte) = ((unsigned long)(page - mem_map) << PAGE_SHIFT) | \ + pgprot_val(pgprot); \ + \ + __pte; \ +}) extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) { @@ -457,200 +423,6 @@ extern void pte_init(unsigned long page); extern void pgd_init(unsigned long page); extern void pmd_init(unsigned long page); -/* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any. - */ - -#define pgd_quicklist (current_cpu_data.pgd_quick) -#define pmd_quicklist (current_cpu_data.pmd_quick) -#define pte_quicklist (current_cpu_data.pte_quick) -#define pgtable_cache_size (current_cpu_data.pgtable_cache_sz) - -extern pgd_t *get_pgd_slow(void); - -extern inline pgd_t *get_pgd_fast(void) -{ - unsigned long *ret; - - if((ret = pgd_quicklist) != NULL) { - pgd_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - return (pgd_t *)ret; - } - - ret = (unsigned long *) get_pgd_slow(); - return (pgd_t *)ret; -} - -extern inline void free_pgd_fast(pgd_t *pgd) -{ - *(unsigned long *)pgd = (unsigned long) pgd_quicklist; - pgd_quicklist = (unsigned long *) pgd; - pgtable_cache_size++; -} - -extern inline void free_pgd_slow(pgd_t *pgd) -{ - free_pages((unsigned long)pgd, 1); -} - -extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); -extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted); - -extern inline pte_t *get_pte_fast(void) -{ - unsigned long *ret; - - if((ret = (unsigned long *)pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } - return (pte_t *)ret; -} - -extern inline void free_pte_fast(pte_t *pte) -{ - *(unsigned long *)pte = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pte; - pgtable_cache_size++; -} - -extern inline void free_pte_slow(pte_t *pte) -{ - free_pages((unsigned long)pte, 0); -} - -extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long address_preadjusted); -extern pmd_t *get_pmd_kernel_slow(pgd_t *pgd, unsigned long address_preadjusted); - -extern inline pmd_t *get_pmd_fast(void) -{ - unsigned long *ret; - - if ((ret = (unsigned long *)pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - return (pmd_t *)ret; - } - - return (pmd_t *)ret; -} - -extern inline void free_pmd_fast(pmd_t *pmd) -{ - *(unsigned long *)pmd = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pmd; - pgtable_cache_size++; -} - -extern inline void free_pmd_slow(pmd_t *pmd) -{ - free_pages((unsigned long)pmd, 1); -} - -extern void __bad_pte(pmd_t *pmd); -extern void __bad_pte_kernel(pmd_t *pmd); -extern void __bad_pmd(pgd_t *pgd); - -#define pte_free_kernel(pte) free_pte_fast(pte) -#define pte_free(pte) free_pte_fast(pte) -#define pmd_free_kernel(pte) free_pmd_fast(pte) -#define pmd_free(pte) free_pmd_fast(pte) -#define pgd_free(pgd) free_pgd_fast(pgd) -#define pgd_alloc() get_pgd_fast() - -extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - - if (pmd_none(*pmd)) { - pte_t *page = get_pte_fast(); - if (page) { - pmd_val(*pmd) = (unsigned long) page; - return page + address; - } - return get_pte_kernel_slow(pmd, address); - } - if (pmd_bad(*pmd)) { - __bad_pte_kernel(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} - -extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - - if (pmd_none(*pmd)) { - pte_t *page = get_pte_fast(); - if (page) { - pmd_val(*pmd) = (unsigned long) page; - return page + address; - } - return get_pte_slow(pmd, address); - } - if (pmd_bad(*pmd)) { - __bad_pte(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} - -extern inline pmd_t *pmd_alloc(pgd_t * pgd, unsigned long address) -{ - address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); - if (pgd_none(*pgd)) { - pmd_t *page = get_pmd_fast(); - - if (!page) - return get_pmd_slow(pgd, address); - pgd_set(pgd, page); - return page + address; - } - if (pgd_bad(*pgd)) { - __bad_pmd(pgd); - return NULL; - } - return (pmd_t *) pgd_page(*pgd) + address; -} - -#define pmd_alloc_kernel pmd_alloc - -extern int do_check_pgt_cache(int, int); - -extern inline void set_pgdir(unsigned long address, pgd_t entry) -{ - struct task_struct * p; - pgd_t *pgd; -#ifdef __SMP__ - int i; -#endif - - read_lock(&tasklist_lock); - for_each_task(p) { - if (!p->mm) - continue; - *pgd_offset(p->mm, address) = entry; - } - read_unlock(&tasklist_lock); -#ifndef __SMP__ - for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[address >> PGDIR_SHIFT] = entry; -#else - /* To pgd_alloc/pgd_free, one holds master kernel lock and so does our - callee, so we can modify pgd caches of other CPUs as well. -jj */ - for (i = 0; i < NR_CPUS; i++) - for (pgd = (pgd_t *)cpu_data[i].pgd_quick; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[address >> PGDIR_SHIFT] = entry; -#endif -} - extern pgd_t swapper_pg_dir[1024]; extern void (*update_mmu_cache)(struct vm_area_struct *vma, diff --git a/include/asm-mips64/resource.h b/include/asm-mips64/resource.h index 6f317289f..199a9a4e6 100644 --- a/include/asm-mips64/resource.h +++ b/include/asm-mips64/resource.h @@ -1,4 +1,4 @@ -/* $Id: resource.h,v 1.2 1999/10/09 00:01:43 ralf Exp $ +/* $Id: resource.h,v 1.3 2000/01/27 23:45:30 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -26,6 +26,12 @@ #define RLIM_NLIMITS 10 /* Number of limit flavors. */ +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + */ +#define RLIM_INFINITY (~0UL) + #ifdef __KERNEL__ #define INIT_RLIMITS \ diff --git a/include/asm-mips64/serial.h b/include/asm-mips64/serial.h index c6b3245d7..82abb1fc2 100644 --- a/include/asm-mips64/serial.h +++ b/include/asm-mips64/serial.h @@ -1,4 +1,4 @@ -/* $Id: serial.h,v 1.1 2000/01/04 10:51:55 ralf Exp $ +/* $Id: serial.h,v 1.2 2000/01/17 23:32:47 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -36,9 +36,14 @@ #define RS_TABLE_SIZE #ifdef CONFIG_SGI_IP27 +#define _ORIGIN_SERIAL_INIT(int, base) \ + { baud_base: IOC3_BAUD, irq: int, flags: IOC3_COM_FLAGS, \ + iomem_base: (u8 *) base, iomem_reg_shift: 0, \ + io_type: SERIAL_IO_MEM } #define ORIGIN_SERIAL_PORT_DFNS \ - { 0, IOC3_BAUD, 0x9200000008620178, 0, IOC3_COM_FLAGS },\ - { 0, IOC3_BAUD, 0x9200000008620170, 0, IOC3_COM_FLAGS }, + _ORIGIN_SERIAL_INIT(0, 0x9200000008620178UL), \ + _ORIGIN_SERIAL_INIT(0, 0x9200000008620170UL), + #else #define ORIGIN_SERIAL_PORT_DFNS #endif diff --git a/include/asm-mips64/sgi/io.h b/include/asm-mips64/sgi/io.h new file mode 100644 index 000000000..774892239 --- /dev/null +++ b/include/asm-mips64/sgi/io.h @@ -0,0 +1,22 @@ +/* $Id$ + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2000 Ralf Baechle + * Copyright (C) 2000 Silicon Graphics, Inc. + */ +#ifndef _ASM_SGI_IO_H +#define _ASM_SGI_IO_H + +#include <asm/addrspace.h> + +#define IO_SPACE_BASE K1BASE + +/* For Indigo2. */ +#define IO_SPACE_LIMIT 0xffff + +/* XXX ISA specific functions go here here. */ + +#endif /* _ASM_SGI_IO_H */ diff --git a/include/asm-mips64/sn/io.h b/include/asm-mips64/sn/io.h new file mode 100644 index 000000000..86b394ec7 --- /dev/null +++ b/include/asm-mips64/sn/io.h @@ -0,0 +1,22 @@ +/* $Id: io.h,v 1.2 2000/02/02 16:35:57 ralf Exp $ + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2000 Ralf Baechle + * Copyright (C) 2000 Silicon Graphics, Inc. + */ +#ifndef _ASM_SN_IO_H +#define _ASM_SN_IO_H + +#include <asm/sn/sn0/addrs.h> + +#define IO_SPACE_BASE IO_BASE + +/* Because we only have PCI I/O ports. */ +#define IO_SPACE_LIMIT 0xffffffff + +/* No isa_* versions, the Origin doesn't have ISA / EISA bridges. */ + +#endif /* _ASM_SN_IO_H */ diff --git a/include/asm-mips64/unistd.h b/include/asm-mips64/unistd.h index ae9b7123c..6d34a529a 100644 --- a/include/asm-mips64/unistd.h +++ b/include/asm-mips64/unistd.h @@ -1,4 +1,4 @@ -/* $Id: unistd.h,v 1.6 2000/01/16 01:44:34 ralf Exp $ +/* $Id: unistd.h,v 1.7 2000/01/29 01:42:28 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -1195,12 +1195,14 @@ #define __NR_Linux32_sendfile (__NR_Linux32 + 207) #define __NR_Linux32_getpmsg (__NR_Linux32 + 208) #define __NR_Linux32_putpmsg (__NR_Linux32 + 209) -#define __NR_Linux32_ugetrlimit (__NR_Linux32 + 210) +#define __NR_mmap2 (__NR_Linux32 + 210) +#define __NR_truncate64 (__NR_Linux32 + 211) +#define __NR_ftruncate64 (__NR_Linux32 + 212) /* * Offset of the last Linux o32 flavoured syscall */ -#define __NR_Linux32_syscalls 210 +#define __NR_Linux32_syscalls 212 /* * Linux 64-bit syscalls are in the range from 5000 to 5999. @@ -1416,12 +1418,11 @@ #define __NR_sendfile (__NR_Linux + 207) #define __NR_getpmsg (__NR_Linux + 208) #define __NR_putpmsg (__NR_Linux + 209) -#define __NR_ugetrlimit (__NR_Linux + 210) /* * Offset of the last Linux flavoured syscall */ -#define __NR_Linux_syscalls 210 +#define __NR_Linux_syscalls 209 #ifndef _LANGUAGE_ASSEMBLY diff --git a/include/asm-ppc/board.h b/include/asm-ppc/board.h new file mode 100644 index 000000000..39ab9da51 --- /dev/null +++ b/include/asm-ppc/board.h @@ -0,0 +1,36 @@ +/* + * + * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu> + * + * Module name: board.h + * + * Description: + * A generic include file which pulls in appropriate include files + * for specific board types based on configuration settings. + * + */ + +#ifndef __BOARD_H__ +#define __BOARD_H__ + +#include <linux/config.h> + +#if defined(CONFIG_OAK) +#include <asm/oak.h> +#endif + +#if defined(CONFIG_WALNUT) +#include <asm/walnut.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + + +#ifdef __cplusplus +} +#endif + +#endif /* __BOARD_H__ */ diff --git a/include/asm-ppc/bootinfo.h b/include/asm-ppc/bootinfo.h index 8d78bb9cb..cc32d941f 100644 --- a/include/asm-ppc/bootinfo.h +++ b/include/asm-ppc/bootinfo.h @@ -1,375 +1,27 @@ /* -** asm/bootinfo.h -- Definition of the Linux/m68k boot information structure -** -** Copyright 1992 by Greg Harp -** -** This file is subject to the terms and conditions of the GNU General Public -** License. See the file COPYING in the main directory of this archive -** for more details. -** -** Created 09/29/92 by Greg Harp -** -** 5/2/94 Roman Hodek: -** Added bi_atari part of the machine dependent union bi_un; for now it -** contains just a model field to distinguish between TT and Falcon. -** 26/7/96 Roman Zippel: -** Renamed to setup.h; added some useful macros to allow gcc some -** optimizations if possible. -** 5/10/96 Geert Uytterhoeven: -** Redesign of the boot information structure; renamed to bootinfo.h again -** 27/11/96 Geert Uytterhoeven: -** Backwards compatibility with bootinfo interface version 1.0 -*/ + * Non-machine dependent bootinfo structure. Basic idea + * borrowed from the m68k. + * + * Copyright (C) 1999 Cort Dougan <cort@ppc.kernel.org> + */ -#ifndef _BOOTINFO_H -#define _BOOTINFO_H - - /* - * Bootinfo definitions - * - * This is an easily parsable and extendable structure containing all - * information to be passed from the bootstrap to the kernel. - * - * This way I hope to keep all future changes back/forewards compatible. - * Thus, keep your fingers crossed... - * - * This structure is copied right after the kernel bss by the bootstrap - * routine. - */ - -#ifndef __ASSEMBLY__ +#ifndef _PPC_BOOTINFO_H +#define _PPC_BOOTINFO_H struct bi_record { - unsigned short tag; /* tag ID */ - unsigned short size; /* size of record (in bytes) */ + unsigned long tag; /* tag ID */ + unsigned long size; /* size of record (in bytes) */ unsigned long data[0]; /* data */ }; -#else /* __ASSEMBLY__ */ - -BIR_tag = 0 -BIR_size = BIR_tag+2 -BIR_data = BIR_size+2 - -#endif /* __ASSEMBLY__ */ - - - /* - * Tag Definitions - * - * Machine independent tags start counting from 0x0000 - * Machine dependent tags start counting from 0x8000 - */ - -#define BI_LAST 0x0000 /* last record (sentinel) */ -#define BI_MACHTYPE 0x0001 /* machine type (u_long) */ -#define BI_CPUTYPE 0x0002 /* cpu type (u_long) */ -#define BI_FPUTYPE 0x0003 /* fpu type (u_long) */ -#define BI_MMUTYPE 0x0004 /* mmu type (u_long) */ -#define BI_MEMCHUNK 0x0005 /* memory chunk address and size */ - /* (struct mem_info) */ -#define BI_RAMDISK 0x0006 /* ramdisk address and size */ - /* (struct mem_info) */ -#define BI_COMMAND_LINE 0x0007 /* kernel command line parameters */ - /* (string) */ - - /* - * Amiga-specific tags - */ - -#define BI_AMIGA_MODEL 0x8000 /* model (u_long) */ -#define BI_AMIGA_AUTOCON 0x8001 /* AutoConfig device */ - /* (struct ConfigDev) */ -#define BI_AMIGA_CHIP_SIZE 0x8002 /* size of Chip RAM (u_long) */ -#define BI_AMIGA_VBLANK 0x8003 /* VBLANK frequency (u_char) */ -#define BI_AMIGA_PSFREQ 0x8004 /* power supply frequency (u_char) */ -#define BI_AMIGA_ECLOCK 0x8005 /* EClock frequency (u_long) */ -#define BI_AMIGA_CHIPSET 0x8006 /* native chipset present (u_long) */ -#define BI_AMIGA_SERPER 0x8007 /* serial port period (u_short) */ - - /* - * Atari-specific tags - */ - -#define BI_ATARI_MCH_COOKIE 0x8000 /* _MCH cookie from TOS (u_long) */ -#define BI_ATARI_MCH_TYPE 0x8001 /* special machine type (u_long) */ - /* (values are ATARI_MACH_* defines */ - -/* mch_cookie values (upper word) */ -#define ATARI_MCH_ST 0 -#define ATARI_MCH_STE 1 -#define ATARI_MCH_TT 2 -#define ATARI_MCH_FALCON 3 - -/* mch_type values */ -#define ATARI_MACH_NORMAL 0 /* no special machine type */ -#define ATARI_MACH_MEDUSA 1 /* Medusa 040 */ -#define ATARI_MACH_HADES 2 /* Hades 040 or 060 */ -#define ATARI_MACH_AB40 3 /* Afterburner040 on Falcon */ - - /* - * Macintosh-specific tags (all u_long) - */ - -#define BI_MAC_MODEL 0x8000 /* Mac Gestalt ID (model type) */ -#define BI_MAC_VADDR 0x8001 /* Mac video base address */ -#define BI_MAC_VDEPTH 0x8002 /* Mac video depth */ -#define BI_MAC_VROW 0x8003 /* Mac video rowbytes */ -#define BI_MAC_VDIM 0x8004 /* Mac video dimensions */ -#define BI_MAC_VLOGICAL 0x8005 /* Mac video logical base */ -#define BI_MAC_SCCBASE 0x8006 /* Mac SCC base address */ -#define BI_MAC_BTIME 0x8007 /* Mac boot time */ -#define BI_MAC_GMTBIAS 0x8008 /* Mac GMT timezone offset */ -#define BI_MAC_MEMSIZE 0x8009 /* Mac RAM size (sanity check) */ -#define BI_MAC_CPUID 0x800a /* Mac CPU type (sanity check) */ -#define BI_MAC_ROMBASE 0x800b /* Mac system ROM base address */ - - /* - * Macintosh hardware profile data - unused, see macintosh.h for - * resonable type values - */ - -#define BI_MAC_VIA1BASE 0x8010 /* Mac VIA1 base address (always present) */ -#define BI_MAC_VIA2BASE 0x8011 /* Mac VIA2 base address (type varies) */ -#define BI_MAC_VIA2TYPE 0x8012 /* Mac VIA2 type (VIA, RBV, OSS) */ -#define BI_MAC_ADBTYPE 0x8013 /* Mac ADB interface type */ -#define BI_MAC_ASCBASE 0x8014 /* Mac Apple Sound Chip base address */ -#define BI_MAC_SCSI5380 0x8015 /* Mac NCR 5380 SCSI (base address, multi) */ -#define BI_MAC_SCSIDMA 0x8016 /* Mac SCSI DMA (base address) */ -#define BI_MAC_SCSI5396 0x8017 /* Mac NCR 53C96 SCSI (base address, multi) */ -#define BI_MAC_IDETYPE 0x8018 /* Mac IDE interface type */ -#define BI_MAC_IDEBASE 0x8019 /* Mac IDE interface base address */ -#define BI_MAC_NUBUS 0x801a /* Mac Nubus type (none, regular, pseudo) */ -#define BI_MAC_SLOTMASK 0x801b /* Mac Nubus slots present */ -#define BI_MAC_SCCTYPE 0x801c /* Mac SCC serial type (normal, IOP) */ -#define BI_MAC_ETHTYPE 0x801d /* Mac builtin ethernet type (Sonic, MACE */ -#define BI_MAC_ETHBASE 0x801e /* Mac builtin ethernet base address */ -#define BI_MAC_PMU 0x801f /* Mac power managment / poweroff hardware */ -#define BI_MAC_IOP_SWIM 0x8020 /* Mac SWIM floppy IOP */ -#define BI_MAC_IOP_ADB 0x8021 /* Mac ADB IOP */ - - /* - * Mac: compatibility with old booter data format (temporarily) - * Fields unused with the new bootinfo can be deleted now; instead of - * adding new fields the struct might be splitted into a hardware address - * part and a hardware type part - */ - -#ifndef __ASSEMBLY__ - -struct mac_booter_data -{ - unsigned long videoaddr; - unsigned long videorow; - unsigned long videodepth; - unsigned long dimensions; - unsigned long args; - unsigned long boottime; - unsigned long gmtbias; - unsigned long bootver; - unsigned long videological; - unsigned long sccbase; - unsigned long id; - unsigned long memsize; - unsigned long serialmf; - unsigned long serialhsk; - unsigned long serialgpi; - unsigned long printmf; - unsigned long printhsk; - unsigned long printgpi; - unsigned long cpuid; - unsigned long rombase; - unsigned long adbdelay; - unsigned long timedbra; -}; - -extern struct mac_booter_data - mac_bi_data; - -#endif - - /* - * Stuff for bootinfo interface versioning - * - * At the start of kernel code, a 'struct bootversion' is located. - * bootstrap checks for a matching version of the interface before booting - * a kernel, to avoid user confusion if kernel and bootstrap don't work - * together :-) - * - * If incompatible changes are made to the bootinfo interface, the major - * number below should be stepped (and the minor reset to 0) for the - * appropriate machine. If a change is backward-compatible, the minor - * should be stepped. "Backwards-compatible" means that booting will work, - * but certain features may not. - */ - -#define BOOTINFOV_MAGIC 0x4249561A /* 'BIV^Z' */ -#define MK_BI_VERSION(major,minor) (((major)<<16)+(minor)) -#define BI_VERSION_MAJOR(v) (((v) >> 16) & 0xffff) -#define BI_VERSION_MINOR(v) ((v) & 0xffff) - -#ifndef __ASSEMBLY__ - -struct bootversion { - unsigned short branch; - unsigned long magic; - struct { - unsigned long machtype; - unsigned long version; - } machversions[0]; -}; - -#endif /* __ASSEMBLY__ */ - -#define AMIGA_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) -#define ATARI_BOOTI_VERSION MK_BI_VERSION( 2, 1 ) -#define MAC_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) -#define MVME16x_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) -#define BVME6000_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) - - -#ifdef BOOTINFO_COMPAT_1_0 - - /* - * Backwards compatibility with bootinfo interface version 1.0 - */ - -#define COMPAT_AMIGA_BOOTI_VERSION MK_BI_VERSION( 1, 0 ) -#define COMPAT_ATARI_BOOTI_VERSION MK_BI_VERSION( 1, 0 ) -#define COMPAT_MAC_BOOTI_VERSION MK_BI_VERSION( 1, 0 ) - -#include <linux/zorro.h> - -#define COMPAT_NUM_AUTO 16 - -struct compat_bi_Amiga { - int model; - int num_autocon; - struct ConfigDev autocon[COMPAT_NUM_AUTO]; - unsigned long chip_size; - unsigned char vblank; - unsigned char psfreq; - unsigned long eclock; - unsigned long chipset; - unsigned long hw_present; -}; - -struct compat_bi_Atari { - unsigned long hw_present; - unsigned long mch_cookie; -}; - -#ifndef __ASSEMBLY__ - -#define MACHW_DECLARE(name) unsigned name : 1 -#define MACHW_SET(name) (boot_info.bi_mac.hw_present.name = 1) -#define MACHW_PRESENT(name) (boot_info.bi_mac.hw_present.name) - -struct compat_bi_Macintosh -{ - unsigned long videoaddr; - unsigned long videorow; - unsigned long videodepth; - unsigned long dimensions; - unsigned long args; - unsigned long boottime; - unsigned long gmtbias; - unsigned long bootver; - unsigned long videological; - unsigned long sccbase; - unsigned long id; - unsigned long memsize; - unsigned long serialmf; - unsigned long serialhsk; - unsigned long serialgpi; - unsigned long printmf; - unsigned long printhsk; - unsigned long printgpi; - unsigned long cpuid; - unsigned long rombase; - unsigned long adbdelay; - unsigned long timedbra; - struct { - /* video hardware */ - /* sound hardware */ - /* disk storage interfaces */ - MACHW_DECLARE(MAC_SCSI); /* Directly mapped NCR5380 */ - MACHW_DECLARE(IDE); /* IDE Interface */ - /* other I/O hardware */ - MACHW_DECLARE(SCC); /* Serial Communications Contr. */ - /* DMA */ - MACHW_DECLARE(SCSI_DMA); /* DMA for the NCR5380 */ - /* real time clocks */ - MACHW_DECLARE(RTC_CLK); /* clock chip */ - /* supporting hardware */ - MACHW_DECLARE(VIA1); /* Versatile Interface Ad. 1 */ - MACHW_DECLARE(VIA2); /* Versatile Interface Ad. 2 */ - MACHW_DECLARE(RBV); /* Versatile Interface Ad. 2+ */ - /* NUBUS */ - MACHW_DECLARE(NUBUS); /* NUBUS */ - } hw_present; -}; -#else - -#define BI_videoaddr BI_un -#define BI_videorow BI_videoaddr+4 -#define BI_videodepth BI_videorow+4 -#define BI_dimensions BI_videodepth+4 -#define BI_args BI_dimensions+4 -#define BI_cpuid BI_args+56 - -#endif - -struct compat_mem_info { - unsigned long addr; - unsigned long size; -}; - -#define COMPAT_NUM_MEMINFO 4 - -#define COMPAT_CPUB_68020 0 -#define COMPAT_CPUB_68030 1 -#define COMPAT_CPUB_68040 2 -#define COMPAT_CPUB_68060 3 -#define COMPAT_FPUB_68881 5 -#define COMPAT_FPUB_68882 6 -#define COMPAT_FPUB_68040 7 -#define COMPAT_FPUB_68060 8 - -#define COMPAT_CPU_68020 (1<<COMPAT_CPUB_68020) -#define COMPAT_CPU_68030 (1<<COMPAT_CPUB_68030) -#define COMPAT_CPU_68040 (1<<COMPAT_CPUB_68040) -#define COMPAT_CPU_68060 (1<<COMPAT_CPUB_68060) -#define COMPAT_CPU_MASK (31) -#define COMPAT_FPU_68881 (1<<COMPAT_FPUB_68881) -#define COMPAT_FPU_68882 (1<<COMPAT_FPUB_68882) -#define COMPAT_FPU_68040 (1<<COMPAT_FPUB_68040) -#define COMPAT_FPU_68060 (1<<COMPAT_FPUB_68060) -#define COMPAT_FPU_MASK (0xfe0) - -#define COMPAT_CL_SIZE (256) - -struct compat_bootinfo { - unsigned long machtype; - unsigned long cputype; - struct compat_mem_info memory[COMPAT_NUM_MEMINFO]; - int num_memory; - unsigned long ramdisk_size; - unsigned long ramdisk_addr; - char command_line[COMPAT_CL_SIZE]; - union { - struct compat_bi_Amiga bi_ami; - struct compat_bi_Atari bi_ata; - struct compat_bi_Macintosh bi_mac; - } bi_un; -}; - -#define bi_amiga bi_un.bi_ami -#define bi_atari bi_un.bi_ata -#define bi_mac bi_un.bi_mac - -#endif /* BOOTINFO_COMPAT_1_0 */ +#define BI_FIRST 0x1010 /* first record - marker */ +#define BI_LAST 0x1011 /* last record - marker */ +#define BI_CMD_LINE 0x1012 +#define BI_BOOTLOADER_ID 0x1013 +#define BI_INITRD 0x1014 +#define BI_SYSMAP 0x1015 +#define BI_MACHTYPE 0x1016 +#endif /* _PPC_BOOTINFO_H */ -#endif /* _BOOTINFO_H */ diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h index fd8f1879c..051aed929 100644 --- a/include/asm-ppc/io.h +++ b/include/asm-ppc/io.h @@ -19,7 +19,9 @@ #define PREP_ISA_MEM_BASE 0xc0000000 #define PREP_PCI_DRAM_OFFSET 0x80000000 -#ifdef CONFIG_8xx +#if defined(CONFIG_4xx) +#include <asm/board.h> +#elif defined(CONFIG_8xx) #include <asm/mpc8xx.h> #else #ifdef CONFIG_APUS @@ -34,7 +36,7 @@ extern unsigned long pci_dram_offset; #define _ISA_MEM_BASE isa_mem_base #define PCI_DRAM_OFFSET pci_dram_offset #endif /* CONFIG_APUS */ -#endif /* CONFIG_8xx */ +#endif #define readb(addr) in_8((volatile unsigned char *)(addr)) #define writeb(b,addr) out_8((volatile unsigned char *)(addr), (b)) @@ -98,6 +100,8 @@ extern void _outsw_ns(volatile unsigned short *port, const void *buf, int ns); extern void _insl_ns(volatile unsigned long *port, void *buf, int nl); extern void _outsl_ns(volatile unsigned long *port, const void *buf, int nl); +#define IO_SPACE_LIMIT 0xffff + #define memset_io(a,b,c) memset((a),(b),(c)) #define memcpy_fromio(a,b,c) memcpy((a),(b),(c)) #define memcpy_toio(a,b,c) memcpy((a),(b),(c)) diff --git a/include/asm-ppc/irq_control.h b/include/asm-ppc/irq_control.h index 6bb85f0f0..5a79e3e37 100644 --- a/include/asm-ppc/irq_control.h +++ b/include/asm-ppc/irq_control.h @@ -6,8 +6,6 @@ #ifndef _PPC_IRQ_CONTROL_H #define _PPC_IRQ_CONTROL_H -#include <linux/config.h> - #include <asm/irq.h> #include <asm/atomic.h> diff --git a/include/asm-ppc/keyboard.h b/include/asm-ppc/keyboard.h index 27ca7c887..8a6e74fcc 100644 --- a/include/asm-ppc/keyboard.h +++ b/include/asm-ppc/keyboard.h @@ -15,7 +15,6 @@ #ifdef __KERNEL__ -#include <linux/config.h> #include <linux/adb.h> #include <asm/machdep.h> diff --git a/include/asm-ppc/linux_logo.h b/include/asm-ppc/linux_logo.h index 199d0dc2c..33ad40f64 100644 --- a/include/asm-ppc/linux_logo.h +++ b/include/asm-ppc/linux_logo.h @@ -11,7 +11,6 @@ * (i.e. linux_logo_{red,green,blue}[0] is color 0x20) */ -#include <linux/config.h> #include <linux/init.h> #define linux_logo_banner "Linux/PPC version " UTS_RELEASE diff --git a/include/asm-ppc/machdep.h b/include/asm-ppc/machdep.h index 40e5ea046..eaf91b288 100644 --- a/include/asm-ppc/machdep.h +++ b/include/asm-ppc/machdep.h @@ -83,23 +83,6 @@ extern char cmd_line[512]; extern void setup_pci_ptrs(void); -#define BOOT_INFO_VER 0x1 -#define BOOT_INFO_MAGIC 0x05027800 - -struct boot_info -{ - unsigned long magic_start; - char cmd_line[256]; - char boot_loader[128]; - int _machine_type; - unsigned long initrd_start, initrd_size; - unsigned long systemmap_start, systemmap_size; - unsigned long prom_entry; - char reserved[3680]; /* pad to 1 page */ - unsigned long magic_end; -}; -struct boot_info *binfo; - /* * Power macintoshes have either a CUDA or a PMU controlling * system reset, power, NVRAM, RTC. diff --git a/include/asm-ppc/mpc8xx.h b/include/asm-ppc/mpc8xx.h index 656d3d60e..2befa81ba 100644 --- a/include/asm-ppc/mpc8xx.h +++ b/include/asm-ppc/mpc8xx.h @@ -8,6 +8,8 @@ #ifndef __CONFIG_8xx_DEFS #define __CONFIG_8xx_DEFS +#include <linux/config.h> + #ifdef CONFIG_8xx #ifdef CONFIG_MBX diff --git a/include/asm-ppc/oak.h b/include/asm-ppc/oak.h new file mode 100644 index 000000000..b85cc84ed --- /dev/null +++ b/include/asm-ppc/oak.h @@ -0,0 +1,31 @@ +/* + * + * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu> + * + * Module name: oak.h + * + * Description: + * Macros, definitions, and data structures specific to the IBM PowerPC + * 403G{A,B,C,CX} "Oak" evaluation board. Anything specific to the pro- + * cessor itself is defined elsewhere. + * + */ + +#ifndef __OAK_H__ +#define __OAK_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#define _IO_BASE 0 +#define _ISA_MEM_BASE 0 +#define PCI_DRAM_OFFSET 0 + + +#ifdef __cplusplus +} +#endif + +#endif /* __OAK_H__ */ diff --git a/include/asm-ppc/pgalloc.h b/include/asm-ppc/pgalloc.h new file mode 100644 index 000000000..869a0e143 --- /dev/null +++ b/include/asm-ppc/pgalloc.h @@ -0,0 +1,201 @@ +#ifndef _PPC_PGALLOC_H +#define _PPC_PGALLOC_H + +#include <linux/threads.h> +#include <asm/processor.h> + +/* + * This is handled very differently on the PPC since out page tables + * are all 0's and I want to be able to use these zero'd pages elsewhere + * as well - it gives us quite a speedup. + * + * Note that the SMP/UP versions are the same but we don't need a + * per cpu list of zero pages because we do the zero-ing with the cache + * off and the access routines are lock-free but the pgt cache stuff + * is per-cpu since it isn't done with any lock-free access routines + * (although I think we need arch-specific routines so I can do lock-free). + * + * I need to generalize this so we can use it for other arch's as well. + * -- Cort + */ +#ifdef __SMP__ +#define quicklists cpu_data[smp_processor_id()] +#else +extern struct pgtable_cache_struct { + unsigned long *pgd_cache; + unsigned long *pte_cache; + unsigned long pgtable_cache_sz; +} quicklists; +#endif + +#define pgd_quicklist (quicklists.pgd_cache) +#define pmd_quicklist ((unsigned long *)0) +#define pte_quicklist (quicklists.pte_cache) +#define pgtable_cache_size (quicklists.pgtable_cache_sz) + +extern unsigned long *zero_cache; /* head linked list of pre-zero'd pages */ +extern atomic_t zero_sz; /* # currently pre-zero'd pages */ +extern atomic_t zeropage_hits; /* # zero'd pages request that we've done */ +extern atomic_t zeropage_calls; /* # zero'd pages request that've been made */ +extern atomic_t zerototal; /* # pages zero'd over time */ + +#define zero_quicklist (zero_cache) +#define zero_cache_sz (zero_sz) +#define zero_cache_calls (zeropage_calls) +#define zero_cache_hits (zeropage_hits) +#define zero_cache_total (zerototal) + +/* return a pre-zero'd page from the list, return NULL if none available -- Cort */ +extern unsigned long get_zero_page_fast(void); + +extern void __bad_pte(pmd_t *pmd); + +extern inline void set_pgdir(unsigned long address, pgd_t entry) +{ + struct task_struct * p; + pgd_t *pgd; +#ifdef __SMP__ + int i; +#endif + + read_lock(&tasklist_lock); + for_each_task(p) { + if (!p->mm) + continue; + *pgd_offset(p->mm,address) = entry; + } + read_unlock(&tasklist_lock); +#ifndef __SMP__ + for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[address >> PGDIR_SHIFT] = entry; +#else + /* To pgd_alloc/pgd_free, one holds master kernel lock and so does our callee, so we can + modify pgd caches of other CPUs as well. -jj */ + for (i = 0; i < NR_CPUS; i++) + for (pgd = (pgd_t *)cpu_data[i].pgd_cache; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) + pgd[address >> PGDIR_SHIFT] = entry; +#endif +} + +/* We don't use pmd cache, so this is a dummy routine */ +extern __inline__ pmd_t *get_pmd_fast(void) +{ + return (pmd_t *)0; +} + +extern __inline__ void free_pmd_fast(pmd_t *pmd) +{ +} + +extern __inline__ void free_pmd_slow(pmd_t *pmd) +{ +} + +/* + * allocating and freeing a pmd is trivial: the 1-entry pmd is + * inside the pgd, so has no extra memory associated with it. + */ +extern inline void pmd_free(pmd_t * pmd) +{ +} + +extern inline pmd_t * pmd_alloc(pgd_t * pgd, unsigned long address) +{ + return (pmd_t *) pgd; +} + +#define pmd_free_kernel pmd_free +#define pmd_alloc_kernel pmd_alloc +#define pte_alloc_kernel pte_alloc + +extern __inline__ pgd_t *get_pgd_slow(void) +{ + pgd_t *ret, *init; + /*if ( (ret = (pgd_t *)get_zero_page_fast()) == NULL )*/ + if ( (ret = (pgd_t *)__get_free_page(GFP_KERNEL)) != NULL ) + memset (ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); + if (ret) { + init = pgd_offset(&init_mm, 0); + memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, + (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); + } + return ret; +} + +extern __inline__ pgd_t *get_pgd_fast(void) +{ + unsigned long *ret; + + if ((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)(*ret); + ret[0] = 0; + pgtable_cache_size--; + } else + ret = (unsigned long *)get_pgd_slow(); + return (pgd_t *)ret; +} + +extern __inline__ void free_pgd_fast(pgd_t *pgd) +{ + *(unsigned long **)pgd = pgd_quicklist; + pgd_quicklist = (unsigned long *) pgd; + pgtable_cache_size++; +} + +extern __inline__ void free_pgd_slow(pgd_t *pgd) +{ + free_page((unsigned long)pgd); +} + +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); + +extern __inline__ pte_t *get_pte_fast(void) +{ + unsigned long *ret; + + if ((ret = pte_quicklist) != NULL) { + pte_quicklist = (unsigned long *)(*ret); + ret[0] = 0; + pgtable_cache_size--; + } + return (pte_t *)ret; +} + +extern __inline__ void free_pte_fast(pte_t *pte) +{ + *(unsigned long **)pte = pte_quicklist; + pte_quicklist = (unsigned long *) pte; + pgtable_cache_size++; +} + +extern __inline__ void free_pte_slow(pte_t *pte) +{ + free_page((unsigned long)pte); +} + +#define pte_free_kernel(pte) free_pte_fast(pte) +#define pte_free(pte) free_pte_fast(pte) +#define pgd_free(pgd) free_pgd_fast(pgd) +#define pgd_alloc() get_pgd_fast() + +extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + if (pmd_none(*pmd)) { + pte_t * page = (pte_t *) get_pte_fast(); + + if (!page) + return get_pte_slow(pmd, address); + pmd_val(*pmd) = (unsigned long) page; + return page + address; + } + if (pmd_bad(*pmd)) { + __bad_pte(pmd); + return NULL; + } + return (pte_t *) pmd_page(*pmd) + address; +} + +extern int do_check_pgt_cache(int, int); + +#endif /* _PPC_PGALLOC_H */ diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index c62d78c79..3c1eec8c0 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h @@ -1,16 +1,17 @@ -#include <linux/config.h> - #ifndef _PPC_PGTABLE_H #define _PPC_PGTABLE_H +#include <linux/config.h> + #ifndef __ASSEMBLY__ -#include <linux/mm.h> #include <linux/threads.h> #include <asm/processor.h> /* For TASK_SIZE */ #include <asm/mmu.h> #include <asm/page.h> #ifndef CONFIG_8xx +struct mm_struct; +struct vm_area_struct; extern void local_flush_tlb_all(void); extern void local_flush_tlb_mm(struct mm_struct *mm); extern void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); @@ -273,7 +274,7 @@ extern pte_t * __bad_pagetable(void); /* * Permanent address of a page. */ -#define page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) +#define page_address(page) ({ if (!(page)->virtual) BUG(); (page)->virtual; }) #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) #define pte_page(x) (mem_map+pte_pagenr(x)) @@ -286,7 +287,7 @@ extern pte_t * __bad_pagetable(void); extern inline int pgd_none(pgd_t pgd) { return 0; } extern inline int pgd_bad(pgd_t pgd) { return 0; } extern inline int pgd_present(pgd_t pgd) { return 1; } -#define pgd_clear(xp) do { pgd_val(*(xp)) = 0; } while (0) +#define pgd_clear(xp) do { } while (0) #define pgd_page(pgd) \ ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) @@ -354,12 +355,12 @@ extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) return pte; } -extern inline pte_t mk_pte(struct page *page, pgprot_t pgprot) -{ - pte_t pte; - pte_val(pte) = ((page - mem_map) << PAGE_SHIFT) | pgprot_val(pgprot); - return pte; -} +#define mk_pte(page,pgprot) \ +({ \ + pte_t pte; \ + pte_val(pte) = ((page - mem_map) << PAGE_SHIFT) | pgprot_val(pgprot); \ + pte; \ +}) extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { @@ -367,19 +368,13 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) return pte; } -#define page_pte_prot(page,prot) mk_pte(page, prot) -#define page_pte(page) page_pte_prot(page, __pgprot(0)) - #define pmd_page(pmd) (pmd_val(pmd)) /* to find an entry in a kernel page-table-directory */ #define pgd_offset_k(address) pgd_offset(&init_mm, address) /* to find an entry in a page-table-directory */ -extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) -{ - return mm->pgd + (address >> PGDIR_SHIFT); -} +#define pgd_offset(mm, address) ((mm)->pgd + ((address) >> PGDIR_SHIFT)) /* Find an entry in the second-level page table.. */ extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) @@ -393,227 +388,8 @@ extern inline pte_t * pte_offset(pmd_t * dir, unsigned long address) return (pte_t *) pmd_page(*dir) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); } -/* - * This is handled very differently on the PPC since out page tables - * are all 0's and I want to be able to use these zero'd pages elsewhere - * as well - it gives us quite a speedup. - * - * Note that the SMP/UP versions are the same but we don't need a - * per cpu list of zero pages because we do the zero-ing with the cache - * off and the access routines are lock-free but the pgt cache stuff - * is per-cpu since it isn't done with any lock-free access routines - * (although I think we need arch-specific routines so I can do lock-free). - * - * I need to generalize this so we can use it for other arch's as well. - * -- Cort - */ -#ifdef __SMP__ -#define quicklists cpu_data[smp_processor_id()] -#else -extern struct pgtable_cache_struct { - unsigned long *pgd_cache; - unsigned long *pte_cache; - unsigned long pgtable_cache_sz; -} quicklists; -#endif - -#define pgd_quicklist (quicklists.pgd_cache) -#define pmd_quicklist ((unsigned long *)0) -#define pte_quicklist (quicklists.pte_cache) -#define pgtable_cache_size (quicklists.pgtable_cache_sz) - -extern unsigned long *zero_cache; /* head linked list of pre-zero'd pages */ -extern atomic_t zero_sz; /* # currently pre-zero'd pages */ -extern atomic_t zeropage_hits; /* # zero'd pages request that we've done */ -extern atomic_t zeropage_calls; /* # zero'd pages request that've been made */ -extern atomic_t zerototal; /* # pages zero'd over time */ - -#define zero_quicklist (zero_cache) -#define zero_cache_sz (zero_sz) -#define zero_cache_calls (zeropage_calls) -#define zero_cache_hits (zeropage_hits) -#define zero_cache_total (zerototal) - -/* return a pre-zero'd page from the list, return NULL if none available -- Cort */ -extern unsigned long get_zero_page_fast(void); - -extern __inline__ pgd_t *get_pgd_slow(void) -{ - pgd_t *ret, *init; - /*if ( (ret = (pgd_t *)get_zero_page_fast()) == NULL )*/ - if ( (ret = (pgd_t *)__get_free_page(GFP_KERNEL)) != NULL ) - memset (ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); - if (ret) { - init = pgd_offset(&init_mm, 0); - memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, - (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); - } - return ret; -} - -extern __inline__ pgd_t *get_pgd_fast(void) -{ - unsigned long *ret; - - if((ret = pgd_quicklist) != NULL) { - pgd_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } else - ret = (unsigned long *)get_pgd_slow(); - return (pgd_t *)ret; -} - -extern __inline__ void free_pgd_fast(pgd_t *pgd) -{ - *(unsigned long *)pgd = (unsigned long) pgd_quicklist; - pgd_quicklist = (unsigned long *) pgd; - pgtable_cache_size++; -} - -extern __inline__ void free_pgd_slow(pgd_t *pgd) -{ - free_page((unsigned long)pgd); -} - -extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); - -extern __inline__ pte_t *get_pte_fast(void) -{ - unsigned long *ret; - - if((ret = (unsigned long *)pte_quicklist) != NULL) { - pte_quicklist = (unsigned long *)(*ret); - ret[0] = ret[1]; - pgtable_cache_size--; - } - return (pte_t *)ret; -} - -extern __inline__ void free_pte_fast(pte_t *pte) -{ - *(unsigned long *)pte = (unsigned long) pte_quicklist; - pte_quicklist = (unsigned long *) pte; - pgtable_cache_size++; -} - -extern __inline__ void free_pte_slow(pte_t *pte) -{ - free_page((unsigned long)pte); -} - -/* We don't use pmd cache, so this is a dummy routine */ -extern __inline__ pmd_t *get_pmd_fast(void) -{ - return (pmd_t *)0; -} - -extern __inline__ void free_pmd_fast(pmd_t *pmd) -{ -} - -extern __inline__ void free_pmd_slow(pmd_t *pmd) -{ -} - -extern void __bad_pte(pmd_t *pmd); - -#define pte_free_kernel(pte) free_pte_fast(pte) -#define pte_free(pte) free_pte_fast(pte) -#define pgd_free(pgd) free_pgd_fast(pgd) -#define pgd_alloc() get_pgd_fast() - -extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - pte_t * page = (pte_t *) get_pte_fast(); - - if (!page) - return get_pte_slow(pmd, address); - pmd_val(*pmd) = (unsigned long) page; - return page + address; - } - if (pmd_bad(*pmd)) { - __bad_pte(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + address; -} - -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - */ -extern inline void pmd_free(pmd_t * pmd) -{ -} - -extern inline pmd_t * pmd_alloc(pgd_t * pgd, unsigned long address) -{ - return (pmd_t *) pgd; -} - -#define pmd_free_kernel pmd_free -#define pmd_alloc_kernel pmd_alloc -#define pte_alloc_kernel pte_alloc - -extern int do_check_pgt_cache(int, int); - -extern inline void set_pgdir(unsigned long address, pgd_t entry) -{ - struct task_struct * p; - pgd_t *pgd; -#ifdef __SMP__ - int i; -#endif - - read_lock(&tasklist_lock); - for_each_task(p) { - if (!p->mm) - continue; - *pgd_offset(p->mm,address) = entry; - } - read_unlock(&tasklist_lock); -#ifndef __SMP__ - for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[address >> PGDIR_SHIFT] = entry; -#else - /* To pgd_alloc/pgd_free, one holds master kernel lock and so does our callee, so we can - modify pgd caches of other CPUs as well. -jj */ - for (i = 0; i < NR_CPUS; i++) - for (pgd = (pgd_t *)cpu_data[i].pgd_cache; pgd; pgd = (pgd_t *)*(unsigned long *)pgd) - pgd[address >> PGDIR_SHIFT] = entry; -#endif -} - extern pgd_t swapper_pg_dir[1024]; -extern __inline__ pte_t *find_pte(struct mm_struct *mm,unsigned long va) -{ - pgd_t *dir; - pmd_t *pmd; - pte_t *pte; - - va &= PAGE_MASK; - - dir = pgd_offset( mm, va ); - if (dir) - { - pmd = pmd_offset(dir, va & PAGE_MASK); - if (pmd && pmd_present(*pmd)) - { - pte = pte_offset(pmd, va); - if (pte && pte_present(*pte)) - { - pte_uncache(*pte); - flush_tlb_page(find_vma(mm,va),va); - } - } - } - return pte; -} - /* * Page tables may have changed. We don't need to do anything here * as entries are faulted into the hash table by the low-level @@ -628,11 +404,10 @@ extern __inline__ pte_t *find_pte(struct mm_struct *mm,unsigned long va) extern void flush_hash_segments(unsigned low_vsid, unsigned high_vsid); extern void flush_hash_page(unsigned context, unsigned long va); - /* Encode and de-code a swap entry */ -#define SWP_TYPE(entry) (((entry).val >> 1) & 0x3f) -#define SWP_OFFSET(entry) ((entry).val >> 8) -#define SWP_ENTRY(type,offset) ((swp_entry_t) { (((type) << 1) | ((offset) << 8)) }) +#define SWP_TYPE(entry) (((entry).val >> 1) & 0x3f) +#define SWP_OFFSET(entry) ((entry).val >> 8) +#define SWP_ENTRY(type, offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 8) }) #define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) #define swp_entry_to_pte(x) ((pte_t) { (x).val }) diff --git a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h index a78c75b4e..8bfaa5341 100644 --- a/include/asm-ppc/processor.h +++ b/include/asm-ppc/processor.h @@ -217,8 +217,6 @@ n: #ifndef CONFIG_MACH_SPECIFIC extern int _machine; extern int have_of; -extern int is_chrp; -extern int is_powerplus; #endif /* CONFIG_MACH_SPECIFIC */ /* what kind of prep workstation we are */ diff --git a/include/asm-ppc/ptrace.h b/include/asm-ppc/ptrace.h index 52a4953ac..448f0b274 100644 --- a/include/asm-ppc/ptrace.h +++ b/include/asm-ppc/ptrace.h @@ -49,7 +49,7 @@ struct pt_regs { #define __SIGNAL_FRAMESIZE 64 #define instruction_pointer(regs) ((regs)->nip) -#define user_mode(regs) ((regs)->msr & 0x4000) +#define user_mode(regs) ((regs)->msr & MSR_PR) /* * Offsets used by 'ptrace' system call interface. diff --git a/include/asm-ppc/resource.h b/include/asm-ppc/resource.h index c8ced55c5..c27aa8591 100644 --- a/include/asm-ppc/resource.h +++ b/include/asm-ppc/resource.h @@ -14,20 +14,27 @@ #define RLIM_NLIMITS 10 +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + */ +#define RLIM_INFINITY (~0UL) + + #ifdef __KERNEL__ #define INIT_RLIMITS \ { \ - {LONG_MAX, LONG_MAX}, /* RLIMIT_CPU */ \ - {LONG_MAX, LONG_MAX}, /* RLIMIT_FSIZE */ \ - {LONG_MAX, LONG_MAX}, /* RLIMIT_DATA */ \ - {_STK_LIM, LONG_MAX}, /* RLIMIT_STACK */ \ - { 0, LONG_MAX}, /* RLIMIT_CORE */ \ - {LONG_MAX, LONG_MAX}, /* RLIMIT_RSS */ \ - {0, 0}, \ - {INR_OPEN, INR_OPEN}, /* RLIMIT_NOFILE */ \ - {LONG_MAX, LONG_MAX}, /* RLIMIT_MEMLOCK */ \ - {LONG_MAX, LONG_MAX}, /* RLIMIT_AS */ \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { _STK_LIM, RLIM_INFINITY }, \ + { 0, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { 0, 0 }, \ + { INR_OPEN, INR_OPEN }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ } #endif /* __KERNEL__ */ diff --git a/include/asm-ppc/signal.h b/include/asm-ppc/signal.h index 7e14071d9..f5025a161 100644 --- a/include/asm-ppc/signal.h +++ b/include/asm-ppc/signal.h @@ -54,6 +54,7 @@ typedef struct { #define SIGLOST 29 */ #define SIGPWR 30 +#define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ diff --git a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h index 35641aff0..6b2e724f6 100644 --- a/include/asm-ppc/unistd.h +++ b/include/asm-ppc/unistd.h @@ -194,6 +194,7 @@ #define __NR_getpmsg 187 /* some people actually want streams */ #define __NR_putpmsg 188 /* some people actually want streams */ #define __NR_vfork 189 +#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ #define __NR(n) #n diff --git a/include/asm-ppc/walnut.h b/include/asm-ppc/walnut.h new file mode 100644 index 000000000..84499af8a --- /dev/null +++ b/include/asm-ppc/walnut.h @@ -0,0 +1,28 @@ +/* + * + * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu> + * + * Module name: walnut.h + * + * Description: + * Macros, definitions, and data structures specific to the IBM PowerPC + * 405GP "Walnut" evaluation board. Anything specific to the processor + * itself is defined elsewhere. + * + */ + +#ifndef __WALNUT_H__ +#define __WALNUT_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#ifdef __cplusplus +} +#endif + +#endif /* __WALNUT_H__ */ diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h index dd9205b32..677be2445 100644 --- a/include/asm-sh/io.h +++ b/include/asm-sh/io.h @@ -158,6 +158,8 @@ extern __inline__ void ctrl_outl(unsigned int b, unsigned long addr) #ifdef __KERNEL__ +#define IO_SPACE_LIMIT 0xffff + #include <asm/addrspace.h> /* diff --git a/include/asm-sh/resource.h b/include/asm-sh/resource.h index 857c37166..ef89ec7e6 100644 --- a/include/asm-sh/resource.h +++ b/include/asm-sh/resource.h @@ -18,6 +18,12 @@ #define RLIM_NLIMITS 10 +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + */ +#define RLIM_INFINITY (~0UL) + #ifdef __KERNEL__ #define INIT_RLIMITS \ diff --git a/include/asm-sh/signal.h b/include/asm-sh/signal.h index ab4663210..0a6ebb3ba 100644 --- a/include/asm-sh/signal.h +++ b/include/asm-sh/signal.h @@ -51,6 +51,7 @@ typedef struct { #define SIGLOST 29 */ #define SIGPWR 30 +#define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h index da901ab88..2540cffe9 100644 --- a/include/asm-sparc/io.h +++ b/include/asm-sparc/io.h @@ -98,6 +98,8 @@ extern __inline__ void outl(unsigned int b, unsigned long addr) #define inb_p inb #define outb_p outb +#define IO_SPACE_LIMIT 0xffffffff + extern void sun4c_mapioaddr(unsigned long, unsigned long, int bus_type, int rdonly); extern void srmmu_mapioaddr(unsigned long, unsigned long, int bus_type, int rdonly); diff --git a/include/asm-sparc/resource.h b/include/asm-sparc/resource.h index 466cfc1ea..ff079180f 100644 --- a/include/asm-sparc/resource.h +++ b/include/asm-sparc/resource.h @@ -24,6 +24,12 @@ #define RLIM_NLIMITS 10 +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + */ +#define RLIM_INFINITY (~0UL) + #ifdef __KERNEL__ #define INIT_RLIMITS \ { \ diff --git a/include/asm-sparc/sfp-machine.h b/include/asm-sparc/sfp-machine.h new file mode 100644 index 000000000..9ac17ed0a --- /dev/null +++ b/include/asm-sparc/sfp-machine.h @@ -0,0 +1,205 @@ +/* Machine-dependent software floating-point definitions. + Sparc userland (_Q_*) version. + Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com), + Jakub Jelinek (jj@ultra.linux.cz), + David S. Miller (davem@redhat.com) and + Peter Maydell (pmaydell@chiark.greenend.org.uk). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _SFP_MACHINE_H +#define _SFP_MACHINE_H + +#define _FP_W_TYPE_SIZE 32 +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long + +#define _FP_MUL_MEAT_S(R,X,Y) \ + _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_D(R,X,Y) \ + _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_Q(R,X,Y) \ + _FP_MUL_MEAT_5_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) + +#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) +#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) +#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) + +#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) +#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 +#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 +#define _FP_NANSIGN_S 0 +#define _FP_NANSIGN_D 0 +#define _FP_NANSIGN_Q 0 + +#define _FP_KEEPNANFRACP 1 + +/* If one NaN is signaling and the other is not, + * we choose that one, otherwise we choose X. + */ +/* For _Qp_* and _Q_*, this should prefer X, for + * CPU instruction emulation this should prefer Y. + * (see SPAMv9 B.2.2 section). + */ +#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ + do { \ + if ((_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs) \ + && !(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \ + { \ + R##_s = X##_s; \ + _FP_FRAC_COPY_##wc(R,X); \ + } \ + else \ + { \ + R##_s = Y##_s; \ + _FP_FRAC_COPY_##wc(R,Y); \ + } \ + R##_c = FP_CLS_NAN; \ + } while (0) + +/* Some assembly to speed things up. */ +#define __FP_FRAC_ADD_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \ + __asm__ ("addcc %r7,%8,%2 + addxcc %r5,%6,%1 + addx %r3,%4,%0" \ + : "=r" ((USItype)(r2)), \ + "=&r" ((USItype)(r1)), \ + "=&r" ((USItype)(r0)) \ + : "%rJ" ((USItype)(x2)), \ + "rI" ((USItype)(y2)), \ + "%rJ" ((USItype)(x1)), \ + "rI" ((USItype)(y1)), \ + "%rJ" ((USItype)(x0)), \ + "rI" ((USItype)(y0)) \ + : "cc") + +#define __FP_FRAC_SUB_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \ + __asm__ ("subcc %r7,%8,%2 + subxcc %r5,%6,%1 + subx %r3,%4,%0" \ + : "=r" ((USItype)(r2)), \ + "=&r" ((USItype)(r1)), \ + "=&r" ((USItype)(r0)) \ + : "%rJ" ((USItype)(x2)), \ + "rI" ((USItype)(y2)), \ + "%rJ" ((USItype)(x1)), \ + "rI" ((USItype)(y1)), \ + "%rJ" ((USItype)(x0)), \ + "rI" ((USItype)(y0)) \ + : "cc") + +#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ + do { \ + /* We need to fool gcc, as we need to pass more than 10 \ + input/outputs. */ \ + register USItype _t1 __asm__ ("g1"), _t2 __asm__ ("g2"); \ + __asm__ __volatile__ (" + addcc %r8,%9,%1 + addxcc %r6,%7,%0 + addxcc %r4,%5,%%g2 + addx %r2,%3,%%g1" \ + : "=&r" ((USItype)(r1)), \ + "=&r" ((USItype)(r0)) \ + : "%rJ" ((USItype)(x3)), \ + "rI" ((USItype)(y3)), \ + "%rJ" ((USItype)(x2)), \ + "rI" ((USItype)(y2)), \ + "%rJ" ((USItype)(x1)), \ + "rI" ((USItype)(y1)), \ + "%rJ" ((USItype)(x0)), \ + "rI" ((USItype)(y0)) \ + : "cc", "g1", "g2"); \ + __asm__ __volatile__ ("" : "=r" (_t1), "=r" (_t2)); \ + r3 = _t1; r2 = _t2; \ + } while (0) + +#define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ + do { \ + /* We need to fool gcc, as we need to pass more than 10 \ + input/outputs. */ \ + register USItype _t1 __asm__ ("g1"), _t2 __asm__ ("g2"); \ + __asm__ __volatile__ (" + subcc %r8,%9,%1 + subxcc %r6,%7,%0 + subxcc %r4,%5,%%g2 + subx %r2,%3,%%g1" \ + : "=&r" ((USItype)(r1)), \ + "=&r" ((USItype)(r0)) \ + : "%rJ" ((USItype)(x3)), \ + "rI" ((USItype)(y3)), \ + "%rJ" ((USItype)(x2)), \ + "rI" ((USItype)(y2)), \ + "%rJ" ((USItype)(x1)), \ + "rI" ((USItype)(y1)), \ + "%rJ" ((USItype)(x0)), \ + "rI" ((USItype)(y0)) \ + : "cc", "g1", "g2"); \ + __asm__ __volatile__ ("" : "=r" (_t1), "=r" (_t2)); \ + r3 = _t1; r2 = _t2; \ + } while (0) + +#define __FP_FRAC_DEC_3(x2,x1,x0,y2,y1,y0) __FP_FRAC_SUB_3(x2,x1,x0,x2,x1,x0,y2,y1,y0) + +#define __FP_FRAC_DEC_4(x3,x2,x1,x0,y3,y2,y1,y0) __FP_FRAC_SUB_4(x3,x2,x1,x0,x3,x2,x1,x0,y3,y2,y1,y0) + +#define __FP_FRAC_ADDI_4(x3,x2,x1,x0,i) \ + __asm__ ("addcc %3,%4,%3 + addxcc %2,%%g0,%2 + addxcc %1,%%g0,%1 + addx %0,%%g0,%0" \ + : "=&r" ((USItype)(x3)), \ + "=&r" ((USItype)(x2)), \ + "=&r" ((USItype)(x1)), \ + "=&r" ((USItype)(x0)) \ + : "rI" ((USItype)(i)), \ + "0" ((USItype)(x3)), \ + "1" ((USItype)(x2)), \ + "2" ((USItype)(x1)), \ + "3" ((USItype)(x0)) \ + : "cc") + +#ifndef __SMP__ +extern struct task_struct *last_task_used_math; +#endif + +/* Obtain the current rounding mode. */ +#ifndef FP_ROUNDMODE +#ifdef __SMP__ +#define FP_ROUNDMODE ((current->thread.fsr >> 30) & 0x3) +#else +#define FP_ROUNDMODE ((last_task_used_math->thread.fsr >> 30) & 0x3) +#endif +#endif + +/* Exception flags. */ +#define FP_EX_INVALID (1 << 4) +#define FP_EX_OVERFLOW (1 << 3) +#define FP_EX_UNDERFLOW (1 << 2) +#define FP_EX_DIVZERO (1 << 1) +#define FP_EX_INEXACT (1 << 0) + +#define FP_HANDLE_EXCEPTIONS return _fex + +#ifdef __SMP__ +#define FP_INHIBIT_RESULTS ((current->thread.fsr >> 23) & _fex) +#else +#define FP_INHIBIT_RESULTS ((last_task_used_math->thread.fsr >> 23) & _fex) +#endif + +#endif diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h index 254babf91..8295a17ce 100644 --- a/include/asm-sparc64/io.h +++ b/include/asm-sparc64/io.h @@ -180,6 +180,8 @@ extern __inline__ void _writel(unsigned int l, unsigned long addr) #define writew(__w, __addr) (_writew((__w), (unsigned long)(__addr))) #define writel(__l, __addr) (_writel((__l), (unsigned long)(__addr))) +#define IO_SPACE_LIMIT 0xffffffff + /* * Memcpy to/from I/O space is just a regular memory operation on * Ultra as well. diff --git a/include/asm-sparc64/resource.h b/include/asm-sparc64/resource.h index a8ecef2a7..0bd968298 100644 --- a/include/asm-sparc64/resource.h +++ b/include/asm-sparc64/resource.h @@ -24,6 +24,12 @@ #define RLIM_NLIMITS 10 +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + */ +#define RLIM_INFINITY (~0UL) + #ifdef __KERNEL__ #define INIT_RLIMITS \ { \ diff --git a/include/asm-sparc64/sfp-machine.h b/include/asm-sparc64/sfp-machine.h new file mode 100644 index 000000000..edb309873 --- /dev/null +++ b/include/asm-sparc64/sfp-machine.h @@ -0,0 +1,91 @@ +/* Machine-dependent software floating-point definitions. + Sparc64 kernel version. + Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com), + Jakub Jelinek (jj@ultra.linux.cz) and + David S. Miller (davem@redhat.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _SFP_MACHINE_H +#define _SFP_MACHINE_H + +#define _FP_W_TYPE_SIZE 64 +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long + +#define _FP_MUL_MEAT_S(R,X,Y) \ + _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y) +#define _FP_MUL_MEAT_D(R,X,Y) \ + _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_Q(R,X,Y) \ + _FP_MUL_MEAT_2_wide_3mul(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) + +#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) +#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv(D,R,X,Y) +#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) + +#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) +#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1) +#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1 +#define _FP_NANSIGN_S 0 +#define _FP_NANSIGN_D 0 +#define _FP_NANSIGN_Q 0 + +#define _FP_KEEPNANFRACP 1 + +/* If one NaN is signaling and the other is not, + * we choose that one, otherwise we choose X. + */ +/* For _Qp_* and _Q_*, this should prefer X, for + * CPU instruction emulation this should prefer Y. + * (see SPAMv9 B.2.2 section). + */ +#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ + do { \ + if ((_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs) \ + && !(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \ + { \ + R##_s = X##_s; \ + _FP_FRAC_COPY_##wc(R,X); \ + } \ + else \ + { \ + R##_s = Y##_s; \ + _FP_FRAC_COPY_##wc(R,Y); \ + } \ + R##_c = FP_CLS_NAN; \ + } while (0) + +/* Obtain the current rounding mode. */ +#ifndef FP_ROUNDMODE +#define FP_ROUNDMODE ((current->thread.xfsr[0] >> 30) & 0x3) +#endif + +/* Exception flags. */ +#define FP_EX_INVALID (1 << 4) +#define FP_EX_OVERFLOW (1 << 3) +#define FP_EX_UNDERFLOW (1 << 2) +#define FP_EX_DIVZERO (1 << 1) +#define FP_EX_INEXACT (1 << 0) + +#define FP_HANDLE_EXCEPTIONS return _fex + +#define FP_INHIBIT_RESULTS ((current->thread.xfsr[0] >> 23) & _fex) + +#endif diff --git a/include/linux/802_11.h b/include/linux/802_11.h new file mode 100644 index 000000000..cff47601a --- /dev/null +++ b/include/linux/802_11.h @@ -0,0 +1,191 @@ +#ifndef IEEE_802_11 +#define IEEE_802_11 + +#include <linux/types.h> + +enum ieee_802_11_link_status_failure_reason { + reserved0, Unspecified=1, Previous_not_valid, + Sender_Quits_ESS_or_IBSS, + Due_Inactivity, AP_Overload, + Class_2_from_NonAuth, + Class_3_from_NonAuth, + Sender_Quits_BSS, + Association_requester_not_authenticated, + Reserved10 +}; + + +#define IEEE_802_11_LINK_STATUS_FAILURE_REASON_STRINGS \ +{ \ + {reserved0, 0xff," Reserved reason "},\ + {Unspecified, 0xff," Unspecified Reason "},\ + {Previous_not_valid, 0xff," Previous Authentication no longer valid "},\ + {Sender_Quits_ESS_or_IBSS,0xff," Deauthenticated because sending station is leaving (has left) IBSS or ESS "},\ + {Due_Inactivity, 0xff," Disassociated due to inactivity "},\ + {AP_Overload, 0xff," Disassociated because AP is unable to handle all currently associated stations "},\ + {Class_2_from_NonAuth, 0xff," Class 2 frame received from non-Authenticated station"},\ + {Class_3_from_NonAuth, 0xff," Class 3 frame received from nonAssociated station"},\ + {Sender_Quits_BSS, 0xff," Disassociated because sending station is leaving (has left) BSS"},\ + {Association_requester_not_authenticated,0xff," Station requesting (Re)Association is not Authenticated with responding station"},\ + {Reserved10, 0xff," Reserved"},\ + {0,0,NULL}\ +}; + + + +struct ieee_802_11_header { + u16 frame_control;// needs to be subtyped + u16 duration; + u8 mac1[6]; + u8 mac2[6]; + u8 mac3[6]; + u16 SeqCtl; + u8 mac4[6]; + u16 gapLen; + u8 gap[8]; +}; + + +struct ieee_802_3_header { + + u16 status; + u16 payload_length; + u8 dst_mac[6]; + u8 src_mac[6]; + +}; + +#define P80211_OUI_LEN 3 + +struct ieee_802_11_snap_header { + + u8 dsap; /* always 0xAA */ + u8 ssap; /* always 0xAA */ + u8 ctrl; /* always 0x03 */ + u8 oui[P80211_OUI_LEN]; /* organizational universal id */ + +} __attribute__ ((packed)); + +#define P80211_LLC_OUI_LEN 3 + +struct ieee_802_11_802_1H_header { + + u8 dsap; + u8 ssap; /* always 0xAA */ + u8 ctrl; /* always 0x03 */ + u8 oui[P80211_OUI_LEN]; /* organizational universal id */ + u16 unknown1; /* packet type ID fields */ + u16 unknown2; /* here is something like length in some cases */ +} __attribute__ ((packed)); + +struct ieee_802_11_802_2_header { + + u8 dsap; + u8 ssap; /* always 0xAA */ + u8 ctrl; /* always 0x03 */ + u8 oui[P80211_OUI_LEN]; /* organizational universal id */ + u8 type; /* packet type ID field. i guess, */ + +} __attribute__ ((packed)); + + + +// following is incoplete and may be incorrect and need reorganization + +#define ieee_802_11_frame_type_Management 0x00 +#define ieee_802_11_frame_type_Control 0x01 +#define ieee_802_11_frame_type_Data 0x10 +#define ieee_802_11_frame_type_Reserved 0x11 + +#define ieee_802_11_frame_subtype_Association_Req 0x0 // Association Request +#define ieee_802_11_frame_subtype_Association_Resp 0x1 // Association Response +#define ieee_802_11_frame_subtype_Reassociation_Req 0x2 // Reassociation Request +#define ieee_802_11_frame_subtype_Reassociation_Resp 0x3 // Reassociation Response +#define ieee_802_11_frame_subtype_Probe_Req 0x4 // Probe Request +#define ieee_802_11_frame_subtype_Probe_Resp 0x5 // Probe Response +#define ieee_802_11_frame_subtype_Beacon 0x8 // Beacon +#define ieee_802_11_frame_subtype_ATIM 0x9 // ATIM +#define ieee_802_11_frame_subtype_Disassociation 0xA // Disassociation +#define ieee_802_11_frame_subtype_Authentication 0xB // Authentication +#define ieee_802_11_frame_subtype_Deauthentication 0xC // Deauthentication +#define ieee_802_11_frame_subtype_PS_Poll 0xA // PS-Poll +#define ieee_802_11_frame_subtype_RTS 0xB // RTS +#define ieee_802_11_frame_subtype_CTS 0xC // CTS +#define ieee_802_11_frame_subtype_ACK 0xD // ACK +#define ieee_802_11_frame_subtype_CFEnd 0xE // CF-End +#define ieee_802_11_frame_subtype_CFEnd_CFAck 0xF // CF-End + CF-Ack +#define ieee_802_11_frame_subtype_Data 0x0 // Data +#define ieee_802_11_frame_subtype_Data_CFAck 0x1 // Data + CF-Ack +#define ieee_802_11_frame_subtype_Data_CF_Poll 0x2 // Data + CF-Poll +#define ieee_802_11_frame_subtype_Data_CF_AckCF_Poll 0x3 // Data + CF-Ack + CF-Poll +#define ieee_802_11_frame_subtype_NullFunction 0x4 // Null Function (no data) +#define ieee_802_11_frame_subtype_CF_Ack 0x5 // CF-Ack (no data) +#define ieee_802_11_frame_subtype_CF_Poll 0x6 // CF-Poll (no data) +#define ieee_802_11_frame_subtype_CF_AckCF_Poll 0x7 // CF-Ack + CF-Poll (no data) + + +#define ieee_802_11_frame_subtype_strings {\ + { ieee_802_11_frame_subtype_Association_Req, 0xF,"f Association Request"},\ + { ieee_802_11_frame_subtype_Association_Resp, 0xF,"1 Association Response"},\ + { ieee_802_11_frame_subtype_Reassociation_Req, 0xF,"2 Reassociation Request"},\ + { ieee_802_11_frame_subtype_Reassociation_Resp, 0xF,"3 Reassociation Response"},\ + { ieee_802_11_frame_subtype_Probe_Req , 0xF,"4 Probe Request"},\ + { ieee_802_11_frame_subtype_Probe_Resp , 0xF,"5 Probe Response"},\ + { ieee_802_11_frame_subtype_Beacon , 0xF,"8 Beacon"},\ + { ieee_802_11_frame_subtype_ATIM , 0xF,"9 ATIM"},\ + { ieee_802_11_frame_subtype_Disassociation, 0xF,"A Disassociation"},\ + { ieee_802_11_frame_subtype_Authentication, 0xF,"B Authentication"},\ + { ieee_802_11_frame_subtype_Deauthentication, 0xF,"C Deauthentication"},\ + { ieee_802_11_frame_subtype_PS_Poll , 0xF,"A PS-Poll"},\ + { ieee_802_11_frame_subtype_RTS , 0xF,"B RTS"},\ + { ieee_802_11_frame_subtype_CTS , 0xF,"C CTS"},\ + { ieee_802_11_frame_subtype_ACK , 0xF,"D ACK"},\ + { ieee_802_11_frame_subtype_CFEnd , 0xF,"E CF-End"},\ + { ieee_802_11_frame_subtype_CFEnd_CFAck , 0xF,"F CF-End + CF-Ack"},\ + { ieee_802_11_frame_subtype_Data , 0xF,"0 Data"},\ + { ieee_802_11_frame_subtype_Data_CFAck , 0xF,"1 Data + CF-Ack"},\ + { ieee_802_11_frame_subtype_Data_CFPoll , 0xF,"2 Data + CF-Poll"},\ + { ieee_802_11_frame_subtype_Data_CFAck_CFPoll, 0xF,"3 Data + CF-Ack + CF-Poll"},\ + { ieee_802_11_frame_subtype_Null_Function , 0xF,"4 Null Function (no data)"},\ + { ieee_802_11_frame_subtype_CFAck , 0xF,"5 CF-Ack (no data)"},\ + { ieee_802_11_frame_subtype_CFPoll , 0xF,"6 CF-Poll (no data)"},\ + { ieee_802_11_frame_subtype_CFAck_CFPoll, 0xF,"y7 CF-Ack + CF-Poll (no data)"},\ + { 0,0,NULL}\ +} +struct ieee_802_11_frame_subtype_class { + u8 subtype; + u8 mask; + u8 class; + u8 type; +}; +#define ieee_802_11_frame_subtype_classes {\ + { ieee_802_11_frame_subtype_Association_Req, 0xF,2,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Association_Resp, 0xF,2,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Reassociation_Req, 0xF,2,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Reassociation_Resp, 0xF,2,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Probe_Req , 0xF,1,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Probe_Resp , 0xF,1,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Beacon , 0xF,1,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_ATIM , 0xF,1,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Disassociation, 0xF,2,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Authentication, 0xF,1,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_Deauthentication, 0xF,3,ieee_802_11_frame_type_Management},\ + { ieee_802_11_frame_subtype_PS-Poll , 0xF,3,ieee_802_11_frame_type_Control},\ + { ieee_802_11_frame_subtype_RTS , 0xF,1,ieee_802_11_frame_type_Control},\ + { ieee_802_11_frame_subtype_CTS , 0xF,1,ieee_802_11_frame_type_Control},\ + { ieee_802_11_frame_subtype_ACK , 0xF,1,ieee_802_11_frame_type_Control},\ + { ieee_802_11_frame_subtype_CFEnd , 0xF,1,ieee_802_11_frame_type_Control},\ + { ieee_802_11_frame_subtype_CFEnd_CFAck , 0xF,1,ieee_802_11_frame_type_Control},\ + { ieee_802_11_frame_subtype_Data , 0xF,3,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_Data_CFAck , 0xF,3,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_Data_CF_Poll 0xF,3,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_Data_CF_AckCF_Poll, 0xF,3,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_NullFunction 0xF,1,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_CF_Ack , 0xF,1,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_CF_Poll , 0xF,1,ieee_802_11_frame_type_Data},\ + { ieee_802_11_frame_subtype_CF_AckCF_Poll, 0xF,1,ieee_802_11_frame_type_Data},\ + { 0,0,NULL}\ +} + + +#endif
\ No newline at end of file diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 138831b4a..22a3f3779 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -23,35 +23,39 @@ #include <linux/types.h> #include <linux/ioctl.h> - #ifdef __KERNEL__ - +#include <linux/config.h> #include <linux/sched.h> #include <linux/wait.h> +#endif /* __KERNEL__ */ /* - * Device types + * System sleep states */ enum { - ACPI_SYS_DEV, /* system device (fan, KB controller, ...) */ - ACPI_PCI_DEV, /* generic PCI device */ - ACPI_PCI_BUS, /* PCI bus */ - ACPI_ISA_DEV, /* generic ISA device */ - ACPI_ISA_BUS, /* ISA bus */ - ACPI_USB_DEV, /* generic USB device */ - ACPI_USB_HUB, /* USB hub device */ - ACPI_USB_CTRL, /* USB controller */ - ACPI_SCSI_DEV, /* generic SCSI device */ - ACPI_SCSI_CTRL, /* SCSI controller */ + ACPI_S0, /* working */ + ACPI_S1, /* sleep */ + ACPI_S2, /* sleep */ + ACPI_S3, /* sleep */ + ACPI_S4, /* non-volatile sleep */ + ACPI_S5, /* soft-off */ }; -typedef int acpi_dev_t; +typedef int acpi_sstate_t; /* - * Device addresses + * Device states */ -#define ACPI_PCI_ADR(dev) ((dev)->bus->number << 16 | (dev)->devfn) +enum +{ + ACPI_D0, /* fully-on */ + ACPI_D1, /* partial-on */ + ACPI_D2, /* partial-on */ + ACPI_D3, /* fully-off */ +}; + +typedef int acpi_dstate_t; /* * HID (PnP) values @@ -70,18 +74,31 @@ enum typedef int acpi_hid_t; +#ifdef __KERNEL__ + /* - * Device states + * Device types */ enum { - ACPI_D0, /* fully-on */ - ACPI_D1, /* partial-on */ - ACPI_D2, /* partial-on */ - ACPI_D3, /* fully-off */ + ACPI_SYS_DEV, /* system device (fan, KB controller, ...) */ + ACPI_PCI_DEV, /* generic PCI device */ + ACPI_PCI_BUS, /* PCI bus */ + ACPI_ISA_DEV, /* generic ISA device */ + ACPI_ISA_BUS, /* ISA bus */ + ACPI_USB_DEV, /* generic USB device */ + ACPI_USB_HUB, /* USB hub device */ + ACPI_USB_CTRL, /* USB controller */ + ACPI_SCSI_DEV, /* generic SCSI device */ + ACPI_SCSI_CTRL, /* SCSI controller */ }; -typedef int acpi_dstate_t; +typedef int acpi_dev_t; + +/* + * Device addresses + */ +#define ACPI_PCI_ADR(dev) ((dev)->bus->number << 16 | (dev)->devfn) struct acpi_dev; @@ -120,7 +137,7 @@ struct acpi_dev #ifdef CONFIG_ACPI -extern wait_queue_head_t acpi_idle_wait; +extern wait_queue_head_t acpi_control_wait; /* * Register a device with the ACPI subsystem @@ -152,8 +169,8 @@ extern inline void acpi_dev_idle(struct acpi_dev *dev) { if (dev) { dev->idle = jiffies; - if (waitqueue_active(&acpi_idle_wait)) - wake_up(&acpi_idle_wait); + if (waitqueue_active(&acpi_control_wait)) + wake_up(&acpi_control_wait); } } @@ -216,6 +233,8 @@ extern void (*acpi_power_off)(void); /* strangess to avoid integer overflow */ #define ACPI_uS_TO_TMR_TICKS(val) \ (((val) * (ACPI_TMR_HZ / 10000)) / 100) +#define ACPI_TMR_TICKS_TO_uS(ticks) \ + (((ticks) * 100) / (ACPI_TMR_HZ / 10000)) /* CPU cycles -> PM timer cycles, looks somewhat heuristic but (ticks = 3/11 * CPU_MHz + 2) comes pretty close for my systems @@ -241,6 +260,16 @@ extern void (*acpi_power_off)(void); /* FACS flags */ #define ACPI_S4BIOS 0x00000001 +/* processor block offsets */ +#define ACPI_P_CNT 0x00000000 +#define ACPI_P_LVL2 0x00000004 +#define ACPI_P_LVL3 0x00000005 + +/* C-state latencies (microseconds) */ +#define ACPI_MAX_P_LVL2_LAT 100 +#define ACPI_MAX_P_LVL3_LAT 1000 +#define ACPI_INFINITE_LAT (~0UL) + struct acpi_rsdp { __u32 signature[2]; __u8 checksum; @@ -330,14 +359,15 @@ enum ACPI_GPE_ENABLE, ACPI_GPE_LEVEL, ACPI_EVENT, - ACPI_P_LVL2, - ACPI_P_LVL3, + ACPI_P_BLK, ACPI_P_LVL2_LAT, ACPI_P_LVL3_LAT, + ACPI_S0_SLP_TYP, + ACPI_S1_SLP_TYP, ACPI_S5_SLP_TYP, + ACPI_SLEEP, }; -#define ACPI_P_LVL_DISABLED 0x80 #define ACPI_SLP_TYP_DISABLED (~0UL) /* @@ -362,9 +392,7 @@ enum #define ACPI_PIIX4_S5_MASK (0x0000 << 10) #define ACPI_PIIX4_PM_TMR 0x0008 #define ACPI_PIIX4_GPE0 0x000c -#define ACPI_PIIX4_P_CNT 0x0010 -#define ACPI_PIIX4_P_LVL2 0x0014 -#define ACPI_PIIX4_P_LVL3 0x0015 +#define ACPI_PIIX4_P_BLK 0x0010 #define ACPI_PIIX4_PM1_EVT_LEN 0x04 #define ACPI_PIIX4_PM1_CNT_LEN 0x02 diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h new file mode 100644 index 000000000..d2ae68864 --- /dev/null +++ b/include/linux/agp_backend.h @@ -0,0 +1,224 @@ +/* + * AGPGART module version 0.99 + * Copyright (C) 1999 Jeff Hartmann + * Copyright (C) 1999 Precision Insight, Inc. + * Copyright (C) 1999 Xi Graphics, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef _AGP_BACKEND_H +#define _AGP_BACKEND_H 1 + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#define AGPGART_VERSION_MAJOR 0 +#define AGPGART_VERSION_MINOR 99 + +enum chipset_type { + NOT_SUPPORTED, + INTEL_GENERIC, + INTEL_LX, + INTEL_BX, + INTEL_GX, + INTEL_I810, + VIA_GENERIC, + VIA_VP3, + VIA_MVP3, + VIA_APOLLO_PRO, + SIS_GENERIC, + AMD_GENERIC, + AMD_IRONGATE, + ALI_M1541, + ALI_GENERIC +}; + +typedef struct _agp_version { + u16 major; + u16 minor; +} agp_version; + +typedef struct _agp_kern_info { + agp_version version; + struct pci_dev *device; + enum chipset_type chipset; + unsigned long mode; + off_t aper_base; + size_t aper_size; + int max_memory; /* In pages */ + int current_memory; +} agp_kern_info; + +/* + * The agp_memory structure has information + * about the block of agp memory allocated. + * A caller may manipulate the next and prev + * pointers to link each allocated item into + * a list. These pointers are ignored by the + * backend. Everything else should never be + * written to, but the caller may read any of + * the items to detrimine the status of this + * block of agp memory. + * + */ + +typedef struct _agp_memory { + int key; + struct _agp_memory *next; + struct _agp_memory *prev; + size_t page_count; + int num_scratch_pages; + unsigned long *memory; + off_t pg_start; + u32 type; + u8 is_bound; + u8 is_flushed; +} agp_memory; + +#define AGP_NORMAL_MEMORY 0 + +extern void agp_free_memory(agp_memory *); + +/* + * agp_free_memory : + * + * This function frees memory associated with + * an agp_memory pointer. It is the only function + * that can be called when the backend is not owned + * by the caller. (So it can free memory on client + * death.) + * + * It takes an agp_memory pointer as an argument. + * + */ + +extern agp_memory *agp_allocate_memory(size_t, u32); + +/* + * agp_allocate_memory : + * + * This function allocates a group of pages of + * a certain type. + * + * It takes a size_t argument of the number of pages, and + * an u32 argument of the type of memory to be allocated. + * Every agp bridge device will allow you to allocate + * AGP_NORMAL_MEMORY which maps to physical ram. Any other + * type is device dependant. + * + * It returns NULL whenever memory is unavailable. + * + */ + +extern void agp_copy_info(agp_kern_info *); + +/* + * agp_copy_info : + * + * This function copies information about the + * agp bridge device and the state of the agp + * backend into an agp_kern_info pointer. + * + * It takes an agp_kern_info pointer as an + * argument. The caller should insure that + * this pointer is valid. + * + */ + +extern int agp_bind_memory(agp_memory *, off_t); + +/* + * agp_bind_memory : + * + * This function binds an agp_memory structure + * into the graphics aperture translation table. + * + * It takes an agp_memory pointer and an offset into + * the graphics aperture translation table as arguments + * + * It returns -EINVAL if the pointer == NULL. + * It returns -EBUSY if the area of the table + * requested is already in use. + * + */ + +extern int agp_unbind_memory(agp_memory *); + +/* + * agp_unbind_memory : + * + * This function removes an agp_memory structure + * from the graphics aperture translation table. + * + * It takes an agp_memory pointer as an argument. + * + * It returns -EINVAL if this piece of agp_memory + * is not currently bound to the graphics aperture + * translation table or if the agp_memory + * pointer == NULL + * + */ + +extern void agp_enable(u32); + +/* + * agp_enable : + * + * This function initializes the agp point-to-point + * connection. + * + * It takes an agp mode register as an argument + * + */ + +extern int agp_backend_acquire(void); + +/* + * agp_backend_acquire : + * + * This Function attempts to acquire the agp + * backend. + * + * returns -EBUSY if agp is in use, + * returns 0 if the caller owns the agp backend + */ + +extern void agp_backend_release(void); + +/* + * agp_backend_release : + * + * This Function releases the lock on the agp + * backend. + * + * The caller must insure that the graphics + * aperture translation table is read for use + * by another entity. (Ensure that all memory + * it bound is unbound.) + * + */ + +#endif /* _AGP_BACKEND_H */ diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h new file mode 100644 index 000000000..86617386e --- /dev/null +++ b/include/linux/agpgart.h @@ -0,0 +1,216 @@ +/* + * AGPGART module version 0.99 + * Copyright (C) 1999 Jeff Hartmann + * Copyright (C) 1999 Precision Insight, Inc. + * Copyright (C) 1999 Xi Graphics, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef _AGP_H +#define _AGP_H 1 + +#define AGPIOC_BASE 'A' +#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, agp_info*) +#define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1) +#define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2) +#define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, agp_setup*) +#define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, agp_region*) +#define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, agp_region*) +#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, agp_allocate*) +#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int) +#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, agp_bind*) +#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, agp_unbind*) + +#define AGP_DEVICE "/dev/agpgart" + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef __KERNEL__ +#include <linux/types.h> +#include <asm/types.h> + +typedef struct _agp_version { + __u16 major; + __u16 minor; +} agp_version; + +typedef struct _agp_info { + agp_version version; /* version of the driver */ + __u32 bridge_id; /* bridge vendor/device */ + __u32 agp_mode; /* mode info of bridge */ + off_t aper_base; /* base of aperture */ + size_t aper_size; /* size of aperture */ + size_t pg_total; /* max pages (swap + system) */ + size_t pg_system; /* max pages (system) */ + size_t pg_used; /* current pages used */ +} agp_info; + +typedef struct _agp_setup { + __u32 agp_mode; /* mode info of bridge */ +} agp_setup; + +/* + * The "prot" down below needs still a "sleep" flag somehow ... + */ +typedef struct _agp_segment { + off_t pg_start; /* starting page to populate */ + size_t pg_count; /* number of pages */ + int prot; /* prot flags for mmap */ +} agp_segment; + +typedef struct _agp_region { + pid_t pid; /* pid of process */ + size_t seg_count; /* number of segments */ + struct _agp_segment *seg_list; +} agp_region; + +typedef struct _agp_allocate { + int key; /* tag of allocation */ + size_t pg_count; /* number of pages */ + __u32 type; /* 0 == normal, other devspec */ +} agp_allocate; + +typedef struct _agp_bind { + int key; /* tag of allocation */ + off_t pg_start; /* starting page to populate */ +} agp_bind; + +typedef struct _agp_unbind { + int key; /* tag of allocation */ + __u32 priority; /* priority for paging out */ +} agp_unbind; + +#else /* __KERNEL__ */ + +#define AGPGART_MINOR 175 + +#define AGP_UNLOCK() up(&(agp_fe.agp_mutex)); +#define AGP_LOCK() down(&(agp_fe.agp_mutex)); +#define AGP_LOCK_INIT() sema_init(&(agp_fe.agp_mutex), 1) + +#ifndef _AGP_BACKEND_H +typedef struct _agp_version { + u16 major; + u16 minor; +} agp_version; + +#endif + +typedef struct _agp_info { + agp_version version; /* version of the driver */ + u32 bridge_id; /* bridge vendor/device */ + u32 agp_mode; /* mode info of bridge */ + off_t aper_base; /* base of aperture */ + size_t aper_size; /* size of aperture */ + size_t pg_total; /* max pages (swap + system) */ + size_t pg_system; /* max pages (system) */ + size_t pg_used; /* current pages used */ +} agp_info; + +typedef struct _agp_setup { + u32 agp_mode; /* mode info of bridge */ +} agp_setup; + +/* + * The "prot" down below needs still a "sleep" flag somehow ... + */ +typedef struct _agp_segment { + off_t pg_start; /* starting page to populate */ + size_t pg_count; /* number of pages */ + int prot; /* prot flags for mmap */ +} agp_segment; + +typedef struct _agp_segment_priv { + off_t pg_start; + size_t pg_count; + pgprot_t prot; +} agp_segment_priv; + +typedef struct _agp_region { + pid_t pid; /* pid of process */ + size_t seg_count; /* number of segments */ + struct _agp_segment *seg_list; +} agp_region; + +typedef struct _agp_allocate { + int key; /* tag of allocation */ + size_t pg_count; /* number of pages */ + u32 type; /* 0 == normal, other devspec */ +} agp_allocate; + +typedef struct _agp_bind { + int key; /* tag of allocation */ + off_t pg_start; /* starting page to populate */ +} agp_bind; + +typedef struct _agp_unbind { + int key; /* tag of allocation */ + u32 priority; /* priority for paging out */ +} agp_unbind; + +typedef struct _agp_client { + struct _agp_client *next; + struct _agp_client *prev; + pid_t pid; + int num_segments; + agp_segment_priv **segments; +} agp_client; + +typedef struct _agp_controller { + struct _agp_controller *next; + struct _agp_controller *prev; + pid_t pid; + int num_clients; + agp_memory *pool; + agp_client *clients; +} agp_controller; + +#define AGP_FF_ALLOW_CLIENT 0 +#define AGP_FF_ALLOW_CONTROLLER 1 +#define AGP_FF_IS_CLIENT 2 +#define AGP_FF_IS_CONTROLLER 3 +#define AGP_FF_IS_VALID 4 + +typedef struct _agp_file_private { + struct _agp_file_private *next; + struct _agp_file_private *prev; + pid_t my_pid; + u32 access_flags; +} agp_file_private; + +struct agp_front_data { + struct semaphore agp_mutex; + agp_controller *current_controller; + agp_controller *controllers; + agp_file_private *file_priv_list; + u8 used_by_controller; + u8 backend_acquired; +}; + +#endif /* __KERNEL__ */ + +#endif /* _AGP_H */ diff --git a/include/linux/blk.h b/include/linux/blk.h index d0db1bce6..594f891af 100644 --- a/include/linux/blk.h +++ b/include/linux/blk.h @@ -157,9 +157,7 @@ static void floppy_off(unsigned int nr); #elif (SCSI_DISK_MAJOR(MAJOR_NR)) #define DEVICE_NAME "scsidisk" -#define DEVICE_INTR do_sd #define TIMEOUT_VALUE (2*HZ) -#define DEVICE_REQUEST do_sd_request #define DEVICE_NR(device) (((MAJOR(device) & SD_MAJOR_MASK) << (8 - 4)) + (MINOR(device) >> 4)) #define DEVICE_ON(device) #define DEVICE_OFF(device) @@ -184,8 +182,6 @@ static void floppy_off(unsigned int nr); #elif (MAJOR_NR == SCSI_CDROM_MAJOR) #define DEVICE_NAME "CD-ROM" -#define DEVICE_INTR do_sr -#define DEVICE_REQUEST do_sr_request #define DEVICE_NR(device) (MINOR(device)) #define DEVICE_ON(device) #define DEVICE_OFF(device) @@ -387,7 +383,7 @@ static void floppy_off(unsigned int nr); #if !defined(IDE_DRIVER) #ifndef CURRENT -#define CURRENT (blk_dev[MAJOR_NR].current_request) +#define CURRENT (blk_dev[MAJOR_NR].request_queue.current_request) #endif #ifndef DEVICE_NAME @@ -421,7 +417,9 @@ else \ #endif /* DEVICE_TIMEOUT */ -static void (DEVICE_REQUEST)(void); +#ifdef DEVICE_REQUEST +static void (DEVICE_REQUEST)(request_queue_t *); +#endif #ifdef DEVICE_INTR #define CLEAR_INTR SET_INTR(NULL) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0567e080e..77d31cc9a 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -27,6 +27,7 @@ struct request { unsigned long nr_sectors; unsigned long nr_segments; unsigned long current_nr_sectors; + void * special; char * buffer; struct semaphore * sem; struct buffer_head * bh; @@ -34,19 +35,57 @@ struct request { struct request * next; }; -typedef void (request_fn_proc) (void); -typedef struct request ** (queue_proc) (kdev_t dev); +typedef struct request_queue request_queue_t; +typedef int (merge_request_fn) (request_queue_t *, + struct request * req, + struct buffer_head *); +typedef int (merge_requests_fn) (request_queue_t *, + struct request * req, + struct request * req2); +typedef void (request_fn_proc) (request_queue_t *); +typedef request_queue_t * (queue_proc) (kdev_t dev); + +struct request_queue +{ + struct request * current_request; + request_fn_proc * request_fn; + merge_request_fn * merge_fn; + merge_requests_fn * merge_requests_fn; + /* + * The queue owner gets to use this for whatever they like. + * ll_rw_blk doesn't touch it. + */ + void * queuedata; + + /* + * This is used to remove the plug when tq_disk runs. + */ + struct tq_struct plug_tq; + /* + * Boolean that indicates whether this queue is plugged or not. + */ + char plugged; + + /* + * Boolean that indicates whether current_request is active or + * not. + */ + char head_active; + + /* + * Boolean that indicates whether we should use plugging on + * this queue or not. + */ + char use_plug; +}; struct blk_dev_struct { - request_fn_proc *request_fn; /* * queue_proc has to be atomic */ + request_queue_t request_queue; queue_proc *queue; void *data; - struct request *current_request; - struct request plug; - struct tq_struct plug_tq; }; struct sec_size { @@ -54,6 +93,14 @@ struct sec_size { unsigned block_size_bits; }; +/* + * Used to indicate the default queue for drivers that don't bother + * to implement multiple queues. We have this access macro here + * so as to eliminate the need for each and every block device + * driver to know about the internal structure of blk_dev[]. + */ +#define BLK_DEFAULT_QUEUE(_MAJOR) &blk_dev[_MAJOR].request_queue + extern struct sec_size * blk_sec[MAX_BLKDEV]; extern struct blk_dev_struct blk_dev[MAX_BLKDEV]; extern wait_queue_head_t wait_for_request; @@ -61,6 +108,14 @@ extern void resetup_one_dev(struct gendisk *dev, int drive); extern void unplug_device(void * data); extern void make_request(int major,int rw, struct buffer_head * bh); +/* + * Access functions for manipulating queue properties + */ +extern void blk_init_queue(request_queue_t *, request_fn_proc *); +extern void blk_cleanup_queue(request_queue_t *); +extern void blk_queue_headactive(request_queue_t *, int); +extern void blk_queue_pluggable(request_queue_t *, int); + /* md needs this function to remap requests */ extern int md_map (int minor, kdev_t *rdev, unsigned long *rsector, unsigned long size); extern int md_make_request (int minor, int rw, struct buffer_head * bh); diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index c789e769c..7b51fcb54 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h @@ -1,8 +1,13 @@ +/* + * Discontiguous memory support, Kanoj Sarcar, SGI, Nov 1999 + */ #ifndef _LINUX_BOOTMEM_H #define _LINUX_BOOTMEM_H #include <asm/pgtable.h> #include <asm/dma.h> +#include <linux/cache.h> +#include <linux/init.h> /* * simple boot-time physical memory area allocator. @@ -10,18 +15,45 @@ extern unsigned long max_low_pfn; +/* + * node_bootmem_map is a map pointer - the bits represent all physical + * memory pages (including holes) on the node. + */ +typedef struct bootmem_data { + unsigned long node_boot_start; + unsigned long node_low_pfn; + void *node_bootmem_map; + unsigned long last_offset; + unsigned long last_pos; +} bootmem_data_t; + +extern unsigned long __init bootmem_bootmap_pages (unsigned long); extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend); extern void __init reserve_bootmem (unsigned long addr, unsigned long size); extern void __init free_bootmem (unsigned long addr, unsigned long size); extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal); #define alloc_bootmem(x) \ __alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) +#define alloc_bootmem_low(x) \ + __alloc_bootmem((x), SMP_CACHE_BYTES, 0) #define alloc_bootmem_pages(x) \ __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) #define alloc_bootmem_low_pages(x) \ __alloc_bootmem((x), PAGE_SIZE, 0) extern unsigned long __init free_all_bootmem (void); +extern unsigned long __init init_bootmem_node (int nid, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn); +extern void __init reserve_bootmem_node (int nid, unsigned long physaddr, unsigned long size); +extern void __init free_bootmem_node (int nid, unsigned long addr, unsigned long size); +extern unsigned long __init free_all_bootmem_node (int nid); +extern void * __init __alloc_bootmem_node (int nid, unsigned long size, unsigned long align, unsigned long goal); +#define alloc_bootmem_node(nid, x) \ + __alloc_bootmem_node((nid), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) +#define alloc_bootmem_pages_node(nid, x) \ + __alloc_bootmem_node((nid), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) +#define alloc_bootmem_low_pages_node(nid, x) \ + __alloc_bootmem_node((nid), (x), PAGE_SIZE, 0) + #endif /* _LINUX_BOOTMEM_H */ diff --git a/include/linux/cache.h b/include/linux/cache.h new file mode 100644 index 000000000..2030eb72b --- /dev/null +++ b/include/linux/cache.h @@ -0,0 +1,28 @@ +#ifndef __LINUX_CACHE_H +#define __LINUX_CACHE_H + +#include <asm/cache.h> + +#ifndef L1_CACHE_ALIGN +#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) +#endif + +#ifndef SMP_CACHE_BYTES +#define SMP_CACHE_BYTES L1_CACHE_BYTES +#endif + +#ifndef ____cacheline_aligned +#define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) +#endif + +#ifndef __cacheline_aligned +#ifdef MODULE +#define __cacheline_aligned ____cacheline_aligned +#else +#define __cacheline_aligned \ + __attribute__((__aligned__(SMP_CACHE_BYTES), \ + __section__(".data.cacheline_aligned"))) +#endif +#endif /* __cacheline_aligned */ + +#endif /* __LINUX_CACHE_H */ diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 9331f9a2d..b125ee4d6 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -12,6 +12,7 @@ #define _LINUX_CDROM_H #include <linux/types.h> +#include <asm/byteorder.h> /******************************************************* * As of Linux 2.1.x, all Linux CD-ROM application programs will use this @@ -269,11 +270,12 @@ struct cdrom_blk /* for CDROM_PACKET_COMMAND ioctl */ struct cdrom_generic_command { - unsigned char cmd[CDROM_PACKET_SIZE]; - unsigned char *buffer; - unsigned int buflen; - int stat; - void *reserved[4]; + unsigned char cmd[CDROM_PACKET_SIZE]; + unsigned char *buffer; + unsigned int buflen; + int stat; + struct request_sense *sense; + void *reserved[3]; }; @@ -584,6 +586,8 @@ typedef union { #define DVD_LU_SEND_TITLE_KEY 7 #define DVD_LU_SEND_ASF 8 #define DVD_INVALIDATE_AGID 9 +#define DVD_LU_SEND_RPC_STATE 10 +#define DVD_HOST_SEND_RPC_STATE 11 /* State data */ typedef __u8 dvd_key[5]; /* 40-bit value, MSB is first elem. */ @@ -643,6 +647,19 @@ struct dvd_lu_send_asf { unsigned asf : 1; }; +struct dvd_host_send_rpcstate { + __u8 type; + __u8 pdrc; +}; + +struct dvd_lu_send_rpcstate { + __u8 type : 2; + __u8 vra : 3; + __u8 ucca : 3; + __u8 region_mask; + __u8 rpc_scheme; +}; + typedef union { __u8 type; @@ -653,8 +670,40 @@ typedef union { struct dvd_send_key hsk; struct dvd_lu_send_title_key lstk; struct dvd_lu_send_asf lsasf; + struct dvd_host_send_rpcstate hrpcs; + struct dvd_lu_send_rpcstate lrpcs; } dvd_authinfo; +struct request_sense { +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 valid : 1; + __u8 error_code : 7; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 error_code : 7; + __u8 valid : 1; +#endif + __u8 segment_number; +#if defined(__BIG_ENDIAN_BITFIELD) + __u8 reserved1 : 2; + __u8 ili : 1; + __u8 reserved2 : 1; + __u8 sense_key : 4; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + __u8 sense_key : 4; + __u8 reserved2 : 1; + __u8 ili : 1; + __u8 reserved1 : 2; +#endif + __u8 information[4]; + __u8 add_sense_len; + __u8 command_info[4]; + __u8 asc; + __u8 ascq; + __u8 fruc; + __u8 sks[3]; + __u8 asb[46]; +}; + #ifdef __KERNEL__ struct cdrom_write_settings { diff --git a/include/linux/coda_proc.h b/include/linux/coda_proc.h index 7c4ca8a04..99cee973f 100644 --- a/include/linux/coda_proc.h +++ b/include/linux/coda_proc.h @@ -133,13 +133,13 @@ int do_reset_coda_cache_inv_stats( ctl_table * table, int write, /* these functions are called to form the content of /proc/fs/coda/... files */ int coda_vfs_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ); + int length); int coda_upcall_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ); + int length); int coda_permission_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ); + int length); int coda_cache_inv_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ); + int length); #endif /* _CODA_PROC_H */ diff --git a/include/linux/cycx_drv.h b/include/linux/cycx_drv.h index b38cfe77f..b456e1f15 100644 --- a/include/linux/cycx_drv.h +++ b/include/linux/cycx_drv.h @@ -53,6 +53,7 @@ typedef struct cycxhw { /* Function Prototypes */ extern int cycx_setup (cycxhw_t *hw, void *sfm, u32 len); +extern int cycx_down (cycxhw_t *hw); extern int cycx_peek (cycxhw_t *hw, u32 addr, void *buf, u32 len); extern int cycx_poke (cycxhw_t *hw, u32 addr, void *buf, u32 len); extern int cycx_exec (u32 addr); diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index 1ed6fe5e1..836038e59 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h @@ -615,6 +615,7 @@ extern struct inode_operations ext2_file_inode_operations; /* symlink.c */ extern struct inode_operations ext2_symlink_inode_operations; +extern struct inode_operations ext2_fast_symlink_inode_operations; #endif /* __KERNEL__ */ diff --git a/include/linux/fb.h b/include/linux/fb.h index 8c008b8de..78fb24d23 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -1,6 +1,7 @@ #ifndef _LINUX_FB_H #define _LINUX_FB_H +#include <linux/tty.h> #include <asm/types.h> /* Definitions of frame buffers */ @@ -254,61 +255,6 @@ struct fb_ops { int (*fb_rasterimg)(struct fb_info *info, int start); }; - - /* - * This is the interface between the low-level console driver and the - * low-level frame buffer device - */ - -struct display { - /* Filled in by the frame buffer device */ - - struct fb_var_screeninfo var; /* variable infos. yoffset and vmode */ - /* are updated by fbcon.c */ - struct fb_cmap cmap; /* colormap */ - char *screen_base; /* pointer to top of virtual screen */ - /* (virtual address) */ - int visual; - int type; /* see FB_TYPE_* */ - int type_aux; /* Interleave for interleaved Planes */ - u_short ypanstep; /* zero if no hardware ypan */ - u_short ywrapstep; /* zero if no hardware ywrap */ - u_long line_length; /* length of a line in bytes */ - u_short can_soft_blank; /* zero if no hardware blanking */ - u_short inverse; /* != 0 text black on white as default */ - struct display_switch *dispsw; /* low level operations */ - void *dispsw_data; /* optional dispsw helper data */ - -#if 0 - struct fb_fix_cursorinfo fcrsr; - struct fb_var_cursorinfo *vcrsr; - struct fb_cursorstate crsrstate; -#endif - - /* Filled in by the low-level console driver */ - - struct vc_data *conp; /* pointer to console data */ - struct fb_info *fb_info; /* frame buffer for this console */ - int vrows; /* number of virtual rows */ - unsigned short cursor_x; /* current cursor position */ - unsigned short cursor_y; - int fgcol; /* text colors */ - int bgcol; - u_long next_line; /* offset to one line below */ - u_long next_plane; /* offset to next plane */ - u_char *fontdata; /* Font associated to this display */ - unsigned short _fontheightlog; - unsigned short _fontwidthlog; - unsigned short _fontheight; - unsigned short _fontwidth; - int userfont; /* != 0 if fontdata kmalloc()ed */ - u_short scrollmode; /* Scroll Method */ - short yscroll; /* Hardware scrolling */ - unsigned char fgshift, bgshift; - unsigned short charmask; /* 0xff or 0x1ff */ -}; - - struct fb_info { char modename[40]; /* default video mode */ kdev_t node; @@ -408,20 +354,17 @@ extern int fbgen_switch(int con, struct fb_info *info); extern void fbgen_blank(int blank, struct fb_info *info); -/* drivers/char/fbmem.c */ +/* drivers/video/fbmem.c */ extern int register_framebuffer(struct fb_info *fb_info); extern int unregister_framebuffer(const struct fb_info *fb_info); -extern int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal, - const struct fb_info *fb_info); -extern int fbmon_dpms(const struct fb_info *fb_info); - extern int num_registered_fb; extern struct fb_info *registered_fb[FB_MAX]; -extern char con2fb_map[MAX_NR_CONSOLES]; -/* drivers/video/fbcon.c */ -extern struct display fb_display[MAX_NR_CONSOLES]; +/* drivers/video/fbmon.c */ +extern int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal, + const struct fb_info *fb_info); +extern int fbmon_dpms(const struct fb_info *fb_info); /* drivers/video/fbcmap.c */ extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp); diff --git a/include/linux/fs.h b/include/linux/fs.h index 348cf02e2..57ba941dd 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -18,10 +18,10 @@ #include <linux/list.h> #include <linux/dcache.h> #include <linux/stat.h> +#include <linux/cache.h> #include <asm/atomic.h> #include <asm/bitops.h> -#include <asm/cache.h> struct poll_table_struct; @@ -62,6 +62,7 @@ extern int max_super_blocks, nr_super_blocks; #define READ 0 #define WRITE 1 #define READA 2 /* read-ahead - don't block if no resources */ +#define SPECIAL 4 /* For non-blockdevice requests in request queue */ #define WRITERAW 5 /* raw write - don't play with buffer lists */ @@ -543,14 +544,12 @@ struct super_block { unsigned long s_blocksize; unsigned char s_blocksize_bits; unsigned char s_lock; - unsigned char s_rd_only; unsigned char s_dirt; struct file_system_type *s_type; struct super_operations *s_op; struct dquot_operations *dq_op; unsigned long s_flags; unsigned long s_magic; - unsigned long s_time; struct dentry *s_root; wait_queue_head_t s_wait; @@ -639,7 +638,7 @@ struct inode_operations { /* * the order of these functions within the VFS template has been * changed because SMP locking has changed: from now on all get_block, - * readpage, writepage and flushpage functions are supposed to do + * readpage and writepage functions are supposed to do * whatever locking they need to get proper SMP operation - for * now in most cases this means a lock/unlock_kernel at entry/exit. * [The new order is also slightly more logical :)] @@ -651,13 +650,11 @@ struct inode_operations { */ int (*get_block) (struct inode *, long, struct buffer_head *, int); - int (*readpage) (struct file *, struct page *); - int (*writepage) (struct file *, struct page *); - int (*flushpage) (struct inode *, struct page *, unsigned long); + int (*readpage) (struct dentry *, struct page *); + int (*writepage) (struct dentry *, struct page *); void (*truncate) (struct inode *); int (*permission) (struct inode *, int); - int (*smap) (struct inode *,int); int (*revalidate) (struct dentry *); }; @@ -678,11 +675,11 @@ struct super_operations { struct dquot_operations { void (*initialize) (struct inode *, short); void (*drop) (struct inode *); - int (*alloc_block) (const struct inode *, unsigned long, uid_t, char); - int (*alloc_inode) (const struct inode *, unsigned long, uid_t); + int (*alloc_block) (const struct inode *, unsigned long, char); + int (*alloc_inode) (const struct inode *, unsigned long); void (*free_block) (const struct inode *, unsigned long); void (*free_inode) (const struct inode *, unsigned long); - int (*transfer) (struct inode *, struct iattr *, char, uid_t); + int (*transfer) (struct dentry *, struct iattr *); }; struct file_system_type { @@ -735,7 +732,7 @@ extern inline int locks_verify_area(int read_write, struct inode *inode, asmlinkage long sys_open(const char *, int, int); 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 *, unsigned long); +extern int do_truncate(struct dentry *, loff_t start); extern int get_unused_fd(void); extern void put_unused_fd(unsigned int); @@ -946,17 +943,28 @@ extern int brw_page(int, struct page *, kdev_t, int [], int); typedef int (*writepage_t)(struct file *, struct page *, unsigned long, unsigned long, const char *); /* Generic buffer handling for block filesystems.. */ -extern int block_read_full_page(struct file *, struct page *); -extern int block_write_full_page (struct file *, struct page *); +extern int block_read_full_page(struct dentry *, struct page *); +extern int block_write_full_page (struct dentry *, struct page *); extern int block_write_partial_page (struct file *, struct page *, unsigned long, unsigned long, const char *); extern int block_write_cont_page (struct file *, struct page *, unsigned long, unsigned long, const char *); -extern int block_flushpage(struct inode *, struct page *, unsigned long); +extern int block_write_zero_range(struct inode *, struct page *, unsigned, unsigned, unsigned, const char *); +extern inline int block_write_range(struct inode *inode, struct page *page, + unsigned from, unsigned len,const char *buf) +{ + return block_write_zero_range(inode, page, from, from, from+len, buf); +} +extern int block_flushpage(struct page *, unsigned long); +extern int block_symlink(struct inode *, const char *, int); extern int generic_file_mmap(struct file *, struct vm_area_struct *); extern ssize_t generic_file_read(struct file *, char *, size_t, loff_t *); extern ssize_t generic_file_write(struct file *, const char *, size_t, loff_t *, writepage_t); -extern void do_generic_file_read(struct file * filp, loff_t *ppos, read_descriptor_t * desc, read_actor_t actor); +extern void do_generic_file_read(struct file *, loff_t *, read_descriptor_t *, read_actor_t); +extern int vfs_readlink(struct dentry *, char *, int, char *); +extern struct dentry *vfs_follow_link(struct dentry *, struct dentry *, unsigned, char *); +extern int page_readlink(struct dentry *, char *, int); +extern struct dentry *page_follow_link(struct dentry *, struct dentry *, unsigned); extern struct super_block *get_super(kdev_t); struct super_block *get_empty_super(void); @@ -983,7 +991,7 @@ extern ssize_t block_write(struct file *, const char *, size_t, loff_t *); extern int block_fsync(struct file *, struct dentry *); extern int file_fsync(struct file *, struct dentry *); -extern int generic_buffer_fdatasync(struct inode *inode, unsigned long start, unsigned long end); +extern int generic_buffer_fdatasync(struct inode *inode, unsigned long start_idx, unsigned long end_idx); extern int inode_change_ok(struct inode *, struct iattr *); extern void inode_setattr(struct inode *, struct iattr *); diff --git a/include/linux/ftape.h b/include/linux/ftape.h index a26f2e51b..d9ab7df58 100644 --- a/include/linux/ftape.h +++ b/include/linux/ftape.h @@ -40,9 +40,6 @@ #include <linux/types.h> #include <linux/version.h> #include <linux/config.h> -#if LINUX_VERSION_CODE <= KERNEL_VER(1,2,13) -typedef daddr_t __kernel_daddr_t; /* needed for mtio.h */ -#endif #include <linux/mtio.h> #define FT_SECTOR(x) (x+1) /* sector offset into real sector */ diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 4e8e98224..2e31d77f2 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -2,8 +2,7 @@ #define _LINUX_HIGHMEM_H #include <linux/config.h> -#include <linux/pagemap.h> -#include <asm/pgtable.h> +#include <asm/pgalloc.h> #ifdef CONFIG_HIGHMEM diff --git a/include/linux/i2c.h b/include/linux/i2c.h index f5e1a3015..60e08d0d3 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -42,6 +42,7 @@ struct i2c_device; #define I2C_BUSID_PARPORT 2 /* Bit banging on a parallel port */ #define I2C_BUSID_BUZ 3 #define I2C_BUSID_ZORAN 4 +#define I2C_BUSID_CYBER2000 5 /* I2C bus on a Cyber2000 */ /* * struct for a driver for a i2c chip (tuner, soundprocessor, diff --git a/include/linux/ide.h b/include/linux/ide.h index 10cfa1605..cd813e9c6 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -227,11 +227,11 @@ typedef union { unsigned set_multmode : 1; /* set multmode count */ unsigned set_tune : 1; /* tune interface for drive */ unsigned reserved : 4; /* unused */ - } b; - } special_t; + } b; +} special_t; typedef struct ide_drive_s { - struct request *queue; /* request queue */ + request_queue_t queue; /* request queue */ struct ide_drive_s *next; /* circular list of hwgroup drives */ unsigned long sleep; /* sleep until this time */ unsigned long service_start; /* time we started last request */ @@ -299,7 +299,9 @@ typedef struct ide_drive_s { thresholds_t smart_thresholds; values_t smart_values; #endif - } ide_drive_t; + int last_lun; /* last logical unit */ + int forced_lun; /* if hdxlun was given at boot */ +} ide_drive_t; /* * An ide_dmaproc_t() initiates/aborts DMA read/write operations on a drive. @@ -317,11 +319,10 @@ typedef enum { ide_dma_read, ide_dma_write, ide_dma_begin, ide_dma_off, ide_dma_off_quietly, ide_dma_test_irq, ide_dma_bad_drive, ide_dma_good_drive, ide_dma_lostirq, ide_dma_timeout - } ide_dma_action_t; +} ide_dma_action_t; typedef int (ide_dmaproc_t)(ide_dma_action_t, ide_drive_t *); - /* * An ide_tuneproc_t() is used to set the speed of an IDE interface * to a particular PIO mode. The "byte" parameter is used @@ -350,7 +351,7 @@ typedef enum { ide_unknown, ide_generic, ide_pci, ide_qd6580, ide_umc8672, ide_ht6560b, ide_pdc4030, ide_rz1000, ide_trm290, ide_cmd646, ide_cy82c693, ide_4drives - } hwif_chipset_t; +} hwif_chipset_t; typedef struct ide_pci_devid_s { unsigned short vid; @@ -396,12 +397,20 @@ typedef struct hwif_s { #if (DISK_RECOVERY_TIME > 0) unsigned long last_time; /* time when previous rq was done */ #endif - } ide_hwif_t; +} ide_hwif_t; + + /* + * Status returned from various ide_ functions + */ +typedef enum { + ide_stopped, /* no drive operation was started */ + ide_started /* a drive operation was started, and a handler was set */ +} ide_startstop_t; /* * internal ide interrupt handler type */ -typedef void (ide_handler_t)(ide_drive_t *); +typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); /* * when ide_timer_expiry fires, invoke a handler of this type @@ -410,9 +419,9 @@ typedef void (ide_handler_t)(ide_drive_t *); typedef int (ide_expiry_t)(ide_drive_t *); typedef struct hwgroup_s { - spinlock_t spinlock; /* protects "busy" and "handler" */ ide_handler_t *handler;/* irq handler, if active */ - int busy; /* BOOL: protects all fields below */ + volatile int busy; /* BOOL: protects all fields below */ + int sleeping; /* BOOL: wake us up on timer expiry */ ide_drive_t *drive; /* current drive */ ide_hwif_t *hwif; /* ptr to current hwif in linked-list */ struct request *rq; /* current request */ @@ -420,7 +429,7 @@ typedef struct hwgroup_s { struct request wrq; /* local copy of current write rq */ unsigned long poll_timeout; /* timeout value during long polls */ ide_expiry_t *expiry; /* queried upon timeouts */ - } ide_hwgroup_t; +} ide_hwgroup_t; /* * configurable drive settings @@ -504,7 +513,7 @@ read_proc_t proc_ide_read_geometry; #define IDE_SUBDRIVER_VERSION 1 typedef int (ide_cleanup_proc)(ide_drive_t *); -typedef void (ide_do_request_proc)(ide_drive_t *, struct request *, unsigned long); +typedef ide_startstop_t (ide_do_request_proc)(ide_drive_t *, struct request *, unsigned long); typedef void (ide_end_request_proc)(byte, ide_hwgroup_t *); typedef int (ide_ioctl_proc)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long); typedef int (ide_open_proc)(struct inode *, struct file *, ide_drive_t *); @@ -512,7 +521,7 @@ 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_pre_reset_proc)(ide_drive_t *); typedef unsigned long (ide_capacity_proc)(ide_drive_t *); -typedef void (ide_special_proc)(ide_drive_t *); +typedef ide_startstop_t (ide_special_proc)(ide_drive_t *); typedef void (ide_setting_proc)(ide_drive_t *); typedef struct ide_driver_s { @@ -533,7 +542,7 @@ typedef struct ide_driver_s { ide_capacity_proc *capacity; ide_special_proc *special; ide_proc_entry_t *proc; - } ide_driver_t; +} ide_driver_t; #define DRIVER(drive) ((ide_driver_t *)((drive)->driver)) @@ -600,9 +609,9 @@ byte ide_dump_status (ide_drive_t *drive, const char *msg, byte stat); /* * ide_error() takes action based on the error returned by the controller. - * The calling function must return afterwards, to restart the request. + * The caller should return immediately after invoking this. */ -void ide_error (ide_drive_t *drive, const char *msg, byte stat); +ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); /* * Issue a simple drive command @@ -622,10 +631,13 @@ void ide_fixstring (byte *s, const int bytecount, const int byteswap); * This routine busy-waits for the drive status to be not "busy". * It then checks the status for all of the "good" bits and none * of the "bad" bits, and if all is okay it returns 0. All other - * cases return 1 after invoking ide_error() -- caller should return. - * + * cases return 1 after doing "*startstop = ide_error()", and the + * caller should return the updated value of "startstop" in this case. + * "startstop" is unchanged when the function returns 0; */ -int ide_wait_stat (ide_drive_t *drive, byte good, byte bad, unsigned long timeout); +int ide_wait_stat (ide_startstop_t *startstop, ide_drive_t *drive, byte good, byte bad, unsigned long timeout); + +int ide_wait_noerr (ide_drive_t *drive, byte good, byte bad, unsigned long timeout); /* * This routine is called from the partition-table code in genhd.c @@ -647,7 +659,7 @@ unsigned long current_capacity (ide_drive_t *drive); * Start a reset operation for an IDE interface. * The caller should return immediately after invoking this. */ -void ide_do_reset (ide_drive_t *); +ide_startstop_t ide_do_reset (ide_drive_t *); /* * This function is intended to be used prior to invoking ide_do_drive_cmd(). @@ -657,12 +669,12 @@ void ide_init_drive_cmd (struct request *rq); /* * "action" parameter type for ide_do_drive_cmd() below. */ -typedef enum - {ide_wait, /* insert rq at end of list, and wait for it */ - ide_next, /* insert rq immediately after current request */ - ide_preempt, /* insert rq in front of current request */ - ide_end} /* insert rq at end of list, but don't wait for it */ - ide_action_t; +typedef enum { + ide_wait, /* insert rq at end of list, and wait for it */ + ide_next, /* insert rq immediately after current request */ + ide_preempt, /* insert rq in front of current request */ + ide_end /* insert rq at end of list, but don't wait for it */ +} ide_action_t; /* * This function issues a special IDE device request @@ -703,7 +715,11 @@ 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 ide_driveid_update (ide_drive_t *drive); +int ide_ata66_check (ide_drive_t *drive, int cmd, int nsect, int feature); int ide_config_drive_speed (ide_drive_t *drive, byte speed); +int set_transfer (ide_drive_t *drive, int cmd, int nsect, int feature); /* * ide_system_bus_speed() returns what we think is the system VESA/PCI @@ -717,7 +733,7 @@ int ide_system_bus_speed (void); * ide_multwrite() transfers a block of up to mcount sectors of data * to a drive as part of a disk multwrite operation. */ -void ide_multwrite (ide_drive_t *drive, unsigned int mcount); +int ide_multwrite (ide_drive_t *drive, unsigned int mcount); /* * ide_stall_queue() can be used by a drive to give excess bandwidth back @@ -728,7 +744,7 @@ void ide_stall_queue (ide_drive_t *drive, unsigned long timeout); /* * ide_get_queue() returns the queue which corresponds to a given device. */ -struct request **ide_get_queue (kdev_t dev); +request_queue_t *ide_get_queue (kdev_t dev); /* * CompactFlash cards and their brethern pretend to be removable hard disks, @@ -741,33 +757,33 @@ int ide_spin_wait_hwgroup(ide_drive_t *drive, unsigned long *flags); void ide_timer_expiry (unsigned long data); void ide_intr (int irq, void *dev_id, struct pt_regs *regs); void ide_geninit (struct gendisk *gd); -void do_ide0_request (void); +void do_ide0_request (request_queue_t * q); #if MAX_HWIFS > 1 -void do_ide1_request (void); +void do_ide1_request (request_queue_t * q); #endif #if MAX_HWIFS > 2 -void do_ide2_request (void); +void do_ide2_request (request_queue_t * q); #endif #if MAX_HWIFS > 3 -void do_ide3_request (void); +void do_ide3_request (request_queue_t * q); #endif #if MAX_HWIFS > 4 -void do_ide4_request (void); +void do_ide4_request (request_queue_t * q); #endif #if MAX_HWIFS > 5 -void do_ide5_request (void); +void do_ide5_request (request_queue_t * q); #endif #if MAX_HWIFS > 6 -void do_ide6_request (void); +void do_ide6_request (request_queue_t * q); #endif #if MAX_HWIFS > 7 -void do_ide7_request (void); +void do_ide7_request (request_queue_t * q); #endif #if MAX_HWIFS > 8 -void do_ide8_request (void); +void do_ide8_request (request_queue_t * q); #endif #if MAX_HWIFS > 9 -void do_ide9_request (void); +void do_ide9_request (request_queue_t * q); #endif void ide_init_subdrivers (void); @@ -812,6 +828,7 @@ int ide_replace_subdriver(ide_drive_t *drive, const char *driver); #else /* CONFIG_BLK_DEV_OFFBOARD */ # define OFF_BOARD NEVER_BOARD #endif /* CONFIG_BLK_DEV_OFFBOARD */ + unsigned long ide_find_free_region (unsigned short size) __init; void ide_scan_pcibus (void) __init; #endif @@ -819,7 +836,7 @@ void ide_scan_pcibus (void) __init; #define BAD_DMA_DRIVE 0 #define GOOD_DMA_DRIVE 1 int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func); -void ide_dma_intr (ide_drive_t *drive); +ide_startstop_t ide_dma_intr (ide_drive_t *drive); int check_drive_lists (ide_drive_t *drive, int good_bad); int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive); int ide_release_dma (ide_hwif_t *hwif); diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index 18873a97f..817449276 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h @@ -76,7 +76,7 @@ #define ARPHRD_FCPL 786 /* Fibrechannel public loop */ #define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */ /* 787->799 reserved for fibrechannel media types */ - +#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */ /* ARP protocol opcodes. */ #define ARPOP_REQUEST 1 /* ARP request */ diff --git a/include/linux/ioport.h b/include/linux/ioport.h index cf5f36775..6c5349546 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -83,7 +83,9 @@ extern int release_resource(struct resource *new); extern int allocate_resource(struct resource *root, struct resource *new, unsigned long size, unsigned long min, unsigned long max, - unsigned long align); + unsigned long align, + void (*alignf)(void *, struct resource *, unsigned long), + void *alignf_data); /* Convenience shorthand with allocation */ #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) diff --git a/include/linux/ipc.h b/include/linux/ipc.h index 56bcb9780..0aec0d93c 100644 --- a/include/linux/ipc.h +++ b/include/linux/ipc.h @@ -38,10 +38,6 @@ struct ipc_perm #ifdef __KERNEL__ -/* special shmsegs[id] values */ -#define IPC_UNUSED ((void *) -1) -#define IPC_NOID ((void *) -2) /* being allocated/destroyed */ - #define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ #endif /* __KERNEL__ */ diff --git a/include/linux/irq.h b/include/linux/irq.h index 4063fe743..f8a16d730 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -42,7 +42,7 @@ typedef struct { independent code */ struct irqaction *action; /* IRQ action list */ unsigned int depth; /* Disable depth for nested irq disables */ -} irq_desc_t; +} ____cacheline_aligned irq_desc_t; #include <asm/hw_irq.h> /* the arch dependent stuff */ @@ -52,27 +52,6 @@ extern int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); extern spinlock_t irq_controller_lock; extern int setup_irq(unsigned int , struct irqaction * ); -#ifdef __SMP__ - -#include <asm/atomic.h> - -static inline void irq_enter(int cpu, unsigned int irq) -{ - hardirq_enter(cpu); - while (test_bit(0,&global_irq_lock)) { - /* nothing */; - } -} - -static inline void irq_exit(int cpu, unsigned int irq) -{ - hardirq_exit(cpu); -} -#else -#define irq_enter(cpu, irq) (++local_irq_count[cpu]) -#define irq_exit(cpu, irq) (--local_irq_count[cpu]) -#endif - extern hw_irq_controller no_irq_type; /* needed in every arch ? */ #endif /* __asm_h */ diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h index e5b426d07..1ec294a3b 100644 --- a/include/linux/isapnp.h +++ b/include/linux/isapnp.h @@ -23,6 +23,7 @@ #define LINUX_ISAPNP_H #include <linux/config.h> +#include <linux/errno.h> /* * Configuration registers (TODO: change by specification) diff --git a/include/linux/iso_fs.h b/include/linux/iso_fs.h index e5b3a3d7b..80a8b27f4 100644 --- a/include/linux/iso_fs.h +++ b/include/linux/iso_fs.h @@ -178,7 +178,7 @@ extern int iso_date(char *, int); extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *); extern int get_rock_ridge_filename(struct iso_directory_record *, char *, struct inode *); -extern char * get_rock_ridge_symlink(struct inode *); +extern int rock_ridge_symlink_readpage(struct dentry *, struct page *); extern int find_rock_ridge_relocation(struct iso_directory_record *, struct inode *); int get_joliet_filename(struct iso_directory_record *, struct inode *, unsigned char *); diff --git a/include/linux/joystick.h b/include/linux/joystick.h index 0aa715cb3..b5b39d0f5 100644 --- a/include/linux/joystick.h +++ b/include/linux/joystick.h @@ -4,7 +4,9 @@ /* * /usr/include/linux/joystick.h Version 1.2 * - * Copyright (C) 1996-1998 Vojtech Pavlik + * Copyright (C) 1996-1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* @@ -34,7 +36,7 @@ * Version */ -#define JS_VERSION 0x01020d +#define JS_VERSION 0x01020f /* * Types and constants for reading from /dev/js @@ -128,64 +130,61 @@ struct JS_DATA_SAVE_TYPE { #include <linux/version.h> -#ifndef KERNEL_VERSION -#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -#endif - -#ifndef LINUX_VERSION_CODE -#error "You need to use at least 2.0 Linux kernel." +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) +#error "You need to use at least v2.2 Linux kernel." #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,0,0) -#error "You need to use at least 2.0 Linux kernel." -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) -#define JS_HAS_RDTSC (current_cpu_data.x86_capability & 0x10) -#include <linux/init.h> -#else -#ifdef MODULE -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,35) -#define JS_HAS_RDTSC (x86_capability & 0x10) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) +#include <asm/spinlock.h> +typedef struct wait_queue *wait_queue_head_t; +#define __setup(a,b) +#define BASE_ADDRESS(x,i) ((x)->base_address[i]) +#define DECLARE_WAITQUEUE(x,y) struct wait_queue x = { y, NULL } +#define init_waitqueue_head(x) do { *(x) = NULL; } while (0) +#define __set_current_state(x) current->state = x +#define SETUP_PARAM char *str, int *ints +#define SETUP_PARSE(x) do {} while (0) #else -#define JS_HAS_RDTSC 0 -#endif -#else -#define JS_HAS_RDTSC (x86_capability & 0x10) -#endif -#define __initdata -#define __init -#define __cli cli -#define __save_flags(flags) save_flags(flags) -#define __restore_flags(flags) restore_flags(flags) -#define spin_lock_irqsave(x, flags) do { save_flags(flags); cli(); } while (0) -#define spin_unlock_irqrestore(x, flags) restore_flags(flags) -#define spin_lock_init(x) do { } while (0) -typedef struct { int something; } spinlock_t; -#define SPIN_LOCK_UNLOCKED { 0 } -#define MODULE_AUTHOR(x) -#define MODULE_PARM(x,y) -#define MODULE_SUPPORTED_DEVICE(x) -#define signal_pending(x) (((x)->signal) & ~((x)->blocked)) +#include <linux/spinlock.h> +#define BASE_ADDRESS(x,i) ((x)->resource[i].start) +#define SETUP_PARAM char *str +#define SETUP_PARSE(x) int ints[x]; get_options(str, x, ints) #endif +#define PCI_VENDOR_ID_AUREAL 0x12eb + /* * Parport stuff */ -#define USE_PARPORT - #include <linux/parport.h> -#include <linux/parport_pc.h> + +#define JS_PAR_STATUS_INVERT (0x80) +#define JS_PAR_CTRL_INVERT (0x04) #define JS_PAR_DATA_IN(y) parport_read_data(y->port) #define JS_PAR_DATA_OUT(x,y) parport_write_data(y->port, x) #define JS_PAR_STATUS(y) parport_read_status(y->port) + +#ifndef PARPORT_NEED_GENERIC_OPS #define JS_PAR_CTRL_IN(y) parport_read_control(y->port) -#define JS_PAR_CTRL_OUT(x,y) parport_write_control(y->port, x) -#define JS_PAR_ECTRL_OUT(x,y) outb(x, ECONTROL(y->port)) +#else +#define JS_PAR_CTRL_IN(y) inb(y->port->base+2) +#endif -#define JS_PAR_STATUS_INVERT (0x80) -#define JS_PAR_CTRL_INVERT (0x04) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) +#define JS_PAR_CTRL_OUT(x,y) parport_write_control(y->port, x) +#define JS_PAR_ECTRL_OUT(x,y) parport_write_econtrol(y->port, x) +#else +#define JS_PAR_CTRL_OUT(x,y) \ + do { \ + if ((x) & 0x20) parport_data_reverse(y->port); \ + else parport_data_forward(y->port); \ + parport_write_control(y->port, (x) & ~0x20); \ + } while (0) +#define JS_PAR_ECTRL_OUT(x,y) /*parport sets PS/2 mode on ECR chips */ +#define PARPORT_MODE_PCPS2 PARPORT_MODE_TRISTATE +#define PARPORT_MODE_PCECPPS2 PARPORT_MODE_TRISTATE +#endif /* * Internal types @@ -194,8 +193,6 @@ typedef struct { int something; } spinlock_t; struct js_dev; typedef int (*js_read_func)(void *info, int **axes, int **buttons); -typedef unsigned int (*js_time_func)(void); -typedef int (*js_delta_func)(unsigned int x, unsigned int y); typedef int (*js_ops_func)(struct js_dev *dev); struct js_data { @@ -239,20 +236,14 @@ struct js_port { struct js_corr **corr; void *info; int ndevs; + int fail; + int total; }; /* * Sub-module interface */ -extern unsigned int js_time_speed; -extern js_time_func js_get_time; -extern js_delta_func js_delta; - -extern unsigned int js_time_speed_a; -extern js_time_func js_get_time_a; -extern js_delta_func js_delta_a; - extern struct js_port *js_register_port(struct js_port *port, void *info, int devs, int infos, js_read_func read); extern struct js_port *js_unregister_port(struct js_port *port); @@ -270,19 +261,19 @@ extern int js_am_init(void); extern int js_an_init(void); extern int js_as_init(void); extern int js_console_init(void); +extern int js_cr_init(void); extern int js_db9_init(void); extern int js_gr_init(void); extern int js_l4_init(void); extern int js_lt_init(void); +extern int js_mag_init(void); +extern int js_pci_init(void); extern int js_sw_init(void); +extern int js_sball_init(void); +extern int js_orb_init(void); extern int js_tm_init(void); - -extern void js_am_setup(char *str, int *ints); -extern void js_an_setup(char *str, int *ints); -extern void js_as_setup(char *str, int *ints); -extern void js_console_setup(char *str, int *ints); -extern void js_db9_setup(char *str, int *ints); -extern void js_l4_setup(char *str, int *ints); +extern int js_tg_init(void); +extern int js_war_init(void); #endif /* __KERNEL__ */ diff --git a/include/linux/mm.h b/include/linux/mm.h index b53688676..a9d66b90b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -9,6 +9,7 @@ #include <linux/config.h> #include <linux/string.h> #include <linux/list.h> +#include <linux/mmzone.h> extern unsigned long max_mapnr; extern unsigned long num_physpages; @@ -16,6 +17,7 @@ extern void * high_memory; extern int page_cluster; #include <asm/page.h> +#include <asm/pgtable.h> #include <asm/atomic.h> /* @@ -127,7 +129,6 @@ typedef struct { * is used for linear searches (eg. clock algorithm scans). */ typedef struct page { - /* these must be first (free area handling) */ struct list_head list; struct address_space *mapping; unsigned long index; @@ -139,6 +140,7 @@ typedef struct page { struct page **pprev_hash; struct buffer_head * buffers; unsigned long virtual; /* nonzero if kmapped */ + struct zone_struct *zone; } mem_map_t; #define get_page(p) atomic_inc(&(p)->count) @@ -152,8 +154,10 @@ typedef struct page { #define PG_error 1 #define PG_referenced 2 #define PG_uptodate 3 +#define PG__unused_00 4 #define PG_decr_after 5 -#define PG_DMA 7 +#define PG_unused_01 6 +#define PG__unused_02 7 #define PG_slab 8 #define PG_swap_cache 9 #define PG_skip 10 @@ -179,7 +183,7 @@ typedef struct page { #define ClearPageError(page) clear_bit(PG_error, &(page)->flags) #define PageReferenced(page) test_bit(PG_referenced, &(page)->flags) #define PageDecrAfter(page) test_bit(PG_decr_after, &(page)->flags) -#define PageDMA(page) test_bit(PG_DMA, &(page)->flags) +#define PageDMA(page) (contig_page_data.node_zones + ZONE_DMA == (page)->zone) #define PageSlab(page) test_bit(PG_slab, &(page)->flags) #define PageSwapCache(page) test_bit(PG_swap_cache, &(page)->flags) #define PageReserved(page) test_bit(PG_reserved, &(page)->flags) @@ -216,8 +220,8 @@ typedef struct page { * PG_reserved is set for a page which must never be accessed (which * may not even be present). * - * PG_DMA is set for those pages which lie in the range of - * physical addresses capable of carrying DMA transfers. + * PG_DMA has been removed, page->zone now tells exactly wether the + * page is suited to do DMAing into. * * Multiple processes may "see" the same page. E.g. for untouched * mappings of /dev/null, all processes see the same page full of @@ -283,19 +287,49 @@ typedef struct page { extern mem_map_t * mem_map; /* - * This is timing-critical - most of the time in getting a new page - * goes to clearing the page. If you want a page without the clearing - * overhead, just use __get_free_page() directly.. - * - * We have two allocation namespaces - the *get*page*() variants - * return virtual kernel addresses to the allocated page(s), the - * alloc_page*() variants return 'struct page *'. + * There is only one page-allocator function, and two main namespaces to + * it. The alloc_page*() variants return 'struct page *' and as such + * can allocate highmem pages, the *get*page*() variants return + * virtual kernel addresses to the allocated page(s). */ -#define __get_free_page(gfp_mask) __get_free_pages((gfp_mask),0) -#define __get_dma_pages(gfp_mask, order) __get_free_pages((gfp_mask) | GFP_DMA,(order)) -extern unsigned long FASTCALL(__get_free_pages(int gfp_mask, unsigned long order)); -extern struct page * FASTCALL(alloc_pages(int gfp_mask, unsigned long order)); -#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) +extern struct page * FASTCALL(__alloc_pages(zonelist_t *zonelist, unsigned long order)); +extern struct page * alloc_pages_node(int nid, int gfp_mask, unsigned long order); + +#ifndef CONFIG_DISCONTIGMEM +extern inline struct page * alloc_pages(int gfp_mask, unsigned long order) +{ + /* temporary check. */ + if (contig_page_data.node_zonelists[gfp_mask].gfp_mask != (gfp_mask)) + BUG(); + /* + * Gets optimized away by the compiler. + */ + if (order >= MAX_ORDER) + return NULL; + return __alloc_pages(contig_page_data.node_zonelists+(gfp_mask), order); +} +#else /* !CONFIG_DISCONTIGMEM */ +extern struct page * alloc_pages(int gfp_mask, unsigned long order); +#endif /* !CONFIG_DISCONTIGMEM */ + +#define alloc_page(gfp_mask) \ + alloc_pages(gfp_mask, 0) + +extern inline unsigned long __get_free_pages (int gfp_mask, unsigned long order) +{ + struct page * page; + + page = alloc_pages(gfp_mask, order); + if (!page) + return 0; + return page_address(page); +} + +#define __get_free_page(gfp_mask) \ + __get_free_pages((gfp_mask),0) + +#define __get_dma_pages(gfp_mask, order) \ + __get_free_pages((gfp_mask) | GFP_DMA,(order)) extern inline unsigned long get_zeroed_page(int gfp_mask) { @@ -312,13 +346,36 @@ extern inline unsigned long get_zeroed_page(int gfp_mask) */ #define get_free_page get_zeroed_page -/* memory.c & swap.c*/ +/* + * There is only one 'core' page-freeing function. + */ +extern void FASTCALL(__free_pages_ok(struct page * page, unsigned long order)); + +extern inline void __free_pages(struct page *page, unsigned long order) +{ + if (!put_page_testzero(page)) + return; + __free_pages_ok(page, order); +} + +#define __free_page(page) __free_pages(page, 0) + +extern inline void free_pages(unsigned long addr, unsigned long order) +{ + unsigned long map_nr; + +#ifdef CONFIG_DISCONTIGMEM + if (addr == 0) return; +#endif + map_nr = MAP_NR(addr); + if (map_nr < max_mapnr) + __free_pages(mem_map + map_nr, order); +} #define free_page(addr) free_pages((addr),0) -extern int FASTCALL(free_pages(unsigned long addr, unsigned long order)); -extern int FASTCALL(__free_page(struct page *)); extern void show_free_areas(void); +extern void show_free_areas_node(int nid); extern struct page * put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long address); @@ -329,7 +386,7 @@ extern int copy_page_range(struct mm_struct *dst, struct mm_struct *src, struct extern int remap_page_range(unsigned long from, unsigned long to, unsigned long size, pgprot_t prot); extern int zeromap_page_range(unsigned long from, unsigned long size, pgprot_t prot); extern int vmap_page_range (unsigned long from, unsigned long size, unsigned long vaddr); -extern void vmtruncate(struct inode * inode, unsigned long offset); +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 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); @@ -341,6 +398,8 @@ extern int check_pgt_cache(void); extern void paging_init(void); extern void free_area_init(unsigned int * zones_size); +extern void free_area_init_node(int nid, pg_data_t *pgdat, + unsigned int * zones_size, unsigned long zone_start_paddr); extern void mem_init(void); extern void show_mem(void); extern void oom(struct task_struct * tsk); @@ -355,8 +414,23 @@ extern void build_mmap_avl(struct mm_struct *); extern void exit_mmap(struct mm_struct *); extern unsigned long get_unmapped_area(unsigned long, unsigned long); -extern unsigned long do_mmap(struct file *, unsigned long, unsigned long, - unsigned long, unsigned long, unsigned long); +extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, + unsigned long len, unsigned long prot, + unsigned long flag, unsigned long pgoff); + +extern inline unsigned long do_mmap(struct file *file, unsigned long addr, + unsigned long len, unsigned long prot, + unsigned long flag, unsigned long offset) +{ + unsigned long ret = -EINVAL; + if ((offset + PAGE_ALIGN(len)) < offset) + goto out; + if (!(offset & ~PAGE_MASK)) + ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT); +out: + return ret; +} + extern int do_munmap(unsigned long, size_t); extern unsigned long do_brk(unsigned long, unsigned long); @@ -364,8 +438,7 @@ extern unsigned long do_brk(unsigned long, unsigned long); extern void remove_inode_page(struct page *); extern unsigned long page_unuse(struct page *); extern int shrink_mmap(int, int); -extern void truncate_inode_pages(struct inode *, unsigned long); -extern void put_cached_page(unsigned long); +extern void truncate_inode_pages(struct inode *, loff_t); /* * GFP bitmasks.. @@ -407,7 +480,7 @@ extern void put_cached_page(unsigned long); #define GFP_DMA __GFP_DMA /* Flag - indicates that the buffer can be taken from high memory which is not - directly addressable by the kernel */ + permanently mapped by the kernel */ #define GFP_HIGHMEM __GFP_HIGHMEM @@ -456,7 +529,6 @@ extern struct vm_area_struct *find_extend_vma(struct task_struct *tsk, unsigned #define vmlist_modify_lock(mm) vmlist_access_lock(mm) #define vmlist_modify_unlock(mm) vmlist_access_unlock(mm) - #endif /* __KERNEL__ */ #endif diff --git a/include/linux/mman.h b/include/linux/mman.h index 3bc0430bc..73d4c2ade 100644 --- a/include/linux/mman.h +++ b/include/linux/mman.h @@ -4,5 +4,6 @@ #include <asm/mman.h> #define MREMAP_MAYMOVE 1 +#define MREMAP_FIXED 2 #endif /* _LINUX_MMAN_H */ diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h new file mode 100644 index 000000000..79c206282 --- /dev/null +++ b/include/linux/mmzone.h @@ -0,0 +1,115 @@ +#ifndef _LINUX_MMZONE_H +#define _LINUX_MMZONE_H + +#ifdef __KERNEL__ +#ifndef __ASSEMBLY__ + +#include <linux/config.h> +#include <linux/spinlock.h> +#include <linux/list.h> + +/* + * Free memory management - zoned buddy allocator. + */ + +#if CONFIG_AP1000 +/* the AP+ needs to allocate 8MB contiguous, aligned chunks of ram + for the ring buffers */ +#define MAX_ORDER 12 +#else +#define MAX_ORDER 10 +#endif + +typedef struct free_area_struct { + struct list_head free_list; + unsigned int * map; +} free_area_t; + +typedef struct zone_struct { + /* + * Commonly accessed fields: + */ + spinlock_t lock; + unsigned long offset; + unsigned long free_pages; + int low_on_memory; + unsigned long pages_low, pages_high; + + /* + * free areas of different sizes + */ + free_area_t free_area[MAX_ORDER]; + + /* + * rarely used fields: + */ + char * name; + unsigned long size; +} zone_t; + +#define ZONE_DMA 0 +#define ZONE_NORMAL 1 +#define ZONE_HIGHMEM 2 +#define MAX_NR_ZONES 3 + +/* + * One allocation request operates on a zonelist. A zonelist + * is a list of zones, the first one is the 'goal' of the + * allocation, the other zones are fallback zones, in decreasing + * priority. + * + * Right now a zonelist takes up less than a cacheline. We never + * modify it apart from boot-up, and only a few indices are used, + * so despite the zonelist table being relatively big, the cache + * footprint of this construct is very small. + */ +typedef struct zonelist_struct { + zone_t * zones [MAX_NR_ZONES+1]; // NULL delimited + int gfp_mask; +} zonelist_t; + +#define NR_GFPINDEX 0x100 + +struct bootmem_data; +typedef struct pglist_data { + zone_t node_zones[MAX_NR_ZONES]; + zonelist_t node_zonelists[NR_GFPINDEX]; + struct page *node_mem_map; + unsigned long *valid_addr_bitmap; + struct bootmem_data *bdata; +} pg_data_t; + +extern int numnodes; + +#ifndef CONFIG_DISCONTIGMEM + +extern pg_data_t contig_page_data; + +#define NODE_DATA(nid) (&contig_page_data) +#define NODE_MEM_MAP(nid) mem_map + +#else /* !CONFIG_DISCONTIGMEM */ + +#include <asm/mmzone.h> + +#endif /* !CONFIG_DISCONTIGMEM */ + +#define MAP_ALIGN(x) ((((x) % sizeof(mem_map_t)) == 0) ? (x) : ((x) + \ + sizeof(mem_map_t) - ((x) % sizeof(mem_map_t)))) + +#ifdef CONFIG_DISCONTIGMEM + +#define LOCAL_MAP_NR(kvaddr) \ + (((unsigned long)(kvaddr)-LOCAL_BASE_ADDR((kvaddr))) >> PAGE_SHIFT) +#define MAP_NR(kaddr) (LOCAL_MAP_NR((kaddr)) + \ + (((unsigned long)ADDR_TO_MAPBASE((kaddr)) - PAGE_OFFSET) / \ + sizeof(mem_map_t))) +#define kern_addr_valid(addr) ((KVADDR_TO_NID((unsigned long)addr) >= \ + numnodes) ? 0 : (test_bit(LOCAL_MAP_NR((addr)), \ + NODE_DATA(KVADDR_TO_NID((unsigned long)addr))->valid_addr_bitmap))) + +#endif /* CONFIG_DISCONTIGMEM */ + +#endif /* !__ASSEMBLY__ */ +#endif /* __KERNEL__ */ +#endif /* _LINUX_MMZONE_H */ diff --git a/include/linux/module.h b/include/linux/module.h index a0fc64c88..ce2d3aa98 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -102,6 +102,7 @@ struct module_info #define MOD_VISITED 8 #define MOD_USED_ONCE 16 #define MOD_JUST_FREED 32 +#define MOD_INITIALIZING 64 /* Values for query_module's which. */ @@ -111,6 +112,9 @@ struct module_info #define QM_SYMBOLS 4 #define QM_INFO 5 +/* Can the module be queried? */ +#define MOD_CAN_QUERY(mod) (((mod)->flags & (MOD_RUNNING | MOD_INITIALIZING)) && !((mod)->flags & MOD_DELETED)) + /* When struct module is extended, we must test whether the new member is present in the header received from insmod before we can use it. This function returns true if the member is present. */ diff --git a/include/linux/mount.h b/include/linux/mount.h index 423119f09..86dc89c47 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h @@ -17,11 +17,12 @@ struct quota_mount_options { unsigned int flags; /* Flags for diskquotas on this device */ - struct semaphore semaphore; /* lock device while I/O in progress */ + struct semaphore dqio_sem; /* lock device while I/O in progress */ + struct semaphore dqoff_sem; /* serialize quota_off() and quota_on() on device */ struct file *files[MAXQUOTAS]; /* fp's to quotafiles */ time_t inode_expire[MAXQUOTAS]; /* expiretime for inode-quota */ time_t block_expire[MAXQUOTAS]; /* expiretime for block-quota */ - char rsquash[MAXQUOTAS]; /* for quotas treat root as any other user */ + char rsquash[MAXQUOTAS]; /* for quotas threat root as any other user */ }; struct vfsmount diff --git a/include/linux/msg.h b/include/linux/msg.h index b3284bfa1..38d10dd72 100644 --- a/include/linux/msg.h +++ b/include/linux/msg.h @@ -45,7 +45,7 @@ struct msginfo { unsigned short msgseg; }; -#define MSGMNI 128 /* <= IPCMNI */ /* max # of msg queue identifiers */ +#define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */ #define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */ #define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */ diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h index 11acbd7b7..0ce8596ed 100644 --- a/include/linux/ncp_fs.h +++ b/include/linux/ncp_fs.h @@ -213,7 +213,7 @@ static inline void ncp_kfree_s(void *obj, int size) #endif /* DEBUG_NCP_MALLOC */ /* linux/fs/ncpfs/inode.c */ -int ncp_notify_change(struct dentry *, struct iattr *attr); +int ncp_notify_change(struct dentry *, struct iattr *); struct super_block *ncp_read_super(struct super_block *, void *, int); struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); void ncp_update_inode(struct inode *, struct ncp_entry_info *); @@ -250,54 +250,24 @@ int ncp_mmap(struct file *, struct vm_area_struct *); /* linux/fs/ncpfs/ncplib_kernel.c */ int ncp_make_closed(struct inode *); -static inline void str_upper(char *name) -{ - while (*name) { - if (*name >= 'a' && *name <= 'z') { - *name -= ('a' - 'A'); - } - name++; - } -} - -static inline void str_lower(char *name) -{ - while (*name) { - if (*name >= 'A' && *name <= 'Z') { - *name += ('a' - 'A'); - } - name++; - } -} +#define ncp_namespace(i) (NCP_SERVER(i)->name_space[NCP_FINFO(i)->volNumber]) -static inline int ncp_namespace(struct inode *inode) +static inline int ncp_preserve_entry_case(struct inode *i, __u32 nscreator) { - struct ncp_server *server = NCP_SERVER(inode); - return server->name_space[NCP_FINFO(inode)->volNumber]; -} - -static inline int ncp_preserve_entry_case(struct inode *i, __u32 nscreator) { -#if defined(CONFIG_NCPFS_NFS_NS) || defined(CONFIG_NCPFS_OS2_NS) +#ifdef CONFIG_NCPFS_SMALLDOS int ns = ncp_namespace(i); -#endif -#if defined(CONFIG_NCPFS_SMALLDOS) && defined(CONFIG_NCPFS_OS2_NS) - if ((ns == NW_NS_OS2) && (nscreator == NW_NS_DOS)) - return 0; -#endif - return + + if ((ns == NW_NS_DOS) #ifdef CONFIG_NCPFS_OS2_NS - (ns == NW_NS_OS2) || -#endif /* CONFIG_NCPFS_OS2_NS */ -#ifdef CONFIG_NCPFS_NFS_NS - (ns == NW_NS_NFS) || -#endif /* CONFIG_NCPFS_NFS_NS */ - 0; + || ((ns == NW_NS_OS2) && (nscreator == NW_NS_DOS)) +#endif /* CONFIG_NCPFS_OS2_NS */ + ) + return 0; +#endif /* CONFIG_NCPFS_SMALLDOS */ + return 1; } -static inline int ncp_preserve_case(struct inode *i) -{ - return ncp_preserve_entry_case(i, NW_NS_OS2); -} +#define ncp_preserve_case(i) (ncp_namespace(i) != NW_NS_DOS) static inline int ncp_case_sensitive(struct inode *i) { diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h index 6f71f8e37..46f100eb4 100644 --- a/include/linux/ncp_fs_sb.h +++ b/include/linux/ncp_fs_sb.h @@ -52,23 +52,23 @@ struct ncp_server { int root_setuped; -/* info for packet signing */ - int sign_wanted; /* 1=Server needs signed packets */ - int sign_active; /* 0=don't do signing, 1=do */ + /* info for packet signing */ + int sign_wanted; /* 1=Server needs signed packets */ + int sign_active; /* 0=don't do signing, 1=do */ char sign_root[8]; /* generated from password and encr. key */ char sign_last[16]; /* Authentication info: NDS or BINDERY, username */ struct { - int auth_type; - size_t object_name_len; - void* object_name; - int object_type; + int auth_type; + size_t object_name_len; + void* object_name; + int object_type; } auth; /* Password info */ struct { - size_t len; - void* data; + size_t len; + void* data; } priv; /* nls info: codepage for volume and charset for I/O */ @@ -77,10 +77,18 @@ struct ncp_server { /* maximum age in jiffies */ int dentry_ttl; + + /* miscellaneous */ + unsigned int flags; }; #define ncp_sb_info ncp_server +#define NCP_FLAG_UTF8 1 + +#define NCP_CLR_FLAG(server, flag) ((server)->flags &= ~(flag)) +#define NCP_SET_FLAG(server, flag) ((server)->flags |= (flag)) +#define NCP_IS_FLAG(server, flag) ((server)->flags & (flag)) static inline int ncp_conn_valid(struct ncp_server *server) { diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 75d6f872d..59e67a859 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -391,7 +391,6 @@ extern __inline__ int unregister_gifconf(unsigned int family) #define HAVE_NETIF_RX 1 extern void netif_rx(struct sk_buff *skb); extern void net_bh(void); -extern int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy); extern int dev_ioctl(unsigned int cmd, void *); extern int dev_change_flags(struct net_device *, unsigned); extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); @@ -423,7 +422,6 @@ extern void ether_setup(struct net_device *dev); extern void fddi_setup(struct net_device *dev); extern void tr_setup(struct net_device *dev); extern void fc_setup(struct net_device *dev); -extern void tr_freedev(struct net_device *dev); extern void fc_freedev(struct net_device *dev); extern int ether_config(struct net_device *dev, struct ifmap *map); /* Support for loadable net-drivers */ diff --git a/include/linux/nfs.h b/include/linux/nfs.h index c188fc808..e476cdbf9 100644 --- a/include/linux/nfs.h +++ b/include/linux/nfs.h @@ -1,5 +1,8 @@ /* * NFS protocol definitions + * + * This file contains constants mostly for Version 2 of the protocol, + * but also has a couple of NFSv3 bits in (notably the error codes). */ #ifndef _LINUX_NFS_H #define _LINUX_NFS_H @@ -24,30 +27,50 @@ #define NFSMODE_FIFO 0010000 -enum nfs_stat { - NFS_OK = 0, - NFSERR_PERM = 1, - NFSERR_NOENT = 2, - NFSERR_IO = 5, - NFSERR_NXIO = 6, - NFSERR_EAGAIN = 11, - NFSERR_ACCES = 13, - NFSERR_EXIST = 17, - NFSERR_XDEV = 18, - NFSERR_NODEV = 19, - NFSERR_NOTDIR = 20, - NFSERR_ISDIR = 21, - NFSERR_INVAL = 22, /* that Sun forgot */ - NFSERR_FBIG = 27, - NFSERR_NOSPC = 28, - NFSERR_ROFS = 30, - NFSERR_OPNOTSUPP = 45, - NFSERR_NAMETOOLONG = 63, - NFSERR_NOTEMPTY = 66, - NFSERR_DQUOT = 69, - NFSERR_STALE = 70, - NFSERR_WFLUSH = 99 -}; +/* + * NFS stats. The good thing with these values is that NFSv3 errors are + * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which + * no-one uses anyway), so we can happily mix code as long as we make sure + * no NFSv3 errors are returned to NFSv2 clients. + * Error codes that have a `--' in the v2 column are not part of the + * standard, but seem to be widely used nevertheless. + */ + enum nfs_stat { + NFS_OK = 0, /* v2 v3 */ + NFSERR_PERM = 1, /* v2 v3 */ + NFSERR_NOENT = 2, /* v2 v3 */ + NFSERR_IO = 5, /* v2 v3 */ + NFSERR_NXIO = 6, /* v2 v3 */ + NFSERR_EAGAIN = 11, /* v2 v3 */ + NFSERR_ACCES = 13, /* v2 v3 */ + NFSERR_EXIST = 17, /* v2 v3 */ + NFSERR_XDEV = 18, /* v3 */ + NFSERR_NODEV = 19, /* v2 v3 */ + NFSERR_NOTDIR = 20, /* v2 v3 */ + NFSERR_ISDIR = 21, /* v2 v3 */ + NFSERR_INVAL = 22, /* v2 v3 that Sun forgot */ + NFSERR_FBIG = 27, /* v2 v3 */ + NFSERR_NOSPC = 28, /* v2 v3 */ + NFSERR_ROFS = 30, /* v2 v3 */ + NFSERR_MLINK = 31, /* v3 */ + NFSERR_OPNOTSUPP = 45, /* v2 v3 */ + NFSERR_NAMETOOLONG = 63, /* v2 v3 */ + NFSERR_NOTEMPTY = 66, /* v2 v3 */ + NFSERR_DQUOT = 69, /* v2 v3 */ + NFSERR_STALE = 70, /* v2 v3 */ + NFSERR_REMOTE = 71, /* v2 v3 */ + NFSERR_WFLUSH = 99, /* v2 */ + NFSERR_BADHANDLE = 10001, /* v3 */ + NFSERR_NOT_SYNC = 10002, /* v3 */ + NFSERR_BAD_COOKIE = 10003, /* v3 */ + NFSERR_NOTSUPP = 10004, /* v3 */ + NFSERR_TOOSMALL = 10005, /* v3 */ + NFSERR_SERVERFAULT = 10006, /* v3 */ + NFSERR_BADTYPE = 10007, /* v3 */ + NFSERR_JUKEBOX = 10008 /* v3 */ + }; + +/* NFSv2 file types - beware, these are not the same in NFSv3 */ enum nfs_ftype { NFNON = 0, @@ -93,7 +116,14 @@ struct nfs_fh { #define NFS_MNT_PORT 627 #define NFS_MNTPROC_MNT 1 #define NFS_MNTPROC_UMNT 3 -#endif + +/* + * This is really a general kernel constant, but since nothing like + * this is defined in the kernel headers, I have to do it here. + */ +#define NFS_OFFSET_MAX ((__s64)((~(__u64)0) >> 1)) + +#endif /* __KERNEL__ */ #if defined(__KERNEL__) || defined(NFS_NEED_KERNEL_TYPES) diff --git a/include/linux/nfs3.h b/include/linux/nfs3.h index 94ec44b6a..cf5405b35 100644 --- a/include/linux/nfs3.h +++ b/include/linux/nfs3.h @@ -12,7 +12,6 @@ #define NFS3_MAXPATHLEN PATH_MAX #define NFS3_MAXNAMLEN NAME_MAX #define NFS3_MAXGROUPS 16 -#define NFS3_FHSIZE NFS_FHSIZE #define NFS3_COOKIESIZE 4 #define NFS3_FIFO_DEV (-1) #define NFS3MODE_FMT 0170000 @@ -25,38 +24,28 @@ #define NFS3MODE_FIFO 0010000 -enum nfs3_stat { - NFS3_OK = 0, - NFS3ERR_PERM = 1, - NFS3ERR_NOENT = 2, - NFS3ERR_IO = 5, - NFS3ERR_NXIO = 6, - NFS3ERR_EAGAIN = 11, - NFS3ERR_ACCES = 13, - NFS3ERR_EXIST = 17, - NFS3ERR_XDEV = 18, /* new in NFSv3 */ - NFS3ERR_NODEV = 19, - NFS3ERR_NOTDIR = 20, - NFS3ERR_ISDIR = 21, - NFS3ERR_INVAL = 22, /* new in NFSv3 */ - NFS3ERR_FBIG = 27, - NFS3ERR_NOSPC = 28, - NFS3ERR_ROFS = 30, - NFS3ERR_MLINK = 31, /* new in NFSv3 */ - NFS3ERR_NAMETOOLONG = 63, - NFS3ERR_NOTEMPTY = 66, - NFS3ERR_DQUOT = 69, - NFS3ERR_STALE = 70, - NFS3ERR_REMOTE = 71, /* new in NFSv3 */ - NFS3ERR_BADHANDLE = 10001,/* ditto */ - NFS3ERR_NOT_SYNC = 10002,/* ditto */ - NFS3ERR_BAD_COOKIE = 10003,/* ditto */ - NFS3ERR_NOTSUPP = 10004,/* ditto */ - NFS3ERR_TOOSMALL = 10005,/* ditto */ - NFS3ERR_SERVERFAULT = 10006,/* ditto */ - NFS3ERR_BADTYPE = 10007,/* ditto */ - NFS3ERR_JUKEBOX = 10008,/* ditto */ -}; +/* Flags for access() call */ +#define NFS3_ACCESS_READ 0x0001 +#define NFS3_ACCESS_LOOKUP 0x0002 +#define NFS3_ACCESS_MODIFY 0x0004 +#define NFS3_ACCESS_EXTEND 0x0008 +#define NFS3_ACCESS_DELETE 0x0010 +#define NFS3_ACCESS_EXECUTE 0x0020 + +/* Flags for create mode */ +#define NFS3_CREATE_UNCHECKED 0 +#define NFS3_CREATE_GUARDED 1 +#define NFS3_CREATE_EXCLUSIVE 2 + +/* NFSv3 file system properties */ +#define NFS3_FSF_LINK 0x0001 +#define NFS3_FSF_SYMLINK 0x0002 +#define NFS3_FSF_HOMOGENEOUS 0x0008 +#define NFS3_FSF_CANSETTIME 0x0010 +/* Some shorthands. See fs/nfsd/nfs3proc.c */ +#define NFS3_FSF_DEFAULT 0x001B +#define NFS3_FSF_BILLYBOY 0x0018 +#define NFS3_FSF_READONLY 0x0008 enum nfs3_ftype { NF3NON = 0, @@ -92,10 +81,8 @@ enum nfs3_ftype { #if defined(__KERNEL__) || defined(NFS_NEED_KERNEL_TYPES) -struct nfs3_fh { - __u32 size; - __u8 data[NFS3_FHSIZE]; -}; +/* Number of 32bit words in post_op_attr */ +#define NFS3_POST_OP_ATTR_WORDS 22 struct nfs3_fattr { enum nfs3_ftype type; diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index df6b7c8df..f2a114a58 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -212,7 +212,7 @@ extern int nfs_lock(struct file *, int, struct file_lock *); /* * linux/fs/nfs/write.c */ -extern int nfs_writepage(struct file *, struct page *); +extern int nfs_writepage(struct dentry *, struct page *); extern int nfs_check_failed_request(struct inode *); /* @@ -233,7 +233,7 @@ extern int nfs_updatepage(struct file *, struct page *, unsigned long, unsigned /* * linux/fs/nfs/read.c */ -extern int nfs_readpage(struct file *, struct page *); +extern int nfs_readpage(struct dentry *, struct page *); /* * linux/fs/mount_clnt.c diff --git a/include/linux/nfsd/const.h b/include/linux/nfsd/const.h index 0727e1288..22c7ff1e8 100644 --- a/include/linux/nfsd/const.h +++ b/include/linux/nfsd/const.h @@ -1,19 +1,14 @@ /* - * include/linux/nfsd/nfsconst.h + * include/linux/nfsd/const.h * * Various constants related to NFS. * - * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de> + * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> */ -#ifndef __NFSCONST_H__ -#define __NFSCONST_H__ +#ifndef _LINUX_NFSD_CONST_H +#define _LINUX_NFSD_CONST_H -#include <linux/limits.h> -#include <linux/types.h> -#include <linux/unistd.h> -#include <linux/dirent.h> -#include <linux/fs.h> #include <linux/nfs.h> /* @@ -33,7 +28,7 @@ #define NFS3_MAXPATHLEN PATH_MAX #define NFS3_MAXNAMLEN NAME_MAX -#define NFS3_FHSIZE NFS_FHSIZE +#define NFS3_FHSIZE 64 #define NFS3_COOKIEVERFSIZE 8 #define NFS3_CREATEVERFSIZE 8 #define NFS3_WRITEVERFSIZE 8 @@ -44,43 +39,6 @@ # define NFS_SUPER_MAGIC 0x6969 #endif -/* - * NFS stats. The good thing with these values is that NFSv3 errors are - * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which - * no-one uses anyway), so we can happily mix code as long as we make sure - * no NFSv3 errors are returned to NFSv2 clients. - */ -#define NFS_OK 0 /* v2 v3 */ -#define NFSERR_PERM 1 /* v2 v3 */ -#define NFSERR_NOENT 2 /* v2 v3 */ -#define NFSERR_IO 5 /* v2 v3 */ -#define NFSERR_NXIO 6 /* v2 v3 */ -#define NFSERR_ACCES 13 /* v2 v3 */ -#define NFSERR_EXIST 17 /* v2 v3 */ -#define NFSERR_XDEV 18 /* v3 */ -#define NFSERR_NODEV 19 /* v2 v3 */ -#define NFSERR_NOTDIR 20 /* v2 v3 */ -#define NFSERR_ISDIR 21 /* v2 v3 */ -#define NFSERR_INVAL 22 /* v3 */ -#define NFSERR_FBIG 27 /* v2 v3 */ -#define NFSERR_NOSPC 28 /* v2 v3 */ -#define NFSERR_ROFS 30 /* v2 v3 */ -#define NFSERR_MLINK 31 /* v3 */ -#define NFSERR_NAMETOOLONG 63 /* v2 v3 */ -#define NFSERR_NOTEMPTY 66 /* v2 v3 */ -#define NFSERR_DQUOT 69 /* v2 v3 */ -#define NFSERR_STALE 70 /* v2 v3 */ -#define NFSERR_REMOTE 71 /* v3 */ -#define NFSERR_WFLUSH 99 /* v2 */ -#define NFSERR_BADHANDLE 10001 /* v3 */ -#define NFSERR_NOT_SYNC 10002 /* v3 */ -#define NFSERR_BAD_COOKIE 10003 /* v3 */ -#define NFSERR_NOTSUPP 10004 /* v3 */ -#define NFSERR_TOOSMALL 10005 /* v3 */ -#define NFSERR_SERVERFAULT 10006 /* v3 */ -#define NFSERR_BADTYPE 10007 /* v3 */ -#define NFSERR_JUKEBOX 10008 /* v3 */ - #endif /* __KERNEL__ */ -#endif /* __NFSCONST_H__ */ +#endif /* _LINUX_NFSD_CONST_H */ diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h index 1f3a61486..febb7c741 100644 --- a/include/linux/nfsd/export.h +++ b/include/linux/nfsd/export.h @@ -4,16 +4,17 @@ * Public declarations for NFS exports. The definitions for the * syscall interface are in nfsctl.h * - * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> + * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> */ #ifndef NFSD_EXPORT_H #define NFSD_EXPORT_H -#include <linux/types.h> -#include <linux/socket.h> -#include <linux/in.h> -#include <linux/fs.h> +#include <asm/types.h> +#ifdef __KERNEL__ +# include <linux/types.h> +# include <linux/in.h> +#endif /* * Important limits for the exports stuff. diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 4c32fe530..25b95ee44 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h @@ -4,12 +4,13 @@ * Hodge-podge collection of knfsd-related stuff. * I will sort this out later. * - * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de> + * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> */ #ifndef LINUX_NFSD_NFSD_H #define LINUX_NFSD_NFSD_H +#include <linux/config.h> #include <linux/types.h> #include <linux/unistd.h> #include <linux/dirent.h> @@ -24,7 +25,7 @@ /* * nfsd version */ -#define NFSD_VERSION "0.4" +#define NFSD_VERSION "0.5" #ifdef __KERNEL__ /* @@ -61,6 +62,9 @@ typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); * Procedure table for NFSv2 */ extern struct svc_procedure nfsd_procedures2[]; +#ifdef CONFIG_NFSD_V3 +extern struct svc_procedure nfsd_procedures3[]; +#endif /* CONFIG_NFSD_V3 */ extern struct svc_program nfsd_program; /* @@ -74,11 +78,20 @@ void nfsd_racache_init(void); void nfsd_racache_shutdown(void); int nfsd_lookup(struct svc_rqst *, struct svc_fh *, const char *, int, struct svc_fh *); +#ifdef CONFIG_NFSD_V3 +int nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *); +#endif /* CONFIG_NFSD_V3 */ int nfsd_setattr(struct svc_rqst *, struct svc_fh *, struct iattr *); int nfsd_create(struct svc_rqst *, struct svc_fh *, char *name, int len, struct iattr *attrs, int type, dev_t rdev, struct svc_fh *res); +#ifdef CONFIG_NFSD_V3 +int nfsd_create_v3(struct svc_rqst *, struct svc_fh *, + char *name, int len, struct iattr *attrs, + struct svc_fh *res, int createmode, + u32 *verifier); +#endif /* CONFIG_NFSD_V3 */ int nfsd_open(struct svc_rqst *, struct svc_fh *, int, int, struct file *); void nfsd_close(struct file *); @@ -90,7 +103,7 @@ int nfsd_readlink(struct svc_rqst *, struct svc_fh *, char *, int *); int nfsd_symlink(struct svc_rqst *, struct svc_fh *, char *name, int len, char *path, int plen, - struct svc_fh *res); + struct svc_fh *res, struct iattr *); int nfsd_link(struct svc_rqst *, struct svc_fh *, char *, int, struct svc_fh *); int nfsd_rename(struct svc_rqst *, @@ -104,9 +117,13 @@ int nfsd_truncate(struct svc_rqst *, struct svc_fh *, unsigned long size); int nfsd_readdir(struct svc_rqst *, struct svc_fh *, loff_t, encode_dent_fn, - u32 *buffer, int *countp); + u32 *buffer, int *countp, u32 *verf); int nfsd_statfs(struct svc_rqst *, struct svc_fh *, struct statfs *); +#ifdef CONFIG_NFSD_V3 +int nfsd_commit(struct svc_rqst *, struct svc_fh *, + off_t, unsigned long); +#endif /* CONFIG_NFSD_V3 */ int nfsd_notify_change(struct inode *, struct iattr *); int nfsd_permission(struct svc_export *, struct dentry *, int); @@ -146,6 +163,7 @@ extern u32 nfs_ok, nfserr_rofs, nfserr_mlink, nfserr_nametoolong, + nfserr_notempty, nfserr_dquot, nfserr_stale, nfserr_remote, diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h index ca34d85e3..ac73ca409 100644 --- a/include/linux/nfsd/nfsfh.h +++ b/include/linux/nfsd/nfsfh.h @@ -11,12 +11,16 @@ * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> */ -#ifndef NFSD_FH_H -#define NFSD_FH_H +#ifndef _LINUX_NFSD_FH_H +#define _LINUX_NFSD_FH_H -#include <linux/types.h> -#include <linux/string.h> -#include <linux/fs.h> +#include <asm/types.h> +#ifdef __KERNEL__ +# include <linux/config.h> +# include <linux/types.h> +# include <linux/string.h> +# include <linux/fs.h> +#endif #include <linux/nfsd/const.h> #include <linux/nfsd/debug.h> @@ -83,12 +87,33 @@ typedef struct svc_fh { struct knfs_fh fh_handle; /* FH data */ struct dentry * fh_dentry; /* validated dentry */ struct svc_export * fh_export; /* export pointer */ - size_t fh_pre_size; /* size before operation */ - time_t fh_pre_mtime; /* mtime before oper */ - time_t fh_pre_ctime; /* ctime before oper */ - unsigned long fh_post_version;/* inode version after oper */ +#ifdef CONFIG_NFSD_V3 + unsigned char fh_post_saved; /* post-op attrs saved */ + unsigned char fh_pre_saved; /* pre-op attrs saved */ +#endif /* CONFIG_NFSD_V3 */ unsigned char fh_locked; /* inode locked by us */ unsigned char fh_dverified; /* dentry has been checked */ + +#ifdef CONFIG_NFSD_V3 + /* Pre-op attributes saved during fh_lock */ + __u64 fh_pre_size; /* size before operation */ + time_t fh_pre_mtime; /* mtime before oper */ + time_t fh_pre_ctime; /* ctime before oper */ + + /* Post-op attributes saved in fh_unlock */ + umode_t fh_post_mode; /* i_mode */ + nlink_t fh_post_nlink; /* i_nlink */ + uid_t fh_post_uid; /* i_uid */ + gid_t fh_post_gid; /* i_gid */ + __u64 fh_post_size; /* i_size */ + unsigned long fh_post_blocks; /* i_blocks */ + unsigned long fh_post_blksize;/* i_blksize */ + kdev_t fh_post_rdev; /* i_rdev */ + time_t fh_post_atime; /* i_atime */ + time_t fh_post_mtime; /* i_mtime */ + time_t fh_post_ctime; /* i_ctime */ +#endif /* CONFIG_NFSD_V3 */ + } svc_fh; /* @@ -129,6 +154,53 @@ fh_init(struct svc_fh *fhp) return fhp; } +#ifdef CONFIG_NFSD_V3 +/* + * Fill in the pre_op attr for the wcc data + */ +static inline void +fill_pre_wcc(struct svc_fh *fhp) +{ + struct inode *inode; + + inode = fhp->fh_dentry->d_inode; + if (!fhp->fh_pre_saved) { + fhp->fh_pre_mtime = inode->i_mtime; + fhp->fh_pre_ctime = inode->i_ctime; + fhp->fh_pre_size = inode->i_size; + fhp->fh_pre_saved = 1; + } + fhp->fh_locked = 1; +} + +/* + * Fill in the post_op attr for the wcc data + */ +static inline void +fill_post_wcc(struct svc_fh *fhp) +{ + struct inode *inode = fhp->fh_dentry->d_inode; + + if (fhp->fh_post_saved) + printk("nfsd: inode locked twice during operation.\n"); + + fhp->fh_post_mode = inode->i_mode; + fhp->fh_post_nlink = inode->i_nlink; + fhp->fh_post_uid = inode->i_uid; + fhp->fh_post_gid = inode->i_gid; + fhp->fh_post_size = inode->i_size; + fhp->fh_post_blksize = inode->i_blksize; + fhp->fh_post_blocks = inode->i_blocks; + fhp->fh_post_rdev = inode->i_rdev; + fhp->fh_post_atime = inode->i_atime; + fhp->fh_post_mtime = inode->i_mtime; + fhp->fh_post_ctime = inode->i_ctime; + fhp->fh_post_saved = 1; + fhp->fh_locked = 0; +} +#endif /* CONFIG_NFSD_V3 */ + + /* * Lock a file handle/inode */ @@ -138,10 +210,9 @@ fh_lock(struct svc_fh *fhp) struct dentry *dentry = fhp->fh_dentry; struct inode *inode; - /* dfprintk(FILEOP, "nfsd: fh_lock(%x/%ld) locked = %d\n", - SVCFH_DEV(fhp), SVCFH_INO(fhp), fhp->fh_locked); - */ + SVCFH_DEV(fhp), (long)SVCFH_INO(fhp), fhp->fh_locked); + if (!fhp->fh_dverified) { printk(KERN_ERR "fh_lock: fh not verified!\n"); return; @@ -154,9 +225,11 @@ fh_lock(struct svc_fh *fhp) inode = dentry->d_inode; down(&inode->i_sem); - if (!fhp->fh_pre_mtime) - fhp->fh_pre_mtime = inode->i_mtime; +#ifdef CONFIG_NFSD_V3 + fill_pre_wcc(fhp); +#else fhp->fh_locked = 1; +#endif /* CONFIG_NFSD_V3 */ } /* @@ -169,44 +242,19 @@ fh_unlock(struct svc_fh *fhp) printk(KERN_ERR "fh_unlock: fh not verified!\n"); if (fhp->fh_locked) { +#ifdef CONFIG_NFSD_V3 + fill_post_wcc(fhp); + up(&fhp->fh_dentry->d_inode->i_sem); +#else struct dentry *dentry = fhp->fh_dentry; struct inode *inode = dentry->d_inode; - if (!fhp->fh_post_version) - fhp->fh_post_version = inode->i_version; fhp->fh_locked = 0; up(&inode->i_sem); +#endif /* CONFIG_NFSD_V3 */ } } - -/* - * Release an inode - */ -#if 0 -#define fh_put(fhp) __fh_put(fhp, __FILE__, __LINE__) - -static inline void -__fh_put(struct svc_fh *fhp, char *file, int line) -{ - struct dentry *dentry; - - if (!fhp->fh_dverified) - return; - - dentry = fhp->fh_dentry; - if (!dentry->d_count) { - printk("nfsd: trying to free free dentry in %s:%d\n" - " file %s/%s\n", - file, line, - dentry->d_parent->d_name.name, dentry->d_name.name); - } else { - fh_unlock(fhp); - fhp->fh_dverified = 0; - dput(dentry); - } -} -#endif - #endif /* __KERNEL__ */ -#endif /* NFSD_FH_H */ + +#endif /* _LINUX_NFSD_FH_H */ diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h index 4ce3f06cd..4169a1e21 100644 --- a/include/linux/nfsd/stats.h +++ b/include/linux/nfsd/stats.h @@ -13,11 +13,11 @@ struct nfsd_stats { unsigned int rchits; /* repcache hits */ unsigned int rcmisses; /* repcache hits */ unsigned int rcnocache; /* uncached reqs */ - unsigned int fh_cached; /* dentry cached */ - unsigned int fh_valid; /* dentry validated */ - unsigned int fh_fixup; /* dentry fixup validated */ - unsigned int fh_lookup; /* new lookup required */ unsigned int fh_stale; /* FH stale error */ + unsigned int fh_lookup; /* dentry cached */ + unsigned int fh_anon; /* anon file dentry returned */ + unsigned int fh_nocache_dir; /* filehandle not foudn in dcache */ + unsigned int fh_nocache_nondir; /* filehandle not foudn in dcache */ }; #ifdef __KERNEL__ diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h index 019d33f76..1d42ec550 100644 --- a/include/linux/nfsd/syscall.h +++ b/include/linux/nfsd/syscall.h @@ -3,15 +3,18 @@ * * This file holds all declarations for the knfsd syscall interface. * - * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de> + * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> */ #ifndef NFSD_SYSCALL_H #define NFSD_SYSCALL_H -#include <linux/config.h> -#include <linux/types.h> -#include <linux/socket.h> +#include <asm/types.h> +#ifdef __KERNEL__ +# include <linux/config.h> +# include <linux/types.h> +# include <linux/in.h> +#endif #include <linux/posix_types.h> #include <linux/nfsd/const.h> #include <linux/nfsd/export.h> diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h index 54e11c549..7b787bb93 100644 --- a/include/linux/nfsd/xdr3.h +++ b/include/linux/nfsd/xdr3.h @@ -3,17 +3,18 @@ * * XDR types for NFSv3 in nfsd. * - * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> + * Copyright (C) 1996-1998, Olaf Kirch <okir@monad.swb.de> */ -#ifndef LINUX_NFSD_XDR3_H -#define LINUX_NFSD_XDR3_H +#ifndef _LINUX_NFSD_XDR3_H +#define _LINUX_NFSD_XDR3_H #include <linux/nfsd/xdr.h> struct nfsd3_sattrargs { struct svc_fh fh; struct iattr attrs; + int check_guard; time_t guardtime; }; @@ -88,7 +89,7 @@ struct nfsd3_symlinkargs { struct nfsd3_readdirargs { struct svc_fh fh; - __u32 cookie; + __u64 cookie; __u32 dircount; __u32 count; __u32 * verf; @@ -97,7 +98,7 @@ struct nfsd3_readdirargs { struct nfsd3_commitargs { struct svc_fh fh; __u64 offset; - __u64 count; + __u32 count; }; struct nfsd3_attrstat { @@ -105,7 +106,8 @@ struct nfsd3_attrstat { struct svc_fh fh; }; -struct nfsd3_lookupres { +/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */ +struct nfsd3_diropres { __u32 status; struct svc_fh dirfh; struct svc_fh fh; @@ -137,12 +139,6 @@ struct nfsd3_writeres { int committed; }; -struct nfsd3_createres { - __u32 status; - struct svc_fh dirfh; - struct svc_fh fh; -}; - struct nfsd3_renameres { __u32 status; struct svc_fh ffh; @@ -158,10 +154,11 @@ struct nfsd3_linkres { struct nfsd3_readdirres { __u32 status; struct svc_fh fh; - __u32 * list_end; + int count; + __u32 verf[2]; }; -struct nfsd3_statfsres { +struct nfsd3_fsstatres { __u32 status; struct statfs stats; __u32 invarsec; @@ -184,6 +181,8 @@ struct nfsd3_pathconfres { __u32 status; __u32 p_link_max; __u32 p_name_max; + __u32 p_no_trunc; + __u32 p_chown_restricted; __u32 p_case_insensitive; __u32 p_case_preserving; }; @@ -194,7 +193,7 @@ struct nfsd3_commitres { }; /* dummy type for release */ -struct nfsd3_fhandle2 { +struct nfsd3_fhandle_pair { __u32 dummy; struct svc_fh fh1; struct svc_fh fh2; @@ -213,16 +212,15 @@ union nfsd3_xdrstore { struct nfsd3_linkargs linkargs; struct nfsd3_symlinkargs symlinkargs; struct nfsd3_readdirargs readdirargs; - struct nfsd3_lookupres lookupres; + struct nfsd3_diropres diropres; struct nfsd3_accessres accessres; struct nfsd3_readlinkres readlinkres; struct nfsd3_readres readres; struct nfsd3_writeres writeres; - struct nfsd3_createres createres; struct nfsd3_renameres renameres; struct nfsd3_linkres linkres; struct nfsd3_readdirres readdirres; - struct nfsd3_statfsres statfsres; + struct nfsd3_fsstatres fsstatres; struct nfsd3_fsinfores fsinfores; struct nfsd3_pathconfres pathconfres; struct nfsd3_commitres commitres; @@ -230,39 +228,87 @@ union nfsd3_xdrstore { #define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) -void nfsxdr_init(void); - int nfs3svc_decode_fhandle(struct svc_rqst *, u32 *, struct svc_fh *); -int nfs3svc_decode_sattr3args(struct svc_rqst *, u32 *, +int nfs3svc_decode_sattrargs(struct svc_rqst *, u32 *, struct nfsd3_sattrargs *); -int nfs3svc_decode_dirop3args(struct svc_rqst *, u32 *, +int nfs3svc_decode_diropargs(struct svc_rqst *, u32 *, struct nfsd3_diropargs *); -int nfs3svc_decode_read3args(struct svc_rqst *, u32 *, +int nfs3svc_decode_accessargs(struct svc_rqst *, u32 *, + struct nfsd3_accessargs *); +int nfs3svc_decode_readargs(struct svc_rqst *, u32 *, struct nfsd3_readargs *); -int nfs3svc_decode_write3args(struct svc_rqst *, u32 *, +int nfs3svc_decode_writeargs(struct svc_rqst *, u32 *, struct nfsd3_writeargs *); -int nfs3svc_decode_create3args(struct svc_rqst *, u32 *, +int nfs3svc_decode_createargs(struct svc_rqst *, u32 *, + struct nfsd3_createargs *); +int nfs3svc_decode_mkdirargs(struct svc_rqst *, u32 *, struct nfsd3_createargs *); -int nfs3svc_decode_rename3args(struct svc_rqst *, u32 *, +int nfs3svc_decode_mknodargs(struct svc_rqst *, u32 *, + struct nfsd3_mknodargs *); +int nfs3svc_decode_renameargs(struct svc_rqst *, u32 *, struct nfsd3_renameargs *); -int nfs3svc_decode_link3args(struct svc_rqst *, u32 *, +int nfs3svc_decode_linkargs(struct svc_rqst *, u32 *, struct nfsd3_linkargs *); -int nfs3svc_decode_symlink3args(struct svc_rqst *, u32 *, +int nfs3svc_decode_symlinkargs(struct svc_rqst *, u32 *, struct nfsd3_symlinkargs *); -int nfs3svc_decode_readdir3args(struct svc_rqst *, u32 *, +int nfs3svc_decode_readdirargs(struct svc_rqst *, u32 *, struct nfsd3_readdirargs *); +int nfs3svc_decode_readdirplusargs(struct svc_rqst *, u32 *, + struct nfsd3_readdirargs *); +int nfs3svc_decode_commitargs(struct svc_rqst *, u32 *, + struct nfsd3_commitargs *); +int nfs3svc_encode_voidres(struct svc_rqst *, u32 *, void *); +int nfs3svc_encode_attrstat(struct svc_rqst *, u32 *, + struct nfsd3_attrstat *); +int nfs3svc_encode_wccstat(struct svc_rqst *, u32 *, + struct nfsd3_attrstat *); +int nfs3svc_encode_diropres(struct svc_rqst *, u32 *, + struct nfsd3_diropres *); +int nfs3svc_encode_accessres(struct svc_rqst *, u32 *, + struct nfsd3_accessres *); int nfs3svc_encode_readlinkres(struct svc_rqst *, u32 *, struct nfsd3_readlinkres *); int nfs3svc_encode_readres(struct svc_rqst *, u32 *, struct nfsd3_readres *); -int nfs3svc_encode_statfsres(struct svc_rqst *, u32 *, - struct nfsd3_statfsres *); +int nfs3svc_encode_writeres(struct svc_rqst *, u32 *, struct nfsd3_writeres *); +int nfs3svc_encode_createres(struct svc_rqst *, u32 *, + struct nfsd3_diropres *); +int nfs3svc_encode_renameres(struct svc_rqst *, u32 *, + struct nfsd3_renameres *); +int nfs3svc_encode_linkres(struct svc_rqst *, u32 *, + struct nfsd3_linkres *); int nfs3svc_encode_readdirres(struct svc_rqst *, u32 *, struct nfsd3_readdirres *); +int nfs3svc_encode_fsstatres(struct svc_rqst *, u32 *, + struct nfsd3_fsstatres *); +int nfs3svc_encode_fsinfores(struct svc_rqst *, u32 *, + struct nfsd3_fsinfores *); +int nfs3svc_encode_pathconfres(struct svc_rqst *, u32 *, + struct nfsd3_pathconfres *); +int nfs3svc_encode_commitres(struct svc_rqst *, u32 *, + struct nfsd3_commitres *); + int nfs3svc_release_fhandle(struct svc_rqst *, u32 *, - struct nfsd_fhandle *); + struct nfsd3_attrstat *); int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *, - struct nfsd3_fhandle2 *); + struct nfsd3_fhandle_pair *); int nfs3svc_encode_entry(struct readdir_cd *, const char *name, - int namlen, unsigned long offset, ino_t ino); + int namlen, off_t offset, ino_t ino); +int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name, + int namlen, off_t offset, ino_t ino); + +#ifdef __KERNEL__ + +/* + * This is needed in nfs_readdir for encoding NFS3 directory cookies. + */ +static inline u32 * +enc64(u32 *p, u64 val) +{ + *p++ = htonl(val >> 32); + *p++ = htonl(val & 0xffffffff); + return p; +} + +#endif /* __KERNEL__ */ -#endif /* LINUX_NFSD_XDR3_H */ +#endif /* _LINUX_NFSD_XDR3_H */ diff --git a/include/linux/nls.h b/include/linux/nls.h index efcd58920..9e39d3cd4 100644 --- a/include/linux/nls.h +++ b/include/linux/nls.h @@ -7,7 +7,8 @@ struct nls_table { char *charset; unsigned char **page_uni2charset; struct nls_unicode *charset2uni; - + unsigned char *charset2lower; + unsigned char *charset2upper; void (*inc_use_count) (void); void (*dec_use_count) (void); struct nls_table *next; diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 66b558627..53bc365d2 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -13,6 +13,7 @@ #include <asm/system.h> #include <asm/pgtable.h> +#include <linux/highmem.h> /* * The page cache can done in larger chunks than @@ -79,7 +80,6 @@ extern void lock_page(struct page *page); extern void __add_page_to_hash_queue(struct page * page, struct page **p); extern void add_to_page_cache(struct page * page, struct address_space *mapping, unsigned long index); -extern int add_to_page_cache_unique(struct page * page, struct address_space *mapping, unsigned long index, struct page **hash); extern inline void add_page_to_hash_queue(struct page * page, struct inode * inode, unsigned long index) { @@ -117,4 +117,10 @@ extern inline void wait_on_page(struct page * page) ___wait_on_page(page); } +extern struct page * grab_cache_page (struct address_space *, unsigned long); + +typedef int filler_t(void *, struct page*); + +extern struct page *read_cache_page(struct address_space *, unsigned long, + filler_t *, void *); #endif diff --git a/include/linux/pci.h b/include/linux/pci.h index 96a9dd076..0335bd565 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -3,7 +3,7 @@ * * PCI defines and function prototypes * Copyright 1994, Drew Eckhardt - * Copyright 1997--1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz> + * Copyright 1997--1999 Martin Mares <mj@suse.cz> * * For more information, please consult the following manuals (look at * http://www.pcisig.com/ for how to get them): @@ -404,11 +404,20 @@ struct pci_ops { int (*write_dword)(struct pci_dev *, int where, u32 val); }; +struct pbus_set_ranges_data +{ + int found_vga; + unsigned long io_start, io_end; + unsigned long mem_start, mem_end; +}; + void pcibios_init(void); void pcibios_fixup_bus(struct pci_bus *); +void pcibios_fixup_pbus_ranges(struct pci_bus *, struct pbus_set_ranges_data *); int pcibios_enable_device(struct pci_dev *); char *pcibios_setup (char *str); +void pcibios_align_resource(void *, struct resource *, unsigned long); void pcibios_update_resource(struct pci_dev *, struct resource *, struct resource *, int); void pcibios_update_irq(struct pci_dev *, int irq); @@ -441,6 +450,7 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata); int pci_proc_attach_device(struct pci_dev *dev); int pci_proc_detach_device(struct pci_dev *dev); void pci_name_device(struct pci_dev *dev); +char *pci_class_name(u32 class); void pci_read_bridge_bases(struct pci_bus *child); struct resource *pci_find_parent_resource(struct pci_dev *dev, struct resource *res); diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 3015837a3..7e0979b98 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -27,32 +27,37 @@ #define PCI_BASE_CLASS_DISPLAY 0x03 #define PCI_CLASS_DISPLAY_VGA 0x0300 #define PCI_CLASS_DISPLAY_XGA 0x0301 +#define PCI_CLASS_DISPLAY_3D 0x0302 #define PCI_CLASS_DISPLAY_OTHER 0x0380 #define PCI_BASE_CLASS_MULTIMEDIA 0x04 #define PCI_CLASS_MULTIMEDIA_VIDEO 0x0400 #define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401 +#define PCI_CLASS_MULTIMEDIA_PHONE 0x0402 #define PCI_CLASS_MULTIMEDIA_OTHER 0x0480 #define PCI_BASE_CLASS_MEMORY 0x05 -#define PCI_CLASS_MEMORY_RAM 0x0500 -#define PCI_CLASS_MEMORY_FLASH 0x0501 -#define PCI_CLASS_MEMORY_OTHER 0x0580 +#define PCI_CLASS_MEMORY_RAM 0x0500 +#define PCI_CLASS_MEMORY_FLASH 0x0501 +#define PCI_CLASS_MEMORY_OTHER 0x0580 #define PCI_BASE_CLASS_BRIDGE 0x06 -#define PCI_CLASS_BRIDGE_HOST 0x0600 -#define PCI_CLASS_BRIDGE_ISA 0x0601 -#define PCI_CLASS_BRIDGE_EISA 0x0602 -#define PCI_CLASS_BRIDGE_MC 0x0603 -#define PCI_CLASS_BRIDGE_PCI 0x0604 -#define PCI_CLASS_BRIDGE_PCMCIA 0x0605 -#define PCI_CLASS_BRIDGE_NUBUS 0x0606 -#define PCI_CLASS_BRIDGE_CARDBUS 0x0607 -#define PCI_CLASS_BRIDGE_OTHER 0x0680 +#define PCI_CLASS_BRIDGE_HOST 0x0600 +#define PCI_CLASS_BRIDGE_ISA 0x0601 +#define PCI_CLASS_BRIDGE_EISA 0x0602 +#define PCI_CLASS_BRIDGE_MC 0x0603 +#define PCI_CLASS_BRIDGE_PCI 0x0604 +#define PCI_CLASS_BRIDGE_PCMCIA 0x0605 +#define PCI_CLASS_BRIDGE_NUBUS 0x0606 +#define PCI_CLASS_BRIDGE_CARDBUS 0x0607 +#define PCI_CLASS_BRIDGE_RACEWAY 0x0608 +#define PCI_CLASS_BRIDGE_OTHER 0x0680 #define PCI_BASE_CLASS_COMMUNICATION 0x07 #define PCI_CLASS_COMMUNICATION_SERIAL 0x0700 #define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701 +#define PCI_CLASS_COMMUNICATION_MULTISERIAL 0x0702 +#define PCI_CLASS_COMMUNICATION_MODEM 0x0703 #define PCI_CLASS_COMMUNICATION_OTHER 0x0780 #define PCI_BASE_CLASS_SYSTEM 0x08 @@ -60,17 +65,20 @@ #define PCI_CLASS_SYSTEM_DMA 0x0801 #define PCI_CLASS_SYSTEM_TIMER 0x0802 #define PCI_CLASS_SYSTEM_RTC 0x0803 +#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804 #define PCI_CLASS_SYSTEM_OTHER 0x0880 #define PCI_BASE_CLASS_INPUT 0x09 #define PCI_CLASS_INPUT_KEYBOARD 0x0900 #define PCI_CLASS_INPUT_PEN 0x0901 #define PCI_CLASS_INPUT_MOUSE 0x0902 +#define PCI_CLASS_INPUT_SCANNER 0x0903 +#define PCI_CLASS_INPUT_GAMEPORT 0x0904 #define PCI_CLASS_INPUT_OTHER 0x0980 #define PCI_BASE_CLASS_DOCKING 0x0a #define PCI_CLASS_DOCKING_GENERIC 0x0a00 -#define PCI_CLASS_DOCKING_OTHER 0x0a01 +#define PCI_CLASS_DOCKING_OTHER 0x0a80 #define PCI_BASE_CLASS_PROCESSOR 0x0b #define PCI_CLASS_PROCESSOR_386 0x0b00 @@ -78,6 +86,7 @@ #define PCI_CLASS_PROCESSOR_PENTIUM 0x0b02 #define PCI_CLASS_PROCESSOR_ALPHA 0x0b10 #define PCI_CLASS_PROCESSOR_POWERPC 0x0b20 +#define PCI_CLASS_PROCESSOR_MIPS 0x0b30 #define PCI_CLASS_PROCESSOR_CO 0x0b40 #define PCI_BASE_CLASS_SERIAL 0x0c @@ -86,11 +95,25 @@ #define PCI_CLASS_SERIAL_SSA 0x0c02 #define PCI_CLASS_SERIAL_USB 0x0c03 #define PCI_CLASS_SERIAL_FIBER 0x0c04 +#define PCI_CLASS_SERIAL_SMBUS 0x0c05 #define PCI_BASE_CLASS_INTELLIGENT 0x0e #define PCI_CLASS_INTELLIGENT_I2O 0x0e00 -#define PCI_CLASS_HOT_SWAP_CONTROLLER 0xff00 +#define PCI_BASE_CLASS_SATELLITE 0x0f +#define PCI_CLASS_SATELLITE_TV 0x0f00 +#define PCI_CLASS_SATELLITE_AUDIO 0x0f01 +#define PCI_CLASS_SATELLITE_VOICE 0x0f03 +#define PCI_CLASS_SATELLITE_DATA 0x0f04 + +#define PCI_BASE_CLASS_CRYPT 0x10 +#define PCI_CLASS_CRYPT_NETWORK 0x1000 +#define PCI_CLASS_CRYPT_ENTERTAINMENT 0x1001 +#define PCI_CLASS_CRYPT_OTHER 0x1080 + +#define PCI_BASE_CLASS_SIGNAL_PROCESSING 0x11 +#define PCI_CLASS_SP_DPIO 0x1100 +#define PCI_CLASS_SP_OTHER 0x1180 #define PCI_CLASS_OTHERS 0xff @@ -287,8 +310,10 @@ #define PCI_DEVICE_ID_SI_501 0x0406 #define PCI_DEVICE_ID_SI_496 0x0496 #define PCI_DEVICE_ID_SI_530 0x0530 +#define PCI_DEVICE_ID_SI_540 0x0540 #define PCI_DEVICE_ID_SI_601 0x0601 #define PCI_DEVICE_ID_SI_620 0x0620 +#define PCI_DEVICE_ID_SI_630 0x0630 #define PCI_DEVICE_ID_SI_5107 0x5107 #define PCI_DEVICE_ID_SI_5511 0x5511 #define PCI_DEVICE_ID_SI_5513 0x5513 @@ -433,6 +458,10 @@ #define PCI_VENDOR_ID_LEADTEK 0x107d #define PCI_DEVICE_ID_LEADTEK_805 0x0000 +#define PCI_VENDOR_ID_INTERPHASE 0x107e +#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004 +#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005 + #define PCI_VENDOR_ID_CONTAQ 0x1080 #define PCI_DEVICE_ID_CONTAQ_82C599 0x0600 #define PCI_DEVICE_ID_CONTAQ_82C693 0xc693 @@ -706,10 +735,10 @@ #define PCI_DEVICE_ID_ALLIANCE_AT24 0x6424 #define PCI_DEVICE_ID_ALLIANCE_AT3D 0x643d -#define PCI_VENDOR_ID_SK 0x1148 -#define PCI_DEVICE_ID_SK_FP 0x4000 -#define PCI_DEVICE_ID_SK_TR 0x4200 -#define PCI_DEVICE_ID_SK_GE 0x4300 +#define PCI_VENDOR_ID_SYSKONNECT 0x1148 +#define PCI_DEVICE_ID_SYSKONNECT_FP 0x4000 +#define PCI_DEVICE_ID_SYSKONNECT_TR 0x4200 +#define PCI_DEVICE_ID_SYSKONNECT_GE 0x4300 #define PCI_VENDOR_ID_VMIC 0x114a #define PCI_DEVICE_ID_VMIC_VME 0x7587 @@ -782,6 +811,7 @@ #define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000 #define PCI_DEVICE_ID_SPECIALIX_XIO 0x4000 #define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000 +#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004 #define PCI_VENDOR_ID_AURAVISION 0x11d1 #define PCI_DEVICE_ID_AURAVISION_VXP524 0x01f7 @@ -873,9 +903,13 @@ #define PCI_DEVICE_ID_ENSONIQ_AUDIOPCI 0x5000 #define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371 +#define PCI_VENDOR_ID_ROCKWELL 0x127A + #define PCI_VENDOR_ID_ALTEON 0x12ae #define PCI_DEVICE_ID_ALTEON_ACENIC 0x0001 +#define PCI_VENDOR_ID_USR 0x12B9 + #define PCI_SUBVENDOR_ID_CONNECT_TECH 0x12c4 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232 0x0001 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232 0x0002 @@ -892,30 +926,65 @@ #define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2 #define PCI_DEVICE_ID_NVIDIA_SGS_RIVA128 0x0018 +#define PCI_SUBVENDOR_ID_CHASE_PCIFAST 0x12E0 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST4 0x0031 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST8 0x0021 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16 0x0011 +#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC 0x0041 +#define PCI_SUBVENDOR_ID_CHASE_PCIRAS 0x124D +#define PCI_SUBDEVICE_ID_CHASE_PCIRAS4 0xF001 +#define PCI_SUBDEVICE_ID_CHASE_PCIRAS8 0xF010 + #define PCI_VENDOR_ID_CBOARDS 0x1307 #define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001 #define PCI_VENDOR_ID_SIIG 0x131f +#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 +#define PCI_DEVICE_ID_SIIG_1S_10x_650 0x1001 +#define PCI_DEVICE_ID_SIIG_1S_10x_850 0x1002 #define PCI_DEVICE_ID_SIIG_1S1P_10x_550 0x1010 #define PCI_DEVICE_ID_SIIG_1S1P_10x_650 0x1011 #define PCI_DEVICE_ID_SIIG_1S1P_10x_850 0x1012 #define PCI_DEVICE_ID_SIIG_1P_10x 0x1020 #define PCI_DEVICE_ID_SIIG_2P_10x 0x1021 +#define PCI_DEVICE_ID_SIIG_2S_10x_550 0x1030 +#define PCI_DEVICE_ID_SIIG_2S_10x_650 0x1031 +#define PCI_DEVICE_ID_SIIG_2S_10x_850 0x1032 #define PCI_DEVICE_ID_SIIG_2S1P_10x_550 0x1034 #define PCI_DEVICE_ID_SIIG_2S1P_10x_650 0x1035 #define PCI_DEVICE_ID_SIIG_2S1P_10x_850 0x1036 +#define PCI_DEVICE_ID_SIIG_4S_10x_550 0x1050 +#define PCI_DEVICE_ID_SIIG_4S_10x_650 0x1051 +#define PCI_DEVICE_ID_SIIG_4S_10x_850 0x1052 +#define PCI_DEVICE_ID_SIIG_1S_20x_550 0x2000 +#define PCI_DEVICE_ID_SIIG_1S_20x_650 0x2001 +#define PCI_DEVICE_ID_SIIG_1S_20x_850 0x2002 #define PCI_DEVICE_ID_SIIG_1P_20x 0x2020 #define PCI_DEVICE_ID_SIIG_2P_20x 0x2021 +#define PCI_DEVICE_ID_SIIG_2S_20x_550 0x2030 +#define PCI_DEVICE_ID_SIIG_2S_20x_650 0x2031 +#define PCI_DEVICE_ID_SIIG_2S_20x_850 0x2032 #define PCI_DEVICE_ID_SIIG_2P1S_20x_550 0x2040 #define PCI_DEVICE_ID_SIIG_2P1S_20x_650 0x2041 #define PCI_DEVICE_ID_SIIG_2P1S_20x_850 0x2042 #define PCI_DEVICE_ID_SIIG_1S1P_20x_550 0x2010 #define PCI_DEVICE_ID_SIIG_1S1P_20x_650 0x2011 #define PCI_DEVICE_ID_SIIG_1S1P_20x_850 0x2012 +#define PCI_DEVICE_ID_SIIG_4S_20x_550 0x2050 +#define PCI_DEVICE_ID_SIIG_4S_20x_650 0x2051 +#define PCI_DEVICE_ID_SIIG_4S_20x_850 0x2052 #define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060 #define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061 #define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062 +#define PCI_VENDOR_ID_QUATECH 0x135C +#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010 +#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020 +#define PCI_DEVICE_ID_QUATECH_DSC200 0x0030 +#define PCI_DEVICE_ID_QUATECH_QSC200 0x0040 +#define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050 +#define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060 + #define PCI_VENDOR_ID_SEALEVEL 0x135e #define PCI_DEVICE_ID_SEALEVEL_U530 0x7101 #define PCI_DEVICE_ID_SEALEVEL_UCOMM2 0x7201 @@ -928,11 +997,18 @@ #define PCI_DEVICE_ID_NETGEAR_GA620 0x620a #define PCI_VENDOR_ID_LAVA 0x1407 +#define PCI_DEVICE_ID_LAVA_DUAL_SERIAL 0x0100 #define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000 #define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 /* The Lava Dual Parallel is */ #define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 /* two PCI devices on a card */ #define PCI_DEVICE_ID_LAVA_BOCA_IOPPAR 0x8800 +#define PCI_VENDOR_ID_TIMEDIA 0x1409 +#define PCI_DEVICE_ID_TIMEDIA_1889 0x7168 + +#define PCI_VENDOR_ID_OXSEMI 0x1415 +#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 + #define PCI_VENDOR_ID_PANACOM 0x14d4 #define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400 #define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402 @@ -1021,8 +1097,6 @@ #define PCI_DEVICE_ID_INTEL_82371AB 0x7111 #define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112 #define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 -#define PCI_VENDOR_ID_COMPUTONE 0x8e0e -#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 #define PCI_DEVICE_ID_INTEL_82443LX_0 0x7180 #define PCI_DEVICE_ID_INTEL_82443LX_1 0x7181 @@ -1033,6 +1107,14 @@ #define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 #define PCI_DEVICE_ID_INTEL_82451NX 0x84ca +#define PCI_VENDOR_ID_COMPUTONE 0x8e0e +#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 +#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 +#define PCI_SUBVENDOR_ID_COMPUTONE 0x8e0e +#define PCI_SUBDEVICE_ID_COMPUTONE_PG4 0x0001 +#define PCI_SUBDEVICE_ID_COMPUTONE_PG8 0x0002 +#define PCI_SUBDEVICE_ID_COMPUTONE_PG6 0x0003 + #define PCI_VENDOR_ID_KTI 0x8e2e #define PCI_DEVICE_ID_KTI_ET32P2 0x3000 @@ -1098,15 +1180,4 @@ #define PCI_DEVICE_ID_ARK_STINGARK 0xa099 #define PCI_DEVICE_ID_ARK_2000MT 0xa0a1 -#define PCI_VENDOR_ID_INTERPHASE 0x107e -#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004 -#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005 - -#define PCI_VENDOR_ID_INTERPHASE 0x107e -#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004 -#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005 - -#define PCI_VENDOR_ID_INTERPHASE 0x107e -#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004 -#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005 diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index eb2d91054..25210f8e5 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h @@ -7,6 +7,8 @@ struct pipe_inode_info { unsigned int start; unsigned int readers; unsigned int writers; + unsigned int waiting_readers; + unsigned int waiting_writers; }; /* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual @@ -20,6 +22,8 @@ struct pipe_inode_info { #define PIPE_LEN(inode) ((inode).i_size) #define PIPE_READERS(inode) ((inode).i_pipe->readers) #define PIPE_WRITERS(inode) ((inode).i_pipe->writers) +#define PIPE_WAITING_READERS(inode) ((inode).i_pipe->waiting_readers) +#define PIPE_WAITING_WRITERS(inode) ((inode).i_pipe->waiting_writers) #define PIPE_EMPTY(inode) (PIPE_LEN(inode) == 0) #define PIPE_FULL(inode) (PIPE_LEN(inode) == PIPE_SIZE) diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index d0e57016f..a061d647d 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -53,7 +53,7 @@ typedef int (read_proc_t)(char *page, char **start, off_t off, int count, int *eof, void *data); typedef int (write_proc_t)(struct file *file, const char *buffer, unsigned long count, void *data); -typedef int (get_info_t)(char *, char **, off_t, int, int); +typedef int (get_info_t)(char *, char **, off_t, int); struct proc_dir_entry { unsigned short low_ino; @@ -71,24 +71,18 @@ struct proc_dir_entry { void *data; read_proc_t *read_proc; write_proc_t *write_proc; - int (*readlink_proc)(struct proc_dir_entry *de, char *page); unsigned int count; /* use count */ int deleted; /* delete flag */ + kdev_t rdev; }; #define PROC_INODE_PROPER(inode) ((inode)->i_ino & ~0xffff) -#define PROC_INODE_OPENPROM(inode) \ - ((inode->i_ino >= PROC_OPENPROM_FIRST) \ - && (inode->i_ino < PROC_OPENPROM_FIRST + PROC_NOPENPROM)) #ifdef CONFIG_PROC_FS extern struct proc_dir_entry proc_root; extern struct proc_dir_entry *proc_root_fs; extern struct proc_dir_entry *proc_net; -extern struct proc_dir_entry proc_sys; -extern struct proc_dir_entry proc_openprom; -extern struct proc_dir_entry *proc_mca; extern struct proc_dir_entry *proc_bus; extern struct proc_dir_entry *proc_root_driver; extern struct proc_dir_entry proc_root_kcore; @@ -101,62 +95,15 @@ void proc_pid_delete_inode(struct inode *inode); int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); extern int proc_register(struct proc_dir_entry *, struct proc_dir_entry *); -extern int proc_unregister(struct proc_dir_entry *, int); extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, struct proc_dir_entry *parent); extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); - -/* - * retrieve the proc_dir_entry associated with /proc/driver/$module_name - */ -extern inline -struct proc_dir_entry *proc_driver_find (const char *module_name) -{ - struct proc_dir_entry *p; - - p = proc_root_driver->subdir; - while (p != NULL) { - if (strcmp (p->name, module_name) == 0) - return p; - - p = p->next; - } - return NULL; -} - - -/* - * remove /proc/driver/$module_name, and all its contents - */ -extern inline int proc_driver_unregister(const char *module_name) -{ - remove_proc_entry (module_name, proc_root_driver); - return 0; -} - - -/* - * create driver-specific playground directory, /proc/driver/$module_name - */ -extern inline int proc_driver_register(const char *module_name) -{ - struct proc_dir_entry *p; - - p = create_proc_entry (module_name, S_IFDIR, proc_root_driver); - - return (p == NULL) ? -1 : 0; -} - extern struct super_block *proc_super_blocks; -extern struct dentry_operations proc_dentry_operations; extern struct super_block *proc_read_super(struct super_block *,void *,int); extern int init_proc_fs(void); extern struct inode * proc_get_inode(struct super_block *, int, struct proc_dir_entry *); -extern int proc_statfs(struct super_block *, struct statfs *, int); -extern void proc_read_inode(struct inode *); -extern void proc_write_inode(struct inode *); extern int proc_match(int, const char *,struct proc_dir_entry *); @@ -178,22 +125,11 @@ struct openpromfs_dev { mode_t mode; char name[32]; }; -extern struct inode_operations * -proc_openprom_register(int (*readdir)(struct file *, void *, filldir_t), - struct dentry * (*lookup)(struct inode *, struct dentry *), - void (*use)(struct inode *, int), - struct openpromfs_dev ***); -extern void proc_openprom_deregister(void); -extern void (*proc_openprom_use)(struct inode *,int); extern int proc_openprom_regdev(struct openpromfs_dev *); extern int proc_openprom_unregdev(struct openpromfs_dev *); -extern struct inode_operations proc_dir_inode_operations; -extern struct inode_operations proc_file_inode_operations; -extern struct inode_operations proc_openprom_inode_operations; extern struct inode_operations proc_sys_inode_operations; extern struct inode_operations proc_kcore_inode_operations; -extern struct inode_operations proc_profile_inode_operations; extern struct inode_operations proc_kmsg_inode_operations; #if CONFIG_AP1000 extern struct inode_operations proc_ringbuf_inode_operations; @@ -213,6 +149,12 @@ extern void proc_tty_unregister_driver(struct tty_driver *driver); */ extern void proc_device_tree_init(void); +extern struct proc_dir_entry *proc_symlink(const char *, + struct proc_dir_entry *,char *); +extern struct proc_dir_entry *proc_mknod(const char *,mode_t, + struct proc_dir_entry *,kdev_t); +extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); + extern inline struct proc_dir_entry *create_proc_read_entry(const char *name, mode_t mode, struct proc_dir_entry *base, read_proc_t *read_proc, void * data) @@ -247,7 +189,6 @@ extern inline void proc_net_remove(const char *name) #else extern inline int proc_register(struct proc_dir_entry *a, struct proc_dir_entry *b) { return 0; } -extern inline int proc_unregister(struct proc_dir_entry *a, int b) { return 0; } extern inline struct proc_dir_entry *proc_net_create(const char *name, mode_t mode, get_info_t *get_info) {return NULL;} extern inline void proc_net_remove(const char *name) {} @@ -256,6 +197,12 @@ extern inline struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, struct proc_dir_entry *parent) { return NULL; } extern inline void remove_proc_entry(const char *name, struct proc_dir_entry *parent) {}; +extern inline proc_dir_entry *proc_symlink(const char *name, + struct proc_dir_entry *parent,char *dest) {return NULL;} +extern inline proc_dir_entry *proc_mknod(const char *name,mode_t mode, + struct proc_dir_entry *parent,kdev_t rdev) {return NULL;} +extern struct proc_dir_entry *proc_mkdir(const char *name, + struct proc_dir_entry *parent) {return NULL;} extern inline struct proc_dir_entry *create_proc_read_entry(const char *name, mode_t mode, struct proc_dir_entry *base, @@ -268,22 +215,6 @@ extern inline struct proc_dir_entry *create_proc_info_entry(const char *name, extern inline void proc_tty_register_driver(struct tty_driver *driver) {}; extern inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; -extern inline -struct proc_dir_entry *proc_driver_find (const char *module_name) -{ - return NULL; -} - -extern inline int proc_driver_unregister(const char *module_name) -{ - return 0; -} - -extern inline int proc_driver_register(const char *module_name) -{ - return 0; -} - extern struct proc_dir_entry proc_root; #endif /* CONFIG_PROC_FS */ diff --git a/include/linux/quota.h b/include/linux/quota.h index a3e76e138..ad2380019 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h @@ -44,8 +44,8 @@ /* * Convert diskblocks to blocks and the other way around. */ -#define dbtob(num) (num << 10) -#define btodb(num) (num >> 10) +#define dbtob(num) (num << BLOCK_SIZE_BITS) +#define btodb(num) (num >> BLOCK_SIZE_BITS) /* * Convert count of filesystem blocks to diskquota blocks, meant @@ -202,7 +202,7 @@ struct dquot { # /* nodep */ include <sys/cdefs.h> __BEGIN_DECLS -int quotactl __P ((int, const char *, int, caddr_t)); +long quotactl __P ((int, const char *, int, caddr_t)); __END_DECLS #endif /* __KERNEL__ */ diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index b31daec41..17371e58c 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h @@ -23,16 +23,13 @@ extern void invalidate_dquots(kdev_t dev, short type); extern int quota_off(kdev_t dev, short type); extern int sync_dquots(kdev_t dev, short type); -extern int dquot_alloc_block(const struct inode *inode, unsigned long number, - uid_t initiator, char warn); -extern int dquot_alloc_inode(const struct inode *inode, unsigned long number, - uid_t initiator); +extern int dquot_alloc_block(const struct inode *inode, unsigned long number, char prealloc); +extern int dquot_alloc_inode(const struct inode *inode, unsigned long number); extern void dquot_free_block(const struct inode *inode, unsigned long number); extern void dquot_free_inode(const struct inode *inode, unsigned long number); -extern int dquot_transfer(struct inode *inode, struct iattr *iattr, - char direction, uid_t initiator); +extern int dquot_transfer(struct dentry *dentry, struct iattr *iattr); /* * Operations supported for diskquotas. @@ -54,8 +51,7 @@ extern __inline__ void DQUOT_DROP(struct inode *inode) extern __inline__ int DQUOT_PREALLOC_BLOCK(struct super_block *sb, const struct inode *inode, int nr) { if (sb->dq_op) { - if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), - current->fsuid, 0) == NO_QUOTA) + if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), 1) == NO_QUOTA) return 1; } return 0; @@ -64,8 +60,7 @@ extern __inline__ int DQUOT_PREALLOC_BLOCK(struct super_block *sb, const struct extern __inline__ int DQUOT_ALLOC_BLOCK(struct super_block *sb, const struct inode *inode, int nr) { if (sb->dq_op) { - if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), - current->fsuid, 1) == NO_QUOTA) + if (sb->dq_op->alloc_block(inode, fs_to_dq_blocks(nr, sb->s_blocksize), 0) == NO_QUOTA) return 1; } return 0; @@ -75,7 +70,7 @@ extern __inline__ int DQUOT_ALLOC_INODE(struct super_block *sb, struct inode *in { if (sb->dq_op) { sb->dq_op->initialize (inode, -1); - if (sb->dq_op->alloc_inode (inode, 1, current->fsuid)) + if (sb->dq_op->alloc_inode (inode, 1)) return 1; } inode->i_flags |= S_QUOTA; @@ -99,17 +94,11 @@ extern __inline__ int DQUOT_TRANSFER(struct dentry *dentry, struct iattr *iattr) int error = -EDQUOT; if (dentry->d_inode->i_sb->dq_op) { - if (IS_QUOTAINIT(dentry->d_inode) == 0) - dentry->d_inode->i_sb->dq_op->initialize(dentry->d_inode, -1); - if (dentry->d_inode->i_sb->dq_op->transfer(dentry->d_inode, iattr, 0, current->fsuid)) - goto out; - error = notify_change(dentry, iattr); - if (error) - dentry->d_inode->i_sb->dq_op->transfer(dentry->d_inode, iattr, 1, current->fsuid); + dentry->d_inode->i_sb->dq_op->initialize(dentry->d_inode, -1); + error = dentry->d_inode->i_sb->dq_op->transfer(dentry, iattr); } else { error = notify_change(dentry, iattr); } -out: return error; } diff --git a/include/linux/resource.h b/include/linux/resource.h index 5b38bb9e9..0b7585f25 100644 --- a/include/linux/resource.h +++ b/include/linux/resource.h @@ -37,13 +37,6 @@ struct rusage { long ru_nivcsw; /* involuntary " */ }; -/* - * SuS says limits have to be unsigned. - * - * Which makes a ton more sense anyway. - */ -#define RLIM_INFINITY (~0UL) - struct rlimit { unsigned long rlim_cur; unsigned long rlim_max; diff --git a/include/linux/sched.h b/include/linux/sched.h index 26ef161ec..d9a6b2e18 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -84,20 +84,20 @@ extern int last_pid; #define TASK_EXCLUSIVE 32 #define __set_task_state(tsk, state_value) \ - do { tsk->state = state_value; } while (0) + do { (tsk)->state = (state_value); } while (0) #ifdef __SMP__ #define set_task_state(tsk, state_value) \ - set_mb(tsk->state, state_value) + set_mb((tsk)->state, (state_value)) #else #define set_task_state(tsk, state_value) \ - __set_task_state(tsk, state_value) + __set_task_state((tsk), (state_value)) #endif #define __set_current_state(state_value) \ - do { current->state = state_value; } while (0) + do { current->state = (state_value); } while (0) #ifdef __SMP__ #define set_current_state(state_value) \ - set_mb(current->state, state_value) + set_mb(current->state, (state_value)) #else #define set_current_state(state_value) \ __set_current_state(state_value) @@ -498,6 +498,7 @@ extern unsigned long prof_shift; #define CURRENT_TIME (xtime.tv_sec) extern void FASTCALL(__wake_up(wait_queue_head_t *q, unsigned int mode)); +extern void FASTCALL(__wake_up_sync(wait_queue_head_t *q, unsigned int mode)); extern void FASTCALL(sleep_on(wait_queue_head_t *q)); extern long FASTCALL(sleep_on_timeout(wait_queue_head_t *q, signed long timeout)); @@ -507,9 +508,12 @@ extern long FASTCALL(interruptible_sleep_on_timeout(wait_queue_head_t *q, extern void FASTCALL(wake_up_process(struct task_struct * tsk)); #define wake_up(x) __wake_up((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE) +#define wake_up_sync(x) __wake_up_sync((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE) #define wake_up_interruptible(x) __wake_up((x),TASK_INTERRUPTIBLE) +#define wake_up_interruptible_sync(x) __wake_up_sync((x),TASK_INTERRUPTIBLE) extern int in_group_p(gid_t); +extern int in_egroup_p(gid_t); extern void release(struct task_struct * p); @@ -847,7 +851,7 @@ static inline int task_lock(struct task_struct *p) down(&p->exit_sem); if (p->p_pptr) return 1; - /* He's dead, Jim. You take his wallet, I'll take tricoder... */ + /* He's dead, Jim. You take his wallet, I'll take the tricorder... */ up(&p->exit_sem); return 0; } diff --git a/include/linux/serial.h b/include/linux/serial.h index 7149f5b35..bfeee939c 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h @@ -20,7 +20,8 @@ struct serial_struct { int custom_divisor; int baud_base; unsigned short close_delay; - char reserved_char[2]; + char io_type; + char reserved_char[1]; int hub6; unsigned short closing_wait; /* time to wait before closing */ unsigned short closing_wait2; /* no longer used... */ @@ -68,6 +69,11 @@ struct async_icount { #define PORT_16850 12 #define PORT_MAX 12 +#define SERIAL_IO_PORT 0 +#define SERIAL_IO_HUB6 1 +#define SERIAL_IO_MEM 2 +#define SERIAL_IO_GSC 3 + struct serial_uart_config { char *name; int dfl_xmit_fifo_size; diff --git a/include/linux/serialP.h b/include/linux/serialP.h index 11643f8a0..3fdadb4a1 100644 --- a/include/linux/serialP.h +++ b/include/linux/serialP.h @@ -45,6 +45,7 @@ struct serial_state { struct async_icount icount; struct termios normal_termios; struct termios callout_termios; + int io_type; struct async_struct *info; }; @@ -80,6 +81,7 @@ struct async_struct { int xmit_cnt; u8 *iomem_base; u16 iomem_reg_shift; + int io_type; struct tq_struct tqueue; #ifdef DECLARE_WAITQUEUE wait_queue_head_t open_wait; @@ -99,6 +101,10 @@ struct async_struct { #define SERIAL_MAGIC 0x5301 #define SSTATE_MAGIC 0x5302 +/* + * The size of the serial xmit buffer is 1 page, or 4096 bytes + */ +#define SERIAL_XMIT_SIZE 4096 /* * Events are used to schedule things to happen at timer-interrupt @@ -132,7 +138,6 @@ struct rs_multiport_struct { #define ALPHA_KLUDGE_MCR 0 #endif -#ifdef CONFIG_PCI /* * Structures and definitions for PCI support */ @@ -147,8 +152,9 @@ struct pci_board { int base_baud; int uart_offset; int reg_shift; - void (*init_fn)(struct pci_dev *dev, struct pci_board *board, + int (*init_fn)(struct pci_dev *dev, struct pci_board *board, int enable); + int first_uart_offset; }; struct pci_board_inst { @@ -159,7 +165,6 @@ struct pci_board_inst { #ifndef PCI_ANY_ID #define PCI_ANY_ID (~0) #endif -#endif #define SPCI_FL_BASE_MASK 0x0007 #define SPCI_FL_BASE0 0x0000 diff --git a/include/linux/slab.h b/include/linux/slab.h index fa344d816..97f6923da 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -12,7 +12,7 @@ typedef struct kmem_cache_s kmem_cache_t; #include <linux/mm.h> -#include <asm/cache.h> +#include <linux/cache.h> /* flags for kmem_cache_alloc() */ #define SLAB_BUFFER GFP_BUFFER diff --git a/include/linux/swap.h b/include/linux/swap.h index 8e9e72989..18ea45e63 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -1,6 +1,7 @@ #ifndef _LINUX_SWAP_H #define _LINUX_SWAP_H +#include <linux/spinlock.h> #include <asm/page.h> #define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */ @@ -48,6 +49,7 @@ union swap_header { struct swap_info_struct { unsigned int flags; kdev_t swap_device; + spinlock_t sdev_lock; struct dentry * swap_file; unsigned short * swap_map; unsigned int lowest_bit; @@ -94,19 +96,17 @@ extern void rw_swap_page_nolock(int, swp_entry_t, char *, int); /* linux/mm/swap_state.c */ extern void show_swap_cache_info(void); extern void add_to_swap_cache(struct page *, swp_entry_t); -extern int swap_duplicate(swp_entry_t); extern int swap_check_entry(unsigned long); extern struct page * lookup_swap_cache(swp_entry_t); extern struct page * read_swap_cache_async(swp_entry_t, int); #define read_swap_cache(entry) read_swap_cache_async(entry, 1); -extern int swap_count(struct page *); -extern swp_entry_t acquire_swap_entry(struct page *page); /* * Make these inline later once they are working properly. */ extern void __delete_from_swap_cache(struct page *page); extern void delete_from_swap_cache(struct page *page); +extern void delete_from_swap_cache_nolock(struct page *page); extern void free_page_and_swap_cache(struct page *page); /* linux/mm/swapfile.c */ @@ -115,6 +115,12 @@ extern struct swap_info_struct swap_info[]; extern int is_swap_partition(kdev_t); extern void si_swapinfo(struct sysinfo *); extern swp_entry_t __get_swap_page(unsigned short); +extern void get_swaphandle_info(swp_entry_t, unsigned long *, kdev_t *, + struct inode **); +extern int swap_duplicate(swp_entry_t); +extern int swap_count(struct page *); +extern swp_entry_t acquire_swap_entry(struct page *page); +extern int valid_swaphandles(swp_entry_t, unsigned long *); #define get_swap_page() __get_swap_page(1) extern void __swap_free(swp_entry_t, unsigned short); #define swap_free(entry) __swap_free((entry), 1) @@ -173,6 +179,13 @@ do { \ spin_unlock(&pagemap_lru_lock); \ } while (0) +extern spinlock_t swaplock; + +#define swap_list_lock() spin_lock(&swaplock) +#define swap_list_unlock() spin_unlock(&swaplock) +#define swap_device_lock(p) spin_lock(&p->sdev_lock) +#define swap_device_unlock(p) spin_unlock(&p->sdev_lock) + #endif /* __KERNEL__*/ #endif /* _LINUX_SWAP_H */ diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index ce76c926d..ab92bbece 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -97,7 +97,7 @@ enum KERN_RTSIGNR=32, /* Number of rt sigs queued */ KERN_RTSIGMAX=33, /* Max queuable */ - KERN_SHMMAX=34, /* int: Maximum shared memory segment */ + KERN_SHMMAX=34, /* long: Maximum shared memory segment */ KERN_MSGMAX=35, /* int: Maximum size of a messege */ KERN_MSGMNB=36, /* int: Maximum message queue size */ KERN_MSGPOOL=37, /* int: Maximum system message pool size */ @@ -106,7 +106,9 @@ enum KERN_RANDOM=40, /* Random driver */ KERN_SHMALL=41, /* int: Maximum size of shared memory */ KERN_MSGMNI=42, /* int: msg queue identifiers */ - KERN_SEM=43 /* int: sysv semaphore limits */ + KERN_SEM=43, /* struct: sysv semaphore limits */ + KERN_SPARC_STOP_A=44, /* int: Sparc Stop-A enable */ + KERN_SHMMNI=45 /* int: shm array identifiers */ }; diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h index 9c0b764a2..e3dbdd5fd 100644 --- a/include/linux/udf_fs.h +++ b/include/linux/udf_fs.h @@ -30,8 +30,8 @@ #define UDF_DEFAULT_PREALLOC_BLOCKS 8 #define UDF_DEFAULT_PREALLOC_DIR_BLOCKS 0 -#define UDFFS_DATE "99/10/29" -#define UDFFS_VERSION "0.8.9.3" +#define UDFFS_DATE "99/11/18" +#define UDFFS_VERSION "0.8.9.4" #define UDFFS_DEBUG #ifdef UDFFS_DEBUG diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h index d938298a3..b650d7897 100644 --- a/include/linux/ufs_fs.h +++ b/include/linux/ufs_fs.h @@ -563,6 +563,7 @@ extern void ufs_write_super (struct super_block *); /* symlink.c */ extern struct inode_operations ufs_symlink_inode_operations; +extern struct inode_operations ufs_fast_symlink_inode_operations; /* truncate.c */ extern void ufs_truncate (struct inode *); diff --git a/include/linux/umsdos_fs.h b/include/linux/umsdos_fs.h index 395226a23..d4a675e78 100644 --- a/include/linux/umsdos_fs.h +++ b/include/linux/umsdos_fs.h @@ -2,7 +2,7 @@ #define LINUX_UMSDOS_FS_H -#define UMS_DEBUG 1 /* define for check_* functions */ +/*#define UMS_DEBUG 1 // define for check_* functions */ /*#define UMSDOS_DEBUG 1*/ #define UMSDOS_PARANOIA 1 diff --git a/include/linux/umsdos_fs_i.h b/include/linux/umsdos_fs_i.h index 96135ec0f..e123efb10 100644 --- a/include/linux/umsdos_fs_i.h +++ b/include/linux/umsdos_fs_i.h @@ -47,15 +47,13 @@ struct dir_locking_info { * Only one at a time, although one * may recursively lock, so it is a counter */ - long pid; /* pid of the process owning the creation */ - /* lock */ + long pid; /* pid of the process owning the creation + * lock */ }; struct umsdos_inode_info { - union { - struct msdos_inode_info msdos_info; - struct dir_locking_info dir_info; - } u; + struct msdos_inode_info msdos_info; + struct dir_locking_info dir_info; int i_patched; /* Inode has been patched */ int i_is_hlink; /* Resolved hardlink inode? */ unsigned long i_emd_owner; /* Is this the EMD file inode? */ diff --git a/include/linux/videodev.h b/include/linux/videodev.h index f58bf97dd..d9cedda12 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -175,6 +175,7 @@ struct video_window struct video_clip *clips; /* Set only */ int clipcount; #define VIDEO_WINDOW_INTERLACE 1 +#define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */ #define VIDEO_CLIP_BITMAP -1 /* bitmap is 1024x625, a '1' bit represents a clipped pixel */ #define VIDEO_CLIPMAP_SIZE (128 * 625) @@ -353,6 +354,8 @@ struct video_code #define VID_HARDWARE_TRUST 22 /* Trust FM Radio */ #define VID_HARDWARE_TERRATEC 23 /* TerraTec ActiveRadio */ #define VID_HARDWARE_CPIA 24 +#define VID_HARDWARE_ZR36120 25 /* Zoran ZR36120/ZR36125 */ +#define VID_HARDWARE_ZR36067 26 /* Zoran ZR36067/36060 */ /* * Initialiser list diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 0aba8360c..d360d41bc 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -6,6 +6,10 @@ #include <asm/pgtable.h> +/* bits in vm_struct->flags */ +#define VM_IOREMAP 0x00000001 /* ioremap() and friends */ +#define VM_ALLOC 0x00000002 /* vmalloc() */ + struct vm_struct { unsigned long flags; void * addr; @@ -13,7 +17,7 @@ struct vm_struct { struct vm_struct * next; }; -struct vm_struct * get_vm_area(unsigned long size); +struct vm_struct * get_vm_area(unsigned long size, unsigned long flags); void vfree(void * addr); void * vmalloc_prot(unsigned long size, pgprot_t prot); void * vmalloc_uncached(unsigned long size); diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h index 993579d8c..accecf8d2 100644 --- a/include/linux/wanrouter.h +++ b/include/linux/wanrouter.h @@ -363,7 +363,7 @@ typedef struct wan_device struct wan_device* next; /* -> next device */ struct net_device* dev; /* list of network interfaces */ unsigned ndev; /* number of interfaces */ - struct proc_dir_entry dent; /* proc filesystem entry */ + struct proc_dir_entry *dent; /* proc filesystem entry */ } wan_device_t; /* Public functions available for device drivers */ diff --git a/include/linux/wireless.h b/include/linux/wireless.h index acc0619eb..868f812ac 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h @@ -1,7 +1,7 @@ /* * This file define a set of standard wireless extensions * - * Version : 8 28.7.99 + * Version : 9 16.10.99 * * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> */ @@ -63,7 +63,7 @@ * (there is some stuff that will be added in the future...) * I just plan to increment with each new version. */ -#define WIRELESS_EXT 8 +#define WIRELESS_EXT 9 /* * Changes : @@ -96,6 +96,14 @@ * - Changed my e-mail address * - More 802.11 support (nickname, rate, rts, frag) * - List index in frequencies + * + * V8 to V9 + * -------- + * - Support for 'mode of operation' (ad-hoc, managed...) + * - Support for unicast and multicast power saving + * - Change encoding to support larger tokens (>64 bits) + * - Updated iw_params (disable, flags) and use it for NWID + * - Extracted iw_point from iwreq for clarity */ /* -------------------------- IOCTL LIST -------------------------- */ @@ -103,12 +111,12 @@ /* Basic operations */ #define SIOCSIWNAME 0x8B00 /* Unused ??? */ #define SIOCGIWNAME 0x8B01 /* get name */ -#define SIOCSIWNWID 0x8B02 /* set network id */ +#define SIOCSIWNWID 0x8B02 /* set network id (the cell) */ #define SIOCGIWNWID 0x8B03 /* get network id */ #define SIOCSIWFREQ 0x8B04 /* set channel/frequency */ #define SIOCGIWFREQ 0x8B05 /* get channel/frequency */ -#define SIOCSIWENCODE 0x8B06 /* set encoding info */ -#define SIOCGIWENCODE 0x8B07 /* get encoding info */ +#define SIOCSIWMODE 0x8B06 /* set operation mode */ +#define SIOCGIWMODE 0x8B07 /* get operation mode */ #define SIOCSIWSENS 0x8B08 /* set sensitivity */ #define SIOCGIWSENS 0x8B09 /* get sensitivity */ @@ -146,11 +154,18 @@ #define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */ #define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */ +/* Encoding stuff (scrambling, hardware security, WEP...) */ +#define SIOCSIWENCODE 0x8B2A /* set encoding token & mode */ +#define SIOCGIWENCODE 0x8B2B /* get encoding token & mode */ +/* Power saving stuff (power management, unicast and multicast) */ +#define SIOCSIWPOWER 0x8B2C /* set Power Management settings */ +#define SIOCGIWPOWER 0x8B2D /* get Power Management settings */ + /* ------------------------- IOCTL STUFF ------------------------- */ /* The first and the last (range) */ #define SIOCIWFIRST 0x8B00 -#define SIOCIWLAST 0x8B25 +#define SIOCIWLAST 0x8B30 /* Even : get (world access), odd : set (root access) */ #define IW_IS_SET(cmd) (!((cmd) & 0x1)) @@ -200,10 +215,67 @@ /* Maximum size of the ESSID and NICKN strings */ #define IW_ESSID_MAX_SIZE 32 +/* Modes of operation */ +#define IW_MODE_AUTO 0 /* Let the driver decides */ +#define IW_MODE_ADHOC 1 /* Single cell network */ +#define IW_MODE_INFRA 2 /* Multi cell network, roaming, ... */ +#define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */ +#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ +#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ + +/* Maximum number of size of encoding token available + * they are listed in the range structure */ +#define IW_MAX_ENCODING_SIZES 8 + +/* Maximum size of the encoding token in bytes */ +#define IW_ENCODING_TOKEN_MAX 32 /* 256 bits (for now) */ + +/* Flags for encoding (along with the token) */ +#define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */ +#define IW_ENCODE_FLAGS 0xF000 /* Flags defined below */ +#define IW_ENCODE_DISABLED 0x8000 /* Encoding disabled */ +#define IW_ENCODE_ENABLED 0x0000 /* Encoding enabled */ +#define IW_ENCODE_RESTRICTED 0x4000 /* Refuse non-encoded packets */ +#define IW_ENCODE_OPEN 0x2000 /* Accept non-encoded packets */ + +/* Power management flags available (along with the value, if any) */ +#define IW_POWER_ON 0x0000 /* No details... */ +#define IW_POWER_TYPE 0xF000 /* Type of parameter */ +#define IW_POWER_PERIOD 0x1000 /* Value is a period/duration of */ +#define IW_POWER_TIMEOUT 0x2000 /* Value is a timeout (to go asleep) */ +#define IW_POWER_MODE 0x0F00 /* Power Management mode */ +#define IW_POWER_UNICAST_R 0x0100 /* Receive only unicast messages */ +#define IW_POWER_MULTICAST_R 0x0200 /* Receive only multicast messages */ +#define IW_POWER_ALL_R 0x0300 /* Receive all messages though PM */ +#define IW_POWER_FORCE_S 0x0400 /* Force PM procedure for sending unicast */ +#define IW_POWER_REPEATER 0x0800 /* Repeat broadcast messages in PM period */ + /****************************** TYPES ******************************/ /* --------------------------- SUBTYPES --------------------------- */ /* + * Generic format for most parameters that fit in an int + */ +struct iw_param +{ + __s32 value; /* The value of the parameter itself */ + __u8 fixed; /* Hardware should not use auto select */ + __u8 disabled; /* Disable the feature */ + __u16 flags; /* Various specifc flags (if any) */ +}; + +/* + * For all data larger than 16 octets, we need to use a + * pointer to memory alocated in user space. + */ +struct iw_point +{ + caddr_t pointer; /* Pointer to the data (in user space) */ + __u16 length; /* number of fields or size in bytes */ + __u16 flags; /* Optional params */ +}; + +/* * A frequency * For numbers lower than 10^9, we encode the number in 'm' and * set 'e' to 0 @@ -223,7 +295,7 @@ struct iw_freq */ struct iw_quality { - __u8 qual; /* link quality (SNR or better...) */ + __u8 qual; /* link quality (%retries, SNR or better...) */ __u8 level; /* signal level */ __u8 noise; /* noise level */ __u8 updated; /* Flags to know if updated */ @@ -240,33 +312,13 @@ struct iw_discarded __u32 misc; /* Others cases */ }; -/* - * Encoding information (setting and so on) - * Encoding might be hardware encryption, scrambing or others - */ -struct iw_encoding -{ - __u8 method; /* Algorithm number / key used */ - __u64 code; /* Data/key used for algorithm */ -}; - -/* - * Generic format for parameters - */ -struct iw_param -{ - __s32 value; /* The value of the parameter itself */ - __u8 fixed; /* Hardware should not use auto select */ -}; - - /* ------------------------ WIRELESS STATS ------------------------ */ /* * Wireless statistics (used for /proc/net/wireless) */ struct iw_statistics { - __u8 status; /* Status + __u16 status; /* Status * - device dependent for now */ struct iw_quality qual; /* Quality of the link @@ -295,37 +347,28 @@ struct iwreq union { /* Config - generic */ - char name[IFNAMSIZ]; + char name[IFNAMSIZ]; /* Name : used to verify the presence of wireless extensions. * Name of the protocol/provider... */ - struct /* network id (or domain) : used to to */ - { /* create logical channels on the air */ - __u32 nwid; /* value */ - __u8 on; /* active/unactive nwid */ - } nwid; - + struct iw_point essid; /* Extended network name */ + struct iw_param nwid; /* network id (or domain - the cell) */ struct iw_freq freq; /* frequency or channel : * 0-1000 = channel * > 1000 = frequency in Hz */ - struct iw_encoding encoding; /* Encoding stuff */ - - __u32 sensitivity; /* Obsolete, but compatible */ struct iw_param sens; /* signal level threshold */ struct iw_param bitrate; /* default bit rate */ struct iw_param rts; /* RTS threshold threshold */ struct iw_param frag; /* Fragmentation threshold */ + __u32 mode; /* Operation mode */ + + struct iw_point encoding; /* Encoding stuff : tokens */ + struct iw_param power; /* PM duration/timeout */ struct sockaddr ap_addr; /* Access point address */ - struct /* For all data bigger than 16 octets */ - { - caddr_t pointer; /* Pointer to the data - * (in user space) */ - __u16 length; /* fields or byte size */ - __u16 flags; /* Optional params */ - } data; + struct iw_point data; /* Other large parameters */ } u; }; @@ -366,9 +409,6 @@ struct iw_range /* Quality of link & SNR stuff */ struct iw_quality max_qual; /* Quality of the link */ - /* Encoder stuff */ - struct iw_encoding max_encoding; /* Encoding max range */ - /* Rates */ __u8 num_bitrates; /* Number of entries in the list */ __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */ @@ -380,6 +420,17 @@ struct iw_range /* Frag threshold */ __s32 min_frag; /* Minimal frag threshold */ __s32 max_frag; /* Maximal frag threshold */ + + /* Power Management duration & timeout */ + __s32 min_pmd; /* Minimal PM duration */ + __s32 max_pmd; /* Maximal PM duration */ + __s32 min_pmt; /* Minimal PM timeout */ + __s32 max_pmt; /* Maximal PM timeout */ + + /* Encoder stuff */ + __u16 encoding_size[IW_MAX_ENCODING_SIZES]; /* Different token sizes */ + __u8 num_encoding_sizes; /* Number of entry in the list */ + __u8 max_encoding_tokens; /* Max number of tokens */ }; /* diff --git a/include/math-emu/double.h b/include/math-emu/double.h index ee581c2da..04c4c0f45 100644 --- a/include/math-emu/double.h +++ b/include/math-emu/double.h @@ -115,6 +115,7 @@ union _FP_UNION_D #define FP_CMP_EQ_D(r,X,Y) _FP_CMP_EQ(D,2,r,X,Y) #define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg) +#define FP_TO_INT_ROUND_D(r,X,rsz,rsg) _FP_TO_INT_ROUND(D,2,r,X,rsz,rsg) #define FP_FROM_INT_D(X,r,rs,rt) _FP_FROM_INT(D,2,X,r,rs,rt) #define _FP_FRAC_HIGH_D(X) _FP_FRAC_HIGH_2(X) @@ -189,6 +190,7 @@ union _FP_UNION_D #define FP_CMP_EQ_D(r,X,Y) _FP_CMP_EQ(D,1,r,X,Y) #define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,1,r,X,rsz,rsg) +#define FP_TO_INT_ROUND_D(r,X,rsz,rsg) _FP_TO_INT_ROUND(D,1,r,X,rsz,rsg) #define FP_FROM_INT_D(X,r,rs,rt) _FP_FROM_INT(D,1,X,r,rs,rt) #define _FP_FRAC_HIGH_D(X) _FP_FRAC_HIGH_1(X) diff --git a/include/math-emu/extended.h b/include/math-emu/extended.h index 4a1d7e711..ae73cecb3 100644 --- a/include/math-emu/extended.h +++ b/include/math-emu/extended.h @@ -226,6 +226,7 @@ union _FP_UNION_E #define FP_CMP_EQ_E(r,X,Y) _FP_CMP_EQ(E,4,r,X,Y) #define FP_TO_INT_E(r,X,rsz,rsg) _FP_TO_INT(E,4,r,X,rsz,rsg) +#define FP_TO_INT_ROUND_E(r,X,rsz,rsg) _FP_TO_INT_ROUND(E,4,r,X,rsz,rsg) #define FP_FROM_INT_E(X,r,rs,rt) _FP_FROM_INT(E,4,X,r,rs,rt) #define _FP_FRAC_HIGH_E(X) (X##_f[2]) @@ -380,6 +381,7 @@ union _FP_UNION_E #define FP_CMP_EQ_E(r,X,Y) _FP_CMP_EQ(E,2,r,X,Y) #define FP_TO_INT_E(r,X,rsz,rsg) _FP_TO_INT(E,2,r,X,rsz,rsg) +#define FP_TO_INT_ROUND_E(r,X,rsz,rsg) _FP_TO_INT_ROUND(E,2,r,X,rsz,rsg) #define FP_FROM_INT_E(X,r,rs,rt) _FP_FROM_INT(E,2,X,r,rs,rt) #define _FP_FRAC_HIGH_E(X) (X##_f1) diff --git a/include/math-emu/op-2.h b/include/math-emu/op-2.h index ad3fbc538..184eb3c3b 100644 --- a/include/math-emu/op-2.h +++ b/include/math-emu/op-2.h @@ -113,9 +113,9 @@ #define _FP_FRAC_OVERP_2(fs,X) (_FP_FRAC_HIGH_##fs(X) & _FP_OVERFLOW_##fs) #define _FP_FRAC_EQ_2(X, Y) (X##_f1 == Y##_f1 && X##_f0 == Y##_f0) #define _FP_FRAC_GT_2(X, Y) \ - (X##_f1 > Y##_f1 || X##_f1 == Y##_f1 && X##_f0 > Y##_f0) + (X##_f1 > Y##_f1 || (X##_f1 == Y##_f1 && X##_f0 > Y##_f0)) #define _FP_FRAC_GE_2(X, Y) \ - (X##_f1 > Y##_f1 || X##_f1 == Y##_f1 && X##_f0 >= Y##_f0) + (X##_f1 > Y##_f1 || (X##_f1 == Y##_f1 && X##_f0 >= Y##_f0)) #define _FP_ZEROFRAC_2 0, 0 #define _FP_MINFRAC_2 0, 1 diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h index 207aa7738..e03e40e65 100644 --- a/include/math-emu/op-common.h +++ b/include/math-emu/op-common.h @@ -54,6 +54,11 @@ do { \ X##_e -= _FP_EXPBIAS_##fs - 1 + _shift; \ X##_c = FP_CLS_NORMAL; \ FP_SET_EXCEPTION(FP_EX_DENORM); \ + if (FP_DENORM_ZERO) \ + { \ + FP_SET_EXCEPTION(FP_EX_INEXACT); \ + X##_c = FP_CLS_ZERO; \ + } \ } \ break; \ \ @@ -618,6 +623,8 @@ do { \ * 1: the number is required to be -(2^(rsize-1))..(2^(rsize-1))-1, if not, NV is * set plus the result is either -(2^(rsize-1)) or (2^(rsize-1))-1 depending * on the sign in such case. + * 2: the number is required to be -(2^(rsize-1))..(2^(rsize-1))-1, if not, NV is + * set plus the result is truncated to fit into destination. * -1: the number is required to be -(2^(rsize-1))..(2^rsize)-1, if not, NV is * set plus the result is either -(2^(rsize-1)) or (2^(rsize-1))-1 depending * on the sign in such case. @@ -638,12 +645,25 @@ do { \ { /* overflow */ \ case FP_CLS_NAN: \ case FP_CLS_INF: \ - if (rsigned) \ + if (rsigned == 2) \ + { \ + if (X##_c != FP_CLS_NORMAL \ + || X##_e >= rsize - 1 + _FP_WFRACBITS_##fs) \ + r = 0; \ + else \ + { \ + _FP_FRAC_SLL_##wc(X, (X##_e - _FP_WFRACBITS_##fs + 1)); \ + _FP_FRAC_ASSEMBLE_##wc(r, X, rsize); \ + } \ + } \ + else if (rsigned) \ { \ r = 1; \ r <<= rsize - 1; \ r -= 1 - X##_s; \ - } else { \ + } \ + else \ + { \ r = 0; \ if (X##_s) \ r = ~r; \ @@ -678,6 +698,67 @@ do { \ } \ } while (0) +#define _FP_TO_INT_ROUND(fs, wc, r, X, rsize, rsigned) \ + do { \ + r = 0; \ + switch (X##_c) \ + { \ + case FP_CLS_NORMAL: \ + if (X##_e >= _FP_FRACBITS_##fs - 1) \ + { \ + if (X##_e < rsize - 1 + _FP_WFRACBITS_##fs) \ + { \ + if (X##_e >= _FP_WFRACBITS_##fs - 1) \ + { \ + _FP_FRAC_ASSEMBLE_##wc(r, X, rsize); \ + r <<= X##_e - _FP_WFRACBITS_##fs + 1; \ + } \ + else \ + { \ + _FP_FRAC_SRL_##wc(X, _FP_WORKBITS - X##_e \ + + _FP_FRACBITS_##fs - 1); \ + _FP_FRAC_ASSEMBLE_##wc(r, X, rsize); \ + } \ + } \ + } \ + else \ + { \ + if (X##_e <= -_FP_WORKBITS - 1) \ + _FP_FRAC_SET_##wc(X, _FP_MINFRAC_##wc); \ + else \ + _FP_FRAC_SRS_##wc(X, _FP_FRACBITS_##fs - 1 - X##_e, \ + _FP_WFRACBITS_##fs); \ + _FP_ROUND(wc, X); \ + _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \ + _FP_FRAC_ASSEMBLE_##wc(r, X, rsize); \ + } \ + if (rsigned && X##_s) \ + r = -r; \ + if (X##_e >= rsize - (rsigned > 0 || X##_s) \ + || (!rsigned && X##_s)) \ + { /* overflow */ \ + case FP_CLS_NAN: \ + case FP_CLS_INF: \ + if (!rsigned) \ + { \ + r = 0; \ + if (X##_s) \ + r = ~r; \ + } \ + else if (rsigned != 2) \ + { \ + r = 1; \ + r <<= rsize - 1; \ + r -= 1 - X##_s; \ + } \ + FP_SET_EXCEPTION(FP_EX_INVALID); \ + } \ + break; \ + case FP_CLS_ZERO: \ + break; \ + } \ + } while (0) + #define _FP_FROM_INT(fs, wc, X, r, rsize, rtype) \ do { \ if (r) \ diff --git a/include/math-emu/quad.h b/include/math-emu/quad.h index 92a1e2b48..23b20c3e6 100644 --- a/include/math-emu/quad.h +++ b/include/math-emu/quad.h @@ -121,6 +121,7 @@ union _FP_UNION_Q #define FP_CMP_EQ_Q(r,X,Y) _FP_CMP_EQ(Q,4,r,X,Y) #define FP_TO_INT_Q(r,X,rsz,rsg) _FP_TO_INT(Q,4,r,X,rsz,rsg) +#define FP_TO_INT_ROUND_Q(r,X,rsz,rsg) _FP_TO_INT_ROUND(Q,4,r,X,rsz,rsg) #define FP_FROM_INT_Q(X,r,rs,rt) _FP_FROM_INT(Q,4,X,r,rs,rt) #define _FP_FRAC_HIGH_Q(X) _FP_FRAC_HIGH_4(X) @@ -193,6 +194,7 @@ union _FP_UNION_Q #define FP_CMP_EQ_Q(r,X,Y) _FP_CMP_EQ(Q,2,r,X,Y) #define FP_TO_INT_Q(r,X,rsz,rsg) _FP_TO_INT(Q,2,r,X,rsz,rsg) +#define FP_TO_INT_ROUND_Q(r,X,rsz,rsg) _FP_TO_INT_ROUND(Q,2,r,X,rsz,rsg) #define FP_FROM_INT_Q(X,r,rs,rt) _FP_FROM_INT(Q,2,X,r,rs,rt) #define _FP_FRAC_HIGH_Q(X) _FP_FRAC_HIGH_2(X) diff --git a/include/math-emu/single.h b/include/math-emu/single.h index 6504e5283..ea12cb8b0 100644 --- a/include/math-emu/single.h +++ b/include/math-emu/single.h @@ -104,6 +104,7 @@ union _FP_UNION_S #define FP_CMP_EQ_S(r,X,Y) _FP_CMP_EQ(S,1,r,X,Y) #define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg) +#define FP_TO_INT_ROUND_S(r,X,rsz,rsg) _FP_TO_INT_ROUND(S,1,r,X,rsz,rsg) #define FP_FROM_INT_S(X,r,rs,rt) _FP_FROM_INT(S,1,X,r,rs,rt) #define _FP_FRAC_HIGH_S(X) _FP_FRAC_HIGH_1(X) diff --git a/include/math-emu/soft-fp.h b/include/math-emu/soft-fp.h index 3c5072e51..1d1345134 100644 --- a/include/math-emu/soft-fp.h +++ b/include/math-emu/soft-fp.h @@ -24,7 +24,7 @@ #ifndef SOFT_FP_H #define SOFT_FP_H -#include "sfp-machine.h" +#include <asm/sfp-machine.h> /* Allow sfp-machine to have its own byte order definitions. */ #ifndef __BYTE_ORDER @@ -83,6 +83,11 @@ #define FP_HANDLE_EXCEPTIONS do {} while (0) #endif +/* By default we never flush denormal input operands to signed zero. */ +#ifndef FP_DENORM_ZERO +#define FP_DENORM_ZERO 0 +#endif + #ifndef FP_INHIBIT_RESULTS /* By default we write the results always. * sfp-machine may override this and e.g. diff --git a/include/net/ax25.h b/include/net/ax25.h index 96780fc1f..f0c547d0b 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h @@ -286,7 +286,7 @@ extern int ax25_check_iframes_acked(ax25_cb *, unsigned short); /* ax25_route.c */ extern void ax25_rt_device_down(struct net_device *); extern int ax25_rt_ioctl(unsigned int, void *); -extern int ax25_rt_get_info(char *, char **, off_t, int, int); +extern int ax25_rt_get_info(char *, char **, off_t, int); extern int ax25_rt_autobind(ax25_cb *, ax25_address *); extern ax25_route *ax25_rt_find_route(ax25_address *, struct net_device *); extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); @@ -339,7 +339,7 @@ extern unsigned long ax25_display_timer(struct timer_list *); extern int ax25_uid_policy; extern ax25_address *ax25_findbyuid(uid_t); extern int ax25_uid_ioctl(int, struct sockaddr_ax25 *); -extern int ax25_uid_get_info(char *, char **, off_t, int, int); +extern int ax25_uid_get_info(char *, char **, off_t, int); extern void ax25_uid_free(void); /* sysctl_net_ax25.c */ diff --git a/include/net/br.h b/include/net/br.h index 82b79ca5d..14203c061 100644 --- a/include/net/br.h +++ b/include/net/br.h @@ -296,7 +296,6 @@ void requeue_fdb(struct fdb *node, int new_port); struct fdb *br_avl_find_addr(unsigned char addr[6]); struct fdb *br_avl_insert (struct fdb * new_node); void sprintf_avl (char **pbuffer, struct fdb * tree, off_t *pos,int* len, off_t offset, int length); -int br_tree_get_info(char *buffer, char **start, off_t offset, int length, int dummy); void br_avl_delete_by_port(int port); /* externs */ diff --git a/include/net/ip.h b/include/net/ip.h index 0fb977fbd..419078aba 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -22,7 +22,7 @@ #ifndef _IP_H #define _IP_H - +#include <linux/config.h> #include <linux/types.h> #include <linux/socket.h> #include <linux/ip.h> @@ -78,7 +78,7 @@ extern rwlock_t ip_ra_lock; extern void ip_mc_dropsocket(struct sock *); extern void ip_mc_dropdevice(struct net_device *dev); -extern int ip_mc_procinfo(char *, char **, off_t, int, int); +extern int ip_mc_procinfo(char *, char **, off_t, int); /* * Functions provided by ip.c @@ -110,6 +110,22 @@ extern int ip_build_xmit(struct sock *sk, struct rtable *rt, int flags); +/* + * Map a multicast IP onto multicast MAC for type Token Ring. + * This conforms to RFC1469 Option 2 Multicasting i.e. + * using a functional address to transmit / receive + * multicast packets. + */ + +extern __inline__ void ip_tr_mc_map(u32 addr, char *buf) +{ + buf[0]=0xC0; + buf[1]=0x00; + buf[2]=0x00; + buf[3]=0x04; + buf[4]=0x00; + buf[5]=0x00; +} struct ip_reply_arg { struct iovec iov[2]; diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h index d633d0e51..a16d928b3 100644 --- a/include/net/irda/irda_device.h +++ b/include/net/irda/irda_device.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Tue Apr 14 12:41:42 1998 - * Modified at: Tue Oct 19 20:00:03 1999 + * Modified at: Tue Nov 16 12:54:01 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -164,6 +164,7 @@ int irda_device_is_receiving(struct net_device *dev); int irda_device_txqueue_empty(struct net_device *dev); int irda_device_set_raw_mode(struct net_device* self, int status); int irda_device_set_dtr_rts(struct net_device *dev, int dtr, int rts); +int irda_device_change_speed(struct net_device *dev, __u32 speed); int irda_device_setup(struct net_device *dev); /* Dongle interface */ diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h index 8059956fa..0e6a52a0a 100644 --- a/include/net/irda/irlap.h +++ b/include/net/irda/irlap.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Mon Aug 4 20:40:53 1997 - * Modified at: Thu Oct 7 23:06:36 1999 + * Modified at: Tue Nov 16 10:00:36 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, @@ -162,6 +162,8 @@ struct irlap_cb { hashbin_t *discovery_log; discovery_t *discovery_cmd; + __u32 speed; + struct qos_info qos_tx; /* QoS requested by peer */ struct qos_info qos_rx; /* QoS requested by self */ struct qos_info *qos_dev; /* QoS supported by device */ @@ -220,7 +222,7 @@ int irlap_validate_ns_received(struct irlap_cb *, int ns); int irlap_generate_rand_time_slot(int S, int s); void irlap_initiate_connection_state(struct irlap_cb *); void irlap_flush_all_queues(struct irlap_cb *); -void irlap_change_speed(struct irlap_cb *self, __u32 speed); +void irlap_change_speed(struct irlap_cb *self, __u32 speed, int now); void irlap_wait_min_turn_around(struct irlap_cb *, struct qos_info *); void irlap_init_qos_capabilities(struct irlap_cb *, struct qos_info *); diff --git a/include/net/irda/irport.h b/include/net/irda/irport.h index d02bc92b0..ed5e2e92a 100644 --- a/include/net/irda/irport.h +++ b/include/net/irda/irport.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Aug 3 13:49:59 1997 - * Modified at: Sat Oct 30 19:54:07 1999 + * Modified at: Sat Nov 13 23:48:55 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1997, 1998-1999 Dag Brattli <dagb@cs.uit.no> @@ -64,6 +64,7 @@ struct irport_cb { dongle_t *dongle; /* Dongle driver */ __u32 flags; /* Interface flags */ + __u32 new_speed; spinlock_t lock; /* For serializing operations */ @@ -74,6 +75,7 @@ void irport_start(struct irport_cb *self, int iobase); void irport_stop(struct irport_cb *self, int iobase); int irport_probe(int iobase); +int irport_change_speed(struct irda_task *task); void __irport_change_speed(struct irport_cb *self, __u32 speed); void irport_interrupt(int irq, void *dev_id, struct pt_regs *regs); int irport_hard_xmit(struct sk_buff *skb, struct net_device *dev); diff --git a/include/net/irda/irtty.h b/include/net/irda/irtty.h index 5c418c355..757425853 100644 --- a/include/net/irda/irtty.h +++ b/include/net/irda/irtty.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Tue Dec 9 21:13:12 1997 - * Modified at: Mon Oct 18 23:24:31 1999 + * Modified at: Fri Nov 5 10:46:51 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1997, 1999 Dag Brattli, All Rights Reserved. @@ -61,6 +61,8 @@ struct irtty_cb { struct qos_info qos; /* QoS capabilities for this device */ dongle_t *dongle; /* Dongle driver */ + __u32 new_speed; + __u32 flags; /* Interface flags */ INFRARED_MODE mode; diff --git a/include/net/irda/pc87108.h b/include/net/irda/pc87108.h index 7af5c0383..d7b63a38f 100644 --- a/include/net/irda/pc87108.h +++ b/include/net/irda/pc87108.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Fri Nov 13 14:37:40 1998 - * Modified at: Mon Oct 18 15:08:53 1999 + * Modified at: Mon Nov 8 10:00:27 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no> @@ -194,6 +194,7 @@ struct pc87108 { struct qos_info qos; /* QoS capabilities for this device */ __u32 flags; /* Interface flags */ + __u32 new_speed; }; static inline void switch_bank(int iobase, int bank) diff --git a/include/net/irda/toshoboe.h b/include/net/irda/toshoboe.h index 40e781690..96d9f2ec5 100644 --- a/include/net/irda/toshoboe.h +++ b/include/net/irda/toshoboe.h @@ -163,6 +163,7 @@ struct toshoboe_cb struct qos_info qos; /* QoS capabilities for this device */ __u32 flags; /* Interface flags */ + __u32 new_speed; struct pci_dev *pdev; /*PCI device */ int base; /*IO base */ diff --git a/include/net/irda/w83977af_ir.h b/include/net/irda/w83977af_ir.h index e94271e66..afd04bf86 100644 --- a/include/net/irda/w83977af_ir.h +++ b/include/net/irda/w83977af_ir.h @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Paul VanderSpek * Created at: Thu Nov 19 13:55:34 1998 - * Modified at: Fri Oct 15 16:06:46 1999 + * Modified at: Mon Nov 8 10:00:40 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. @@ -181,6 +181,7 @@ struct w83977af_ir { struct qos_info qos; /* QoS capabilities for this device */ __u32 flags; /* Interface flags */ + __u32 new_speed; }; static inline void switch_bank( int iobase, int set) diff --git a/include/net/netrom.h b/include/net/netrom.h index e69d76a01..11aefe5fa 100644 --- a/include/net/netrom.h +++ b/include/net/netrom.h @@ -147,8 +147,8 @@ extern struct net_device *nr_dev_get(ax25_address *); extern int nr_rt_ioctl(unsigned int, void *); extern void nr_link_failed(ax25_cb *, int); extern int nr_route_frame(struct sk_buff *, ax25_cb *); -extern int nr_nodes_get_info(char *, char **, off_t, int, int); -extern int nr_neigh_get_info(char *, char **, off_t, int, int); +extern int nr_nodes_get_info(char *, char **, off_t, int); +extern int nr_neigh_get_info(char *, char **, off_t, int); extern void nr_rt_free(void); /* nr_subr.c */ diff --git a/include/net/rose.h b/include/net/rose.h index a74f132c2..da19fb64f 100644 --- a/include/net/rose.h +++ b/include/net/rose.h @@ -207,9 +207,9 @@ extern struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *, unsign extern int rose_rt_ioctl(unsigned int, void *); extern void rose_link_failed(ax25_cb *, int); extern int rose_route_frame(struct sk_buff *, ax25_cb *); -extern int rose_nodes_get_info(char *, char **, off_t, int, int); -extern int rose_neigh_get_info(char *, char **, off_t, int, int); -extern int rose_routes_get_info(char *, char **, off_t, int, int); +extern int rose_nodes_get_info(char *, char **, off_t, int); +extern int rose_neigh_get_info(char *, char **, off_t, int); +extern int rose_routes_get_info(char *, char **, off_t, int); extern void rose_rt_free(void); /* rose_subr.c */ diff --git a/include/net/sock.h b/include/net/sock.h index 6b05d7107..ead5fc0c3 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -386,6 +386,7 @@ typedef struct { #define sock_lock_init(__sk) \ do { spin_lock_init(&((__sk)->lock.slock)); \ + (__sk)->dst_lock = RW_LOCK_UNLOCKED; \ (__sk)->lock.users = 0; \ init_waitqueue_head(&((__sk)->lock.wq)); \ } while(0); diff --git a/include/net/x25.h b/include/net/x25.h index b2ea4f8b6..3b28c58ce 100644 --- a/include/net/x25.h +++ b/include/net/x25.h @@ -192,7 +192,7 @@ extern struct net_device *x25_get_route(x25_address *); extern struct net_device *x25_dev_get(char *); extern void x25_route_device_down(struct net_device *); extern int x25_route_ioctl(unsigned int, void *); -extern int x25_routes_get_info(char *, char **, off_t, int, int); +extern int x25_routes_get_info(char *, char **, off_t, int); extern void x25_route_free(void); /* x25_subr.c */ diff --git a/include/pcmcia/bulkmem.h b/include/pcmcia/bulkmem.h index 09f0a4ddd..dcc84bf04 100644 --- a/include/pcmcia/bulkmem.h +++ b/include/pcmcia/bulkmem.h @@ -192,4 +192,16 @@ extern int MTDHelperEntry(int func, void *a1, void *a2); extern int MTDHelperEntry(int func, ...); #endif +int pcmcia_get_first_region(client_handle_t handle, region_info_t *rgn); +int pcmcia_get_next_region(client_handle_t handle, region_info_t *rgn); +int pcmcia_register_mtd(client_handle_t handle, mtd_reg_t *reg); +int pcmcia_register_erase_queue(client_handle_t *handle, eraseq_hdr_t *header); +int pcmcia_deregister_erase_queue(eraseq_handle_t eraseq); +int pcmcia_check_erase_queue(eraseq_handle_t eraseq); +int pcmcia_open_memory(client_handle_t *handle, open_mem_t *open); +int pcmcia_close_memory(memory_handle_t handle); +int pcmcia_read_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf); +int pcmcia_write_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf); +int pcmcia_copy_memory(memory_handle_t handle, copy_op_t *req); + #endif /* _LINUX_BULKMEM_H */ diff --git a/include/pcmcia/bus_ops.h b/include/pcmcia/bus_ops.h index bdbd34312..29e13547a 100644 --- a/include/pcmcia/bus_ops.h +++ b/include/pcmcia/bus_ops.h @@ -30,6 +30,8 @@ #ifndef _LINUX_BUS_OPS_H #define _LINUX_BUS_OPS_H +#include <linux/config.h> + #ifdef CONFIG_VIRTUAL_BUS typedef struct bus_operations { diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h index 9ab70257c..00412858e 100644 --- a/include/pcmcia/cistpl.h +++ b/include/pcmcia/cistpl.h @@ -580,4 +580,12 @@ typedef struct cisdump_t { cisdata_t Data[CISTPL_MAX_CIS_SIZE]; } cisdump_t; +int pcmcia_get_first_tuple(client_handle_t handle, tuple_t *tuple); +int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple); +int pcmcia_get_tuple_data(client_handle_t handle, tuple_t *tuple); +int pcmcia_parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse); + +int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info); +int pcmcia_replace_cis(client_handle_t handle, cisdump_t *cis); + #endif /* LINUX_CISTPL_H */ diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index bd9968630..8a67a6f98 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -440,6 +440,42 @@ extern int CardServices(int func, void *a1, void *a2, void *a3); extern int CardServices(int func, ...); #endif +int pcmcia_access_configuration_register(client_handle_t handle, conf_reg_t *reg); +int pcmcia_bind_device(bind_req_t *req); +int pcmcia_bind_mtd(mtd_bind_t *req); +int pcmcia_deregister_client(client_handle_t handle); +int pcmcia_get_configuration_info(client_handle_t handle, config_info_t *config); +int pcmcia_get_card_services_info(servinfo_t *info); +int pcmcia_get_first_client(client_handle_t *handle, client_req_t *req); +int pcmcia_get_next_client(client_handle_t *handle, client_req_t *req); +int pcmcia_get_window(window_handle_t *handle, int idx, win_req_t *req); +int pcmcia_get_first_window(client_handle_t *handle, win_req_t *req); +int pcmcia_get_next_window(window_handle_t *win, win_req_t *req); +int pcmcia_get_status(client_handle_t handle, cs_status_t *status); +int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); +int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); +int pcmcia_modify_configuration(client_handle_t handle, modconf_t *mod); +int pcmcia_modify_window(window_handle_t win, modwin_t *req); +int pcmcia_register_client(client_handle_t *handle, client_reg_t *req); +int pcmcia_release_configuration(client_handle_t handle); +int pcmcia_release_io(client_handle_t handle, io_req_t *req); +int pcmcia_release_irq(client_handle_t handle, irq_req_t *req); +int pcmcia_release_window(window_handle_t win); +int pcmcia_request_configuration(client_handle_t handle, config_req_t *req); +int pcmcia_request_io(client_handle_t handle, io_req_t *req); +int pcmcia_request_irq(client_handle_t handle, irq_req_t *req); +int pcmcia_request_window(client_handle_t *handle, win_req_t *req); +int pcmcia_reset_card(client_handle_t handle, client_req_t *req); +int pcmcia_suspend_card(client_handle_t handle, client_req_t *req); +int pcmcia_resume_card(client_handle_t handle, client_req_t *req); +int pcmcia_eject_card(client_handle_t handle, client_req_t *req); +int pcmcia_insert_card(client_handle_t handle, client_req_t *req); +int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask); +int pcmcia_report_error(client_handle_t handle, error_info_t *err); + +/* rsrc_mgr.c */ +int pcmcia_adjust_resource_info(client_handle_t handle, adjust_t *adj); + #endif /* __KERNEL__ */ #endif /* _LINUX_CS_H */ diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 086ad3681..76e63aa75 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -73,7 +73,11 @@ #define LOG_SELECT 0x4c #define LOG_SENSE 0x4d #define MODE_SELECT_10 0x55 +#define RESERVE_10 0x56 +#define RELEASE_10 0x57 #define MODE_SENSE_10 0x5a +#define PERSISTENT_RESERVE_IN 0x5e +#define PERSISTENT_RESERVE_OUT 0x5f #define MOVE_MEDIUM 0xa5 #define READ_12 0xa8 #define WRITE_12 0xaa diff --git a/include/video/fbcon.h b/include/video/fbcon.h index 1cca4c90f..7ceb380ab 100644 --- a/include/video/fbcon.h +++ b/include/video/fbcon.h @@ -44,6 +44,67 @@ struct display_switch { extern struct display_switch fbcon_dummy; + /* + * This is the interface between the low-level console driver and the + * low-level frame buffer device + */ + +struct display { + /* Filled in by the frame buffer device */ + + struct fb_var_screeninfo var; /* variable infos. yoffset and vmode */ + /* are updated by fbcon.c */ + struct fb_cmap cmap; /* colormap */ + char *screen_base; /* pointer to top of virtual screen */ + /* (virtual address) */ + int visual; + int type; /* see FB_TYPE_* */ + int type_aux; /* Interleave for interleaved Planes */ + u_short ypanstep; /* zero if no hardware ypan */ + u_short ywrapstep; /* zero if no hardware ywrap */ + u_long line_length; /* length of a line in bytes */ + u_short can_soft_blank; /* zero if no hardware blanking */ + u_short inverse; /* != 0 text black on white as default */ + struct display_switch *dispsw; /* low level operations */ + void *dispsw_data; /* optional dispsw helper data */ + +#if 0 + struct fb_fix_cursorinfo fcrsr; + struct fb_var_cursorinfo *vcrsr; + struct fb_cursorstate crsrstate; +#endif + + /* Filled in by the low-level console driver */ + + struct vc_data *conp; /* pointer to console data */ + struct fb_info *fb_info; /* frame buffer for this console */ + int vrows; /* number of virtual rows */ + unsigned short cursor_x; /* current cursor position */ + unsigned short cursor_y; + int fgcol; /* text colors */ + int bgcol; + u_long next_line; /* offset to one line below */ + u_long next_plane; /* offset to next plane */ + u_char *fontdata; /* Font associated to this display */ + unsigned short _fontheightlog; + unsigned short _fontwidthlog; + unsigned short _fontheight; + unsigned short _fontwidth; + int userfont; /* != 0 if fontdata kmalloc()ed */ + u_short scrollmode; /* Scroll Method */ + short yscroll; /* Hardware scrolling */ + unsigned char fgshift, bgshift; + unsigned short charmask; /* 0xff or 0x1ff */ +}; + +/* drivers/video/fbcon.c */ +extern struct display fb_display[MAX_NR_CONSOLES]; +extern char con2fb_map[MAX_NR_CONSOLES]; +extern int PROC_CONSOLE(const struct fb_info *info); +extern void set_con2fb_map(int unit, int newidx); +extern int set_all_vcs(int fbidx, struct fb_ops *fb, + struct fb_var_screeninfo *var, struct fb_info *info); + #define fontheight(p) ((p)->_fontheight) #define fontheightlog(p) ((p)->_fontheightlog) |