Example #1
0
		printf("%c", data & (1 << i) ? '1' : '0');
	printf("\n");

	if (i2c_read(chip, PCA953X_OUT, 1, &data, 1))
		return -1;
	printf("output:    ");
	for (i = 7; i >= 0; i--)
		printf("%c", data & (1 << i) ? '1' : '0');
	printf("\n");

	return 0;
}
#endif /* CONFIG_CMD_PCA953X_INFO */

cmd_tbl_t cmd_pca953x[] = {
	U_BOOT_CMD_MKENT(device, 3, 0, (void *)PCA953X_CMD_DEVICE, "", ""),
	U_BOOT_CMD_MKENT(output, 4, 0, (void *)PCA953X_CMD_OUTPUT, "", ""),
	U_BOOT_CMD_MKENT(input, 3, 0, (void *)PCA953X_CMD_INPUT, "", ""),
	U_BOOT_CMD_MKENT(invert, 4, 0, (void *)PCA953X_CMD_INVERT, "", ""),
#ifdef CONFIG_CMD_PCA953X_INFO
	U_BOOT_CMD_MKENT(info, 2, 0, (void *)PCA953X_CMD_INFO, "", ""),
#endif
};

int do_pca953x(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
	static uint8_t chip = CONFIG_SYS_I2C_PCA953X_ADDR;
	int val;
	ulong ul_arg2 = 0;
	ulong ul_arg3 = 0;
	cmd_tbl_t *c;
Example #2
0
	}

	guid = efi_global_variable_guid;
	ret = EFI_CALL(RT->set_variable(L"BootOrder", &guid,
					EFI_VARIABLE_BOOTSERVICE_ACCESS |
					EFI_VARIABLE_RUNTIME_ACCESS,
					size, bootorder));
	ret = (ret == EFI_SUCCESS ? CMD_RET_SUCCESS : CMD_RET_FAILURE);
out:
	free(bootorder);

	return ret;
}

static cmd_tbl_t cmd_efidebug_boot_sub[] = {
	U_BOOT_CMD_MKENT(add, CONFIG_SYS_MAXARGS, 1, do_efi_boot_add, "", ""),
	U_BOOT_CMD_MKENT(rm, CONFIG_SYS_MAXARGS, 1, do_efi_boot_rm, "", ""),
	U_BOOT_CMD_MKENT(dump, CONFIG_SYS_MAXARGS, 1, do_efi_boot_dump, "", ""),
	U_BOOT_CMD_MKENT(next, CONFIG_SYS_MAXARGS, 1, do_efi_boot_next, "", ""),
	U_BOOT_CMD_MKENT(order, CONFIG_SYS_MAXARGS, 1, do_efi_boot_order,
			 "", ""),
};

/**
 * do_efi_boot_opt() - manage UEFI load options
 *
 * @cmdtp:	Command table
 * @flag:	Command flag
 * @argc:	Number of arguments
 * @argv:	Argument array
 * Return:	CMD_RET_SUCCESS on success,
Example #3
0
        ssize_t keysize = 0;
        ret = key_manage_query_size(keyname, &keysize);
        if (ret) {
            KM_ERR("Fail in query key size, err=%d\n", ret);
            return CMD_RET_FAILURE;
        }
        KM_MSG("key[%s] size is %zd\n", keyname, keysize);
        ret = keysize ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
    }
    else return CMD_RET_USAGE;

    return ret;
}

static cmd_tbl_t cmd_keyman_sub[] = {
    U_BOOT_CMD_MKENT(init,          3, 0, do_keyman_init, "", ""),
    U_BOOT_CMD_MKENT(exit,          2, 0, do_keyman_exit, "", ""),
    U_BOOT_CMD_MKENT(read,          4, 0, do_keyman_read, "", ""),
    U_BOOT_CMD_MKENT(write,         4, 0, do_keyman_write, "", ""),
    U_BOOT_CMD_MKENT(query,         3, 0, do_keyman_query, "", ""),
};

static int do_keymanage(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
    cmd_tbl_t *c;

    if (argc < 2) return CMD_RET_USAGE;

    c = find_cmd_tbl(argv[1], cmd_keyman_sub, ARRAY_SIZE(cmd_keyman_sub));

	if (!c) { return CMD_RET_USAGE;}
Example #4
0
			printf("Remote processor responds 'Pong'\n");
		} else if (ret == 1) {
			printf("No response from Remote processor\n");
			ret = 0;
		}
		/* Else error.. */
	}

	if (ret < 0)
		printf("Operation Failed with error (%d)\n", ret);

	return ret ? CMD_RET_FAILURE : 0;
}

