/[dynamips]/trunk/dev_c7200_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

Contents of /trunk/dev_c7200_eth.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12 - (show annotations)
Sat Oct 6 16:45:40 2007 UTC (16 years, 5 months ago) by dpavlin
File MIME type: text/plain
File size: 19350 byte(s)
make working copy

1 /*
2 * Cisco router simulation platform.
3 * Copyright (c) 2005,2006 Christophe Fillot (cf@utc.fr)
4 *
5 * Ethernet Port Adapters.
6 */
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <stdarg.h>
12 #include <unistd.h>
13 #include <time.h>
14 #include <errno.h>
15 #include <assert.h>
16
17 #include "utils.h"
18 #include "net.h"
19 #include "net_io.h"
20 #include "ptask.h"
21 #include "dev_am79c971.h"
22 #include "dev_dec21140.h"
23 #include "dev_i8254x.h"
24 #include "dev_c7200.h"
25
26 /* ====================================================================== */
27 /* C7200-IO-FE EEPROM */
28 /* ====================================================================== */
29
30 /* C7200-IO-FE: C7200 IOCard with one FastEthernet port EEPROM */
31 static const m_uint16_t eeprom_c7200_io_fe_data[16] = {
32 0x0183, 0x010E, 0xffff, 0xffff, 0x490B, 0x8C02, 0x0000, 0x0000,
33 0x5000, 0x0000, 0x9812, 0x2800, 0x00FF, 0xFFFF, 0xFFFF, 0xFFFF,
34 };
35
36 static const struct cisco_eeprom eeprom_c7200_io_fe = {
37 "C7200-IO-FE", (m_uint16_t *)eeprom_c7200_io_fe_data,
38 sizeof(eeprom_c7200_io_fe_data)/2,
39 };
40
41 /*
42 * dev_c7200_iocard_init()
43 *
44 * Add an IOcard into slot 0.
45 */
46 static int dev_c7200_iocard_init(vm_instance_t *vm,struct cisco_card *card)
47 {
48 struct dec21140_data *data;
49 u_int slot = card->slot_id;
50
51 if (slot != 0) {
52 vm_error(vm,"cannot put IOCARD in PA bay %u!\n",slot);
53 return(-1);
54 }
55
56 /* Set the PCI bus */
57 card->pci_bus = vm->slots_pci_bus[slot];
58
59 /* Set the EEPROM */
60 cisco_card_set_eeprom(vm,card,&eeprom_c7200_io_fe);
61 c7200_set_slot_eeprom(VM_C7200(vm),slot,&card->eeprom);
62
63 /* Create the DEC21140 chip */
64 data = dev_dec21140_init(vm,card->dev_name,
65 card->pci_bus,
66 VM_C7200(vm)->npe_driver->dec21140_pci_dev,
67 c7200_net_irq_for_slot_port(slot,0));
68 if (!data) return(-1);
69
70 /* Store device info into the router structure */
71 card->drv_info = data;
72 return(0);
73 }
74
75 /* Remove an IOcard from slot 0 */
76 static int dev_c7200_iocard_shutdown(vm_instance_t *vm,struct cisco_card *card)
77 {
78 /* Remove the PA EEPROM */
79 cisco_card_unset_eeprom(card);
80 c7200_set_slot_eeprom(VM_C7200(vm),card->slot_id,NULL);
81
82 /* Shutdown the DEC21140 */
83 dev_dec21140_remove(card->drv_info);
84 return(0);
85 }
86
87 /* Bind a Network IO descriptor */
88 static int dev_c7200_iocard_set_nio(vm_instance_t *vm,struct cisco_card *card,
89 u_int port_id,netio_desc_t *nio)
90 {
91 struct dec21140_data *d = card->drv_info;
92
93 if (!d || (port_id > 0))
94 return(-1);
95
96 return(dev_dec21140_set_nio(d,nio));
97 }
98
99 /* Unbind a Network IO descriptor */
100 static int dev_c7200_iocard_unset_nio(vm_instance_t *vm,
101 struct cisco_card *card,
102 u_int port_id)
103 {
104 struct dec21140_data *d = card->drv_info;
105
106 if (!d || (port_id > 0))
107 return(-1);
108
109 dev_dec21140_unset_nio(d);
110 return(0);
111 }
112
113 /*
114 * dev_c7200_pa_fe_tx_init()
115 *
116 * Add a PA-FE-TX port adapter into specified slot.
117 */
118 static int dev_c7200_pa_fe_tx_init(vm_instance_t *vm,struct cisco_card *card)
119 {
120 struct dec21140_data *data;
121 u_int slot = card->slot_id;
122
123 /* Set the PCI bus */
124 card->pci_bus = vm->slots_pci_bus[slot];
125
126 /* Set the EEPROM */
127 cisco_card_set_eeprom(vm,card,cisco_eeprom_find_pa("PA-FE-TX"));
128 c7200_set_slot_eeprom(VM_C7200(vm),slot,&card->eeprom);
129
130 /* Create the DEC21140 chip */
131 data = dev_dec21140_init(vm,card->dev_name,card->pci_bus,0,
132 c7200_net_irq_for_slot_port(slot,0));
133 if (!data) return(-1);
134
135 /* Store device info into the router structure */
136 card->drv_info = data;
137 return(0);
138 }
139
140 /* Remove a PA-FE-TX from the specified slot */
141 static int
142 dev_c7200_pa_fe_tx_shutdown(vm_instance_t *vm,struct cisco_card *card)
143 {
144 /* Remove the PA EEPROM */
145 cisco_card_unset_eeprom(card);
146 c7200_set_slot_eeprom(VM_C7200(vm),card->slot_id,NULL);
147
148 /* Shutdown the DEC21140 */
149 dev_dec21140_remove(card->drv_info);
150 return(0);
151 }
152
153 /* Bind a Network IO descriptor */
154 static int
155 dev_c7200_pa_fe_tx_set_nio(vm_instance_t *vm,struct cisco_card *card,
156 u_int port_id,netio_desc_t *nio)
157 {
158 struct dec21140_data *d = card->drv_info;
159
160 if (!d || (port_id > 0))
161 return(-1);
162
163 return(dev_dec21140_set_nio(d,nio));
164 }
165
166 /* Unbind a Network IO descriptor */
167 static int
168 dev_c7200_pa_fe_tx_unset_nio(vm_instance_t *vm,struct cisco_card *card,
169 u_int port_id)
170 {
171 struct dec21140_data *d = card->drv_info;
172
173 if (!d || (port_id > 0))
174 return(-1);
175
176 dev_dec21140_unset_nio(d);
177 return(0);
178 }
179
180 /* C7200-IO-FE driver */
181 struct cisco_card_driver dev_c7200_iocard_fe_driver = {
182 "C7200-IO-FE", 1, 0,
183 dev_c7200_iocard_init,
184 dev_c7200_iocard_shutdown,
185 NULL,
186 dev_c7200_iocard_set_nio,
187 dev_c7200_iocard_unset_nio,
188 NULL,
189 };
190
191 /* PA-FE-TX driver */
192 struct cisco_card_driver dev_c7200_pa_fe_tx_driver = {
193 "PA-FE-TX", 1, 0,
194 dev_c7200_pa_fe_tx_init,
195 dev_c7200_pa_fe_tx_shutdown,
196 NULL,
197 dev_c7200_pa_fe_tx_set_nio,
198 dev_c7200_pa_fe_tx_unset_nio,
199 NULL,
200 };
201
202 /* ====================================================================== */
203 /* PA based on Intel i8254x chips */
204 /* ====================================================================== */
205
206 struct pa_i8254x_data {
207 u_int nr_port;
208 struct i8254x_data *port[2];
209 };
210
211 /* Remove a PA-2FE-TX from the specified slot */
212 static int
213 dev_c7200_pa_i8254x_shutdown(vm_instance_t *vm,struct cisco_card *card)
214 {
215 struct pa_i8254x_data *data = card->drv_info;
216 int i;
217
218 /* Remove the PA EEPROM */
219 cisco_card_unset_eeprom(card);
220 c7200_set_slot_eeprom(VM_C7200(vm),card->slot_id,NULL);
221
222 /* Remove the Intel i2854x chips */
223 for(i=0;i<data->nr_port;i++)
224 dev_i8254x_remove(data->port[i]);
225
226 free(data);
227 return(0);
228 }
229
230 /* Bind a Network IO descriptor */
231 static int
232 dev_c7200_pa_i8254x_set_nio(vm_instance_t *vm,struct cisco_card *card,
233 u_int port_id,netio_desc_t *nio)
234 {
235 struct pa_i8254x_data *d = card->drv_info;
236
237 if (!d || (port_id >= d->nr_port))
238 return(-1);
239
240 dev_i8254x_set_nio(d->port[port_id],nio);
241 return(0);
242 }
243
244 /* Unbind a Network IO descriptor */
245 static int
246 dev_c7200_pa_i8254x_unset_nio(vm_instance_t *vm,struct cisco_card *card,
247 u_int port_id)
248 {
249 struct pa_i8254x_data *d = card->drv_info;
250
251 if (!d || (port_id >= d->nr_port))
252 return(-1);
253
254 dev_i8254x_unset_nio(d->port[port_id]);
255 return(0);
256 }
257
258 /* ====================================================================== */
259 /* PA-2FE-TX */
260 /* ====================================================================== */
261
262 /*
263 * dev_c7200_pa_2fe_tx_init()
264 *
265 * Add a PA-2FE-TX port adapter into specified slot.
266 */
267 static int dev_c7200_pa_2fe_tx_init(vm_instance_t *vm,struct cisco_card *card)
268 {
269 struct pa_i8254x_data *data;
270 u_int slot = card->slot_id;
271 int i;
272
273 /* Allocate the private data structure for the PA-2FE-TX */
274 if (!(data = malloc(sizeof(*data)))) {
275 vm_error(vm,"%s: out of memory\n",card->dev_name);
276 return(-1);
277 }
278
279 /* 2 Ethernet ports */
280 memset(data,0,sizeof(*data));
281 data->nr_port = 2;
282
283 /* Set the PCI bus */
284 card->pci_bus = vm->slots_pci_bus[slot];
285
286 /* Set the EEPROM */
287 cisco_card_set_eeprom(vm,card,cisco_eeprom_find_pa("PA-2FE-TX"));
288 c7200_set_slot_eeprom(VM_C7200(vm),slot,&card->eeprom);
289
290 /* Create the Intel i8254x chips */
291 for(i=0;i<data->nr_port;i++) {
292 data->port[i] = dev_i8254x_init(vm,card->dev_name,0,
293 card->pci_bus,i,
294 c7200_net_irq_for_slot_port(slot,i));
295 }
296
297 /* Store device info into the router structure */
298 card->drv_info = data;
299 return(0);
300 }
301
302 /* PA-2FE-TX driver */
303 struct cisco_card_driver dev_c7200_pa_2fe_tx_driver = {
304 "PA-2FE-TX", 0, 0,
305 dev_c7200_pa_2fe_tx_init,
306 dev_c7200_pa_i8254x_shutdown,
307 NULL,
308 dev_c7200_pa_i8254x_set_nio,
309 dev_c7200_pa_i8254x_unset_nio,
310 NULL,
311 };
312
313 /* ====================================================================== */
314 /* PA-GE */
315 /* ====================================================================== */
316
317 /*
318 * dev_c7200_pa_ge_init()
319 *
320 * Add a PA-GE port adapter into specified slot.
321 */
322 static int dev_c7200_pa_ge_init(vm_instance_t *vm,struct cisco_card *card)
323 {
324 struct pa_i8254x_data *data;
325 u_int slot = card->slot_id;
326
327 /* Allocate the private data structure for the PA-2FE-TX */
328 if (!(data = malloc(sizeof(*data)))) {
329 vm_error(vm,"%s: out of memory\n",card->dev_name);
330 return(-1);
331 }
332
333 /* 2 Ethernet ports */
334 memset(data,0,sizeof(*data));
335 data->nr_port = 1;
336
337 /* Set the PCI bus */
338 card->pci_bus = vm->slots_pci_bus[slot];
339
340 /* Set the EEPROM */
341 cisco_card_set_eeprom(vm,card,cisco_eeprom_find_pa("PA-GE"));
342 c7200_set_slot_eeprom(VM_C7200(vm),slot,&card->eeprom);
343
344 /* Create the Intel i8254x chip */
345 data->port[0] = dev_i8254x_init(vm,card->dev_name,0,
346 card->pci_bus,0,
347 c7200_net_irq_for_slot_port(slot,0));
348
349 /* Store device info into the router structure */
350 card->drv_info = data;
351 return(0);
352 }
353
354 /* PA-GE driver */
355 struct cisco_card_driver dev_c7200_pa_ge_driver = {
356 "PA-GE", 0, 0,
357 dev_c7200_pa_ge_init,
358 dev_c7200_pa_i8254x_shutdown,
359 NULL,
360 dev_c7200_pa_i8254x_set_nio,
361 dev_c7200_pa_i8254x_unset_nio,
362 NULL,
363 };
364
365 /* ====================================================================== */
366 /* C7200-IO-2FE */
367 /* ====================================================================== */
368
369 /* C7200-IO-2FE/E: C7200 IOCard with two FastEthernet ports EEPROM */
370 static const m_uint16_t eeprom_c7200_io_2fe_data[] = {
371 0x04FF, 0x4002, 0x1541, 0x0201, 0xC046, 0x0320, 0x001B, 0xCA06,
372 0x8249, 0x138B, 0x0642, 0x4230, 0xC18B, 0x3030, 0x3030, 0x3030,
373 0x3030, 0x0000, 0x0004, 0x0002, 0x0385, 0x1C0D, 0x7F03, 0xCB8F,
374 0x4337, 0x3230, 0x302D, 0x492F, 0x4F2D, 0x3246, 0x452F, 0x4580,
375 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
376 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
377 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
378 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
379 };
380
381 static const struct cisco_eeprom eeprom_c7200_io_2fe = {
382 "C7200-IO-2FE", (m_uint16_t *)eeprom_c7200_io_2fe_data,
383 sizeof(eeprom_c7200_io_2fe_data)/2,
384 };
385
386 /*
387 * dev_c7200_pa_2fe_tx_init()
388 *
389 * Add a C7200-IO-2FE/E port adapter into specified slot.
390 */
391 static int dev_c7200_iocard_2fe_init(vm_instance_t *vm,struct cisco_card *card)
392 {
393 struct pa_i8254x_data *data;
394 u_int slot = card->slot_id;
395
396 /* Allocate the private data structure for the iocard */
397 if (!(data = malloc(sizeof(*data)))) {
398 vm_error(vm,"%s: out of memory\n",card->dev_name);
399 return(-1);
400 }
401
402 /* 2 Ethernet ports */
403 memset(data,0,sizeof(*data));
404 data->nr_port = 2;
405
406 /* Set the PCI bus */
407 card->pci_bus = vm->slots_pci_bus[slot];
408
409 /* Set the EEPROM */
410 cisco_card_set_eeprom(vm,card,&eeprom_c7200_io_2fe);
411 c7200_set_slot_eeprom(VM_C7200(vm),slot,&card->eeprom);
412
413 /* Port Fa0/0 is on PCI Device 1 */
414 data->port[0] = dev_i8254x_init(vm,card->dev_name,0,
415 card->pci_bus,1,
416 c7200_net_irq_for_slot_port(slot,1));
417
418 /* Port Fa0/1 is on PCI Device 0 */
419 data->port[1] = dev_i8254x_init(vm,card->dev_name,0,
420 card->pci_bus,0,
421 c7200_net_irq_for_slot_port(slot,0));
422
423 if (!data->port[0] || !data->port[1]) {
424 dev_i8254x_remove(data->port[0]);
425 dev_i8254x_remove(data->port[1]);
426 free(data);
427 return(-1);
428 }
429
430 /* Store device info into the router structure */
431 card->drv_info = data;
432 return(0);
433 }
434
435 /* C7200-IO-2FE driver */
436 struct cisco_card_driver dev_c7200_iocard_2fe_driver = {
437 "C7200-IO-2FE", 0, 0,
438 dev_c7200_iocard_2fe_init,
439 dev_c7200_pa_i8254x_shutdown,
440 NULL,
441 dev_c7200_pa_i8254x_set_nio,
442 dev_c7200_pa_i8254x_unset_nio,
443 NULL,
444 };
445
446 /* ====================================================================== */
447 /* C7200-IO-GE-E */
448 /* ====================================================================== */
449
450 /*
451 * C7200-IO-GE+E: C7200 IOCard with 1 GigatEthernet ports
452 * and 1 Ethernet port EEPROM.
453 */
454 static const m_uint16_t eeprom_c7200_io_ge_e_data[] = {
455 0x04FF, 0x4002, 0x1641, 0x0201, 0xC046, 0x0320, 0x001B, 0xCA06,
456 0x8249, 0x138B, 0x0642, 0x4230, 0xC18B, 0x3030, 0x3030, 0x3030,
457 0x3030, 0x0000, 0x0004, 0x0002, 0x0385, 0x1C0D, 0x7F03, 0xCB8F,
458 0x4337, 0x3230, 0x302D, 0x492F, 0x4F2D, 0x3246, 0x452F, 0x4580,
459 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
460 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
461 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
462 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
463 };
464
465 static const struct cisco_eeprom eeprom_c7200_io_ge_e = {
466 "C7200-IO-GE-E", (m_uint16_t *)eeprom_c7200_io_ge_e_data,
467 sizeof(eeprom_c7200_io_ge_e_data)/2,
468 };
469
470 /*
471 * dev_c7200_pa_ge_e_tx_init()
472 *
473 * Add a C7200-I/O-GE+E port adapter into specified slot.
474 */
475 static int
476 dev_c7200_iocard_ge_e_init(vm_instance_t *vm,struct cisco_card *card)
477 {
478 struct pa_i8254x_data *data;
479 u_int slot = card->slot_id;
480
481 /* Allocate the private data structure for the iocard */
482 if (!(data = malloc(sizeof(*data)))) {
483 vm_error(vm,"%s: out of memory\n",card->dev_name);
484 return(-1);
485 }
486
487 /* 2 Ethernet ports */
488 memset(data,0,sizeof(*data));
489 data->nr_port = 2;
490
491 /* Set the PCI bus */
492 card->pci_bus = vm->slots_pci_bus[slot];
493
494 /* Set the EEPROM */
495 cisco_card_set_eeprom(vm,card,&eeprom_c7200_io_ge_e);
496 c7200_set_slot_eeprom(VM_C7200(vm),slot,&card->eeprom);
497
498 /* Port Gi0/0 is on PCI Device 1 */
499 data->port[0] = dev_i8254x_init(vm,card->dev_name,0,
500 card->pci_bus,1,
501 c7200_net_irq_for_slot_port(slot,1));
502
503 /* Port e0/0 is on PCI Device 0 */
504 data->port[1] = dev_i8254x_init(vm,card->dev_name,0,
505 card->pci_bus,0,
506 c7200_net_irq_for_slot_port(slot,0));
507
508 /* Store device info into the router structure */
509 card->drv_info = data;
510 return(0);
511 }
512
513 /* C7200-IO-GE-E driver */
514 struct cisco_card_driver dev_c7200_iocard_ge_e_driver = {
515 "C7200-IO-GE-E", 0, 0,
516 dev_c7200_iocard_ge_e_init,
517 dev_c7200_pa_i8254x_shutdown,
518 NULL,
519 dev_c7200_pa_i8254x_set_nio,
520 dev_c7200_pa_i8254x_unset_nio,
521 NULL,
522 };
523
524 /* ====================================================================== */
525 /* PA-4E / PA-8E */
526 /* ====================================================================== */
527
528 /* PA-4E/PA-8E data */
529 struct pa_4e8e_data {
530 u_int nr_port;
531 struct am79c971_data *port[8];
532 };
533
534 /*
535 * dev_c7200_pa_4e_init()
536 *
537 * Add a PA-4E port adapter into specified slot.
538 */
539 static int dev_c7200_pa_4e_init(vm_instance_t *vm,struct cisco_card *card)
540 {
541 struct pa_4e8e_data *data;
542 u_int slot = card->slot_id;
543 int i;
544
545 /* Allocate the private data structure for the PA-4E */
546 if (!(data = malloc(sizeof(*data)))) {
547 vm_error(vm,"%s: out of memory\n",card->dev_name);
548 return(-1);
549 }
550
551 /* 4 Ethernet ports */
552 memset(data,0,sizeof(*data));
553 data->nr_port = 4;
554
555 /* Set the PCI bus */
556 card->pci_bus = vm->slots_pci_bus[slot];
557
558 /* Set the EEPROM */
559 cisco_card_set_eeprom(vm,card,cisco_eeprom_find_pa("PA-4E"));
560 c7200_set_slot_eeprom(VM_C7200(vm),slot,&card->eeprom);
561
562 /* Create the AMD Am79c971 chips */
563 for(i=0;i<data->nr_port;i++) {
564 data->port[i] = dev_am79c971_init(vm,card->dev_name,
565 AM79C971_TYPE_10BASE_T,
566 card->pci_bus,i,
567 c7200_net_irq_for_slot_port(slot,i));
568 }
569
570 /* Store device info into the router structure */
571 card->drv_info = data;
572 return(0);
573 }
574
575 /*
576 * dev_c7200_pa_8e_init()
577 *
578 * Add a PA-8E port adapter into specified slot.
579 */
580 static int dev_c7200_pa_8e_init(vm_instance_t *vm,struct cisco_card *card)
581 {
582 struct pa_4e8e_data *data;
583 u_int slot = card->slot_id;
584 int i;
585
586 /* Allocate the private data structure for the PA-8E */
587 if (!(data = malloc(sizeof(*data)))) {
588 vm_error(vm,"%s: out of memory\n",card->dev_name);
589 return(-1);
590 }
591
592 /* 4 Ethernet ports */
593 memset(data,0,sizeof(*data));
594 data->nr_port = 8;
595
596 /* Set the PCI bus */
597 card->pci_bus = vm->slots_pci_bus[slot];
598
599 /* Set the EEPROM */
600 cisco_card_set_eeprom(vm,card,cisco_eeprom_find_pa("PA-8E"));
601 c7200_set_slot_eeprom(VM_C7200(vm),slot,&card->eeprom);
602
603 /* Create the AMD Am79c971 chips */
604 for(i=0;i<data->nr_port;i++) {
605 data->port[i] = dev_am79c971_init(vm,card->dev_name,
606 AM79C971_TYPE_10BASE_T,
607 card->pci_bus,i,
608 c7200_net_irq_for_slot_port(slot,i));
609 }
610
611 /* Store device info into the router structure */
612 card->drv_info = data;
613 return(0);
614 }
615
616 /* Remove a PA-4E/PA-8E from the specified slot */
617 static int
618 dev_c7200_pa_4e8e_shutdown(vm_instance_t *vm,struct cisco_card *card)
619 {
620 struct pa_4e8e_data *data = card->drv_info;
621 int i;
622
623 /* Remove the PA EEPROM */
624 cisco_card_unset_eeprom(card);
625 c7200_set_slot_eeprom(VM_C7200(vm),card->slot_id,NULL);
626
627 /* Remove the AMD Am79c971 chips */
628 for(i=0;i<data->nr_port;i++)
629 dev_am79c971_remove(data->port[i]);
630
631 free(data);
632 return(0);
633 }
634
635 /* Bind a Network IO descriptor */
636 static int
637 dev_c7200_pa_4e8e_set_nio(vm_instance_t *vm,struct cisco_card *card,
638 u_int port_id,netio_desc_t *nio)
639 {
640 struct pa_4e8e_data *d = card->drv_info;
641
642 if (!d || (port_id >= d->nr_port))
643 return(-1);
644
645 dev_am79c971_set_nio(d->port[port_id],nio);
646 return(0);
647 }
648
649 /* Unbind a Network IO descriptor */
650 static int
651 dev_c7200_pa_4e8e_unset_nio(vm_instance_t *vm,struct cisco_card *card,
652 u_int port_id)
653 {
654 struct pa_4e8e_data *d = card->drv_info;
655
656 if (!d || (port_id >= d->nr_port))
657 return(-1);
658
659 dev_am79c971_unset_nio(d->port[port_id]);
660 return(0);
661 }
662
663 /* PA-4E driver */
664 struct cisco_card_driver dev_c7200_pa_4e_driver = {
665 "PA-4E", 1, 0,
666 dev_c7200_pa_4e_init,
667 dev_c7200_pa_4e8e_shutdown,
668 NULL,
669 dev_c7200_pa_4e8e_set_nio,
670 dev_c7200_pa_4e8e_unset_nio,
671 NULL,
672 };
673
674 /* PA-8E driver */
675 struct cisco_card_driver dev_c7200_pa_8e_driver = {
676 "PA-8E", 1, 0,
677 dev_c7200_pa_8e_init,
678 dev_c7200_pa_4e8e_shutdown,
679 NULL,
680 dev_c7200_pa_4e8e_set_nio,
681 dev_c7200_pa_4e8e_unset_nio,
682 NULL,
683 };

  ViewVC Help
Powered by ViewVC 1.1.26