diff options
52 files changed, 141 insertions, 63 deletions
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 <skiboot.h> #include <opal.h> +#include <opal-api.h> #include <device.h> #include <console.h> #include <trace.h> 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 <unistd.h> #include <console.h> #include <opal.h> +#include <opal-api.h> #include <device.h> #include <processor.h> #include <cpu.h> @@ -22,6 +22,7 @@ #include <cpu.h> #include <device.h> #include <opal.h> +#include <opal-api.h> #include <stack.h> #include <trace.h> #include <affinity.h> 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 <skiboot.h> #include <stack.h> #include <opal.h> +#include <opal-api.h> #include <processor.h> #include <cpu.h> @@ -15,6 +15,7 @@ */ #include <skiboot.h> #include <opal.h> +#include <opal-api.h> #include <opal-msg.h> #include <processor.h> #include <chiptod.h> @@ -17,6 +17,7 @@ #include <skiboot.h> #include <i2c.h> #include <opal.h> +#include <opal-api.h> #include <device.h> #include <opal-msg.h> 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 <xscom.h> #include <device_tree.h> #include <opal.h> +#include <opal-api.h> #include <opal-msg.h> #include <elf.h> #include <io.h> 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 <fsp.h> #include <interrupts.h> #include <opal.h> +#include <opal-api.h> #include <io.h> #include <cec.h> #include <device.h> 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 <stdio.h> +#include <string.h> #include <bt.h> #include <ipmi.h> #include <opal.h> +#include <opal-api.h> #include <device.h> +#include <skiboot.h> 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 <skiboot.h> #include <fsp.h> #include <opal.h> +#include <opal-api.h> #include <lock.h> #include <device.h> #include <platform.h> 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 <skiboot.h> #include <opal-msg.h> +#include <opal-api.h> #include <lock.h> #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 <skiboot.h> #include <opal.h> +#include <opal-api.h> #include <stack.h> #include <lock.h> #include <fsp.h> 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 <skiboot.h> +#include <opal-api.h> #include <pci.h> #include <pci-cfg.h> #include <timebase.h> 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 <skiboot.h> #include <opal.h> +#include <opal-api.h> #include <console.h> /* 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 <timebase.h> #include <opal.h> +#include <opal-api.h> #include <cpu.h> 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 <fsp.h> #include <device.h> #include <opal.h> +#include <opal-api.h> #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 <libfdt.h> #include <processor.h> #include <skiboot.h> +#include <opal-api.h> #define DEBUG_TRACES @@ -19,6 +19,7 @@ #include <p7ioc.h> #include <p5ioc2.h> #include <interrupts.h> +#include <opal-api.h> /* * 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 <io.h> #include <cpu.h> #include <timebase.h> +#include <opal-api.h> /* 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 <skiboot.h> #include <opal.h> +#include <opal-api.h> #include <mem_region.h> 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 <device.h> #include <ccan/endian/endian.h> #include <errorlog.h> +#include <opal-api.h> #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 <fsp.h> #include <console.h> #include <opal.h> +#include <opal-api.h> #include <timebase.h> #include <device.h> #include <fsp-sysparam.h> 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 <stdio.h> #include <timebase.h> #include <opal.h> +#include <opal-api.h> #include <opal-msg.h> #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 <device.h> #include <skiboot.h> #include <errorlog.h> +#include <opal-api.h> /* * 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 <errno.h> #include <psi.h> #include <fsp-elog.h> +#include <opal-api.h> /* * 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 <timebase.h> #include <pel.h> #include <pool.h> +#include <opal-api.h> 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 <stdio.h> #include <spcn.h> #include <opal.h> +#include <opal-api.h> #include <opal-msg.h> #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 <fsp.h> #include <psi.h> #include <opal.h> +#include <opal-api.h> #include <lock.h> #include <skiboot.h> #include <errorlog.h> 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 <skiboot.h> #include <fsp.h> #include <opal.h> +#include <opal-api.h> #include <lock.h> #include <device.h> #include <errorlog.h> 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 <fsp.h> #include <lock.h> #include <opal.h> +#include <opal-api.h> #include <device.h> #include <processor.h> #include <opal-msg.h> 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 <timebase.h> #include <time.h> #include <time-utils.h> +#include <opal-api.h> #include <opal-msg.h> #include <errorlog.h> #include <device.h> 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 <lock.h> #include <device.h> #include <spcn.h> +#include <opal-api.h> #include <opal-msg.h> #include<errorlog.h> 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 <timebase.h> #include <fsp-sysparam.h> #include <errorlog.h> +#include <opal-api.h> 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 <skiboot.h> #include <fsp.h> #include <opal.h> +#include <opal-api.h> #include <device.h> #include <lock.h> #include <processor.h> 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 <cpu.h> #include <errorlog.h> #include <opal.h> +#include <opal-api.h> #include <opal-msg.h> 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 <skiboot.h> #include <stdlib.h> +#include <string.h> #include <ipmi.h> #include <lock.h> #include <opal.h> 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 <stdlib.h> +#include <string.h> #include <ipmi.h> #include <lock.h> #include <opal.h> +#include <opal-api.h> #include <device.h> #include <ccan/list/list.h> 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 <skiboot.h> #include <stdlib.h> #include <ipmi.h> #include <opal.h> 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 <stdlib.h> +#include <string.h> #include <ipmi.h> #include <time.h> #include <time-utils.h> #include <device.h> #include <opal.h> +#include <opal-api.h> #include <rtc.h> 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 <skiboot.h> #include <stdlib.h> +#include <string.h> #include <ipmi.h> #include <device.h> #include <opal.h> 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 <lpc.h> #include <console.h> #include <opal.h> +#include <opal-api.h> #include <device.h> #include <interrupts.h> #include <processor.h> @@ -22,6 +22,7 @@ #include <lpc.h> #include <timebase.h> #include <errorlog.h> +#include <opal-api.h> 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 <pci-cfg.h> #include <interrupts.h> #include <opal.h> +#include <opal-api.h> #include <ccan/str/str.h> #define PHBDBG(p, fmt, a...) prlog(PR_DEBUG, "PHB%d: " fmt, \ @@ -19,6 +19,7 @@ #include <p7ioc-regs.h> #include <cec.h> #include <opal.h> +#include <opal-api.h> #include <io.h> #include <vpd.h> #include <interrupts.h> 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 <opal.h> +#include <skiboot.h> +#include <mem_region-malloc.h> #include <lock.h> #include <chip.h> #include <i2c.h> @@ -35,6 +35,7 @@ #include <vpd.h> #include <interrupts.h> #include <opal.h> +#include <opal-api.h> #include <cpu.h> #include <device.h> #include <ccan/str/str.h> @@ -21,6 +21,7 @@ #include <psi.h> #include <fsp.h> #include <opal.h> +#include <opal-api.h> #include <gx.h> #include <interrupts.h> #include <cpu.h> @@ -28,6 +28,7 @@ #include <timebase.h> #include <errorlog.h> #include <libfdt/libfdt.h> +#include <opal-api.h> #ifdef __HAVE_LIBPORE__ #include <p8_pore_table_gen_api.H> @@ -22,6 +22,7 @@ #include <chip.h> #include <centaur.h> #include <errorlog.h> +#include <opal-api.h> /* 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 <compiler.h> #include <opal.h> #include <stdint.h> #include <ccan/list/list.h> 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 <skiboot.h> + +/* 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 <skiboot.h> - -/* 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 */ |