*last = '\0';
}
-#ifdef CONFIG_ATAPI
/****************************************************************************
* ATAPI Support
*/
#define ATAPI_READ_BLOCK_SIZE 2048 /* assuming CD part */
#define ATAPI_READ_MAX_BLOCK (ATAPI_READ_MAX_BYTES/ATAPI_READ_BLOCK_SIZE)
-ulong atapi_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
+ulong atapi_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
void *buffer)
{
+ struct blk_desc *block_dev = dev_get_uclass_plat(dev);
int device = block_dev->devnum;
ulong n = 0;
unsigned char ccb[12]; /* Command descriptor block */
return n;
}
+#ifdef CONFIG_ATAPI
+
static void atapi_inquiry(struct blk_desc *dev_desc)
{
unsigned char ccb[12]; /* Command descriptor block */
#ifdef CONFIG_ATAPI
if (is_atapi) {
+ dev_desc->atapi = true;
atapi_inquiry(dev_desc);
return;
}
return n;
}
+ulong ide_or_atapi_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
+ void *buffer)
+{
+ struct blk_desc *desc = dev_get_uclass_plat(dev);
+
+ if (IS_ENABLED(CONFIG_ATAPI) && desc->atapi)
+ return atapi_read(dev, blknr, blkcnt, buffer);
+
+ return ide_read(dev, blknr, blkcnt, buffer);
+}
+
static int ide_blk_probe(struct udevice *udev)
{
struct blk_desc *desc = dev_get_uclass_plat(udev);
}
static const struct blk_ops ide_blk_ops = {
- .read = ide_read,
+ .read = ide_or_atapi_read,
.write = ide_write,
};
/* device can use 48bit addr (ATA/ATAPI v7) */
unsigned char lba48;
#endif
+ unsigned char atapi; /* Use ATAPI protocol */
lbaint_t lba; /* number of blocks */
unsigned long blksz; /* block size */
int log2blksz; /* for convenience: log2(blksz) */