Remove firmware B

BUG=chrome-os-partner:11449
TEST=build link, snow, bds; ectool reboot_ec cold to make sure enums line up

Change-Id: Ie09db2080a00f1a7e2c05579b9b41ea5137c1af0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27658
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
Randall Spangler
2012-07-17 09:58:17 -07:00
committed by Gerrit
parent c44c17890c
commit fc7b64e186
15 changed files with 22 additions and 171 deletions

View File

@@ -1,5 +1,5 @@
# -*- makefile -*-
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Copyright (c) 2012 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.
#
@@ -48,20 +48,15 @@ cmd_sign = vbutil_ec --sign $@ \
--signpubkey $(VBOOT_DEVKEYS)/ec_root_key.vbpubk \
$(silent)
cmd_mv = mv $^ $@
cmd_extractab-y = cd $(out) && \
cmd_extractrw-y = cd $(out) && \
dump_fmap -x $(PROJECT).bin.tmp RW_SECTION_A $(silent) && \
mv RW_SECTION_A $(PROJECT).RW.bin
cmd_extractab-$(CONFIG_RW_B) += && \
dump_fmap -x $(PROJECT).bin.tmp RW_SECTION_B $(silent) && \
mv RW_SECTION_B $(PROJECT).RW_B.bin
cmd_copyab-y = cd $(out) && cp $(PROJECT).RW.flat $(PROJECT).RW.bin
cmd_copyab-$(CONFIG_RW_B) += && cp $(PROJECT).RW_B.flat $(PROJECT).RW_B.bin
cmd_copyrw-y = cd $(out) && cp $(PROJECT).RW.flat $(PROJECT).RW.bin
.PHONY: all tests utils
all: $(out)/$(PROJECT).bin utils
dis-y = $(out)/$(PROJECT).RO.dis $(out)/$(PROJECT).RW.dis
dis-$(CONFIG_RW_B) += $(out)/$(PROJECT).RW_B.dis
dis: $(dis-y)
utils: $(build-utils) $(host-utils)
@@ -93,11 +88,10 @@ $(out)/%.bin: $(out)/%.bin.tmp
$(out)/%.bin.tmp: $(out)/%.obj
$(call quiet,obj_to_bin,OBJCOPY)
$(if $(sign-y),$(call quiet,sign,SIGN ),)
$(if $(sign-y),$(call quiet,extractab-y,EXTR_AB), \
$(call quiet,copyab-y,COPY_AB))
$(if $(sign-y),$(call quiet,extractrw-y,EXTR_RW), \
$(call quiet,copyrw-y,COPY_RW))
flat-y = $(out)/$(PROJECT).RO.flat $(out)/$(PROJECT).RW.flat
flat-$(CONFIG_RW_B) += $(out)/$(PROJECT).RW_B.flat
$(out)/%.obj: common/firmware_image.S $(out)/firmware_image.lds $(flat-y)
$(call quiet,flat_to_obj,CAT )

View File

@@ -15,7 +15,6 @@
/* Optional features */
#define CONFIG_CONSOLE_CMDHELP
#define CONFIG_RW_B /* RW firmware A *and* B */
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands */
#define CONFIG_VBOOT
#define CONFIG_VBOOT_SIG

View File

