aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-10-10 13:35:17 -0400
committerTom Rini <trini@konsulko.com>2018-10-10 13:35:17 -0400
commit3d5ced9e22d32112a20f9dc0f5fb1f22ef088079 (patch)
tree2c1e1f34c4dad05dfd08bd3687e6aee634c58500 /cmd
parent98068b3be51a77d8b931a2f5097b5c22c57bcea5 (diff)
parent41b781ddf1869f5349e05ace888979f3673fe8c6 (diff)
downloadu-boot-3d5ced9e22d32112a20f9dc0f5fb1f22ef088079.zip
u-boot-3d5ced9e22d32112a20f9dc0f5fb1f22ef088079.tar.gz
u-boot-3d5ced9e22d32112a20f9dc0f5fb1f22ef088079.tar.bz2
Merge tag 'dm-9oct18' of git://git.denx.de/u-boot-dm
Test improvements to tidy up output and drop duplicate tests Sandbox SPL/TPL support Various dm-related improvements
Diffstat (limited to 'cmd')
-rw-r--r--cmd/cros_ec.c31
-rw-r--r--cmd/tpm_test.c15
-rw-r--r--cmd/x86/mtrr.c8
3 files changed, 19 insertions, 35 deletions
diff --git a/cmd/cros_ec.c b/cmd/cros_ec.c
index 60c8783..9e2f1b0 100644
--- a/cmd/cros_ec.c
+++ b/cmd/cros_ec.c
@@ -27,7 +27,7 @@ static int cros_ec_decode_region(int argc, char * const argv[])
{
if (argc > 0) {
if (0 == strcmp(*argv, "rw"))
- return EC_FLASH_REGION_RW;
+ return EC_FLASH_REGION_ACTIVE;
else if (0 == strcmp(*argv, "ro"))
return EC_FLASH_REGION_RO;
@@ -49,7 +49,7 @@ static int cros_ec_decode_region(int argc, char * const argv[])
* @return 0 for ok, 1 for a usage error or -ve for ec command error
* (negative EC_RES_...)
*/
-static int do_read_write(struct cros_ec_dev *dev, int is_write, int argc,
+static int do_read_write(struct udevice *dev, int is_write, int argc,
char * const argv[])
{
uint32_t offset, size = -1U, region_size;
@@ -94,8 +94,7 @@ static int do_read_write(struct cros_ec_dev *dev, int is_write, int argc,
static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- struct cros_ec_dev *dev;
- struct udevice *udev;
+ struct udevice *dev;
const char *cmd;
int ret = 0;
@@ -105,10 +104,10 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
cmd = argv[1];
if (0 == strcmp("init", cmd)) {
/* Remove any existing device */
- ret = uclass_find_device(UCLASS_CROS_EC, 0, &udev);
+ ret = uclass_find_device(UCLASS_CROS_EC, 0, &dev);
if (!ret)
- device_remove(udev, DM_REMOVE_NORMAL);
- ret = uclass_get_device(UCLASS_CROS_EC, 0, &udev);
+ device_remove(dev, DM_REMOVE_NORMAL);
+ ret = uclass_get_device(UCLASS_CROS_EC, 0, &dev);
if (ret) {
printf("Could not init cros_ec device (err %d)\n", ret);
return 1;
@@ -116,12 +115,11 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
- ret = uclass_get_device(UCLASS_CROS_EC, 0, &udev);
+ ret = uclass_get_device(UCLASS_CROS_EC, 0, &dev);
if (ret) {
printf("Cannot get cros-ec device (err=%d)\n", ret);
return 1;
}
- dev = dev_get_uclass_priv(udev);
if (0 == strcmp("id", cmd)) {
char id[MSG_BYTES];
@@ -139,7 +137,6 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
printf("rows = %u\n", info.rows);
printf("cols = %u\n", info.cols);
- printf("switches = %#x\n", info.switches);
} else if (0 == strcmp("curimage", cmd)) {
enum ec_current_image image;
@@ -152,7 +149,7 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
struct ec_response_vboot_hash hash;
int i;
- if (cros_ec_read_hash(dev, &hash)) {
+ if (cros_ec_read_hash(dev, EC_VBOOT_HASH_OFFSET_ACTIVE, &hash)) {
debug("%s: Could not read KBC hash\n", __func__);
return 1;
}
@@ -179,7 +176,7 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
region = cros_ec_decode_region(argc - 2, argv + 2);
if (region == EC_FLASH_REGION_RO)
cmd = EC_REBOOT_JUMP_RO;
- else if (region == EC_FLASH_REGION_RW)
+ else if (region == EC_FLASH_REGION_ACTIVE)
cmd = EC_REBOOT_JUMP_RW;
else
return CMD_RET_USAGE;
@@ -262,7 +259,8 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
unsigned long result;
if (argc <= 2) {
- ret = cros_ec_read_vbnvcontext(dev, block);
+ ret = cros_ec_read_nvdata(dev, block,
+ EC_VBNV_BLOCK_SIZE);
if (!ret) {
printf("vbnv_block: ");
for (i = 0; i < EC_VBNV_BLOCK_SIZE; i++)
@@ -288,7 +286,8 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
strict_strtoul(buf, 16, &result);
block[i] = result;
}
- ret = cros_ec_write_vbnvcontext(dev, block);
+ ret = cros_ec_write_nvdata(dev, block,
+ EC_VBNV_BLOCK_SIZE);
}
if (ret) {
debug("%s: Could not %s VbNvContext\n", __func__,
@@ -336,9 +335,9 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
state = simple_strtoul(argv[3], &endp, 10);
if (*argv[3] == 0 || *endp != 0)
return CMD_RET_USAGE;
- ret = cros_ec_set_ldo(udev, index, state);
+ ret = cros_ec_set_ldo(dev, index, state);
} else {
- ret = cros_ec_get_ldo(udev, index, &state);
+ ret = cros_ec_get_ldo(dev, index, &state);
if (!ret) {
printf("LDO%d: %s\n", index,
state == EC_LDO_STATE_ON ?
diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c
index 35f3c96..f21ad5d 100644
--- a/cmd/tpm_test.c
+++ b/cmd/tpm_test.c
@@ -62,14 +62,6 @@ static uint32_t tpm_get_flags(uint8_t *disable, uint8_t *deactivated,
return 0;
}
-static uint32_t tpm_set_global_lock(void)
-{
- uint32_t x;
-
- debug("TPM: Set global lock\n");
- return tpm_nv_write_value(INDEX0, (uint8_t *)&x, 0);
-}
-
static uint32_t tpm_nv_write_value_lock(uint32_t index)
{
debug("TPM: Write lock 0x%x\n", index);
@@ -77,13 +69,6 @@ static uint32_t tpm_nv_write_value_lock(uint32_t index)
return tpm_nv_write_value(index, NULL, 0);
}
-static uint32_t tpm_nv_set_locked(void)
-{
- debug("TPM: Set NV locked\n");
-
- return tpm_nv_define_space(TPM_NV_INDEX_LOCK, 0, 0);
-}
-
static int tpm_is_owned(void)
{
uint8_t response[TPM_PUBEK_SIZE];
diff --git a/cmd/x86/mtrr.c b/cmd/x86/mtrr.c
index 70f373a..d3fd959 100644
--- a/cmd/x86/mtrr.c
+++ b/cmd/x86/mtrr.c
@@ -73,10 +73,10 @@ static int do_mtrr_set(uint reg, int argc, char * const argv[])
mask |= MTRR_PHYS_MASK_VALID;
printf("base=%llx, mask=%llx\n", base, mask);
- mtrr_open(&state);
+ mtrr_open(&state, true);
wrmsrl(MTRR_PHYS_BASE_MSR(reg), base);
wrmsrl(MTRR_PHYS_MASK_MSR(reg), mask);
- mtrr_close(&state);
+ mtrr_close(&state, true);
return 0;
}
@@ -86,14 +86,14 @@ static int mtrr_set_valid(int reg, bool valid)
struct mtrr_state state;
uint64_t mask;
- mtrr_open(&state);
+ mtrr_open(&state, true);
mask = native_read_msr(MTRR_PHYS_MASK_MSR(reg));
if (valid)
mask |= MTRR_PHYS_MASK_VALID;
else
mask &= ~MTRR_PHYS_MASK_VALID;
wrmsrl(MTRR_PHYS_MASK_MSR(reg), mask);
- mtrr_close(&state);
+ mtrr_close(&state, true);
return 0;
}