30 |
* |
* |
31 |
* Add a NM-4T network module into specified slot. |
* Add a NM-4T network module into specified slot. |
32 |
*/ |
*/ |
33 |
int dev_c3725_nm_4t_init(c3725_t *router,char *name,u_int nm_bay) |
int dev_c3725_nm_4t_init(vm_instance_t *vm,struct cisco_card *card) |
34 |
{ |
{ |
35 |
struct mueslix_data *data; |
struct mueslix_data *data; |
36 |
|
u_int slot = card->slot_id; |
37 |
|
|
38 |
|
/* Set the PCI bus */ |
39 |
|
card->pci_bus = vm->slots_pci_bus[slot]; |
40 |
|
|
41 |
/* Set the EEPROM */ |
/* Set the EEPROM */ |
42 |
c3725_nm_set_eeprom(router,nm_bay,cisco_eeprom_find_nm("NM-4T")); |
cisco_card_set_eeprom(vm,card,cisco_eeprom_find_nm("NM-4T")); |
43 |
|
c3725_set_slot_eeprom(VM_C3725(vm),slot,&card->eeprom); |
44 |
|
|
45 |
/* Create the Mueslix chip */ |
/* Create the Mueslix chip */ |
46 |
data = dev_mueslix_init(router->vm,name,0, |
data = dev_mueslix_init(vm,card->dev_name,0, |
47 |
router->nm_bay[nm_bay].pci_map, |
card->pci_bus,c3725_nm_get_pci_device(slot), |
48 |
c3725_nm_get_pci_device(nm_bay), |
c3725_net_irq_for_slot_port(slot,0)); |
|
c3725_net_irq_for_slot_port(nm_bay,0)); |
|
49 |
|
|
50 |
if (!data) return(-1); |
if (!data) return(-1); |
51 |
|
|
52 |
/* Store device info into the router structure */ |
/* Store device info into the router structure */ |
53 |
return(c3725_nm_set_drvinfo(router,nm_bay,data)); |
card->drv_info = data; |
54 |
|
return(0); |
55 |
} |
} |
56 |
|
|
57 |
/* Remove a NM-4T from the specified slot */ |
/* Remove a NM-4T from the specified slot */ |
58 |
int dev_c3725_nm_4t_shutdown(c3725_t *router,u_int nm_bay) |
int dev_c3725_nm_4t_shutdown(vm_instance_t *vm,struct cisco_card *card) |
59 |
{ |
{ |
60 |
struct c3725_nm_bay *bay; |
/* Remove the NM EEPROM */ |
61 |
|
cisco_card_unset_eeprom(card); |
62 |
if (!(bay = c3725_nm_get_info(router,nm_bay))) |
c3725_set_slot_eeprom(VM_C3725(vm),card->slot_id,NULL); |
|
return(-1); |
|
63 |
|
|
64 |
c3725_nm_unset_eeprom(router,nm_bay); |
/* Remove the mueslix driver */ |
65 |
dev_mueslix_remove(bay->drv_info); |
dev_mueslix_remove(card->drv_info); |
66 |
return(0); |
return(0); |
67 |
} |
} |
68 |
|
|
69 |
/* Bind a Network IO descriptor to a specific port */ |
/* Bind a Network IO descriptor to a specific port */ |
70 |
int dev_c3725_nm_4t_set_nio(c3725_t *router,u_int nm_bay,u_int port_id, |
int dev_c3725_nm_4t_set_nio(vm_instance_t *vm,struct cisco_card *card, |
71 |
netio_desc_t *nio) |
u_int port_id,netio_desc_t *nio) |
72 |
{ |
{ |
73 |
struct mueslix_data *data; |
struct mueslix_data *d = card->drv_info; |
74 |
|
|
75 |
if ((port_id >= MUESLIX_NR_CHANNELS) || |
if (!d || (port_id >= MUESLIX_NR_CHANNELS)) |
|
!(data = c3725_nm_get_drvinfo(router,nm_bay))) |
|
76 |
return(-1); |
return(-1); |
77 |
|
|
78 |
return(dev_mueslix_set_nio(data,port_id,nio)); |
return(dev_mueslix_set_nio(d,port_id,nio)); |
79 |
} |
} |
80 |
|
|
81 |
/* Unbind a Network IO descriptor to a specific port */ |
/* Unbind a Network IO descriptor to a specific port */ |
82 |
int dev_c3725_nm_4t_unset_nio(c3725_t *router,u_int nm_bay,u_int port_id) |
int dev_c3725_nm_4t_unset_nio(vm_instance_t *vm,struct cisco_card *card, |
83 |
|
u_int port_id) |
84 |
{ |
{ |
85 |
struct mueslix_data *d; |
struct mueslix_data *d = card->drv_info; |
86 |
|
|
87 |
if ((port_id >= MUESLIX_NR_CHANNELS) || |
if (!d || (port_id >= MUESLIX_NR_CHANNELS)) |
|
!(d = c3725_nm_get_drvinfo(router,nm_bay))) |
|
88 |
return(-1); |
return(-1); |
89 |
|
|
90 |
return(dev_mueslix_unset_nio(d,port_id)); |
return(dev_mueslix_unset_nio(d,port_id)); |
91 |
} |
} |
92 |
|
|
93 |
/* NM-4T driver */ |
/* NM-4T driver */ |
94 |
struct c3725_nm_driver dev_c3725_nm_4t_driver = { |
struct cisco_card_driver dev_c3725_nm_4t_driver = { |
95 |
"NM-4T", 1, 0, |
"NM-4T", 1, 0, |
96 |
dev_c3725_nm_4t_init, |
dev_c3725_nm_4t_init, |
97 |
dev_c3725_nm_4t_shutdown, |
dev_c3725_nm_4t_shutdown, |
98 |
|
NULL, |
99 |
dev_c3725_nm_4t_set_nio, |
dev_c3725_nm_4t_set_nio, |
100 |
dev_c3725_nm_4t_unset_nio, |
dev_c3725_nm_4t_unset_nio, |
101 |
NULL, |
NULL, |