iPXE
Functions
igbvf_mbx.c File Reference
#include "igbvf_mbx.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_ONLY)
 
static s32 igbvf_poll_for_msg (struct e1000_hw *hw, u16 mbx_id)
 igbvf_poll_for_msg - Wait for message notification @hw: pointer to the HW structure @mbx_id: id of mailbox to write More...
 
static s32 igbvf_poll_for_ack (struct e1000_hw *hw, u16 mbx_id)
 igbvf_poll_for_ack - Wait for message acknowledgement @hw: pointer to the HW structure @mbx_id: id of mailbox to write More...
 
static s32 igbvf_read_posted_mbx (struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
 igbvf_read_posted_mbx - Wait for message notification and receive message @hw: pointer to the HW structure @msg: The message buffer @size: Length of buffer @mbx_id: id of mailbox to write More...
 
static s32 igbvf_write_posted_mbx (struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
 igbvf_write_posted_mbx - Write a message to the mailbox, wait for ack @hw: pointer to the HW structure @msg: The message buffer @size: Length of buffer @mbx_id: id of mailbox to write More...
 
void igbvf_init_mbx_ops_generic (struct e1000_hw *hw)
 igbvf_init_mbx_ops_generic - Initialize NVM function pointers @hw: pointer to the HW structure More...
 
static u32 igbvf_read_v2p_mailbox (struct e1000_hw *hw)
 igbvf_read_v2p_mailbox - read v2p mailbox @hw: pointer to the HW structure More...
 
static s32 igbvf_check_for_bit_vf (struct e1000_hw *hw, u32 mask)
 igbvf_check_for_bit_vf - Determine if a status bit was set @hw: pointer to the HW structure @mask: bitmask for bits to be tested and cleared More...
 
static s32 igbvf_check_for_msg_vf (struct e1000_hw *hw, u16 mbx_id __unused)
 igbvf_check_for_msg_vf - checks to see if the PF has sent mail @hw: pointer to the HW structure @mbx_id: id of mailbox to check More...
 
static s32 igbvf_check_for_ack_vf (struct e1000_hw *hw, u16 mbx_id __unused)
 igbvf_check_for_ack_vf - checks to see if the PF has ACK'd @hw: pointer to the HW structure @mbx_id: id of mailbox to check More...
 
static s32 igbvf_check_for_rst_vf (struct e1000_hw *hw, u16 mbx_id __unused)
 igbvf_check_for_rst_vf - checks to see if the PF has reset @hw: pointer to the HW structure @mbx_id: id of mailbox to check More...
 
static s32 igbvf_obtain_mbx_lock_vf (struct e1000_hw *hw)
 igbvf_obtain_mbx_lock_vf - obtain mailbox lock @hw: pointer to the HW structure More...
 
static s32 igbvf_write_mbx_vf (struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id __unused)
 igbvf_write_mbx_vf - Write a message to the mailbox @hw: pointer to the HW structure @msg: The message buffer @size: Length of buffer @mbx_id: id of mailbox to write More...
 
static s32 igbvf_read_mbx_vf (struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id __unused)
 igbvf_read_mbx_vf - Reads a message from the inbox intended for vf @hw: pointer to the HW structure @msg: The message buffer @size: Length of buffer @mbx_id: id of mailbox to read More...
 
s32 igbvf_init_mbx_params_vf (struct e1000_hw *hw)
 igbvf_init_mbx_params_vf - set initial values for vf mailbox @hw: pointer to the HW structure More...
 

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_ONLY  )

◆ igbvf_poll_for_msg()

static s32 igbvf_poll_for_msg ( struct e1000_hw hw,
u16  mbx_id 
)
static

igbvf_poll_for_msg - Wait for message notification @hw: pointer to the HW structure @mbx_id: id of mailbox to write

returns SUCCESS if it successfully received a message notification

Definition at line 40 of file igbvf_mbx.c.

41 {
42  struct e1000_mbx_info *mbx = &hw->mbx;
43  int countdown = mbx->timeout;
44 
45  DEBUGFUNC("igbvf_poll_for_msg");
46 
47  if (!countdown || !mbx->ops.check_for_msg)
48  goto out;
49 
50  while (countdown && mbx->ops.check_for_msg(hw, mbx_id)) {
51  countdown--;
52  if (!countdown)
53  break;
54  usec_delay(mbx->usec_delay);
55  }
56 
57  /* if we failed, all future posted messages fail until reset */
58  if (!countdown)
59  mbx->timeout = 0;
60 out:
61  return countdown ? E1000_SUCCESS : -E1000_ERR_MBX;
62 }
Definition: hw.c:16
__be32 out[4]
Definition: CIB_PRM.h:36
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
#define usec_delay(x)
Definition: igbvf_osdep.h:59
#define E1000_SUCCESS
#define E1000_ERR_MBX
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71
s32(* check_for_msg)(struct e1000_hw *, u16)
Definition: igbvf_vf.h:283

References e1000_mbx_operations::check_for_msg, DEBUGFUNC, E1000_ERR_MBX, E1000_SUCCESS, e1000_mbx_info::ops, out, e1000_mbx_info::timeout, usec_delay, and e1000_mbx_info::usec_delay.

Referenced by igbvf_read_posted_mbx().

◆ igbvf_poll_for_ack()

static s32 igbvf_poll_for_ack ( struct e1000_hw hw,
u16  mbx_id 
)
static

igbvf_poll_for_ack - Wait for message acknowledgement @hw: pointer to the HW structure @mbx_id: id of mailbox to write

returns SUCCESS if it successfully received a message acknowledgement

Definition at line 71 of file igbvf_mbx.c.

72 {
73  struct e1000_mbx_info *mbx = &hw->mbx;
74  int countdown = mbx->timeout;
75 
76  DEBUGFUNC("igbvf_poll_for_ack");
77 
78  if (!countdown || !mbx->ops.check_for_ack)
79  goto out;
80 
81  while (countdown && mbx->ops.check_for_ack(hw, mbx_id)) {
82  countdown--;
83  if (!countdown)
84  break;
85  usec_delay(mbx->usec_delay);
86  }
87 
88  /* if we failed, all future posted messages fail until reset */
89  if (!countdown)
90  mbx->timeout = 0;
91 out:
92  return countdown ? E1000_SUCCESS : -E1000_ERR_MBX;
93 }
Definition: hw.c:16
__be32 out[4]
Definition: CIB_PRM.h:36
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
#define usec_delay(x)
Definition: igbvf_osdep.h:59
#define E1000_SUCCESS
#define E1000_ERR_MBX
s32(* check_for_ack)(struct e1000_hw *, u16)
Definition: igbvf_vf.h:284
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71

References e1000_mbx_operations::check_for_ack, DEBUGFUNC, E1000_ERR_MBX, E1000_SUCCESS, e1000_mbx_info::ops, out, e1000_mbx_info::timeout, usec_delay, and e1000_mbx_info::usec_delay.

Referenced by igbvf_write_posted_mbx().

◆ igbvf_read_posted_mbx()

static s32 igbvf_read_posted_mbx ( struct e1000_hw hw,
u32 msg,
u16  size,
u16  mbx_id 
)
static

igbvf_read_posted_mbx - Wait for message notification and receive message @hw: pointer to the HW structure @msg: The message buffer @size: Length of buffer @mbx_id: id of mailbox to write

returns SUCCESS if it successfully received a message notification and copied it into the receive buffer.

Definition at line 105 of file igbvf_mbx.c.

107 {
108  struct e1000_mbx_info *mbx = &hw->mbx;
109  s32 ret_val = -E1000_ERR_MBX;
110 
111  DEBUGFUNC("igbvf_read_posted_mbx");
112 
113  if (!mbx->ops.read)
114  goto out;
115 
116  ret_val = igbvf_poll_for_msg(hw, mbx_id);
117 
118  /* if ack received read message, otherwise we timed out */
119  if (!ret_val)
120  ret_val = mbx->ops.read(hw, msg, size, mbx_id);
121 out:
122  return ret_val;
123 }
static s32 igbvf_poll_for_msg(struct e1000_hw *hw, u16 mbx_id)
igbvf_poll_for_msg - Wait for message notification @hw: pointer to the HW structure @mbx_id: id of ma...
Definition: igbvf_mbx.c:40
int32_t s32
Definition: stdint.h:22
Definition: hw.c:16
__be32 out[4]
Definition: CIB_PRM.h:36
s32(* read)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:279
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
#define E1000_ERR_MBX
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71
static void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: settings_ui.c:288

References DEBUGFUNC, E1000_ERR_MBX, igbvf_poll_for_msg(), msg(), e1000_mbx_info::ops, out, e1000_mbx_operations::read, and size.

Referenced by igbvf_init_mbx_ops_generic(), and igbvf_init_mbx_params_vf().

◆ igbvf_write_posted_mbx()

static s32 igbvf_write_posted_mbx ( struct e1000_hw hw,
u32 msg,
u16  size,
u16  mbx_id 
)
static

igbvf_write_posted_mbx - Write a message to the mailbox, wait for ack @hw: pointer to the HW structure @msg: The message buffer @size: Length of buffer @mbx_id: id of mailbox to write

returns SUCCESS if it successfully copied message into the buffer and received an ack to that message within delay * timeout period

Definition at line 135 of file igbvf_mbx.c.

137 {
138  struct e1000_mbx_info *mbx = &hw->mbx;
139  s32 ret_val = -E1000_ERR_MBX;
140 
141  DEBUGFUNC("igbvf_write_posted_mbx");
142 
143  /* exit if either we can't write or there isn't a defined timeout */
144  if (!mbx->ops.write || !mbx->timeout)
145  goto out;
146 
147  /* send msg */
148  ret_val = mbx->ops.write(hw, msg, size, mbx_id);
149 
150  /* if msg sent wait until we receive an ack */
151  if (!ret_val)
152  ret_val = igbvf_poll_for_ack(hw, mbx_id);
153 out:
154  return ret_val;
155 }
static s32 igbvf_poll_for_ack(struct e1000_hw *hw, u16 mbx_id)
igbvf_poll_for_ack - Wait for message acknowledgement @hw: pointer to the HW structure @mbx_id: id of...
Definition: igbvf_mbx.c:71
int32_t s32
Definition: stdint.h:22
Definition: hw.c:16
__be32 out[4]
Definition: CIB_PRM.h:36
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
#define E1000_ERR_MBX
s32(* write)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:280
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71
static void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: settings_ui.c:288

References DEBUGFUNC, E1000_ERR_MBX, igbvf_poll_for_ack(), msg(), e1000_mbx_info::ops, out, size, e1000_mbx_info::timeout, and e1000_mbx_operations::write.

Referenced by igbvf_init_mbx_ops_generic(), and igbvf_init_mbx_params_vf().

◆ igbvf_init_mbx_ops_generic()

void igbvf_init_mbx_ops_generic ( struct e1000_hw hw)

igbvf_init_mbx_ops_generic - Initialize NVM function pointers @hw: pointer to the HW structure

Setups up the function pointers to no-op functions

Definition at line 163 of file igbvf_mbx.c.

164 {
165  struct e1000_mbx_info *mbx = &hw->mbx;
168 }
s32(* read_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:281
Definition: hw.c:16
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
static s32 igbvf_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
igbvf_read_posted_mbx - Wait for message notification and receive message @hw: pointer to the HW stru...
Definition: igbvf_mbx.c:105
static s32 igbvf_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
igbvf_write_posted_mbx - Write a message to the mailbox, wait for ack @hw: pointer to the HW structur...
Definition: igbvf_mbx.c:135
s32(* write_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:282

References igbvf_read_posted_mbx(), igbvf_write_posted_mbx(), e1000_mbx_info::ops, e1000_mbx_operations::read_posted, and e1000_mbx_operations::write_posted.

◆ igbvf_read_v2p_mailbox()

static u32 igbvf_read_v2p_mailbox ( struct e1000_hw hw)
static

igbvf_read_v2p_mailbox - read v2p mailbox @hw: pointer to the HW structure

This function is used to read the v2p mailbox without losing the read to clear status bits.

Definition at line 177 of file igbvf_mbx.c.

178 {
179  u32 v2p_mailbox = E1000_READ_REG(hw, E1000_V2PMAILBOX(0));
180 
181  v2p_mailbox |= hw->dev_spec.vf.v2p_mailbox;
182  hw->dev_spec.vf.v2p_mailbox |= v2p_mailbox & E1000_V2PMAILBOX_R2C_BITS;
183 
184  return v2p_mailbox;
185 }
#define E1000_V2PMAILBOX_R2C_BITS
Definition: igbvf_mbx.h:49
Definition: hw.c:16
#define E1000_V2PMAILBOX(_n)
Definition: igbvf_mbx.h:37
uint32_t u32
Definition: stdint.h:23
#define E1000_READ_REG(a, reg)
Definition: igbvf_osdep.h:79

References E1000_READ_REG, E1000_V2PMAILBOX, and E1000_V2PMAILBOX_R2C_BITS.

Referenced by igbvf_check_for_bit_vf(), and igbvf_obtain_mbx_lock_vf().

◆ igbvf_check_for_bit_vf()

static s32 igbvf_check_for_bit_vf ( struct e1000_hw hw,
u32  mask 
)
static

igbvf_check_for_bit_vf - Determine if a status bit was set @hw: pointer to the HW structure @mask: bitmask for bits to be tested and cleared

This function is used to check for the read to clear bits within the V2P mailbox.

Definition at line 195 of file igbvf_mbx.c.

196 {
197  u32 v2p_mailbox = igbvf_read_v2p_mailbox(hw);
198  s32 ret_val = -E1000_ERR_MBX;
199 
200  if (v2p_mailbox & mask)
201  ret_val = E1000_SUCCESS;
202 
203  hw->dev_spec.vf.v2p_mailbox &= ~mask;
204 
205  return ret_val;
206 }
int32_t s32
Definition: stdint.h:22
static u32 igbvf_read_v2p_mailbox(struct e1000_hw *hw)
igbvf_read_v2p_mailbox - read v2p mailbox @hw: pointer to the HW structure
Definition: igbvf_mbx.c:177
Definition: hw.c:16
#define E1000_SUCCESS
#define E1000_ERR_MBX
uint32_t u32
Definition: stdint.h:23

References E1000_ERR_MBX, E1000_SUCCESS, and igbvf_read_v2p_mailbox().

Referenced by igbvf_check_for_ack_vf(), igbvf_check_for_msg_vf(), and igbvf_check_for_rst_vf().

◆ igbvf_check_for_msg_vf()

static s32 igbvf_check_for_msg_vf ( struct e1000_hw hw,
u16 mbx_id  __unused 
)
static

igbvf_check_for_msg_vf - checks to see if the PF has sent mail @hw: pointer to the HW structure @mbx_id: id of mailbox to check

returns SUCCESS if the PF has set the Status bit or else ERR_MBX

Definition at line 215 of file igbvf_mbx.c.

216 {
217  s32 ret_val = -E1000_ERR_MBX;
218 
219  DEBUGFUNC("igbvf_check_for_msg_vf");
220 
222  ret_val = E1000_SUCCESS;
223  hw->mbx.stats.reqs++;
224  }
225 
226  return ret_val;
227 }
int32_t s32
Definition: stdint.h:22
static s32 igbvf_check_for_bit_vf(struct e1000_hw *hw, u32 mask)
igbvf_check_for_bit_vf - Determine if a status bit was set @hw: pointer to the HW structure @mask: bi...
Definition: igbvf_mbx.c:195
Definition: hw.c:16
#define E1000_V2PMAILBOX_PFSTS
Definition: igbvf_mbx.h:45
#define E1000_SUCCESS
#define E1000_ERR_MBX
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71

References DEBUGFUNC, E1000_ERR_MBX, E1000_SUCCESS, E1000_V2PMAILBOX_PFSTS, and igbvf_check_for_bit_vf().

Referenced by igbvf_init_mbx_params_vf(), and igbvf_write_mbx_vf().

◆ igbvf_check_for_ack_vf()

static s32 igbvf_check_for_ack_vf ( struct e1000_hw hw,
u16 mbx_id  __unused 
)
static

igbvf_check_for_ack_vf - checks to see if the PF has ACK'd @hw: pointer to the HW structure @mbx_id: id of mailbox to check

returns SUCCESS if the PF has set the ACK bit or else ERR_MBX

Definition at line 236 of file igbvf_mbx.c.

237 {
238  s32 ret_val = -E1000_ERR_MBX;
239 
240  DEBUGFUNC("igbvf_check_for_ack_vf");
241 
243  ret_val = E1000_SUCCESS;
244  hw->mbx.stats.acks++;
245  }
246 
247  return ret_val;
248 }
int32_t s32
Definition: stdint.h:22
static s32 igbvf_check_for_bit_vf(struct e1000_hw *hw, u32 mask)
igbvf_check_for_bit_vf - Determine if a status bit was set @hw: pointer to the HW structure @mask: bi...
Definition: igbvf_mbx.c:195
Definition: hw.c:16
#define E1000_V2PMAILBOX_PFACK
Definition: igbvf_mbx.h:46
#define E1000_SUCCESS
#define E1000_ERR_MBX
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71

References DEBUGFUNC, E1000_ERR_MBX, E1000_SUCCESS, E1000_V2PMAILBOX_PFACK, and igbvf_check_for_bit_vf().

Referenced by igbvf_init_mbx_params_vf(), and igbvf_write_mbx_vf().

◆ igbvf_check_for_rst_vf()

static s32 igbvf_check_for_rst_vf ( struct e1000_hw hw,
u16 mbx_id  __unused 
)
static

igbvf_check_for_rst_vf - checks to see if the PF has reset @hw: pointer to the HW structure @mbx_id: id of mailbox to check

returns true if the PF has set the reset done bit or else false

Definition at line 257 of file igbvf_mbx.c.

258 {
259  s32 ret_val = -E1000_ERR_MBX;
260 
261  DEBUGFUNC("igbvf_check_for_rst_vf");
262 
265  ret_val = E1000_SUCCESS;
266  hw->mbx.stats.rsts++;
267  }
268 
269  return ret_val;
270 }
#define E1000_V2PMAILBOX_RSTD
Definition: igbvf_mbx.h:48
int32_t s32
Definition: stdint.h:22
static s32 igbvf_check_for_bit_vf(struct e1000_hw *hw, u32 mask)
igbvf_check_for_bit_vf - Determine if a status bit was set @hw: pointer to the HW structure @mask: bi...
Definition: igbvf_mbx.c:195
Definition: hw.c:16
#define E1000_SUCCESS
#define E1000_ERR_MBX
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71
#define E1000_V2PMAILBOX_RSTI
Definition: igbvf_mbx.h:47

