summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig5
-rw-r--r--cmd/Makefile1
-rw-r--r--cmd/bmp.c9
-rw-r--r--cmd/booti.c4
-rw-r--r--cmd/bootm.c5
-rw-r--r--cmd/bootz.c5
-rw-r--r--cmd/cramfs.c5
-rw-r--r--cmd/disk.c3
-rw-r--r--cmd/elf.c5
-rw-r--r--cmd/fat.c2
-rw-r--r--cmd/fdc.c752
-rw-r--r--cmd/jffs2.c5
-rw-r--r--cmd/load.c10
-rw-r--r--cmd/mem.c57
-rw-r--r--cmd/mvebu/bubt.c7
-rw-r--r--cmd/nand.c3
-rw-r--r--cmd/net.c13
-rw-r--r--cmd/pxe.c2
-rw-r--r--cmd/pxe_utils.c5
-rw-r--r--cmd/reiser.c2
-rw-r--r--cmd/source.c8
-rw-r--r--cmd/ti/ddr3.c1
-rw-r--r--cmd/tpm_test.c1
-rw-r--r--cmd/ximg.c2
-rw-r--r--cmd/zfs.c2
25 files changed, 88 insertions, 826 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 298feae24d..b1a1cbcab2 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -858,11 +858,6 @@ config CMD_FASTBOOT
See doc/android/fastboot.txt for more information.
-config CMD_FDC
- bool "fdcboot - Boot from floppy device"
- help
- The 'fdtboot' command allows booting an image from a floppy disk.
-
config CMD_FLASH
bool "flinfo, erase, protect"
default y
diff --git a/cmd/Makefile b/cmd/Makefile
index ecf687d49f..6afdf65507 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -58,7 +58,6 @@ obj-$(CONFIG_HUSH_PARSER) += exit.o
obj-$(CONFIG_CMD_EXT4) += ext4.o
obj-$(CONFIG_CMD_EXT2) += ext2.o
obj-$(CONFIG_CMD_FAT) += fat.o
-obj-$(CONFIG_CMD_FDC) += fdc.o
obj-$(CONFIG_CMD_FDT) += fdt.o
obj-$(CONFIG_CMD_FITUPD) += fitupd.o
obj-$(CONFIG_CMD_FLASH) += flash.o
diff --git a/cmd/bmp.c b/cmd/bmp.c
index d2a39f677f..edf4f56426 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -13,6 +13,7 @@
#include <command.h>
#include <dm.h>
#include <gzip.h>
+#include <image.h>
#include <lcd.h>
#include <malloc.h>
#include <mapmem.h>
@@ -95,8 +96,8 @@ static int do_bmp_info(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[
ulong addr;
switch (argc) {
- case 1: /* use load_addr as default address */
- addr = load_addr;
+ case 1: /* use image_load_addr as default address */
+ addr = image_load_addr;
break;
case 2: /* use argument */
addr = simple_strtoul(argv[1], NULL, 16);
@@ -116,8 +117,8 @@ static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int argc, char * const ar
splash_get_pos(&x, &y);
switch (argc) {
- case 1: /* use load_addr as default address */
- addr = load_addr;
+ case 1: /* use image_load_addr as default address */
+ addr = image_load_addr;
break;
case 2: /* use argument */
addr = simple_strtoul(argv[1], NULL, 16);
diff --git a/cmd/booti.c b/cmd/booti.c
index d0671deb75..de5058236e 100644
--- a/cmd/booti.c
+++ b/cmd/booti.c
@@ -30,9 +30,9 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
/* Setup Linux kernel Image entry point */
if (!argc) {
- ld = load_addr;
+ ld = image_load_addr;
debug("* kernel: default image load address = 0x%08lx\n",
- load_addr);
+ image_load_addr);
} else {
ld = simple_strtoul(argv[0], NULL, 16);
debug("* kernel: cmdline image address = 0x%08lx\n", ld);
diff --git a/cmd/bootm.c b/cmd/bootm.c
index 62ee7c4b8a..931d53f0c7 100644
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
@@ -144,7 +144,8 @@ int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
char *local_args[2];
local_args[0] = (char *)cmd;
local_args[1] = NULL;
- printf("Automatic boot of image at addr 0x%08lX ...\n", load_addr);
+ printf("Automatic boot of image at addr 0x%08lX ...\n",
+ image_load_addr);
return do_bootm(cmdtp, 0, 1, local_args);
}
@@ -232,7 +233,7 @@ static int do_iminfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int rcode = 0;
if (argc < 2) {
- return image_info(load_addr);
+ return image_info(image_load_addr);
}
for (arg = 1; arg < argc; ++arg) {
diff --git a/cmd/bootz.c b/cmd/bootz.c
index 74be62c2c5..f14a5fefbf 100644
--- a/cmd/bootz.c
+++ b/cmd/bootz.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <bootm.h>
#include <command.h>
+#include <image.h>
#include <irq_func.h>
#include <lmb.h>
#include <linux/compiler.h>
@@ -33,9 +34,9 @@ static int bootz_start(cmd_tbl_t *cmdtp, int flag, int argc,
/* Setup Linux kernel zImage entry point */
if (!argc) {
- images->ep = load_addr;
+ images->ep = image_load_addr;
debug("* kernel: default image load address = 0x%08lx\n",
- load_addr);
+ image_load_addr);
} else {
images->ep = simple_strtoul(argv[0], NULL, 16);
debug("* kernel: cmdline image address = 0x%08lx\n",
diff --git a/cmd/cramfs.c b/cmd/cramfs.c
index 2188910b2a..ad232deae0 100644
--- a/cmd/cramfs.c
+++ b/cmd/cramfs.c
@@ -13,6 +13,7 @@
#include <common.h>
#include <command.h>
#include <env.h>
+#include <image.h>
#include <malloc.h>
#include <mapmem.h>
#include <linux/list.h>
@@ -97,7 +98,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char *filename;
int size;
- ulong offset = load_addr;
+ ulong offset = image_load_addr;
char *offset_virt;
struct part_info part;
@@ -127,7 +128,7 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
if (argc == 3) {
offset = simple_strtoul(argv[1], NULL, 0);
- load_addr = offset;
+ image_load_addr = offset;
filename = argv[2];
}
diff --git a/cmd/disk.c b/cmd/disk.c
index 437c175374..15973b7d13 100644
--- a/cmd/disk.c
+++ b/cmd/disk.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
#include <cpu_func.h>
+#include <image.h>
#include <part.h>
int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
@@ -124,7 +125,7 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
flush_cache(addr, (cnt+1)*info.blksz);
/* Loading ok, update default load address */
- load_addr = addr;
+ image_load_addr = addr;
return bootm_maybe_autostart(cmdtp, argv[0]);
}
diff --git a/cmd/elf.c b/cmd/elf.c
index 32f12a72b9..ba06df06cf 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -18,6 +18,7 @@
#include <cpu_func.h>
#include <elf.h>
#include <env.h>
+#include <image.h>
#include <net.h>
#include <vxworks.h>
#ifdef CONFIG_X86
@@ -294,7 +295,7 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* Consume address */
argc--; argv++;
} else
- addr = load_addr;
+ addr = image_load_addr;
if (!valid_elf_image(addr))
return 1;
@@ -348,7 +349,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* If we don't know where the image is then we're done.
*/
if (argc < 2)
- addr = load_addr;
+ addr = image_load_addr;
else
addr = simple_strtoul(argv[1], NULL, 16);
diff --git a/cmd/fat.c b/cmd/fat.c
index 4b9a7eaab0..50df127f6d 100644
--- a/cmd/fat.c
+++ b/cmd/fat.c
@@ -31,7 +31,7 @@ U_BOOT_CMD(
" and determine its size."
);
-int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_fat_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
return do_load(cmdtp, flag, argc, argv, FS_TYPE_FAT);
}
diff --git a/cmd/fdc.c b/cmd/fdc.c
deleted file mode 100644
index 7d4b829637..0000000000
--- a/cmd/fdc.c
+++ /dev/null
@@ -1,752 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2001
- * Denis Peter, MPL AG, d.peter@mpl.ch.
- */
-/*
- * Floppy Disk support
- */
-
-#include <common.h>
-#include <config.h>
-#include <command.h>
-#include <image.h>
-#include <irq_func.h>
-
-
-#undef FDC_DEBUG
-
-#ifdef FDC_DEBUG
-#define PRINTF(fmt,args...) printf (fmt ,##args)
-#else
-#define PRINTF(fmt,args...)
-#endif
-
-/*#if defined(CONFIG_CMD_DATE) */
-/*#include <rtc.h> */
-/*#endif */
-
-typedef struct {
- int flags; /* connected drives ect */
- unsigned long blnr; /* Logical block nr */
- uchar drive; /* drive no */
- uchar cmdlen; /* cmd length */
- uchar cmd[16]; /* cmd desc */
- uchar dma; /* if > 0 dma enabled */
- uchar result[11]; /* status information */
- uchar resultlen; /* lenght of result */
-} FDC_COMMAND_STRUCT;
-
-/* flags: only the lower 8bit used:
- * bit 0 if set drive 0 is present
- * bit 1 if set drive 1 is present
- * bit 2 if set drive 2 is present
- * bit 3 if set drive 3 is present
- * bit 4 if set disk in drive 0 is inserted
- * bit 5 if set disk in drive 1 is inserted
- * bit 6 if set disk in drive 2 is inserted
- * bit 7 if set disk in drive 4 is inserted
- */
-
-/* cmd indexes */
-#define COMMAND 0
-#define DRIVE 1
-#define CONFIG0 1
-#define SPEC_HUTSRT 1
-#define TRACK 2
-#define CONFIG1 2
-#define SPEC_HLT 2
-#define HEAD 3
-#define CONFIG2 3
-#define SECTOR 4
-#define SECTOR_SIZE 5
-#define LAST_TRACK 6
-#define GAP 7
-#define DTL 8
-/* result indexes */
-#define STATUS_0 0
-#define STATUS_PCN 1
-#define STATUS_1 1
-#define STATUS_2 2
-#define STATUS_TRACK 3
-#define STATUS_HEAD 4
-#define STATUS_SECT 5
-#define STATUS_SECT_SIZE 6
-
-
-/* Register addresses */
-#define FDC_BASE 0x3F0
-#define FDC_SRA FDC_BASE + 0 /* Status Register A */
-#define FDC_SRB FDC_BASE + 1 /* Status Register B */
-#define FDC_DOR FDC_BASE + 2 /* Digital Output Register */
-#define FDC_TDR FDC_BASE + 3 /* Tape Drive Register */
-#define FDC_DSR FDC_BASE + 4 /* Data rate Register */
-#define FDC_MSR FDC_BASE + 4 /* Main Status Register */
-#define FDC_FIFO FDC_BASE + 5 /* FIFO */
-#define FDC_DIR FDC_BASE + 6 /* Digital Input Register */
-#define FDC_CCR FDC_BASE + 7 /* Configuration Control */
-/* Commands */
-#define FDC_CMD_SENSE_INT 0x08
-#define FDC_CMD_CONFIGURE 0x13
-#define FDC_CMD_SPECIFY 0x03
-#define FDC_CMD_RECALIBRATE 0x07
-#define FDC_CMD_READ 0x06
-#define FDC_CMD_READ_TRACK 0x02
-#define FDC_CMD_READ_ID 0x0A
-#define FDC_CMD_DUMP_REG 0x0E
-#define FDC_CMD_SEEK 0x0F
-
-#define FDC_CMD_SENSE_INT_LEN 0x01
-#define FDC_CMD_CONFIGURE_LEN 0x04
-#define FDC_CMD_SPECIFY_LEN 0x03
-#define FDC_CMD_RECALIBRATE_LEN 0x02
-#define FDC_CMD_READ_LEN 0x09
-#define FDC_CMD_READ_TRACK_LEN 0x09
-#define FDC_CMD_READ_ID_LEN 0x02
-#define FDC_CMD_DUMP_REG_LEN 0x01
-#define FDC_CMD_SEEK_LEN 0x03
-
-#define FDC_FIFO_THR 0x0C
-#define FDC_FIFO_DIS 0x00
-#define FDC_IMPLIED_SEEK 0x01
-#define FDC_POLL_DIS 0x00
-#define FDC_PRE_TRK 0x00
-#define FDC_CONFIGURE FDC_FIFO_THR | (FDC_POLL_DIS<<4) | (FDC_FIFO_DIS<<5) | (FDC_IMPLIED_SEEK << 6)
-#define FDC_MFM_MODE 0x01 /* MFM enable */
-#define FDC_SKIP_MODE 0x00 /* skip enable */
-
-#define FDC_TIME_OUT 100000 /* time out */
-#define FDC_RW_RETRIES 3 /* read write retries */
-#define FDC_CAL_RETRIES 3 /* calibration and seek retries */
-
-
-/* Disk structure */
-typedef struct {
- unsigned int size; /* nr of sectors total */
- unsigned int sect; /* sectors per track */
- unsigned int head; /* nr of heads */
- unsigned int track; /* nr of tracks */
- unsigned int stretch; /* !=0 means double track steps */
- unsigned char gap; /* gap1 size */
- unsigned char rate; /* data rate. |= 0x40 for perpendicular */
- unsigned char spec1; /* stepping rate, head unload time */
- unsigned char fmt_gap;/* gap2 size */
- unsigned char hlt; /* head load time */
- unsigned char sect_code;/* Sector Size code */
- const char * name; /* used only for predefined formats */
-} FD_GEO_STRUCT;
-
-
-/* supported Floppy types (currently only one) */
-const static FD_GEO_STRUCT floppy_type[2] = {
- { 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,16,2,"H1440" }, /* 7 1.44MB 3.5" */
- { 0, 0,0, 0,0,0x00,0x00,0x00,0x00, 0,0,NULL }, /* end of table */
-};
-
-static FDC_COMMAND_STRUCT cmd; /* global command struct */
-
-/* If the boot drive number is undefined, we assume it's drive 0 */
-#ifndef CONFIG_SYS_FDC_DRIVE_NUMBER
-#define CONFIG_SYS_FDC_DRIVE_NUMBER 0
-#endif
-
-/* Hardware access */
-#ifndef CONFIG_SYS_ISA_IO_STRIDE
-#define CONFIG_SYS_ISA_IO_STRIDE 1
-#endif
-
-#ifndef CONFIG_SYS_ISA_IO_OFFSET
-#define CONFIG_SYS_ISA_IO_OFFSET 0
-#endif
-
-/* Supporting Functions */
-/* reads a Register of the FDC */
-unsigned char read_fdc_reg(unsigned int addr)
-{
- volatile unsigned char *val =
- (volatile unsigned char *)(CONFIG_SYS_ISA_IO_BASE_ADDRESS +
- (addr * CONFIG_SYS_ISA_IO_STRIDE) +
- CONFIG_SYS_ISA_IO_OFFSET);
-
- return val [0];
-}
-
-/* writes a Register of the FDC */
-void write_fdc_reg(unsigned int addr, unsigned char val)
-{
- volatile unsigned char *tmp =
- (volatile unsigned char *)(CONFIG_SYS_ISA_IO_BASE_ADDRESS +
- (addr * CONFIG_SYS_ISA_IO_STRIDE) +
- CONFIG_SYS_ISA_IO_OFFSET);
- tmp[0]=val;
-}
-
-/* waits for an interrupt (polling) */
-int wait_for_fdc_int(void)
-{
- unsigned long timeout;
- timeout = FDC_TIME_OUT;
- while((read_fdc_reg(FDC_SRA)&0x80)==0) {
- timeout--;
- udelay(10);
- if(timeout==0) /* timeout occurred */
- return false;
- }
- return true;
-}
-
-/* reads a byte from the FIFO of the FDC and checks direction and RQM bit
- of the MSR. returns -1 if timeout, or byte if ok */
-int read_fdc_byte(void)
-{
- unsigned long timeout;
- timeout = FDC_TIME_OUT;
- while((read_fdc_reg(FDC_MSR)&0xC0)!=0xC0) {
- /* direction out and ready */
- udelay(10);
- timeout--;
- if(timeout==0) /* timeout occurred */
- return -1;
- }
- return read_fdc_reg(FDC_FIFO);
-}
-
-/* if the direction of the FIFO is wrong, this routine is used to
- empty the FIFO. Should _not_ be used */
-int fdc_need_more_output(void)
-{
- unsigned char c;
- while((read_fdc_reg(FDC_MSR)&0xC0)==0xC0) {
- c=(unsigned char)read_fdc_byte();
- printf("Error: more output: %x\n",c);
- }
- return true;
-}
-
-
-/* writes a byte to the FIFO of the FDC and checks direction and RQM bit
- of the MSR */
-int write_fdc_byte(unsigned char val)
-{
- unsigned long timeout;
- timeout = FDC_TIME_OUT;
- while((read_fdc_reg(FDC_MSR)&0xC0)!=0x80) {
- /* direction in and ready for byte */
- timeout--;
- udelay(10);
- fdc_need_more_output();
- if(timeout==0) /* timeout occurred */
- return false;
- }
- write_fdc_reg(FDC_FIFO,val);
- return true;
-}
-
-/* sets up all FDC commands and issues it to the FDC. If
- the command causes direct results (no Execution Phase)
- the result is be read as well. */
-
-int fdc_issue_cmd(FDC_COMMAND_STRUCT *pCMD,FD_GEO_STRUCT *pFG)
-{
- int i;
- unsigned long head,track,sect,timeout;
- track = pCMD->blnr / (pFG->sect * pFG->head); /* track nr */
- sect = pCMD->blnr % (pFG->sect * pFG->head); /* remaining blocks */
- head = sect / pFG->sect; /* head nr */
- sect = sect % pFG->sect; /* remaining blocks */
- sect++; /* sectors are 1 based */
- PRINTF("Cmd 0x%02x Track %ld, Head %ld, Sector %ld, Drive %d (blnr %ld)\n",
- pCMD->cmd[0],track,head,sect,pCMD->drive,pCMD->blnr);
-
- if(head|=0) { /* max heads = 2 */
- pCMD->cmd[DRIVE]=pCMD->drive | 0x04; /* head 1 */
- pCMD->cmd[HEAD]=(unsigned char) head; /* head register */
- }
- else {
- pCMD->cmd[DRIVE]=pCMD->drive; /* head 0 */
- pCMD->cmd[HEAD]=(unsigned char) head; /* head register */
- }
- pCMD->cmd[TRACK]=(unsigned char) track; /* track */
- switch (pCMD->cmd[COMMAND]) {
- case FDC_CMD_READ:
- pCMD->cmd[SECTOR]=(unsigned char) sect; /* sector */
- pCMD->cmd[SECTOR_SIZE]=pFG->sect_code; /* sector size code */
- pCMD->cmd[LAST_TRACK]=pFG->sect; /* End of track */
- pCMD->cmd[GAP]=pFG->gap; /* gap */
- pCMD->cmd[DTL]=0xFF; /* DTL */
- pCMD->cmdlen=FDC_CMD_READ_LEN;
- pCMD->cmd[COMMAND]|=(FDC_MFM_MODE<<6); /* set MFM bit */
- pCMD->cmd[COMMAND]|=(FDC_SKIP_MODE<<5); /* set Skip bit */
- pCMD->resultlen=0; /* result only after execution */
- break;
- case FDC_CMD_SEEK:
- pCMD->cmdlen=FDC_CMD_SEEK_LEN;
- pCMD->resultlen=0; /* no result */
- break;
- case FDC_CMD_CONFIGURE:
- pCMD->cmd[CONFIG0]=0;
- pCMD->cmd[CONFIG1]=FDC_CONFIGURE; /* FIFO Threshold, Poll, Enable FIFO */
- pCMD->cmd[CONFIG2]=FDC_PRE_TRK; /* Precompensation Track */
- pCMD->cmdlen=FDC_CMD_CONFIGURE_LEN;
- pCMD->resultlen=0; /* no result */
- break;
- case FDC_CMD_SPECIFY:
- pCMD->cmd[SPEC_HUTSRT]=pFG->spec1;
- pCMD->cmd[SPEC_HLT]=(pFG->hlt)<<1; /* head load time */
- if(pCMD->dma==0)
- pCMD->cmd[SPEC_HLT]|=0x1; /* no dma */
- pCMD->cmdlen=FDC_CMD_SPECIFY_LEN;
- pCMD->resultlen=0; /* no result */
- break;
- case FDC_CMD_DUMP_REG:
- pCMD->cmdlen=FDC_CMD_DUMP_REG_LEN;
- pCMD->resultlen=10; /* 10 byte result */
- break;
- case FDC_CMD_READ_ID:
- pCMD->cmd[COMMAND]|=(FDC_MFM_MODE<<6); /* set MFM bit */
- pCMD->cmdlen=FDC_CMD_READ_ID_LEN;
- pCMD->resultlen=7; /* 7 byte result */
- break;
- case FDC_CMD_RECALIBRATE:
- pCMD->cmd[DRIVE]&=0x03; /* don't set the head bit */
- pCMD->cmdlen=FDC_CMD_RECALIBRATE_LEN;
- pCMD->resultlen=0; /* no result */
- break;
- break;
- case FDC_CMD_SENSE_INT:
- pCMD->cmdlen=FDC_CMD_SENSE_INT_LEN;
- pCMD->resultlen=2;
- break;
- }
- for(i=0;i<pCMD->cmdlen;i++) {
- /* PRINTF("write cmd%d = 0x%02X\n",i,pCMD->cmd[i]); */
- if (write_fdc_byte(pCMD->cmd[i]) == false) {
- PRINTF("Error: timeout while issue cmd%d\n",i);
- return false;
- }
- }
- timeout=FDC_TIME_OUT;
- for(i=0;i<pCMD->resultlen;i++) {
- while((read_fdc_reg(FDC_MSR)&0xC0)!=0xC0) {
- timeout--;
- if(timeout==0) {
- PRINTF(" timeout while reading result%d MSR=0x%02X\n",i,read_fdc_reg(FDC_MSR));
- return false;
- }
- }
- pCMD->result[i]=(unsigned char)read_fdc_byte();
- }
- return true;
-}
-
-/* selects the drive assigned in the cmd structur and
- switches on the Motor */
-void select_fdc_drive(FDC_COMMAND_STRUCT *pCMD)
-{
- unsigned char val;
-
- val=(1<<(4+pCMD->drive))|pCMD->drive|0xC; /* set reset, dma gate and motor bits */
- if((read_fdc_reg(FDC_DOR)&val)!=val) {
- write_fdc_reg(FDC_DOR,val);
- for(val=0;val<255;val++)
- udelay(500); /* wait some time to start motor */
- }
-}
-
-/* switches off the Motor of the specified drive */
-void stop_fdc_drive(FDC_COMMAND_STRUCT *pCMD)
-{
- unsigned char val;
-
- val=(1<<(4+pCMD->drive))|pCMD->drive; /* sets motor bits */
- write_fdc_reg(FDC_DOR,(read_fdc_reg(FDC_DOR)&~val));
-}
-
-/* issues a recalibrate command, waits for interrupt and
- * issues a sense_interrupt */
-int fdc_recalibrate(FDC_COMMAND_STRUCT *pCMD,FD_GEO_STRUCT *pFG)
-{
- pCMD->cmd[COMMAND]=FDC_CMD_RECALIBRATE;
- if (fdc_issue_cmd(pCMD, pFG) == false)
- return false;
- while (wait_for_fdc_int() != true);
-
- pCMD->cmd[COMMAND]=FDC_CMD_SENSE_INT;
- return(fdc_issue_cmd(pCMD,pFG));
-}
-
-/* issues a recalibrate command, waits for interrupt and
- * issues a sense_interrupt */
-int fdc_seek(FDC_COMMAND_STRUCT *pCMD,FD_GEO_STRUCT *pFG)
-{
- pCMD->cmd[COMMAND]=FDC_CMD_SEEK;
- if (fdc_issue_cmd(pCMD, pFG) == false)
- return false;
- while (wait_for_fdc_int() != true);
-
- pCMD->cmd[COMMAND]=FDC_CMD_SENSE_INT;
- return(fdc_issue_cmd(pCMD,pFG));
-}
-
-/* terminates current command, by not servicing the FIFO
- * waits for interrupt and fills in the result bytes */
-int fdc_terminate(FDC_COMMAND_STRUCT *pCMD)
-{
- int i;
- for(i=0;i<100;i++)
- udelay(500); /* wait 500usec for fifo overrun */
- while((read_fdc_reg(FDC_SRA)&0x80)==0x00); /* wait as long as no int has occurred */
- for(i=0;i<7;i++) {
- pCMD->result[i]=(unsigned char)read_fdc_byte();
- }
- return true;
-}
-
-/* reads data from FDC, seek commands are issued automatic */
-int fdc_read_data(unsigned char *buffer, unsigned long blocks,FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
-{
- /* first seek to start address */
- unsigned long len,readblk,i,timeout,ii,offset;
- unsigned char c,retriesrw,retriescal;
- unsigned char *bufferw; /* working buffer */
- int sect_size;
- int flags;
-
- flags=disable_interrupts(); /* switch off all Interrupts */
- select_fdc_drive(pCMD); /* switch on drive */
- sect_size=0x080<<pFG->sect_code;
- retriesrw=0;
- retriescal=0;
- offset=0;
- if (fdc_seek(pCMD, pFG) == false) {
- stop_fdc_drive(pCMD);
- if (flags)
- enable_interrupts();
- return false;
- }
- if((pCMD->result[STATUS_0]&0x20)!=0x20) {
- printf("Seek error Status: %02X\n",pCMD->result[STATUS_0]);
- stop_fdc_drive(pCMD);
- if (flags)
- enable_interrupts();
- return false;
- }
- /* now determine the next seek point */
- /* lastblk=pCMD->blnr + blocks; */
- /* readblk=(pFG->head*pFG->sect)-(pCMD->blnr%(pFG->head*pFG->sect)); */
- readblk=pFG->sect-(pCMD->blnr%pFG->sect);
- PRINTF("1st nr of block possible read %ld start %ld\n",readblk,pCMD->blnr);
- if(readblk>blocks) /* is end within 1st track */
- readblk=blocks; /* yes, correct it */
- PRINTF("we read %ld blocks start %ld\n",readblk,pCMD->blnr);
- bufferw = &buffer[0]; /* setup working buffer */
- do {
-retryrw:
- len=sect_size * readblk;
- pCMD->cmd[COMMAND]=FDC_CMD_READ;
- if (fdc_issue_cmd(pCMD, pFG) == false) {
- stop_fdc_drive(pCMD);
- if (flags)
- enable_interrupts();
- return false;
- }
- for (i=0;i<len;i++) {
- timeout=FDC_TIME_OUT;
- do {
- c=read_fdc_reg(FDC_MSR);
- if((c&0xC0)==0xC0) {
- bufferw[i]=read_fdc_reg(FDC_FIFO);
- break;
- }
- if((c&0xC0)==0x80) { /* output */
- PRINTF("Transfer error transferred: at %ld, MSR=%02X\n",i,c);
- if(i>6) {
- for(ii=0;ii<7;ii++) {
- pCMD->result[ii]=bufferw[(i-7+ii)];
- } /* for */
- }
- if(retriesrw++>FDC_RW_RETRIES) {
- if (retriescal++>FDC_CAL_RETRIES) {
- stop_fdc_drive(pCMD);
- if (flags)
- enable_interrupts();
- return false;
- }
- else {
- PRINTF(" trying to recalibrate Try %d\n",retriescal);
- if (fdc_recalibrate(pCMD, pFG) == false) {
- stop_fdc_drive(pCMD);
- if (flags)
- enable_interrupts();
- return false;
- }
- retriesrw=0;
- goto retrycal;
- } /* else >FDC_CAL_RETRIES */
- }
- else {
- PRINTF("Read retry %d\n",retriesrw);
- goto retryrw;
- } /* else >FDC_RW_RETRIES */
- }/* if output */
- timeout--;
- } while (true);
- } /* for len */
- /* the last sector of a track or all data has been read,
- * we need to get the results */
- fdc_terminate(pCMD);
- offset+=(sect_size*readblk); /* set up buffer pointer */
- bufferw = &buffer[offset];
- pCMD->blnr+=readblk; /* update current block nr */
- blocks-=readblk; /* update blocks */
- if(blocks==0)
- break; /* we are finish */
- /* setup new read blocks */
- /* readblk=pFG->head*pFG->sect; */
- readblk=pFG->sect;
- if(readblk>blocks)
- readblk=blocks;
-retrycal:
- /* a seek is necessary */
- if (fdc_seek(pCMD, pFG) == false) {
- stop_fdc_drive(pCMD);
- if (flags)
- enable_interrupts();
- return false;
- }
- if((pCMD->result[STATUS_0]&0x20)!=0x20) {
- PRINTF("Seek error Status: %02X\n",pCMD->result[STATUS_0]);
- stop_fdc_drive(pCMD);
- return false;
- }
- } while (true); /* start over */
- stop_fdc_drive(pCMD); /* switch off drive */
- if (flags)
- enable_interrupts();
- return true;
-}
-
-/* Scan all drives and check if drive is present and disk is inserted */
-int fdc_check_drive(FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
-{
- int i,drives,state;
- /* OK procedure of data book is satisfied.
- * trying to get some information over the drives */
- state=0; /* no drives, no disks */
- for(drives=0;drives<4;drives++) {
- pCMD->drive=drives;
- select_fdc_drive(pCMD);
- pCMD->blnr=0; /* set to the 1st block */
- if (fdc_recalibrate(pCMD, pFG) == false)
- continue;
- if((pCMD->result[STATUS_0]&0x10)==0x10)
- continue;
- /* ok drive connected check for disk */
- state|=(1<<drives);
- pCMD->blnr=pFG->size; /* set to the last block */
- if (fdc_seek(pCMD, pFG) == false)
- continue;
- pCMD->blnr=0; /* set to the 1st block */
- if (fdc_recalibrate(pCMD, pFG) == false)
- continue;
- pCMD->cmd[COMMAND]=FDC_CMD_READ_ID;
- if (fdc_issue_cmd(pCMD, pFG) == false)
- continue;
- state|=(0x10<<drives);
- }
- stop_fdc_drive(pCMD);
- for(i=0;i<4;i++) {
- PRINTF("Floppy Drive %d %sconnected %sDisk inserted %s\n",i,
- ((state&(1<<i))==(1<<i)) ? "":"not ",
- ((state&(0x10<<i))==(0x10<<i)) ? "":"no ",
- ((state&(0x10<<i))==(0x10<<i)) ? pFG->name : "");
- }
- pCMD->flags=state;
- return true;
-}
-
-
-/**************************************************************************
-* int fdc_setup
-* setup the fdc according the datasheet
-* assuming in PS2 Mode
-*/
-int fdc_setup(int drive, FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
-{
- int i;
-
-#ifdef CONFIG_SYS_FDC_HW_INIT
- fdc_hw_init ();
-#endif
- /* first, we reset the FDC via the DOR */
- write_fdc_reg(FDC_DOR,0x00);
- for(i=0; i<255; i++) /* then we wait some time */
- udelay(500);
- /* then, we clear the reset in the DOR */
- pCMD->drive=drive;
- select_fdc_drive(pCMD);
- /* initialize the CCR */
- write_fdc_reg(FDC_CCR,pFG->rate);
- /* then initialize the DSR */
- write_fdc_reg(FDC_DSR,pFG->rate);
- if (wait_for_fdc_int() == false) {
- PRINTF("Time Out after writing CCR\n");
- return false;
- }
- /* now issue sense Interrupt and status command
- * assuming only one drive present (drive 0) */
- pCMD->dma=0; /* we don't use any dma at all */
- for(i=0;i<4;i++) {
- /* issue sense interrupt for all 4 possible drives */
- pCMD->cmd[COMMAND]=FDC_CMD_SENSE_INT;
- if (fdc_issue_cmd(pCMD, pFG) == false) {
- PRINTF("Sense Interrupt for drive %d failed\n",i);
- }
- }
- /* issue the configure command */
- pCMD->drive=drive;
- select_fdc_drive(pCMD);
- pCMD->cmd[COMMAND]=FDC_CMD_CONFIGURE;
- if (fdc_issue_cmd(pCMD, pFG) == false) {
- PRINTF(" configure timeout\n");
- stop_fdc_drive(pCMD);
- return false;
- }
- /* issue specify command */
- pCMD->cmd[COMMAND]=FDC_CMD_SPECIFY;
- if (fdc_issue_cmd(pCMD, pFG) == false) {
- PRINTF(" specify timeout\n");
- stop_fdc_drive(pCMD);
- return false;
-
- }
- /* then, we clear the reset in the DOR */
- /* fdc_check_drive(pCMD,pFG); */
- /* write_fdc_reg(FDC_DOR,0x04); */
-
- return true;
-}
-
-/****************************************************************************
- * main routine do_fdcboot
- */
-int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
- FD_GEO_STRUCT *pFG = (FD_GEO_STRUCT *)floppy_type;
- FDC_COMMAND_STRUCT *pCMD = &cmd;
- unsigned long addr,imsize;
-#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
- image_header_t *hdr; /* used for fdc boot */
-#endif
- unsigned char boot_drive;
- int i,nrofblk;
-#if defined(CONFIG_FIT)
- const void *fit_hdr = NULL;
-#endif
-
- switch (argc) {
- case 1:
- addr = CONFIG_SYS_LOAD_ADDR;
- boot_drive=CONFIG_SYS_FDC_DRIVE_NUMBER;
- break;
- case 2:
- addr = simple_strtoul(argv[1], NULL, 16);
- boot_drive=CONFIG_SYS_FDC_DRIVE_NUMBER;
- break;
- case 3:
- addr = simple_strtoul(argv[1], NULL, 16);
- boot_drive=simple_strtoul(argv[2], NULL, 10);
- break;
- default:
- return CMD_RET_USAGE;
- }
- /* setup FDC and scan for drives */
- if (fdc_setup(boot_drive, pCMD, pFG) == false) {
- printf("\n** Error in setup FDC **\n");
- return 1;
- }
- if (fdc_check_drive(pCMD, pFG) == false) {
- printf("\n** Error in check_drives **\n");
- return 1;
- }
- if((pCMD->flags&(1<<boot_drive))==0) {
- /* drive not available */
- printf("\n** Drive %d not availabe **\n",boot_drive);
- return 1;
- }
- if((pCMD->flags&(0x10<<boot_drive))==0) {
- /* no disk inserted */
- printf("\n** No disk inserted in drive %d **\n",boot_drive);
- return 1;
- }
- /* ok, we have a valid source */
- pCMD->drive=boot_drive;
- /* read first block */
- pCMD->blnr=0;
- if (fdc_read_data((unsigned char *)addr, 1, pCMD, pFG) == false) {
- printf("\nRead error:");
- for(i=0;i<7;i++)
- printf("result%d: 0x%02X\n",i,pCMD->result[i]);
- return 1;
- }
-
- switch (genimg_get_format ((void *)addr)) {
-#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
- case IMAGE_FORMAT_LEGACY:
- hdr = (image_header_t *)addr;
- image_print_contents (hdr);
-
- imsize = image_get_image_size (hdr);
- break;
-#endif
-#if defined(CONFIG_FIT)
- case IMAGE_FORMAT_FIT:
- fit_hdr = (const void *)addr;
- puts ("Fit image detected...\n");
-
- imsize = fit_get_size (fit_hdr);
- break;
-#endif
- default:
- puts ("** Unknown image type\n");
- return 1;
- }
-
- nrofblk=imsize/512;
- if((imsize%512)>0)
- nrofblk++;
- printf("Loading %ld Bytes (%d blocks) at 0x%08lx..\n",imsize,nrofblk,addr);
- pCMD->blnr=0;
- if (fdc_read_data((unsigned char *)addr, nrofblk, pCMD, pFG) == false) {
- /* read image block */
- printf("\nRead error:");
- for(i=0;i<7;i++)
- printf("result%d: 0x%02X\n",i,pCMD->result[i]);
- return 1;
- }
- printf("OK %ld Bytes loaded.\n",imsize);
-
- flush_cache (addr, imsize);
-
-#if defined(CONFIG_FIT)
- /* This cannot be done earlier, we need complete FIT image in RAM first */
- if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
- if (!fit_check_format (fit_hdr)) {
- puts ("** Bad FIT image format\n");
- return 1;
- }
- fit_print_contents (fit_hdr);
- }
-#endif
-
- /* Loading ok, update default load address */
- load_addr = addr;
-
- return bootm_maybe_autostart(cmdtp, argv[0]);
-}
-
-U_BOOT_CMD(
- fdcboot, 3, 1, do_fdcboot,
- "boot from floppy device",
- "loadAddr drive"
-);
diff --git a/cmd/jffs2.c b/cmd/jffs2.c
index b47cd3d989..da2580d85d 100644
--- a/cmd/jffs2.c
+++ b/cmd/jffs2.c
@@ -73,6 +73,7 @@
#include <common.h>
#include <command.h>
#include <env.h>
+#include <image.h>
#include <malloc.h>
#include <jffs2/jffs2.h>
#include <linux/list.h>
@@ -476,7 +477,7 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
char *filename;
int size;
struct part_info *part;
- ulong offset = load_addr;
+ ulong offset = image_load_addr;
/* pre-set Boot file name */
filename = env_get("bootfile");
@@ -488,7 +489,7 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
if (argc == 3) {
offset = simple_strtoul(argv[1], NULL, 16);
- load_addr = offset;
+ image_load_addr = offset;
filename = argv[2];
}
diff --git a/cmd/load.c b/cmd/load.c
index 3bfc1b41ec..fab30fe894 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -12,6 +12,8 @@
#include <console.h>
#include <cpu_func.h>
#include <env.h>
+#include <flash.h>
+#include <image.h>
#include <s_record.h>
#include <net.h>
#include <exports.h>
@@ -108,7 +110,7 @@ static int do_load_serial(cmd_tbl_t *cmdtp, int flag, int argc,
rcode = 1;
} else {
printf("## Start Addr = 0x%08lX\n", addr);
- load_addr = addr;
+ image_load_addr = addr;
}
#ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
@@ -484,12 +486,12 @@ static int do_load_serial_bin(cmd_tbl_t *cmdtp, int flag, int argc,
addr = load_serial_bin(offset);
if (addr == ~0) {
- load_addr = 0;
+ image_load_addr = 0;
printf("## Binary (kermit) download aborted\n");
rcode = 1;
} else {
printf("## Start Addr = 0x%08lX\n", addr);
- load_addr = addr;
+ image_load_addr = addr;
}
}
if (load_baudrate != current_baudrate) {
@@ -980,7 +982,7 @@ static ulong load_serial_ymodem(ulong offset, int mode)
rc = flash_write((char *) ymodemBuf,
store_addr, res);
if (rc != 0) {
- flash_perror (rc);
+ flash_perror(rc);
return (~0);
}
} else
diff --git a/cmd/mem.c b/cmd/mem.c
index 4ec450b050..f32985ca7d 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -16,6 +16,7 @@
#include <cli.h>
#include <command.h>
#include <console.h>
+#include <flash.h>
#include <hash.h>
#include <mapmem.h>
#include <watchdog.h>
@@ -106,7 +107,7 @@ static int do_mem_nm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
u64 writeval;
#else
ulong writeval;
@@ -131,7 +132,7 @@ static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* Get the value to write.
*/
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
writeval = simple_strtoull(argv[2], NULL, 16);
#else
writeval = simple_strtoul(argv[2], NULL, 16);
@@ -150,7 +151,7 @@ static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
while (count-- > 0) {
if (size == 4)
*((u32 *)buf) = (u32)writeval;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
else if (size == 8)
*((u64 *)buf) = (u64)writeval;
#endif
@@ -227,7 +228,7 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int rcode = 0;
const char *type;
const void *buf1, *buf2, *base;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
u64 word1, word2;
#else
ulong word1, word2;
@@ -259,7 +260,7 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (size == 4) {
word1 = *(u32 *)buf1;
word2 = *(u32 *)buf2;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
} else if (size == 8) {
word1 = *(u64 *)buf1;
word2 = *(u64 *)buf2;
@@ -273,7 +274,7 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
if (word1 != word2) {
ulong offset = buf1 - base;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n",
type, (void *)(addr1 + offset), size, word1,
type, (void *)(addr2 + offset), size, word2);
@@ -339,7 +340,7 @@ static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
rc = flash_write((char *)src, (ulong)dst, count * size);
if (rc != 0) {
- flash_perror (rc);
+ flash_perror(rc);
unmap_sysmem(src);
unmap_sysmem(dst);
return (1);
@@ -377,7 +378,7 @@ static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
{
ulong addr, length, i, bytes;
int size;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
volatile u64 *llp;
#endif
volatile u32 *longp;
@@ -410,7 +411,7 @@ static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
* If we have only one object, just run infinite loops.
*/
if (length == 1) {
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
if (size == 8) {
llp = (u64 *)buf;
for (;;)
@@ -432,7 +433,7 @@ static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
i = *cp;
}
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
if (size == 8) {
for (;;) {
llp = (u64 *)buf;
@@ -475,7 +476,7 @@ static int do_mem_loopw(cmd_tbl_t *cmdtp, int flag, int argc,
{
ulong addr, length, i, bytes;
int size;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
volatile u64 *llp;
u64 data;
#else
@@ -505,7 +506,7 @@ static int do_mem_loopw(cmd_tbl_t *cmdtp, int flag, int argc,
length = simple_strtoul(argv[2], NULL, 16);
/* data to write */
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
data = simple_strtoull(argv[3], NULL, 16);
#else
data = simple_strtoul(argv[3], NULL, 16);
@@ -518,7 +519,7 @@ static int do_mem_loopw(cmd_tbl_t *cmdtp, int flag, int argc,
* If we have only one object, just run infinite loops.
*/
if (length == 1) {
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
if (size == 8) {
llp = (u64 *)buf;
for (;;)
@@ -540,7 +541,7 @@ static int do_mem_loopw(cmd_tbl_t *cmdtp, int flag, int argc,
*cp = data;
}
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
if (size == 8) {
for (;;) {
llp = (u64 *)buf;
@@ -967,7 +968,7 @@ static int
mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
{
ulong addr;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
u64 i;
#else
ulong i;
@@ -1006,7 +1007,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
printf("%08lx:", addr);
if (size == 4)
printf(" %08x", *((u32 *)ptr));
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
else if (size == 8)
printf(" %016llx", *((u64 *)ptr));
#endif
@@ -1033,7 +1034,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
#endif
else {
char *endp;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
i = simple_strtoull(console_buffer, &endp, 16);
#else
i = simple_strtoul(console_buffer, &endp, 16);
@@ -1045,7 +1046,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
bootretry_reset_cmd_timeout();
if (size == 4)
*((u32 *)ptr) = i;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
else if (size == 8)
*((u64 *)ptr) = i;
#endif
@@ -1139,7 +1140,7 @@ static int do_random(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
U_BOOT_CMD(
md, 3, 1, do_mem_md,
"memory display",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address [# of objects]"
#else
"[.b, .w, .l] address [# of objects]"
@@ -1150,7 +1151,7 @@ U_BOOT_CMD(
U_BOOT_CMD(
mm, 2, 1, do_mem_mm,
"memory modify (auto-incrementing address)",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address"
#else
"[.b, .w, .l] address"
@@ -1161,7 +1162,7 @@ U_BOOT_CMD(
U_BOOT_CMD(
nm, 2, 1, do_mem_nm,
"memory modify (constant address)",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address"
#else
"[.b, .w, .l] address"
@@ -1171,7 +1172,7 @@ U_BOOT_CMD(
U_BOOT_CMD(
mw, 4, 1, do_mem_mw,
"memory write (fill)",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address value [count]"
#else
"[.b, .w, .l] address value [count]"
@@ -1181,7 +1182,7 @@ U_BOOT_CMD(
U_BOOT_CMD(
cp, 4, 1, do_mem_cp,
"memory copy",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] source target count"
#else
"[.b, .w, .l] source target count"
@@ -1191,7 +1192,7 @@ U_BOOT_CMD(
U_BOOT_CMD(
cmp, 4, 1, do_mem_cmp,
"memory compare",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] addr1 addr2 count"
#else
"[.b, .w, .l] addr1 addr2 count"
@@ -1242,7 +1243,7 @@ U_BOOT_CMD(
U_BOOT_CMD(
loop, 3, 1, do_mem_loop,
"infinite loop on address range",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address number_of_objects"
#else
"[.b, .w, .l] address number_of_objects"
@@ -1253,7 +1254,7 @@ U_BOOT_CMD(
U_BOOT_CMD(
loopw, 4, 1, do_mem_loopw,
"infinite write loop on address range",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address number_of_objects data_to_write"
#else
"[.b, .w, .l] address number_of_objects data_to_write"
@@ -1273,7 +1274,7 @@ U_BOOT_CMD(
U_BOOT_CMD(
mdc, 4, 1, do_mem_mdc,
"memory display cyclic",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address count delay(ms)"
#else
"[.b, .w, .l] address count delay(ms)"
@@ -1283,7 +1284,7 @@ U_BOOT_CMD(
U_BOOT_CMD(
mwc, 4, 1, do_mem_mwc,
"memory write cyclic",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address value delay(ms)"
#else
"[.b, .w, .l] address value delay(ms)"
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index 84d2d531f0..2041a7a29a 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <command.h>
#include <env.h>
+#include <image.h>
#include <vsprintf.h>
#include <errno.h>
#include <dm.h>
@@ -423,8 +424,10 @@ static int is_usb_active(void)
#ifdef CONFIG_CMD_NET
static size_t tftp_read_file(const char *file_name)
{
- /* update global variable load_addr before tftp file from network */
- load_addr = get_load_addr();
+ /*
+ * update global variable image_load_addr before tftp file from network
+ */
+ image_load_addr = get_load_addr();
return net_loop(TFTPGET);
}
diff --git a/cmd/nand.c b/cmd/nand.c
index 5bda69e819..4de6892a01 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -20,6 +20,7 @@
*/
#include <common.h>
+#include <image.h>
#include <linux/mtd/mtd.h>
#include <command.h>
#include <console.h>
@@ -925,7 +926,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, struct mtd_info *mtd,
/* Loading ok, update default load address */
- load_addr = addr;
+ image_load_addr = addr;
return bootm_maybe_autostart(cmdtp, cmd);
}
diff --git a/cmd/net.c b/cmd/net.c
index 237403977e..1b724cc570 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <command.h>
#include <env.h>
+#include <image.h>
#include <net.h>
static int netboot_common(enum proto_t, cmd_tbl_t *, int, char * const []);
@@ -186,10 +187,10 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
net_boot_file_name_explicit = false;
- /* pre-set load_addr */
+ /* pre-set image_load_addr */
s = env_get("loadaddr");
if (s != NULL)
- load_addr = simple_strtoul(s, NULL, 16);
+ image_load_addr = simple_strtoul(s, NULL, 16);
switch (argc) {
case 1:
@@ -206,7 +207,7 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
*/
addr = simple_strtoul(argv[1], &end, 16);
if (end == (argv[1] + strlen(argv[1]))) {
- load_addr = addr;
+ image_load_addr = addr;
/* refresh bootfile name from env */
copy_filename(net_boot_file_name, env_get("bootfile"),
sizeof(net_boot_file_name));
@@ -218,7 +219,7 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
break;
case 3:
- load_addr = simple_strtoul(argv[1], NULL, 16);
+ image_load_addr = simple_strtoul(argv[1], NULL, 16);
net_boot_file_name_explicit = true;
copy_filename(net_boot_file_name, argv[2],
sizeof(net_boot_file_name));
@@ -227,8 +228,8 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
#ifdef CONFIG_CMD_TFTPPUT
case 4:
- if (strict_strtoul(argv[1], 16, &save_addr) < 0 ||
- strict_strtoul(argv[2], 16, &save_size) < 0) {
+ if (strict_strtoul(argv[1], 16, &image_save_addr) < 0 ||
+ strict_strtoul(argv[2], 16, &image_save_size) < 0) {
printf("Invalid address/size\n");
return CMD_RET_USAGE;
}
diff --git a/cmd/pxe.c b/cmd/pxe.c
index 73f1b4fbd3..bce6728875 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -6,6 +6,8 @@
#include <common.h>
#include <command.h>
+#include <fs.h>
+#include <net.h>
#include "pxe_utils.h"
diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index a636346bb5..8b830212ce 100644
--- a/cmd/pxe_utils.c
+++ b/cmd/pxe_utils.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <env.h>
+#include <image.h>
#include <malloc.h>
#include <mapmem.h>
#include <lcd.h>
@@ -1310,9 +1311,9 @@ void handle_pxe_menu(cmd_tbl_t *cmdtp, struct pxe_menu *cfg)
#ifdef CONFIG_CMD_BMP
/* display BMP if available */
if (cfg->bmp) {
- if (get_relfile(cmdtp, cfg->bmp, load_addr)) {
+ if (get_relfile(cmdtp, cfg->bmp, image_load_addr)) {
run_command("cls", 0);
- bmp_display(load_addr,
+ bmp_display(image_load_addr,
BMP_ALIGN_CENTER, BMP_ALIGN_CENTER);
} else {
printf("Skipping background bmp %s for failure\n",
diff --git a/cmd/reiser.c b/cmd/reiser.c
index 7f51b927a4..598fab48b3 100644
--- a/cmd/reiser.c
+++ b/cmd/reiser.c
@@ -154,7 +154,7 @@ int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
/* Loading ok, update default load address */
- load_addr = addr;
+ image_load_addr = addr;
printf ("\n%ld bytes read\n", filelen);
env_set_hex("filesize", filelen);
diff --git a/cmd/source.c b/cmd/source.c
index 3a51ebf0b6..92f8f77ee6 100644
--- a/cmd/source.c
+++ b/cmd/source.c
@@ -41,8 +41,7 @@ static const char *get_default_image(const void *fit)
}
#endif
-int
-source (ulong addr, const char *fit_uname)
+int image_source_script(ulong addr, const char *fit_uname)
{
ulong len;
#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
@@ -172,7 +171,8 @@ static int do_source(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
addr = CONFIG_SYS_LOAD_ADDR;
debug ("* source: default load address = 0x%08lx\n", addr);
#if defined(CONFIG_FIT)
- } else if (fit_parse_subimage (argv[1], load_addr, &addr, &fit_uname)) {
+ } else if (fit_parse_subimage(argv[1], image_load_addr, &addr,
+ &fit_uname)) {
debug ("* source: subimage '%s' from FIT image at 0x%08lx\n",
fit_uname, addr);
#endif
@@ -182,7 +182,7 @@ static int do_source(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
printf ("## Executing script at %08lx\n", addr);
- rcode = source (addr, fit_uname);
+ rcode = image_source_script(addr, fit_uname);
return rcode;
}
diff --git a/cmd/ti/ddr3.c b/cmd/ti/ddr3.c
index 55130898c9..a452fe7876 100644
--- a/cmd/ti/ddr3.c
+++ b/cmd/ti/ddr3.c
@@ -6,6 +6,7 @@
*/
#include <cpu_func.h>
+#include <init.h>
#include <asm/arch/hardware.h>
#include <asm/cache.h>
#include <asm/emif.h>
diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c
index c14dd75a26..2cde517d7a 100644
--- a/cmd/tpm_test.c
+++ b/cmd/tpm_test.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <cpu_func.h>
#include <tpm-v1.h>
#include "tpm-user-utils.h"
diff --git a/cmd/ximg.c b/cmd/ximg.c
index 22b2037a33..dccd1143a7 100644
--- a/cmd/ximg.c
+++ b/cmd/ximg.c
@@ -33,7 +33,7 @@
static int
do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
- ulong addr = load_addr;
+ ulong addr = image_load_addr;
ulong dest = 0;
ulong data, len;
int verify;
diff --git a/cmd/zfs.c b/cmd/zfs.c
index ed5402bb13..1533130635 100644
--- a/cmd/zfs.c
+++ b/cmd/zfs.c
@@ -112,7 +112,7 @@ static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
zfs_close(&zfile);
/* Loading ok, update default load address */
- load_addr = addr;
+ image_load_addr = addr;
printf("%llu bytes read\n", zfile.size);
env_set_hex("filesize", zfile.size);