blob: 84ab65988af26183df9acdf51724b3ea7afb6251 [file] [log] [blame]
Kevin O'Connor7d700252010-02-15 11:56:07 -05001// 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
11struct 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
23struct cdb_read_capacity {
24 u8 command;
25 u8 flags;
26 u8 resreved_02[8];
27 u8 pad[6];
28} PACKED;
29
30struct cdbres_read_capacity {
31 u32 sectors;
32 u32 blksize;
33} PACKED;
34
Paolo Bonzini00823742011-11-16 13:02:42 +010035#define CDB_CMD_TEST_UNIT_READY 0x00
36#define CDB_CMD_INQUIRY 0x12
37#define CDB_CMD_REQUEST_SENSE 0x03
Kevin O'Connor7d700252010-02-15 11:56:07 -050038
39struct 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
48struct 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'Connor7149fc82010-02-17 23:24:42 -050060struct 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'Connor76977b22010-02-17 01:01:32 -050071// blockcmd.c
Kevin O'Connor7149fc82010-02-17 23:24:42 -050072int cdb_get_inquiry(struct disk_op_s *op, struct cdbres_inquiry *data);
Kevin O'Connor76977b22010-02-17 01:01:32 -050073int cdb_get_sense(struct disk_op_s *op, struct cdbres_request_sense *data);
Paolo Bonzini00823742011-11-16 13:02:42 +010074int cdb_test_unit_ready(struct disk_op_s *op);
Kevin O'Connor76977b22010-02-17 01:01:32 -050075int cdb_read_capacity(struct disk_op_s *op, struct cdbres_read_capacity *data);
Kevin O'Connor7149fc82010-02-17 23:24:42 -050076int cdb_inquiry(struct disk_op_s *op, struct cdbres_inquiry *data);
Kevin O'Connor76977b22010-02-17 01:01:32 -050077int cdb_read(struct disk_op_s *op);
Paolo Bonziniddb8ceb2011-11-16 13:02:47 +010078int cdb_write(struct disk_op_s *op);
Kevin O'Connor76977b22010-02-17 01:01:32 -050079
Kevin O'Connor7d700252010-02-15 11:56:07 -050080#endif // blockcmd.h