]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge iSeries include file move
authorStephen Rothwell <sfr@canb.auug.org.au>
Wed, 2 Nov 2005 05:06:03 +0000 (16:06 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 2 Nov 2005 05:06:03 +0000 (16:06 +1100)
58 files changed:
arch/powerpc/Kconfig
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/ppc_ksyms.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/kernel/rtas_fw.c [moved from arch/powerpc/platforms/pseries/rtas-fw.c with 97% similarity]
arch/powerpc/kernel/setup-common.c
arch/powerpc/kernel/setup_64.c
arch/powerpc/kernel/traps.c
arch/powerpc/lib/Makefile
arch/powerpc/lib/bitops.c [moved from arch/ppc64/kernel/bitops.c with 66% similarity]
arch/powerpc/platforms/Makefile
arch/powerpc/platforms/cell/Makefile [new file with mode: 0644]
arch/powerpc/platforms/cell/interrupt.c [moved from arch/ppc64/kernel/bpa_iic.c with 97% similarity]
arch/powerpc/platforms/cell/interrupt.h [moved from arch/ppc64/kernel/bpa_iic.h with 92% similarity]
arch/powerpc/platforms/cell/iommu.c [moved from arch/ppc64/kernel/bpa_iommu.c with 89% similarity]
arch/powerpc/platforms/cell/iommu.h [moved from arch/ppc64/kernel/bpa_iommu.h with 92% similarity]
arch/powerpc/platforms/cell/setup.c [moved from arch/ppc64/kernel/bpa_setup.c with 74% similarity]
arch/powerpc/platforms/cell/smp.c [new file with mode: 0644]
arch/powerpc/platforms/cell/spider-pic.c [moved from arch/ppc64/kernel/spider-pic.c with 99% similarity]
arch/powerpc/platforms/chrp/nvram.c
arch/powerpc/platforms/iseries/setup.c
arch/powerpc/platforms/powermac/pic.c
arch/powerpc/platforms/pseries/Makefile
arch/powerpc/platforms/pseries/rtas-fw.h [deleted file]
arch/powerpc/platforms/pseries/setup.c
arch/powerpc/sysdev/Makefile
arch/powerpc/sysdev/mmio_nvram.c [moved from arch/ppc64/kernel/bpa_nvram.c with 56% similarity]
arch/ppc/Makefile
arch/ppc/kernel/bitops.c [deleted file]
arch/ppc64/Makefile
arch/ppc64/kernel/Makefile
arch/ppc64/kernel/irq.c
arch/ppc64/kernel/proc_ppc64.c
arch/ppc64/kernel/prom_init.c
arch/ppc64/lib/Makefile [deleted file]
arch/ppc64/lib/string.S [deleted file]
drivers/macintosh/via-pmu.c
include/asm-powerpc/bitops.h [new file with mode: 0644]
include/asm-powerpc/bug.h
include/asm-powerpc/futex.h [moved from include/asm-ppc64/futex.h with 71% similarity]
include/asm-powerpc/ioctls.h
include/asm-powerpc/ipcbuf.h [new file with mode: 0644]
include/asm-powerpc/irq.h
include/asm-powerpc/ppc_asm.h
include/asm-powerpc/processor.h
include/asm-powerpc/rtas.h
include/asm-powerpc/termios.h
include/asm-powerpc/uaccess.h [new file with mode: 0644]
include/asm-ppc/bitops.h [deleted file]
include/asm-ppc/futex.h [deleted file]
include/asm-ppc/ipcbuf.h [deleted file]
include/asm-ppc/uaccess.h [deleted file]
include/asm-ppc64/bitops.h [deleted file]
include/asm-ppc64/ipcbuf.h [deleted file]
include/asm-ppc64/mmu_context.h
include/asm-ppc64/nvram.h
include/asm-ppc64/smp.h
include/asm-ppc64/uaccess.h [deleted file]

index 967ecf92d6a7524add144533c3924de2a8cc6d62..1c44a1dac4213fc1ad677feab1420cc59fc99367 100644 (file)
@@ -278,6 +278,7 @@ config PPC_PSERIES
        select PPC_I8259
        select PPC_RTAS
        select RTAS_ERROR_LOGGING
+       select RTAS_FW
        default y
 
 config PPC_CHRP
@@ -319,10 +320,12 @@ config PPC_MAPLE
           This option enables support for the Maple 970FX Evaluation Board.
          For more informations, refer to <http://www.970eval.com>
 
-config PPC_BPA
-       bool "  Broadband Processor Architecture"
+config PPC_CELL
+       bool "  Cell Broadband Processor Architecture"
        depends on PPC_MULTIPLATFORM && PPC64
        select PPC_RTAS
+       select RTAS_FW
+       select MMIO_NVRAM
 
 config PPC_OF
        bool
@@ -353,13 +356,22 @@ config RTAS_ERROR_LOGGING
        depends on PPC_RTAS
        default n
 
+config RTAS_FW
+       bool
+       depends on PPC_RTAS
+       default n
+
+config MMIO_NVRAM
+       bool
+       default n
+
 config MPIC_BROKEN_U3
        bool
        depends on PPC_MAPLE
        default y
 
-config BPA_IIC
-       depends on PPC_BPA
+config CELL_IIC
+       depends on PPC_CELL
        bool
        default y
 
index 572d4f5eaacb48da8209fe169306f5b967cf3bd0..abad3059a21ad6d304f624dea0c2ae5ecaec7ee8 100644 (file)
@@ -18,6 +18,7 @@ obj-$(CONFIG_ALTIVEC)         += vecemu.o vector.o
 obj-$(CONFIG_POWER4)           += idle_power4.o
 obj-$(CONFIG_PPC_OF)           += of_device.o
 obj-$(CONFIG_PPC_RTAS)         += rtas.o
+obj-$(CONFIG_RTAS_FW)          += rtas_fw.o
 obj-$(CONFIG_IBMVIO)           += vio.o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
index 8bc540337ba086a4d4b81a65d4d3bf1ba0fd9d4a..47d6f7e2ea9faab8887beb46e69dc2e317b1b758 100644 (file)
@@ -81,15 +81,6 @@ EXPORT_SYMBOL(_prep_type);
 EXPORT_SYMBOL(ucSystemType);
 #endif
 
-#if !defined(__INLINE_BITOPS)
-EXPORT_SYMBOL(set_bit);
-EXPORT_SYMBOL(clear_bit);
-EXPORT_SYMBOL(change_bit);
-EXPORT_SYMBOL(test_and_set_bit);
-EXPORT_SYMBOL(test_and_clear_bit);
-EXPORT_SYMBOL(test_and_change_bit);
-#endif /* __INLINE_BITOPS */
-
 EXPORT_SYMBOL(strcpy);
 EXPORT_SYMBOL(strncpy);
 EXPORT_SYMBOL(strcat);
index 9750b3cd8ecdf3134a07a56079edee51e5d5e782..c758b6624d7bee6c777c5e0532c8b16553b7f52b 100644 (file)
@@ -2000,7 +2000,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
 #endif
 
        /*
-        * On pSeries and BPA, copy the CPU hold code
+        * Copy the CPU hold code
         */
                if (RELOC(of_platform) != PLATFORM_POWERMAC)
                        copy_and_flush(0, KERNELBASE + offset, 0x100, 0);
similarity index 97%
rename from arch/powerpc/platforms/pseries/rtas-fw.c
rename to arch/powerpc/kernel/rtas_fw.c
index 15d81d758ca09921932390f168f4bad701cbe334..448922e8af1bc435e01e1e8e2cb4f931571441be 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- * Procedures for firmware flash updates on pSeries systems.
+ * Procedures for firmware flash updates.
  *
  * Peter Bergner, IBM  March 2001.
  * Copyright (C) 2001 IBM.
@@ -31,8 +31,6 @@
 #include <asm/uaccess.h>
 #include <asm/systemcfg.h>
 
-#include "rtas-fw.h"
-
 struct flash_block_list_header rtas_firmware_flash_list = {0, NULL};
 
 #define FLASH_BLOCK_LIST_VERSION (1UL)
index 1292460fcde26cb70049c7da3f06c63085a1dd64..14ebe3bc48c3e7e5621601180d55e5568f4437f4 100644 (file)
@@ -201,11 +201,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 #ifdef CONFIG_TAU_AVERAGE
                /* more straightforward, but potentially misleading */
                seq_printf(m,  "temperature \t: %u C (uncalibrated)\n",
-                          cpu_temp(i));
+                          cpu_temp(cpu_id));
 #else
                /* show the actual temp sensor range */
                u32 temp;
-               temp = cpu_temp_both(i);
+               temp = cpu_temp_both(cpu_id);
                seq_printf(m, "temperature \t: %u-%u C (uncalibrated)\n",
                           temp & 0xff, temp >> 16);
 #endif
index 079867e181455930d2dacd3620111f380bc03293..d4a3c5dd1a217a9b330585fb91691c954fbe0c87 100644 (file)
@@ -296,7 +296,7 @@ static void __init setup_cpu_maps(void)
 extern struct machdep_calls pSeries_md;
 extern struct machdep_calls pmac_md;
 extern struct machdep_calls maple_md;
-extern struct machdep_calls bpa_md;
+extern struct machdep_calls cell_md;
 extern struct machdep_calls iseries_md;
 
 /* Ultimately, stuff them in an elf section like initcalls... */