@@ -46,7 +46,7 @@
#define CONFIG_SECTION_ROLLBACK_OFF (CONFIG_FLASH_SIZE \
- CONFIG_FLASH_ROLLBACK_SIZE)
/* Then there are the three major sections. */
/* Then there are the two major sections. */
#define CONFIG_SECTION_RO_SIZE (40 * CONFIG_FLASH_BANK_SIZE)
#define CONFIG_SECTION_RO_OFF CONFIG_FLASH_BASE
@@ -54,10 +54,6 @@
#define CONFIG_SECTION_RW_OFF (CONFIG_SECTION_RO_OFF \
+ CONFIG_SECTION_RO_SIZE)
#define CONFIG_SECTION_RW_B_SIZE (40 * CONFIG_FLASH_BANK_SIZE)
#define CONFIG_SECTION_RW_B_OFF (CONFIG_SECTION_RW_OFF \
+ CONFIG_SECTION_RW_SIZE)
/* The top of each section will hold the vboot stuff, since the firmware vector
* table has to go at the start. The root key will fit in 2K, but the vblocks
* need 4K. */
@@ -76,15 +72,6 @@
- CONFIG_VBLOCK_SIZE)
#define CONFIG_VBLOCK_RW_OFF (CONFIG_FW_RW_OFF + CONFIG_FW_RW_SIZE)
/* B: firmware, vblock */
#define CONFIG_FW_RW_B_SIZE (CONFIG_SECTION_RW_B_SIZE \
- CONFIG_VBLOCK_SIZE)
#define CONFIG_FW_RW_B_OFF (CONFIG_SECTION_RW_OFF \
+ CONFIG_SECTION_RW_SIZE)
#define CONFIG_VBLOCK_RW_B_OFF (CONFIG_FW_RW_B_OFF \
+ CONFIG_FW_RW_B_SIZE)
/****************************************************************************/
/* Customize the build */

View File

@@ -27,10 +27,6 @@ proc flash_link_rw { } {
flash_lm4 ../../../build/link/ec.RW.bin 81920 81920
}
proc flash_link_rw_b { } {
flash_lm4 ../../../build/link/ec.RW_B.bin 163840 81920
}
proc flash_bds { } {
flash_lm4 ../../../build/bds/ec.bin 0 262144
}

View File

@@ -17,24 +17,15 @@
#define CONFIG_FW_RO_SIZE CONFIG_FW_IMAGE_SIZE
#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
#define CONFIG_FW_RW_B_OFF (2 * CONFIG_FW_IMAGE_SIZE)
#define CONFIG_FW_RW_B_SIZE CONFIG_FW_IMAGE_SIZE
#define CONFIG_SECTION_RO_OFF CONFIG_FW_RO_OFF
#define CONFIG_SECTION_RO_SIZE CONFIG_FW_RO_SIZE
#define CONFIG_SECTION_RW_OFF CONFIG_FW_RW_OFF
#define CONFIG_SECTION_RW_SIZE CONFIG_FW_RW_SIZE
#define CONFIG_SECTION_RW_B_OFF CONFIG_FW_RW_B_OFF
#ifdef CONFIG_RW_B
#define CONFIG_SECTION_RW_B_SIZE CONFIG_FW_RW_B_SIZE
#else /* CONFIG_RW_B */
#define CONFIG_SECTION_RW_B_SIZE 0
#endif /* CONFIG_RW_B */
/* no keys for now */
#define CONFIG_VBOOT_ROOTKEY_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE)
#define CONFIG_VBLOCK_RW_OFF (CONFIG_FW_RW_OFF + CONFIG_FW_RW_SIZE)
#define CONFIG_VBLOCK_RW_B_OFF (CONFIG_FW_RW_B_OFF + CONFIG_FW_RW_B_SIZE)
#define CONFIG_VBOOT_ROOTKEY_SIZE 0
#define CONFIG_VBLOCK_SIZE 0

View File

@@ -17,20 +17,15 @@
#define CONFIG_FW_RO_SIZE CONFIG_FW_IMAGE_SIZE
#define CONFIG_FW_RW_OFF CONFIG_FW_IMAGE_SIZE
#define CONFIG_FW_RW_SIZE CONFIG_FW_IMAGE_SIZE
#define CONFIG_FW_RW_B_OFF (2 * CONFIG_FW_IMAGE_SIZE)
#define CONFIG_FW_RW_B_SIZE CONFIG_FW_IMAGE_SIZE
#define CONFIG_SECTION_RO_OFF CONFIG_FW_RO_OFF
#define CONFIG_SECTION_RO_SIZE CONFIG_FW_RO_SIZE
#define CONFIG_SECTION_RW_OFF CONFIG_FW_RW_OFF
#define CONFIG_SECTION_RW_SIZE CONFIG_FW_RW_SIZE
#define CONFIG_SECTION_RW_B_OFF CONFIG_FW_RW_B_OFF
#define CONFIG_SECTION_RW_B_SIZE CONFIG_FW_RW_B_SIZE
/* no keys for now */
#define CONFIG_VBOOT_ROOTKEY_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE)
#define CONFIG_VBLOCK_RW_OFF (CONFIG_FW_RW_OFF + CONFIG_FW_RW_SIZE)
#define CONFIG_VBLOCK_RW_B_OFF (CONFIG_FW_RW_B_OFF + CONFIG_FW_RW_B_SIZE)
#define CONFIG_VBOOT_ROOTKEY_SIZE 0
#define CONFIG_VBLOCK_SIZE 0