static cmd_tbl_t cmd_remoteproc_sub[] = {
	U_BOOT_CMD_MKENT(init, 0, 1, do_rproc_init,
			 "Enumerate and initialize all processors", ""),
	U_BOOT_CMD_MKENT(list, 0, 1, do_remoteproc_list,
			 "list remote processors", ""),
	U_BOOT_CMD_MKENT(load, 5, 1, do_remoteproc_load,
			 "Load remote processor with provided image",
			 "<id> [addr] [size]\n"
			 "- id: ID of the remote processor(see 'list' cmd)\n"
			 "- addr: Address in memory of the image to loadup\n"
			 "- size: Size of the image to loadup\n"),
	U_BOOT_CMD_MKENT(start, 1, 1, do_remoteproc_wrapper,
			 "Start remote processor",
			 "id - ID of the remote processor (see 'list' cmd)\n"),
	U_BOOT_CMD_MKENT(stop, 1, 1, do_remoteproc_wrapper,
			 "Stop remote processor",
			 "id - ID of the remote processor (see 'list' cmd)\n"),
	U_BOOT_CMD_MKENT(reset, 1, 1, do_remoteproc_wrapper,
Example #5
0
	value = argv[2];

	if (avb_ops->write_persistent_value(avb_ops, name, strlen(value) + 1,
					    (const uint8_t *)value) ==
	    AVB_IO_RESULT_OK) {
		printf("Wrote %ld bytes\n", strlen(value) + 1);
		return CMD_RET_SUCCESS;
	}

	printf("Failed to write persistent value\n");

	return CMD_RET_FAILURE;
}

static cmd_tbl_t cmd_avb[] = {
	U_BOOT_CMD_MKENT(init, 2, 0, do_avb_init, "", ""),
	U_BOOT_CMD_MKENT(read_rb, 2, 0, do_avb_read_rb, "", ""),
	U_BOOT_CMD_MKENT(write_rb, 3, 0, do_avb_write_rb, "", ""),
	U_BOOT_CMD_MKENT(is_unlocked, 1, 0, do_avb_is_unlocked, "", ""),
	U_BOOT_CMD_MKENT(get_uuid, 2, 0, do_avb_get_uuid, "", ""),
	U_BOOT_CMD_MKENT(read_part, 5, 0, do_avb_read_part, "", ""),
	U_BOOT_CMD_MKENT(read_part_hex, 4, 0, do_avb_read_part_hex, "", ""),
	U_BOOT_CMD_MKENT(write_part, 5, 0, do_avb_write_part, "", ""),
	U_BOOT_CMD_MKENT(verify, 1, 0, do_avb_verify_part, "", ""),
#ifdef CONFIG_OPTEE_TA_AVB
	U_BOOT_CMD_MKENT(read_pvalue, 3, 0, do_avb_read_pvalue, "", ""),
	U_BOOT_CMD_MKENT(write_pvalue, 3, 0, do_avb_write_pvalue, "", ""),
#endif
};

static int do_avb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Example #6
0
	} else if (strcmp(argv[1], "get") == 0) {
		vpu_clk_get();
	} else {
		ret = -1;
	}
	return ret;
}

static int do_vpu_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	vcbus_test();
	return 0;
}

static cmd_tbl_t cmd_vpu_sub[] = {
	U_BOOT_CMD_MKENT(probe, 2, 0, do_vpu_enable, "", ""),
	U_BOOT_CMD_MKENT(remove, 2, 0, do_vpu_disable, "", ""),
	U_BOOT_CMD_MKENT(clk, 3, 0, do_vpu_clk, "", ""),
	U_BOOT_CMD_MKENT(test, 2, 0, do_vpu_test, "", ""),
};

static int do_vpu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	cmd_tbl_t *c;

	/* Strip off leading 'bmp' command argument */
	argc--;
	argv++;

	c = find_cmd_tbl(argv[0], &cmd_vpu_sub[0], ARRAY_SIZE(cmd_vpu_sub));
Example #7
0
		printf("No bootstage stash area defined\n");
		return 1;
	}

	if (0 == strcmp(argv[0], "stash"))
		ret = bootstage_stash((void *)base, size);
	else
		ret = bootstage_unstash((void *)base, size);
	if (ret)
		return 1;

	return 0;
}

static cmd_tbl_t cmd_bootstage_sub[] = {
	U_BOOT_CMD_MKENT(report, 2, 1, do_bootstage_report, "", ""),
	U_BOOT_CMD_MKENT(stash, 4, 0, do_bootstage_stash, "", ""),
	U_BOOT_CMD_MKENT(unstash, 4, 0, do_bootstage_stash, "", ""),
};

/*
 * Process a bootstage sub-command
 */
static int do_boostage(cmd_tbl_t *cmdtp, int flag, int argc,
		       char * const argv[])
{
	cmd_tbl_t *c;

	/* Strip off leading 'bootstage' command argument */
	argc--;
	argv++;
Example #8
0
		addr = (volatile unsigned int *)simple_strtoul(argv[2], NULL, 10);
		value = simple_strtoul(argv[3], NULL, 10);
		drv->write_reg((volatile unsigned int *)addr, value);
	} else if(!strcmp(argv[1], "read")) {
		addr = (volatile unsigned int *)simple_strtoul(argv[2], NULL, 10);
		value = simple_strtoul(argv[3], NULL, 10);
		drv->read_reg((volatile unsigned int *)addr, value);
		printf("read reg\n");
	} else
		return CMD_RET_USAGE;
	return CMD_RET_SUCCESS;
}


