• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/drivers/block/

Lines Matching refs:Controller

166 static void DAC960_AnnounceDriver(DAC960_Controller_T *Controller)
170 DAC960_DriverDate " *****\n", Controller);
172 "<lnz@dandelion.com>\n", Controller);
180 static bool DAC960_Failure(DAC960_Controller_T *Controller,
183 DAC960_Error("While configuring DAC960 PCI RAID Controller at\n",
184 Controller);
185 if (Controller->IO_Address == 0)
187 "PCI Address 0x%X\n", Controller,
188 Controller->Bus, Controller->Device,
189 Controller->Function, Controller->PCI_Address);
191 "0x%X PCI Address 0x%X\n", Controller,
192 Controller->Bus, Controller->Device,
193 Controller->Function, Controller->IO_Address,
194 Controller->PCI_Address);
195 DAC960_Error("%s FAILED - DETACHING\n", Controller, ErrorMessage);
249 data structures for Controller. It returns true on success and false on
253 static bool DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
265 if (Controller->FirmwareType == DAC960_V1_Controller)
270 Controller->PCIDevice,
274 return DAC960_Failure(Controller,
276 Controller->ScatterGatherPool = ScatterGatherPool;
283 Controller->PCIDevice,
287 return DAC960_Failure(Controller,
290 Controller->PCIDevice, sizeof(DAC960_SCSI_RequestSense_T),
294 return DAC960_Failure(Controller,
297 Controller->ScatterGatherPool = ScatterGatherPool;
298 Controller->V2.RequestSensePool = RequestSensePool;
300 Controller->CommandAllocationGroupSize = CommandAllocationGroupSize;
301 Controller->FreeCommands = NULL;
303 CommandIdentifier <= Controller->DriverQueueDepth;
310 Controller->DriverQueueDepth - CommandIdentifier + 1;
317 return DAC960_Failure(Controller,
323 Command->Controller = Controller;
324 Command->Next = Controller->FreeCommands;
325 Controller->FreeCommands = Command;
326 Controller->Commands[CommandIdentifier-1] = Command;
330 return DAC960_Failure(Controller, "AUXILIARY STRUCTURE CREATION");
338 return DAC960_Failure(Controller,
342 if (Controller->FirmwareType == DAC960_V1_Controller) {
363 structures for Controller.
366 static void DAC960_DestroyAuxiliaryStructures(DAC960_Controller_T *Controller)
369 struct pci_pool *ScatterGatherPool = Controller->ScatterGatherPool;
378 if (Controller->FirmwareType == DAC960_V2_Controller)
379 RequestSensePool = Controller->V2.RequestSensePool;
381 Controller->FreeCommands = NULL;
382 for (i = 0; i < Controller->DriverQueueDepth; i++)
384 DAC960_Command_T *Command = Controller->Commands[i];
389 if (Controller->FirmwareType == DAC960_V1_Controller) {
406 % Controller->CommandAllocationGroupSize) == 1) {
416 Controller->Commands[i] = NULL;
420 if (Controller->CombinedStatusBuffer != NULL)
422 kfree(Controller->CombinedStatusBuffer);
423 Controller->CombinedStatusBuffer = NULL;
424 Controller->CurrentStatusBuffer = NULL;
429 if (Controller->FirmwareType == DAC960_V1_Controller)
436 kfree(Controller->V2.LogicalDeviceInformation[i]);
437 Controller->V2.LogicalDeviceInformation[i] = NULL;
442 kfree(Controller->V2.PhysicalDeviceInformation[i]);
443 Controller->V2.PhysicalDeviceInformation[i] = NULL;
444 kfree(Controller->V2.InquiryUnitSerialNumber[i]);
445 Controller->V2.InquiryUnitSerialNumber[i] = NULL;
477 DAC960_AllocateCommand allocates a Command structure from Controller's
484 *Controller)
486 DAC960_Command_T *Command = Controller->FreeCommands;
488 Controller->FreeCommands = Command->Next;
495 DAC960_DeallocateCommand deallocates Command, returning it to Controller's
501 DAC960_Controller_T *Controller = Command->Controller;
504 Command->Next = Controller->FreeCommands;
505 Controller->FreeCommands = Command;
510 DAC960_WaitForCommand waits for a wake_up on Controller's Command Wait Queue.
513 static void DAC960_WaitForCommand(DAC960_Controller_T *Controller)
515 spin_unlock_irq(&Controller->queue_lock);
516 __wait_event(Controller->CommandWaitQueue, Controller->FreeCommands);
517 spin_lock_irq(&Controller->queue_lock);
526 DAC960_Controller_T *Controller = Command->Controller;
527 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
530 Controller->V2.NextCommandMailbox;
535 if (Controller->V2.PreviousCommandMailbox1->Words[0] == 0 ||
536 Controller->V2.PreviousCommandMailbox2->Words[0] == 0)
539 Controller->V2.PreviousCommandMailbox2 =
540 Controller->V2.PreviousCommandMailbox1;
541 Controller->V2.PreviousCommandMailbox1 = NextCommandMailbox;
543 if (++NextCommandMailbox > Controller->V2.LastCommandMailbox)
544 NextCommandMailbox = Controller->V2.FirstCommandMailbox;
546 Controller->V2.NextCommandMailbox = NextCommandMailbox;
555 DAC960_Controller_T *Controller = Command->Controller;
556 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
559 Controller->V2.NextCommandMailbox;
562 if (Controller->V2.PreviousCommandMailbox1->Words[0] == 0 ||
563 Controller->V2.PreviousCommandMailbox2->Words[0] == 0)
565 Controller->V2.PreviousCommandMailbox2 =
566 Controller->V2.PreviousCommandMailbox1;
567 Controller->V2.PreviousCommandMailbox1 = NextCommandMailbox;
568 if (++NextCommandMailbox > Controller->V2.LastCommandMailbox)
569 NextCommandMailbox = Controller->V2.FirstCommandMailbox;
570 Controller->V2.NextCommandMailbox = NextCommandMailbox;
580 DAC960_Controller_T *Controller = Command->Controller;
581 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
584 Controller->V2.NextCommandMailbox;
587 if (Controller->V2.PreviousCommandMailbox1->Words[0] == 0 ||
588 Controller->V2.PreviousCommandMailbox2->Words[0] == 0)
590 Controller->V2.PreviousCommandMailbox2 =
591 Controller->V2.PreviousCommandMailbox1;
592 Controller->V2.PreviousCommandMailbox1 = NextCommandMailbox;
593 if (++NextCommandMailbox > Controller->V2.LastCommandMailbox)
594 NextCommandMailbox = Controller->V2.FirstCommandMailbox;
595 Controller->V2.NextCommandMailbox = NextCommandMailbox;
606 DAC960_Controller_T *Controller = Command->Controller;
607 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
610 Controller->V1.NextCommandMailbox;
613 if (Controller->V1.PreviousCommandMailbox1->Words[0] == 0 ||
614 Controller->V1.PreviousCommandMailbox2->Words[0] == 0)
616 Controller->V1.PreviousCommandMailbox2 =
617 Controller->V1.PreviousCommandMailbox1;
618 Controller->V1.PreviousCommandMailbox1 = NextCommandMailbox;
619 if (++NextCommandMailbox > Controller->V1.LastCommandMailbox)
620 NextCommandMailbox = Controller->V1.FirstCommandMailbox;
621 Controller->V1.NextCommandMailbox = NextCommandMailbox;
632 DAC960_Controller_T *Controller = Command->Controller;
633 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
636 Controller->V1.NextCommandMailbox;
639 if (Controller->V1.PreviousCommandMailbox1->Words[0] == 0 ||
640 Controller->V1.PreviousCommandMailbox2->Words[0] == 0)
642 Controller->V1.PreviousCommandMailbox2 =
643 Controller->V1.PreviousCommandMailbox1;
644 Controller->V1.PreviousCommandMailbox1 = NextCommandMailbox;
645 if (++NextCommandMailbox > Controller->V1.LastCommandMailbox)
646 NextCommandMailbox = Controller->V1.FirstCommandMailbox;
647 Controller->V1.NextCommandMailbox = NextCommandMailbox;
658 DAC960_Controller_T *Controller = Command->Controller;
659 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
662 Controller->V1.NextCommandMailbox;
665 if (Controller->V1.PreviousCommandMailbox1->Words[0] == 0 ||
666 Controller->V1.PreviousCommandMailbox2->Words[0] == 0)
668 Controller->V1.PreviousCommandMailbox2 =
669 Controller->V1.PreviousCommandMailbox1;
670 Controller->V1.PreviousCommandMailbox1 = NextCommandMailbox;
671 if (++NextCommandMailbox > Controller->V1.LastCommandMailbox)
672 NextCommandMailbox = Controller->V1.FirstCommandMailbox;
673 Controller->V1.NextCommandMailbox = NextCommandMailbox;
684 DAC960_Controller_T *Controller = Command->Controller;
685 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
688 Controller->V1.NextCommandMailbox;
691 if (Controller->V1.PreviousCommandMailbox1->Words[0] == 0 ||
692 Controller->V1.PreviousCommandMailbox2->Words[0] == 0)
694 Controller->V1.PreviousCommandMailbox2 =
695 Controller->V1.PreviousCommandMailbox1;
696 Controller->V1.PreviousCommandMailbox1 = NextCommandMailbox;
697 if (++NextCommandMailbox > Controller->V1.LastCommandMailbox)
698 NextCommandMailbox = Controller->V1.FirstCommandMailbox;
699 Controller->V1.NextCommandMailbox = NextCommandMailbox;
709 DAC960_Controller_T *Controller = Command->Controller;
710 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
726 DAC960_Controller_T *Controller = Command->Controller;
727 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
772 DAC960_Controller_T *Controller = Command->Controller;
777 spin_lock_irqsave(&Controller->queue_lock, flags);
779 spin_unlock_irqrestore(&Controller->queue_lock, flags);
788 DAC960_V1_ExecuteType3 executes a DAC960 V1 Firmware Controller Type 3
793 static bool DAC960_V1_ExecuteType3(DAC960_Controller_T *Controller,
797 DAC960_Command_T *Command = DAC960_AllocateCommand(Controller);
812 DAC960_V1_ExecuteTypeB executes a DAC960 V1 Firmware Controller Type 3B
817 static bool DAC960_V1_ExecuteType3B(DAC960_Controller_T *Controller,
822 DAC960_Command_T *Command = DAC960_AllocateCommand(Controller);
838 DAC960_V1_ExecuteType3D executes a DAC960 V1 Firmware Controller Type 3D
843 static bool DAC960_V1_ExecuteType3D(DAC960_Controller_T *Controller,
849 DAC960_Command_T *Command = DAC960_AllocateCommand(Controller);
873 static bool DAC960_V2_GeneralInfo(DAC960_Controller_T *Controller)
875 DAC960_Command_T *Command = DAC960_AllocateCommand(Controller);
890 Controller->V2.HealthStatusBufferDMA;
903 DAC960_V2_ControllerInfo executes a DAC960 V2 Firmware Controller
911 static bool DAC960_V2_NewControllerInfo(DAC960_Controller_T *Controller)
913 DAC960_Command_T *Command = DAC960_AllocateCommand(Controller);
929 Controller->V2.NewControllerInformationDMA;
942 DAC960_V2_LogicalDeviceInfo executes a DAC960 V2 Firmware Controller Logical
949 static bool DAC960_V2_NewLogicalDeviceInfo(DAC960_Controller_T *Controller,
952 DAC960_Command_T *Command = DAC960_AllocateCommand(Controller);
972 Controller->V2.NewLogicalDeviceInformationDMA;
985 DAC960_V2_PhysicalDeviceInfo executes a DAC960 V2 Firmware Controller "Read
1000 static bool DAC960_V2_NewPhysicalDeviceInfo(DAC960_Controller_T *Controller,
1005 DAC960_Command_T *Command = DAC960_AllocateCommand(Controller);
1026 Controller->V2.NewPhysicalDeviceInformationDMA;
1039 DAC960_Controller_T *Controller,
1064 Controller->V2.NewInquiryUnitSerialNumberDMA;
1085 static bool DAC960_V2_NewInquiryUnitSerialNumber(DAC960_Controller_T *Controller,
1092 Command = DAC960_AllocateCommand(Controller);
1097 DAC960_V2_ConstructNewUnitSerialNumber(Controller, CommandMailbox,
1108 DAC960_V2_DeviceOperation executes a DAC960 V2 Firmware Controller Device
1113 static bool DAC960_V2_DeviceOperation(DAC960_Controller_T *Controller,
1118 DAC960_Command_T *Command = DAC960_AllocateCommand(Controller);
1146 *Controller)
1148 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
1149 DAC960_HardwareType_T hw_type = Controller->HardwareType;
1150 struct pci_dev *PCI_Device = Controller->PCIDevice;
1151 struct dma_loaf *DmaPages = &Controller->DmaPages;
1168 if (pci_set_dma_mask(Controller->PCIDevice, DAC690_V1_PciDmaMask))
1169 return DAC960_Failure(Controller, "DMA mask out of range");
1170 Controller->BounceBufferLimit = DAC690_V1_PciDmaMask;
1199 Controller->V1.FirstCommandMailbox = CommandMailboxesMemory;
1200 Controller->V1.FirstCommandMailboxDMA = CommandMailboxesMemoryDMA;
1203 Controller->V1.LastCommandMailbox = CommandMailboxesMemory;
1204 Controller->V1.NextCommandMailbox = Controller->V1.FirstCommandMailbox;
1205 Controller->V1.PreviousCommandMailbox1 = Controller->V1.LastCommandMailbox;
1206 Controller->V1.PreviousCommandMailbox2 =
1207 Controller->V1.LastCommandMailbox - 1;
1213 Controller->V1.FirstStatusMailbox = StatusMailboxesMemory;
1214 Controller->V1.FirstStatusMailboxDMA = StatusMailboxesMemoryDMA;
1216 Controller->V1.LastStatusMailbox = StatusMailboxesMemory;
1217 Controller->V1.NextStatusMailbox = Controller->V1.FirstStatusMailbox;
1220 Controller->V1.MonitoringDCDB = slice_dma_loaf(DmaPages,
1222 &Controller->V1.MonitoringDCDB_DMA);
1224 Controller->V1.NewEnquiry = slice_dma_loaf(DmaPages,
1226 &Controller->V1.NewEnquiryDMA);
1228 Controller->V1.NewErrorTable = slice_dma_loaf(DmaPages,
1230 &Controller->V1.NewErrorTableDMA);
1232 Controller->V1.EventLogEntry = slice_dma_loaf(DmaPages,
1234 &Controller->V1.EventLogEntryDMA);
1236 Controller->V1.RebuildProgress = slice_dma_loaf(DmaPages,
1238 &Controller->V1.RebuildProgressDMA);
1240 Controller->V1.NewLogicalDriveInformation = slice_dma_loaf(DmaPages,
1242 &Controller->V1.NewLogicalDriveInformationDMA);
1244 Controller->V1.BackgroundInitializationStatus = slice_dma_loaf(DmaPages,
1246 &Controller->V1.BackgroundInitializationStatusDMA);
1248 Controller->V1.NewDeviceState = slice_dma_loaf(DmaPages,
1250 &Controller->V1.NewDeviceStateDMA);
1252 Controller->V1.NewInquiryStandardData = slice_dma_loaf(DmaPages,
1254 &Controller->V1.NewInquiryStandardDataDMA);
1256 Controller->V1.NewInquiryUnitSerialNumber = slice_dma_loaf(DmaPages,
1258 &Controller->V1.NewInquiryUnitSerialNumberDMA);
1264 Controller->V1.DualModeMemoryMailboxInterface = true;
1269 Controller->V1.FirstCommandMailboxDMA;
1271 Controller->V1.FirstStatusMailboxDMA;
1275 switch (Controller->HardwareType)
1301 Controller->V1.DualModeMemoryMailboxInterface = false;
1329 Controller->V1.DualModeMemoryMailboxInterface = false;
1333 DAC960_Failure(Controller, "Unknown Controller Type\n");
1352 *Controller)
1354 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
1355 struct pci_dev *PCI_Device = Controller->PCIDevice;
1356 struct dma_loaf *DmaPages = &Controller->DmaPages;
1371 if (pci_set_dma_mask(Controller->PCIDevice, DAC690_V2_PciDmaMask))
1372 return DAC960_Failure(Controller, "DMA mask out of range");
1373 Controller->BounceBufferLimit = DAC690_V2_PciDmaMask;
1403 Controller->V2.FirstCommandMailbox = CommandMailboxesMemory;
1404 Controller->V2.FirstCommandMailboxDMA = CommandMailboxesMemoryDMA;
1407 Controller->V2.LastCommandMailbox = CommandMailboxesMemory;
1408 Controller->V2.NextCommandMailbox = Controller->V2.FirstCommandMailbox;
1409 Controller->V2.PreviousCommandMailbox1 = Controller->V2.LastCommandMailbox;
1410 Controller->V2.PreviousCommandMailbox2 =
1411 Controller->V2.LastCommandMailbox - 1;
1417 Controller->V2.FirstStatusMailbox = StatusMailboxesMemory;
1418 Controller->V2.FirstStatusMailboxDMA = StatusMailboxesMemoryDMA;
1420 Controller->V2.LastStatusMailbox = StatusMailboxesMemory;
1421 Controller->V2.NextStatusMailbox = Controller->V2.FirstStatusMailbox;
1423 Controller->V2.HealthStatusBuffer = slice_dma_loaf(DmaPages,
1425 &Controller->V2.HealthStatusBufferDMA);
1427 Controller->V2.NewControllerInformation = slice_dma_loaf(DmaPages,
1429 &Controller->V2.NewControllerInformationDMA);
1431 Controller->V2.NewLogicalDeviceInformation = slice_dma_loaf(DmaPages,
1433 &Controller->V2.NewLogicalDeviceInformationDMA);
1435 Controller->V2.NewPhysicalDeviceInformation = slice_dma_loaf(DmaPages,
1437 &Controller->V2.NewPhysicalDeviceInformationDMA);
1439 Controller->V2.NewInquiryUnitSerialNumber = slice_dma_loaf(DmaPages,
1441 &Controller->V2.NewInquiryUnitSerialNumberDMA);
1443 Controller->V2.Event = slice_dma_loaf(DmaPages,
1445 &Controller->V2.EventDMA);
1447 Controller->V2.PhysicalToLogicalDevice = slice_dma_loaf(DmaPages,
1449 &Controller->V2.PhysicalToLogicalDeviceDMA);
1472 Controller->V2.HealthStatusBufferDMA;
1474 Controller->V2.FirstCommandMailboxDMA;
1476 Controller->V2.FirstStatusMailboxDMA;
1477 switch (Controller->HardwareType)
1513 DAC960_Failure(Controller, "Unknown Controller Type\n");
1525 from DAC960 V1 Firmware Controllers and initializes the Controller structure.
1529 *Controller)
1538 if (!init_dma_loaf(Controller->PCIDevice, &local_dma,
1540 return DAC960_Failure(Controller, "LOGICAL DEVICE ALLOCATION");
1545 if (!DAC960_V1_ExecuteType3(Controller, DAC960_V1_Enquiry,
1546 Controller->V1.NewEnquiryDMA)) {
1547 free_dma_loaf(Controller->PCIDevice, &local_dma);
1548 return DAC960_Failure(Controller, "ENQUIRY");
1550 memcpy(&Controller->V1.Enquiry, Controller->V1.NewEnquiry,
1553 if (!DAC960_V1_ExecuteType3(Controller, DAC960_V1_Enquiry2, Enquiry2DMA)) {
1554 free_dma_loaf(Controller->PCIDevice, &local_dma);
1555 return DAC960_Failure(Controller, "ENQUIRY2");
1558 if (!DAC960_V1_ExecuteType3(Controller, DAC960_V1_ReadConfig2, Config2DMA)) {
1559 free_dma_loaf(Controller->PCIDevice, &local_dma);
1560 return DAC960_Failure(Controller, "READ CONFIG2");
1563 if (!DAC960_V1_ExecuteType3(Controller, DAC960_V1_GetLogicalDriveInformation,
1564 Controller->V1.NewLogicalDriveInformationDMA)) {
1565 free_dma_loaf(Controller->PCIDevice, &local_dma);
1566 return DAC960_Failure(Controller, "GET LOGICAL DRIVE INFORMATION");
1568 memcpy(&Controller->V1.LogicalDriveInformation,
1569 Controller->V1.NewLogicalDriveInformation,
1574 if (!DAC960_V1_ExecuteType3D(Controller, DAC960_V1_GetDeviceState,
1576 Controller->V1.NewDeviceStateDMA)) {
1577 free_dma_loaf(Controller->PCIDevice, &local_dma);
1578 return DAC960_Failure(Controller, "GET DEVICE STATE");
1580 memcpy(&Controller->V1.DeviceState[Channel][TargetID],
1581 Controller->V1.NewDeviceState, sizeof(DAC960_V1_DeviceState_T));
1584 Initialize the Controller Model Name and Full Model Name fields.
1590 strcpy(Controller->ModelName, "DAC960PU");
1591 else strcpy(Controller->ModelName, "DAC960PD");
1594 strcpy(Controller->ModelName, "DAC960PL");
1597 strcpy(Controller->ModelName, "DAC960PG");
1600 strcpy(Controller->ModelName, "DAC960PJ");
1603 strcpy(Controller->ModelName, "DAC960PR");
1606 strcpy(Controller->ModelName, "DAC960PT");
1609 strcpy(Controller->ModelName, "DAC960PTL0");
1612 strcpy(Controller->ModelName, "DAC960PRL");
1615 strcpy(Controller->ModelName, "DAC960PTL1");
1618 strcpy(Controller->ModelName, "DAC1164P");
1621 free_dma_loaf(Controller->PCIDevice, &local_dma);
1622 return DAC960_Failure(Controller, "MODEL VERIFICATION");
1624 strcpy(Controller->FullModelName, "Mylex ");
1625 strcat(Controller->FullModelName, Controller->ModelName);
1627 Initialize the Controller Firmware Version field and verify that it
1658 Controller->V1.Enquiry.MajorFirmwareVersion;
1660 Controller->V1.Enquiry.MinorFirmwareVersion;
1664 sprintf(Controller->FirmwareVersion, "%d.%02d-%c-%02d",
1667 if (!((Controller->FirmwareVersion[0] == '5' &&
1668 strcmp(Controller->FirmwareVersion, "5.06") >= 0) ||
1669 (Controller->FirmwareVersion[0] == '4' &&
1670 strcmp(Controller->FirmwareVersion, "4.06") >= 0) ||
1671 (Controller->FirmwareVersion[0] == '3' &&
1672 strcmp(Controller->FirmwareVersion, "3.51") >= 0) ||
1673 (Controller->FirmwareVersion[0] == '2' &&
1674 strcmp(Controller->FirmwareVersion, FIRMWARE_27X) >= 0)))
1676 DAC960_Failure(Controller, "FIRMWARE VERSION VERIFICATION");
1677 DAC960_Error("Firmware Version = '%s'\n", Controller,
1678 Controller->FirmwareVersion);
1679 free_dma_loaf(Controller->PCIDevice, &local_dma);
1683 Initialize the Controller Channels, Targets, Memory Size, and SAF-TE
1686 Controller->Channels = Enquiry2->ActualChannels;
1687 Controller->Targets = Enquiry2->MaxTargets;
1688 Controller->MemorySize = Enquiry2->MemorySize >> 20;
1689 Controller->V1.SAFTE_EnclosureManagementEnabled =
1692 Initialize the Controller Queue Depth, Driver Queue Depth, Logical Drive
1693 Count, Maximum Blocks per Command, Controller Scatter/Gather Limit, and
1695 less than the Controller Queue Depth to allow for an automatic drive
1698 Controller->ControllerQueueDepth = Controller->V1.Enquiry.MaxCommands;
1699 Controller->DriverQueueDepth = Controller->ControllerQueueDepth - 1;
1700 if (Controller->DriverQueueDepth > DAC960_MaxDriverQueueDepth)
1701 Controller->DriverQueueDepth = DAC960_MaxDriverQueueDepth;
1702 Controller->LogicalDriveCount =
1703 Controller->V1.Enquiry.NumberOfLogicalDrives;
1704 Controller->MaxBlocksPerCommand = Enquiry2->MaxBlocksPerCommand;
1705 Controller->ControllerScatterGatherLimit = Enquiry2->MaxScatterGatherEntries;
1706 Controller->DriverScatterGatherLimit =
1707 Controller->ControllerScatterGatherLimit;
1708 if (Controller->DriverScatterGatherLimit > DAC960_V1_ScatterGatherLimit)
1709 Controller->DriverScatterGatherLimit = DAC960_V1_ScatterGatherLimit;
1713 Controller->V1.StripeSize = Config2->BlocksPerStripe * Config2->BlockFactor
1715 Controller->V1.SegmentSize = Config2->BlocksPerCacheLine * Config2->BlockFactor
1720 Controller->V1.GeometryTranslationHeads = 128;
1721 Controller->V1.GeometryTranslationSectors = 32;
1724 Controller->V1.GeometryTranslationHeads = 255;
1725 Controller->V1.GeometryTranslationSectors = 63;
1728 free_dma_loaf(Controller->PCIDevice, &local_dma);
1729 return DAC960_Failure(Controller, "CONFIG2 DRIVE GEOMETRY");
1734 if ((Controller->FirmwareVersion[0] == '4' &&
1735 strcmp(Controller->FirmwareVersion, "4.08") >= 0) ||
1736 (Controller->FirmwareVersion[0] == '5' &&
1737 strcmp(Controller->FirmwareVersion, "5.08") >= 0))
1739 Controller->V1.BackgroundInitializationStatusSupported = true;
1740 DAC960_V1_ExecuteType3B(Controller,
1742 Controller->
1744 memcpy(&Controller->V1.LastBackgroundInitializationStatus,
1745 Controller->V1.BackgroundInitializationStatus,
1752 LogicalDriveNumber < Controller->LogicalDriveCount;
1754 if (Controller->V1.LogicalDriveInformation
1757 Controller->LogicalDriveInitiallyAccessible[LogicalDriveNumber] = true;
1758 Controller->V1.LastRebuildStatus = DAC960_V1_NoRebuildOrCheckInProgress;
1759 free_dma_loaf(Controller->PCIDevice, &local_dma);
1766 from DAC960 V2 Firmware Controllers and initializes the Controller structure.
1770 *Controller)
1773 &Controller->V2.ControllerInformation;
1778 if (!DAC960_V2_NewControllerInfo(Controller))
1779 return DAC960_Failure(Controller, "GET CONTROLLER INFO");
1780 memcpy(ControllerInfo, Controller->V2.NewControllerInformation,
1784 if (!DAC960_V2_GeneralInfo(Controller))
1785 return DAC960_Failure(Controller, "GET HEALTH STATUS");
1788 Initialize the Controller Model Name and Full Model Name fields.
1791 if (ModelNameLength > sizeof(Controller->ModelName)-1)
1792 ModelNameLength = sizeof(Controller->ModelName)-1;
1793 memcpy(Controller->ModelName, ControllerInfo->ControllerName,
1796 while (Controller->ModelName[ModelNameLength] == ' ' ||
1797 Controller->ModelName[ModelNameLength] == '\0')
1799 Controller->ModelName[++ModelNameLength] = '\0';
1800 strcpy(Controller->FullModelName, "Mylex ");
1801 strcat(Controller->FullModelName, Controller->ModelName);
1803 Initialize the Controller Firmware Version field.
1805 sprintf(Controller->FirmwareVersion, "%d.%02d-%02d",
1814 Controller, Controller->FirmwareVersion);
1816 Controller);
1818 Controller);
1821 Initialize the Controller Channels, Targets, and Memory Size.
1823 Controller->Channels = ControllerInfo->NumberOfPhysicalChannelsPresent;
1824 Controller->Targets =
1827 Controller->MemorySize = ControllerInfo->MemorySizeMB;
1829 Initialize the Controller Queue Depth, Driver Queue Depth, Logical Drive
1830 Count, Maximum Blocks per Command, Controller Scatter/Gather Limit, and
1832 less than the Controller Queue Depth to allow for an automatic drive
1835 Controller->ControllerQueueDepth = ControllerInfo->MaximumParallelCommands;
1836 Controller->DriverQueueDepth = Controller->ControllerQueueDepth - 1;
1837 if (Controller->DriverQueueDepth > DAC960_MaxDriverQueueDepth)
1838 Controller->DriverQueueDepth = DAC960_MaxDriverQueueDepth;
1839 Controller->LogicalDriveCount = ControllerInfo->LogicalDevicesPresent;
1840 Controller->MaxBlocksPerCommand =
1842 Controller->ControllerScatterGatherLimit =
1844 Controller->DriverScatterGatherLimit =
1845 Controller->ControllerScatterGatherLimit;
1846 if (Controller->DriverScatterGatherLimit > DAC960_V2_ScatterGatherLimit)
1847 Controller->DriverScatterGatherLimit = DAC960_V2_ScatterGatherLimit;
1854 Controller->V2.NewLogicalDeviceInformation;
1858 if (!DAC960_V2_NewLogicalDeviceInfo(Controller, LogicalDeviceNumber))
1863 Controller, LogicalDeviceNumber);
1868 Controller, NewLogicalDeviceInfo->DeviceBlockSizeInBytes);
1872 PhysicalDevice.Controller = 0;
1876 Controller->V2.LogicalDriveToVirtualDevice[LogicalDeviceNumber] =
1880 Controller->LogicalDriveInitiallyAccessible[LogicalDeviceNumber] = true;
1884 return DAC960_Failure(Controller, "LOGICAL DEVICE ALLOCATION");
1885 Controller->V2.LogicalDeviceInformation[LogicalDeviceNumber] =
1897 for Controller.
1901 *Controller)
1903 DAC960_Info("Configuring Mylex %s PCI RAID Controller\n",
1904 Controller, Controller->ModelName);
1906 Controller, Controller->FirmwareVersion,
1907 Controller->Channels, Controller->MemorySize);
1909 Controller, Controller->Bus,
1910 Controller->Device, Controller->Function);
1911 if (Controller->IO_Address == 0)
1912 DAC960_Info("Unassigned\n", Controller);
1913 else DAC960_Info("0x%X\n", Controller, Controller->IO_Address);
1915 Controller, Controller->PCI_Address,
1916 (unsigned long) Controller->BaseAddress,
1917 Controller->IRQ_Channel);
1918 DAC960_Info(" Controller Queue Depth: %d, "
1920 Controller, Controller->ControllerQueueDepth,
1921 Controller->MaxBlocksPerCommand);
1924 Controller, Controller->DriverQueueDepth,
1925 Controller->DriverScatterGatherLimit,
1926 Controller->ControllerScatterGatherLimit);
1927 if (Controller->FirmwareType == DAC960_V1_Controller)
1930 "BIOS Geometry: %d/%d\n", Controller,
1931 Controller->V1.StripeSize,
1932 Controller->V1.SegmentSize,
1933 Controller->V1.GeometryTranslationHeads,
1934 Controller->V1.GeometryTranslationSectors);
1935 if (Controller->V1.SAFTE_EnclosureManagementEnabled)
1936 DAC960_Info(" SAF-TE Enclosure Management Enabled\n", Controller);
1946 Controller.
1950 *Controller)
1967 if (!init_dma_loaf(Controller->PCIDevice, &local_dma,
1971 return DAC960_Failure(Controller,
1974 for (Channel = 0; Channel < Controller->Channels; Channel++) {
1985 for (TargetID = 0; TargetID < Controller->Targets; TargetID++)
1993 for (Channel = 0; Channel < Controller->Channels; Channel++)
1998 DAC960_Command_T *Command = Controller->Commands[Channel];
2026 spin_lock_irqsave(&Controller->queue_lock, flags);
2028 spin_unlock_irqrestore(&Controller->queue_lock, flags);
2035 for (Channel = 0; Channel < Controller->Channels; Channel++)
2038 &Controller->V1.InquiryStandardData[Channel][TargetID];
2045 &Controller->V1.InquiryUnitSerialNumber[Channel][TargetID];
2046 DAC960_Command_T *Command = Controller->Commands[Channel];
2071 spin_lock_irqsave(&Controller->queue_lock, flags);
2073 spin_unlock_irqrestore(&Controller->queue_lock, flags);
2085 free_dma_loaf(Controller->PCIDevice, &local_dma);
2094 device connected to Controller.
2098 *Controller)
2106 Controller->V2.NewPhysicalDeviceInformation;
2109 Controller->V2.NewInquiryUnitSerialNumber;
2112 if (!DAC960_V2_NewPhysicalDeviceInfo(Controller, Channel, TargetID, LogicalUnit))
2118 return DAC960_Failure(Controller, "PHYSICAL DEVICE ALLOCATION");
2119 Controller->V2.PhysicalDeviceInformation[PhysicalDeviceIndex] =
2128 return DAC960_Failure(Controller, "SERIAL NUMBER ALLOCATION");
2130 Controller->V2.InquiryUnitSerialNumber[PhysicalDeviceIndex] =
2143 if (!DAC960_V2_NewInquiryUnitSerialNumber(Controller, Channel, TargetID, LogicalUnit)) {
2222 *Controller)
2225 DAC960_Info(" Physical Devices:\n", Controller);
2226 for (Channel = 0; Channel < Controller->Channels; Channel++)
2227 for (TargetID = 0; TargetID < Controller->Targets; TargetID++)
2230 &Controller->V1.InquiryStandardData[Channel][TargetID];
2232 &Controller->V1.InquiryUnitSerialNumber[Channel][TargetID];
2234 &Controller->V1.DeviceState[Channel][TargetID];
2236 &Controller->V1.ErrorTable.ErrorTableEntries[Channel][TargetID];
2246 Controller, Channel, TargetID, (TargetID < 10 ? " " : ""),
2249 DAC960_Info(" Serial Number: %s\n", Controller, SerialNumber);
2253 if (Controller->V1.DeviceResetCount[Channel][TargetID] > 0)
2255 Controller,
2265 Controller->V1.DeviceResetCount[Channel][TargetID]);
2267 DAC960_Info(" Disk Status: %s, %u blocks\n", Controller,
2283 "Hard: %d, Misc: %d\n", Controller,
2289 DAC960_Info(" Logical Drives:\n", Controller);
2291 LogicalDriveNumber < Controller->LogicalDriveCount;
2295 &Controller->V1.LogicalDriveInformation[LogicalDriveNumber];
2297 Controller, Controller->ControllerNumber, LogicalDriveNumber,
2319 *Controller)
2322 DAC960_Info(" Physical Devices:\n", Controller);
2328 Controller->V2.PhysicalDeviceInformation[PhysicalDeviceIndex];
2332 Controller->V2.InquiryUnitSerialNumber[PhysicalDeviceIndex];
2341 Controller,
2347 DAC960_Info(" %sAsynchronous\n", Controller,
2351 DAC960_Info(" %sSynchronous at %d MB/sec\n", Controller,
2357 DAC960_Info(" Serial Number: %s\n", Controller, SerialNumber);
2361 DAC960_Info(" Disk Status: %s, %u blocks\n", Controller,
2397 "Hard: %d, Misc: %d\n", Controller,
2403 "Aborts: %d, Predicted: %d\n", Controller,
2409 DAC960_Info(" Logical Drives:\n", Controller);
2415 Controller->V2.LogicalDeviceInformation[LogicalDriveNumber];
2439 Controller, LogicalDeviceInfo->DriveGeometry);
2443 Controller, Controller->ControllerNumber, LogicalDriveNumber,
2453 Controller,
2462 "Segment Size: N/A\n", Controller);
2465 "Segment Size: %dKB\n", Controller,
2472 "Segment Size: N/A\n", Controller,
2476 "Segment Size: %dKB\n", Controller,
2480 DAC960_Info(" %s, %s\n", Controller,
2489 "Deferred Write: %d\n", Controller,
2500 associated with Controller.
2503 static bool DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller)
2505 int MajorNumber = DAC960_MAJOR + Controller->ControllerNumber;
2509 Register the Block Device Major Number for this DAC960 Controller.
2515 struct gendisk *disk = Controller->disks[n];
2519 RequestQueue = blk_init_queue(DAC960_RequestFunction,&Controller->queue_lock);
2524 Controller->RequestQueue[n] = RequestQueue;
2525 blk_queue_bounce_limit(RequestQueue, Controller->BounceBufferLimit);
2526 RequestQueue->queuedata = Controller;
2527 blk_queue_max_hw_segments(RequestQueue, Controller->DriverScatterGatherLimit);
2528 blk_queue_max_phys_segments(RequestQueue, Controller->DriverScatterGatherLimit);
2529 blk_queue_max_sectors(RequestQueue, Controller->MaxBlocksPerCommand);
2531 sprintf(disk->disk_name, "rd/c%dd%d", Controller->ControllerNumber, n);
2545 associated with Controller.
2548 static void DAC960_UnregisterBlockDevice(DAC960_Controller_T *Controller)
2550 int MajorNumber = DAC960_MAJOR + Controller->ControllerNumber;
2555 del_gendisk(Controller->disks[disk]);
2556 blk_cleanup_queue(Controller->RequestQueue[disk]);
2557 Controller->RequestQueue[disk] = NULL;
2561 Unregister the Block Device Major Number for this DAC960 Controller.
2571 static void DAC960_ComputeGenericDiskInfo(DAC960_Controller_T *Controller)
2575 set_capacity(Controller->disks[disk], disk_size(Controller, disk));
2579 DAC960_ReportErrorStatus reports Controller BIOS Messages passed through
2584 static bool DAC960_ReportErrorStatus(DAC960_Controller_T *Controller,
2593 Controller, Parameter1, Parameter0);
2596 if (Controller->DriveSpinUpMessageDisplayed) break;
2597 DAC960_Notice("Spinning Up Drives\n", Controller);
2598 Controller->DriveSpinUpMessageDisplayed = true;
2601 DAC960_Notice("Configuration Checksum Error\n", Controller);
2604 DAC960_Notice("Mirror Race Recovery Failed\n", Controller);
2607 DAC960_Notice("Mirror Race Recovery In Progress\n", Controller);
2611 Controller, Parameter1, Parameter0);
2614 DAC960_Notice("Logical Drive Installation Aborted\n", Controller);
2617 DAC960_Notice("Mirror Race On A Critical Logical Drive\n", Controller);
2620 DAC960_Notice("New Controller Configuration Found\n", Controller);
2623 DAC960_Error("Fatal Memory Parity Error for Controller at\n", Controller);
2626 DAC960_Error("Unknown Initialization Error %02X for Controller at\n",
2627 Controller, ErrorStatus);
2643 static void DAC960_DetectCleanup(DAC960_Controller_T *Controller)
2648 free_dma_loaf(Controller->PCIDevice, &Controller->DmaPages);
2649 if (Controller->MemoryMappedAddress) {
2650 switch(Controller->HardwareType)
2653 DAC960_GEM_DisableInterrupts(Controller->BaseAddress);
2656 DAC960_BA_DisableInterrupts(Controller->BaseAddress);
2659 DAC960_LP_DisableInterrupts(Controller->BaseAddress);
2662 DAC960_LA_DisableInterrupts(Controller->BaseAddress);
2665 DAC960_PG_DisableInterrupts(Controller->BaseAddress);
2668 DAC960_PD_DisableInterrupts(Controller->BaseAddress);
2671 DAC960_PD_DisableInterrupts(Controller->BaseAddress);
2674 iounmap(Controller->MemoryMappedAddress);
2676 if (Controller->IRQ_Channel)
2677 free_irq(Controller->IRQ_Channel, Controller);
2678 if (Controller->IO_Address)
2679 release_region(Controller->IO_Address, 0x80);
2680 pci_disable_device(Controller->PCIDevice);
2681 for (i = 0; (i < DAC960_MaxLogicalDrives) && Controller->disks[i]; i++)
2682 put_disk(Controller->disks[i]);
2683 DAC960_Controllers[Controller->ControllerNumber] = NULL;
2684 kfree(Controller);
2691 Controller Type.
2702 DAC960_Controller_T *Controller = NULL;
2709 Controller = kzalloc(sizeof(DAC960_Controller_T), GFP_ATOMIC);
2710 if (Controller == NULL) {
2711 DAC960_Error("Unable to allocate Controller structure for "
2712 "Controller at\n", NULL);
2715 Controller->ControllerNumber = DAC960_ControllerCount;
2716 DAC960_Controllers[DAC960_ControllerCount++] = Controller;
2717 Controller->Bus = PCI_Device->bus->number;
2718 Controller->FirmwareType = privdata->FirmwareType;
2719 Controller->HardwareType = privdata->HardwareType;
2720 Controller->Device = DeviceFunction >> 3;
2721 Controller->Function = DeviceFunction & 0x7;
2722 Controller->PCIDevice = PCI_Device;
2723 strcpy(Controller->FullModelName, "DAC960");
2728 switch (Controller->HardwareType)
2731 Controller->PCI_Address = pci_resource_start(PCI_Device, 0);
2734 Controller->PCI_Address = pci_resource_start(PCI_Device, 0);
2737 Controller->PCI_Address = pci_resource_start(PCI_Device, 0);
2740 Controller->PCI_Address = pci_resource_start(PCI_Device, 0);
2743 Controller->PCI_Address = pci_resource_start(PCI_Device, 0);
2746 Controller->IO_Address = pci_resource_start(PCI_Device, 0);
2747 Controller->PCI_Address = pci_resource_start(PCI_Device, 1);
2750 Controller->IO_Address = pci_resource_start(PCI_Device, 0);
2751 Controller->PCI_Address = pci_resource_start(PCI_Device, 1);
2755 pci_set_drvdata(PCI_Device, (void *)((long)Controller->ControllerNumber));
2757 Controller->disks[i] = alloc_disk(1<<DAC960_MaxPartitionsBits);
2758 if (!Controller->disks[i])
2760 Controller->disks[i]->private_data = (void *)((long)i);
2762 init_waitqueue_head(&Controller->CommandWaitQueue);
2763 init_waitqueue_head(&Controller->HealthStatusWaitQueue);
2764 spin_lock_init(&Controller->queue_lock);
2765 DAC960_AnnounceDriver(Controller);
2767 Map the Controller Register Window.
2771 Controller->MemoryMappedAddress =
2772 ioremap_nocache(Controller->PCI_Address & PAGE_MASK, MemoryWindowSize);
2773 Controller->BaseAddress =
2774 Controller->MemoryMappedAddress + (Controller->PCI_Address & ~PAGE_MASK);
2775 if (Controller->MemoryMappedAddress == NULL)
2777 DAC960_Error("Unable to map Controller Register Window for "
2778 "Controller at\n", Controller);
2781 BaseAddress = Controller->BaseAddress;
2782 switch (Controller->HardwareType)
2792 DAC960_ReportErrorStatus(Controller, ErrorStatus,
2797 if (!DAC960_V2_EnableMemoryMailboxInterface(Controller))
2800 "for Controller at\n", Controller);
2804 Controller->QueueCommand = DAC960_GEM_QueueCommand;
2805 Controller->ReadControllerConfiguration =
2807 Controller->ReadDeviceConfiguration =
2809 Controller->ReportDeviceConfiguration =
2811 Controller->QueueReadWriteCommand =
2822 DAC960_ReportErrorStatus(Controller, ErrorStatus,
2827 if (!DAC960_V2_EnableMemoryMailboxInterface(Controller))
2830 "for Controller at\n", Controller);
2834 Controller->QueueCommand = DAC960_BA_QueueCommand;
2835 Controller->ReadControllerConfiguration =
2837 Controller->ReadDeviceConfiguration =
2839 Controller->ReportDeviceConfiguration =
2841 Controller->QueueReadWriteCommand =
2852 DAC960_ReportErrorStatus(Controller, ErrorStatus,
2857 if (!DAC960_V2_EnableMemoryMailboxInterface(Controller))
2860 "for Controller at\n", Controller);
2864 Controller->QueueCommand = DAC960_LP_QueueCommand;
2865 Controller->ReadControllerConfiguration =
2867 Controller->ReadDeviceConfiguration =
2869 Controller->ReportDeviceConfiguration =
2871 Controller->QueueReadWriteCommand =
2882 DAC960_ReportErrorStatus(Controller, ErrorStatus,
2887 if (!DAC960_V1_EnableMemoryMailboxInterface(Controller))
2890 "for Controller at\n", Controller);
2894 if (Controller->V1.DualModeMemoryMailboxInterface)
2895 Controller->QueueCommand = DAC960_LA_QueueCommandDualMode;
2896 else Controller->QueueCommand = DAC960_LA_QueueCommandSingleMode;
2897 Controller->ReadControllerConfiguration =
2899 Controller->ReadDeviceConfiguration =
2901 Controller->ReportDeviceConfiguration =
2903 Controller->QueueReadWriteCommand =
2914 DAC960_ReportErrorStatus(Controller, ErrorStatus,
2919 if (!DAC960_V1_EnableMemoryMailboxInterface(Controller))
2922 "for Controller at\n", Controller);
2926 if (Controller->V1.DualModeMemoryMailboxInterface)
2927 Controller->QueueCommand = DAC960_PG_QueueCommandDualMode;
2928 else Controller->QueueCommand = DAC960_PG_QueueCommandSingleMode;
2929 Controller->ReadControllerConfiguration =
2931 Controller->ReadDeviceConfiguration =
2933 Controller->ReportDeviceConfiguration =
2935 Controller->QueueReadWriteCommand =
2939 if (!request_region(Controller->IO_Address, 0x80,
2940 Controller->FullModelName)) {
2941 DAC960_Error("IO port 0x%d busy for Controller at\n",
2942 Controller, Controller->IO_Address);
2952 DAC960_ReportErrorStatus(Controller, ErrorStatus,
2957 if (!DAC960_V1_EnableMemoryMailboxInterface(Controller))
2960 "for Controller at\n", Controller);
2964 Controller->QueueCommand = DAC960_PD_QueueCommand;
2965 Controller->ReadControllerConfiguration =
2967 Controller->ReadDeviceConfiguration =
2969 Controller->ReportDeviceConfiguration =
2971 Controller->QueueReadWriteCommand =
2975 if (!request_region(Controller->IO_Address, 0x80,
2976 Controller->FullModelName)){
2977 DAC960_Error("IO port 0x%d busy for Controller at\n",
2978 Controller, Controller->IO_Address);
2988 DAC960_ReportErrorStatus(Controller, ErrorStatus,
2993 if (!DAC960_V1_EnableMemoryMailboxInterface(Controller))
2996 "for Controller at\n", Controller);
3000 Controller->QueueCommand = DAC960_P_QueueCommand;
3001 Controller->ReadControllerConfiguration =
3003 Controller->ReadDeviceConfiguration =
3005 Controller->ReportDeviceConfiguration =
3007 Controller->QueueReadWriteCommand =
3016 Controller->FullModelName, Controller) < 0)
3018 DAC960_Error("Unable to acquire IRQ Channel %d for Controller at\n",
3019 Controller, Controller->IRQ_Channel);
3022 Controller->IRQ_Channel = IRQ_Channel;
3023 Controller->InitialCommand.CommandIdentifier = 1;
3024 Controller->InitialCommand.Controller = Controller;
3025 Controller->Commands[0] = &Controller->InitialCommand;
3026 Controller->FreeCommands = &Controller->InitialCommand;
3027 return Controller;
3030 if (Controller->IO_Address == 0)
3032 "PCI Address 0x%X\n", Controller,
3033 Controller->Bus, Controller->Device,
3034 Controller->Function, Controller->PCI_Address);
3037 "0x%X PCI Address 0x%X\n", Controller,
3038 Controller->Bus, Controller->Device,
3039 Controller->Function, Controller->IO_Address,
3040 Controller->PCI_Address);
3041 DAC960_DetectCleanup(Controller);
3047 DAC960_InitializeController initializes Controller.
3051 DAC960_InitializeController(DAC960_Controller_T *Controller)
3053 if (DAC960_ReadControllerConfiguration(Controller) &&
3054 DAC960_ReportControllerConfiguration(Controller) &&
3055 DAC960_CreateAuxiliaryStructures(Controller) &&
3056 DAC960_ReadDeviceConfiguration(Controller) &&
3057 DAC960_ReportDeviceConfiguration(Controller) &&
3058 DAC960_RegisterBlockDevice(Controller))
3063 init_timer(&Controller->MonitoringTimer);
3064 Controller->MonitoringTimer.expires =
3066 Controller->MonitoringTimer.data = (unsigned long) Controller;
3067 Controller->MonitoringTimer.function = DAC960_MonitoringTimerFunction;
3068 add_timer(&Controller->MonitoringTimer);
3069 Controller->ControllerInitialized = true;
3077 DAC960_FinalizeController finalizes Controller.
3080 static void DAC960_FinalizeController(DAC960_Controller_T *Controller)
3082 if (Controller->ControllerInitialized)
3103 spin_lock_irqsave(&Controller->queue_lock, flags);
3104 Controller->ShutdownMonitoringTimer = 1;
3105 spin_unlock_irqrestore(&Controller->queue_lock, flags);
3107 del_timer_sync(&Controller->MonitoringTimer);
3108 if (Controller->FirmwareType == DAC960_V1_Controller)
3110 DAC960_Notice("Flushing Cache...", Controller);
3111 DAC960_V1_ExecuteType3(Controller, DAC960_V1_Flush, 0);
3112 DAC960_Notice("done\n", Controller);
3114 if (Controller->HardwareType == DAC960_PD_Controller)
3115 release_region(Controller->IO_Address, 0x80);
3119 DAC960_Notice("Flushing Cache...", Controller);
3120 DAC960_V2_DeviceOperation(Controller, DAC960_V2_PauseDevice,
3122 DAC960_Notice("done\n", Controller);
3125 DAC960_UnregisterBlockDevice(Controller);
3126 DAC960_DestroyAuxiliaryStructures(Controller);
3127 DAC960_DestroyProcEntries(Controller);
3128 DAC960_DetectCleanup(Controller);
3141 DAC960_Controller_T *Controller;
3146 "ignoring from Controller at\n",
3151 Controller = DAC960_DetectController(dev, entry);
3152 if (!Controller)
3155 if (!DAC960_InitializeController(Controller)) {
3156 DAC960_FinalizeController(Controller);
3161 set_capacity(Controller->disks[disk], disk_size(Controller, disk));
3162 add_disk(Controller->disks[disk]);
3164 DAC960_CreateProcEntries(Controller);
3176 DAC960_Controller_T *Controller = DAC960_Controllers[Controller_Number];
3177 if (Controller != NULL)
3178 DAC960_FinalizeController(Controller);
3189 DAC960_Controller_T *Controller = Command->Controller;
3244 DAC960_Controller_T *Controller = Command->Controller;
3257 Controller->V2.LogicalDriveToVirtualDevice[Command->LogicalDriveNumber];
3311 static int DAC960_process_queue(DAC960_Controller_T *Controller, struct request_queue *req_q)
3321 Command = DAC960_AllocateCommand(Controller);
3341 Command->SegmentCount = pci_map_sg(Controller->PCIDevice, Command->cmd_sglist,
3349 DAC960_ProcessRequest attempts to remove one I/O Request from Controller's
3350 I/O Request Queue and queues it to the Controller. WaitForCommand is true if
3402 DAC960_Controller_T *Controller = Command->Controller;
3404 struct request_queue *req_q = Controller->RequestQueue[Command->LogicalDriveNumber];
3419 (void)pci_map_sg(Controller->PCIDevice, Command->cmd_sglist, 1, Command->DmaDirection);
3457 pci_unmap_sg(Command->Controller->PCIDevice, Command->cmd_sglist,
3480 DAC960_Controller_T *Controller = Command->Controller;
3501 Controller, CommandName);
3505 Controller, CommandName);
3509 "on %s:\n", Controller, CommandName);
3512 DAC960_Error("Bad Data Encountered on %s:\n", Controller, CommandName);
3516 Controller, Command->V1.CommandStatus, CommandName);
3520 Controller, Controller->ControllerNumber,
3533 DAC960_Controller_T *Controller = Command->Controller;
3605 if (Controller->ShutdownMonitoringTimer)
3609 DAC960_V1_Enquiry_T *OldEnquiry = &Controller->V1.Enquiry;
3610 DAC960_V1_Enquiry_T *NewEnquiry = Controller->V1.NewEnquiry;
3615 if (NewEnquiry->NumberOfLogicalDrives > Controller->LogicalDriveCount)
3617 int LogicalDriveNumber = Controller->LogicalDriveCount - 1;
3620 "Now Exists\n", Controller,
3622 Controller->ControllerNumber,
3624 Controller->LogicalDriveCount = NewEnquiry->NumberOfLogicalDrives;
3625 DAC960_ComputeGenericDiskInfo(Controller);
3627 if (NewEnquiry->NumberOfLogicalDrives < Controller->LogicalDriveCount)
3630 while (++LogicalDriveNumber < Controller->LogicalDriveCount)
3632 "No Longer Exists\n", Controller,
3634 Controller->ControllerNumber,
3636 Controller->LogicalDriveCount = NewEnquiry->NumberOfLogicalDrives;
3637 DAC960_ComputeGenericDiskInfo(Controller);
3641 DAC960_Critical("Deferred Write Error Flag is now %s\n", Controller,
3654 Controller->MonitoringTimerCount == 0 ||
3655 time_after_eq(jiffies, Controller->SecondaryMonitoringTime
3658 Controller->V1.NeedLogicalDriveInformation = true;
3659 Controller->V1.NewEventLogSequenceNumber =
3661 Controller->V1.NeedErrorTableInformation = true;
3662 Controller->V1.NeedDeviceStateInformation = true;
3663 Controller->V1.StartDeviceStateScan = true;
3664 Controller->V1.NeedBackgroundInitializationStatus =
3665 Controller->V1.BackgroundInitializationStatusSupported;
3666 Controller->SecondaryMonitoringTime = jiffies;
3674 Controller->V1.NeedRebuildProgress = true;
3675 Controller->V1.RebuildProgressFirst =
3684 Controller);
3690 Controller->V1.NeedConsistencyCheckProgress = true;
3694 Controller);
3698 "Physical Device Failed\n", Controller);
3702 "Logical Drive Failed\n", Controller);
3706 Controller);
3710 Controller);
3715 Controller->V1.NeedConsistencyCheckProgress = true;
3716 Controller->MonitoringAlertMode =
3722 Controller->V1.PendingRebuildFlag = NewEnquiry->RebuildFlag;
3723 Controller->V1.RebuildFlagPending = true;
3725 memcpy(&Controller->V1.Enquiry, &Controller->V1.NewEnquiry,
3746 Controller->V1.EventLogEntry;
3748 Controller->V1.OldEventLogSequenceNumber)
3759 DAC960_Critical("Physical Device %d:%d %s\n", Controller,
3767 if (Controller->MonitoringTimerCount > 0)
3768 Controller->V1.DeviceResetCount[EventLogEntry->Channel]
3779 Controller,
3788 Controller,
3801 Controller->V1.OldEventLogSequenceNumber++;
3805 DAC960_V1_ErrorTable_T *OldErrorTable = &Controller->V1.ErrorTable;
3806 DAC960_V1_ErrorTable_T *NewErrorTable = Controller->V1.NewErrorTable;
3808 for (Channel = 0; Channel < Controller->Channels; Channel++)
3809 for (TargetID = 0; TargetID < Controller->Targets; TargetID++)
3826 Controller, Channel, TargetID,
3832 memcpy(&Controller->V1.ErrorTable, Controller->V1.NewErrorTable,
3838 &Controller->V1.DeviceState[Controller->V1.DeviceStateChannel]
3839 [Controller->V1.DeviceStateTargetID];
3841 Controller->V1.NewDeviceState;
3843 DAC960_Critical("Physical Device %d:%d is now %s\n", Controller,
3844 Controller->V1.DeviceStateChannel,
3845 Controller->V1.DeviceStateTargetID,
3858 Controller->V1.NeedDeviceInquiryInformation = true;
3859 Controller->V1.NeedDeviceSerialNumberInformation = true;
3860 Controller->V1.DeviceResetCount
3861 [Controller->V1.DeviceStateChannel]
3862 [Controller->V1.DeviceStateTargetID] = 0;
3871 LogicalDriveNumber < Controller->LogicalDriveCount;
3875 &Controller->V1.LogicalDriveInformation[LogicalDriveNumber];
3877 &(*Controller->V1.NewLogicalDriveInformation)[LogicalDriveNumber];
3881 "is now %s\n", Controller,
3883 Controller->ControllerNumber,
3894 "is now %s\n", Controller,
3896 Controller->ControllerNumber,
3901 memcpy(&Controller->V1.LogicalDriveInformation,
3902 Controller->V1.NewLogicalDriveInformation,
3908 Controller->V1.RebuildProgress->LogicalDriveNumber;
3910 Controller->V1.RebuildProgress->LogicalDriveSize;
3912 LogicalDriveSize - Controller->V1.RebuildProgress->RemainingBlocks;
3914 Controller->V1.LastRebuildStatus == DAC960_V1_NormalCompletion)
3919 Controller->EphemeralProgressMessage = true;
3923 Controller, LogicalDriveNumber,
3924 Controller->ControllerNumber,
3928 Controller->EphemeralProgressMessage = false;
3932 "Logical Drive Failure\n", Controller);
3936 "Bad Blocks on Other Drives\n", Controller);
3940 "Failure of Drive Being Rebuilt\n", Controller);
3945 DAC960_Progress("Rebuild Completed Successfully\n", Controller);
3948 DAC960_Progress("Rebuild Successfully Terminated\n", Controller);
3951 Controller->V1.LastRebuildStatus = CommandStatus;
3953 Controller->V1.RebuildStatusPending)
3955 Command->V1.CommandStatus = Controller->V1.PendingRebuildStatus;
3956 Controller->V1.RebuildStatusPending = false;
3962 Controller->V1.PendingRebuildStatus = CommandStatus;
3963 Controller->V1.RebuildStatusPending = true;
3969 Controller->V1.RebuildProgress->LogicalDriveNumber;
3971 Controller->V1.RebuildProgress->LogicalDriveSize;
3973 LogicalDriveSize - Controller->V1.RebuildProgress->RemainingBlocks;
3976 Controller->EphemeralProgressMessage = true;
3980 Controller, LogicalDriveNumber,
3981 Controller->ControllerNumber,
3985 Controller->EphemeralProgressMessage = false;
3991 Controller->V1.BackgroundInitializationStatus->LogicalDriveNumber;
3993 Controller->V1.BackgroundInitializationStatus->LogicalDriveSize;
3995 Controller->V1.BackgroundInitializationStatus->BlocksCompleted;
3999 switch (Controller->V1.BackgroundInitializationStatus->Status)
4005 Controller);
4009 Controller->V1.LastBackgroundInitializationStatus.
4012 Controller->V1.LastBackgroundInitializationStatus.
4015 Controller->EphemeralProgressMessage = true;
4019 Controller, LogicalDriveNumber,
4020 Controller->ControllerNumber,
4024 Controller->EphemeralProgressMessage = false;
4028 Controller);
4032 Controller);
4035 memcpy(&Controller->V1.LastBackgroundInitializationStatus,
4036 Controller->V1.BackgroundInitializationStatus,
4040 if (Controller->V1.BackgroundInitializationStatus->Status ==
4043 "Completed Successfully\n", Controller);
4044 Controller->V1.BackgroundInitializationStatus->Status =
4048 if (Controller->V1.BackgroundInitializationStatus->Status ==
4051 Controller);
4052 Controller->V1.BackgroundInitializationStatus->Status =
4074 if (Controller->V1.NeedDeviceInquiryInformation)
4077 &Controller->V1.InquiryStandardData
4078 [Controller->V1.DeviceStateChannel]
4079 [Controller->V1.DeviceStateTargetID];
4088 Controller->V1.NewInquiryStandardData,
4090 Controller->V1.NeedDeviceInquiryInformation = false;
4092 else if (Controller->V1.NeedDeviceSerialNumberInformation)
4095 &Controller->V1.InquiryUnitSerialNumber
4096 [Controller->V1.DeviceStateChannel]
4097 [Controller->V1.DeviceStateTargetID];
4106 Controller->V1.NewInquiryUnitSerialNumber,
4108 Controller->V1.NeedDeviceSerialNumberInformation = false;
4114 if (Controller->V1.NewEventLogSequenceNumber
4115 - Controller->V1.OldEventLogSequenceNumber > 0)
4123 Controller->V1.OldEventLogSequenceNumber;
4125 Controller->V1.EventLogEntryDMA;
4129 if (Controller->V1.NeedErrorTableInformation)
4131 Controller->V1.NeedErrorTableInformation = false;
4135 Controller->V1.NewErrorTableDMA;
4139 if (Controller->V1.NeedRebuildProgress &&
4140 Controller->V1.RebuildProgressFirst)
4142 Controller->V1.NeedRebuildProgress = false;
4146 Controller->V1.RebuildProgressDMA;
4150 if (Controller->V1.NeedDeviceStateInformation)
4152 if (Controller->V1.NeedDeviceInquiryInformation)
4154 DAC960_V1_DCDB_T *DCDB = Controller->V1.MonitoringDCDB;
4155 dma_addr_t DCDB_DMA = Controller->V1.MonitoringDCDB_DMA;
4158 Controller->V1.NewInquiryStandardDataDMA;
4162 DCDB->Channel = Controller->V1.DeviceStateChannel;
4163 DCDB->TargetID = Controller->V1.DeviceStateTargetID;
4183 if (Controller->V1.NeedDeviceSerialNumberInformation)
4185 DAC960_V1_DCDB_T *DCDB = Controller->V1.MonitoringDCDB;
4186 dma_addr_t DCDB_DMA = Controller->V1.MonitoringDCDB_DMA;
4188 Controller->V1.NewInquiryUnitSerialNumberDMA;
4192 DCDB->Channel = Controller->V1.DeviceStateChannel;
4193 DCDB->TargetID = Controller->V1.DeviceStateTargetID;
4214 if (Controller->V1.StartDeviceStateScan)
4216 Controller->V1.DeviceStateChannel = 0;
4217 Controller->V1.DeviceStateTargetID = 0;
4218 Controller->V1.StartDeviceStateScan = false;
4220 else if (++Controller->V1.DeviceStateTargetID == Controller->Targets)
4222 Controller->V1.DeviceStateChannel++;
4223 Controller->V1.DeviceStateTargetID = 0;
4225 if (Controller->V1.DeviceStateChannel < Controller->Channels)
4227 Controller->V1.NewDeviceState->DeviceState =
4232 Controller->V1.DeviceStateChannel;
4234 Controller->V1.DeviceStateTargetID;
4236 Controller->V1.NewDeviceStateDMA;
4240 Controller->V1.NeedDeviceStateInformation = false;
4242 if (Controller->V1.NeedLogicalDriveInformation)
4244 Controller->V1.NeedLogicalDriveInformation = false;
4248 Controller->V1.NewLogicalDriveInformationDMA;
4252 if (Controller->V1.NeedRebuildProgress)
4254 Controller->V1.NeedRebuildProgress = false;
4258 Controller->V1.RebuildProgressDMA;
4262 if (Controller->V1.NeedConsistencyCheckProgress)
4264 Controller->V1.NeedConsistencyCheckProgress = false;
4268 Controller->V1.RebuildProgressDMA;
4272 if (Controller->V1.NeedBackgroundInitializationStatus)
4274 Controller->V1.NeedBackgroundInitializationStatus = false;
4279 Controller->V1.BackgroundInitializationStatusDMA;
4283 Controller->MonitoringTimerCount++;
4284 Controller->MonitoringTimer.expires =
4286 add_timer(&Controller->MonitoringTimer);
4300 Controller->V1.DirectCommandActive[KernelCommand->DCDB->Channel]
4308 Queue a Status Monitoring Command to the Controller using the just
4312 if (Controller->MonitoringCommandDeferred)
4314 Controller->MonitoringCommandDeferred = false;
4325 wake_up(&Controller->CommandWaitQueue);
4336 DAC960_Controller_T *Controller = Command->Controller;
4361 DAC960_Error("Error Condition %s on %s:\n", Controller,
4364 Controller, Controller->ControllerNumber,
4371 DAC960_V2_ReportEvent prints an appropriate message when a Controller Event
4375 static void DAC960_V2_ReportEvent(DAC960_Controller_T *Controller,
4483 /* Controller Events (0x0180 - 0x01FF) */
4496 /* Controller Internal Processor Events */
4497 { 0x0380, "C Internal Controller Hung" },
4498 { 0x0381, "C Internal Controller Firmware Breakpoint" },
4499 { 0x0390, "C Internal Controller i960 Processor Specific Error" },
4500 { 0x03A0, "C Internal Controller StrongARM Processor Specific Error" },
4520 DAC960_Critical("Unknown Controller Event Code %04X\n",
4521 Controller, Event->EventCode);
4527 DAC960_Critical("Physical Device %d:%d %s\n", Controller,
4531 DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) %s\n", Controller,
4532 Event->LogicalUnit, Controller->ControllerNumber,
4536 DAC960_Progress("Logical Drive %d (/dev/rd/c%dd%d) %s\n", Controller,
4537 Event->LogicalUnit, Controller->ControllerNumber,
4547 DAC960_Critical("Physical Device %d:%d %s\n", Controller,
4551 Controller,
4560 Controller,
4573 if (Controller->SuppressEnclosureMessages) break;
4575 DAC960_Critical("Enclosure %d %s\n", Controller,
4579 DAC960_Critical("Controller %s\n", Controller, EventMessage);
4582 DAC960_Critical("Unknown Controller Event Code %04X\n",
4583 Controller, Event->EventCode);
4594 static void DAC960_V2_ReportProgress(DAC960_Controller_T *Controller,
4600 Controller->EphemeralProgressMessage = true;
4602 "%d%% completed\n", Controller,
4605 Controller->ControllerNumber,
4608 Controller->EphemeralProgressMessage = false;
4619 DAC960_Controller_T *Controller = Command->Controller;
4692 if (Controller->ShutdownMonitoringTimer)
4697 Controller->V2.NewControllerInformation;
4699 &Controller->V2.ControllerInformation;
4700 Controller->LogicalDriveCount =
4702 Controller->V2.NeedLogicalDeviceInformation = true;
4703 Controller->V2.NeedPhysicalDeviceInformation = true;
4704 Controller->V2.StartLogicalDeviceInformationScan = true;
4705 Controller->V2.StartPhysicalDeviceInformationScan = true;
4706 Controller->MonitoringAlertMode =
4717 DAC960_V2_ReportEvent(Controller, Controller->V2.Event);
4719 Controller->V2.NextEventSequenceNumber++;
4725 Controller->V2.NewPhysicalDeviceInformation;
4726 unsigned int PhysicalDeviceIndex = Controller->V2.PhysicalDeviceIndex;
4728 Controller->V2.PhysicalDeviceInformation[PhysicalDeviceIndex];
4730 Controller->V2.InquiryUnitSerialNumber[PhysicalDeviceIndex];
4745 Controller,
4748 Controller->V2.PhysicalDeviceInformation
4750 Controller->V2.InquiryUnitSerialNumber
4758 Controller->V2.PhysicalDeviceInformation[DeviceIndex] =
4759 Controller->V2.PhysicalDeviceInformation[DeviceIndex+1];
4760 Controller->V2.InquiryUnitSerialNumber[DeviceIndex] =
4761 Controller->V2.InquiryUnitSerialNumber[DeviceIndex+1];
4763 Controller->V2.PhysicalDeviceInformation
4765 Controller->V2.InquiryUnitSerialNumber
4768 Controller->V2.PhysicalDeviceInformation[PhysicalDeviceIndex];
4770 Controller->V2.InquiryUnitSerialNumber[PhysicalDeviceIndex];
4794 Controller,
4812 Controller->V2.PhysicalDeviceInformation[DeviceIndex] =
4813 Controller->V2.PhysicalDeviceInformation[DeviceIndex-1];
4814 Controller->V2.InquiryUnitSerialNumber[DeviceIndex] =
4815 Controller->V2.InquiryUnitSerialNumber[DeviceIndex-1];
4817 Controller->V2.PhysicalDeviceInformation
4820 Controller->V2.InquiryUnitSerialNumber
4823 Controller->V2.NeedDeviceSerialNumberInformation = true;
4831 "Physical Device %d:%d is now %s\n", Controller,
4878 Controller,
4888 Controller,
4903 Controller->V2.NeedDeviceSerialNumberInformation = true;
4908 Controller->V2.PhysicalDeviceIndex++;
4913 for (DeviceIndex = Controller->V2.PhysicalDeviceIndex;
4918 Controller->V2.PhysicalDeviceInformation[DeviceIndex];
4920 Controller->V2.InquiryUnitSerialNumber[DeviceIndex];
4923 Controller,
4926 Controller->V2.PhysicalDeviceInformation[DeviceIndex] = NULL;
4927 Controller->V2.InquiryUnitSerialNumber[DeviceIndex] = NULL;
4931 Controller->V2.NeedPhysicalDeviceInformation = false;
4937 Controller->V2.NewLogicalDeviceInformation;
4941 Controller->V2.LogicalDeviceInformation[LogicalDeviceNumber];
4945 PhysicalDevice.Controller = 0;
4949 Controller->V2.LogicalDriveToVirtualDevice[LogicalDeviceNumber] =
4953 Controller->V2.LogicalDeviceInformation[LogicalDeviceNumber] =
4956 "Now Exists%s\n", Controller,
4958 Controller->ControllerNumber,
4966 DAC960_ComputeGenericDiskInfo(Controller);
4976 "is now %s\n", Controller,
4978 Controller->ControllerNumber,
4994 Controller, LogicalDeviceNumber,
4995 Controller->ControllerNumber,
5001 DAC960_V2_ReportProgress(Controller,
5008 DAC960_V2_ReportProgress(Controller,
5015 DAC960_V2_ReportProgress(Controller,
5022 DAC960_V2_ReportProgress(Controller,
5029 DAC960_V2_ReportProgress(Controller,
5036 DAC960_V2_ReportProgress(Controller,
5046 Controller,
5048 Controller->ControllerNumber,
5056 Controller->V2.LogicalDriveFoundDuringScan
5068 Controller->V2.LogicalDeviceInformation[LogicalDriveNumber];
5070 Controller->V2.LogicalDriveFoundDuringScan
5074 "No Longer Exists\n", Controller,
5076 Controller->ControllerNumber,
5078 Controller->V2.LogicalDeviceInformation
5081 Controller->LogicalDriveInitiallyAccessible
5083 DAC960_ComputeGenericDiskInfo(Controller);
5085 Controller->V2.NeedLogicalDeviceInformation = false;
5090 Controller->V2.InquiryUnitSerialNumber[Controller->V2.PhysicalDeviceIndex - 1];
5098 Controller->V2.NewInquiryUnitSerialNumber,
5101 Controller->V2.NeedDeviceSerialNumberInformation = false;
5104 if (Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
5105 - Controller->V2.NextEventSequenceNumber > 0)
5110 Controller->V2.NextEventSequenceNumber >> 16;
5115 Controller->V2.NextEventSequenceNumber & 0xFFFF;
5119 Controller->V2.EventDMA;
5127 if (Controller->V2.NeedPhysicalDeviceInformation)
5129 if (Controller->V2.NeedDeviceSerialNumberInformation)
5132 Controller->V2.NewInquiryUnitSerialNumber;
5135 DAC960_V2_ConstructNewUnitSerialNumber(Controller, CommandMailbox,
5136 Controller->V2.NewPhysicalDeviceInformation->Channel,
5137 Controller->V2.NewPhysicalDeviceInformation->TargetID,
5138 Controller->V2.NewPhysicalDeviceInformation->LogicalUnit - 1);
5144 if (Controller->V2.StartPhysicalDeviceInformationScan)
5146 Controller->V2.PhysicalDeviceIndex = 0;
5147 Controller->V2.NewPhysicalDeviceInformation->Channel = 0;
5148 Controller->V2.NewPhysicalDeviceInformation->TargetID = 0;
5149 Controller->V2.NewPhysicalDeviceInformation->LogicalUnit = 0;
5150 Controller->V2.StartPhysicalDeviceInformationScan = false;
5156 Controller->V2.NewPhysicalDeviceInformation->LogicalUnit;
5158 Controller->V2.NewPhysicalDeviceInformation->TargetID;
5160 Controller->V2.NewPhysicalDeviceInformation->Channel;
5166 Controller->V2.NewPhysicalDeviceInformationDMA;
5174 if (Controller->V2.NeedLogicalDeviceInformation)
5176 if (Controller->V2.StartLogicalDeviceInformationScan)
5182 Controller->V2.LogicalDriveFoundDuringScan
5184 Controller->V2.NewLogicalDeviceInformation->LogicalDeviceNumber = 0;
5185 Controller->V2.StartLogicalDeviceInformationScan = false;
5191 Controller->V2.NewLogicalDeviceInformation->LogicalDeviceNumber;
5197 Controller->V2.NewLogicalDeviceInformationDMA;
5205 Controller->MonitoringTimerCount++;
5206 Controller->MonitoringTimer.expires =
5208 add_timer(&Controller->MonitoringTimer);
5228 Queue a Status Monitoring Command to the Controller using the just
5232 if (Controller->MonitoringCommandDeferred)
5234 Controller->MonitoringCommandDeferred = false;
5245 wake_up(&Controller->CommandWaitQueue);
5256 DAC960_Controller_T *Controller = DeviceIdentifier;
5257 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5261 spin_lock_irqsave(&Controller->queue_lock, flags);
5263 NextStatusMailbox = Controller->V2.NextStatusMailbox;
5268 DAC960_Command_T *Command = Controller->Commands[CommandIdentifier-1];
5275 if (++NextStatusMailbox > Controller->V2.LastStatusMailbox)
5276 NextStatusMailbox = Controller->V2.FirstStatusMailbox;
5279 Controller->V2.NextStatusMailbox = NextStatusMailbox;
5281 Attempt to remove additional I/O Requests from the Controller's
5282 I/O Request Queue and queue them to the Controller.
5284 DAC960_ProcessRequest(Controller);
5285 spin_unlock_irqrestore(&Controller->queue_lock, flags);
5297 DAC960_Controller_T *Controller = DeviceIdentifier;
5298 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5302 spin_lock_irqsave(&Controller->queue_lock, flags);
5304 NextStatusMailbox = Controller->V2.NextStatusMailbox;
5309 DAC960_Command_T *Command = Controller->Commands[CommandIdentifier-1];
5316 if (++NextStatusMailbox > Controller->V2.LastStatusMailbox)
5317 NextStatusMailbox = Controller->V2.FirstStatusMailbox;
5320 Controller->V2.NextStatusMailbox = NextStatusMailbox;
5322 Attempt to remove additional I/O Requests from the Controller's
5323 I/O Request Queue and queue them to the Controller.
5325 DAC960_ProcessRequest(Controller);
5326 spin_unlock_irqrestore(&Controller->queue_lock, flags);
5339 DAC960_Controller_T *Controller = DeviceIdentifier;
5340 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5344 spin_lock_irqsave(&Controller->queue_lock, flags);
5346 NextStatusMailbox = Controller->V2.NextStatusMailbox;
5351 DAC960_Command_T *Command = Controller->Commands[CommandIdentifier-1];
5358 if (++NextStatusMailbox > Controller->V2.LastStatusMailbox)
5359 NextStatusMailbox = Controller->V2.FirstStatusMailbox;
5362 Controller->V2.NextStatusMailbox = NextStatusMailbox;
5364 Attempt to remove additional I/O Requests from the Controller's
5365 I/O Request Queue and queue them to the Controller.
5367 DAC960_ProcessRequest(Controller);
5368 spin_unlock_irqrestore(&Controller->queue_lock, flags);
5381 DAC960_Controller_T *Controller = DeviceIdentifier;
5382 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5386 spin_lock_irqsave(&Controller->queue_lock, flags);
5388 NextStatusMailbox = Controller->V1.NextStatusMailbox;
5393 DAC960_Command_T *Command = Controller->Commands[CommandIdentifier-1];
5396 if (++NextStatusMailbox > Controller->V1.LastStatusMailbox)
5397 NextStatusMailbox = Controller->V1.FirstStatusMailbox;
5400 Controller->V1.NextStatusMailbox = NextStatusMailbox;
5402 Attempt to remove additional I/O Requests from the Controller's
5403 I/O Request Queue and queue them to the Controller.
5405 DAC960_ProcessRequest(Controller);
5406 spin_unlock_irqrestore(&Controller->queue_lock, flags);
5419 DAC960_Controller_T *Controller = DeviceIdentifier;
5420 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5424 spin_lock_irqsave(&Controller->queue_lock, flags);
5426 NextStatusMailbox = Controller->V1.NextStatusMailbox;
5431 DAC960_Command_T *Command = Controller->Commands[CommandIdentifier-1];
5434 if (++NextStatusMailbox > Controller->V1.LastStatusMailbox)
5435 NextStatusMailbox = Controller->V1.FirstStatusMailbox;
5438 Controller->V1.NextStatusMailbox = NextStatusMailbox;
5440 Attempt to remove additional I/O Requests from the Controller's
5441 I/O Request Queue and queue them to the Controller.
5443 DAC960_ProcessRequest(Controller);
5444 spin_unlock_irqrestore(&Controller->queue_lock, flags);
5457 DAC960_Controller_T *Controller = DeviceIdentifier;
5458 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5461 spin_lock_irqsave(&Controller->queue_lock, flags);
5466 DAC960_Command_T *Command = Controller->Commands[CommandIdentifier-1];
5474 Attempt to remove additional I/O Requests from the Controller's
5475 I/O Request Queue and queue them to the Controller.
5477 DAC960_ProcessRequest(Controller);
5478 spin_unlock_irqrestore(&Controller->queue_lock, flags);
5495 DAC960_Controller_T *Controller = DeviceIdentifier;
5496 void __iomem *ControllerBaseAddress = Controller->BaseAddress;
5499 spin_lock_irqsave(&Controller->queue_lock, flags);
5504 DAC960_Command_T *Command = Controller->Commands[CommandIdentifier-1];
5516 DAC960_P_To_PD_TranslateEnquiry(Controller->V1.NewEnquiry);
5521 DAC960_P_To_PD_TranslateDeviceState(Controller->V1.NewDeviceState);
5547 Attempt to remove additional I/O Requests from the Controller's
5548 I/O Request Queue and queue them to the Controller.
5550 DAC960_ProcessRequest(Controller);
5551 spin_unlock_irqrestore(&Controller->queue_lock, flags);
5563 DAC960_Controller_T *Controller = Command->Controller;
5568 CommandMailbox->Type3.BusAddress = Controller->V1.NewEnquiryDMA;
5580 DAC960_Controller_T *Controller = Command->Controller;
5596 Controller->V2.NewControllerInformationDMA;
5612 DAC960_Controller_T *Controller = (DAC960_Controller_T *) TimerData;
5616 if (Controller->FirmwareType == DAC960_V1_Controller)
5618 spin_lock_irqsave(&Controller->queue_lock, flags);
5620 Queue a Status Monitoring Command to Controller.
5622 Command = DAC960_AllocateCommand(Controller);
5625 else Controller->MonitoringCommandDeferred = true;
5626 spin_unlock_irqrestore(&Controller->queue_lock, flags);
5631 &Controller->V2.ControllerInformation;
5633 Controller->V2.HealthStatusBuffer->StatusChangeCounter;
5635 if (time_after(jiffies, Controller->SecondaryMonitoringTime
5644 Controller->V2.LogicalDeviceInformation[LogicalDriveNumber];
5653 Controller->SecondaryMonitoringTime = jiffies;
5655 if (StatusChangeCounter == Controller->V2.StatusChangeCounter &&
5656 Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
5657 == Controller->V2.NextEventSequenceNumber &&
5664 time_before(jiffies, Controller->PrimaryMonitoringTime
5668 Controller->MonitoringTimer.expires =
5670 add_timer(&Controller->MonitoringTimer);
5673 Controller->V2.StatusChangeCounter = StatusChangeCounter;
5674 Controller->PrimaryMonitoringTime = jiffies;
5676 spin_lock_irqsave(&Controller->queue_lock, flags);
5678 Queue a Status Monitoring Command to Controller.
5680 Command = DAC960_AllocateCommand(Controller);
5683 else Controller->MonitoringCommandDeferred = true;
5684 spin_unlock_irqrestore(&Controller->queue_lock, flags);
5688 wake_up(&Controller->HealthStatusWaitQueue);
5698 static bool DAC960_CheckStatusBuffer(DAC960_Controller_T *Controller,
5702 if (Controller->InitialStatusLength + 1 +
5703 Controller->CurrentStatusLength + ByteCount + 1 <=
5704 Controller->CombinedStatusBufferLength)
5706 if (Controller->CombinedStatusBufferLength == 0)
5711 Controller->CombinedStatusBuffer = kmalloc(NewStatusBufferLength,
5713 if (Controller->CombinedStatusBuffer == NULL) return false;
5714 Controller->CombinedStatusBufferLength = NewStatusBufferLength;
5717 NewStatusBuffer = kmalloc(2 * Controller->CombinedStatusBufferLength,
5722 Controller);
5725 memcpy(NewStatusBuffer, Controller->CombinedStatusBuffer,
5726 Controller->CombinedStatusBufferLength);
5727 kfree(Controller->CombinedStatusBuffer);
5728 Controller->CombinedStatusBuffer = NewStatusBuffer;
5729 Controller->CombinedStatusBufferLength *= 2;
5730 Controller->CurrentStatusBuffer =
5731 &NewStatusBuffer[Controller->InitialStatusLength + 1];
5742 DAC960_Controller_T *Controller,
5749 va_start(Arguments, Controller);
5752 if (Controller == NULL)
5758 if (!Controller->ControllerInitialized)
5760 if (DAC960_CheckStatusBuffer(Controller, Length))
5762 strcpy(&Controller->CombinedStatusBuffer
5763 [Controller->InitialStatusLength],
5765 Controller->InitialStatusLength += Length;
5766 Controller->CurrentStatusBuffer =
5767 &Controller->CombinedStatusBuffer
5768 [Controller->InitialStatusLength + 1];
5784 Controller->ControllerNumber, Buffer);
5789 else if (DAC960_CheckStatusBuffer(Controller, Length))
5791 strcpy(&Controller->CurrentStatusBuffer[
5792 Controller->CurrentStatusLength], Buffer);
5793 Controller->CurrentStatusLength += Length;
5798 strcpy(Controller->ProgressBuffer, Buffer);
5799 Controller->ProgressBufferLength = Length;
5800 if (Controller->EphemeralProgressMessage)
5802 if (time_after_eq(jiffies, Controller->LastProgressReportTime
5806 Controller->ControllerNumber, Buffer);
5807 Controller->LastProgressReportTime = jiffies;
5811 Controller->ControllerNumber, Buffer);
5815 strcpy(&Controller->UserStatusBuffer[Controller->UserStatusLength],
5817 Controller->UserStatusLength += Length;
5820 Controller->ControllerNumber, Buffer);
5826 Controller->ControllerNumber, Buffer);
5839 static bool DAC960_ParsePhysicalDevice(DAC960_Controller_T *Controller,
5852 XChannel >= Controller->Channels)
5858 XTargetID >= Controller->Targets)
5872 static bool DAC960_ParseLogicalDrive(DAC960_Controller_T *Controller,
5897 static void DAC960_V1_SetDeviceState(DAC960_Controller_T *Controller,
5915 DAC960_UserCritical("%s of Physical Device %d:%d Succeeded\n", Controller,
5920 "Unable to Start Device\n", Controller,
5925 "No Device at Address\n", Controller,
5931 Controller, DeviceStateString, Channel, TargetID);
5935 "Channel Busy\n", Controller,
5940 "Unexpected Status %04X\n", Controller,
5953 static bool DAC960_V1_ExecuteUserCommand(DAC960_Controller_T *Controller,
5961 spin_lock_irqsave(&Controller->queue_lock, flags);
5962 while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
5963 DAC960_WaitForCommand(Controller);
5964 spin_unlock_irqrestore(&Controller->queue_lock, flags);
5965 Controller->UserStatusLength = 0;
5973 DAC960_UserCritical("Cache Flush Completed\n", Controller);
5976 DAC960_ParsePhysicalDevice(Controller, &UserCommand[4],
5980 &Controller->V1.DeviceState[Channel][TargetID];
5984 DAC960_V1_SetDeviceState(Controller, Command, Channel, TargetID,
5987 Controller, Channel, TargetID);
5990 DAC960_ParsePhysicalDevice(Controller, &UserCommand[11],
5994 &Controller->V1.DeviceState[Channel][TargetID];
5998 DAC960_V1_SetDeviceState(Controller, Command, Channel, TargetID,
6001 Controller, Channel, TargetID);
6005 DAC960_ParsePhysicalDevice(Controller, &UserCommand[12],
6009 &Controller->V1.DeviceState[Channel][TargetID];
6013 DAC960_V1_SetDeviceState(Controller, Command, Channel, TargetID,
6017 Controller, Channel, TargetID);
6020 DAC960_ParsePhysicalDevice(Controller, &UserCommand[7],
6031 Controller, Channel, TargetID);
6037 Controller, Channel, TargetID);
6042 Controller, Channel, TargetID);
6047 Controller, Channel, TargetID);
6052 "in Progress\n", Controller, Channel, TargetID);
6056 "Unexpected Status %04X\n", Controller,
6062 DAC960_ParseLogicalDrive(Controller, &UserCommand[17],
6074 Controller, LogicalDriveNumber,
6075 Controller->ControllerNumber,
6082 Controller, LogicalDriveNumber,
6083 Controller->ControllerNumber,
6090 Controller, LogicalDriveNumber,
6091 Controller->ControllerNumber,
6098 Controller, LogicalDriveNumber,
6099 Controller->ControllerNumber,
6106 Controller, LogicalDriveNumber,
6107 Controller->ControllerNumber,
6122 OldRebuildRateConstant = pci_alloc_consistent( Controller->PCIDevice,
6128 Controller);
6139 Controller);
6145 Controller, Command->V1.CommandStatus);
6149 pci_free_consistent(Controller->PCIDevice, sizeof(char),
6153 Controller, UserCommand);
6155 spin_lock_irqsave(&Controller->queue_lock, flags);
6157 spin_unlock_irqrestore(&Controller->queue_lock, flags);
6175 DAC960_Controller_T *Controller = Command->Controller;
6195 Controller->V2.PhysicalToLogicalDeviceDMA;
6202 *LogicalDeviceNumber = Controller->V2.PhysicalToLogicalDevice->LogicalDeviceNumber;
6215 static bool DAC960_V2_ExecuteUserCommand(DAC960_Controller_T *Controller,
6224 spin_lock_irqsave(&Controller->queue_lock, flags);
6225 while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
6226 DAC960_WaitForCommand(Controller);
6227 spin_unlock_irqrestore(&Controller->queue_lock, flags);
6228 Controller->UserStatusLength = 0;
6241 DAC960_UserCritical("Cache Flush Completed\n", Controller);
6244 DAC960_ParsePhysicalDevice(Controller, &UserCommand[4],
6257 Controller, Channel, TargetID,
6263 DAC960_ParsePhysicalDevice(Controller, &UserCommand[11],
6276 Controller, Channel, TargetID,
6282 DAC960_ParsePhysicalDevice(Controller, &UserCommand[12],
6295 Controller, Channel, TargetID,
6301 DAC960_ParsePhysicalDevice(Controller, &UserCommand[7],
6312 Controller, Channel, TargetID,
6318 DAC960_ParsePhysicalDevice(Controller, &UserCommand[14],
6329 Controller, Channel, TargetID,
6335 DAC960_ParseLogicalDrive(Controller, &UserCommand[17],
6347 Controller, LogicalDriveNumber,
6348 Controller->ControllerNumber,
6355 DAC960_ParseLogicalDrive(Controller, &UserCommand[24],
6365 Controller, LogicalDriveNumber,
6366 Controller->ControllerNumber,
6376 DAC960_UserCritical("Discovery %s\n", Controller,
6399 Controller->V2.NewControllerInformationDMA;
6405 while (Controller->V2.NewControllerInformation->PhysicalScanActive)
6408 sleep_on_timeout(&Controller->CommandWaitQueue, HZ);
6410 DAC960_UserCritical("Discovery Completed\n", Controller);
6414 Controller->SuppressEnclosureMessages = true;
6416 Controller, UserCommand);
6418 spin_lock_irqsave(&Controller->queue_lock, flags);
6420 spin_unlock_irqrestore(&Controller->queue_lock, flags);
6438 DAC960_Controller_T *Controller = DAC960_Controllers[ControllerNumber];
6439 if (Controller == NULL) continue;
6440 if (Controller->MonitoringAlertMode)
6466 DAC960_Controller_T *Controller = (DAC960_Controller_T *) Data;
6467 int BytesAvailable = Controller->InitialStatusLength - Offset;
6475 memcpy(Page, &Controller->CombinedStatusBuffer[Offset], Count);
6487 DAC960_Controller_T *Controller = (DAC960_Controller_T *) Data;
6492 if (jiffies != Controller->LastCurrentStatusTime)
6494 Controller->CurrentStatusLength = 0;
6495 DAC960_AnnounceDriver(Controller);
6496 DAC960_ReportControllerConfiguration(Controller);
6497 DAC960_ReportDeviceConfiguration(Controller);
6498 if (Controller->ProgressBufferLength > 0)
6499 ProgressMessageLength = Controller->ProgressBufferLength;
6500 if (DAC960_CheckStatusBuffer(Controller, 2 + ProgressMessageLength))
6502 unsigned char *CurrentStatusBuffer = Controller->CurrentStatusBuffer;
6503 CurrentStatusBuffer[Controller->CurrentStatusLength++] = ' ';
6504 CurrentStatusBuffer[Controller->CurrentStatusLength++] = ' ';
6505 if (Controller->ProgressBufferLength > 0)
6506 strcpy(&CurrentStatusBuffer[Controller->CurrentStatusLength],
6507 Controller->ProgressBuffer);
6509 strcpy(&CurrentStatusBuffer[Controller->CurrentStatusLength],
6511 Controller->CurrentStatusLength += ProgressMessageLength;
6513 Controller->LastCurrentStatusTime = jiffies;
6515 BytesAvailable = Controller->CurrentStatusLength - Offset;
6523 memcpy(Page, &Controller->CurrentStatusBuffer[Offset], Count);
6535 DAC960_Controller_T *Controller = (DAC960_Controller_T *) Data;
6536 int BytesAvailable = Controller->UserStatusLength - Offset;
6544 memcpy(Page, &Controller->UserStatusBuffer[Offset], Count);
6557 DAC960_Controller_T *Controller = (DAC960_Controller_T *) Data;
6566 if (Controller->FirmwareType == DAC960_V1_Controller)
6567 return (DAC960_V1_ExecuteUserCommand(Controller, CommandBuffer)
6570 return (DAC960_V2_ExecuteUserCommand(Controller, CommandBuffer)
6580 static void DAC960_CreateProcEntries(DAC960_Controller_T *Controller)
6593 sprintf(Controller->ControllerName, "c%d", Controller->ControllerNumber);
6594 ControllerProcEntry = proc_mkdir(Controller->ControllerName,
6597 DAC960_ProcReadInitialStatus, Controller);
6599 DAC960_ProcReadCurrentStatus, Controller);
6603 Controller);
6605 Controller->ControllerProcEntry = ControllerProcEntry;
6614 static void DAC960_DestroyProcEntries(DAC960_Controller_T *Controller)
6616 if (Controller->ControllerProcEntry == NULL)
6618 remove_proc_entry("initial_status", Controller->ControllerProcEntry);
6619 remove_proc_entry("current_status", Controller->ControllerProcEntry);
6620 remove_proc_entry("user_command", Controller->ControllerProcEntry);
6621 remove_proc_entry(Controller->ControllerName, DAC960_ProcDirectoryEntry);
6622 Controller->ControllerProcEntry = NULL;
6645 DAC960_Controller_T *Controller;
6654 Controller = DAC960_Controllers[ControllerNumber];
6655 if (Controller == NULL) return -ENXIO;
6658 ControllerInfo.FirmwareType = Controller->FirmwareType;
6659 ControllerInfo.Channels = Controller->Channels;
6660 ControllerInfo.Targets = Controller->Targets;
6661 ControllerInfo.PCI_Bus = Controller->Bus;
6662 ControllerInfo.PCI_Device = Controller->Device;
6663 ControllerInfo.PCI_Function = Controller->Function;
6664 ControllerInfo.IRQ_Channel = Controller->IRQ_Channel;
6665 ControllerInfo.PCI_Address = Controller->PCI_Address;
6666 strcpy(ControllerInfo.ModelName, Controller->ModelName);
6667 strcpy(ControllerInfo.FirmwareVersion, Controller->FirmwareVersion);
6676 DAC960_Controller_T *Controller;
6697 Controller = DAC960_Controllers[ControllerNumber];
6698 if (Controller == NULL) return -ENXIO;
6699 if (Controller->FirmwareType != DAC960_V1_Controller) return -EINVAL;
6724 DCDB_IOBUF = pci_alloc_consistent(Controller->PCIDevice,
6731 DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
6741 DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
6756 spin_lock_irqsave(&Controller->queue_lock, flags);
6757 while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
6758 DAC960_WaitForCommand(Controller);
6759 while (Controller->V1.DirectCommandActive[DCDB.Channel]
6762 spin_unlock_irq(&Controller->queue_lock);
6763 __wait_event(Controller->CommandWaitQueue,
6764 !Controller->V1.DirectCommandActive
6766 spin_lock_irq(&Controller->queue_lock);
6768 Controller->V1.DirectCommandActive[DCDB.Channel]
6770 spin_unlock_irqrestore(&Controller->queue_lock, flags);
6781 spin_lock_irqsave(&Controller->queue_lock, flags);
6782 while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
6783 DAC960_WaitForCommand(Controller);
6784 spin_unlock_irqrestore(&Controller->queue_lock, flags);
6795 spin_lock_irqsave(&Controller->queue_lock, flags);
6797 spin_unlock_irqrestore(&Controller->queue_lock, flags);
6812 Controller->V1.DirectCommandActive[DCDB.Channel]
6823 pci_free_consistent(Controller->PCIDevice, abs(DataTransferLength),
6826 pci_free_consistent(Controller->PCIDevice, sizeof(DAC960_V1_DCDB_T),
6836 DAC960_Controller_T *Controller;
6857 Controller = DAC960_Controllers[ControllerNumber];
6858 if (Controller == NULL) return -ENXIO;
6859 if (Controller->FirmwareType != DAC960_V2_Controller) return -EINVAL;
6863 DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
6870 DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice,
6883 RequestSenseBuffer = pci_alloc_consistent(Controller->PCIDevice,
6892 spin_lock_irqsave(&Controller->queue_lock, flags);
6893 while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
6894 DAC960_WaitForCommand(Controller);
6895 spin_unlock_irqrestore(&Controller->queue_lock, flags);
6943 spin_lock_irqsave(&Controller->queue_lock, flags);
6945 spin_unlock_irqrestore(&Controller->queue_lock, flags);
6977 pci_free_consistent(Controller->PCIDevice, abs(DataTransferLength),
6980 pci_free_consistent(Controller->PCIDevice, RequestSenseLength,
6991 DAC960_Controller_T *Controller;
7001 Controller = DAC960_Controllers[ControllerNumber];
7002 if (Controller == NULL) return -ENXIO;
7003 if (Controller->FirmwareType != DAC960_V2_Controller) return -EINVAL;
7008 while (Controller->V2.HealthStatusBuffer->StatusChangeCounter
7010 Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
7013 interruptible_sleep_on_timeout(&Controller->HealthStatusWaitQueue,
7018 Controller->V2.HealthStatusBuffer,
7188 DAC960_Controller_T *Controller = DAC960_Controllers[i];
7189 if (Controller == NULL)
7191 DAC960_FinalizeController(Controller);