19 |
#include "net_io.h" |
#include "net_io.h" |
20 |
#include "ptask.h" |
#include "ptask.h" |
21 |
#include "dev_am79c971.h" |
#include "dev_am79c971.h" |
22 |
|
#include "dev_nm_16esw.h" |
23 |
#include "dev_c3600.h" |
#include "dev_c3600.h" |
24 |
#include "dev_c3600_bay.h" |
#include "dev_c3600_bay.h" |
25 |
|
|
173 |
} |
} |
174 |
|
|
175 |
/* ====================================================================== */ |
/* ====================================================================== */ |
176 |
|
/* NM-16ESW */ |
177 |
|
/* ====================================================================== */ |
178 |
|
|
179 |
|
/* Add a NM-16ESW */ |
180 |
|
static int dev_c3600_nm_16esw_init(c3600_t *router,char *name,u_int nm_bay) |
181 |
|
{ |
182 |
|
struct nm_bay_info *bay_info; |
183 |
|
struct nm_16esw_data *data; |
184 |
|
|
185 |
|
/* Set the EEPROM */ |
186 |
|
c3600_nm_set_eeprom(router,nm_bay,cisco_eeprom_find_nm("NM-16ESW")); |
187 |
|
dev_nm_16esw_burn_mac_addr(router->vm,nm_bay, |
188 |
|
&router->nm_bay[nm_bay].eeprom); |
189 |
|
|
190 |
|
/* Get PCI bus info about this bay */ |
191 |
|
bay_info = c3600_nm_get_bay_info(c3600_chassis_get_id(router),nm_bay); |
192 |
|
|
193 |
|
if (!bay_info) { |
194 |
|
fprintf(stderr,"%s: unable to get info for NM bay %u\n",name,nm_bay); |
195 |
|
return(-1); |
196 |
|
} |
197 |
|
|
198 |
|
/* Create the device */ |
199 |
|
data = dev_nm_16esw_init(router->vm,name,nm_bay, |
200 |
|
router->nm_bay[nm_bay].pci_map, |
201 |
|
bay_info->pci_device,C3600_NETIO_IRQ); |
202 |
|
|
203 |
|
/* Store device info into the router structure */ |
204 |
|
return(c3600_nm_set_drvinfo(router,nm_bay,data)); |
205 |
|
} |
206 |
|
|
207 |
|
/* Remove a NM-16ESW from the specified slot */ |
208 |
|
static int dev_c3600_nm_16esw_shutdown(c3600_t *router,u_int nm_bay) |
209 |
|
{ |
210 |
|
struct c3600_nm_bay *bay; |
211 |
|
struct nm_16esw_data *data; |
212 |
|
|
213 |
|
if (!(bay = c3600_nm_get_info(router,nm_bay))) |
214 |
|
return(-1); |
215 |
|
|
216 |
|
data = bay->drv_info; |
217 |
|
|
218 |
|
/* Remove the NM EEPROM */ |
219 |
|
c3600_nm_unset_eeprom(router,nm_bay); |
220 |
|
|
221 |
|
/* Remove the BCM5600 chip */ |
222 |
|
dev_nm_16esw_remove(data); |
223 |
|
return(0); |
224 |
|
} |
225 |
|
|
226 |
|
/* Bind a Network IO descriptor */ |
227 |
|
static int dev_c3600_nm_16esw_set_nio(c3600_t *router,u_int nm_bay, |
228 |
|
u_int port_id,netio_desc_t *nio) |
229 |
|
{ |
230 |
|
struct nm_16esw_data *d; |
231 |
|
|
232 |
|
d = c3600_nm_get_drvinfo(router,nm_bay); |
233 |
|
dev_nm_16esw_set_nio(d,port_id,nio); |
234 |
|
return(0); |
235 |
|
} |
236 |
|
|
237 |
|
/* Unbind a Network IO descriptor */ |
238 |
|
static int dev_c3600_nm_16esw_unset_nio(c3600_t *router,u_int nm_bay, |
239 |
|
u_int port_id) |
240 |
|
{ |
241 |
|
struct nm_16esw_data *d; |
242 |
|
|
243 |
|
d = c3600_nm_get_drvinfo(router,nm_bay); |
244 |
|
dev_nm_16esw_unset_nio(d,port_id); |
245 |
|
return(0); |
246 |
|
} |
247 |
|
|
248 |
|
/* Show debug info */ |
249 |
|
static int dev_c3600_nm_16esw_show_info(c3600_t *router,u_int nm_bay) |
250 |
|
{ |
251 |
|
struct nm_16esw_data *d; |
252 |
|
|
253 |
|
d = c3600_nm_get_drvinfo(router,nm_bay); |
254 |
|
dev_nm_16esw_show_info(d); |
255 |
|
return(0); |
256 |
|
} |
257 |
|
|
258 |
|
/* ====================================================================== */ |
259 |
/* Leopard-2FE */ |
/* Leopard-2FE */ |
260 |
/* ====================================================================== */ |
/* ====================================================================== */ |
261 |
|
|
329 |
NULL, |
NULL, |
330 |
}; |
}; |
331 |
|
|
332 |
|
/* NM-16ESW driver */ |
333 |
|
struct c3600_nm_driver dev_c3600_nm_16esw_driver = { |
334 |
|
"NM-16ESW", 1, 0, |
335 |
|
dev_c3600_nm_16esw_init, |
336 |
|
dev_c3600_nm_16esw_shutdown, |
337 |
|
dev_c3600_nm_16esw_set_nio, |
338 |
|
dev_c3600_nm_16esw_unset_nio, |
339 |
|
dev_c3600_nm_16esw_show_info, |
340 |
|
}; |
341 |
|
|
342 |
/* Leopard-2FE driver */ |
/* Leopard-2FE driver */ |
343 |
struct c3600_nm_driver dev_c3600_leopard_2fe_driver = { |
struct c3600_nm_driver dev_c3600_leopard_2fe_driver = { |
344 |
"Leopard-2FE", 1, 0, |
"Leopard-2FE", 1, 0, |