static cmd_tbl_t cmd_ir_sub[] = {
	U_BOOT_CMD_MKENT(open, 1, 1, do_ir_open, "", ""),
	U_BOOT_CMD_MKENT(close, 1, 1, do_ir_close, "", ""),
	U_BOOT_CMD_MKENT(test, 2, 1, do_ir_test, "", ""),
	U_BOOT_CMD_MKENT(send, 2, 1, do_ir_send, "", ""),
	U_BOOT_CMD_MKENT(set, 3, 1, do_ir_set, "", ""),
	U_BOOT_CMD_MKENT(get, 2, 1, do_ir_get, "", ""),
	U_BOOT_CMD_MKENT(reg, 4, 1, do_ir_reg, "", ""),
};

static int do_irblaster (cmd_tbl_t *cmdtp, int flag, int argc,
	char *const argv[])
{
	cmd_tbl_t *c;

	if (argc < 2)
		return CMD_RET_USAGE;
Example #9
0
			  int argc, char * const argv[])
{
	unsigned blocks_per_entry, max_entries;
	if (argc != 3)
		return CMD_RET_USAGE;

	blocks_per_entry = simple_strtoul(argv[1], 0, 0);
	max_entries = simple_strtoul(argv[2], 0, 0);
	blkcache_configure(blocks_per_entry, max_entries);
	printf("changed to max of %u entries of %u blocks each\n",
	       max_entries, blocks_per_entry);
	return 0;
}

static cmd_tbl_t cmd_blkc_sub[] = {
	U_BOOT_CMD_MKENT(show, 0, 0, blkc_show, "", ""),
	U_BOOT_CMD_MKENT(configure, 3, 0, blkc_configure, "", ""),
};

static __maybe_unused void blkc_reloc(void)
{
	static int relocated;

	if (!relocated) {
		fixup_cmdtable(cmd_blkc_sub, ARRAY_SIZE(cmd_blkc_sub));
		relocated = 1;
	};
}

static int do_blkcache(cmd_tbl_t *cmdtp, int flag,
		       int argc, char * const argv[])
Example #10
0
}

static int do_sandbox_ls(cmd_tbl_t *cmdtp, int flag, int argc,
			   char * const argv[])
{
	return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
}

static int do_sandbox_save(cmd_tbl_t *cmdtp, int flag, int argc,
			   char * const argv[])
{
	return do_save(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX, 16);
}

static cmd_tbl_t cmd_sandbox_sub[] = {
	U_BOOT_CMD_MKENT(load, 7, 0, do_sandbox_load, "", ""),
	U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, "", ""),
	U_BOOT_CMD_MKENT(save, 6, 0, do_sandbox_save, "", ""),
};

static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc,
		      char * const argv[])
{
	cmd_tbl_t *c;

	/* Skip past 'sandbox' */
	argc--;
	argv++;

	c = find_cmd_tbl(argv[0], cmd_sandbox_sub,
			 ARRAY_SIZE(cmd_sandbox_sub));
Example #11
0
File: osd.c Project: Noltari/u-boot
			osd_no = -1;
		printf("Current osd is %d\n", osd_no);
	} else {
		osd_no = simple_strtoul(argv[1], NULL, 10);
		printf("Setting osd to %d\n", osd_no);

		res = cmd_osd_set_osd_num(osd_no);
		if (res)
			printf("Failure changing osd number (err = %d)\n", res);
	}

	return res ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
}

static cmd_tbl_t cmd_osd_sub[] = {
	U_BOOT_CMD_MKENT(show, 1, 1, do_show_osd, "", ""),
	U_BOOT_CMD_MKENT(dev, 1, 1, do_osd_num, "", ""),
	U_BOOT_CMD_MKENT(write, 4, 1, do_osd_write, "", ""),
	U_BOOT_CMD_MKENT(print, 4, 1, do_osd_print, "", ""),
	U_BOOT_CMD_MKENT(size, 2, 1, do_osd_size, "", ""),
};

static int do_osd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	cmd_tbl_t *c;

	if (argc < 2)
		return CMD_RET_USAGE;

	/* Strip off leading 'osd' command argument */
	argc--;
Example #12
0
#include <fs.h>

static int do_sandbox_load(cmd_tbl_t *cmdtp, int flag, int argc,
			   char * const argv[])
{
	return do_load(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX, 16);
}

static int do_sandbox_ls(cmd_tbl_t *cmdtp, int flag, int argc,
			   char * const argv[])
{
	return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
}

static cmd_tbl_t cmd_sandbox_sub[] = {
	U_BOOT_CMD_MKENT(load, 3, 0, do_sandbox_load, "", ""),
	U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, "", ""),
};

