Revision cd8722bb hw/ide/core.c
b/hw/ide/core.c | ||
---|---|---|
292 | 292 |
/* put signature */ |
293 | 293 |
s->nsector = 1; |
294 | 294 |
s->sector = 1; |
295 |
if (s->is_cdrom) {
|
|
295 |
if (s->drive_kind == IDE_CD) {
|
|
296 | 296 |
s->lcyl = 0x14; |
297 | 297 |
s->hcyl = 0xeb; |
298 | 298 |
} else if (s->bs) { |
... | ... | |
1827 | 1827 |
|
1828 | 1828 |
switch(val) { |
1829 | 1829 |
case WIN_IDENTIFY: |
1830 |
if (s->bs && !s->is_cdrom) {
|
|
1831 |
if (!s->is_cf)
|
|
1830 |
if (s->bs && s->drive_kind != IDE_CD) {
|
|
1831 |
if (s->drive_kind != IDE_CFATA)
|
|
1832 | 1832 |
ide_identify(s); |
1833 | 1833 |
else |
1834 | 1834 |
ide_cfata_identify(s); |
1835 | 1835 |
s->status = READY_STAT | SEEK_STAT; |
1836 | 1836 |
ide_transfer_start(s, s->io_buffer, 512, ide_transfer_stop); |
1837 | 1837 |
} else { |
1838 |
if (s->is_cdrom) {
|
|
1838 |
if (s->drive_kind == IDE_CD) {
|
|
1839 | 1839 |
ide_set_signature(s); |
1840 | 1840 |
} |
1841 | 1841 |
ide_abort_command(s); |
... | ... | |
1849 | 1849 |
ide_set_irq(s->bus); |
1850 | 1850 |
break; |
1851 | 1851 |
case WIN_SETMULT: |
1852 |
if (s->is_cf && s->nsector == 0) {
|
|
1852 |
if (s->drive_kind == IDE_CFATA && s->nsector == 0) {
|
|
1853 | 1853 |
/* Disable Read and Write Multiple */ |
1854 | 1854 |
s->mult_sectors = 0; |
1855 | 1855 |
s->status = READY_STAT | SEEK_STAT; |
... | ... | |
2033 | 2033 |
ide_set_irq(s->bus); |
2034 | 2034 |
break; |
2035 | 2035 |
case WIN_SEEK: |
2036 |
if(s->is_cdrom)
|
|
2036 |
if(s->drive_kind == IDE_CD)
|
|
2037 | 2037 |
goto abort_cmd; |
2038 | 2038 |
/* XXX: Check that seek is within bounds */ |
2039 | 2039 |
s->status = READY_STAT | SEEK_STAT; |
... | ... | |
2041 | 2041 |
break; |
2042 | 2042 |
/* ATAPI commands */ |
2043 | 2043 |
case WIN_PIDENTIFY: |
2044 |
if (s->is_cdrom) {
|
|
2044 |
if (s->drive_kind == IDE_CD) {
|
|
2045 | 2045 |
ide_atapi_identify(s); |
2046 | 2046 |
s->status = READY_STAT | SEEK_STAT; |
2047 | 2047 |
ide_transfer_start(s, s->io_buffer, 512, ide_transfer_stop); |
... | ... | |
2052 | 2052 |
break; |
2053 | 2053 |
case WIN_DIAGNOSE: |
2054 | 2054 |
ide_set_signature(s); |
2055 |
if (s->is_cdrom)
|
|
2055 |
if (s->drive_kind == IDE_CD)
|
|
2056 | 2056 |
s->status = 0; /* ATAPI spec (v6) section 9.10 defines packet |
2057 | 2057 |
* devices to return a clear status register |
2058 | 2058 |
* with READY_STAT *not* set. */ |
... | ... | |
2064 | 2064 |
ide_set_irq(s->bus); |
2065 | 2065 |
break; |
2066 | 2066 |
case WIN_SRST: |
2067 |
if (!s->is_cdrom)
|
|
2067 |
if (s->drive_kind != IDE_CD)
|
|
2068 | 2068 |
goto abort_cmd; |
2069 | 2069 |
ide_set_signature(s); |
2070 | 2070 |
s->status = 0x00; /* NOTE: READY is _not_ set */ |
2071 | 2071 |
s->error = 0x01; |
2072 | 2072 |
break; |
2073 | 2073 |
case WIN_PACKETCMD: |
2074 |
if (!s->is_cdrom)
|
|
2074 |
if (s->drive_kind != IDE_CD)
|
|
2075 | 2075 |
goto abort_cmd; |
2076 | 2076 |
/* overlapping commands not supported */ |
2077 | 2077 |
if (s->feature & 0x02) |
... | ... | |
2084 | 2084 |
break; |
2085 | 2085 |
/* CF-ATA commands */ |
2086 | 2086 |
case CFA_REQ_EXT_ERROR_CODE: |
2087 |
if (!s->is_cf)
|
|
2087 |
if (s->drive_kind != IDE_CFATA)
|
|
2088 | 2088 |
goto abort_cmd; |
2089 | 2089 |
s->error = 0x09; /* miscellaneous error */ |
2090 | 2090 |
s->status = READY_STAT | SEEK_STAT; |
... | ... | |
2092 | 2092 |
break; |
2093 | 2093 |
case CFA_ERASE_SECTORS: |
2094 | 2094 |
case CFA_WEAR_LEVEL: |
2095 |
if (!s->is_cf)
|
|
2095 |
if (s->drive_kind != IDE_CFATA)
|
|
2096 | 2096 |
goto abort_cmd; |
2097 | 2097 |
if (val == CFA_WEAR_LEVEL) |
2098 | 2098 |
s->nsector = 0; |
... | ... | |
2103 | 2103 |
ide_set_irq(s->bus); |
2104 | 2104 |
break; |
2105 | 2105 |
case CFA_TRANSLATE_SECTOR: |
2106 |
if (!s->is_cf)
|
|
2106 |
if (s->drive_kind != IDE_CFATA)
|
|
2107 | 2107 |
goto abort_cmd; |
2108 | 2108 |
s->error = 0x00; |
2109 | 2109 |
s->status = READY_STAT | SEEK_STAT; |
... | ... | |
2123 | 2123 |
ide_set_irq(s->bus); |
2124 | 2124 |
break; |
2125 | 2125 |
case CFA_ACCESS_METADATA_STORAGE: |
2126 |
if (!s->is_cf)
|
|
2126 |
if (s->drive_kind != IDE_CFATA)
|
|
2127 | 2127 |
goto abort_cmd; |
2128 | 2128 |
switch (s->feature) { |
2129 | 2129 |
case 0x02: /* Inquiry Metadata Storage */ |
... | ... | |
2143 | 2143 |
ide_set_irq(s->bus); |
2144 | 2144 |
break; |
2145 | 2145 |
case IBM_SENSE_CONDITION: |
2146 |
if (!s->is_cf)
|
|
2146 |
if (s->drive_kind != IDE_CFATA)
|
|
2147 | 2147 |
goto abort_cmd; |
2148 | 2148 |
switch (s->feature) { |
2149 | 2149 |
case 0x01: /* sense temperature in device */ |
... | ... | |
2157 | 2157 |
break; |
2158 | 2158 |
|
2159 | 2159 |
case WIN_SMART: |
2160 |
if (s->is_cdrom)
|
|
2160 |
if (s->drive_kind == IDE_CD)
|
|
2161 | 2161 |
goto abort_cmd; |
2162 | 2162 |
if (s->hcyl != 0xc2 || s->lcyl != 0x4f) |
2163 | 2163 |
goto abort_cmd; |
... | ... | |
2438 | 2438 |
/* high to low */ |
2439 | 2439 |
for(i = 0;i < 2; i++) { |
2440 | 2440 |
s = &bus->ifs[i]; |
2441 |
if (s->is_cdrom)
|
|
2441 |
if (s->drive_kind == IDE_CD)
|
|
2442 | 2442 |
s->status = 0x00; /* NOTE: READY is _not_ set */ |
2443 | 2443 |
else |
2444 | 2444 |
s->status = READY_STAT | SEEK_STAT; |
... | ... | |
2540 | 2540 |
#ifdef DEBUG_IDE |
2541 | 2541 |
printf("ide: reset\n"); |
2542 | 2542 |
#endif |
2543 |
if (s->is_cf)
|
|
2543 |
if (s->drive_kind == IDE_CFATA)
|
|
2544 | 2544 |
s->mult_sectors = 0; |
2545 | 2545 |
else |
2546 | 2546 |
s->mult_sectors = MAX_MULT_SECTORS; |
... | ... | |
2614 | 2614 |
s->smart_errors = 0; |
2615 | 2615 |
s->smart_selftest_count = 0; |
2616 | 2616 |
if (bdrv_get_type_hint(bs) == BDRV_TYPE_CDROM) { |
2617 |
s->is_cdrom = 1;
|
|
2617 |
s->drive_kind = IDE_CD;
|
|
2618 | 2618 |
bdrv_set_change_cb(bs, cdrom_change_cb, s); |
2619 | 2619 |
} |
2620 | 2620 |
if (serial) { |
... | ... | |
2629 | 2629 |
pstrcpy(s->version, sizeof(s->version), QEMU_VERSION); |
2630 | 2630 |
} |
2631 | 2631 |
ide_reset(s); |
2632 |
bdrv_set_removable(bs, s->is_cdrom);
|
|
2632 |
bdrv_set_removable(bs, s->drive_kind == IDE_CD);
|
|
2633 | 2633 |
} |
2634 | 2634 |
|
2635 | 2635 |
static void ide_init1(IDEBus *bus, int unit) |
Also available in: Unified diff