blob: 9c3c3b0d3ac46ed2c9be2f5bfb9aae751b5ed9bc [file] [log] [blame]
Jeff Kirsherae06c702018-03-22 10:08:48 -07001/* SPDX-License-Identifier: GPL-2.0 */
Jesse Brandeburg7daa6bf2013-09-11 08:40:01 +00002/*******************************************************************************
3 *
4 * Intel Ethernet Controller XL710 Family Linux Driver
Greg Rosedc641b72013-12-18 13:45:51 +00005 * Copyright(c) 2013 - 2014 Intel Corporation.
Jesse Brandeburg7daa6bf2013-09-11 08:40:01 +00006 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
Greg Rosedc641b72013-12-18 13:45:51 +000016 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
Jesse Brandeburg7daa6bf2013-09-11 08:40:01 +000018 *
19 * The full GNU General Public License is included in this distribution in
20 * the file called "COPYING".
21 *
22 * Contact Information:
23 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25 *
26 ******************************************************************************/
27
28#ifndef _I40E_OSDEP_H_
29#define _I40E_OSDEP_H_
30
31#include <linux/types.h>
32#include <linux/if_ether.h>
33#include <linux/if_vlan.h>
34#include <linux/tcp.h>
35#include <linux/pci.h>
36#include <linux/highuid.h>
37
38/* get readq/writeq support for 32 bit kernels, use the low-first version */
Christoph Hellwig2f8e2c82015-08-28 09:27:14 +020039#include <linux/io-64-nonatomic-lo-hi.h>
Jesse Brandeburg7daa6bf2013-09-11 08:40:01 +000040
41/* File to be the magic between shared code and
42 * actual OS primitives
43 */
44
45#define hw_dbg(hw, S, A...) do {} while (0)
46
47#define wr32(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
48#define rd32(a, reg) readl((a)->hw_addr + (reg))
49
50#define wr64(a, reg, value) writeq((value), ((a)->hw_addr + (reg)))
51#define rd64(a, reg) readq((a)->hw_addr + (reg))
52#define i40e_flush(a) readl((a)->hw_addr + I40E_GLGEN_STAT)
53
54/* memory allocation tracking */
55struct i40e_dma_mem {
56 void *va;
57 dma_addr_t pa;
58 u32 size;
Tushar Dave95883972016-11-19 13:53:58 -080059};
Jesse Brandeburg7daa6bf2013-09-11 08:40:01 +000060
61#define i40e_allocate_dma_mem(h, m, unused, s, a) \
62 i40e_allocate_dma_mem_d(h, m, s, a)
63#define i40e_free_dma_mem(h, m) i40e_free_dma_mem_d(h, m)
64
65struct i40e_virt_mem {
66 void *va;
67 u32 size;
Tushar Dave95883972016-11-19 13:53:58 -080068};
Jesse Brandeburg7daa6bf2013-09-11 08:40:01 +000069
70#define i40e_allocate_virt_mem(h, m, s) i40e_allocate_virt_mem_d(h, m, s)
71#define i40e_free_virt_mem(h, m) i40e_free_virt_mem_d(h, m)
72
Sudheer Mogilappagarib3f028f2017-02-09 23:58:22 -080073#define i40e_debug(h, m, s, ...) \
74do { \
75 if (((m) & (h)->debug_mask)) \
76 pr_info("i40e %02x:%02x.%x " s, \
77 (h)->bus.bus_id, (h)->bus.device, \
78 (h)->bus.func, ##__VA_ARGS__); \
Jesse Brandeburg7daa6bf2013-09-11 08:40:01 +000079} while (0)
80
81typedef enum i40e_status_code i40e_status;
Jesse Brandeburg7daa6bf2013-09-11 08:40:01 +000082#endif /* _I40E_OSDEP_H_ */