static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc,
		      char * const argv[])
{
	cmd_tbl_t *c;

	/* Skip past 'sandbox' */
	argc--;
	argv++;

	c = find_cmd_tbl(argv[0], cmd_sandbox_sub,
			 ARRAY_SIZE(cmd_sandbox_sub));
Example #13
0
	case 4:
		addr = simple_strtoul(argv[1], NULL, 16);
		x = simple_strtoul(argv[2], NULL, 10);
		y = simple_strtoul(argv[3], NULL, 10);
		break;
	default:
		return CMD_RET_USAGE;
	}

	ret = video_display_bitmap((unsigned long)addr, x, y);

	return ret;
}

static cmd_tbl_t cmd_osd_sub[] = {
	U_BOOT_CMD_MKENT(open, 2, 0, do_osd_open, "", ""),
	U_BOOT_CMD_MKENT(enable, 2, 0, do_osd_enable, "", ""),
	U_BOOT_CMD_MKENT(close, 2, 0, do_osd_close, "", ""),
	U_BOOT_CMD_MKENT(clear, 2, 0, do_osd_clear, "", ""),
	U_BOOT_CMD_MKENT(debug, 2, 0, do_osd_debug, "", ""),
	U_BOOT_CMD_MKENT(test, 2, 0, do_osd_test, "", ""),
	U_BOOT_CMD_MKENT(display, 5, 0, do_osd_display, "", ""),
};

static int do_osd(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{
	cmd_tbl_t *c;

	/* Strip off leading 'osd' command argument */
	argc--;
	argv++;
        store_dbg("command: %s\n", str);
        ret = run_command(str, 0);
        if (ret != 0) {
            store_msg("amlmmc cmd %s failed \n",cmd);
            return -1;
        }
        return ret;
    }else{
        store_dbg("CARD BOOT, %s %d ",__func__,__LINE__);
        return CMD_RET_FAILURE;
    }
    return ret;
}

static cmd_tbl_t cmd_store_sub[] = {
    U_BOOT_CMD_MKENT(init,          4, 0, do_store_init, "", ""),
    U_BOOT_CMD_MKENT(exit,          3, 0, do_store_exit, "", ""),
    U_BOOT_CMD_MKENT(disprotect,    3, 0, do_store_disprotect, "", ""),
    U_BOOT_CMD_MKENT(rom_protect,   5, 0, do_store_rom_protect, "", ""),
    U_BOOT_CMD_MKENT(size,          5, 0, do_store_size, "", ""),
    U_BOOT_CMD_MKENT(scrub,         3, 0, do_store_scrub, "", ""),
    U_BOOT_CMD_MKENT(erase,         5, 0, do_store_erase, "", ""),
    U_BOOT_CMD_MKENT(read,          6, 0, do_store_read, "", ""),
    U_BOOT_CMD_MKENT(write,         6, 0, do_store_write, "", ""),
    U_BOOT_CMD_MKENT(rom_read,      5, 0, do_store_rom_read, "", ""),
    U_BOOT_CMD_MKENT(rom_write,     5, 0, do_store_rom_write, "", ""),
    U_BOOT_CMD_MKENT(dtb,           5, 0, do_store_dtb_ops, "", ""),
    U_BOOT_CMD_MKENT(key,           5, 0, do_store_key_ops, "", ""),
};

static int do_store(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
Example #15
0
	printf("\n");

	printf("read       ");
	tmp = ds4510_gpio_read_val(chip);
	if (tmp == -1)
		return -1;
	for (i = DS4510_NUM_IO - 1; i >= 0; i--)
		printf("%d", (tmp & (1 << i)) ? 1 : 0);
	printf("\n");

	return 0;
}
#endif /* CONFIG_CMD_DS4510_INFO */

