summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@chromium.org>2011-07-14 18:43:17 +0800
committerSimon Glass <sjg@chromium.org>2011-08-29 10:58:56 -0700
commit089a52dacb068d5564a6947bb4234daf18a53f52 (patch)
tree6148355c847539b18d866e2b0abeddc32e72158d
parent106ae544629c8ced2293e31897f5d5f81562b5ad (diff)
CHROMIUM: reorganize fmap to increase size for R/O u-boot
BUG=chromium-os:17424 TEST=build and boot on tegra2_{seaboard,kaen,dev-board} Change-Id: Idea5a021c0c3888f5cc60c8fd5faf8d875d6267e Reviewed-on: http://gerrit.chromium.org/gerrit/4088 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
-rw-r--r--board/nvidia/seaboard/flashmap-twostop-ro-submap.dtsi65
-rw-r--r--board/nvidia/seaboard/flashmap-twostop-seaboard.dtsi103
-rw-r--r--board/nvidia/seaboard/flashmap-twostop.dtsi99
-rw-r--r--board/nvidia/seaboard/onestop-layout.dtsi45
-rw-r--r--common/cmd_vboot_twostop.c2
-rw-r--r--include/chromeos/fdt_decode.h3
-rw-r--r--lib/chromeos/fdt_decode.c3
7 files changed, 158 insertions, 162 deletions
diff --git a/board/nvidia/seaboard/flashmap-twostop-ro-submap.dtsi b/board/nvidia/seaboard/flashmap-twostop-ro-submap.dtsi
new file mode 100644
index 0000000000..f8c943f16d
--- /dev/null
+++ b/board/nvidia/seaboard/flashmap-twostop-ro-submap.dtsi
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/*
+ * This is a sub-fmap embedded into twostop fmap. This sub-fmap defines
+ * the layout of the R/O portion.
+ *
+ * The R/O blobs only consumes 1 MB space so that it could be possible to
+ * squeeze the final image (R/O + R/W) into 2 MB space. As a result, even if
+ * the target machine has a 4 MB flash chip and enables write-protect for the
+ * first 2 MB space, only the first 1 MB will contain R/O blobs and the rest
+ * 1 MB will be empty.
+ */
+
+/ {
+ flash@0 {
+ readonly@0 {
+ label = "readonly";
+ reg = <0x00000000 0x00100000>;
+ read-only;
+ };
+
+ ro-firmware-image@0 {
+ label = "ro-firmware-image";
+ reg = <0x00000000 0x000bfb00>; /* ~785 KB */
+ read-only;
+ type = "blob signed";
+ };
+ ro-firmware-id@bfb00 {
+ label = "ro-onestop";
+ reg = <0x000bfb00 0x00000100>;
+ read-only;
+ };
+
+ gbb@bfc00 {
+ label = "gbb";
+ reg = <0x000bfc00 0x00020000>;
+ read-only;
+ type = "blob gbb";
+ };
+ ro-data@dfc00 {
+ label = "ro-data";
+ reg = <0x000dfc00 0x00010000>;
+ read-only;
+ };
+ ro-vpd@efc00 {
+ label = "ro-vpd";
+ reg = <0x000efc00 0x00010000>;
+ read-only;
+ type = "wiped";
+ wipe-value = [ff];
+ };
+ fmap@ffc00 {
+ label = "ro-fmap";
+ reg = <0x000ffc00 0x00000400>;
+ read-only;
+ type = "fmap";
+ ver-major = <1>;
+ ver-minor = <0>;
+ };
+ };
+};
diff --git a/board/nvidia/seaboard/flashmap-twostop-seaboard.dtsi b/board/nvidia/seaboard/flashmap-twostop-seaboard.dtsi
index f7e5ab95ae..45c5a8f911 100644
--- a/board/nvidia/seaboard/flashmap-twostop-seaboard.dtsi
+++ b/board/nvidia/seaboard/flashmap-twostop-seaboard.dtsi
@@ -13,6 +13,9 @@
* All sections will be marked static in the fmap.
*/
+/include/ "onestop-layout.dtsi"
+/include/ "flashmap-twostop-ro-submap.dtsi"
+
/ {
flash@0 {
#address-cells = <1>;
@@ -21,100 +24,32 @@
"chromeos,flashmap";
reg = <0x00000000 0x00200000>;
- /* ---- Onestop Blob Layout; not a real section ---- */
- onestop-layout@0 {
- /* size: 512 KB */
- label = "onestop-layout";
- reg = <0x00000000 0x00080000>;
- };
- /* U-Boot image including fdt: first ~503 KB */
- firmware-image@0 {
- label = "firmware-image";
- reg = <0x00000000 0x0007df00>;
- };
- /* verification block: 8 KB */
- verification-block@7df00 {
- label = "verification-block";
- reg = <0x0007df00 0x00002000>;
- };
- /* frimware ID: 256 Bytes */
- firmware-id@7ff00 {
- label = "firmware-id";
- reg = <0x0007ff00 0x00000100>;
- };
-
- /* ---- Section: Read-only ---- */
- readonly@0 {
- label = "readonly";
- reg = <0x00000000 0x00100000>;
- read-only;
- };
- bct@0 { /* Tegra's board config table: 64 KB */
- label = "bct";
- reg = <0x00000000 0x00010000>;
- read-only;
- type = "blob signed";
- };
- /* R/O section's copy of onestop */
- ro-onestop@10000 {
- label = "ro-onestop";
- reg = <0x00010000 0x00080000>;
- read-only;
- type = "blob boot";
- };
- gbb@90000 {
- label = "gbb";
- reg = <0x00090000 0x00020000>;
- read-only;
- type = "blob gbb";
- };
- ro-data@b0000 {
- label = "ro-data";
- reg = <0x000b0000 0x00010000>;
- read-only;
- };
- ro-vpd@c0000 {
- label = "ro-vpd";
- reg = <0x000c0000 0x00010000>;
- read-only;
- type = "wiped";
- wipe-value = [ff];
- };
- fmap@d0000 {
- label = "ro-fmap";
- reg = <0x000d0000 0x00000400>;
- read-only;
- type = "fmap";
- ver-major = <1>;
- ver-minor = <0>;
- };
-
/* ---- Section: Readwrite ---- */
- readwrite@200000 {
+ readwrite@1e4000 {
label = "readwrite";
- reg = <0x00200000 0x00000000>;
+ reg = <0x001e4000 0x00000000>;
};
- rw-vpd@200000 {
+ rw-vpd@1e4000 {
label = "rw-vpd";
- reg = <0x00200000 0x00000000>;
+ reg = <0x001e4000 0x00001000>;
type = "wiped";
wipe-value = [ff];
};
- shared-dev-cfg@200000 {
+ shared-dev-cfg@1e5000 {
label = "shared-dev-cfg";
- reg = <0x00200000 0x00000000>;
+ reg = <0x001e5000 0x00001000>;
type = "wiped";
wipe-value = [00];
};
- shared-data@200000 {
+ shared-data@1e6000 {
label = "shared-data";
- reg = <0x00200000 0x00000000>;
+ reg = <0x001e6000 0x00001000>;
type = "wiped";
wipe-value = [00];
};
- shared-env@200000 {
+ shared-env@1e7000 {
label = "shared-env";
- reg = <0x00200000 0x00000000>;
+ reg = <0x001e7000 0x00019000>;
/*
* We could put the dev environment here, but U-Boot
@@ -129,22 +64,22 @@
/* So far only onestop is put into readwrite A/B section */
readwrite-a@100000 {
label = "readwrite-a";
- reg = <0x00100000 0x00080000>;
+ reg = <0x00100000 0x00072000>;
block-lba = <0x00000022>;
};
rw-a-onestop@100000 {
label = "rw-a-onestop";
- reg = <0x00100000 0x00080000>;
+ reg = <0x00100000 0x00072000>;
type = "blob boot";
};
- readwrite-b@180000 {
+ readwrite-b@172000 {
label = "readwrite-b";
- reg = <0x00180000 0x00080000>;
+ reg = <0x00172000 0x00072000>;
block-lba = <0x00000422>;
};
- rw-b-onestop@180000 {
+ rw-b-onestop@172000 {
label = "rw-b-onestop";
- reg = <0x00180000 0x00080000>;
+ reg = <0x00172000 0x00072000>;
type = "blob boot";
};
};
diff --git a/board/nvidia/seaboard/flashmap-twostop.dtsi b/board/nvidia/seaboard/flashmap-twostop.dtsi
index 234b8b2d3c..ed2b4bab78 100644
--- a/board/nvidia/seaboard/flashmap-twostop.dtsi
+++ b/board/nvidia/seaboard/flashmap-twostop.dtsi
@@ -13,6 +13,25 @@
* All sections will be marked static in the fmap.
*/
+/include/ "onestop-layout.dtsi"
+/include/ "flashmap-twostop-ro-submap.dtsi"
+
+/*
+ * TODO: Although we can squeeze R/O and R/W blobs into 2 MB, we do not do
+ * so because:
+ *
+ * - (A minor reason) Not every 4 MB flash chip can write-protect just the
+ * first 1 MB.
+ *
+ * - (The main reason) We do not know how many tools or scripts implicitly
+ * assume that R/O section consumes the first half 2 MB.
+ *
+ * In the long run, we should find and fix all those tools and scripts that
+ * have incorrect implicit assumption of R/O section, but for now, we just
+ * cannot squeeze the image size down to 2 MB at the risk of wrongly write-
+ * protecting the R/W blobs.
+ */
+
/ {
flash@0 {
#address-cells = <1>;
@@ -21,74 +40,6 @@
"chromeos,flashmap";
reg = <0x00000000 0x00400000>;
- /* ---- Onestop Blob Layout; not a real section ---- */
- onestop-layout@0 {
- /* size: 512 KB */
- label = "onestop-layout";
- reg = <0x00000000 0x00080000>;
- };
- /* U-Boot image including fdt: first ~503 KB */
- firmware-image@0 {
- label = "firmware-image";
- reg = <0x00000000 0x0007df00>;
- };
- /* verification block: 8 KB */
- verification-block@7df00 {
- label = "verification-block";
- reg = <0x0007df00 0x00002000>;
- };
- /* frimware ID: 256 Bytes */
- firmware-id@7ff00 {
- label = "firmware-id";
- reg = <0x0007ff00 0x00000100>;
- };
-
- /* ---- Section: Read-only ---- */
- readonly@0 {
- label = "readonly";
- reg = <0x00000000 0x00100000>;
- read-only;
- };
- bct@0 { /* Tegra's board config table: 64 KB */
- label = "bct";
- reg = <0x00000000 0x00010000>;
- read-only;
- type = "blob signed";
- };
- /* R/O section's copy of onestop */
- ro-onestop@10000 {
- label = "ro-onestop";
- reg = <0x00010000 0x00080000>;
- read-only;
- type = "blob boot";
- };
- gbb@90000 {
- label = "gbb";
- reg = <0x00090000 0x00020000>;
- read-only;
- type = "blob gbb";
- };
- ro-data@b0000 {
- label = "ro-data";
- reg = <0x000b0000 0x00010000>;
- read-only;
- };
- ro-vpd@c0000 {
- label = "ro-vpd";
- reg = <0x000c0000 0x00010000>;
- read-only;
- type = "wiped";
- wipe-value = [ff];
- };
- fmap@d0000 {
- label = "ro-fmap";
- reg = <0x000d0000 0x00000400>;
- read-only;
- type = "fmap";
- ver-major = <1>;
- ver-minor = <0>;
- };
-
/* ---- Section: Readwrite ---- */
readwrite@300000 {
label = "readwrite";
@@ -112,9 +63,9 @@
type = "wiped";
wipe-value = [00];
};
- shared-env@3ff000 {
+ shared-env@3f0000 {
label = "shared-env";
- reg = <0x003ff000 0x00001000>;
+ reg = <0x003f0000 0x00010000>;
/*
* We could put the dev environment here, but U-Boot
@@ -126,7 +77,7 @@
};
/* ---- Section: Readwrite Slot A and B ---- */
- /* So far only onestop is put into readwrite A/B section */
+ /* So far only a onestop blob is put into readwrite A/B slot */
readwrite-a@200000 {
label = "readwrite-a";
reg = <0x00200000 0x00080000>;
@@ -134,8 +85,7 @@
};
rw-a-onestop@200000 {
label = "rw-a-onestop";
- reg = <0x00200000 0x00080000>;
- type = "blob boot";
+ reg = <0x00200000 0x00072000>;
};
readwrite-b@280000 {
label = "readwrite-b";
@@ -144,8 +94,7 @@
};
rw-b-onestop@280000 {
label = "rw-b-onestop";
- reg = <0x00280000 0x00080000>;
- type = "blob boot";
+ reg = <0x00280000 0x00072000>;
};
};
};
diff --git a/board/nvidia/seaboard/onestop-layout.dtsi b/board/nvidia/seaboard/onestop-layout.dtsi
new file mode 100644
index 0000000000..994051ad79
--- /dev/null
+++ b/board/nvidia/seaboard/onestop-layout.dtsi
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/*
+ * This is a flash map (fmap) defines the internal layout of onestop blobs
+ * in R/W slot A and slot B. Given that, the addresses here are interpreted
+ * as relative offset from its enclosing onestop blob.
+ *
+ * The onestop layout is made smaller than 512 KB so that two onestop blobs
+ * together are smaller than 1 MB and it is possible to squeeze the entire
+ * R/W section into 1 MB (the R/W section includes two onestop blobs and
+ * read-write data blobs).
+ */
+
+/ {
+ flash@0 {
+ /* total size of onestop blob: ~468 KB */
+ onestop-layout {
+ label = "onestop-layout";
+ reg = <0x00000000 0x00072000>;
+ type = "blob boot";
+ };
+
+ /* U-Boot image including fdt: ~460 KB */
+ firmware-image {
+ label = "firmware-image";
+ reg = <0x00000000 0x00070000>;
+ };
+
+ /* verification block: ~8 KB */
+ verification-block {
+ label = "verification-block";
+ reg = <0x00070000 0x00001f00>;
+ };
+
+ /* frimware ID: 256 Bytes */
+ firmware-id {
+ label = "firmware-id";
+ reg = <0x00071f00 0x00000100>;
+ };
+ };
+};
diff --git a/common/cmd_vboot_twostop.c b/common/cmd_vboot_twostop.c
index 2430a405d4..9b461c89ec 100644
--- a/common/cmd_vboot_twostop.c
+++ b/common/cmd_vboot_twostop.c
@@ -117,7 +117,7 @@ int twostop_read_firmware_id(twostop_t *tdata,
switch (tdata->whoami) {
case I_AM_RO_FW:
- firmware_id_offset += fmap->readonly.ro_onestop.offset;
+ firmware_id_offset = fmap->readonly.ro_firmware_id.offset;
break;
case I_AM_RW_A_FW:
firmware_id_offset += fmap->readwrite_a.rw_a_onestop.offset;
diff --git a/include/chromeos/fdt_decode.h b/include/chromeos/fdt_decode.h
index 772716773c..2073ee6238 100644
--- a/include/chromeos/fdt_decode.h
+++ b/include/chromeos/fdt_decode.h
@@ -32,7 +32,8 @@ struct fdt_twostop_fmap {
struct {
struct fdt_fmap_entry readonly;
- struct fdt_fmap_entry ro_onestop;
+ struct fdt_fmap_entry ro_firmware_image;
+ struct fdt_fmap_entry ro_firmware_id;
struct fdt_fmap_entry fmap;
struct fdt_fmap_entry gbb;
} readonly;
diff --git a/lib/chromeos/fdt_decode.c b/lib/chromeos/fdt_decode.c
index 438b8c5589..a85dc37d65 100644
--- a/lib/chromeos/fdt_decode.c
+++ b/lib/chromeos/fdt_decode.c
@@ -83,7 +83,8 @@ static int fdt_decode_block_lba(const void *fdt, int offset, const char *path,
ACT_ON_ENTRY("/verification-block", onestop_layout.vblock); \
ACT_ON_ENTRY("/firmware-id", onestop_layout.fwid); \
ACT_ON_ENTRY("/readonly", readonly.readonly); \
- ACT_ON_ENTRY("/ro-onestop", readonly.ro_onestop); \
+ ACT_ON_ENTRY("/ro-firmware-image", readonly.ro_firmware_image); \
+ ACT_ON_ENTRY("/ro-firmware-id", readonly.ro_firmware_id); \
ACT_ON_ENTRY("/fmap", readonly.fmap); \
ACT_ON_ENTRY("/gbb", readonly.gbb); \
ACT_ON_ENTRY("/readwrite-a", readwrite_a.readwrite_a); \