summaryrefslogtreecommitdiffstats
path: root/common/cmd_sata.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2015-12-07 11:38:48 -0700
committerTom Rini <trini@konsulko.com>2016-01-13 21:05:18 -0500
commit7c4213f6a52f35ff6ba2d97aa4eb04cbfc963b86 (patch)
tree8dfb6b9f5721891de191bad798b0533e3a0bf69a /common/cmd_sata.c
parentadc421e4cee8275cd99367b3b455ffbb5ead3990 (diff)
downloadtalos-obmc-uboot-7c4213f6a52f35ff6ba2d97aa4eb04cbfc963b86.tar.gz
talos-obmc-uboot-7c4213f6a52f35ff6ba2d97aa4eb04cbfc963b86.zip
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>
Diffstat (limited to 'common/cmd_sata.c')
-rw-r--r--common/cmd_sata.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/common/cmd_sata.c b/common/cmd_sata.c
index 51f67033ae..76baceae8c 100644
--- a/common/cmd_sata.c
+++ b/common/cmd_sata.c
@@ -18,6 +18,18 @@
static int sata_curr_device = -1;
block_dev_desc_t sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE];
+static unsigned long sata_bread(block_dev_desc_t *block_dev, lbaint_t start,
+ lbaint_t blkcnt, void *dst)
+{
+ return sata_read(block_dev->dev, start, blkcnt, dst);
+}
+
+static unsigned long sata_bwrite(block_dev_desc_t *block_dev, lbaint_t start,
+ lbaint_t blkcnt, const void *buffer)
+{
+ return sata_write(block_dev->dev, start, blkcnt, buffer);
+}
+
int __sata_initialize(void)
{
int rc;
@@ -32,8 +44,8 @@ int __sata_initialize(void)
sata_dev_desc[i].lba = 0;
sata_dev_desc[i].blksz = 512;
sata_dev_desc[i].log2blksz = LOG2(sata_dev_desc[i].blksz);
- sata_dev_desc[i].block_read = sata_read;
- sata_dev_desc[i].block_write = sata_write;
+ sata_dev_desc[i].block_read = sata_bread;
+ sata_dev_desc[i].block_write = sata_bwrite;
rc = init_sata(i);
if (!rc) {
OpenPOWER on IntegriCloud