
On Fri, Sep 25, 2015 at 07:17:18PM +0300, Sergey Temerkhanov wrote:
This commit adds functions issuing calls to the product-specific ATF services
Signed-off-by: Sergey Temerkhanov s.temerkhanov@gmail.com Signed-off-by: Radha Mohan Chintakuntla rchintakuntla@cavium.com
OK, problem:
+#ifdef CONFIG_CMD_ATF
+static void atf_print_ver(void) +{
- struct pt_regs regs;
- regs.regs[0] = ARM_STD_SVC_VERSION;
- smc_call(®s);
- printf("ARM Std FW version: %ld.%ld\n", regs.regs[0], regs.regs[1]);
- regs.regs[0] = THUNDERX_SVC_VERSION;
- smc_call(®s);
- printf("ThunderX OEM ver: %ld.%ld\n", regs.regs[0], regs.regs[1]);
+}
+static void atf_print_uid(void) +{ +}
+static void atf_print_part_table(void) +{
- size_t pcount;
- unsigned long i;
- int ret;
- char *ptype;
- struct storage_partition *part = (void *)CONFIG_SYS_LOWMEM_BASE;
- pcount = atf_get_pcount();
- printf("Partition count: %lu\n\n", pcount);
- printf("%10s %10s %10s\n", "Type", "Size", "Offset");
- for (i = 0; i < pcount; i++) {
ret = atf_get_part(part, i);
if (ret < 0) {
printf("Uknown error while reading partition: %d\n",
ret);
return;
}
switch (part->type) {
case PARTITION_NBL1FW_REST:
ptype = "NBL1FW";
break;
case PARTITION_BL2_BL31:
ptype = "BL2_BL31";
break;
case PARTITION_UBOOT:
ptype = "BOOTLDR";
break;
case PARTITION_KERNEL:
ptype = "KERNEL";
break;
case PARTITION_DEVICE_TREE:
ptype = "DEVTREE";
break;
default:
ptype = "UNKNOWN";
}
printf("%10s %10d %10lx\n", ptype, part->size, part->offset);
- }
+}
+int do_atf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{
- ssize_t ret;
- size_t size, offset;
- void *buffer = 0;
- unsigned int index, node;
- char str[4 * sizeof(uint64_t)];
- if ((argc == 5) && !strcmp(argv[1], "readmmc")) {
buffer = (void *)simple_strtoul(argv[2], NULL, 16);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
ret = atf_read_mmc(offset, buffer, size);
- } else if ((argc == 5) && !strcmp(argv[1], "readnor")) {
buffer = (void *)simple_strtoul(argv[2], NULL, 16);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
ret = atf_read_nor(offset, buffer, size);
- } else if ((argc == 5) && !strcmp(argv[1], "writemmc")) {
buffer = (void *)simple_strtoul(argv[2], NULL, 16);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
ret = atf_write_mmc(offset, buffer, size);
- } else if ((argc == 5) && !strcmp(argv[1], "writenor")) {
buffer = (void *)simple_strtoul(argv[2], NULL, 16);
offset = simple_strtoul(argv[3], NULL, 10);
size = simple_strtoul(argv[4], NULL, 10);
ret = atf_write_nor(offset, buffer, size);
- } else if ((argc == 2) && !strcmp(argv[1], "part")) {
atf_print_part_table();
- } else if ((argc == 4) && !strcmp(argv[1], "erasenor")) {
offset = simple_strtoul(argv[2], NULL, 10);
size = simple_strtoul(argv[3], NULL, 10);
ret = atf_erase_nor(offset, size);
- } else if ((argc == 2) && !strcmp(argv[1], "envcount")) {
ret = atf_env_count();
printf("Number of environment strings: %zd\n", ret);
- } else if ((argc == 3) && !strcmp(argv[1], "envstring")) {
index = simple_strtoul(argv[2], NULL, 10);
ret = atf_env_string(index, str);
if (ret > 0)
printf("Environment string %d: %s\n", index, str);
else
printf("Return code: %zd\n", ret);
- } else if ((argc == 3) && !strcmp(argv[1], "dramsize")) {
node = simple_strtoul(argv[2], NULL, 10);
ret = atf_dram_size(node);
printf("DRAM size: %zd Mbytes\n", ret >> 20);
- } else if ((argc == 2) && !strcmp(argv[1], "nodes")) {
ret = atf_node_count();
printf("Nodes count: %zd\n", ret);
- } else if ((argc == 2) && !strcmp(argv[1], "ver")) {
atf_print_ver();
- } else if ((argc == 2) && !strcmp(argv[1], "uid")) {
atf_print_uid();
- } else {
return CMD_RET_USAGE;
- }
- return 0;
+}
+U_BOOT_CMD(
- atf, 10, 1, do_atf,
- "issue calls to ATF",
- "\t readmmc addr offset size - read MMC card\n"
- "\t readnor addr offset size - read NOR flash\n"
- "\t writemmc addr offset size - write MMC card\n"
- "\t writenor addr offset size - write NOR flash\n"
- "\t erasenor offset size - erase NOR flash\n"
- "\t nodes - number of nodes\n"
- "\t dramsize node - size of DRAM attached to node\n"
- "\t envcount - number of environment strings\n"
- "\t envstring index - print the environment string\n"
- "\t part - print MMC partition table\n"
- "\t ver - print ATF call set versions\n"
+);
+#endif
But you don't add a Kconfig entry for CMD_ATF anywhere and you just set it in the Kconfig defconfig file for the board and it will then be dropped out upon reading because there's no Kconfig entry for it, so this code is never built in. Please fix.