View File

@@ -17,12 +17,6 @@
.section .image.RO, "ax"
.incbin FW_IMAGE(RO)
/* Read Write firmware copy A */
/* Read Write firmware */
.section .image.RW, "ax"
.incbin FW_IMAGE(RW)
#ifdef CONFIG_RW_B
/* Read Write firmware copy B */
.section .image.RW_B, "ax"
.incbin FW_IMAGE(RW_B)
#endif

View File

@@ -23,13 +23,6 @@ SECTIONS
*(.image.RW)
BYTE(0xEA) /* Mark end explicitly */
} > FLASH =0xff
#ifdef CONFIG_RW_B
. = ALIGN(CONFIG_FLASH_BANK_SIZE);
.image.RW_B : AT(CONFIG_FLASH_BASE + CONFIG_SECTION_RW_B_OFF) {
*(.image.RW_B)
BYTE(0xEB) /* Mark end explicitly */
} > FLASH =0xff
#endif
.padding : AT(CONFIG_FLASH_BASE + CONFIG_FLASH_SIZE - 1) {
BYTE(0xff);
} > FLASH =0xff

View File

@@ -40,7 +40,7 @@ typedef struct _FmapAreaHeader {
} __packed FmapAreaHeader;
#define NUM_EC_FMAP_AREAS 17
#define NUM_EC_FMAP_AREAS 13
const struct _ec_fmap {
FmapHeader header;
FmapAreaHeader area[NUM_EC_FMAP_AREAS];
@@ -108,11 +108,10 @@ const struct _ec_fmap {
.area_flags = FMAP_AREA_STATIC | FMAP_AREA_RO,
},
{
/* The range for autoupdate to update A/B at once. */
/* The range for autoupdate to update RW */
.area_name = "EC_RW",
.area_offset = CONFIG_SECTION_RW_OFF,
.area_size = CONFIG_SECTION_RW_SIZE
+ CONFIG_SECTION_RW_B_SIZE,
.area_size = CONFIG_SECTION_RW_SIZE,
.area_flags = FMAP_AREA_STATIC | FMAP_AREA_RO,
},
{
@@ -151,35 +150,5 @@ const struct _ec_fmap {
.area_size = CONFIG_VBLOCK_SIZE,
.area_flags = FMAP_AREA_STATIC,
},
#ifdef CONFIG_RW_B
/* Firmware B */
{
.area_name = "RW_SECTION_B",
.area_offset = CONFIG_SECTION_RW_B_OFF,
.area_size = CONFIG_SECTION_RW_B_SIZE,
.area_flags = FMAP_AREA_STATIC,
},
{
.area_name = "FW_MAIN_B",
.area_offset = CONFIG_FW_RW_B_OFF,
.area_size = CONFIG_FW_RW_B_SIZE,
.area_flags = FMAP_AREA_STATIC,
},
{
.area_name = "RW_FWID_B", /* FIXME: Where is it? */
.area_offset = CONFIG_FW_RW_B_OFF +
(uint32_t)__version_struct_offset +
offsetof(struct version_struct, version),
.area_size = sizeof(version_data.version),
.area_flags = FMAP_AREA_STATIC,
},
{
.area_name = "VBLOCK_B",
.area_offset = CONFIG_VBLOCK_RW_B_OFF,
.area_size = CONFIG_VBLOCK_SIZE,
.area_flags = FMAP_AREA_STATIC,
},
#endif /* CONFIG_RW_B */
}
};

