[Skiboot] [RFC PATCH 2/2] config: fix undefined references when !CONFIG_FSP
Cédric Le Goater
clg at fr.ibm.com
Wed Apr 13 22:06:24 AEST 2016
When FSP support is removed with !CONFIG_FSP, the link of skiboot.elf
is broken because of a large set of undefined symbols.
This patch adds the necessary #ifdefs to work around the issue but
this is not the optimal solution. We should add specific platform
operations to handle differences, op_display looks like a good
candidate. hostservices and occ module maybe need a little more
refactoring.
The good news is there is nothing really complex to handle if that
needs to be done and we would gain quite a lot of bytes in our 1MB
flash partition on OpenPOWER systems. Here are some figures :
$ ls -l skiboot.lid.nofsp skiboot.lid.fsp
-rw-r--r-- 1 legoater legoater 920030 Apr 7 11:12 skiboot.lid.fsp
-rw-r--r-- 1 legoater legoater 753772 Apr 7 11:13 skiboot.lid.nofsp
$ size skiboot.elf.fsp skiboot.elf.nofsp
text data bss dec hex filename
798948 71808 108272 979028 ef054 skiboot.elf.fsp
643886 60600 81936 786422 bfff6 skiboot.elf.nofsp
Fixed errors are :
hdata/built-in.o: In function `__memory_parse':
./hdata/memory.c:405: undefined reference to `op_display'
core/built-in.o: In function `load_and_boot_kernel':
./core/init.c:415: undefined reference to `op_display'
./core/init.c:422: undefined reference to `op_display'
./core/init.c:434: undefined reference to `fsp_nvram_wait_open'
./core/init.c:437: undefined reference to `fsp_code_update_wait_vpd'
./core/init.c:439: undefined reference to `fsp_console_select_stdout'
./core/init.c:452: undefined reference to `op_display'
./core/init.c:457: undefined reference to `op_display'
./core/init.c:461: undefined reference to `op_display'
./core/init.c:465: undefined reference to `op_panel_disable_src_echo'
./core/init.c:468: undefined reference to `op_panel_clear_src'
core/built-in.o: In function `main_cpu_entry':
./core/init.c:749: undefined reference to `op_display'
core/built-in.o: In function `lock_error':
./core/lock.c:38: undefined reference to `op_display'
core/built-in.o: In function `cpu_bringup':
./core/cpu.c:565: undefined reference to `op_display'
./core/cpu.c:572: undefined reference to `op_display'
./core/cpu.c:589: undefined reference to `op_display'
core/built-in.o: In function `opal_poll_events':
./core/opal.c:332: undefined reference to `fsp_trigger_reset'
core/built-in.o: In function `pci_add_loc_code':
./core/pci.c:1212: undefined reference to `fsp_present'
./core/pci.c:1232: undefined reference to `fsp_present'
core/built-in.o: In function `fast_reboot':
./core/fast-reboot.c:326: undefined reference to `fsp_console_reset'
core/built-in.o: In function `vpd_iohub_load':
./core/vpd.c:192: undefined reference to `fsp_wait_lid_loaded'
core/built-in.o: In function `vpd_lid_preload':
./core/vpd.c:154: undefined reference to `fsp_adjust_lid_side'
./core/vpd.c:160: undefined reference to `fsp_preload_lid'
core/built-in.o: In function `hservice_start_elog_send':
./core/hostservices.c:302: undefined reference to `fsp_tce_map'
./core/hostservices.c:305: undefined reference to `fsp_mkmsg'
./core/hostservices.c:314: undefined reference to `fsp_queue_msg'
./core/hostservices.c:319: undefined reference to `fsp_freemsg'
./core/hostservices.c:320: undefined reference to `fsp_tce_unmap'
core/built-in.o: In function `hservice_send_error_log':
./core/hostservices.c:336: undefined reference to `fsp_present'
core/built-in.o: In function `hservice_elog_write_complete':
./core/hostservices.c:279: undefined reference to `fsp_tce_unmap'
./core/hostservices.c:283: undefined reference to `fsp_freemsg'
core/built-in.o: In function `__hservice_lid_load':
./core/hostservices.c:410: undefined reference to `fsp_adjust_lid_side'
./core/hostservices.c:418: undefined reference to `fsp_preload_lid'
./core/hostservices.c:419: undefined reference to `fsp_wait_lid_loaded'
core/built-in.o: In function `late_init_timers':
./core/timer.c:258: undefined reference to `fsp_present'
hw/built-in.o: In function `chiptod_init':
./hw/chiptod.c:1710: undefined reference to `op_display'
./hw/chiptod.c:1714: undefined reference to `op_display'
./hw/chiptod.c:1718: undefined reference to `op_display'
./hw/chiptod.c:1733: undefined reference to `op_display'
./hw/chiptod.c:1737: undefined reference to `op_display'
hw/built-in.o:./hw/chiptod.c:1751: more undefined references to `op_display' follow
hw/built-in.o: In function `psi_link_poll':
./hw/psi.c:199: undefined reference to `fsp_reinit_fsp'
hw/built-in.o: In function `psi_interrupt':
./hw/psi.c:385: undefined reference to `fsp_interrupt'
./hw/psi.c:395: undefined reference to `fsp_console_poll'
hw/built-in.o: In function `__occ_do_load':
./hw/occ.c:598: undefined reference to `fsp_mkmsg'
./hw/occ.c:600: undefined reference to `fsp_queue_msg'
./hw/occ.c:604: undefined reference to `fsp_freemsg'
hw/built-in.o: In function `occ_do_load':
./hw/occ.c:636: undefined reference to `fsp_mkmsg'
./hw/occ.c:638: undefined reference to `fsp_queue_msg'
./hw/occ.c:642: undefined reference to `fsp_freemsg'
hw/built-in.o: In function `occ_do_reset':
./hw/occ.c:676: undefined reference to `fsp_mkmsg'
./hw/occ.c:678: undefined reference to `fsp_queue_msg'
./hw/occ.c:680: undefined reference to `fsp_freemsg'
./hw/occ.c:707: undefined reference to `fsp_mkmsg'
./hw/occ.c:709: undefined reference to `fsp_queue_msg'
./hw/occ.c:711: undefined reference to `fsp_freemsg'
./hw/occ.c:747: undefined reference to `fsp_mkmsg'
./hw/occ.c:750: undefined reference to `fsp_queue_msg'
./hw/occ.c:752: undefined reference to `fsp_freemsg'
hw/built-in.o: In function `occ_fsp_init':
./hw/occ.c:908: undefined reference to `fsp_present'
./hw/occ.c:909: undefined reference to `fsp_register_client'
hw/built-in.o: In function `prd_init':
./hw/prd.c:360: undefined reference to `fsp_present'
hw/built-in.o:(.toc+0x0): undefined reference to `fsp_freemsg'
Signed-off-by: Cédric Le Goater <clg at fr.ibm.com>
---
hw/occ.c | 15 +++++++++++--
include/fsp.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++--
include/op-panel.h | 10 ++++++++-
3 files changed, 76 insertions(+), 6 deletions(-)
Index: skiboot.git/include/op-panel.h
===================================================================
--- skiboot.git.orig/include/op-panel.h
+++ skiboot.git/include/op-panel.h
@@ -58,10 +58,18 @@ enum op_module {
* 'BA070003' : MS VPD doesn't have a total config
*/
+#ifdef CONFIG_FSP
extern void op_display(enum op_severity, enum op_module, uint16_t code);
-
extern void op_panel_disable_src_echo(void);
extern void op_panel_clear_src(void);
+#else
+static inline void op_display(enum op_severity sev __unused,
+ enum op_module mod __unused,
+ uint16_t code __unused) {}
+static inline void op_panel_disable_src_echo(void) {}
+static inline void op_panel_clear_src(void) {}
+#endif
+
extern void fsp_oppanel_init(void);
#endif /* __OP_PANEL_H */
Index: skiboot.git/hw/occ.c
===================================================================
--- skiboot.git.orig/hw/occ.c
+++ skiboot.git/hw/occ.c
@@ -71,11 +71,11 @@ struct occ_pstate_table {
DEFINE_LOG_ENTRY(OPAL_RC_OCC_LOAD, OPAL_PLATFORM_ERR_EVT, OPAL_OCC,
OPAL_CEC_HARDWARE, OPAL_PREDICTIVE_ERR_GENERAL,
OPAL_NA);
-
+#ifdef CONFIG_FSP
DEFINE_LOG_ENTRY(OPAL_RC_OCC_RESET, OPAL_PLATFORM_ERR_EVT, OPAL_OCC,
OPAL_CEC_HARDWARE, OPAL_PREDICTIVE_ERR_GENERAL,
OPAL_NA);
-
+#endif
DEFINE_LOG_ENTRY(OPAL_RC_OCC_PSTATE_INIT, OPAL_PLATFORM_ERR_EVT, OPAL_OCC,
OPAL_CEC_HARDWARE, OPAL_INFO,
OPAL_NA);
@@ -539,6 +539,7 @@ int find_master_and_slave_occ(uint64_t *
return 0;
}
+#ifdef CONFIG_FSP
static void occ_queue_load(u8 scope, u32 dbob_id, u32 seq_id)
{
struct occ_load_req *occ_req;
@@ -554,7 +555,7 @@ static void occ_queue_load(u8 scope, u32
occ_req->seq_id = seq_id;
list_add_tail(&occ_load_req_list, &occ_req->link);
}
-
+#endif
static void __occ_do_load(u8 scope, u32 dbob_id __unused, u32 seq_id)
{
struct fsp_msg *stat;
@@ -619,6 +620,7 @@ void occ_poke_load_queue(void)
free(occ_req);
}
}
+#ifdef CONFIG_FSP
static void occ_do_load(u8 scope, u32 dbob_id __unused, u32 seq_id)
{
@@ -758,6 +760,7 @@ static void occ_do_reset(u8 scope, u32 d
}
}
}
+#endif
#define PV_OCC_GP0 0x01000000
#define PV_OCC_GP0_AND 0x01000004
@@ -787,6 +790,7 @@ void occ_pnor_set_owner(enum pnor_owner
occ_pnor_set_one_owner(chip->id, owner);
}
+#ifdef CONFIG_FSP
static bool fsp_occ_msg(u32 cmd_sub_mod, struct fsp_msg *msg)
{
u32 dbob_id, seq_id;
@@ -828,6 +832,7 @@ static bool fsp_occ_msg(u32 cmd_sub_mod,
static struct fsp_client fsp_occ_client = {
.message = fsp_occ_msg,
};
+#endif
#define OCB_OCI_OCCMISC 0x6a020
#define OCB_OCI_OCCMISC_AND 0x6a021
@@ -900,6 +905,7 @@ void occ_interrupt(uint32_t chip_id)
void occ_fsp_init(void)
{
+#ifdef CONFIG_FSP
/* OCC is P8 only */
if (proc_gen != proc_gen_p8)
return;
@@ -907,6 +913,9 @@ void occ_fsp_init(void)
/* If we have an FSP, register for notifications */
if (fsp_present())
fsp_register_client(&fsp_occ_client, FSP_MCLASS_OCC);
+#else
+ prerror("OCC: no need to init !\n");
+#endif
}
Index: skiboot.git/include/fsp.h
===================================================================
--- skiboot.git.orig/include/fsp.h
+++ skiboot.git/include/fsp.h
@@ -658,7 +658,11 @@ extern void fsp_init(void);
extern void fsp_opl(void);
/* Check if system has an FSP */
+#ifdef CONFIG_FSP
extern bool fsp_present(void);
+#else
+static inline bool fsp_present(void) { return false; }
+#endif
/* Allocate and populate an fsp_msg structure
*
@@ -666,7 +670,12 @@ extern bool fsp_present(void);
* instead as we will eventually use pre-allocated message pools
*/
extern struct fsp_msg *fsp_allocmsg(bool alloc_response) __warn_unused_result;
+
+#ifdef CONFIG_FSP
extern struct fsp_msg *fsp_mkmsg(u32 cmd_sub_mod, u8 add_words, ...) __warn_unused_result;
+#else
+static inline struct fsp_msg *fsp_mkmsg(u32 cmd_sub_mod __unused, u8 add_words __unused, ...) {return 0;}
+#endif
/* Populate a pre-allocated msg */
extern void fsp_fillmsg(struct fsp_msg *msg, u32 cmd_sub_mod, u8 add_words, ...);
@@ -675,8 +684,11 @@ extern void fsp_fillmsg(struct fsp_msg *
*
* WARNING: This will also free an attached response if any
*/
+#ifdef CONFIG_FSP
extern void fsp_freemsg(struct fsp_msg *msg);
-
+#else
+static inline void fsp_freemsg(struct fsp_msg *msg __unused) {}
+#endif
/* Free a message and not the attached reply */
extern void __fsp_freemsg(struct fsp_msg *msg);
@@ -694,8 +706,14 @@ extern void fsp_cancelmsg(struct fsp_msg
* and is meant to be used that way for sending serial "poke"
* commands to the FSP.
*/
+#ifdef CONFIG_FSP
extern int fsp_queue_msg(struct fsp_msg *msg,
void (*comp)(struct fsp_msg *msg)) __warn_unused_result;
+#else
+static inline int fsp_queue_msg(struct fsp_msg *msg __unused,
+ void (*comp)(struct fsp_msg *msg) __unused)
+{ return 0; }
+#endif
/* Synchronously send a command. If there's a response, the status is
* returned as a positive number. A negative result means an error
@@ -712,7 +730,11 @@ extern int fsp_queue_msg(struct fsp_msg
extern int fsp_sync_msg(struct fsp_msg *msg, bool autofree);
/* Handle FSP interrupts */
+#ifdef CONFIG_FSP
extern void fsp_interrupt(void);
+#else
+static inline void fsp_interrupt(void) {}
+#endif
/* An FSP client is interested in messages for a given class */
struct fsp_client {
@@ -737,7 +759,11 @@ extern void fsp_tce_unmap(u32 offset, u3
extern void *fsp_inbound_buf_from_tce(u32 tce_token);
/* Data fetch helper */
+#ifdef CONFIG_FSP
extern uint32_t fsp_adjust_lid_side(uint32_t lid_no);
+#else
+static inline uint32_t fsp_adjust_lid_side(uint32_t lid_no __unused) { return 0; }
+#endif
extern int fsp_fetch_data(uint8_t flags, uint16_t id, uint32_t sub_id,
uint32_t offset, void *buffer, size_t *length);
extern int fsp_fetch_data_queue(uint8_t flags, uint16_t id, uint32_t sub_id,
@@ -746,16 +772,31 @@ extern int fsp_fetch_data_queue(uint8_t
extern int fsp_start_preload_resource(enum resource_id id, uint32_t idx,
void *buf, size_t *size);
extern int fsp_resource_loaded(enum resource_id id, uint32_t idx);
+
+#ifdef CONFIG_FSP
extern int fsp_preload_lid(uint32_t lid_no, char *buf, size_t *size);
extern int fsp_wait_lid_loaded(uint32_t lid_no);
+#else
+static inline int fsp_preload_lid(uint32_t __unused lid_no, char *buf __unused, size_t *size __unused)
+{ return 0; /* OPAL_SUCCESS */ }
+static inline int fsp_wait_lid_loaded(uint32_t __unused lid_no)
+{ return 0; /* OPAL_SUCCESS */ }
+#endif
/* FSP console stuff */
extern void fsp_console_preinit(void);
extern void fsp_console_init(void);
extern void fsp_console_add_nodes(void);
+
+#ifdef CONFIG_FSP
extern void fsp_console_select_stdout(void);
extern void fsp_console_reset(void);
extern void fsp_console_poll(void *);
+#else
+static inline void fsp_console_select_stdout(void) {}
+static inline void fsp_console_reset(void) {}
+static inline void fsp_console_poll(void *foo __unused) {}
+#endif
/* Mark FSP lock */
extern void fsp_used_by_console(void);
@@ -764,8 +805,11 @@ extern void fsp_used_by_console(void);
extern int fsp_nvram_info(uint32_t *total_size);
extern int fsp_nvram_start_read(void *dst, uint32_t src, uint32_t len);
extern int fsp_nvram_write(uint32_t offset, void *src, uint32_t size);
+#ifdef CONFIG_FSP
extern void fsp_nvram_wait_open(void);
-
+#else
+static inline void fsp_nvram_wait_open(void) {}
+#endif
/* RTC */
extern void fsp_rtc_init(void);
@@ -775,7 +819,11 @@ extern void fsp_elog_write_init(void);
/* Code update */
extern void fsp_code_update_init(void);
+#ifdef CONFIG_FSP
extern void fsp_code_update_wait_vpd(bool is_boot);
+#else
+static inline void fsp_code_update_wait_vpd(bool is_boot __unused) {}
+#endif
/* Dump */
extern void fsp_dump_init(void);
@@ -800,8 +848,13 @@ extern void fsp_surv_query(void);
extern void fsp_ipmi_init(void);
/* Reset/Reload */
+#ifdef CONFIG_FSP
extern void fsp_reinit_fsp(void);
extern void fsp_trigger_reset(void);
+#else
+static inline void fsp_reinit_fsp(void) {}
+static inline void fsp_trigger_reset(void) {}
+#endif
extern void fsp_reset_links(void);
/* FSP memory errors */
More information about the Skiboot
mailing list