References DEBUGFUNC, E1000_ERR_MBX, E1000_SUCCESS, E1000_V2PMAILBOX_RSTD, E1000_V2PMAILBOX_RSTI, and igbvf_check_for_bit_vf().

Referenced by igbvf_init_mbx_params_vf().

◆ igbvf_obtain_mbx_lock_vf()

static s32 igbvf_obtain_mbx_lock_vf ( struct e1000_hw hw)
static

igbvf_obtain_mbx_lock_vf - obtain mailbox lock @hw: pointer to the HW structure

return SUCCESS if we obtained the mailbox lock

Definition at line 278 of file igbvf_mbx.c.

279 {
280  s32 ret_val = -E1000_ERR_MBX;
281 
282  DEBUGFUNC("igbvf_obtain_mbx_lock_vf");
283 
284  /* Take ownership of the buffer */
286 
287  /* reserve mailbox for vf use */
289  ret_val = E1000_SUCCESS;
290 
291  return ret_val;
292 }
int32_t s32
Definition: stdint.h:22
static u32 igbvf_read_v2p_mailbox(struct e1000_hw *hw)
igbvf_read_v2p_mailbox - read v2p mailbox @hw: pointer to the HW structure
Definition: igbvf_mbx.c:177
Definition: hw.c:16
#define E1000_V2PMAILBOX_VFU
Definition: igbvf_mbx.h:43
#define E1000_WRITE_REG(a, reg, value)
Definition: igbvf_osdep.h:76
#define E1000_SUCCESS
#define E1000_ERR_MBX
#define E1000_V2PMAILBOX(_n)
Definition: igbvf_mbx.h:37
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71

