atapi.c (f2bcdc8de018d33ecf93da7a94f327956ecf76ea) | atapi.c (d735b620b58f2fdfddc8e641e9feac3c9671a49d) |
---|---|
1/* 2 * QEMU ATAPI Emulation 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * Copyright (c) 2006 Openedhand Ltd. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to deal --- 122 unchanged lines hidden (view full) --- 131 return ret; 132} 133 134void ide_atapi_cmd_ok(IDEState *s) 135{ 136 s->error = 0; 137 s->status = READY_STAT | SEEK_STAT; 138 s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD; | 1/* 2 * QEMU ATAPI Emulation 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * Copyright (c) 2006 Openedhand Ltd. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to deal --- 122 unchanged lines hidden (view full) --- 131 return ret; 132} 133 134void ide_atapi_cmd_ok(IDEState *s) 135{ 136 s->error = 0; 137 s->status = READY_STAT | SEEK_STAT; 138 s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD; |
139 ide_transfer_stop(s); |
|
139 ide_set_irq(s->bus); 140} 141 142void ide_atapi_cmd_error(IDEState *s, int sense_key, int asc) 143{ 144#ifdef DEBUG_IDE_ATAPI 145 printf("atapi_cmd_error: sense=0x%x asc=0x%x\n", sense_key, asc); 146#endif 147 s->error = sense_key << 4; 148 s->status = READY_STAT | ERR_STAT; 149 s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD; 150 s->sense_key = sense_key; 151 s->asc = asc; | 140 ide_set_irq(s->bus); 141} 142 143void ide_atapi_cmd_error(IDEState *s, int sense_key, int asc) 144{ 145#ifdef DEBUG_IDE_ATAPI 146 printf("atapi_cmd_error: sense=0x%x asc=0x%x\n", sense_key, asc); 147#endif 148 s->error = sense_key << 4; 149 s->status = READY_STAT | ERR_STAT; 150 s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD; 151 s->sense_key = sense_key; 152 s->asc = asc; |
153 ide_transfer_stop(s); |
|
152 ide_set_irq(s->bus); 153} 154 155void ide_atapi_io_error(IDEState *s, int ret) 156{ 157 /* XXX: handle more errors */ 158 if (ret == -ENOMEDIUM) { 159 ide_atapi_cmd_error(s, NOT_READY, --- 11 unchanged lines hidden (view full) --- 171#ifdef DEBUG_IDE_ATAPI 172 printf("reply: tx_size=%d elem_tx_size=%d index=%d\n", 173 s->packet_transfer_size, 174 s->elementary_transfer_size, 175 s->io_buffer_index); 176#endif 177 if (s->packet_transfer_size <= 0) { 178 /* end of transfer */ | 154 ide_set_irq(s->bus); 155} 156 157void ide_atapi_io_error(IDEState *s, int ret) 158{ 159 /* XXX: handle more errors */ 160 if (ret == -ENOMEDIUM) { 161 ide_atapi_cmd_error(s, NOT_READY, --- 11 unchanged lines hidden (view full) --- 173#ifdef DEBUG_IDE_ATAPI 174 printf("reply: tx_size=%d elem_tx_size=%d index=%d\n", 175 s->packet_transfer_size, 176 s->elementary_transfer_size, 177 s->io_buffer_index); 178#endif 179 if (s->packet_transfer_size <= 0) { 180 /* end of transfer */ |
179 s->status = READY_STAT | SEEK_STAT; 180 s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD; 181 ide_transfer_stop(s); | 181 ide_atapi_cmd_ok(s); |
182 ide_set_irq(s->bus); 183#ifdef DEBUG_IDE_ATAPI 184 printf("status=0x%x\n", s->status); 185#endif 186 } else { 187 /* see if a new sector must be read */ 188 if (s->lba != -1 && s->io_buffer_index >= s->cd_sector_size) { 189 ret = cd_read_sector(s, s->lba, s->io_buffer, s->cd_sector_size); 190 if (ret < 0) { | 182 ide_set_irq(s->bus); 183#ifdef DEBUG_IDE_ATAPI 184 printf("status=0x%x\n", s->status); 185#endif 186 } else { 187 /* see if a new sector must be read */ 188 if (s->lba != -1 && s->io_buffer_index >= s->cd_sector_size) { 189 ret = cd_read_sector(s, s->lba, s->io_buffer, s->cd_sector_size); 190 if (ret < 0) { |
191 ide_transfer_stop(s); | |
192 ide_atapi_io_error(s, ret); 193 return; 194 } 195 s->lba++; 196 s->io_buffer_index = 0; 197 } 198 if (s->elementary_transfer_size > 0) { 199 /* there are some data left to transmit in this elementary --- 958 unchanged lines hidden --- | 191 ide_atapi_io_error(s, ret); 192 return; 193 } 194 s->lba++; 195 s->io_buffer_index = 0; 196 } 197 if (s->elementary_transfer_size > 0) { 198 /* there are some data left to transmit in this elementary --- 958 unchanged lines hidden --- |