-/*
- * The commands in this table are sorted alphabetically by the
- * command name and in descending order by the command name string
- * length. This is to prevent conflicts in command name parsing.
- * Please ensure that new commands are added according to that rule.
- * Please use $(TOPDIR)/doc/README.commands as a reference AND make
- * sure it gets updated.
+#endif
+
+#ifdef CMD_DATA_SIZE
+int cmd_get_data_size(char* arg, int default_size)
+{
+ /* Check for a size specification .b, .w or .l.
+ */
+ int len = strlen(arg);
+ if (len > 2 && arg[len-2] == '.') {
+ switch (arg[len-1]) {
+ case 'b':
+ return 1;
+ case 'w':
+ return 2;
+ case 'l':
+ return 4;
+#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+ case 'q':
+ return 8;
+#endif
+ case 's':
+ return -2;
+ default:
+ return -1;
+ }
+ }
+ return default_size;
+}
+#endif
+
+#if defined(CONFIG_NEEDS_MANUAL_RELOC)
+DECLARE_GLOBAL_DATA_PTR;
+
+void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
+{
+ int i;
+
+ if (gd->reloc_off == 0)
+ return;
+
+ for (i = 0; i < size; i++) {
+ ulong addr;
+
+ addr = (ulong)(cmdtp->cmd) + gd->reloc_off;
+#if DEBUG_COMMANDS
+ printf("Command \"%s\": 0x%08lx => 0x%08lx\n",
+ cmdtp->name, (ulong)(cmdtp->cmd), addr);
+#endif
+ cmdtp->cmd =
+ (int (*)(struct cmd_tbl_s *, int, int, char * const []))addr;
+ addr = (ulong)(cmdtp->name) + gd->reloc_off;
+ cmdtp->name = (char *)addr;
+ if (cmdtp->usage) {
+ addr = (ulong)(cmdtp->usage) + gd->reloc_off;
+ cmdtp->usage = (char *)addr;
+ }
+#ifdef CONFIG_SYS_LONGHELP
+ if (cmdtp->help) {
+ addr = (ulong)(cmdtp->help) + gd->reloc_off;
+ cmdtp->help = (char *)addr;
+ }
+#endif
+#ifdef CONFIG_AUTO_COMPLETE
+ if (cmdtp->complete) {
+ addr = (ulong)(cmdtp->complete) + gd->reloc_off;
+ cmdtp->complete =
+ (int (*)(int, char * const [], char, int, char * []))addr;
+ }
+#endif
+ cmdtp++;
+ }
+}
+#endif
+
+/**
+ * Call a command function. This should be the only route in U-Boot to call
+ * a command, so that we can track whether we are waiting for input or
+ * executing a command.
+ *
+ * @param cmdtp Pointer to the command to execute
+ * @param flag Some flags normally 0 (see CMD_FLAG_.. above)
+ * @param argc Number of arguments (arg 0 must be the command text)
+ * @param argv Arguments
+ * @return 0 if command succeeded, else non-zero (CMD_RET_...)