1222613Snwhitehorn/*-
2222613Snwhitehorn * Copyright (c) 2011 Nathan Whitehorn
3222613Snwhitehorn * All rights reserved.
4222613Snwhitehorn *
5222613Snwhitehorn * Redistribution and use in source and binary forms, with or without
6222613Snwhitehorn * modification, are permitted provided that the following conditions
7222613Snwhitehorn * are met:
8222613Snwhitehorn * 1. Redistributions of source code must retain the above copyright
9222613Snwhitehorn *    notice, this list of conditions and the following disclaimer.
10222613Snwhitehorn * 2. Redistributions in binary form must reproduce the above copyright
11222613Snwhitehorn *    notice, this list of conditions and the following disclaimer in the
12222613Snwhitehorn *    documentation and/or other materials provided with the distribution.
13222613Snwhitehorn *
14222613Snwhitehorn * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15222613Snwhitehorn * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16222613Snwhitehorn * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17222613Snwhitehorn * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18222613Snwhitehorn * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19222613Snwhitehorn * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20222613Snwhitehorn * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21222613Snwhitehorn * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22222613Snwhitehorn * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23222613Snwhitehorn * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24222613Snwhitehorn * SUCH DAMAGE.
25222613Snwhitehorn *
26222613Snwhitehorn * $FreeBSD: releng/10.3/sys/powerpc/include/rtas.h 222613 2011-06-02 14:12:37Z nwhitehorn $
27222613Snwhitehorn */
28222613Snwhitehorn
29222613Snwhitehorn#ifndef _MACHINE_RTAS_H_
30222613Snwhitehorn#define _MACHINE_RTAS_H_
31222613Snwhitehorn
32222613Snwhitehorn#include <sys/cdefs.h>
33222613Snwhitehorn#include <sys/types.h>
34222613Snwhitehorn#include <dev/ofw/openfirm.h>
35222613Snwhitehorn
36222613Snwhitehorn/*
37222613Snwhitehorn * RTAS functions are defined by 32-bit integer tokens. These vary from
38222613Snwhitehorn * system to system, and can be looked up from their standardized names
39222613Snwhitehorn * using rtas_token_lookup(). If RTAS is not available, rtas_token_lookup()
40222613Snwhitehorn * and rtas_call_method() return -1; this can be checked in advance using
41222613Snwhitehorn * rtas_exists(). Otherwise, rtas_call_method() returns one of the RTAS
42222613Snwhitehorn * status codes from the bottom of this file.
43222613Snwhitehorn */
44222613Snwhitehorn
45222613Snwhitehornint rtas_exists(void);
46222613Snwhitehornint rtas_call_method(cell_t token, int nargs, int nreturns, ...);
47222613Snwhitehorncell_t rtas_token_lookup(const char *method);
48222613Snwhitehorn
49222613Snwhitehorn/* RTAS Status Codes: see CHRP or PAPR specification */
50222613Snwhitehorn#define	RTAS_OK				0
51222613Snwhitehorn#define	RTAS_HW_ERROR			-1
52222613Snwhitehorn#define	RTAS_BUSY			-2
53222613Snwhitehorn#define	RTAS_PARAM_ERROR		-3
54222613Snwhitehorn#define	RTAS_STATE_CHANGE		-7
55222613Snwhitehorn#define	RTAS_VENDOR_BEGIN		9000
56222613Snwhitehorn#define	RTAS_EXTENDED_DELAY		9900
57222613Snwhitehorn#define	RTAS_ISOLATION_ERROR		-9000
58222613Snwhitehorn#define	RTAS_VENDOR_ERROR_BEGIN		-9004
59222613Snwhitehorn
60222613Snwhitehorn#endif /* _MACHINE_RTAS_H_ */
61222613Snwhitehorn
62