1 /****************************************************************************
2 * Driver for Solarflare Solarstorm network controllers and boards
3 * Copyright 2005-2006 Fen Systems Ltd.
4 * Copyright 2006-2008 Solarflare Communications Inc.
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.
14 #include "net_driver.h"
17 * Falcon hardware control
20 enum falcon_revision {
26 #define FALCON_REV(efx) ((efx)->pci_dev->revision)
28 extern struct efx_nic_type falcon_a_nic_type;
29 extern struct efx_nic_type falcon_b_nic_type;
31 /**************************************************************************
35 **************************************************************************
39 extern int falcon_probe_tx(struct efx_tx_queue *tx_queue);
40 extern int falcon_init_tx(struct efx_tx_queue *tx_queue);
41 extern void falcon_fini_tx(struct efx_tx_queue *tx_queue);
42 extern void falcon_remove_tx(struct efx_tx_queue *tx_queue);
43 extern void falcon_push_buffers(struct efx_tx_queue *tx_queue);
46 extern int falcon_probe_rx(struct efx_rx_queue *rx_queue);
47 extern int falcon_init_rx(struct efx_rx_queue *rx_queue);
48 extern void falcon_fini_rx(struct efx_rx_queue *rx_queue);
49 extern void falcon_remove_rx(struct efx_rx_queue *rx_queue);
50 extern void falcon_notify_rx_desc(struct efx_rx_queue *rx_queue);
53 extern int falcon_probe_eventq(struct efx_channel *channel);
54 extern int falcon_init_eventq(struct efx_channel *channel);
55 extern void falcon_fini_eventq(struct efx_channel *channel);
56 extern void falcon_remove_eventq(struct efx_channel *channel);
57 extern int falcon_process_eventq(struct efx_channel *channel, int *rx_quota);
58 extern void falcon_eventq_read_ack(struct efx_channel *channel);
61 extern int falcon_probe_port(struct efx_nic *efx);
62 extern void falcon_remove_port(struct efx_nic *efx);
65 extern int falcon_xaui_link_ok(struct efx_nic *efx);
66 extern int falcon_dma_stats(struct efx_nic *efx,
67 unsigned int done_offset);
68 extern void falcon_drain_tx_fifo(struct efx_nic *efx);
69 extern void falcon_deconfigure_mac_wrapper(struct efx_nic *efx);
70 extern void falcon_reconfigure_mac_wrapper(struct efx_nic *efx);
72 /* Interrupts and test events */
73 extern int falcon_init_interrupt(struct efx_nic *efx);
74 extern void falcon_enable_interrupts(struct efx_nic *efx);
75 extern void falcon_generate_test_event(struct efx_channel *channel,
77 extern void falcon_generate_interrupt(struct efx_nic *efx);
78 extern void falcon_set_int_moderation(struct efx_channel *channel);
79 extern void falcon_disable_interrupts(struct efx_nic *efx);
80 extern void falcon_fini_interrupt(struct efx_nic *efx);
82 /* Global Resources */
83 extern int falcon_probe_nic(struct efx_nic *efx);
84 extern int falcon_probe_resources(struct efx_nic *efx);
85 extern int falcon_init_nic(struct efx_nic *efx);
86 extern int falcon_reset_hw(struct efx_nic *efx, enum reset_type method);
87 extern void falcon_remove_resources(struct efx_nic *efx);
88 extern void falcon_remove_nic(struct efx_nic *efx);
89 extern void falcon_update_nic_stats(struct efx_nic *efx);
90 extern void falcon_set_multicast_hash(struct efx_nic *efx);
91 extern int falcon_reset_xaui(struct efx_nic *efx);
93 /**************************************************************************
97 **************************************************************************
100 #define FALCON_STAT_OFFSET(falcon_stat) EFX_VAL(falcon_stat, offset)
101 #define FALCON_STAT_WIDTH(falcon_stat) EFX_VAL(falcon_stat, WIDTH)
103 /* Retrieve statistic from statistics block */
104 #define FALCON_STAT(efx, falcon_stat, efx_stat) do { \
105 if (FALCON_STAT_WIDTH(falcon_stat) == 16) \
106 (efx)->mac_stats.efx_stat += le16_to_cpu( \
107 *((__force __le16 *) \
108 (efx->stats_buffer.addr + \
109 FALCON_STAT_OFFSET(falcon_stat)))); \
110 else if (FALCON_STAT_WIDTH(falcon_stat) == 32) \
111 (efx)->mac_stats.efx_stat += le32_to_cpu( \
112 *((__force __le32 *) \
113 (efx->stats_buffer.addr + \
114 FALCON_STAT_OFFSET(falcon_stat)))); \
116 (efx)->mac_stats.efx_stat += le64_to_cpu( \
117 *((__force __le64 *) \
118 (efx->stats_buffer.addr + \
119 FALCON_STAT_OFFSET(falcon_stat)))); \
122 #define FALCON_MAC_STATS_SIZE 0x100
124 #define MAC_DATA_LBN 0
125 #define MAC_DATA_WIDTH 32
127 extern void falcon_generate_event(struct efx_channel *channel,
130 #endif /* EFX_FALCON_H */