void post_mobility_update(int action) { int rc; int do_update = 0; char *path; if (action == HIBERNATE) path = SYSFS_HIBERNATION_FILE; else path = SYSFS_MIGRATION_API_FILE; /* kernel will return 0 or sysfs attribute will be unreadable if drmgr needs to perform a device tree update */ rc = get_int_attribute(path, NULL, &do_update, sizeof(do_update)); if (rc) say(DEBUG, "get_int_attribute returned %d for path %s\n", rc, path); if (!do_update) { rc = rtas_activate_firmware(); if (rc) say(DEBUG, "rtas_activate_firmware() returned %d\n", rc); devtree_update(); } }
static int activate_firmware(void) { int rc; rc = rtas_activate_firmware(); /* Map 'rc' to valid return code listed above */ switch (rc) { /* 0 - Success!! */ case 0: if (verbose) printf("activate_firmware: rtas call succeeded\n"); break; /* 1 - activate-firmware not supported */ case RTAS_KERNEL_INT: /* No kernel interface to firmware */ case RTAS_KERNEL_IMP: /* No kernel implementation of function */ case RTAS_UNKNOWN_OP: /* No firmware implementation of function */ if (verbose) { printf("activate_fw: rtas call returned %d, " "converting to %d\n", rc, 1); } rc = 1; break; /* 2 - no new firmware to activate */ case -9001: if (verbose) { printf("activate_fw: rtas call returned %d, " "converting to %d\n", rc, 2); } rc = 2; break; /* 3 - no root authority */ case RTAS_PERM: if (verbose) { printf("activate_fw: rtas call returned %d, " "converting to %d\n", rc, 3); } rc = 3; break; /* 4 - hardware error */ case -1: if (verbose) { printf("activate_fw: rtas call returned %d, " "converting to %d\n", rc, 4); } rc = 4; break; /* 5 - Memory/resource allocation error */ case RTAS_NO_MEM: case RTAS_NO_LOWMEM: if (verbose) { printf("activate_fw: rtas call returned %d, " "converting to %d\n", rc, 5); } rc = 5; break; case -3: if (verbose) { printf("activate_fw: rtas call returned %d, " "converting to %d\n", rc, 8); } rc = 8; break; /* 6 - catch all other return codes here */ default: if (verbose) { printf("activate_fw: rtas call returned %d, " "converting to %d\n", rc, 6); } rc = 6; break; } return rc; }