/* * dev_c2691_nm_eth_init() * * Add an Ethernet Network Module into specified slot. */ static int dev_c2691_nm_eth_init(vm_instance_t *vm,struct cisco_card *card, int nr_port,int interface_type, const struct cisco_eeprom *eeprom) { struct nm_eth_data *data; u_int slot = card->slot_id; int i; /* Allocate the private data structure */ if (!(data = malloc(sizeof(*data)))) { vm_error(vm,"%s: out of memory.\n",card->dev_name); return(-1); } memset(data,0,sizeof(*data)); data->nr_port = nr_port; /* Set the PCI bus */ card->pci_bus = vm->slots_pci_bus[slot]; /* Set the EEPROM */ cisco_card_set_eeprom(vm,card,eeprom); c2691_set_slot_eeprom(VM_C2691(vm),slot,&card->eeprom); /* Create the AMD Am971c971 chip(s) */ for(i=0;i<data->nr_port;i++) { data->port[i] = dev_am79c971_init(vm,card->dev_name,interface_type, card->pci_bus,6+i, c2691_net_irq_for_slot_port(slot,i)); } /* Store device info into the router structure */ card->drv_info = data; return(0); }
/* * dev_c7200_pa_8e_init() * * Add a PA-8E port adapter into specified slot. */ static int dev_c7200_pa_8e_init(vm_instance_t *vm,struct cisco_card *card) { struct pa_4e8e_data *data; u_int slot = card->slot_id; int i; /* Allocate the private data structure for the PA-8E */ if (!(data = malloc(sizeof(*data)))) { vm_error(vm,"%s: out of memory\n",card->dev_name); return(-1); } /* 4 Ethernet ports */ memset(data,0,sizeof(*data)); data->nr_port = 8; /* Set the PCI bus */ card->pci_bus = vm->slots_pci_bus[slot]; /* Set the EEPROM */ cisco_card_set_eeprom(vm,card,cisco_eeprom_find_pa("PA-8E")); c7200_set_slot_eeprom(VM_C7200(vm),slot,&card->eeprom); /* Create the AMD Am79c971 chips */ for(i=0;i<data->nr_port;i++) { data->port[i] = dev_am79c971_init(vm,card->dev_name, AM79C971_TYPE_10BASE_T, card->pci_bus,i, c7200_net_irq_for_slot_port(slot,i)); } /* Store device info into the router structure */ card->drv_info = data; return(0); }
/* * dev_c3600_nm_eth_init() * * Add an Ethernet Network Module into specified slot. */ static int dev_c3600_nm_eth_init(vm_instance_t *vm,struct cisco_card *card, int nr_port,int interface_type, const struct cisco_eeprom *eeprom) { struct nm_bay_info *bay_info; struct nm_eth_data *data; u_int slot = card->slot_id; u_int chassis_id; int i; /* Allocate the private data structure */ if (!(data = malloc(sizeof(*data)))) { vm_error(vm,"%s: out of memory.\n",card->dev_name); return(-1); } memset(data,0,sizeof(*data)); data->nr_port = nr_port; /* Set the PCI bus */ card->pci_bus = vm->slots_pci_bus[slot]; /* Set the EEPROM */ cisco_card_set_eeprom(vm,card,eeprom); c3600_set_slot_eeprom(VM_C3600(vm),slot,&card->eeprom); /* Get PCI bus info about this bay */ chassis_id = c3600_chassis_get_id(VM_C3600(vm)); bay_info = c3600_nm_get_bay_info(chassis_id,slot); if (!bay_info) { vm_error(vm,"unable to get info for NM bay %u\n",slot); return(-1); } /* Create the AMD Am971c971 chip(s) */ for(i=0;i<data->nr_port;i++) { data->port[i] = dev_am79c971_init(vm,card->dev_name,interface_type, card->pci_bus,bay_info->pci_device+i, c3600_net_irq_for_slot_port(slot,i)); } /* Store device info into the router structure */ card->drv_info = data; return(0); }