diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-11-13 08:20:38 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-11-13 08:20:38 -0800 |
commit | 239fd45938f9ddf64f120e0260c7b76eb73bd5a7 (patch) | |
tree | 2b0350fb9f45f2ffa7473e6c3d75f9ff26d85e82 /arch | |
parent | eea2078eaf2bcd4e5e8b2e08798071efedac5e17 (diff) | |
parent | 36b600f2649e3be49039efe31edeeb64277dbd99 (diff) |
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* '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
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/Kconfig | 2 | ||||
-rwxr-xr-x | arch/powerpc/boot/wrapper | 4 | ||||
-rw-r--r-- | arch/powerpc/boot/zImage.lds.S | 5 | ||||
-rw-r--r-- | arch/powerpc/kernel/rtas_flash.c | 47 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spu_base.c | 41 |
5 files changed, 78 insertions, 21 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 2bd9b7fb0f6c..0673dbedb241 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -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 diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper index eab7318729e9..b5fb1fee76f8 100755 --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper @@ -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 diff --git a/arch/powerpc/boot/zImage.lds.S b/arch/powerpc/boot/zImage.lds.S index 4b6bb3ffe3dc..4be3c6414b04 100644 --- a/arch/powerpc/boot/zImage.lds.S +++ b/arch/powerpc/boot/zImage.lds.S @@ -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) } diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c index 1442b63a75da..6f6fc977cb39 100644 --- a/arch/powerpc/kernel/rtas_flash.c +++ b/arch/powerpc/kernel/rtas_flash.c @@ -72,6 +72,10 @@ #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); diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index d0fb959e3ef1..7aa809d5a244 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c @@ -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: |