2014-05-19 01:21:02 +00:00
|
|
|
/******************************************************************************
|
|
|
|
|
|
|
|
Copyright (c) 2013-2014, Intel Corporation
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
this list of conditions and the following disclaimer.
|
|
|
|
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
|
|
|
documentation and/or other materials provided with the distribution.
|
|
|
|
|
|
|
|
3. Neither the name of the Intel Corporation nor the names of its
|
|
|
|
contributors may be used to endorse or promote products derived from
|
|
|
|
this software without specific prior written permission.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
******************************************************************************/
|
|
|
|
/*$FreeBSD$*/
|
|
|
|
|
|
|
|
#ifndef _I40E_ADMINQ_H_
|
|
|
|
#define _I40E_ADMINQ_H_
|
|
|
|
|
|
|
|
#include "i40e_osdep.h"
|
2015-01-12 18:32:45 +00:00
|
|
|
#include "i40e_status.h"
|
2014-05-19 01:21:02 +00:00
|
|
|
#include "i40e_adminq_cmd.h"
|
|
|
|
|
|
|
|
#define I40E_ADMINQ_DESC(R, i) \
|
|
|
|
(&(((struct i40e_aq_desc *)((R).desc_buf.va))[i]))
|
|
|
|
|
|
|
|
#define I40E_ADMINQ_DESC_ALIGNMENT 4096
|
|
|
|
|
|
|
|
struct i40e_adminq_ring {
|
|
|
|
struct i40e_virt_mem dma_head; /* space for dma structures */
|
|
|
|
struct i40e_dma_mem desc_buf; /* descriptor ring memory */
|
|
|
|
struct i40e_virt_mem cmd_buf; /* command buffer memory */
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct i40e_dma_mem *asq_bi;
|
|
|
|
struct i40e_dma_mem *arq_bi;
|
|
|
|
} r;
|
|
|
|
|
|
|
|
u16 count; /* Number of descriptors */
|
|
|
|
u16 rx_buf_len; /* Admin Receive Queue buffer length */
|
|
|
|
|
|
|
|
/* used for interrupt processing */
|
|
|
|
u16 next_to_use;
|
|
|
|
u16 next_to_clean;
|
|
|
|
|
|
|
|
/* used for queue tracking */
|
|
|
|
u32 head;
|
|
|
|
u32 tail;
|
|
|
|
u32 len;
|
2014-07-28 21:57:09 +00:00
|
|
|
u32 bah;
|
|
|
|
u32 bal;
|
2014-05-19 01:21:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* ASQ transaction details */
|
|
|
|
struct i40e_asq_cmd_details {
|
|
|
|
void *callback; /* cast from type I40E_ADMINQ_CALLBACK */
|
|
|
|
u64 cookie;
|
|
|
|
u16 flags_ena;
|
|
|
|
u16 flags_dis;
|
|
|
|
bool async;
|
|
|
|
bool postpone;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define I40E_ADMINQ_DETAILS(R, i) \
|
|
|
|
(&(((struct i40e_asq_cmd_details *)((R).cmd_buf.va))[i]))
|
|
|
|
|
|
|
|
/* ARQ event information */
|
|
|
|
struct i40e_arq_event_info {
|
|
|
|
struct i40e_aq_desc desc;
|
2014-08-22 18:59:19 +00:00
|
|
|
u16 msg_len;
|
|
|
|
u16 buf_len;
|
2014-05-19 01:21:02 +00:00
|
|
|
u8 *msg_buf;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Admin Queue information */
|
|
|
|
struct i40e_adminq_info {
|
|
|
|
struct i40e_adminq_ring arq; /* receive queue */
|
|
|
|
struct i40e_adminq_ring asq; /* send queue */
|
2014-07-28 21:57:09 +00:00
|
|
|
u32 asq_cmd_timeout; /* send queue cmd write back timeout*/
|
2014-05-19 01:21:02 +00:00
|
|
|
u16 num_arq_entries; /* receive queue depth */
|
|
|
|
u16 num_asq_entries; /* send queue depth */
|
|
|
|
u16 arq_buf_size; /* receive queue buffer size */
|
|
|
|
u16 asq_buf_size; /* send queue buffer size */
|
|
|
|
u16 fw_maj_ver; /* firmware major version */
|
|
|
|
u16 fw_min_ver; /* firmware minor version */
|
2015-01-12 18:32:45 +00:00
|
|
|
u32 fw_build; /* firmware build number */
|
2014-05-19 01:21:02 +00:00
|
|
|
u16 api_maj_ver; /* api major version */
|
|
|
|
u16 api_min_ver; /* api minor version */
|
|
|
|
bool nvm_release_on_done;
|
|
|
|
|
|
|
|
struct i40e_spinlock asq_spinlock; /* Send queue spinlock */
|
|
|
|
struct i40e_spinlock arq_spinlock; /* Receive queue spinlock */
|
|
|
|
|
|
|
|
/* last status values on send and receive queues */
|
|
|
|
enum i40e_admin_queue_err asq_last_status;
|
|
|
|
enum i40e_admin_queue_err arq_last_status;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* general information */
|
2014-07-28 21:57:09 +00:00
|
|
|
#define I40E_AQ_LARGE_BUF 512
|
2015-01-12 18:32:45 +00:00
|
|
|
#define I40E_ASQ_CMD_TIMEOUT 250 /* msecs */
|
2014-05-19 01:21:02 +00:00
|
|
|
|
|
|
|
void i40e_fill_default_direct_cmd_desc(struct i40e_aq_desc *desc,
|
|
|
|
u16 opcode);
|
|
|
|
|
|
|
|
#endif /* _I40E_ADMINQ_H_ */
|