References DEBUGFUNC, E1000_ERR_MBX, E1000_SUCCESS, E1000_V2PMAILBOX, E1000_V2PMAILBOX_VFU, E1000_WRITE_REG, and igbvf_read_v2p_mailbox().

Referenced by igbvf_read_mbx_vf(), and igbvf_write_mbx_vf().

◆ igbvf_write_mbx_vf()

static s32 igbvf_write_mbx_vf ( struct e1000_hw hw,
u32 msg,
u16  size,
u16 mbx_id  __unused 
)
static

igbvf_write_mbx_vf - Write a message to the mailbox @hw: pointer to the HW structure @msg: The message buffer @size: Length of buffer @mbx_id: id of mailbox to write

returns SUCCESS if it successfully copied message into the buffer

Definition at line 303 of file igbvf_mbx.c.

305 {
306  s32 ret_val;
307  u16 i;
308 
309 
310  DEBUGFUNC("igbvf_write_mbx_vf");
311 
312  /* lock the mailbox to prevent pf/vf race condition */
313  ret_val = igbvf_obtain_mbx_lock_vf(hw);
314  if (ret_val)
315  goto out_no_write;
316 
317  /* flush msg and acks as we are overwriting the message buffer */
320 
321  /* copy the caller specified message to the mailbox memory buffer */
322  for (i = 0; i < size; i++)
324 
325  /* update stats */
326  hw->mbx.stats.msgs_tx++;
327 
328  /* Drop VFU and interrupt the PF to tell it a message has been sent */
330 
331 out_no_write:
332  return ret_val;
333 }
uint16_t u16
Definition: stdint.h:21
int32_t s32
Definition: stdint.h:22
Definition: hw.c:16
#define E1000_WRITE_REG_ARRAY(a, reg, offset, value)
Definition: igbvf_osdep.h:81
#define E1000_WRITE_REG(a, reg, value)
Definition: igbvf_osdep.h:76
static s32 igbvf_check_for_msg_vf(struct e1000_hw *hw, u16 mbx_id __unused)
igbvf_check_for_msg_vf - checks to see if the PF has sent mail @hw: pointer to the HW structure @mbx_...
Definition: igbvf_mbx.c:215
static s32 igbvf_obtain_mbx_lock_vf(struct e1000_hw *hw)
igbvf_obtain_mbx_lock_vf - obtain mailbox lock @hw: pointer to the HW structure
Definition: igbvf_mbx.c:278
#define E1000_V2PMAILBOX(_n)
Definition: igbvf_mbx.h:37
#define E1000_V2PMAILBOX_REQ
Definition: igbvf_mbx.h:41
static s32 igbvf_check_for_ack_vf(struct e1000_hw *hw, u16 mbx_id __unused)
igbvf_check_for_ack_vf - checks to see if the PF has ACK'd @hw: pointer to the HW structure @mbx_id: ...
Definition: igbvf_mbx.c:236
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
#define E1000_VMBMEM(_n)
Definition: igbvf_mbx.h:38
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71
static void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: settings_ui.c:288