cmd_tbl_t cmd_ds4510[] = {
	U_BOOT_CMD_MKENT(device, 3, 0, (void *)DS4510_CMD_DEVICE, "", ""),
	U_BOOT_CMD_MKENT(nv, 3, 0, (void *)DS4510_CMD_NV, "", ""),
	U_BOOT_CMD_MKENT(output, 4, 0, (void *)DS4510_CMD_OUTPUT, "", ""),
	U_BOOT_CMD_MKENT(input, 3, 0, (void *)DS4510_CMD_INPUT, "", ""),
	U_BOOT_CMD_MKENT(pullup, 4, 0, (void *)DS4510_CMD_PULLUP, "", ""),
#ifdef CONFIG_CMD_DS4510_INFO
	U_BOOT_CMD_MKENT(info, 2, 0, (void *)DS4510_CMD_INFO, "", ""),
#endif
#ifdef CONFIG_CMD_DS4510_RST
	U_BOOT_CMD_MKENT(rstdelay, 3, 0, (void *)DS4510_CMD_RSTDELAY, "", ""),
#endif
#ifdef CONFIG_CMD_DS4510_MEM
	U_BOOT_CMD_MKENT(eeprom, 6, 0, (void *)DS4510_CMD_EEPROM, "", ""),
	U_BOOT_CMD_MKENT(seeprom, 6, 0, (void *)DS4510_CMD_SEEPROM, "", ""),
	U_BOOT_CMD_MKENT(sram, 6, 0, (void *)DS4510_CMD_SRAM, "", ""),
#endif
Example #16
0
{
	dm_dump_uclass();

	return 0;
}

static int do_dm_dump_devres(cmd_tbl_t *cmdtp, int flag, int argc,
			     char * const argv[])
{
	dm_dump_devres();

	return 0;
}

static cmd_tbl_t test_commands[] = {
	U_BOOT_CMD_MKENT(tree, 0, 1, do_dm_dump_all, "", ""),
	U_BOOT_CMD_MKENT(uclass, 1, 1, do_dm_dump_uclass, "", ""),
	U_BOOT_CMD_MKENT(devres, 1, 1, do_dm_dump_devres, "", ""),
};

static int do_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	cmd_tbl_t *test_cmd;
	int ret;

	if (argc < 2)
		return CMD_RET_USAGE;
	test_cmd = find_cmd_tbl(argv[1], test_commands,
				ARRAY_SIZE(test_commands));
	argc -= 2;
	argv += 2;
			if (ret == -ENOENT)
				puts("Not bound to a backing file\n");
			else if (ret == -ENODEV)
				puts("Invalid host device number\n");

			continue;
		}
		struct host_block_dev *host_dev = blk_dev->priv;
		printf("%12lu %s\n", (unsigned long)blk_dev->lba,
		       host_dev->filename);
	}
	return 0;
}

static cmd_tbl_t cmd_sandbox_sub[] = {
	U_BOOT_CMD_MKENT(load, 7, 0, do_sandbox_load, "", ""),
	U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, "", ""),
	U_BOOT_CMD_MKENT(save, 6, 0, do_sandbox_save, "", ""),
	U_BOOT_CMD_MKENT(bind, 3, 0, do_sandbox_bind, "", ""),
	U_BOOT_CMD_MKENT(info, 3, 0, do_sandbox_info, "", ""),
};

static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc,
		      char * const argv[])
{
	cmd_tbl_t *c;

	/* Skip past 'sandbox' */
	argc--;
	argv++;
Example #18
0
		ret = do_bootm(find_cmd("do_bootm"), 0, argc+2,
			bootm_argv);
		debug("Subcommand retcode: %d\n", ret);
		i++;
	}

	if (ret) {
		printf("ERROR prep subcommand failed!\n");
		return -1;
	}

	return 0;
}

static cmd_tbl_t cmd_spl_export_sub[] = {
	U_BOOT_CMD_MKENT(fdt, 0, 1, (void *)SPL_EXPORT_FDT, "", ""),
	U_BOOT_CMD_MKENT(atags, 0, 1, (void *)SPL_EXPORT_ATAGS, "", ""),
};

static int spl_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	const cmd_tbl_t *c;

	if (argc < 2) /* no subcommand */
		return cmd_usage(cmdtp);

	c = find_cmd_tbl(argv[1], &cmd_spl_export_sub[0],
		ARRAY_SIZE(cmd_spl_export_sub));
	if ((c) && ((int)c->cmd <= SPL_EXPORT_LAST)) {
		argc -= 2;
		argv += 2;
Example #19
0
int cmd_ut_category(const char *name, struct unit_test *tests, int n_ents,
		    int argc, char * const argv[])
{
	struct unit_test_state uts = { .fail_count = 0 };
	struct unit_test *test;

	if (argc == 1)
		printf("Running %d %s tests\n", n_ents, name);

	for (test = tests; test < tests + n_ents; test++) {
		if (argc > 1 && strcmp(argv[1], test->name))
			continue;
		printf("Test: %s\n", test->name);

		uts.start = mallinfo();

		test->func(&uts);
	}

	printf("Failures: %d\n", uts.fail_count);

	return uts.fail_count ? CMD_RET_FAILURE : 0;
}

static cmd_tbl_t cmd_ut_sub[] = {
	U_BOOT_CMD_MKENT(all, CONFIG_SYS_MAXARGS, 1, do_ut_all, "", ""),
#if defined(CONFIG_UT_DM)
	U_BOOT_CMD_MKENT(dm, CONFIG_SYS_MAXARGS, 1, do_ut_dm, "", ""),
#endif
#if defined(CONFIG_UT_ENV)
	U_BOOT_CMD_MKENT(env, CONFIG_SYS_MAXARGS, 1, do_ut_env, "", ""),
#endif
#ifdef CONFIG_UT_OVERLAY
	U_BOOT_CMD_MKENT(overlay, CONFIG_SYS_MAXARGS, 1, do_ut_overlay, "", ""),
#endif
#ifdef CONFIG_UT_LIB
	U_BOOT_CMD_MKENT(lib, CONFIG_SYS_MAXARGS, 1, do_ut_lib, "", ""),
#endif
#ifdef CONFIG_UT_TIME
	U_BOOT_CMD_MKENT(time, CONFIG_SYS_MAXARGS, 1, do_ut_time, "", ""),
#endif
#if CONFIG_IS_ENABLED(UT_UNICODE) && !defined(API_BUILD)
	U_BOOT_CMD_MKENT(unicode, CONFIG_SYS_MAXARGS, 1, do_ut_unicode, "", ""),
#endif
#ifdef CONFIG_SANDBOX
	U_BOOT_CMD_MKENT(compression, CONFIG_SYS_MAXARGS, 1, do_ut_compression,
			 "", ""),
	U_BOOT_CMD_MKENT(bloblist, CONFIG_SYS_MAXARGS, 1, do_ut_bloblist,
			 "", ""),
#endif
};

static int do_ut_all(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	int i;
	int retval;
	int any_fail = 0;

	for (i = 1; i < ARRAY_SIZE(cmd_ut_sub); i++) {
		printf("----Running %s tests----\n", cmd_ut_sub[i].name);
		retval = cmd_ut_sub[i].cmd(cmdtp, flag, 1, &cmd_ut_sub[i].name);
		if (!any_fail)
			any_fail = retval;
	}

	return any_fail;
}
Example #20
0
		printf("Input     %02Xh\n", prx.input);
		printf("UserWD    %02Xh\n", prx.ack2);
		printf("Sys WD    %02Xh\n", prx.ack3);
		printf("WD Timout %02Xh\n", prx.ack0);
		printf("eSysState %02Xh\n", prx.ack1);
	}

	return err;
}

