/* ------------------------------------------------------------------------- */
#ifdef CONFIG_IDE_RESET
-static void ide_reset (void);
+static void ide_reset(void);
#else
#define ide_reset() /* dummy */
#endif
static void ide_ident(struct blk_desc *dev_desc);
-static uchar ide_wait (int dev, ulong t);
+static uchar ide_wait(int dev, ulong t);
#define IDE_TIME_OUT 2000 /* 2 sec timeout */
#define IDE_SPIN_UP_TIME_OUT 5000 /* 5 sec spin-up timeout */
-static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len);
+static void ident_cpy(unsigned char *dest, unsigned char *src,
+ unsigned int len);
#ifndef CONFIG_SYS_ATA_PORT_ADDR
#define CONFIG_SYS_ATA_PORT_ADDR(port) (port)
#endif
#ifdef CONFIG_ATAPI
-static void atapi_inquiry(struct blk_desc *dev_desc);
+static void atapi_inquiry(struct blk_desc *dev_desc);
static ulong atapi_read(struct blk_desc *block_dev, lbaint_t blknr,
lbaint_t blkcnt, void *buffer);
#endif
return CMD_RET_USAGE;
case 3:
if (strncmp(argv[1], "dev", 3) == 0) {
- int dev = (int) simple_strtoul(argv[2], NULL, 10);
+ int dev = (int)simple_strtoul(argv[2], NULL, 10);
printf("\nIDE device %d: ", dev);
if (dev >= CONFIG_SYS_IDE_MAXDEVICE) {
return 0;
} else if (strncmp(argv[1], "part", 4) == 0) {
- int dev = (int) simple_strtoul(argv[2], NULL, 10);
+ int dev = (int)simple_strtoul(argv[2], NULL, 10);
if (ide_dev_desc[dev].part_type != PART_TYPE_UNKNOWN) {
part_print(&ide_dev_desc[dev]);
#ifdef CONFIG_SYS_64BIT_LBA
lbaint_t blk = simple_strtoull(argv[3], NULL, 16);
- printf("\nIDE read: device %d block # %lld, count %ld ... ",
- curr_device, blk, cnt);
+ printf("\nIDE read: device %d block # %lld, count %ld...",
+ curr_device, blk, cnt);
#else
lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
- printf("\nIDE read: device %d block # %ld, count %ld ... ",
- curr_device, blk, cnt);
+ printf("\nIDE read: device %d block # %ld, count %ld...",
+ curr_device, blk, cnt);
#endif
dev_desc = &ide_dev_desc[curr_device];
#ifdef CONFIG_SYS_64BIT_LBA
lbaint_t blk = simple_strtoull(argv[3], NULL, 16);
- printf("\nIDE write: device %d block # %lld, count %ld ... ",
- curr_device, blk, cnt);
+ printf("\nIDE write: device %d block # %lld, count %ld...",
+ curr_device, blk, cnt);
#else
lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
- printf("\nIDE write: device %d block # %ld, count %ld ... ",
- curr_device, blk, cnt);
+ printf("\nIDE write: device %d block # %ld, count %ld...",
+ curr_device, blk, cnt);
#endif
n = ide_write(&ide_dev_desc[curr_device], blk, cnt,
(ulong *)addr);
}
IDE_READ_E:
ide_led(DEVICE_LED(device), 0); /* LED off */
- return (n);
+ return n;
}
/* ------------------------------------------------------------------------- */
}
WR_OUT:
ide_led(DEVICE_LED(device), 0); /* LED off */
- return (n);
+ return n;
}
/* ------------------------------------------------------------------------- */
if (delay-- == 0)
break;
}
- return (c);
+ return c;
}
/* ------------------------------------------------------------------------- */
if (delay-- == 0)
break;
}
- return (c);
+ return c;
}
/*
if ((c & mask) != res) { /* DRQ must be 1, BSY 0 */
printf("ATAPI_ISSUE: Error (no IRQ) before sending ccb dev %d status 0x%02x\n",
- device, c);
+ device, c);
err = 0xFF;
goto AI_OUT;
}
if (c & ATA_STAT_ERR) {
err = (ide_inb(device, ATA_ERROR_REG)) >> 4;
debug("atapi_issue 1 returned sense key %X status %02X\n",
- err, c);
+ err, c);
} else {
printf("ATAPI_ISSUE: (no DRQ) after sending ccb (%x) status 0x%02x\n",
- ccb[0], c);
+ ccb[0], c);
err = 0xFF;
}
goto AI_OUT;
}
if (n != buflen) {
debug("WARNING, transfer bytes %d not equal with requested %d\n",
- n, buflen);
+ n, buflen);
}
if (n != 0) { /* data transfer */
debug("ATAPI_ISSUE: %d Bytes to transfer\n", n);
}
AI_OUT:
ide_led(DEVICE_LED(device), 0); /* LED off */
- return (err);
+ return err;
}
/*
ascq);
error:
debug("ERROR Sense key %02X ASC %02X ASCQ %02X\n", key, asc, ascq);
- return (0xFF);
+ return 0xFF;
}
unsigned char ccb[12]; /* Command descriptor block */
ulong cnt;
- debug("atapi_read dev %d start " LBAF " blocks " LBAF " buffer at %lX\n",
- device, blknr, blkcnt, (ulong) buffer);
+ debug("atapi_read dev %d start " LBAF " blocks " LBAF
+ " buffer at %lX\n", device, blknr, blkcnt, (ulong) buffer);
do {
if (blkcnt > ATAPI_READ_MAX_BLOCK)
(unsigned char *) buffer,
cnt * ATAPI_READ_BLOCK_SIZE)
== 0xFF) {
- return (n);
+ return n;
}
n += cnt;
blkcnt -= cnt;
blknr += cnt;
buffer += (cnt * ATAPI_READ_BLOCK_SIZE);
} while (blkcnt > 0);
- return (n);
+ return n;
}
/* ------------------------------------------------------------------------- */