blob: 903c435f7b987f7ec1c2e235cf61f21c39f2c732 [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
Kevin O'Connor7149fc82010-02-17 23:24:42 -050035#define CDB_CMD_INQUIRY 0x12
Kevin O'Connor7d700252010-02-15 11:56:07 -050036#define CDB_CMD_REQUEST_SENSE 0x03
37
38struct cdb_request_sense {
39 u8 command;
40 u8 flags;
41 u16 reserved_02;
42 u8 length;
43 u8 reserved_05;
44 u8 pad[10];
45} PACKED;
46
47struct cdbres_request_sense {
48 u8 errcode;
49 u8 segment;
50 u8 flags;
51 u32 info;
52 u8 additional;
53 u32 specific;
54 u8 asc;
55 u8 ascq;
56 u32 reserved_0e;
57} PACKED;
58
Kevin O'Connor7149fc82010-02-17 23:24:42 -050059struct cdbres_inquiry {
60 u8 pdt;
61 u8 removable;
62 u8 reserved_02[2];
63 u8 additional;
64 u8 reserved_05[3];
65 char vendor[8];
66 char product[16];
67 char rev[4];
68} PACKED;
69
Kevin O'Connor76977b22010-02-17 01:01:32 -050070// blockcmd.c
Kevin O'Connor7149fc82010-02-17 23:24:42 -050071int cdb_get_inquiry(struct disk_op_s *op, struct cdbres_inquiry *data);
Kevin O'Connor76977b22010-02-17 01:01:32 -050072int cdb_get_sense(struct disk_op_s *op, struct cdbres_request_sense *data);
73int cdb_read_capacity(struct disk_op_s *op, struct cdbres_read_capacity *data);
Kevin O'Connor7149fc82010-02-17 23:24:42 -050074int cdb_inquiry(struct disk_op_s *op, struct cdbres_inquiry *data);
Kevin O'Connor76977b22010-02-17 01:01:32 -050075int cdb_read(struct disk_op_s *op);
76
Kevin O'Connor7d700252010-02-15 11:56:07 -050077#endif // blockcmd.h