Lines Matching defs:scp
1071 scb->scp = NULL;
1266 * @scp : pointer to the scsi command to be executed
1272 megaraid_alloc_scb(adapter_t *adapter, struct scsi_cmnd *scp)
1292 scb->scp = scp;
1316 scb->scp = NULL;
1339 struct scsi_cmnd *scp;
1344 scp = scb->scp;
1347 sgcnt = scsi_dma_map(scp);
1356 scsi_for_each_sg(scp, sgl, sgcnt, i) {
1431 * @scp : pointer to the scsi command to be executed
1437 megaraid_queue_command_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *))
1443 adapter = SCP2ADAPTER(scp);
1444 scp->scsi_done = done;
1445 scp->result = 0;
1456 scb = megaraid_mbox_build_cmd(adapter, scp, &if_busy);
1458 done(scp);
1471 * @scp : mid-layer scsi command pointer
1480 megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
1500 MRAID_GET_DEVICE_MAP(adapter, scp, channel, target, islogical);
1506 switch (scp->cmnd[0]) {
1513 scp->result = (DID_OK << 16);
1517 if (!(scb = megaraid_alloc_scb(adapter, scp))) {
1518 scp->result = (DID_ERROR << 16);
1523 scb->dma_direction = scp->sc_data_direction;
1543 sgl = scsi_sglist(scp);
1547 memset(vaddr, 0, scp->cmnd[4]);
1555 scp->result = (DID_OK << 16);
1563 if (!(rdev->last_disp & (1L << SCP2CHANNEL(scp)))) {
1568 SCP2CHANNEL(scp)));
1573 rdev->last_disp |= (1L << SCP2CHANNEL(scp));
1576 if (scp->cmnd[1] & MEGA_SCSI_INQ_EVPD) {
1577 scp->sense_buffer[0] = 0x70;
1578 scp->sense_buffer[2] = ILLEGAL_REQUEST;
1579 scp->sense_buffer[12] = MEGA_INVALID_FIELD_IN_CDB;
1580 scp->result = CHECK_CONDITION << 1;
1591 if (SCP2LUN(scp)) {
1592 scp->result = (DID_BAD_TARGET << 16);
1596 scp->result = (DID_BAD_TARGET << 16);
1602 if (!(scb = megaraid_alloc_scb(adapter, scp))) {
1603 scp->result = (DID_ERROR << 16);
1620 pthru->cdblen = scp->cmd_len;
1621 memcpy(pthru->cdb, scp->cmnd, scp->cmd_len);
1624 scb->dma_direction = scp->sc_data_direction;
1626 pthru->dataxferlen = scsi_bufflen(scp);
1647 if (!(scb = megaraid_alloc_scb(adapter, scp))) {
1648 scp->result = (DID_ERROR << 16);
1663 mbox->cmd = (scp->cmnd[0] & 0x02) ? MBOXCMD_LWRITE64:
1669 if (scp->cmd_len == 6) {
1670 mbox->numsectors = (uint32_t)scp->cmnd[4];
1672 ((uint32_t)scp->cmnd[1] << 16) |
1673 ((uint32_t)scp->cmnd[2] << 8) |
1674 (uint32_t)scp->cmnd[3];
1682 else if (scp->cmd_len == 10) {
1684 (uint32_t)scp->cmnd[8] |
1685 ((uint32_t)scp->cmnd[7] << 8);
1687 ((uint32_t)scp->cmnd[2] << 24) |
1688 ((uint32_t)scp->cmnd[3] << 16) |
1689 ((uint32_t)scp->cmnd[4] << 8) |
1690 (uint32_t)scp->cmnd[5];
1696 else if (scp->cmd_len == 12) {
1698 ((uint32_t)scp->cmnd[2] << 24) |
1699 ((uint32_t)scp->cmnd[3] << 16) |
1700 ((uint32_t)scp->cmnd[4] << 8) |
1701 (uint32_t)scp->cmnd[5];
1704 ((uint32_t)scp->cmnd[6] << 24) |
1705 ((uint32_t)scp->cmnd[7] << 16) |
1706 ((uint32_t)scp->cmnd[8] << 8) |
1707 (uint32_t)scp->cmnd[9];
1715 scp->result = (DID_ERROR << 16);
1719 scb->dma_direction = scp->sc_data_direction;
1736 scp->result = (DID_BAD_TARGET << 16);
1743 if (!(scb = megaraid_alloc_scb(adapter, scp))) {
1744 scp->result = (DID_ERROR << 16);
1753 ccb->raw_mbox[2] = (scp->cmnd[0] == RESERVE) ?
1757 scb->dma_direction = scp->sc_data_direction;
1762 scp->result = (DID_BAD_TARGET << 16);
1769 if (target > 15 || SCP2LUN(scp) > 7) {
1770 scp->result = (DID_BAD_TARGET << 16);
1778 (SCP2CHANNEL(scp) == adapter->max_channel -1)) {
1789 if (!(rdev->last_disp & (1L << SCP2CHANNEL(scp)))) {
1795 adapter->host->host_no, ss, SCP2CHANNEL(scp),
1801 rdev->last_disp |= (1L << SCP2CHANNEL(scp));
1806 scp->result = (DID_BAD_TARGET << 16);
1811 if (!(scb = megaraid_alloc_scb(adapter, scp))) {
1812 scp->result = (DID_ERROR << 16);
1820 scb->dma_direction = scp->sc_data_direction;
1828 megaraid_mbox_prepare_epthru(adapter, scb, scp);
1837 megaraid_mbox_prepare_pthru(adapter, scb, scp);
1930 * @scp : scsi command from the mid-layer
1936 struct scsi_cmnd *scp)
1954 pthru->logdrv = SCP2LUN(scp);
1956 pthru->cdblen = scp->cmd_len;
1958 memcpy(pthru->cdb, scp->cmnd, scp->cmd_len);
1960 if (scsi_bufflen(scp)) {
1961 pthru->dataxferlen = scsi_bufflen(scp);
1978 * @scp : scsi command from the mid-layer
1985 struct scsi_cmnd *scp)
2003 epthru->logdrv = SCP2LUN(scp);
2005 epthru->cdblen = scp->cmd_len;
2007 memcpy(epthru->cdb, scp->cmnd, scp->cmd_len);
2009 if (scsi_bufflen(scp)) {
2010 epthru->dataxferlen = scsi_bufflen(scp);
2179 struct scsi_cmnd *scp;
2210 scp = scb->scp;
2220 scb->sno, scb->state, scp));
2256 islogical = MRAID_IS_LOGICAL(adapter, scp);
2257 if (scp->cmnd[0] == INQUIRY && status == 0 && islogical == 0
2260 sgl = scsi_sglist(scp);
2292 scp->result = (DID_OK << 16);
2301 memcpy(scp->sense_buffer, pthru->reqsensearea,
2304 scp->result = DRIVER_SENSE << 24 |
2310 memcpy(scp->sense_buffer,
2313 scp->result = DRIVER_SENSE << 24 |
2317 scp->sense_buffer[0] = 0x70;
2318 scp->sense_buffer[2] = ABORTED_COMMAND;
2319 scp->result = CHECK_CONDITION << 1;
2326 scp->result = DID_BUS_BUSY << 16 | status;
2335 if (scp->cmnd[0] == TEST_UNIT_READY) {
2336 scp->result = DID_ERROR << 16 |
2344 if (status == 1 && (scp->cmnd[0] == RESERVE ||
2345 scp->cmnd[0] == RELEASE)) {
2347 scp->result = DID_ERROR << 16 |
2351 scp->result = DID_BAD_TARGET << 16 | status;
2360 scsi_dma_unmap(scp);
2369 scp->scsi_done(scp);
2378 * @scp : command to be aborted
2384 megaraid_abort_handler(struct scsi_cmnd *scp)
2395 adapter = SCP2ADAPTER(scp);
2400 scp->cmnd[0], SCP2CHANNEL(scp),
2401 SCP2TARGET(scp), SCP2LUN(scp)));
2418 if (scb->scp == scp) { // Found command
2426 scp->result = (DID_ABORT << 16);
2427 scp->scsi_done(scp);
2446 if (scb->scp == scp) { // Found command
2456 scp->result = (DID_ABORT << 16);
2457 scp->scsi_done(scp);
2479 if (scb->scp == scp) {
2513 * @scp : reference command
2522 megaraid_reset_handler(struct scsi_cmnd *scp)
2535 adapter = SCP2ADAPTER(scp);
2566 if (scb->scp == scp) { // Found command
2576 scb->scp->result = (DID_RESET << 16);
2577 scb->scp->scsi_done(scb->scp);
3315 struct scsi_cmnd *scp;
3322 scp = scb->scp;
3335 if (!scp) return;
3339 for (i = 0; i < scp->cmd_len; i++) {
3340 con_log(level, ("%#2.02x ", scp->cmnd[i]));
3450 scb->scp = NULL;
3700 scb->scp = NULL;