From d195fd680eac1044681fd265edfbf342888f4a93 Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Fri, 6 Feb 2015 13:11:25 +1100 Subject: Move skiboot internal things from opal.h to opal-api.h This is probably not the best collection of things in the world, but it means that opal.h is much closer to being directly usable by an OS. This triggers a bunch of #include fixes throughout the tree. Signed-off-by: Stewart Smith --- core/affinity.c | 1 + core/console.c | 1 + core/cpu.c | 1 + core/exceptions.c | 1 + core/hmi.c | 1 + core/i2c.c | 1 + core/init.c | 1 + core/interrupts.c | 1 + core/ipmi.c | 3 ++ core/nvram.c | 1 + core/opal-msg.c | 1 + core/opal.c | 1 + core/pci-opal.c | 1 + core/platform.c | 1 + core/timebase.c | 1 + core/timer.c | 1 + core/trace.c | 1 + hw/cec.c | 1 + hw/chiptod.c | 1 + hw/fake-rtc.c | 1 + hw/fsp/fsp-codeupdate.c | 1 + hw/fsp/fsp-console.c | 1 + hw/fsp/fsp-dpo.c | 1 + hw/fsp/fsp-dump.c | 1 + hw/fsp/fsp-elog-read.c | 1 + hw/fsp/fsp-elog-write.c | 1 + hw/fsp/fsp-epow.c | 1 + hw/fsp/fsp-mdst-table.c | 1 + hw/fsp/fsp-nvram.c | 1 + hw/fsp/fsp-op-panel.c | 1 + hw/fsp/fsp-rtc.c | 1 + hw/fsp/fsp-sensor.c | 1 + hw/fsp/fsp-surveillance.c | 1 + hw/fsp/fsp-sysparam.c | 1 + hw/fsp/fsp.c | 1 + hw/ipmi/ipmi-fru.c | 2 ++ hw/ipmi/ipmi-opal.c | 2 ++ hw/ipmi/ipmi-power.c | 1 + hw/ipmi/ipmi-rtc.c | 2 ++ hw/ipmi/ipmi-sel.c | 2 ++ hw/lpc-uart.c | 1 + hw/lpc.c | 1 + hw/p7ioc-phb.c | 1 + hw/p7ioc.c | 1 + hw/p8-i2c.c | 2 ++ hw/phb3.c | 1 + hw/psi.c | 1 + hw/slw.c | 1 + hw/xscom.c | 1 + include/errorlog.h | 1 + include/opal-api.h | 84 +++++++++++++++++++++++++++++++++++++++++++++++ include/opal.h | 63 ----------------------------------- 52 files changed, 141 insertions(+), 63 deletions(-) create mode 100644 include/opal-api.h diff --git a/core/affinity.c b/core/affinity.c index d5eea82..fe364a2 100644 --- a/core/affinity.c +++ b/core/affinity.c @@ -45,6 +45,7 @@ */ #include #include +#include #include #include #include diff --git a/core/console.c b/core/console.c index bc8eed8..3a607d0 100644 --- a/core/console.c +++ b/core/console.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/core/cpu.c b/core/cpu.c index 1e405f8..1b523f6 100644 --- a/core/cpu.c +++ b/core/cpu.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/core/exceptions.c b/core/exceptions.c index 4a4da15..1587034 100644 --- a/core/exceptions.c +++ b/core/exceptions.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/core/hmi.c b/core/hmi.c index 45fc89b..1978f54 100644 --- a/core/hmi.c +++ b/core/hmi.c @@ -15,6 +15,7 @@ */ #include #include +#include #include #include #include diff --git a/core/i2c.c b/core/i2c.c index e0af9b2..26149da 100644 --- a/core/i2c.c +++ b/core/i2c.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/core/init.c b/core/init.c index 92f61e8..3923164 100644 --- a/core/init.c +++ b/core/init.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/core/interrupts.c b/core/interrupts.c index 70614a0..df48c8d 100644 --- a/core/interrupts.c +++ b/core/interrupts.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/core/ipmi.c b/core/ipmi.c index 14c35f3..76b9a33 100644 --- a/core/ipmi.c +++ b/core/ipmi.c @@ -15,10 +15,13 @@ */ #include +#include #include #include #include +#include #include +#include struct ipmi_backend *ipmi_backend = NULL; diff --git a/core/nvram.c b/core/nvram.c index f25d6aa..0dce4fc 100644 --- a/core/nvram.c +++ b/core/nvram.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/core/opal-msg.c b/core/opal-msg.c index f033b76..47c5a12 100644 --- a/core/opal-msg.c +++ b/core/opal-msg.c @@ -17,6 +17,7 @@ #include #include +#include #include #define OPAL_MAX_MSGS (OPAL_MSG_TYPE_MAX + OPAL_MAX_ASYNC_COMP - 1) diff --git a/core/opal.c b/core/opal.c index 044ff92..fc18db3 100644 --- a/core/opal.c +++ b/core/opal.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include diff --git a/core/pci-opal.c b/core/pci-opal.c index bb6bb70..a1c6e7a 100644 --- a/core/pci-opal.c +++ b/core/pci-opal.c @@ -15,6 +15,7 @@ */ #include +#include #include #include #include diff --git a/core/platform.c b/core/platform.c index 53971e9..69d8e91 100644 --- a/core/platform.c +++ b/core/platform.c @@ -17,6 +17,7 @@ #include #include +#include #include /* diff --git a/core/timebase.c b/core/timebase.c index 7e3345f..9321373 100644 --- a/core/timebase.c +++ b/core/timebase.c @@ -16,6 +16,7 @@ #include #include +#include #include static void time_wait_poll(unsigned long duration) diff --git a/core/timer.c b/core/timer.c index 737fb78..81ee5b9 100644 --- a/core/timer.c +++ b/core/timer.c @@ -4,6 +4,7 @@ #include #include #include +#include #ifdef __TEST__ #define this_cpu() ((void *)-1) diff --git a/core/trace.c b/core/trace.c index 47c10e3..6dc1e65 100644 --- a/core/trace.c +++ b/core/trace.c @@ -24,6 +24,7 @@ #include #include #include +#include #define DEBUG_TRACES diff --git a/hw/cec.c b/hw/cec.c index d8d1354..6c0fea8 100644 --- a/hw/cec.c +++ b/hw/cec.c @@ -19,6 +19,7 @@ #include #include #include +#include /* * Note: This file os only used on P7/P7+ diff --git a/hw/chiptod.c b/hw/chiptod.c index 22dfaec..1e3448b 100644 --- a/hw/chiptod.c +++ b/hw/chiptod.c @@ -24,6 +24,7 @@ #include #include #include +#include /* TOD chip XSCOM addresses */ #define TOD_TTYPE_0 0x00040011 diff --git a/hw/fake-rtc.c b/hw/fake-rtc.c index f0764db..06b6135 100644 --- a/hw/fake-rtc.c +++ b/hw/fake-rtc.c @@ -16,6 +16,7 @@ #include #include +#include #include uint32_t *fake_ymd; diff --git a/hw/fsp/fsp-codeupdate.c b/hw/fsp/fsp-codeupdate.c index 0d50f0c..3ace928 100644 --- a/hw/fsp/fsp-codeupdate.c +++ b/hw/fsp/fsp-codeupdate.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "fsp-codeupdate.h" diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c index 2dc5058..d77d086 100644 --- a/hw/fsp/fsp-console.c +++ b/hw/fsp/fsp-console.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/hw/fsp/fsp-dpo.c b/hw/fsp/fsp-dpo.c index 610c7c3..d3967a3 100644 --- a/hw/fsp/fsp-dpo.c +++ b/hw/fsp/fsp-dpo.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #define PREFIX "FSPDPO: " diff --git a/hw/fsp/fsp-dump.c b/hw/fsp/fsp-dump.c index 9f0a693..941224f 100644 --- a/hw/fsp/fsp-dump.c +++ b/hw/fsp/fsp-dump.c @@ -41,6 +41,7 @@ #include #include #include +#include /* * Max outstanding dumps to retrieve diff --git a/hw/fsp/fsp-elog-read.c b/hw/fsp/fsp-elog-read.c index 435612e..7ec7742 100644 --- a/hw/fsp/fsp-elog-read.c +++ b/hw/fsp/fsp-elog-read.c @@ -53,6 +53,7 @@ #include #include #include +#include /* * Maximum number of entries that are pre-allocated diff --git a/hw/fsp/fsp-elog-write.c b/hw/fsp/fsp-elog-write.c index dd71712..eaf3225 100644 --- a/hw/fsp/fsp-elog-write.c +++ b/hw/fsp/fsp-elog-write.c @@ -33,6 +33,7 @@ #include #include #include +#include static LIST_HEAD(elog_write_to_fsp_pending); static LIST_HEAD(elog_write_to_host_pending); diff --git a/hw/fsp/fsp-epow.c b/hw/fsp/fsp-epow.c index 3979bb2..dba05cb 100644 --- a/hw/fsp/fsp-epow.c +++ b/hw/fsp/fsp-epow.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "fsp-epow.h" diff --git a/hw/fsp/fsp-mdst-table.c b/hw/fsp/fsp-mdst-table.c index b220fbe..318c6b0 100644 --- a/hw/fsp/fsp-mdst-table.c +++ b/hw/fsp/fsp-mdst-table.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/hw/fsp/fsp-nvram.c b/hw/fsp/fsp-nvram.c index 257cdd6..87a774a 100644 --- a/hw/fsp/fsp-nvram.c +++ b/hw/fsp/fsp-nvram.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/hw/fsp/fsp-op-panel.c b/hw/fsp/fsp-op-panel.c index 18cdd28..93d1266 100644 --- a/hw/fsp/fsp-op-panel.c +++ b/hw/fsp/fsp-op-panel.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/hw/fsp/fsp-rtc.c b/hw/fsp/fsp-rtc.c index 0650902..6c9258f 100644 --- a/hw/fsp/fsp-rtc.c +++ b/hw/fsp/fsp-rtc.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/hw/fsp/fsp-sensor.c b/hw/fsp/fsp-sensor.c index c40ba23..39e4e8e 100644 --- a/hw/fsp/fsp-sensor.c +++ b/hw/fsp/fsp-sensor.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include diff --git a/hw/fsp/fsp-surveillance.c b/hw/fsp/fsp-surveillance.c index dab3f31..138ff3f 100644 --- a/hw/fsp/fsp-surveillance.c +++ b/hw/fsp/fsp-surveillance.c @@ -20,6 +20,7 @@ #include #include #include +#include static bool fsp_surv_state = false; static bool fsp_surv_ack_pending = false; diff --git a/hw/fsp/fsp-sysparam.c b/hw/fsp/fsp-sysparam.c index d017e4d..083c465 100644 --- a/hw/fsp/fsp-sysparam.c +++ b/hw/fsp/fsp-sysparam.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c index fcffbfd..fdc4ffb 100644 --- a/hw/fsp/fsp.c +++ b/hw/fsp/fsp.c @@ -36,6 +36,7 @@ #include #include #include +#include #include DEFINE_LOG_ENTRY(OPAL_RC_FSP_POLL_TIMEOUT, OPAL_PLATFORM_ERR_EVT, OPAL_FSP, diff --git a/hw/ipmi/ipmi-fru.c b/hw/ipmi/ipmi-fru.c index 49a7e0f..8728e33 100644 --- a/hw/ipmi/ipmi-fru.c +++ b/hw/ipmi/ipmi-fru.c @@ -14,7 +14,9 @@ * limitations under the License. */ +#include #include +#include #include #include #include diff --git a/hw/ipmi/ipmi-opal.c b/hw/ipmi/ipmi-opal.c index 4a90468..92e9ac5 100644 --- a/hw/ipmi/ipmi-opal.c +++ b/hw/ipmi/ipmi-opal.c @@ -15,9 +15,11 @@ */ #include +#include #include #include #include +#include #include #include diff --git a/hw/ipmi/ipmi-power.c b/hw/ipmi/ipmi-power.c index 05c0e4c..f14a0c9 100644 --- a/hw/ipmi/ipmi-power.c +++ b/hw/ipmi/ipmi-power.c @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include #include diff --git a/hw/ipmi/ipmi-rtc.c b/hw/ipmi/ipmi-rtc.c index ffb33ed..46271e2 100644 --- a/hw/ipmi/ipmi-rtc.c +++ b/hw/ipmi/ipmi-rtc.c @@ -15,11 +15,13 @@ */ #include +#include #include #include #include #include #include +#include #include static enum {idle, waiting, updated, error} time_status; diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c index d6f7f47..3f9462a 100644 --- a/hw/ipmi/ipmi-sel.c +++ b/hw/ipmi/ipmi-sel.c @@ -14,7 +14,9 @@ * limitations under the License. */ +#include #include +#include #include #include #include diff --git a/hw/lpc-uart.c b/hw/lpc-uart.c index 2e6114a..b73f69c 100644 --- a/hw/lpc-uart.c +++ b/hw/lpc-uart.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/hw/lpc.c b/hw/lpc.c index e2e848b..b6d9a63 100644 --- a/hw/lpc.c +++ b/hw/lpc.c @@ -22,6 +22,7 @@ #include #include #include +#include DEFINE_LOG_ENTRY(OPAL_RC_LPC_READ, OPAL_PLATFORM_ERR_EVT, OPAL_LPC, OPAL_MISC_SUBSYSTEM, OPAL_PREDICTIVE_ERR_GENERAL, diff --git a/hw/p7ioc-phb.c b/hw/p7ioc-phb.c index 34ee683..99528f5 100644 --- a/hw/p7ioc-phb.c +++ b/hw/p7ioc-phb.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #define PHBDBG(p, fmt, a...) prlog(PR_DEBUG, "PHB%d: " fmt, \ diff --git a/hw/p7ioc.c b/hw/p7ioc.c index 9aa6480..5cb9f14 100644 --- a/hw/p7ioc.c +++ b/hw/p7ioc.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c index 3e5334c..4068024 100644 --- a/hw/p8-i2c.c +++ b/hw/p8-i2c.c @@ -17,6 +17,8 @@ #undef DEBUG #include +#include +#include #include #include #include diff --git a/hw/phb3.c b/hw/phb3.c index c07d2eb..b27bac3 100644 --- a/hw/phb3.c +++ b/hw/phb3.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/hw/psi.c b/hw/psi.c index 70403fd..5225656 100644 --- a/hw/psi.c +++ b/hw/psi.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/hw/slw.c b/hw/slw.c index 38c781f..3f3f649 100644 --- a/hw/slw.c +++ b/hw/slw.c @@ -28,6 +28,7 @@ #include #include #include +#include #ifdef __HAVE_LIBPORE__ #include diff --git a/hw/xscom.c b/hw/xscom.c index 94e088c..33c04b1 100644 --- a/hw/xscom.c +++ b/hw/xscom.c @@ -22,6 +22,7 @@ #include #include #include +#include /* Mask of bits to clear in HMER before an access */ #define HMER_CLR_MASK (~(SPR_HMER_XSCOM_FAIL | \ diff --git a/include/errorlog.h b/include/errorlog.h index 7879b7b..f44e9b8 100644 --- a/include/errorlog.h +++ b/include/errorlog.h @@ -17,6 +17,7 @@ #ifndef __ERRORLOG_H #define __ERRORLOG_H +#include #include #include #include diff --git a/include/opal-api.h b/include/opal-api.h new file mode 100644 index 0000000..4e05d59 --- /dev/null +++ b/include/opal-api.h @@ -0,0 +1,84 @@ +/* Copyright 2013-2014 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __OPAL_API_H +#define __OPAL_API_H + +/****** Internal header for OPAL API related things in skiboot **********/ +#include + +/* An opal table entry */ +struct opal_table_entry { + void *func; + __be32 token; + __be32 nargs; +}; + +#define opal_call(__tok, __func, __nargs) \ +static struct opal_table_entry __e_##__func __used __section(".opal_table") = \ +{ .func = __func, .token = __tok, \ + .nargs = __nargs + 0 * sizeof(__func( __test_args##__nargs )) } + +/* Make sure function takes args they claim. Look away now... */ +#define __test_args0 +#define __test_args1 0 +#define __test_args2 0,0 +#define __test_args3 0,0,0 +#define __test_args4 0,0,0,0 +#define __test_args5 0,0,0,0,0 +#define __test_args6 0,0,0,0,0,0 +#define __test_args7 0,0,0,0,0,0,0 + +extern struct opal_table_entry __opal_table_start[]; +extern struct opal_table_entry __opal_table_end[]; + +extern __be64 opal_pending_events; + +extern struct dt_node *opal_node; + +extern void opal_table_init(void); +extern void opal_update_pending_evt(__be64 evt_mask, __be64 evt_values); +__be64 opal_dynamic_event_alloc(void); +void opal_dynamic_event_free(__be64 event); +extern void add_opal_node(void); + +#define opal_register(token, func, nargs) \ + __opal_register((token) + 0*sizeof(func(__test_args##nargs)), \ + (func), (nargs)) +extern void __opal_register(__be64 token, void *func, unsigned num_args); + +/* Warning: no locking at the moment, do at init time only + * + * XXX TODO: Add the big RCU-ish "opal API lock" to protect us here + * which will also be used for other things such as runtime updates + */ +extern void opal_add_poller(void (*poller)(void *data), void *data); +extern void opal_del_poller(void (*poller)(void *data)); +extern void opal_run_pollers(void); + +/* + * Warning: no locking, only call that from the init processor + */ +extern void opal_add_host_sync_notifier(bool (*notify)(void *data), void *data); +extern void opal_del_host_sync_notifier(bool (*notify)(void *data)); + +/* + * Opal internal function prototype + */ +struct OpalHMIEvent; +extern int handle_hmi_exception(__be64 hmer, struct OpalHMIEvent *hmi_evt); + +#endif /* __OPAL_API_H */ diff --git a/include/opal.h b/include/opal.h index 7e23dfa..088a30d 100644 --- a/include/opal.h +++ b/include/opal.h @@ -816,68 +816,5 @@ struct opal_i2c_request { __be64 buffer_ra; /* Buffer real address */ }; -/****** Internal **********/ -#include - -/* An opal table entry */ -struct opal_table_entry { - void *func; - __be32 token; - __be32 nargs; -}; - -#define opal_call(__tok, __func, __nargs) \ -static struct opal_table_entry __e_##__func __used __section(".opal_table") = \ -{ .func = __func, .token = __tok, \ - .nargs = __nargs + 0 * sizeof(__func( __test_args##__nargs )) } - -/* Make sure function takes args they claim. Look away now... */ -#define __test_args0 -#define __test_args1 0 -#define __test_args2 0,0 -#define __test_args3 0,0,0 -#define __test_args4 0,0,0,0 -#define __test_args5 0,0,0,0,0 -#define __test_args6 0,0,0,0,0,0 -#define __test_args7 0,0,0,0,0,0,0 - -extern struct opal_table_entry __opal_table_start[]; -extern struct opal_table_entry __opal_table_end[]; - -extern __be64 opal_pending_events; - -extern struct dt_node *opal_node; - -extern void opal_table_init(void); -extern void opal_update_pending_evt(__be64 evt_mask, __be64 evt_values); -__be64 opal_dynamic_event_alloc(void); -void opal_dynamic_event_free(__be64 event); -extern void add_opal_node(void); - -#define opal_register(token, func, nargs) \ - __opal_register((token) + 0*sizeof(func(__test_args##nargs)), \ - (func), (nargs)) -extern void __opal_register(__be64 token, void *func, unsigned num_args); - -/* Warning: no locking at the moment, do at init time only - * - * XXX TODO: Add the big RCU-ish "opal API lock" to protect us here - * which will also be used for other things such as runtime updates - */ -extern void opal_add_poller(void (*poller)(void *data), void *data); -extern void opal_del_poller(void (*poller)(void *data)); -extern void opal_run_pollers(void); - -/* - * Warning: no locking, only call that from the init processor - */ -extern void opal_add_host_sync_notifier(bool (*notify)(void *data), void *data); -extern void opal_del_host_sync_notifier(bool (*notify)(void *data)); - -/* - * Opal internal function prototype - */ -extern int handle_hmi_exception(__be64 hmer, struct OpalHMIEvent *hmi_evt); - #endif /* __ASSEMBLY__ */ #endif /* __OPAL_H */ -- cgit v1.1