⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpt-fusion-downgrade-to-3_02_73-rhel4.patch

📁 lustre 1.6.5 source code
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
-			karg.Information.Phy[ii].Attached.bTargetPortProtocol |=-			    CSMI_SAS_PROTOCOL_SSP;-		if (protocol & MPI_SAS_DEVICE_INFO_STP_TARGET)-			karg.Information.Phy[ii].Attached.bTargetPortProtocol |=-			    CSMI_SAS_PROTOCOL_STP;-		if (protocol & MPI_SAS_DEVICE_INFO_SMP_TARGET)-			karg.Information.Phy[ii].Attached.bTargetPortProtocol |=-			    CSMI_SAS_PROTOCOL_SMP;-		if (protocol & MPI_SAS_DEVICE_INFO_SATA_DEVICE)-			karg.Information.Phy[ii].Attached.bTargetPortProtocol |=-			    CSMI_SAS_PROTOCOL_SATA;---		/* Fill in Attached device type */-		switch (le32_to_cpu(sasPhyPg0->AttachedDeviceInfo) &-		    MPI_SAS_DEVICE_INFO_MASK_DEVICE_TYPE) {--		case MPI_SAS_DEVICE_INFO_NO_DEVICE:-			karg.Information.Phy[ii].Attached.bDeviceType =-			    CSMI_SAS_NO_DEVICE_ATTACHED;-			break;--		case MPI_SAS_DEVICE_INFO_END_DEVICE:-			karg.Information.Phy[ii].Attached.bDeviceType =-			    CSMI_SAS_END_DEVICE;-			break;--		case MPI_SAS_DEVICE_INFO_EDGE_EXPANDER:-			karg.Information.Phy[ii].Attached.bDeviceType =-			    CSMI_SAS_EDGE_EXPANDER_DEVICE;-			break;--		case MPI_SAS_DEVICE_INFO_FANOUT_EXPANDER:-			karg.Information.Phy[ii].Attached.bDeviceType =-			    CSMI_SAS_FANOUT_EXPANDER_DEVICE;-			break;-		}--		/* Identify Info. */-		switch (le32_to_cpu(sasIoUnitPg0->PhyData[ii].ControllerPhyDeviceInfo) &-		    MPI_SAS_DEVICE_INFO_MASK_DEVICE_TYPE) {--		case MPI_SAS_DEVICE_INFO_NO_DEVICE:-			karg.Information.Phy[ii].Identify.bDeviceType =-			    CSMI_SAS_NO_DEVICE_ATTACHED;-			break;--		case MPI_SAS_DEVICE_INFO_END_DEVICE:-			karg.Information.Phy[ii].Identify.bDeviceType =-			    CSMI_SAS_END_DEVICE;-			break;--		case MPI_SAS_DEVICE_INFO_EDGE_EXPANDER:-			karg.Information.Phy[ii].Identify.bDeviceType =-			    CSMI_SAS_EDGE_EXPANDER_DEVICE;-			break;--		case MPI_SAS_DEVICE_INFO_FANOUT_EXPANDER:-			karg.Information.Phy[ii].Identify.bDeviceType =-			    CSMI_SAS_FANOUT_EXPANDER_DEVICE;-			break;-		}--		/* Fill in Phy Initiator Port Protocol. Bits 6:3-		 * More than one bit can be set, fall through cases.-		 */-		protocol = le32_to_cpu(-		    sasIoUnitPg0->PhyData[ii].ControllerPhyDeviceInfo) & 0x78;-		karg.Information.Phy[ii].Identify.bInitiatorPortProtocol = 0;-		if( protocol & MPI_SAS_DEVICE_INFO_SSP_INITIATOR )-		     karg.Information.Phy[ii].Identify.bInitiatorPortProtocol |=-			    CSMI_SAS_PROTOCOL_SSP;-		if( protocol & MPI_SAS_DEVICE_INFO_STP_INITIATOR )-		     karg.Information.Phy[ii].Identify.bInitiatorPortProtocol |=-			    CSMI_SAS_PROTOCOL_STP;-		if( protocol & MPI_SAS_DEVICE_INFO_SMP_INITIATOR )-		     karg.Information.Phy[ii].Identify.bInitiatorPortProtocol |=-			    CSMI_SAS_PROTOCOL_SMP;-		if( protocol & MPI_SAS_DEVICE_INFO_SATA_HOST )-		     karg.Information.Phy[ii].Identify.bInitiatorPortProtocol |=-			    CSMI_SAS_PROTOCOL_SATA;--		/* Fill in Phy Target Port Protocol. Bits 10:7-		 * More than one bit can be set, fall through cases.-		 */-		protocol = le32_to_cpu(-		    sasIoUnitPg0->PhyData[ii].ControllerPhyDeviceInfo) & 0x780;-		karg.Information.Phy[ii].Identify.bTargetPortProtocol = 0;-		if( protocol & MPI_SAS_DEVICE_INFO_SSP_TARGET )-			karg.Information.Phy[ii].Identify.bTargetPortProtocol |=-			    CSMI_SAS_PROTOCOL_SSP;-		if( protocol & MPI_SAS_DEVICE_INFO_STP_TARGET )-			karg.Information.Phy[ii].Identify.bTargetPortProtocol |=-			    CSMI_SAS_PROTOCOL_STP;-		if( protocol & MPI_SAS_DEVICE_INFO_SMP_TARGET )-			karg.Information.Phy[ii].Identify.bTargetPortProtocol |=-			    CSMI_SAS_PROTOCOL_SMP;-		if( protocol & MPI_SAS_DEVICE_INFO_SATA_DEVICE )-			karg.Information.Phy[ii].Identify.bTargetPortProtocol |=-			    CSMI_SAS_PROTOCOL_SATA;--		/* Setup SAS Address for the attached device */-		if (sasPhyPg0->AttachedDevHandle) {-			sas_address = reverse_byte_order64(sas_address);-			memcpy(karg.Information.Phy[ii].Attached.bSASAddress,-			    &sas_address, sizeof(u64));-			karg.Information.Phy[ii].Attached.bPhyIdentifier =-			    sasPhyPg0->AttachedPhyIdentifier;-		}--		/* Setup SAS Address for the parent device */-		csmisas_sas_device_pg0(ioc, &device_info,-		    (MPI_SAS_DEVICE_PGAD_FORM_HANDLE <<-		    MPI_SAS_DEVICE_PGAD_FORM_SHIFT),-		    sasIoUnitPg0->PhyData[ii].ControllerDevHandle);-		sas_address = reverse_byte_order64(device_info.sas_address);-		memcpy(karg.Information.Phy[ii].Identify.bSASAddress,-		    &sas_address, sizeof(u64));-		karg.Information.Phy[ii].Identify.bPhyIdentifier = ii;--		pci_free_consistent(ioc->pcidev, sasPhyPg0_data_sz,-		    (u8 *) sasPhyPg0, sasPhyPg0_dma);-	}--sas_get_phy_info_exit:--	if (sasIoUnitPg0)-		pci_free_consistent(ioc->pcidev, sasIoUnitPg0_data_sz,-		    (u8 *) sasIoUnitPg0, sasIoUnitPg0_dma);--	/* Copy the data from kernel memory to user memory-	 */-	if (copy_to_user((char *)arg, &karg,-	    sizeof(CSMI_SAS_PHY_INFO_BUFFER))) {-		printk(KERN_ERR "%s@%d::%s - "-		    "Unable to write out csmisas_get_phy_info_buffer @ %p\n",-		    __FILE__, __LINE__, __FUNCTION__, uarg);-		return -EFAULT;-	}--	dcsmisasprintk(("%s exit.\n",__FUNCTION__));-	return 0;-}--/**- * Prototype Routine for the CSMI SAS Set PHY Info command.- *- * Outputs:	None.- * Return:	0 if successful- *		-EFAULT if data unavailable- *		-ENODEV if no such device/adapter- **/-static int-csmisas_set_phy_info(unsigned long arg)-{-	CSMI_SAS_SET_PHY_INFO_BUFFER __user *uarg = (void __user *) arg;-	CSMI_SAS_SET_PHY_INFO_BUFFER	 karg;-	MPT_ADAPTER			*ioc = NULL;-	int				iocnum;--	dcsmisasprintk(("%s enter.\n",__FUNCTION__));--	if (copy_from_user(&karg, uarg, sizeof(CSMI_SAS_SET_PHY_INFO_BUFFER))) {-		printk(KERN_ERR "%s@%d::%s() - "-		    "Unable to read in csmi_sas_set_phy_info struct @ %p\n",-		    __FILE__, __LINE__, __FUNCTION__, uarg);-		return -EFAULT;-	}--	if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,-	    &ioc)) < 0) || (ioc == NULL)) {-		dcsmisasprintk((KERN_ERR-		"%s::%s() @%d - ioc%d not found!\n",-		    __FILE__, __FUNCTION__, __LINE__, iocnum));-		return -ENODEV;-	}--	if (!csmisas_is_this_sas_cntr(ioc)) {-		dcsmisasprintk((KERN_ERR-		    "%s::%s() @%d - ioc%d not SAS controller!\n",-		    __FILE__, __FUNCTION__, __LINE__, iocnum));-		return -ENODEV;-	}--/* TODO - implement IOCTL here */-	karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_BAD_CNTL_CODE;-	dcsmisasprintk((": not implemented\n"));--// cim_set_phy_info_exit:--	/* Copy the data from kernel memory to user memory-	 */-	if (copy_to_user((char *)arg, &karg,-				sizeof(CSMI_SAS_SET_PHY_INFO_BUFFER))) {-		printk(KERN_ERR "%s@%d::%s() - "-			"Unable to write out csmi_sas_set_phy_info @ %p\n",-				__FILE__, __LINE__, __FUNCTION__, uarg);-		return -EFAULT;-	}--	dcsmisasprintk(("%s exit.\n",__FUNCTION__));-	return 0;--}--/**- * Prototype Routine for the CSMI Sas Get SCSI Address command.- *- * Outputs:	None.- * Return:	0 if successful- *		-EFAULT if data unavailable- *		-ENODEV if no such device/adapter- **/-static int-csmisas_get_scsi_address(unsigned long arg)-{-	CSMI_SAS_GET_SCSI_ADDRESS_BUFFER __user *uarg = (void __user *) arg;-	CSMI_SAS_GET_SCSI_ADDRESS_BUFFER	 karg;-	MPT_ADAPTER		*ioc = NULL;-	int			iocnum;-	u64			sas_address;-	struct sas_device_info	*sas_info;--	dcsmisasprintk(("%s enter.\n",__FUNCTION__));--	if (copy_from_user(&karg, uarg,-	    sizeof(CSMI_SAS_GET_SCSI_ADDRESS_BUFFER))) {-		printk(KERN_ERR "%s@%d::%s() - "-		    "Unable to read in csmi_sas_get_scsi_address struct @ %p\n",-		    __FILE__, __LINE__, __FUNCTION__, uarg);-		return -EFAULT;-	}--	if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,-	    &ioc)) < 0) || (ioc == NULL)) {-		dcsmisasprintk((KERN_ERR-	      "%s::%s() @%d - ioc%d not found!\n",-		    __FILE__, __FUNCTION__, __LINE__, iocnum));-		return -ENODEV;-	}--	if (!csmisas_is_this_sas_cntr(ioc)) {-		dcsmisasprintk((KERN_ERR-		    "%s::%s() @%d - ioc%d not SAS controller!\n",-		    __FILE__, __FUNCTION__, __LINE__, iocnum));-		return -ENODEV;-	}--	/* reverse byte order the sas address */-	memcpy(&sas_address, karg.bSASAddress, sizeof(u64));-	sas_address = reverse_byte_order64(sas_address);--	/* Search the list for the matching SAS address. */-	karg.IoctlHeader.ReturnCode = CSMI_SAS_NO_SCSI_ADDRESS;-	karg.bPathId = 0;-	karg.bTargetId = 0;-	karg.bLun = 0;--	sas_info = csmisas_get_device_component_by_sas_addr(ioc, sas_address);-	if (!sas_info || sas_info->is_cached || sas_info->is_logical_volume)-		goto csmisas_get_scsi_address_exit;--	karg.bPathId = sas_info->os.channel;-	karg.bTargetId = sas_info->os.id;-	karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_SUCCESS;-- csmisas_get_scsi_address_exit:--	/* Copy the data from kernel memory to user memory-	 */-	if (copy_to_user((char *)arg, &karg,-	    sizeof(CSMI_SAS_GET_SCSI_ADDRESS_BUFFER))) {-		printk(KERN_ERR "%s@%d::%s() - "-		    "Unable to write out csmi_sas_get_scsi_address @ %p\n",-		    __FILE__, __LINE__, __FUNCTION__, uarg);-		return -EFAULT;-	}--	dcsmisasprintk(("%s exit.\n",__FUNCTION__));-	return 0;-}--/**- * Prototype Routine for the CSMI Sas Get SCSI Address command.- *- * Outputs:	None.- * Return:	0 if successful- *		-EFAULT if data unavailable- *		-ENODEV if no such device/adapter- **/-static int-csmisas_get_sata_signature(unsigned long arg)-{-	CSMI_SAS_SATA_SIGNATURE_BUFFER  __user *uarg = (void __user *) arg;-	CSMI_SAS_SATA_SIGNATURE_BUFFER	 karg;-	MPT_ADAPTER			*ioc = NULL;-	int				iocnum;-	int				rc, jj;-	ConfigExtendedPageHeader_t	hdr;-	CONFIGPARMS			cfg;-	SasPhyPage0_t			*sasPhyPg0;-	dma_addr_t			sasPhyPg0_dma;-	int				sasPhyPg0_data_sz;-	SasDevicePage1_t		*sasDevicePg1;-	dma_addr_t			sasDevicePg1_dma;-	int				sasDevicePg1_data_sz;-	u8				phyId;--	dcsmisasprintk(("%s enter.\n",__FUNCTION__));-	sasPhyPg0=NULL;-	sasPhyPg0_data_sz=0;-	sasDevicePg1=NULL;-	sasDevicePg1_data_sz=0;--	if (copy_from_user(&karg, uarg,-	     sizeof(CSMI_SAS_SATA_SIGNATURE_BUFFER))) {-		printk(KERN_ERR "%s@%d::%s() - "-		    "Unable to read in csmi_sas_sata_signature struct @ %p\n",-		    __FILE__, __LINE__, __FUNCTION__, uarg);-		return -EFAULT;-	}--	if (((iocnum = mpt_verify_adapter(karg.IoctlHeader.IOControllerNumber,-	    &ioc)) < 0) || (ioc == NULL)) {-		dcsmisasprintk((KERN_ERR-	    "%s::%s() @%d - ioc%d not found!\n",-		     __FILE__, __FUNCTION__, __LINE__, iocnum));-		return -ENODEV;-	}--	if (!csmisas_is_this_sas_cntr(ioc)) {-		dcsmisasprintk((KERN_ERR-		    "%s::%s() @%d - ioc%d not SAS controller!\n",-		    __FILE__, __FUNCTION__, __LINE__, iocnum));-		return -ENODEV;-	}--	phyId = karg.Signature.bPhyIdentifier;-	if (phyId >= ioc->num_ports) {-		karg.IoctlHeader.ReturnCode = CSMI_SAS_PHY_DOES_NOT_EXIST;-		dcsmisasprintk((": phyId >= ioc->num_ports\n"));-		goto cim_sata_signature_exit;-	}--	/* Default to success.*/-	karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_SUCCESS;--	/* Issue a config request to get the devHandle of the attached device-	 */--	/* Issue a config request to get phy information. */-	hdr.PageVersion = MPI_SASPHY0_PAGEVERSION;-	hdr.ExtPageLength = 0;-	hdr.PageNumber = 0;-	hdr.Reserved1 = 0;-	hdr.Reserved2 = 0;-	hdr.PageType = MPI_CONFIG_PAGETYPE_EXTENDED;-	hdr.ExtPageType = MPI_CONFIG_EXTPAGETYPE_SAS_PHY;--	cfg.cfghdr.ehdr = &hdr;-	cfg.physAddr = -1;-	cfg.pageAddr = phyId;-	cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;-	cfg.dir = 0;	/* read */-	cfg.timeout = MPT_IOCTL_DEFAULT_TIMEOUT;--	if ((rc = mpt_config(ioc, &cfg)) != 0) {-		/* Don't check if this failed.  Already in a-		 * failure case.-		 */-		dcsmisasprintk((": FAILED: MPI_SASPHY0_PAGEVERSION: HEADER\n"));-		dcsmisasprintk((": rc=%x\n",rc));-		karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;-		goto cim_sata_signature_exit;-	}--	if (hdr.ExtPageLength == 0) {-		/* Don't check if this failed.  Already in a-		 * failure case.-		 */-		dcsmisasprintk((": hdr.ExtPageLength == 0\n"));-		karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;-		goto cim_sata_signature_exit;-	}---	sasPhyPg0_data_sz = hdr.ExtPageLength * 4;-	rc = -ENOMEM;--	sasPhyPg0 = (SasPhyPage0_t *) pci_alloc_consistent(ioc->pcidev,-	    sasPhyPg0_data_sz, &sasPhyPg0_dma);--	if (! sasPhyPg0) {-		dcsmisasprintk((": pci_alloc_consistent: FAILED\n"));-		karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;-		goto cim_sata_signature_exit;-	}--	memset((u8 *)sasPhyPg0, 0, sasPhyPg0_data_sz);-	cfg.physAddr = sasPhyPg0_dma;-	cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;--	if ((rc = mpt_config(ioc, &cfg)) != 0) {-		/* Don't check if this failed.  Already in a-		 * failure case.-		 */-		dcsmisasprintk((": FAILED: MPI_SASPHY0_PAGEVERSION: PAGE\n"));-		dcsmisasprintk((": rc=%x\n",rc));-		karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;-		goto cim_sata_signature_exit;-	}--	/* Make sure a SATA device is attached. */-	if ((le32_to_cpu(sasPhyPg0->AttachedDeviceInfo) &-	    MPI_SAS_DEVICE_INFO_SATA_DEVICE) == 0) {-		dcsmisasprintk((": NOT A SATA DEVICE\n"));-		karg.IoctlHeader.ReturnCode = CSMI_SAS_NO_SATA_DEVICE;-		goto cim_sata_signature_exit;-	}--	/* Get device page 1 for FIS  signature. */-	hdr.PageVersion = MPI_SASDEVICE1_PAGEVERSION;-	hdr.ExtPageLength = 0;-	hdr.PageNumber = 1 /* page number 1 */;-	hdr.Reserved1 = 0;-	hdr.Reserved2 = 0;-	hdr.PageType = MPI_CONFIG_PAGETYPE_EXTENDED;-	hdr.ExtPageType = MPI_CONFIG_EXTPAGETYPE_SAS_DEVICE;--	cfg.cfghdr.ehdr = &hdr;-	cfg.physAddr = -1;--	cfg.pageAddr = ((MPI_SAS_DEVICE_PGAD_FORM_HANDLE <<-	    MPI_SAS_DEVICE_PGAD_FORM_SHIFT) |-	    le16_to_cpu(sasPhyPg0->AttachedDevHandle));-	cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;-	cfg.dir = 0;	/* read */-	cfg.timeout = MPT_IOCTL_DEFAULT_TIMEOUT;--	if ((rc = mpt_config(ioc, &cfg)) != 0) {-		dcsmisasprintk((": FAILED: MPI_SASDEVICE1_PAGEVERSION: HEADER\n"));-		dcsmisasprintk((": rc=%x\n",rc));-		karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;-		goto cim_sata_signature_exit;-	}--	if (hdr.ExtPageLength == 0) {-		dcsmisasprintk((": hdr.ExtPageLength == 0\n"));-		karg.IoctlHeader.ReturnCode = CSMI_SAS_STATUS_FAILED;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -