Files
OpenCellular/common/vboot.c
Randall Spangler acf6f963a1 Flash pre-init reboots if it needs to clear protection registers
BUG=chrome-os-partner:11171
TEST=manual

1. Clear some of the writable-bits in the flash registers
> ww 0x400fe40c 0xffff1234
write 0x400fe40c = 0xffff1234
> rw 0x400fe40c
read 0x400fe40c = 0xffff1234
2. Reset using power+refresh
3. Register should be clear again
> rw 0x400fe40c
read 0x400fe40c = 0xffffffff
4. Sysinfo should indicate reset-pin reason AND hard-reset reason
> sysinfo
Reset flags: 0x0000000a (reset-pin power-on)
5. Reset using power+refresh
6. Sysinfo should indicate reset-pin reason only
> sysinfo
Reset flags: 0x00000002 (reset-pin)
7. Clear writable-bits again
> ww 0x400fe40c 0xffff1234
write 0x400fe40c = 0xffff1234
8. Jump to another image.  This should NOT trigger a hard reset.
> sysjump A
> sysinfo
Reset flags: 0x00000402 (reset-pin sysjump)

Change-Id: Ie1d6af2acc68217bb82faae464798ee85d63d1ea
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27540
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-16 17:49:10 -07:00

49 lines
1.2 KiB
C

/* 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.
*/
/* Verified boot module for Chrome EC */
#include "common.h"
#include "console.h"
#include "host_command.h"
#include "system.h"
#include "vboot.h"
/* Console output macros */
#define CPUTS(outstr) cputs(CC_VBOOT, outstr)
#define CPRINTF(format, args...) cprintf(CC_VBOOT, format, ## args)
/****************************************************************************/
/* Host commands */
static int host_cmd_vboot(struct host_cmd_handler_args *args)
{
const struct ec_params_vboot_cmd *p =
(const struct ec_params_vboot_cmd *)args->params;
struct ec_params_vboot_cmd *r =
(struct ec_params_vboot_cmd *)args->response;
uint8_t v;
switch (p->in.cmd) {
case VBOOT_CMD_GET_FLAGS:
v = VBOOT_FLAGS_IMAGE_MASK & system_get_image_copy();
r->out.get_flags.val = v;
args->response_size = sizeof(r);
break;
case VBOOT_CMD_SET_FLAGS:
v = p->in.set_flags.val;
break;
default:
CPRINTF("[%T LB bad cmd 0x%x]\n", p->in.cmd);
return EC_RES_INVALID_PARAM;
}
return EC_RES_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_CMD_VBOOT_CMD,
host_cmd_vboot,
EC_VER_MASK(0));