References DEBUGFUNC, E1000_V2PMAILBOX, E1000_V2PMAILBOX_REQ, E1000_VMBMEM, E1000_WRITE_REG, E1000_WRITE_REG_ARRAY, igbvf_check_for_ack_vf(), igbvf_check_for_msg_vf(), igbvf_obtain_mbx_lock_vf(), msg(), and size.

Referenced by igbvf_init_mbx_params_vf().

◆ igbvf_read_mbx_vf()

static s32 igbvf_read_mbx_vf ( struct e1000_hw hw,
u32 msg,
u16  size,
u16 mbx_id  __unused 
)
static

igbvf_read_mbx_vf - Reads a message from the inbox intended for vf @hw: pointer to the HW structure @msg: The message buffer @size: Length of buffer @mbx_id: id of mailbox to read

returns SUCCESS if it successfuly read message from buffer

Definition at line 344 of file igbvf_mbx.c.

346 {
347  s32 ret_val = E1000_SUCCESS;
348  u16 i;
349 
350  DEBUGFUNC("igbvf_read_mbx_vf");
351 
352  /* lock the mailbox to prevent pf/vf race condition */
353  ret_val = igbvf_obtain_mbx_lock_vf(hw);
354  if (ret_val)
355  goto out_no_read;
356 
357  /* copy the message from the mailbox memory buffer */
358  for (i = 0; i < size; i++)
360 
361  /* Acknowledge receipt and release mailbox, then we're done */
363 
364  /* update stats */
365  hw->mbx.stats.msgs_rx++;
366 
367 out_no_read:
368  return ret_val;
369 }
#define E1000_READ_REG_ARRAY(a, reg, offset)
Definition: igbvf_osdep.h:84
uint16_t u16
Definition: stdint.h:21
int32_t s32
Definition: stdint.h:22
Definition: hw.c:16
#define E1000_WRITE_REG(a, reg, value)
Definition: igbvf_osdep.h:76
static s32 igbvf_obtain_mbx_lock_vf(struct e1000_hw *hw)
igbvf_obtain_mbx_lock_vf - obtain mailbox lock @hw: pointer to the HW structure
Definition: igbvf_mbx.c:278
#define E1000_SUCCESS
#define E1000_V2PMAILBOX(_n)
Definition: igbvf_mbx.h:37
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
#define E1000_VMBMEM(_n)
Definition: igbvf_mbx.h:38
#define DEBUGFUNC(F)
Definition: igbvf_osdep.h:71
#define E1000_V2PMAILBOX_ACK
Definition: igbvf_mbx.h:42
static void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: settings_ui.c:288

