Commit 4f781f02 authored by James Bottomley's avatar James Bottomley

mptfusion: replace chip_type

From: 	Moore, Eric Dean <Eric.Moore@lsil.com>

This replaces chip_type with bus_type.
Signed-off-by: default avatarEric Moore <Eric.Moore@lsil.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 73e0dcff
......@@ -337,15 +337,13 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r)
ioc_stat = le16_to_cpu(mr->u.reply.IOCStatus);
if (ioc_stat & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) {
u32 log_info = le32_to_cpu(mr->u.reply.IOCLogInfo);
if ((int)ioc->chip_type <= (int)FC929)
if (ioc->bus_type == FC)
mpt_fc_log_info(ioc, log_info);
else
else if (ioc->bus_type == SCSI)
mpt_sp_log_info(ioc, log_info);
}
if (ioc_stat & MPI_IOCSTATUS_MASK) {
if ((int)ioc->chip_type <= (int)FC929)
;
else
if (ioc->bus_type == SCSI)
mpt_sp_ioc_info(ioc, (u32)ioc_stat, mf);
}
} else {
......@@ -392,7 +390,7 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r)
}
#ifdef MPT_DEBUG_IRQ
if ((int)ioc->chip_type > (int)FC929) {
if (ioc->bus_type == SCSI) {
/* Verify mf, mr are reasonable.
*/
if ((mf) && ((mf >= MPT_INDEX_2_MFPTR(ioc, ioc->req_depth))
......@@ -1220,22 +1218,21 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ioc->pio_chip = (SYSIF_REGS __iomem *)pmem;
}
ioc->chip_type = FCUNK;
if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC909) {
ioc->chip_type = FC909;
ioc->prod_name = "LSIFC909";
ioc->bus_type = FC;
}
if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC929) {
ioc->chip_type = FC929;
ioc->prod_name = "LSIFC929";
ioc->bus_type = FC;
}
else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC919) {
ioc->chip_type = FC919;
ioc->prod_name = "LSIFC919";
ioc->bus_type = FC;
}
else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC929X) {
ioc->chip_type = FC929X;
pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
ioc->bus_type = FC;
if (revision < XL_929) {
ioc->prod_name = "LSIFC929X";
/* 929X Chip Fix. Set Split transactions level
......@@ -1254,8 +1251,8 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
}
}
else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC919X) {
ioc->chip_type = FC919X;
ioc->prod_name = "LSIFC919X";
ioc->bus_type = FC;
/* 919X Chip Fix. Set Split transactions level
* for PCIX. Set MOST bits to zero.
*/
......@@ -1264,8 +1261,8 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
pci_write_config_byte(pdev, 0x6a, pcixcmd);
}
else if (pdev->device == MPI_MANUFACTPAGE_DEVID_53C1030) {
ioc->chip_type = C1030;
ioc->prod_name = "LSI53C1030";
ioc->bus_type = SCSI;
/* 1030 Chip Fix. Disable Split transactions
* for PCIX. Set MOST bits to zero if Rev < C0( = 8).
*/
......@@ -1277,8 +1274,8 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
}
}
else if (pdev->device == MPI_MANUFACTPAGE_DEVID_1030_53C1035) {
ioc->chip_type = C1035;
ioc->prod_name = "LSI53C1035";
ioc->bus_type = SCSI;
}
sprintf(ioc->name, "ioc%d", ioc->id);
......@@ -1326,9 +1323,7 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* NEW! 20010220 -sralston
* Check for "bound ports" (929, 929X, 1030, 1035) to reduce redundant resets.
*/
if ((ioc->chip_type == FC929) || (ioc->chip_type == C1030)
|| (ioc->chip_type == C1035) || (ioc->chip_type == FC929X))
mpt_detect_bound_ports(ioc, pdev);
mpt_detect_bound_ports(ioc, pdev);
if ((r = mpt_do_ioc_recovery(ioc,
MPT_HOSTEVENT_IOC_BRINGUP, CAN_SLEEP)) != 0) {
......@@ -1760,7 +1755,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
* and we try GetLanConfigPages again...
*/
if ((ret == 0) && (reason == MPT_HOSTEVENT_IOC_BRINGUP)) {
if ((int)ioc->chip_type <= (int)FC929) {
if (ioc->bus_type == FC) {
/*
* Pre-fetch FC port WWN and stuff...
* (FCPortPage0_t stuff)
......@@ -2103,20 +2098,8 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
}
/* Is it already READY? */
if (!statefault && (ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_READY) {
if ((int)ioc->chip_type <= (int)FC929)
return 0;
else {
return 0;
/* Workaround from broken 1030 FW.
* Force a diagnostic reset if fails.
*/
/* if ((r = SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, sleepFlag)) == 0)
return 0;
else
statefault = 4; */
}
}
if (!statefault && (ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_READY)
return 0;
/*
* Check to see if IOC is in FAULT state.
......@@ -2513,11 +2496,11 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
ddlprintk((MYIOC_s_INFO_FMT "upload_fw %d facts.Flags=%x\n",
ioc->name, ioc->upload_fw, ioc->facts.Flags));
if ((int)ioc->chip_type <= (int)FC929) {
if (ioc->bus_type == FC)
ioc_init.MaxDevices = MPT_MAX_FC_DEVICES;
} else {
else
ioc_init.MaxDevices = MPT_MAX_SCSI_DEVICES;
}
ioc_init.MaxBuses = MPT_MAX_BUS;
ioc_init.ReplyFrameSize = cpu_to_le16(ioc->reply_sz); /* in BYTES */
......@@ -2622,7 +2605,7 @@ SendPortEnable(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
/* RAID FW may take a long time to enable
*/
if ((int)ioc->chip_type <= (int)FC929) {
if (ioc->bus_type == FC) {
ii = mpt_handshake_req_reply_wait(ioc, req_sz, (u32*)&port_enable,
reply_sz, (u16*)&reply_buf, 65 /*seconds*/, sleepFlag);
} else {
......@@ -2992,7 +2975,7 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
int cnt,cntdn;
dinitprintk((KERN_WARNING MYNAM ": KickStarting %s!\n", ioc->name));
if ((int)ioc->chip_type > (int)FC929) {
if (ioc->bus_type == SCSI) {
/* Always issue a Msg Unit Reset first. This will clear some
* SCSI bus hang conditions.
*/
......@@ -3420,7 +3403,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
dinitprintk((KERN_INFO MYNAM ": %s Now numSGE=%d num_sge=%d num_chain=%d\n",
ioc->name, numSGE, num_sge, num_chain));
if ((int) ioc->chip_type > (int) FC929)
if (ioc->bus_type == SCSI)
num_chain *= MPT_SCSI_CAN_QUEUE;
else
num_chain *= MPT_FC_CAN_QUEUE;
......@@ -5277,7 +5260,7 @@ procmpt_iocinfo_read(char *buf, char **start, off_t offset, int request, int *eo
len += sprintf(buf+len, " PortNumber = %d (of %d)\n",
p+1,
ioc->facts.NumberOfPorts);
if ((int)ioc->chip_type <= (int)FC929) {
if (ioc->bus_type == FC) {
if (ioc->pfacts[p].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) {
u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
len += sprintf(buf+len, " LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n",
......
......@@ -296,23 +296,6 @@ typedef struct _MPT_SGL64_HDR {
SGESimple64_t sge[1];
} MPT_SGL64_HDR;
/*
* Chip-specific stuff... FC929 delineates break between
* FC and Parallel SCSI parts. Do NOT re-order.
*/
typedef enum {
FC919X = 0x0819,
FC929X = 0x0829,
FC909 = 0x0909,
FC919 = 0x0919,
FC929 = 0x0929,
C1030 = 0x1030,
C1035 = 0x1035,
FCUNK = 0xFBAD
} CHIP_TYPE;
/*
* System interface register set
*/
......@@ -517,6 +500,7 @@ typedef struct _MPT_ADAPTER
char *prod_name; /* "LSIFC9x9" */
SYSIF_REGS __iomem *chip; /* == c8817000 (mmap) */
SYSIF_REGS __iomem *pio_chip; /* Programmed IO (downloadboot) */
u8 bus_type;
u32 mem_phys; /* == f4020000 (mmap) */
u32 pio_mem_phys; /* Programmed IO (downloadboot) */
int mem_size; /* mmap memory size */
......@@ -543,7 +527,6 @@ typedef struct _MPT_ADAPTER
dma_addr_t ChainBufferDMA;
struct list_head FreeChainQ;
spinlock_t FreeChainQlock;
CHIP_TYPE chip_type;
/* We (host driver) get to manage our own RequestQueue! */
dma_addr_t req_frames_dma;
MPT_FRAME_HDR *req_frames; /* Request msg frames - rounded up! */
......@@ -888,6 +871,12 @@ typedef struct _MPT_LOCAL_REPLY {
#define TM_STATE_IN_PROGRESS (1)
#define TM_STATE_ERROR (2)
typedef enum {
FC,
SCSI,
SAS
} BUS_TYPE;
typedef struct _MPT_SCSI_HOST {
MPT_ADAPTER *ioc;
int port;
......@@ -903,7 +892,6 @@ typedef struct _MPT_SCSI_HOST {
*/
u8 tmPending;
u8 resetPending;
u8 is_spi; /* Parallel SCSI i/f */
u8 negoNvram; /* DV disabled, nego NVRAM */
u8 pad1;
u8 tmState;
......
......@@ -1218,7 +1218,7 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
/* Fill in the data and return the structure to the calling
* program
*/
if ((int)ioc->chip_type <= (int) FC929)
if (ioc->bus_type == FC)
karg->adapterType = MPT_IOCTL_INTERFACE_FC;
else
karg->adapterType = MPT_IOCTL_INTERFACE_SCSI;
......@@ -1518,7 +1518,7 @@ mptctl_readtest (unsigned long arg)
#ifdef MFCNT
karg.chip_type = ioc->mfcnt;
#else
karg.chip_type = ioc->chip_type;
karg.chip_type = ioc->pcidev->device;
#endif
strncpy (karg.name, ioc->name, MPT_MAX_NAME);
karg.name[MPT_MAX_NAME-1]='\0';
......@@ -2470,7 +2470,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
karg.base_io_addr = pci_resource_start(pdev, 0);
if ((int)ioc->chip_type <= (int) FC929)
if (ioc->bus_type == FC)
karg.bus_phys_width = HP_BUS_WIDTH_UNK;
else
karg.bus_phys_width = HP_BUS_WIDTH_16;
......@@ -2559,7 +2559,7 @@ mptctl_hp_targetinfo(unsigned long arg)
/* There is nothing to do for FCP parts.
*/
if ((int) ioc->chip_type <= (int) FC929)
if (ioc->bus_type == FC)
return 0;
if ((ioc->spi_data.sdp0length == 0) || (ioc->sh == NULL))
......
......@@ -712,7 +712,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
sc->result = DID_RESET << 16;
/* GEM Workaround. */
if (hd->is_spi)
if (ioc->bus_type == SCSI)
mptscsih_no_negotiate(hd, sc->device->id);
break;
......@@ -1107,7 +1107,7 @@ mptscsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
* max_lun = 1 + actual last lun,
* see hosts.h :o(
*/
if ((int)ioc->chip_type > (int)FC929) {
if (ioc->bus_type == SCSI) {
sh->max_id = MPT_MAX_SCSI_DEVICES;
} else {
/* For FC, increase the queue depth
......@@ -1166,9 +1166,6 @@ mptscsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
hd = (MPT_SCSI_HOST *) sh->hostdata;
hd->ioc = ioc;
if ((int)ioc->chip_type > (int)FC929)
hd->is_spi = 1;
/* SCSI needs scsi_cmnd lookup table!
* (with size equal to req_depth*PtrSz!)
*/
......@@ -1234,7 +1231,7 @@ mptscsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* Moved Earlier Pam D */
/* ioc->sh = sh; */
if (hd->is_spi) {
if (ioc->bus_type == SCSI) {
/* Update with the driver setup
* values.
*/
......@@ -1801,7 +1798,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
SCpnt->host_scribble = NULL;
#ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
if (hd->is_spi) {
if (hd->ioc->bus_type == SCSI) {
int dvStatus = hd->ioc->spi_data.dvStatus[target];
int issueCmd = 1;
......@@ -2255,9 +2252,9 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
printk(KERN_WARNING MYNAM ": %s: >> Attempting target reset! (sc=%p)\n",
hd->ioc->name, SCpnt);
/* Unsupported for SCSI. Supported for FCP
/* Supported for FC only.
*/
if (hd->is_spi)
if (hd->ioc->bus_type == SCSI)
return FAILED;
spin_unlock_irq(host_lock);
......@@ -2589,7 +2586,7 @@ mptscsih_slave_alloc(struct scsi_device *device)
vdev->bus_id = device->channel;
vdev->raidVolume = 0;
hd->Targets[device->id] = vdev;
if (hd->is_spi) {
if (hd->ioc->bus_type == SCSI) {
if (hd->ioc->spi_data.isRaid & (1 << device->id)) {
vdev->raidVolume = 1;
ddvtprintk((KERN_INFO
......@@ -2645,7 +2642,7 @@ mptscsih_slave_destroy(struct scsi_device *device)
kfree(hd->Targets[target]);
hd->Targets[target] = NULL;
if (hd->is_spi) {
if (hd->ioc->bus_type == SCSI) {
if (mptscsih_is_raid_volume(hd, target)) {
hd->ioc->spi_data.forceDv |= MPT_SCSICFG_RELOAD_IOC_PG3;
} else {
......@@ -2667,7 +2664,7 @@ mptscsih_set_queue_depth(struct scsi_device *device, MPT_SCSI_HOST *hd,
int max_depth;
int tagged;
if (hd->is_spi) {
if (hd->ioc->bus_type == SCSI) {
if (pTarget->tflags & MPT_TARGET_FLAGS_VALID_INQUIRY) {
if (!(pTarget->tflags & MPT_TARGET_FLAGS_Q_YES))
max_depth = 1;
......@@ -2946,7 +2943,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
/* 4. Renegotiate to all devices, if SCSI
*/
if (hd->is_spi) {
if (hd->ioc->bus_type == SCSI) {
dnegoprintk(("writeSDP1: ALL_IDS USE_NVRAM\n"));
mptscsih_writeSDP1(hd, 0, 0, MPT_SCSICFG_ALL_IDS | MPT_SCSICFG_USE_NVRAM);
}
......@@ -2975,7 +2972,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
/* 7. Set flag to force DV and re-read IOC Page 3
*/
if (hd->is_spi) {
if (ioc->bus_type == SCSI) {
ioc->spi_data.forceDv = MPT_SCSICFG_NEED_DV | MPT_SCSICFG_RELOAD_IOC_PG3;
ddvtprintk(("Set reload IOC Pg3 Flag\n"));
}
......@@ -3006,7 +3003,7 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
hd = NULL;
if (ioc->sh) {
hd = (MPT_SCSI_HOST *) ioc->sh->hostdata;
if (hd && (hd->is_spi) && (hd->soft_resets < -1))
if (hd && (ioc->bus_type == SCSI) && (hd->soft_resets < -1))
hd->soft_resets++;
}
break;
......@@ -3035,7 +3032,7 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
if (ioc->sh)
hd = (MPT_SCSI_HOST *) ioc->sh->hostdata;
if (hd && (hd->is_spi) && (hd->negoNvram == 0)) {
if (hd && (ioc->bus_type == SCSI) && (hd->negoNvram == 0)) {
ScsiCfgData *pSpi;
Ioc3PhysDisk_t *pPDisk;
int numPDisk;
......@@ -3182,7 +3179,7 @@ mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *
indexed_lun = (lun % 32);
vdev->luns[lun_index] |= (1 << indexed_lun);
if (hd->is_spi) {
if (hd->ioc->bus_type == SCSI) {
if ((data[0] == TYPE_PROCESSOR) && (hd->ioc->spi_data.Saf_Te)) {
/* Treat all Processors as SAF-TE if
* command line option is set */
......@@ -4463,7 +4460,7 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, int portnum)
/* Write SDP1 for all SCSI devices
* Alloc memory and set up config buffer
*/
if (hd->is_spi) {
if (ioc->bus_type == SCSI) {
if (ioc->spi_data.sdp1length > 0) {
pcfg1Data = (SCSIDevicePage1_t *)pci_alloc_consistent(ioc->pcidev,
ioc->spi_data.sdp1length * 4, &cfg1_dma_addr);
......@@ -4606,7 +4603,7 @@ mptscsih_domainValidation(void *arg)
msleep(250);
/* DV only to SCSI adapters */
if ((int)ioc->chip_type <= (int)FC929)
if (ioc->bus_type != SCSI)
continue;
/* Make sure everything looks ok */
......
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