/[gxemul]/trunk/src/devices/dev_wdc.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/devices/dev_wdc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 29 by dpavlin, Mon Oct 8 16:19:56 2007 UTC revision 30 by dpavlin, Mon Oct 8 16:20:40 2007 UTC
# Line 25  Line 25 
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   */   */
# Line 69  struct wdc_data { Line 69  struct wdc_data {
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];
# Line 130  void dev_wdc_tick(struct cpu *cpu, void Line 131  void dev_wdc_tick(struct cpu *cpu, void
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.
# Line 555  DEVICE_ACCESS(wdc) Line 573  DEVICE_ACCESS(wdc)
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);
# Line 900  DEVICE_ACCESS(wdc) Line 921  DEVICE_ACCESS(wdc)
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);
# Line 931  DEVINIT(wdc) Line 955  DEVINIT(wdc)
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    
# Line 977  DEVINIT(wdc) Line 1002  DEVINIT(wdc)
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    

Legend:
Removed from v.29  
changed lines
  Added in v.30

  ViewVC Help
Powered by ViewVC 1.1.26