Lines Matching refs:arr
1151 static int fill_from_dev_buffer(struct scsi_cmnd *scp, unsigned char *arr, in fill_from_dev_buffer() argument
1163 arr, arr_len); in fill_from_dev_buffer()
1174 static int p_fill_from_dev_buffer(struct scsi_cmnd *scp, const void *arr, in p_fill_from_dev_buffer() argument
1187 arr, arr_len, skip); in p_fill_from_dev_buffer()
1199 static int fetch_to_dev_buffer(struct scsi_cmnd *scp, unsigned char *arr, in fetch_to_dev_buffer() argument
1207 return scsi_sg_copy_to_buffer(scp, arr, arr_len); in fetch_to_dev_buffer()
1220 static int inquiry_vpd_83(unsigned char *arr, int port_group_id, in inquiry_vpd_83() argument
1230 arr[0] = 0x2; /* ASCII */ in inquiry_vpd_83()
1231 arr[1] = 0x1; in inquiry_vpd_83()
1232 arr[2] = 0x0; in inquiry_vpd_83()
1233 memcpy(&arr[4], sdebug_inq_vendor_id, 8); in inquiry_vpd_83()
1234 memcpy(&arr[12], sdebug_inq_product_id, 16); in inquiry_vpd_83()
1235 memcpy(&arr[28], dev_id_str, dev_id_str_len); in inquiry_vpd_83()
1237 arr[3] = num; in inquiry_vpd_83()
1242 arr[num++] = 0x1; /* binary (not necessarily sas) */ in inquiry_vpd_83()
1243 arr[num++] = 0xa; /* PIV=0, lu, naa */ in inquiry_vpd_83()
1244 arr[num++] = 0x0; in inquiry_vpd_83()
1245 arr[num++] = 0x12; in inquiry_vpd_83()
1246 arr[num++] = 0x10; /* uuid type=1, locally assigned */ in inquiry_vpd_83()
1247 arr[num++] = 0x0; in inquiry_vpd_83()
1248 memcpy(arr + num, lu_name, 16); in inquiry_vpd_83()
1252 arr[num++] = 0x1; /* binary (not necessarily sas) */ in inquiry_vpd_83()
1253 arr[num++] = 0x3; /* PIV=0, lu, naa */ in inquiry_vpd_83()
1254 arr[num++] = 0x0; in inquiry_vpd_83()
1255 arr[num++] = 0x8; in inquiry_vpd_83()
1256 put_unaligned_be64(naa3_comp_b + dev_id_num, arr + num); in inquiry_vpd_83()
1260 arr[num++] = 0x61; /* proto=sas, binary */ in inquiry_vpd_83()
1261 arr[num++] = 0x94; /* PIV=1, target port, rel port */ in inquiry_vpd_83()
1262 arr[num++] = 0x0; /* reserved */ in inquiry_vpd_83()
1263 arr[num++] = 0x4; /* length */ in inquiry_vpd_83()
1264 arr[num++] = 0x0; /* reserved */ in inquiry_vpd_83()
1265 arr[num++] = 0x0; /* reserved */ in inquiry_vpd_83()
1266 arr[num++] = 0x0; in inquiry_vpd_83()
1267 arr[num++] = 0x1; /* relative port A */ in inquiry_vpd_83()
1270 arr[num++] = 0x61; /* proto=sas, binary */ in inquiry_vpd_83()
1271 arr[num++] = 0x93; /* piv=1, target port, naa */ in inquiry_vpd_83()
1272 arr[num++] = 0x0; in inquiry_vpd_83()
1273 arr[num++] = 0x8; in inquiry_vpd_83()
1274 put_unaligned_be64(naa3_comp_a + port_a, arr + num); in inquiry_vpd_83()
1277 arr[num++] = 0x61; /* proto=sas, binary */ in inquiry_vpd_83()
1278 arr[num++] = 0x95; /* piv=1, target port group id */ in inquiry_vpd_83()
1279 arr[num++] = 0x0; in inquiry_vpd_83()
1280 arr[num++] = 0x4; in inquiry_vpd_83()
1281 arr[num++] = 0; in inquiry_vpd_83()
1282 arr[num++] = 0; in inquiry_vpd_83()
1283 put_unaligned_be16(port_group_id, arr + num); in inquiry_vpd_83()
1286 arr[num++] = 0x61; /* proto=sas, binary */ in inquiry_vpd_83()
1287 arr[num++] = 0xa3; /* piv=1, target device, naa */ in inquiry_vpd_83()
1288 arr[num++] = 0x0; in inquiry_vpd_83()
1289 arr[num++] = 0x8; in inquiry_vpd_83()
1290 put_unaligned_be64(naa3_comp_a + target_dev_id, arr + num); in inquiry_vpd_83()
1293 arr[num++] = 0x63; /* proto=sas, UTF-8 */ in inquiry_vpd_83()
1294 arr[num++] = 0xa8; /* piv=1, target device, SCSI name string */ in inquiry_vpd_83()
1295 arr[num++] = 0x0; in inquiry_vpd_83()
1296 arr[num++] = 24; in inquiry_vpd_83()
1297 memcpy(arr + num, "naa.32222220", 12); in inquiry_vpd_83()
1300 memcpy(arr + num, b, 8); in inquiry_vpd_83()
1302 memset(arr + num, 0, 4); in inquiry_vpd_83()
1314 static int inquiry_vpd_84(unsigned char *arr) in inquiry_vpd_84() argument
1316 memcpy(arr, vpd84_data, sizeof(vpd84_data)); in inquiry_vpd_84()
1321 static int inquiry_vpd_85(unsigned char *arr) in inquiry_vpd_85() argument
1328 arr[num++] = 0x1; /* lu, storage config */ in inquiry_vpd_85()
1329 arr[num++] = 0x0; /* reserved */ in inquiry_vpd_85()
1330 arr[num++] = 0x0; in inquiry_vpd_85()
1335 arr[num++] = plen; /* length, null termianted, padded */ in inquiry_vpd_85()
1336 memcpy(arr + num, na1, olen); in inquiry_vpd_85()
1337 memset(arr + num + olen, 0, plen - olen); in inquiry_vpd_85()
1340 arr[num++] = 0x4; /* lu, logging */ in inquiry_vpd_85()
1341 arr[num++] = 0x0; /* reserved */ in inquiry_vpd_85()
1342 arr[num++] = 0x0; in inquiry_vpd_85()
1347 arr[num++] = plen; /* length, null terminated, padded */ in inquiry_vpd_85()
1348 memcpy(arr + num, na2, olen); in inquiry_vpd_85()
1349 memset(arr + num + olen, 0, plen - olen); in inquiry_vpd_85()
1356 static int inquiry_vpd_88(unsigned char *arr, int target_dev_id) in inquiry_vpd_88() argument
1363 arr[num++] = 0x0; /* reserved */ in inquiry_vpd_88()
1364 arr[num++] = 0x0; /* reserved */ in inquiry_vpd_88()
1365 arr[num++] = 0x0; in inquiry_vpd_88()
1366 arr[num++] = 0x1; /* relative port 1 (primary) */ in inquiry_vpd_88()
1367 memset(arr + num, 0, 6); in inquiry_vpd_88()
1369 arr[num++] = 0x0; in inquiry_vpd_88()
1370 arr[num++] = 12; /* length tp descriptor */ in inquiry_vpd_88()
1372 arr[num++] = 0x61; /* proto=sas, binary */ in inquiry_vpd_88()
1373 arr[num++] = 0x93; /* PIV=1, target port, NAA */ in inquiry_vpd_88()
1374 arr[num++] = 0x0; /* reserved */ in inquiry_vpd_88()
1375 arr[num++] = 0x8; /* length */ in inquiry_vpd_88()
1376 put_unaligned_be64(naa3_comp_a + port_a, arr + num); in inquiry_vpd_88()
1378 arr[num++] = 0x0; /* reserved */ in inquiry_vpd_88()
1379 arr[num++] = 0x0; /* reserved */ in inquiry_vpd_88()
1380 arr[num++] = 0x0; in inquiry_vpd_88()
1381 arr[num++] = 0x2; /* relative port 2 (secondary) */ in inquiry_vpd_88()
1382 memset(arr + num, 0, 6); in inquiry_vpd_88()
1384 arr[num++] = 0x0; in inquiry_vpd_88()
1385 arr[num++] = 12; /* length tp descriptor */ in inquiry_vpd_88()
1387 arr[num++] = 0x61; /* proto=sas, binary */ in inquiry_vpd_88()
1388 arr[num++] = 0x93; /* PIV=1, target port, NAA */ in inquiry_vpd_88()
1389 arr[num++] = 0x0; /* reserved */ in inquiry_vpd_88()
1390 arr[num++] = 0x8; /* length */ in inquiry_vpd_88()
1391 put_unaligned_be64(naa3_comp_a + port_b, arr + num); in inquiry_vpd_88()
1443 static int inquiry_vpd_89(unsigned char *arr) in inquiry_vpd_89() argument
1445 memcpy(arr, vpd89_data, sizeof(vpd89_data)); in inquiry_vpd_89()
1458 static int inquiry_vpd_b0(unsigned char *arr) in inquiry_vpd_b0() argument
1462 memcpy(arr, vpdb0_data, sizeof(vpdb0_data)); in inquiry_vpd_b0()
1470 put_unaligned_be16(gran, arr + 2); in inquiry_vpd_b0()
1474 put_unaligned_be32(sdebug_store_sectors, arr + 4); in inquiry_vpd_b0()
1477 put_unaligned_be32(sdebug_opt_blks, &arr[8]); in inquiry_vpd_b0()
1481 put_unaligned_be32(sdebug_unmap_max_blocks, &arr[16]); in inquiry_vpd_b0()
1484 put_unaligned_be32(sdebug_unmap_max_desc, &arr[20]); in inquiry_vpd_b0()
1489 put_unaligned_be32(sdebug_unmap_alignment, &arr[28]); in inquiry_vpd_b0()
1490 arr[28] |= 0x80; /* UGAVALID */ in inquiry_vpd_b0()
1494 put_unaligned_be32(sdebug_unmap_granularity, &arr[24]); in inquiry_vpd_b0()
1497 put_unaligned_be64(sdebug_write_same_length, &arr[32]); in inquiry_vpd_b0()
1505 static int inquiry_vpd_b1(struct sdebug_dev_info *devip, unsigned char *arr) in inquiry_vpd_b1() argument
1507 memset(arr, 0, 0x3c); in inquiry_vpd_b1()
1508 arr[0] = 0; in inquiry_vpd_b1()
1509 arr[1] = 1; /* non rotating medium (e.g. solid state) */ in inquiry_vpd_b1()
1510 arr[2] = 0; in inquiry_vpd_b1()
1511 arr[3] = 5; /* less than 1.8" */ in inquiry_vpd_b1()
1513 arr[4] = 1 << 4; /* zoned field = 01b */ in inquiry_vpd_b1()
1519 static int inquiry_vpd_b2(unsigned char *arr) in inquiry_vpd_b2() argument
1521 memset(arr, 0, 0x4); in inquiry_vpd_b2()
1522 arr[0] = 0; /* threshold exponent */ in inquiry_vpd_b2()
1524 arr[1] = 1 << 7; in inquiry_vpd_b2()
1526 arr[1] |= 1 << 6; in inquiry_vpd_b2()
1528 arr[1] |= 1 << 5; in inquiry_vpd_b2()
1530 arr[1] |= (sdebug_lbprz & 0x7) << 2; /* sbc4r07 and later */ in inquiry_vpd_b2()
1538 static int inquiry_vpd_b6(struct sdebug_dev_info *devip, unsigned char *arr) in inquiry_vpd_b6() argument
1540 memset(arr, 0, 0x3c); in inquiry_vpd_b6()
1541 arr[0] = 0x1; /* set URSWRZ (unrestricted read in seq. wr req zone) */ in inquiry_vpd_b6()
1548 put_unaligned_be32(0xffffffff, &arr[4]); in inquiry_vpd_b6()
1549 put_unaligned_be32(0xffffffff, &arr[8]); in inquiry_vpd_b6()
1551 put_unaligned_be32(devip->max_open, &arr[12]); in inquiry_vpd_b6()
1553 put_unaligned_be32(0xffffffff, &arr[12]); in inquiry_vpd_b6()
1563 unsigned char *arr; in resp_inquiry() local
1570 arr = kzalloc(SDEBUG_MAX_INQ_ARR_SZ, GFP_ATOMIC); in resp_inquiry()
1571 if (! arr) in resp_inquiry()
1583 arr[0] = pq_pdt; in resp_inquiry()
1586 kfree(arr); in resp_inquiry()
1604 arr[1] = cmd[2]; /*sanity */ in resp_inquiry()
1606 arr[n++] = 0x0; /* this page */ in resp_inquiry()
1607 arr[n++] = 0x80; /* unit serial number */ in resp_inquiry()
1608 arr[n++] = 0x83; /* device identification */ in resp_inquiry()
1609 arr[n++] = 0x84; /* software interface ident. */ in resp_inquiry()
1610 arr[n++] = 0x85; /* management network addresses */ in resp_inquiry()
1611 arr[n++] = 0x86; /* extended inquiry */ in resp_inquiry()
1612 arr[n++] = 0x87; /* mode page policy */ in resp_inquiry()
1613 arr[n++] = 0x88; /* SCSI ports */ in resp_inquiry()
1615 arr[n++] = 0x89; /* ATA information */ in resp_inquiry()
1616 arr[n++] = 0xb0; /* Block limits */ in resp_inquiry()
1617 arr[n++] = 0xb1; /* Block characteristics */ in resp_inquiry()
1619 arr[n++] = 0xb2; /* LB Provisioning */ in resp_inquiry()
1621 arr[n++] = 0xb6; /* ZB dev. char. */ in resp_inquiry()
1623 arr[3] = n - 4; /* number of supported VPD pages */ in resp_inquiry()
1625 arr[1] = cmd[2]; /*sanity */ in resp_inquiry()
1626 arr[3] = len; in resp_inquiry()
1627 memcpy(&arr[4], lu_id_str, len); in resp_inquiry()
1629 arr[1] = cmd[2]; /*sanity */ in resp_inquiry()
1630 arr[3] = inquiry_vpd_83(&arr[4], port_group_id, in resp_inquiry()
1635 arr[1] = cmd[2]; /*sanity */ in resp_inquiry()
1636 arr[3] = inquiry_vpd_84(&arr[4]); in resp_inquiry()
1638 arr[1] = cmd[2]; /*sanity */ in resp_inquiry()
1639 arr[3] = inquiry_vpd_85(&arr[4]); in resp_inquiry()
1641 arr[1] = cmd[2]; /*sanity */ in resp_inquiry()
1642 arr[3] = 0x3c; /* number of following entries */ in resp_inquiry()
1644 arr[4] = 0x4; /* SPT: GRD_CHK:1 */ in resp_inquiry()
1646 arr[4] = 0x5; /* SPT: GRD_CHK:1, REF_CHK:1 */ in resp_inquiry()
1648 arr[4] = 0x0; /* no protection stuff */ in resp_inquiry()
1649 arr[5] = 0x7; /* head of q, ordered + simple q's */ in resp_inquiry()
1651 arr[1] = cmd[2]; /*sanity */ in resp_inquiry()
1652 arr[3] = 0x8; /* number of following entries */ in resp_inquiry()
1653 arr[4] = 0x2; /* disconnect-reconnect mp */ in resp_inquiry()
1654 arr[6] = 0x80; /* mlus, shared */ in resp_inquiry()
1655 arr[8] = 0x18; /* protocol specific lu */ in resp_inquiry()
1656 arr[10] = 0x82; /* mlus, per initiator port */ in resp_inquiry()
1658 arr[1] = cmd[2]; /*sanity */ in resp_inquiry()
1659 arr[3] = inquiry_vpd_88(&arr[4], target_dev_id); in resp_inquiry()
1661 arr[1] = cmd[2]; /*sanity */ in resp_inquiry()
1662 n = inquiry_vpd_89(&arr[4]); in resp_inquiry()
1663 put_unaligned_be16(n, arr + 2); in resp_inquiry()
1665 arr[1] = cmd[2]; /*sanity */ in resp_inquiry()
1666 arr[3] = inquiry_vpd_b0(&arr[4]); in resp_inquiry()
1668 arr[1] = cmd[2]; /*sanity */ in resp_inquiry()
1669 arr[3] = inquiry_vpd_b1(devip, &arr[4]); in resp_inquiry()
1671 arr[1] = cmd[2]; /*sanity */ in resp_inquiry()
1672 arr[3] = inquiry_vpd_b2(&arr[4]); in resp_inquiry()
1674 arr[1] = cmd[2]; /*sanity */ in resp_inquiry()
1675 arr[3] = inquiry_vpd_b6(devip, &arr[4]); in resp_inquiry()
1678 kfree(arr); in resp_inquiry()
1681 len = min_t(u32, get_unaligned_be16(arr + 2) + 4, alloc_len); in resp_inquiry()
1682 ret = fill_from_dev_buffer(scp, arr, in resp_inquiry()
1684 kfree(arr); in resp_inquiry()
1688 arr[1] = sdebug_removable ? 0x80 : 0; /* Removable disk */ in resp_inquiry()
1689 arr[2] = sdebug_scsi_level; in resp_inquiry()
1690 arr[3] = 2; /* response_data_format==2 */ in resp_inquiry()
1691 arr[4] = SDEBUG_LONG_INQ_SZ - 5; in resp_inquiry()
1692 arr[5] = (int)have_dif_prot; /* PROTECT bit */ in resp_inquiry()
1694 arr[5] |= 0x10; /* claim: implicit TPGS */ in resp_inquiry()
1695 arr[6] = 0x10; /* claim: MultiP */ in resp_inquiry()
1697 arr[7] = 0xa; /* claim: LINKED + CMDQUE */ in resp_inquiry()
1698 memcpy(&arr[8], sdebug_inq_vendor_id, 8); in resp_inquiry()
1699 memcpy(&arr[16], sdebug_inq_product_id, 16); in resp_inquiry()
1700 memcpy(&arr[32], sdebug_inq_product_rev, 4); in resp_inquiry()
1702 memcpy(&arr[36], sdebug_version_date, 8); in resp_inquiry()
1704 put_unaligned_be16(0xc0, arr + 58); /* SAM-6 no version claimed */ in resp_inquiry()
1705 put_unaligned_be16(0x5c0, arr + 60); /* SPC-5 no version claimed */ in resp_inquiry()
1708 put_unaligned_be16(0x600, arr + n); in resp_inquiry()
1711 put_unaligned_be16(0x525, arr + n); in resp_inquiry()
1714 put_unaligned_be16(0x624, arr + n); in resp_inquiry()
1717 put_unaligned_be16(0x2100, arr + n); /* SPL-4 no version claimed */ in resp_inquiry()
1718 ret = fill_from_dev_buffer(scp, arr, in resp_inquiry()
1720 kfree(arr); in resp_inquiry()
1732 unsigned char arr[SCSI_SENSE_BUFFERSIZE]; /* assume >= 18 bytes */ in resp_requests() local
1738 memset(arr, 0, sizeof(arr)); in resp_requests()
1741 arr[0] = 0x72; in resp_requests()
1742 arr[1] = NOT_READY; in resp_requests()
1743 arr[2] = LOGICAL_UNIT_NOT_READY; in resp_requests()
1744 arr[3] = (stopped_state == 2) ? 0x1 : 0x2; in resp_requests()
1747 arr[0] = 0x70; in resp_requests()
1748 arr[2] = NOT_READY; /* NO_SENSE in sense_key */ in resp_requests()
1749 arr[7] = 0xa; /* 18 byte sense buffer */ in resp_requests()
1750 arr[12] = LOGICAL_UNIT_NOT_READY; in resp_requests()
1751 arr[13] = (stopped_state == 2) ? 0x1 : 0x2; in resp_requests()
1756 arr[0] = 0x72; in resp_requests()
1757 arr[1] = 0x0; /* NO_SENSE in sense_key */ in resp_requests()
1758 arr[2] = THRESHOLD_EXCEEDED; in resp_requests()
1759 arr[3] = 0xff; /* Failure prediction(false) */ in resp_requests()
1762 arr[0] = 0x70; in resp_requests()
1763 arr[2] = 0x0; /* NO_SENSE in sense_key */ in resp_requests()
1764 arr[7] = 0xa; /* 18 byte sense buffer */ in resp_requests()
1765 arr[12] = THRESHOLD_EXCEEDED; in resp_requests()
1766 arr[13] = 0xff; /* Failure prediction(false) */ in resp_requests()
1771 memset(arr, 0, len); in resp_requests()
1772 arr[0] = 0x72; in resp_requests()
1774 memset(arr, 0, len); in resp_requests()
1775 arr[0] = 0x70; in resp_requests()
1776 arr[7] = 0xa; in resp_requests()
1779 return fill_from_dev_buffer(scp, arr, min_t(u32, len, alloc_len)); in resp_requests()
1840 unsigned char arr[SDEBUG_READCAP_ARR_SZ]; in resp_readcap() local
1845 memset(arr, 0, SDEBUG_READCAP_ARR_SZ); in resp_readcap()
1848 put_unaligned_be32(capac, arr + 0); in resp_readcap()
1850 put_unaligned_be32(0xffffffff, arr + 0); in resp_readcap()
1851 put_unaligned_be16(sdebug_sector_size, arr + 6); in resp_readcap()
1852 return fill_from_dev_buffer(scp, arr, SDEBUG_READCAP_ARR_SZ); in resp_readcap()
1860 unsigned char arr[SDEBUG_READCAP16_ARR_SZ]; in resp_readcap16() local
1866 memset(arr, 0, SDEBUG_READCAP16_ARR_SZ); in resp_readcap16()
1867 put_unaligned_be64((u64)(sdebug_capacity - 1), arr + 0); in resp_readcap16()
1868 put_unaligned_be32(sdebug_sector_size, arr + 8); in resp_readcap16()
1869 arr[13] = sdebug_physblk_exp & 0xf; in resp_readcap16()
1870 arr[14] = (sdebug_lowest_aligned >> 8) & 0x3f; in resp_readcap16()
1873 arr[14] |= 0x80; /* LBPME */ in resp_readcap16()
1879 arr[14] |= 0x40; in resp_readcap16()
1882 arr[15] = sdebug_lowest_aligned & 0xff; in resp_readcap16()
1885 arr[12] = (sdebug_dif - 1) << 1; /* P_TYPE */ in resp_readcap16()
1886 arr[12] |= 1; /* PROT_EN */ in resp_readcap16()
1889 return fill_from_dev_buffer(scp, arr, in resp_readcap16()
1899 unsigned char *arr; in resp_report_tgtpgs() local
1906 arr = kzalloc(SDEBUG_MAX_TGTPGS_ARR_SZ, GFP_ATOMIC); in resp_report_tgtpgs()
1907 if (! arr) in resp_report_tgtpgs()
1927 arr[n++] = host_no % 3; /* Asymm access state */ in resp_report_tgtpgs()
1928 arr[n++] = 0x0F; /* claim: all states are supported */ in resp_report_tgtpgs()
1930 arr[n++] = 0x0; /* Active/Optimized path */ in resp_report_tgtpgs()
1931 arr[n++] = 0x01; /* only support active/optimized paths */ in resp_report_tgtpgs()
1933 put_unaligned_be16(port_group_a, arr + n); in resp_report_tgtpgs()
1935 arr[n++] = 0; /* Reserved */ in resp_report_tgtpgs()
1936 arr[n++] = 0; /* Status code */ in resp_report_tgtpgs()
1937 arr[n++] = 0; /* Vendor unique */ in resp_report_tgtpgs()
1938 arr[n++] = 0x1; /* One port per group */ in resp_report_tgtpgs()
1939 arr[n++] = 0; /* Reserved */ in resp_report_tgtpgs()
1940 arr[n++] = 0; /* Reserved */ in resp_report_tgtpgs()
1941 put_unaligned_be16(port_a, arr + n); in resp_report_tgtpgs()
1943 arr[n++] = 3; /* Port unavailable */ in resp_report_tgtpgs()
1944 arr[n++] = 0x08; /* claim: only unavailalbe paths are supported */ in resp_report_tgtpgs()
1945 put_unaligned_be16(port_group_b, arr + n); in resp_report_tgtpgs()
1947 arr[n++] = 0; /* Reserved */ in resp_report_tgtpgs()
1948 arr[n++] = 0; /* Status code */ in resp_report_tgtpgs()
1949 arr[n++] = 0; /* Vendor unique */ in resp_report_tgtpgs()
1950 arr[n++] = 0x1; /* One port per group */ in resp_report_tgtpgs()
1951 arr[n++] = 0; /* Reserved */ in resp_report_tgtpgs()
1952 arr[n++] = 0; /* Reserved */ in resp_report_tgtpgs()
1953 put_unaligned_be16(port_b, arr + n); in resp_report_tgtpgs()
1957 put_unaligned_be32(rlen, arr + 0); in resp_report_tgtpgs()
1966 ret = fill_from_dev_buffer(scp, arr, in resp_report_tgtpgs()
1968 kfree(arr); in resp_report_tgtpgs()
1982 u8 *arr; in resp_rsup_opcodes() local
1998 arr = kzalloc((a_len < 256) ? 320 : a_len + 64, GFP_ATOMIC); in resp_rsup_opcodes()
1999 if (NULL == arr) { in resp_rsup_opcodes()
2014 put_unaligned_be32(count * bump, arr); in resp_rsup_opcodes()
2020 arr[offset] = oip->opcode; in resp_rsup_opcodes()
2021 put_unaligned_be16(oip->sa, arr + offset + 2); in resp_rsup_opcodes()
2023 arr[offset + 5] |= 0x2; in resp_rsup_opcodes()
2025 arr[offset + 5] |= 0x1; in resp_rsup_opcodes()
2026 put_unaligned_be16(oip->len_mask[0], arr + offset + 6); in resp_rsup_opcodes()
2028 put_unaligned_be16(0xa, arr + offset + 8); in resp_rsup_opcodes()
2034 arr[offset] = oip->opcode; in resp_rsup_opcodes()
2035 put_unaligned_be16(oip->sa, arr + offset + 2); in resp_rsup_opcodes()
2037 arr[offset + 5] |= 0x2; in resp_rsup_opcodes()
2039 arr[offset + 5] |= 0x1; in resp_rsup_opcodes()
2041 arr + offset + 6); in resp_rsup_opcodes()
2044 arr + offset + 8); in resp_rsup_opcodes()
2063 kfree(arr); in resp_rsup_opcodes()
2070 kfree(arr); /* point at requested sa */ in resp_rsup_opcodes()
2096 put_unaligned_be16(u, arr + 2); in resp_rsup_opcodes()
2097 arr[4] = oip->opcode; in resp_rsup_opcodes()
2099 arr[4 + k] = (k < 16) ? in resp_rsup_opcodes()
2105 arr[1] = (rctd ? 0x80 : 0) | supp; in resp_rsup_opcodes()
2107 put_unaligned_be16(0xa, arr + offset); in resp_rsup_opcodes()
2113 kfree(arr); in resp_rsup_opcodes()
2118 errsts = fill_from_dev_buffer(scp, arr, len); in resp_rsup_opcodes()
2119 kfree(arr); in resp_rsup_opcodes()
2128 u8 arr[16]; in resp_rsup_tmfs() local
2131 memset(arr, 0, sizeof(arr)); in resp_rsup_tmfs()
2138 arr[0] = 0xc8; /* ATS | ATSS | LURS */ in resp_rsup_tmfs()
2139 arr[1] = 0x1; /* ITNRS */ in resp_rsup_tmfs()
2141 arr[3] = 0xc; in resp_rsup_tmfs()
2147 return fill_from_dev_buffer(scp, arr, len); in resp_rsup_tmfs()
2321 unsigned char arr[SDEBUG_MAX_MSENSE_SZ]; in resp_mode_sense() local
2338 memset(arr, 0, SDEBUG_MAX_MSENSE_SZ); in resp_mode_sense()
2353 arr[2] = dev_spec; in resp_mode_sense()
2354 arr[3] = bd_len; in resp_mode_sense()
2357 arr[3] = dev_spec; in resp_mode_sense()
2359 arr[4] = 0x1; /* set LONGLBA bit */ in resp_mode_sense()
2360 arr[7] = bd_len; /* assume 255 or less */ in resp_mode_sense()
2363 ap = arr + offset; in resp_mode_sense()
2374 ap = arr + offset; in resp_mode_sense()
2379 ap = arr + offset; in resp_mode_sense()
2471 arr[0] = offset - 1; in resp_mode_sense()
2473 put_unaligned_be16((offset - 2), arr + 0); in resp_mode_sense()
2474 return fill_from_dev_buffer(scp, arr, min_t(u32, alloc_len, offset)); in resp_mode_sense()
2484 unsigned char arr[SDEBUG_MAX_MSELECT_SZ]; in resp_mode_select() local
2488 memset(arr, 0, sizeof(arr)); in resp_mode_select()
2496 res = fetch_to_dev_buffer(scp, arr, param_len); in resp_mode_select()
2503 md_len = mselect6 ? (arr[0] + 1) : (get_unaligned_be16(arr + 0) + 2); in resp_mode_select()
2504 bd_len = mselect6 ? arr[3] : get_unaligned_be16(arr + 6); in resp_mode_select()
2510 mpage = arr[off] & 0x3f; in resp_mode_select()
2511 ps = !!(arr[off] & 0x80); in resp_mode_select()
2516 spf = !!(arr[off] & 0x40); in resp_mode_select()
2517 pg_len = spf ? (get_unaligned_be16(arr + off + 2) + 4) : in resp_mode_select()
2518 (arr[off + 1] + 2); in resp_mode_select()
2526 if (caching_pg[1] == arr[off + 1]) { in resp_mode_select()
2527 memcpy(caching_pg + 2, arr + off + 2, in resp_mode_select()
2533 if (ctrl_m_pg[1] == arr[off + 1]) { in resp_mode_select()
2534 memcpy(ctrl_m_pg + 2, arr + off + 2, in resp_mode_select()
2545 if (iec_m_pg[1] == arr[off + 1]) { in resp_mode_select()
2546 memcpy(iec_m_pg + 2, arr + off + 2, in resp_mode_select()
2561 static int resp_temp_l_pg(unsigned char *arr) in resp_temp_l_pg() argument
2567 memcpy(arr, temp_l_pg, sizeof(temp_l_pg)); in resp_temp_l_pg()
2571 static int resp_ie_l_pg(unsigned char *arr) in resp_ie_l_pg() argument
2576 memcpy(arr, ie_l_pg, sizeof(ie_l_pg)); in resp_ie_l_pg()
2578 arr[4] = THRESHOLD_EXCEEDED; in resp_ie_l_pg()
2579 arr[5] = 0xff; in resp_ie_l_pg()
2591 unsigned char arr[SDEBUG_MAX_LSENSE_SZ]; in resp_log_sense() local
2594 memset(arr, 0, sizeof(arr)); in resp_log_sense()
2604 arr[0] = pcode; in resp_log_sense()
2609 arr[n++] = 0x0; /* this page */ in resp_log_sense()
2610 arr[n++] = 0xd; /* Temperature */ in resp_log_sense()
2611 arr[n++] = 0x2f; /* Informational exceptions */ in resp_log_sense()
2612 arr[3] = n - 4; in resp_log_sense()
2615 arr[3] = resp_temp_l_pg(arr + 4); in resp_log_sense()
2618 arr[3] = resp_ie_l_pg(arr + 4); in resp_log_sense()
2625 arr[0] |= 0x40; in resp_log_sense()
2626 arr[1] = subpcode; in resp_log_sense()
2630 arr[n++] = 0x0; in resp_log_sense()
2631 arr[n++] = 0x0; /* 0,0 page */ in resp_log_sense()
2632 arr[n++] = 0x0; in resp_log_sense()
2633 arr[n++] = 0xff; /* this page */ in resp_log_sense()
2634 arr[n++] = 0xd; in resp_log_sense()
2635 arr[n++] = 0x0; /* Temperature */ in resp_log_sense()
2636 arr[n++] = 0x2f; in resp_log_sense()
2637 arr[n++] = 0x0; /* Informational exceptions */ in resp_log_sense()
2638 arr[3] = n - 4; in resp_log_sense()
2642 arr[n++] = 0xd; in resp_log_sense()
2643 arr[n++] = 0x0; /* Temperature */ in resp_log_sense()
2644 arr[3] = n - 4; in resp_log_sense()
2648 arr[n++] = 0x2f; in resp_log_sense()
2649 arr[n++] = 0x0; /* Informational exceptions */ in resp_log_sense()
2650 arr[3] = n - 4; in resp_log_sense()
2660 len = min_t(u32, get_unaligned_be16(arr + 2) + 4, alloc_len); in resp_log_sense()
2661 return fill_from_dev_buffer(scp, arr, in resp_log_sense()
2967 const u8 *arr, bool compare_only) in comp_write_worker() argument
2979 res = !memcmp(fsp + (block * lb_size), arr, (num - rest) * lb_size); in comp_write_worker()
2983 res = memcmp(fsp, arr + ((num - rest) * lb_size), in comp_write_worker()
2989 arr += num * lb_size; in comp_write_worker()
2990 memcpy(fsp + (block * lb_size), arr, (num - rest) * lb_size); in comp_write_worker()
2992 memcpy(fsp, arr + ((num - rest) * lb_size), rest * lb_size); in comp_write_worker()
3888 u8 *arr; in resp_comp_write() local
3916 arr = kcalloc(lb_size, dnum, GFP_ATOMIC); in resp_comp_write()
3917 if (NULL == arr) { in resp_comp_write()
3925 ret = do_dout_fetch(scp, dnum, arr); in resp_comp_write()
3933 if (!comp_write_worker(sip, lba, num, arr, false)) { in resp_comp_write()
3942 kfree(arr); in resp_comp_write()
4017 u8 arr[SDEBUG_GET_LBA_STATUS_LEN]; in resp_get_lba_status() local
4043 memset(arr, 0, SDEBUG_GET_LBA_STATUS_LEN); in resp_get_lba_status()
4044 put_unaligned_be32(20, arr); /* Parameter Data Length */ in resp_get_lba_status()
4045 put_unaligned_be64(lba, arr + 8); /* LBA */ in resp_get_lba_status()
4046 put_unaligned_be32(num, arr + 16); /* Number of blocks */ in resp_get_lba_status()
4047 arr[20] = !mapped; /* prov_stat=0: mapped; 1: dealloc */ in resp_get_lba_status()
4049 return fill_from_dev_buffer(scp, arr, SDEBUG_GET_LBA_STATUS_LEN); in resp_get_lba_status()
4146 u8 arr[RL_BUCKET_ELEMS * sizeof(struct scsi_lun)]; in resp_report_luns() local
4200 memset(arr, 0, sizeof(arr)); in resp_report_luns()
4201 lun_p = (struct scsi_lun *)&arr[0]; in resp_report_luns()
4203 put_unaligned_be32(rlen, &arr[0]); in resp_report_luns()
4217 res = p_fill_from_dev_buffer(scp, arr, n, off_rsp); in resp_report_luns()
4227 res = p_fill_from_dev_buffer(scp, arr, j * sz_lun, off_rsp); in resp_report_luns()
4239 u8 *arr; in resp_verify() local
4274 arr = kcalloc(lb_size, vnum, GFP_ATOMIC); in resp_verify()
4275 if (!arr) { in resp_verify()
4283 ret = do_dout_fetch(scp, a_num, arr); in resp_verify()
4294 memcpy(arr + off, arr, lb_size); in resp_verify()
4297 if (!comp_write_worker(sip, lba, vnum, arr, true)) { in resp_verify()
4304 kfree(arr); in resp_verify()
4319 u8 *arr = NULL, *desc; in resp_report_zones() local
4345 arr = kzalloc(alloc_len, GFP_ATOMIC); in resp_report_zones()
4346 if (!arr) { in resp_report_zones()
4354 desc = arr + 64; in resp_report_zones()
4433 put_unaligned_be32(nrz * RZONES_DESC_HD, arr + 0); in resp_report_zones()
4434 put_unaligned_be64(sdebug_capacity - 1, arr + 8); in resp_report_zones()
4436 rep_len = (unsigned long)desc - (unsigned long)arr; in resp_report_zones()
4437 ret = fill_from_dev_buffer(scp, arr, min_t(u32, alloc_len, rep_len)); in resp_report_zones()
4441 kfree(arr); in resp_report_zones()
5792 char arr[16]; in scsi_debug_write_info() local
5798 memcpy(arr, buffer, minLen); in scsi_debug_write_info()
5799 arr[minLen] = '\0'; in scsi_debug_write_info()
5800 if (1 != sscanf(arr, "%d", &opts)) in scsi_debug_write_info()