static int do_mtc_help(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);

cmd_tbl_t cmd_mtc_sub[] = {
	U_BOOT_CMD_MKENT(led, 3, 1, do_mtc_led,
	"set state of leds",
	"[ledname] [state] [blink]\n"
	" - lednames: diag can1 can2 can3 can4 usbpwr usbbusy user1 user2\n"
	" - state: off red green orange\n"
	" - blink: blink interval in 100ms steps (1 - 10; 0 = static)\n"),
	U_BOOT_CMD_MKENT(key, 0, 1, do_mtc_key,
	"returns state of user key", ""),
	U_BOOT_CMD_MKENT(version, 0, 1, do_mtc_version,
	"returns firmware version of supervisor uC", ""),
	U_BOOT_CMD_MKENT(appreg, 0, 1, do_mtc_appreg,
	"reads appreg value and stores in environment variable 'appreg'", ""),
	U_BOOT_CMD_MKENT(digin, 1, 1, do_mtc_digin,
	"returns state of digital input",
	"<channel_num> - get state of digital input (1 or 2)\n"),
	U_BOOT_CMD_MKENT(digout, 2, 1, do_mtc_digout,
	"sets digital outputs",
	"<on|off> <on|off>- set state of digital output 1 and 2\n"),
	U_BOOT_CMD_MKENT(state, 0, 1, do_mtc_state,
Example #21
0
	if (!err) {
		printf("dump of received pub key structure:\n");
		print_byte_string(pub_key_buffer, pub_key_len);
	}
	return convert_return_code(err);
}

TPM_COMMAND_NO_ARG(tpm_end_oiap)

#endif /* CONFIG_TPM_AUTH_SESSIONS */

#define MAKE_TPM_CMD_ENTRY(cmd) \
	U_BOOT_CMD_MKENT(cmd, 0, 1, do_tpm_ ## cmd, "", "")

static cmd_tbl_t tpm_commands[] = {
	U_BOOT_CMD_MKENT(init, 0, 1,
			do_tpm_init, "", ""),
	U_BOOT_CMD_MKENT(startup, 0, 1,
			do_tpm_startup, "", ""),
	U_BOOT_CMD_MKENT(self_test_full, 0, 1,
			do_tpm_self_test_full, "", ""),
	U_BOOT_CMD_MKENT(continue_self_test, 0, 1,
			do_tpm_continue_self_test, "", ""),
	U_BOOT_CMD_MKENT(force_clear, 0, 1,
			do_tpm_force_clear, "", ""),
	U_BOOT_CMD_MKENT(physical_enable, 0, 1,
			do_tpm_physical_enable, "", ""),
	U_BOOT_CMD_MKENT(physical_disable, 0, 1,
			do_tpm_physical_disable, "", ""),
	U_BOOT_CMD_MKENT(nv_define_space, 0, 1,
			do_tpm_nv_define_space, "", ""),
	U_BOOT_CMD_MKENT(nv_read_value, 0, 1,
Example #22
0
        break;
    case 4:
        addr = simple_strtoul(argv[1], NULL, 16);
        x = simple_strtoul(argv[2], NULL, 10);
        y = simple_strtoul(argv[3], NULL, 10);
        break;
    default:
        cmd_usage(cmdtp);
        return 1;
    }

    return (bmp_display(addr, x, y));
}

static cmd_tbl_t cmd_bmp_sub[] = {
    U_BOOT_CMD_MKENT(info, 3, 0, do_bmp_info, "", ""),
    U_BOOT_CMD_MKENT(display, 5, 0, do_bmp_display, "", ""),
};

/*
 * Subroutine:  do_bmp
 *
 * Description: Handler for 'bmp' command..
 *
 * Inputs:	argv[1] contains the subcommand
 *
 * Return:      None
 *
 */
static int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
Example #23
0
#include <clk.h>

int __weak soc_clk_dump(void)
{
	puts("Not implemented\n");
	return 1;
}

static int do_clk_dump(cmd_tbl_t *cmdtp, int flag, int argc,
		       char *const argv[])
{
	return soc_clk_dump();
}

static cmd_tbl_t cmd_clk_sub[] = {
	U_BOOT_CMD_MKENT(dump, 1, 1, do_clk_dump, "", ""),
};

static int do_clk(cmd_tbl_t *cmdtp, int flag, int argc,
		  char *const argv[])
{
	cmd_tbl_t *c;

	if (argc < 2)
		return CMD_RET_USAGE;

	/* Strip off leading 'clk' command argument */
	argc--;
	argv++;

	c = find_cmd_tbl(argv[0], &cmd_clk_sub[0], ARRAY_SIZE(cmd_clk_sub));
Example #24
0
			       guid->data2, guid->data3);
			for (j = 0; j < ARRAY_SIZE(guid->data4); j++)
				printf("-%02x", guid->data4[j]);
		} else {
			printf("%42s", "Not Available");
		}
		printf("\n");
		hdr = get_next_hob(hdr);
		i++;
	}

	return 0;
}

