1 /**************************************************************************
3 * Copyright (c) 2000-2002 Alacritech, Inc. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials provided
15 * with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY ALACRITECH, INC. ``AS IS'' AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ALACRITECH, INC. OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * The views and conclusions contained in the software and documentation
31 * are those of the authors and should not be interpreted as representing
32 * official policies, either expressed or implied, of Alacritech, Inc.
34 **************************************************************************/
39 * This file contains all other include files and prototype definitions
40 * for the SLICOSS driver.
42 #ifndef _SLIC_INCLUDE_H_
43 #define _SLIC_INCLUDE_H_
50 static int slic_entry_probe(struct pci_dev *pcidev,
51 const struct pci_device_id *ent);
52 static void slic_entry_remove(struct pci_dev *pcidev);
54 static void slic_init_driver(void);
55 static int slic_entry_open(struct net_device *dev);
56 static int slic_entry_halt(struct net_device *dev);
57 static int slic_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
58 static int slic_xmit_start(struct sk_buff *skb, struct net_device *dev);
59 static void slic_xmit_fail(struct adapter *adapter,
64 static void slic_config_pci(struct pci_dev *pcidev);
65 static struct sk_buff *slic_rcvqueue_getnext(struct adapter *adapter);
67 static inline void slic_reg32_write(void __iomem *reg, u32 value, uint flush);
68 static inline void slic_reg64_write(struct adapter *adapter, void __iomem *reg,
69 u32 value, void __iomem *regh, u32 paddrh, uint flush);
71 #if SLIC_GET_STATS_ENABLED
72 static struct net_device_stats *slic_get_stats(struct net_device *dev);
75 static int slic_mac_set_address(struct net_device *dev, void *ptr);
76 static void slic_rcv_handler(struct adapter *adapter);
77 static void slic_link_event_handler(struct adapter *adapter);
78 static void slic_xmit_complete(struct adapter *adapter);
79 static void slic_upr_request_complete(struct adapter *adapter, u32 isr);
80 static int slic_rspqueue_init(struct adapter *adapter);
81 static int slic_rspqueue_reset(struct adapter *adapter);
82 static void slic_rspqueue_free(struct adapter *adapter);
83 static struct slic_rspbuf *slic_rspqueue_getnext(struct adapter *adapter);
84 static void slic_cmdqmem_init(struct adapter *adapter);
85 static void slic_cmdqmem_free(struct adapter *adapter);
86 static u32 *slic_cmdqmem_addpage(struct adapter *adapter);
87 static int slic_cmdq_init(struct adapter *adapter);
88 static void slic_cmdq_free(struct adapter *adapter);
89 static void slic_cmdq_reset(struct adapter *adapter);
90 static void slic_cmdq_addcmdpage(struct adapter *adapter, u32 *page);
91 static void slic_cmdq_getdone(struct adapter *adapter);
92 static void slic_cmdq_putdone_irq(struct adapter *adapter,
93 struct slic_hostcmd *cmd);
94 static struct slic_hostcmd *slic_cmdq_getfree(struct adapter *adapter);
95 static int slic_rcvqueue_init(struct adapter *adapter);
96 static int slic_rcvqueue_reset(struct adapter *adapter);
97 static int slic_rcvqueue_fill(struct adapter *adapter);
98 static u32 slic_rcvqueue_reinsert(struct adapter *adapter, struct sk_buff *skb);
99 static void slic_rcvqueue_free(struct adapter *adapter);
100 static void slic_rcv_handle_error(struct adapter *adapter,
101 struct slic_rcvbuf *rcvbuf);
102 static void slic_adapter_set_hwaddr(struct adapter *adapter);
103 static int slic_card_init(struct sliccard *card, struct adapter *adapter);
104 static void slic_intagg_set(struct adapter *adapter, u32 value);
105 static int slic_card_download(struct adapter *adapter);
106 static u32 slic_card_locate(struct adapter *adapter);
108 static void slic_if_stop_queue(struct adapter *adapter);
109 static void slic_if_start_queue(struct adapter *adapter);
110 static int slic_if_init(struct adapter *adapter);
111 static int slic_adapter_allocresources(struct adapter *adapter);
112 static void slic_adapter_freeresources(struct adapter *adapter);
113 static void slic_link_config(struct adapter *adapter, u32 linkspeed,
115 static void slic_unmap_mmio_space(struct adapter *adapter);
116 static void slic_card_cleanup(struct sliccard *card);
117 static void slic_init_cleanup(struct adapter *adapter);
118 static void slic_soft_reset(struct adapter *adapter);
119 static bool slic_mac_filter(struct adapter *adapter,
120 struct ether_header *ether_frame);
121 static void slic_mac_address_config(struct adapter *adapter);
122 static void slic_mac_config(struct adapter *adapter);
123 static void slic_mcast_set_mask(struct adapter *adapter);
124 static int slic_mcast_add_list(struct adapter *adapter, char *address);
125 static unsigned char slic_mcast_get_mac_hash(char *macaddr);
126 static void slic_mcast_set_bit(struct adapter *adapter, char *address);
127 static void slic_config_set(struct adapter *adapter, bool linkchange);
128 static void slic_config_clear(struct adapter *adapter);
129 static void slic_config_get(struct adapter *adapter, u32 config,
131 static void slic_timer_load_check(ulong context);
132 static void slic_timer_ping(ulong dev);
133 static void slic_assert_fail(void);
134 static ushort slic_eeprom_cksum(char *m, int len);
136 static void slic_upr_start(struct adapter *adapter);
137 static void slic_link_upr_complete(struct adapter *adapter, u32 Isr);
138 static int slic_upr_request(struct adapter *adapter,
144 static int slic_upr_queue_request(struct adapter *adapter,
150 static void slic_mcast_set_list(struct net_device *dev);
151 static void slic_mcast_init_crc32(void);
153 #if SLIC_DUMP_ENABLED
154 static int slic_dump_thread(void *context);
155 static uint slic_init_dump_thread(struct sliccard *card);
156 static unsigned char slic_get_dump_index(char *path);
157 static u32 slic_dump_card(struct sliccard *card, bool resume);
158 static u32 slic_dump_halt(struct sliccard *card, unsigned char proc);
159 static u32 slic_dump_reg(struct sliccard *card, unsigned char proc);
160 static u32 slic_dump_data(struct sliccard *card, u32 addr,
161 ushort count, unsigned char desc);
162 static u32 slic_dump_queue(struct sliccard *card, u32 buf_phys,
163 u32 buf_physh, u32 queue);
164 static u32 slic_dump_load_queue(struct sliccard *card, u32 data,
166 static u32 slic_dump_cam(struct sliccard *card, u32 addr,
167 u32 count, unsigned char desc);
169 static u32 slic_dump_resume(struct sliccard *card, unsigned char proc);
170 static u32 slic_dump_send_cmd(struct sliccard *card, u32 cmd_phys,
171 u32 cmd_physh, u32 buf_phys,
174 #define create_file(x) STATUS_SUCCESS
175 #define write_file(w, x, y, z) STATUS_SUCCESS
176 #define close_file(x) STATUS_SUCCESS
177 #define read_file(w, x, y, z) STATUS_SUCCESS
178 #define open_file(x) STATUS_SUCCESS
181 #define DUMP_PAGE_SIZE 0xFFFF
182 #define DUMP_PAGE_SIZE_HALF 0x7FFE
185 #endif /* _SLIC_INCLUDE_H_ */