Siew Chin Lim | 1025b53 | 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 | |
Simon Glass | 7e5f460 | 2021-07-24 09:03:29 -0600 | [diff] [blame] | 20 | addr = hextoul(argv[1], NULL); |
| 21 | len = hextoul(argv[2], NULL); |
Siew Chin Lim | 1025b53 | 2021-03-01 20:04:12 +0800 | [diff] [blame] | 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 | ); |