25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_wdc.c,v 1.66 2006/04/20 16:59:05 debug Exp $ |
* $Id: dev_wdc.c,v 1.68 2006/08/14 17:45:47 debug Exp $ |
29 |
* |
* |
30 |
* Standard "wdc" IDE controller. |
* Standard "wdc" IDE controller. |
31 |
*/ |
*/ |
69 |
int addr_mult; |
int addr_mult; |
70 |
int base_drive; |
int base_drive; |
71 |
int data_debug; |
int data_debug; |
72 |
|
int io_enabled; |
73 |
|
|
74 |
/* Cached values: */ |
/* Cached values: */ |
75 |
int cyls[2]; |
int cyls[2]; |
131 |
|
|
132 |
|
|
133 |
/* |
/* |
134 |
|
* wdc_set_io_enabled(): |
135 |
|
* |
136 |
|
* Set io_enabled to zero to disable the I/O registers temporarily (e.g. |
137 |
|
* used by PCI code in NetBSD to detect whether multiple controllers collide |
138 |
|
* in I/O space). |
139 |
|
* |
140 |
|
* Return value is old contents of the io_enabled variable. |
141 |
|
*/ |
142 |
|
int wdc_set_io_enabled(struct wdc_data *d, int io_enabled) |
143 |
|
{ |
144 |
|
int old = d->io_enabled; |
145 |
|
d->io_enabled = io_enabled; |
146 |
|
return old; |
147 |
|
} |
148 |
|
|
149 |
|
|
150 |
|
/* |
151 |
* wdc_addtoinbuf(): |
* wdc_addtoinbuf(): |
152 |
* |
* |
153 |
* Write to the inbuf at its head, read at its tail. |
* Write to the inbuf at its head, read at its tail. |
573 |
|
|
574 |
relative_addr /= d->addr_mult; |
relative_addr /= d->addr_mult; |
575 |
|
|
576 |
|
if (!d->io_enabled) |
577 |
|
goto ret; |
578 |
|
|
579 |
if (writeflag == MEM_WRITE) { |
if (writeflag == MEM_WRITE) { |
580 |
if (relative_addr == wd_data) |
if (relative_addr == wd_data) |
581 |
idata = memory_readmax64(cpu, data, len); |
idata = memory_readmax64(cpu, data, len); |
921 |
(int)relative_addr, (int)idata); |
(int)relative_addr, (int)idata); |
922 |
} |
} |
923 |
|
|
924 |
|
|
925 |
if (cpu->machine->machine_type != MACHINE_HPCMIPS && |
if (cpu->machine->machine_type != MACHINE_HPCMIPS && |
926 |
cpu->machine->machine_type != MACHINE_EVBMIPS && |
cpu->machine->machine_type != MACHINE_EVBMIPS && |
927 |
|
cpu->machine->machine_type != MACHINE_ALGOR && |
928 |
cpu->machine->machine_type != MACHINE_BEBOX) |
cpu->machine->machine_type != MACHINE_BEBOX) |
929 |
dev_wdc_tick(cpu, extra); |
dev_wdc_tick(cpu, extra); |
930 |
|
|
931 |
|
ret: |
932 |
if (writeflag == MEM_READ) { |
if (writeflag == MEM_READ) { |
933 |
if (relative_addr == wd_data) |
if (relative_addr == wd_data) |
934 |
memory_writemax64(cpu, data, len, odata); |
memory_writemax64(cpu, data, len, odata); |
955 |
d->irq_nr = devinit->irq_nr; |
d->irq_nr = devinit->irq_nr; |
956 |
d->addr_mult = devinit->addr_mult; |
d->addr_mult = devinit->addr_mult; |
957 |
d->data_debug = 1; |
d->data_debug = 1; |
958 |
|
d->io_enabled = 1; |
959 |
|
|
960 |
d->inbuf = zeroed_alloc(WDC_INBUF_SIZE); |
d->inbuf = zeroed_alloc(WDC_INBUF_SIZE); |
961 |
|
|
1002 |
machine_add_tickfunction(devinit->machine, dev_wdc_tick, |
machine_add_tickfunction(devinit->machine, dev_wdc_tick, |
1003 |
d, tick_shift, 0.0); |
d, tick_shift, 0.0); |
1004 |
|
|
1005 |
|
devinit->return_ptr = d; |
1006 |
|
|
1007 |
return 1; |
return 1; |
1008 |
} |
} |
1009 |
|
|