Jens Axboe | 3d6392c | 2007-07-09 12:38:05 +0200 | [diff] [blame] | 1 | #ifndef BSG_H |
| 2 | #define BSG_H |
| 3 | |
FUJITA Tomonori | 45977d0e | 2006-12-20 11:19:32 +0100 | [diff] [blame^] | 4 | struct sg_io_v4 { |
| 5 | int32_t guard; /* [i] 'Q' to differentiate from v3 */ |
| 6 | uint32_t protocol; /* [i] 0 -> SCSI , .... */ |
| 7 | uint32_t subprotocol; /* [i] 0 -> SCSI command, 1 -> SCSI task |
| 8 | management function, .... */ |
| 9 | |
| 10 | uint32_t request_len; /* [i] in bytes */ |
| 11 | uint64_t request; /* [i], [*i] {SCSI: cdb} */ |
| 12 | uint32_t request_attr; /* [i] {SCSI: task attribute} */ |
| 13 | uint32_t request_tag; /* [i] {SCSI: task tag (only if flagged)} */ |
| 14 | uint32_t request_priority; /* [i] {SCSI: task priority} */ |
| 15 | uint32_t max_response_len; /* [i] in bytes */ |
| 16 | uint64_t response; /* [i], [*o] {SCSI: (auto)sense data} */ |
| 17 | |
| 18 | /* "din_" for data in (from device); "dout_" for data out (to device) */ |
| 19 | uint32_t dout_xfer_len; /* [i] bytes to be transferred to device */ |
| 20 | uint32_t din_xfer_len; /* [i] bytes to be transferred from device */ |
| 21 | uint64_t dout_xferp; /* [i], [*i] */ |
| 22 | uint64_t din_xferp; /* [i], [*o] */ |
| 23 | |
| 24 | uint32_t timeout; /* [i] units: millisecond */ |
| 25 | uint32_t flags; /* [i] bit mask */ |
| 26 | uint64_t usr_ptr; /* [i->o] unused internally */ |
| 27 | uint32_t spare_in; /* [i] */ |
| 28 | |
| 29 | uint32_t driver_status; /* [o] 0 -> ok */ |
| 30 | uint32_t transport_status; /* [o] 0 -> ok */ |
| 31 | uint32_t device_status; /* [o] {SCSI: command completion status} */ |
| 32 | uint32_t retry_delay; /* [o] {SCSI: status auxiliary information} */ |
| 33 | uint32_t info; /* [o] additional information */ |
| 34 | uint32_t duration; /* [o] time to complete, in milliseconds */ |
| 35 | uint32_t response_len; /* [o] bytes of response actually written */ |
| 36 | int32_t din_resid; /* [o] actual_din_xfer_len - din_xfer_len */ |
| 37 | uint32_t generated_tag; /* [o] {SCSI: task tag that transport chose} */ |
| 38 | uint32_t spare_out; /* [o] */ |
| 39 | |
| 40 | uint32_t padding; |
| 41 | }; |
| 42 | |
| 43 | #ifdef __KERNEL__ |
| 44 | |
Jens Axboe | 3d6392c | 2007-07-09 12:38:05 +0200 | [diff] [blame] | 45 | #if defined(CONFIG_BLK_DEV_BSG) |
| 46 | struct bsg_class_device { |
| 47 | struct class_device *class_dev; |
| 48 | struct device *dev; |
| 49 | int minor; |
| 50 | struct gendisk *disk; |
| 51 | struct list_head list; |
| 52 | }; |
| 53 | |
| 54 | extern int bsg_register_disk(struct gendisk *); |
| 55 | extern void bsg_unregister_disk(struct gendisk *); |
| 56 | #else |
| 57 | struct bsg_class_device { }; |
| 58 | #define bsg_register_disk(disk) (0) |
| 59 | #define bsg_unregister_disk(disk) do { } while (0) |
| 60 | #endif |
| 61 | |
FUJITA Tomonori | 45977d0e | 2006-12-20 11:19:32 +0100 | [diff] [blame^] | 62 | #endif /* __KERNEL__ */ |
| 63 | |
Jens Axboe | 3d6392c | 2007-07-09 12:38:05 +0200 | [diff] [blame] | 64 | #endif |