From b2a5f4833d022d16c934f7dad30cdfa8fb28863c Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Wed, 14 Dec 2016 14:40:43 -0600 Subject: lib/cbmem: allow anyone to use cbmem_possibly_online() The cbmem_possibly_online() is a helpful construct. Therefore, push it into cbmem.h so other users can take advantage of it. BUG=chrome-os-partner:60592 BRANCH=reef Change-Id: If5a1c7815ed03874dcf141014b8ffefb82b7cc92 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/17868 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh Reviewed-by: Paul Menzel --- src/include/cbmem.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/include') diff --git a/src/include/cbmem.h b/src/include/cbmem.h index 5c4b7c7189..c13fe925ad 100644 --- a/src/include/cbmem.h +++ b/src/include/cbmem.h @@ -158,4 +158,20 @@ void set_top_of_ram(uint64_t ramtop); void backup_top_of_ram(uint64_t ramtop); #endif +/* + * Returns 0 for the stages where we know that cbmem does not come online. + * Even if this function returns 1 for romstage, depending upon the point in + * bootup, cbmem might not actually be online. + */ +static inline int cbmem_possibly_online(void) +{ + if (ENV_BOOTBLOCK) + return 0; + + if (ENV_VERSTAGE && IS_ENABLED(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK)) + return 0; + + return 1; +} + #endif /* _CBMEM_H_ */ -- cgit v1.2.3