eltan/security: Remove some preprocessor guards

We generally let garbage-collection take care of unused functions.
While at it, move some related variable declarations in to the
header file and declare them const like they should be.

Change-Id: I7c6fa15bd45f861f13b6123ccb14c55415e42bc7
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/36632
Reviewed-by: Wim Vervoorn <wvervoorn@eltan.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/vendorcode/eltan/security/verified_boot/vboot_check.c b/src/vendorcode/eltan/security/verified_boot/vboot_check.c
index 88519bd..fdae7b8 100644
--- a/src/vendorcode/eltan/security/verified_boot/vboot_check.c
+++ b/src/vendorcode/eltan/security/verified_boot/vboot_check.c
@@ -276,13 +276,11 @@
 		i++;
 	}
 }
-#ifdef __BOOTBLOCK__
+
 /*
  * BOOTBLOCK
  */
 
-extern verify_item_t bootblock_verify_list[];
-
 void verified_boot_bootblock_check(void)
 {
 	printk(BIOS_SPEW, "%s: processing bootblock items\n", __func__);
@@ -296,14 +294,6 @@
 	process_verify_list(bootblock_verify_list);
 }
 
-static void vendor_secure_prepare(void)
-{
-	printk(BIOS_SPEW, "%s: bootblock\n", __func__);
-	verified_boot_bootblock_check();
-}
-#endif //__BOOTBLOCK__
-
-#ifdef __ROMSTAGE__
 /*
  * ROMSTAGE
  */
@@ -330,33 +320,6 @@
 	process_verify_list(romstage_verify_list);
 }
 
-static int prepare_romstage = 0;
-
-static void vendor_secure_prepare(void)
-{
-	printk(BIOS_SPEW, "%s: romstage\n", __func__);
-	if (!prepare_romstage) {
-		verified_boot_early_check();
-		prepare_romstage = 1;
-	}
-}
-#endif //__ROMSTAGE__
-
-#ifdef __POSTCAR__
-/*
- * POSTCAR
- */
-
-extern verify_item_t postcar_verify_list[];
-
-static void vendor_secure_prepare(void)
-{
-	printk(BIOS_SPEW, "%s: postcar\n", __func__);
-	process_verify_list(postcar_verify_list);
-}
-#endif //__POSTCAR__
-
-#ifdef __RAMSTAGE__
 /*
  * RAM STAGE
  */
@@ -408,10 +371,6 @@
 	return 0;
 }
 
-extern verify_item_t payload_verify_list[];
-
-extern verify_item_t oprom_verify_list[];
-
 int verified_boot_should_run_oprom(struct rom_header *rom_header)
 {
 	return process_oprom_list(oprom_verify_list, rom_header);
@@ -419,10 +378,30 @@
 
 static void vendor_secure_prepare(void)
 {
-	printk(BIOS_SPEW, "%s: ramstage\n", __func__);
-	process_verify_list(payload_verify_list);
+	if (ENV_BOOTBLOCK) {
+		printk(BIOS_SPEW, "%s: bootblock\n", __func__);
+		verified_boot_bootblock_check();
+	}
+
+	if (ENV_ROMSTAGE) {
+		static int prepare_romstage = 0;
+		printk(BIOS_SPEW, "%s: romstage\n", __func__);
+		if (!prepare_romstage) {
+			verified_boot_early_check();
+			prepare_romstage = 1;
+		}
+	}
+
+	if (ENV_POSTCAR) {
+		printk(BIOS_SPEW, "%s: postcar\n", __func__);
+		process_verify_list(postcar_verify_list);
+	}
+
+	if (ENV_RAMSTAGE) {
+		printk(BIOS_SPEW, "%s: ramstage\n", __func__);
+		process_verify_list(payload_verify_list);
+	}
 }
-#endif //__RAMSTAGE__
 
 const struct cbfs_locator cbfs_master_header_locator = {
 	.name = "Vendorcode Header Locator",