9 #define IDEREG_DATA 0x00
10 #define IDEREG_ERROR 0x01
11 #define IDEREG_FEATURE IDEREG_ERROR
12 #define IDEREG_NSECTOR 0x02
13 #define IDEREG_SECTOR 0x03
14 #define IDEREG_LCYL 0x04
15 #define IDEREG_HCYL 0x05
16 #define IDEREG_CURRENT 0x06
17 #define IDEREG_STATUS 0x07
18 #define IDEREG_COMMAND IDEREG_STATUS
19 #define IDEREG_CONTROL 0x08
20 #define IDEREG_ASTATUS IDEREG_CONTROL
25 #define IDECON_NIEN 0x02
26 #define IDECON_SRST 0x04
31 #define IDEHEAD_LBA 0x40
32 #define IDEHEAD_DEV0 0x00
33 #define IDEHEAD_DEV1 0x10
40 #define SEEK_STAT 0x10
41 #define WRERR_STAT 0x20
42 #define READY_STAT 0x40
43 #define BUSY_STAT 0x80
45 #define IREASON_CD 0x01
46 #define IREASON_IO 0x02
52 #define WIN_READ_EXT 0x24
53 #define WIN_IDENTIFY 0xEC
54 #define WIN_PACKET 0xA0
55 #define WIN_IDENTIFY_PACKET 0xA1
60 #define ATAPI_TUR 0x00
61 #define ATAPI_READ_10 0x28
62 #define ATAPI_REQ_SENSE 0x03
63 #define ATAPI_START_STOP_UNIT 0x1b
64 #define ATAPI_READ_CAPACITY 0x25
69 #define ATAPI_SENSE_NOT_READY 0x02
72 * supported device types
81 ide_media_floppy
= 0x00,
82 ide_media_cdrom
= 0x05,
83 ide_media_optical
= 0x07,
84 ide_media_disk
= 0x20,
97 * simple ata command that works for everything (except 48-bit lba commands)
100 unsigned char *buffer
;
107 unsigned char feature
;
108 unsigned char nsector
;
109 unsigned char sector
;
112 unsigned char device_head
;
113 unsigned char command
;
114 unsigned char control
;
117 * or tasklet, just for lba48 for now (above could be scrapped)
119 unsigned char task
[10];
128 struct atapi_command
{
129 unsigned char cdb
[12];
130 unsigned char *buffer
;
132 unsigned char data_direction
;
135 unsigned char sense_valid
;
136 struct request_sense sense
;
137 unsigned char old_cdb
;
143 char unit
; /* 0: master, 1: slave */
144 char present
; /* there or not */
145 char type
; /* ata or atapi */
146 char media
; /* disk, cdrom, etc */
147 char addressing
; /* chs/lba28/lba48 */
149 char model
[41]; /* name */
152 unsigned long sectors
;
154 unsigned int max_sectors
;
157 * for legacy chs crap
163 unsigned int bs
; /* block size */
165 struct ide_channel
*channel
;
171 struct ide_channel
*next
;
174 * either mmio or io_regs is set to indicate mmio or not
180 * can be set to a mmio hook, default it legacy outb/inb
182 void (*obide_outb
)(struct ide_channel
*chan
,
183 unsigned char addr
, unsigned int port
);
184 unsigned char (*obide_inb
)(struct ide_channel
*chan
,
186 void (*obide_insw
)(struct ide_channel
*chan
,
187 unsigned int port
, unsigned char *addr
,
189 void (*obide_outsw
)(struct ide_channel
*chan
,
190 unsigned int port
, unsigned char *addr
,
193 struct ide_drive drives
[2];
198 * only one can be busy per channel
200 struct ata_command ata_cmd
;
201 struct atapi_command atapi_cmd
;
211 static int ob_ide_atapi_request_sense(struct ide_drive
*drive
);