static cmd_tbl_t fsp_commands[] = {
	U_BOOT_CMD_MKENT(hdr, 0, 1, do_hdr, "", ""),
	U_BOOT_CMD_MKENT(hob, 0, 1, do_hob, "", ""),
};

static int do_fsp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	cmd_tbl_t *fsp_cmd;
	int ret;

	if (argc < 2)
		return CMD_RET_USAGE;
	fsp_cmd = find_cmd_tbl(argv[1], fsp_commands, ARRAY_SIZE(fsp_commands));
	argc -= 2;
	argv += 2;
	if (!fsp_cmd || argc > fsp_cmd->maxargs)
		return CMD_RET_USAGE;
	ret |= do_vbexport_test_key(cmdtp, flag, argc, argv);
	ret |= do_vbexport_test_display(cmdtp, flag, argc, argv);
	ret |= do_vbexport_test_isshutdown(cmdtp, flag, argc, argv);
	if (!ret)
		VbExDebug("All tests passed!\n");
	return ret;
}

static int do_vbexport_init(cmd_tbl_t *cmdtp, int flag,
		int argc, char * const argv[])
{
	return cros_init();
}

static cmd_tbl_t cmd_vbexport_test_sub[] = {
	U_BOOT_CMD_MKENT(init, 0, 1, do_vbexport_init, "", ""),
	U_BOOT_CMD_MKENT(all, 0, 1, do_vbexport_test_all, "", ""),
	U_BOOT_CMD_MKENT(debug, 0, 1, do_vbexport_test_debug, "", ""),
	U_BOOT_CMD_MKENT(malloc, 0, 1, do_vbexport_test_malloc, "", ""),
	U_BOOT_CMD_MKENT(sleep, 0, 1, do_vbexport_test_sleep, "", ""),
	U_BOOT_CMD_MKENT(longsleep, 0, 1, do_vbexport_test_longsleep, "", ""),
	U_BOOT_CMD_MKENT(beep, 0, 1, do_vbexport_test_beep, "", ""),
	U_BOOT_CMD_MKENT(diskinfo, 0, 1, do_vbexport_test_diskinfo, "", ""),
	U_BOOT_CMD_MKENT(diskrw, 0, 1, do_vbexport_test_diskrw, "", ""),
	U_BOOT_CMD_MKENT(nvrw, 0, 1, do_vbexport_test_nvrw, "", ""),
	U_BOOT_CMD_MKENT(nvclear, 0, 1, do_vbexport_test_nvclear, "", ""),
	U_BOOT_CMD_MKENT(key, 0, 1, do_vbexport_test_key, "", ""),
	U_BOOT_CMD_MKENT(display, 0, 1, do_vbexport_test_display, "", ""),
	U_BOOT_CMD_MKENT(isshutdown, 0, 1, do_vbexport_test_isshutdown, "", ""),
	U_BOOT_CMD_MKENT(image, 0, 1, do_vbexport_test_image, "", ""),
};
Example #26
0
	if (((s = getenv("autostart")) != NULL) && (strcmp(s, "no") == 0)) {
		char buf[32];
		sprintf(buf, "%lX", images.os.image_len);
		setenv("filesize", buf);
		return 0;
	}
	appl = (int (*)(int, char *[]))ntohl(images.ep);
	(*appl)(argc-1, &argv[1]);

	return 0;
}

