diff options
author | Kashyap, Desai <kashyap.desai@lsi.com> | 2009-05-29 07:23:56 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-06-09 18:44:11 -0400 |
commit | a7938b0bb3b458fe0723608be3db6c4ed8d79a8c (patch) | |
tree | 6654a67ee51d52e1447ed970801b2fb9106f3867 /drivers/message/fusion/mptbase.c | |
parent | 71278192a887d7da3e768809c6fe9979d172ff23 (diff) |
[SCSI] mpt fusion: RAID device handling and Dual port Raid support is added
1. Handle integrated Raid device(Add/Delete) and error condition and check
related to Raid device. is_logical_volume will represent logical volume
device.
2. Raid device dual port support is added. Main functions to support this
feature are mpt_raid_phys_disk_get_num_paths and mpt_raid_phys_disk_pg1.
Signed-off-by: Kashyap Desai <kadesai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/message/fusion/mptbase.c')
-rw-r--r-- | drivers/message/fusion/mptbase.c | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 9f6b315624aa..44b931504457 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -5763,6 +5763,161 @@ mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, | |||
5763 | } | 5763 | } |
5764 | 5764 | ||
5765 | /** | 5765 | /** |
5766 | * mpt_raid_phys_disk_get_num_paths - returns number paths associated to this phys_num | ||
5767 | * @ioc: Pointer to a Adapter Structure | ||
5768 | * @phys_disk_num: io unit unique phys disk num generated by the ioc | ||
5769 | * | ||
5770 | * Return: | ||
5771 | * returns number paths | ||
5772 | **/ | ||
5773 | int | ||
5774 | mpt_raid_phys_disk_get_num_paths(MPT_ADAPTER *ioc, u8 phys_disk_num) | ||
5775 | { | ||
5776 | CONFIGPARMS cfg; | ||
5777 | ConfigPageHeader_t hdr; | ||
5778 | dma_addr_t dma_handle; | ||
5779 | pRaidPhysDiskPage1_t buffer = NULL; | ||
5780 | int rc; | ||
5781 | |||
5782 | memset(&cfg, 0 , sizeof(CONFIGPARMS)); | ||
5783 | memset(&hdr, 0 , sizeof(ConfigPageHeader_t)); | ||
5784 | |||
5785 | hdr.PageVersion = MPI_RAIDPHYSDISKPAGE1_PAGEVERSION; | ||
5786 | hdr.PageType = MPI_CONFIG_PAGETYPE_RAID_PHYSDISK; | ||
5787 | hdr.PageNumber = 1; | ||
5788 | cfg.cfghdr.hdr = &hdr; | ||
5789 | cfg.physAddr = -1; | ||
5790 | cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER; | ||
5791 | |||
5792 | if (mpt_config(ioc, &cfg) != 0) { | ||
5793 | rc = 0; | ||
5794 | goto out; | ||
5795 | } | ||
5796 | |||
5797 | if (!hdr.PageLength) { | ||
5798 | rc = 0; | ||
5799 | goto out; | ||
5800 | } | ||
5801 | |||
5802 | buffer = pci_alloc_consistent(ioc->pcidev, hdr.PageLength * 4, | ||
5803 | &dma_handle); | ||
5804 | |||
5805 | if (!buffer) { | ||
5806 | rc = 0; | ||
5807 | goto out; | ||
5808 | } | ||
5809 | |||
5810 | cfg.physAddr = dma_handle; | ||
5811 | cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; | ||
5812 | cfg.pageAddr = phys_disk_num; | ||
5813 | |||
5814 | if (mpt_config(ioc, &cfg) != 0) { | ||
5815 | rc = 0; | ||
5816 | goto out; | ||
5817 | } | ||
5818 | |||
5819 | rc = buffer->NumPhysDiskPaths; | ||
5820 | out: | ||
5821 | |||
5822 | if (buffer) | ||
5823 | pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, buffer, | ||
5824 | dma_handle); | ||
5825 | |||
5826 | return rc; | ||
5827 | } | ||
5828 | EXPORT_SYMBOL(mpt_raid_phys_disk_get_num_paths); | ||
5829 | |||
5830 | /** | ||
5831 | * mpt_raid_phys_disk_pg1 - returns phys disk page 1 | ||
5832 | * @ioc: Pointer to a Adapter Structure | ||
5833 | * @phys_disk_num: io unit unique phys disk num generated by the ioc | ||
5834 | * @phys_disk: requested payload data returned | ||
5835 | * | ||
5836 | * Return: | ||
5837 | * 0 on success | ||
5838 | * -EFAULT if read of config page header fails or data pointer not NULL | ||
5839 | * -ENOMEM if pci_alloc failed | ||
5840 | **/ | ||
5841 | int | ||
5842 | mpt_raid_phys_disk_pg1(MPT_ADAPTER *ioc, u8 phys_disk_num, | ||
5843 | RaidPhysDiskPage1_t *phys_disk) | ||
5844 | { | ||
5845 | CONFIGPARMS cfg; | ||
5846 | ConfigPageHeader_t hdr; | ||
5847 | dma_addr_t dma_handle; | ||
5848 | pRaidPhysDiskPage1_t buffer = NULL; | ||
5849 | int rc; | ||
5850 | int i; | ||
5851 | __le64 sas_address; | ||
5852 | |||
5853 | memset(&cfg, 0 , sizeof(CONFIGPARMS)); | ||
5854 | memset(&hdr, 0 , sizeof(ConfigPageHeader_t)); | ||
5855 | rc = 0; | ||
5856 | |||
5857 | hdr.PageVersion = MPI_RAIDPHYSDISKPAGE1_PAGEVERSION; | ||
5858 | hdr.PageType = MPI_CONFIG_PAGETYPE_RAID_PHYSDISK; | ||
5859 | hdr.PageNumber = 1; | ||
5860 | cfg.cfghdr.hdr = &hdr; | ||
5861 | cfg.physAddr = -1; | ||
5862 | cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER; | ||
5863 | |||
5864 | if (mpt_config(ioc, &cfg) != 0) { | ||
5865 | rc = -EFAULT; | ||
5866 | goto out; | ||
5867 | } | ||
5868 | |||
5869 | if (!hdr.PageLength) { | ||
5870 | rc = -EFAULT; | ||
5871 | goto out; | ||
5872 | } | ||
5873 | |||
5874 | buffer = pci_alloc_consistent(ioc->pcidev, hdr.PageLength * 4, | ||
5875 | &dma_handle); | ||
5876 | |||
5877 | if (!buffer) { | ||
5878 | rc = -ENOMEM; | ||
5879 | goto out; | ||
5880 | } | ||
5881 | |||
5882 | cfg.physAddr = dma_handle; | ||
5883 | cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; | ||
5884 | cfg.pageAddr = phys_disk_num; | ||
5885 | |||
5886 | if (mpt_config(ioc, &cfg) != 0) { | ||
5887 | rc = -EFAULT; | ||
5888 | goto out; | ||
5889 | } | ||
5890 | |||
5891 | phys_disk->NumPhysDiskPaths = buffer->NumPhysDiskPaths; | ||
5892 | phys_disk->PhysDiskNum = phys_disk_num; | ||
5893 | for (i = 0; i < phys_disk->NumPhysDiskPaths; i++) { | ||
5894 | phys_disk->Path[i].PhysDiskID = buffer->Path[i].PhysDiskID; | ||
5895 | phys_disk->Path[i].PhysDiskBus = buffer->Path[i].PhysDiskBus; | ||
5896 | phys_disk->Path[i].OwnerIdentifier = | ||
5897 | buffer->Path[i].OwnerIdentifier; | ||
5898 | phys_disk->Path[i].Flags = le16_to_cpu(buffer->Path[i].Flags); | ||
5899 | memcpy(&sas_address, &buffer->Path[i].WWID, sizeof(__le64)); | ||
5900 | sas_address = le64_to_cpu(sas_address); | ||
5901 | memcpy(&phys_disk->Path[i].WWID, &sas_address, sizeof(__le64)); | ||
5902 | memcpy(&sas_address, | ||
5903 | &buffer->Path[i].OwnerWWID, sizeof(__le64)); | ||
5904 | sas_address = le64_to_cpu(sas_address); | ||
5905 | memcpy(&phys_disk->Path[i].OwnerWWID, | ||
5906 | &sas_address, sizeof(__le64)); | ||
5907 | } | ||
5908 | |||
5909 | out: | ||
5910 | |||
5911 | if (buffer) | ||
5912 | pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, buffer, | ||
5913 | dma_handle); | ||
5914 | |||
5915 | return rc; | ||
5916 | } | ||
5917 | EXPORT_SYMBOL(mpt_raid_phys_disk_pg1); | ||
5918 | |||
5919 | |||
5920 | /** | ||
5766 | * mpt_findImVolumes - Identify IDs of hidden disks and RAID Volumes | 5921 | * mpt_findImVolumes - Identify IDs of hidden disks and RAID Volumes |
5767 | * @ioc: Pointer to a Adapter Strucutre | 5922 | * @ioc: Pointer to a Adapter Strucutre |
5768 | * | 5923 | * |
@@ -7170,6 +7325,18 @@ mpt_display_event_info(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply) | |||
7170 | "id=%d channel=%d phys_num=%d", | 7325 | "id=%d channel=%d phys_num=%d", |
7171 | id, channel, phys_num); | 7326 | id, channel, phys_num); |
7172 | break; | 7327 | break; |
7328 | case MPI_EVENT_IR2_RC_DUAL_PORT_ADDED: | ||
7329 | snprintf(evStr, EVENT_DESCR_STR_SZ, | ||
7330 | "IR2: Dual Port Added: " | ||
7331 | "id=%d channel=%d phys_num=%d", | ||
7332 | id, channel, phys_num); | ||
7333 | break; | ||
7334 | case MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED: | ||
7335 | snprintf(evStr, EVENT_DESCR_STR_SZ, | ||
7336 | "IR2: Dual Port Removed: " | ||
7337 | "id=%d channel=%d phys_num=%d", | ||
7338 | id, channel, phys_num); | ||
7339 | break; | ||
7173 | default: | 7340 | default: |
7174 | ds = "IR2"; | 7341 | ds = "IR2"; |
7175 | break; | 7342 | break; |