/[dynamips]/upstream/dynamips-0.2.8-RC1/dev_c3600_eth.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /upstream/dynamips-0.2.8-RC1/dev_c3600_eth.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

upstream/dynamips-0.2.6-RC2/dev_c3600_eth.c revision 3 by dpavlin, Sat Oct 6 16:05:34 2007 UTC upstream/dynamips-0.2.7/dev_c3600_eth.c revision 10 by dpavlin, Sat Oct 6 16:29:14 2007 UTC
# Line 19  Line 19 
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    
# Line 66  static int dev_c3600_nm_eth_init(c3600_t Line 67  static int dev_c3600_nm_eth_init(c3600_t
67        data->port[i] = dev_am79c971_init(router->vm,name,interface_type,        data->port[i] = dev_am79c971_init(router->vm,name,interface_type,
68                                          router->nm_bay[nm_bay].pci_map,                                          router->nm_bay[nm_bay].pci_map,
69                                          bay_info->pci_device + i,                                          bay_info->pci_device + i,
70                                          C3600_NETIO_IRQ);                                          c3600_net_irq_for_slot_port(nm_bay,i));
71     }     }
72    
73     /* Store device info into the router structure */     /* Store device info into the router structure */
# Line 172  static int dev_c3600_nm_1fe_tx_init(c360 Line 173  static int dev_c3600_nm_1fe_tx_init(c360
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,
202                                c3600_net_irq_for_slot_port(nm_bay,0));
203    
204       /* Store device info into the router structure */
205       return(c3600_nm_set_drvinfo(router,nm_bay,data));
206    }
207    
208    /* Remove a NM-16ESW from the specified slot */
209    static int dev_c3600_nm_16esw_shutdown(c3600_t *router,u_int nm_bay)
210    {
211       struct c3600_nm_bay *bay;
212       struct nm_16esw_data *data;
213    
214       if (!(bay = c3600_nm_get_info(router,nm_bay)))
215          return(-1);
216    
217       data = bay->drv_info;
218    
219       /* Remove the NM EEPROM */
220       c3600_nm_unset_eeprom(router,nm_bay);
221    
222       /* Remove the BCM5600 chip */
223       dev_nm_16esw_remove(data);
224       return(0);
225    }
226    
227    /* Bind a Network IO descriptor */
228    static int dev_c3600_nm_16esw_set_nio(c3600_t *router,u_int nm_bay,
229                                          u_int port_id,netio_desc_t *nio)
230    {
231       struct nm_16esw_data *d;
232    
233       d = c3600_nm_get_drvinfo(router,nm_bay);
234       dev_nm_16esw_set_nio(d,port_id,nio);
235       return(0);
236    }
237    
238    /* Unbind a Network IO descriptor */
239    static int dev_c3600_nm_16esw_unset_nio(c3600_t *router,u_int nm_bay,
240                                            u_int port_id)
241    {
242       struct nm_16esw_data *d;
243    
244       d = c3600_nm_get_drvinfo(router,nm_bay);
245       dev_nm_16esw_unset_nio(d,port_id);
246       return(0);
247    }
248    
249    /* Show debug info */
250    static int dev_c3600_nm_16esw_show_info(c3600_t *router,u_int nm_bay)
251    {
252       struct nm_16esw_data *d;
253    
254       d = c3600_nm_get_drvinfo(router,nm_bay);
255       dev_nm_16esw_show_info(d);
256       return(0);
257    }
258    
259    /* ====================================================================== */
260  /* Leopard-2FE                                                            */  /* Leopard-2FE                                                            */
261  /* ====================================================================== */  /* ====================================================================== */
262    
# Line 245  struct c3600_nm_driver dev_c3600_nm_4e_d Line 330  struct c3600_nm_driver dev_c3600_nm_4e_d
330     NULL,     NULL,
331  };  };
332    
333    /* NM-16ESW driver */
334    struct c3600_nm_driver dev_c3600_nm_16esw_driver = {
335       "NM-16ESW", 1, 0,
336       dev_c3600_nm_16esw_init,
337       dev_c3600_nm_16esw_shutdown,
338       dev_c3600_nm_16esw_set_nio,
339       dev_c3600_nm_16esw_unset_nio,
340       dev_c3600_nm_16esw_show_info,
341    };
342    
343  /* Leopard-2FE driver */  /* Leopard-2FE driver */
344  struct c3600_nm_driver dev_c3600_leopard_2fe_driver = {  struct c3600_nm_driver dev_c3600_leopard_2fe_driver = {
345     "Leopard-2FE", 1, 0,     "Leopard-2FE", 1, 0,

Legend:
Removed from v.3  
changed lines
  Added in v.10

  ViewVC Help
Powered by ViewVC 1.1.26