1 |
/* |
/* |
2 |
* Cisco C7200 (Predator) Simulation Platform. |
* Cisco router simulation platform. |
3 |
* Copyright (C) 2005,2006 Christophe Fillot. All rights reserved. |
* Copyright (C) 2005,2006 Christophe Fillot. All rights reserved. |
4 |
* |
* |
5 |
* PA-A1 ATM interface based on TI1570 and PLX 9060-ES. |
* PA-A1 ATM interface based on TI1570 and PLX 9060-ES. |
35 |
|
|
36 |
#include "crc.h" |
#include "crc.h" |
37 |
#include "atm.h" |
#include "atm.h" |
38 |
#include "mips64.h" |
#include "cpu.h" |
39 |
|
#include "vm.h" |
40 |
#include "dynamips.h" |
#include "dynamips.h" |
41 |
#include "memory.h" |
#include "memory.h" |
42 |
#include "device.h" |
#include "device.h" |
330 |
ptask_id_t tx_tid; |
ptask_id_t tx_tid; |
331 |
}; |
}; |
332 |
|
|
|
/* EEPROM definition */ |
|
|
static const m_uint16_t eeprom_pa_a1_data[64] = { |
|
|
0x0117, 0x010F, 0xffff, 0xffff, 0x4906, 0x2E07, 0x0000, 0x0000, |
|
|
0x5000, 0x0000, 0x0010, 0x2400, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, |
|
|
}; |
|
|
|
|
|
static const struct c7200_eeprom eeprom_pa_a1 = { |
|
|
"PA-A1-OC3MM", (m_uint16_t *)eeprom_pa_a1_data, sizeof(eeprom_pa_a1_data)/2, |
|
|
}; |
|
|
|
|
333 |
/* Log a TI1570 message */ |
/* Log a TI1570 message */ |
334 |
#define TI1570_LOG(d,msg...) vm_log((d)->vm,(d)->name,msg) |
#define TI1570_LOG(d,msg...) vm_log((d)->vm,(d)->name,msg) |
335 |
|
|
339 |
/* |
/* |
340 |
* dev_pa_a1_access() |
* dev_pa_a1_access() |
341 |
*/ |
*/ |
342 |
void *dev_pa_a1_access(cpu_mips_t *cpu,struct vdevice *dev,m_uint32_t offset, |
void *dev_pa_a1_access(cpu_gen_t *cpu,struct vdevice *dev,m_uint32_t offset, |
343 |
u_int op_size,u_int op_type,m_uint64_t *data) |
u_int op_size,u_int op_type,m_uint64_t *data) |
344 |
{ |
{ |
345 |
struct pa_a1_data *d = dev->priv_data; |
struct pa_a1_data *d = dev->priv_data; |
350 |
#if DEBUG_ACCESS |
#if DEBUG_ACCESS |
351 |
if (op_type == MTS_READ) { |
if (op_type == MTS_READ) { |
352 |
cpu_log(cpu,"TI1570","read access to offset = 0x%x, pc = 0x%llx\n", |
cpu_log(cpu,"TI1570","read access to offset = 0x%x, pc = 0x%llx\n", |
353 |
offset,cpu->pc); |
offset,cpu_get_pc(cpu)); |
354 |
} else { |
} else { |
355 |
cpu_log(cpu,"TI1570","write access to vaddr = 0x%x, pc = 0x%llx, " |
cpu_log(cpu,"TI1570","write access to vaddr = 0x%x, pc = 0x%llx, " |
356 |
"val = 0x%llx\n",offset,cpu->pc,*data); |
"val = 0x%llx\n",offset,cpu_get_pc(cpu),*data); |
357 |
} |
} |
358 |
#endif |
#endif |
359 |
|
|
385 |
#if DEBUG_UNKNOWN |
#if DEBUG_UNKNOWN |
386 |
if (op_type == MTS_READ) { |
if (op_type == MTS_READ) { |
387 |
cpu_log(cpu,d->name,"read from unknown addr 0x%x, pc=0x%llx (size=%u)\n", |
cpu_log(cpu,d->name,"read from unknown addr 0x%x, pc=0x%llx (size=%u)\n", |
388 |
offset,cpu->pc,op_size); |
offset,cpu_get_pc(cpu),op_size); |
389 |
} else { |
} else { |
390 |
cpu_log(cpu,d->name,"write to unknown addr 0x%x, value=0x%llx, " |
cpu_log(cpu,d->name,"write to unknown addr 0x%x, value=0x%llx, " |
391 |
"pc=0x%llx (size=%u)\n",offset,*data,cpu->pc,op_size); |
"pc=0x%llx (size=%u)\n",offset,*data,cpu_get_pc(cpu),op_size); |
392 |
} |
} |
393 |
#endif |
#endif |
394 |
return NULL; |
return NULL; |
1429 |
/* |
/* |
1430 |
* pci_ti1570_read() |
* pci_ti1570_read() |
1431 |
*/ |
*/ |
1432 |
static m_uint32_t pci_ti1570_read(cpu_mips_t *cpu,struct pci_device *dev, |
static m_uint32_t pci_ti1570_read(cpu_gen_t *cpu,struct pci_device *dev, |
1433 |
int reg) |
int reg) |
1434 |
{ |
{ |
1435 |
struct pa_a1_data *d = dev->priv_data; |
struct pa_a1_data *d = dev->priv_data; |
1449 |
/* |
/* |
1450 |
* pci_ti1570_write() |
* pci_ti1570_write() |
1451 |
*/ |
*/ |
1452 |
static void pci_ti1570_write(cpu_mips_t *cpu,struct pci_device *dev, |
static void pci_ti1570_write(cpu_gen_t *cpu,struct pci_device *dev, |
1453 |
int reg,m_uint32_t value) |
int reg,m_uint32_t value) |
1454 |
{ |
{ |
1455 |
struct pa_a1_data *d = dev->priv_data; |
struct pa_a1_data *d = dev->priv_data; |
1469 |
/* |
/* |
1470 |
* pci_plx9060es_read() |
* pci_plx9060es_read() |
1471 |
*/ |
*/ |
1472 |
static m_uint32_t pci_plx9060es_read(cpu_mips_t *cpu,struct pci_device *dev, |
static m_uint32_t pci_plx9060es_read(cpu_gen_t *cpu,struct pci_device *dev, |
1473 |
int reg) |
int reg) |
1474 |
{ |
{ |
1475 |
#if DEBUG_ACCESS |
#if DEBUG_ACCESS |
1484 |
/* |
/* |
1485 |
* pci_plx9060es_write() |
* pci_plx9060es_write() |
1486 |
*/ |
*/ |
1487 |
static void pci_plx9060es_write(cpu_mips_t *cpu,struct pci_device *dev, |
static void pci_plx9060es_write(cpu_gen_t *cpu,struct pci_device *dev, |
1488 |
int reg,m_uint32_t value) |
int reg,m_uint32_t value) |
1489 |
{ |
{ |
1490 |
#if DEBUG_ACCESS |
#if DEBUG_ACCESS |
1528 |
memset(d,0,sizeof(*d)); |
memset(d,0,sizeof(*d)); |
1529 |
|
|
1530 |
/* Set the EEPROM */ |
/* Set the EEPROM */ |
1531 |
c7200_pa_set_eeprom(router,pa_bay,&eeprom_pa_a1); |
c7200_pa_set_eeprom(router,pa_bay,cisco_eeprom_find_pa("PA-A1")); |
1532 |
|
|
1533 |
/* Add PCI device TI1570 */ |
/* Add PCI device TI1570 */ |
1534 |
pci_dev_ti = pci_dev_add(router->pa_bay[pa_bay].pci_map,name, |
pci_dev_ti = pci_dev_add(router->pa_bay[pa_bay].pci_map,name, |