1 |
dpavlin |
1 |
/* |
2 |
|
|
* Cisco C7200 (Predator) 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 "mips64.h" |
15 |
|
|
#include "dynamips.h" |
16 |
|
|
#include "memory.h" |
17 |
|
|
#include "device.h" |
18 |
|
|
|
19 |
|
|
#define AP1011_PCI_VENDOR_ID 0x14D9 |
20 |
|
|
#define AP1011_PCI_PRODUCT_ID 0x0010 |
21 |
|
|
|
22 |
|
|
/* |
23 |
|
|
* pci_ap1011_read() |
24 |
|
|
* |
25 |
|
|
* Read a PCI register. |
26 |
|
|
*/ |
27 |
|
|
static m_uint32_t pci_ap1011_read(cpu_mips_t *cpu,struct pci_device *dev, |
28 |
|
|
int reg) |
29 |
|
|
{ |
30 |
|
|
switch (reg) { |
31 |
|
|
case 0x08: |
32 |
|
|
return(0x06040000); |
33 |
|
|
case 0x34: |
34 |
|
|
return(0x00000040); |
35 |
|
|
case 0x40: |
36 |
|
|
return(0x00210008); |
37 |
|
|
case 0x44: |
38 |
|
|
return(0x00000020); |
39 |
|
|
case 0x48: |
40 |
|
|
return(0x000000C0); |
41 |
|
|
default: |
42 |
|
|
return(0); |
43 |
|
|
} |
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
/* Create an AP1011 Sturgeon HyperTransport-PCI Bridge */ |
47 |
|
|
int dev_ap1011_init(struct pci_bus *pci_bus,int pci_device, |
48 |
|
|
struct pci_bus *sec_bus) |
49 |
|
|
{ |
50 |
|
|
struct pci_device *dev; |
51 |
|
|
|
52 |
|
|
dev = pci_bridge_create_dev(pci_bus,"ap1011", |
53 |
|
|
AP1011_PCI_VENDOR_ID,AP1011_PCI_PRODUCT_ID, |
54 |
|
|
pci_device,0,sec_bus,pci_ap1011_read,NULL); |
55 |
|
|
|
56 |
|
|
return((dev != NULL) ? 0 : -1); |
57 |
|
|
} |