/* we overload the cmd field with our state machine info instead of a
 * function pointer */
cmd_tbl_t cmd_bootm_sub[] = {
	U_BOOT_CMD_MKENT(start, 0, 1, (void *)BOOTM_STATE_START, "", ""),
	U_BOOT_CMD_MKENT(loados, 0, 1, (void *)BOOTM_STATE_LOADOS, "", ""),
#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC)
	U_BOOT_CMD_MKENT(ramdisk, 0, 1, (void *)BOOTM_STATE_RAMDISK, "", ""),
#endif
#ifdef CONFIG_OF_LIBFDT
	U_BOOT_CMD_MKENT(fdt, 0, 1, (void *)BOOTM_STATE_FDT, "", ""),
#endif
	U_BOOT_CMD_MKENT(bdt, 0, 1, (void *)BOOTM_STATE_OS_BD_T, "", ""),
	U_BOOT_CMD_MKENT(cmdline, 0, 1, (void *)BOOTM_STATE_OS_CMDLINE, "", ""),
	U_BOOT_CMD_MKENT(prep, 0, 1, (void *)BOOTM_STATE_OS_PREP, "", ""),
	U_BOOT_CMD_MKENT(go, 0, 1, (void *)BOOTM_STATE_OS_GO, "", ""),
};

int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
Example #27
0
	if (argc > 2)
		freq = simple_strtoul(argv[2], NULL, 10);

	ret = uclass_first_device_err(UCLASS_SOUND, &dev);
	if (!ret)
		ret = sound_beep(dev, msec, freq);
	if (ret) {
		printf("Sound device failed to play (err=%d)\n", ret);
		return CMD_RET_FAILURE;
	}

	return 0;
}

static cmd_tbl_t cmd_sound_sub[] = {
	U_BOOT_CMD_MKENT(init, 0, 1, do_init, "", ""),
	U_BOOT_CMD_MKENT(play, 2, 1, do_play, "", ""),
};

/* process sound command */
static int do_sound(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{
	cmd_tbl_t *c;

	if (argc < 1)
		return CMD_RET_USAGE;

	/* Strip off leading 'sound' command argument */
	argc--;
	argv++;
Example #28
0
	printf("## %s: only one of \"-b\", \"-c\" or \"-t\" allowed\n",
		cmd);
	return 1;
}
#endif

#if defined(CONFIG_CMD_RUN)
extern int do_run(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
#endif

/*
 * New command line interface: "env" command with subcommands
 */
static cmd_tbl_t cmd_env_sub[] = {
#if defined(CONFIG_CMD_ASKENV)
	U_BOOT_CMD_MKENT(ask, CONFIG_SYS_MAXARGS, 1, do_env_ask, "", ""),
#endif
	U_BOOT_CMD_MKENT(default, 1, 0, do_env_default, "", ""),
	U_BOOT_CMD_MKENT(delete, 2, 0, do_env_delete, "", ""),
#if defined(CONFIG_CMD_EDITENV)
	U_BOOT_CMD_MKENT(edit, 2, 0, do_env_edit, "", ""),
#endif
#if defined(CONFIG_CMD_EXPORTENV)
	U_BOOT_CMD_MKENT(export, 4, 0, do_env_export, "", ""),
#endif
#if defined(CONFIG_CMD_GREPENV)
	U_BOOT_CMD_MKENT(grep, CONFIG_SYS_MAXARGS, 1, do_env_grep, "", ""),
#endif
#if defined(CONFIG_CMD_IMPORTENV)
	U_BOOT_CMD_MKENT(import, 5, 0, do_env_import, "", ""),
#endif
Example #29
0
                const char* filePath = argv[3];

                rc = optimus_read_keyfile_2_mem(filePath, keyVal, &keyValLen);
                if(rc){
                        _AML_KEY_ERR("Fail to read file[%s]\n", filePath);
                        return __LINE__;
                }
        }
        rc = optimus_keysburn_onekey(keyName, keyVal, keyValLen);

        return rc;
}


static cmd_tbl_t cmd_opt_key_burn[] = {
	U_BOOT_CMD_MKENT(probe,       4, 0, do_opt_keysburn_probe, "", ""),
	U_BOOT_CMD_MKENT(init,        3, 0, do_opt_keysburn_init, "", ""),
	U_BOOT_CMD_MKENT(uninit,      2, 0, do_opt_keysburn_uninit, "", ""),
	U_BOOT_CMD_MKENT(burn,        5, 0, do_opt_keysburn_burn, "", ""),
	U_BOOT_CMD_MKENT(misc,        6, 0, do_opt_keysburn_misc, "", ""),
};

static int do_aml_key_burn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
        int rc = 0;
	cmd_tbl_t *c;

        sprintf(_errInfo, "success");
	c = find_cmd_tbl(argv[1], cmd_opt_key_burn, ARRAY_SIZE(cmd_opt_key_burn));

        if(!c){