X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fcmd_ide.c;h=2e8c6e044a2962f72982b722bba96649da637fac;hb=0886eef9ba25b9e8da4bbaefc1a0b6da7a9567dc;hp=df7bdf56ec4d6f3491ecf979863e905d12872fcc;hpb=c6b734f5aea2ba75caaa1929f7e649ecda8d2f31;p=u-boot diff --git a/common/cmd_ide.c b/common/cmd_ide.c index df7bdf56ec..2e8c6e044a 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -160,7 +160,7 @@ static uchar ide_wait (int dev, ulong t); #define IDE_SPIN_UP_TIME_OUT 5000 /* 5 sec spin-up timeout */ static void input_data(int dev, ulong *sect_buf, int words); -static void output_data(int dev, ulong *sect_buf, int words); +static void output_data(int dev, const ulong *sect_buf, int words); static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len); #ifndef CONFIG_SYS_ATA_PORT_ADDR @@ -356,7 +356,6 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ulong addr, cnt; disk_partition_t info; image_header_t *hdr; - int rcode = 0; #if defined(CONFIG_FIT) const void *fit_hdr = NULL; #endif @@ -495,19 +494,7 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) load_addr = addr; - /* Check if we should attempt an auto-start */ - if (((ep = getenv("autostart")) != NULL) && (strcmp(ep,"yes") == 0)) { - char *local_args[2]; - - local_args[0] = argv[0]; - local_args[1] = NULL; - - printf ("Automatic boot of image at addr 0x%08lX ...\n", addr); - - do_bootm (cmdtp, 0, 1, local_args); - rcode = 1; - } - return rcode; + return bootm_maybe_autostart(cmdtp, argv[0]); } /* ------------------------------------------------------------------------- */ @@ -517,8 +504,20 @@ __ide_outb(int dev, int port, unsigned char val) { debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n", dev, port, val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port))); + +#if defined(CONFIG_IDE_AHB) + if (port) { + /* write command */ + ide_write_register(dev, port, val); + } else { + /* write data */ + outb(val, (ATA_CURR_BASE(dev))); + } +#else outb(val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port))); +#endif } + void ide_outb (int dev, int port, unsigned char val) __attribute__((weak, alias("__ide_outb"))); @@ -526,7 +525,13 @@ unsigned char inline __ide_inb(int dev, int port) { uchar val; + +#if defined(CONFIG_IDE_AHB) + val = ide_read_register(dev, port); +#else val = inb((ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port))); +#endif + debug ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n", dev, port, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)), val); return val; @@ -695,6 +700,7 @@ void ide_init (void) ide_dev_desc[i].blksz=0; ide_dev_desc[i].lba=0; ide_dev_desc[i].block_read=ide_read; + ide_dev_desc[i].block_write = ide_write; if (!ide_bus_ok[IDE_BUS(i)]) continue; ide_led (led, 1); /* LED on */ @@ -713,10 +719,12 @@ void ide_init (void) /* ------------------------------------------------------------------------- */ +#ifdef CONFIG_PARTITIONS block_dev_desc_t * ide_get_dev(int dev) { return (dev < CONFIG_SYS_IDE_MAXDEVICE) ? &ide_dev_desc[dev] : NULL; } +#endif #ifdef CONFIG_IDE_8xx_DIRECT @@ -811,7 +819,8 @@ set_pcmcia_timing (int pmode) /* We only need to swap data if we are running on a big endian cpu. */ /* But Au1x00 cpu:s already swaps data in big endian mode! */ -#if defined(__LITTLE_ENDIAN) || ( defined(CONFIG_AU1X00) && !defined(CONFIG_GTH2) ) +#if defined(__LITTLE_ENDIAN) || \ + (defined(CONFIG_SOC_AU1X00) && !defined(CONFIG_GTH2)) #define input_swap_data(x,y,z) input_data(x,y,z) #else static void @@ -855,7 +864,7 @@ input_swap_data(int dev, ulong *sect_buf, int words) #if defined(CONFIG_IDE_SWAP_IO) static void -output_data(int dev, ulong *sect_buf, int words) +output_data(int dev, const ulong *sect_buf, int words) { #if defined(CONFIG_CPC45) uchar *dbuf; @@ -899,9 +908,13 @@ output_data(int dev, ulong *sect_buf, int words) } #else /* ! CONFIG_IDE_SWAP_IO */ static void -output_data(int dev, ulong *sect_buf, int words) +output_data(int dev, const ulong *sect_buf, int words) { - outsw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words<<1); +#if defined(CONFIG_IDE_AHB) + ide_write_data(dev, sect_buf, words); +#else + outsw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words << 1); +#endif } #endif /* CONFIG_IDE_SWAP_IO */ @@ -959,7 +972,11 @@ input_data(int dev, ulong *sect_buf, int words) static void input_data(int dev, ulong *sect_buf, int words) { +#if defined(CONFIG_IDE_AHB) + ide_read_data(dev, sect_buf, words); +#else insw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words << 1); +#endif } #endif /* CONFIG_IDE_SWAP_IO */ @@ -1320,7 +1337,7 @@ IDE_READ_E: /* ------------------------------------------------------------------------- */ -ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, void *buffer) +ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, const void *buffer) { ulong n = 0; unsigned char c;