From 29ee9c6d48910c8ce327ac1ccee18eaca9036eb1 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Fri, 20 Sep 2013 14:00:45 -0700 Subject: Support compiling with chipset task disabled For bringup, we need to be able to compile a binary with the chipset task disabled. Chipset functions should be stubbed to do nothing in that case. BUG=chrome-os-partner:22820 BRANCH=none TEST=compile falco, pit, link with chipset task commented out in ec.tasklist Change-Id: I73a4e09effb049f19b1a128e643b267d6469037b Signed-off-by: Randall Spangler Reviewed-on: https://chromium-review.googlesource.com/170221 --- board/mccroskey/board.c | 5 ----- include/chipset.h | 29 +++++++++++++++++++---------- include/chipset_haswell.h | 4 ++++ include/chipset_ivybridge.h | 4 ++++ include/chipset_x86_common.h | 4 ++++ 5 files changed, 31 insertions(+), 15 deletions(-) diff --git a/board/mccroskey/board.c b/board/mccroskey/board.c index ca38624331..4665565033 100644 --- a/board/mccroskey/board.c +++ b/board/mccroskey/board.c @@ -164,11 +164,6 @@ void board_i2c_post_init(int port) } } -void chipset_reset(int is_cold) -{ - /* FIXME: this is just a stub for now... */ -} - void kbd_power_on(enum gpio_signal signal) { /* FIXME: this is just a stub for now... */ diff --git a/include/chipset.h b/include/chipset.h index 932f1aec3e..ddf4eb3db0 100644 --- a/include/chipset.h +++ b/include/chipset.h @@ -35,6 +35,7 @@ enum chipset_state_mask { }; #ifdef HAS_TASK_CHIPSET + /** * Check if chipset is in a given state. * @@ -44,14 +45,7 @@ enum chipset_state_mask { * mask. */ int chipset_in_state(int state_mask); -#else -static inline int chipset_in_state(int state_mask) -{ - return 0; -} -#endif -#ifdef HAS_TASK_CHIPSET /** * Ask the chipset to exit the hard off state. * @@ -59,9 +53,6 @@ static inline int chipset_in_state(int state_mask) * state to begin with. */ void chipset_exit_hard_off(void); -#else -static inline void chipset_exit_hard_off(void) { } -#endif /* This is a private chipset-specific implementation for use only by * throttle_ap() . Don't call this directly! @@ -84,4 +75,22 @@ void chipset_force_shutdown(void); */ void chipset_reset(int cold_reset); +#else /* !HAS_TASK_CHIPSET */ +/* + * Allow other modules to compile if the chipset module is disabled. This is + * commonly done during early stages of board bringup. + */ + +static inline int chipset_in_state(int state_mask) +{ + return 0; +} + +static inline void chipset_exit_hard_off(void) { } +static inline void chipset_throttle_cpu(int throttle) { } +static inline void chipset_force_shutdown(void) { } +static inline void chipset_reset(int cold_reset) { } + +#endif /* !HAS_TASK_CHIPSET */ + #endif /* __CROS_EC_CHIPSET_H */ diff --git a/include/chipset_haswell.h b/include/chipset_haswell.h index ef61922008..5a4eaf9dc6 100644 --- a/include/chipset_haswell.h +++ b/include/chipset_haswell.h @@ -11,6 +11,10 @@ /** * Interrupt handler for Haswell-specific GPIOs. */ +#ifdef CONFIG_CHIPSET_HASWELL void haswell_interrupt(enum gpio_signal signal); +#else +#define haswell_interrupt NULL +#endif #endif diff --git a/include/chipset_ivybridge.h b/include/chipset_ivybridge.h index d88566948c..af752a9f97 100644 --- a/include/chipset_ivybridge.h +++ b/include/chipset_ivybridge.h @@ -11,6 +11,10 @@ /** * Interrupt handler for Ivy Bridge-specific GPIOs. */ +#ifdef CONFIG_CHIPSET_IVYBRIDGE void ivybridge_interrupt(enum gpio_signal signal); +#else +#define ivybridge_interrupt NULL +#endif #endif diff --git a/include/chipset_x86_common.h b/include/chipset_x86_common.h index a23b11661f..21576f1899 100644 --- a/include/chipset_x86_common.h +++ b/include/chipset_x86_common.h @@ -89,6 +89,10 @@ enum x86_state x86_handle_state(enum x86_state state); /** * Interrupt handler for x86 chipset GPIOs. */ +#ifdef CONFIG_CHIPSET_X86 void x86_interrupt(enum gpio_signal signal); +#else +#define x86_interrupt NULL +#endif #endif /* __CROS_EC_CHIPSET_X86_COMMON_H */ -- cgit v1.2.1