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