Example #1
0
/**
 * corrupted_dcache
 * @brief "corrupted D-cache" error injection handler
 *
 * This will inject a corrupted D-cache error onto the system
 *
 * @param ei_func errinjct functionality
 * @return 0 on success, !0 otherwise
 */
int corrupted_dcache(ei_function *ei_func)
{
	int rc;

	if (ext_help || check_cpu_arg() || check_token_arg()) {
		corrupted_dcache_usage(ei_func);
		return 1;
	}

	if ((action < 0) || (action > MAX_DCACHE_ACTION_CODE)) {
		perr(0, "Invalid action code (%d)", action);
		corrupted_dcache_usage(ei_func);
		return 1;
	}

	if (!be_quiet) {
		printf("Injecting a %s error\n", ei_func->name);
		printf("Action: %d - %s\n", action, action_codes[action]);
	}

	if (dryrun)
		return 0;

	err_buf[0] = action;

	rc = do_rtas_errinjct(ei_func);

	return rc;
}
Example #2
0
/**
 * corrupted_icache
 * @brief "corrupted I-cache" error injection handler
 *
 * @param ei_func errinjct functionality
 * @return 0 on success, !0 otherwise
 */
int corrupted_icache(ei_function *ei_func)
{
	int rc;

	if (ext_help || check_cpu_arg() || check_token_arg()) {
		corrupted_icache_usage(ei_func);
		return 1;
	}

	if ((action < 0) || (action > 3)) {
		perr(0, "Invalid action code (%d)", action);
		corrupted_icache_usage(ei_func);
		return 1;
	}

	if ((nature < 0) || (nature > 2)) {
		perr(0, "Invalid nature code (%d)", nature);
		corrupted_icache_usage(ei_func);
		return 1;
	}

	err_buf[0] = action;
	err_buf[1] = nature;

	if (!be_quiet) {
		printf("Injecting a %s error\n", ei_func->name);
		printf("Action: %d - %s\n", action, action_codes[action]);
		printf("Nature: %d - %s\n", nature, nature_codes[nature]);
	}

	if (dryrun)
		return 0;

	rc = do_rtas_errinjct(ei_func);

	return rc;
}