View File

@@ -225,10 +225,6 @@ enum system_image_copy_t system_get_image_copy(void)
my_addr < (CONFIG_SECTION_RW_OFF + CONFIG_SECTION_RW_SIZE))
return SYSTEM_IMAGE_RW_A;
if (my_addr >= CONFIG_SECTION_RW_B_OFF &&
my_addr < (CONFIG_SECTION_RW_B_OFF + CONFIG_SECTION_RW_B_SIZE))
return SYSTEM_IMAGE_RW_B;
return SYSTEM_IMAGE_UNKNOWN;
}
@@ -250,10 +246,6 @@ int system_unsafe_to_overwrite(uint32_t offset, uint32_t size) {
r_offset = CONFIG_FW_RW_OFF;
r_size = CONFIG_FW_RW_SIZE;
break;
case SYSTEM_IMAGE_RW_B:
r_offset = CONFIG_FW_RW_B_OFF;
r_size = CONFIG_FW_RW_B_SIZE;
break;
default:
return 0;
}
@@ -319,10 +311,6 @@ static uint32_t get_base(enum system_image_copy_t copy)
return CONFIG_FLASH_BASE + CONFIG_FW_RO_OFF;
case SYSTEM_IMAGE_RW_A:
return CONFIG_FLASH_BASE + CONFIG_FW_RW_OFF;
#ifdef CONFIG_RW_B
case SYSTEM_IMAGE_RW_B:
return CONFIG_FLASH_BASE + CONFIG_FW_RW_B_OFF;
#endif
default:
return 0xffffffff;
}
@@ -336,10 +324,6 @@ static uint32_t get_size(enum system_image_copy_t copy)
return CONFIG_FW_RO_SIZE;
case SYSTEM_IMAGE_RW_A:
return CONFIG_FW_RW_SIZE;
#ifdef CONFIG_RW_B
case SYSTEM_IMAGE_RW_B:
return CONFIG_FW_RW_B_SIZE;
#endif
default:
return 0;
}
@@ -364,7 +348,7 @@ int system_run_image_copy(enum system_image_copy_t copy)
return EC_ERROR_ACCESS_DENIED;
/* Target image must be RW image */
if (copy != SYSTEM_IMAGE_RW_A && copy != SYSTEM_IMAGE_RW_B)
if (copy != SYSTEM_IMAGE_RW_A)
return EC_ERROR_ACCESS_DENIED;
/* Can't have already jumped between images */
@@ -516,8 +500,6 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd)
return system_run_image_copy(SYSTEM_IMAGE_RO);
case EC_REBOOT_JUMP_RW_A:
return system_run_image_copy(SYSTEM_IMAGE_RW_A);
case EC_REBOOT_JUMP_RW_B:
return system_run_image_copy(SYSTEM_IMAGE_RW_B);
case EC_REBOOT_COLD:
system_reset(SYSTEM_RESET_HARD);
/* That shouldn't return... */
@@ -623,8 +605,7 @@ static int command_version(int argc, char **argv)
system_get_chip_name(), system_get_chip_revision());
ccprintf("Board: %d\n", system_get_board_version());
ccprintf("RO: %s\n", system_get_version(SYSTEM_IMAGE_RO));
ccprintf("RW-A: %s\n", system_get_version(SYSTEM_IMAGE_RW_A));
ccprintf("RW-B: %s\n", system_get_version(SYSTEM_IMAGE_RW_B));
ccprintf("RW: %s\n", system_get_version(SYSTEM_IMAGE_RW_A));
ccprintf("Build: %s\n", system_get_build_info());
return EC_SUCCESS;
}
@@ -647,8 +628,6 @@ static int command_sysjump(int argc, char **argv)
return system_run_image_copy(SYSTEM_IMAGE_RO);
else if (!strcasecmp(argv[1], "A"))
return system_run_image_copy(SYSTEM_IMAGE_RW_A);
else if (!strcasecmp(argv[1], "B"))
return system_run_image_copy(SYSTEM_IMAGE_RW_B);
else if (!strcasecmp(argv[1], "disable")) {
system_disable_jump();
return EC_SUCCESS;
@@ -723,8 +702,6 @@ static int host_command_get_version(struct host_cmd_handler_args *args)
sizeof(r->version_string_ro));
strzcpy(r->version_string_rw_a, system_get_version(SYSTEM_IMAGE_RW_A),
sizeof(r->version_string_rw_a));
strzcpy(r->version_string_rw_b, system_get_version(SYSTEM_IMAGE_RW_B),
sizeof(r->version_string_rw_b));
switch (system_get_image_copy()) {
case SYSTEM_IMAGE_RO:
@@ -733,9 +710,6 @@ static int host_command_get_version(struct host_cmd_handler_args *args)
case SYSTEM_IMAGE_RW_A:
r->current_image = EC_IMAGE_RW_A;
break;
case SYSTEM_IMAGE_RW_B:
r->current_image = EC_IMAGE_RW_B;
break;
default:
r->current_image = EC_IMAGE_UNKNOWN;
break;

View File

@@ -155,35 +155,6 @@ int vboot_check_signature(void)
CPRINTF("[Image A is invalid]\n");
}
#ifdef CONFIG_RW_B
CPRINTF("[%T Vboot check image B...]\n");
ts1 = get_time();
r = good_image((uint8_t *)CONFIG_VBOOT_ROOTKEY_OFF,
(uint8_t *)CONFIG_VBLOCK_RW_B_OFF, CONFIG_VBLOCK_SIZE,
(uint8_t *)CONFIG_FW_RW_B_OFF, CONFIG_FW_RW_B_SIZE);
ts2 = get_time();
CPRINTF("[%T Vboot result=%d, elapsed time=%ld us]\n",
r, ts2.val - ts1.val);
switch (r) {
case IMAGE_IS_GOOD:
CPRINTF("[Image B verified]\n");
system_run_image_copy(SYSTEM_IMAGE_RW_B);
CPRINTF("[ERROR: Unable to jump to image B]\n");
goto bad;
case IMAGE_IS_GOOD_BUT_USE_RO_ANYWAY:
CPRINTF("[Image B verified]\n");
CPRINTF("[Staying in RO mode]\n");
return EC_SUCCESS;
default:
CPRINTF("[Image B is invalid]\n");
}
#else /* CONFIG_RW_B */
CPRINTF("[Vboot no image B to check]\n");
#endif /* CONFIG_RW_B */
bad:
CPRINTF("[Staying in RO mode]\n");
CPRINTF("[FIXME: How to trigger recovery mode?]\n");

