falcon.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /****************************************************************************
  2. * Driver for Solarflare Solarstorm network controllers and boards
  3. * Copyright 2005-2006 Fen Systems Ltd.
  4. * Copyright 2006-2008 Solarflare Communications Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published
  8. * by the Free Software Foundation, incorporated herein by reference.
  9. */
  10. #ifndef EFX_FALCON_H
  11. #define EFX_FALCON_H
  12. #include "net_driver.h"
  13. /*
  14. * Falcon hardware control
  15. */
  16. enum falcon_revision {
  17. FALCON_REV_A0 = 0,
  18. FALCON_REV_A1 = 1,
  19. FALCON_REV_B0 = 2,
  20. };
  21. #define FALCON_REV(efx) ((efx)->pci_dev->revision)
  22. extern struct efx_nic_type falcon_a_nic_type;
  23. extern struct efx_nic_type falcon_b_nic_type;
  24. /**************************************************************************
  25. *
  26. * Externs
  27. *
  28. **************************************************************************
  29. */
  30. /* TX data path */
  31. extern int falcon_probe_tx(struct efx_tx_queue *tx_queue);
  32. extern int falcon_init_tx(struct efx_tx_queue *tx_queue);
  33. extern void falcon_fini_tx(struct efx_tx_queue *tx_queue);
  34. extern void falcon_remove_tx(struct efx_tx_queue *tx_queue);
  35. extern void falcon_push_buffers(struct efx_tx_queue *tx_queue);
  36. /* RX data path */
  37. extern int falcon_probe_rx(struct efx_rx_queue *rx_queue);
  38. extern int falcon_init_rx(struct efx_rx_queue *rx_queue);
  39. extern void falcon_fini_rx(struct efx_rx_queue *rx_queue);
  40. extern void falcon_remove_rx(struct efx_rx_queue *rx_queue);
  41. extern void falcon_notify_rx_desc(struct efx_rx_queue *rx_queue);
  42. /* Event data path */
  43. extern int falcon_probe_eventq(struct efx_channel *channel);
  44. extern int falcon_init_eventq(struct efx_channel *channel);
  45. extern void falcon_fini_eventq(struct efx_channel *channel);
  46. extern void falcon_remove_eventq(struct efx_channel *channel);
  47. extern int falcon_process_eventq(struct efx_channel *channel, int *rx_quota);
  48. extern void falcon_eventq_read_ack(struct efx_channel *channel);
  49. /* Ports */
  50. extern int falcon_probe_port(struct efx_nic *efx);
  51. extern void falcon_remove_port(struct efx_nic *efx);
  52. /* MAC/PHY */
  53. extern int falcon_xaui_link_ok(struct efx_nic *efx);
  54. extern int falcon_dma_stats(struct efx_nic *efx,
  55. unsigned int done_offset);
  56. extern void falcon_drain_tx_fifo(struct efx_nic *efx);
  57. extern void falcon_deconfigure_mac_wrapper(struct efx_nic *efx);
  58. extern void falcon_reconfigure_mac_wrapper(struct efx_nic *efx);
  59. /* Interrupts and test events */
  60. extern int falcon_init_interrupt(struct efx_nic *efx);
  61. extern void falcon_enable_interrupts(struct efx_nic *efx);
  62. extern void falcon_generate_test_event(struct efx_channel *channel,
  63. unsigned int magic);
  64. extern void falcon_generate_interrupt(struct efx_nic *efx);
  65. extern void falcon_set_int_moderation(struct efx_channel *channel);
  66. extern void falcon_disable_interrupts(struct efx_nic *efx);
  67. extern void falcon_fini_interrupt(struct efx_nic *efx);
  68. /* Global Resources */
  69. extern int falcon_probe_nic(struct efx_nic *efx);
  70. extern int falcon_probe_resources(struct efx_nic *efx);
  71. extern int falcon_init_nic(struct efx_nic *efx);
  72. extern int falcon_reset_hw(struct efx_nic *efx, enum reset_type method);
  73. extern void falcon_remove_resources(struct efx_nic *efx);
  74. extern void falcon_remove_nic(struct efx_nic *efx);
  75. extern void falcon_update_nic_stats(struct efx_nic *efx);
  76. extern void falcon_set_multicast_hash(struct efx_nic *efx);
  77. extern int falcon_reset_xaui(struct efx_nic *efx);
  78. /**************************************************************************
  79. *
  80. * Falcon MAC stats
  81. *
  82. **************************************************************************
  83. */
  84. #define FALCON_STAT_OFFSET(falcon_stat) EFX_VAL(falcon_stat, offset)
  85. #define FALCON_STAT_WIDTH(falcon_stat) EFX_VAL(falcon_stat, WIDTH)
  86. /* Retrieve statistic from statistics block */
  87. #define FALCON_STAT(efx, falcon_stat, efx_stat) do { \
  88. if (FALCON_STAT_WIDTH(falcon_stat) == 16) \
  89. (efx)->mac_stats.efx_stat += le16_to_cpu( \
  90. *((__force __le16 *) \
  91. (efx->stats_buffer.addr + \
  92. FALCON_STAT_OFFSET(falcon_stat)))); \
  93. else if (FALCON_STAT_WIDTH(falcon_stat) == 32) \
  94. (efx)->mac_stats.efx_stat += le32_to_cpu( \
  95. *((__force __le32 *) \
  96. (efx->stats_buffer.addr + \
  97. FALCON_STAT_OFFSET(falcon_stat)))); \
  98. else \
  99. (efx)->mac_stats.efx_stat += le64_to_cpu( \
  100. *((__force __le64 *) \
  101. (efx->stats_buffer.addr + \
  102. FALCON_STAT_OFFSET(falcon_stat)))); \
  103. } while (0)
  104. #define FALCON_MAC_STATS_SIZE 0x100
  105. #define MAC_DATA_LBN 0
  106. #define MAC_DATA_WIDTH 32
  107. extern void falcon_generate_event(struct efx_channel *channel,
  108. efx_qword_t *event);
  109. #endif /* EFX_FALCON_H */