2 * c 2001 PPC 64 Team, IBM Corp
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 * /proc/powerpc/rtas/firmware_flash interface
11 * This file implements a firmware_flash interface to pump a firmware
12 * image into the kernel. At reboot time rtas_restart() will see the
13 * firmware image and flash it as it reboots (see rtas.c).
16 #include <linux/module.h>
17 #include <linux/init.h>
18 #include <linux/slab.h>
19 #include <linux/proc_fs.h>
20 #include <linux/reboot.h>
21 #include <asm/delay.h>
22 #include <asm/uaccess.h>
24 #include <asm/abs_addr.h>
26 #define MODULE_VERS "1.0"
27 #define MODULE_NAME "rtas_flash"
29 #define FIRMWARE_FLASH_NAME "firmware_flash"
30 #define FIRMWARE_UPDATE_NAME "firmware_update"
31 #define MANAGE_FLASH_NAME "manage_flash"
32 #define VALIDATE_FLASH_NAME "validate_flash"
34 /* General RTAS Status Codes */
35 #define RTAS_RC_SUCCESS 0
36 #define RTAS_RC_HW_ERR -1
37 #define RTAS_RC_BUSY -2
39 /* Flash image status values */
40 #define FLASH_AUTH -9002 /* RTAS Not Service Authority Partition */
41 #define FLASH_NO_OP -1099 /* No operation initiated by user */
42 #define FLASH_IMG_SHORT -1005 /* Flash image shorter than expected */
43 #define FLASH_IMG_BAD_LEN -1004 /* Bad length value in flash list block */
44 #define FLASH_IMG_NULL_DATA -1003 /* Bad data value in flash list block */
45 #define FLASH_IMG_READY 0 /* Firmware img ready for flash on reboot */
47 /* Manage image status values */
48 #define MANAGE_AUTH -9002 /* RTAS Not Service Authority Partition */
49 #define MANAGE_ACTIVE_ERR -9001 /* RTAS Cannot Overwrite Active Img */
50 #define MANAGE_NO_OP -1099 /* No operation initiated by user */
51 #define MANAGE_PARAM_ERR -3 /* RTAS Parameter Error */
52 #define MANAGE_HW_ERR -1 /* RTAS Hardware Error */
54 /* Validate image status values */
55 #define VALIDATE_AUTH -9002 /* RTAS Not Service Authority Partition */
56 #define VALIDATE_NO_OP -1099 /* No operation initiated by the user */
57 #define VALIDATE_INCOMPLETE -1002 /* User copied < VALIDATE_BUF_SIZE */
58 #define VALIDATE_READY -1001 /* Firmware image ready for validation */
59 #define VALIDATE_PARAM_ERR -3 /* RTAS Parameter Error */
60 #define VALIDATE_HW_ERR -1 /* RTAS Hardware Error */
61 #define VALIDATE_TMP_UPDATE 0 /* Validate Return Status */
62 #define VALIDATE_FLASH_AUTH 1 /* Validate Return Status */
63 #define VALIDATE_INVALID_IMG 2 /* Validate Return Status */
64 #define VALIDATE_CUR_UNKNOWN 3 /* Validate Return Status */
65 #define VALIDATE_TMP_COMMIT_DL 4 /* Validate Return Status */
66 #define VALIDATE_TMP_COMMIT 5 /* Validate Return Status */
67 #define VALIDATE_TMP_UPDATE_DL 6 /* Validate Return Status */
69 /* ibm,manage-flash-image operation tokens */
70 #define RTAS_REJECT_TMP_IMG 0
71 #define RTAS_COMMIT_TMP_IMG 1
74 #define VALIDATE_BUF_SIZE 4096
75 #define RTAS_MSG_MAXLEN 64
77 /* Quirk - RTAS requires 4k list length and block size */
78 #define RTAS_BLKLIST_LENGTH 4096
79 #define RTAS_BLK_SIZE 4096
86 /* This struct is very similar but not identical to
87 * that needed by the rtas flash update.
88 * All we need to do for rtas is rewrite num_blocks
89 * into a version/length and translate the pointers
92 #define FLASH_BLOCKS_PER_NODE ((RTAS_BLKLIST_LENGTH - 16) / sizeof(struct flash_block))
93 struct flash_block_list
{
94 unsigned long num_blocks
;
95 struct flash_block_list
*next
;
96 struct flash_block blocks
[FLASH_BLOCKS_PER_NODE
];
99 static struct flash_block_list
*rtas_firmware_flash_list
;
101 /* Use slab cache to guarantee 4k alignment */
102 static struct kmem_cache
*flash_block_cache
= NULL
;
104 #define FLASH_BLOCK_LIST_VERSION (1UL)
106 /* Local copy of the flash block list.
107 * We only allow one open of the flash proc file and create this
108 * list as we go. The rtas_firmware_flash_list varable will be
109 * set once the data is fully read.
111 * For convenience as we build the list we use virtual addrs,
112 * we do not fill in the version number, and the length field
113 * is treated as the number of entries currently in the block
114 * (i.e. not a byte count). This is all fixed when calling
118 /* Status int must be first member of struct */
119 struct rtas_update_flash_t
121 int status
; /* Flash update status */
122 struct flash_block_list
*flist
; /* Local copy of flash block list */
125 /* Status int must be first member of struct */
126 struct rtas_manage_flash_t
128 int status
; /* Returned status */
129 unsigned int op
; /* Reject or commit image */
132 /* Status int must be first member of struct */
133 struct rtas_validate_flash_t
135 int status
; /* Returned status */
136 char buf
[VALIDATE_BUF_SIZE
]; /* Candidate image buffer */
137 unsigned int buf_size
; /* Size of image buf */
138 unsigned int update_results
; /* Update results token */
141 static DEFINE_SPINLOCK(flash_file_open_lock
);
142 static struct proc_dir_entry
*firmware_flash_pde
;
143 static struct proc_dir_entry
*firmware_update_pde
;
144 static struct proc_dir_entry
*validate_pde
;
145 static struct proc_dir_entry
*manage_pde
;
147 /* Do simple sanity checks on the flash image. */
148 static int flash_list_valid(struct flash_block_list
*flist
)
150 struct flash_block_list
*f
;
152 unsigned long block_size
, image_size
;
154 /* Paranoid self test here. We also collect the image size. */
156 for (f
= flist
; f
; f
= f
->next
) {
157 for (i
= 0; i
< f
->num_blocks
; i
++) {
158 if (f
->blocks
[i
].data
== NULL
) {
159 return FLASH_IMG_NULL_DATA
;
161 block_size
= f
->blocks
[i
].length
;
162 if (block_size
<= 0 || block_size
> RTAS_BLK_SIZE
) {
163 return FLASH_IMG_BAD_LEN
;
165 image_size
+= block_size
;
169 if (image_size
< (256 << 10)) {
174 printk(KERN_INFO
"FLASH: flash image with %ld bytes stored for hardware flash on reboot\n", image_size
);
176 return FLASH_IMG_READY
;
179 static void free_flash_list(struct flash_block_list
*f
)
181 struct flash_block_list
*next
;
185 for (i
= 0; i
< f
->num_blocks
; i
++)
186 kmem_cache_free(flash_block_cache
, f
->blocks
[i
].data
);
188 kmem_cache_free(flash_block_cache
, f
);
193 static int rtas_flash_release(struct inode
*inode
, struct file
*file
)
195 struct proc_dir_entry
*dp
= PDE(file
->f_path
.dentry
->d_inode
);
196 struct rtas_update_flash_t
*uf
;
198 uf
= (struct rtas_update_flash_t
*) dp
->data
;
200 /* File was opened in write mode for a new flash attempt */
201 /* Clear saved list */
202 if (rtas_firmware_flash_list
) {
203 free_flash_list(rtas_firmware_flash_list
);
204 rtas_firmware_flash_list
= NULL
;
207 if (uf
->status
!= FLASH_AUTH
)
208 uf
->status
= flash_list_valid(uf
->flist
);
210 if (uf
->status
== FLASH_IMG_READY
)
211 rtas_firmware_flash_list
= uf
->flist
;
213 free_flash_list(uf
->flist
);
218 atomic_dec(&dp
->count
);
222 static void get_flash_status_msg(int status
, char *buf
)
228 msg
= "error: this partition does not have service authority\n";
231 msg
= "info: no firmware image for flash\n";
233 case FLASH_IMG_SHORT
:
234 msg
= "error: flash image short\n";
236 case FLASH_IMG_BAD_LEN
:
237 msg
= "error: internal error bad length\n";
239 case FLASH_IMG_NULL_DATA
:
240 msg
= "error: internal error null data\n";
242 case FLASH_IMG_READY
:
243 msg
= "ready: firmware image ready for flash on reboot\n";
246 sprintf(buf
, "error: unexpected status value %d\n", status
);
253 /* Reading the proc file will show status (not the firmware contents) */
254 static ssize_t
rtas_flash_read(struct file
*file
, char __user
*buf
,
255 size_t count
, loff_t
*ppos
)
257 struct proc_dir_entry
*dp
= PDE(file
->f_path
.dentry
->d_inode
);
258 struct rtas_update_flash_t
*uf
;
259 char msg
[RTAS_MSG_MAXLEN
];
263 if (!strcmp(dp
->name
, FIRMWARE_FLASH_NAME
)) {
264 get_flash_status_msg(uf
->status
, msg
);
265 } else { /* FIRMWARE_UPDATE_NAME */
266 sprintf(msg
, "%d\n", uf
->status
);
269 return simple_read_from_buffer(buf
, count
, ppos
, msg
, strlen(msg
));
272 /* constructor for flash_block_cache */
273 void rtas_block_ctor(void *ptr
)
275 memset(ptr
, 0, RTAS_BLK_SIZE
);
278 /* We could be much more efficient here. But to keep this function
279 * simple we allocate a page to the block list no matter how small the
280 * count is. If the system is low on memory it will be just as well
283 static ssize_t
rtas_flash_write(struct file
*file
, const char __user
*buffer
,
284 size_t count
, loff_t
*off
)
286 struct proc_dir_entry
*dp
= PDE(file
->f_path
.dentry
->d_inode
);
287 struct rtas_update_flash_t
*uf
;
290 struct flash_block_list
*fl
;
292 uf
= (struct rtas_update_flash_t
*) dp
->data
;
294 if (uf
->status
== FLASH_AUTH
|| count
== 0)
295 return count
; /* discard data */
297 /* In the case that the image is not ready for flashing, the memory
298 * allocated for the block list will be freed upon the release of the
301 if (uf
->flist
== NULL
) {
302 uf
->flist
= kmem_cache_alloc(flash_block_cache
, GFP_KERNEL
);
309 fl
= fl
->next
; /* seek to last block_list for append */
310 next_free
= fl
->num_blocks
;
311 if (next_free
== FLASH_BLOCKS_PER_NODE
) {
312 /* Need to allocate another block_list */
313 fl
->next
= kmem_cache_alloc(flash_block_cache
, GFP_KERNEL
);
320 if (count
> RTAS_BLK_SIZE
)
321 count
= RTAS_BLK_SIZE
;
322 p
= kmem_cache_alloc(flash_block_cache
, GFP_KERNEL
);
326 if(copy_from_user(p
, buffer
, count
)) {
327 kmem_cache_free(flash_block_cache
, p
);
330 fl
->blocks
[next_free
].data
= p
;
331 fl
->blocks
[next_free
].length
= count
;
337 static int rtas_excl_open(struct inode
*inode
, struct file
*file
)
339 struct proc_dir_entry
*dp
= PDE(inode
);
341 /* Enforce exclusive open with use count of PDE */
342 spin_lock(&flash_file_open_lock
);
343 if (atomic_read(&dp
->count
) > 2) {
344 spin_unlock(&flash_file_open_lock
);
348 atomic_inc(&dp
->count
);
349 spin_unlock(&flash_file_open_lock
);
354 static int rtas_excl_release(struct inode
*inode
, struct file
*file
)
356 struct proc_dir_entry
*dp
= PDE(inode
);
358 atomic_dec(&dp
->count
);
363 static void manage_flash(struct rtas_manage_flash_t
*args_buf
)
368 rc
= rtas_call(rtas_token("ibm,manage-flash-image"), 1,
369 1, NULL
, args_buf
->op
);
370 } while (rtas_busy_delay(rc
));
372 args_buf
->status
= rc
;
375 static ssize_t
manage_flash_read(struct file
*file
, char __user
*buf
,
376 size_t count
, loff_t
*ppos
)
378 struct proc_dir_entry
*dp
= PDE(file
->f_path
.dentry
->d_inode
);
379 struct rtas_manage_flash_t
*args_buf
;
380 char msg
[RTAS_MSG_MAXLEN
];
384 if (args_buf
== NULL
)
387 msglen
= sprintf(msg
, "%d\n", args_buf
->status
);
389 return simple_read_from_buffer(buf
, count
, ppos
, msg
, msglen
);
392 static ssize_t
manage_flash_write(struct file
*file
, const char __user
*buf
,
393 size_t count
, loff_t
*off
)
395 struct proc_dir_entry
*dp
= PDE(file
->f_path
.dentry
->d_inode
);
396 struct rtas_manage_flash_t
*args_buf
;
397 const char reject_str
[] = "0";
398 const char commit_str
[] = "1";
402 args_buf
= (struct rtas_manage_flash_t
*) dp
->data
;
403 if ((args_buf
->status
== MANAGE_AUTH
) || (count
== 0))
408 if (count
> 9) count
= 9;
409 if (copy_from_user (stkbuf
, buf
, count
)) {
412 if (strncmp(stkbuf
, reject_str
, strlen(reject_str
)) == 0)
413 op
= RTAS_REJECT_TMP_IMG
;
414 else if (strncmp(stkbuf
, commit_str
, strlen(commit_str
)) == 0)
415 op
= RTAS_COMMIT_TMP_IMG
;
418 if (op
== -1) /* buf is empty, or contains invalid string */
422 manage_flash(args_buf
);
427 static void validate_flash(struct rtas_validate_flash_t
*args_buf
)
429 int token
= rtas_token("ibm,validate-flash-image");
435 spin_lock(&rtas_data_buf_lock
);
436 memcpy(rtas_data_buf
, args_buf
->buf
, VALIDATE_BUF_SIZE
);
437 rc
= rtas_call(token
, 2, 2, &update_results
,
438 (u32
) __pa(rtas_data_buf
), args_buf
->buf_size
);
439 memcpy(args_buf
->buf
, rtas_data_buf
, VALIDATE_BUF_SIZE
);
440 spin_unlock(&rtas_data_buf_lock
);
441 } while (rtas_busy_delay(rc
));
443 args_buf
->status
= rc
;
444 args_buf
->update_results
= update_results
;
447 static int get_validate_flash_msg(struct rtas_validate_flash_t
*args_buf
,
452 if (args_buf
->status
>= VALIDATE_TMP_UPDATE
) {
453 n
= sprintf(msg
, "%d\n", args_buf
->update_results
);
454 if ((args_buf
->update_results
>= VALIDATE_CUR_UNKNOWN
) ||
455 (args_buf
->update_results
== VALIDATE_TMP_UPDATE
))
456 n
+= sprintf(msg
+ n
, "%s\n", args_buf
->buf
);
458 n
= sprintf(msg
, "%d\n", args_buf
->status
);
463 static ssize_t
validate_flash_read(struct file
*file
, char __user
*buf
,
464 size_t count
, loff_t
*ppos
)
466 struct proc_dir_entry
*dp
= PDE(file
->f_path
.dentry
->d_inode
);
467 struct rtas_validate_flash_t
*args_buf
;
468 char msg
[RTAS_MSG_MAXLEN
];
473 msglen
= get_validate_flash_msg(args_buf
, msg
);
475 return simple_read_from_buffer(buf
, count
, ppos
, msg
, msglen
);
478 static ssize_t
validate_flash_write(struct file
*file
, const char __user
*buf
,
479 size_t count
, loff_t
*off
)
481 struct proc_dir_entry
*dp
= PDE(file
->f_path
.dentry
->d_inode
);
482 struct rtas_validate_flash_t
*args_buf
;
485 args_buf
= (struct rtas_validate_flash_t
*) dp
->data
;
487 if (dp
->data
== NULL
) {
488 dp
->data
= kmalloc(sizeof(struct rtas_validate_flash_t
),
490 if (dp
->data
== NULL
)
494 /* We are only interested in the first 4K of the
496 if ((*off
>= VALIDATE_BUF_SIZE
) ||
497 (args_buf
->status
== VALIDATE_AUTH
)) {
502 if (*off
+ count
>= VALIDATE_BUF_SIZE
) {
503 count
= VALIDATE_BUF_SIZE
- *off
;
504 args_buf
->status
= VALIDATE_READY
;
506 args_buf
->status
= VALIDATE_INCOMPLETE
;
509 if (!access_ok(VERIFY_READ
, buf
, count
)) {
513 if (copy_from_user(args_buf
->buf
+ *off
, buf
, count
)) {
528 static int validate_flash_release(struct inode
*inode
, struct file
*file
)
530 struct proc_dir_entry
*dp
= PDE(file
->f_path
.dentry
->d_inode
);
531 struct rtas_validate_flash_t
*args_buf
;
533 args_buf
= (struct rtas_validate_flash_t
*) dp
->data
;
535 if (args_buf
->status
== VALIDATE_READY
) {
536 args_buf
->buf_size
= VALIDATE_BUF_SIZE
;
537 validate_flash(args_buf
);
540 /* The matching atomic_inc was in rtas_excl_open() */
541 atomic_dec(&dp
->count
);
546 static void rtas_flash_firmware(int reboot_type
)
548 unsigned long image_size
;
549 struct flash_block_list
*f
, *next
, *flist
;
550 unsigned long rtas_block_list
;
551 int i
, status
, update_token
;
553 if (rtas_firmware_flash_list
== NULL
)
554 return; /* nothing to do */
556 if (reboot_type
!= SYS_RESTART
) {
557 printk(KERN_ALERT
"FLASH: firmware flash requires a reboot\n");
558 printk(KERN_ALERT
"FLASH: the firmware image will NOT be flashed\n");
562 update_token
= rtas_token("ibm,update-flash-64-and-reboot");
563 if (update_token
== RTAS_UNKNOWN_SERVICE
) {
564 printk(KERN_ALERT
"FLASH: ibm,update-flash-64-and-reboot "
565 "is not available -- not a service partition?\n");
566 printk(KERN_ALERT
"FLASH: firmware will not be flashed\n");
571 * Just before starting the firmware flash, cancel the event scan work
572 * to avoid any soft lockup issues.
574 rtas_cancel_event_scan();
577 * NOTE: the "first" block must be under 4GB, so we create
578 * an entry with no data blocks in the reserved buffer in
579 * the kernel data segment.
581 spin_lock(&rtas_data_buf_lock
);
582 flist
= (struct flash_block_list
*)&rtas_data_buf
[0];
583 flist
->num_blocks
= 0;
584 flist
->next
= rtas_firmware_flash_list
;
585 rtas_block_list
= virt_to_abs(flist
);
586 if (rtas_block_list
>= 4UL*1024*1024*1024) {
587 printk(KERN_ALERT
"FLASH: kernel bug...flash list header addr above 4GB\n");
588 spin_unlock(&rtas_data_buf_lock
);
592 printk(KERN_ALERT
"FLASH: preparing saved firmware image for flash\n");
593 /* Update the block_list in place. */
594 rtas_firmware_flash_list
= NULL
; /* too hard to backout on error */
596 for (f
= flist
; f
; f
= next
) {
597 /* Translate data addrs to absolute */
598 for (i
= 0; i
< f
->num_blocks
; i
++) {
599 f
->blocks
[i
].data
= (char *)virt_to_abs(f
->blocks
[i
].data
);
600 image_size
+= f
->blocks
[i
].length
;
603 /* Don't translate NULL pointer for last entry */
605 f
->next
= (struct flash_block_list
*)virt_to_abs(f
->next
);
608 /* make num_blocks into the version/length field */
609 f
->num_blocks
= (FLASH_BLOCK_LIST_VERSION
<< 56) | ((f
->num_blocks
+1)*16);
612 printk(KERN_ALERT
"FLASH: flash image is %ld bytes\n", image_size
);
613 printk(KERN_ALERT
"FLASH: performing flash and reboot\n");
614 rtas_progress("Flashing \n", 0x0);
615 rtas_progress("Please Wait... ", 0x0);
616 printk(KERN_ALERT
"FLASH: this will take several minutes. Do not power off!\n");
617 status
= rtas_call(update_token
, 1, 1, NULL
, rtas_block_list
);
618 switch (status
) { /* should only get "bad" status */
620 printk(KERN_ALERT
"FLASH: success\n");
623 printk(KERN_ALERT
"FLASH: hardware error. Firmware may not be not flashed\n");
626 printk(KERN_ALERT
"FLASH: image is corrupt or not correct for this platform. Firmware not flashed\n");
629 printk(KERN_ALERT
"FLASH: flash failed when partially complete. System may not reboot\n");
632 printk(KERN_ALERT
"FLASH: unknown flash return code %d\n", status
);
635 spin_unlock(&rtas_data_buf_lock
);
638 static void remove_flash_pde(struct proc_dir_entry
*dp
)
642 remove_proc_entry(dp
->name
, dp
->parent
);
646 static int initialize_flash_pde_data(const char *rtas_call_name
,
648 struct proc_dir_entry
*dp
)
653 dp
->data
= kzalloc(buf_size
, GFP_KERNEL
);
654 if (dp
->data
== NULL
) {
655 remove_flash_pde(dp
);
660 * This code assumes that the status int is the first member of the
663 status
= (int *) dp
->data
;
664 token
= rtas_token(rtas_call_name
);
665 if (token
== RTAS_UNKNOWN_SERVICE
)
666 *status
= FLASH_AUTH
;
668 *status
= FLASH_NO_OP
;
673 static struct proc_dir_entry
*create_flash_pde(const char *filename
,
674 const struct file_operations
*fops
)
676 return proc_create(filename
, S_IRUSR
| S_IWUSR
, NULL
, fops
);
679 static const struct file_operations rtas_flash_operations
= {
680 .owner
= THIS_MODULE
,
681 .read
= rtas_flash_read
,
682 .write
= rtas_flash_write
,
683 .open
= rtas_excl_open
,
684 .release
= rtas_flash_release
,
685 .llseek
= default_llseek
,
688 static const struct file_operations manage_flash_operations
= {
689 .owner
= THIS_MODULE
,
690 .read
= manage_flash_read
,
691 .write
= manage_flash_write
,
692 .open
= rtas_excl_open
,
693 .release
= rtas_excl_release
,
694 .llseek
= default_llseek
,
697 static const struct file_operations validate_flash_operations
= {
698 .owner
= THIS_MODULE
,
699 .read
= validate_flash_read
,
700 .write
= validate_flash_write
,
701 .open
= rtas_excl_open
,
702 .release
= validate_flash_release
,
703 .llseek
= default_llseek
,
706 static int __init
rtas_flash_init(void)
710 if (rtas_token("ibm,update-flash-64-and-reboot") ==
711 RTAS_UNKNOWN_SERVICE
) {
712 printk(KERN_ERR
"rtas_flash: no firmware flash support\n");
716 firmware_flash_pde
= create_flash_pde("powerpc/rtas/"
718 &rtas_flash_operations
);
719 if (firmware_flash_pde
== NULL
) {
724 rc
= initialize_flash_pde_data("ibm,update-flash-64-and-reboot",
725 sizeof(struct rtas_update_flash_t
),
730 firmware_update_pde
= create_flash_pde("powerpc/rtas/"
731 FIRMWARE_UPDATE_NAME
,
732 &rtas_flash_operations
);
733 if (firmware_update_pde
== NULL
) {
738 rc
= initialize_flash_pde_data("ibm,update-flash-64-and-reboot",
739 sizeof(struct rtas_update_flash_t
),
740 firmware_update_pde
);
744 validate_pde
= create_flash_pde("powerpc/rtas/" VALIDATE_FLASH_NAME
,
745 &validate_flash_operations
);
746 if (validate_pde
== NULL
) {
751 rc
= initialize_flash_pde_data("ibm,validate-flash-image",
752 sizeof(struct rtas_validate_flash_t
),
757 manage_pde
= create_flash_pde("powerpc/rtas/" MANAGE_FLASH_NAME
,
758 &manage_flash_operations
);
759 if (manage_pde
== NULL
) {
764 rc
= initialize_flash_pde_data("ibm,manage-flash-image",
765 sizeof(struct rtas_manage_flash_t
),
770 rtas_flash_term_hook
= rtas_flash_firmware
;
772 flash_block_cache
= kmem_cache_create("rtas_flash_cache",
773 RTAS_BLK_SIZE
, RTAS_BLK_SIZE
, 0,
775 if (!flash_block_cache
) {
776 printk(KERN_ERR
"%s: failed to create block cache\n",
784 remove_flash_pde(firmware_flash_pde
);
785 remove_flash_pde(firmware_update_pde
);
786 remove_flash_pde(validate_pde
);
787 remove_flash_pde(manage_pde
);
792 static void __exit
rtas_flash_cleanup(void)
794 rtas_flash_term_hook
= NULL
;
796 if (flash_block_cache
)
797 kmem_cache_destroy(flash_block_cache
);
799 remove_flash_pde(firmware_flash_pde
);
800 remove_flash_pde(firmware_update_pde
);
801 remove_flash_pde(validate_pde
);
802 remove_flash_pde(manage_pde
);
805 module_init(rtas_flash_init
);
806 module_exit(rtas_flash_cleanup
);
807 MODULE_LICENSE("GPL");