903
904 msg_type = request->msg_type.type;
905
906 /*
907 * Verify that we have already set up the master sbbc
908 */
909 if (master_mbox == NULL)
910 return (ENXIO);
911 mbox_wait_lock = &master_mbox->mbox_wait_lock[msg_type];
912
913 flags = WAIT_FOR_REPLY|WAIT_FOR_SPACE;
914
915 /*
916 * We want to place a lower limit on the shortest amount of time we
917 * will wait before timing out while communicating with the SC via
918 * the mailbox.
919 */
920 if (wait_time < sbbc_mbox_min_timeout)
921 wait_time = sbbc_mbox_default_timeout;
922
923 stop_time = ddi_get_lbolt() + wait_time * drv_usectohz(MICROSEC);
924
925 /*
926 * If there is a message being processed, sleep until it is our turn.
927 */
928 mutex_enter(&outbox_queue_lock);
929
930 /*
931 * allocate an ID for this message, let it wrap
932 * around transparently.
933 * msg_id == 0 is unsolicited message
934 */
935 msg_id = ++(master_mbox->mbox_msg_id);
936 if (msg_id == 0)
937 msg_id = ++(master_mbox->mbox_msg_id);
938
939 SGSBBC_DBG_MBOX("%s: msg_id = 0x%x, msg_len = 0x%x\n",
940 f, msg_id, request->msg_len);
941
942 /*
943 * A new message can actually grab the lock before the thread
|
903
904 msg_type = request->msg_type.type;
905
906 /*
907 * Verify that we have already set up the master sbbc
908 */
909 if (master_mbox == NULL)
910 return (ENXIO);
911 mbox_wait_lock = &master_mbox->mbox_wait_lock[msg_type];
912
913 flags = WAIT_FOR_REPLY|WAIT_FOR_SPACE;
914
915 /*
916 * We want to place a lower limit on the shortest amount of time we
917 * will wait before timing out while communicating with the SC via
918 * the mailbox.
919 */
920 if (wait_time < sbbc_mbox_min_timeout)
921 wait_time = sbbc_mbox_default_timeout;
922
923 stop_time = ddi_get_lbolt() + drv_sectohz(wait_time);
924
925 /*
926 * If there is a message being processed, sleep until it is our turn.
927 */
928 mutex_enter(&outbox_queue_lock);
929
930 /*
931 * allocate an ID for this message, let it wrap
932 * around transparently.
933 * msg_id == 0 is unsolicited message
934 */
935 msg_id = ++(master_mbox->mbox_msg_id);
936 if (msg_id == 0)
937 msg_id = ++(master_mbox->mbox_msg_id);
938
939 SGSBBC_DBG_MBOX("%s: msg_id = 0x%x, msg_len = 0x%x\n",
940 f, msg_id, request->msg_len);
941
942 /*
943 * A new message can actually grab the lock before the thread
|