Lines Matching refs:padapter

195 static void Alarm (PADAPTER2220I padapter, UCHAR device)  in Alarm()  argument
199 if ( padapter->bigD ) in Alarm()
202 if ( padapter->failRegister & FAIL_ANY ) in Alarm()
205 padapter->failRegister = zc; in Alarm()
206 outb_p (~zc, padapter->regFail); in Alarm()
209 outb_p (0x3C | (1 << device), padapter->regFail); // sound alarm and set fail light in Alarm()
221 static void MuteAlarm (PADAPTER2220I padapter) in MuteAlarm() argument
225 if ( padapter->bigD ) in MuteAlarm()
227 padapter->failRegister &= ~FAIL_AUDIBLE; in MuteAlarm()
228 outb_p (~padapter->failRegister, padapter->regFail); in MuteAlarm()
232 old = (inb_p (padapter->regStatSel) >> 3) | (inb_p (padapter->regStatSel) & 0x83); in MuteAlarm()
233 outb_p (old | 0x40, padapter->regFail); in MuteAlarm()
246 static int WaitReady (PADAPTER2220I padapter) in WaitReady() argument
253 status = inb_p (padapter->regStatCmd); in WaitReady()
270 static int WaitReadyReset (PADAPTER2220I padapter) in WaitReadyReset() argument
277 status = inb_p (padapter->regStatCmd); in WaitReadyReset()
298 static int WaitDrq (PADAPTER2220I padapter) in WaitDrq() argument
305 status = inb_p (padapter->regStatCmd); in WaitDrq()
323 static int AtapiWaitReady (PADAPTER2220I padapter, int msec) in AtapiWaitReady() argument
329 if ( !(inb_p (padapter->regStatCmd) & (IDE_STATUS_BUSY | IDE_STATUS_DRQ)) ) in AtapiWaitReady()
346 static int AtapiWaitDrq (PADAPTER2220I padapter, int msec) in AtapiWaitDrq() argument
352 if ( inb_p (padapter->regStatCmd) & IDE_STATUS_DRQ ) in AtapiWaitDrq()
370 static int HardReset (PADAPTER2220I padapter, POUR_DEVICE pdev, UCHAR spigot) in HardReset() argument
374 SelectSpigot (padapter, spigot | SEL_IRQ_OFF); in HardReset()
376 outb_p (0x0E, padapter->regAltStat); // reset the suvivor in HardReset()
378 outb_p (0x08, padapter->regAltStat); // clear the reset in HardReset()
381 outb_p (0xA0, padapter->regLba24); // select the master drive in HardReset()
382 if ( WaitReadyReset (padapter) ) in HardReset()
387 outb_p (0xB0, padapter->regLba24); // try the slave drive in HardReset()
388 if ( (inb_p (padapter->regStatCmd) & (IDE_STATUS_DRDY | IDE_STATUS_BUSY)) == IDE_STATUS_DRDY ) in HardReset()
391 outb_p (SECTORSXFER, padapter->regSectCount); in HardReset()
392 WriteCommand (padapter, IDE_CMD_SET_MULTIPLE); in HardReset()
393 if ( WaitReady (padapter) ) in HardReset()
400 outb_p (0xA0, padapter->regLba24); // select the drive in HardReset()
401 outb_p (SECTORSXFER, padapter->regSectCount); in HardReset()
402 WriteCommand (padapter, IDE_CMD_SET_MULTIPLE); in HardReset()
403 if ( WaitReady (padapter) ) in HardReset()
421 static int AtapiReset (PADAPTER2220I padapter, POUR_DEVICE pdev) in AtapiReset() argument
423 SelectSpigot (padapter, pdev->spigot); in AtapiReset()
424 AtapiDevice (padapter, pdev->byte6); in AtapiReset()
425 AtapiCountLo (padapter, 0); in AtapiReset()
426 AtapiCountHi (padapter, 0); in AtapiReset()
427 WriteCommand (padapter, IDE_COMMAND_ATAPI_RESET); in AtapiReset()
429 if ( AtapiWaitReady (padapter, 1000) ) in AtapiReset()
431 …if ( inb_p (padapter->regStatCmd) || (inb_p (padapter->regLba8) != 0x14) || (inb_p (padapter->regL… in AtapiReset()
447 static void WalkScatGath (PADAPTER2220I padapter, UCHAR datain, ULONG length) in WalkScatGath() argument
450 UCHAR *buffer = padapter->kBuffer; in WalkScatGath()
454 count = ( length > padapter->currentSgCount ) ? padapter->currentSgCount : length; in WalkScatGath()
457 memcpy (padapter->currentSgBuffer, buffer, count); in WalkScatGath()
459 memcpy (buffer, padapter->currentSgBuffer, count); in WalkScatGath()
461 padapter->currentSgCount -= count; in WalkScatGath()
462 if ( !padapter->currentSgCount ) in WalkScatGath()
464 if ( padapter->nextSg < padapter->SCpnt->use_sg ) in WalkScatGath()
466padapter->currentSgBuffer = ((struct scatterlist *)padapter->SCpnt->request_buffer)[padapter->next… in WalkScatGath()
467padapter->currentSgCount = ((struct scatterlist *)padapter->SCpnt->request_buffer)[padapter->nextS… in WalkScatGath()
468 padapter->nextSg++; in WalkScatGath()
472 padapter->currentSgBuffer += count; in WalkScatGath()
490 static void BusMaster (PADAPTER2220I padapter, UCHAR datain, UCHAR irq) in BusMaster() argument
494 …zl = ( padapter->sectorCount > MAX_BUS_MASTER_BLOCKS ) ? MAX_BUS_MASTER_BLOCKS : padapter->sectorC… in BusMaster()
495 padapter->sectorCount -= zl; in BusMaster()
500 padapter->readCount = zl; in BusMaster()
501 outb_p (8, padapter->regDmaDesc); // read operation in BusMaster()
502 if ( padapter->bigD ) in BusMaster()
504 if ( irq && !padapter->sectorCount ) in BusMaster()
505 outb_p (0x0C, padapter->regDmaMode); // interrupt on in BusMaster()
507 outb_p (0x08, padapter->regDmaMode); // no interrupt in BusMaster()
511 if ( irq && !padapter->sectorCount ) in BusMaster()
512 outb_p (0x05, padapter->regDmaMode); // interrupt on in BusMaster()
514 outb_p (0x01, padapter->regDmaMode); // no interrupt in BusMaster()
519 outb_p (0x00, padapter->regDmaDesc); // write operation in BusMaster()
520 if ( padapter->bigD ) in BusMaster()
521 outb_p (0x08, padapter->regDmaMode); // no interrupt in BusMaster()
523 outb_p (0x01, padapter->regDmaMode); // no interrupt in BusMaster()
524 WalkScatGath (padapter, FALSE, zl); in BusMaster()
527 outl (padapter->timingAddress, padapter->regDmaAddrLoc); in BusMaster()
528 outl (padapter->kBufferDma, padapter->regDmaAddrPci); in BusMaster()
529 outl (zl, padapter->regDmaCount); in BusMaster()
530 outb_p (0x03, padapter->regDmaCmdStat); // kick the DMA engine in gear in BusMaster()
544 static void AtapiBusMaster (PADAPTER2220I padapter, UCHAR datain, ULONG length) in AtapiBusMaster() argument
546 outl (padapter->timingAddress, padapter->regDmaAddrLoc); in AtapiBusMaster()
547 outl (padapter->kBufferDma, padapter->regDmaAddrPci); in AtapiBusMaster()
548 outl (length, padapter->regDmaCount); in AtapiBusMaster()
551 if ( padapter->readCount ) in AtapiBusMaster()
552 WalkScatGath (padapter, TRUE, padapter->readCount); in AtapiBusMaster()
553 outb_p (0x08, padapter->regDmaDesc); // read operation in AtapiBusMaster()
554 outb_p (0x08, padapter->regDmaMode); // no interrupt in AtapiBusMaster()
555 padapter->readCount = length; in AtapiBusMaster()
559 outb_p (0x00, padapter->regDmaDesc); // write operation in AtapiBusMaster()
560 outb_p (0x08, padapter->regDmaMode); // no interrupt in AtapiBusMaster()
561 if ( !padapter->atapiSpecial ) in AtapiBusMaster()
562 WalkScatGath (padapter, FALSE, length); in AtapiBusMaster()
564 outb_p (0x03, padapter->regDmaCmdStat); // kick the DMA engine in gear in AtapiBusMaster()
576 static int WriteData (PADAPTER2220I padapter) in WriteData() argument
580 if ( !WaitDrq (padapter) ) in WriteData()
582 if ( padapter->timingPIO ) in WriteData()
584 …zl = (padapter->sectorCount > MAX_BUS_MASTER_BLOCKS) ? MAX_BUS_MASTER_BLOCKS : padapter->sectorCou… in WriteData()
585 WalkScatGath (padapter, FALSE, zl * BYTES_PER_SECTOR); in WriteData()
586 outsw (padapter->regData, padapter->kBuffer, zl * (BYTES_PER_SECTOR / 2)); in WriteData()
587 padapter->sectorCount -= zl; in WriteData()
590 BusMaster (padapter, 0, 0); in WriteData()
593 padapter->cmd = 0; // null out the command byte in WriteData()
607 static int WriteDataBoth (PADAPTER2220I padapter, POUR_DEVICE pdev) in WriteDataBoth() argument
612 SelectSpigot (padapter, pdev->spigots[0]); in WriteDataBoth()
613 status0 = WaitDrq (padapter); in WriteDataBoth()
616 SelectSpigot (padapter, pdev->spigots[1]); in WriteDataBoth()
617 status1 = WaitDrq (padapter); in WriteDataBoth()
620 SelectSpigot (padapter, pdev->spigots[0] | pdev->spigots[1] | padapter->bigD); in WriteDataBoth()
621 if ( padapter->timingPIO ) in WriteDataBoth()
623 …zl = (padapter->sectorCount > MAX_BUS_MASTER_BLOCKS) ? MAX_BUS_MASTER_BLOCKS : padapter->sectorCou… in WriteDataBoth()
624 WalkScatGath (padapter, FALSE, zl * BYTES_PER_SECTOR); in WriteDataBoth()
625 outsw (padapter->regData, padapter->kBuffer, zl * (BYTES_PER_SECTOR / 2)); in WriteDataBoth()
626 padapter->sectorCount -= zl; in WriteDataBoth()
629 BusMaster (padapter, 0, 0); in WriteDataBoth()
633 padapter->cmd = 0; // null out the command byte in WriteDataBoth()
649 static UCHAR IdeCmd (PADAPTER2220I padapter, POUR_DEVICE pdev) in IdeCmd() argument
653 SelectSpigot (padapter, pdev->spigot | padapter->bigD); // select the spigot in IdeCmd()
654 …outb_p (pdev->byte6 | ((UCHAR *)(&padapter->startSector))[3], padapter->regLba24); // select the… in IdeCmd()
655 status = WaitReady (padapter); in IdeCmd()
658 outb_p (padapter->sectorCount, padapter->regSectCount); in IdeCmd()
659 outb_p (((UCHAR *)(&padapter->startSector))[0], padapter->regLba0); in IdeCmd()
660 outb_p (((UCHAR *)(&padapter->startSector))[1], padapter->regLba8); in IdeCmd()
661 outb_p (((UCHAR *)(&padapter->startSector))[2], padapter->regLba16); in IdeCmd()
662 padapter->expectingIRQ = TRUE; in IdeCmd()
663 WriteCommand (padapter, padapter->cmd); in IdeCmd()
667 padapter->cmd = 0; // null out the command byte in IdeCmd()
681 static UCHAR IdeCmdBoth (PADAPTER2220I padapter, POUR_DEVICE pdev) in IdeCmdBoth() argument
686 SelectSpigot (padapter, pdev->spigots[0] | pdev->spigots[1]); // select the spigots in IdeCmdBoth()
687 …outb_p (padapter->pdev->byte6 | ((UCHAR *)(&padapter->startSector))[3], padapter->regLba24);// sel… in IdeCmdBoth()
688 SelectSpigot (padapter, pdev->spigots[0]); in IdeCmdBoth()
689 status0 = WaitReady (padapter); in IdeCmdBoth()
692 SelectSpigot (padapter, pdev->spigots[1]); in IdeCmdBoth()
693 status1 = WaitReady (padapter); in IdeCmdBoth()
696 SelectSpigot (padapter, pdev->spigots[0] | pdev->spigots[1] | padapter->bigD); in IdeCmdBoth()
697 outb_p (padapter->sectorCount, padapter->regSectCount); in IdeCmdBoth()
698 outb_p (((UCHAR *)(&padapter->startSector))[0], padapter->regLba0); in IdeCmdBoth()
699 outb_p (((UCHAR *)(&padapter->startSector))[1], padapter->regLba8); in IdeCmdBoth()
700 outb_p (((UCHAR *)(&padapter->startSector))[2], padapter->regLba16); in IdeCmdBoth()
701 padapter->expectingIRQ = TRUE; in IdeCmdBoth()
702 WriteCommand (padapter, padapter->cmd); in IdeCmdBoth()
706 padapter->cmd = 0; // null out the command byte in IdeCmdBoth()
723 static void OpDone (PADAPTER2220I padapter, ULONG result) in OpDone() argument
725 Scsi_Cmnd *SCpnt = padapter->SCpnt; in OpDone()
727 if ( padapter->reconPhase ) in OpDone()
729 padapter->reconPhase = 0; in OpDone()
730 if ( padapter->SCpnt ) in OpDone()
736 if ( padapter->reconOn ) in OpDone()
738 ReconTimerExpiry ((unsigned long)padapter); in OpDone()
744 padapter->cmd = 0; in OpDone()
745 padapter->SCpnt = NULL; in OpDone()
746 padapter->pdev = NULL; in OpDone()
749 if ( padapter->reconOn && !padapter->reconTimer.data ) in OpDone()
751 padapter->reconTimer.expires = jiffies + (HZ / 4); // start in 1/4 second in OpDone()
752 padapter->reconTimer.data = (unsigned long)padapter; in OpDone()
753 add_timer (&padapter->reconTimer); in OpDone()
769 static ULONG InlineIdentify (PADAPTER2220I padapter, UCHAR spigot, UCHAR device) in InlineIdentify() argument
771 PIDENTIFY_DATA pid = (PIDENTIFY_DATA)padapter->kBuffer; in InlineIdentify()
773 SelectSpigot (padapter, spigot | SEL_IRQ_OFF); // select the spigot in InlineIdentify()
774 outb_p ((device << 4) | 0xA0, padapter->regLba24); // select the drive in InlineIdentify()
775 if ( WaitReady (padapter) ) in InlineIdentify()
777 WriteCommand (padapter, IDE_COMMAND_IDENTIFY); in InlineIdentify()
778 if ( WaitDrq (padapter) ) in InlineIdentify()
780 insw (padapter->regData, padapter->kBuffer, sizeof (IDENTIFY_DATA) >> 1); in InlineIdentify()
794 static ULONG AtapiIdentify (PADAPTER2220I padapter, POUR_DEVICE pdev) in AtapiIdentify() argument
800 AtapiDevice (padapter, pdev->byte6); in AtapiIdentify()
801 WriteCommand (padapter, IDE_COMMAND_ATAPI_IDENTIFY); in AtapiIdentify()
802 if ( AtapiWaitDrq (padapter, 3000) ) in AtapiIdentify()
805 *(USHORT *)&ag0 = inw_p (padapter->regData); in AtapiIdentify()
807 zs = inw_p (padapter->regData); in AtapiIdentify()
840 void Atapi2Scsi (PADAPTER2220I padapter, Scsi_Cmnd *SCpnt) in Atapi2Scsi() argument
842 UCHAR *buff = padapter->currentSgBuffer; in Atapi2Scsi()
847 buff[0] = padapter->kBuffer[1]; in Atapi2Scsi()
848 buff[1] = padapter->kBuffer[2]; in Atapi2Scsi()
849 buff[2] = padapter->kBuffer[3]; in Atapi2Scsi()
850 buff[3] = padapter->kBuffer[7]; in Atapi2Scsi()
851 memcpy (&buff[4], &padapter->kBuffer[8], padapter->atapiCdb[8] - 8); in Atapi2Scsi()
854 padapter->kBuffer[2] = 2; in Atapi2Scsi()
855 memcpy (buff, padapter->kBuffer, padapter->currentSgCount); in Atapi2Scsi()
858 if ( padapter->readCount ) in Atapi2Scsi()
859 WalkScatGath (padapter, TRUE, padapter->readCount); in Atapi2Scsi()
874 static void Scsi2Atapi (PADAPTER2220I padapter, Scsi_Cmnd *SCpnt) in Scsi2Atapi() argument
877 UCHAR *buff = padapter->currentSgBuffer; in Scsi2Atapi()
882 padapter->atapiCdb[0] = SCSIOP_READ; in Scsi2Atapi()
883 padapter->atapiCdb[1] = cdb[1] & 0xE0; in Scsi2Atapi()
884 padapter->atapiCdb[3] = cdb[1] & 0x1F; in Scsi2Atapi()
885 padapter->atapiCdb[4] = cdb[2]; in Scsi2Atapi()
886 padapter->atapiCdb[5] = cdb[3]; in Scsi2Atapi()
887 padapter->atapiCdb[8] = cdb[4]; in Scsi2Atapi()
888 padapter->atapiCdb[9] = cdb[5]; in Scsi2Atapi()
891 padapter->atapiCdb[0] = SCSIOP_WRITE; in Scsi2Atapi()
892 padapter->atapiCdb[1] = cdb[1] & 0xE0; in Scsi2Atapi()
893 padapter->atapiCdb[3] = cdb[1] & 0x1F; in Scsi2Atapi()
894 padapter->atapiCdb[4] = cdb[2]; in Scsi2Atapi()
895 padapter->atapiCdb[5] = cdb[3]; in Scsi2Atapi()
896 padapter->atapiCdb[8] = cdb[4]; in Scsi2Atapi()
897 padapter->atapiCdb[9] = cdb[5]; in Scsi2Atapi()
900 padapter->atapiCdb[0] = SCSIOP_MODE_SENSE10; in Scsi2Atapi()
901 padapter->atapiCdb[2] = cdb[2]; in Scsi2Atapi()
902 padapter->atapiCdb[8] = cdb[4] + 4; in Scsi2Atapi()
906 padapter->atapiSpecial = TRUE; in Scsi2Atapi()
907 padapter->atapiCdb[0] = SCSIOP_MODE_SELECT10; in Scsi2Atapi()
908 padapter->atapiCdb[1] = cdb[1] | 0x10; in Scsi2Atapi()
909 memcpy (padapter->kBuffer, buff, 4); in Scsi2Atapi()
910 padapter->kBuffer[4] = padapter->kBuffer[5] = 0; in Scsi2Atapi()
911 padapter->kBuffer[6] = padapter->kBuffer[7] = 0; in Scsi2Atapi()
912 memcpy (&padapter->kBuffer[8], &buff[4], cdb[4] - 4); in Scsi2Atapi()
913 padapter->atapiCdb[8] = cdb[4] + 4; in Scsi2Atapi()
929 static void AtapiSendCdb (PADAPTER2220I padapter, POUR_DEVICE pdev, CHAR *cdb) in AtapiSendCdb() argument
932 outsw (padapter->regData, cdb, pdev->packet); in AtapiSendCdb()
947 static int AtapiRequestSense (PADAPTER2220I padapter, POUR_DEVICE pdev, Scsi_Cmnd *SCpnt, UCHAR pas… in AtapiRequestSense() argument
955 padapter->reqSense = TRUE; in AtapiRequestSense()
956 AtapiCountLo (padapter, cdb[4]); in AtapiRequestSense()
957 AtapiCountHi (padapter, 0); in AtapiRequestSense()
958 outb_p (0, padapter->regError); in AtapiRequestSense()
959 WriteCommand (padapter, IDE_COMMAND_ATAPI_PACKET); in AtapiRequestSense()
963 if ( AtapiWaitDrq (padapter, 500) ) in AtapiRequestSense()
966 AtapiSendCdb (padapter, pdev, cdb); in AtapiRequestSense()
981 static UCHAR InlineReadSignature (PADAPTER2220I padapter, POUR_DEVICE pdev, int index) in InlineReadSignature() argument
986 …SelectSpigot (padapter, pdev->spigots[index] | SEL_IRQ_OFF); // select the spigot without interrup… in InlineReadSignature()
987 outb_p (pdev->byte6 | ((UCHAR *)&zl)[3], padapter->regLba24); in InlineReadSignature()
988 status = WaitReady (padapter); in InlineReadSignature()
991 outb_p (((UCHAR *)&zl)[2], padapter->regLba16); in InlineReadSignature()
992 outb_p (((UCHAR *)&zl)[1], padapter->regLba8); in InlineReadSignature()
993 outb_p (((UCHAR *)&zl)[0], padapter->regLba0); in InlineReadSignature()
994 outb_p (1, padapter->regSectCount); in InlineReadSignature()
995 WriteCommand (padapter, IDE_COMMAND_READ); in InlineReadSignature()
996 status = WaitDrq (padapter); in InlineReadSignature()
999 insw (padapter->regData, padapter->kBuffer, BYTES_PER_SECTOR / 2); in InlineReadSignature()
1000 …((ULONG *)(&pdev->DiskMirror[index]))[0] = ((ULONG *)(&padapter->kBuffer[DISK_MIRROR_POSITION]))[0… in InlineReadSignature()
1001 …((ULONG *)(&pdev->DiskMirror[index]))[1] = ((ULONG *)(&padapter->kBuffer[DISK_MIRROR_POSITION]))[1… in InlineReadSignature()
1003 WaitReady (padapter); in InlineReadSignature()
1020 static ULONG DecodeError (PADAPTER2220I padapter, UCHAR status) in DecodeError() argument
1024 padapter->expectingIRQ = 0; in DecodeError()
1032 error = inb_p (padapter->regError); in DecodeError()
1057 static void StartTimer (PADAPTER2220I padapter) in StartTimer() argument
1059 padapter->timer.expires = jiffies + TIMEOUT_DATA; in StartTimer()
1060 add_timer (&padapter->timer); in StartTimer()
1075 static int WriteSignature (PADAPTER2220I padapter, POUR_DEVICE pdev, UCHAR spigot, int index) in WriteSignature() argument
1079 SelectSpigot (padapter, spigot); in WriteSignature()
1081 outb_p (pdev->byte6 | ((UCHAR *)&zl)[3], padapter->regLba24); in WriteSignature()
1082 outb_p (((UCHAR *)&zl)[2], padapter->regLba16); in WriteSignature()
1083 outb_p (((UCHAR *)&zl)[1], padapter->regLba8); in WriteSignature()
1084 outb_p (((UCHAR *)&zl)[0], padapter->regLba0); in WriteSignature()
1085 outb_p (1, padapter->regSectCount); in WriteSignature()
1087 WriteCommand (padapter, IDE_COMMAND_WRITE); in WriteSignature()
1088 if ( WaitDrq (padapter) ) in WriteSignature()
1090 StartTimer (padapter); in WriteSignature()
1091 padapter->expectingIRQ = TRUE; in WriteSignature()
1093 …((ULONG *)(&padapter->kBuffer[DISK_MIRROR_POSITION]))[0] = ((ULONG *)(&pdev->DiskMirror[index]))[0… in WriteSignature()
1094 …((ULONG *)(&padapter->kBuffer[DISK_MIRROR_POSITION]))[1] = ((ULONG *)(&pdev->DiskMirror[index]))[1… in WriteSignature()
1095 outsw (padapter->regData, padapter->kBuffer, BYTES_PER_SECTOR / 2); in WriteSignature()
1110 static int InitFailover (PADAPTER2220I padapter, POUR_DEVICE pdev) in InitFailover() argument
1114 …DEB (printk ("\npci2220i: Initialize failover process - survivor = %d", pdev->deviceID[padapter->… in InitFailover()
1117 spigot = pdev->spigots[padapter->survivor]; in InitFailover()
1119 if ( pdev->DiskMirror[padapter->survivor].status & UCBF_REBUILD ) in InitFailover()
1125 if ( HardReset (padapter, pdev, spigot) ) in InitFailover()
1131 Alarm (padapter, pdev->deviceID[padapter->survivor ^ 1]); in InitFailover()
1132 pdev->DiskMirror[padapter->survivor].status = UCBF_MIRRORED | UCBF_SURVIVOR; //clear present status in InitFailover()
1134 if ( WriteSignature (padapter, pdev, spigot, padapter->survivor) ) in InitFailover()
1139 padapter->failinprog = TRUE; in InitFailover()
1154 PADAPTER2220I padapter = (PADAPTER2220I)data; in TimerExpiry() local
1155 POUR_DEVICE pdev = padapter->pdev; in TimerExpiry()
1167 if ( padapter->failinprog ) in TimerExpiry()
1170 OpDone (padapter, DecodeError (padapter, inb_p (padapter->regStatCmd))); in TimerExpiry()
1174 while ( padapter->reconPhase ) in TimerExpiry()
1176 DEB (printk ("in recon phase %X", padapter->reconPhase)); in TimerExpiry()
1177 switch ( padapter->reconPhase ) in TimerExpiry()
1181 padapter->survivor = ( pdev->spigot == pdev->spigots[0] ) ? 1 : 0; in TimerExpiry()
1183 if ( InitFailover (padapter, pdev) ) in TimerExpiry()
1184 OpDone (padapter, DID_ERROR << 16); in TimerExpiry()
1188 OpDone (padapter, DID_ERROR << 16); in TimerExpiry()
1192 padapter->survivor = ( pdev->spigot == pdev->spigots[0] ) ? 0 : 1; in TimerExpiry()
1194 DEB (printk ("\n spig/stat = %X", inb_p (padapter->regStatSel)); in TimerExpiry()
1195 if ( InitFailover (padapter, pdev) ) in TimerExpiry()
1196 OpDone (padapter, DID_ERROR << 16); in TimerExpiry()
1200 padapter->survivor = ( pdev->spigot == pdev->spigots[0] ) ? 0 : 1; in TimerExpiry()
1202 if ( InitFailover (padapter, pdev) ) in TimerExpiry()
1203 OpDone (padapter, DID_ERROR << 16); in TimerExpiry()
1207 padapter->survivor = ( pdev->spigot == pdev->spigots[0] ) ? 0 : 1; in TimerExpiry()
1209 if ( InitFailover (padapter, pdev) ) in TimerExpiry()
1210 OpDone (padapter, DID_ERROR << 16); in TimerExpiry()
1218 while ( padapter->cmd ) in TimerExpiry()
1220 outb_p (0x08, padapter->regDmaCmdStat); // cancel interrupt from DMA engine in TimerExpiry()
1223 if ( padapter->cmd == WRITE_CMD ) in TimerExpiry()
1227 if ( inb_p (padapter->regStatSel) & temp ) in TimerExpiry()
1230 SelectSpigot (padapter, temp | SEL_IRQ_OFF); // Masking the interrupt during spigot select in TimerExpiry()
1231 temp = inb_p (padapter->regStatCmd); in TimerExpiry()
1237 if ( inb (padapter->regStatSel) & temp1 ) in TimerExpiry()
1240 SelectSpigot (padapter, temp1 | SEL_IRQ_OFF); // Masking the interrupt during spigot select in TimerExpiry()
1241 temp1 = inb_p (padapter->regStatCmd); in TimerExpiry()
1257 padapter->survivor = 1; in TimerExpiry()
1259 padapter->survivor = 0; in TimerExpiry()
1260 if ( InitFailover (padapter, pdev) ) in TimerExpiry()
1262 status = inb_p (padapter->regStatCmd); in TimerExpiry()
1272 padapter->survivor = ( pdev->spigot == pdev->spigots[0] ) ? 0 : 1; in TimerExpiry()
1274 if ( InitFailover (padapter, pdev) ) in TimerExpiry()
1276 status = inb_p (padapter->regStatCmd); in TimerExpiry()
1285 status = inb_p (padapter->regStatCmd); in TimerExpiry()
1290 OpDone (padapter, DecodeError (padapter, status)); in TimerExpiry()
1331 PADAPTER2220I padapter; in ReconTimerExpiry() local
1347 padapter = (PADAPTER2220I)data; in ReconTimerExpiry()
1348 if ( padapter->SCpnt ) in ReconTimerExpiry()
1351 padapter->reconTimer.data = 0; in ReconTimerExpiry()
1352 for ( z = padapter->devInReconIndex + 1; z < BIGD_MAXDRIVES; z++ ) in ReconTimerExpiry()
1354 if ( padapter->device[z].reconOn ) in ReconTimerExpiry()
1358 pdev = &padapter->device[z]; in ReconTimerExpiry()
1363 if ( padapter->device[z].reconOn ) in ReconTimerExpiry()
1367 pdev = &padapter->device[z]; in ReconTimerExpiry()
1370 padapter->reconOn = FALSE; in ReconTimerExpiry()
1375 padapter->devInReconIndex = z; in ReconTimerExpiry()
1376 pid = (PIDENTIFY_DATA)padapter->kBuffer; in ReconTimerExpiry()
1377 padapter->pdev = pdev; in ReconTimerExpiry()
1409 if ( padapter->bigD ) in ReconTimerExpiry()
1411 padapter->failRegister = 0; in ReconTimerExpiry()
1412 outb_p (~padapter->failRegister, padapter->regFail); in ReconTimerExpiry()
1416 …zc = ((inb_p (padapter->regStatSel) >> 3) | inb_p (padapter->regStatSel)) & 0x83; // mute the ala… in ReconTimerExpiry()
1417 outb_p (0xFF, padapter->regFail); in ReconTimerExpiry()
1423 if ( HardReset (padapter, pdev, pdev->spigots[pdev->mirrorRecon]) ) in ReconTimerExpiry()
1429 …pdev->lastsectorlba[pdev->mirrorRecon] = InlineIdentify (padapter, pdev->spigots[pdev->mirrorRecon… in ReconTimerExpiry()
1445 if ( (pid->MinPIOCycleWithoutFlow > 240) && !pid->SupportIORDYDisable && !padapter->timingPIO ) in ReconTimerExpiry()
1474 if ( padapter->timingMode > minmode ) // set minimum timing mode in ReconTimerExpiry()
1475 padapter->timingMode = minmode; in ReconTimerExpiry()
1476 if ( padapter->timingMode >= 2 ) in ReconTimerExpiry()
1477 padapter->timingAddress = ModeArray[padapter->timingMode - 2]; in ReconTimerExpiry()
1479 padapter->timingPIO = TRUE; in ReconTimerExpiry()
1481 padapter->reconOn = TRUE; in ReconTimerExpiry()
1487 padapter->survivor = pdev->mirrorRecon ^ 1; in ReconTimerExpiry()
1488 padapter->reconPhase = RECON_PHASE_FAILOVER; in ReconTimerExpiry()
1490 InitFailover (padapter, pdev); in ReconTimerExpiry()
1496 if ( WriteSignature (padapter, pdev, pdev->spigot, pdev->mirrorRecon ^ 1) ) in ReconTimerExpiry()
1498 padapter->reconPhase = RECON_PHASE_MARKING; in ReconTimerExpiry()
1508 if ( WriteSignature (padapter, pdev, pdev->spigots[pdev->mirrorRecon], pdev->mirrorRecon) ) in ReconTimerExpiry()
1510 padapter->survivor = pdev->mirrorRecon ^ 1; in ReconTimerExpiry()
1511 padapter->reconPhase = RECON_PHASE_FAILOVER; in ReconTimerExpiry()
1513 InitFailover (padapter, pdev); in ReconTimerExpiry()
1516 padapter->reconPhase = RECON_PHASE_UPDATE; in ReconTimerExpiry()
1521 padapter->reconSize = pdev->DiskMirror[pdev->mirrorRecon ^ 1].reconstructPoint - zl; in ReconTimerExpiry()
1522 if ( padapter->reconSize > MAX_BUS_MASTER_BLOCKS ) in ReconTimerExpiry()
1523 padapter->reconSize = MAX_BUS_MASTER_BLOCKS; in ReconTimerExpiry()
1525 if ( padapter->reconSize ) in ReconTimerExpiry()
1527 SelectSpigot (padapter, pdev->spigots[0] | pdev->spigots[1]); // select the spigots in ReconTimerExpiry()
1528 outb_p (pdev->byte6 | ((UCHAR *)(&zl))[3], padapter->regLba24); // select the drive in ReconTimerExpiry()
1529 SelectSpigot (padapter, pdev->spigot); in ReconTimerExpiry()
1530 if ( WaitReady (padapter) ) in ReconTimerExpiry()
1533 SelectSpigot (padapter, pdev->spigots[pdev->mirrorRecon]); in ReconTimerExpiry()
1534 if ( WaitReady (padapter) ) in ReconTimerExpiry()
1536 padapter->survivor = pdev->mirrorRecon ^ 1; in ReconTimerExpiry()
1537 padapter->reconPhase = RECON_PHASE_FAILOVER; in ReconTimerExpiry()
1539 InitFailover (padapter, pdev); in ReconTimerExpiry()
1543 SelectSpigot (padapter, pdev->spigots[0] | pdev->spigots[1]); in ReconTimerExpiry()
1544 outb_p (padapter->reconSize & 0xFF, padapter->regSectCount); in ReconTimerExpiry()
1545 outb_p (((UCHAR *)(&zl))[0], padapter->regLba0); in ReconTimerExpiry()
1546 outb_p (((UCHAR *)(&zl))[1], padapter->regLba8); in ReconTimerExpiry()
1547 outb_p (((UCHAR *)(&zl))[2], padapter->regLba16); in ReconTimerExpiry()
1548 padapter->expectingIRQ = TRUE; in ReconTimerExpiry()
1549 padapter->reconPhase = RECON_PHASE_READY; in ReconTimerExpiry()
1550 SelectSpigot (padapter, pdev->spigots[pdev->mirrorRecon]); in ReconTimerExpiry()
1551 WriteCommand (padapter, WRITE_CMD); in ReconTimerExpiry()
1552 StartTimer (padapter); in ReconTimerExpiry()
1553 SelectSpigot (padapter, pdev->spigot); in ReconTimerExpiry()
1554 WriteCommand (padapter, READ_CMD); in ReconTimerExpiry()
1560 if ( WriteSignature (padapter, pdev, pdev->spigot, pdev->mirrorRecon ^ 1) ) in ReconTimerExpiry()
1562 padapter->reconPhase = RECON_PHASE_LAST; in ReconTimerExpiry()
1587 PADAPTER2220I padapter; // Pointer to adapter control structure in Irq_Handler() local
1625 padapter = HOSTDATA(shost); in Irq_Handler()
1626 pdev = padapter->pdev; in Irq_Handler()
1627 SCpnt = padapter->SCpnt; in Irq_Handler()
1628 outb_p (0x08, padapter->regDmaCmdStat); // cancel interrupt from DMA engine in Irq_Handler()
1630 if ( padapter->atapi && SCpnt ) in Irq_Handler()
1632 *(char *)&statusa = inb_p (padapter->regStatCmd); // read the device status in Irq_Handler()
1633 *(char *)&reasona = inb_p (padapter->regSectCount); // read the device interrupt reason in Irq_Handler()
1641 z = (ULONG)inb_p (padapter->regLba8) | (ULONG)(inb_p (padapter->regLba16) << 8); in Irq_Handler()
1642 if ( padapter->reqSense ) in Irq_Handler()
1643 insw (padapter->regData, SCpnt->sense_buffer, z / 2); in Irq_Handler()
1645 AtapiBusMaster (padapter, reasona.io, z); in Irq_Handler()
1650 if ( padapter->reqSense ) in Irq_Handler()
1651 AtapiRequestSense (padapter, pdev, SCpnt, TRUE); in Irq_Handler()
1653 AtapiSendCdb (padapter, pdev, padapter->atapiCdb); in Irq_Handler()
1661 Atapi2Scsi (padapter, SCpnt); in Irq_Handler()
1664 *(UCHAR *)&errora = inb_p (padapter->regError); // read the device error in Irq_Handler()
1667 if ( padapter->reqSense || AtapiRequestSense (padapter, pdev, SCpnt, FALSE) ) in Irq_Handler()
1668 OpDone (padapter, DID_ERROR << 16); in Irq_Handler()
1673 OpDone (padapter, DID_ERROR << 16); in Irq_Handler()
1675 OpDone (padapter, DID_OK << 16); in Irq_Handler()
1679 if ( padapter->reqSense ) in Irq_Handler()
1682 OpDone (padapter, (DRIVER_SENSE << 24) | (DID_OK << 16) | 2); in Irq_Handler()
1685 OpDone (padapter, DID_OK << 16); in Irq_Handler()
1692 if ( !padapter->expectingIRQ || !(SCpnt || padapter->reconPhase) ) in Irq_Handler()
1698 padapter->expectingIRQ = 0; in Irq_Handler()
1700 if ( padapter->failinprog ) in Irq_Handler()
1703 padapter->failinprog = FALSE; in Irq_Handler()
1704 status = inb_p (padapter->regStatCmd); // read the device status in Irq_Handler()
1708 padapter->cmd = 0; in Irq_Handler()
1713 pdev->spigot = (padapter->survivor) ? pdev->spigots[1] : pdev->spigots[0]; in Irq_Handler()
1714 del_timer (&padapter->timer); in Irq_Handler()
1715 if ( padapter->reconPhase ) in Irq_Handler()
1716 OpDone (padapter, DID_OK << 16); in Irq_Handler()
1723 if ( padapter->reconPhase ) in Irq_Handler()
1725 switch ( padapter->reconPhase ) in Irq_Handler()
1729 status = inb_p (padapter->regStatCmd); // read the device status in Irq_Handler()
1730 del_timer (&padapter->timer); in Irq_Handler()
1731 if ( padapter->reconPhase == RECON_PHASE_LAST ) in Irq_Handler()
1735 padapter->survivor = ( pdev->spigot == pdev->spigots[0] ) ? 1 : 0; in Irq_Handler()
1737 if ( InitFailover (padapter, pdev) ) in Irq_Handler()
1738 OpDone (padapter, DecodeError (padapter, status)); in Irq_Handler()
1741 if ( WriteSignature (padapter, pdev, pdev->spigots[pdev->mirrorRecon], pdev->mirrorRecon) ) in Irq_Handler()
1743 padapter->survivor = ( pdev->spigot == pdev->spigots[0] ) ? 0 : 1; in Irq_Handler()
1745 if ( InitFailover (padapter, pdev) ) in Irq_Handler()
1746 OpDone (padapter, DecodeError (padapter, status)); in Irq_Handler()
1749 padapter->reconPhase = RECON_PHASE_END; in Irq_Handler()
1752 OpDone (padapter, DID_OK << 16); in Irq_Handler()
1756 status = inb_p (padapter->regStatCmd); // read the device status in Irq_Handler()
1759 del_timer (&padapter->timer); in Irq_Handler()
1760 OpDone (padapter, DecodeError (padapter, status)); in Irq_Handler()
1763 SelectSpigot (padapter, pdev->spigots[pdev->mirrorRecon]); in Irq_Handler()
1764 if ( WaitDrq (padapter) ) in Irq_Handler()
1766 del_timer (&padapter->timer); in Irq_Handler()
1767 padapter->survivor = ( pdev->spigot == pdev->spigots[0] ) ? 0 : 1; in Irq_Handler()
1769 if ( InitFailover (padapter, pdev) ) in Irq_Handler()
1770 OpDone (padapter, DecodeError (padapter, status)); in Irq_Handler()
1773 SelectSpigot (padapter, pdev->spigot | SEL_COPY | padapter->bigD); in Irq_Handler()
1774 padapter->reconPhase = RECON_PHASE_COPY; in Irq_Handler()
1775 padapter->expectingIRQ = TRUE; in Irq_Handler()
1776 if ( padapter->timingPIO ) in Irq_Handler()
1778 insw (padapter->regData, padapter->kBuffer, padapter->reconSize * (BYTES_PER_SECTOR / 2)); in Irq_Handler()
1782 if ( (padapter->timingMode > 3) ) in Irq_Handler()
1784 if ( padapter->bigD ) in Irq_Handler()
1785 outl (BIGD_DATA_MODE3, padapter->regDmaAddrLoc); in Irq_Handler()
1787 outl (DALE_DATA_MODE3, padapter->regDmaAddrLoc); in Irq_Handler()
1790 outl (padapter->timingAddress, padapter->regDmaAddrLoc); in Irq_Handler()
1791 outl (padapter->kBufferDma, padapter->regDmaAddrPci); in Irq_Handler()
1792 outl (padapter->reconSize * BYTES_PER_SECTOR, padapter->regDmaCount); in Irq_Handler()
1793 outb_p (8, padapter->regDmaDesc); // read operation in Irq_Handler()
1794 if ( padapter->bigD ) in Irq_Handler()
1795 outb_p (8, padapter->regDmaMode); // no interrupt in Irq_Handler()
1797 outb_p (1, padapter->regDmaMode); // no interrupt in Irq_Handler()
1798 outb_p (0x03, padapter->regDmaCmdStat); // kick the DMA engine in gear in Irq_Handler()
1803 pdev->DiskMirror[pdev->mirrorRecon].reconstructPoint += padapter->reconSize; in Irq_Handler()
1806 SelectSpigot (padapter, pdev->spigots[pdev->mirrorRecon] | SEL_IRQ_OFF); in Irq_Handler()
1807 status = inb_p (padapter->regStatCmd); // read the device status in Irq_Handler()
1808 del_timer (&padapter->timer); in Irq_Handler()
1811 padapter->survivor = ( pdev->spigot == pdev->spigots[0] ) ? 0 : 1; in Irq_Handler()
1813 DEB (printk ("\n status register = %X error = %X", status, inb_p (padapter->regError))); in Irq_Handler()
1814 if ( InitFailover (padapter, pdev) ) in Irq_Handler()
1815 OpDone (padapter, DecodeError (padapter, status)); in Irq_Handler()
1818 OpDone (padapter, DID_OK << 16); in Irq_Handler()
1822 status = inb_p (padapter->regStatCmd); // read the device status in Irq_Handler()
1823 del_timer (&padapter->timer); in Irq_Handler()
1826 padapter->survivor = ( pdev->spigot == pdev->spigots[0] ) ? 0 : 1; in Irq_Handler()
1828 if ( InitFailover (padapter, pdev) ) in Irq_Handler()
1829 OpDone (padapter, DecodeError (padapter, status)); in Irq_Handler()
1833 if ( padapter->bigD ) in Irq_Handler()
1835 for ( z = 0; z < padapter->numberOfDrives; z++ ) in Irq_Handler()
1837 if ( padapter->device[z].DiskMirror[0].status & UCBF_SURVIVOR ) in Irq_Handler()
1839 Alarm (padapter, padapter->device[z].deviceID[0] ^ 2); in Irq_Handler()
1840 MuteAlarm (padapter); in Irq_Handler()
1842 if ( padapter->device[z].DiskMirror[1].status & UCBF_SURVIVOR ) in Irq_Handler()
1844 Alarm (padapter, padapter->device[z].deviceID[1] ^ 2); in Irq_Handler()
1845 MuteAlarm (padapter); in Irq_Handler()
1849 OpDone (padapter, DID_OK << 16); in Irq_Handler()
1857 switch ( padapter->cmd ) // decide how to handle the interrupt in Irq_Handler()
1860 if ( padapter->sectorCount ) in Irq_Handler()
1862 status = inb_p (padapter->regStatCmd); // read the device status in Irq_Handler()
1867 padapter->survivor = ( pdev->spigot == pdev->spigots[0] ) ? 1 : 0; in Irq_Handler()
1868 del_timer (&padapter->timer); in Irq_Handler()
1870 if ( !InitFailover (padapter, pdev) ) in Irq_Handler()
1875 if ( padapter->timingPIO ) in Irq_Handler()
1877 insw (padapter->regData, padapter->kBuffer, padapter->readCount / 2); in Irq_Handler()
1878 padapter->sectorCount -= padapter->readCount / BYTES_PER_SECTOR; in Irq_Handler()
1879 WalkScatGath (padapter, TRUE, padapter->readCount); in Irq_Handler()
1880 if ( !padapter->sectorCount ) in Irq_Handler()
1888 if ( padapter->readCount ) in Irq_Handler()
1889 WalkScatGath (padapter, TRUE, padapter->readCount); in Irq_Handler()
1890 BusMaster (padapter, 1, 1); in Irq_Handler()
1892 padapter->expectingIRQ = TRUE; in Irq_Handler()
1895 if ( padapter->readCount && !padapter->timingPIO ) in Irq_Handler()
1896 WalkScatGath (padapter, TRUE, padapter->readCount); in Irq_Handler()
1903 SelectSpigot (padapter, pdev->spigots[0] | SEL_IRQ_OFF); in Irq_Handler()
1904 status = inb_p (padapter->regStatCmd); // read the device status in Irq_Handler()
1905 SelectSpigot (padapter, pdev->spigots[1] | SEL_IRQ_OFF); in Irq_Handler()
1906 status1 = inb_p (padapter->regStatCmd); // read the device status in Irq_Handler()
1909 SelectSpigot (padapter, pdev->spigot | SEL_IRQ_OFF); in Irq_Handler()
1910 status = inb_p (padapter->regStatCmd); // read the device status in Irq_Handler()
1917 padapter->survivor = 1; in Irq_Handler()
1918 del_timer (&padapter->timer); in Irq_Handler()
1919 SelectSpigot (padapter, pdev->spigot | SEL_IRQ_OFF); in Irq_Handler()
1920 …DEB (printk ("\npci2220i: FAILURE 16 status = %X error = %X", status, inb_p (padapter->regError)… in Irq_Handler()
1921 if ( !InitFailover (padapter, pdev) ) in Irq_Handler()
1930 padapter->survivor = 0; in Irq_Handler()
1931 del_timer (&padapter->timer); in Irq_Handler()
1932 …DEB (printk ("\npci2220i: FAILURE 17 status = %X error = %X", status1, inb_p (padapter->regError… in Irq_Handler()
1933 if ( !InitFailover (padapter, pdev) ) in Irq_Handler()
1938 if ( padapter->sectorCount ) in Irq_Handler()
1940 status = WriteDataBoth (padapter, pdev); in Irq_Handler()
1943 padapter->survivor = status >> 1; in Irq_Handler()
1944 del_timer (&padapter->timer); in Irq_Handler()
1946 if ( !InitFailover (padapter, pdev) ) in Irq_Handler()
1948 SelectSpigot (padapter, pdev->spigots[status] | SEL_IRQ_OFF); in Irq_Handler()
1949 status = inb_p (padapter->regStatCmd); // read the device status in Irq_Handler()
1952 padapter->expectingIRQ = TRUE; in Irq_Handler()
1958 if ( padapter->sectorCount ) in Irq_Handler()
1960 SelectSpigot (padapter, pdev->spigot | padapter->bigD); in Irq_Handler()
1961 status = WriteData (padapter); in Irq_Handler()
1964 padapter->expectingIRQ = TRUE; in Irq_Handler()
1973 PIDENTIFY_DATA pid = (PIDENTIFY_DATA)padapter->kBuffer; in Irq_Handler()
1975 status = inb_p (padapter->regStatCmd); in Irq_Handler()
1978 insw (padapter->regData, pid, sizeof (IDENTIFY_DATA) >> 1); in Irq_Handler()
2003 if ( pdev == padapter->device ) in Irq_Handler()
2016 del_timer (&padapter->timer); in Irq_Handler()
2020 zl = DecodeError (padapter, status); in Irq_Handler()
2025 OpDone (padapter, zl); in Irq_Handler()
2048 PADAPTER2220I padapter = HOSTDATA(SCpnt->host); // Pointer to adapter control structure in Pci2220i_QueueCommand() local
2049 POUR_DEVICE pdev = &padapter->device[SCpnt->target];// Pointer to device information in Pci2220i_QueueCommand()
2055 padapter->SCpnt = SCpnt; // Save this command data in Pci2220i_QueueCommand()
2056 padapter->readCount = 0; in Pci2220i_QueueCommand()
2060 padapter->currentSgBuffer = ((struct scatterlist *)SCpnt->request_buffer)[0].address; in Pci2220i_QueueCommand()
2061 padapter->currentSgCount = ((struct scatterlist *)SCpnt->request_buffer)[0].length; in Pci2220i_QueueCommand()
2065 padapter->currentSgBuffer = SCpnt->request_buffer; in Pci2220i_QueueCommand()
2066 padapter->currentSgCount = SCpnt->request_bufflen; in Pci2220i_QueueCommand()
2068 padapter->nextSg = 1; in Pci2220i_QueueCommand()
2076 if ( padapter->atapi ) in Pci2220i_QueueCommand()
2081 padapter->pdev = pdev; in Pci2220i_QueueCommand()
2084 OpDone (padapter, DID_BAD_TARGET << 16); in Pci2220i_QueueCommand()
2088 padapter->atapiSpecial = FALSE; in Pci2220i_QueueCommand()
2089 padapter->reqSense = FALSE; in Pci2220i_QueueCommand()
2090 memset (padapter->atapiCdb, 0, 16); in Pci2220i_QueueCommand()
2091 SelectSpigot (padapter, pdev->spigot); // select the spigot in Pci2220i_QueueCommand()
2092 AtapiDevice (padapter, pdev->byte6); // select the drive in Pci2220i_QueueCommand()
2093 if ( AtapiWaitReady (padapter, 100) ) in Pci2220i_QueueCommand()
2095 OpDone (padapter, DID_NO_CONNECT << 16); in Pci2220i_QueueCommand()
2103 Scsi2Atapi (padapter, SCpnt); in Pci2220i_QueueCommand()
2108 Scsi2Atapi (padapter, SCpnt); in Pci2220i_QueueCommand()
2112 memcpy (padapter->atapiCdb, cdb, SCpnt->cmd_len); in Pci2220i_QueueCommand()
2121 AtapiCountLo (padapter, zlo); in Pci2220i_QueueCommand()
2122 AtapiCountHi (padapter, zhi); in Pci2220i_QueueCommand()
2123 outb_p (0, padapter->regError); in Pci2220i_QueueCommand()
2124 WriteCommand (padapter, IDE_COMMAND_ATAPI_PACKET); in Pci2220i_QueueCommand()
2128 if ( AtapiWaitDrq (padapter, 500) ) in Pci2220i_QueueCommand()
2130 OpDone (padapter, DID_ERROR << 16); in Pci2220i_QueueCommand()
2133 AtapiSendCdb (padapter, pdev, padapter->atapiCdb); in Pci2220i_QueueCommand()
2137 if ( padapter->reconPhase ) in Pci2220i_QueueCommand()
2139 if ( padapter->reconTimer.data ) in Pci2220i_QueueCommand()
2141 del_timer (&padapter->reconTimer); in Pci2220i_QueueCommand()
2142 padapter->reconTimer.data = 0; in Pci2220i_QueueCommand()
2145 if ( (SCpnt->target >= padapter->numberOfDrives) || SCpnt->lun ) in Pci2220i_QueueCommand()
2147 OpDone (padapter, DID_BAD_TARGET << 16); in Pci2220i_QueueCommand()
2160 for ( z = 0; z < padapter->numberOfDrives; z++ ) in Pci2220i_QueueCommand()
2162 pdev = &padapter->device[z]; in Pci2220i_QueueCommand()
2166 padapter->reconOn = pdev->reconOn = pdev->reconIsStarting = TRUE; in Pci2220i_QueueCommand()
2169 OpDone (padapter, DID_OK << 16); in Pci2220i_QueueCommand()
2172 MuteAlarm (padapter); in Pci2220i_QueueCommand()
2173 OpDone (padapter, DID_OK << 16); in Pci2220i_QueueCommand()
2176 padapter->demoFail = TRUE; in Pci2220i_QueueCommand()
2177 OpDone (padapter, DID_OK << 16); in Pci2220i_QueueCommand()
2182 if ( padapter->raidData[z] ) in Pci2220i_QueueCommand()
2184 memcpy (&pdr->DiskRaid1, padapter->raidData[z], sizeof (DISK_MIRROR)); in Pci2220i_QueueCommand()
2185 if ( padapter->raidData[z]->reconstructPoint > padapter->raidData[z ^ 2]->reconstructPoint ) in Pci2220i_QueueCommand()
2186 pdr->TotalSectors = padapter->raidData[z]->reconstructPoint; in Pci2220i_QueueCommand()
2188 pdr->TotalSectors = padapter->raidData[z ^ 2]->reconstructPoint; in Pci2220i_QueueCommand()
2192 OpDone (padapter, DID_OK << 16); in Pci2220i_QueueCommand()
2197 padapter->cmd = IDE_COMMAND_IDENTIFY; in Pci2220i_QueueCommand()
2202 OpDone (padapter, DID_OK << 16); in Pci2220i_QueueCommand()
2210 OpDone (padapter, DID_OK << 16); in Pci2220i_QueueCommand()
2214 padapter->startSector = XSCSI2LONG (&cdb[2]); in Pci2220i_QueueCommand()
2215 padapter->sectorCount = (UCHAR)((USHORT)cdb[8] | ((USHORT)cdb[7] << 8)); in Pci2220i_QueueCommand()
2216 padapter->cmd = IDE_COMMAND_VERIFY; in Pci2220i_QueueCommand()
2219 padapter->startSector = XSCSI2LONG (&cdb[2]); in Pci2220i_QueueCommand()
2220 padapter->sectorCount = (USHORT)cdb[8] | ((USHORT)cdb[7] << 8); in Pci2220i_QueueCommand()
2221 padapter->cmd = READ_CMD; in Pci2220i_QueueCommand()
2224 padapter->startSector = SCSI2LONG (&cdb[1]); in Pci2220i_QueueCommand()
2225 padapter->sectorCount = cdb[4]; in Pci2220i_QueueCommand()
2226 padapter->cmd = READ_CMD; in Pci2220i_QueueCommand()
2229 padapter->startSector = XSCSI2LONG (&cdb[2]); in Pci2220i_QueueCommand()
2230 padapter->sectorCount = (USHORT)cdb[8] | ((USHORT)cdb[7] << 8); in Pci2220i_QueueCommand()
2231 padapter->cmd = WRITE_CMD; in Pci2220i_QueueCommand()
2234 padapter->startSector = SCSI2LONG (&cdb[1]); in Pci2220i_QueueCommand()
2235 padapter->sectorCount = cdb[4]; in Pci2220i_QueueCommand()
2236 padapter->cmd = WRITE_CMD; in Pci2220i_QueueCommand()
2240 OpDone (padapter, DID_ERROR << 16); in Pci2220i_QueueCommand()
2244 if ( padapter->reconPhase ) in Pci2220i_QueueCommand()
2247 padapter->pdev = pdev; in Pci2220i_QueueCommand()
2249 while ( padapter->demoFail ) in Pci2220i_QueueCommand()
2251 pdev = padapter->pdev = &padapter->device[0]; in Pci2220i_QueueCommand()
2252 padapter->demoFail = FALSE; in Pci2220i_QueueCommand()
2260 padapter->survivor = 1; in Pci2220i_QueueCommand()
2262 padapter->survivor = 0; in Pci2220i_QueueCommand()
2264 if ( InitFailover (padapter, pdev) ) in Pci2220i_QueueCommand()
2269 StartTimer (padapter); in Pci2220i_QueueCommand()
2270 if ( pdev->raid && (padapter->cmd == WRITE_CMD) ) in Pci2220i_QueueCommand()
2272 rc = IdeCmdBoth (padapter, pdev); in Pci2220i_QueueCommand()
2274 rc = WriteDataBoth (padapter, pdev); in Pci2220i_QueueCommand()
2277 del_timer (&padapter->timer); in Pci2220i_QueueCommand()
2278 padapter->expectingIRQ = 0; in Pci2220i_QueueCommand()
2279 padapter->survivor = rc >> 1; in Pci2220i_QueueCommand()
2281 if ( InitFailover (padapter, pdev) ) in Pci2220i_QueueCommand()
2283 OpDone (padapter, DID_ERROR << 16); in Pci2220i_QueueCommand()
2290 rc = IdeCmd (padapter, pdev); in Pci2220i_QueueCommand()
2291 if ( (padapter->cmd == WRITE_CMD) && !rc ) in Pci2220i_QueueCommand()
2292 rc = WriteData (padapter); in Pci2220i_QueueCommand()
2295 del_timer (&padapter->timer); in Pci2220i_QueueCommand()
2296 padapter->expectingIRQ = 0; in Pci2220i_QueueCommand()
2299 padapter->survivor = (pdev->spigot ^ 3) >> 1; in Pci2220i_QueueCommand()
2301 if ( !InitFailover (padapter, pdev) ) in Pci2220i_QueueCommand()
2304 OpDone (padapter, DID_ERROR << 16); in Pci2220i_QueueCommand()
2345 static VOID ReadFlash (PADAPTER2220I padapter, VOID *pdata, ULONG base, ULONG length) in ReadFlash() argument
2352 oldremap = inl (padapter->regRemap); // save values to restore later in ReadFlash()
2353 olddesc = inb_p (padapter->regDesc); in ReadFlash()
2355 outl (base | 1, padapter->regRemap); // remap to Flash space as specified in ReadFlash()
2356 outb_p (0x40, padapter->regDesc); // describe remap region as 8 bit in ReadFlash()
2358 *pd++ = inb_p (padapter->regBase + z); // read in the data in ReadFlash()
2360 outl (oldremap, padapter->regRemap); // restore remap register values in ReadFlash()
2361 outb_p (olddesc, padapter->regDesc); in ReadFlash()
2377 PADAPTER2220I padapter; in GetRegs() local
2384 padapter = HOSTDATA(pshost); in GetRegs()
2385 memset (padapter, 0, sizeof (ADAPTER2220I)); in GetRegs()
2392 padapter->basePort = zr; in GetRegs()
2393 padapter->regRemap = zr + RTR_LOCAL_REMAP; // 32 bit local space remap in GetRegs()
2394 padapter->regDesc = zr + RTR_REGIONS; // 32 bit local region descriptor in GetRegs()
2395 padapter->regRange = zr + RTR_LOCAL_RANGE; // 32 bit local range in GetRegs()
2396 padapter->regIrqControl = zr + RTR_INT_CONTROL_STATUS; // 16 bit interupt control and status in GetRegs()
2397 padapter->regScratchPad = zr + RTR_MAILBOX; // 16 byte scratchpad I/O base address in GetRegs()
2399 padapter->regBase = zl; in GetRegs()
2400 padapter->regData = zl + REG_DATA; // data register I/O address in GetRegs()
2401 padapter->regError = zl + REG_ERROR; // error register I/O address in GetRegs()
2402 padapter->regSectCount = zl + REG_SECTOR_COUNT; // sector count register I/O address in GetRegs()
2403 padapter->regLba0 = zl + REG_LBA_0; // least significant byte of LBA in GetRegs()
2404 padapter->regLba8 = zl + REG_LBA_8; // next least significant byte of LBA in GetRegs()
2405 padapter->regLba16 = zl + REG_LBA_16; // next most significan byte of LBA in GetRegs()
2406 padapter->regLba24 = zl + REG_LBA_24; // head and most 4 significant bits of LBA in GetRegs()
2407 padapter->regStatCmd = zl + REG_STAT_CMD; // status on read and command on write register in GetRegs()
2408padapter->regStatSel = zl + REG_STAT_SEL; // board status on read and spigot select on write r… in GetRegs()
2409 padapter->regFail = zl + REG_FAIL; in GetRegs()
2410 padapter->regAltStat = zl + REG_ALT_STAT; in GetRegs()
2411 padapter->pcidev = pcidev; in GetRegs()
2415padapter->regDmaDesc = zr + RTR_DMA0_DESC_PTR; // address of the DMA discriptor register for dir… in GetRegs()
2416 padapter->regDmaCmdStat = zr + RTR_DMA_COMMAND_STATUS; // Byte #0 of DMA command status register in GetRegs()
2417 padapter->regDmaAddrPci = zr + RTR_DMA0_PCI_ADDR; // 32 bit register for PCI address of DMA in GetRegs()
2418padapter->regDmaAddrLoc = zr + RTR_DMA0_LOCAL_ADDR; // 32 bit register for local bus address of … in GetRegs()
2419 padapter->regDmaCount = zr + RTR_DMA0_COUNT; // 32 bit register for DMA transfer count in GetRegs()
2420 padapter->regDmaMode = zr + RTR_DMA0_MODE + 1; // 32 bit register for DMA mode control in GetRegs()
2421 padapter->bigD = SEL_NEW_SPEED_1; // set spigot speed control bit in GetRegs()
2425padapter->regDmaDesc = zl + RTL_DMA1_DESC_PTR; // address of the DMA discriptor register for dir… in GetRegs()
2426padapter->regDmaCmdStat = zl + RTL_DMA_COMMAND_STATUS + 1; // Byte #1 of DMA command status regist… in GetRegs()
2427 padapter->regDmaAddrPci = zl + RTL_DMA1_PCI_ADDR; // 32 bit register for PCI address of DMA in GetRegs()
2428padapter->regDmaAddrLoc = zl + RTL_DMA1_LOCAL_ADDR; // 32 bit register for local bus address of … in GetRegs()
2429 padapter->regDmaCount = zl + RTL_DMA1_COUNT; // 32 bit register for DMA transfer count in GetRegs()
2430 padapter->regDmaMode = zl + RTL_DMA1_MODE + 1; // 32 bit register for DMA mode control in GetRegs()
2433 padapter->numberOfDrives = inb_p (padapter->regScratchPad + BIGD_NUM_DRIVES); in GetRegs()
2434 if ( !bigd && !padapter->numberOfDrives ) // if no devices on this board in GetRegs()
2446 if ( request_irq (pshost->irq, Irq_Handler, SA_SHIRQ, "pci2220i", padapter) < 0 ) in GetRegs()
2448 if ( request_irq (pshost->irq, Irq_Handler, SA_INTERRUPT | SA_SHIRQ, "pci2220i", padapter) < 0 ) in GetRegs()
2454 padapter->irqOwned = pshost->irq; // set IRQ as owned in GetRegs()
2457 if ( padapter->numberOfDrives ) in GetRegs()
2464 free_irq (pshost->irq, padapter); in GetRegs()
2467 padapter->kBuffer = consistent; in GetRegs()
2468 padapter->kBufferDma = consistentDma; in GetRegs()
2471 pshost->io_port = padapter->basePort; in GetRegs()
2473 pshost->unique_id = padapter->regBase; in GetRegs()
2475 …outb_p (0x01, padapter->regRange); // fix our range register because other drivers want to … in GetRegs()
2477 padapter->timingMode = inb_p (padapter->regScratchPad + DALE_TIMING_MODE); in GetRegs()
2478 if ( padapter->timingMode >= 2 ) in GetRegs()
2481 padapter->timingAddress = ModeArray2[padapter->timingMode - 2]; in GetRegs()
2483 padapter->timingAddress = ModeArray[padapter->timingMode - 2]; in GetRegs()
2486 padapter->timingPIO = TRUE; in GetRegs()
2488 ReadFlash (padapter, &DaleSetup, DALE_FLASH_SETUP, sizeof (SETUP)); in GetRegs()
2489 ReadFlash (padapter, &DiskMirror, DALE_FLASH_RAID, sizeof (DiskMirror)); in GetRegs()
2504 VOID SetupFinish (PADAPTER2220I padapter, char *str, int irq) in SetupFinish() argument
2506 init_timer (&padapter->timer); in SetupFinish()
2507 padapter->timer.function = TimerExpiry; in SetupFinish()
2508 padapter->timer.data = (unsigned long)padapter; in SetupFinish()
2509 init_timer (&padapter->reconTimer); in SetupFinish()
2510 padapter->reconTimer.function = ReconTimerExpiry; in SetupFinish()
2511 padapter->reconTimer.data = (unsigned long)padapter; in SetupFinish()
2512 …nPCI-%sI EIDE CONTROLLER: at I/O = %lX/%lX IRQ = %d\n", str, padapter->basePort, padapter->regBas… in SetupFinish()
2528 PADAPTER2220I padapter; in Pci2220i_Detect() local
2551 padapter = HOSTDATA(pshost); in Pci2220i_Detect()
2557 pshost->max_id = padapter->numberOfDrives; in Pci2220i_Detect()
2558 for ( z = 0; z < padapter->numberOfDrives; z++ ) in Pci2220i_Detect()
2560 unit = inb_p (padapter->regScratchPad + DALE_CHANNEL_DEVICE_0 + z) & 0x0F; in Pci2220i_Detect()
2561 pdev = &padapter->device[z]; in Pci2220i_Detect()
2571 DiskMirror[0].status = inb_p (padapter->regScratchPad + DALE_RAID_0_STATUS); in Pci2220i_Detect()
2572 DiskMirror[1].status = inb_p (padapter->regScratchPad + DALE_RAID_1_STATUS); in Pci2220i_Detect()
2584 padapter->raidData[0] = &pdev->DiskMirror[0]; in Pci2220i_Detect()
2585 padapter->raidData[2] = &pdev->DiskMirror[1]; in Pci2220i_Detect()
2590 pdev->lastsectorlba[0] = InlineIdentify (padapter, 1, 0); in Pci2220i_Detect()
2591 pdev->lastsectorlba[1] = InlineIdentify (padapter, 2, 0); in Pci2220i_Detect()
2601 InlineReadSignature (padapter, pdev, 0); in Pci2220i_Detect()
2603 InlineReadSignature (padapter, pdev, 1); in Pci2220i_Detect()
2613 padapter->reconOn = pdev->reconOn = pdev->reconIsStarting = TRUE; in Pci2220i_Detect()
2632 padapter->reconOn = pdev->reconOn = pdev->reconIsStarting = TRUE; in Pci2220i_Detect()
2640 SetupFinish (padapter, "2220", pshost->irq); in Pci2220i_Detect()
2652 padapter = HOSTDATA(pshost); in Pci2220i_Detect()
2658 DiskMirror[z].status = inb_p (padapter->regScratchPad + BIGD_RAID_0_STATUS + z); in Pci2220i_Detect()
2661 pshost->max_id = padapter->numberOfDrives; in Pci2220i_Detect()
2662 padapter->failRegister = inb_p (padapter->regScratchPad + BIGD_ALARM_IMAGE); in Pci2220i_Detect()
2663 for ( z = 0; z < padapter->numberOfDrives; z++ ) in Pci2220i_Detect()
2665 unit = inb_p (padapter->regScratchPad + BIGD_DEVICE_0 + z); in Pci2220i_Detect()
2666 pdev = &padapter->device[z]; in Pci2220i_Detect()
2687 padapter->raidData[unit] = &pdev->DiskMirror[0]; in Pci2220i_Detect()
2688 padapter->raidData[unit ^ 2] = &pdev->DiskMirror[1]; in Pci2220i_Detect()
2693 pdev->lastsectorlba[0] = InlineIdentify (padapter, pdev->spigots[0], unit & 1); in Pci2220i_Detect()
2694 pdev->lastsectorlba[1] = InlineIdentify (padapter, pdev->spigots[1], unit & 1); in Pci2220i_Detect()
2704 InlineReadSignature (padapter, pdev, 0); in Pci2220i_Detect()
2706 InlineReadSignature (padapter, pdev, 1); in Pci2220i_Detect()
2716 padapter->reconOn = pdev->reconOn = pdev->reconIsStarting = TRUE; in Pci2220i_Detect()
2735 padapter->reconOn = pdev->reconOn = pdev->reconIsStarting = TRUE; in Pci2220i_Detect()
2739 if ( !padapter->numberOfDrives ) // If no ATA devices then scan ATAPI in Pci2220i_Detect()
2747 pdev = &(padapter->device[(spigot1 * 2) + device]); in Pci2220i_Detect()
2750 if ( !AtapiReset (padapter, pdev) ) in Pci2220i_Detect()
2753 if ( !AtapiIdentify (padapter, pdev) ) in Pci2220i_Detect()
2766 padapter->atapi = TRUE; in Pci2220i_Detect()
2767 padapter->timingAddress = DALE_DATA_MODE3; in Pci2220i_Detect()
2768 outw_p (0x0900, padapter->regIrqControl); // Turn our interrupts on in Pci2220i_Detect()
2769 …outw_p (0x0C41, padapter->regDmaMode - 1); // setup for 16 bits, ready enabled, done IRQ enabl… in Pci2220i_Detect()
2770 outb_p (0xFF, padapter->regFail); // all fail lights and alarm off in Pci2220i_Detect()
2774 SetupFinish (padapter, "2240", pshost->irq); in Pci2220i_Detect()
2798 PADAPTER2220I padapter = HOSTDATA(SCpnt->host); // Pointer to adapter control structure in Pci2220i_Abort() local
2799 POUR_DEVICE pdev = &padapter->device[SCpnt->target];// Pointer to device information in Pci2220i_Abort()
2801 if ( !padapter->SCpnt ) in Pci2220i_Abort()
2804 if ( padapter->atapi ) in Pci2220i_Abort()
2806 if ( AtapiReset (padapter, pdev) ) in Pci2220i_Abort()
2808 OpDone (padapter, DID_ABORT << 16); in Pci2220i_Abort()
2830 PADAPTER2220I padapter = HOSTDATA(SCpnt->host); // Pointer to adapter control structure in Pci2220i_Reset() local
2831 POUR_DEVICE pdev = &padapter->device[SCpnt->target];// Pointer to device information in Pci2220i_Reset()
2833 if ( padapter->atapi ) in Pci2220i_Reset()
2835 if ( AtapiReset (padapter, pdev) ) in Pci2220i_Reset()
2853 PADAPTER2220I padapter = HOSTDATA (pshost); in Pci2220i_Release() local
2856 if ( padapter->reconOn ) in Pci2220i_Release()
2858 padapter->reconOn = FALSE; // shut down the hot reconstruct in Pci2220i_Release()
2859 if ( padapter->reconPhase ) in Pci2220i_Release()
2861 if ( padapter->reconTimer.data ) // is the timer running? in Pci2220i_Release()
2863 del_timer (&padapter->reconTimer); in Pci2220i_Release()
2864 padapter->reconTimer.data = 0; in Pci2220i_Release()
2869 if ( padapter->bigD ) in Pci2220i_Release()
2871 outb_p (padapter->failRegister, padapter->regScratchPad + BIGD_ALARM_IMAGE); in Pci2220i_Release()
2874 if ( padapter->raidData ) in Pci2220i_Release()
2875 outb_p (padapter->raidData[z]->status, padapter->regScratchPad + BIGD_RAID_0_STATUS + z); in Pci2220i_Release()
2877 outb_p (0, padapter->regScratchPad + BIGD_RAID_0_STATUS); in Pci2220i_Release()
2882 outb_p (padapter->device[0].DiskMirror[0].status, padapter->regScratchPad + DALE_RAID_0_STATUS); in Pci2220i_Release()
2883 outb_p (padapter->device[0].DiskMirror[1].status, padapter->regScratchPad + DALE_RAID_1_STATUS); in Pci2220i_Release()
2886 if ( padapter->irqOwned ) in Pci2220i_Release()
2887 free_irq (pshost->irq, padapter); in Pci2220i_Release()
2889 if ( padapter->numberOfDrives ) in Pci2220i_Release()
2890 …pci_free_consistent (padapter->pcidev, SECTORSXFER * BYTES_PER_SECTOR, padapter->kBuffer, padapter in Pci2220i_Release()
2892 pci_free_consistent (padapter->pcidev, ATAPI_TRANSFER, padapter->kBuffer, padapter->kBufferDma); in Pci2220i_Release()