--- trunk/src/devices/dev_eagle.c 2007/10/08 16:19:28 21 +++ trunk/src/devices/dev_eagle.c 2007/10/08 16:19:37 22 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2005 Anders Gavare. All rights reserved. + * Copyright (C) 2003-2006 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -25,11 +25,9 @@ * SUCH DAMAGE. * * - * $Id: dev_eagle.c,v 1.3 2005/11/21 09:17:26 debug Exp $ + * $Id: dev_eagle.c,v 1.9 2006/01/16 00:51:14 debug Exp $ * * Motorola MPC105 "Eagle" host bridge. - * - * TODO: This is just a dummy. */ #include @@ -53,29 +51,31 @@ /* * dev_eagle_access(): * - * Passes accesses to ISA ports 0xcf8 and 0xcfc onto bus_pci_access(). + * Passes accesses to ISA ports 0xcf8 and 0xcfc onto bus_pci. */ -int dev_eagle_access(struct cpu *cpu, struct memory *mem, - uint64_t relative_addr, unsigned char *data, size_t len, - int writeflag, void *extra) +DEVICE_ACCESS(eagle) { uint64_t idata = 0, odata = 0; struct eagle_data *d = extra; + int bus, dev, func, reg; if (writeflag == MEM_WRITE) - idata = memory_readmax64(cpu, data, len); + idata = memory_readmax64(cpu, data, len|MEM_PCI_LITTLE_ENDIAN); - relative_addr += BUS_PCI_ADDR; + switch (relative_addr) { + case 0: /* Address: */ + bus_pci_decompose_1(idata, &bus, &dev, &func, ®); + bus_pci_setaddr(cpu, d->pci_data, bus, dev, func, reg); + break; - if (writeflag == MEM_WRITE) - bus_pci_access(cpu, mem, relative_addr, &idata, - len, writeflag, d->pci_data); - else - bus_pci_access(cpu, mem, relative_addr, &odata, - len, writeflag, d->pci_data); + case 4: /* Data: */ + bus_pci_data_access(cpu, d->pci_data, writeflag == MEM_READ? + &odata : &idata, len, writeflag); + break; + } if (writeflag == MEM_READ) - memory_writemax64(cpu, data, len, odata); + memory_writemax64(cpu, data, len|MEM_PCI_LITTLE_ENDIAN, odata); return 1; } @@ -108,7 +108,8 @@ isa_portbase = 0x80000000ULL; isa_membase = 0xc0000000ULL; - d->pci_data = bus_pci_init(pciirq, + /* Create a PCI bus: */ + d->pci_data = bus_pci_init(machine, pciirq, pci_io_offset, pci_mem_offset, pci_portbase, pci_membase, pci_irqbase, isa_portbase, isa_membase, isa_irqbase); @@ -127,6 +128,19 @@ case MACHINE_PREP: bus_pci_add(machine, d->pci_data, mem, 0, 11, 0, "ibm_isa"); break; + case MACHINE_MVMEPPC: + switch (machine->machine_subtype) { + case MACHINE_MVMEPPC_1600: + bus_pci_add(machine, d->pci_data, mem, 0, 11, 0, + "i82378zb"); + break; + default:fatal("unimplemented machine subtype for " + "eagle/mvmeppc\n"); + exit(1); + } + break; + default:fatal("unimplemented machine type for eagle\n"); + exit(1); } return d->pci_data;