1 |
dpavlin |
1 |
/* |
2 |
|
|
* Cisco 3600 simulation platform. |
3 |
|
|
* Copyright (c) 2006 Christophe Fillot (cf@utc.fr) |
4 |
|
|
* |
5 |
|
|
* Cisco 3600 Network Modules. Info are obtained with "show pci bridge". |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
#include <stdio.h> |
9 |
|
|
#include <stdlib.h> |
10 |
|
|
#include <string.h> |
11 |
|
|
#include <unistd.h> |
12 |
|
|
#include <sys/types.h> |
13 |
|
|
#include <sys/stat.h> |
14 |
|
|
#include <sys/mman.h> |
15 |
|
|
#include <fcntl.h> |
16 |
|
|
|
17 |
|
|
#include "mips64.h" |
18 |
|
|
#include "dynamips.h" |
19 |
|
|
#include "memory.h" |
20 |
|
|
#include "device.h" |
21 |
|
|
#include "dev_c3600_bay.h" |
22 |
|
|
|
23 |
|
|
/* C3620 NM info */ |
24 |
|
|
static struct nm_bay_info c3620_nm_bays[2] = { |
25 |
|
|
{ -1, 0x05 }, /* Slot 0: PCI bus 0, device 5 */ |
26 |
|
|
{ -1, 0x0d }, /* Slot 1: PCI bus 0, device 13 */ |
27 |
|
|
}; |
28 |
|
|
|
29 |
|
|
/* C3640 NM info */ |
30 |
|
|
static struct nm_bay_info c3640_nm_bays[4] = { |
31 |
|
|
{ 0x03, 0x00 }, /* Slot 0: PCI bus 2, device 0 */ |
32 |
|
|
{ 0x02, 0x00 }, /* Slot 1: PCI bus 1, device 0 */ |
33 |
|
|
{ -1, 0x08 }, /* Slot 2: PCI bus 2, device 8 */ |
34 |
|
|
{ -1, 0x08 }, /* Slot 3: PCI bus 1, device 8 */ |
35 |
|
|
}; |
36 |
|
|
|
37 |
|
|
/* C3660 NM info */ |
38 |
|
|
static struct nm_bay_info c3660_nm_bays[7] = { |
39 |
|
|
{ -1, 0x06 }, /* Slot 0: PCI bus 0, device 6 */ |
40 |
|
|
{ 0x02, 0x00 }, /* Slot 1: PCI bus 2 */ |
41 |
|
|
{ 0x07, 0x00 }, /* Slot 2: PCI bus 22 */ |
42 |
|
|
{ 0x03, 0x00 }, /* Slot 3: PCI bus 6 */ |
43 |
|
|
{ 0x06, 0x00 }, /* Slot 4: PCI bus 18 */ |
44 |
|
|
{ 0x04, 0x00 }, /* Slot 5: PCI bus 10 */ |
45 |
|
|
{ 0x05, 0x00 }, /* Slot 6: PCI bus 14 */ |
46 |
|
|
}; |
47 |
|
|
|
48 |
|
|
/* Get NM bay information */ |
49 |
|
|
struct nm_bay_info *c3600_nm_get_bay_info(u_int chassis,u_int nm_bay) |
50 |
|
|
{ |
51 |
|
|
struct nm_bay_info *bay_info; |
52 |
|
|
u_int max_bays = 0; |
53 |
|
|
|
54 |
|
|
switch(chassis) { |
55 |
|
|
case 3620: |
56 |
|
|
bay_info = c3620_nm_bays; |
57 |
|
|
max_bays = 2; |
58 |
|
|
break; |
59 |
|
|
case 3640: |
60 |
|
|
bay_info = c3640_nm_bays; |
61 |
|
|
max_bays = 4; |
62 |
|
|
break; |
63 |
|
|
case 3660: |
64 |
|
|
bay_info = c3660_nm_bays; |
65 |
|
|
max_bays = 7; |
66 |
|
|
break; |
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
if (nm_bay >= max_bays) |
70 |
|
|
return NULL; |
71 |
|
|
|
72 |
|
|
return(&bay_info[nm_bay]); |
73 |
|
|
} |