[SCSI] sd: Identify DIF protection type and application tag ownership
If a disk is formatted with protection information (Inquiry bit PROTECT=1) it is required to support Read Capacity(16). Force use of the 16-bit command in this case and extract the P_TYPE field which indicates whether the disk is formatted using DIF Type 1, 2 or 3. The ATO (App Tag Own) bit in the Control Mode Page indicates whether the storage device or the initiator own the contents of the DIF application tag. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
committed by
James Bottomley
parent
511e44f42e
commit
e0597d7001
@@ -41,7 +41,9 @@ struct scsi_disk {
|
||||
u32 index;
|
||||
u8 media_present;
|
||||
u8 write_prot;
|
||||
u8 protection_type;/* Data Integrity Field */
|
||||
unsigned previous_state : 1;
|
||||
unsigned ATO : 1; /* state of disk ATO bit */
|
||||
unsigned WCE : 1; /* state of disk WCE bit */
|
||||
unsigned RCD : 1; /* state of disk RCD bit, unused */
|
||||
unsigned DPOFUA : 1; /* state of disk DPOFUA bit */
|
||||
@@ -59,4 +61,25 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
|
||||
(sdsk)->disk->disk_name, ##a) : \
|
||||
sdev_printk(prefix, (sdsk)->device, fmt, ##a)
|
||||
|
||||
/*
|
||||
* A DIF-capable target device can be formatted with different
|
||||
* protection schemes. Currently 0 through 3 are defined:
|
||||
*
|
||||
* Type 0 is regular (unprotected) I/O
|
||||
*
|
||||
* Type 1 defines the contents of the guard and reference tags
|
||||
*
|
||||
* Type 2 defines the contents of the guard and reference tags and
|
||||
* uses 32-byte commands to seed the latter
|
||||
*
|
||||
* Type 3 defines the contents of the guard tag only
|
||||
*/
|
||||
|
||||
enum sd_dif_target_protection_types {
|
||||
SD_DIF_TYPE0_PROTECTION = 0x0,
|
||||
SD_DIF_TYPE1_PROTECTION = 0x1,
|
||||
SD_DIF_TYPE2_PROTECTION = 0x2,
|
||||
SD_DIF_TYPE3_PROTECTION = 0x3,
|
||||
};
|
||||
|
||||
#endif /* _SCSI_DISK_H */
|
||||
|
Reference in New Issue
Block a user