block: pass block dev not num to read/write/erase()

This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index 8695408..bc7d1b6 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -66,9 +66,9 @@
 
 static int scsi_read_capacity(ccb *pccb, lbaint_t *capacity,
 			      unsigned long *blksz);
-static ulong scsi_read(int device, lbaint_t blknr, lbaint_t blkcnt,
-		       void *buffer);
-static ulong scsi_write(int device, lbaint_t blknr,
+static ulong scsi_read(block_dev_desc_t *block_dev, lbaint_t blknr,
+		       lbaint_t blkcnt, void *buffer);
+static ulong scsi_write(block_dev_desc_t *block_dev, lbaint_t blknr,
 			lbaint_t blkcnt, const void *buffer);
 
 
@@ -346,7 +346,8 @@
 				ulong n;
 				printf ("\nSCSI read: device %d block # %ld, count %ld ... ",
 						scsi_curr_dev, blk, cnt);
-				n = scsi_read(scsi_curr_dev, blk, cnt, (ulong *)addr);
+				n = scsi_read(&scsi_dev_desc[scsi_curr_dev],
+					      blk, cnt, (ulong *)addr);
 				printf ("%ld blocks read: %s\n",n,(n==cnt) ? "OK" : "ERROR");
 				return 0;
 			} else if (strcmp(argv[1], "write") == 0) {
@@ -357,8 +358,8 @@
 				printf("\nSCSI write: device %d block # %ld, "
 				       "count %ld ... ",
 				       scsi_curr_dev, blk, cnt);
-				n = scsi_write(scsi_curr_dev, blk, cnt,
-					       (ulong *)addr);
+				n = scsi_write(&scsi_dev_desc[scsi_curr_dev],
+					       blk, cnt, (ulong *)addr);
 				printf("%ld blocks written: %s\n", n,
 				       (n == cnt) ? "OK" : "ERROR");
 				return 0;
@@ -375,9 +376,10 @@
 #define SCSI_MAX_READ_BLK 0xFFFF
 #define SCSI_LBA48_READ	0xFFFFFFF
 
-static ulong scsi_read(int device, lbaint_t blknr, lbaint_t blkcnt,
-		       void *buffer)
+static ulong scsi_read(block_dev_desc_t *block_dev, lbaint_t blknr,
+		       lbaint_t blkcnt, void *buffer)
 {
+	int device = block_dev->dev;
 	lbaint_t start, blks;
 	uintptr_t buf_addr;
 	unsigned short smallblks = 0;
@@ -441,9 +443,10 @@
 /* Almost the maximum amount of the scsi_ext command.. */
 #define SCSI_MAX_WRITE_BLK 0xFFFF
 
-static ulong scsi_write(int device, lbaint_t blknr,
+static ulong scsi_write(block_dev_desc_t *block_dev, lbaint_t blknr,
 			lbaint_t blkcnt, const void *buffer)
 {
+	int device = block_dev->dev;
 	lbaint_t start, blks;
 	uintptr_t buf_addr;
 	unsigned short smallblks;