25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_wdc.c,v 1.74 2007/02/16 19:57:56 debug Exp $ |
* $Id: dev_wdc.c,v 1.76 2007/06/15 19:57:34 debug Exp $ |
29 |
* |
* |
30 |
* Standard "wdc" IDE controller. |
* COMMENT: Standard "wdc" IDE controller |
31 |
*/ |
*/ |
32 |
|
|
33 |
#include <stdio.h> |
#include <stdio.h> |
676 |
inbuf_len += WDC_INBUF_SIZE; |
inbuf_len += WDC_INBUF_SIZE; |
677 |
|
|
678 |
if (d->atapi_cmd_in_progress && inbuf_len == 12) { |
if (d->atapi_cmd_in_progress && inbuf_len == 12) { |
679 |
unsigned char *scsi_cmd = malloc(12); |
unsigned char *scsi_cmd; |
680 |
int x = 0, res; |
int x = 0, res; |
681 |
|
|
682 |
|
CHECK_ALLOCATION(scsi_cmd = malloc(12)); |
683 |
|
|
684 |
if (d->atapi_st != NULL) |
if (d->atapi_st != NULL) |
685 |
scsi_transfer_free(d->atapi_st); |
scsi_transfer_free(d->atapi_st); |
686 |
d->atapi_st = scsi_transfer_alloc(); |
d->atapi_st = scsi_transfer_alloc(); |
744 |
inbuf_len % 512 == 0) ) { |
inbuf_len % 512 == 0) ) { |
745 |
int count = (d->write_in_progress == |
int count = (d->write_in_progress == |
746 |
WDCC_WRITEMULTI)? d->write_count : 1; |
WDCC_WRITEMULTI)? d->write_count : 1; |
747 |
unsigned char *buf = malloc(512 * count); |
unsigned char *buf, *b; |
|
unsigned char *b = buf; |
|
748 |
|
|
749 |
if (buf == NULL) { |
CHECK_ALLOCATION(buf = malloc(512 * count)); |
750 |
fprintf(stderr, "out of memory\n"); |
b = buf; |
|
exit(1); |
|
|
} |
|
751 |
|
|
752 |
if (d->inbuf_tail+512*count <= WDC_INBUF_SIZE) { |
if (d->inbuf_tail+512*count <= WDC_INBUF_SIZE) { |
753 |
b = d->inbuf + d->inbuf_tail; |
b = d->inbuf + d->inbuf_tail; |
912 |
uint64_t alt_status_addr; |
uint64_t alt_status_addr; |
913 |
int i, tick_shift = WDC_TICK_SHIFT; |
int i, tick_shift = WDC_TICK_SHIFT; |
914 |
|
|
915 |
d = malloc(sizeof(struct wdc_data)); |
CHECK_ALLOCATION(d = malloc(sizeof(struct wdc_data))); |
|
if (d == NULL) { |
|
|
fprintf(stderr, "out of memory\n"); |
|
|
exit(1); |
|
|
} |
|
916 |
memset(d, 0, sizeof(struct wdc_data)); |
memset(d, 0, sizeof(struct wdc_data)); |
917 |
|
|
918 |
INTERRUPT_CONNECT(devinit->interrupt_path, d->irq); |
INTERRUPT_CONNECT(devinit->interrupt_path, d->irq); |
959 |
d, DM_DEFAULT, NULL); |
d, DM_DEFAULT, NULL); |
960 |
|
|
961 |
machine_add_tickfunction(devinit->machine, dev_wdc_tick, |
machine_add_tickfunction(devinit->machine, dev_wdc_tick, |
962 |
d, tick_shift, 0.0); |
d, tick_shift); |
963 |
|
|
964 |
devinit->return_ptr = d; |
devinit->return_ptr = d; |
965 |
|
|