Lines Matching refs:mdev

20 	struct otx2_mbox_dev *mdev = &mbox->dev[devid];  in __otx2_mbox_reset()  local
22 void *hw_mbase = mdev->hwbase; in __otx2_mbox_reset()
27 mdev->msg_size = 0; in __otx2_mbox_reset()
28 mdev->rsp_size = 0; in __otx2_mbox_reset()
38 struct otx2_mbox_dev *mdev = &mbox->dev[devid]; in otx2_mbox_reset() local
40 spin_lock(&mdev->mbox_lock); in otx2_mbox_reset()
42 spin_unlock(&mdev->mbox_lock); in otx2_mbox_reset()
133 struct otx2_mbox_dev *mdev; in otx2_mbox_init() local
143 mdev = &mbox->dev[devid]; in otx2_mbox_init()
144 mdev->mbase = mbox->hwbase + (devid * MBOX_SIZE); in otx2_mbox_init()
145 mdev->hwbase = mdev->mbase; in otx2_mbox_init()
146 spin_lock_init(&mdev->mbox_lock); in otx2_mbox_init()
162 struct otx2_mbox_dev *mdev; in otx2_mbox_regions_init() local
175 mdev = &mbox->dev[devid]; in otx2_mbox_regions_init()
176 mdev->mbase = hwbase[devid]; in otx2_mbox_regions_init()
177 mdev->hwbase = hwbase[devid]; in otx2_mbox_regions_init()
178 spin_lock_init(&mdev->mbox_lock); in otx2_mbox_regions_init()
190 struct otx2_mbox_dev *mdev = &mbox->dev[devid]; in otx2_mbox_wait_for_rsp() local
194 if (mdev->num_msgs == mdev->msgs_acked) in otx2_mbox_wait_for_rsp()
205 struct otx2_mbox_dev *mdev = &mbox->dev[devid]; in otx2_mbox_busy_poll_for_rsp() local
209 if (mdev->num_msgs == mdev->msgs_acked) in otx2_mbox_busy_poll_for_rsp()
219 struct otx2_mbox_dev *mdev = &mbox->dev[devid]; in otx2_mbox_msg_send() local
221 void *hw_mbase = mdev->hwbase; in otx2_mbox_msg_send()
229 if (mdev->mbase != hw_mbase) in otx2_mbox_msg_send()
231 mdev->mbase + mbox->tx_start + msgs_offset, in otx2_mbox_msg_send()
232 mdev->msg_size); in otx2_mbox_msg_send()
234 spin_lock(&mdev->mbox_lock); in otx2_mbox_msg_send()
236 tx_hdr->msg_size = mdev->msg_size; in otx2_mbox_msg_send()
239 mdev->msg_size = 0; in otx2_mbox_msg_send()
240 mdev->rsp_size = 0; in otx2_mbox_msg_send()
241 mdev->msgs_acked = 0; in otx2_mbox_msg_send()
250 tx_hdr->num_msgs = mdev->num_msgs; in otx2_mbox_msg_send()
255 spin_unlock(&mdev->mbox_lock); in otx2_mbox_msg_send()
268 struct otx2_mbox_dev *mdev = &mbox->dev[devid]; in otx2_mbox_alloc_msg_rsp() local
271 spin_lock(&mdev->mbox_lock); in otx2_mbox_alloc_msg_rsp()
275 if ((mdev->msg_size + size) > mbox->tx_size - msgs_offset) in otx2_mbox_alloc_msg_rsp()
277 if ((mdev->rsp_size + size_rsp) > mbox->rx_size - msgs_offset) in otx2_mbox_alloc_msg_rsp()
280 if (mdev->msg_size == 0) in otx2_mbox_alloc_msg_rsp()
281 mdev->num_msgs = 0; in otx2_mbox_alloc_msg_rsp()
282 mdev->num_msgs++; in otx2_mbox_alloc_msg_rsp()
284 msghdr = mdev->mbase + mbox->tx_start + msgs_offset + mdev->msg_size; in otx2_mbox_alloc_msg_rsp()
290 mdev->msg_size += size; in otx2_mbox_alloc_msg_rsp()
291 mdev->rsp_size += size_rsp; in otx2_mbox_alloc_msg_rsp()
292 msghdr->next_msgoff = mdev->msg_size + msgs_offset; in otx2_mbox_alloc_msg_rsp()
294 spin_unlock(&mdev->mbox_lock); in otx2_mbox_alloc_msg_rsp()
305 struct otx2_mbox_dev *mdev = &mbox->dev[devid]; in otx2_mbox_get_rsp() local
308 spin_lock(&mdev->mbox_lock); in otx2_mbox_get_rsp()
310 if (mdev->num_msgs != mdev->msgs_acked) in otx2_mbox_get_rsp()
313 for (msgs = 0; msgs < mdev->msgs_acked; msgs++) { in otx2_mbox_get_rsp()
314 struct mbox_msghdr *pmsg = mdev->mbase + imsg; in otx2_mbox_get_rsp()
315 struct mbox_msghdr *prsp = mdev->mbase + irsp; in otx2_mbox_get_rsp()
320 spin_unlock(&mdev->mbox_lock); in otx2_mbox_get_rsp()
329 spin_unlock(&mdev->mbox_lock); in otx2_mbox_get_rsp()
338 struct otx2_mbox_dev *mdev = &mbox->dev[devid]; in otx2_mbox_check_rsp_msgs() local
342 spin_lock(&mdev->mbox_lock); in otx2_mbox_check_rsp_msgs()
344 if (mdev->num_msgs != mdev->msgs_acked) in otx2_mbox_check_rsp_msgs()
347 for (msgs = 0; msgs < mdev->msgs_acked; msgs++) { in otx2_mbox_check_rsp_msgs()
348 struct mbox_msghdr *preq = mdev->mbase + ireq; in otx2_mbox_check_rsp_msgs()
349 struct mbox_msghdr *prsp = mdev->mbase + irsp; in otx2_mbox_check_rsp_msgs()
368 spin_unlock(&mdev->mbox_lock); in otx2_mbox_check_rsp_msgs()
392 struct otx2_mbox_dev *mdev = &mbox->dev[devid]; in otx2_mbox_nonempty() local
395 spin_lock(&mdev->mbox_lock); in otx2_mbox_nonempty()
396 ret = mdev->num_msgs != 0; in otx2_mbox_nonempty()
397 spin_unlock(&mdev->mbox_lock); in otx2_mbox_nonempty()