CBMEM: Change declarations for initialization hooks

There are efforts to have bootflows that do not follow a traditional
bootblock-romstage-postcar-ramstage model. As part of that CBMEM
initialisation hooks will need to move from romstage to bootblock.

The interface towards platforms and drivers will change to use one of
CBMEM_CREATION_HOOK() or CBMEM_READY_HOOK(). Former will only be called
in the first stage with CBMEM available.

Change-Id: Ie24bf4e818ca69f539196c3a814f3c52d4103d7e
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63375
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
diff --git a/src/lib/imd_cbmem.c b/src/lib/imd_cbmem.c
index 453b0c1..a855cf1 100644
--- a/src/lib/imd_cbmem.c
+++ b/src/lib/imd_cbmem.c
@@ -17,7 +17,7 @@
 
 void *cbmem_top(void)
 {
-	if (ENV_ROMSTAGE) {
+	if (ENV_CREATES_CBMEM) {
 		static void *top;
 		if (top)
 			return top;
@@ -49,9 +49,8 @@
 
 static void cbmem_top_init_once(void)
 {
-	/* Call one-time hook on expected cbmem init during boot. This sequence
-	   assumes first init call is in romstage. */
-	if (!ENV_ROMSTAGE)
+	/* Call one-time hook on expected cbmem init during boot. */
+	if (!ENV_CREATES_CBMEM)
 		return;
 
 	/* The test is only effective on X86 and when address hits UC memory. */
@@ -106,7 +105,7 @@
 	 * if the imd area was recovered in romstage then S3 resume path
 	 * is being taken.
 	 */
-	if (ENV_ROMSTAGE)
+	if (ENV_CREATES_CBMEM)
 		imd_lockdown(&imd);
 
 	/* Add the specified range first */
@@ -206,8 +205,7 @@
 	imd_region_used(&imd, baseptr, size);
 }
 
-#if ENV_PAYLOAD_LOADER || (CONFIG(EARLY_CBMEM_LIST) \
-	&& (ENV_POSTCAR || ENV_ROMSTAGE))
+#if ENV_PAYLOAD_LOADER || (CONFIG(EARLY_CBMEM_LIST) && ENV_HAS_CBMEM)
 /*
  * -fdata-sections doesn't work so well on read only strings. They all
  * get put in the same section even though those strings may never be