diff options
author | Ronald G. Minnich <rminnich@gmail.com> | 2018-05-12 06:42:01 -0700 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2018-05-14 02:54:21 +0000 |
commit | f3d99b6a657fe2bc3cff71956ab4f68fd1f287fe (patch) | |
tree | ae9349bf765f4e26c137e272b0430499021b5172 /src | |
parent | c97b5af898d21dbc089d336ccd863ccfd6bd965a (diff) | |
download | coreboot-f3d99b6a657fe2bc3cff71956ab4f68fd1f287fe.tar.xz |
program_loading: make types a mask, make unknown type a non-zero
This will allow loading of programs that are more than one type,
e.g. ramstage type might now be a stage or payload.
Further, unknown types of 0 are dangerous, make it a real value.
Change-Id: Ieb4eeb7c5934bddd9046ece8326342db0d76363c
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-on: https://review.coreboot.org/26242
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/program_loading.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/include/program_loading.h b/src/include/program_loading.h index 416e2e9418..7aba30214c 100644 --- a/src/include/program_loading.h +++ b/src/include/program_loading.h @@ -26,15 +26,22 @@ enum { SEG_FINAL = 1 << 0, }; +// The prog_type is a bit mask, so that in searches one can find, e.g., +// a file with a given name that is either a payload or a ramstage. +// The PROG_UNKNOWN should not have any bits set that match a valid +// type, and for the sake of sanity, let's keep the high order bit out of it. +// The current value allows for 16 file types. This is a change from before, +// where we could have 2^32-1 different types. On a guess, it seems 16 should +// be enough. We started with 3 and are up to 6 twelve years later. enum prog_type { - PROG_UNKNOWN, - PROG_VERSTAGE, - PROG_ROMSTAGE, - PROG_RAMSTAGE, - PROG_REFCODE, - PROG_PAYLOAD, - PROG_BL31, - PROG_BL32, + PROG_UNKNOWN = 0x7bba0000, + PROG_VERSTAGE = 1 << 0, + PROG_ROMSTAGE = 1 << 1, + PROG_RAMSTAGE = 1 << 2, + PROG_REFCODE = 1 << 3, + PROG_PAYLOAD = 1 << 4, + PROG_BL31 = 1 << 5, + PROG_BL32 = 1 << 6, }; /* |