Lines Matching refs:karg
126 static int mptctl_do_mpt_command(struct mpt_ioctl_command karg, void __user *mfPtr);
1244 struct mpt_ioctl_iocinfo *karg; in mptctl_getiocinfo() local
1268 karg = memdup_user(uarg, data_size); in mptctl_getiocinfo()
1269 if (IS_ERR(karg)) { in mptctl_getiocinfo()
1271 __FILE__, __LINE__, PTR_ERR(karg)); in mptctl_getiocinfo()
1272 return PTR_ERR(karg); in mptctl_getiocinfo()
1275 if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) || in mptctl_getiocinfo()
1279 kfree(karg); in mptctl_getiocinfo()
1284 if (karg->hdr.maxDataSize != data_size) { in mptctl_getiocinfo()
1288 kfree(karg); in mptctl_getiocinfo()
1299 karg->adapterType = MPT_IOCTL_INTERFACE_SAS; in mptctl_getiocinfo()
1301 karg->adapterType = MPT_IOCTL_INTERFACE_FC; in mptctl_getiocinfo()
1303 karg->adapterType = MPT_IOCTL_INTERFACE_SCSI; in mptctl_getiocinfo()
1305 if (karg->hdr.port > 1) { in mptctl_getiocinfo()
1306 kfree(karg); in mptctl_getiocinfo()
1309 port = karg->hdr.port; in mptctl_getiocinfo()
1311 karg->port = port; in mptctl_getiocinfo()
1314 karg->pciId = pdev->device; in mptctl_getiocinfo()
1315 karg->hwRev = pdev->revision; in mptctl_getiocinfo()
1316 karg->subSystemDevice = pdev->subsystem_device; in mptctl_getiocinfo()
1317 karg->subSystemVendor = pdev->subsystem_vendor; in mptctl_getiocinfo()
1322 karg->pciInfo.u.bits.busNumber = pdev->bus->number; in mptctl_getiocinfo()
1323 karg->pciInfo.u.bits.deviceNumber = PCI_SLOT( pdev->devfn ); in mptctl_getiocinfo()
1324 karg->pciInfo.u.bits.functionNumber = PCI_FUNC( pdev->devfn ); in mptctl_getiocinfo()
1328 karg->pciInfo.u.bits.busNumber = pdev->bus->number; in mptctl_getiocinfo()
1329 karg->pciInfo.u.bits.deviceNumber = PCI_SLOT( pdev->devfn ); in mptctl_getiocinfo()
1330 karg->pciInfo.u.bits.functionNumber = PCI_FUNC( pdev->devfn ); in mptctl_getiocinfo()
1331 karg->pciInfo.segmentID = pci_domain_nr(pdev->bus); in mptctl_getiocinfo()
1336 karg->numDevices = 0; in mptctl_getiocinfo()
1345 karg->numDevices++; in mptctl_getiocinfo()
1351 karg->FWVersion = ioc->facts.FWVersion.Word; in mptctl_getiocinfo()
1352 karg->BIOSVersion = ioc->biosVersion; in mptctl_getiocinfo()
1356 strncpy (karg->driverVersion, MPT_LINUX_PACKAGE_NAME, MPT_IOCTL_VERSION_LENGTH); in mptctl_getiocinfo()
1357 karg->driverVersion[MPT_IOCTL_VERSION_LENGTH-1]='\0'; in mptctl_getiocinfo()
1359 karg->busChangeEvent = 0; in mptctl_getiocinfo()
1360 karg->hostId = ioc->pfacts[port].PortSCSIID; in mptctl_getiocinfo()
1361 karg->rsvd[0] = karg->rsvd[1] = 0; in mptctl_getiocinfo()
1365 if (copy_to_user((char __user *)arg, karg, data_size)) { in mptctl_getiocinfo()
1369 kfree(karg); in mptctl_getiocinfo()
1373 kfree(karg); in mptctl_getiocinfo()
1391 struct mpt_ioctl_targetinfo karg; in mptctl_gettargetinfo() local
1404 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_targetinfo))) { in mptctl_gettargetinfo()
1411 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || in mptctl_gettargetinfo()
1424 numBytes = karg.hdr.maxDataSize - sizeof(mpt_ioctl_header); in mptctl_gettargetinfo()
1426 port = karg.hdr.port; in mptctl_gettargetinfo()
1476 karg.numDevices = numDevices; in mptctl_gettargetinfo()
1480 if (copy_to_user((char __user *)arg, &karg, in mptctl_gettargetinfo()
1516 struct mpt_ioctl_test karg; in mptctl_readtest() local
1520 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) { in mptctl_readtest()
1527 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || in mptctl_readtest()
1541 karg.chip_type = ioc->mfcnt; in mptctl_readtest()
1543 karg.chip_type = ioc->pcidev->device; in mptctl_readtest()
1545 strncpy (karg.name, ioc->name, MPT_MAX_NAME); in mptctl_readtest()
1546 karg.name[MPT_MAX_NAME-1]='\0'; in mptctl_readtest()
1547 strncpy (karg.product, ioc->prod_name, MPT_PRODUCT_LENGTH); in mptctl_readtest()
1548 karg.product[MPT_PRODUCT_LENGTH-1]='\0'; in mptctl_readtest()
1552 if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_test))) { in mptctl_readtest()
1577 struct mpt_ioctl_eventquery karg; in mptctl_eventquery() local
1581 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) { in mptctl_eventquery()
1588 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || in mptctl_eventquery()
1597 karg.eventEntries = MPTCTL_EVENT_LOG_SIZE; in mptctl_eventquery()
1598 karg.eventTypes = ioc->eventTypes; in mptctl_eventquery()
1602 if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_eventquery))) { in mptctl_eventquery()
1616 struct mpt_ioctl_eventenable karg; in mptctl_eventenable() local
1620 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) { in mptctl_eventenable()
1627 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || in mptctl_eventenable()
1654 ioc->eventTypes = karg.eventTypes; in mptctl_eventenable()
1664 struct mpt_ioctl_eventreport karg; in mptctl_eventreport() local
1669 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) { in mptctl_eventreport()
1676 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || in mptctl_eventreport()
1685 numBytes = karg.hdr.maxDataSize - sizeof(mpt_ioctl_header); in mptctl_eventreport()
1718 struct mpt_ioctl_replace_fw karg; in mptctl_replace_fw() local
1723 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) { in mptctl_replace_fw()
1730 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || in mptctl_replace_fw()
1748 newFwSize = ALIGN(karg.newImageSize, 4); in mptctl_replace_fw()
1786 struct mpt_ioctl_command karg; in mptctl_mpt_command() local
1792 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_command))) { in mptctl_mpt_command()
1799 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || in mptctl_mpt_command()
1806 rc = mptctl_do_mpt_command (karg, &uarg->MF); in mptctl_mpt_command()
1824 mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) in mptctl_do_mpt_command() argument
1850 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || in mptctl_do_mpt_command()
1867 if (karg.maxReplyBytes < 0 || in mptctl_do_mpt_command()
1868 karg.dataInSize < 0 || in mptctl_do_mpt_command()
1869 karg.dataOutSize < 0 || in mptctl_do_mpt_command()
1870 karg.dataSgeOffset < 0 || in mptctl_do_mpt_command()
1871 karg.maxSenseBytes < 0 || in mptctl_do_mpt_command()
1872 karg.dataSgeOffset > ioc->req_sz / 4) in mptctl_do_mpt_command()
1877 sz = karg.dataSgeOffset * 4; in mptctl_do_mpt_command()
1878 if (karg.dataInSize > 0) in mptctl_do_mpt_command()
1880 if (karg.dataOutSize > 0) in mptctl_do_mpt_command()
1903 if (copy_from_user(mf, mfPtr, karg.dataSgeOffset * 4)) { in mptctl_do_mpt_command()
1923 karg.dataOutSize = karg.dataInSize = 0; in mptctl_do_mpt_command()
1984 if (karg.maxSenseBytes > MPT_SENSE_BUFFER_SIZE) in mptctl_do_mpt_command()
1987 pScsiReq->SenseBufferLength = karg.maxSenseBytes; in mptctl_do_mpt_command()
2009 if (karg.dataOutSize > 0) { in mptctl_do_mpt_command()
2011 dataSize = karg.dataOutSize; in mptctl_do_mpt_command()
2014 dataSize = karg.dataInSize; in mptctl_do_mpt_command()
2071 if (karg.maxSenseBytes > MPT_SENSE_BUFFER_SIZE) in mptctl_do_mpt_command()
2074 pScsiReq->SenseBufferLength = karg.maxSenseBytes; in mptctl_do_mpt_command()
2086 if (karg.dataOutSize > 0) { in mptctl_do_mpt_command()
2088 dataSize = karg.dataOutSize; in mptctl_do_mpt_command()
2091 dataSize = karg.dataInSize; in mptctl_do_mpt_command()
2185 psge = (char *) (((int *) mf) + karg.dataSgeOffset); in mptctl_do_mpt_command()
2188 if (karg.dataOutSize > 0) in mptctl_do_mpt_command()
2191 if (karg.dataInSize > 0) in mptctl_do_mpt_command()
2197 if (karg.dataOutSize > 0) { in mptctl_do_mpt_command()
2198 if (karg.dataInSize > 0) { in mptctl_do_mpt_command()
2206 flagsLength |= karg.dataOutSize; in mptctl_do_mpt_command()
2207 bufOut.len = karg.dataOutSize; in mptctl_do_mpt_command()
2224 karg.dataOutBufPtr, in mptctl_do_mpt_command()
2230 ioc->name, __FILE__, __LINE__,karg.dataOutBufPtr); in mptctl_do_mpt_command()
2237 if (karg.dataInSize > 0) { in mptctl_do_mpt_command()
2239 flagsLength |= karg.dataInSize; in mptctl_do_mpt_command()
2241 bufIn.len = karg.dataInSize; in mptctl_do_mpt_command()
2294 timeout = (karg.timeout > 0) ? karg.timeout : MPT_IOCTL_DEFAULT_TIMEOUT; in mptctl_do_mpt_command()
2331 if (karg.maxReplyBytes < ioc->reply_sz) { in mptctl_do_mpt_command()
2332 sz = min(karg.maxReplyBytes, in mptctl_do_mpt_command()
2338 if (copy_to_user(karg.replyFrameBufPtr, in mptctl_do_mpt_command()
2343 ioc->name, __FILE__, __LINE__, karg.replyFrameBufPtr); in mptctl_do_mpt_command()
2353 sz = min(karg.maxSenseBytes, MPT_SENSE_BUFFER_SIZE); in mptctl_do_mpt_command()
2355 if (copy_to_user(karg.senseDataPtr, in mptctl_do_mpt_command()
2360 karg.senseDataPtr); in mptctl_do_mpt_command()
2371 (karg.dataInSize > 0) && (bufIn.kptr)) { in mptctl_do_mpt_command()
2373 if (copy_to_user(karg.dataInBufPtr, in mptctl_do_mpt_command()
2374 bufIn.kptr, karg.dataInSize)) { in mptctl_do_mpt_command()
2378 karg.dataInBufPtr); in mptctl_do_mpt_command()
2428 hp_host_info_t karg; in mptctl_hp_hostinfo() local
2448 if (copy_from_user(&karg, uarg, sizeof(hp_host_info_t))) { in mptctl_hp_hostinfo()
2455 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || in mptctl_hp_hostinfo()
2469 karg.vendor = pdev->vendor; in mptctl_hp_hostinfo()
2470 karg.device = pdev->device; in mptctl_hp_hostinfo()
2471 karg.subsystem_id = pdev->subsystem_device; in mptctl_hp_hostinfo()
2472 karg.subsystem_vendor = pdev->subsystem_vendor; in mptctl_hp_hostinfo()
2473 karg.devfn = pdev->devfn; in mptctl_hp_hostinfo()
2474 karg.bus = pdev->bus->number; in mptctl_hp_hostinfo()
2480 karg.host_no = ioc->sh->host_no; in mptctl_hp_hostinfo()
2482 karg.host_no = -1; in mptctl_hp_hostinfo()
2486 karg.fw_version[0] = ioc->facts.FWVersion.Struct.Major >= 10 ? in mptctl_hp_hostinfo()
2488 karg.fw_version[1] = (ioc->facts.FWVersion.Struct.Major % 10 ) + '0'; in mptctl_hp_hostinfo()
2489 karg.fw_version[2] = '.'; in mptctl_hp_hostinfo()
2490 karg.fw_version[3] = ioc->facts.FWVersion.Struct.Minor >= 10 ? in mptctl_hp_hostinfo()
2492 karg.fw_version[4] = (ioc->facts.FWVersion.Struct.Minor % 10 ) + '0'; in mptctl_hp_hostinfo()
2493 karg.fw_version[5] = '.'; in mptctl_hp_hostinfo()
2494 karg.fw_version[6] = ioc->facts.FWVersion.Struct.Unit >= 10 ? in mptctl_hp_hostinfo()
2496 karg.fw_version[7] = (ioc->facts.FWVersion.Struct.Unit % 10 ) + '0'; in mptctl_hp_hostinfo()
2497 karg.fw_version[8] = '.'; in mptctl_hp_hostinfo()
2498 karg.fw_version[9] = ioc->facts.FWVersion.Struct.Dev >= 10 ? in mptctl_hp_hostinfo()
2500 karg.fw_version[10] = (ioc->facts.FWVersion.Struct.Dev % 10 ) + '0'; in mptctl_hp_hostinfo()
2501 karg.fw_version[11] = '\0'; in mptctl_hp_hostinfo()
2516 strncpy(karg.serial_number, " ", 24); in mptctl_hp_hostinfo()
2528 strncpy(karg.serial_number, pdata->BoardTracerNumber, 24); in mptctl_hp_hostinfo()
2529 karg.serial_number[24-1]='\0'; in mptctl_hp_hostinfo()
2540 karg.ioc_status = HP_STATUS_OK; in mptctl_hp_hostinfo()
2544 karg.ioc_status = HP_STATUS_FAILED; in mptctl_hp_hostinfo()
2550 karg.ioc_status = HP_STATUS_OTHER; in mptctl_hp_hostinfo()
2554 karg.base_io_addr = pci_resource_start(pdev, 0); in mptctl_hp_hostinfo()
2557 karg.bus_phys_width = HP_BUS_WIDTH_UNK; in mptctl_hp_hostinfo()
2559 karg.bus_phys_width = HP_BUS_WIDTH_16; in mptctl_hp_hostinfo()
2561 karg.hard_resets = 0; in mptctl_hp_hostinfo()
2562 karg.soft_resets = 0; in mptctl_hp_hostinfo()
2563 karg.timeouts = 0; in mptctl_hp_hostinfo()
2568 karg.hard_resets = ioc->hard_resets; in mptctl_hp_hostinfo()
2569 karg.soft_resets = ioc->soft_resets; in mptctl_hp_hostinfo()
2570 karg.timeouts = ioc->timeouts; in mptctl_hp_hostinfo()
2639 karg.rsvd = *(u32 *)pbuf; in mptctl_hp_hostinfo()
2650 if (copy_to_user((char __user *)arg, &karg, sizeof(hp_host_info_t))) { in mptctl_hp_hostinfo()
2680 hp_target_info_t karg; in mptctl_hp_targetinfo() local
2688 if (copy_from_user(&karg, uarg, sizeof(hp_target_info_t))) { in mptctl_hp_targetinfo()
2695 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || in mptctl_hp_targetinfo()
2712 if (ioc->sh->host_no != karg.hdr.host) in mptctl_hp_targetinfo()
2731 cfg.pageAddr = (karg.hdr.channel << 8) | karg.hdr.id; in mptctl_hp_targetinfo()
2735 karg.negotiated_width = np & MPI_SCSIDEVPAGE0_NP_WIDE ? in mptctl_hp_targetinfo()
2741 karg.negotiated_speed = HP_DEV_SPEED_ULTRA320; in mptctl_hp_targetinfo()
2743 karg.negotiated_speed = HP_DEV_SPEED_ULTRA160; in mptctl_hp_targetinfo()
2745 karg.negotiated_speed = HP_DEV_SPEED_ULTRA2; in mptctl_hp_targetinfo()
2747 karg.negotiated_speed = HP_DEV_SPEED_ULTRA; in mptctl_hp_targetinfo()
2749 karg.negotiated_speed = HP_DEV_SPEED_FAST; in mptctl_hp_targetinfo()
2751 karg.negotiated_speed = HP_DEV_SPEED_ASYNC; in mptctl_hp_targetinfo()
2753 karg.negotiated_speed = HP_DEV_SPEED_ASYNC; in mptctl_hp_targetinfo()
2761 karg.message_rejects = -1; in mptctl_hp_targetinfo()
2762 karg.phase_errors = -1; in mptctl_hp_targetinfo()
2763 karg.parity_errors = -1; in mptctl_hp_targetinfo()
2764 karg.select_timeouts = -1; in mptctl_hp_targetinfo()
2786 cfg.pageAddr = (karg.hdr.channel << 8) | karg.hdr.id; in mptctl_hp_targetinfo()
2788 karg.message_rejects = (u32) le16_to_cpu(pg3_alloc->MsgRejectCount); in mptctl_hp_targetinfo()
2789 karg.phase_errors = (u32) le16_to_cpu(pg3_alloc->PhaseErrorCount); in mptctl_hp_targetinfo()
2790 karg.parity_errors = (u32) le16_to_cpu(pg3_alloc->ParityErrorCount); in mptctl_hp_targetinfo()
2797 karg.select_timeouts = hd->sel_timeout[karg.hdr.id]; in mptctl_hp_targetinfo()
2801 if (copy_to_user((char __user *)arg, &karg, sizeof(hp_target_info_t))) { in mptctl_hp_targetinfo()
2879 struct mpt_ioctl_command karg; in compat_mpt_command() local
2903 karg.hdr.iocnum = karg32.hdr.iocnum; in compat_mpt_command()
2904 karg.hdr.port = karg32.hdr.port; in compat_mpt_command()
2905 karg.timeout = karg32.timeout; in compat_mpt_command()
2906 karg.maxReplyBytes = karg32.maxReplyBytes; in compat_mpt_command()
2908 karg.dataInSize = karg32.dataInSize; in compat_mpt_command()
2909 karg.dataOutSize = karg32.dataOutSize; in compat_mpt_command()
2910 karg.maxSenseBytes = karg32.maxSenseBytes; in compat_mpt_command()
2911 karg.dataSgeOffset = karg32.dataSgeOffset; in compat_mpt_command()
2913 karg.replyFrameBufPtr = (char __user *)(unsigned long)karg32.replyFrameBufPtr; in compat_mpt_command()
2914 karg.dataInBufPtr = (char __user *)(unsigned long)karg32.dataInBufPtr; in compat_mpt_command()
2915 karg.dataOutBufPtr = (char __user *)(unsigned long)karg32.dataOutBufPtr; in compat_mpt_command()
2916 karg.senseDataPtr = (char __user *)(unsigned long)karg32.senseDataPtr; in compat_mpt_command()
2920 ret = mptctl_do_mpt_command (karg, &uarg->MF); in compat_mpt_command()