vboot/vboot_kernel: break disk check out to separate function

Move disk validity check to static function is_valid_disk().

If multiple disk types are selected (e.g. REMOVABLE | FIXED),
is_valid_disk() will now check that exactly *one* of those flags
is selected by VbDiskInfo.flags.

Also, split disk flags into two 16-bit sections:
 - Disk selection in the lower 16 bits (where the disk lives)
 - Disk attributes in the higher 16 bits (extra information about
   the disk needed to access it correctly)

This CL is part of a series to merge vboot1 and vboot2.0
kernel verification code; see b/181739551.

BUG=b:181739551
TEST=make clean && make runtests
BRANCH=none

Signed-off-by: Joel Kitching <kitching@google.com>
Change-Id: Icf76ab6e92cca40810071def66aed13cdb3a7ec7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2872251
Commit-Queue: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
8 files changed