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 |
* EEPROM types: |
* EEPROM types: |
22 |
#include <pthread.h> |
#include <pthread.h> |
23 |
#include <assert.h> |
#include <assert.h> |
24 |
|
|
25 |
#include "mips64.h" |
#include "cpu.h" |
26 |
|
#include "vm.h" |
27 |
#include "dynamips.h" |
#include "dynamips.h" |
28 |
#include "memory.h" |
#include "memory.h" |
29 |
#include "device.h" |
#include "device.h" |
286 |
u_int m32_offset; |
u_int m32_offset; |
287 |
}; |
}; |
288 |
|
|
|
/* EEPROM definition (3D = PA-4B, 3E = PA-8B) */ |
|
|
static const m_uint16_t eeprom_pa_4b_data[64] = { |
|
|
0x013D, 0x0202, 0xffff, 0xffff, 0x490C, 0x7806, 0x0000, 0x0000, |
|
|
0x5000, 0x0000, 0x0208, 0x1900, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, |
|
|
}; |
|
|
|
|
|
static const struct c7200_eeprom eeprom_pa_4b = { |
|
|
"PA-4B", (m_uint16_t *)eeprom_pa_4b_data, |
|
|
sizeof(eeprom_pa_4b_data)/2, |
|
|
}; |
|
|
|
|
289 |
/* Log a PA-4B/PA-8B message */ |
/* Log a PA-4B/PA-8B message */ |
290 |
#define BRI_LOG(d,msg...) vm_log((d)->vm,(d)->name,msg) |
#define BRI_LOG(d,msg...) vm_log((d)->vm,(d)->name,msg) |
291 |
|
|
491 |
printf("M32: data_ptr=0x%x, len=%u\n",txd.tdp,pkt_len); |
printf("M32: data_ptr=0x%x, len=%u\n",txd.tdp,pkt_len); |
492 |
mem_dump(stdout,pkt,pkt_len); |
mem_dump(stdout,pkt,pkt_len); |
493 |
|
|
494 |
/* Poll the next descriptor (wait for HOLD bit to be reset */ |
/* Poll the next descriptor (wait for HOLD bit to be reset) */ |
495 |
chan->poll_mode = 1; |
chan->poll_mode = 1; |
496 |
|
|
497 |
if (txd.params & M32_TXDESC_FE) { |
if (txd.params & M32_TXDESC_FE) { |
579 |
} |
} |
580 |
|
|
581 |
/* Munich32 general access function */ |
/* Munich32 general access function */ |
582 |
static void *m32_gen_access(struct m32_data *d,cpu_mips_t *cpu, |
static void *m32_gen_access(struct m32_data *d,cpu_gen_t *cpu, |
583 |
m_uint32_t offset,u_int op_size,u_int op_type, |
m_uint32_t offset,u_int op_size,u_int op_type, |
584 |
m_uint64_t *data) |
m_uint64_t *data) |
585 |
{ |
{ |
642 |
/* |
/* |
643 |
* pa_4b_access() |
* pa_4b_access() |
644 |
*/ |
*/ |
645 |
void *pa_4b_access(cpu_mips_t *cpu,struct vdevice *dev,m_uint32_t offset, |
void *pa_4b_access(cpu_gen_t *cpu,struct vdevice *dev,m_uint32_t offset, |
646 |
u_int op_size,u_int op_type,m_uint64_t *data) |
u_int op_size,u_int op_type,m_uint64_t *data) |
647 |
{ |
{ |
648 |
struct pa_4b_data *d = dev->priv_data; |
struct pa_4b_data *d = dev->priv_data; |
655 |
if (offset >= MUNICH32_MEM_SIZE) { |
if (offset >= MUNICH32_MEM_SIZE) { |
656 |
if (op_type == MTS_READ) { |
if (op_type == MTS_READ) { |
657 |
cpu_log(cpu,d->name,"read access to offset = 0x%x, pc = 0x%llx " |
cpu_log(cpu,d->name,"read access to offset = 0x%x, pc = 0x%llx " |
658 |
"(op_size=%u)\n",offset,cpu->pc,op_size); |
"(op_size=%u)\n",offset,cpu_get_pc(cpu),op_size); |
659 |
} else { |
} else { |
660 |
cpu_log(cpu,d->name,"write access to vaddr = 0x%x, pc = 0x%llx, " |
cpu_log(cpu,d->name,"write access to vaddr = 0x%x, pc = 0x%llx, " |
661 |
"val = 0x%llx (op_size=%u)\n",offset,cpu->pc,*data,op_size); |
"val = 0x%llx (op_size=%u)\n", |
662 |
|
offset,cpu_get_pc(cpu),*data,op_size); |
663 |
} |
} |
664 |
} |
} |
665 |
#endif |
#endif |
743 |
/* |
/* |
744 |
* pci_munich32_read() |
* pci_munich32_read() |
745 |
*/ |
*/ |
746 |
static m_uint32_t pci_munich32_read(cpu_mips_t *cpu,struct pci_device *dev, |
static m_uint32_t pci_munich32_read(cpu_gen_t *cpu,struct pci_device *dev, |
747 |
int reg) |
int reg) |
748 |
{ |
{ |
749 |
struct pa_4b_data *d = dev->priv_data; |
struct pa_4b_data *d = dev->priv_data; |
762 |
/* |
/* |
763 |
* pci_munich32_write() |
* pci_munich32_write() |
764 |
*/ |
*/ |
765 |
static void pci_munich32_write(cpu_mips_t *cpu,struct pci_device *dev, |
static void pci_munich32_write(cpu_gen_t *cpu,struct pci_device *dev, |
766 |
int reg,m_uint32_t value) |
int reg,m_uint32_t value) |
767 |
{ |
{ |
768 |
struct pa_4b_data *d = dev->priv_data; |
struct pa_4b_data *d = dev->priv_data; |
801 |
d->m32_data.vm = router->vm; |
d->m32_data.vm = router->vm; |
802 |
|
|
803 |
/* Set the EEPROM */ |
/* Set the EEPROM */ |
804 |
c7200_pa_set_eeprom(router,pa_bay,&eeprom_pa_4b); |
c7200_pa_set_eeprom(router,pa_bay,cisco_eeprom_find_pa("PA-4B")); |
805 |
|
|
806 |
/* Add as PCI device PA-4B */ |
/* Add as PCI device PA-4B */ |
807 |
pci_dev = pci_dev_add(router->pa_bay[pa_bay].pci_map,name, |
pci_dev = pci_dev_add(router->pa_bay[pa_bay].pci_map,name, |