| 1 |
/* |
| 2 |
* Cisco router simulation platform. |
| 3 |
* Copyright (c) 2006 Christophe Fillot. All rights reserved. |
| 4 |
* |
| 5 |
* AP1011 - Sturgeon HyperTransport-PCI Bridge. |
| 6 |
*/ |
| 7 |
|
| 8 |
#include <stdio.h> |
| 9 |
#include <stdlib.h> |
| 10 |
#include <string.h> |
| 11 |
#include <time.h> |
| 12 |
#include <errno.h> |
| 13 |
|
| 14 |
#include "cpu.h" |
| 15 |
#include "vm.h" |
| 16 |
#include "dynamips.h" |
| 17 |
#include "memory.h" |
| 18 |
#include "device.h" |
| 19 |
|
| 20 |
#define AP1011_PCI_VENDOR_ID 0x14D9 |
| 21 |
#define AP1011_PCI_PRODUCT_ID 0x0010 |
| 22 |
|
| 23 |
/* |
| 24 |
* pci_ap1011_read() |
| 25 |
* |
| 26 |
* Read a PCI register. |
| 27 |
*/ |
| 28 |
static m_uint32_t pci_ap1011_read(cpu_gen_t *cpu,struct pci_device *dev, |
| 29 |
int reg) |
| 30 |
{ |
| 31 |
switch (reg) { |
| 32 |
case 0x08: |
| 33 |
return(0x06040000); |
| 34 |
case 0x34: |
| 35 |
return(0x00000040); |
| 36 |
case 0x40: |
| 37 |
return(0x00210008); |
| 38 |
case 0x44: |
| 39 |
return(0x00000020); |
| 40 |
case 0x48: |
| 41 |
return(0x000000C0); |
| 42 |
default: |
| 43 |
return(0); |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
/* Create an AP1011 Sturgeon HyperTransport-PCI Bridge */ |
| 48 |
int dev_ap1011_init(struct pci_bus *pci_bus,int pci_device, |
| 49 |
struct pci_bus *sec_bus) |
| 50 |
{ |
| 51 |
struct pci_device *dev; |
| 52 |
|
| 53 |
dev = pci_bridge_create_dev(pci_bus,"ap1011", |
| 54 |
AP1011_PCI_VENDOR_ID,AP1011_PCI_PRODUCT_ID, |
| 55 |
pci_device,0,sec_bus,pci_ap1011_read,NULL); |
| 56 |
|
| 57 |
return((dev != NULL) ? 0 : -1); |
| 58 |
} |