X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=include%2Fscsi%2Fscsi_device.h;h=f6a9fe0ef09c62cf38b28f6cdd9bfd9bad06121a;hb=7022b15e2a9f878fd5184586064c63352c3dd225;hp=66e9058357e02d85d8617b9cd58edf893fff0b30;hpb=64c911a3f7c9864a4bbddbb77b722d5553ddcd32;p=linux-2.6-omap-h63xx.git diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 66e9058357e..f6a9fe0ef09 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -122,9 +122,6 @@ struct scsi_device { unsigned tagged_supported:1; /* Supports SCSI-II tagged queuing */ unsigned simple_tags:1; /* simple queue tag messages are enabled */ unsigned ordered_tags:1;/* ordered queue tag messages are enabled */ - unsigned single_lun:1; /* Indicates we should only allow I/O to - * one of the luns for the device at a - * time. */ unsigned was_reset:1; /* There was a bus reset on the bus for * this device */ unsigned expecting_cc_ua:1; /* Expecting a CHECK_CONDITION/UNIT_ATTN @@ -142,6 +139,7 @@ struct scsi_device { unsigned fix_capacity:1; /* READ_CAPACITY is too high by 1 */ unsigned guess_capacity:1; /* READ_CAPACITY might be too high by 1 */ unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */ + unsigned last_sector_bug:1; /* Always read last sector in a 1 sector read */ DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */ struct list_head event_list; /* asserted events */ @@ -158,8 +156,8 @@ struct scsi_device { int timeout; - struct device sdev_gendev; - struct class_device sdev_classdev; + struct device sdev_gendev, + sdev_dev; struct execute_work ew; /* used to get process context on put */ @@ -169,9 +167,9 @@ struct scsi_device { #define to_scsi_device(d) \ container_of(d, struct scsi_device, sdev_gendev) #define class_to_sdev(d) \ - container_of(d, struct scsi_device, sdev_classdev) + container_of(d, struct scsi_device, sdev_dev) #define transport_class_to_sdev(class_dev) \ - to_scsi_device(class_dev->dev) + to_scsi_device(class_dev->parent) #define sdev_printk(prefix, sdev, fmt, a...) \ dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a) @@ -183,7 +181,8 @@ struct scsi_device { sdev_printk(prefix, (scmd)->device, fmt, ##a) enum scsi_target_state { - STARGET_RUNNING = 1, + STARGET_CREATED = 1, + STARGET_RUNNING, STARGET_DEL, }; @@ -202,6 +201,9 @@ struct scsi_target { unsigned int id; /* target id ... replace * scsi_device.id eventually */ unsigned int create:1; /* signal that it needs to be added */ + unsigned int single_lun:1; /* Indicates we should only + * allow I/O to one of the luns + * for the device at a time. */ unsigned int pdt_1f_for_no_lun; /* PDT = 0x1f */ /* means no lun present */ @@ -219,7 +221,7 @@ static inline struct scsi_target *scsi_target(struct scsi_device *sdev) return to_scsi_target(sdev->sdev_gendev.parent); } #define transport_class_to_starget(class_dev) \ - to_scsi_target(class_dev->dev) + to_scsi_target(class_dev->parent) #define starget_printk(prefix, starget, fmt, a...) \ dev_printk(prefix, &(starget)->dev, fmt, ##a) @@ -242,6 +244,9 @@ extern struct scsi_device *__scsi_device_lookup_by_target(struct scsi_target *, uint); extern void starget_for_each_device(struct scsi_target *, void *, void (*fn)(struct scsi_device *, void *)); +extern void __starget_for_each_device(struct scsi_target *, void *, + void (*fn)(struct scsi_device *, + void *)); /* only exposed to implement shost_for_each_device */ extern struct scsi_device *__scsi_iterate_devices(struct Scsi_Host *, @@ -292,7 +297,7 @@ extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp, struct scsi_mode_data *data, struct scsi_sense_hdr *); extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, - int retries); + int retries, struct scsi_sense_hdr *sshdr); extern int scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state); extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, @@ -383,6 +388,10 @@ static inline int scsi_device_qas(struct scsi_device *sdev) return 0; return sdev->inquiry[56] & 0x02; } +static inline int scsi_device_enclosure(struct scsi_device *sdev) +{ + return sdev->inquiry[6] & (1<<6); +} #define MODULE_ALIAS_SCSI_DEVICE(type) \ MODULE_ALIAS("scsi:t-" __stringify(type) "*")