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