Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
authorLinus Torvalds <torvalds@g5.osdl.org>
Mon, 13 Nov 2006 16:20:38 +0000 (08:20 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 13 Nov 2006 16:20:38 +0000 (08:20 -0800)
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc:
  [POWERPC] cell: set ARCH_SPARSEMEM_DEFAULT in Kconfig
  [POWERPC] Fix cell "new style" mapping and add debug
  [POWERPC] pseries: Force 4k update_flash block and list sizes
  [POWERPC] CPM_UART: Fix non-console initialisation
  [POWERPC] CPM_UART: Fix non-console transmit
  [POWERPC] Make sure initrd and dtb sections get into zImage correctly

arch/powerpc/Kconfig
arch/powerpc/boot/wrapper
arch/powerpc/boot/zImage.lds.S
arch/powerpc/kernel/rtas_flash.c
arch/powerpc/platforms/cell/spu_base.c
drivers/serial/cpm_uart/cpm_uart.h
drivers/serial/cpm_uart/cpm_uart_core.c
drivers/serial/cpm_uart/cpm_uart_cpm1.c

index 2bd9b7fb0f6c91cc7e35bdedf3bafed7f897e7a3..0673dbedb241e8562db83b8fa69ba5d43eacf473 100644 (file)
@@ -740,7 +740,7 @@ config ARCH_SPARSEMEM_ENABLE
 
 config ARCH_SPARSEMEM_DEFAULT
        def_bool y
-       depends on SMP && PPC_PSERIES
+       depends on (SMP && PPC_PSERIES) || PPC_CELL
 
 config ARCH_POPULATES_NODE_MAP
        def_bool y
index eab7318729e93a26d8eb9a898ecbd9d2d6f9d8e7..b5fb1fee76f8ca0a1e6bf1961c167c458d05ae90 100755 (executable)
@@ -179,11 +179,11 @@ if [ -z "$cacheit" ]; then
 fi
 
 if [ -n "$initrd" ]; then
-    addsec $tmp "$initrd" initrd
+    addsec $tmp "$initrd" $isection
 fi
 
 if [ -n "$dtb" ]; then
-    addsec $tmp "$dtb" dtb
+    addsec $tmp "$dtb" .kernel:dtb
 fi
 
 if [ "$platform" != "miboot" ]; then
index 4b6bb3ffe3dcb1ea5b06c2df1e2ade5fceb19310..4be3c6414b04d683ff015ff6cc2648da62fb0ee7 100644 (file)
@@ -21,6 +21,11 @@ SECTIONS
     __got2_end = .;
   }
 
+  . = ALIGN(8);
+  _dtb_start = .;
+  .kernel:dtb : { *(.kernel:dtb) }
+  _dtb_end = .;
+
   . = ALIGN(4096);
   _vmlinux_start =  .;
   .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) }
index 1442b63a75daa1998f5d8c4bc22a6b8d758f46e7..6f6fc977cb399a189c0d530dc44badf1c4a021ce 100644 (file)
 #define VALIDATE_BUF_SIZE 4096    
 #define RTAS_MSG_MAXLEN   64
 
