1
/* Copyright 2013-2014 IBM Corp.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
7
* http://www.apache.org/licenses/LICENSE-2.0
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
#ifndef __OPAL_INTERNAL_H
18
#define __OPAL_INTERNAL_H
20
/****** Internal header for OPAL API related things in skiboot **********/
24
/* An opal table entry */
25
struct opal_table_entry {
31
#define opal_call(__tok, __func, __nargs) \
32
static struct opal_table_entry __e_##__func __used __section(".opal_table") = \
33
{ .func = __func, .token = __tok, \
34
.nargs = __nargs + 0 * sizeof(__func( __test_args##__nargs )) }
36
/* Make sure function takes args they claim. Look away now... */
38
#define __test_args1 0
39
#define __test_args2 0,0
40
#define __test_args3 0,0,0
41
#define __test_args4 0,0,0,0
42
#define __test_args5 0,0,0,0,0
43
#define __test_args6 0,0,0,0,0,0
44
#define __test_args7 0,0,0,0,0,0,0
46
extern struct opal_table_entry __opal_table_start[];
47
extern struct opal_table_entry __opal_table_end[];
49
extern uint64_t opal_pending_events;
51
extern struct dt_node *opal_node;
53
extern void opal_table_init(void);
54
extern void opal_update_pending_evt(uint64_t evt_mask, uint64_t evt_values);
55
__be64 opal_dynamic_event_alloc(void);
56
void opal_dynamic_event_free(__be64 event);
57
extern void add_opal_node(void);
59
#define opal_register(token, func, nargs) \
60
__opal_register((token) + 0*sizeof(func(__test_args##nargs)), \
62
extern void __opal_register(uint64_t token, void *func, unsigned num_args);
64
/* Warning: no locking at the moment, do at init time only
66
* XXX TODO: Add the big RCU-ish "opal API lock" to protect us here
67
* which will also be used for other things such as runtime updates
69
extern void opal_add_poller(void (*poller)(void *data), void *data);
70
extern void opal_del_poller(void (*poller)(void *data));
71
extern void opal_run_pollers(void);
74
* Warning: no locking, only call that from the init processor
76
extern void opal_add_host_sync_notifier(bool (*notify)(void *data), void *data);
77
extern void opal_del_host_sync_notifier(bool (*notify)(void *data));
80
* Opal internal function prototype
83
extern int handle_hmi_exception(__be64 hmer, struct OpalHMIEvent *hmi_evt);
84
extern int occ_msg_queue_occ_reset(void);
86
#endif /* __OPAL_INTERNAL_H */