- default: /* at least 4 args */
- if (strcmp(argv[1], "read") == 0) {
- ulong addr = simple_strtoul(argv[2], NULL, 16);
- ulong cnt = simple_strtoul(argv[4], NULL, 16);
- ulong n;
- lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
-
- printf("\nSATA read: device %d block # %ld, count %ld ... ",
- sata_curr_device, blk, cnt);
-
- n = sata_read(sata_curr_device, blk, cnt, (u32 *)addr);
-
- /* flush cache after read */
- flush_cache(addr, cnt * sata_dev_desc[sata_curr_device].blksz);
-
- printf("%ld blocks read: %s\n",
- n, (n==cnt) ? "OK" : "ERROR");
- return (n == cnt) ? 0 : 1;
- } else if (strcmp(argv[1], "write") == 0) {
- ulong addr = simple_strtoul(argv[2], NULL, 16);
- ulong cnt = simple_strtoul(argv[4], NULL, 16);
- ulong n;
-
- lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
-
- printf("\nSATA write: device %d block # %ld, count %ld ... ",
- sata_curr_device, blk, cnt);
-
- n = sata_write(sata_curr_device, blk, cnt, (u32 *)addr);
-
- printf("%ld blocks written: %s\n",
- n, (n == cnt) ? "OK" : "ERROR");
- return (n == cnt) ? 0 : 1;
- } else {
- return CMD_RET_USAGE;