root / hw / ide / internal.h @ a0f42610
History | View | Annotate | Download (20 kB)
1 | 356721ae | Gerd Hoffmann | #ifndef HW_IDE_INTERNAL_H
|
---|---|---|---|
2 | 356721ae | Gerd Hoffmann | #define HW_IDE_INTERNAL_H
|
3 | 356721ae | Gerd Hoffmann | |
4 | 356721ae | Gerd Hoffmann | /*
|
5 | 356721ae | Gerd Hoffmann | * QEMU IDE Emulation -- internal header file
|
6 | 59f2a787 | Gerd Hoffmann | * only files in hw/ide/ are supposed to include this file.
|
7 | 356721ae | Gerd Hoffmann | * non-internal declarations are in hw/ide.h
|
8 | 356721ae | Gerd Hoffmann | */
|
9 | 59f2a787 | Gerd Hoffmann | #include <hw/ide.h> |
10 | 4a91d3b3 | Richard Henderson | #include <hw/isa.h> |
11 | 9fbef1ac | Avi Kivity | #include "iorange.h" |
12 | 33231e0e | Kevin Wolf | #include "dma.h" |
13 | 1dfb4dd9 | Luiz Capitulino | #include "sysemu.h" |
14 | 67cc61e4 | Paolo Bonzini | #include "hw/scsi-defs.h" |
15 | 356721ae | Gerd Hoffmann | |
16 | 356721ae | Gerd Hoffmann | /* debug IDE devices */
|
17 | 356721ae | Gerd Hoffmann | //#define DEBUG_IDE
|
18 | 356721ae | Gerd Hoffmann | //#define DEBUG_IDE_ATAPI
|
19 | 356721ae | Gerd Hoffmann | //#define DEBUG_AIO
|
20 | 356721ae | Gerd Hoffmann | #define USE_DMA_CDROM
|
21 | 356721ae | Gerd Hoffmann | |
22 | 356721ae | Gerd Hoffmann | typedef struct IDEBus IDEBus; |
23 | da4d0419 | Gerd Hoffmann | typedef struct IDEDevice IDEDevice; |
24 | da4d0419 | Gerd Hoffmann | typedef struct IDEDeviceInfo IDEDeviceInfo; |
25 | 356721ae | Gerd Hoffmann | typedef struct IDEState IDEState; |
26 | 40a6238a | Alexander Graf | typedef struct IDEDMA IDEDMA; |
27 | 40a6238a | Alexander Graf | typedef struct IDEDMAOps IDEDMAOps; |
28 | 356721ae | Gerd Hoffmann | |
29 | 356721ae | Gerd Hoffmann | /* Bits of HD_STATUS */
|
30 | 356721ae | Gerd Hoffmann | #define ERR_STAT 0x01 |
31 | 356721ae | Gerd Hoffmann | #define INDEX_STAT 0x02 |
32 | 356721ae | Gerd Hoffmann | #define ECC_STAT 0x04 /* Corrected error */ |
33 | 356721ae | Gerd Hoffmann | #define DRQ_STAT 0x08 |
34 | 356721ae | Gerd Hoffmann | #define SEEK_STAT 0x10 |
35 | 356721ae | Gerd Hoffmann | #define SRV_STAT 0x10 |
36 | 356721ae | Gerd Hoffmann | #define WRERR_STAT 0x20 |
37 | 356721ae | Gerd Hoffmann | #define READY_STAT 0x40 |
38 | 356721ae | Gerd Hoffmann | #define BUSY_STAT 0x80 |
39 | 356721ae | Gerd Hoffmann | |
40 | 356721ae | Gerd Hoffmann | /* Bits for HD_ERROR */
|
41 | 356721ae | Gerd Hoffmann | #define MARK_ERR 0x01 /* Bad address mark */ |
42 | 356721ae | Gerd Hoffmann | #define TRK0_ERR 0x02 /* couldn't find track 0 */ |
43 | 356721ae | Gerd Hoffmann | #define ABRT_ERR 0x04 /* Command aborted */ |
44 | 356721ae | Gerd Hoffmann | #define MCR_ERR 0x08 /* media change request */ |
45 | 356721ae | Gerd Hoffmann | #define ID_ERR 0x10 /* ID field not found */ |
46 | 356721ae | Gerd Hoffmann | #define MC_ERR 0x20 /* media changed */ |
47 | 356721ae | Gerd Hoffmann | #define ECC_ERR 0x40 /* Uncorrectable ECC error */ |
48 | 356721ae | Gerd Hoffmann | #define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */ |
49 | 356721ae | Gerd Hoffmann | #define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */ |
50 | 356721ae | Gerd Hoffmann | |
51 | 356721ae | Gerd Hoffmann | /* Bits of HD_NSECTOR */
|
52 | 356721ae | Gerd Hoffmann | #define CD 0x01 |
53 | 356721ae | Gerd Hoffmann | #define IO 0x02 |
54 | 356721ae | Gerd Hoffmann | #define REL 0x04 |
55 | 356721ae | Gerd Hoffmann | #define TAG_MASK 0xf8 |
56 | 356721ae | Gerd Hoffmann | |
57 | 356721ae | Gerd Hoffmann | #define IDE_CMD_RESET 0x04 |
58 | 356721ae | Gerd Hoffmann | #define IDE_CMD_DISABLE_IRQ 0x02 |
59 | 356721ae | Gerd Hoffmann | |
60 | 1d4316d3 | Markus Armbruster | /* ACS-2 T13/2015-D Table B.2 Command codes */
|
61 | 356721ae | Gerd Hoffmann | #define WIN_NOP 0x00 |
62 | 1d4316d3 | Markus Armbruster | /* reserved 0x01..0x02 */
|
63 | 356721ae | Gerd Hoffmann | #define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */ |
64 | 1d4316d3 | Markus Armbruster | /* reserved 0x04..0x05 */
|
65 | d353fb72 | Christoph Hellwig | #define WIN_DSM 0x06 |
66 | 1d4316d3 | Markus Armbruster | /* reserved 0x07 */
|
67 | 356721ae | Gerd Hoffmann | #define WIN_DEVICE_RESET 0x08 |
68 | 1d4316d3 | Markus Armbruster | /* reserved 0x09..0x0a */
|
69 | 1d4316d3 | Markus Armbruster | /* REQUEST SENSE DATA EXT 0x0B */
|
70 | 1d4316d3 | Markus Armbruster | /* reserved 0x0C..0x0F */
|
71 | 1d4316d3 | Markus Armbruster | #define WIN_RECAL 0x10 /* obsolete since ATA4 */ |
72 | 1d4316d3 | Markus Armbruster | /* obsolete since ATA3, retired in ATA4 0x11..0x1F */
|
73 | 356721ae | Gerd Hoffmann | #define WIN_READ 0x20 /* 28-Bit */ |
74 | 1d4316d3 | Markus Armbruster | #define WIN_READ_ONCE 0x21 /* 28-Bit w/o retries, obsolete since ATA5 */ |
75 | 1d4316d3 | Markus Armbruster | /* obsolete since ATA4 0x22..0x23 */
|
76 | 356721ae | Gerd Hoffmann | #define WIN_READ_EXT 0x24 /* 48-Bit */ |
77 | 356721ae | Gerd Hoffmann | #define WIN_READDMA_EXT 0x25 /* 48-Bit */ |
78 | 1d4316d3 | Markus Armbruster | #define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit, obsolete since ACS2 */ |
79 | 356721ae | Gerd Hoffmann | #define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */ |
80 | 1d4316d3 | Markus Armbruster | /* reserved 0x28 */
|
81 | 356721ae | Gerd Hoffmann | #define WIN_MULTREAD_EXT 0x29 /* 48-Bit */ |
82 | 1d4316d3 | Markus Armbruster | /* READ STREAM DMA EXT 0x2A */
|
83 | 1d4316d3 | Markus Armbruster | /* READ STREAM EXT 0x2B */
|
84 | 1d4316d3 | Markus Armbruster | /* reserved 0x2C..0x2E */
|
85 | 1d4316d3 | Markus Armbruster | /* READ LOG EXT 0x2F */
|
86 | 356721ae | Gerd Hoffmann | #define WIN_WRITE 0x30 /* 28-Bit */ |
87 | 1d4316d3 | Markus Armbruster | #define WIN_WRITE_ONCE 0x31 /* 28-Bit w/o retries, obsolete since ATA5 */ |
88 | 1d4316d3 | Markus Armbruster | /* obsolete since ATA4 0x32..0x33 */
|
89 | 356721ae | Gerd Hoffmann | #define WIN_WRITE_EXT 0x34 /* 48-Bit */ |
90 | 356721ae | Gerd Hoffmann | #define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */ |
91 | 356721ae | Gerd Hoffmann | #define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */ |
92 | 1d4316d3 | Markus Armbruster | #define WIN_SET_MAX_EXT 0x37 /* 48-Bit, obsolete since ACS2 */ |
93 | 356721ae | Gerd Hoffmann | #define WIN_SET_MAX_EXT 0x37 /* 48-Bit */ |
94 | 356721ae | Gerd Hoffmann | #define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */ |
95 | 356721ae | Gerd Hoffmann | #define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */ |
96 | 1d4316d3 | Markus Armbruster | /* WRITE STREAM DMA EXT 0x3A */
|
97 | 1d4316d3 | Markus Armbruster | /* WRITE STREAM EXT 0x3B */
|
98 | 1d4316d3 | Markus Armbruster | #define WIN_WRITE_VERIFY 0x3C /* 28-Bit, obsolete since ATA4 */ |
99 | 1d4316d3 | Markus Armbruster | /* WRITE DMA FUA EXT 0x3D */
|
100 | 1d4316d3 | Markus Armbruster | /* obsolete since ACS2 0x3E */
|
101 | 1d4316d3 | Markus Armbruster | /* WRITE LOG EXT 0x3F */
|
102 | 356721ae | Gerd Hoffmann | #define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */ |
103 | 1d4316d3 | Markus Armbruster | #define WIN_VERIFY_ONCE 0x41 /* 28-Bit - w/o retries, obsolete since ATA5 */ |
104 | 356721ae | Gerd Hoffmann | #define WIN_VERIFY_EXT 0x42 /* 48-Bit */ |
105 | 1d4316d3 | Markus Armbruster | /* reserved 0x43..0x44 */
|
106 | 1d4316d3 | Markus Armbruster | /* WRITE UNCORRECTABLE EXT 0x45 */
|
107 | 1d4316d3 | Markus Armbruster | /* reserved 0x46 */
|
108 | 1d4316d3 | Markus Armbruster | /* READ LOG DMA EXT 0x47 */
|
109 | 1d4316d3 | Markus Armbruster | /* reserved 0x48..0x4F */
|
110 | 1d4316d3 | Markus Armbruster | /* obsolete since ATA4 0x50 */
|
111 | 1d4316d3 | Markus Armbruster | /* CONFIGURE STREAM 0x51 */
|
112 | 1d4316d3 | Markus Armbruster | /* reserved 0x52..0x56 */
|
113 | 1d4316d3 | Markus Armbruster | /* WRITE LOG DMA EXT 0x57 */
|
114 | 1d4316d3 | Markus Armbruster | /* reserved 0x58..0x5A */
|
115 | 1d4316d3 | Markus Armbruster | /* TRUSTED NON DATA 0x5B */
|
116 | 1d4316d3 | Markus Armbruster | /* TRUSTED RECEIVE 0x5C */
|
117 | 1d4316d3 | Markus Armbruster | /* TRUSTED RECEIVE DMA 0x5D */
|
118 | 1d4316d3 | Markus Armbruster | /* TRUSTED SEND 0x5E */
|
119 | 1d4316d3 | Markus Armbruster | /* TRUSTED SEND DMA 0x5F */
|
120 | 1d4316d3 | Markus Armbruster | /* READ FPDMA QUEUED 0x60 */
|
121 | 1d4316d3 | Markus Armbruster | /* WRITE FPDMA QUEUED 0x61 */
|
122 | 1d4316d3 | Markus Armbruster | /* reserved 0x62->0x6F */
|
123 | 1d4316d3 | Markus Armbruster | #define WIN_SEEK 0x70 /* obsolete since ATA7 */ |
124 | 1d4316d3 | Markus Armbruster | /* reserved 0x71-0x7F */
|
125 | 1d4316d3 | Markus Armbruster | /* vendor specific 0x80-0x86 */
|
126 | 356721ae | Gerd Hoffmann | #define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */ |
127 | 1d4316d3 | Markus Armbruster | /* vendor specific 0x88-0x8F */
|
128 | 356721ae | Gerd Hoffmann | #define WIN_DIAGNOSE 0x90 |
129 | 1d4316d3 | Markus Armbruster | #define WIN_SPECIFY 0x91 /* set drive geometry translation, obsolete since ATA6 */ |
130 | 356721ae | Gerd Hoffmann | #define WIN_DOWNLOAD_MICROCODE 0x92 |
131 | 1d4316d3 | Markus Armbruster | /* DOWNLOAD MICROCODE DMA 0x93 */
|
132 | 1d4316d3 | Markus Armbruster | #define WIN_STANDBYNOW2 0x94 /* retired in ATA4 */ |
133 | 1d4316d3 | Markus Armbruster | #define WIN_IDLEIMMEDIATE2 0x95 /* force drive to become "ready", retired in ATA4 */ |
134 | 1d4316d3 | Markus Armbruster | #define WIN_STANDBY2 0x96 /* retired in ATA4 */ |
135 | 1d4316d3 | Markus Armbruster | #define WIN_SETIDLE2 0x97 /* retired in ATA4 */ |
136 | 1d4316d3 | Markus Armbruster | #define WIN_CHECKPOWERMODE2 0x98 /* retired in ATA4 */ |
137 | 1d4316d3 | Markus Armbruster | #define WIN_SLEEPNOW2 0x99 /* retired in ATA4 */ |
138 | 1d4316d3 | Markus Armbruster | /* vendor specific 0x9A */
|
139 | 1d4316d3 | Markus Armbruster | /* reserved 0x9B..0x9F */
|
140 | 356721ae | Gerd Hoffmann | #define WIN_PACKETCMD 0xA0 /* Send a packet command. */ |
141 | 356721ae | Gerd Hoffmann | #define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */ |
142 | 1d4316d3 | Markus Armbruster | #define WIN_QUEUED_SERVICE 0xA2 /* obsolete since ACS2 */ |
143 | 1d4316d3 | Markus Armbruster | /* reserved 0xA3..0xAF */
|
144 | 356721ae | Gerd Hoffmann | #define WIN_SMART 0xB0 /* self-monitoring and reporting */ |
145 | 1d4316d3 | Markus Armbruster | /* Device Configuration Overlay 0xB1 */
|
146 | 1d4316d3 | Markus Armbruster | /* reserved 0xB2..0xB3 */
|
147 | 1d4316d3 | Markus Armbruster | /* Sanitize Device 0xB4 */
|
148 | 1d4316d3 | Markus Armbruster | /* reserved 0xB5 */
|
149 | 1d4316d3 | Markus Armbruster | /* NV Cache 0xB6 */
|
150 | 1d4316d3 | Markus Armbruster | /* reserved for CFA 0xB7..0xBB */
|
151 | 356721ae | Gerd Hoffmann | #define CFA_ACCESS_METADATA_STORAGE 0xB8 |
152 | 1d4316d3 | Markus Armbruster | /* reserved 0xBC..0xBF */
|
153 | 356721ae | Gerd Hoffmann | #define CFA_ERASE_SECTORS 0xC0 /* microdrives implement as NOP */ |
154 | 1d4316d3 | Markus Armbruster | /* vendor specific 0xC1..0xC3 */
|
155 | 356721ae | Gerd Hoffmann | #define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/ |
156 | 356721ae | Gerd Hoffmann | #define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */ |
157 | 356721ae | Gerd Hoffmann | #define WIN_SETMULT 0xC6 /* enable/disable multiple mode */ |
158 | 1d4316d3 | Markus Armbruster | #define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers, obsolete since ACS2 */ |
159 | 356721ae | Gerd Hoffmann | #define WIN_READDMA 0xC8 /* read sectors using DMA transfers */ |
160 | 1d4316d3 | Markus Armbruster | #define WIN_READDMA_ONCE 0xC9 /* 28-Bit - w/o retries, obsolete since ATA5 */ |
161 | 356721ae | Gerd Hoffmann | #define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */ |
162 | 1d4316d3 | Markus Armbruster | #define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - w/o retries, obsolete since ATA5 */ |
163 | 1d4316d3 | Markus Armbruster | #define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers, obsolete since ACS2 */ |
164 | 356721ae | Gerd Hoffmann | #define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */ |
165 | 1d4316d3 | Markus Armbruster | /* WRITE MULTIPLE FUA EXT 0xCE */
|
166 | 1d4316d3 | Markus Armbruster | /* reserved 0xCF..0xDO */
|
167 | 1d4316d3 | Markus Armbruster | /* CHECK MEDIA CARD TYPE 0xD1 */
|
168 | 1d4316d3 | Markus Armbruster | /* reserved for media card pass through 0xD2..0xD4 */
|
169 | 1d4316d3 | Markus Armbruster | /* reserved 0xD5..0xD9 */
|
170 | 1d4316d3 | Markus Armbruster | #define WIN_GETMEDIASTATUS 0xDA /* obsolete since ATA8 */ |
171 | 1d4316d3 | Markus Armbruster | /* obsolete since ATA3, retired in ATA4 0xDB..0xDD */
|
172 | 1d4316d3 | Markus Armbruster | #define WIN_DOORLOCK 0xDE /* lock door on removable drives, obsolete since ATA8 */ |
173 | 1d4316d3 | Markus Armbruster | #define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives, obsolete since ATA8 */ |
174 | 356721ae | Gerd Hoffmann | #define WIN_STANDBYNOW1 0xE0 |
175 | 356721ae | Gerd Hoffmann | #define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */ |
176 | 356721ae | Gerd Hoffmann | #define WIN_STANDBY 0xE2 /* Set device in Standby Mode */ |
177 | 356721ae | Gerd Hoffmann | #define WIN_SETIDLE1 0xE3 |
178 | 356721ae | Gerd Hoffmann | #define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */ |
179 | 356721ae | Gerd Hoffmann | #define WIN_CHECKPOWERMODE1 0xE5 |
180 | 356721ae | Gerd Hoffmann | #define WIN_SLEEPNOW1 0xE6 |
181 | 356721ae | Gerd Hoffmann | #define WIN_FLUSH_CACHE 0xE7 |
182 | 356721ae | Gerd Hoffmann | #define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */ |
183 | 1d4316d3 | Markus Armbruster | /* READ BUFFER DMA 0xE9 */
|
184 | 356721ae | Gerd Hoffmann | #define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */ |
185 | 1d4316d3 | Markus Armbruster | /* WRITE BUFFER DMA 0xEB */
|
186 | 356721ae | Gerd Hoffmann | #define WIN_IDENTIFY 0xEC /* ask drive to identify itself */ |
187 | 1d4316d3 | Markus Armbruster | #define WIN_MEDIAEJECT 0xED /* obsolete since ATA8 */ |
188 | 1d4316d3 | Markus Armbruster | /* obsolete since ATA4 0xEE */
|
189 | 356721ae | Gerd Hoffmann | #define WIN_SETFEATURES 0xEF /* set special drive features */ |
190 | 1d4316d3 | Markus Armbruster | #define IBM_SENSE_CONDITION 0xF0 /* measure disk temperature, vendor specific */ |
191 | 356721ae | Gerd Hoffmann | #define WIN_SECURITY_SET_PASS 0xF1 |
192 | 356721ae | Gerd Hoffmann | #define WIN_SECURITY_UNLOCK 0xF2 |
193 | 356721ae | Gerd Hoffmann | #define WIN_SECURITY_ERASE_PREPARE 0xF3 |
194 | 356721ae | Gerd Hoffmann | #define WIN_SECURITY_ERASE_UNIT 0xF4 |
195 | 356721ae | Gerd Hoffmann | #define WIN_SECURITY_FREEZE_LOCK 0xF5 |
196 | 1d4316d3 | Markus Armbruster | #define CFA_WEAR_LEVEL 0xF5 /* microdrives implement as NOP; not specified in T13! */ |
197 | 356721ae | Gerd Hoffmann | #define WIN_SECURITY_DISABLE 0xF6 |
198 | 1d4316d3 | Markus Armbruster | /* vendor specific 0xF7 */
|
199 | 356721ae | Gerd Hoffmann | #define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */ |
200 | 356721ae | Gerd Hoffmann | #define WIN_SET_MAX 0xF9 |
201 | 1d4316d3 | Markus Armbruster | /* vendor specific 0xFA..0xFF */
|
202 | 356721ae | Gerd Hoffmann | |
203 | 356721ae | Gerd Hoffmann | /* set to 1 set disable mult support */
|
204 | 356721ae | Gerd Hoffmann | #define MAX_MULT_SECTORS 16 |
205 | 356721ae | Gerd Hoffmann | |
206 | 356721ae | Gerd Hoffmann | #define IDE_DMA_BUF_SECTORS 256 |
207 | 356721ae | Gerd Hoffmann | |
208 | d353fb72 | Christoph Hellwig | /* feature values for Data Set Management */
|
209 | d353fb72 | Christoph Hellwig | #define DSM_TRIM 0x01 |
210 | d353fb72 | Christoph Hellwig | |
211 | 356721ae | Gerd Hoffmann | #if (IDE_DMA_BUF_SECTORS < MAX_MULT_SECTORS)
|
212 | 356721ae | Gerd Hoffmann | #error "IDE_DMA_BUF_SECTORS must be bigger or equal to MAX_MULT_SECTORS" |
213 | 356721ae | Gerd Hoffmann | #endif
|
214 | 356721ae | Gerd Hoffmann | |
215 | 356721ae | Gerd Hoffmann | /* ATAPI defines */
|
216 | 356721ae | Gerd Hoffmann | |
217 | 356721ae | Gerd Hoffmann | #define ATAPI_PACKET_SIZE 12 |
218 | 356721ae | Gerd Hoffmann | |
219 | 356721ae | Gerd Hoffmann | /* The generic packet command opcodes for CD/DVD Logical Units,
|
220 | 356721ae | Gerd Hoffmann | * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
|
221 | 356721ae | Gerd Hoffmann | #define GPCMD_BLANK 0xa1 |
222 | 356721ae | Gerd Hoffmann | #define GPCMD_CLOSE_TRACK 0x5b |
223 | 356721ae | Gerd Hoffmann | #define GPCMD_FLUSH_CACHE 0x35 |
224 | 356721ae | Gerd Hoffmann | #define GPCMD_FORMAT_UNIT 0x04 |
225 | 356721ae | Gerd Hoffmann | #define GPCMD_GET_CONFIGURATION 0x46 |
226 | 356721ae | Gerd Hoffmann | #define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a |
227 | 356721ae | Gerd Hoffmann | #define GPCMD_GET_PERFORMANCE 0xac |
228 | 356721ae | Gerd Hoffmann | #define GPCMD_INQUIRY 0x12 |
229 | 356721ae | Gerd Hoffmann | #define GPCMD_LOAD_UNLOAD 0xa6 |
230 | 356721ae | Gerd Hoffmann | #define GPCMD_MECHANISM_STATUS 0xbd |
231 | 356721ae | Gerd Hoffmann | #define GPCMD_MODE_SELECT_10 0x55 |
232 | 356721ae | Gerd Hoffmann | #define GPCMD_MODE_SENSE_10 0x5a |
233 | 356721ae | Gerd Hoffmann | #define GPCMD_PAUSE_RESUME 0x4b |
234 | 356721ae | Gerd Hoffmann | #define GPCMD_PLAY_AUDIO_10 0x45 |
235 | 356721ae | Gerd Hoffmann | #define GPCMD_PLAY_AUDIO_MSF 0x47 |
236 | 356721ae | Gerd Hoffmann | #define GPCMD_PLAY_AUDIO_TI 0x48 |
237 | 356721ae | Gerd Hoffmann | #define GPCMD_PLAY_CD 0xbc |
238 | 356721ae | Gerd Hoffmann | #define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e |
239 | 356721ae | Gerd Hoffmann | #define GPCMD_READ_10 0x28 |
240 | 356721ae | Gerd Hoffmann | #define GPCMD_READ_12 0xa8 |
241 | 356721ae | Gerd Hoffmann | #define GPCMD_READ_CDVD_CAPACITY 0x25 |
242 | 356721ae | Gerd Hoffmann | #define GPCMD_READ_CD 0xbe |
243 | 356721ae | Gerd Hoffmann | #define GPCMD_READ_CD_MSF 0xb9 |
244 | 356721ae | Gerd Hoffmann | #define GPCMD_READ_DISC_INFO 0x51 |
245 | 356721ae | Gerd Hoffmann | #define GPCMD_READ_DVD_STRUCTURE 0xad |
246 | 356721ae | Gerd Hoffmann | #define GPCMD_READ_FORMAT_CAPACITIES 0x23 |
247 | 356721ae | Gerd Hoffmann | #define GPCMD_READ_HEADER 0x44 |
248 | 356721ae | Gerd Hoffmann | #define GPCMD_READ_TRACK_RZONE_INFO 0x52 |
249 | 356721ae | Gerd Hoffmann | #define GPCMD_READ_SUBCHANNEL 0x42 |
250 | 356721ae | Gerd Hoffmann | #define GPCMD_READ_TOC_PMA_ATIP 0x43 |
251 | 356721ae | Gerd Hoffmann | #define GPCMD_REPAIR_RZONE_TRACK 0x58 |
252 | 356721ae | Gerd Hoffmann | #define GPCMD_REPORT_KEY 0xa4 |
253 | 356721ae | Gerd Hoffmann | #define GPCMD_REQUEST_SENSE 0x03 |
254 | 356721ae | Gerd Hoffmann | #define GPCMD_RESERVE_RZONE_TRACK 0x53 |
255 | 356721ae | Gerd Hoffmann | #define GPCMD_SCAN 0xba |
256 | 356721ae | Gerd Hoffmann | #define GPCMD_SEEK 0x2b |
257 | 356721ae | Gerd Hoffmann | #define GPCMD_SEND_DVD_STRUCTURE 0xad |
258 | 356721ae | Gerd Hoffmann | #define GPCMD_SEND_EVENT 0xa2 |
259 | 356721ae | Gerd Hoffmann | #define GPCMD_SEND_KEY 0xa3 |
260 | 356721ae | Gerd Hoffmann | #define GPCMD_SEND_OPC 0x54 |
261 | 356721ae | Gerd Hoffmann | #define GPCMD_SET_READ_AHEAD 0xa7 |
262 | 356721ae | Gerd Hoffmann | #define GPCMD_SET_STREAMING 0xb6 |
263 | 356721ae | Gerd Hoffmann | #define GPCMD_START_STOP_UNIT 0x1b |
264 | 356721ae | Gerd Hoffmann | #define GPCMD_STOP_PLAY_SCAN 0x4e |
265 | 356721ae | Gerd Hoffmann | #define GPCMD_TEST_UNIT_READY 0x00 |
266 | 356721ae | Gerd Hoffmann | #define GPCMD_VERIFY_10 0x2f |
267 | 356721ae | Gerd Hoffmann | #define GPCMD_WRITE_10 0x2a |
268 | 356721ae | Gerd Hoffmann | #define GPCMD_WRITE_AND_VERIFY_10 0x2e |
269 | 356721ae | Gerd Hoffmann | /* This is listed as optional in ATAPI 2.6, but is (curiously)
|
270 | 356721ae | Gerd Hoffmann | * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji
|
271 | 356721ae | Gerd Hoffmann | * Table 377 as an MMC command for SCSi devices though... Most ATAPI
|
272 | 356721ae | Gerd Hoffmann | * drives support it. */
|
273 | 356721ae | Gerd Hoffmann | #define GPCMD_SET_SPEED 0xbb |
274 | 356721ae | Gerd Hoffmann | /* This seems to be a SCSI specific CD-ROM opcode
|
275 | 356721ae | Gerd Hoffmann | * to play data at track/index */
|
276 | 356721ae | Gerd Hoffmann | #define GPCMD_PLAYAUDIO_TI 0x48 |
277 | 356721ae | Gerd Hoffmann | /*
|
278 | 356721ae | Gerd Hoffmann | * From MS Media Status Notification Support Specification. For
|
279 | 356721ae | Gerd Hoffmann | * older drives only.
|
280 | 356721ae | Gerd Hoffmann | */
|
281 | 356721ae | Gerd Hoffmann | #define GPCMD_GET_MEDIA_STATUS 0xda |
282 | 356721ae | Gerd Hoffmann | #define GPCMD_MODE_SENSE_6 0x1a |
283 | 356721ae | Gerd Hoffmann | |
284 | 356721ae | Gerd Hoffmann | #define ATAPI_INT_REASON_CD 0x01 /* 0 = data transfer */ |
285 | 356721ae | Gerd Hoffmann | #define ATAPI_INT_REASON_IO 0x02 /* 1 = transfer to the host */ |
286 | 356721ae | Gerd Hoffmann | #define ATAPI_INT_REASON_REL 0x04 |
287 | 356721ae | Gerd Hoffmann | #define ATAPI_INT_REASON_TAG 0xf8 |
288 | 356721ae | Gerd Hoffmann | |
289 | 356721ae | Gerd Hoffmann | /* same constants as bochs */
|
290 | 356721ae | Gerd Hoffmann | #define ASC_ILLEGAL_OPCODE 0x20 |
291 | 356721ae | Gerd Hoffmann | #define ASC_LOGICAL_BLOCK_OOR 0x21 |
292 | 356721ae | Gerd Hoffmann | #define ASC_INV_FIELD_IN_CMD_PACKET 0x24 |
293 | 356721ae | Gerd Hoffmann | #define ASC_MEDIUM_MAY_HAVE_CHANGED 0x28 |
294 | 356721ae | Gerd Hoffmann | #define ASC_INCOMPATIBLE_FORMAT 0x30 |
295 | 356721ae | Gerd Hoffmann | #define ASC_MEDIUM_NOT_PRESENT 0x3a |
296 | 356721ae | Gerd Hoffmann | #define ASC_SAVING_PARAMETERS_NOT_SUPPORTED 0x39 |
297 | 356721ae | Gerd Hoffmann | #define ASC_MEDIA_REMOVAL_PREVENTED 0x53 |
298 | 356721ae | Gerd Hoffmann | |
299 | 356721ae | Gerd Hoffmann | #define CFA_NO_ERROR 0x00 |
300 | 356721ae | Gerd Hoffmann | #define CFA_MISC_ERROR 0x09 |
301 | 356721ae | Gerd Hoffmann | #define CFA_INVALID_COMMAND 0x20 |
302 | 356721ae | Gerd Hoffmann | #define CFA_INVALID_ADDRESS 0x21 |
303 | 356721ae | Gerd Hoffmann | #define CFA_ADDRESS_OVERFLOW 0x2f |
304 | 356721ae | Gerd Hoffmann | |
305 | 356721ae | Gerd Hoffmann | #define SMART_READ_DATA 0xd0 |
306 | 356721ae | Gerd Hoffmann | #define SMART_READ_THRESH 0xd1 |
307 | 356721ae | Gerd Hoffmann | #define SMART_ATTR_AUTOSAVE 0xd2 |
308 | 356721ae | Gerd Hoffmann | #define SMART_SAVE_ATTR 0xd3 |
309 | 356721ae | Gerd Hoffmann | #define SMART_EXECUTE_OFFLINE 0xd4 |
310 | 356721ae | Gerd Hoffmann | #define SMART_READ_LOG 0xd5 |
311 | 356721ae | Gerd Hoffmann | #define SMART_WRITE_LOG 0xd6 |
312 | 356721ae | Gerd Hoffmann | #define SMART_ENABLE 0xd8 |
313 | 356721ae | Gerd Hoffmann | #define SMART_DISABLE 0xd9 |
314 | 356721ae | Gerd Hoffmann | #define SMART_STATUS 0xda |
315 | 356721ae | Gerd Hoffmann | |
316 | cd8722bb | Markus Armbruster | typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKind; |
317 | cd8722bb | Markus Armbruster | |
318 | 356721ae | Gerd Hoffmann | typedef void EndTransferFunc(IDEState *); |
319 | 356721ae | Gerd Hoffmann | |
320 | 40a6238a | Alexander Graf | typedef void DMAStartFunc(IDEDMA *, IDEState *, BlockDriverCompletionFunc *); |
321 | 40a6238a | Alexander Graf | typedef int DMAFunc(IDEDMA *); |
322 | 40a6238a | Alexander Graf | typedef int DMAIntFunc(IDEDMA *, int); |
323 | 1dfb4dd9 | Luiz Capitulino | typedef void DMARestartFunc(void *, int, RunState); |
324 | 40a6238a | Alexander Graf | |
325 | 996faf1a | Amit Shah | struct unreported_events {
|
326 | 996faf1a | Amit Shah | bool eject_request;
|
327 | 996faf1a | Amit Shah | bool new_media;
|
328 | 996faf1a | Amit Shah | }; |
329 | 996faf1a | Amit Shah | |
330 | 4e1e0051 | Christoph Hellwig | enum ide_dma_cmd {
|
331 | 4e1e0051 | Christoph Hellwig | IDE_DMA_READ, |
332 | 4e1e0051 | Christoph Hellwig | IDE_DMA_WRITE, |
333 | d353fb72 | Christoph Hellwig | IDE_DMA_TRIM, |
334 | 4e1e0051 | Christoph Hellwig | }; |
335 | 4e1e0051 | Christoph Hellwig | |
336 | 4e1e0051 | Christoph Hellwig | #define ide_cmd_is_read(s) \
|
337 | 4e1e0051 | Christoph Hellwig | ((s)->dma_cmd == IDE_DMA_READ) |
338 | 4e1e0051 | Christoph Hellwig | |
339 | 356721ae | Gerd Hoffmann | /* NOTE: IDEState represents in fact one drive */
|
340 | 356721ae | Gerd Hoffmann | struct IDEState {
|
341 | 356721ae | Gerd Hoffmann | IDEBus *bus; |
342 | 356721ae | Gerd Hoffmann | uint8_t unit; |
343 | 356721ae | Gerd Hoffmann | /* ide config */
|
344 | cd8722bb | Markus Armbruster | IDEDriveKind drive_kind; |
345 | 356721ae | Gerd Hoffmann | int cylinders, heads, sectors;
|
346 | 356721ae | Gerd Hoffmann | int64_t nb_sectors; |
347 | 356721ae | Gerd Hoffmann | int mult_sectors;
|
348 | 356721ae | Gerd Hoffmann | int identify_set;
|
349 | 96c35ceb | Juan Quintela | uint8_t identify_data[512];
|
350 | 356721ae | Gerd Hoffmann | int drive_serial;
|
351 | 356721ae | Gerd Hoffmann | char drive_serial_str[21]; |
352 | 356721ae | Gerd Hoffmann | /* ide regs */
|
353 | 356721ae | Gerd Hoffmann | uint8_t feature; |
354 | 356721ae | Gerd Hoffmann | uint8_t error; |
355 | 356721ae | Gerd Hoffmann | uint32_t nsector; |
356 | 356721ae | Gerd Hoffmann | uint8_t sector; |
357 | 356721ae | Gerd Hoffmann | uint8_t lcyl; |
358 | 356721ae | Gerd Hoffmann | uint8_t hcyl; |
359 | 356721ae | Gerd Hoffmann | /* other part of tf for lba48 support */
|
360 | 356721ae | Gerd Hoffmann | uint8_t hob_feature; |
361 | 356721ae | Gerd Hoffmann | uint8_t hob_nsector; |
362 | 356721ae | Gerd Hoffmann | uint8_t hob_sector; |
363 | 356721ae | Gerd Hoffmann | uint8_t hob_lcyl; |
364 | 356721ae | Gerd Hoffmann | uint8_t hob_hcyl; |
365 | 356721ae | Gerd Hoffmann | |
366 | 356721ae | Gerd Hoffmann | uint8_t select; |
367 | 356721ae | Gerd Hoffmann | uint8_t status; |
368 | 356721ae | Gerd Hoffmann | |
369 | 356721ae | Gerd Hoffmann | /* set for lba48 access */
|
370 | 356721ae | Gerd Hoffmann | uint8_t lba48; |
371 | 356721ae | Gerd Hoffmann | BlockDriverState *bs; |
372 | 47c06340 | Gerd Hoffmann | char version[9]; |
373 | 356721ae | Gerd Hoffmann | /* ATAPI specific */
|
374 | 996faf1a | Amit Shah | struct unreported_events events;
|
375 | 356721ae | Gerd Hoffmann | uint8_t sense_key; |
376 | 356721ae | Gerd Hoffmann | uint8_t asc; |
377 | dd063333 | Markus Armbruster | bool tray_open;
|
378 | a0a7573b | Markus Armbruster | bool tray_locked;
|
379 | 356721ae | Gerd Hoffmann | uint8_t cdrom_changed; |
380 | 356721ae | Gerd Hoffmann | int packet_transfer_size;
|
381 | 356721ae | Gerd Hoffmann | int elementary_transfer_size;
|
382 | 356721ae | Gerd Hoffmann | int io_buffer_index;
|
383 | 356721ae | Gerd Hoffmann | int lba;
|
384 | 356721ae | Gerd Hoffmann | int cd_sector_size;
|
385 | 356721ae | Gerd Hoffmann | int atapi_dma; /* true if dma is requested for the packet cmd */ |
386 | a597e79c | Christoph Hellwig | BlockAcctCookie acct; |
387 | 356721ae | Gerd Hoffmann | /* ATA DMA state */
|
388 | 356721ae | Gerd Hoffmann | int io_buffer_size;
|
389 | 356721ae | Gerd Hoffmann | QEMUSGList sg; |
390 | 356721ae | Gerd Hoffmann | /* PIO transfer handling */
|
391 | 356721ae | Gerd Hoffmann | int req_nb_sectors; /* number of sectors per interrupt */ |
392 | 356721ae | Gerd Hoffmann | EndTransferFunc *end_transfer_func; |
393 | 356721ae | Gerd Hoffmann | uint8_t *data_ptr; |
394 | 356721ae | Gerd Hoffmann | uint8_t *data_end; |
395 | 356721ae | Gerd Hoffmann | uint8_t *io_buffer; |
396 | 50641c5c | Juan Quintela | /* PIO save/restore */
|
397 | 50641c5c | Juan Quintela | int32_t io_buffer_total_len; |
398 | 50641c5c | Juan Quintela | int cur_io_buffer_offset;
|
399 | 50641c5c | Juan Quintela | int cur_io_buffer_len;
|
400 | 50641c5c | Juan Quintela | uint8_t end_transfer_fn_idx; |
401 | 356721ae | Gerd Hoffmann | QEMUTimer *sector_write_timer; /* only used for win2k install hack */
|
402 | 356721ae | Gerd Hoffmann | uint32_t irq_count; /* counts IRQs when using win2k install hack */
|
403 | 356721ae | Gerd Hoffmann | /* CF-ATA extended error */
|
404 | 356721ae | Gerd Hoffmann | uint8_t ext_error; |
405 | 356721ae | Gerd Hoffmann | /* CF-ATA metadata storage */
|
406 | 356721ae | Gerd Hoffmann | uint32_t mdata_size; |
407 | 356721ae | Gerd Hoffmann | uint8_t *mdata_storage; |
408 | 356721ae | Gerd Hoffmann | int media_changed;
|
409 | 4e1e0051 | Christoph Hellwig | enum ide_dma_cmd dma_cmd;
|
410 | 356721ae | Gerd Hoffmann | /* SMART */
|
411 | 356721ae | Gerd Hoffmann | uint8_t smart_enabled; |
412 | 356721ae | Gerd Hoffmann | uint8_t smart_autosave; |
413 | 356721ae | Gerd Hoffmann | int smart_errors;
|
414 | 356721ae | Gerd Hoffmann | uint8_t smart_selftest_count; |
415 | 356721ae | Gerd Hoffmann | uint8_t *smart_selftest_data; |
416 | ccf0fd8b | Roland Elek | /* AHCI */
|
417 | ccf0fd8b | Roland Elek | int ncq_queues;
|
418 | 356721ae | Gerd Hoffmann | }; |
419 | 356721ae | Gerd Hoffmann | |
420 | 40a6238a | Alexander Graf | struct IDEDMAOps {
|
421 | 40a6238a | Alexander Graf | DMAStartFunc *start_dma; |
422 | 40a6238a | Alexander Graf | DMAFunc *start_transfer; |
423 | 40a6238a | Alexander Graf | DMAIntFunc *prepare_buf; |
424 | 40a6238a | Alexander Graf | DMAIntFunc *rw_buf; |
425 | 40a6238a | Alexander Graf | DMAIntFunc *set_unit; |
426 | 40a6238a | Alexander Graf | DMAIntFunc *add_status; |
427 | 40a6238a | Alexander Graf | DMAFunc *set_inactive; |
428 | 40a6238a | Alexander Graf | DMARestartFunc *restart_cb; |
429 | 40a6238a | Alexander Graf | DMAFunc *reset; |
430 | 40a6238a | Alexander Graf | }; |
431 | 40a6238a | Alexander Graf | |
432 | 40a6238a | Alexander Graf | struct IDEDMA {
|
433 | 40a6238a | Alexander Graf | const struct IDEDMAOps *ops; |
434 | 40a6238a | Alexander Graf | struct iovec iov;
|
435 | 40a6238a | Alexander Graf | QEMUIOVector qiov; |
436 | 40a6238a | Alexander Graf | BlockDriverAIOCB *aiocb; |
437 | 40a6238a | Alexander Graf | }; |
438 | 40a6238a | Alexander Graf | |
439 | 356721ae | Gerd Hoffmann | struct IDEBus {
|
440 | 356721ae | Gerd Hoffmann | BusState qbus; |
441 | da4d0419 | Gerd Hoffmann | IDEDevice *master; |
442 | da4d0419 | Gerd Hoffmann | IDEDevice *slave; |
443 | 356721ae | Gerd Hoffmann | IDEState ifs[2];
|
444 | 3835510f | Gleb Natapov | int bus_id;
|
445 | 40a6238a | Alexander Graf | IDEDMA *dma; |
446 | 356721ae | Gerd Hoffmann | uint8_t unit; |
447 | 9cdd03a7 | Gerd Hoffmann | uint8_t cmd; |
448 | 9cdd03a7 | Gerd Hoffmann | qemu_irq irq; |
449 | def93791 | Kevin Wolf | |
450 | def93791 | Kevin Wolf | int error_status;
|
451 | 356721ae | Gerd Hoffmann | }; |
452 | 356721ae | Gerd Hoffmann | |
453 | da4d0419 | Gerd Hoffmann | struct IDEDevice {
|
454 | da4d0419 | Gerd Hoffmann | DeviceState qdev; |
455 | da4d0419 | Gerd Hoffmann | uint32_t unit; |
456 | 428c149b | Christoph Hellwig | BlockConf conf; |
457 | 47c06340 | Gerd Hoffmann | char *version;
|
458 | 6ced55a5 | Markus Armbruster | char *serial;
|
459 | da4d0419 | Gerd Hoffmann | }; |
460 | da4d0419 | Gerd Hoffmann | |
461 | da4d0419 | Gerd Hoffmann | typedef int (*ide_qdev_initfn)(IDEDevice *dev); |
462 | da4d0419 | Gerd Hoffmann | struct IDEDeviceInfo {
|
463 | da4d0419 | Gerd Hoffmann | DeviceInfo qdev; |
464 | da4d0419 | Gerd Hoffmann | ide_qdev_initfn init; |
465 | da4d0419 | Gerd Hoffmann | }; |
466 | da4d0419 | Gerd Hoffmann | |
467 | 356721ae | Gerd Hoffmann | #define BM_STATUS_DMAING 0x01 |
468 | 356721ae | Gerd Hoffmann | #define BM_STATUS_ERROR 0x02 |
469 | 356721ae | Gerd Hoffmann | #define BM_STATUS_INT 0x04 |
470 | def93791 | Kevin Wolf | |
471 | def93791 | Kevin Wolf | /* FIXME These are not status register bits */
|
472 | 356721ae | Gerd Hoffmann | #define BM_STATUS_DMA_RETRY 0x08 |
473 | 356721ae | Gerd Hoffmann | #define BM_STATUS_PIO_RETRY 0x10 |
474 | e2bcadad | Kevin Wolf | #define BM_STATUS_RETRY_READ 0x20 |
475 | e2bcadad | Kevin Wolf | #define BM_STATUS_RETRY_FLUSH 0x40 |
476 | d353fb72 | Christoph Hellwig | #define BM_STATUS_RETRY_TRIM 0x80 |
477 | 356721ae | Gerd Hoffmann | |
478 | def93791 | Kevin Wolf | #define BM_MIGRATION_COMPAT_STATUS_BITS \
|
479 | def93791 | Kevin Wolf | (BM_STATUS_DMA_RETRY | BM_STATUS_PIO_RETRY | \ |
480 | def93791 | Kevin Wolf | BM_STATUS_RETRY_READ | BM_STATUS_RETRY_FLUSH) |
481 | def93791 | Kevin Wolf | |
482 | 356721ae | Gerd Hoffmann | #define BM_CMD_START 0x01 |
483 | 356721ae | Gerd Hoffmann | #define BM_CMD_READ 0x08 |
484 | 356721ae | Gerd Hoffmann | |
485 | 356721ae | Gerd Hoffmann | static inline IDEState *idebus_active_if(IDEBus *bus) |
486 | 356721ae | Gerd Hoffmann | { |
487 | 356721ae | Gerd Hoffmann | return bus->ifs + bus->unit;
|
488 | 356721ae | Gerd Hoffmann | } |
489 | 356721ae | Gerd Hoffmann | |
490 | 9cdd03a7 | Gerd Hoffmann | static inline void ide_set_irq(IDEBus *bus) |
491 | 356721ae | Gerd Hoffmann | { |
492 | 9cdd03a7 | Gerd Hoffmann | if (!(bus->cmd & IDE_CMD_DISABLE_IRQ)) {
|
493 | 9cdd03a7 | Gerd Hoffmann | qemu_irq_raise(bus->irq); |
494 | 356721ae | Gerd Hoffmann | } |
495 | 356721ae | Gerd Hoffmann | } |
496 | 356721ae | Gerd Hoffmann | |
497 | da4d0419 | Gerd Hoffmann | /* hw/ide/core.c */
|
498 | b38436e3 | Juan Quintela | extern const VMStateDescription vmstate_ide_bus; |
499 | b38436e3 | Juan Quintela | |
500 | b38436e3 | Juan Quintela | #define VMSTATE_IDE_BUS(_field, _state) \
|
501 | b38436e3 | Juan Quintela | VMSTATE_STRUCT(_field, _state, 1, vmstate_ide_bus, IDEBus)
|
502 | b38436e3 | Juan Quintela | |
503 | 407a4f30 | Juan Quintela | #define VMSTATE_IDE_BUS_ARRAY(_field, _state, _num) \
|
504 | 407a4f30 | Juan Quintela | VMSTATE_STRUCT_ARRAY(_field, _state, _num, 1, vmstate_ide_bus, IDEBus)
|
505 | 407a4f30 | Juan Quintela | |
506 | b38436e3 | Juan Quintela | extern const VMStateDescription vmstate_ide_drive; |
507 | b38436e3 | Juan Quintela | |
508 | b38436e3 | Juan Quintela | #define VMSTATE_IDE_DRIVES(_field, _state) \
|
509 | b38436e3 | Juan Quintela | VMSTATE_STRUCT_ARRAY(_field, _state, 2, 3, vmstate_ide_drive, IDEState) |
510 | b38436e3 | Juan Quintela | |
511 | 4a643563 | Blue Swirl | void ide_bus_reset(IDEBus *bus);
|
512 | 356721ae | Gerd Hoffmann | int64_t ide_get_sector(IDEState *s); |
513 | 356721ae | Gerd Hoffmann | void ide_set_sector(IDEState *s, int64_t sector_num);
|
514 | 356721ae | Gerd Hoffmann | |
515 | 356721ae | Gerd Hoffmann | void ide_dma_error(IDEState *s);
|
516 | 356721ae | Gerd Hoffmann | |
517 | 356721ae | Gerd Hoffmann | void ide_atapi_cmd_ok(IDEState *s);
|
518 | 356721ae | Gerd Hoffmann | void ide_atapi_cmd_error(IDEState *s, int sense_key, int asc); |
519 | 356721ae | Gerd Hoffmann | void ide_atapi_io_error(IDEState *s, int ret); |
520 | 356721ae | Gerd Hoffmann | |
521 | 356721ae | Gerd Hoffmann | void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val); |
522 | 356721ae | Gerd Hoffmann | uint32_t ide_ioport_read(void *opaque, uint32_t addr1);
|
523 | 356721ae | Gerd Hoffmann | uint32_t ide_status_read(void *opaque, uint32_t addr);
|
524 | 356721ae | Gerd Hoffmann | void ide_cmd_write(void *opaque, uint32_t addr, uint32_t val); |
525 | 356721ae | Gerd Hoffmann | void ide_data_writew(void *opaque, uint32_t addr, uint32_t val); |
526 | 356721ae | Gerd Hoffmann | uint32_t ide_data_readw(void *opaque, uint32_t addr);
|
527 | 356721ae | Gerd Hoffmann | void ide_data_writel(void *opaque, uint32_t addr, uint32_t val); |
528 | 356721ae | Gerd Hoffmann | uint32_t ide_data_readl(void *opaque, uint32_t addr);
|
529 | 356721ae | Gerd Hoffmann | |
530 | 1f56e32a | Markus Armbruster | int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind,
|
531 | c4d74df7 | Markus Armbruster | const char *version, const char *serial); |
532 | 57234ee4 | Markus Armbruster | void ide_init2(IDEBus *bus, qemu_irq irq);
|
533 | 57234ee4 | Markus Armbruster | void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0,
|
534 | 57234ee4 | Markus Armbruster | DriveInfo *hd1, qemu_irq irq); |
535 | 4a91d3b3 | Richard Henderson | void ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2); |
536 | 356721ae | Gerd Hoffmann | |
537 | 7cff87ff | Alexander Graf | void ide_exec_cmd(IDEBus *bus, uint32_t val);
|
538 | cd369c46 | Christoph Hellwig | void ide_dma_cb(void *opaque, int ret); |
539 | 40a6238a | Alexander Graf | void ide_sector_write(IDEState *s);
|
540 | 40a6238a | Alexander Graf | void ide_sector_read(IDEState *s);
|
541 | 40a6238a | Alexander Graf | void ide_flush_cache(IDEState *s);
|
542 | 7cff87ff | Alexander Graf | |
543 | 33231e0e | Kevin Wolf | void ide_transfer_start(IDEState *s, uint8_t *buf, int size, |
544 | 33231e0e | Kevin Wolf | EndTransferFunc *end_transfer_func); |
545 | 33231e0e | Kevin Wolf | void ide_transfer_stop(IDEState *s);
|
546 | 33231e0e | Kevin Wolf | void ide_set_inactive(IDEState *s);
|
547 | d353fb72 | Christoph Hellwig | BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs, |
548 | d353fb72 | Christoph Hellwig | int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
|
549 | d353fb72 | Christoph Hellwig | BlockDriverCompletionFunc *cb, void *opaque);
|
550 | 33231e0e | Kevin Wolf | |
551 | 33231e0e | Kevin Wolf | /* hw/ide/atapi.c */
|
552 | 33231e0e | Kevin Wolf | void ide_atapi_cmd(IDEState *s);
|
553 | 33231e0e | Kevin Wolf | void ide_atapi_cmd_reply_end(IDEState *s);
|
554 | 33231e0e | Kevin Wolf | |
555 | da4d0419 | Gerd Hoffmann | /* hw/ide/qdev.c */
|
556 | 3835510f | Gleb Natapov | void ide_bus_new(IDEBus *idebus, DeviceState *dev, int bus_id); |
557 | da4d0419 | Gerd Hoffmann | IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive);
|
558 | da4d0419 | Gerd Hoffmann | |
559 | 356721ae | Gerd Hoffmann | #endif /* HW_IDE_INTERNAL_H */ |