From 7c4213f6a52f35ff6ba2d97aa4eb04cbfc963b86 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 7 Dec 2015 11:38:48 -0700 Subject: 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 Reviewed-by: Tom Rini --- common/cmd_sata.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'common/cmd_sata.c') diff --git a/common/cmd_sata.c b/common/cmd_sata.c index 51f6703..76bacea 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) { -- cgit v1.1