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>
This commit is contained in:
Stephen Warren
2015-12-07 11:38:48 -07:00
committed by Tom Rini
parent adc421e4ce
commit 7c4213f6a5
41 changed files with 224 additions and 194 deletions

View File

@@ -41,8 +41,10 @@ typedef ulong lbaint_t;
*/
void ide_init(void);
ulong ide_read(int device, lbaint_t blknr, lbaint_t blkcnt, void *buffer);
ulong ide_write(int device, lbaint_t blknr, lbaint_t blkcnt,
typedef struct block_dev_desc block_dev_desc_t;
ulong ide_read(block_dev_desc_t *block_dev, lbaint_t blknr, lbaint_t blkcnt,
void *buffer);
ulong ide_write(block_dev_desc_t *block_dev, lbaint_t blknr, lbaint_t blkcnt,
const void *buffer);
#ifdef CONFIG_IDE_PREINIT

View File

@@ -10,7 +10,9 @@
#include <ide.h>
#include <common.h>
typedef struct block_dev_desc {
typedef struct block_dev_desc block_dev_desc_t;
struct block_dev_desc {
int if_type; /* type of the interface */
int dev; /* device number */
unsigned char part_type; /* partition type */
@@ -27,19 +29,19 @@ typedef struct block_dev_desc {
char vendor [40+1]; /* IDE model, SCSI Vendor */
char product[20+1]; /* IDE Serial no, SCSI product */
char revision[8+1]; /* firmware revision */
unsigned long (*block_read)(int dev,
unsigned long (*block_read)(block_dev_desc_t *block_dev,
lbaint_t start,
lbaint_t blkcnt,
void *buffer);
unsigned long (*block_write)(int dev,
unsigned long (*block_write)(block_dev_desc_t *block_dev,
lbaint_t start,
lbaint_t blkcnt,
const void *buffer);
unsigned long (*block_erase)(int dev,
unsigned long (*block_erase)(block_dev_desc_t *block_dev,
lbaint_t start,
lbaint_t blkcnt);
void *priv; /* driver private struct pointer */
}block_dev_desc_t;
};
#define BLOCK_CNT(size, block_dev_desc) (PAD_COUNT(size, block_dev_desc->blksz))
#define PAD_TO_BLOCKSIZE(size, block_dev_desc) \