Lines Matching refs:padapter

118 static int WaitReady (PADAPTER2000 padapter)  in WaitReady()  argument
124 if ( !inb_p (padapter->cmd) ) in WaitReady()
140 static int WaitReadyLong (PADAPTER2000 padapter) in WaitReadyLong() argument
146 if ( !inb_p (padapter->cmd) ) in WaitReadyLong()
179 static UCHAR Command (PADAPTER2000 padapter, UCHAR cmd) in Command() argument
181 outb_p (cmd, padapter->cmd); in Command()
182 if ( WaitReady (padapter) ) in Command()
185 if ( inw_p (padapter->mb0) ) in Command()
188 return inb_p (padapter->mb1); in Command()
202 static int BuildSgList (Scsi_Cmnd *SCpnt, PADAPTER2000 padapter, PDEV2000 pdev) in BuildSgList() argument
211 …zc = pci_map_sg (padapter->pdev, sg, SCpnt->use_sg, scsi_to_pci_dma_dir (SCpnt->sc_data_direction)… in BuildSgList()
217 outl (pdev->scatGathDma, padapter->mb2); in BuildSgList()
218 outl ((zc << 24) | SCpnt->request_bufflen, padapter->mb3); in BuildSgList()
223 outl (0, padapter->mb2); in BuildSgList()
224 outl (0, padapter->mb3); in BuildSgList()
227 …SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, SCpnt->request_buffer, SCpnt->request_bu… in BuildSgList()
228 outl (SCpnt->SCp.have_data_in, padapter->mb2); in BuildSgList()
229 outl (SCpnt->request_bufflen, padapter->mb3); in BuildSgList()
243 static int PsiRaidCmd (PADAPTER2000 padapter, char cmd) in PsiRaidCmd() argument
245 if ( WaitReady (padapter) ) // test for command register ready in PsiRaidCmd()
247 outb_p (cmd, padapter->cmd); // issue command in PsiRaidCmd()
248 if ( WaitReadyLong (padapter) ) // wait for adapter ready in PsiRaidCmd()
267 PADAPTER2000 padapter; // Pointer to adapter control structure in Irq_Handler() local
304 padapter = HOSTDATA(shost); in Irq_Handler()
311 pdev = &padapter->dev[bus][pun]; in Irq_Handler()
323 outb_p (0xFF, padapter->tag); // clear the op interrupt in Irq_Handler()
324 outb_p (CMD_DONE, padapter->cmd); // complete the op in Irq_Handler()
333 …pci_unmap_single (padapter->pdev, SCpnt->SCp.have_data_in, sizeof (SCpnt->sense_buffer), PCI_DMA_F… in Irq_Handler()
336 pci_unmap_single (padapter->pdev, SCpnt->SCp.have_data_in, 8, PCI_DMA_FROMDEVICE); in Irq_Handler()
345 …pci_unmap_single (padapter->pdev, SCpnt->SCp.have_data_in, SCpnt->request_bufflen, scsi_to_pci_dma… in Irq_Handler()
349 …pci_unmap_sg (padapter->pdev, (struct scatterlist *)SCpnt->request_buffer, SCpnt->use_sg, scsi_to_… in Irq_Handler()
355 if ( WaitReady (padapter) ) in Irq_Handler()
361 outb_p (tag0, padapter->mb0); // get real error code in Irq_Handler()
362 outb_p (CMD_ERROR, padapter->cmd); in Irq_Handler()
363 if ( WaitReady (padapter) ) // wait for controller to suck up the op in Irq_Handler()
369 error = inl (padapter->mb0); // get error data in Irq_Handler()
370 outb_p (0xFF, padapter->tag); // clear the op interrupt in Irq_Handler()
371 outb_p (CMD_DONE, padapter->cmd); // complete the op in Irq_Handler()
391 outb_p (0xFF, padapter->tag); // clear the op interrupt in Irq_Handler()
392 outb_p (CMD_DONE, padapter->cmd); // complete the op in Irq_Handler()
417 PADAPTER2000 padapter = HOSTDATA(SCpnt->host); // Pointer to adapter control structure in Pci2000_QueueCommand() local
423 PDEV2000 pdev = &padapter->dev[bus][pun]; in Pci2000_QueueCommand()
435 if ( WaitReady (padapter) ) in Pci2000_QueueCommand()
441 outw_p (pun | (lun << 8), padapter->mb0); in Pci2000_QueueCommand()
448 outl (SCpnt->timeout_per_command, padapter->mb1); in Pci2000_QueueCommand()
449 outb_p (CMD_SCSI_TIMEOUT, padapter->cmd); in Pci2000_QueueCommand()
450 if ( WaitReady (padapter) ) in Pci2000_QueueCommand()
456 outw_p (pun | (lun << 8), padapter->mb0); in Pci2000_QueueCommand()
457 outw_p (SCpnt->cmd_len << 8, padapter->mb0 + 2); in Pci2000_QueueCommand()
460 outl (pdev->cdbDma, padapter->mb1); in Pci2000_QueueCommand()
461 if ( BuildSgList (SCpnt, padapter, pdev) ) in Pci2000_QueueCommand()
465 if ( (pdev->tag = Command (padapter, cmd)) == 0 ) in Pci2000_QueueCommand()
486 OpDone (SCpnt, PsiRaidCmd (padapter, CMD_RAID_REBUILD) << 16); in Pci2000_QueueCommand()
489 OpDone (SCpnt, PsiRaidCmd (padapter, CMD_RAID_MUTE) << 16); in Pci2000_QueueCommand()
492 OpDone (SCpnt, PsiRaidCmd (padapter, CMD_RAID_FAIL) << 16); in Pci2000_QueueCommand()
502 …SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, SCpnt->request_buffer, SCpnt->request_bu… in Pci2000_QueueCommand()
504 outl (SCpnt->SCp.have_data_in, padapter->mb2); in Pci2000_QueueCommand()
506 outl (cdb[5], padapter->mb0); in Pci2000_QueueCommand()
507 outl (cdb[3], padapter->mb3); in Pci2000_QueueCommand()
516 …SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, ((struct scatterlist *)SCpnt->request_bu… in Pci2000_QueueCommand()
521 SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, SCpnt->request_buffer, in Pci2000_QueueCommand()
524 outl (SCpnt->SCp.have_data_in, padapter->mb2); in Pci2000_QueueCommand()
525 outl (SCpnt->request_bufflen, padapter->mb3); in Pci2000_QueueCommand()
530 …SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, SCpnt->sense_buffer, sizeof (SCpnt->sens… in Pci2000_QueueCommand()
531 outl (SCpnt->SCp.have_data_in, padapter->mb2); in Pci2000_QueueCommand()
532 outl (sizeof (SCpnt->sense_buffer), padapter->mb3); in Pci2000_QueueCommand()
539 …SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, ((struct scatterlist *)(SCpnt->request_b… in Pci2000_QueueCommand()
543 …SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, SCpnt->request_buffer, 8, PCI_DMA_FROMDE… in Pci2000_QueueCommand()
544 outl (SCpnt->SCp.have_data_in, padapter->mb2); in Pci2000_QueueCommand()
545 outl (8, padapter->mb3); in Pci2000_QueueCommand()
549 outw_p ((USHORT)cdb[8] | ((USHORT)cdb[7] << 8), padapter->mb0 + 2); in Pci2000_QueueCommand()
550 outl (XSCSI2LONG (&cdb[2]), padapter->mb1); in Pci2000_QueueCommand()
554 outw_p ((USHORT)cdb[8] | ((USHORT)cdb[7] << 8), padapter->mb0 + 2); in Pci2000_QueueCommand()
555 outl (XSCSI2LONG (&cdb[2]), padapter->mb1); in Pci2000_QueueCommand()
556 if ( BuildSgList (SCpnt, padapter, pdev) ) in Pci2000_QueueCommand()
562 outw_p (cdb[4], padapter->mb0 + 2); in Pci2000_QueueCommand()
563 outl ((SCSI2LONG (&cdb[1])) & 0x001FFFFF, padapter->mb1); in Pci2000_QueueCommand()
564 if ( BuildSgList (SCpnt, padapter, pdev) ) in Pci2000_QueueCommand()
570 outw_p ((USHORT)cdb[8] | ((USHORT)cdb[7] << 8), padapter->mb0 + 2); in Pci2000_QueueCommand()
571 outl (XSCSI2LONG (&cdb[2]), padapter->mb1); in Pci2000_QueueCommand()
572 if ( BuildSgList (SCpnt, padapter, pdev) ) in Pci2000_QueueCommand()
578 outw_p (cdb[4], padapter->mb0 + 2); in Pci2000_QueueCommand()
579 outl ((SCSI2LONG (&cdb[1])) & 0x001FFFFF, padapter->mb1); in Pci2000_QueueCommand()
580 if ( BuildSgList (SCpnt, padapter, pdev) ) in Pci2000_QueueCommand()
609 if ( (pdev->tag = Command (padapter, cmd)) == 0 ) in Pci2000_QueueCommand()
666 PADAPTER2000 padapter; in Pci2000_Detect() local
687 padapter = HOSTDATA(pshost); in Pci2000_Detect()
689 padapter->basePort = pci_resource_start (pdev, 1); in Pci2000_Detect()
690 DEB (printk ("\nBase Regs = %#04X", padapter->basePort)); // get the base I/O port address in Pci2000_Detect()
691 padapter->mb0 = padapter->basePort + RTR_MAILBOX; // get the 32 bit mail boxes in Pci2000_Detect()
692 padapter->mb1 = padapter->basePort + RTR_MAILBOX + 4; in Pci2000_Detect()
693 padapter->mb2 = padapter->basePort + RTR_MAILBOX + 8; in Pci2000_Detect()
694 padapter->mb3 = padapter->basePort + RTR_MAILBOX + 12; in Pci2000_Detect()
695 padapter->mb4 = padapter->basePort + RTR_MAILBOX + 16; in Pci2000_Detect()
696 padapter->cmd = padapter->basePort + RTR_LOCAL_DOORBELL; // command register in Pci2000_Detect()
697 padapter->tag = padapter->basePort + RTR_PCI_DOORBELL; // tag/response register in Pci2000_Detect()
698 padapter->pdev = pdev; in Pci2000_Detect()
700 if ( WaitReady (padapter) ) in Pci2000_Detect()
702 outb_p (0x84, padapter->mb0); in Pci2000_Detect()
703 outb_p (CMD_SPECIFY, padapter->cmd); in Pci2000_Detect()
704 if ( WaitReady (padapter) ) in Pci2000_Detect()
717 padapter->irqOwned = 0; in Pci2000_Detect()
725 if ( request_irq (pshost->irq, Irq_Handler, SA_SHIRQ, "pci2000", padapter) < 0 ) in Pci2000_Detect()
727 if ( request_irq (pshost->irq, Irq_Handler, SA_INTERRUPT | SA_SHIRQ, "pci2000", padapter) < 0 ) in Pci2000_Detect()
734 padapter->irqOwned = pshost->irq; // set IRQ as owned in Pci2000_Detect()
738 pshost->io_port = padapter->basePort; in Pci2000_Detect()
740 pshost->unique_id = padapter->basePort; in Pci2000_Detect()
747 padapter->dev[zz][z].tag = 0; in Pci2000_Detect()
748 padapter->dev[zz][z].scatGath = (PSCATGATH)consistent; in Pci2000_Detect()
749 padapter->dev[zz][z].scatGathDma = consistentDma; in Pci2000_Detect()
752 padapter->dev[zz][z].cdb = (UCHAR *)consistent; in Pci2000_Detect()
753 padapter->dev[zz][z].cdbDma = consistentDma; in Pci2000_Detect()
758 …printk("\nPSI-2000 Intelligent Storage SCSI CONTROLLER: at I/O = %lX IRQ = %d\n", padapter->baseP… in Pci2000_Detect()
817 PADAPTER2000 padapter = HOSTDATA (pshost); in Pci2000_Release() local
819 if ( padapter->irqOwned ) in Pci2000_Release()
820 free_irq (pshost->irq, padapter); in Pci2000_Release()
821 …pci_free_consistent (padapter->pdev, consistentLen, padapter->dev[0][0].scatGath, padapter->dev[0]… in Pci2000_Release()
843 PADAPTER2000 padapter; in Pci2000_BiosParam() local
845 padapter = HOSTDATA(disk->device->host); in Pci2000_BiosParam()
847 if ( WaitReady (padapter) ) in Pci2000_BiosParam()
849 outb_p (disk->device->id, padapter->mb0); in Pci2000_BiosParam()
850 outb_p (CMD_GET_PARMS, padapter->cmd); in Pci2000_BiosParam()
851 if ( WaitReady (padapter) ) in Pci2000_BiosParam()
854 geom[0] = inb_p (padapter->mb2 + 3); in Pci2000_BiosParam()
855 geom[1] = inb_p (padapter->mb2 + 2); in Pci2000_BiosParam()
856 geom[2] = inw_p (padapter->mb2); in Pci2000_BiosParam()