diff options
author | Joel Kitching <kitching@google.com> | 2021-04-29 12:02:16 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-15 19:35:56 +0000 |
commit | 4e982f1c39da417100e4021fb1c2c370da5f8dd6 (patch) | |
tree | 658c9539ddd1841087da6d742e4c2d999cb3e6e1 /firmware/include/vboot_api.h | |
parent | da50d8587ae24b1a5e7528dde1ead5523e78f6b2 (diff) | |
download | vboot-4e982f1c39da417100e4021fb1c2c370da5f8dd6.tar.gz |
vboot/vboot_kernel: break disk check out to separate functionstabilize-14031.B
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>
Diffstat (limited to 'firmware/include/vboot_api.h')
-rw-r--r-- | firmware/include/vboot_api.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h index 98cbd9bc..2b1d838b 100644 --- a/firmware/include/vboot_api.h +++ b/firmware/include/vboot_api.h @@ -81,13 +81,22 @@ vb2_error_t VbSelectAndLoadKernel(struct vb2_context *ctx, /* Disk access (previously in boot_device.h) */ /* Flags for VbDisk APIs */ + +/* + * Disk selection in the lower 16 bits (where the disk lives), and disk + * attributes in the higher 16 bits (extra information about the disk + * needed to access it correctly). + */ +#define VB_DISK_FLAG_SELECT_MASK 0xffff +#define VB_DISK_FLAG_ATTRIBUTE_MASK (0xffff << 16) + /* Disk is removable. Example removable disks: SD cards, USB keys. */ -#define VB_DISK_FLAG_REMOVABLE 0x00000001 +#define VB_DISK_FLAG_REMOVABLE (1 << 0) /* * Disk is fixed. If this flag is present, disk is internal to the system and * not removable. Example fixed disks: internal SATA SSD, eMMC. */ -#define VB_DISK_FLAG_FIXED 0x00000002 +#define VB_DISK_FLAG_FIXED (1 << 1) /* * Note that VB_DISK_FLAG_REMOVABLE and VB_DISK_FLAG_FIXED are * mutually-exclusive for a single disk. VbExDiskGetInfo() may specify both @@ -123,7 +132,7 @@ vb2_error_t VbSelectAndLoadKernel(struct vb2_context *ctx, * streaming aspects of the disk. If a disk is random-access (i.e. * not raw NAND) then these fields are equal. */ -#define VB_DISK_FLAG_EXTERNAL_GPT 0x00000004 +#define VB_DISK_FLAG_EXTERNAL_GPT (1 << 16) /* Information on a single disk */ typedef struct VbDiskInfo { |