/[gxemul]/trunk/src/devices/dev_mpc10x.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_mpc10x.c

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

revision 56 by dpavlin, Thu Oct 11 12:54:37 2007 UTC revision 57 by dpavlin, Thu Oct 11 18:57:32 2007 UTC
# Line 82  DEVICE_ACCESS(mpc10x_pci) Line 82  DEVICE_ACCESS(mpc10x_pci)
82          int bus, dev, func, reg;          int bus, dev, func, reg;
83          struct mpc10x_data *d = extra;          struct mpc10x_data *d = extra;
84    
85          if (writeflag == MEM_WRITE)          if (writeflag == MEM_WRITE) {
86                  idata = memory_readmax64(cpu, data, len|MEM_PCI_LITTLE_ENDIAN);                  idata = memory_readmax64(cpu, data, len|MEM_PCI_LITTLE_ENDIAN);
87                    debug("mpc10x_pci WRITE offset 0x%x: 0x%x\n", relative_addr, odata);
88            }
89    
90            debug("relative: %d i: 0x%x o: 0x%x data: %s len: %d\n", relative_addr,idata, odata, data, len );
91    
92          switch (relative_addr) {          switch (relative_addr) {
93          case 0: /*  Address:  */          case 0: /*  Address:  */
# Line 97  DEVICE_ACCESS(mpc10x_pci) Line 101  DEVICE_ACCESS(mpc10x_pci)
101                  break;                  break;
102          }          }
103    
104          if (writeflag == MEM_READ)  #define PCI_VENDOR_ID_MOTOROLA          0x1057
105    #define MPC10X_BRIDGE_106       ((PCI_DEVICE_ID_MOTOROLA_MPC106 << 16) |  \
106                                      PCI_VENDOR_ID_MOTOROLA)
107    #define MPC10X_BRIDGE_8240      ((0x0003 << 16) | PCI_VENDOR_ID_MOTOROLA)
108    #define MPC10X_BRIDGE_107       ((0x0004 << 16) | PCI_VENDOR_ID_MOTOROLA)
109    #define MPC10X_BRIDGE_8245      ((0x0006 << 16) | PCI_VENDOR_ID_MOTOROLA)
110    
111            debug("i: 0x%x o: 0x%x\n", idata, odata );
112            if (writeflag == MEM_READ) {
113                  memory_writemax64(cpu, data, len|MEM_PCI_LITTLE_ENDIAN, odata);                  memory_writemax64(cpu, data, len|MEM_PCI_LITTLE_ENDIAN, odata);
114                    odata = MPC10X_BRIDGE_8245;
115                    debug("mpc10x_pci READ offset 0x%x: 0x%x\n", relative_addr, odata);
116            }
117    
118          return 1;          return 1;
119  }  }
# Line 182  DEVICE_ACCESS(mpc10x_int) Line 197  DEVICE_ACCESS(mpc10x_int)
197          return 1;          return 1;
198  }  }
199    
200    /*
201     *  dev_mpc10x_config_access():
202     *
203     *  Configuration
204     */
205    DEVICE_ACCESS(mpc10x_config)
206    {
207            uint64_t idata = 0, odata = 0;
208    //      struct mpc10x_data *d = extra;
209    
210            if (writeflag == MEM_WRITE) {
211                    idata = memory_readmax64(cpu, data, len);
212                    debug("mpc10x_config WRITE offset 0x%x: 0x%x [old: 0x%x]\n", relative_addr, odata, idata);
213            }
214    
215            debug("relative: %d i: 0x%x o: 0x%x data: %s len: %d\n", relative_addr,idata, odata, data, len );
216    
217            switch (relative_addr) {
218            case 0:
219    
220    #define PCI_VENDOR_ID_MOTOROLA          0x1057
221    #define MPC10X_BRIDGE_106       ((PCI_DEVICE_ID_MOTOROLA_MPC106 << 16) |  \
222                                      PCI_VENDOR_ID_MOTOROLA)
223    #define MPC10X_BRIDGE_8240      ((0x0003 << 16) | PCI_VENDOR_ID_MOTOROLA)
224    #define MPC10X_BRIDGE_107       ((0x0004 << 16) | PCI_VENDOR_ID_MOTOROLA)
225    #define MPC10X_BRIDGE_8245      ((0x0006 << 16) | PCI_VENDOR_ID_MOTOROLA)
226    
227                    return MPC10X_BRIDGE_8245;
228            }
229    
230            debug("i: 0x%x o: 0x%x\n", idata, odata );
231            if (writeflag == MEM_READ) {
232                    odata = MPC10X_BRIDGE_8245;
233                    memory_writemax64(cpu, data, len, odata);
234                    debug("mpc10x_config READ offset 0x%x: 0x%x\n", relative_addr, odata);
235            }
236    
237            return 1;
238    }
239    
240  DEVINIT(mpc10x)  DEVINIT(mpc10x)
241  {  {
# Line 215  DEVINIT(mpc10x) Line 269  DEVINIT(mpc10x)
269          d->pci_data = bus_pci_init(          d->pci_data = bus_pci_init(
270              devinit->machine,              devinit->machine,
271              tmp,                /*  pciirq path  */              tmp,                /*  pciirq path  */
272              0,                  /*  pci device io offset  */              0xfc000000,         /*  pci device io offset  */
273              0,                  /*  pci device mem offset  */              0xfcc00000,         /*  pci device mem offset  */
274              MPC_PCI_IO_BASE,    /*  PCI portbase  */              0xfec00000,         /*  PCI portbase  */
275              MPC_PCI_MEM_BASE,   /*  PCI membase: TODO  */              0x80000000,         /*  PCI membase: TODO  */
276              tmp,                /*  PCI irqbase  */              tmp,                /*  PCI irqbase  */
277              0,                  /*  ISA portbase: TODO  */              0,                  /*  ISA portbase: TODO  */
278              0,                  /*  ISA membase: TODO  */              0,                  /*  ISA membase: TODO  */
279              tmp);               /*  ISA irqbase  */              tmp);               /*  ISA irqbase  */
280    
281  #if 0          /* PCI host bridge */
282          switch (devinit->machine->machine_type) {          bus_pci_add(devinit->machine, d->pci_data,
283                    devinit->machine->memory, 0, 0, 0, "mpc10x_host_bridge");
284          case MACHINE_SANDPOINT:  
285                  bus_pci_add(devinit->machine, d->pci_data,          /*  MPC10x configuration  */
286                      devinit->machine->memory, 0, 0, 0, "sandpoint_pci");          memory_device_register(devinit->machine->memory, "mpc10x_config",
287                  break;              0xfec00000, 8, dev_mpc10x_config_access, d, DM_DEFAULT, NULL);
   
         default:fatal("!\n! WARNING: mpc10x for non-implemented machine"  
                     " type\n!\n");  
                 exit(1);  
         }  
 #endif  
288    
289          /*  PCI configuration registers:  */          /*  PCI configuration registers:  */
290          memory_device_register(devinit->machine->memory, "mpc10x_pci",          memory_device_register(devinit->machine->memory, "mpc10x_pci",
291              MPC10X_MAPB_CNFG_DATA, 8, dev_mpc10x_pci_access, d, DM_DEFAULT, NULL);              0xfee00000, 8, dev_mpc10x_pci_access, d, DM_DEFAULT, NULL);
292    
293          /*  Interrupt controller:  */          /*  Interrupt controller:  */
294          memory_device_register(devinit->machine->memory, "mpc10x_int",          memory_device_register(devinit->machine->memory, "mpc10x_int",

Legend:
Removed from v.56  
changed lines
  Added in v.57

  ViewVC Help
Powered by ViewVC 1.1.26