3 #include <linux/interrupt.h>
4 #include <linux/netdevice.h>
5 #include <linux/skbuff.h>
6 #include <linux/workqueue.h>
7 #include <asm/ccwdev.h>
9 #define VERSION_LCS_H "$Revision: 1.17 $"
11 #define LCS_DBF_TEXT(level, name, text) \
13 debug_text_event(lcs_dbf_##name, level, text); \
16 #define LCS_DBF_HEX(level,name,addr,len) \
18 debug_event(lcs_dbf_##name,level,(void*)(addr),len); \
21 #define LCS_DBF_TEXT_(level,name,text...) \
23 sprintf(debug_buffer, text); \
24 debug_text_event(lcs_dbf_##name,level, debug_buffer);\
28 * some more definitions for debug or output stuff
30 #define PRINTK_HEADER " lcs: "
35 #define CARD_FROM_DEV(cdev) \
37 ((struct ccwgroup_device *)cdev->dev.driver_data)->dev.driver_data;
39 * CCW commands used in this driver
41 #define LCS_CCW_WRITE 0x01
42 #define LCS_CCW_READ 0x02
43 #define LCS_CCW_TRANSFER 0x08
46 * LCS device status primitives
48 #define LCS_CMD_STARTLAN 0x01
49 #define LCS_CMD_STOPLAN 0x02
50 #define LCS_CMD_LANSTAT 0x04
51 #define LCS_CMD_STARTUP 0x07
52 #define LCS_CMD_SHUTDOWN 0x08
53 #define LCS_CMD_QIPASSIST 0xb2
54 #define LCS_CMD_SETIPM 0xb4
55 #define LCS_CMD_DELIPM 0xb5
57 #define LCS_INITIATOR_TCPIP 0x00
58 #define LCS_INITIATOR_LGW 0x01
59 #define LCS_STD_CMD_SIZE 16
60 #define LCS_MULTICAST_CMD_SIZE 404
63 * LCS IPASSIST MASKS,only used when multicast is switched on
65 /* Not supported by LCS */
66 #define LCS_IPASS_ARP_PROCESSING 0x0001
67 #define LCS_IPASS_IN_CHECKSUM_SUPPORT 0x0002
68 #define LCS_IPASS_OUT_CHECKSUM_SUPPORT 0x0004
69 #define LCS_IPASS_IP_FRAG_REASSEMBLY 0x0008
70 #define LCS_IPASS_IP_FILTERING 0x0010
71 /* Supported by lcs 3172 */
72 #define LCS_IPASS_IPV6_SUPPORT 0x0020
73 #define LCS_IPASS_MULTICAST_SUPPORT 0x0040
76 * LCS sense byte definitions
78 #define LCS_SENSE_INTERFACE_DISCONNECT 0x01
79 #define LCS_SENSE_EQUIPMENT_CHECK 0x10
80 #define LCS_SENSE_BUS_OUT_CHECK 0x20
81 #define LCS_SENSE_INTERVENTION_REQUIRED 0x40
82 #define LCS_SENSE_CMD_REJECT 0x80
83 #define LCS_SENSE_RESETTING_EVENT 0x0080
84 #define LCS_SENSE_DEVICE_ONLINE 0x0020
87 * LCS packet type definitions
89 #define LCS_FRAME_TYPE_CONTROL 0
90 #define LCS_FRAME_TYPE_ENET 1
91 #define LCS_FRAME_TYPE_TR 2
92 #define LCS_FRAME_TYPE_FDDI 7
93 #define LCS_FRAME_TYPE_AUTO -1
96 * some more definitions,we will sort them later
98 #define LCS_ILLEGAL_OFFSET 0xffff
99 #define LCS_IOBUFFERSIZE 0x5000
100 #define LCS_NUM_BUFFS 8 /* needs to be power of 2 */
101 #define LCS_MAC_LENGTH 6
102 #define LCS_INVALID_PORT_NO -1
103 #define LCS_LANCMD_TIMEOUT_DEFAULT 5
108 #define LCS_IPM_STATE_SET_REQUIRED 0
109 #define LCS_IPM_STATE_DEL_REQUIRED 1
110 #define LCS_IPM_STATE_ON_CARD 2
113 * LCS IP Assist declarations
114 * seems to be only used for multicast
116 #define LCS_IPASS_ARP_PROCESSING 0x0001
117 #define LCS_IPASS_INBOUND_CSUM_SUPP 0x0002
118 #define LCS_IPASS_OUTBOUND_CSUM_SUPP 0x0004
119 #define LCS_IPASS_IP_FRAG_REASSEMBLY 0x0008
120 #define LCS_IPASS_IP_FILTERING 0x0010
121 #define LCS_IPASS_IPV6_SUPPORT 0x0020
122 #define LCS_IPASS_MULTICAST_SUPPORT 0x0040
127 enum lcs_buffer_states {
128 BUF_STATE_EMPTY, /* buffer is empty */
129 BUF_STATE_LOCKED, /* buffer is locked, don't touch */
130 BUF_STATE_READY, /* buffer is ready for read/write */
135 * LCS Channel State Machine declarations
137 enum lcs_channel_states {
147 * LCS device state machine
149 enum lcs_dev_states {
156 * LCS struct declarations
162 } __attribute__ ((packed));
164 struct lcs_ip_mac_pair {
166 __u8 mac_addr[LCS_MAC_LENGTH];
168 } __attribute__ ((packed));
170 struct lcs_ipm_list {
171 struct list_head list;
172 struct lcs_ip_mac_pair ipm;
188 __u16 parameter_count;
189 __u8 operator_flags[3];
201 __u8 mac_addr[LCS_MAC_LENGTH];
202 __u32 num_packets_deblocked;
203 __u32 num_packets_blocked;
204 __u32 num_packets_tx_on_lan;
205 __u32 num_tx_errors_detected;
206 __u32 num_tx_packets_disgarded;
207 __u32 num_packets_rx_from_lan;
208 __u32 num_rx_errors_detected;
209 __u32 num_rx_discarded_nobuffs_avail;
210 __u32 num_rx_packets_too_large;
212 #ifdef CONFIG_IP_MULTICAST
217 __u16 ip_assists_supported;
218 __u16 ip_assists_enabled;
221 struct lcs_ip_mac_pair
224 } lcs_ipass_ctlmsg __attribute ((packed));
225 } lcs_qipassist __attribute__ ((packed));
226 #endif /*CONFIG_IP_MULTICAST */
227 } cmd __attribute__ ((packed));
228 } __attribute__ ((packed));
231 * Forward declarations.
237 * Definition of an lcs buffer.
240 enum lcs_buffer_states state;
243 /* Callback for completion notification. */
244 void (*callback)(struct lcs_channel *, struct lcs_buffer *);
248 struct list_head list;
250 /* Callback for completion notification. */
251 void (*callback)(struct lcs_card *, struct lcs_cmd *);
252 wait_queue_head_t wait_q;
258 * Definition of an lcs channel
261 enum lcs_channel_states state;
262 struct ccw_device *ccwdev;
263 struct ccw1 ccws[LCS_NUM_BUFFS + 1];
264 wait_queue_head_t wait_q;
265 struct tasklet_struct irq_tasklet;
266 struct lcs_buffer iob[LCS_NUM_BUFFS];
272 * definition of the lcs card
277 enum lcs_dev_states state;
278 struct net_device *dev;
279 struct net_device_stats stats;
280 unsigned short (*lan_type_trans)(struct sk_buff *skb,
281 struct net_device *dev);
282 struct lcs_channel read;
283 struct lcs_channel write;
284 struct lcs_buffer *tx_buffer;
286 struct list_head lancmd_waiters;
289 struct work_struct kernel_thread_starter;
290 unsigned long thread_mask;
292 #ifdef CONFIG_IP_MULTICAST
293 struct list_head ipm_list;
295 __u8 mac[LCS_MAC_LENGTH];
296 __u16 ip_assists_supported;
297 __u16 ip_assists_enabled;
301 /* Some info copied from probeinfo */
305 s16 port_protocol_no;
306 } __attribute__ ((aligned(8)));