Lines Matching +full:pci +full:- +full:host +full:- +full:cam +full:- +full:generic

13  *   FDDI TURBOchannel, EISA and PCI controller families.  Supported
18 * DEC FDDIcontroller/PCI (DEFPA)
24 * macro Maciej W. Rozycki <macro@linux-mips.org>
40 * Adapter Probe -
45 * Bus-Specific Initialization -
46 * This driver currently supports both EISA and PCI controller
49 * initialization, the only bus-specific differences is in how the
51 * run-time critical code behaves the same on both families.
55 * Driver Open/Close -
67 * Driver Shutdown -
73 * to ensure that the adapter DMA engine is taken off-line. However,
79 * Interrupt Service Routine -
85 * Interrupt enabling/disabling can occur at many levels. At the host
87 * PIC (on Intel systems). Across the bus, both EISA and PCI adapters
88 * have a bus-logic chip interrupt enable/disable as well as a DMA
92 * bus-logic chip and assumes that Linux will take care of clearing or
93 * acknowledging any host-based interrupt chips.
95 * Control Functions -
103 * - Custom ioctl interface for executing port interface commands
104 * - Custom ioctl interface for adding unicast addresses to
105 * adapter CAM (to support bridge functions).
106 * - Custom ioctl interface for supporting firmware upgrades.
108 * Hardware (port interface) Support Routines -
110 * low-level port interface routines that are called frequently. They
113 * driver initialization and run-time code must make calls into the
114 * port interface, these routines were written to be as generic and
117 * Receive Path -
127 * single-fragment receive buffers of 4608 bytes, then allocates a
134 * Transmit Path -
142 * Before posting the buffer to the adapter, the driver sets a three-byte
153 * bytes available before the skb->data field on the outgoing transmit
155 * dev->hard_header_len to 24 bytes. 21 bytes accounts for the largest
163 * or DMAing directly from the FC byte which starts at skb->data. Should
165 * module should be updated and dev->hard_header_len should be increased.
167 * dev->hard_header_len should always be evenly divisible by 4 and at
172 * 16-Aug-96 LVS Created.
173 * 20-Aug-96 LVS Updated dfx_probe so that version information
178 * 09-Sep-96 LVS Updated dfx_ctl_set_multicast_list to enable
185 * 12-Sep-96 LVS Reset current address to factory address during
187 * single fragment which includes PRH->end of data.
189 * Jun 2000 jgarzik PCI and resource alloc cleanups
193 * Feb 2001 davej PCI enable cleanups.
197 * 23 Oct 2006 macro Big-endian host support.
199 * 01 Jul 2014 macro Fixes for DMA on 64-bit hosts.
206 #include <linux/dma-mapping.h>
215 #include <linux/pci.h>
245 #define DFX_BUS_EISA(dev) (dev->bus == &eisa_bus_type)
251 #define DFX_BUS_TC(dev) (dev->bus == &tc_bus_type)
262 /* Define module-wide (static) routines */
306 /* Define module-wide (static) variables */
326 * bp - pointer to board information
327 * offset - register offset from base I/O address
328 * data - for dfx_port_write_long, this is a value to write;
340 * This port block can be used to access PDQ, ESIC, and DEFEA on-board
343 * PCI port block base addresses are assigned by the PCI BIOS or system
352 * bp->base is a valid base I/O address for this adapter.
365 writel(data, bp->base.mem + offset); in dfx_writel()
371 outl(data, bp->base.port + offset); in dfx_outl()
376 struct device __maybe_unused *bdev = bp->bus_dev; in dfx_port_write_long()
390 *data = readl(bp->base.mem + offset); in dfx_readl()
395 *data = inl(bp->base.port + offset); in dfx_inl()
400 struct device __maybe_unused *bdev = bp->bus_dev; in dfx_port_read_long()
424 * bdev - pointer to device information
425 * bar_start - pointer to store the start addresses
426 * bar_len - pointer to store the lengths of the areas
451 unsigned long base_addr = to_eisa_device(bdev)->base_addr; in dfx_get_bars()
469 bar_len[0] = ((bar_hi - bar_lo) | PI_MEM_ADD_MASK_M) + in dfx_get_bars()
481 bar_start[0] = to_tc_dev(bdev)->resource.start + in dfx_get_bars()
510 * bdev - pointer to device information
515 * 0 - This device (fddi0, fddi1, etc) configured successfully
516 * -EBUSY - Failed to get resources, or dfx_driver_init failed.
519 * It compiles so it should work :-( (PCI cards do :-)
551 return -ENOMEM; in dfx_register()
554 /* Enable PCI device. */ in dfx_register()
558 pr_err("%s: Cannot enable PCI device, aborting\n", in dfx_register()
567 bp->bus_dev = bdev; in dfx_register()
578 err = -ENXIO; in dfx_register()
591 err = -EBUSY; in dfx_register()
600 err = -EBUSY; in dfx_register()
610 err = -EBUSY; in dfx_register()
617 bp->base.mem = ioremap(bar_start[0], bar_len[0]); in dfx_register()
618 if (!bp->base.mem) { in dfx_register()
620 err = -ENOMEM; in dfx_register()
624 bp->base.port = bar_start[0]; in dfx_register()
625 dev->base_addr = bar_start[0]; in dfx_register()
629 dev->netdev_ops = &dfx_netdev_ops; in dfx_register()
635 err = -ENODEV; in dfx_register()
643 printk("%s: registered as %s\n", print_name, dev->name); in dfx_register()
650 (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX) + in dfx_register()
653 (PI_ALIGN_K_DESC_BLK - 1); in dfx_register()
654 if (bp->kmalloced) in dfx_register()
656 bp->kmalloced, bp->kmalloced_dma); in dfx_register()
660 iounmap(bp->base.mem); in dfx_register()
692 * Initializes the bus-specific controller logic.
698 * dev - pointer to device information
702 * then perform bus-specific logic initialization.
708 * bp->base has already been set with the proper
712 * Interrupts are enabled at the adapter bus-specific logic.
720 struct device *bdev = bp->bus_dev; in dfx_bus_init()
730 bp->dev = dev; in dfx_bus_init()
735 dev->irq = to_tc_dev(bdev)->interrupt; in dfx_bus_init()
737 unsigned long base_addr = to_eisa_device(bdev)->base_addr; in dfx_bus_init()
749 dev->irq = 9; in dfx_bus_init()
753 dev->irq = 10; in dfx_bus_init()
757 dev->irq = 11; in dfx_bus_init()
761 dev->irq = 15; in dfx_bus_init()
769 * taking 16 32-bit words, while IOCS1 is used for the in dfx_bus_init()
770 * Burst Holdoff register, taking a single 32-bit word in dfx_bus_init()
771 * only. We use the slot-specific I/O range as per the in dfx_bus_init()
784 val = (PI_ESIC_K_CSR_IO_LEN - 1) & ~3; in dfx_bus_init()
794 val = (PI_ESIC_K_BURST_HOLDOFF_LEN - 1) & ~3; in dfx_bus_init()
831 /* Get the interrupt level from the PCI Configuration Table */ in dfx_bus_init()
833 dev->irq = pdev->irq; in dfx_bus_init()
843 /* Enable interrupts at PCI bus interface chip (PFI) */ in dfx_bus_init()
855 * Uninitializes the bus-specific controller logic.
861 * dev - pointer to device information
864 * Perform bus-specific logic uninitialization.
870 * bp->base has already been set with the proper
874 * Interrupts are disabled at the adapter bus-specific logic.
880 struct device *bdev = bp->bus_dev; in dfx_bus_uninit()
890 unsigned long base_addr = to_eisa_device(bdev)->base_addr; in dfx_bus_uninit()
904 /* Disable interrupts at PCI bus interface chip (PFI) */ in dfx_bus_uninit()
916 * Checks the configuration (burst size, full-duplex, etc.) If any parameters
923 * bp - pointer to board information
927 * PDQ, and all FDDI PCI controllers, all values are legal.
942 struct device __maybe_unused *bdev = bp->bus_dev; in dfx_bus_config_check()
959 if (to_eisa_device(bdev)->id.driver_data == DEFEA_PROD_ID_2) { in dfx_bus_config_check()
979 switch (bp->burst_size) in dfx_bus_config_check()
983 bp->burst_size = PI_PDATA_B_DMA_BURST_SIZE_8; in dfx_bus_config_check()
990 /* Ensure that full-duplex mode is not enabled */ in dfx_bus_config_check()
992 bp->full_duplex_enb = PI_SNMP_K_FALSE; in dfx_bus_config_check()
1012 * dev - pointer to device information
1013 * print_name - printable device name
1016 * This function allocates additional resources such as the host memory
1020 * must call dfx_open() to open the adapter and bring it on-line.
1023 * DFX_K_SUCCESS - initialization succeeded
1024 * DFX_K_FAILURE - initialization failed - could not allocate memory
1040 struct device *bdev = bp->bus_dev; in dfx_driver_init()
1048 u32 data; /* host data register value */ in dfx_driver_init()
1054 /* Initialize bus-specific hardware registers */ in dfx_driver_init()
1067 bp->full_duplex_enb = PI_SNMP_K_FALSE; in dfx_driver_init()
1068 bp->req_ttrt = 8 * 12500; /* 8ms in 80 nanosec units */ in dfx_driver_init()
1069 bp->burst_size = PI_PDATA_B_DMA_BURST_SIZE_DEF; in dfx_driver_init()
1070 bp->rcv_bufs_to_post = RCV_BUFS_DEF; in dfx_driver_init()
1100 memcpy(&bp->factory_mac_addr[0], &le32, sizeof(u32)); in dfx_driver_init()
1109 memcpy(&bp->factory_mac_addr[4], &le32, sizeof(u16)); in dfx_driver_init()
1118 memcpy(dev->dev_addr, bp->factory_mac_addr, FDDI_K_ALEN); in dfx_driver_init()
1127 (long long)bar_start, dev->irq, dev->dev_addr); in dfx_driver_init()
1138 (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX) + in dfx_driver_init()
1141 (PI_ALIGN_K_DESC_BLK - 1); in dfx_driver_init()
1142 bp->kmalloced = top_v = dma_alloc_coherent(bp->bus_dev, alloc_size, in dfx_driver_init()
1143 &bp->kmalloced_dma, in dfx_driver_init()
1148 top_p = bp->kmalloced_dma; /* get physical address of buffer */ in dfx_driver_init()
1151 * To guarantee the 8K alignment required for the descriptor block, 8K - 1 in dfx_driver_init()
1156 * Note: If the assumptions change regarding the non-paged, non-cached, in dfx_driver_init()
1163 curr_v = top_v + (curr_p - top_p); in dfx_driver_init()
1167 bp->descr_block_virt = (PI_DESCR_BLOCK *) curr_v; in dfx_driver_init()
1168 bp->descr_block_phys = curr_p; in dfx_driver_init()
1174 bp->cmd_req_virt = (PI_DMA_CMD_REQ *) curr_v; in dfx_driver_init()
1175 bp->cmd_req_phys = curr_p; in dfx_driver_init()
1181 bp->cmd_rsp_virt = (PI_DMA_CMD_RSP *) curr_v; in dfx_driver_init()
1182 bp->cmd_rsp_phys = curr_p; in dfx_driver_init()
1186 /* Reserve space for the LLC host receive queue buffers */ in dfx_driver_init()
1188 bp->rcv_block_virt = curr_v; in dfx_driver_init()
1189 bp->rcv_block_phys = curr_p; in dfx_driver_init()
1192 curr_v += (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX); in dfx_driver_init()
1193 curr_p += (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX); in dfx_driver_init()
1198 bp->cons_block_virt = (PI_CONSUMER_BLOCK *) curr_v; in dfx_driver_init()
1199 bp->cons_block_phys = curr_p; in dfx_driver_init()
1204 print_name, bp->descr_block_virt, &bp->descr_block_phys); in dfx_driver_init()
1206 print_name, bp->cmd_req_virt, &bp->cmd_req_phys); in dfx_driver_init()
1208 print_name, bp->cmd_rsp_virt, &bp->cmd_rsp_phys); in dfx_driver_init()
1210 print_name, bp->rcv_block_virt, &bp->rcv_block_phys); in dfx_driver_init()
1212 print_name, bp->cons_block_virt, &bp->cons_block_phys); in dfx_driver_init()
1230 * bp - pointer to board information
1231 * get_buffers - non-zero if buffers to be allocated
1234 * Issues the low-level firmware/hardware calls necessary to bring
1236 * run-time.
1239 * DFX_K_SUCCESS - Adapter brought up successfully
1240 * DFX_K_FAILURE - Adapter initialization failed
1243 * bp->reset_type should be set to a valid reset type value before
1261 if (dfx_hw_dma_uninit(bp, bp->reset_type) != DFX_K_SUCCESS) in dfx_adap_init()
1263 printk("%s: Could not uninitialize/reset adapter!\n", bp->dev->name); in dfx_adap_init()
1277 * Note: We only need to clear host copies of these registers. The PDQ reset in dfx_adap_init()
1278 * takes care of the on-board register values. in dfx_adap_init()
1281 bp->cmd_req_reg.lword = 0; in dfx_adap_init()
1282 bp->cmd_rsp_reg.lword = 0; in dfx_adap_init()
1283 bp->rcv_xmt_reg.lword = 0; in dfx_adap_init()
1287 memset(bp->cons_block_virt, 0, sizeof(PI_CONSUMER_BLOCK)); in dfx_adap_init()
1294 bp->burst_size, in dfx_adap_init()
1297 printk("%s: Could not set adapter burst size!\n", bp->dev->name); in dfx_adap_init()
1304 * Assumption: 32-bit physical address of consumer block is 64 byte in dfx_adap_init()
1305 * aligned. That is, bits 0-5 of the address must be zero. in dfx_adap_init()
1310 bp->cons_block_phys, in dfx_adap_init()
1314 printk("%s: Could not set consumer block address!\n", bp->dev->name); in dfx_adap_init()
1325 * Assumption: 32-bit physical address of descriptor block in dfx_adap_init()
1329 (u32)(bp->descr_block_phys | in dfx_adap_init()
1333 bp->dev->name); in dfx_adap_init()
1339 bp->cmd_req_virt->cmd_type = PI_CMD_K_CHARS_SET; in dfx_adap_init()
1340 bp->cmd_req_virt->char_set.item[0].item_code = PI_ITEM_K_FLUSH_TIME; in dfx_adap_init()
1341 bp->cmd_req_virt->char_set.item[0].value = 3; /* 3 seconds */ in dfx_adap_init()
1342 bp->cmd_req_virt->char_set.item[0].item_index = 0; in dfx_adap_init()
1343 bp->cmd_req_virt->char_set.item[1].item_code = PI_ITEM_K_EOL; in dfx_adap_init()
1346 printk("%s: DMA command request failed!\n", bp->dev->name); in dfx_adap_init()
1352 bp->cmd_req_virt->cmd_type = PI_CMD_K_SNMP_SET; in dfx_adap_init()
1353 bp->cmd_req_virt->snmp_set.item[0].item_code = PI_ITEM_K_FDX_ENB_DIS; in dfx_adap_init()
1354 bp->cmd_req_virt->snmp_set.item[0].value = bp->full_duplex_enb; in dfx_adap_init()
1355 bp->cmd_req_virt->snmp_set.item[0].item_index = 0; in dfx_adap_init()
1356 bp->cmd_req_virt->snmp_set.item[1].item_code = PI_ITEM_K_MAC_T_REQ; in dfx_adap_init()
1357 bp->cmd_req_virt->snmp_set.item[1].value = bp->req_ttrt; in dfx_adap_init()
1358 bp->cmd_req_virt->snmp_set.item[1].item_index = 0; in dfx_adap_init()
1359 bp->cmd_req_virt->snmp_set.item[2].item_code = PI_ITEM_K_EOL; in dfx_adap_init()
1362 printk("%s: DMA command request failed!\n", bp->dev->name); in dfx_adap_init()
1366 /* Initialize adapter CAM */ in dfx_adap_init()
1370 printk("%s: Adapter CAM update failed!\n", bp->dev->name); in dfx_adap_init()
1378 printk("%s: Adapter filters update failed!\n", bp->dev->name); in dfx_adap_init()
1394 printk("%s: Receive buffer allocation failed\n", bp->dev->name); in dfx_adap_init()
1402 bp->cmd_req_virt->cmd_type = PI_CMD_K_START; in dfx_adap_init()
1405 printk("%s: Start command failed\n", bp->dev->name); in dfx_adap_init()
1430 * dev - pointer to device information
1436 * 0 - Adapter was successfully opened
1437 * -EAGAIN - Could not register IRQ or adapter initialization failed
1455 /* Register IRQ - support shared interrupts by passing device ptr */ in dfx_open()
1457 ret = request_irq(dev->irq, dfx_interrupt, IRQF_SHARED, dev->name, in dfx_open()
1460 printk(KERN_ERR "%s: Requested IRQ %d is busy\n", dev->name, dev->irq); in dfx_open()
1475 memcpy(dev->dev_addr, bp->factory_mac_addr, FDDI_K_ALEN); in dfx_open()
1479 memset(bp->uc_table, 0, sizeof(bp->uc_table)); in dfx_open()
1480 memset(bp->mc_table, 0, sizeof(bp->mc_table)); in dfx_open()
1481 bp->uc_count = 0; in dfx_open()
1482 bp->mc_count = 0; in dfx_open()
1486 bp->ind_group_prom = PI_FSTATE_K_BLOCK; in dfx_open()
1487 bp->group_prom = PI_FSTATE_K_BLOCK; in dfx_open()
1489 spin_lock_init(&bp->lock); in dfx_open()
1493 bp->reset_type = PI_PDATA_A_RESET_M_SKIP_ST; /* skip self-test */ in dfx_open()
1496 printk(KERN_ERR "%s: Adapter open failed!\n", dev->name); in dfx_open()
1497 free_irq(dev->irq, dev); in dfx_open()
1498 return -EAGAIN; in dfx_open()
1519 * dev - pointer to device information
1575 bp->cmd_req_reg.lword = 0; in dfx_close()
1576 bp->cmd_rsp_reg.lword = 0; in dfx_close()
1577 bp->rcv_xmt_reg.lword = 0; in dfx_close()
1581 memset(bp->cons_block_virt, 0, sizeof(PI_CONSUMER_BLOCK)); in dfx_close()
1593 free_irq(dev->irq, dev); in dfx_close()
1611 * bp - pointer to board information
1641 printk("%s: Halt ID: Selftest Timeout\n", bp->dev->name); in dfx_int_pr_halt_id()
1645 printk("%s: Halt ID: Host Bus Parity Error\n", bp->dev->name); in dfx_int_pr_halt_id()
1649 printk("%s: Halt ID: Host-Directed Halt\n", bp->dev->name); in dfx_int_pr_halt_id()
1653 printk("%s: Halt ID: Adapter Software Fault\n", bp->dev->name); in dfx_int_pr_halt_id()
1657 printk("%s: Halt ID: Adapter Hardware Fault\n", bp->dev->name); in dfx_int_pr_halt_id()
1661 printk("%s: Halt ID: FDDI Network PC Trace Path Test\n", bp->dev->name); in dfx_int_pr_halt_id()
1665 printk("%s: Halt ID: Adapter DMA Error\n", bp->dev->name); in dfx_int_pr_halt_id()
1669 printk("%s: Halt ID: Firmware Image CRC Error\n", bp->dev->name); in dfx_int_pr_halt_id()
1673 printk("%s: Halt ID: 68000 Bus Exception\n", bp->dev->name); in dfx_int_pr_halt_id()
1677 printk("%s: Halt ID: Unknown (code = %X)\n", bp->dev->name, halt_id); in dfx_int_pr_halt_id()
1695 * bp - pointer to board information
1726 * is responsible for reinitializing the adapter with the current CAM
1733 PI_UINT32 type_0_status; /* Host Interrupt Type 0 register */ in dfx_int_type_0_process()
1737 * Read host interrupt Type 0 register to determine which Type 0 in dfx_int_type_0_process()
1751 /* Check for Non-Existent Memory error */ in dfx_int_type_0_process()
1754 printk("%s: Non-Existent Memory Access Error\n", bp->dev->name); in dfx_int_type_0_process()
1759 printk("%s: Packet Memory Parity Error\n", bp->dev->name); in dfx_int_type_0_process()
1761 /* Check for Host Bus Parity error */ in dfx_int_type_0_process()
1764 printk("%s: Host Bus Parity Error\n", bp->dev->name); in dfx_int_type_0_process()
1766 /* Reset adapter and bring it back on-line */ in dfx_int_type_0_process()
1768 bp->link_available = PI_K_FALSE; /* link is no longer available */ in dfx_int_type_0_process()
1769 bp->reset_type = 0; /* rerun on-board diagnostics */ in dfx_int_type_0_process()
1770 printk("%s: Resetting adapter...\n", bp->dev->name); in dfx_int_type_0_process()
1773 printk("%s: Adapter reset failed! Disabling adapter interrupts.\n", bp->dev->name); in dfx_int_type_0_process()
1777 printk("%s: Adapter reset successful!\n", bp->dev->name); in dfx_int_type_0_process()
1787 bp->link_available = PI_K_FALSE; /* link is no longer available */ in dfx_int_type_0_process()
1807 * adapter to bring it back on-line. If reset fails, in dfx_int_type_0_process()
1811 printk("%s: Controller has transitioned to HALTED state!\n", bp->dev->name); in dfx_int_type_0_process()
1814 /* Reset adapter and bring it back on-line */ in dfx_int_type_0_process()
1816 bp->link_available = PI_K_FALSE; /* link is no longer available */ in dfx_int_type_0_process()
1817 bp->reset_type = 0; /* rerun on-board diagnostics */ in dfx_int_type_0_process()
1818 printk("%s: Resetting adapter...\n", bp->dev->name); in dfx_int_type_0_process()
1821 printk("%s: Adapter reset failed! Disabling adapter interrupts.\n", bp->dev->name); in dfx_int_type_0_process()
1825 printk("%s: Adapter reset successful!\n", bp->dev->name); in dfx_int_type_0_process()
1829 bp->link_available = PI_K_TRUE; /* set link available flag */ in dfx_int_type_0_process()
1847 * bp - pointer to board information
1880 /* Process xmt interrupts - frequent case, so always call this routine */ in dfx_int_common()
1885 /* Process rcv interrupts - frequent case, so always call this routine */ in dfx_int_common()
1896 dfx_port_write_long(bp, PI_PDQ_K_REG_TYPE_2_PROD, bp->rcv_xmt_reg.lword); in dfx_int_common()
1902 /* Process Type 0 interrupts (if any) - infrequent, so only call when needed */ in dfx_int_common()
1921 * irq - interrupt vector
1922 * dev_id - pointer to device information
1931 * IRQ_HANDLED - an IRQ was handled.
1932 * IRQ_NONE - no IRQ was handled.
1936 * on Intel-based systems) is done by the operating system outside this
1949 struct device *bdev = bp->bus_dev; in dfx_interrupt()
1963 spin_lock(&bp->lock); in dfx_interrupt()
1965 /* Disable PDQ-PFI interrupts at PFI */ in dfx_interrupt()
1979 spin_unlock(&bp->lock); in dfx_interrupt()
1982 unsigned long base_addr = to_eisa_device(bdev)->base_addr; in dfx_interrupt()
1989 spin_lock(&bp->lock); in dfx_interrupt()
2003 spin_unlock(&bp->lock); in dfx_interrupt()
2018 spin_lock(&bp->lock); in dfx_interrupt()
2023 spin_unlock(&bp->lock); in dfx_interrupt()
2042 * dev - pointer to device information
2051 * have an FDDI-specific get statistics handler,
2057 * decode the FDDI-specific statistics.
2077 /* Fill the bp->stats structure with driver-maintained counters */ in dfx_ctl_get_stats()
2079 bp->stats.gen.rx_packets = bp->rcv_total_frames; in dfx_ctl_get_stats()
2080 bp->stats.gen.tx_packets = bp->xmt_total_frames; in dfx_ctl_get_stats()
2081 bp->stats.gen.rx_bytes = bp->rcv_total_bytes; in dfx_ctl_get_stats()
2082 bp->stats.gen.tx_bytes = bp->xmt_total_bytes; in dfx_ctl_get_stats()
2083 bp->stats.gen.rx_errors = bp->rcv_crc_errors + in dfx_ctl_get_stats()
2084 bp->rcv_frame_status_errors + in dfx_ctl_get_stats()
2085 bp->rcv_length_errors; in dfx_ctl_get_stats()
2086 bp->stats.gen.tx_errors = bp->xmt_length_errors; in dfx_ctl_get_stats()
2087 bp->stats.gen.rx_dropped = bp->rcv_discards; in dfx_ctl_get_stats()
2088 bp->stats.gen.tx_dropped = bp->xmt_discards; in dfx_ctl_get_stats()
2089 bp->stats.gen.multicast = bp->rcv_multicast_frames; in dfx_ctl_get_stats()
2090 bp->stats.gen.collisions = 0; /* always zero (0) for FDDI */ in dfx_ctl_get_stats()
2094 bp->cmd_req_virt->cmd_type = PI_CMD_K_SMT_MIB_GET; in dfx_ctl_get_stats()
2096 return (struct net_device_stats *)&bp->stats; in dfx_ctl_get_stats()
2098 /* Fill the bp->stats structure with the SMT MIB object values */ in dfx_ctl_get_stats()
2100 …memcpy(bp->stats.smt_station_id, &bp->cmd_rsp_virt->smt_mib_get.smt_station_id, sizeof(bp->cmd_rsp… in dfx_ctl_get_stats()
2101 bp->stats.smt_op_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_op_version_id; in dfx_ctl_get_stats()
2102 bp->stats.smt_hi_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_hi_version_id; in dfx_ctl_get_stats()
2103 bp->stats.smt_lo_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_lo_version_id; in dfx_ctl_get_stats()
2104 …memcpy(bp->stats.smt_user_data, &bp->cmd_rsp_virt->smt_mib_get.smt_user_data, sizeof(bp->cmd_rsp_v… in dfx_ctl_get_stats()
2105 bp->stats.smt_mib_version_id = bp->cmd_rsp_virt->smt_mib_get.smt_mib_version_id; in dfx_ctl_get_stats()
2106 bp->stats.smt_mac_cts = bp->cmd_rsp_virt->smt_mib_get.smt_mac_ct; in dfx_ctl_get_stats()
2107 bp->stats.smt_non_master_cts = bp->cmd_rsp_virt->smt_mib_get.smt_non_master_ct; in dfx_ctl_get_stats()
2108 bp->stats.smt_master_cts = bp->cmd_rsp_virt->smt_mib_get.smt_master_ct; in dfx_ctl_get_stats()
2109 bp->stats.smt_available_paths = bp->cmd_rsp_virt->smt_mib_get.smt_available_paths; in dfx_ctl_get_stats()
2110 bp->stats.smt_config_capabilities = bp->cmd_rsp_virt->smt_mib_get.smt_config_capabilities; in dfx_ctl_get_stats()
2111 bp->stats.smt_config_policy = bp->cmd_rsp_virt->smt_mib_get.smt_config_policy; in dfx_ctl_get_stats()
2112 bp->stats.smt_connection_policy = bp->cmd_rsp_virt->smt_mib_get.smt_connection_policy; in dfx_ctl_get_stats()
2113 bp->stats.smt_t_notify = bp->cmd_rsp_virt->smt_mib_get.smt_t_notify; in dfx_ctl_get_stats()
2114 bp->stats.smt_stat_rpt_policy = bp->cmd_rsp_virt->smt_mib_get.smt_stat_rpt_policy; in dfx_ctl_get_stats()
2115 bp->stats.smt_trace_max_expiration = bp->cmd_rsp_virt->smt_mib_get.smt_trace_max_expiration; in dfx_ctl_get_stats()
2116 bp->stats.smt_bypass_present = bp->cmd_rsp_virt->smt_mib_get.smt_bypass_present; in dfx_ctl_get_stats()
2117 bp->stats.smt_ecm_state = bp->cmd_rsp_virt->smt_mib_get.smt_ecm_state; in dfx_ctl_get_stats()
2118 bp->stats.smt_cf_state = bp->cmd_rsp_virt->smt_mib_get.smt_cf_state; in dfx_ctl_get_stats()
2119 bp->stats.smt_remote_disconnect_flag = bp->cmd_rsp_virt->smt_mib_get.smt_remote_disconnect_flag; in dfx_ctl_get_stats()
2120 bp->stats.smt_station_status = bp->cmd_rsp_virt->smt_mib_get.smt_station_status; in dfx_ctl_get_stats()
2121 bp->stats.smt_peer_wrap_flag = bp->cmd_rsp_virt->smt_mib_get.smt_peer_wrap_flag; in dfx_ctl_get_stats()
2122 bp->stats.smt_time_stamp = bp->cmd_rsp_virt->smt_mib_get.smt_msg_time_stamp.ls; in dfx_ctl_get_stats()
2123 bp->stats.smt_transition_time_stamp = bp->cmd_rsp_virt->smt_mib_get.smt_transition_time_stamp.ls; in dfx_ctl_get_stats()
2124 bp->stats.mac_frame_status_functions = bp->cmd_rsp_virt->smt_mib_get.mac_frame_status_functions; in dfx_ctl_get_stats()
2125 bp->stats.mac_t_max_capability = bp->cmd_rsp_virt->smt_mib_get.mac_t_max_capability; in dfx_ctl_get_stats()
2126 bp->stats.mac_tvx_capability = bp->cmd_rsp_virt->smt_mib_get.mac_tvx_capability; in dfx_ctl_get_stats()
2127 bp->stats.mac_available_paths = bp->cmd_rsp_virt->smt_mib_get.mac_available_paths; in dfx_ctl_get_stats()
2128 bp->stats.mac_current_path = bp->cmd_rsp_virt->smt_mib_get.mac_current_path; in dfx_ctl_get_stats()
2129 memcpy(bp->stats.mac_upstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_upstream_nbr, FDDI_K_ALEN); in dfx_ctl_get_stats()
2130 …memcpy(bp->stats.mac_downstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_downstream_nbr, FDDI_K_ALE… in dfx_ctl_get_stats()
2131 …memcpy(bp->stats.mac_old_upstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_old_upstream_nbr, FDDI_K… in dfx_ctl_get_stats()
2132 …memcpy(bp->stats.mac_old_downstream_nbr, &bp->cmd_rsp_virt->smt_mib_get.mac_old_downstream_nbr, FD… in dfx_ctl_get_stats()
2133 bp->stats.mac_dup_address_test = bp->cmd_rsp_virt->smt_mib_get.mac_dup_address_test; in dfx_ctl_get_stats()
2134 bp->stats.mac_requested_paths = bp->cmd_rsp_virt->smt_mib_get.mac_requested_paths; in dfx_ctl_get_stats()
2135 bp->stats.mac_downstream_port_type = bp->cmd_rsp_virt->smt_mib_get.mac_downstream_port_type; in dfx_ctl_get_stats()
2136 memcpy(bp->stats.mac_smt_address, &bp->cmd_rsp_virt->smt_mib_get.mac_smt_address, FDDI_K_ALEN); in dfx_ctl_get_stats()
2137 bp->stats.mac_t_req = bp->cmd_rsp_virt->smt_mib_get.mac_t_req; in dfx_ctl_get_stats()
2138 bp->stats.mac_t_neg = bp->cmd_rsp_virt->smt_mib_get.mac_t_neg; in dfx_ctl_get_stats()
2139 bp->stats.mac_t_max = bp->cmd_rsp_virt->smt_mib_get.mac_t_max; in dfx_ctl_get_stats()
2140 bp->stats.mac_tvx_value = bp->cmd_rsp_virt->smt_mib_get.mac_tvx_value; in dfx_ctl_get_stats()
2141 bp->stats.mac_frame_error_threshold = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_threshold; in dfx_ctl_get_stats()
2142 bp->stats.mac_frame_error_ratio = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_ratio; in dfx_ctl_get_stats()
2143 bp->stats.mac_rmt_state = bp->cmd_rsp_virt->smt_mib_get.mac_rmt_state; in dfx_ctl_get_stats()
2144 bp->stats.mac_da_flag = bp->cmd_rsp_virt->smt_mib_get.mac_da_flag; in dfx_ctl_get_stats()
2145 bp->stats.mac_una_da_flag = bp->cmd_rsp_virt->smt_mib_get.mac_unda_flag; in dfx_ctl_get_stats()
2146 bp->stats.mac_frame_error_flag = bp->cmd_rsp_virt->smt_mib_get.mac_frame_error_flag; in dfx_ctl_get_stats()
2147 bp->stats.mac_ma_unitdata_available = bp->cmd_rsp_virt->smt_mib_get.mac_ma_unitdata_available; in dfx_ctl_get_stats()
2148 bp->stats.mac_hardware_present = bp->cmd_rsp_virt->smt_mib_get.mac_hardware_present; in dfx_ctl_get_stats()
2149 bp->stats.mac_ma_unitdata_enable = bp->cmd_rsp_virt->smt_mib_get.mac_ma_unitdata_enable; in dfx_ctl_get_stats()
2150 bp->stats.path_tvx_lower_bound = bp->cmd_rsp_virt->smt_mib_get.path_tvx_lower_bound; in dfx_ctl_get_stats()
2151 bp->stats.path_t_max_lower_bound = bp->cmd_rsp_virt->smt_mib_get.path_t_max_lower_bound; in dfx_ctl_get_stats()
2152 bp->stats.path_max_t_req = bp->cmd_rsp_virt->smt_mib_get.path_max_t_req; in dfx_ctl_get_stats()
2153 …memcpy(bp->stats.path_configuration, &bp->cmd_rsp_virt->smt_mib_get.path_configuration, sizeof(bp- in dfx_ctl_get_stats()
2154 bp->stats.port_my_type[0] = bp->cmd_rsp_virt->smt_mib_get.port_my_type[0]; in dfx_ctl_get_stats()
2155 bp->stats.port_my_type[1] = bp->cmd_rsp_virt->smt_mib_get.port_my_type[1]; in dfx_ctl_get_stats()
2156 bp->stats.port_neighbor_type[0] = bp->cmd_rsp_virt->smt_mib_get.port_neighbor_type[0]; in dfx_ctl_get_stats()
2157 bp->stats.port_neighbor_type[1] = bp->cmd_rsp_virt->smt_mib_get.port_neighbor_type[1]; in dfx_ctl_get_stats()
2158 bp->stats.port_connection_policies[0] = bp->cmd_rsp_virt->smt_mib_get.port_connection_policies[0]; in dfx_ctl_get_stats()
2159 bp->stats.port_connection_policies[1] = bp->cmd_rsp_virt->smt_mib_get.port_connection_policies[1]; in dfx_ctl_get_stats()
2160 bp->stats.port_mac_indicated[0] = bp->cmd_rsp_virt->smt_mib_get.port_mac_indicated[0]; in dfx_ctl_get_stats()
2161 bp->stats.port_mac_indicated[1] = bp->cmd_rsp_virt->smt_mib_get.port_mac_indicated[1]; in dfx_ctl_get_stats()
2162 bp->stats.port_current_path[0] = bp->cmd_rsp_virt->smt_mib_get.port_current_path[0]; in dfx_ctl_get_stats()
2163 bp->stats.port_current_path[1] = bp->cmd_rsp_virt->smt_mib_get.port_current_path[1]; in dfx_ctl_get_stats()
2164 …memcpy(&bp->stats.port_requested_paths[0*3], &bp->cmd_rsp_virt->smt_mib_get.port_requested_paths[0… in dfx_ctl_get_stats()
2165 …memcpy(&bp->stats.port_requested_paths[1*3], &bp->cmd_rsp_virt->smt_mib_get.port_requested_paths[1… in dfx_ctl_get_stats()
2166 bp->stats.port_mac_placement[0] = bp->cmd_rsp_virt->smt_mib_get.port_mac_placement[0]; in dfx_ctl_get_stats()
2167 bp->stats.port_mac_placement[1] = bp->cmd_rsp_virt->smt_mib_get.port_mac_placement[1]; in dfx_ctl_get_stats()
2168 bp->stats.port_available_paths[0] = bp->cmd_rsp_virt->smt_mib_get.port_available_paths[0]; in dfx_ctl_get_stats()
2169 bp->stats.port_available_paths[1] = bp->cmd_rsp_virt->smt_mib_get.port_available_paths[1]; in dfx_ctl_get_stats()
2170 bp->stats.port_pmd_class[0] = bp->cmd_rsp_virt->smt_mib_get.port_pmd_class[0]; in dfx_ctl_get_stats()
2171 bp->stats.port_pmd_class[1] = bp->cmd_rsp_virt->smt_mib_get.port_pmd_class[1]; in dfx_ctl_get_stats()
2172 …bp->stats.port_connection_capabilities[0] = bp->cmd_rsp_virt->smt_mib_get.port_connection_capabili… in dfx_ctl_get_stats()
2173 …bp->stats.port_connection_capabilities[1] = bp->cmd_rsp_virt->smt_mib_get.port_connection_capabili… in dfx_ctl_get_stats()
2174 bp->stats.port_bs_flag[0] = bp->cmd_rsp_virt->smt_mib_get.port_bs_flag[0]; in dfx_ctl_get_stats()
2175 bp->stats.port_bs_flag[1] = bp->cmd_rsp_virt->smt_mib_get.port_bs_flag[1]; in dfx_ctl_get_stats()
2176 bp->stats.port_ler_estimate[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_estimate[0]; in dfx_ctl_get_stats()
2177 bp->stats.port_ler_estimate[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_estimate[1]; in dfx_ctl_get_stats()
2178 bp->stats.port_ler_cutoff[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_cutoff[0]; in dfx_ctl_get_stats()
2179 bp->stats.port_ler_cutoff[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_cutoff[1]; in dfx_ctl_get_stats()
2180 bp->stats.port_ler_alarm[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_alarm[0]; in dfx_ctl_get_stats()
2181 bp->stats.port_ler_alarm[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_alarm[1]; in dfx_ctl_get_stats()
2182 bp->stats.port_connect_state[0] = bp->cmd_rsp_virt->smt_mib_get.port_connect_state[0]; in dfx_ctl_get_stats()
2183 bp->stats.port_connect_state[1] = bp->cmd_rsp_virt->smt_mib_get.port_connect_state[1]; in dfx_ctl_get_stats()
2184 bp->stats.port_pcm_state[0] = bp->cmd_rsp_virt->smt_mib_get.port_pcm_state[0]; in dfx_ctl_get_stats()
2185 bp->stats.port_pcm_state[1] = bp->cmd_rsp_virt->smt_mib_get.port_pcm_state[1]; in dfx_ctl_get_stats()
2186 bp->stats.port_pc_withhold[0] = bp->cmd_rsp_virt->smt_mib_get.port_pc_withhold[0]; in dfx_ctl_get_stats()
2187 bp->stats.port_pc_withhold[1] = bp->cmd_rsp_virt->smt_mib_get.port_pc_withhold[1]; in dfx_ctl_get_stats()
2188 bp->stats.port_ler_flag[0] = bp->cmd_rsp_virt->smt_mib_get.port_ler_flag[0]; in dfx_ctl_get_stats()
2189 bp->stats.port_ler_flag[1] = bp->cmd_rsp_virt->smt_mib_get.port_ler_flag[1]; in dfx_ctl_get_stats()
2190 bp->stats.port_hardware_present[0] = bp->cmd_rsp_virt->smt_mib_get.port_hardware_present[0]; in dfx_ctl_get_stats()
2191 bp->stats.port_hardware_present[1] = bp->cmd_rsp_virt->smt_mib_get.port_hardware_present[1]; in dfx_ctl_get_stats()
2195 bp->cmd_req_virt->cmd_type = PI_CMD_K_CNTRS_GET; in dfx_ctl_get_stats()
2197 return (struct net_device_stats *)&bp->stats; in dfx_ctl_get_stats()
2199 /* Fill the bp->stats structure with the FDDI counter values */ in dfx_ctl_get_stats()
2201 bp->stats.mac_frame_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.frame_cnt.ls; in dfx_ctl_get_stats()
2202 bp->stats.mac_copied_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.copied_cnt.ls; in dfx_ctl_get_stats()
2203 bp->stats.mac_transmit_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.transmit_cnt.ls; in dfx_ctl_get_stats()
2204 bp->stats.mac_error_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.error_cnt.ls; in dfx_ctl_get_stats()
2205 bp->stats.mac_lost_cts = bp->cmd_rsp_virt->cntrs_get.cntrs.lost_cnt.ls; in dfx_ctl_get_stats()
2206 bp->stats.port_lct_fail_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.lct_rejects[0].ls; in dfx_ctl_get_stats()
2207 bp->stats.port_lct_fail_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.lct_rejects[1].ls; in dfx_ctl_get_stats()
2208 bp->stats.port_lem_reject_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.lem_rejects[0].ls; in dfx_ctl_get_stats()
2209 bp->stats.port_lem_reject_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.lem_rejects[1].ls; in dfx_ctl_get_stats()
2210 bp->stats.port_lem_cts[0] = bp->cmd_rsp_virt->cntrs_get.cntrs.link_errors[0].ls; in dfx_ctl_get_stats()
2211 bp->stats.port_lem_cts[1] = bp->cmd_rsp_virt->cntrs_get.cntrs.link_errors[1].ls; in dfx_ctl_get_stats()
2213 return (struct net_device_stats *)&bp->stats; in dfx_ctl_get_stats()
2230 * dev - pointer to device information
2234 * adapter filters and CAM:
2241 * (CAM max size - number of unicast addresses in CAM)
2243 * set driver-maintained multicast address count to zero
2246 * set driver-maintained multicast address count to incoming count
2247 * update adapter CAM
2257 * On-board adapter CAM and filters are updated.
2268 if (dev->flags & IFF_PROMISC) in dfx_ctl_set_multicast_list()
2269 bp->ind_group_prom = PI_FSTATE_K_PASS; /* Enable LLC ind/group prom mode */ in dfx_ctl_set_multicast_list()
2275 bp->ind_group_prom = PI_FSTATE_K_BLOCK; /* Disable LLC ind/group prom mode */ in dfx_ctl_set_multicast_list()
2279 * Note: The adapters utilize an on-board 64 entry CAM for in dfx_ctl_set_multicast_list()
2286 * The firmware reserves two CAM entries for SMT-related in dfx_ctl_set_multicast_list()
2289 * to add more than 62 addresses to the CAM. If we are, in dfx_ctl_set_multicast_list()
2296 if (netdev_mc_count(dev) > (PI_CMD_ADDR_FILTER_K_SIZE - bp->uc_count)) in dfx_ctl_set_multicast_list()
2298 bp->group_prom = PI_FSTATE_K_PASS; /* Enable LLC group prom mode */ in dfx_ctl_set_multicast_list()
2299 bp->mc_count = 0; /* Don't add mc addrs to CAM */ in dfx_ctl_set_multicast_list()
2303 bp->group_prom = PI_FSTATE_K_BLOCK; /* Disable LLC group prom mode */ in dfx_ctl_set_multicast_list()
2304 bp->mc_count = netdev_mc_count(dev); /* Add mc addrs to CAM */ in dfx_ctl_set_multicast_list()
2307 /* Copy addresses to multicast address table, then update adapter CAM */ in dfx_ctl_set_multicast_list()
2311 memcpy(&bp->mc_table[i++ * FDDI_K_ALEN], in dfx_ctl_set_multicast_list()
2312 ha->addr, FDDI_K_ALEN); in dfx_ctl_set_multicast_list()
2316 DBG_printk("%s: Could not update multicast address table!\n", dev->name); in dfx_ctl_set_multicast_list()
2320 …DBG_printk("%s: Multicast address table updated! Added %d addresses.\n", dev->name, bp->mc_count); in dfx_ctl_set_multicast_list()
2328 DBG_printk("%s: Could not update adapter filters!\n", dev->name); in dfx_ctl_set_multicast_list()
2332 DBG_printk("%s: Adapter filters updated!\n", dev->name); in dfx_ctl_set_multicast_list()
2344 * CAM and update dev_addr field in device table.
2350 * dev - pointer to device information
2351 * addr - pointer to sockaddr structure containing unicast address to add
2355 * unicast addresses to the adapter CAM. This is similar to adding
2357 * device structures with the new address, then update the adapter CAM
2365 * The address pointed to by addr->sa_data is a valid unicast
2369 * On-board adapter CAM is updated. On-board adapter filters
2378 /* Copy unicast address to driver-maintained structs and update count */ in dfx_ctl_set_mac_address()
2380 memcpy(dev->dev_addr, p_sockaddr->sa_data, FDDI_K_ALEN); /* update device struct */ in dfx_ctl_set_mac_address()
2381 memcpy(&bp->uc_table[0], p_sockaddr->sa_data, FDDI_K_ALEN); /* update driver struct */ in dfx_ctl_set_mac_address()
2382 bp->uc_count = 1; in dfx_ctl_set_mac_address()
2385 * Verify we're not exceeding the CAM size by adding unicast address in dfx_ctl_set_mac_address()
2388 * already filled the CAM with 62 multicast addresses. in dfx_ctl_set_mac_address()
2390 * the CAM, we have to check to see that we're not in dfx_ctl_set_mac_address()
2391 * exceeding the CAM size. If we are, we have to enable in dfx_ctl_set_mac_address()
2396 if ((bp->uc_count + bp->mc_count) > PI_CMD_ADDR_FILTER_K_SIZE) in dfx_ctl_set_mac_address()
2398 bp->group_prom = PI_FSTATE_K_PASS; /* Enable LLC group prom mode */ in dfx_ctl_set_mac_address()
2399 bp->mc_count = 0; /* Don't add mc addrs to CAM */ in dfx_ctl_set_mac_address()
2405 DBG_printk("%s: Could not update adapter filters!\n", dev->name); in dfx_ctl_set_mac_address()
2409 DBG_printk("%s: Adapter filters updated!\n", dev->name); in dfx_ctl_set_mac_address()
2413 /* Update adapter CAM with new unicast address */ in dfx_ctl_set_mac_address()
2417 DBG_printk("%s: Could not set new MAC address!\n", dev->name); in dfx_ctl_set_mac_address()
2421 DBG_printk("%s: Adapter CAM updated with new MAC address\n", dev->name); in dfx_ctl_set_mac_address()
2433 * Procedure to update adapter CAM (Content Addressable Memory)
2440 * bp - pointer to board information
2443 * Updates adapter CAM with current contents of board structure
2445 * free entries in CAM, this routine ensures that the command
2449 * DFX_K_SUCCESS - Request succeeded
2450 * DFX_K_FAILURE - Request failed
2457 * On-board adapter CAM is updated.
2463 PI_LAN_ADDR *p_addr; /* pointer to CAM entry */ in dfx_ctl_update_cam()
2478 memset(bp->cmd_req_virt, 0, PI_CMD_REQ_K_SIZE_MAX); /* first clear buffer */ in dfx_ctl_update_cam()
2479 bp->cmd_req_virt->cmd_type = PI_CMD_K_ADDR_FILTER_SET; in dfx_ctl_update_cam()
2480 p_addr = &bp->cmd_req_virt->addr_filter_set.entry[0]; in dfx_ctl_update_cam()
2484 for (i=0; i < (int)bp->uc_count; i++) in dfx_ctl_update_cam()
2488 memcpy(p_addr, &bp->uc_table[i*FDDI_K_ALEN], FDDI_K_ALEN); in dfx_ctl_update_cam()
2495 for (i=0; i < (int)bp->mc_count; i++) in dfx_ctl_update_cam()
2497 if ((i + bp->uc_count) < PI_CMD_ADDR_FILTER_K_SIZE) in dfx_ctl_update_cam()
2499 memcpy(p_addr, &bp->mc_table[i*FDDI_K_ALEN], FDDI_K_ALEN); in dfx_ctl_update_cam()
2504 /* Issue command to update adapter CAM, then return */ in dfx_ctl_update_cam()
2525 * bp - pointer to board information
2531 * DFX_K_SUCCESS - Request succeeded.
2532 * DFX_K_FAILURE - Request failed.
2536 * address (FF-FF-FF-FF-FF-FF), so we'll always keep the
2540 * On-board adapter filters are updated.
2549 bp->cmd_req_virt->cmd_type = PI_CMD_K_FILTERS_SET; in dfx_ctl_update_filters()
2551 /* Initialize Broadcast filter - * ALWAYS ENABLED * */ in dfx_ctl_update_filters()
2553 bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_BROADCAST; in dfx_ctl_update_filters()
2554 bp->cmd_req_virt->filter_set.item[i++].value = PI_FSTATE_K_PASS; in dfx_ctl_update_filters()
2558 bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_IND_GROUP_PROM; in dfx_ctl_update_filters()
2559 bp->cmd_req_virt->filter_set.item[i++].value = bp->ind_group_prom; in dfx_ctl_update_filters()
2563 bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_GROUP_PROM; in dfx_ctl_update_filters()
2564 bp->cmd_req_virt->filter_set.item[i++].value = bp->group_prom; in dfx_ctl_update_filters()
2568 bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_EOL; in dfx_ctl_update_filters()
2590 * bp - pointer to board information
2607 * DFX_K_SUCCESS - DMA command succeeded
2608 * DFX_K_OUTSTATE - Adapter is NOT in proper state
2609 * DFX_K_HW_TIMEOUT - DMA command timed out
2634 bp->descr_block_virt->cmd_rsp[bp->cmd_rsp_reg.index.prod].long_0 = (u32) (PI_RCV_DESCR_M_SOP | in dfx_hw_dma_cmd_req()
2636 bp->descr_block_virt->cmd_rsp[bp->cmd_rsp_reg.index.prod].long_1 = bp->cmd_rsp_phys; in dfx_hw_dma_cmd_req()
2640 bp->cmd_rsp_reg.index.prod += 1; in dfx_hw_dma_cmd_req()
2641 bp->cmd_rsp_reg.index.prod &= PI_CMD_RSP_K_NUM_ENTRIES-1; in dfx_hw_dma_cmd_req()
2642 dfx_port_write_long(bp, PI_PDQ_K_REG_CMD_RSP_PROD, bp->cmd_rsp_reg.lword); in dfx_hw_dma_cmd_req()
2646 bp->descr_block_virt->cmd_req[bp->cmd_req_reg.index.prod].long_0 = (u32) (PI_XMT_DESCR_M_SOP | in dfx_hw_dma_cmd_req()
2648 bp->descr_block_virt->cmd_req[bp->cmd_req_reg.index.prod].long_1 = bp->cmd_req_phys; in dfx_hw_dma_cmd_req()
2652 bp->cmd_req_reg.index.prod += 1; in dfx_hw_dma_cmd_req()
2653 bp->cmd_req_reg.index.prod &= PI_CMD_REQ_K_NUM_ENTRIES-1; in dfx_hw_dma_cmd_req()
2654 dfx_port_write_long(bp, PI_PDQ_K_REG_CMD_REQ_PROD, bp->cmd_req_reg.lword); in dfx_hw_dma_cmd_req()
2661 for (timeout_cnt = 20000; timeout_cnt > 0; timeout_cnt--) in dfx_hw_dma_cmd_req()
2663 if (bp->cmd_req_reg.index.prod == (u8)(bp->cons_block_virt->cmd_req)) in dfx_hw_dma_cmd_req()
2672 bp->cmd_req_reg.index.comp += 1; in dfx_hw_dma_cmd_req()
2673 bp->cmd_req_reg.index.comp &= PI_CMD_REQ_K_NUM_ENTRIES-1; in dfx_hw_dma_cmd_req()
2674 dfx_port_write_long(bp, PI_PDQ_K_REG_CMD_REQ_PROD, bp->cmd_req_reg.lword); in dfx_hw_dma_cmd_req()
2681 for (timeout_cnt = 20000; timeout_cnt > 0; timeout_cnt--) in dfx_hw_dma_cmd_req()
2683 if (bp->cmd_rsp_reg.index.prod == (u8)(bp->cons_block_virt->cmd_rsp)) in dfx_hw_dma_cmd_req()
2692 bp->cmd_rsp_reg.index.comp += 1; in dfx_hw_dma_cmd_req()
2693 bp->cmd_rsp_reg.index.comp &= PI_CMD_RSP_K_NUM_ENTRIES-1; in dfx_hw_dma_cmd_req()
2694 dfx_port_write_long(bp, PI_PDQ_K_REG_CMD_RSP_PROD, bp->cmd_rsp_reg.lword); in dfx_hw_dma_cmd_req()
2708 * Host data register value in host_data if ptr is not NULL
2711 * bp - pointer to board information
2712 * command - port control command
2713 * data_a - port data A register value
2714 * data_b - port data B register value
2715 * host_data - ptr to host data register value
2718 * Send generic port control command to adapter by writing
2722 * DFX_K_SUCCESS - port control command succeeded
2723 * DFX_K_HW_TIMEOUT - port control command timed out
2761 for (; timeout_cnt > 0; timeout_cnt--) in dfx_hw_port_ctrl_req()
2772 * If the address of host_data is non-zero, assume caller has supplied a in dfx_hw_port_ctrl_req()
2795 * bp - pointer to board information
2796 * type - type of reset to perform
2849 * bp - pointer to board information
2885 * bp - pointer to board information
2886 * type - type of reset to perform
2894 * DFX_K_SUCCESS - adapter is in DMA_UNAVAILABLE state
2895 * DFX_K_HW_TIMEOUT - adapter did not reset properly
2914 for (timeout_cnt = 100000; timeout_cnt > 0; timeout_cnt--) in dfx_hw_dma_uninit()
2932 unsigned long x = (unsigned long)skb->data; in my_skb_align()
2937 skb_reserve(skb, v - x); in my_skb_align()
2947 * Produces buffers to adapter LLC Host receive descriptor block
2953 * bp - pointer to board information
2954 * get_buffers - non-zero if buffers to be allocated
2959 * LLC Host queue receive buffers.
2962 * Return 0 on success or -ENOMEM if buffer allocation failed (when using
2982 * first longword in each receive descriptor for entire LLC Host descriptor in dfx_rcv_init()
2992 * aligned. In other words, bits 0-6 of the length and address must in dfx_rcv_init()
2994 * all PDQ-based boards. We guaranteed both requirements during in dfx_rcv_init()
3000 for (i = 0; i < (int)(bp->rcv_bufs_to_post); i++) in dfx_rcv_init()
3001 for (j = 0; (i + j) < (int)PI_RCV_DATA_K_NUM_ENTRIES; j += bp->rcv_bufs_to_post) in dfx_rcv_init()
3006 newskb = __netdev_alloc_skb(bp->dev, NEW_SKB_SIZE, in dfx_rcv_init()
3009 return -ENOMEM; in dfx_rcv_init()
3016 dma_addr = dma_map_single(bp->bus_dev, in dfx_rcv_init()
3017 newskb->data, in dfx_rcv_init()
3020 if (dma_mapping_error(bp->bus_dev, dma_addr)) { in dfx_rcv_init()
3022 return -ENOMEM; in dfx_rcv_init()
3024 bp->descr_block_virt->rcv_data[i + j].long_0 = in dfx_rcv_init()
3029 bp->descr_block_virt->rcv_data[i + j].long_1 = in dfx_rcv_init()
3036 bp->p_rcv_buff_va[i+j] = (char *) newskb; in dfx_rcv_init()
3039 for (i=0; i < (int)(bp->rcv_bufs_to_post); i++) in dfx_rcv_init()
3040 for (j=0; (i + j) < (int)PI_RCV_DATA_K_NUM_ENTRIES; j += bp->rcv_bufs_to_post) in dfx_rcv_init()
3042 bp->descr_block_virt->rcv_data[i+j].long_0 = (u32) (PI_RCV_DESCR_M_SOP | in dfx_rcv_init()
3044 …bp->descr_block_virt->rcv_data[i+j].long_1 = (u32) (bp->rcv_block_phys + (i * PI_RCV_DATA_K_SIZE_M… in dfx_rcv_init()
3045 bp->p_rcv_buff_va[i+j] = (bp->rcv_block_virt + (i * PI_RCV_DATA_K_SIZE_MAX)); in dfx_rcv_init()
3052 bp->rcv_xmt_reg.index.rcv_prod = bp->rcv_bufs_to_post; in dfx_rcv_init()
3053 dfx_port_write_long(bp, PI_PDQ_K_REG_TYPE_2_PROD, bp->rcv_xmt_reg.lword); in dfx_rcv_init()
3070 * bp - pointer to board information
3102 p_type_2_cons = (PI_TYPE_2_CONSUMER *)(&bp->cons_block_virt->xmt_rcv_data); in dfx_rcv_queue_process()
3103 while (bp->rcv_xmt_reg.index.rcv_comp != p_type_2_cons->index.rcv_cons) in dfx_rcv_queue_process()
3109 entry = bp->rcv_xmt_reg.index.rcv_comp; in dfx_rcv_queue_process()
3111 p_buff = (char *) (((struct sk_buff *)bp->p_rcv_buff_va[entry])->data); in dfx_rcv_queue_process()
3113 p_buff = bp->p_rcv_buff_va[entry]; in dfx_rcv_queue_process()
3115 dma_addr = bp->descr_block_virt->rcv_data[entry].long_1; in dfx_rcv_queue_process()
3116 dma_sync_single_for_cpu(bp->bus_dev, in dfx_rcv_queue_process()
3125 bp->rcv_crc_errors++; in dfx_rcv_queue_process()
3127 bp->rcv_frame_status_errors++; in dfx_rcv_queue_process()
3133 /* The frame was received without errors - verify packet length */ in dfx_rcv_queue_process()
3136 pkt_len -= 4; /* subtract 4 byte CRC */ in dfx_rcv_queue_process()
3138 bp->rcv_length_errors++; in dfx_rcv_queue_process()
3146 newskb = netdev_alloc_skb(bp->dev, in dfx_rcv_queue_process()
3151 bp->bus_dev, in dfx_rcv_queue_process()
3152 newskb->data, in dfx_rcv_queue_process()
3156 bp->bus_dev, in dfx_rcv_queue_process()
3165 skb = (struct sk_buff *)bp->p_rcv_buff_va[entry]; in dfx_rcv_queue_process()
3166 dma_unmap_single(bp->bus_dev, in dfx_rcv_queue_process()
3171 bp->p_rcv_buff_va[entry] = (char *)newskb; in dfx_rcv_queue_process()
3172 bp->descr_block_virt->rcv_data[entry].long_1 = (u32)new_dma_addr; in dfx_rcv_queue_process()
3179 skb = netdev_alloc_skb(bp->dev, in dfx_rcv_queue_process()
3183 printk("%s: Could not allocate receive buffer. Dropping packet.\n", bp->dev->name); in dfx_rcv_queue_process()
3184 bp->rcv_discards++; in dfx_rcv_queue_process()
3191 bp->bus_dev, in dfx_rcv_queue_process()
3204 skb->protocol = fddi_type_trans(skb, bp->dev); in dfx_rcv_queue_process()
3205 bp->rcv_total_bytes += skb->len; in dfx_rcv_queue_process()
3209 bp->rcv_total_frames++; in dfx_rcv_queue_process()
3211 bp->rcv_multicast_frames++; in dfx_rcv_queue_process()
3224 bp->rcv_xmt_reg.index.rcv_prod += 1; in dfx_rcv_queue_process()
3225 bp->rcv_xmt_reg.index.rcv_comp += 1; in dfx_rcv_queue_process()
3242 * skb - pointer to sk_buff to queue for transmission
3243 * dev - pointer to device information
3249 * (skb->data) can be converted to a physical address
3256 * ensured that dev->hard_header_len includes three pad
3266 * 0 - driver queued packet, link is unavailable, or skbuff was bad
3267 * 1 - caller should requeue the sk_buff for later transmission
3280 * 32-bit physical address can be determined.
3312 if (!IN_RANGE(skb->len, FDDI_K_LLC_ZLEN, FDDI_K_LLC_LEN)) in dfx_xmt_queue_pkt()
3314 printk("%s: Invalid packet length - %u bytes\n", in dfx_xmt_queue_pkt()
3315 dev->name, skb->len); in dfx_xmt_queue_pkt()
3316 bp->xmt_length_errors++; /* bump error counter */ in dfx_xmt_queue_pkt()
3333 if (bp->link_available == PI_K_FALSE) in dfx_xmt_queue_pkt()
3336 bp->link_available = PI_K_TRUE; /* if so, set flag and continue */ in dfx_xmt_queue_pkt()
3339 bp->xmt_discards++; /* bump error counter */ in dfx_xmt_queue_pkt()
3349 skb->data[0] = DFX_PRH0_BYTE; /* these byte values are defined */ in dfx_xmt_queue_pkt()
3350 skb->data[1] = DFX_PRH1_BYTE; /* in the Motorola FDDI MAC chip */ in dfx_xmt_queue_pkt()
3351 skb->data[2] = DFX_PRH2_BYTE; /* specification */ in dfx_xmt_queue_pkt()
3353 dma_addr = dma_map_single(bp->bus_dev, skb->data, skb->len, in dfx_xmt_queue_pkt()
3355 if (dma_mapping_error(bp->bus_dev, dma_addr)) { in dfx_xmt_queue_pkt()
3360 spin_lock_irqsave(&bp->lock, flags); in dfx_xmt_queue_pkt()
3364 prod = bp->rcv_xmt_reg.index.xmt_prod; in dfx_xmt_queue_pkt()
3365 p_xmt_descr = &(bp->descr_block_virt->xmt_data[prod]); in dfx_xmt_queue_pkt()
3378 p_xmt_drv_descr = &(bp->xmt_drv_descr_blk[prod++]); /* also bump producer index */ in dfx_xmt_queue_pkt()
3386 * buffer from the PRH, not skb->data. in dfx_xmt_queue_pkt()
3390 * at skb->data. in dfx_xmt_queue_pkt()
3391 * 2. The 4-byte CRC is not appended to the buffer or in dfx_xmt_queue_pkt()
3393 * 3. Packet length (skb->len) is from FC to end of in dfx_xmt_queue_pkt()
3398 * contiguous, non-cached, locked memory space in dfx_xmt_queue_pkt()
3400 * skb->data. in dfx_xmt_queue_pkt()
3403 * by using pci_map_single() and is only 32-bits in dfx_xmt_queue_pkt()
3407 …p_xmt_descr->long_0 = (u32) (PI_XMT_DESCR_M_SOP | PI_XMT_DESCR_M_EOP | ((skb->len) << PI_XMT_DESCR… in dfx_xmt_queue_pkt()
3408 p_xmt_descr->long_1 = (u32)dma_addr; in dfx_xmt_queue_pkt()
3421 if (prod == bp->rcv_xmt_reg.index.xmt_comp) in dfx_xmt_queue_pkt()
3424 spin_unlock_irqrestore(&bp->lock, flags); in dfx_xmt_queue_pkt()
3444 p_xmt_drv_descr->p_skb = skb; in dfx_xmt_queue_pkt()
3448 bp->rcv_xmt_reg.index.xmt_prod = prod; in dfx_xmt_queue_pkt()
3449 dfx_port_write_long(bp, PI_PDQ_K_REG_TYPE_2_PROD, bp->rcv_xmt_reg.lword); in dfx_xmt_queue_pkt()
3450 spin_unlock_irqrestore(&bp->lock, flags); in dfx_xmt_queue_pkt()
3468 * bp - pointer to board information
3497 p_type_2_cons = (PI_TYPE_2_CONSUMER *)(&bp->cons_block_virt->xmt_rcv_data); in dfx_xmt_done()
3498 while (bp->rcv_xmt_reg.index.xmt_comp != p_type_2_cons->index.xmt_cons) in dfx_xmt_done()
3502 p_xmt_drv_descr = &(bp->xmt_drv_descr_blk[bp->rcv_xmt_reg.index.xmt_comp]); in dfx_xmt_done()
3506 bp->xmt_total_frames++; in dfx_xmt_done()
3507 bp->xmt_total_bytes += p_xmt_drv_descr->p_skb->len; in dfx_xmt_done()
3510 comp = bp->rcv_xmt_reg.index.xmt_comp; in dfx_xmt_done()
3511 dma_unmap_single(bp->bus_dev, in dfx_xmt_done()
3512 bp->descr_block_virt->xmt_data[comp].long_1, in dfx_xmt_done()
3513 p_xmt_drv_descr->p_skb->len, in dfx_xmt_done()
3515 dev_consume_skb_irq(p_xmt_drv_descr->p_skb); in dfx_xmt_done()
3528 bp->rcv_xmt_reg.index.xmt_comp += 1; in dfx_xmt_done()
3547 * bp - pointer to board information
3566 for (i = 0; i < (int)(bp->rcv_bufs_to_post); i++) in dfx_rcv_flush()
3567 for (j = 0; (i + j) < (int)PI_RCV_DATA_K_NUM_ENTRIES; j += bp->rcv_bufs_to_post) in dfx_rcv_flush()
3570 skb = (struct sk_buff *)bp->p_rcv_buff_va[i+j]; in dfx_rcv_flush()
3572 dma_unmap_single(bp->bus_dev, in dfx_rcv_flush()
3573 bp->descr_block_virt->rcv_data[i+j].long_1, in dfx_rcv_flush()
3578 bp->p_rcv_buff_va[i+j] = NULL; in dfx_rcv_flush()
3597 * bp - pointer to board information
3628 while (bp->rcv_xmt_reg.index.xmt_comp != bp->rcv_xmt_reg.index.xmt_prod) in dfx_xmt_flush()
3632 p_xmt_drv_descr = &(bp->xmt_drv_descr_blk[bp->rcv_xmt_reg.index.xmt_comp]); in dfx_xmt_flush()
3635 comp = bp->rcv_xmt_reg.index.xmt_comp; in dfx_xmt_flush()
3636 dma_unmap_single(bp->bus_dev, in dfx_xmt_flush()
3637 bp->descr_block_virt->xmt_data[comp].long_1, in dfx_xmt_flush()
3638 p_xmt_drv_descr->p_skb->len, in dfx_xmt_flush()
3640 dev_kfree_skb(p_xmt_drv_descr->p_skb); in dfx_xmt_flush()
3644 bp->xmt_discards++; in dfx_xmt_flush()
3657 bp->rcv_xmt_reg.index.xmt_comp += 1; in dfx_xmt_flush()
3662 prod_cons = (u32)(bp->cons_block_virt->xmt_rcv_data & ~PI_CONS_M_XMT_INDEX); in dfx_xmt_flush()
3663 prod_cons |= (u32)(bp->rcv_xmt_reg.index.xmt_prod << PI_CONS_V_XMT_INDEX); in dfx_xmt_flush()
3664 bp->cons_block_virt->xmt_rcv_data = prod_cons; in dfx_xmt_flush()
3679 * bdev - pointer to device information
3687 * It compiles so it should work :-( (PCI cards do :-)
3709 (bp->rcv_bufs_to_post * PI_RCV_DATA_K_SIZE_MAX) + in dfx_unregister()
3712 (PI_ALIGN_K_DESC_BLK - 1); in dfx_unregister()
3713 if (bp->kmalloced) in dfx_unregister()
3715 bp->kmalloced, bp->kmalloced_dma); in dfx_unregister()
3725 iounmap(bp->base.mem); in dfx_unregister()
3748 MODULE_DEVICE_TABLE(pci, dfx_pci_table);
3760 return dfx_register(&pdev->dev); in dfx_pci_register()
3765 dfx_unregister(&pdev->dev); in dfx_pci_unregister()
3792 { "DEC ", "PMAF-FA " },
3793 { "DEC ", "PMAF-FD " },
3794 { "DEC ", "PMAF-FS " },
3795 { "DEC ", "PMAF-FU " },
3851 MODULE_DESCRIPTION("DEC FDDIcontroller TC/EISA/PCI (DEFTA/DEFEA/DEFPA) driver "