Kevin O'Connor | 7d70025 | 2010-02-15 11:56:07 -0500 | [diff] [blame] | 1 | // Definitions for SCSI style command data blocks. |
| 2 | #ifndef __BLOCKCMD_H |
| 3 | #define __BLOCKCMD_H |
| 4 | |
| 5 | #include "types.h" // u8 |
| 6 | |
| 7 | #define CDB_CMD_READ_10 0x28 |
| 8 | #define CDB_CMD_VERIFY_10 0x2f |
| 9 | #define CDB_CMD_WRITE_10 0x2a |
| 10 | |
| 11 | struct cdb_rwdata_10 { |
| 12 | u8 command; |
| 13 | u8 flags; |
| 14 | u32 lba; |
| 15 | u8 resreved_06; |
| 16 | u16 count; |
| 17 | u8 reserved_09; |
| 18 | u8 pad[6]; |
| 19 | } PACKED; |
| 20 | |
| 21 | #define CDB_CMD_READ_CAPACITY 0x25 |
| 22 | |
| 23 | struct cdb_read_capacity { |
| 24 | u8 command; |
| 25 | u8 flags; |
| 26 | u8 resreved_02[8]; |
| 27 | u8 pad[6]; |
| 28 | } PACKED; |
| 29 | |
| 30 | struct cdbres_read_capacity { |
| 31 | u32 sectors; |
| 32 | u32 blksize; |
| 33 | } PACKED; |
| 34 | |
Paolo Bonzini | 0082374 | 2011-11-16 13:02:42 +0100 | [diff] [blame] | 35 | #define CDB_CMD_TEST_UNIT_READY 0x00 |
| 36 | #define CDB_CMD_INQUIRY 0x12 |
| 37 | #define CDB_CMD_REQUEST_SENSE 0x03 |
Kevin O'Connor | 7d70025 | 2010-02-15 11:56:07 -0500 | [diff] [blame] | 38 | |
| 39 | struct cdb_request_sense { |
| 40 | u8 command; |
| 41 | u8 flags; |
| 42 | u16 reserved_02; |
| 43 | u8 length; |
| 44 | u8 reserved_05; |
| 45 | u8 pad[10]; |
| 46 | } PACKED; |
| 47 | |
| 48 | struct cdbres_request_sense { |
| 49 | u8 errcode; |
| 50 | u8 segment; |
| 51 | u8 flags; |
| 52 | u32 info; |
| 53 | u8 additional; |
| 54 | u32 specific; |
| 55 | u8 asc; |
| 56 | u8 ascq; |
| 57 | u32 reserved_0e; |
| 58 | } PACKED; |
| 59 | |
Kevin O'Connor | 7149fc8 | 2010-02-17 23:24:42 -0500 | [diff] [blame] | 60 | struct cdbres_inquiry { |
| 61 | u8 pdt; |
| 62 | u8 removable; |
| 63 | u8 reserved_02[2]; |
| 64 | u8 additional; |
| 65 | u8 reserved_05[3]; |
| 66 | char vendor[8]; |
| 67 | char product[16]; |
| 68 | char rev[4]; |
| 69 | } PACKED; |
| 70 | |
Kevin O'Connor | 76977b2 | 2010-02-17 01:01:32 -0500 | [diff] [blame] | 71 | // blockcmd.c |
Kevin O'Connor | 7149fc8 | 2010-02-17 23:24:42 -0500 | [diff] [blame] | 72 | int cdb_get_inquiry(struct disk_op_s *op, struct cdbres_inquiry *data); |
Kevin O'Connor | 76977b2 | 2010-02-17 01:01:32 -0500 | [diff] [blame] | 73 | int cdb_get_sense(struct disk_op_s *op, struct cdbres_request_sense *data); |
Paolo Bonzini | 0082374 | 2011-11-16 13:02:42 +0100 | [diff] [blame] | 74 | int cdb_test_unit_ready(struct disk_op_s *op); |
Kevin O'Connor | 76977b2 | 2010-02-17 01:01:32 -0500 | [diff] [blame] | 75 | int cdb_read_capacity(struct disk_op_s *op, struct cdbres_read_capacity *data); |
Kevin O'Connor | 7149fc8 | 2010-02-17 23:24:42 -0500 | [diff] [blame] | 76 | int cdb_inquiry(struct disk_op_s *op, struct cdbres_inquiry *data); |
Kevin O'Connor | 76977b2 | 2010-02-17 01:01:32 -0500 | [diff] [blame] | 77 | int cdb_read(struct disk_op_s *op); |
Paolo Bonzini | ddb8ceb | 2011-11-16 13:02:47 +0100 | [diff] [blame^] | 78 | int cdb_write(struct disk_op_s *op); |
Kevin O'Connor | 76977b2 | 2010-02-17 01:01:32 -0500 | [diff] [blame] | 79 | |
Kevin O'Connor | 7d70025 | 2010-02-15 11:56:07 -0500 | [diff] [blame] | 80 | #endif // blockcmd.h |