You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[SCSI] mptfusion - fc transport attributes
Signed-off-by: Michael Reed <mdr@sgi.com> Signed-off-by: Eric Moore <Eric.Moore@lsil.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
committed by
James Bottomley
parent
d158d26167
commit
05e8ec17f4
@@ -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 WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag);
|
||||
static int GetLanConfigPages(MPT_ADAPTER *ioc);
|
||||
static int GetFcPortPage0(MPT_ADAPTER *ioc, int portnum);
|
||||
static int GetIoUnitPage2(MPT_ADAPTER *ioc);
|
||||
int mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode);
|
||||
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)
|
||||
ioc->pcidev = pdev;
|
||||
ioc->diagPending = 0;
|
||||
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);
|
||||
|
||||
/* Initialize the event logging.
|
||||
@@ -1267,6 +1268,10 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
*/
|
||||
INIT_LIST_HEAD(&ioc->configQ);
|
||||
|
||||
/* Initialize the fc rport list head.
|
||||
*/
|
||||
INIT_LIST_HEAD(&ioc->fc_rports);
|
||||
|
||||
/* Find lookup slot. */
|
||||
INIT_LIST_HEAD(&ioc->list);
|
||||
ioc->id = mpt_ids++;
|
||||
@@ -1879,7 +1884,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
|
||||
* (FCPortPage0_t stuff)
|
||||
*/
|
||||
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) &&
|
||||
@@ -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
|
||||
* @portnum: IOC Port number
|
||||
*
|
||||
@@ -4208,8 +4213,8 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
|
||||
* -EAGAIN if no msg frames currently available
|
||||
* -EFAULT for non-successful reply or no reply (timeout)
|
||||
*/
|
||||
static int
|
||||
GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
|
||||
int
|
||||
mptbase_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
|
||||
{
|
||||
ConfigPageHeader_t hdr;
|
||||
CONFIGPARMS cfg;
|
||||
@@ -4219,6 +4224,8 @@ GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
|
||||
int data_sz;
|
||||
int copy_sz;
|
||||
int rc;
|
||||
int count = 400;
|
||||
|
||||
|
||||
/* Get FCPort Page 0 header */
|
||||
hdr.PageVersion = 0;
|
||||
@@ -4242,6 +4249,8 @@ GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
|
||||
rc = -ENOMEM;
|
||||
ppage0_alloc = (FCPortPage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma);
|
||||
if (ppage0_alloc) {
|
||||
|
||||
try_again:
|
||||
memset((u8 *)ppage0_alloc, 0, data_sz);
|
||||
cfg.physAddr = page0_dma;
|
||||
cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
|
||||
@@ -4273,6 +4282,19 @@ GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
|
||||
pp0dest->DiscoveredPortsCount = le32_to_cpu(pp0dest->DiscoveredPortsCount);
|
||||
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);
|
||||
@@ -6357,6 +6379,7 @@ EXPORT_SYMBOL(mpt_alloc_fw_memory);
|
||||
EXPORT_SYMBOL(mpt_free_fw_memory);
|
||||
EXPORT_SYMBOL(mptbase_sas_persist_operation);
|
||||
EXPORT_SYMBOL(mpt_alt_ioc_wait);
|
||||
EXPORT_SYMBOL(mptbase_GetFcPortPage0);
|
||||
|
||||
|
||||
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR
|
||||
#endif
|
||||
|
||||
#define MPT_LINUX_VERSION_COMMON "3.03.05"
|
||||
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.05"
|
||||
#define MPT_LINUX_VERSION_COMMON "3.03.06"
|
||||
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.06"
|
||||
#define WHAT_MAGIC_STRING "@" "(" "#" ")"
|
||||
|
||||
#define show_mptmod_ver(s,ver) \
|
||||
@@ -499,6 +499,22 @@ typedef struct _RaidCfgData {
|
||||
int isRaid; /* bit field, 1 if RAID */
|
||||
}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
|
||||
*/
|
||||
@@ -614,6 +630,13 @@ typedef struct _MPT_ADAPTER
|
||||
struct list_head sas_topology;
|
||||
struct mutex sas_topology_mutex;
|
||||
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;
|
||||
|
||||
/*
|
||||
@@ -1000,6 +1023,7 @@ extern void mpt_free_fw_memory(MPT_ADAPTER *ioc);
|
||||
extern int mpt_findImVolumes(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_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum);
|
||||
extern int mpt_alt_ioc_wait(MPT_ADAPTER *ioc);
|
||||
|
||||
/*
|
||||
|
||||
+536
-17
File diff suppressed because it is too large
Load Diff
@@ -893,6 +893,7 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)
|
||||
* when a lun is disable by mid-layer.
|
||||
* Do NOT access the referenced scsi_cmnd structure or
|
||||
* 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
|
||||
* @vdevice: per device private data
|
||||
*
|
||||
@@ -2557,13 +2558,25 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
|
||||
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) {
|
||||
ioc->spi_data.forceDv = MPT_SCSICFG_NEED_DV | MPT_SCSICFG_RELOAD_IOC_PG3;
|
||||
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));
|
||||
|
||||
}
|
||||
@@ -2587,6 +2600,8 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
|
||||
{
|
||||
MPT_SCSI_HOST *hd;
|
||||
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",
|
||||
ioc->name, event));
|
||||
@@ -2608,11 +2623,18 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
|
||||
/* FIXME! */
|
||||
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
|
||||
* anything for these, but...
|
||||
*/
|
||||
case MPI_EVENT_RESCAN: /* 06 */
|
||||
case MPI_EVENT_LINK_STATUS_CHANGE: /* 07 */
|
||||
case MPI_EVENT_LOOP_STATE_CHANGE: /* 08 */
|
||||
/*
|
||||
@@ -3950,8 +3972,6 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
|
||||
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
|
||||
*/
|
||||
static int
|
||||
|
||||
Reference in New Issue
Block a user