Siew Chin Lim | d883450 | 2021-03-01 20:04:12 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright (C) 2020 Intel Corporation <www.intel.com> |
| 4 | * |
| 5 | */ |
| 6 | |
| 7 | #include <asm/arch/secure_vab.h> |
| 8 | #include <command.h> |
| 9 | #include <common.h> |
| 10 | #include <linux/ctype.h> |
| 11 | |
| 12 | static int do_vab(struct cmd_tbl *cmdtp, int flag, int argc, |
| 13 | char *const argv[]) |
| 14 | { |
| 15 | unsigned long addr, len; |
| 16 | |
| 17 | if (argc < 3) |
| 18 | return CMD_RET_USAGE; |
| 19 | |
| 20 | addr = simple_strtoul(argv[1], NULL, 16); |
| 21 | len = simple_strtoul(argv[2], NULL, 16); |
| 22 | |
| 23 | if (socfpga_vendor_authentication((void *)&addr, (size_t *)&len) != 0) |
| 24 | return CMD_RET_FAILURE; |
| 25 | |
| 26 | return 0; |
| 27 | } |
| 28 | |
| 29 | U_BOOT_CMD( |
| 30 | vab, 3, 2, do_vab, |
| 31 | "perform vendor authorization", |
| 32 | "addr len - authorize 'len' bytes starting at\n" |
| 33 | " 'addr' via vendor public key" |
| 34 | ); |