Lines Matching refs:scsicmd
212 static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *sgmap);
213 static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg);
214 static long aac_build_sgraw(struct scsi_cmnd *scsicmd, struct sgmapraw *psg);
215 static long aac_build_sgraw2(struct scsi_cmnd *scsicmd,
219 static int aac_send_srb_fib(struct scsi_cmnd* scsicmd);
319 static inline int aac_valid_context(struct scsi_cmnd *scsicmd, in aac_valid_context() argument
323 if (unlikely(!scsicmd || !scsicmd->scsi_done)) { in aac_valid_context()
328 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; in aac_valid_context()
329 device = scsicmd->device; in aac_valid_context()
420 static void aac_expose_phy_device(struct scsi_cmnd *scsicmd) in aac_expose_phy_device() argument
423 scsi_sg_copy_to_buffer(scsicmd, &inq_data, sizeof(inq_data)); in aac_expose_phy_device()
426 scsi_sg_copy_from_buffer(scsicmd, &inq_data, sizeof(inq_data)); in aac_expose_phy_device()
506 struct scsi_cmnd * scsicmd; in get_container_name_callback() local
508 scsicmd = (struct scsi_cmnd *) context; in get_container_name_callback()
510 if (!aac_valid_context(scsicmd, fibptr)) in get_container_name_callback()
533 scsi_sg_copy_to_buffer(scsicmd, &inq, sizeof(inq)); in get_container_name_callback()
535 scsi_sg_copy_from_buffer(scsicmd, &inq, sizeof(inq)); in get_container_name_callback()
539 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; in get_container_name_callback()
542 scsicmd->scsi_done(scsicmd); in get_container_name_callback()
548 static int aac_get_container_name(struct scsi_cmnd * scsicmd) in aac_get_container_name() argument
555 dev = (struct aac_dev *)scsicmd->device->host->hostdata; in aac_get_container_name()
557 cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd); in aac_get_container_name()
564 dinfo->cid = cpu_to_le32(scmd_id(scsicmd)); in aac_get_container_name()
573 (void *) scsicmd); in aac_get_container_name()
579 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; in aac_get_container_name()
588 static int aac_probe_container_callback2(struct scsi_cmnd * scsicmd) in aac_probe_container_callback2() argument
590 struct fsa_dev_info *fsa_dev_ptr = ((struct aac_dev *)(scsicmd->device->host->hostdata))->fsa_dev; in aac_probe_container_callback2()
592 if ((fsa_dev_ptr[scmd_id(scsicmd)].valid & 1)) in aac_probe_container_callback2()
593 return aac_scsi_cmd(scsicmd); in aac_probe_container_callback2()
595 scsicmd->result = DID_NO_CONNECT << 16; in aac_probe_container_callback2()
596 scsicmd->scsi_done(scsicmd); in aac_probe_container_callback2()
604 struct scsi_cmnd * scsicmd = (struct scsi_cmnd *)context; in _aac_probe_container2() local
607 if (!aac_valid_context(scsicmd, fibptr)) in _aac_probe_container2()
610 scsicmd->SCp.Status = 0; in _aac_probe_container2()
614 fsa_dev_ptr += scmd_id(scsicmd); in _aac_probe_container2()
641 scsicmd->SCp.Status = le32_to_cpu(dresp->count); in _aac_probe_container2()
645 callback = (int (*)(struct scsi_cmnd *))(scsicmd->SCp.ptr); in _aac_probe_container2()
646 scsicmd->SCp.ptr = NULL; in _aac_probe_container2()
647 (*callback)(scsicmd); in _aac_probe_container2()
653 struct scsi_cmnd * scsicmd; in _aac_probe_container1() local
667 scsicmd = (struct scsi_cmnd *) context; in _aac_probe_container1()
669 if (!aac_valid_context(scsicmd, fibptr)) in _aac_probe_container1()
682 dinfo->count = cpu_to_le32(scmd_id(scsicmd)); in _aac_probe_container1()
691 (void *) scsicmd); in _aac_probe_container1()
696 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; in _aac_probe_container1()
704 static int _aac_probe_container(struct scsi_cmnd * scsicmd, int (*callback)(struct scsi_cmnd *)) in _aac_probe_container() argument
709 if ((fibptr = aac_fib_alloc((struct aac_dev *)scsicmd->device->host->hostdata))) { in _aac_probe_container()
722 dinfo->count = cpu_to_le32(scmd_id(scsicmd)); in _aac_probe_container()
724 scsicmd->SCp.ptr = (char *)callback; in _aac_probe_container()
732 (void *) scsicmd); in _aac_probe_container()
737 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; in _aac_probe_container()
741 scsicmd->SCp.ptr = NULL; in _aac_probe_container()
747 struct fsa_dev_info *fsa_dev_ptr = ((struct aac_dev *)(scsicmd->device->host->hostdata))->fsa_dev; in _aac_probe_container()
749 fsa_dev_ptr += scmd_id(scsicmd); in _aac_probe_container()
752 return (*callback)(scsicmd); in _aac_probe_container()
767 static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd) in aac_probe_container_callback1() argument
769 scsicmd->device = NULL; in aac_probe_container_callback1()
775 struct scsi_cmnd *scsicmd = kmalloc(sizeof(*scsicmd), GFP_KERNEL); in aac_probe_container() local
779 if (!scsicmd || !scsidev) { in aac_probe_container()
780 kfree(scsicmd); in aac_probe_container()
784 scsicmd->list.next = NULL; in aac_probe_container()
785 scsicmd->scsi_done = (void (*)(struct scsi_cmnd*))aac_probe_container_callback1; in aac_probe_container()
787 scsicmd->device = scsidev; in aac_probe_container()
792 if (_aac_probe_container(scsicmd, aac_probe_container_callback1) == 0) in aac_probe_container()
793 while (scsicmd->device == scsidev) in aac_probe_container()
796 status = scsicmd->SCp.Status; in aac_probe_container()
797 kfree(scsicmd); in aac_probe_container()
924 struct scsi_cmnd * scsicmd; in get_container_serial_callback() local
928 scsicmd = (struct scsi_cmnd *) context; in get_container_serial_callback()
929 if (!aac_valid_context(scsicmd, fibptr)) in get_container_serial_callback()
936 if (scsicmd->cmnd[2] == 0x83) { in get_container_serial_callback()
1003 scsi_sg_copy_from_buffer(scsicmd, &VPDPage83Data, in get_container_serial_callback()
1010 sp[1] = scsicmd->cmnd[2]; in get_container_serial_callback()
1014 scsi_sg_copy_from_buffer(scsicmd, sp, in get_container_serial_callback()
1019 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; in get_container_serial_callback()
1022 scsicmd->scsi_done(scsicmd); in get_container_serial_callback()
1028 static int aac_get_container_serial(struct scsi_cmnd * scsicmd) in aac_get_container_serial() argument
1035 dev = (struct aac_dev *)scsicmd->device->host->hostdata; in aac_get_container_serial()
1037 cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd); in aac_get_container_serial()
1044 dinfo->cid = cpu_to_le32(scmd_id(scsicmd)); in aac_get_container_serial()
1052 (void *) scsicmd); in aac_get_container_serial()
1058 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; in aac_get_container_serial()
1782 struct scsi_cmnd *scsicmd; in io_callback() local
1785 scsicmd = (struct scsi_cmnd *) context; in io_callback()
1787 if (!aac_valid_context(scsicmd, fibptr)) in io_callback()
1791 cid = scmd_id(scsicmd); in io_callback()
1795 switch (scsicmd->cmnd[0]) { in io_callback()
1798 lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | in io_callback()
1799 (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; in io_callback()
1803 lba = ((u64)scsicmd->cmnd[2] << 56) | in io_callback()
1804 ((u64)scsicmd->cmnd[3] << 48) | in io_callback()
1805 ((u64)scsicmd->cmnd[4] << 40) | in io_callback()
1806 ((u64)scsicmd->cmnd[5] << 32) | in io_callback()
1807 ((u64)scsicmd->cmnd[6] << 24) | in io_callback()
1808 (scsicmd->cmnd[7] << 16) | in io_callback()
1809 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; in io_callback()
1813 lba = ((u64)scsicmd->cmnd[2] << 24) | in io_callback()
1814 (scsicmd->cmnd[3] << 16) | in io_callback()
1815 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; in io_callback()
1818 lba = ((u64)scsicmd->cmnd[2] << 24) | in io_callback()
1819 (scsicmd->cmnd[3] << 16) | in io_callback()
1820 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; in io_callback()
1830 scsi_dma_unmap(scsicmd); in io_callback()
1835 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | in io_callback()
1840 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | in io_callback()
1844 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, in io_callback()
1853 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | in io_callback()
1858 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, in io_callback()
1865 scsicmd->scsi_done(scsicmd); in io_callback()
1868 static int aac_read(struct scsi_cmnd * scsicmd) in aac_read() argument
1877 dev = (struct aac_dev *)scsicmd->device->host->hostdata; in aac_read()
1881 switch (scsicmd->cmnd[0]) { in aac_read()
1883 dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", scmd_id(scsicmd))); in aac_read()
1885 lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | in aac_read()
1886 (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; in aac_read()
1887 count = scsicmd->cmnd[4]; in aac_read()
1893 dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", scmd_id(scsicmd))); in aac_read()
1895 lba = ((u64)scsicmd->cmnd[2] << 56) | in aac_read()
1896 ((u64)scsicmd->cmnd[3] << 48) | in aac_read()
1897 ((u64)scsicmd->cmnd[4] << 40) | in aac_read()
1898 ((u64)scsicmd->cmnd[5] << 32) | in aac_read()
1899 ((u64)scsicmd->cmnd[6] << 24) | in aac_read()
1900 (scsicmd->cmnd[7] << 16) | in aac_read()
1901 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; in aac_read()
1902 count = (scsicmd->cmnd[10] << 24) | in aac_read()
1903 (scsicmd->cmnd[11] << 16) | in aac_read()
1904 (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13]; in aac_read()
1907 dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", scmd_id(scsicmd))); in aac_read()
1909 lba = ((u64)scsicmd->cmnd[2] << 24) | in aac_read()
1910 (scsicmd->cmnd[3] << 16) | in aac_read()
1911 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; in aac_read()
1912 count = (scsicmd->cmnd[6] << 24) | in aac_read()
1913 (scsicmd->cmnd[7] << 16) | in aac_read()
1914 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; in aac_read()
1917 dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", scmd_id(scsicmd))); in aac_read()
1919 lba = ((u64)scsicmd->cmnd[2] << 24) | in aac_read()
1920 (scsicmd->cmnd[3] << 16) | in aac_read()
1921 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; in aac_read()
1922 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; in aac_read()
1926 if ((lba + count) > (dev->fsa_dev[scmd_id(scsicmd)].size)) { in aac_read()
1927 cid = scmd_id(scsicmd); in aac_read()
1929 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | in aac_read()
1934 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, in aac_read()
1937 scsicmd->scsi_done(scsicmd); in aac_read()
1943 if (aac_adapter_bounds(dev,scsicmd,lba)) in aac_read()
1948 cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd); in aac_read()
1950 status = aac_adapter_read(cmd_fibcontext, scsicmd, lba, count); in aac_read()
1956 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; in aac_read()
1964 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL; in aac_read()
1965 scsicmd->scsi_done(scsicmd); in aac_read()
1971 static int aac_write(struct scsi_cmnd * scsicmd) in aac_write() argument
1981 dev = (struct aac_dev *)scsicmd->device->host->hostdata; in aac_write()
1985 if (scsicmd->cmnd[0] == WRITE_6) /* 6 byte command */ in aac_write()
1987 lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; in aac_write()
1988 count = scsicmd->cmnd[4]; in aac_write()
1992 } else if (scsicmd->cmnd[0] == WRITE_16) { /* 16 byte command */ in aac_write()
1993 dprintk((KERN_DEBUG "aachba: received a write(16) command on id %d.\n", scmd_id(scsicmd))); in aac_write()
1995 lba = ((u64)scsicmd->cmnd[2] << 56) | in aac_write()
1996 ((u64)scsicmd->cmnd[3] << 48) | in aac_write()
1997 ((u64)scsicmd->cmnd[4] << 40) | in aac_write()
1998 ((u64)scsicmd->cmnd[5] << 32) | in aac_write()
1999 ((u64)scsicmd->cmnd[6] << 24) | in aac_write()
2000 (scsicmd->cmnd[7] << 16) | in aac_write()
2001 (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; in aac_write()
2002 count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) | in aac_write()
2003 (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13]; in aac_write()
2004 fua = scsicmd->cmnd[1] & 0x8; in aac_write()
2005 } else if (scsicmd->cmnd[0] == WRITE_12) { /* 12 byte command */ in aac_write()
2006 dprintk((KERN_DEBUG "aachba: received a write(12) command on id %d.\n", scmd_id(scsicmd))); in aac_write()
2008 lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) in aac_write()
2009 | (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; in aac_write()
2010 count = (scsicmd->cmnd[6] << 24) | (scsicmd->cmnd[7] << 16) in aac_write()
2011 | (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; in aac_write()
2012 fua = scsicmd->cmnd[1] & 0x8; in aac_write()
2014 dprintk((KERN_DEBUG "aachba: received a write(10) command on id %d.\n", scmd_id(scsicmd))); in aac_write()
2015 …lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | (scsicmd->cmnd[4] << 8) | scsicmd… in aac_write()
2016 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; in aac_write()
2017 fua = scsicmd->cmnd[1] & 0x8; in aac_write()
2020 if ((lba + count) > (dev->fsa_dev[scmd_id(scsicmd)].size)) { in aac_write()
2021 cid = scmd_id(scsicmd); in aac_write()
2023 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | in aac_write()
2028 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, in aac_write()
2031 scsicmd->scsi_done(scsicmd); in aac_write()
2037 if (aac_adapter_bounds(dev,scsicmd,lba)) in aac_write()
2042 cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd); in aac_write()
2044 status = aac_adapter_write(cmd_fibcontext, scsicmd, lba, count, fua); in aac_write()
2050 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; in aac_write()
2058 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL; in aac_write()
2059 scsicmd->scsi_done(scsicmd); in aac_write()
2107 static int aac_synchronize(struct scsi_cmnd *scsicmd) in aac_synchronize() argument
2113 struct scsi_device *sdev = scsicmd->device; in aac_synchronize()
2116 u64 lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | in aac_synchronize()
2117 (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5]; in aac_synchronize()
2118 u32 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8]; in aac_synchronize()
2199 synchronizecmd->cid = cpu_to_le32(scmd_id(scsicmd)); in aac_synchronize()
2212 (void *)scsicmd); in aac_synchronize()
2218 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; in aac_synchronize()
2231 struct scsi_cmnd *scsicmd = context; in aac_start_stop_callback() local
2233 if (!aac_valid_context(scsicmd, fibptr)) in aac_start_stop_callback()
2238 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; in aac_start_stop_callback()
2242 scsicmd->scsi_done(scsicmd); in aac_start_stop_callback()
2245 static int aac_start_stop(struct scsi_cmnd *scsicmd) in aac_start_stop() argument
2250 struct scsi_device *sdev = scsicmd->device; in aac_start_stop()
2255 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | in aac_start_stop()
2257 scsicmd->scsi_done(scsicmd); in aac_start_stop()
2267 cmd_fibcontext = aac_fib_alloc_tag(aac, scsicmd); in aac_start_stop()
2275 pmcmd->sub = (scsicmd->cmnd[4] & 1) ? in aac_start_stop()
2278 pmcmd->parm = (scsicmd->cmnd[1] & 1) ? in aac_start_stop()
2290 (void *)scsicmd); in aac_start_stop()
2296 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; in aac_start_stop()
2313 int aac_scsi_cmd(struct scsi_cmnd * scsicmd) in aac_scsi_cmd() argument
2316 struct Scsi_Host *host = scsicmd->device->host; in aac_scsi_cmd()
2327 cid = scmd_id(scsicmd); in aac_scsi_cmd()
2329 if (scmd_channel(scsicmd) == CONTAINER_CHANNEL) { in aac_scsi_cmd()
2331 (scsicmd->device->lun != 0)) { in aac_scsi_cmd()
2332 scsicmd->result = DID_NO_CONNECT << 16; in aac_scsi_cmd()
2333 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2344 switch (scsicmd->cmnd[0]) { in aac_scsi_cmd()
2348 ((scsicmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16)) in aac_scsi_cmd()
2355 return _aac_probe_container(scsicmd, in aac_scsi_cmd()
2366 return aac_send_srb_fib(scsicmd); in aac_scsi_cmd()
2368 scsicmd->result = DID_NO_CONNECT << 16; in aac_scsi_cmd()
2369 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2377 else if ((scsicmd->cmnd[0] != INQUIRY) && /* only INQUIRY & TUR cmnd supported for controller */ in aac_scsi_cmd()
2378 (scsicmd->cmnd[0] != TEST_UNIT_READY)) in aac_scsi_cmd()
2380 …_WARNING "Only INQUIRY & TUR command supported for controller, rcvd = 0x%x.\n", scsicmd->cmnd[0])); in aac_scsi_cmd()
2381 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; in aac_scsi_cmd()
2385 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, in aac_scsi_cmd()
2388 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2394 switch (scsicmd->cmnd[0]) { in aac_scsi_cmd()
2402 if ((scsicmd->cmnd[1] & 0x1) && aac_wwn) { in aac_scsi_cmd()
2406 arr[0] = (scmd_id(scsicmd) == host->this_id) ? in aac_scsi_cmd()
2408 if (scsicmd->cmnd[2] == 0) { in aac_scsi_cmd()
2414 arr[1] = scsicmd->cmnd[2]; in aac_scsi_cmd()
2415 scsi_sg_copy_from_buffer(scsicmd, &inq_data, in aac_scsi_cmd()
2417 scsicmd->result = DID_OK << 16 | in aac_scsi_cmd()
2419 } else if (scsicmd->cmnd[2] == 0x80) { in aac_scsi_cmd()
2422 scmd_id(scsicmd)); in aac_scsi_cmd()
2423 arr[1] = scsicmd->cmnd[2]; in aac_scsi_cmd()
2424 scsi_sg_copy_from_buffer(scsicmd, &inq_data, in aac_scsi_cmd()
2428 scsicmd); in aac_scsi_cmd()
2429 scsicmd->result = DID_OK << 16 | in aac_scsi_cmd()
2431 } else if (scsicmd->cmnd[2] == 0x83) { in aac_scsi_cmd()
2435 scmd_id(scsicmd)); in aac_scsi_cmd()
2438 scsicmd); in aac_scsi_cmd()
2439 scsicmd->result = DID_OK << 16 | in aac_scsi_cmd()
2443 scsicmd->result = DID_OK << 16 | in aac_scsi_cmd()
2449 memcpy(scsicmd->sense_buffer, in aac_scsi_cmd()
2455 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2470 scsi_sg_copy_from_buffer(scsicmd, &inq_data, in aac_scsi_cmd()
2472 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; in aac_scsi_cmd()
2473 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2480 scsi_sg_copy_from_buffer(scsicmd, &inq_data, sizeof(inq_data)); in aac_scsi_cmd()
2481 return aac_get_container_name(scsicmd); in aac_scsi_cmd()
2486 ((scsicmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16)) in aac_scsi_cmd()
2509 alloc_len = ((scsicmd->cmnd[10] << 24) in aac_scsi_cmd()
2510 + (scsicmd->cmnd[11] << 16) in aac_scsi_cmd()
2511 + (scsicmd->cmnd[12] << 8) + scsicmd->cmnd[13]); in aac_scsi_cmd()
2514 scsi_sg_copy_from_buffer(scsicmd, cp, alloc_len); in aac_scsi_cmd()
2515 if (alloc_len < scsi_bufflen(scsicmd)) in aac_scsi_cmd()
2516 scsi_set_resid(scsicmd, in aac_scsi_cmd()
2517 scsi_bufflen(scsicmd) - alloc_len); in aac_scsi_cmd()
2520 scsicmd->device->removable = 1; in aac_scsi_cmd()
2522 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; in aac_scsi_cmd()
2523 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2547 scsi_sg_copy_from_buffer(scsicmd, cp, sizeof(cp)); in aac_scsi_cmd()
2549 scsicmd->device->removable = 1; in aac_scsi_cmd()
2550 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | in aac_scsi_cmd()
2552 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2582 if (scsicmd->cmnd[1] & 0x8) in aac_scsi_cmd()
2594 mpd.mpc_buf[0] = scsicmd->cmnd[2]; in aac_scsi_cmd()
2595 if (scsicmd->cmnd[2] == 0x1C) { in aac_scsi_cmd()
2615 if (((scsicmd->cmnd[2] & 0x3f) == 8) || in aac_scsi_cmd()
2616 ((scsicmd->cmnd[2] & 0x3f) == 0x3f)) { in aac_scsi_cmd()
2625 if (mode_buf_length > scsicmd->cmnd[4]) in aac_scsi_cmd()
2626 mode_buf_length = scsicmd->cmnd[4]; in aac_scsi_cmd()
2629 scsi_sg_copy_from_buffer(scsicmd, in aac_scsi_cmd()
2632 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; in aac_scsi_cmd()
2633 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2665 if (scsicmd->cmnd[1] & 0x8) { in aac_scsi_cmd()
2696 if (((scsicmd->cmnd[2] & 0x3f) == 8) || in aac_scsi_cmd()
2697 ((scsicmd->cmnd[2] & 0x3f) == 0x3f)) { in aac_scsi_cmd()
2704 if (mode_buf_length > scsicmd->cmnd[8]) in aac_scsi_cmd()
2705 mode_buf_length = scsicmd->cmnd[8]; in aac_scsi_cmd()
2707 scsi_sg_copy_from_buffer(scsicmd, in aac_scsi_cmd()
2711 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; in aac_scsi_cmd()
2712 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2718 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, sizeof (struct sense_data)); in aac_scsi_cmd()
2720 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; in aac_scsi_cmd()
2721 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2726 if (scsicmd->cmnd[4]) in aac_scsi_cmd()
2731 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; in aac_scsi_cmd()
2732 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2739 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | in aac_scsi_cmd()
2744 memcpy(scsicmd->sense_buffer, in aac_scsi_cmd()
2749 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2758 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; in aac_scsi_cmd()
2759 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2763 return aac_start_stop(scsicmd); in aac_scsi_cmd()
2766 switch (scsicmd->cmnd[0]) in aac_scsi_cmd()
2780 if (scsicmd->request->rq_disk) in aac_scsi_cmd()
2782 scsicmd->request->rq_disk->disk_name, in aac_scsi_cmd()
2784 sizeof(scsicmd->request->rq_disk->disk_name) + 1)); in aac_scsi_cmd()
2786 return aac_read(scsicmd); in aac_scsi_cmd()
2794 return aac_write(scsicmd); in aac_scsi_cmd()
2798 scsicmd->result = DID_OK << 16 | in aac_scsi_cmd()
2800 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2805 return aac_synchronize(scsicmd); in aac_scsi_cmd()
2811 dprintk((KERN_WARNING "Unhandled SCSI Command: 0x%x.\n", scsicmd->cmnd[0])); in aac_scsi_cmd()
2812 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; in aac_scsi_cmd()
2816 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, in aac_scsi_cmd()
2820 scsicmd->scsi_done(scsicmd); in aac_scsi_cmd()
2949 struct scsi_cmnd *scsicmd; in aac_srb_callback() local
2951 scsicmd = (struct scsi_cmnd *) context; in aac_srb_callback()
2953 if (!aac_valid_context(scsicmd, fibptr)) in aac_srb_callback()
2962 scsicmd->sense_buffer[0] = '\0'; /* Initialize sense valid flag to false */ in aac_srb_callback()
2972 scsi_set_resid(scsicmd, scsi_bufflen(scsicmd) in aac_srb_callback()
2977 scsi_dma_unmap(scsicmd); in aac_srb_callback()
2980 if (scsicmd->cmnd[0] == INQUIRY && !(scsicmd->cmnd[1] & 0x01) in aac_srb_callback()
2982 aac_expose_phy_device(scsicmd); in aac_srb_callback()
2995 scsicmd->result = DID_ERROR << 16 in aac_srb_callback()
2998 memcpy(scsicmd->sense_buffer, in aac_srb_callback()
3009 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; in aac_srb_callback()
3012 switch (scsicmd->cmnd[0]) { in aac_srb_callback()
3022 < scsicmd->underflow) in aac_srb_callback()
3026 scsicmd->result = DID_ERROR << 16 in aac_srb_callback()
3030 scsicmd->result = DID_OK << 16 in aac_srb_callback()
3034 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; in aac_srb_callback()
3039 scsicmd->result = DID_ABORT << 16 | ABORT << 8; in aac_srb_callback()
3046 scsicmd->result = DID_ERROR << 16 | ABORT << 8; in aac_srb_callback()
3049 scsicmd->result = DID_PARITY << 16 in aac_srb_callback()
3057 scsicmd->result = DID_NO_CONNECT << 16 in aac_srb_callback()
3063 scsicmd->result = DID_TIME_OUT << 16 in aac_srb_callback()
3068 scsicmd->result = DID_BUS_BUSY << 16 in aac_srb_callback()
3073 scsicmd->result = DID_RESET << 16 in aac_srb_callback()
3078 scsicmd->result = DID_ERROR << 16 in aac_srb_callback()
3101 scsicmd->cmnd[0], in aac_srb_callback()
3111 if ((scsicmd->cmnd[0] == ATA_12) in aac_srb_callback()
3112 || (scsicmd->cmnd[0] == ATA_16)) { in aac_srb_callback()
3114 if (scsicmd->cmnd[2] & (0x01 << 5)) { in aac_srb_callback()
3115 scsicmd->result = DID_OK << 16 in aac_srb_callback()
3119 scsicmd->result = DID_ERROR << 16 in aac_srb_callback()
3124 scsicmd->result = DID_ERROR << 16 in aac_srb_callback()
3133 scsicmd->result |= SAM_STAT_CHECK_CONDITION; in aac_srb_callback()
3140 memcpy(scsicmd->sense_buffer, in aac_srb_callback()
3147 scsicmd->result |= le32_to_cpu(srbreply->scsi_status); in aac_srb_callback()
3150 scsicmd->scsi_done(scsicmd); in aac_srb_callback()
3162 static int aac_send_srb_fib(struct scsi_cmnd* scsicmd) in aac_send_srb_fib() argument
3168 dev = (struct aac_dev *)scsicmd->device->host->hostdata; in aac_send_srb_fib()
3169 if (scmd_id(scsicmd) >= dev->maximum_num_physicals || in aac_send_srb_fib()
3170 scsicmd->device->lun > 7) { in aac_send_srb_fib()
3171 scsicmd->result = DID_NO_CONNECT << 16; in aac_send_srb_fib()
3172 scsicmd->scsi_done(scsicmd); in aac_send_srb_fib()
3179 cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd); in aac_send_srb_fib()
3181 status = aac_adapter_scsi(cmd_fibcontext, scsicmd); in aac_send_srb_fib()
3187 scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; in aac_send_srb_fib()
3198 static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *psg) in aac_build_sg() argument
3204 dev = (struct aac_dev *)scsicmd->device->host->hostdata; in aac_build_sg()
3210 nseg = scsi_dma_map(scsicmd); in aac_build_sg()
3219 scsi_for_each_sg(scsicmd, sg, nseg, i) { in aac_build_sg()
3225 if (byte_count > scsi_bufflen(scsicmd)) { in aac_build_sg()
3227 (byte_count - scsi_bufflen(scsicmd)); in aac_build_sg()
3229 byte_count = scsi_bufflen(scsicmd); in aac_build_sg()
3232 if(scsicmd->underflow && (byte_count < scsicmd->underflow)){ in aac_build_sg()
3234 byte_count, scsicmd->underflow); in aac_build_sg()
3241 static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg) in aac_build_sg64() argument
3248 dev = (struct aac_dev *)scsicmd->device->host->hostdata; in aac_build_sg64()
3255 nseg = scsi_dma_map(scsicmd); in aac_build_sg64()
3262 scsi_for_each_sg(scsicmd, sg, nseg, i) { in aac_build_sg64()
3272 if (byte_count > scsi_bufflen(scsicmd)) { in aac_build_sg64()
3274 (byte_count - scsi_bufflen(scsicmd)); in aac_build_sg64()
3276 byte_count = scsi_bufflen(scsicmd); in aac_build_sg64()
3279 if(scsicmd->underflow && (byte_count < scsicmd->underflow)){ in aac_build_sg64()
3281 byte_count, scsicmd->underflow); in aac_build_sg64()
3287 static long aac_build_sgraw(struct scsi_cmnd *scsicmd, struct sgmapraw *psg) in aac_build_sgraw() argument
3301 nseg = scsi_dma_map(scsicmd); in aac_build_sgraw()
3308 scsi_for_each_sg(scsicmd, sg, nseg, i) { in aac_build_sgraw()
3321 if (byte_count > scsi_bufflen(scsicmd)) { in aac_build_sgraw()
3323 (byte_count - scsi_bufflen(scsicmd)); in aac_build_sgraw()
3325 byte_count = scsi_bufflen(scsicmd); in aac_build_sgraw()
3328 if(scsicmd->underflow && (byte_count < scsicmd->underflow)){ in aac_build_sgraw()
3330 byte_count, scsicmd->underflow); in aac_build_sgraw()
3336 static long aac_build_sgraw2(struct scsi_cmnd *scsicmd, in aac_build_sgraw2() argument
3342 nseg = scsi_dma_map(scsicmd); in aac_build_sgraw2()
3350 scsi_for_each_sg(scsicmd, sg, nseg, i) { in aac_build_sgraw2()
3375 if (byte_count > scsi_bufflen(scsicmd)) { in aac_build_sgraw2()
3377 (byte_count - scsi_bufflen(scsicmd)); in aac_build_sgraw2()
3379 byte_count = scsi_bufflen(scsicmd); in aac_build_sgraw2()
3406 if (scsicmd->underflow && (byte_count < scsicmd->underflow)) { in aac_build_sgraw2()
3408 byte_count, scsicmd->underflow); in aac_build_sgraw2()