static int __init rtas_flash_init(void) { int rc; if (rtas_token("ibm,update-flash-64-and-reboot") == RTAS_UNKNOWN_SERVICE) { printk(KERN_ERR "rtas_flash: no firmware flash support\n"); return 1; } firmware_flash_pde = create_flash_pde("ppc64/rtas/" FIRMWARE_FLASH_NAME, &rtas_flash_operations); if (firmware_flash_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot", sizeof(struct rtas_update_flash_t), firmware_flash_pde); if (rc != 0) goto cleanup; firmware_update_pde = create_flash_pde("ppc64/rtas/" FIRMWARE_UPDATE_NAME, &rtas_flash_operations); if (firmware_update_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot", sizeof(struct rtas_update_flash_t), firmware_update_pde); if (rc != 0) goto cleanup; validate_pde = create_flash_pde("ppc64/rtas/" VALIDATE_FLASH_NAME, &validate_flash_operations); if (validate_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,validate-flash-image", sizeof(struct rtas_validate_flash_t), validate_pde); if (rc != 0) goto cleanup; manage_pde = create_flash_pde("ppc64/rtas/" MANAGE_FLASH_NAME, &manage_flash_operations); if (manage_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,manage-flash-image", sizeof(struct rtas_manage_flash_t), manage_pde); if (rc != 0) 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); if (!flash_block_cache) { printk(KERN_ERR "%s: failed to create block cache\n", __func__); rc = -ENOMEM; goto cleanup; } return 0; cleanup: remove_flash_pde(firmware_flash_pde); remove_flash_pde(firmware_update_pde); remove_flash_pde(validate_pde); remove_flash_pde(manage_pde); return rc; }
int __init rtas_flash_init(void) { int rc; if (rtas_token("ibm,update-flash-64-and-reboot") == RTAS_UNKNOWN_SERVICE) { printk(KERN_ERR "rtas_flash: no firmware flash support\n"); return 1; } firmware_flash_pde = create_flash_pde("ppc64/rtas/" FIRMWARE_FLASH_NAME, &rtas_flash_operations); if (firmware_flash_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot", sizeof(struct rtas_update_flash_t), firmware_flash_pde); if (rc != 0) goto cleanup; firmware_update_pde = create_flash_pde("ppc64/rtas/" FIRMWARE_UPDATE_NAME, &rtas_flash_operations); if (firmware_update_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot", sizeof(struct rtas_update_flash_t), firmware_update_pde); if (rc != 0) goto cleanup; validate_pde = create_flash_pde("ppc64/rtas/" VALIDATE_FLASH_NAME, &validate_flash_operations); if (validate_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,validate-flash-image", sizeof(struct rtas_validate_flash_t), validate_pde); if (rc != 0) goto cleanup; manage_pde = create_flash_pde("ppc64/rtas/" MANAGE_FLASH_NAME, &manage_flash_operations); if (manage_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,manage-flash-image", sizeof(struct rtas_manage_flash_t), manage_pde); if (rc != 0) goto cleanup; return 0; cleanup: remove_flash_pde(firmware_flash_pde); remove_flash_pde(firmware_update_pde); remove_flash_pde(validate_pde); remove_flash_pde(manage_pde); return rc; }