FreeBSD/sys/dev/mrsas/mrsas.c
/*
 * mrsas_issue_polled:	Issues a polling command
 * inputs:				Adapter soft state
 * 						Command packet to be issued
 *
 * This function is for posting of internal commands to Firmware.  MFI requires
 * the cmd_status to be set to 0xFF before posting.  The maximun wait time of
 * the poll response timer is 180 seconds.
 */
Issues a polling command
inputs:                              Adapter soft state
Command packet to be issued

This function is for posting of internal commands to Firmware.  MFI requires
the cmd_status to be set to 0xFF before posting.  The maximun wait time of
the poll response timer is 180 seconds.
Issues a polling command inputs : Adapter soft state Command packet to be issued This function is for posting of internal commands to Firmware . MFI requires the cmd_status to be set to 0xFF before posting . The maximun wait time of the poll response timer is 180 seconds .
int
mrsas_issue_polled(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd)
{
	struct mrsas_header *frame_hdr = &cmd->frame->hdr;
	u_int8_t max_wait = MRSAS_INTERNAL_CMD_WAIT_TIME;
	int i, retcode = SUCCESS;
	frame_hdr->cmd_status = 0xFF;
	frame_hdr->flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE;
	if (mrsas_issue_dcmd(sc, cmd)) {
		device_printf(sc->mrsas_dev, "Cannot issue DCMD internal command.\n");
		return (1);
	}
	if (frame_hdr->cmd_status == 0xFF) {
		for (i = 0; i < (max_wait * 1000); i++) {
			if (frame_hdr->cmd_status == 0xFF)
				DELAY(1000);
			else
				break;
		}
	}
	if (frame_hdr->cmd_status == 0xFF) {
		device_printf(sc->mrsas_dev, "DCMD timed out after %d "
		    "seconds from %s\n", max_wait, __func__);
		device_printf(sc->mrsas_dev, "DCMD opcode 0x%X\n",
		    cmd->frame->dcmd.opcode);
		retcode = ETIMEDOUT;
	}
	return (retcode);
}
int mrsas_issue_polled ( struct mrsas_softc * sc , struct mrsas_mfi_cmd * cmd ) { struct mrsas_header * frame_hdr = & cmd -> frame -> hdr ; u_int8_t max_wait = MRSAS_INTERNAL_CMD_WAIT_TIME ; int i , retcode = SUCCESS ; frame_hdr -> cmd_status = 0xFF ; frame_hdr -> flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE ; if ( mrsas_issue_dcmd ( sc , cmd ) ) { device_printf ( sc -> mrsas_dev , " \n " ) ; return ( 1 ) ; } if ( frame_hdr -> cmd_status == 0xFF ) { for ( i = 0 ; i < ( max_wait * 1000 ) ; i ++ ) { if ( frame_hdr -> cmd_status == 0xFF ) DELAY ( 1000 ) ; else break ; } } if ( frame_hdr -> cmd_status == 0xFF ) { device_printf ( sc -> mrsas_dev , " " " \n " , max_wait , __func__ ) ; device_printf ( sc -> mrsas_dev , " \n " , cmd -> frame -> dcmd . opcode ) ; retcode = ETIMEDOUT ; } return ( retcode ) ; }
mrsas_issue_polled:  Issues a polling command
 inputs:                              Adapter soft state
                                              Command packet to be issued
mrsas_issue_polled : Issues a polling command inputs : Adapter soft state Command packet to be issued
/* Issue the frame using inbound queue port */ /*
	 * Poll response timer to wait for Firmware response.  While this
	 * timer with the DELAY call could block CPU, the time interval for
	 * this is only 1 millisecond.
	 */