xref: /freebsd/sys/dev/ixl/i40e_alloc.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
161ae650dSJack F Vogel /******************************************************************************
261ae650dSJack F Vogel 
3*f4cc2d17SEric Joyner   Copyright (c) 2013-2018, Intel Corporation
461ae650dSJack F Vogel   All rights reserved.
561ae650dSJack F Vogel 
661ae650dSJack F Vogel   Redistribution and use in source and binary forms, with or without
761ae650dSJack F Vogel   modification, are permitted provided that the following conditions are met:
861ae650dSJack F Vogel 
961ae650dSJack F Vogel    1. Redistributions of source code must retain the above copyright notice,
1061ae650dSJack F Vogel       this list of conditions and the following disclaimer.
1161ae650dSJack F Vogel 
1261ae650dSJack F Vogel    2. Redistributions in binary form must reproduce the above copyright
1361ae650dSJack F Vogel       notice, this list of conditions and the following disclaimer in the
1461ae650dSJack F Vogel       documentation and/or other materials provided with the distribution.
1561ae650dSJack F Vogel 
1661ae650dSJack F Vogel    3. Neither the name of the Intel Corporation nor the names of its
1761ae650dSJack F Vogel       contributors may be used to endorse or promote products derived from
1861ae650dSJack F Vogel       this software without specific prior written permission.
1961ae650dSJack F Vogel 
2061ae650dSJack F Vogel   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2161ae650dSJack F Vogel   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2261ae650dSJack F Vogel   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2361ae650dSJack F Vogel   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2461ae650dSJack F Vogel   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2561ae650dSJack F Vogel   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2661ae650dSJack F Vogel   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2761ae650dSJack F Vogel   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2861ae650dSJack F Vogel   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2961ae650dSJack F Vogel   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3061ae650dSJack F Vogel   POSSIBILITY OF SUCH DAMAGE.
3161ae650dSJack F Vogel 
3261ae650dSJack F Vogel ******************************************************************************/
3361ae650dSJack F Vogel 
3461ae650dSJack F Vogel #ifndef _I40E_ALLOC_H_
3561ae650dSJack F Vogel #define _I40E_ALLOC_H_
3661ae650dSJack F Vogel 
3761ae650dSJack F Vogel struct i40e_hw;
3861ae650dSJack F Vogel 
3961ae650dSJack F Vogel /* Memory allocation types */
4061ae650dSJack F Vogel enum i40e_memory_type {
4161ae650dSJack F Vogel 	i40e_mem_arq_buf = 0,		/* ARQ indirect command buffer */
4261ae650dSJack F Vogel 	i40e_mem_asq_buf = 1,
4361ae650dSJack F Vogel 	i40e_mem_atq_buf = 2,		/* ATQ indirect command buffer */
4461ae650dSJack F Vogel 	i40e_mem_arq_ring = 3,		/* ARQ descriptor ring */
4561ae650dSJack F Vogel 	i40e_mem_atq_ring = 4,		/* ATQ descriptor ring */
4661ae650dSJack F Vogel 	i40e_mem_pd = 5,		/* Page Descriptor */
4761ae650dSJack F Vogel 	i40e_mem_bp = 6,		/* Backing Page - 4KB */
4861ae650dSJack F Vogel 	i40e_mem_bp_jumbo = 7,		/* Backing Page - > 4KB */
4961ae650dSJack F Vogel 	i40e_mem_reserved
5061ae650dSJack F Vogel };
5161ae650dSJack F Vogel 
5261ae650dSJack F Vogel /* prototype for functions used for dynamic memory allocation */
53d94ca7cfSBjoern A. Zeeb enum i40e_status_code i40e_allocate_dma_mem(struct i40e_hw *hw,
5461ae650dSJack F Vogel 					    struct i40e_dma_mem *mem,
55d94ca7cfSBjoern A. Zeeb 					    enum i40e_memory_type type,
56d94ca7cfSBjoern A. Zeeb 					    u64 size, u32 alignment);
57d94ca7cfSBjoern A. Zeeb enum i40e_status_code i40e_free_dma_mem(struct i40e_hw *hw,
5861ae650dSJack F Vogel 					struct i40e_dma_mem *mem);
59d94ca7cfSBjoern A. Zeeb enum i40e_status_code i40e_allocate_virt_mem(struct i40e_hw *hw,
6061ae650dSJack F Vogel 					     struct i40e_virt_mem *mem,
6161ae650dSJack F Vogel 					     u32 size);
62d94ca7cfSBjoern A. Zeeb enum i40e_status_code i40e_free_virt_mem(struct i40e_hw *hw,
6361ae650dSJack F Vogel 					 struct i40e_virt_mem *mem);
6461ae650dSJack F Vogel 
6561ae650dSJack F Vogel #endif /* _I40E_ALLOC_H_ */
66