Commit 05e8ec17 authored by Michael Reed's avatar Michael Reed Committed by James Bottomley

[SCSI] mptfusion - fc transport attributes

Signed-off-by: default avatarMichael Reed <mdr@sgi.com>
Signed-off-by: default avatarEric Moore <Eric.Moore@lsil.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent d158d261
...@@ -148,7 +148,6 @@ static int WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag); ...@@ -148,7 +148,6 @@ static int WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag);
static int WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag); static int WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag);
static int WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag); static int WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag);
static int GetLanConfigPages(MPT_ADAPTER *ioc); static int GetLanConfigPages(MPT_ADAPTER *ioc);
static int GetFcPortPage0(MPT_ADAPTER *ioc, int portnum);
static int GetIoUnitPage2(MPT_ADAPTER *ioc); static int GetIoUnitPage2(MPT_ADAPTER *ioc);
int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode); int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode);
static int mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum); static int mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum);
...@@ -1244,6 +1243,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1244,6 +1243,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
ioc->pcidev = pdev; ioc->pcidev = pdev;
ioc->diagPending = 0; ioc->diagPending = 0;
spin_lock_init(&ioc->diagLock); spin_lock_init(&ioc->diagLock);
spin_lock_init(&ioc->fc_rescan_work_lock);
spin_lock_init(&ioc->fc_rport_lock);
spin_lock_init(&ioc->initializing_hba_lock); spin_lock_init(&ioc->initializing_hba_lock);
/* Initialize the event logging. /* Initialize the event logging.
...@@ -1267,6 +1268,10 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1267,6 +1268,10 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
*/ */
INIT_LIST_HEAD(&ioc->configQ); INIT_LIST_HEAD(&ioc->configQ);
/* Initialize the fc rport list head.
*/
INIT_LIST_HEAD(&ioc->fc_rports);
/* Find lookup slot. */ /* Find lookup slot. */
INIT_LIST_HEAD(&ioc->list); INIT_LIST_HEAD(&ioc->list);
ioc->id = mpt_ids++; ioc->id = mpt_ids++;
...@@ -1879,7 +1884,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) ...@@ -1879,7 +1884,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
* (FCPortPage0_t stuff) * (FCPortPage0_t stuff)
*/ */
for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) { for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) {
(void) GetFcPortPage0(ioc, ii); (void) mptbase_GetFcPortPage0(ioc, ii);
} }
if ((ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) && if ((ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) &&
...@@ -4198,7 +4203,7 @@ GetLanConfigPages(MPT_ADAPTER *ioc) ...@@ -4198,7 +4203,7 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
* GetFcPortPage0 - Fetch FCPort config Page0. * mptbase_GetFcPortPage0 - Fetch FCPort config Page0.
* @ioc: Pointer to MPT_ADAPTER structure * @ioc: Pointer to MPT_ADAPTER structure
* @portnum: IOC Port number * @portnum: IOC Port number
* *
...@@ -4208,8 +4213,8 @@ GetLanConfigPages(MPT_ADAPTER *ioc) ...@@ -4208,8 +4213,8 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
* -EAGAIN if no msg frames currently available * -EAGAIN if no msg frames currently available
* -EFAULT for non-successful reply or no reply (timeout) * -EFAULT for non-successful reply or no reply (timeout)
*/ */
static int int
GetFcPortPage0(MPT_ADAPTER *ioc, int portnum) mptbase_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
{ {
ConfigPageHeader_t hdr; ConfigPageHeader_t hdr;
CONFIGPARMS cfg; CONFIGPARMS cfg;
...@@ -4219,6 +4224,8 @@ GetFcPortPage0(MPT_ADAPTER *ioc, int portnum) ...@@ -4219,6 +4224,8 @@ GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
int data_sz; int data_sz;
int copy_sz; int copy_sz;
int rc; int rc;
int count = 400;
/* Get FCPort Page 0 header */ /* Get FCPort Page 0 header */
hdr.PageVersion = 0; hdr.PageVersion = 0;
...@@ -4242,6 +4249,8 @@ GetFcPortPage0(MPT_ADAPTER *ioc, int portnum) ...@@ -4242,6 +4249,8 @@ GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
rc = -ENOMEM; rc = -ENOMEM;
ppage0_alloc = (FCPortPage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma); ppage0_alloc = (FCPortPage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma);
if (ppage0_alloc) { if (ppage0_alloc) {
try_again:
memset((u8 *)ppage0_alloc, 0, data_sz); memset((u8 *)ppage0_alloc, 0, data_sz);
cfg.physAddr = page0_dma; cfg.physAddr = page0_dma;
cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
...@@ -4273,6 +4282,19 @@ GetFcPortPage0(MPT_ADAPTER *ioc, int portnum) ...@@ -4273,6 +4282,19 @@ GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
pp0dest->DiscoveredPortsCount = le32_to_cpu(pp0dest->DiscoveredPortsCount); pp0dest->DiscoveredPortsCount = le32_to_cpu(pp0dest->DiscoveredPortsCount);
pp0dest->MaxInitiators = le32_to_cpu(pp0dest->MaxInitiators); pp0dest->MaxInitiators = le32_to_cpu(pp0dest->MaxInitiators);
/*
* if still doing discovery,
* hang loose a while until finished
*/
if (pp0dest->PortState == MPI_FCPORTPAGE0_PORTSTATE_UNKNOWN) {
if (count-- > 0) {
msleep_interruptible(100);
goto try_again;
}
printk(MYIOC_s_INFO_FMT "Firmware discovery not"
" complete.\n",
ioc->name);
}
} }
pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma); pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma);
...@@ -6357,6 +6379,7 @@ EXPORT_SYMBOL(mpt_alloc_fw_memory); ...@@ -6357,6 +6379,7 @@ EXPORT_SYMBOL(mpt_alloc_fw_memory);
EXPORT_SYMBOL(mpt_free_fw_memory); EXPORT_SYMBOL(mpt_free_fw_memory);
EXPORT_SYMBOL(mptbase_sas_persist_operation); EXPORT_SYMBOL(mptbase_sas_persist_operation);
EXPORT_SYMBOL(mpt_alt_ioc_wait); EXPORT_SYMBOL(mpt_alt_ioc_wait);
EXPORT_SYMBOL(mptbase_GetFcPortPage0);
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......
...@@ -76,8 +76,8 @@ ...@@ -76,8 +76,8 @@
#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR #define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR
#endif #endif
#define MPT_LINUX_VERSION_COMMON "3.03.05" #define MPT_LINUX_VERSION_COMMON "3.03.06"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.05" #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.06"
#define WHAT_MAGIC_STRING "@" "(" "#" ")" #define WHAT_MAGIC_STRING "@" "(" "#" ")"
#define show_mptmod_ver(s,ver) \ #define show_mptmod_ver(s,ver) \
...@@ -499,6 +499,22 @@ typedef struct _RaidCfgData { ...@@ -499,6 +499,22 @@ typedef struct _RaidCfgData {
int isRaid; /* bit field, 1 if RAID */ int isRaid; /* bit field, 1 if RAID */
}RaidCfgData; }RaidCfgData;
#define MPT_RPORT_INFO_FLAGS_REGISTERED 0x01 /* rport registered */
#define MPT_RPORT_INFO_FLAGS_MISSING 0x02 /* missing from DevPage0 scan */
#define MPT_RPORT_INFO_FLAGS_MAPPED_VDEV 0x04 /* target mapped in vdev */
/*
* data allocated for each fc rport device
*/
struct mptfc_rport_info
{
struct list_head list;
struct fc_rport *rport;
VirtDevice *vdev;
FCDevicePage0_t pg0;
u8 flags;
};
/* /*
* Adapter Structure - pci_dev specific. Maximum: MPT_MAX_ADAPTERS * Adapter Structure - pci_dev specific. Maximum: MPT_MAX_ADAPTERS
*/ */
...@@ -614,6 +630,13 @@ typedef struct _MPT_ADAPTER ...@@ -614,6 +630,13 @@ typedef struct _MPT_ADAPTER
struct list_head sas_topology; struct list_head sas_topology;
struct mutex sas_topology_mutex; struct mutex sas_topology_mutex;
MPT_SAS_MGMT sas_mgmt; MPT_SAS_MGMT sas_mgmt;
struct list_head fc_rports;
spinlock_t fc_rport_lock; /* list and ri flags */
spinlock_t fc_rescan_work_lock;
int fc_rescan_work_count;
struct work_struct fc_rescan_work;
} MPT_ADAPTER; } MPT_ADAPTER;
/* /*
...@@ -1000,6 +1023,7 @@ extern void mpt_free_fw_memory(MPT_ADAPTER *ioc); ...@@ -1000,6 +1023,7 @@ extern void mpt_free_fw_memory(MPT_ADAPTER *ioc);
extern int mpt_findImVolumes(MPT_ADAPTER *ioc); extern int mpt_findImVolumes(MPT_ADAPTER *ioc);
extern int mpt_read_ioc_pg_3(MPT_ADAPTER *ioc); extern int mpt_read_ioc_pg_3(MPT_ADAPTER *ioc);
extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode); extern int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode);
extern int mptbase_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum);
extern int mpt_alt_ioc_wait(MPT_ADAPTER *ioc); extern int mpt_alt_ioc_wait(MPT_ADAPTER *ioc);
/* /*
......
This diff is collapsed.
...@@ -893,6 +893,7 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd) ...@@ -893,6 +893,7 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)
* when a lun is disable by mid-layer. * when a lun is disable by mid-layer.
* Do NOT access the referenced scsi_cmnd structure or * Do NOT access the referenced scsi_cmnd structure or
* members. Will cause either a paging or NULL ptr error. * members. Will cause either a paging or NULL ptr error.
* (BUT, BUT, BUT, the code does reference it! - mdr)
* @hd: Pointer to a SCSI HOST structure * @hd: Pointer to a SCSI HOST structure
* @vdevice: per device private data * @vdevice: per device private data
* *
...@@ -2557,13 +2558,25 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) ...@@ -2557,13 +2558,25 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
hd->cmdPtr = NULL; hd->cmdPtr = NULL;
} }
/* 7. Set flag to force DV and re-read IOC Page 3 /* 7. SPI: Set flag to force DV and re-read IOC Page 3
*/ */
if (ioc->bus_type == SPI) { if (ioc->bus_type == SPI) {
ioc->spi_data.forceDv = MPT_SCSICFG_NEED_DV | MPT_SCSICFG_RELOAD_IOC_PG3; ioc->spi_data.forceDv = MPT_SCSICFG_NEED_DV | MPT_SCSICFG_RELOAD_IOC_PG3;
ddvtprintk(("Set reload IOC Pg3 Flag\n")); ddvtprintk(("Set reload IOC Pg3 Flag\n"));
} }
/* 7. FC: Rescan for blocked rports which might have returned.
*/
else if (ioc->bus_type == FC) {
int work_count;
unsigned long flags;
spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
work_count = ++ioc->fc_rescan_work_count;
spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
if (work_count == 1)
schedule_work(&ioc->fc_rescan_work);
}
dtmprintk((MYIOC_s_WARN_FMT "Post-Reset complete.\n", ioc->name)); dtmprintk((MYIOC_s_WARN_FMT "Post-Reset complete.\n", ioc->name));
} }
...@@ -2587,6 +2600,8 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) ...@@ -2587,6 +2600,8 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
{ {
MPT_SCSI_HOST *hd; MPT_SCSI_HOST *hd;
u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; u8 event = le32_to_cpu(pEvReply->Event) & 0xFF;
int work_count;
unsigned long flags;
devtprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n", devtprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n",
ioc->name, event)); ioc->name, event));
...@@ -2608,11 +2623,18 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) ...@@ -2608,11 +2623,18 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
/* FIXME! */ /* FIXME! */
break; break;
case MPI_EVENT_RESCAN: /* 06 */
spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
work_count = ++ioc->fc_rescan_work_count;
spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
if (work_count == 1)
schedule_work(&ioc->fc_rescan_work);
break;
/* /*
* CHECKME! Don't think we need to do * CHECKME! Don't think we need to do
* anything for these, but... * anything for these, but...
*/ */
case MPI_EVENT_RESCAN: /* 06 */
case MPI_EVENT_LINK_STATUS_CHANGE: /* 07 */ case MPI_EVENT_LINK_STATUS_CHANGE: /* 07 */
case MPI_EVENT_LOOP_STATE_CHANGE: /* 08 */ case MPI_EVENT_LOOP_STATE_CHANGE: /* 08 */
/* /*
...@@ -3950,8 +3972,6 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice) ...@@ -3950,8 +3972,6 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
mptscsih_do_cmd(hd, &iocmd); mptscsih_do_cmd(hd, &iocmd);
} }
/* Search IOC page 3 to determine if this is hidden physical disk
*/
/* Search IOC page 3 to determine if this is hidden physical disk /* Search IOC page 3 to determine if this is hidden physical disk
*/ */
static int static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment