summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2014-11-15 03:02:29 +0000
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-15 05:59:54 +0000
commit79a9e0e63fd1001a3f9615f96c09acba5f20250d (patch)
treed3743c717ea7f193e4069d91a3a0f18c0426e4db /firmware
parent5040a945dfd0dd305d3ca8e923b8bf0bd5c6528e (diff)
downloadvboot-79a9e0e63fd1001a3f9615f96c09acba5f20250d.tar.gz
Revert "vboot: Plumb the two disk sizes and 'gpt on device' param through"stabilize-6480.Bfactory-ryu-6486.Bfactory-ryu-6486.1.B
This reverts commit 5040a945dfd0dd305d3ca8e923b8bf0bd5c6528e. This patch breaks booting any image (both fixed and removable) on Veyron_Pinky (and presumably every other non-NAND board?). By the power vested in me through the office of ChromeOS tree sheriff (well, five hours early but whatever) it is hereby reverted! BUG=chromium:425677 BRANCH=none TEST=Can successfully boot on Veyron_Pinky again. Change-Id: I9323a3d5e34491337fc7eb09dd00d845ac42997d Reviewed-on: https://chromium-review.googlesource.com/229963 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org> Tested-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r--firmware/include/vboot_api.h42
-rw-r--r--firmware/lib/include/load_kernel_fw.h4
-rw-r--r--firmware/lib/vboot_api_kernel.c6
-rw-r--r--firmware/lib/vboot_kernel.c6
4 files changed, 15 insertions, 43 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index 853a34ad..526c1e4a 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -553,35 +553,14 @@ VbError_t VbExHashFirmwareBody(VbCommonParams *cparams,
* when processing read-only recovery image.
*/
-/*
- * Disks are used in two ways:
- * - As a random-access device to read and write the GPT
- * - As a streaming device to read the kernel
- * These are implemented differently on raw NAND vs eMMC/SATA/USB
- * - On eMMC/SATA/USB, both of these refer to the same underlying
- * storage, so they have the same size and LBA size. In this case,
- * the GPT should not point to the same address as itself.
- * - On raw NAND, the GPT is held on a portion of the SPI flash.
- * Random access GPT operations refer to the SPI and streaming
- * operations refer to NAND. The GPT may therefore point into
- * the same offsets as itself.
- * These types are distinguished by the following flag and VbDiskInfo
- * has separate fields to describe the random-access ("GPT") and
- * 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
-
/* Information on a single disk */
typedef struct VbDiskInfo {
/* Disk handle */
VbExDiskHandle_t handle;
- /* Size of a random-access LBA sector in bytes */
+ /* Size of a LBA sector in bytes */
uint64_t bytes_per_lba;
- /* Number of random-access LBA sectors on the device */
+ /* Number of LBA sectors on the device */
uint64_t lba_count;
- /* Number of streaming sectors on the device */
- uint64_t streaming_lba_count;
/* Flags (see VB_DISK_FLAG_* constants) */
uint32_t flags;
/*
@@ -623,9 +602,6 @@ VbError_t VbExDiskFreeInfo(VbDiskInfo *infos,
* Read lba_count LBA sectors, starting at sector lba_start, from the disk,
* into the buffer.
*
- * This is used for random access to the GPT. It does not (necessarily) access
- * the streaming portion of the device.
- *
* If the disk handle is invalid (for example, the handle refers to a disk
* which as been removed), the function must return error but must not
* crash.
@@ -637,9 +613,6 @@ VbError_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start,
* Write lba_count LBA sectors, starting at sector lba_start, to the disk, from
* the buffer.
*
- * This is used for random access to the GPT. It does not (necessarily) access
- * the streaming portion of the device.
- *
* If the disk handle is invalid (for example, the handle refers to a disk
* which as been removed), the function must return error but must not
* crash.
@@ -660,9 +633,10 @@ typedef void *VbExStream_t;
*
* @return Error code, or VBERROR_SUCCESS.
*
- * This is used for access to the streaming portion of the device, and does
- * not (necessarily) access the GPT. The size of the content addressed is within
- * streaming_lba_count.
+ * lba_start and lba_count are subject to disk type-dependent alignment
+ * restrictions. An invalid value will lead to an error code. In particular,
+ * on raw NAND devices, lba_start and lba_count must be page-aligned after
+ * subtracting the offset of the GPT.
*/
VbError_t VbExStreamOpen(VbExDiskHandle_t handle, uint64_t lba_start,
uint64_t lba_count, VbExStream_t *stream_ptr);
@@ -676,6 +650,10 @@ VbError_t VbExStreamOpen(VbExDiskHandle_t handle, uint64_t lba_start,
*
* @return Error code, or VBERROR_SUCCESS. Failure to read as much data as
* requested is an error.
+ *
+ * bytes is subject to disk type-dependent alignment restrictions. An invalid
+ * value will lead to an error code. In particular, on raw NAND devices, bytes
+ * must be a page multiple.
*/
VbError_t VbExStreamRead(VbExStream_t stream, uint32_t bytes, void *buffer);
diff --git a/firmware/lib/include/load_kernel_fw.h b/firmware/lib/include/load_kernel_fw.h
index bd816d65..a710ee5d 100644
--- a/firmware/lib/include/load_kernel_fw.h
+++ b/firmware/lib/include/load_kernel_fw.h
@@ -42,10 +42,6 @@ typedef struct LoadKernelParams {
uint64_t bytes_per_lba;
/* Last addressable lba sector on current device */
uint64_t ending_lba;
- /* Random-access GPT size */
- uint64_t gpt_lba_count;
- /* External GPT */
- uint8_t external_gpt; /* 1 = external, 0 = internal */
/* Destination buffer for kernel (normally at 0x100000) */
void *kernel_buffer;
/* Size of kernel buffer in bytes */
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index 942dbcc2..0609b55b 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -88,7 +88,7 @@ uint32_t VbTryLoadKernel(VbCommonParams *cparams, LoadKernelParams *p,
*/
if (512 != disk_info[i].bytes_per_lba ||
32 > disk_info[i].lba_count ||
- get_info_flags != (disk_info[i].flags & ~VB_DISK_FLAG_EXTERNAL_GPT)) {
+ get_info_flags != disk_info[i].flags) {
VBDEBUG((" skipping: bytes_per_lba=%" PRIu64
" lba_count=%" PRIu64 " flags=0x%x\n",
disk_info[i].bytes_per_lba,
@@ -98,9 +98,7 @@ uint32_t VbTryLoadKernel(VbCommonParams *cparams, LoadKernelParams *p,
}
p->disk_handle = disk_info[i].handle;
p->bytes_per_lba = disk_info[i].bytes_per_lba;
- p->ending_lba = disk_info[i].streaming_lba_count - 1;
- p->gpt_lba_count = disk_info[i].lba_count;
- p->external_gpt = disk_info[i].flags & VB_DISK_FLAG_EXTERNAL_GPT;
+ p->ending_lba = disk_info[i].lba_count - 1;
retval = LoadKernel(p, cparams);
VBDEBUG(("VbTryLoadKernel() LoadKernel() = %d\n", retval));
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index 740e1f23..62e62967 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -116,9 +116,9 @@ VbError_t LoadKernel(LoadKernelParams *params, VbCommonParams *cparams)
/* Read GPT data */
gpt.sector_bytes = (uint32_t)blba;
gpt.drive_sectors = params->ending_lba + 1;
- gpt.gpt_drive_sectors = params->gpt_lba_count;
- gpt.stored_on_device = params->external_gpt ? GPT_STORED_OFF_DEVICE
- : GPT_STORED_ON_DEVICE;
+ /* TODO: Set stored_on_device and gpt_drive_sectors appropriately */
+ gpt.stored_on_device = GPT_STORED_ON_DEVICE;
+ gpt.gpt_drive_sectors = gpt.drive_sectors;
if (0 != AllocAndReadGptData(params->disk_handle, &gpt)) {
VBDEBUG(("Unable to read GPT data\n"));
shcall->check_result = VBSD_LKC_CHECK_GPT_READ_ERROR;