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 "cpu.h" |
18 |
#include "vm.h" |
19 |
#include "device.h" |
20 |
#include "dev_c3600_bay.h" |
21 |
|
22 |
/* C3620 NM info */ |
23 |
static struct nm_bay_info c3620_nm_bays[2] = { |
24 |
{ -1, 0x05 }, /* Slot 0: PCI bus 0, device 5 */ |
25 |
{ -1, 0x0d }, /* Slot 1: PCI bus 0, device 13 */ |
26 |
}; |
27 |
|
28 |
/* C3640 NM info */ |
29 |
static struct nm_bay_info c3640_nm_bays[4] = { |
30 |
{ 0x03, 0x00 }, /* Slot 0: PCI bus 2, device 0 */ |
31 |
{ 0x02, 0x00 }, /* Slot 1: PCI bus 1, device 0 */ |
32 |
{ -1, 0x08 }, /* Slot 2: PCI bus 2, device 8 */ |
33 |
{ -1, 0x08 }, /* Slot 3: PCI bus 1, device 8 */ |
34 |
}; |
35 |
|
36 |
/* C3660 NM info */ |
37 |
static struct nm_bay_info c3660_nm_bays[7] = { |
38 |
{ -1, 0x06 }, /* Slot 0: PCI bus 0, device 6 */ |
39 |
{ 0x02, 0x00 }, /* Slot 1: PCI bus 2 */ |
40 |
{ 0x07, 0x00 }, /* Slot 2: PCI bus 22 */ |
41 |
{ 0x03, 0x00 }, /* Slot 3: PCI bus 6 */ |
42 |
{ 0x06, 0x00 }, /* Slot 4: PCI bus 18 */ |
43 |
{ 0x04, 0x00 }, /* Slot 5: PCI bus 10 */ |
44 |
{ 0x05, 0x00 }, /* Slot 6: PCI bus 14 */ |
45 |
}; |
46 |
|
47 |
/* Get NM bay information */ |
48 |
struct nm_bay_info *c3600_nm_get_bay_info(u_int chassis,u_int nm_bay) |
49 |
{ |
50 |
struct nm_bay_info *bay_info; |
51 |
u_int max_bays = 0; |
52 |
|
53 |
switch(chassis) { |
54 |
case 3620: |
55 |
bay_info = c3620_nm_bays; |
56 |
max_bays = 2; |
57 |
break; |
58 |
case 3640: |
59 |
bay_info = c3640_nm_bays; |
60 |
max_bays = 4; |
61 |
break; |
62 |
case 3660: |
63 |
bay_info = c3660_nm_bays; |
64 |
max_bays = 7; |
65 |
break; |
66 |
} |
67 |
|
68 |
if (nm_bay >= max_bays) |
69 |
return NULL; |
70 |
|
71 |
return(&bay_info[nm_bay]); |
72 |
} |