1 |
/* |
/* |
2 |
* Cisco 7200 (Predator) simulation platform. |
* Cisco router simulation platform. |
3 |
* Copyright (c) 2005,2006 Christophe Fillot (cf@utc.fr) |
* Copyright (c) 2005,2006 Christophe Fillot (cf@utc.fr) |
4 |
* |
* |
5 |
* PCI devices. |
* PCI devices. |
15 |
#include <unistd.h> |
#include <unistd.h> |
16 |
#include <sys/types.h> |
#include <sys/types.h> |
17 |
|
|
18 |
#include "mips64.h" |
#include "cpu.h" |
19 |
|
#include "vm.h" |
20 |
#include "dynamips.h" |
#include "dynamips.h" |
21 |
#include "memory.h" |
#include "memory.h" |
22 |
#include "device.h" |
#include "device.h" |
|
#include "vm.h" |
|
23 |
|
|
24 |
#define DEBUG_PCI 1 |
#define DEBUG_PCI 1 |
25 |
|
|
109 |
} |
} |
110 |
|
|
111 |
/* Handle the address register access */ |
/* Handle the address register access */ |
112 |
void pci_dev_addr_handler(cpu_mips_t *cpu,struct pci_bus *pci_bus, |
void pci_dev_addr_handler(cpu_gen_t *cpu,struct pci_bus *pci_bus, |
113 |
u_int op_type,int swap,m_uint64_t *data) |
u_int op_type,int swap,m_uint64_t *data) |
114 |
{ |
{ |
115 |
if (op_type == MTS_WRITE) |
if (op_type == MTS_WRITE) |
126 |
* |
* |
127 |
* The data is read/written at address 0xcfc. |
* The data is read/written at address 0xcfc. |
128 |
*/ |
*/ |
129 |
void pci_dev_data_handler(cpu_mips_t *cpu,struct pci_bus *pci_bus, |
void pci_dev_data_handler(cpu_gen_t *cpu,struct pci_bus *pci_bus, |
130 |
u_int op_type,int swap,m_uint64_t *data) |
u_int op_type,int swap,m_uint64_t *data) |
131 |
{ |
{ |
132 |
struct pci_device *dev; |
struct pci_device *dev; |
133 |
int bus,device,function,reg; |
int bus,device,function,reg; |
134 |
|
|
135 |
if (op_type == MTS_READ) |
if (op_type == MTS_READ) |
136 |
*data = 0; |
*data = 0x0; |
137 |
|
|
138 |
/* |
/* |
139 |
* http://www.mega-tokyo.com/osfaq2/index.php/PciSectionOfPentiumVme |
* http://www.mega-tokyo.com/osfaq2/index.php/PciSectionOfPentiumVme |
158 |
if (op_type == MTS_READ) { |
if (op_type == MTS_READ) { |
159 |
cpu_log(cpu,"PCI","read request at pc=0x%llx: " |
cpu_log(cpu,"PCI","read request at pc=0x%llx: " |
160 |
"bus=%d,device=%d,function=%d,reg=0x%2.2x\n", |
"bus=%d,device=%d,function=%d,reg=0x%2.2x\n", |
161 |
cpu->pc, bus, device, function, reg); |
cpu_get_pc(cpu), bus, device, function, reg); |
162 |
} else { |
} else { |
163 |
cpu_log(cpu,"PCI","write request (data=0x%8.8x) at pc=0x%llx: " |
cpu_log(cpu,"PCI","write request (data=0x%8.8x) at pc=0x%llx: " |
164 |
"bus=%d,device=%d,function=%d,reg=0x%2.2x\n", |
"bus=%d,device=%d,function=%d,reg=0x%2.2x\n", |
165 |
pci_swap(*data,swap), cpu->pc, bus, device, function, reg); |
pci_swap(*data,swap), cpu_get_pc(cpu), |
166 |
|
bus, device, function, reg); |
167 |
} |
} |
168 |
#endif |
#endif |
169 |
|
|
171 |
if (op_type == MTS_READ) { |
if (op_type == MTS_READ) { |
172 |
cpu_log(cpu,"PCI","read request for unknown device at pc=0x%llx " |
cpu_log(cpu,"PCI","read request for unknown device at pc=0x%llx " |
173 |
"(bus=%d,device=%d,function=%d,reg=0x%2.2x).\n", |
"(bus=%d,device=%d,function=%d,reg=0x%2.2x).\n", |
174 |
cpu->pc, bus, device, function, reg); |
cpu_get_pc(cpu), bus, device, function, reg); |
175 |
} else { |
} else { |
176 |
cpu_log(cpu,"PCI","write request (data=0x%8.8x) for unknown device " |
cpu_log(cpu,"PCI","write request (data=0x%8.8x) for unknown device " |
177 |
"at pc=0x%llx (bus=%d,device=%d,function=%d,reg=0x%2.2x).\n", |
"at pc=0x%llx (bus=%d,device=%d,function=%d,reg=0x%2.2x).\n", |
178 |
pci_swap(*data,swap), cpu->pc, bus, device, function, reg); |
pci_swap(*data,swap), cpu_get_pc(cpu), |
179 |
|
bus, device, function, reg); |
180 |
} |
} |
181 |
|
|
182 |
/* Returns an invalid device ID */ |
/* Returns an invalid device ID */ |
427 |
} |
} |
428 |
|
|
429 |
/* Read a configuration register of a PCI bridge */ |
/* Read a configuration register of a PCI bridge */ |
430 |
static m_uint32_t pci_bridge_read_reg(cpu_mips_t *cpu,struct pci_device *dev, |
static m_uint32_t pci_bridge_read_reg(cpu_gen_t *cpu,struct pci_device *dev, |
431 |
int reg) |
int reg) |
432 |
{ |
{ |
433 |
struct pci_bridge *bridge = dev->priv_data; |
struct pci_bridge *bridge = dev->priv_data; |
449 |
} |
} |
450 |
|
|
451 |
/* Write a configuration register of a PCI bridge */ |
/* Write a configuration register of a PCI bridge */ |
452 |
static void pci_bridge_write_reg(cpu_mips_t *cpu,struct pci_device *dev, |
static void pci_bridge_write_reg(cpu_gen_t *cpu,struct pci_device *dev, |
453 |
int reg,m_uint32_t value) |
int reg,m_uint32_t value) |
454 |
{ |
{ |
455 |
struct pci_bridge *bridge = dev->priv_data; |
struct pci_bridge *bridge = dev->priv_data; |