scsi: Provide some response flags
Rather than open-coding the SCSI-inquiry-response flags, add an enum and use that. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
#include <log.h>
|
#include <log.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <part.h>
|
#include <part.h>
|
||||||
|
#include <scsi.h>
|
||||||
#include <ubifs_uboot.h>
|
#include <ubifs_uboot.h>
|
||||||
#include <dm/uclass.h>
|
#include <dm/uclass.h>
|
||||||
|
|
||||||
@@ -221,7 +222,7 @@ void dev_print(struct blk_desc *desc)
|
|||||||
puts (" Type: ");
|
puts (" Type: ");
|
||||||
if (desc->removable)
|
if (desc->removable)
|
||||||
puts ("Removable ");
|
puts ("Removable ");
|
||||||
switch (desc->type & 0x1F) {
|
switch (desc->type & SCSIRF_TYPE_MASK) {
|
||||||
case DEV_TYPE_HARDDISK:
|
case DEV_TYPE_HARDDISK:
|
||||||
puts ("Hard Disk");
|
puts ("Hard Disk");
|
||||||
break;
|
break;
|
||||||
@@ -235,7 +236,7 @@ void dev_print(struct blk_desc *desc)
|
|||||||
puts ("Tape");
|
puts ("Tape");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("# %02X #", desc->type & 0x1F);
|
printf("# %02X #", desc->type & SCSIRF_TYPE_MASK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
puts ("\n");
|
puts ("\n");
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <ide.h>
|
#include <ide.h>
|
||||||
#include <log.h>
|
#include <log.h>
|
||||||
#include <part.h>
|
#include <part.h>
|
||||||
|
#include <scsi.h>
|
||||||
#include <watchdog.h>
|
#include <watchdog.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
@@ -476,7 +477,7 @@ static void atapi_inquiry(struct blk_desc *desc)
|
|||||||
desc->lba = 0;
|
desc->lba = 0;
|
||||||
desc->blksz = 0;
|
desc->blksz = 0;
|
||||||
desc->log2blksz = LOG2_INVALID(typeof(desc->log2blksz));
|
desc->log2blksz = LOG2_INVALID(typeof(desc->log2blksz));
|
||||||
desc->type = iobuf[0] & 0x1f;
|
desc->type = iobuf[0] & SCSIRF_TYPE_MASK;
|
||||||
|
|
||||||
if (iobuf[1] & 0x80)
|
if (iobuf[1] & 0x80)
|
||||||
desc->removable = 1;
|
desc->removable = 1;
|
||||||
|
|||||||
@@ -478,9 +478,9 @@ static int scsi_detect_dev(struct udevice *dev, int target, int lun,
|
|||||||
}
|
}
|
||||||
perq = tempbuff[0];
|
perq = tempbuff[0];
|
||||||
modi = tempbuff[1];
|
modi = tempbuff[1];
|
||||||
if ((perq & 0x1f) == 0x1f)
|
if ((perq & SCSIRF_TYPE_MASK) == SCSIRF_TYPE_UNKNOWN)
|
||||||
return -ENODEV; /* skip unknown devices */
|
return -ENODEV; /* skip unknown devices */
|
||||||
if ((modi & 0x80) == 0x80) /* drive is removable */
|
if (modi & SCSIRF_FLAGS_REMOVABLE) /* drive is removable */
|
||||||
dev_desc->removable = true;
|
dev_desc->removable = true;
|
||||||
/* get info for this device */
|
/* get info for this device */
|
||||||
scsi_ident_cpy((unsigned char *)dev_desc->vendor,
|
scsi_ident_cpy((unsigned char *)dev_desc->vendor,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <asm/cache.h>
|
#include <asm/cache.h>
|
||||||
#include <bouncebuf.h>
|
#include <bouncebuf.h>
|
||||||
|
#include <linux/bitops.h>
|
||||||
#include <linux/dma-direction.h>
|
#include <linux/dma-direction.h>
|
||||||
|
|
||||||
struct udevice;
|
struct udevice;
|
||||||
@@ -199,6 +200,13 @@ enum scsi_cmd_phase {
|
|||||||
SCSIPH_STATUS,
|
SCSIPH_STATUS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum scsi_resp_t {
|
||||||
|
SCSIRF_TYPE_MASK = 0x1f,
|
||||||
|
SCSIRF_TYPE_UNKNOWN = 0x1f,
|
||||||
|
|
||||||
|
SCSIRF_FLAGS_REMOVABLE = BIT(8),
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct scsi_inquiry_resp - holds a SCSI inquiry command
|
* struct scsi_inquiry_resp - holds a SCSI inquiry command
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user