14 |
#include "net.h" |
#include "net.h" |
15 |
#include "device.h" |
#include "device.h" |
16 |
#include "pci_dev.h" |
#include "pci_dev.h" |
17 |
#include "nmc93c46.h" |
#include "nmc93cX6.h" |
18 |
#include "net_io.h" |
#include "net_io.h" |
19 |
#include "vm.h" |
#include "vm.h" |
20 |
|
|
48 |
/* C3600 NM Management Interrupt handler */ |
/* C3600 NM Management Interrupt handler */ |
49 |
#define C3600_NM_MGMT_IRQ 3 |
#define C3600_NM_MGMT_IRQ 3 |
50 |
|
|
51 |
|
/* Network IRQ */ |
52 |
|
#define C3600_NETIO_IRQ_BASE 32 |
53 |
|
#define C3600_NETIO_IRQ_PORT_BITS 2 |
54 |
|
#define C3600_NETIO_IRQ_PORT_MASK ((1 << C3600_NETIO_IRQ_PORT_BITS) - 1) |
55 |
|
#define C3600_NETIO_IRQ_PER_SLOT (1 << C3600_NETIO_IRQ_PORT_BITS) |
56 |
|
#define C3600_NETIO_IRQ_END \ |
57 |
|
(C3600_NETIO_IRQ_BASE + (C3600_MAX_NM_BAYS * C3600_NETIO_IRQ_PER_SLOT) - 1) |
58 |
|
|
59 |
/* C3600 common device addresses */ |
/* C3600 common device addresses */ |
60 |
#define C3600_GT64K_ADDR 0x14000000ULL |
#define C3600_GT64K_ADDR 0x14000000ULL |
61 |
#define C3600_IOFPGA_ADDR 0x1e800000ULL |
#define C3600_IOFPGA_ADDR 0x1e800000ULL |
77 |
/* C3600 router */ |
/* C3600 router */ |
78 |
typedef struct c3600_router c3600_t; |
typedef struct c3600_router c3600_t; |
79 |
|
|
|
/* C3600 EEPROM */ |
|
|
struct c3600_eeprom { |
|
|
char *name; |
|
|
m_uint16_t *data; |
|
|
u_int len; |
|
|
}; |
|
|
|
|
80 |
/* Prototype of chassis driver initialization function */ |
/* Prototype of chassis driver initialization function */ |
81 |
typedef int (*c3600_chassis_init_fn)(c3600_t *router); |
typedef int (*c3600_chassis_init_fn)(c3600_t *router); |
82 |
|
|
83 |
/* Prototype of NM driver initialization function */ |
/* Prototype of NM driver initialization function */ |
84 |
typedef int (*c3600_nm_init_fn)(c3600_t *router,char *name,u_int nm_bay); |
typedef int (*c3600_nm_init_fn)(c3600_t *router,char *name,u_int nm_bay); |
85 |
|
|
86 |
/* Prototype of PA driver shutdown function */ |
/* Prototype of NM driver shutdown function */ |
87 |
typedef int (*c3600_nm_shutdown_fn)(c3600_t *router,u_int nm_bay); |
typedef int (*c3600_nm_shutdown_fn)(c3600_t *router,u_int nm_bay); |
88 |
|
|
89 |
/* Prototype of PA NIO set function */ |
/* Prototype of NM NIO set function */ |
90 |
typedef int (*c3600_nm_set_nio_fn)(c3600_t *router,u_int nm_bay,u_int port_id, |
typedef int (*c3600_nm_set_nio_fn)(c3600_t *router,u_int nm_bay,u_int port_id, |
91 |
netio_desc_t *nio); |
netio_desc_t *nio); |
92 |
|
|
93 |
/* Prototype of PA NIO unset function */ |
/* Prototype of NM NIO unset function */ |
94 |
typedef int (*c3600_nm_unset_nio_fn)(c3600_t *router,u_int nm_bay, |
typedef int (*c3600_nm_unset_nio_fn)(c3600_t *router,u_int nm_bay, |
95 |
u_int port_id); |
u_int port_id); |
96 |
|
|
97 |
|
/* Prototype of NM NIO show info function */ |
98 |
|
typedef int (*c3600_nm_show_info_fn)(c3600_t *router,u_int nm_bay); |
99 |
|
|
100 |
/* C3600 Network Module Driver */ |
/* C3600 Network Module Driver */ |
101 |
struct c3600_nm_driver { |
struct c3600_nm_driver { |
102 |
char *dev_type; |
char *dev_type; |
106 |
c3600_nm_shutdown_fn nm_shutdown; |
c3600_nm_shutdown_fn nm_shutdown; |
107 |
c3600_nm_set_nio_fn nm_set_nio; |
c3600_nm_set_nio_fn nm_set_nio; |
108 |
c3600_nm_unset_nio_fn nm_unset_nio; |
c3600_nm_unset_nio_fn nm_unset_nio; |
109 |
|
c3600_nm_show_info_fn nm_show_info; |
110 |
|
|
111 |
/* TODO: WAN Interface Cards (WIC) */ |
/* TODO: WAN Interface Cards (WIC) */ |
112 |
}; |
}; |
113 |
|
|
122 |
struct c3600_nm_bay { |
struct c3600_nm_bay { |
123 |
char *dev_name; /* Device name */ |
char *dev_name; /* Device name */ |
124 |
char *dev_type; /* Device Type */ |
char *dev_type; /* Device Type */ |
125 |
|
struct cisco_eeprom eeprom; /* NM EEPROM */ |
126 |
struct pci_bus *pci_map; /* PCI bus */ |
struct pci_bus *pci_map; /* PCI bus */ |
|
m_uint16_t *eeprom_data; /* NM EEPROM data */ |
|
|
u_int eeprom_data_len; /* NM EEPROM data length */ |
|
127 |
struct c3600_nm_driver *nm_driver; /* NM Driver */ |
struct c3600_nm_driver *nm_driver; /* NM Driver */ |
128 |
void *drv_info; /* Private driver info */ |
void *drv_info; /* Private driver info */ |
129 |
struct c3600_nio_binding *nio_list; /* NIO bindings to ports */ |
struct c3600_nio_binding *nio_list; /* NIO bindings to ports */ |
135 |
int chassis_id; |
int chassis_id; |
136 |
int supported; |
int supported; |
137 |
c3600_chassis_init_fn chassis_init; |
c3600_chassis_init_fn chassis_init; |
138 |
m_uint16_t *mb_eeprom; |
struct cisco_eeprom *eeprom; |
|
u_int mb_eeprom_len; |
|
139 |
}; |
}; |
140 |
|
|
141 |
/* C3600 router */ |
/* C3600 router */ |
149 |
/* IO memory size to be passed to Smart Init */ |
/* IO memory size to be passed to Smart Init */ |
150 |
u_int nm_iomem_size; |
u_int nm_iomem_size; |
151 |
|
|
152 |
|
/* I/O FPGA */ |
153 |
|
struct c3600_iofpga_data *iofpga_data; |
154 |
|
|
155 |
/* Chassis information */ |
/* Chassis information */ |
156 |
struct c3600_chassis_driver *chassis_driver; |
struct c3600_chassis_driver *chassis_driver; |
157 |
struct c3600_nm_bay nm_bay[C3600_MAX_NM_BAYS]; |
struct c3600_nm_bay nm_bay[C3600_MAX_NM_BAYS]; |
161 |
* Mainboard EEPROM. |
* Mainboard EEPROM. |
162 |
* It can be modified to change the chassis MAC address. |
* It can be modified to change the chassis MAC address. |
163 |
*/ |
*/ |
164 |
m_uint16_t mb_eeprom_data[64]; |
struct cisco_eeprom mb_eeprom; |
165 |
struct nmc93c46_eeprom_def mb_eeprom; |
struct nmc93cX6_group mb_eeprom_group; |
|
struct nmc93c46_group mb_eeprom_group; |
|
166 |
|
|
167 |
/* Network Module EEPROMs (3620/3640) */ |
/* Network Module EEPROMs (3620/3640) */ |
168 |
struct nmc93c46_eeprom_def nm_eeprom; |
struct nmc93cX6_group nm_eeprom_group; |
|
struct nmc93c46_group nm_eeprom_group; |
|
169 |
|
|
170 |
/* Cisco 3660 NM EEPROMs */ |
/* Cisco 3660 NM EEPROMs */ |
171 |
struct nmc93c46_eeprom_def c3660_nm_eeprom_def[C3600_MAX_NM_BAYS]; |
struct nmc93cX6_group c3660_nm_eeprom_group[C3600_MAX_NM_BAYS]; |
|
struct nmc93c46_group c3660_nm_eeprom_group[C3600_MAX_NM_BAYS]; |
|
172 |
}; |
}; |
173 |
|
|
174 |
/* Create a new router instance */ |
/* Create a new router instance */ |
186 |
/* Save configurations of all C3600 instances */ |
/* Save configurations of all C3600 instances */ |
187 |
void c3600_save_config_all(FILE *fd); |
void c3600_save_config_all(FILE *fd); |
188 |
|
|
189 |
|
/* Get network IRQ for specified slot/port */ |
190 |
|
u_int c3600_net_irq_for_slot_port(u_int slot,u_int port); |
191 |
|
|
192 |
/* Set NM EEPROM definition */ |
/* Set NM EEPROM definition */ |
193 |
int c3600_nm_set_eeprom(c3600_t *router,u_int nm_bay, |
int c3600_nm_set_eeprom(c3600_t *router,u_int nm_bay, |
194 |
const struct c3600_eeprom *eeprom); |
const struct cisco_eeprom *eeprom); |
195 |
|
|
196 |
/* Unset NM EEPROM definition (empty bay) */ |
/* Unset NM EEPROM definition (empty bay) */ |
197 |
int c3600_nm_unset_eeprom(c3600_t *router,u_int nm_bay); |
int c3600_nm_unset_eeprom(c3600_t *router,u_int nm_bay); |
252 |
/* Shutdown all NM of a router */ |
/* Shutdown all NM of a router */ |
253 |
int c3600_nm_shutdown_all(c3600_t *router); |
int c3600_nm_shutdown_all(c3600_t *router); |
254 |
|
|
255 |
|
/* Show info about all NMs */ |
256 |
|
int c3600_nm_show_all_info(c3600_t *router); |
257 |
|
|
258 |
/* Create a Network Module (command line) */ |
/* Create a Network Module (command line) */ |
259 |
int c3600_cmd_nm_create(c3600_t *router,char *str); |
int c3600_cmd_nm_create(c3600_t *router,char *str); |
260 |
|
|
303 |
extern struct c3600_nm_driver dev_c3600_nm_1fe_tx_driver; |
extern struct c3600_nm_driver dev_c3600_nm_1fe_tx_driver; |
304 |
extern struct c3600_nm_driver dev_c3600_nm_4t_driver; |
extern struct c3600_nm_driver dev_c3600_nm_4t_driver; |
305 |
extern struct c3600_nm_driver dev_c3600_leopard_2fe_driver; |
extern struct c3600_nm_driver dev_c3600_leopard_2fe_driver; |
306 |
|
extern struct c3600_nm_driver dev_c3600_nm_16esw_driver; |
307 |
|
|
308 |
#endif |
#endif |