References DEBUGFUNC, E1000_READ_REG_ARRAY, E1000_SUCCESS, E1000_V2PMAILBOX, E1000_V2PMAILBOX_ACK, E1000_VMBMEM, E1000_WRITE_REG, igbvf_obtain_mbx_lock_vf(), msg(), and size.

Referenced by igbvf_init_mbx_params_vf().

◆ igbvf_init_mbx_params_vf()

s32 igbvf_init_mbx_params_vf ( struct e1000_hw hw)

igbvf_init_mbx_params_vf - set initial values for vf mailbox @hw: pointer to the HW structure

Initializes the hw->mbx struct to correct values for vf mailbox

Definition at line 377 of file igbvf_mbx.c.

378 {
379  struct e1000_mbx_info *mbx = &hw->mbx;
380 
381  /* start mailbox as timed out and let the reset_hw call set the timeout
382  * value to begin communications */
383  mbx->timeout = 0;
385 
386  mbx->size = E1000_VFMAILBOX_SIZE;
387 
388  mbx->ops.read = igbvf_read_mbx_vf;
395 
396  mbx->stats.msgs_tx = 0;
397  mbx->stats.msgs_rx = 0;
398  mbx->stats.reqs = 0;
399  mbx->stats.acks = 0;
400  mbx->stats.rsts = 0;
401 
402  return E1000_SUCCESS;
403 }
s32(* read_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:281
Definition: hw.c:16
s32(* read)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:279
struct e1000_mbx_operations ops
Definition: igbvf_vf.h:298
static s32 igbvf_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
igbvf_read_posted_mbx - Wait for message notification and receive message @hw: pointer to the HW stru...
Definition: igbvf_mbx.c:105
struct e1000_mbx_stats stats
Definition: igbvf_vf.h:299
static s32 igbvf_read_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id __unused)
igbvf_read_mbx_vf - Reads a message from the inbox intended for vf @hw: pointer to the HW structure @...
Definition: igbvf_mbx.c:344
static s32 igbvf_check_for_rst_vf(struct e1000_hw *hw, u16 mbx_id __unused)
igbvf_check_for_rst_vf - checks to see if the PF has reset @hw: pointer to the HW structure @mbx_id: ...
Definition: igbvf_mbx.c:257
static s32 igbvf_check_for_msg_vf(struct e1000_hw *hw, u16 mbx_id __unused)
igbvf_check_for_msg_vf - checks to see if the PF has sent mail @hw: pointer to the HW structure @mbx_...
Definition: igbvf_mbx.c:215
#define E1000_SUCCESS
s32(* write)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:280
#define E1000_VFMAILBOX_SIZE
Definition: igbvf_mbx.h:51
s32(* check_for_rst)(struct e1000_hw *, u16)
Definition: igbvf_vf.h:285
static s32 igbvf_check_for_ack_vf(struct e1000_hw *hw, u16 mbx_id __unused)
igbvf_check_for_ack_vf - checks to see if the PF has ACK'd @hw: pointer to the HW structure @mbx_id: ...
Definition: igbvf_mbx.c:236
s32(* check_for_ack)(struct e1000_hw *, u16)
Definition: igbvf_vf.h:284
static s32 igbvf_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
igbvf_write_posted_mbx - Write a message to the mailbox, wait for ack @hw: pointer to the HW structur...
Definition: igbvf_mbx.c:135
static s32 igbvf_write_mbx_vf(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id __unused)
igbvf_write_mbx_vf - Write a message to the mailbox @hw: pointer to the HW structure @msg: The messag...
Definition: igbvf_mbx.c:303
s32(* write_posted)(struct e1000_hw *, u32 *, u16, u16)
Definition: igbvf_vf.h:282
#define E1000_VF_MBX_INIT_DELAY
Definition: igbvf_mbx.h:82
s32(* check_for_msg)(struct e1000_hw *, u16)
Definition: igbvf_vf.h:283

References e1000_mbx_stats::acks, e1000_mbx_operations::check_for_ack, e1000_mbx_operations::check_for_msg, e1000_mbx_operations::check_for_rst, E1000_SUCCESS, E1000_VF_MBX_INIT_DELAY, E1000_VFMAILBOX_SIZE, igbvf_check_for_ack_vf(), igbvf_check_for_msg_vf(), igbvf_check_for_rst_vf(), igbvf_read_mbx_vf(), igbvf_read_posted_mbx(), igbvf_write_mbx_vf(), igbvf_write_posted_mbx(), e1000_mbx_stats::msgs_rx, e1000_mbx_stats::msgs_tx, e1000_mbx_info::ops, e1000_mbx_operations::read, e1000_mbx_operations::read_posted, e1000_mbx_stats::reqs, e1000_mbx_stats::rsts, e1000_mbx_info::size, e1000_mbx_info::stats, e1000_mbx_info::timeout, e1000_mbx_info::usec_delay, e1000_mbx_operations::write, and e1000_mbx_operations::write_posted.

Referenced by igbvf_init_function_pointers_vf().