diff options
Diffstat (limited to 'include')
336 files changed, 9764 insertions, 2676 deletions
diff --git a/include/asm-alpha/atomic.h b/include/asm-alpha/atomic.h index 16366d055..2dccf3521 100644 --- a/include/asm-alpha/atomic.h +++ b/include/asm-alpha/atomic.h @@ -15,7 +15,7 @@ typedef struct { volatile int counter; } atomic_t; typedef struct { int counter; } atomic_t; #endif -#define ATOMIC_INIT(i) { (i) } +#define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) #define atomic_read(v) ((v)->counter) #define atomic_set(v,i) ((v)->counter = (i)) diff --git a/include/asm-alpha/core_apecs.h b/include/asm-alpha/core_apecs.h index a8f0bd6ef..3346346f9 100644 --- a/include/asm-alpha/core_apecs.h +++ b/include/asm-alpha/core_apecs.h @@ -458,7 +458,7 @@ __EXTERN_INLINE unsigned int apecs_inb(unsigned long addr) __EXTERN_INLINE void apecs_outb(unsigned char b, unsigned long addr) { - unsigned int w; + unsigned long w; w = __kernel_insbl(b, addr & 3); *(vuip) ((addr << 5) + APECS_IO + 0x00) = w; @@ -473,7 +473,7 @@ __EXTERN_INLINE unsigned int apecs_inw(unsigned long addr) __EXTERN_INLINE void apecs_outw(unsigned short b, unsigned long addr) { - unsigned int w; + unsigned long w; w = __kernel_inswl(b, addr & 3); *(vuip) ((addr << 5) + APECS_IO + 0x08) = w; diff --git a/include/asm-alpha/core_cia.h b/include/asm-alpha/core_cia.h index 32fd81f2e..3407d0159 100644 --- a/include/asm-alpha/core_cia.h +++ b/include/asm-alpha/core_cia.h @@ -326,9 +326,9 @@ __EXTERN_INLINE unsigned int cia_inb(unsigned long addr) __EXTERN_INLINE void cia_outb(unsigned char b, unsigned long addr) { - unsigned int w = __kernel_insbl(b, addr & 3); + unsigned long w = __kernel_insbl(b, addr & 3); *(vuip) ((addr << 5) + CIA_IO + 0x00) = w; - wmb(); + mb(); } __EXTERN_INLINE unsigned int cia_inw(unsigned long addr) @@ -340,9 +340,9 @@ __EXTERN_INLINE unsigned int cia_inw(unsigned long addr) __EXTERN_INLINE void cia_outw(unsigned short b, unsigned long addr) { - unsigned int w = __kernel_inswl(b, addr & 3); + unsigned long w = __kernel_inswl(b, addr & 3); *(vuip) ((addr << 5) + CIA_IO + 0x08) = w; - wmb(); + mb(); } __EXTERN_INLINE unsigned int cia_inl(unsigned long addr) @@ -353,7 +353,7 @@ __EXTERN_INLINE unsigned int cia_inl(unsigned long addr) __EXTERN_INLINE void cia_outl(unsigned int b, unsigned long addr) { *(vuip) ((addr << 5) + CIA_IO + 0x18) = b; - wmb(); + mb(); } diff --git a/include/asm-alpha/core_lca.h b/include/asm-alpha/core_lca.h index bce449fa4..63f258924 100644 --- a/include/asm-alpha/core_lca.h +++ b/include/asm-alpha/core_lca.h @@ -262,7 +262,7 @@ __EXTERN_INLINE unsigned int lca_inb(unsigned long addr) __EXTERN_INLINE void lca_outb(unsigned char b, unsigned long addr) { - unsigned int w; + unsigned long w; w = __kernel_insbl(b, addr & 3); *(vuip) ((addr << 5) + LCA_IO + 0x00) = w; @@ -277,7 +277,7 @@ __EXTERN_INLINE unsigned int lca_inw(unsigned long addr) __EXTERN_INLINE void lca_outw(unsigned short b, unsigned long addr) { - unsigned int w; + unsigned long w; w = __kernel_inswl(b, addr & 3); *(vuip) ((addr << 5) + LCA_IO + 0x08) = w; @@ -340,7 +340,7 @@ __EXTERN_INLINE unsigned long lca_readq(unsigned long addr) __EXTERN_INLINE void lca_writeb(unsigned char b, unsigned long addr) { unsigned long msb; - unsigned int w; + unsigned long w; if (addr >= (1UL << 24)) { msb = addr & 0xf8000000; @@ -354,7 +354,7 @@ __EXTERN_INLINE void lca_writeb(unsigned char b, unsigned long addr) __EXTERN_INLINE void lca_writew(unsigned short b, unsigned long addr) { unsigned long msb; - unsigned int w; + unsigned long w; if (addr >= (1UL << 24)) { msb = addr & 0xf8000000; diff --git a/include/asm-alpha/core_mcpcia.h b/include/asm-alpha/core_mcpcia.h index 33e67b462..84eab12d8 100644 --- a/include/asm-alpha/core_mcpcia.h +++ b/include/asm-alpha/core_mcpcia.h @@ -71,9 +71,7 @@ * */ -#define MCPCIA_MEM_R1_MASK 0x1fffffff /* SPARSE Mem region 1 mask is 29 bits */ -#define MCPCIA_MEM_R2_MASK 0x07ffffff /* SPARSE Mem region 2 mask is 27 bits */ -#define MCPCIA_MEM_R3_MASK 0x03ffffff /* SPARSE Mem region 3 mask is 26 bits */ +#define MCPCIA_MEM_MASK 0x07ffffff /* SPARSE Mem region mask is 27 bits */ #define MCPCIA_DMA_WIN_BASE_DEFAULT (2*1024*1024*1024U) #define MCPCIA_DMA_WIN_SIZE_DEFAULT (2*1024*1024*1024U) @@ -264,7 +262,7 @@ __EXTERN_INLINE void mcpcia_outb(unsigned char b, unsigned long in_addr) { unsigned long addr = in_addr & 0xffffffffUL; unsigned long hose = (in_addr >> 32) & 3; - unsigned int w; + unsigned long w; w = __kernel_insbl(b, addr & 3); *(vuip) ((addr << 5) + MCPCIA_IO(hose) + 0x00) = w; @@ -283,7 +281,7 @@ __EXTERN_INLINE void mcpcia_outw(unsigned short b, unsigned long in_addr) { unsigned long addr = in_addr & 0xffffffffUL; unsigned long hose = (in_addr >> 32) & 3; - unsigned int w; + unsigned long w; w = __kernel_inswl(b, addr & 3); *(vuip) ((addr << 5) + MCPCIA_IO(hose) + 0x08) = w; @@ -386,23 +384,10 @@ __EXTERN_INLINE unsigned long mcpcia_srm_base(unsigned long addr) unsigned long hose = (addr >> 32) & 3; if (addr >= alpha_mv.sm_base_r1 - && addr <= alpha_mv.sm_base_r1 + MCPCIA_MEM_R1_MASK) { - mask = MCPCIA_MEM_R1_MASK; + && addr <= alpha_mv.sm_base_r1 + MCPCIA_MEM_MASK) { + mask = MCPCIA_MEM_MASK; base = MCPCIA_SPARSE(hose); } -#if 0 - /* FIXME FIXME FIXME: SPARSE_MEM_R2 and R3 are not defined? */ - else if (addr >= alpha_mv.sm_base_r2 - && addr <= alpha_mv.sm_base_r2 + MCPCIA_MEM_R2_MASK) { - mask = MCPCIA_MEM_R2_MASK; - base = MCPCIA_SPARSE_MEM_R2; - } - else if (addr >= alpha_mv.sm_base_r3 - && addr <= alpha_mv.sm_base_r3 + MCPCIA_MEM_R3_MASK) { - mask = MCPCIA_MEM_R3_MASK; - base = MCPCIA_SPARSE_MEM_R3; - } -#endif else { #if 0 @@ -462,8 +447,8 @@ __EXTERN_INLINE unsigned long mcpcia_readb(unsigned long in_addr) unsigned long hose = (in_addr >> 32) & 3; unsigned long result, msb, work, temp; - msb = addr & 0xE0000000UL; - temp = addr & MCPCIA_MEM_R1_MASK; + msb = addr & ~MCPCIA_MEM_MASK; + temp = addr & MCPCIA_MEM_MASK; set_hae(msb); work = ((temp << 5) + MCPCIA_SPARSE(hose) + 0x00); @@ -477,8 +462,8 @@ __EXTERN_INLINE unsigned long mcpcia_readw(unsigned long in_addr) unsigned long hose = (in_addr >> 32) & 3; unsigned long result, msb, work, temp; - msb = addr & 0xE0000000UL; - temp = addr & MCPCIA_MEM_R1_MASK ; + msb = addr & ~MCPCIA_MEM_MASK; + temp = addr & MCPCIA_MEM_MASK ; set_hae(msb); work = ((temp << 5) + MCPCIA_SPARSE(hose) + 0x08); @@ -492,8 +477,8 @@ __EXTERN_INLINE void mcpcia_writeb(unsigned char b, unsigned long in_addr) unsigned long hose = (in_addr >> 32) & 3; unsigned long msb; - msb = addr & 0xE0000000; - addr &= MCPCIA_MEM_R1_MASK; + msb = addr & ~MCPCIA_MEM_MASK; + addr &= MCPCIA_MEM_MASK; set_hae(msb); *(vuip) ((addr << 5) + MCPCIA_SPARSE(hose) + 0x00) = b * 0x01010101; @@ -505,8 +490,8 @@ __EXTERN_INLINE void mcpcia_writew(unsigned short b, unsigned long in_addr) unsigned long hose = (in_addr >> 32) & 3; unsigned long msb ; - msb = addr & 0xE0000000 ; - addr &= MCPCIA_MEM_R1_MASK ; + msb = addr & ~MCPCIA_MEM_MASK ; + addr &= MCPCIA_MEM_MASK ; set_hae(msb); *(vuip) ((addr << 5) + MCPCIA_SPARSE(hose) + 0x08) = b * 0x00010001; diff --git a/include/asm-alpha/core_polaris.h b/include/asm-alpha/core_polaris.h new file mode 100644 index 000000000..8caf50622 --- /dev/null +++ b/include/asm-alpha/core_polaris.h @@ -0,0 +1,241 @@ +#ifndef __ALPHA_POLARIS__H__ +#define __ALPHA_POLARIS__H__ + +#include <linux/config.h> +#include <linux/types.h> +#include <asm/compiler.h> + +/* + * POLARIS is the internal name for a core logic chipset which provides + * memory controller and PCI access for the 21164PC chip based systems. + * + * This file is based on: + * + * Polaris System Controller + * Device Functional Specification + * 22-Jan-98 + * Rev. 4.2 + * + */ + +/* Polaris memory regions */ +#define POLARIS_SPARSE_MEM_BASE (IDENT_ADDR + 0xf800000000) +#define POLARIS_DENSE_MEM_BASE (IDENT_ADDR + 0xf900000000) +#define POLARIS_SPARSE_IO_BASE (IDENT_ADDR + 0xf980000000) +#define POLARIS_SPARSE_CONFIG_BASE (IDENT_ADDR + 0xf9c0000000) +#define POLARIS_IACK_BASE (IDENT_ADDR + 0xf9f8000000) +#define POLARIS_DENSE_IO_BASE (IDENT_ADDR + 0xf9fc000000) +#define POLARIS_DENSE_CONFIG_BASE (IDENT_ADDR + 0xf9fe000000) + +#define POLARIS_IACK_SC POLARIS_IACK_BASE + +/* The Polaris command/status registers live in PCI Config space for + * bus 0/device 0. As such, they may be bytes, words, or doublewords. + */ +#define POLARIS_W_VENID (POLARIS_DENSE_CONFIG_BASE) +#define POLARIS_W_DEVID (POLARIS_DENSE_CONFIG_BASE+2) +#define POLARIS_W_CMD (POLARIS_DENSE_CONFIG_BASE+4) +#define POLARIS_W_STATUS (POLARIS_DENSE_CONFIG_BASE+6) + +/* No HAE address. Polaris has no concept of an HAE, since it + * supports transfers of all sizes in dense space. + */ + +#define POLARIS_DMA_WIN_BASE_DEFAULT 0x80000000 /* fixed, 2G @ 2G */ +#define POLARIS_DMA_WIN_SIZE_DEFAULT 0x80000000 /* fixed, 2G @ 2G */ + +#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM_SETUP) +#define POLARIS_DMA_WIN_BASE alpha_mv.dma_win_base +#define POLARIS_DMA_WIN_SIZE alpha_mv.dma_win_size +#else +#define POLARIS_DMA_WIN_BASE POLARIS_DMA_WIN_BASE_DEFAULT +#define POLARIS_DMA_WIN_SIZE POLARIS_DMA_WIN_SIZE_DEFAULT +#endif + +/* + * Data structure for handling POLARIS machine checks: + */ +struct el_POLARIS_sysdata_mcheck { + u_long psc_status; + u_long psc_pcictl0; + u_long psc_pcictl1; + u_long psc_pcictl2; +}; + + #ifdef __KERNEL__ + +#ifndef __EXTERN_INLINE +#define __EXTERN_INLINE extern inline +#define __IO_EXTERN_INLINE +#endif + +__EXTERN_INLINE unsigned long polaris_virt_to_bus(void * address) +{ + return virt_to_phys(address) + POLARIS_DMA_WIN_BASE; +} + +__EXTERN_INLINE void * polaris_bus_to_virt(unsigned long address) +{ + return phys_to_virt(address - POLARIS_DMA_WIN_BASE); +} + +/* + * I/O functions: + * + * POLARIS, the PCI/memory support chipset for the PCA56 (21164PC) + * processors, can use either a sparse address mapping scheme, or the + * so-called byte-word PCI address space, to get at PCI memory and I/O. + * + * However, we will support only the BWX form. + */ + +#define vucp volatile unsigned char * +#define vusp volatile unsigned short * +#define vuip volatile unsigned int * +#define vulp volatile unsigned long * + +__EXTERN_INLINE unsigned int polaris_inb(unsigned long addr) +{ + return __kernel_ldbu(*(vucp)(addr + POLARIS_DENSE_IO_BASE)); +} + +__EXTERN_INLINE void polaris_outb(unsigned char b, unsigned long addr) +{ + __kernel_stb(b, *(vucp)(addr + POLARIS_DENSE_IO_BASE)); + mb(); +} + +__EXTERN_INLINE unsigned int polaris_inw(unsigned long addr) +{ + return __kernel_ldwu(*(vusp)(addr + POLARIS_DENSE_IO_BASE)); +} + +__EXTERN_INLINE void polaris_outw(unsigned short b, unsigned long addr) +{ + __kernel_stw(b, *(vusp)(addr + POLARIS_DENSE_IO_BASE)); + mb(); +} + +__EXTERN_INLINE unsigned int polaris_inl(unsigned long addr) +{ + return *(vuip)(addr + POLARIS_DENSE_IO_BASE); +} + +__EXTERN_INLINE void polaris_outl(unsigned int b, unsigned long addr) +{ + *(vuip)(addr + POLARIS_DENSE_IO_BASE) = b; + mb(); +} + +/* + * Memory functions. Polaris allows all accesses (byte/word + * as well as long/quad) to be done through dense space. + * + * We will only support DENSE access via BWX insns. + */ + +__EXTERN_INLINE unsigned long polaris_readb(unsigned long addr) +{ + return __kernel_ldbu(*(vucp)(addr + POLARIS_DENSE_MEM_BASE)); +} + +__EXTERN_INLINE unsigned long polaris_readw(unsigned long addr) +{ + return __kernel_ldwu(*(vusp)(addr + POLARIS_DENSE_MEM_BASE)); +} + +__EXTERN_INLINE unsigned long polaris_readl(unsigned long addr) +{ + return *(vuip)(addr + POLARIS_DENSE_MEM_BASE); +} + +__EXTERN_INLINE unsigned long polaris_readq(unsigned long addr) +{ + return *(vulp)(addr + POLARIS_DENSE_MEM_BASE); +} + +__EXTERN_INLINE void polaris_writeb(unsigned char b, unsigned long addr) +{ + __kernel_stb(b, *(vucp)(addr + POLARIS_DENSE_MEM_BASE)); + mb(); +} + +__EXTERN_INLINE void polaris_writew(unsigned short b, unsigned long addr) +{ + __kernel_stw(b, *(vusp)(addr + POLARIS_DENSE_MEM_BASE)); + mb(); +} + +__EXTERN_INLINE void polaris_writel(unsigned int b, unsigned long addr) +{ + *(vuip)(addr + POLARIS_DENSE_MEM_BASE) = b; + mb(); +} + +__EXTERN_INLINE void polaris_writeq(unsigned long b, unsigned long addr) +{ + *(vulp)(addr + POLARIS_DENSE_MEM_BASE) = b; + mb(); +} + +/* Find the DENSE memory area for a given bus address. */ + +__EXTERN_INLINE unsigned long polaris_dense_mem(unsigned long addr) +{ + return POLARIS_DENSE_MEM_BASE; +} + +#undef vucp +#undef vusp +#undef vuip +#undef vulp + +#ifdef __WANT_IO_DEF + +#define virt_to_bus polaris_virt_to_bus +#define bus_to_virt polaris_bus_to_virt + +#define __inb polaris_inb +#define __inw polaris_inw +#define __inl polaris_inl +#define __outb polaris_outb +#define __outw polaris_outw +#define __outl polaris_outl +#define __readb polaris_readb +#define __readw polaris_readw +#define __writeb polaris_writeb +#define __writew polaris_writew +#define __readl polaris_readl +#define __readq polaris_readq +#define __writel polaris_writel +#define __writeq polaris_writeq +#define dense_mem polaris_dense_mem + +#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 readb(a) __readb((unsigned long)(a)) +#define readw(a) __readw((unsigned long)(a)) +#define readl(a) __readl((unsigned long)(a)) +#define readq(a) __readq((unsigned long)(a)) + +#define writeb(v,a) __writeb((v),(unsigned long)(a)) +#define writew(v,a) __writew((v),(unsigned long)(a)) +#define writel(v,a) __writel((v),(unsigned long)(a)) +#define 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_POLARIS__H__ */ diff --git a/include/asm-alpha/core_pyxis.h b/include/asm-alpha/core_pyxis.h index da80e501e..213adf4ba 100644 --- a/include/asm-alpha/core_pyxis.h +++ b/include/asm-alpha/core_pyxis.h @@ -326,7 +326,7 @@ __EXTERN_INLINE unsigned int pyxis_inb(unsigned long addr) __EXTERN_INLINE void pyxis_outb(unsigned char b, unsigned long addr) { - unsigned int w; + unsigned long w; w = __kernel_insbl(b, addr & 3); *(vuip) ((addr << 5) + PYXIS_IO + 0x00) = w; @@ -341,7 +341,7 @@ __EXTERN_INLINE unsigned int pyxis_inw(unsigned long addr) __EXTERN_INLINE void pyxis_outw(unsigned short b, unsigned long addr) { - unsigned int w; + unsigned long w; w = __kernel_inswl(b, addr & 3); *(vuip) ((addr << 5) + PYXIS_IO + 0x08) = w; diff --git a/include/asm-alpha/core_t2.h b/include/asm-alpha/core_t2.h index 1f0984b38..fdb0f82fe 100644 --- a/include/asm-alpha/core_t2.h +++ b/include/asm-alpha/core_t2.h @@ -378,7 +378,7 @@ __EXTERN_INLINE unsigned int t2_inw(unsigned long addr) __EXTERN_INLINE void t2_outw(unsigned short b, unsigned long addr) { - unsigned int w; + unsigned long w; w = __kernel_inswl(b, addr & 3); *(vuip) ((addr << 5) + T2_IO + 0x08) = w; diff --git a/include/asm-alpha/core_tsunami.h b/include/asm-alpha/core_tsunami.h index ee62c175f..68d30cf86 100644 --- a/include/asm-alpha/core_tsunami.h +++ b/include/asm-alpha/core_tsunami.h @@ -16,8 +16,8 @@ * */ -#define TSUNAMI_DMA_WIN_BASE_DEFAULT (1024*1024*1024) -#define TSUNAMI_DMA_WIN_SIZE_DEFAULT (1024*1024*1024) +#define TSUNAMI_DMA_WIN_BASE_DEFAULT (1024*1024*1024U) +#define TSUNAMI_DMA_WIN_SIZE_DEFAULT (1024*1024*1024U) #if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM_SETUP) #define TSUNAMI_DMA_WIN_BASE alpha_mv.dma_win_base diff --git a/include/asm-alpha/delay.h b/include/asm-alpha/delay.h index 87e69f657..a55752abb 100644 --- a/include/asm-alpha/delay.h +++ b/include/asm-alpha/delay.h @@ -1,7 +1,7 @@ #ifndef __ALPHA_DELAY_H #define __ALPHA_DELAY_H -extern unsigned long loops_per_sec; +#include <asm/smp.h> /* * Copyright (C) 1993 Linus Torvalds @@ -9,7 +9,8 @@ extern unsigned long loops_per_sec; * Delay routines, using a pre-computed "loops_per_second" value. */ -extern __inline__ void __delay(unsigned long loops) +extern __inline__ void +__delay(unsigned long loops) { __asm__ __volatile__(".align 3\n" "1:\tsubq %0,1,%0\n\t" @@ -24,15 +25,46 @@ extern __inline__ void __delay(unsigned long loops) * lookup table, really, as the multiplications take much too long with * short delays. This is a "reasonable" implementation, though (and the * first constant multiplications gets optimized away if the delay is - * a constant) + * a constant). + * + * Optimize small constants further by exposing the second multiplication + * to the compiler. In addition, mulq is 2 cycles faster than umulh. */ -extern __inline__ void udelay(unsigned long usecs) + +extern __inline__ void +__udelay(unsigned long usecs, unsigned long lps) { + /* compute (usecs * 2**64 / 10**6) * loops_per_sec / 2**64 */ + usecs *= 0x000010c6f7a0b5edUL; /* 2**64 / 1000000 */ - __asm__("umulh %1,%2,%0" - :"=r" (usecs) - :"r" (usecs),"r" (loops_per_sec)); + __asm__("umulh %1,%2,%0" :"=r" (usecs) :"r" (usecs),"r" (lps)); + __delay(usecs); +} + +extern __inline__ void +__small_const_udelay(unsigned long usecs, unsigned long lps) +{ + /* compute (usecs * 2**32 / 10**6) * loops_per_sec / 2**32 */ + + usecs *= 0x10c6; /* 2^32 / 10^6 */ + usecs *= lps; + usecs >>= 32; __delay(usecs); } +#ifdef __SMP__ +#define udelay(usecs) \ + (__builtin_constant_p(usecs) && usecs < 0x100000000UL \ + ? __small_const_udelay(usecs, \ + cpu_data[smp_processor_id()].loops_per_sec) \ + : __udelay(usecs, \ + cpu_data[smp_processor_id()].loops_per_sec)) +#else +#define udelay(usecs) \ + (__builtin_constant_p(usecs) && usecs < 0x100000000UL \ + ? __small_const_udelay(usecs, loops_per_sec) \ + : __udelay(usecs, loops_per_sec)) +#endif + + #endif /* defined(__ALPHA_DELAY_H) */ diff --git a/include/asm-alpha/dma.h b/include/asm-alpha/dma.h index f16bdc6de..d415b2a7e 100644 --- a/include/asm-alpha/dma.h +++ b/include/asm-alpha/dma.h @@ -173,6 +173,8 @@ #define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */ #define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */ +#define DMA_AUTOINIT 0x10 + extern spinlock_t dma_spin_lock; static __inline__ unsigned long claim_dma_lock(void) @@ -342,4 +344,12 @@ extern void free_dma(unsigned int dmanr); /* release it again */ #define KERNEL_HAVE_CHECK_DMA extern int check_dma(unsigned int dmanr); +/* From PCI */ + +#ifdef CONFIG_PCI_QUIRKS +extern int isa_dma_bridge_buggy; +#else +#define isa_dma_bridge_buggy (0) +#endif + #endif /* _ASM_DMA_H */ diff --git a/include/asm-alpha/init.h b/include/asm-alpha/init.h index 7d769dfcd..f4a08c9f2 100644 --- a/include/asm-alpha/init.h +++ b/include/asm-alpha/init.h @@ -12,4 +12,6 @@ #define __FINIT .previous #define __INITDATA .section .data.init,"a" +#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES))) + #endif diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h index 51d2af596..3074ba8fb 100644 --- a/include/asm-alpha/io.h +++ b/include/asm-alpha/io.h @@ -3,7 +3,6 @@ #include <linux/config.h> #include <asm/system.h> -#include <asm/machvec.h> /* We don't use IO slowdowns on the Alpha, but.. */ #define __SLOW_DOWN_IO do { } while (0) @@ -19,6 +18,7 @@ #endif #ifdef __KERNEL__ +#include <asm/machvec.h> /* * We try to avoid hae updates (thus the cache), but when we @@ -78,6 +78,7 @@ extern void _sethae (unsigned long addr); /* cached version */ * There are different chipsets to interface the Alpha CPUs to the world. */ +#ifdef __KERNEL__ #ifdef CONFIG_ALPHA_GENERIC /* In a generic kernel, we always go through the machine vector. */ @@ -140,6 +141,8 @@ extern void _sethae (unsigned long addr); /* cached version */ # include <asm/core_tsunami.h> #elif defined(CONFIG_ALPHA_JENSEN) # include <asm/jensen.h> +#elif defined(CONFIG_ALPHA_RX164) +# include <asm/core_polaris.h> #else #error "What system is this?" #endif @@ -147,6 +150,7 @@ extern void _sethae (unsigned long addr); /* cached version */ #undef __WANT_IO_DEF #endif /* GENERIC */ +#endif /* __KERNEL__ */ /* * The convention used for inb/outb etc. is that names starting with @@ -172,6 +176,7 @@ extern void _writew(unsigned short b, unsigned long addr); extern void _writel(unsigned int b, unsigned long addr); extern void _writeq(unsigned long b, unsigned long addr); +#ifdef __KERNEL__ /* * The platform header files may define some of these macros to use * the inlined versions where appropriate. These macros may also be @@ -216,6 +221,27 @@ extern void _writeq(unsigned long b, unsigned long addr); # define outl_p outl #endif +#else + +/* Userspace declarations. */ + +extern unsigned int inb (unsigned long port); +extern unsigned int inw (unsigned long port); +extern unsigned int inl (unsigned long port); +extern void outb (unsigned char b,unsigned long port); +extern void outw (unsigned short w,unsigned long port); +extern void outl (unsigned int l,unsigned long port); +extern unsigned long readb(unsigned long addr); +extern unsigned long readw(unsigned long addr); +extern unsigned long readl(unsigned long addr); +extern void writeb(unsigned char b, unsigned long addr); +extern void writew(unsigned short b, unsigned long addr); +extern void writel(unsigned int b, unsigned long addr); + +#endif /* __KERNEL__ */ + +#ifdef __KERNEL__ + /* * The "address" in IO memory space is not clearly either an integer or a * pointer. We will accept both, thus the casts. @@ -257,8 +283,6 @@ static inline void iounmap(void *addr) # define writeq(v,a) _writeq((v),(unsigned long)(a)) #endif -#ifdef __KERNEL__ - /* * String version of IO memory access ops: */ diff --git a/include/asm-alpha/irq.h b/include/asm-alpha/irq.h index 7f8853c55..fc9e8019a 100644 --- a/include/asm-alpha/irq.h +++ b/include/asm-alpha/irq.h @@ -34,6 +34,7 @@ defined(CONFIG_ALPHA_XLT) || \ defined(CONFIG_ALPHA_MIATA) || \ defined(CONFIG_ALPHA_RUFFIAN) || \ + defined(CONFIG_ALPHA_RX164) || \ defined(CONFIG_ALPHA_NORITAKE) # define NR_IRQS 48 @@ -93,4 +94,8 @@ static __inline__ int irq_cannonicalize(int irq) extern void disable_irq(unsigned int); extern void enable_irq(unsigned int); +struct pt_regs; +extern void (*perf_irq)(unsigned long, struct pt_regs *); + + #endif /* _ALPHA_IRQ_H */ diff --git a/include/asm-alpha/jensen.h b/include/asm-alpha/jensen.h index 75f99ea33..874511e94 100644 --- a/include/asm-alpha/jensen.h +++ b/include/asm-alpha/jensen.h @@ -7,6 +7,9 @@ * Defines for the AlphaPC EISA IO and memory address space. */ +/* The Jensen is strange */ +#define AUX_IRQ (9) + /* * NOTE! The memory operations do not set any memory barriers, as it's * not needed for cases like a frame buffer that is essentially memory-like. diff --git a/include/asm-alpha/keyboard.h b/include/asm-alpha/keyboard.h index 0c6f04d6b..85a1ea9ae 100644 --- a/include/asm-alpha/keyboard.h +++ b/include/asm-alpha/keyboard.h @@ -3,7 +3,7 @@ * * Created 3 Nov 1996 by Geert Uytterhoeven * - * $Id: keyboard.h,v 1.6 1998/10/28 12:39:58 ralf Exp $ + * $Id: keyboard.h,v 1.7 1999/02/10 16:02:26 ralf Exp $ */ /* @@ -68,11 +68,10 @@ extern unsigned char pckbd_sysrq_xlate[128]; /* * Machine specific bits for the PS/2 driver */ - -#if defined(CONFIG_PCI) -#define AUX_IRQ 12 +#if defined(__alpha__) && !defined(CONFIG_PCI) +# define AUX_IRQ 9 /* Jensen is odd indeed */ #else -#define AUX_IRQ 9 /* Jensen is odd indeed */ +# define AUX_IRQ 12 #endif #define aux_request_irq(handler, dev_id) request_irq(AUX_IRQ, handler, 0, \ diff --git a/include/asm-alpha/machvec.h b/include/asm-alpha/machvec.h index 17d50c777..035ffa4e2 100644 --- a/include/asm-alpha/machvec.h +++ b/include/asm-alpha/machvec.h @@ -4,6 +4,12 @@ #include <linux/config.h> #include <linux/types.h> +/* + * This file gets pulled in by asm/io.h from user space. We don't + * want most of this escaping. + */ + +#ifdef __KERNEL__ /* The following structure vectors all of the I/O and IRQ manipulation from the generic kernel to the hardware specific backend. */ @@ -122,4 +128,5 @@ extern int alpha_use_srm_setup; #endif #endif /* GENERIC */ +#endif #endif /* __ALPHA_MACHVEC_H */ diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h index 2ed4cacc2..fa6bd17e1 100644 --- a/include/asm-alpha/pci.h +++ b/include/asm-alpha/pci.h @@ -8,7 +8,7 @@ /* * The following structure is used to manage multiple PCI busses. * - * XXX: We should solve thos problem in an architecture independant + * XXX: We should solve this problem in an architecture independent * way, rather than hacking something up here. */ diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h index 47432c051..b74744207 100644 --- a/include/asm-alpha/pgtable.h +++ b/include/asm-alpha/pgtable.h @@ -14,6 +14,7 @@ #include <asm/processor.h> /* For TASK_SIZE */ #include <asm/mmu_context.h> #include <asm/machvec.h> +#include <asm/spinlock.h> /* For the task lock */ /* Caches aren't brain-dead on the Alpha. */ @@ -174,7 +175,7 @@ struct ipi_msg_flush_tb_struct { struct vm_area_struct * flush_vma; } p; unsigned long flush_addr; - /* unsigned long flush_end; */ /* not used by local_flush_tlb_range */ + unsigned long flush_end; }; extern struct ipi_msg_flush_tb_struct ipi_msg_flush_tb; diff --git a/include/asm-alpha/processor.h b/include/asm-alpha/processor.h index 141075ef6..2af7a8806 100644 --- a/include/asm-alpha/processor.h +++ b/include/asm-alpha/processor.h @@ -65,7 +65,7 @@ struct thread_struct { }; #define INIT_MMAP { &init_mm, PAGE_OFFSET, PAGE_OFFSET+0x10000000, \ - PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } + NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } #define INIT_TSS { \ 0, 0, 0, \ @@ -113,6 +113,7 @@ extern void release_thread(struct task_struct *); #define copy_segments(nr, tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) +#define forget_segments() do { } while (0) /* NOTE: The task struct and the stack go together! */ #define alloc_task_struct() \ diff --git a/include/asm-alpha/semaphore.h b/include/asm-alpha/semaphore.h index 29cbb4a33..a172211c1 100644 --- a/include/asm-alpha/semaphore.h +++ b/include/asm-alpha/semaphore.h @@ -7,28 +7,80 @@ * (C) Copyright 1996 Linus Torvalds */ +#include <asm/current.h> +#include <asm/system.h> #include <asm/atomic.h> +/* + * Semaphores are recursive: we allow the holder process to recursively do + * down() operations on a semaphore that the process already owns. In order + * to do that, we need to keep a semaphore-local copy of the owner and the + * "depth of ownership". + * + * NOTE! Nasty memory ordering rules: + * - "owner" and "owner_count" may only be modified once you hold the lock. + * - "owner_count" must be written _after_ modifying owner, and must be + * read _before_ reading owner. There must be appropriate write and read + * barriers to enforce this. + */ + struct semaphore { atomic_t count; atomic_t waking; + struct task_struct *owner; + long owner_depth; struct wait_queue * wait; }; -#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), ATOMIC_INIT(0), NULL }) -#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), ATOMIC_INIT(0), NULL }) +#define MUTEX ((struct semaphore) \ + { ATOMIC_INIT(1), ATOMIC_INIT(0), NULL, 0, NULL }) +#define MUTEX_LOCKED ((struct semaphore) \ + { ATOMIC_INIT(0), ATOMIC_INIT(0), NULL, 1, NULL }) + +#define semaphore_owner(sem) ((sem)->owner) +#define sema_init(sem, val) atomic_set(&((sem)->count), val) extern void __down(struct semaphore * sem); extern int __down_interruptible(struct semaphore * sem); extern void __up(struct semaphore * sem); -#define sema_init(sem, val) atomic_set(&((sem)->count), val) +/* All three have custom assembly linkages. */ +extern void __down_failed(struct semaphore * sem); +extern void __down_failed_interruptible(struct semaphore * sem); +extern void __up_wakeup(struct semaphore * sem); + /* * These two _must_ execute atomically wrt each other. * * This is trivially done with load_locked/store_cond, * which we have. Let the rest of the losers suck eggs. + * + * Tricky bits -- + * + * (1) One task does two downs, no other contention + * initial state: + * count = 1, waking = 0, depth = undef; + * down(&sem) + * count = 0, waking = 0, depth = 1; + * down(&sem) + * atomic dec and test sends us to waking_non_zero via __down + * count = -1, waking = 0; + * conditional atomic dec on waking discovers no free slots + * count = -1, waking = 0; + * test for owner succeeeds and we return ok. + * count = -1, waking = 0, depth = 2; + * up(&sem) + * dec depth + * count = -1, waking = 0, depth = 1; + * atomic inc and test sends us to slow path + * count = 0, waking = 0, depth = 1; + * notice !(depth < 0) and don't call __up. + * up(&sem) + * dec depth + * count = 0, waking = 0, depth = 0; + * atomic inc and test succeeds. + * count = 1, waking = 0, depth = 0; */ static inline void wake_one_more(struct semaphore * sem) @@ -36,48 +88,153 @@ static inline void wake_one_more(struct semaphore * sem) atomic_inc(&sem->waking); } -static inline int waking_non_zero(struct semaphore *sem) +static inline int waking_non_zero(struct semaphore *sem, + struct task_struct *tsk) { + long owner_depth; int ret, tmp; + owner_depth = sem->owner_depth; + + /* Atomic decrement, iff the value is > 0. */ __asm__ __volatile__( "1: ldl_l %1,%2\n" " ble %1,2f\n" " subl %1,1,%0\n" " stl_c %0,%2\n" " beq %0,3f\n" - "2:\n" + "2: mb\n" ".section .text2,\"ax\"\n" "3: br 1b\n" ".previous" : "=r"(ret), "=r"(tmp), "=m"(__atomic_fool_gcc(&sem->waking)) : "0"(0)); + ret |= ((owner_depth != 0) & (sem->owner == tsk)); + if (ret) { + sem->owner = tsk; + wmb(); + /* Don't use the old value, which is stale in the + !owner case. */ + sem->owner_depth++; + } + return ret; } /* - * This isn't quite as clever as the x86 side, but the gp register - * makes things a bit more complicated on the alpha.. + * Whee. Hidden out of line code is fun. The contention cases are + * handled out of line in kernel/sched.c; arch/alpha/lib/semaphore.S + * takes care of making sure we can call it without clobbering regs. */ + extern inline void down(struct semaphore * sem) { - if (atomic_dec_return(&sem->count) < 0) - __down(sem); + /* Given that we have to use particular hard registers to + communicate with __down_failed anyway, reuse them in + the atomic operation as well. + + __down_failed takes the semaphore address in $24, and + it's return address in $28. The pv is loaded as usual. + The gp is clobbered (in the module case) as usual. */ + + __asm__ __volatile__ ( + "/* semaphore down operation */\n" + "1: ldl_l $27,%3\n" + " subl $27,1,$27\n" + " mov $27,$28\n" + " stl_c $28,%0\n" + " beq $28,2f\n" + " blt $27,3f\n" + /* Got the semaphore no contention. Set owner and depth. */ + " stq $8,%1\n" + " lda $28,1\n" + " wmb\n" + " stq $28,%2\n" + "4: mb\n" + ".section .text2,\"ax\"\n" + "2: br 1b\n" + "3: lda $24,%3\n" + " jsr $28,__down_failed\n" + " ldgp $29,0($28)\n" + " br 4b\n" + ".previous" + : "=m"(sem->count), "=m"(sem->owner), "=m"(sem->owner_depth) + : "m"(sem->count) + : "$24", "$27", "$28", "memory"); } extern inline int down_interruptible(struct semaphore * sem) { - int ret = 0; - if (atomic_dec_return(&sem->count) < 0) - ret = __down_interruptible(sem); + /* __down_failed_interruptible takes the semaphore address in $24, + and it's return address in $28. The pv is loaded as usual. + The gp is clobbered (in the module case) as usual. The return + value is in $24. */ + + register int ret __asm__("$24"); + + __asm__ __volatile__ ( + "/* semaphore down interruptible operation */\n" + "1: ldl_l $27,%4\n" + " subl $27,1,$27\n" + " mov $27,$28\n" + " stl_c $28,%1\n" + " beq $28,2f\n" + " blt $27,3f\n" + /* Got the semaphore no contention. Set owner and depth. */ + " stq $8,%2\n" + " lda $28,1\n" + " wmb\n" + " stq $28,%3\n" + " mov $31,$24\n" + "4: mb\n" + ".section .text2,\"ax\"\n" + "2: br 1b\n" + "3: lda $24,%4\n" + " jsr $28,__down_failed_interruptible\n" + " ldgp $29,0($28)\n" + " br 4b\n" + ".previous" + : "=r"(ret), "=m"(sem->count), "=m"(sem->owner), + "=m"(sem->owner_depth) + : "m"(sem->count) + : "$27", "$28", "memory"); + return ret; } extern inline void up(struct semaphore * sem) { - if (atomic_inc_return(&sem->count) <= 0) - __up(sem); -} + /* Given that we have to use particular hard registers to + communicate with __up_wakeup anyway, reuse them in + the atomic operation as well. + + __up_wakeup takes the semaphore address in $24, and + it's return address in $28. The pv is loaded as usual. + The gp is clobbered (in the module case) as usual. */ + + __asm__ __volatile__ ( + "/* semaphore up operation */\n" + " mb\n" + "1: ldl_l $27,%1\n" + " addl $27,1,$27\n" + " mov $27,$28\n" + " stl_c $28,%0\n" + " beq $28,2f\n" + " mb\n" + " ble $27,3f\n" + "4:\n" + ".section .text2,\"ax\"\n" + "2: br 1b\n" + "3: lda $24,%1\n" + " bgt %2,4b\n" + " jsr $28,__up_wakeup\n" + " ldgp $29,0($28)\n" + " br 4b\n" + ".previous" + : "=m"(sem->count) + : "m"(sem->count), "r"(--sem->owner_depth) + : "$24", "$27", "$28", "memory"); +} #endif diff --git a/include/asm-alpha/smp.h b/include/asm-alpha/smp.h index 9d5e8e084..04be8487d 100644 --- a/include/asm-alpha/smp.h +++ b/include/asm-alpha/smp.h @@ -12,7 +12,8 @@ struct cpuinfo_alpha { unsigned long *pgd_cache; unsigned long *pte_cache; unsigned long pgtable_cache_sz; -}; + unsigned long ipi_count; +} __attribute__((aligned(32))); extern struct cpuinfo_alpha cpu_data[NR_CPUS]; @@ -36,9 +37,6 @@ static __inline__ unsigned char hard_smp_processor_id(void) #define smp_processor_id() (current->processor) #define cpu_logical_map(cpu) (cpu) -/* For the benefit of panic. */ -void smp_message_pass(int target, int msg, unsigned long data, int wait); - #endif /* __SMP__ */ #define NO_PROC_ID (-1) diff --git a/include/asm-alpha/softirq.h b/include/asm-alpha/softirq.h index b47281a3b..41ccc29c9 100644 --- a/include/asm-alpha/softirq.h +++ b/include/asm-alpha/softirq.h @@ -27,7 +27,7 @@ static inline void clear_active_bhs(unsigned long x) extern inline void init_bh(int nr, void (*routine)(void)) { bh_base[nr] = routine; - bh_mask_count[nr] = 0; + atomic_set(&bh_mask_count[nr], 0); bh_mask |= 1 << nr; } @@ -116,12 +116,13 @@ extern inline void end_bh_atomic(void) extern inline void disable_bh(int nr) { bh_mask &= ~(1 << nr); - bh_mask_count[nr]++; + atomic_inc(&bh_mask_count[nr]); + synchronize_bh(); } extern inline void enable_bh(int nr) { - if (!--bh_mask_count[nr]) + if (atomic_dec_and_test(&bh_mask_count[nr])) bh_mask |= 1 << nr; } diff --git a/include/asm-alpha/spinlock.h b/include/asm-alpha/spinlock.h index 63837b195..b5fe62ddf 100644 --- a/include/asm-alpha/spinlock.h +++ b/include/asm-alpha/spinlock.h @@ -88,12 +88,12 @@ typedef struct { } spinlock_t; #if DEBUG_SPINLOCK -#define SPIN_LOCK_UNLOCKED {0, 1, 0, 0, 0, 0} +#define SPIN_LOCK_UNLOCKED (spinlock_t) {0, 1, 0, 0, 0, 0} #define spin_lock_init(x) \ ((x)->lock = 0, (x)->target_ipl = 0, (x)->debug_state = 1, \ (x)->previous = 0, (x)->task = 0) #else -#define SPIN_LOCK_UNLOCKED { 0 } +#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } #define spin_lock_init(x) ((x)->lock = 0) #endif @@ -163,7 +163,7 @@ static inline void spin_lock(spinlock_t * lock) typedef struct { volatile int write_lock:1, read_counter:31; } rwlock_t; -#define RW_LOCK_UNLOCKED { 0, 0 } +#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 } #if DEBUG_RWLOCK extern void write_lock(rwlock_t * lock); @@ -207,7 +207,7 @@ static inline void read_lock(rwlock_t * lock) " br 1b\n" ".previous" : "=m" (__dummy_lock(lock)), "=&r" (regx) - : "0" (__dummy_lock(lock)) + : "m" (__dummy_lock(lock)) ); } #endif /* DEBUG_RWLOCK */ @@ -230,7 +230,7 @@ static inline void read_unlock(rwlock_t * lock) "6: br 1b\n" ".previous" : "=m" (__dummy_lock(lock)), "=&r" (regx) - : "0" (__dummy_lock(lock))); + : "m" (__dummy_lock(lock))); } #define read_lock_irq(lock) (__cli(), read_lock(lock)) diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h index 798207747..626495adf 100644 --- a/include/asm-alpha/system.h +++ b/include/asm-alpha/system.h @@ -107,6 +107,9 @@ extern void alpha_switch_to(unsigned long pctxp); #define mb() \ __asm__ __volatile__("mb": : :"memory") +#define rmb() \ +__asm__ __volatile__("mb": : :"memory") + #define wmb() \ __asm__ __volatile__("wmb": : :"memory") @@ -116,6 +119,24 @@ __asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory") #define draina() \ __asm__ __volatile__ ("call_pal %0 #draina" : : "i" (PAL_draina) : "memory") + +static inline unsigned long +wrperfmon(unsigned long perf_fun, unsigned long arg) +{ + register unsigned long __r0 __asm__("$0"); + register unsigned long __r16 __asm__("$16"); + register unsigned long __r17 __asm__("$17"); + __r16 = perf_fun; + __r17 = arg; + __asm__ __volatile__( + "call_pal %1" + : "=r"(__r0) + : "i"(PAL_wrperfmon), "r"(__r16), "r"(__r17) + : "$1", "$22", "$23", "$24", "$25", "$26"); + return __r0; +} + + #define call_pal1(palno,arg) \ ({ \ register unsigned long __r0 __asm__("$0"); \ @@ -226,14 +247,14 @@ extern __inline__ unsigned long xchg_u32(volatile int *m, unsigned long val) __asm__ __volatile__( "1: ldl_l %0,%2\n" - " bis %3,%3,%1\n" + " bis $31,%3,%1\n" " stl_c %1,%2\n" " beq %1,2f\n" ".section .text2,\"ax\"\n" "2: br 1b\n" ".previous" : "=&r" (val), "=&r" (dummy), "=m" (*m) - : "r" (val), "m" (*m)); + : "rI" (val), "m" (*m)); return val; } @@ -244,14 +265,14 @@ extern __inline__ unsigned long xchg_u64(volatile long * m, unsigned long val) __asm__ __volatile__( "1: ldq_l %0,%2\n" - " bis %3,%3,%1\n" + " bis $31,%3,%1\n" " stq_c %1,%2\n" " beq %1,2f\n" ".section .text2,\"ax\"\n" "2: br 1b\n" ".previous" : "=&r" (val), "=&r" (dummy), "=m" (*m) - : "r" (val), "m" (*m)); + : "rI" (val), "m" (*m)); return val; } diff --git a/include/asm-alpha/termbits.h b/include/asm-alpha/termbits.h index 0d0a33251..675231bca 100644 --- a/include/asm-alpha/termbits.h +++ b/include/asm-alpha/termbits.h @@ -125,6 +125,17 @@ struct termios { #define B115200 00021 #define B230400 00022 #define B460800 00023 +#define B500000 00024 +#define B576000 00025 +#define B921600 00026 +#define B1000000 00027 +#define B1152000 00030 +#define B1500000 00031 +#define B2000000 00032 +#define B2500000 00033 +#define B3000000 00034 +#define B3500000 00035 +#define B4000000 00036 #define CSIZE 00001400 #define CS5 00000000 diff --git a/include/asm-alpha/termios.h b/include/asm-alpha/termios.h index a16407c8e..015e2debb 100644 --- a/include/asm-alpha/termios.h +++ b/include/asm-alpha/termios.h @@ -77,6 +77,8 @@ struct termio { #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ +#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #ifdef __KERNEL__ /* eof=^D eol=\0 eol2=\0 erase=del diff --git a/include/asm-alpha/timex.h b/include/asm-alpha/timex.h index c0bfb799c..2576553b3 100644 --- a/include/asm-alpha/timex.h +++ b/include/asm-alpha/timex.h @@ -8,4 +8,23 @@ #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ +/* + * Standard way to access the cycle counter. + * Currently only used on SMP for scheduling. + * + * Only the low 32 bits are available as a continuously counting entity. + * But this only means we'll force a reschedule every 8 seconds or so, + * which isn't an evil thing. + */ + +typedef unsigned int cycles_t; +extern cycles_t cacheflush_time; + +static inline cycles_t get_cycles (void) +{ + cycles_t ret; + __asm__ __volatile__ ("rpcc %0" : "=r"(ret)); + return ret; +} + #endif diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h index 9de6e47ad..df20edc7f 100644 --- a/include/asm-alpha/unistd.h +++ b/include/asm-alpha/unistd.h @@ -67,7 +67,7 @@ #define __NR_getpgrp 63 #define __NR_getpagesize 64 #define __NR_osf_mremap 65 /* not implemented */ -#define __NR_osf_vfork 66 +#define __NR_vfork 66 #define __NR_stat 67 #define __NR_lstat 68 #define __NR_osf_sbrk 69 /* not implemented */ @@ -307,6 +307,7 @@ #define __NR_getcwd 367 #define __NR_capget 368 #define __NR_capset 369 +#define __NR_sendfile 370 #if defined(__LIBRARY__) && defined(__GNUC__) diff --git a/include/asm-arm/a.out.h b/include/asm-arm/a.out.h index 12df46a9a..489d76eb5 100644 --- a/include/asm-arm/a.out.h +++ b/include/asm-arm/a.out.h @@ -27,4 +27,9 @@ struct exec #define M_ARM 103 #include <asm/arch/a.out.h> + +#ifndef LIBRARY_START_TEXT +#define LIBRARY_START_TEXT (0x00c00000) +#endif + #endif /* __A_OUT_GNU_H__ */ diff --git a/include/asm-arm/arch-arc/a.out.h b/include/asm-arm/arch-arc/a.out.h index a8ef7645f..e00511463 100644 --- a/include/asm-arm/arch-arc/a.out.h +++ b/include/asm-arm/arch-arc/a.out.h @@ -10,7 +10,6 @@ #ifdef __KERNEL__ #define STACK_TOP (0x01a00000) -#define LIBRARY_START_TEXT (0x00c00000) #endif #endif diff --git a/include/asm-arm/arch-arc/dma.h b/include/asm-arm/arch-arc/dma.h index 3420d7d6d..49e184769 100644 --- a/include/asm-arm/arch-arc/dma.h +++ b/include/asm-arm/arch-arc/dma.h @@ -16,22 +16,19 @@ #define MAX_DMA_ADDRESS 0x03000000 -/* - * DMA modes - we have two, IN and OUT - */ -typedef enum { - DMA_MODE_READ, - DMA_MODE_WRITE -} dmamode_t; - -#define MAX_DMA_CHANNELS 4 +#ifdef CONFIG_ARCH_ARC +#define MAX_DMA_CHANNELS 3 -#define DMA_0 0 -#define DMA_1 1 -#define DMA_VIRTUAL_FLOPPY 2 -#define DMA_VIRTUAL_SOUND 3 +#define DMA_VIRTUAL_FLOPPY0 0 +#define DMA_VIRTUAL_FLOPPY1 1 +#define DMA_VIRTUAL_SOUND 2 +#endif #ifdef CONFIG_ARCH_A5K +#define MAX_DMA_CHANNELS 2 + +#define DMA_VIRTUAL_FLOPPY 0 +#define DMA_VIRTUAL_SOUND 1 #define DMA_FLOPPY DMA_VIRTUAL_FLOPPY #endif diff --git a/include/asm-arm/arch-arc/hardware.h b/include/asm-arm/arch-arc/hardware.h index 4990ca132..c59007f3c 100644 --- a/include/asm-arm/arch-arc/hardware.h +++ b/include/asm-arm/arch-arc/hardware.h @@ -20,33 +20,51 @@ * source. */ #define HAS_IOC +#include <asm/ioc.h> #define HAS_MEMC +#include <asm/memc.h> #define HAS_MEMC1A #define HAS_VIDC -#ifdef CONFIG_ARCH_A5K -#define HAS_PCIO -#endif - /* * Optional hardware */ #define HAS_EXPMASK +/* 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 +#define IO_SIZE 0x01000000 +#define IO_BASE 0x03000000 + +/* + * Screen mapping information + */ +#define SCREEN_START 0x02000000 +#define SCREEN2_END 0x02078000 +#define SCREEN2_BASE 0x02000000 +#define SCREEN1_END 0x02000000 +#define SCREEN1_BASE 0x01f88000 + + #ifndef __ASSEMBLER__ /* * for use with inb/outb */ -#define VIDC_BASE 0x80100000 -#define IOCEC4IO_BASE 0x8009c000 +#define IO_VIDC_BASE 0x80100000 #ifdef CONFIG_ARCH_ARC #define LATCHAADDR 0x80094010 #define LATCHBADDR 0x80094006 #endif -#define IOCECIO_BASE 0x80090000 #define IOC_BASE 0x80080000 -#define MEMCECIO_BASE 0x80000000 + +#define IO_EC_IOC4_BASE 0x8009c000 +#define IO_EC_IOC_BASE 0x80090000 +#define IO_EC_MEMC_BASE 0x80000000 /* * IO definitions @@ -57,23 +75,6 @@ #define PCIO_BASE 0x03010000 /* - * Mapping areas - */ -#define IO_END 0x03ffffff -#define IO_BASE 0x03000000 -#define IO_SIZE (IO_END - IO_BASE) -#define IO_START 0x03000000 - -/* - * Screen mapping information - */ -#define SCREEN2_END 0x02078000 -#define SCREEN2_BASE 0x02000000 -#define SCREEN1_END SCREEN2_BASE -#define SCREEN1_BASE 0x01f88000 -#define SCREEN_START 0x02000000 - -/* * RAM definitions */ #define MAPTOPHYS(a) (((unsigned long)a & 0x007fffff) + PAGE_OFFSET) @@ -88,7 +89,6 @@ #define IOC_BASE 0x03200000 #define PCIO_FLOPPYDMABASE 0x0302a000 #define PCIO_BASE 0x03010000 -#define IO_BASE 0x03000000 #endif #endif diff --git a/include/asm-arm/arch-arc/ide.h b/include/asm-arm/arch-arc/ide.h index 24bc4899d..2fc6ce282 100644 --- a/include/asm-arm/arch-arc/ide.h +++ b/include/asm-arm/arch-arc/ide.h @@ -8,50 +8,44 @@ * * Modifications: * 04-04-1998 PJB Merged `arc' and `a5k' versions + * 01-07-1998 RMK Added new ide_ioregspec_t + * 29-07-1998 RMK Major re-work of IDE architecture specific code */ #include <linux/config.h> #include <asm/irq.h> -static __inline__ int -ide_default_irq(ide_ioreg_t base) +/* + * 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) { -#ifdef CONFIG_ARCH_A5K - if (base == 0x1f0) - return IRQ_HARDDISK; -#endif - return 0; -} + ide_ioreg_t reg = (ide_ioreg_t) data_port; + int i; -static __inline__ ide_ioreg_t -ide_default_io_base(int index) -{ -#ifdef CONFIG_ARCH_A5K - if (index == 0) - return 0x1f0; -#endif - return 0; -} + memset(hw, 0, sizeof(*hw)); -static __inline__ int -ide_default_stepping(int index) -{ - return 0; + 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_hwif_ports (ide_ioreg_t *p, ide_ioreg_t base, int stepping, int *irq) +ide_init_default_hwifs(void) { - ide_ioreg_t port = base; - ide_ioreg_t ctrl = base + 0x206; - int i; +#ifdef CONFIG_ARCH_A5K + hw_regs_t hw; - i = 8; - while (i--) { - *p++ = port; - port += 1 << stepping; - } - *p++ = ctrl; - if (irq != NULL) - *irq = 0; + ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, IRQ_HARDDISK); + ide_register_hw(&hw, NULL); +#endif } diff --git a/include/asm-arm/arch-arc/io.h b/include/asm-arm/arch-arc/io.h index 0b77060c5..4e984bd3c 100644 --- a/include/asm-arm/arch-arc/io.h +++ b/include/asm-arm/arch-arc/io.h @@ -35,7 +35,7 @@ extern __inline__ void __outb (unsigned int value, unsigned int port) "tst %2, #0x80000000\n\t" "mov %0, %4\n\t" "addeq %0, %0, %3\n\t" - "strb %1, [%0, %2, lsl #2]" + "strb %1, [%0, %2, lsl #2] @ outb" : "=&r" (temp) : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) : "cc"); @@ -48,7 +48,7 @@ extern __inline__ void __outw (unsigned int value, unsigned int port) "tst %2, #0x80000000\n\t" "mov %0, %4\n\t" "addeq %0, %0, %3\n\t" - "str %1, [%0, %2, lsl #2]" + "str %1, [%0, %2, lsl #2] @ outw" : "=&r" (temp) : "r" (value|value<<16), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) : "cc"); @@ -61,7 +61,7 @@ extern __inline__ void __outl (unsigned int value, unsigned int port) "tst %2, #0x80000000\n\t" "mov %0, %4\n\t" "addeq %0, %0, %3\n\t" - "str %1, [%0, %2, lsl #2]" + "str %1, [%0, %2, lsl #2] @ outl" : "=&r" (temp) : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) : "cc"); @@ -75,7 +75,7 @@ extern __inline__ unsigned sz __in##fnsuffix (unsigned int port) \ "tst %2, #0x80000000\n\t" \ "mov %0, %4\n\t" \ "addeq %0, %0, %3\n\t" \ - "ldr" ##instr## " %1, [%0, %2, lsl #2]" \ + "ldr" ##instr## " %1, [%0, %2, lsl #2] @ in"###fnsuffix \ : "=&r" (temp), "=r" (value) \ : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \ : "cc"); \ @@ -110,11 +110,11 @@ DECLARE_IO(long,l,"") ({ \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "strb %0, [%1, %2]" \ + "strb %0, [%1, %2] @ outbc" \ : : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "strb %0, [%1, %2]" \ + "strb %0, [%1, %2] @ outbc" \ : : "r" (value), "r" (IO_BASE), "r" ((port) << 2)); \ }) @@ -123,11 +123,11 @@ DECLARE_IO(long,l,"") unsigned char result; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "ldrb %0, [%1, %2]" \ + "ldrb %0, [%1, %2] @ inbc" \ : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "ldrb %0, [%1, %2]" \ + "ldrb %0, [%1, %2] @ inbc" \ : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ result; \ }) @@ -137,11 +137,11 @@ DECLARE_IO(long,l,"") unsigned long v = value; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str %0, [%1, %2] @ outwc" \ : : "r" (v|v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str %0, [%1, %2] @ outwc" \ : : "r" (v|v<<16), "r" (IO_BASE), "r" ((port) << 2)); \ }) @@ -150,11 +150,11 @@ DECLARE_IO(long,l,"") unsigned short result; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr %0, [%1, %2] @ inwc" \ : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr %0, [%1, %2] @ inwc" \ : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ result & 0xffff; \ }) @@ -164,11 +164,11 @@ DECLARE_IO(long,l,"") unsigned long v = value; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str %0, [%1, %2] @ outlc" \ : : "r" (v), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str %0, [%1, %2] @ outlc" \ : : "r" (v), "r" (IO_BASE), "r" ((port) << 2)); \ }) @@ -177,11 +177,11 @@ DECLARE_IO(long,l,"") unsigned long result; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr %0, [%1, %2] @ inlc" \ : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr %0, [%1, %2] @ inlc" \ : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ result; \ }) diff --git a/include/asm-arm/arch-arc/keyboard.h b/include/asm-arm/arch-arc/keyboard.h index 59272e269..388014703 100644 --- a/include/asm-arm/arch-arc/keyboard.h +++ b/include/asm-arm/arch-arc/keyboard.h @@ -35,3 +35,5 @@ extern unsigned char a5kkbd_sysrq_xlate[NR_SCANCODES]; #define kbd_sysrq_xlate a5kkbd_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-arc/processor.h b/include/asm-arm/arch-arc/processor.h index 314525eef..cb63936e4 100644 --- a/include/asm-arm/arch-arc/processor.h +++ b/include/asm-arm/arch-arc/processor.h @@ -26,12 +26,7 @@ /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ -#if 0 -#define TASK_UNMAPPED_BASE(off) (TASK_SIZE / 3) -#else #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) -#endif -#define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr) #define INIT_MMAP \ { &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } diff --git a/include/asm-arm/arch-arc/system.h b/include/asm-arm/arch-arc/system.h index 3becc7b2f..9e2e99cfd 100644 --- a/include/asm-arm/arch-arc/system.h +++ b/include/asm-arm/arch-arc/system.h @@ -23,25 +23,25 @@ #endif -extern __inline__ void arch_hard_reset (void) +extern __inline__ void arch_reset(char mode) { - extern void ecard_reset (int card); + extern void ecard_reset(int card); + + /* + * Do any cleanups that the processor may require + */ + processor._proc_fin(); /* * Reset all expansion cards. */ - ecard_reset (-1); + ecard_reset(-1); /* * copy branch instruction to reset location and call it */ *(unsigned long *)0 = *(unsigned long *)0x03800000; ((void(*)(void))0)(); - - /* - * If that didn't work, loop endlessly - */ - while (1); } #endif diff --git a/include/asm-arm/arch-ebsa110/a.out.h b/include/asm-arm/arch-ebsa110/a.out.h index 0123eb29a..2746584c8 100644 --- a/include/asm-arm/arch-ebsa110/a.out.h +++ b/include/asm-arm/arch-ebsa110/a.out.h @@ -9,7 +9,6 @@ #ifdef __KERNEL__ #define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) -#define LIBRARY_START_TEXT (0x00c00000) #endif #endif diff --git a/include/asm-arm/arch-ebsa110/dma.h b/include/asm-arm/arch-ebsa110/dma.h index 96a265927..971369789 100644 --- a/include/asm-arm/arch-ebsa110/dma.h +++ b/include/asm-arm/arch-ebsa110/dma.h @@ -14,15 +14,6 @@ * bytes of RAM. */ #define MAX_DMA_ADDRESS 0xd0000000 - -/* - * DMA modes - we have two, IN and OUT - */ -typedef enum { - DMA_MODE_READ, - DMA_MODE_WRITE -} dmamode_t; - #define MAX_DMA_CHANNELS 8 #endif /* _ASM_ARCH_DMA_H */ diff --git a/include/asm-arm/arch-ebsa110/hardware.h b/include/asm-arm/arch-ebsa110/hardware.h index 61ac7492e..e502b0fc6 100644 --- a/include/asm-arm/arch-ebsa110/hardware.h +++ b/include/asm-arm/arch-ebsa110/hardware.h @@ -28,9 +28,8 @@ /* * Mapping areas */ -#define IO_END 0xffffffff #define IO_BASE 0xe0000000 -#define IO_SIZE (IO_END - IO_BASE) +#define IO_SIZE 0x20000000 #define IO_START 0xe0000000 /* @@ -39,7 +38,7 @@ #define MAPTOPHYS(a) ((unsigned long)(a) - PAGE_OFFSET) #define KERNTOPHYS(a) ((unsigned long)(&a)) #define KERNEL_BASE (0xc0008000) -#define SAFE_ADDR 0x40000000 +#define FLUSH_BASE_PHYS 0x40000000 #else diff --git a/include/asm-arm/arch-ebsa110/io.h b/include/asm-arm/arch-ebsa110/io.h index 39f574d55..32fc49c1a 100644 --- a/include/asm-arm/arch-ebsa110/io.h +++ b/include/asm-arm/arch-ebsa110/io.h @@ -36,7 +36,7 @@ extern __inline__ void __out##fnsuffix (unsigned int value, unsigned int port) \ "tst %2, #0x80000000\n\t" \ "mov %0, %4\n\t" \ "addeq %0, %0, %3\n\t" \ - "str" ##instr## " %1, [%0, %2, lsl #2]" \ + "str" ##instr## " %1, [%0, %2, lsl #2] @ out"###fnsuffix \ : "=&r" (temp) \ : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \ : "cc"); \ @@ -50,7 +50,7 @@ extern __inline__ unsigned sz __in##fnsuffix (unsigned int port) \ "tst %2, #0x80000000\n\t" \ "mov %0, %4\n\t" \ "addeq %0, %0, %3\n\t" \ - "ldr" ##instr## " %1, [%0, %2, lsl #2]" \ + "ldr" ##instr## " %1, [%0, %2, lsl #2] @ in"###fnsuffix \ : "=&r" (temp), "=r" (value) \ : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \ : "cc"); \ @@ -87,11 +87,11 @@ DECLARE_IO(long,l,"") ({ \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "strb %0, [%1, %2]" \ + "strb %0, [%1, %2] @ outbc" \ : : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "strb %0, [%1, %2]" \ + "strb %0, [%1, %2] @ outbc" \ : : "r" (value), "r" (IO_BASE), "r" ((port) << 2)); \ }) @@ -100,11 +100,11 @@ DECLARE_IO(long,l,"") unsigned char result; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "ldrb %0, [%1, %2]" \ + "ldrb %0, [%1, %2] @ inbc" \ : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "ldrb %0, [%1, %2]" \ + "ldrb %0, [%1, %2] @ inbc" \ : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ result; \ }) @@ -114,11 +114,11 @@ DECLARE_IO(long,l,"") unsigned long v = value; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str %0, [%1, %2] @ outwc" \ : : "r" (v|v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str %0, [%1, %2] @ outwc" \ : : "r" (v|v<<16), "r" (IO_BASE), "r" ((port) << 2)); \ }) @@ -127,11 +127,11 @@ DECLARE_IO(long,l,"") unsigned short result; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr %0, [%1, %2] @ inwc" \ : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr %0, [%1, %2] @ inwc" \ : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ result & 0xffff; \ }) @@ -141,11 +141,11 @@ DECLARE_IO(long,l,"") unsigned long v = value; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str %0, [%1, %2] @ outlc" \ : : "r" (v), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str %0, [%1, %2] @ outlc" \ : : "r" (v), "r" (IO_BASE), "r" ((port) << 2)); \ }) @@ -154,11 +154,11 @@ DECLARE_IO(long,l,"") unsigned long result; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr %0, [%1, %2] @ inlc" \ : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr %0, [%1, %2] @ inlc" \ : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ result; \ }) diff --git a/include/asm-arm/arch-ebsa110/processor.h b/include/asm-arm/arch-ebsa110/processor.h index bf1f6d384..e98d1ff33 100644 --- a/include/asm-arm/arch-ebsa110/processor.h +++ b/include/asm-arm/arch-ebsa110/processor.h @@ -23,12 +23,7 @@ /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ -#if 0 -#define TASK_UNMAPPED_BASE(off) (TASK_SIZE / 3) -#else #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) -#endif -#define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr) #define INIT_MMAP \ { &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } diff --git a/include/asm-arm/arch-ebsa110/system.h b/include/asm-arm/arch-ebsa110/system.h index a28161cb2..ba0c99258 100644 --- a/include/asm-arm/arch-ebsa110/system.h +++ b/include/asm-arm/arch-ebsa110/system.h @@ -6,13 +6,12 @@ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H -extern __inline__ void arch_hard_reset (void) +extern __inline__ void arch_reset(char mode) { /* * loop endlessly */ cli(); - while (1); } #endif diff --git a/include/asm-arm/arch-ebsa110/time.h b/include/asm-arm/arch-ebsa110/time.h index 5b1447b7e..1f21a02e6 100644 --- a/include/asm-arm/arch-ebsa110/time.h +++ b/include/asm-arm/arch-ebsa110/time.h @@ -9,8 +9,10 @@ * 10-Oct-1996 RMK Created * 04-Dec-1997 RMK Updated for new arch/arm/kernel/time.c * 07-Aug-1998 RMK Updated for arch/arm/kernel/leds.c + * 28-Dec-1998 APH Made leds code optional */ +#include <linux/config.h> #include <asm/leds.h> #define IRQ_TIMER IRQ_EBSA110_TIMER0 @@ -47,15 +49,19 @@ extern __inline__ int reset_timer (void) extern __inline__ int reset_timer (void) { static unsigned int divisor; +#ifdef CONFIG_LEDS static int count = 50; +#endif *PIT_T1 = (PIT1_COUNT) & 0xff; *PIT_T1 = (PIT1_COUNT) >> 8; +#ifdef CONFIG_LEDS if (--count == 0) { count = 50; leds_event(led_timer); } +#endif if (divisor == 0) { divisor = DIVISOR - 1; diff --git a/include/asm-arm/arch-ebsa285/a.out.h b/include/asm-arm/arch-ebsa285/a.out.h index 0123eb29a..2746584c8 100644 --- a/include/asm-arm/arch-ebsa285/a.out.h +++ b/include/asm-arm/arch-ebsa285/a.out.h @@ -9,7 +9,6 @@ #ifdef __KERNEL__ #define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) -#define LIBRARY_START_TEXT (0x00c00000) #endif #endif diff --git a/include/asm-arm/arch-ebsa285/dma.h b/include/asm-arm/arch-ebsa285/dma.h index d3a2aa0c9..28c093aec 100644 --- a/include/asm-arm/arch-ebsa285/dma.h +++ b/include/asm-arm/arch-ebsa285/dma.h @@ -15,20 +15,11 @@ #define MAX_DMA_ADDRESS 0xffffffff /* - * DMA modes - we have two, IN and OUT - */ - -typedef int dmamode_t; -#define DMA_MODE_READ 0x44 -#define DMA_MODE_WRITE 0x48 - -/* * The 21285 has two internal DMA channels; we call these 0 and 1. * On CATS hardware we have an additional eight ISA dma channels * numbered 2..9. */ #define MAX_DMA_CHANNELS 10 - #define DMA_ISA_BASE 2 #define DMA_FLOPPY (DMA_ISA_BASE + 2) diff --git a/include/asm-arm/arch-ebsa285/hardware.h b/include/asm-arm/arch-ebsa285/hardware.h index a9bc6f0a4..e08c5b823 100644 --- a/include/asm-arm/arch-ebsa285/hardware.h +++ b/include/asm-arm/arch-ebsa285/hardware.h @@ -19,12 +19,12 @@ * 0xf8000000 0x7b010000 PCI Config type 0 * */ + +#include <asm/dec21285.h> -#define IO_END 0xffffffff #define IO_BASE 0xe0000000 -#define IO_SIZE (IO_END - IO_BASE) - -#define HAS_PCIO +#define PCIO_BASE 0xffe00000 +#define PCI_IACK 0xfc000000 #define XBUS_LEDS ((volatile unsigned char *)0xfff12000) #define XBUS_LED_AMBER (1 << 0) @@ -38,70 +38,10 @@ #define XBUS_SWITCH_J17_11 ((*XBUS_SWITCH) & (1 << 5)) #define XBUS_SWITCH_J17_9 ((*XBUS_SWITCH) & (1 << 6)) -#define PCIO_BASE 0xffe00000 - -#define CSR_SA110_CNTL ((volatile unsigned long *)0xfe00013c) -#define CSR_PCIADDR_EXTN ((volatile unsigned long *)0xfe000140) -#define CSR_PREFETCHMEMRANGE ((volatile unsigned long *)0xfe000144) -#define CSR_XBUS_CYCLE ((volatile unsigned long *)0xfe000148) -#define CSR_XBUS_IOSTROBE ((volatile unsigned long *)0xfe00014c) -#define CSR_DOORBELL_PCI ((volatile unsigned long *)0xfe000150) -#define CSR_DOORBELL_SA110 ((volatile unsigned long *)0xfe000154) - - -#define CSR_UARTDR ((volatile unsigned long *)0xfe000160) -#define CSR_RXSTAT ((volatile unsigned long *)0xfe000164) -#define CSR_H_UBRLCR ((volatile unsigned long *)0xfe000168) -#define CSR_M_UBRLCR ((volatile unsigned long *)0xfe00016c) -#define CSR_L_UBRLCR ((volatile unsigned long *)0xfe000170) -#define CSR_UARTCON ((volatile unsigned long *)0xfe000174) -#define CSR_UARTFLG ((volatile unsigned long *)0xfe000178) - -#define CSR_IRQ_STATUS ((volatile unsigned long *)0xfe000180) -#define CSR_IRQ_RAWSTATUS ((volatile unsigned long *)0xfe000184) -#define CSR_IRQ_ENABLE ((volatile unsigned long *)0xfe000188) -#define CSR_IRQ_DISABLE ((volatile unsigned long *)0xfe00018c) -#define CSR_IRQ_SOFT ((volatile unsigned long *)0xfe000190) - -#define CSR_FIQ_STATUS ((volatile unsigned long *)0xfe000280) -#define CSR_FIQ_RAWSTATUS ((volatile unsigned long *)0xfe000284) -#define CSR_FIQ_ENABLE ((volatile unsigned long *)0xfe000288) -#define CSR_FIQ_DISABLE ((volatile unsigned long *)0xfe00028c) -#define CSR_FIQ_SOFT ((volatile unsigned long *)0xfe000290) - -#define CSR_TIMER1_LOAD ((volatile unsigned long *)0xfe000300) -#define CSR_TIMER1_VALUE ((volatile unsigned long *)0xfe000304) -#define CSR_TIMER1_CNTL ((volatile unsigned long *)0xfe000308) -#define CSR_TIMER1_CLR ((volatile unsigned long *)0xfe00030c) - -#define CSR_TIMER2_LOAD ((volatile unsigned long *)0xfe000320) -#define CSR_TIMER2_VALUE ((volatile unsigned long *)0xfe000324) -#define CSR_TIMER2_CNTL ((volatile unsigned long *)0xfe000328) -#define CSR_TIMER2_CLR ((volatile unsigned long *)0xfe00032c) - -#define CSR_TIMER3_LOAD ((volatile unsigned long *)0xfe000340) -#define CSR_TIMER3_VALUE ((volatile unsigned long *)0xfe000344) -#define CSR_TIMER3_CNTL ((volatile unsigned long *)0xfe000348) -#define CSR_TIMER3_CLR ((volatile unsigned long *)0xfe00034c) - -#define CSR_TIMER4_LOAD ((volatile unsigned long *)0xfe000360) -#define CSR_TIMER4_VALUE ((volatile unsigned long *)0xfe000364) -#define CSR_TIMER4_CNTL ((volatile unsigned long *)0xfe000368) -#define CSR_TIMER4_CLR ((volatile unsigned long *)0xfe00036c) - - -#define TIMER_CNTL_ENABLE (1 << 7) -#define TIMER_CNTL_AUTORELOAD (1 << 6) -#define TIMER_CNTL_DIV1 (0) -#define TIMER_CNTL_DIV16 (1 << 2) -#define TIMER_CNTL_DIV256 (2 << 2) -#define TIMER_CNTL_CNTEXT (3 << 2) - - #define KERNTOPHYS(a) ((unsigned long)(&a)) #define PARAMS_OFFSET 0x0100 #define PARAMS_BASE (PAGE_OFFSET + PARAMS_OFFSET) -#define SAFE_ADDR 0x50000000 +#define FLUSH_BASE_PHYS 0x50000000 diff --git a/include/asm-arm/arch-ebsa285/ide.h b/include/asm-arm/arch-ebsa285/ide.h index 35eff5c28..b0071a45b 100644 --- a/include/asm-arm/arch-ebsa285/ide.h +++ b/include/asm-arm/arch-ebsa285/ide.h @@ -1 +1,38 @@ -/* no ide */ +/* + * linux/include/asm-arm/arch-ebsa285/ide.h + * + * Copyright (c) 1998 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-ebsa285/io.h b/include/asm-arm/arch-ebsa285/io.h index f42717350..1be73879d 100644 --- a/include/asm-arm/arch-ebsa285/io.h +++ b/include/asm-arm/arch-ebsa285/io.h @@ -1,5 +1,5 @@ /* - * linux/include/asm-arm/arch-ebsa110/io.h + * linux/include/asm-arm/arch-ebsa285/io.h * * Copyright (C) 1997,1998 Russell King * @@ -9,6 +9,8 @@ #ifndef __ASM_ARM_ARCH_IO_H #define __ASM_ARM_ARCH_IO_H +#include <asm/dec21285.h> + /* * This architecture does not require any delayed IO, and * has the constant-optimised IO @@ -23,7 +25,7 @@ extern __inline__ void __out##fnsuffix (unsigned int value, unsigned int port) \ { \ __asm__ __volatile__( \ - "str" ##instr## " %0, [%1, %2]" \ + "str%?" ##instr## " %0, [%1, %2] @ out"###fnsuffix \ : \ : "r" (value), "r" (PCIO_BASE), typ (port)); \ } @@ -33,7 +35,7 @@ extern __inline__ unsigned sz __in##fnsuffix (unsigned int port) \ { \ unsigned long value; \ __asm__ __volatile__( \ - "ldr" ##instr## " %0, [%1, %2]" \ + "ldr%?" ##instr## " %0, [%1, %2] @ in"###fnsuffix \ : "=&r" (value) \ : "r" (PCIO_BASE), typ (port)); \ return (unsigned sz)value; \ @@ -65,7 +67,7 @@ DECLARE_IO(long,l,"","Jr") #define __outbc(value,port) \ ({ \ __asm__ __volatile__( \ - "strb %0, [%1, %2]" \ + "str%?b %0, [%1, %2] @ outbc" \ : \ : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ }) @@ -74,7 +76,7 @@ DECLARE_IO(long,l,"","Jr") ({ \ unsigned char result; \ __asm__ __volatile__( \ - "ldrb %0, [%1, %2]" \ + "ldr%?b %0, [%1, %2] @ inbc" \ : "=r" (result) \ : "r" (PCIO_BASE), "Jr" (port)); \ result; \ @@ -83,7 +85,7 @@ DECLARE_IO(long,l,"","Jr") #define __outwc(value,port) \ ({ \ __asm__ __volatile__( \ - "strh %0, [%1, %2]" \ + "str%?h %0, [%1, %2] @ outwc" \ : \ : "r" (value), "r" (PCIO_BASE), "r" (port)); \ }) @@ -92,7 +94,7 @@ DECLARE_IO(long,l,"","Jr") ({ \ unsigned short result; \ __asm__ __volatile__( \ - "ldrh %0, [%1, %2]" \ + "ldr%?h %0, [%1, %2] @ inwc" \ : "=r" (result) \ : "r" (PCIO_BASE), "r" (port)); \ result & 0xffff; \ @@ -101,7 +103,7 @@ DECLARE_IO(long,l,"","Jr") #define __outlc(value,port) \ ({ \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str%? %0, [%1, %2] @ outlc" \ : \ : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ }) @@ -110,7 +112,7 @@ DECLARE_IO(long,l,"","Jr") ({ \ unsigned long result; \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr%? %0, [%1, %2] @ inlc" \ : "=r" (result) \ : "r" (PCIO_BASE), "Jr" (port)); \ result; \ @@ -141,25 +143,68 @@ DECLARE_IO(long,l,"","Jr") (*(volatile unsigned long *)(p)) /* - * This is not sufficient... (and it's a hack anyway) + * ioremap support + */ +#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 0xe0000000 + +extern inline void *ioremap(unsigned long iomem_addr, unsigned long size) +{ + unsigned long phys_addr; + + if (!valid_ioaddr(iomem_addr, size)) + return NULL; + + phys_addr = io_to_phys(iomem_addr & PAGE_MASK); + + return (void *)((unsigned long)__ioremap(phys_addr, size, 0) + - IO_FUDGE_FACTOR); +} + +#define ioremap_nocache(iomem_addr,size) ioremap((iomem_addr),(size)) + +extern void iounmap(void *addr); + +/* + * We'd probably be better off with these as macros rather than functions. + * Firstly that would be more efficient and secondly we could do with the + * ability to stop GCC whinging about type conversions. --philb */ static inline void writeb(unsigned char b, unsigned int addr) { - *(volatile unsigned char *)(0xe0000000 + (addr)) = b; + *(volatile unsigned char *)(IO_FUDGE_FACTOR + (addr)) = b; } static inline unsigned char readb(unsigned int addr) { - return *(volatile unsigned char *)(0xe0000000 + (addr)); + return *(volatile unsigned char *)(IO_FUDGE_FACTOR + (addr)); } static inline void writew(unsigned short b, unsigned int addr) { - *(volatile unsigned short *)(0xe0000000 + (addr)) = b; + *(volatile unsigned short *)(IO_FUDGE_FACTOR + (addr)) = b; } static inline unsigned short readw(unsigned int addr) { - return *(volatile unsigned short *)(0xe0000000 + (addr)); + return *(volatile unsigned short *)(IO_FUDGE_FACTOR + (addr)); } + +static inline void writel(unsigned long b, unsigned int addr) +{ + *(volatile unsigned long *)(IO_FUDGE_FACTOR + (addr)) = b; +} + +static inline unsigned short readl(unsigned int addr) +{ + return *(volatile unsigned long *)(IO_FUDGE_FACTOR + (addr)); +} + #endif diff --git a/include/asm-arm/arch-ebsa285/irq.h b/include/asm-arm/arch-ebsa285/irq.h index 029b1b1a6..74bc33c58 100644 --- a/include/asm-arm/arch-ebsa285/irq.h +++ b/include/asm-arm/arch-ebsa285/irq.h @@ -5,7 +5,9 @@ * * Changelog: * 22-08-1998 RMK Restructured IRQ routines + * 03-09-1998 PJB Merged CATS support */ +#include <linux/config.h> static void ebsa285_mask_irq(unsigned int irq) { @@ -16,7 +18,73 @@ static void ebsa285_unmask_irq(unsigned int irq) { *CSR_IRQ_ENABLE = 1 << irq; } + +#ifdef CONFIG_CATS + +/* + * This contains the irq mask for both 8259A irq controllers, + */ +static unsigned int isa_irq_mask = 0xffff; + +#define cached_21 (isa_irq_mask & 0xff) +#define cached_A1 ((isa_irq_mask >> 8) & 0xff) + +#define update_8259(_irq) \ + if ((_irq) & 8) \ + outb(cached_A1, 0xa1); \ + else \ + outb(cached_21, 0x21); + +static void isa_interrupt(int irq, void *h, struct pt_regs *regs) +{ + asmlinkage void do_IRQ(int irq, struct pt_regs * regs); + unsigned int irqbits = inb(0x20) | (inb(0xa0) << 8), irqnr = 0; + irqbits &= ~(1<<2); /* don't try to service the cascade */ + while (irqbits) { + if (irqbits & 1) + do_IRQ(32 + irqnr, regs); + irqbits >>= 1; + irqnr++; + } +} + +static void no_action(int cpl, void *dev_id, struct pt_regs *regs) { } + +static struct irqaction irq_isa = + { isa_interrupt, SA_INTERRUPT, 0, "ISA PIC", NULL, NULL }; +static struct irqaction irq_cascade = + { no_action, 0, 0, "cascade", NULL, NULL }; + +static void cats_mask_and_ack_isa_irq(unsigned int irq) +{ + isa_irq_mask |= (1 << (irq - 32)); + update_8259(irq); + if (irq & 8) { + inb(0xA1); /* DUMMY */ + outb(cached_A1,0xA1); + outb(0x62,0x20); /* Specific EOI to cascade */ + outb(0x20,0xA0); + } else { + inb(0x21); /* DUMMY */ + outb(cached_21,0x21); + outb(0x20,0x20); + } +} + +static void cats_mask_isa_irq(unsigned int irq) +{ + isa_irq_mask |= (1 << (irq - 32)); + update_8259(irq); +} + +static void cats_unmask_isa_irq(unsigned int irq) +{ + isa_irq_mask &= ~(1 << (irq - 32)); + update_8259(irq); +} +#endif + static __inline__ void irq_init_irq(void) { int irq; @@ -27,8 +95,45 @@ static __inline__ void irq_init_irq(void) for (irq = 0; irq < NR_IRQS; irq++) { irq_desc[irq].valid = 1; irq_desc[irq].probe_ok = 1; - irq_desc[irq].mask_ack = ebsa285_mask_irq; - irq_desc[irq].mask = ebsa285_mask_irq; - irq_desc[irq].unmask = ebsa285_unmask_irq; +#ifdef CONFIG_CATS + if (machine_is_cats() && IRQ_IS_ISA(irq)) { + irq_desc[irq].mask_ack = cats_mask_and_ack_isa_irq; + irq_desc[irq].mask = cats_mask_isa_irq; + irq_desc[irq].unmask = cats_unmask_isa_irq; + } else +#endif + { + irq_desc[irq].mask_ack = ebsa285_mask_irq; + irq_desc[irq].mask = ebsa285_mask_irq; + irq_desc[irq].unmask = ebsa285_unmask_irq; + } + } + +#ifdef CONFIG_CATS + if (machine_is_cats()) { + request_region(0x20, 2, "pic1"); + request_region(0xa0, 2, "pic2"); + + /* set up master 8259 */ + outb(0x11, 0x20); + outb(0, 0x21); + outb(1<<2, 0x21); + outb(0x1, 0x21); + outb(0xff, 0x21); + outb(0x68, 0x20); + outb(0xa, 0x20); + + /* set up slave 8259 */ + outb(0x11, 0xa0); + outb(0, 0xa1); + outb(2, 0xa1); + outb(0x1, 0xa1); + outb(0xff, 0xa1); + outb(0x68, 0xa0); + outb(0xa, 0xa0); + + setup_arm_irq(IRQ_ISA_PIC, &irq_isa); + setup_arm_irq(IRQ_ISA_CASCADE, &irq_cascade); } +#endif } diff --git a/include/asm-arm/arch-ebsa285/irqs.h b/include/asm-arm/arch-ebsa285/irqs.h index f2ef06c9d..6021bee6e 100644 --- a/include/asm-arm/arch-ebsa285/irqs.h +++ b/include/asm-arm/arch-ebsa285/irqs.h @@ -2,9 +2,10 @@ * linux/include/asm-arm/arch-ebsa285/irqs.h * * Copyright (C) 1998 Russell King + * Copyright (C) 1998 Phil Blundell */ -#define NR_IRQS 32 +#define NR_IRQS 48 /* * This is a list of all interrupts that the 21285 @@ -39,10 +40,18 @@ #define IRQ_PCITARGETABORT 30 #define IRQ_PCIPARITY 31 +/* IRQs 32-47 are the 16 ISA interrupts on a CATS board. */ +#define IRQ_ISA_PIC IRQ_IN2 +#define IRQ_IS_ISA(_x) (((_x) >= 32) && ((_x) <= 47)) +#define IRQ_ISA(_x) ((_x) + 0x20) +#define IRQ_ISA_CASCADE IRQ_ISA(2) + /* * Now map them to the Linux interrupts */ #define IRQ_TIMER IRQ_TIMER1 +#define IRQ_FLOPPYDISK IRQ_ISA(6) +#define IRQ_HARDDISK IRQ_ISA(14) +#define IRQ_HARDDISK_SECONDARY IRQ_ISA(15) -#define irq_cannonicalize(i) (i) - +#define irq_cannonicalize(_i) (((_i) == IRQ_ISA_CASCADE) ? IRQ_ISA(9) : _i) diff --git a/include/asm-arm/arch-ebsa285/keyboard.h b/include/asm-arm/arch-ebsa285/keyboard.h index 4620ff165..ad6eb0e5a 100644 --- a/include/asm-arm/arch-ebsa285/keyboard.h +++ b/include/asm-arm/arch-ebsa285/keyboard.h @@ -4,16 +4,48 @@ * Keyboard driver definitions for EBSA285 architecture * * (C) 1998 Russell King + * (C) 1998 Phil Blundell */ #include <linux/config.h> #include <asm/irq.h> +#include <asm/system.h> #define NR_SCANCODES 128 -#ifdef CONFIG_MAGIC_SYSRQ -static unsigned char kbd_sysrq_xlate[NR_SCANCODES]; -#endif +#ifdef CONFIG_CATS + +#define KEYBOARD_IRQ IRQ_ISA(1) + +extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); +extern int pckbd_getkeycode(unsigned int scancode); +extern int pckbd_pretranslate(unsigned char scancode, char raw_mode); +extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, + char raw_mode); +extern char pckbd_unexpected_up(unsigned char keycode); +extern void pckbd_leds(unsigned char leds); +extern void pckbd_init_hw(void); +extern unsigned char pckbd_sysrq_xlate[128]; + +#define kbd_setkeycode pckbd_setkeycode +#define kbd_getkeycode pckbd_getkeycode +#define kbd_pretranslate pckbd_pretranslate +#define kbd_translate(sc, kcp, ufp, rm) ({ *ufp = sc & 0200; \ + pckbd_translate(sc & 0x7f, kcp, rm);}) + +#define kbd_unexpected_up pckbd_unexpected_up +#define kbd_leds pckbd_leds +#define kbd_init_hw() \ + do { if (machine_is_cats()) pckbd_init_hw(); } while (0) +#define kbd_sysrq_xlate pckbd_sysrq_xlate +#define kbd_disable_irq() +#define kbd_enable_irq() + +#define SYSRQ_KEY 0x54 + +#else + +/* Dummy keyboard definitions */ #define kbd_setkeycode(sc,kc) (-EINVAL) #define kbd_getkeycode(sc) (-EINVAL) @@ -35,3 +67,6 @@ static unsigned char kbd_sysrq_xlate[NR_SCANCODES]; #define kbd_disable_irq() #define kbd_enable_irq() +#define SYSRQ_KEY 13 + +#endif diff --git a/include/asm-arm/arch-ebsa285/mmu.h b/include/asm-arm/arch-ebsa285/mmu.h index 8e2e98ef6..b26aa8f66 100644 --- a/include/asm-arm/arch-ebsa285/mmu.h +++ b/include/asm-arm/arch-ebsa285/mmu.h @@ -7,6 +7,7 @@ * 20-10-1996 RMK Created * 31-12-1997 RMK Fixed definitions to reduce warnings * 17-05-1998 DAG Added __virt_to_bus and __bus_to_virt functions. + * 21-11-1998 RMK Changed __virt_to_bus and __bus_to_virt to macros. */ #ifndef __ASM_ARCH_MMU_H #define __ASM_ARCH_MMU_H @@ -15,11 +16,13 @@ * On ebsa285, the dram is contiguous */ #define __virt_to_phys__is_a_macro -#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET) +#define __virt_to_phys(vpage) ((unsigned long)(vpage) - PAGE_OFFSET) #define __phys_to_virt__is_a_macro -#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET) +#define __phys_to_virt(ppage) ((unsigned long)(ppage) + PAGE_OFFSET) -extern unsigned long __virt_to_bus(unsigned long); -extern unsigned long __bus_to_virt(unsigned long); +#define __virt_to_bus__is_a_macro +#define __virt_to_bus(x) ((x) - 0xe0000000) +#define __bus_to_virt__is_a_macro +#define __bus_to_virt(x) ((x) + 0xe0000000) #endif diff --git a/include/asm-arm/arch-ebsa285/processor.h b/include/asm-arm/arch-ebsa285/processor.h index bf1f6d384..e98d1ff33 100644 --- a/include/asm-arm/arch-ebsa285/processor.h +++ b/include/asm-arm/arch-ebsa285/processor.h @@ -23,12 +23,7 @@ /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ -#if 0 -#define TASK_UNMAPPED_BASE(off) (TASK_SIZE / 3) -#else #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) -#endif -#define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr) #define INIT_MMAP \ { &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } diff --git a/include/asm-arm/arch-ebsa285/serial.h b/include/asm-arm/arch-ebsa285/serial.h index 0e8479ff8..c874f9dfa 100644 --- a/include/asm-arm/arch-ebsa285/serial.h +++ b/include/asm-arm/arch-ebsa285/serial.h @@ -5,10 +5,15 @@ * * Changelog: * 15-10-1996 RMK Created + * 25-05-1998 PJB CATS support */ #ifndef __ASM_ARCH_SERIAL_H #define __ASM_ARCH_SERIAL_H +#include <linux/config.h> + +#include <asm/irq.h> + /* * This assumes you have a 1.8432 MHz clock for your UART. * @@ -18,23 +23,31 @@ */ #define BASE_BAUD (1843200 / 16) +#ifdef CONFIG_CATS +#define _SER_IRQ0 IRQ_ISA(4) +#define _SER_IRQ1 IRQ_ISA(3) +#else +#define _SER_IRQ0 0 +#define _SER_IRQ1 0 +#endif + #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) /* UART CLK PORT IRQ FLAGS */ #define SERIAL_PORT_DFNS \ - { 0, BASE_BAUD, 0x3F8, 0, STD_COM_FLAGS }, /* ttyS0 */ \ - { 0, BASE_BAUD, 0x2F8, 0, 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, 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 */ #endif diff --git a/include/asm-arm/arch-ebsa285/system.h b/include/asm-arm/arch-ebsa285/system.h index a3fed312c..40d540dba 100644 --- a/include/asm-arm/arch-ebsa285/system.h +++ b/include/asm-arm/arch-ebsa285/system.h @@ -6,19 +6,26 @@ #include <asm/hardware.h> #include <asm/leds.h> -/* To reboot, we set up the 21285 watchdog and enable it. - * We then wait for it to timeout. - */ -extern __inline__ void arch_hard_reset (void) +extern __inline__ void arch_reset(char mode) { cli(); - *CSR_TIMER4_LOAD = 0x8000; - *CSR_TIMER4_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16; - *CSR_SA110_CNTL |= 1 << 13; - while(1); -} -#define ARCH_IDLE_OK + if (mode == 's') { + __asm__ volatile ( + "mov lr, #0x41000000 @ prepare to jump to ROM + mov r0, #0x130 + mcr p15, 0, r0, c1, c0 @ MMU off + mcr p15, 0, ip, c7, c7 @ flush caches + mov pc, lr"); + } else { + /* To reboot, we set up the 21285 watchdog and enable it. + * We then wait for it to timeout. + */ + *CSR_TIMER4_LOAD = 0x8000; + *CSR_TIMER4_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16; + *CSR_SA110_CNTL |= 1 << 13; + } +} #define arch_start_idle() leds_event(led_idle_start) #define arch_end_idle() leds_event(led_idle_end) diff --git a/include/asm-arm/arch-ebsa285/time.h b/include/asm-arm/arch-ebsa285/time.h index cbc53293a..342e9528f 100644 --- a/include/asm-arm/arch-ebsa285/time.h +++ b/include/asm-arm/arch-ebsa285/time.h @@ -2,40 +2,58 @@ * linux/include/asm-arm/arch-ebsa285/time.h * * Copyright (c) 1998 Russell King. + * Copyright (c) 1998 Phil Blundell * - * No real time clock on the evalulation board! + * CATS has a real-time clock, though the evaluation board doesn't. * * Changelog: * 21-Mar-1998 RMK Created + * 27-Aug-1998 PJB CATS support + * 28-Dec-1998 APH Made leds optional */ +#define RTC_PORT(x) (0x72+(x)) +#define RTC_ALWAYS_BCD 1 + +#include <linux/config.h> #include <asm/leds.h> +#include <asm/system.h> +#include <linux/mc146818rtc.h> extern __inline__ unsigned long gettimeoffset (void) { - return 0; + unsigned long value = LATCH - *CSR_TIMER1_VALUE; + + return (tick * value) / LATCH; } extern __inline__ int reset_timer (void) { - static unsigned int count = 50; - static int last_pid; - *CSR_TIMER1_CLR = 0; - if (current->pid != last_pid) { - last_pid = current->pid; - if (last_pid) - leds_event(led_idle_end); - else - leds_event(led_idle_start); - } +#ifdef CONFIG_LEDS + /* + * Do the LEDs thing on EBSA-285 hardware. + */ + if (!machine_is_cats()) { + static unsigned int count = 50; + static int last_pid; - if (--count == 0) { - count = 50; - leds_event(led_timer); + if (current->pid != last_pid) { + last_pid = current->pid; + if (last_pid) + leds_event(led_idle_end); + else + leds_event(led_idle_start); + } + + if (--count == 0) { + count = 50; + leds_event(led_timer); + } } - +#endif + return 1; } @@ -49,9 +67,59 @@ extern __inline__ int reset_timer (void) */ extern __inline__ unsigned long setup_timer (void) { + int year, mon, day, hour, min, sec; + + /* + * Default the date to 1 Jan 1970 0:0:0 + */ + year = 1970; mon = 1; day = 1; + hour = 0; min = 0; sec = 0; + *CSR_TIMER1_CLR = 0; *CSR_TIMER1_LOAD = LATCH; *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16; - return mktime(1970, 1, 1, 0, 0, 0); + if (machine_is_cats()) + { + int i; + /* + * Read the real time from the Dallas chip. (Code borrowed + * from arch/i386/kernel/time.c). + */ + + /* The Linux interpretation of the CMOS clock register contents: + * When the Update-In-Progress (UIP) flag goes from 1 to 0, the + * RTC registers show the second which has precisely just started. + * Let's hope other operating systems interpret the RTC the same way. + */ + + /* read RTC exactly on falling edge of update flag */ + for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ + if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) + break; + for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */ + if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)) + break; + do { /* Isn't this overkill ? UIP above should guarantee consistency */ + sec = CMOS_READ(RTC_SECONDS); + min = CMOS_READ(RTC_MINUTES); + hour = CMOS_READ(RTC_HOURS); + day = CMOS_READ(RTC_DAY_OF_MONTH); + mon = CMOS_READ(RTC_MONTH); + year = CMOS_READ(RTC_YEAR); + } while (sec != CMOS_READ(RTC_SECONDS)); + if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) + { + BCD_TO_BIN(sec); + BCD_TO_BIN(min); + BCD_TO_BIN(hour); + BCD_TO_BIN(day); + BCD_TO_BIN(mon); + BCD_TO_BIN(year); + } + if ((year += 1900) < 1970) + year += 100; + } + + return mktime(year, mon, day, hour, min, sec); } diff --git a/include/asm-arm/arch-ebsa285/uncompress.h b/include/asm-arm/arch-ebsa285/uncompress.h index d6097d43f..7f655745f 100644 --- a/include/asm-arm/arch-ebsa285/uncompress.h +++ b/include/asm-arm/arch-ebsa285/uncompress.h @@ -4,27 +4,25 @@ * Copyright (C) 1996,1997,1998 Russell King */ +#define BASE 0x42000160 + +static __inline__ void putc(char c) +{ + while (*((volatile unsigned int *)(BASE + 0x18)) & 8); + *((volatile unsigned int *)(BASE)) = c; +} + /* * This does not append a newline */ static void puts(const char *s) { - __asm__ __volatile__(" - ldrb %0, [%2], #1 - teq %0, #0 - beq 3f -1: strb %0, [%3] -2: ldrb %1, [%3, #0x14] - and %1, %1, #0x60 - teq %1, #0x60 - bne 2b - teq %0, #'\n' - moveq %0, #'\r' - beq 1b - ldrb %0, [%2], #1 - teq %0, #0 - bne 1b -3: " : : "r" (0), "r" (0), "r" (s), "r" (0xf0000be0) : "cc"); + while (*s) { + putc(*s); + if (*s == '\n') + putc('\r'); + s++; + } } /* diff --git a/include/asm-arm/arch-nexuspci/a.out.h b/include/asm-arm/arch-nexuspci/a.out.h index 9051eb0c9..4972f5f70 100644 --- a/include/asm-arm/arch-nexuspci/a.out.h +++ b/include/asm-arm/arch-nexuspci/a.out.h @@ -9,7 +9,6 @@ #ifdef __KERNEL__ #define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) -#define LIBRARY_START_TEXT (0x00c00000) #endif #endif diff --git a/include/asm-arm/arch-nexuspci/dma.h b/include/asm-arm/arch-nexuspci/dma.h index 83931f566..6d0a46e17 100644 --- a/include/asm-arm/arch-nexuspci/dma.h +++ b/include/asm-arm/arch-nexuspci/dma.h @@ -7,6 +7,3 @@ * Copyright (C) 1998 Philip Blundell */ -/* Need this to keep <asm/dma.h> happy. */ -typedef unsigned int dmamode_t; - diff --git a/include/asm-arm/arch-nexuspci/hardware.h b/include/asm-arm/arch-nexuspci/hardware.h index 997569748..6141bbf4c 100644 --- a/include/asm-arm/arch-nexuspci/hardware.h +++ b/include/asm-arm/arch-nexuspci/hardware.h @@ -27,15 +27,13 @@ /* * Mapping areas */ -#define IO_END 0xffffffff #define IO_BASE 0xfe000000 -#define IO_SIZE (IO_END - IO_BASE) /* * RAM definitions */ #define RAM_BASE 0x40000000 #define KERNTOPHYS(a) ((unsigned long)(&a)) -#define SAFE_ADDR 0x40000000 +#define FLUSH_BASE_PHYS 0x40000000 #endif diff --git a/include/asm-arm/arch-nexuspci/processor.h b/include/asm-arm/arch-nexuspci/processor.h index da9fdd583..f722be87c 100644 --- a/include/asm-arm/arch-nexuspci/processor.h +++ b/include/asm-arm/arch-nexuspci/processor.h @@ -24,12 +24,7 @@ /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ -#if 0 -#define TASK_UNMAPPED_BASE(off) (TASK_SIZE / 3) -#else #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) -#endif -#define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr) #define INIT_MMAP \ { &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } diff --git a/include/asm-arm/arch-nexuspci/system.h b/include/asm-arm/arch-nexuspci/system.h index 7042dc436..b5a2464b2 100644 --- a/include/asm-arm/arch-nexuspci/system.h +++ b/include/asm-arm/arch-nexuspci/system.h @@ -6,13 +6,12 @@ #ifndef __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H -extern __inline__ void arch_hard_reset (void) +extern __inline__ void arch_reset(char mode) { /* * loop endlessly - the watchdog will reset us if it's enabled. */ cli(); - while (1); } #endif diff --git a/include/asm-arm/arch-rpc/a.out.h b/include/asm-arm/arch-rpc/a.out.h index 6b55ee076..598614f23 100644 --- a/include/asm-arm/arch-rpc/a.out.h +++ b/include/asm-arm/arch-rpc/a.out.h @@ -9,7 +9,6 @@ #ifdef __KERNEL__ #define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) -#define LIBRARY_START_TEXT (0x00c00000) #endif #endif diff --git a/include/asm-arm/arch-rpc/dma.h b/include/asm-arm/arch-rpc/dma.h index 0f556e856..c6b6679af 100644 --- a/include/asm-arm/arch-rpc/dma.h +++ b/include/asm-arm/arch-rpc/dma.h @@ -7,15 +7,6 @@ * bytes of RAM. */ #define MAX_DMA_ADDRESS 0xd0000000 - -/* - * DMA modes - we have two, IN and OUT - */ -typedef enum { - DMA_MODE_READ, - DMA_MODE_WRITE -} dmamode_t; - #define MAX_DMA_CHANNELS 8 #define DMA_0 0 diff --git a/include/asm-arm/arch-rpc/hardware.h b/include/asm-arm/arch-rpc/hardware.h index 706992b78..8ca6273ff 100644 --- a/include/asm-arm/arch-rpc/hardware.h +++ b/include/asm-arm/arch-rpc/hardware.h @@ -13,33 +13,46 @@ * What hardware must be present */ #define HAS_IOMD -#define HAS_PCIO +#include <asm/iomd.h> #define HAS_VIDC20 -/* - * Optional hardware - */ -#define HAS_EXPMASK - -/* - * Physical definitions +/* Hardware addresses of major areas. + * *_START is the physical address + * *_SIZE is the size of the region + * *_BASE is the virtual address */ +#define RAM_SIZE 0x10000000 #define RAM_START 0x10000000 -#define IO_START 0x03000000 + +#define EASI_SIZE 0x08000000 /* EASI I/O */ +#define EASI_START 0x08000000 +#define EASI_BASE 0xe8000000 + +#define IO_START 0x03000000 /* I/O */ +#define IO_SIZE 0x01000000 +#define IO_BASE 0xe0000000 + #define SCREEN_START 0x02000000 /* VRAM */ +#define SCREEN2_END 0xe0000000 +#define SCREEN2_BASE 0xd8000000 +#define SCREEN1_END 0xd8000000 +#define SCREEN1_BASE 0xd0000000 + #ifndef __ASSEMBLER__ /* * for use with inb/outb */ -#define VIDC_AUDIO_BASE 0x80140000 -#define VIDC_BASE 0x80100000 -#define IOCEC4IO_BASE 0x8009c000 -#define IOCECIO_BASE 0x80090000 -#define IOMD_BASE 0x80080000 -#define MEMCEC8IO_BASE 0x8000ac00 -#define MEMCECIO_BASE 0x80000000 +#define IO_VIDC_AUDIO_BASE 0x80140000 +#define IO_VIDC_BASE 0x80100000 +#define IO_IOMD_BASE 0x80080000 + +#define IO_EC_EASI_BASE 0x82000000 +#define IO_EC_IOC4_BASE 0x8009c000 +#define IO_EC_IOC_BASE 0x80090000 +#define IO_EC_MEMC8_BASE 0x8000ac00 +#define IO_EC_MEMC_BASE 0x80000000 /* * IO definitions @@ -51,21 +64,6 @@ #define PCIO_BASE 0xe0010000 /* - * Mapping areas - */ -#define IO_END 0xe1000000 -#define IO_BASE 0xe0000000 -#define IO_SIZE (IO_END - IO_BASE) - -/* - * Screen mapping information - */ -#define SCREEN2_END 0xe0000000 -#define SCREEN2_BASE 0xd8000000 -#define SCREEN1_END SCREEN2_BASE -#define SCREEN1_BASE 0xd0000000 - -/* * Offsets from RAM base */ #define PARAMS_OFFSET 0x0100 @@ -95,7 +93,6 @@ #define IOC_BASE 0xe0200000 #define PCIO_FLOPPYDMABASE 0xe002a000 #define PCIO_BASE 0xe0010000 -#define IO_BASE 0xe0000000 #endif #endif diff --git a/include/asm-arm/arch-rpc/ide.h b/include/asm-arm/arch-rpc/ide.h index 311a98853..ccbc7cf76 100644 --- a/include/asm-arm/arch-rpc/ide.h +++ b/include/asm-arm/arch-rpc/ide.h @@ -2,44 +2,41 @@ * linux/include/asm-arm/arch-rpc/ide.h * * Copyright (c) 1997 Russell King + * + * Modifications: + * 29-07-1998 RMK Major re-work of IDE architecture specific code */ #include <asm/irq.h> -static __inline__ int -ide_default_irq(ide_ioreg_t base) +/* + * 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) { - if (base == 0x1f0) - return IRQ_HARDDISK; - return 0; -} + ide_ioreg_t reg = (ide_ioreg_t) data_port; + int i; -static __inline__ ide_ioreg_t -ide_default_io_base(int index) -{ - if (index == 0) - return 0x1f0; - return 0; -} + memset(hw, 0, sizeof(*hw)); -static __inline__ int -ide_default_stepping(int index) -{ - return 0; + 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_hwif_ports (ide_ioreg_t *p, ide_ioreg_t base, int stepping, int *irq) +ide_init_default_hwifs(void) { - ide_ioreg_t port = base; - ide_ioreg_t ctrl = base + 0x206; - int i; + hw_regs_t hw; - i = 8; - while (i--) { - *p++ = port; - port += 1 << stepping; - } - *p++ = ctrl; - if (irq != NULL) - *irq = 0; + ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, IRQ_HARDDISK); + ide_register_hw(&hw, NULL); } diff --git a/include/asm-arm/arch-rpc/io.h b/include/asm-arm/arch-rpc/io.h index 43d787b96..ecf07c17c 100644 --- a/include/asm-arm/arch-rpc/io.h +++ b/include/asm-arm/arch-rpc/io.h @@ -36,7 +36,7 @@ extern __inline__ void __out##fnsuffix (unsigned int value, unsigned int port) \ "tst %2, #0x80000000\n\t" \ "mov %0, %4\n\t" \ "addeq %0, %0, %3\n\t" \ - "str" ##instr## " %1, [%0, %2, lsl #2]" \ + "str" ##instr## " %1, [%0, %2, lsl #2] @ out"###fnsuffix \ : "=&r" (temp) \ : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \ : "cc"); \ @@ -50,7 +50,7 @@ extern __inline__ unsigned sz __in##fnsuffix (unsigned int port) \ "tst %2, #0x80000000\n\t" \ "mov %0, %4\n\t" \ "addeq %0, %0, %3\n\t" \ - "ldr" ##instr## " %1, [%0, %2, lsl #2]" \ + "ldr" ##instr## " %1, [%0, %2, lsl #2] @ in"###fnsuffix \ : "=&r" (temp), "=r" (value) \ : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \ : "cc"); \ @@ -87,11 +87,11 @@ DECLARE_IO(long,l,"") ({ \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "strb %0, [%1, %2]" \ + "strb %0, [%1, %2] @ outbc" \ : : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "strb %0, [%1, %2]" \ + "strb %0, [%1, %2] @ outbc" \ : : "r" (value), "r" (IO_BASE), "r" ((port) << 2)); \ }) @@ -100,11 +100,11 @@ DECLARE_IO(long,l,"") unsigned char result; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "ldrb %0, [%1, %2]" \ + "ldrb %0, [%1, %2] @ inbc" \ : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "ldrb %0, [%1, %2]" \ + "ldrb %0, [%1, %2] @ inbc" \ : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ result; \ }) @@ -114,11 +114,11 @@ DECLARE_IO(long,l,"") unsigned long v = value; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str %0, [%1, %2] @ outwc" \ : : "r" (v|v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str %0, [%1, %2] @ outwc" \ : : "r" (v|v<<16), "r" (IO_BASE), "r" ((port) << 2)); \ }) @@ -127,11 +127,11 @@ DECLARE_IO(long,l,"") unsigned short result; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr %0, [%1, %2] @ inwc" \ : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr %0, [%1, %2] @ inwc" \ : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ result & 0xffff; \ }) @@ -141,11 +141,11 @@ DECLARE_IO(long,l,"") unsigned long v = value; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str %0, [%1, %2] @ outlc" \ : : "r" (v), "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str %0, [%1, %2] @ outlc" \ : : "r" (v), "r" (IO_BASE), "r" ((port) << 2)); \ }) @@ -154,11 +154,11 @@ DECLARE_IO(long,l,"") unsigned long result; \ if (__PORT_PCIO((port))) \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr %0, [%1, %2] @ inlc" \ : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \ else \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr %0, [%1, %2] @ inlc" \ : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \ result; \ }) diff --git a/include/asm-arm/arch-rpc/keyboard.h b/include/asm-arm/arch-rpc/keyboard.h index 44090e122..6c04cf074 100644 --- a/include/asm-arm/arch-rpc/keyboard.h +++ b/include/asm-arm/arch-rpc/keyboard.h @@ -40,3 +40,4 @@ extern unsigned char ps2kbd_sysrq_xlate[NR_SCANCODES]; #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-rpc/processor.h b/include/asm-arm/arch-rpc/processor.h index cdb79eeed..2fd9155b2 100644 --- a/include/asm-arm/arch-rpc/processor.h +++ b/include/asm-arm/arch-rpc/processor.h @@ -26,12 +26,7 @@ /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ -#if 0 -#define TASK_UNMAPPED_BASE(off) (TASK_SIZE / 3) -#else #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) -#endif -#define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr) #define INIT_MMAP \ { &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } diff --git a/include/asm-arm/arch-rpc/system.h b/include/asm-arm/arch-rpc/system.h index aa6e645c6..e0a16f61d 100644 --- a/include/asm-arm/arch-rpc/system.h +++ b/include/asm-arm/arch-rpc/system.h @@ -8,10 +8,10 @@ #include <asm/proc-fns.h> -#define arch_hard_reset() { \ +#define arch_reset(mode) { \ extern void ecard_reset (int card); \ outb (0, IOMD_ROMCR0); \ - ecard_reset (-1); \ + ecard_reset(-1); \ cli(); \ __asm__ __volatile__("msr spsr, r1;" \ "mcr p15, 0, %0, c1, c0, 0;" \ diff --git a/include/asm-arm/arch-vnc/a.out.h b/include/asm-arm/arch-vnc/a.out.h index 05f7c1d58..011b08373 100644 --- a/include/asm-arm/arch-vnc/a.out.h +++ b/include/asm-arm/arch-vnc/a.out.h @@ -9,7 +9,6 @@ #ifdef __KERNEL__ #define STACK_TOP ((current->personality==PER_LINUX_32BIT)? 0xc0000000 : 0x04000000) -#define LIBRARY_START_TEXT (0x00c00000) #endif #endif diff --git a/include/asm-arm/arch-vnc/dma.h b/include/asm-arm/arch-vnc/dma.h index e6d042675..f205f0376 100644 --- a/include/asm-arm/arch-vnc/dma.h +++ b/include/asm-arm/arch-vnc/dma.h @@ -14,15 +14,6 @@ * bytes of RAM. */ #define MAX_DMA_ADDRESS 0xd0000000 - -/* - * DMA modes - we have two, IN and OUT - */ -typedef enum { - DMA_MODE_READ, - DMA_MODE_WRITE -} dmamode_t; - #define MAX_DMA_CHANNELS 8 #endif /* _ASM_ARCH_DMA_H */ diff --git a/include/asm-arm/arch-vnc/hardware.h b/include/asm-arm/arch-vnc/hardware.h index b0021b724..e95b1e7b6 100644 --- a/include/asm-arm/arch-vnc/hardware.h +++ b/include/asm-arm/arch-vnc/hardware.h @@ -7,84 +7,20 @@ */ /* Logical Physical - * 0xfff00000 0x40000000 X-Bus * 0xffe00000 0x7c000000 PCI I/O space - * * 0xfe000000 0x42000000 CSR * 0xfd000000 0x78000000 Outbound write flush * 0xfc000000 0x79000000 PCI IACK/special space - * - * 0xf9030000 0x7a080000 PCI Config type 1 card 4 - * 0xf9020000 0x7a040000 PCI Config type 1 card 3 - * 0xf9010000 0x7a020000 PCI Config type 1 card 2 - * 0xf9000000 0x7a010000 PCI Config type 1 card 1 - * - * 0xf8030000 0x7b080000 PCI Config type 0 card 4 - * 0xf8020000 0x7b040000 PCI Config type 0 card 3 - * 0xf8010000 0x7b020000 PCI Config type 0 card 2 - * 0xf8000000 0x7b010000 PCI Config type 0 card 1 + * 0xf9000000 0x7a000000 PCI Config type 1 + * 0xf8000000 0x7b000000 PCI Config type 0 * */ - -/* - * DEC21285 - */ -#define CSR_SA110_CNTL ((volatile unsigned long *)0xfe00013c) -#define CSR_PCIADDR_EXTN ((volatile unsigned long *)0xfe000140) -#define CSR_PREFETCHMEMRANGE ((volatile unsigned long *)0xfe000144) -#define CSR_XBUS_CYCLE ((volatile unsigned long *)0xfe000148) -#define CSR_XBUS_IOSTROBE ((volatile unsigned long *)0xfe00014c) -#define CSR_DOORBELL_PCI ((volatile unsigned long *)0xfe000150) -#define CSR_DOORBELL_SA110 ((volatile unsigned long *)0xfe000154) - - -#define CSR_UARTDR ((volatile unsigned long *)0xfe000160) -#define CSR_RXSTAT ((volatile unsigned long *)0xfe000164) -#define CSR_H_UBRLCR ((volatile unsigned long *)0xfe000168) -#define CSR_M_UBRLCR ((volatile unsigned long *)0xfe00016c) -#define CSR_L_UBRLCR ((volatile unsigned long *)0xfe000170) -#define CSR_UARTCON ((volatile unsigned long *)0xfe000174) -#define CSR_UARTFLG ((volatile unsigned long *)0xfe000178) - -#define CSR_IRQ_STATUS ((volatile unsigned long *)0xfe000180) -#define CSR_IRQ_RAWSTATUS ((volatile unsigned long *)0xfe000184) -#define CSR_IRQ_ENABLE ((volatile unsigned long *)0xfe000188) -#define CSR_IRQ_DISABLE ((volatile unsigned long *)0xfe00018c) -#define CSR_IRQ_SOFT ((volatile unsigned long *)0xfe000190) -#define CSR_FIQ_STATUS ((volatile unsigned long *)0xfe000280) -#define CSR_FIQ_RAWSTATUS ((volatile unsigned long *)0xfe000284) -#define CSR_FIQ_ENABLE ((volatile unsigned long *)0xfe000288) -#define CSR_FIQ_DISABLE ((volatile unsigned long *)0xfe00028c) -#define CSR_FIQ_SOFT ((volatile unsigned long *)0xfe000290) - -#define CSR_TIMER1_LOAD ((volatile unsigned long *)0xfe000300) -#define CSR_TIMER1_VALUE ((volatile unsigned long *)0xfe000304) -#define CSR_TIMER1_CNTL ((volatile unsigned long *)0xfe000308) -#define CSR_TIMER1_CLR ((volatile unsigned long *)0xfe00030c) - -#define CSR_TIMER2_LOAD ((volatile unsigned long *)0xfe000320) -#define CSR_TIMER2_VALUE ((volatile unsigned long *)0xfe000324) -#define CSR_TIMER2_CNTL ((volatile unsigned long *)0xfe000328) -#define CSR_TIMER2_CLR ((volatile unsigned long *)0xfe00032c) - -#define CSR_TIMER3_LOAD ((volatile unsigned long *)0xfe000340) -#define CSR_TIMER3_VALUE ((volatile unsigned long *)0xfe000344) -#define CSR_TIMER3_CNTL ((volatile unsigned long *)0xfe000348) -#define CSR_TIMER3_CLR ((volatile unsigned long *)0xfe00034c) - -#define CSR_TIMER4_LOAD ((volatile unsigned long *)0xfe000360) -#define CSR_TIMER4_VALUE ((volatile unsigned long *)0xfe000364) -#define CSR_TIMER4_CNTL ((volatile unsigned long *)0xfe000368) -#define CSR_TIMER4_CLR ((volatile unsigned long *)0xfe00036c) - -#define TIMER_CNTL_ENABLE (1 << 7) -#define TIMER_CNTL_AUTORELOAD (1 << 6) -#define TIMER_CNTL_DIV1 (0) -#define TIMER_CNTL_DIV16 (1 << 2) -#define TIMER_CNTL_DIV256 (2 << 2) -#define TIMER_CNTL_CNTEXT (3 << 2) +#include <asm/dec21285.h> +#define IO_BASE_ARM_CSR 0xfe000000 +#define PCI_IACK 0xfc000000 + /* LEDs */ #define XBUS_LEDS ((volatile unsigned char *)0xfff12000) #define XBUS_LED_AMBER (1 << 0) @@ -103,18 +39,36 @@ #define IO_SIZE (IO_END - IO_BASE) #define HAS_PCIO - -#define XBUS_SWITCH ((volatile unsigned char *)0xfff12000) -#define XBUS_SWITCH_SWITCH ((*XBUS_SWITCH) & 15) -#define XBUS_SWITCH_J17_13 ((*XBUS_SWITCH) & (1 << 4)) -#define XBUS_SWITCH_J17_11 ((*XBUS_SWITCH) & (1 << 5)) -#define XBUS_SWITCH_J17_9 ((*XBUS_SWITCH) & (1 << 6)) - #define PCIO_BASE 0xffe00000 #define KERNTOPHYS(a) ((unsigned long)(&a)) -#define PARAMS_OFFSET 0x0100 -#define PARAMS_BASE (PAGE_OFFSET + PARAMS_OFFSET) - -#define SAFE_ADDR 0x50000000 +//#define PARAMS_OFFSET 0x0100 +//#define PARAMS_BASE (PAGE_OFFSET + PARAMS_OFFSET) + +#define FLUSH_BASE_PHYS 0x50000000 + +/* GPIO pins */ +#define GPIO_CCLK 0x800 +#define GPIO_DSCLK 0x400 +#define GPIO_E2CLK 0x200 +#define GPIO_IOLOAD 0x100 +#define GPIO_RED_LED 0x080 +#define GPIO_WDTIMER 0x040 +#define GPIO_DATA 0x020 +#define GPIO_IOCLK 0x010 +#define GPIO_DONE 0x008 +#define GPIO_FAN 0x004 +#define GPIO_GREEN_LED 0x002 +#define GPIO_RESET 0x001 + +/* CPLD pins */ +#define CPLD_DSRESET 8 +#define CPLD_UNMUTE 2 + +#ifndef __ASSEMBLY__ +extern void gpio_modify_op(int mask, int set); +extern void gpio_modify_io(int mask, int in); +extern int gpio_read(void); +extern void cpld_modify(int mask, int set); +#endif diff --git a/include/asm-arm/arch-vnc/ide.h b/include/asm-arm/arch-vnc/ide.h index 35eff5c28..c3761ab90 100644 --- a/include/asm-arm/arch-vnc/ide.h +++ b/include/asm-arm/arch-vnc/ide.h @@ -1 +1,42 @@ -/* no ide */ +/* + * linux/include/asm-arm/arch-vnc/ide.h + * + * Copyright (c) 1998 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) +{ + hw_regs_t hw; + + ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, IRQ_HARDDISK); + ide_register_hw(&hw, NULL); +} diff --git a/include/asm-arm/arch-vnc/io.h b/include/asm-arm/arch-vnc/io.h index 83d25d363..da1b48599 100644 --- a/include/asm-arm/arch-vnc/io.h +++ b/include/asm-arm/arch-vnc/io.h @@ -23,7 +23,7 @@ extern __inline__ void __out##fnsuffix (unsigned int value, unsigned int port) \ { \ __asm__ __volatile__( \ - "str" ##instr## " %0, [%1, %2]" \ + "str%?" ##instr## " %0, [%1, %2] @ out"###fnsuffix \ : \ : "r" (value), "r" (PCIO_BASE), typ (port)); \ } @@ -33,7 +33,7 @@ extern __inline__ unsigned sz __in##fnsuffix (unsigned int port) \ { \ unsigned long value; \ __asm__ __volatile__( \ - "ldr" ##instr## " %0, [%1, %2]" \ + "ldr%?" ##instr## " %0, [%1, %2] @ in"###fnsuffix \ : "=&r" (value) \ : "r" (PCIO_BASE), typ (port)); \ return (unsigned sz)value; \ @@ -65,7 +65,7 @@ DECLARE_IO(long,l,"","Jr") #define __outbc(value,port) \ ({ \ __asm__ __volatile__( \ - "strb %0, [%1, %2]" \ + "strb %0, [%1, %2] @ outbc" \ : \ : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ }) @@ -74,7 +74,7 @@ DECLARE_IO(long,l,"","Jr") ({ \ unsigned char result; \ __asm__ __volatile__( \ - "ldrb %0, [%1, %2]" \ + "ldrb %0, [%1, %2] @ inbc" \ : "=r" (result) \ : "r" (PCIO_BASE), "Jr" (port)); \ result; \ @@ -83,7 +83,7 @@ DECLARE_IO(long,l,"","Jr") #define __outwc(value,port) \ ({ \ __asm__ __volatile__( \ - "strh %0, [%1, %2]" \ + "strh %0, [%1, %2] @ outwc" \ : \ : "r" (value), "r" (PCIO_BASE), "r" (port)); \ }) @@ -92,7 +92,7 @@ DECLARE_IO(long,l,"","Jr") ({ \ unsigned short result; \ __asm__ __volatile__( \ - "ldrh %0, [%1, %2]" \ + "ldrh %0, [%1, %2] @ inwc" \ : "=r" (result) \ : "r" (PCIO_BASE), "r" (port)); \ result & 0xffff; \ @@ -101,7 +101,7 @@ DECLARE_IO(long,l,"","Jr") #define __outlc(value,port) \ ({ \ __asm__ __volatile__( \ - "str %0, [%1, %2]" \ + "str %0, [%1, %2] @ outlc" \ : \ : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ }) @@ -110,7 +110,7 @@ DECLARE_IO(long,l,"","Jr") ({ \ unsigned long result; \ __asm__ __volatile__( \ - "ldr %0, [%1, %2]" \ + "ldr %0, [%1, %2] @ inlc" \ : "=r" (result) \ : "r" (PCIO_BASE), "Jr" (port)); \ result; \ @@ -163,12 +163,12 @@ static inline unsigned short readw(unsigned int addr) return *(volatile unsigned short *)(0xe0000000 + (addr)); } -static inline void writew(unsigned long b, unsigned int addr) +static inline void writel(unsigned long b, unsigned int addr) { *(volatile unsigned long *)(0xe0000000 + (addr)) = b; } -static inline unsigned long readw(unsigned int addr) +static inline unsigned long readl(unsigned int addr) { return *(volatile unsigned long *)(0xe0000000 + (addr)); } diff --git a/include/asm-arm/arch-vnc/irq.h b/include/asm-arm/arch-vnc/irq.h index abf877dc9..10e4d0f9e 100644 --- a/include/asm-arm/arch-vnc/irq.h +++ b/include/asm-arm/arch-vnc/irq.h @@ -7,6 +7,7 @@ * 22-08-1998 RMK Restructured IRQ routines */ +#include <asm/dec21285.h> #include <asm/irq.h> /* @@ -39,7 +40,7 @@ static void vnc_mask_csr_irq(unsigned int irq) static void vnc_unmask_csr_irq(unsigned int irq) { - *CSR_IRQ_DISABLE = fb_irq_mask[irq]; + *CSR_IRQ_ENABLE = fb_irq_mask[irq]; } static void vnc_mask_pic_lo_irq(unsigned int irq) @@ -49,11 +50,19 @@ static void vnc_mask_pic_lo_irq(unsigned int irq) outb(inb(PIC_MASK_LO) | mask, PIC_MASK_LO); } -static void vnc_unmask_pic_lo_irq(unsigned int irq) +static void vnc_mask_ack_pic_lo_irq(unsigned int irq) { unsigned int mask = 1 << (irq & 7); - outb(inb(PIC_MASK_LO) & ~mask, PIC_MASK_LO); + outb(inb(PIC_MASK_LO) | mask, PIC_MASK_LO); + outb(0x20, PIC_LO); +} + +static void vnc_unmask_pic_lo_irq(unsigned int irq) +{ + unsigned int mask = ~(1 << (irq & 7)); + + outb(inb(PIC_MASK_LO) & mask, PIC_MASK_LO); } static void vnc_mask_pic_hi_irq(unsigned int irq) @@ -63,6 +72,15 @@ static void vnc_mask_pic_hi_irq(unsigned int irq) outb(inb(PIC_MASK_HI) | mask, PIC_MASK_HI); } +static void vnc_mask_ack_pic_hi_irq(unsigned int irq) +{ + unsigned int mask = 1 << (irq & 7); + + outb(inb(PIC_MASK_HI) | mask, PIC_MASK_HI); + outb(0x62, PIC_LO); + outb(0x20, PIC_HI); +} + static void vnc_unmask_pic_hi_irq(unsigned int irq) { unsigned int mask = 1 << (irq & 7); @@ -70,6 +88,12 @@ static void vnc_unmask_pic_hi_irq(unsigned int irq) outb(inb(PIC_MASK_HI) & ~mask, PIC_MASK_HI); } +static void no_action(int irq, void *dev_id, struct pt_regs *regs) +{ +} + +static struct irqaction irq_cascade = { no_action, 0, 0, "cascade", NULL, NULL }; + static __inline__ void irq_init_irq(void) { unsigned int irq; @@ -97,13 +121,36 @@ static __inline__ void irq_init_irq(void) irq_desc[irq].mask = vnc_mask_csr_irq; irq_desc[irq].unmask = vnc_unmask_csr_irq; } else if (irq < 24) { - irq_desc[irq].mask_ack = vnc_mask_pic_lo_irq; +irq_desc[irq].probe_ok = 0; + irq_desc[irq].mask_ack = vnc_mask_ack_pic_lo_irq; irq_desc[irq].mask = vnc_mask_pic_lo_irq; irq_desc[irq].unmask = vnc_unmask_pic_lo_irq; } else { - irq_desc[irq].mask_ack = vnc_mask_pic_hi_irq; +irq_desc[irq].probe_ok = 0; + irq_desc[irq].mask_ack = vnc_mask_ack_pic_hi_irq; irq_desc[irq].mask = vnc_mask_pic_hi_irq; irq_desc[irq].unmask = vnc_unmask_pic_hi_irq; } } + + irq_desc[0].probe_ok = 0; + irq_desc[IRQ_SOFTIRQ].probe_ok = 0; + irq_desc[IRQ_CONRX].probe_ok = 0; + irq_desc[IRQ_CONTX].probe_ok = 0; + irq_desc[IRQ_TIMER0].probe_ok = 0; + irq_desc[IRQ_TIMER1].probe_ok = 0; + irq_desc[IRQ_TIMER2].probe_ok = 0; + irq_desc[IRQ_WATCHDOG].probe_ok = 0; + irq_desc[IRQ_DMA1].probe_ok = 0; + irq_desc[13].probe_ok = 0; + irq_desc[14].probe_ok = 0; + irq_desc[IRQ_PCI_ERR].probe_ok = 0; + irq_desc[IRQ_PIC_HI].probe_ok = 0; + irq_desc[29].probe_ok = 0; + irq_desc[31].probe_ok = 0; + + outb(0xff, PIC_MASK_LO); + outb(0xff, PIC_MASK_HI); + + setup_arm_irq(IRQ_PIC_HI, &irq_cascade); } diff --git a/include/asm-arm/arch-vnc/irqs.h b/include/asm-arm/arch-vnc/irqs.h index 37b48c43d..e9df93f5c 100644 --- a/include/asm-arm/arch-vnc/irqs.h +++ b/include/asm-arm/arch-vnc/irqs.h @@ -39,7 +39,7 @@ #define IRQ_HARDDISK 30 /* from 553.14 */ /* These defines handle the translation from the above FB #defines - * into physical buts for the FootBridge IRQ registers + * into physical bits for the FootBridge IRQ registers */ #define IRQ_MASK_SOFTIRQ 0x00000002 #define IRQ_MASK_UART_DEBUG 0x0000000C @@ -47,16 +47,21 @@ #define IRQ_MASK_TIMER1 0x00000020 #define IRQ_MASK_TIMER2 0x00000040 #define IRQ_MASK_WATCHDOG 0x00000080 -#define IRQ_MASK_ETHERH10 0x00000100 -#define IRQ_MASK_ETHERH100 0x00000200 +#define IRQ_MASK_ETHER10 0x00000100 +#define IRQ_MASK_ETHER100 0x00000200 #define IRQ_MASK_VIDCOMP 0x00000400 #define IRQ_MASK_EXTERN_IRQ 0x00000800 #define IRQ_MASK_DMA1 0x00030000 -#define IRQ_MASK_PCI_ERR 0xf0000000 +#define IRQ_MASK_PCI_ERR 0xf8800000 /* * Now map them to the Linux interrupts */ +#undef IRQ_TIMER #define IRQ_TIMER IRQ_TIMER0 +#undef RTC_IRQ +#define RTC_IRQ IRQ_RTC_ALARM +#undef AUX_IRQ +#define AUX_IRQ IRQ_MOUSE #define irq_cannonicalize(i) (i) diff --git a/include/asm-arm/arch-vnc/keyboard.h b/include/asm-arm/arch-vnc/keyboard.h index 4498ecc9b..2fa371ff9 100644 --- a/include/asm-arm/arch-vnc/keyboard.h +++ b/include/asm-arm/arch-vnc/keyboard.h @@ -1,36 +1,38 @@ /* - * linux/include/asm-arm/arch-ebsa285/keyboard.h + * linux/include/asm-arm/arch-vnc/keyboard.h * - * Keyboard driver definitions for EBSA285 architecture + * Keyboard driver definitions for VNC architecture * * (C) 1998 Russell King */ -#include <linux/config.h> #include <asm/irq.h> #define NR_SCANCODES 128 -#ifdef CONFIG_MAGIC_SYSRQ -static unsigned char kbd_sysrq_xlate[NR_SCANCODES]; -#endif +#define KEYBOARD_IRQ IRQ_KEYBOARD -#define kbd_setkeycode(sc,kc) (-EINVAL) -#define kbd_getkeycode(sc) (-EINVAL) +extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); +extern int pckbd_getkeycode(unsigned int scancode); +extern int pckbd_pretranslate(unsigned char scancode, char raw_mode); +extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, + char raw_mode); +extern char pckbd_unexpected_up(unsigned char keycode); +extern void pckbd_leds(unsigned char leds); +extern void pckbd_init_hw(void); +extern unsigned char pckbd_sysrq_xlate[128]; -/* Prototype: int kbd_pretranslate(scancode, raw_mode) - * Returns : 0 to ignore scancode - */ -#define kbd_pretranslate(sc,rm) (1) +#define kbd_setkeycode pckbd_setkeycode +#define kbd_getkeycode pckbd_getkeycode +#define kbd_pretranslate pckbd_pretranslate +#define kbd_translate(sc, kcp, ufp, rm) ({ *ufp = sc & 0200; \ + pckbd_translate(sc & 0x7f, kcp, rm);}) -/* Prototype: int kbd_translate(scancode, *keycode, *up_flag, raw_mode) - * Returns : 0 to ignore scancode, *keycode set to keycode, *up_flag - * set to 0200 if scancode indicates release - */ -#define kbd_translate(sc, kcp, ufp, rm) (1) -#define kbd_unexpected_up(kc) (0200) -#define kbd_leds(leds) -#define kbd_init_hw() -//#define kbd_sysrq_xlate ps2kbd_sysrq_xlate +#define kbd_unexpected_up pckbd_unexpected_up +#define kbd_leds pckbd_leds +#define kbd_init_hw() pckbd_init_hw() +#define kbd_sysrq_xlate pckbd_sysrq_xlate #define kbd_disable_irq() #define kbd_enable_irq() + +#define SYSRQ_KEY 0x54 diff --git a/include/asm-arm/arch-vnc/mmu.h b/include/asm-arm/arch-vnc/mmu.h index 85307d717..64e334292 100644 --- a/include/asm-arm/arch-vnc/mmu.h +++ b/include/asm-arm/arch-vnc/mmu.h @@ -19,8 +19,8 @@ #define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET) #define __virt_to_bus__is_a_macro -#define __virt_to_bus(x) (x) +#define __virt_to_bus(x) (x - 0xe0000000) #define __bus_to_virt__is_a_macro -#define __bus_to_virt(x) (x) +#define __bus_to_virt(x) (x + 0xe0000000) #endif diff --git a/include/asm-arm/arch-vnc/system.h b/include/asm-arm/arch-vnc/system.h index a3fed312c..dc21f08d8 100644 --- a/include/asm-arm/arch-vnc/system.h +++ b/include/asm-arm/arch-vnc/system.h @@ -1,24 +1,37 @@ /* - * linux/include/asm-arm/arch-ebsa285/system.h + * linux/include/asm-arm/arch-vnc/system.h * * Copyright (c) 1996,1997,1998 Russell King. + * Copyright (c) 1998 Corel Computer Corp. */ #include <asm/hardware.h> +#include <asm/dec21285.h> #include <asm/leds.h> +#include <asm/io.h> -/* To reboot, we set up the 21285 watchdog and enable it. - * We then wait for it to timeout. - */ -extern __inline__ void arch_hard_reset (void) +extern __inline__ void arch_reset(char mode) { cli(); - *CSR_TIMER4_LOAD = 0x8000; - *CSR_TIMER4_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16; - *CSR_SA110_CNTL |= 1 << 13; - while(1); -} -#define ARCH_IDLE_OK + /* open up the SuperIO chip + */ + outb(0x87, 0x370); + outb(0x87, 0x370); + + /* aux function group 1 (Logical Device 7) + */ + outb(0x07, 0x370); + outb(0x07, 0x371); + + /* set GP16 for WD-TIMER output + */ + outb(0xE6, 0x370); + outb(0x00, 0x371); + + /* set a RED LED and toggle WD_TIMER for rebooting... + */ + outb(0xC4, 0x338); +} #define arch_start_idle() leds_event(led_idle_start) #define arch_end_idle() leds_event(led_idle_end) diff --git a/include/asm-arm/arch-vnc/time.h b/include/asm-arm/arch-vnc/time.h index 73f228441..c55000bdc 100644 --- a/include/asm-arm/arch-vnc/time.h +++ b/include/asm-arm/arch-vnc/time.h @@ -4,37 +4,229 @@ * Copyright (c) 1997 Corel Computer Corp. * Slight modifications to bring in line with ebsa285 port. * -- Russell King. + * Added LED driver (based on the ebsa285 code) - Alex Holden 28/12/98. */ +#include <linux/config.h> +#include <linux/mc146818rtc.h> + +#include <asm/leds.h> +#include <asm/system.h> + +#undef IRQ_TIMER +#define IRQ_TIMER IRQ_TIMER4 + +#define mSEC_10_from_14 ((14318180 + 100) / 200) + extern __inline__ unsigned long gettimeoffset (void) { - return 0; + int count; + + static int count_p = (mSEC_10_from_14/6); /* for the first call after boot */ + static unsigned long jiffies_p = 0; + + /* + * cache volatile jiffies temporarily; we have IRQs turned off. + */ + unsigned long jiffies_t; + + /* timer count may underflow right here */ + outb_p(0x00, 0x43); /* latch the count ASAP */ + + count = inb_p(0x40); /* read the latched count */ + + /* + * We do this guaranteed double memory access instead of a _p + * postfix in the previous port access. Wheee, hackady hack + */ + jiffies_t = jiffies; + + count |= inb_p(0x40) << 8; + + /* Detect timer underflows. If we haven't had a timer tick since + the last time we were called, and time is apparently going + backwards, the counter must have wrapped during this routine. */ + if ((jiffies_t == jiffies_p) && (count > count_p)) + count -= (mSEC_10_from_14/6); + else + jiffies_p = jiffies_t; + + count_p = count; + + count = (((mSEC_10_from_14/6)-1) - count) * tick; + count = (count + (mSEC_10_from_14/6)/2) / (mSEC_10_from_14/6); + + return count; } extern __inline__ int reset_timer (void) { - *CSR_TIMER1_CLR = 0; +#ifdef CONFIG_LEDS + static unsigned int count = 50; + static int last_pid; + + if (current->pid != last_pid) { + last_pid = current->pid; + if (last_pid) + leds_event(led_idle_end); + else + leds_event(led_idle_start); + } + + if (--count == 0) { + count = 50; + leds_event(led_timer); + } +#endif return 1; } +unsigned long set_rtc_mmss(unsigned long nowtime) +{ + int retval = 0; + int real_seconds, real_minutes, cmos_minutes; + unsigned char save_control, save_freq_select; + + save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */ + CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); + + save_freq_select = CMOS_READ(RTC_FREQ_SELECT); /* stop and reset prescaler */ + CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT); + + cmos_minutes = CMOS_READ(RTC_MINUTES); + if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) + BCD_TO_BIN(cmos_minutes); + + /* + * since we're only adjusting minutes and seconds, + * don't interfere with hour overflow. This avoids + * messing with unknown time zones but requires your + * RTC not to be off by more than 15 minutes + */ + real_seconds = nowtime % 60; + real_minutes = nowtime / 60; + if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1) + real_minutes += 30; /* correct for half hour time zone */ + real_minutes %= 60; + + if (abs(real_minutes - cmos_minutes) < 30) { + if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { + BIN_TO_BCD(real_seconds); + BIN_TO_BCD(real_minutes); + } + CMOS_WRITE(real_seconds,RTC_SECONDS); + CMOS_WRITE(real_minutes,RTC_MINUTES); + } else + retval = -1; + + /* The following flags have to be released exactly in this order, + * otherwise the DS12887 (popular MC146818A clone with integrated + * battery and quartz) will not reset the oscillator and will not + * update precisely 500 ms later. You won't find this mentioned in + * the Dallas Semiconductor data sheets, but who believes data + * sheets anyway ... -- Markus Kuhn + */ + CMOS_WRITE(save_control, RTC_CONTROL); + CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); + + return retval; +} + /* * We don't have a RTC to update! */ -#define update_rtc() +extern __inline__ void update_rtc(void) +{ + static long last_rtc_update = 0; /* last time the cmos clock got updated */ + + /* 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_state != TIME_BAD && xtime.tv_sec > last_rtc_update + 660 && + xtime.tv_usec > 50000 - (tick >> 1) && + xtime.tv_usec < 50000 + (tick >> 1)) { + if (set_rtc_mmss(xtime.tv_sec) == 0) + last_rtc_update = xtime.tv_sec; + else + last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ + } +} + +extern __inline__ unsigned long get_cmos_time(void) +{ + unsigned int year, mon, day, hour, min, sec; + int i; + + // check to see if the RTC makes sense..... + if ((CMOS_READ(RTC_VALID) & RTC_VRT) == 0) + return mktime(1970, 1, 1, 0, 0, 0); + + /* The Linux interpretation of the CMOS clock register contents: + * When the Update-In-Progress (UIP) flag goes from 1 to 0, the + * RTC registers show the second which has precisely just started. + * Let's hope other operating systems interpret the RTC the same way. + */ + /* read RTC exactly on falling edge of update flag */ + for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ + if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) + break; + + for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */ + if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)) + break; + + do { /* Isn't this overkill ? UIP above should guarantee consistency */ + sec = CMOS_READ(RTC_SECONDS); + min = CMOS_READ(RTC_MINUTES); + hour = CMOS_READ(RTC_HOURS); + day = CMOS_READ(RTC_DAY_OF_MONTH); + mon = CMOS_READ(RTC_MONTH); + year = CMOS_READ(RTC_YEAR); + } while (sec != CMOS_READ(RTC_SECONDS)); + + if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { + BCD_TO_BIN(sec); + BCD_TO_BIN(min); + BCD_TO_BIN(hour); + BCD_TO_BIN(day); + BCD_TO_BIN(mon); + BCD_TO_BIN(year); + } + if ((year += 1900) < 1970) + year += 100; + return mktime(year, mon, day, hour, min, sec); +} /* * Set up timer interrupt, and return the current time in seconds. */ extern __inline__ unsigned long setup_timer (void) { - *CSR_TIMER1_CLR = 1; - *CSR_TIMER1_LOAD = LATCH; - *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16; + unsigned int c; + + /* Turn on the RTC */ + outb(13, 0x70); + if ((inb(0x71) & 0x80) == 0) + printk("RTC: *** warning: CMOS battery bad\n"); + + outb(10, 0x70); /* select control reg */ + outb(32, 0x71); /* make sure the divider is set */ + outb(11, 0x70); /* select other control reg */ + c = inb(0x71) & 0xfb; /* read it */ + outb(11, 0x70); + outb(c | 2, 0x71); /* turn on BCD counting and 24 hour clock mode */ + + /* enable PIT timer */ + /* set for periodic (4) and LSB/MSB write (0x30) */ + outb(0x34, 0x43); + outb((mSEC_10_from_14/6) & 0xFF, 0x40); + outb((mSEC_10_from_14/6) >> 8, 0x40); /* * Default the date to 1 Jan 1970 00:00:00 * You will have to run a time daemon to set the * clock correctly at bootup */ - return mktime(1970, 1, 1, 0, 0, 0); + return get_cmos_time(); } diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h index 48d688eb1..431194234 100644 --- a/include/asm-arm/atomic.h +++ b/include/asm-arm/atomic.h @@ -12,17 +12,23 @@ #ifndef __ASM_ARM_ATOMIC_H #define __ASM_ARM_ATOMIC_H +#ifdef __SMP__ +#error SMP not supported +#endif + +#include <linux/config.h> + +#ifdef CONFIG_ARCH_CO285 +typedef struct { volatile int counter; } atomic_t; +#else typedef struct { int counter; } atomic_t; +#endif #define ATOMIC_INIT(i) { (i) } #ifdef __KERNEL__ #include <asm/system.h> -#ifdef __SMP__ -#error SMP not supported -#endif - #define atomic_read(v) ((v)->counter) #define atomic_set(v,i) (((v)->counter) = (i)) diff --git a/include/asm-arm/byteorder.h b/include/asm-arm/byteorder.h index 7b232d906..60a191cc3 100644 --- a/include/asm-arm/byteorder.h +++ b/include/asm-arm/byteorder.h @@ -3,7 +3,14 @@ #include <asm/types.h> -#ifdef __GNUC__ +#if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ < 8 + +/* Recent versions of GCC can open code the swaps at least as well + as we can write them by hand, so the "optimisations" here only + make sense for older compilers. Worse, some versions of GCC + actually go wrong in the presence of the assembler versions. + We play it safe and only turn them on for compilers older than + GCC 2.8.0. */ static __inline__ __const__ __u32 ___arch__swab32(__u32 x) { @@ -33,6 +40,11 @@ static __inline__ __const__ __u16 ___arch__swab16(__u16 x) #endif /* __GNUC__ */ +#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) +# define __BYTEORDER_HAS_U64__ +# define __SWAB_64_THRU_32__ +#endif + #include <linux/byteorder/little_endian.h> #endif diff --git a/include/asm-arm/dec21285.h b/include/asm-arm/dec21285.h new file mode 100644 index 000000000..0facd0b7c --- /dev/null +++ b/include/asm-arm/dec21285.h @@ -0,0 +1,94 @@ +/* + * include/asm-arm/dec21285.h + * + * Copyright (C) 1998 Russell King + * + * DC21285 registers + */ +#define DC21285_PCI_IACK 0x79000000 +#define DC21285_ARMCSR_BASE 0x42000000 +#define DC21285_PCI_TYPE_0_CONFIG 0x7b000000 +#define DC21285_PCI_TYPE_1_CONFIG 0x7a000000 +#define DC21285_OUTBOUND_WRITE_FLUSH 0x78000000 +#define DC21285_FLASH 0x41000000 +#define DC21285_PCI_IO 0x7c000000 +#define DC21285_PCI_MEM 0x80000000 + +#ifndef __ASSEMBLY__ +#define DC21285_IO(x) ((volatile unsigned long *)(0xfe000000+(x))) +#else +#define DC21285_IO(x) (x) +#endif + +#define CSR_PCICMD DC21285_IO(0x0004) +#define CSR_PCICACHELINESIZE DC21285_IO(0x000c) +#define CSR_PCICSRBASE DC21285_IO(0x0010) +#define CSR_PCICSRIOBASE DC21285_IO(0x0014) +#define CSR_PCISDRAMBASE DC21285_IO(0x0018) +#define CSR_PCIROMBASE DC21285_IO(0x0030) +#define CSR_CSRBASEMASK DC21285_IO(0x00f8) +#define CSR_CSRBASEOFFSET DC21285_IO(0x00fc) +#define CSR_SDRAMBASEMASK DC21285_IO(0x0100) +#define CSR_SDRAMBASEOFFSET DC21285_IO(0x0104) +#define CSR_ROMBASEMASK DC21285_IO(0x0108) +#define CSR_SDRAMTIMING DC21285_IO(0x010c) +#define CSR_SDRAMADDRSIZE0 DC21285_IO(0x0110) +#define CSR_SDRAMADDRSIZE1 DC21285_IO(0x0114) +#define CSR_SDRAMADDRSIZE2 DC21285_IO(0x0118) +#define CSR_SDRAMADDRSIZE3 DC21285_IO(0x011c) +#define CSR_I2O_INFREEHEAD DC21285_IO(0x0120) +#define CSR_I2O_INPOSTTAIL DC21285_IO(0x0124) +#define CSR_I2O_OUTPOSTHEAD DC21285_IO(0x0128) +#define CSR_I2O_OUTFREETAIL DC21285_IO(0x012c) +#define CSR_I2O_INFREECOUNT DC21285_IO(0x0130) +#define CSR_I2O_OUTPOSTCOUNT DC21285_IO(0x0134) +#define CSR_I2O_INPOSTCOUNT DC21285_IO(0x0138) +#define CSR_SA110_CNTL DC21285_IO(0x013c) +#define CSR_PCIADDR_EXTN DC21285_IO(0x0140) +#define CSR_PREFETCHMEMRANGE DC21285_IO(0x0144) +#define CSR_XBUS_CYCLE DC21285_IO(0x0148) +#define CSR_XBUS_IOSTROBE DC21285_IO(0x014c) +#define CSR_DOORBELL_PCI DC21285_IO(0x0150) +#define CSR_DOORBELL_SA110 DC21285_IO(0x0154) +#define CSR_UARTDR DC21285_IO(0x0160) +#define CSR_RXSTAT DC21285_IO(0x0164) +#define CSR_H_UBRLCR DC21285_IO(0x0168) +#define CSR_M_UBRLCR DC21285_IO(0x016c) +#define CSR_L_UBRLCR DC21285_IO(0x0170) +#define CSR_UARTCON DC21285_IO(0x0174) +#define CSR_UARTFLG DC21285_IO(0x0178) +#define CSR_IRQ_STATUS DC21285_IO(0x0180) +#define CSR_IRQ_RAWSTATUS DC21285_IO(0x0184) +#define CSR_IRQ_ENABLE DC21285_IO(0x0188) +#define CSR_IRQ_DISABLE DC21285_IO(0x018c) +#define CSR_IRQ_SOFT DC21285_IO(0x0190) +#define CSR_FIQ_STATUS DC21285_IO(0x0280) +#define CSR_FIQ_RAWSTATUS DC21285_IO(0x0284) +#define CSR_FIQ_ENABLE DC21285_IO(0x0288) +#define CSR_FIQ_DISABLE DC21285_IO(0x028c) +#define CSR_FIQ_SOFT DC21285_IO(0x0290) +#define CSR_TIMER1_LOAD DC21285_IO(0x0300) +#define CSR_TIMER1_VALUE DC21285_IO(0x0304) +#define CSR_TIMER1_CNTL DC21285_IO(0x0308) +#define CSR_TIMER1_CLR DC21285_IO(0x030c) +#define CSR_TIMER2_LOAD DC21285_IO(0x0320) +#define CSR_TIMER2_VALUE DC21285_IO(0x0324) +#define CSR_TIMER2_CNTL DC21285_IO(0x0328) +#define CSR_TIMER2_CLR DC21285_IO(0x032c) +#define CSR_TIMER3_LOAD DC21285_IO(0x0340) +#define CSR_TIMER3_VALUE DC21285_IO(0x0344) +#define CSR_TIMER3_CNTL DC21285_IO(0x0348) +#define CSR_TIMER3_CLR DC21285_IO(0x034c) +#define CSR_TIMER4_LOAD DC21285_IO(0x0360) +#define CSR_TIMER4_VALUE DC21285_IO(0x0364) +#define CSR_TIMER4_CNTL DC21285_IO(0x0368) +#define CSR_TIMER4_CLR DC21285_IO(0x036c) + +#define TIMER_CNTL_ENABLE (1 << 7) +#define TIMER_CNTL_AUTORELOAD (1 << 6) +#define TIMER_CNTL_DIV1 (0) +#define TIMER_CNTL_DIV16 (1 << 2) +#define TIMER_CNTL_DIV256 (2 << 2) +#define TIMER_CNTL_CNTEXT (3 << 2) + + diff --git a/include/asm-arm/dma.h b/include/asm-arm/dma.h index d8b9f1d3a..9fb7a0242 100644 --- a/include/asm-arm/dma.h +++ b/include/asm-arm/dma.h @@ -3,9 +3,24 @@ typedef unsigned int dmach_t; +#include <linux/config.h> +#include <linux/kernel.h> #include <asm/irq.h> +#include <asm/system.h> +#include <asm/spinlock.h> #include <asm/arch/dma.h> +/* + * DMA modes - we have two, IN and OUT + */ +typedef unsigned int dmamode_t; + +#define DMA_MODE_MASK 1 + +#define DMA_MODE_READ 0 +#define DMA_MODE_WRITE 1 +#define DMA_AUTOINIT 2 + typedef struct { unsigned long address; unsigned long length; @@ -13,6 +28,20 @@ typedef struct { extern const char dma_str[]; +extern spinlock_t dma_spin_lock; + +extern __inline__ unsigned long claim_dma_lock(void) +{ + unsigned long flags; + spin_lock_irqsave(&dma_spin_lock, flags); + return flags; +} + +extern __inline__ void release_dma_lock(unsigned long flags) +{ + spin_unlock_irqrestore(&dma_spin_lock, flags); +} + /* Clear the 'DMA Pointer Flip Flop'. * Write 0 for LSB/MSB, 1 for MSB/LSB access. * @@ -26,7 +55,7 @@ extern const char dma_str[]; * NOTE: This is an architecture specific function, and should * be hidden from the drivers */ -static __inline__ void set_dma_page(dmach_t channel, char pagenr) +extern __inline__ void set_dma_page(dmach_t channel, char pagenr) { printk(dma_str, "set_dma_page", channel); } @@ -102,4 +131,10 @@ extern int get_dma_residue(dmach_t channel); #define NO_DMA 255 #endif +#ifdef CONFIG_PCI_QUIRKS +extern int isa_dma_bridge_buggy; +#else +#define isa_dma_bridge_buggy (0) +#endif + #endif /* _ARM_DMA_H */ diff --git a/include/asm-arm/ecard.h b/include/asm-arm/ecard.h index afc4acc14..0f60505f9 100644 --- a/include/asm-arm/ecard.h +++ b/include/asm-arm/ecard.h @@ -31,6 +31,9 @@ #define MANU_ATOMWIDE 0x0017 #define PROD_ATOMWIDE_3PSERIAL 0x0090 +#define MANU_IRLAM_INSTRUMENTS 0x001f +#define MANU_IRLAM_INSTRUMENTS_ETHERN 0x5678 + #define MANU_OAK 0x0021 #define PROD_OAK_SCSI 0x0058 @@ -75,51 +78,48 @@ #define MAX_ECARDS 8 -/* Type of card's address space */ -typedef enum { +typedef enum { /* Cards address space */ ECARD_IOC, ECARD_MEMC, - ECARD_DEBI + ECARD_EASI } card_type_t; -/* Speed of card for ECARD_IOC address space */ -typedef enum { +typedef enum { /* Speed for ECARD_IOC space */ ECARD_SLOW = 0, ECARD_MEDIUM = 1, ECARD_FAST = 2, ECARD_SYNC = 3 } card_speed_t; -/* Card ID structure */ -typedef struct { +typedef struct { /* Card ID structure */ unsigned short manufacturer; unsigned short product; } card_ids; -/* External view of card ID information */ -struct in_ecld { - unsigned short product; - unsigned short manufacturer; - unsigned char ecld; - unsigned char country; - unsigned char fiqmask; - unsigned char irqmask; - unsigned long fiqaddr; - unsigned long irqaddr; +struct in_ecid { /* Packed card ID information */ + unsigned short product; /* Product code */ + unsigned short manufacturer; /* Manufacturer code */ + unsigned char id:4; /* Simple ID */ + unsigned char cd:1; /* Chunk dir present */ + unsigned char is:1; /* Interrupt status pointers */ + unsigned char w:2; /* Width */ + unsigned char country; /* Country */ + unsigned char irqmask; /* IRQ mask */ + unsigned char fiqmask; /* FIQ mask */ + unsigned long irqoff; /* IRQ offset */ + unsigned long fiqoff; /* FIQ offset */ }; typedef struct expansion_card ecard_t; +typedef unsigned long *loader_t; -/* Card handler routines */ -typedef struct { +typedef struct { /* Card handler routines */ void (*irqenable)(ecard_t *ec, int irqnr); void (*irqdisable)(ecard_t *ec, int irqnr); void (*fiqenable)(ecard_t *ec, int fiqnr); void (*fiqdisable)(ecard_t *ec, int fiqnr); } expansioncard_ops_t; -typedef unsigned long *loader_t; - /* * This contains all the info needed on an expansion card */ @@ -131,17 +131,19 @@ struct expansion_card { unsigned char fiqmask; /* FIQ mask */ unsigned char claimed; /* Card claimed? */ + void *irq_data; /* Data for use for IRQ by card */ + void *fiq_data; /* Data for use for FIQ by card */ + expansioncard_ops_t *ops; /* Enable/Disable Ops for card */ + CONST unsigned char slot_no; /* Slot number */ CONST unsigned char dma; /* DMA number (for request_dma) */ CONST unsigned char irq; /* IRQ number (for request_irq) */ CONST unsigned char fiq; /* FIQ number (for request_irq) */ - - CONST struct in_ecld cld; /* Card Identification */ - void *irq_data; /* Data for use for IRQ by card */ - void *fiq_data; /* Data for use for FIQ by card */ - expansioncard_ops_t *ops; /* Enable/Disable Ops for card */ + CONST card_type_t type; /* Type of card */ + CONST struct in_ecid cid; /* Card Identification */ /* Private internal data */ + const char *card_desc; /* Card description */ CONST unsigned int podaddr; /* Base Linux address for card */ CONST loader_t loader; /* loader program */ }; @@ -170,9 +172,9 @@ struct in_chunk_dir { extern void ecard_startfind (void); /* - * Find an expansion card with the correct cld, product and manufacturer code + * Find an expansion card with the correct cid, product and manufacturer code */ -extern struct expansion_card *ecard_find (int cld, const card_ids *ids); +extern struct expansion_card *ecard_find (int cid, const card_ids *ids); /* * Read a chunk from an expansion card @@ -193,25 +195,31 @@ extern unsigned int ecard_address (struct expansion_card *ec, card_type_t card_t * * External expansion card header as read from the card */ -struct ex_ecld { - unsigned char r_ecld; - unsigned char r_reserved[2]; - unsigned char r_product[2]; - unsigned char r_manufacturer[2]; - unsigned char r_country; - long r_fiqs; - long r_irqs; -#define e_ecld(x) ((x)->r_ecld) -#define e_cd(x) ((x)->r_reserved[0] & 1) -#define e_is(x) ((x)->r_reserved[0] & 2) -#define e_w(x) (((x)->r_reserved[0] & 12)>>2) -#define e_prod(x) ((x)->r_product[0]|((x)->r_product[1]<<8)) -#define e_manu(x) ((x)->r_manufacturer[0]|((x)->r_manufacturer[1]<<8)) -#define e_country(x) ((x)->r_country) -#define e_fiqmask(x) ((x)->r_fiqs & 0xff) -#define e_fiqaddr(x) ((x)->r_fiqs >> 8) -#define e_irqmask(x) ((x)->r_irqs & 0xff) -#define e_irqaddr(x) ((x)->r_irqs >> 8) +struct ex_ecid { + unsigned char r_irq:1; + unsigned char r_zero:1; + unsigned char r_fiq:1; + unsigned char r_id:4; + unsigned char r_a:1; + + unsigned char r_cd:1; + unsigned char r_is:1; + unsigned char r_w:2; + unsigned char r_r1:4; + + unsigned char r_r2:8; + + unsigned char r_prod[2]; + + unsigned char r_manu[2]; + + unsigned char r_country; + + unsigned char r_irqmask; + unsigned char r_irqoff[3]; + + unsigned char r_fiqmask; + unsigned char r_fiqoff[3]; }; /* diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h index c99a67292..8b0980053 100644 --- a/include/asm-arm/elf.h +++ b/include/asm-arm/elf.h @@ -6,6 +6,7 @@ */ #include <asm/ptrace.h> +#include <asm/proc/elf.h> #include <asm/procinfo.h> typedef unsigned long elf_greg_t; @@ -20,7 +21,7 @@ typedef struct { void *null; } elf_fpregset_t; /* * This is used to ensure we don't load something for the wrong architecture. */ -#define elf_check_arch(x) ( ((x) == EM_ARM) ) +#define elf_check_arch(x) ( ((x)->e_machine == EM_ARM) && (ELF_PROC_OK((x))) ) /* * These are used to set parameters in the core dumps. @@ -30,7 +31,6 @@ typedef struct { void *null; } elf_fpregset_t; #define ELF_ARCH EM_ARM #define USE_ELF_CORE_DUMP -#define ELF_EXEC_PAGESIZE 4096 /* This is the location that an ET_DYN program is loaded if exec'ed. Typical use of this is to invoke "./ld.so someprog" to test out a new version of @@ -65,9 +65,4 @@ typedef struct { void *null; } elf_fpregset_t; extern char elf_platform[]; #define ELF_PLATFORM (elf_platform) -#ifdef __KERNEL__ -#define SET_PERSONALITY(ex,ibcs2) \ - current->personality = PER_LINUX_32BIT -#endif - #endif diff --git a/include/asm-arm/hardware.h b/include/asm-arm/hardware.h index c21abeed3..cd4528235 100644 --- a/include/asm-arm/hardware.h +++ b/include/asm-arm/hardware.h @@ -11,257 +11,8 @@ #include <asm/arch/hardware.h> -/* - * Use these macros to read/write the IOC. All it does is perform the actual - * read/write. - */ -#ifdef HAS_IOC -#ifndef __ASSEMBLER__ -#define __IOC(offset) (IOC_BASE + (offset >> 2)) -#else -#define __IOC(offset) offset -#endif - -#define IOC_CONTROL __IOC(0x00) -#define IOC_KARTTX __IOC(0x04) -#define IOC_KARTRX __IOC(0x04) - -#define IOC_IRQSTATA __IOC(0x10) -#define IOC_IRQREQA __IOC(0x14) -#define IOC_IRQCLRA __IOC(0x14) -#define IOC_IRQMASKA __IOC(0x18) - -#define IOC_IRQSTATB __IOC(0x20) -#define IOC_IRQREQB __IOC(0x24) -#define IOC_IRQMASKB __IOC(0x28) - -#define IOC_FIQSTAT __IOC(0x30) -#define IOC_FIQREQ __IOC(0x34) -#define IOC_FIQMASK __IOC(0x38) - -#define IOC_T0CNTL __IOC(0x40) -#define IOC_T0LTCHL __IOC(0x40) -#define IOC_T0CNTH __IOC(0x44) -#define IOC_T0LTCHH __IOC(0x44) -#define IOC_T0GO __IOC(0x48) -#define IOC_T0LATCH __IOC(0x4c) - -#define IOC_T1CNTL __IOC(0x50) -#define IOC_T1LTCHL __IOC(0x50) -#define IOC_T1CNTH __IOC(0x54) -#define IOC_T1LTCHH __IOC(0x54) -#define IOC_T1GO __IOC(0x58) -#define IOC_T1LATCH __IOC(0x5c) - -#define IOC_T2CNTL __IOC(0x60) -#define IOC_T2LTCHL __IOC(0x60) -#define IOC_T2CNTH __IOC(0x64) -#define IOC_T2LTCHH __IOC(0x64) -#define IOC_T2GO __IOC(0x68) -#define IOC_T2LATCH __IOC(0x6c) - -#define IOC_T3CNTL __IOC(0x70) -#define IOC_T3LTCHL __IOC(0x70) -#define IOC_T3CNTH __IOC(0x74) -#define IOC_T3LTCHH __IOC(0x74) -#define IOC_T3GO __IOC(0x78) -#define IOC_T3LATCH __IOC(0x7c) -#endif - -#ifdef HAS_MEMC -#define VDMA_ALIGNMENT PAGE_SIZE -#define VDMA_XFERSIZE 16 -#define VDMA_INIT 0 -#define VDMA_START 1 -#define VDMA_END 2 - -#define video_set_dma(start,end,offset) \ -do { \ - memc_write (VDMA_START, (start >> 2)); \ - memc_write (VDMA_END, (end - VDMA_XFERSIZE) >> 2); \ - memc_write (VDMA_INIT, (offset >> 2)); \ -} while (0) -#endif - -#ifdef HAS_IOMD -#ifndef __ASSEMBLER__ -#define __IOMD(offset) (IOMD_BASE + (offset >> 2)) -#else -#define __IOMD(offset) offset -#endif - -#define IOMD_CONTROL __IOMD(0x000) -#define IOMD_KARTTX __IOMD(0x004) -#define IOMD_KARTRX __IOMD(0x004) -#define IOMD_KCTRL __IOMD(0x008) - -#define IOMD_IRQSTATA __IOMD(0x010) -#define IOMD_IRQREQA __IOMD(0x014) -#define IOMD_IRQCLRA __IOMD(0x014) -#define IOMD_IRQMASKA __IOMD(0x018) - -#define IOMD_IRQSTATB __IOMD(0x020) -#define IOMD_IRQREQB __IOMD(0x024) -#define IOMD_IRQMASKB __IOMD(0x028) - -#define IOMD_FIQSTAT __IOMD(0x030) -#define IOMD_FIQREQ __IOMD(0x034) -#define IOMD_FIQMASK __IOMD(0x038) - -#define IOMD_T0CNTL __IOMD(0x040) -#define IOMD_T0LTCHL __IOMD(0x040) -#define IOMD_T0CNTH __IOMD(0x044) -#define IOMD_T0LTCHH __IOMD(0x044) -#define IOMD_T0GO __IOMD(0x048) -#define IOMD_T0LATCH __IOMD(0x04c) - -#define IOMD_T1CNTL __IOMD(0x050) -#define IOMD_T1LTCHL __IOMD(0x050) -#define IOMD_T1CNTH __IOMD(0x054) -#define IOMD_T1LTCHH __IOMD(0x054) -#define IOMD_T1GO __IOMD(0x058) -#define IOMD_T1LATCH __IOMD(0x05c) - -#define IOMD_ROMCR0 __IOMD(0x080) -#define IOMD_ROMCR1 __IOMD(0x084) -#define IOMD_DRAMCR __IOMD(0x088) -#define IOMD_VREFCR __IOMD(0x08C) - -#define IOMD_FSIZE __IOMD(0x090) -#define IOMD_ID0 __IOMD(0x094) -#define IOMD_ID1 __IOMD(0x098) -#define IOMD_VERSION __IOMD(0x09C) - -#define IOMD_MOUSEX __IOMD(0x0A0) -#define IOMD_MOUSEY __IOMD(0x0A4) - -#define IOMD_DMATCR __IOMD(0x0C0) -#define IOMD_IOTCR __IOMD(0x0C4) -#define IOMD_ECTCR __IOMD(0x0C8) -#define IOMD_DMAEXT __IOMD(0x0CC) - -#define DMA_EXT_IO0 1 -#define DMA_EXT_IO1 2 -#define DMA_EXT_IO2 4 -#define DMA_EXT_IO3 8 - -#define IOMD_IO0CURA __IOMD(0x100) -#define IOMD_IO0ENDA __IOMD(0x104) -#define IOMD_IO0CURB __IOMD(0x108) -#define IOMD_IO0ENDB __IOMD(0x10C) -#define IOMD_IO0CR __IOMD(0x110) -#define IOMD_IO0ST __IOMD(0x114) - -#define IOMD_IO1CURA __IOMD(0x120) -#define IOMD_IO1ENDA __IOMD(0x124) -#define IOMD_IO1CURB __IOMD(0x128) -#define IOMD_IO1ENDB __IOMD(0x12C) -#define IOMD_IO1CR __IOMD(0x130) -#define IOMD_IO1ST __IOMD(0x134) - -#define IOMD_IO2CURA __IOMD(0x140) -#define IOMD_IO2ENDA __IOMD(0x144) -#define IOMD_IO2CURB __IOMD(0x148) -#define IOMD_IO2ENDB __IOMD(0x14C) -#define IOMD_IO2CR __IOMD(0x150) -#define IOMD_IO2ST __IOMD(0x154) - -#define IOMD_IO3CURA __IOMD(0x160) -#define IOMD_IO3ENDA __IOMD(0x164) -#define IOMD_IO3CURB __IOMD(0x168) -#define IOMD_IO3ENDB __IOMD(0x16C) -#define IOMD_IO3CR __IOMD(0x170) -#define IOMD_IO3ST __IOMD(0x174) - -#define IOMD_SD0CURA __IOMD(0x180) -#define IOMD_SD0ENDA __IOMD(0x184) -#define IOMD_SD0CURB __IOMD(0x188) -#define IOMD_SD0ENDB __IOMD(0x18C) -#define IOMD_SD0CR __IOMD(0x190) -#define IOMD_SD0ST __IOMD(0x194) - -#define IOMD_SD1CURA __IOMD(0x1A0) -#define IOMD_SD1ENDA __IOMD(0x1A4) -#define IOMD_SD1CURB __IOMD(0x1A8) -#define IOMD_SD1ENDB __IOMD(0x1AC) -#define IOMD_SD1CR __IOMD(0x1B0) -#define IOMD_SD1ST __IOMD(0x1B4) - -#define IOMD_CURSCUR __IOMD(0x1C0) -#define IOMD_CURSINIT __IOMD(0x1C4) - -#define IOMD_VIDCUR __IOMD(0x1D0) -#define IOMD_VIDEND __IOMD(0x1D4) -#define IOMD_VIDSTART __IOMD(0x1D8) -#define IOMD_VIDINIT __IOMD(0x1DC) -#define IOMD_VIDCR __IOMD(0x1E0) - -#define IOMD_DMASTAT __IOMD(0x1F0) -#define IOMD_DMAREQ __IOMD(0x1F4) -#define IOMD_DMAMASK __IOMD(0x1F8) - -#define DMA_END_S (1 << 31) -#define DMA_END_L (1 << 30) - -#define DMA_CR_C 0x80 -#define DMA_CR_D 0x40 -#define DMA_CR_E 0x20 - -#define DMA_ST_OFL 4 -#define DMA_ST_INT 2 -#define DMA_ST_AB 1 -/* - * IOC compatability - */ -#define IOC_CONTROL IOMD_CONTROL -#define IOC_IRQSTATA IOMD_IRQSTATA -#define IOC_IRQREQA IOMD_IRQREQA -#define IOC_IRQCLRA IOMD_IRQCLRA -#define IOC_IRQMASKA IOMD_IRQMASKA - -#define IOC_IRQSTATB IOMD_IRQSTATB -#define IOC_IRQREQB IOMD_IRQREQB -#define IOC_IRQMASKB IOMD_IRQMASKB - -#define IOC_FIQSTAT IOMD_FIQSTAT -#define IOC_FIQREQ IOMD_FIQREQ -#define IOC_FIQMASK IOMD_FIQMASK - -#define IOC_T0CNTL IOMD_T0CNTL -#define IOC_T0LTCHL IOMD_T0LTCHL -#define IOC_T0CNTH IOMD_T0CNTH -#define IOC_T0LTCHH IOMD_T0LTCHH -#define IOC_T0GO IOMD_T0GO -#define IOC_T0LATCH IOMD_T0LATCH - -#define IOC_T1CNTL IOMD_T1CNTL -#define IOC_T1LTCHL IOMD_T1LTCHL -#define IOC_T1CNTH IOMD_T1CNTH -#define IOC_T1LTCHH IOMD_T1LTCHH -#define IOC_T1GO IOMD_T1GO -#define IOC_T1LATCH IOMD_T1LATCH - -/* - * DMA (MEMC) compatability - */ -#define HALF_SAM vram_half_sam -#define VDMA_ALIGNMENT (HALF_SAM * 2) -#define VDMA_XFERSIZE (HALF_SAM) -#define VDMA_INIT IOMD_VIDINIT -#define VDMA_START IOMD_VIDSTART -#define VDMA_END IOMD_VIDEND - -#ifndef __ASSEMBLER__ -extern unsigned int vram_half_sam; -#define video_set_dma(start,end,offset) \ -do { \ - outl (SCREEN_START + start, VDMA_START); \ - outl (SCREEN_START + end - VDMA_XFERSIZE, VDMA_END); \ - if (offset >= end - VDMA_XFERSIZE) \ - offset |= 0x40000000; \ - outl (SCREEN_START + offset, VDMA_INIT); \ -} while (0) -#endif +#ifndef FLUSH_BASE +#define FLUSH_BASE 0xdf000000 #endif #ifdef HAS_EXPMASK diff --git a/include/asm-arm/ide.h b/include/asm-arm/ide.h index 2ead7b36a..76da8806b 100644 --- a/include/asm-arm/ide.h +++ b/include/asm-arm/ide.h @@ -13,8 +13,6 @@ #ifdef __KERNEL__ -typedef unsigned long ide_ioreg_t; - #ifndef MAX_HWIFS #define MAX_HWIFS 4 #endif @@ -34,51 +32,19 @@ typedef union { } b; } select_t; -static __inline__ int ide_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *device, void *dev_id) -{ - return request_irq(irq, handler, flags, device, dev_id); -} - -static __inline__ void ide_free_irq(unsigned int irq, void *dev_id) -{ - free_irq(irq, dev_id); -} - -static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent) -{ - return check_region(from, extent); -} - -static __inline__ void ide_request_region (ide_ioreg_t from, unsigned int extent, const char *name) -{ - request_region(from, extent, name); -} - -static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent) -{ - release_region(from, extent); -} +#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) +#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id)) +#define ide_check_region(from,extent) check_region((from), (extent)) +#define ide_request_region(from,extent,name) request_region((from), (extent), (name)) +#define ide_release_region(from,extent) release_region((from), (extent)) /* * The following are not needed for the non-m68k ports */ -static __inline__ int ide_ack_intr (ide_ioreg_t status_port, ide_ioreg_t irq_port) -{ - return(1); -} - -static __inline__ void ide_fix_driveid(struct hd_driveid *id) -{ -} - -static __inline__ void ide_release_lock (int *ide_lock) -{ -} - -static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *, struct pt_regs *), void *data) -{ -} +#define ide_ack_intr(hwif) (1) +#define ide_fix_driveid(id) do {} while (0) +#define ide_release_lock(lock) do {} while (0) +#define ide_get_lock(lock, hdlr, data) do {} while (0) #endif /* __KERNEL__ */ diff --git a/include/asm-arm/init.h b/include/asm-arm/init.h index 6105bbe88..c0aa97f7f 100644 --- a/include/asm-arm/init.h +++ b/include/asm-arm/init.h @@ -5,7 +5,7 @@ /* C routines */ -#ifdef CONFIG_BINUTILS_NEW +#ifdef CONFIG_TEXT_INIT_SECTION #define __init __attribute__ ((__section__ (".text.init"))) #define __initfunc(__arginit) \ @@ -26,4 +26,7 @@ #define __INITDATA .section ".data.init",@alloc,@write #define __FINIT .previous +#define __cacheline_aligned __attribute__ \ + ((__aligned__ (L1_CACHE_BYTES))) + #endif diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h index 10b20184a..e87744b71 100644 --- a/include/asm-arm/io.h +++ b/include/asm-arm/io.h @@ -31,7 +31,7 @@ * 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(x))) +#define bus_to_virt(x) ((void *)(__bus_to_virt((unsigned long)(x)))) /* * These macros actually build the multi-value IO function prototypes @@ -173,6 +173,8 @@ __IO(l,"",long) #ifdef __KERNEL__ +extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); + /* * String version of IO memory access ops: */ diff --git a/include/asm-arm/ioc.h b/include/asm-arm/ioc.h new file mode 100644 index 000000000..2b3d6062a --- /dev/null +++ b/include/asm-arm/ioc.h @@ -0,0 +1,56 @@ +/* + * Use these macros to read/write the IOC. All it does is perform the actual + * read/write. + */ + +#ifndef __ASSEMBLER__ +#define __IOC(offset) (IOC_BASE + (offset >> 2)) +#else +#define __IOC(offset) offset +#endif + +#define IOC_CONTROL __IOC(0x00) +#define IOC_KARTTX __IOC(0x04) +#define IOC_KARTRX __IOC(0x04) + +#define IOC_IRQSTATA __IOC(0x10) +#define IOC_IRQREQA __IOC(0x14) +#define IOC_IRQCLRA __IOC(0x14) +#define IOC_IRQMASKA __IOC(0x18) + +#define IOC_IRQSTATB __IOC(0x20) +#define IOC_IRQREQB __IOC(0x24) +#define IOC_IRQMASKB __IOC(0x28) + +#define IOC_FIQSTAT __IOC(0x30) +#define IOC_FIQREQ __IOC(0x34) +#define IOC_FIQMASK __IOC(0x38) + +#define IOC_T0CNTL __IOC(0x40) +#define IOC_T0LTCHL __IOC(0x40) +#define IOC_T0CNTH __IOC(0x44) +#define IOC_T0LTCHH __IOC(0x44) +#define IOC_T0GO __IOC(0x48) +#define IOC_T0LATCH __IOC(0x4c) + +#define IOC_T1CNTL __IOC(0x50) +#define IOC_T1LTCHL __IOC(0x50) +#define IOC_T1CNTH __IOC(0x54) +#define IOC_T1LTCHH __IOC(0x54) +#define IOC_T1GO __IOC(0x58) +#define IOC_T1LATCH __IOC(0x5c) + +#define IOC_T2CNTL __IOC(0x60) +#define IOC_T2LTCHL __IOC(0x60) +#define IOC_T2CNTH __IOC(0x64) +#define IOC_T2LTCHH __IOC(0x64) +#define IOC_T2GO __IOC(0x68) +#define IOC_T2LATCH __IOC(0x6c) + +#define IOC_T3CNTL __IOC(0x70) +#define IOC_T3LTCHL __IOC(0x70) +#define IOC_T3CNTH __IOC(0x74) +#define IOC_T3LTCHH __IOC(0x74) +#define IOC_T3GO __IOC(0x78) +#define IOC_T3LATCH __IOC(0x7c) + diff --git a/include/asm-arm/iomd.h b/include/asm-arm/iomd.h new file mode 100644 index 000000000..375c6fdf1 --- /dev/null +++ b/include/asm-arm/iomd.h @@ -0,0 +1,180 @@ + +#ifndef __ASSEMBLER__ +#define __IOMD(offset) (IO_IOMD_BASE + (offset >> 2)) +#else +#define __IOMD(offset) offset +#endif + +#define IOMD_CONTROL __IOMD(0x000) +#define IOMD_KARTTX __IOMD(0x004) +#define IOMD_KARTRX __IOMD(0x004) +#define IOMD_KCTRL __IOMD(0x008) + +#define IOMD_IRQSTATA __IOMD(0x010) +#define IOMD_IRQREQA __IOMD(0x014) +#define IOMD_IRQCLRA __IOMD(0x014) +#define IOMD_IRQMASKA __IOMD(0x018) + +#define IOMD_IRQSTATB __IOMD(0x020) +#define IOMD_IRQREQB __IOMD(0x024) +#define IOMD_IRQMASKB __IOMD(0x028) + +#define IOMD_FIQSTAT __IOMD(0x030) +#define IOMD_FIQREQ __IOMD(0x034) +#define IOMD_FIQMASK __IOMD(0x038) + +#define IOMD_T0CNTL __IOMD(0x040) +#define IOMD_T0LTCHL __IOMD(0x040) +#define IOMD_T0CNTH __IOMD(0x044) +#define IOMD_T0LTCHH __IOMD(0x044) +#define IOMD_T0GO __IOMD(0x048) +#define IOMD_T0LATCH __IOMD(0x04c) + +#define IOMD_T1CNTL __IOMD(0x050) +#define IOMD_T1LTCHL __IOMD(0x050) +#define IOMD_T1CNTH __IOMD(0x054) +#define IOMD_T1LTCHH __IOMD(0x054) +#define IOMD_T1GO __IOMD(0x058) +#define IOMD_T1LATCH __IOMD(0x05c) + +#define IOMD_ROMCR0 __IOMD(0x080) +#define IOMD_ROMCR1 __IOMD(0x084) +#define IOMD_DRAMCR __IOMD(0x088) +#define IOMD_VREFCR __IOMD(0x08C) + +#define IOMD_FSIZE __IOMD(0x090) +#define IOMD_ID0 __IOMD(0x094) +#define IOMD_ID1 __IOMD(0x098) +#define IOMD_VERSION __IOMD(0x09C) + +#define IOMD_MOUSEX __IOMD(0x0A0) +#define IOMD_MOUSEY __IOMD(0x0A4) + +#define IOMD_DMATCR __IOMD(0x0C0) +#define IOMD_IOTCR __IOMD(0x0C4) +#define IOMD_ECTCR __IOMD(0x0C8) +#define IOMD_DMAEXT __IOMD(0x0CC) + +#define DMA_EXT_IO0 1 +#define DMA_EXT_IO1 2 +#define DMA_EXT_IO2 4 +#define DMA_EXT_IO3 8 + +#define IOMD_IO0CURA __IOMD(0x100) +#define IOMD_IO0ENDA __IOMD(0x104) +#define IOMD_IO0CURB __IOMD(0x108) +#define IOMD_IO0ENDB __IOMD(0x10C) +#define IOMD_IO0CR __IOMD(0x110) +#define IOMD_IO0ST __IOMD(0x114) + +#define IOMD_IO1CURA __IOMD(0x120) +#define IOMD_IO1ENDA __IOMD(0x124) +#define IOMD_IO1CURB __IOMD(0x128) +#define IOMD_IO1ENDB __IOMD(0x12C) +#define IOMD_IO1CR __IOMD(0x130) +#define IOMD_IO1ST __IOMD(0x134) + +#define IOMD_IO2CURA __IOMD(0x140) +#define IOMD_IO2ENDA __IOMD(0x144) +#define IOMD_IO2CURB __IOMD(0x148) +#define IOMD_IO2ENDB __IOMD(0x14C) +#define IOMD_IO2CR __IOMD(0x150) +#define IOMD_IO2ST __IOMD(0x154) + +#define IOMD_IO3CURA __IOMD(0x160) +#define IOMD_IO3ENDA __IOMD(0x164) +#define IOMD_IO3CURB __IOMD(0x168) +#define IOMD_IO3ENDB __IOMD(0x16C) +#define IOMD_IO3CR __IOMD(0x170) +#define IOMD_IO3ST __IOMD(0x174) + +#define IOMD_SD0CURA __IOMD(0x180) +#define IOMD_SD0ENDA __IOMD(0x184) +#define IOMD_SD0CURB __IOMD(0x188) +#define IOMD_SD0ENDB __IOMD(0x18C) +#define IOMD_SD0CR __IOMD(0x190) +#define IOMD_SD0ST __IOMD(0x194) + +#define IOMD_SD1CURA __IOMD(0x1A0) +#define IOMD_SD1ENDA __IOMD(0x1A4) +#define IOMD_SD1CURB __IOMD(0x1A8) +#define IOMD_SD1ENDB __IOMD(0x1AC) +#define IOMD_SD1CR __IOMD(0x1B0) +#define IOMD_SD1ST __IOMD(0x1B4) + +#define IOMD_CURSCUR __IOMD(0x1C0) +#define IOMD_CURSINIT __IOMD(0x1C4) + +#define IOMD_VIDCUR __IOMD(0x1D0) +#define IOMD_VIDEND __IOMD(0x1D4) +#define IOMD_VIDSTART __IOMD(0x1D8) +#define IOMD_VIDINIT __IOMD(0x1DC) +#define IOMD_VIDCR __IOMD(0x1E0) + +#define IOMD_DMASTAT __IOMD(0x1F0) +#define IOMD_DMAREQ __IOMD(0x1F4) +#define IOMD_DMAMASK __IOMD(0x1F8) + +#define DMA_END_S (1 << 31) +#define DMA_END_L (1 << 30) + +#define DMA_CR_C 0x80 +#define DMA_CR_D 0x40 +#define DMA_CR_E 0x20 + +#define DMA_ST_OFL 4 +#define DMA_ST_INT 2 +#define DMA_ST_AB 1 +/* + * IOC compatability + */ +#define IOC_CONTROL IOMD_CONTROL +#define IOC_IRQSTATA IOMD_IRQSTATA +#define IOC_IRQREQA IOMD_IRQREQA +#define IOC_IRQCLRA IOMD_IRQCLRA +#define IOC_IRQMASKA IOMD_IRQMASKA + +#define IOC_IRQSTATB IOMD_IRQSTATB +#define IOC_IRQREQB IOMD_IRQREQB +#define IOC_IRQMASKB IOMD_IRQMASKB + +#define IOC_FIQSTAT IOMD_FIQSTAT +#define IOC_FIQREQ IOMD_FIQREQ +#define IOC_FIQMASK IOMD_FIQMASK + +#define IOC_T0CNTL IOMD_T0CNTL +#define IOC_T0LTCHL IOMD_T0LTCHL +#define IOC_T0CNTH IOMD_T0CNTH +#define IOC_T0LTCHH IOMD_T0LTCHH +#define IOC_T0GO IOMD_T0GO +#define IOC_T0LATCH IOMD_T0LATCH + +#define IOC_T1CNTL IOMD_T1CNTL +#define IOC_T1LTCHL IOMD_T1LTCHL +#define IOC_T1CNTH IOMD_T1CNTH +#define IOC_T1LTCHH IOMD_T1LTCHH +#define IOC_T1GO IOMD_T1GO +#define IOC_T1LATCH IOMD_T1LATCH + +/* + * DMA (MEMC) compatability + */ +#define HALF_SAM vram_half_sam +#define VDMA_ALIGNMENT (HALF_SAM * 2) +#define VDMA_XFERSIZE (HALF_SAM) +#define VDMA_INIT IOMD_VIDINIT +#define VDMA_START IOMD_VIDSTART +#define VDMA_END IOMD_VIDEND + +#ifndef __ASSEMBLER__ +extern unsigned int vram_half_sam; +#define video_set_dma(start,end,offset) \ +do { \ + outl (SCREEN_START + start, VDMA_START); \ + outl (SCREEN_START + end - VDMA_XFERSIZE, VDMA_END); \ + if (offset >= end - VDMA_XFERSIZE) \ + offset |= 0x40000000; \ + outl (SCREEN_START + offset, VDMA_INIT); \ +} while (0) +#endif + diff --git a/include/asm-arm/irq.h b/include/asm-arm/irq.h index 59770101e..0e8c4ad27 100644 --- a/include/asm-arm/irq.h +++ b/include/asm-arm/irq.h @@ -3,7 +3,9 @@ #include <asm/arch/irqs.h> +#ifndef irq_cannonicalize #define irq_cannonicalize(i) (i) +#endif #ifndef NR_IRQS #define NR_IRQS 128 diff --git a/include/asm-arm/keyboard.h b/include/asm-arm/keyboard.h index 6b64ec6af..9514b470a 100644 --- a/include/asm-arm/keyboard.h +++ b/include/asm-arm/keyboard.h @@ -19,8 +19,6 @@ #include <asm/arch/keyboard.h> -#define SYSRQ_KEY 13 - #endif /* __KERNEL__ */ #endif /* __ASM_ARM_KEYBOARD_H */ diff --git a/include/asm-arm/leds.h b/include/asm-arm/leds.h index d253e2abf..f69aa7fce 100644 --- a/include/asm-arm/leds.h +++ b/include/asm-arm/leds.h @@ -4,6 +4,8 @@ * Copyright (C) 1998 Russell King * * Event-driven interface for LEDs on machines + * + * Added led_start and led_stop- Alex Holden, 28th Dec 1998. */ #ifndef ASM_ARM_LEDS_H #define ASM_ARM_LEDS_H @@ -11,7 +13,9 @@ typedef enum { led_idle_start, led_idle_end, - led_timer + led_timer, + led_start, + led_stop } led_event_t; /* Use this routine to handle LEDs */ diff --git a/include/asm-arm/linux_logo.h b/include/asm-arm/linux_logo.h index 9eeae3619..35ee86403 100644 --- a/include/asm-arm/linux_logo.h +++ b/include/asm-arm/linux_logo.h @@ -11,13 +11,16 @@ #define linux_logo_banner "ARM Linux version " UTS_RELEASE -#define LINUX_LOGO_COLORS 221 +#define LINUX_LOGO_COLORS 214 #ifdef INCLUDE_LINUX_LOGO_DATA +#define INCLUDE_LINUX_LOGOBW #define INCLUDE_LINUX_LOGO16 + #include <linux/linux_logo.h> +#else /* prototypes only */ extern unsigned char linux_logo_red[]; diff --git a/include/asm-arm/md.h b/include/asm-arm/md.h new file mode 100644 index 000000000..0a2c5dd01 --- /dev/null +++ b/include/asm-arm/md.h @@ -0,0 +1,13 @@ +/* $Id: md.h,v 1.1 1997/12/15 15:11:57 jj Exp $ + * md.h: High speed xor_block operation for RAID4/5 + * + */ + +#ifndef __ASM_MD_H +#define __ASM_MD_H + +/* #define HAVE_ARCH_XORBLOCK */ + +#define MD_XORBLOCK_ALIGNMENT sizeof(long) + +#endif /* __ASM_MD_H */ diff --git a/include/asm-arm/memc.h b/include/asm-arm/memc.h new file mode 100644 index 000000000..820738a29 --- /dev/null +++ b/include/asm-arm/memc.h @@ -0,0 +1,13 @@ +#define VDMA_ALIGNMENT PAGE_SIZE +#define VDMA_XFERSIZE 16 +#define VDMA_INIT 0 +#define VDMA_START 1 +#define VDMA_END 2 + +#define video_set_dma(start,end,offset) \ +do { \ + memc_write (VDMA_START, (start >> 2)); \ + memc_write (VDMA_END, (end - VDMA_XFERSIZE) >> 2); \ + memc_write (VDMA_INIT, (offset >> 2)); \ +} while (0) + diff --git a/include/asm-arm/posix_types.h b/include/asm-arm/posix_types.h index cff51a289..4c02ac5fe 100644 --- a/include/asm-arm/posix_types.h +++ b/include/asm-arm/posix_types.h @@ -1,7 +1,7 @@ /* * linux/include/asm-arm/posix_types.h * - * Copyright (c) 1996 Russell King. + * Copyright (c) 1996-1998 Russell King. * * Changelog: * 27-06-1996 RMK Created @@ -9,8 +9,6 @@ #ifndef __ARCH_ARM_POSIX_TYPES_H #define __ARCH_ARM_POSIX_TYPES_H -#include <linux/config.h> - /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot @@ -26,11 +24,7 @@ typedef int __kernel_pid_t; typedef unsigned short __kernel_ipc_pid_t; typedef unsigned short __kernel_uid_t; typedef unsigned short __kernel_gid_t; -#ifdef CONFIG_BINUTILS_NEW -typedef long unsigned int __kernel_size_t; -#else typedef unsigned int __kernel_size_t; -#endif typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; typedef long __kernel_time_t; diff --git a/include/asm-arm/proc-armo/elf.h b/include/asm-arm/proc-armo/elf.h new file mode 100644 index 000000000..535deef31 --- /dev/null +++ b/include/asm-arm/proc-armo/elf.h @@ -0,0 +1,19 @@ +/* + * ELF definitions for 26-bit CPUs + */ + +#define ELF_EXEC_PAGESIZE 32768 + +#if 0 /* not yet */ +#define ELF_PROC_OK(x) \ + ((x)->e_flags & EF_ARM_APCS26) +#else +#define ELF_PROC_OK(x) (1) +#endif + +#ifdef __KERNEL__ + +#define SET_PERSONALITY(ex,ibcs2) \ + current->personality = PER_LINUX + +#endif diff --git a/include/asm-arm/proc-armo/pgtable.h b/include/asm-arm/proc-armo/pgtable.h index 10631f7b2..934902052 100644 --- a/include/asm-arm/proc-armo/pgtable.h +++ b/include/asm-arm/proc-armo/pgtable.h @@ -94,10 +94,6 @@ extern __inline__ void update_memc_addr(struct mm_struct *mm, unsigned long addr #define __flush_entry_to_ram(entry) -/* Certain architectures need to do special things when pte's - * within a page table are directly modified. Thus, the following - * hook is made available. - */ /* PMD_SHIFT determines the size of the area a second-level page table can map */ #define PMD_SHIFT 20 #define PMD_SIZE (1UL << PMD_SHIFT) @@ -119,13 +115,6 @@ extern __inline__ void update_memc_addr(struct mm_struct *mm, unsigned long addr #define PTRS_PER_PGD 32 #define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) -/* Just any arbitrary offset to the start of the vmalloc VM area: the - * current 8MB value just means that there will be a 8MB "hole" after the - * physical memory until the kernel virtual memory starts. That means that - * any out-of-bounds memory accesses will hopefully be caught. - * The vmalloc() routines leaves a hole of 4kB between each vmalloced - * area for the same reason. ;) - */ #define VMALLOC_START 0x01a00000 #define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END 0x01c00000 @@ -280,6 +269,10 @@ extern __inline__ pte_t pte_modify(pte_t pte, pgprot_t newprot) return pte; } +/* Certain architectures need to do special things when pte's + * within a page table are directly modified. Thus, the following + * hook is made available. + */ #define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval)) extern __inline__ unsigned long pte_page(pte_t pte) diff --git a/include/asm-arm/proc-armo/processor.h b/include/asm-arm/proc-armo/processor.h index f76b404c5..4a8b60d10 100644 --- a/include/asm-arm/proc-armo/processor.h +++ b/include/asm-arm/proc-armo/processor.h @@ -9,6 +9,7 @@ * 26-09-1996 RMK Added 'EXTRA_THREAD_STRUCT*' * 28-09-1996 RMK Moved start_thread into the processor dependencies * 11-01-1998 RMK Added new uaccess_t + * 09-09-1998 PJB Delete redundant `wp_works_ok' */ #ifndef __ASM_PROC_PROCESSOR_H #define __ASM_PROC_PROCESSOR_H @@ -20,12 +21,6 @@ #define KERNEL_STACK_SIZE 4096 -/* - * on arm2,3 wp does not work - */ -#define wp_works_ok 0 -#define wp_works_ok__is_a_macro /* for versions in ksyms.c */ - struct context_save_struct { unsigned long r4; unsigned long r5; diff --git a/include/asm-arm/proc-armo/system.h b/include/asm-arm/proc-armo/system.h index a1c2d01cb..471daf654 100644 --- a/include/asm-arm/proc-armo/system.h +++ b/include/asm-arm/proc-armo/system.h @@ -19,6 +19,7 @@ extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int case 4: return processor.u.armv2._xchg_4(x, ptr); default: arm_invalidptr(xchg_str, size); } + return 0; } /* @@ -39,74 +40,74 @@ extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int /* * Save the current interrupt enable state & disable IRQs */ -#define __save_flags_cli(x) \ - do { \ - unsigned long temp; \ - __asm__ __volatile__( \ -" mov %0, pc\n" \ -" orr %1, %0, #0x08000000\n" \ -" and %0, %0, #0x0c000000\n" \ -" teqp %1, #0\n" \ - : "=r" (x), "=r" (temp) \ - : \ - : "memory"); \ +#define __save_flags_cli(x) \ + do { \ + unsigned long temp; \ + __asm__ __volatile__( \ +" mov %0, pc @ save_flags_cli\n" \ +" orr %1, %0, #0x08000000\n" \ +" and %0, %0, #0x0c000000\n" \ +" teqp %1, #0\n" \ + : "=r" (x), "=r" (temp) \ + : \ + : "memory"); \ } while (0) /* * Enable IRQs */ -#define __sti() \ - do { \ - unsigned long temp; \ - __asm__ __volatile__( \ -" mov %0, pc\n" \ -" bic %0, %0, #0x08000000\n" \ -" teqp %0, #0\n" \ - : "=r" (temp) \ - : \ - : "memory"); \ +#define __sti() \ + do { \ + unsigned long temp; \ + __asm__ __volatile__( \ +" mov %0, pc @ sti\n" \ +" bic %0, %0, #0x08000000\n" \ +" teqp %0, #0\n" \ + : "=r" (temp) \ + : \ + : "memory"); \ } while(0) /* * Disable IRQs */ -#define __cli() \ - do { \ - unsigned long temp; \ - __asm__ __volatile__( \ -" mov %0, pc\n" \ -" orr %0, %0, #0x08000000\n" \ -" teqp %0, #0\n" \ - : "=r" (temp) \ - : \ - : "memory"); \ +#define __cli() \ + do { \ + unsigned long temp; \ + __asm__ __volatile__( \ +" mov %0, pc @ cli\n" \ +" orr %0, %0, #0x08000000\n" \ +" teqp %0, #0\n" \ + : "=r" (temp) \ + : \ + : "memory"); \ } while(0) /* * save current IRQ & FIQ state */ -#define __save_flags(x) \ - do { \ - __asm__ __volatile__( \ -" mov %0, pc\n" \ -" and %0, %0, #0x0c000000\n" \ - : "=r" (x)); \ +#define __save_flags(x) \ + do { \ + __asm__ __volatile__( \ +" mov %0, pc @ save_flags\n" \ +" and %0, %0, #0x0c000000\n" \ + : "=r" (x)); \ } while (0) /* * restore saved IRQ & FIQ state */ -#define __restore_flags(x) \ - do { \ - unsigned long temp; \ - __asm__ __volatile__( \ -" mov %0, pc\n" \ -" bic %0, %0, #0x0c000000\n" \ -" orr %0, %0, %1\n" \ -" teqp %0, #0\n" \ - : "=r" (temp) \ - : "r" (x) \ - : "memory"); \ +#define __restore_flags(x) \ + do { \ + unsigned long temp; \ + __asm__ __volatile__( \ +" mov %0, pc @ restore_flags\n" \ +" bic %0, %0, #0x0c000000\n" \ +" orr %0, %0, %1\n" \ +" teqp %0, #0\n" \ + : "=r" (temp) \ + : "r" (x) \ + : "memory"); \ } while (0) #ifdef __SMP__ diff --git a/include/asm-arm/proc-armv/elf.h b/include/asm-arm/proc-armv/elf.h new file mode 100644 index 000000000..f82a786db --- /dev/null +++ b/include/asm-arm/proc-armv/elf.h @@ -0,0 +1,21 @@ +/* + * ELF definitions for 32-bit CPUs + */ + +#define ELF_EXEC_PAGESIZE 4096 + +/* We can execute both 32-bit and 26-bit code. */ +#define ELF_PROC_OK(x) (1) + +#ifdef __KERNEL__ + +#if 0 /* not yet */ +#define SET_PERSONALITY(ex,ibcs2) \ + current_personality = (ex->e_flags & EF_ARM_APCS26) ? \ + PER_LINUX : PER_LINUX_32BIT +#else +#define SET_PERSONALITY(ex,ibcs2) \ + current->personality = PER_LINUX_32BIT +#endif + +#endif diff --git a/include/asm-arm/proc-armv/io.h b/include/asm-arm/proc-armv/io.h index 949d41010..461da303f 100644 --- a/include/asm-arm/proc-armv/io.h +++ b/include/asm-arm/proc-armv/io.h @@ -22,17 +22,17 @@ #include <asm/proc-fns.h> -#define dma_cache_inv(_start,_size) \ - do { \ - processor.u.armv3v4._cache_purge_area(_start,(_start+_size)); \ - } while (0) +extern inline void dma_cache_inv(unsigned long start, unsigned long size) +{ + processor.u.armv3v4._cache_purge_area(start, start + size); +} -#define dma_cache_wback(_start,_size) \ - do { \ - processor.u.armv3v4._cache_wback_area(_start,(_start+_size)); \ - } while (0) +extern inline void dma_cache_wback(unsigned long start, unsigned long size) +{ + processor.u.armv3v4._cache_wback_area(start, start + size); +} -#define dma_cache_wback_inv(_start,_size) \ - do { \ - processor.u.armv3v4._flush_cache_area(_start,(_start+_size),0); \ - } while (0) +extern inline void dma_cache_wback_inv(unsigned long start, unsigned long size) +{ + processor.u.armv3v4._flush_cache_area(start, start + size, 0); +} diff --git a/include/asm-arm/proc-armv/mm-init.h b/include/asm-arm/proc-armv/mm-init.h index 2e861b213..a3f5c327f 100644 --- a/include/asm-arm/proc-armv/mm-init.h +++ b/include/asm-arm/proc-armv/mm-init.h @@ -136,7 +136,7 @@ setup_pagetables(unsigned long start_mem, unsigned long end_mem) /* * An area to invalidate the cache */ - alloc_init_section(&start_mem, 0xdf000000, SAFE_ADDR, DOMAIN_KERNEL, + alloc_init_section(&start_mem, FLUSH_BASE, FLUSH_BASE_PHYS, DOMAIN_KERNEL, PMD_SECT_CACHEABLE | PMD_SECT_AP_READ); /* diff --git a/include/asm-arm/proc-armv/page.h b/include/asm-arm/proc-armv/page.h index fd8768939..8acec4c75 100644 --- a/include/asm-arm/proc-armv/page.h +++ b/include/asm-arm/proc-armv/page.h @@ -7,6 +7,8 @@ #ifndef __ASM_PROC_PAGE_H #define __ASM_PROC_PAGE_H +#include <asm/hardware.h> + /* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT 12 #define PAGE_SIZE (1UL << PAGE_SHIFT) @@ -60,7 +62,10 @@ typedef unsigned long pgprot_t; #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) /* This handles the memory map.. */ +#ifndef PAGE_OFFSET #define PAGE_OFFSET 0xc0000000 +#endif + #define MAP_NR(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> PAGE_SHIFT) #endif /* __KERNEL__ */ diff --git a/include/asm-arm/proc-armv/processor.h b/include/asm-arm/proc-armv/processor.h index 294dead68..88b277ea7 100644 --- a/include/asm-arm/proc-armv/processor.h +++ b/include/asm-arm/proc-armv/processor.h @@ -7,6 +7,7 @@ * 20-09-1996 RMK Created * 26-09-1996 RMK Added 'EXTRA_THREAD_STRUCT*' * 28-09-1996 RMK Moved start_thread into the processor dependencies + * 09-09-1998 PJB Delete redundant `wp_works_ok' */ #ifndef __ASM_PROC_PROCESSOR_H #define __ASM_PROC_PROCESSOR_H @@ -15,12 +16,6 @@ #define KERNEL_STACK_SIZE PAGE_SIZE -/* - * on arm2,3 wp does not work - */ -#define wp_works_ok 0 -#define wp_works_ok__is_a_macro /* for versions in ksyms.c */ - struct context_save_struct { unsigned long cpsr; unsigned long r4; diff --git a/include/asm-arm/proc-armv/semaphore.h b/include/asm-arm/proc-armv/semaphore.h index fb1ad746f..3da31f536 100644 --- a/include/asm-arm/proc-armv/semaphore.h +++ b/include/asm-arm/proc-armv/semaphore.h @@ -10,20 +10,24 @@ */ extern inline void down(struct semaphore * sem) { + unsigned int cpsr, temp; + __asm__ __volatile__ (" @ atomic down operation - mrs r0, cpsr - orr r1, r0, #128 @ disable IRQs - bic r0, r0, #0x80000000 @ clear N - msr cpsr, r1 - ldr r1, [%0] - subs r1, r1, #1 - str r1, [%0] - orrmi r0, r0, #0x80000000 @ set N - msr cpsr, r0 - movmi r0, %0 - blmi " SYMBOL_NAME_STR(__down) - : : "r" (sem) : "r0", "r1", "r2", "r3", "ip", "lr", "cc"); + mrs %0, cpsr + orr %1, %0, #128 @ disable IRQs + bic %0, %0, #0x80000000 @ clear N + msr cpsr, %1 + ldr %1, [%2] + subs %1, %1, #1 + orrmi %0, %0, #0x80000000 @ set N + str %1, [%2] + msr cpsr, %0 + movmi r0, %2 + blmi " SYMBOL_NAME_STR(__down_failed) + : "=&r" (cpsr), "=&r" (temp) + : "r" (sem) + : "r0", "lr", "cc"); } /* @@ -32,26 +36,28 @@ extern inline void down(struct semaphore * sem) */ extern inline int down_interruptible (struct semaphore * sem) { - int result; + unsigned int cpsr, temp; + __asm__ __volatile__ (" - @ atomic down operation - mrs r0, cpsr - orr r1, r0, #128 @ disable IRQs - bic r0, r0, #0x80000000 @ clear N - msr cpsr, r1 - ldr r1, [%1] - subs r1, r1, #1 - str r1, [%1] - orrmi r0, r0, #0x80000000 @ set N - msr cpsr, r0 - movmi r0, %1 + @ atomic down interruptible operation + mrs %0, cpsr + orr %1, %0, #128 @ disable IRQs + bic %0, %0, #0x80000000 @ clear N + msr cpsr, %1 + ldr %1, [%2] + subs %1, %1, #1 + orrmi %0, %0, #0x80000000 @ set N + str %1, [%2] + msr cpsr, %0 + movmi r0, %2 movpl r0, #0 - blmi " SYMBOL_NAME_STR(__down_interruptible) " - mov %0, r0" - : "=r" (result) + blmi " SYMBOL_NAME_STR(__down_interruptible_failed) " + mov %1, r0" + : "=&r" (cpsr), "=&r" (temp) : "r" (sem) - : "r0", "r1", "r2", "r3", "ip", "lr", "cc"); - return result; + : "r0", "lr", "cc"); + + return temp; } /* @@ -62,20 +68,24 @@ extern inline int down_interruptible (struct semaphore * sem) */ extern inline void up(struct semaphore * sem) { + unsigned int cpsr, temp; + __asm__ __volatile__ (" @ atomic up operation - mrs r0, cpsr - orr r1, r0, #128 @ disable IRQs - bic r0, r0, #0x80000000 @ clear N - msr cpsr, r1 - ldr r1, [%0] - adds r1, r1, #1 - str r1, [%0] - orrls r0, r0, #0x80000000 @ set N - msr cpsr, r0 - movmi r0, %0 - blmi " SYMBOL_NAME_STR(__up) - : : "r" (sem) : "r0", "r1", "r2", "r3", "ip", "lr", "cc"); + mrs %0, cpsr + orr %1, %0, #128 @ disable IRQs + bic %0, %0, #0x80000000 @ clear N + msr cpsr, %1 + ldr %1, [%2] + adds %1, %1, #1 + orrls %0, %0, #0x80000000 @ set N + str %1, [%2] + msr cpsr, %0 + movmi r0, %2 + blmi " SYMBOL_NAME_STR(__up_wakeup) + : "=&r" (cpsr), "=&r" (temp) + : "r" (sem) + : "r0", "lr", "cc"); } #endif diff --git a/include/asm-arm/proc-armv/system.h b/include/asm-arm/proc-armv/system.h index 0ef12de11..9de0fccc5 100644 --- a/include/asm-arm/proc-armv/system.h +++ b/include/asm-arm/proc-armv/system.h @@ -22,22 +22,24 @@ extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int return x; } -/* - * This processor does not need anything special before reset, - * but RPC may do... - */ -extern __inline__ void proc_hard_reset(void) -{ -} +#define set_cr(x) \ + do { \ + __asm__ __volatile__( \ + "mcr p15, 0, %0, c1, c0 @ set CR" \ + : : "r" (x)); \ + } while (0) + +extern unsigned long cr_no_alignment; /* defined in entry-armv.S */ +extern unsigned long cr_alignment; /* defined in entry-armv.S */ /* * We can wait for an interrupt... */ -#define proc_idle() \ - do { \ - __asm__ __volatile__( \ -" mcr p15, 0, %0, c15, c8, 2" \ - : : "r" (0)); \ +#define proc_idle() \ + do { \ + __asm__ __volatile__( \ +" mcr p15, 0, %0, c15, c8, 2 @ proc_idle" \ + : : "r" (0)); \ } while (0) /* @@ -47,75 +49,75 @@ extern __inline__ void proc_hard_reset(void) /* * Save the current interrupt enable state & disable IRQs */ -#define __save_flags_cli(x) \ - do { \ - unsigned long temp; \ - __asm__ __volatile__( \ - "mrs %1, cpsr\n" \ -" and %0, %1, #192\n" \ -" orr %1, %1, #128\n" \ -" msr cpsr, %1" \ - : "=r" (x), "=r" (temp) \ - : \ - : "memory"); \ +#define __save_flags_cli(x) \ + do { \ + unsigned long temp; \ + __asm__ __volatile__( \ + "mrs %1, cpsr @ save_flags_cli\n" \ +" and %0, %1, #192\n" \ +" orr %1, %1, #128\n" \ +" msr cpsr, %1" \ + : "=r" (x), "=r" (temp) \ + : \ + : "memory"); \ } while (0) /* * Enable IRQs */ -#define __sti() \ - do { \ - unsigned long temp; \ - __asm__ __volatile__( \ - "mrs %0, cpsr\n" \ -" bic %0, %0, #128\n" \ -" msr cpsr, %0" \ - : "=r" (temp) \ - : \ - : "memory"); \ +#define __sti() \ + do { \ + unsigned long temp; \ + __asm__ __volatile__( \ + "mrs %0, cpsr @ sti\n" \ +" bic %0, %0, #128\n" \ +" msr cpsr, %0" \ + : "=r" (temp) \ + : \ + : "memory"); \ } while(0) /* * Disable IRQs */ -#define __cli() \ - do { \ - unsigned long temp; \ - __asm__ __volatile__( \ - "mrs %0, cpsr\n" \ -" orr %0, %0, #128\n" \ -" msr cpsr, %0" \ - : "=r" (temp) \ - : \ - : "memory"); \ +#define __cli() \ + do { \ + unsigned long temp; \ + __asm__ __volatile__( \ + "mrs %0, cpsr @ cli\n" \ +" orr %0, %0, #128\n" \ +" msr cpsr, %0" \ + : "=r" (temp) \ + : \ + : "memory"); \ } while(0) /* * save current IRQ & FIQ state */ -#define __save_flags(x) \ - do { \ - __asm__ __volatile__( \ - "mrs %0, cpsr\n" \ -" and %0, %0, #192" \ - : "=r" (x) \ - : \ - : "memory"); \ +#define __save_flags(x) \ + do { \ + __asm__ __volatile__( \ + "mrs %0, cpsr @ save_flags\n" \ +" and %0, %0, #192" \ + : "=r" (x) \ + : \ + : "memory"); \ } while (0) /* * restore saved IRQ & FIQ state */ -#define __restore_flags(x) \ - do { \ - unsigned long temp; \ - __asm__ __volatile__( \ - "mrs %0, cpsr\n" \ -" bic %0, %0, #192\n" \ -" orr %0, %0, %1\n" \ -" msr cpsr, %0" \ - : "=r" (temp) \ - : "r" (x) \ +#define __restore_flags(x) \ + do { \ + unsigned long temp; \ + __asm__ __volatile__( \ + "mrs %0, cpsr @ restore_flags\n" \ +" bic %0, %0, #192\n" \ +" orr %0, %0, %1\n" \ +" msr cpsr, %0" \ + : "=r" (temp) \ + : "r" (x) \ : "memory"); \ } while (0) diff --git a/include/asm-arm/proc-armv/uaccess.h b/include/asm-arm/proc-armv/uaccess.h index acadb35a3..a8dce6739 100644 --- a/include/asm-arm/proc-armv/uaccess.h +++ b/include/asm-arm/proc-armv/uaccess.h @@ -11,6 +11,8 @@ * DOMAIN_USER - domain 0 includes all user memory only */ +#include <asm/hardware.h> + #define DOMAIN_CLIENT 1 #define DOMAIN_MANAGER 3 @@ -35,7 +37,7 @@ * Note that this is actually 0x1,0000,0000 */ #define KERNEL_DS 0x00000000 -#define USER_DS 0xc0000000 +#define USER_DS PAGE_OFFSET #define get_ds() (KERNEL_DS) #define get_fs() (current->addr_limit) @@ -50,13 +52,10 @@ extern __inline__ void set_fs (mm_segment_t fs) : "r" (fs ? USER_DOMAIN : KERNEL_DOMAIN)); } -/* - * a + s <= 2^32 -> C = 0 || Z = 0 (LS) - * (a + s) <= l -> C = 0 || Z = 0 (LS) - */ +/* We use 33-bit arithmetic here... */ #define __range_ok(addr,size) ({ \ unsigned long flag, sum; \ - __asm__ __volatile__("adds %1, %2, %3; cmpls %1, %0; movls %0, #0" \ + __asm__ __volatile__("adds %1, %2, %3; sbcccs %1, %1, %0; movcc %0, #0" \ : "=&r" (flag), "=&r" (sum) \ : "r" (addr), "Ir" (size), "0" (current->addr_limit) \ : "cc"); \ diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h index edab09ace..f4c687089 100644 --- a/include/asm-arm/processor.h +++ b/include/asm-arm/processor.h @@ -53,11 +53,9 @@ struct mm_struct; extern void release_thread(struct task_struct *); /* Copy and release all segment info associated with a VM */ -extern void copy_segments(int nr, struct task_struct *p, struct mm_struct * mm); -extern void release_segments(struct mm_struct * mm); - #define copy_segments(nr, tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) +#define forget_segments() do { } while (0) #define init_task (init_task_union.task) #define init_stack (init_task_union.stack) diff --git a/include/asm-arm/semaphore.h b/include/asm-arm/semaphore.h index 3186aac19..287d8c263 100644 --- a/include/asm-arm/semaphore.h +++ b/include/asm-arm/semaphore.h @@ -18,10 +18,11 @@ struct semaphore { #define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), 0, NULL }) asmlinkage void __down_failed (void /* special register calling convention */); -asmlinkage int __down_failed_interruptible (void /* special register calling convention */); +asmlinkage int __down_interruptible_failed (void /* special register calling convention */); asmlinkage void __up_wakeup (void /* special register calling convention */); extern void __down(struct semaphore * sem); +extern int __down_interruptible(struct semaphore * sem); extern void __up(struct semaphore * sem); #define sema_init(sem, val) atomic_set(&((sem)->count), (val)) @@ -47,7 +48,7 @@ static inline void wake_one_more(struct semaphore * sem) restore_flags(flags); } -static inline int waking_non_zero(struct semaphore *sem) +static inline int waking_non_zero(struct semaphore *sem, struct task_struct *tsk) { unsigned long flags; int ret = 0; diff --git a/include/asm-arm/signal.h b/include/asm-arm/signal.h index 08b5edb50..12ec642aa 100644 --- a/include/asm-arm/signal.h +++ b/include/asm-arm/signal.h @@ -21,7 +21,7 @@ typedef struct { } sigset_t; #else -/* Here we must cater to lics that poke about in kernel headers. */ +/* Here we must cater to libcs that poke about in kernel headers. */ #define NSIG 32 typedef unsigned long sigset_t; @@ -69,6 +69,8 @@ typedef unsigned long sigset_t; #define SIGRTMIN 32 #define SIGRTMAX (_NSIG-1) +#define SIGSWI 32 + /* * SA_FLAGS values: * @@ -96,6 +98,8 @@ typedef unsigned long sigset_t; #define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ #define SA_RESTORER 0x04000000 +#define SA_THIRTYTWO 0x02000000 /* deliver signal in 32-bit mode even if + task is running 26 bits. */ /* * sigaltstack controls @@ -132,6 +136,7 @@ typedef void (*__sighandler_t)(int); #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ +#ifdef __KERNEL__ struct old_sigaction { __sighandler_t sa_handler; old_sigset_t sa_mask; @@ -150,6 +155,24 @@ struct k_sigaction { struct sigaction sa; }; +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + +struct sigaction { + union { + __sighandler_t _sa_handler; + void (*_sa_sigaction)(int, struct siginfo *, void *); + } _u; + sigset_t sa_mask; + unsigned long sa_flags; + void (*sa_restorer)(void); +}; + +#define sa_handler _u._sa_handler +#define sa_sigaction _u._sa_sigaction + +#endif /* __KERNEL__ */ + typedef struct sigaltstack { void *ss_sp; int ss_flags; diff --git a/include/asm-arm/socket.h b/include/asm-arm/socket.h index 91de70e6e..d0d2ddb36 100644 --- a/include/asm-arm/socket.h +++ b/include/asm-arm/socket.h @@ -35,4 +35,8 @@ #define SO_BINDTODEVICE 25 +/* Socket filtering */ +#define SO_ATTACH_FILTER 26 +#define SO_DETACH_FILTER 27 + #endif /* _ASM_SOCKET_H */ diff --git a/include/asm-arm/softirq.h b/include/asm-arm/softirq.h index ba99f96f6..6bad79dd4 100644 --- a/include/asm-arm/softirq.h +++ b/include/asm-arm/softirq.h @@ -13,7 +13,7 @@ extern unsigned int local_bh_count[NR_CPUS]; extern inline void init_bh(int nr, void (*routine)(void)) { bh_base[nr] = routine; - bh_mask_count[nr] = 0; + atomic_set(&bh_mask_count[nr], 0); bh_mask |= 1 << nr; } @@ -58,13 +58,13 @@ extern inline void end_bh_atomic(void) extern inline void disable_bh(int nr) { bh_mask &= ~(1 << nr); - bh_mask_count[nr]++; + atomic_inc(&bh_mask_count[nr]); synchronize_bh(); } extern inline void enable_bh(int nr) { - if (!--bh_mask_count[nr]) + if (atomic_dec_and_test(&bh_mask_count[nr])) bh_mask |= 1 << nr; } diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h index e72553f1a..33e1fe183 100644 --- a/include/asm-arm/spinlock.h +++ b/include/asm-arm/spinlock.h @@ -4,11 +4,19 @@ #ifndef __SMP__ /* + * To be safe, we assume the only compiler that can cope with + * empty initialisers is EGCS. + */ +#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 90)) +#define EMPTY_INIT_OK +#endif + +/* * Your basic spinlocks, allowing only a single CPU anywhere */ -#if (__GNUC__ > 2) || (__GNUC_MINOR__ >= 8) +#ifdef EMPTY_INIT_OK typedef struct { } spinlock_t; -# define SPIN_LOCK_UNLOCKED { } +# define SPIN_LOCK_UNLOCKED (spinlock_t) { } #else typedef unsigned char spinlock_t; # define SPIN_LOCK_UNLOCKED 0 @@ -37,8 +45,13 @@ * irq-safe write-lock, but readers can get non-irqsafe * read-locks. */ -typedef struct { } rwlock_t; -#define RW_LOCK_UNLOCKED { } +#ifdef EMPTY_INIT_OK + typedef struct { } rwlock_t; +# define RW_LOCK_UNLOCKED (rwlock_t) { } +#else + typedef unsigned char rwlock_t; +# define RW_LOCK_UNLOCKED 0 +#endif #define read_lock(lock) do { } while(0) #define read_unlock(lock) do { } while(0) diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index 1d7e28b0b..91c08d668 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h @@ -1,6 +1,8 @@ #ifndef __ASM_ARM_SYSTEM_H #define __ASM_ARM_SYSTEM_H +#include <linux/config.h> + /* The type of machine we're running on */ extern unsigned int machine_type; #define MACH_TYPE_EBSA110 0 @@ -11,6 +13,29 @@ extern unsigned int machine_type; #define MACH_TYPE_CATS 6 #define MACH_TYPE_TBOX 7 +#ifdef CONFIG_ARCH_EBSA285 +#define machine_is_ebsa285() (1) +#else +#define machine_is_ebsa285() (0) +#endif + +#ifdef CONFIG_ARCH_VNC +#define machine_is_netwinder() (1) +#else +#define machine_is_netwinder() (0) +#endif + +#if defined(CONFIG_CATS) +#define machine_is_cats() (machine_type == MACH_TYPE_CATS) +#else +#define machine_is_cats() (0) +#endif + +#if 0 +#define machine_is_ebsa285() (machine_type == MACH_TYPE_EBSA285) +#define machine_is_netwinder() (machine_type == MACH_TYPE_NETWINDER) +#endif + #include <linux/kernel.h> #include <asm/proc-fns.h> diff --git a/include/asm-arm/termbits.h b/include/asm-arm/termbits.h index 435833937..9922760e4 100644 --- a/include/asm-arm/termbits.h +++ b/include/asm-arm/termbits.h @@ -117,10 +117,21 @@ struct termios { #define HUPCL 0002000 #define CLOCAL 0004000 #define CBAUDEX 0010000 -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 #define CIBAUD 002003600000 /* input baud rate (not used) */ #define CMSPAR 010000000000 /* mark or space (stick) parity */ #define CRTSCTS 020000000000 /* flow control */ diff --git a/include/asm-arm/termios.h b/include/asm-arm/termios.h index 2510a5b0e..5e05c1754 100644 --- a/include/asm-arm/termios.h +++ b/include/asm-arm/termios.h @@ -58,6 +58,8 @@ struct termio { #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ +#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #ifdef __KERNEL__ diff --git a/include/asm-arm/timex.h b/include/asm-arm/timex.h index 29ae27df2..d9a3303be 100644 --- a/include/asm-arm/timex.h +++ b/include/asm-arm/timex.h @@ -10,4 +10,13 @@ #include <asm/arch/timex.h> +typedef unsigned long cycles_t; + +extern cycles_t cacheflush_time; + +static inline cycles_t get_cycles (void) +{ + return 0; +} + #endif diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h index 780b7a13c..601af3b0a 100644 --- a/include/asm-arm/unistd.h +++ b/include/asm-arm/unistd.h @@ -23,7 +23,7 @@ #define __NR_time (__NR_SYSCALL_BASE+ 13) #define __NR_mknod (__NR_SYSCALL_BASE+ 14) #define __NR_chmod (__NR_SYSCALL_BASE+ 15) -#define __NR_chown (__NR_SYSCALL_BASE+ 16) +#define __NR_lchown (__NR_SYSCALL_BASE+ 16) #define __NR_break (__NR_SYSCALL_BASE+ 17) #define __NR_oldstat (__NR_SYSCALL_BASE+ 18) #define __NR_lseek (__NR_SYSCALL_BASE+ 19) @@ -189,8 +189,12 @@ #define __NR_rt_sigsuspend (__NR_SYSCALL_BASE+179) #define __NR_pread (__NR_SYSCALL_BASE+180) #define __NR_pwrite (__NR_SYSCALL_BASE+181) -#define __NR_xstat (__NR_SYSCALL_BASE+182) -#define __NR_xmknod (__NR_SYSCALL_BASE+183) +#define __NR_chown (__NR_SYSCALL_BASE+182) +#define __NR_getcwd (__NR_SYSCALL_BASE+183) +#define __NR_capget (__NR_SYSCALL_BASE+184) +#define __NR_capset (__NR_SYSCALL_BASE+185) +#define __NR_sigaltstack (__NR_SYSCALL_BASE+186) +#define __NR_sendfile (__NR_SYSCALL_BASE+187) #define __sys2(x) #x #define __sys1(x) __sys2(x) @@ -299,41 +303,94 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ #ifdef __KERNEL_SYSCALLS__ -/* - * we need this inline - forking from kernel space will result - * in NO COPY ON WRITE (!!!), until an execve is executed. This - * is no problem, but for the stack. This is handled by not letting - * main() use the stack at all after fork(). Thus, no function - * calls - which means inline code for fork too, as otherwise we - * would use the stack upon exit from 'fork()'. - * - * Actually only pause and fork are needed inline, so that there - * won't be any messing with the stack from main(), but we define - * some others too. - */ -#define __NR__exit __NR_exit -static inline _syscall0(int,idle); -static inline _syscall0(int,pause); -static inline _syscall1(int,setup,int,magic); -static inline _syscall0(int,sync); -static inline _syscall0(pid_t,setsid); -static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count); -static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) -static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count); -static inline _syscall1(int,dup,int,fd); -static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp); -static inline _syscall3(int,open,const char *,file,int,flag,int,mode); -static inline _syscall1(int,close,int,fd); -static inline _syscall1(int,_exit,int,exitcode); -static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options); -static inline _syscall1(int,delete_module,const char *,name) +static inline int idle(void) +{ + extern int sys_idle(void); + return sys_idle(); +} -static inline pid_t wait(int * wait_stat) +static inline int pause(void) +{ + extern int sys_pause(void); + return sys_pause(); +} + +static inline int sync(void) +{ + extern int sys_sync(void); + return sys_sync(); +} + +static inline pid_t setsid(void) +{ + extern int sys_setsid(void); + return sys_setsid(); +} + +static inline int write(int fd, const char *buf, off_t count) +{ + extern int sys_write(int, const char *, int); + return sys_write(fd, buf, count); +} + +static inline int read(int fd, char *buf, off_t count) +{ + extern int sys_read(int, char *, int); + return sys_read(fd, buf, count); +} + +static inline off_t lseek(int fd, off_t offset, int count) +{ + extern off_t sys_lseek(int, off_t, int); + return sys_lseek(fd, offset, count); +} + +static inline int dup(int fd) +{ + extern int sys_dup(int); + return sys_dup(fd); +} + +static inline int open(const char *file, int flag, int mode) +{ + extern int sys_open(const char *, int, int); + return sys_open(file, flag, mode); +} + +static inline int close(int fd) { - return waitpid(-1,wait_stat,0); + return sys_close(fd); } +static inline int _exit(int exitcode) +{ + extern int sys_exit(int); + return sys_exit(exitcode); +} +static inline pid_t waitpid(pid_t pid, int *wait_stat, int options) +{ + extern int sys_wait4(int, int *, int, struct rusage *); + return sys_wait4((int)pid, wait_stat, options, NULL); +} + +static inline int delete_module(const char *name) +{ + extern int sys_delete_module(const char *name); + return sys_delete_module(name); +} + +static inline pid_t wait(int * wait_stat) +{ + extern int sys_wait4(int, int *, int, struct rusage *); + return sys_wait4(-1, wait_stat, 0, NULL); +} + +/* + * The following two can't be eliminated yet - they rely on + * specific conditions. + */ +static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp); /* * This is the mechanism for creating a new kernel thread. diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index 00dd9dcc8..09f25dc78 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h @@ -127,6 +127,7 @@ extern __inline__ int __test_bit(int nr, volatile void * addr) */ extern __inline__ int find_first_zero_bit(void * addr, unsigned size) { + int d0, d1, d2; int res; if (!size) @@ -142,9 +143,8 @@ extern __inline__ int find_first_zero_bit(void * addr, unsigned size) "1:\tsubl %%ebx,%%edi\n\t" "shll $3,%%edi\n\t" "addl %%edi,%%edx" - :"=d" (res) - :"c" ((size + 31) >> 5), "D" (addr), "b" (addr) - :"ax", "cx", "di"); + :"=d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2) + :"1" ((size + 31) >> 5), "2" (addr), "b" (addr)); return res; } diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h index 5cd7e94d6..c9ca53c66 100644 --- a/include/asm-i386/bugs.h +++ b/include/asm-i386/bugs.h @@ -5,6 +5,7 @@ * * Cyrix stuff, June 1998 by: * - Rafael R. Reilova (moved everything from head.S), + * <rreilova@ececs.uc.edu> * - Channing Corn (tests & fixes), * - Andrew D. Balsa (code cleanup). */ @@ -113,21 +114,6 @@ __initfunc(static void check_hlt(void)) printk("OK.\n"); } -__initfunc(static void check_tlb(void)) -{ -#ifndef CONFIG_M386 - /* - * The 386 chips don't support TLB finegrained invalidation. - * They will fault when they hit an invlpg instruction. - */ - if (boot_cpu_data.x86 == 3) { - printk(KERN_EMERG "CPU is a 386 and this kernel was compiled for 486 or better.\n"); - printk("Giving up.\n"); - for (;;) ; - } -#endif -} - /* * Most 386 processors have a bug where a POPAD can lock the * machine even from user space. @@ -135,15 +121,15 @@ __initfunc(static void check_tlb(void)) __initfunc(static void check_popad(void)) { -#ifdef CONFIG_M386 +#ifndef CONFIG_X86_POPAD_OK int res, inp = (int) &res; printk(KERN_INFO "Checking for popad bug... "); __asm__ __volatile__( "movl $12345678,%%eax; movl $0,%%edi; pusha; popa; movl (%%edx,%%edi),%%ecx " - : "=eax" (res) - : "edx" (inp) - : "eax", "ecx", "edx", "edi" ); + : "=&a" (res) + : "d" (inp) + : "ecx", "edi" ); /* If this fails, it means that any user program may lock the CPU hard. Too bad. */ if (res != 12345678) printk( "Buggy.\n" ); else printk( "OK.\n" ); @@ -247,63 +233,63 @@ static inline int test_cyrix_52div(void) } /* - * Cyrix CPUs without cpuid or with cpuid not yet enabled can be detected - * by the fact that they preserve the flags across the division of 5/2. - * PII and PPro exhibit this behavior too, but they have cpuid available. + * Fix cpuid problems with Cyrix CPU's: + * -- on the Cx686(L) the cpuid is disabled on power up. + * -- braindamaged BIOS disable cpuid on the Cx686MX. */ -__initfunc(static void check_cyrix_cpu(void)) +extern unsigned char Cx86_dir0_msb; /* exported HACK from cyrix_model() */ + +__initfunc(static void check_cx686_cpuid(void)) { - if ((boot_cpu_data.cpuid_level == -1) && (boot_cpu_data.x86 == 4) - && test_cyrix_52div()) { + if (boot_cpu_data.cpuid_level == -1 && + ((Cx86_dir0_msb == 5) || (Cx86_dir0_msb == 3))) { + int eax, dummy; + unsigned char ccr3, ccr4; - /* default to an unknown Cx486, (we will differentiate later) */ - /* NOTE: using 0xff since 0x00 is a valid DIR0 value */ - strcpy(boot_cpu_data.x86_vendor_id, "CyrixInstead"); - boot_cpu_data.x86_model = 0xff; - boot_cpu_data.x86_mask = 0; + cli(); + ccr3 = getCx86(CX86_CCR3); + setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ + ccr4 = getCx86(CX86_CCR4); + setCx86(CX86_CCR4, ccr4 | 0x80); /* enable cpuid */ + setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ + sti(); + + /* we have up to level 1 available on the Cx6x86(L|MX) */ + boot_cpu_data.cpuid_level = 1; + cpuid(1, &eax, &dummy, &dummy, + &boot_cpu_data.x86_capability); + + boot_cpu_data.x86 = (eax >> 8) & 15; + /* + * we already have a cooked step/rev number from DIR1 + * so we don't use the cpuid-provided ones. + */ } } /* - * Fix two problems with the Cyrix 6x86 and 6x86L: - * -- the cpuid is disabled on power up, enable it, use it. - * -- the SLOP bit needs resetting on some motherboards due to old BIOS, - * so that the udelay loop calibration works well. Recalibrate. + * Reset the slow-loop (SLOP) bit on the 686(L) which is set by some old + * BIOSes for compatability with DOS games. This makes the udelay loop + * work correctly, and improves performance. */ extern void calibrate_delay(void) __init; -__initfunc(static void check_cx686_cpuid_slop(void)) +__initfunc(static void check_cx686_slop(void)) { - if (boot_cpu_data.x86_vendor == X86_VENDOR_CYRIX && - (boot_cpu_data.x86_model & 0xf0) == 0x30) { /* 6x86(L) */ - int dummy; - unsigned char ccr3, ccr4, ccr5; + if (Cx86_dir0_msb == 3) { + unsigned char ccr3, ccr5; cli(); ccr3 = getCx86(CX86_CCR3); - setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ - ccr4 = getCx86(CX86_CCR4); - setCx86(CX86_CCR4, ccr4 | 0x80); /* enable cpuid */ + setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ ccr5 = getCx86(CX86_CCR5); - if (ccr5 & 2) /* reset SLOP if needed, old BIOS do this wrong */ - setCx86(CX86_CCR5, ccr5 & 0xfd); - setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ + if (ccr5 & 2) + setCx86(CX86_CCR5, ccr5 & 0xfd); /* reset SLOP */ + setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ sti(); - boot_cpu_data.cpuid_level = 1; /* should cover all 6x86(L) */ - boot_cpu_data.x86 = 5; - - /* we know we have level 1 available on the 6x86(L) */ - cpuid(1, &dummy, &dummy, &dummy, - &boot_cpu_data.x86_capability); - /* - * DON'T use the x86_mask and x86_model from cpuid, these are - * not as accurate (or the same) as those from the DIR regs. - * already in place after cyrix_model() in setup.c - */ - if (ccr5 & 2) { /* possible wrong calibration done */ printk(KERN_INFO "Recalibrating delay loop with SLOP bit reset\n"); calibrate_delay(); @@ -312,16 +298,74 @@ __initfunc(static void check_cx686_cpuid_slop(void)) } } +/* + * Cyrix CPUs without cpuid or with cpuid not yet enabled can be detected + * by the fact that they preserve the flags across the division of 5/2. + * PII and PPro exhibit this behavior too, but they have cpuid available. + */ + +__initfunc(static void check_cyrix_cpu(void)) +{ + if ((boot_cpu_data.cpuid_level == -1) && (boot_cpu_data.x86 == 4) + && test_cyrix_52div()) { + + strcpy(boot_cpu_data.x86_vendor_id, "CyrixInstead"); + } +} + +/* + * Check wether we are able to run this kernel safely on SMP. + * + * - In order to run on a i386, we need to be compiled for i386 + * (for due to lack of "invlpg" and working WP on a i386) + * - In order to run on anything without a TSC, we need to be + * compiled for a i486. + * - In order to work on a Pentium/SMP machine, we need to be + * compiled for a Pentium or lower, as a PPro config implies + * a properly working local APIC without the need to do extra + * reads from the APIC. +*/ + +__initfunc(static void check_config(void)) +{ +/* + * We'd better not be a i386 if we're configured to use some + * i486+ only features! (WP works in supervisor mode and the + * new "invlpg" and "bswap" instructions) + */ +#if defined(CONFIG_X86_WP_WORKS_OK) || defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_BSWAP) + if (boot_cpu_data.x86 == 3) + panic("Kernel requires i486+ for 'invlpg' and other features"); +#endif + +/* + * If we configured ourselves for a TSC, we'd better have one! + */ +#ifdef CONFIG_X86_TSC + if (!(boot_cpu_data.x86_capability & X86_FEATURE_TSC)) + panic("Kernel compiled for Pentium+, requires TSC"); +#endif + +/* + * If we were told we had a good APIC for SMP, we'd better be a PPro + */ +#if defined(CONFIG_X86_GOOD_APIC) && defined(CONFIG_SMP) + if (smp_found_config && boot_cpu_data.x86 <= 5) + panic("Kernel compiled for PPro+, assumes local APIC without read-before-write bug"); +#endif +} + __initfunc(static void check_bugs(void)) { check_cyrix_cpu(); identify_cpu(&boot_cpu_data); + check_cx686_cpuid(); + check_cx686_slop(); #ifndef __SMP__ printk("CPU: "); print_cpu_info(&boot_cpu_data); #endif - check_cx686_cpuid_slop(); - check_tlb(); + check_config(); check_fpu(); check_hlt(); check_popad(); diff --git a/include/asm-i386/byteorder.h b/include/asm-i386/byteorder.h index 51d66f8fc..bbfb629fa 100644 --- a/include/asm-i386/byteorder.h +++ b/include/asm-i386/byteorder.h @@ -12,7 +12,7 @@ static __inline__ __const__ __u32 ___arch__swab32(__u32 x) { -#if defined(__KERNEL__) && !defined(CONFIG_M386) +#ifdef CONFIG_X86_BSWAP __asm__("bswap %0" : "=r" (x) : "0" (x)); #else __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */ diff --git a/include/asm-i386/checksum.h b/include/asm-i386/checksum.h index 8ec5f9c8d..addaea876 100644 --- a/include/asm-i386/checksum.h +++ b/include/asm-i386/checksum.h @@ -14,7 +14,7 @@ * * it's best to have buff aligned on a 32-bit boundary */ -unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); +asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); /* * the same as csum_partial, but copies from src while it @@ -24,8 +24,8 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) * better 64-bit) boundary */ -unsigned int csum_partial_copy_generic( const char *src, char *dst, int len, int sum, - int *src_err_ptr, int *dst_err_ptr); +asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, int len, int sum, + int *src_err_ptr, int *dst_err_ptr); /* * Note: when you get a NULL pointer exception here this means someone diff --git a/include/asm-i386/cobalt.h b/include/asm-i386/cobalt.h new file mode 100644 index 000000000..02c3b4ab3 --- /dev/null +++ b/include/asm-i386/cobalt.h @@ -0,0 +1,117 @@ +#include <linux/config.h> +#ifndef __I386_COBALT_H +#define __I386_COBALT_H + +/* + * Cobalt is the system ASIC on the SGI 320 and 540 Visual Workstations + */ + +#define CO_CPU_PHYS 0xc2000000 +#define CO_APIC_PHYS 0xc4000000 + +/* see set_fixmap() and asm/fixmap.h */ +#define CO_CPU_VADDR (fix_to_virt(FIX_CO_CPU)) +#define CO_APIC_VADDR (fix_to_virt(FIX_CO_APIC)) + +/* Cobalt CPU registers -- relative to CO_CPU_VADDR, use co_cpu_*() */ +#define CO_CPU_REV 0x08 +#define CO_CPU_CTRL 0x10 +#define CO_CPU_STAT 0x20 +#define CO_CPU_TIMEVAL 0x30 + +/* CO_CPU_CTRL bits */ +#define CO_CTRL_TIMERUN 0x04 /* 0 == disabled */ +#define CO_CTRL_TIMEMASK 0x08 /* 0 == unmasked */ + +/* CO_CPU_STATUS bits */ +#define CO_STAT_TIMEINTR 0x02 /* (r) 1 == int pend, (w) 0 == clear */ + +/* CO_CPU_TIMEVAL value */ +#define CO_TIME_HZ 100000000 /* Cobalt core rate */ + +/* Cobalt APIC registers -- relative to CO_APIC_VADDR, use co_apic_*() */ +#define CO_APIC_HI(n) (((n) * 0x10) + 4) +#define CO_APIC_LO(n) ((n) * 0x10) +#define CO_APIC_ID 0x0ffc + +/* CO_APIC_ID bits */ +#define CO_APIC_ENABLE 0x00000100 + +/* CO_APIC_LO bits */ +#define CO_APIC_LEVEL 0x08000 /* 0 = edge */ + +/* + * Where things are physically wired to Cobalt + * #defines with no board _<type>_<rev>_ are common to all (thus far) + */ +#define CO_APIC_0_5_IDE0 5 +#define CO_APIC_0_5_SERIAL 13 /* XXX not really...h/w bug! */ +#define CO_APIC_0_5_PARLL 4 +#define CO_APIC_0_5_FLOPPY 6 + +#define CO_APIC_0_6_IDE0 4 +#define CO_APIC_0_6_USB 7 /* PIIX4 USB */ + +#define CO_APIC_1_2_IDE0 4 + +#define CO_APIC_0_5_IDE1 2 +#define CO_APIC_0_6_IDE1 2 + +/* XXX */ +#define CO_APIC_IDE0 CO_APIC_0_5_IDE0 +#define CO_APIC_IDE1 CO_APIC_0_5_IDE1 +#define CO_APIC_SERIAL CO_APIC_0_5_SERIAL +/* XXX */ + +#define CO_APIC_ENET 3 /* Lithium PCI Bridge A, Device 3 */ +#define CO_APIC_8259 12 /* serial, floppy, par-l-l, audio */ + +#define CO_APIC_VIDOUT0 16 +#define CO_APIC_VIDOUT1 17 +#define CO_APIC_VIDIN0 18 +#define CO_APIC_VIDIN1 19 + +#define CO_APIC_CPU 28 /* Timer and Cache interrupt */ + +/* + * This is the "irq" arg to request_irq(), just a unique cookie. + */ +#define CO_IRQ_TIMER 0 +#define CO_IRQ_ENET 3 +#define CO_IRQ_SERIAL 4 +#define CO_IRQ_FLOPPY 6 /* Same as drivers/block/floppy.c:FLOPPY_IRQ */ +#define CO_IRQ_PARLL 7 +#define CO_IRQ_POWER 9 +#define CO_IRQ_IDE 14 +#define CO_IRQ_8259 12 + +#ifdef CONFIG_X86_VISWS_APIC +extern __inline void co_cpu_write(unsigned long reg, unsigned long v) +{ + *((volatile unsigned long *)(CO_CPU_VADDR+reg))=v; +} + +extern __inline unsigned long co_cpu_read(unsigned long reg) +{ + return *((volatile unsigned long *)(CO_CPU_VADDR+reg)); +} + +extern __inline void co_apic_write(unsigned long reg, unsigned long v) +{ + *((volatile unsigned long *)(CO_APIC_VADDR+reg))=v; +} + +extern __inline unsigned long co_apic_read(unsigned long reg) +{ + return *((volatile unsigned long *)(CO_APIC_VADDR+reg)); +} +#endif + +extern char visws_board_type; + +#define VISWS_320 0 +#define VISWS_540 1 + +extern char visws_board_rev; + +#endif diff --git a/include/asm-i386/dma.h b/include/asm-i386/dma.h index 58f7bfc05..12e02b1d0 100644 --- a/include/asm-i386/dma.h +++ b/include/asm-i386/dma.h @@ -8,6 +8,7 @@ #ifndef _ASM_DMA_H #define _ASM_DMA_H +#include <linux/config.h> #include <asm/io.h> /* need byte IO */ #include <asm/spinlock.h> /* And spinlocks */ #include <linux/delay.h> @@ -131,6 +132,8 @@ #define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */ #define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */ +#define DMA_AUTOINIT 0x10 + extern spinlock_t dma_spin_lock; @@ -284,4 +287,11 @@ static __inline__ int get_dma_residue(unsigned int dmanr) extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */ extern void free_dma(unsigned int dmanr); /* release it again */ +/* From PCI */ + +#ifdef CONFIG_PCI_QUIRKS +extern int isa_dma_bridge_buggy; +#else +#define isa_dma_bridge_buggy (0) +#endif #endif /* _ASM_DMA_H */ diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h index 65a74c5cb..dacd01b99 100644 --- a/include/asm-i386/elf.h +++ b/include/asm-i386/elf.h @@ -32,8 +32,16 @@ typedef struct user_i387_struct elf_fpregset_t; This provides a mean for the dynamic linker to call DT_FINI functions for shared libraries that have been loaded before the code runs. - A value of 0 tells we have no such handler. */ -#define ELF_PLAT_INIT(_r) _r->edx = 0 + A value of 0 tells we have no such handler. + + We might as well make sure everything else is cleared too (except for %esp), + just to make things more deterministic. + */ +#define ELF_PLAT_INIT(_r) do { \ + _r->ebx = 0; _r->ecx = 0; _r->edx = 0; \ + _r->esi = 0; _r->edi = 0; _r->ebp = 0; \ + _r->eax = 0; \ +} while (0) #define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h index ae6f062dd..c259a45ee 100644 --- a/include/asm-i386/fixmap.h +++ b/include/asm-i386/fixmap.h @@ -11,8 +11,9 @@ #ifndef _ASM_FIXMAP_H #define _ASM_FIXMAP_H -#include <asm/page.h> +#include <linux/config.h> #include <linux/kernel.h> +#include <asm/page.h> /* * Here we define all the compile-time 'special' virtual @@ -40,10 +41,18 @@ * fix-mapped? */ enum fixed_addresses { -#ifdef __SMP__ - FIX_APIC_BASE, +#ifdef CONFIG_X86_LOCAL_APIC + FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ +#endif +#ifdef CONFIG_X86_IO_APIC FIX_IO_APIC_BASE, #endif +#ifdef CONFIG_X86_VISWS_APIC + FIX_CO_CPU, /* Cobalt timer */ + FIX_CO_APIC, /* Cobalt APIC Redirection Table */ + FIX_LI_PCIA, /* Lithium PCI Bridge A */ + FIX_LI_PCIB, /* Lithium PCI Bridge B */ +#endif __end_of_fixed_addresses }; diff --git a/include/asm-i386/i82489.h b/include/asm-i386/i82489.h index 8c36eb273..76f580bde 100644 --- a/include/asm-i386/i82489.h +++ b/include/asm-i386/i82489.h @@ -6,6 +6,7 @@ * * Alan Cox <Alan.Cox@linux.org>, 1995. */ +#define APIC_PHYS_BASE 0xfee00000 /* IA s/w dev Vol 3, Section 7.4 */ #define APIC_ID 0x20 #define GET_APIC_ID(x) (((x)>>24)&0x0F) @@ -13,12 +14,15 @@ #define APIC_TASKPRI 0x80 #define APIC_TPRI_MASK 0xFF #define APIC_ARBPRI 0x90 +#define APIC_ARBPRI_MASK 0xFF #define APIC_PROCPRI 0xA0 #define APIC_EOI 0xB0 #define APIC_EIO_ACK 0x0 /* Write this to the EOI register */ #define APIC_RRR 0xC0 #define APIC_LDR 0xD0 +#define APIC_LDR_MASK (0xFF<<24) #define GET_APIC_LOGICAL_ID(x) (((x)>>24)&0xFF) +#define SET_APIC_LOGICAL_ID(x) (((x)<<24)) #define APIC_DFR 0xE0 #define GET_APIC_DFR(x) (((x)>>28)&0x0F) #define SET_APIC_DFR(x) ((x)<<28) @@ -35,7 +39,6 @@ #define APIC_ESR_RECVILL 0x00040 #define APIC_ESR_ILLREGA 0x00080 #define APIC_ICR 0x300 -#define APIC_DEST_FIELD 0x00000 #define APIC_DEST_SELF 0x40000 #define APIC_DEST_ALLINC 0x80000 #define APIC_DEST_ALLBUT 0xC0000 @@ -85,4 +88,16 @@ #define APIC_TDR_DIV_64 0x9 #define APIC_TDR_DIV_128 0xA +#define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) + +extern __inline void apic_write(unsigned long reg, unsigned long v) +{ + *((volatile unsigned long *)(APIC_BASE+reg))=v; +} + +extern __inline unsigned long apic_read(unsigned long reg) +{ + return *((volatile unsigned long *)(APIC_BASE+reg)); +} + #endif diff --git a/include/asm-i386/init.h b/include/asm-i386/init.h index 83215545f..7618c0054 100644 --- a/include/asm-i386/init.h +++ b/include/asm-i386/init.h @@ -11,4 +11,7 @@ #define __FINIT .previous #define __INITDATA .section ".data.init",#alloc,#write +#define __cacheline_aligned __attribute__ \ + ((__section__ (".data.cacheline_aligned"))) + #endif diff --git a/include/asm-i386/ipc.h b/include/asm-i386/ipc.h index f368d14c8..36f43063a 100644 --- a/include/asm-i386/ipc.h +++ b/include/asm-i386/ipc.h @@ -23,6 +23,9 @@ struct ipc_kludge { #define SHMGET 23 #define SHMCTL 24 +/* Used by the DIPC package, try and avoid reusing it */ +#define DIPC 25 + #define IPCCALL(version,op) ((version)<<16 | (op)) #endif diff --git a/include/asm-i386/keyboard.h b/include/asm-i386/keyboard.h index a30e49946..fd3009724 100644 --- a/include/asm-i386/keyboard.h +++ b/include/asm-i386/keyboard.h @@ -3,7 +3,7 @@ * * Created 3 Nov 1996 by Geert Uytterhoeven * - * $Id: keyboard.h,v 1.6 1998/10/28 12:40:06 ralf Exp $ + * $Id: keyboard.h,v 1.7 1999/02/01 15:51:16 ralf Exp $ */ /* @@ -15,7 +15,6 @@ #ifdef __KERNEL__ -#include <linux/config.h> #include <linux/kernel.h> #include <asm/io.h> @@ -64,19 +63,8 @@ extern unsigned char pckbd_sysrq_xlate[128]; #define AUX_IRQ 12 -#ifdef CONFIG_MCA - -#define aux_request_irq(handler, dev_id) request_irq(AUX_IRQ, handler, \ - MCA_bus ? SA_SHIRQ : 0, "PS/2 Mouse", dev_id) -#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id) - -#else /* !defined(CONFIG_MCA) */ - -#define aux_request_irq(handler, dev_id) request_irq(AUX_IRQ, handler, 0, \ - "PS/2 Mouse", NULL) -#define aux_free_irq(dev_id) free_irq(AUX_IRQ, NULL) - -#endif +#define aux_free_irq(dev_id) free_irq(AUX_IRQ, AUX_DEV) +request_irq(AUX_IRQ, keyboard_interrupt, SA_SHIRQ, "PS/2 Mouse", AUX_DEV) #endif /* __KERNEL__ */ #endif /* __ASM_i386_KEYBOARD_H */ diff --git a/include/asm-i386/lithium.h b/include/asm-i386/lithium.h new file mode 100644 index 000000000..253472ee1 --- /dev/null +++ b/include/asm-i386/lithium.h @@ -0,0 +1,45 @@ +#ifndef __I386_LITHIUM_H +#define __I386_LITHIUM_H + +#include <linux/config.h> + +/* + * Lithium is the I/O ASIC on the SGI 320 and 540 Visual Workstations + */ + +#define LI_PCI_A_PHYS 0xfc000000 /* Enet is dev 3 */ +#define LI_PCI_B_PHYS 0xfd000000 /* PIIX4 is here */ + +/* see set_fixmap() and asm/fixmap.h */ +#define LI_PCIA_VADDR (fix_to_virt(FIX_LI_PCIA)) +#define LI_PCIB_VADDR (fix_to_virt(FIX_LI_PCIB)) + +/* Not a standard PCI? (not in linux/pci.h) */ +#define LI_PCI_BUSNUM 0x44 /* lo8: primary, hi8: sub */ +#define LI_PCI_INTEN 0x46 + +#ifdef CONFIG_X86_VISWS_APIC +/* More special purpose macros... */ +extern __inline void li_pcia_write16(unsigned long reg, unsigned short v) +{ + *((volatile unsigned short *)(LI_PCIA_VADDR+reg))=v; +} + +extern __inline unsigned short li_pcia_read16(unsigned long reg) +{ + return *((volatile unsigned short *)(LI_PCIA_VADDR+reg)); +} + +extern __inline void li_pcib_write16(unsigned long reg, unsigned short v) +{ + *((volatile unsigned short *)(LI_PCIB_VADDR+reg))=v; +} + +extern __inline unsigned short li_pcib_read16(unsigned long reg) +{ + return *((volatile unsigned short *)(LI_PCIB_VADDR+reg)); +} +#endif + +#endif + diff --git a/include/asm-i386/locks.h b/include/asm-i386/locks.h index a075e92bd..a46015d21 100644 --- a/include/asm-i386/locks.h +++ b/include/asm-i386/locks.h @@ -62,7 +62,7 @@ extern __inline__ int prim_spin_unlock(struct spinlock *sp) not be safe this way */ if(!--sp->users) { - lock_clear_bit(0,&sp->lock);sp->cpu= NO_PROC_ID; + sp->cpu= NO_PROC_ID;lock_clear_bit(0,&sp->lock); return 1; } return 0; @@ -102,15 +102,17 @@ extern __inline__ void spinlock(struct spinlock *sp) extern __inline__ void spinunlock(struct spinlock *sp) { + int pri; if(current->lock_order!=sp->priority) panic("lock release order violation %s (%d)\n", sp->name, current->lock_order); + pri=sp->oldpri; if(prim_spin_unlock(sp)) { /* * Update the debugging lock priority chain. We dumped * our last right to the lock. */ - current->lock_order=sp->oldpri; + current->lock_order=sp->pri; } } diff --git a/include/asm-i386/mca_dma.h b/include/asm-i386/mca_dma.h new file mode 100644 index 000000000..791152f3d --- /dev/null +++ b/include/asm-i386/mca_dma.h @@ -0,0 +1,126 @@ +#ifndef MCA_DMA_H +#define MCA_DMA_H + +#include <asm/io.h> +#include <linux/ioport.h> + +/* + * Microchannel specific DMA stuff. DMA on an MCA machine is fairly similar to + * standard PC dma, but it certainly has its quirks. DMA register addresses + * are in a different place and there are some added functions. Most of this + * should be pretty obvious on inspection. Note that the user must divide + * count by 2 when using 16-bit dma; that is not handled by these functions. + * + * Ramen Noodles are yummy. + * + * 1998 Tymm Twillman <tymm@computer.org> + */ + +/* + * Registers that are used by the DMA controller; FN is the function register + * (tell the controller what to do) and EXE is the execution register (how + * to do it) + */ + +#define MCA_DMA_REG_FN 0x18 +#define MCA_DMA_REG_EXE 0x1A + +/* + * Functions that the DMA controller can do + */ + +#define MCA_DMA_FN_SET_IO 0x00 +#define MCA_DMA_FN_SET_ADDR 0x20 +#define MCA_DMA_FN_GET_ADDR 0x30 +#define MCA_DMA_FN_SET_COUNT 0x40 +#define MCA_DMA_FN_GET_COUNT 0x50 +#define MCA_DMA_FN_GET_STATUS 0x60 +#define MCA_DMA_FN_SET_MODE 0x70 +#define MCA_DMA_FN_SET_ARBUS 0x80 +#define MCA_DMA_FN_MASK 0x90 +#define MCA_DMA_FN_RESET_MASK 0xA0 +#define MCA_DMA_FN_MASTER_CLEAR 0xD0 + +/* + * Modes (used by setting MCA_DMA_FN_MODE in the function register) + * + * Note that the MODE_READ is read from memory (write to device), and + * MODE_WRITE is vice-versa. + */ + +#define MCA_DMA_MODE_XFER 0x04 /* read by default */ +#define MCA_DMA_MODE_READ 0x04 /* same as XFER */ +#define MCA_DMA_MODE_WRITE 0x08 /* OR with MODE_XFER to use */ +#define MCA_DMA_MODE_IO 0x01 /* DMA from IO register */ +#define MCA_DMA_MODE_16 0x40 /* 16 bit xfers */ + + + +static __inline__ void mca_enable_dma(unsigned int dmanr) +{ + outb(MCA_DMA_FN_RESET_MASK | dmanr, MCA_DMA_REG_FN); +} + +static __inline__ void mca_disable_dma(unsigned int dmanr) +{ + outb(MCA_DMA_FN_MASK | dmanr, MCA_DMA_REG_FN); +} + +static __inline__ void mca_set_dma_addr(unsigned int dmanr, unsigned int a) +{ + outb(MCA_DMA_FN_SET_ADDR | dmanr, MCA_DMA_REG_FN); + outb(a & 0xff, MCA_DMA_REG_EXE); + outb((a >> 8) & 0xff, MCA_DMA_REG_EXE); + outb((a >> 16) & 0xff, MCA_DMA_REG_EXE); +} + +static __inline__ unsigned int mca_get_dma_addr(unsigned int dmanr) +{ + unsigned int addr; + + outb(MCA_DMA_FN_GET_ADDR | dmanr, MCA_DMA_REG_FN); + addr = inb(MCA_DMA_REG_EXE); + addr |= inb(MCA_DMA_REG_EXE) << 8; + addr |= inb(MCA_DMA_REG_EXE) << 16; + + return addr; +} + +static __inline__ void mca_set_dma_count(unsigned int dmanr, unsigned int count) +{ + count--; /* transfers one more than count -- correct for this */ + + outb(MCA_DMA_FN_SET_COUNT | dmanr, MCA_DMA_REG_FN); + outb(count & 0xff, MCA_DMA_REG_EXE); + outb((count >> 8) & 0xff, MCA_DMA_REG_EXE); +} + +static __inline__ unsigned int mca_get_dma_residue(unsigned int dmanr) +{ + unsigned short count; + + outb(MCA_DMA_FN_GET_COUNT | dmanr, MCA_DMA_REG_FN); + count = 1 + inb(MCA_DMA_REG_EXE); + count += inb(MCA_DMA_REG_EXE) << 8; + + return count; +} + +static __inline__ void mca_set_dma_io(unsigned int dmanr, unsigned int io_addr) +{ + /* + * DMA from a port address -- set the io address + */ + + outb(MCA_DMA_FN_SET_IO | dmanr, MCA_DMA_REG_FN); + outb(io_addr & 0xff, MCA_DMA_REG_EXE); + outb((io_addr >> 8) & 0xff, MCA_DMA_REG_EXE); +} + +static __inline__ void mca_set_dma_mode(unsigned int dmanr, unsigned int mode) +{ + outb(MCA_DMA_FN_SET_MODE | dmanr, MCA_DMA_REG_FN); + outb(mode, MCA_DMA_REG_EXE); +} + +#endif MCA_DMA_H diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h index e9952bd8e..1694ed16b 100644 --- a/include/asm-i386/page.h +++ b/include/asm-i386/page.h @@ -69,10 +69,9 @@ typedef unsigned long pgprot_t; * you want to use more physical memory, change this define. * * For example, if you have 2GB worth of physical memory, you - * could change this define to 0x70000000, which gives the - * kernel slightly more than 2GB of virtual memory (enough to - * map all your physical memory + a bit extra for various - * io-memory mappings) + * could change this define to 0x80000000, which gives the + * kernel 2GB of virtual memory (enough to most of your physical memory + * as the kernel needs a bit extra for various io-memory mappings) * * IF YOU CHANGE THIS, PLEASE ALSO CHANGE * diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index e0cd4b361..257a0e99d 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -41,7 +41,7 @@ #define __flush_tlb() \ do { unsigned long tmpreg; __asm__ __volatile__("movl %%cr3,%0\n\tmovl %0,%%cr3":"=r" (tmpreg) : :"memory"); } while (0) -#ifdef CONFIG_M386 +#ifndef CONFIG_X86_INVLPG #define __flush_tlb_one(addr) flush_tlb() #else #define __flush_tlb_one(addr) \ @@ -218,18 +218,16 @@ static inline void flush_tlb_range(struct mm_struct *mm, * memory. */ #define _PAGE_PRESENT 0x001 -#define _PAGE_PROTNONE 0x002 /* If not present */ -#define _PAGE_RW 0x002 /* If present */ +#define _PAGE_RW 0x002 #define _PAGE_USER 0x004 #define _PAGE_WT 0x008 #define _PAGE_PCD 0x010 #define _PAGE_ACCESSED 0x020 #define _PAGE_DIRTY 0x040 -#define _PAGE_4M 0x080 /* 4 MB page, Pentium+.. */ +#define _PAGE_4M 0x080 /* 4 MB page, Pentium+, if present.. */ #define _PAGE_GLOBAL 0x100 /* Global TLB entry PPro+ */ -#define _PAGE_READABLE (_PAGE_PRESENT) -#define _PAGE_WRITABLE (_PAGE_PRESENT | _PAGE_RW) +#define _PAGE_PROTNONE 0x080 /* If not present */ #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) @@ -340,21 +338,17 @@ extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } extern inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 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; } - -/* - * These are harder, as writability is two bits, not one.. - */ -extern inline int pte_write(pte_t pte) { return (pte_val(pte) & _PAGE_WRITABLE) == _PAGE_WRITABLE; } -extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~((pte_val(pte) & _PAGE_PRESENT) << 1); return pte; } extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pte; } /* @@ -589,9 +583,9 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma, { } -#define SWP_TYPE(entry) (((entry) >> 2) & 0x3f) +#define SWP_TYPE(entry) (((entry) >> 1) & 0x3f) #define SWP_OFFSET(entry) ((entry) >> 8) -#define SWP_ENTRY(type,offset) (((type) << 2) | ((offset) << 8)) +#define SWP_ENTRY(type,offset) (((type) << 1) | ((offset) << 8)) #define module_map vmalloc #define module_unmap vfree diff --git a/include/asm-i386/posix_types.h b/include/asm-i386/posix_types.h index 6413683c2..0a794e306 100644 --- a/include/asm-i386/posix_types.h +++ b/include/asm-i386/posix_types.h @@ -59,10 +59,14 @@ typedef struct { #undef __FD_ZERO #define __FD_ZERO(fdsetp) \ - __asm__ __volatile__("cld ; rep ; stosl" \ - :"=m" (*(__kernel_fd_set *) (fdsetp)) \ - :"a" (0), "c" (__FDSET_LONGS), \ - "D" ((__kernel_fd_set *) (fdsetp)) :"cx","di") +do { \ + int __d0, __d1; \ + __asm__ __volatile__("cld ; rep ; stosl" \ + :"=m" (*(__kernel_fd_set *) (fdsetp)), \ + "=&c" (__d0), "=&D" (__d1) \ + :"a" (0), "1" (__FDSET_LONGS), \ + "2" ((__kernel_fd_set *) (fdsetp)) : "memory"); \ +} while (0) #endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 1b1e97d73..9dd4f9df2 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -100,6 +100,7 @@ extern char ignore_irq13; extern void identify_cpu(struct cpuinfo_x86 *); extern void print_cpu_info(struct cpuinfo_x86 *); +extern void dodgy_tsc(void); /* * Generic CPUID function @@ -237,7 +238,7 @@ struct thread_struct { }; #define INIT_MMAP \ -{ &init_mm, 0, 0, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } +{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } #define INIT_TSS { \ 0,0, /* back_link, __blh */ \ @@ -280,6 +281,7 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); /* Copy and release all segment info associated with a VM */ extern void copy_segments(int nr, struct task_struct *p, struct mm_struct * mm); extern void release_segments(struct mm_struct * mm); +extern void forget_segments(void); /* * FPU lazy state save handling.. diff --git a/include/asm-i386/semaphore.h b/include/asm-i386/semaphore.h index 2cb1b891c..d78970da0 100644 --- a/include/asm-i386/semaphore.h +++ b/include/asm-i386/semaphore.h @@ -23,14 +23,49 @@ #include <asm/atomic.h> #include <asm/spinlock.h> +/* + * Semaphores are recursive: we allow the holder process + * to recursively do down() operations on a semaphore that + * the process already owns. In order to do that, we need + * to keep a semaphore-local copy of the owner and the + * "depth of ownership". + * + * NOTE! Nasty memory ordering rules: + * - "owner" and "owner_count" may only be modified once you hold the + * lock. + * - "owner_count" must be written _after_ modifying owner, and + * must be read _before_ reading owner. There must be appropriate + * write and read barriers to enforce this. + * + * On an x86, writes are always ordered, so the only enformcement + * necessary is to make sure that the owner_depth is written after + * the owner value in program order. + * + * For read ordering guarantees, the semaphore wake_lock spinlock + * is already giving us ordering guarantees. + * + * Other (saner) architectures would use "wmb()" and "rmb()" to + * do this in a more obvious manner. + */ struct semaphore { atomic_t count; + unsigned long owner, owner_depth; int waking; struct wait_queue * wait; }; -#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), 0, NULL }) -#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), 0, NULL }) +/* + * Because we want the non-contention case to be + * fast, we save the stack pointer into the "owner" + * field, and to get the true task pointer we have + * to do the bit masking. That moves the masking + * operation into the slow path. + */ +#define semaphore_owner(sem) \ + ((struct task_struct *)((2*PAGE_MASK) & (sem)->owner)) + +#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), 0, 0, 0, NULL }) +#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), 0, 1, 0, NULL }) asmlinkage void __down_failed(void /* special register calling convention */); asmlinkage int __down_failed_interruptible(void /* params in registers */); @@ -49,11 +84,6 @@ extern spinlock_t semaphore_wake_lock; * * This is trivially done with load_locked/store_cond, * but on the x86 we need an external synchronizer. - * Currently this is just the global interrupt lock, - * bah. Go for a smaller spinlock some day. - * - * (On the other hand this shouldn't be in any critical - * path, so..) */ static inline void wake_one_more(struct semaphore * sem) { @@ -64,13 +94,53 @@ static inline void wake_one_more(struct semaphore * sem) spin_unlock_irqrestore(&semaphore_wake_lock, flags); } -static inline int waking_non_zero(struct semaphore *sem) +/* + * NOTE NOTE NOTE! + * + * We read owner-count _before_ getting the semaphore. This + * is important, because the semaphore also acts as a memory + * ordering point between reading owner_depth and reading + * the owner. + * + * Why is this necessary? The "owner_depth" essentially protects + * us from using stale owner information - in the case that this + * process was the previous owner but somebody else is racing to + * aquire the semaphore, the only way we can see ourselves as an + * owner is with "owner_depth" of zero (so that we know to avoid + * the stale value). + * + * In the non-race case (where we really _are_ the owner), there + * is not going to be any question about what owner_depth is. + * + * In the race case, the race winner will not even get here, because + * it will have successfully gotten the semaphore with the locked + * decrement operation. + * + * Basically, we have two values, and we cannot guarantee that either + * is really up-to-date until we have aquired the semaphore. But we + * _can_ depend on a ordering between the two values, so we can use + * one of them to determine whether we can trust the other: + * + * Cases: + * - owner_depth == zero: ignore the semaphore owner, because it + * cannot possibly be us. Somebody else may be in the process + * of modifying it and the zero may be "stale", but it sure isn't + * going to say that "we" are the owner anyway, so who cares? + * - owner_depth is non-zero. That means that even if somebody + * else wrote the non-zero count value, the write ordering requriement + * means that they will have written themselves as the owner, so + * if we now see ourselves as an owner we can trust it to be true. + */ +static inline int waking_non_zero(struct semaphore *sem, struct task_struct *tsk) { unsigned long flags; + unsigned long owner_depth = sem->owner_depth; int ret = 0; spin_lock_irqsave(&semaphore_wake_lock, flags); - if (sem->waking > 0) { + if (sem->waking > 0 || (owner_depth && semaphore_owner(sem) == tsk)) { + sem->owner = (unsigned long) tsk; + sem->owner_depth++; /* Don't use the possibly stale value */ sem->waking--; ret = 1; } @@ -91,7 +161,9 @@ extern inline void down(struct semaphore * sem) "lock ; " #endif "decl 0(%0)\n\t" - "js 2f\n" + "js 2f\n\t" + "movl %%esp,4(%0)\n" + "movl $1,8(%0)\n\t" "1:\n" ".section .text.lock,\"ax\"\n" "2:\tpushl $1b\n\t" @@ -113,6 +185,8 @@ extern inline int down_interruptible(struct semaphore * sem) #endif "decl 0(%1)\n\t" "js 2f\n\t" + "movl %%esp,4(%1)\n\t" + "movl $1,8(%1)\n\t" "xorl %0,%0\n" "1:\n" ".section .text.lock,\"ax\"\n" @@ -136,6 +210,7 @@ extern inline void up(struct semaphore * sem) { __asm__ __volatile__( "# atomic up operation\n\t" + "decl 8(%0)\n\t" #ifdef __SMP__ "lock ; " #endif diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h index 33dbab5bf..ec24476ae 100644 --- a/include/asm-i386/smp.h +++ b/include/asm-i386/smp.h @@ -1,12 +1,20 @@ #ifndef __ASM_SMP_H #define __ASM_SMP_H -#ifdef __SMP__ +/* + * We need the APIC definitions automatically as part of 'smp.h' + */ +#include <linux/config.h> +#ifdef CONFIG_X86_LOCAL_APIC #ifndef ASSEMBLY - +#include <asm/fixmap.h> #include <asm/i82489.h> #include <asm/bitops.h> -#include <asm/fixmap.h> +#endif +#endif + +#ifdef __SMP__ +#ifndef ASSEMBLY #include <linux/tasks.h> #include <linux/ptrace.h> @@ -155,10 +163,11 @@ struct mpc_config_intlocal */ extern int smp_found_config; -extern int smp_scan_config(unsigned long, unsigned long); +extern void init_smp_config(void); extern unsigned long smp_alloc_memory(unsigned long mem_base); extern unsigned char boot_cpu_id; extern unsigned long cpu_present_map; +extern unsigned long cpu_online_map; extern volatile int cpu_number_map[NR_CPUS]; extern volatile unsigned long smp_invalidate_needed; extern void smp_flush_tlb(void); @@ -185,29 +194,6 @@ extern inline int cpu_logical_map(int cpu) extern void smp_callin(void); extern void smp_boot_cpus(void); extern void smp_store_cpu_info(int id); /* Store per CPU info (like the initial udelay numbers */ -extern void smp_message_pass(int target, int msg, unsigned long data, int wait); - -extern volatile unsigned long smp_proc_in_lock[NR_CPUS]; /* for computing process time */ -extern volatile int smp_process_available; - -/* - * APIC handlers: Note according to the Intel specification update - * you should put reads between APIC writes. - * Intel Pentium processor specification update [11AP, pg 64] - * "Back to Back Assertions of HOLD May Cause Lost APIC Write Cycle" - */ - -#define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) - -extern __inline void apic_write(unsigned long reg, unsigned long v) -{ - *((volatile unsigned long *)(APIC_BASE+reg))=v; -} - -extern __inline unsigned long apic_read(unsigned long reg) -{ - return *((volatile unsigned long *)(APIC_BASE+reg)); -} /* * This function is needed by all SMP systems. It must _always_ be valid @@ -237,9 +223,7 @@ extern __inline int hard_smp_processor_id(void) * processes are run. */ -#define PROC_CHANGE_PENALTY 20 /* Schedule penalty */ +#define PROC_CHANGE_PENALTY 15 /* Schedule penalty */ -#define SMP_FROM_INT 1 -#define SMP_FROM_SYSCALL 2 #endif #endif diff --git a/include/asm-i386/smplock.h b/include/asm-i386/smplock.h index 3bb933e42..73c9cf927 100644 --- a/include/asm-i386/smplock.h +++ b/include/asm-i386/smplock.h @@ -51,7 +51,7 @@ extern __inline__ void unlock_kernel(void) { __asm__ __volatile__( "decl %1\n\t" - "jns 9f\n" + "jns 9f\n\t" spin_unlock_string "\n9:" :"=m" (__dummy_lock(&kernel_flag)), diff --git a/include/asm-i386/softirq.h b/include/asm-i386/softirq.h index c96481626..a0e4d76b6 100644 --- a/include/asm-i386/softirq.h +++ b/include/asm-i386/softirq.h @@ -12,14 +12,15 @@ extern unsigned int local_bh_count[NR_CPUS]; extern inline void init_bh(int nr, void (*routine)(void)) { bh_base[nr] = routine; - bh_mask_count[nr] = 0; + atomic_set(&bh_mask_count[nr], 0); bh_mask |= 1 << nr; } extern inline void remove_bh(int nr) { - bh_base[nr] = NULL; bh_mask &= ~(1 << nr); + mb(); + bh_base[nr] = NULL; } extern inline void mark_bh(int nr) @@ -97,13 +98,13 @@ extern inline void end_bh_atomic(void) extern inline void disable_bh(int nr) { bh_mask &= ~(1 << nr); - bh_mask_count[nr]++; + atomic_inc(&bh_mask_count[nr]); synchronize_bh(); } extern inline void enable_bh(int nr) { - if (!--bh_mask_count[nr]) + if (atomic_dec_and_test(&bh_mask_count[nr])) bh_mask |= 1 << nr; } diff --git a/include/asm-i386/string.h b/include/asm-i386/string.h index 65d72fabf..48b119895 100644 --- a/include/asm-i386/string.h +++ b/include/asm-i386/string.h @@ -30,20 +30,22 @@ #define __HAVE_ARCH_STRCPY 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" "jne 1b" - : /* no output */ - :"S" (src),"D" (dest):"si","di","ax","memory"); + : "=&S" (d0), "=&D" (d1), "=&a" (d2) + :"0" (src),"1" (dest) : "memory"); return dest; } #define __HAVE_ARCH_STRNCPY 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" @@ -55,14 +57,15 @@ __asm__ __volatile__( "rep\n\t" "stosb\n" "2:" - : /* no output */ - :"S" (src),"D" (dest),"c" (count):"si","di","ax","cx","memory"); + : "=&S" (d0), "=&D" (d1), "=&c" (d2), "=&a" (d3) + :"0" (src),"1" (dest),"2" (count) : "memory"); return dest; } #define __HAVE_ARCH_STRCAT extern inline char * strcat(char * dest,const char * src) { +int d0, d1, d2, d3; __asm__ __volatile__( "cld\n\t" "repne\n\t" @@ -72,20 +75,21 @@ __asm__ __volatile__( "stosb\n\t" "testb %%al,%%al\n\t" "jne 1b" - : /* no output */ - :"S" (src),"D" (dest),"a" (0),"c" (0xffffffff):"si","di","ax","cx"); + : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3) + : "0" (src), "1" (dest), "2" (0), "3" (0xffffffff):"memory"); return dest; } #define __HAVE_ARCH_STRNCAT 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" - "movl %4,%3\n" + "movl %8,%3\n" "1:\tdecl %3\n\t" "js 2f\n\t" "lodsb\n\t" @@ -94,15 +98,16 @@ __asm__ __volatile__( "jne 1b\n" "2:\txorl %2,%2\n\t" "stosb" - : /* no output */ - :"S" (src),"D" (dest),"a" (0),"c" (0xffffffff),"g" (count) - :"si","di","ax","cx","memory"); + : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3) + : "0" (src),"1" (dest),"2" (0),"3" (0xffffffff), "g" (count) + : "memory"); return dest; } #define __HAVE_ARCH_STRCMP extern inline int strcmp(const char * cs,const char * ct) { +int d0, d1; register int __res; __asm__ __volatile__( "cld\n" @@ -116,7 +121,8 @@ __asm__ __volatile__( "2:\tsbbl %%eax,%%eax\n\t" "orb $1,%%al\n" "3:" - :"=a" (__res):"S" (cs),"D" (ct):"si","di"); + :"=a" (__res), "=&S" (d0), "=&D" (d1) + :"1" (cs),"2" (ct)); return __res; } @@ -124,6 +130,7 @@ return __res; 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" @@ -138,13 +145,15 @@ __asm__ __volatile__( "3:\tsbbl %%eax,%%eax\n\t" "orb $1,%%al\n" "4:" - :"=a" (__res):"S" (cs),"D" (ct),"c" (count):"si","di","cx"); + :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2) + :"1" (cs),"2" (ct),"3" (count)); return __res; } #define __HAVE_ARCH_STRCHR extern inline char * strchr(const char * s, int c) { +int d0; register char * __res; __asm__ __volatile__( "cld\n\t" @@ -157,13 +166,14 @@ __asm__ __volatile__( "movl $1,%1\n" "2:\tmovl %1,%0\n\t" "decl %0" - :"=a" (__res):"S" (s),"0" (c):"si"); + :"=a" (__res), "=&S" (d0) : "1" (s),"0" (c)); return __res; } #define __HAVE_ARCH_STRRCHR extern inline char * strrchr(const char * s, int c) { +int d0, d1; register char * __res; __asm__ __volatile__( "cld\n\t" @@ -174,123 +184,14 @@ __asm__ __volatile__( "leal -1(%%esi),%0\n" "2:\ttestb %%al,%%al\n\t" "jne 1b" - :"=d" (__res):"0" (0),"S" (s),"a" (c):"ax","si"); -return __res; -} - -#define __HAVE_ARCH_STRSPN -extern inline size_t strspn(const char * cs, const char * ct) -{ -register char * __res; -__asm__ __volatile__( - "cld\n\t" - "movl %4,%%edi\n\t" - "repne\n\t" - "scasb\n\t" - "notl %%ecx\n\t" - "decl %%ecx\n\t" - "movl %%ecx,%%edx\n" - "1:\tlodsb\n\t" - "testb %%al,%%al\n\t" - "je 2f\n\t" - "movl %4,%%edi\n\t" - "movl %%edx,%%ecx\n\t" - "repne\n\t" - "scasb\n\t" - "je 1b\n" - "2:\tdecl %0" - :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) - :"ax","cx","dx","di"); -return __res-cs; -} - -#define __HAVE_ARCH_STRCSPN -extern inline size_t strcspn(const char * cs, const char * ct) -{ -register char * __res; -__asm__ __volatile__( - "cld\n\t" - "movl %4,%%edi\n\t" - "repne\n\t" - "scasb\n\t" - "notl %%ecx\n\t" - "decl %%ecx\n\t" - "movl %%ecx,%%edx\n" - "1:\tlodsb\n\t" - "testb %%al,%%al\n\t" - "je 2f\n\t" - "movl %4,%%edi\n\t" - "movl %%edx,%%ecx\n\t" - "repne\n\t" - "scasb\n\t" - "jne 1b\n" - "2:\tdecl %0" - :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) - :"ax","cx","dx","di"); -return __res-cs; -} - -#define __HAVE_ARCH_STRPBRK -extern inline char * strpbrk(const char * cs,const char * ct) -{ -register char * __res; -__asm__ __volatile__( - "cld\n\t" - "movl %4,%%edi\n\t" - "repne\n\t" - "scasb\n\t" - "notl %%ecx\n\t" - "decl %%ecx\n\t" - "movl %%ecx,%%edx\n" - "1:\tlodsb\n\t" - "testb %%al,%%al\n\t" - "je 2f\n\t" - "movl %4,%%edi\n\t" - "movl %%edx,%%ecx\n\t" - "repne\n\t" - "scasb\n\t" - "jne 1b\n\t" - "decl %0\n\t" - "jmp 3f\n" - "2:\txorl %0,%0\n" - "3:" - :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) - :"ax","cx","dx","di"); -return __res; -} - -#define __HAVE_ARCH_STRSTR -extern inline char * strstr(const char * cs,const char * ct) -{ -register char * __res; -__asm__ __volatile__( - "cld\n\t" \ - "movl %4,%%edi\n\t" - "repne\n\t" - "scasb\n\t" - "notl %%ecx\n\t" - "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */ - "movl %%ecx,%%edx\n" - "1:\tmovl %4,%%edi\n\t" - "movl %%esi,%%eax\n\t" - "movl %%edx,%%ecx\n\t" - "repe\n\t" - "cmpsb\n\t" - "je 2f\n\t" /* also works for empty string, see above */ - "xchgl %%eax,%%esi\n\t" - "incl %%esi\n\t" - "cmpb $0,-1(%%eax)\n\t" - "jne 1b\n\t" - "xorl %%eax,%%eax\n\t" - "2:" - :"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct) - :"cx","dx","di","si"); + :"=g" (__res), "=&S" (d0), "=&a" (d1) :"0" (0),"1" (s),"2" (c)); return __res; } #define __HAVE_ARCH_STRLEN extern inline size_t strlen(const char * s) { +int d0; register int __res; __asm__ __volatile__( "cld\n\t" @@ -298,86 +199,26 @@ __asm__ __volatile__( "scasb\n\t" "notl %0\n\t" "decl %0" - :"=c" (__res):"D" (s),"a" (0),"0" (0xffffffff):"di"); -return __res; -} - -#define __HAVE_ARCH_STRTOK -extern inline char * strtok(char * s,const char * ct) -{ -register char * __res; -__asm__ __volatile__( - "testl %1,%1\n\t" - "jne 1f\n\t" - "testl %0,%0\n\t" - "je 8f\n\t" - "movl %0,%1\n" - "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" - "notl %%ecx\n\t" - "decl %%ecx\n\t" - "je 7f\n\t" /* empty delimiter-string */ - "movl %%ecx,%%edx\n" - "2:\tlodsb\n\t" - "testb %%al,%%al\n\t" - "je 7f\n\t" - "movl %4,%%edi\n\t" - "movl %%edx,%%ecx\n\t" - "repne\n\t" - "scasb\n\t" - "je 2b\n\t" - "decl %1\n\t" - "cmpb $0,(%1)\n\t" - "je 7f\n\t" - "movl %1,%0\n" - "3:\tlodsb\n\t" - "testb %%al,%%al\n\t" - "je 5f\n\t" - "movl %4,%%edi\n\t" - "movl %%edx,%%ecx\n\t" - "repne\n\t" - "scasb\n\t" - "jne 3b\n\t" - "decl %1\n\t" - "cmpb $0,(%1)\n\t" - "je 5f\n\t" - "movb $0,(%1)\n\t" - "incl %1\n\t" - "jmp 6f\n" - "5:\txorl %1,%1\n" - "6:\tcmpb $0,(%0)\n\t" - "jne 7f\n\t" - "xorl %0,%0\n" - "7:\ttestl %0,%0\n\t" - "jne 8f\n\t" - "movl %0,%1\n" - "8:" - :"=b" (__res),"=S" (___strtok) - :"0" (___strtok),"1" (s),"g" (ct) - :"ax","cx","dx","di","memory"); + :"=c" (__res), "=&D" (d0) :"1" (s),"a" (0), "0" (0xffffffff)); return __res; } 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,%b1\n\t" + "testb $2,%b4\n\t" "je 1f\n\t" "movsw\n" - "1:\ttestb $1,%b1\n\t" + "1:\ttestb $1,%b4\n\t" "je 2f\n\t" "movsb\n" "2:" - : /* no output */ - :"c" (n/4), "q" (n),"D" ((long) to),"S" ((long) from) - : "cx","di","si","memory"); + : "=&c" (d0), "=&D" (d1), "=&S" (d2) + :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from) + : "memory"); return (to); } @@ -431,19 +272,23 @@ extern inline void * __constant_memcpy(void * to, const void * from, size_t n) return to; } #define COMMON(x) \ -__asm__("cld\n\t" \ +__asm__ __volatile__( \ + "cld\n\t" \ "rep ; movsl" \ x \ - : /* no outputs */ \ - : "c" (n/4),"D" ((long) to),"S" ((long) from) \ - : "cx","di","si","memory"); - + : "=&c" (d0), "=&D" (d1), "=&S" (d2) \ + : "0" (n/4),"1" ((long) to),"2" ((long) from) \ + : "memory"); +{ + int d0, d1, d2; switch (n % 4) { case 0: COMMON(""); return to; case 1: COMMON("\n\tmovsb"); return to; case 2: COMMON("\n\tmovsw"); return to; default: COMMON("\n\tmovsw\n\tmovsb"); return to; } +} + #undef COMMON } @@ -456,25 +301,26 @@ __asm__("cld\n\t" \ #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" - : /* no output */ - :"c" (n),"S" (src),"D" (dest) - :"cx","si","di"); + : "=&c" (d0), "=&S" (d1), "=&D" (d2) + :"0" (n),"1" (src),"2" (dest) + : "memory"); else __asm__ __volatile__( "std\n\t" "rep\n\t" "movsb\n\t" "cld" - : /* no output */ - :"c" (n), - "S" (n-1+(const char *)src), - "D" (n-1+(char *)dest) - :"cx","si","di","memory"); + : "=&c" (d0), "=&S" (d1), "=&D" (d2) + :"0" (n), + "1" (n-1+(const char *)src), + "2" (n-1+(char *)dest) + :"memory"); return dest; } @@ -483,6 +329,7 @@ return dest; #define __HAVE_ARCH_MEMCHR extern inline void * memchr(const void * cs,int c,size_t count) { +int d0; register void * __res; if (!count) return NULL; @@ -493,20 +340,20 @@ __asm__ __volatile__( "je 1f\n\t" "movl $1,%0\n" "1:\tdecl %0" - :"=D" (__res):"a" (c),"D" (cs),"c" (count) - :"cx"); + :"=D" (__res), "=&c" (d0) : "a" (c),"0" (cs),"1" (count)); return __res; } extern inline void * __memset_generic(void * s, char c,size_t count) { +int d0, d1; __asm__ __volatile__( "cld\n\t" "rep\n\t" "stosb" - : /* no output */ - :"a" (c),"D" (s),"c" (count) - :"cx","di","memory"); + : "=&c" (d0), "=&D" (d1) + :"a" (c),"1" (s),"0" (count) + :"memory"); return s; } @@ -520,19 +367,20 @@ return s; */ 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,%b1\n\t" + "testb $2,%b3\n\t" "je 1f\n\t" "stosw\n" - "1:\ttestb $1,%b1\n\t" + "1:\ttestb $1,%b3\n\t" "je 2f\n\t" "stosb\n" "2:" - : /* no output */ - :"a" (c), "q" (count), "c" (count/4), "D" ((long) s) - :"cx","di","memory"); + : "=&c" (d0), "=&D" (d1) + :"a" (c), "q" (count), "0" (count/4), "1" ((long) s) + :"memory"); return (s); } @@ -540,20 +388,20 @@ return (s); #define __HAVE_ARCH_STRNLEN extern inline size_t strnlen(const char * s, size_t count) { +int d0; register int __res; __asm__ __volatile__( - "movl %1,%0\n\t" + "movl %2,%0\n\t" "jmp 2f\n" "1:\tcmpb $0,(%0)\n\t" "je 3f\n\t" "incl %0\n" - "2:\tdecl %2\n\t" - "cmpl $-1,%2\n\t" + "2:\tdecl %1\n\t" + "cmpl $-1,%1\n\t" "jne 1b\n" - "3:\tsubl %1,%0" - :"=a" (__res) - :"c" (s),"d" (count) - :"dx"); + "3:\tsubl %2,%0" + :"=a" (__res), "=&d" (d0) + :"c" (s),"1" (count)); return __res; } /* end of additional stuff */ @@ -582,19 +430,22 @@ extern inline void * __constant_c_and_count_memset(void * s, unsigned long patte return s; } #define COMMON(x) \ -__asm__("cld\n\t" \ +__asm__ __volatile__("cld\n\t" \ "rep ; stosl" \ x \ - : /* no outputs */ \ - : "a" (pattern),"c" (count/4),"D" ((long) s) \ - : "cx","di","memory") - + : "=&c" (d0), "=&D" (d1) \ + : "a" (pattern),"0" (count/4),"1" ((long) s) \ + : "memory") +{ + int d0, d1; switch (count % 4) { case 0: COMMON(""); return s; case 1: COMMON("\n\tstosb"); return s; case 2: COMMON("\n\tstosw"); return s; default: COMMON("\n\tstosw\n\tstosb"); return s; } +} + #undef COMMON } diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 65012f648..6dd4b33f0 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -35,30 +35,30 @@ extern void FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *n "a" (prev), "d" (next)); \ } while (0) -#define _set_base(addr,base) \ -__asm__("movw %%dx,%0\n\t" \ +#define _set_base(addr,base) do { unsigned long __pr; \ +__asm__ __volatile__ ("movw %%dx,%1\n\t" \ "rorl $16,%%edx\n\t" \ - "movb %%dl,%1\n\t" \ - "movb %%dh,%2" \ - : /* no output */ \ + "movb %%dl,%2\n\t" \ + "movb %%dh,%3" \ + :"=&d" (__pr) \ :"m" (*((addr)+2)), \ "m" (*((addr)+4)), \ "m" (*((addr)+7)), \ - "d" (base) \ - :"dx") + "0" (base) \ + ); } while(0) -#define _set_limit(addr,limit) \ -__asm__("movw %%dx,%0\n\t" \ +#define _set_limit(addr,limit) do { unsigned long __lr; \ +__asm__ __volatile__ ("movw %%dx,%1\n\t" \ "rorl $16,%%edx\n\t" \ - "movb %1,%%dh\n\t" \ + "movb %2,%%dh\n\t" \ "andb $0xf0,%%dh\n\t" \ "orb %%dh,%%dl\n\t" \ - "movb %%dl,%1" \ - : /* no output */ \ + "movb %%dl,%2" \ + :"=&d" (__lr) \ :"m" (*(addr)), \ "m" (*((addr)+6)), \ - "d" (limit) \ - :"dx") + "0" (limit) \ + ); } while(0) #define set_base(ldt,base) _set_base( ((char *)&(ldt)) , (base) ) #define set_limit(ldt,limit) _set_limit( ((char *)&(ldt)) , ((limit)-1)>>12 ) @@ -165,8 +165,19 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size) * Force strict CPU ordering. * And yes, this is required on UP too when we're talking * to devices. + * + * For now, "wmb()" doesn't actually do anything, as all + * Intel CPU's follow what Intel calls a *Processor Order*, + * in which all writes are seen in the program order even + * outside the CPU. + * + * I expect future Intel CPU's to have a weaker ordering, + * but I'd also expect them to finally get their act together + * and add some real memory barriers if so. */ #define mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") +#define rmb() mb() +#define wmb() __asm__ __volatile__ ("": : :"memory") /* interrupt control.. */ #define __sti() __asm__ __volatile__ ("sti": : :"memory") diff --git a/include/asm-i386/termbits.h b/include/asm-i386/termbits.h index b89188b8c..5ccd7d8f0 100644 --- a/include/asm-i386/termbits.h +++ b/include/asm-i386/termbits.h @@ -117,10 +117,21 @@ struct termios { #define HUPCL 0002000 #define CLOCAL 0004000 #define CBAUDEX 0010000 -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 #define CIBAUD 002003600000 /* input baud rate (not used) */ #define CMSPAR 010000000000 /* mark or space (stick) parity */ #define CRTSCTS 020000000000 /* flow control */ diff --git a/include/asm-i386/termios.h b/include/asm-i386/termios.h index cf6b5cd67..6c8600060 100644 --- a/include/asm-i386/termios.h +++ b/include/asm-i386/termios.h @@ -50,6 +50,8 @@ struct termio { #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ +#define N_IRDA 11 /* Linux IR - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #ifdef __KERNEL__ diff --git a/include/asm-i386/timex.h b/include/asm-i386/timex.h index c492e1b93..bca879f73 100644 --- a/include/asm-i386/timex.h +++ b/include/asm-i386/timex.h @@ -6,10 +6,42 @@ #ifndef _ASMi386_TIMEX_H #define _ASMi386_TIMEX_H +#include <linux/config.h> + #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ #define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ #define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \ (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ << (SHIFT_SCALE-SHIFT_HZ)) / HZ) +/* + * Standard way to access the cycle counter on i586+ CPUs. + * Currently only used on SMP. + * + * If you really have a SMP machine with i486 chips or older, + * compile for that, and this will just always return zero. + * That's ok, it just means that the nicer scheduling heuristics + * won't work for you. + * + * We only use the low 32 bits, and we'd simply better make sure + * that we reschedule before that wraps. Scheduling at least every + * four billion cycles just basically sounds like a good idea, + * regardless of how fast the machine is. + */ +typedef unsigned long cycles_t; + +extern cycles_t cacheflush_time; + +static inline cycles_t get_cycles (void) +{ +#ifndef CONFIG_X86_TSC + return 0; +#else + unsigned long eax, edx; + + __asm__("rdtsc":"=a" (eax), "=d" (edx)); + return eax; +#endif +} + #endif diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h index dcc56f31c..a44ca6c78 100644 --- a/include/asm-i386/uaccess.h +++ b/include/asm-i386/uaccess.h @@ -4,6 +4,7 @@ /* * User space memory access functions */ +#include <linux/config.h> #include <linux/sched.h> #include <asm/page.h> @@ -44,7 +45,7 @@ extern int __verify_write(const void *, unsigned long); :"1" (addr),"g" (size),"g" (current->addr_limit.seg)); \ flag; }) -#if CPU > 386 +#ifdef CONFIG_X86_WP_WORKS_OK #define access_ok(type,addr,size) (__range_ok(addr,size) == 0) @@ -250,13 +251,15 @@ do { \ /* Generic arbitrary sized copy. */ #define __copy_user(to,from,size) \ +do { \ + int __d0, __d1; \ __asm__ __volatile__( \ "0: rep; movsl\n" \ - " movl %1,%0\n" \ + " movl %3,%0\n" \ "1: rep; movsb\n" \ "2:\n" \ ".section .fixup,\"ax\"\n" \ - "3: lea 0(%1,%0,4),%0\n" \ + "3: lea 0(%3,%0,4),%0\n" \ " jmp 2b\n" \ ".previous\n" \ ".section __ex_table,\"a\"\n" \ @@ -264,18 +267,21 @@ do { \ " .long 0b,3b\n" \ " .long 1b,2b\n" \ ".previous" \ - : "=&c"(size) \ - : "r"(size & 3), "0"(size / 4), "D"(to), "S"(from) \ - : "di", "si", "memory") + : "=&c"(size), "=&D" (__d0), "=&S" (__d1) \ + : "r"(size & 3), "0"(size / 4), "1"(to), "2"(from) \ + : "memory"); \ +} while (0) #define __copy_user_zeroing(to,from,size) \ +do { \ + int __d0, __d1; \ __asm__ __volatile__( \ "0: rep; movsl\n" \ - " movl %1,%0\n" \ + " movl %3,%0\n" \ "1: rep; movsb\n" \ "2:\n" \ ".section .fixup,\"ax\"\n" \ - "3: lea 0(%1,%0,4),%0\n" \ + "3: lea 0(%3,%0,4),%0\n" \ "4: pushl %0\n" \ " pushl %%eax\n" \ " xorl %%eax,%%eax\n" \ @@ -289,9 +295,10 @@ do { \ " .long 0b,3b\n" \ " .long 1b,4b\n" \ ".previous" \ - : "=&c"(size) \ - : "r"(size & 3), "0"(size / 4), "D"(to), "S"(from) \ - : "di", "si", "memory"); + : "=&c"(size), "=&D" (__d0), "=&S" (__d1) \ + : "r"(size & 3), "0"(size / 4), "1"(to), "2"(from) \ + : "memory"); \ +} while (0) /* We let the __ versions of copy_from/to_user inline, because they're often * used in fast paths and have only a small space overhead. @@ -314,6 +321,7 @@ __generic_copy_to_user_nocheck(void *to, const void *from, unsigned long n) /* Optimize just a little bit when we know the size of the move. */ #define __constant_copy_user(to, from, size) \ do { \ + int __d0, __d1; \ switch (size & 3) { \ default: \ __asm__ __volatile__( \ @@ -327,9 +335,9 @@ do { \ " .align 4\n" \ " .long 0b,2b\n" \ ".previous" \ - : "=c"(size) \ - : "S"(from), "D"(to), "0"(size/4) \ - : "di", "si", "memory"); \ + : "=c"(size), "=&S" (__d0), "=&D" (__d1)\ + : "1"(from), "2"(to), "0"(size/4) \ + : "memory"); \ break; \ case 1: \ __asm__ __volatile__( \ @@ -346,9 +354,9 @@ do { \ " .long 0b,3b\n" \ " .long 1b,4b\n" \ ".previous" \ - : "=c"(size) \ - : "S"(from), "D"(to), "0"(size/4) \ - : "di", "si", "memory"); \ + : "=c"(size), "=&S" (__d0), "=&D" (__d1)\ + : "1"(from), "2"(to), "0"(size/4) \ + : "memory"); \ break; \ case 2: \ __asm__ __volatile__( \ @@ -365,9 +373,9 @@ do { \ " .long 0b,3b\n" \ " .long 1b,4b\n" \ ".previous" \ - : "=c"(size) \ - : "S"(from), "D"(to), "0"(size/4) \ - : "di", "si", "memory"); \ + : "=c"(size), "=&S" (__d0), "=&D" (__d1)\ + : "1"(from), "2"(to), "0"(size/4) \ + : "memory"); \ break; \ case 3: \ __asm__ __volatile__( \ @@ -387,9 +395,9 @@ do { \ " .long 1b,5b\n" \ " .long 2b,6b\n" \ ".previous" \ - : "=c"(size) \ - : "S"(from), "D"(to), "0"(size/4) \ - : "di", "si", "memory"); \ + : "=c"(size), "=&S" (__d0), "=&D" (__d1)\ + : "1"(from), "2"(to), "0"(size/4) \ + : "memory"); \ break; \ } \ } while (0) @@ -397,6 +405,7 @@ do { \ /* Optimize just a little bit when we know the size of the move. */ #define __constant_copy_user_zeroing(to, from, size) \ do { \ + int __d0, __d1; \ switch (size & 3) { \ default: \ __asm__ __volatile__( \ @@ -416,9 +425,9 @@ do { \ " .align 4\n" \ " .long 0b,2b\n" \ ".previous" \ - : "=c"(size) \ - : "S"(from), "D"(to), "0"(size/4) \ - : "di", "si", "memory"); \ + : "=c"(size), "=&S" (__d0), "=&D" (__d1)\ + : "1"(from), "2"(to), "0"(size/4) \ + : "memory"); \ break; \ case 1: \ __asm__ __volatile__( \ @@ -448,9 +457,9 @@ do { \ " .long 0b,3b\n" \ " .long 1b,4b\n" \ ".previous" \ - : "=c"(size) \ - : "S"(from), "D"(to), "0"(size/4) \ - : "di", "si", "memory"); \ + : "=c"(size), "=&S" (__d0), "=&D" (__d1)\ + : "1"(from), "2"(to), "0"(size/4) \ + : "memory"); \ break; \ case 2: \ __asm__ __volatile__( \ @@ -480,9 +489,9 @@ do { \ " .long 0b,3b\n" \ " .long 1b,4b\n" \ ".previous" \ - : "=c"(size) \ - : "S"(from), "D"(to), "0"(size/4) \ - : "di", "si", "memory"); \ + : "=c"(size), "=&S" (__d0), "=&D" (__d1)\ + : "1"(from), "2"(to), "0"(size/4) \ + : "memory"); \ break; \ case 3: \ __asm__ __volatile__( \ @@ -522,9 +531,9 @@ do { \ " .long 1b,5b\n" \ " .long 2b,6b\n" \ ".previous" \ - : "=c"(size) \ - : "S"(from), "D"(to), "0"(size/4) \ - : "di", "si", "memory"); \ + : "=c"(size), "=&S" (__d0), "=&D" (__d1)\ + : "1"(from), "2"(to), "0"(size/4) \ + : "memory"); \ break; \ } \ } while (0) diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index 76c7241bf..c961fdd2e 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -194,6 +194,7 @@ #define __NR_sendfile 187 #define __NR_getpmsg 188 /* some people actually want streams */ #define __NR_putpmsg 189 /* some people actually want streams */ +#define __NR_vfork 190 /* user-visible error numbers are in the range -1 - -122: see <asm-i386/errno.h> */ diff --git a/include/asm-m68k/bootinfo.h b/include/asm-m68k/bootinfo.h index c0a7e6cb0..74930a381 100644 --- a/include/asm-m68k/bootinfo.h +++ b/include/asm-m68k/bootinfo.h @@ -46,12 +46,6 @@ struct bi_record { unsigned long data[0]; /* data */ }; -#else /* __ASSEMBLY__ */ - -BIR_tag = 0 -BIR_size = BIR_tag+2 -BIR_data = BIR_size+2 - #endif /* __ASSEMBLY__ */ @@ -287,14 +281,6 @@ struct compat_bi_Macintosh unsigned long adbdelay; unsigned long timedbra; }; -#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 diff --git a/include/asm-m68k/bvme6000hw.h b/include/asm-m68k/bvme6000hw.h index 0218c29dc..853120a04 100644 --- a/include/asm-m68k/bvme6000hw.h +++ b/include/asm-m68k/bvme6000hw.h @@ -98,7 +98,7 @@ typedef struct { #define BVME_CONFIG_REG 0xff500003 -#define config_reg_ptr (unsigned char *)BVME_CONFIG_REG +#define config_reg_ptr (volatile unsigned char *)BVME_CONFIG_REG #define BVME_CONFIG_SW1 0x08 #define BVME_CONFIG_SW2 0x04 @@ -126,4 +126,24 @@ typedef struct { #define BVME_IRQ_SCCA_RX 0x4c #define BVME_IRQ_SCCA_SPCOND 0x4e +/* Address control registers */ + +#define BVME_ACR_A32VBA 0xff400003 +#define BVME_ACR_A32MSK 0xff410003 +#define BVME_ACR_A24VBA 0xff420003 +#define BVME_ACR_A24MSK 0xff430003 +#define BVME_ACR_A16VBA 0xff440003 +#define BVME_ACR_A32LBA 0xff450003 +#define BVME_ACR_A24LBA 0xff460003 +#define BVME_ACR_ADDRCTL 0xff470003 + +#define bvme_acr_a32vba *(volatile unsigned char *)BVME_ACR_A32VBA +#define bvme_acr_a32msk *(volatile unsigned char *)BVME_ACR_A32MSK +#define bvme_acr_a24vba *(volatile unsigned char *)BVME_ACR_A24VBA +#define bvme_acr_a24msk *(volatile unsigned char *)BVME_ACR_A24MSK +#define bvme_acr_a16vba *(volatile unsigned char *)BVME_ACR_A16VBA +#define bvme_acr_a32lba *(volatile unsigned char *)BVME_ACR_A32LBA +#define bvme_acr_a24lba *(volatile unsigned char *)BVME_ACR_A24LBA +#define bvme_acr_addrctl *(volatile unsigned char *)BVME_ACR_ADDRCTL + #endif diff --git a/include/asm-m68k/entry.h b/include/asm-m68k/entry.h index b1c102ce2..647764bd1 100644 --- a/include/asm-m68k/entry.h +++ b/include/asm-m68k/entry.h @@ -37,25 +37,8 @@ #define curptr a2 -/* - * these are offsets into the task-struct - */ -LTASK_STATE = 0 -LTASK_FLAGS = 4 -LTASK_SIGPENDING = 8 -LTASK_ADDRLIMIT = 12 -LTASK_EXECDOMAIN = 16 -LTASK_NEEDRESCHED = 20 - -LTSS_KSP = 0 -LTSS_USP = 4 -LTSS_SR = 8 -LTSS_FS = 10 -LTSS_CRP = 12 -LTSS_FPCTXT = 24 - /* the following macro is used when enabling interrupts */ -#if defined(CONFIG_ATARI_ONLY) && !defined(CONFIG_HADES) +#if defined(MACH_ATARI_ONLY) && !defined(CONFIG_HADES) /* block out HSYNC on the atari */ #define ALLOWINT 0xfbff #define MAX_NOINT_IPL 3 @@ -65,22 +48,20 @@ LTSS_FPCTXT = 24 #define MAX_NOINT_IPL 0 #endif /* machine compilation types */ -LPT_OFF_D0 = 0x20 -LPT_OFF_ORIG_D0 = 0x24 -LPT_OFF_SR = 0x2C -LPT_OFF_FORMATVEC = 0x32 - LFLUSH_I_AND_D = 0x00000808 -LENOSYS = 38 LSIGTRAP = 5 -LPF_TRACESYS_OFF = 3 -LPF_TRACESYS_BIT = 5 -LPF_PTRACED_OFF = 3 -LPF_PTRACED_BIT = 4 -LPF_DTRACE_OFF = 1 -LPF_DTRACE_BIT = 5 - +/* process bits for task_struct.flags */ +PF_TRACESYS_OFF = 3 +PF_TRACESYS_BIT = 5 +PF_PTRACED_OFF = 3 +PF_PTRACED_BIT = 4 +PF_DTRACE_OFF = 1 +PF_DTRACE_BIT = 5 + +#define SAVE_ALL_INT save_all_int +#define SAVE_ALL_SYS save_all_sys +#define RESTORE_ALL restore_all /* * This defines the normal kernel pt-regs layout. * @@ -92,56 +73,68 @@ LPF_DTRACE_BIT = 5 * a -1 in the orig_d0 field signifies * that the stack frame is NOT for syscall */ -#define SAVE_ALL_INT \ - clrl %sp@-; /* stk_adj */ \ - pea -1:w; /* orig d0 */ \ - movel %d0,%sp@-; /* d0 */ \ +.macro save_all_int + clrl %sp@- | stk_adj + pea -1:w | orig d0 + movel %d0,%sp@- | d0 moveml %d1-%d5/%a0-%a1/%curptr,%sp@- +.endm -#define SAVE_ALL_SYS \ - clrl %sp@-; /* stk_adj */ \ - movel %d0,%sp@-; /* orig d0 */ \ - movel %d0,%sp@-; /* d0 */ \ - moveml %d1-%d5/%a0-%a1/%curptr,%sp@- +.macro save_all_sys + clrl %sp@- | stk_adj + movel %d0,%sp@- | orig d0 + movel %d0,%sp@- | d0 + moveml %d1-%d5/%a0-%a1/%curptr,%sp@- +.endm #else /* Need to save the "missing" registers for kgdb... */ -#define SAVE_ALL_INT \ - clrl %sp@-; /* stk_adj */ \ - pea -1:w; /* orig d0 */ \ - movel %d0,%sp@-; /* d0 */ \ - moveml %d1-%d5/%a0-%a1/%curptr,%sp@-; \ - moveml %d6-%d7,kgdb_registers+GDBOFFA_D6; \ +.macro save_all_int + clrl %sp@- | stk_adj + pea -1:w | orig d0 + movel %d0,%sp@- | d0 + moveml %d1-%d5/%a0-%a1/%curptr,%sp@- + moveml %d6-%d7,kgdb_registers+GDBOFFA_D6 moveml %a3-%a6,kgdb_registers+GDBOFFA_A3 +.endm -#define SAVE_ALL_SYS \ - clrl %sp@-; /* stk_adj */ \ - movel %d0,%sp@-; /* orig d0 */ \ - movel %d0,%sp@-; /* d0 */ \ - moveml %d1-%d5/%a0-%a1/%curptr,%sp@-; \ - moveml %d6-%d7,kgdb_registers+GDBOFFA_D6; \ +.macro save_all_sys + clrl %sp@- | stk_adj + movel %d0,%sp@- | orig d0 + movel %d0,%sp@- | d0 + moveml %d1-%d5/%a0-%a1/%curptr,%sp@- + moveml %d6-%d7,kgdb_registers+GDBOFFA_D6 moveml %a3-%a6,kgdb_registers+GDBOFFA_A3 +.endm #endif -#define RESTORE_ALL \ - moveml %sp@+,%a0-%a1/%curptr/%d1-%d5; \ - movel %sp@+,%d0; \ - addql #4,%sp; /* orig d0 */ \ - addl %sp@+,%sp; /* stk adj */ \ +.macro restore_all + moveml %sp@+,%a0-%a1/%curptr/%d1-%d5 + movel %sp@+,%d0 + addql #4,%sp | orig d0 + addl %sp@+,%sp | stk adj rte +.endm #define SWITCH_STACK_SIZE (6*4+4) /* includes return address */ -#define SAVE_SWITCH_STACK \ +#define SAVE_SWITCH_STACK save_switch_stack +#define RESTORE_SWITCH_STACK restore_switch_stack +#define GET_CURRENT(tmp) get_current tmp + +.macro save_switch_stack moveml %a3-%a6/%d6-%d7,%sp@- +.endm -#define RESTORE_SWITCH_STACK \ +.macro restore_switch_stack moveml %sp@+,%a3-%a6/%d6-%d7 +.endm -#define GET_CURRENT(tmp) \ - movel %sp,tmp; \ - andw &-8192,tmp; \ - movel tmp,%curptr; +.macro get_current reg=%d0 + movel %sp,\reg + andw #-8192,\reg + movel \reg,%curptr +.endm #else /* C source */ diff --git a/include/asm-m68k/ide.h b/include/asm-m68k/ide.h index 6fa31e040..a590528a7 100644 --- a/include/asm-m68k/ide.h +++ b/include/asm-m68k/ide.h @@ -449,7 +449,7 @@ static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *, * an interrupt, and in that case it does nothing. Hope that is reasonable and * works. (Roman) */ -#ifdef CONFIG_ATARI_ONLY +#ifdef MACH_ATARI_ONLY #define ide__sti() \ do { \ if (!in_interrupt()) __sti(); \ diff --git a/include/asm-m68k/init.h b/include/asm-m68k/init.h index 9d366561a..022300376 100644 --- a/include/asm-m68k/init.h +++ b/include/asm-m68k/init.h @@ -15,6 +15,9 @@ #define __FINIT .previous #define __INITDATA .section ".data.init",#alloc,#write +#define __cacheline_aligned __attribute__ \ + ((__aligned__(16), __section__ (".data.cacheline_aligned"))) + #else /* gdb doesn't like it all if the code for one source file isn't together in @@ -27,7 +30,8 @@ #define __INIT #define __FINIT #define __INITDATA +#define __cacheline_aligned __attribute__ ((__aligned__(16))) #endif /* CONFIG_KGDB */ - + #endif diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h index d60096384..168077b26 100644 --- a/include/asm-m68k/io.h +++ b/include/asm-m68k/io.h @@ -43,6 +43,35 @@ #define outb(x,addr) ((void) writeb(x,addr)) #define outb_p(x,addr) outb(x,addr) + +/* Values for nocacheflag and cmode */ +#define IOMAP_FULL_CACHING 0 +#define IOMAP_NOCACHE_SER 1 +#define IOMAP_NOCACHE_NONSER 2 +#define IOMAP_WRITETHROUGH 3 + +extern void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag); +extern void __iounmap(void *addr, unsigned long size); + +extern inline void *ioremap(unsigned long physaddr, unsigned long size) +{ + return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); +} +extern inline void *ioremap_nocache(unsigned long physaddr, unsigned long size) +{ + return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); +} +extern inline void *ioremap_writethrough(unsigned long physaddr, unsigned long size) +{ + return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); +} +extern inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size) +{ + return __ioremap(physaddr, size, IOMAP_FULL_CACHING); +} + +extern void iounmap(void *addr); + #endif /* __KERNEL__ */ #endif /* _M68K_IO_H */ diff --git a/include/asm-m68k/ipc.h b/include/asm-m68k/ipc.h index f1a75cc1d..96441c86c 100644 --- a/include/asm-m68k/ipc.h +++ b/include/asm-m68k/ipc.h @@ -23,6 +23,9 @@ struct ipc_kludge { #define SHMGET 23 #define SHMCTL 24 +/* Used by the DIPC package, try and avoid reusing it */ +#define DIPC 25 + #define IPCCALL(version,op) ((version)<<16 | (op)) #endif diff --git a/include/asm-m68k/keyboard.h b/include/asm-m68k/keyboard.h index c30c8dc04..eccadf2e3 100644 --- a/include/asm-m68k/keyboard.h +++ b/include/asm-m68k/keyboard.h @@ -52,9 +52,9 @@ static __inline__ void kbd_leds(unsigned char leds) #ifdef CONFIG_MAGIC_SYSRQ #define kbd_is_sysrq(keycode) ((keycode) == mach_sysrq_key && \ - (up_flag || \ - (shift_state & mach_sysrq_shift_mask) == \ - mach_sysrq_shift_state)) + (up_flag || \ + (shift_state & mach_sysrq_shift_mask) == \ + mach_sysrq_shift_state)) #define kbd_sysrq_xlate mach_sysrq_xlate #endif diff --git a/include/asm-m68k/machdep.h b/include/asm-m68k/machdep.h index 2d8959093..ff785fb6e 100644 --- a/include/asm-m68k/machdep.h +++ b/include/asm-m68k/machdep.h @@ -13,7 +13,6 @@ extern void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *)); extern int (*mach_keyb_init) (void); extern int (*mach_kbdrate) (struct kbd_repeat *); extern void (*mach_kbd_leds) (unsigned int); -extern void (*kbd_reset_setup) (char *, int); /* machine dependent irq functions */ extern void (*mach_init_IRQ) (void); extern void (*(*mach_default_handler)[]) (int, void *, struct pt_regs *); diff --git a/include/asm-m68k/machw.h b/include/asm-m68k/machw.h index 90ff6b627..56da64f3b 100644 --- a/include/asm-m68k/machw.h +++ b/include/asm-m68k/machw.h @@ -13,6 +13,16 @@ #ifndef _ASM_MACHW_H_ #define _ASM_MACHW_H_ +/* + * head.S maps the videomem to VIDEOMEMBASE + */ + +#define VIDEOMEMBASE 0xf0000000 +#define VIDEOMEMSIZE (4096*1024) +#define VIDEOMEMMASK (-4096*1024) + +#ifndef __ASSEMBLY__ + #include <linux/types.h> /* Mac SCSI Controller 5380 */ @@ -143,4 +153,6 @@ struct { /* extern struct mac_hw_present mac_hw_present; */ +#endif /* __ASSEMBLY__ */ + #endif /* linux/machw.h */ diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h index f9f50bff7..a3fe87e71 100644 --- a/include/asm-m68k/page.h +++ b/include/asm-m68k/page.h @@ -8,7 +8,7 @@ #ifdef __KERNEL__ -#include<linux/config.h> +#include <asm/setup.h> #define STRICT_MM_TYPECHECKS @@ -18,7 +18,7 @@ /* * We don't need to check for alignment etc. */ -#if defined(CONFIG_OPTIMIZE_040) || defined(CONFIG_OPTIMIZE_060) +#ifdef CPU_M68040_OR_M68060_ONLY static inline void copy_page(unsigned long to, unsigned long from) { unsigned long tmp; diff --git a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h index 1dbc17608..a3487fb9d 100644 --- a/include/asm-m68k/pgtable.h +++ b/include/asm-m68k/pgtable.h @@ -13,14 +13,7 @@ * the m68k page table tree. */ -/* For virtual address to physical address conversion */ -extern unsigned long mm_vtop(unsigned long addr) __attribute__ ((const)); -extern unsigned long mm_ptov(unsigned long addr) __attribute__ ((const)); - -#include<asm/virtconvert.h> - -#define VTOP(addr) (mm_vtop((unsigned long)(addr))) -#define PTOV(addr) (mm_ptov((unsigned long)(addr))) +#include <asm/virtconvert.h> /* * Cache handling functions @@ -428,7 +421,7 @@ extern pte_t * __bad_pagetable(void); #define mk_pte(page, pgprot) \ ({ pte_t __pte; pte_val(__pte) = virt_to_phys((void *)page) + pgprot_val(pgprot); __pte; }) #define mk_pte_phys(physpage, pgprot) \ -({ pte_t __pte; pte_val(__pte) = virt_to_phys((void *)physpage) + pgprot_val(pgprot); __pte; }) +({ pte_t __pte; pte_val(__pte) = (unsigned long)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; } @@ -436,34 +429,24 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep) { int i; - - ptep = (pte_t *) virt_to_phys(ptep); - for (i = 0; i < 16; i++, ptep += PTRS_PER_PTE/16) - pmdp->pmd[i] = _PAGE_TABLE | _PAGE_ACCESSED | (unsigned long)ptep; -} - -/* early termination version of the above */ -extern inline void pmd_set_et(pmd_t * pmdp, pte_t * ptep) -{ - int i; - - ptep = (pte_t *) virt_to_phys(ptep); - for (i = 0; i < 16; i++, ptep += PTRS_PER_PTE/16) - pmdp->pmd[i] = _PAGE_PRESENT | _PAGE_ACCESSED | (unsigned long)ptep; + unsigned long ptbl; + ptbl = virt_to_phys(ptep); + for (i = 0; i < 16; i++, ptbl += sizeof(pte_table)/16) + pmdp->pmd[i] = _PAGE_TABLE | _PAGE_ACCESSED | ptbl; } extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) { pgd_val(*pgdp) = _PAGE_TABLE | _PAGE_ACCESSED | virt_to_phys(pmdp); } extern inline unsigned long pte_page(pte_t pte) -{ return (unsigned long)phys_to_virt((unsigned long)(pte_val(pte) & PAGE_MASK)); } +{ return (unsigned long)phys_to_virt(pte_val(pte) & PAGE_MASK); } extern inline unsigned long pmd_page2(pmd_t *pmd) -{ return (unsigned long)phys_to_virt((unsigned long)(pmd_val(*pmd) & _TABLE_MASK)); } +{ return (unsigned long)phys_to_virt(pmd_val(*pmd) & _TABLE_MASK); } #define pmd_page(pmd) pmd_page2(&(pmd)) extern inline unsigned long pgd_page(pgd_t pgd) -{ return (unsigned long)phys_to_virt((unsigned long)(pgd_val(pgd) & _TABLE_MASK)); } +{ return (unsigned long)phys_to_virt(pgd_val(pgd) & _TABLE_MASK); } extern inline int pte_none(pte_t pte) { return !pte_val(pte); } extern inline int pte_present(pte_t pte) { return pte_val(pte) & (_PAGE_PRESENT | _PAGE_FAKE_SUPER); } @@ -547,7 +530,7 @@ extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) return mm->pgd + (address >> PGDIR_SHIFT); } -extern pgd_t swapper_pg_dir[128]; +#define swapper_pg_dir kernel_pg_dir extern pgd_t kernel_pg_dir[128]; extern inline pgd_t * pgd_offset_k(unsigned long address) @@ -625,8 +608,6 @@ extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long offset); extern pmd_t *get_pointer_table(void); extern int free_pointer_table(pmd_t *); -extern pmd_t *get_kpointer_table(void); -extern void free_kpointer_table(pmd_t *); extern __inline__ pte_t *get_pte_fast(void) { @@ -754,29 +735,12 @@ extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) extern inline void pmd_free_kernel(pmd_t * pmd) { - free_kpointer_table(pmd); + free_pmd_fast(pmd); } extern inline pmd_t * pmd_alloc_kernel(pgd_t * pgd, unsigned long address) { - address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); - if (pgd_none(*pgd)) { - pmd_t *page = get_kpointer_table(); - if (pgd_none(*pgd)) { - if (page) { - pgd_set(pgd, page); - return page + address; - } - pgd_set(pgd, (pmd_t *)BAD_PAGETABLE); - return NULL; - } - free_kpointer_table(page); - } - if (pgd_bad(*pgd)) { - __bad_pmd(pgd); - return NULL; - } - return (pmd_t *) pgd_page(*pgd) + address; + return pmd_alloc(pgd, address); } extern inline void pgd_free(pgd_t * pgd) @@ -815,26 +779,7 @@ extern inline int mm_end_of_chunk (unsigned long addr, int len) int mm_end_of_chunk (unsigned long addr, int len); #endif -/* - * Map some physical address range into the kernel address space. - */ -extern unsigned long kernel_map(unsigned long paddr, unsigned long size, - int nocacheflag, unsigned long *memavailp ); -/* - * Unmap a region alloced by kernel_map(). - */ -extern void kernel_unmap( unsigned long addr ); -/* - * Change the cache mode of some kernel address range. - */ -extern void kernel_set_cachemode( unsigned long address, unsigned long size, - unsigned cmode ); - -/* Values for nocacheflag and cmode */ -#define KERNELMAP_FULL_CACHING 0 -#define KERNELMAP_NOCACHE_SER 1 -#define KERNELMAP_NOCACHE_NONSER 2 -#define KERNELMAP_NO_COPYBACK 3 +extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode); /* * The m68k doesn't have any external MMU info: the kernel page diff --git a/include/asm-m68k/processor.h b/include/asm-m68k/processor.h index 8246efd95..3fcf0670b 100644 --- a/include/asm-m68k/processor.h +++ b/include/asm-m68k/processor.h @@ -45,7 +45,7 @@ struct thread_struct { unsigned char fpstate[FPSTATESIZE]; /* floating point state */ }; -#define INIT_MMAP { &init_mm, 0, 0x40000000, __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED), VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } +#define INIT_MMAP { &init_mm, 0, 0x40000000, NULL, __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED), VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } #define INIT_TSS { \ sizeof(init_stack) + (unsigned long) init_stack, 0, \ @@ -72,8 +72,11 @@ static inline void release_thread(struct task_struct *dead_task) { } +extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); + #define copy_segments(nr, tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) +#define forget_segments() do { } while (0) /* * Free current thread data structures etc.. diff --git a/include/asm-m68k/resource.h b/include/asm-m68k/resource.h index f94ce2708..09ae4cfd2 100644 --- a/include/asm-m68k/resource.h +++ b/include/asm-m68k/resource.h @@ -25,7 +25,7 @@ {LONG_MAX, LONG_MAX}, \ {LONG_MAX, LONG_MAX}, \ {LONG_MAX, LONG_MAX}, \ - {_STK_LIM, _STK_LIM}, \ + {_STK_LIM, LONG_MAX}, \ { 0, LONG_MAX}, \ {LONG_MAX, LONG_MAX}, \ {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, \ diff --git a/include/asm-m68k/semaphore.h b/include/asm-m68k/semaphore.h index 50aabc1c8..9d05256df 100644 --- a/include/asm-m68k/semaphore.h +++ b/include/asm-m68k/semaphore.h @@ -3,6 +3,7 @@ #include <linux/config.h> #include <linux/linkage.h> +#include <asm/current.h> #include <asm/system.h> #include <asm/atomic.h> @@ -16,18 +17,30 @@ struct semaphore { atomic_t count; + unsigned long owner, owner_depth; atomic_t waking; struct wait_queue * wait; }; -#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), ATOMIC_INIT(0), NULL }) -#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), ATOMIC_INIT(0), NULL }) +/* + * Because we want the non-contention case to be + * fast, we save the stack pointer into the "owner" + * field, and to get the true task pointer we have + * to do the bit masking. That moves the masking + * operation into the slow path. + */ +#define semaphore_owner(sem) \ + ((struct task_struct *)((2*PAGE_MASK) & (sem)->owner)) + +#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), 0, 0, ATOMIC_INIT(0), NULL }) +#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), 0, 1, ATOMIC_INIT(0), NULL }) asmlinkage void __down_failed(void /* special register calling convention */); asmlinkage int __down_failed_interruptible(void /* params in registers */); asmlinkage void __up_wakeup(void /* special register calling convention */); extern void __down(struct semaphore * sem); +extern int __down_interruptible(struct semaphore * sem); extern void __up(struct semaphore * sem); #define sema_init(sem, val) atomic_set(&((sem)->count), val) @@ -37,7 +50,7 @@ static inline void wake_one_more(struct semaphore * sem) atomic_inc(&sem->waking); } -static inline int waking_non_zero(struct semaphore *sem) +static inline int waking_non_zero(struct semaphore *sem, struct task_struct *tsk) { #ifndef CONFIG_RMW_INSNS unsigned long flags; @@ -45,7 +58,9 @@ static inline int waking_non_zero(struct semaphore *sem) save_flags(flags); cli(); - if (atomic_read(&sem->waking) > 0) { + if (atomic_read(&sem->waking) > 0 || (owner_depth && semaphore_owner(sem) == tsk)) { + sem->owner = (unsigned long)tsk; + sem->owner_depth++; atomic_dec(&sem->waking); ret = 1; } @@ -55,7 +70,7 @@ static inline int waking_non_zero(struct semaphore *sem) __asm__ __volatile__ ("1: movel %2,%0\n" - " jeq 3f\n" + " jeq 3f\n" "2: movel %0,%1\n" " subql #1,%1\n" " casl %0,%1,%2\n" @@ -64,6 +79,13 @@ static inline int waking_non_zero(struct semaphore *sem) " jne 2b\n" "3:" : "=d" (ret), "=d" (tmp), "=m" (sem->waking)); + + ret |= ((sem->owner_depth != 0) && (semaphore_owner(sem) == tsk)); + if (ret) { + sem->owner = (unsigned long)tsk; + sem->owner_depth++; + } + #endif return ret; } @@ -79,7 +101,9 @@ extern inline void down(struct semaphore * sem) __asm__ __volatile__( "| atomic down operation\n\t" "subql #1,%0@\n\t" - "jmi 2f\n" + "jmi 2f\n\t" + "movel %%sp,4(%0)\n" + "movel #1,8(%0)\n\t" "1:\n" ".section .text.lock,\"ax\"\n" ".even\n" @@ -100,6 +124,9 @@ extern inline int down_interruptible(struct semaphore * sem) "| atomic interruptible down operation\n\t" "subql #1,%1@\n\t" "jmi 2f\n\t" + "movel %%sp,4(%1)\n" + "moveql #1,%0\n" + "movel %0,8(%1)\n" "clrl %0\n" "1:\n" ".section .text.lock,\"ax\"\n" @@ -124,6 +151,7 @@ extern inline void up(struct semaphore * sem) register struct semaphore *sem1 __asm__ ("%a1") = sem; __asm__ __volatile__( "| atomic up operation\n\t" + "subql #1,8(%0)\n\t" "addql #1,%0@\n\t" "jle 2f\n" "1:\n" diff --git a/include/asm-m68k/setup.h b/include/asm-m68k/setup.h index bf3314c2a..197d96f1e 100644 --- a/include/asm-m68k/setup.h +++ b/include/asm-m68k/setup.h @@ -52,7 +52,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) # define MACH_IS_AMIGA (m68k_machtype == MACH_AMIGA) #else -# define CONFIG_AMIGA_ONLY +# define MACH_AMIGA_ONLY # define MACH_IS_AMIGA (1) # define MACH_TYPE (MACH_AMIGA) #endif @@ -63,7 +63,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) # define MACH_IS_ATARI (m68k_machtype == MACH_ATARI) #else -# define CONFIG_ATARI_ONLY +# define MACH_ATARI_ONLY # define MACH_IS_ATARI (1) # define MACH_TYPE (MACH_ATARI) #endif @@ -74,7 +74,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_HP300) || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) # define MACH_IS_MAC (m68k_machtype == MACH_MAC) #else -# define CONFIG_MAC_ONLY +# define MACH_MAC_ONLY # define MACH_IS_MAC (1) # define MACH_TYPE (MACH_MAC) #endif @@ -91,7 +91,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) # define MACH_IS_APOLLO (m68k_machtype == MACH_APOLLO) #else -# define CONFIG_APOLLO_ONLY +# define MACH_APOLLO_ONLY # define MACH_IS_APOLLO (1) # define MACH_TYPE (MACH_APOLLO) #endif @@ -102,7 +102,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_APOLLO) || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) # define MACH_IS_MVME16x (m68k_machtype == MACH_MVME16x) #else -# define CONFIG_MVME16x_ONLY +# define MACH_MVME16x_ONLY # define MACH_IS_MVME16x (1) # define MACH_TYPE (MACH_MVME16x) #endif @@ -113,7 +113,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) || defined(CONFIG_HP300) # define MACH_IS_BVME6000 (m68k_machtype == MACH_BVME6000) #else -# define CONFIG_BVME6000_ONLY +# define MACH_BVME6000_ONLY # define MACH_IS_BVME6000 (1) # define MACH_TYPE (MACH_BVME6000) #endif @@ -124,7 +124,7 @@ extern unsigned long m68k_machtype; || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) # define MAC_IS_HP300 (m68k_machtype == MACH_HP300) #else -# define CONFIG_HP300_ONLY +# define MACH_HP300_ONLY # define MACH_IS_HP300 (1) # define MACH_TYPE (MACH_HP300) #endif @@ -260,6 +260,7 @@ extern int m68k_is040or060; #define CPU_TYPE (m68k_cputype) + /* * Miscellaneous */ @@ -268,7 +269,8 @@ extern int m68k_is040or060; #define CL_SIZE 256 #ifndef __ASSEMBLY__ -extern int m68k_num_memory; /* # of memory blocks found */ +extern int m68k_num_memory; /* # of memory blocks found (and used) */ +extern int m68k_realnum_memory; /* real # of memory blocks found */ extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */ struct mem_info { diff --git a/include/asm-m68k/softirq.h b/include/asm-m68k/softirq.h index 89c786665..dc5f56728 100644 --- a/include/asm-m68k/softirq.h +++ b/include/asm-m68k/softirq.h @@ -13,7 +13,7 @@ extern inline void init_bh(int nr, void (*routine)(void)) { bh_base[nr] = routine; - bh_mask_count[nr] = 0; + atomic_set(&bh_mask_count[nr], 0); bh_mask |= 1 << nr; } @@ -29,12 +29,12 @@ extern inline void mark_bh(int nr) extern inline void disable_bh(int nr) { bh_mask &= ~(1 << nr); - bh_mask_count[nr]++; + atomic_inc(&bh_mask_count[nr]); } extern inline void enable_bh(int nr) { - if (!--bh_mask_count[nr]) + if (atomic_dec_and_test(&bh_mask_count[nr])) bh_mask |= 1 << nr; } diff --git a/include/asm-m68k/spinlock.h b/include/asm-m68k/spinlock.h index 6c049a124..1c3ace986 100644 --- a/include/asm-m68k/spinlock.h +++ b/include/asm-m68k/spinlock.h @@ -10,10 +10,10 @@ */ #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) typedef struct { } spinlock_t; -#define SPIN_LOCK_UNLOCKED { } +#define SPIN_LOCK_UNLOCKED (spinlock_t) { } #else typedef struct { int gcc_is_buggy; } spinlock_t; -#define SPIN_LOCK_UNLOCKED { 0 } +#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } #endif #define spin_lock_init(lock) do { } while(0) @@ -38,9 +38,16 @@ typedef struct { int gcc_is_buggy; } spinlock_t; * can "mix" irq-safe locks - any writer needs to get a * irq-safe write-lock, but readers can get non-irqsafe * read-locks. + * + * Gcc-2.7.x has a nasty bug with empty initializers. */ +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) typedef struct { } rwlock_t; -#define RW_LOCK_UNLOCKED { } +#define RW_LOCK_UNLOCKED (rwlock_t) { } +#else +typedef struct { int gcc_is_buggy; } rwlock_t; +#define RW_LOCK_UNLOCKED (rwlock_t) { 0 } +#endif #define read_lock(lock) do { } while(0) #define read_unlock(lock) do { } while(0) diff --git a/include/asm-m68k/string.h b/include/asm-m68k/string.h index 796f6f16e..710288a1a 100644 --- a/include/asm-m68k/string.h +++ b/include/asm-m68k/string.h @@ -1,7 +1,7 @@ #ifndef _M68K_STRING_H_ #define _M68K_STRING_H_ -#include <linux/config.h> +#include <asm/setup.h> #include <asm/page.h> #define __HAVE_ARCH_STRCPY @@ -315,7 +315,7 @@ extern inline void * __memset_page(void * s,int c,size_t count) data = c | (c << 8); data |= data << 16; -#if defined(CONFIG_OPTIMIZE_040) || defined(CONFIG_OPTIMIZE_060) +#ifdef CPU_M68040_OR_M68060_ONLY if (((unsigned long) s) & 0x0f) memset(s, c, count); @@ -386,7 +386,7 @@ extern inline void * __memcpy_page(void * to, const void * from, size_t count) unsigned long tmp; void *xto = to; -#if defined(CONFIG_OPTIMIZE_040) || defined(CONFIG_OPTIMIZE_060) +#ifdef CPU_M68040_OR_M68060_ONLY if (((unsigned long) to | (unsigned long) from) & 0x0f) return memcpy(to, from, count); diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h index cee722633..86d3d38f1 100644 --- a/include/asm-m68k/system.h +++ b/include/asm-m68k/system.h @@ -46,11 +46,8 @@ asmlinkage void resume(void); #define switch_to(prev,next) { \ register void *_prev __asm__ ("a0") = (prev); \ register void *_next __asm__ ("a1") = (next); \ - register int _tssoff __asm__ ("d1") = (int)&((struct task_struct *)0)->tss; \ - register char _shared __asm__ ("d2") = ((prev)->mm == (next)->mm); \ - __asm__ __volatile__("jbsr " SYMBOL_NAME_STR(resume) "\n\t" \ - : : "a" (_prev), "a" (_next), "d" (_tssoff), \ - "d" (_shared) \ + __asm__ __volatile__("jbsr " SYMBOL_NAME_STR(resume) \ + : : "a" (_prev), "a" (_next) \ : "d0", "d1", "d2", "d3", "d4", "d5", "a0", "a1"); \ } @@ -60,7 +57,7 @@ asmlinkage void resume(void); struct __xchg_dummy { unsigned long a[100]; }; #define __xg(x) ((volatile struct __xchg_dummy *)(x)) -#if defined(CONFIG_ATARI) && !defined(CONFIG_AMIGA) && !defined(CONFIG_MAC) && !defined(CONFIG_HADES) && !defined(CONFIG_VME) && !defined(CONFIG_APOLLO) +#if defined(MACH_ATARI_ONLY) && !defined(CONFIG_HADES) /* block out HSYNC on the atari */ #define __sti() __asm__ __volatile__ ("andiw #0xfbff,%/sr": : : "memory") #else /* portable version */ diff --git a/include/asm-m68k/termbits.h b/include/asm-m68k/termbits.h index 0a3080a76..c43bb869a 100644 --- a/include/asm-m68k/termbits.h +++ b/include/asm-m68k/termbits.h @@ -118,10 +118,21 @@ struct termios { #define HUPCL 0002000 #define CLOCAL 0004000 #define CBAUDEX 0010000 -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 #define CIBAUD 002003600000 /* input baud rate (not used) */ #define CMSPAR 010000000000 /* mark or space (stick) parity */ #define CRTSCTS 020000000000 /* flow control */ diff --git a/include/asm-m68k/termios.h b/include/asm-m68k/termios.h index b17fed223..a65484efb 100644 --- a/include/asm-m68k/termios.h +++ b/include/asm-m68k/termios.h @@ -58,6 +58,8 @@ struct termio { #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ +#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #ifdef __KERNEL__ diff --git a/include/asm-m68k/timex.h b/include/asm-m68k/timex.h index fe5cff581..7a05262f2 100644 --- a/include/asm-m68k/timex.h +++ b/include/asm-m68k/timex.h @@ -12,4 +12,11 @@ (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ << (SHIFT_SCALE-SHIFT_HZ)) / HZ) +typedef unsigned long cycles_t; + +static inline cycles_t get_cycles(void) +{ + return 0; +} + #endif diff --git a/include/asm-m68k/traps.h b/include/asm-m68k/traps.h index 5b12398f5..c4a7d6baa 100644 --- a/include/asm-m68k/traps.h +++ b/include/asm-m68k/traps.h @@ -11,10 +11,14 @@ #ifndef _M68K_TRAPS_H #define _M68K_TRAPS_H +#ifndef __ASSEMBLY__ + typedef void (*e_vector)(void); extern e_vector vectors[]; +#endif + #define VEC_BUSERR (2) #define VEC_ADDRERR (3) #define VEC_ILLEGAL (4) @@ -63,9 +67,12 @@ extern e_vector vectors[]; #define VEC_FPUNSUP (55) #define VEC_UNIMPEA (60) #define VEC_UNIMPII (61) +#define VEC_USER (64) #define VECOFF(vec) ((vec)<<2) +#ifndef __ASSEMBLY__ + /* Status register bits */ #define PS_T (0x8000) #define PS_S (0x2000) @@ -238,4 +245,6 @@ struct frame { } un; }; +#endif /* __ASSEMBLY__ */ + #endif /* _M68K_TRAPS_H */ diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h index a477bce01..aa1b4494f 100644 --- a/include/asm-m68k/uaccess.h +++ b/include/asm-m68k/uaccess.h @@ -184,7 +184,7 @@ __generic_copy_from_user(void *to, const void *from, unsigned long n) " .long 5b,9b\n" ".previous" : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp) - : "r"(n & 3), "0"(to), "1"(from), "2"(n/4) + : "d"(n & 3), "0"(to), "1"(from), "2"(n/4) : "d0", "memory"); return n; } @@ -233,7 +233,8 @@ __generic_copy_to_user(void *to, const void *from, unsigned long n) " .long 5b,8b\n" ".previous" : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp) - : "r"(n & 3), "0"(to), "1"(from), "2"(n / 4)); + : "r"(n & 3), "0"(to), "1"(from), "2"(n / 4) + : "memory"); return n; } @@ -514,7 +515,7 @@ __constant_copy_from_user(void *to, const void *from, unsigned long n) "13:" \ : "=a"(to), "=a"(from), "=d"(n) \ : "0"(to), "1"(from), "2"(n/4) \ - : "d0") + : "d0", "memory") static inline unsigned long __constant_copy_to_user(void *to, const void *from, unsigned long n) diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h index 2ad5c196c..4180f3df7 100644 --- a/include/asm-m68k/unistd.h +++ b/include/asm-m68k/unistd.h @@ -193,6 +193,7 @@ #define __NR_sendfile 187 #define __NR_getpmsg 188 /* some people actually want streams */ #define __NR_putpmsg 189 /* some people actually want streams */ +#define __NR_vfork 190 /* user-visible error numbers are in the range -1 - -122: see <asm-m68k/errno.h> */ @@ -323,49 +324,6 @@ static inline _syscall1(int,_exit,int,exitcode) static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) static inline _syscall1(int,delete_module,const char *,name) -/* - * This is the mechanism for creating a new kernel thread. - * - * NOTE! Only a kernel-only process(ie the swapper or direct descendants - * who haven't done an "execve()") should use this: it will work within - * a system call from a "real" process, but the process memory space will - * not be free'd until both the parent and the child have exited. - */ -static inline pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) -{ - pid_t pid; - mm_segment_t fs; - - fs = get_fs(); - set_fs (KERNEL_DS); - - { - register long retval __asm__ ("d0"); - register long clone_arg __asm__ ("d1") = flags | CLONE_VM; - - __asm__ __volatile__ - ("clrl %%d2\n\t" - "trap #0\n\t" /* Linux/m68k system call */ - "tstl %0\n\t" /* child or parent */ - "jne 1f\n\t" /* parent - jump */ - "lea %%sp@(-8192),%6\n\t" /* reload current */ - "movel %3,%%sp@-\n\t" /* push argument */ - "jsr %4@\n\t" /* call fn */ - "movel %0,%%d1\n\t" /* pass exit value */ - "movel %2,%0\n\t" /* exit */ - "trap #0\n" - "1:" - : "=d" (retval) - : "0" (__NR_clone), "i" (__NR_exit), - "r" (arg), "a" (fn), "d" (clone_arg), "r" (current) - : "d0", "d2"); - pid = retval; - } - - set_fs (fs); - return pid; -} - static inline pid_t wait(int * wait_stat) { return waitpid(-1,wait_stat,0); diff --git a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h index 1e942b9e5..8162a4979 100644 --- a/include/asm-m68k/virtconvert.h +++ b/include/asm-m68k/virtconvert.h @@ -18,7 +18,7 @@ * Change virtual addresses to physical addresses and vv. */ extern unsigned long mm_vtop(unsigned long addr) __attribute__ ((const)); -extern unsigned long mm_vtop_fallback (unsigned long); +extern unsigned long mm_vtop_fallback (unsigned long) __attribute__ ((const)); extern unsigned long mm_ptov(unsigned long addr) __attribute__ ((const)); #ifdef CONFIG_SINGLE_MEMORY_CHUNK diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h index ffdd577cd..af1a8f171 100644 --- a/include/asm-mips/elf.h +++ b/include/asm-mips/elf.h @@ -1,5 +1,5 @@ /* - * $Id: elf.h,v 1.4 1997/12/16 05:36:40 ralf Exp $ + * $Id: elf.h,v 1.5 1998/03/17 22:16:13 ralf Exp $ */ #ifndef __ASM_MIPS_ELF_H #define __ASM_MIPS_ELF_H @@ -53,10 +53,20 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; #define ELF_PLATFORM (NULL) -/* See comments in asm-alpha/elf.h, this is the same thing +/* + * See comments in asm-alpha/elf.h, this is the same thing * on the MIPS. */ -#define ELF_PLAT_INIT(_r) _r->regs[2] = 0; +#define ELF_PLAT_INIT(_r) do { \ + _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0; \ + _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0; \ + _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0; \ + _r->regs[13] = _r->regs[14] = _r->regs[15] = _r->regs[16] = 0; \ + _r->regs[17] = _r->regs[18] = _r->regs[19] = _r->regs[20] = 0; \ + _r->regs[21] = _r->regs[22] = _r->regs[23] = _r->regs[24] = 0; \ + _r->regs[25] = _r->regs[26] = _r->regs[27] = _r->regs[28] = 0; \ + _r->regs[30] = _r->regs[31] = 0; \ +} while (0) /* This is the location that an ET_DYN program is loaded if exec'ed. Typical use of this is to invoke "./ld.so someprog" to test out a new version of diff --git a/include/asm-mips/init.h b/include/asm-mips/init.h index 3dd2f614d..0f99681b7 100644 --- a/include/asm-mips/init.h +++ b/include/asm-mips/init.h @@ -1,11 +1,10 @@ -/* - * include/asm-mips/init.h +/* $Id: init.h,v 1.2 1998/04/05 11:25:06 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. * - * $Id: init.h,v 1.2 1998/03/27 08:54:04 ralf Exp $ + * Copyright 1998, 1999 Ralf Baechle */ #ifndef __MIPS_INIT_H #define __MIPS_INIT_H @@ -26,5 +25,6 @@ #define __INIT .section .text.init,"ax" #define __FINIT .previous #define __INITDATA .section .data.init,"a" +#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES))) #endif /* __MIPS_INIT_H */ diff --git a/include/asm-mips/ipc.h b/include/asm-mips/ipc.h index 3288c1e28..006d47307 100644 --- a/include/asm-mips/ipc.h +++ b/include/asm-mips/ipc.h @@ -24,6 +24,9 @@ struct ipc_kludge { #define SHMGET 23 #define SHMCTL 24 +/* Used by the DIPC package, try and avoid reusing it */ +#define DIPC 25 + #define IPCCALL(version,op) ((version)<<16 | (op)) #endif /* __ASM_MIPS_IPC_H */ diff --git a/include/asm-mips/offset.h b/include/asm-mips/offset.h index 6f7a5b019..73ec088ba 100644 --- a/include/asm-mips/offset.h +++ b/include/asm-mips/offset.h @@ -78,9 +78,9 @@ #define THREAD_OLDCTX 912 /* Linux mm_struct offsets. */ -#define MM_COUNT 12 -#define MM_PGD 8 -#define MM_CONTEXT 32 +#define MM_COUNT 16 +#define MM_PGD 12 +#define MM_CONTEXT 36 /* Linux sigcontext offsets. */ #define SC_REGMASK 0 diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index 3cc620222..e21766bb0 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.16 1998/08/28 23:24:03 tsbogend Exp $ +/* $Id: pgtable.h,v 1.17 1998/09/16 21:37:38 tsbogend 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 @@ -580,9 +580,9 @@ extern void (*update_mmu_cache)(struct vm_area_struct *vma, /* * Kernel with 32 bit address space */ -#define SWP_TYPE(entry) (((entry) >> 8) & 0x7f) -#define SWP_OFFSET(entry) ((entry) >> 15) -#define SWP_ENTRY(type,offset) (((type) << 8) | ((offset) << 15)) +#define SWP_TYPE(entry) (((entry) >> 1) & 0x3f) +#define SWP_OFFSET(entry) ((entry) >> 8) +#define SWP_ENTRY(type,offset) (((type) << 1) | ((offset) << 8)) #define module_map vmalloc #define module_unmap vfree diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h index a1e8aa831..96dd34c91 100644 --- a/include/asm-mips/processor.h +++ b/include/asm-mips/processor.h @@ -1,4 +1,4 @@ -/* $Id: processor.h,v 1.13 1998/10/14 23:40:47 ralf Exp $ +/* $Id: processor.h,v 1.14 1999/01/04 16:09:25 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 @@ -139,8 +139,8 @@ struct thread_struct { #endif /* !defined (_LANGUAGE_ASSEMBLY) */ -#define INIT_MMAP { &init_mm, KSEG0, KSEG1, PAGE_SHARED, \ - VM_READ | VM_WRITE | VM_EXEC, NULL, &init_mm.mmap } +#define INIT_MMAP { &init_mm, KSEG0, KSEG1, NULL, PAGE_SHARED, \ + VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } #define INIT_TSS { \ /* \ @@ -179,6 +179,7 @@ extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); /* Copy and release all segment info associated with a VM */ #define copy_segments(nr, p, mm) do { } while(0) #define release_segments(mm) do { } while(0) +#define forget_segments() do { } while (0) /* * Return saved PC of a blocked thread. diff --git a/include/asm-mips/semaphore.h b/include/asm-mips/semaphore.h index aff081776..b1ac4ecce 100644 --- a/include/asm-mips/semaphore.h +++ b/include/asm-mips/semaphore.h @@ -43,7 +43,7 @@ static inline void wake_one_more(struct semaphore * sem) atomic_inc(&sem->waking); } -static inline int waking_non_zero(struct semaphore *sem) +static inline int waking_non_zero(struct semaphore *sem, struct task_struct *tsk) { int ret, tmp; diff --git a/include/asm-mips/softirq.h b/include/asm-mips/softirq.h index fa72d0d78..3c38ecf7b 100644 --- a/include/asm-mips/softirq.h +++ b/include/asm-mips/softirq.h @@ -1,10 +1,10 @@ -/* $Id: softirq.h,v 1.3 1998/03/22 23:27:19 ralf Exp $ +/* $Id: softirq.h,v 1.4 1998/09/19 19:19:39 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) 1997, 1998 by Ralf Baechle + * Copyright (C) 1997, 1998, 1999 by Ralf Baechle */ #ifndef __ASM_MIPS_SOFTIRQ_H #define __ASM_MIPS_SOFTIRQ_H @@ -37,14 +37,15 @@ static inline void clear_active_bhs(unsigned long x) extern inline void init_bh(int nr, void (*routine)(void)) { bh_base[nr] = routine; - bh_mask_count[nr] = 0; + atomic_set(&bh_mask_count[nr], 0); bh_mask |= 1 << nr; } extern inline void remove_bh(int nr) { - bh_base[nr] = NULL; bh_mask &= ~(1 << nr); + mb(); + bh_base[nr] = NULL; } extern inline void mark_bh(int nr) @@ -59,12 +60,12 @@ extern inline void mark_bh(int nr) extern inline void disable_bh(int nr) { bh_mask &= ~(1 << nr); - bh_mask_count[nr]++; + atomic_inc(&bh_mask_count[nr]); } extern inline void enable_bh(int nr) { - if (!--bh_mask_count[nr]) + if (atomic_dec_and_test(&bh_mask_count[nr])) bh_mask |= 1 << nr; } diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h index c16163a32..49f5f2aad 100644 --- a/include/asm-mips/system.h +++ b/include/asm-mips/system.h @@ -1,4 +1,4 @@ -/* $Id: system.h,v 1.8 1998/07/20 17:52:21 ralf Exp $ +/* $Id: system.h,v 1.7 1998/08/25 09:22:03 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 @@ -107,6 +107,9 @@ __restore_flags(int flags) #define save_and_cli(x) __save_and_cli(x) #define restore_flags(x) __restore_flags(x) +/* + * These are probably defined overly paranoid ... + */ #define mb() \ __asm__ __volatile__( \ "# prevent instructions being moved around\n\t" \ @@ -117,6 +120,8 @@ __asm__ __volatile__( \ : /* no output */ \ : /* no input */ \ : "memory") +#define rmb() mb() +#define wmb() mb() #if !defined (_LANGUAGE_ASSEMBLY) /* diff --git a/include/asm-mips/termbits.h b/include/asm-mips/termbits.h index fbce44aee..ccf5e85ec 100644 --- a/include/asm-mips/termbits.h +++ b/include/asm-mips/termbits.h @@ -153,10 +153,21 @@ struct termios { #define CLOCAL 0004000 /* Ignore modem status lines. */ #if defined (__USE_BSD) || defined (__KERNEL__) #define CBAUDEX 0010000 -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 #define CIBAUD 002003600000 /* input baud rate (not used) */ #define CMSPAR 010000000000 /* mark or space (stick) parity */ #define CRTSCTS 020000000000 /* flow control */ diff --git a/include/asm-mips/termios.h b/include/asm-mips/termios.h index 4a6553c17..62e3882a3 100644 --- a/include/asm-mips/termios.h +++ b/include/asm-mips/termios.h @@ -96,6 +96,8 @@ struct termio { #define N_MASC 8 /* Reserved fo Mobitex module <kaz@cafe.net> */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ +#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #ifdef __KERNEL__ diff --git a/include/asm-mips/timex.h b/include/asm-mips/timex.h index dd4aea511..2bec751a4 100644 --- a/include/asm-mips/timex.h +++ b/include/asm-mips/timex.h @@ -1,10 +1,10 @@ -/* $Id: timex.h,v 1.1 1998/08/17 10:20:18 ralf Exp $ +/* $Id: timex.h,v 1.1 1998/08/25 09:22:03 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) 1998 by Ralf Baechle + * Copyright (C) 1998, 1999 by Ralf Baechle * * FIXME: For some of the supported machines this is dead wrong. */ @@ -17,4 +17,23 @@ (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ << (SHIFT_SCALE-SHIFT_HZ)) / HZ) +/* + * Standard way to access the cycle counter. + * Currently only used on SMP for scheduling. + * + * Only the low 32 bits are available as a continuously counting entity. + * But this only means we'll force a reschedule every 8 seconds or so, + * which isn't an evil thing. + * + * We know that all SMP capable CPUs have cycle counters. + */ + +typedef unsigned int cycles_t; +extern cycles_t cacheflush_time; + +static inline cycles_t get_cycles (void) +{ + return read_32bit_cp0_register(CP0_COUNT); +} + #endif /* __ASM_MIPS_TIMEX_H */ diff --git a/include/asm-ppc/amigappc.h b/include/asm-ppc/amigappc.h index 5546cb1fb..bea284b2d 100644 --- a/include/asm-ppc/amigappc.h +++ b/include/asm-ppc/amigappc.h @@ -16,20 +16,20 @@ #ifndef __ASSEMBLY__ -#ifndef iobarrier /* Don't include io.h - avoid circular dependency */ -#define iobarrier() eieio() +#ifndef iobarrier_rw /* Don't include io.h - avoid circular dependency */ +#define iobarrier_rw() eieio() #endif #define APUS_WRITE(_a_, _v_) \ do { \ (*((volatile unsigned char *)(_a_)) = (_v_)); \ - iobarrier (); \ + iobarrier_rw (); \ } while (0) #define APUS_READ(_a_, _v_) \ do { \ (_v_) = (*((volatile unsigned char *)(_a_))); \ - iobarrier (); \ + iobarrier_rw (); \ } while (0) #endif /* ndef __ASSEMBLY__ */ diff --git a/include/asm-ppc/bitops.h b/include/asm-ppc/bitops.h index 9e0614ae2..95b59cafc 100644 --- a/include/asm-ppc/bitops.h +++ b/include/asm-ppc/bitops.h @@ -1,5 +1,5 @@ /* - * $Id: bitops.h,v 1.10 1998/08/16 21:56:53 geert Exp $ + * $Id: bitops.h,v 1.11 1999/01/03 20:16:48 cort Exp $ * bitops.h: Bit string operations on the ppc */ @@ -16,6 +16,16 @@ extern int test_and_set_bit(int nr, volatile void *addr); extern int test_and_clear_bit(int nr, volatile void *addr); extern int test_and_change_bit(int nr, volatile void *addr); + +/* Returns the number of 0's to the left of the most significant 1 bit */ +extern __inline__ int cntlzw(int bits) +{ + int lz; + + asm ("cntlzw %0,%1" : "=r" (lz) : "r" (bits)); + return lz; +} + /* * These are if'd out here because using : "cc" as a constraint * results in errors from gcc. -- Cort diff --git a/include/asm-ppc/checksum.h b/include/asm-ppc/checksum.h index 1c18664bc..e635ff599 100644 --- a/include/asm-ppc/checksum.h +++ b/include/asm-ppc/checksum.h @@ -83,13 +83,13 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, unsigned int sum) { __asm__(" - add %0,%0,%1 - add %0,%0,%2 - add %0,%0,%0 - addi %0,%0,0 + addc %0,%0,%1 + adde %0,%0,%2 + adde %0,%0,%3 + addze %0,%0 " : "=r" (sum) - : "r" (daddr), "r"(saddr), "r"((ntohs(len)<<16)+proto*256), "0"(sum)); + : "r" (daddr), "r"(saddr), "r"((proto<<16)+len), "0"(sum)); return sum; } diff --git a/include/asm-ppc/dma.h b/include/asm-ppc/dma.h index 8560c7d88..b817e055a 100644 --- a/include/asm-ppc/dma.h +++ b/include/asm-ppc/dma.h @@ -204,6 +204,7 @@ extern long ppc_cs4232_dma, ppc_cs4232_dma2; #define DMA2_EXT_REG 0x4D6 #define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */ +#define DMA_AUTOINIT 0x10 extern spinlock_t dma_spin_lock; @@ -393,4 +394,10 @@ static __inline__ int get_dma_residue(unsigned int dmanr) extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */ extern void free_dma(unsigned int dmanr); /* release it again */ +#ifdef CONFIG_PCI_QUIRKS +extern int isa_dma_bridge_buggy; +#else +#define isa_dma_bridge_buggy (0) +#endif + #endif /* _ASM_DMA_H */ diff --git a/include/asm-ppc/ide.h b/include/asm-ppc/ide.h index 75f77641c..cad526b12 100644 --- a/include/asm-ppc/ide.h +++ b/include/asm-ppc/ide.h @@ -80,8 +80,11 @@ extern void chrp_ide_probe(void); static __inline__ int ide_default_irq(ide_ioreg_t base) { - if ( (_machine == _MACH_Pmac) || (_machine == _MACH_mbx) ) + if ( _machine == _MACH_Pmac ) return 0; + else if ( _machine == _MACH_mbx ) + /* hardcode IRQ 14 on the MBX */ + return 14+16; else if ( _machine == _MACH_chrp) { if (chrp_ide_ports_known == 0) chrp_ide_probe(); @@ -142,7 +145,7 @@ static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent } /* Convert the shorts/longs in hd_driveid from little to big endian; - chars are endian independant, of course, but strings need to be flipped. + chars are endian independent, of course, but strings need to be flipped. (Despite what it says in drivers/block/ide.h, they come up as little endian...) Changes to linux/hdreg.h may require changes here. */ static __inline__ void ide_fix_driveid (struct hd_driveid *id) { @@ -200,26 +203,66 @@ static __inline__ void ide_fix_driveid (struct hd_driveid *id) { id->word79 = __le16_to_cpu(id->word79); id->word80 = __le16_to_cpu(id->word80); id->word81 = __le16_to_cpu(id->word81); - id->word82 = __le16_to_cpu(id->word82); + id->command_sets = __le16_to_cpu(id->command_sets); id->word83 = __le16_to_cpu(id->word83); id->word84 = __le16_to_cpu(id->word84); id->word85 = __le16_to_cpu(id->word85); id->word86 = __le16_to_cpu(id->word86); id->word87 = __le16_to_cpu(id->word87); id->dma_ultra = __le16_to_cpu(id->dma_ultra); - for (i=0; i<167; i++) + id->word89 = __le16_to_cpu(id->word89); + id->word90 = __le16_to_cpu(id->word90); + id->word91 = __le16_to_cpu(id->word91); + id->word92 = __le16_to_cpu(id->word92); + id->word93 = __le16_to_cpu(id->word93); + id->word94 = __le16_to_cpu(id->word94); + id->word95 = __le16_to_cpu(id->word95); + id->word96 = __le16_to_cpu(id->word96); + id->word97 = __le16_to_cpu(id->word97); + id->word98 = __le16_to_cpu(id->word98); + id->word99 = __le16_to_cpu(id->word99); + id->word100 = __le16_to_cpu(id->word100); + id->word101 = __le16_to_cpu(id->word101); + id->word102 = __le16_to_cpu(id->word102); + id->word103 = __le16_to_cpu(id->word103); + id->word104 = __le16_to_cpu(id->word104); + id->word105 = __le16_to_cpu(id->word105); + id->word106 = __le16_to_cpu(id->word106); + id->word107 = __le16_to_cpu(id->word107); + id->word108 = __le16_to_cpu(id->word108); + id->word109 = __le16_to_cpu(id->word109); + id->word110 = __le16_to_cpu(id->word110); + id->word111 = __le16_to_cpu(id->word111); + id->word112 = __le16_to_cpu(id->word112); + id->word113 = __le16_to_cpu(id->word113); + id->word114 = __le16_to_cpu(id->word114); + id->word115 = __le16_to_cpu(id->word115); + id->word116 = __le16_to_cpu(id->word116); + id->word117 = __le16_to_cpu(id->word117); + id->word118 = __le16_to_cpu(id->word118); + id->word119 = __le16_to_cpu(id->word119); + id->word120 = __le16_to_cpu(id->word120); + id->word121 = __le16_to_cpu(id->word121); + id->word122 = __le16_to_cpu(id->word122); + id->word123 = __le16_to_cpu(id->word123); + id->word124 = __le16_to_cpu(id->word124); + id->word125 = __le16_to_cpu(id->word125); + id->word126 = __le16_to_cpu(id->word126); + id->word127 = __le16_to_cpu(id->word127); + id->security = __le16_to_cpu(id->security); + for (i=0; i<127; i++) id->reserved[i] = __le16_to_cpu(id->reserved[i]); } } - #undef insw #define insw(port, buf, ns) do { \ if ( _machine == _MACH_chrp) {\ ide_insw((port)+_IO_BASE, (buf), (ns)); \ }\ else if ( (_machine == _MACH_Pmac) || (_machine == _MACH_mbx) ) \ - ide_insw((port), (buf), (ns)); \ + ide_insw((port)+((_machine==_MACH_mbx)? 0x80000000: 0), \ + (buf), (ns)); \ else \ /* this must be the same as insw in io.h!! */ \ _insw((unsigned short *)((port)+_IO_BASE), (buf), (ns)); \ @@ -230,8 +273,9 @@ static __inline__ void ide_fix_driveid (struct hd_driveid *id) { if ( _machine == _MACH_chrp) {\ ide_outsw((port)+_IO_BASE, (buf), (ns)); \ }\ - else if ( (_machine == _MACH_Pmac) || (_machine == _MACH_mbx) ) \ - ide_outsw((port), (buf), (ns)); \ + else if ( (_machine == _MACH_Pmac) || (_machine == _MACH_mbx) ) \ + ide_outsw((port)+((_machine==_MACH_mbx)? 0x80000000: 0), \ + (buf), (ns)); \ else \ /* this must be the same as outsw in io.h!! */ \ _outsw((unsigned short *)((port)+_IO_BASE), (buf), (ns)); \ @@ -239,13 +283,17 @@ static __inline__ void ide_fix_driveid (struct hd_driveid *id) { #undef inb #define inb(port) \ - in_8((unsigned char *)((port) + ((_machine==_MACH_Pmac)? 0: _IO_BASE))) + in_8((unsigned char *)((port) + \ + ((_machine==_MACH_Pmac)? 0: _IO_BASE) + \ + ((_machine==_MACH_mbx)? 0x80000000: 0)) ) #undef inb_p #define inb_p(port) inb(port) #undef outb #define outb(val, port) \ - out_8((unsigned char *)((port) + ((_machine==_MACH_Pmac)? 0: _IO_BASE)), (val)) + out_8((unsigned char *)((port) + \ + ((_machine==_MACH_Pmac)? 0: _IO_BASE) + \ + ((_machine==_MACH_mbx)? 0x80000000: 0)), (val) ) #undef outb_p #define outb_p(val, port) outb(val, port) diff --git a/include/asm-ppc/init.h b/include/asm-ppc/init.h index ea24bbab7..5ee43593c 100644 --- a/include/asm-ppc/init.h +++ b/include/asm-ppc/init.h @@ -31,6 +31,9 @@ #define __FINIT .previous #define __INITDATA .section ".data.init",#alloc,#write +#define __cacheline_aligned __attribute__ \ + ((__section__ (".data.cacheline_aligned"))) + #else /* not egcs */ #define __init @@ -52,5 +55,7 @@ #define __openfirmware #define __openfirmwaredata #define __openfirmwarefunc(x) x + +#define __cacheline_aligned #endif /* egcs */ #endif diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h index da5219e39..b6b80c4ea 100644 --- a/include/asm-ppc/io.h +++ b/include/asm-ppc/io.h @@ -192,7 +192,13 @@ extern inline void eieio(void) { __asm__ __volatile__ ("eieio" : : : "memory"); } -#define iobarrier() eieio() + +/* Enforce in-order execution of data I/O. + * No distinction between read/write on PPC; use eieio for all three. + */ +#define iobarrier_rw() eieio() +#define iobarrier_r() eieio() +#define iobarrier_w() eieio() /* * 8, 16 and 32 bit, big and little endian I/O operations, with barrier. diff --git a/include/asm-ppc/mmu_context.h b/include/asm-ppc/mmu_context.h index 5b2bdc932..50fa27081 100644 --- a/include/asm-ppc/mmu_context.h +++ b/include/asm-ppc/mmu_context.h @@ -38,7 +38,7 @@ #define MUNGE_CONTEXT(n) (((n) * 897) & LAST_CONTEXT) #endif -extern int next_mmu_context; +extern atomic_t next_mmu_context; extern void mmu_context_overflow(void); #ifndef CONFIG_8xx @@ -54,9 +54,9 @@ extern void set_context(int context); do { \ struct mm_struct *mm = (tsk)->mm; \ if (mm->context == NO_CONTEXT) { \ - if (next_mmu_context == LAST_CONTEXT) \ + if (atomic_read(&next_mmu_context) == LAST_CONTEXT) \ mmu_context_overflow(); \ - mm->context = MUNGE_CONTEXT(++next_mmu_context);\ + mm->context = MUNGE_CONTEXT(atomic_inc_return(&next_mmu_context));\ } \ } while (0) diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index d0c0673b3..9e8e36d60 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h @@ -121,6 +121,7 @@ extern pte_t *va_to_pte(struct task_struct *tsk, unsigned long address); #define _PAGE_DIRTY 0x080 /* C: page changed */ #define _PAGE_ACCESSED 0x100 /* R: page referenced */ #define _PAGE_HWWRITE 0x200 /* software: _PAGE_RW & _PAGE_DIRTY */ +#define _PAGE_SHARED 0 #else #define _PAGE_PRESENT 0x0001 /* Page is valid */ @@ -147,28 +148,23 @@ extern pte_t *va_to_pte(struct task_struct *tsk, unsigned long address); #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) +#ifdef __SMP__ +#define _PAGE_BASE _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT +#else +#define _PAGE_BASE _PAGE_PRESENT | _PAGE_ACCESSED +#endif +#define _PAGE_WRENABLE _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE + #define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) -#ifndef CONFIG_8xx -#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \ - _PAGE_ACCESSED) -#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) -#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) -#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | \ - _PAGE_HWWRITE | _PAGE_ACCESSED) -#define PAGE_KERNEL_CI __pgprot(_PAGE_PRESENT | _PAGE_NO_CACHE | _PAGE_RW | \ - _PAGE_HWWRITE | _PAGE_DIRTY | _PAGE_ACCESSED) -#else -#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \ - _PAGE_ACCESSED | _PAGE_SHARED) -#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) -#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) -#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | \ - _PAGE_SHARED | _PAGE_ACCESSED) -#define PAGE_KERNEL_CI __pgprot(_PAGE_PRESENT | _PAGE_NO_CACHE | _PAGE_RW | \ - _PAGE_SHARED | _PAGE_DIRTY | _PAGE_ACCESSED) -#endif /* CONFIG_8xx */ - +#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER | \ + _PAGE_SHARED) +#define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_USER) +#define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_USER) +#define PAGE_KERNEL __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_SHARED) +#define PAGE_KERNEL_CI __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_SHARED | \ + _PAGE_NO_CACHE ) + /* * The PowerPC can only do execute protection on a segment (256MB) basis, * not on a page basis. So we consider execute permission the same as read. @@ -230,7 +226,7 @@ extern unsigned long empty_zero_page[1024]; do { \ unsigned long __pgdir = (unsigned long)pgdir; \ ((tsk)->tss.pg_tables = (unsigned long *)(__pgdir)); \ - asm("mtspr %0,%1 \n\t" :: "i"(M_TWB), "r"(__pa(__pgdir))); \ + asm("mtspr %0,%1 \n\t" : : "i"(M_TWB), "r"(__pa(__pgdir))); \ } while (0) #endif /* CONFIG_8xx */ @@ -641,5 +637,7 @@ extern void kernel_set_cachemode (unsigned long address, unsigned long size, /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ #define PageSkip(page) (0) +#define kern_addr_valid(addr) (1) + #endif __ASSEMBLY__ #endif /* _PPC_PGTABLE_H */ diff --git a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h index a3e06e566..de8f12e5b 100644 --- a/include/asm-ppc/processor.h +++ b/include/asm-ppc/processor.h @@ -286,8 +286,9 @@ struct thread_struct { * Note: the vm_start and vm_end fields here should *not* * be in kernel space. (Could vm_end == vm_start perhaps?) */ -#define INIT_MMAP { &init_mm, 0, 0x1000, \ - PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC } +#define INIT_MMAP { &init_mm, 0, 0x1000, NULL, \ + PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, \ + 1, NULL, NULL } /* * Return saved PC of a blocked thread. For now, this is the "user" PC @@ -299,6 +300,7 @@ static inline unsigned long thread_saved_pc(struct thread_struct *t) #define copy_segments(nr, tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) +#define forget_segments() do { } while (0) /* * NOTE! The task struct and the stack go together diff --git a/include/asm-ppc/resource.h b/include/asm-ppc/resource.h index 4555502a2..674e6d6f1 100644 --- a/include/asm-ppc/resource.h +++ b/include/asm-ppc/resource.h @@ -21,7 +21,7 @@ {LONG_MAX, LONG_MAX}, /* RLIMIT_CPU */ \ {LONG_MAX, LONG_MAX}, /* RLIMIT_FSIZE */ \ {LONG_MAX, LONG_MAX}, /* RLIMIT_DATA */ \ - {_STK_LIM, _STK_LIM}, /* RLIMIT_STACK */ \ + {_STK_LIM, LONG_MAX}, /* RLIMIT_STACK */ \ { 0, LONG_MAX}, /* RLIMIT_CORE */ \ {LONG_MAX, LONG_MAX}, /* RLIMIT_RSS */ \ {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, /* RLIMIT_NPROC */ \ diff --git a/include/asm-ppc/semaphore.h b/include/asm-ppc/semaphore.h index f6a2a59f2..a78c203d2 100644 --- a/include/asm-ppc/semaphore.h +++ b/include/asm-ppc/semaphore.h @@ -37,7 +37,7 @@ static inline void wake_one_more(struct semaphore * sem) atomic_inc(&sem->waking); } -static inline int waking_non_zero(struct semaphore *sem) +static inline int waking_non_zero(struct semaphore *sem, struct task_struct *tsk) { int ret, tmp; diff --git a/include/asm-ppc/softirq.h b/include/asm-ppc/softirq.h index 739b22580..e2064f07d 100644 --- a/include/asm-ppc/softirq.h +++ b/include/asm-ppc/softirq.h @@ -12,7 +12,7 @@ extern unsigned int local_bh_count[NR_CPUS]; extern inline void init_bh(int nr, void (*routine)(void)) { bh_base[nr] = routine; - bh_mask_count[nr] = 0; + atomic_set(&bh_mask_count[nr], 0); bh_mask |= 1 << nr; } @@ -96,13 +96,13 @@ extern inline void end_bh_atomic(void) extern inline void disable_bh(int nr) { bh_mask &= ~(1 << nr); - bh_mask_count[nr]++; + atomic_inc(&bh_mask_count[nr]); synchronize_bh(); } extern inline void enable_bh(int nr) { - if (!--bh_mask_count[nr]) + if (atomic_dec_and_test(&bh_mask_count[nr])) bh_mask |= 1 << nr; } diff --git a/include/asm-ppc/spinlock.h b/include/asm-ppc/spinlock.h index 55e6bd16f..c048dbc1a 100644 --- a/include/asm-ppc/spinlock.h +++ b/include/asm-ppc/spinlock.h @@ -3,12 +3,23 @@ #ifndef __SMP__ -typedef struct { } spinlock_t; -#define SPIN_LOCK_UNLOCKED { } +/* + * Your basic spinlocks, allowing only a single CPU anywhere + * + * Gcc-2.7.x has a nasty bug with empty initializers. + */ +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) + typedef struct { } spinlock_t; + #define SPIN_LOCK_UNLOCKED (spinlock_t) { } +#else + typedef struct { int gcc_is_buggy; } spinlock_t; + #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } +#endif #define spin_lock_init(lock) do { } while(0) #define spin_lock(lock) do { } while(0) #define spin_trylock(lock) do { } while(0) +#define spin_unlock_wait(lock) do { } while(0) #define spin_unlock(lock) do { } while(0) #define spin_lock_irq(lock) cli() #define spin_unlock_irq(lock) sti() @@ -27,9 +38,16 @@ typedef struct { } spinlock_t; * can "mix" irq-safe locks - any writer needs to get a * irq-safe write-lock, but readers can get non-irqsafe * read-locks. + * + * Gcc-2.7.x has a nasty bug with empty initializers. */ -typedef struct { } rwlock_t; -#define RW_LOCK_UNLOCKED { } +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) + typedef struct { } rwlock_t; + #define RW_LOCK_UNLOCKED (rwlock_t) { } +#else + typedef struct { int gcc_is_buggy; } rwlock_t; + #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } +#endif #define read_lock(lock) do { } while(0) #define read_unlock(lock) do { } while(0) @@ -63,8 +81,8 @@ typedef struct { volatile unsigned long owner_cpu; } spinlock_t; -#define SPIN_LOCK_UNLOCKED { 0, 0, 0 } -#define spin_lock_init(lp) do { (lp)->lock = 0; } while(0) +#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 0, 0 } +#define spin_lock_init(lp) do { (lp)->lock = 0; } while(0) #define spin_unlock_wait(lp) do { barrier(); } while((lp)->lock) extern void _spin_lock(spinlock_t *lock); @@ -99,7 +117,7 @@ typedef struct { volatile unsigned long owner_pc; } rwlock_t; -#define RW_LOCK_UNLOCKED { 0, 0 } +#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 } extern void _read_lock(rwlock_t *rw); extern void _read_unlock(rwlock_t *rw); diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h index 32d01e7f2..5a1740847 100644 --- a/include/asm-ppc/system.h +++ b/include/asm-ppc/system.h @@ -5,7 +5,15 @@ #include <asm/processor.h> #include <asm/atomic.h> +/* + * Memory barrier. + * The sync instruction guarantees that all memory accesses initiated + * by this processor have been performed (with respect to all other + * mechanisms that access memory). + */ #define mb() __asm__ __volatile__ ("sync" : : : "memory") +#define rmb() __asm__ __volatile__ ("sync" : : : "memory") +#define wmb() __asm__ __volatile__ ("sync" : : : "memory") #define __save_flags(flags) ({\ __asm__ __volatile__ ("mfmsr %0" : "=r" ((flags)) : : "memory"); }) diff --git a/include/asm-ppc/termbits.h b/include/asm-ppc/termbits.h index df1014281..0d387ca10 100644 --- a/include/asm-ppc/termbits.h +++ b/include/asm-ppc/termbits.h @@ -126,6 +126,17 @@ struct termios { #define B115200 00021 #define B230400 00022 #define B460800 00023 +#define B500000 00024 +#define B576000 00025 +#define B921600 00026 +#define B1000000 00027 +#define B1152000 00030 +#define B1500000 00031 +#define B2000000 00032 +#define B2500000 00033 +#define B3000000 00034 +#define B3500000 00035 +#define B4000000 00036 #define CSIZE 00001400 #define CS5 00000000 diff --git a/include/asm-ppc/termios.h b/include/asm-ppc/termios.h index c6385d4a7..13b3591b8 100644 --- a/include/asm-ppc/termios.h +++ b/include/asm-ppc/termios.h @@ -182,6 +182,8 @@ struct termio { #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ +#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #ifdef __KERNEL__ diff --git a/include/asm-ppc/timex.h b/include/asm-ppc/timex.h index a20f6031c..4fac4ea39 100644 --- a/include/asm-ppc/timex.h +++ b/include/asm-ppc/timex.h @@ -12,4 +12,28 @@ (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ << (SHIFT_SCALE-SHIFT_HZ)) / HZ) +typedef unsigned long cycles_t; + +/* + * For the "cycle" counter we use the timebase lower half. + * Currently only used on SMP. + * + * Since SMP kernels won't run on the PPC601 CPU (which doesn't have + * the timebase register) anyway, we don't bother checking the CPU version. + */ + +extern cycles_t cacheflush_time; + +static inline cycles_t get_cycles(void) +{ +#ifdef __SMP__ + cycles_t ret; + + __asm__("mftb %0" : "=r" (ret) : ); + return ret; +#else + return 0; +#endif +} + #endif diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h index 57e46e7b0..14513a0b6 100644 --- a/include/asm-sparc/page.h +++ b/include/asm-sparc/page.h @@ -19,7 +19,6 @@ #ifdef __KERNEL__ -#include <linux/config.h> #include <asm/head.h> /* for KERNBASE */ #include <asm/btfixup.h> diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h index 6f34d510b..14a4621dd 100644 --- a/include/asm-sparc/processor.h +++ b/include/asm-sparc/processor.h @@ -148,6 +148,7 @@ extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc, #define copy_segments(nr, tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) +#define forget_segments() do { } while (0) #ifdef __KERNEL__ diff --git a/include/asm-sparc/semaphore.h b/include/asm-sparc/semaphore.h index 2832f8ed4..e9b490a5a 100644 --- a/include/asm-sparc/semaphore.h +++ b/include/asm-sparc/semaphore.h @@ -30,7 +30,7 @@ do { \ restore_flags(flags); \ } while(0) -#define waking_non_zero(sem) \ +#define waking_non_zero(sem,tsk)\ ({ unsigned long flags; \ int ret = 0; \ save_and_cli(flags); \ diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h index aeefe28e4..d00d6558c 100644 --- a/include/asm-sparc/termios.h +++ b/include/asm-sparc/termios.h @@ -66,6 +66,8 @@ struct winsize { #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ +#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #ifdef __KERNEL__ diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index d1d319bab..c074344a4 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h @@ -371,7 +371,7 @@ extern __inline__ pgd_t *get_pgd_fast(void) (unsigned long)ret->pprev_hash = mask; if (!mask) pgd_quicklist = (unsigned long *)ret->next_hash; - ret = (struct page *)(PAGE_OFFSET + (ret->map_nr << PAGE_SHIFT) + off); + ret = (struct page *) (page_address(ret) + off); pgd_cache_size--; } else { ret = (struct page *) __get_free_page(GFP_KERNEL); diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h index a2574758a..f5b7b9e91 100644 --- a/include/asm-sparc64/processor.h +++ b/include/asm-sparc64/processor.h @@ -208,6 +208,7 @@ do { \ #define copy_segments(nr, tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0) +#define forget_segments() do { } while (0) #ifdef __KERNEL__ /* Allocation and freeing of task_struct and kernel stack. */ diff --git a/include/asm-sparc64/semaphore.h b/include/asm-sparc64/semaphore.h index b0eb13911..48d96f23d 100644 --- a/include/asm-sparc64/semaphore.h +++ b/include/asm-sparc64/semaphore.h @@ -24,7 +24,7 @@ extern void __up(struct semaphore * sem); #define wake_one_more(sem) atomic_inc(&sem->waking); -static __inline__ int waking_non_zero(struct semaphore *sem) +static __inline__ int waking_non_zero(struct semaphore *sem, struct task_struct *tsk) { int ret; diff --git a/include/asm-sparc64/termios.h b/include/asm-sparc64/termios.h index 767722d4c..607ad1440 100644 --- a/include/asm-sparc64/termios.h +++ b/include/asm-sparc64/termios.h @@ -66,6 +66,8 @@ struct winsize { #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ #define N_R3964 9 /* Reserved for Simatic R3964 module */ #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ +#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ +#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ #ifdef __KERNEL__ diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h index 054c59f15..4c0f2e05d 100644 --- a/include/linux/arcdevice.h +++ b/include/linux/arcdevice.h @@ -192,7 +192,7 @@ extern int arcnet_debug; -#define JIFFER(time) for (delayval=jiffies+time; jiffies<delayval;) ; +#define JIFFER(time) for (delayval=jiffies+time; time_before(jiffies,delayval);) ; /* a complete ARCnet packet */ union ArcPacket diff --git a/include/linux/atalk.h b/include/linux/atalk.h index 5641129d7..e9d209791 100644 --- a/include/linux/atalk.h +++ b/include/linux/atalk.h @@ -10,7 +10,7 @@ #define ATPORT_FIRST 1 #define ATPORT_RESERVED 128 -#define ATPORT_LAST 255 +#define ATPORT_LAST 254 /* 254 is only legal on localtalk */ #define ATADDR_ANYNET (__u16)0 #define ATADDR_ANYNODE (__u8)0 #define ATADDR_ANYPORT (__u8)0 diff --git a/include/linux/awe_voice.h b/include/linux/awe_voice.h index aa1313131..95fc207da 100644 --- a/include/linux/awe_voice.h +++ b/include/linux/awe_voice.h @@ -2,10 +2,10 @@ * sound/awe_voice.h * * Voice information definitions for the low level driver for the - * AWE32/Sound Blaster 32 wave table synth. - * version 0.4.2c; Oct. 7, 1997 + * AWE32/SB32/AWE64 wave table synth. + * version 0.4.3; Mar. 1, 1998 * - * Copyright (C) 1996,1997 Takashi Iwai + * Copyright (C) 1996-1998 Takashi Iwai * * 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 @@ -55,6 +55,8 @@ typedef struct awe_patch_info { #define AWE_UNLOAD_PATCH 4 /* none */ #define AWE_REPLACE_DATA 5 /* awe_sample_info (optarg=#channels)*/ #define AWE_MAP_PRESET 6 /* awe_voice_map */ +/*#define AWE_PROBE_INFO 7*/ /* awe_voice_map (pat only) */ +#define AWE_PROBE_DATA 8 /* optarg=sample */ #define AWE_LOAD_CHORUS_FX 0x10 /* awe_chorus_fx_rec (optarg=mode) */ #define AWE_LOAD_REVERB_FX 0x11 /* awe_reverb_fx_rec (optarg=mode) */ @@ -88,6 +90,7 @@ typedef struct _awe_open_parm { #define AWE_PAT_TYPE_MAP 7 #define AWE_PAT_LOCKED 0x100 /* lock the samples */ +#define AWE_PAT_SHARED 0x200 /* sample is shared */ short reserved; char name[AWE_PATCH_NAME_LEN]; @@ -126,6 +129,30 @@ typedef struct _awe_voice_parm { unsigned short reserved[4]; /* not used */ } awe_voice_parm; +typedef struct _awe_voice_parm_block { + unsigned short moddelay; /* modulation delay (0x8000) */ + unsigned char modatk, modhld; + unsigned char moddcy, modsus; + unsigned short modrel, moddummy; + short modkeyhold, modkeydecay; /* envelope change per key (not used) */ + unsigned short voldelay; /* volume delay (0x8000) */ + unsigned char volatk, volhld; + unsigned char voldcy, volsus; + unsigned char volrel, voldummy; + short volkeyhold, volkeydecay; /* envelope change per key (not used) */ + unsigned short lfo1delay; /* LFO1 delay (0x8000) */ + unsigned short lfo2delay; /* LFO2 delay (0x8000) */ + unsigned char env1fc, env1pit; + unsigned char lfo1fc, lfo1pit; + unsigned char lfo1freq, lfo1vol; + unsigned char lfo2freq, lfo2pit; + unsigned char cutoff; /* initial cutoff (0xff) */ + unsigned char filterQ; /* initial filter Q [0-15] (0x0) */ + unsigned char chorus; /* chorus send (0x00) */ + unsigned char reverb; /* reverb send (0x00) */ + unsigned short reserved[4]; /* not used */ +} awe_voice_parm_block; + #define AWE_VOICE_PARM_SIZE 48 @@ -419,7 +446,7 @@ enum { /* 0*/ AWE_MD_EXCLUSIVE_OFF, /* obsolete */ /* 1*/ AWE_MD_EXCLUSIVE_ON, /* obsolete */ /* 2*/ AWE_MD_VERSION, /* read only */ -/* 3*/ AWE_MD_EXCLUSIVE_SOUND, /* ignored */ +/* 3*/ AWE_MD_EXCLUSIVE_SOUND, /* 0/1: exclusive note on (default=1) */ /* 4*/ AWE_MD_REALTIME_PAN, /* 0/1: do realtime pan change (default=1) */ /* 5*/ AWE_MD_GUS_BANK, /* bank number for GUS patches (default=0) */ /* 6*/ AWE_MD_KEEP_EFFECT, /* 0/1: keep effect values, (default=0) */ @@ -430,6 +457,13 @@ enum { /*11*/ AWE_MD_DEF_BANK, /* integer: default bank number (def=0) */ /*12*/ AWE_MD_DEF_DRUM, /* integer: default drumset number (def=0) */ /*13*/ AWE_MD_TOGGLE_DRUM_BANK, /* 0/1: toggle drum flag with bank# (def=0) */ +/*14*/ AWE_MD_NEW_VOLUME_CALC, /* 0/1: volume calculation mode (def=1) */ +/*15*/ AWE_MD_CHORUS_MODE, /* integer: chorus mode (def=2) */ +/*16*/ AWE_MD_REVERB_MODE, /* integer: chorus mode (def=4) */ +/*17*/ AWE_MD_BASS_LEVEL, /* integer: bass level (def=5) */ +/*18*/ AWE_MD_TREBLE_LEVEL, /* integer: treble level (def=9) */ +/*19*/ AWE_MD_DEBUG_MODE, /* integer: debug level (def=0) */ +/*20*/ AWE_MD_PAN_EXCHANGE, /* 0/1: exchange panning direction (def=0) */ AWE_MD_END, }; diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 9b8a9c3c6..c63d79037 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -5,8 +5,7 @@ * 1994, 1995 Eberhard Moenkeberg, emoenke@gwdg.de * 1996 David van Leeuwen, david@tm.tno.nl * 1997, 1998 Erik Andersen, andersee@debian.org - * 1998 Jens Axboe, axboe@image.dk and - * Chris Zwilling, chris@cloudnet.com + * 1998, 1999 Jens Axboe, axboe@image.dk */ #ifndef _LINUX_CDROM_H diff --git a/include/linux/coda.h b/include/linux/coda.h index 564b3933b..ac3301c8a 100644 --- a/include/linux/coda.h +++ b/include/linux/coda.h @@ -1,12 +1,63 @@ +/* + You may distribute this file under either of the two licenses that + follow at your discretion. +*/ + +/* BLURB lgpl + + Coda File System + Release 5 + + Copyright (c) 1987-1999 Carnegie Mellon University + Additional copyrights listed below + +This code is distributed "AS IS" without warranty of any kind under +the terms of the GNU Library General Public Licence Version 2, as +shown in the file LICENSE, or under the license shown below. The +technical and financial contributors to Coda are listed in the file +CREDITS. + + Additional copyrights +*/ + +/* + + Coda: an Experimental Distributed File System + Release 4.0 + + Copyright (c) 1987-1999 Carnegie Mellon University + All Rights Reserved + +Permission to use, copy, modify and distribute this software and its +documentation is hereby granted, provided that both the copyright +notice and this permission notice appear in all copies of the +software, derivative works or modified versions, and any portions +thereof, and that both notices appear in supporting documentation, and +that credit is given to Carnegie Mellon University in all documents +and publicity pertaining to direct or indirect use of this code or its +derivatives. + +CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, +SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS +FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON +DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER +RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF +ANY DERIVATIVE WORK. + +Carnegie Mellon encourages users of this software to return any +improvements or extensions that they make, and to grant Carnegie +Mellon the rights to redistribute these changes without encumbrance. +*/ /* * * Based on cfs.h from Mach, but revamped for increased simplicity. - * Linux modifications by Peter Braam, Aug 1996 + * Linux modifications by + * Peter Braam, Aug 1996 */ -#ifndef _CFS_HEADER_ -#define _CFS_HEADER_ +#ifndef _CODA_HEADER_ +#define _CODA_HEADER_ @@ -15,7 +66,11 @@ #include <sys/types.h> #endif -#ifdef DJGPP +#ifndef CODA_MAXSYMLINKS +#define CODA_MAXSYMLINKS 10 +#endif + +#if defined(DJGPP) || defined(__CYGWIN32__) #ifdef KERNEL typedef unsigned long u_long; typedef unsigned int u_int; @@ -23,7 +78,11 @@ typedef unsigned short u_short; typedef u_long ino_t; typedef u_long dev_t; typedef void * caddr_t; -typedef u_long u_quad_t; +#ifdef DOS +typedef unsigned __int64 u_quad_t; +#else +typedef unsigned long long u_quad_t; +#endif #define inline @@ -34,12 +93,12 @@ struct timespec { #else /* DJGPP but not KERNEL */ #include <sys/types.h> #include <sys/time.h> -typedef u_long u_quad_t; +typedef unsigned long long u_quad_t; #endif /* !KERNEL */ #endif /* !DJGPP */ -#if defined(__linux__) || defined(__CYGWIN32__) +#if defined(__linux__) #define cdev_t u_quad_t #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2) #define _UQUAD_T_ 1 @@ -61,9 +120,9 @@ struct timespec { /* * Cfs constants */ -#define CFS_MAXNAMLEN 255 -#define CFS_MAXPATHLEN 1024 -#define CFS_MAXSYMLINK 10 +#define CODA_MAXNAMLEN 255 +#define CODA_MAXPATHLEN 1024 +#define CODA_MAXSYMLINK 10 /* these are Coda's version of O_RDONLY etc combinations * to deal with VFS open modes @@ -79,9 +138,9 @@ struct timespec { #define C_M_WRITE 00200 /* for access Venus will use */ +#define C_A_C_OK 8 /* Test for writing upon create. */ #define C_A_R_OK 4 /* Test for read permission. */ #define C_A_W_OK 2 /* Test for write permission. */ -#define C_A_C_OK 8 /* Test for writing upon create. */ #define C_A_X_OK 1 /* Test for execute permission. */ #define C_A_F_OK 0 /* Test for existence. */ @@ -94,23 +153,23 @@ struct venus_dirent { unsigned short d_reclen; /* length of this record */ char d_type; /* file type, see below */ char d_namlen; /* length of string in d_name */ - char d_name[CFS_MAXNAMLEN + 1];/* name must be no longer than this */ + char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */ }; #undef DIRSIZ -#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CFS_MAXNAMLEN+1)) + \ +#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \ (((dp)->d_namlen+1 + 3) &~ 3)) /* * File types */ #define CDT_UNKNOWN 0 -#define CDT_FIFO 1 +#define CDT_FIFO 1 #define CDT_CHR 2 #define CDT_DIR 4 #define CDT_BLK 6 #define CDT_REG 8 #define CDT_LNK 10 -#define CDT_SOCK 12 +#define CDT_SOCK 12 #define CDT_WHT 14 /* @@ -138,14 +197,27 @@ typedef struct ViceFid { } ViceFid; #endif /* VICEFID */ -static inline ino_t coda_f2i(struct ViceFid *fid) + +#ifdef __linux__ +static __inline__ ino_t coda_f2i(struct ViceFid *fid) { - if ( fid ) { - return (fid->Unique + (fid->Vnode << 10) + (fid->Volume << 20)); - } else { - return 0; - } + if ( ! fid ) + return 0; + if (fid->Vnode == 0xfffffffe || fid->Vnode == 0xffffffff) + return ((fid->Volume << 20) | (fid->Unique & 0xfffff)); + else + return (fid->Unique + (fid->Vnode<<10) + (fid->Volume<<20)); } + +#else +#define coda_f2i(fid)\ + ((fid) ? ((fid)->Unique + ((fid)->Vnode<<10) + ((fid)->Volume<<20)) : 0) +#endif + + +#ifndef __BIT_TYPES_DEFINED__ +#define u_int32_t unsigned int +#endif #ifndef _VUID_T_ @@ -157,12 +229,12 @@ typedef u_int32_t vgid_t; #ifndef _CODACRED_T_ #define _CODACRED_T_ struct coda_cred { - vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/ -#if defined(__NetBSD__) || defined(__FreeBSD__) - vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */ -#else - vgid_t cr_gid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */ -#endif + vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; + vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; +#if defined(CODA_SUPPORTS_SUPPLEMENTARY_GROUPS) + int cr_nsupgps; + vgid_t cr_supgps[NGROUPS]; +#endif /* defined(CODA_SUPPORTS_SUPPLEMENTARY_GROUPS) */ }; #endif @@ -174,7 +246,7 @@ struct coda_cred { enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD }; struct coda_vattr { - enum coda_vtype va_type; /* vnode type (for create) */ + int va_type; /* vnode type (for create) */ u_short va_mode; /* files access mode and type */ short va_nlink; /* number of references to file */ vuid_t va_uid; /* owner user id */ @@ -198,50 +270,59 @@ struct coda_vattr { * Kernel <--> Venus communications. */ -#define CFS_ROOT ((u_long) 2) -#define CFS_SYNC ((u_long) 3) -#define CFS_OPEN ((u_long) 4) -#define CFS_CLOSE ((u_long) 5) -#define CFS_IOCTL ((u_long) 6) -#define CFS_GETATTR ((u_long) 7) -#define CFS_SETATTR ((u_long) 8) -#define CFS_ACCESS ((u_long) 9) -#define CFS_LOOKUP ((u_long) 10) -#define CFS_CREATE ((u_long) 11) -#define CFS_REMOVE ((u_long) 12) -#define CFS_LINK ((u_long) 13) -#define CFS_RENAME ((u_long) 14) -#define CFS_MKDIR ((u_long) 15) -#define CFS_RMDIR ((u_long) 16) -#define CFS_READDIR ((u_long) 17) -#define CFS_SYMLINK ((u_long) 18) -#define CFS_READLINK ((u_long) 19) -#define CFS_FSYNC ((u_long) 20) -#define CFS_INACTIVE ((u_long) 21) -#define CFS_VGET ((u_long) 22) -#define CFS_SIGNAL ((u_long) 23) -#define CFS_REPLACE ((u_long) 24) -#define CFS_FLUSH ((u_long) 25) -#define CFS_PURGEUSER ((u_long) 26) -#define CFS_ZAPFILE ((u_long) 27) -#define CFS_ZAPDIR ((u_long) 28) -/* #define CFS_ZAPVNODE ((u_long) 29) obsolete */ -#define CFS_PURGEFID ((u_long) 30) -#define CFS_OPEN_BY_PATH ((u_long) 31) -#define CFS_NCALLS 32 - -#define DOWNCALL(opcode) (opcode >= CFS_REPLACE && opcode <= CFS_PURGEFID) +#define CODA_ROOT 2 +#define CODA_SYNC 3 +#define CODA_OPEN 4 +#define CODA_CLOSE 5 +#define CODA_IOCTL 6 +#define CODA_GETATTR 7 +#define CODA_SETATTR 8 +#define CODA_ACCESS 9 +#define CODA_LOOKUP 10 +#define CODA_CREATE 11 +#define CODA_REMOVE 12 +#define CODA_LINK 13 +#define CODA_RENAME 14 +#define CODA_MKDIR 15 +#define CODA_RMDIR 16 +#define CODA_READDIR 17 +#define CODA_SYMLINK 18 +#define CODA_READLINK 19 +#define CODA_FSYNC 20 +#define CODA_INACTIVE 21 +#define CODA_VGET 22 +#define CODA_SIGNAL 23 +#define CODA_REPLACE 24 +#define CODA_FLUSH 25 +#define CODA_PURGEUSER 26 +#define CODA_ZAPFILE 27 +#define CODA_ZAPDIR 28 +#define CODA_PURGEFID 30 +#define CODA_OPEN_BY_PATH 31 +#define CODA_RESOLVE 32 +#define CODA_REINTEGRATE 33 +#define CODA_NCALLS 34 + +#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID) #define VC_MAXDATASIZE 8192 #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\ VC_MAXDATASIZE - +#define CIOC_KERNEL_VERSION _IOWR('c', 10, sizeof (int)) +#if 0 + /* don't care about kernel version number */ +#define CODA_KERNEL_VERSION 0 + /* The old venus 4.6 compatible interface */ +#define CODA_KERNEL_VERSION 1 +#endif + /* venus_lookup gets an extra parameter to aid windows.*/ +#define CODA_KERNEL_VERSION 2 /* * Venus <-> Coda RPC arguments */ -struct cfs_in_hdr { +struct coda_in_hdr { unsigned long opcode; unsigned long unique; /* Keep multiple outstanding msgs distinct */ u_short pid; /* Common to all */ @@ -251,53 +332,53 @@ struct cfs_in_hdr { }; /* Really important that opcode and unique are 1st two fields! */ -struct cfs_out_hdr { +struct coda_out_hdr { unsigned long opcode; unsigned long unique; unsigned long result; }; -/* cfs_root: NO_IN */ -struct cfs_root_out { - struct cfs_out_hdr oh; +/* coda_root: NO_IN */ +struct coda_root_out { + struct coda_out_hdr oh; ViceFid VFid; }; -struct cfs_root_in { - struct cfs_in_hdr in; +struct coda_root_in { + struct coda_in_hdr in; }; -/* cfs_sync: */ -/* Nothing needed for cfs_sync */ +/* coda_sync: */ +/* Nothing needed for coda_sync */ -/* cfs_open: */ -struct cfs_open_in { - struct cfs_in_hdr ih; +/* coda_open: */ +struct coda_open_in { + struct coda_in_hdr ih; ViceFid VFid; int flags; }; -struct cfs_open_out { - struct cfs_out_hdr oh; +struct coda_open_out { + struct coda_out_hdr oh; cdev_t dev; ino_t inode; }; -/* cfs_close: */ -struct cfs_close_in { - struct cfs_in_hdr ih; +/* coda_close: */ +struct coda_close_in { + struct coda_in_hdr ih; ViceFid VFid; int flags; }; -struct cfs_close_out { - struct cfs_out_hdr out; +struct coda_close_out { + struct coda_out_hdr out; }; -/* cfs_ioctl: */ -struct cfs_ioctl_in { - struct cfs_in_hdr ih; +/* coda_ioctl: */ +struct coda_ioctl_in { + struct coda_in_hdr ih; ViceFid VFid; int cmd; int len; @@ -305,64 +386,70 @@ struct cfs_ioctl_in { char *data; /* Place holder for data. */ }; -struct cfs_ioctl_out { - struct cfs_out_hdr oh; +struct coda_ioctl_out { + struct coda_out_hdr oh; int len; caddr_t data; /* Place holder for data. */ }; -/* cfs_getattr: */ -struct cfs_getattr_in { - struct cfs_in_hdr ih; +/* coda_getattr: */ +struct coda_getattr_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_getattr_out { - struct cfs_out_hdr oh; +struct coda_getattr_out { + struct coda_out_hdr oh; struct coda_vattr attr; }; -/* cfs_setattr: NO_OUT */ -struct cfs_setattr_in { - struct cfs_in_hdr ih; +/* coda_setattr: NO_OUT */ +struct coda_setattr_in { + struct coda_in_hdr ih; ViceFid VFid; struct coda_vattr attr; }; -struct cfs_setattr_out { - struct cfs_out_hdr out; +struct coda_setattr_out { + struct coda_out_hdr out; }; -/* cfs_access: NO_OUT */ -struct cfs_access_in { - struct cfs_in_hdr ih; +/* coda_access: NO_OUT */ +struct coda_access_in { + struct coda_in_hdr ih; ViceFid VFid; int flags; }; -struct cfs_access_out { - struct cfs_out_hdr out; +struct coda_access_out { + struct coda_out_hdr out; }; -/* cfs_lookup: */ -struct cfs_lookup_in { - struct cfs_in_hdr ih; + +/* lookup flags */ +#define CLU_CASE_SENSITIVE 0x01 +#define CLU_CASE_INSENSITIVE 0x02 + +/* coda_lookup: */ +struct coda_lookup_in { + struct coda_in_hdr ih; ViceFid VFid; int name; /* Place holder for data. */ + int flags; }; -struct cfs_lookup_out { - struct cfs_out_hdr oh; +struct coda_lookup_out { + struct coda_out_hdr oh; ViceFid VFid; int vtype; }; -/* cfs_create: */ -struct cfs_create_in { - struct cfs_in_hdr ih; +/* coda_create: */ +struct coda_create_in { + struct coda_in_hdr ih; ViceFid VFid; struct coda_vattr attr; int excl; @@ -370,188 +457,188 @@ struct cfs_create_in { int name; /* Place holder for data. */ }; -struct cfs_create_out { - struct cfs_out_hdr oh; +struct coda_create_out { + struct coda_out_hdr oh; ViceFid VFid; struct coda_vattr attr; }; -/* cfs_remove: NO_OUT */ -struct cfs_remove_in { - struct cfs_in_hdr ih; +/* coda_remove: NO_OUT */ +struct coda_remove_in { + struct coda_in_hdr ih; ViceFid VFid; int name; /* Place holder for data. */ }; -struct cfs_remove_out { - struct cfs_out_hdr out; +struct coda_remove_out { + struct coda_out_hdr out; }; -/* cfs_link: NO_OUT */ -struct cfs_link_in { - struct cfs_in_hdr ih; +/* coda_link: NO_OUT */ +struct coda_link_in { + struct coda_in_hdr ih; ViceFid sourceFid; /* cnode to link *to* */ ViceFid destFid; /* Directory in which to place link */ int tname; /* Place holder for data. */ }; -struct cfs_link_out { - struct cfs_out_hdr out; +struct coda_link_out { + struct coda_out_hdr out; }; -/* cfs_rename: NO_OUT */ -struct cfs_rename_in { - struct cfs_in_hdr ih; +/* coda_rename: NO_OUT */ +struct coda_rename_in { + struct coda_in_hdr ih; ViceFid sourceFid; int srcname; ViceFid destFid; int destname; }; -struct cfs_rename_out { - struct cfs_out_hdr out; +struct coda_rename_out { + struct coda_out_hdr out; }; -/* cfs_mkdir: */ -struct cfs_mkdir_in { - struct cfs_in_hdr ih; +/* coda_mkdir: */ +struct coda_mkdir_in { + struct coda_in_hdr ih; ViceFid VFid; struct coda_vattr attr; int name; /* Place holder for data. */ }; -struct cfs_mkdir_out { - struct cfs_out_hdr oh; +struct coda_mkdir_out { + struct coda_out_hdr oh; ViceFid VFid; struct coda_vattr attr; }; -/* cfs_rmdir: NO_OUT */ -struct cfs_rmdir_in { - struct cfs_in_hdr ih; +/* coda_rmdir: NO_OUT */ +struct coda_rmdir_in { + struct coda_in_hdr ih; ViceFid VFid; int name; /* Place holder for data. */ }; -struct cfs_rmdir_out { - struct cfs_out_hdr out; +struct coda_rmdir_out { + struct coda_out_hdr out; }; -/* cfs_readdir: */ -struct cfs_readdir_in { - struct cfs_in_hdr ih; +/* coda_readdir: */ +struct coda_readdir_in { + struct coda_in_hdr ih; ViceFid VFid; int count; int offset; }; -struct cfs_readdir_out { - struct cfs_out_hdr oh; +struct coda_readdir_out { + struct coda_out_hdr oh; int size; caddr_t data; /* Place holder for data. */ }; -/* cfs_symlink: NO_OUT */ -struct cfs_symlink_in { - struct cfs_in_hdr ih; +/* coda_symlink: NO_OUT */ +struct coda_symlink_in { + struct coda_in_hdr ih; ViceFid VFid; /* Directory to put symlink in */ int srcname; struct coda_vattr attr; int tname; }; -struct cfs_symlink_out { - struct cfs_out_hdr out; +struct coda_symlink_out { + struct coda_out_hdr out; }; -/* cfs_readlink: */ -struct cfs_readlink_in { - struct cfs_in_hdr ih; +/* coda_readlink: */ +struct coda_readlink_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_readlink_out { - struct cfs_out_hdr oh; +struct coda_readlink_out { + struct coda_out_hdr oh; int count; caddr_t data; /* Place holder for data. */ }; -/* cfs_fsync: NO_OUT */ -struct cfs_fsync_in { - struct cfs_in_hdr ih; +/* coda_fsync: NO_OUT */ +struct coda_fsync_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_fsync_out { - struct cfs_out_hdr out; +struct coda_fsync_out { + struct coda_out_hdr out; }; -/* cfs_inactive: NO_OUT */ -struct cfs_inactive_in { - struct cfs_in_hdr ih; +/* coda_inactive: NO_OUT */ +struct coda_inactive_in { + struct coda_in_hdr ih; ViceFid VFid; }; -/* cfs_vget: */ -struct cfs_vget_in { - struct cfs_in_hdr ih; +/* coda_vget: */ +struct coda_vget_in { + struct coda_in_hdr ih; ViceFid VFid; }; -struct cfs_vget_out { - struct cfs_out_hdr oh; +struct coda_vget_out { + struct coda_out_hdr oh; ViceFid VFid; int vtype; }; -/* CFS_SIGNAL is out-of-band, doesn't need data. */ -/* CFS_INVALIDATE is a venus->kernel call */ -/* CFS_FLUSH is a venus->kernel call */ +/* CODA_SIGNAL is out-of-band, doesn't need data. */ +/* CODA_INVALIDATE is a venus->kernel call */ +/* CODA_FLUSH is a venus->kernel call */ -/* cfs_purgeuser: */ -/* CFS_PURGEUSER is a venus->kernel call */ -struct cfs_purgeuser_out { - struct cfs_out_hdr oh; +/* coda_purgeuser: */ +/* CODA_PURGEUSER is a venus->kernel call */ +struct coda_purgeuser_out { + struct coda_out_hdr oh; struct coda_cred cred; }; -/* cfs_zapfile: */ -/* CFS_ZAPFILE is a venus->kernel call */ -struct cfs_zapfile_out { - struct cfs_out_hdr oh; +/* coda_zapfile: */ +/* CODA_ZAPFILE is a venus->kernel call */ +struct coda_zapfile_out { + struct coda_out_hdr oh; ViceFid CodaFid; }; -/* cfs_zapdir: */ -/* CFS_ZAPDIR is a venus->kernel call */ -struct cfs_zapdir_out { - struct cfs_out_hdr oh; +/* coda_zapdir: */ +/* CODA_ZAPDIR is a venus->kernel call */ +struct coda_zapdir_out { + struct coda_out_hdr oh; ViceFid CodaFid; }; -/* cfs_zapnode: */ -/* CFS_ZAPVNODE is a venus->kernel call */ -struct cfs_zapvnode_out { - struct cfs_out_hdr oh; +/* coda_zapnode: */ +/* CODA_ZAPVNODE is a venus->kernel call */ +struct coda_zapvnode_out { + struct coda_out_hdr oh; struct coda_cred cred; ViceFid VFid; }; -/* cfs_purgefid: */ -/* CFS_PURGEFID is a venus->kernel call */ -struct cfs_purgefid_out { - struct cfs_out_hdr oh; +/* coda_purgefid: */ +/* CODA_PURGEFID is a venus->kernel call */ +struct coda_purgefid_out { + struct coda_out_hdr oh; ViceFid CodaFid; }; -/* cfs_rdwr: */ -struct cfs_rdwr_in { - struct cfs_in_hdr ih; +/* coda_rdwr: */ +struct coda_rdwr_in { + struct coda_in_hdr ih; ViceFid VFid; int rwflag; int count; @@ -560,97 +647,97 @@ struct cfs_rdwr_in { caddr_t data; /* Place holder for data. */ }; -struct cfs_rdwr_out { - struct cfs_out_hdr oh; +struct coda_rdwr_out { + struct coda_out_hdr oh; int rwflag; int count; caddr_t data; /* Place holder for data. */ }; -/* cfs_replace: */ -/* CFS_REPLACE is a venus->kernel call */ -struct cfs_replace_out { /* cfs_replace is a venus->kernel call */ - struct cfs_out_hdr oh; +/* coda_replace: */ +/* CODA_REPLACE is a venus->kernel call */ +struct coda_replace_out { /* coda_replace is a venus->kernel call */ + struct coda_out_hdr oh; ViceFid NewFid; ViceFid OldFid; }; -/* cfs_open_by_path: */ -struct cfs_open_by_path_in { - struct cfs_in_hdr ih; +/* coda_open_by_path: */ +struct coda_open_by_path_in { + struct coda_in_hdr ih; ViceFid VFid; int flags; }; -struct cfs_open_by_path_out { - struct cfs_out_hdr oh; +struct coda_open_by_path_out { + struct coda_out_hdr oh; int path; }; /* - * Occasionally, we don't cache the fid returned by CFS_LOOKUP. + * Occasionally, we don't cache the fid returned by CODA_LOOKUP. * For instance, if the fid is inconsistent. * This case is handled by setting the top bit of the type result parameter. */ -#define CFS_NOCACHE 0x80000000 +#define CODA_NOCACHE 0x80000000 union inputArgs { - struct cfs_in_hdr ih; /* NB: every struct below begins with an ih */ - struct cfs_open_in cfs_open; - struct cfs_close_in cfs_close; - struct cfs_ioctl_in cfs_ioctl; - struct cfs_getattr_in cfs_getattr; - struct cfs_setattr_in cfs_setattr; - struct cfs_access_in cfs_access; - struct cfs_lookup_in cfs_lookup; - struct cfs_create_in cfs_create; - struct cfs_remove_in cfs_remove; - struct cfs_link_in cfs_link; - struct cfs_rename_in cfs_rename; - struct cfs_mkdir_in cfs_mkdir; - struct cfs_rmdir_in cfs_rmdir; - struct cfs_readdir_in cfs_readdir; - struct cfs_symlink_in cfs_symlink; - struct cfs_readlink_in cfs_readlink; - struct cfs_fsync_in cfs_fsync; - struct cfs_inactive_in cfs_inactive; - struct cfs_vget_in cfs_vget; - struct cfs_rdwr_in cfs_rdwr; - struct cfs_open_by_path_in cfs_open_by_path; + struct coda_in_hdr ih; /* NB: every struct below begins with an ih */ + struct coda_open_in coda_open; + struct coda_close_in coda_close; + struct coda_ioctl_in coda_ioctl; + struct coda_getattr_in coda_getattr; + struct coda_setattr_in coda_setattr; + struct coda_access_in coda_access; + struct coda_lookup_in coda_lookup; + struct coda_create_in coda_create; + struct coda_remove_in coda_remove; + struct coda_link_in coda_link; + struct coda_rename_in coda_rename; + struct coda_mkdir_in coda_mkdir; + struct coda_rmdir_in coda_rmdir; + struct coda_readdir_in coda_readdir; + struct coda_symlink_in coda_symlink; + struct coda_readlink_in coda_readlink; + struct coda_fsync_in coda_fsync; + struct coda_inactive_in coda_inactive; + struct coda_vget_in coda_vget; + struct coda_rdwr_in coda_rdwr; + struct coda_open_by_path_in coda_open_by_path; }; union outputArgs { - struct cfs_out_hdr oh; /* NB: every struct below begins with an oh */ - struct cfs_root_out cfs_root; - struct cfs_open_out cfs_open; - struct cfs_ioctl_out cfs_ioctl; - struct cfs_getattr_out cfs_getattr; - struct cfs_lookup_out cfs_lookup; - struct cfs_create_out cfs_create; - struct cfs_mkdir_out cfs_mkdir; - struct cfs_readdir_out cfs_readdir; - struct cfs_readlink_out cfs_readlink; - struct cfs_vget_out cfs_vget; - struct cfs_purgeuser_out cfs_purgeuser; - struct cfs_zapfile_out cfs_zapfile; - struct cfs_zapdir_out cfs_zapdir; - struct cfs_zapvnode_out cfs_zapvnode; - struct cfs_purgefid_out cfs_purgefid; - struct cfs_rdwr_out cfs_rdwr; - struct cfs_replace_out cfs_replace; - struct cfs_open_by_path_out cfs_open_by_path; + struct coda_out_hdr oh; /* NB: every struct below begins with an oh */ + struct coda_root_out coda_root; + struct coda_open_out coda_open; + struct coda_ioctl_out coda_ioctl; + struct coda_getattr_out coda_getattr; + struct coda_lookup_out coda_lookup; + struct coda_create_out coda_create; + struct coda_mkdir_out coda_mkdir; + struct coda_readdir_out coda_readdir; + struct coda_readlink_out coda_readlink; + struct coda_vget_out coda_vget; + struct coda_purgeuser_out coda_purgeuser; + struct coda_zapfile_out coda_zapfile; + struct coda_zapdir_out coda_zapdir; + struct coda_zapvnode_out coda_zapvnode; + struct coda_purgefid_out coda_purgefid; + struct coda_rdwr_out coda_rdwr; + struct coda_replace_out coda_replace; + struct coda_open_by_path_out coda_open_by_path; }; -union cfs_downcalls { - /* CFS_INVALIDATE is a venus->kernel call */ - /* CFS_FLUSH is a venus->kernel call */ - struct cfs_purgeuser_out purgeuser; - struct cfs_zapfile_out zapfile; - struct cfs_zapdir_out zapdir; - struct cfs_zapvnode_out zapvnode; - struct cfs_purgefid_out purgefid; - struct cfs_replace_out replace; +union coda_downcalls { + /* CODA_INVALIDATE is a venus->kernel call */ + /* CODA_FLUSH is a venus->kernel call */ + struct coda_purgeuser_out purgeuser; + struct coda_zapfile_out zapfile; + struct coda_zapdir_out zapdir; + struct coda_zapvnode_out zapvnode; + struct coda_purgefid_out purgefid; + struct coda_replace_out replace; }; @@ -665,14 +752,23 @@ struct ViceIoctl { short out_size; /* Maximum size of output buffer, <= 2K */ }; +#if defined(__CYGWIN32__) || defined(DJGPP) +struct PioctlData { + unsigned long cmd; + const char *path; + int follow; + struct ViceIoctl vi; +}; +#else struct PioctlData { const char *path; int follow; struct ViceIoctl vi; }; +#endif -#define CFS_CONTROL ".CONTROL" -#define CFS_CONTROLLEN 8 +#define CODA_CONTROL ".CONTROL" +#define CODA_CONTROLLEN 8 #define CTL_VOL -1 #define CTL_VNO -1 #define CTL_UNI -1 diff --git a/include/linux/coda_cache.h b/include/linux/coda_cache.h index fc607fdba..e549b02e7 100644 --- a/include/linux/coda_cache.h +++ b/include/linux/coda_cache.h @@ -30,7 +30,7 @@ int coda_cache_check(struct inode *inode, int mask); /* for downcalls and attributes and lookups */ void coda_flag_inode(struct inode *inode, int flag); -void coda_flag_alias_children(struct inode *inode, int flag); +void coda_flag_inode_children(struct inode *inode, int flag); /* diff --git a/include/linux/coda_fs_i.h b/include/linux/coda_fs_i.h index 83980b26e..baa136b97 100644 --- a/include/linux/coda_fs_i.h +++ b/include/linux/coda_fs_i.h @@ -33,12 +33,12 @@ struct coda_inode_info { }; /* flags */ -#define C_VATTR 0x1 /* Validity of vattr in the cnode */ -#define C_SYMLINK 0x2 /* Validity of symlink pointer in the cnode */ -#define C_DYING 0x4 /* Set for outstanding cnodes from venus (which died) */ -#define C_PURGE 0x8 +#define C_VATTR 0x1 /* Validity of vattr in inode */ +#define C_PURGE 0x8 #define C_ZAPDIR 0x10 +#define C_DYING 0x4 /* from venus (which died) */ #define C_INITED 0x20 +#define C_FLUSH 0x2 /* used after a flush */ int coda_cnode_make(struct inode **, struct ViceFid *, struct super_block *); int coda_cnode_makectl(struct inode **inode, struct super_block *sb); diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h index 98407f73b..82ace8e27 100644 --- a/include/linux/coda_linux.h +++ b/include/linux/coda_linux.h @@ -46,6 +46,7 @@ extern int coda_access_cache; /* this file: heloers */ static __inline__ struct ViceFid *coda_i2f(struct inode *); char *coda_f2s(ViceFid *f); +char *coda_f2s2(ViceFid *f); int coda_isroot(struct inode *i); int coda_fid_is_volroot(struct ViceFid *); int coda_fid_is_weird(struct ViceFid *fid); @@ -71,16 +72,20 @@ int coda_inode_grab(dev_t dev, ino_t ino, struct inode **ind); #define NB_SFS_SIZ 0x895440 /* cache.c */ -void coda_purge_children(struct inode *); +void coda_purge_children(struct inode *, int); void coda_purge_dentries(struct inode *); +/* sysctl.h */ +void coda_sysctl_init(void); +void coda_sysctl_clean(void); + /* debugging masks */ #define D_SUPER 1 /* print results returned by Venus */ #define D_INODE 2 /* print entry and exit into procedure */ -#define D_FILE 4 /* print malloc, de-alloc information */ +#define D_FILE 4 #define D_CACHE 8 /* cache debugging */ -#define D_MALLOC 16 +#define D_MALLOC 16 /* print malloc, de-alloc information */ #define D_CNODE 32 #define D_UPCALL 64 /* up and downcall debugging */ #define D_PSDEV 128 diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h index 7b827e8c3..2de8ff1ff 100644 --- a/include/linux/coda_psdev.h +++ b/include/linux/coda_psdev.h @@ -4,16 +4,8 @@ #define CODA_PSDEV_MAJOR 67 #define MAX_CODADEVS 5 /* how many do we allow */ -extern struct vcomm psdev_vcomm[]; - -/* queue stuff; the rest is static to psdev.c */ -struct queue { - struct queue *forw, *back; -}; -void coda_q_insert(struct queue *el, struct queue *q); -void coda_q_remove(struct queue *q); - - +extern struct venus_comm coda_upc_comm; +extern struct coda_sb_info coda_super_info; #define CODA_SUPER_MAGIC 0x73757245 struct coda_sb_info @@ -21,31 +13,23 @@ struct coda_sb_info struct inode * sbi_psdev; /* /dev/cfs? Venus/kernel device */ struct inode * sbi_ctlcp; /* control magic file */ int sbi_refct; - struct vcomm * sbi_vcomm; + struct venus_comm * sbi_vcomm; struct inode * sbi_root; + struct super_block *sbi_sb; struct list_head sbi_cchead; struct list_head sbi_volroothead; }; -/* communication pending/processing queues queues */ -struct vcomm { +/* communication pending/processing queues */ +struct venus_comm { u_long vc_seq; struct wait_queue *vc_waitq; /* Venus wait queue */ - struct queue vc_pending; - struct queue vc_processing; - struct super_block *vc_sb; + struct list_head vc_pending; + struct list_head vc_processing; int vc_inuse; + pid_t vc_pid; /* Venus pid */ }; -static inline int vcomm_open(struct vcomm *vcp) -{ - return ((vcp)->vc_pending.forw != NULL); -} - -static inline void mark_vcomm_closed(struct vcomm *vcp) -{ - (vcp)->vc_pending.forw = NULL; -} static inline struct coda_sb_info *coda_sbp(struct super_block *sb) { @@ -67,7 +51,8 @@ int venus_setattr(struct super_block *, struct ViceFid *, int venus_lookup(struct super_block *sb, struct ViceFid *fid, const char *name, int length, int *type, struct ViceFid *resfid); -int venus_release(struct super_block *sb, struct ViceFid *fid, int flags); +int venus_release(struct super_block *sb, struct ViceFid *fid, int flags, + struct coda_cred *); int venus_open(struct super_block *sb, struct ViceFid *fid, int flags, ino_t *ino, dev_t *dev); int venus_mkdir(struct super_block *sb, struct ViceFid *dirfid, @@ -100,18 +85,22 @@ int venus_fsync(struct super_block *sb, struct ViceFid *fid); /* messages between coda filesystem in kernel and Venus */ extern int coda_hard; extern unsigned long coda_timeout; -struct vmsg { - struct queue vm_chain; - caddr_t vm_data; - u_short vm_flags; - u_short vm_inSize; /* Size is at most 5000 bytes */ - u_short vm_outSize; - u_short vm_opcode; /* copied from data to save lookup */ - int vm_unique; - struct wait_queue *vm_sleep; /* process' wait queue */ - unsigned long vm_posttime; +struct upc_req { + struct list_head uc_chain; + caddr_t uc_data; + u_short uc_flags; + u_short uc_inSize; /* Size is at most 5000 bytes */ + u_short uc_outSize; + u_short uc_opcode; /* copied from data to save lookup */ + int uc_unique; + struct wait_queue *uc_sleep; /* process' wait queue */ + unsigned long uc_posttime; }; +#define REQ_ASYNC 0x1 +#define REQ_READ 0x2 +#define REQ_WRITE 0x4 + /* * Statistics @@ -119,7 +108,7 @@ struct vmsg { struct coda_upcallstats { int ncalls; /* client requests */ int nbadcalls; /* upcall failures */ - int reqs[CFS_NCALLS]; /* count of each request */ + int reqs[CODA_NCALLS]; /* count of each request */ } ; extern struct coda_upcallstats coda_callstats; @@ -127,7 +116,7 @@ extern struct coda_upcallstats coda_callstats; static inline void clstats(int opcode) { coda_callstats.ncalls++; - if ( (0 <= opcode) && (opcode <= CFS_NCALLS) ) + if ( (0 <= opcode) && (opcode <= CODA_NCALLS) ) coda_callstats.reqs[opcode]++; else printk("clstats called with bad opcode %d\n", opcode); diff --git a/include/linux/consolemap.h b/include/linux/consolemap.h index fd0bcd43f..dee4b654c 100644 --- a/include/linux/consolemap.h +++ b/include/linux/consolemap.h @@ -11,5 +11,5 @@ struct vc_data; extern unsigned char inverse_translate(struct vc_data *conp, int glyph); -extern unsigned short *set_translate(int m); +extern unsigned short *set_translate(int m,int currcons); extern int conv_uni_to_pc(struct vc_data *conp, long ucs); diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h index 41d57b959..6e67b5414 100644 --- a/include/linux/cyclades.h +++ b/include/linux/cyclades.h @@ -581,6 +581,7 @@ struct cyclades_port { #define CyISA_Ywin 0x2000 #define CyPCI_Ywin 0x4000 +#define CyPCI_Yctl 0x80 #define CyPCI_Zctl CTRL_WINDOW_SIZE #define CyPCI_Zwin 0x80000 #define CyPCI_Ze_win (2 * CyPCI_Zwin) diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 93b863695..ecf38fd06 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -42,7 +42,7 @@ static __inline__ unsigned long end_name_hash(unsigned long hash) } /* Compute the hash for a name string. */ -static __inline__ unsigned int full_name_hash(const char * name, unsigned int len) +static __inline__ unsigned int full_name_hash(const unsigned char * name, unsigned int len) { unsigned long hash = init_name_hash(); while (len--) @@ -150,10 +150,18 @@ extern struct dentry * d_alloc_root(struct inode * root_inode, struct dentry * o extern int is_root_busy(struct dentry *); /* + * This adds the entry to the hash queues. + */ +extern void d_rehash(struct dentry * entry); +/* * This adds the entry to the hash queues and initializes "d_inode". * The entry was actually filled in earlier during "d_alloc()" */ -extern void d_add(struct dentry * entry, struct inode * inode); +static __inline__ void d_add(struct dentry * entry, struct inode * inode) +{ + d_rehash(entry); + d_instantiate(entry, inode); +} /* used for rename() and baskets */ extern void d_move(struct dentry * entry, struct dentry * newdentry); diff --git a/include/linux/fb.h b/include/linux/fb.h index cb5618a56..f4c775db4 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -35,6 +35,8 @@ #define FB_AUX_TEXT_MDA 0 /* Monochrome text */ #define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */ #define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */ +#define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */ +#define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */ #define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */ #define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */ diff --git a/include/linux/file.h b/include/linux/file.h index 0884fad2f..05f388f08 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -6,7 +6,6 @@ #define __LINUX_FILE_H extern void __fput(struct file *); -extern void insert_file_free(struct file *file); /* * Check whether the specified task has the fd open. Since the task @@ -50,34 +49,23 @@ extern inline void fd_install(unsigned int fd, struct file *file) current->files->fd[fd] = file; } -/* It does not matter which list it is on. */ -extern inline void remove_filp(struct file *file) -{ - if(file->f_next) - file->f_next->f_pprev = file->f_pprev; - *file->f_pprev = file->f_next; -} - -extern inline void fput(struct file *file) -{ - int count = file->f_count-1; - - if (!count) { - locks_remove_flock(file); - __fput(file); - file->f_count = 0; - remove_filp(file); - insert_file_free(file); - } else - file->f_count = count; -} - -extern inline void put_filp(struct file *file) -{ - if(--file->f_count == 0) { - remove_filp(file); - insert_file_free(file); - } -} +/* + * 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>: + * + * Since those functions where calling other functions, it was compleatly + * bogous to make them all "extern inline". + * + * The removal of this pseudo optimization saved me scandaleous: + * + * 3756 (i386 arch) + * + * precious bytes from my kernel, even without counting all the code compiled + * as module! + * + * I suspect there are many other similar "optimizations" across the + * kernel... + */ +extern void fput(struct file *file); +extern void put_filp(struct file *file); #endif diff --git a/include/linux/fs.h b/include/linux/fs.h index 3a38d6f86..311409e8b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -176,8 +176,6 @@ typedef char buffer_block[BLOCK_SIZE]; #define BH_Dirty 1 /* 1 if the buffer is dirty */ #define BH_Lock 2 /* 1 if the buffer is locked */ #define BH_Req 3 /* 0 if the buffer has been invalidated */ -#define BH_Touched 4 /* 1 if the buffer has been touched (aging) */ -#define BH_Has_aged 5 /* 1 if the buffer has been aged (aging) */ #define BH_Protected 6 /* 1 if the buffer is protected */ /* @@ -210,8 +208,6 @@ struct buffer_head { unsigned int b_list; /* List that this buffer appears */ unsigned long b_flushtime; /* Time when this (dirty) buffer * should be written */ - unsigned long b_lru_time; /* Time when this buffer was - * last used. */ struct wait_queue * b_wait; struct buffer_head ** b_pprev; /* doubly linked list of hash-queue */ struct buffer_head * b_prev_free; /* doubly linked list of buffers */ @@ -248,21 +244,24 @@ static inline int buffer_req(struct buffer_head * bh) return test_bit(BH_Req, &bh->b_state); } -static inline int buffer_touched(struct buffer_head * bh) -{ - return test_bit(BH_Touched, &bh->b_state); -} - -static inline int buffer_has_aged(struct buffer_head * bh) -{ - return test_bit(BH_Has_aged, &bh->b_state); -} - static inline int buffer_protected(struct buffer_head * bh) { return test_bit(BH_Protected, &bh->b_state); } +/* + * Deprecated - we don't keep per-buffer reference flags + * any more. + * + * We _could_ try to update the page reference, but that + * doesn't seem to really be worth it either. If we did, + * it would look something like this: + * + * #define buffer_page(bh) (mem_map + MAP_NR((bh)->b_data)) + * #define touch_buffer(bh) set_bit(PG_referenced, &buffer_page(bh)->flags) + */ +#define touch_buffer(bh) do { } while (0) + #include <linux/pipe_fs_i.h> #include <linux/minix_fs_i.h> #include <linux/ext2_fs_i.h> @@ -423,7 +422,7 @@ struct file { struct file_operations *f_op; mode_t f_mode; loff_t f_pos; - unsigned short f_count, f_flags; + unsigned int f_count, f_flags; unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin; struct fown_struct f_owner; @@ -472,7 +471,7 @@ struct file_lock { } fl_u; }; -extern struct file_lock *file_lock_table; +extern struct file_lock *file_lock_table; #include <linux/fcntl.h> @@ -564,6 +563,13 @@ struct super_block { }; /* + * VFS helper functions.. + */ +extern int vfs_rmdir(struct inode *, struct dentry *); +extern int vfs_unlink(struct inode *, struct dentry *); +extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); + +/* * This is the "filldir" function type, used by readdir() to let * the kernel specify what kind of dirent layout it wants to have. * This allows the kernel to read directories into kernel space or @@ -693,7 +699,8 @@ extern int close_fp(struct file *, fl_owner_t id); extern struct file *filp_open(const char *, int, int); extern char * getname(const char * filename); -extern void putname(char * name); +#define __getname() ((char *) __get_free_page(GFP_KERNEL)) +#define putname(name) free_page((unsigned long)(name)) extern void kill_fasync(struct fasync_struct *fa, int sig); extern int register_blkdev(unsigned int, const char *, struct file_operations *); @@ -703,11 +710,16 @@ extern int blkdev_release (struct inode * inode); extern struct file_operations def_blk_fops; extern struct inode_operations blkdev_inode_operations; +/* fs/devices.c */ extern int register_chrdev(unsigned int, const char *, struct file_operations *); extern int unregister_chrdev(unsigned int major, const char * name); extern int chrdev_open(struct inode * inode, struct file * filp); extern struct file_operations def_chr_fops; extern struct inode_operations chrdev_inode_operations; +extern char * bdevname(kdev_t dev); +extern char * cdevname(kdev_t dev); +extern char * kdevname(kdev_t dev); + extern void init_fifo(struct inode * inode); extern struct inode_operations fifo_inode_operations; @@ -733,7 +745,7 @@ extern struct file *inuse_filps; extern void refile_buffer(struct buffer_head * buf); extern void set_writetime(struct buffer_head * buf, int flag); -extern int try_to_free_buffer(struct buffer_head*, struct buffer_head**, int); +extern int try_to_free_buffers(struct page *); extern int nr_buffers; extern int buffermem; @@ -816,8 +828,6 @@ extern struct buffer_head * get_hash_table(kdev_t, int, int); extern struct buffer_head * getblk(kdev_t, int, int); extern struct buffer_head * find_buffer(kdev_t dev, int block, int size); extern void ll_rw_block(int, int, struct buffer_head * bh[]); -extern void ll_rw_page(int, kdev_t, unsigned long, char *); -extern void ll_rw_swap_file(int, kdev_t, unsigned int *, int, char *); extern int is_read_only(kdev_t); extern void __brelse(struct buffer_head *); extern inline void brelse(struct buffer_head *buf) diff --git a/include/linux/genhd.h b/include/linux/genhd.h index fe89b7e7a..20589194f 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -108,12 +108,21 @@ struct solaris_x86_vtoc { #ifdef CONFIG_BSD_DISKLABEL /* * BSD disklabel support by Yossi Gottlieb <yogo@math.tau.ac.il> + * updated by Marc Espie <Marc.Espie@openbsd.org> */ +#define FREEBSD_PARTITION 0xa5 /* FreeBSD Partition ID */ +#define OPENBSD_PARTITION 0xa6 /* OpenBSD Partition ID */ +#define NETBSD_PARTITION 0xa9 /* NetBSD Partition ID */ +#define BSDI_PARTITION 0xb7 /* BSDI Partition ID */ -#define BSD_PARTITION 0xa5 /* Partition ID */ +/* Ours is not to wonder why.. */ +#define BSD_PARTITION FREEBSD_PARTITION + +/* check against BSD src/sys/sys/disklabel.h for consistency */ #define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */ #define BSD_MAXPARTITIONS 8 +#define OPENBSD_MAXPARTITIONS 16 #define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */ struct bsd_disklabel { __u32 d_magic; /* the magic number */ @@ -160,6 +169,62 @@ struct bsd_disklabel { #endif /* CONFIG_BSD_DISKLABEL */ +#ifdef CONFIG_UNIXWARE_DISKLABEL +/* + * Unixware slices support by Andrzej Krzysztofowicz <ankry@mif.pg.gda.pl> + * and Krzysztof G. Baranowski <kgb@knm.org.pl> + */ + +#define UNIXWARE_PARTITION 0x63 /* Partition ID, same as */ + /* GNU_HURD and SCO Unix */ +#define UNIXWARE_DISKMAGIC (0xCA5E600DUL) /* The disk magic number */ +#define UNIXWARE_DISKMAGIC2 (0x600DDEEEUL) /* The slice table magic nr */ +#define UNIXWARE_NUMSLICE 16 +#define UNIXWARE_FS_UNUSED 0 /* Unused slice entry ID */ + +struct unixware_slice { + __u16 s_label; /* label */ + __u16 s_flags; /* permission flags */ + __u32 start_sect; /* starting sector */ + __u32 nr_sects; /* number of sectors in slice */ +}; + +struct unixware_disklabel { + __u32 d_type; /* drive type */ + __u32 d_magic; /* the magic number */ + __u32 d_version; /* version number */ + char d_serial[12]; /* serial number of the device */ + __u32 d_ncylinders; /* # of data cylinders per device */ + __u32 d_ntracks; /* # of tracks per cylinder */ + __u32 d_nsectors; /* # of data sectors per track */ + __u32 d_secsize; /* # of bytes per sector */ + __u32 d_part_start; /* # of first sector of this partition */ + __u32 d_unknown1[12]; /* ? */ + __u32 d_alt_tbl; /* byte offset of alternate table */ + __u32 d_alt_len; /* byte length of alternate table */ + __u32 d_phys_cyl; /* # of physical cylinders per device */ + __u32 d_phys_trk; /* # of physical tracks per cylinder */ + __u32 d_phys_sec; /* # of physical sectors per track */ + __u32 d_phys_bytes; /* # of physical bytes per sector */ + __u32 d_unknown2; /* ? */ + __u32 d_unknown3; /* ? */ + __u32 d_pad[8]; /* pad */ + + struct unixware_vtoc { + __u32 v_magic; /* the magic number */ + __u32 v_version; /* version number */ + char v_name[8]; /* volume name */ + __u16 v_nslices; /* # of slices */ + __u16 v_unknown1; /* ? */ + __u32 v_reserved[10]; /* reserved */ + struct unixware_slice + v_slice[UNIXWARE_NUMSLICE]; /* slice headers */ + } vtoc; + +}; /* 408 */ + +#endif /* CONFIG_UNIXWARE_DISKLABEL */ + extern struct gendisk *gendisk_head; /* linked list of disks */ /* diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h index 79d657a0d..e467ae9b6 100644 --- a/include/linux/hdreg.h +++ b/include/linux/hdreg.h @@ -52,6 +52,13 @@ #define WIN_SETIDLE1 0xE3 #define WIN_SETIDLE2 0x97 +#define WIN_STANDBYNOW1 0xE0 +#define WIN_STANDBYNOW2 0x94 +#define WIN_SLEEPNOW1 0xE6 +#define WIN_SLEEPNOW2 0x99 +#define WIN_CHECKPOWERMODE1 0xE5 +#define WIN_CHECKPOWERMODE2 0x98 + #define WIN_DOORLOCK 0xde /* lock door on removable drives */ #define WIN_DOORUNLOCK 0xdf /* unlock door on removable drives */ @@ -59,6 +66,7 @@ #define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */ #define WIN_SETMULT 0xC6 /* enable/disable multiple mode */ #define WIN_IDENTIFY 0xEC /* ask drive to identify itself */ +#define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */ #define WIN_SETFEATURES 0xEF /* set special drive features */ #define WIN_READDMA 0xc8 /* read sectors using DMA transfers */ #define WIN_WRITEDMA 0xca /* write sectors using DMA transfers */ @@ -85,6 +93,14 @@ #define SMART_STATUS 0xda #define SMART_AUTO_OFFLINE 0xdb +/* WIN_SECURITY sub-commands */ +#define SECURITY_SET_PASSWORD 0xBA /* 0xF1 */ +#define SECURITY_UNLOCK 0xBB /* 0xF2 */ +#define SECURITY_ERASE_PREPARE 0xBC /* 0xF3 */ +#define SECURITY_ERASE_UNIT 0xBD /* 0xF4 */ +#define SECURITY_FREEZE_LOCK 0xBE /* 0xF5 */ +#define SECURITY_DISABLE_PASSWORD 0xBF /* 0xF6 */ + /* Bits for HD_ERROR */ #define MARK_ERR 0x01 /* Bad address mark */ #define TRK0_ERR 0x02 /* couldn't find track 0 */ @@ -125,6 +141,7 @@ struct hd_geometry { #define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ #define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ #define HDIO_SET_NICE 0x0329 /* set nice flags */ +#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ /* structure returned by HDIO_GET_IDENTITY, as per ANSI ATA2 rev.2f spec */ struct hd_driveid { @@ -184,14 +201,54 @@ struct hd_driveid { unsigned short word79; unsigned short word80; unsigned short word81; - unsigned short word82; - unsigned short word83; + unsigned short command_sets; /* bits 0:Smart 1:Security 2:Removable 3:PM */ + unsigned short word83; /* bits 14:Smart Enabled 13:0 zero */ unsigned short word84; unsigned short word85; unsigned short word86; unsigned short word87; unsigned short dma_ultra; - unsigned short reserved[167]; + unsigned short word89; /* reserved (word 89) */ + unsigned short word90; /* reserved (word 90) */ + unsigned short word91; /* reserved (word 91) */ + unsigned short word92; /* reserved (word 92) */ + unsigned short word93; /* reserved (word 93) */ + unsigned short word94; /* reserved (word 94) */ + unsigned short word95; /* reserved (word 95) */ + unsigned short word96; /* reserved (word 96) */ + unsigned short word97; /* reserved (word 97) */ + unsigned short word98; /* reserved (word 98) */ + unsigned short word99; /* reserved (word 99) */ + unsigned short word100; /* reserved (word 100) */ + unsigned short word101; /* reserved (word 101) */ + unsigned short word102; /* reserved (word 102) */ + unsigned short word103; /* reserved (word 103) */ + unsigned short word104; /* reserved (word 104) */ + unsigned short word105; /* reserved (word 105) */ + unsigned short word106; /* reserved (word 106) */ + unsigned short word107; /* reserved (word 107) */ + unsigned short word108; /* reserved (word 108) */ + unsigned short word109; /* reserved (word 109) */ + unsigned short word110; /* reserved (word 110) */ + unsigned short word111; /* reserved (word 111) */ + unsigned short word112; /* reserved (word 112) */ + unsigned short word113; /* reserved (word 113) */ + unsigned short word114; /* reserved (word 114) */ + unsigned short word115; /* reserved (word 115) */ + unsigned short word116; /* reserved (word 116) */ + unsigned short word117; /* reserved (word 117) */ + unsigned short word118; /* reserved (word 118) */ + unsigned short word119; /* reserved (word 119) */ + unsigned short word120; /* reserved (word 120) */ + unsigned short word121; /* reserved (word 121) */ + unsigned short word122; /* reserved (word 122) */ + unsigned short word123; /* reserved (word 123) */ + unsigned short word124; /* reserved (word 124) */ + unsigned short word125; /* reserved (word 125) */ + unsigned short word126; /* reserved (word 126) */ + unsigned short word127; /* reserved (word 127) */ + unsigned short security; /* bits 0:support 1:enabled 2:locked 3:frozen */ + unsigned short reserved[127]; }; /* diff --git a/include/linux/hfs_fs_i.h b/include/linux/hfs_fs_i.h index 453896882..03585a086 100644 --- a/include/linux/hfs_fs_i.h +++ b/include/linux/hfs_fs_i.h @@ -33,6 +33,9 @@ struct hfs_inode_info { const struct hfs_hdr_layout *default_layout; struct hfs_hdr_layout *layout; + /* to deal with localtime ugliness */ + int tz_secondswest; + /* for dentry cleanup */ void (*d_drop_op)(struct dentry *, const ino_t); }; diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 44c09570d..129e1ed58 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -6,7 +6,7 @@ * There are: * * i2c the basic control module (like scsi_mod) - * bus driver a driver with a i2c bus (host adapter driver) + * bus driver a driver with a i2c bus (hostadapter driver) * chip driver a driver for a chip connected * to a i2c bus (cdrom/hd driver) * @@ -87,8 +87,21 @@ struct i2c_driver /* needed: unsigned long flags */ -#define LOCK_I2C_BUS(bus) spin_lock_irqsave(&(bus->bus_lock),flags); -#define UNLOCK_I2C_BUS(bus) spin_unlock_irqrestore(&(bus->bus_lock),flags); +#if LINUX_VERSION_CODE >= 0x020100 +# if 0 +# define LOCK_FLAGS unsigned long flags; +# define LOCK_I2C_BUS(bus) spin_lock_irqsave(&(bus->bus_lock),flags); +# define UNLOCK_I2C_BUS(bus) spin_unlock_irqrestore(&(bus->bus_lock),flags); +# else +# define LOCK_FLAGS +# define LOCK_I2C_BUS(bus) spin_lock(&(bus->bus_lock)); +# define UNLOCK_I2C_BUS(bus) spin_unlock(&(bus->bus_lock)); +# endif +#else +# define LOCK_FLAGS unsigned long flags; +# define LOCK_I2C_BUS(bus) { save_flags(flags); cli(); } +# define UNLOCK_I2C_BUS(bus) { restore_flags(flags); } +#endif struct i2c_bus { @@ -96,7 +109,9 @@ struct i2c_bus int id; void *data; /* free for use by the bus driver */ +#if LINUX_VERSION_CODE >= 0x020100 spinlock_t bus_lock; +#endif /* attach/detach inform callbacks */ void (*attach_inform)(struct i2c_bus *bus, int id); @@ -163,4 +178,5 @@ int i2c_read(struct i2c_bus *bus, unsigned char addr); int i2c_write(struct i2c_bus *bus, unsigned char addr, unsigned char b1, unsigned char b2, int both); +int i2c_init(void); #endif /* I2C_H */ diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index 31bab91a4..30d8b8f0a 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h @@ -65,6 +65,7 @@ #define ARPHRD_HIPPI 780 /* High Performance Parallel Interface */ #define ARPHRD_ASH 781 /* Nexus 64Mbps Ash */ #define ARPHRD_ECONET 782 /* Acorn Econet */ +#define ARPHRD_IRDA 783 /* Linux/IR */ /* ARP protocol opcodes. */ #define ARPOP_REQUEST 1 /* ARP request */ diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index 68213c539..3fae9a9de 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h @@ -73,6 +73,8 @@ #define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ #define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ #define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ +#define ETH_P_CONTROL 0x0016 /* Card specific control frames */ +#define ETH_P_IRDA 0x0017 /* Linux/IR */ /* * This is an Ethernet frame header. diff --git a/include/linux/if_pppvar.h b/include/linux/if_pppvar.h index a85b33cd1..6fae4b94b 100644 --- a/include/linux/if_pppvar.h +++ b/include/linux/if_pppvar.h @@ -42,7 +42,7 @@ */ /* - * ==FILEVERSION 981004== + * ==FILEVERSION 990114== * * NOTE TO MAINTAINERS: * If you modify this file at all, please set the above date. @@ -61,7 +61,8 @@ #define NP_IP 0 /* Internet Protocol */ #define NP_IPX 1 /* IPX protocol */ #define NP_AT 2 /* Appletalk protocol */ -#define NUM_NP 3 /* Number of NPs. */ +#define NP_IPV6 3 /* Internet Protocol */ +#define NUM_NP 4 /* Number of NPs. */ #define OBUFSIZE 256 /* # chars of output buffering */ diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index f4662fc3d..25c449598 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h @@ -76,8 +76,6 @@ extern struct in_device *inetdev_init(struct device *dev); extern struct in_device *inetdev_by_index(int); extern u32 inet_select_addr(struct device *dev, u32 dst, int scope); extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix, u32 mask); -extern int inet_add_bootp_addr(struct device *dev); -extern void inet_del_bootp_addr(struct device *dev); extern void inet_forward_change(void); extern __inline__ int inet_ifa_match(u32 addr, struct in_ifaddr *ifa) diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 925e70d20..aa157d4a5 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -17,7 +17,7 @@ struct irqaction { extern volatile unsigned char bh_running; -extern int bh_mask_count[32]; +extern atomic_t bh_mask_count[32]; extern unsigned long bh_active; extern unsigned long bh_mask; extern void (*bh_base[32])(void); @@ -43,7 +43,8 @@ enum { CYCLADES_BH, CM206_BH, JS_BH, - MACSERIAL_BH + MACSERIAL_BH, + ISICOM_BH }; #include <asm/hardirq.h> diff --git a/include/linux/ip_masq.h b/include/linux/ip_masq.h index ac7ca606e..ba8931383 100644 --- a/include/linux/ip_masq.h +++ b/include/linux/ip_masq.h @@ -1,6 +1,6 @@ /* * IP_MASQ user space control interface - * $Id: ip_masq.h,v 1.1 1998/08/29 23:50:56 davem Exp $ + * $Id: ip_masq.h,v 1.2 1998/12/08 05:41:48 davem Exp $ */ #ifndef _LINUX_IP_MASQ_H @@ -90,16 +90,19 @@ struct ip_portfw_user { }; /* - * MARKFW stuff + * MFW stuff */ -struct ip_markfw_user { +struct ip_mfw_user { u_int32_t fwmark; /* Firewalling mark */ u_int32_t raddr; /* remote port */ u_int16_t rport; /* remote port */ u_int16_t dummy; /* Make up to multiple of 4 */ int pref; /* Preference value */ + unsigned flags; /* misc flags */ }; +#define IP_MASQ_MFW_SCHED 0x01 + #define IP_FW_MASQCTL_MAX 256 #define IP_MASQ_TNAME_MAX 32 @@ -110,7 +113,7 @@ struct ip_masq_ctl { union { struct ip_portfw_user portfw_user; struct ip_autofw_user autofw_user; - struct ip_markfw_user markfw_user; + struct ip_mfw_user mfw_user; struct ip_masq_user user; unsigned char m_raw[IP_FW_MASQCTL_MAX]; } u; @@ -123,14 +126,14 @@ struct ip_masq_ctl { #define IP_MASQ_TARGET_USER 3 #define IP_MASQ_TARGET_LAST 4 -#define IP_MASQ_CMD_NONE 0 +#define IP_MASQ_CMD_NONE 0 /* just peek */ #define IP_MASQ_CMD_INSERT 1 #define IP_MASQ_CMD_ADD 2 #define IP_MASQ_CMD_SET 3 #define IP_MASQ_CMD_DEL 4 #define IP_MASQ_CMD_GET 5 #define IP_MASQ_CMD_FLUSH 6 -#define IP_MASQ_CMD_LIST 7 +#define IP_MASQ_CMD_LIST 7 /* actually fake: done via /proc */ #define IP_MASQ_CMD_ENABLE 8 #define IP_MASQ_CMD_DISABLE 9 diff --git a/include/linux/ipc.h b/include/linux/ipc.h index 10840cab1..c1d9cbaf1 100644 --- a/include/linux/ipc.h +++ b/include/linux/ipc.h @@ -21,6 +21,11 @@ struct ipc_perm #define IPC_EXCL 00002000 /* fail if key exists */ #define IPC_NOWAIT 00004000 /* return error on wait */ +/* these fields are used by the DIPC package so the kernel as standard + should avoid using them if possible */ + +#define IPC_DIPC 00010000 /* make it distributed */ +#define IPC_OWN 00020000 /* this machine is the DIPC owner */ /* * Control commands used with semctl, msgctl and shmctl diff --git a/include/linux/ipx.h b/include/linux/ipx.h index c6846779b..8b9d6bb12 100644 --- a/include/linux/ipx.h +++ b/include/linux/ipx.h @@ -76,6 +76,7 @@ struct ipx_route_def #define SIOCAIPXITFCRT (SIOCPROTOPRIVATE) #define SIOCAIPXPRISLT (SIOCPROTOPRIVATE+1) #define SIOCIPXCFGDATA (SIOCPROTOPRIVATE+2) +#define SIOCIPXNCPCONN (SIOCPROTOPRIVATE+3) #ifdef __KERNEL__ #include <linux/skbuff.h> diff --git a/include/linux/isdn.h b/include/linux/isdn.h index e061cabaa..0b61899c0 100644 --- a/include/linux/isdn.h +++ b/include/linux/isdn.h @@ -1,9 +1,3 @@ -/* Changes for X.25 support: - Added ISDN_NET_ENCAP_X25IFACE macro. - Additional field in isdn_net_dev_s and isdn_net_local to support - generic encapsulation protocols. -*/ - /* $Id: isdn.h,v 1.37 1998/02/22 19:45:24 fritz Exp $ * * Main header for the Linux ISDN subsystem (linklevel). @@ -26,6 +20,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * + * Note: This file differs from the corresponding revision as present in the + * isdn4linux CVS repository because some later bug fixes have been extracted + * from the repository and merged into this file. -- Henner Eisen + * * $Log: isdn.h,v $ * Revision 1.37 1998/02/22 19:45:24 fritz * Some changes regarding V.110 @@ -800,6 +798,7 @@ typedef struct isdn_devt { int v110emu[ISDN_MAX_CHANNELS];/* V.110 emulator-mode 0=none */ atomic_t v110use[ISDN_MAX_CHANNELS];/* Usage-Semaphore for stream */ isdn_v110_stream *v110[ISDN_MAX_CHANNELS]; /* V.110 private data */ + struct semaphore sem; /* serialize list access*/ } isdn_dev; extern isdn_dev *dev; diff --git a/include/linux/isicom.h b/include/linux/isicom.h new file mode 100644 index 000000000..82325a9b8 --- /dev/null +++ b/include/linux/isicom.h @@ -0,0 +1,302 @@ +#ifndef _LINUX_ISICOM_H +#define _LINUX_ISICOM_H + +/*#define ISICOM_DEBUG*/ +/*#define ISICOM_DEBUG_DTR_RTS*/ + + +/* + * Firmware Loader definitions ... + */ + +#define __MultiTech ('M'<<8) +#define MIOCTL_LOAD_FIRMWARE (__MultiTech | 0x01) +#define MIOCTL_READ_FIRMWARE (__MultiTech | 0x02) +#define MIOCTL_XFER_CTRL (__MultiTech | 0x03) +#define MIOCTL_RESET_CARD (__MultiTech | 0x04) + +#define DATA_SIZE 16 + +typedef struct { + unsigned short exec_segment; + unsigned short exec_addr; +} exec_record; + +typedef struct { + int board; /* Board to load */ + unsigned short addr; + unsigned short count; +} bin_header; + +typedef struct { + int board; /* Board to load */ + unsigned short addr; + unsigned short count; + unsigned short segment; + unsigned char bin_data[DATA_SIZE]; +} bin_frame; + +#ifdef __KERNEL__ + +#define YES 1 +#define NO 0 + +#define ISILOAD_MISC_MINOR 155 /* /dev/isctl */ +#define ISILOAD_NAME "ISILoad" + +/* + * ISICOM Driver definitions ... + * + */ + +#define ISICOM_NAME "ISICom" + +/* + * These are now officially allocated numbers + */ + +#define ISICOM_NMAJOR 112 /* normal */ +#define ISICOM_CMAJOR 113 /* callout */ +#define ISICOM_MAGIC (('M' << 8) | 'T') + +#define WAKEUP_CHARS 256 /* hard coded for now */ +#define TX_SIZE 254 + +#define BOARD_COUNT 4 +#define PORT_COUNT (BOARD_COUNT*16) + +#define SERIAL_TYPE_NORMAL 1 +#define SERIAL_TYPE_CALLOUT 2 + +/* character sizes */ + +#define ISICOM_CS5 0x0000 +#define ISICOM_CS6 0x0001 +#define ISICOM_CS7 0x0002 +#define ISICOM_CS8 0x0003 + +/* stop bits */ + +#define ISICOM_1SB 0x0000 +#define ISICOM_2SB 0x0004 + +/* parity */ + +#define ISICOM_NOPAR 0x0000 +#define ISICOM_ODPAR 0x0008 +#define ISICOM_EVPAR 0x0018 + +/* flow control */ + +#define ISICOM_CTSRTS 0x03 +#define ISICOM_INITIATE_XONXOFF 0x04 +#define ISICOM_RESPOND_XONXOFF 0x08 + +#define InterruptTheCard(base) (outw(0,(base)+0xc)) +#define ClearInterrupt(base) (inw((base)+0x0a)) + +#define BOARD(line) (((line) >> 4) & 0x3) +#define MIN(a, b) ( (a) < (b) ? (a) : (b) ) + + /* isi kill queue bitmap */ + +#define ISICOM_KILLTX 0x01 +#define ISICOM_KILLRX 0x02 + + /* isi_board status bitmap */ + +#define FIRMWARE_LOADED 0x0001 +#define BOARD_ACTIVE 0x0002 + + /* isi_port status bitmap */ + +#define ISI_CTS 0x1000 +#define ISI_DSR 0x2000 +#define ISI_RI 0x4000 +#define ISI_DCD 0x8000 +#define ISI_DTR 0x0100 +#define ISI_RTS 0x0200 + + +#define ISI_TXOK 0x0001 + +struct isi_board { + unsigned short base; + unsigned char irq; + unsigned char port_count; + unsigned short status; + unsigned short port_status; /* each bit represents a single port */ + unsigned short shift_count; + struct isi_port * ports; + signed char count; +}; + +struct isi_port { + unsigned short magic; + unsigned int flags; + int count; + int blocked_open; + int close_delay; + unsigned short channel; + unsigned short status; + unsigned short closing_wait; + long session; + long pgrp; + struct isi_board * card; + struct tty_struct * tty; + struct wait_queue * close_wait; + struct wait_queue * open_wait; + struct tq_struct hangup_tq; + struct tq_struct bh_tqueue; + unsigned char * xmit_buf; + int xmit_head; + int xmit_tail; + int xmit_cnt; + struct termios normal_termios; + struct termios callout_termios; +}; + + +/* + * ISI Card specific ops ... + */ + +extern inline void raise_dtr(struct isi_port * port) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=300; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr.\n"); + return; + } +#ifdef ISICOM_DEBUG_DTR_RTS + printk(KERN_DEBUG "ISICOM: raise_dtr.\n"); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw(0x0504, base); + InterruptTheCard(base); + port->status |= ISI_DTR; +} + +extern inline void drop_dtr(struct isi_port * port) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=300; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr.\n"); + return; + } +#ifdef ISICOM_DEBUG_DTR_RTS + printk(KERN_DEBUG "ISICOM: drop_dtr.\n"); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw(0x0404, base); + InterruptTheCard(base); + port->status &= ~ISI_DTR; +} +extern inline void raise_rts(struct isi_port * port) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=300; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in raise_rts.\n"); + return; + } +#ifdef ISICOM_DEBUG_DTR_RTS + printk(KERN_DEBUG "ISICOM: raise_rts.\n"); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw(0x0a04, base); + InterruptTheCard(base); + port->status |= ISI_RTS; +} +extern inline void drop_rts(struct isi_port * port) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=300; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in drop_rts.\n"); + return; + } +#ifdef ISICOM_DEBUG_DTR_RTS + printk(KERN_DEBUG "ISICOM: drop_rts.\n"); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw(0x0804, base); + InterruptTheCard(base); + port->status &= ~ISI_RTS; +} +extern inline void raise_dtr_rts(struct isi_port * port) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=300; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr_rts.\n"); + return; + } +#ifdef ISICOM_DEBUG_DTR_RTS + printk(KERN_DEBUG "ISICOM: raise_dtr_rts.\n"); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw(0x0f04, base); + InterruptTheCard(base); + port->status |= (ISI_DTR | ISI_RTS); +} +extern inline void drop_dtr_rts(struct isi_port * port) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=300; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr_rts.\n"); + return; + } +#ifdef ISICOM_DEBUG_DTR_RTS + printk(KERN_DEBUG "ISICOM: drop_dtr_rts.\n"); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw(0x0c04, base); + InterruptTheCard(base); + port->status &= ~(ISI_RTS | ISI_DTR); +} + +extern inline void kill_queue(struct isi_port * port, short queue) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=300; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in kill_queue.\n"); + return; + } +#ifdef ISICOM_DEBUG + printk(KERN_DEBUG "ISICOM: kill_queue 0x%x.\n", queue); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw((queue << 8) | 0x06, base); + InterruptTheCard(base); +} + +#endif /* __KERNEL__ */ + +#endif /* ISICOM_H */ + diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 1111b19b4..73a0a689e 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -72,10 +72,10 @@ asmlinkage int printk(const char * fmt, ...) */ #define NIPQUAD(addr) \ - (int)(((addr) >> 0) & 0xff), \ - (int)(((addr) >> 8) & 0xff), \ - (int)(((addr) >> 16) & 0xff), \ - (int)(((addr) >> 24) & 0xff) + ((unsigned char *)&addr)[0], \ + ((unsigned char *)&addr)[1], \ + ((unsigned char *)&addr)[2], \ + ((unsigned char *)&addr)[3] #endif /* __KERNEL__ */ diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 876c7f222..7392910d3 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h @@ -1,4 +1,12 @@ /* kmod header */ + +#include <linux/config.h> + +#ifdef CONFIG_KMOD extern int request_module(const char * name); +#else +#define request_module(x) do {} while(0) +#endif + diff --git a/include/linux/mm.h b/include/linux/mm.h index b413095d3..2413bfedf 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -11,6 +11,7 @@ extern unsigned long max_mapnr; extern unsigned long num_physpages; extern void * high_memory; +extern int page_cluster; #include <asm/page.h> #include <asm/atomic.h> @@ -34,10 +35,17 @@ struct vm_area_struct { struct mm_struct * vm_mm; /* VM area parameters */ unsigned long vm_start; unsigned long vm_end; + + /* linked list of VM areas per task, sorted by address */ + struct vm_area_struct *vm_next; + pgprot_t vm_page_prot; unsigned short vm_flags; - struct vm_area_struct *vm_next; - struct vm_area_struct **vm_pprev; + + /* AVL tree of VM areas per task, sorted by address */ + short vm_avl_height; + struct vm_area_struct * vm_avl_left; + struct vm_area_struct * vm_avl_right; /* For areas with inode, the list inode->i_mmap, for shm areas, * the list of attaches, otherwise unused. @@ -97,7 +105,7 @@ struct vm_operations_struct { unsigned long (*nopage)(struct vm_area_struct * area, unsigned long address, int write_access); unsigned long (*wppage)(struct vm_area_struct * area, unsigned long address, unsigned long page); - int (*swapout)(struct vm_area_struct *, unsigned long, pte_t *); + int (*swapout)(struct vm_area_struct *, struct page *); pte_t (*swapin)(struct vm_area_struct *, unsigned long, unsigned long); }; @@ -117,32 +125,32 @@ typedef struct page { unsigned long offset; struct page *next_hash; atomic_t count; - unsigned int unused; unsigned long flags; /* atomic flags, some possibly updated asynchronously */ struct wait_queue *wait; struct page **pprev_hash; struct buffer_head * buffers; - unsigned long map_nr; /* page->map_nr == page - mem_map */ } mem_map_t; /* Page flag bit values */ #define PG_locked 0 #define PG_error 1 #define PG_referenced 2 -#define PG_uptodate 3 -#define PG_free_after 4 -#define PG_decr_after 5 -#define PG_swap_unlock_after 6 -#define PG_DMA 7 -#define PG_Slab 8 -#define PG_swap_cache 9 -#define PG_skip 10 +#define PG_dirty 3 +#define PG_uptodate 4 +#define PG_free_after 5 +#define PG_decr_after 6 +#define PG_swap_unlock_after 7 +#define PG_DMA 8 +#define PG_Slab 9 +#define PG_swap_cache 10 +#define PG_skip 11 #define PG_reserved 31 /* Make it prettier to test the above... */ #define PageLocked(page) (test_bit(PG_locked, &(page)->flags)) #define PageError(page) (test_bit(PG_error, &(page)->flags)) #define PageReferenced(page) (test_bit(PG_referenced, &(page)->flags)) +#define PageDirty(page) (test_bit(PG_dirty, &(page)->flags)) #define PageUptodate(page) (test_bit(PG_uptodate, &(page)->flags)) #define PageFreeAfter(page) (test_bit(PG_free_after, &(page)->flags)) #define PageDecrAfter(page) (test_bit(PG_decr_after, &(page)->flags)) @@ -154,12 +162,17 @@ typedef struct page { #define PageSetSlab(page) (set_bit(PG_Slab, &(page)->flags)) #define PageSetSwapCache(page) (set_bit(PG_swap_cache, &(page)->flags)) + +#define PageTestandSetDirty(page) \ + (test_and_set_bit(PG_dirty, &(page)->flags)) #define PageTestandSetSwapCache(page) \ (test_and_set_bit(PG_swap_cache, &(page)->flags)) #define PageClearSlab(page) (clear_bit(PG_Slab, &(page)->flags)) #define PageClearSwapCache(page)(clear_bit(PG_swap_cache, &(page)->flags)) +#define PageTestandClearDirty(page) \ + (test_and_clear_bit(PG_dirty, &(page)->flags)) #define PageTestandClearSwapCache(page) \ (test_and_clear_bit(PG_swap_cache, &(page)->flags)) @@ -249,6 +262,8 @@ extern inline unsigned long get_free_page(int gfp_mask) return page; } +extern int low_on_memory; + /* memory.c & swap.c*/ #define free_page(addr) free_pages((addr),0) @@ -260,7 +275,7 @@ extern unsigned long put_dirty_page(struct task_struct * tsk,unsigned long page, unsigned long address); extern void free_page_tables(struct mm_struct * mm); -extern void clear_page_tables(struct task_struct * tsk); +extern void clear_page_tables(struct mm_struct *, unsigned long, int); extern int new_page_tables(struct task_struct * tsk); extern void zap_page_range(struct mm_struct *mm, unsigned long address, unsigned long size); @@ -285,6 +300,7 @@ extern void si_meminfo(struct sysinfo * val); extern void vma_init(void); extern void merge_segments(struct mm_struct *, unsigned long, unsigned long); extern void insert_vm_struct(struct mm_struct *, struct vm_area_struct *); +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); @@ -307,15 +323,18 @@ extern void put_cached_page(unsigned long); #define __GFP_LOW 0x02 #define __GFP_MED 0x04 #define __GFP_HIGH 0x08 +#define __GFP_IO 0x10 +#define __GFP_SWAP 0x20 #define __GFP_UNCACHED 0x40 #define __GFP_DMA 0x80 #define GFP_BUFFER (__GFP_LOW | __GFP_WAIT) #define GFP_ATOMIC (__GFP_HIGH) -#define GFP_USER (__GFP_LOW | __GFP_WAIT) -#define GFP_KERNEL (__GFP_MED | __GFP_WAIT) -#define GFP_NFS (__GFP_HIGH | __GFP_WAIT) +#define GFP_USER (__GFP_LOW | __GFP_WAIT | __GFP_IO) +#define GFP_KERNEL (__GFP_MED | __GFP_WAIT | __GFP_IO) +#define GFP_NFS (__GFP_HIGH | __GFP_WAIT | __GFP_IO) +#define GFP_KSWAPD (__GFP_IO | __GFP_SWAP) /* Flag - indicates that the buffer should be allocated uncached as for an architecture where the caches don't snoop DMA access. This is a even @@ -359,22 +378,7 @@ static inline int expand_stack(struct vm_area_struct * vma, unsigned long addres } /* Look up the first VMA which satisfies addr < vm_end, NULL if none. */ -static inline struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr) -{ - struct vm_area_struct *vma = NULL; - - if (mm) { - /* Check the cache first. */ - vma = mm->mmap_cache; - if(!vma || (vma->vm_end <= addr) || (vma->vm_start > addr)) { - vma = mm->mmap; - while(vma && vma->vm_end <= addr) - vma = vma->vm_next; - mm->mmap_cache = vma; - } - } - return vma; -} +extern struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr); /* Look up the first VMA which intersects the interval start_addr..end_addr-1, NULL if none. Assume start_addr < end_addr. */ @@ -389,28 +393,8 @@ static inline struct vm_area_struct * find_vma_intersection(struct mm_struct * m #define buffer_under_min() ((buffermem >> PAGE_SHIFT) * 100 < \ buffer_mem.min_percent * num_physpages) -#define buffer_under_borrow() ((buffermem >> PAGE_SHIFT) * 100 < \ - buffer_mem.borrow_percent * num_physpages) -#define buffer_under_max() ((buffermem >> PAGE_SHIFT) * 100 < \ - buffer_mem.max_percent * num_physpages) -#define buffer_over_min() ((buffermem >> PAGE_SHIFT) * 100 > \ - buffer_mem.min_percent * num_physpages) -#define buffer_over_borrow() ((buffermem >> PAGE_SHIFT) * 100 > \ - buffer_mem.borrow_percent * num_physpages) -#define buffer_over_max() ((buffermem >> PAGE_SHIFT) * 100 > \ - buffer_mem.max_percent * num_physpages) #define pgcache_under_min() (page_cache_size * 100 < \ page_cache.min_percent * num_physpages) -#define pgcache_under_borrow() (page_cache_size * 100 < \ - page_cache.borrow_percent * num_physpages) -#define pgcache_under_max() (page_cache_size * 100 < \ - page_cache.max_percent * num_physpages) -#define pgcache_over_min() (page_cache_size * 100 > \ - page_cache.min_percent * num_physpages) -#define pgcache_over_borrow() (page_cache_size * 100 > \ - page_cache.borrow_percent * num_physpages) -#define pgcache_over_max() (page_cache_size * 100 > \ - page_cache.max_percent * num_physpages) #endif /* __KERNEL__ */ diff --git a/include/linux/module.h b/include/linux/module.h index ad3d10baf..94cce874f 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -20,6 +20,7 @@ # endif #endif /* __GENKSYMS__ */ +#include <asm/atomic.h> /* Don't need to bring in all of uaccess.h just for this decl. */ struct exception_table_entry; @@ -54,7 +55,12 @@ struct module const char *name; unsigned long size; - long usecount; + union + { + atomic_t usecount; + long pad; + } uc; /* Needs to keep its size - so says rth */ + unsigned long flags; /* AUTOCLEAN et al */ unsigned nsyms; @@ -80,10 +86,10 @@ struct module struct module_info { - unsigned long addr; - unsigned long size; - unsigned long flags; - long usecount; + unsigned long addr; + unsigned long size; + unsigned long flags; + long usecount; }; /* Bits of module.flags. */ @@ -114,17 +120,17 @@ struct module_info /* Backwards compatibility definition. */ -#define GET_USE_COUNT(module) ((module)->usecount) +#define GET_USE_COUNT(module) (atomic_read(&(module)->uc.usecount)) /* Poke the use count of a module. */ #define __MOD_INC_USE_COUNT(mod) \ - ((mod)->usecount++, (mod)->flags |= MOD_VISITED|MOD_USED_ONCE) + (atomic_inc(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED|MOD_USED_ONCE) #define __MOD_DEC_USE_COUNT(mod) \ - ((mod)->usecount--, (mod)->flags |= MOD_VISITED) + (atomic_dec(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED) #define __MOD_IN_USE(mod) \ (mod_member_present((mod), can_unload) && (mod)->can_unload \ - ? (mod)->can_unload() : (mod)->usecount) + ? (mod)->can_unload() : atomic_read(&(mod)->uc.usecount)) /* Indirect stringification. */ diff --git a/include/linux/msdos_fs_sb.h b/include/linux/msdos_fs_sb.h index 4985eef15..4497eeedb 100644 --- a/include/linux/msdos_fs_sb.h +++ b/include/linux/msdos_fs_sb.h @@ -35,9 +35,11 @@ struct vfat_unicode { struct msdos_sb_info { unsigned short cluster_size; /* sectors/cluster */ unsigned char fats,fat_bits; /* number of FATs, FAT bits (12 or 16) */ - unsigned short fat_start,fat_length; /* FAT start & length (sec.) */ - unsigned short dir_start,dir_entries; /* root dir start & entries */ - unsigned short data_start; /* first data sector */ + unsigned short fat_start; + unsigned long fat_length; /* FAT start & length (sec.) */ + unsigned long dir_start; + unsigned short dir_entries; /* root dir start & entries */ + unsigned long data_start; /* first data sector */ unsigned long clusters; /* number of clusters */ unsigned long root_cluster; /* first cluster of the root directory */ unsigned long fsinfo_offset; /* FAT32 fsinfo offset from start of disk */ diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 9a9297cac..afd52c619 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -222,13 +222,13 @@ extern int nfs_check_error(struct inode *); extern int nfs_wb_all(struct inode *); extern int nfs_wb_page(struct inode *, struct page *); extern int nfs_wb_pid(struct inode *, pid_t); +extern int nfs_flush_trunc(struct inode *, unsigned long); /* * Invalidate write-backs, possibly trying to write them * back first.. */ extern void nfs_inval(struct inode *); -extern int nfs_truncate_dirty_pages(struct inode *, unsigned long); extern int nfs_updatepage(struct file *, struct page *, unsigned long, unsigned int, int); /* diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index aea15a68b..4c32fe530 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h @@ -26,11 +26,6 @@ */ #define NFSD_VERSION "0.4" -/* - * Maximum number of nfsd processes - */ -#define NFSD_MAXSERVS 16 - #ifdef __KERNEL__ /* * Special flags for nfsd_permission. These must be different from MAY_READ, @@ -76,6 +71,7 @@ int nfsd_svc(unsigned short port, int nrservs); /* nfsd/vfs.c */ int fh_lock_parent(struct svc_fh *, struct dentry *); 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 *); int nfsd_setattr(struct svc_rqst *, struct svc_fh *, @@ -167,6 +163,11 @@ extern u32 nfs_ok, */ extern struct timeval nfssvc_boot; +/* + * The number of nfsd threads. + */ +extern int nfsd_nservers; + #endif /* __KERNEL__ */ #endif /* LINUX_NFSD_NFSD_H */ diff --git a/include/linux/nls.h b/include/linux/nls.h index 3321e2958..efcd58920 100644 --- a/include/linux/nls.h +++ b/include/linux/nls.h @@ -36,6 +36,7 @@ extern int init_nls_iso8859_6(void); extern int init_nls_iso8859_7(void); extern int init_nls_iso8859_8(void); extern int init_nls_iso8859_9(void); +extern int init_nls_iso8859_15(void); extern int init_nls_cp437(void); extern int init_nls_cp737(void); extern int init_nls_cp775(void); diff --git a/include/linux/ntfs_fs_i.h b/include/linux/ntfs_fs_i.h index dbb0289fd..cab27748c 100644 --- a/include/linux/ntfs_fs_i.h +++ b/include/linux/ntfs_fs_i.h @@ -5,13 +5,17 @@ struct ntfs_attribute; struct ntfs_sb_info; -/* Duplicate definitions from ntfs/types.h */ +/* Duplicate definitions from ntfs/ntfstypes.h */ #ifndef NTFS_INTEGRAL_TYPES #define NTFS_INTEGRAL_TYPES -typedef unsigned char ntfs_u8; -typedef unsigned short ntfs_u16; -typedef unsigned int ntfs_u32; -typedef unsigned long long ntfs_u64; +typedef u8 ntfs_u8; +typedef u16 ntfs_u16; +typedef u32 ntfs_u32; +typedef u64 ntfs_u64; +typedef s8 ntfs_s8; +typedef s16 ntfs_s16; +typedef s32 ntfs_s32; +typedef s64 ntfs_s64; #endif #ifndef NTMODE_T diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 667f214e1..e9305f9b8 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -14,7 +14,7 @@ static inline unsigned long page_address(struct page * page) { - return PAGE_OFFSET + PAGE_SIZE * page->map_nr; + return PAGE_OFFSET + PAGE_SIZE * (page - mem_map); } #define PAGE_HASH_BITS 11 diff --git a/include/linux/pc_keyb.h b/include/linux/pc_keyb.h index 651bf4b19..b79ecf0eb 100644 --- a/include/linux/pc_keyb.h +++ b/include/linux/pc_keyb.h @@ -51,6 +51,8 @@ extern unsigned char aux_device_present; #define KBD_CCMD_KBD_TEST 0xAB /* Keyboard interface test */ #define KBD_CCMD_KBD_DISABLE 0xAD /* Keyboard interface disable */ #define KBD_CCMD_KBD_ENABLE 0xAE /* Keyboard interface enable */ +#define KBD_CCMD_WRITE_AUX_OBUF 0xD3 /* Write to output buffer as if + initiated by the auxiliary device */ #define KBD_CCMD_WRITE_MOUSE 0xD4 /* Write the following byte to the mouse */ /* diff --git a/include/linux/pci.h b/include/linux/pci.h index 539586e40..6ba04c1d3 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -408,7 +408,11 @@ #define PCI_DEVICE_ID_MATROX_MYS 0x051A #define PCI_DEVICE_ID_MATROX_MIL_2 0x051b #define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f +#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520 +#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521 #define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10 +#define PCI_DEVICE_ID_MATROX_G100_MM 0x1000 +#define PCI_DEVICE_ID_MATROX_G100_AGP 0x1001 #define PCI_VENDOR_ID_CT 0x102c #define PCI_DEVICE_ID_CT_65545 0x00d8 @@ -538,6 +542,7 @@ #define PCI_VENDOR_ID_QLOGIC 0x1077 #define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020 #define PCI_DEVICE_ID_QLOGIC_ISP1022 0x1022 +#define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100 #define PCI_VENDOR_ID_CYRIX 0x1078 #define PCI_DEVICE_ID_CYRIX_5510 0x0000 @@ -587,6 +592,8 @@ #define PCI_VENDOR_ID_BROOKTREE 0x109e #define PCI_DEVICE_ID_BROOKTREE_848 0x0350 #define PCI_DEVICE_ID_BROOKTREE_849A 0x0351 +#define PCI_DEVICE_ID_BROOKTREE_878_1 0x036e +#define PCI_DEVICE_ID_BROOKTREE_878 0x0878 #define PCI_DEVICE_ID_BROOKTREE_8474 0x8474 #define PCI_VENDOR_ID_SIERRA 0x10a8 @@ -720,6 +727,7 @@ #define PCI_DEVICE_ID_VIA_82C586_0 0x0586 #define PCI_DEVICE_ID_VIA_82C595 0x0595 #define PCI_DEVICE_ID_VIA_82C597_0 0x0597 +#define PCI_DEVICE_ID_VIA_82C598_0 0x0598 #define PCI_DEVICE_ID_VIA_82C926 0x0926 #define PCI_DEVICE_ID_VIA_82C416 0x1571 #define PCI_DEVICE_ID_VIA_82C595_97 0x1595 @@ -727,6 +735,10 @@ #define PCI_DEVICE_ID_VIA_82C586_3 0x3040 #define PCI_DEVICE_ID_VIA_86C100A 0x6100 #define PCI_DEVICE_ID_VIA_82C597_1 0x8597 +#define PCI_DEVICE_ID_VIA_82C598_1 0x8598 + +#define PCI_VENDOR_ID_SMC2 0x1113 +#define PCI_DEVICE_ID_SMC2_1211TX 0x1211 #define PCI_VENDOR_ID_VORTEX 0x1119 #define PCI_DEVICE_ID_VORTEX_GDT60x0 0x0000 @@ -897,6 +909,7 @@ #define PCI_VENDOR_ID_3DFX 0x121a #define PCI_DEVICE_ID_3DFX_VOODOO 0x0001 #define PCI_DEVICE_ID_3DFX_VOODOO2 0x0002 +#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003 #define PCI_VENDOR_ID_SIGMADES 0x1236 #define PCI_DEVICE_ID_SIGMADES_6425 0x6401 @@ -982,6 +995,9 @@ #define PCI_DEVICE_ID_S3_ViRGE_MXPMV 0x8c03 #define PCI_DEVICE_ID_S3_SONICVIBES 0xca00 +#define PCI_VENDOR_ID_DCI 0x6666 +#define PCI_DEVICE_ID_DCI_PCCOM4 0x0001 + #define PCI_VENDOR_ID_GENROCO 0x5555 #define PCI_DEVICE_ID_GENROCO_HFP832 0x0003 @@ -1048,8 +1064,10 @@ #define PCI_VENDOR_ID_ADAPTEC2 0x9005 #define PCI_DEVICE_ID_ADAPTEC2_2940U2 0x0010 +#define PCI_DEVICE_ID_ADAPTEC2_78902 0x0013 #define PCI_DEVICE_ID_ADAPTEC2_7890 0x001f #define PCI_DEVICE_ID_ADAPTEC2_3940U2 0x0050 +#define PCI_DEVICE_ID_ADAPTEC2_3950U2D 0x0051 #define PCI_DEVICE_ID_ADAPTEC2_7896 0x005f #define PCI_VENDOR_ID_ATRONICS 0x907f diff --git a/include/linux/poll.h b/include/linux/poll.h index 7cafbfbad..7eb57334f 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h @@ -7,6 +7,7 @@ #include <linux/wait.h> #include <linux/string.h> +#include <linux/mm.h> #include <asm/uaccess.h> @@ -17,31 +18,21 @@ struct poll_table_entry { }; typedef struct poll_table_struct { + struct poll_table_struct * next; unsigned int nr; struct poll_table_entry * entry; } poll_table; -#define __MAX_POLL_TABLE_ENTRIES (PAGE_SIZE / sizeof (struct poll_table_entry)) +#define __MAX_POLL_TABLE_ENTRIES ((PAGE_SIZE - sizeof (poll_table)) / sizeof (struct poll_table_entry)) + +extern void __pollwait(struct file * filp, struct wait_queue ** wait_address, poll_table *p); extern inline void poll_wait(struct file * filp, struct wait_queue ** wait_address, poll_table *p) { - struct poll_table_entry * entry; - - if (!p || !wait_address) - return; - if (p->nr >= __MAX_POLL_TABLE_ENTRIES) - return; - entry = p->entry + p->nr; - entry->filp = filp; - filp->f_count++; - entry->wait_address = wait_address; - entry->wait.task = current; - entry->wait.next = NULL; - add_wait_queue(wait_address,&entry->wait); - p->nr++; + if (p && wait_address) + __pollwait(filp, wait_address, p); } - /* * For the kernel fd_set we use a fixed set-size for allocation purposes. * This set-size doesn't necessarily bear any relation to the size the user @@ -59,11 +50,21 @@ extern inline void poll_wait(struct file * filp, struct wait_queue ** wait_addre #define KFDS_NR (KFDS_64BLOCK*8 > NR_OPEN ? NR_OPEN : KFDS_64BLOCK*8) typedef unsigned long kernel_fd_set[KFDS_NR/__NFDBITS]; +/* + * Scaleable version of the fd_set. + */ + typedef struct { - kernel_fd_set in, out, ex; - kernel_fd_set res_in, res_out, res_ex; -} fd_set_buffer; + unsigned long *in, *out, *ex; + unsigned long *res_in, *res_out, *res_ex; +} fd_set_bits; +/* + * How many longwords for "nr" bits? + */ +#define FDS_BITPERLONG (8*sizeof(long)) +#define FDS_LONGS(nr) (((nr)+FDS_BITPERLONG-1)/FDS_BITPERLONG) +#define FDS_BYTES(nr) (FDS_LONGS(nr)*sizeof(long)) /* * We do a VERIFY_WRITE here even though we are only reading this time: @@ -74,8 +75,7 @@ typedef struct { static inline int get_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset) { - /* round up nr to nearest "unsigned long" */ - nr = (nr + 8*sizeof(long) - 1) / (8*sizeof(long)) * sizeof(long); + nr = FDS_BYTES(nr); if (ufdset) { int error; error = verify_area(VERIFY_WRITE, ufdset, nr); @@ -90,20 +90,17 @@ int get_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset) static inline void set_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset) { - if (ufdset) { - nr = (nr + 8*sizeof(long) - 1) / (8*sizeof(long))*sizeof(long); - __copy_to_user(ufdset, fdset, nr); - } + if (ufdset) + __copy_to_user(ufdset, fdset, FDS_BYTES(nr)); } static inline void zero_fd_set(unsigned long nr, unsigned long *fdset) { - nr = (nr + 8*sizeof(long) - 1) / (8*sizeof(long)) * sizeof(long); - memset(fdset, 0, nr); + memset(fdset, 0, FDS_BYTES(nr)); } -extern int do_select(int n, fd_set_buffer *fds, long *timeout); +extern int do_select(int n, fd_set_bits *fds, long *timeout); #endif /* KERNEL */ diff --git a/include/linux/ppp_defs.h b/include/linux/ppp_defs.h index bb2d14c6e..c506c90ab 100644 --- a/include/linux/ppp_defs.h +++ b/include/linux/ppp_defs.h @@ -28,7 +28,7 @@ */ /* - * ==FILEVERSION 970607== + * ==FILEVERSION 990114== * * NOTE TO MAINTAINERS: * If you modify this file at all, please set the above date. @@ -75,6 +75,7 @@ #define PPP_IPCP 0x8021 /* IP Control Protocol */ #define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ #define PPP_IPXCP 0x802b /* IPX Control Protocol */ +#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ #define PPP_CCP 0x80fd /* Compression Control Protocol */ #define PPP_LCP 0xc021 /* Link Control Protocol */ #define PPP_PAP 0xc023 /* Password Authentication Protocol */ diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index d12e05650..e02d072f7 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -139,10 +139,13 @@ enum net_directory_inos { PROC_NET_DN_L2, PROC_NET_DN_CACHE, PROC_NET_DN_SKT, + PROC_NET_DN_FW, + PROC_NET_DN_RAW, PROC_NET_NETSTAT, PROC_NET_IPFW_CHAINS, PROC_NET_IPFW_CHAIN_NAMES, PROC_NET_AT_AARP, + PROC_NET_BRIDGE, PROC_NET_LAST }; @@ -167,6 +170,7 @@ enum scsi_directory_inos { PROC_SCSI_PAS16, PROC_SCSI_QLOGICFAS, PROC_SCSI_QLOGICISP, + PROC_SCSI_QLOGICFC, PROC_SCSI_SEAGATE, PROC_SCSI_T128, PROC_SCSI_NCR53C7xx, @@ -180,7 +184,9 @@ enum scsi_directory_inos { PROC_SCSI_AM53C974, PROC_SCSI_SSC, PROC_SCSI_NCR53C406A, + PROC_SCSI_MEGARAID, PROC_SCSI_PPA, + PROC_SCSI_ATP870U, PROC_SCSI_ESP, PROC_SCSI_QLOGICPTI, PROC_SCSI_AMIGA7XX, @@ -196,6 +202,7 @@ enum scsi_directory_inos { PROC_SCSI_MESH, PROC_SCSI_53C94, PROC_SCSI_PLUTO, + PROC_SCSI_INI9100U, PROC_SCSI_SCSI_DEBUG, PROC_SCSI_NOT_PRESENT, PROC_SCSI_FILE, /* I'm assuming here that we */ @@ -290,6 +297,8 @@ typedef int (write_proc_t)(struct file *file, const char *buffer, extern int (* dispatch_scsi_info_ptr) (int ino, char *buffer, char **start, off_t offset, int length, int inout); +#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; @@ -429,4 +438,26 @@ extern void proc_tty_unregister_driver(struct tty_driver *driver); */ extern void proc_device_tree_init(void); +#else + +extern inline int proc_register(struct proc_dir_entry *a, struct proc_dir_entry *b) {}; +extern inline int proc_unregister(struct proc_dir_entry *a, int b) {}; +extern inline int proc_net_register(struct proc_dir_entry *a) {}; +extern inline int proc_net_unregister(int x) {}; +extern inline int proc_scsi_register(struct proc_dir_entry *b, struct proc_dir_entry *c) {}; +extern inline int proc_scsi_unregister(struct proc_dir_entry *a, int x); + +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 void proc_tty_register_driver(struct tty_driver *driver) {}; +extern inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; + + +#endif #endif /* _LINUX_PROC_FS_H */ diff --git a/include/linux/quota.h b/include/linux/quota.h index c0945f60b..2c4a5bcef 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h @@ -86,7 +86,7 @@ extern int max_dquots; extern int dquot_root_squash; #define NR_DQHASH 43 /* Just an arbitrary number */ -#define NR_DQUOTS 256 /* Maximum number of quotas active at one time (Configurable from /proc/sys/fs) */ +#define NR_DQUOTS 1024 /* Maximum number of quotas active at one time (Configurable from /proc/sys/fs) */ /* * Command definitions for the 'quotactl' system call. diff --git a/include/linux/scc.h b/include/linux/scc.h index c8a440538..7ad72e102 100644 --- a/include/linux/scc.h +++ b/include/linux/scc.h @@ -82,8 +82,8 @@ enum HWEVENT_opts { /* channel grouping */ -#define RXGROUP 0x100 /* if set, only tx when all channels clear */ -#define TXGROUP 0x200 /* if set, don't transmit simultaneously */ +#define RXGROUP 0100 /* if set, only tx when all channels clear */ +#define TXGROUP 0200 /* if set, don't transmit simultaneously */ /* Tx/Rx clock sources */ @@ -237,6 +237,7 @@ struct scc_channel { unsigned char wreg[16]; /* Copy of last written value in WRx */ unsigned char status; /* Copy of R0 at last external interrupt */ + unsigned char dcd; /* DCD status */ struct scc_kiss kiss; /* control structure for KISS params */ struct scc_stat stat; /* statistical information */ diff --git a/include/linux/sched.h b/include/linux/sched.h index da5be1f10..b37bce2cc 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -11,6 +11,7 @@ extern unsigned long event; #include <linux/kernel.h> #include <linux/types.h> #include <linux/times.h> +#include <linux/timex.h> #include <asm/system.h> #include <asm/semaphore.h> @@ -32,6 +33,7 @@ extern unsigned long event; #define CLONE_SIGHAND 0x00000800 /* set if signal handlers shared */ #define CLONE_PID 0x00001000 /* set if pid shared */ #define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */ +#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ /* * These are the constant used to fake the fixed-point load-average @@ -154,11 +156,16 @@ struct fs_struct { /* Maximum number of active map areas.. This is a random (large) number */ #define MAX_MAP_COUNT (65536) +/* Number of map areas at which the AVL tree is activated. This is arbitrary. */ +#define AVL_MIN_MAP_COUNT 32 + struct mm_struct { - struct vm_area_struct *mmap, *mmap_cache; + struct vm_area_struct *mmap; /* list of VMAs */ + struct vm_area_struct *mmap_avl; /* tree of VMAs */ + struct vm_area_struct *mmap_cache; /* last find_vma result */ pgd_t * pgd; atomic_t count; - int map_count; + int map_count; /* number of VMAs */ struct semaphore mmap_sem; unsigned long context; unsigned long start_code, end_code, start_data, end_data; @@ -175,7 +182,8 @@ struct mm_struct { }; #define INIT_MM { \ - &init_mmap, NULL, swapper_pg_dir, \ + &init_mmap, NULL, NULL, \ + swapper_pg_dir, \ ATOMIC_INIT(1), 1, \ MUTEX, \ 0, \ @@ -219,6 +227,7 @@ struct task_struct { /* various fields */ long counter; long priority; + cycles_t avg_slice; /* SMP and runqueue state */ int has_cpu; int processor; @@ -256,6 +265,7 @@ struct task_struct { struct task_struct **tarray_ptr; struct wait_queue *wait_chldexit; /* for wait4() */ + struct semaphore *vfork_sem; /* for vfork() */ unsigned long policy, rt_priority; unsigned long it_real_value, it_prof_value, it_virt_value; unsigned long it_real_incr, it_prof_incr, it_virt_incr; @@ -267,8 +277,6 @@ struct task_struct { unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap; int swappable:1; unsigned long swap_address; - unsigned long old_maj_flt; /* old value of maj_flt */ - unsigned long dec_flt; /* page fault count of the last time */ unsigned long swap_cnt; /* number of pages to swap on next pass */ /* process credentials */ uid_t uid,euid,suid,fsuid; @@ -295,6 +303,7 @@ struct task_struct { struct files_struct *files; /* memory management info */ struct mm_struct *mm; + /* signal handlers */ spinlock_t sigmask_lock; /* Protects signal and blocked */ struct signal_struct *sig; @@ -318,6 +327,7 @@ struct task_struct { #define PF_DUMPCORE 0x00000200 /* dumped core */ #define PF_SIGNALED 0x00000400 /* killed by a signal */ #define PF_MEMALLOC 0x00000800 /* Allocating memory */ +#define PF_VFORK 0x00001000 /* Wake up parent in mm_release */ #define PF_USEDFPU 0x00100000 /* task used FPU this quantum (SMP) */ #define PF_DTRACE 0x00200000 /* delayed trace (used on m68k, i386) */ @@ -328,7 +338,7 @@ struct task_struct { */ #define _STK_LIM (8*1024*1024) -#define DEF_PRIORITY (20*HZ/100) /* 200 ms time slices */ +#define DEF_PRIORITY (20*HZ/100) /* 210 ms time slices */ /* * INIT_TASK is used to set up the first task table, touch at @@ -336,7 +346,7 @@ struct task_struct { */ #define INIT_TASK \ /* state etc */ { 0,0,0,KERNEL_DS,&default_exec_domain,0, \ -/* counter */ DEF_PRIORITY,DEF_PRIORITY, \ +/* counter */ DEF_PRIORITY,DEF_PRIORITY,0, \ /* SMP */ 0,0,0,-1, \ /* schedlink */ &init_task,&init_task, &init_task, &init_task, \ /* binfmt */ NULL, \ @@ -345,13 +355,13 @@ struct task_struct { /* proc links*/ &init_task,&init_task,NULL,NULL,NULL, \ /* pidhash */ NULL, NULL, \ /* tarray */ &task[0], \ -/* chld wait */ NULL, \ +/* chld wait */ NULL, NULL, \ /* timeout */ SCHED_OTHER,0,0,0,0,0,0,0, \ /* timer */ { NULL, NULL, 0, 0, it_real_fn }, \ /* utime */ {0,0,0,0},0, \ /* per CPU times */ {0, }, {0, }, \ /* flt */ 0,0,0,0,0,0, \ -/* swp */ 0,0,0,0,0, \ +/* swp */ 0,0,0, \ /* process credentials */ \ /* uid etc */ 0,0,0,0,0,0,0,0, \ /* suppl grps*/ 0, {0,}, \ @@ -455,6 +465,8 @@ extern unsigned long prof_shift; extern void FASTCALL(__wake_up(struct wait_queue ** p, unsigned int mode)); extern void FASTCALL(sleep_on(struct wait_queue ** p)); +extern long FASTCALL(sleep_on_timeout(struct wait_queue ** p, + signed long timeout)); extern void FASTCALL(interruptible_sleep_on(struct wait_queue ** p)); extern long FASTCALL(interruptible_sleep_on_timeout(struct wait_queue ** p, signed long timeout)); @@ -603,6 +615,8 @@ static inline void mmget(struct mm_struct * mm) atomic_inc(&mm->count); } extern void mmput(struct mm_struct *); +/* Remove the current tasks stale references to the old mm_struct */ +extern void mm_release(void); extern int copy_thread(int, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); extern void flush_thread(void); diff --git a/include/linux/sem.h b/include/linux/sem.h index a5b3134bf..3fb2a48f6 100644 --- a/include/linux/sem.h +++ b/include/linux/sem.h @@ -92,6 +92,7 @@ struct sem_queue { struct semid_ds * sma; /* semaphore array for operations */ struct sembuf * sops; /* array of pending operations */ int nsops; /* number of operations */ + int alter; /* operation will alter semaphore */ }; /* Each task has a list of undo requests. They are executed automatically diff --git a/include/linux/shm.h b/include/linux/shm.h index 819e346a4..a6d13e8d9 100644 --- a/include/linux/shm.h +++ b/include/linux/shm.h @@ -14,6 +14,9 @@ struct shmid_ds { __kernel_ipc_pid_t shm_cpid; /* pid of creator */ __kernel_ipc_pid_t shm_lpid; /* pid of last operator */ unsigned short shm_nattch; /* no. of current attaches */ + unsigned short shm_unused; /* compatibility */ + void *shm_unused2; /* ditto - used by DIPC */ + void *shm_unused3; /* unused */ }; struct shmid_kernel diff --git a/include/linux/smp.h b/include/linux/smp.h index 5034c71f6..80ea3056f 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -11,12 +11,22 @@ #include <asm/smp.h> /* - * main IPI interface, handles INIT, TLB flush, STOP, etc. (defined in asm header): - * - * extern void smp_message_pass(int target, int msg, unsigned long data, int wait); + * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc. + * (defined in asm header): */ /* + * stops all CPUs but the current one: + */ +extern void smp_send_stop(void); + +/* + * sends a 'reschedule' event to another CPU: + */ +extern void FASTCALL(smp_send_reschedule(int cpu)); + + +/* * Boot processor call to load the other CPU's */ extern void smp_boot_cpus(void); @@ -61,7 +71,6 @@ extern volatile int smp_msg_id; #define smp_num_cpus 1 #define smp_processor_id() 0 #define hard_smp_processor_id() 0 -#define smp_message_pass(t,m,d,w) #define smp_threads_ready 1 #define kernel_lock() #define cpu_logical_map(cpu) 0 diff --git a/include/linux/socket.h b/include/linux/socket.h index f1e8dcfaf..41e759751 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -154,6 +154,7 @@ struct ucred { #define AF_ECONET 19 /* Acorn Econet */ #define AF_ATMSVC 20 /* ATM SVCs */ #define AF_SNA 22 /* Linux SNA Project (nutters!) */ +#define AF_IRDA 23 /* IRDA sockets */ #define AF_MAX 32 /* For now.. */ /* Protocol families, same as address families. */ @@ -181,6 +182,7 @@ struct ucred { #define PF_ECONET AF_ECONET #define PF_ATMSVC AF_ATMSVC #define PF_SNA AF_SNA +#define PF_IRDA AF_IRDA #define PF_MAX AF_MAX @@ -194,6 +196,7 @@ struct ucred { #define MSG_OOB 1 #define MSG_PEEK 2 #define MSG_DONTROUTE 4 +#define MSG_TRYHARD 4 /* Synonym for MSG_DONTROUTE for DECnet */ #define MSG_CTRUNC 8 #define MSG_PROXY 0x10 /* Supply or ask second address. */ #define MSG_TRUNC 0x20 diff --git a/include/linux/sound.h b/include/linux/sound.h index bc9335801..4921b90e2 100644 --- a/include/linux/sound.h +++ b/include/linux/sound.h @@ -2,11 +2,11 @@ * Sound core interface functions */ -extern int register_sound_special(struct file_operations *, int); -extern int register_sound_mixer(struct file_operations *fops); -extern int register_sound_midi(struct file_operations *fops); -extern int register_sound_dsp(struct file_operations *fops); -extern int register_sound_synth(struct file_operations *fops); +extern int register_sound_special(struct file_operations *fops, int unit); +extern int register_sound_mixer(struct file_operations *fops, int dev); +extern int register_sound_midi(struct file_operations *fops, int dev); +extern int register_sound_dsp(struct file_operations *fops, int dev); +extern int register_sound_synth(struct file_operations *fops, int dev); extern void unregister_sound_special(int unit); extern void unregister_sound_mixer(int unit); diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index f0f8e0384..8ec30527f 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h @@ -128,7 +128,7 @@ void rpc_killall_tasks(struct rpc_clnt *); void rpc_execute(struct rpc_task *); void rpc_run_child(struct rpc_task *parent, struct rpc_task *child, rpc_action action); -void rpc_add_wait_queue(struct rpc_wait_queue *, struct rpc_task *); +int rpc_add_wait_queue(struct rpc_wait_queue *, struct rpc_task *); void rpc_remove_wait_queue(struct rpc_task *); void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *, rpc_action action, rpc_action timer); diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h index c01ebfa4b..24da571cb 100644 --- a/include/linux/sunrpc/stats.h +++ b/include/linux/sunrpc/stats.h @@ -9,6 +9,7 @@ #ifndef _LINUX_SUNRPC_STATS_H #define _LINUX_SUNRPC_STATS_H +#include <linux/config.h> #include <linux/proc_fs.h> struct rpc_stat { @@ -44,6 +45,7 @@ void rpc_proc_exit(void); void rpc_modcount(struct inode *, int); #endif +#ifdef CONFIG_PROC_FS struct proc_dir_entry * rpc_proc_register(struct rpc_stat *); void rpc_proc_unregister(const char *); int rpc_proc_read(char *, char **, off_t, int, @@ -55,4 +57,18 @@ int svc_proc_read(char *, char **, off_t, int, int *, void *); void svc_proc_zero(struct svc_program *); +#else + +extern inline void svc_proc_unregister(const char *p) {} +extern inline struct proc_dir_entry*svc_proc_register(struct svc_stat *s) +{ + return NULL; +} + +extern inline int svc_proc_read(char *a, char **b, off_t c, int d, int *e, void *f) +{ + return 0; +} +#endif + #endif /* _LINUX_SUNRPC_STATS_H */ diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 7c9a1e525..4ab59ed1c 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -106,7 +106,8 @@ struct svc_rqst { u32 rq_prot; /* IP protocol */ unsigned short rq_verfed : 1, /* reply has verifier */ rq_userset : 1, /* auth->setuser OK */ - rq_secure : 1; /* secure port */ + rq_secure : 1, /* secure port */ + rq_auth : 1; /* check client */ void * rq_argp; /* decoded arguments */ void * rq_resp; /* xdr'd results */ diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index df16576d7..032293ea3 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -158,7 +158,7 @@ struct rpc_xprt { */ union { /* record marker & XID */ u32 header[2]; - u8 * data[8]; + u8 data[8]; } tcp_recm; struct rpc_rqst * tcp_rqstp; struct iovec tcp_iovec[MAX_IOVEC]; diff --git a/include/linux/swap.h b/include/linux/swap.h index d4fcf03b8..66ba5d623 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -1,6 +1,8 @@ #ifndef _LINUX_SWAP_H #define _LINUX_SWAP_H +#include <asm/page.h> + #define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */ #define SWAP_FLAG_PRIO_MASK 0x7fff #define SWAP_FLAG_PRIO_SHIFT 0 @@ -26,6 +28,13 @@ union swap_header { #ifdef __KERNEL__ +/* + * Max bad pages in the new format.. + */ +#define __swapoffset(x) ((unsigned long)&((union swap_header *)0)->x) +#define MAX_SWAP_BADPAGES \ + ((__swapoffset(magic.magic) - __swapoffset(info.badpages)) / sizeof(int)) + #undef DEBUG_SWAP #include <asm/atomic.h> @@ -69,12 +78,16 @@ struct sysinfo; /* linux/ipc/shm.c */ extern int shm_swap (int, int); +/* linux/mm/swap.c */ +extern void swap_setup (void); + /* linux/mm/vmscan.c */ -extern int try_to_free_pages(unsigned int gfp_mask, int count); +extern int try_to_free_pages(unsigned int gfp_mask); /* linux/mm/page_io.c */ extern void rw_swap_page(int, unsigned long, char *, int); extern void rw_swap_page_nocache(int, unsigned long, char *); +extern void rw_swap_page_nolock(int, unsigned long, char *, int); extern void swap_after_unlock_page (unsigned long entry); /* linux/mm/page_alloc.c */ @@ -87,6 +100,7 @@ extern void show_swap_cache_info(void); extern int add_to_swap_cache(struct page *, unsigned long); extern int swap_duplicate(unsigned long); extern int swap_check_entry(unsigned long); +struct page * lookup_swap_cache(unsigned long); extern struct page * read_swap_cache_async(unsigned long, int); #define read_swap_cache(entry) read_swap_cache_async(entry, 1); extern int FASTCALL(swap_count(unsigned long)); @@ -125,9 +139,7 @@ asmlinkage int sys_swapon(const char *, int); #ifdef SWAP_CACHE_INFO extern unsigned long swap_cache_add_total; -extern unsigned long swap_cache_add_success; extern unsigned long swap_cache_del_total; -extern unsigned long swap_cache_del_success; extern unsigned long swap_cache_find_total; extern unsigned long swap_cache_find_success; #endif @@ -152,12 +164,7 @@ static inline int is_page_shared(struct page *page) return 1; count = atomic_read(&page->count); if (PageSwapCache(page)) - { - /* PARANOID */ - if (page->inode != &swapper_inode) - panic("swap cache page has wrong inode\n"); count += swap_count(page->offset) - 2; - } if (PageFreeAfter(page)) count--; return count > 1; diff --git a/include/linux/swapctl.h b/include/linux/swapctl.h index 54fb59381..f9f2d2acb 100644 --- a/include/linux/swapctl.h +++ b/include/linux/swapctl.h @@ -4,33 +4,6 @@ #include <asm/page.h> #include <linux/fs.h> -/* Swap tuning control */ - -typedef struct swap_control_v6 -{ - unsigned int sc_max_page_age; - unsigned int sc_page_advance; - unsigned int sc_page_decline; - unsigned int sc_page_initial_age; - unsigned int sc_age_cluster_fract; - unsigned int sc_age_cluster_min; - unsigned int sc_pageout_weight; - unsigned int sc_bufferout_weight; -} swap_control_v6; -typedef struct swap_control_v6 swap_control_t; -extern swap_control_t swap_control; - -typedef struct swapstat_v1 -{ - unsigned int wakeups; - unsigned int pages_reclaimed; - unsigned int pages_shm; - unsigned int pages_mmap; - unsigned int pages_swap; -} swapstat_v1; -typedef swapstat_v1 swapstat_t; -extern swapstat_t swapstats; - typedef struct buffer_mem_v1 { unsigned int min_percent; @@ -59,41 +32,4 @@ typedef struct pager_daemon_v1 typedef pager_daemon_v1 pager_daemon_t; extern pager_daemon_t pager_daemon; -#define SC_VERSION 1 -#define SC_MAX_VERSION 1 - -#ifdef __KERNEL__ - -/* Define the maximum (least urgent) priority for the page reclaim code */ -#define RCL_MAXPRI 6 -/* We use an extra priority in the swap accounting code to represent - failure to free a resource at any priority */ -#define RCL_FAILURE (RCL_MAXPRI + 1) - -#define AGE_CLUSTER_FRACT (swap_control.sc_age_cluster_fract) -#define AGE_CLUSTER_MIN (swap_control.sc_age_cluster_min) -#define PAGEOUT_WEIGHT (swap_control.sc_pageout_weight) -#define BUFFEROUT_WEIGHT (swap_control.sc_bufferout_weight) - -/* Page aging (see mm/swap.c) */ - -#define MAX_PAGE_AGE (swap_control.sc_max_page_age) -#define PAGE_ADVANCE (swap_control.sc_page_advance) -#define PAGE_DECLINE (swap_control.sc_page_decline) -#define PAGE_INITIAL_AGE (swap_control.sc_page_initial_age) - -/* Given a resource of N units (pages or buffers etc), we only try to - * age and reclaim AGE_CLUSTER_FRACT per 1024 resources each time we - * scan the resource list. */ -static inline int AGE_CLUSTER_SIZE(int resources) -{ - unsigned int n = (resources * AGE_CLUSTER_FRACT) >> 10; - if (n < AGE_CLUSTER_MIN) - return AGE_CLUSTER_MIN; - else - return n; -} - -#endif /* __KERNEL */ - #endif /* _LINUX_SWAPCTL_H */ diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 20e3b9abf..413864d40 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -56,7 +56,7 @@ enum CTL_PROC=4, /* Process info */ CTL_FS=5, /* Filesystems */ CTL_DEBUG=6, /* Debugging */ - CTL_DEV=7, /* Devices */ + CTL_DEV=7 /* Devices */ }; @@ -89,6 +89,14 @@ enum KERN_SG_BIG_BUFF=29, KERN_ACCT=30, /* BSD process accounting parameters */ KERN_PPC_L2CR=31, /* l2cr register on PPC */ + + KERN_RTSIGNR=32, /* Number of rt sigs queued */ + KERN_RTSIGMAX=33, /* Max queuable */ + + KERN_SHMMAX=34, /* int: 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 */ }; @@ -103,7 +111,8 @@ enum VM_BUFFERMEM=6, /* struct: Set buffer memory thresholds */ VM_PAGECACHE=7, /* struct: Set cache memory thresholds */ VM_PAGERDAEMON=8, /* struct: Control kswapd behaviour */ - VM_PGT_CACHE=9 /* struct: Set page table cache parameters */ + VM_PGT_CACHE=9, /* struct: Set page table cache parameters */ + VM_PAGE_CLUSTER=10 /* int: set number of pages to swap together */ }; @@ -140,7 +149,7 @@ enum NET_CORE_FASTROUTE=7, NET_CORE_MSG_COST=8, NET_CORE_MSG_BURST=9, - NET_CORE_OPTMEM_MAX=10, + NET_CORE_OPTMEM_MAX=10 }; /* /proc/sys/net/ethernet */ @@ -152,7 +161,7 @@ enum enum { NET_UNIX_DESTROY_DELAY=1, - NET_UNIX_DELETE_DELAY=2, + NET_UNIX_DELETE_DELAY=2 }; /* /proc/sys/net/ipv4 */ @@ -198,6 +207,8 @@ enum NET_IPV4_ICMP_TIMEEXCEED_RATE=61, NET_IPV4_ICMP_PARAMPROB_RATE=62, NET_IPV4_ICMP_ECHOREPLY_RATE=63, + NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64, + NET_IPV4_IGMP_MAX_MEMBERSHIPS=65 }; enum { @@ -214,13 +225,13 @@ enum { NET_IPV4_ROUTE_REDIRECT_SILENCE=11, NET_IPV4_ROUTE_ERROR_COST=12, NET_IPV4_ROUTE_ERROR_BURST=13, - NET_IPV4_ROUTE_GC_ELASTICITY=14, + NET_IPV4_ROUTE_GC_ELASTICITY=14 }; enum { NET_PROTO_CONF_ALL=-2, - NET_PROTO_CONF_DEFAULT=-3, + NET_PROTO_CONF_DEFAULT=-3 /* And device ifindices ... */ }; @@ -237,14 +248,14 @@ enum NET_IPV4_CONF_RP_FILTER=8, NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE=9, NET_IPV4_CONF_BOOTP_RELAY=10, - NET_IPV4_CONF_LOG_MARTIANS=11, + NET_IPV4_CONF_LOG_MARTIANS=11 }; /* /proc/sys/net/ipv6 */ enum { NET_IPV6_CONF=16, NET_IPV6_NEIGH=17, - NET_IPV6_ROUTE=18, + NET_IPV6_ROUTE=18 }; enum { @@ -254,7 +265,7 @@ enum { NET_IPV6_ROUTE_GC_MIN_INTERVAL=4, NET_IPV6_ROUTE_GC_TIMEOUT=5, NET_IPV6_ROUTE_GC_INTERVAL=6, - NET_IPV6_ROUTE_GC_ELASTICITY=7, + NET_IPV6_ROUTE_GC_ELASTICITY=7 }; enum { @@ -267,7 +278,7 @@ enum { NET_IPV6_DAD_TRANSMITS=7, NET_IPV6_RTR_SOLICITS=8, NET_IPV6_RTR_SOLICIT_INTERVAL=9, - NET_IPV6_RTR_SOLICIT_DELAY=10, + NET_IPV6_RTR_SOLICIT_DELAY=10 }; /* /proc/sys/net/<protocol>/neigh/<dev> */ @@ -298,7 +309,7 @@ enum { NET_ATALK_AARP_EXPIRY_TIME=1, NET_ATALK_AARP_TICK_TIME=2, NET_ATALK_AARP_RETRANSMIT_LIMIT=3, - NET_ATALK_AARP_RESOLVE_TIME=4, + NET_ATALK_AARP_RESOLVE_TIME=4 }; @@ -346,7 +357,7 @@ enum { NET_ROSE_LINK_FAIL_TIMEOUT=7, NET_ROSE_MAX_VCS=8, NET_ROSE_WINDOW_SIZE=9, - NET_ROSE_NO_ACTIVITY_TIMEOUT=10, + NET_ROSE_NO_ACTIVITY_TIMEOUT=10 }; /* /proc/sys/net/x25 */ @@ -388,7 +399,7 @@ enum FS_MAXFILE=7, /* int:maximum number of filedescriptors that can be allocated */ FS_DENTRY=8, FS_NRSUPER=9, /* int:current number of allocated super_blocks */ - FS_MAXSUPER=10, /* int:maximum number of super_blocks that can be allocated */ + FS_MAXSUPER=10 /* int:maximum number of super_blocks that can be allocated */ }; /* CTL_DEBUG names: */ @@ -396,12 +407,12 @@ enum /* CTL_DEV names: */ enum { DEV_CDROM=1, - DEV_HWMON=2, + DEV_HWMON=2 }; /* /proc/sys/dev/cdrom */ enum { - DEV_CDROM_INFO=1, + DEV_CDROM_INFO=1 }; #ifdef __KERNEL__ diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h index 76dab1072..547e5c2c1 100644 --- a/include/linux/sysv_fs.h +++ b/include/linux/sysv_fs.h @@ -98,7 +98,9 @@ struct xenix_super_block { char s_fill[371]; s32 s_magic; /* version of file system */ s32 s_type; /* type of file system: 1 for 512 byte blocks - 2 for 1024 byte blocks */ + 2 for 1024 byte blocks + 3 for 2048 byte blocks */ + }; /* Xenix free list block on disk */ diff --git a/include/linux/tasks.h b/include/linux/tasks.h index 4a82ad4e0..91b758f49 100644 --- a/include/linux/tasks.h +++ b/include/linux/tasks.h @@ -11,7 +11,7 @@ #define NR_CPUS 1 #endif -#define NR_TASKS 512 +#define NR_TASKS 512 /* On x86 Max 4092, or 4090 w/APM configured. */ #define MAX_TASKS_PER_USER (NR_TASKS/2) #define MIN_TASKS_LEFT_FOR_ROOT 4 diff --git a/include/linux/timex.h b/include/linux/timex.h index df4743f58..653009adf 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h @@ -45,6 +45,8 @@ * Derived linux/timex.h * 1995-08-13 Torsten Duwe * kernel PLL updated to 1994-12-13 specs (rfc-1589) + * 1997-08-30 Ulrich Windl + * Added new constant NTP_PHASE_LIMIT */ #ifndef _LINUX_TIMEX_H #define _LINUX_TIMEX_H @@ -102,6 +104,7 @@ #define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */ #define MINSEC 16L /* min interval between updates (s) */ #define MAXSEC 1200L /* max interval between updates (s) */ +#define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ /* * The following defines are used only if a pulse-per-second (PPS) diff --git a/include/linux/tty.h b/include/linux/tty.h index f0e8e0656..854cbd1a8 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -304,6 +304,7 @@ struct tty_struct { int canon_data; unsigned long canon_head; unsigned int canon_column; + struct semaphore atomic_read; }; /* tty magic number */ @@ -325,6 +326,7 @@ struct tty_struct { #define TTY_DO_WRITE_WAKEUP 5 #define TTY_PUSH 6 #define TTY_CLOSING 7 +#define TTY_DONT_FLIP 8 #define TTY_HW_COOK_OUT 14 #define TTY_HW_COOK_IN 15 #define TTY_PTY_LOCK 16 diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h index 0f5975b6e..65d26195f 100644 --- a/include/linux/ufs_fs.h +++ b/include/linux/ufs_fs.h @@ -110,12 +110,12 @@ #define UFS_MOUNT_ONERROR_UMOUNT 0x00000004 #define UFS_MOUNT_ONERROR_REPAIR 0x00000008 -#define UFS_MOUNT_UFSTYPE 0x000000F0 +#define UFS_MOUNT_UFSTYPE 0x000001F0 #define UFS_MOUNT_UFSTYPE_OLD 0x00000010 #define UFS_MOUNT_UFSTYPE_44BSD 0x00000020 #define UFS_MOUNT_UFSTYPE_SUN 0x00000040 #define UFS_MOUNT_UFSTYPE_NEXT 0x00000080 - +#define UFS_MOUNT_UFSTYPE_OPENSTEP 0x00000100 #define ufs_clear_opt(o,opt) o &= ~UFS_MOUNT_##opt #define ufs_set_opt(o,opt) o |= UFS_MOUNT_##opt diff --git a/include/linux/videodev.h b/include/linux/videodev.h index f8e85a1b1..57e5a2a12 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h @@ -1,9 +1,14 @@ #ifndef __LINUX_VIDEODEV_H #define __LINUX_VIDEODEV_H +#include <linux/types.h> +#include <linux/version.h> + #ifdef __KERNEL__ +#if LINUX_VERSION_CODE >= 0x020100 #include <linux/poll.h> +#endif struct video_device { @@ -16,7 +21,9 @@ struct video_device long (*read)(struct video_device *, char *, unsigned long, int noblock); /* Do we need a write method ? */ long (*write)(struct video_device *, const char *, unsigned long, int noblock); +#if LINUX_VERSION_CODE >= 0x020100 unsigned int (*poll)(struct video_device *, struct file *, poll_table *); +#endif int (*ioctl)(struct video_device *, unsigned int , void *); int (*mmap)(struct video_device *, const char *, unsigned long); int (*initialize)(struct video_device *); @@ -48,7 +55,6 @@ extern void video_unregister_device(struct video_device *); #define VID_TYPE_SCALES 128 /* Scalable */ #define VID_TYPE_MONOCHROME 256 /* Monochrome only */ #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ -#define VID_TYPE_OUTPUT 1024 /* Can output video data */ struct video_capability { @@ -120,6 +126,10 @@ struct video_picture #define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */ #define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */ #define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */ +#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */ +#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */ +#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */ +#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */ }; struct video_audio @@ -136,8 +146,8 @@ struct video_audio char name[16]; #define VIDEO_SOUND_MONO 1 #define VIDEO_SOUND_STEREO 2 -#define VIDEO_SOUND_LANG1 3 -#define VIDEO_SOUND_LANG2 4 +#define VIDEO_SOUND_LANG1 4 +#define VIDEO_SOUND_LANG2 8 __u16 mode; __u16 balance; /* Stereo balance */ __u16 step; /* Step actual volume uses */ @@ -261,7 +271,9 @@ struct video_unit #define VID_HARDWARE_PERMEDIA2 14 /* Reserved for Permedia2 */ #define VID_HARDWARE_RIVA128 15 /* Reserved for RIVA 128 */ #define VID_HARDWARE_PLANB 16 /* PowerMac motherboard video-in */ -#define VID_HARDWARE_VINO 17 +#define VID_HARDWARE_BROADWAY 17 /* Broadway project */ +#define VID_HARDWARE_GEMTEK 18 +#define VID_HARDWARE_VINO 19 /* SGI Indy Vino */ /* * Initialiser list diff --git a/include/linux/wavefront.h b/include/linux/wavefront.h index f5f4052d6..f96c52d04 100644 --- a/include/linux/wavefront.h +++ b/include/linux/wavefront.h @@ -307,7 +307,7 @@ struct wf_layer UCHAR8 mute:1; UCHAR8 split_point:7; - UCHAR8 updown:1; + UCHAR8 play_below:1; UCHAR8 pan_mod_src:2; UCHAR8 pan_or_mod:1; @@ -507,9 +507,16 @@ typedef union wf_any { typedef struct wf_patch_info { + /* the first two fields are used by the OSS "patch loading" interface + only, and are unused by the current user-level library. + */ + INT16 key; /* Use WAVEFRONT_PATCH here */ UINT16 devno; /* fill in when sending */ UCHAR8 subkey; /* WF_ST_{SAMPLE,ALIAS,etc.} */ + +#define WAVEFRONT_FIND_FREE_SAMPLE_SLOT 999 + UINT16 number; /* patch/sample/prog number */ UINT32 size; /* size of any data included in @@ -548,13 +555,15 @@ typedef struct wf_patch_info { */ typedef struct wavefront_control { - int devno; /* from /dev/sequencer interface */ int cmd; /* WFC_* */ char status; /* return status to user-space */ unsigned char rbuf[WF_MAX_READ]; /* bytes read from card */ unsigned char wbuf[WF_MAX_WRITE]; /* bytes written to card */ } wavefront_control; +#define WFCTL_WFCMD 0x1 +#define WFCTL_LOAD_SPP 0x2 + /* Modulator table */ #define WF_MOD_LFO1 0 diff --git a/include/net/ax25.h b/include/net/ax25.h index fd25e9f7f..2c8d20a62 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h @@ -281,7 +281,7 @@ extern void ax25_output(ax25_cb *, int, struct sk_buff *); extern void ax25_kick(ax25_cb *); extern void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int); extern void ax25_queue_xmit(struct sk_buff *); -extern void ax25_check_iframes_acked(ax25_cb *, unsigned short); +extern int ax25_check_iframes_acked(ax25_cb *, unsigned short); /* ax25_route.c */ extern void ax25_rt_device_down(struct device *); diff --git a/include/net/br.h b/include/net/br.h index 8f47d3c12..c0b69e54a 100644 --- a/include/net/br.h +++ b/include/net/br.h @@ -293,9 +293,11 @@ 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); /* externs */ extern struct br_stat br_stats; - +extern Port_data port_info[]; diff --git a/include/net/ip_masq.h b/include/net/ip_masq.h index 03c65fddc..70b627305 100644 --- a/include/net/ip_masq.h +++ b/include/net/ip_masq.h @@ -48,7 +48,8 @@ #define IP_MASQ_F_NO_SADDR 0x0004 /* no sport set yet */ #define IP_MASQ_F_NO_SPORT 0x0008 /* no sport set yet */ -#define IP_MASQ_F_NO_REPLY 0x0010 /* no reply yet from outside */ +#define IP_MASQ_F_DLOOSE 0x0010 /* loose dest binding */ +#define IP_MASQ_F_NO_REPLY 0x0080 /* no reply yet from outside */ #define IP_MASQ_F_HASHED 0x0100 /* hashed entry */ #define IP_MASQ_F_OUT_SEQ 0x0200 /* must do output seq adjust */ diff --git a/include/net/ipconfig.h b/include/net/ipconfig.h index db64243a6..f93569461 100644 --- a/include/net/ipconfig.h +++ b/include/net/ipconfig.h @@ -1,5 +1,5 @@ /* - * $Id: ipconfig.h,v 1.2 1997/10/17 12:41:16 mj Exp $ + * $Id: ipconfig.h,v 1.3 1999/01/04 20:13:29 davem Exp $ * * Copyright (C) 1997 Martin Mares * @@ -12,8 +12,10 @@ extern u32 ic_myaddr; extern u32 ic_servaddr; extern u32 ic_gateway; extern u32 ic_netmask; -extern int ic_bootp_flag; -extern int ic_rarp_flag; extern int ic_enable; extern int ic_host_name_set; extern int ic_set_manually; +extern int ic_proto_enabled; + +#define IC_BOOTP 1 +#define IC_RARP 2 diff --git a/include/net/irda/crc.h b/include/net/irda/crc.h new file mode 100644 index 000000000..d4ee011e4 --- /dev/null +++ b/include/net/irda/crc.h @@ -0,0 +1,30 @@ +/********************************************************************* + * + * Filename: crc.h + * Version: + * Description: CRC routines + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Mon Aug 4 20:40:53 1997 + * Modified at: Tue Dec 15 22:18:53 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + ********************************************************************/ + +#ifndef IR_CRC_H +#define IR_CRC_H + +#include <linux/types.h> + +#define INIT_FCS 0xffff /* Initial FCS value */ +#define GOOD_FCS 0xf0b8 /* Good final FCS value */ + +/* Recompute the FCS with one more character appended. */ +#define IR_FCS(fcs, c) (((fcs) >> 8) ^ irda_crc16_table[((fcs) ^ (c)) & 0xff]) + +/* Recompute the FCS with len bytes appended. */ +unsigned short crc_calc( __u16 fcs, __u8 const *buf, size_t len); + +extern __u16 const irda_crc16_table[]; + +#endif diff --git a/include/net/irda/dongle.h b/include/net/irda/dongle.h new file mode 100644 index 000000000..8498f4176 --- /dev/null +++ b/include/net/irda/dongle.h @@ -0,0 +1,48 @@ +/********************************************************************* + * + * Filename: dongle.h + * Version: + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Wed Oct 21 22:47:12 1998 + * Modified at: Mon Dec 14 11:47:25 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef DONGLE_H +#define DONGLE_H + +#include <net/irda/qos.h> +#include <net/irda/irda_device.h> + +/* These are the currently known dongles */ +typedef enum { + TEKRAM_DONGLE, + ESI_DONGLE, + ACTISYS_DONGLE, + ACTISYS_PLUS_DONGLE, +} DONGLE_T; + +struct dongle { + DONGLE_T type; + void (*open)(struct irda_device *, int type); + void (*close)(struct irda_device *); + void (*reset)( struct irda_device *, int unused); + void (*change_speed)( struct irda_device *, int baudrate); + void (*qos_init)( struct irda_device *, struct qos_info *); +}; + +#endif diff --git a/include/net/irda/ircomm_common.h b/include/net/irda/ircomm_common.h new file mode 100644 index 000000000..a092d9808 --- /dev/null +++ b/include/net/irda/ircomm_common.h @@ -0,0 +1,233 @@ +/********************************************************************* + * + * Filename: ircomm_common.h + * Version: + * Description: An implementation of IrCOMM service interface and state machine + * Status: Experimental. + * Author: Takahide Higuchi <thiguchi@pluto.dti.ne.jp> + * + * Copyright (c) 1998, Takahide Higuchi, <thiguchi@pluto.dti.ne.jp>, + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * I, Takahide Higuchi, provide no warranty for any of this software. + * This material is provided "AS-IS" and at no charge. + * + ********************************************************************/ + +/* #define DEBUG(n, args...) printk( KERN_DEBUG args) */ /* enable all debug message */ + +#include <linux/types.h> +#include <net/irda/irmod.h> + +typedef enum { + COMM_DISCOVERY, + COMM_IDLE, + COMM_WAITI, + COMM_WAITR, + COMM_CONN, +} IRCOMM_STATE; + +/* IrCOMM Events */ +typedef enum { + IRCOMM_CONNECT_REQUEST, + TTP_CONNECT_INDICATION, + LMP_CONNECT_INDICATION, + + TTP_CONNECT_CONFIRM, + TTP_DISCONNECT_INDICATION, + LMP_CONNECT_CONFIRM, + LMP_DISCONNECT_INDICATION, + + IRCOMM_CONNECT_RESPONSE, + IRCOMM_DISCONNECT_REQUEST, + + TTP_DATA_INDICATION, + IRCOMM_DATA_REQUEST, + LMP_DATA_INDICATION, + IRCOMM_CONTROL_REQUEST, +} IRCOMM_EVENT; + + +#define IRCOMM_MAGIC 0x434f4d4d +#define COMM_INIT_CTRL_PARAM 3 /* length of initial control parameters */ +#define COMM_CTRL_MIN 1 /* length of clen field */ +#define COMM_HEADER_SIZE (LAP_HEADER+LMP_HEADER+TTP_HEADER+COMM_CTRL_MIN) +#define COMM_DEFAULT_DATA_SIZE 64 +#define IRCOMM_MAX_CONNECTION 1 /* Don't change */ + +#define IAS_PARAM 1 +#define CONTROL_CHANNEL 2 + + + +#define UNKNOWN 0x00 /* not defined yet. */ +/* we use 9wire if servicetype=DEFAULT, but is it good? */ +#define DEFAULT 0x0a /* private number */ +#define THREE_WIRE_RAW 0x01 /* bit 0 */ +#define THREE_WIRE 0x02 /* bit 1 */ +#define NINE_WIRE 0x04 /* bit 2 */ +#define CENTRONICS 0x08 /* bit 3 */ + +#define SERIAL 0x01 /* bit 0 */ +#define PARALLEL 0x02 /* bit 1 */ + + +#define SERVICETYPE 0x00 +#define PORT_TYPE 0x02 +#define PORT_NAME 0x02 +#define FIXED_PORT_NAME 0x82 + +#define DATA_RATE 0x10 +#define DATA_FORMAT 0x11 +#define FLOW_CONTROL 0x12 +#define XON_XOFF_CHAR 0x13 +#define ENQ_ACK_CHAR 0x14 +#define LINESTATUS 0x15 +#define BREAK_SIGNAL 0x16 + +#define DTELINE_STATE 0x20 +#define DCELINE_STATE 0x21 +#define POLL_FOR_LINE_SETTINGS 0x22 + +#define STATUS_QUERY 0x30 +#define SET_BUSY_TIMEOUT 0x31 +#define IEEE1284_MODE_SUPPORT 0x32 +#define IEEE1284_DEVICEID 0x33 +#define IEEE1284_MODE 0x34 +#define IEEE1284_ECP_EPP_DATA_TRANSFER 0x35 + +#define TX_READY 0xFE /* FIXME: this is not defined in IrCOMM spec */ +#define TX_BUSY 0XFF /* so we should find another way */ + + +/* parameters of FLOW_CONTROL */ + +#define USE_RTS 0x08 /* use RTS on output */ +#define USE_CTS 0x04 /* use CTS on input */ +#define USE_DTR 0x20 /* use DTR on output */ + +/* parameters of DTELINE_STATE */ + +#define DELTA_DTR 0x01 +#define DELTA_RTS 0x02 +#define MCR_DTR 0x04 +#define MCR_RTS 0x08 + +/* parameters of DCELINE_STATE */ + +#define DELTA_CTS 0x01 +#define DELTA_DSR 0x02 +#define DELTA_RI 0x04 +#define DELTA_DCD 0x08 +#define MSR_CTS 0x10 +#define MSR_DSR 0x20 +#define MSR_RI 0x40 +#define MSR_DCD 0x80 + +/* parameters of DATA_FORMAT */ + +#define LSR_OE 0x02 /* Overrun error indicator */ +#define LSR_PE 0x04 /* Parity error indicator */ +#define LSR_FE 0x08 /* Frame error indicator */ +#define LSR_BI 0x01 /* Break interrupt indicator */ + + +struct ircomm_cb{ + int magic; + int state; /* Current state of IrCOMM layer: + * DISCOVERY,COMM_IDLE, COMM_WAITR, + * COMM_WAITI, COMM_CONN + */ + int in_use; + int null_modem_mode; /* switch for null modem emulation */ + int ttp_stop; + int max_txbuff_size; + int maxsdusize; + __u32 daddr; /* Device address of the peer device */ + + void (*d_handler)(struct ircomm_cb *self); + struct notify_t notify; /* container of callbacks */ + + struct sk_buff *ctrl_skb; /* queue of control channel */ + + struct tsap_cb *tsap; /* IrTTP/LMP handle */ + struct qos_info *qos; /* Quality of Service */ + + int reason; /* I don't know about reason: + see Irlmp.c or somewhere :p)*/ + + __u8 dlsap; /* IrLMP dlsap */ + __u8 lsap; /* sap of local device */ + + __u8 pi ; /* instruction of control channel*/ + __u8 port_type; + __u8 peer_port_type; + + __u8 servicetype; + __u8 peer_servicetype; + __u8 data_format; + __u8 peer_data_format; + __u8 flow_ctrl; + __u8 peer_flow_ctrl; + __u8 line_status; + __u8 peer_line_status; + __u8 break_signal; + __u8 peer_break_signal; + __u8 dte; + __u8 peer_dte; + __u8 dce; + __u8 peer_dce; + __u8 xon_char; + __u8 xoff_char; + __u8 peer_xon_char; + __u8 peer_xoff_char; + __u8 enq_char; + __u8 ack_char; + __u8 peer_enq_char; + __u8 peer_ack_char; + __u8 busy_timeout; + __u8 peer_busy_timeout; + __u8 ecp_epp_mode; + __u8 peer_ecp_epp_mode; + __u8 channel_or_addr; + __u8 peer_channel_or_addr; + + __u32 data_rate; + __u32 peer_data_rate; + char port_name[60]; + +}; + + + +void ircomm_connect_request(struct ircomm_cb *self, int maxsdusize); +void ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata, + int maxsdusize); +void ircomm_disconnect_request(struct ircomm_cb *self, + struct sk_buff *userdata); +void ircomm_data_request(struct ircomm_cb *self, + struct sk_buff *userdata); +void ircomm_control_request(struct ircomm_cb *self); +void ircomm_append_ctrl(struct ircomm_cb *self, __u8 instruction); +struct ircomm_cb *ircomm_attach_cable( __u8 servicetype, struct notify_t notify, + void *handler); +int ircomm_detach_cable(struct ircomm_cb *self); + + +void ircomm_accept_data_indication(void *instance, void *sap, struct sk_buff *skb); +void ircomm_accept_connect_confirm(void *instance, void *sap, struct qos_info *qos, + int maxsdusize, struct sk_buff *skb); +void ircomm_accept_connect_indication(void *instance, void *sap, + struct qos_info *qos, + int maxsdusize, struct sk_buff *skb); +void ircomm_accept_disconnect_indication(void *instance, void *sap, LM_REASON reason, + struct sk_buff *skb); +void ircomm_accept_flow_indication(void *instance, void *sap, LOCAL_FLOW flow); +void ircomm_next_state( struct ircomm_cb *self, IRCOMM_STATE state); + + diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h new file mode 100644 index 000000000..22458aa0b --- /dev/null +++ b/include/net/irda/irda.h @@ -0,0 +1,155 @@ +/********************************************************************* + * + * Filename: irda.h + * Version: + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Tue Dec 9 21:13:12 1997 + * Modified at: Sat Jan 16 01:23:15 1999 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRDA_H +#define IRDA_H + +#include <linux/config.h> +#include <linux/skbuff.h> + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#define ALIGN __attribute__((aligned)) +#define PACK __attribute__((packed)) + +/* use 0 for production, 1 for verification, >2 for debug */ +#ifdef CONFIG_IRDA_DEBUG + +extern __u32 irda_debug; + +#define IRDA_DEBUG 3 + +#define DEBUG(n, args...) if (irda_debug >= (n)) printk( KERN_DEBUG args) +#define ASSERT(expr, func) \ +if(!(expr)) { \ + printk( "Assertion failed! %s,%s,%s,line=%d\n",\ + #expr,__FILE__,__FUNCTION__,__LINE__); \ + ##func} +#else +#define DEBUG(n, args...) +#define ASSERT(expr, func) +#endif /* CONFIG_IRDA_DEBUG */ + +#ifdef CHECK_SKB +static unsigned int check_skb = CHECK_SKB; + +#define SK_FREED_SKB 0x0DE2C0DE +#define SK_GOOD_SKB 0xDEC0DED1 +#define SK_HEAD_SKB 0x12231298 + +extern int skb_check(struct sk_buff *skb,int,int, char *); + +#ifdef IS_SKB +#undef IS_SKB +#endif + +#define IS_SKB(skb, func) \ +if( skb_check((skb), 0, __LINE__,__FILE__) == -1) { \ + ##func} + +#ifdef IS_SKB_HEAD +#undef IS_SKB_HEAD +#endif + +#define IS_SKB_HEAD(skb) skb_check((skb), 1, __LINE__,__FILE__) + +#define ALLOC_SKB_MAGIC(skb) \ +if( check_skb) \ + skb->magic_debug_cookie = SK_GOOD_SKB; + +#define FREE_SKB_MAGIC(skb) \ +if( check_skb) {\ + skb->magic_debug_cookie = SK_FREED_SKB; \ +} + +#else +#undef IS_SKB +#define IS_SKB(skb, func) +#undef IS_SKB_HEAD +#define IS_SKB_HEAD(skb) +#define ALLOC_SKB_MAGIC(skb) +#define FREE_SKB_MAGIC(skb) +#endif /* CHECK_SKB */ + +/* + * Magic numbers used by Linux/IR. Random numbers which must be unique to + * give the best protection + */ +#define IRTTY_MAGIC 0x2357 +#define LAP_MAGIC 0x1357 +#define LMP_MAGIC 0x4321 +#define LMP_LSAP_MAGIC 0x69333 +#define LMP_LAP_MAGIC 0x3432 +#define IRDA_DEVICE_MAGIC 0x63454 +#define IAS_MAGIC 0x007 +#define TTP_MAGIC 0x241169 +#define TTP_TSAP_MAGIC 0x4345 +#define IROBEX_MAGIC 0x341324 +#define HB_MAGIC 0x64534 +#define IRLAN_MAGIC 0x754 +#define IAS_OBJECT_MAGIC 0x34234 +#define IAS_ATTRIB_MAGIC 0x45232 + +#define IAS_DEVICE_ID 0x5342 +#define IAS_PNP_ID 0xd342 +#define IAS_OBEX_ID 0x34323 +#define IAS_IRLAN_ID 0x34234 +#define IAS_IRCOMM_ID 0x2343 +#define IAS_IRLPT_ID 0x9876 + +#endif /* IRDA_H */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h new file mode 100644 index 000000000..d8e546bb5 --- /dev/null +++ b/include/net/irda/irda_device.h @@ -0,0 +1,153 @@ +/********************************************************************* + * + * Filename: irda_device.h + * Version: + * Description: + * Status: Experimental. + * Author: Haris Zukanovic <haris@stud.cs.uit.no> + * Created at: Tue Apr 14 12:41:42 1998 + * Modified at: Mon Jan 18 10:52:10 1999 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Haris Zukanovic, <haris@stud.cs.uit.no> + * Copyright (c) 1998 Dag Brattli, <dagb@cs.uit.no> + * Copyright (c) 1998 Thomas Davis, <ratbert@radiks.net>, + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Haris Zukanovic nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRDA_DEVICE_H +#define IRDA_DEVICE_H + +#include <linux/tty.h> +#include <linux/netdevice.h> + +#include <net/irda/irda.h> +#include <net/irda/qos.h> +#include <net/irda/irqueue.h> + +#define SIR_MODE 0x01 +#define MIR_MODE 0x02 +#define FIR_MODE 0x04 +#define IO_PIO 0x08 +#define IO_DMA 0x10 + +#define IO_XMIT 0x01 +#define IO_RECV 0x02 + +/* Chip specific info */ +struct chipio_t { + int iobase, iobase2; /* IO base */ + int io_ext, io_ext2; /* Length of iobase */ + int irq, irq2; /* Interrupts used */ + int fifo_size; /* FIFO size */ + + int dma, dma2; /* DMA channel used */ + int irqflags; /* interrupt flags (ie, SA_SHIRQ|SA_INTERRUPT) */ + int direction; /* Used by some FIR drivers */ + + int baudrate; /* Currently used baudrate */ + int dongle_id; /* Dongle or transceiver currently used */ +}; + +/* Buffer specific info */ +struct iobuff_t { + int state; /* Receiving state (transmit state not used) */ + int in_frame; /* True if receiving frame */ + + __u8 *data; /* the buffer */ + __u8 *head; /* start of data in buffer */ + __u8 *tail; /* end of data in buffer */ + + int offset; /* Usually data + offset = head */ + int len; /* currently used bytes in buffer */ + int truesize; /* total size of the data area */ + __u16 fcs; + + int flags; /* Allocation flags (GFP_KERNEL | GFP_DMA ) */ +}; + +/* + * This structure contains data that _we_ would have liked to be in the device + * structure, but we don't want to mess it up more than it is already. Better + * to keep the data in separate structures! This structure abstracts common + * stuff from IrDA port implementations. + */ +struct irda_device { + QUEUE q; /* Must be first */ + + int magic; /* Our magic bullet */ + char name[16]; /* Name of device "irda0" */ + char description[32]; /* Something like "irda0 <-> ttyS0" */ + + struct irlap_cb *irlap; /* The link layer we are connected to */ + struct device netdev; /* Yes! we are some kind of netdevice */ + struct enet_statistics stats; + +/* int flags; */ + + void *priv; /* Pointer to low level implementation */ + + struct qos_info qos; /* QoS capabilities for this device */ + + struct chipio_t io; + struct iobuff_t tx_buff; + struct iobuff_t rx_buff; + + int media_busy; + + /* Media busy stuff */ + struct timer_list media_busy_timer; + struct timer_list todo_timer; + + int (*hard_xmit)( struct sk_buff *skb, struct device *dev); + void (*change_speed)( struct irda_device *driver, int baud); + + int (*is_receiving)(struct irda_device *); /* receiving? */ + /* int (*is_tbusy)(struct irda_device *); */ /* transmitting? */ + void (*wait_until_sent)(struct irda_device *); + + int new_speed; /* Will be removed in future */ +}; + +extern hashbin_t *irda_device; + +/* Function prototypes */ +int irda_device_init( void); +void irda_device_cleanup( void); + +int irda_device_open( struct irda_device *, char *name, void *priv); +void irda_device_close( struct irda_device *); + +/* Interface to be uses by IrLAP */ +inline void irda_device_set_media_busy( struct irda_device *, int status); +inline int irda_device_is_media_busy( struct irda_device *); +inline int irda_device_is_receiving( struct irda_device *); +inline void irda_device_change_speed( struct irda_device *, int); + +inline struct qos_info *irda_device_get_qos( struct irda_device *self); +int irda_device_txqueue_empty( struct irda_device *self); + +int irda_device_setup( struct device *dev); + +__inline__ int irda_get_mtt( struct sk_buff *skb); + +void setup_dma( int channel, char *buffer, int count, int mode); + +#endif + + + + + + + diff --git a/include/net/irda/irdacall.h b/include/net/irda/irdacall.h new file mode 100644 index 000000000..f7f67ce92 --- /dev/null +++ b/include/net/irda/irdacall.h @@ -0,0 +1,2 @@ +/* Separate to keep compilation of protocols.c simpler */ +extern void irda_proto_init(struct net_proto *pro); diff --git a/include/net/irda/iriap.h b/include/net/irda/iriap.h new file mode 100644 index 000000000..495da351e --- /dev/null +++ b/include/net/irda/iriap.h @@ -0,0 +1,123 @@ +/********************************************************************* + * + * Filename: iriap.h + * Version: + * Description: Information Access Protocol (IAP) + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Thu Aug 21 00:02:07 1997 + * Modified at: Sat Dec 5 13:45:37 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRIAP_H +#define IRIAP_H + +#include <linux/types.h> +#include <linux/skbuff.h> + +#include <net/irda/qos.h> +#include <net/irda/iriap_event.h> +#include <net/irda/irias_object.h> +#include <net/irda/irqueue.h> +#include <net/irda/timer.h> + +#define LST 0x80 +#define ACK 0x40 + +#define IAS_SERVER 0 +#define IAS_CLIENT 1 + +/* IrIAP Op-codes */ +#define GET_INFO_BASE 0x01 +#define GET_OBJECTS 0x02 +#define GET_VALUE 0x03 +#define GET_VALUE_BY_CLASS 0x04 +#define GET_OBJECT_INFO 0x05 +#define GET_ATTRIB_NAMES 0x06 + +#define IAS_SUCCESS 0 +#define IAS_CLASS_UNKNOWN 1 +#define IAS_ATTRIB_UNKNOWN 2 + +typedef void (*CONFIRM_CALLBACK)( __u16 obj_id, struct ias_value *value, + void *priv); + +struct iap_value { + char *full; + char *name; + char *attr; + __u16 obj_id; + __u8 ret_code; + __u8 type; + int len; + int value_int; + char *value_char; +}; + +struct iriap_cb { + QUEUE queue; /* Must be first */ + + int magic; /* Magic cookie */ + int mode; /* Client or server */ + __u32 daddr; + __u8 operation; + + struct sk_buff *skb; + struct lsap_cb *lsap; + __u8 slsap_sel; + + /* Client states */ + IRIAP_STATE client_state; + IRIAP_STATE call_state; + + /* Server states */ + IRIAP_STATE server_state; + IRIAP_STATE r_connect_state; + + CONFIRM_CALLBACK confirm; + void *priv; + + struct timer_list watchdog_timer; +}; + +int iriap_init(void); +void iriap_cleanup(void); +void iriap_getvaluebyclass_request( __u32 addr, char *name, char *attr, + CONFIRM_CALLBACK callback, void *priv); +void iriap_getvaluebyclass_confirm( struct iriap_cb *self, + struct sk_buff *skb); + +void iriap_send_ack( struct iriap_cb *self); +void iriap_data_indication( void *instance, void *sap, struct sk_buff *skb); +void iriap_connect_confirm( void *instance, void *sap, struct qos_info *qos, + int max_sdu_size, struct sk_buff *skb); +void iriap_connect_indication( void *instance, void *sap, + struct qos_info *qos, int max_sdu_size, + struct sk_buff *skb); +void iriap_call_indication( struct iriap_cb *self, struct sk_buff *skb); + +void iriap_register_server(void); + +void iriap_watchdog_timer_expired( unsigned long data); + +static inline void iriap_start_watchdog_timer( struct iriap_cb *self, + int timeout) +{ + irda_start_timer( &self->watchdog_timer, timeout, + (unsigned long) self, iriap_watchdog_timer_expired); +} + +#endif diff --git a/include/net/irda/iriap_event.h b/include/net/irda/iriap_event.h new file mode 100644 index 000000000..e99f319a3 --- /dev/null +++ b/include/net/irda/iriap_event.h @@ -0,0 +1,84 @@ +/********************************************************************* + * + * Filename: iriap_event.h + * Version: + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Mon Aug 4 20:40:53 1997 + * Modified at: Fri Sep 4 13:19:28 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRIAP_FSM_H +#define IRIAP_FSM_H + +/* Forward because of circular include dependecies */ +struct iriap_cb; + +/* IrIAP states */ +typedef enum { + /* Client */ + S_DISCONNECT, + S_CONNECTING, + S_CALL, + + /* S-Call */ + S_MAKE_CALL, + S_CALLING, + S_OUTSTANDING, + S_REPLYING, + S_WAIT_FOR_CALL, + S_WAIT_ACTIVE, + + /* Server */ + R_DISCONNECT, + R_CALL, + + /* R-Connect */ + R_WAITING, + R_WAIT_ACTIVE, + R_RECEIVING, + R_EXECUTE, + R_RETURNING, +} IRIAP_STATE; + +typedef enum { + IAP_CALL_REQUEST, + IAP_CALL_REQUEST_GVBC, + IAP_CALL_RESPONSE, + IAP_RECV_F_LST, + IAP_LM_DISCONNECT_INDICATION, + IAP_LM_CONNECT_INDICATION, + IAP_LM_CONNECT_CONFIRM, +} IRIAP_EVENT; + +void iriap_next_client_state ( struct iriap_cb *self, IRIAP_STATE state); +void iriap_next_call_state ( struct iriap_cb *self, IRIAP_STATE state); +void iriap_next_server_state ( struct iriap_cb *self, IRIAP_STATE state); +void iriap_next_r_connect_state( struct iriap_cb *self, IRIAP_STATE state); + + +void iriap_do_client_event( struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb); +void iriap_do_call_event ( struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb); + +void iriap_do_server_event ( struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb); +void iriap_do_r_connect_event( struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb); + +#endif diff --git a/include/net/irda/irias_object.h b/include/net/irda/irias_object.h new file mode 100644 index 000000000..efacac854 --- /dev/null +++ b/include/net/irda/irias_object.h @@ -0,0 +1,107 @@ +/********************************************************************* + * + * Filename: irias_object.h + * Version: + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Thu Oct 1 22:49:50 1998 + * Modified at: Sun Oct 25 00:28:56 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef LM_IAS_OBJECT_H +#define LM_IAS_OBJECT_H + +#include "irqueue.h" + +/* LM-IAS Attribute types */ +#define IAS_MISSING 0 +#define IAS_INTEGER 1 +#define IAS_OCT_SEQ 2 +#define IAS_STRING 3 + +/* + * LM-IAS Object + */ +struct ias_object { + QUEUE queue; /* Must be first! */ + + int magic; + + char *name; + int id; + + hashbin_t *attribs; +}; + +/* + * Values used by LM-IAS attributes + */ +struct ias_value { + /* Value description */ + __u8 type; + int charset; /* Only used by string type */ + int len; + + /* Value */ + union { + int integer; + char *string; + __u8 *oct_seq; + } t; +}; + +/* + * Attributes used by LM-IAS objects + */ +struct ias_attrib { + QUEUE queue; /* Must be first! */ + + int magic; + + /* Attribute name */ + char *name; + /* char *attr; What do we need this for? */ + + /* Attribute value */ + struct ias_value *value; +}; + +char *strdup( char *str); + +struct ias_object *irias_new_object( char *name, int id); +void irias_insert_object( struct ias_object *obj); +void __irias_delete_object( struct ias_object *obj); +void irias_delete_object( char *name); + +void irias_add_integer_attrib( struct ias_object *obj, char *name, + int value); +void irias_add_string_attrib( struct ias_object *obj, char *name, + char *value); +void irias_add_octseq_attrib( struct ias_object *obj, char *name, + __u8 *octets, int len); +struct ias_object *irias_find_object( char *name); +struct ias_attrib *irias_find_attrib( struct ias_object *obj, char *name); + +struct ias_value *irias_new_string_value( char *string); +struct ias_value *irias_new_integer_value( int integer); +struct ias_value *irias_new_octseq_value( __u8 *octseq , int len); +void irias_delete_value( struct ias_value *value); + +extern struct ias_value missing; +extern hashbin_t *objects; + +#endif diff --git a/include/net/irda/irlan_cli.h b/include/net/irda/irlan_cli.h new file mode 100644 index 000000000..fb677af20 --- /dev/null +++ b/include/net/irda/irlan_cli.h @@ -0,0 +1,65 @@ +/********************************************************************* + * + * Filename: client.h + * Version: 0.3 + * Description: IrDA LAN access layer + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sun Aug 31 20:14:37 1997 + * Modified at: Mon Oct 19 12:37:20 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLAN_CLIENT_H +#define IRLAN_CLIENT_H + +#include <linux/kernel.h> +#include <linux/types.h> +#include <linux/skbuff.h> +#include <linux/netdevice.h> + +int irlan_client_init(void); +void irlan_client_cleanup(void); + +void irlan_discovery_indication( DISCOVERY*); +void irlan_client_disconnect_indication( void *instance, void *sap, + LM_REASON reason, struct sk_buff *); + +void irlan_client_data_indication( void *instance, void *sap, + struct sk_buff *skb); + +void irlan_client_control_data_indication( void *instance, void *sap, + struct sk_buff *skb); + +void irlan_client_connect_confirm( void *instance, void *sap, + struct qos_info *qos, int max_sdu_size, + struct sk_buff *); +void irlan_client_connect_indication( void *instance, void *sap, + struct sk_buff *); +void irlan_client_connect_response( void *instance, void *sap, + int max_sdu_size, struct sk_buff *skb); + +void irlan_client_open_tsaps( struct irlan_cb *self); + +void irlan_client_extract_params( struct irlan_cb *self, + struct sk_buff *skb); +void check_response_param( struct irlan_cb *self, char *param, + char *value, int val_len); +void handle_request( struct irlan_cb *self); +void irlan_client_register_server(void); +void irlan_client_get_value_confirm( __u16 obj_id, struct ias_value *value, + void *priv); + +#endif diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h new file mode 100644 index 000000000..33ba52377 --- /dev/null +++ b/include/net/irda/irlan_common.h @@ -0,0 +1,199 @@ +/********************************************************************* + * + * Filename: irlan.h + * Version: 0.1 + * Description: IrDA LAN access layer + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sun Aug 31 20:14:37 1997 + * Modified at: Thu Oct 29 13:23:11 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLAN_H +#define IRLAN_H + +#include <linux/kernel.h> +#include <linux/types.h> +#include <linux/skbuff.h> +#include <linux/netdevice.h> + +#include "irqueue.h" +#include "irttp.h" + +#define IRLAN_MTU 1518 + +/* Command packet types */ +#define CMD_GET_PROVIDER_INFO 0 +#define CMD_GET_MEDIA_CHAR 1 +#define CMD_OPEN_DATA_CHANNEL 2 +#define CMD_CLOSE_DATA_CHAN 3 +#define CMD_RECONNECT_DATA_CHAN 4 +#define CMD_FILTER_OPERATION 5 + +/* Some responses */ +#define RSP_SUCCESS 0 +#define RSP_INSUFFICIENT_RESOURCES 1 +#define RSP_INVALID_COMMAND_FORMAT 2 +#define RSP_COMMAND_NOT_SUPPORTED 3 +#define RSP_PARAM_NOT_SUPPORTED 4 +#define RSP_VALUE_NOT_SUPPORTED 5 +#define RSP_NOT_OPEN 6 +#define RSP_AUTHENTICATION_REQUIRED 7 +#define RSP_INVALID_PASSWORD 8 +#define RSP_PROTOCOL_ERROR 9 +#define RSP_ASYNCHRONOUS_ERROR 255 + +/* Media types */ +#define MEDIA_802_3 1 +#define MEDIA_802_5 2 + +/* Filter parameters */ +#define DATA_CHAN 1 +#define FILTER_TYPE 2 +#define FILTER_MODE 3 + +/* Filter types */ +#define IR_DIRECTED 1 +#define IR_FUNCTIONAL 2 +#define IR_GROUP 3 +#define IR_MAC_FRAME 4 +#define IR_MULTICAST 5 +#define IR_BROADCAST 6 +#define IR_IPX_SOCKET 7 + +/* Filter modes */ +#define ALL 1 +#define FILTER 2 +#define NONE 3 + +/* Filter operations */ +#define GET 1 +#define CLEAR 2 +#define ADD 3 +#define REMOVE 4 +#define DYNAMIC 5 + +/* Access types */ +#define DIRECT 1 +#define PEER 2 +#define HOSTED 3 + +#define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_HEADER) + +/* + * IrLAN client subclass + */ +struct irlan_client_cb { + /* + * Client fields + */ + int open_retries; + + __u8 reconnect_key[255]; + __u8 key_len; + + int unicast_open; + int broadcast_open; +}; + +/* + * IrLAN servers subclass + */ +struct irlan_server_cb { + + /* + * Store some values here which are used by the irlan_server to parse + * FILTER_OPERATIONs + */ + int data_chan; + int filter_type; + int filter_mode; + int filter_operation; + int filter_entry; + + __u8 mac_address[6]; /* Generated MAC address for peer device */ +}; + +/* + * IrLAN super class + */ +struct irlan_cb { + QUEUE queue; /* Must be first */ + + int magic; + char ifname[9]; + struct device dev; /* Ethernet device structure*/ + struct enet_statistics stats; + + __u32 saddr; /* Source devcie address */ + __u32 daddr; /* Destination device address */ + int connected; /* TTP layer ready to exchange ether frames */ + + int state; /* Current state of IrLAN layer */ + + int media; + + struct tsap_cb *tsap_ctrl; + struct tsap_cb *tsap_data; + + int use_udata; /* Use Unit Data transfers */ + + __u8 dtsap_sel_data; /* Destination data TSAP selector */ + __u8 stsap_sel_data; /* Source data TSAP selector */ + __u8 dtsap_sel_ctrl; /* Destination ctrl TSAP selector */ + + int client; /* Client or server */ + union { + struct irlan_client_cb client; + struct irlan_server_cb server; + } t; + + /* void (*irlan_dev_init)(struct irlan_cb *); */ + + /* + * Used by extract_params, placed here for now to avoid placing + * them on the stack. FIXME: remove these! + */ + char name[255]; + char value[1016]; +}; + +struct irlan_cb *irlan_open(void); + +void irlan_get_provider_info( struct irlan_cb *self); +void irlan_get_unicast_addr( struct irlan_cb *self); +void irlan_get_media_char( struct irlan_cb *self); +void irlan_open_data_channel( struct irlan_cb *self); +void irlan_set_multicast_filter( struct irlan_cb *self, int status); +void irlan_set_broadcast_filter( struct irlan_cb *self, int status); +void irlan_open_unicast_addr( struct irlan_cb *self); + +int insert_byte_param( struct sk_buff *skb, char *param, __u8 value); +int insert_string_param( struct sk_buff *skb, char *param, char *value); +int insert_array_param( struct sk_buff *skb, char *name, __u8 *value, + __u16 value_len); + +int insert_param( struct sk_buff *skb, char *param, int type, char *value_char, + __u8 value_byte, __u16 value_short); + +int irlan_get_response_param( __u8 *buf, char *name, char *value, int *len); +void print_ret_code( __u8 code); + +extern hashbin_t *irlan; + +#endif + + diff --git a/include/net/irda/irlan_eth.h b/include/net/irda/irlan_eth.h new file mode 100644 index 000000000..72f14ff75 --- /dev/null +++ b/include/net/irda/irlan_eth.h @@ -0,0 +1,40 @@ +/********************************************************************* + * + * Filename: irlan_eth.h + * Version: + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Thu Oct 15 08:36:58 1998 + * Modified at: Thu Oct 15 12:28:12 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLAN_ETH_H +#define IRLAN_ETH_H + +int irlan_eth_init( struct device *dev); +int irlan_eth_open( struct device *dev); +int irlan_eth_close( struct device *dev); + +void irlan_eth_rx( void *instance, void *sap, struct sk_buff *skb); +int irlan_eth_tx( struct sk_buff *skb, struct device *dev); + +void irlan_eth_flow_indication( void *instance, void *sap, LOCAL_FLOW flow); + +void irlan_eth_set_multicast_list( struct device *dev); +struct enet_statistics *irlan_eth_get_stats(struct device *dev); + +#endif diff --git a/include/net/irda/irlan_event.h b/include/net/irda/irlan_event.h new file mode 100644 index 000000000..d3a062af0 --- /dev/null +++ b/include/net/irda/irlan_event.h @@ -0,0 +1,86 @@ +/********************************************************************* + * + * Filename: irlan_event.h + * Version: + * Description: LAN access + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sun Aug 31 20:14:37 1997 + * Modified at: Tue Oct 20 09:59:31 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLAN_EVENT_H +#define IRLAN_EVENT_H + +#include <linux/kernel.h> +#include <linux/skbuff.h> + +#include <net/irda/irlan_common.h> + +typedef enum { + IRLAN_IDLE, + IRLAN_QUERY, + IRLAN_CONN, + IRLAN_INFO, + IRLAN_MEDIA, + IRLAN_OPEN, + IRLAN_WAIT, + IRLAN_ARB, + IRLAN_DATA, + IRLAN_CLOSE, + IRLAN_SYNC +} IRLAN_STATE; + +/* IrLAN Client Events */ +typedef enum { + IRLAN_DISCOVERY_INDICATION, + IRLAN_IAS_PROVIDER_AVAIL, + IRLAN_IAS_PROVIDER_NOT_AVAIL, + IRLAN_LAP_DISCONNECT, + IRLAN_LMP_DISCONNECT, + IRLAN_CONNECT_COMPLETE, + IRLAN_DATA_INDICATION, + IRLAN_DATA_CONNECT_INDICATION, + IRLAN_RETRY_CONNECT, + + IRLAN_CONNECT_INDICATION, + IRLAN_GET_INFO_CMD, + IRLAN_GET_MEDIA_CMD, + IRLAN_OPEN_DATA_CMD, + IRLAN_FILTER_CONFIG_CMD, +} IRLAN_EVENT; + +struct irlan_info { + __u8 dlsap_sel; + __u32 daddr; + struct tsap_cb *tsap; +}; + +extern char *irlan_state[]; + +void irlan_do_client_event( struct irlan_cb *self, + IRLAN_EVENT event, + struct sk_buff *skb); + +void irlan_do_server_event( struct irlan_cb *self, + IRLAN_EVENT event, + struct sk_buff *skb, + struct irlan_info *info); + +void irlan_next_state( struct irlan_cb *self, + IRLAN_STATE state); + +#endif diff --git a/include/net/irda/irlan_srv.h b/include/net/irda/irlan_srv.h new file mode 100644 index 000000000..c187302e2 --- /dev/null +++ b/include/net/irda/irlan_srv.h @@ -0,0 +1,62 @@ +/********************************************************************* + * + * Filename: server.h + * Version: 0.1 + * Description: IrDA LAN access layer + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sun Aug 31 20:14:37 1997 + * Modified at: Fri Oct 16 11:25:37 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLAN_SERVER_H +#define IRLAN_SERVER_H + +#include <linux/kernel.h> +#include <linux/types.h> +#include <linux/skbuff.h> +#include <linux/netdevice.h> + +#include <net/irda/irlan_common.h> + +int irlan_server_init(void); +void irlan_server_cleanup(void); +struct irlan_cb *irlan_server_open(void); +void irlan_server_close( struct irlan_cb *self); + +void irlan_server_disconnect_indication( void *instance, void *sap, + LM_REASON reason, + struct sk_buff *skb); + +void irlan_server_data_indication( void *instance, void *sap, + struct sk_buff *skb); +void irlan_server_control_data_indication( void *instance, void *sap, + struct sk_buff *skb); + +void irlan_server_connect_indication( void *instance, void *sap, + struct qos_info *qos, int max_sdu_size, + struct sk_buff *skb); +void irlan_server_connect_response( struct irlan_cb *, struct tsap_cb *); + +int irlan_parse_open_data_cmd( struct irlan_cb *self, struct sk_buff *skb); +int irlan_server_extract_params( struct irlan_cb *self, int cmd, + struct sk_buff *skb); + +void irlan_server_send_reply( struct irlan_cb *self, int command, + int ret_code); +void irlan_server_register(void); + +#endif diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h new file mode 100644 index 000000000..524d2b799 --- /dev/null +++ b/include/net/irda/irlap.h @@ -0,0 +1,232 @@ +/********************************************************************* + * + * Filename: irlap.h + * Version: 0.3 + * Description: An IrDA LAP driver for Linux + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Mon Aug 4 20:40:53 1997 + * Modified at: Sat Dec 12 12:25:33 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLAP_H +#define IRLAP_H + +#include <linux/config.h> +#include <linux/types.h> +#include <linux/skbuff.h> +#include <linux/netdevice.h> +#include <linux/ppp_defs.h> +#include <linux/ppp-comp.h> + +#include <net/irda/irlap_event.h> + +#define LAP_RELIABLE 1 +#define LAP_UNRELIABLE 0 + +#define LAP_ADDR_HEADER 1 /* IrLAP Address Header */ +#define LAP_CTRL_HEADER 1 /* IrLAP Control Header */ +#define LAP_COMP_HEADER 1 /* IrLAP Compression Header */ + +#ifdef CONFIG_IRDA_COMPRESSION +# define LAP_HEADER (LAP_ADDR_HEADER + LAP_CTRL_HEADER + LAP_COMP_HEADER) +# define IRDA_COMPRESSED 1 +# define IRDA_NORMAL 0 +#else +#define LAP_HEADER (LAP_ADDR_HEADER + LAP_CTRL_HEADER) +#endif + +#define BROADCAST 0xffffffff /* Broadcast device address */ +#define CBROADCAST 0xfe /* Connection broadcast address */ +#define XID_FORMAT 0x01 /* Discovery XID format */ + +#define LAP_WINDOW_SIZE 8 +#define MAX_CONNECTIONS 1 + +#define NR_EXPECTED 1 +#define NR_UNEXPECTED 0 +#define NR_INVALID -1 + +#define NS_EXPECTED 1 +#define NS_UNEXPECTED 0 +#define NS_INVALID -1 + +#ifdef CONFIG_IRDA_COMPRESSION +/* + * Just some shortcuts (may give you strange compiler errors if you change + * them :-) + */ +#define irda_compress (*self->compessor.cp->compress) +#define irda_comp_free (*self->compressor.cp->comp_free) +#define irda_decompress (*self->decompressor.cp->decompress) +#define irda_decomp_free (*self->decompressor.cp->decomp_free) +#define irda_incomp (*self->decompressor.cp->incomp) + +struct irda_compressor { + QUEUE queue; + + struct compressor *cp; + void *state; /* Not used by IrDA */ +}; +#endif + +/* Main structure of IrLAP */ +struct irlap_cb { + QUEUE q; /* Must be first */ + + int magic; + + struct irda_device *irdev; + struct device *netdev; + + /* Connection state */ + volatile IRLAP_STATE state; /* Current state */ + + /* Timers used by IrLAP */ + struct timer_list query_timer; + struct timer_list slot_timer; + struct timer_list discovery_timer; + struct timer_list final_timer; + struct timer_list poll_timer; + struct timer_list wd_timer; + struct timer_list backoff_timer; + + /* Timeouts which will be different with different turn time */ + int poll_timeout; + int final_timeout; + int wd_timeout; + + struct sk_buff_head tx_list; /* Frames to be transmitted */ + + __u8 caddr; /* Connection address */ + __u32 saddr; /* Source device address */ + __u32 daddr; /* Destination device address */ + + int retry_count; /* Times tried to establish connection */ + int add_wait; /* True if we are waiting for frame */ + +#ifdef CONFIG_IRDA_FAST_RR + /* + * To send a faster RR if tx queue empty + */ + int fast_RR_timeout; + int fast_RR; +#endif + + int N1; /* N1 * F-timer = Negitiated link disconnect warning threshold */ + int N2; /* N2 * F-timer = Negitiated link disconnect time */ + int N3; /* Connection retry count */ + + int local_busy; + int remote_busy; + int xmitflag; + + __u8 vs; /* Next frame to be sent */ + __u8 vr; /* Next frame to be received */ + int tmp; + __u8 va; /* Last frame acked */ + int window; /* Nr of I-frames allowed to send */ + int window_size; /* Current negotiated window size */ + int window_bytes; /* Number of bytes allowed to send */ + int bytes_left; /* Number of bytes allowed to transmit */ + + struct sk_buff_head wx_list; + + __u8 ack_required; + + /* XID parameters */ + __u8 S; /* Number of slots */ + __u8 slot; /* Random chosen slot */ + __u8 s; /* Current slot */ + int frame_sent; /* Have we sent reply? */ + + int discovery_count; + hashbin_t *discovery_log; + DISCOVERY *discovery_cmd; + + struct qos_info qos_tx; /* QoS requested by peer */ + struct qos_info qos_rx; /* QoS requested by self */ + + struct notify_t notify; /* Callbacks to IrLMP */ + + int mtt_required; /* Minumum turnaround time required */ + int xbofs_delay; /* Nr of XBOF's used to MTT */ + int bofs_count; /* Negotiated extra BOFs */ + + struct irda_statistics stats; + +#ifdef CONFIG_IRDA_RECYCLE_RR + struct sk_buff *recycle_rr_skb; +#endif + +#ifdef CONFIG_IRDA_COMPRESSION + struct irda_compressor compressor; + struct irda_compressor decompressor; +#endif +}; + +extern hashbin_t *irlap; + +/* + * Function prototypes + */ + +int irlap_init( void); +void irlap_cleanup( void); + +struct irlap_cb *irlap_open( struct irda_device *dev); +void irlap_close( struct irlap_cb *self); + +void irlap_connect_request( struct irlap_cb *self, __u32 daddr, + struct qos_info *qos, int sniff); +void irlap_connect_response( struct irlap_cb *self, struct sk_buff *skb); +void irlap_connect_indication( struct irlap_cb *self, struct sk_buff *skb); +void irlap_connect_confirm( struct irlap_cb *, struct sk_buff *skb); + +inline void irlap_data_indication( struct irlap_cb *, struct sk_buff *); +inline void irlap_unit_data_indication( struct irlap_cb *, struct sk_buff *); +inline void irlap_data_request( struct irlap_cb *, struct sk_buff *, + int reliable); + +void irlap_disconnect_request( struct irlap_cb *); +void irlap_disconnect_indication( struct irlap_cb *, LAP_REASON reason); + +void irlap_status_indication( int quality_of_link); + +void irlap_test_request( __u8 *info, int len); + +void irlap_discovery_request( struct irlap_cb *, DISCOVERY *discovery); +void irlap_discovery_confirm( struct irlap_cb *, hashbin_t *discovery_log); +void irlap_discovery_indication( struct irlap_cb *, DISCOVERY *discovery); + +void irlap_reset_indication( struct irlap_cb *self); +void irlap_reset_confirm(void); + +void irlap_update_nr_received( struct irlap_cb *, int nr); +int irlap_validate_nr_received( struct irlap_cb *, int nr); +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 *, int); +void irlap_wait_min_turn_around( struct irlap_cb *, struct qos_info *); + +void irlap_init_qos_capabilities( struct irlap_cb *, struct qos_info *); +void irlap_apply_default_connection_parameters( struct irlap_cb *self); +void irlap_apply_connection_parameters( struct irlap_cb *, struct qos_info *); + +#endif diff --git a/include/net/irda/irlap_comp.h b/include/net/irda/irlap_comp.h new file mode 100644 index 000000000..59f268e53 --- /dev/null +++ b/include/net/irda/irlap_comp.h @@ -0,0 +1,47 @@ +/********************************************************************* + * + * Filename: irlap_comp.h + * Version: + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Fri Oct 9 09:21:12 1998 + * Modified at: Sat Dec 12 12:23:16 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLAP_COMP_H +#define IRLAP_COMP_H + +#include <linux/ppp-comp.h> + +#define CI_BZIP2 27 /* Random pick */ + +extern hashbin_t *irlap_compressors; + +int irda_register_compressor( struct compressor *cp); +void irda_unregister_compressor( struct compressor *cp); + +int irda_set_compression( struct irlap_cb *self, int proto); +void irlap_compressor_init( struct irlap_cb *self, int compress); +void irda_free_compression( struct irlap_cb *self); + +struct sk_buff *irlap_compress_frame( struct irlap_cb *self, + struct sk_buff *skb); +struct sk_buff *irlap_decompress_frame( struct irlap_cb *self, + struct sk_buff *skb); + +#endif + diff --git a/include/net/irda/irlap_event.h b/include/net/irda/irlap_event.h new file mode 100644 index 000000000..bf4128939 --- /dev/null +++ b/include/net/irda/irlap_event.h @@ -0,0 +1,121 @@ +/********************************************************************* + * + * Filename: irlap_event.h + * Version: 0.1 + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sat Aug 16 00:59:29 1997 + * Modified at: Thu Dec 17 11:58:10 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLAP_EVENT_H +#define IRLAP_EVENT_H + +#include "irmod.h" + +struct irlap_cb; + +/* IrLAP States */ +typedef enum { + LAP_NDM, /* Normal disconnected mode */ + LAP_QUERY, + LAP_REPLY, + LAP_CONN, /* Connect indication */ + LAP_SETUP, /* Setting up connection */ + LAP_OFFLINE, /* A really boring state */ + LAP_XMIT_P, + LAP_PCLOSE, + LAP_NRM_P, /* Normal response mode as primary */ + LAP_RESET_WAIT, + LAP_RESET, + LAP_NRM_S, /* Normal response mode as secondary */ + LAP_XMIT_S, + LAP_SCLOSE, + LAP_RESET_CHECK, +} IRLAP_STATE; + +/* IrLAP Events */ +typedef enum { + /* Services events */ + DISCOVERY_REQUEST, + CONNECT_REQUEST, + CONNECT_RESPONSE, + DISCONNECT_REQUEST, + DATA_REQUEST, + RESET_REQUEST, + RESET_RESPONSE, + + /* Send events */ + SEND_I_CMD, + + /* Receive events */ + RECV_DISCOVERY_XID_CMD, + RECV_DISCOVERY_XID_RSP, + RECV_SNRM_CMD, + RECV_TEST_CMD, + RECV_UA_RSP, + RECV_DM_RSP, + RECV_I_CMD, + RECV_I_RSP, + RECV_UI_FRAME, + RECV_FRMR_RSP, + RECV_RR_CMD, + RECV_RR_RSP, + RECV_RNR_FRAME, + RECV_DISC_FRAME, + + /* Timer events */ + SLOT_TIMER_EXPIRED, + QUERY_TIMER_EXPIRED, + FINAL_TIMER_EXPIRED, + POLL_TIMER_EXPIRED, + DISCOVERY_TIMER_EXPIRED, + WD_TIMER_EXPIRED, + BACKOFF_TIMER_EXPIRED, +} IRLAP_EVENT; + +/* + * Various things used by the IrLAP state machine + */ +struct irlap_info { + __u8 caddr; /* Connection address */ + __u8 control; /* Frame type */ + __u8 cmd; + + __u32 saddr; + __u32 daddr; + + int pf; /* Poll/final bit set */ + + __u8 nr; /* Sequence number of next frame expected */ + __u8 ns; /* Sequence number of frame sent */ + + int S; /* Number of slots */ + int slot; /* Random chosen slot */ + int s; /* Current slot */ + + DISCOVERY *discovery; /* Discovery information */ +}; + +extern char *irlap_state[]; + +void irlap_do_event( struct irlap_cb *self, IRLAP_EVENT event, + struct sk_buff *skb, struct irlap_info *info); +void irlap_next_state( struct irlap_cb *self, IRLAP_STATE state); +void irlap_print_event( IRLAP_EVENT event); + +#endif diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h new file mode 100644 index 000000000..6b661e4b5 --- /dev/null +++ b/include/net/irda/irlap_frame.h @@ -0,0 +1,155 @@ +/********************************************************************* + * + * Filename: irlap_frame.h + * Version: 0.3 + * Description: Build and transmit IrLAP frames + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Tue Aug 19 10:27:26 1997 + * Modified at: Mon Dec 14 14:22:23 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLAP_FRAME_H +#define IRLAP_FRAME_H + +#include <linux/skbuff.h> + +#include <net/irda/irmod.h> +#include <net/irda/irlap.h> +#include <net/irda/qos.h> + +/* Frame types and templates */ +#define INVALID 0xff + +/* Unnumbered (U) commands */ +#define SNRM_CMD 0x83 /* Set Normal Response Mode */ +#define DISC_CMD 0x43 /* Disconnect */ +#define XID_CMD 0x2f /* Exchange Station Identification */ +#define TEST_CMD 0xe3 /* Test */ + +/* Unnumbered responses */ +#define RNRM_RSP 0x83 /* Request Normal Response Mode */ +#define UA_RSP 0x63 /* Unnumbered Acknowledgement */ +#define FRMR_RSP 0x87 /* Frame Reject */ +#define DM_RSP 0x0f /* Disconnect Mode */ +#define RD_RSP 0x43 /* Request Disconnection */ +#define XID_RSP 0xaf /* Exchange Station Identification */ +#define TEST_RSP 0xe3 /* Test frame */ + +/* Supervisory (S) */ +#define RR 0x01 /* Receive Ready */ +#define REJ 0x09 /* Reject */ +#define RNR 0x05 /* Receive Not Ready */ +#define SREJ 0x0d /* Selective Reject */ + +/* Information (I) */ +#define I_FRAME 0x00 /* Information Format */ +#define UI_FRAME 0x03 /* Unnumbered Information */ + +#define CMD_FRAME 0x01 +#define RSP_FRAME 0x00 + +#define PF_BIT 0x10 /* Poll/final bit */ + +#define IR_S 0x01 /* Supervisory frames */ +#define IR_RR 0x01 /* Receiver ready */ +#define IR_RNR 0x05 /* Receiver not ready */ +#define IR_REJ 0x09 /* Reject */ +#define IR_U 0x03 /* Unnumbered frames */ +#define IR_SNRM 0x2f /* Set Asynchronous Balanced Mode */ + +#define IR_DISC 0x43 /* Disconnect */ +#define IR_DM 0x0f /* Disconnected mode */ +#define IR_UA 0x63 /* Unnumbered acknowledge */ +#define IR_FRMR 0x87 /* Frame reject */ +#define IR_UI 0x03 /* Unnumbered information */ + +struct xid_frame { + __u8 caddr __attribute__((packed)); /* Connection address */ + __u8 control __attribute__((packed)); + __u8 ident __attribute__((packed)); /* Should always be XID_FORMAT */ + __u32 saddr __attribute__((packed)); /* Source device address */ + __u32 daddr __attribute__((packed)); /* Destination device address */ + __u8 flags __attribute__((packed)); /* Discovery flags */ + __u8 slotnr __attribute__((packed)); + __u8 version __attribute__((packed)); + __u8 discovery_info[0] __attribute__((packed)); +}; + +struct test_frame { + __u8 caddr; /* Connection address */ + __u8 control; + __u8 saddr; /* Source device address */ + __u8 daddr; /* Destination device address */ + __u8 *info; /* Information */ +}; + +struct ua_frame { + __u8 caddr __attribute__((packed)); + __u8 control __attribute__((packed)); + + __u32 saddr __attribute__((packed)); /* Source device address */ + __u32 daddr __attribute__((packed)); /* Dest device address */ + __u8 params[0]; +}; + +struct i_frame { + __u8 caddr __attribute__((packed)); + __u8 control __attribute__((packed)); + __u8 data[0] __attribute__((packed)); +}; + +struct snrm_frame { + __u8 caddr __attribute__((packed)); + __u8 control __attribute__((packed)); + __u32 saddr __attribute__((packed)); + __u32 daddr __attribute__((packed)); + __u8 ncaddr __attribute__((packed)); + __u8 params[0]; +}; + +/* Per-packet information we need to hide inside sk_buff */ +struct irlap_skb_cb { + int mtt; /* minimum turn around time */ + int xbofs; /* number of xbofs required */ + int vs; /* next frame to send */ + int vr; /* next frame to receive */ +}; + +__inline__ void irlap_insert_mtt( struct irlap_cb *self, struct sk_buff *skb); + +void irlap_send_discovery_xid_frame( struct irlap_cb *, int S, __u8 s, + __u8 command, DISCOVERY *discovery); +void irlap_send_snrm_frame( struct irlap_cb *, struct qos_info *); +void irlap_send_ua_response_frame( struct irlap_cb *, struct qos_info *); +void irlap_send_ui_frame( struct irlap_cb *self, struct sk_buff *skb, + int command); +void irlap_send_dm_frame( struct irlap_cb *); +void irlap_send_disc_frame( struct irlap_cb *); +void irlap_send_rr_frame( struct irlap_cb *, int command); + +void irlap_send_data_primary( struct irlap_cb *, struct sk_buff *); +void irlap_send_data_primary_poll( struct irlap_cb *, struct sk_buff *); +void irlap_send_data_secondary( struct irlap_cb *, struct sk_buff *); +void irlap_send_data_secondary_final( struct irlap_cb *, struct sk_buff *); +void irlap_resend_rejected_frames( struct irlap_cb *, int command); + +void irlap_send_i_frame( struct irlap_cb *, struct sk_buff *, int command); +void irlap_send_ui_frame( struct irlap_cb *, struct sk_buff *, int command); + +/* void irlap_input( struct irlap_cb *self, struct sk_buff *skb); */ + +#endif diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h new file mode 100644 index 000000000..a10a08fe1 --- /dev/null +++ b/include/net/irda/irlmp.h @@ -0,0 +1,239 @@ +/********************************************************************* + * + * Filename: irlmp.h + * Version: 0.3 + * Description: IrDA Link Management Protocol (LMP) layer + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sun Aug 17 20:54:32 1997 + * Modified at: Mon Dec 7 21:11:32 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLMP_H +#define IRLMP_H + +#include <linux/config.h> +#include <linux/types.h> + +#include "irmod.h" +#include "qos.h" +#include "irlap.h" +#include "irlmp_event.h" +#include "irqueue.h" + +/* LSAP-SEL's */ +#define LSAP_MASK 0x7f +#define LSAP_IAS 0x00 +#define LSAP_ANY 0xff + +/* Predefined LSAPs used by the various servers */ +#define TSAP_IRLAN 0x05 +#define LSAP_IRLPT 0x06 +#define TSAP_IROBEX 0x07 +#define TSAP_IRCOMM 0x08 + +#define LMP_HEADER 2 /* Dest LSAP + Source LSAP */ +#define LMP_CONTROL_HEADER 4 +#define LMP_MAX_HEADER (LAP_HEADER+LMP_HEADER) + +#define LM_MAX_CONNECTIONS 10 + +/* Hint bit positions for first hint byte */ +#define HINT_PNP 0x01 +#define HINT_PDA 0x02 +#define HINT_COMPUTER 0x04 +#define HINT_PRINTER 0x08 +#define HINT_MODEM 0x10 +#define HINT_FAX 0x20 +#define HINT_LAN 0x40 +#define HINT_EXTENSION 0x80 + +/* Hint bit positions for second hint byte (first extension byte) */ +#define HINT_TELEPHONY 0x01 +#define HINT_FILE_SERVER 0x02 +#define HINT_COMM 0x04 +#define HINT_MESSAGE 0x08 +#define HINT_HTTP 0x10 +#define HINT_OBEX 0x20 + +typedef enum { + S_PNP, + S_PDA, + S_COMPUTER, + S_PRINTER, + S_MODEM, + S_FAX, + S_LAN, + S_TELEPHONY, + S_COMM, + S_OBEX, +} SERVICE; + +#define S_END 0xff + +#define CLIENT 1 +#define SERVER 2 + +typedef void (*DISCOVERY_CALLBACK) ( DISCOVERY*); + +struct irlmp_registration { + QUEUE queue; /* Must be first */ + + int service; /* LAN, OBEX, COMM etc. */ + int type; /* Client or server or both */ + + DISCOVERY_CALLBACK discovery_callback; +}; + +struct lap_cb; /* Forward decl. */ + +/* + * Information about each logical LSAP connection + */ +struct lsap_cb { + QUEUE queue; /* Must be first */ + + int magic; + + int connected; + int persistent; + + struct irda_statistics stats; + + __u8 slsap_sel; /* Source (this) LSAP address */ + __u8 dlsap_sel; /* Destination LSAP address (if connected) */ + + struct sk_buff *tmp_skb; /* Store skb here while connecting */ + + struct timer_list watchdog_timer; + + IRLMP_STATE lsap_state; /* Connection state */ + struct notify_t notify; /* Indication/Confirm entry points */ + struct qos_info qos; /* QoS for this connection */ + + struct lap_cb *lap; /* Pointer to LAP connection structure */ +}; + +/* + * Information about each registred IrLAP layer + */ +struct lap_cb { + QUEUE queue; /* Must be first */ + + int magic; + int reason; /* LAP disconnect reason */ + + IRLMP_STATE lap_state; + + struct irlap_cb *irlap; /* Instance of IrLAP layer */ + + hashbin_t *lsaps; /* LSAP associated with this link */ + + __u8 caddr; /* Connection address */ + + __u32 saddr; /* Source device address */ + __u32 daddr; /* Destination device address */ + + hashbin_t *cachelog; /* Discovered devices for this link */ + + struct qos_info *qos; /* LAP QoS for this session */ +}; + +/* + * Used for caching the last slsap->dlsap->handle mapping + */ +typedef struct { + int valid; + + __u8 slsap_sel; + __u8 dlsap_sel; + struct lsap_cb *lsap; +} CACHE_ENTRY; + +/* + * Main structure for IrLMP + */ +struct irlmp_cb { + int magic; + + __u8 conflict_flag; + + /* int discovery; */ + + DISCOVERY discovery_rsp; /* Discovery response to use by IrLAP */ + DISCOVERY discovery_cmd; /* Discovery command to use by IrLAP */ + + int free_lsap_sel; + +#ifdef CONFIG_IRDA_CACHE_LAST_LSAP + CACHE_ENTRY cache; /* Caching last slsap->dlsap->handle mapping */ +#endif + struct timer_list discovery_timer; + + hashbin_t *links; /* IrLAP connection table */ + hashbin_t *unconnected_lsaps; + hashbin_t *registry; + + __u8 hint[2]; /* Hint bits */ +}; + +/* Prototype declarations */ +int irlmp_init(void); +void irlmp_cleanup(void); + +struct lsap_cb *irlmp_open_lsap( __u8 slsap, struct notify_t *notify); +void irlmp_close_lsap( struct lsap_cb *self); + +void irlmp_register_layer( int service, int type, int do_discovery, + DISCOVERY_CALLBACK); +void irlmp_unregister_layer( int service, int type); + +void irlmp_register_irlap( struct irlap_cb *self, __u32 saddr, + struct notify_t *); +void irlmp_unregister_irlap( __u32 saddr); + +void irlmp_connect_request( struct lsap_cb *, __u8 dlsap_sel, __u32 daddr, + struct qos_info *, struct sk_buff *); +void irlmp_connect_indication( struct lsap_cb *self, struct sk_buff *skb); +void irlmp_connect_response( struct lsap_cb *, struct sk_buff *); +void irlmp_connect_confirm( struct lsap_cb *, struct sk_buff *); + + +void irlmp_disconnect_indication( struct lsap_cb *self, LM_REASON reason, + struct sk_buff *userdata); +void irlmp_disconnect_request( struct lsap_cb *, struct sk_buff *userdata); + +void irlmp_discovery_confirm( struct lap_cb *, hashbin_t *discovery_log); +void irlmp_discovery_indication( struct lap_cb *, DISCOVERY *discovery); +void irlmp_discovery_request( int nslots); +DISCOVERY *irlmp_get_discovery_response(void); + +void irlmp_data_request( struct lsap_cb *, struct sk_buff *); +void irlmp_udata_request( struct lsap_cb *, struct sk_buff *); +void irlmp_data_indication( struct lsap_cb *, struct sk_buff *); +void irlmp_udata_indication( struct lsap_cb *, struct sk_buff *); + +void irlmp_status_request(void); +void irlmp_status_indication( LINK_STATUS link, LOCK_STATUS lock); + +int irlmp_slsap_inuse( __u8 slsap); +__u8 irlmp_find_free_slsap(void); + +LM_REASON irlmp_convert_lap_reason( LAP_REASON); + +extern struct irlmp_cb *irlmp; + +#endif diff --git a/include/net/irda/irlmp_event.h b/include/net/irda/irlmp_event.h new file mode 100644 index 000000000..1ffb6faa5 --- /dev/null +++ b/include/net/irda/irlmp_event.h @@ -0,0 +1,113 @@ +/********************************************************************* + * + * Filename: irlmp_event.h + * Version: 0.1 + * Description: IrDA-LMP event handling + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Mon Aug 4 20:40:53 1997 + * Modified at: Wed Oct 28 14:58:23 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLMP_EVENT_H +#define IRLMP_EVENT_H + +struct irlmp_cb; +struct lsap_cb; +struct lap_cb; + +/* LAP states */ +typedef enum { + /* IrLAP connection control states */ + LAP_STANDBY, /* No LAP connection */ + LAP_U_CONNECT, /* Starting LAP connection */ + LAP_ACTIVE, /* LAP connection is active */ +} IRLMP_STATE; + +/* LSAP connection control states */ +typedef enum { + LSAP_DISCONNECTED, /* No LSAP connection */ + LSAP_CONNECT, /* Connect indication from peer */ + LSAP_CONNECT_PEND, /* Connect request from service user */ + LSAP_DATA_TRANSFER_READY, /* LSAP connection established */ + LSAP_SETUP, /* Trying to set up LSAP connection */ + LSAP_SETUP_PEND, /* Request to start LAP connection */ +} LSAP_STATE; + +typedef enum { + /* LSAP events */ + LM_CONNECT_REQUEST, + LM_CONNECT_CONFIRM, + LM_CONNECT_RESPONSE, + LM_CONNECT_INDICATION, + + LM_DISCONNECT_INDICATION, + LM_DISCONNECT_REQUEST, + + LM_DATA_REQUEST, + LM_UDATA_REQUEST, + LM_DATA_INDICATION, + LM_UDATA_INDICATION, + + LM_WATCHDOG_TIMEOUT, + + /* IrLAP events */ + LM_LAP_CONNECT_REQUEST, + LM_LAP_CONNECT_INDICATION, + LM_LAP_CONNECT_CONFIRM, + LM_LAP_DISCONNECT_INDICATION, + LM_LAP_DISCONNECT_REQUEST, + LM_LAP_DISCOVERY_REQUEST, + LM_LAP_DISCOVERY_CONFIRM, + +} IRLMP_EVENT; + +/* + * Information which is used by the current thread, when executing in the + * state machine. + */ +struct irlmp_event { + IRLMP_EVENT *event; + struct sk_buff *skb; + + __u8 hint; + __u32 daddr; + __u32 saddr; + + __u8 slsap; + __u8 dlsap; + + int reason; + + DISCOVERY *discovery; +}; + +extern char *irlmp_state[]; +extern char *irlsap_state[]; + +void irlmp_watchdog_timer_expired( unsigned long data); +void irlmp_discovery_timer_expired( unsigned long data); + +void irlmp_next_station_state( IRLMP_STATE state); +void irlmp_next_lsap_state( struct lsap_cb *self, LSAP_STATE state); +void irlmp_next_lap_state( struct lap_cb *self, IRLMP_STATE state); + +void irlmp_do_lap_event( struct lap_cb *self, IRLMP_EVENT event, + struct sk_buff *skb); +void irlmp_do_lsap_event( struct lsap_cb *self, IRLMP_EVENT event, + struct sk_buff *skb); + +#endif diff --git a/include/net/irda/irlmp_frame.h b/include/net/irda/irlmp_frame.h new file mode 100644 index 000000000..64960f31d --- /dev/null +++ b/include/net/irda/irlmp_frame.h @@ -0,0 +1,57 @@ +/********************************************************************* + * + * Filename: irlmp_frame.h + * Version: 0.1 + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Tue Aug 19 02:09:59 1997 + * Modified at: Sun Oct 25 00:30:31 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRMLP_FRAME_H +#define IRMLP_FRAME_H + +#include <linux/skbuff.h> + +/* Frame opcodes */ +#define CONNECT_CMD 0x01 +#define CONNECT_CNF 0x81 +#define DISCONNECT 0x02 +#define ACCESSMODE_CMD 0x03 +#define ACCESSMODE_CNF 0x83 + +#define CONTROL_BIT 0x80 + +inline void irlmp_send_data_pdu( struct lap_cb *self, __u8 dlsap, __u8 slsap, + int expedited, struct sk_buff *skb); +void irlmp_send_lcf_pdu( struct lap_cb *self, __u8 dlsap, __u8 slsap, + __u8 opcode, struct sk_buff *skb); +void irlmp_link_data_indication( struct lap_cb *, int reliable, + struct sk_buff *); +void irlmp_link_connect_indication( struct lap_cb *, struct qos_info *qos, + struct sk_buff *skb); +void irlmp_link_connect_request( __u32 daddr); +void irlmp_link_connect_confirm( struct lap_cb *self, struct qos_info *qos, + struct sk_buff *skb); +void irlmp_link_disconnect_indication( struct lap_cb *self, + struct irlap_cb *irlap, + LAP_REASON reason, + struct sk_buff *); +void irlmp_link_discovery_confirm( struct lap_cb *self, hashbin_t *log); +/* void irlmp_link_disconnect_request( void); */ + +#endif diff --git a/include/net/irda/irlpt_cli.h b/include/net/irda/irlpt_cli.h new file mode 100644 index 000000000..1a54c68eb --- /dev/null +++ b/include/net/irda/irlpt_cli.h @@ -0,0 +1,47 @@ +/********************************************************************* + * + * Filename: irlpt_client.h + * Version: 0.1 + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sat Feb 21 18:54:38 1998 + * Modified at: Mon Jan 11 15:58:16 1999 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net> + * Copyright (c) 1998, Dag Brattli, + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * I, Thomas Davis, provide no warranty for any of this software. This + * material is provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLPT_CLIENT_H +#define IRLPT_CLIENT_H + +/* Debug function */ + +/* int client_init( struct device *dev); */ + +/* + * if it's static, it doesn't go in here. + */ + +void irlpt_client_get_value_confirm(__u16 obj_id, + struct ias_value *value, void *priv); +void irlpt_client_connect_indication( void *instance, void *sap, + struct qos_info *qos, + int max_seg_size, + struct sk_buff *skb); +void irlpt_client_connect_request( struct irlpt_cb *self); + +extern hashbin_t *irlpt_clients; + +#endif diff --git a/include/net/irda/irlpt_cli_fsm.h b/include/net/irda/irlpt_cli_fsm.h new file mode 100644 index 000000000..4013c2f4d --- /dev/null +++ b/include/net/irda/irlpt_cli_fsm.h @@ -0,0 +1,34 @@ +/********************************************************************* + * + * Filename: irlpt_client_fsm.h + * Version: 0.1 + * Sources: irlan_event.h + * + * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * I, Thomas Davis, provide no warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLPT_EVENT_H +#define IRLPT_EVENT_H + +#include <linux/kernel.h> +#include <linux/skbuff.h> + +extern void irlpt_client_do_event( struct irlpt_cb *self, + IRLPT_EVENT event, + struct sk_buff *skb, + struct irlpt_info *info); +extern void irlpt_client_next_state( struct irlpt_cb *self, + IRLPT_CLIENT_STATE state); + +#endif + diff --git a/include/net/irda/irlpt_common.h b/include/net/irda/irlpt_common.h new file mode 100644 index 000000000..0e51b017a --- /dev/null +++ b/include/net/irda/irlpt_common.h @@ -0,0 +1,184 @@ +/********************************************************************* + * + * Filename: irlpt.c + * Version: + * Description: + * Status: Experimental. + * Author: Thomas Davis, <ratbert@radiks.net> + * Created at: Sat Feb 21 18:54:38 1998 + * Modified at: Sun Mar 8 23:44:19 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * Sources: irlan.c + * + * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, + * Dag Brattli, <dagb@cs.uit.no> + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * I, Thomas Davis, provide no warranty for any of this software. + * This material is provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLPT_COMMON_H +#define IRLPT_COMMON_H + +#include <net/irda/qos.h> +#include <net/irda/irmod.h> + +#include <linux/kernel.h> +#include <linux/types.h> +#include <linux/skbuff.h> +#include <linux/netdevice.h> +#include <linux/miscdevice.h> + +#include <linux/poll.h> + +extern char *irlpt_service_type[]; +extern char *irlpt_port_type[]; +extern char *irlpt_connected[]; +extern char *irlpt_reasons[]; +extern char *irlpt_client_fsm_state[]; +extern char *irlpt_server_fsm_state[]; +extern char *irlpt_fsm_event[]; + +extern struct wait_queue *lpt_wait; + +extern struct irlpt_cb *irlpt_find_handle(unsigned int minor); +extern void irlpt_flow_control(struct sk_buff *skb); + +extern ssize_t irlpt_read( struct file *file, char *buffer, + size_t count, loff_t *noidea); +extern ssize_t irlpt_write(struct file *file, const char *buffer, + size_t count, loff_t *noidea); +extern loff_t irlpt_seek(struct file *, loff_t, int); +extern int irlpt_open(struct inode * inode, struct file *file); +extern int irlpt_close(struct inode *inode, struct file *file); +extern u_int irlpt_poll(struct file *file, poll_table *wait); + +/* FSM definitions */ + +typedef enum { + IRLPT_CLIENT_IDLE, + IRLPT_CLIENT_QUERY, + IRLPT_CLIENT_READY, + IRLPT_CLIENT_WAITI, + IRLPT_CLIENT_WAITR, + IRLPT_CLIENT_CONN, +} IRLPT_CLIENT_STATE; + +typedef enum { + IRLPT_SERVER_IDLE, + IRLPT_SERVER_CONN, +} IRLPT_SERVER_STATE; + +/* IrLPT Events */ + +typedef enum { + QUERY_REMOTE_IAS, + IAS_PROVIDER_AVAIL, + IAS_PROVIDER_NOT_AVAIL, + LAP_DISCONNECT, + LMP_CONNECT, + LMP_DISCONNECT, + LMP_CONNECT_INDICATION, + LMP_DISCONNECT_INDICATION, +#if 0 + TTP_CONNECT_INDICATION, + TTP_DISCONNECT_INDICATION, +#endif + IRLPT_DISCOVERY_INDICATION, + IRLPT_CONNECT_REQUEST, + IRLPT_DISCONNECT_REQUEST, + CLIENT_DATA_INDICATION, +} IRLPT_EVENT; + +struct irlpt_info { + struct lsap_cb *lsap; + __u8 dlsap_sel; + __u32 daddr; +}; + +/* Command packet types */ + +#define IRLPT_MAX_PACKET 1024 +#define IRLPT_MAX_HEADER LMP_MAX_HEADER +#define IRLPT_MAX_DEVICES 3 +#define IRLPT_MAGIC 0x0755 + +typedef enum { + IRLPT_DISCONNECTED, + IRLPT_WAITING, + IRLPT_CONNECTED, + IRLPT_FLUSHED, +} IRLPT_SERVER_STATUS; + +#define IRLPT_LSAP 0x09 + +#define PI_SERVICE_TYPE 0x00 + +#define IRLPT_UNKNOWN 0x00 /* not defined yet. */ +#define IRLPT_THREE_WIRE_RAW 0x01 /* bit 0 */ +#define IRLPT_THREE_WIRE 0x02 /* bit 1 */ +#define IRLPT_NINE_WIRE 0x04 /* bit 2 */ +#define IRLPT_CENTRONICS 0x08 /* bit 3 */ +#define IRLPT_SERVER_MODE 0xFF /* our own flag */ + +#define PI_PORT_TYPE 0x01 + +#define IRLPT_SERIAL 0x01 /* bit 0 */ +#define IRLPT_PARALLEL 0x02 /* bit 1 */ + +#define PI_PORT_NAME 0x02 + +#define PI_CRITICAL 0x80 + +struct irlpt_cb { + QUEUE queue; /* must be first. */ + + int magic; /* magic used to detect corruption of + the struct */ + __u32 daddr; /* my local address. */ + + struct timer_list retry_timer; + + int volatile state; /* Current state of IrCOMM layer */ + int open_retries; + int in_use; /* flag to prevent re-use */ + char ifname[16]; /* name of the allocated instance, + and registered device. */ + struct lsap_cb *lsap; /* lmp handle */ + + __u8 dlsap_sel; /* remote LSAP selector address */ + __u8 slsap_sel; /* local LSAP selectoraddress */ + __u8 servicetype; /* Type of remote service, ie THREE_WIRE_RAW */ + __u8 porttype; /* type of remote port. */ + + struct miscdevice ir_dev; /* used to register the misc device. */ + + int count; /* open count */ + int irlap_data_size; /* max frame size we can send */ + int pkt_count; /* how many packets are queued up */ + + struct wait_queue *read_wait; /* wait queues */ + struct wait_queue *write_wait; + struct wait_queue *ex_wait; + + /* this is used by the server side of the system */ + + IRLPT_SERVER_STATE connected; + + int eof; + int service_LSAP; + + struct sk_buff_head rx_queue; /* read buffer queue */ +}; + +/* Debug function */ +void irlpt_dump_buffer(struct sk_buff *); + +#endif diff --git a/include/net/irda/irlpt_server.h b/include/net/irda/irlpt_server.h new file mode 100644 index 000000000..7984a331d --- /dev/null +++ b/include/net/irda/irlpt_server.h @@ -0,0 +1,42 @@ +/********************************************************************* + * + * Filename: server.h + * Version: 0.1 + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sat Feb 21 18:54:38 1998 + * Modified at: Tue Sep 22 11:41:42 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net> + * Copyright (c) 1998, Dag Brattli, + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * I, Thomas Davis, provide no warranty for any of this software. This + * material is provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLPT_SERVER_H +#define IRLPT_SERVER_H + +#include "qos.h" +#include "irmod.h" + +#include <linux/kernel.h> +#include <linux/types.h> +#include <linux/skbuff.h> +#include <linux/netdevice.h> +#include <linux/miscdevice.h> + +/* int server_init( struct device *dev); */ + +extern struct irlpt_cb *irlpt_server; + +#endif diff --git a/include/net/irda/irlpt_server_fsm.h b/include/net/irda/irlpt_server_fsm.h new file mode 100644 index 000000000..8f23226c3 --- /dev/null +++ b/include/net/irda/irlpt_server_fsm.h @@ -0,0 +1,30 @@ +/********************************************************************* + * + * Filename: server_fsm.h<2> + * Version: 0.1 + * Sources: irlan_event.h + * + * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * I, Thomas Davis, provide no warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRLPT_EVENT_H +#define IRLPT_EVENT_H + +#include <linux/kernel.h> +#include <linux/skbuff.h> + +void irlpt_server_do_event( struct irlpt_cb *self, IRLPT_EVENT event, + struct sk_buff *skb, struct irlpt_info *info); +void irlpt_server_next_state( struct irlpt_cb *self, IRLPT_SERVER_STATE state); + +#endif diff --git a/include/net/irda/irmod.h b/include/net/irda/irmod.h new file mode 100644 index 000000000..a2f592572 --- /dev/null +++ b/include/net/irda/irmod.h @@ -0,0 +1,265 @@ +/********************************************************************* + * + * Filename: irmod.h + * Version: 0.3 + * Description: IrDA module and utilities functions + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Mon Dec 15 13:58:52 1997 + * Modified at: Tue Jan 12 14:56:11 1999 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charg. + * + ********************************************************************/ + +#ifndef IRMOD_H +#define IRMOD_H + +#include <linux/skbuff.h> +#include <linux/miscdevice.h> + +#include <net/irda/irqueue.h> +#include <net/irda/qos.h> + +#define IRMGR_IOC_MAGIC 'm' +#define IRMGR_IOCTNPC _IO(IRMGR_IOC_MAGIC, 1) +#define IRMGR_IOC_MAXNR 1 + +/* + * Events that we pass to the user space manager + */ +typedef enum { + EVENT_DEVICE_DISCOVERED = 0, + EVENT_REQUEST_MODULE, + EVENT_IRLAN_START, + EVENT_IRLAN_STOP, + EVENT_IRLPT_START, + EVENT_IRLPT_STOP, + EVENT_IROBEX_START, + EVENT_IROBEX_STOP, + EVENT_IRDA_STOP, + EVENT_NEED_PROCESS_CONTEXT, +} IRMGR_EVENT; + +/* + * Event information passed to the IrManager daemon process + */ +struct irmanager_event { + IRMGR_EVENT event; + char devname[10]; + char info[32]; + int service; + __u32 saddr; + __u32 daddr; +}; + +typedef void (*TODO_CALLBACK)( void *self, __u32 param); + +/* + * Same as irmanager_event but this one can be queued and inclueds some + * addtional information + */ +struct irda_event { + QUEUE q; /* Must be first */ + + struct irmanager_event event; +}; + +/* + * Funtions with needs to be called with a process context + */ +struct irda_todo { + QUEUE q; /* Must be first */ + + void *self; + TODO_CALLBACK callback; + __u32 param; +}; + +/* + * Main structure for the IrDA device (not much here :-) + */ +struct irda_cb { + struct miscdevice dev; + struct wait_queue *wait_queue; + + int in_use; + + QUEUE *event_queue; /* Events queued for the irmanager */ + QUEUE *todo_queue; /* Todo list */ +}; + +typedef struct { + char irda_call[7]; /* 6 call + SSID (shifted ascii!) */ +} irda_address; + +struct sockaddr_irda { + short sirda_family; + irda_address sirda_call; + int sirda_ndigis; +}; + +/* + * This type is used by the protocols that transmit 16 bits words in + * little endian format. A little endian machine stores MSB of word in + * byte[1] and LSB in byte[0]. A big endian machine stores MSB in byte[0] + * and LSB in byte[1]. + */ +typedef union { + __u16 word; + __u8 byte[2]; +} __u16_host_order; + +/* + * Information monitored by some layers + */ +struct irda_statistics +{ + int rx_packets; /* total packets received */ + int tx_packets; /* total packets transmitted */ + int rx_errors; /* bad packets received */ + int tx_errors; /* packet transmit problems */ + int rx_dropped; /* no space in linux buffers */ + int tx_dropped; /* no space available in linux */ + int rx_compressed; + int tx_compressed; + int rx_bytes; /* total bytes received */ + int tx_bytes; /* total bytes transmitted */ + + int multicast; /* multicast packets received */ + int collisions; + + /* detailed rx_errors: */ + int rx_length_errors; + int rx_over_errors; /* receiver ring buff overflow */ + int rx_crc_errors; /* recved pkt with crc error */ + int rx_frame_errors; /* recv'd frame alignment error */ + int rx_fifo_errors; /* recv'r fifo overrun */ + int rx_missed_errors; /* receiver missed packet */ + + /* detailed tx_errors */ + int tx_aborted_errors; + int tx_carrier_errors; + int tx_fifo_errors; + int tx_heartbeat_errors; + int tx_window_errors; +}; + +typedef enum { + NO_CHANGE, + LOCKED, + UNLOCKED, +} LOCK_STATUS; + +/* Misc status information */ +typedef enum { + STATUS_OK, + STATUS_ABORTED, + STATUS_NO_ACTIVITY, + STATUS_NOISY, + STATUS_REMOTE, +} LINK_STATUS; + +typedef enum { /* FIXME check the two first reason codes */ + LAP_DISC_INDICATION=1, /* Received a disconnect request from peer */ + LAP_NO_RESPONSE, /* To many retransmits without response */ + LAP_RESET_INDICATION, /* To many retransmits, or invalid nr/ns */ + LAP_FOUND_NONE, /* No devices were discovered */ + LAP_MEDIA_BUSY, + LAP_PRIMARY_CONFLICT, +} LAP_REASON; + +/* + * IrLMP disconnect reasons. The order is very important, since they + * correspond to disconnect reasons sent in IrLMP disconnect frames, so + * please do not touch :-) + */ +typedef enum { + LM_USER_REQUEST = 1, /* User request */ + LM_LAP_DISCONNECT, /* Unexpected IrLAP disconnect */ + LM_CONNECT_FAILURE, /* Failed to establish IrLAP connection */ + LM_LAP_RESET, /* IrLAP reset */ + LM_INIT_DISCONNECT, /* Link Management initiated disconnect */ +} LM_REASON; /* FIXME: Just for now */ + +/* + * IrLMP character code values + */ +#define CS_ASCII 0x00 +#define CS_ISO_8859_1 0x01 +#define CS_ISO_8859_2 0x02 +#define CS_ISO_8859_3 0x03 +#define CS_ISO_8859_4 0x04 +#define CS_ISO_8859_5 0x05 +#define CS_ISO_8859_6 0x06 +#define CS_ISO_8859_7 0x07 +#define CS_ISO_8859_8 0x08 +#define CS_ISO_8859_9 0x09 +#define CS_UNICODE 0xff + +/* + * The DISCOVERY structure is used for both discovery requests and responses + */ +#define DISCOVERY struct discovery_t +struct discovery_t { + QUEUE queue; /* Must be first! */ + + __u32 saddr; /* Which link the device was discovered */ + __u32 daddr; /* Remote device address */ + LAP_REASON condition; /* More info about the discovery */ + + __u8 hint[2]; /* Discovery hint bits */ + __u8 charset; + char info[32]; /* Usually the name of the device */ + __u8 info_len; /* Length of device info field */ + + int gen_addr_bit; /* Need to generate a new device address? */ +}; + +typedef enum { FLOW_STOP, FLOW_START } LOCAL_FLOW; + +/* + * Notify structure used between transport and link management layers + */ +struct notify_t { + void (*data_indication)( void *instance, void *sap, + struct sk_buff *skb); + void (*udata_indication)( void *instance, void *sap, + struct sk_buff *skb); + void (*connect_confirm)( void *instance, void *sap, + struct qos_info *qos, int max_sdu_size, + struct sk_buff *skb); + void (*connect_indication)( void *instance, void *sap, + struct qos_info *qos, int max_sdu_size, + struct sk_buff *skb); + void (*disconnect_indication)( void *instance, void *sap, + LM_REASON reason, struct sk_buff *); + void (*flow_indication)( void *instance, void *sap, LOCAL_FLOW flow); + void *instance; /* Layer instance pointer */ + char name[16]; /* Name of layer */ +}; + +#define NOTIFY_MAX_NAME 16 + +int irmod_init_module(void); +void irmod_cleanup_module(void); + +inline int irda_lock( int *lock); +inline int irda_unlock( int *lock); + +void irda_notify_init( struct notify_t *notify); + +void irda_execute_as_process( void *self, TODO_CALLBACK callback, __u32 param); +void irmanager_notify( struct irmanager_event *event); + +#endif diff --git a/include/net/irda/irobex.h b/include/net/irda/irobex.h new file mode 100644 index 000000000..8f69707d0 --- /dev/null +++ b/include/net/irda/irobex.h @@ -0,0 +1,135 @@ +/********************************************************************* + * + * Filename: irobex.h + * Version: + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sat Jul 4 22:43:57 1998 + * Modified at: Wed Jan 13 15:55:28 1999 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IROBEX_H +#define IROBEX_H + +#include <linux/kernel.h> +#include <linux/types.h> +#include <linux/skbuff.h> +/* #include <linux/netdevice.h> */ +#include <linux/miscdevice.h> + +#include <net/irda/timer.h> +#include <net/irda/qos.h> +#include <net/irda/irmod.h> + +#define LOW_THRESHOLD 4 +#define HIGH_THRESHOLD 8 +#define IROBEX_MAX_QUEUE 12 + +/* Small structure to be used by the IOCTL call */ +struct irobex_ioc_t { + __u32 daddr; +}; + +#define IROBEX_IOC_MAGIC 'k' + +#define IROBEX_IOCSCONNECT _IOW(IROBEX_IOC_MAGIC, 1, 4) +#define IROBEX_IOCSDISCONNECT _IOW(IROBEX_IOC_MAGIC, 2, 4) +#define IROBEX_IOC_MAXNR 2 + +#define IROBEX_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_HEADER) + +typedef enum { + OBEX_IDLE, /* Doing nothing */ + OBEX_DISCOVER, /* Trying to discovery remote device */ + OBEX_QUERY, /* Querying remote LM-IAS */ + OBEX_CONN, /* Trying to connect to remote device */ + OBEX_DATA, /* Data transfer ready */ +} OBEX_STATE; + +struct irobex_cb { + QUEUE queue; /* Must be first! */ + + int magic; /* magic used to detect corruption of the struct */ + + OBEX_STATE state; /* Current state */ + + __u32 saddr; /* my local address */ + __u32 daddr; /* peer address */ + unsigned long time_discovered; + + char devname[9]; /* name of the registered device */ + struct tsap_cb *tsap; + int eof; + + __u8 dtsap_sel; /* remote TSAP address */ + __u8 stsap_sel; /* local TSAP address */ + + int irlap_data_size; + + struct miscdevice dev; + + int count; /* open count */ + + struct sk_buff_head rx_queue; /* Receive queue */ + + struct wait_queue *read_wait; + struct wait_queue *write_wait; + + struct fasync_struct *async; + + struct timer_list watchdog_timer; + + LOCAL_FLOW tx_flow; + LOCAL_FLOW rx_flow; +}; + +int irobex_init(void); +void irobex_cleanup(void); +struct irobex_cb *irobex_open(void); +void irobex_close( struct irobex_cb *self); + +void irobex_discovery_indication( DISCOVERY *); + +void irobex_data_request( int handle, struct sk_buff *skb); +void irobex_data_indication( void *instance, void *sap, struct sk_buff *skb); +void irobex_control_data_indication( void *instance, void *sap, + struct sk_buff *skb); + +void irobex_connect_request( struct irobex_cb *self); +void irobex_connect(struct irobex_cb *self, struct sk_buff *skb); +void irobex_connect_confirm( void *instance, void *sap, struct qos_info *qos, + int max_sdu_size, struct sk_buff *skb); +void irobex_disconnect_indication( void *instance, void *sap, LM_REASON reason, + struct sk_buff *skb); +void irobex_flow_indication( void *instance, void *sap, LOCAL_FLOW flow); + +void irobex_extract_params( struct sk_buff *skb); +void irobex_get_value_confirm(__u16 obj_id, struct ias_value *value, + void *priv); +void irobex_register_server( struct irobex_cb *self); + +void irobex_watchdog_timer_expired( unsigned long data); + +inline void irobex_start_watchdog_timer( struct irobex_cb *self, int timeout) +{ + irda_start_timer( &self->watchdog_timer, timeout, (unsigned long) self, + irobex_watchdog_timer_expired); +} + +extern struct irobex_cb *irobex; + +#endif diff --git a/include/net/irda/irport.h b/include/net/irda/irport.h new file mode 100644 index 000000000..c4a036a4d --- /dev/null +++ b/include/net/irda/irport.h @@ -0,0 +1,61 @@ +/********************************************************************* + * + * Filename: irport.h + * Version: 0.1 + * Description: Serial driver for IrDA + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sun Aug 3 13:49:59 1997 + * Modified at: Thu Jan 7 14:17:31 1999 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1997, 1998 Dag Brattli <dagb@cs.uit.no> + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRPORT_H +#define IRPORT_H + +#include <linux/netdevice.h> +#include <linux/skbuff.h> +#include <linux/types.h> + +#include <net/irda/irda_device.h> + +#define SPEED_DEFAULT 9600 +#define SPEED_MAX 115200 + +/* + * These are the supported serial types. + */ +#define PORT_UNKNOWN 0 +#define PORT_8250 1 +#define PORT_16450 2 +#define PORT_16550 3 +#define PORT_16550A 4 +#define PORT_CIRRUS 5 +#define PORT_16650 6 +#define PORT_MAX 6 + +#define FRAME_MAX_SIZE 2048 + +void irport_close( int iobase); +int irport_open( int iobase); +int irport_detect(struct irda_device *idev); + +void irport_change_speed( int iobase, int speed); +void irport_interrupt(int irq, void *dev_id, struct pt_regs *regs); + +int irport_hard_xmit( struct sk_buff *skb, struct device *dev); + +#endif diff --git a/include/net/irda/irqueue.h b/include/net/irda/irqueue.h new file mode 100644 index 000000000..0551e3b52 --- /dev/null +++ b/include/net/irda/irqueue.h @@ -0,0 +1,106 @@ +/********************************************************************* + * + * Filename: irqueue.h + * Version: 0.3 + * Description: General queue implementation + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Tue Jun 9 13:26:50 1998 + * Modified at: Sun Oct 25 00:26:31 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (C) 1998, Aage Kvalnes <aage@cs.uit.no> + * Copyright (c) 1998, Dag Brattli + * All Rights Reserved. + * + * This code is taken from the Vortex Operating System written by Aage + * Kvalnes and has been ported to Linux and Linux/IR by Dag Brattli + * + * 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. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#include <linux/types.h> +#include <asm/spinlock.h> + +#include <net/irda/irda.h> + +#ifndef QUEUE_H +#define QUEUE_H + +#define NAME_SIZE 32 + +/* + * Hash types + */ +#define HB_NOLOCK 0 +#define HB_GLOBAL 1 +#define HB_LOCAL 2 +#define HB_SORTED 4 + +/* + * Hash defines + */ +#define HASHBIN_SIZE 8 +#define HASHBIN_MASK 0x7 + +typedef void (*FREE_FUNC)( void *arg); + +/* + * Hashbin + */ +#define GET_HASHBIN(x) ( x & HASHBIN_MASK ) + +#define QUEUE struct queue_t +struct queue_t { + QUEUE* q_next; + QUEUE* q_prev; + + char q_name[ NAME_SIZE]; + __u32 q_hash; +}; + +typedef struct hashbin_t { + int magic; + int hb_type; + int hb_size; + spinlock_t hb_mutex[ HASHBIN_SIZE ] ALIGN; + QUEUE* hb_queue[ HASHBIN_SIZE ] ALIGN; + + QUEUE* hb_current; +} hashbin_t; + +hashbin_t *hashbin_new( int type); +int hashbin_delete( hashbin_t* hashbin, FREE_FUNC func); +int hashbin_clear( hashbin_t* hashbin, FREE_FUNC free_func); +void hashbin_insert( hashbin_t* hashbin, QUEUE* entry, __u32 hashv, + char* name); +void* hashbin_find( hashbin_t* hashbin, __u32 hashv, char* name); +void* hashbin_remove( hashbin_t* hashbin, __u32 hashv, char* name); +void* hashbin_remove_first( hashbin_t *hashbin); +QUEUE *hashbin_get_first( hashbin_t *hashbin); +QUEUE *hashbin_get_next( hashbin_t *hashbin); + +void enqueue_last(QUEUE **queue, QUEUE* element); +void enqueue_first(QUEUE **queue, QUEUE* element); +QUEUE *dequeue_first(QUEUE **queue); + +/* + * Function hashbin_get_size (hashbin) + * + * Returns the number of elements in the hashbin + * + */ +extern __inline__ int hashbin_get_size( hashbin_t* hashbin) +{ + return hashbin->hb_size; +} + +#endif diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h new file mode 100644 index 000000000..02a486dd5 --- /dev/null +++ b/include/net/irda/irttp.h @@ -0,0 +1,136 @@ +/********************************************************************* + * + * Filename: irttp.h + * Version: 0.3 + * Description: Tiny Transport Protocol (TTP) definitions + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sun Aug 31 20:14:31 1997 + * Modified at: Sat Dec 5 13:48:12 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRTTP_H +#define IRTTP_H + +#include <linux/types.h> +#include <linux/skbuff.h> + +#include <net/irda/irmod.h> +#include <net/irda/irlmp.h> +#include <net/irda/qos.h> +#include <net/irda/irqueue.h> + +#define TTP_MAX_CONNECTIONS LM_MAX_CONNECTIONS +#define TTP_HEADER 1 +#define TTP_HEADER_WITH_SAR 6 +#define TTP_PARAMETERS 0x80 +#define TTP_MORE 0x80 + +#define DEFAULT_INITIAL_CREDIT 22 + +#define LOW_THRESHOLD 4 +#define HIGH_THRESHOLD 8 +#define TTP_MAX_QUEUE 22 + +/* Some priorities for disconnect requests */ +#define P_NORMAL 0 +#define P_HIGH 1 + +#define SAR_DISABLE 0 + +/* + * This structure contains all data assosiated with one instance of a TTP + * connection. + */ +struct tsap_cb { + QUEUE queue; /* For linking it into the hashbin */ + int magic; /* Just in case */ + + int max_seg_size; /* Max data that fit into an IrLAP frame */ + + __u8 stsap_sel; /* Source TSAP */ + __u8 dtsap_sel; /* Destination TSAP */ + + struct lsap_cb *lsap; /* Corresponding LSAP to this TSAP */ + + __u8 connected; /* TSAP connected */ + + __u8 initial_credit; /* Initial credit to give peer */ + + int avail_credit; /* Available credit to return to peer */ + int remote_credit; /* Credit held by peer TTP entity */ + int send_credit; /* Credit held by local TTP entity */ + + struct sk_buff_head tx_queue; /* Frames to be transmitted */ + struct sk_buff_head rx_queue; /* Received frames */ + struct sk_buff_head rx_fragments; + int tx_queue_lock; + int rx_queue_lock; + + struct notify_t notify; /* Callbacks to client layer */ + + struct irda_statistics stats; + struct timer_list todo_timer; + + int rx_sdu_busy; /* RxSdu.busy */ + int rx_sdu_size; /* The current size of a partially received frame */ + int rx_max_sdu_size; /* Max receive user data size */ + + int tx_sdu_busy; /* TxSdu.busy */ + int tx_max_sdu_size; /* Max transmit user data size */ + + int no_defrag; /* Don't reassemble received fragments */ + + int disconnect_pend; /* Disconnect, but still data to send */ + struct sk_buff *disconnect_skb; +}; + +struct irttp_cb { + int magic; + + hashbin_t *tsaps; +}; + +int irttp_init(void); +void irttp_cleanup(void); + +struct tsap_cb *irttp_open_tsap( __u8 stsap, int credit, + struct notify_t *notify); +void irttp_close_tsap( struct tsap_cb *self); + +int irttp_data_request( struct tsap_cb *self, struct sk_buff *skb); +int irttp_udata_request( struct tsap_cb *self, struct sk_buff *skb); + +void irttp_connect_request( struct tsap_cb *self, __u8 dtsap_sel, __u32 daddr, + struct qos_info *qos, int max_sdu_size, + struct sk_buff *userdata); +void irttp_connect_confirm( void *instance, void *sap, struct qos_info *qos, + int max_sdu_size, struct sk_buff *skb); +void irttp_connect_response( struct tsap_cb *self, int max_sdu_size, + struct sk_buff *userdata); + +void irttp_disconnect_request( struct tsap_cb *self, struct sk_buff *skb, + int priority); +void irttp_flow_request( struct tsap_cb *self, LOCAL_FLOW flow); + +static __inline__ void irttp_no_reassemble( struct tsap_cb *self) +{ + self->no_defrag = TRUE; +} + +extern struct irttp_cb *irttp; + +#endif /* IRTTP_H */ diff --git a/include/net/irda/irtty.h b/include/net/irda/irtty.h new file mode 100644 index 000000000..313a32d9b --- /dev/null +++ b/include/net/irda/irtty.h @@ -0,0 +1,68 @@ +/********************************************************************* + * + * Filename: irtty.h + * Version: 0.1 + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Tue Dec 9 21:13:12 1997 + * Modified at: Mon Dec 14 11:22:37 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1997 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRTTY_H +#define IRTTY_H + +#include <linux/if.h> +#include <linux/skbuff.h> +#include <linux/termios.h> + +#include <net/irda/irda.h> +#include <net/irda/irqueue.h> +#include <net/irda/irda_device.h> + +#include <net/irda/dongle.h> + +#define IRTTY_IOC_MAGIC 'e' +#define IRTTY_IOCTDONGLE _IO(IRTTY_IOC_MAGIC, 1) +#define IRTTY_IOC_MAXNR 1 + +#ifndef N_IRDA +#define N_IRDA 11 /* This one should go in </asm/termio.h> */ +#endif + +struct dongle_q { + QUEUE q; + + struct dongle *dongle; +}; + +struct irtty_cb { + QUEUE q; /* Must be first */ + +/* char name[16]; */ + + int magic; + + struct tty_struct *tty; /* Ptr to TTY structure */ + struct irda_device idev; + + struct dongle_q *dongle_q; /* Has this tty got a dongle attached? */ +}; + +int irtty_register_dongle( struct dongle *dongle); +void irtty_unregister_dongle( struct dongle *dongle); + +#endif diff --git a/include/net/irda/irvtd.h b/include/net/irda/irvtd.h new file mode 100644 index 000000000..43d61c9c0 --- /dev/null +++ b/include/net/irda/irvtd.h @@ -0,0 +1,104 @@ +/********************************************************************* + * + * Filename: irvtd.h + * Version: 0.1 + * Sources: irlpt.h + * + * Copyright (c) 1998, Takahide Higuchi <thiguchi@pluto.dti.ne.jp>, + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * I, Takahide Higuchi, provide no warranty for any of this software. + * This material is provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef IRCOMM_H +#define IRCOMM_H + +#include <linux/types.h> +#include <linux/ioctl.h> +#include <linux/tqueue.h> + +#include <net/irda/irmod.h> +#include <net/irda/qos.h> +#include <net/irda/ircomm_common.h> + + +#define IRVTD_MAGIC 0xff545943 /* random */ +#define COMM_MAX_TTY 1 +#define IRVTD_RX_QUEUE_HIGH 10 +#define IRVTD_RX_QUEUE_LOW 2 + + +/* + * Serial input interrupt line counters -- external structure + * Four lines can interrupt: CTS, DSR, RI, DCD + * + * this structure must be compatible with serial_icounter_struct defined in + * <linux/serial.h>. + */ +struct icounter_struct { + int cts, dsr, rng, dcd; + int reserved[16]; +}; + +struct irvtd_cb { + + int magic; /* magic used to detect corruption of the struct */ + + /* if daddr is NULL, remote device have not been discovered yet */ + + int rx_disable; + struct sk_buff *txbuff; /* buffer queue */ + struct sk_buff_head rxbuff; /* buffer queue */ + struct ircomm_cb *comm; /* ircomm instance */ + + /* + * These members are used for compatibility with usual serial device. + * See linux/serial.h + */ + + int baud_base; + int flags; + struct tty_struct *tty; + + int line; + int count; /* open count */ + int blocked_open; + struct wait_queue *open_wait; + struct wait_queue *close_wait; + struct wait_queue *delta_msr_wait; + struct wait_queue *tx_wait; + + struct tq_struct rx_tqueue; + + long pgrp; + long session; + struct termios normal_termios; + struct termios callout_termios; + unsigned short closing_wait; /* time to wait before closing */ + unsigned short close_delay; + + int mcr; + int msr; + int cts_stoptx; + int ttp_stoptx; + int ttp_stoprx; + struct icounter_struct icount; + int read_status_mask; + int ignore_status_mask; +}; + + +/* Debug function */ + +/* #define CHECK_SKB(skb) check_skb((skb), __LINE__,__FILE__) */ + + + +#endif diff --git a/include/net/irda/irvtd_driver.h b/include/net/irda/irvtd_driver.h new file mode 100644 index 000000000..4983b3d2c --- /dev/null +++ b/include/net/irda/irvtd_driver.h @@ -0,0 +1,122 @@ +/********************************************************************* + * + * Filename: irvtd_driver.h + * Version: 0.1 + * + * Copyright (c) 1998, Takahide Higuchi <thiguchi@pluto.dti.ne.jp>, + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * I, Takahide Higuchi, provide no warranty for any of this software. + * This material is provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#include <linux/tty.h> + +#include <net/irda/irlap.h> +#include <net/irda/irlmp.h> +#include <net/irda/irttp.h> + + +#define VSP_TYPE_NORMAL 1 +#define VSP_TYPE_CALLOUT 2 +#define IRCOMM_MAJOR 60; /* Zero means automatic allocation + 60,61,62,and 63 is reserved for experiment */ +#define IRVTD_MINOR 64 +#define IRVTD_CALLOUT_MINOR 32 + +#define IRVTD_TYPE_NORMAL 11 +#define IRVTD_TYPE_CALLOUT 12 + + +#define IRCOMM_HEADER 1 +#define IRCOMM_RESERVE LAP_HEADER+LMP_HEADER+TTP_HEADER+IRCOMM_HEADER + + + + + +/* + * Definitions for ircomm_cb_struct flags field + * this section is "stolen" from linux-kernel (drivers/char/serial.c) + */ +#define IRVTD_ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes + on the callout port */ +/* #define IRVTD_ASYNC_FOURPORT 0x0002 */ +/* Set OU1, OUT2 per AST Fourport settings */ + +#define IRVTD_ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */ + +#define IRVTD_ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */ + +#define IRVTD_ASYNC_SPD_MASK 0x0030 +#define IRVTD_ASYNC_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */ + +#define IRVTD_ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */ +#define IRVTD_ASYNC_SPD_CUST 0x0030 /* Use user-specified divisor */ + +#define IRVTD_ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */ +#define IRVTD_ASYNC_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */ +#define IRVTD_ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */ +#define IRVTD_ASYNC_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */ +#define IRVTD_ASYNC_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */ + +#define IRVTD_ASYNC_FLAGS 0x0FFF /* Possible legal async flags */ +#define IRVTD_ASYNC_USR_MASK 0x0430 /* Legal flags that non-privileged + * users can set or reset */ + +/* Internal flags used only by kernel/chr_drv/serial.c */ +#define IRVTD_ASYNC_INITIALIZED 0x80000000 /* Serial port was initialized */ +#define IRVTD_ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device is active */ +#define IRVTD_ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device is active */ +#define IRVTD_ASYNC_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */ +#define IRVTD_ASYNC_CLOSING 0x08000000 /* Serial port is closing */ +#define IRVTD_ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */ +#define IRVTD_ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */ +#define IRVTD_ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards */ + + +#define IRVTD_ASYNC_CLOSING_WAIT_INF 0 +#define IRVTD_ASYNC_CLOSING_WAIT_NONE 65535 + +/**************************************/ + +#define DELTA_DTR 0x01 +#define DELTA_RTS 0x02 +#define MCR_DTR 0x04 +#define MCR_RTS 0x08 + +#define DELTA_CTS 0x01 +#define DELTA_DSR 0x02 +#define DELTA_RI 0x04 +#define DELTA_DCD 0x08 +#define MSR_CTS 0x10 +#define MSR_DSR 0x20 +#define MSR_RI 0x40 +#define MSR_DCD 0x80 + +#define LSR_OE 0x02 /* Overrun error indicator */ +#define LSR_PE 0x04 /* Parity error indicator */ +#define LSR_FE 0x08 /* Frame error indicator */ +#define LSR_BI 0x01 /* Break interrupt indicator */ + + + +/**************************************/ + + + + +int irvtd_register_ttydriver(void); +void irvtd_unregister_ttydriver(void); + +void irvtd_flush_chars(struct tty_struct *tty); + + + + diff --git a/include/net/irda/pc87108.h b/include/net/irda/pc87108.h new file mode 100644 index 000000000..ed47bdc1b --- /dev/null +++ b/include/net/irda/pc87108.h @@ -0,0 +1,194 @@ +/********************************************************************* + * + * Filename: pc87108.h + * Version: + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Fri Nov 13 14:37:40 1998 + * Modified at: Thu Dec 10 19:58:20 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no> + * Copyright (c) 1998 Lichen Wang, <lwang@actisys.com> + * Copyright (c) 1998 Actisys Corp., www.actisys.com + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef PC87108_H +#define PC87108_H + +#include <asm/io.h> + +/* Flags for configuration register CRF0 */ +#define APEDCRC 0x02 +#define ENBNKSEL 0x01 + +/* Set 0 */ +#define TXD 0x00 /* Transmit data port */ +#define RXD 0x00 /* Receive data port */ + +/* Register 1 */ +#define IER 0x01 /* Interrupt Enable Register*/ +#define IER_RXHDL_IE 0x01 /* Receiver high data level interrupt */ +#define IER_TXLDL_IE 0x02 /* Transeiver low data level interrupt */ +#define IER_LS_IE 0x04//* Link Status Interrupt */ +#define IER_ETXURI 0x04 /* Tx underrun */ +#define IER_DMA_IE 0x10 /* DMA finished interrupt */ +#define IER_TXEMP_IE 0x20 +#define IER_SFIF_IE 0x40 /* Frame status FIFO intr */ +#define IER_TMR_IE 0x80 /* Timer event */ + +#define FCR 0x02 /* (write only) */ +#define FCR_FIFO_EN 0x01 /* Enable FIFO's */ +#define FCR_RXSR 0x02 /* Rx FIFO soft reset */ +#define FCR_TXSR 0x04 /* Tx FIFO soft reset */ +#define FCR_RXTH 0x80 /* Rx FIFO threshold (set to 16) */ +#define FCR_TXTH 0x20 /* Tx FIFO threshold (set to 17) */ + +#define EIR 0x02 /* (read only) */ +#define EIR_RXHDL_EV 0x01 +#define EIR_TXLDL_EV 0x02 +#define EIR_LS_EV 0x04 +#define EIR_DMA_EV 0x10 +#define EIR_TXEMP_EV 0x20 +#define EIR_SFIF_EV 0x40 +#define EIR_TMR_EV 0x80 + +#define LCR 0x03 /* Link control register */ +#define LCR_WLS_8 0x03 /* 8 bits */ + +#define BSR 0x03 /* Bank select register */ +#define BSR_BKSE 0x80 +#define BANK0 LCR_WLS_8 /* Must make sure that we set 8N1 */ +#define BANK1 0x80 +#define BANK2 0xe0 +#define BANK3 0xe4 +#define BANK4 0xe8 +#define BANK5 0xec +#define BANK6 0xf0 +#define BANK7 0xf4 + +#define MCR 0x04 /* Mode Control Register */ +#define MCR_MODE_MASK ~(0xd0) +#define MCR_UART 0x00 +#define MCR_RESERVED 0x20 +#define MCR_SHARP_IR 0x40 +#define MCR_SIR 0x60 +#define MCR_MIR 0x80 +#define MCR_FIR 0xa0 +#define MCR_CEIR 0xb0 +#define MCR_DMA_EN 0x04 +#define MCR_EN_IRQ 0x08 +#define MCR_TX_DFR 0x08 + +#define LSR 0x05 /* Link status register */ +#define LSR_RXDA 0x01 /* Receiver data available */ +#define LSR_TXRDY 0x20 /* Transmitter ready */ +#define LSR_TXEMP 0x40 /* Transmitter empty */ + +#define ASCR 0x07 /* Auxillary Status and Control Register */ +#define ASCR_RXF_TOUT 0x01 /* Rx FIFO timeout */ +#define ASCR_FEND_INF 0x02 /* Frame end bytes in rx FIFO */ +#define ASCR_S_EOT 0x04 /* Set end of transmission */ +#define ASCT_RXBSY 0x20 /* Rx busy */ +#define ASCR_TXUR 0x40 /* Transeiver underrun */ +#define ASCR_CTE 0x80 /* Clear timer event */ + +/* Bank 2 */ +#define BGDL 0x00 /* Baud Generator Divisor Port (Low Byte) */ +#define BGDH 0x01 /* Baud Generator Divisor Port (High Byte) */ + +#define ECR1 0x02 /* Extended Control Register 1 */ +#define ECR1_EXT_SL 0x01 /* Extended Mode Select */ +#define ECR1_DMANF 0x02 /* DMA Fairness */ +#define ECR1_DMATH 0x04 +#define ECR1_DMASWP 0x08 /* DMA Swap */ + +#define EXCR2 0x04 +#define EXCR2_TFSIZ 0x01 /* Rx FIFO size = 32 */ +#define EXCR2_RFSIZ 0x04 /* Tx FIFO size = 32 */ + +#define TXFLV 0x06 /* Tx FIFO level */ +#define RXFLV 0x07 /* Rx FIFO level */ + +/* Bank 3 */ +#define MID 0x00 + +/* Bank 4 */ +#define TMRL 0x00 /* Timer low byte */ +#define TMRH 0x01 /* Timer high byte */ +#define IRCR1 0x02 /* Infrared control register 1 */ +#define IRCR1_TMR_EN 0x01 /* Timer enable */ + +#define TFRLL 0x04 +#define TFRLH 0x05 +#define RFRLL 0x06 +#define RFRLH 0x07 + +/* Bank 5 */ +#define IRCR2 0x04 /* Infrared control register 2 */ +#define IRCR2_MDRS 0x04 /* MIR data rate select */ +#define IRCR2_FEND_MD 0x20 /* */ + +#define FRM_ST 0x05 /* Frame status FIFO */ +#define FRM_ST_VLD 0x80 /* Frame status FIFO data valid */ +#define FRM_ST_ERR_MSK 0x5f +#define FRM_ST_LOST_FR 0x40 /* Frame lost */ +#define FRM_ST_MAX_LEN 0x10 /* Max frame len exceeded */ +#define FRM_ST_PHY_ERR 0x08 /* Physical layer error */ +#define FRM_ST_BAD_CRC 0x04 +#define FRM_ST_OVR2 0x02 /* Receive overrun */ +#define FRM_ST_OVR1 0x01 /* Frame status FIFO overrun */ + +#define RFLFL 0x06 +#define RFLFH 0x07 + +/* Bank 6 */ +#define IR_CFG2 0x00 +#define IR_CFG2_DIS_CRC 0x02 + +/* Bank 7 */ +#define IRM_CR 0x07 /* Infrared module control register */ +#define IRM_CR_IRX_MSL 0x40 +#define IRM_CR_AF_MNT 0x80 /* Automatic format */ + +/* For storing entries in the status FIFO */ +struct st_fifo_entry { + int status; + int len; +}; + +struct st_fifo { + struct st_fifo_entry entries[10]; + int head; + int tail; + int len; +}; + +/* Private data for each instance */ +struct pc87108 { + struct st_fifo st_fifo; + + int tx_buff_offsets[10]; /* Offsets between frames in tx_buff */ + int tx_len; /* Number of frames in tx_buff */ + + struct irda_device idev; +}; + +static inline void switch_bank( int iobase, int bank) +{ + outb( bank, iobase+BSR); +} + +#endif diff --git a/include/net/irda/qos.h b/include/net/irda/qos.h new file mode 100644 index 000000000..39ca2b7b9 --- /dev/null +++ b/include/net/irda/qos.h @@ -0,0 +1,104 @@ +/********************************************************************* + * + * Filename: qos.h + * Version: 0.1 + * Description: Quality of Service definitions + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Fri Sep 19 23:21:09 1997 + * Modified at: Wed Dec 9 10:32:47 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef QOS_H +#define QOS_H + +#include <linux/config.h> +#include <linux/skbuff.h> + +#define PI_BAUD_RATE 0x01 +#define PI_MAX_TURN_TIME 0x82 +#define PI_DATA_SIZE 0x83 +#define PI_WINDOW_SIZE 0x84 +#define PI_ADD_BOFS 0x85 +#define PI_MIN_TURN_TIME 0x86 +#define PI_LINK_DISC 0x08 +#define PI_COMPRESSION 0x07 /* Just a random pick */ + + +#define IR_115200_MAX 0x3f + +/* Baud rates (first byte) */ +#define IR_2400 0x01 +#define IR_9600 0x02 +#define IR_19200 0x04 +#define IR_38400 0x08 +#define IR_57600 0x10 +#define IR_115200 0x20 +#define IR_576000 0x40 +#define IR_1152000 0x80 + +/* Baud rates (second byte) */ +#define IR_4000000 0x01 + +/* Quality of Service information */ +typedef struct { + int value; + __u16 bits; /* LSB is first byte, MSB is second byte */ +} qos_value_t; + +struct qos_info { + int magic; + + qos_value_t baud_rate; /* IR_11520O | ... */ + qos_value_t max_turn_time; + qos_value_t data_size; + qos_value_t window_size; + qos_value_t additional_bofs; + qos_value_t min_turn_time; + qos_value_t link_disc_time; + + qos_value_t power; +#ifdef CONFIG_IRDA_COMPRESSION + /* An experimental non IrDA field */ + qos_value_t compression; +#endif +}; + +extern int baud_rates[]; +extern int data_size[]; +extern int min_turn_time[]; +extern int add_bofs[]; +extern int compression[]; + +void irda_init_max_qos_capabilies( struct qos_info *qos); +void irda_qos_compute_intersection( struct qos_info *, struct qos_info *); +int irda_insert_qos_negotiation_params( struct qos_info *qos, __u8 *fp); +void irda_qos_negotiate( struct qos_info *qos_rx, struct qos_info *qos_tx, + struct sk_buff *skb); + +int msb_index ( __u16 byte); +int byte_value( __u8 byte, int *array); +int value_index( int value, int *array); +int index_value( int index, int *array); + +void irda_qos_bits_to_value( struct qos_info *qos); + +#endif + + + + + diff --git a/include/net/irda/smc_ircc.h b/include/net/irda/smc_ircc.h new file mode 100644 index 000000000..8750618a7 --- /dev/null +++ b/include/net/irda/smc_ircc.h @@ -0,0 +1,123 @@ +#if 0 +static char *rcsid = "$Id: smc_ircc.h,v 1.5 1998/07/27 01:25:29 ratbert Exp $"; +#endif + +#ifndef SMC_IRCC_H +#define SMC_IRCC_H + +#define FIR_XMIT 1 +#define FIR_RECEIVE 2 +#define SIR_XMIT 3 +#define SIR_RECEIVE 4 + +#define MASTER 0x07 +#define MASTER_POWERDOWN 1<<7 +#define MASTER_RESET 1<<6 +#define MASTER_INT_EN 1<<5 +#define MASTER_ERROR_RESET 1<<4 + +/* Register block 0 */ + +#define IIR 0x01 +#define IER 0x02 +#define LSR 0x03 +#define LCR_A 0x04 +#define LCR_B 0x05 +#define BSR 0x06 + +#define IIR_ACTIVE_FRAME 1<<7 +#define IIR_EOM 1<<6 +#define IIR_RAW_MODE 1<<5 +#define IIR_FIFO 1<<4 + +#define IER_ACTIVE_FRAME 1<<7 +#define IER_EOM 1<<6 +#define IER_RAW_MODE 1<<5 +#define IER_FIFO 1<<4 + +#define LSR_UNDER_RUN 1<<7 +#define LSR_OVER_RUN 1<<6 +#define LSR_FRAME_ERROR 1<<5 +#define LSR_SIZE_ERROR 1<<4 +#define LSR_CRC_ERROR 1<<3 +#define LSR_FRAME_ABORT 1<<2 + +#define LCR_A_FIFO_RESET 1<<7 +#define LCR_A_FAST 1<<6 +#define LCR_A_GP_DATA 1<<5 +#define LCR_A_RAW_TX 1<<4 +#define LCR_A_RAW_RX 1<<3 +#define LCR_A_ABORT 1<<2 +#define LCR_A_DATA_DONE 1<<1 + +#define LCR_B_SCE_MODE_DISABLED 0x00<<6 +#define LCR_B_SCE_MODE_TRANSMIT 0x01<<6 +#define LCR_B_SCE_MODE_RECEIVE 0x02<<6 +#define LCR_B_SCE_MODE_UNDEFINED 0x03<<6 +#define LCR_B_SIP_ENABLE 1<<5 +#define LCR_B_BRICK_WALL 1<<4 + +#define BSR_NOT_EMPTY 1<<7 +#define BSR_FIFO_FULL 1<<6 +#define BSR_TIMEOUT 1<<5 + +/* Register block 1 */ + +#define SCE_CFG_A 0x00 +#define SCE_CFG_B 0x01 +#define FIFO_THRESHOLD 0x02 + +#define CFG_A_AUX_IR 0x01<<7 +#define CFG_A_HALF_DUPLEX 0x01<<2 +#define CFG_A_TX_POLARITY 0x01<<1 +#define CFG_A_RX_POLARITY 0x01 + +#define CFG_A_COM 0x00<<3 +#define CFG_A_IRDA_SIR_A 0x01<<3 +#define CFG_A_ASK_SIR 0x02<<3 +#define CFG_A_IRDA_SIR_B 0x03<<3 +#define CFG_A_IRDA_HDLC 0x04<<3 +#define CFG_A_IRDA_4PPM 0x05<<3 +#define CFG_A_CONSUMER 0x06<<3 +#define CFG_A_RAW_IR 0x07<<3 +#define CFG_A_OTHER 0x08<<3 + +#define IR_HDLC 0x04 +#define IR_4PPM 0x01 +#define IR_CONSUMER 0x02 + +#define CFG_B_LOOPBACK 0x01<<5 +#define CFG_B_LPBCK_TX_CRC 0x01<<4 +#define CFG_B_NOWAIT 0x01<<3 +#define CFB_B_STRING_MOVE 0x01<<2 +#define CFG_B_DMA_BURST 0x01<<1 +#define CFG_B_DMA_ENABLE 0x01 + +#define CFG_B_MUX_COM 0x00<<6 +#define CFG_B_MUX_IR 0x01<<6 +#define CFG_B_MUX_AUX 0x02<<6 +#define CFG_B_INACTIVE 0x03<<6 + +/* Register block 2 - Consumer IR - not used */ + +/* Register block 3 - Identification Registers! */ + +#define SMSC_ID_HIGH 0x00 /* 0x10 */ +#define SMSC_ID_LOW 0x01 /* 0xB8 */ +#define CHIP_ID 0x02 /* 0xF1 */ +#define VERSION_NUMBER 0x03 /* 0x01 */ +#define HOST_INTERFACE 0x04 /* low 4 = DMA, high 4 = IRQ */ + +/* Register block 4 - IrDA */ +#define IR_CONTROL 0x00 +#define BOF_COUNT_LO 0x01 +#define BRICK_WALL_CNT_LO 0x02 +#define BRICK_TX_CNT_HI 0x03 +#define TX_DATA_SIZE_LO 0x04 +#define RX_DATA_SIZE_HI 0x05 +#define RX_DATA_SIZE_LO 0x06 + +#define SELECT_1152 0x01<<7 +#define CRC_SELECT 0x01<<6 + +#endif diff --git a/include/net/irda/timer.h b/include/net/irda/timer.h new file mode 100644 index 000000000..35a5be260 --- /dev/null +++ b/include/net/irda/timer.h @@ -0,0 +1,79 @@ +/********************************************************************* + * + * Filename: timer.h + * Version: + * Description: + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sat Aug 16 00:59:29 1997 + * Modified at: Mon Nov 2 14:31:55 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1997, 1998 Dag Brattli <dagb@cs.uit.no>, + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef TIMER_H +#define TIMER_H + +#include "irda.h" +#include "irmod.h" +#include "irlap.h" +#include "irlmp.h" +#include "irda_device.h" + +/* + * Timeout definitions, some defined in IrLAP p. 92 + */ +#define POLL_TIMEOUT 45 /* Must never exceed 500 ms */ +#define FINAL_TIMEOUT 50 /* Must never exceed 500 ms */ + +/* + * Normally twice of p-timer. Note 3, IrLAP p. 60 suggests at least twice + * duration of the P-timer. + */ +#define WD_TIMEOUT POLL_TIMEOUT*2 +#define MEDIABUSY_TIMEOUT 50 /* 500 msec */ + +/* + * Slot timer must never exceed 85 ms, and must always be at least 25 ms, + * suggested to 75-85 msec by IrDA lite + */ +#define SLOT_TIMEOUT 8 +#define QUERY_TIMEOUT 100 + +#define WATCHDOG_TIMEOUT 2000 /* 20 sec */ +#define RETRY_TIMEOUT 51 + +typedef void (*TIMER_CALLBACK)( unsigned long); + +void irda_start_timer( struct timer_list *ptimer, int timeout, int data, + TIMER_CALLBACK callback); + +inline void irlap_start_slot_timer( struct irlap_cb *self, int timeout); +inline void irlap_start_query_timer( struct irlap_cb *self, int timeout); +inline void irlap_start_final_timer( struct irlap_cb *self, int timeout); +inline void irlap_start_wd_timer( struct irlap_cb *self, int timeout); +inline void irlap_start_backoff_timer( struct irlap_cb *self, int timeout); + +inline void irda_device_start_mbusy_timer( struct irda_device *self); + +struct lsap_cb; +inline void irlmp_start_watchdog_timer( struct lsap_cb *, int timeout); +inline void irlmp_start_discovery_timer( struct irlmp_cb *, int timeout); + +struct irobex_cb; +inline void irobex_start_watchdog_timer( struct irobex_cb *, int timeout); + +#endif + diff --git a/include/net/irda/uircc.h b/include/net/irda/uircc.h new file mode 100644 index 000000000..a8b4c02dd --- /dev/null +++ b/include/net/irda/uircc.h @@ -0,0 +1,121 @@ +/********************************************************************* + * + * Filename: uircc.h + * Version: 0.1 + * Description: Driver for the Sharp Universal Infrared + * Communications Controller (UIRCC) + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Sat Dec 26 11:00:49 1998 + * Modified at: Tue Jan 19 23:52:46 1999 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef UIRCC_H +#define UIRCC_H + +/* Control registers (write only) */ +#define UIRCC_CR0 0x00 /* Control register 0 */ +#define UIRCC_CR0_XMIT_RST 0x20 /* Transmit reset */ +#define UIRCC_CR0_RECV_RST 0x10 /* Receive reset */ +#define UIRCC_CR0_TMR_RST 0x08 /* Timer reset */ +#define UIRCC_CR0_SYS_RST 0x04 /* System reset */ +#define UIRCC_CR0_CARR_RST 0x02 /* Carrier latch reset */ +#define UIRCC_CR0_CNT_SWT 0x01 /* Transmit/receive length counter reset */ + +#define UIRCC_CR1 0x01 /* Transmit/receive mode setting register */ +#define UIRCC_CR1_RX_DMA 0x80 /* Rx DMA mode */ +#define UIRCC_CR1_TX_DMA 0x20 /* Tx DMA mode */ +#define UIRCC_CR1_DMA_BRST 0x10 /* DMA burst mode */ +#define UIRCC_CR1_MUST_SET 0x0c /* Must be set */ + +#define UIRCC_CR2 0x02 /* Interrupt mask register */ +#define UIRCC_CR2_RECV_OVR 0x40 /* Receive overrun error */ +#define UIRCC_CR2_RECV_FRM 0x20 /* Receive frame error */ +#define UIRCC_CR2_RECV_END 0x10 /* Receive end */ +#define UIRCC_CR2_TMR_OUT 0x08 /* Timer time-out */ +#define UIRCC_CR2_XMIT_UNR 0x04 /* Transmit under-run error */ +#define UIRCC_CR2_XMIT_END 0x01 /* Transmit end */ +#define UIRCC_CR2_RECV_MASK 0x70 +#define UIRCC_CR2_XMIT_MASK 0x05 + +#define UIRCC_CR3 0x03 /* Transmit/receive control */ +#define UIRCC_CR3_XMIT_EN 0x80 /* Transmit enable */ +#define UIRCC_CR3_TX_CRC_EN 0x40 /* Transmit UIRCC_CRC enable */ +#define UIRCC_CR3_RECV_EN 0x20 /* Receive enable */ +#define UIRCC_CR3_RX_CRC_EN 0x10 /* Receive CRC enable */ +#define UIRCC_CR3_ADDR_CMP 0x08 /* Address comparison enable */ +#define UIRCC_CR3_MCAST_EN 0x04 /* Multicast enable */ + +#define UIRCC_CR4 0x04 /* Transmit data length low byte */ +#define UIRCC_CR5 0x05 /* Transmit data length high byte */ +#define UIRCC_CR6 0x06 /* Transmit data writing low byte */ +#define UIRCC_CR7 0x07 /* Transmit data writing high byte */ + +#define UIRCC_CR8 0x08 /* Self pole address */ + +#define UIRCC_CR9 0x09 /* System control 1 */ + +#define UIRCC_CR10 0x0a /* Modem selection */ +#define UIRCC_CR10_SIR 0x22 /* Set SIR mode */ +#define UIRCC_CR10_FIR 0x88 /* Set FIR mode */ + +#define UIRCC_CR11 0x0b /* System control 2 (same as SR11) */ +#define UIRCC_CR11_TMR_EN 0x08 + +#define UIRCC_CR12 0x0c /* Timer counter initial value (low byte) */ +#define UIRCC_CR13 0x0d /* Timer counter initial value (high byte) */ + +/* Status registers (read only) */ +#define UIRCC_SR0 0x00 /* Transmit/receive status register */ +#define UIRCC_SR0_RX_RDY 0x80 /* Received data ready */ +#define UIRCC_SR0_RX_OVR 0x40 /* Receive overrun error */ +#define UIRCC_SR0_RX_CRCFRM 0x20 /* Receive CRC or framing error */ + +#define UIRCC_SR2 0x02 /* Interrupt mask status */ + +#define UIRCC_SR3 0x03 /* Interrupt factor register */ +#define UIRCC_SR3_RX_OVR_ER 0x40 /* Receive overrun error */ +#define UIRCC_SR3_RX_FRM_ER 0x20 /* Receive frameing error */ +#define UIRCC_SR3_RX_EOF 0x10 /* Receive end of frame */ +#define UIRCC_SR3_TMR_OUT 0x08 /* Timer timeout */ +#define UIRCC_SR3_TXUR 0x04 /* Transmit underrun */ +#define UIRCC_SR3_TX_DONE 0x01 /* Transmit all sent */ + +#define UIRCC_SR4 0x04 /* TX/RX data length counter low byte */ +#define UIRCC_SR5 0x05 /* TX/RX data length counter high byte */ + +#define UIRCC_SR8 0x08 /* Chip version */ + +#define UIRCC_SR9 0x09 /* System status 1 */ + +#define UIRCC_SR10 0x0a /* Modem select status */ + +#define UIRCC_SR12 0x0c /* Timer counter status (low byte) */ +#define UIRCC_SR13 0x0d /* Timer counter status (high byte) */ + +/* Private data for each instance */ +struct uircc_cb { + struct irda_device idev; + + __u8 cr3; /* Copy of register sr3 */ +}; + +#define CR3_SET + +#endif + + + diff --git a/include/net/irda/w83977af.h b/include/net/irda/w83977af.h new file mode 100644 index 000000000..dda084ab7 --- /dev/null +++ b/include/net/irda/w83977af.h @@ -0,0 +1,54 @@ +#ifndef W83977AF_H +#define W83977AF_H + +#define W977_EFER 0x370 +#define W977_EFIR 0x370 +#define W977_EFDR 0x371 +#define W977_DEVICE_IR 0x06 + + +/* + * Enter extended function mode + */ +static inline void w977_efm_enter(void) +{ + outb(0x87, W977_EFER); + outb(0x87, W977_EFER); +} + +/* + * Select a device to configure + */ + +static inline void w977_select_device(__u8 devnum) +{ + outb(0x07, W977_EFIR); + outb(devnum, W977_EFDR); +} + +/* + * Write a byte to a register + */ +static inline void w977_write_reg(__u8 reg, __u8 value) +{ + outb(reg, W977_EFIR); + outb(value, W977_EFDR); +} + +/* + * read a byte from a register + */ +static inline __u8 w977_read_reg(__u8 reg) +{ + outb(reg, W977_EFIR); + return inb(W977_EFDR); +} + +/* + * Exit extended function mode + */ +static inline void w977_efm_exit(void) +{ + outb(0xAA, W977_EFER); +} +#endif diff --git a/include/net/irda/w83977af_ir.h b/include/net/irda/w83977af_ir.h new file mode 100644 index 000000000..3e3200b2d --- /dev/null +++ b/include/net/irda/w83977af_ir.h @@ -0,0 +1,158 @@ +/********************************************************************* + * + * Filename: w83977af_ir.h + * Version: + * Description: + * Status: Experimental. + * Author: Paul VanderSpek + * Created at: Thu Nov 19 13:55:34 1998 + * Modified at: Thu Dec 10 14:06:18 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef W83977AF_IR_H +#define W83977AF_IR_H + +#include <asm/io.h> + +/* Flags for configuration register CRF0 */ +#define ENBNKSEL 0x01 +#define APEDCRC 0x02 +#define TXW4C 0x04 +#define RXW4C 0x08 + +/* Bank 0 */ +#define RBR 0x00 /* Receiver buffer register */ +#define TBR 0x00 /* Transmitter buffer register */ + +#define ICR 0x01 /* Interrupt configuration register */ +#define ICR_ERBRI 0x01 /* Receiver buffer register interrupt */ +#define ICR_ETBREI 0x02 /* Transeiver empty interrupt */ +#define ICR_EUSRI 0x04//* IR status interrupt */ +#define ICR_EHSRI 0x04 +#define ICR_ETXURI 0x04 /* Tx underrun */ +#define ICR_EDMAI 0x10 /* DMA interrupt */ +#define ICR_ETXTHI 0x20 /* Transmitter threshold interrupt */ +#define ICR_EFSFI 0x40 /* Frame status FIFO interrupt */ +#define ICR_ETMRI 0x80 /* Timer interrupt */ + +#define UFR 0x02 /* FIFO control register */ +#define UFR_EN_FIFO 0x01 /* Enable FIFO's */ +#define UFR_RXF_RST 0x02 /* Reset Rx FIFO */ +#define UFR_TXF_RST 0x04 /* Reset Tx FIFO */ +#define UFR_RXTL 0x80 /* Rx FIFO threshold (set to 16) */ +#define UFR_TXTL 0x20 /* Tx FIFO threshold (set to 17) */ + +#define ISR 0x02 /* Interrupt status register */ +#define ISR_RXTH_I 0x01 /* Receive threshold interrupt */ +#define ISR_TXEMP_I 0x02 /* Transmitter empty interrupt */ +#define ISR_FEND_I 0x04 +#define ISR_DMA_I 0x10 +#define ISR_TXTH_I 0x20 /* Transmitter threshold interrupt */ +#define ISR_FSF_I 0x40 +#define ISR_TMR_I 0x80 /* Timer interrupt */ + +#define UCR 0x03 /* Uart control register */ +#define UCR_DLS8 0x03 /* 8N1 */ + +#define SSR 0x03 /* Sets select register */ +#define SET0 UCR_DLS8 /* Make sure we keep 8N1 */ +#define SET1 (0x80|UCR_DLS8) /* Make sure we keep 8N1 */ +#define SET2 0xE0 +#define SET3 0xE4 +#define SET4 0xE8 +#define SET5 0xEC +#define SET6 0xF0 +#define SET7 0xF4 + +#define HCR 0x04 +#define HCR_MODE_MASK ~(0xD0) +#define HCR_SIR 0x60 +#define HCR_MIR_576 0x20 +#define HCR_MIR_1152 0x80 +#define HCR_FIR 0xA0 +#define HCR_EN_DMA 0x04 +#define HCR_EN_IRQ 0x08 +#define HCR_TX_WT 0x08 + +#define USR 0x05 /* IR status register */ +#define USR_RDR 0x01 /* Receive data ready */ +#define USR_TSRE 0x40 /* Transmitter empty? */ + +#define AUDR 0x07 +#define AUDR_SFEND 0x08 /* Set a frame end */ +#define AUDR_RXBSY 0x20 /* Rx busy */ +#define AUDR_UNDR 0x40 /* Transeiver underrun */ + +/* Set 2 */ +#define ABLL 0x00 /* Advanced baud rate divisor latch (low byte) */ +#define ABHL 0x01 /* Advanced baud rate divisor latch (high byte) */ + +#define ADCR1 0x02 +#define ADCR1_ADV_SL 0x01 +#define ADCR1_D_CHSW 0x08 /* the specs are wrong. its bit 3, not 4 */ +#define ADCR1_DMA_F 0x02 + +#define ADCR2 0x04 +#define ADCR2_TXFS32 0x01 +#define ADCR2_RXFS32 0x04 + +#define RXFDTH 0x07 + +/* Set 3 */ +#define AUID 0x00 + +/* Set 4 */ +#define TMRL 0x00 /* Timer value register (low byte) */ +#define TMRH 0x01 /* Timer value register (high byte) */ + +#define IR_MSL 0x02 /* Infrared mode select */ +#define IR_MSL_EN_TMR 0x01 /* Enable timer */ + +#define TFRLL 0x04 /* Transmitter frame length (low byte) */ +#define TFRLH 0x05 /* Transmitter frame length (high byte) */ +#define RFRLL 0x06 /* Receiver frame length (low byte) */ +#define RFRLH 0x07 /* Receiver frame length (high byte) */ + +/* Set 5 */ + +#define FS_FO 0x05 /* Frame status FIFO */ +#define FS_FO_FSFDR 0x80 /* Frame status FIFO data ready */ +#define FS_FO_LST_FR 0x40 /* Frame lost */ +#define FS_FO_MX_LEX 0x10 /* Max frame len exceeded */ +#define FS_FO_PHY_ERR 0x08 /* Physical layer error */ +#define FS_FO_CRC_ERR 0x04 +#define FS_FO_RX_OV 0x02 /* Receive overrun */ +#define FS_FO_FSF_OV 0x01 /* Frame status FIFO overrun */ +#define FS_FO_ERR_MSK 0x5f /* Error mask */ + +#define RFLFL 0x06 +#define RFLFH 0x07 + +/* Set 6 */ +#define IR_CFG2 0x00 +#define IR_CFG2_DIS_CRC 0x02 + +/* Set 7 */ +#define IRM_CR 0x07 /* Infrared module control register */ +#define IRM_CR_IRX_MSL 0x40 +#define IRM_CR_AF_MNT 0x80 /* Automatic format */ + +static inline void switch_bank( int iobase, int set) +{ + outb( set, iobase+SSR); +} + +#endif diff --git a/include/net/irda/wrapper.h b/include/net/irda/wrapper.h new file mode 100644 index 000000000..838713f31 --- /dev/null +++ b/include/net/irda/wrapper.h @@ -0,0 +1,57 @@ +/********************************************************************* + * + * Filename: wrapper.h + * Version: + * Description: IrDA Wrapper layer + * Status: Experimental. + * Author: Dag Brattli <dagb@cs.uit.no> + * Created at: Mon Aug 4 20:40:53 1997 + * Modified at: Thu Nov 19 13:17:56 1998 + * Modified by: Dag Brattli <dagb@cs.uit.no> + * + * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * Neither Dag Brattli nor University of Tromsų admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + ********************************************************************/ + +#ifndef WRAPPER_H +#define WRAPPER_H + +#include <linux/types.h> +#include <linux/skbuff.h> + +#include "irda_device.h" + +#define BOF 0xc0 /* Beginning of frame */ +#define XBOF 0xff +#define EOF 0xc1 /* End of frame */ +#define CE 0x7d /* Control escape */ + +#define STA BOF /* Start flag */ +#define STO EOF /* End flag */ + +#define IR_TRANS 0x20 /* Asynchronous transparency modifier */ + +#define SOP BOF /* Start of */ +#define EOP EOF /* End of */ + +enum { + OUTSIDE_FRAME = 1, + BEGIN_FRAME, + LINK_ESCAPE, + INSIDE_FRAME +}; + +/* Proto definitions */ +int async_wrap_skb( struct sk_buff *skb, __u8 *tx_buff, int buffsize); +void async_unwrap_char( struct irda_device *, __u8 byte); + +#endif diff --git a/include/net/sock.h b/include/net/sock.h index a9cc39260..c03168f4b 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -128,6 +128,11 @@ struct ipx_opt { unsigned char node[IPX_NODE_LEN]; #endif unsigned short type; +/* + * To handle special ncp connection-handling sockets for mars_nwe, + * the connection number must be stored in the socket. + */ + unsigned short ipx_ncp_conn; }; #endif @@ -273,6 +278,7 @@ struct tcp_opt { char saw_tstamp; /* Saw TIMESTAMP on last packet */ __u8 snd_wscale; /* Window scaling received from sender */ __u8 rcv_wscale; /* Window scaling to send to receiver */ + __u8 rexmt_done; /* Retransmitted up to send head? */ __u32 rcv_tsval; /* Time stamp value */ __u32 rcv_tsecr; /* Time stamp echo reply */ __u32 ts_recent; /* Time stamp to echo next */ @@ -905,7 +911,7 @@ extern void net_timer (unsigned long); * Enable debug/info messages */ -#if 0 +#if 1 #define NETDEBUG(x) do { } while (0) #else #define NETDEBUG(x) do { x; } while (0) diff --git a/include/net/tcp.h b/include/net/tcp.h index 2ebee4e0d..5da07ba9d 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -813,8 +813,9 @@ static __inline__ int tcp_snd_test(struct sock *sk, struct sk_buff *skb) /* This tells the input processing path that an ACK should go out * right now. */ -#define tcp_enter_quickack_mode(__tp) ((__tp)->ato = (HZ/100)) -#define tcp_in_quickack_mode(__tp) ((__tp)->ato == (HZ/100)) +#define tcp_enter_quickack_mode(__tp) ((__tp)->ato |= (1<<31)) +#define tcp_exit_quickack_mode(__tp) ((__tp)->ato &= ~(1<<31)) +#define tcp_in_quickack_mode(__tp) (((__tp)->ato & (1 << 31)) != 0) /* * List all states of a TCP socket that can be viewed as a "connected" diff --git a/include/video/fbcon.h b/include/video/fbcon.h index 4145f56e3..4fe4eb7eb 100644 --- a/include/video/fbcon.h +++ b/include/video/fbcon.h @@ -100,6 +100,7 @@ extern struct display_switch fbcon_dummy; #define __SCROLL_YFIXED 0x010 #define __SCROLL_YNOMOVE 0x020 #define __SCROLL_YPANREDRAW 0x040 +#define __SCROLL_YNOPARTIAL 0x080 /* Only these should be used by the drivers */ /* Which one should you use? If you have a fast card and slow bus, @@ -117,6 +118,15 @@ extern struct display_switch fbcon_dummy; #define SCROLL_YREDRAW (__SCROLL_YFIXED|__SCROLL_YREDRAW) #define SCROLL_YNOMOVE (__SCROLL_YNOMOVE|__SCROLL_YPANREDRAW) +/* SCROLL_YNOPARTIAL, used in combination with the above, is for video + cards which can not handle using panning to scroll a portion of the + screen without excessive flicker. Panning will only be used for + whole screens. + */ +/* Namespace consistency */ +#define SCROLL_YNOPARTIAL __SCROLL_YNOPARTIAL + + extern void fbcon_redraw_bmove(struct display *, int, int, int, int, int, int); @@ -431,6 +441,7 @@ static __inline__ void *mymemset(void *s, size_t count) static __inline__ void fast_memmove(void *d, const void *s, size_t count) { + int d0, d1, d2, d3; if (d < s) { __asm__ __volatile__ ( "cld\n\t" @@ -442,9 +453,9 @@ __asm__ __volatile__ ( "movsw\n" "2:\trep\n\t" "movsl" - : /* no output */ - :"c"(count),"D"((long)d),"S"((long)s) - :"cx","di","si","memory"); + : "=&c" (d0), "=&D" (d1), "=&S" (d2) + :"0"(count),"1"((long)d),"2"((long)s) + :"memory"); } else { __asm__ __volatile__ ( "std\n\t" @@ -465,9 +476,9 @@ __asm__ __volatile__ ( "2:\trep\n\t" "movsl\n\t" "cld" - : /* no output */ - :"c"(count),"D"(count-4+(long)d),"S"(count-4+(long)s) - :"ax","cx","di","si","memory"); + : "=&c" (d0), "=&D" (d1), "=&S" (d2), "=&a" (d3) + :"0"(count),"1"(count-4+(long)d),"2"(count-4+(long)s) + :"memory"); } } diff --git a/include/video/font.h b/include/video/font.h index bdb7fc4bf..01d3c87d4 100644 --- a/include/video/font.h +++ b/include/video/font.h @@ -11,19 +11,6 @@ #ifndef _VIDEO_FONT_H #define _VIDEO_FONT_H -#ifdef __ASSEMBLY__ - -#ifdef __mc68000__ -#define FBCON_FONT_DESC_idx 0 -#define FBCON_FONT_DESC_name (FBCON_FONT_DESC_idx +4) -#define FBCON_FONT_DESC_width (FBCON_FONT_DESC_name +4) -#define FBCON_FONT_DESC_height (FBCON_FONT_DESC_width +4) -#define FBCON_FONT_DESC_data (FBCON_FONT_DESC_height+4) -#define FBCON_FONT_DESC_pref (FBCON_FONT_DESC_data +4) -#endif - -#else /* __ASSEMBLY__ */ - #include <linux/types.h> struct fbcon_font_desc { @@ -61,6 +48,4 @@ extern struct fbcon_font_desc *fbcon_get_default_font(int xres, int yres); /* Max. length for the name of a predefined font */ #define MAX_FONT_NAME 32 -#endif /* __ASSEMBLY__ */ - #endif /* _VIDEO_FONT_H */ |