summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2011-10-06 13:19:18 +0800
committerHung-Te Lin <hungte@chromium.org>2011-10-10 19:32:44 -0700
commitbb5a9925f5bc1055ad3f9cd4f3af83919e8dd6df (patch)
tree37962ed1c3e7459fb0615188f77c00eb9d80f731 /lib
parent2ef04ec040ea3a7a1036451ece74a9c5d1391d0b (diff)
CHROMIUM: add scsi_write to SCSI driver.
Verified boot requires writing to GPT attributes (success / tries), so we need to implement *_write. "scsi write" command is also added to console for testing. BUG=chrome-os-partner:6258 TEST=(1) Modified GPT to trigger VBOOT updating GPT, and verified GPT changed successfully (by firmware) after reboot (2) ext2load usb 1:1 10000000 /part2.bin # load kernel partition dump scsi write 10000000 5000 5000 # write into kernel partition in #2 Change-Id: I8027b6075cdabf8df81ea1ba620ca0dcd3d33232 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/8841 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/vbexport/boot_device.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/vbexport/boot_device.c b/lib/vbexport/boot_device.c
index 5392c73e43..8b842e1a0a 100644
--- a/lib/vbexport/boot_device.c
+++ b/lib/vbexport/boot_device.c
@@ -182,6 +182,11 @@ VbError_t VbExDiskWrite(VbExDiskHandle_t handle, uint64_t lba_start,
if (lba_start >= dev->lba || lba_start + lba_count > dev->lba)
return VBERROR_DISK_OUT_OF_RANGE;
+ if (!dev->block_write) {
+ VBDEBUG(PREFIX "interface (%d) does not support writing.\n",
+ (int)dev->if_type);
+ return VBERROR_DISK_WRITE_ERROR;
+ }
if (dev->block_write(dev->dev, lba_start, lba_count, buffer)
!= lba_count)
return VBERROR_DISK_WRITE_ERROR;