+/* Quirk - RTAS requires 4k list length and block size */
+#define RTAS_BLKLIST_LENGTH 4096
+#define RTAS_BLK_SIZE 4096
+
 struct flash_block {
        char *data;
        unsigned long length;
@@ -83,7 +87,7 @@ struct flash_block {
  * into a version/length and translate the pointers
  * to absolute.
  */
-#define FLASH_BLOCKS_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct flash_block))
+#define FLASH_BLOCKS_PER_NODE ((RTAS_BLKLIST_LENGTH - 16) / sizeof(struct flash_block))
 struct flash_block_list {
        unsigned long num_blocks;
        struct flash_block_list *next;
@@ -96,6 +100,9 @@ struct flash_block_list_header { /* just the header of flash_block_list */
 
 static struct flash_block_list_header rtas_firmware_flash_list = {0, NULL};
 
+/* Use slab cache to guarantee 4k alignment */
+static kmem_cache_t *flash_block_cache = NULL;
+
 #define FLASH_BLOCK_LIST_VERSION (1UL)
 
 /* Local copy of the flash block list.
@@ -153,7 +160,7 @@ static int flash_list_valid(struct flash_block_list *flist)
                                return FLASH_IMG_NULL_DATA;
                        }
                        block_size = f->blocks[i].length;
-                       if (block_size <= 0 || block_size > PAGE_SIZE) {
+                       if (block_size <= 0 || block_size > RTAS_BLK_SIZE) {
                                return FLASH_IMG_BAD_LEN;
                        }
                        image_size += block_size;
@@ -177,9 +184,9 @@ static void free_flash_list(struct flash_block_list *f)
 
        while (f) {
                for (i = 0; i < f->num_blocks; i++)
-                       free_page((unsigned long)(f->blocks[i].data));
+                       kmem_cache_free(flash_block_cache, f->blocks[i].data);
                next = f->next;
-               free_page((unsigned long)f);
+               kmem_cache_free(flash_block_cache, f);
                f = next;
        }
 }
@@ -278,6 +285,12 @@ static ssize_t rtas_flash_read(struct file *file, char __user *buf,
        return msglen;
 }
 
+/* constructor for flash_block_cache */
+void rtas_block_ctor(void *ptr, kmem_cache_t *cache, unsigned long flags)
+{
+       memset(ptr, 0, RTAS_BLK_SIZE);
+}
+
 /* We could be much more efficient here.  But to keep this function
  * simple we allocate a page to the block list no matter how small the
  * count is.  If the system is low on memory it will be just as well
@@ -302,7 +315,7 @@ static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
         * proc file
         */
        if (uf->flist == NULL) {
-               uf->flist = (struct flash_block_list *) get_zeroed_page(GFP_KERNEL);
+               uf->flist = kmem_cache_alloc(flash_block_cache, GFP_KERNEL);
                if (!uf->flist)
                        return -ENOMEM;
        }
@@ -313,21 +326,21 @@ static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
        next_free = fl->num_blocks;
        if (next_free == FLASH_BLOCKS_PER_NODE) {
                /* Need to allocate another block_list */
-               fl->next = (struct flash_block_list *)get_zeroed_page(GFP_KERNEL);
+               fl->next = kmem_cache_alloc(flash_block_cache, GFP_KERNEL);
                if (!fl->next)
                        return -ENOMEM;
                fl = fl->next;
                next_free = 0;
        }
 
-       if (count > PAGE_SIZE)
-               count = PAGE_SIZE;
-       p = (char *)get_zeroed_page(GFP_KERNEL);
+       if (count > RTAS_BLK_SIZE)
+               count = RTAS_BLK_SIZE;
+       p = kmem_cache_alloc(flash_block_cache, GFP_KERNEL);
        if (!p)
                return -ENOMEM;
        
        if(copy_from_user(p, buffer, count)) {
-               free_page((unsigned long)p);
+               kmem_cache_free(flash_block_cache, p);
                return -EFAULT;
        }
        fl->blocks[next_free].data = p;
@@ -791,6 +804,16 @@ int __init rtas_flash_init(void)
                goto cleanup;
 
        rtas_flash_term_hook = rtas_flash_firmware;
+
+       flash_block_cache = kmem_cache_create("rtas_flash_cache",
+                               RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0,
+                               rtas_block_ctor, NULL);
+       if (!flash_block_cache) {
+               printk(KERN_ERR "%s: failed to create block cache\n",
+                               __FUNCTION__);
+               rc = -ENOMEM;
+               goto cleanup;
+       }
        return 0;
 
 cleanup:
@@ -805,6 +828,10 @@ cleanup:
 void __exit rtas_flash_cleanup(void)
 {
        rtas_flash_term_hook = NULL;
+
+       if (flash_block_cache)
+               kmem_cache_destroy(flash_block_cache);
+
        remove_flash_pde(firmware_flash_pde);
        remove_flash_pde(firmware_update_pde);
        remove_flash_pde(validate_pde);
index d0fb959e3ef113b117d4972c373067baab96aa29..7aa809d5a244230f14ce6a9042efc918063409cf 100644 (file)
@@ -655,14 +655,19 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
 
        for (i=0; i < 3; i++) {
                ret = of_irq_map_one(np, i, &oirq);
-               if (ret)
+               if (ret) {
+                       pr_debug("spu_new: failed to get irq %d\n", i);
                        goto err;
-
+               }
                ret = -EINVAL;
+               pr_debug("  irq %d no 0x%x on %s\n", i, oirq.specifier[0],
+                        oirq.controller->full_name);
                spu->irqs[i] = irq_create_of_mapping(oirq.controller,
                                        oirq.specifier, oirq.size);
-               if (spu->irqs[i] == NO_IRQ)
+               if (spu->irqs[i] == NO_IRQ) {
+                       pr_debug("spu_new: failed to map it !\n");
                        goto err;
+               }
        }
        return 0;
 
@@ -681,7 +686,7 @@ static int spu_map_resource(struct device_node *node, int nr,
        struct resource resource = { };
        int ret;
 
-       ret = of_address_to_resource(node, 0, &resource);
+       ret = of_address_to_resource(node, nr, &resource);
        if (ret)
                goto out;
 
@@ -704,22 +709,42 @@ static int __init spu_map_device(struct spu *spu, struct device_node *node)
 
        ret = spu_map_resource(node, 0, (void __iomem**)&spu->local_store,
                                        &spu->local_store_phys);
-       if (ret)
+       if (ret) {
+               pr_debug("spu_new: failed to map %s resource 0\n",
+                        node->full_name);
                goto out;
+       }
        ret = spu_map_resource(node, 1, (void __iomem**)&spu->problem,
                                        &spu->problem_phys);
-       if (ret)
+       if (ret) {
+               pr_debug("spu_new: failed to map %s resource 1\n",
+                        node->full_name);
                goto out_unmap;
+       }
        ret = spu_map_resource(node, 2, (void __iomem**)&spu->priv2,
                                        NULL);
-       if (ret)
+       if (ret) {
+               pr_debug("spu_new: failed to map %s resource 2\n",
+                        node->full_name);
                goto out_unmap;
+       }
 
        if (!firmware_has_feature(FW_FEATURE_LPAR))
                ret = spu_map_resource(node, 3, (void __iomem**)&spu->priv1,
                                        NULL);
-       if (ret)
+       if (ret) {
+               pr_debug("spu_new: failed to map %s resource 3\n",
+                        node->full_name);
                goto out_unmap;
+       }
+       pr_debug("spu_new: %s maps:\n", node->full_name);
+       pr_debug("  local store   : 0x%016lx -> 0x%p\n",
+                spu->local_store_phys, spu->local_store);
+       pr_debug("  problem state : 0x%016lx -> 0x%p\n",
+                spu->problem_phys, spu->problem);
+       pr_debug("  priv2         :                       0x%p\n", spu->priv2);
+       pr_debug("  priv1         :                       0x%p\n", spu->priv1);
+
        return 0;
 
 out_unmap:
index a8f894c7819463cd30b39eafd1bc10032f135965..69715e55650612ebca86fd7d8b069e6ad4eb03a9 100644 (file)
@@ -88,7 +88,7 @@ extern struct uart_cpm_port cpm_uart_ports[UART_NR];
 
 /* these are located in their respective files */
 void cpm_line_cr_cmd(int line, int cmd);
-int cpm_uart_init_portdesc(void);
+int __init cpm_uart_init_portdesc(void);
 int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con);
 void cpm_uart_freebuf(struct uart_cpm_port *pinfo);
 
index 0abb544ae63dbc34a7acc19eaad39c84e5152a17..7a3b97fdf8d18713509b8c8b9502ce4cb3072bca 100644 (file)
@@ -195,10 +195,8 @@ static void cpm_uart_start_tx(struct uart_port *port)
        if (cpm_uart_tx_pump(port) != 0) {
                if (IS_SMC(pinfo)) {
                        smcp->smc_smcm |= SMCM_TX;
-                       smcp->smc_smcmr |= SMCMR_TEN;
                } else {
                        sccp->scc_sccm |= UART_SCCM_TX;
-                       pinfo->sccp->scc_gsmrl |= SCC_GSMRL_ENT;
                }
        }
 }
@@ -421,9 +419,10 @@ static int cpm_uart_startup(struct uart_port *port)
        /* Startup rx-int */
        if (IS_SMC(pinfo)) {
                pinfo->smcp->smc_smcm |= SMCM_RX;
-               pinfo->smcp->smc_smcmr |= SMCMR_REN;
+               pinfo->smcp->smc_smcmr |= (SMCMR_REN | SMCMR_TEN);
        } else {
                pinfo->sccp->scc_sccm |= UART_SCCM_RX;
+               pinfo->sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
        }
 
        if (!(pinfo->flags & FLAG_CONSOLE))
@@ -1350,11 +1349,10 @@ static int cpm_uart_init(void) {
                pr_info("cpm_uart: WARNING: no UART devices found on platform bus!\n");
                pr_info(
                "cpm_uart: the driver will guess configuration, but this mode is no longer supported.\n");
-#ifndef CONFIG_SERIAL_CPM_CONSOLE
-               ret = cpm_uart_init_portdesc();
-               if (ret)
-                       return ret;
-#endif
+
+               /* Don't run this again, if the console driver did it already */
+               if (cpm_uart_nr == 0)
+                       cpm_uart_init_portdesc();
 
                cpm_reg.nr = cpm_uart_nr;
                ret = uart_register_driver(&cpm_reg);
@@ -1366,6 +1364,8 @@ static int cpm_uart_init(void) {
                        int con = cpm_uart_port_map[i];
                        cpm_uart_ports[con].port.line = i;
                        cpm_uart_ports[con].port.flags = UPF_BOOT_AUTOCONF;
+                       if (cpm_uart_ports[con].set_lineif)
+                               cpm_uart_ports[con].set_lineif(&cpm_uart_ports[con]);
                        uart_add_one_port(&cpm_reg, &cpm_uart_ports[con].port);
                }
 
index 95afc37297a849253d495e744bb90b47cde3a437..08e55fdc882a87b004e1fd8a04bf334c7e0b708e 100644 (file)
@@ -184,7 +184,7 @@ void cpm_uart_freebuf(struct uart_cpm_port *pinfo)
 }
 
 /* Setup any dynamic params in the uart desc */
-int cpm_uart_init_portdesc(void)
+int __init cpm_uart_init_portdesc(void)
 {
        pr_debug("CPM uart[-]:init portdesc\n");
 
This page took 0.03388 seconds and 5 git commands to generate.