View File

@@ -290,15 +290,14 @@ struct ec_response_hello {
enum ec_current_image {
EC_IMAGE_UNKNOWN = 0,
EC_IMAGE_RO,
EC_IMAGE_RW_A,
EC_IMAGE_RW_B
EC_IMAGE_RW_A
};
struct ec_response_get_version {
/* Null-terminated version strings for RO, RW-A, RW-B */
/* Null-terminated version strings for RO, RW */
char version_string_ro[32];
char version_string_rw_a[32];
char version_string_rw_b[32];
char reserved[32]; /* Was previously RW-B string */
uint32_t current_image; /* One of ec_current_image */
} __packed;
@@ -873,8 +872,8 @@ enum ec_reboot_cmd {
EC_REBOOT_CANCEL = 0, /* Cancel a pending reboot */
EC_REBOOT_JUMP_RO, /* Jump to RO without rebooting */
EC_REBOOT_JUMP_RW_A, /* Jump to RW-A without rebooting */
EC_REBOOT_JUMP_RW_B, /* Jump to RW-B without rebooting */
EC_REBOOT_COLD, /* Cold-reboot */
/* (command 3 was jump to RW-B) */
EC_REBOOT_COLD = 4, /* Cold-reboot */
EC_REBOOT_DISABLE_JUMP, /* Disable jump until next reboot */
};

View File

@@ -28,8 +28,7 @@
enum system_image_copy_t {
SYSTEM_IMAGE_UNKNOWN = 0,
SYSTEM_IMAGE_RO,
SYSTEM_IMAGE_RW_A,
SYSTEM_IMAGE_RW_B
SYSTEM_IMAGE_RW_A
};
/* Pre-initializes the module. This occurs before clocks or tasks are

View File

@@ -34,13 +34,11 @@ enum ec_current_image get_version(enum ec_current_image *version_ptr)
/* Ensure versions are null-terminated before we print them */
r.version_string_ro[sizeof(r.version_string_ro) - 1] = '\0';
r.version_string_rw_a[sizeof(r.version_string_rw_a) - 1] = '\0';
r.version_string_rw_b[sizeof(r.version_string_rw_b) - 1] = '\0';
build_info[sizeof(build_info) - 1] = '\0';
/* Print versions */
printf("RO version: %s\n", r.version_string_ro);
printf("RW-A version: %s\n", r.version_string_rw_a);
printf("RW-B version: %s\n", r.version_string_rw_b);
printf("RW version: %s\n", r.version_string_rw_a);
printf("Firmware copy: %s\n",
(r.current_image < sizeof(part_name)/sizeof(part_name[0]) ?
part_name[r.current_image] : "?"));
@@ -140,10 +138,6 @@ int main(int argc, char *argv[])
if (comm_init() < 0)
return -3;
#ifdef CONFIG_RW_B
flash_partition(EC_IMAGE_RW_B, data + CONFIG_FW_RW_B_OFF,
CONFIG_FW_RW_B_OFF, CONFIG_FW_RW_B_SIZE);
#endif /* CONFIG_RW_B */
flash_partition(EC_IMAGE_RW_A, data + CONFIG_FW_RW_OFF,
CONFIG_FW_RW_OFF, CONFIG_FW_RW_SIZE);
flash_partition(EC_IMAGE_RO, data + CONFIG_FW_RO_OFF,

View File

@@ -99,8 +99,8 @@ const char help_str[] =
" Set keyboard backlight in percent\n"
" readtest <patternoffset> <size>\n"
" Reads a pattern from the EC via LPC\n"
" reboot_ec <RO|A|B|disable-jump> [at-shutdown]\n"
" Reboot EC to RO or RW A/B\n"
" reboot_ec <RO|A|disable-jump> [at-shutdown]\n"
" Reboot EC to RO or RW\n"
" sertest\n"
" Serial output test for COM2\n"
" switches\n"
@@ -296,13 +296,11 @@ int cmd_version(int argc, char *argv[])
/* Ensure versions are null-terminated before we print them */
r.version_string_ro[sizeof(r.version_string_ro) - 1] = '\0';
r.version_string_rw_a[sizeof(r.version_string_rw_a) - 1] = '\0';
r.version_string_rw_b[sizeof(r.version_string_rw_b) - 1] = '\0';
build_string[sizeof(build_string) - 1] = '\0';
/* Print versions */
printf("RO version: %s\n", r.version_string_ro);
printf("RW-A version: %s\n", r.version_string_rw_a);
printf("RW-B version: %s\n", r.version_string_rw_b);
printf("RW version: %s\n", r.version_string_rw_a);
printf("Firmware copy: %s\n",
(r.current_image < ARRAY_SIZE(fw_copies) ?
fw_copies[r.current_image] : "?"));
@@ -399,8 +397,6 @@ int cmd_reboot_ec(int argc, char *argv[])
p.cmd = EC_REBOOT_JUMP_RO;
else if (!strcmp(argv[1], "A"))
p.cmd = EC_REBOOT_JUMP_RW_A;
else if (!strcmp(argv[1], "B"))
p.cmd = EC_REBOOT_JUMP_RW_B;
else if (!strcmp(argv[1], "cold"))
p.cmd = EC_REBOOT_COLD;
else if (!strcmp(argv[1], "disable-jump"))