aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptctl.c
diff options
context:
space:
mode:
authorMoore, Eric <Eric.Moore@lsil.com>2006-02-02 19:19:47 -0500
committer <jejb@mulgrave.il.steeleye.com>2006-02-04 17:32:51 -0500
commit592f9c2fc9725b922ba8c4b1d67318ea4a301b59 (patch)
treec6412bd0074ee48693d4560bcbe28927c95de3bb /drivers/message/fusion/mptctl.c
parent5f07e2499d629045f7f8a60a5b442792f08732cb (diff)
[SCSI] fusion - mptctl - backplane istwi fix
Moving the toolbox call from mptbase.c, over to mptctl.c, and using the mptctl infastructure to issue the call. The existing code is hanging on certain HP platforms when this ioctl is issued, and this patch fix's that. Signed-off-by: Eric Moore <Eric.Moore@lsil.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message/fusion/mptctl.c')
-rw-r--r--drivers/message/fusion/mptctl.c74
1 files changed, 62 insertions, 12 deletions
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index be5fcd8db63b..2df3b8756545 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -2271,13 +2271,16 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2271 hp_host_info_t __user *uarg = (void __user *) arg; 2271 hp_host_info_t __user *uarg = (void __user *) arg;
2272 MPT_ADAPTER *ioc; 2272 MPT_ADAPTER *ioc;
2273 struct pci_dev *pdev; 2273 struct pci_dev *pdev;
2274 char *pbuf; 2274 char *pbuf=NULL;
2275 dma_addr_t buf_dma; 2275 dma_addr_t buf_dma;
2276 hp_host_info_t karg; 2276 hp_host_info_t karg;
2277 CONFIGPARMS cfg; 2277 CONFIGPARMS cfg;
2278 ConfigPageHeader_t hdr; 2278 ConfigPageHeader_t hdr;
2279 int iocnum; 2279 int iocnum;
2280 int rc, cim_rev; 2280 int rc, cim_rev;
2281 ToolboxIstwiReadWriteRequest_t *IstwiRWRequest;
2282 MPT_FRAME_HDR *mf = NULL;
2283 MPIHeader_t *mpi_hdr;
2281 2284
2282 dctlprintk((": mptctl_hp_hostinfo called.\n")); 2285 dctlprintk((": mptctl_hp_hostinfo called.\n"));
2283 /* Reset long to int. Should affect IA64 and SPARC only 2286 /* Reset long to int. Should affect IA64 and SPARC only
@@ -2413,20 +2416,67 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2413 } 2416 }
2414 } 2417 }
2415 2418
2416 cfg.pageAddr = 0; 2419 /*
2417 cfg.action = MPI_TOOLBOX_ISTWI_READ_WRITE_TOOL; 2420 * Gather ISTWI(Industry Standard Two Wire Interface) Data
2418 cfg.dir = MPI_TB_ISTWI_FLAGS_READ; 2421 */
2419 cfg.timeout = 10; 2422 if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL) {
2423 dfailprintk((MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
2424 ioc->name,__FUNCTION__));
2425 goto out;
2426 }
2427
2428 IstwiRWRequest = (ToolboxIstwiReadWriteRequest_t *)mf;
2429 mpi_hdr = (MPIHeader_t *) mf;
2430 memset(IstwiRWRequest,0,sizeof(ToolboxIstwiReadWriteRequest_t));
2431 IstwiRWRequest->Function = MPI_FUNCTION_TOOLBOX;
2432 IstwiRWRequest->Tool = MPI_TOOLBOX_ISTWI_READ_WRITE_TOOL;
2433 IstwiRWRequest->MsgContext = mpi_hdr->MsgContext;
2434 IstwiRWRequest->Flags = MPI_TB_ISTWI_FLAGS_READ;
2435 IstwiRWRequest->NumAddressBytes = 0x01;
2436 IstwiRWRequest->DataLength = cpu_to_le16(0x04);
2437 if (pdev->devfn & 1)
2438 IstwiRWRequest->DeviceAddr = 0xB2;
2439 else
2440 IstwiRWRequest->DeviceAddr = 0xB0;
2441
2420 pbuf = pci_alloc_consistent(ioc->pcidev, 4, &buf_dma); 2442 pbuf = pci_alloc_consistent(ioc->pcidev, 4, &buf_dma);
2421 if (pbuf) { 2443 if (!pbuf)
2422 cfg.physAddr = buf_dma; 2444 goto out;
2423 if ((mpt_toolbox(ioc, &cfg)) == 0) { 2445 mpt_add_sge((char *)&IstwiRWRequest->SGL,
2424 karg.rsvd = *(u32 *)pbuf; 2446 (MPT_SGE_FLAGS_SSIMPLE_READ|4), buf_dma);
2425 } 2447
2426 pci_free_consistent(ioc->pcidev, 4, pbuf, buf_dma); 2448 ioc->ioctl->wait_done = 0;
2427 pbuf = NULL; 2449 mpt_put_msg_frame(mptctl_id, ioc, mf);
2450
2451 rc = wait_event_timeout(mptctl_wait,
2452 ioc->ioctl->wait_done == 1,
2453 HZ*MPT_IOCTL_DEFAULT_TIMEOUT /* 10 sec */);
2454
2455 if(rc <=0 && (ioc->ioctl->wait_done != 1 )) {
2456 /*
2457 * Now we need to reset the board
2458 */
2459 mpt_free_msg_frame(ioc, mf);
2460 mptctl_timeout_expired(ioc->ioctl);
2461 goto out;
2428 } 2462 }
2429 2463
2464 /*
2465 *ISTWI Data Definition
2466 * pbuf[0] = FW_VERSION = 0x4
2467 * pbuf[1] = Bay Count = 6 or 4 or 2, depending on
2468 * the config, you should be seeing one out of these three values
2469 * pbuf[2] = Drive Installed Map = bit pattern depend on which
2470 * bays have drives in them
2471 * pbuf[3] = Checksum (0x100 = (byte0 + byte2 + byte3)
2472 */
2473 if (ioc->ioctl->status & MPT_IOCTL_STATUS_RF_VALID)
2474 karg.rsvd = *(u32 *)pbuf;
2475
2476 out:
2477 if (pbuf)
2478 pci_free_consistent(ioc->pcidev, 4, pbuf, buf_dma);
2479
2430 /* Copy the data from kernel memory to user memory 2480 /* Copy the data from kernel memory to user memory
2431 */ 2481 */
2432 if (copy_to_user((char __user *)arg, &karg, sizeof(hp_host_info_t))) { 2482 if (copy_to_user((char __user *)arg, &karg, sizeof(hp_host_info_t))) {