diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2008-07-17 04:28:34 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-07-26 15:14:55 -0400 |
commit | e0597d70012c82e16ee152270a55d89d8bf66693 (patch) | |
tree | 1752132ba07975a8db2bf93ddad88e1a6c06f4d2 /drivers/scsi/sd.h | |
parent | 511e44f42e3239a4df77b8e0e46d294d98a768ad (diff) |
[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>
Diffstat (limited to 'drivers/scsi/sd.h')
-rw-r--r-- | drivers/scsi/sd.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h index 03a3d45cfa42..86b18d4170fe 100644 --- a/drivers/scsi/sd.h +++ b/drivers/scsi/sd.h | |||
@@ -41,7 +41,9 @@ struct scsi_disk { | |||
41 | u32 index; | 41 | u32 index; |
42 | u8 media_present; | 42 | u8 media_present; |
43 | u8 write_prot; | 43 | u8 write_prot; |
44 | u8 protection_type;/* Data Integrity Field */ | ||
44 | unsigned previous_state : 1; | 45 | unsigned previous_state : 1; |
46 | unsigned ATO : 1; /* state of disk ATO bit */ | ||
45 | unsigned WCE : 1; /* state of disk WCE bit */ | 47 | unsigned WCE : 1; /* state of disk WCE bit */ |
46 | unsigned RCD : 1; /* state of disk RCD bit, unused */ | 48 | unsigned RCD : 1; /* state of disk RCD bit, unused */ |
47 | unsigned DPOFUA : 1; /* state of disk DPOFUA bit */ | 49 | unsigned DPOFUA : 1; /* state of disk DPOFUA bit */ |
@@ -59,4 +61,25 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk) | |||
59 | (sdsk)->disk->disk_name, ##a) : \ | 61 | (sdsk)->disk->disk_name, ##a) : \ |
60 | sdev_printk(prefix, (sdsk)->device, fmt, ##a) | 62 | sdev_printk(prefix, (sdsk)->device, fmt, ##a) |
61 | 63 | ||
64 | /* | ||
65 | * A DIF-capable target device can be formatted with different | ||
66 | * protection schemes. Currently 0 through 3 are defined: | ||
67 | * | ||
68 | * Type 0 is regular (unprotected) I/O | ||
69 | * | ||
70 | * Type 1 defines the contents of the guard and reference tags | ||
71 | * | ||
72 | * Type 2 defines the contents of the guard and reference tags and | ||
73 | * uses 32-byte commands to seed the latter | ||
74 | * | ||
75 | * Type 3 defines the contents of the guard tag only | ||
76 | */ | ||
77 | |||
78 | enum sd_dif_target_protection_types { | ||
79 | SD_DIF_TYPE0_PROTECTION = 0x0, | ||
80 | SD_DIF_TYPE1_PROTECTION = 0x1, | ||
81 | SD_DIF_TYPE2_PROTECTION = 0x2, | ||
82 | SD_DIF_TYPE3_PROTECTION = 0x3, | ||
83 | }; | ||
84 | |||
62 | #endif /* _SCSI_DISK_H */ | 85 | #endif /* _SCSI_DISK_H */ |