@@ -310,8 +310,8 @@ static struct machdep_calls __initdata *machines[] = {
 #ifdef CONFIG_PPC_MAPLE
        &maple_md,
 #endif /* CONFIG_PPC_MAPLE */
-#ifdef CONFIG_PPC_BPA
-       &bpa_md,
+#ifdef CONFIG_PPC_CELL
+       &cell_md,
 #endif
 #ifdef CONFIG_PPC_ISERIES
        &iseries_md,
@@ -631,23 +631,6 @@ static int ppc64_panic_event(struct notifier_block *this,
        return NOTIFY_DONE;
 }
 
-#ifdef CONFIG_PPC_ISERIES
-/*
- * On iSeries we just parse the mem=X option from the command line.
- * On pSeries it's a bit more complicated, see prom_init_mem()
- */
-static int __init early_parsemem(char *p)
-{
-       if (!p)
-               return 0;
-
-       memory_limit = ALIGN(memparse(p, &p), PAGE_SIZE);
-
-       return 0;
-}
-early_param("mem", early_parsemem);
-#endif /* CONFIG_PPC_ISERIES */
-
 #ifdef CONFIG_IRQSTACKS
 static void __init irqstack_early_init(void)
 {
index 5d638ecddbd0afbfe3d5f85710d4d0ef93aa2c62..07e5ee40b8700aadc5cc82a395c7c20e088a402a 100644 (file)
@@ -147,8 +147,8 @@ int die(const char *str, struct pt_regs *regs, long err)
                printk("POWERMAC ");
                nl = 1;
                break;
-       case PLATFORM_BPA:
-               printk("BPA ");
+       case PLATFORM_CELL:
+               printk("CELL ");
                nl = 1;
                break;
        }
@@ -749,22 +749,22 @@ static int check_bug_trap(struct pt_regs *regs)
        if (bug->line & BUG_WARNING_TRAP) {
                /* this is a WARN_ON rather than BUG/BUG_ON */
 #ifdef CONFIG_XMON
-               xmon_printf(KERN_ERR "Badness in %s at %s:%d\n",
+               xmon_printf(KERN_ERR "Badness in %s at %s:%ld\n",
                       bug->function, bug->file,
                       bug->line & ~BUG_WARNING_TRAP);
 #endif /* CONFIG_XMON */               
-               printk(KERN_ERR "Badness in %s at %s:%d\n",
+               printk(KERN_ERR "Badness in %s at %s:%ld\n",
                       bug->function, bug->file,
                       bug->line & ~BUG_WARNING_TRAP);
                dump_stack();
                return 1;
        }
 #ifdef CONFIG_XMON
-       xmon_printf(KERN_CRIT "kernel BUG in %s at %s:%d!\n",
+       xmon_printf(KERN_CRIT "kernel BUG in %s at %s:%ld!\n",
               bug->function, bug->file, bug->line);
        xmon(regs);
 #endif /* CONFIG_XMON */
-       printk(KERN_CRIT "kernel BUG in %s at %s:%d!\n",
+       printk(KERN_CRIT "kernel BUG in %s at %s:%ld!\n",
               bug->function, bug->file, bug->line);
 
        return 0;
index e6b2be3bcec1469816a8046b49cb572b04b09913..34f5c2e074c987ea3346ad1933c03e745328bb10 100644 (file)
@@ -3,13 +3,14 @@
 #
 
 ifeq ($(CONFIG_PPC_MERGE),y)
-obj-y                  := string.o
+obj-y                  := string.o strcase.o
+obj-$(CONFIG_PPC32)    += div64.o copy_32.o checksum_32.o
 endif
 
-obj-y                  += strcase.o
-obj-$(CONFIG_PPC32)    += div64.o copy_32.o checksum_32.o
+obj-y                  += bitops.o
 obj-$(CONFIG_PPC64)    += checksum_64.o copypage_64.o copyuser_64.o \
-                          memcpy_64.o usercopy_64.o mem_64.o
+                          memcpy_64.o usercopy_64.o mem_64.o string.o \
+                          strcase.o
 obj-$(CONFIG_PPC_ISERIES) += e2a.o
 obj-$(CONFIG_XMON)     += sstep.o
 
similarity index 66%
rename from arch/ppc64/kernel/bitops.c
rename to arch/powerpc/lib/bitops.c
index ae329e8b4acbfd66147a3ff1761632f64484e52a..b67ce3004ebf535fec0881b55370ca98489e1c3e 100644 (file)
@@ -1,93 +1,97 @@
-/*
- * These are too big to be inlined.
- */
-
-#include <linux/kernel.h>
+#include <linux/types.h>
 #include <linux/module.h>
-#include <linux/bitops.h>
 #include <asm/byteorder.h>
+#include <asm/bitops.h>
 
-unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
-                                unsigned long offset)
+/**
+ * find_next_bit - find the next set bit in a memory region
+ * @addr: The address to base the search on
+ * @offset: The bitnumber to start searching at
+ * @size: The maximum size to search
+ */
+unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
+                           unsigned long offset)
 {
-       const unsigned long *p = addr + (offset >> 6);
-       unsigned long result = offset & ~63UL;
+       const unsigned long *p = addr + BITOP_WORD(offset);
+       unsigned long result = offset & ~(BITS_PER_LONG-1);
        unsigned long tmp;
 
        if (offset >= size)
                return size;
        size -= result;
-       offset &= 63UL;
+       offset %= BITS_PER_LONG;
        if (offset) {
                tmp = *(p++);
-               tmp |= ~0UL >> (64 - offset);
-               if (size < 64)
+               tmp &= (~0UL << offset);
+               if (size < BITS_PER_LONG)
                        goto found_first;
-               if (~tmp)
+               if (tmp)
                        goto found_middle;
-               size -= 64;
-               result += 64;
+               size -= BITS_PER_LONG;
+               result += BITS_PER_LONG;
        }
-       while (size & ~63UL) {
-               if (~(tmp = *(p++)))
+       while (size & ~(BITS_PER_LONG-1)) {
+               if ((tmp = *(p++)))
                        goto found_middle;
-               result += 64;
-               size -= 64;
+               result += BITS_PER_LONG;
+               size -= BITS_PER_LONG;
        }
        if (!size)
                return result;
        tmp = *p;
 
 found_first:
-       tmp |= ~0UL << size;
-       if (tmp == ~0UL)        /* Are any bits zero? */
+       tmp &= (~0UL >> (64 - size));
+       if (tmp == 0UL)         /* Are any bits set? */
                return result + size;   /* Nope. */
 found_middle:
-       return result + ffz(tmp);
+       return result + __ffs(tmp);
 }
+EXPORT_SYMBOL(find_next_bit);
 
-EXPORT_SYMBOL(find_next_zero_bit);
-
-unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
-                           unsigned long offset)
+/*
+ * This implementation of find_{first,next}_zero_bit was stolen from
+ * Linus' asm-alpha/bitops.h.
+ */
+unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
+                                unsigned long offset)
 {
-       const unsigned long *p = addr + (offset >> 6);
-       unsigned long result = offset & ~63UL;
+       const unsigned long *p = addr + BITOP_WORD(offset);
+       unsigned long result = offset & ~(BITS_PER_LONG-1);
        unsigned long tmp;
 
        if (offset >= size)
                return size;
        size -= result;
-       offset &= 63UL;
+       offset %= BITS_PER_LONG;
        if (offset) {
                tmp = *(p++);
-               tmp &= (~0UL << offset);
-               if (size < 64)
+               tmp |= ~0UL >> (BITS_PER_LONG - offset);
+               if (size < BITS_PER_LONG)
                        goto found_first;
-               if (tmp)
+               if (~tmp)
                        goto found_middle;
-               size -= 64;
-               result += 64;
+               size -= BITS_PER_LONG;
+               result += BITS_PER_LONG;
        }
-       while (size & ~63UL) {
-               if ((tmp = *(p++)))
+       while (size & ~(BITS_PER_LONG-1)) {
+               if (~(tmp = *(p++)))
                        goto found_middle;
-               result += 64;
-               size -= 64;
+               result += BITS_PER_LONG;
+               size -= BITS_PER_LONG;
        }
        if (!size)
                return result;
        tmp = *p;
 
 found_first:
-       tmp &= (~0UL >> (64 - size));
-       if (tmp == 0UL)         /* Are any bits set? */
+       tmp |= ~0UL << size;
+       if (tmp == ~0UL)        /* Are any bits zero? */
                return result + size;   /* Nope. */
 found_middle:
-       return result + __ffs(tmp);
+       return result + ffz(tmp);
 }
-
-EXPORT_SYMBOL(find_next_bit);
+EXPORT_SYMBOL(find_next_zero_bit);
 
 static inline unsigned int ext2_ilog2(unsigned int x)
 {
@@ -106,8 +110,8 @@ static inline unsigned int ext2_ffz(unsigned int x)
        return rc;
 }
 
-unsigned long find_next_zero_le_bit(const unsigned long *addr, unsigned long size,
-                                   unsigned long offset)
+unsigned long find_next_zero_le_bit(const unsigned long *addr,
+                                   unsigned long size, unsigned long offset)
 {
        const unsigned int *p = ((const unsigned int *)addr) + (offset >> 5);
        unsigned int result = offset & ~31;
@@ -143,5 +147,4 @@ found_first:
 found_middle:
        return result + ext2_ffz(tmp);
 }
-
 EXPORT_SYMBOL(find_next_zero_le_bit);
index 172c0db635041b025261893f99b26b06da65333e..8836b3a0066837c1c60ccf5ab5e6b1f63b4f38e4 100644 (file)
@@ -11,3 +11,4 @@ obj-$(CONFIG_85xx)            += 85xx/
 obj-$(CONFIG_PPC_PSERIES)      += pseries/
 obj-$(CONFIG_PPC_ISERIES)      += iseries/
 obj-$(CONFIG_PPC_MAPLE)                += maple/
+obj-$(CONFIG_PPC_CELL)         += cell/
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
new file mode 100644 (file)
index 0000000..55e094b
--- /dev/null
@@ -0,0 +1,2 @@
+obj-y                  += interrupt.o iommu.o setup.o spider-pic.o
+obj-$(CONFIG_SMP)      += smp.o
similarity index 97%
rename from arch/ppc64/kernel/bpa_iic.c
rename to arch/powerpc/platforms/cell/interrupt.c
index 0aaa878e19d36767861cba4b7da846c833675d78..7fbe78a9327db993b5e386ab1d6f8f760852d917 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BPA Internal Interrupt Controller
+ * Cell Internal Interrupt Controller
  *
  * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
  *
@@ -31,7 +31,7 @@
 #include <asm/prom.h>
 #include <asm/ptrace.h>
 
-#include "bpa_iic.h"
+#include "interrupt.h"
 
 struct iic_pending_bits {
        u32 data;
@@ -89,7 +89,7 @@ static void iic_end(unsigned int irq)
 }
 
 static struct hw_interrupt_type iic_pic = {
-       .typename = " BPA-IIC  ",
+       .typename = " CELL-IIC ",
        .startup = iic_startup,
        .enable = iic_enable,
        .disable = iic_disable,
@@ -106,7 +106,7 @@ static int iic_external_get_irq(struct iic_pending_bits pending)
        irq = -1;
 
        /*
-        * This mapping is specific to the Broadband
+        * This mapping is specific to the Cell Broadband
         * Engine. We might need to get the numbers
         * from the device tree to support future CPUs.
         */
similarity index 92%
rename from arch/ppc64/kernel/bpa_iic.h
rename to arch/powerpc/platforms/cell/interrupt.h
index 6833c302216685deb88032be5f71e6b4ce035e7f..37d58e6fd0c6c4f17e14166ec63e29e306df1328 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef ASM_BPA_IIC_H
-#define ASM_BPA_IIC_H
+#ifndef ASM_CELL_PIC_H
+#define ASM_CELL_PIC_H
 #ifdef __KERNEL__
 /*
  * Mapping of IIC pending bits into per-node
@@ -21,7 +21,7 @@
  *    + node number
  *    * don't care
  *
- * A node consists of a Broadband Engine and an optional
+ * A node consists of a Cell Broadband Engine and an optional
  * south bridge device providing a maximum of 64 IRQs.
  * The south bridge may be connected to either IOIF0
  * or IOIF1.
@@ -59,4 +59,4 @@ extern void spider_init_IRQ(void);
 extern int spider_get_irq(unsigned long int_pending);
 
 #endif
-#endif /* ASM_BPA_IIC_H */
+#endif /* ASM_CELL_PIC_H */
similarity index 89%
rename from arch/ppc64/kernel/bpa_iommu.c
rename to arch/powerpc/platforms/cell/iommu.c
index da1b4b7a32692cf3ce15414a99aad757a19d2faa..74f999b4ac9e782cbdee477457681b6de4e3639f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * IOMMU implementation for Broadband Processor Architecture
+ * IOMMU implementation for Cell Broadband Processor Architecture
  * We just establish a linear mapping at boot by setting all the
  * IOPT cache entries in the CPU.
  * The mapping functions should be identical to pci_direct_iommu, 
@@ -41,7 +41,7 @@
 #include <asm/system.h>
 #include <asm/ppc-pci.h>
 
-#include "bpa_iommu.h"
+#include "iommu.h"
 
 static inline unsigned long 
 get_iopt_entry(unsigned long real_address, unsigned long ioid,
@@ -276,7 +276,7 @@ static void iommu_dev_setup_null(struct pci_dev *d) { }
  * for each DMA window used by any device. For now, we
  * happen to know that there is only one DMA window in use,
  * starting at iopt_phys_offset. */
-static void bpa_map_iommu(void)
+static void cell_map_iommu(void)
 {
        unsigned long address;
        void __iomem *base;
@@ -309,7 +309,7 @@ static void bpa_map_iommu(void)
 }
 
 
-static void *bpa_alloc_coherent(struct device *hwdev, size_t size,
+static void *cell_alloc_coherent(struct device *hwdev, size_t size,
                           dma_addr_t *dma_handle, gfp_t flag)
 {
        void *ret;
@@ -317,65 +317,65 @@ static void *bpa_alloc_coherent(struct device *hwdev, size_t size,
        ret = (void *)__get_free_pages(flag, get_order(size));
        if (ret != NULL) {
                memset(ret, 0, size);
-               *dma_handle = virt_to_abs(ret) | BPA_DMA_VALID;
+               *dma_handle = virt_to_abs(ret) | CELL_DMA_VALID;
        }
        return ret;
 }
 
-static void bpa_free_coherent(struct device *hwdev, size_t size,
+static void cell_free_coherent(struct device *hwdev, size_t size,
                                 void *vaddr, dma_addr_t dma_handle)
 {
        free_pages((unsigned long)vaddr, get_order(size));
 }
 
-static dma_addr_t bpa_map_single(struct device *hwdev, void *ptr,
+static dma_addr_t cell_map_single(struct device *hwdev, void *ptr,
                size_t size, enum dma_data_direction direction)
 {
-       return virt_to_abs(ptr) | BPA_DMA_VALID;
+       return virt_to_abs(ptr) | CELL_DMA_VALID;
 }
 
-static void bpa_unmap_single(struct device *hwdev, dma_addr_t dma_addr,
+static void cell_unmap_single(struct device *hwdev, dma_addr_t dma_addr,
                size_t size, enum dma_data_direction direction)
 {
 }
 
-static int bpa_map_sg(struct device *hwdev, struct scatterlist *sg,
+static int cell_map_sg(struct device *hwdev, struct scatterlist *sg,
                int nents, enum dma_data_direction direction)
 {
        int i;
 
        for (i = 0; i < nents; i++, sg++) {
                sg->dma_address = (page_to_phys(sg->page) + sg->offset)
-                                       | BPA_DMA_VALID;
+                                       | CELL_DMA_VALID;
                sg->dma_length = sg->length;
        }
 
        return nents;
 }
 
-static void bpa_unmap_sg(struct device *hwdev, struct scatterlist *sg,
+static void cell_unmap_sg(struct device *hwdev, struct scatterlist *sg,
                int nents, enum dma_data_direction direction)
 {
 }
 
-static int bpa_dma_supported(struct device *dev, u64 mask)
+static int cell_dma_supported(struct device *dev, u64 mask)
 {
        return mask < 0x100000000ull;
 }
 
-void bpa_init_iommu(void)
+void cell_init_iommu(void)
 {
-       bpa_map_iommu();
+       cell_map_iommu();
 
        /* Direct I/O, IOMMU off */
        ppc_md.iommu_dev_setup = iommu_dev_setup_null;
        ppc_md.iommu_bus_setup = iommu_bus_setup_null;
 
-       pci_dma_ops.alloc_coherent = bpa_alloc_coherent;
-       pci_dma_ops.free_coherent = bpa_free_coherent;
-       pci_dma_ops.map_single = bpa_map_single;
-       pci_dma_ops.unmap_single = bpa_unmap_single;
-       pci_dma_ops.map_sg = bpa_map_sg;
-       pci_dma_ops.unmap_sg = bpa_unmap_sg;
-       pci_dma_ops.dma_supported = bpa_dma_supported;
+       pci_dma_ops.alloc_coherent = cell_alloc_coherent;
+       pci_dma_ops.free_coherent = cell_free_coherent;
+       pci_dma_ops.map_single = cell_map_single;
+       pci_dma_ops.unmap_single = cell_unmap_single;
+       pci_dma_ops.map_sg = cell_map_sg;
+       pci_dma_ops.unmap_sg = cell_unmap_sg;
+       pci_dma_ops.dma_supported = cell_dma_supported;
 }
similarity index 92%
rename from arch/ppc64/kernel/bpa_iommu.h
rename to arch/powerpc/platforms/cell/iommu.h
index e547d77dfa0480facb0c0137cb633588bb910a07..490d77abfe852804c7309c6185cf25b4b2f304a2 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef BPA_IOMMU_H
-#define BPA_IOMMU_H
+#ifndef CELL_IOMMU_H
+#define CELL_IOMMU_H
 
 /* some constants */
 enum {
@@ -55,11 +55,11 @@ enum {
 
        /* The high bit needs to be set on every DMA address,
           only 2GB are addressable */
-       BPA_DMA_VALID     = 0x80000000,
-       BPA_DMA_MASK      = 0x7fffffff,
+       CELL_DMA_VALID    = 0x80000000,
+       CELL_DMA_MASK     = 0x7fffffff,
 };
 
 
-void bpa_init_iommu(void);
+void cell_init_iommu(void);
 
 #endif
similarity index 74%
rename from arch/ppc64/kernel/bpa_setup.c
rename to arch/powerpc/platforms/cell/setup.c
index c2dc8f282eb85680a15de253e1ad95ff5f8b41e1..9a495634d0c238aeaef80aa3b675dc5a3ef3f8e8 100644 (file)
@@ -1,11 +1,11 @@
 /*
- *  linux/arch/ppc/kernel/bpa_setup.c
+ *  linux/arch/powerpc/platforms/cell/cell_setup.c
  *
  *  Copyright (C) 1995  Linus Torvalds
  *  Adapted from 'alpha' version by Gary Thomas
  *  Modified by Cort Dougan (cort@cs.nmt.edu)
  *  Modified by PPC64 Team, IBM Corp
- *  Modified by BPA Team, IBM Deutschland Entwicklung GmbH
+ *  Modified by Cell Team, IBM Deutschland Entwicklung GmbH
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -46,8 +46,8 @@
 #include <asm/ppc-pci.h>
 #include <asm/irq.h>
 
-#include "bpa_iic.h"
-#include "bpa_iommu.h"
+#include "interrupt.h"
+#include "iommu.h"
 
 #ifdef DEBUG
 #define DBG(fmt...) udbg_printf(fmt)
@@ -55,7 +55,7 @@
 #define DBG(fmt...)
 #endif
 
-void bpa_show_cpuinfo(struct seq_file *m)
+void cell_show_cpuinfo(struct seq_file *m)
 {
        struct device_node *root;
        const char *model = "";
@@ -63,22 +63,22 @@ void bpa_show_cpuinfo(struct seq_file *m)
        root = of_find_node_by_path("/");
        if (root)
                model = get_property(root, "model", NULL);
-       seq_printf(m, "machine\t\t: BPA %s\n", model);
+       seq_printf(m, "machine\t\t: CHRP %s\n", model);
        of_node_put(root);
 }
 
-static void bpa_progress(char *s, unsigned short hex)
+static void cell_progress(char *s, unsigned short hex)
 {
        printk("*** %04x : %s\n", hex, s ? s : "");
 }
 
-static void __init bpa_setup_arch(void)
+static void __init cell_setup_arch(void)
 {
        ppc_md.init_IRQ       = iic_init_IRQ;
        ppc_md.get_irq        = iic_get_irq;
 
 #ifdef CONFIG_SMP
-       smp_init_pSeries();
+       smp_init_cell();
 #endif
 
        /* init to some ~sane value until calibrate_delay() runs */
@@ -97,39 +97,39 @@ static void __init bpa_setup_arch(void)
        conswitchp = &dummy_con;
 #endif
 
-       bpa_nvram_init();
+       mmio_nvram_init();
 }
 
 /*
  * Early initialization.  Relocation is on but do not reference unbolted pages
  */
-static void __init bpa_init_early(void)
+static void __init cell_init_early(void)
 {
-       DBG(" -> bpa_init_early()\n");
+       DBG(" -> cell_init_early()\n");
 
        hpte_init_native();
 
-       bpa_init_iommu();
+       cell_init_iommu();
 
-       ppc64_interrupt_controller = IC_BPA_IIC;
+       ppc64_interrupt_controller = IC_CELL_PIC;
 
-       DBG(" <- bpa_init_early()\n");
+       DBG(" <- cell_init_early()\n");
 }
 
 
-static int __init bpa_probe(int platform)
+static int __init cell_probe(int platform)
 {
-       if (platform != PLATFORM_BPA)
+       if (platform != PLATFORM_CELL)
                return 0;
 
        return 1;
 }
 
-struct machdep_calls __initdata bpa_md = {
-       .probe                  = bpa_probe,
-       .setup_arch             = bpa_setup_arch,
-       .init_early             = bpa_init_early,
-       .show_cpuinfo           = bpa_show_cpuinfo,
+struct machdep_calls __initdata cell_md = {
+       .probe                  = cell_probe,
+       .setup_arch             = cell_setup_arch,
+       .init_early             = cell_init_early,
+       .show_cpuinfo           = cell_show_cpuinfo,
        .restart                = rtas_restart,
        .power_off              = rtas_power_off,
        .halt                   = rtas_halt,
@@ -137,5 +137,5 @@ struct machdep_calls __initdata bpa_md = {
        .get_rtc_time           = rtas_get_rtc_time,
        .set_rtc_time           = rtas_set_rtc_time,
        .calibrate_decr         = generic_calibrate_decr,
-       .progress               = bpa_progress,
+       .progress               = cell_progress,
 };
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
new file mode 100644 (file)
index 0000000..de96ead
--- /dev/null
@@ -0,0 +1,230 @@
+/*
+ * SMP support for BPA machines.
+ *
+ * Dave Engebretsen, Peter Bergner, and
+ * Mike Corrigan {engebret|bergner|mikec}@us.ibm.com
+ *
+ * Plus various changes from other IBM teams...
+ *
+ *      This program is free software; you can redistribute it and/or
+ *      modify it under the terms of the GNU General Public License
+ *      as published by the Free Software Foundation; either version
+ *      2 of the License, or (at your option) any later version.
+ */
+
+#undef DEBUG
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/smp.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/spinlock.h>
+#include <linux/cache.h>
+#include <linux/err.h>
+#include <linux/sysdev.h>
+#include <linux/cpu.h>
+
+#include <asm/ptrace.h>
+#include <asm/atomic.h>
+#include <asm/irq.h>
+#include <asm/page.h>
+#include <asm/pgtable.h>
+#include <asm/io.h>
+#include <asm/prom.h>
+#include <asm/smp.h>
+#include <asm/paca.h>
+#include <asm/time.h>
+#include <asm/machdep.h>
+#include <asm/cputable.h>
+#include <asm/firmware.h>
+#include <asm/system.h>
+#include <asm/rtas.h>
+
+#include "interrupt.h"
+
+#ifdef DEBUG
+#define DBG(fmt...) udbg_printf(fmt)
+#else
+#define DBG(fmt...)
+#endif
+
+/*
+ * The primary thread of each non-boot processor is recorded here before
+ * smp init.
+ */
+static cpumask_t of_spin_map;
+
+extern void pSeries_secondary_smp_init(unsigned long);
+
+/**
+ * smp_startup_cpu() - start the given cpu
+ *
+ * At boot time, there is nothing to do for primary threads which were
+ * started from Open Firmware.  For anything else, call RTAS with the
+ * appropriate start location.
+ *
+ * Returns:
+ *     0       - failure
+ *     1       - success
+ */
+static inline int __devinit smp_startup_cpu(unsigned int lcpu)
+{
+       int status;
+       unsigned long start_here = __pa((u32)*((unsigned long *)
+                                              pSeries_secondary_smp_init));
+       unsigned int pcpu;
+       int start_cpu;
+
+       if (cpu_isset(lcpu, of_spin_map))
+               /* Already started by OF and sitting in spin loop */
+               return 1;
+
+       pcpu = get_hard_smp_processor_id(lcpu);
+
+       /* Fixup atomic count: it exited inside IRQ handler. */
+       paca[lcpu].__current->thread_info->preempt_count        = 0;
+
+       /*
+        * If the RTAS start-cpu token does not exist then presume the
+        * cpu is already spinning.
+        */
+       start_cpu = rtas_token("start-cpu");
+       if (start_cpu == RTAS_UNKNOWN_SERVICE)
+               return 1;
+
+       status = rtas_call(start_cpu, 3, 1, NULL, pcpu, start_here, lcpu);
+       if (status != 0) {
+               printk(KERN_ERR "start-cpu failed: %i\n", status);
+               return 0;
+       }
+
+       return 1;
+}
+
+static void smp_iic_message_pass(int target, int msg)
+{
+       unsigned int i;
+
+       if (target < NR_CPUS) {
+               iic_cause_IPI(target, msg);
+       } else {
+               for_each_online_cpu(i) {
+                       if (target == MSG_ALL_BUT_SELF
+                           && i == smp_processor_id())
+                               continue;
+                       iic_cause_IPI(i, msg);
+               }
+       }
+}
+
+static int __init smp_iic_probe(void)
+{
+       iic_request_IPIs();
+
+       return cpus_weight(cpu_possible_map);
+}
+
+static void __devinit smp_iic_setup_cpu(int cpu)
+{
+       if (cpu != boot_cpuid)
+               iic_setup_cpu();
+}
+
+static DEFINE_SPINLOCK(timebase_lock);
+static unsigned long timebase = 0;
+
+static void __devinit cell_give_timebase(void)
+{
+       spin_lock(&timebase_lock);
+       rtas_call(rtas_token("freeze-time-base"), 0, 1, NULL);
+       timebase = get_tb();
+       spin_unlock(&timebase_lock);
+
+       while (timebase)
+               barrier();
+       rtas_call(rtas_token("thaw-time-base"), 0, 1, NULL);
+}
+
+static void __devinit cell_take_timebase(void)
+{
+       while (!timebase)
+               barrier();
+       spin_lock(&timebase_lock);
+       set_tb(timebase >> 32, timebase & 0xffffffff);
+       timebase = 0;
+       spin_unlock(&timebase_lock);
+}
+
+static void __devinit smp_cell_kick_cpu(int nr)
+{
+       BUG_ON(nr < 0 || nr >= NR_CPUS);
+
+       if (!smp_startup_cpu(nr))
+               return;
+
+       /*
+        * The processor is currently spinning, waiting for the
+        * cpu_start field to become non-zero After we set cpu_start,
+        * the processor will continue on to secondary_start
+        */
+       paca[nr].cpu_start = 1;
+}
+
+static int smp_cell_cpu_bootable(unsigned int nr)
+{
+       /* Special case - we inhibit secondary thread startup
+        * during boot if the user requests it.  Odd-numbered
+        * cpus are assumed to be secondary threads.
+        */
+       if (system_state < SYSTEM_RUNNING &&
+           cpu_has_feature(CPU_FTR_SMT) &&
+           !smt_enabled_at_boot && nr % 2 != 0)
+               return 0;
+
+       return 1;
+}
+static struct smp_ops_t bpa_iic_smp_ops = {
+       .message_pass   = smp_iic_message_pass,
+       .probe          = smp_iic_probe,
+       .kick_cpu       = smp_cell_kick_cpu,
+       .setup_cpu      = smp_iic_setup_cpu,
+       .cpu_bootable   = smp_cell_cpu_bootable,
+};
+
+/* This is called very early */
+void __init smp_init_cell(void)
+{
+       int i;
+
+       DBG(" -> smp_init_cell()\n");
+
+       smp_ops = &bpa_iic_smp_ops;
+
+       /* Mark threads which are still spinning in hold loops. */
+       if (cpu_has_feature(CPU_FTR_SMT)) {
+               for_each_present_cpu(i) {
+                       if (i % 2 == 0)
+                               /*
+                                * Even-numbered logical cpus correspond to
+                                * primary threads.
+                                */
+                               cpu_set(i, of_spin_map);
+               }
+       } else {
+               of_spin_map = cpu_present_map;
+       }
+
+       cpu_clear(boot_cpuid, of_spin_map);
+
+       /* Non-lpar has additional take/give timebase */
+       if (rtas_token("freeze-time-base") != RTAS_UNKNOWN_SERVICE) {
+               smp_ops->give_timebase = cell_give_timebase;
+               smp_ops->take_timebase = cell_take_timebase;
+       }
+
+       DBG(" <- smp_init_cell()\n");
+}
similarity index 99%
rename from arch/ppc64/kernel/spider-pic.c
rename to arch/powerpc/platforms/cell/spider-pic.c
index d5c9a02fb119f52ef9f4aa78f2b42b526ad1807c..e74132188bdf7f4190a6ae46b45cb50599cb9ebb 100644 (file)
@@ -27,7 +27,7 @@
 #include <asm/prom.h>
 #include <asm/io.h>
 
-#include "bpa_iic.h"
+#include "interrupt.h"
 
 /* register layout taken from Spider spec, table 7.4-4 */
 enum {
index 4ac7125aa09cb3dbbafbeb05e5c503e44bd4337c..65266b46db9b6a0e8da7b822d3739b5e0f10bac2 100644 (file)
@@ -34,7 +34,8 @@ static unsigned char chrp_nvram_read(int addr)
                return 0xff;
        }
        spin_lock_irqsave(&nvram_lock, flags);
-       if ((call_rtas("nvram-fetch", 3, 2, &done, addr, __pa(nvram_buf), 1) != 0) || 1 != done)
+       if ((rtas_call(rtas_token("nvram-fetch"), 3, 2, &done, addr,
+                      __pa(nvram_buf), 1) != 0) || 1 != done)
                ret = 0xff;
        else
                ret = nvram_buf[0];
@@ -54,7 +55,8 @@ static void chrp_nvram_write(int addr, unsigned char val)
        }
        spin_lock_irqsave(&nvram_lock, flags);
        nvram_buf[0] = val;
-       if ((call_rtas("nvram-store", 3, 2, &done, addr, __pa(nvram_buf), 1) != 0) || 1 != done)
+       if ((rtas_call(rtas_token("nvram-store"), 3, 2, &done, addr,
+                      __pa(nvram_buf), 1) != 0) || 1 != done)
                printk(KERN_DEBUG "rtas IO error storing 0x%02x at %d", val, addr);
        spin_unlock_irqrestore(&nvram_lock, flags);
 }
index d955e950a74c269bfa2cee0d27cf35b2757d097b..8e5ef62715bb28e24f630a468baadc9ca2dca16b 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/kdev_t.h>
 #include <linux/major.h>
 #include <linux/root_dev.h>
+#include <linux/kernel.h>
 
 #include <asm/processor.h>
 #include <asm/machdep.h>
@@ -94,6 +95,8 @@ extern unsigned long iSeries_recal_titan;
 
 static int mf_initialized;
 
+static unsigned long cmd_mem_limit;
+
 struct MemoryBlock {
        unsigned long absStart;
        unsigned long absEnd;
@@ -341,23 +344,6 @@ static void __init iSeries_init_early(void)
         */
        iommu_init_early_iSeries();
 
-       iSeries_get_cmdline();
-
-       /* Save unparsed command line copy for /proc/cmdline */
-       strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
-
-       /* Parse early parameters, in particular mem=x */
-       parse_early_param();
-
-       if (memory_limit) {
-               if (memory_limit < systemcfg->physicalMemorySize)
-                       systemcfg->physicalMemorySize = memory_limit;
-               else {
-                       printk("Ignoring mem=%lu >= ram_top.\n", memory_limit);
-                       memory_limit = 0;
-               }
-       }
-
        /* Initialize machine-dependency vectors */
 #ifdef CONFIG_SMP
        smp_init_iSeries();
@@ -971,6 +957,8 @@ void build_flat_dt(struct iseries_flat_dt *dt)
        /* /chosen */
        dt_start_node(dt, "chosen");
        dt_prop_u32(dt, "linux,platform", PLATFORM_ISERIES_LPAR);
+       if (cmd_mem_limit)
+               dt_prop_u64(dt, "linux,memory-limit", cmd_mem_limit);
        dt_end_node(dt);
 
        dt_cpus(dt);
@@ -990,7 +978,27 @@ void * __init iSeries_early_setup(void)
         */
        build_iSeries_Memory_Map();
 
+       iSeries_get_cmdline();
+
+       /* Save unparsed command line copy for /proc/cmdline */
+       strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
+
+       /* Parse early parameters, in particular mem=x */
+       parse_early_param();
+
        build_flat_dt(&iseries_dt);
 
        return (void *) __pa(&iseries_dt);
 }
+
+/*
+ * On iSeries we just parse the mem=X option from the command line.
+ * On pSeries it's a bit more complicated, see prom_init_mem()
+ */
+static int __init early_parsemem(char *p)
+{
+       if (p)
+               cmd_mem_limit = ALIGN(memparse(p, &p), PAGE_SIZE);
+       return 0;
+}
+early_param("mem", early_parsemem);
index 0037a8c8c81f52e9ba6eb21a11f9e423115886f7..83a49e80ac2955e8f065f45e9662c99f066bc280 100644 (file)
@@ -576,7 +576,7 @@ void __init pmac_pic_init(void)
 #endif /* CONFIG_PPC32 */
 }
 
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
 /*
  * These procedures are used in implementing sleep on the powerbooks.
  * sleep_save_intrs() saves the states of all interrupt enables
@@ -643,7 +643,7 @@ static int pmacpic_resume(struct sys_device *sysdev)
        return 0;
 }
 
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM && CONFIG_PPC32 */
 
 static struct sysdev_class pmacpic_sysclass = {
        set_kset_name("pmac_pic"),
@@ -655,10 +655,10 @@ static struct sys_device device_pmacpic = {
 };
 
 static struct sysdev_driver driver_pmacpic = {
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
        .suspend        = &pmacpic_suspend,
        .resume         = &pmacpic_resume,
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM && CONFIG_PPC32 */
 };
 
 static int __init init_pmacpic_sysfs(void)
index 5ef494e3a70f797cf507072b4e1527f1033a169e..91909a84473652edbf9031144dde274c3bf3da64 100644 (file)
@@ -1,5 +1,5 @@
 obj-y                  := pci.o lpar.o hvCall.o nvram.o reconfig.o \
-                          setup.o iommu.o rtas-fw.o ras.o
+                          setup.o iommu.o ras.o
 obj-$(CONFIG_SMP)      += smp.o
 obj-$(CONFIG_IBMVIO)   += vio.o
 obj-$(CONFIG_XICS)     += xics.o
diff --git a/arch/powerpc/platforms/pseries/rtas-fw.h b/arch/powerpc/platforms/pseries/rtas-fw.h
deleted file mode 100644 (file)
index e70fa69..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-void rtas_fw_restart(char *cmd);
-void rtas_fw_power_off(void);
-void rtas_fw_halt(void);
index 10cb0f2d9b5bd327a4073a2c33b444646834884b..c0a3d918148ad2fac0677fc476d79b1820350b15 100644 (file)
@@ -67,8 +67,6 @@
 #include <asm/i8259.h>
 #include <asm/udbg.h>
 
-#include "rtas-fw.h"
-
 #ifdef DEBUG
 #define DBG(fmt...) udbg_printf(fmt)
 #else
index 8acd21dee05dbc26d552d9b4c3022b0bc511a9d2..6b7efcfc352a2ed266ee08f8da00ad90f58041a5 100644 (file)
@@ -5,3 +5,4 @@ obj-$(CONFIG_PPC_MPC106)        += grackle.o
 obj-$(CONFIG_BOOKE)            += dcr.o
 obj-$(CONFIG_40x)              += dcr.o
 obj-$(CONFIG_U3_DART)          += u3_iommu.o
+obj-$(CONFIG_MMIO_NVRAM)       += mmio_nvram.o
similarity index 56%
rename from arch/ppc64/kernel/bpa_nvram.c
rename to arch/powerpc/sysdev/mmio_nvram.c
index 06a119cfceb5ef525cf2ef2c91042e0f63b2a27f..74e0d31a3559cf9ca3859a0f3b55fff962966f97 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * NVRAM for CPBW
+ * memory mapped NVRAM
  *
  * (C) Copyright IBM Corp. 2005
  *
 #include <asm/nvram.h>
 #include <asm/prom.h>
 
-static void __iomem *bpa_nvram_start;
-static long bpa_nvram_len;
-static spinlock_t bpa_nvram_lock = SPIN_LOCK_UNLOCKED;
+static void __iomem *mmio_nvram_start;
+static long mmio_nvram_len;
+static spinlock_t mmio_nvram_lock = SPIN_LOCK_UNLOCKED;
 
-static ssize_t bpa_nvram_read(char *buf, size_t count, loff_t *index)
+static ssize_t mmio_nvram_read(char *buf, size_t count, loff_t *index)
 {
        unsigned long flags;
 
-       if (*index >= bpa_nvram_len)
+       if (*index >= mmio_nvram_len)
                return 0;
-       if (*index + count > bpa_nvram_len)
-               count = bpa_nvram_len - *index;
+       if (*index + count > mmio_nvram_len)
+               count = mmio_nvram_len - *index;
 
-       spin_lock_irqsave(&bpa_nvram_lock, flags);
+       spin_lock_irqsave(&mmio_nvram_lock, flags);
 
-       memcpy_fromio(buf, bpa_nvram_start + *index, count);
+       memcpy_fromio(buf, mmio_nvram_start + *index, count);
 
-       spin_unlock_irqrestore(&bpa_nvram_lock, flags);
+       spin_unlock_irqrestore(&mmio_nvram_lock, flags);
        
        *index += count;
        return count;
 }
 
-static ssize_t bpa_nvram_write(char *buf, size_t count, loff_t *index)
+static ssize_t mmio_nvram_write(char *buf, size_t count, loff_t *index)
 {
        unsigned long flags;
 
-       if (*index >= bpa_nvram_len)
+       if (*index >= mmio_nvram_len)
                return 0;
-       if (*index + count > bpa_nvram_len)
-               count = bpa_nvram_len - *index;
+       if (*index + count > mmio_nvram_len)
+               count = mmio_nvram_len - *index;
 
-       spin_lock_irqsave(&bpa_nvram_lock, flags);
+       spin_lock_irqsave(&mmio_nvram_lock, flags);
 
-       memcpy_toio(bpa_nvram_start + *index, buf, count);
+       memcpy_toio(mmio_nvram_start + *index, buf, count);
 
-       spin_unlock_irqrestore(&bpa_nvram_lock, flags);
+       spin_unlock_irqrestore(&mmio_nvram_lock, flags);
        
        *index += count;
        return count;
 }
 
-static ssize_t bpa_nvram_get_size(void)
+static ssize_t mmio_nvram_get_size(void)
 {
-       return bpa_nvram_len;
+       return mmio_nvram_len;
 }
 
-int __init bpa_nvram_init(void)
+int __init mmio_nvram_init(void)
 {
        struct device_node *nvram_node;
        unsigned long *buffer;
@@ -97,20 +97,20 @@ int __init bpa_nvram_init(void)
 
        ret = -ENODEV;
        nvram_addr = buffer[0];
-       bpa_nvram_len = buffer[1];
-       if ( (!bpa_nvram_len) || (!nvram_addr) )
+       mmio_nvram_len = buffer[1];
+       if ( (!mmio_nvram_len) || (!nvram_addr) )
                goto out;
 
-       bpa_nvram_start = ioremap(nvram_addr, bpa_nvram_len);
-       if (!bpa_nvram_start)
+       mmio_nvram_start = ioremap(nvram_addr, mmio_nvram_len);
+       if (!mmio_nvram_start)
                goto out;
 
-       printk(KERN_INFO "BPA NVRAM, %luk mapped to %p\n",
-              bpa_nvram_len >> 10, bpa_nvram_start);
+       printk(KERN_INFO "mmio NVRAM, %luk mapped to %p\n",
+              mmio_nvram_len >> 10, mmio_nvram_start);
 
-       ppc_md.nvram_read       = bpa_nvram_read;
-       ppc_md.nvram_write      = bpa_nvram_write;
-       ppc_md.nvram_size       = bpa_nvram_get_size;
+       ppc_md.nvram_read       = mmio_nvram_read;
+       ppc_md.nvram_write      = mmio_nvram_write;
+       ppc_md.nvram_size       = mmio_nvram_get_size;
 
 out:
        of_node_put(nvram_node);
index 94d5716fa7c34aa1b668d7e786fe65f486b862f4..e719a4933af1e1bff7d820f42225dda557f310af 100644 (file)
@@ -66,7 +66,8 @@ head-$(CONFIG_PPC_FPU)                += arch/powerpc/kernel/fpu.o
 core-y                         += arch/ppc/kernel/ arch/powerpc/kernel/ \
                                   arch/ppc/platforms/ \
                                   arch/ppc/mm/ arch/ppc/lib/ \
-                                  arch/ppc/syslib/ arch/powerpc/sysdev/
+                                  arch/ppc/syslib/ arch/powerpc/sysdev/ \
+                                  arch/powerpc/lib/
 core-$(CONFIG_4xx)             += arch/ppc/platforms/4xx/
 core-$(CONFIG_83xx)            += arch/ppc/platforms/83xx/
 core-$(CONFIG_85xx)            += arch/ppc/platforms/85xx/
diff --git a/arch/ppc/kernel/bitops.c b/arch/ppc/kernel/bitops.c
deleted file mode 100644 (file)
index 7f53d19..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 1996 Paul Mackerras.
- */
-
-#include <linux/kernel.h>
-#include <linux/bitops.h>
-
-/*
- * If the bitops are not inlined in bitops.h, they are defined here.
- *  -- paulus
- */
-#if !__INLINE_BITOPS
-void set_bit(int nr, volatile void * addr)
-{
-       unsigned long old;
-       unsigned long mask = 1 << (nr & 0x1f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-       
-       __asm__ __volatile__(SMP_WMB "\n\
-1:     lwarx   %0,0,%3 \n\
-       or      %0,%0,%2 \n"
-       PPC405_ERR77(0,%3)
-"      stwcx.  %0,0,%3 \n\
-       bne     1b"
-       SMP_MB
-       : "=&r" (old), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc" );
-}
-
-void clear_bit(int nr, volatile void *addr)
-{
-       unsigned long old;
-       unsigned long mask = 1 << (nr & 0x1f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-
-       __asm__ __volatile__(SMP_WMB "\n\
-1:     lwarx   %0,0,%3 \n\
-       andc    %0,%0,%2 \n"
-       PPC405_ERR77(0,%3)
-"      stwcx.  %0,0,%3 \n\
-       bne     1b"
-       SMP_MB
-       : "=&r" (old), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc");
-}
-
-void change_bit(int nr, volatile void *addr)
-{
-       unsigned long old;
-       unsigned long mask = 1 << (nr & 0x1f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-
-       __asm__ __volatile__(SMP_WMB "\n\
-1:     lwarx   %0,0,%3 \n\
-       xor     %0,%0,%2 \n"
-       PPC405_ERR77(0,%3)
-"      stwcx.  %0,0,%3 \n\
-       bne     1b"
-       SMP_MB
-       : "=&r" (old), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc");
-}
-
-int test_and_set_bit(int nr, volatile void *addr)
-{
-       unsigned int old, t;
-       unsigned int mask = 1 << (nr & 0x1f);
-       volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5);
-
-       __asm__ __volatile__(SMP_WMB "\n\
-1:     lwarx   %0,0,%4 \n\
-       or      %1,%0,%3 \n"
-       PPC405_ERR77(0,%4)
-"      stwcx.  %1,0,%4 \n\
-       bne     1b"
-       SMP_MB
-       : "=&r" (old), "=&r" (t), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc");
-
-       return (old & mask) != 0;
-}
-
-int test_and_clear_bit(int nr, volatile void *addr)
-{
-       unsigned int old, t;
-       unsigned int mask = 1 << (nr & 0x1f);
-       volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5);
-
-       __asm__ __volatile__(SMP_WMB "\n\
-1:     lwarx   %0,0,%4 \n\
-       andc    %1,%0,%3 \n"
-       PPC405_ERR77(0,%4)
-"      stwcx.  %1,0,%4 \n\
-       bne     1b"
-       SMP_MB
-       : "=&r" (old), "=&r" (t), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc");
-
-       return (old & mask) != 0;
-}
-
-int test_and_change_bit(int nr, volatile void *addr)
-{
-       unsigned int old, t;
-       unsigned int mask = 1 << (nr & 0x1f);
-       volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5);
-
-       __asm__ __volatile__(SMP_WMB "\n\
-1:     lwarx   %0,0,%4 \n\
-       xor     %1,%0,%3 \n"
-       PPC405_ERR77(0,%4)
-"      stwcx.  %1,0,%4 \n\
-       bne     1b"
-       SMP_MB
-       : "=&r" (old), "=&r" (t), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc");
-
-       return (old & mask) != 0;
-}
-#endif /* !__INLINE_BITOPS */
index fdbd6f44adc07a1f01e57803b9b3d5717c37e488..a55a82d145d4c14a8a0f5c5d30a92e218b26d4fd 100644 (file)
@@ -86,7 +86,6 @@ head-y := arch/ppc64/kernel/head.o
 head-y += arch/powerpc/kernel/fpu.o
 head-y += arch/powerpc/kernel/entry_64.o
 
-libs-y                         += arch/ppc64/lib/
 core-y                         += arch/ppc64/kernel/ arch/powerpc/kernel/
 core-y                         += arch/powerpc/mm/
 core-y                         += arch/powerpc/sysdev/
index 327c08ce429169ba5f1fbb0e473bb5cdb72a6bec..990df0905c874d0873c2ac3edd7f563f66493eff 100644 (file)
@@ -13,7 +13,7 @@ endif
 
 obj-y               += irq.o idle.o dma.o \
                        signal.o \
-                       align.o bitops.o pacaData.o \
+                       align.o pacaData.o \
                        udbg.o ioctl32.o \
                        rtc.o \
                        cpu_setup_power4.o \
@@ -31,9 +31,6 @@ endif
 
 obj-$(CONFIG_PPC_PSERIES) += rtasd.o udbg_16550.o
 
-obj-$(CONFIG_PPC_BPA) += bpa_setup.o bpa_iommu.o bpa_nvram.o \
-                        bpa_iic.o spider-pic.o
-
 obj-$(CONFIG_KEXEC)            += machine_kexec.o
 obj-$(CONFIG_EEH)              += eeh.o
 obj-$(CONFIG_PROC_FS)          += proc_ppc64.o
index 310931dbd4aefe6ba50d45ef866e084e5b685ead..87474584033fe83774c37ba431b9c252d7d667ab 100644 (file)
@@ -392,7 +392,7 @@ int virt_irq_create_mapping(unsigned int real_irq)
        if (ppc64_interrupt_controller == IC_OPEN_PIC)
                return real_irq;        /* no mapping for openpic (for now) */
 
-       if (ppc64_interrupt_controller == IC_BPA_IIC)
+       if (ppc64_interrupt_controller == IC_CELL_PIC)
                return real_irq;        /* no mapping for iic either */
 
        /* don't map interrupts < MIN_VIRT_IRQ */
index a87c66a9652ad7c799ce9e8f15ef8e9a8305e81e..24e955ee9487420ac5b82945c0464aa08a80a17b 100644 (file)
@@ -53,7 +53,7 @@ static int __init proc_ppc64_create(void)
        if (!root)
                return 1;
 
-       if (!(systemcfg->platform & (PLATFORM_PSERIES | PLATFORM_BPA)))
+       if (!(systemcfg->platform & (PLATFORM_PSERIES | PLATFORM_CELL)))
                return 0;
 
        if (!proc_mkdir("rtas", root))
index 69924ba4d7d9a774a2ae1de81d806fbc7f6d0cb4..a4bbca6dbb8b4624f01d150840ebeff031f0860b 100644 (file)
@@ -1939,9 +1939,9 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, unsigned long
                prom_send_capabilities();
 
        /*
-        * On pSeries and BPA, copy the CPU hold code
+        * On pSeries and Cell, copy the CPU hold code
         */
-               if (RELOC(of_platform) & (PLATFORM_PSERIES | PLATFORM_BPA))
+               if (RELOC(of_platform) & (PLATFORM_PSERIES | PLATFORM_CELL))
                        copy_and_flush(0, KERNELBASE - offset, 0x100, 0);
 
        /*
diff --git a/arch/ppc64/lib/Makefile b/arch/ppc64/lib/Makefile
deleted file mode 100644 (file)
index 42d5295..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Makefile for ppc64-specific library files..
-#
-
-lib-y := string.o
diff --git a/arch/ppc64/lib/string.S b/arch/ppc64/lib/string.S
deleted file mode 100644 (file)
index e21a003..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * String handling functions for PowerPC.
- *
- * Copyright (C) 1996 Paul Mackerras.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-#include <asm/processor.h>
-#include <asm/errno.h>
-#include <asm/ppc_asm.h>
-
-_GLOBAL(strcpy)
-       addi    r5,r3,-1
-       addi    r4,r4,-1
-1:     lbzu    r0,1(r4)
-       cmpwi   0,r0,0
-       stbu    r0,1(r5)
-       bne     1b
-       blr
-
-_GLOBAL(strncpy)
-       cmpwi   0,r5,0
-       beqlr
-       mtctr   r5
-       addi    r6,r3,-1
-       addi    r4,r4,-1
-1:     lbzu    r0,1(r4)
-       cmpwi   0,r0,0
-       stbu    r0,1(r6)
-       bdnzf   2,1b            /* dec ctr, branch if ctr != 0 && !cr0.eq */
-       blr
-
-_GLOBAL(strcat)
-       addi    r5,r3,-1
-       addi    r4,r4,-1
-1:     lbzu    r0,1(r5)
-       cmpwi   0,r0,0
-       bne     1b
-       addi    r5,r5,-1
-1:     lbzu    r0,1(r4)
-       cmpwi   0,r0,0
-       stbu    r0,1(r5)
-       bne     1b
-       blr
-
-_GLOBAL(strcmp)
-       addi    r5,r3,-1
-       addi    r4,r4,-1
-1:     lbzu    r3,1(r5)
-       cmpwi   1,r3,0
-       lbzu    r0,1(r4)
-       subf.   r3,r0,r3
-       beqlr   1
-       beq     1b
-       blr
-
-_GLOBAL(strlen)
-       addi    r4,r3,-1
-1:     lbzu    r0,1(r4)
-       cmpwi   0,r0,0
-       bne     1b
-       subf    r3,r3,r4
-       blr
-
-_GLOBAL(memcmp)
-       cmpwi   0,r5,0
-       ble-    2f
-       mtctr   r5
-       addi    r6,r3,-1
-       addi    r4,r4,-1
-1:     lbzu    r3,1(r6)
-       lbzu    r0,1(r4)
-       subf.   r3,r0,r3
-       bdnzt   2,1b
-       blr
-2:     li      r3,0
-       blr
-
-_GLOBAL(memchr)
-       cmpwi   0,r5,0
-       ble-    2f
-       mtctr   r5
-       addi    r3,r3,-1
-1:     lbzu    r0,1(r3)
-       cmpw    0,r0,r4
-       bdnzf   2,1b
-       beqlr
-2:     li      r3,0
-       blr
-
-_GLOBAL(__clear_user)
-       addi    r6,r3,-4
-       li      r3,0
-       li      r5,0
-       cmplwi  0,r4,4
-       blt     7f
-       /* clear a single word */
-11:    stwu    r5,4(r6)
-       beqlr
-       /* clear word sized chunks */
-       andi.   r0,r6,3
-       add     r4,r0,r4
-       subf    r6,r0,r6
-       srwi    r0,r4,2
-       andi.   r4,r4,3
-       mtctr   r0
-       bdz     7f
-1:     stwu    r5,4(r6)
-       bdnz    1b
-       /* clear byte sized chunks */
-7:     cmpwi   0,r4,0
-       beqlr
-       mtctr   r4
-       addi    r6,r6,3
-8:     stbu    r5,1(r6)
-       bdnz    8b
-       blr
-90:    mr      r3,r4
-       blr
-91:    mfctr   r3
-       slwi    r3,r3,2
-       add     r3,r3,r4
-       blr
-92:    mfctr   r3
-       blr
-
-       .section __ex_table,"a"
-       .align  3
-       .llong  11b,90b
-       .llong  1b,91b
-       .llong  8b,92b
-       .text
-
-/* r3 = dst, r4 = src, r5 = count */
-_GLOBAL(__strncpy_from_user)
-       addi    r6,r3,-1
-       addi    r4,r4,-1
-       cmpwi   0,r5,0
-       beq     2f
-       mtctr   r5
-1:     lbzu    r0,1(r4)
-       cmpwi   0,r0,0
-       stbu    r0,1(r6)
-       bdnzf   2,1b            /* dec ctr, branch if ctr != 0 && !cr0.eq */
-       beq     3f
-2:     addi    r6,r6,1
-3:     subf    r3,r3,r6
-       blr
-99:    li      r3,-EFAULT
-       blr
-
-       .section __ex_table,"a"
-       .align  3
-       .llong  1b,99b
-       .text
-
-/* r3 = str, r4 = len (> 0) */
-_GLOBAL(__strnlen_user)
-       addi    r7,r3,-1
-       mtctr   r4              /* ctr = len */
-1:     lbzu    r0,1(r7)        /* get next byte */
-       cmpwi   0,r0,0
-       bdnzf   2,1b            /* loop if --ctr != 0 && byte != 0 */
-       addi    r7,r7,1
-       subf    r3,r3,r7        /* number of bytes we have looked at */
-       beqlr                   /* return if we found a 0 byte */
-       cmpw    0,r3,r4         /* did we look at all len bytes? */
-       blt     99f             /* if not, must have hit top */
-       addi    r3,r4,1         /* return len + 1 to indicate no null found */
-       blr
-99:    li      r3,0            /* bad address, return 0 */
-       blr
-
-       .section __ex_table,"a"
-       .align  3
-       .llong  1b,99b
index 91920a1140fa1335ea76135580cc29e85f6518fe..9bc6cc6e384546faee4b068fa5aa87e0e350fe5d 100644 (file)
@@ -155,10 +155,10 @@ static spinlock_t pmu_lock;
 static u8 pmu_intr_mask;
 static int pmu_version;
 static int drop_interrupts;
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
 static int option_lid_wakeup = 1;
 static int sleep_in_progress;
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM && CONFIG_PPC32 */
 static unsigned long async_req_locks;
 static unsigned int pmu_irq_stats[11];
 
@@ -865,7 +865,7 @@ proc_read_options(char *page, char **start, off_t off,
 {
        char *p = page;
 
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
        if (pmu_kind == PMU_KEYLARGO_BASED &&
            pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
                p += sprintf(p, "lid_wakeup=%d\n", option_lid_wakeup);
@@ -906,7 +906,7 @@ proc_write_options(struct file *file, const char __user *buffer,
        *(val++) = 0;
        while(*val == ' ')
                val++;
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
        if (pmu_kind == PMU_KEYLARGO_BASED &&
            pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
                if (!strcmp(label, "lid_wakeup"))
@@ -2063,6 +2063,9 @@ pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* n)
        n->list.next = NULL;
        return 0;
 }
+#endif /* CONFIG_PM */
+
+#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
 
 /* Sleep is broadcast last-to-first */
 static int
@@ -2687,7 +2690,7 @@ powerbook_sleep_3400(void)
        return 0;
 }
 
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM && CONFIG_PPC32 */
 
 /*
  * Support for /dev/pmu device
@@ -2871,7 +2874,7 @@ pmu_ioctl(struct inode * inode, struct file *filp,
        int error = -EINVAL;
 
        switch (cmd) {
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
        case PMU_IOC_SLEEP:
                if (!capable(CAP_SYS_ADMIN))
                        return -EACCES;
@@ -2899,7 +2902,7 @@ pmu_ioctl(struct inode * inode, struct file *filp,
                        return put_user(0, argp);
                else
                        return put_user(1, argp);
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM && CONFIG_PPC32 */
 
 #ifdef CONFIG_PMAC_BACKLIGHT
        /* Backlight should have its own device or go via
@@ -3047,7 +3050,7 @@ pmu_polled_request(struct adb_request *req)
  * to do suspend-to-disk.
  */
 
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
 
 static int pmu_sys_suspended = 0;
 
@@ -3082,7 +3085,7 @@ static int pmu_sys_resume(struct sys_device *sysdev)
        return 0;
 }
 
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM && CONFIG_PPC32 */
 
 static struct sysdev_class pmu_sysclass = {
        set_kset_name("pmu"),
@@ -3094,10 +3097,10 @@ static struct sys_device device_pmu = {
 };
 
 static struct sysdev_driver driver_pmu = {
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
        .suspend        = &pmu_sys_suspend,
        .resume         = &pmu_sys_resume,
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM && CONFIG_PPC32 */
 };
 
 static int __init init_pmu_sysfs(void)
@@ -3135,12 +3138,12 @@ EXPORT_SYMBOL(pmu_i2c_combined_read);
 EXPORT_SYMBOL(pmu_i2c_stdsub_write);
 EXPORT_SYMBOL(pmu_i2c_simple_read);
 EXPORT_SYMBOL(pmu_i2c_simple_write);
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
 EXPORT_SYMBOL(pmu_register_sleep_notifier);
 EXPORT_SYMBOL(pmu_unregister_sleep_notifier);
 EXPORT_SYMBOL(pmu_enable_irled);
 EXPORT_SYMBOL(pmu_battery_count);
 EXPORT_SYMBOL(pmu_batteries);
 EXPORT_SYMBOL(pmu_power_flags);
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM && CONFIG_PPC32 */
 
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
new file mode 100644 (file)
index 0000000..dc25c53
--- /dev/null
@@ -0,0 +1,437 @@
+/*
+ * PowerPC atomic bit operations.
+ *
+ * Merged version by David Gibson <david@gibson.dropbear.id.au>.
+ * Based on ppc64 versions by: Dave Engebretsen, Todd Inglett, Don
+ * Reed, Pat McCarthy, Peter Bergner, Anton Blanchard.  They
+ * originally took it from the ppc32 code.
+ *
+ * Within a word, bits are numbered LSB first.  Lot's of places make
+ * this assumption by directly testing bits with (val & (1<<nr)).
+ * This can cause confusion for large (> 1 word) bitmaps on a
+ * big-endian system because, unlike little endian, the number of each
+ * bit depends on the word size.
+ *
+ * The bitop functions are defined to work on unsigned longs, so for a
+ * ppc64 system the bits end up numbered:
+ *   |63..............0|127............64|191...........128|255...........196|
+ * and on ppc32:
+ *   |31.....0|63....31|95....64|127...96|159..128|191..160|223..192|255..224|
+ *
+ * There are a few little-endian macros used mostly for filesystem
+ * bitmaps, these work on similar bit arrays layouts, but
+ * byte-oriented:
+ *   |7...0|15...8|23...16|31...24|39...32|47...40|55...48|63...56|
+ *
+ * The main difference is that bit 3-5 (64b) or 3-4 (32b) in the bit
+ * number field needs to be reversed compared to the big-endian bit
+ * fields. This can be achieved by XOR with 0x38 (64b) or 0x18 (32b).
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _ASM_POWERPC_BITOPS_H
+#define _ASM_POWERPC_BITOPS_H
+
+#ifdef __KERNEL__
+
+#include <linux/compiler.h>
+#include <asm/atomic.h>
+#include <asm/synch.h>
+
+/*
+ * clear_bit doesn't imply a memory barrier
+ */
+#define smp_mb__before_clear_bit()     smp_mb()
+#define smp_mb__after_clear_bit()      smp_mb()
+
+#define BITOP_MASK(nr)         (1UL << ((nr) % BITS_PER_LONG))
+#define BITOP_WORD(nr)         ((nr) / BITS_PER_LONG)
+#define BITOP_LE_SWIZZLE       ((BITS_PER_LONG-1) & ~0x7)
+
+#ifdef CONFIG_PPC64
+#define LARXL          "ldarx"
+#define STCXL          "stdcx."
+#define CNTLZL         "cntlzd"
+#else
+#define LARXL          "lwarx"
+#define STCXL          "stwcx."
+#define CNTLZL         "cntlzw"
+#endif
+
+static __inline__ void set_bit(int nr, volatile unsigned long *addr)
+{
+       unsigned long old;
+       unsigned long mask = BITOP_MASK(nr);
+       unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+       __asm__ __volatile__(
+"1:"   LARXL " %0,0,%3 # set_bit\n"
+       "or     %0,%0,%2\n"
+       PPC405_ERR77(0,%3)
+       STCXL " %0,0,%3\n"
+       "bne-   1b"
+       : "=&r"(old), "=m"(*p)
+       : "r"(mask), "r"(p), "m"(*p)
+       : "cc" );
+}
+
+static __inline__ void clear_bit(int nr, volatile unsigned long *addr)
+{
+       unsigned long old;
+       unsigned long mask = BITOP_MASK(nr);
+       unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+       __asm__ __volatile__(
+"1:"   LARXL " %0,0,%3 # set_bit\n"
+       "andc   %0,%0,%2\n"
+       PPC405_ERR77(0,%3)
+       STCXL " %0,0,%3\n"
+       "bne-   1b"
+       : "=&r"(old), "=m"(*p)
+       : "r"(mask), "r"(p), "m"(*p)
+       : "cc" );
+}
+
+static __inline__ void change_bit(int nr, volatile unsigned long *addr)
+{
+       unsigned long old;
+       unsigned long mask = BITOP_MASK(nr);
+       unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+       __asm__ __volatile__(
+"1:"   LARXL " %0,0,%3 # set_bit\n"
+       "xor    %0,%0,%2\n"
+       PPC405_ERR77(0,%3)
+       STCXL " %0,0,%3\n"
+       "bne-   1b"
+       : "=&r"(old), "=m"(*p)
+       : "r"(mask), "r"(p), "m"(*p)
+       : "cc" );
+}
+
+static __inline__ int test_and_set_bit(unsigned long nr,
+                                      volatile unsigned long *addr)
+{
+       unsigned long old, t;
+       unsigned long mask = BITOP_MASK(nr);
+       unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+       __asm__ __volatile__(
+       EIEIO_ON_SMP
+"1:"   LARXL " %0,0,%3         # test_and_set_bit\n"
+       "or     %1,%0,%2 \n"
+       PPC405_ERR77(0,%3)
+       STCXL " %1,0,%3 \n"
+       "bne-   1b"
+       ISYNC_ON_SMP
+       : "=&r" (old), "=&r" (t)
+       : "r" (mask), "r" (p)
+       : "cc", "memory");
+
+       return (old & mask) != 0;
+}
+
+static __inline__ int test_and_clear_bit(unsigned long nr,
+                                        volatile unsigned long *addr)
+{
+       unsigned long old, t;
+       unsigned long mask = BITOP_MASK(nr);
+       unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+       __asm__ __volatile__(
+       EIEIO_ON_SMP
+"1:"   LARXL " %0,0,%3         # test_and_clear_bit\n"
+       "andc   %1,%0,%2 \n"
+       PPC405_ERR77(0,%3)
+       STCXL " %1,0,%3 \n"
+       "bne-   1b"
+       ISYNC_ON_SMP
+       : "=&r" (old), "=&r" (t)
+       : "r" (mask), "r" (p)
+       : "cc", "memory");
+
+       return (old & mask) != 0;
+}
+
+static __inline__ int test_and_change_bit(unsigned long nr,
+                                         volatile unsigned long *addr)
+{
+       unsigned long old, t;
+       unsigned long mask = BITOP_MASK(nr);
+       unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+       __asm__ __volatile__(
+       EIEIO_ON_SMP
+"1:"   LARXL " %0,0,%3         # test_and_change_bit\n"
+       "xor    %1,%0,%2 \n"
+       PPC405_ERR77(0,%3)
+       STCXL " %1,0,%3 \n"
+       "bne-   1b"
+       ISYNC_ON_SMP
+       : "=&r" (old), "=&r" (t)
+       : "r" (mask), "r" (p)
+       : "cc", "memory");
+
+       return (old & mask) != 0;
+}
+
+static __inline__ void set_bits(unsigned long mask, unsigned long *addr)
+{
+        unsigned long old;
+
+       __asm__ __volatile__(
+"1:"   LARXL " %0,0,%3         # set_bit\n"
+       "or     %0,%0,%2\n"
+       STCXL " %0,0,%3\n"
+       "bne-   1b"
+       : "=&r" (old), "=m" (*addr)
+       : "r" (mask), "r" (addr), "m" (*addr)
+       : "cc");
+}
+
+/* Non-atomic versions */
+static __inline__ int test_bit(unsigned long nr,
+                              __const__ volatile unsigned long *addr)
+{
+       return 1UL & (addr[BITOP_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
+}
+
+static __inline__ void __set_bit(unsigned long nr,
+                                volatile unsigned long *addr)
+{
+       unsigned long mask = BITOP_MASK(nr);
+       unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+       *p  |= mask;
+}
+
+static __inline__ void __clear_bit(unsigned long nr,
+                                  volatile unsigned long *addr)
+{
+       unsigned long mask = BITOP_MASK(nr);
+       unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+       *p &= ~mask;
+}
+
+static __inline__ void __change_bit(unsigned long nr,
+                                   volatile unsigned long *addr)
+{
+       unsigned long mask = BITOP_MASK(nr);
+       unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+       *p ^= mask;
+}
+
+static __inline__ int __test_and_set_bit(unsigned long nr,
+                                        volatile unsigned long *addr)
+{
+       unsigned long mask = BITOP_MASK(nr);
+       unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+       unsigned long old = *p;
+
+       *p = old | mask;
+       return (old & mask) != 0;
+}
+
+static __inline__ int __test_and_clear_bit(unsigned long nr,
+                                          volatile unsigned long *addr)
+{
+       unsigned long mask = BITOP_MASK(nr);
+       unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+       unsigned long old = *p;
+
+       *p = old & ~mask;
+       return (old & mask) != 0;
+}
+
+static __inline__ int __test_and_change_bit(unsigned long nr,
+                                           volatile unsigned long *addr)
+{
+       unsigned long mask = BITOP_MASK(nr);
+       unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+       unsigned long old = *p;
+
+       *p = old ^ mask;
+       return (old & mask) != 0;
+}
+
+/*
+ * Return the zero-based bit position (LE, not IBM bit numbering) of
+ * the most significant 1-bit in a double word.
+ */
+static __inline__ int __ilog2(unsigned long x)
+{
+       int lz;
+
+       asm (CNTLZL " %0,%1" : "=r" (lz) : "r" (x));
+       return BITS_PER_LONG - 1 - lz;
+}
+
+/*
+ * Determines the bit position of the least significant 0 bit in the
+ * specified double word. The returned bit position will be
+ * zero-based, starting from the right side (63/31 - 0).
+ */
+static __inline__ unsigned long ffz(unsigned long x)
+{
+       /* no zero exists anywhere in the 8 byte area. */
+       if ((x = ~x) == 0)
+               return BITS_PER_LONG;
+
+       /*
+        * Calculate the bit position of the least signficant '1' bit in x
+        * (since x has been changed this will actually be the least signficant
+        * '0' bit in * the original x).  Note: (x & -x) gives us a mask that
+        * is the least significant * (RIGHT-most) 1-bit of the value in x.
+        */
+       return __ilog2(x & -x);
+}
+
+static __inline__ int __ffs(unsigned long x)
+{
+       return __ilog2(x & -x);
+}
+
+/*
+ * 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).
+ */
+static __inline__ int ffs(int x)
+{
+       unsigned long i = (unsigned long)x;
+       return __ilog2(i & -i) + 1;
+}
+
+/*
+ * fls: find last (most-significant) bit set.
+ * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
+ */
+static __inline__ int fls(unsigned int x)
+{
+       int lz;
+
+       asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
+       return 32 - lz;
+}
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+#define hweight64(x) generic_hweight64(x)
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
+#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
+unsigned long find_next_zero_bit(const unsigned long *addr,
+                                unsigned long size, unsigned long offset);
+/**
+ * find_first_bit - find the first set bit in a memory region
+ * @addr: The address to start the search at
+ * @size: The maximum size to search
+ *
+ * Returns the bit-number of the first set bit, not the number of the byte
+ * containing a bit.
+ */
+#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
+unsigned long find_next_bit(const unsigned long *addr,
+                           unsigned long size, unsigned long offset);
+
+/* Little-endian versions */
+
+static __inline__ int test_le_bit(unsigned long nr,
+                                 __const__ unsigned long *addr)
+{
+       __const__ unsigned char *tmp = (__const__ unsigned char *) addr;
+       return (tmp[nr >> 3] >> (nr & 7)) & 1;
+}
+
+#define __set_le_bit(nr, addr) \
+       __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+#define __clear_le_bit(nr, addr) \
+       __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+#define test_and_set_le_bit(nr, addr) \
+       test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+#define test_and_clear_le_bit(nr, addr) \
+       test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+#define __test_and_set_le_bit(nr, addr) \
+       __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+#define __test_and_clear_le_bit(nr, addr) \
+       __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+
+#define find_first_zero_le_bit(addr, size) find_next_zero_le_bit((addr), (size), 0)
+unsigned long find_next_zero_le_bit(const unsigned long *addr,
+                                   unsigned long size, unsigned long offset);
+
+/* Bitmap functions for the ext2 filesystem */
+
+#define ext2_set_bit(nr,addr) \
+       __test_and_set_le_bit((nr), (unsigned long*)addr)
+#define ext2_clear_bit(nr, addr) \
+       __test_and_clear_le_bit((nr), (unsigned long*)addr)
+
+#define ext2_set_bit_atomic(lock, nr, addr) \
+       test_and_set_le_bit((nr), (unsigned long*)addr)
+#define ext2_clear_bit_atomic(lock, nr, addr) \
+       test_and_clear_le_bit((nr), (unsigned long*)addr)
+
+#define ext2_test_bit(nr, addr)      test_le_bit((nr),(unsigned long*)addr)
+
+#define ext2_find_first_zero_bit(addr, size) \
+       find_first_zero_le_bit((unsigned long*)addr, size)
+#define ext2_find_next_zero_bit(addr, size, off) \
+       find_next_zero_le_bit((unsigned long*)addr, size, off)
+
+/* Bitmap functions for the minix filesystem.  */
+
+#define minix_test_and_set_bit(nr,addr) \
+       __test_and_set_le_bit(nr, (unsigned long *)addr)
+#define minix_set_bit(nr,addr) \
+       __set_le_bit(nr, (unsigned long *)addr)
+#define minix_test_and_clear_bit(nr,addr) \
+       __test_and_clear_le_bit(nr, (unsigned long *)addr)
+#define minix_test_bit(nr,addr) \
+       test_le_bit(nr, (unsigned long *)addr)
+
+#define minix_find_first_zero_bit(addr,size) \
+       find_first_zero_le_bit((unsigned long *)addr, size)
+
+/*
+ * Every architecture must define this function. It's the fastest
+ * way of searching a 140-bit bitmap where the first 100 bits are
+ * unlikely to be set. It's guaranteed that at least one of the 140
+ * bits is cleared.
+ */
+static inline int sched_find_first_bit(const unsigned long *b)
+{
+#ifdef CONFIG_PPC64
+       if (unlikely(b[0]))
+               return __ffs(b[0]);
+       if (unlikely(b[1]))
+               return __ffs(b[1]) + 64;
+       return __ffs(b[2]) + 128;
+#else
+       if (unlikely(b[0]))
+               return __ffs(b[0]);
+       if (unlikely(b[1]))
+               return __ffs(b[1]) + 32;
+       if (unlikely(b[2]))
+               return __ffs(b[2]) + 64;
+       if (b[3])
+               return __ffs(b[3]) + 96;
+       return __ffs(b[4]) + 128;
+#endif
+}
+
+#endif /* __KERNEL__ */
+
+#endif /* _ASM_POWERPC_BITOPS_H */
index e4d028e8702042d3573117b53241dfda23f48fab..d625ee55f9571e68503cbd43d01240de1875d22b 100644 (file)
 #ifndef __ASSEMBLY__
 
 #ifdef __powerpc64__
-#define BUG_TABLE_ENTRY(label, line, file, func) \
-       ".llong " #label "\n .long " #line "\n .llong " #file ", " #func "\n"
-#define TRAP_OP(ra, rb) "1: tdnei " #ra ", " #rb "\n"
-#define DATA_TYPE long long
+#define BUG_TABLE_ENTRY                ".llong"
+#define BUG_TRAP_OP            "tdnei"
 #else 
-#define BUG_TABLE_ENTRY(label, line, file, func) \
-       ".long " #label ", " #line ", " #file ", " #func "\n"
-#define TRAP_OP(ra, rb) "1: twnei " #ra ", " #rb "\n"
-#define DATA_TYPE int
+#define BUG_TABLE_ENTRY                ".long"
+#define BUG_TRAP_OP            "twnei"
 #endif /* __powerpc64__ */
 
 struct bug_entry {
        unsigned long   bug_addr;
-       int             line;
+       long            line;
        const char      *file;
        const char      *function;
 };
@@ -43,29 +39,29 @@ struct bug_entry *find_bug(unsigned long bugaddr);
 #define BUG() do {                                                      \
        __asm__ __volatile__(                                            \
                "1:     twi 31,0,0\n"                                    \
-               ".section __bug_table,\"a\"\n\t"                         \
-               BUG_TABLE_ENTRY(1b,%0,%1,%2)                             \
+               ".section __bug_table,\"a\"\n"                           \
+               "\t"BUG_TABLE_ENTRY"    1b,%0,%1,%2\n"                   \
                ".previous"                                              \
                : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \
 } while (0)
 
 #define BUG_ON(x) do {                                         \
        __asm__ __volatile__(                                   \
-               TRAP_OP(%0,0)                                   \
-               ".section __bug_table,\"a\"\n\t"                \
-               BUG_TABLE_ENTRY(1b,%1,%2,%3)                    \
+               "1:     "BUG_TRAP_OP"   %0,0\n"                 \
+               ".section __bug_table,\"a\"\n"                  \
+               "\t"BUG_TABLE_ENTRY"    1b,%1,%2,%3\n"          \
                ".previous"                                     \
-               : : "r" ((DATA_TYPE)(x)), "i" (__LINE__),       \
+               : : "r" ((long)(x)), "i" (__LINE__),            \
                    "i" (__FILE__), "i" (__FUNCTION__));        \
 } while (0)
 
 #define WARN_ON(x) do {                                                \
        __asm__ __volatile__(                                   \
-               TRAP_OP(%0,0)                                   \
-               ".section __bug_table,\"a\"\n\t"                \
-               BUG_TABLE_ENTRY(1b,%1,%2,%3)                    \
+               "1:     "BUG_TRAP_OP"   %0,0\n"                 \
+               ".section __bug_table,\"a\"\n"                  \
+               "\t"BUG_TABLE_ENTRY"    1b,%1,%2,%3\n"          \
                ".previous"                                     \
-               : : "r" ((DATA_TYPE)(x)),                       \
+               : : "r" ((long)(x)),                            \
                    "i" (__LINE__ + BUG_WARNING_TRAP),          \
                    "i" (__FILE__), "i" (__FUNCTION__));        \
 } while (0)
similarity index 71%
rename from include/asm-ppc64/futex.h
rename to include/asm-powerpc/futex.h
index 266b460de44e1dcb6cbe69917ce64e49001a08f6..37c94e52ab6dd6a5bb0d41bbdfb2a2082479e0b5 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _ASM_FUTEX_H
-#define _ASM_FUTEX_H
+#ifndef _ASM_POWERPC_FUTEX_H
+#define _ASM_POWERPC_FUTEX_H
 
 #ifdef __KERNEL__
 
@@ -7,28 +7,29 @@
 #include <asm/errno.h>
 #include <asm/synch.h>
 #include <asm/uaccess.h>
+#include <asm/ppc_asm.h>
 
 #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
-  __asm__ __volatile (SYNC_ON_SMP                              \
-"1:    lwarx   %0,0,%2\n"                                      \
-       insn                                                    \
-"2:    stwcx.  %1,0,%2\n\
-       bne-    1b\n\
-       li      %1,0\n\
-3:     .section .fixup,\"ax\"\n\
-4:     li      %1,%3\n\
-       b       3b\n\
-       .previous\n\
-       .section __ex_table,\"a\"\n\
-       .align 3\n\
-       .llong  1b,4b,2b,4b\n\
-       .previous"                                              \
-       : "=&r" (oldval), "=&r" (ret)                           \
-       : "b" (uaddr), "i" (-EFAULT), "1" (oparg)               \
+  __asm__ __volatile ( \
+       SYNC_ON_SMP \
+"1:    lwarx   %0,0,%2\n" \
+       insn \
+"2:    stwcx.  %1,0,%2\n" \
+       "bne-   1b\n" \
+       "li     %1,0\n" \
+"3:    .section .fixup,\"ax\"\n" \
+"4:    li      %1,%3\n" \
+       "b      3b\n" \
+       ".previous\n" \
+       ".section __ex_table,\"a\"\n" \
+       ".align 3\n" \
+       DATAL " 1b,4b,2b,4b\n" \
+       ".previous" \
+       : "=&r" (oldval), "=&r" (ret) \
+       : "b" (uaddr), "i" (-EFAULT), "1" (oparg) \
        : "cr0", "memory")
 
-static inline int
-futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
+static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
 {
        int op = (encoded_op >> 28) & 7;
        int cmp = (encoded_op >> 24) & 15;
@@ -79,5 +80,5 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
        return ret;
 }
 
-#endif
-#endif
+#endif /* __KERNEL__ */
+#endif /* _ASM_POWERPC_FUTEX_H */
index 5b94ff489b8b42c4d8bded2b088e1c62438d0d6b..279a6229584b010d136036823cb00f02950e6c3b 100644 (file)
@@ -62,6 +62,9 @@
 # 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
 
 #define TIOCGSOFTCAR   0x5419
 #define TIOCSSOFTCAR   0x541A
diff --git a/include/asm-powerpc/ipcbuf.h b/include/asm-powerpc/ipcbuf.h
new file mode 100644 (file)
index 0000000..71382c1
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _ASM_POWERPC_IPCBUF_H
+#define _ASM_POWERPC_IPCBUF_H
+
+/*
+ * The ipc64_perm structure for the powerpc is identical to
+ * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the
+ * kernel.  Note extra padding because this structure is passed back
+ * and forth between kernel and user space.  Pad space is left for:
+ *     - 1 32-bit value to fill up for 8-byte alignment
+ *     - 2 miscellaneous 64-bit values
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/types.h>
+
+struct ipc64_perm
+{
+       __kernel_key_t  key;
+       __kernel_uid_t  uid;
+       __kernel_gid_t  gid;
+       __kernel_uid_t  cuid;
+       __kernel_gid_t  cgid;
+       __kernel_mode_t mode;
+       unsigned int    seq;
+       unsigned int    __pad1;
+       __u32           __unused[4];
+};
+
+#endif /* _ASM_POWERPC_IPCBUF_H */
index c7c3f912a3c2c426266baa0ec6f91b910be79bff..b3935ea28fff181a4b3a30bb0d485b3eab15e9ad 100644 (file)
@@ -73,7 +73,7 @@ extern unsigned int real_irq_to_virt_slowpath(unsigned int real_irq);
 #define IC_INVALID    0
 #define IC_OPEN_PIC   1
 #define IC_PPC_XIC    2
-#define IC_BPA_IIC    3
+#define IC_CELL_PIC   3
 #define IC_ISERIES    4
 
 extern u64 ppc64_interrupt_controller;
index f99f2af82ca564fb9377d5cd5cdb70be70d12887..c534ca41224b6cea93d31fd29fdba6445da5dcbc 100644 (file)
@@ -506,6 +506,13 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
 #else
   #define __ASM_CONST(x) x##UL
   #define ASM_CONST(x) __ASM_CONST(x)
+
+#ifdef CONFIG_PPC64
+#define DATAL  ".llong"
+#else
+#define DATAL  ".long"
+#endif
+
 #endif /*  __ASSEMBLY__ */
 
 #endif /* _ASM_POWERPC_PPC_ASM_H */
index eee954a001fdb7aef5710fa37948ed1cf7dbdedf..1dc4bf7b52b302533b2909ff688d883816cf1b9a 100644 (file)
@@ -70,7 +70,7 @@ extern unsigned char ucBoardRevMaj, ucBoardRevMin;
 #define PLATFORM_LPAR         0x0001
 #define PLATFORM_POWERMAC     0x0400
 #define PLATFORM_MAPLE        0x0500
-#define PLATFORM_BPA          0x1000
+#define PLATFORM_CELL         0x1000
 
 /* Compatibility with drivers coming from PPC32 world */
 #define _machine       (systemcfg->platform)
index 2c050332471db29d7bedd4ed1fc4f36b5f485605..d9fd7866927ff8b60eaa121d98454d4878a3c1c6 100644 (file)
@@ -171,6 +171,9 @@ struct flash_block_list_header { /* just the header of flash_block_list */
        struct flash_block_list *next;
 };
 extern struct flash_block_list_header rtas_firmware_flash_list;
+void rtas_fw_restart(char *cmd);
+void rtas_fw_power_off(void);
+void rtas_fw_halt(void);
 
 extern struct rtas_t rtas;
 
index c5b8e5358f830c337d026ea3f1c68bc345a35178..7f80a019b6a00310b572d3c57d5a955148b41e06 100644 (file)
@@ -94,142 +94,9 @@ struct termio {
 #define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" 
 #endif
 
-#define FIOCLEX                _IO('f', 1)
-#define FIONCLEX       _IO('f', 2)
-#define FIOASYNC       _IOW('f', 125, int)
-#define FIONBIO                _IOW('f', 126, int)
-#define FIONREAD       _IOR('f', 127, int)
-#define TIOCINQ                FIONREAD
-
-#define TIOCGETP       _IOR('t', 8, struct sgttyb)
-#define TIOCSETP       _IOW('t', 9, struct sgttyb)
-#define TIOCSETN       _IOW('t', 10, struct sgttyb)    /* TIOCSETP wo flush */
-
-#define TIOCSETC       _IOW('t', 17, struct tchars)
-#define TIOCGETC       _IOR('t', 18, struct tchars)
-#define TCGETS         _IOR('t', 19, struct termios)
-#define TCSETS         _IOW('t', 20, struct termios)
-#define TCSETSW                _IOW('t', 21, struct termios)
-#define TCSETSF                _IOW('t', 22, struct termios)
-
-#define TCGETA         _IOR('t', 23, struct termio)
-#define TCSETA         _IOW('t', 24, struct termio)
-#define TCSETAW                _IOW('t', 25, struct termio)
-#define TCSETAF                _IOW('t', 28, struct termio)
-
-#define TCSBRK         _IO('t', 29)
-#define TCXONC         _IO('t', 30)
-#define TCFLSH         _IO('t', 31)
-
-#define TIOCSWINSZ     _IOW('t', 103, struct winsize)
-#define TIOCGWINSZ     _IOR('t', 104, struct winsize)
-#define        TIOCSTART       _IO('t', 110)           /* start output, like ^Q */
-#define        TIOCSTOP        _IO('t', 111)           /* stop output, like ^S */
-#define TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */
-
-#define TIOCGLTC       _IOR('t', 116, struct ltchars)
-#define TIOCSLTC       _IOW('t', 117, struct ltchars)
-#define TIOCSPGRP      _IOW('t', 118, int)
-#define TIOCGPGRP      _IOR('t', 119, int)
-
-#define TIOCEXCL       0x540C
-#define TIOCNXCL       0x540D
-#define TIOCSCTTY      0x540E
-
-#define TIOCSTI                0x5412
-#define TIOCMGET       0x5415
-#define TIOCMBIS       0x5416
-#define TIOCMBIC       0x5417
-#define TIOCMSET       0x5418
-#define TIOCGSOFTCAR   0x5419
-#define TIOCSSOFTCAR   0x541A
-#define TIOCLINUX      0x541C
-#define TIOCCONS       0x541D
-#define TIOCGSERIAL    0x541E
-#define TIOCSSERIAL    0x541F
-#define TIOCPKT                0x5420
-
-#define TIOCNOTTY      0x5422
-#define TIOCSETD       0x5423
-#define TIOCGETD       0x5424
-#define TCSBRKP                0x5425  /* Needed for POSIX tcsendbreak() */
-
-#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 */
-
-/* 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
-
-/* 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 */
-#define TIOCSER_TEMT    0x01   /* Transmitter physically empty */
-
 #ifdef __KERNEL__
 
-/*
- * Translate a "termio" structure into a "termios". Ugh.
- */
-#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
-       unsigned short __tmp; \
-       get_user(__tmp,&(termio)->x); \
-       (termios)->x = (0xffff0000 & (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))
+#include <asm-generic/termios.h>
 
 #endif /* __KERNEL__ */
 
diff --git a/include/asm-powerpc/uaccess.h b/include/asm-powerpc/uaccess.h
new file mode 100644 (file)
index 0000000..33af730
--- /dev/null
@@ -0,0 +1,468 @@
+#ifndef _ARCH_POWERPC_UACCESS_H
+#define _ARCH_POWERPC_UACCESS_H
+
+#ifdef __KERNEL__
+#ifndef __ASSEMBLY__
+
+#include <linux/sched.h>
+#include <linux/errno.h>
+#include <asm/processor.h>
+
+#define VERIFY_READ    0
+#define VERIFY_WRITE   1
+
+/*
+ * The fs value determines whether argument validity checking should be
+ * performed or not.  If get_fs() == USER_DS, checking is performed, with
+ * get_fs() == KERNEL_DS, checking is bypassed.
+ *
+ * For historical reasons, these macros are grossly misnamed.
+ *
+ * The fs/ds values are now the highest legal address in the "segment".
+ * This simplifies the checking in the routines below.
+ */
+
+#define MAKE_MM_SEG(s)  ((mm_segment_t) { (s) })
+
+#define KERNEL_DS      MAKE_MM_SEG(~0UL)
+#ifdef __powerpc64__
+/* We use TASK_SIZE_USER64 as TASK_SIZE is not constant */
+#define USER_DS                MAKE_MM_SEG(TASK_SIZE_USER64 - 1)
+#else
+#define USER_DS                MAKE_MM_SEG(TASK_SIZE - 1)
+#endif
+
+#define get_ds()       (KERNEL_DS)
+#define get_fs()       (current->thread.fs)
+#define set_fs(val)    (current->thread.fs = (val))
+
+#define segment_eq(a, b)       ((a).seg == (b).seg)
+
+#ifdef __powerpc64__
+/*
+ * This check is sufficient because there is a large enough
+ * gap between user addresses and the kernel addresses
+ */
+#define __access_ok(addr, size, segment)       \
+       (((addr) <= (segment).seg) && ((size) <= (segment).seg))
+
+#else
+
+#define __access_ok(addr, size, segment)       \
+       (((addr) <= (segment).seg) &&           \
+        (((size) == 0) || (((size) - 1) <= ((segment).seg - (addr)))))
+
+#endif
+
+#define access_ok(type, addr, size)            \
+       (__chk_user_ptr(addr),                  \
+        __access_ok((__force unsigned long)(addr), (size), get_fs()))
+
+/*
+ * The exception table consists of pairs of addresses: the first is the
+ * address of an instruction that is allowed to fault, and the second is
+ * the address at which the program should continue.  No registers are
+ * modified, so it is entirely up to the continuation code to figure out
+ * what to do.
+ *
+ * All the routines below use bits of fixup code that are out of line
+ * with the main instruction path.  This means when everything is well,
+ * we don't even have to jump over them.  Further, they do not intrude
+ * on our cache or tlb entries.
+ */
+
+struct exception_table_entry {
+       unsigned long insn;
+       unsigned long fixup;
+};
+
+/*
+ * These are the main single-value transfer routines.  They automatically
+ * use the right size if we just have the right pointer type.
+ *
+ * This gets kind of ugly. We want to return _two_ values in "get_user()"
+ * and yet we don't want to do any pointers, because that is too much
+ * of a performance impact. Thus we have a few rather ugly macros here,
+ * and hide all the ugliness from the user.
+ *
+ * The "__xxx" versions of the user access functions are versions that
+ * do not verify the address space, that must have been done previously
+ * with a separate "access_ok()" call (this is used when we do multiple
+ * accesses to the same area of user memory).
+ *
+ * As we use the same address space for kernel and user data on the
+ * PowerPC, we can just do these as direct assignments.  (Of course, the
+ * exception handling means that it's no longer "just"...)
+ *
+ * The "user64" versions of the user access functions are versions that
+ * allow access of 64-bit data. The "get_user" functions do not
+ * properly handle 64-bit data because the value gets down cast to a long.
+ * The "put_user" functions already handle 64-bit data properly but we add
+ * "user64" versions for completeness
+ */
+#define get_user(x, ptr) \
+       __get_user_check((x), (ptr), sizeof(*(ptr)))
+#define put_user(x, ptr) \
+       __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
+
+#define __get_user(x, ptr) \
+       __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
+#define __put_user(x, ptr) \
+       __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
+#ifndef __powerpc64__
+#define __get_user64(x, ptr) \
+       __get_user64_nocheck((x), (ptr), sizeof(*(ptr)))
+#define __put_user64(x, ptr) __put_user(x, ptr)
+#endif
+
+#define __get_user_unaligned __get_user
+#define __put_user_unaligned __put_user
+
+extern long __put_user_bad(void);
+
+#ifdef __powerpc64__
+#define __EX_TABLE_ALIGN       "3"
+#define __EX_TABLE_TYPE                "llong"
+#else
+#define __EX_TABLE_ALIGN       "2"
+#define __EX_TABLE_TYPE                "long"
+#endif
+
+/*
+ * We don't tell gcc that we are accessing memory, but this is OK
+ * because we do not write to any memory gcc knows about, so there
+ * are no aliasing issues.
+ */
+#define __put_user_asm(x, addr, err, op)                       \
+       __asm__ __volatile__(                                   \
+               "1:     " op " %1,0(%2) # put_user\n"           \
+               "2:\n"                                          \
+               ".section .fixup,\"ax\"\n"                      \
+               "3:     li %0,%3\n"                             \
+               "       b 2b\n"                                 \
+               ".previous\n"                                   \
+               ".section __ex_table,\"a\"\n"                   \
+               "       .align " __EX_TABLE_ALIGN "\n"          \
+               "       ."__EX_TABLE_TYPE" 1b,3b\n"             \
+               ".previous"                                     \
+               : "=r" (err)                                    \
+               : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
+
+#ifdef __powerpc64__
+#define __put_user_asm2(x, ptr, retval)                                \
+         __put_user_asm(x, ptr, retval, "std")
+#else /* __powerpc64__ */
+#define __put_user_asm2(x, addr, err)                          \
+       __asm__ __volatile__(                                   \
+               "1:     stw %1,0(%2)\n"                         \
+               "2:     stw %1+1,4(%2)\n"                       \
+               "3:\n"                                          \
+               ".section .fixup,\"ax\"\n"                      \
+               "4:     li %0,%3\n"                             \
+               "       b 3b\n"                                 \
+               ".previous\n"                                   \
+               ".section __ex_table,\"a\"\n"                   \
+               "       .align " __EX_TABLE_ALIGN "\n"          \
+               "       ." __EX_TABLE_TYPE " 1b,4b\n"           \
+               "       ." __EX_TABLE_TYPE " 2b,4b\n"           \
+               ".previous"                                     \
+               : "=r" (err)                                    \
+               : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
+#endif /* __powerpc64__ */
+
+#define __put_user_size(x, ptr, size, retval)                  \
+do {                                                           \
+       retval = 0;                                             \
+       switch (size) {                                         \
+         case 1: __put_user_asm(x, ptr, retval, "stb"); break; \
+         case 2: __put_user_asm(x, ptr, retval, "sth"); break; \
+         case 4: __put_user_asm(x, ptr, retval, "stw"); break; \
+         case 8: __put_user_asm2(x, ptr, retval); break;       \
+         default: __put_user_bad();                            \
+       }                                                       \
+} while (0)
+
+#define __put_user_nocheck(x, ptr, size)                       \
+({                                                             \
+       long __pu_err;                                          \
+       might_sleep();                                          \
+       __chk_user_ptr(ptr);                                    \
+       __put_user_size((x), (ptr), (size), __pu_err);          \
+       __pu_err;                                               \
+})
+
+#define __put_user_check(x, ptr, size)                                 \
+({                                                                     \
+       long __pu_err = -EFAULT;                                        \
+       __typeof__(*(ptr)) __user *__pu_addr = (ptr);                   \
+       might_sleep();                                                  \
+       if (access_ok(VERIFY_WRITE, __pu_addr, size))                   \
+               __put_user_size((x), __pu_addr, (size), __pu_err);      \
+       __pu_err;                                                       \
+})
+
+extern long __get_user_bad(void);
+
+#define __get_user_asm(x, addr, err, op)               \
+       __asm__ __volatile__(                           \
+               "1:     "op" %1,0(%2)   # get_user\n"   \
+               "2:\n"                                  \
+               ".section .fixup,\"ax\"\n"              \
+               "3:     li %0,%3\n"                     \
+               "       li %1,0\n"                      \
+               "       b 2b\n"                         \
+               ".previous\n"                           \
+               ".section __ex_table,\"a\"\n"           \
+               "       .align "__EX_TABLE_ALIGN "\n"   \
+               "       ." __EX_TABLE_TYPE " 1b,3b\n"   \
+               ".previous"                             \
+               : "=r" (err), "=r" (x)                  \
+               : "b" (addr), "i" (-EFAULT), "0" (err))
+
+#ifdef __powerpc64__
+#define __get_user_asm2(x, addr, err)                  \
+       __get_user_asm(x, addr, err, "ld")
+#else /* __powerpc64__ */
+#define __get_user_asm2(x, addr, err)                  \
+       __asm__ __volatile__(                           \
+               "1:     lwz %1,0(%2)\n"                 \
+               "2:     lwz %1+1,4(%2)\n"               \
+               "3:\n"                                  \
+               ".section .fixup,\"ax\"\n"              \
+               "4:     li %0,%3\n"                     \
+               "       li %1,0\n"                      \
+               "       li %1+1,0\n"                    \
+               "       b 3b\n"                         \
+               ".previous\n"                           \
+               ".section __ex_table,\"a\"\n"           \
+               "       .align " __EX_TABLE_ALIGN "\n"  \
+               "       ." __EX_TABLE_TYPE " 1b,4b\n"   \
+               "       ." __EX_TABLE_TYPE " 2b,4b\n"   \
+               ".previous"                             \
+               : "=r" (err), "=&r" (x)                 \
+               : "b" (addr), "i" (-EFAULT), "0" (err))
+#endif /* __powerpc64__ */
+
+#define __get_user_size(x, ptr, size, retval)                  \
+do {                                                           \
+       retval = 0;                                             \
+       __chk_user_ptr(ptr);                                    \
+       if (size > sizeof(x))                                   \
+               (x) = __get_user_bad();                         \
+       switch (size) {                                         \
+       case 1: __get_user_asm(x, ptr, retval, "lbz"); break;   \
+       case 2: __get_user_asm(x, ptr, retval, "lhz"); break;   \
+       case 4: __get_user_asm(x, ptr, retval, "lwz"); break;   \
+       case 8: __get_user_asm2(x, ptr, retval);  break;        \
+       default: (x) = __get_user_bad();                        \
+       }                                                       \
+} while (0)
+
+#define __get_user_nocheck(x, ptr, size)                       \
+({                                                             \
+       long __gu_err;                                          \
+       unsigned long __gu_val;                                 \
+       __chk_user_ptr(ptr);                                    \
+       might_sleep();                                          \
+       __get_user_size(__gu_val, (ptr), (size), __gu_err);     \
+       (x) = (__typeof__(*(ptr)))__gu_val;                     \
+       __gu_err;                                               \
+})
+
+#ifndef __powerpc64__
+#define __get_user64_nocheck(x, ptr, size)                     \
+({                                                             \
+       long __gu_err;                                          \
+       long long __gu_val;                                     \
+       __chk_user_ptr(ptr);                                    \
+       might_sleep();                                          \
+       __get_user_size(__gu_val, (ptr), (size), __gu_err);     \
+       (x) = (__typeof__(*(ptr)))__gu_val;                     \
+       __gu_err;                                               \
+})
+#endif /* __powerpc64__ */
+
+#define __get_user_check(x, ptr, size)                                 \
+({                                                                     \
+       long __gu_err = -EFAULT;                                        \
+       unsigned long  __gu_val = 0;                                    \
+       const __typeof__(*(ptr)) __user *__gu_addr = (ptr);             \
+       might_sleep();                                                  \
+       if (access_ok(VERIFY_READ, __gu_addr, (size)))                  \
+               __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
+       (x) = (__typeof__(*(ptr)))__gu_val;                             \
+       __gu_err;                                                       \
+})
+
+/* more complex routines */
+
+extern unsigned long __copy_tofrom_user(void __user *to,
+               const void __user *from, unsigned long size);
+
+#ifndef __powerpc64__
+
+extern inline unsigned long copy_from_user(void *to,
+               const void __user *from, unsigned long n)
+{
+       unsigned long over;
+
+       if (access_ok(VERIFY_READ, from, n))
+               return __copy_tofrom_user((__force void __user *)to, from, n);
+       if ((unsigned long)from < TASK_SIZE) {
+               over = (unsigned long)from + n - TASK_SIZE;
+               return __copy_tofrom_user((__force void __user *)to, from,
+                               n - over) + over;
+       }
+       return n;
+}
+
+extern inline unsigned long copy_to_user(void __user *to,
+               const void *from, unsigned long n)
+{
+       unsigned long over;
+
+       if (access_ok(VERIFY_WRITE, to, n))
+               return __copy_tofrom_user(to, (__force void __user *)from, n);
+       if ((unsigned long)to < TASK_SIZE) {
+               over = (unsigned long)to + n - TASK_SIZE;
+               return __copy_tofrom_user(to, (__force void __user *)from,
+                               n - over) + over;
+       }
+       return n;
+}
+
+#else /* __powerpc64__ */
+
+#define __copy_in_user(to, from, size) \
+       __copy_tofrom_user((to), (from), (size))
+
+extern unsigned long copy_from_user(void *to, const void __user *from,
+                                   unsigned long n);
+extern unsigned long copy_to_user(void __user *to, const void *from,
+                                 unsigned long n);
+extern unsigned long copy_in_user(void __user *to, const void __user *from,
+                                 unsigned long n);
+
+#endif /* __powerpc64__ */
+
+static inline unsigned long __copy_from_user_inatomic(void *to,
+               const void __user *from, unsigned long n)
+{
+       if (__builtin_constant_p(n) && (n <= 8)) {
+               unsigned long ret;
+
+               switch (n) {
+               case 1:
+                       __get_user_size(*(u8 *)to, from, 1, ret);
+                       break;
+               case 2:
+                       __get_user_size(*(u16 *)to, from, 2, ret);
+                       break;
+               case 4:
+                       __get_user_size(*(u32 *)to, from, 4, ret);
+                       break;
+               case 8:
+                       __get_user_size(*(u64 *)to, from, 8, ret);
+                       break;
+               }
+               if (ret == 0)
+                       return 0;
+       }
+       return __copy_tofrom_user((__force void __user *)to, from, n);
+}
+
+static inline unsigned long __copy_to_user_inatomic(void __user *to,
+               const void *from, unsigned long n)
+{
+       if (__builtin_constant_p(n) && (n <= 8)) {
+               unsigned long ret;
+
+               switch (n) {
+               case 1:
+                       __put_user_size(*(u8 *)from, (u8 __user *)to, 1, ret);
+                       break;
+               case 2:
+                       __put_user_size(*(u16 *)from, (u16 __user *)to, 2, ret);
+                       break;
+               case 4:
+                       __put_user_size(*(u32 *)from, (u32 __user *)to, 4, ret);
+                       break;
+               case 8:
+                       __put_user_size(*(u64 *)from, (u64 __user *)to, 8, ret);
+                       break;
+               }
+               if (ret == 0)
+                       return 0;
+       }
+       return __copy_tofrom_user(to, (__force const void __user *)from, n);
+}
+
+static inline unsigned long __copy_from_user(void *to,
+               const void __user *from, unsigned long size)
+{
+       might_sleep();
+       return __copy_from_user_inatomic(to, from, size);
+}
+
+static inline unsigned long __copy_to_user(void __user *to,
+               const void *from, unsigned long size)
+{
+       might_sleep();
+       return __copy_to_user_inatomic(to, from, size);
+}
+
+extern unsigned long __clear_user(void __user *addr, unsigned long size);
+
+static inline unsigned long clear_user(void __user *addr, unsigned long size)
+{
+       might_sleep();
+       if (likely(access_ok(VERIFY_WRITE, addr, size)))
+               return __clear_user(addr, size);
+       if ((unsigned long)addr < TASK_SIZE) {
+               unsigned long over = (unsigned long)addr + size - TASK_SIZE;
+               return __clear_user(addr, size - over) + over;
+       }
+       return size;
+}
+
+extern int __strncpy_from_user(char *dst, const char __user *src, long count);
+
+static inline long strncpy_from_user(char *dst, const char __user *src,
+               long count)
+{
+       might_sleep();
+       if (likely(access_ok(VERIFY_READ, src, 1)))
+               return __strncpy_from_user(dst, src, count);
+       return -EFAULT;
+}
+
+/*
+ * Return the size of a string (including the ending 0)
+ *
+ * Return 0 for error
+ */
+extern int __strnlen_user(const char __user *str, long len, unsigned long top);
+
+/*
+ * Returns the length of the string at str (including the null byte),
+ * or 0 if we hit a page we can't access,
+ * or something > len if we didn't find a null byte.
+ *
+ * The `top' parameter to __strnlen_user is to make sure that
+ * we can never overflow from the user area into kernel space.
+ */
+static inline int strnlen_user(const char __user *str, long len)
+{
+       unsigned long top = current->thread.fs.seg;
+
+       if ((unsigned long)str > top)
+               return 0;
+       return __strnlen_user(str, len, top);
+}
+
+#define strlen_user(str)       strnlen_user((str), 0x7ffffffe)
+
+#endif  /* __ASSEMBLY__ */
+#endif /* __KERNEL__ */
+
+#endif /* _ARCH_POWERPC_UACCESS_H */
diff --git a/include/asm-ppc/bitops.h b/include/asm-ppc/bitops.h
deleted file mode 100644 (file)
index e30f536..0000000
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * bitops.h: Bit string operations on the ppc
- */
-
-#ifdef __KERNEL__
-#ifndef _PPC_BITOPS_H
-#define _PPC_BITOPS_H
-
-#include <linux/config.h>
-#include <linux/compiler.h>
-#include <asm/byteorder.h>
-#include <asm/atomic.h>
-
-/*
- * The test_and_*_bit operations are taken to imply a memory barrier
- * on SMP systems.
- */
-#ifdef CONFIG_SMP
-#define SMP_WMB                "eieio\n"
-#define SMP_MB         "\nsync"
-#else
-#define SMP_WMB
-#define SMP_MB
-#endif /* CONFIG_SMP */
-
-static __inline__ void set_bit(int nr, volatile unsigned long * addr)
-{
-       unsigned long old;
-       unsigned long mask = 1 << (nr & 0x1f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-       
-       __asm__ __volatile__("\n\
-1:     lwarx   %0,0,%3 \n\
-       or      %0,%0,%2 \n"
-       PPC405_ERR77(0,%3)
-"      stwcx.  %0,0,%3 \n\
-       bne-    1b"
-       : "=&r" (old), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc" );
-}
-
-/*
- * non-atomic version
- */
-static __inline__ void __set_bit(int nr, volatile unsigned long *addr)
-{
-       unsigned long mask = 1 << (nr & 0x1f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-
-       *p |= mask;
-}
-
-/*
- * clear_bit doesn't imply a memory barrier
- */
-#define smp_mb__before_clear_bit()     smp_mb()
-#define smp_mb__after_clear_bit()      smp_mb()
-
-static __inline__ void clear_bit(int nr, volatile unsigned long *addr)
-{
-       unsigned long old;
-       unsigned long mask = 1 << (nr & 0x1f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-
-       __asm__ __volatile__("\n\
-1:     lwarx   %0,0,%3 \n\
-       andc    %0,%0,%2 \n"
-       PPC405_ERR77(0,%3)
-"      stwcx.  %0,0,%3 \n\
-       bne-    1b"
-       : "=&r" (old), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc");
-}
-
-/*
- * non-atomic version
- */
-static __inline__ void __clear_bit(int nr, volatile unsigned long *addr)
-{
-       unsigned long mask = 1 << (nr & 0x1f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-
-       *p &= ~mask;
-}
-
-static __inline__ void change_bit(int nr, volatile unsigned long *addr)
-{
-       unsigned long old;
-       unsigned long mask = 1 << (nr & 0x1f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-
-       __asm__ __volatile__("\n\
-1:     lwarx   %0,0,%3 \n\
-       xor     %0,%0,%2 \n"
-       PPC405_ERR77(0,%3)
-"      stwcx.  %0,0,%3 \n\
-       bne-    1b"
-       : "=&r" (old), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc");
-}
-
-/*
- * non-atomic version
- */
-static __inline__ void __change_bit(int nr, volatile unsigned long *addr)
-{
-       unsigned long mask = 1 << (nr & 0x1f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-
-       *p ^= mask;
-}
-
-/*
- * test_and_*_bit do imply a memory barrier (?)
- */
-static __inline__ int test_and_set_bit(int nr, volatile unsigned long *addr)
-{
-       unsigned int old, t;
-       unsigned int mask = 1 << (nr & 0x1f);
-       volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5);
-
-       __asm__ __volatile__(SMP_WMB "\n\
-1:     lwarx   %0,0,%4 \n\
-       or      %1,%0,%3 \n"
-       PPC405_ERR77(0,%4)
-"      stwcx.  %1,0,%4 \n\
-       bne     1b"
-       SMP_MB
-       : "=&r" (old), "=&r" (t), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc", "memory");
-
-       return (old & mask) != 0;
-}
-
-/*
- * non-atomic version
- */
-static __inline__ int __test_and_set_bit(int nr, volatile unsigned long *addr)
-{
-       unsigned long mask = 1 << (nr & 0x1f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-       unsigned long old = *p;
-
-       *p = old | mask;
-       return (old & mask) != 0;
-}
-
-static __inline__ int test_and_clear_bit(int nr, volatile unsigned long *addr)
-{
-       unsigned int old, t;
-       unsigned int mask = 1 << (nr & 0x1f);
-       volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5);
-
-       __asm__ __volatile__(SMP_WMB "\n\
-1:     lwarx   %0,0,%4 \n\
-       andc    %1,%0,%3 \n"
-       PPC405_ERR77(0,%4)
-"      stwcx.  %1,0,%4 \n\
-       bne     1b"
-       SMP_MB
-       : "=&r" (old), "=&r" (t), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc", "memory");
-
-       return (old & mask) != 0;
-}
-
-/*
- * non-atomic version
- */
-static __inline__ int __test_and_clear_bit(int nr, volatile unsigned long *addr)
-{
-       unsigned long mask = 1 << (nr & 0x1f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-       unsigned long old = *p;
-
-       *p = old & ~mask;
-       return (old & mask) != 0;
-}
-
-static __inline__ int test_and_change_bit(int nr, volatile unsigned long *addr)
-{
-       unsigned int old, t;
-       unsigned int mask = 1 << (nr & 0x1f);
-       volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5);
-
-       __asm__ __volatile__(SMP_WMB "\n\
-1:     lwarx   %0,0,%4 \n\
-       xor     %1,%0,%3 \n"
-       PPC405_ERR77(0,%4)
-"      stwcx.  %1,0,%4 \n\
-       bne     1b"
-       SMP_MB
-       : "=&r" (old), "=&r" (t), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc", "memory");
-
-       return (old & mask) != 0;
-}
-
-/*
- * non-atomic version
- */
-static __inline__ int __test_and_change_bit(int nr, volatile unsigned long *addr)
-{
-       unsigned long mask = 1 << (nr & 0x1f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-       unsigned long old = *p;
-
-       *p = old ^ mask;
-       return (old & mask) != 0;
-}
-
-static __inline__ int test_bit(int nr, __const__ volatile unsigned long *addr)
-{
-       return ((addr[nr >> 5] >> (nr & 0x1f)) & 1) != 0;
-}
-
-/* Return the bit position of the most significant 1 bit in a word */
-static __inline__ int __ilog2(unsigned long x)
-{
-       int lz;
-
-       asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
-       return 31 - lz;
-}
-
-static __inline__ int ffz(unsigned long x)
-{
-       if ((x = ~x) == 0)
-               return 32;
-       return __ilog2(x & -x);
-}
-
-static inline int __ffs(unsigned long x)
-{
-       return __ilog2(x & -x);
-}
-
-/*
- * 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).
- */
-static __inline__ int ffs(int x)
-{
-       return __ilog2(x & -x) + 1;
-}
-
-/*
- * fls: find last (most-significant) bit set.
- * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
- */
-static __inline__ int fls(unsigned int x)
-{
-       int lz;
-
-       asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
-       return 32 - lz;
-}
-
-/*
- * 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)
-
-/*
- * Find the first bit set in a 140-bit bitmap.
- * The first 100 bits are unlikely to be set.
- */
-static inline int sched_find_first_bit(const unsigned long *b)
-{
-       if (unlikely(b[0]))
-               return __ffs(b[0]);
-       if (unlikely(b[1]))
-               return __ffs(b[1]) + 32;
-       if (unlikely(b[2]))
-               return __ffs(b[2]) + 64;
-       if (b[3])
-               return __ffs(b[3]) + 96;
-       return __ffs(b[4]) + 128;
-}
-
-/**
- * find_next_bit - find the next set bit in a memory region
- * @addr: The address to base the search on
- * @offset: The bitnumber to start searching at
- * @size: The maximum size to search
- */
-static __inline__ unsigned long find_next_bit(const unsigned long *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 = *p++;
-               tmp &= ~0UL << offset;
-               if (size < 32)
-                       goto found_first;
-               if (tmp)
-                       goto found_middle;
-               size -= 32;
-               result += 32;
-       }
-       while (size >= 32) {
-               if ((tmp = *p++) != 0)
-                       goto found_middle;
-               result += 32;
-               size -= 32;
-       }
-       if (!size)
-               return result;
-       tmp = *p;
-
-found_first:
-       tmp &= ~0UL >> (32 - size);
-       if (tmp == 0UL)        /* Are any bits set? */
-               return result + size; /* Nope. */
-found_middle:
-       return result + __ffs(tmp);
-}
-
-/**
- * find_first_bit - find the first set bit in a memory region
- * @addr: The address to start the search at
- * @size: The maximum size to search
- *
- * Returns the bit-number of the first set bit, not the number of the byte
- * containing a bit.
- */
-#define find_first_bit(addr, size) \
-       find_next_bit((addr), (size), 0)
-
-/*
- * 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(const unsigned long *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 = *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 = *p++) != ~0U)
-                       goto found_middle;
-               result += 32;
-               size -= 32;
-       }
-       if (!size)
-               return result;
-       tmp = *p;
-found_first:
-       tmp |= ~0UL << size;
-       if (tmp == ~0UL)        /* Are any bits zero? */
-               return result + size; /* Nope. */
-found_middle:
-       return result + ffz(tmp);
-}
-
-
-#define ext2_set_bit(nr, addr) __test_and_set_bit((nr) ^ 0x18, (unsigned long *)(addr))
-#define ext2_set_bit_atomic(lock, nr, addr)  test_and_set_bit((nr) ^ 0x18, (unsigned long *)(addr))
-#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 0x18, (unsigned long *)(addr))
-#define ext2_clear_bit_atomic(lock, nr, addr) test_and_clear_bit((nr) ^ 0x18, (unsigned long *)(addr))
-
-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)
-
-static __inline__ unsigned long ext2_find_next_zero_bit(const 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;
-       if (tmp == ~0UL)        /* Are any bits zero? */
-               return result + size; /* Nope. */
-found_middle:
-       return result + ffz(tmp);
-}
-
-/* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr) ext2_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) ((void)ext2_set_bit(nr,addr))
-#define minix_test_and_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 /* _PPC_BITOPS_H */
-#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/futex.h b/include/asm-ppc/futex.h
deleted file mode 100644 (file)
index 9feff4c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef _ASM_FUTEX_H
-#define _ASM_FUTEX_H
-
-#ifdef __KERNEL__
-
-#include <linux/futex.h>
-#include <asm/errno.h>
-#include <asm/uaccess.h>
-
-static inline int
-futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
-{
-       int op = (encoded_op >> 28) & 7;
-       int cmp = (encoded_op >> 24) & 15;
-       int oparg = (encoded_op << 8) >> 20;
-       int cmparg = (encoded_op << 20) >> 20;
-       int oldval = 0, ret;
-       if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
-               oparg = 1 << oparg;
-
-       if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
-               return -EFAULT;
-
-       inc_preempt_count();
-
-       switch (op) {
-       case FUTEX_OP_SET:
-       case FUTEX_OP_ADD:
-       case FUTEX_OP_OR:
-       case FUTEX_OP_ANDN:
-       case FUTEX_OP_XOR:
-       default:
-               ret = -ENOSYS;
-       }
-
-       dec_preempt_count();
-
-       if (!ret) {
-               switch (cmp) {
-               case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
-               case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
-               case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
-               case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
-               case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
-               case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
-               default: ret = -ENOSYS;
-               }
-       }
-       return ret;
-}
-
-#endif
-#endif
diff --git a/include/asm-ppc/ipcbuf.h b/include/asm-ppc/ipcbuf.h
deleted file mode 100644 (file)
index fab6752..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __PPC_IPCBUF_H__
-#define __PPC_IPCBUF_H__
-
-/*
- * The ipc64_perm structure for PPC architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 1 32-bit value to fill up for 8-byte alignment
- * - 2 miscellaneous 64-bit values (so that this structure matches
- *                                  PPC64 ipc64_perm)
- */
-
-struct ipc64_perm
-{
-       __kernel_key_t          key;
-       __kernel_uid_t          uid;
-       __kernel_gid_t          gid;
-       __kernel_uid_t          cuid;
-       __kernel_gid_t          cgid;
-       __kernel_mode_t         mode;
-       unsigned long           seq;
-       unsigned int            __pad2;
-       unsigned long long      __unused1;
-       unsigned long long      __unused2;
-};
-
-#endif /* __PPC_IPCBUF_H__ */
diff --git a/include/asm-ppc/uaccess.h b/include/asm-ppc/uaccess.h
deleted file mode 100644 (file)
index 63f5622..0000000
+++ /dev/null
@@ -1,393 +0,0 @@
-#ifdef __KERNEL__
-#ifndef _PPC_UACCESS_H
-#define _PPC_UACCESS_H
-
-#ifndef __ASSEMBLY__
-#include <linux/sched.h>
-#include <linux/errno.h>
-#include <asm/processor.h>
-
-#define VERIFY_READ    0
-#define VERIFY_WRITE   1
-
-/*
- * The fs value determines whether argument validity checking should be
- * performed or not.  If get_fs() == USER_DS, checking is performed, with
- * get_fs() == KERNEL_DS, checking is bypassed.
- *
- * For historical reasons, these macros are grossly misnamed.
- *
- * The fs/ds values are now the highest legal address in the "segment".
- * This simplifies the checking in the routines below.
- */
-
-#define KERNEL_DS      ((mm_segment_t) { ~0UL })
-#define USER_DS                ((mm_segment_t) { TASK_SIZE - 1 })
-
-#define get_ds()       (KERNEL_DS)
-#define get_fs()       (current->thread.fs)
-#define set_fs(val)    (current->thread.fs = (val))
-
-#define segment_eq(a,b)        ((a).seg == (b).seg)
-
-#define __access_ok(addr,size)                                             \
-       ((addr) <= current->thread.fs.seg                                   \
-        && ((size) == 0 || (size) - 1 <= current->thread.fs.seg - (addr)))
-
-#define access_ok(type, addr, size) \
-       (__chk_user_ptr(addr),__access_ok((unsigned long)(addr),(size)))
-
-/*
- * The exception table consists of pairs of addresses: the first is the
- * address of an instruction that is allowed to fault, and the second is
- * the address at which the program should continue.  No registers are
- * modified, so it is entirely up to the continuation code to figure out
- * what to do.
- *
- * All the routines below use bits of fixup code that are out of line
- * with the main instruction path.  This means when everything is well,
- * we don't even have to jump over them.  Further, they do not intrude
- * on our cache or tlb entries.
- */
-
-struct exception_table_entry
-{
-       unsigned long insn, fixup;
-};
-
-/*
- * These are the main single-value transfer routines.  They automatically
- * use the right size if we just have the right pointer type.
- *
- * This gets kind of ugly. We want to return _two_ values in "get_user()"
- * and yet we don't want to do any pointers, because that is too much
- * of a performance impact. Thus we have a few rather ugly macros here,
- * and hide all the ugliness from the user.
- *
- * The "__xxx" versions of the user access functions are versions that
- * do not verify the address space, that must have been done previously
- * with a separate "access_ok()" call (this is used when we do multiple
- * accesses to the same area of user memory).
- *
- * As we use the same address space for kernel and user data on the
- * PowerPC, we can just do these as direct assignments.  (Of course, the
- * exception handling means that it's no longer "just"...)
- *
- * The "user64" versions of the user access functions are versions that 
- * allow access of 64-bit data. The "get_user" functions do not 
- * properly handle 64-bit data because the value gets down cast to a long. 
- * The "put_user" functions already handle 64-bit data properly but we add 
- * "user64" versions for completeness
- */
-#define get_user(x,ptr) \
-  __get_user_check((x),(ptr),sizeof(*(ptr)))
-#define get_user64(x,ptr) \
-  __get_user64_check((x),(ptr),sizeof(*(ptr)))
-#define put_user(x,ptr) \
-  __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
-#define put_user64(x,ptr) put_user(x,ptr)
-
-#define __get_user(x,ptr) \
-  __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
-#define __get_user64(x,ptr) \
-  __get_user64_nocheck((x),(ptr),sizeof(*(ptr)))
-#define __put_user(x,ptr) \
-  __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
-#define __put_user64(x,ptr) __put_user(x,ptr)
-
-extern long __put_user_bad(void);
-
-#define __put_user_nocheck(x,ptr,size)                 \
-({                                                     \
-       long __pu_err;                                  \
-       __chk_user_ptr(ptr);                            \
-       __put_user_size((x),(ptr),(size),__pu_err);     \
-       __pu_err;                                       \
-})
-
-#define __put_user_check(x,ptr,size)                           \
-({                                                             \
-       long __pu_err = -EFAULT;                                \
-       __typeof__(*(ptr)) __user *__pu_addr = (ptr);           \
-       if (access_ok(VERIFY_WRITE,__pu_addr,size))             \
-               __put_user_size((x),__pu_addr,(size),__pu_err); \
-       __pu_err;                                               \
-})
-
-#define __put_user_size(x,ptr,size,retval)             \
-do {                                                   \
-       retval = 0;                                     \
-       switch (size) {                                 \
-       case 1:                                         \
-               __put_user_asm(x, ptr, retval, "stb");  \
-               break;                                  \
-       case 2:                                         \
-               __put_user_asm(x, ptr, retval, "sth");  \
-               break;                                  \
-       case 4:                                         \
-               __put_user_asm(x, ptr, retval, "stw");  \
-               break;                                  \
-       case 8:                                         \
-               __put_user_asm2(x, ptr, retval);        \
-               break;                                  \
-       default:                                        \
-               __put_user_bad();                       \
-       }                                               \
-} while (0)
-
-/*
- * We don't tell gcc that we are accessing memory, but this is OK
- * because we do not write to any memory gcc knows about, so there
- * are no aliasing issues.
- */
-#define __put_user_asm(x, addr, err, op)                       \
-       __asm__ __volatile__(                                   \
-               "1:     "op" %1,0(%2)\n"                        \
-               "2:\n"                                          \
-               ".section .fixup,\"ax\"\n"                      \
-               "3:     li %0,%3\n"                             \
-               "       b 2b\n"                                 \
-               ".previous\n"                                   \
-               ".section __ex_table,\"a\"\n"                   \
-               "       .align 2\n"                             \
-               "       .long 1b,3b\n"                          \
-               ".previous"                                     \
-               : "=r" (err)                                    \
-               : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
-
-#define __put_user_asm2(x, addr, err)                          \
-       __asm__ __volatile__(                                   \
-               "1:     stw %1,0(%2)\n"                         \
-               "2:     stw %1+1,4(%2)\n"                       \
-               "3:\n"                                          \
-               ".section .fixup,\"ax\"\n"                      \
-               "4:     li %0,%3\n"                             \
-               "       b 3b\n"                                 \
-               ".previous\n"                                   \
-               ".section __ex_table,\"a\"\n"                   \
-               "       .align 2\n"                             \
-               "       .long 1b,4b\n"                          \
-               "       .long 2b,4b\n"                          \
-               ".previous"                                     \
-               : "=r" (err)                                    \
-               : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
-
-#define __get_user_nocheck(x, ptr, size)                       \
-({                                                             \
-       long __gu_err;                                          \
-       unsigned long __gu_val;                                 \
-       __chk_user_ptr(ptr);                                    \
-       __get_user_size(__gu_val, (ptr), (size), __gu_err);     \
-       (x) = (__typeof__(*(ptr)))__gu_val;                     \
-       __gu_err;                                               \
-})
-
-#define __get_user64_nocheck(x, ptr, size)                     \
-({                                                             \
-       long __gu_err;                                          \
-       long long __gu_val;                                     \
-       __chk_user_ptr(ptr);                                    \
-       __get_user_size64(__gu_val, (ptr), (size), __gu_err);   \
-       (x) = (__typeof__(*(ptr)))__gu_val;                     \
-       __gu_err;                                               \
-})
-
-#define __get_user_check(x, ptr, size)                                 \
-({                                                                     \
-       long __gu_err = -EFAULT;                                        \
-       unsigned long  __gu_val = 0;                                    \
-       const __typeof__(*(ptr)) __user *__gu_addr = (ptr);             \
-       if (access_ok(VERIFY_READ, __gu_addr, (size)))                  \
-               __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
-       (x) = (__typeof__(*(ptr)))__gu_val;                             \
-       __gu_err;                                                       \
-})
-
-#define __get_user64_check(x, ptr, size)                                 \
-({                                                                       \
-       long __gu_err = -EFAULT;                                          \
-       long long __gu_val = 0;                                           \
-       const __typeof__(*(ptr)) __user *__gu_addr = (ptr);               \
-       if (access_ok(VERIFY_READ, __gu_addr, (size)))                    \
-               __get_user_size64(__gu_val, __gu_addr, (size), __gu_err); \
-       (x) = (__typeof__(*(ptr)))__gu_val;                               \
-       __gu_err;                                                         \
-})
-
-extern long __get_user_bad(void);
-
-#define __get_user_size(x, ptr, size, retval)                  \
-do {                                                           \
-       retval = 0;                                             \
-       switch (size) {                                         \
-       case 1:                                                 \
-               __get_user_asm(x, ptr, retval, "lbz");          \
-               break;                                          \
-       case 2:                                                 \
-               __get_user_asm(x, ptr, retval, "lhz");          \
-               break;                                          \
-       case 4:                                                 \
-               __get_user_asm(x, ptr, retval, "lwz");          \
-               break;                                          \
-       default:                                                \
-               x = __get_user_bad();                           \
-       }                                                       \
-} while (0)
-
-#define __get_user_size64(x, ptr, size, retval)                        \
-do {                                                           \
-       retval = 0;                                             \
-       switch (size) {                                         \
-       case 1:                                                 \
-               __get_user_asm(x, ptr, retval, "lbz");          \
-               break;                                          \
-       case 2:                                                 \
-               __get_user_asm(x, ptr, retval, "lhz");          \
-               break;                                          \
-       case 4:                                                 \
-               __get_user_asm(x, ptr, retval, "lwz");          \
-               break;                                          \
-       case 8:                                                 \
-               __get_user_asm2(x, ptr, retval);                \
-               break;                                          \
-       default:                                                \
-               x = __get_user_bad();                           \
-       }                                                       \
-} while (0)
-
-#define __get_user_asm(x, addr, err, op)               \
-       __asm__ __volatile__(                           \
-               "1:     "op" %1,0(%2)\n"                \
-               "2:\n"                                  \
-               ".section .fixup,\"ax\"\n"              \
-               "3:     li %0,%3\n"                     \
-               "       li %1,0\n"                      \
-               "       b 2b\n"                         \
-               ".previous\n"                           \
-               ".section __ex_table,\"a\"\n"           \
-               "       .align 2\n"                     \
-               "       .long 1b,3b\n"                  \
-               ".previous"                             \
-               : "=r"(err), "=r"(x)                    \
-               : "b"(addr), "i"(-EFAULT), "0"(err))
-
-#define __get_user_asm2(x, addr, err)                  \
-       __asm__ __volatile__(                           \
-               "1:     lwz %1,0(%2)\n"                 \
-               "2:     lwz %1+1,4(%2)\n"               \
-               "3:\n"                                  \
-               ".section .fixup,\"ax\"\n"              \
-               "4:     li %0,%3\n"                     \
-               "       li %1,0\n"                      \
-               "       li %1+1,0\n"                    \
-               "       b 3b\n"                         \
-               ".previous\n"                           \
-               ".section __ex_table,\"a\"\n"           \
-               "       .align 2\n"                     \
-               "       .long 1b,4b\n"                  \
-               "       .long 2b,4b\n"                  \
-               ".previous"                             \
-               : "=r"(err), "=&r"(x)                   \
-               : "b"(addr), "i"(-EFAULT), "0"(err))
-
-/* more complex routines */
-
-extern int __copy_tofrom_user(void __user *to, const void __user *from,
-                             unsigned long size);
-
-extern inline unsigned long
-copy_from_user(void *to, const void __user *from, unsigned long n)
-{
-       unsigned long over;
-
-       if (access_ok(VERIFY_READ, from, n))
-               return __copy_tofrom_user((__force void __user *)to, from, n);
-       if ((unsigned long)from < TASK_SIZE) {
-               over = (unsigned long)from + n - TASK_SIZE;
-               return __copy_tofrom_user((__force void __user *)to, from, n - over) + over;
-       }
-       return n;
-}
-
-extern inline unsigned long
-copy_to_user(void __user *to, const void *from, unsigned long n)
-{
-       unsigned long over;
-
-       if (access_ok(VERIFY_WRITE, to, n))
-               return __copy_tofrom_user(to, (__force void __user *) from, n);
-       if ((unsigned long)to < TASK_SIZE) {
-               over = (unsigned long)to + n - TASK_SIZE;
-               return __copy_tofrom_user(to, (__force void __user *) from, n - over) + over;
-       }
-       return n;
-}
-
-static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long size)
-{
-       return __copy_tofrom_user((__force void __user *)to, from, size);
-}
-
-static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long size)
-{
-       return __copy_tofrom_user(to, (__force void __user *)from, size);
-}
-
-#define __copy_to_user_inatomic __copy_to_user
-#define __copy_from_user_inatomic __copy_from_user
-
-extern unsigned long __clear_user(void __user *addr, unsigned long size);
-
-extern inline unsigned long
-clear_user(void __user *addr, unsigned long size)
-{
-       if (access_ok(VERIFY_WRITE, addr, size))
-               return __clear_user(addr, size);
-       if ((unsigned long)addr < TASK_SIZE) {
-               unsigned long over = (unsigned long)addr + size - TASK_SIZE;
-               return __clear_user(addr, size - over) + over;
-       }
-       return size;
-}
-
-extern int __strncpy_from_user(char *dst, const char __user *src, long count);
-
-extern inline long
-strncpy_from_user(char *dst, const char __user *src, long count)
-{
-       if (access_ok(VERIFY_READ, src, 1))
-               return __strncpy_from_user(dst, src, count);
-       return -EFAULT;
-}
-
-/*
- * Return the size of a string (including the ending 0)
- *
- * Return 0 for error
- */
-
-extern int __strnlen_user(const char __user *str, long len, unsigned long top);
-
-/*
- * Returns the length of the string at str (including the null byte),
- * or 0 if we hit a page we can't access,
- * or something > len if we didn't find a null byte.
- *
- * The `top' parameter to __strnlen_user is to make sure that
- * we can never overflow from the user area into kernel space.
- */
-extern __inline__ int strnlen_user(const char __user *str, long len)
-{
-       unsigned long top = current->thread.fs.seg;
-
-       if ((unsigned long)str > top)
-               return 0;
-       return __strnlen_user(str, len, top);
-}
-
-#define strlen_user(str)       strnlen_user((str), 0x7ffffffe)
-
-#endif  /* __ASSEMBLY__ */
-
-#endif /* _PPC_UACCESS_H */
-#endif /* __KERNEL__ */
diff --git a/include/asm-ppc64/bitops.h b/include/asm-ppc64/bitops.h
deleted file mode 100644 (file)
index dbfa42e..0000000
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * PowerPC64 atomic bit operations.
- * Dave Engebretsen, Todd Inglett, Don Reed, Pat McCarthy, Peter Bergner,
- * Anton Blanchard
- *
- * Originally taken from the 32b PPC code.  Modified to use 64b values for
- * the various counters & memory references.
- *
- * Bitops are odd when viewed on big-endian systems.  They were designed
- * on little endian so the size of the bitset doesn't matter (low order bytes
- * come first) as long as the bit in question is valid.
- *
- * Bits are "tested" often using the C expression (val & (1<<nr)) so we do
- * our best to stay compatible with that.  The assumption is that val will
- * be unsigned long for such tests.  As such, we assume the bits are stored
- * as an array of unsigned long (the usual case is a single unsigned long,
- * of course).  Here's an example bitset with bit numbering:
- *
- *   |63..........0|127........64|195.......128|255.......196|
- *
- * This leads to a problem. If an int, short or char is passed as a bitset
- * it will be a bad memory reference since we want to store in chunks
- * of unsigned long (64 bits here) size.
- *
- * There are a few little-endian macros used mostly for filesystem bitmaps,
- * these work on similar bit arrays layouts, but byte-oriented:
- *
- *   |7...0|15...8|23...16|31...24|39...32|47...40|55...48|63...56|
- *
- * The main difference is that bit 3-5 in the bit number field needs to be
- * reversed compared to the big-endian bit fields. This can be achieved
- * by XOR with 0b111000 (0x38).
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#ifndef _PPC64_BITOPS_H
-#define _PPC64_BITOPS_H
-
-#ifdef __KERNEL__
-
-#include <asm/synch.h>
-
-/*
- * clear_bit doesn't imply a memory barrier
- */
-#define smp_mb__before_clear_bit()     smp_mb()
-#define smp_mb__after_clear_bit()      smp_mb()
-
-static __inline__ int test_bit(unsigned long nr, __const__ volatile unsigned long *addr)
-{
-       return (1UL & (addr[nr >> 6] >> (nr & 63)));
-}
-
-static __inline__ void set_bit(unsigned long nr, volatile unsigned long *addr)
-{
-       unsigned long old;
-       unsigned long mask = 1UL << (nr & 0x3f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
-       __asm__ __volatile__(
-"1:    ldarx   %0,0,%3         # set_bit\n\
-       or      %0,%0,%2\n\
-       stdcx.  %0,0,%3\n\
-       bne-    1b"
-       : "=&r" (old), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc");
-}
-
-static __inline__ void clear_bit(unsigned long nr, volatile unsigned long *addr)
-{
-       unsigned long old;
-       unsigned long mask = 1UL << (nr & 0x3f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
-       __asm__ __volatile__(
-"1:    ldarx   %0,0,%3         # clear_bit\n\
-       andc    %0,%0,%2\n\
-       stdcx.  %0,0,%3\n\
-       bne-    1b"
-       : "=&r" (old), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc");
-}
-
-static __inline__ void change_bit(unsigned long nr, volatile unsigned long *addr)
-{
-       unsigned long old;
-       unsigned long mask = 1UL << (nr & 0x3f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
-       __asm__ __volatile__(
-"1:    ldarx   %0,0,%3         # change_bit\n\
-       xor     %0,%0,%2\n\
-       stdcx.  %0,0,%3\n\
-       bne-    1b"
-       : "=&r" (old), "=m" (*p)
-       : "r" (mask), "r" (p), "m" (*p)
-       : "cc");
-}
-
-static __inline__ int test_and_set_bit(unsigned long nr, volatile unsigned long *addr)
-{
-       unsigned long old, t;
-       unsigned long mask = 1UL << (nr & 0x3f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
-       __asm__ __volatile__(
-       EIEIO_ON_SMP
-"1:    ldarx   %0,0,%3         # test_and_set_bit\n\
-       or      %1,%0,%2 \n\
-       stdcx.  %1,0,%3 \n\
-       bne-    1b"
-       ISYNC_ON_SMP
-       : "=&r" (old), "=&r" (t)
-       : "r" (mask), "r" (p)
-       : "cc", "memory");
-
-       return (old & mask) != 0;
-}
-
-static __inline__ int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
-{
-       unsigned long old, t;
-       unsigned long mask = 1UL << (nr & 0x3f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
-       __asm__ __volatile__(
-       EIEIO_ON_SMP
-"1:    ldarx   %0,0,%3         # test_and_clear_bit\n\
-       andc    %1,%0,%2\n\
-       stdcx.  %1,0,%3\n\
-       bne-    1b"
-       ISYNC_ON_SMP
-       : "=&r" (old), "=&r" (t)
-       : "r" (mask), "r" (p)
-       : "cc", "memory");
-
-       return (old & mask) != 0;
-}
-
-static __inline__ int test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
-{
-       unsigned long old, t;
-       unsigned long mask = 1UL << (nr & 0x3f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
-       __asm__ __volatile__(
-       EIEIO_ON_SMP
-"1:    ldarx   %0,0,%3         # test_and_change_bit\n\
-       xor     %1,%0,%2\n\
-       stdcx.  %1,0,%3\n\
-       bne-    1b"
-       ISYNC_ON_SMP
-       : "=&r" (old), "=&r" (t)
-       : "r" (mask), "r" (p)
-       : "cc", "memory");
-
-       return (old & mask) != 0;
-}
-
-static __inline__ void set_bits(unsigned long mask, unsigned long *addr)
-{
-       unsigned long old;
-
-       __asm__ __volatile__(
-"1:    ldarx   %0,0,%3         # set_bit\n\
-       or      %0,%0,%2\n\
-       stdcx.  %0,0,%3\n\
-       bne-    1b"
-       : "=&r" (old), "=m" (*addr)
-       : "r" (mask), "r" (addr), "m" (*addr)
-       : "cc");
-}
-
-/*
- * non-atomic versions
- */
-static __inline__ void __set_bit(unsigned long nr, volatile unsigned long *addr)
-{
-       unsigned long mask = 1UL << (nr & 0x3f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
-       *p |= mask;
-}
-
-static __inline__ void __clear_bit(unsigned long nr, volatile unsigned long *addr)
-{
-       unsigned long mask = 1UL << (nr & 0x3f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
-       *p &= ~mask;
-}
-
-static __inline__ void __change_bit(unsigned long nr, volatile unsigned long *addr)
-{
-       unsigned long mask = 1UL << (nr & 0x3f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-
-       *p ^= mask;
-}
-
-static __inline__ int __test_and_set_bit(unsigned long nr, volatile unsigned long *addr)
-{
-       unsigned long mask = 1UL << (nr & 0x3f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-       unsigned long old = *p;
-
-       *p = old | mask;
-       return (old & mask) != 0;
-}
-
-static __inline__ int __test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
-{
-       unsigned long mask = 1UL << (nr & 0x3f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-       unsigned long old = *p;
-
-       *p = old & ~mask;
-       return (old & mask) != 0;
-}
-
-static __inline__ int __test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
-{
-       unsigned long mask = 1UL << (nr & 0x3f);
-       unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-       unsigned long old = *p;
-
-       *p = old ^ mask;
-       return (old & mask) != 0;
-}
-
-/*
- * Return the zero-based bit position (from RIGHT TO LEFT, 63 -> 0) of the
- * most significant (left-most) 1-bit in a double word.
- */
-static __inline__ int __ilog2(unsigned long x)
-{
-       int lz;
-
-       asm ("cntlzd %0,%1" : "=r" (lz) : "r" (x));
-       return 63 - lz;
-}
-
-/*
- * Determines the bit position of the least significant (rightmost) 0 bit
- * in the specified double word. The returned bit position will be zero-based,
- * starting from the right side (63 - 0).
- */
-static __inline__ unsigned long ffz(unsigned long x)
-{
-       /* no zero exists anywhere in the 8 byte area. */
-       if ((x = ~x) == 0)
-               return 64;
-
-       /*
-        * Calculate the bit position of the least signficant '1' bit in x
-        * (since x has been changed this will actually be the least signficant
-        * '0' bit in * the original x).  Note: (x & -x) gives us a mask that
-        * is the least significant * (RIGHT-most) 1-bit of the value in x.
-        */
-       return __ilog2(x & -x);
-}
-
-static __inline__ int __ffs(unsigned long x)
-{
-       return __ilog2(x & -x);
-}
-
-/*
- * 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).
- */
-static __inline__ int ffs(int x)
-{
-       unsigned long i = (unsigned long)x;
-       return __ilog2(i & -i) + 1;
-}
-
-/*
- * fls: find last (most-significant) bit set.
- * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
- */
-#define fls(x) generic_fls(x)
-
-/*
- * hweightN: returns the hamming weight (i.e. the number
- * of bits set) of a N-bit word
- */
-#define hweight64(x) generic_hweight64(x)
-#define hweight32(x) generic_hweight32(x)
-#define hweight16(x) generic_hweight16(x)
-#define hweight8(x) generic_hweight8(x)
-
-extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, unsigned long offset);
-#define find_first_zero_bit(addr, size) \
-       find_next_zero_bit((addr), (size), 0)
-
-extern unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset);
-#define find_first_bit(addr, size) \
-       find_next_bit((addr), (size), 0)
-
-extern unsigned long find_next_zero_le_bit(const unsigned long *addr, unsigned long size, unsigned long offset);
-#define find_first_zero_le_bit(addr, size) \
-       find_next_zero_le_bit((addr), (size), 0)
-
-static __inline__ int test_le_bit(unsigned long nr, __const__ unsigned long * addr)
-{
-       __const__ unsigned char *ADDR = (__const__ unsigned char *) addr;
-       return (ADDR[nr >> 3] >> (nr & 7)) & 1;
-}
-
-#define test_and_clear_le_bit(nr, addr) \
-       test_and_clear_bit((nr) ^ 0x38, (addr))
-#define test_and_set_le_bit(nr, addr) \
-       test_and_set_bit((nr) ^ 0x38, (addr))
-
-/*
- * non-atomic versions
- */
-
-#define __set_le_bit(nr, addr) \
-       __set_bit((nr) ^ 0x38, (addr))
-#define __clear_le_bit(nr, addr) \
-       __clear_bit((nr) ^ 0x38, (addr))
-#define __test_and_clear_le_bit(nr, addr) \
-       __test_and_clear_bit((nr) ^ 0x38, (addr))
-#define __test_and_set_le_bit(nr, addr) \
-       __test_and_set_bit((nr) ^ 0x38, (addr))
-
-#define ext2_set_bit(nr,addr) \
-       __test_and_set_le_bit((nr), (unsigned long*)addr)
-#define ext2_clear_bit(nr, addr) \
-       __test_and_clear_le_bit((nr), (unsigned long*)addr)
-
-#define ext2_set_bit_atomic(lock, nr, addr) \
-       test_and_set_le_bit((nr), (unsigned long*)addr)
-#define ext2_clear_bit_atomic(lock, nr, addr) \
-       test_and_clear_le_bit((nr), (unsigned long*)addr)
-
-
-#define ext2_test_bit(nr, addr)      test_le_bit((nr),(unsigned long*)addr)
-#define ext2_find_first_zero_bit(addr, size) \
-       find_first_zero_le_bit((unsigned long*)addr, size)
-#define ext2_find_next_zero_bit(addr, size, off) \
-       find_next_zero_le_bit((unsigned long*)addr, size, off)
-
-#define minix_test_and_set_bit(nr,addr)                test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr)                 set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr)      test_and_clear_bit(nr,addr)
-#define minix_test_bit(nr,addr)                        test_bit(nr,addr)
-#define minix_find_first_zero_bit(addr,size)   find_first_zero_bit(addr,size)
-
-#endif /* __KERNEL__ */
-#endif /* _PPC64_BITOPS_H */
diff --git a/include/asm-ppc64/ipcbuf.h b/include/asm-ppc64/ipcbuf.h
deleted file mode 100644 (file)
index fa393c8..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef __PPC64_IPCBUF_H__
-#define __PPC64_IPCBUF_H__
-
-/*
- * The ipc64_perm structure for the PPC is identical to kern_ipc_perm
- * as we have always had 32-bit UIDs and GIDs in the kernel.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-struct ipc64_perm
-{
-       __kernel_key_t  key;
-       __kernel_uid_t  uid;
-       __kernel_gid_t  gid;
-       __kernel_uid_t  cuid;
-       __kernel_gid_t  cgid;
-       __kernel_mode_t mode;
-       unsigned int    seq;
-       unsigned int    __pad1;
-       unsigned long   __unused1;
-       unsigned long   __unused2;
-};
-
-#endif /* __PPC64_IPCBUF_H__ */
index 77a743402db40c1e7710fc22d7e4d304955c7da8..820dd729b895aeecdd257b09888be3e170115c6e 100644 (file)
  * 2 of the License, or (at your option) any later version.
  */
 
-/*
- * Every architecture must define this function. It's the fastest
- * way of searching a 140-bit bitmap where the first 100 bits are
- * unlikely to be set. It's guaranteed that at least one of the 140
- * bits is cleared.
- */
-static inline int sched_find_first_bit(unsigned long *b)
-{
-       if (unlikely(b[0]))
-               return __ffs(b[0]);
-       if (unlikely(b[1]))
-               return __ffs(b[1]) + 64;
-       return __ffs(b[2]) + 128;
-}
-
 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
 {
 }
index dfaa21566c9aa9f004ebfef1c8f617b99c522260..def47d720d3da822259bf0e5834effc447a9593d 100644 (file)
@@ -70,7 +70,7 @@ extern struct nvram_partition *nvram_find_partition(int sig, const char *name);
 
 extern int pSeries_nvram_init(void);
 extern int pmac_nvram_init(void);
-extern int bpa_nvram_init(void);
+extern int mmio_nvram_init(void);
 
 /* PowerMac specific nvram stuffs */
 
index c5e9052e796710db29efbdd8a5d12daeacf1c7c1..0f42fcc1900b9473f4fd1f7bc04d2fec99153fd2 100644 (file)
@@ -64,6 +64,7 @@ extern cpumask_t cpu_sibling_map[NR_CPUS];
 
 void smp_init_iSeries(void);
 void smp_init_pSeries(void);
+void smp_init_cell(void);
 
 extern int __cpu_disable(void);
 extern void __cpu_die(unsigned int cpu);
diff --git a/include/asm-ppc64/uaccess.h b/include/asm-ppc64/uaccess.h
deleted file mode 100644 (file)
index 132c127..0000000
+++ /dev/null
@@ -1,341 +0,0 @@
-#ifndef _PPC64_UACCESS_H
-#define _PPC64_UACCESS_H
-
-/* 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#ifndef __ASSEMBLY__
-#include <linux/sched.h>
-#include <linux/errno.h>
-#include <asm/processor.h>
-
-#define VERIFY_READ    0
-#define VERIFY_WRITE   1
-
-/*
- * The fs value determines whether argument validity checking should be
- * performed or not.  If get_fs() == USER_DS, checking is performed, with
- * get_fs() == KERNEL_DS, checking is bypassed.
- *
- * For historical reasons, these macros are grossly misnamed.
- */
-
-#define MAKE_MM_SEG(s)  ((mm_segment_t) { (s) })
-
-#define KERNEL_DS      MAKE_MM_SEG(0UL)
-#define USER_DS                MAKE_MM_SEG(0xf000000000000000UL)
-
-#define get_ds()       (KERNEL_DS)
-#define get_fs()       (current->thread.fs)
-#define set_fs(val)    (current->thread.fs = (val))
-
-#define segment_eq(a,b)        ((a).seg == (b).seg)
-
-/*
- * Use the alpha trick for checking ranges:
- *
- * Is a address valid? This does a straightforward calculation rather
- * than tests.
- *
- * Address valid if:
- *  - "addr" doesn't have any high-bits set
- *  - AND "size" doesn't have any high-bits set
- *  - OR we are in kernel mode.
- *
- * We dont have to check for high bits in (addr+size) because the first
- * two checks force the maximum result to be below the start of the
- * kernel region.
- */
-#define __access_ok(addr,size,segment) \
-       (((segment).seg & (addr | size )) == 0)
-
-#define access_ok(type,addr,size) \
-       __access_ok(((__force unsigned long)(addr)),(size),get_fs())
-
-/*
- * The exception table consists of pairs of addresses: the first is the
- * address of an instruction that is allowed to fault, and the second is
- * the address at which the program should continue.  No registers are
- * modified, so it is entirely up to the continuation code to figure out
- * what to do.
- *
- * All the routines below use bits of fixup code that are out of line
- * with the main instruction path.  This means when everything is well,
- * we don't even have to jump over them.  Further, they do not intrude
- * on our cache or tlb entries.
- */
-
-struct exception_table_entry
-{
-       unsigned long insn, fixup;
-};
-
-/* Returns 0 if exception not found and fixup otherwise.  */
-extern unsigned long search_exception_table(unsigned long);
-
-/*
- * These are the main single-value transfer routines.  They automatically
- * use the right size if we just have the right pointer type.
- *
- * This gets kind of ugly. We want to return _two_ values in "get_user()"
- * and yet we don't want to do any pointers, because that is too much
- * of a performance impact. Thus we have a few rather ugly macros here,
- * and hide all the ugliness from the user.
- *
- * The "__xxx" versions of the user access functions are versions that
- * do not verify the address space, that must have been done previously
- * with a separate "access_ok()" call (this is used when we do multiple
- * accesses to the same area of user memory).
- *
- * As we use the same address space for kernel and user data on the
- * PowerPC, we can just do these as direct assignments.  (Of course, the
- * exception handling means that it's no longer "just"...)
- */
-#define get_user(x,ptr) \
-  __get_user_check((x),(ptr),sizeof(*(ptr)))
-#define put_user(x,ptr) \
-  __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
-
-#define __get_user(x,ptr) \
-  __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
-#define __put_user(x,ptr) \
-  __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
-
-#define __get_user_unaligned __get_user
-#define __put_user_unaligned __put_user
-
-extern long __put_user_bad(void);
-
-#define __put_user_nocheck(x,ptr,size)                         \
-({                                                             \
-       long __pu_err;                                          \
-       might_sleep();                                          \
-       __chk_user_ptr(ptr);                                    \
-       __put_user_size((x),(ptr),(size),__pu_err,-EFAULT);     \
-       __pu_err;                                               \
-})
-
-#define __put_user_check(x,ptr,size)                                   \
-({                                                                     \
-       long __pu_err = -EFAULT;                                        \
-       void __user *__pu_addr = (ptr);                                 \
-       might_sleep();                                                  \
-       if (access_ok(VERIFY_WRITE,__pu_addr,size))                     \
-               __put_user_size((x),__pu_addr,(size),__pu_err,-EFAULT); \
-       __pu_err;                                                       \
-})
-
-#define __put_user_size(x,ptr,size,retval,errret)                      \
-do {                                                                   \
-       retval = 0;                                                     \
-       switch (size) {                                                 \
-         case 1: __put_user_asm(x,ptr,retval,"stb",errret); break;     \
-         case 2: __put_user_asm(x,ptr,retval,"sth",errret); break;     \
-         case 4: __put_user_asm(x,ptr,retval,"stw",errret); break;     \
-         case 8: __put_user_asm(x,ptr,retval,"std",errret); break;     \
-         default: __put_user_bad();                                    \
-       }                                                               \
-} while (0)
-
-/*
- * We don't tell gcc that we are accessing memory, but this is OK
- * because we do not write to any memory gcc knows about, so there
- * are no aliasing issues.
- */
-#define __put_user_asm(x, addr, err, op, errret)               \
-       __asm__ __volatile__(                                   \
-               "1:     "op" %1,0(%2)   # put_user\n"           \
-               "2:\n"                                          \
-               ".section .fixup,\"ax\"\n"                      \
-               "3:     li %0,%3\n"                             \
-               "       b 2b\n"                                 \
-               ".previous\n"                                   \
-               ".section __ex_table,\"a\"\n"                   \
-               "       .align 3\n"                             \
-               "       .llong 1b,3b\n"                         \
-               ".previous"                                     \
-               : "=r"(err)                                     \
-               : "r"(x), "b"(addr), "i"(errret), "0"(err))
-
-
-#define __get_user_nocheck(x,ptr,size)                         \
-({                                                             \
-       long __gu_err;                                          \
-       unsigned long __gu_val;                                 \
-       might_sleep();                                          \
-       __get_user_size(__gu_val,(ptr),(size),__gu_err,-EFAULT);\
-       (x) = (__typeof__(*(ptr)))__gu_val;                     \
-       __gu_err;                                               \
-})
-
-#define __get_user_check(x,ptr,size)                                   \
-({                                                                     \
-       long __gu_err = -EFAULT;                                        \
-       unsigned long __gu_val = 0;                                     \
-       const __typeof__(*(ptr)) __user *__gu_addr = (ptr);             \
-       might_sleep();                                                  \
-       if (access_ok(VERIFY_READ,__gu_addr,size))                      \
-               __get_user_size(__gu_val,__gu_addr,(size),__gu_err,-EFAULT);\
-       (x) = (__typeof__(*(ptr)))__gu_val;                             \
-       __gu_err;                                                       \
-})
-
-extern long __get_user_bad(void);
-
-#define __get_user_size(x,ptr,size,retval,errret)                      \
-do {                                                                   \
-       retval = 0;                                                     \
-       __chk_user_ptr(ptr);                                            \
-       switch (size) {                                                 \
-         case 1: __get_user_asm(x,ptr,retval,"lbz",errret); break;     \
-         case 2: __get_user_asm(x,ptr,retval,"lhz",errret); break;     \
-         case 4: __get_user_asm(x,ptr,retval,"lwz",errret); break;     \
-         case 8: __get_user_asm(x,ptr,retval,"ld",errret);  break;     \
-         default: (x) = __get_user_bad();                              \
-       }                                                               \
-} while (0)
-
-#define __get_user_asm(x, addr, err, op, errret)       \
-       __asm__ __volatile__(                           \
-               "1:     "op" %1,0(%2)   # get_user\n"   \
-               "2:\n"                                  \
-               ".section .fixup,\"ax\"\n"              \
-               "3:     li %0,%3\n"                     \
-               "       li %1,0\n"                      \
-               "       b 2b\n"                         \
-               ".previous\n"                           \
-               ".section __ex_table,\"a\"\n"           \
-               "       .align 3\n"                     \
-               "       .llong 1b,3b\n"                 \
-               ".previous"                             \
-               : "=r"(err), "=r"(x)                    \
-               : "b"(addr), "i"(errret), "0"(err))
-
-/* more complex routines */
-
-extern unsigned long __copy_tofrom_user(void __user *to, const void __user *from,
-                                       unsigned long size);
-
-static inline unsigned long
-__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
-{
-       if (__builtin_constant_p(n)) {
-               unsigned long ret;
-
-               switch (n) {
-               case 1:
-                       __get_user_size(*(u8 *)to, from, 1, ret, 1);
-                       return ret;
-               case 2:
-                       __get_user_size(*(u16 *)to, from, 2, ret, 2);
-                       return ret;
-               case 4:
-                       __get_user_size(*(u32 *)to, from, 4, ret, 4);
-                       return ret;
-               case 8:
-                       __get_user_size(*(u64 *)to, from, 8, ret, 8);
-                       return ret;
-               }
-       }
-       return __copy_tofrom_user((__force void __user *) to, from, n);
-}
-
-static inline unsigned long
-__copy_from_user(void *to, const void __user *from, unsigned long n)
-{
-       might_sleep();
-       return __copy_from_user_inatomic(to, from, n);
-}
-
-static inline unsigned long
-__copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
-{
-       if (__builtin_constant_p(n)) {
-               unsigned long ret;
-
-               switch (n) {
-               case 1:
-                       __put_user_size(*(u8 *)from, (u8 __user *)to, 1, ret, 1);
-                       return ret;
-               case 2:
-                       __put_user_size(*(u16 *)from, (u16 __user *)to, 2, ret, 2);
-                       return ret;
-               case 4:
-                       __put_user_size(*(u32 *)from, (u32 __user *)to, 4, ret, 4);
-                       return ret;
-               case 8:
-                       __put_user_size(*(u64 *)from, (u64 __user *)to, 8, ret, 8);
-                       return ret;
-               }
-       }
-       return __copy_tofrom_user(to, (__force const void __user *) from, n);
-}
-
-static inline unsigned long
-__copy_to_user(void __user *to, const void *from, unsigned long n)
-{
-       might_sleep();
-       return __copy_to_user_inatomic(to, from, n);
-}
-
-#define __copy_in_user(to, from, size) \
-       __copy_tofrom_user((to), (from), (size))
-
-extern unsigned long copy_from_user(void *to, const void __user *from,
-                                   unsigned long n);
-extern unsigned long copy_to_user(void __user *to, const void *from,
-                                 unsigned long n);
-extern unsigned long copy_in_user(void __user *to, const void __user *from,
-                                 unsigned long n);
-
-extern unsigned long __clear_user(void __user *addr, unsigned long size);
-
-static inline unsigned long
-clear_user(void __user *addr, unsigned long size)
-{
-       might_sleep();
-       if (likely(access_ok(VERIFY_WRITE, addr, size)))
-               size = __clear_user(addr, size);
-       return size;
-}
-
-extern int __strncpy_from_user(char *dst, const char __user *src, long count);
-
-static inline long
-strncpy_from_user(char *dst, const char __user *src, long count)
-{
-       might_sleep();
-       if (likely(access_ok(VERIFY_READ, src, 1)))
-               return __strncpy_from_user(dst, src, count);
-       return -EFAULT;
-}
-
-/*
- * Return the size of a string (including the ending 0)
- *
- * Return 0 for error
- */
-extern int __strnlen_user(const char __user *str, long len);
-
-/*
- * Returns the length of the string at str (including the null byte),
- * or 0 if we hit a page we can't access,
- * or something > len if we didn't find a null byte.
- */
-static inline int strnlen_user(const char __user *str, long len)
-{
-       might_sleep();
-       if (likely(access_ok(VERIFY_READ, str, 1)))
-               return __strnlen_user(str, len);
-       return 0;
-}
-
-#define strlen_user(str)       strnlen_user((str), 0x7ffffffe)
-
-#endif  /* __ASSEMBLY__ */
-
-#endif /* _PPC64_UACCESS_H */