Example #1
0
int set_rtas_dbg(struct rtas_token *tok)
{
	struct rtas_args args;
	int rc;

	args.token = htobe32(RTAS_DBG_ENABLE);
	args.ninputs = htobe32(1);
	args.nret = htobe32(1);
	args.args[0] = htobe32(tok->token);

	printf("Enabling rtas debug for %s (%d)\n", tok->name, tok->token);

	rc = rtas(&args);

	if (rc)
		fprintf(stderr, "RTAS syscall failure, errno=%d\n", errno);

	return rc;
}
Example #2
0
void __openfirmware
phys_call_rtas(int service, int nargs, int nret, ...)
{
	va_list list;
	union {
		unsigned long words[16];
		double align;
	} u;
	void (*rtas)(void *, unsigned long);
	int i;

	u.words[0] = service;
	u.words[1] = nargs;
	u.words[2] = nret;
	va_start(list, nret);
	for (i = 0; i < nargs; ++i)
		u.words[i+3] = va_arg(list, unsigned long);
	va_end(list);

	rtas = (void (*)(void *, unsigned long)) rtas_entry;
	rtas(&u, rtas_data);
}