xref: /freebsd/sys/dev/ixl/i40e_alloc.h (revision 61ae650d55553d48c55fbe023706dfa4b97483bb)
1*61ae650dSJack F Vogel /******************************************************************************
2*61ae650dSJack F Vogel 
3*61ae650dSJack F Vogel   Copyright (c) 2013-2014, Intel Corporation
4*61ae650dSJack F Vogel   All rights reserved.
5*61ae650dSJack F Vogel 
6*61ae650dSJack F Vogel   Redistribution and use in source and binary forms, with or without
7*61ae650dSJack F Vogel   modification, are permitted provided that the following conditions are met:
8*61ae650dSJack F Vogel 
9*61ae650dSJack F Vogel    1. Redistributions of source code must retain the above copyright notice,
10*61ae650dSJack F Vogel       this list of conditions and the following disclaimer.
11*61ae650dSJack F Vogel 
12*61ae650dSJack F Vogel    2. Redistributions in binary form must reproduce the above copyright
13*61ae650dSJack F Vogel       notice, this list of conditions and the following disclaimer in the
14*61ae650dSJack F Vogel       documentation and/or other materials provided with the distribution.
15*61ae650dSJack F Vogel 
16*61ae650dSJack F Vogel    3. Neither the name of the Intel Corporation nor the names of its
17*61ae650dSJack F Vogel       contributors may be used to endorse or promote products derived from
18*61ae650dSJack F Vogel       this software without specific prior written permission.
19*61ae650dSJack F Vogel 
20*61ae650dSJack F Vogel   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21*61ae650dSJack F Vogel   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22*61ae650dSJack F Vogel   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23*61ae650dSJack F Vogel   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24*61ae650dSJack F Vogel   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25*61ae650dSJack F Vogel   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26*61ae650dSJack F Vogel   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27*61ae650dSJack F Vogel   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28*61ae650dSJack F Vogel   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29*61ae650dSJack F Vogel   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30*61ae650dSJack F Vogel   POSSIBILITY OF SUCH DAMAGE.
31*61ae650dSJack F Vogel 
32*61ae650dSJack F Vogel ******************************************************************************/
33*61ae650dSJack F Vogel /*$FreeBSD$*/
34*61ae650dSJack F Vogel 
35*61ae650dSJack F Vogel #ifndef _I40E_ALLOC_H_
36*61ae650dSJack F Vogel #define _I40E_ALLOC_H_
37*61ae650dSJack F Vogel 
38*61ae650dSJack F Vogel struct i40e_hw;
39*61ae650dSJack F Vogel 
40*61ae650dSJack F Vogel /* Memory allocation types */
41*61ae650dSJack F Vogel enum i40e_memory_type {
42*61ae650dSJack F Vogel 	i40e_mem_arq_buf = 0,		/* ARQ indirect command buffer */
43*61ae650dSJack F Vogel 	i40e_mem_asq_buf = 1,
44*61ae650dSJack F Vogel 	i40e_mem_atq_buf = 2,		/* ATQ indirect command buffer */
45*61ae650dSJack F Vogel 	i40e_mem_arq_ring = 3,		/* ARQ descriptor ring */
46*61ae650dSJack F Vogel 	i40e_mem_atq_ring = 4,		/* ATQ descriptor ring */
47*61ae650dSJack F Vogel 	i40e_mem_pd = 5,		/* Page Descriptor */
48*61ae650dSJack F Vogel 	i40e_mem_bp = 6,		/* Backing Page - 4KB */
49*61ae650dSJack F Vogel 	i40e_mem_bp_jumbo = 7,		/* Backing Page - > 4KB */
50*61ae650dSJack F Vogel 	i40e_mem_reserved
51*61ae650dSJack F Vogel };
52*61ae650dSJack F Vogel 
53*61ae650dSJack F Vogel /* prototype for functions used for dynamic memory allocation */
54*61ae650dSJack F Vogel enum i40e_status_code i40e_allocate_dma_mem(struct i40e_hw *hw,
55*61ae650dSJack F Vogel 					    struct i40e_dma_mem *mem,
56*61ae650dSJack F Vogel 					    enum i40e_memory_type type,
57*61ae650dSJack F Vogel 					    u64 size, u32 alignment);
58*61ae650dSJack F Vogel enum i40e_status_code i40e_free_dma_mem(struct i40e_hw *hw,
59*61ae650dSJack F Vogel 					struct i40e_dma_mem *mem);
60*61ae650dSJack F Vogel enum i40e_status_code i40e_allocate_virt_mem(struct i40e_hw *hw,
61*61ae650dSJack F Vogel 					     struct i40e_virt_mem *mem,
62*61ae650dSJack F Vogel 					     u32 size);
63*61ae650dSJack F Vogel enum i40e_status_code i40e_free_virt_mem(struct i40e_hw *hw,
64*61ae650dSJack F Vogel 					 struct i40e_virt_mem *mem);
65*61ae650dSJack F Vogel 
66*61ae650dSJack F Vogel #endif /* _I40E_ALLOC_H_ */
67