--- zzzz-none-000/linux-2.6.19.2/arch/powerpc/kernel/rtas_flash.c 2007-01-10 19:10:37.000000000 +0000 +++ davinci-8020-5505/linux-2.6.19.2/arch/powerpc/kernel/rtas_flash.c 2007-01-11 07:38:19.000000000 +0000 @@ -72,10 +72,6 @@ #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; @@ -87,7 +83,7 @@ * into a version/length and translate the pointers * to absolute. */ -#define FLASH_BLOCKS_PER_NODE ((RTAS_BLKLIST_LENGTH - 16) / sizeof(struct flash_block)) +#define FLASH_BLOCKS_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct flash_block)) struct flash_block_list { unsigned long num_blocks; struct flash_block_list *next; @@ -100,9 +96,6 @@ 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. @@ -160,7 +153,7 @@ return FLASH_IMG_NULL_DATA; } block_size = f->blocks[i].length; - if (block_size <= 0 || block_size > RTAS_BLK_SIZE) { + if (block_size <= 0 || block_size > PAGE_SIZE) { return FLASH_IMG_BAD_LEN; } image_size += block_size; @@ -184,9 +177,9 @@ while (f) { for (i = 0; i < f->num_blocks; i++) - kmem_cache_free(flash_block_cache, f->blocks[i].data); + free_page((unsigned long)(f->blocks[i].data)); next = f->next; - kmem_cache_free(flash_block_cache, f); + free_page((unsigned long)f); f = next; } } @@ -285,12 +278,6 @@ 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 @@ -315,7 +302,7 @@ * proc file */ if (uf->flist == NULL) { - uf->flist = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); + uf->flist = (struct flash_block_list *) get_zeroed_page(GFP_KERNEL); if (!uf->flist) return -ENOMEM; } @@ -326,21 +313,21 @@ next_free = fl->num_blocks; if (next_free == FLASH_BLOCKS_PER_NODE) { /* Need to allocate another block_list */ - fl->next = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); + fl->next = (struct flash_block_list *)get_zeroed_page(GFP_KERNEL); if (!fl->next) return -ENOMEM; fl = fl->next; next_free = 0; } - if (count > RTAS_BLK_SIZE) - count = RTAS_BLK_SIZE; - p = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); + if (count > PAGE_SIZE) + count = PAGE_SIZE; + p = (char *)get_zeroed_page(GFP_KERNEL); if (!p) return -ENOMEM; if(copy_from_user(p, buffer, count)) { - kmem_cache_free(flash_block_cache, p); + free_page((unsigned long)p); return -EFAULT; } fl->blocks[next_free].data = p; @@ -804,16 +791,6 @@ 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: @@ -828,10 +805,6 @@ 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);