* Code cleanup:
[platform/kernel/u-boot.git] / common / cmd_ide.c
index 7b45508..c1e610a 100644 (file)
@@ -39,7 +39,6 @@
 #endif
 #include <ide.h>
 #include <ata.h>
-#include <cmd_ide.h>
 #include <cmd_disk.h>
 #ifdef CONFIG_STATUS_LED
 # include <status_led.h>
@@ -132,8 +131,12 @@ static  block_dev_desc_t ide_dev_desc[CFG_IDE_MAXDEVICE];
 /* ------------------------------------------------------------------------- */
 
 #ifdef CONFIG_IDE_LED
+#ifndef CONFIG_KUP4K
 static void  ide_led   (uchar led, uchar status);
 #else
+extern void  ide_led   (uchar led, uchar status);
+#endif
+#else
 #ifndef CONFIG_AMIGAONEG3SE
 #define ide_led(a,b)   /* dummy */
 #else
@@ -400,7 +403,8 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                SHOW_BOOT_PROGRESS (-1);
                return 1;
        }
-       if (strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
+       if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
+           (strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
                printf ("\n** Invalid partition type \"%.32s\""
                        " (expect \"" BOOT_PART_TYPE "\")\n",
                        info.type);
@@ -485,11 +489,14 @@ void ide_init (void)
 
 #ifdef CONFIG_IDE_8xx_PCCARD
        extern int pcmcia_on (void);
+       extern int ide_devices_found; /* Initialized in check_ide_device() */
 
        WATCHDOG_RESET();
 
+       ide_devices_found = 0;
        /* initialize the PCMCIA IDE adapter card */
-       if (pcmcia_on())
+       pcmcia_on();
+       if (!ide_devices_found)
                return;
        udelay (1000000);       /* 1 s */
 #endif /* CONFIG_IDE_8xx_PCCARD */
@@ -546,6 +553,13 @@ void ide_init (void)
                int dev = bus * (CFG_IDE_MAXDEVICE / max_bus_scan);
 #endif
 
+#ifdef CONFIG_IDE_8xx_PCCARD
+               /* Skip non-ide devices from probing */
+               if ((ide_devices_found & (1 << bus)) == 0) {
+                       ide_led ((LED_IDE1 | LED_IDE2), 0); /* LED's off */
+                       continue;
+               }
+#endif
                printf ("Bus %d: ", bus);
 
                ide_bus_ok[bus] = 0;
@@ -777,21 +791,13 @@ ide_inb(int dev, int port)
 #endif /* __PPC__ */
 
 #ifdef __PPC__
-__inline__ unsigned ld_le16(const volatile unsigned short *addr)
-{
-       unsigned val;
-
-       __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r"(val) : "r"(addr), "m"(*addr));
-       return val;
-}
-
-#ifdef CONFIG_AMIGAONEG3SE
+# ifdef CONFIG_AMIGAONEG3SE
 static void
 output_data_short(int dev, ulong *sect_buf, int words)
 {
        ushort  *dbuf;
        volatile ushort *pbuf;
-       
+
        pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
        dbuf = (ushort *)sect_buf;
        while (words--) {
@@ -803,7 +809,7 @@ output_data_short(int dev, ulong *sect_buf, int words)
        if (words&1)
            *pbuf = 0;
 }
-#endif
+# endif        /* CONFIG_AMIGAONEG3SE */
 
 static void
 input_swap_data(int dev, ulong *sect_buf, int words)
@@ -821,8 +827,6 @@ input_swap_data(int dev, ulong *sect_buf, int words)
 #endif /* __PPC__ */
 
 
-
-
 #ifdef __PPC__
 static void
 output_data(int dev, ulong *sect_buf, int words)
@@ -1347,7 +1351,7 @@ static void ide_reset (void)
 
 /* ------------------------------------------------------------------------- */
 
-#if defined(CONFIG_IDE_LED) && !defined(CONFIG_AMIGAONEG3SE)
+#if defined(CONFIG_IDE_LED) && !defined(CONFIG_AMIGAONEG3SE) && !defined(CONFIG_KUP4K)
 
 static uchar   led_buffer = 0;         /* Buffer for current LED status        */
 
@@ -1374,7 +1378,6 @@ static void ide_led (uchar led, uchar status)
  */
 
 
-
 #undef ATAPI_DEBUG
 
 #ifdef ATAPI_DEBUG
@@ -1674,7 +1677,6 @@ error:
 }
 
 
-
 static void    atapi_inquiry(block_dev_desc_t * dev_desc)
 {
        unsigned char ccb[12]; /* Command descriptor block */
@@ -1809,4 +1811,23 @@ ulong atapi_read (int device, ulong blknr, ulong blkcnt, ulong *buffer)
 
 #endif /* CONFIG_ATAPI */
 
+cmd_tbl_t U_BOOT_CMD(IDE) = MK_CMD_ENTRY(
+       "ide",  5,  1,  do_ide,
+       "ide     - IDE sub-system\n",
+       "reset - reset IDE controller\n"
+       "ide info  - show available IDE devices\n"
+       "ide device [dev] - show or set current device\n"
+       "ide part [dev] - print partition table of one or all IDE devices\n"
+       "ide read  addr blk# cnt\n"
+       "ide write addr blk# cnt - read/write `cnt'"
+       " blocks starting at block `blk#'\n"
+       "    to/from memory address `addr'\n"
+);
+
+cmd_tbl_t U_BOOT_CMD(DISK) = MK_CMD_ENTRY(
+       "diskboot",     3,      1,      do_diskboot,
+       "diskboot- boot from IDE device\n",
+       "loadAddr dev:part\n"
+);
+
 #endif /* CONFIG_COMMANDS & CFG_CMD_IDE */