2009-06-29 Robert Millan <rmh.grub@aybabtu.com>
[grub2/jjazz.git] / include / grub / scsicmd.h
blob40f237a174d5d060f2620d68fbd5b23e676e422f
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2008 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_SCSICMD_H
20 #define GRUB_SCSICMD_H 1
22 #include <grub/types.h>
24 #define GRUB_SCSI_DEVTYPE_MASK 31
25 #define GRUB_SCSI_REMOVABLE_BIT 7
26 #define GRUB_SCSI_LUN_SHIFT 5
28 struct grub_scsi_inquiry
30 grub_uint8_t opcode;
31 grub_uint8_t lun;
32 grub_uint16_t reserved;
33 grub_uint16_t alloc_length;
34 grub_uint8_t reserved2;
35 grub_uint8_t pad[5];
36 } __attribute__((packed));
38 struct grub_scsi_inquiry_data
40 grub_uint8_t devtype;
41 grub_uint8_t rmb;
42 grub_uint16_t reserved;
43 grub_uint8_t length;
44 grub_uint8_t reserved2[3];
45 char vendor[8];
46 char prodid[16];
47 char prodrev[4];
48 } __attribute__((packed));
50 struct grub_scsi_read_capacity
52 grub_uint8_t opcode;
53 grub_uint8_t lun;
54 grub_uint8_t reserved[8];
55 grub_uint8_t pad[2];
56 } __attribute__((packed));
58 struct grub_scsi_read_capacity_data
60 grub_uint32_t size;
61 grub_uint32_t blocksize;
62 } __attribute__((packed));
64 struct grub_scsi_read10
66 grub_uint8_t opcode;
67 grub_uint8_t lun;
68 grub_uint32_t lba;
69 grub_uint8_t reserved;
70 grub_uint16_t size;
71 grub_uint8_t reserved2;
72 grub_uint16_t pad;
73 } __attribute__((packed));
75 struct grub_scsi_read12
77 grub_uint8_t opcode;
78 grub_uint8_t lun;
79 grub_uint32_t lba;
80 grub_uint32_t size;
81 grub_uint8_t reserved;
82 grub_uint8_t control;
83 } __attribute__((packed));
85 struct grub_scsi_write10
87 grub_uint8_t opcode;
88 grub_uint8_t lun;
89 grub_uint32_t lba;
90 grub_uint8_t reserved;
91 grub_uint16_t size;
92 grub_uint8_t reserved2;
93 grub_uint16_t pad;
94 } __attribute__((packed));
96 struct grub_scsi_write12
98 grub_uint8_t opcode;
99 grub_uint8_t lun;
100 grub_uint32_t lba;
101 grub_uint32_t size;
102 grub_uint8_t reserved;
103 grub_uint8_t control;
104 } __attribute__((packed));
106 typedef enum
108 grub_scsi_cmd_inquiry = 0x12,
109 grub_scsi_cmd_read_capacity = 0x25,
110 grub_scsi_cmd_read10 = 0x28,
111 grub_scsi_cmd_write10 = 0x2a,
112 grub_scsi_cmd_read12 = 0xa8,
113 grub_scsi_cmd_write12 = 0xaa
114 } grub_scsi_cmd_t;
116 typedef enum
118 grub_scsi_devtype_direct = 0x00,
119 grub_scsi_devtype_cdrom = 0x05
120 } grub_scsi_devtype_t;
122 #endif /* GRUB_SCSICMD_H */