25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_wdc.c,v 1.63 2006/02/18 13:15:21 debug Exp $ |
* $Id: dev_wdc.c,v 1.66 2006/04/20 16:59:05 debug Exp $ |
29 |
* |
* |
30 |
* Standard "wdc" IDE controller. |
* Standard "wdc" IDE controller. |
31 |
*/ |
*/ |
588 |
} |
} |
589 |
|
|
590 |
if (d->data_debug) { |
if (d->data_debug) { |
591 |
char *s = "0x%04llx ]\n"; |
char *s = "0x%04"PRIx64" ]\n"; |
592 |
if (len == 1) |
if (len == 1) |
593 |
s = "0x%02llx ]\n"; |
s = "0x%02"PRIx64" ]\n"; |
594 |
if (len == 4) |
if (len == 4) |
595 |
s = "0x%08llx ]\n"; |
s = "0x%08"PRIx64" ]\n"; |
596 |
if (len == 8) |
if (len == 8) |
597 |
s = "0x%016llx ]\n"; |
s = "0x%016"PRIx64" ]\n"; |
598 |
debug("[ wdc: read from DATA: "); |
debug("[ wdc: read from DATA: "); |
599 |
debug(s, (long long)odata); |
debug(s, (uint64_t) odata); |
600 |
} |
} |
601 |
|
|
602 |
if (d->atapi_cmd_in_progress) { |
if (d->atapi_cmd_in_progress) { |
629 |
} else { |
} else { |
630 |
int inbuf_len; |
int inbuf_len; |
631 |
if (d->data_debug) { |
if (d->data_debug) { |
632 |
char *s = "0x%04llx ]\n"; |
char *s = "0x%04"PRIx64" ]\n"; |
633 |
if (len == 1) |
if (len == 1) |
634 |
s = "0x%02llx ]\n"; |
s = "0x%02"PRIx64" ]\n"; |
635 |
if (len == 4) |
if (len == 4) |
636 |
s = "0x%08llx ]\n"; |
s = "0x%08"PRIx64" ]\n"; |
637 |
if (len == 8) |
if (len == 8) |
638 |
s = "0x%016llx ]\n"; |
s = "0x%016"PRIx64" ]\n"; |
639 |
debug("[ wdc: write to DATA: "); |
debug("[ wdc: write to DATA: "); |
640 |
debug(s, (long long)idata); |
debug(s, (uint64_t) idata); |
641 |
} |
} |
642 |
if (!d->write_in_progress && |
if (!d->write_in_progress && |
643 |
!d->atapi_cmd_in_progress) { |
!d->atapi_cmd_in_progress) { |
749 |
inbuf_len % 512 == 0) ) { |
inbuf_len % 512 == 0) ) { |
750 |
int count = (d->write_in_progress == |
int count = (d->write_in_progress == |
751 |
WDCC_WRITEMULTI)? d->write_count : 1; |
WDCC_WRITEMULTI)? d->write_count : 1; |
752 |
unsigned char buf[512 * count]; |
unsigned char *buf = malloc(512 * count); |
753 |
unsigned char *b = buf; |
unsigned char *b = buf; |
754 |
|
|
755 |
|
if (buf == NULL) { |
756 |
|
fprintf(stderr, "out of memory\n"); |
757 |
|
exit(1); |
758 |
|
} |
759 |
|
|
760 |
if (d->inbuf_tail+512*count <= WDC_INBUF_SIZE) { |
if (d->inbuf_tail+512*count <= WDC_INBUF_SIZE) { |
761 |
b = d->inbuf + d->inbuf_tail; |
b = d->inbuf + d->inbuf_tail; |
762 |
d->inbuf_tail = (d->inbuf_tail + 512 |
d->inbuf_tail = (d->inbuf_tail + 512 |
777 |
|
|
778 |
if (d->write_count == 0) |
if (d->write_count == 0) |
779 |
d->write_in_progress = 0; |
d->write_in_progress = 0; |
780 |
|
|
781 |
|
free(buf); |
782 |
} |
} |
783 |
} |
} |
784 |
break; |
break; |
975 |
tick_shift += 1; |
tick_shift += 1; |
976 |
|
|
977 |
machine_add_tickfunction(devinit->machine, dev_wdc_tick, |
machine_add_tickfunction(devinit->machine, dev_wdc_tick, |
978 |
d, tick_shift); |
d, tick_shift, 0.0); |
979 |
|
|
980 |
return 1; |
return 1; |
981 |
} |
} |