From c9c06167e7933d93a6e396174c68abf242294abb Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 10 Jan 2001 05:27:25 +0000 Subject: Merge with Linux 2.4.0-test12. --- include/asm-alpha/bitops.h | 153 ++--- include/asm-alpha/byteorder.h | 38 ++ include/asm-alpha/fpu.h | 33 +- include/asm-alpha/pgtable.h | 19 +- include/asm-arm/arch-arc/memory.h | 6 + include/asm-arm/arch-arc/processor.h | 31 - include/asm-arm/arch-cl7500/memory.h | 6 + include/asm-arm/arch-cl7500/processor.h | 27 - include/asm-arm/arch-ebsa285/hardware.h | 7 +- include/asm-arm/arch-ebsa285/memory.h | 6 + include/asm-arm/arch-ebsa285/processor.h | 30 - include/asm-arm/arch-l7200/hardware.h | 3 - include/asm-arm/arch-l7200/memory.h | 6 + include/asm-arm/arch-l7200/processor.h | 27 - include/asm-arm/arch-nexuspci/memory.h | 6 + include/asm-arm/arch-nexuspci/processor.h | 27 - include/asm-arm/arch-rpc/memory.h | 6 + include/asm-arm/arch-rpc/processor.h | 31 - include/asm-arm/arch-rpc/uncompress.h | 20 +- include/asm-arm/arch-shark/memory.h | 6 + include/asm-arm/arch-shark/processor.h | 28 - include/asm-arm/arch-tbox/memory.h | 6 + include/asm-arm/arch-tbox/processor.h | 24 - include/asm-arm/bitops.h | 3 + include/asm-arm/hardware.h | 6 - include/asm-arm/pci.h | 5 +- include/asm-arm/proc-armo/processor.h | 2 +- include/asm-arm/proc-armv/processor.h | 6 +- include/asm-arm/proc-armv/ptrace.h | 6 + include/asm-arm/proc-armv/system.h | 71 ++- include/asm-arm/processor.h | 27 +- include/asm-arm/system.h | 11 +- include/asm-generic/bitops.h | 8 +- include/asm-generic/pgtable.h | 2 +- include/asm-i386/apic.h | 2 +- include/asm-i386/hardirq.h | 2 +- include/asm-i386/msr.h | 4 + include/asm-i386/mtrr.h | 18 + include/asm-i386/page.h | 2 - include/asm-i386/pgtable.h | 2 +- include/asm-i386/processor.h | 3 +- include/asm-i386/spinlock.h | 2 +- include/asm-ia64/hardirq.h | 2 +- include/asm-m68k/amigahw.h | 24 +- include/asm-m68k/amigaints.h | 6 +- include/asm-m68k/amipcmcia.h | 6 +- include/asm-m68k/atari_stram.h | 10 +- include/asm-m68k/atarihw.h | 2 +- include/asm-m68k/bitops.h | 6 + include/asm-m68k/entry.h | 14 +- include/asm-m68k/fcntl.h | 12 + include/asm-m68k/keyboard.h | 30 +- include/asm-m68k/machdep.h | 1 + include/asm-m68k/mman.h | 6 + include/asm-m68k/motorola_pgalloc.h | 260 +++++++++ include/asm-m68k/motorola_pgtable.h | 266 +++++++++ include/asm-m68k/page.h | 2 +- include/asm-m68k/param.h | 4 + include/asm-m68k/parport.h | 23 + include/asm-m68k/pgalloc.h | 263 +-------- include/asm-m68k/pgtable.h | 318 ++--------- include/asm-m68k/processor.h | 3 +- include/asm-m68k/q40_keyboard.h | 2 - include/asm-m68k/q40_master.h | 41 +- include/asm-m68k/q40ints.h | 2 +- include/asm-m68k/siginfo.h | 22 +- include/asm-m68k/softirq.h | 12 +- include/asm-m68k/spinlock.h | 2 +- include/asm-m68k/stat.h | 12 +- include/asm-m68k/sun3_pgalloc.h | 274 +++++++++ include/asm-m68k/sun3_pgtable.h | 219 ++++++++ include/asm-m68k/system.h | 15 +- include/asm-m68k/types.h | 4 + include/asm-m68k/unistd.h | 5 +- include/asm-parisc/a.out.h | 29 + include/asm-parisc/asmregs.h | 183 ++++++ include/asm-parisc/assembly.h | 374 +++++++++++++ include/asm-parisc/atomic.h | 103 ++++ include/asm-parisc/bitops.h | 247 ++++++++ include/asm-parisc/bootdata.h | 16 + include/asm-parisc/bugs.h | 19 + include/asm-parisc/byteorder.h | 75 +++ include/asm-parisc/cache.h | 58 ++ include/asm-parisc/checksum.h | 174 ++++++ include/asm-parisc/current.h | 19 + include/asm-parisc/delay.h | 45 ++ include/asm-parisc/div64.h | 54 ++ include/asm-parisc/elf.h | 97 ++++ include/asm-parisc/errno.h | 147 +++++ include/asm-parisc/fcntl.h | 90 +++ include/asm-parisc/fixmap.h | 8 + include/asm-parisc/gsc.h | 79 +++ include/asm-parisc/hardirq.h | 87 +++ include/asm-parisc/hardware.h | 103 ++++ include/asm-parisc/hdreg.h | 6 + include/asm-parisc/hil.h | 26 + include/asm-parisc/hw_irq.h | 17 + include/asm-parisc/ide.h | 111 ++++ include/asm-parisc/io.h | 61 ++ include/asm-parisc/ioctl.h | 67 +++ include/asm-parisc/ioctls.h | 82 +++ include/asm-parisc/iosapic.h | 53 ++ include/asm-parisc/ipcbuf.h | 11 + include/asm-parisc/irq.h | 89 +++ include/asm-parisc/keyboard.h | 67 +++ include/asm-parisc/led.h | 33 ++ include/asm-parisc/linux_logo.h | 48 ++ include/asm-parisc/machdep.h | 16 + include/asm-parisc/mc146818rtc.h | 9 + include/asm-parisc/md.h | 13 + include/asm-parisc/mman.h | 52 ++ include/asm-parisc/mmu.h | 64 +++ include/asm-parisc/mmu_context.h | 67 +++ include/asm-parisc/msgbuf.h | 31 + include/asm-parisc/namei.h | 17 + include/asm-parisc/page.h | 86 +++ include/asm-parisc/param.h | 24 + include/asm-parisc/parport.h | 18 + include/asm-parisc/parport_gsc.h | 193 +++++++ include/asm-parisc/pci.h | 215 +++++++ include/asm-parisc/pdc.h | 629 +++++++++++++++++++++ include/asm-parisc/pdcpat.h | 247 ++++++++ include/asm-parisc/pgalloc.h | 404 ++++++++++++++ include/asm-parisc/pgtable.h | 337 +++++++++++ include/asm-parisc/poll.h | 25 + include/asm-parisc/posix_types.h | 140 +++++ include/asm-parisc/processor.h | 341 +++++++++++ include/asm-parisc/psw.h | 54 ++ include/asm-parisc/ptrace.h | 56 ++ include/asm-parisc/real.h | 5 + include/asm-parisc/resource.h | 47 ++ include/asm-parisc/runway.h | 9 + include/asm-parisc/scatterlist.h | 20 + include/asm-parisc/segment.h | 6 + include/asm-parisc/semaphore-helper.h | 89 +++ include/asm-parisc/semaphore.h | 301 ++++++++++ include/asm-parisc/sembuf.h | 25 + include/asm-parisc/serial.h | 47 ++ include/asm-parisc/setup.h | 10 + include/asm-parisc/shmbuf.h | 50 ++ include/asm-parisc/shmparam.h | 6 + include/asm-parisc/sigcontext.h | 20 + include/asm-parisc/siginfo.h | 234 ++++++++ include/asm-parisc/signal.h | 163 ++++++ include/asm-parisc/smp.h | 10 + include/asm-parisc/smplock.h | 49 ++ include/asm-parisc/socket.h | 59 ++ include/asm-parisc/sockios.h | 12 + include/asm-parisc/softirq.h | 15 + include/asm-parisc/som.h | 8 + include/asm-parisc/spinlock.h | 95 ++++ include/asm-parisc/stat.h | 71 +++ include/asm-parisc/statfs.h | 25 + include/asm-parisc/string.h | 2 + include/asm-parisc/system.h | 148 +++++ include/asm-parisc/termbits.h | 174 ++++++ include/asm-parisc/termios.h | 103 ++++ include/asm-parisc/timex.h | 21 + include/asm-parisc/traps.h | 4 + include/asm-parisc/types.h | 54 ++ include/asm-parisc/uaccess.h | 189 +++++++ include/asm-parisc/ucontext.h | 12 + include/asm-parisc/unaligned.h | 20 + include/asm-parisc/unistd.h | 901 ++++++++++++++++++++++++++++++ include/asm-parisc/user.h | 5 + include/asm-sh/page.h | 2 - include/asm-sparc/atops.h | 24 - include/asm-sparc/hdreg.h | 4 +- include/asm-sparc/processor.h | 3 +- include/asm-sparc64/pgalloc.h | 11 +- include/asm-sparc64/processor.h | 3 +- include/linux/agpgart.h | 2 +- include/linux/apm_bios.h | 20 +- include/linux/atmdev.h | 2 +- include/linux/bfs_fs.h | 2 +- include/linux/bfs_fs_i.h | 2 +- include/linux/bfs_fs_sb.h | 2 +- include/linux/compatmac.h | 1 - include/linux/ext2_fs.h | 3 +- include/linux/fs.h | 45 +- include/linux/hdlcdrv.h | 2 +- include/linux/highmem.h | 4 - include/linux/highuid.h | 28 +- include/linux/icmp.h | 5 - include/linux/ioport.h | 7 + include/linux/isdn.h | 4 +- include/linux/isdnif.h | 4 +- include/linux/iso_fs.h | 2 - include/linux/kernel.h | 17 + include/linux/kernelcapi.h | 2 +- include/linux/mm.h | 10 +- include/linux/module.h | 4 +- include/linux/mtd/cfi.h | 3 +- include/linux/mtd/doc2000.h | 34 +- include/linux/mtd/map.h | 19 +- include/linux/mtd/mtd.h | 50 +- include/linux/mtd/nand.h | 169 +++++- include/linux/mtd/nand_ids.h | 52 ++ include/linux/mtd/nftl.h | 44 +- include/linux/mtd/partitions.h | 50 ++ include/linux/mtd/pmc551.h | 52 +- include/linux/netdevice.h | 26 +- include/linux/nfs_fs.h | 18 +- include/linux/nfs_fs_i.h | 7 + include/linux/nfs_page.h | 3 +- include/linux/nfs_xdr.h | 40 +- include/linux/pci.h | 7 +- include/linux/pci_ids.h | 201 ++++++- include/linux/raid/md_k.h | 5 +- include/linux/raid/raid0.h | 2 +- include/linux/raid/raid1.h | 1 - include/linux/sched.h | 64 ++- include/linux/signal.h | 4 +- include/linux/skbuff.h | 6 +- include/linux/smb_fs.h | 4 +- include/linux/smb_fs_sb.h | 5 +- include/linux/spinlock.h | 4 +- include/linux/stallion.h | 2 +- include/linux/sunrpc/sched.h | 2 +- include/linux/sunrpc/xprt.h | 15 +- include/linux/swap.h | 2 - include/linux/tqueue.h | 65 +-- include/linux/tty.h | 1 - include/linux/usb.h | 6 +- include/linux/wanrouter.h | 2 +- include/net/checksum.h | 23 +- include/net/icmp.h | 5 + include/net/ipx.h | 2 + include/net/sock.h | 6 +- include/net/tcp.h | 49 +- include/video/fbcon.h | 28 +- 231 files changed, 11189 insertions(+), 1425 deletions(-) delete mode 100644 include/asm-arm/arch-arc/processor.h delete mode 100644 include/asm-arm/arch-cl7500/processor.h delete mode 100644 include/asm-arm/arch-ebsa285/processor.h delete mode 100644 include/asm-arm/arch-l7200/processor.h delete mode 100644 include/asm-arm/arch-nexuspci/processor.h delete mode 100644 include/asm-arm/arch-rpc/processor.h delete mode 100644 include/asm-arm/arch-shark/processor.h delete mode 100644 include/asm-arm/arch-tbox/processor.h create mode 100644 include/asm-m68k/motorola_pgalloc.h create mode 100644 include/asm-m68k/motorola_pgtable.h create mode 100644 include/asm-m68k/parport.h create mode 100644 include/asm-m68k/sun3_pgalloc.h create mode 100644 include/asm-m68k/sun3_pgtable.h create mode 100644 include/asm-parisc/a.out.h create mode 100644 include/asm-parisc/asmregs.h create mode 100644 include/asm-parisc/assembly.h create mode 100644 include/asm-parisc/atomic.h create mode 100644 include/asm-parisc/bitops.h create mode 100644 include/asm-parisc/bootdata.h create mode 100644 include/asm-parisc/bugs.h create mode 100644 include/asm-parisc/byteorder.h create mode 100644 include/asm-parisc/cache.h create mode 100644 include/asm-parisc/checksum.h create mode 100644 include/asm-parisc/current.h create mode 100644 include/asm-parisc/delay.h create mode 100644 include/asm-parisc/div64.h create mode 100644 include/asm-parisc/elf.h create mode 100644 include/asm-parisc/errno.h create mode 100644 include/asm-parisc/fcntl.h create mode 100644 include/asm-parisc/fixmap.h create mode 100644 include/asm-parisc/gsc.h create mode 100644 include/asm-parisc/hardirq.h create mode 100644 include/asm-parisc/hardware.h create mode 100644 include/asm-parisc/hdreg.h create mode 100644 include/asm-parisc/hil.h create mode 100644 include/asm-parisc/hw_irq.h create mode 100644 include/asm-parisc/ide.h create mode 100644 include/asm-parisc/io.h create mode 100644 include/asm-parisc/ioctl.h create mode 100644 include/asm-parisc/ioctls.h create mode 100644 include/asm-parisc/iosapic.h create mode 100644 include/asm-parisc/ipcbuf.h create mode 100644 include/asm-parisc/irq.h create mode 100644 include/asm-parisc/keyboard.h create mode 100644 include/asm-parisc/led.h create mode 100644 include/asm-parisc/linux_logo.h create mode 100644 include/asm-parisc/machdep.h create mode 100644 include/asm-parisc/mc146818rtc.h create mode 100644 include/asm-parisc/md.h create mode 100644 include/asm-parisc/mman.h create mode 100644 include/asm-parisc/mmu.h create mode 100644 include/asm-parisc/mmu_context.h create mode 100644 include/asm-parisc/msgbuf.h create mode 100644 include/asm-parisc/namei.h create mode 100644 include/asm-parisc/page.h create mode 100644 include/asm-parisc/param.h create mode 100644 include/asm-parisc/parport.h create mode 100644 include/asm-parisc/parport_gsc.h create mode 100644 include/asm-parisc/pci.h create mode 100644 include/asm-parisc/pdc.h create mode 100644 include/asm-parisc/pdcpat.h create mode 100644 include/asm-parisc/pgalloc.h create mode 100644 include/asm-parisc/pgtable.h create mode 100644 include/asm-parisc/poll.h create mode 100644 include/asm-parisc/posix_types.h create mode 100644 include/asm-parisc/processor.h create mode 100644 include/asm-parisc/psw.h create mode 100644 include/asm-parisc/ptrace.h create mode 100644 include/asm-parisc/real.h create mode 100644 include/asm-parisc/resource.h create mode 100644 include/asm-parisc/runway.h create mode 100644 include/asm-parisc/scatterlist.h create mode 100644 include/asm-parisc/segment.h create mode 100644 include/asm-parisc/semaphore-helper.h create mode 100644 include/asm-parisc/semaphore.h create mode 100644 include/asm-parisc/sembuf.h create mode 100644 include/asm-parisc/serial.h create mode 100644 include/asm-parisc/setup.h create mode 100644 include/asm-parisc/shmbuf.h create mode 100644 include/asm-parisc/shmparam.h create mode 100644 include/asm-parisc/sigcontext.h create mode 100644 include/asm-parisc/siginfo.h create mode 100644 include/asm-parisc/signal.h create mode 100644 include/asm-parisc/smp.h create mode 100644 include/asm-parisc/smplock.h create mode 100644 include/asm-parisc/socket.h create mode 100644 include/asm-parisc/sockios.h create mode 100644 include/asm-parisc/softirq.h create mode 100644 include/asm-parisc/som.h create mode 100644 include/asm-parisc/spinlock.h create mode 100644 include/asm-parisc/stat.h create mode 100644 include/asm-parisc/statfs.h create mode 100644 include/asm-parisc/string.h create mode 100644 include/asm-parisc/system.h create mode 100644 include/asm-parisc/termbits.h create mode 100644 include/asm-parisc/termios.h create mode 100644 include/asm-parisc/timex.h create mode 100644 include/asm-parisc/traps.h create mode 100644 include/asm-parisc/types.h create mode 100644 include/asm-parisc/uaccess.h create mode 100644 include/asm-parisc/ucontext.h create mode 100644 include/asm-parisc/unaligned.h create mode 100644 include/asm-parisc/unistd.h create mode 100644 include/asm-parisc/user.h delete mode 100644 include/asm-sparc/atops.h create mode 100644 include/linux/mtd/nand_ids.h create mode 100644 include/linux/mtd/partitions.h (limited to 'include') diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h index 649abd02d..78e0f58c3 100644 --- a/include/asm-alpha/bitops.h +++ b/include/asm-alpha/bitops.h @@ -20,31 +20,12 @@ * bit 0 is the LSB of addr; bit 64 is the LSB of (addr+1). */ -#define BITOPS_NO_BRANCH - -extern __inline__ void set_bit(unsigned long nr, volatile void * addr) +extern __inline__ void +set_bit(unsigned long nr, volatile void * addr) { -#ifndef BITOPS_NO_BRANCH - unsigned long oldbit; -#endif unsigned long temp; - unsigned int * m = ((unsigned int *) addr) + (nr >> 5); + int *m = ((int *) addr) + (nr >> 5); -#ifndef BITOPS_NO_BRANCH - __asm__ __volatile__( - "1: ldl_l %0,%4\n" - " and %0,%3,%2\n" - " bne %2,2f\n" - " xor %0,%3,%0\n" - " stl_c %0,%1\n" - " beq %0,3f\n" - "2:\n" - ".subsection 2\n" - "3: br 1b\n" - ".previous" - :"=&r" (temp), "=m" (*m), "=&r" (oldbit) - :"Ir" (1UL << (nr & 31)), "m" (*m)); -#else __asm__ __volatile__( "1: ldl_l %0,%3\n" " bis %0,%2,%0\n" @@ -55,58 +36,28 @@ extern __inline__ void set_bit(unsigned long nr, volatile void * addr) ".previous" :"=&r" (temp), "=m" (*m) :"Ir" (1UL << (nr & 31)), "m" (*m)); -#endif } /* * WARNING: non atomic version. */ -extern __inline__ void __set_bit(unsigned long nr, volatile void * addr) +extern __inline__ void +__set_bit(unsigned long nr, volatile void * addr) { - unsigned int * m = ((unsigned int *) addr) + (nr >> 5); - /* - * Asm and C produces the same thing so let - * the compiler to do its good work. - */ -#if 0 - int tmp; + int *m = ((int *) addr) + (nr >> 5); - __asm__ __volatile__( - "ldl %0,%3\n\t" - "bis %0,%2,%0\n\t" - "stl %0,%1" - : "=&r" (tmp), "=m" (*m) - : "Ir" (1UL << (nr & 31)), "m" (*m)); -#else *m |= 1UL << (nr & 31); -#endif } #define smp_mb__before_clear_bit() smp_mb() #define smp_mb__after_clear_bit() smp_mb() -extern __inline__ void clear_bit(unsigned long nr, volatile void * addr) + +extern __inline__ void +clear_bit(unsigned long nr, volatile void * addr) { -#ifndef BITOPS_NO_BRANCH - unsigned long oldbit; -#endif unsigned long temp; - unsigned int * m = ((unsigned int *) addr) + (nr >> 5); + int *m = ((int *) addr) + (nr >> 5); -#ifndef BITOPS_NO_BRANCH - __asm__ __volatile__( - "1: ldl_l %0,%4\n" - " and %0,%3,%2\n" - " beq %2,2f\n" - " xor %0,%3,%0\n" - " stl_c %0,%1\n" - " beq %0,3f\n" - "2:\n" - ".subsection 2\n" - "3: br 1b\n" - ".previous" - :"=&r" (temp), "=m" (*m), "=&r" (oldbit) - :"Ir" (1UL << (nr & 31)), "m" (*m)); -#else __asm__ __volatile__( "1: ldl_l %0,%3\n" " and %0,%2,%0\n" @@ -117,13 +68,13 @@ extern __inline__ void clear_bit(unsigned long nr, volatile void * addr) ".previous" :"=&r" (temp), "=m" (*m) :"Ir" (~(1UL << (nr & 31))), "m" (*m)); -#endif } -extern __inline__ void change_bit(unsigned long nr, volatile void * addr) +extern __inline__ void +change_bit(unsigned long nr, volatile void * addr) { unsigned long temp; - unsigned int * m = ((unsigned int *) addr) + (nr >> 5); + int *m = ((int *) addr) + (nr >> 5); __asm__ __volatile__( "1: ldl_l %0,%3\n" @@ -137,12 +88,12 @@ extern __inline__ void change_bit(unsigned long nr, volatile void * addr) :"Ir" (1UL << (nr & 31)), "m" (*m)); } -extern __inline__ int test_and_set_bit(unsigned long nr, - volatile void * addr) +extern __inline__ int +test_and_set_bit(unsigned long nr, volatile void *addr) { unsigned long oldbit; unsigned long temp; - unsigned int * m = ((unsigned int *) addr) + (nr >> 5); + int *m = ((int *) addr) + (nr >> 5); __asm__ __volatile__( "1: ldl_l %0,%4\n" @@ -151,10 +102,10 @@ extern __inline__ int test_and_set_bit(unsigned long nr, " xor %0,%3,%0\n" " stl_c %0,%1\n" " beq %0,3f\n" + "2:\n" #ifdef CONFIG_SMP " mb\n" #endif - "2:\n" ".subsection 2\n" "3: br 1b\n" ".previous" @@ -167,32 +118,23 @@ extern __inline__ int test_and_set_bit(unsigned long nr, /* * WARNING: non atomic version. */ -extern __inline__ int __test_and_set_bit(unsigned long nr, - volatile void * addr) +extern __inline__ int +__test_and_set_bit(unsigned long nr, volatile void * addr) { - unsigned long oldbit; - unsigned long temp; - unsigned int * m = ((unsigned int *) addr) + (nr >> 5); - - __asm__ __volatile__( - " ldl %0,%4\n" - " and %0,%3,%2\n" - " bne %2,1f\n" - " xor %0,%3,%0\n" - " stl %0,%1\n" - "1:\n" - :"=&r" (temp), "=m" (*m), "=&r" (oldbit) - :"Ir" (1UL << (nr & 31)), "m" (*m)); + unsigned long mask = 1 << (nr & 0x1f); + int *m = ((int *) addr) + (nr >> 5); + int old = *m; - return oldbit != 0; + *m = old | mask; + return (old & mask) != 0; } -extern __inline__ int test_and_clear_bit(unsigned long nr, - volatile void * addr) +extern __inline__ int +test_and_clear_bit(unsigned long nr, volatile void * addr) { unsigned long oldbit; unsigned long temp; - unsigned int * m = ((unsigned int *) addr) + (nr >> 5); + int *m = ((int *) addr) + (nr >> 5); __asm__ __volatile__( "1: ldl_l %0,%4\n" @@ -201,10 +143,10 @@ extern __inline__ int test_and_clear_bit(unsigned long nr, " xor %0,%3,%0\n" " stl_c %0,%1\n" " beq %0,3f\n" + "2:\n" #ifdef CONFIG_SMP " mb\n" #endif - "2:\n" ".subsection 2\n" "3: br 1b\n" ".previous" @@ -217,32 +159,23 @@ extern __inline__ int test_and_clear_bit(unsigned long nr, /* * WARNING: non atomic version. */ -extern __inline__ int __test_and_clear_bit(unsigned long nr, - volatile void * addr) +extern __inline__ int +__test_and_clear_bit(unsigned long nr, volatile void * addr) { - unsigned long oldbit; - unsigned long temp; - unsigned int * m = ((unsigned int *) addr) + (nr >> 5); + unsigned long mask = 1 << (nr & 0x1f); + int *m = ((int *) addr) + (nr >> 5); + int old = *m; - __asm__ __volatile__( - " ldl %0,%4\n" - " and %0,%3,%2\n" - " beq %2,1f\n" - " xor %0,%3,%0\n" - " stl %0,%1\n" - "1:\n" - :"=&r" (temp), "=m" (*m), "=&r" (oldbit) - :"Ir" (1UL << (nr & 31)), "m" (*m)); - - return oldbit != 0; + *m = old & ~mask; + return (old & mask) != 0; } -extern __inline__ int test_and_change_bit(unsigned long nr, - volatile void * addr) +extern __inline__ int +test_and_change_bit(unsigned long nr, volatile void * addr) { unsigned long oldbit; unsigned long temp; - unsigned int * m = ((unsigned int *) addr) + (nr >> 5); + int *m = ((int *) addr) + (nr >> 5); __asm__ __volatile__( "1: ldl_l %0,%4\n" @@ -262,7 +195,8 @@ extern __inline__ int test_and_change_bit(unsigned long nr, return oldbit != 0; } -extern __inline__ int test_bit(int nr, volatile void * addr) +extern __inline__ int +test_bit(int nr, volatile void * addr) { return (1UL & (((const int *) addr)[nr >> 5] >> (nr & 31))) != 0UL; } @@ -289,7 +223,7 @@ extern inline unsigned long ffz_b(unsigned long x) extern inline unsigned long ffz(unsigned long word) { #if defined(__alpha_cix__) && defined(__alpha_fix__) - /* Whee. EV6 can calculate it directly. */ + /* Whee. EV67 can calculate it directly. */ unsigned long result; __asm__("cttz %1,%0" : "=r"(result) : "r"(~word)); return result; @@ -325,7 +259,7 @@ extern inline int ffs(int word) */ #if defined(__alpha_cix__) && defined(__alpha_fix__) -/* Whee. EV6 can calculate it directly. */ +/* Whee. EV67 can calculate it directly. */ extern __inline__ unsigned long hweight64(unsigned long w) { unsigned long result; @@ -347,7 +281,8 @@ extern __inline__ unsigned long hweight64(unsigned long w) /* * Find next zero bit in a bitmap reasonably efficiently.. */ -extern inline unsigned long find_next_zero_bit(void * addr, unsigned long size, unsigned long offset) +extern inline unsigned long +find_next_zero_bit(void * addr, unsigned long size, unsigned long offset) { unsigned long * p = ((unsigned long *) addr) + (offset >> 6); unsigned long result = offset & ~63UL; diff --git a/include/asm-alpha/byteorder.h b/include/asm-alpha/byteorder.h index edc376a04..91b55ea3e 100644 --- a/include/asm-alpha/byteorder.h +++ b/include/asm-alpha/byteorder.h @@ -3,6 +3,44 @@ #include +#ifdef __GNUC__ + +static __inline __u32 __attribute__((__const)) __arch__swab32(__u32 x) +{ + /* + * Unfortunately, we can't use the 6 instruction sequence + * on ev6 since the latency of the UNPKBW is 3, which is + * pretty hard to hide. Just in case a future implementation + * has a lower latency, here's the sequence (also by Mike Burrows) + * + * UNPKBW a0, v0 v0: 00AA00BB00CC00DD + * SLL v0, 24, a0 a0: BB00CC00DD000000 + * BIS v0, a0, a0 a0: BBAACCBBDDCC00DD + * EXTWL a0, 6, v0 v0: 000000000000BBAA + * ZAP a0, 0xf3, a0 a0: 00000000DDCC0000 + * ADDL a0, v0, v0 v0: ssssssssDDCCBBAA + */ + + __u64 t0, t1, t2, t3; + + __asm__("inslh %1, 7, %0" /* t0 : 0000000000AABBCC */ + : "=r"(t0) : "r"(x)); + __asm__("inswl %1, 3, %0" /* t1 : 000000CCDD000000 */ + : "=r"(t1) : "r"(x)); + + t1 |= t0; /* t1 : 000000CCDDAABBCC */ + t2 = t1 >> 16; /* t2 : 0000000000CCDDAA */ + t0 = t1 & 0xFF00FF00; /* t0 : 00000000DD00BB00 */ + t3 = t2 & 0x00FF00FF; /* t3 : 0000000000CC00AA */ + t1 = t0 + t3; /* t1 : ssssssssDDCCBBAA */ + + return t1; +} + +#define __arch__swab32 __arch__swab32 + +#endif /* __GNUC__ */ + #define __BYTEORDER_HAS_U64__ #include diff --git a/include/asm-alpha/fpu.h b/include/asm-alpha/fpu.h index b02a78594..acd1b9a03 100644 --- a/include/asm-alpha/fpu.h +++ b/include/asm-alpha/fpu.h @@ -131,17 +131,19 @@ rdfpcr(void) unsigned long tmp, ret; #if defined(__alpha_cix__) || defined(__alpha_fix__) - __asm__ ("ftoit $f0,%0\n\t" - "mf_fpcr $f0\n\t" - "ftoit $f0,%1\n\t" - "itoft %0,$f0" - : "=r"(tmp), "=r"(ret)); + __asm__ __volatile__ ( + "ftoit $f0,%0\n\t" + "mf_fpcr $f0\n\t" + "ftoit $f0,%1\n\t" + "itoft %0,$f0" + : "=r"(tmp), "=r"(ret)); #else - __asm__ ("stt $f0,%0\n\t" - "mf_fpcr $f0\n\t" - "stt $f0,%1\n\t" - "ldt $f0,%0" - : "=m"(tmp), "=m"(ret)); + __asm__ __volatile__ ( + "stt $f0,%0\n\t" + "mf_fpcr $f0\n\t" + "stt $f0,%1\n\t" + "ldt $f0,%0" + : "=m"(tmp), "=m"(ret)); #endif return ret; @@ -153,11 +155,12 @@ wrfpcr(unsigned long val) unsigned long tmp; #if defined(__alpha_cix__) || defined(__alpha_fix__) - __asm__ __volatile__ ("ftoit $f0,%0\n\t" - "itoft %1,$f0\n\t" - "mt_fpcr $f0\n\t" - "itoft %0,$f0" - : "=&r"(tmp) : "r"(val)); + __asm__ __volatile__ ( + "ftoit $f0,%0\n\t" + "itoft %1,$f0\n\t" + "mt_fpcr $f0\n\t" + "itoft %0,$f0" + : "=&r"(tmp) : "r"(val)); #else __asm__ __volatile__ ( "stt $f0,%0\n\t" diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h index 54341fff1..b3f6e8141 100644 --- a/include/asm-alpha/pgtable.h +++ b/include/asm-alpha/pgtable.h @@ -59,6 +59,11 @@ #define _PAGE_FOW 0x0004 /* used for page protection (fault on write) */ #define _PAGE_FOE 0x0008 /* used for page protection (fault on exec) */ #define _PAGE_ASM 0x0010 +#if defined(CONFIG_ALPHA_EV6) && !defined(CONFIG_SMP) +#define _PAGE_MBE 0x0080 /* MB disable bit for EV6. */ +#else +#define _PAGE_MBE 0x0000 +#endif #define _PAGE_KRE 0x0100 /* xxx - see below on the "accessed" bit */ #define _PAGE_URE 0x0200 /* xxx */ #define _PAGE_KWE 0x1000 /* used to do the dirty bit in software */ @@ -85,19 +90,20 @@ #define _PFN_MASK 0xFFFFFFFF00000000 #define _PAGE_TABLE (_PAGE_VALID | __DIRTY_BITS | __ACCESS_BITS) -#define _PAGE_CHG_MASK (_PFN_MASK | __DIRTY_BITS | __ACCESS_BITS) +#define _PAGE_CHG_MASK (_PFN_MASK | __DIRTY_BITS | __ACCESS_BITS | _PAGE_MBE) /* - * All the normal masks have the "page accessed" bits on, as any time they are used, - * the page is accessed. They are cleared only by the page-out routines + * All the normal masks have the "page accessed" bits on, as any time they + * are used, the page is accessed. They are cleared only by the page-out + * routines. */ #define PAGE_NONE __pgprot(_PAGE_VALID | __ACCESS_BITS | _PAGE_FOR | _PAGE_FOW | _PAGE_FOE) #define PAGE_SHARED __pgprot(_PAGE_VALID | __ACCESS_BITS) #define PAGE_COPY __pgprot(_PAGE_VALID | __ACCESS_BITS | _PAGE_FOW) #define PAGE_READONLY __pgprot(_PAGE_VALID | __ACCESS_BITS | _PAGE_FOW) -#define PAGE_KERNEL __pgprot(_PAGE_VALID | _PAGE_ASM | _PAGE_KRE | _PAGE_KWE) +#define PAGE_KERNEL __pgprot(_PAGE_VALID | _PAGE_ASM | _PAGE_KRE | _PAGE_KWE | _PAGE_MBE) -#define _PAGE_NORMAL(x) __pgprot(_PAGE_VALID | __ACCESS_BITS | (x)) +#define _PAGE_NORMAL(x) __pgprot(_PAGE_VALID | __ACCESS_BITS | _PAGE_MBE | (x)) #define _PAGE_P(x) _PAGE_NORMAL((x) | (((x) & _PAGE_FOW)?0:_PAGE_FOW)) #define _PAGE_S(x) _PAGE_NORMAL(x) @@ -189,6 +195,7 @@ extern unsigned long __zero_page(void); * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ + #define mk_pte(page, pgprot) \ ({ \ pte_t pte; \ @@ -199,7 +206,7 @@ extern unsigned long __zero_page(void); }) extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) -{ pte_t pte; pte_val(pte) = (PHYS_TWIDDLE(physpage) << (32-PAGE_SHIFT)) | pgprot_val(pgprot); return pte; } +{ pte_t pte; pte_val(pte) = (PHYS_TWIDDLE(physpage) << (32-PAGE_SHIFT)) | (pgprot_val(pgprot) & ~_PAGE_MBE); return 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; } diff --git a/include/asm-arm/arch-arc/memory.h b/include/asm-arm/arch-arc/memory.h index fb4d819f4..3c21224b5 100644 --- a/include/asm-arm/arch-arc/memory.h +++ b/include/asm-arm/arch-arc/memory.h @@ -21,6 +21,12 @@ #define TASK_SIZE (0x01a00000UL) #define TASK_SIZE_26 (0x01a00000UL) +/* + * This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + /* * Page offset: 32MB */ diff --git a/include/asm-arm/arch-arc/processor.h b/include/asm-arm/arch-arc/processor.h deleted file mode 100644 index 7eea170e3..000000000 --- a/include/asm-arm/arch-arc/processor.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * linux/include/asm-arm/arch-arc/processor.h - * - * Copyright (c) 1996-1999 Russell King. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Changelog: - * 10-Sep-1996 RMK Created - * 21-Mar-1999 RMK Added asm/arch/memory.h - */ - -#ifndef __ASM_ARCH_PROCESSOR_H -#define __ASM_ARCH_PROCESSOR_H - -/* - * Bus types - */ -#define EISA_bus 0 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ -#define MCA_bus 0 -#define MCA_bus__is_a_macro /* for versions in ksyms.c */ - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) - -#endif diff --git a/include/asm-arm/arch-cl7500/memory.h b/include/asm-arm/arch-cl7500/memory.h index a1811df0c..56e1d3bfc 100644 --- a/include/asm-arm/arch-cl7500/memory.h +++ b/include/asm-arm/arch-cl7500/memory.h @@ -20,6 +20,12 @@ #define TASK_SIZE (0xc0000000UL) #define TASK_SIZE_26 (0x04000000UL) +/* + * This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + /* * Page offset: 3GB */ diff --git a/include/asm-arm/arch-cl7500/processor.h b/include/asm-arm/arch-cl7500/processor.h deleted file mode 100644 index 3f75f16bc..000000000 --- a/include/asm-arm/arch-cl7500/processor.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * linux/include/asm-arm/arch-cl7500/processor.h - * - * Copyright (c) 1996-1999 Russell King. - * - * Changelog: - * 10-Sep-1996 RMK Created - * 21-Mar-1999 RMK Added asm/arch/memory.h - */ - -#ifndef __ASM_ARCH_PROCESSOR_H -#define __ASM_ARCH_PROCESSOR_H - -/* - * Bus types - */ -#define EISA_bus 0 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ -#define MCA_bus 0 -#define MCA_bus__is_a_macro /* for versions in ksyms.c */ - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) - -#endif diff --git a/include/asm-arm/arch-ebsa285/hardware.h b/include/asm-arm/arch-ebsa285/hardware.h index 44747379c..21157a5c3 100644 --- a/include/asm-arm/arch-ebsa285/hardware.h +++ b/include/asm-arm/arch-ebsa285/hardware.h @@ -94,8 +94,6 @@ #define XBUS_SWITCH_J17_11 ((*XBUS_SWITCH) & (1 << 5)) #define XBUS_SWITCH_J17_9 ((*XBUS_SWITCH) & (1 << 6)) -#define PARAMS_OFFSET 0x0100 - #define FLUSH_BASE_PHYS 0x50000000 #define UNCACHEABLE_ADDR (ARMCSR_BASE + 0x108) @@ -133,4 +131,9 @@ extern int gpio_read(void); extern void cpld_modify(int mask, int set); #endif +#define pcibios_assign_all_busses() 1 + +#define PCIBIOS_MIN_IO 0x6000 +#define PCIBIOS_MIN_MEM 0x40000000 + #endif diff --git a/include/asm-arm/arch-ebsa285/memory.h b/include/asm-arm/arch-ebsa285/memory.h index 98172671f..41e730cea 100644 --- a/include/asm-arm/arch-ebsa285/memory.h +++ b/include/asm-arm/arch-ebsa285/memory.h @@ -66,6 +66,12 @@ extern unsigned long __bus_to_virt(unsigned long); #define TASK_SIZE_26 (0x04000000UL) #define PHYS_OFFSET (0x00000000UL) +/* + * This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + /* * The DRAM is always contiguous. */ diff --git a/include/asm-arm/arch-ebsa285/processor.h b/include/asm-arm/arch-ebsa285/processor.h deleted file mode 100644 index 1c0561018..000000000 --- a/include/asm-arm/arch-ebsa285/processor.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa110/processor.h - * - * Copyright (C) 1996-1999 Russell King - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Changelog: - * 21-Mar-1999 RMK Added asm/arch/memory.h - */ - -#ifndef __ASM_ARCH_PROCESSOR_H -#define __ASM_ARCH_PROCESSOR_H - -/* - * Bus types - */ -#define EISA_bus 0 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ -#define MCA_bus 0 -#define MCA_bus__is_a_macro /* for versions in ksyms.c */ - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) - -#endif diff --git a/include/asm-arm/arch-l7200/hardware.h b/include/asm-arm/arch-l7200/hardware.h index a9209af7b..506192bc8 100644 --- a/include/asm-arm/arch-l7200/hardware.h +++ b/include/asm-arm/arch-l7200/hardware.h @@ -41,9 +41,6 @@ #define FLUSH_BASE_PHYS 0x40000000 /* ROM */ #define FLUSH_BASE 0xdf000000 -#define PARAMS_OFFSET (0x0100) -#define Z_PARAMS_BASE (RAM_START + PARAMS_OFFSET) - #define PCIO_BASE IO_BASE #endif diff --git a/include/asm-arm/arch-l7200/memory.h b/include/asm-arm/arch-l7200/memory.h index d07a1ddc1..a34a0f9a4 100644 --- a/include/asm-arm/arch-l7200/memory.h +++ b/include/asm-arm/arch-l7200/memory.h @@ -18,6 +18,12 @@ #define TASK_SIZE (0xc0000000UL) #define TASK_SIZE_26 (0x04000000UL) +/* + * This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + /* * Page offset: 3GB */ diff --git a/include/asm-arm/arch-l7200/processor.h b/include/asm-arm/arch-l7200/processor.h deleted file mode 100644 index ee4b4b2ca..000000000 --- a/include/asm-arm/arch-l7200/processor.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * linux/include/asm-arm/arch-l7200/processor.h - * - * Copyright (c) 2000 Steven Hill (sjhill@cotw.com) - * - * Changelog: - * 03-21-2000 SJH Created - * 05-03-2000 SJH Comment cleaning - */ - -#ifndef __ASM_ARCH_PROCESSOR_H -#define __ASM_ARCH_PROCESSOR_H - -/* - * Bus types - */ -#define EISA_bus 0 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ -#define MCA_bus 0 -#define MCA_bus__is_a_macro /* for versions in ksyms.c */ - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) - -#endif diff --git a/include/asm-arm/arch-nexuspci/memory.h b/include/asm-arm/arch-nexuspci/memory.h index de0429b6b..a7e644257 100644 --- a/include/asm-arm/arch-nexuspci/memory.h +++ b/include/asm-arm/arch-nexuspci/memory.h @@ -14,6 +14,12 @@ #define TASK_SIZE (0xc0000000UL) #define TASK_SIZE_26 (0x04000000UL) +/* + * This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + /* * Page offset: 3GB */ diff --git a/include/asm-arm/arch-nexuspci/processor.h b/include/asm-arm/arch-nexuspci/processor.h deleted file mode 100644 index 542dd9106..000000000 --- a/include/asm-arm/arch-nexuspci/processor.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * linux/include/asm-arm/arch-nexuspci/processor.h - * from linux/include/asm-arm/arch-ebsa110/processor.h - * - * Copyright (C) 1996-1999 Russell King - * - * Changelog: - * 21-Mar-1999 RMK Added asm/arch/memory.h - */ - -#ifndef __ASM_ARCH_PROCESSOR_H -#define __ASM_ARCH_PROCESSOR_H - -/* - * Bus types - */ -#define EISA_bus 0 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ -#define MCA_bus 0 -#define MCA_bus__is_a_macro /* for versions in ksyms.c */ - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) - -#endif diff --git a/include/asm-arm/arch-rpc/memory.h b/include/asm-arm/arch-rpc/memory.h index 2b3899173..cf562f87f 100644 --- a/include/asm-arm/arch-rpc/memory.h +++ b/include/asm-arm/arch-rpc/memory.h @@ -24,6 +24,12 @@ #define TASK_SIZE (0xc0000000UL) #define TASK_SIZE_26 (0x04000000UL) +/* + * This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + /* * Page offset: 3GB */ diff --git a/include/asm-arm/arch-rpc/processor.h b/include/asm-arm/arch-rpc/processor.h deleted file mode 100644 index b64eaebfc..000000000 --- a/include/asm-arm/arch-rpc/processor.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * linux/include/asm-arm/arch-rpc/processor.h - * - * Copyright (C) 1996-1999 Russell King. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Changelog: - * 10-Sep-1996 RMK Created - * 21-Mar-1999 RMK Added asm/arch/memory.h - */ - -#ifndef __ASM_ARCH_PROCESSOR_H -#define __ASM_ARCH_PROCESSOR_H - -/* - * Bus types - */ -#define EISA_bus 0 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ -#define MCA_bus 0 -#define MCA_bus__is_a_macro /* for versions in ksyms.c */ - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) - -#endif diff --git a/include/asm-arm/arch-rpc/uncompress.h b/include/asm-arm/arch-rpc/uncompress.h index 0834d287e..dde1bfc7a 100644 --- a/include/asm-arm/arch-rpc/uncompress.h +++ b/include/asm-arm/arch-rpc/uncompress.h @@ -56,7 +56,7 @@ static const unsigned long palette_4[16] = { #define palette_setpixel(p) *(unsigned long *)(IO_START+0x00400000) = 0x10000000|((p) & 255) #define palette_write(v) *(unsigned long *)(IO_START+0x00400000) = 0x00000000|((v) & 0x00ffffff) -static struct param_struct * const params = (struct param_struct *)Z_PARAMS_BASE; +extern struct param_struct params; #ifndef STANDALONE_DEBUG /* @@ -69,8 +69,8 @@ static void puts(const char *s) unsigned char c; char *ptr; - x = params->video_x; - y = params->video_y; + x = params.video_x; + y = params.video_y; while ( ( c = *(unsigned char *)s++ ) != '\0' ) { if ( c == '\n' ) { @@ -79,7 +79,7 @@ static void puts(const char *s) y--; } } else { - ptr = VIDMEM + ((y*video_num_columns*params->bytes_per_char_v+x)*bytes_per_char_h); + ptr = VIDMEM + ((y*video_num_columns*params.bytes_per_char_v+x)*bytes_per_char_h); ll_write_char(ptr, c|(white<<16)); if ( ++x >= video_num_columns ) { x = 0; @@ -90,8 +90,8 @@ static void puts(const char *s) } } - params->video_x = x; - params->video_y = y; + params.video_x = x; + params.video_y = y; } static void error(char *x); @@ -103,9 +103,9 @@ static void arch_decomp_setup(void) { int i; - video_num_lines = params->video_num_rows; - video_num_columns = params->video_num_cols; - bytes_per_char_h = params->bytes_per_char_h; + video_num_lines = params.video_num_rows; + video_num_columns = params.video_num_cols; + bytes_per_char_h = params.bytes_per_char_h; video_size_row = video_num_columns * bytes_per_char_h; if (bytes_per_char_h == 4) for (i = 0; i < 256; i++) @@ -140,7 +140,7 @@ static void arch_decomp_setup(void) white = 7; } - if (params->nr_pages * params->page_size < 4096*1024) error("<4M of mem\n"); + if (params.nr_pages * params.page_size < 4096*1024) error("<4M of mem\n"); } #endif diff --git a/include/asm-arm/arch-shark/memory.h b/include/asm-arm/arch-shark/memory.h index d3ede01ec..96b24052a 100644 --- a/include/asm-arm/arch-shark/memory.h +++ b/include/asm-arm/arch-shark/memory.h @@ -16,6 +16,12 @@ #define TASK_SIZE (0xc0000000UL) #define TASK_SIZE_26 (0x04000000UL) +/* + * This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + /* * Page offset: = 3GB */ diff --git a/include/asm-arm/arch-shark/processor.h b/include/asm-arm/arch-shark/processor.h deleted file mode 100644 index bd99869af..000000000 --- a/include/asm-arm/arch-shark/processor.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * linux/include/asm-arm/arch-ebsa110/processor.h - * - * Copyright (C) 1996-1999 Russell King - * - * Changelog: - * 21-Mar-1999 RMK Added asm/arch/memory.h - */ - -#ifndef __ASM_ARCH_PROCESSOR_H -#define __ASM_ARCH_PROCESSOR_H - -#include - -/* - * Bus types - */ -#define EISA_bus 0 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ -#define MCA_bus 0 -#define MCA_bus__is_a_macro /* for versions in ksyms.c */ - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) - -#endif diff --git a/include/asm-arm/arch-tbox/memory.h b/include/asm-arm/arch-tbox/memory.h index e066821f2..e93d0afb1 100644 --- a/include/asm-arm/arch-tbox/memory.h +++ b/include/asm-arm/arch-tbox/memory.h @@ -13,6 +13,12 @@ #define TASK_SIZE (0xc0000000UL) #define TASK_SIZE_26 (0x04000000UL) +/* + * This decides where the kernel will search for a free chunk of vm + * space during mmap's. + */ +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + /* * Page offset: 3GB */ diff --git a/include/asm-arm/arch-tbox/processor.h b/include/asm-arm/arch-tbox/processor.h deleted file mode 100644 index 0f8e7129b..000000000 --- a/include/asm-arm/arch-tbox/processor.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * linux/include/asm-arm/arch-tbox/processor.h - * from linux/include/asm-arm/arch-ebsa110/processor.h - * - * Copyright (C) 1996,1997,1998 Russell King - */ - -#ifndef __ASM_ARCH_PROCESSOR_H -#define __ASM_ARCH_PROCESSOR_H - -/* - * Bus types - */ -#define EISA_bus 0 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ -#define MCA_bus 0 -#define MCA_bus__is_a_macro /* for versions in ksyms.c */ - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) - -#endif diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h index 9773f6749..9bfe93269 100644 --- a/include/asm-arm/bitops.h +++ b/include/asm-arm/bitops.h @@ -17,6 +17,9 @@ #ifdef __KERNEL__ +#define smp_mb__before_clear_bit() do { } while (0) +#define smp_mb__after_clear_bit() do { } while (0) + /* * Function prototypes to keep gcc -Wall happy. */ diff --git a/include/asm-arm/hardware.h b/include/asm-arm/hardware.h index 4ded5b8f0..1fd1a5b65 100644 --- a/include/asm-arm/hardware.h +++ b/include/asm-arm/hardware.h @@ -15,10 +15,4 @@ #include -#ifdef PARAMS_OFFSET -#define PARAMS_BASE ((PAGE_OFFSET) + (PARAMS_OFFSET)) -#else -#define PARAMS_BASE 0 -#endif - #endif diff --git a/include/asm-arm/pci.h b/include/asm-arm/pci.h index 63c1ee9cf..c32ddbc3c 100644 --- a/include/asm-arm/pci.h +++ b/include/asm-arm/pci.h @@ -3,10 +3,7 @@ #ifdef __KERNEL__ -#define pcibios_assign_all_busses() 0 - -#define PCIBIOS_MIN_IO 0x8000 -#define PCIBIOS_MIN_MEM 0x40000000 +#include extern inline void pcibios_set_master(struct pci_dev *dev) { diff --git a/include/asm-arm/proc-armo/processor.h b/include/asm-arm/proc-armo/processor.h index 581236378..43cbb221e 100644 --- a/include/asm-arm/proc-armo/processor.h +++ b/include/asm-arm/proc-armo/processor.h @@ -57,7 +57,7 @@ extern uaccess_t uaccess_user, uaccess_kernel; uaccess_t *uaccess; /* User access functions*/ #define EXTRA_THREAD_STRUCT_INIT \ - ,&uaccess_kernel + uaccess: &uaccess_kernel, #define start_thread(regs,pc,sp) \ ({ \ diff --git a/include/asm-arm/proc-armv/processor.h b/include/asm-arm/proc-armv/processor.h index ab7f31d65..775ebfc55 100644 --- a/include/asm-arm/proc-armv/processor.h +++ b/include/asm-arm/proc-armv/processor.h @@ -41,9 +41,9 @@ struct context_save_struct { unsigned int domain; #define EXTRA_THREAD_STRUCT_INIT \ - , domain_val(DOMAIN_USER, DOMAIN_CLIENT) | \ - domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ - domain_val(DOMAIN_IO, DOMAIN_CLIENT) + domain: domain_val(DOMAIN_USER, DOMAIN_CLIENT) | \ + domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ + domain_val(DOMAIN_IO, DOMAIN_CLIENT) #define start_thread(regs,pc,sp) \ ({ \ diff --git a/include/asm-arm/proc-armv/ptrace.h b/include/asm-arm/proc-armv/ptrace.h index d15d5a6ec..190caa193 100644 --- a/include/asm-arm/proc-armv/ptrace.h +++ b/include/asm-arm/proc-armv/ptrace.h @@ -10,6 +10,8 @@ #ifndef __ASM_PROC_PTRACE_H #define __ASM_PROC_PTRACE_H +#include + #define USR26_MODE 0x00 #define FIQ26_MODE 0x01 #define IRQ26_MODE 0x02 @@ -64,8 +66,12 @@ struct pt_regs { #define user_mode(regs) \ (((regs)->ARM_cpsr & 0xf) == 0) +#ifdef CONFIG_ARM_THUMB #define thumb_mode(regs) \ (((regs)->ARM_cpsr & T_BIT)) +#else +#define thumb_mode(regs) (0) +#endif #define processor_mode(regs) \ ((regs)->ARM_cpsr & MODE_MASK) diff --git a/include/asm-arm/proc-armv/system.h b/include/asm-arm/proc-armv/system.h index 247ed3e2b..becb31c2d 100644 --- a/include/asm-arm/proc-armv/system.h +++ b/include/asm-arm/proc-armv/system.h @@ -10,19 +10,7 @@ #ifndef __ASM_PROC_SYSTEM_H #define __ASM_PROC_SYSTEM_H -extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int size) -{ - extern void __bad_xchg(volatile void *, int); - - switch (size) { - case 1: __asm__ __volatile__ ("swpb %0, %1, [%2]" : "=r" (x) : "r" (x), "r" (ptr) : "memory"); - break; - case 4: __asm__ __volatile__ ("swp %0, %1, [%2]" : "=r" (x) : "r" (x), "r" (ptr) : "memory"); - break; - default: __bad_xchg(ptr, size); - } - return x; -} +#include #define set_cr(x) \ __asm__ __volatile__( \ @@ -131,4 +119,61 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */ : "r" (x) \ : "memory") +#if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110) +/* + * On the StrongARM, "swp" is terminally broken since it bypasses the + * cache totally. This means that the cache becomes inconsistent, and, + * since we use normal loads/stores as well, this is really bad. + * Typically, this causes oopsen in filp_close, but could have other, + * more disasterous effects. There are two work-arounds: + * 1. Disable interrupts and emulate the atomic swap + * 2. Clean the cache, perform atomic swap, flush the cache + * + * We choose (1) since its the "easiest" to achieve here and is not + * dependent on the processor type. + */ +#define swp_is_buggy +#endif + +extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int size) +{ + extern void __bad_xchg(volatile void *, int); + unsigned long ret; +#ifdef swp_is_buggy + unsigned long flags; +#endif + + switch (size) { +#ifdef swp_is_buggy + case 1: + __save_flags_cli(flags); + ret = *(volatile unsigned char *)ptr; + *(volatile unsigned char *)ptr = x; + __restore_flags(flags); + break; + + case 4: + __save_flags_cli(flags); + ret = *(volatile unsigned long *)ptr; + *(volatile unsigned long *)ptr = x; + __restore_flags(flags); + break; +#else + case 1: __asm__ __volatile__ ("swpb %0, %1, [%2]" + : "=r" (ret) + : "r" (x), "r" (ptr) + : "memory"); + break; + case 4: __asm__ __volatile__ ("swp %0, %1, [%2]" + : "=r" (ret) + : "r" (x), "r" (ptr) + : "memory"); + break; +#endif + default: __bad_xchg(ptr, size); + } + + return ret; +} + #endif diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h index cf21f2c1b..f84c5d2d3 100644 --- a/include/asm-arm/processor.h +++ b/include/asm-arm/processor.h @@ -36,12 +36,12 @@ typedef unsigned long mm_segment_t; /* domain register */ #ifdef __KERNEL__ -#define NR_DEBUGS 5 +#define EISA_bus 0 +#define MCA_bus 0 #include #include #include -#include #include struct debug_info { @@ -67,18 +67,16 @@ struct thread_struct { EXTRA_THREAD_STRUCT }; -#define INIT_MMAP \ -{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } - -#define INIT_THREAD { \ - ATOMIC_INIT(1), \ - 0, \ - 0, \ - 0, \ - { { { 0, }, }, }, \ - { 0, }, \ - (struct context_save_struct *)0 \ - EXTRA_THREAD_STRUCT_INIT \ +#define INIT_MMAP { \ + vm_mm: &init_mm, \ + vm_page_prot: PAGE_SHARED, \ + vm_flags: VM_READ | VM_WRITE | VM_EXEC, \ + vm_avl_height: 1, \ +} + +#define INIT_THREAD { \ + refcount: ATOMIC_INIT(1), \ + EXTRA_THREAD_STRUCT_INIT \ } /* @@ -104,7 +102,6 @@ extern __inline__ void init_thread_css(struct context_save_struct *save) /* Forward declaration, a strange C thing */ struct task_struct; -struct mm_struct; /* Free all resources held by a thread. */ extern void release_thread(struct task_struct *); diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index a1142be1a..f19eaed13 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h @@ -4,7 +4,7 @@ #ifdef __KERNEL__ #include -#include +#include /* information about the system we're running on */ extern unsigned int system_rev; @@ -64,8 +64,17 @@ extern struct task_struct *__switch_to(struct task_struct *prev, struct task_str #ifdef CONFIG_SMP #error SMP not supported + +#define smp_mb() mb() +#define smp_rmb() rmb() +#define smp_wmb() wmb() + #else +#define smp_mb() barrier() +#define smp_rmb() barrier() +#define smp_wmb() barrier() + #define cli() __cli() #define sti() __sti() #define clf() __clf() diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h index 0ae108653..1428fd95b 100644 --- a/include/asm-generic/bitops.h +++ b/include/asm-generic/bitops.h @@ -9,14 +9,14 @@ * disable interrupts while they operate. (You have to provide inline * routines to cli() and sti().) * - * Also note, these routines assume that you have 32 bit integers. + * Also note, these routines assume that you have 32 bit longs. * You will have to change this if you are trying to port Linux to the * Alpha architecture or to a Cray. :-) * * C language equivalents written by Theodore Ts'o, 9/26/92 */ -extern __inline__ int set_bit(int nr,int * addr) +extern __inline__ int set_bit(int nr,long * addr) { int mask, retval; @@ -29,7 +29,7 @@ extern __inline__ int set_bit(int nr,int * addr) return retval; } -extern __inline__ int clear_bit(int nr, int * addr) +extern __inline__ int clear_bit(int nr, long * addr) { int mask, retval; @@ -42,7 +42,7 @@ extern __inline__ int clear_bit(int nr, int * addr) return retval; } -extern __inline__ int test_bit(int nr, int * addr) +extern __inline__ int test_bit(int nr, long * addr) { int mask; diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index a65546820..b98102522 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -26,7 +26,7 @@ static inline pte_t ptep_get_and_clear(pte_t *ptep) return pte; } -static inline void ptep_clear_wrprotect(pte_t *ptep) +static inline void ptep_set_wrprotect(pte_t *ptep) { pte_t old_pte = *ptep; set_pte(ptep, pte_wrprotect(old_pte)); diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h index 733ec4cc0..abb627a41 100644 --- a/include/asm-i386/apic.h +++ b/include/asm-i386/apic.h @@ -10,7 +10,7 @@ #ifdef CONFIG_X86_LOCAL_APIC #if APIC_DEBUG -#define Dprintk(x...) printk(##x) +#define Dprintk(x...) printk(x) #else #define Dprintk(x...) #endif diff --git a/include/asm-i386/hardirq.h b/include/asm-i386/hardirq.h index 3860288ad..9ccc2821c 100644 --- a/include/asm-i386/hardirq.h +++ b/include/asm-i386/hardirq.h @@ -42,7 +42,7 @@ typedef struct { #include extern unsigned char global_irq_holder; -extern unsigned volatile int global_irq_lock; +extern unsigned volatile long global_irq_lock; /* long for set_bit -RR */ static inline int irqs_running (void) { diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h index 515a8dc5c..72bf155e9 100644 --- a/include/asm-i386/msr.h +++ b/include/asm-i386/msr.h @@ -30,3 +30,7 @@ : "=a" (low), "=d" (high) \ : "c" (counter)) +/* symbolic names for some interesting MSRs */ +#define MSR_IA32_PLATFORM_ID 0x17 +#define MSR_IA32_UCODE_WRITE 0x79 +#define MSR_IA32_UCODE_REV 0x8B diff --git a/include/asm-i386/mtrr.h b/include/asm-i386/mtrr.h index cc28a42c7..488208e70 100644 --- a/include/asm-i386/mtrr.h +++ b/include/asm-i386/mtrr.h @@ -49,6 +49,11 @@ struct mtrr_gentry #define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry) #define MTRRIOC_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry) #define MTRRIOC_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry) +#define MTRRIOC_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry) +#define MTRRIOC_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry) +#define MTRRIOC_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry) +#define MTRRIOC_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry) +#define MTRRIOC_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry) /* These are the region types */ #define MTRR_TYPE_UNCACHABLE 0 @@ -79,18 +84,31 @@ static char *mtrr_strings[MTRR_NUM_TYPES] = # ifdef CONFIG_MTRR extern int mtrr_add (unsigned long base, unsigned long size, unsigned int type, char increment); +extern int mtrr_add_page (unsigned long base, unsigned long size, + unsigned int type, char increment); extern int mtrr_del (int reg, unsigned long base, unsigned long size); +extern int mtrr_del_page (int reg, unsigned long base, unsigned long size); # else static __inline__ int mtrr_add (unsigned long base, unsigned long size, unsigned int type, char increment) { return -ENODEV; } +static __inline__ int mtrr_add_page (unsigned long base, unsigned long size, + unsigned int type, char increment) +{ + return -ENODEV; +} static __inline__ int mtrr_del (int reg, unsigned long base, unsigned long size) { return -ENODEV; } +static __inline__ int mtrr_del_page (int reg, unsigned long base, + unsigned long size) +{ + return -ENODEV; +} # endif /* The following functions are for initialisation: don't use them! */ diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h index 8272b8f29..8bf9bd75c 100644 --- a/include/asm-i386/page.h +++ b/include/asm-i386/page.h @@ -82,8 +82,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; #ifndef __ASSEMBLY__ -extern int console_loglevel; - /* * Tell the user there is some problem. Beep too, so we can * see^H^H^Hhear bugs in early bootup as well! diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 1fc0a0b9a..5d7d5717a 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -283,7 +283,7 @@ static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return p static inline int ptep_test_and_clear_dirty(pte_t *ptep) { return test_and_clear_bit(_PAGE_BIT_DIRTY, ptep); } static inline int ptep_test_and_clear_young(pte_t *ptep) { return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); } -static inline void ptep_clear_wrprotect(pte_t *ptep) { clear_bit(_PAGE_BIT_RW, ptep); } +static inline void ptep_set_wrprotect(pte_t *ptep) { clear_bit(_PAGE_BIT_RW, ptep); } static inline void ptep_mkdirty(pte_t *ptep) { set_bit(_PAGE_BIT_RW, ptep); } /* diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 9e8e8c5ef..a03dd0027 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -464,7 +464,8 @@ struct microcode { unsigned int bits[500]; }; -#define MICROCODE_IOCFREE _IO('6',0) /* because it is for P6 */ +/* '6' because it used to be for P6 only (but now covers Pentium 4 as well) */ +#define MICROCODE_IOCFREE _IO('6',0) /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ extern inline void rep_nop(void) diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h index 4a92bb2a2..2d6eb04bf 100644 --- a/include/asm-i386/spinlock.h +++ b/include/asm-i386/spinlock.h @@ -141,7 +141,7 @@ typedef struct { * Changed to use the same technique as rw semaphores. See * semaphore.h for details. -ben */ -/* the spinlock helpers are in arch/i386/kernel/semaphore.S */ +/* the spinlock helpers are in arch/i386/kernel/semaphore.c */ static inline void read_lock(rwlock_t *rw) { diff --git a/include/asm-ia64/hardirq.h b/include/asm-ia64/hardirq.h index 7c1a4d109..1dabc1bdf 100644 --- a/include/asm-ia64/hardirq.h +++ b/include/asm-ia64/hardirq.h @@ -49,7 +49,7 @@ typedef struct { #include extern unsigned int global_irq_holder; -extern volatile unsigned int global_irq_lock; +extern volatile unsigned long global_irq_lock; static inline int irqs_running (void) { diff --git a/include/asm-m68k/amigahw.h b/include/asm-m68k/amigahw.h index d63ceca32..3e5a2770c 100644 --- a/include/asm-m68k/amigahw.h +++ b/include/asm-m68k/amigahw.h @@ -16,6 +16,8 @@ #ifndef _M68K_AMIGAHW_H #define _M68K_AMIGAHW_H +#include + /* * Different Amiga models */ @@ -279,11 +281,27 @@ struct CIA { #define ciab ((*(volatile struct CIA *)(zTwoBase + CIAB_PHYSADDR))) #define CHIP_PHYSADDR (0x000000) -#define chipaddr ((unsigned long)(zTwoBase + CHIP_PHYSADDR)) + void amiga_chip_init (void); -void *amiga_chip_alloc (long size, const char *name); -void amiga_chip_free (void *); +void *amiga_chip_alloc(unsigned long size, const char *name); +void *amiga_chip_alloc_res(unsigned long size, struct resource *res); +void amiga_chip_free(void *ptr); unsigned long amiga_chip_avail( void ); /*MILAN*/ +extern volatile unsigned short amiga_audio_min_period; + +static inline void amifb_video_off(void) +{ + if (amiga_chipset == CS_ECS || amiga_chipset == CS_AGA) { + /* program Denise/Lisa for a higher maximum play rate */ + custom.htotal = 113; /* 31 kHz */ + custom.vtotal = 223; /* 70 Hz */ + custom.beamcon0 = 0x4390; /* HARDDIS, VAR{BEAM,VSY,HSY,CSY}EN */ + /* suspend the monitor */ + custom.hsstrt = custom.hsstop = 116; + custom.vsstrt = custom.vsstop = 226; + amiga_audio_min_period = 57; + } +} struct tod3000 { unsigned int :28, second2:4; /* lower digit */ diff --git a/include/asm-m68k/amigaints.h b/include/asm-m68k/amigaints.h index 35bc3e18e..2aff4cfbf 100644 --- a/include/asm-m68k/amigaints.h +++ b/include/asm-m68k/amigaints.h @@ -106,12 +106,8 @@ #define IF_DSKBLK 0x0002 /* diskblock DMA finished */ #define IF_TBE 0x0001 /* serial transmit buffer empty interrupt */ -struct irq_server { - unsigned short count, reentrance; -}; - extern void amiga_do_irq(int irq, struct pt_regs *fp); -extern void amiga_do_irq_list(int irq, struct pt_regs *fp, struct irq_server *server); +extern void amiga_do_irq_list(int irq, struct pt_regs *fp); extern unsigned short amiga_intena_vals[]; diff --git a/include/asm-m68k/amipcmcia.h b/include/asm-m68k/amipcmcia.h index 78ffce6aa..6f1ec1887 100644 --- a/include/asm-m68k/amipcmcia.h +++ b/include/asm-m68k/amipcmcia.h @@ -36,17 +36,17 @@ static inline u_char pcmcia_get_intreq(void) static inline void pcmcia_ack_int(u_char intreq) { - gayle.intreq = ((intreq & 0x2c) ^ 0x2c) | 0xc0; + gayle.intreq = 0xf8; } static inline void pcmcia_enable_irq(void) { - gayle.inten = GAYLE_IRQ_IDE|GAYLE_IRQ_IRQ; + gayle.inten |= GAYLE_IRQ_IRQ; } static inline void pcmcia_disable_irq(void) { - gayle.inten = GAYLE_IRQ_IDE; + gayle.inten &= ~GAYLE_IRQ_IRQ; } #define PCMCIA_INSERTED (gayle.cardstatus & GAYLE_CS_CCDET) diff --git a/include/asm-m68k/atari_stram.h b/include/asm-m68k/atari_stram.h index 31d620b67..7546d1396 100644 --- a/include/asm-m68k/atari_stram.h +++ b/include/asm-m68k/atari_stram.h @@ -6,12 +6,12 @@ */ /* public interface */ -void *atari_stram_alloc( long size, unsigned long *start_mem, - const char *owner ); -void atari_stram_free( void *); +void *atari_stram_alloc(long size, const char *owner); +void atari_stram_free(void *); /* functions called internally by other parts of the kernel */ -void atari_stram_init( void); -void atari_stram_reserve_pages( unsigned long start_mem ); +void atari_stram_init(void); +void atari_stram_reserve_pages(void *start_mem); +void atari_stram_mem_init_hook (void); #endif /*_M68K_ATARI_STRAM_H */ diff --git a/include/asm-m68k/atarihw.h b/include/asm-m68k/atarihw.h index 8937fc2d1..e27147ae8 100644 --- a/include/asm-m68k/atarihw.h +++ b/include/asm-m68k/atarihw.h @@ -123,7 +123,7 @@ extern struct atari_hw_present atari_hw_present; */ #include -#include +#include static inline void dma_cache_maintenance( unsigned long paddr, unsigned long len, diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h index ff1c8b9fa..7d91887d7 100644 --- a/include/asm-m68k/bitops.h +++ b/include/asm-m68k/bitops.h @@ -83,6 +83,12 @@ extern __inline__ int __generic_test_and_clear_bit(int nr, void * vaddr) return retval; } +/* + * clear_bit() doesn't provide any barrier for the compiler. + */ +#define smp_mb__before_clear_bit() barrier() +#define smp_mb__after_clear_bit() barrier() + #define clear_bit(nr,vaddr) \ (__builtin_constant_p(nr) ? \ __constant_clear_bit(nr, vaddr) : \ diff --git a/include/asm-m68k/entry.h b/include/asm-m68k/entry.h index 444d5ba35..d5eae1ee1 100644 --- a/include/asm-m68k/entry.h +++ b/include/asm-m68k/entry.h @@ -49,13 +49,13 @@ LFLUSH_I_AND_D = 0x00000808 LSIGTRAP = 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 +/* process bits for task_struct.ptrace */ +PT_TRACESYS_OFF = 3 +PT_TRACESYS_BIT = 1 +PT_PTRACED_OFF = 3 +PT_PTRACED_BIT = 0 +PT_DTRACE_OFF = 3 +PT_DTRACE_BIT = 2 #define SAVE_ALL_INT save_all_int #define SAVE_ALL_SYS save_all_sys diff --git a/include/asm-m68k/fcntl.h b/include/asm-m68k/fcntl.h index 9738061b7..c0b273f68 100644 --- a/include/asm-m68k/fcntl.h +++ b/include/asm-m68k/fcntl.h @@ -35,6 +35,10 @@ #define F_SETSIG 10 /* for sockets. */ #define F_GETSIG 11 /* for sockets. */ +#define F_GETLK64 12 /* using 'struct flock64' */ +#define F_SETLK64 13 +#define F_SETLKW64 14 + /* for F_[GET|SET]FL */ #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ @@ -70,5 +74,13 @@ struct flock { pid_t l_pid; }; +struct flock64 { + short l_type; + short l_whence; + loff_t l_start; + loff_t l_len; + pid_t l_pid; +}; + #define F_LINUX_SPECIFIC_BASE 1024 #endif /* _M68K_FCNTL_H */ diff --git a/include/asm-m68k/keyboard.h b/include/asm-m68k/keyboard.h index 555ef68ec..4129be701 100644 --- a/include/asm-m68k/keyboard.h +++ b/include/asm-m68k/keyboard.h @@ -8,12 +8,12 @@ * This file contains the m68k architecture specific keyboard definitions */ -#include /* CONFIG_MAGIC_SYSRQ */ #ifndef __M68K_KEYBOARD_H #define __M68K_KEYBOARD_H #ifdef __KERNEL__ +#include #include #ifdef CONFIG_Q40 @@ -39,17 +39,6 @@ static __inline__ int kbd_getkeycode(unsigned int scancode) return scancode > 127 ? -EINVAL : scancode; } -static __inline__ int kbd_translate(unsigned char scancode, - unsigned char *keycode, char raw_mode) -{ -#ifdef CONFIG_Q40 - if (MACH_IS_Q40) - return q40kbd_translate(scancode,keycode,raw_mode); -#endif - *keycode = scancode; - return 1; -} - static __inline__ char kbd_unexpected_up(unsigned char keycode) { #ifdef CONFIG_Q40 @@ -65,15 +54,16 @@ static __inline__ void kbd_leds(unsigned char leds) mach_kbd_leds(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)) -#define kbd_sysrq_xlate mach_sysrq_xlate -#endif +#define kbd_init_hw mach_keyb_init +#define kbd_translate mach_kbd_translate + +#define kbd_sysrq_xlate mach_sysrq_xlate + +/* resource allocation */ +#define kbd_request_region() +#define kbd_request_irq(handler) -#define kbd_init_hw mach_keyb_init +extern unsigned int SYSRQ_KEY; #endif /* __KERNEL__ */ diff --git a/include/asm-m68k/machdep.h b/include/asm-m68k/machdep.h index 864f09ecd..269d90b9d 100644 --- a/include/asm-m68k/machdep.h +++ b/include/asm-m68k/machdep.h @@ -13,6 +13,7 @@ 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 int (*mach_kbd_translate)(unsigned char scancode, unsigned char *keycode, char raw_mode); /* 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/mman.h b/include/asm-m68k/mman.h index cbee6c998..8255e9d60 100644 --- a/include/asm-m68k/mman.h +++ b/include/asm-m68k/mman.h @@ -25,6 +25,12 @@ #define MCL_CURRENT 1 /* lock all current mappings */ #define MCL_FUTURE 2 /* lock all future mappings */ +#define MADV_NORMAL 0x0 /* default page-in behavior */ +#define MADV_RANDOM 0x1 /* page-in minimum required */ +#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ +#define MADV_WILLNEED 0x3 /* pre-fault pages */ +#define MADV_DONTNEED 0x4 /* discard these pages */ + /* compatibility flags */ #define MAP_ANON MAP_ANONYMOUS #define MAP_FILE 0 diff --git a/include/asm-m68k/motorola_pgalloc.h b/include/asm-m68k/motorola_pgalloc.h new file mode 100644 index 000000000..9257aeb43 --- /dev/null +++ b/include/asm-m68k/motorola_pgalloc.h @@ -0,0 +1,260 @@ +#ifndef _MOTOROLA_PGALLOC_H +#define _MOTOROLA_PGALLOC_H + +extern struct pgtable_cache_struct { + unsigned long *pmd_cache; + unsigned long *pte_cache; +/* This counts in units of pointer tables, of which can be eight per page. */ + unsigned long pgtable_cache_sz; +} quicklists; + +#define pgd_quicklist ((unsigned long *)0) +#define pmd_quicklist (quicklists.pmd_cache) +#define pte_quicklist (quicklists.pte_cache) +/* This isn't accurate because of fragmentation of allocated pages for + pointer tables, but that should not be a problem. */ +#define pgtable_cache_size ((quicklists.pgtable_cache_sz+7)/8) + +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long offset); +extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long offset); + +extern pmd_t *get_pointer_table(void); +extern int free_pointer_table(pmd_t *); + +extern inline pte_t *get_pte_fast(void) +{ + unsigned long *ret; + + ret = pte_quicklist; + if (ret) { + pte_quicklist = (unsigned long *)*ret; + ret[0] = 0; + quicklists.pgtable_cache_sz -= 8; + } + return (pte_t *)ret; +} + +extern inline void free_pte_fast(pte_t *pte) +{ + *(unsigned long *)pte = (unsigned long)pte_quicklist; + pte_quicklist = (unsigned long *)pte; + quicklists.pgtable_cache_sz += 8; +} + +extern inline void free_pte_slow(pte_t *pte) +{ + cache_page((unsigned long)pte); + free_page((unsigned long) pte); +} + +extern inline pmd_t *get_pmd_fast(void) +{ + unsigned long *ret; + + ret = pmd_quicklist; + if (ret) { + pmd_quicklist = (unsigned long *)*ret; + ret[0] = 0; + quicklists.pgtable_cache_sz--; + } + return (pmd_t *)ret; +} + +extern inline void free_pmd_fast(pmd_t *pmd) +{ + *(unsigned long *)pmd = (unsigned long)pmd_quicklist; + pmd_quicklist = (unsigned long *) pmd; + quicklists.pgtable_cache_sz++; +} + +extern inline int free_pmd_slow(pmd_t *pmd) +{ + return free_pointer_table(pmd); +} + +/* The pgd cache is folded into the pmd cache, so these are dummy routines. */ +extern inline pgd_t *get_pgd_fast(void) +{ + return (pgd_t *)0; +} + +extern inline void free_pgd_fast(pgd_t *pgd) +{ +} + +extern inline void free_pgd_slow(pgd_t *pgd) +{ +} + +extern void __bad_pte(pmd_t *pmd); +extern void __bad_pmd(pgd_t *pgd); + +extern inline void pte_free(pte_t *pte) +{ + free_pte_fast(pte); +} + +extern inline pte_t *pte_alloc(pmd_t *pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + if (pmd_none(*pmd)) { + pte_t *page = get_pte_fast(); + + if (!page) + return get_pte_slow(pmd, address); + pmd_set(pmd,page); + return page + address; + } + if (pmd_bad(*pmd)) { + __bad_pte(pmd); + return NULL; + } + return (pte_t *)__pmd_page(*pmd) + address; +} + +extern inline void pmd_free(pmd_t *pmd) +{ + free_pmd_fast(pmd); +} + +extern inline pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address) +{ + address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); + if (pgd_none(*pgd)) { + pmd_t *page = get_pmd_fast(); + + if (!page) + return get_pmd_slow(pgd, address); + pgd_set(pgd, page); + return page + address; + } + if (pgd_bad(*pgd)) { + __bad_pmd(pgd); + return NULL; + } + return (pmd_t *)__pgd_page(*pgd) + address; +} + +extern inline void pte_free_kernel(pte_t *pte) +{ + free_pte_fast(pte); +} + +extern inline pte_t *pte_alloc_kernel(pmd_t *pmd, unsigned long address) +{ + return pte_alloc(pmd, address); +} + +extern inline void pmd_free_kernel(pmd_t *pmd) +{ + free_pmd_fast(pmd); +} + +extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) +{ + return pmd_alloc(pgd, address); +} + +extern inline void pgd_free(pgd_t *pgd) +{ + free_pmd_fast((pmd_t *)pgd); +} + +extern inline pgd_t *pgd_alloc(void) +{ + pgd_t *pgd = (pgd_t *)get_pmd_fast(); + if (!pgd) + pgd = (pgd_t *)get_pointer_table(); + return pgd; +} + +extern int do_check_pgt_cache(int, int); + +extern inline void set_pgdir(unsigned long address, pgd_t entry) +{ +} + + +/* + * flush all user-space atc entries. + */ +static inline void __flush_tlb(void) +{ + if (CPU_IS_040_OR_060) + __asm__ __volatile__(".chip 68040\n\t" + "pflushan\n\t" + ".chip 68k"); + else + __asm__ __volatile__("pflush #0,#4"); +} + +static inline void __flush_tlb040_one(unsigned long addr) +{ + __asm__ __volatile__(".chip 68040\n\t" + "pflush (%0)\n\t" + ".chip 68k" + : : "a" (addr)); +} + +static inline void __flush_tlb_one(unsigned long addr) +{ + if (CPU_IS_040_OR_060) + __flush_tlb040_one(addr); + else + __asm__ __volatile__("pflush #0,#4,(%0)" : : "a" (addr)); +} + +#define flush_tlb() __flush_tlb() + +/* + * flush all atc entries (both kernel and user-space entries). + */ +static inline void flush_tlb_all(void) +{ + if (CPU_IS_040_OR_060) + __asm__ __volatile__(".chip 68040\n\t" + "pflusha\n\t" + ".chip 68k"); + else + __asm__ __volatile__("pflusha"); +} + +static inline void flush_tlb_mm(struct mm_struct *mm) +{ + if (mm == current->mm) + __flush_tlb(); +} + +static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr) +{ + if (vma->vm_mm == current->mm) + __flush_tlb_one(addr); +} + +static inline void flush_tlb_range(struct mm_struct *mm, + unsigned long start, unsigned long end) +{ + if (mm == current->mm) + __flush_tlb(); +} + +extern inline void flush_tlb_kernel_page(unsigned long addr) +{ + if (CPU_IS_040_OR_060) { + mm_segment_t old_fs = get_fs(); + set_fs(KERNEL_DS); + __asm__ __volatile__(".chip 68040\n\t" + "pflush (%0)\n\t" + ".chip 68k" + : : "a" (addr)); + set_fs(old_fs); + } else + __asm__ __volatile__("pflush #4,#4,(%0)" : : "a" (addr)); +} + +extern inline void flush_tlb_pgtables(struct mm_struct *mm, + unsigned long start, unsigned long end) +{ +} + +#endif /* _MOTOROLA_PGALLOC_H */ diff --git a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h new file mode 100644 index 000000000..7fea2e4ff --- /dev/null +++ b/include/asm-m68k/motorola_pgtable.h @@ -0,0 +1,266 @@ +#ifndef _MOTOROLA_PGTABLE_H +#define _MOTOROLA_PGTABLE_H + +#include + +/* + * Definitions for MMU descriptors + */ +#define _PAGE_PRESENT 0x001 +#define _PAGE_SHORT 0x002 +#define _PAGE_RONLY 0x004 +#define _PAGE_ACCESSED 0x008 +#define _PAGE_DIRTY 0x010 +#define _PAGE_SUPER 0x080 /* 68040 supervisor only */ +#define _PAGE_FAKE_SUPER 0x200 /* fake supervisor only on 680[23]0 */ +#define _PAGE_GLOBAL040 0x400 /* 68040 global bit, used for kva descs */ +#define _PAGE_COW 0x800 /* implemented in software */ +#define _PAGE_NOCACHE030 0x040 /* 68030 no-cache mode */ +#define _PAGE_NOCACHE 0x060 /* 68040 cache mode, non-serialized */ +#define _PAGE_NOCACHE_S 0x040 /* 68040 no-cache mode, serialized */ +#define _PAGE_CACHE040 0x020 /* 68040 cache mode, cachable, copyback */ +#define _PAGE_CACHE040W 0x000 /* 68040 cache mode, cachable, write-through */ + +#define _DESCTYPE_MASK 0x003 + +#define _CACHEMASK040 (~0x060) +#define _TABLE_MASK (0xfffffe00) + +#define _PAGE_TABLE (_PAGE_SHORT) +#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_NOCACHE) + +#ifndef __ASSEMBLY__ + +/* This is the cache mode to be used for pages containing page descriptors for + * processors >= '040. It is in pte_mknocache(), and the variable is defined + * and initialized in head.S */ +extern int m68k_pgtable_cachemode; + +/* This is the cache mode for normal pages, for supervisor access on + * processors >= '040. It is used in pte_mkcache(), and the variable is + * defined and initialized in head.S */ + +#if defined(CONFIG_060_WRITETHROUGH) +extern int m68k_supervisor_cachemode; +#else +#define m68k_supervisor_cachemode _PAGE_CACHE040 +#endif + +#if defined(CPU_M68040_OR_M68060_ONLY) +#define mm_cachebits _PAGE_CACHE040 +#elif defined(CPU_M68020_OR_M68030_ONLY) +#define mm_cachebits 0 +#else +extern unsigned long mm_cachebits; +#endif + +#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED | mm_cachebits) +#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | mm_cachebits) +#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED | mm_cachebits) +#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED | mm_cachebits) +#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | _PAGE_ACCESSED | mm_cachebits) + +/* Alternate definitions that are compile time constants, for + initializing protection_map. The cachebits are fixed later. */ +#define PAGE_NONE_C __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED) +#define PAGE_SHARED_C __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) +#define PAGE_COPY_C __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED) +#define PAGE_READONLY_C __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED) + +/* + * The m68k can't do page protection for execute, and considers that the same are read. + * Also, write permissions imply read permissions. This is the closest we can get.. + */ +#define __P000 PAGE_NONE_C +#define __P001 PAGE_READONLY_C +#define __P010 PAGE_COPY_C +#define __P011 PAGE_COPY_C +#define __P100 PAGE_READONLY_C +#define __P101 PAGE_READONLY_C +#define __P110 PAGE_COPY_C +#define __P111 PAGE_COPY_C + +#define __S000 PAGE_NONE_C +#define __S001 PAGE_READONLY_C +#define __S010 PAGE_SHARED_C +#define __S011 PAGE_SHARED_C +#define __S100 PAGE_READONLY_C +#define __S101 PAGE_READONLY_C +#define __S110 PAGE_SHARED_C +#define __S111 PAGE_SHARED_C + +/* + * Conversion functions: convert a page and protection to a page entry, + * and a page entry and page directory to the page they refer to. + */ +#define __mk_pte(page, pgprot) \ +({ \ + pte_t __pte; \ + \ + pte_val(__pte) = __pa(page) + pgprot_val(pgprot); \ + __pte; \ +}) +#define mk_pte(page, pgprot) __mk_pte(page_address(page), (pgprot)) +#define mk_pte_phys(physpage, pgprot) \ +({ \ + pte_t __pte; \ + \ + pte_val(__pte) = (physpage) + pgprot_val(pgprot); \ + __pte; \ +}) + +extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) +{ pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; } + +extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep) +{ + unsigned long ptbl = virt_to_phys(ptep) | _PAGE_TABLE | _PAGE_ACCESSED; + unsigned long *ptr = pmdp->pmd; + short i = 16; + while (--i >= 0) { + *ptr++ = ptbl; + ptbl += (sizeof(pte_t)*PTRS_PER_PTE/16); + } +} + +extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) +{ pgd_val(*pgdp) = _PAGE_TABLE | _PAGE_ACCESSED | __pa(pmdp); } + +#define __pte_page(pte) ((unsigned long)__va(pte_val(pte) & PAGE_MASK)) +#define __pmd_page(pmd) ((unsigned long)__va(pmd_val(pmd) & _TABLE_MASK)) +#define __pgd_page(pgd) ((unsigned long)__va(pgd_val(pgd) & _TABLE_MASK)) + + +#define pte_none(pte) (!pte_val(pte)) +#define pte_present(pte) (pte_val(pte) & (_PAGE_PRESENT | _PAGE_FAKE_SUPER)) +#define pte_clear(ptep) ({ pte_val(*(ptep)) = 0; }) +#define pte_pagenr(pte) ((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT) + +#define pmd_none(pmd) (!pmd_val(pmd)) +#define pmd_bad(pmd) ((pmd_val(pmd) & _DESCTYPE_MASK) != _PAGE_TABLE) +#define pmd_present(pmd) (pmd_val(pmd) & _PAGE_TABLE) +#define pmd_clear(pmdp) ({ \ + unsigned long *__ptr = pmdp->pmd; \ + short __i = 16; \ + while (--__i >= 0) \ + *__ptr++ = 0; \ +}) + + +#define pgd_none(pgd) (!pgd_val(pgd)) +#define pgd_bad(pgd) ((pgd_val(pgd) & _DESCTYPE_MASK) != _PAGE_TABLE) +#define pgd_present(pgd) (pgd_val(pgd) & _PAGE_TABLE) +#define pgd_clear(pgdp) ({ pgd_val(*pgdp) = 0; }) +/* Permanent address of a page. */ +#define page_address(page) ({ if (!(page)->virtual) BUG(); (page)->virtual; }) +#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) +#define pte_page(pte) (mem_map+pte_pagenr(pte)) + +#define pte_ERROR(e) \ + printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) +#define pmd_ERROR(e) \ + printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) +#define pgd_ERROR(e) \ + printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) + + +/* + * The following only work if pte_present() is true. + * Undefined behaviour if not.. + */ +extern inline int pte_read(pte_t pte) { return 1; } +extern inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_RONLY); } +extern inline int pte_exec(pte_t pte) { return 1; } +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 pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; } +extern inline pte_t pte_rdprotect(pte_t pte) { return pte; } +extern inline pte_t pte_exprotect(pte_t pte) { 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_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_RONLY; return pte; } +extern inline pte_t pte_mkread(pte_t pte) { return pte; } +extern inline pte_t pte_mkexec(pte_t pte) { return pte; } +extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } +extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } +extern inline pte_t pte_mknocache(pte_t pte) +{ + pte_val(pte) = (pte_val(pte) & _CACHEMASK040) | m68k_pgtable_cachemode; + return pte; +} +extern inline pte_t pte_mkcache(pte_t pte) { pte_val(pte) = (pte_val(pte) & _CACHEMASK040) | m68k_supervisor_cachemode; return pte; } + +#define PAGE_DIR_OFFSET(tsk,address) pgd_offset((tsk),(address)) + +#define pgd_index(address) ((address) >> PGDIR_SHIFT) + +/* to find an entry in a page-table-directory */ +extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) +{ + return mm->pgd + pgd_index(address); +} + +#define swapper_pg_dir kernel_pg_dir +extern pgd_t kernel_pg_dir[128]; + +extern inline pgd_t * pgd_offset_k(unsigned long address) +{ + return kernel_pg_dir + (address >> PGDIR_SHIFT); +} + + +/* Find an entry in the second-level page table.. */ +extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) +{ + return (pmd_t *)__pgd_page(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PMD-1)); +} + +/* Find an entry in the third-level page table.. */ +extern inline pte_t * pte_offset(pmd_t * pmdp, unsigned long address) +{ + return (pte_t *)__pmd_page(*pmdp) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); +} + + +/* + * Allocate and free page tables. The xxx_kernel() versions are + * used to allocate a kernel page table - this turns on ASN bits + * if any. + */ + +/* Prior to calling these routines, the page should have been flushed + * from both the cache and ATC, or the CPU might not notice that the + * cache setting for the page has been changed. -jskov + */ +static inline void nocache_page (unsigned long vaddr) +{ + if (CPU_IS_040_OR_060) { + pgd_t *dir; + pmd_t *pmdp; + pte_t *ptep; + + dir = pgd_offset_k(vaddr); + pmdp = pmd_offset(dir,vaddr); + ptep = pte_offset(pmdp,vaddr); + *ptep = pte_mknocache(*ptep); + } +} + +static inline void cache_page (unsigned long vaddr) +{ + if (CPU_IS_040_OR_060) { + pgd_t *dir; + pmd_t *pmdp; + pte_t *ptep; + + dir = pgd_offset_k(vaddr); + pmdp = pmd_offset(dir,vaddr); + ptep = pte_offset(pmdp,vaddr); + *ptep = pte_mkcache(*ptep); + } +} + + +#endif /* !__ASSEMBLY__ */ +#endif /* _MOTOROLA_PGTABLE_H */ diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h index 80e5269a2..40915d41c 100644 --- a/include/asm-m68k/page.h +++ b/include/asm-m68k/page.h @@ -160,7 +160,7 @@ static inline void *__va(unsigned long x) #endif /* CONFIG_SUN3 */ #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) -#define virt_to_page(kaddr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)) +#define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr)-PAGE_OFFSET) >> PAGE_SHIFT)) #define VALID_PAGE(page) ((page - mem_map) < max_mapnr) #ifndef CONFIG_SUN3 diff --git a/include/asm-m68k/param.h b/include/asm-m68k/param.h index ffd640baa..7d37eb540 100644 --- a/include/asm-m68k/param.h +++ b/include/asm-m68k/param.h @@ -26,4 +26,8 @@ #define MAXHOSTNAMELEN 64 /* max length of hostname */ +#ifdef __KERNEL__ +# define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ +#endif + #endif /* _M68K_PARAM_H */ diff --git a/include/asm-m68k/parport.h b/include/asm-m68k/parport.h new file mode 100644 index 000000000..98a228ac7 --- /dev/null +++ b/include/asm-m68k/parport.h @@ -0,0 +1,23 @@ +/* + * parport.h: platform-specific PC-style parport initialisation + * + * Copyright (C) 1999, 2000 Tim Waugh + * + * This file should only be included by drivers/parport/parport_pc.c. + * + * RZ: for use with Q40 and other ISA machines + */ + +#ifndef _ASM_M68K_PARPORT_H +#define _ASM_M68K_PARPORT_H 1 + +/* no dma, or IRQ autoprobing */ +static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); +static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) +{ + if (! (MACH_IS_Q40)) + return 0; /* count=0 */ + return parport_pc_find_isa_ports (PARPORT_IRQ_NONE, PARPORT_DMA_NONE); +} + +#endif /* !(_ASM_M68K_PARPORT_H) */ diff --git a/include/asm-m68k/pgalloc.h b/include/asm-m68k/pgalloc.h index 028b7c40e..9f307b343 100644 --- a/include/asm-m68k/pgalloc.h +++ b/include/asm-m68k/pgalloc.h @@ -1,183 +1,11 @@ -#ifndef _M68K_PGALLOC_H -#define _M68K_PGALLOC_H +#ifndef M68K_PGALLOC_H +#define M68K_PGALLOC_H + +#include #include #include -extern struct pgtable_cache_struct { - unsigned long *pmd_cache; - unsigned long *pte_cache; -/* This counts in units of pointer tables, of which can be eight per page. */ - unsigned long pgtable_cache_sz; -} quicklists; - -#define pgd_quicklist ((unsigned long *)0) -#define pmd_quicklist (quicklists.pmd_cache) -#define pte_quicklist (quicklists.pte_cache) -/* This isn't accurate because of fragmentation of allocated pages for - pointer tables, but that should not be a problem. */ -#define pgtable_cache_size ((quicklists.pgtable_cache_sz+7)/8) - -extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long offset); -extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long offset); - -extern pmd_t *get_pointer_table(void); -extern int free_pointer_table(pmd_t *); - -extern inline pte_t *get_pte_fast(void) -{ - unsigned long *ret; - - ret = pte_quicklist; - if (ret) { - pte_quicklist = (unsigned long *)*ret; - ret[0] = 0; - quicklists.pgtable_cache_sz -= 8; - } - return (pte_t *)ret; -} - -extern inline void free_pte_fast(pte_t *pte) -{ - *(unsigned long *)pte = (unsigned long)pte_quicklist; - pte_quicklist = (unsigned long *)pte; - quicklists.pgtable_cache_sz += 8; -} - -extern inline void free_pte_slow(pte_t *pte) -{ - cache_page((unsigned long)pte); - free_page((unsigned long) pte); -} - -extern inline pmd_t *get_pmd_fast(void) -{ - unsigned long *ret; - - ret = pmd_quicklist; - if (ret) { - pmd_quicklist = (unsigned long *)*ret; - ret[0] = 0; - quicklists.pgtable_cache_sz--; - } - return (pmd_t *)ret; -} - -extern inline void free_pmd_fast(pmd_t *pmd) -{ - *(unsigned long *)pmd = (unsigned long)pmd_quicklist; - pmd_quicklist = (unsigned long *) pmd; - quicklists.pgtable_cache_sz++; -} - -extern inline int free_pmd_slow(pmd_t *pmd) -{ - return free_pointer_table(pmd); -} - -/* The pgd cache is folded into the pmd cache, so these are dummy routines. */ -extern inline pgd_t *get_pgd_fast(void) -{ - return (pgd_t *)0; -} - -extern inline void free_pgd_fast(pgd_t *pgd) -{ -} - -extern inline void free_pgd_slow(pgd_t *pgd) -{ -} - -extern void __bad_pte(pmd_t *pmd); -extern void __bad_pmd(pgd_t *pgd); - -extern inline void pte_free(pte_t *pte) -{ - free_pte_fast(pte); -} - -extern inline pte_t *pte_alloc(pmd_t *pmd, unsigned long address) -{ - address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); - if (pmd_none(*pmd)) { - pte_t *page = get_pte_fast(); - - if (!page) - return get_pte_slow(pmd, address); - pmd_set(pmd,page); - return page + address; - } - if (pmd_bad(*pmd)) { - __bad_pte(pmd); - return NULL; - } - return (pte_t *)__pmd_page(*pmd) + address; -} - -extern inline void pmd_free(pmd_t *pmd) -{ - free_pmd_fast(pmd); -} - -extern inline pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address) -{ - address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); - if (pgd_none(*pgd)) { - pmd_t *page = get_pmd_fast(); - - if (!page) - return get_pmd_slow(pgd, address); - pgd_set(pgd, page); - return page + address; - } - if (pgd_bad(*pgd)) { - __bad_pmd(pgd); - return NULL; - } - return (pmd_t *)__pgd_page(*pgd) + address; -} - -extern inline void pte_free_kernel(pte_t *pte) -{ - free_pte_fast(pte); -} - -extern inline pte_t *pte_alloc_kernel(pmd_t *pmd, unsigned long address) -{ - return pte_alloc(pmd, address); -} - -extern inline void pmd_free_kernel(pmd_t *pmd) -{ - free_pmd_fast(pmd); -} - -extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) -{ - return pmd_alloc(pgd, address); -} - -extern inline void pgd_free(pgd_t *pgd) -{ - free_pmd_fast((pmd_t *)pgd); -} - -extern inline pgd_t *pgd_alloc(void) -{ - pgd_t *pgd = (pgd_t *)get_pmd_fast(); - if (!pgd) - pgd = (pgd_t *)get_pointer_table(); - return pgd; -} - -extern int do_check_pgt_cache(int, int); - -extern inline void set_pgdir(unsigned long address, pgd_t entry) -{ -} - - /* * Cache handling functions */ @@ -325,82 +153,13 @@ extern inline void flush_icache_range (unsigned long address, } } +#define flush_icache_page(vma,pg) do { } while (0) -/* - * flush all user-space atc entries. - */ -static inline void __flush_tlb(void) -{ - if (CPU_IS_040_OR_060) - __asm__ __volatile__(".chip 68040\n\t" - "pflushan\n\t" - ".chip 68k"); - else - __asm__ __volatile__("pflush #0,#4"); -} - -static inline void __flush_tlb_one(unsigned long addr) -{ - if (CPU_IS_040_OR_060) { - __asm__ __volatile__(".chip 68040\n\t" - "pflush (%0)\n\t" - ".chip 68k" - : : "a" (addr)); - } else - __asm__ __volatile__("pflush #0,#4,(%0)" : : "a" (addr)); -} - -#define flush_tlb() __flush_tlb() - -/* - * flush all atc entries (both kernel and user-space entries). - */ -static inline void flush_tlb_all(void) -{ - if (CPU_IS_040_OR_060) - __asm__ __volatile__(".chip 68040\n\t" - "pflusha\n\t" - ".chip 68k"); - else - __asm__ __volatile__("pflusha"); -} - -static inline void flush_tlb_mm(struct mm_struct *mm) -{ - if (mm == current->mm) - __flush_tlb(); -} - -static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr) -{ - if (vma->vm_mm == current->mm) - __flush_tlb_one(addr); -} - -static inline void flush_tlb_range(struct mm_struct *mm, - unsigned long start, unsigned long end) -{ - if (mm == current->mm) - __flush_tlb(); -} -extern inline void flush_tlb_kernel_page(unsigned long addr) -{ - if (CPU_IS_040_OR_060) { - mm_segment_t old_fs = get_fs(); - set_fs(KERNEL_DS); - __asm__ __volatile__(".chip 68040\n\t" - "pflush (%0)\n\t" - ".chip 68k" - : : "a" (addr)); - set_fs(old_fs); - } else - __asm__ __volatile__("pflush #4,#4,(%0)" : : "a" (addr)); -} - -extern inline void flush_tlb_pgtables(struct mm_struct *mm, - unsigned long start, unsigned long end) -{ -} +#ifdef CONFIG_SUN3 +#include +#else +#include +#endif -#endif /* _M68K_PGALLOC_H */ +#endif /* M68K_PGALLOC_H */ diff --git a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h index 655d604d2..71fd0ae75 100644 --- a/include/asm-m68k/pgtable.h +++ b/include/asm-m68k/pgtable.h @@ -26,12 +26,20 @@ /* PMD_SHIFT determines the size of the area a second-level page table can map */ +#ifdef CONFIG_SUN3 +#define PMD_SHIFT 17 +#else #define PMD_SHIFT 22 +#endif #define PMD_SIZE (1UL << PMD_SHIFT) #define PMD_MASK (~(PMD_SIZE-1)) /* PGDIR_SHIFT determines what a third-level page table entry can map */ +#ifdef CONFIG_SUN3 +#define PGDIR_SHIFT 17 +#else #define PGDIR_SHIFT 25 +#endif #define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE-1)) @@ -39,16 +47,28 @@ * entries per page directory level: the m68k is configured as three-level, * so we do have PMD level physically. */ +#ifdef CONFIG_SUN3 +#define PTRS_PER_PTE 16 +#define PTRS_PER_PMD 1 +#define PTRS_PER_PGD 2048 +#else #define PTRS_PER_PTE 1024 #define PTRS_PER_PMD 8 #define PTRS_PER_PGD 128 +#endif #define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) #define FIRST_USER_PGD_NR 0 /* Virtual address region for use by kernel_map() */ +#ifdef CONFIG_SUN3 +#define KMAP_START 0x0DC00000 +#define KMAP_END 0x0E000000 +#else #define KMAP_START 0xd0000000 #define KMAP_END 0xf0000000 +#endif +#ifndef CONFIG_SUN3 /* 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 @@ -60,102 +80,12 @@ #define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END KMAP_START - -#endif /* __ASSEMBLY__ */ - -/* - * Definitions for MMU descriptors - */ -#define _PAGE_PRESENT 0x001 -#define _PAGE_SHORT 0x002 -#define _PAGE_RONLY 0x004 -#define _PAGE_ACCESSED 0x008 -#define _PAGE_DIRTY 0x010 -#define _PAGE_SUPER 0x080 /* 68040 supervisor only */ -#define _PAGE_FAKE_SUPER 0x200 /* fake supervisor only on 680[23]0 */ -#define _PAGE_GLOBAL040 0x400 /* 68040 global bit, used for kva descs */ -#define _PAGE_COW 0x800 /* implemented in software */ -#define _PAGE_NOCACHE030 0x040 /* 68030 no-cache mode */ -#define _PAGE_NOCACHE 0x060 /* 68040 cache mode, non-serialized */ -#define _PAGE_NOCACHE_S 0x040 /* 68040 no-cache mode, serialized */ -#define _PAGE_CACHE040 0x020 /* 68040 cache mode, cachable, copyback */ -#define _PAGE_CACHE040W 0x000 /* 68040 cache mode, cachable, write-through */ - -/* Page protection values within PTE. */ -#define SUN3_PAGE_VALID (0x80000000) -#define SUN3_PAGE_WRITEABLE (0x40000000) -#define SUN3_PAGE_SYSTEM (0x20000000) -#define SUN3_PAGE_NOCACHE (0x10000000) -#define SUN3_PAGE_ACCESSED (0x02000000) -#define SUN3_PAGE_MODIFIED (0x01000000) - -#define _DESCTYPE_MASK 0x003 - -#define _CACHEMASK040 (~0x060) -#define _TABLE_MASK (0xfffffe00) - -#define _PAGE_TABLE (_PAGE_SHORT) -#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_NOCACHE) - -#ifndef __ASSEMBLY__ - -/* This is the cache mode to be used for pages containing page descriptors for - * processors >= '040. It is in pte_mknocache(), and the variable is defined - * and initialized in head.S */ -extern int m68k_pgtable_cachemode; - -/* This is the cache mode for normal pages, for supervisor access on - * processors >= '040. It is used in pte_mkcache(), and the variable is - * defined and initialized in head.S */ - -#if defined(CONFIG_060_WRITETHROUGH) -extern int m68k_supervisor_cachemode; -#else -#define m68k_supervisor_cachemode _PAGE_CACHE040 -#endif - -#if defined(CPU_M68040_OR_M68060_ONLY) -#define mm_cachebits _PAGE_CACHE040 -#elif defined(CPU_M68020_OR_M68030_ONLY) -#define mm_cachebits 0 #else -extern unsigned long mm_cachebits; -#endif - -#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED | mm_cachebits) -#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | mm_cachebits) -#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED | mm_cachebits) -#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED | mm_cachebits) -#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | _PAGE_ACCESSED | mm_cachebits) - -/* Alternate definitions that are compile time constants, for - initializing protection_map. The cachebits are fixed later. */ -#define PAGE_NONE_C __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED) -#define PAGE_SHARED_C __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) -#define PAGE_COPY_C __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED) -#define PAGE_READONLY_C __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED) - -/* - * The m68k can't do page protection for execute, and considers that the same are read. - * Also, write permissions imply read permissions. This is the closest we can get.. - */ -#define __P000 PAGE_NONE_C -#define __P001 PAGE_READONLY_C -#define __P010 PAGE_COPY_C -#define __P011 PAGE_COPY_C -#define __P100 PAGE_READONLY_C -#define __P101 PAGE_READONLY_C -#define __P110 PAGE_COPY_C -#define __P111 PAGE_COPY_C - -#define __S000 PAGE_NONE_C -#define __S001 PAGE_READONLY_C -#define __S010 PAGE_SHARED_C -#define __S011 PAGE_SHARED_C -#define __S100 PAGE_READONLY_C -#define __S101 PAGE_READONLY_C -#define __S110 PAGE_SHARED_C -#define __S111 PAGE_SHARED_C +extern unsigned long vmalloc_end; +#define VMALLOC_START 0x0f800000 +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) +#define VMALLOC_END vmalloc_end +#endif /* CONFIG_SUN3 */ /* zero page used for uninitialized stuff */ extern unsigned long empty_zero_page; @@ -182,176 +112,7 @@ extern pte_t * __bad_pagetable(void); /* sizeof(void*)==1<pmd; - short i = 16; - while (--i >= 0) { - *ptr++ = ptbl; - ptbl += (sizeof(pte_t)*PTRS_PER_PTE/16); - } -} - -extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) -{ pgd_val(*pgdp) = _PAGE_TABLE | _PAGE_ACCESSED | __pa(pmdp); } - -#define __pte_page(pte) ((unsigned long)__va(pte_val(pte) & PAGE_MASK)) -#define __pmd_page(pmd) ((unsigned long)__va(pmd_val(pmd) & _TABLE_MASK)) -#define __pgd_page(pgd) ((unsigned long)__va(pgd_val(pgd) & _TABLE_MASK)) - -#define pte_none(pte) (!pte_val(pte)) -#define pte_present(pte) (pte_val(pte) & (_PAGE_PRESENT | _PAGE_FAKE_SUPER)) -#define pte_clear(ptep) ({ pte_val(*(ptep)) = 0; }) - -#define pmd_none(pmd) (!pmd_val(pmd)) -#define pmd_bad(pmd) ((pmd_val(pmd) & _DESCTYPE_MASK) != _PAGE_TABLE) -#define pmd_present(pmd) (pmd_val(pmd) & _PAGE_TABLE) -#define pmd_clear(pmdp) ({ \ - unsigned long *__ptr = pmdp->pmd; \ - short __i = 16; \ - while (--__i >= 0) \ - *__ptr++ = 0; \ -}) - -#define pgd_none(pgd) (!pgd_val(pgd)) -#define pgd_bad(pgd) ((pgd_val(pgd) & _DESCTYPE_MASK) != _PAGE_TABLE) -#define pgd_present(pgd) (pgd_val(pgd) & _PAGE_TABLE) -#define pgd_clear(pgdp) ({ pgd_val(*pgdp) = 0; }) - -/* Permanent address of a page. */ -#define page_address(page) ((page)->virtual) -#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) -#define pte_page(pte) (mem_map+((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT)) - -#define pte_ERROR(e) \ - printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), pte_val(e)) -#define pmd_ERROR(e) \ - printk("%s:%d: bad pmd %p(%08lx).\n", __FILE__, __LINE__, &(e), pmd_val(e)) -#define pgd_ERROR(e) \ - printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), pgd_val(e)) - -/* - * The following only work if pte_present() is true. - * Undefined behaviour if not.. - */ -extern inline int pte_read(pte_t pte) { return 1; } -extern inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_RONLY); } -extern inline int pte_exec(pte_t pte) { return 1; } -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 pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; } -extern inline pte_t pte_rdprotect(pte_t pte) { return pte; } -extern inline pte_t pte_exprotect(pte_t pte) { 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_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_RONLY; return pte; } -extern inline pte_t pte_mkread(pte_t pte) { return pte; } -extern inline pte_t pte_mkexec(pte_t pte) { return pte; } -extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } -extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } -extern inline pte_t pte_mknocache(pte_t pte) -{ - pte_val(pte) = (pte_val(pte) & _CACHEMASK040) | m68k_pgtable_cachemode; - return pte; -} -extern inline pte_t pte_mkcache(pte_t pte) { pte_val(pte) = (pte_val(pte) & _CACHEMASK040) | m68k_supervisor_cachemode; return pte; } - -#define PAGE_DIR_OFFSET(tsk,address) pgd_offset((tsk),(address)) - -#define pgd_index(address) ((address) >> PGDIR_SHIFT) - -/* to find an entry in a page-table-directory */ -extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) -{ - return mm->pgd + pgd_index(address); -} - -#define swapper_pg_dir kernel_pg_dir -extern pgd_t kernel_pg_dir[128]; - -extern inline pgd_t * pgd_offset_k(unsigned long address) -{ - return kernel_pg_dir + (address >> PGDIR_SHIFT); -} - - -/* Find an entry in the second-level page table.. */ -extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) -{ - return (pmd_t *)__pgd_page(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PMD-1)); -} - -/* Find an entry in the third-level page table.. */ -extern inline pte_t * pte_offset(pmd_t * pmdp, unsigned long address) -{ - return (pte_t *)__pmd_page(*pmdp) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); -} - -/* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any. - */ - -/* Prior to calling these routines, the page should have been flushed - * from both the cache and ATC, or the CPU might not notice that the - * cache setting for the page has been changed. -jskov - */ -static inline void nocache_page (unsigned long vaddr) -{ - if (CPU_IS_040_OR_060) { - pgd_t *dir; - pmd_t *pmdp; - pte_t *ptep; - - dir = pgd_offset_k(vaddr); - pmdp = pmd_offset(dir,vaddr); - ptep = pte_offset(pmdp,vaddr); - *ptep = pte_mknocache(*ptep); - } -} - -static inline void cache_page (unsigned long vaddr) -{ - if (CPU_IS_040_OR_060) { - pgd_t *dir; - pmd_t *pmdp; - pte_t *ptep; - - dir = pgd_offset_k(vaddr); - pmdp = pmd_offset(dir,vaddr); - ptep = pte_offset(pmdp,vaddr); - *ptep = pte_mkcache(*ptep); - } -} - +#define SIZEOF_PTR_LOG2 2 /* * Check if the addr/len goes up to the end of a physical @@ -374,13 +135,24 @@ extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode); /* * The m68k doesn't have any external MMU info: the kernel page - * tables contain all the necessary information. + * tables contain all the necessary information. The Sun3 does, but + * they are updated on demand. */ extern inline void update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t pte) { } +#ifdef CONFIG_SUN3 +/* Macros to (de)construct the fake PTEs representing swap pages. */ +#define SWP_TYPE(x) ((x).val & 0x7F) +#define SWP_OFFSET(x) (((x).val) >> 7) +#define SWP_ENTRY(type,offset) ((swp_entry_t) { ((type) | ((offset) << 7)) }) +#define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) +#define swp_entry_to_pte(x) ((pte_t) { (x).val }) + +#else + /* Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e)) */ #define SWP_TYPE(x) (((x).val >> 1) & 0xff) #define SWP_OFFSET(x) ((x).val >> 10) @@ -388,7 +160,9 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma, #define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) #define swp_entry_to_pte(x) ((pte_t) { (x).val }) -#endif /* __ASSEMBLY__ */ +#endif CONFIG_SUN3 + +#endif /* !__ASSEMBLY__ */ /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ #define PageSkip(page) (0) @@ -396,6 +170,16 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma, #define io_remap_page_range remap_page_range +/* MMU-specific headers */ + +#ifdef CONFIG_SUN3 +#include +#else +#include +#endif + +#ifndef __ASSEMBLY__ #include +#endif /* !__ASSEMBLY__ */ #endif /* _M68K_PGTABLE_H */ diff --git a/include/asm-m68k/processor.h b/include/asm-m68k/processor.h index 79d81adc2..1bba1277f 100644 --- a/include/asm-m68k/processor.h +++ b/include/asm-m68k/processor.h @@ -71,6 +71,8 @@ struct thread_struct { unsigned short fs; /* saved fs (sfc, dfc) */ unsigned long crp[2]; /* cpu root pointer */ unsigned long esp0; /* points to SR of stack frame */ + unsigned long faddr; /* info about last fault */ + int signo, code; unsigned long fp[8*3]; unsigned long fpcntl[3]; /* fp control regs */ unsigned char fpstate[FPSTATESIZE]; /* floating point state */ @@ -81,7 +83,6 @@ struct thread_struct { #define INIT_THREAD { \ sizeof(init_stack) + (unsigned long) init_stack, 0, \ PS_S, __KERNEL_DS, \ - {0, 0}, 0, {0,}, {0, 0, 0}, {0,}, \ } /* diff --git a/include/asm-m68k/q40_keyboard.h b/include/asm-m68k/q40_keyboard.h index 9083bc1ec..88993462d 100644 --- a/include/asm-m68k/q40_keyboard.h +++ b/include/asm-m68k/q40_keyboard.h @@ -23,7 +23,6 @@ extern int q40kbd_translate(unsigned char scancode, unsigned char *keycode, char raw_mode); extern char q40kbd_unexpected_up(unsigned char keycode); extern void q40kbd_leds(unsigned char leds); -extern int q40kbd_is_sysrq(unsigned char keycode); extern void q40kbd_init_hw(void); extern unsigned char q40kbd_sysrq_xlate[128]; @@ -36,7 +35,6 @@ extern unsigned char q40kbd_sysrq_xlate[128]; #define kbd_unexpected_up q40kbd_unexpected_up #define kbd_leds q40kbd_leds #define kbd_init_hw q40kbd_init_hw -#define kbd_is_sysrq q40kbd_is_sysrq #define kbd_sysrq_xlate q40kbd_sysrq_xlate diff --git a/include/asm-m68k/q40_master.h b/include/asm-m68k/q40_master.h index b7e365b0f..dd34c1b93 100644 --- a/include/asm-m68k/q40_master.h +++ b/include/asm-m68k/q40_master.h @@ -3,13 +3,14 @@ * RTC stuff merged for compactnes.. */ -#if 1 +#ifndef _Q40_MASTER_H +#define _Q40_MASTER_H + +#include + + #define q40_master_addr 0xff000000 #define q40_rtc_addr 0xff021ffc -#else -extern unsigned long q40_master_addr; /* wherever it is mapped ... */ -extern unsigned long q40_rtc_addr; -#endif #define IIRQ_REG 0x0 /* internal IRQ reg */ #define EIRQ_REG 0x4 /* external ... */ @@ -22,7 +23,7 @@ extern unsigned long q40_rtc_addr; #define KEYBOARD_UNLOCK_REG 0x20 /* clear kb int */ #define SAMPLE_ENABLE_REG 0x14 /* generate SAMPLE ints */ -#define SAMPLE_RATE_REG 0x28 +#define SAMPLE_RATE_REG 0x2c #define SAMPLE_CLEAR_REG 0x28 #define SAMPLE_LOW 0x00 #define SAMPLE_HIGH 0x01 @@ -34,9 +35,13 @@ extern unsigned long q40_rtc_addr; #endif #define EXT_ENABLE_REG 0x10 /* ... rest of the ISA ints ... */ +#if 0 #define master_inb(_reg_) (*(((unsigned char *)q40_master_addr)+_reg_)) #define master_outb(_b_,_reg_) (*(((unsigned char *)q40_master_addr)+_reg_)=(_b_)) - +#else +#define master_inb(_reg_) native_inb((unsigned char *)q40_master_addr+_reg_) +#define master_outb(_b_,_reg_) native_outb(_b_,(unsigned char *)q40_master_addr+_reg_) +#endif /* define some Q40 specific ints */ #include "q40ints.h" @@ -55,21 +60,13 @@ extern unsigned long q40_rtc_addr; #define RTC_CTRL (*(unsigned char *)(Q40_RTC_BASE-28)) -#if 0 -struct RTC_STRUCT{ - unsigned char bcd_year; - unsigned char bcd_mth; - unsigned char bcd_dom; - unsigned char bcd_dayofweek; - unsigned char bcd_hr; - unsigned char bcd_min; - unsigned char bcd_sec; - unsigned char ctrl; -}; -typedef struct RTC_STRUCT *RtcPtr_t; -#endif - - /* some control bits */ #define RTC_READ 64 /* prepare for reading */ #define RTC_WRITE 128 + + +/* misc defs */ +#define DAC_LEFT ((unsigned char *)0xff008000) +#define DAC_RIGHT ((unsigned char *)0xff008004) + +#endif /* _Q40_MASTER_H */ diff --git a/include/asm-m68k/q40ints.h b/include/asm-m68k/q40ints.h index f5e29c982..8aaca406e 100644 --- a/include/asm-m68k/q40ints.h +++ b/include/asm-m68k/q40ints.h @@ -4,7 +4,7 @@ #define Q40_IRQ_MAX (34) -#define Q40_IRQ_TIMER (34) +#define Q40_IRQ_SAMPLE (34) #define Q40_IRQ_KEYBOARD (32) #define Q40_IRQ_FRAME (33) diff --git a/include/asm-m68k/siginfo.h b/include/asm-m68k/siginfo.h index 2a5782905..6b48063af 100644 --- a/include/asm-m68k/siginfo.h +++ b/include/asm-m68k/siginfo.h @@ -23,8 +23,9 @@ typedef struct siginfo { /* kill() */ struct { - pid_t _pid; /* sender's pid */ - uid_t _uid; /* sender's uid */ + __kernel_pid_t _pid; /* sender's pid */ + __kernel_uid_t _uid; /* backwards compatibility */ + __kernel_uid32_t _uid32; /* sender's uid */ } _kill; /* POSIX.1b timers */ @@ -35,18 +36,20 @@ typedef struct siginfo { /* POSIX.1b signals */ struct { - pid_t _pid; /* sender's pid */ - uid_t _uid; /* sender's uid */ + __kernel_pid_t _pid; /* sender's pid */ + __kernel_uid_t _uid; /* backwards compatibility */ sigval_t _sigval; + __kernel_uid32_t _uid32; /* sender's uid */ } _rt; /* SIGCHLD */ struct { - pid_t _pid; /* which child */ - uid_t _uid; /* sender's uid */ + __kernel_pid_t _pid; /* which child */ + __kernel_uid_t _uid; /* backwards compatibility */ int _status; /* exit code */ clock_t _utime; clock_t _stime; + __kernel_uid32_t _uid32; /* sender's uid */ } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ @@ -62,11 +65,18 @@ typedef struct siginfo { } _sifields; } siginfo_t; +#define UID16_SIGINFO_COMPAT_NEEDED + /* * How these fields are to be accessed. */ #define si_pid _sifields._kill._pid +#ifdef __KERNEL__ +#define si_uid _sifields._kill._uid32 +#define si_uid16 _sifields._kill._uid +#else #define si_uid _sifields._kill._uid +#endif /* __KERNEL__ */ #define si_status _sifields._sigchld._status #define si_utime _sifields._sigchld._utime #define si_stime _sifields._sigchld._stime diff --git a/include/asm-m68k/softirq.h b/include/asm-m68k/softirq.h index 89a3e3971..3a346780b 100644 --- a/include/asm-m68k/softirq.h +++ b/include/asm-m68k/softirq.h @@ -7,14 +7,12 @@ #include -#define local_bh_disable() (local_bh_count(smp_processor_id())++) -#define local_bh_enable() (local_bh_count(smp_processor_id())--) +#define cpu_bh_disable(cpu) do { local_bh_count(cpu)++; barrier(); } while (0) +#define cpu_bh_enable(cpu) do { barrier(); local_bh_count(cpu)--; } while (0) -#define in_softirq() (local_bh_count != 0) +#define local_bh_disable() cpu_bh_disable(smp_processor_id()) +#define local_bh_enable() cpu_bh_enable(smp_processor_id()) -/* These are for the irq's testing the lock */ -#define softirq_trylock(cpu) (local_bh_count(cpu) ? 0 : (local_bh_count(cpu)=1)) -#define softirq_endlock(cpu) (local_bh_count(cpu) = 0) -#define synchronize_bh() barrier() +#define in_softirq() (local_bh_count(smp_processor_id()) != 0) #endif diff --git a/include/asm-m68k/spinlock.h b/include/asm-m68k/spinlock.h index fec148175..20f46e27b 100644 --- a/include/asm-m68k/spinlock.h +++ b/include/asm-m68k/spinlock.h @@ -1,6 +1,6 @@ #ifndef __M68K_SPINLOCK_H #define __M68K_SPINLOCK_H -#error "m68k doesn't do SMP" +#error "m68k doesn't do SMP yet" #endif diff --git a/include/asm-m68k/stat.h b/include/asm-m68k/stat.h index 1d5b008e0..81b225ef4 100644 --- a/include/asm-m68k/stat.h +++ b/include/asm-m68k/stat.h @@ -44,8 +44,10 @@ struct stat { struct stat64 { unsigned char __pad0[6]; unsigned short st_dev; + unsigned char __pad1[4]; - unsigned long long st_ino; +#define STAT64_HAS_BROKEN_ST_INO 1 + unsigned long __st_ino; unsigned int st_mode; unsigned int st_nlink; @@ -53,14 +55,15 @@ struct stat64 { unsigned long st_uid; unsigned long st_gid; + unsigned char __pad2[6]; unsigned short st_rdev; - unsigned char __pad3[10]; + unsigned char __pad3[4]; long long st_size; unsigned long st_blksize; - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ unsigned long __pad4; /* future possible st_blocks high bits */ + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ unsigned long st_atime; unsigned long __pad5; @@ -71,8 +74,7 @@ struct stat64 { unsigned long st_ctime; unsigned long __pad7; /* will be high 32 bits of ctime someday */ - unsigned long __unused1; - unsigned long __unused2; + unsigned long long st_ino; }; #endif /* _M68K_STAT_H */ diff --git a/include/asm-m68k/sun3_pgalloc.h b/include/asm-m68k/sun3_pgalloc.h new file mode 100644 index 000000000..32a810aa5 --- /dev/null +++ b/include/asm-m68k/sun3_pgalloc.h @@ -0,0 +1,274 @@ +/* sun3_pgalloc.h -- + * reorganization around 2.3.39, routines moved from sun3_pgtable.h + * + * moved 1/26/2000 Sam Creasey + */ + +#ifndef _SUN3_PGALLOC_H +#define _SUN3_PGALLOC_H + +/* Pagetable caches. */ +//todo: should implement for at least ptes. --m +#define pgd_quicklist ((unsigned long *) 0) +#define pmd_quicklist ((unsigned long *) 0) +#define pte_quicklist ((unsigned long *) 0) +#define pgtable_cache_size (0L) + +/* Allocation and deallocation of various flavours of pagetables. */ +extern inline int free_pmd_fast (pmd_t *pmdp) { return 0; } +extern inline int free_pmd_slow (pmd_t *pmdp) { return 0; } +extern inline pmd_t *get_pmd_fast (void) { return (pmd_t *) 0; } + +//todo: implement the following properly. +#define get_pte_fast() ((pte_t *) 0) +#define get_pte_slow pte_alloc +#define free_pte_fast(pte) +#define free_pte_slow pte_free + +/* FIXME - when we get this compiling */ +/* erm, now that it's compiling, what do we do with it? */ +#define _KERNPG_TABLE 0 + +extern inline void pte_free_kernel(pte_t * pte) +{ + free_page((unsigned long) pte); +} + +extern const char bad_pmd_string[]; + +extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + if (pmd_none(*pmd)) { + pte_t * page = (pte_t *) get_free_page(GFP_KERNEL); + if (pmd_none(*pmd)) { + if (page) { + pmd_val(*pmd) = _KERNPG_TABLE + __pa(page); + return page + address; + } + pmd_val(*pmd) = _KERNPG_TABLE + __pa((unsigned long)BAD_PAGETABLE); + return NULL; + } + free_page((unsigned long) page); + } + if (pmd_bad(*pmd)) { + printk(bad_pmd_string, pmd_val(*pmd)); + printk("at kernel pgd off %08x\n", (unsigned int)pmd); + pmd_val(*pmd) = _KERNPG_TABLE + __pa((unsigned long)BAD_PAGETABLE); + return NULL; + } + return (pte_t *) __pmd_page(*pmd) + address; +} + +/* + * allocating and freeing a pmd is trivial: the 1-entry pmd is + * inside the pgd, so has no extra memory associated with it. + */ +extern inline void pmd_free_kernel(pmd_t * pmd) +{ +// pmd_val(*pmd) = 0; +} + +extern inline pmd_t * pmd_alloc_kernel(pgd_t * pgd, unsigned long address) +{ + return (pmd_t *) pgd; +} + +extern inline void pte_free(pte_t * pte) +{ + free_page((unsigned long) pte); +} + +extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) +{ + address = (address >> (PAGE_SHIFT-2)) & 4*(PTRS_PER_PTE - 1); + +repeat: + if (pmd_none(*pmd)) + goto getnew; + if (pmd_bad(*pmd)) + goto fix; + return (pte_t *) (__pmd_page(*pmd) + address); + +getnew: +{ + unsigned long page = __get_free_page(GFP_KERNEL); + if (!pmd_none(*pmd)) + goto freenew; + if (!page) + goto oom; + memset((void *)page, 0, PAGE_SIZE); +// pmd_val(*pmd) = SUN3_PMD_MAGIC + __pa(page); + pmd_val(*pmd) = __pa(page); + return (pte_t *) (page + address); +freenew: + free_page(page); + goto repeat; +} + +fix: + printk(bad_pmd_string, pmd_val(*pmd)); + printk("in normal pgd offset %08x\n", (unsigned int)pmd); +oom: +// pmd_val(*pmd) = SUN3_PMD_MAGIC + __pa(BAD_PAGETABLE); + pmd_val(*pmd) = __pa(BAD_PAGETABLE); + return NULL; +} + +/* + * allocating and freeing a pmd is trivial: the 1-entry pmd is + * inside the pgd, so has no extra memory associated with it. + */ +extern inline void pmd_free(pmd_t * pmd) +{ + pmd_val(*pmd) = 0; +} + +extern inline pmd_t * pmd_alloc(pgd_t * pgd, unsigned long address) +{ + return (pmd_t *) pgd; +} + +extern inline void pgd_free(pgd_t * pgd) +{ + free_page((unsigned long) pgd); +} + +extern inline pgd_t * pgd_alloc(void) +{ + pgd_t *new_pgd; + + new_pgd = (pgd_t *)get_free_page(GFP_KERNEL); + memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE); + memset(new_pgd, 0, (PAGE_OFFSET >> PGDIR_SHIFT)); + return new_pgd; +} + +/* FIXME: the sun3 doesn't have a page table cache! + (but the motorola routine should just return 0) */ + +extern int do_check_pgt_cache(int, int); + +extern inline void set_pgdir(unsigned long address, pgd_t entry) +{ +} + +/* Reserved PMEGs. */ +extern char sun3_reserved_pmeg[SUN3_PMEGS_NUM]; +extern unsigned long pmeg_vaddr[SUN3_PMEGS_NUM]; +extern unsigned char pmeg_alloc[SUN3_PMEGS_NUM]; +extern unsigned char pmeg_ctx[SUN3_PMEGS_NUM]; + +/* Flush all userspace mappings one by one... (why no flush command, + sun?) */ +static inline void flush_tlb_all(void) +{ + unsigned long addr; + unsigned char ctx, oldctx; + + oldctx = sun3_get_context(); + for(addr = 0x00000000; addr < TASK_SIZE; addr += SUN3_PMEG_SIZE) { + for(ctx = 0; ctx < 8; ctx++) { + sun3_put_context(ctx); + sun3_put_segmap(addr, SUN3_INVALID_PMEG); + } + } + + sun3_put_context(oldctx); + /* erase all of the userspace pmeg maps, we've clobbered them + all anyway */ + for(addr = 0; addr < SUN3_INVALID_PMEG; addr++) { + if(pmeg_alloc[addr] == 1) { + pmeg_alloc[addr] = 0; + pmeg_ctx[addr] = 0; + pmeg_vaddr[addr] = 0; + } + } + +} + +/* Clear user TLB entries within the context named in mm */ +static inline void flush_tlb_mm (struct mm_struct *mm) +{ + unsigned char oldctx; + unsigned char seg; + unsigned long i; + + oldctx = sun3_get_context(); + sun3_put_context(mm->context); + + for(i = 0; i < TASK_SIZE; i += SUN3_PMEG_SIZE) { + seg = sun3_get_segmap(i); + if(seg == SUN3_INVALID_PMEG) + continue; + + sun3_put_segmap(i, SUN3_INVALID_PMEG); + pmeg_alloc[seg] = 0; + pmeg_ctx[seg] = 0; + pmeg_vaddr[seg] = 0; + } + + sun3_put_context(oldctx); + +} + +/* Flush a single TLB page. In this case, we're limited to flushing a + single PMEG */ +static inline void flush_tlb_page (struct vm_area_struct *vma, + unsigned long addr) +{ + unsigned char oldctx; + unsigned char i; + + oldctx = sun3_get_context(); + sun3_put_context(vma->vm_mm->context); + addr &= ~SUN3_PMEG_MASK; + if((i = sun3_get_segmap(addr)) != SUN3_INVALID_PMEG) + { + pmeg_alloc[i] = 0; + pmeg_ctx[i] = 0; + pmeg_vaddr[i] = 0; + sun3_put_segmap (addr, SUN3_INVALID_PMEG); + } + sun3_put_context(oldctx); + +} +/* Flush a range of pages from TLB. */ + +static inline void flush_tlb_range (struct mm_struct *mm, + unsigned long start, unsigned long end) +{ + unsigned char seg, oldctx; + + start &= ~SUN3_PMEG_MASK; + + oldctx = sun3_get_context(); + sun3_put_context(mm->context); + + while(start < end) + { + if((seg = sun3_get_segmap(start)) == SUN3_INVALID_PMEG) + goto next; + if(pmeg_ctx[seg] == mm->context) { + pmeg_alloc[seg] = 0; + pmeg_ctx[seg] = 0; + pmeg_vaddr[seg] = 0; + } + sun3_put_segmap(start, SUN3_INVALID_PMEG); + next: + start += SUN3_PMEG_SIZE; + } +} + +/* Flush kernel page from TLB. */ +static inline void flush_tlb_kernel_page (unsigned long addr) +{ + sun3_put_segmap (addr & ~(SUN3_PMEG_SIZE - 1), SUN3_INVALID_PMEG); +} + +extern inline void flush_tlb_pgtables(struct mm_struct *mm, + unsigned long start, unsigned long end) +{ +} + +#endif /* SUN3_PGALLOC_H */ diff --git a/include/asm-m68k/sun3_pgtable.h b/include/asm-m68k/sun3_pgtable.h new file mode 100644 index 000000000..ce9e09a2c --- /dev/null +++ b/include/asm-m68k/sun3_pgtable.h @@ -0,0 +1,219 @@ +#ifndef _SUN3_PGTABLE_H +#define _SUN3_PGTABLE_H + +#include + +#ifndef __ASSEMBLY__ +#include +#include + +/* + * This file contains all the things which change drastically for the sun3 + * pagetable stuff, to avoid making too much of a mess of the generic m68k + * `pgtable.h'; this should only be included from the generic file. --m + */ + +/* For virtual address to physical address conversion */ +#define VTOP(addr) __pa(addr) +#define PTOV(addr) __va(addr) + + +#endif /* !__ASSEMBLY__ */ + +/* These need to be defined for compatibility although the sun3 doesn't use them */ +#define _PAGE_NOCACHE030 0x040 +#define _CACHEMASK040 (~0x060) +#define _PAGE_NOCACHE_S 0x040 + +/* Page protection values within PTE. */ +#define SUN3_PAGE_VALID (0x80000000) +#define SUN3_PAGE_WRITEABLE (0x40000000) +#define SUN3_PAGE_SYSTEM (0x20000000) +#define SUN3_PAGE_NOCACHE (0x10000000) +#define SUN3_PAGE_ACCESSED (0x02000000) +#define SUN3_PAGE_MODIFIED (0x01000000) + + +/* Externally used page protection values. */ +#define _PAGE_PRESENT (SUN3_PAGE_VALID) +#define _PAGE_ACCESSED (SUN3_PAGE_ACCESSED) + +/* Compound page protection values. */ +//todo: work out which ones *should* have SUN3_PAGE_NOCACHE and fix... +// is it just PAGE_KERNEL and PAGE_SHARED? +#define PAGE_NONE __pgprot(SUN3_PAGE_VALID \ + | SUN3_PAGE_ACCESSED \ + | SUN3_PAGE_NOCACHE) +#define PAGE_SHARED __pgprot(SUN3_PAGE_VALID \ + | SUN3_PAGE_WRITEABLE \ + | SUN3_PAGE_ACCESSED \ + | SUN3_PAGE_NOCACHE) +#define PAGE_COPY __pgprot(SUN3_PAGE_VALID \ + | SUN3_PAGE_ACCESSED \ + | SUN3_PAGE_NOCACHE) +#define PAGE_READONLY __pgprot(SUN3_PAGE_VALID \ + | SUN3_PAGE_ACCESSED \ + | SUN3_PAGE_NOCACHE) +#define PAGE_KERNEL __pgprot(SUN3_PAGE_VALID \ + | SUN3_PAGE_WRITEABLE \ + | SUN3_PAGE_SYSTEM \ + | SUN3_PAGE_NOCACHE \ + | SUN3_PAGE_ACCESSED \ + | SUN3_PAGE_MODIFIED) +#define PAGE_INIT __pgprot(SUN3_PAGE_VALID \ + | SUN3_PAGE_WRITEABLE \ + | SUN3_PAGE_SYSTEM \ + | SUN3_PAGE_NOCACHE) + +/* + * Page protections for initialising protection_map. The sun3 has only two + * protection settings, valid (implying read and execute) and writeable. These + * are as close as we can get... + */ +#define __P000 PAGE_NONE +#define __P001 PAGE_READONLY +#define __P010 PAGE_COPY +#define __P011 PAGE_COPY +#define __P100 PAGE_READONLY +#define __P101 PAGE_READONLY +#define __P110 PAGE_COPY +#define __P111 PAGE_COPY + +#define __S000 PAGE_NONE +#define __S001 PAGE_READONLY +#define __S010 PAGE_SHARED +#define __S011 PAGE_SHARED +#define __S100 PAGE_READONLY +#define __S101 PAGE_READONLY +#define __S110 PAGE_SHARED +#define __S111 PAGE_SHARED + +/* Use these fake page-protections on PMDs. */ +#define SUN3_PMD_VALID (0x00000001) +#define SUN3_PMD_MASK (0x0000003F) +#define SUN3_PMD_MAGIC (0x0000002B) + +#ifndef __ASSEMBLY__ + +/* + * Conversion functions: convert a page and protection to a page entry, + * and a page entry and page directory to the page they refer to. + */ +#define __mk_pte(page, pgprot) \ +({ pte_t __pte; pte_val(__pte) = (__pa(page) >> PAGE_SHIFT) | pgprot_val(pgprot); __pte; }) +#define mk_pte(page, pgprot) __mk_pte(page_address(page), (pgprot)) +#define mk_pte_phys(physpage, pgprot) \ +({ pte_t __pte; pte_val(__pte) = ((physpage) >> PAGE_SHIFT) | pgprot_val(pgprot); __pte; }) +extern inline pte_t pte_modify (pte_t pte, pgprot_t newprot) +{ pte_val(pte) = (pte_val(pte) & SUN3_PAGE_CHG_MASK) | pgprot_val(newprot); return pte; } + +#define pmd_set(pmdp,ptep) do {} while (0) + +extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) +{ pgd_val(*pgdp) = virt_to_phys(pmdp); } + +#define __pte_page(pte) \ +((unsigned long) __va ((pte_val (pte) & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT)) +#define __pmd_page(pmd) \ +((unsigned long) __va (pmd_val (pmd) & PAGE_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) & SUN3_PAGE_VALID; } +extern inline void pte_clear (pte_t *ptep) { pte_val (*ptep) = 0; } + +/* FIXME: this is only a guess */ +#define pte_pagenr(pte) ((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT) +/* Permanent address of a page. */ +#define page_address(page) ({ if (!(page)->virtual) BUG(); (page)->virtual; }) +#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) +#define pte_page(pte) (mem_map+pte_pagenr(pte)) + + +extern inline int pmd_none2 (pmd_t *pmd) { return !pmd_val (*pmd); } +#define pmd_none(pmd) pmd_none2(&(pmd)) +//extern inline int pmd_bad (pmd_t pmd) { return (pmd_val (pmd) & SUN3_PMD_MASK) != SUN3_PMD_MAGIC; } +extern inline int pmd_bad2 (pmd_t *pmd) { return 0; } +#define pmd_bad(pmd) pmd_bad2(&(pmd)) +extern inline int pmd_present2 (pmd_t *pmd) { return pmd_val (*pmd) & SUN3_PMD_VALID; } +#define pmd_present(pmd) pmd_present2(&(pmd)) +extern inline void pmd_clear (pmd_t *pmdp) { pmd_val (*pmdp) = 0; } + +extern inline int pgd_none (pgd_t pgd) { return 0; } +extern inline int pgd_bad (pgd_t pgd) { return 0; } +extern inline int pgd_present (pgd_t pgd) { return 0; } +extern inline void pgd_clear (pgd_t *pgdp) {} + + +#define pte_ERROR(e) \ + printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) +#define pmd_ERROR(e) \ + printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) +#define pgd_ERROR(e) \ + printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) + + +/* + * The following only work if pte_present() is true. + * Undefined behaviour if not... + * [we have the full set here even if they don't change from m68k] + */ +extern inline int pte_read(pte_t pte) { return 1; } +extern inline int pte_write(pte_t pte) { return pte_val(pte) & SUN3_PAGE_WRITEABLE; } +extern inline int pte_exec(pte_t pte) { return 1; } +extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & SUN3_PAGE_MODIFIED; } +extern inline int pte_young(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } + +extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_WRITEABLE; return pte; } +extern inline pte_t pte_rdprotect(pte_t pte) { return pte; } +extern inline pte_t pte_exprotect(pte_t pte) { return pte; } +extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_MODIFIED; return pte; } +extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_ACCESSED; return pte; } +extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= SUN3_PAGE_WRITEABLE; return pte; } +extern inline pte_t pte_mkread(pte_t pte) { return pte; } +extern inline pte_t pte_mkexec(pte_t pte) { return pte; } +extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= SUN3_PAGE_MODIFIED; return pte; } +extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= SUN3_PAGE_ACCESSED; return pte; } +extern inline pte_t pte_mknocache(pte_t pte) { pte_val(pte) |= SUN3_PAGE_NOCACHE; return pte; } +// use this version when caches work... +//extern inline pte_t pte_mkcache(pte_t pte) { pte_val(pte) &= SUN3_PAGE_NOCACHE; return pte; } +// until then, use: +extern inline pte_t pte_mkcache(pte_t pte) { return pte; } + +extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; +extern pgd_t kernel_pg_dir[PTRS_PER_PGD]; + +/* Find an entry in a pagetable directory. */ +#define pgd_index(address) ((address) >> PGDIR_SHIFT) + +#define pgd_offset(mm, address) \ +((mm)->pgd + pgd_index(address)) + +/* Find an entry in a kernel pagetable directory. */ +#define pgd_offset_k(address) pgd_offset(&init_mm, address) + +/* Find an entry in the second-level pagetable. */ +extern inline pmd_t *pmd_offset (pgd_t *pgd, unsigned long address) +{ + return (pmd_t *) pgd; +} + +/* Find an entry in the third-level pagetable. */ +#define pte_offset(pmd, address) \ +((pte_t *) __pmd_page (*pmd) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE-1))) + +/* Disable caching for page at given kernel virtual address. */ +static inline void nocache_page (unsigned long vaddr) +{ + /* Don't think this is required on sun3. --m */ +} + +/* Enable caching for page at given kernel virtual address. */ +static inline void cache_page (unsigned long vaddr) +{ + /* Don't think this is required on sun3. --m */ +} + + + +#endif /* !__ASSEMBLY__ */ +#endif /* !_SUN3_PGTABLE_H */ diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h index a33bb7c14..3da1d58d7 100644 --- a/include/asm-m68k/system.h +++ b/include/asm-m68k/system.h @@ -3,6 +3,7 @@ #include /* get configuration macros */ #include +#include #include #include @@ -70,19 +71,23 @@ asmlinkage void resume(void); #define sti() __sti() #define save_flags(x) __save_flags(x) #define restore_flags(x) __restore_flags(x) - +#define save_and_cli(flags) do { save_flags(flags); cli(); } while(0) /* * Force strict CPU ordering. * Not really required on m68k... */ -#define nop() asm volatile ("nop"::) -#define mb() asm volatile ("" : : :"memory") -#define rmb() asm volatile ("" : : :"memory") -#define wmb() asm volatile ("" : : :"memory") +#define nop() do { asm volatile ("nop"); barrier(); } while (0) +#define mb() barrier() +#define rmb() barrier() +#define wmb() barrier() #define set_mb(var, value) do { xchg(&var, value); } while (0) #define set_wmb(var, value) do { var = value; wmb(); } while (0) +#define smp_mb() barrier() +#define smp_rmb() barrier() +#define smp_wmb() barrier() + #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) #define tas(ptr) (xchg((ptr),1)) diff --git a/include/asm-m68k/types.h b/include/asm-m68k/types.h index b0ece7bda..45d1588f2 100644 --- a/include/asm-m68k/types.h +++ b/include/asm-m68k/types.h @@ -49,6 +49,10 @@ typedef unsigned long long u64; #define BITS_PER_LONG 32 +/* DMA addresses are 32-bits wide */ + +typedef u32 dma_addr_t; + #endif /* __KERNEL__ */ #endif /* _M68K_TYPES_H */ diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h index 9b88477aa..4c43eb814 100644 --- a/include/asm-m68k/unistd.h +++ b/include/asm-m68k/unistd.h @@ -80,7 +80,7 @@ #define __NR_sigpending 73 #define __NR_sethostname 74 #define __NR_setrlimit 75 -#define __NR_old_getrlimit 76 +#define __NR_getrlimit 76 #define __NR_getrusage 77 #define __NR_gettimeofday 78 #define __NR_settimeofday 79 @@ -170,6 +170,7 @@ #define __NR_mremap 163 #define __NR_setresuid 164 #define __NR_getresuid 165 +#define __NR_getpagesize 166 #define __NR_query_module 167 #define __NR_poll 168 #define __NR_nfsservctl 169 @@ -194,7 +195,7 @@ #define __NR_getpmsg 188 /* some people actually want streams */ #define __NR_putpmsg 189 /* some people actually want streams */ #define __NR_vfork 190 -#define __NR_getrlimit 191 +#define __NR_ugetrlimit 191 #define __NR_mmap2 192 #define __NR_truncate64 193 #define __NR_ftruncate64 194 diff --git a/include/asm-parisc/a.out.h b/include/asm-parisc/a.out.h new file mode 100644 index 000000000..2a490cc9e --- /dev/null +++ b/include/asm-parisc/a.out.h @@ -0,0 +1,29 @@ +#ifndef __PARISC_A_OUT_H__ +#define __PARISC_A_OUT_H__ + +struct exec +{ + unsigned int a_info; /* Use macros N_MAGIC, etc for access */ + unsigned a_text; /* length of text, in bytes */ + unsigned a_data; /* length of data, in bytes */ + unsigned a_bss; /* length of uninitialized data area for file, in bytes */ + unsigned a_syms; /* length of symbol table data in file, in bytes */ + unsigned a_entry; /* start address */ + unsigned a_trsize; /* length of relocation info for text, in bytes */ + unsigned a_drsize; /* length of relocation info for data, in bytes */ +}; + +#define N_TRSIZE(a) ((a).a_trsize) +#define N_DRSIZE(a) ((a).a_drsize) +#define N_SYMSIZE(a) ((a).a_syms) + +#ifdef __KERNEL__ + +/* XXX: STACK_TOP actually should be STACK_BOTTOM for parisc. + * prumpf */ + +#define STACK_TOP TASK_SIZE + +#endif + +#endif /* __A_OUT_GNU_H__ */ diff --git a/include/asm-parisc/asmregs.h b/include/asm-parisc/asmregs.h new file mode 100644 index 000000000..d93c646e1 --- /dev/null +++ b/include/asm-parisc/asmregs.h @@ -0,0 +1,183 @@ +/* + * Copyright (C) 1999 Hewlett-Packard (Frank Rowand) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _PARISC_ASMREGS_H +#define _PARISC_ASMREGS_H + +;! General Registers + +rp: .reg %r2 +arg3: .reg %r23 +arg2: .reg %r24 +arg1: .reg %r25 +arg0: .reg %r26 +dp: .reg %r27 +ret0: .reg %r28 +ret1: .reg %r29 +sl: .reg %r29 +sp: .reg %r30 + +#if 0 +/* PA20_REVISIT */ +arg7: .reg r19 +arg6: .reg r20 +arg5: .reg r21 +arg4: .reg r22 +gp: .reg r27 +ap: .reg r29 +#endif + + +r0: .reg %r0 +r1: .reg %r1 +r2: .reg %r2 +r3: .reg %r3 +r4: .reg %r4 +r5: .reg %r5 +r6: .reg %r6 +r7: .reg %r7 +r8: .reg %r8 +r9: .reg %r9 +r10: .reg %r10 +r11: .reg %r11 +r12: .reg %r12 +r13: .reg %r13 +r14: .reg %r14 +r15: .reg %r15 +r16: .reg %r16 +r17: .reg %r17 +r18: .reg %r18 +r19: .reg %r19 +r20: .reg %r20 +r21: .reg %r21 +r22: .reg %r22 +r23: .reg %r23 +r24: .reg %r24 +r25: .reg %r25 +r26: .reg %r26 +r27: .reg %r27 +r28: .reg %r28 +r29: .reg %r29 +r30: .reg %r30 +r31: .reg %r31 + + +;! Space Registers + +sr0: .reg %sr0 +sr1: .reg %sr1 +sr2: .reg %sr2 +sr3: .reg %sr3 +sr4: .reg %sr4 +sr5: .reg %sr5 +sr6: .reg %sr6 +sr7: .reg %sr7 + + +;! Floating Point Registers + +fr0: .reg %fr0 +fr1: .reg %fr1 +fr2: .reg %fr2 +fr3: .reg %fr3 +fr4: .reg %fr4 +fr5: .reg %fr5 +fr6: .reg %fr6 +fr7: .reg %fr7 +fr8: .reg %fr8 +fr9: .reg %fr9 +fr10: .reg %fr10 +fr11: .reg %fr11 +fr12: .reg %fr12 +fr13: .reg %fr13 +fr14: .reg %fr14 +fr15: .reg %fr15 +fr16: .reg %fr16 +fr17: .reg %fr17 +fr18: .reg %fr18 +fr19: .reg %fr19 +fr20: .reg %fr20 +fr21: .reg %fr21 +fr22: .reg %fr22 +fr23: .reg %fr23 +fr24: .reg %fr24 +fr25: .reg %fr25 +fr26: .reg %fr26 +fr27: .reg %fr27 +fr28: .reg %fr28 +fr29: .reg %fr29 +fr30: .reg %fr30 +fr31: .reg %fr31 + + +;! Control Registers + +rctr: .reg %cr0 +pidr1: .reg %cr8 +pidr2: .reg %cr9 +ccr: .reg %cr10 +sar: .reg %cr11 +pidr3: .reg %cr12 +pidr4: .reg %cr13 +iva: .reg %cr14 +eiem: .reg %cr15 +itmr: .reg %cr16 +pcsq: .reg %cr17 +pcoq: .reg %cr18 +iir: .reg %cr19 +isr: .reg %cr20 +ior: .reg %cr21 +ipsw: .reg %cr22 +eirr: .reg %cr23 +tr0: .reg %cr24 +tr1: .reg %cr25 +tr2: .reg %cr26 +tr3: .reg %cr27 +tr4: .reg %cr28 +tr5: .reg %cr29 +tr6: .reg %cr30 +tr7: .reg %cr31 + + +cr0: .reg %cr0 +cr8: .reg %cr8 +cr9: .reg %cr9 +cr10: .reg %cr10 +cr11: .reg %cr11 +cr12: .reg %cr12 +cr13: .reg %cr13 +cr14: .reg %cr14 +cr15: .reg %cr15 +cr16: .reg %cr16 +cr17: .reg %cr17 +cr18: .reg %cr18 +cr19: .reg %cr19 +cr20: .reg %cr20 +cr21: .reg %cr21 +cr22: .reg %cr22 +cr23: .reg %cr23 +cr24: .reg %cr24 +cr25: .reg %cr25 +cr26: .reg %cr26 +cr27: .reg %cr27 +cr28: .reg %cr28 +cr29: .reg %cr29 +cr30: .reg %cr30 +cr31: .reg %cr31 + +#endif diff --git a/include/asm-parisc/assembly.h b/include/asm-parisc/assembly.h new file mode 100644 index 000000000..8d60681b2 --- /dev/null +++ b/include/asm-parisc/assembly.h @@ -0,0 +1,374 @@ +/* + * Copyright (C) 1999 Hewlett-Packard (Frank Rowand) + * Copyright (C) 1999 Philipp Rumpf + * Copyright (C) 1999 SuSE GmbH + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _PARISC_ASSEMBLY_H +#define _PARISC_ASSEMBLY_H + +#if defined(__LP64__) && defined(__ASSEMBLY__) +/* the 64-bit pa gnu assembler unfortunately defaults to .level 1.1 or 2.0 so + * work around that for now... */ + .level 2.0w +#endif + +#include +#include + +#include + + sp = 30 + gp = 27 + ipsw = 22 + +#if __PAGE_OFFSET == 0xc0000000 + .macro tophys gr + zdep \gr, 31, 30, \gr + .endm + + .macro tovirt gr + depi 3,1,2,\gr + .endm +#else +#error unknown __PAGE_OFFSET +#endif + + .macro delay value + ldil L%\value, 1 + ldo R%\value(1), 1 + addib,UV,n -1,1,. + addib,NUV,n -1,1,.+8 + nop + .endm + + .macro debug value + .endm + +#ifdef __LP64__ +# define LDIL_FIXUP(reg) depdi 0,31,32,reg +#else +# define LDIL_FIXUP(reg) +#endif + + /* load 32-bit 'value' into 'reg' compensating for the ldil + * sign-extension when running in wide mode. + * WARNING!! neither 'value' nor 'reg' can be expressions + * containing '.'!!!! */ + .macro load32 value, reg + ldil L%\value, \reg + ldo R%\value(\reg), \reg + LDIL_FIXUP(\reg) + .endm + +#ifdef __LP64__ +#define LDREG ldd +#define STREG std +#define RP_OFFSET 16 +#else +#define LDREG ldw +#define STREG stw +#define RP_OFFSET 20 +#endif + + .macro loadgp +#ifdef __LP64__ + ldil L%__gp, %r27 + ldo R%__gp(%r27), %r27 + LDIL_FIXUP(%r27) +#else + ldil L%$global$, %r27 + ldo R%$global$(%r27), %r27 +#endif + .endm + +#define SAVE_SP(r, where) mfsp r, %r1 ! STREG %r1, where +#define REST_SP(r, where) LDREG where, %r1 ! mtsp %r1, r +#define SAVE_CR(r, where) mfctl r, %r1 ! STREG %r1, where +#define REST_CR(r, where) LDREG where, %r1 ! mtctl %r1, r + + .macro save_general regs + STREG %r2, PT_GR2 (\regs) + STREG %r3, PT_GR3 (\regs) + STREG %r4, PT_GR4 (\regs) + STREG %r5, PT_GR5 (\regs) + STREG %r6, PT_GR6 (\regs) + STREG %r7, PT_GR7 (\regs) + STREG %r8, PT_GR8 (\regs) + STREG %r9, PT_GR9 (\regs) + STREG %r10, PT_GR10(\regs) + STREG %r11, PT_GR11(\regs) + STREG %r12, PT_GR12(\regs) + STREG %r13, PT_GR13(\regs) + STREG %r14, PT_GR14(\regs) + STREG %r15, PT_GR15(\regs) + STREG %r16, PT_GR16(\regs) + STREG %r17, PT_GR17(\regs) + STREG %r18, PT_GR18(\regs) + STREG %r19, PT_GR19(\regs) + STREG %r20, PT_GR20(\regs) + STREG %r21, PT_GR21(\regs) + STREG %r22, PT_GR22(\regs) + STREG %r23, PT_GR23(\regs) + STREG %r24, PT_GR24(\regs) + STREG %r25, PT_GR25(\regs) + /* r26 is clobbered by cr19 and assumed to be saved before hand */ + STREG %r27, PT_GR27(\regs) + STREG %r28, PT_GR28(\regs) + /* r29 is already saved and points to PT_xxx struct */ + /* r30 stack pointer saved in get_stack */ + STREG %r31, PT_GR31(\regs) + .endm + + .macro rest_general regs + LDREG PT_GR2 (\regs), %r2 + LDREG PT_GR3 (\regs), %r3 + LDREG PT_GR4 (\regs), %r4 + LDREG PT_GR5 (\regs), %r5 + LDREG PT_GR6 (\regs), %r6 + LDREG PT_GR7 (\regs), %r7 + LDREG PT_GR8 (\regs), %r8 + LDREG PT_GR9 (\regs), %r9 + LDREG PT_GR10(\regs), %r10 + LDREG PT_GR11(\regs), %r11 + LDREG PT_GR12(\regs), %r12 + LDREG PT_GR13(\regs), %r13 + LDREG PT_GR14(\regs), %r14 + LDREG PT_GR15(\regs), %r15 + LDREG PT_GR16(\regs), %r16 + LDREG PT_GR17(\regs), %r17 + LDREG PT_GR18(\regs), %r18 + LDREG PT_GR19(\regs), %r19 + LDREG PT_GR20(\regs), %r20 + LDREG PT_GR21(\regs), %r21 + LDREG PT_GR22(\regs), %r22 + LDREG PT_GR23(\regs), %r23 + LDREG PT_GR24(\regs), %r24 + LDREG PT_GR25(\regs), %r25 + LDREG PT_GR26(\regs), %r26 + LDREG PT_GR27(\regs), %r27 + LDREG PT_GR28(\regs), %r28 + /* r30 stack pointer restored in rest_stack */ + LDREG PT_GR31(\regs), %r31 + .endm + + .macro save_fp regs + fstd,ma %fr0, 8(\regs) + fstd,ma %fr1, 8(\regs) + fstd,ma %fr2, 8(\regs) + fstd,ma %fr3, 8(\regs) + fstd,ma %fr4, 8(\regs) + fstd,ma %fr5, 8(\regs) + fstd,ma %fr6, 8(\regs) + fstd,ma %fr7, 8(\regs) + fstd,ma %fr8, 8(\regs) + fstd,ma %fr9, 8(\regs) + fstd,ma %fr10, 8(\regs) + fstd,ma %fr11, 8(\regs) + fstd,ma %fr12, 8(\regs) + fstd,ma %fr13, 8(\regs) + fstd,ma %fr14, 8(\regs) + fstd,ma %fr15, 8(\regs) + fstd,ma %fr16, 8(\regs) + fstd,ma %fr17, 8(\regs) + fstd,ma %fr18, 8(\regs) + fstd,ma %fr19, 8(\regs) + fstd,ma %fr20, 8(\regs) + fstd,ma %fr21, 8(\regs) + fstd,ma %fr22, 8(\regs) + fstd,ma %fr23, 8(\regs) + fstd,ma %fr24, 8(\regs) + fstd,ma %fr25, 8(\regs) + fstd,ma %fr26, 8(\regs) + fstd,ma %fr27, 8(\regs) + fstd,ma %fr28, 8(\regs) + fstd,ma %fr29, 8(\regs) + fstd,ma %fr30, 8(\regs) + fstd %fr31, 0(\regs) + .endm + + .macro rest_fp regs + fldd 0(\regs), %fr31 + fldd,mb -8(\regs), %fr30 + fldd,mb -8(\regs), %fr29 + fldd,mb -8(\regs), %fr28 + fldd,mb -8(\regs), %fr27 + fldd,mb -8(\regs), %fr26 + fldd,mb -8(\regs), %fr25 + fldd,mb -8(\regs), %fr24 + fldd,mb -8(\regs), %fr23 + fldd,mb -8(\regs), %fr22 + fldd,mb -8(\regs), %fr21 + fldd,mb -8(\regs), %fr20 + fldd,mb -8(\regs), %fr19 + fldd,mb -8(\regs), %fr18 + fldd,mb -8(\regs), %fr17 + fldd,mb -8(\regs), %fr16 + fldd,mb -8(\regs), %fr15 + fldd,mb -8(\regs), %fr14 + fldd,mb -8(\regs), %fr13 + fldd,mb -8(\regs), %fr12 + fldd,mb -8(\regs), %fr11 + fldd,mb -8(\regs), %fr10 + fldd,mb -8(\regs), %fr9 + fldd,mb -8(\regs), %fr8 + fldd,mb -8(\regs), %fr7 + fldd,mb -8(\regs), %fr6 + fldd,mb -8(\regs), %fr5 + fldd,mb -8(\regs), %fr4 + fldd,mb -8(\regs), %fr3 + fldd,mb -8(\regs), %fr2 + fldd,mb -8(\regs), %fr1 + fldd,mb -8(\regs), %fr0 + .endm + +#ifdef __LP64__ + .macro callee_save + ldo 144(%r30), %r30 + std %r3, -144(%r30) + std %r4, -136(%r30) + std %r5, -128(%r30) + std %r6, -120(%r30) + std %r7, -112(%r30) + std %r8, -104(%r30) + std %r9, -96(%r30) + std %r10, -88(%r30) + std %r11, -80(%r30) + std %r12, -72(%r30) + std %r13, -64(%r30) + std %r14, -56(%r30) + std %r15, -48(%r30) + std %r16, -40(%r30) + std %r17, -32(%r30) + std %r18, -24(%r30) + .endm + + .macro callee_rest + ldd -24(%r30), %r18 + ldd -32(%r30), %r17 + ldd -40(%r30), %r16 + ldd -48(%r30), %r15 + ldd -56(%r30), %r14 + ldd -64(%r30), %r13 + ldd -72(%r30), %r12 + ldd -80(%r30), %r11 + ldd -88(%r30), %r10 + ldd -96(%r30), %r9 + ldd -104(%r30), %r8 + ldd -112(%r30), %r7 + ldd -120(%r30), %r6 + ldd -128(%r30), %r5 + ldd -136(%r30), %r4 + ldd -144(%r30), %r3 + ldo -144(%r30), %r30 + .endm + +#else /* __LP64__ */ + + .macro callee_save + ldo 128(30), 30 + stw 3, -128(30) + stw 4, -124(30) + stw 5, -120(30) + stw 6, -116(30) + stw 7, -112(30) + stw 8, -108(30) + stw 9, -104(30) + stw 10, -100(30) + stw 11, -96(30) + stw 12, -92(30) + stw 13, -88(30) + stw 14, -84(30) + stw 15, -80(30) + stw 16, -76(30) + stw 17, -72(30) + stw 18, -68(30) + .endm + + .macro callee_rest + ldw -68(30), 18 + ldw -72(30), 17 + ldw -76(30), 16 + ldw -80(30), 15 + ldw -84(30), 14 + ldw -88(30), 13 + ldw -92(30), 12 + ldw -96(30), 11 + ldw -100(30), 10 + ldw -104(30), 9 + ldw -108(30), 8 + ldw -112(30), 7 + ldw -116(30), 6 + ldw -120(30), 5 + ldw -124(30), 4 + ldw -128(30), 3 + ldo -128(30), 30 + .endm +#endif /* __LP64__ */ + + .macro save_specials regs + + SAVE_SP (%sr0, PT_SR0 (\regs)) + SAVE_SP (%sr1, PT_SR1 (\regs)) + SAVE_SP (%sr2, PT_SR2 (\regs)) + SAVE_SP (%sr3, PT_SR3 (\regs)) + SAVE_SP (%sr4, PT_SR4 (\regs)) + SAVE_SP (%sr5, PT_SR5 (\regs)) + SAVE_SP (%sr6, PT_SR6 (\regs)) + SAVE_SP (%sr7, PT_SR7 (\regs)) + + SAVE_CR (%cr17, PT_IASQ0(\regs)) + mtctl %r0, %cr17 + SAVE_CR (%cr17, PT_IASQ1(\regs)) + + SAVE_CR (%cr18, PT_IAOQ0(\regs)) + mtctl %r0, %cr18 + SAVE_CR (%cr18, PT_IAOQ1(\regs)) + + SAVE_CR (%cr11, PT_SAR (\regs)) + SAVE_CR (%cr22, PT_PSW (\regs)) + SAVE_CR (%cr19, PT_IIR (\regs)) + SAVE_CR (%cr28, PT_GR1 (\regs)) + SAVE_CR (%cr31, PT_GR29 (\regs)) + + STREG %r26, PT_GR26 (\regs) + mfctl %cr29, %r26 + .endm + + .macro rest_specials regs + + REST_SP (%sr0, PT_SR0 (\regs)) + REST_SP (%sr1, PT_SR1 (\regs)) + REST_SP (%sr2, PT_SR2 (\regs)) + REST_SP (%sr3, PT_SR3 (\regs)) + REST_SP (%sr4, PT_SR4 (\regs)) + REST_SP (%sr5, PT_SR5 (\regs)) + REST_SP (%sr6, PT_SR6 (\regs)) + REST_SP (%sr7, PT_SR7 (\regs)) + + REST_CR (%cr17, PT_IASQ0(\regs)) + REST_CR (%cr17, PT_IASQ1(\regs)) + + REST_CR (%cr18, PT_IAOQ0(\regs)) + REST_CR (%cr18, PT_IAOQ1(\regs)) + + REST_CR (%cr11, PT_SAR (\regs)) + + REST_CR (%cr22, PT_PSW (\regs)) + .endm + +#endif diff --git a/include/asm-parisc/atomic.h b/include/asm-parisc/atomic.h new file mode 100644 index 000000000..5b374fc1a --- /dev/null +++ b/include/asm-parisc/atomic.h @@ -0,0 +1,103 @@ +#ifndef _ASM_PARISC_ATOMIC_H_ +#define _ASM_PARISC_ATOMIC_H_ + +#include +#include + +/* Copyright (C) 2000 Philipp Rumpf . */ + +/* + * Atomic operations that C can't guarantee us. Useful for + * resource counting etc.. + * + * And probably incredibly slow on parisc. OTOH, we don't + * have to write any serious assembly. prumpf + */ + +#ifdef CONFIG_SMP +/* we have an array of spinlocks for our atomic_ts, and a hash function + * to get the right index */ +# define ATOMIC_HASH_SIZE 1 +# define ATOMIC_HASH(a) (&__atomic_hash[0]) + +extern spinlock_t __atomic_hash[ATOMIC_HASH_SIZE]; +/* copied from and modified */ +# define SPIN_LOCK(x) \ + do { while(__ldcw(&(x)->lock) == 0); } while(0) + +# define SPIN_UNLOCK(x) \ + do { (x)->lock = 1; } while(0) +#else +# define ATOMIC_HASH_SIZE 1 +# define ATOMIC_HASH(a) (0) + +/* copied from and modified */ +# define SPIN_LOCK(x) (void)(x) + +# define SPIN_UNLOCK(x) do { } while(0) +#endif + +/* copied from and modified */ +#define SPIN_LOCK_IRQSAVE(lock, flags) do { local_irq_save(flags); SPIN_LOCK(lock); } while (0) +#define SPIN_UNLOCK_IRQRESTORE(lock, flags) do { SPIN_UNLOCK(lock); local_irq_restore(flags); } while (0) + +/* Note that we need not lock read accesses - aligned word writes/reads + * are atomic, so a reader never sees unconsistent values. + * + * Cache-line alignment would conflict with, for example, linux/module.h */ + +typedef struct { + volatile int counter; +} atomic_t; + +/* It's possible to reduce all atomic operations to either + * __atomic_add_return, __atomic_set and __atomic_ret (the latter + * is there only for consistency). */ + +static __inline__ int __atomic_add_return(int i, atomic_t *v) +{ + int ret; + unsigned long flags; + SPIN_LOCK_IRQSAVE(ATOMIC_HASH(v), flags); + + ret = (v->counter += i); + + SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(v), flags); + return ret; +} + +static __inline__ void __atomic_set(atomic_t *v, int i) +{ + unsigned long flags; + SPIN_LOCK_IRQSAVE(ATOMIC_HASH(v), flags); + + v->counter = i; + + SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(v), flags); +} + +static __inline__ int __atomic_read(atomic_t *v) +{ + return v->counter; +} + +/* exported interface */ + +#define atomic_add(i,v) ((void)(__atomic_add_return( (i),(v)))) +#define atomic_sub(i,v) ((void)(__atomic_add_return(-(i),(v)))) +#define atomic_inc(v) ((void)(__atomic_add_return( 1,(v)))) +#define atomic_dec(v) ((void)(__atomic_add_return( -1,(v)))) + +#define atomic_add_return(i,v) (__atomic_add_return( (i),(v))) +#define atomic_sub_return(i,v) (__atomic_add_return(-(i),(v))) +#define atomic_inc_return(v) (__atomic_add_return( 1,(v))) +#define atomic_dec_return(v) (__atomic_add_return( -1,(v))) + +#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0) + +#define atomic_set(v,i) (__atomic_set((v),i)) +#define atomic_read(v) (__atomic_read(v)) + +#define ATOMIC_INIT(i) { (i) } + +#endif diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h new file mode 100644 index 000000000..f3f8e0e5b --- /dev/null +++ b/include/asm-parisc/bitops.h @@ -0,0 +1,247 @@ +#ifndef _PARISC_BITOPS_H +#define _PARISC_BITOPS_H + +#include +#include +#include +#include + +#ifdef __LP64__ +# define SHIFT_PER_LONG 6 +#ifndef BITS_PER_LONG +# define BITS_PER_LONG 64 +#endif +#else +# define SHIFT_PER_LONG 5 +#ifndef BITS_PER_LONG +# define BITS_PER_LONG 32 +#endif +#endif + +#define CHOP_SHIFTCOUNT(x) ((x) & (BITS_PER_LONG - 1)) + +static __inline__ int test_and_set_bit(int nr, void * address) +{ + unsigned long mask; + unsigned long *addr = (unsigned long *) address; + int oldbit; + unsigned long flags; + + addr += (nr >> SHIFT_PER_LONG); + SPIN_LOCK_IRQSAVE(ATOMIC_HASH(addr), flags); + + mask = 1L << CHOP_SHIFTCOUNT(nr); + oldbit = (*addr & mask) ? 1 : 0; + *addr |= mask; + + SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(addr), flags); + + return oldbit; +} + +static __inline__ int test_and_clear_bit(int nr, void * address) +{ + unsigned long mask; + unsigned long *addr = (unsigned long *) address; + int oldbit; + unsigned long flags; + + addr += (nr >> SHIFT_PER_LONG); + SPIN_LOCK_IRQSAVE(ATOMIC_HASH(addr), flags); + + mask = 1L << CHOP_SHIFTCOUNT(nr); + oldbit = (*addr & mask) ? 1 : 0; + *addr &= ~mask; + + SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(addr), flags); + + return oldbit; +} + +static __inline__ int test_and_change_bit(int nr, void * address) +{ + unsigned long mask; + unsigned long *addr = (unsigned long *) address; + int oldbit; + unsigned long flags; + + addr += (nr >> SHIFT_PER_LONG); + SPIN_LOCK_IRQSAVE(ATOMIC_HASH(addr), flags); + + mask = 1L << CHOP_SHIFTCOUNT(nr); + oldbit = (*addr & mask) ? 1 : 0; + *addr ^= mask; + + SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(addr), flags); + + return oldbit; +} + +/* again, the read-only case doesn't have to do any locking */ + +static __inline__ int test_bit(int nr, const volatile void *address) +{ + unsigned long mask; + unsigned long *addr = (unsigned long *) address; + + addr += (nr >> SHIFT_PER_LONG); + mask = 1L << CHOP_SHIFTCOUNT(nr); + + return !!(*addr & mask); +} + +/* sparc does this, other arch's don't -- what's the right answer? XXX */ +#define smp_mb__before_clear_bit() do { } while(0) +#define smp_mb__after_clear_bit() do { } while(0) +#define set_bit(nr,addr) ((void)test_and_set_bit(nr,addr)) +#define clear_bit(nr,addr) ((void)test_and_clear_bit(nr,addr)) +#define change_bit(nr,addr) ((void)test_and_change_bit(nr,addr)) + +/* XXX We'd need some binary search here */ + +extern __inline__ unsigned long ffz(unsigned long word) +{ + unsigned long result; + + result = 0; + while(word & 1) { + result++; + word >>= 1; + } + + return result; +} + +#ifdef __KERNEL__ + +/* + * ffs: find first bit set. This is defined the same way as + * the libc and compiler builtin ffs routines, therefore + * differs in spirit from the above ffz (man ffs). + */ + +#define ffs(x) generic_ffs(x) + +/* + * hweightN: returns the hamming weight (i.e. the number + * of bits set) of a N-bit word + */ + +#define hweight32(x) generic_hweight32(x) +#define hweight16(x) generic_hweight16(x) +#define hweight8(x) generic_hweight8(x) + +#endif /* __KERNEL__ */ + +/* + * This implementation of find_{first,next}_zero_bit was stolen from + * Linus' asm-alpha/bitops.h. + */ +#define find_first_zero_bit(addr, size) \ + find_next_zero_bit((addr), (size), 0) + +static __inline__ unsigned long find_next_zero_bit(void * addr, unsigned long size, unsigned long offset) +{ + unsigned long * p = ((unsigned long *) addr) + (offset >> SHIFT_PER_LONG); + unsigned long result = offset & ~(BITS_PER_LONG-1); + unsigned long tmp; + + if (offset >= size) + return size; + size -= result; + offset &= (BITS_PER_LONG-1); + if (offset) { + tmp = *(p++); + tmp |= ~0UL >> (BITS_PER_LONG-offset); + if (size < BITS_PER_LONG) + goto found_first; + if (~tmp) + goto found_middle; + size -= BITS_PER_LONG; + result += BITS_PER_LONG; + } + while (size & ~(BITS_PER_LONG -1)) { + if (~(tmp = *(p++))) + goto found_middle; + result += BITS_PER_LONG; + size -= BITS_PER_LONG; + } + if (!size) + return result; + tmp = *p; +found_first: + tmp |= ~0UL << size; +found_middle: + return result + ffz(tmp); +} + +#define _EXT2_HAVE_ASM_BITOPS_ + +#ifdef __KERNEL__ +/* + * test_and_{set,clear}_bit guarantee atomicity without + * disabling interrupts. + */ +#define ext2_set_bit(nr, addr) test_and_set_bit((nr) ^ 0x18, addr) +#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr) ^ 0x18, addr) + +#endif /* __KERNEL__ */ + +static __inline__ int ext2_test_bit(int nr, __const__ void * addr) +{ + __const__ unsigned char *ADDR = (__const__ unsigned char *) addr; + + return (ADDR[nr >> 3] >> (nr & 7)) & 1; +} + +/* + * This implementation of ext2_find_{first,next}_zero_bit was stolen from + * Linus' asm-alpha/bitops.h and modified for a big-endian machine. + */ + +#define ext2_find_first_zero_bit(addr, size) \ + ext2_find_next_zero_bit((addr), (size), 0) + +extern __inline__ unsigned long ext2_find_next_zero_bit(void *addr, + unsigned long size, unsigned long offset) +{ + unsigned int *p = ((unsigned int *) addr) + (offset >> 5); + unsigned int result = offset & ~31UL; + unsigned int tmp; + + if (offset >= size) + return size; + size -= result; + offset &= 31UL; + if (offset) { + tmp = cpu_to_le32p(p++); + tmp |= ~0UL >> (32-offset); + if (size < 32) + goto found_first; + if (tmp != ~0U) + goto found_middle; + size -= 32; + result += 32; + } + while (size >= 32) { + if ((tmp = cpu_to_le32p(p++)) != ~0U) + goto found_middle; + result += 32; + size -= 32; + } + if (!size) + return result; + tmp = cpu_to_le32p(p); +found_first: + tmp |= ~0U << size; +found_middle: + return result + ffz(tmp); +} + +/* Bitmap functions for the minix filesystem. */ +#define minix_set_bit(nr,addr) ext2_set_bit(nr,addr) +#define minix_clear_bit(nr,addr) ext2_clear_bit(nr,addr) +#define minix_test_bit(nr,addr) ext2_test_bit(nr,addr) +#define minix_find_first_zero_bit(addr,size) ext2_find_first_zero_bit(addr,size) + +#endif /* _PARISC_BITOPS_H */ diff --git a/include/asm-parisc/bootdata.h b/include/asm-parisc/bootdata.h new file mode 100644 index 000000000..e4de299b3 --- /dev/null +++ b/include/asm-parisc/bootdata.h @@ -0,0 +1,16 @@ +#ifndef _PARISC_BOOTDATA_H +#define _PARISC_BOOTDATA_H + +/* structure given from bootloader... */ +typedef struct { + unsigned data_valid_signature, + initrd_start, + initrd_end; + char commandline[1024]; +} bootdata_t; + +#define BOOTDATA_DATA_VALID_SIGNATURE 0xC0400000 + +#define BOOTDATA_PTR ((bootdata_t*) 0xC0400000) + +#endif diff --git a/include/asm-parisc/bugs.h b/include/asm-parisc/bugs.h new file mode 100644 index 000000000..9e6284342 --- /dev/null +++ b/include/asm-parisc/bugs.h @@ -0,0 +1,19 @@ +/* + * include/asm-parisc/bugs.h + * + * Copyright (C) 1999 Mike Shaver + */ + +/* + * This is included by init/main.c to check for architecture-dependent bugs. + * + * Needs: + * void check_bugs(void); + */ + +#include + +static inline void check_bugs(void) +{ +// identify_cpu(&boot_cpu_data); +} diff --git a/include/asm-parisc/byteorder.h b/include/asm-parisc/byteorder.h new file mode 100644 index 000000000..7b3a2ab4c --- /dev/null +++ b/include/asm-parisc/byteorder.h @@ -0,0 +1,75 @@ +#ifndef _PARISC_BYTEORDER_H +#define _PARISC_BYTEORDER_H + +#include + +#ifdef __GNUC__ + +static __inline__ __const__ __u32 ___arch__swab32(__u32 x) +{ + unsigned int temp; + __asm__("shd %0, %0, 16, %1\n\t" /* shift abcdabcd -> cdab */ + "dep %1, 15, 8, %1\n\t" /* deposit cdab -> cbab */ + "shd %0, %1, 8, %0" /* shift abcdcbab -> dcba */ + : "=r" (x), "=&r" (temp) + : "0" (x)); + return x; +} + + +#if BITS_PER_LONG > 32 +/* +** From "PA-RISC 2.0 Architecture", HP Professional Books. +** See Appendix I page 8 , "Endian Byte Swapping". +** +** Pretty cool algorithm: (* == zero'd bits) +** PERMH 01234567 -> 67452301 into %0 +** HSHL 67452301 -> 7*5*3*1* into %1 +** HSHR 67452301 -> *6*4*2*0 into %0 +** OR %0 | %1 -> 76543210 into %0 (all done!) +*/ +static __inline__ __const__ __u64 ___arch__swab64(__u64 x) { + __u64 temp; + __asm__("permh 3210, %0, %0\n\t" + "hshl %0, 8, %1\n\t" + "hshr u, %0, 8, %0\n\t" + "or %1, %0, %0" + : "=r" (x), "=&r" (temp) + : "0" (x)); + return x; +} +#define __arch__swab64(x) ___arch__swab64(x) +#else +static __inline__ __const__ __u64 ___arch__swab64(__u64 x) +{ + __u32 t1 = (__u32) x; + __u32 t2 = (__u32) ((x) >> 32); + ___arch__swab32(t1); + ___arch__swab32(t2); + return (((__u64) t1 << 32) + ((__u64) t2)); +} +#endif + + +static __inline__ __const__ __u16 ___arch__swab16(__u16 x) +{ + __asm__("dep %0, 15, 8, %0\n\t" /* deposit 00ab -> 0bab */ + "shd %r0, %0, 8, %0" /* shift 000000ab -> 00ba */ + : "=r" (x) + : "0" (x)); + return x; +} + +#define __arch__swab32(x) ___arch__swab32(x) +#define __arch__swab16(x) ___arch__swab16(x) + +#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) +# define __BYTEORDER_HAS_U64__ +# define __SWAB_64_THRU_32__ +#endif + +#endif /* __GNUC__ */ + +#include + +#endif /* _PARISC_BYTEORDER_H */ diff --git a/include/asm-parisc/cache.h b/include/asm-parisc/cache.h new file mode 100644 index 000000000..2460121b6 --- /dev/null +++ b/include/asm-parisc/cache.h @@ -0,0 +1,58 @@ +/* + * include/asm-parisc/cache.h + */ + +#ifndef __ARCH_PARISC_CACHE_H +#define __ARCH_PARISC_CACHE_H + +/* +** XXX FIXME : L1_CACHE_BYTES (cacheline size) should be a boot time thing. +** +** 32-bit on PA2.0 is not covered well by the #ifdef __LP64__ below. +** PA2.0 processors have 64-byte cachelines. +** +** The issue is mostly cacheline ping-ponging on SMP boxes. +** To avoid this, code should define stuff to be per CPU on cacheline +** aligned boundaries. This can make a 2x or more difference in perf +** depending on how badly the thrashing is. +** +** We don't need to worry about I/O since all PA2.0 boxes (except T600) +** are I/O coherent. That means flushing less than you needed to generally +** doesn't matter - the I/O MMU will read/modify/write the cacheline. +** +** (Digression: it is possible to program I/O MMU's to not first read +** a cacheline for inbound data - ie just grab ownership and start writing. +** While it improves I/O throughput, you gotta know the device driver +** is well behaved and can deal with the issues.) +*/ +#if defined(__LP64__) +#define L1_CACHE_BYTES 64 +#else +#define L1_CACHE_BYTES 32 +#endif + +#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) + +#define SMP_CACHE_BYTES L1_CACHE_BYTES + +#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES))) + +extern void init_cache(void); /* initializes cache-flushing */ +extern void flush_data_cache(void); /* flushes data-cache only */ +extern void flush_instruction_cache(void);/* flushes code-cache only */ +extern void flush_all_caches(void); /* flushes code and data-cache */ + +extern int get_cache_info(char *); + +extern struct pdc_cache_info cache_info; + +#define fdce(addr) asm volatile("fdce 0(%0)" : : "r" (addr)) +#define fice(addr) asm volatile("fice 0(%%sr1,%0)" : : "r" (addr)) + +#define pdtlbe(addr) asm volatile("pdtlbe 0(%%sr1,%0)" : : "r" (addr)) +#define pdtlb_kernel(addr) asm volatile("pdtlb 0(%0)" : : "r" (addr)); +#define pitlbe(addr) asm volatile("pitlbe 0(%%sr1,%0)" : : "r" (addr)) + +#define kernel_fdc(addr) asm volatile("fdc 0(%%sr0, %0)" : : "r" (addr)) + +#endif diff --git a/include/asm-parisc/checksum.h b/include/asm-parisc/checksum.h new file mode 100644 index 000000000..9088f9795 --- /dev/null +++ b/include/asm-parisc/checksum.h @@ -0,0 +1,174 @@ +#ifndef _PARISC_CHECKSUM_H +#define _PARISC_CHECKSUM_H + +/* + * computes the checksum of a memory block at buff, length len, + * and adds in "sum" (32-bit) + * + * returns a 32-bit number suitable for feeding into itself + * or csum_tcpudp_magic + * + * this function must be called with even lengths, except + * for the last fragment, which may be odd + * + * it's best to have buff aligned on a 32-bit boundary + */ +extern unsigned int csum_partial(const unsigned char *, int, unsigned int); + +/* + * the same as csum_partial, but copies from src while it + * checksums + * + * here even more important to align src and dst on a 32-bit (or even + * better 64-bit) boundary + */ +extern unsigned int csum_partial_copy(const char *, char *, int, unsigned int); + +/* + * the same as csum_partial, but copies from user space + * + * this is obsolete and will go away. + */ +#define csum_partial_copy_fromuser csum_partial_copy + +/* + * this is a new version of the above that records errors it finds in *errp, + * but continues and zeros the rest of the buffer. + */ +unsigned int csum_partial_copy_from_user(const char *src, char *dst, int len, unsigned int sum, int *errp); + +/* + * Note: when you get a NULL pointer exception here this means someone + * passed in an incorrect kernel address to one of these functions. + * + * If you use these functions directly please don't forget the + * verify_area(). + */ +extern __inline__ +unsigned int csum_partial_copy_nocheck (const char *src, char *dst, + int len, int sum) +{ + return csum_partial_copy (src, dst, len, sum); +} + +/* + * Optimized for IP headers, which always checksum on 4 octet boundaries. + * + * Written by Randolph Chung + */ +static inline unsigned short ip_fast_csum(unsigned char * iph, + unsigned int ihl) { + unsigned int sum; + + + __asm__ __volatile__ (" + ldws,ma 4(%1), %0 + addi -4, %2, %2 + comib,>= 0, %2, 2f + + ldws,ma 4(%1), %%r19 + add %0, %%r19, %0 + ldws,ma 4(%1), %%r19 + addc %0, %%r19, %0 + ldws,ma 4(%1), %%r19 + addc %0, %%r19, %0 +1: ldws,ma 4(%1), %%r19 + addib,<> -1, %2, 1b + addc %0, %%r19, %0 + addc %0, %%r0, %0 + + zdepi -1, 31, 16, %%r19 + and %0, %%r19, %%r20 + extru %0, 15, 16, %%r21 + add %%r20, %%r21, %0 + and %0, %%r19, %%r20 + extru %0, 15, 16, %%r21 + add %%r20, %%r21, %0 + subi -1, %0, %0 +2: + " + : "=r" (sum), "=r" (iph), "=r" (ihl) + : "1" (iph), "2" (ihl) + : "r19", "r20", "r21" ); + + return(sum); +} + +/* + * Fold a partial checksum + */ +static inline unsigned int csum_fold(unsigned int sum) +{ + sum = (sum & 0xffff) + (sum >> 16); + sum = (sum & 0xffff) + (sum >> 16); + return ~sum; +} + +static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, + unsigned long daddr, + unsigned short len, + unsigned short proto, + unsigned int sum) +{ + __asm__(" + add %1, %0, %0 + addc %2, %0, %0 + addc %3, %0, %0 + addc %%r0, %0, %0 " + : "=r" (sum) + : "r" (daddr), "r"(saddr), "r"((proto<<16)+len), "0"(sum)); + return sum; +} + +/* + * computes the checksum of the TCP/UDP pseudo-header + * returns a 16-bit checksum, already complemented + */ +static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, + unsigned long daddr, + unsigned short len, + unsigned short proto, + unsigned int sum) +{ + return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); +} + +/* + * this routine is used for miscellaneous IP-like checksums, mainly + * in icmp.c + */ +static inline unsigned short ip_compute_csum(unsigned char * buf, int len) { + return csum_fold (csum_partial(buf, len, 0)); +} + +#define _HAVE_ARCH_IPV6_CSUM +static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, + struct in6_addr *daddr, + __u16 len, + unsigned short proto, + unsigned int sum) +{ + BUG(); + return csum_fold(sum); +} + +/* + * Copy and checksum to user + */ +#define HAVE_CSUM_COPY_USER +static __inline__ unsigned int csum_and_copy_to_user (const char *src, char *dst, + int len, int sum, int *err_ptr) +{ + /* code stolen from include/asm-mips64 */ + sum = csum_partial(src, len, sum); + + if (copy_to_user(dst, src, len)) { + *err_ptr = -EFAULT; + return -1; + } + + return sum; +} + +#endif + diff --git a/include/asm-parisc/current.h b/include/asm-parisc/current.h new file mode 100644 index 000000000..f3452d340 --- /dev/null +++ b/include/asm-parisc/current.h @@ -0,0 +1,19 @@ +#ifndef _PARISC_CURRENT_H +#define _PARISC_CURRENT_H + +#include + +struct task_struct; + +static inline struct task_struct * get_current(void) +{ + struct task_struct *current; + + asm("copy 30,%0" : "=r" (current)); + + return (struct task_struct *)((long) current & ~(THREAD_SIZE-1)); +} + +#define current get_current() + +#endif /* !(_PARISC_CURRENT_H) */ diff --git a/include/asm-parisc/delay.h b/include/asm-parisc/delay.h new file mode 100644 index 000000000..705c4a792 --- /dev/null +++ b/include/asm-parisc/delay.h @@ -0,0 +1,45 @@ +#ifndef _PARISC_DELAY_H +#define _PARISC_DELAY_H + +#include /* for mfctl() */ +#include /* for boot_cpu_data */ + + +/* + * Copyright (C) 1993 Linus Torvalds + * + * Delay routines + */ + +extern unsigned long loops_per_sec; + +static __inline__ void __delay(unsigned long loops) { + asm volatile( + " .balignl 64,0x34000034 + addib,UV -1,%0,. + nop" + : "=r" (loops) : "0" (loops)); +} + +static __inline__ void __cr16_delay(unsigned long clocks) { + unsigned long start; + + /* + * Note: Due to unsigned math, cr16 rollovers shouldn't be + * a problem here. However, on 32 bit, we need to make sure + * we don't pass in too big a value. The current default + * value of MAX_UDELAY_MS should help prevent this. + */ + + start = mfctl(16); + while ((mfctl(16) - start) < clocks) + ; +} + +static __inline__ void __udelay(unsigned long usecs) { + __cr16_delay(usecs * ((unsigned long)boot_cpu_data.cpu_hz / 1000000UL)); +} + +#define udelay(n) __udelay(n) + +#endif /* defined(_PARISC_DELAY_H) */ diff --git a/include/asm-parisc/div64.h b/include/asm-parisc/div64.h new file mode 100644 index 000000000..e86e35e8a --- /dev/null +++ b/include/asm-parisc/div64.h @@ -0,0 +1,54 @@ +#ifndef __ASM_PARISC_DIV64 +#define __ASM_PARISC_DIV64 + +#ifdef __LP64__ + +/* + * Copyright (C) 1999 Hewlett-Packard Co + * Copyright (C) 1999 David Mosberger-Tang + * + * vsprintf uses this to divide a 64-bit integer N by a small integer BASE. + * This is incredibly hard on IA-64 and HPPA + */ + +#define do_div(n,base) \ +({ \ + int _res; \ + _res = ((unsigned long) (n)) % (unsigned) (base); \ + (n) = ((unsigned long) (n)) / (unsigned) (base); \ + _res; \ +}) + +#else +/* + * unsigned long long division. Yuck Yuck! What is Linux coming to? + * This is 100% disgusting + */ +#define do_div(n,base) \ +({ \ + unsigned long __low, __low2, __high, __rem; \ + __low = (n) & 0xffffffff; \ + __high = (n) >> 32; \ + if (__high) { \ + __rem = __high % (unsigned long)base; \ + __high = __high / (unsigned long)base; \ + __low2 = __low >> 16; \ + __low2 += __rem << 16; \ + __rem = __low2 % (unsigned long)base; \ + __low2 = __low2 / (unsigned long)base; \ + __low = __low & 0xffff; \ + __low += __rem << 16; \ + __rem = __low % (unsigned long)base; \ + __low = __low / (unsigned long)base; \ + n = __low + ((long long)__low2 << 16) + \ + ((long long) __high << 32); \ + } else { \ + __rem = __low % (unsigned long)base; \ + n = (__low / (unsigned long)base); \ + } \ + __rem; \ +}) +#endif + +#endif + diff --git a/include/asm-parisc/elf.h b/include/asm-parisc/elf.h new file mode 100644 index 000000000..c478db079 --- /dev/null +++ b/include/asm-parisc/elf.h @@ -0,0 +1,97 @@ +#ifndef __ASMPARISC_ELF_H +#define __ASMPARISC_ELF_H + +/* + * ELF register definitions.. + */ + +#include + +#define EM_PARISC 15 + +#define ELF_NGREG 32 +#define ELF_NFPREG 32 + +typedef unsigned long elf_greg_t; +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +typedef double elf_fpreg_t; +typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; + +#define ELF_CORE_COPY_REGS(gregs, regs) \ + memcpy(gregs, regs, \ + sizeof(struct pt_regs) < sizeof(elf_gregset_t)? \ + sizeof(struct pt_regs): sizeof(elf_gregset_t)); + +/* + * This is used to ensure we don't load something for the wrong architecture. + * + * Note that this header file is used by default in fs/binfmt_elf.c. So + * the following macros are for the default case. However, for the 64 + * bit kernel we also support 32 bit parisc binaries. To do that + * arch/parisc64/kernel/binfmt_elf32.c defines its own set of these + * macros, and then if includes fs/binfmt_elf.c to provide an alternate + * elf binary handler for 32 bit binaries (on the 64 bit kernel). + */ + +#ifdef __LP64__ +#define ELF_CLASS ELFCLASS64 +#else +#define ELF_CLASS ELFCLASS32 +#endif + +#define elf_check_arch(x) ((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELF_CLASS) + +/* + * These are used to set parameters in the core dumps. + */ +#define ELF_DATA ELFDATA2MSB +#define ELF_ARCH EM_PARISC + +/* %r23 is set by ld.so to a pointer to a function which might be + registered using atexit. This provides a mean for the dynamic + linker to call DT_FINI functions for shared libraries that have + been loaded before the code runs. + + So that we can use the same startup file with static executables, + we start programs with a value of 0 to indicate that there is no + such function. */ +#define ELF_PLAT_INIT(_r) _r->gr[23] = 0 + +#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 + the loader. We need to make sure that it is out of the way of the program + that it will "exec", and that there is sufficient room for the brk. + + (2 * TASK_SIZE / 3) turns into something undefined when run through a + 32 bit preprocessor and in some cases results in the kernel trying to map + ld.so to the kernel virtual base. Use a sane value instead. /Jes + */ + +#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x01000000) + +/* This yields a mask that user programs can use to figure out what + instruction set this CPU supports. This could be done in user space, + but it's not easy, and we've already done it here. */ + +#define ELF_HWCAP 0 +/* (boot_cpu_data.x86_capability) */ + +/* This yields a string that ld.so will use to load implementation + specific libraries for optimization. This is more specific in + intent than poking at uname or /proc/cpuinfo. + + For the moment, we have only optimizations for the Intel generations, + but that could change... */ + +#define ELF_PLATFORM ("PARISC\0" /*+((boot_cpu_data.x86-3)*5) */) + +#ifdef __KERNEL__ +#define SET_PERSONALITY(ex, ibcs2) \ + current->personality = PER_LINUX +#endif + +#endif diff --git a/include/asm-parisc/errno.h b/include/asm-parisc/errno.h new file mode 100644 index 000000000..b7348c553 --- /dev/null +++ b/include/asm-parisc/errno.h @@ -0,0 +1,147 @@ +#ifndef _PARISC_ERRNO_H +#define _PARISC_ERRNO_H + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No child processes */ +#define EAGAIN 11 /* Try again */ +#define ENOMEM 12 /* Out of memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Device or resource busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Math argument out of domain of func */ +#define ERANGE 34 /* Math result not representable */ +#define ENOMSG 35 /* No message of desired type */ +#define EIDRM 36 /* Identifier removed */ +#define ECHRNG 37 /* Channel number out of range */ +#define EL2NSYNC 38 /* Level 2 not synchronized */ +#define EL3HLT 39 /* Level 3 halted */ +#define EL3RST 40 /* Level 3 reset */ +#define ELNRNG 41 /* Link number out of range */ +#define EUNATCH 42 /* Protocol driver not attached */ +#define ENOCSI 43 /* No CSI structure available */ +#define EL2HLT 44 /* Level 2 halted */ +#define EDEADLK 45 /* Resource deadlock would occur */ +#define EDEADLOCK EDEADLK +#define ENOLCK 46 /* No record locks available */ +#define EILSEQ 47 /* Illegal byte sequence */ + +#define ENONET 50 /* Machine is not on the network */ +#define ENODATA 51 /* No data available */ +#define ETIME 52 /* Timer expired */ +#define ENOSR 53 /* Out of streams resources */ +#define ENOSTR 54 /* Device not a stream */ +#define ENOPKG 55 /* Package not installed */ + +#define ENOLINK 57 /* Link has been severed */ +#define EADV 58 /* Advertise error */ +#define ESRMNT 59 /* Srmount error */ +#define ECOMM 60 /* Communication error on send */ +#define EPROTO 61 /* Protocol error */ + +#define EMULTIHOP 64 /* Multihop attempted */ + +#define EDOTDOT 66 /* RFS specific error */ +#define EBADMSG 67 /* Not a data message */ +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Quota exceeded */ +#define ESTALE 70 /* Stale NFS file handle */ +#define EREMOTE 71 /* Object is remote */ +#define EOVERFLOW 72 /* Value too large for defined data type */ + +/* these errnos are defined by Linux but not HPUX. */ + +#define EBADE 160 /* Invalid exchange */ +#define EBADR 161 /* Invalid request descriptor */ +#define EXFULL 162 /* Exchange full */ +#define ENOANO 163 /* No anode */ +#define EBADRQC 164 /* Invalid request code */ +#define EBADSLT 165 /* Invalid slot */ +#define EBFONT 166 /* Bad font file format */ +#define ENOTUNIQ 167 /* Name not unique on network */ +#define EBADFD 168 /* File descriptor in bad state */ +#define EREMCHG 169 /* Remote address changed */ +#define ELIBACC 170 /* Can not access a needed shared library */ +#define ELIBBAD 171 /* Accessing a corrupted shared library */ +#define ELIBSCN 172 /* .lib section in a.out corrupted */ +#define ELIBMAX 173 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 174 /* Cannot exec a shared library directly */ +#define ERESTART 175 /* Interrupted system call should be restarted */ +#define ESTRPIPE 176 /* Streams pipe error */ +#define EUCLEAN 177 /* Structure needs cleaning */ +#define ENOTNAM 178 /* Not a XENIX named type file */ +#define ENAVAIL 179 /* No XENIX semaphores available */ +#define EISNAM 180 /* Is a named type file */ +#define EREMOTEIO 181 /* Remote I/O error */ +#define ENOMEDIUM 182 /* No medium found */ +#define EMEDIUMTYPE 183 /* Wrong medium type */ + +/* We now return you to your regularly scheduled HPUX. */ + +#define ENOSYM 215 /* symbol does not exist in executable */ +#define ENOTSOCK 216 /* Socket operation on non-socket */ +#define EDESTADDRREQ 217 /* Destination address required */ +#define EMSGSIZE 218 /* Message too long */ +#define EPROTOTYPE 219 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 220 /* Protocol not available */ +#define EPROTONOSUPPORT 221 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 222 /* Socket type not supported */ +#define EOPNOTSUPP 223 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 224 /* Protocol family not supported */ +#define EAFNOSUPPORT 225 /* Address family not supported by protocol */ +#define EADDRINUSE 226 /* Address already in use */ +#define EADDRNOTAVAIL 227 /* Cannot assign requested address */ +#define ENETDOWN 228 /* Network is down */ +#define ENETUNREACH 229 /* Network is unreachable */ +#define ENETRESET 230 /* Network dropped connection because of reset */ +#define ECONNABORTED 231 /* Software caused connection abort */ +#define ECONNRESET 232 /* Connection reset by peer */ +#define ENOBUFS 233 /* No buffer space available */ +#define EISCONN 234 /* Transport endpoint is already connected */ +#define ENOTCONN 235 /* Transport endpoint is not connected */ +#define ESHUTDOWN 236 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 237 /* Too many references: cannot splice */ +#define EREFUSED ECONNREFUSED /* for HP's NFS apparently */ +#define ETIMEDOUT 238 /* Connection timed out */ +#define ECONNREFUSED 239 /* Connection refused */ +#define EREMOTERELEASE 240 /* Remote peer released connection */ +#define EHOSTDOWN 241 /* Host is down */ +#define EHOSTUNREACH 242 /* No route to host */ + +#define EALREADY 244 /* Operation already in progress */ +#define EINPROGRESS 245 /* Operation now in progress */ +#define EWOULDBLOCK 246 /* Operation would block (Linux returns EAGAIN) */ +#define ENOTEMPTY 247 /* Directory not empty */ +#define ENAMETOOLONG 248 /* File name too long */ +#define ELOOP 249 /* Too many symbolic links encountered */ +#define ENOSYS 251 /* Function not implemented */ + +#define ENOTSUP 252 /* Function not implemented (POSIX.4 / HPUX) */ +#define ECANCELLED 253 /* aio request was canceled before complete (POSIX.4 / HPUX) */ + + +#endif diff --git a/include/asm-parisc/fcntl.h b/include/asm-parisc/fcntl.h new file mode 100644 index 000000000..94fa13fa5 --- /dev/null +++ b/include/asm-parisc/fcntl.h @@ -0,0 +1,90 @@ +#ifndef _PARISC_FCNTL_H +#define _PARISC_FCNTL_H + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 00000003 +#define O_RDONLY 00000000 +#define O_WRONLY 00000001 +#define O_RDWR 00000002 +#define O_APPEND 00000010 +#define O_BLKSEEK 00000100 /* HPUX only */ +#define O_CREAT 00000400 /* not fcntl */ +#define O_TRUNC 00001000 /* not fcntl */ +#define O_EXCL 00002000 /* not fcntl */ +#define O_LARGEFILE 00004000 +#define O_SYNC 00100000 +#define O_NONBLOCK 00200004 /* HPUX has separate NDELAY & NONBLOCK */ +#define O_NDELAY O_NONBLOCK +#define O_NOCTTY 00400000 /* not fcntl */ +#define O_DSYNC 01000000 /* HPUX only */ +#define O_RSYNC 02000000 /* HPUX only */ + +#define FASYNC 00020000 /* fcntl, for BSD compatibility */ +#define O_DIRECT 00040000 /* direct disk access hint - currently ignored */ +#define O_DIRECTORY 00010000 /* must be a directory */ +#define O_NOFOLLOW 00000200 /* don't follow links */ + +#define F_DUPFD 0 /* dup */ +#define F_GETFD 1 /* get f_flags */ +#define F_SETFD 2 /* set f_flags */ +#define F_GETFL 3 /* more flags (cloexec) */ +#define F_SETFL 4 +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 +#define F_GETLK64 8 +#define F_SETLK64 9 +#define F_SETLKW64 10 + +#define F_GETOWN 11 /* for sockets. */ +#define F_SETOWN 12 /* for sockets. */ +#define F_SETSIG 13 /* for sockets. */ +#define F_GETSIG 14 /* for sockets. */ + +/* for F_[GET|SET]FL */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* for posix fcntl() and lockf() */ +#define F_RDLCK 01 +#define F_WRLCK 02 +#define F_UNLCK 03 + +/* for old implementation of bsd flock () */ +#define F_EXLCK 4 /* or 3 */ +#define F_SHLCK 8 /* or 4 */ + +/* for leases */ +#define F_INPROGRESS 16 + +/* operations for bsd flock(), also used by the kernel implementation */ +#define LOCK_SH 1 /* shared lock */ +#define LOCK_EX 2 /* exclusive lock */ +#define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +#define LOCK_UN 8 /* remove lock */ + +#define LOCK_MAND 32 /* This is a mandatory flock */ +#define LOCK_READ 64 /* ... Which allows concurrent read operations */ +#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */ +#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */ + +struct flock { + short l_type; + short l_whence; + off_t l_start; + off_t l_len; + pid_t l_pid; +}; + +struct flock64 { + short l_type; + short l_whence; + loff_t l_start; + loff_t l_len; + pid_t l_pid; +}; + +#define F_LINUX_SPECIFIC_BASE 1024 + +#endif diff --git a/include/asm-parisc/fixmap.h b/include/asm-parisc/fixmap.h new file mode 100644 index 000000000..013ea2182 --- /dev/null +++ b/include/asm-parisc/fixmap.h @@ -0,0 +1,8 @@ +#ifndef _ASM_FIXMAP_H +#define _ASM_FIXMAP_H + +#define FIXADDR_TOP (0xffffe000UL) +#define FIXADDR_SIZE (0 << PAGE_SHIFT) +#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) + +#endif diff --git a/include/asm-parisc/gsc.h b/include/asm-parisc/gsc.h new file mode 100644 index 000000000..0cf1e6d68 --- /dev/null +++ b/include/asm-parisc/gsc.h @@ -0,0 +1,79 @@ +#ifndef ASM_PARISC_GSC_H +#define ASM_PARISC_GSC_H +#ifdef __KERNEL__ + +#include +#include /* for struct hp_device */ + +/* + * The convention used for inb/outb etc. is that names starting with + * two underscores are the inline versions, names starting with a + * single underscore are proper functions, and names starting with a + * letter are macros that map in some way to inline or proper function + * versions. Not all that pretty, but before you change it, be sure + * to convince yourself that it won't break anything (in particular + * module support). + */ +extern u8 _gsc_readb(void *); +extern u16 _gsc_readw(void *); +extern u32 _gsc_readl(void *); +extern u64 _gsc_readq(void *); +extern void _gsc_writeb(u8, void *); +extern void _gsc_writew(u16,void *); +extern void _gsc_writel(u32,void *); +extern void _gsc_writeq(u64,void *); + +#define gsc_readb(a) _gsc_readb((void *)(a)) +#define gsc_readw(a) _gsc_readw((void *)(a)) +#define gsc_readl(a) _gsc_readl((void *)(a)) +#define gsc_readq(a) _gsc_readq((void *)(a)) +#define gsc_writeb(v,a) _gsc_writeb((v),(void *)(a)) +#define gsc_writew(v,a) _gsc_writew((v),(void *)(a)) +#define gsc_writel(v,a) _gsc_writel((v),(void *)(a)) +#define gsc_writeq(v,a) _gsc_writeq((v),(void *)(a)) + +struct gsc_dev { + struct gsc_bus *bus; /* bus this device is on */ + struct gsc_dev *next; /* chain of all devices */ + struct gsc_dev *next_bus; /* chain of all devices on a bus */ + struct gsc_dev *next_submod; /* chain of all devices on a module */ + + unsigned irq; /* irq generated by this device */ + void *hpa; /* hard physical address */ + + u16 hversion; + u8 spa; /* SPA requirements */ + u8 type; + u32 sversion; +}; + +struct gsc_irq { + unsigned long txn_addr; /* IRQ "target" */ + int txn_data; /* HW "IRQ" */ + int irq; /* virtual IRQ */ +}; + +/* PA I/O Architected devices support at least 5 bits in the EIM register. */ +#define GSC_EIM_WIDTH 5 + +extern int gsc_alloc_irq(struct gsc_irq *dev); /* dev needs an irq */ +extern int gsc_claim_irq(struct gsc_irq *dev, int irq); /* dev needs this irq */ + +struct gsc_bus { + void *hpa; /* HPA of device 0, function 0 of this bus */ +}; + +/* + * There is one gsc_dev structure for each slot-number/function-number + * combination: + */ + +struct gsc_dev *gsc_find_device(u16 hversion, struct gsc_dev *from); + +extern void probe_serial_gsc(void); + +/* returns a virtual irq for device at dev->hpa (works for all LASI/ASP/WAX) */ +extern int busdevice_alloc_irq( struct hp_device *dev ); + +#endif /* __KERNEL__ */ +#endif /* LINUX_GSC_H */ diff --git a/include/asm-parisc/hardirq.h b/include/asm-parisc/hardirq.h new file mode 100644 index 000000000..2c717bfd5 --- /dev/null +++ b/include/asm-parisc/hardirq.h @@ -0,0 +1,87 @@ +/* hardirq.h: 32-bit Sparc hard IRQ support. + * + * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) + * Copyright (C) 1998-99 Anton Blanchard (anton@progsoc.uts.edu.au) + */ + +#ifndef __PARISC_HARDIRQ_H +#define __PARISC_HARDIRQ_H + +#include +#include + +typedef struct { + unsigned int __softirq_active; + unsigned int __softirq_mask; + unsigned int __local_irq_count; + unsigned int __local_bh_count; + unsigned int __syscall_count; +} ____cacheline_aligned irq_cpustat_t; + +#include /* Standard mappings for irq_cpustat_t above */ + +/* + * Are we in an interrupt context? Either doing bottom half + * or hardware interrupt processing? + */ +#define in_interrupt() ({ int __cpu = smp_processor_id(); \ + (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); }) + +#define in_irq() ({ int __cpu = smp_processor_id(); \ + (local_irq_count(__cpu) != 0); }) + +#ifndef CONFIG_SMP + +#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0) +#define hardirq_endlock(cpu) do { } while (0) + +#define irq_enter(cpu, irq) (local_irq_count(cpu)++) +#define irq_exit(cpu, irq) (local_irq_count(cpu)--) + +#define synchronize_irq() barrier() + +#else + +#include +#include +#include +#include + +extern unsigned char global_irq_holder; +extern spinlock_t global_irq_lock; +extern atomic_t global_irq_count; + +static inline void release_irqlock(int cpu) +{ + /* if we didn't own the irq lock, just ignore.. */ + if (global_irq_holder == (unsigned char) cpu) { + global_irq_holder = NO_PROC_ID; + spin_unlock(&global_irq_lock); + } +} + +static inline void irq_enter(int cpu) +{ + ++local_irq_count(cpu); + atomic_inc(&global_irq_count); +} + +static inline void irq_exit(int cpu) +{ + atomic_dec(&global_irq_count); + --local_irq_count(cpu); +} + +static inline int hardirq_trylock(int cpu) +{ + return (! atomic_read(&global_irq_count) && + ! spin_is_locked (&global_irq_lock)); +} + +#define hardirq_endlock(cpu) do { } while (0) + +extern void synchronize_irq(void); + +#endif /* CONFIG_SMP */ + +#endif /* __PARISC_HARDIRQ_H */ diff --git a/include/asm-parisc/hardware.h b/include/asm-parisc/hardware.h new file mode 100644 index 000000000..c44e941ad --- /dev/null +++ b/include/asm-parisc/hardware.h @@ -0,0 +1,103 @@ +#ifndef _PARISC_HP_MACHINES_H_ +#define _PARISC_HP_MACHINES_H_ + +struct hp_hardware { + unsigned short hw_type:5; /* HPHW_xxx */ + unsigned short hversion; + unsigned long sversion:28; + unsigned short opt; + char *name; +}; + +struct hp_device { + unsigned short hw_type:5; /* HPHW_xxx */ + unsigned short hversion; /* HP-UX uses hv_model:12 */ + unsigned int sversion; /* HP-UX uses sv_model:20 sv_opt:8 */ + unsigned short opt; + unsigned int hversion_rev; + unsigned int sversion_rev; + struct hp_hardware * reference; /* This is a pointer to the + reference */ + unsigned int managed; /* this is if the device has a driver for it */ + void * hpa; + +#ifdef __LP64__ + /* parms for pdc_pat_cell_module() call */ + unsigned long pcell_loc; /* Physical Cell location */ + unsigned long mod_index; /* PAT specific - Misc Module info */ + + /* generic info returned from pdc_pat_cell_module() */ + unsigned long mod_info; /* PAT specific - Misc Module info */ + unsigned long pmod_loc; /* physical Module location */ + unsigned long mod_path; /* Module HW path */ +#endif +}; + +enum cpu_type { + pcx = 0, /* pa7000 pa 1.0 */ + pcxs = 1, /* pa7000 pa 1.1a */ + pcxt = 2, /* pa7100 pa 1.1b */ + pcxt_ = 3, /* pa7200 (t') pa 1.1c */ + pcxl = 4, /* pa7100lc pa 1.1d */ + pcxl2 = 5, /* pa7300lc pa 1.1e */ + pcxu = 6, /* pa8000 pa 2.0 */ + pcxu_ = 7, /* pa8200 (u+) pa 2.0 */ + pcxw = 8, /* pa8500 pa 2.0 */ + pcxw_ = 9 /* pa8600 (w+) pa 2.0 */ +}; + +extern char *cpu_name_version[][2]; /* mapping from enum cpu_type to strings */ + +struct pa_iodc_driver { + unsigned short hw_type:5; /* HPHW_xxx */ + unsigned short hversion; + unsigned short hversion_rev; + unsigned long sversion:28; + unsigned short sversion_rev; + unsigned short opt; + unsigned int check; /* Components that are significant */ + char *name; + char *version; + int (* callback)(struct hp_device *d, struct pa_iodc_driver *dri); +}; + +#define DRIVER_CHECK_HWTYPE 1 +#define DRIVER_CHECK_HVERSION 2 +#define DRIVER_CHECK_SVERSION 4 +#define DRIVER_CHECK_OPT 8 +/* The following two are useless right now */ +#define DRIVER_CHECK_HVERSION_REV 16 +#define DRIVER_CHECK_SVERSION_REV 32 +#define DRIVER_CHECK_EVERYTHING 63 + + +#define HPHW_NPROC 0 +#define HPHW_MEMORY 1 +#define HPHW_B_DMA 2 +#define HPHW_OBSOLETE 3 +#define HPHW_A_DMA 4 +#define HPHW_A_DIRECT 5 +#define HPHW_OTHER 6 +#define HPHW_BCPORT 7 +#define HPHW_CIO 8 +#define HPHW_CONSOLE 9 +#define HPHW_FIO 10 +#define HPHW_BA 11 +#define HPHW_IOA 12 +#define HPHW_BRIDGE 13 +#define HPHW_FABRIC 14 +#define HPHW_FAULTY 31 + +extern struct hp_hardware hp_hardware_list[]; + +char *parisc_getHWtype( unsigned short hw_type ); + +/* Attention: first hversion, then sversion...! */ +char *parisc_getHWdescription( unsigned short hw_type, + unsigned long hversion, /* have to be long ! */ + unsigned long sversion ); + +enum cpu_type parisc_get_cpu_type( unsigned long hversion ); + +extern int register_driver(struct pa_iodc_driver *driver); +#endif diff --git a/include/asm-parisc/hdreg.h b/include/asm-parisc/hdreg.h new file mode 100644 index 000000000..629b220f2 --- /dev/null +++ b/include/asm-parisc/hdreg.h @@ -0,0 +1,6 @@ +#ifndef _ASM_HDREG_H +#define _ASM_HDREG_H + +typedef unsigned short ide_ioreg_t; + +#endif diff --git a/include/asm-parisc/hil.h b/include/asm-parisc/hil.h new file mode 100644 index 000000000..9112f9bf5 --- /dev/null +++ b/include/asm-parisc/hil.h @@ -0,0 +1,26 @@ +#ifndef _ASM_HIL_H +#define _ASM_HIL_H + +/* + * linux/asm-parisc/hil.h + * + * (c) 1999 Matthew Wilcox + */ + +extern unsigned long hil_base; /* declared in drivers/gsc/hil.c */ +extern unsigned int hil_irq; + +#define HILBASE hil_base /* 0xf0821000 (old) or 0xf0201000 (new) */ +#define HIL_DATA 0x800 +#define HIL_CMD 0x801 + +#define HIL_IRQ hil_irq + +#define hil_busy() (gsc_readb(HILBASE + HIL_CMD) & HIL_BUSY) +#define hil_data_available() (gsc_readb(HILBASE + HIL_CMD) & HIL_DATA_RDY) +#define hil_status() (gsc_readb(HILBASE + HIL_CMD)) +#define hil_command(x) do { gsc_writeb((x), HILBASE + HIL_CMD); } while (0) +#define hil_read_data() (gsc_readb(HILBASE + HIL_DATA)) +#define hil_write_data(x) do { gsc_writeb((x), HILBASE + HIL_DATA); } while (0) + +#endif diff --git a/include/asm-parisc/hw_irq.h b/include/asm-parisc/hw_irq.h new file mode 100644 index 000000000..f35c91da6 --- /dev/null +++ b/include/asm-parisc/hw_irq.h @@ -0,0 +1,17 @@ +#ifndef _ASM_HW_IRQ_H +#define _ASM_HW_IRQ_H + +/* + * linux/include/asm/hw_irq.h + * + * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar + * + * moved some of the old arch/i386/kernel/irq.h to here. VY + * + * IRQ/IPI changes taken from work by Thomas Radke + * + */ + +#include + +#endif diff --git a/include/asm-parisc/ide.h b/include/asm-parisc/ide.h new file mode 100644 index 000000000..08d1c9408 --- /dev/null +++ b/include/asm-parisc/ide.h @@ -0,0 +1,111 @@ +/* + * linux/include/asm-parisc/ide.h + * + * Copyright (C) 1994-1996 Linus Torvalds & authors + */ + +/* + * This file contains the i386 architecture specific IDE code. + */ + +#ifndef __ASMi386_IDE_H +#define __ASMi386_IDE_H + +#ifdef __KERNEL__ + +#include + +#ifndef MAX_HWIFS +#define MAX_HWIFS 10 +#endif + +#define ide__sti() __sti() + +static __inline__ int ide_default_irq(ide_ioreg_t base) +{ + switch (base) { + case 0x1f0: return 14; + case 0x170: return 15; + case 0x1e8: return 11; + case 0x168: return 10; + case 0x1e0: return 8; + case 0x160: return 12; + default: + return 0; + } +} + +static __inline__ ide_ioreg_t ide_default_io_base(int index) +{ + switch (index) { + case 0: return 0x1f0; + case 1: return 0x170; + case 2: return 0x1e8; + case 3: return 0x168; + case 4: return 0x1e0; + case 5: return 0x160; + default: + return 0; + } +} + +static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq) +{ + ide_ioreg_t reg = data_port; + int i; + + for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { + hw->io_ports[i] = reg; + reg += 1; + } + if (ctrl_port) { + hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; + } else { + hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206; + } + if (irq != NULL) + *irq = 0; +} + +static __inline__ void ide_init_default_hwifs(void) +{ +#ifndef CONFIG_BLK_DEV_IDEPCI + hw_regs_t hw; + int index; + + for(index = 0; index < MAX_HWIFS; index++) { + ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL); + hw.irq = ide_default_irq(ide_default_io_base(index)); + ide_register_hw(&hw, NULL); + } +#endif /* CONFIG_BLK_DEV_IDEPCI */ +} + +typedef union { + unsigned all : 8; /* all of the bits together */ + struct { + unsigned head : 4; /* always zeros here */ + unsigned unit : 1; /* drive select number, 0 or 1 */ + unsigned bit5 : 1; /* always 1 */ + unsigned lba : 1; /* using LBA instead of CHS */ + unsigned bit7 : 1; /* always 1 */ + } b; + } select_t; + +#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 + */ +#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__ */ + +#endif /* __ASMi386_IDE_H */ diff --git a/include/asm-parisc/io.h b/include/asm-parisc/io.h new file mode 100644 index 000000000..ca40fdf2d --- /dev/null +++ b/include/asm-parisc/io.h @@ -0,0 +1,61 @@ +#ifndef _ASM_IO_H +#define _ASM_IO_H + +#include +#include +#include + +#define virt_to_phys(a) ((unsigned long)__pa(a)) +#define phys_to_virt(a) __va(a) +#define virt_to_bus virt_to_phys +#define bus_to_virt phys_to_virt + +#define inb_p inb +#define inw_p inw +#define inl_p inl +#define outb_p outb +#define outw_p outw +#define outl_p outl + +#define readb gsc_readb +#define readw gsc_readw +#define readl gsc_readl +#define writeb gsc_writeb +#define writew gsc_writew +#define writel gsc_writel + + +#if defined(CONFIG_PCI) || defined(CONFIG_ISA) +/* + * So we get clear link errors + */ +extern u8 inb(unsigned long addr); +extern u16 inw(unsigned long addr); +extern u32 inl(unsigned long addr); + +extern void outb(unsigned char b, unsigned long addr); +extern void outw(unsigned short b, unsigned long addr); +extern void outl(u32 b, unsigned long addr); + +static inline void memcpy_toio(void *dest, void *src, int count) +{ + while(count--) + writeb(*((char *)src)++, (char *)dest++); +} + +#endif + +/* IO Port space is : BBiiii where BB is HBA number. */ +#define IO_SPACE_LIMIT 0x00ffffff + +/* Right now we don't support Dino-on-a-card and V class which do PCI MMIO + * through address/data registers. */ + +#define ioremap(__offset, __size) ((void *)(__offset)) +#define iounmap(__addr) + +#define dma_cache_inv(_start,_size) do { flush_kernel_dcache_range(_start,_size); } while(0) +#define dma_cache_wback(_start,_size) do { flush_kernel_dcache_range(_start,_size); } while (0) +#define dma_cache_wback_inv(_start,_size) do { flush_kernel_dcache_range(_start,_size); } while (0) + +#endif diff --git a/include/asm-parisc/ioctl.h b/include/asm-parisc/ioctl.h new file mode 100644 index 000000000..ff78546f6 --- /dev/null +++ b/include/asm-parisc/ioctl.h @@ -0,0 +1,67 @@ +/* $Id: ioctl.h,v 1.2 1999/12/29 22:18:15 willy Exp $ + * + * linux/ioctl.h for Linux by H.H. Bergman. + */ + +#ifndef _ASM_PARISC_IOCTL_H +#define _ASM_PARISC_IOCTL_H + +/* ioctl command encoding: 32 bits total, command in lower 16 bits, + * size of the parameter structure in the lower 14 bits of the + * upper 16 bits. + * Encoding the size of the parameter structure in the ioctl request + * is useful for catching programs compiled with old versions + * and to avoid overwriting user space outside the user buffer area. + * The highest 2 bits are reserved for indicating the ``access mode''. + * NOTE: This limits the max parameter size to 16kB -1 ! + */ + +#define _IOC_NRBITS 8 +#define _IOC_TYPEBITS 8 +#define _IOC_SIZEBITS 14 +#define _IOC_DIRBITS 2 + +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) + +#define _IOC_NRSHIFT 0 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) + +/* + * Direction bits. + */ +#define _IOC_NONE 0U +#define _IOC_WRITE 2U +#define _IOC_READ 1U + +#define _IOC(dir,type,nr,size) \ + (((dir) << _IOC_DIRSHIFT) | \ + ((type) << _IOC_TYPESHIFT) | \ + ((nr) << _IOC_NRSHIFT) | \ + ((size) << _IOC_SIZESHIFT)) + +/* used to create numbers */ +#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) +#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) +#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) +#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) + +/* used to decode ioctl numbers.. */ +#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) +#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) +#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) +#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) + +/* ...and for the drivers/sound files... */ + +#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) +#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) +#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) +#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) +#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) + +#endif /* _ASM_PARISC_IOCTL_H */ diff --git a/include/asm-parisc/ioctls.h b/include/asm-parisc/ioctls.h new file mode 100644 index 000000000..332027f38 --- /dev/null +++ b/include/asm-parisc/ioctls.h @@ -0,0 +1,82 @@ +#ifndef __ARCH_PARISC_IOCTLS_H__ +#define __ARCH_PARISC_IOCTLS_H__ + +#include + +/* 0x54 is just a magic number to make these relatively unique ('T') */ + +#define TCGETS _IOR('T', 16, struct termios) /* TCGETATTR */ +#define TCSETS _IOW('T', 17, struct termios) /* TCSETATTR */ +#define TCSETSW _IOW('T', 18, struct termios) /* TCSETATTRD */ +#define TCSETSF _IOW('T', 19, struct termios) /* TCSETATTRF */ +#define TCGETA _IOR('T', 1, struct termio) +#define TCSETA _IOW('T', 2, struct termio) +#define TCSETAW _IOW('T', 3, struct termio) +#define TCSETAF _IOW('T', 4, struct termio) +#define TCSBRK _IO('T', 5) +#define TCXONC _IO('T', 6) +#define TCFLSH _IO('T', 7) +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E +#define TIOCGPGRP _IOR('T', 30, int) +#define TIOCSPGRP _IOW('T', 29, int) +#define TIOCOUTQ 0x5411 +#define TIOCSTI 0x5412 +#define TIOCGWINSZ 0x5413 +#define TIOCSWINSZ 0x5414 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define FIONREAD 0x541B +#define TIOCINQ FIONREAD +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +#define FIONBIO 0x5421 +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ +#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ +#define TIOCSBRK 0x5427 /* BSD compatibility */ +#define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID _IOR('T', 20, int) /* Return the session ID of FD */ +#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ +#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ + +#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ +#define FIOCLEX 0x5451 +#define FIOASYNC 0x5452 +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ +#define TIOCSERGETLSR 0x5459 /* Get line status register */ +#define TIOCSERGETMULTI 0x545A /* Get multiport config */ +#define TIOCSERSETMULTI 0x545B /* Set multiport config */ + +#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ +#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ +#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */ +#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */ + +/* Used for packet mode */ +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 + +#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ + +#endif /* _ASM_PARISC_IOCTLS_H */ diff --git a/include/asm-parisc/iosapic.h b/include/asm-parisc/iosapic.h new file mode 100644 index 000000000..d22509fb0 --- /dev/null +++ b/include/asm-parisc/iosapic.h @@ -0,0 +1,53 @@ +/* +** This file is private to iosapic driver. +** If stuff needs to be used by another driver, move it to a common file. +** +** WARNING: fields most data structures here are ordered to make sure +** they pack nicely for 64-bit compilation. (ie sizeof(long) == 8) +*/ + + +/* +** I/O SAPIC init function +** Caller knows where an I/O SAPIC is. LBA has an integrated I/O SAPIC. +** Call setup as part of per instance initialization. +** (ie *not* init_module() function unless only one is present.) +** fixup_irq is to initialize PCI IRQ line support and +** virtualize pcidev->irq value. To be called by pci_fixup_bus(). +*/ +extern void *iosapic_register(void *hpa); +extern int iosapic_fixup_irq(void *obj, struct pci_dev *pcidev); + + +#ifdef __IA64__ +/* +** PA: PIB (Processor Interrupt Block) is handled by Runway bus adapter. +** and is hardcoded to 0xfeeNNNN0 where NNNN is id_eid field. +** +** IA64: PIB is handled by "Local SAPIC" (integrated in the processor). +*/ +struct local_sapic_info { + struct local_sapic_info *lsi_next; /* point to next CPU info */ + int *lsi_cpu_id; /* point to logical CPU id */ + unsigned long *lsi_id_eid; /* point to IA-64 CPU id */ + int *lsi_status; /* point to CPU status */ + void *lsi_private; /* point to special info */ +}; + +/* +** "root" data structure which ties everything together. +** Should always be able to start with sapic_root and locate +** the desired information. +*/ +struct sapic_info { + struct sapic_info *si_next; /* info is per cell */ + int si_cellid; /* cell id */ + unsigned int si_status; /* status */ + char *si_pib_base; /* intr blk base address */ + local_sapic_info_t *si_local_info; + io_sapic_info_t *si_io_info; + extint_info_t *si_extint_info;/* External Intr info */ +}; + +#endif /* IA64 */ + diff --git a/include/asm-parisc/ipcbuf.h b/include/asm-parisc/ipcbuf.h new file mode 100644 index 000000000..f576ce5e0 --- /dev/null +++ b/include/asm-parisc/ipcbuf.h @@ -0,0 +1,11 @@ +#ifndef __PARISC_IPCBUF_H__ +#define __PARISC_IPCBUF_H__ + +/* + * The ipc64_perm structure for PA-RISC is identical to kern_ipc_perm + * as we have always had 32-bit UIDs and GIDs in the kernel. + */ + +#define ipc64_perm kern_ipc_perm + +#endif /* __PARISC_IPCBUF_H__ */ diff --git a/include/asm-parisc/irq.h b/include/asm-parisc/irq.h new file mode 100644 index 000000000..b52415f41 --- /dev/null +++ b/include/asm-parisc/irq.h @@ -0,0 +1,89 @@ +#ifndef _ASM_IRQ_H +#define _ASM_IRQ_H + +#include +#include +#include + +#include +/* + * linux/include/asm/irq.h + * + * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar, + * Copyright 1999 SuSE GmbH + * + * IRQ/IPI changes taken from work by Thomas Radke + * + */ + +#define CPU_IRQ_REGION 1 +#define TIMER_IRQ (IRQ_FROM_REGION(CPU_IRQ_REGION) | 0) +#define IPI_IRQ (IRQ_FROM_REGION(CPU_IRQ_REGION) | 1) + +/* This should be 31 for PA1.1 binaries and 63 for PA-2.0 wide mode) */ +#define MAX_CPU_IRQ (BITS_PER_LONG - 1) + +#if 1 /* set to 1 to get the new irq offsets, or ... */ +# if BITS_PER_LONG == 32 +# define IRQ_REGION_SHIFT 5 +# else +# define IRQ_REGION_SHIFT 6 +# endif +#else /* 256 irq-entries per region (wastes memory, maybe gains speed? :-))*/ +# define IRQ_REGION_SHIFT 8 +#endif + +#define IRQ_PER_REGION (1 << IRQ_REGION_SHIFT) +#define NR_IRQ_REGS 8 +#define NR_IRQS (NR_IRQ_REGS * IRQ_PER_REGION) + +#define IRQ_REGION(irq) ((irq) >> IRQ_REGION_SHIFT) +#define IRQ_OFFSET(irq) ((irq) & ((1< + * portions copyright (1999) The Puffin Group + * mostly rewritten by Philipp Rumpf , + * Copyright 2000 Philipp Rumpf + */ + +/* + * We try to keep the amount of generic code as low as possible - + * we want to support all HIL, PS/2, and untranslated USB keyboards + */ + +#ifndef _PARISC_KEYBOARD_H +#define _PARISC_KEYBOARD_H + +#include + +#ifdef __KERNEL__ +#ifdef CONFIG_VT + +/* These are basically the generic functions / variables. The only + * unexpected detail is the initialization sequence for the keyboard + * driver is something like this: + * + * detect keyboard port + * detect keyboard + * call register_kbd_ops + * wait for init_hw + * + * only after init_hw has been called you're allowed to call + * handle_scancode. This means you either have to be extremely + * careful or use a global flag or something - I strongly suggest + * the latter. prumpf */ + +extern struct kbd_ops { + int (*setkeycode)(unsigned int, unsigned int); + int (*getkeycode)(unsigned int); + int (*translate)(unsigned char, unsigned char *, char); + char (*unexpected_up)(unsigned char); + void (*leds)(unsigned char); + void (*init_hw)(void); + + unsigned char sysrq_key; + unsigned char *sysrq_xlate; +} *kbd_ops; + +#define kbd_setkeycode (*kbd_ops->setkeycode) +#define kbd_getkeycode (*kbd_ops->getkeycode) +#define kbd_translate (*kbd_ops->translate) +#define kbd_unexpected_up (*kbd_ops->unexpected_up) +#define kbd_leds (*kbd_ops->leds) +#define kbd_init_hw (*kbd_ops->init_hw) + +#define SYSRQ_KEY (kbd_ops->sysrq_key) +#define kbd_sysrq_xlate (kbd_ops->sysrq_xlate) +extern unsigned char hp_ps2kbd_sysrq_xlate[128]; /* from drivers/char/hp_keyb.c */ + +extern void register_kbd_ops(struct kbd_ops *ops); + +#endif /* CONFIG_VT */ + +#endif /* __KERNEL__ */ + +#endif /* __ASMPARISC_KEYBOARD_H */ diff --git a/include/asm-parisc/led.h b/include/asm-parisc/led.h new file mode 100644 index 000000000..e4c9b2cc5 --- /dev/null +++ b/include/asm-parisc/led.h @@ -0,0 +1,33 @@ +#ifndef LED_H +#define LED_H + + +#define LED7 0x80 /* top (or furthest right) LED */ +#define LED6 0x40 +#define LED5 0x20 +#define LED4 0x10 +#define LED3 0x08 +#define LED2 0x04 +#define LED1 0x02 +#define LED0 0x01 /* bottom (or furthest left) LED */ + +#define LED_LAN_TX LED0 /* for LAN transmit activity */ +#define LED_LAN_RCV LED1 /* for LAN receive activity */ +#define LED_DISK_IO LED2 /* for disk activity */ +#define LED_HEARTBEAT LED3 /* heartbeat */ + + +/* irq function */ +extern void led_interrupt_func(void); + +/* LASI & ASP specific LED initialization funcs */ +extern void __init lasi_led_init( unsigned long lasi_hpa ); +extern void __init asp_led_init( unsigned long led_ptr ); + +/* registers the LED regions for procfs */ +extern void __init register_led_regions(void); + +/* main LED initialization function (uses the PDC) */ +extern int __init led_init(void); + +#endif /* LED_H */ diff --git a/include/asm-parisc/linux_logo.h b/include/asm-parisc/linux_logo.h new file mode 100644 index 000000000..f431e4256 --- /dev/null +++ b/include/asm-parisc/linux_logo.h @@ -0,0 +1,48 @@ +/* $Id: linux_logo.h,v 1.1.1.1 1999/03/15 19:41:01 pjlahaie Exp $ + * include/asm-parisc/linux_logo.h: This is a linux logo + * to be displayed on boot. + * + * Copyright (C) 1996 Larry Ewing (lewing@isc.tamu.edu) + * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) + * + * You can put anything here, but: + * LINUX_LOGO_COLORS has to be less than 224 + * image size has to be 80x80 + * values have to start from 0x20 + * (i.e. RGB(linux_logo_red[0], + * linux_logo_green[0], + * linux_logo_blue[0]) is color 0x20) + * BW image has to be 80x80 as well, with MS bit + * on the left + * Serial_console ascii image can be any size, + * but should contain %s to display the version + */ + +#include +#include + +#define linux_logo_banner "Linux/PA-RISC version " UTS_RELEASE + +#define LINUX_LOGO_COLORS 214 + +#ifdef INCLUDE_LINUX_LOGO_DATA + +#define INCLUDE_LINUX_LOGOBW +#define INCLUDE_LINUX_LOGO16 + +#include + +#else + +/* prototypes only */ +extern unsigned char linux_logo_red[]; +extern unsigned char linux_logo_green[]; +extern unsigned char linux_logo_blue[]; +extern unsigned char linux_logo[]; +extern unsigned char linux_logo_bw[]; +extern unsigned char linux_logo16_red[]; +extern unsigned char linux_logo16_green[]; +extern unsigned char linux_logo16_blue[]; +extern unsigned char linux_logo16[]; + +#endif diff --git a/include/asm-parisc/machdep.h b/include/asm-parisc/machdep.h new file mode 100644 index 000000000..a231c97d7 --- /dev/null +++ b/include/asm-parisc/machdep.h @@ -0,0 +1,16 @@ +#ifndef _PARISC_MACHDEP_H +#define _PARISC_MACHDEP_H + +#include + +#define MACH_RESTART 1 +#define MACH_HALT 2 +#define MACH_POWER_ON 3 +#define MACH_POWER_OFF 4 + +extern struct notifier_block *mach_notifier; +extern void pa7300lc_init(void); + +extern void (*cpu_lpmc)(int, struct pt_regs *); + +#endif diff --git a/include/asm-parisc/mc146818rtc.h b/include/asm-parisc/mc146818rtc.h new file mode 100644 index 000000000..adf416314 --- /dev/null +++ b/include/asm-parisc/mc146818rtc.h @@ -0,0 +1,9 @@ +/* + * Machine dependent access functions for RTC registers. + */ +#ifndef _ASM_MC146818RTC_H +#define _ASM_MC146818RTC_H + +/* empty include file to satisfy the include in genrtc.c */ + +#endif /* _ASM_MC146818RTC_H */ diff --git a/include/asm-parisc/md.h b/include/asm-parisc/md.h new file mode 100644 index 000000000..67aace80e --- /dev/null +++ b/include/asm-parisc/md.h @@ -0,0 +1,13 @@ +/* $Id: md.h,v 1.1.1.1 1999/03/15 19:41:02 pjlahaie 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-parisc/mman.h b/include/asm-parisc/mman.h new file mode 100644 index 000000000..b04014203 --- /dev/null +++ b/include/asm-parisc/mman.h @@ -0,0 +1,52 @@ +#ifndef __PARISC_MMAN_H__ +#define __PARISC_MMAN_H__ + +#define PROT_READ 0x1 /* page can be read */ +#define PROT_WRITE 0x2 /* page can be written */ +#define PROT_EXEC 0x4 /* page can be executed */ +#define PROT_NONE 0x0 /* page can not be accessed */ + +#define MAP_SHARED 0x01 /* Share changes */ +#define MAP_PRIVATE 0x02 /* Changes are private */ +#define MAP_TYPE 0x03 /* Mask for type of mapping */ +#define MAP_FIXED 0x04 /* Interpret addr exactly */ +#define MAP_ANONYMOUS 0x10 /* don't use a file */ + +#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ +#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ +#define MAP_LOCKED 0x2000 /* pages are locked */ +#define MAP_NORESERVE 0x4000 /* don't check for reservations */ +#define MAP_GROWSDOWN 0x8000 /* stack-like segment */ + +#define MS_SYNC 1 /* synchronous memory sync */ +#define MS_ASYNC 2 /* sync memory asynchronously */ +#define MS_INVALIDATE 4 /* invalidate the caches */ + +#define MCL_CURRENT 1 /* lock all current mappings */ +#define MCL_FUTURE 2 /* lock all future mappings */ + +#define MADV_NORMAL 0 /* no further special treatment */ +#define MADV_RANDOM 1 /* expect random page references */ +#define MADV_SEQUENTIAL 2 /* expect sequential page references */ +#define MADV_WILLNEED 3 /* will need these pages */ +#define MADV_DONTNEED 4 /* dont need these pages */ +#define MADV_SPACEAVAIL 5 /* insure that resources are reserved */ +#define MADV_VPS_PURGE 6 /* Purge pages from VM page cache */ +#define MADV_VPS_INHERIT 7 /* Inherit parents page size */ + +/* The range 12-64 is reserved for page size specification. */ +#define MADV_4K_PAGES 12 /* Use 4K pages */ +#define MADV_16K_PAGES 14 /* Use 16K pages */ +#define MADV_64K_PAGES 16 /* Use 64K pages */ +#define MADV_256K_PAGES 18 /* Use 256K pages */ +#define MADV_1M_PAGES 20 /* Use 1 Megabyte pages */ +#define MADV_4M_PAGES 22 /* Use 4 Megabyte pages */ +#define MADV_16M_PAGES 24 /* Use 16 Megabyte pages */ +#define MADV_64M_PAGES 26 /* Use 64 Megabyte pages */ + +/* compatibility flags */ +#define MAP_ANON MAP_ANONYMOUS +#define MAP_FILE 0 +#define MAP_VARIABLE 0 + +#endif /* __PARISC_MMAN_H__ */ diff --git a/include/asm-parisc/mmu.h b/include/asm-parisc/mmu.h new file mode 100644 index 000000000..c311f8ae7 --- /dev/null +++ b/include/asm-parisc/mmu.h @@ -0,0 +1,64 @@ +/* + * parisc mmu structures + */ + +#ifndef _PARISC_MMU_H_ +#define _PARISC_MMU_H_ + +#ifndef __ASSEMBLY__ +/* Hardware Page Table Entry */ +typedef struct _PTE { + unsigned long v:1; /* Entry is valid */ + unsigned long tag:31; /* Unique Tag */ + + unsigned long r:1; /* referenced */ + unsigned long os_1:1; /* */ + unsigned long t:1; /* page reference trap */ + unsigned long d:1; /* dirty */ + unsigned long b:1; /* break */ + unsigned long type:3; /* access type */ + unsigned long pl1:2; /* PL1 (execute) */ + unsigned long pl2:2; /* PL2 (write) */ + unsigned long u:1; /* uncacheable */ + unsigned long id:1; /* access id */ + unsigned long os_2:1; /* */ + + unsigned long os_3:3; /* */ + unsigned long res_1:4; /* */ + unsigned long phys:20; /* physical page number */ + unsigned long os_4:2; /* */ + unsigned long res_2:3; /* */ + + unsigned long next; /* pointer to next page */ +} PTE; + +/* + * Simulated two-level MMU. This structure is used by the kernel + * to keep track of MMU mappings and is used to update/maintain + * the hardware HASH table which is really a cache of mappings. + * + * The simulated structures mimic the hardware available on other + * platforms, notably the 80x86 and 680x0. + */ + +typedef struct _pte { + unsigned long page_num:20; + unsigned long flags:12; /* Page flags (some unused bits) */ +} pte; + +#define PD_SHIFT (10+12) /* Page directory */ +#define PD_MASK 0x02FF +#define PT_SHIFT (12) /* Page Table */ +#define PT_MASK 0x02FF +#define PG_SHIFT (12) /* Page Entry */ + +/* MMU context */ + +typedef struct _MMU_context { + long pid[4]; + pte **pmap; /* Two-level page-map structure */ +} MMU_context; + +#endif /* __ASSEMBLY__ */ + +#endif /* _PARISC_MMU_H_ */ diff --git a/include/asm-parisc/mmu_context.h b/include/asm-parisc/mmu_context.h new file mode 100644 index 000000000..64531f986 --- /dev/null +++ b/include/asm-parisc/mmu_context.h @@ -0,0 +1,67 @@ +#ifndef __PARISC_MMU_CONTEXT_H +#define __PARISC_MMU_CONTEXT_H + +static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu) +{ +} + +/* on PA-RISC, we actually have enough contexts to justify an allocator + * for them. prumpf */ + +extern unsigned long alloc_sid(void); +extern void free_sid(unsigned long); + +static inline int +init_new_context(struct task_struct *tsk, struct mm_struct *mm) +{ + /* + * Init_new_context can be called for a cloned mm, so we + * only allocate a space id if one hasn't been allocated + * yet AND mm != &init_mm (cloned kernel thread which + * will run in the kernel space with spaceid 0). + */ + + if ((mm != &init_mm) && (mm->context == 0)) { + mm->context = alloc_sid(); + } + + return 0; +} + +static inline void +destroy_context(struct mm_struct *mm) +{ + free_sid(mm->context); + mm->context = 0; +} + +static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu) +{ + + if (prev != next) { + /* Re-load page tables */ + tsk->thread.pg_tables = __pa(next->pgd); + + mtctl(tsk->thread.pg_tables, 25); + mtsp(next->context,3); + } +} + +static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next) +{ + /* + * Activate_mm is our one chance to allocate a space id + * for a new mm created in the exec path. There's also + * some lazy tlb stuff, which is currently dead code, but + * we only allocate a space id if one hasn't been allocated + * already, so we should be OK. + */ + + if (next == &init_mm) BUG(); /* Should never happen */ + + if (next->context == 0) + next->context = alloc_sid(); + + switch_mm(prev,next,current,0); +} +#endif diff --git a/include/asm-parisc/msgbuf.h b/include/asm-parisc/msgbuf.h new file mode 100644 index 000000000..9dd868a1f --- /dev/null +++ b/include/asm-parisc/msgbuf.h @@ -0,0 +1,31 @@ +#ifndef _PARISC_MSGBUF_H +#define _PARISC_MSGBUF_H + +/* + * The msqid64_ds structure for parisc architecture, copied from sparc. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 64-bit time_t to solve y2038 problem + * - 2 miscellaneous 32-bit values + */ + +struct msqid64_ds { + struct ipc64_perm msg_perm; + unsigned int __pad1; + __kernel_time_t msg_stime; /* last msgsnd time */ + unsigned int __pad2; + __kernel_time_t msg_rtime; /* last msgrcv time */ + unsigned int __pad3; + __kernel_time_t msg_ctime; /* last change time */ + unsigned int msg_cbytes; /* current number of bytes on queue */ + unsigned int msg_qnum; /* number of messages in queue */ + unsigned int msg_qbytes; /* max number of bytes on queue */ + __kernel_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_pid_t msg_lrpid; /* last receive pid */ + unsigned int __unused1; + unsigned int __unused2; +}; + +#endif /* _PARISC_MSGBUF_H */ diff --git a/include/asm-parisc/namei.h b/include/asm-parisc/namei.h new file mode 100644 index 000000000..2b8132d79 --- /dev/null +++ b/include/asm-parisc/namei.h @@ -0,0 +1,17 @@ +/* $Id: namei.h,v 1.1.1.1 1999/03/15 19:41:02 pjlahaie Exp $ + * linux/include/asm-parisc/namei.h + * + * Included from linux/fs/namei.c + */ + +#ifndef __PARISC_NAMEI_H +#define __PARISC_NAMEI_H + +/* This dummy routine maybe changed to something useful + * for /usr/gnemul/ emulation stuff. + * Look at asm-sparc/namei.h for details. + */ + +#define __emul_prefix() NULL + +#endif /* __PARISC_NAMEI_H */ diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h new file mode 100644 index 000000000..39f19f601 --- /dev/null +++ b/include/asm-parisc/page.h @@ -0,0 +1,86 @@ +#ifndef _PARISC_PAGE_H +#define _PARISC_PAGE_H + +/* PAGE_SHIFT determines the page size */ +#define PAGE_SHIFT 12 +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) + +#ifdef __KERNEL__ +#ifndef __ASSEMBLY__ + +#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) +#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) + +#define clear_user_page(page, vaddr) clear_page(page) +#define copy_user_page(to, from, vaddr) copy_page(to, from) + +/* + * These are used to make use of C type-checking.. + */ +typedef struct { unsigned long pte; } pte_t; +typedef struct { unsigned long pmd; } pmd_t; +typedef struct { unsigned long pgd; } pgd_t; +typedef struct { unsigned long pgprot; } pgprot_t; + +#define pte_val(x) ((x).pte) +#define pmd_val(x) ((x).pmd) +#define pgd_val(x) ((x).pgd) +#define pgprot_val(x) ((x).pgprot) + +#define __pte(x) ((pte_t) { (x) } ) +#define __pmd(x) ((pmd_t) { (x) } ) +#define __pgd(x) ((pgd_t) { (x) } ) +#define __pgprot(x) ((pgprot_t) { (x) } ) + +/* Pure 2^n version of get_order */ +extern __inline__ int get_order(unsigned long size) +{ + int order; + + size = (size-1) >> (PAGE_SHIFT-1); + order = -1; + do { + size >>= 1; + order++; + } while (size); + return order; +} + +#endif /* !__ASSEMBLY__ */ + +/* to align the pointer to the (next) page boundary */ +#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) + +/* + * Tell the user there is some problem. Beep too, so we can + * see^H^H^Hhear bugs in early bootup as well! + * + * We don't beep yet. prumpf + */ +#define BUG() do { \ + printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ +} while (0) + +#define PAGE_BUG(page) do { \ + BUG(); \ +} while (0) + + +#define LINUX_GATEWAY_SPACE 0 +#define __PAGE_OFFSET (0xc0000000) + +#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) +/* These macros don't work for 64-bit C code -- don't allow in C at all */ +#ifdef __ASSEMBLY__ +# define PA(x) ((x)-__PAGE_OFFSET) +# define VA(x) ((x)+__PAGE_OFFSET) +#endif +#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) +#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) +#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT)) +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr) + +#endif /* __KERNEL__ */ + +#endif /* _PARISC_PAGE_H */ diff --git a/include/asm-parisc/param.h b/include/asm-parisc/param.h new file mode 100644 index 000000000..d6ee56cea --- /dev/null +++ b/include/asm-parisc/param.h @@ -0,0 +1,24 @@ +#ifndef _ASMPARISC_PARAM_H +#define _ASMPARISC_PARAM_H + +#ifndef HZ +#define HZ 100 +#endif + +#define EXEC_PAGESIZE 4096 + +#ifndef NGROUPS +#define NGROUPS 32 +#endif + +#ifndef NOGROUP +#define NOGROUP (-1) +#endif + +#define MAXHOSTNAMELEN 64 /* max length of hostname */ + +#ifdef __KERNEL__ +# define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ +#endif + +#endif diff --git a/include/asm-parisc/parport.h b/include/asm-parisc/parport.h new file mode 100644 index 000000000..00d9cc3e7 --- /dev/null +++ b/include/asm-parisc/parport.h @@ -0,0 +1,18 @@ +/* + * + * parport.h: ia32-compatible parport initialisation + * + * This file should only be included by drivers/parport/parport_pc.c. + */ +#ifndef _ASM_PARPORT_H +#define _ASM_PARPORT_H 1 + + +static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) +{ + /* nothing ! */ + return 0; +} + + +#endif /* !(_ASM_PARPORT_H) */ diff --git a/include/asm-parisc/parport_gsc.h b/include/asm-parisc/parport_gsc.h new file mode 100644 index 000000000..686d4f127 --- /dev/null +++ b/include/asm-parisc/parport_gsc.h @@ -0,0 +1,193 @@ +#ifndef __LINUX_PARPORT_GSC_H +#define __LINUX_PARPORT_GSC_H + +#include +#include + +#undef DEBUG_PARPORT /* undefine for production */ +#define DELAY_TIME 0 + +#if DELAY_TIME == 0 +#define parport_readb gsc_readb +#define parport_writeb gsc_writeb +#else +static __inline__ unsigned char parport_readb( unsigned long port ) +{ + udelay(DELAY_TIME); + return gsc_readb(port); +} + +static __inline__ void parport_writeb( unsigned char value, unsigned long port ) +{ + gsc_writeb(value,port); + udelay(DELAY_TIME); +} +#endif + +/* --- register definitions ------------------------------- */ + +#define EPPDATA(p) ((p)->base + 0x4) +#define EPPADDR(p) ((p)->base + 0x3) +#define CONTROL(p) ((p)->base + 0x2) +#define STATUS(p) ((p)->base + 0x1) +#define DATA(p) ((p)->base + 0x0) + +struct parport_gsc_private { + /* Contents of CTR. */ + unsigned char ctr; + + /* Bitmask of writable CTR bits. */ + unsigned char ctr_writable; + + /* Number of bytes per portword. */ + int pword; + + /* Not used yet. */ + int readIntrThreshold; + int writeIntrThreshold; + + /* buffer suitable for DMA, if DMA enabled */ + char *dma_buf; + dma_addr_t dma_handle; + struct pci_dev *dev; +}; + +extern __inline__ void parport_gsc_write_data(struct parport *p, unsigned char d) +{ +#ifdef DEBUG_PARPORT + printk (KERN_DEBUG "parport_gsc_write_data(%p,0x%02x)\n", p, d); +#endif + parport_writeb(d, DATA(p)); +} + +extern __inline__ unsigned char parport_gsc_read_data(struct parport *p) +{ + unsigned char val = parport_readb (DATA (p)); +#ifdef DEBUG_PARPORT + printk (KERN_DEBUG "parport_gsc_read_data(%p) = 0x%02x\n", + p, val); +#endif + return val; +} + +/* __parport_gsc_frob_control differs from parport_gsc_frob_control in that + * it doesn't do any extra masking. */ +static __inline__ unsigned char __parport_gsc_frob_control (struct parport *p, + unsigned char mask, + unsigned char val) +{ + struct parport_gsc_private *priv = p->physport->private_data; + unsigned char ctr = priv->ctr; +#ifdef DEBUG_PARPORT + printk (KERN_DEBUG + "__parport_gsc_frob_control(%02x,%02x): %02x -> %02x\n", + mask, val, ctr, ((ctr & ~mask) ^ val) & priv->ctr_writable); +#endif + ctr = (ctr & ~mask) ^ val; + ctr &= priv->ctr_writable; /* only write writable bits. */ + parport_writeb (ctr, CONTROL (p)); + priv->ctr = ctr; /* Update soft copy */ + return ctr; +} + +extern __inline__ void parport_gsc_data_reverse (struct parport *p) +{ + __parport_gsc_frob_control (p, 0x20, 0x20); +} + +extern __inline__ void parport_gsc_data_forward (struct parport *p) +{ + __parport_gsc_frob_control (p, 0x20, 0x00); +} + +extern __inline__ void parport_gsc_write_control (struct parport *p, + unsigned char d) +{ + const unsigned char wm = (PARPORT_CONTROL_STROBE | + PARPORT_CONTROL_AUTOFD | + PARPORT_CONTROL_INIT | + PARPORT_CONTROL_SELECT); + + /* Take this out when drivers have adapted to newer interface. */ + if (d & 0x20) { + printk (KERN_DEBUG "%s (%s): use data_reverse for this!\n", + p->name, p->cad->name); + parport_gsc_data_reverse (p); + } + + __parport_gsc_frob_control (p, wm, d & wm); +} + +extern __inline__ unsigned char parport_gsc_read_control(struct parport *p) +{ + const unsigned char rm = (PARPORT_CONTROL_STROBE | + PARPORT_CONTROL_AUTOFD | + PARPORT_CONTROL_INIT | + PARPORT_CONTROL_SELECT); + const struct parport_gsc_private *priv = p->physport->private_data; + return priv->ctr & rm; /* Use soft copy */ +} + +extern __inline__ unsigned char parport_gsc_frob_control (struct parport *p, + unsigned char mask, + unsigned char val) +{ + const unsigned char wm = (PARPORT_CONTROL_STROBE | + PARPORT_CONTROL_AUTOFD | + PARPORT_CONTROL_INIT | + PARPORT_CONTROL_SELECT); + + /* Take this out when drivers have adapted to newer interface. */ + if (mask & 0x20) { + printk (KERN_DEBUG "%s (%s): use data_%s for this!\n", + p->name, p->cad->name, + (val & 0x20) ? "reverse" : "forward"); + if (val & 0x20) + parport_gsc_data_reverse (p); + else + parport_gsc_data_forward (p); + } + + /* Restrict mask and val to control lines. */ + mask &= wm; + val &= wm; + + return __parport_gsc_frob_control (p, mask, val); +} + +extern __inline__ unsigned char parport_gsc_read_status(struct parport *p) +{ + return parport_readb (STATUS(p)); +} + + +extern __inline__ void parport_gsc_disable_irq(struct parport *p) +{ + __parport_gsc_frob_control (p, 0x10, 0x00); +} + +extern __inline__ void parport_gsc_enable_irq(struct parport *p) +{ + __parport_gsc_frob_control (p, 0x10, 0x10); +} + +extern void parport_gsc_release_resources(struct parport *p); + +extern int parport_gsc_claim_resources(struct parport *p); + +extern void parport_gsc_init_state(struct pardevice *, struct parport_state *s); + +extern void parport_gsc_save_state(struct parport *p, struct parport_state *s); + +extern void parport_gsc_restore_state(struct parport *p, struct parport_state *s); + +extern void parport_gsc_inc_use_count(void); + +extern void parport_gsc_dec_use_count(void); + +extern struct parport *parport_gsc_probe_port (unsigned long base, + unsigned long base_hi, + int irq, int dma, + struct pci_dev *dev); + +#endif diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h new file mode 100644 index 000000000..89ea37048 --- /dev/null +++ b/include/asm-parisc/pci.h @@ -0,0 +1,215 @@ +#ifndef __ASM_PARISC_PCI_H +#define __ASM_PARISC_PCI_H + +#include + +#define MIN_PCI_PORT 0x000000 +#define MAX_PCI_PORT 0xffffff + +/* +** HP PCI platforms generally support multiple bus adapters. +** (workstations 1-~4, servers 2-~32) +** +** Newer platforms number the busses across PCI bus adapters *sparsely*. +** E.g. 0, 8, 16, ... +** +** Under a PCI bus, most HP platforms support PPBs up to two or three +** levels deep. See "Bit3" product line. +*/ +#define PCI_MAX_BUSSES 256 + +/* [soapbox on] +** Who the hell can develope stuff without ASSERT or VASSERT? +** No one understands all the modules across all platforms. +** For linux add another dimension - processor architectures. +** +** This should be a standard/global macro used liberally +** in all code. Every respectable engineer I know in HP +** would support this argument. - grant +** [soapbox off] +*/ +#ifdef PCI_DEBUG +#define ASSERT(expr) \ + if(!(expr)) { \ + printk( "\n" __FILE__ ":%d: Assertion " #expr " failed!\n",__LINE__); \ + panic(#expr); \ + } +#else +#define ASSERT(expr) +#endif + + +/* +** pci_hba_data (aka H2P_OBJECT in HP/UX) +** +** This is the "common" or "base" data structure which HBA drivers +** (eg Dino or LBA) are required to place at the top of their own +** dev->sysdata structure. I've heard this called "C inheritance" too. +** +** Data needed by pcibios layer belongs here. +*/ +struct pci_hba_data { + struct pci_hba_data *next; /* global chain of HBAs */ + char *base_addr; /* aka Host Physical Address */ + struct hp_device *iodc_info; /* Info from PA bus walk */ + struct pci_bus *hba_bus; /* primary PCI bus below HBA */ + int hba_num; /* I/O port space access "key" */ + struct resource bus_num; /* PCI bus numbers */ + struct resource io_space; /* PIOP */ + struct resource mem_space; /* LMMIO */ + unsigned long mem_space_offset; /* VCLASS support */ + /* REVISIT - spinlock to protect resources? */ +}; + + +/* +** KLUGE: linux/pci.h include asm/pci.h BEFORE declaring struct pci_bus +** (This eliminates some of the warnings). +*/ +struct pci_bus; +struct pci_dev; + +/* +** Most PCI devices (eg Tulip, NCR720) also export the same registers +** to both MMIO and I/O port space. Due to poor performance of I/O Port +** access under HP PCI bus adapters, strongly reccomend use of MMIO +** address space. +** +** While I'm at it more PA programming notes: +** +** 1) MMIO stores (writes) are posted operations. This means the processor +** gets an "ACK" before the write actually gets to the device. A read +** to the same device (or typically the bus adapter above it) will +** force in-flight write transaction(s) out to the targeted device +** before the read can complete. +** +** 2) The Programmed I/O (PIO) data may not always be strongly ordered with +** respect to DMA on all platforms. Ie PIO data can reach the processor +** before in-flight DMA reaches memory. Since most SMP PA platforms +** are I/O coherent, it generally doesn't matter...but sometimes +** it does. +** +** I've helped device driver writers debug both types of problems. +*/ +struct pci_port_ops { + u8 (*inb) (struct pci_hba_data *hba, u16 port); + u16 (*inw) (struct pci_hba_data *hba, u16 port); + u32 (*inl) (struct pci_hba_data *hba, u16 port); + void (*outb) (struct pci_hba_data *hba, u16 port, u8 data); + void (*outw) (struct pci_hba_data *hba, u16 port, u16 data); + void (*outl) (struct pci_hba_data *hba, u16 port, u32 data); +}; + + +struct pci_bios_ops { + void (*init)(void); + void (*fixup_bus)(struct pci_bus *bus); +}; + +extern void pcibios_size_bridge(struct pci_bus *, struct pbus_set_ranges_data *); + + +/* +** See Documentation/DMA-mapping.txt +*/ +struct pci_dma_ops { + int (*dma_supported)(struct pci_dev *dev, dma_addr_t mask); + void *(*alloc_consistent)(struct pci_dev *dev, size_t size, dma_addr_t *iova); + void (*free_consistent)(struct pci_dev *dev, size_t size, void *vaddr, dma_addr_t iova); + dma_addr_t (*map_single)(struct pci_dev *dev, void *addr, size_t size, int direction); + void (*unmap_single)(struct pci_dev *dev, dma_addr_t iova, size_t size, int direction); + int (*map_sg)(struct pci_dev *dev, struct scatterlist *sg, int nents, int direction); + void (*unmap_sg)(struct pci_dev *dev, struct scatterlist *sg, int nhwents, int direction); + void (*dma_sync_single)(struct pci_dev *dev, dma_addr_t iova, size_t size, int direction); + void (*dma_sync_sg)(struct pci_dev *dev, struct scatterlist *sg, int nelems, int direction); +}; + + +/* +** We could live without the hppa_dma_ops indirection if we didn't want +** to support 4 different dma models with one binary or they were +** all loadable modules: +** I/O MMU consistent method dma_sync behavior +** ============= ====================== ======================= +** a) PA-7x00LC uncachable host memory flush/purge +** b) U2/Uturn cachable host memory NOP +** c) Ike/Astro cachable host memory NOP +** d) EPIC/SAGA memory on EPIC/SAGA flush/reset DMA channel +** +** PA-7[13]00LC processors have a GSC bus interface and no I/O MMU. +** +** Systems (eg PCX-T workstations) that don't fall into the above +** categories will need to modify the needed drivers to perform +** flush/purge and allocate "regular" cacheable pages for everything. +*/ + +extern struct pci_dma_ops *hppa_dma_ops; +extern struct pci_dma_ops pcxl_dma_ops; +extern struct pci_dma_ops pcx_dma_ops; + +/* +** Oops hard if we haven't setup hppa_dma_ops by the time the first driver +** attempts to initialize. +** Since panic() is a (void)(), pci_dma_panic() is needed to satisfy +** the (int)() required by pci_dma_supported() interface. +*/ +static inline int pci_dma_panic(char *msg) +{ + panic(msg); + return -1; +} + +#define pci_dma_supported(p, m) ( \ + (NULL == hppa_dma_ops) \ + ? pci_dma_panic("Dynamic DMA support missing...OOPS!\n(Hint: was Astro/Ike/U2/Uturn not claimed?)\n") \ + : hppa_dma_ops->dma_supported(p,m) \ +) + +#define pci_alloc_consistent(p, s, a) hppa_dma_ops->alloc_consistent(p,s,a) +#define pci_free_consistent(p, s, v, a) hppa_dma_ops->free_consistent(p,s,v,a) +#define pci_map_single(p, v, s, d) hppa_dma_ops->map_single(p, v, s, d) +#define pci_unmap_single(p, a, s, d) hppa_dma_ops->unmap_single(p, a, s, d) +#define pci_map_sg(p, sg, n, d) hppa_dma_ops->map_sg(p, sg, n, d) +#define pci_unmap_sg(p, sg, n, d) hppa_dma_ops->unmap_sg(p, sg, n, d) + +/* For U2/Astro/Ike based platforms (which are fully I/O coherent) +** dma_sync is a NOP. Let's keep the performance path short here. +*/ +#define pci_dma_sync_single(p, a, s, d) { if (hppa_dma_ops->dma_sync_single) \ + hppa_dma_ops->dma_sync_single(p, a, s, d); \ + } +#define pci_dma_sync_sg(p, sg, n, d) { if (hppa_dma_ops->dma_sync_sg) \ + hppa_dma_ops->dma_sync_sg(p, sg, n, d); \ + } + +/* +** Stuff declared in arch/parisc/kernel/pci.c +*/ +extern struct pci_port_ops *pci_port; +extern struct pci_bios_ops *pci_bios; +extern int pci_post_reset_delay; /* delay after de-asserting #RESET */ + +extern void pcibios_register_hba(struct pci_hba_data *); +extern void pcibios_assign_unassigned_resources(struct pci_bus *); + + +/* +** used by drivers/pci/pci.c:pci_do_scan_bus() +** 0 == check if bridge is numbered before re-numbering. +** 1 == pci_do_scan_bus() should automatically number all PCI-PCI bridges. +** +** REVISIT: +** To date, only alpha sets this to one. We'll need to set this +** to zero for legacy platforms and one for PAT platforms. +*/ +#ifdef __LP64__ +extern int pdc_pat; /* arch/parisc/kernel/inventory.c */ +#define pcibios_assign_all_busses() pdc_pat +#else +#define pcibios_assign_all_busses() 0 +#endif + +#define PCIBIOS_MIN_IO 0x10 +#define PCIBIOS_MIN_MEM 0x1000 /* NBPG - but pci/setup-res.c dies */ + +#endif /* __ASM_PARISC_PCI_H */ diff --git a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h new file mode 100644 index 000000000..debd3f5b8 --- /dev/null +++ b/include/asm-parisc/pdc.h @@ -0,0 +1,629 @@ +#ifndef _PARISC_PDC_H +#define _PARISC_PDC_H + +/* + PDC entry points... +*/ + +#define PDC_POW_FAIL 1 /* perform a power-fail */ +#define PDC_POW_FAIL_PREPARE 0 /* prepare for powerfail */ + +#define PDC_CHASSIS 2 /* PDC-chassis functions */ +#define PDC_CHASSIS_DISP 0 /* update chassis display */ +#define PDC_CHASSIS_WARN 1 /* return chassis warnings */ +#define PDC_CHASSIS_DISPWARN 2 /* update&return chassis status */ +#define PDC_RETURN_CHASSIS_INFO 128 /* HVERSION dependend: return chassis LED/LCD info */ + +#define PDC_PIM 3 /* Get PIM data */ +#define PDC_PIM_HPMC 0 /* Transfer HPMC data */ +#define PDC_PIM_RETURN_SIZE 1 /* Get Max buffer needed for PIM*/ +#define PDC_PIM_LPMC 2 /* Transfer HPMC data */ +#define PDC_PIM_SOFT_BOOT 3 /* Transfer Soft Boot data */ +#define PDC_PIM_TOC 4 /* Transfer TOC data */ + +#define PDC_MODEL 4 /* PDC model information call */ +#define PDC_MODEL_INFO 0 /* returns information */ +#define PDC_MODEL_BOOTID 1 /* set the BOOT_ID */ +#define PDC_MODEL_VERSIONS 2 /* returns cpu-internal versions*/ +#define PDC_MODEL_SYSMODEL 3 /* return system model info */ +#define PDC_MODEL_ENSPEC 4 /* ??? */ +#define PDC_MODEL_DISPEC 5 /* ??? */ +#define PDC_MODEL_CPU_ID 6 /* returns cpu-id (only newer machines!) */ +#define PDC_MODEL_CAPABILITIES 7 /* returns OS32/OS64-flags */ +#define PDC_MODEL_GET_BOOT__OP 8 /* returns boot test options */ +#define PDC_MODEL_SET_BOOT__OP 9 /* set boot test options */ + +#define PDC_CACHE 5 /* return/set cache (& TLB) info*/ +#define PDC_CACHE_INFO 0 /* returns information */ +#define PDC_CACHE_SET_COH 1 /* set coherence state */ +#define PDC_CACHE_RET_SPID 2 /* returns space-ID bits */ + +#define PDC_HPA 6 /* return HPA of processor */ +#define PDC_HPA_PROCESSOR 0 +#define PDC_HPA_MODULES 1 + +#define PDC_IODC 8 /* talk to IODC */ +#define PDC_IODC_READ 0 /* read IODC entry point */ +/* PDC_IODC_RI_* INDEX parameter of PDC_IODC_READ */ +#define PDC_IODC_RI_DATA_BYTES 0 /* IODC Data Bytes */ +/* 1, 2 obsolete - HVERSION dependent */ +#define PDC_IODC_RI_INIT 3 /* Initialize module */ +#define PDC_IODC_RI_IO 4 /* Module input/output */ +#define PDC_IODC_RI_SPA 5 /* Module input/output */ +#define PDC_IODC_RI_CONFIG 6 /* Module input/output */ +/* 7 obsolete - HVERSION dependent */ +#define PDC_IODC_RI_TEST 8 /* Module input/output */ +#define PDC_IODC_RI_TLB 9 /* Module input/output */ +#define PDC_IODC_NINIT 2 /* non-destructive init */ +#define PDC_IODC_DINIT 3 /* destructive init */ +#define PDC_IODC_MEMERR 4 /* check for memory errors */ +#define PDC_IODC_INDEX_DATA 0 /* get first 16 bytes from mod IODC */ +#define PDC_IODC_BUS_ERROR -4 /* bus error return value */ +#define PDC_IODC_INVALID_INDEX -5 /* invalid index return value */ +#define PDC_IODC_COUNT -6 /* count is too small */ + +#define PDC_TOD 9 /* time-of-day clock (TOD) */ +#define PDC_TOD_READ 0 /* read TOD */ +#define PDC_TOD_WRITE 1 /* write TOD */ +#define PDC_TOD_ITIMER 2 /* calibrate Interval Timer (CR16) */ + +#define PDC_ADD_VALID 12 /* Memory validation PDC call */ +#define PDC_ADD_VALID_VERIFY 0 /* Make PDC_ADD_VALID verify region */ + +#define PDC_INSTR 15 /* get instr to invoke PDCE_CHECK() */ + +#define PDC_BLOCK_TLB 18 /* manage hardware block-TLB */ +#define PDC_BTLB_INFO 0 /* returns parameter */ +#define PDC_BTLB_INSERT 1 /* insert BTLB entry */ +#define PDC_BTLB_PURGE 2 /* purge BTLB entries */ +#define PDC_BTLB_PURGE_ALL 3 /* purge all BTLB entries */ + +#define PDC_TLB 19 /* manage hardware TLB miss handling */ +#define PDC_TLB_INFO 0 /* returns parameter */ +#define PDC_TLB_SETUP 1 /* set up miss handling */ + +#define PDC_SYSTEM_MAP 22 /* find system modules */ +#define PDC_FIND_MODULE 0 + + +/* HVERSION dependent */ + +#define PDC_IO 135 /* log error info, reset IO system */ + +#define PDC_BROADCAST_RESET 136 /* reset all processors */ +#define PDC_DO_RESET 0UL /* option: perform a broadcast reset */ +#define PDC_DO_FIRM_TEST_RESET 1UL /* Do broadcast reset with bitmap */ +#define PDC_BR_RECONFIGURATION 2UL /* reset w/reconfiguration */ +#define PDC_FIRM_TEST_MAGIC 0xab9ec36fUL /* for this reboot only */ + +#define PDC_LAN_STATION_ID 138 /* Hversion dependent mechanism for */ +#define PDC_LAN_STATION_ID_READ 0 /* getting the lan station address */ + +#define PDC_LAN_STATION_ID_SIZE 6 + +/* Legacy PDC definitions for same stuff */ +#define PDC_PCI_INDEX 147UL +#define PDC_PCI_GET_INT_TBL_SIZE 13UL +#define PDC_PCI_GET_INT_TBL 14UL + +/* generic error codes returned by all PDC-functions */ + +#define PDC_WARN 3 /* Call completed with a warning */ +#define PDC_REQ_ERR_1 2 /* See above */ +#define PDC_REQ_ERR_0 1 /* Call would generate a requestor error */ +#define PDC_OK 0 /* Call completed successfully */ +#define PDC_BAD_PROC -1 /* Called non-existant procedure */ +#define PDC_BAD_OPTION -2 /* Called with non-existant option */ +#define PDC_ERROR -3 /* Call could not complete without an error */ +#define PDC_INVALID_ARG -10 /* Called with an invalid argument */ +#define PDC_BUS_POW_WARN -12 /* Call could not complete in allowed power budget */ + + +/* The following are from the HPUX .h files, and are just for +compatibility */ + +#define PDC_RET_OK 0L /* Call completed successfully */ +#define PDC_RET_NE_PROC -1L /* Non-existent procedure */ +#define PDC_RET_NE_OPT -2L /* non-existant option - arg1 */ +#define PDC_RET_NE_MOD -5L /* Module not found */ +#define PDC_RET_NE_CELL_MOD -7L /* Cell module not found */ +#define PDC_RET_INV_ARG -10L /* Invalid argument */ +#define PDC_RET_NOT_NARROW -17L /* Narrow mode not supported */ + + +/* Error codes for PDC_ADD_VALID */ + +#define PDC_ADD_VALID_WARN 3 /* Call completed with a warning */ +#define PDC_ADD_VALID_REQ_ERR_1 2 /* See above */ +#define PDC_ADD_VALID_REQ_ERR_0 1 /* Call would generate a requestor error */ +#define PDC_ADD_VALID_OK 0 /* Call completed successfully */ +#define PDC_ADD_VALID_BAD_OPTION -2 /* Called with non-existant option */ +#define PDC_ADD_VALID_ERROR -3 /* Call could not complete without an error */ +#define PDC_ADD_VALID_INVALID_ARG -10 /* Called with an invalid argument */ +#define PDC_ADD_VALID_BUS_POW_WARN -12 /* Call could not complete in allowed power budget */ + +/* The PDC_MEM_MAP calls */ + +#define PDC_MEM_MAP 128 +#define PDC_MEM_MAP_HPA 0 + +/* constants for OS (NVM...) */ +#define OS_ID_NONE 0 +#define OS_ID_HPUX 1 +#define OS_ID_MPEXL 2 +#define OS_ID_OSF 3 +#define OS_ID_LINUX OS_ID_HPUX + +/* constants for PDC_CHASSIS */ +#define OSTAT_OFF 0 +#define OSTAT_FLT 1 +#define OSTAT_TEST 2 +#define OSTAT_INIT 3 +#define OSTAT_SHUT 4 +#define OSTAT_WARN 5 +#define OSTAT_RUN 6 +#define OSTAT_ON 7 + +#ifndef __ASSEMBLY__ + +#include + +struct pdc_model { /* for PDC_MODEL */ + unsigned long hversion; + unsigned long sversion; + unsigned long hw_id; + unsigned long boot_id; + unsigned long sw_id; + unsigned long sw_cap; + unsigned long arch_rev; + unsigned long pot_key; + unsigned long curr_key; + unsigned long pad[32-9]; +} __attribute__((aligned(8))) ; + + +#if 0 +struct pdc_chassis_warn { /* for PDC_CHASSIS */ + unsigned long warn; + unsigned long pad[32-1]; +} __attribute__((aligned(8))) ; +#endif + +struct pdc_model_sysmodel { /* for PDC_MODEL_SYSMODEL */ + unsigned long mod_len; + unsigned long pad[32-1]; +} __attribute__((aligned(8))) ; + +struct pdc_model_cpuid { /* for PDC_MODEL_CPU_ID */ + unsigned long cpuid; + unsigned long pad[32-1]; +} __attribute__((aligned(8))) ; + +struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */ + unsigned long +#ifdef __LP64__ + cc_padW:32, +#endif + cc_alias:4, /* alias boundaries for virtual adresses */ + cc_block: 4, /* to determine most efficient stride */ + cc_line : 3, /* maximum amount written back as a result of store (multiple of 16 bytes) */ + cc_pad0 : 2, /* reserved */ + cc_wt : 1, /* 0 = WT-Dcache, 1 = WB-Dcache */ + cc_sh : 2, /* 0 = separate I/D-cache, else shared I/D-cache */ + cc_cst : 3, /* 0 = incoherent D-cache, 1=coherent D-cache */ + cc_pad1 : 5, /* reserved */ + cc_assoc: 8; /* associativity of I/D-cache */ +}; + +struct pdc_tlb_cf { /* for PDC_CACHE (I/D-TLB's) */ + unsigned long tc_pad0:12, /* reserved */ +#ifdef __LP64__ + tc_padW:32, +#endif + tc_sh : 2, /* 0 = separate I/D-TLB, else shared I/D-TLB */ + tc_hv : 1, /* HV */ + tc_page : 1, /* 0 = 2K page-size-machine, 1 = 4k page size */ + tc_cst : 3, /* 0 = incoherent operations, else coherent operations */ + tc_aid : 5, /* ITLB: width of access ids of processor (encoded!) */ + tc_pad1 : 8; /* ITLB: width of space-registers (encoded) */ +}; + +struct pdc_cache_info { /* main-PDC_CACHE-structure (caches & TLB's) */ + /* I-cache */ + unsigned long ic_size; /* size in bytes */ + struct pdc_cache_cf ic_conf; /* configuration */ + unsigned long ic_base; /* base-addr */ + unsigned long ic_stride; + unsigned long ic_count; + unsigned long ic_loop; + /* D-cache */ + unsigned long dc_size; /* size in bytes */ + struct pdc_cache_cf dc_conf; /* configuration */ + unsigned long dc_base; /* base-addr */ + unsigned long dc_stride; + unsigned long dc_count; + unsigned long dc_loop; + /* Instruction-TLB */ + unsigned long it_size; /* number of entries in I-TLB */ + struct pdc_tlb_cf it_conf; /* I-TLB-configuration */ + unsigned long it_sp_base; + unsigned long it_sp_stride; + unsigned long it_sp_count; + unsigned long it_off_base; + unsigned long it_off_stride; + unsigned long it_off_count; + unsigned long it_loop; + /* data-TLB */ + unsigned long dt_size; /* number of entries in D-TLB */ + struct pdc_tlb_cf dt_conf; /* D-TLB-configuration */ + unsigned long dt_sp_base; + unsigned long dt_sp_stride; + unsigned long dt_sp_count; + unsigned long dt_off_base; + unsigned long dt_off_stride; + unsigned long dt_off_count; + unsigned long dt_loop; + /* padded to 32 entries... */ + unsigned long pad[32-30]; +} __attribute__((aligned(8))) ; + +struct pdc_hpa { /* PDC_HPA */ + unsigned long hpa; + unsigned long filler[31]; +} __attribute__((aligned(8))) ; + +#if 0 +/* If you start using the next struct, you'll have to adjust it to + * work with 64-bit firmware I think -PB + */ +struct pdc_iodc { /* PDC_IODC */ + unsigned char hversion_model; + unsigned char hversion; + unsigned char spa; + unsigned char type; + unsigned int sversion_rev:4; + unsigned int sversion_model:19; + unsigned int sversion_opt:8; + unsigned char rev; + unsigned char dep; + unsigned char features; + unsigned char filler1; + unsigned int checksum:16; + unsigned int length:16; + unsigned int filler[15]; +} __attribute__((aligned(8))) ; +#endif + +#ifndef __LP64__ +/* no BLTBs in pa2.0 processors */ +struct pdc_btlb_info_range { + __u8 res00; + __u8 num_i; + __u8 num_d; + __u8 num_comb; +}; + +struct pdc_btlb_info { /* PDC_BLOCK_TLB, return of PDC_BTLB_INFO */ + unsigned int min_size; /* minimum size of BTLB in pages */ + unsigned int max_size; /* maximum size of BTLB in pages */ + struct pdc_btlb_info_range fixed_range_info; + struct pdc_btlb_info_range variable_range_info; + unsigned int pad[32-4]; +} __attribute__((aligned(8))) ; +#endif + +struct pdc_tlb { /* for PDC_TLB */ + unsigned long min_size; + unsigned long max_size; + unsigned long pad[32-2]; +} __attribute__((aligned(8))) ; + +struct pdc_system_map { /* PDC_SYTEM_MAP/FIND_MODULE */ + void * mod_addr; + unsigned long mod_pgs; + unsigned long add_addrs; + unsigned long filler[29]; +} __attribute__((aligned(8))) ; + +/* + * Device path specifications used by PDC. + */ +struct pdc_module_path { + char flags; /* see bit definitions below */ + char bc[6]; /* Bus Converter routing info to a specific */ + /* I/O adaptor (< 0 means none, > 63 resvd) */ + char mod; /* fixed field of specified module */ + unsigned int layers[6]; /* device-specific info (ctlr #, unit # ...) */ +} __attribute__((aligned(8))) ; + +#ifndef __LP64__ +/* Probably needs 64-bit porting -PB */ +struct pdc_memory_map { /* PDC_MEMORY_MAP */ + unsigned int hpa; /* mod's register set address */ + unsigned int more_pgs; /* number of additional I/O pgs */ +} __attribute__((aligned(8))) ; + +struct pdc_lan_station_id { /* PDC_LAN_STATION_ID */ + unsigned char addr[PDC_LAN_STATION_ID_SIZE]; + unsigned char pad0[2]; + int pad1[30]; +}; +#endif + +struct pdc_tod { + unsigned long tod_sec; + unsigned long tod_usec; + long pad[30]; +} __attribute__((aligned(8))) ; + +/* architected results from PDC_PIM/transfer hpmc on a PA1.1 machine */ + +struct pdc_hpmc_pim_11 { /* PDC_PIM */ + __u32 gr[32]; + __u32 cr[32]; + __u32 sr[8]; + __u32 iasq_back; + __u32 iaoq_back; + __u32 check_type; + __u32 cpu_state; + __u32 rsvd1; + __u32 cache_check; + __u32 tlb_check; + __u32 bus_check; + __u32 assists_check; + __u32 rsvd2; + __u32 assist_state; + __u32 responder_addr; + __u32 requestor_addr; + __u32 path_info; + __u64 fr[32]; +}; + +/* + * architected results from PDC_PIM/transfer hpmc on a PA2.0 machine + * + * Note that PDC_PIM doesn't care whether or not wide mode was enabled + * so the results are different on PA1.1 vs. PA2.0 when in narrow mode. + * + * Note also that there are unarchitected results available, which + * are hversion dependent. Do a "ser pim 0 hpmc" after rebooting, since + * the firmware is probably the best way of printing hversion dependent + * data. + */ + +struct pdc_hpmc_pim_20 { /* PDC_PIM */ + __u64 gr[32]; + __u64 cr[32]; + __u64 sr[8]; + __u64 iasq_back; + __u64 iaoq_back; + __u32 check_type; + __u32 cpu_state; + __u32 cache_check; + __u32 tlb_check; + __u32 bus_check; + __u32 assists_check; + __u32 assist_state; + __u32 path_info; + __u64 responder_addr; + __u64 requestor_addr; + __u64 fr[32]; +}; + +#endif /* __ASSEMBLY__ */ + +/* flags of the device_path (see below) */ +#define PF_AUTOBOOT 0x80 +#define PF_AUTOSEARCH 0x40 +#define PF_TIMER 0x0F + +#ifndef __ASSEMBLY__ + +struct device_path { /* page 1-69 */ + unsigned char flags; /* flags see above! */ + unsigned char bc[6]; /* bus converter routing info */ + unsigned char mod; + unsigned int layers[6];/* device-specific layer-info */ +} __attribute__((aligned(8))) ; + +struct pz_device { + struct device_path dp; /* see above */ + /* struct iomod *hpa; */ + unsigned int hpa; /* HPA base address */ + /* char *spa; */ + unsigned int spa; /* SPA base address */ + /* int (*iodc_io)(struct iomod*, ...); */ + unsigned int iodc_io; /* device entry point */ + short pad; /* reserved */ + unsigned short cl_class;/* see below */ +} __attribute__((aligned(8))) ; + +#endif /* __ASSEMBLY__ */ + +/* cl_class + * page 3-33 of IO-Firmware ARS + * IODC ENTRY_INIT(Search first) RET[1] + */ +#define CL_NULL 0 /* invalid */ +#define CL_RANDOM 1 /* random access (as disk) */ +#define CL_SEQU 2 /* sequential access (as tape) */ +#define CL_DUPLEX 7 /* full-duplex point-to-point (RS-232, Net) */ +#define CL_KEYBD 8 /* half-duplex console (HIL Keyboard) */ +#define CL_DISPL 9 /* half-duplex console (display) */ +#define CL_FC 10 /* FiberChannel access media */ + +#if 0 +/* FIXME: DEVCLASS_* duplicates CL_* (above). Delete DEVCLASS_*? */ +#define DEVCLASS_RANDOM 1 +#define DEVCLASS_SEQU 2 +#define DEVCLASS_DUPLEX 7 +#define DEVCLASS_KEYBD 8 +#define DEVCLASS_DISP 9 +#endif + +/* IODC ENTRY_INIT() */ +#define ENTRY_INIT_SRCH_FRST 2 +#define ENTRY_INIT_SRCH_NEXT 3 +#define ENTRY_INIT_MOD_DEV 4 +#define ENTRY_INIT_DEV 5 +#define ENTRY_INIT_MOD 6 +#define ENTRY_INIT_MSG 9 + +/* IODC ENTRY_IO() */ +#define ENTRY_IO_BOOTIN 0 +#define ENTRY_IO_CIN 2 +#define ENTRY_IO_COUT 3 +#define ENTRY_IO_CLOSE 4 +#define ENTRY_IO_GETMSG 9 + +/* IODC ENTRY_SPA() */ + +/* IODC ENTRY_CONFIG() */ + +/* IODC ENTRY_TEST() */ + +/* IODC ENTRY_TLB() */ + + +/* DEFINITION OF THE ZERO-PAGE (PAG0) */ +/* based on work by Jason Eckhardt (jason@equator.com) */ + +#ifndef __ASSEMBLY__ + +#define PAGE0 ((struct zeropage *)0xc0000000) + +struct zeropage { + /* [0x000] initialize vectors (VEC) */ + unsigned int vec_special; /* must be zero */ + /* int (*vec_pow_fail)(void);*/ + unsigned int vec_pow_fail; /* power failure handler */ + /* int (*vec_toc)(void); */ + unsigned int vec_toc; + unsigned int vec_toclen; + /* int (*vec_rendz)(void); */ + unsigned int vec_rendz; + int vec_pow_fail_flen; + int vec_pad[10]; + + /* [0x040] reserved processor dependent */ + int pad0[112]; + + /* [0x200] reserved */ + int pad1[84]; + + /* [0x350] memory configuration (MC) */ + int memc_cont; /* contiguous mem size (bytes) */ + int memc_phsize; /* physical memory size */ + int memc_adsize; /* additional mem size, bytes of SPA space used by PDC */ + unsigned int mem_pdc_hi; /* used for 64-bit */ + + /* [0x360] various parameters for the boot-CPU */ + /* unsigned int *mem_booterr[8]; */ + unsigned int mem_booterr[8]; /* ptr to boot errors */ + unsigned int mem_free; /* first location, where OS can be loaded */ + /* struct iomod *mem_hpa; */ + unsigned int mem_hpa; /* HPA of the boot-CPU */ + /* int (*mem_pdc)(int, ...); */ + unsigned int mem_pdc; /* PDC entry point */ + unsigned int mem_10msec; /* number of clock ticks in 10msec */ + + /* [0x390] initial memory module (IMM) */ + /* struct iomod *imm_hpa; */ + unsigned int imm_hpa; /* HPA of the IMM */ + int imm_soft_boot; /* 0 = was hard boot, 1 = was soft boot */ + unsigned int imm_spa_size; /* SPA size of the IMM in bytes */ + unsigned int imm_max_mem; /* bytes of mem in IMM */ + + /* [0x3A0] boot console, display device and keyboard */ + struct pz_device mem_cons; /* description of console device */ + struct pz_device mem_boot; /* description of boot device */ + struct pz_device mem_kbd; /* description of keyboard device */ + + /* [0x430] reserved */ + int pad430[116]; + + /* [0x600] processor dependent */ + __u32 pad600[1]; + __u32 proc_sti; /* pointer to STI ROM */ + __u32 pad608[126]; +}; + +#endif /* __ASSEMBLY__ */ + +/* Page Zero constant offsets used by the HPMC handler */ + +#define BOOT_CONSOLE_HPA_OFFSET 0x3c0 +#define BOOT_CONSOLE_SPA_OFFSET 0x3c4 +#define BOOT_CONSOLE_PATH_OFFSET 0x3a8 + +#ifndef __ASSEMBLY__ + +struct pdc_pat_io_num { + unsigned long num; + unsigned long reserved[31]; +}; + + + +extern void pdc_console_init(void); +extern int pdc_getc(void); /* wait for char */ +extern void pdc_putc(unsigned char); /* print char */ + + +/* wrapper-functions from pdc.c */ + +int pdc_add_valid(void *address); +int pdc_hpa_processor(void *address); +#if 0 +int pdc_hpa_modules(void *address); +#endif +int pdc_iodc_read(void *address, void *hpa, unsigned int index, + void *iodc_data, unsigned int iodc_data_size); +int pdc_system_map_find_mods(void *pdc_mod_info, void *mod_path, int index); +int pdc_model_info(struct pdc_model *model); +int pdc_model_sysmodel(char *name); +int pdc_model_cpuid(struct pdc_model_cpuid *cpu_id); +int pdc_model_versions(struct pdc_model_cpuid *cpu_id, int id); +int pdc_cache_info(struct pdc_cache_info *cache); +#ifndef __LP64__ +int pdc_btlb_info( struct pdc_btlb_info *btlb); +int pdc_lan_station_id( char *lan_addr, void *net_hpa); +#endif +int pdc_mem_map_hpa(void *r_addr, void *mod_path); + +extern int pdc_chassis_disp(unsigned long disp); +extern int pdc_chassis_info(void *pdc_result, void *chassis_info, unsigned long len); + +#ifdef __LP64__ +int pdc_pat_get_irt_size(void *r_addr, unsigned long cell_num); +int pdc_pat_get_irt(void *r_addr, unsigned long cell_num); +#else +/* No PAT support for 32-bit kernels...sorry */ +#define pdc_pat_get_irt_size(r_addr, cell_numn) PDC_RET_NE_PROC +#define pdc_pat_get_irt(r_addr, cell_num) PDC_RET_NE_PROC +#endif +int pdc_pci_irt_size(void *r_addr, void *hpa); +int pdc_pci_irt(void *r_addr, void *hpa, void *tbl); + +int pdc_tod_read(struct pdc_tod *tod); +int pdc_tod_set(unsigned long sec, unsigned long usec); + +/* on all currently-supported platforms, IODC I/O calls are always + * 32-bit calls, and MEM_PDC calls are always the same width as the OS. + * This means Cxxx boxes can't run wide kernels right now. -PB + * + * Note that some PAT boxes may have 64-bit IODC I/O... + */ +#ifdef __LP64__ +# define mem_pdc_call(args...) real64_call(0L, ##args) +#else +# define mem_pdc_call(args...) real32_call(0L, ##args) +#endif +/* yes 'int', not 'long' -- IODC I/O is always 32-bit stuff */ +extern long real64_call(unsigned long function, ...); +extern long real32_call(unsigned long function, ...); +extern void pdc_init(void); + +#endif /* __ASSEMBLY__ */ + +#endif /* _PARISC_PDC_H */ diff --git a/include/asm-parisc/pdcpat.h b/include/asm-parisc/pdcpat.h new file mode 100644 index 000000000..38fb2597f --- /dev/null +++ b/include/asm-parisc/pdcpat.h @@ -0,0 +1,247 @@ +#ifndef __PARISC_PATPDC_H +#define __PARISC_PATPDC_H + +/* + * 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) Hewlett Packard (Paul Bame ) + * Copyright 2000 (c) Grant Grundler + */ + + +/* PDC PAT CELL */ +#define PDC_PAT_CELL 64L /* Interface for gaining and + * manipulatin g cell state within PD */ +#define PDC_PAT_CELL_GET_NUMBER 0L /* Return Cell number */ +#define PDC_PAT_CELL_GET_INFO 1L /* Returns info about Cell */ +#define PDC_PAT_CELL_MODULE 2L /* Returns info about Module */ +#define PDC_PAT_CELL_SET_ATTENTION 9L /* Set Cell Attention indicator */ +#define PDC_PAT_CELL_NUMBER_TO_LOC 10L /* Cell Number -> Location */ +#define PDC_PAT_CELL_WALK_FABRIC 11L /* Walk the Fabric */ +#define PDC_PAT_CELL_GET_RDT_SIZE 12L /* Return Route Distance Table Sizes */ +#define PDC_PAT_CELL_GET_RDT 13L /* Return Route Distance Tables */ +#define PDC_PAT_CELL_GET_LOCAL_PDH_SZ 14L /* Read Local PDH Buffer Size */ +#define PDC_PAT_CELL_SET_LOCAL_PDH 15L /* Write Local PDH Buffer */ +#define PDC_PAT_CELL_GET_REMOTE_PDH_SZ 16L /* Return Remote PDH Buffer Size */ +#define PDC_PAT_CELL_GET_REMOTE_PDH 17L /* Read Remote PDH Buffer */ +#define PDC_PAT_CELL_GET_DBG_INFO 128L /* Return DBG Buffer Info */ +#define PDC_PAT_CELL_CHANGE_ALIAS 129L /* Change Non-Equivalent Alias Chacking */ + + +/* +** Arg to PDC_PAT_CELL_MODULE memaddr[4] +** +** Addresses on the Merced Bus != all Runway Bus addresses. +** This is intended for programming SBA/LBA chips range registers. +*/ +#define IO_VIEW 0UL +#define PA_VIEW 1UL + +/* PDC_PAT_CELL_MODULE entity type values */ +#define PAT_ENTITY_CA 0 /* central agent */ +#define PAT_ENTITY_PROC 1 /* processor */ +#define PAT_ENTITY_MEM 2 /* memory controller */ +#define PAT_ENTITY_SBA 3 /* system bus adapter */ +#define PAT_ENTITY_LBA 4 /* local bus adapter */ +#define PAT_ENTITY_PBC 5 /* processor bus converter */ +#define PAT_ENTITY_XBC 6 /* crossbar fabric connect */ +#define PAT_ENTITY_RC 7 /* fabric interconnect */ + +/* PDC_PAT_CELL_MODULE address range type values */ +#define PAT_PBNUM 0 /* PCI Bus Number */ +#define PAT_LMMIO 1 /* < 4G MMIO Space */ +#define PAT_GMMIO 2 /* > 4G MMIO Space */ +#define PAT_NPIOP 3 /* Non Postable I/O Port Space */ +#define PAT_PIOP 4 /* Postable I/O Port Space */ +#define PAT_AHPA 5 /* Addional HPA Space */ +#define PAT_UFO 6 /* HPA Space (UFO for Mariposa) */ +#define PAT_GNIP 7 /* GNI Reserved Space */ + + +/* PDC PAT CHASSIS LOG */ + +#define PDC_PAT_CHASSIS_LOG 65L /* Platform logging & forward + ** progress functions */ +#define PDC_PAT_CHASSIS_WRITE_LOG 0L /* Write Log Entry */ +#define PDC_PAT_CHASSIS_READ_LOG 1L /* Read Log Entry */ + +/* PDC PAT CPU */ + +#define PDC_PAT_CPU 67L /* Interface to CPU configuration + * within the protection domain */ +#define PDC_PAT_CPU_INFO 0L /* Return CPU config info */ +#define PDC_PAT_CPU_DELETE 1L /* Delete CPU */ +#define PDC_PAT_CPU_ADD 2L /* Add CPU */ +#define PDC_PAT_CPU_GET_NUMBER 3L /* Return CPU Number */ +#define PDC_PAT_CPU_GET_HPA 4L /* Return CPU HPA */ +#define PDC_PAT_CPU_STOP 5L /* Stop CPU */ +#define PDC_PAT_CPU_RENDEZVOUS 6L /* Rendezvous CPU */ +#define PDC_PAT_CPU_GET_CLOCK_INFO 7L /* Return CPU Clock info */ +#define PDC_PAT_CPU_GET_RENDEZVOUS_STATE 8L /* Return Rendezvous State */ +#define PDC_PAT_CPU_PLUNGE_FABRIC 128L /* Plunge Fabric */ +#define PDC_PAT_CPU_UPDATE_CACHE_CLEANSING 129L /* Manipulate Cache + * Cleansing Mode */ +/* PDC PAT EVENT */ + +#define PDC_PAT_EVENT 68L /* Interface to Platform Events */ +#define PDC_PAT_EVENT_GET_CAPS 0L /* Get Capabilities */ +#define PDC_PAT_EVENT_SET_MODE 1L /* Set Notification Mode */ +#define PDC_PAT_EVENT_SCAN 2L /* Scan Event */ +#define PDC_PAT_EVENT_HANDLE 3L /* Handle Event */ +#define PDC_PAT_EVENT_GET_NB_CALL 4L /* Get Non-Blocking call Args */ + +/* PDC PAT HPMC */ + +#define PDC_PAT_HPMC 70L /* Cause processor to go into spin + ** loop, and wait for wake up from + ** Monarch Processor */ +#define PDC_PAT_HPMC_RENDEZ_CPU 0L /* go into spin loop */ +#define PDC_PAT_HPMC_SET_PARAMS 1L /* Allows OS to specify intr which PDC + * will use to interupt OS during machine + * check rendezvous */ + +/* parameters for PDC_PAT_HPMC_SET_PARAMS: */ +#define HPMC_SET_PARAMS_INTR 1L /* Rendezvous Interrupt */ +#define HPMC_SET_PARAMS_WAKE 2L /* Wake up processor */ + +/* PDC PAT IO */ + +#define PDC_PAT_IO 71L /* On-line services for I/O modules */ +#define PDC_PAT_IO_GET_SLOT_STATUS 5L /* Get Slot Status Info*/ +#define PDC_PAT_IO_GET_LOC_FROM_HARDWARE 6L /* Get Physical Location from */ + /* Hardware Path */ +#define PDC_PAT_IO_GET_HARDWARE_FROM_LOC 7L /* Get Hardware Path from + * Physical Location */ +#define PDC_PAT_IO_GET_PCI_CONFIG_FROM_HW 11L /* Get PCI Configuration + * Address from Hardware Path */ +#define PDC_PAT_IO_GET_HW_FROM_PCI_CONFIG 12L /* Get Hardware Path + * from PCI Configuration Address */ +#define PDC_PAT_IO_READ_HOST_BRIDGE_INFO 13L /* Read Host Bridge State Info */ +#define PDC_PAT_IO_CLEAR_HOST_BRIDGE_INFO 14L /* Clear Host Bridge State Info*/ +#define PDC_PAT_IO_GET_PCI_ROUTING_TABLE_SIZE 15L /* Get PCI INT Routing Table + * Size */ +#define PDC_PAT_IO_GET_PCI_ROUTING_TABLE 16L /* Get PCI INT Routing Table */ +#define PDC_PAT_IO_GET_HINT_TABLE_SIZE 17L /* Get Hint Table Size */ +#define PDC_PAT_IO_GET_HINT_TABLE 18L /* Get Hint Table */ +#define PDC_PAT_IO_PCI_CONFIG_READ 19L /* PCI Config Read */ +#define PDC_PAT_IO_PCI_CONFIG_WRITE 20L /* PCI Config Write */ +#define PDC_PAT_IO_GET_NUM_IO_SLOTS 21L /* Get Number of I/O Bay Slots in + * Cabinet */ +#define PDC_PAT_IO_GET_LOC_IO_SLOTS 22L /* Get Physical Location of I/O */ + /* Bay Slots in Cabinet */ +#define PDC_PAT_IO_BAY_STATUS_INFO 28L /* Get I/O Bay Slot Status Info */ +#define PDC_PAT_IO_GET_PROC_VIEW 29L /* Get Processor view of IO address */ +#define PDC_PAT_IO_PROG_SBA_DIR_RANGE 30L /* Program directed range */ + +/* PDC PAT MEM */ + +#define PDC_PAT_MEM 72L /* Manage memory page deallocation */ +#define PDC_PAT_MEM_PD_INFO 0L /* Return PDT info for PD */ +#define PDC_PAT_MEM_PD_CLEAR 1L /* Clear PDT for PD */ +#define PDC_PAT_MEM_PD_READ 2L /* Read PDT entries for PD */ +#define PDC_PAT_MEM_PD_RESET 3L /* Reset clear bit for PD */ +#define PDC_PAT_MEM_CELL_INFO 5L /* Return PDT info For Cell */ +#define PDC_PAT_MEM_CELL_CLEAR 6L /* Clear PDT For Cell */ +#define PDC_PAT_MEM_CELL_READ 7L /* Read PDT entries For Cell */ +#define PDC_PAT_MEM_CELL_RESET 8L /* Reset clear bit For Cell */ +#define PDC_PAT_MEM_SETGM 9L /* Set Golden Memory value */ +#define PDC_PAT_MEM_ADD_PAGE 10L /* ADDs a page to the cell */ +#define PDC_PAT_MEM_ADDRESS 11L /* Get Physical Location From */ + /* Memory Address */ +#define PDC_PAT_MEM_GET_TXT_SIZE 12L /* Get Formatted Text Size */ +#define PDC_PAT_MEM_GET_PD_TXT 13L /* Get PD Formatted Text */ +#define PDC_PAT_MEM_GET_CELL_TXT 14L /* Get Cell Formatted Text */ +#define PDC_PAT_MEM_RD_STATE_INFO 15L /* Read Mem Module State Info*/ +#define PDC_PAT_MEM_CLR_STATE_INFO 16L /*Clear Mem Module State Info*/ +#define PDC_PAT_MEM_CLEAN_RANGE 128L /*Clean Mem in specific range*/ +#define PDC_PAT_MEM_GET_TBL_SIZE 131L /* Get Memory Table Size */ +#define PDC_PAT_MEM_GET_TBL 132L /* Get Memory Table */ + +/* PDC PAT NVOLATILE */ + +#define PDC_PAT_NVOLATILE 73L /* Access Non-Volatile Memory */ +#define PDC_PAT_NVOLATILE_READ 0L /* Read Non-Volatile Memory */ +#define PDC_PAT_NVOLATILE_WRITE 1L /* Write Non-Volatile Memory */ +#define PDC_PAT_NVOLATILE_GET_SIZE 2L /* Return size of NVM */ +#define PDC_PAT_NVOLATILE_VERIFY 3L /* Verify contents of NVM */ +#define PDC_PAT_NVOLATILE_INIT 4L /* Initialize NVM */ + +#ifndef __ASSEMBLY__ +#include + +/* +** PDC_PAT_CELL_GET_INFO return block +*/ +typedef struct pdc_pat_cell_info_rtn_block { + unsigned long cpu_info; + unsigned long cell_info; + unsigned long cell_location; + unsigned long reo_location; + unsigned long mem_size; + unsigned long dimm_status; + unsigned long pdc_rev; + unsigned long fabric_info0; + unsigned long fabric_info1; + unsigned long fabric_info2; + unsigned long fabric_info3; + unsigned long reserved[21]; +} pdc_pat_cell_info_rtn_block_t; + + +/* FIXME: mod[508] should really be a union of the various mod components */ +struct pdc_pat_cell_mod_maddr_block { /* PDC_PAT_CELL_MODULE */ + unsigned long cba; /* function 0 configuration space address */ + unsigned long mod_info; /* module information */ + unsigned long mod_location; /* physical location of the module */ + unsigned long mod_path; /* module path (device path - layers) */ + unsigned long mod[508]; /* PAT cell module components */ +} __attribute__((aligned(8))) ; + +typedef struct pdc_pat_cell_mod_maddr_block pdc_pat_cell_mod_maddr_block_t; + + +extern int pdc_pat_cell_get_number(void *); +extern int pdc_pat_cell_module(void *, unsigned long, unsigned long, unsigned long, void *); +extern int pdc_pat_cell_num_to_loc(void *, unsigned long); + +/* Flag to indicate this is a PAT box...don't use this unless you +** really have to...it might go away some day. +*/ +#ifdef __LP64__ +extern int pdc_pat; /* arch/parisc/kernel/inventory.c */ +#endif + +/******************************************************************** +* PDC_PAT_CELL[Return Cell Module] memaddr[0] conf_base_addr +* ---------------------------------------------------------- +* Bit 0 to 51 - conf_base_addr +* Bit 52 to 62 - reserved +* Bit 63 - endianess bit +********************************************************************/ +#define PAT_GET_CBA(value) ((value) & 0xfffffffffffff000UL) + +/******************************************************************** +* PDC_PAT_CELL[Return Cell Module] memaddr[1] mod_info +* ---------------------------------------------------- +* Bit 0 to 7 - entity type +* 0 = central agent, 1 = processor, +* 2 = memory controller, 3 = system bus adapter, +* 4 = local bus adapter, 5 = processor bus converter, +* 6 = crossbar fabric connect, 7 = fabric interconnect, +* 8 to 254 reserved, 255 = unknown. +* Bit 8 to 15 - DVI +* Bit 16 to 23 - IOC functions +* Bit 24 to 39 - reserved +* Bit 40 to 63 - mod_pages +* number of 4K pages a module occupies starting at conf_base_addr +********************************************************************/ +#define PAT_GET_ENTITY(value) (((value) >> 56) & 0xffUL) +#define PAT_GET_DVI(value) (((value) >> 48) & 0xffUL) +#define PAT_GET_IOC(value) (((value) >> 40) & 0xffUL) +#define PAT_GET_MOD_PAGES(value)(((value) & 0xffffffUL) + +#endif /* __ASSEMBLY__ */ + +#endif /* ! __PARISC_PATPDC_H */ diff --git a/include/asm-parisc/pgalloc.h b/include/asm-parisc/pgalloc.h new file mode 100644 index 000000000..1d9365252 --- /dev/null +++ b/include/asm-parisc/pgalloc.h @@ -0,0 +1,404 @@ +#ifndef _ASM_PGALLOC_H +#define _ASM_PGALLOC_H + +/* The usual comment is "Caches aren't brain-dead on the ". + * Unfortunately, that doesn't apply to PA-RISC. */ + +#include +#include +#include + +#include +#include + + +/* Internal use D/I cache flushing routines... */ +/* XXX: these functions must not access memory between f[di]ce instructions. */ + +static inline void __flush_dcache_range(unsigned long start, unsigned long size) +{ +#if 0 + register unsigned long count = (size / L1_CACHE_BYTES); + register unsigned long loop = cache_info.dc_loop; + register unsigned long i, j; + + if (size > 64 * 1024) { + /* Just punt and clear the whole damn thing */ + flush_data_cache(); + return; + } + + for(i = 0; i <= count; i++, start += L1_CACHE_BYTES) + for(j = 0; j < loop; j++) + fdce(start); +#else + flush_data_cache(); +#endif +} + + +static inline void __flush_icache_range(unsigned long start, unsigned long size) +{ +#if 0 + register unsigned long count = (size / L1_CACHE_BYTES); + register unsigned long loop = cache_info.ic_loop; + register unsigned long i, j; + + if (size > 64 * 1024) { + /* Just punt and clear the whole damn thing */ + flush_instruction_cache(); + return; + } + + for(i = 0; i <= count; i++, start += L1_CACHE_BYTES) + for(j = 0; j < loop; j++) + fice(start); +#else + flush_instruction_cache(); +#endif +} + +static inline void +flush_kernel_dcache_range(unsigned long start, unsigned long size) +{ + register unsigned long end = start + size; + register unsigned long i; + + start &= ~(L1_CACHE_BYTES - 1); + for (i = start; i < end; i += L1_CACHE_BYTES) { + kernel_fdc(i); + } + asm volatile("sync" : : ); + asm volatile("syncdma" : : ); +} + +extern void __flush_page_to_ram(unsigned long address); + +#define flush_cache_all() flush_all_caches() +#define flush_cache_mm(foo) flush_all_caches() + +#if 0 +/* This is how I think the cache flushing should be done -- mrw */ +extern inline void flush_cache_mm(struct mm_struct *mm) { + if (mm == current->mm) { + flush_user_dcache_range(mm->start_data, mm->end_data); + flush_user_icache_range(mm->start_code, mm->end_code); + } else { + flush_other_dcache_range(mm->context, mm->start_data, mm->end_data); + flush_other_icache_range(mm->context, mm->start_code, mm->end_code); + } +} +#endif + +#define flush_cache_range(mm, start, end) do { \ + __flush_dcache_range(start, (unsigned long)end - (unsigned long)start); \ + __flush_icache_range(start, (unsigned long)end - (unsigned long)start); \ +} while(0) + +#define flush_cache_page(vma, vmaddr) do { \ + __flush_dcache_range(vmaddr, PAGE_SIZE); \ + __flush_icache_range(vmaddr, PAGE_SIZE); \ +} while(0) + +#define flush_page_to_ram(page) \ + __flush_page_to_ram((unsigned long)page_address(page)) + +#define flush_icache_range(start, end) \ + __flush_icache_range(start, end - start) + +#define flush_icache_page(vma, page) \ + __flush_icache_range(page_address(page), PAGE_SIZE) + +#define flush_dcache_page(page) \ + __flush_dcache_range(page_address(page), PAGE_SIZE) + +/* TLB flushing routines.... */ + +extern void flush_data_tlb(void); +extern void flush_instruction_tlb(void); + +#define flush_tlb() do { \ + flush_data_tlb(); \ + flush_instruction_tlb(); \ +} while(0); + +#define flush_tlb_all() flush_tlb() /* XXX p[id]tlb */ + +extern __inline__ void flush_tlb_pgtables(struct mm_struct *mm, unsigned long start, unsigned long end) +{ +} + +static inline void flush_instruction_tlb_range(unsigned long start, + unsigned long size) +{ +#if 0 + register unsigned long count = (size / PAGE_SIZE); + register unsigned long loop = cache_info.it_loop; + register unsigned long i, j; + + for(i = 0; i <= count; i++, start += PAGE_SIZE) + for(j = 0; j < loop; j++) + pitlbe(start); +#else + flush_instruction_tlb(); +#endif +} + +static inline void flush_data_tlb_range(unsigned long start, + unsigned long size) +{ +#if 0 + register unsigned long count = (size / PAGE_SIZE); + register unsigned long loop = cache_info.dt_loop; + register unsigned long i, j; + + for(i = 0; i <= count; i++, start += PAGE_SIZE) + for(j = 0; j < loop; j++) + pdtlbe(start); +#else + flush_data_tlb(); +#endif +} + + + +static inline void __flush_tlb_range(unsigned long space, unsigned long start, + unsigned long size) +{ + unsigned long old_sr1; + + if(!size) + return; + + old_sr1 = mfsp(1); + mtsp(space, 1); + + flush_data_tlb_range(start, size); + flush_instruction_tlb_range(start, size); + + mtsp(old_sr1, 1); +} + +extern void __flush_tlb_space(unsigned long space); + +static inline void flush_tlb_mm(struct mm_struct *mm) +{ +#if 0 + __flush_tlb_space(mm->context); +#else + flush_tlb(); +#endif +} + +static inline void flush_tlb_page(struct vm_area_struct *vma, + unsigned long addr) +{ + __flush_tlb_range(vma->vm_mm->context, addr, PAGE_SIZE); + +} + +static inline void flush_tlb_range(struct mm_struct *mm, + unsigned long start, unsigned long end) +{ + __flush_tlb_range(mm->context, start, end - start); +} + +/* + * NOTE: Many of the below macros use PT_NLEVELS because + * it is convenient that PT_NLEVELS == LOG2(pte size in bytes), + * i.e. we use 3 level page tables when we use 8 byte pte's + * (for 64 bit) and 2 level page tables when we use 4 byte pte's + */ + +#ifdef __LP64__ +#define PT_NLEVELS 3 +#define PT_INITIAL 4 /* Number of initial page tables */ +#else +#define PT_NLEVELS 2 +#define PT_INITIAL 2 /* Number of initial page tables */ +#endif + +/* Definitions for 1st level */ + +#define PGDIR_SHIFT (PAGE_SHIFT + (PT_NLEVELS - 1)*(PAGE_SHIFT - PT_NLEVELS)) +#define PGDIR_SIZE (1UL << PGDIR_SHIFT) +#define PGDIR_MASK (~(PGDIR_SIZE-1)) +#define PTRS_PER_PGD (1UL << (PAGE_SHIFT - PT_NLEVELS)) +#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) + +/* Definitions for 2nd level */ + +#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT - PT_NLEVELS)) +#define PMD_SIZE (1UL << PMD_SHIFT) +#define PMD_MASK (~(PMD_SIZE-1)) +#if PT_NLEVELS == 3 +#define PTRS_PER_PMD (1UL << (PAGE_SHIFT - PT_NLEVELS)) +#else +#define PTRS_PER_PMD 1 +#endif + +/* Definitions for 3rd level */ + +#define PTRS_PER_PTE (1UL << (PAGE_SHIFT - PT_NLEVELS)) + + +#define get_pgd_fast get_pgd_slow +#define free_pgd_fast free_pgd_slow + +extern __inline__ pgd_t *get_pgd_slow(void) +{ + extern unsigned long gateway_pgd_offset; + extern unsigned long gateway_pgd_entry; + pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL); + + if (ret) { + memset (ret, 0, PTRS_PER_PGD * sizeof(pgd_t)); + + /* Install HP-UX and Linux gateway page translations */ + + pgd_val(*(ret + gateway_pgd_offset)) = gateway_pgd_entry; + } + return ret; +} + +extern __inline__ void free_pgd_slow(pgd_t *pgd) +{ + free_page((unsigned long)pgd); +} + +#if PT_NLEVELS == 3 + +/* Three Level Page Table Support for pmd's */ + +extern __inline__ pmd_t *get_pmd_fast(void) +{ + return NULL; /* la la */ +} + +#if 0 +extern __inline__ void free_pmd_fast(pmd_t *pmd) +{ +} +#else +#define free_pmd_fast free_pmd_slow +#endif + +extern __inline__ pmd_t *get_pmd_slow(void) +{ + pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL); + + if (pmd) + clear_page(pmd); + return pmd; +} + +extern __inline__ void free_pmd_slow(pmd_t *pmd) +{ + free_page((unsigned long)pmd); +} + +extern void __bad_pgd(pgd_t *pgd); + +extern inline pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) +{ + address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); + + if (pgd_none(*pgd)) + goto getnew; + if (pgd_bad(*pgd)) + goto fix; + return (pmd_t *) pgd_page(*pgd) + address; +getnew: +{ + pmd_t *page = get_pmd_fast(); + + if (!page) + page = get_pmd_slow(); + if (page) { + if (pgd_none(*pgd)) { + pgd_val(*pgd) = _PAGE_TABLE + __pa((unsigned long)page); + return page + address; + } + else + free_pmd_fast(page); + } + else { + return NULL; + } +} +fix: + __bad_pgd(pgd); + return NULL; +} + +#else + +/* Two Level Page Table Support for pmd's */ + +extern inline pmd_t * pmd_alloc(pgd_t * pgd, unsigned long address) +{ + return (pmd_t *) pgd; +} + +extern inline void free_pmd_fast(pmd_t * pmd) +{ +} + +#endif + +extern __inline__ pte_t *get_pte_fast(void) +{ + return NULL; /* la la */ +} + +#if 0 +extern __inline__ void free_pte_fast(pte_t *pte) +{ +} +#else +#define free_pte_fast free_pte_slow +#endif + +extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); + +extern __inline__ void free_pte_slow(pte_t *pte) +{ + free_page((unsigned long)pte); +} + +#define pmd_alloc_kernel pmd_alloc +#define pte_alloc_kernel pte_alloc + +#define pte_free(pte) free_pte_fast(pte) +#define pmd_free(pmd) free_pmd_fast(pmd) +#define pgd_free(pgd) free_pgd_fast(pgd) +#define pgd_alloc() get_pgd_fast() + +extern void __bad_pmd(pmd_t *pmd); + +extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) +{ + address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); + + if (pmd_none(*pmd)) + goto getnew; + if (pmd_bad(*pmd)) + goto fix; + return (pte_t *) pmd_page(*pmd) + address; +getnew: +{ + pte_t *page = get_pte_fast(); + + if (!page) + return get_pte_slow(pmd, address); + pmd_val(*pmd) = _PAGE_TABLE + __pa((unsigned long)page); + return page + address; +} +fix: + __bad_pmd(pmd); + return NULL; +} + +extern int do_check_pgt_cache(int, int); + +#endif diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h new file mode 100644 index 000000000..6213ab850 --- /dev/null +++ b/include/asm-parisc/pgtable.h @@ -0,0 +1,337 @@ +#ifndef _PARISC_PGTABLE_H +#define _PARISC_PGTABLE_H + +#ifndef __ASSEMBLY__ +/* + * we simulate an x86-style page table for the linux mm code + */ + +#include +#include +#include + +/* To make 53c7xx.c happy */ + +#define IOMAP_FULL_CACHING 2 /* used for 'what' below */ +#define IOMAP_NOCACHE_SER 3 + +extern void kernel_set_cachemode(unsigned long addr, + unsigned long size, int what); + +/* + * cache_clear() semantics: Clear any cache entries for the area in question, + * without writing back dirty entries first. This is useful if the data will + * be overwritten anyway, e.g. by DMA to memory. The range is defined by a + * _physical_ address. + */ +#define cache_clear(paddr, len) do { } while (0) +/* + * cache_push() semantics: Write back any dirty cache data in the given area, + * and invalidate the range in the instruction cache. It needs not (but may) + * invalidate those entries also in the data cache. The range is defined by a + * _physical_ address. + */ +#define cache_push(paddr, len) \ + do { \ + unsigned long vaddr = phys_to_virt(paddr); \ + flush_cache_range(&init_mm, vaddr, vaddr + len); \ + } while(0) +#define cache_push_v(vaddr, len) \ + flush_cache_range(&init_mm, vaddr, vaddr + len) + +/* + * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel + * memory. For the return value to be meaningful, ADDR must be >= + * PAGE_OFFSET. This operation can be relatively expensive (e.g., + * require a hash-, or multi-level tree-lookup or something of that + * sort) but it guarantees to return TRUE only if accessing the page + * at that address does not cause an error. Note that there may be + * addresses for which kern_addr_valid() returns FALSE even though an + * access would not cause an error (e.g., this is typically true for + * memory mapped I/O regions. + * + * XXX Need to implement this for parisc. + */ +#define kern_addr_valid(addr) (1) + +/* Certain architectures need to do special things when PTEs + * within a page table are directly modified. Thus, the following + * hook is made available. + */ +#define set_pte(pteptr, pteval) \ + do{ \ + *(pteptr) = (pteval); \ + } while(0) + + + +#endif /* !__ASSEMBLY__ */ + +#define pte_ERROR(e) \ + printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) +#define pmd_ERROR(e) \ + printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) +#define pgd_ERROR(e) \ + printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) + +/* + * pgd entries used up by user/kernel: + */ + +#define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT) +#define FIRST_USER_PGD_NR 0 + +#ifndef __ASSEMBLY__ +extern void *vmalloc_start; +#define PCXL_DMA_MAP_SIZE (8*1024*1024) +#define VMALLOC_START ((unsigned long)vmalloc_start) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) +#define VMALLOC_END (FIXADDR_START) +#endif + +#define _PAGE_READ 0x001 /* read access allowed */ +#define _PAGE_WRITE 0x002 /* write access allowed */ +#define _PAGE_EXEC 0x004 /* execute access allowed */ +#define _PAGE_GATEWAY 0x008 /* privilege promotion allowed */ +#define _PAGE_GATEWAY_BIT 28 /* _PAGE_GATEWAY & _PAGE_GATEWAY_BIT need */ + /* to agree. One could be defined in relation */ + /* to the other, but that's kind of ugly. */ + + /* 0x010 reserved (B bit) */ +#define _PAGE_DIRTY 0x020 /* D: dirty */ + /* 0x040 reserved (T bit) */ +#define _PAGE_NO_CACHE 0x080 /* Software: Uncacheable */ +#define _PAGE_NO_CACHE_BIT 24 /* Needs to agree with _PAGE_NO_CACHE above */ +#define _PAGE_ACCESSED 0x100 /* R: page cache referenced */ +#define _PAGE_PRESENT 0x200 /* Software: pte contains a translation */ +#define _PAGE_PRESENT_BIT 22 /* Needs to agree with _PAGE_PRESENT above */ +#define _PAGE_USER 0x400 /* Software: User accessable page */ +#define _PAGE_USER_BIT 21 /* Needs to agree with _PAGE_USER above */ + /* 0x800 still available */ + +#ifdef __ASSEMBLY__ +#define _PGB_(x) (1 << (63 - (x))) +#define __PAGE_O _PGB_(13) +#define __PAGE_U _PGB_(12) +#define __PAGE_T _PGB_(2) +#define __PAGE_D _PGB_(3) +#define __PAGE_B _PGB_(4) +#define __PAGE_P _PGB_(14) +#endif +#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED) +#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) +#define _PAGE_KERNEL (_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED) + +#ifndef __ASSEMBLY__ + +#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) +#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_READ | _PAGE_WRITE | _PAGE_ACCESSED) +/* Others seem to make this executable, I don't know if that's correct + or not. The stack is mapped this way though so this is necessary + in the short term - dhd@linuxcare.com, 2000-08-08 */ +#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_READ | _PAGE_ACCESSED) +#define PAGE_WRITEONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_WRITE | _PAGE_ACCESSED) +#define PAGE_EXECREAD __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_READ | _PAGE_EXEC |_PAGE_ACCESSED) +#define PAGE_COPY PAGE_EXECREAD +#define PAGE_RWX __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_READ | _PAGE_WRITE | _PAGE_EXEC |_PAGE_ACCESSED) +#define PAGE_KERNEL __pgprot(_PAGE_KERNEL) +#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_DIRTY | _PAGE_ACCESSED) +#define PAGE_KERNEL_UNC __pgprot(_PAGE_KERNEL | _PAGE_NO_CACHE) +#define PAGE_GATEWAY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_GATEWAY| _PAGE_READ) + + +/* + * We could have an execute only page using "gateway - promote to priv + * level 3", but that is kind of silly. So, the way things are defined + * now, we must always have read permission for pages with execute + * permission. For the fun of it we'll go ahead and support write only + * pages. + */ + + /*xwr*/ +#define __P000 PAGE_NONE +#define __P001 PAGE_READONLY +#define __P010 __P000 /* copy on write */ +#define __P011 __P001 /* copy on write */ +#define __P100 PAGE_EXECREAD +#define __P101 PAGE_EXECREAD +#define __P110 __P100 /* copy on write */ +#define __P111 __P101 /* copy on write */ + +#define __S000 PAGE_NONE +#define __S001 PAGE_READONLY +#define __S010 PAGE_WRITEONLY +#define __S011 PAGE_SHARED +#define __S100 PAGE_EXECREAD +#define __S101 PAGE_EXECREAD +#define __S110 PAGE_RWX +#define __S111 PAGE_RWX + +extern unsigned long swapper_pg_dir[]; /* declared in init_task.c */ + +/* initial page tables for 0-8MB for kernel */ + +extern unsigned long pg0[]; + +/* zero page used for uninitialized stuff */ + +extern unsigned long *empty_zero_page; + +/* + * BAD_PAGETABLE is used when we need a bogus page-table, while + * BAD_PAGE is used for a bogus page. + * + * ZERO_PAGE is a global shared page that is always zero: used + * for zero-mapped memory areas etc.. + */ +extern pte_t __bad_page(void); +extern pte_t * __bad_pagetable(void); + +#define BAD_PAGETABLE __bad_pagetable() +#define BAD_PAGE __bad_page() +#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) + +#define pte_none(x) (!pte_val(x)) +#define pte_present(x) (pte_val(x) & _PAGE_PRESENT) +#define pte_clear(xp) do { pte_val(*(xp)) = 0; } while (0) +#define pte_pagenr(x) ((unsigned long)((pte_val(x) >> PAGE_SHIFT))) + +#define pmd_none(x) (!pmd_val(x)) +#define pmd_bad(x) ((pmd_val(x) & ~PAGE_MASK) != _PAGE_TABLE) +#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) +#define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0) + + + +#ifdef __LP64__ +#define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) + +/* For 64 bit we have three level tables */ + +#define pgd_none(x) (!pgd_val(x)) +#define pgd_bad(x) ((pgd_val(x) & ~PAGE_MASK) != _PAGE_TABLE) +#define pgd_present(x) (pgd_val(x) & _PAGE_PRESENT) +#define pgd_clear(xp) do { pgd_val(*(xp)) = 0; } while (0) +#else +/* + * The "pgd_xxx()" functions here are trivial for a folded two-level + * setup: the pgd is never bad, and a pmd always exists (as it's folded + * into the pgd entry) + */ +extern inline int pgd_none(pgd_t pgd) { return 0; } +extern inline int pgd_bad(pgd_t pgd) { return 0; } +extern inline int pgd_present(pgd_t pgd) { return 1; } +extern inline void pgd_clear(pgd_t * pgdp) { } +#endif + +/* + * The following only work if pte_present() is true. + * Undefined behaviour if not.. + */ +extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; } +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_WRITE; } + +extern inline pte_t pte_rdprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_READ; 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_WRITE; return pte; } +extern inline pte_t pte_mkread(pte_t pte) { pte_val(pte) |= _PAGE_READ; return pte; } +extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } +extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } +extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; } + +/* + * Conversion functions: convert a page and protection to a page entry, + * and a page entry and page directory to the page they refer to. + */ +#define __mk_pte(addr,pgprot) \ +({ \ + pte_t __pte; \ + \ + pte_val(__pte) = ((addr)+pgprot_val(pgprot)); \ + \ + __pte; \ +}) + +#define mk_pte(page,pgprot) \ +({ \ + pte_t __pte; \ + \ + pte_val(__pte) = ((page)-mem_map)*PAGE_SIZE + \ + pgprot_val(pgprot); \ + __pte; \ +}) + +/* This takes a physical page address that is used by the remapping functions */ +#define mk_pte_phys(physpage, pgprot) \ +({ pte_t __pte; pte_val(__pte) = physpage + pgprot_val(pgprot); __pte; }) + +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; } + +/* + * Permanent address of a page. Obviously must never be + * called on a highmem page. + */ +#define page_address(page) ({ if (!(page)->virtual) BUG(); (page)->virtual; }) +#define __page_address(page) ({ if (PageHighMem(page)) BUG(); PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT); }) +#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) +#define pte_page(x) (mem_map+pte_pagenr(x)) + +#define pmd_page(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) + +#define pgd_index(address) ((address) >> PGDIR_SHIFT) + +/* to find an entry in a page-table-directory */ +#define pgd_offset(mm, address) \ +((mm)->pgd + ((address) >> PGDIR_SHIFT)) + +/* to find an entry in a kernel page-table-directory */ +#define pgd_offset_k(address) pgd_offset(&init_mm, address) + +/* Find an entry in the second-level page table.. */ + +#ifdef __LP64__ +#define pmd_offset(dir,address) \ +((pmd_t *) pgd_page(*(dir)) + (((address)>>PMD_SHIFT) & (PTRS_PER_PMD-1))) +#else +#define pmd_offset(dir,addr) ((pmd_t *) dir) +#endif + +/* Find an entry in the third-level page table.. */ +#define pte_offset(pmd, address) \ +((pte_t *) pmd_page(*(pmd)) + (((address)>>PAGE_SHIFT) & (PTRS_PER_PTE-1))) + +extern void paging_init (void); + +extern inline void update_mmu_cache(struct vm_area_struct * vma, + unsigned long address, pte_t pte) +{ +} + +/* Encode and de-code a swap entry */ + +#define SWP_TYPE(x) ((x).val & 0x3f) +#define SWP_OFFSET(x) ( (((x).val >> 6) & 0x7) | \ + (((x).val >> 7) & ~0x7) ) +#define SWP_ENTRY(type, offset) ((swp_entry_t) { (type) | \ + ((offset & 0x7) << 6) | \ + ((offset & ~0x7) << 7) }) +#define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) +#define swp_entry_to_pte(x) ((pte_t) { (x).val }) + +#define module_map vmalloc +#define module_unmap vfree + +#include + +#endif /* !__ASSEMBLY__ */ + +/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ +#define PageSkip(page) (0) + +#define io_remap_page_range remap_page_range + +#endif /* _PARISC_PAGE_H */ diff --git a/include/asm-parisc/poll.h b/include/asm-parisc/poll.h new file mode 100644 index 000000000..55ebfcc44 --- /dev/null +++ b/include/asm-parisc/poll.h @@ -0,0 +1,25 @@ +#ifndef __PARISC_POLL_H +#define __PARISC_POLL_H + +/* These are specified by iBCS2 */ +#define POLLIN 0x0001 +#define POLLPRI 0x0002 +#define POLLOUT 0x0004 +#define POLLERR 0x0008 +#define POLLHUP 0x0010 +#define POLLNVAL 0x0020 + +/* The rest seem to be more-or-less nonstandard. Check them! */ +#define POLLRDNORM 0x0040 +#define POLLRDBAND 0x0080 +#define POLLWRNORM 0x0100 +#define POLLWRBAND 0x0200 +#define POLLMSG 0x0400 + +struct pollfd { + int fd; + short events; + short revents; +}; + +#endif diff --git a/include/asm-parisc/posix_types.h b/include/asm-parisc/posix_types.h new file mode 100644 index 000000000..58f20853d --- /dev/null +++ b/include/asm-parisc/posix_types.h @@ -0,0 +1,140 @@ +#ifndef __ARCH_PARISC_POSIX_TYPES_H +#define __ARCH_PARISC_POSIX_TYPES_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 + * assume GCC is being used. + */ +typedef unsigned int __kernel_dev_t; +typedef unsigned long __kernel_ino_t; +typedef unsigned short __kernel_mode_t; +typedef unsigned short __kernel_nlink_t; +typedef long __kernel_off_t; +typedef int __kernel_pid_t; +typedef unsigned short __kernel_ipc_pid_t; +typedef unsigned int __kernel_uid_t; +typedef unsigned int __kernel_gid_t; +typedef int __kernel_suseconds_t; +typedef int __kernel_clock_t; +typedef int __kernel_daddr_t; +/* Note these change from narrow to wide kernels */ +typedef unsigned long __kernel_size_t; +typedef long __kernel_ssize_t; +typedef long __kernel_ptrdiff_t; +typedef long __kernel_time_t; +typedef char * __kernel_caddr_t; + +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; +typedef unsigned int __kernel_uid32_t; +typedef unsigned int __kernel_gid32_t; + +#ifdef __GNUC__ +typedef long long __kernel_loff_t; +typedef long long __kernel_off64_t; +typedef unsigned long long __kernel_ino64_t; +#endif + +typedef struct { +#if defined(__KERNEL__) || defined(__USE_ALL) + int val[2]; +#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ + int __val[2]; +#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ +} __kernel_fsid_t; + +#if defined(__KERNEL__) && defined(__LP64__) +/* Now 32bit compatibility types */ +typedef unsigned int __kernel_dev_t32; +typedef unsigned int __kernel_ino_t32; +typedef unsigned short __kernel_mode_t32; +typedef unsigned short __kernel_nlink_t32; +typedef int __kernel_off_t32; +typedef int __kernel_pid_t32; +typedef unsigned short __kernel_ipc_pid_t32; +typedef unsigned int __kernel_uid_t32; +typedef unsigned int __kernel_gid_t32; +typedef unsigned int __kernel_size_t32; +typedef int __kernel_ssize_t32; +typedef int __kernel_ptrdiff_t32; +typedef int __kernel_time_t32; +typedef int __kernel_suseconds_t32; +typedef int __kernel_clock_t32; +typedef int __kernel_daddr_t32; +typedef unsigned int __kernel_caddr_t32; +#endif + +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) + +#undef __FD_SET +static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp) +{ + unsigned long __tmp = __fd / __NFDBITS; + unsigned long __rem = __fd % __NFDBITS; + __fdsetp->fds_bits[__tmp] |= (1UL<<__rem); +} + +#undef __FD_CLR +static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp) +{ + unsigned long __tmp = __fd / __NFDBITS; + unsigned long __rem = __fd % __NFDBITS; + __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem); +} + +#undef __FD_ISSET +static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p) +{ + unsigned long __tmp = __fd / __NFDBITS; + unsigned long __rem = __fd % __NFDBITS; + return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0; +} + +/* + * This will unroll the loop for the normal constant case (8 ints, + * for a 256-bit fd_set) + */ +#undef __FD_ZERO +static __inline__ void __FD_ZERO(__kernel_fd_set *__p) +{ + unsigned long *__tmp = __p->fds_bits; + int __i; + + if (__builtin_constant_p(__FDSET_LONGS)) { + switch (__FDSET_LONGS) { + case 16: + __tmp[ 0] = 0; __tmp[ 1] = 0; + __tmp[ 2] = 0; __tmp[ 3] = 0; + __tmp[ 4] = 0; __tmp[ 5] = 0; + __tmp[ 6] = 0; __tmp[ 7] = 0; + __tmp[ 8] = 0; __tmp[ 9] = 0; + __tmp[10] = 0; __tmp[11] = 0; + __tmp[12] = 0; __tmp[13] = 0; + __tmp[14] = 0; __tmp[15] = 0; + return; + + case 8: + __tmp[ 0] = 0; __tmp[ 1] = 0; + __tmp[ 2] = 0; __tmp[ 3] = 0; + __tmp[ 4] = 0; __tmp[ 5] = 0; + __tmp[ 6] = 0; __tmp[ 7] = 0; + return; + + case 4: + __tmp[ 0] = 0; __tmp[ 1] = 0; + __tmp[ 2] = 0; __tmp[ 3] = 0; + return; + } + } + __i = __FDSET_LONGS; + while (__i) { + __i--; + *__tmp = 0; + __tmp++; + } +} + +#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ + +#endif diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h new file mode 100644 index 000000000..406366292 --- /dev/null +++ b/include/asm-parisc/processor.h @@ -0,0 +1,341 @@ +/* + * include/asm-parisc/processor.h + * + * Copyright (C) 1994 Linus Torvalds + */ + +#ifndef __ASM_PARISC_PROCESSOR_H +#define __ASM_PARISC_PROCESSOR_H + +#ifndef __ASSEMBLY__ +#include + +#include +#include +#include +#include +#include +#endif /* __ASSEMBLY__ */ + +/* + * Default implementation of macro that returns current + * instruction pointer ("program counter"). + */ + +/* We cannot use MFIA as it was added for PA2.0 - prumpf + + At one point there were no "0f/0b" type local symbols in gas for + PA-RISC. This is no longer true, but this still seems like the + nicest way to implement this. */ + +#define current_text_addr() ({ void *pc; __asm__("\n\tblr 0,%0\n\tnop":"=r" (pc)); pc; }) + +#define TASK_SIZE (PAGE_OFFSET) +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) + +#ifndef __ASSEMBLY__ + +/* +** Data detected about CPUs at boot time which is the same for all CPU's. +** HP boxes are SMP - ie identical processors. +** +** FIXME: some CPU rev info may be processor specific... +*/ +struct system_cpuinfo_parisc { + unsigned int cpu_count; + unsigned int cpu_hz; + unsigned int hversion; + unsigned int sversion; + enum cpu_type cpu_type; + + struct { + struct pdc_model model; + struct pdc_model_cpuid /* ARGH */ versions; + struct pdc_model_cpuid cpuid; +#if 0 + struct pdc_model_caps caps; +#endif + char sys_model_name[81]; /* PDC-ROM returnes this model name */ + } pdc; + + char *model_name; + char *cpu_name; + char *family_name; +}; + + +/* +** Per CPU data structure - ie varies per CPU. +*/ +struct cpuinfo_parisc { + unsigned cpuid; + + struct irq_region *region; + + unsigned long it_value; /* Interval Timer value at last timer interrupt */ + unsigned long it_delta; /* Interval Timer delta (tic_10ms / HZ * 100) */ + + unsigned long hpa; /* Host Physical address */ + unsigned long txn_addr; /* External Interrupt Register or id_eid */ + + unsigned long bh_count; /* number of times bh was invoked */ + unsigned long irq_count; /* number of IRQ's since boot */ + unsigned long irq_max_cr16; /* longest time to handle a single IRQ */ +}; + +extern struct system_cpuinfo_parisc boot_cpu_data; +extern struct cpuinfo_parisc cpu_data[NR_CPUS]; +#define current_cpu_data cpu_data[smp_processor_id()] + +extern void identify_cpu(struct cpuinfo_parisc *); + +#define EISA_bus 0 /* we don't have ISA support yet */ +#define EISA_bus__is_a_macro /* for versions in ksyms.c */ +#define MCA_bus 0 +#define MCA_bus__is_a_macro /* for versions in ksyms.c */ + +typedef struct { + int seg; +} mm_segment_t; + +struct thread_struct { + struct pt_regs regs; + unsigned long pg_tables; + unsigned long flags; +}; + +/* Thread struct flags. */ +#define PARISC_KERNEL_DEATH (1UL << 31) /* see die_if_kernel()... */ + +#define INIT_MMAP { &init_mm, 0, 0, NULL, PAGE_SHARED, \ + VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } + +#define INIT_THREAD { { \ + { 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0 }, \ + { 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0 }, \ + { 0, 0, 0, 0, 0, 0, 0, 0 }, \ + { 0, 0}, { 0, 0}, 0, 0, 0, 0 \ + }, __pa((unsigned long) swapper_pg_dir) } + +/* + * Return saved PC of a blocked thread. This is used by ps mostly. + */ + +extern inline unsigned long thread_saved_pc(struct thread_struct *t) +{ + return 0xabcdef; +} + +/* + * Start user thread in another space. + * + * Note that we set both the iaoq and r31 to the new pc. When + * the kernel initially calls execve it will return through an + * rfi path that will use the values in the iaoq. The execve + * syscall path will return through the gateway page, and + * that uses r31 to branch to. + * + * For ELF we clear r23, because the dynamic linker uses it to pass + * the address of the finalizer function. + * + * We also initialize sr3 to an illegal value (illegal for our + * implementation, not for the architecture). + */ + +/* The ELF abi wants things done a "wee bit" differently than + * som does. Supporting this behavior here avoids + * having our own version of create_elf_tables. + * + * Oh, and yes, that is not a typo, we are really passing argc in r25 + * and argv in r24 (rather than r26 and r25). This is because that's + * where __libc_start_main wants them. + * + * Duplicated from dl-machine.h for the benefit of readers: + * + * Our initial stack layout is rather different from everyone else's + * due to the unique PA-RISC ABI. As far as I know it looks like + * this: + + ----------------------------------- (user startup code creates this frame) + | 32 bytes of magic | + |---------------------------------| + | 32 bytes argument/sp save area | + |---------------------------------| ((current->mm->env_end) + 63 & ~63) + | N bytes of slack | + |---------------------------------| + | envvar and arg strings | + |---------------------------------| + | ELF auxiliary info | + | (up to 28 words) | + |---------------------------------| + | Environment variable pointers | + | upwards to NULL | + |---------------------------------| + | Argument pointers | + | upwards to NULL | + |---------------------------------| + | argc (1 word) | + ----------------------------------- + + * The pleasant part of this is that if we need to skip arguments we + * can just decrement argc and move argv, because the stack pointer + * is utterly unrelated to the location of the environment and + * argument vectors. + * + * Note that the S/390 people took the easy way out and hacked their + * GCC to make the stack grow downwards. */ + +#define start_thread_som(regs, new_pc, new_sp) do { \ + unsigned long *sp = (unsigned long *)new_sp; \ + __u32 spaceid = (__u32)current->mm->context; \ + unsigned long pc = (unsigned long)new_pc; \ + /* offset pc for priv. level */ \ + pc |= 3; \ + \ + set_fs(USER_DS); \ + regs->iasq[0] = spaceid; \ + regs->iasq[1] = spaceid; \ + regs->iaoq[0] = pc; \ + regs->iaoq[1] = pc; \ + regs->sr[2] = LINUX_GATEWAY_SPACE; \ + regs->sr[3] = 0xffff; \ + regs->sr[4] = spaceid; \ + regs->sr[5] = spaceid; \ + regs->sr[6] = spaceid; \ + regs->sr[7] = spaceid; \ + regs->gr[ 0] = USER_INIT_PSW; \ + regs->gr[30] = ((new_sp)+63)&~63; \ + regs->gr[31] = pc; \ + \ + get_user(regs->gr[26],&sp[0]); \ + get_user(regs->gr[25],&sp[-1]); \ + get_user(regs->gr[24],&sp[-2]); \ + get_user(regs->gr[23],&sp[-3]); \ + \ + regs->cr30 = (u32) current; \ +} while(0) + + +#define start_thread(regs, new_pc, new_sp) do { \ + unsigned long *sp = (unsigned long *)new_sp; \ + __u32 spaceid = (__u32)current->mm->context; \ + unsigned long pc = (unsigned long)new_pc; \ + /* offset pc for priv. level */ \ + pc |= 3; \ + \ + \ + set_fs(USER_DS); \ + regs->iasq[0] = spaceid; \ + regs->iasq[1] = spaceid; \ + regs->iaoq[0] = pc; \ + regs->iaoq[1] = pc; \ + regs->sr[2] = LINUX_GATEWAY_SPACE; \ + regs->sr[3] = 0xffff; \ + regs->sr[4] = spaceid; \ + regs->sr[5] = spaceid; \ + regs->sr[6] = spaceid; \ + regs->sr[7] = spaceid; \ + regs->gr[ 0] = USER_INIT_PSW; \ + regs->fr[ 0] = 0LL; \ + regs->fr[ 1] = 0LL; \ + regs->fr[ 2] = 0LL; \ + regs->fr[ 3] = 0LL; \ + regs->gr[30] = ((current->mm->env_end)+63)&~63; \ + regs->gr[31] = pc; \ + \ + get_user(regs->gr[25],&sp[0]); \ + regs->gr[24] = (unsigned long) &sp[1]; \ + regs->gr[23] = 0; \ + \ + regs->cr30 = (u32) current; \ +} while(0) + +#ifdef __LP64__ + +/* + * For 64 bit kernels we need a version of start thread for 32 bit + * elf files. + * + * FIXME: It should be possible to not duplicate the above code + * by playing games with concatenation to form both + * macros at compile time. The only difference between + * this macro and the above is the name and the types + * for sp and pc. + */ + +#define start_thread32(regs, new_pc, new_sp) do { \ + __u32 *sp = (__u32 *)new_sp; \ + __u32 spaceid = (__u32)current->mm->context; \ + __u32 pc = (__u32)new_pc; \ + /* offset pc for priv. level */ \ + pc |= 3; \ + \ + set_fs(USER_DS); \ + regs->iasq[0] = spaceid; \ + regs->iasq[1] = spaceid; \ + regs->iaoq[0] = pc; \ + regs->iaoq[1] = pc; \ + regs->sr[2] = LINUX_GATEWAY_SPACE; \ + regs->sr[3] = 0xffff; \ + regs->sr[4] = spaceid; \ + regs->sr[5] = spaceid; \ + regs->sr[6] = spaceid; \ + regs->sr[7] = spaceid; \ + regs->gr[ 0] = USER_INIT_PSW; \ + regs->fr[ 0] = 0LL; \ + regs->fr[ 1] = 0LL; \ + regs->fr[ 2] = 0LL; \ + regs->fr[ 3] = 0LL; \ + regs->gr[30] = ((current->mm->env_end)+63)&~63; \ + regs->gr[31] = pc; \ + \ + get_user(regs->gr[25],&sp[0]); \ + regs->gr[24] = (unsigned long) &sp[1]; \ + regs->gr[23] = 0; \ + \ + regs->cr30 = (u32) current; \ +} while(0) + +#endif + +struct task_struct; + +/* Free all resources held by a thread. */ +extern void release_thread(struct task_struct *); +extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); + +#define copy_segments(tsk, mm) do { } while (0) +#define release_segments(mm) do { } while (0) +#define forget_segments() do { } while (0) + +extern inline unsigned long get_wchan(struct task_struct *p) +{ + return 0xdeadbeef; /* XXX */ +} + +#define KSTK_EIP(tsk) (0xdeadbeef) +#define KSTK_ESP(tsk) (0xdeadbeef) + +/* Be sure to hunt all references to this down when you change the size of + * the kernel stack */ + +#endif /* __ASSEMBLY__ */ + +#define THREAD_SIZE (4*PAGE_SIZE) + +#define alloc_task_struct() \ + ((struct task_struct *) __get_free_pages(GFP_KERNEL,2)) +#define free_task_struct(p) free_pages((unsigned long)(p),2) +#define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count) + +#define init_task (init_task_union.task) +#define init_stack (init_task_union.stack) + + +#endif /* __ASM_PARISC_PROCESSOR_H */ diff --git a/include/asm-parisc/psw.h b/include/asm-parisc/psw.h new file mode 100644 index 000000000..5d425e490 --- /dev/null +++ b/include/asm-parisc/psw.h @@ -0,0 +1,54 @@ +#ifndef _PARISC_PSW_H +#define PSW_I 0x00000001 +#define PSW_D 0x00000002 +#define PSW_P 0x00000004 +#define PSW_Q 0x00000008 + +#define PSW_R 0x00000010 +#define PSW_F 0x00000020 +#define PSW_G 0x00000040 /* PA1.x only */ +#define PSW_O 0x00000080 /* PA2.0 only */ + +#define PSW_M 0x00010000 +#define PSW_V 0x00020000 +#define PSW_C 0x00040000 +#define PSW_B 0x00080000 + +#define PSW_X 0x00100000 +#define PSW_N 0x00200000 +#define PSW_L 0x00400000 +#define PSW_H 0x00800000 + +#define PSW_T 0x01000000 +#define PSW_S 0x02000000 +#define PSW_E 0x04000000 +#define PSW_W 0x08000000 /* PA2.0 only */ + +#define PSW_Z 0x40000000 /* PA1.x only */ +#define PSW_Y 0x80000000 /* PA1.x only */ + +/* PSW bits to be used with ssm/rsm */ +#define PSW_SM_I 0x1 +#define PSW_SM_D 0x2 +#define PSW_SM_P 0x4 +#define PSW_SM_Q 0x8 +#define PSW_SM_R 0x10 +#define PSW_SM_F 0x20 +#define PSW_SM_G 0x40 +#define PSW_SM_O 0x80 +#define PSW_SM_E 0x100 +#define PSW_SM_W 0x200 + +#ifdef __LP64__ +# define USER_PSW (PSW_C | PSW_D | PSW_Q | PSW_I) +# define USER_INIT_PSW (PSW_C | PSW_D | PSW_Q | PSW_I | PSW_N) +# define KERNEL_PSW (PSW_C | PSW_D | PSW_Q | PSW_W) +# define PDC_PSW (PSW_Q | PSW_W) +#else +# define USER_PSW (PSW_C | PSW_D | PSW_Q | PSW_I | PSW_P) +# define USER_INIT_PSW (PSW_C | PSW_D | PSW_Q | PSW_I | PSW_N) +# define KERNEL_PSW (PSW_C | PSW_D | PSW_Q) +# define PDC_PSW (PSW_Q) +#endif + +#endif diff --git a/include/asm-parisc/ptrace.h b/include/asm-parisc/ptrace.h new file mode 100644 index 000000000..81ea038ac --- /dev/null +++ b/include/asm-parisc/ptrace.h @@ -0,0 +1,56 @@ +#ifndef _PARISC_PTRACE_H +#define _PARISC_PTRACE_H + +/* written by Philipp Rumpf, Copyright (C) 1999 SuSE GmbH Nuernberg +** Copyright (C) 2000 Grant Grundler, Hewlett-Packard +*/ + +#include + +/* This struct defines the way the registers are stored on the + stack during a system call. */ + +struct pt_regs { + unsigned long gr[32]; /* PSW is in gr[0] */ + __u64 fr[32]; + unsigned long sr[ 8]; + unsigned long iasq[2]; + unsigned long iaoq[2]; + unsigned long cr24; + unsigned long cr25; + unsigned long cr26; + unsigned long cr27; + unsigned long cr30; + unsigned long orig_r28; + unsigned long ksp; + unsigned long kpc; + unsigned long sar; /* CR11 */ + unsigned long iir; /* CR19 */ + unsigned long isr; /* CR20 */ + unsigned long ior; /* CR21 */ + unsigned long ipsw; /* CR22 */ + unsigned long cr_pid[4]; /* CR8,9,12,13 */ +}; + +#define task_regs(task) ((struct pt_regs *) ((char *)(task) + TASK_REGS)) +/* + * The numbers chosen here are somewhat arbitrary but absolutely MUST + * not overlap with any of the number assigned in . + * + * These ones are taken from IA-64 on the assumption that theirs are + * the most correct (and we also want to support PTRACE_SINGLEBLOCK + * since we have taken branch traps too) + */ +#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */ +#define PTRACE_GETSIGINFO 13 /* get child's siginfo structure */ +#define PTRACE_SETSIGINFO 14 /* set child's siginfo structure */ + +#ifdef __KERNEL__ + +/* XXX should we use iaoq[1] or iaoq[0] ? */ +#define user_mode(regs) (((regs)->iaoq[0] & 3) ? 1 : 0) +#define instruction_pointer(regs) ((regs)->iaoq[0] & ~3) +extern void show_regs(struct pt_regs *); +#endif + +#endif diff --git a/include/asm-parisc/real.h b/include/asm-parisc/real.h new file mode 100644 index 000000000..82acb25db --- /dev/null +++ b/include/asm-parisc/real.h @@ -0,0 +1,5 @@ +#ifndef _PARISC_REAL_H +#define _PARISC_REAL_H + + +#endif diff --git a/include/asm-parisc/resource.h b/include/asm-parisc/resource.h new file mode 100644 index 000000000..f9088848f --- /dev/null +++ b/include/asm-parisc/resource.h @@ -0,0 +1,47 @@ +#ifndef _ASM_PARISC_RESOURCE_H +#define _ASM_PARISC_RESOURCE_H + +/* + * Resource limits + */ + +#define RLIMIT_CPU 0 /* CPU time in ms */ +#define RLIMIT_FSIZE 1 /* Maximum filesize */ +#define RLIMIT_DATA 2 /* max data size */ +#define RLIMIT_STACK 3 /* max stack size */ +#define RLIMIT_CORE 4 /* max core file size */ +#define RLIMIT_RSS 5 /* max resident set size */ +#define RLIMIT_NPROC 6 /* max number of processes */ +#define RLIMIT_NOFILE 7 /* max number of open files */ +#define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */ +#define RLIMIT_AS 9 /* address space limit */ +#define RLIMIT_LOCKS 10 /* maximum file locks held */ + +#define RLIM_NLIMITS 11 + +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + */ +#define RLIM_INFINITY (~0UL) + +#ifdef __KERNEL__ + +#define INIT_RLIMITS \ +{ \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { _STK_LIM, 10 * _STK_LIM }, \ + { 0, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { 0, 0 }, \ + { INR_OPEN, INR_OPEN }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ + { RLIM_INFINITY, RLIM_INFINITY }, \ +} + +#endif /* __KERNEL__ */ + +#endif diff --git a/include/asm-parisc/runway.h b/include/asm-parisc/runway.h new file mode 100644 index 000000000..a1dea786d --- /dev/null +++ b/include/asm-parisc/runway.h @@ -0,0 +1,9 @@ +#ifndef ASM_PARISC_RUNWAY_H +#define ASM_PARISC_RUNWAY_H +#ifdef __KERNEL__ + +/* declared in arch/parisc/kernel/setup.c */ +extern struct proc_dir_entry * proc_runway_root; + +#endif /* __KERNEL__ */ +#endif /* ASM_PARISC_RUNWAY_H */ diff --git a/include/asm-parisc/scatterlist.h b/include/asm-parisc/scatterlist.h new file mode 100644 index 000000000..3ef9a113d --- /dev/null +++ b/include/asm-parisc/scatterlist.h @@ -0,0 +1,20 @@ +#ifndef _ASM_PARISC_SCATTERLIST_H +#define _ASM_PARISC_SCATTERLIST_H + +struct scatterlist { + char * address; /* Location data is to be transferred to */ + char * alt_address; /* Location of actual if address is a + * dma indirect buffer. NULL otherwise */ + unsigned int length; + + /* an IOVA can be 64-bits on some PA-Risc platforms. */ + dma_addr_t iova; /* I/O Virtual Address */ + __u32 iova_length; /* bytes mapped */ +}; + +#define sg_dma_address(sg) ((sg)->iova) +#define sg_dma_len(sg) ((sg)->iova_length) + +#define ISA_DMA_THRESHOLD (~0UL) + +#endif /* _ASM_PARISC_SCATTERLIST_H */ diff --git a/include/asm-parisc/segment.h b/include/asm-parisc/segment.h new file mode 100644 index 000000000..26794ddb6 --- /dev/null +++ b/include/asm-parisc/segment.h @@ -0,0 +1,6 @@ +#ifndef __PARISC_SEGMENT_H +#define __PARISC_SEGMENT_H + +/* Only here because we have some old header files that expect it.. */ + +#endif diff --git a/include/asm-parisc/semaphore-helper.h b/include/asm-parisc/semaphore-helper.h new file mode 100644 index 000000000..387f7c127 --- /dev/null +++ b/include/asm-parisc/semaphore-helper.h @@ -0,0 +1,89 @@ +#ifndef _ASM_PARISC_SEMAPHORE_HELPER_H +#define _ASM_PARISC_SEMAPHORE_HELPER_H + +/* + * SMP- and interrupt-safe semaphores helper functions. + * + * (C) Copyright 1996 Linus Torvalds + * (C) Copyright 1999 Andrea Arcangeli + */ + +/* + * 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. + */ +static __inline__ void wake_one_more(struct semaphore * sem) +{ + atomic_inc((atomic_t *)&sem->waking); +} + +static __inline__ int waking_non_zero(struct semaphore *sem) +{ + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + if (sem->waking > 0) { + sem->waking--; + ret = 1; + } + spin_unlock_irqrestore(&semaphore_wake_lock, flags); + return ret; +} + +/* + * waking_non_zero_interruptible: + * 1 got the lock + * 0 go to sleep + * -EINTR interrupted + * + * We must undo the sem->count down_interruptible() increment while we are + * protected by the spinlock in order to make atomic this atomic_inc() with the + * atomic_read() in wake_one_more(), otherwise we can race. -arca + */ +static __inline__ int waking_non_zero_interruptible(struct semaphore *sem, + struct task_struct *tsk) +{ + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + if (sem->waking > 0) { + sem->waking--; + ret = 1; + } else if (signal_pending(tsk)) { + atomic_inc(&sem->count); + ret = -EINTR; + } + spin_unlock_irqrestore(&semaphore_wake_lock, flags); + return ret; +} + +/* + * waking_non_zero_trylock: + * 1 failed to lock + * 0 got the lock + * + * We must undo the sem->count down_trylock() increment while we are + * protected by the spinlock in order to make atomic this atomic_inc() with the + * atomic_read() in wake_one_more(), otherwise we can race. -arca + */ +static __inline__ int waking_non_zero_trylock(struct semaphore *sem) +{ + unsigned long flags; + int ret = 1; + + spin_lock_irqsave(&semaphore_wake_lock, flags); + if (sem->waking <= 0) + atomic_inc(&sem->count); + else { + sem->waking--; + ret = 0; + } + spin_unlock_irqrestore(&semaphore_wake_lock, flags); + return ret; +} + +#endif /* _ASM_PARISC_SEMAPHORE_HELPER_H */ diff --git a/include/asm-parisc/semaphore.h b/include/asm-parisc/semaphore.h new file mode 100644 index 000000000..12deca83c --- /dev/null +++ b/include/asm-parisc/semaphore.h @@ -0,0 +1,301 @@ +#ifndef _ASM_PARISC_SEMAPHORE_H +#define _ASM_PARISC_SEMAPHORE_H + +#include + +/* + * SMP- and interrupt-safe semaphores. + * + * (C) Copyright 1996 Linus Torvalds + * + * SuperH verison by Niibe Yutaka + * + */ + +/* if you're going to use out-of-line slowpaths, use .section .lock.text, + * not .text.lock or the -ffunction-sections monster will eat you alive + */ + +#include + +#include +#include + +struct semaphore { + atomic_t count; + int waking; + wait_queue_head_t wait; +#if WAITQUEUE_DEBUG + long __magic; +#endif +}; + +#if WAITQUEUE_DEBUG +# define __SEM_DEBUG_INIT(name) \ + , (long)&(name).__magic +#else +# define __SEM_DEBUG_INIT(name) +#endif + +#define __SEMAPHORE_INITIALIZER(name,count) \ +{ ATOMIC_INIT(count), 0, __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ + __SEM_DEBUG_INIT(name) } + +#define __MUTEX_INITIALIZER(name) \ + __SEMAPHORE_INITIALIZER(name,1) + +#define __DECLARE_SEMAPHORE_GENERIC(name,count) \ + struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) + +#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) +#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) + +extern inline void sema_init (struct semaphore *sem, int val) +{ +/* + * *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); + * + * i'd rather use the more flexible initialization above, but sadly + * GCC 2.7.2.3 emits a bogus warning. EGCS doesnt. Oh well. + */ + atomic_set(&sem->count, val); + sem->waking = 0; + init_waitqueue_head(&sem->wait); +#if WAITQUEUE_DEBUG + sem->__magic = (long)&sem->__magic; +#endif +} + +static inline void init_MUTEX (struct semaphore *sem) +{ + sema_init(sem, 1); +} + +static inline void init_MUTEX_LOCKED (struct semaphore *sem) +{ + sema_init(sem, 0); +} + +asmlinkage void __down_failed(void /* special register calling convention */); +asmlinkage int __down_failed_interruptible(void /* params in registers */); +asmlinkage int __down_failed_trylock(void /* params in registers */); +asmlinkage void __up_wakeup(void /* special register calling convention */); + +asmlinkage void __down(struct semaphore * sem); +asmlinkage int __down_interruptible(struct semaphore * sem); +asmlinkage int __down_trylock(struct semaphore * sem); +asmlinkage void __up(struct semaphore * sem); + +extern spinlock_t semaphore_wake_lock; + +extern __inline__ void down(struct semaphore * sem) +{ +#if WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif + + if (atomic_dec_return(&sem->count) < 0) + __down(sem); +} + +extern __inline__ int down_interruptible(struct semaphore * sem) +{ + int ret = 0; +#if WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif + + if (atomic_dec_return(&sem->count) < 0) + ret = __down_interruptible(sem); + return ret; +} + +extern __inline__ int down_trylock(struct semaphore * sem) +{ + int ret = 0; +#if WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif + + if (atomic_dec_return(&sem->count) < 0) + ret = __down_trylock(sem); + return ret; +} + +/* + * Note! This is subtle. We jump to wake people up only if + * the semaphore was negative (== somebody was waiting on it). + */ +extern __inline__ void up(struct semaphore * sem) +{ +#if WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif + if (atomic_inc_return(&sem->count) <= 0) + __up(sem); +} + +/* rw mutexes (should that be mutices? =) -- throw rw + * spinlocks and semaphores together, and this is what we + * end up with... + * + * The lock is initialized to BIAS. This way, a writer + * subtracts BIAS ands gets 0 for the case of an uncontended + * lock. Readers decrement by 1 and see a positive value + * when uncontended, negative if there are writers waiting + * (in which case it goes to sleep). + * + * The value 0x01000000 supports up to 128 processors and + * lots of processes. BIAS must be chosen such that subl'ing + * BIAS once per CPU will result in the long remaining + * negative. + * + * In terms of fairness, this should result in the lock + * flopping back and forth between readers and writers + * under heavy use. + * + * -ben + */ +struct rw_semaphore { + atomic_t count; + volatile unsigned char write_bias_granted; + volatile unsigned char read_bias_granted; + volatile unsigned char pad1; + volatile unsigned char pad2; + wait_queue_head_t wait; + wait_queue_head_t write_bias_wait; +#if WAITQUEUE_DEBUG + long __magic; + atomic_t readers; + atomic_t writers; +#endif +}; + +#if WAITQUEUE_DEBUG +#define __RWSEM_DEBUG_INIT , ATOMIC_INIT(0), ATOMIC_INIT(0) +#else +#define __RWSEM_DEBUG_INIT /* */ +#endif + +#define RW_LOCK_BIAS 0x01000000 + +#define __RWSEM_INITIALIZER(name,count) \ +{ ATOMIC_INIT(count), 0, 0, 0, 0, __WAIT_QUEUE_HEAD_INITIALIZER((name).wait), \ + __WAIT_QUEUE_HEAD_INITIALIZER((name).write_bias_wait) \ + __SEM_DEBUG_INIT(name) __RWSEM_DEBUG_INIT } + +#define __DECLARE_RWSEM_GENERIC(name,count) \ + struct rw_semaphore name = __RWSEM_INITIALIZER(name,count) + +#define DECLARE_RWSEM(name) __DECLARE_RWSEM_GENERIC(name,RW_LOCK_BIAS) +#define DECLARE_RWSEM_READ_LOCKED(name) __DECLARE_RWSEM_GENERIC(name,RW_LOCK_BIAS-1) +#define DECLARE_RWSEM_WRITE_LOCKED(name) __DECLARE_RWSEM_GENERIC(name,0) + +extern inline void init_rwsem(struct rw_semaphore *sem) +{ + atomic_set(&sem->count, RW_LOCK_BIAS); + sem->read_bias_granted = 0; + sem->write_bias_granted = 0; + init_waitqueue_head(&sem->wait); + init_waitqueue_head(&sem->write_bias_wait); +#if WAITQUEUE_DEBUG + sem->__magic = (long)&sem->__magic; + atomic_set(&sem->readers, 0); + atomic_set(&sem->writers, 0); +#endif +} + +#ifdef FIXME_WILLY_FIXME_FOR_REAL_THIS_TIME +extern struct rw_semaphore *__build_read_lock(struct rw_semaphore *sem, const char *what); +extern struct rw_semaphore *__build_write_lock(struct rw_semaphore *sem, const char *what); +#endif + +/* we use FASTCALL convention for the helpers */ +extern struct rw_semaphore *FASTCALL(__down_read_failed(struct rw_semaphore *sem)); +extern struct rw_semaphore *FASTCALL(__down_write_failed(struct rw_semaphore *sem)); +extern struct rw_semaphore *FASTCALL(__rwsem_wake(struct rw_semaphore *sem)); + +extern inline void down_read(struct rw_semaphore *sem) +{ +#if WAITQUEUE_DEBUG + if (sem->__magic != (long)&sem->__magic) + BUG(); +#endif +#ifdef FIXME_WILLY_FIXME_FOR_REAL_THIS_TIME + __build_read_lock(sem, "__down_read_failed"); +#endif +#if WAITQUEUE_DEBUG + if (sem->write_bias_granted) + BUG(); + if (atomic_read(&sem->writers)) + BUG(); + atomic_inc(&sem->readers); +#endif +} + +extern inline void down_write(struct rw_semaphore *sem) +{ +#if WAITQUEUE_DEBUG + if (sem->__magic != (long)&sem->__magic) + BUG(); +#endif +#ifdef FIXME_WILLY_FIXME_FOR_REAL_THIS_TIME + __build_write_lock(sem, "__down_write_failed"); +#endif +#if WAITQUEUE_DEBUG + if (atomic_read(&sem->writers)) + BUG(); + if (atomic_read(&sem->readers)) + BUG(); + if (sem->read_bias_granted) + BUG(); + if (sem->write_bias_granted) + BUG(); + atomic_inc(&sem->writers); +#endif +} + +/* When a reader does a release, the only significant + * case is when there was a writer waiting, and we've + * bumped the count to 0: we must wake the writer up. + */ +extern inline void __up_read(struct rw_semaphore *sem) +{ +} + +/* releasing the writer is easy -- just release it and + * wake up any sleepers. + */ +extern inline void __up_write(struct rw_semaphore *sem) +{ +} + +extern inline void up_read(struct rw_semaphore *sem) +{ +#if WAITQUEUE_DEBUG + if (sem->write_bias_granted) + BUG(); + if (atomic_read(&sem->writers)) + BUG(); + atomic_dec(&sem->readers); +#endif + __up_read(sem); +} + +extern inline void up_write(struct rw_semaphore *sem) +{ +#if WAITQUEUE_DEBUG + if (sem->read_bias_granted) + BUG(); + if (sem->write_bias_granted) + BUG(); + if (atomic_read(&sem->readers)) + BUG(); + if (atomic_read(&sem->writers) != 1) + BUG(); + atomic_dec(&sem->writers); +#endif + __up_write(sem); +} + +#endif /* _ASM_PARISC_SEMAPHORE_H */ diff --git a/include/asm-parisc/sembuf.h b/include/asm-parisc/sembuf.h new file mode 100644 index 000000000..25f3ef8f3 --- /dev/null +++ b/include/asm-parisc/sembuf.h @@ -0,0 +1,25 @@ +#ifndef _PARISC_SEMBUF_H +#define _PARISC_SEMBUF_H + +/* + * The semid64_ds structure for parisc architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 64-bit time_t to solve y2038 problem + * - 2 miscellaneous 32-bit values + */ + +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ + unsigned int __pad1; + __kernel_time_t sem_otime; /* last semop time */ + unsigned int __pad2; + __kernel_time_t sem_ctime; /* last change time */ + unsigned int sem_nsems; /* no. of semaphores in array */ + unsigned int __unused1; + unsigned int __unused2; +}; + +#endif /* _PARISC_SEMBUF_H */ diff --git a/include/asm-parisc/serial.h b/include/asm-parisc/serial.h new file mode 100644 index 000000000..a9cef8e95 --- /dev/null +++ b/include/asm-parisc/serial.h @@ -0,0 +1,47 @@ +/* + * include/asm-parisc/serial.h + */ + +#include +#include + +/* + * This assumes you have a 7.272727 MHz clock for your UART. + * The documentation implies a 40Mhz clock, and elsewhere a 7Mhz clock + * Clarified: 7.2727MHz on LASI. Not yet clarified for DINO + */ + +#define LASI_BASE_BAUD ( 7272727 / 16 ) +#define BASE_BAUD LASI_BASE_BAUD + +#ifdef CONFIG_SERIAL_DETECT_IRQ +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ) +#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ) +#else +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF +#endif + +#ifdef CONFIG_SERIAL_MANY_PORTS +#define FOURPORT_FLAGS ASYNC_FOURPORT +#define ACCENT_FLAGS 0 +#define BOCA_FLAGS 0 +#define HUB6_FLAGS 0 +#define RS_TABLE_SIZE 64 +#else +#define RS_TABLE_SIZE 4 +#endif + +/* + * The base is relative to the LASI base. We can fix that + * up later. We could also virtually map LASI so that we get + * nice constants all over our kernel... + */ + +#define STD_SERIAL_PORT_DEFNS \ + /* UART CLK PORT IRQ FLAGS */ \ + { 0, LASI_BASE_BAUD, -1, 4, ASYNC_SKIP_TEST, 0, PORT_UNKNOWN,}, /* ttyS0 */ + +#define SERIAL_PORT_DFNS \ + STD_SERIAL_PORT_DEFNS + diff --git a/include/asm-parisc/setup.h b/include/asm-parisc/setup.h new file mode 100644 index 000000000..ae25cc427 --- /dev/null +++ b/include/asm-parisc/setup.h @@ -0,0 +1,10 @@ +/* + * Just a place holder. We don't want to have to test x86 before + * we include stuff + */ + +#ifndef _i386_SETUP_H +#define _i386_SETUP_H + + +#endif /* _i386_SETUP_H */ diff --git a/include/asm-parisc/shmbuf.h b/include/asm-parisc/shmbuf.h new file mode 100644 index 000000000..ea45e96b3 --- /dev/null +++ b/include/asm-parisc/shmbuf.h @@ -0,0 +1,50 @@ +#ifndef _PARISC_SHMBUF_H +#define _PARISC_SHMBUF_H + +/* + * The shmid64_ds structure for parisc architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 64-bit time_t to solve y2038 problem + * - 2 miscellaneous 32-bit values + */ + +struct shmid64_ds { + struct ipc64_perm shm_perm; /* operation perms */ + unsigned int __pad1; + __kernel_time_t shm_atime; /* last attach time */ + unsigned int __pad2; + __kernel_time_t shm_dtime; /* last detach time */ + unsigned int __pad3; + __kernel_time_t shm_ctime; /* last change time */ + size_t shm_segsz; /* size of segment (bytes) */ + __kernel_pid_t shm_cpid; /* pid of creator */ + __kernel_pid_t shm_lpid; /* pid of last operator */ + unsigned int shm_nattch; /* no. of current attaches */ + unsigned int __unused1; + unsigned int __unused2; +}; + +#ifdef __LP64__ +#warning shminfo64 is an undocumented struct +/* The 'unsigned int' (formerly 'unsigned long') data types below will + * ensure that a 32-bit app calling shmctl(*,IPC_INFO,*) will work on + * a wide kernel, but if some of these values are meant to contain pointers + * they may need to be 'long long' instead. -PB + */ +#endif +struct shminfo64 { + unsigned int shmmax; + unsigned int shmmin; + unsigned int shmmni; + unsigned int shmseg; + unsigned int shmall; + unsigned int __unused1; + unsigned int __unused2; + unsigned int __unused3; + unsigned int __unused4; +}; + +#endif /* _PARISC_SHMBUF_H */ diff --git a/include/asm-parisc/shmparam.h b/include/asm-parisc/shmparam.h new file mode 100644 index 000000000..bbc52f028 --- /dev/null +++ b/include/asm-parisc/shmparam.h @@ -0,0 +1,6 @@ +#ifndef _ASMPARISC_SHMPARAM_H +#define _ASMPARISC_SHMPARAM_H + +#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ + +#endif /* _ASMPARISC_SHMPARAM_H */ diff --git a/include/asm-parisc/sigcontext.h b/include/asm-parisc/sigcontext.h new file mode 100644 index 000000000..27ef31bb3 --- /dev/null +++ b/include/asm-parisc/sigcontext.h @@ -0,0 +1,20 @@ +#ifndef _ASMPARISC_SIGCONTEXT_H +#define _ASMPARISC_SIGCONTEXT_H + +#define PARISC_SC_FLAG_ONSTACK 1<<0 +#define PARISC_SC_FLAG_IN_SYSCALL 1<<1 + +/* We will add more stuff here as it becomes necessary, until we know + it works. */ +struct sigcontext { + unsigned long sc_flags; + + unsigned long sc_gr[32]; /* PSW in sc_gr[0] */ + unsigned long long sc_fr[32]; /* FIXME, do we need other state info? */ + unsigned long sc_iasq[2]; + unsigned long sc_iaoq[2]; + unsigned long sc_sar; /* cr11 */ +}; + + +#endif diff --git a/include/asm-parisc/siginfo.h b/include/asm-parisc/siginfo.h new file mode 100644 index 000000000..143fe7eef --- /dev/null +++ b/include/asm-parisc/siginfo.h @@ -0,0 +1,234 @@ +#ifndef _PARISC_SIGINFO_H +#define _PARISC_SIGINFO_H + +#include + +/* XXX: This structure was copied from the Alpha; is there an iBCS version? */ + +typedef union sigval { + int sival_int; + void *sival_ptr; +} sigval_t; + +#define SI_MAX_SIZE 128 +#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 3) + +typedef struct siginfo { + int si_signo; + int si_errno; + int si_code; + + union { + int _pad[SI_PAD_SIZE]; + + /* kill() */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + } _kill; + + /* POSIX.1b timers */ + struct { + unsigned int _timer1; + unsigned int _timer2; + } _timer; + + /* POSIX.1b signals */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + sigval_t _sigval; + } _rt; + + /* SIGCHLD */ + struct { + pid_t _pid; /* which child */ + uid_t _uid; /* sender's uid */ + int _status; /* exit code */ + clock_t _utime; + clock_t _stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + void *_addr; /* faulting insn/memory ref. */ + } _sigfault; + + /* SIGPOLL */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; +} siginfo_t; + +/* + * How these fields are to be accessed. + */ +#define si_pid _sifields._kill._pid +#define si_uid _sifields._kill._uid +#define si_status _sifields._sigchld._status +#define si_utime _sifields._sigchld._utime +#define si_stime _sifields._sigchld._stime +#define si_value _sifields._rt._sigval +#define si_int _sifields._rt._sigval.sival_int +#define si_ptr _sifields._rt._sigval.sival_ptr +#define si_addr _sifields._sigfault._addr +#define si_band _sifields._sigpoll._band +#define si_fd _sifields._sigpoll._fd + +#ifdef __KERNEL__ +#define __SI_MASK 0xffff0000 +#define __SI_KILL (0 << 16) +#define __SI_TIMER (1 << 16) +#define __SI_POLL (2 << 16) +#define __SI_FAULT (3 << 16) +#define __SI_CHLD (4 << 16) +#define __SI_RT (5 << 16) +#define __SI_CODE(T,N) ((T) << 16 | ((N) & 0xffff)) +#else +#define __SI_KILL 0 +#define __SI_TIMER 0 +#define __SI_POLL 0 +#define __SI_FAULT 0 +#define __SI_CHLD 0 +#define __SI_RT 0 +#define __SI_CODE(T,N) (N) +#endif + +/* + * si_code values + * Digital reserves positive values for kernel-generated signals. + */ +#define SI_USER 0 /* sent by kill, sigsend, raise */ +#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ +#define SI_QUEUE -1 /* sent by sigqueue */ +#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */ +#define SI_MESGQ -3 /* sent by real time mesq state change */ +#define SI_ASYNCIO -4 /* sent by AIO completion */ +#define SI_SIGIO -5 /* sent by queued SIGIO */ + +#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) +#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) + +/* + * SIGILL si_codes + */ +#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */ +#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */ +#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */ +#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */ +#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */ +#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */ +#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */ +#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */ +#define NSIGILL 8 + +/* + * SIGFPE si_codes + */ +#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */ +#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */ +#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */ +#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */ +#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */ +#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */ +#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */ +#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */ +#define NSIGFPE 8 + +/* + * SIGSEGV si_codes + */ +#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */ +#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */ +#define NSIGSEGV 2 + +/* + * SIGBUS si_codes + */ +#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */ +#define BUS_ADRERR (__SI_FAULT|2) /* non-existant physical address */ +#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */ +#define NSIGBUS 3 + +/* + * SIGTRAP si_codes + */ +#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */ +#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */ +#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */ +#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint or watchpoint */ +#define NSIGTRAP 4 + +/* + * SIGCHLD si_codes + */ +#define CLD_EXITED (__SI_CHLD|1) /* child has exited */ +#define CLD_KILLED (__SI_CHLD|2) /* child was killed */ +#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */ +#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */ +#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */ +#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */ +#define NSIGCHLD 6 + +/* + * SIGPOLL si_codes + */ +#define POLL_IN (__SI_POLL|1) /* data input available */ +#define POLL_OUT (__SI_POLL|2) /* output buffers available */ +#define POLL_MSG (__SI_POLL|3) /* input message available */ +#define POLL_ERR (__SI_POLL|4) /* i/o error */ +#define POLL_PRI (__SI_POLL|5) /* high priority input available */ +#define POLL_HUP (__SI_POLL|6) /* device disconnected */ +#define NSIGPOLL 6 + +/* + * sigevent definitions + * + * It seems likely that SIGEV_THREAD will have to be handled from + * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the + * thread manager then catches and does the appropriate nonsense. + * However, everything is written out here so as to not get lost. + */ +#define SIGEV_SIGNAL 0 /* notify via signal */ +#define SIGEV_NONE 1 /* other notification: meaningless */ +#define SIGEV_THREAD 2 /* deliver via thread creation */ + +#define SIGEV_MAX_SIZE 64 +#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3) + +typedef struct sigevent { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + union { + int _pad[SIGEV_PAD_SIZE]; + + struct { + void (*_function)(sigval_t); + void *_attribute; /* really pthread_attr_t */ + } _sigev_thread; + } _sigev_un; +} sigevent_t; + +#define sigev_notify_function _sigev_un._sigev_thread._function +#define sigev_notify_attributes _sigev_un._sigev_thread._attribute + +#ifdef __KERNEL__ +#include + +extern inline void copy_siginfo(siginfo_t *to, siginfo_t *from) +{ + if (from->si_code < 0) + memcpy(to, from, sizeof(siginfo_t)); + else + /* _sigchld is currently the largest know union member */ + memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld)); +} + +extern int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from); + +#endif /* __KERNEL__ */ + +#endif diff --git a/include/asm-parisc/signal.h b/include/asm-parisc/signal.h new file mode 100644 index 000000000..9295c212b --- /dev/null +++ b/include/asm-parisc/signal.h @@ -0,0 +1,163 @@ +#ifndef _ASM_PARISC_SIGNAL_H +#define _ASM_PARISC_SIGNAL_H + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT 6 +#define SIGEMT 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGBUS 10 +#define SIGSEGV 11 +#define SIGSYS 12 /* Linux doesn't use this */ +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGUSR1 16 +#define SIGUSR2 17 +#define SIGCHLD 18 +#define SIGPWR 19 +#define SIGVTALRM 20 +#define SIGPROF 21 +#define SIGIO 22 +#define SIGPOLL SIGIO +#define SIGWINCH 23 +#define SIGSTOP 24 +#define SIGTSTP 25 +#define SIGCONT 26 +#define SIGTTIN 27 +#define SIGTTOU 28 +#define SIGURG 29 +#define SIGLOST 30 /* Linux doesn't use this either */ +#define SIGUNUSED 31 +#define SIGRESERVE SIGUNUSED + +#define SIGXCPU 33 +#define SIGXFSZ 34 +#define SIGSTKFLT 36 + +/* These should not be considered constants from userland. */ +#define SIGRTMIN 37 +#define SIGRTMAX (_NSIG-1) /* it's 44 under HP/UX */ + +/* + * SA_FLAGS values: + * + * SA_ONSTACK indicates that a registered stack_t will be used. + * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the + * SA_RESTART flag to get restarting signals (which were the default long ago) + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. + * SA_RESETHAND clears the handler when the signal is delivered. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. + * SA_NODEFER prevents the current signal from being masked in the handler. + * + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single + * Unix names RESETHAND and NODEFER respectively. + */ +#define SA_ONSTACK 0x00000001 +#define SA_RESETHAND 0x00000004 +#define SA_NOCLDSTOP 0x00000008 +#define SA_SIGINFO 0x00000010 +#define SA_NODEFER 0x00000020 +#define SA_RESTART 0x00000040 +#define SA_NOCLDWAIT 0x00000080 /* not supported yet */ +#define _SA_SIGGFAULT 0x00000100 /* HPUX */ + +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND +#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ + +#define SA_RESTORER 0x04000000 /* obsolete -- ignored */ + +/* + * sigaltstack controls + */ +#define SS_ONSTACK 1 +#define SS_DISABLE 2 + +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 + +#ifdef __KERNEL__ + +#define _NSIG 64 +/* bits-per-word, where word apparently means 'long' not 'int' */ +#define _NSIG_BPW BITS_PER_LONG +#define _NSIG_WORDS (_NSIG / _NSIG_BPW) + +/* + * These values of sa_flags are used only by the kernel as part of the + * irq handling routines. + * + * SA_INTERRUPT is also used by the irq handling routines. + * SA_SHIRQ is for shared interrupt support on PCI and EISA. + */ +#define SA_PROBE SA_ONESHOT +#define SA_SAMPLE_RANDOM SA_RESTART +#define SA_SHIRQ 0x04000000 + +#endif /* __KERNEL__ */ + +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ + +# ifndef __ASSEMBLY__ + +# include + +/* Avoid too many header ordering problems. */ +struct siginfo; + +/* Type of a signal handler. */ +#ifdef __LP64__ +/* function pointers on 64-bit parisc are pointers to little structs and the + * compiler doesn't support code which changes or tests the address of + * the function in the little struct. This is really ugly -PB + */ +typedef __kernel_caddr_t __sighandler_t; +#else +typedef void (*__sighandler_t)(int); +#endif + +typedef struct sigaltstack { + void *ss_sp; + int ss_flags; + size_t ss_size; +} stack_t; + +#ifdef __KERNEL__ + +/* Most things should be clean enough to redefine this at will, if care + is taken to make libc match. */ + +typedef unsigned long old_sigset_t; /* at least 32 bits */ + +typedef struct { + /* next_signal() assumes this is a long - no choice */ + unsigned long sig[_NSIG_WORDS]; +} sigset_t; + +struct sigaction { + __sighandler_t sa_handler; + unsigned long sa_flags; + sigset_t sa_mask; /* mask last for extensibility */ +}; + +struct k_sigaction { + struct sigaction sa; +}; + +#include + +#endif /* __KERNEL__ */ +#endif /* !__ASSEMBLY */ +#endif /* _ASM_PARISC_SIGNAL_H */ diff --git a/include/asm-parisc/smp.h b/include/asm-parisc/smp.h new file mode 100644 index 000000000..36e78e9bc --- /dev/null +++ b/include/asm-parisc/smp.h @@ -0,0 +1,10 @@ +#ifndef __ASM_SMP_H +#define __ASM_SMP_H + +#include + +#ifdef CONFIG_SMP +extern volatile unsigned long cpu_online_map; /* Bitmap of available cpu's */ +#endif + +#endif diff --git a/include/asm-parisc/smplock.h b/include/asm-parisc/smplock.h new file mode 100644 index 000000000..1590fafe9 --- /dev/null +++ b/include/asm-parisc/smplock.h @@ -0,0 +1,49 @@ +/* + * + * + * Default SMP lock implementation + */ +#include +#include + +extern spinlock_t kernel_flag; + +/* + * Release global kernel lock and global interrupt lock + */ +#define release_kernel_lock(task, cpu) \ +do { \ + if (task->lock_depth >= 0) \ + spin_unlock(&kernel_flag); \ + release_irqlock(cpu); \ + __sti(); \ +} while (0) + +/* + * Re-acquire the kernel lock + */ +#define reacquire_kernel_lock(task) \ +do { \ + if (task->lock_depth >= 0) \ + spin_lock(&kernel_flag); \ +} while (0) + + +/* + * Getting the big kernel lock. + * + * This cannot happen asynchronously, + * so we only need to worry about other + * CPU's. + */ +extern __inline__ void lock_kernel(void) +{ + if (!++current->lock_depth) + spin_lock(&kernel_flag); +} + +extern __inline__ void unlock_kernel(void) +{ + if (--current->lock_depth < 0) + spin_unlock(&kernel_flag); +} diff --git a/include/asm-parisc/socket.h b/include/asm-parisc/socket.h new file mode 100644 index 000000000..6ce553460 --- /dev/null +++ b/include/asm-parisc/socket.h @@ -0,0 +1,59 @@ +#ifndef _ASM_SOCKET_H +#define _ASM_SOCKET_H + +#include + +/* For setsockoptions(2) */ +#define SOL_SOCKET 0xffff + +#define SO_DEBUG 0x0001 +#define SO_REUSEADDR 0x0004 +#define SO_KEEPALIVE 0x0008 +#define SO_DONTROUTE 0x0010 +#define SO_BROADCAST 0x0020 +#define SO_LINGER 0x0080 +#define SO_OOBINLINE 0x0100 +/* To add :#define SO_REUSEPORT 0x0200 */ +#define SO_SNDBUF 0x1001 +#define SO_RCVBUF 0x1002 +#define SO_SNDLOWAT 0x1003 +#define SO_RCVLOWAT 0x1004 +#define SO_SNDTIMEO 0x1005 +#define SO_RCVTIMEO 0x1006 +#define SO_ERROR 0x1007 +#define SO_TYPE 0x1008 +#define SO_PEERNAME 0x2000 + +#define SO_NO_CHECK 0x400b +#define SO_PRIORITY 0x400c +#define SO_BSDCOMPAT 0x400e +#define SO_PASSCRED 0x4010 +#define SO_PEERCRED 0x4011 +#define SO_TIMESTAMP 0x4012 +#define SCM_TIMESTAMP SO_TIMESTAMP + +/* Security levels - as per NRL IPv6 - don't actually do anything */ +#define SO_SECURITY_AUTHENTICATION 0x4016 +#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x4017 +#define SO_SECURITY_ENCRYPTION_NETWORK 0x4018 + +#define SO_BINDTODEVICE 0x4019 + +/* Socket filtering */ +#define SO_ATTACH_FILTER 0x401a +#define SO_DETACH_FILTER 0x401b + +#if defined(__KERNEL__) +#define SOCK_STREAM 1 /* stream (connection) socket */ +#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ +#define SOCK_RAW 3 /* raw socket */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequential packet socket */ +#define SOCK_PACKET 10 /* linux specific way of */ + /* getting packets at the dev */ + /* level. For writing rarp and */ + /* other similar things on the */ + /* user level. */ +#endif + +#endif /* _ASM_SOCKET_H */ diff --git a/include/asm-parisc/sockios.h b/include/asm-parisc/sockios.h new file mode 100644 index 000000000..aace49629 --- /dev/null +++ b/include/asm-parisc/sockios.h @@ -0,0 +1,12 @@ +#ifndef __ARCH_PARISC_SOCKIOS__ +#define __ARCH_PARISC_SOCKIOS__ + +/* Socket-level I/O control calls. */ +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#define SIOCGSTAMP 0x8906 /* Get stamp */ + +#endif diff --git a/include/asm-parisc/softirq.h b/include/asm-parisc/softirq.h new file mode 100644 index 000000000..4fe26b2b7 --- /dev/null +++ b/include/asm-parisc/softirq.h @@ -0,0 +1,15 @@ +#ifndef __ASM_SOFTIRQ_H +#define __ASM_SOFTIRQ_H + +#include +#include + +#define cpu_bh_disable(cpu) do { local_bh_count(cpu)++; barrier(); } while (0) +#define cpu_bh_enable(cpu) do { barrier(); local_bh_count(cpu)--; } while (0) + +#define local_bh_disable() cpu_bh_disable(smp_processor_id()) +#define local_bh_enable() cpu_bh_enable(smp_processor_id()) + +#define in_softirq() (local_bh_count(smp_processor_id()) != 0) + +#endif /* __ASM_SOFTIRQ_H */ diff --git a/include/asm-parisc/som.h b/include/asm-parisc/som.h new file mode 100644 index 000000000..5f90baa4a --- /dev/null +++ b/include/asm-parisc/som.h @@ -0,0 +1,8 @@ +#ifndef _ASM_PARISC_SOM_H +#define _ASM_PARISC_SOM_H + +/* File format definition for SOM executables / shared libraries */ +#include + + +#endif /* _ASM_PARISC_SOM_H diff --git a/include/asm-parisc/spinlock.h b/include/asm-parisc/spinlock.h new file mode 100644 index 000000000..7a59ed694 --- /dev/null +++ b/include/asm-parisc/spinlock.h @@ -0,0 +1,95 @@ +#ifndef __ASM_SPINLOCK_H +#define __ASM_SPINLOCK_H + +#include + +/* if you're going to use out-of-line slowpaths, use .section .lock.text, + * not .text.lock or the -ffunction-sections monster will eat you alive + */ + +/* we seem to be the only architecture that uses 0 to mean locked - but we + * have to. prumpf */ + +#undef SPIN_LOCK_UNLOCKED +#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 } + +#define spin_lock_init(x) do { (x)->lock = 1; } while(0) + +#define spin_unlock_wait(x) do { barrier(); } while(((volatile spinlock_t *)(x))->lock == 1) + +#define spin_lock(x) \ + do { while(__ldcw(&(x)->lock) == 0); } while(0) + +#define spin_unlock(x) \ + do { (x)->lock = 1; } while(0) + +#define spin_trylock(x) (__ldcw(&(x)->lock) == 1) + +/* + * Read-write spinlocks, allowing multiple readers + * but only one writer. + */ +typedef struct { + spinlock_t lock; + volatile int counter; +} rwlock_t; + +#define RW_LOCK_UNLOCKED (rwlock_t) { SPIN_LOCK_UNLOCKED, 0 } + +/* read_lock, read_unlock are pretty straightforward. Of course it somehow + * sucks we end up saving/restoring flags twice for read_lock_irqsave aso. */ + +static inline void read_lock(rwlock_t *rw) +{ + unsigned long flags; + spin_lock_irqsave(&rw->lock, flags); + + rw->counter++; + + spin_unlock_irqrestore(&rw->lock, flags); +} + +static inline void read_unlock(rwlock_t *rw) +{ + unsigned long flags; + spin_lock_irqsave(&rw->lock, flags); + + rw->counter--; + + spin_unlock_irqrestore(&rw->lock, flags); +} + +/* write_lock is less trivial. We optimistically grab the lock and check + * if we surprised any readers. If so we release the lock and wait till + * they're all gone before trying again + * + * Also note that we don't use the _irqsave / _irqrestore suffixes here. + * If we're called with interrupts enabled and we've got readers (or other + * writers) in interrupt handlers someone fucked up and we'd dead-lock + * sooner or later anyway. prumpf */ + +static inline void write_lock(rwlock_t *rw) +{ +retry: + spin_lock(&rw->lock); + + if(rw->counter != 0) { + /* this basically never happens */ + spin_unlock(&rw->lock); + + while(rw->counter != 0); + + goto retry; + } + + /* got it. now leave without unlocking */ +} + +/* write_unlock is absolutely trivial - we don't have to wait for anything */ + +static inline void write_unlock(rwlock_t *rw) +{ + spin_unlock(&rw->lock); +} + +#endif /* __ASM_SPINLOCK_H */ diff --git a/include/asm-parisc/stat.h b/include/asm-parisc/stat.h new file mode 100644 index 000000000..9d09e955a --- /dev/null +++ b/include/asm-parisc/stat.h @@ -0,0 +1,71 @@ +#ifndef _PARISC_STAT_H +#define _PARISC_STAT_H + +#include + +struct stat { + dev_t st_dev; /* dev_t is 32 bits on parisc */ + ino_t st_ino; /* 32 bits */ + mode_t st_mode; /* 16 bits */ + nlink_t st_nlink; /* 16 bits */ + unsigned short st_reserved1; /* old st_uid */ + unsigned short st_reserved2; /* old st_gid */ + dev_t st_rdev; + off_t st_size; + time_t st_atime; + unsigned int st_spare1; + time_t st_mtime; + unsigned int st_spare2; + time_t st_ctime; + unsigned int st_spare3; + int st_blksize; + int st_blocks; + unsigned int __unused1; /* ACL stuff */ + dev_t __unused2; /* network */ + ino_t __unused3; /* network */ + unsigned int __unused4; /* cnodes */ + unsigned short __unused5; /* netsite */ + short st_fstype; + dev_t st_realdev; + unsigned short st_basemode; + unsigned short st_spareshort; + uid_t st_uid; + gid_t st_gid; + unsigned int st_spare4[3]; +}; + +typedef __kernel_off64_t off64_t; + +struct hpux_stat64 { + dev_t st_dev; /* dev_t is 32 bits on parisc */ + ino_t st_ino; /* 32 bits */ + mode_t st_mode; /* 16 bits */ + nlink_t st_nlink; /* 16 bits */ + unsigned short st_reserved1; /* old st_uid */ + unsigned short st_reserved2; /* old st_gid */ + dev_t st_rdev; + off64_t st_size; + time_t st_atime; + unsigned int st_spare1; + time_t st_mtime; + unsigned int st_spare2; + time_t st_ctime; + unsigned int st_spare3; + int st_blksize; + __u64 st_blocks; + unsigned int __unused1; /* ACL stuff */ + dev_t __unused2; /* network */ + ino_t __unused3; /* network */ + unsigned int __unused4; /* cnodes */ + unsigned short __unused5; /* netsite */ + short st_fstype; + dev_t st_realdev; + unsigned short st_basemode; + unsigned short st_spareshort; + uid_t st_uid; + gid_t st_gid; + unsigned int st_spare4[3]; +}; +#define stat64 hpux_stat64 + +#endif diff --git a/include/asm-parisc/statfs.h b/include/asm-parisc/statfs.h new file mode 100644 index 000000000..db72e852e --- /dev/null +++ b/include/asm-parisc/statfs.h @@ -0,0 +1,25 @@ +#ifndef _PARISC_STATFS_H +#define _PARISC_STATFS_H + +#ifndef __KERNEL_STRICT_NAMES + +#include + +typedef __kernel_fsid_t fsid_t; + +#endif + +struct statfs { + long f_type; + long f_bsize; + long f_blocks; + long f_bfree; + long f_bavail; + long f_files; + long f_ffree; + __kernel_fsid_t f_fsid; + long f_namelen; + long f_spare[6]; +}; + +#endif diff --git a/include/asm-parisc/string.h b/include/asm-parisc/string.h new file mode 100644 index 000000000..beede5791 --- /dev/null +++ b/include/asm-parisc/string.h @@ -0,0 +1,2 @@ + +/* This left blank until we do parisc optimizations */ diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h new file mode 100644 index 000000000..1f2563418 --- /dev/null +++ b/include/asm-parisc/system.h @@ -0,0 +1,148 @@ +#ifndef __PARISC_SYSTEM_H +#define __PARISC_SYSTEM_H + +#include +#include + +/* The program status word as bitfields. */ +struct pa_psw { + unsigned int y:1; + unsigned int z:1; + unsigned int rv:2; + unsigned int w:1; + unsigned int e:1; + unsigned int s:1; + unsigned int t:1; + + unsigned int h:1; + unsigned int l:1; + unsigned int n:1; + unsigned int x:1; + unsigned int b:1; + unsigned int c:1; + unsigned int v:1; + unsigned int m:1; + + unsigned int cb:8; + + unsigned int o:1; + unsigned int g:1; + unsigned int f:1; + unsigned int r:1; + unsigned int q:1; + unsigned int p:1; + unsigned int d:1; + unsigned int i:1; +}; + +#define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW)) + +struct task_struct; + +extern struct task_struct *_switch_to(struct task_struct *, struct task_struct *); + +#define prepare_to_switch() do { } while(0) +#define switch_to(prev, next, last) do { \ + (last) = _switch_to(prev, next); \ +} while(0) + +/* borrowed this from sparc64 -- probably the SMP case is hosed for us */ +#ifdef CONFIG_SMP +#define smp_mb() mb() +#define smp_rmb() rmb() +#define smp_wmb() wmb() +#else +/* This is simply the barrier() macro from linux/kernel.h but when serial.c + * uses tqueue.h uses smp_mb() defined using barrier(), linux/kernel.h + * hasn't yet been included yet so it fails, thus repeating the macro here. + */ +#define smp_mb() __asm__ __volatile__("":::"memory"); +#define smp_rmb() __asm__ __volatile__("":::"memory"); +#define smp_wmb() __asm__ __volatile__("":::"memory"); +#endif + +/* interrupt control */ +#define __save_flags(x) __asm__ __volatile__("ssm 0, %0" : "=r" (x) : : "memory") +#define __restore_flags(x) __asm__ __volatile__("mtsm %0" : : "r" (x) : "memory") +#define __cli() __asm__ __volatile__("rsm %0,%%r0\n" : : "i" (PSW_I) : "memory" ) +#define __sti() __asm__ __volatile__("ssm %0,%%r0\n" : : "i" (PSW_I) : "memory" ) + +#define local_irq_save(x) \ + __asm__ __volatile__("rsm %1,%0" : "=r" (x) :"i" (PSW_I) : "memory" ) +#define local_irq_restore(x) \ + __asm__ __volatile__("mtsm %0" : : "r" (x) : "memory" ) +#define local_irq_disable() __cli() +#define local_irq_enable() __sti() + +#ifdef CONFIG_SMP +#else +#define cli() __cli() +#define sti() __sti() +#define save_flags(x) __save_flags(x) +#define restore_flags(x) __restore_flags(x) +#endif + + +#define mfctl(reg) ({ \ + unsigned long cr; \ + __asm__ __volatile__( \ + "mfctl " #reg ",%0" : \ + "=r" (cr) \ + ); \ + cr; \ +}) + +#define mtctl(gr, cr) \ + __asm__ __volatile__("mtctl %0,%1" \ + : /* no outputs */ \ + : "r" (gr), "i" (cr)) + +/* these are here to de-mystefy the calling code, and to provide hooks */ +/* which I needed for debugging EIEM problems -PB */ +#define get_eiem() mfctl(15) +static inline void set_eiem(unsigned long val) +{ + mtctl(val, 15); +} + +#define mfsp(reg) ({ \ + unsigned long cr; \ + __asm__ __volatile__( \ + "mfsp " #reg ",%0" : \ + "=r" (cr) \ + ); \ + cr; \ +}) + +#define mtsp(gr, cr) \ + __asm__ __volatile__("mtsp %0,%1" \ + : /* no outputs */ \ + : "r" (gr), "i" (cr)) + + +#define mb() __asm__ __volatile__ ("sync" : : :"memory") +#define wmb() mb() + +extern unsigned long __xchg(unsigned long, unsigned long *, int); + +#define xchg(ptr,x) \ + (__typeof__(*(ptr)))__xchg((unsigned long)(x),(unsigned long*)(ptr),sizeof(*(ptr))) + +/* LDCW, the only atomic read-write operation PA-RISC has. Sigh. */ +#define __ldcw(a) ({ \ + unsigned __ret; \ + __asm__ __volatile__("ldcw 0(%1),%0" : "=r" (__ret) : "r" (a)); \ + __ret; \ +}) + +#ifdef CONFIG_SMP +/* + * Your basic SMP spinlocks, allowing only a single CPU anywhere + */ + +typedef struct { + volatile unsigned int __attribute__((aligned(16))) lock; +} spinlock_t; +#endif + +#endif diff --git a/include/asm-parisc/termbits.h b/include/asm-parisc/termbits.h new file mode 100644 index 000000000..4cff59325 --- /dev/null +++ b/include/asm-parisc/termbits.h @@ -0,0 +1,174 @@ +#ifndef __ARCH_PARISC_TERMBITS_H__ +#define __ARCH_PARISC_TERMBITS_H__ + +#include + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 19 +struct termios { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ +}; + +/* c_cc characters */ +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 + + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0040000 + +/* c_oflag bits */ +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#define NLDLY 0000400 +#define NL0 0000000 +#define NL1 0000400 +#define CRDLY 0003000 +#define CR0 0000000 +#define CR1 0001000 +#define CR2 0002000 +#define CR3 0003000 +#define TABDLY 0014000 +#define TAB0 0000000 +#define TAB1 0004000 +#define TAB2 0010000 +#define TAB3 0014000 +#define XTABS 0014000 +#define BSDLY 0020000 +#define BS0 0000000 +#define BS1 0020000 +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 +#define FFDLY 0100000 +#define FF0 0000000 +#define FF1 0100000 + +/* c_cflag bit meaning */ +#define CBAUD 0010017 +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#define EXTA B19200 +#define EXTB B38400 +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 +#define CBAUDEX 0010000 +#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 */ + + +/* c_lflag bits */ +#define ISIG 0000001 +#define ICANON 0000002 +#define XCASE 0000004 +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0000400 +#define ECHOCTL 0001000 +#define ECHOPRT 0002000 +#define ECHOKE 0004000 +#define FLUSHO 0010000 +#define PENDIN 0040000 +#define IEXTEN 0100000 + +/* tcflow() and TCXONC use these */ +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* tcflush() and TCFLSH use these */ +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* tcsetattr uses these */ +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + +#endif diff --git a/include/asm-parisc/termios.h b/include/asm-parisc/termios.h new file mode 100644 index 000000000..6aa0f8ff7 --- /dev/null +++ b/include/asm-parisc/termios.h @@ -0,0 +1,103 @@ +#ifndef _PARISC_TERMIOS_H +#define _PARISC_TERMIOS_H + +#include +#include + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define NCC 8 +struct termio { + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ + +/* line disciplines */ +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 /* X.25 async */ +#define N_6PACK 7 +#define N_MASC 8 /* Reserved for Mobitex module */ +#define N_R3964 9 /* Reserved for Simatic R3964 module */ +#define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ +#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__ + +/* intr=^C quit=^\ erase=del kill=^U + eof=^D vtime=\0 vmin=\1 sxtc=\0 + start=^Q stop=^S susp=^Z eol=\0 + reprint=^R discard=^U werase=^W lnext=^V + eol2=\0 +*/ +#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" + +/* + * Translate a "termio" structure into a "termios". Ugh. + */ +#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ + unsigned short __tmp; \ + get_user(__tmp,&(termio)->x); \ + *(unsigned short *) &(termios)->x = __tmp; \ +} + +#define user_termio_to_kernel_termios(termios, termio) \ +({ \ + SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ + copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ +}) + +/* + * Translate a "termios" structure into a "termio". Ugh. + */ +#define kernel_termios_to_user_termio(termio, termios) \ +({ \ + put_user((termios)->c_iflag, &(termio)->c_iflag); \ + put_user((termios)->c_oflag, &(termio)->c_oflag); \ + put_user((termios)->c_cflag, &(termio)->c_cflag); \ + put_user((termios)->c_lflag, &(termio)->c_lflag); \ + put_user((termios)->c_line, &(termio)->c_line); \ + copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ +}) + +#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) +#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) + +#endif /* __KERNEL__ */ + +#endif /* _PARISC_TERMIOS_H */ diff --git a/include/asm-parisc/timex.h b/include/asm-parisc/timex.h new file mode 100644 index 000000000..7b901fc23 --- /dev/null +++ b/include/asm-parisc/timex.h @@ -0,0 +1,21 @@ +/* + * linux/include/asm-parisc/timex.h + * + * PARISC architecture timex specifications + */ +#ifndef _ASMPARISC_TIMEX_H +#define _ASMPARISC_TIMEX_H + +#include +#include + +typedef unsigned long cycles_t; + +extern cycles_t cacheflush_time; + +static inline cycles_t get_cycles (void) +{ + return mfctl(16); +} + +#endif diff --git a/include/asm-parisc/traps.h b/include/asm-parisc/traps.h new file mode 100644 index 000000000..6ebc4e6e2 --- /dev/null +++ b/include/asm-parisc/traps.h @@ -0,0 +1,4 @@ +#ifndef __ASM_TRAPS_H +#define __ASM_TRAPS_H + +#endif diff --git a/include/asm-parisc/types.h b/include/asm-parisc/types.h new file mode 100644 index 000000000..6d4698649 --- /dev/null +++ b/include/asm-parisc/types.h @@ -0,0 +1,54 @@ +#ifndef _PARISC_TYPES_H +#define _PARISC_TYPES_H + +typedef unsigned short umode_t; + +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +typedef __signed__ long long __s64; +typedef unsigned long long __u64; +#endif + +/* + * These aren't exported outside the kernel to avoid name space clashes + */ +#ifdef __KERNEL__ + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long long s64; +typedef unsigned long long u64; + +#ifdef __LP64__ +#define BITS_PER_LONG 64 +#else +#define BITS_PER_LONG 32 +#endif + +/* Dma addresses are 32-bits wide. */ + +typedef u32 dma_addr_t; + +#endif /* __KERNEL__ */ + +#endif diff --git a/include/asm-parisc/uaccess.h b/include/asm-parisc/uaccess.h new file mode 100644 index 000000000..70e834f12 --- /dev/null +++ b/include/asm-parisc/uaccess.h @@ -0,0 +1,189 @@ +#ifndef __PARISC_UACCESS_H +#define __PARISC_UACCESS_H + +/* + * User space memory access functions + */ +#include +#include +#include +#include + +#define VERIFY_READ 0 +#define VERIFY_WRITE 1 + +#define KERNEL_DS ((mm_segment_t){0}) +#define USER_DS ((mm_segment_t){1}) + +#define segment_eq(a,b) ((a).seg == (b).seg) + +#define get_ds() (KERNEL_DS) +#define get_fs() (current->addr_limit) +#define set_fs(x) (current->addr_limit = (x)) + +/* + * Note that since kernel addresses are in a separate address space on + * parisc, we don't need to do anything for access_ok() or verify_area(). + * We just let the page fault handler do the right thing. This also means + * that put_user is the same as __put_user, etc. + */ + +#define access_ok(type,addr,size) (1) +#define verify_area(type,addr,size) (0) + +#define put_user __put_user +#define get_user __get_user + +/* + * The exception table contains two values: the first is an address + * for an instruction that is allowed to fault, and the second is + * the number of bytes to skip if a fault occurs. We also support in + * two bit flags: 0x2 tells the exception handler to clear register + * r9 and 0x1 tells the exception handler to put -EFAULT in r8. + * This allows us to handle the simple cases for put_user and + * get_user without having to have .fixup sections. + */ + +struct exception_table_entry { + unsigned long addr; /* address of insn that is allowed to fault. */ + int skip; /* pcoq skip | r9 clear flag | r8 -EFAULT flag */ +}; + +extern const struct exception_table_entry + *search_exception_table(unsigned long addr); + +#define __get_user(x,ptr) \ +({ \ + register long __gu_err __asm__ ("r8") = 0; \ + register long __gu_val __asm__ ("r9") = 0; \ + \ + if (segment_eq(get_fs(),KERNEL_DS)) { \ + switch (sizeof(*(ptr))) { \ + case 1: __get_kernel_asm("ldb",ptr); break; \ + case 2: __get_kernel_asm("ldh",ptr); break; \ + case 4: __get_kernel_asm("ldw",ptr); break; \ + case 8: __get_kernel_asm("ldd",ptr); break; \ + default: BUG(); break; \ + } \ + } \ + else { \ + switch (sizeof(*(ptr))) { \ + case 1: __get_user_asm("ldb",ptr); break; \ + case 2: __get_user_asm("ldh",ptr); break; \ + case 4: __get_user_asm("ldw",ptr); break; \ + case 8: __get_user_asm("ldd",ptr); break; \ + default: BUG(); break; \ + } \ + } \ + \ + (x) = (__typeof__(*(ptr))) __gu_val; \ + __gu_err; \ +}) + +#define __get_kernel_asm(ldx,ptr) \ + __asm__("\n1:\t" ldx "\t0(%2),%0\n" \ + "2:\n" \ + "\t.section __ex_table,\"a\"\n" \ + "\t.word\t1b\n" \ + "\t.word\t(2b-1b)+3\n" \ + "\t.previous" \ + : "=r"(__gu_val), "=r"(__gu_err) \ + : "r"(ptr), "1"(__gu_err)); + +#define __get_user_asm(ldx,ptr) \ + __asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n" \ + "2:\n" \ + "\t.section __ex_table,\"a\"\n" \ + "\t.word\t1b\n" \ + "\t.word\t(2b-1b)+3\n" \ + "\t.previous" \ + : "=r"(__gu_val), "=r"(__gu_err) \ + : "r"(ptr), "1"(__gu_err)); + + +#define __put_user(x,ptr) \ +({ \ + register long __pu_err __asm__ ("r8") = 0; \ + \ + if (segment_eq(get_fs(),KERNEL_DS)) { \ + switch (sizeof(*(ptr))) { \ + case 1: __put_kernel_asm("stb",x,ptr); break; \ + case 2: __put_kernel_asm("sth",x,ptr); break; \ + case 4: __put_kernel_asm("stw",x,ptr); break; \ + case 8: __put_kernel_asm("std",x,ptr); break; \ + default: BUG(); break; \ + } \ + } \ + else { \ + switch (sizeof(*(ptr))) { \ + case 1: __put_user_asm("stb",x,ptr); break; \ + case 2: __put_user_asm("sth",x,ptr); break; \ + case 4: __put_user_asm("stw",x,ptr); break; \ + case 8: __put_user_asm("std",x,ptr); break; \ + default: BUG(); break; \ + } \ + } \ + \ + __pu_err; \ +}) + +/* + * The "__put_user/kernel_asm()" macros tell gcc they read from memory + * instead of writing. This is because they do not write to any memory + * gcc knows about, so there are no aliasing issues. + */ + +#define __put_kernel_asm(stx,x,ptr) \ + __asm__ __volatile__ ( \ + "\n1:\t" stx "\t%2,0(%1)\n" \ + "2:\n" \ + "\t.section __ex_table,\"a\"\n" \ + "\t.word\t1b\n" \ + "\t.word\t(2b-1b)+1\n" \ + "\t.previous" \ + : "=r"(__pu_err) \ + : "r"(ptr), "r"(x), "0"(__pu_err)) + +#define __put_user_asm(stx,x,ptr) \ + __asm__ __volatile__ ( \ + "\n1:\t" stx "\t%2,0(%%sr3,%1)\n" \ + "2:\n" \ + "\t.section __ex_table,\"a\"\n" \ + "\t.word\t1b\n" \ + "\t.word\t(2b-1b)+1\n" \ + "\t.previous" \ + : "=r"(__pu_err) \ + : "r"(ptr), "r"(x), "0"(__pu_err)) + + +/* + * Complex access routines -- external declarations + */ + +extern unsigned long lcopy_to_user(void *, const void *, unsigned long); +extern unsigned long lcopy_from_user(void *, const void *, unsigned long); +extern long lstrncpy_from_user(char *, const char *, long); +extern unsigned lclear_user(void *,unsigned long); +extern long lstrnlen_user(const char *,long); + +/* + * Complex access routines -- macros + */ + +#define strncpy_from_user lstrncpy_from_user +#define strnlen_user lstrnlen_user +#define strlen_user(str) lstrnlen_user(str, 0x7fffffffL) +#define clear_user lclear_user + +#define copy_from_user lcopy_from_user +#define __copy_from_user lcopy_from_user +#define copy_to_user lcopy_to_user +#define __copy_to_user lcopy_to_user + +#define copy_to_user_ret(to,from,n,retval) \ + ({ if (lcopy_to_user(to,from,n)) return retval; }) + +#define copy_from_user_ret(to,from,n,retval) \ + ({ if (lcopy_from_user(to,from,n)) return retval; }) + +#endif /* __PARISC_UACCESS_H */ diff --git a/include/asm-parisc/ucontext.h b/include/asm-parisc/ucontext.h new file mode 100644 index 000000000..f2e590499 --- /dev/null +++ b/include/asm-parisc/ucontext.h @@ -0,0 +1,12 @@ +#ifndef _ASMPARISC_UCONTEXT_H +#define _ASMPARISC_UCONTEXT_H + +struct ucontext { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + struct sigcontext uc_mcontext; + sigset_t uc_sigmask; /* mask last for extensibility */ +}; + +#endif /* !_ASMPARISC_UCONTEXT_H */ diff --git a/include/asm-parisc/unaligned.h b/include/asm-parisc/unaligned.h new file mode 100644 index 000000000..531f53841 --- /dev/null +++ b/include/asm-parisc/unaligned.h @@ -0,0 +1,20 @@ +#ifndef _ASM_PARISC_UNALIGNED_H_ +#define _ASM_PARISC_UNALIGNED_H_ + +/* parisc can't handle unaligned accesses. */ +/* copied from asm-sparc/unaligned.h */ + +#include + + +/* Use memmove here, so gcc does not insert a __builtin_memcpy. */ + +#define get_unaligned(ptr) \ + ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) + +#define put_unaligned(val, ptr) \ + ({ __typeof__(*(ptr)) __tmp = (val); \ + memmove((ptr), &__tmp, sizeof(*(ptr))); \ + (void)0; }) + +#endif /* _ASM_PARISC_UNALIGNED_H */ diff --git a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h new file mode 100644 index 000000000..ea0542a35 --- /dev/null +++ b/include/asm-parisc/unistd.h @@ -0,0 +1,901 @@ +#ifndef _ASM_PARISC_UNISTD_H_ +#define _ASM_PARISC_UNISTD_H_ + +/* + * This file contains the system call numbers. + */ + +/* + * HP-UX system calls get their native numbers for binary compatibility. + */ + +#define __NR_HPUX_exit 1 +#define __NR_HPUX_fork 2 +#define __NR_HPUX_read 3 +#define __NR_HPUX_write 4 +#define __NR_HPUX_open 5 +#define __NR_HPUX_close 6 +#define __NR_HPUX_wait 7 +#define __NR_HPUX_creat 8 +#define __NR_HPUX_link 9 +#define __NR_HPUX_unlink 10 +#define __NR_HPUX_execv 11 +#define __NR_HPUX_chdir 12 +#define __NR_HPUX_time 13 +#define __NR_HPUX_mknod 14 +#define __NR_HPUX_chmod 15 +#define __NR_HPUX_chown 16 +#define __NR_HPUX_break 17 +#define __NR_HPUX_lchmod 18 +#define __NR_HPUX_lseek 19 +#define __NR_HPUX_getpid 20 +#define __NR_HPUX_mount 21 +#define __NR_HPUX_umount 22 +#define __NR_HPUX_setuid 23 +#define __NR_HPUX_getuid 24 +#define __NR_HPUX_stime 25 +#define __NR_HPUX_ptrace 26 +#define __NR_HPUX_alarm 27 +#define __NR_HPUX_oldfstat 28 +#define __NR_HPUX_pause 29 +#define __NR_HPUX_utime 30 +#define __NR_HPUX_stty 31 +#define __NR_HPUX_gtty 32 +#define __NR_HPUX_access 33 +#define __NR_HPUX_nice 34 +#define __NR_HPUX_ftime 35 +#define __NR_HPUX_sync 36 +#define __NR_HPUX_kill 37 +#define __NR_HPUX_stat 38 +#define __NR_HPUX_setpgrp3 39 +#define __NR_HPUX_lstat 40 +#define __NR_HPUX_dup 41 +#define __NR_HPUX_pipe 42 +#define __NR_HPUX_times 43 +#define __NR_HPUX_profil 44 +#define __NR_HPUX_ki_call 45 +#define __NR_HPUX_setgid 46 +#define __NR_HPUX_getgid 47 +#define __NR_HPUX_sigsys 48 +#define __NR_HPUX_reserved1 49 +#define __NR_HPUX_reserved2 50 +#define __NR_HPUX_acct 51 +#define __NR_HPUX_set_userthreadid 52 +#define __NR_HPUX_oldlock 53 +#define __NR_HPUX_ioctl 54 +#define __NR_HPUX_reboot 55 +#define __NR_HPUX_symlink 56 +#define __NR_HPUX_utssys 57 +#define __NR_HPUX_readlink 58 +#define __NR_HPUX_execve 59 +#define __NR_HPUX_umask 60 +#define __NR_HPUX_chroot 61 +#define __NR_HPUX_fcntl 62 +#define __NR_HPUX_ulimit 63 +#define __NR_HPUX_getpagesize 64 +#define __NR_HPUX_mremap 65 +#define __NR_HPUX_vfork 66 +#define __NR_HPUX_vread 67 +#define __NR_HPUX_vwrite 68 +#define __NR_HPUX_sbrk 69 +#define __NR_HPUX_sstk 70 +#define __NR_HPUX_mmap 71 +#define __NR_HPUX_vadvise 72 +#define __NR_HPUX_munmap 73 +#define __NR_HPUX_mprotect 74 +#define __NR_HPUX_madvise 75 +#define __NR_HPUX_vhangup 76 +#define __NR_HPUX_swapoff 77 +#define __NR_HPUX_mincore 78 +#define __NR_HPUX_getgroups 79 +#define __NR_HPUX_setgroups 80 +#define __NR_HPUX_getpgrp2 81 +#define __NR_HPUX_setpgrp2 82 +#define __NR_HPUX_setitimer 83 +#define __NR_HPUX_wait3 84 +#define __NR_HPUX_swapon 85 +#define __NR_HPUX_getitimer 86 +#define __NR_HPUX_gethostname42 87 +#define __NR_HPUX_sethostname42 88 +#define __NR_HPUX_getdtablesize 89 +#define __NR_HPUX_dup2 90 +#define __NR_HPUX_getdopt 91 +#define __NR_HPUX_fstat 92 +#define __NR_HPUX_select 93 +#define __NR_HPUX_setdopt 94 +#define __NR_HPUX_fsync 95 +#define __NR_HPUX_setpriority 96 +#define __NR_HPUX_socket_old 97 +#define __NR_HPUX_connect_old 98 +#define __NR_HPUX_accept_old 99 +#define __NR_HPUX_getpriority 100 +#define __NR_HPUX_send_old 101 +#define __NR_HPUX_recv_old 102 +#define __NR_HPUX_socketaddr_old 103 +#define __NR_HPUX_bind_old 104 +#define __NR_HPUX_setsockopt_old 105 +#define __NR_HPUX_listen_old 106 +#define __NR_HPUX_vtimes_old 107 +#define __NR_HPUX_sigvector 108 +#define __NR_HPUX_sigblock 109 +#define __NR_HPUX_siggetmask 110 +#define __NR_HPUX_sigpause 111 +#define __NR_HPUX_sigstack 112 +#define __NR_HPUX_recvmsg_old 113 +#define __NR_HPUX_sendmsg_old 114 +#define __NR_HPUX_vtrace_old 115 +#define __NR_HPUX_gettimeofday 116 +#define __NR_HPUX_getrusage 117 +#define __NR_HPUX_getsockopt_old 118 +#define __NR_HPUX_resuba_old 119 +#define __NR_HPUX_readv 120 +#define __NR_HPUX_writev 121 +#define __NR_HPUX_settimeofday 122 +#define __NR_HPUX_fchown 123 +#define __NR_HPUX_fchmod 124 +#define __NR_HPUX_recvfrom_old 125 +#define __NR_HPUX_setresuid 126 +#define __NR_HPUX_setresgid 127 +#define __NR_HPUX_rename 128 +#define __NR_HPUX_truncate 129 +#define __NR_HPUX_ftruncate 130 +#define __NR_HPUX_flock_old 131 +#define __NR_HPUX_sysconf 132 +#define __NR_HPUX_sendto_old 133 +#define __NR_HPUX_shutdown_old 134 +#define __NR_HPUX_socketpair_old 135 +#define __NR_HPUX_mkdir 136 +#define __NR_HPUX_rmdir 137 +#define __NR_HPUX_utimes_old 138 +#define __NR_HPUX_sigcleanup_old 139 +#define __NR_HPUX_setcore 140 +#define __NR_HPUX_getpeername_old 141 +#define __NR_HPUX_gethostid 142 +#define __NR_HPUX_sethostid 143 +#define __NR_HPUX_getrlimit 144 +#define __NR_HPUX_setrlimit 145 +#define __NR_HPUX_killpg_old 146 +#define __NR_HPUX_cachectl 147 +#define __NR_HPUX_quotactl 148 +#define __NR_HPUX_get_sysinfo 149 +#define __NR_HPUX_getsockname_old 150 +#define __NR_HPUX_privgrp 151 +#define __NR_HPUX_rtprio 152 +#define __NR_HPUX_plock 153 +#define __NR_HPUX_reserved3 154 +#define __NR_HPUX_lockf 155 +#define __NR_HPUX_semget 156 +#define __NR_HPUX_osemctl 157 +#define __NR_HPUX_semop 158 +#define __NR_HPUX_msgget 159 +#define __NR_HPUX_omsgctl 160 +#define __NR_HPUX_msgsnd 161 +#define __NR_HPUX_msgrecv 162 +#define __NR_HPUX_shmget 163 +#define __NR_HPUX_oshmctl 164 +#define __NR_HPUX_shmat 165 +#define __NR_HPUX_shmdt 166 +#define __NR_HPUX_m68020_advise 167 +/* [168,189] are for Discless/DUX */ +#define __NR_HPUX_csp 168 +#define __NR_HPUX_cluster 169 +#define __NR_HPUX_mkrnod 170 +#define __NR_HPUX_test 171 +#define __NR_HPUX_unsp_open 172 +#define __NR_HPUX_reserved4 173 +#define __NR_HPUX_getcontext_old 174 +#define __NR_HPUX_osetcontext 175 +#define __NR_HPUX_bigio 176 +#define __NR_HPUX_pipenode 177 +#define __NR_HPUX_lsync 178 +#define __NR_HPUX_getmachineid 179 +#define __NR_HPUX_cnodeid 180 +#define __NR_HPUX_cnodes 181 +#define __NR_HPUX_swapclients 182 +#define __NR_HPUX_rmt_process 183 +#define __NR_HPUX_dskless_stats 184 +#define __NR_HPUX_sigprocmask 185 +#define __NR_HPUX_sigpending 186 +#define __NR_HPUX_sigsuspend 187 +#define __NR_HPUX_sigaction 188 +#define __NR_HPUX_reserved5 189 +#define __NR_HPUX_nfssvc 190 +#define __NR_HPUX_getfh 191 +#define __NR_HPUX_getdomainname 192 +#define __NR_HPUX_setdomainname 193 +#define __NR_HPUX_async_daemon 194 +#define __NR_HPUX_getdirentries 195 +#define __NR_HPUX_statfs 196 +#define __NR_HPUX_fstatfs 197 +#define __NR_HPUX_vfsmount 198 +#define __NR_HPUX_reserved6 199 +#define __NR_HPUX_waitpid 200 +/* 201 - 223 missing */ +#define __NR_HPUX_sigsetreturn 224 +#define __NR_HPUX_sigsetstatemask 225 +/* 226 missing */ +#define __NR_HPUX_cs 227 +#define __NR_HPUX_cds 228 +#define __NR_HPUX_set_no_trunc 229 +#define __NR_HPUX_pathconf 230 +#define __NR_HPUX_fpathconf 231 +/* 232, 233 missing */ +#define __NR_HPUX_nfs_fcntl 234 +#define __NR_HPUX_ogetacl 235 +#define __NR_HPUX_ofgetacl 236 +#define __NR_HPUX_osetacl 237 +#define __NR_HPUX_ofsetacl 238 +#define __NR_HPUX_pstat 239 +#define __NR_HPUX_getaudid 240 +#define __NR_HPUX_setaudid 241 +#define __NR_HPUX_getaudproc 242 +#define __NR_HPUX_setaudproc 243 +#define __NR_HPUX_getevent 244 +#define __NR_HPUX_setevent 245 +#define __NR_HPUX_audwrite 246 +#define __NR_HPUX_audswitch 247 +#define __NR_HPUX_audctl 248 +#define __NR_HPUX_ogetaccess 249 +#define __NR_HPUX_fsctl 250 +/* 251 - 258 missing */ +#define __NR_HPUX_swapfs 259 +#define __NR_HPUX_fss 260 +/* 261 - 266 missing */ +#define __NR_HPUX_tsync 267 +#define __NR_HPUX_getnumfds 268 +#define __NR_HPUX_poll 269 +#define __NR_HPUX_getmsg 270 +#define __NR_HPUX_putmsg 271 +#define __NR_HPUX_fchdir 272 +#define __NR_HPUX_getmount_cnt 273 +#define __NR_HPUX_getmount_entry 274 +#define __NR_HPUX_accept 275 +#define __NR_HPUX_bind 276 +#define __NR_HPUX_connect 277 +#define __NR_HPUX_getpeername 278 +#define __NR_HPUX_getsockname 279 +#define __NR_HPUX_getsockopt 280 +#define __NR_HPUX_listen 281 +#define __NR_HPUX_recv 282 +#define __NR_HPUX_recvfrom 283 +#define __NR_HPUX_recvmsg 284 +#define __NR_HPUX_send 285 +#define __NR_HPUX_sendmsg 286 +#define __NR_HPUX_sendto 287 +#define __NR_HPUX_setsockopt 288 +#define __NR_HPUX_shutdown 289 +#define __NR_HPUX_socket 290 +#define __NR_HPUX_socketpair 291 +#define __NR_HPUX_proc_open 292 +#define __NR_HPUX_proc_close 293 +#define __NR_HPUX_proc_send 294 +#define __NR_HPUX_proc_recv 295 +#define __NR_HPUX_proc_sendrecv 296 +#define __NR_HPUX_proc_syscall 297 +/* 298 - 311 missing */ +#define __NR_HPUX_semctl 312 +#define __NR_HPUX_msgctl 313 +#define __NR_HPUX_shmctl 314 +#define __NR_HPUX_mpctl 315 +#define __NR_HPUX_exportfs 316 +#define __NR_HPUX_getpmsg 317 +#define __NR_HPUX_putpmsg 318 +/* 319 missing */ +#define __NR_HPUX_msync 320 +#define __NR_HPUX_msleep 321 +#define __NR_HPUX_mwakeup 322 +#define __NR_HPUX_msem_init 323 +#define __NR_HPUX_msem_remove 324 +#define __NR_HPUX_adjtime 325 +#define __NR_HPUX_kload 326 +#define __NR_HPUX_fattach 327 +#define __NR_HPUX_fdetach 328 +#define __NR_HPUX_serialize 329 +#define __NR_HPUX_statvfs 330 +#define __NR_HPUX_fstatvfs 331 +#define __NR_HPUX_lchown 332 +#define __NR_HPUX_getsid 333 +#define __NR_HPUX_sysfs 334 +/* 335, 336 missing */ +#define __NR_HPUX_sched_setparam 337 +#define __NR_HPUX_sched_getparam 338 +#define __NR_HPUX_sched_setscheduler 339 +#define __NR_HPUX_sched_getscheduler 340 +#define __NR_HPUX_sched_yield 341 +#define __NR_HPUX_sched_get_priority_max 342 +#define __NR_HPUX_sched_get_priority_min 343 +#define __NR_HPUX_sched_rr_get_interval 344 +#define __NR_HPUX_clock_settime 345 +#define __NR_HPUX_clock_gettime 346 +#define __NR_HPUX_clock_getres 347 +#define __NR_HPUX_timer_create 348 +#define __NR_HPUX_timer_delete 349 +#define __NR_HPUX_timer_settime 350 +#define __NR_HPUX_timer_gettime 351 +#define __NR_HPUX_timer_getoverrun 352 +#define __NR_HPUX_nanosleep 353 +#define __NR_HPUX_toolbox 354 +/* 355 missing */ +#define __NR_HPUX_getdents 356 +#define __NR_HPUX_getcontext 357 +#define __NR_HPUX_sysinfo 358 +#define __NR_HPUX_fcntl64 359 +#define __NR_HPUX_ftruncate64 360 +#define __NR_HPUX_fstat64 361 +#define __NR_HPUX_getdirentries64 362 +#define __NR_HPUX_getrlimit64 363 +#define __NR_HPUX_lockf64 364 +#define __NR_HPUX_lseek64 365 +#define __NR_HPUX_lstat64 366 +#define __NR_HPUX_mmap64 367 +#define __NR_HPUX_setrlimit64 368 +#define __NR_HPUX_stat64 369 +#define __NR_HPUX_truncate64 370 +#define __NR_HPUX_ulimit64 371 +#define __NR_HPUX_pread 372 +#define __NR_HPUX_preadv 373 +#define __NR_HPUX_pwrite 374 +#define __NR_HPUX_pwritev 375 +#define __NR_HPUX_pread64 376 +#define __NR_HPUX_preadv64 377 +#define __NR_HPUX_pwrite64 378 +#define __NR_HPUX_pwritev64 379 +#define __NR_HPUX_setcontext 380 +#define __NR_HPUX_sigaltstack 381 +#define __NR_HPUX_waitid 382 +#define __NR_HPUX_setpgrp 383 +#define __NR_HPUX_recvmsg2 384 +#define __NR_HPUX_sendmsg2 385 +#define __NR_HPUX_socket2 386 +#define __NR_HPUX_socketpair2 387 +#define __NR_HPUX_setregid 388 +#define __NR_HPUX_lwp_create 389 +#define __NR_HPUX_lwp_terminate 390 +#define __NR_HPUX_lwp_wait 391 +#define __NR_HPUX_lwp_suspend 392 +#define __NR_HPUX_lwp_resume 393 +/* 394 missing */ +#define __NR_HPUX_lwp_abort_syscall 395 +#define __NR_HPUX_lwp_info 396 +#define __NR_HPUX_lwp_kill 397 +#define __NR_HPUX_ksleep 398 +#define __NR_HPUX_kwakeup 399 +/* 400 missing */ +#define __NR_HPUX_pstat_getlwp 401 +#define __NR_HPUX_lwp_exit 402 +#define __NR_HPUX_lwp_continue 403 +#define __NR_HPUX_getacl 404 +#define __NR_HPUX_fgetacl 405 +#define __NR_HPUX_setacl 406 +#define __NR_HPUX_fsetacl 407 +#define __NR_HPUX_getaccess 408 +#define __NR_HPUX_lwp_mutex_init 409 +#define __NR_HPUX_lwp_mutex_lock_sys 410 +#define __NR_HPUX_lwp_mutex_unlock 411 +#define __NR_HPUX_lwp_cond_init 412 +#define __NR_HPUX_lwp_cond_signal 413 +#define __NR_HPUX_lwp_cond_broadcast 414 +#define __NR_HPUX_lwp_cond_wait_sys 415 +#define __NR_HPUX_lwp_getscheduler 416 +#define __NR_HPUX_lwp_setscheduler 417 +#define __NR_HPUX_lwp_getstate 418 +#define __NR_HPUX_lwp_setstate 419 +#define __NR_HPUX_lwp_detach 420 +#define __NR_HPUX_mlock 421 +#define __NR_HPUX_munlock 422 +#define __NR_HPUX_mlockall 423 +#define __NR_HPUX_munlockall 424 +#define __NR_HPUX_shm_open 425 +#define __NR_HPUX_shm_unlink 426 +#define __NR_HPUX_sigqueue 427 +#define __NR_HPUX_sigwaitinfo 428 +#define __NR_HPUX_sigtimedwait 429 +#define __NR_HPUX_sigwait 430 +#define __NR_HPUX_aio_read 431 +#define __NR_HPUX_aio_write 432 +#define __NR_HPUX_lio_listio 433 +#define __NR_HPUX_aio_error 434 +#define __NR_HPUX_aio_return 435 +#define __NR_HPUX_aio_cancel 436 +#define __NR_HPUX_aio_suspend 437 +#define __NR_HPUX_aio_fsync 438 +#define __NR_HPUX_mq_open 439 +#define __NR_HPUX_mq_close 440 +#define __NR_HPUX_mq_unlink 441 +#define __NR_HPUX_mq_send 442 +#define __NR_HPUX_mq_receive 443 +#define __NR_HPUX_mq_notify 444 +#define __NR_HPUX_mq_setattr 445 +#define __NR_HPUX_mq_getattr 446 +#define __NR_HPUX_ksem_open 447 +#define __NR_HPUX_ksem_unlink 448 +#define __NR_HPUX_ksem_close 449 +#define __NR_HPUX_ksem_post 450 +#define __NR_HPUX_ksem_wait 451 +#define __NR_HPUX_ksem_read 452 +#define __NR_HPUX_ksem_trywait 453 +#define __NR_HPUX_lwp_rwlock_init 454 +#define __NR_HPUX_lwp_rwlock_destroy 455 +#define __NR_HPUX_lwp_rwlock_rdlock_sys 456 +#define __NR_HPUX_lwp_rwlock_wrlock_sys 457 +#define __NR_HPUX_lwp_rwlock_tryrdlock 458 +#define __NR_HPUX_lwp_rwlock_trywrlock 459 +#define __NR_HPUX_lwp_rwlock_unlock 460 +#define __NR_HPUX_ttrace 461 +#define __NR_HPUX_ttrace_wait 462 +#define __NR_HPUX_lf_wire_mem 463 +#define __NR_HPUX_lf_unwire_mem 464 +#define __NR_HPUX_lf_send_pin_map 465 +#define __NR_HPUX_lf_free_buf 466 +#define __NR_HPUX_lf_wait_nq 467 +#define __NR_HPUX_lf_wakeup_conn_q 468 +#define __NR_HPUX_lf_unused 469 +#define __NR_HPUX_lwp_sema_init 470 +#define __NR_HPUX_lwp_sema_post 471 +#define __NR_HPUX_lwp_sema_wait 472 +#define __NR_HPUX_lwp_sema_trywait 473 +#define __NR_HPUX_lwp_sema_destroy 474 +#define __NR_HPUX_statvfs64 475 +#define __NR_HPUX_fstatvfs64 476 +#define __NR_HPUX_msh_register 477 +#define __NR_HPUX_ptrace64 478 +#define __NR_HPUX_sendfile 479 +#define __NR_HPUX_sendpath 480 +#define __NR_HPUX_sendfile64 481 +#define __NR_HPUX_sendpath64 482 +#define __NR_HPUX_modload 483 +#define __NR_HPUX_moduload 484 +#define __NR_HPUX_modpath 485 +#define __NR_HPUX_getksym 486 +#define __NR_HPUX_modadm 487 +#define __NR_HPUX_modstat 488 +#define __NR_HPUX_lwp_detached_exit 489 +#define __NR_HPUX_crashconf 490 +#define __NR_HPUX_siginhibit 491 +#define __NR_HPUX_sigenable 492 +#define __NR_HPUX_spuctl 493 +#define __NR_HPUX_zerokernelsum 494 +#define __NR_HPUX_nfs_kstat 495 +#define __NR_HPUX_aio_read64 496 +#define __NR_HPUX_aio_write64 497 +#define __NR_HPUX_aio_error64 498 +#define __NR_HPUX_aio_return64 499 +#define __NR_HPUX_aio_cancel64 500 +#define __NR_HPUX_aio_suspend64 501 +#define __NR_HPUX_aio_fsync64 502 +#define __NR_HPUX_lio_listio64 503 +#define __NR_HPUX_recv2 504 +#define __NR_HPUX_recvfrom2 505 +#define __NR_HPUX_send2 506 +#define __NR_HPUX_sendto2 507 +#define __NR_HPUX_acl 508 +#define __NR_HPUX___cnx_p2p_ctl 509 +#define __NR_HPUX___cnx_gsched_ctl 510 +#define __NR_HPUX___cnx_pmon_ctl 511 + +#define __NR_HPUX_syscalls 512 + +/* + * Linux system call numbers. + * + * Cary Coutant says that we should just use another syscall gateway + * page to avoid clashing with the HPUX space, and I think he's right: + * it will would keep a branch out of our syscall entry path, at the + * very least. If we decide to change it later, we can ``just'' tweak + * the LINUX_GATEWAY_ADDR define at the bottom and make __NR_Linux be + * 1024 or something. Oh, and recompile libc. =) + * + * 64-bit HPUX binaries get the syscall gateway address passed in a register + * from the kernel at startup, which seems a sane strategy. + */ + +#define __NR_Linux 0 +#define __NR_syscall (__NR_Linux + 0) +#define __NR_exit (__NR_Linux + 1) +#define __NR_fork (__NR_Linux + 2) +#define __NR_read (__NR_Linux + 3) +#define __NR_write (__NR_Linux + 4) +#define __NR_open (__NR_Linux + 5) +#define __NR_close (__NR_Linux + 6) +#define __NR_waitpid (__NR_Linux + 7) +#define __NR_creat (__NR_Linux + 8) +#define __NR_link (__NR_Linux + 9) +#define __NR_unlink (__NR_Linux + 10) +#define __NR_execve (__NR_Linux + 11) +#define __NR_chdir (__NR_Linux + 12) +#define __NR_time (__NR_Linux + 13) +#define __NR_mknod (__NR_Linux + 14) +#define __NR_chmod (__NR_Linux + 15) +#define __NR_lchown (__NR_Linux + 16) +#define __NR_socket (__NR_Linux + 17) +#define __NR_stat (__NR_Linux + 18) +#define __NR_lseek (__NR_Linux + 19) +#define __NR_getpid (__NR_Linux + 20) +#define __NR_mount (__NR_Linux + 21) +#define __NR_bind (__NR_Linux + 22) +#define __NR_setuid (__NR_Linux + 23) +#define __NR_getuid (__NR_Linux + 24) +#define __NR_stime (__NR_Linux + 25) +#define __NR_ptrace (__NR_Linux + 26) +#define __NR_alarm (__NR_Linux + 27) +#define __NR_fstat (__NR_Linux + 28) +#define __NR_pause (__NR_Linux + 29) +#define __NR_utime (__NR_Linux + 30) +#define __NR_connect (__NR_Linux + 31) +#define __NR_listen (__NR_Linux + 32) +#define __NR_access (__NR_Linux + 33) +#define __NR_nice (__NR_Linux + 34) +#define __NR_accept (__NR_Linux + 35) +#define __NR_sync (__NR_Linux + 36) +#define __NR_kill (__NR_Linux + 37) +#define __NR_rename (__NR_Linux + 38) +#define __NR_mkdir (__NR_Linux + 39) +#define __NR_rmdir (__NR_Linux + 40) +#define __NR_dup (__NR_Linux + 41) +#define __NR_pipe (__NR_Linux + 42) +#define __NR_times (__NR_Linux + 43) +#define __NR_getsockname (__NR_Linux + 44) +#define __NR_brk (__NR_Linux + 45) +#define __NR_setgid (__NR_Linux + 46) +#define __NR_getgid (__NR_Linux + 47) +#define __NR_signal (__NR_Linux + 48) +#define __NR_geteuid (__NR_Linux + 49) +#define __NR_getegid (__NR_Linux + 50) +#define __NR_acct (__NR_Linux + 51) +#define __NR_umount2 (__NR_Linux + 52) +#define __NR_getpeername (__NR_Linux + 53) +#define __NR_ioctl (__NR_Linux + 54) +#define __NR_fcntl (__NR_Linux + 55) +#define __NR_socketpair (__NR_Linux + 56) +#define __NR_setpgid (__NR_Linux + 57) +#define __NR_send (__NR_Linux + 58) +#define __NR_uname (__NR_Linux + 59) +#define __NR_umask (__NR_Linux + 60) +#define __NR_chroot (__NR_Linux + 61) +#define __NR_ustat (__NR_Linux + 62) +#define __NR_dup2 (__NR_Linux + 63) +#define __NR_getppid (__NR_Linux + 64) +#define __NR_getpgrp (__NR_Linux + 65) +#define __NR_setsid (__NR_Linux + 66) +#define __NR_pivot_root (__NR_Linux + 67) +#define __NR_sgetmask (__NR_Linux + 68) +#define __NR_ssetmask (__NR_Linux + 69) +#define __NR_setreuid (__NR_Linux + 70) +#define __NR_setregid (__NR_Linux + 71) +#define __NR_mincore (__NR_Linux + 72) +#define __NR_sigpending (__NR_Linux + 73) +#define __NR_sethostname (__NR_Linux + 74) +#define __NR_setrlimit (__NR_Linux + 75) +#define __NR_getrlimit (__NR_Linux + 76) +#define __NR_getrusage (__NR_Linux + 77) +#define __NR_gettimeofday (__NR_Linux + 78) +#define __NR_settimeofday (__NR_Linux + 79) +#define __NR_getgroups (__NR_Linux + 80) +#define __NR_setgroups (__NR_Linux + 81) +#define __NR_sendto (__NR_Linux + 82) +#define __NR_symlink (__NR_Linux + 83) +#define __NR_lstat (__NR_Linux + 84) +#define __NR_readlink (__NR_Linux + 85) +#define __NR_uselib (__NR_Linux + 86) +#define __NR_swapon (__NR_Linux + 87) +#define __NR_reboot (__NR_Linux + 88) +#define __NR_readdir (__NR_Linux + 89) +#define __NR_mmap (__NR_Linux + 90) +#define __NR_munmap (__NR_Linux + 91) +#define __NR_truncate (__NR_Linux + 92) +#define __NR_ftruncate (__NR_Linux + 93) +#define __NR_fchmod (__NR_Linux + 94) +#define __NR_fchown (__NR_Linux + 95) +#define __NR_getpriority (__NR_Linux + 96) +#define __NR_setpriority (__NR_Linux + 97) +#define __NR_recv (__NR_Linux + 98) +#define __NR_statfs (__NR_Linux + 99) +#define __NR_fstatfs (__NR_Linux + 100) +#define __NR_ioperm (__NR_Linux + 101) +#define __NR_socketcall (__NR_Linux + 102) +#define __NR_syslog (__NR_Linux + 103) +#define __NR_setitimer (__NR_Linux + 104) +#define __NR_getitimer (__NR_Linux + 105) +#define __NR_capget (__NR_Linux + 106) +#define __NR_capset (__NR_Linux + 107) +#define __NR_pread (__NR_Linux + 108) +#define __NR_pwrite (__NR_Linux + 109) +#define __NR_getcwd (__NR_Linux + 110) +#define __NR_vhangup (__NR_Linux + 111) +#define __NR_idle (__NR_Linux + 112) +#define __NR_vfork (__NR_Linux + 113) +#define __NR_wait4 (__NR_Linux + 114) +#define __NR_swapoff (__NR_Linux + 115) +#define __NR_sysinfo (__NR_Linux + 116) +#define __NR_shutdown (__NR_Linux + 117) +#define __NR_fsync (__NR_Linux + 118) +#define __NR_madvise (__NR_Linux + 119) +#define __NR_clone (__NR_Linux + 120) +#define __NR_setdomainname (__NR_Linux + 121) +#define __NR_sendfile (__NR_Linux + 122) +#define __NR_recvfrom (__NR_Linux + 123) +#define __NR_adjtimex (__NR_Linux + 124) +#define __NR_mprotect (__NR_Linux + 125) +#define __NR_sigprocmask (__NR_Linux + 126) +#define __NR_create_module (__NR_Linux + 127) +#define __NR_init_module (__NR_Linux + 128) +#define __NR_delete_module (__NR_Linux + 129) +#define __NR_get_kernel_syms (__NR_Linux + 130) +#define __NR_quotactl (__NR_Linux + 131) +#define __NR_getpgid (__NR_Linux + 132) +#define __NR_fchdir (__NR_Linux + 133) +#define __NR_bdflush (__NR_Linux + 134) +#define __NR_sysfs (__NR_Linux + 135) +#define __NR_personality (__NR_Linux + 136) +#define __NR_afs_syscall (__NR_Linux + 137) /* Syscall for Andrew File System */ +#define __NR_setfsuid (__NR_Linux + 138) +#define __NR_setfsgid (__NR_Linux + 139) +#define __NR__llseek (__NR_Linux + 140) +#define __NR_getdents (__NR_Linux + 141) +#define __NR__newselect (__NR_Linux + 142) +#define __NR_flock (__NR_Linux + 143) +#define __NR_msync (__NR_Linux + 144) +#define __NR_readv (__NR_Linux + 145) +#define __NR_writev (__NR_Linux + 146) +#define __NR_getsid (__NR_Linux + 147) +#define __NR_fdatasync (__NR_Linux + 148) +#define __NR__sysctl (__NR_Linux + 149) +#define __NR_mlock (__NR_Linux + 150) +#define __NR_munlock (__NR_Linux + 151) +#define __NR_mlockall (__NR_Linux + 152) +#define __NR_munlockall (__NR_Linux + 153) +#define __NR_sched_setparam (__NR_Linux + 154) +#define __NR_sched_getparam (__NR_Linux + 155) +#define __NR_sched_setscheduler (__NR_Linux + 156) +#define __NR_sched_getscheduler (__NR_Linux + 157) +#define __NR_sched_yield (__NR_Linux + 158) +#define __NR_sched_get_priority_max (__NR_Linux + 159) +#define __NR_sched_get_priority_min (__NR_Linux + 160) +#define __NR_sched_rr_get_interval (__NR_Linux + 161) +#define __NR_nanosleep (__NR_Linux + 162) +#define __NR_mremap (__NR_Linux + 163) +#define __NR_setresuid (__NR_Linux + 164) +#define __NR_getresuid (__NR_Linux + 165) +#define __NR_sigaltstack (__NR_Linux + 166) +#define __NR_query_module (__NR_Linux + 167) +#define __NR_poll (__NR_Linux + 168) +#define __NR_nfsservctl (__NR_Linux + 169) +#define __NR_setresgid (__NR_Linux + 170) +#define __NR_getresgid (__NR_Linux + 171) +#define __NR_prctl (__NR_Linux + 172) +#define __NR_rt_sigreturn (__NR_Linux + 173) +#define __NR_rt_sigaction (__NR_Linux + 174) +#define __NR_rt_sigprocmask (__NR_Linux + 175) +#define __NR_rt_sigpending (__NR_Linux + 176) +#define __NR_rt_sigtimedwait (__NR_Linux + 177) +#define __NR_rt_sigqueueinfo (__NR_Linux + 178) +#define __NR_rt_sigsuspend (__NR_Linux + 179) +#define __NR_chown (__NR_Linux + 180) +#define __NR_setsockopt (__NR_Linux + 181) +#define __NR_getsockopt (__NR_Linux + 182) +#define __NR_sendmsg (__NR_Linux + 183) +#define __NR_recvmsg (__NR_Linux + 184) +#define __NR_semop (__NR_Linux + 185) +#define __NR_semget (__NR_Linux + 186) +#define __NR_semctl (__NR_Linux + 187) +#define __NR_msgsnd (__NR_Linux + 188) +#define __NR_msgrcv (__NR_Linux + 189) +#define __NR_msgget (__NR_Linux + 190) +#define __NR_msgctl (__NR_Linux + 191) +#define __NR_shmat (__NR_Linux + 192) +#define __NR_shmdt (__NR_Linux + 193) +#define __NR_shmget (__NR_Linux + 194) +#define __NR_shmctl (__NR_Linux + 195) + +#define __NR_getpmsg (__NR_Linux + 196) /* some people actually want streams */ +#define __NR_putpmsg (__NR_Linux + 197) /* some people actually want streams */ + +#define __NR_Linux_syscalls 197 + +#define HPUX_GATEWAY_ADDR 0xC0000004 +#define LINUX_GATEWAY_ADDR 0x100 +#define LINUX_GATEWAY_STR "0x100" + +/* The old syscall code here didn't work, and it looks like it's only used + * by applications such as fdisk which for some reason need to produce + * their own syscall instead of using same from libc. The code below + * is leveraged from glibc/sysdeps/unix/sysv/linux/hppa/sysdep.h where + * it is essentially duplicated -- which sucks. -PB + */ + +#define SYS_ify(syscall_name) __NR_##syscall_name + +/* The system call number MUST ALWAYS be loaded in the delay slot of + the ble instruction, or restarting system calls WILL NOT WORK. See + arch/parisc/kernel/signal.c - dhd, 2000-07-26 */ +#define K_INLINE_SYSCALL(name, nr, args...) ({ \ + unsigned long __sys_res; \ + { \ + register unsigned long __res asm("r28"); \ + K_LOAD_ARGS_##nr(args) \ + asm volatile( \ + "ble 0x100(%%sr2, %%r0)\n\t" \ + " ldi %1, %%r20" \ + : "=r" (__res) \ + : "i" (SYS_ify(name)) K_ASM_ARGS_##nr \ + ); \ + __sys_res = __res; \ + } \ + if (__sys_res >= (unsigned long)-4095) { \ + errno = -__sys_res; \ + __sys_res == (unsigned long)-1; \ + } \ + __sys_res; \ +}) + +#define K_LOAD_ARGS_0() +#define K_LOAD_ARGS_1(r26) \ + register unsigned long __r26 __asm__("r26") = (unsigned long)r26; \ + K_LOAD_ARGS_0() +#define K_LOAD_ARGS_2(r26,r25) \ + register unsigned long __r25 __asm__("r25") = (unsigned long)r25; \ + K_LOAD_ARGS_1(r26) +#define K_LOAD_ARGS_3(r26,r25,r24) \ + register unsigned long __r24 __asm__("r24") = (unsigned long)r24; \ + K_LOAD_ARGS_2(r26,r25) +#define K_LOAD_ARGS_4(r26,r25,r24,r23) \ + register unsigned long __r23 __asm__("r23") = (unsigned long)r23; \ + K_LOAD_ARGS_3(r26,r25,r24) +#define K_LOAD_ARGS_5(r26,r25,r24,r23,r22) \ + register unsigned long __r22 __asm__("r22") = (unsigned long)r22; \ + K_LOAD_ARGS_4(r26,r25,r24,r23) +#define K_LOAD_ARGS_6(r26,r25,r24,r23,r22,r21) \ + register unsigned long __r21 __asm__("r21") = (unsigned long)r21; \ + K_LOAD_ARGS_5(r26,r25,r24,r23,r22) + +#define K_ASM_ARGS_0 +#define K_ASM_ARGS_1 , "r" (__r26) +#define K_ASM_ARGS_2 , "r" (__r26), "r" (__r25) +#define K_ASM_ARGS_3 , "r" (__r26), "r" (__r25), "r" (__r24) +#define K_ASM_ARGS_4 , "r" (__r26), "r" (__r25), "r" (__r24), "r" (__r23) +#define K_ASM_ARGS_5 , "r" (__r26), "r" (__r25), "r" (__r24), "r" (__r23), "r" (__r22) +#define K_ASM_ARGS_6 , "r" (__r26), "r" (__r25), "r" (__r24), "r" (__r23), "r" (__r22), "r" (__r21) + +#define _syscall0(type,name) \ +type name(void) \ +{ \ + return K_INLINE_SYSCALL(name, 0); \ +} + +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) \ +{ \ + return K_INLINE_SYSCALL(name, 1, arg1); \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1, type2 arg2) \ +{ \ + return K_INLINE_SYSCALL(name, 2, arg1, arg2); \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1, type2 arg2, type3 arg3) \ +{ \ + return K_INLINE_SYSCALL(name, 3, arg1, arg2, arg3); \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ + return K_INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4); \ +} + +/* select takes 5 arguments */ +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ +{ \ + return K_INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5); \ +} + + +/* mmap takes 6 arguments */ + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \ +{ \ + return K_INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6); \ +} + +#ifdef __KERNEL_SYSCALLS__ + +static inline int idle(void) +{ + extern int sys_idle(void); + return sys_idle(); +} + +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 long sys_open(const char *, int, int); + return sys_open(file, flag, mode); +} + +static inline int close(int fd) +{ + return sys_close(fd); +} + +static inline int _exit(int exitcode) +{ + extern int sys_exit(int) __attribute__((noreturn)); + 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); +} + +static inline int execve(char *filename, char * argv [], + char * envp[]) +{ + extern int __execve(char *, char **, char **, struct task_struct *); + return __execve(filename, argv, envp, current); +} + +#endif + +#undef STR + +#endif /* _ASM_PARISC_UNISTD_H_ */ diff --git a/include/asm-parisc/user.h b/include/asm-parisc/user.h new file mode 100644 index 000000000..80224753e --- /dev/null +++ b/include/asm-parisc/user.h @@ -0,0 +1,5 @@ +/* This file should not exist, but lots of generic code still includes + it. It's a hangover from old a.out days and the traditional core + dump format. We are ELF-only, and so are our core dumps. If we + need to support HP/UX core format then we'll do it here + eventually. */ diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h index aa406533f..53d486ef1 100644 --- a/include/asm-sh/page.h +++ b/include/asm-sh/page.h @@ -76,8 +76,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; #ifndef __ASSEMBLY__ -extern int console_loglevel; - /* * Tell the user there is some problem. */ diff --git a/include/asm-sparc/atops.h b/include/asm-sparc/atops.h deleted file mode 100644 index 30bdf0fb7..000000000 --- a/include/asm-sparc/atops.h +++ /dev/null @@ -1,24 +0,0 @@ -/* atops.h: Atomic SPARC operations. - * - * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) - */ -#ifndef _SPARC_ATOPS_H -#define _SPARC_ATOPS_H - -#include - -#ifdef CONFIG_SMP - -extern __inline__ __volatile__ unsigned char ldstub(volatile unsigned char *lock) -{ - volatile unsigned char retval; - - __asm__ __volatile__("ldstub [%1], %0\n\t" : - "=&r" (retval) : - "r" (lock)); - return retval; -} - -#endif - -#endif diff --git a/include/asm-sparc/hdreg.h b/include/asm-sparc/hdreg.h index 1c321c3e7..8df7a4693 100644 --- a/include/asm-sparc/hdreg.h +++ b/include/asm-sparc/hdreg.h @@ -1,4 +1,4 @@ -/* $Id: hdreg.h,v 1.1 2000/01/21 04:56:27 zaitcev Exp $ +/* $Id: hdreg.h,v 1.2 2000/12/05 00:56:36 anton Exp $ * hdreg.h: SPARC PCI specific IDE glue. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) @@ -8,6 +8,6 @@ #ifndef __SPARC_HDREG_H #define __SPARC_HDREG_H -typedef unsigned int ide_ioreg_t; +typedef unsigned long ide_ioreg_t; #endif /* __SPARC_HDREG_H */ diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h index 278c15c80..41b96727a 100644 --- a/include/asm-sparc/processor.h +++ b/include/asm-sparc/processor.h @@ -1,4 +1,4 @@ -/* $Id: processor.h,v 1.77 2000/01/21 11:39:17 jj Exp $ +/* $Id: processor.h,v 1.78 2000/11/30 08:37:31 anton Exp $ * include/asm-sparc/processor.h * * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu) @@ -90,6 +90,7 @@ struct thread_struct { #define SPARC_FLAG_KTHREAD 0x1 /* task is a kernel thread */ #define SPARC_FLAG_UNALIGNED 0x2 /* is allowed to do unaligned accesses */ +#define SPARC_FLAG_MMAPSHARED 0x4 /* task wants a shared mmap */ #define INIT_MMAP { &init_mm, (0), (0), \ NULL, __pgprot(0x0) , VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } diff --git a/include/asm-sparc64/pgalloc.h b/include/asm-sparc64/pgalloc.h index 23603f287..45e1f1828 100644 --- a/include/asm-sparc64/pgalloc.h +++ b/include/asm-sparc64/pgalloc.h @@ -1,4 +1,4 @@ -/* $Id: pgalloc.h,v 1.13 2000/11/06 06:59:04 davem Exp $ */ +/* $Id: pgalloc.h,v 1.14 2000/12/09 04:15:24 anton Exp $ */ #ifndef _SPARC64_PGALLOC_H #define _SPARC64_PGALLOC_H @@ -18,10 +18,15 @@ #define flush_cache_page(vma, page) \ flush_cache_mm((vma)->vm_mm) -/* These operations are unnecessary on the SpitFire since D-CACHE is write-through. */ -#define flush_icache_range(start, end) do { } while (0) +/* This is unnecessary on the SpitFire since D-CACHE is write-through. */ #define flush_page_to_ram(page) do { } while (0) +/* + * icache doesnt snoop local stores and we don't use block commit stores + * (which invalidate icache lines) during module load, so we need this. + */ +extern void flush_icache_range(unsigned long start, unsigned long end); + extern void __flush_dcache_page(void *addr, int flush_icache); #define flush_dcache_page(page) \ do { if ((page)->mapping && !(page)->mapping->i_mmap && !(page)->mapping->i_mmap_shared) \ diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h index eae8b7bdb..562cf4ba8 100644 --- a/include/asm-sparc64/processor.h +++ b/include/asm-sparc64/processor.h @@ -1,4 +1,4 @@ -/* $Id: processor.h,v 1.65 2000/08/09 00:00:17 davem Exp $ +/* $Id: processor.h,v 1.66 2000/11/29 05:56:12 anton Exp $ * include/asm-sparc64/processor.h * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -80,6 +80,7 @@ struct thread_struct { #define SPARC_FLAG_32BIT 0x04 /* task is older 32-bit binary */ #define SPARC_FLAG_NEWCHILD 0x08 /* task is just-spawned child process */ #define SPARC_FLAG_PERFCTR 0x10 /* task has performance counters active */ +#define SPARC_FLAG_MMAPSHARED 0x20 /* task wants a shared mmap */ #define FAULT_CODE_WRITE 0x01 /* Write access, implies D-TLB */ #define FAULT_CODE_DTLB 0x02 /* Miss happened in D-TLB */ diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h index 7457cd114..d18b71dc7 100644 --- a/include/linux/agpgart.h +++ b/include/linux/agpgart.h @@ -207,7 +207,7 @@ typedef struct _agp_file_private { struct _agp_file_private *next; struct _agp_file_private *prev; pid_t my_pid; - u32 access_flags; + long access_flags; /* long req'd for set_bit --RR */ } agp_file_private; struct agp_front_data { diff --git a/include/linux/apm_bios.h b/include/linux/apm_bios.h index 69ea9cf48..9dba26eeb 100644 --- a/include/linux/apm_bios.h +++ b/include/linux/apm_bios.h @@ -38,13 +38,22 @@ struct apm_bios_info { unsigned short dseg_len; }; - /* Results of APM Installation Check */ +/* Results of APM Installation Check */ #define APM_16_BIT_SUPPORT 0x0001 #define APM_32_BIT_SUPPORT 0x0002 #define APM_IDLE_SLOWS_CLOCK 0x0004 #define APM_BIOS_DISABLED 0x0008 #define APM_BIOS_DISENGAGED 0x0010 +/* + * Data for APM that is persistant across module unload/load + */ +struct apm_info { + struct apm_bios_info bios; + unsigned short connection_version; + int get_power_status_broken; +}; + /* * The APM function codes */ @@ -91,12 +100,9 @@ struct apm_bios_info { #define APM_FUNC_TIMER_GET 2 /* - * in init/main.c + * in arch/i386/kernel/setup.c */ -extern struct apm_bios_info apm_bios_info; - -extern int apm_register_callback(int (*callback)(apm_event_t)); -extern void apm_unregister_callback(int (*callback)(apm_event_t)); +extern struct apm_info apm_info; #endif /* __KERNEL__ */ @@ -176,7 +182,7 @@ extern void apm_unregister_callback(int (*callback)(apm_event_t)); /* * This is the "All Devices" ID communicated to the BIOS */ -#define APM_DEVICE_BALL ((apm_bios_info.version > 0x0100) ? \ +#define APM_DEVICE_BALL ((apm_info.connection_version > 0x0100) ? \ APM_DEVICE_ALL : APM_DEVICE_OLD_ALL) #endif diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index 4d5ada52b..d169bf7f2 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h @@ -257,7 +257,7 @@ enum { #define ATM_ATMOPT_CLP 1 /* set CLP bit */ -typedef struct { unsigned int bits; } atm_vcc_flags_t; +typedef struct { unsigned long bits; } atm_vcc_flags_t; struct atm_vcc { diff --git a/include/linux/bfs_fs.h b/include/linux/bfs_fs.h index afe274a4c..a4ffcbb75 100644 --- a/include/linux/bfs_fs.h +++ b/include/linux/bfs_fs.h @@ -1,6 +1,6 @@ /* * include/linux/bfs_fs.h - BFS data structures on disk. - * Copyright (C) 1999 Tigran Aivazian + * Copyright (C) 1999 Tigran Aivazian */ #ifndef _LINUX_BFS_FS_H diff --git a/include/linux/bfs_fs_i.h b/include/linux/bfs_fs_i.h index 647352882..e939b229e 100644 --- a/include/linux/bfs_fs_i.h +++ b/include/linux/bfs_fs_i.h @@ -1,6 +1,6 @@ /* * include/linux/bfs_fs_i.h - * Copyright (C) 1999 Tigran Aivazian + * Copyright (C) 1999 Tigran Aivazian */ #ifndef _LINUX_BFS_FS_I diff --git a/include/linux/bfs_fs_sb.h b/include/linux/bfs_fs_sb.h index 5f927f35b..efdc30ec7 100644 --- a/include/linux/bfs_fs_sb.h +++ b/include/linux/bfs_fs_sb.h @@ -1,6 +1,6 @@ /* * include/linux/bfs_fs_sb.h - * Copyright (C) 1999 Tigran Aivazian + * Copyright (C) 1999 Tigran Aivazian */ #ifndef _LINUX_BFS_FS_SB diff --git a/include/linux/compatmac.h b/include/linux/compatmac.h index 07d8356d0..72f9151b8 100644 --- a/include/linux/compatmac.h +++ b/include/linux/compatmac.h @@ -104,7 +104,6 @@ static inline void *ioremap(unsigned long base, long length) #define capable(x) suser() -#define queue_task queue_task_irq_off #define tty_flip_buffer_push(tty) queue_task(&tty->flip.tqueue, &tq_timer) #define signal_pending(current) (current->signal & ~current->blocked) #define schedule_timeout(to) do {current->timeout = jiffies + (to);schedule ();} while (0) diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index af962e94f..dd9fdcfaf 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h @@ -549,9 +549,10 @@ extern int ext2_write (struct inode *, struct file *, char *, int); /* fsync.c */ extern int ext2_sync_file (struct file *, struct dentry *, int); +extern int ext2_fsync_inode (struct inode *, int); /* ialloc.c */ -extern struct inode * ext2_new_inode (const struct inode *, int, int *); +extern struct inode * ext2_new_inode (const struct inode *, int); extern void ext2_free_inode (struct inode *); extern unsigned long ext2_count_free_inodes (struct super_block *); extern void ext2_check_inodes_bitmap (struct super_block *); diff --git a/include/linux/fs.h b/include/linux/fs.h index 470186804..2ef374aa1 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -243,6 +243,9 @@ struct buffer_head { unsigned long b_rsector; /* Real buffer location on disk */ wait_queue_head_t b_wait; + + struct inode * b_inode; + struct list_head b_inode_buffers; /* doubly linked list of inode dirty buffers */ }; typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate); @@ -349,7 +352,7 @@ struct page; struct address_space; struct address_space_operations { - int (*writepage)(struct file *, struct page *); + int (*writepage)(struct page *); int (*readpage)(struct file *, struct page *); int (*sync_page)(struct page *); int (*prepare_write)(struct file *, struct page *, unsigned, unsigned); @@ -382,6 +385,8 @@ struct inode { struct list_head i_hash; struct list_head i_list; struct list_head i_dentry; + + struct list_head i_dirty_buffers; unsigned long i_ino; atomic_t i_count; @@ -452,16 +457,25 @@ struct inode { }; /* Inode state bits.. */ -#define I_DIRTY 1 -#define I_LOCK 2 -#define I_FREEING 4 -#define I_CLEAR 8 +#define I_DIRTY_SYNC 1 /* Not dirty enough for O_DATASYNC */ +#define I_DIRTY_DATASYNC 2 /* Data-related inode changes pending */ +#define I_LOCK 4 +#define I_FREEING 8 +#define I_CLEAR 16 + +#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC) -extern void __mark_inode_dirty(struct inode *); +extern void __mark_inode_dirty(struct inode *, int); static inline void mark_inode_dirty(struct inode *inode) { - if (!(inode->i_state & I_DIRTY)) - __mark_inode_dirty(inode); + if ((inode->i_state & I_DIRTY) != I_DIRTY) + __mark_inode_dirty(inode, I_DIRTY); +} + +static inline void mark_inode_dirty_sync(struct inode *inode) +{ + if (!(inode->i_state & I_DIRTY_SYNC)) + __mark_inode_dirty(inode, I_DIRTY_SYNC); } struct fown_struct { @@ -1025,10 +1039,18 @@ static inline void buffer_IO_error(struct buffer_head * bh) bh->b_end_io(bh, 0); } +extern void buffer_insert_inode_queue(struct buffer_head *, struct inode *); +static inline void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode) +{ + mark_buffer_dirty(bh); + buffer_insert_inode_queue(bh, inode); +} + extern void balance_dirty(kdev_t); extern int check_disk_change(kdev_t); extern int invalidate_inodes(struct super_block *); extern void invalidate_inode_pages(struct inode *); +extern void invalidate_inode_buffers(struct inode *); #define invalidate_buffers(dev) __invalidate_buffers((dev), 0) #define destroy_buffers(dev) __invalidate_buffers((dev), 1) extern void __invalidate_buffers(kdev_t dev, int); @@ -1036,10 +1058,14 @@ extern void sync_inodes(kdev_t); extern void write_inode_now(struct inode *, int); extern void sync_dev(kdev_t); extern int fsync_dev(kdev_t); +extern int fsync_inode_buffers(struct inode *); +extern int osync_inode_buffers(struct inode *); +extern int inode_has_buffers(struct inode *); extern void sync_supers(kdev_t); extern int bmap(struct inode *, int); extern int notify_change(struct dentry *, struct iattr *); extern int permission(struct inode *, int); +extern int vfs_permission(struct inode *, int); extern int get_write_access(struct inode *); extern int deny_write_access(struct file *); static inline void put_write_access(struct inode * inode) @@ -1167,6 +1193,7 @@ extern void file_moveto(struct file *new, struct file *old); extern struct buffer_head * get_hash_table(kdev_t, int, int); extern struct buffer_head * getblk(kdev_t, int, int); extern void ll_rw_block(int, int, struct buffer_head * bh[]); +extern void submit_bh(int, struct buffer_head *); extern int is_read_only(kdev_t); extern void __brelse(struct buffer_head *); static inline void brelse(struct buffer_head *buf) @@ -1183,7 +1210,6 @@ static inline void bforget(struct buffer_head *buf) extern void set_blocksize(kdev_t, int); extern unsigned int get_hardblocksize(kdev_t); extern struct buffer_head * bread(kdev_t, int, int); -extern struct buffer_head * breada(kdev_t, int, int, unsigned int, unsigned int); extern void wakeup_bdflush(int wait); extern int brw_page(int, struct page *, kdev_t, int [], int); @@ -1249,6 +1275,7 @@ extern ssize_t block_write(struct file *, const char *, size_t, loff_t *); extern int file_fsync(struct file *, struct dentry *, int); extern int generic_buffer_fdatasync(struct inode *inode, unsigned long start_idx, unsigned long end_idx); +extern int generic_osync_inode(struct inode *, int); extern int inode_change_ok(struct inode *, struct iattr *); extern void inode_setattr(struct inode *, struct iattr *); diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h index 2a55e6018..99a5444da 100644 --- a/include/linux/hdlcdrv.h +++ b/include/linux/hdlcdrv.h @@ -199,7 +199,7 @@ struct hdlcdrv_state { struct hdlcdrv_hdlcrx { struct hdlcdrv_hdlcbuffer hbuf; - int in_hdlc_rx; + long in_hdlc_rx; /* 0 = sync hunt, != 0 receiving */ int rx_state; unsigned int bitstream; diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 9cac7759a..eb5405d33 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -13,8 +13,6 @@ extern struct page *highmem_start_page; /* declarations for linux/mm/highmem.c */ FASTCALL(unsigned int nr_free_highpages(void)); -extern struct page * prepare_highmem_swapout(struct page *); -extern struct page * replace_with_highmem(struct page *); extern struct buffer_head * create_bounce(int rw, struct buffer_head * bh_orig); @@ -31,8 +29,6 @@ static inline void bh_kunmap(struct buffer_head *bh) #else /* CONFIG_HIGHMEM */ static inline unsigned int nr_free_highpages(void) { return 0; } -#define prepare_highmem_swapout(page) page -#define replace_with_highmem(page) page static inline void *kmap(struct page *page) { return page_address(page); } diff --git a/include/linux/highuid.h b/include/linux/highuid.h index 5d287bbb3..d5a9ff5d0 100644 --- a/include/linux/highuid.h +++ b/include/linux/highuid.h @@ -41,14 +41,14 @@ extern int overflowgid; #ifdef CONFIG_UID16 /* prevent uid mod 65536 effect by returning a default value for high UIDs */ -#define high2lowuid(uid) ((uid) > 65535) ? (old_uid_t)overflowuid : (old_uid_t)(uid) -#define high2lowgid(gid) ((gid) > 65535) ? (old_gid_t)overflowgid : (old_gid_t)(gid) +#define high2lowuid(uid) ((uid) > 65535 ? (old_uid_t)overflowuid : (old_uid_t)(uid)) +#define high2lowgid(gid) ((gid) > 65535 ? (old_gid_t)overflowgid : (old_gid_t)(gid)) /* * -1 is different in 16 bits than it is in 32 bits * these macros are used by chown(), setreuid(), ..., */ -#define low2highuid(uid) ((uid) == (old_uid_t)-1) ? (uid_t)-1 : (uid_t)(uid) -#define low2highgid(gid) ((gid) == (old_gid_t)-1) ? (gid_t)-1 : (gid_t)(gid) +#define low2highuid(uid) ((uid) == (old_uid_t)-1 ? (uid_t)-1 : (uid_t)(uid)) +#define low2highgid(gid) ((gid) == (old_gid_t)-1 ? (gid_t)-1 : (gid_t)(gid)) /* Avoid extra ifdefs with these macros */ @@ -67,13 +67,13 @@ extern int overflowgid; #define SET_UID16(var, uid) do { ; } while (0) #define SET_GID16(var, gid) do { ; } while (0) -#define NEW_TO_OLD_UID(uid) uid -#define NEW_TO_OLD_GID(gid) gid +#define NEW_TO_OLD_UID(uid) (uid) +#define NEW_TO_OLD_GID(gid) (gid) -#define SET_OLDSTAT_UID(stat, uid) (stat).st_uid = uid -#define SET_OLDSTAT_GID(stat, gid) (stat).st_gid = gid -#define SET_STAT_UID(stat, uid) (stat).st_uid = uid -#define SET_STAT_GID(stat, gid) (stat).st_gid = gid +#define SET_OLDSTAT_UID(stat, uid) (stat).st_uid = (uid) +#define SET_OLDSTAT_GID(stat, gid) (stat).st_gid = (gid) +#define SET_STAT_UID(stat, uid) (stat).st_uid = (uid) +#define SET_STAT_GID(stat, gid) (stat).st_gid = (gid) #endif /* CONFIG_UID16 */ @@ -97,10 +97,10 @@ extern int fs_overflowgid; * Since these macros are used in architectures that only need limited * 16-bit UID back compatibility, we won't use old_uid_t and old_gid_t */ -#define fs_high2lowuid(uid) (uid > 65535) ? (uid16_t)fs_overflowuid : (uid16_t)uid -#define fs_high2lowgid(gid) (gid > 65535) ? (gid16_t)fs_overflowgid : (gid16_t)gid +#define fs_high2lowuid(uid) ((uid) > 65535 ? (uid16_t)fs_overflowuid : (uid16_t)(uid)) +#define fs_high2lowgid(gid) ((gid) > 65535 ? (gid16_t)fs_overflowgid : (gid16_t)(gid)) -#define low_16_bits(x) x & 0xFFFF -#define high_16_bits(x) (x & 0xFFFF0000) >> 16 +#define low_16_bits(x) ((x) & 0xFFFF) +#define high_16_bits(x) (((x) & 0xFFFF0000) >> 16) #endif /* _LINUX_HIGHUID_H */ diff --git a/include/linux/icmp.h b/include/linux/icmp.h index 292888923..49e3e931d 100644 --- a/include/linux/icmp.h +++ b/include/linux/icmp.h @@ -84,11 +84,6 @@ struct icmphdr { #include -struct icmp_err { - int errno; - unsigned fatal:1; -}; - /* * Build xmit assembly blocks */ diff --git a/include/linux/ioport.h b/include/linux/ioport.h index a24e7770a..7c3569949 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -19,6 +19,12 @@ struct resource { struct resource *parent, *sibling, *child; }; +struct resource_list { + struct resource_list *next; + struct resource *res; + struct pci_dev *dev; +}; + /* * IO resources have these defined flags. */ @@ -34,6 +40,7 @@ struct resource { #define IORESOURCE_CACHEABLE 0x00004000 #define IORESOURCE_RANGELENGTH 0x00008000 #define IORESOURCE_SHADOWABLE 0x00010000 +#define IORESOURCE_BUS_HAS_VGA 0x00080000 #define IORESOURCE_UNSET 0x20000000 #define IORESOURCE_AUTO 0x40000000 diff --git a/include/linux/isdn.h b/include/linux/isdn.h index 51c06aec7..23cf7ed73 100644 --- a/include/linux/isdn.h +++ b/include/linux/isdn.h @@ -1,4 +1,4 @@ -/* $Id: isdn.h,v 1.110 2000/11/01 17:54:01 detabc Exp $ +/* $Id: isdn.h,v 1.111 2000/11/25 17:01:02 kai Exp $ * Main header for the Linux ISDN subsystem (linklevel). * @@ -684,10 +684,8 @@ typedef struct isdn_devt { extern isdn_dev *dev; - /* Utility-Macros */ #define MIN(a,b) ((ab)?a:b) - #endif /* __KERNEL__ */ #endif /* isdn_h */ diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h index 15ebaffcb..1d5d4f85b 100644 --- a/include/linux/isdnif.h +++ b/include/linux/isdnif.h @@ -1,4 +1,4 @@ -/* $Id: isdnif.h,v 1.35 2000/06/16 13:19:38 keil Exp $ +/* $Id: isdnif.h,v 1.37 2000/11/19 17:01:54 kai Exp $ * Linux ISDN subsystem * @@ -53,6 +53,7 @@ #define ISDN_PROTO_L2_V11038 9 /* V.110 bitrate adaption 38400 Baud */ #define ISDN_PROTO_L2_MODEM 10 /* Analog Modem on Board */ #define ISDN_PROTO_L2_FAX 11 /* Fax Group 2/3 */ +#define ISDN_PROTO_L2_HDLC_56K 12 /* HDLC 56k */ #define ISDN_PROTO_L2_MAX 15 /* Max. 16 Protocols */ /* @@ -253,6 +254,7 @@ typedef struct #define ISDN_FEATURE_L2_V11038 (0x0001 << ISDN_PROTO_L2_V11038) #define ISDN_FEATURE_L2_MODEM (0x0001 << ISDN_PROTO_L2_MODEM) #define ISDN_FEATURE_L2_FAX (0x0001 << ISDN_PROTO_L2_FAX) +#define ISDN_FEATURE_L2_HDLC_56K (0x0001 << ISDN_PROTO_L2_HDLC_56K) #define ISDN_FEATURE_L2_MASK (0x0FFFF) /* Max. 16 protocols */ #define ISDN_FEATURE_L2_SHIFT (0) diff --git a/include/linux/iso_fs.h b/include/linux/iso_fs.h index 471c9af2c..e664eed06 100644 --- a/include/linux/iso_fs.h +++ b/include/linux/iso_fs.h @@ -185,8 +185,6 @@ int get_joliet_filename(struct iso_directory_record *, unsigned char *, struct i int get_acorn_filename(struct iso_directory_record *, char *, struct inode *); extern struct dentry *isofs_lookup(struct inode *, struct dentry *); -extern int isofs_get_block(struct inode *, long, struct buffer_head *, int); -extern int isofs_bmap(struct inode *, int); extern struct buffer_head *isofs_bread(struct inode *, unsigned int, unsigned int); extern struct inode_operations isofs_dir_inode_operations; diff --git a/include/linux/kernel.h b/include/linux/kernel.h index beb41bfa3..50ee12471 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -56,17 +56,34 @@ NORET_TYPE void up_and_exit(struct semaphore *, long) ATTRIB_NORET; extern unsigned long simple_strtoul(const char *,char **,unsigned int); extern long simple_strtol(const char *,char **,unsigned int); +extern unsigned long long simple_strtoull(const char *,char **,unsigned int); +extern long long simple_strtoll(const char *,char **,unsigned int); extern int sprintf(char * buf, const char * fmt, ...); extern int vsprintf(char *buf, const char *, va_list); extern int get_option(char **str, int *pint); extern char *get_options(char *str, int nints, int *ints); extern unsigned long memparse(char *ptr, char **retptr); +extern void dev_probe_lock(void); +extern void dev_probe_unlock(void); extern int session_of_pgrp(int pgrp); asmlinkage int printk(const char * fmt, ...) __attribute__ ((format (printf, 1, 2))); +extern int console_loglevel; + +static inline void console_silent(void) +{ + console_loglevel = 0; +} + +static inline void console_verbose(void) +{ + if (console_loglevel) + console_loglevel = 15; +} + #if DEBUG #define pr_debug(fmt,arg...) \ printk(KERN_DEBUG fmt,##arg) diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h index acbdea338..2677f9646 100644 --- a/include/linux/kernelcapi.h +++ b/include/linux/kernelcapi.h @@ -1,5 +1,5 @@ /* - * $Id: kernelcapi.h,v 1.8 2000/08/22 10:11:00 calle Exp $ + * $Id: kernelcapi.h,v 1.8.6.1 2000/11/28 09:36:56 kai Exp $ * * Kernel CAPI 2.0 Interface for Linux * diff --git a/include/linux/mm.h b/include/linux/mm.h index 70ffe28e4..37bc9a4a1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -204,7 +204,7 @@ typedef struct page { */ #define UnlockPage(page) do { \ smp_mb__before_clear_bit(); \ - clear_bit(PG_locked, &(page)->flags); \ + if (!test_and_clear_bit(PG_locked, &(page)->flags)) BUG(); \ smp_mb__after_clear_bit(); \ if (waitqueue_active(&page->wait)) \ wake_up(&page->wait); \ @@ -454,11 +454,9 @@ extern unsigned long page_unuse(struct page *); extern void truncate_inode_pages(struct address_space *, loff_t); /* generic vm_area_ops exported for stackable file systems */ -extern int filemap_swapout(struct page * page, struct file *file); -extern int filemap_sync(struct vm_area_struct * vma, unsigned long address, - size_t size, unsigned int flags); -extern struct page *filemap_nopage(struct vm_area_struct * area, - unsigned long address, int no_share); +extern int filemap_swapout(struct page *, struct file *); +extern int filemap_sync(struct vm_area_struct *, unsigned long, size_t, unsigned int); +extern struct page *filemap_nopage(struct vm_area_struct *, unsigned long, int); /* * GFP bitmasks.. diff --git a/include/linux/module.h b/include/linux/module.h index 249cb0163..7f416d7fb 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -168,6 +168,7 @@ struct module_info * Keith Owens 28 Oct 2000. */ +#ifdef __KERNEL__ #define HAVE_INTER_MODULE extern void inter_module_register(const char *, struct module *, const void *); extern void inter_module_unregister(const char *); @@ -183,6 +184,7 @@ struct inter_module_entry { }; extern int try_inc_mod_count(struct module *mod); +#endif /* __KERNEL__ */ #if defined(MODULE) && !defined(__GENKSYMS__) @@ -345,7 +347,7 @@ __attribute__((section("__ksymtab"))) = \ #endif /* MODULE */ #ifdef CONFIG_MODULES -#define SET_MODULE_OWNER(some_struct) do { some_struct->owner = THIS_MODULE; } while (0) +#define SET_MODULE_OWNER(some_struct) do { (some_struct)->owner = THIS_MODULE; } while (0) #else #define SET_MODULE_OWNER(some_struct) do { } while (0) #endif diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index c8bdd1cd7..4ce69eee8 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h @@ -91,8 +91,9 @@ struct cfi_private { must be of the same type. */ int numchips; unsigned long chipshift; /* Because they're of the same type */ - struct flchip chips[0]; /* per-chip data structure for each chip */ const char *im_name; /* inter_module name for cmdset_setup */ + struct flchip chips[0]; /* per-chip data structure for each chip */ + /* do not add extra fields after "chips" */ }; #define MAX_CFI_CHIPS 8 /* Entirely arbitrary to avoid realloc() */ diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h index 0ed87cdb4..696938aa1 100644 --- a/include/linux/mtd/doc2000.h +++ b/include/linux/mtd/doc2000.h @@ -2,7 +2,7 @@ /* Linux driver for Disk-On-Chip 2000 */ /* (c) 1999 Machine Vision Holdings, Inc. */ /* Author: David Woodhouse */ -/* $Id: doc2000.h,v 1.8 2000/07/10 15:46:29 dwmw2 Exp $ */ +/* $Id: doc2000.h,v 1.12 2000/11/03 12:43:43 dwmw2 Exp $ */ #ifndef __MTD_DOC2000_H__ #define __MTD_DOC2000_H__ @@ -44,16 +44,24 @@ * Others use readb/writeb */ #if defined(__arm__) -#define ReadDOC(adr, reg) ((unsigned char)(*(__u32 *)(((unsigned long)adr)+(DoC_##reg<<2)))) -#define WriteDOC(d, adr, reg) do{ *(__u32 *)(((unsigned long)adr)+(DoC_##reg<<2)) = (__u32)d} while(0) +#define ReadDOC_(adr, reg) ((unsigned char)(*(__u32 *)(((unsigned long)adr)+(reg<<2)))) +#define WriteDOC_(d, adr, reg) do{ *(__u32 *)(((unsigned long)adr)+(reg<<2)) = (__u32)d} while(0) #elif defined(__ppc__) -#define ReadDOC(adr, reg) ((unsigned char)(*(__u16 *)(((unsigned long)adr)+(DoC_##reg<<1)))) -#define WriteDOC(d, adr, reg) do{ *(__u16 *)(((unsigned long)adr)+(DoC_##reg<<1)) = (__u16)d} while(0) +#define ReadDOC_(adr, reg) ((unsigned char)(*(__u16 *)(((unsigned long)adr)+(reg<<1)))) +#define WriteDOC_(d, adr, reg) do{ *(__u16 *)(((unsigned long)adr)+(reg<<1)) = (__u16)d} while(0) #else -#define ReadDOC(adr, reg) readb(((unsigned long)adr) + DoC_##reg) -#define WriteDOC(d, adr, reg) writeb(d, ((unsigned long)adr) + DoC_##reg) +#define ReadDOC_(adr, reg) readb(((unsigned long)adr) + reg) +#define WriteDOC_(d, adr, reg) writeb(d, ((unsigned long)adr) + reg) #endif +#if defined(__i386__) +#define USE_MEMCPY +#endif + +/* These are provided to directly use the DoC_xxx defines */ +#define ReadDOC(adr, reg) ReadDOC_(adr,DoC_##reg) +#define WriteDOC(d, adr, reg) WriteDOC_(d,adr,DoC_##reg) + #define DOC_MODE_RESET 0 #define DOC_MODE_NORMAL 1 #define DOC_MODE_RESERVED1 2 @@ -80,9 +88,10 @@ #define DOC_TOGGLE_BIT 0x04 #define DOC_ECC_RESV 0x02 #define DOC_ECC_IGNORE 0x01 + /* We have to also set the reserved bit 1 for enable */ #define DOC_ECC_EN (DOC_ECC__EN | DOC_ECC_RESV) -#define DOC_ECC_DIS (DOC_ECC_IGNORE | DOC_ECC_RESV) +#define DOC_ECC_DIS (DOC_ECC_RESV) struct Nand { char floor, chip; @@ -97,15 +106,23 @@ struct Nand { #define MAX_FLOORS_MIL 4 #define MAX_CHIPS_MIL 1 +#define ADDR_COLUMN 1 +#define ADDR_PAGE 2 +#define ADDR_COLUMN_PAGE 3 + struct DiskOnChip { unsigned long physadr; unsigned long virtadr; unsigned long totlen; char ChipID; /* Type of DiskOnChip */ + int ioreg; unsigned long mfr; /* Flash IDs - only one type of flash per device */ unsigned long id; int chipshift; + char page256; + char pageadrlen; + unsigned long erasesize; int curfloor; int curchip; @@ -115,5 +132,6 @@ struct DiskOnChip { struct mtd_info *nextdoc; }; +int doc_decode_ecc(unsigned char sector[512], unsigned char ecc1[6]); #endif /* __MTD_DOC2000_H__ */ diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h index ebb41c973..705169800 100644 --- a/include/linux/mtd/map.h +++ b/include/linux/mtd/map.h @@ -1,6 +1,6 @@ /* Overhauled routines for dealing with different mmap regions of flash */ -/* $Id: map.h,v 1.5 2000/06/26 16:18:58 dwmw2 Exp $ */ +/* $Id: map.h,v 1.10 2000/12/04 13:18:33 dwmw2 Exp $ */ #ifndef __LINUX_MTD_MAP_H__ #define __LINUX_MTD_MAP_H__ @@ -42,6 +42,8 @@ struct map_info { void (*write16)(struct map_info *, __u16, unsigned long); void (*write32)(struct map_info *, __u32, unsigned long); void (*copy_to)(struct map_info *, unsigned long, const void *, ssize_t); + + void (*set_vpp)(int); /* We put these two here rather than a single void *map_priv, because we want mappers to be able to have quickly-accessible cache for the 'currently-mapped page' without the _extra_ @@ -54,6 +56,7 @@ struct map_info { const char *im_name; }; +#ifdef CONFIG_MODULES /* * Probe for the contents of a map device and make an MTD structure * if anything is recognised. Doesn't register it because the calling @@ -78,6 +81,18 @@ static inline struct mtd_info *do_map_probe(struct map_info *map, const char *fu #define do_jedec_probe(x) do_map_probe(x, "jedec_probe", "jedec_probe") #define do_ram_probe(x) do_map_probe(x, "map_ram_probe", "map_ram") #define do_rom_probe(x) do_map_probe(x, "map_rom_probe", "map_rom") +#else + /* without module support, call probe function directly */ +extern struct mtd_info *cfi_probe(struct map_info *); +extern struct mtd_info *jedec_probe(struct map_info *); +extern struct mtd_info *map_ram_probe(struct map_info *); +extern struct mtd_info *map_rom_probe(struct map_info *); + +#define do_cfi_probe(x) cfi_probe(x) +#define do_jedec_probe(x) jedec_probe(x) +#define do_ram_probe(x) map_ram_probe(x) +#define do_rom_probe(x) map_rom_probe(x) +#endif /* * Destroy an MTD device which was created for a map device. @@ -92,5 +107,7 @@ static inline void map_destroy(struct mtd_info *mtd) kfree(mtd); } +#define ENABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(1); } while(0) +#define DISABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(0); } while(0) #endif /* __LINUX_MTD_MAP_H__ */ diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index a7bc521c2..708f4f203 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -1,5 +1,5 @@ -/* $Id: mtd.h,v 1.17 2000/07/04 07:24:49 jgg Exp $ */ +/* $Id: mtd.h,v 1.26 2000/10/30 17:18:04 sjhill Exp $ */ #ifndef __MTD_MTD_H__ #define __MTD_MTD_H__ @@ -10,6 +10,7 @@ #include #include #include +#include #endif /* __KERNEL__ */ @@ -61,7 +62,8 @@ struct mtd_oob_buf { // Types of automatic ECC/Checksum available #define MTD_ECC_NONE 0 // No automatic ECC available -#define MTD_ECC_RS_DiskOnChip 1 // Automatic ECC on DiskOnChip +#define MTD_ECC_RS_DiskOnChip 1 // Automatic ECC on DiskOnChip +#define MTD_ECC_SW 2 // SW ECC for Toshiba & Samsung devices struct mtd_info_user { u_char type; @@ -78,6 +80,8 @@ struct mtd_info_user { #define MEMERASE _IOW('M', 2, struct erase_info_user) #define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf) #define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf) +#define MEMLOCK _IOW('M', 5, struct erase_info_user) +#define MEMUNLOCK _IOW('M', 6, struct erase_info_user) #ifndef __KERNEL__ @@ -123,6 +127,7 @@ struct mtd_info { // Kernel-only stuff starts here. char *name; + int index; u_long bank_size; @@ -144,9 +149,22 @@ struct mtd_info { int (*read_oob) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); int (*write_oob) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); - + + /* iovec-based read/write methods. We need these especially for NAND flash, + with its limited number of write cycles per erase. + NB: The 'count' parameter is the number of _vectors_, each of + which contains an (ofs, len) tuple. + */ + int (*readv) (struct mtd_info *mtd, struct iovec *vecs, unsigned long count, loff_t from, size_t *retlen); + int (*writev) (struct mtd_info *mtd, const struct iovec *vecs, unsigned long count, loff_t to, size_t *retlen); + + /* Sync */ void (*sync) (struct mtd_info *mtd); + /* Chip-supported device locking */ + int (*lock) (struct mtd_info *mtd, loff_t ofs, size_t len); + int (*unlock) (struct mtd_info *mtd, loff_t ofs, size_t len); + /* Power Management functions */ int (*suspend) (struct mtd_info *mtd); void (*resume) (struct mtd_info *mtd); @@ -198,20 +216,32 @@ extern int unregister_mtd_user (struct mtd_notifier *old); #define MTD_UNPOINT(mtd, arg) (*(mtd->unpoint))(mtd, (u_char *)arg) #define MTD_READ(mtd, args...) (*(mtd->read))(mtd, args) #define MTD_WRITE(mtd, args...) (*(mtd->write))(mtd, args) +#define MTD_READV(mtd, args...) (*(mtd->readv))(mtd, args) +#define MTD_WRITEV(mtd, args...) (*(mtd->writev))(mtd, args) +#define MTD_READECC(mtd, args...) (*(mtd->read_ecc))(mtd, args) +#define MTD_WRITEECC(mtd, args...) (*(mtd->write_ecc))(mtd, args) #define MTD_READOOB(mtd, args...) (*(mtd->read_oob))(mtd, args) #define MTD_WRITEOOB(mtd, args...) (*(mtd->write_oob))(mtd, args) #define MTD_SYNC(mtd) do { if (mtd->sync) (*(mtd->sync))(mtd); } while (0) #endif /* MTDC */ -/* Debugging macros */ - -#ifdef DEBUGLVL -#define DEBUG(n, args...) if (DEBUGLVL>(n)) printk(KERN_DEBUG args) -#else +/* + * Debugging macro and defines + */ +#define MTD_DEBUG_LEVEL0 (0) /* Quiet */ +#define MTD_DEBUG_LEVEL1 (1) /* Audible */ +#define MTD_DEBUG_LEVEL2 (2) /* Loud */ +#define MTD_DEBUG_LEVEL3 (3) /* Noisy */ + +#ifdef CONFIG_MTD_DEBUG +#define DEBUG(n, args...) \ + if (n <= CONFIG_MTD_DEBUG_VERBOSE) { \ + printk(KERN_INFO args); \ + } +#else /* CONFIG_MTD_DEBUG */ #define DEBUG(n, args...) -#endif +#endif /* CONFIG_MTD_DEBUG */ #endif /* __KERNEL__ */ - #endif /* __MTD_MTD_H__ */ diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 79ca1843c..8c678ab97 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -1,31 +1,154 @@ +/* + * linux/include/linux/mtd/nand.h + * + * Copyright (c) 2000 David Woodhouse + * Steven J. Hill + * + * $Id: nand.h,v 1.8 2000/10/30 17:16:17 sjhill Exp $ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Info: + * Contains standard defines and IDs for NAND flash devices + * + * Changelog: + * 01-31-2000 DMW Created + * 09-18-2000 SJH Moved structure out of the Disk-On-Chip drivers + * so it can be used by other NAND flash device + * drivers. I also changed the copyright since none + * of the original contents of this file are specific + * to DoC devices. David can whack me with a baseball + * bat later if I did something naughty. + * 10-11-2000 SJH Added private NAND flash structure for driver + * 10-24-2000 SJH Added prototype for 'nand_scan' function + */ +#ifndef __LINUX_MTD_NAND_H +#define __LINUX_MTD_NAND_H -/* Defines for NAND flash devices */ -/* (c) 1999 Machine Vision Holdings, Inc. */ -/* Author: David Woodhouse */ -/* $Id: nand.h,v 1.2 1999/08/17 22:57:08 dwmw2 Exp $ */ +#include +#include -#ifndef __MTD_NAND_H__ -#define __MTD_NAND_H__ - -#define NAND_CMD_READ0 0 -#define NAND_CMD_READ1 1 -#define NAND_CMD_PAGEPROG 0x10 -#define NAND_CMD_READOOB 0x50 -#define NAND_CMD_ERASE1 0x60 -#define NAND_CMD_STATUS 0x70 -#define NAND_CMD_SEQIN 0x80 -#define NAND_CMD_READID 0x90 -#define NAND_CMD_ERASE2 0xd0 -#define NAND_CMD_RESET 0xff - -#define NAND_MFR_TOSHIBA 0x98 -#define NAND_MFR_SAMSUNG 0xec - - -#endif /* __MTD_NAND_H__ */ +/* + * Searches for a NAND device + */ +extern int nand_scan (struct mtd_info *mtd); +/* + * Standard NAND flash commands + */ +#define NAND_CMD_READ0 0 +#define NAND_CMD_READ1 1 +#define NAND_CMD_PAGEPROG 0x10 +#define NAND_CMD_READOOB 0x50 +#define NAND_CMD_ERASE1 0x60 +#define NAND_CMD_STATUS 0x70 +#define NAND_CMD_SEQIN 0x80 +#define NAND_CMD_READID 0x90 +#define NAND_CMD_ERASE2 0xd0 +#define NAND_CMD_RESET 0xff +/* + * Enumeration for NAND flash chip state + */ +typedef enum { + FL_READY, + FL_READING, + FL_WRITING, + FL_ERASING, + FL_SYNCING +} nand_state_t; +/* + * NAND Private Flash Chip Data + * + * Structure overview: + * + * IO_ADDR - address to access the 8 I/O lines to the flash device + * + * CTRL_ADDR - address where ALE, CLE and CE control bits are accessed + * + * CLE - location in control word for Command Latch Enable bit + * + * ALE - location in control word for Address Latch Enable bit + * + * NCE - location in control word for nChip Enable bit + * + * chip_lock - spinlock used to protect access to this structure + * + * wq - wait queue to sleep on if a NAND operation is in progress + * + * state - give the current state of the NAND device + * + * page_shift - number of address bits in a page (column address bits) + * + * data_buf - data buffer passed to/from MTD user modules + * + * ecc_code_buf - used only for holding calculated or read ECCs for + * a page read or written when ECC is in use + * + * reserved - padding to make structure fall on word boundary if + * when ECC is in use + */ +struct nand_chip { + unsigned long IO_ADDR; + unsigned long CTRL_ADDR; + unsigned int CLE; + unsigned int ALE; + unsigned int NCE; + spinlock_t chip_lock; + wait_queue_head_t wq; + nand_state_t state; + int page_shift; + u_char *data_buf; +#ifdef CONFIG_MTD_NAND_ECC + u_char ecc_code_buf[6]; + u_char reserved[2]; +#endif +}; +/* + * NAND Flash Manufacturer ID Codes + */ +#define NAND_MFR_TOSHIBA 0x98 +#define NAND_MFR_SAMSUNG 0xec +/* + * NAND Flash Device ID Structure + * + * Structure overview: + * + * name - Complete name of device + * + * manufacture_id - manufacturer ID code of device. + * + * model_id - model ID code of device. + * + * chipshift - total number of address bits for the device which + * is used to calculate address offsets and the total + * number of bytes the device is capable of. + * + * page256 - denotes if flash device has 256 byte pages or not. + * + * pageadrlen - number of bytes minus one needed to hold the + * complete address into the flash array. Keep in + * mind that when a read or write is done to a + * specific address, the address is input serially + * 8 bits at a time. This structure member is used + * by the read/write routines as a loop index for + * shifting the address out 8 bits at a time. + * + * erasesize - size of an erase block in the flash device. + */ +struct nand_flash_dev { + char * name; + int manufacture_id; + int model_id; + int chipshift; + char page256; + char pageadrlen; + unsigned long erasesize; +}; +#endif /* __LINUX_MTD_NAND_H */ diff --git a/include/linux/mtd/nand_ids.h b/include/linux/mtd/nand_ids.h new file mode 100644 index 000000000..0918b8c1e --- /dev/null +++ b/include/linux/mtd/nand_ids.h @@ -0,0 +1,52 @@ +/* + * linux/include/linux/mtd/nand_ids.h + * + * Copyright (c) 2000 David Woodhouse + * Steven J. Hill + * + * $Id: nand_ids.h,v 1.1 2000/10/13 16:16:26 mdeans Exp $ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Info: + * Contains standard defines and IDs for NAND flash devices + * + * Changelog: + * 01-31-2000 DMW Created + * 09-18-2000 SJH Moved structure out of the Disk-On-Chip drivers + * so it can be used by other NAND flash device + * drivers. I also changed the copyright since none + * of the original contents of this file are specific + * to DoC devices. David can whack me with a baseball + * bat later if I did something naughty. + * 10-11-2000 SJH Added private NAND flash structure for driver + * 2000-10-13 BE Moved out of 'nand.h' - avoids duplication. + */ + +#ifndef __LINUX_MTD_NAND_IDS_H +#define __LINUX_MTD_NAND_IDS_H + +static struct nand_flash_dev nand_flash_ids[] = { + {"Toshiba TC5816BDC", NAND_MFR_TOSHIBA, 0x64, 21, 1, 2, 0x1000}, + {"Toshiba TC5832DC", NAND_MFR_TOSHIBA, 0x6b, 22, 0, 2, 0x2000}, + {"Toshiba TH58V128DC", NAND_MFR_TOSHIBA, 0x73, 24, 0, 2, 0x4000}, + {"Toshiba TC58256FT/DC", NAND_MFR_TOSHIBA, 0x75, 25, 0, 2, 0x4000}, + {"Toshiba TH58512FT", NAND_MFR_TOSHIBA, 0x76, 26, 0, 3, 0x4000}, + {"Toshiba TC58V32DC", NAND_MFR_TOSHIBA, 0xe5, 22, 0, 2, 0x2000}, + {"Toshiba TC58V64AFT/DC", NAND_MFR_TOSHIBA, 0xe6, 23, 0, 2, 0x2000}, + {"Toshiba TC58V16BDC", NAND_MFR_TOSHIBA, 0xea, 21, 1, 2, 0x1000}, + {"Samsung KM29N16000", NAND_MFR_SAMSUNG, 0x64, 21, 1, 2, 0x1000}, + {"Samsung unknown 4Mb", NAND_MFR_SAMSUNG, 0x6b, 22, 0, 2, 0x2000}, + {"Samsung KM29U128T", NAND_MFR_SAMSUNG, 0x73, 24, 0, 2, 0x4000}, + {"Samsung KM29U256T", NAND_MFR_SAMSUNG, 0x75, 25, 0, 2, 0x4000}, + {"Samsung unknown 64Mb", NAND_MFR_SAMSUNG, 0x76, 26, 0, 3, 0x4000}, + {"Samsung KM29W32000", NAND_MFR_SAMSUNG, 0xe3, 22, 0, 2, 0x2000}, + {"Samsung unknown 4Mb", NAND_MFR_SAMSUNG, 0xe5, 22, 0, 2, 0x2000}, + {"Samsung KM29U64000", NAND_MFR_SAMSUNG, 0xe6, 23, 0, 2, 0x2000}, + {"Samsung KM29W16000", NAND_MFR_SAMSUNG, 0xea, 21, 1, 2, 0x1000}, + {NULL,} +}; + +#endif /* __LINUX_MTD_NAND_IDS_H */ diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h index 153fa5c6a..ae00ceb0b 100644 --- a/include/linux/mtd/nftl.h +++ b/include/linux/mtd/nftl.h @@ -2,18 +2,21 @@ /* Defines for NAND Flash Translation Layer */ /* (c) 1999 Machine Vision Holdings, Inc. */ /* Author: David Woodhouse */ -/* $Id: nftl.h,v 1.6 2000/03/31 15:12:20 dwmw2 Exp $ */ +/* $Id: nftl.h,v 1.9 2000/11/07 05:48:49 ollie Exp $ */ #ifndef __MTD_NFTL_H__ #define __MTD_NFTL_H__ +#ifndef __BOOT__ #include +#endif /* Block Control Information */ struct nftl_bci { unsigned char ECCSig[6]; - __u16 Status; + __u8 Status; + __u8 Status1; }__attribute__((packed)); /* Unit Control Information */ @@ -32,7 +35,8 @@ struct nftl_uci1 { } __attribute__((packed)); struct nftl_uci2 { - __u32 WriteInh; + __u16 FoldMark; + __u16 FoldMark1; __u32 unused; } __attribute__((packed)); @@ -60,10 +64,12 @@ struct NFTLMediaHeader { #define MAX_ERASE_ZONES (8192 - 512) #define ERASE_MARK 0x3c69 -#define BLOCK_FREE 0xffff -#define BLOCK_USED 0x5555 -#define BLOCK_IGNORE 0x1111 -#define BLOCK_DELETED 0x0000 +#define SECTOR_FREE 0xff +#define SECTOR_USED 0x55 +#define SECTOR_IGNORE 0x11 +#define SECTOR_DELETED 0x00 + +#define FOLD_MARK_IN_PROGRESS 0x5555 #define ZONE_GOOD 0xff #define ZONE_BAD_ORIGINAL 0 @@ -71,6 +77,11 @@ struct NFTLMediaHeader { #ifdef __KERNEL__ +/* these info are used in ReplUnitTable */ +#define BLOCK_NIL 0xffff /* last block of a chain */ +#define BLOCK_FREE 0xfffe /* free block */ +#define BLOCK_NOTEXPLORED 0xfffd /* non explored block, only used during mounting */ +#define BLOCK_RESERVED 0xfffc /* bios block or bad block */ struct NFTLrecord { struct mtd_info *mtd; @@ -83,18 +94,27 @@ struct NFTLrecord { unsigned char sectors; unsigned short cylinders; __u16 numvunits; - __u16 lastEUN; + __u16 lastEUN; /* should be suppressed */ __u16 numfreeEUNs; - __u16 LastFreeEUN; /* To speed up finding a free EUN */ + __u16 LastFreeEUN; /* To speed up finding a free EUN */ __u32 long nr_sects; int head,sect,cyl; - __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */ - __u16 *VirtualUnitTable; /* [numEUNs]: VirtualUnitNumber for each */ - __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */ + __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */ + __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */ + unsigned int nb_blocks; /* number of physical blocks */ + unsigned int nb_boot_blocks; /* number of blocks used by the bios */ + struct erase_info instr; }; +int NFTL_mount(struct NFTLrecord *s); +int NFTL_formatblock(struct NFTLrecord *s, int block); + +#ifndef NFTL_MAJOR #define NFTL_MAJOR 93 +#endif + #define MAX_NFTLS 16 +#define MAX_SECTORS_PER_UNIT 32 #endif /* __KERNEL__ */ diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h new file mode 100644 index 000000000..a92023886 --- /dev/null +++ b/include/linux/mtd/partitions.h @@ -0,0 +1,50 @@ +/* + * MTD partitioning layer definitions + * + * (C) 2000 Nicolas Pitre + * + * This code is GPL + * + * $Id: partitions.h,v 1.3 2000/11/10 23:35:12 nico Exp $ + */ + +#ifndef MTD_PARTITIONS_H +#define MTD_PARTITIONS_H + +#include + + +/* + * Partition definition structure: + * + * An array of struct partition is passed along with a MTD object to + * add_mtd_partitions() to create them. + * + * For each partition, these fields are available: + * name: string that will be used to label the partition's MTD device. + * size: the partition size; if 0, the partition will extend to the end of the + * master MTD device. + * offset: absolute starting position within the master MTD device; if 0, + * partition will start where the previous one ended. + * mask_flags: contains flags that have to be masked (removed) from the + * master MTD flag set for the corresponding MTD partition. + * For example, to force a read-only partition, simply adding + * MTD_WRITEABLE to the mask_flags will do the trick. + * + * Note: writeable partitions require their size and offset be + * erasesize aligned. + */ + +struct mtd_partition { + char *name; /* identifier string */ + u_long size; /* partition size */ + u_long offset; /* offset within the master MTD space */ + u_long mask_flags; /* master MTD flags to mask out for this partition */ +}; + + +int add_mtd_partitions(struct mtd_info *, struct mtd_partition *, int); +int del_mtd_partitions(struct mtd_info *); + +#endif + diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h index 05c506516..144eb922a 100644 --- a/include/linux/mtd/pmc551.h +++ b/include/linux/mtd/pmc551.h @@ -1,5 +1,5 @@ /* - * $Id: pmc551.h,v 1.2 2000/03/31 14:40:42 dwmw2 Exp $ + * $Id: pmc551.h,v 1.3 2000/10/30 20:03:23 major Exp $ * * PMC551 PCI Mezzanine Ram Device * @@ -17,6 +17,9 @@ #include +#define PMC551_VERSION "$Id: pmc551.h,v 1.3 2000/10/30 20:03:23 major Exp $\n"\ + "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n" + /* * Our personal and private information */ @@ -54,68 +57,25 @@ static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_cha #define PMC551_PCI_MEM_MAP1 0x54 #define PMC551_PCI_MEM_MAP_MAP_ADDR_MASK 0x3ff00000 #define PMC551_PCI_MEM_MAP_APERTURE_MASK 0x000000f0 -#define PMC551_PCI_MEM_MAP_1MB_APERTURE 0x00000000 -#define PMC551_PCI_MEM_MAP_2MB_APERTURE 0x00000010 -#define PMC551_PCI_MEM_MAP_REG_EN 0x00000002 -#define PMC551_PCI_MEM_MAP_ENABLE 0x00000001 - -#define PMC551_SDRAM_MA 0x60 -#define PMC551_SDRAM_CMD 0x62 -#define PMC551_DRAM_CFG 0x64 - -#define PMC551_DRAM_BLK0 0x68 -#define PMC551_DRAM_BLK1 0x6c -#define PMC551_DRAM_BLK2 0x70 -#define PMC551_DRAM_BLK3 0x74 -#define PMC551_DRAM_BLK_GET_SIZE(x) ((512 * 1024) << ((x >> 4) & 0xf)) -#define PMC551_DRAM_BLK_SET_COL_MUX(x,v) (((x) & ~0x00007000) | (((v) & 0x7) << 12)) -#define PMC551_DRAM_BLK_SET_ROW_MUX(x,v) (((x) & ~0x00000f00) | (((v) & 0xf) << 8)) - - -/* Use a 1MB apeture into the card. */ -#define PMC551_APERTURE_SIZE 0x00100000 -#define PMC551_ADDR_HIGH_MASK 0x3ff00000 -#define PMC551_ADDR_LOW_MASK 0x000fffff -#define PMC551_APERTURE_VAL PMC551_PCI_MEM_MAP_1MB_APERTURE -/* - * Define the PCI ID's if the kernel doesn't define them for us - */ -#ifndef PCI_VENDOR_ID_V3_SEMI -#define PCI_VENDOR_ID_V3_SEMI 0x11b0 -#endif - -#ifndef PCI_DEVICE_ID_V3_SEMI_V370PDC -#define PCI_DEVICE_ID_V3_SEMI_V370PDC 0x0200 -#endif - - -#define PMC551_PCI_MEM_MAP0 0x50 -#define PMC551_PCI_MEM_MAP1 0x54 -#define PMC551_PCI_MEM_MAP_MAP_ADDR_MASK 0x3ff00000 -#define PMC551_PCI_MEM_MAP_APERTURE_MASK 0x000000f0 -#define PMC551_PCI_MEM_MAP_1MB_APERTURE 0x00000000 -#define PMC551_PCI_MEM_MAP_2MB_APERTURE 0x00000010 #define PMC551_PCI_MEM_MAP_REG_EN 0x00000002 #define PMC551_PCI_MEM_MAP_ENABLE 0x00000001 #define PMC551_SDRAM_MA 0x60 #define PMC551_SDRAM_CMD 0x62 #define PMC551_DRAM_CFG 0x64 +#define PMC551_SYS_CTRL_REG 0x78 #define PMC551_DRAM_BLK0 0x68 #define PMC551_DRAM_BLK1 0x6c #define PMC551_DRAM_BLK2 0x70 #define PMC551_DRAM_BLK3 0x74 -#define PMC551_DRAM_BLK_GET_SIZE(x) ((512 * 1024) << ((x >> 4) & 0xf)) +#define PMC551_DRAM_BLK_GET_SIZE(x) (524288<<((x>>4)&0x0f)) #define PMC551_DRAM_BLK_SET_COL_MUX(x,v) (((x) & ~0x00007000) | (((v) & 0x7) << 12)) #define PMC551_DRAM_BLK_SET_ROW_MUX(x,v) (((x) & ~0x00000f00) | (((v) & 0xf) << 8)) -/* Use a 1MB apeture into the card. */ -#define PMC551_APERTURE_SIZE 0x00100000 #define PMC551_ADDR_HIGH_MASK 0x3ff00000 #define PMC551_ADDR_LOW_MASK 0x000fffff -#define PMC551_APERTURE_VAL PMC551_PCI_MEM_MAP_1MB_APERTURE #endif /* __MTD_PMC551_H__ */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 2c2bfd4d5..462091674 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -51,11 +51,11 @@ struct divert_blk; /* Backlog congestion levels */ #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ -#define NET_RX_CN_LOW 1 /* storm alert, just in case */ -#define NET_RX_CN_MOD 2 /* Storm on its way! */ -#define NET_RX_CN_HIGH 5 /* The storm is here */ -#define NET_RX_DROP -1 /* packet dropped */ -#define NET_RX_BAD -2 /* packet dropped due to kernel error */ +#define NET_RX_DROP 1 /* packet dropped */ +#define NET_RX_CN_LOW 2 /* storm alert, just in case */ +#define NET_RX_CN_MOD 3 /* Storm on its way! */ +#define NET_RX_CN_HIGH 4 /* The storm is here */ +#define NET_RX_BAD 5 /* packet dropped due to kernel error */ #define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) @@ -333,11 +333,17 @@ struct net_device atomic_t refcnt; /* The flag marking that device is unregistered, but held by an user */ int deadbeaf; - /* New style devices allow asynchronous destruction; - netdevice_unregister for old style devices blocks until - the last user will dereference this device. - */ - int new_style; + + /* Net device features */ + int features; +#define NETIF_F_SG 1 /* Scatter/gather IO. */ +#define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */ +#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ +#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */ +#define NETIF_F_DYNALLOC 16 /* Self-dectructable device. */ +#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */ +#define NETIF_F_FRAGLIST 1 /* Scatter/gather IO. */ + /* Called after device is detached from network. */ void (*uninit)(struct net_device *dev); /* Called after last user reference disappears. */ diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index b61722b15..cc8abab1f 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -63,8 +63,7 @@ */ #define NFS_SUPER_MAGIC 0x6969 -#define NFS_FH(dentry) ((struct nfs_fh *) ((dentry)->d_fsdata)) -#define NFS_DSERVER(dentry) (&(dentry)->d_sb->u.nfs_sb.s_server) +#define NFS_FH(inode) (&(inode)->u.nfs_i.fh) #define NFS_SERVER(inode) (&(inode)->i_sb->u.nfs_sb.s_server) #define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) #define NFS_PROTO(inode) (NFS_SERVER(inode)->rpc_ops) @@ -93,6 +92,7 @@ do { \ #define NFS_FLAGS(inode) ((inode)->u.nfs_i.flags) #define NFS_REVALIDATING(inode) (NFS_FLAGS(inode) & NFS_INO_REVALIDATING) +#define NFS_STALE(inode) (NFS_FLAGS(inode) & NFS_INO_STALE) #define NFS_FILEID(inode) ((inode)->u.nfs_i.fileid) #define NFS_FSID(inode) ((inode)->u.nfs_i.fsid) @@ -139,13 +139,16 @@ unsigned long page_index(struct page *page) extern struct super_block *nfs_read_super(struct super_block *, void *, int); extern int init_nfs_fs(void); extern void nfs_zap_caches(struct inode *); +extern int nfs_inode_is_stale(struct inode *, struct nfs_fh *, + struct nfs_fattr *); extern struct inode *nfs_fhget(struct dentry *, struct nfs_fh *, struct nfs_fattr *); extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); extern int nfs_revalidate(struct dentry *); +extern int nfs_permission(struct inode *, int); extern int nfs_open(struct inode *, struct file *); extern int nfs_release(struct inode *, struct file *); -extern int __nfs_revalidate_inode(struct nfs_server *, struct dentry *); +extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); extern int nfs_notify_change(struct dentry *, struct iattr *); /* @@ -192,7 +195,7 @@ extern void nfs_complete_unlink(struct dentry *); /* * linux/fs/nfs/write.c */ -extern int nfs_writepage(struct file *file, struct page *); +extern int nfs_writepage(struct page *); extern int nfs_flush_incompatible(struct file *file, struct page *page); extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); /* @@ -264,12 +267,11 @@ extern int nfs3_mount(struct sockaddr_in *, char *, struct nfs_fh *); * inline functions */ static inline int -nfs_revalidate_inode(struct nfs_server *server, struct dentry *dentry) +nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) { - struct inode *inode = dentry->d_inode; if (time_before(jiffies, NFS_READTIME(inode)+NFS_ATTRTIMEO(inode))) - return 0; - return __nfs_revalidate_inode(server, dentry); + return NFS_STALE(inode) ? -ESTALE : 0; + return __nfs_revalidate_inode(server, inode); } static inline loff_t diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h index 2e10b1963..f14f3d8d9 100644 --- a/include/linux/nfs_fs_i.h +++ b/include/linux/nfs_fs_i.h @@ -3,6 +3,7 @@ #include #include +#include /* * nfs fs inode data in memory @@ -14,6 +15,11 @@ struct nfs_inode_info { __u64 fsid; __u64 fileid; + /* + * NFS file handle + */ + struct nfs_fh fh; + /* * Various flags */ @@ -72,6 +78,7 @@ struct nfs_inode_info { /* * Legal inode flag values */ +#define NFS_INO_STALE 0x0001 /* possible stale inode */ #define NFS_INO_ADVISE_RDPLUS 0x0002 /* advise readdirplus */ #define NFS_INO_REVALIDATING 0x0004 /* revalidating attrs */ #define NFS_IS_SNAPSHOT 0x0010 /* a snapshot file */ diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index f6c35dc01..2f37a4b19 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h @@ -26,7 +26,7 @@ struct nfs_page { wb_list, /* Defines state of page: */ *wb_list_head; /* read/write/commit */ struct file *wb_file; - struct dentry *wb_dentry; + struct inode *wb_inode; struct rpc_cred *wb_cred; struct page *wb_page; /* page to read in/write out */ wait_queue_head_t wb_wait; /* wait queue */ @@ -41,6 +41,7 @@ struct nfs_page { #define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) extern struct nfs_page *nfs_create_request(struct file *file, + struct inode *inode, struct page *page, unsigned int offset, unsigned int count); diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 9863c06af..1ee4dd616 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -316,39 +316,41 @@ struct nfs_rpc_ops { int (*getroot) (struct nfs_server *, struct nfs_fh *, struct nfs_fattr *); - int (*getattr) (struct dentry *, struct nfs_fattr *); - int (*setattr) (struct dentry *, struct nfs_fattr *, + int (*getattr) (struct inode *, struct nfs_fattr *); + int (*setattr) (struct inode *, struct nfs_fattr *, struct iattr *); - int (*lookup) (struct dentry *, struct qstr *, + int (*lookup) (struct inode *, struct qstr *, struct nfs_fh *, struct nfs_fattr *); - int (*access) (struct dentry *, int , int); - int (*readlink)(struct dentry *, void *, unsigned int); - int (*read) (struct file *, struct nfs_fattr *, + int (*access) (struct inode *, int , int); + int (*readlink)(struct inode *, void *, unsigned int); + int (*read) (struct inode *, struct rpc_cred *, + struct nfs_fattr *, int, loff_t, unsigned int, void *buffer, int *eofp); - int (*write) (struct file *, struct nfs_fattr *, + int (*write) (struct inode *, struct rpc_cred *, + struct nfs_fattr *, int, loff_t, unsigned int, void *buffer, struct nfs_writeverf *verfp); - int (*commit) (struct dentry *, struct nfs_fattr *, + int (*commit) (struct inode *, struct nfs_fattr *, unsigned long, unsigned int); - int (*create) (struct dentry *, struct qstr *, struct iattr *, + int (*create) (struct inode *, struct qstr *, struct iattr *, int, struct nfs_fh *, struct nfs_fattr *); - int (*remove) (struct dentry *, struct qstr *); + int (*remove) (struct inode *, struct qstr *); int (*unlink_setup) (struct rpc_message *, struct dentry *, struct qstr *); void (*unlink_done) (struct dentry *, struct rpc_message *); - int (*rename) (struct dentry *, struct qstr *, - struct dentry *, struct qstr *); - int (*link) (struct dentry *, struct dentry *, struct qstr *); - int (*symlink) (struct dentry *, struct qstr *, struct qstr *, + int (*rename) (struct inode *, struct qstr *, + struct inode *, struct qstr *); + int (*link) (struct inode *, struct inode *, struct qstr *); + int (*symlink) (struct inode *, struct qstr *, struct qstr *, struct iattr *, struct nfs_fh *, struct nfs_fattr *); - int (*mkdir) (struct dentry *, struct qstr *, struct iattr *, + int (*mkdir) (struct inode *, struct qstr *, struct iattr *, struct nfs_fh *, struct nfs_fattr *); - int (*rmdir) (struct dentry *, struct qstr *); - int (*readdir) (struct file *, u64 cookie, void *, unsigned int, - int); - int (*mknod) (struct dentry *, struct qstr *, struct iattr *, + int (*rmdir) (struct inode *, struct qstr *); + int (*readdir) (struct inode *, struct rpc_cred *, + u64, void *, unsigned int, int); + int (*mknod) (struct inode *, struct qstr *, struct iattr *, dev_t, struct nfs_fh *, struct nfs_fattr *); int (*statfs) (struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); diff --git a/include/linux/pci.h b/include/linux/pci.h index 0c2dc46ae..d98a3a01a 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -530,12 +530,13 @@ void pci_set_master(struct pci_dev *dev); int pci_set_power_state(struct pci_dev *dev, int state); int pci_assign_resource(struct pci_dev *dev, int i); -/* Helper functions for low-level code (drivers/pci/setup.c) */ +/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ int pci_claim_resource(struct pci_dev *, int); void pci_assign_unassigned_resources(void); -void pdev_assign_unassigned_resources(struct pci_dev *dev); -void pci_set_bus_ranges(void); +void pdev_enable_device(struct pci_dev *); +void pdev_sort_resources(struct pci_dev *, struct resource_list *, u32); +unsigned long pci_bridge_check_io(struct pci_dev *); void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), int (*)(struct pci_dev *, u8, u8)); diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 7a89c6525..60aef94ee 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -119,6 +119,15 @@ /* Vendors and devices. Sort key: vendor first, device next. */ +#define PCI_VENDOR_ID_DYNALINK 0x0675 +#define PCI_DEVICE_ID_DYNALINK_IS64PH 0x1702 + +#define PCI_VENDOR_ID_BERKOM 0x0871 +#define PCI_DEVICE_ID_BERKOM_A1T 0xffa1 +#define PCI_DEVICE_ID_BERKOM_T_CONCEPT 0xffa2 +#define PCI_DEVICE_ID_BERKOM_A4T 0xffa4 +#define PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO 0xffa8 + #define PCI_VENDOR_ID_COMPAQ 0x0e11 #define PCI_DEVICE_ID_COMPAQ_TOKENRING 0x0508 #define PCI_DEVICE_ID_COMPAQ_1280 0x3033 @@ -191,8 +200,8 @@ #define PCI_VENDOR_ID_NS 0x100b #define PCI_DEVICE_ID_NS_87415 0x0002 -#define PCI_DEVICE_ID_NS_87560_LIO 0x000e -#define PCI_DEVICE_ID_NS_87560_USB 0x0012 +#define PCI_DEVICE_ID_NS_87560_LIO 0x000e +#define PCI_DEVICE_ID_NS_87560_USB 0x0012 #define PCI_DEVICE_ID_NS_87410 0xd001 #define PCI_VENDOR_ID_TSENG 0x100c @@ -254,9 +263,17 @@ #define PCI_DEVICE_ID_IBM_405GP 0x0156 #define PCI_DEVICE_ID_IBM_MPIC_2 0xffff +#define PCI_VENDOR_ID_COMPEX2 0x101a // pci.ids says "AT&T GIS (NCR)" +#define PCI_DEVICE_ID_COMPEX2_100VG 0x0005 + #define PCI_VENDOR_ID_WD 0x101c #define PCI_DEVICE_ID_WD_7197 0x3296 +#define PCI_VENDOR_ID_AMI 0x101e +#define PCI_DEVICE_ID_AMI_MEGARAID3 0x1960 +#define PCI_DEVICE_ID_AMI_MEGARAID 0x9010 +#define PCI_DEVICE_ID_AMI_MEGARAID2 0x9060 + #define PCI_VENDOR_ID_AMD 0x1022 #define PCI_DEVICE_ID_AMD_LANCE 0x2000 #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 @@ -272,6 +289,8 @@ #define PCI_DEVICE_ID_AMD_VIPER_740C 0x740C #define PCI_VENDOR_ID_TRIDENT 0x1023 +#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 +#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001 #define PCI_DEVICE_ID_TRIDENT_9320 0x9320 #define PCI_DEVICE_ID_TRIDENT_9388 0x9388 #define PCI_DEVICE_ID_TRIDENT_9397 0x9397 @@ -298,10 +317,10 @@ #define PCI_DEVICE_ID_MATROX_MIL_2 0x051b #define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f #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_DEVICE_ID_MATROX_G200_PCI 0x0520 -#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521 +#define PCI_DEVICE_ID_MATROX_G100_MM 0x1000 +#define PCI_DEVICE_ID_MATROX_G100_AGP 0x1001 +#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520 +#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521 #define PCI_DEVICE_ID_MATROX_G400 0x0525 #define PCI_DEVICE_ID_MATROX_VIA 0x4536 @@ -366,8 +385,11 @@ #define PCI_DEVICE_ID_PCTECH_SAMURAI_1 0x3010 #define PCI_DEVICE_ID_PCTECH_SAMURAI_IDE 0x3020 -#define PCI_VENDOR_ID_DPT 0x1044 -#define PCI_DEVICE_ID_DPT 0xa400 +#define PCI_VENDOR_ID_ASUSTEK 0x1043 +#define PCI_DEVICE_ID_ASUSTEK_0675 0x0675 + +#define PCI_VENDOR_ID_DPT 0x1044 +#define PCI_DEVICE_ID_DPT 0xa400 #define PCI_VENDOR_ID_OPTI 0x1045 #define PCI_DEVICE_ID_OPTI_92C178 0xc178 @@ -381,6 +403,10 @@ #define PCI_DEVICE_ID_OPTI_82C861 0xc861 #define PCI_DEVICE_ID_OPTI_82C825 0xd568 +#define PCI_VENDOR_ID_ELSA 0x1048 +#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000 +#define PCI_DEVICE_ID_ELSA_QS3000 0x3000 + #define PCI_VENDOR_ID_SGS 0x104a #define PCI_DEVICE_ID_SGS_2000 0x0008 #define PCI_DEVICE_ID_SGS_1764 0x0009 @@ -407,6 +433,8 @@ #define PCI_DEVICE_ID_TI_1251B 0xac1f #define PCI_DEVICE_ID_TI_1420 0xac51 +#define PCI_VENDOR_ID_SONY 0x104d +#define PCI_DEVICE_ID_SONY_CXD3222 0x8039 #define PCI_VENDOR_ID_OAK 0x104e #define PCI_DEVICE_ID_OAK_OTI107 0x0107 @@ -415,7 +443,11 @@ #define PCI_VENDOR_ID_WINBOND2 0x1050 #define PCI_DEVICE_ID_WINBOND2_89C940 0x0940 #define PCI_DEVICE_ID_WINBOND2_89C940F 0x5a5a +#define PCI_DEVICE_ID_WINBOND2_6692 0x6692 +#define PCI_VENDOR_ID_ANIGMA 0x1051 +#define PCI_DEVICE_ID_ANIGMA_MC145575 0x0100 + #define PCI_VENDOR_ID_EFAR 0x1055 #define PCI_DEVICE_ID_EFAR_SLC90E66_1 0x9130 #define PCI_DEVICE_ID_EFAR_SLC90E66_0 0x9460 @@ -504,9 +536,10 @@ #define PCI_VENDOR_ID_LEADTEK 0x107d #define PCI_DEVICE_ID_LEADTEK_805 0x0000 -#define PCI_VENDOR_ID_INTERPHASE 0x107e +#define PCI_VENDOR_ID_INTERPHASE 0x107e #define PCI_DEVICE_ID_INTERPHASE_5526 0x0004 #define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005 +#define PCI_DEVICE_ID_INTERPHASE_5575 0x0008 #define PCI_VENDOR_ID_CONTAQ 0x1080 #define PCI_DEVICE_ID_CONTAQ_82C599 0x0600 @@ -545,8 +578,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_878_1 0x036e +#define PCI_DEVICE_ID_BROOKTREE_878 0x0878 #define PCI_DEVICE_ID_BROOKTREE_8474 0x8474 #define PCI_VENDOR_ID_SIERRA 0x10a8 @@ -567,10 +600,13 @@ #define PCI_DEVICE_ID_DATABOOK_87144 0xb106 #define PCI_VENDOR_ID_PLX 0x10b5 -#define PCI_VENDOR_ID_PLX_ROMULUS 0x106a +#define PCI_DEVICE_ID_PLX_R685 0x1030 +#define PCI_DEVICE_ID_PLX_ROMULUS 0x106a #define PCI_DEVICE_ID_PLX_SPCOM800 0x1076 #define PCI_DEVICE_ID_PLX_1077 0x1077 #define PCI_DEVICE_ID_PLX_SPCOM200 0x1103 +#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151 +#define PCI_DEVICE_ID_PLX_R753 0x1152 #define PCI_DEVICE_ID_PLX_9050 0x9050 #define PCI_DEVICE_ID_PLX_9060 0x9060 #define PCI_DEVICE_ID_PLX_9060ES 0x906E @@ -618,6 +654,7 @@ #define PCI_DEVICE_ID_AL_M5229 0x5229 #define PCI_DEVICE_ID_AL_M5237 0x5237 #define PCI_DEVICE_ID_AL_M5243 0x5243 +#define PCI_DEVICE_ID_AL_M5451 0x5451 #define PCI_DEVICE_ID_AL_M7101 0x7101 #define PCI_VENDOR_ID_MITSUBISHI 0x10ba @@ -625,7 +662,7 @@ #define PCI_VENDOR_ID_SURECOM 0x10bd #define PCI_DEVICE_ID_SURECOM_NE34 0x0e34 -#define PCI_VENDOR_ID_NEOMAGIC 0x10c8 +#define PCI_VENDOR_ID_NEOMAGIC 0x10c8 #define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2070 0x0001 #define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128V 0x0002 #define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZV 0x0003 @@ -693,6 +730,12 @@ #define PCI_DEVICE_ID_INIT_320P 0x9100 #define PCI_DEVICE_ID_INIT_360P 0x9500 +#define PCI_VENDOR_ID_CREATIVE 0x1102 // duplicate: ECTIVA +#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002 + +#define PCI_VENDOR_ID_ECTIVA 0x1102 // duplicate: CREATIVE +#define PCI_DEVICE_ID_ECTIVA_EV1938 0x8938 + #define PCI_VENDOR_ID_TTI 0x1103 #define PCI_DEVICE_ID_TTI_HPT343 0x0003 #define PCI_DEVICE_ID_TTI_HPT366 0x0004 @@ -747,8 +790,8 @@ #define PCI_DEVICE_ID_VIA_8633_1 0xB091 #define PCI_DEVICE_ID_VIA_8367_1 0xB099 -#define PCI_VENDOR_ID_SMC2 0x1113 -#define PCI_DEVICE_ID_SMC2_1211TX 0x1211 +#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 @@ -788,6 +831,9 @@ #define PCI_DEVICE_ID_EF_ATM_FPGA 0x0000 #define PCI_DEVICE_ID_EF_ATM_ASIC 0x0002 +#define PCI_VENDOR_ID_IDT 0x111d +#define PCI_DEVICE_ID_IDT_IDT77201 0x0001 + #define PCI_VENDOR_ID_FORE 0x1127 #define PCI_DEVICE_ID_FORE_PCA200PC 0x0210 #define PCI_DEVICE_ID_FORE_PCA200E 0x0300 @@ -800,6 +846,17 @@ #define PCI_DEVICE_ID_PHILIPS_SAA7146 0x7146 #define PCI_DEVICE_ID_PHILIPS_SAA9730 0x9730 +#define PCI_VENDOR_ID_EICON 0x1133 +#define PCI_DEVICE_ID_EICON_DIVA20PRO 0xe001 +#define PCI_DEVICE_ID_EICON_DIVA20 0xe002 +#define PCI_DEVICE_ID_EICON_DIVA20PRO_U 0xe003 +#define PCI_DEVICE_ID_EICON_DIVA20_U 0xe004 +#define PCI_DEVICE_ID_EICON_DIVA201 0xe005 +#define PCI_DEVICE_ID_EICON_MAESTRA 0xe010 +#define PCI_DEVICE_ID_EICON_MAESTRAQ 0xe012 +#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013 +#define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014 + #define PCI_VENDOR_ID_CYCLONE 0x113c #define PCI_DEVICE_ID_CYCLONE_SDK 0x0001 @@ -826,6 +883,10 @@ #define PCI_DEVICE_ID_DIGI_XRJ 0x0009 #define PCI_DEVICE_ID_DIGI_EPCJ 0x000a #define PCI_DEVICE_ID_DIGI_XR_920 0x0027 +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070 +#define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071 +#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072 +#define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073 #define PCI_VENDOR_ID_MUTECH 0x1159 #define PCI_DEVICE_ID_MUTECH_MV1000 0x0001 @@ -839,8 +900,8 @@ #define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 #define PCI_DEVICE_ID_SERVERWORKS_CIOB30 0x0010 #define PCI_DEVICE_ID_SERVERWORKS_CMIC_HE 0x0011 -#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 -#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 +#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 +#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 #define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211 #define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 @@ -866,6 +927,13 @@ #define PCI_DEVICE_ID_ARTOP_ATP850UF 0x0005 #define PCI_DEVICE_ID_ARTOP_ATP860 0x0006 #define PCI_DEVICE_ID_ARTOP_ATP860R 0x0007 +#define PCI_DEVICE_ID_ARTOP_AEC7610 0x8002 +#define PCI_DEVICE_ID_ARTOP_AEC7612UW 0x8010 +#define PCI_DEVICE_ID_ARTOP_AEC7612U 0x8020 +#define PCI_DEVICE_ID_ARTOP_AEC7612S 0x8030 +#define PCI_DEVICE_ID_ARTOP_AEC7612D 0x8040 +#define PCI_DEVICE_ID_ARTOP_AEC7612SUW 0x8050 +#define PCI_DEVICE_ID_ARTOP_8060 0x8060 #define PCI_VENDOR_ID_ZEITNET 0x1193 #define PCI_DEVICE_ID_ZEITNET_1221 0x0001 @@ -920,16 +988,16 @@ #define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 #define PCI_DEVICE_ID_COMPEX_RL2000 0x1401 -#define PCI_VENDOR_ID_RP 0x11fe -#define PCI_DEVICE_ID_RP32INTF 0x0001 -#define PCI_DEVICE_ID_RP8INTF 0x0002 -#define PCI_DEVICE_ID_RP16INTF 0x0003 -#define PCI_DEVICE_ID_RP4QUAD 0x0004 -#define PCI_DEVICE_ID_RP8OCTA 0x0005 -#define PCI_DEVICE_ID_RP8J 0x0006 -#define PCI_DEVICE_ID_RPP4 0x000A -#define PCI_DEVICE_ID_RPP8 0x000B -#define PCI_DEVICE_ID_RP8M 0x000C +#define PCI_VENDOR_ID_RP 0x11fe +#define PCI_DEVICE_ID_RP32INTF 0x0001 +#define PCI_DEVICE_ID_RP8INTF 0x0002 +#define PCI_DEVICE_ID_RP16INTF 0x0003 +#define PCI_DEVICE_ID_RP4QUAD 0x0004 +#define PCI_DEVICE_ID_RP8OCTA 0x0005 +#define PCI_DEVICE_ID_RP8J 0x0006 +#define PCI_DEVICE_ID_RPP4 0x000A +#define PCI_DEVICE_ID_RPP8 0x000B +#define PCI_DEVICE_ID_RP8M 0x000C #define PCI_VENDOR_ID_CYCLADES 0x120e #define PCI_DEVICE_ID_CYCLOM_Y_Lo 0x0100 @@ -957,7 +1025,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_DEVICE_ID_3DFX_BANSHEE 0x0003 #define PCI_DEVICE_ID_3DFX_VOODOO3 0x0005 #define PCI_VENDOR_ID_SIGMADES 0x1236 @@ -966,7 +1034,10 @@ #define PCI_VENDOR_ID_CCUBE 0x123f #define PCI_VENDOR_ID_AVM 0x1244 +#define PCI_DEVICE_ID_AVM_B1 0x0700 +#define PCI_DEVICE_ID_AVM_C4 0x0800 #define PCI_DEVICE_ID_AVM_A1 0x0a00 +#define PCI_DEVICE_ID_AVM_T1 0x1200 #define PCI_VENDOR_ID_DIPIX 0x1246 @@ -983,9 +1054,12 @@ #define PCI_DEVICE_ID_OPTIBASE_VQUEST 0x2130 #define PCI_VENDOR_ID_ESS 0x125d +#define PCI_DEVICE_ID_ESS_ESS1968 0x1968 #define PCI_DEVICE_ID_ESS_AUDIOPCI 0x1969 +#define PCI_DEVICE_ID_ESS_ESS1978 0x1978 #define PCI_VENDOR_ID_SATSAGEM 0x1267 +#define PCI_DEVICE_ID_SATSAGEM_NICCY 0x1016 #define PCI_DEVICE_ID_SATSAGEM_PCR2101 0x5352 #define PCI_DEVICE_ID_SATSAGEM_TELSATTURBO 0x5a4b @@ -994,10 +1068,14 @@ #define PCI_VENDOR_ID_ENSONIQ 0x1274 #define PCI_DEVICE_ID_ENSONIQ_AUDIOPCI 0x5000 -#define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371 +#define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371 #define PCI_VENDOR_ID_ROCKWELL 0x127A +/* formerly Platform Tech */ +#define PCI_VENDOR_ID_ESS_OLD 0x1285 +#define PCI_DEVICE_ID_ESS_ESS0100 0x0100 + #define PCI_VENDOR_ID_ALTEON 0x12ae #define PCI_DEVICE_ID_ALTEON_ACENIC 0x0001 @@ -1031,6 +1109,10 @@ #define PCI_SUBDEVICE_ID_CHASE_PCIRAS4 0xF001 #define PCI_SUBDEVICE_ID_CHASE_PCIRAS8 0xF010 +#define PCI_VENDOR_ID_AUREAL 0x12eb +#define PCI_DEVICE_ID_AUREAL_VORTEX_1 0x0001 +#define PCI_DEVICE_ID_AUREAL_VORTEX_2 0x0002 + #define PCI_VENDOR_ID_CBOARDS 0x1307 #define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001 @@ -1073,6 +1155,9 @@ #define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061 #define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062 +#define PCI_VENDOR_ID_DOMEX 0x134a +#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001 + #define PCI_VENDOR_ID_QUATECH 0x135C #define PCI_DEVICE_ID_QUATECH_QSC100 0x0010 #define PCI_DEVICE_ID_QUATECH_DSC100 0x0020 @@ -1089,12 +1174,56 @@ #define PCI_DEVICE_ID_SEALEVEL_COMM4 0x7401 #define PCI_DEVICE_ID_SEALEVEL_COMM8 0x7801 +#define PCI_VENDOR_ID_HYPERCOPE 0x1365 +#define PCI_DEVICE_ID_HYPERCOPE_PLX 0x9050 +#define PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO 0x0104 +#define PCI_SUBDEVICE_ID_HYPERCOPE_ERGO 0x0106 +#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107 +#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108 +#define PCI_SUBDEVICE_ID_HYPERCOPE_PLEXUS 0x0109 + +#define PCI_VENDOR_ID_LMC 0x1376 +#define PCI_DEVICE_ID_LMC_HSSI 0x0003 +#define PCI_DEVICE_ID_LMC_DS3 0x0004 +#define PCI_DEVICE_ID_LMC_SSI 0x0005 +#define PCI_DEVICE_ID_LMC_T1 0x0006 + #define PCI_VENDOR_ID_NETGEAR 0x1385 #define PCI_DEVICE_ID_NETGEAR_GA620 0x620a +#define PCI_VENDOR_ID_APPLICOM 0x1389 +#define PCI_DEVICE_ID_APPLICOM_PCIGENERIC 0x0001 +#define PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN 0x0002 +#define PCI_DEVICE_ID_APPLICOM_PCI2000PFB 0x0003 + +#define PCI_VENDOR_ID_MOXA 0x1393 +#define PCI_DEVICE_ID_MOXA_C104 0x1040 +#define PCI_DEVICE_ID_MOXA_C168 0x1680 +#define PCI_DEVICE_ID_MOXA_CP204J 0x2040 +#define PCI_DEVICE_ID_MOXA_C218 0x2180 +#define PCI_DEVICE_ID_MOXA_C320 0x3200 + +#define PCI_VENDOR_ID_CCD 0x1397 +#define PCI_DEVICE_ID_CCD_2BD0 0x2bd0 +#define PCI_DEVICE_ID_CCD_B000 0xb000 +#define PCI_DEVICE_ID_CCD_B006 0xb006 +#define PCI_DEVICE_ID_CCD_B007 0xb007 +#define PCI_DEVICE_ID_CCD_B008 0xb008 +#define PCI_DEVICE_ID_CCD_B009 0xb009 +#define PCI_DEVICE_ID_CCD_B00A 0xb00a +#define PCI_DEVICE_ID_CCD_B00B 0xb00b +#define PCI_DEVICE_ID_CCD_B00C 0xb00c +#define PCI_DEVICE_ID_CCD_B100 0xb100 + #define PCI_VENDOR_ID_3WARE 0x13C1 #define PCI_DEVICE_ID_3WARE_1000 0x1000 +#define PCI_VENDOR_ID_CMEDIA 0x13f6 +#define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100 +#define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101 +#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111 +#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112 + #define PCI_VENDOR_ID_LAVA 0x1407 #define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */ #define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */ @@ -1112,11 +1241,16 @@ #define PCI_VENDOR_ID_TIMEDIA 0x1409 #define PCI_DEVICE_ID_TIMEDIA_1889 0x7168 -#define PCI_VENDOR_ID_OXSEMI 0x1415 -#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 +#define PCI_VENDOR_ID_OXSEMI 0x1415 +#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 #define PCI_DEVICE_ID_OXSEMI_16PCI952 0x950A #define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511 +#define PCI_VENDOR_ID_AIRONET 0x14b9 +#define PCI_DEVICE_ID_AIRONET_4800_1 0x0001 +#define PCI_DEVICE_ID_AIRONET_4800 0x4500 // values switched? see +#define PCI_DEVICE_ID_AIRONET_4500 0x4800 // drivers/net/aironet4500_card.c + #define PCI_VENDOR_ID_TITAN 0x14D2 #define PCI_DEVICE_ID_TITAN_100 0xA001 #define PCI_DEVICE_ID_TITAN_200 0xA005 @@ -1137,6 +1271,9 @@ #define PCI_VENDOR_ID_MORETON 0x15aa #define PCI_DEVICE_ID_RASTEL_2PORT 0x2000 +#define PCI_VENDOR_ID_ZOLTRIX 0x15b0 +#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0 + #define PCI_VENDOR_ID_SYMPHONY 0x1c1c #define PCI_DEVICE_ID_SYMPHONY_101 0x0001 @@ -1212,6 +1349,7 @@ #define PCI_DEVICE_ID_INTEL_82441 0x1237 #define PCI_DEVICE_ID_INTEL_82380FB 0x124b #define PCI_DEVICE_ID_INTEL_82439 0x1250 +#define PCI_DEVICE_ID_INTEL_80960_RP 0x1960 #define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 #define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 #define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 @@ -1330,6 +1468,7 @@ #define PCI_VENDOR_ID_TIGERJET 0xe159 #define PCI_DEVICE_ID_TIGERJET_300 0x0001 +#define PCI_DEVICE_ID_TIGERJET_100 0x0002 #define PCI_VENDOR_ID_ARK 0xedd8 #define PCI_DEVICE_ID_ARK_STING 0xa091 diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index 41d729e16..8c260c63d 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h @@ -59,7 +59,6 @@ typedef struct mdk_rdev_s mdk_rdev_t; #error MD doesnt handle bigger kdev yet #endif -#define MAX_REAL 12 /* Max number of disks per md dev */ #define MAX_MD_DEVS (1<sig[1], 0, sizeof(long)*(_NSIG_WORDS-1)); break; case 2: set->sig[1] = 0; - case 1: + case 1: ; } } @@ -205,7 +205,7 @@ static inline void siginitsetinv(sigset_t *set, unsigned long mask) memset(&set->sig[1], -1, sizeof(long)*(_NSIG_WORDS-1)); break; case 2: set->sig[1] = -1; - case 1: + case 1: ; } } diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index c67f8c85a..17e48d0e9 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -65,8 +65,7 @@ struct sk_buff { struct sk_buff_head * list; /* List we are on */ struct sock *sk; /* Socket we are owned by */ struct timeval stamp; /* Time we arrived */ - struct net_device *dev; /* Device we arrived on/are leaving by */ - struct net_device *rx_dev; + struct net_device *dev; /* Device we arrived on/are leaving by */ /* Transport layer header */ union @@ -110,8 +109,7 @@ struct sk_buff { unsigned int len; /* Length of actual data */ unsigned int csum; /* Checksum */ volatile char used; /* Data moved to user and not MSG_PEEK */ - unsigned char is_clone, /* We are a clone */ - cloned, /* head may be cloned (check refcnt to be sure). */ + unsigned char cloned, /* head may be cloned (check refcnt to be sure). */ pkt_type, /* Packet class */ ip_summed; /* Driver fed us an IP checksum */ __u32 priority; /* Packet queueing priority */ diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h index e475057fc..501ea4b96 100644 --- a/include/linux/smb_fs.h +++ b/include/linux/smb_fs.h @@ -126,8 +126,8 @@ int smb_errno(struct smb_sb_info *); int smb_close(struct inode *); int smb_close_fileid(struct dentry *, __u16); int smb_open(struct dentry *, int); -int smb_proc_read(struct dentry *, off_t, int, char *); -int smb_proc_write(struct dentry *, off_t, int, const char *); +int smb_proc_read(struct inode *, off_t, int, char *); +int smb_proc_write(struct inode *, off_t, int, const char *); int smb_proc_create(struct dentry *, __u16, time_t, __u16 *); int smb_proc_mv(struct dentry *, struct dentry *); int smb_proc_mkdir(struct dentry *); diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h index 4bad7e928..0d14b83ae 100644 --- a/include/linux/smb_fs_sb.h +++ b/include/linux/smb_fs_sb.h @@ -14,8 +14,9 @@ #include #include -/* Get the server for the specified dentry */ -#define server_from_dentry(dentry) &dentry->d_sb->u.smbfs_sb +/* structure access macros */ +#define server_from_inode(inode) (&(inode)->i_sb->u.smbfs_sb) +#define server_from_dentry(dentry) (&(dentry)->d_sb->u.smbfs_sb) #define SB_of(server) ((struct super_block *) ((char *)(server) - \ (unsigned long)(&((struct super_block *)0)->u.smbfs_sb))) diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 8ba581f5b..8bb2d1c5d 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -65,7 +65,7 @@ #elif (DEBUG_SPINLOCKS < 2) typedef struct { - volatile unsigned int lock; + volatile unsigned long lock; } spinlock_t; #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } @@ -80,7 +80,7 @@ typedef struct { #else /* (DEBUG_SPINLOCKS >= 2) */ typedef struct { - volatile unsigned int lock; + volatile unsigned long lock; volatile unsigned int babble; const char *module; } spinlock_t; diff --git a/include/linux/stallion.h b/include/linux/stallion.h index a4f6e2278..072f89508 100644 --- a/include/linux/stallion.h +++ b/include/linux/stallion.h @@ -75,7 +75,7 @@ typedef struct stlport { int ioaddr; int uartaddr; int pagenr; - int istate; + long istate; int flags; int baud_base; int custom_divisor; diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index f3e9ad2be..c6e6e40e0 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h @@ -43,7 +43,7 @@ struct rpc_task { struct rpc_task * tk_prev_task; /* global list of tasks */ struct rpc_clnt * tk_client; /* RPC client */ struct rpc_rqst * tk_rqstp; /* RPC request */ - volatile int tk_status; /* result of last operation */ + int tk_status; /* result of last operation */ struct rpc_wait_queue * tk_rpcwait; /* RPC wait queue we're on */ /* diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index dd27162ff..b204387c5 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -138,8 +138,7 @@ struct rpc_xprt { struct rpc_wait_queue reconn; /* waiting for reconnect */ struct rpc_rqst * free; /* free slots */ struct rpc_rqst slot[RPC_MAXREQS]; - volatile unsigned char connected : 1, /* TCP: connected */ - write_space: 1; /* TCP: can send */ + unsigned int sockstate; /* Socket state */ unsigned char shutdown : 1, /* being shut down */ nocong : 1, /* no congestion control */ stream : 1, /* TCP */ @@ -190,6 +189,18 @@ void __rpciod_tcp_dispatcher(void); extern struct list_head rpc_xprt_pending; +#define XPRT_WSPACE 0 +#define XPRT_CONNECT 1 + +#define xprt_wspace(xp) (test_bit(XPRT_WSPACE, &(xp)->sockstate)) +#define xprt_test_and_set_wspace(xp) (test_and_set_bit(XPRT_WSPACE, &(xp)->sockstate)) +#define xprt_clear_wspace(xp) (clear_bit(XPRT_WSPACE, &(xp)->sockstate)) + +#define xprt_connected(xp) (!(xp)->stream || test_bit(XPRT_CONNECT, &(xp)->sockstate)) +#define xprt_set_connected(xp) (set_bit(XPRT_CONNECT, &(xp)->sockstate)) +#define xprt_test_and_set_connected(xp) (test_and_set_bit(XPRT_CONNECT, &(xp)->sockstate)) +#define xprt_clear_connected(xp) (clear_bit(XPRT_CONNECT, &(xp)->sockstate)) + static inline int xprt_tcp_pending(void) { diff --git a/include/linux/swap.h b/include/linux/swap.h index 87364f298..1390490f9 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -82,8 +82,6 @@ struct vm_area_struct; struct sysinfo; struct zone_t; -/* linux/ipc/shm.c */ -extern int shm_swap(int, int); /* linux/mm/swap.c */ extern int memory_pressure; diff --git a/include/linux/tqueue.h b/include/linux/tqueue.h index 3eb8f14ae..a0363ffa6 100644 --- a/include/linux/tqueue.h +++ b/include/linux/tqueue.h @@ -14,6 +14,7 @@ #define _LINUX_TQUEUE_H #include +#include #include #include @@ -29,37 +30,33 @@ * used as a bottom half handler. This is for example useful for bottom * halfs, which want to be delayed until the next clock tick. * - * Problems: - * - The queue_task_irq() inline function is only atomic with respect to itself. - * Problems can occur, when queue_task_irq() is called from a normal system - * call, and an interrupt comes in. No problems occur, when queue_task_irq() - * is called from an interrupt or bottom half, and interrupted, as run_task_queue() - * will not be executed/continued before the last interrupt returns. If in - * doubt, use queue_task(), not queue_task_irq(). + * Notes: * - Bottom halfs are called in the reverse order that they were linked into * the list. */ struct tq_struct { - struct tq_struct *next; /* linked list of active bh's */ + struct list_head list; /* linked list of active bh's */ unsigned long sync; /* must be initialized to zero */ void (*routine)(void *); /* function to call */ void *data; /* argument to function */ }; -typedef struct tq_struct * task_queue; +typedef struct list_head task_queue; -#define DECLARE_TASK_QUEUE(q) task_queue q = NULL +#define DECLARE_TASK_QUEUE(q) LIST_HEAD(q) +#define TQ_ACTIVE(q) (!list_empty(&q)) -extern task_queue tq_timer, tq_immediate, tq_scheduler, tq_disk; +extern task_queue tq_timer, tq_immediate, tq_disk; /* * To implement your own list of active bottom halfs, use the following * two definitions: * - * struct tq_struct *my_bh = NULL; + * DECLARE_TASK_QUEUE(my_bh); * struct tq_struct run_my_bh = { - * 0, 0, (void (*)(void *)) run_task_queue, &my_bh + * routine: (void (*)(void *)) run_task_queue, + * data: &my_bh * }; * * To activate a bottom half on your list, use: @@ -78,18 +75,21 @@ extern task_queue tq_timer, tq_immediate, tq_scheduler, tq_disk; extern spinlock_t tqueue_lock; /* - * queue_task + * Queue a task on a tq. Return non-zero if it was successfully + * added. */ -static inline void queue_task(struct tq_struct *bh_pointer, +static inline int queue_task(struct tq_struct *bh_pointer, task_queue *bh_list) { + int ret = 0; if (!test_and_set_bit(0,&bh_pointer->sync)) { unsigned long flags; spin_lock_irqsave(&tqueue_lock, flags); - bh_pointer->next = *bh_list; - *bh_list = bh_pointer; + list_add_tail(&bh_pointer->list, bh_list); spin_unlock_irqrestore(&tqueue_lock, flags); + ret = 1; } + return ret; } /* @@ -97,28 +97,29 @@ static inline void queue_task(struct tq_struct *bh_pointer, */ static inline void run_task_queue(task_queue *list) { - if (*list) { + while (!list_empty(list)) { unsigned long flags; - struct tq_struct *p; + struct list_head *next; spin_lock_irqsave(&tqueue_lock, flags); - p = *list; - *list = NULL; - spin_unlock_irqrestore(&tqueue_lock, flags); - - while (p) { + next = list->next; + if (next != list) { void *arg; void (*f) (void *); - struct tq_struct *save_p; - arg = p -> data; - f = p -> routine; - save_p = p; - p = p -> next; - smp_mb(); - save_p -> sync = 0; + struct tq_struct *p; + + list_del(next); + p = list_entry(next, struct tq_struct, list); + arg = p->data; + f = p->routine; + p->sync = 0; + spin_unlock_irqrestore(&tqueue_lock, flags); + if (f) - (*f)(arg); + f(arg); + continue; } + spin_unlock_irqrestore(&tqueue_lock, flags); } } diff --git a/include/linux/tty.h b/include/linux/tty.h index bb5bebde0..642c8bd7e 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -360,7 +360,6 @@ extern int rp_init(void); extern int cy_init(void); extern int stl_init(void); extern int stli_init(void); -extern int riscom8_init(void); extern int specialix_init(void); extern int espserial_init(void); extern int macserial_init(void); diff --git a/include/linux/usb.h b/include/linux/usb.h index 2828238ac..39e9f2eed 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -412,7 +412,7 @@ typedef struct urb struct usb_device *dev; // pointer to associated USB device unsigned int pipe; // pipe information int status; // returned status - unsigned int transfer_flags; // USB_DISABLE_SPD | USB_ISO_ASAP | USB_URB_EARLY_COMPLETE + unsigned int transfer_flags; // USB_DISABLE_SPD | USB_ISO_ASAP | etc. void *transfer_buffer; // associated data buffer int transfer_buffer_length; // data buffer length int actual_length; // actual data buffer length @@ -428,7 +428,7 @@ typedef struct urb void *context; // context for completion routine usb_complete_t complete; // pointer to completion routine // - iso_packet_descriptor_t iso_frame_desc[0]; + iso_packet_descriptor_t iso_frame_desc[0]; } urb_t, *purb_t; #define FILL_CONTROL_URB(a,aa,b,c,d,e,f,g) \ @@ -545,7 +545,7 @@ struct usb_bus { struct list_head inodes; }; -#define USB_MAXCHILDREN (8) /* This is arbitrary */ +#define USB_MAXCHILDREN (16) /* This is arbitrary */ struct usb_device { int devnum; /* Device number on USB bus */ diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h index 736493d1d..415454f5f 100644 --- a/include/linux/wanrouter.h +++ b/include/linux/wanrouter.h @@ -442,7 +442,7 @@ typedef struct wan_device char api_status; /* device api status */ struct net_device_stats stats; /* interface statistics */ unsigned reserved[16]; /* reserved for future use */ - unsigned critical; /* critical section flag */ + unsigned long critical; /* critical section flag */ /****** device management methods ***/ int (*setup) (struct wan_device *wandev, wandev_conf_t *conf); int (*shutdown) (struct wan_device *wandev); diff --git a/include/net/checksum.h b/include/net/checksum.h index 76cf27e77..6a16809c9 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h @@ -124,10 +124,31 @@ static __inline__ unsigned int csum_and_copy_to_user } #endif -static inline unsigned int csum_chain(unsigned int csum, unsigned int addend) +static inline unsigned int csum_add(unsigned int csum, unsigned int addend) { csum += addend; return csum + (csum < addend); } +static inline unsigned int csum_sub(unsigned int csum, unsigned int addend) +{ + return csum_add(csum, ~addend); +} + +static inline unsigned int +csum_block_add(unsigned int csum, unsigned int csum2, int offset) +{ + if (offset&1) + csum2 = ((csum2&0xFF00FF)<<8)+((csum2>>8)&0xFF00FF); + return csum_add(csum, csum2); +} + +static inline unsigned int +csum_block_sub(unsigned int csum, unsigned int csum2, int offset) +{ + if (offset&1) + csum2 = ((csum2&0xFF00FF)<<8)+((csum2>>8)&0xFF00FF); + return csum_sub(csum, csum2); +} + #endif diff --git a/include/net/icmp.h b/include/net/icmp.h index e7ff46a05..dc4d6f524 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h @@ -24,6 +24,11 @@ #include #include +struct icmp_err { + int errno; + unsigned fatal:1; +}; + extern struct icmp_err icmp_err_convert[]; extern struct icmp_mib icmp_statistics[NR_CPUS*2]; #define ICMP_INC_STATS(field) SNMP_INC_STATS(icmp_statistics, field) diff --git a/include/net/ipx.h b/include/net/ipx.h index 84e7cdb1d..bc023a662 100644 --- a/include/net/ipx.h +++ b/include/net/ipx.h @@ -45,6 +45,7 @@ typedef struct ipx_interface { /* IPX address */ __u32 if_netnum; unsigned char if_node[IPX_NODE_LEN]; + atomic_t refcnt; /* physical device info */ struct net_device *if_dev; @@ -54,6 +55,7 @@ typedef struct ipx_interface { /* socket support */ unsigned short if_sknum; struct sock *if_sklist; + spinlock_t if_sklist_lock; /* administrative overhead */ int if_ipx_offset; diff --git a/include/net/sock.h b/include/net/sock.h index 75aae4d1b..8550282cb 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -383,7 +383,8 @@ struct tcp_opt { __u32 urg_seq; /* Seq of received urgent pointer */ __u16 urg_data; /* Saved octet of OOB data and control flags */ __u8 pending; /* Scheduled timer event */ - __u8 __empty; + __u8 urg_mode; /* In urgent mode */ + __u32 snd_up; /* Urgent pointer */ /* The syn_wait_lock is necessary only to avoid tcp_get_info having * to grab the main lock sock while browsing the listening hash @@ -402,7 +403,7 @@ struct tcp_opt { struct open_request *accept_queue; struct open_request *accept_queue_tail; - int write_pending; /* A write to socket waits to start. */ + int write_pending; /* A write to socket waits to start. */ unsigned int keepalive_time; /* time before keep alive takes place */ unsigned int keepalive_intvl; /* time interval between keep alive probes */ @@ -1168,6 +1169,7 @@ static inline int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) } #endif /* CONFIG_FILTER */ + skb->dev = NULL; skb_set_owner_r(skb, sk); skb_queue_tail(&sk->receive_queue, skb); if (!sk->dead) diff --git a/include/net/tcp.h b/include/net/tcp.h index dd8e74ca1..ccdff5aaa 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -328,9 +328,13 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk) */ #define TCP_DELACK_MAX (HZ/5) /* maximal time to delay before sending an ACK */ -#define TCP_DELACK_MIN (2) /* minimal time to delay before sending an ACK, - * 2 scheduler ticks, not depending on HZ. */ -#define TCP_ATO_MIN 2 +#if HZ >= 100 +#define TCP_DELACK_MIN (HZ/25) /* minimal time to delay before sending an ACK */ +#define TCP_ATO_MIN (HZ/25) +#else +#define TCP_DELACK_MIN 4 +#define TCP_ATO_MIN 4 +#endif #define TCP_RTO_MAX (120*HZ) #define TCP_RTO_MIN (HZ/5) #define TCP_TIMEOUT_INIT (3*HZ) /* RFC 1122 initial RTO value */ @@ -688,6 +692,10 @@ static __inline__ void tcp_delack_init(struct tcp_opt *tp) memset(&tp->ack, 0, sizeof(tp->ack)); } +static inline void tcp_clear_options(struct tcp_opt *tp) +{ + tp->tstamp_ok = tp->sack_ok = tp->wscale_ok = tp->snd_wscale = 0; +} enum tcp_tw_status { @@ -734,7 +742,8 @@ extern int tcp_recvmsg(struct sock *sk, extern int tcp_listen_start(struct sock *sk); extern void tcp_parse_options(struct sk_buff *skb, - struct tcp_opt *tp); + struct tcp_opt *tp, + int estab); /* * TCP v4 functions exported for the inet6 API @@ -997,6 +1006,9 @@ struct tcp_skb_cb { #define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ #define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) +#define TCPCB_URG 0x20 /* Urgent pointer advenced here */ + +#define TCPCB_AT_TAIL (TCPCB_URG) __u16 urg_ptr; /* Valid w/URG flags is set. */ __u32 ack_seq; /* Sequence number ACK'd */ @@ -1134,18 +1146,19 @@ static __inline__ void tcp_minshall_update(struct tcp_opt *tp, int mss, struct s /* Return 0, if packet can be sent now without violation Nagle's rules: 1. It is full sized. - 2. Or it contains FIN or URG. + 2. Or it contains FIN. 3. Or TCP_NODELAY was set. 4. Or TCP_CORK is not set, and all sent packets are ACKed. With Minshall's modification: all sent small packets are ACKed. */ -static __inline__ int tcp_nagle_check(struct tcp_opt *tp, struct sk_buff *skb, unsigned mss_now) +static __inline__ int +tcp_nagle_check(struct tcp_opt *tp, struct sk_buff *skb, unsigned mss_now, int nonagle) { return (skb->len < mss_now && - !(TCP_SKB_CB(skb)->flags & (TCPCB_FLAG_URG|TCPCB_FLAG_FIN)) && - (tp->nonagle == 2 || - (!tp->nonagle && + !(TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN) && + (nonagle == 2 || + (!nonagle && tp->packets_out && tcp_minshall_check(tp)))); } @@ -1154,7 +1167,7 @@ static __inline__ int tcp_nagle_check(struct tcp_opt *tp, struct sk_buff *skb, u * should be put on the wire right now. */ static __inline__ int tcp_snd_test(struct tcp_opt *tp, struct sk_buff *skb, - unsigned cur_mss, int tail) + unsigned cur_mss, int nonagle) { /* RFC 1122 - section 4.2.3.4 * @@ -1180,8 +1193,8 @@ static __inline__ int tcp_snd_test(struct tcp_opt *tp, struct sk_buff *skb, /* Don't be strict about the congestion window for the * final FIN frame. -DaveM */ - return ((!tail || !tcp_nagle_check(tp, skb, cur_mss) || - skb_tailroom(skb) < 32) && + return ((nonagle==1 || tp->urg_mode + || !tcp_nagle_check(tp, skb, cur_mss, nonagle)) && ((tcp_packets_in_flight(tp) < tp->snd_cwnd) || (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN)) && !after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd)); @@ -1204,12 +1217,15 @@ static __inline__ int tcp_skb_is_last(struct sock *sk, struct sk_buff *skb) */ static __inline__ void __tcp_push_pending_frames(struct sock *sk, struct tcp_opt *tp, - unsigned cur_mss) + unsigned cur_mss, + int nonagle) { struct sk_buff *skb = tp->send_head; if (skb) { - if (!tcp_snd_test(tp, skb, cur_mss, tcp_skb_is_last(sk, skb)) || + if (!tcp_skb_is_last(sk, skb)) + nonagle = 1; + if (!tcp_snd_test(tp, skb, cur_mss, nonagle) || tcp_write_xmit(sk)) tcp_check_probe_timer(sk, tp); } @@ -1219,7 +1235,7 @@ static __inline__ void __tcp_push_pending_frames(struct sock *sk, static __inline__ void tcp_push_pending_frames(struct sock *sk, struct tcp_opt *tp) { - __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk)); + __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk), tp->nonagle); } static __inline__ int tcp_may_send_now(struct sock *sk, struct tcp_opt *tp) @@ -1227,7 +1243,8 @@ static __inline__ int tcp_may_send_now(struct sock *sk, struct tcp_opt *tp) struct sk_buff *skb = tp->send_head; return (skb && - tcp_snd_test(tp, skb, tcp_current_mss(sk), tcp_skb_is_last(sk, skb))); + tcp_snd_test(tp, skb, tcp_current_mss(sk), + tcp_skb_is_last(sk, skb) ? 1 : tp->nonagle)); } static __inline__ void tcp_init_wl(struct tcp_opt *tp, u32 ack, u32 seq) diff --git a/include/video/fbcon.h b/include/video/fbcon.h index 332cabf7e..3dfb64435 100644 --- a/include/video/fbcon.h +++ b/include/video/fbcon.h @@ -290,13 +290,19 @@ static __inline__ void *fb_memclear_small(void *s, size_t count) "1: lsrl #1,%1 ; jcc 1f ; movew %2,%0@-\n\t" "1: lsrl #1,%1 ; jcc 1f ; movel %2,%0@-\n\t" "1: lsrl #1,%1 ; jcc 1f ; movel %2,%0@- ; movel %2,%0@-\n\t" - "1: subql #1,%1 ; jcs 3f\n\t" - "2: moveml %2/%3/%4/%5,%0@-\n\t" + "1:" + : "=a" (s), "=d" (count) + : "d" (0), "0" ((char *)s+count), "1" (count) + ); + __asm__ __volatile__( + "subql #1,%1 ; jcs 3f\n\t" + "movel %2,%%d4; movel %2,%%d5; movel %2,%%d6\n\t" + "2: moveml %2/%%d4/%%d5/%%d6,%0@-\n\t" "dbra %1,2b\n\t" "3:" : "=a" (s), "=d" (count) - : "d" (0), "d" (0), "d" (0), "d" (0), - "0" ((char *)s+count), "1" (count) + : "d" (0), "0" (s), "1" (count) + : "d4", "d5", "d6" ); return(0); @@ -355,13 +361,19 @@ static __inline__ void *fb_memset255(void *s, size_t count) "1: lsrl #1,%1 ; jcc 1f ; movew %2,%0@-\n\t" "1: lsrl #1,%1 ; jcc 1f ; movel %2,%0@-\n\t" "1: lsrl #1,%1 ; jcc 1f ; movel %2,%0@- ; movel %2,%0@-\n\t" - "1: subql #1,%1 ; jcs 3f\n\t" - "2: moveml %2/%3/%4/%5,%0@-\n\t" + "1:" + : "=a" (s), "=d" (count) + : "d" (-1), "0" ((char *)s+count), "1" (count) + ); + __asm__ __volatile__( + "subql #1,%1 ; jcs 3f\n\t" + "movel %2,%%d4; movel %2,%%d5; movel %2,%%d6\n\t" + "2: moveml %2/%%d4/%%d5/%%d6,%0@-\n\t" "dbra %1,2b\n\t" "3:" : "=a" (s), "=d" (count) - : "d" (-1), "d" (-1), "d" (-1), "d" (-1), - "0" ((char *) s + count), "1" (count) + : "d" (-1), "0" (s), "1" (count) + : "d4", "d5", "d6" ); return(0); -- cgit v1.2.3