diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/atm/solos-pci.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/atm/solos-pci.c')
-rw-r--r-- | drivers/atm/solos-pci.c | 63 |
1 files changed, 27 insertions, 36 deletions
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index f46138ab38b6..5d1d07645132 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c | |||
@@ -165,8 +165,7 @@ static uint32_t fpga_tx(struct solos_card *); | |||
165 | static irqreturn_t solos_irq(int irq, void *dev_id); | 165 | static irqreturn_t solos_irq(int irq, void *dev_id); |
166 | static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); | 166 | static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); |
167 | static int list_vccs(int vci); | 167 | static int list_vccs(int vci); |
168 | static void release_vccs(struct atm_dev *dev); | 168 | static int atm_init(struct solos_card *, struct device *); |
169 | static int atm_init(struct solos_card *); | ||
170 | static void atm_remove(struct solos_card *); | 169 | static void atm_remove(struct solos_card *); |
171 | static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); | 170 | static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); |
172 | static void solos_bh(unsigned long); | 171 | static void solos_bh(unsigned long); |
@@ -384,7 +383,6 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb | |||
384 | /* Anything but 'Showtime' is down */ | 383 | /* Anything but 'Showtime' is down */ |
385 | if (strcmp(state_str, "Showtime")) { | 384 | if (strcmp(state_str, "Showtime")) { |
386 | atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_LOST); | 385 | atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_LOST); |
387 | release_vccs(card->atmdev[port]); | ||
388 | dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str); | 386 | dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str); |
389 | return 0; | 387 | return 0; |
390 | } | 388 | } |
@@ -529,7 +527,6 @@ static int flash_upgrade(struct solos_card *card, int chip) | |||
529 | { | 527 | { |
530 | const struct firmware *fw; | 528 | const struct firmware *fw; |
531 | const char *fw_name; | 529 | const char *fw_name; |
532 | uint32_t data32 = 0; | ||
533 | int blocksize = 0; | 530 | int blocksize = 0; |
534 | int numblocks = 0; | 531 | int numblocks = 0; |
535 | int offset; | 532 | int offset; |
@@ -578,7 +575,7 @@ static int flash_upgrade(struct solos_card *card, int chip) | |||
578 | 575 | ||
579 | dev_info(&card->dev->dev, "Changing FPGA to Update mode\n"); | 576 | dev_info(&card->dev->dev, "Changing FPGA to Update mode\n"); |
580 | iowrite32(1, card->config_regs + FPGA_MODE); | 577 | iowrite32(1, card->config_regs + FPGA_MODE); |
581 | data32 = ioread32(card->config_regs + FPGA_MODE); | 578 | (void) ioread32(card->config_regs + FPGA_MODE); |
582 | 579 | ||
583 | /* Set mode to Chip Erase */ | 580 | /* Set mode to Chip Erase */ |
584 | if(chip == 0 || chip == 2) | 581 | if(chip == 0 || chip == 2) |
@@ -697,7 +694,7 @@ void solos_bh(unsigned long card_arg) | |||
697 | size); | 694 | size); |
698 | } | 695 | } |
699 | if (atmdebug) { | 696 | if (atmdebug) { |
700 | dev_info(&card->dev->dev, "Received: device %d\n", port); | 697 | dev_info(&card->dev->dev, "Received: port %d\n", port); |
701 | dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n", | 698 | dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n", |
702 | size, le16_to_cpu(header->vpi), | 699 | size, le16_to_cpu(header->vpi), |
703 | le16_to_cpu(header->vci)); | 700 | le16_to_cpu(header->vci)); |
@@ -710,8 +707,8 @@ void solos_bh(unsigned long card_arg) | |||
710 | le16_to_cpu(header->vci)); | 707 | le16_to_cpu(header->vci)); |
711 | if (!vcc) { | 708 | if (!vcc) { |
712 | if (net_ratelimit()) | 709 | if (net_ratelimit()) |
713 | dev_warn(&card->dev->dev, "Received packet for unknown VCI.VPI %d.%d on port %d\n", | 710 | dev_warn(&card->dev->dev, "Received packet for unknown VPI.VCI %d.%d on port %d\n", |
714 | le16_to_cpu(header->vci), le16_to_cpu(header->vpi), | 711 | le16_to_cpu(header->vpi), le16_to_cpu(header->vci), |
715 | port); | 712 | port); |
716 | continue; | 713 | continue; |
717 | } | 714 | } |
@@ -830,28 +827,6 @@ static int list_vccs(int vci) | |||
830 | return num_found; | 827 | return num_found; |
831 | } | 828 | } |
832 | 829 | ||
833 | static void release_vccs(struct atm_dev *dev) | ||
834 | { | ||
835 | int i; | ||
836 | |||
837 | write_lock_irq(&vcc_sklist_lock); | ||
838 | for (i = 0; i < VCC_HTABLE_SIZE; i++) { | ||
839 | struct hlist_head *head = &vcc_hash[i]; | ||
840 | struct hlist_node *node, *tmp; | ||
841 | struct sock *s; | ||
842 | struct atm_vcc *vcc; | ||
843 | |||
844 | sk_for_each_safe(s, node, tmp, head) { | ||
845 | vcc = atm_sk(s); | ||
846 | if (vcc->dev == dev) { | ||
847 | vcc_release_async(vcc, -EPIPE); | ||
848 | sk_del_node_init(s); | ||
849 | } | ||
850 | } | ||
851 | } | ||
852 | write_unlock_irq(&vcc_sklist_lock); | ||
853 | } | ||
854 | |||
855 | 830 | ||
856 | static int popen(struct atm_vcc *vcc) | 831 | static int popen(struct atm_vcc *vcc) |
857 | { | 832 | { |
@@ -866,8 +841,9 @@ static int popen(struct atm_vcc *vcc) | |||
866 | } | 841 | } |
867 | 842 | ||
868 | skb = alloc_skb(sizeof(*header), GFP_ATOMIC); | 843 | skb = alloc_skb(sizeof(*header), GFP_ATOMIC); |
869 | if (!skb && net_ratelimit()) { | 844 | if (!skb) { |
870 | dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n"); | 845 | if (net_ratelimit()) |
846 | dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n"); | ||
871 | return -ENOMEM; | 847 | return -ENOMEM; |
872 | } | 848 | } |
873 | header = (void *)skb_put(skb, sizeof(*header)); | 849 | header = (void *)skb_put(skb, sizeof(*header)); |
@@ -1017,8 +993,15 @@ static uint32_t fpga_tx(struct solos_card *card) | |||
1017 | 993 | ||
1018 | /* Clean up and free oldskb now it's gone */ | 994 | /* Clean up and free oldskb now it's gone */ |
1019 | if (atmdebug) { | 995 | if (atmdebug) { |
996 | struct pkt_hdr *header = (void *)oldskb->data; | ||
997 | int size = le16_to_cpu(header->size); | ||
998 | |||
999 | skb_pull(oldskb, sizeof(*header)); | ||
1020 | dev_info(&card->dev->dev, "Transmitted: port %d\n", | 1000 | dev_info(&card->dev->dev, "Transmitted: port %d\n", |
1021 | port); | 1001 | port); |
1002 | dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n", | ||
1003 | size, le16_to_cpu(header->vpi), | ||
1004 | le16_to_cpu(header->vci)); | ||
1022 | print_buffer(oldskb); | 1005 | print_buffer(oldskb); |
1023 | } | 1006 | } |
1024 | 1007 | ||
@@ -1161,6 +1144,14 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1161 | dev_info(&dev->dev, "Solos FPGA Version %d.%02d svn-%d\n", | 1144 | dev_info(&dev->dev, "Solos FPGA Version %d.%02d svn-%d\n", |
1162 | major_ver, minor_ver, fpga_ver); | 1145 | major_ver, minor_ver, fpga_ver); |
1163 | 1146 | ||
1147 | if (fpga_ver < 37 && (fpga_upgrade || firmware_upgrade || | ||
1148 | db_fpga_upgrade || db_firmware_upgrade)) { | ||
1149 | dev_warn(&dev->dev, | ||
1150 | "FPGA too old; cannot upgrade flash. Use JTAG.\n"); | ||
1151 | fpga_upgrade = firmware_upgrade = 0; | ||
1152 | db_fpga_upgrade = db_firmware_upgrade = 0; | ||
1153 | } | ||
1154 | |||
1164 | if (card->fpga_version >= DMA_SUPPORTED){ | 1155 | if (card->fpga_version >= DMA_SUPPORTED){ |
1165 | card->using_dma = 1; | 1156 | card->using_dma = 1; |
1166 | } else { | 1157 | } else { |
@@ -1202,7 +1193,7 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1202 | if (db_firmware_upgrade) | 1193 | if (db_firmware_upgrade) |
1203 | flash_upgrade(card, 3); | 1194 | flash_upgrade(card, 3); |
1204 | 1195 | ||
1205 | err = atm_init(card); | 1196 | err = atm_init(card, &dev->dev); |
1206 | if (err) | 1197 | if (err) |
1207 | goto out_free_irq; | 1198 | goto out_free_irq; |
1208 | 1199 | ||
@@ -1225,7 +1216,7 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1225 | return err; | 1216 | return err; |
1226 | } | 1217 | } |
1227 | 1218 | ||
1228 | static int atm_init(struct solos_card *card) | 1219 | static int atm_init(struct solos_card *card, struct device *parent) |
1229 | { | 1220 | { |
1230 | int i; | 1221 | int i; |
1231 | 1222 | ||
@@ -1236,7 +1227,7 @@ static int atm_init(struct solos_card *card) | |||
1236 | skb_queue_head_init(&card->tx_queue[i]); | 1227 | skb_queue_head_init(&card->tx_queue[i]); |
1237 | skb_queue_head_init(&card->cli_queue[i]); | 1228 | skb_queue_head_init(&card->cli_queue[i]); |
1238 | 1229 | ||
1239 | card->atmdev[i] = atm_dev_register("solos-pci", &fpga_ops, -1, NULL); | 1230 | card->atmdev[i] = atm_dev_register("solos-pci", parent, &fpga_ops, -1, NULL); |
1240 | if (!card->atmdev[i]) { | 1231 | if (!card->atmdev[i]) { |
1241 | dev_err(&card->dev->dev, "Could not register ATM device %d\n", i); | 1232 | dev_err(&card->dev->dev, "Could not register ATM device %d\n", i); |
1242 | atm_remove(card); | 1233 | atm_remove(card); |
@@ -1253,7 +1244,7 @@ static int atm_init(struct solos_card *card) | |||
1253 | card->atmdev[i]->ci_range.vci_bits = 16; | 1244 | card->atmdev[i]->ci_range.vci_bits = 16; |
1254 | card->atmdev[i]->dev_data = card; | 1245 | card->atmdev[i]->dev_data = card; |
1255 | card->atmdev[i]->phy_data = (void *)(unsigned long)i; | 1246 | card->atmdev[i]->phy_data = (void *)(unsigned long)i; |
1256 | atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_UNKNOWN); | 1247 | atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_FOUND); |
1257 | 1248 | ||
1258 | skb = alloc_skb(sizeof(*header), GFP_ATOMIC); | 1249 | skb = alloc_skb(sizeof(*header), GFP_ATOMIC); |
1259 | if (!skb) { | 1250 | if (!skb) { |