Commit | Line | Data |
---|---|---|
8ceee660 BH |
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 | ||
11 | #ifndef EFX_FALCON_H | |
12 | #define EFX_FALCON_H | |
13 | ||
14 | #include "net_driver.h" | |
177dfcd8 | 15 | #include "efx.h" |
8ceee660 BH |
16 | |
17 | /* | |
18 | * Falcon hardware control | |
19 | */ | |
20 | ||
21 | enum falcon_revision { | |
22 | FALCON_REV_A0 = 0, | |
23 | FALCON_REV_A1 = 1, | |
24 | FALCON_REV_B0 = 2, | |
25 | }; | |
26 | ||
55668611 BH |
27 | static inline int falcon_rev(struct efx_nic *efx) |
28 | { | |
29 | return efx->pci_dev->revision; | |
30 | } | |
8ceee660 BH |
31 | |
32 | extern struct efx_nic_type falcon_a_nic_type; | |
33 | extern struct efx_nic_type falcon_b_nic_type; | |
34 | ||
35 | /************************************************************************** | |
36 | * | |
37 | * Externs | |
38 | * | |
39 | ************************************************************************** | |
40 | */ | |
41 | ||
42 | /* TX data path */ | |
43 | extern int falcon_probe_tx(struct efx_tx_queue *tx_queue); | |
bc3c90a2 | 44 | extern void falcon_init_tx(struct efx_tx_queue *tx_queue); |
8ceee660 BH |
45 | extern void falcon_fini_tx(struct efx_tx_queue *tx_queue); |
46 | extern void falcon_remove_tx(struct efx_tx_queue *tx_queue); | |
47 | extern void falcon_push_buffers(struct efx_tx_queue *tx_queue); | |
48 | ||
49 | /* RX data path */ | |
50 | extern int falcon_probe_rx(struct efx_rx_queue *rx_queue); | |
bc3c90a2 | 51 | extern void falcon_init_rx(struct efx_rx_queue *rx_queue); |
8ceee660 BH |
52 | extern void falcon_fini_rx(struct efx_rx_queue *rx_queue); |
53 | extern void falcon_remove_rx(struct efx_rx_queue *rx_queue); | |
54 | extern void falcon_notify_rx_desc(struct efx_rx_queue *rx_queue); | |
55 | ||
56 | /* Event data path */ | |
57 | extern int falcon_probe_eventq(struct efx_channel *channel); | |
bc3c90a2 | 58 | extern void falcon_init_eventq(struct efx_channel *channel); |
8ceee660 BH |
59 | extern void falcon_fini_eventq(struct efx_channel *channel); |
60 | extern void falcon_remove_eventq(struct efx_channel *channel); | |
42cbe2d7 | 61 | extern int falcon_process_eventq(struct efx_channel *channel, int rx_quota); |
8ceee660 BH |
62 | extern void falcon_eventq_read_ack(struct efx_channel *channel); |
63 | ||
64 | /* Ports */ | |
65 | extern int falcon_probe_port(struct efx_nic *efx); | |
66 | extern void falcon_remove_port(struct efx_nic *efx); | |
67 | ||
68 | /* MAC/PHY */ | |
177dfcd8 | 69 | extern int falcon_switch_mac(struct efx_nic *efx); |
dc8cfa55 | 70 | extern bool falcon_xaui_link_ok(struct efx_nic *efx); |
8ceee660 BH |
71 | extern int falcon_dma_stats(struct efx_nic *efx, |
72 | unsigned int done_offset); | |
73 | extern void falcon_drain_tx_fifo(struct efx_nic *efx); | |
74 | extern void falcon_deconfigure_mac_wrapper(struct efx_nic *efx); | |
75 | extern void falcon_reconfigure_mac_wrapper(struct efx_nic *efx); | |
76 | ||
77 | /* Interrupts and test events */ | |
78 | extern int falcon_init_interrupt(struct efx_nic *efx); | |
79 | extern void falcon_enable_interrupts(struct efx_nic *efx); | |
80 | extern void falcon_generate_test_event(struct efx_channel *channel, | |
81 | unsigned int magic); | |
177dfcd8 | 82 | extern void falcon_sim_phy_event(struct efx_nic *efx); |
8ceee660 BH |
83 | extern void falcon_generate_interrupt(struct efx_nic *efx); |
84 | extern void falcon_set_int_moderation(struct efx_channel *channel); | |
85 | extern void falcon_disable_interrupts(struct efx_nic *efx); | |
86 | extern void falcon_fini_interrupt(struct efx_nic *efx); | |
87 | ||
6fb70fd1 BH |
88 | #define FALCON_IRQ_MOD_RESOLUTION 5 |
89 | ||
8ceee660 BH |
90 | /* Global Resources */ |
91 | extern int falcon_probe_nic(struct efx_nic *efx); | |
92 | extern int falcon_probe_resources(struct efx_nic *efx); | |
93 | extern int falcon_init_nic(struct efx_nic *efx); | |
6bc5d3a9 | 94 | extern int falcon_flush_queues(struct efx_nic *efx); |
8ceee660 BH |
95 | extern int falcon_reset_hw(struct efx_nic *efx, enum reset_type method); |
96 | extern void falcon_remove_resources(struct efx_nic *efx); | |
97 | extern void falcon_remove_nic(struct efx_nic *efx); | |
98 | extern void falcon_update_nic_stats(struct efx_nic *efx); | |
99 | extern void falcon_set_multicast_hash(struct efx_nic *efx); | |
100 | extern int falcon_reset_xaui(struct efx_nic *efx); | |
101 | ||
8c8661e4 BH |
102 | /* Tests */ |
103 | struct falcon_nvconfig; | |
104 | extern int falcon_read_nvram(struct efx_nic *efx, | |
105 | struct falcon_nvconfig *nvconfig); | |
106 | extern int falcon_test_registers(struct efx_nic *efx); | |
107 | ||
8ceee660 BH |
108 | /************************************************************************** |
109 | * | |
110 | * Falcon MAC stats | |
111 | * | |
112 | ************************************************************************** | |
113 | */ | |
114 | ||
115 | #define FALCON_STAT_OFFSET(falcon_stat) EFX_VAL(falcon_stat, offset) | |
116 | #define FALCON_STAT_WIDTH(falcon_stat) EFX_VAL(falcon_stat, WIDTH) | |
117 | ||
118 | /* Retrieve statistic from statistics block */ | |
119 | #define FALCON_STAT(efx, falcon_stat, efx_stat) do { \ | |
120 | if (FALCON_STAT_WIDTH(falcon_stat) == 16) \ | |
121 | (efx)->mac_stats.efx_stat += le16_to_cpu( \ | |
122 | *((__force __le16 *) \ | |
123 | (efx->stats_buffer.addr + \ | |
124 | FALCON_STAT_OFFSET(falcon_stat)))); \ | |
125 | else if (FALCON_STAT_WIDTH(falcon_stat) == 32) \ | |
126 | (efx)->mac_stats.efx_stat += le32_to_cpu( \ | |
127 | *((__force __le32 *) \ | |
128 | (efx->stats_buffer.addr + \ | |
129 | FALCON_STAT_OFFSET(falcon_stat)))); \ | |
130 | else \ | |
131 | (efx)->mac_stats.efx_stat += le64_to_cpu( \ | |
132 | *((__force __le64 *) \ | |
133 | (efx->stats_buffer.addr + \ | |
134 | FALCON_STAT_OFFSET(falcon_stat)))); \ | |
135 | } while (0) | |
136 | ||
137 | #define FALCON_MAC_STATS_SIZE 0x100 | |
138 | ||
139 | #define MAC_DATA_LBN 0 | |
140 | #define MAC_DATA_WIDTH 32 | |
141 | ||
142 | extern void falcon_generate_event(struct efx_channel *channel, | |
143 | efx_qword_t *event); | |
144 | ||
145 | #endif /* EFX_FALCON_H */ |