~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/skiboot/include/opal-internal.h

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2013-2014 IBM Corp.
 
2
 *
 
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
 
6
 *
 
7
 *      http://www.apache.org/licenses/LICENSE-2.0
 
8
 *
 
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
 
12
 * implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
#ifndef __OPAL_INTERNAL_H
 
18
#define __OPAL_INTERNAL_H
 
19
 
 
20
/****** Internal header for OPAL API related things in skiboot **********/
 
21
 
 
22
#include <skiboot.h>
 
23
 
 
24
/* An opal table entry */
 
25
struct opal_table_entry {
 
26
        void    *func;
 
27
        u32     token;
 
28
        u32     nargs;
 
29
};
 
30
 
 
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 )) }
 
35
 
 
36
/* Make sure function takes args they claim.  Look away now... */
 
37
#define __test_args0
 
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
 
45
 
 
46
extern struct opal_table_entry __opal_table_start[];
 
47
extern struct opal_table_entry __opal_table_end[];
 
48
 
 
49
extern uint64_t opal_pending_events;
 
50
 
 
51
extern struct dt_node *opal_node;
 
52
 
 
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);
 
58
 
 
59
#define opal_register(token, func, nargs)                               \
 
60
        __opal_register((token) + 0*sizeof(func(__test_args##nargs)),   \
 
61
                        (func), (nargs))
 
62
extern void __opal_register(uint64_t token, void *func, unsigned num_args);
 
63
 
 
64
/* Warning: no locking at the moment, do at init time only
 
65
 *
 
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
 
68
 */
 
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);
 
72
 
 
73
/*
 
74
 * Warning: no locking, only call that from the init processor
 
75
 */
 
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));
 
78
 
 
79
/*
 
80
 * Opal internal function prototype
 
81
 */
 
82
struct OpalHMIEvent;
 
83
extern int handle_hmi_exception(__be64 hmer, struct OpalHMIEvent *hmi_evt);
 
84
extern int occ_msg_queue_occ_reset(void);
 
85
 
 
86
#endif /* __OPAL_INTERNAL_H */