aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/rtas_flash.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-02 13:16:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-02 13:16:16 -0400
commit5a148af66932c31814e263366094b5812210b501 (patch)
treec5155ae89d7109533b8b073631bd65a7dd394b9d /arch/powerpc/kernel/rtas_flash.c
parent99c6bcf46d2233d33e441834e958ed0bc22b190a (diff)
parent54d5999d98f2ab36ad71b9ef4d82cf5f399205f5 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Pull powerpc update from Benjamin Herrenschmidt: "The main highlights this time around are: - A pile of addition POWER8 bits and nits, such as updated performance counter support (Michael Ellerman), new branch history buffer support (Anshuman Khandual), base support for the new PCI host bridge when not using the hypervisor (Gavin Shan) and other random related bits and fixes from various contributors. - Some rework of our page table format by Aneesh Kumar which fixes a thing or two and paves the way for THP support. THP itself will not make it this time around however. - More Freescale updates, including Altivec support on the new e6500 cores, new PCI controller support, and a pile of new boards support and updates. - The usual batch of trivial cleanups & fixes" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (156 commits) powerpc: Fix build error for book3e powerpc: Context switch the new EBB SPRs powerpc: Turn on the EBB H/FSCR bits powerpc: Replace CPU_FTR_BCTAR with CPU_FTR_ARCH_207S powerpc: Setup BHRB instructions facility in HFSCR for POWER8 powerpc: Fix interrupt range check on debug exception powerpc: Update tlbie/tlbiel as per ISA doc powerpc: Print page size info during boot powerpc: print both base and actual page size on hash failure powerpc: Fix hpte_decode to use the correct decoding for page sizes powerpc: Decode the pte-lp-encoding bits correctly. powerpc: Use encode avpn where we need only avpn values powerpc: Reduce PTE table memory wastage powerpc: Move the pte free routines from common header powerpc: Reduce the PTE_INDEX_SIZE powerpc: Switch 16GB and 16MB explicit hugepages to a different page table format powerpc: New hugepage directory format powerpc: Don't truncate pgd_index wrongly powerpc: Don't hard code the size of pte page powerpc: Save DAR and DSISR in pt_regs on MCE ...
Diffstat (limited to 'arch/powerpc/kernel/rtas_flash.c')
-rw-r--r--arch/powerpc/kernel/rtas_flash.c51
1 files changed, 34 insertions, 17 deletions
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 5b770262c673..5b3022470126 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -57,13 +57,31 @@
57#define VALIDATE_READY -1001 /* Firmware image ready for validation */ 57#define VALIDATE_READY -1001 /* Firmware image ready for validation */
58#define VALIDATE_PARAM_ERR -3 /* RTAS Parameter Error */ 58#define VALIDATE_PARAM_ERR -3 /* RTAS Parameter Error */
59#define VALIDATE_HW_ERR -1 /* RTAS Hardware Error */ 59#define VALIDATE_HW_ERR -1 /* RTAS Hardware Error */
60#define VALIDATE_TMP_UPDATE 0 /* Validate Return Status */ 60
61#define VALIDATE_FLASH_AUTH 1 /* Validate Return Status */ 61/* ibm,validate-flash-image update result tokens */
62#define VALIDATE_INVALID_IMG 2 /* Validate Return Status */ 62#define VALIDATE_TMP_UPDATE 0 /* T side will be updated */
63#define VALIDATE_CUR_UNKNOWN 3 /* Validate Return Status */ 63#define VALIDATE_FLASH_AUTH 1 /* Partition does not have authority */
64#define VALIDATE_TMP_COMMIT_DL 4 /* Validate Return Status */ 64#define VALIDATE_INVALID_IMG 2 /* Candidate image is not valid */
65#define VALIDATE_TMP_COMMIT 5 /* Validate Return Status */ 65#define VALIDATE_CUR_UNKNOWN 3 /* Current fixpack level is unknown */
66#define VALIDATE_TMP_UPDATE_DL 6 /* Validate Return Status */ 66/*
67 * Current T side will be committed to P side before being replace with new
68 * image, and the new image is downlevel from current image
69 */
70#define VALIDATE_TMP_COMMIT_DL 4
71/*
72 * Current T side will be committed to P side before being replaced with new
73 * image
74 */
75#define VALIDATE_TMP_COMMIT 5
76/*
77 * T side will be updated with a downlevel image
78 */
79#define VALIDATE_TMP_UPDATE_DL 6
80/*
81 * The candidate image's release date is later than the system's firmware
82 * service entitlement date - service warranty period has expired
83 */
84#define VALIDATE_OUT_OF_WRNTY 7
67 85
68/* ibm,manage-flash-image operation tokens */ 86/* ibm,manage-flash-image operation tokens */
69#define RTAS_REJECT_TMP_IMG 0 87#define RTAS_REJECT_TMP_IMG 0
@@ -287,12 +305,6 @@ static ssize_t rtas_flash_read_num(struct file *file, char __user *buf,
287 return simple_read_from_buffer(buf, count, ppos, msg, strlen(msg)); 305 return simple_read_from_buffer(buf, count, ppos, msg, strlen(msg));
288} 306}
289 307
290/* constructor for flash_block_cache */
291static void rtas_block_ctor(void *ptr)
292{
293 memset(ptr, 0, RTAS_BLK_SIZE);
294}
295
296/* We could be much more efficient here. But to keep this function 308/* We could be much more efficient here. But to keep this function
297 * simple we allocate a page to the block list no matter how small the 309 * simple we allocate a page to the block list no matter how small the
298 * count is. If the system is low on memory it will be just as well 310 * count is. If the system is low on memory it will be just as well
@@ -316,7 +328,7 @@ static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
316 * proc file 328 * proc file
317 */ 329 */
318 if (uf->flist == NULL) { 330 if (uf->flist == NULL) {
319 uf->flist = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); 331 uf->flist = kmem_cache_zalloc(flash_block_cache, GFP_KERNEL);
320 if (!uf->flist) 332 if (!uf->flist)
321 goto nomem; 333 goto nomem;
322 } 334 }
@@ -327,7 +339,7 @@ static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
327 next_free = fl->num_blocks; 339 next_free = fl->num_blocks;
328 if (next_free == FLASH_BLOCKS_PER_NODE) { 340 if (next_free == FLASH_BLOCKS_PER_NODE) {
329 /* Need to allocate another block_list */ 341 /* Need to allocate another block_list */
330 fl->next = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); 342 fl->next = kmem_cache_zalloc(flash_block_cache, GFP_KERNEL);
331 if (!fl->next) 343 if (!fl->next)
332 goto nomem; 344 goto nomem;
333 fl = fl->next; 345 fl = fl->next;
@@ -336,7 +348,7 @@ static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
336 348
337 if (count > RTAS_BLK_SIZE) 349 if (count > RTAS_BLK_SIZE)
338 count = RTAS_BLK_SIZE; 350 count = RTAS_BLK_SIZE;
339 p = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); 351 p = kmem_cache_zalloc(flash_block_cache, GFP_KERNEL);
340 if (!p) 352 if (!p)
341 goto nomem; 353 goto nomem;
342 354
@@ -700,7 +712,7 @@ static int __init rtas_flash_init(void)
700 712
701 flash_block_cache = kmem_cache_create("rtas_flash_cache", 713 flash_block_cache = kmem_cache_create("rtas_flash_cache",
702 RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0, 714 RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0,
703 rtas_block_ctor); 715 NULL);
704 if (!flash_block_cache) { 716 if (!flash_block_cache) {
705 printk(KERN_ERR "%s: failed to create block cache\n", 717 printk(KERN_ERR "%s: failed to create block cache\n",
706 __func__); 718 __func__);
@@ -746,6 +758,11 @@ static void __exit rtas_flash_cleanup(void)
746 758
747 rtas_flash_term_hook = NULL; 759 rtas_flash_term_hook = NULL;
748 760
761 if (rtas_firmware_flash_list) {
762 free_flash_list(rtas_firmware_flash_list);
763 rtas_firmware_flash_list = NULL;
764 }
765
749 for (i = 0; i < ARRAY_SIZE(rtas_flash_files); i++) { 766 for (i = 0; i < ARRAY_SIZE(rtas_flash_files); i++) {
750 const struct rtas_flash_file *f = &rtas_flash_files[i]; 767 const struct rtas_flash_file *f = &rtas_flash_files[i];
751 remove_proc_entry(f->filename, NULL); 768 remove_proc_entry(f->filename, NULL);