summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2019-01-28 17:22:22 +0800
committerPatrick Georgi <pgeorgi@google.com>2019-01-30 11:04:49 +0000
commit05532260aee0302e43a4935a402c7b9268036267 (patch)
treef8d94e47280d41f0cc1b612975c0754dc625c056 /src/include
parentab92f26a13f4656821f9dff93f180cb1a33c1c3e (diff)
selfload: check target memory type in selfload_check
Currently, selflock_check() verifies that the binary is loaded in an usable RAM area. Extend its functionality so we can also check that BL31 is loaded in a manually reserved area, and fail early if the range is not protected. Change-Id: Iecdeedd9e8da67f73ac47d2a82e85b306469a626 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://review.coreboot.org/c/31122 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/bootmem.h7
-rw-r--r--src/include/program_loading.h3
2 files changed, 7 insertions, 3 deletions
diff --git a/src/include/bootmem.h b/src/include/bootmem.h
index 0a960c992a..4652d08f20 100644
--- a/src/include/bootmem.h
+++ b/src/include/bootmem.h
@@ -94,8 +94,11 @@ bool bootmem_walk_os_mem(range_action_t action, void *arg);
*/
bool bootmem_walk(range_action_t action, void *arg);
-/* Return 1 if region targets usable RAM, 0 otherwise. */
-int bootmem_region_targets_usable_ram(uint64_t start, uint64_t size);
+/* Returns 1 if the requested memory range is all tagged as type dest_type.
+ * Otherwise returns 0.
+ */
+int bootmem_region_targets_type(uint64_t start, uint64_t size,
+ enum bootmem_type dest_type);
/* Allocate a temporary buffer from the unused RAM areas. */
void *bootmem_allocate_buffer(size_t size);
diff --git a/src/include/program_loading.h b/src/include/program_loading.h
index 468f0b35a6..7be59e2878 100644
--- a/src/include/program_loading.h
+++ b/src/include/program_loading.h
@@ -16,6 +16,7 @@
#ifndef PROGRAM_LOADING_H
#define PROGRAM_LOADING_H
+#include <bootmem.h>
#include <commonlib/region.h>
#include <stdint.h>
#include <stddef.h>
@@ -206,7 +207,7 @@ void mirror_payload(struct prog *payload);
*
* Defined in src/lib/selfboot.c
*/
-bool selfload_check(struct prog *payload);
+bool selfload_check(struct prog *payload, enum bootmem_type dest_type);
bool selfload(struct prog *payload);
#endif /* PROGRAM_LOADING_H */