patch-2.2.19 linux/drivers/block/DAC960.c
Next file: linux/drivers/block/DAC960.h
Previous file: linux/arch/sparc64/mm/init.c
Back to the patch index
Back to the overall index
- Lines: 950
- Date:
Sun Mar 25 11:37:30 2001
- Orig file:
v2.2.18/drivers/block/DAC960.c
- Orig date:
Sun Mar 25 11:28:21 2001
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.18/drivers/block/DAC960.c linux/drivers/block/DAC960.c
@@ -2,7 +2,7 @@
Linux Driver for Mylex DAC960/AcceleRAID/eXtremeRAID PCI RAID Controllers
- Copyright 1998-2000 by Leonard N. Zubkoff <lnz@dandelion.com>
+ Copyright 1998-2001 by Leonard N. Zubkoff <lnz@dandelion.com>
This program is free software; you may redistribute and/or modify it under
the terms of the GNU General Public License Version 2 as published by the
@@ -19,8 +19,8 @@
*/
-#define DAC960_DriverVersion "2.2.9"
-#define DAC960_DriverDate "7 September 2000"
+#define DAC960_DriverVersion "2.2.10"
+#define DAC960_DriverDate "1 February 2001"
#include <linux/version.h>
@@ -120,7 +120,7 @@
DAC960_Announce("***** DAC960 RAID Driver Version "
DAC960_DriverVersion " of "
DAC960_DriverDate " *****\n", Controller);
- DAC960_Announce("Copyright 1998-2000 by Leonard N. Zubkoff "
+ DAC960_Announce("Copyright 1998-2001 by Leonard N. Zubkoff "
"<lnz@dandelion.com>\n", Controller);
}
@@ -521,7 +521,7 @@
DAC960_V1_ClearCommand(Command);
Command->CommandType = DAC960_ImmediateCommand;
CommandMailbox->Type3.CommandOpcode = CommandOpcode;
- CommandMailbox->Type3.BusAddress = Virtual_to_Bus(DataPointer);
+ CommandMailbox->Type3.BusAddress = Virtual_to_Bus32(DataPointer);
DAC960_ExecuteCommand(Command);
CommandStatus = Command->V1.CommandStatus;
DAC960_DeallocateCommand(Command);
@@ -549,7 +549,7 @@
CommandMailbox->Type3D.CommandOpcode = CommandOpcode;
CommandMailbox->Type3D.Channel = Channel;
CommandMailbox->Type3D.TargetID = TargetID;
- CommandMailbox->Type3D.BusAddress = Virtual_to_Bus(DataPointer);
+ CommandMailbox->Type3D.BusAddress = Virtual_to_Bus32(DataPointer);
DAC960_ExecuteCommand(Command);
CommandStatus = Command->V1.CommandStatus;
DAC960_DeallocateCommand(Command);
@@ -583,7 +583,7 @@
CommandMailbox->Common.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(DataPointer);
+ Virtual_to_Bus64(DataPointer);
CommandMailbox->Common.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -622,7 +622,7 @@
CommandMailbox->ControllerInfo.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(DataPointer);
+ Virtual_to_Bus64(DataPointer);
CommandMailbox->ControllerInfo.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -665,7 +665,7 @@
CommandMailbox->LogicalDeviceInfo.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(DataPointer);
+ Virtual_to_Bus64(DataPointer);
CommandMailbox->LogicalDeviceInfo.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -710,7 +710,7 @@
CommandMailbox->PhysicalDeviceInfo.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(DataPointer);
+ Virtual_to_Bus64(DataPointer);
CommandMailbox->PhysicalDeviceInfo.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -826,9 +826,9 @@
CommandMailbox.TypeX.CommandIdentifier = 0;
CommandMailbox.TypeX.CommandOpcode2 = 0x14;
CommandMailbox.TypeX.CommandMailboxesBusAddress =
- Virtual_to_Bus(Controller->V1.FirstCommandMailbox);
+ Virtual_to_Bus32(Controller->V1.FirstCommandMailbox);
CommandMailbox.TypeX.StatusMailboxesBusAddress =
- Virtual_to_Bus(Controller->V1.FirstStatusMailbox);
+ Virtual_to_Bus32(Controller->V1.FirstStatusMailbox);
for (i = 0; i < 2; i++)
switch (Controller->HardwareType)
{
@@ -950,11 +950,11 @@
CommandMailbox.SetMemoryMailbox.IOCTL_Opcode = DAC960_V2_SetMemoryMailbox;
CommandMailbox.SetMemoryMailbox.HealthStatusBufferSizeKB = 1;
CommandMailbox.SetMemoryMailbox.HealthStatusBufferBusAddress =
- Virtual_to_Bus(Controller->V2.HealthStatusBuffer);
+ Virtual_to_Bus64(Controller->V2.HealthStatusBuffer);
CommandMailbox.SetMemoryMailbox.FirstCommandMailboxBusAddress =
- Virtual_to_Bus(Controller->V2.FirstCommandMailbox);
+ Virtual_to_Bus64(Controller->V2.FirstCommandMailbox);
CommandMailbox.SetMemoryMailbox.FirstStatusMailboxBusAddress =
- Virtual_to_Bus(Controller->V2.FirstStatusMailbox);
+ Virtual_to_Bus64(Controller->V2.FirstStatusMailbox);
switch (Controller->HardwareType)
{
case DAC960_BA_Controller:
@@ -1344,7 +1344,7 @@
Command->CommandType = DAC960_ImmediateCommand;
Command->Semaphore = Semaphore;
Command->V1.CommandMailbox.Type3.CommandOpcode = DAC960_V1_DCDB;
- Command->V1.CommandMailbox.Type3.BusAddress = Virtual_to_Bus(DCDB);
+ Command->V1.CommandMailbox.Type3.BusAddress = Virtual_to_Bus32(DCDB);
DCDB->Channel = Channel;
DCDB->TargetID = TargetID;
DCDB->Direction = DAC960_V1_DCDB_DataTransferDeviceToSystem;
@@ -1353,7 +1353,7 @@
DCDB->NoAutomaticRequestSense = false;
DCDB->DisconnectPermitted = true;
DCDB->TransferLength = sizeof(DAC960_SCSI_Inquiry_T);
- DCDB->BusAddress = Virtual_to_Bus(InquiryStandardData);
+ DCDB->BusAddress = Virtual_to_Bus32(InquiryStandardData);
DCDB->CDBLength = 6;
DCDB->TransferLengthHigh4 = 0;
DCDB->SenseLength = sizeof(DCDB->SenseData);
@@ -1380,7 +1380,7 @@
Command->Semaphore = Semaphore;
DCDB = &DCDBs[Channel];
DCDB->TransferLength = sizeof(DAC960_SCSI_Inquiry_UnitSerialNumber_T);
- DCDB->BusAddress = Virtual_to_Bus(InquiryUnitSerialNumber);
+ DCDB->BusAddress = Virtual_to_Bus32(InquiryUnitSerialNumber);
DCDB->SenseLength = sizeof(DCDB->SenseData);
DCDB->CDB[0] = 0x12; /* INQUIRY */
DCDB->CDB[1] = 1; /* EVPD = 1 */
@@ -1471,7 +1471,7 @@
CommandMailbox->SCSI_10.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(InquiryUnitSerialNumber);
+ Virtual_to_Bus64(InquiryUnitSerialNumber);
CommandMailbox->SCSI_10.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -2541,7 +2541,8 @@
CommandMailbox->Type5.LD.TransferLength = Command->BlockCount;
CommandMailbox->Type5.LD.LogicalDriveNumber = Command->LogicalDriveNumber;
CommandMailbox->Type5.LogicalBlockAddress = Command->BlockNumber;
- CommandMailbox->Type5.BusAddress = Virtual_to_Bus(Command->RequestBuffer);
+ CommandMailbox->Type5.BusAddress =
+ Virtual_to_Bus32(Command->RequestBuffer);
}
else
{
@@ -2559,7 +2560,7 @@
CommandMailbox->Type5.LD.TransferLength = Command->BlockCount;
CommandMailbox->Type5.LD.LogicalDriveNumber = Command->LogicalDriveNumber;
CommandMailbox->Type5.LogicalBlockAddress = Command->BlockNumber;
- CommandMailbox->Type5.BusAddress = Virtual_to_Bus(ScatterGatherList);
+ CommandMailbox->Type5.BusAddress = Virtual_to_Bus32(ScatterGatherList);
CommandMailbox->Type5.ScatterGatherCount = Command->SegmentCount;
while (BufferHeader != NULL)
{
@@ -2572,7 +2573,7 @@
else
{
ScatterGatherList[SegmentNumber].SegmentDataPointer =
- Virtual_to_Bus(BufferHeader->b_data);
+ Virtual_to_Bus32(BufferHeader->b_data);
ScatterGatherList[SegmentNumber].SegmentByteCount =
BufferHeader->b_size;
LastDataEndPointer = BufferHeader->b_data + BufferHeader->b_size;
@@ -2604,7 +2605,7 @@
CommandMailbox->SCSI_10.DataTransferSize =
Command->BlockCount << DAC960_BlockSizeBits;
CommandMailbox->SCSI_10.RequestSenseBusAddress =
- Virtual_to_Bus(&Command->V2.RequestSense);
+ Virtual_to_Bus64(&Command->V2.RequestSense);
CommandMailbox->SCSI_10.PhysicalDevice =
Controller->V2.LogicalDriveToVirtualDevice[Command->LogicalDriveNumber];
CommandMailbox->SCSI_10.RequestSenseSize =
@@ -2623,7 +2624,7 @@
CommandMailbox->SCSI_10.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(Command->RequestBuffer);
+ Virtual_to_Bus64(Command->RequestBuffer);
CommandMailbox->SCSI_10.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -2645,7 +2646,7 @@
Command->SegmentCount;
CommandMailbox->SCSI_10.DataTransferMemoryAddress
.ExtendedScatterGather.ScatterGatherList0Address =
- Virtual_to_Bus(ScatterGatherList);
+ Virtual_to_Bus64(ScatterGatherList);
}
else
ScatterGatherList =
@@ -2662,7 +2663,7 @@
else
{
ScatterGatherList[SegmentNumber].SegmentDataPointer =
- Virtual_to_Bus(BufferHeader->b_data);
+ Virtual_to_Bus64(BufferHeader->b_data);
ScatterGatherList[SegmentNumber].SegmentByteCount =
BufferHeader->b_size;
LastDataEndPointer = BufferHeader->b_data + BufferHeader->b_size;
@@ -3047,7 +3048,7 @@
Command->BlockCount = BufferHeader->b_size >> DAC960_BlockSizeBits;
CommandMailbox->Type5.LD.TransferLength = Command->BlockCount;
CommandMailbox->Type5.BusAddress =
- Virtual_to_Bus(BufferHeader->b_data);
+ Virtual_to_Bus32(BufferHeader->b_data);
DAC960_QueueCommand(Command);
return;
}
@@ -3103,7 +3104,7 @@
CommandMailbox->Type5.LD.TransferLength = Command->BlockCount;
CommandMailbox->Type5.LogicalBlockAddress = Command->BlockNumber;
CommandMailbox->Type5.BusAddress =
- Virtual_to_Bus(NextBufferHeader->b_data);
+ Virtual_to_Bus32(NextBufferHeader->b_data);
DAC960_QueueCommand(Command);
return;
}
@@ -3116,11 +3117,13 @@
{
if (CommandOpcode == DAC960_V1_Enquiry)
memcpy(&Controller->V1.NewEnquiry,
- Bus_to_Virtual(Command->V1.CommandMailbox.Type3.BusAddress),
+ Bus32_to_Virtual(Command->V1.CommandMailbox
+ .Type3.BusAddress),
sizeof(DAC960_V1_Enquiry_T));
else if (CommandOpcode == DAC960_V1_GetRebuildProgress)
memcpy(&Controller->V1.RebuildProgress,
- Bus_to_Virtual(Command->V1.CommandMailbox.Type3.BusAddress),
+ Bus32_to_Virtual(Command->V1.CommandMailbox
+ .Type3.BusAddress),
sizeof(DAC960_V1_RebuildProgress_T));
}
if (CommandOpcode == DAC960_V1_Enquiry &&
@@ -3134,18 +3137,25 @@
NewEnquiry->CriticalLogicalDriveCount;
if (NewEnquiry->NumberOfLogicalDrives > Controller->LogicalDriveCount)
{
- int LogicalDriveNumber = Controller->LogicalDriveCount;
- while (LogicalDriveNumber < NewEnquiry->NumberOfLogicalDrives)
- {
- DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) "
- "Now Exists\n", Controller,
- LogicalDriveNumber,
- Controller->ControllerNumber,
- LogicalDriveNumber);
- LogicalDriveNumber++;
- }
- Controller->LogicalDriveCount = LogicalDriveNumber;
+ int LogicalDriveNumber = Controller->LogicalDriveCount - 1;
+ while (++LogicalDriveNumber < NewEnquiry->NumberOfLogicalDrives)
+ DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) "
+ "Now Exists\n", Controller,
+ LogicalDriveNumber,
+ Controller->ControllerNumber,
+ LogicalDriveNumber);
+ }
+ if (NewEnquiry->NumberOfLogicalDrives < Controller->LogicalDriveCount)
+ {
+ int LogicalDriveNumber = NewEnquiry->NumberOfLogicalDrives - 1;
+ while (++LogicalDriveNumber < Controller->LogicalDriveCount)
+ DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) "
+ "No Longer Exists\n", Controller,
+ LogicalDriveNumber,
+ Controller->ControllerNumber,
+ LogicalDriveNumber);
}
+ Controller->LogicalDriveCount = NewEnquiry->NumberOfLogicalDrives;
if (NewEnquiry->StatusFlags.DeferredWriteError !=
OldEnquiry->StatusFlags.DeferredWriteError)
DAC960_Critical("Deferred Write Error Flag is now %s\n", Controller,
@@ -3170,8 +3180,7 @@
NewEnquiry->EventLogSequenceNumber;
Controller->V1.NeedErrorTableInformation = true;
Controller->V1.NeedDeviceStateInformation = true;
- Controller->V1.DeviceStateChannel = 0;
- Controller->V1.DeviceStateTargetID = -1;
+ Controller->V1.StartDeviceStateScan = true;
Controller->SecondaryMonitoringTime = jiffies;
}
if (NewEnquiry->RebuildFlag == DAC960_V1_StandbyRebuildInProgress ||
@@ -3230,7 +3239,7 @@
Controller->V1.RebuildFlagPending)
{
DAC960_V1_Enquiry_T *Enquiry = (DAC960_V1_Enquiry_T *)
- Bus_to_Virtual(Command->V1.CommandMailbox.Type3.BusAddress);
+ Bus32_to_Virtual(Command->V1.CommandMailbox.Type3.BusAddress);
Enquiry->RebuildFlag = Controller->V1.PendingRebuildFlag;
Controller->V1.RebuildFlagPending = false;
}
@@ -3376,6 +3385,9 @@
{
Controller->V1.NeedDeviceInquiryInformation = true;
Controller->V1.NeedDeviceSerialNumberInformation = true;
+ Controller->V1.DeviceResetCount
+ [Controller->V1.DeviceStateChannel]
+ [Controller->V1.DeviceStateTargetID] = 0;
}
memcpy(OldDeviceState, NewDeviceState,
sizeof(DAC960_V1_DeviceState_T));
@@ -3515,7 +3527,7 @@
Command->V1.CommandMailbox.Type3E.SequenceNumber =
Controller->V1.OldEventLogSequenceNumber;
Command->V1.CommandMailbox.Type3E.BusAddress =
- Virtual_to_Bus(&Controller->V1.EventLogEntry);
+ Virtual_to_Bus32(&Controller->V1.EventLogEntry);
DAC960_QueueCommand(Command);
return;
}
@@ -3525,7 +3537,7 @@
Command->V1.CommandMailbox.Type3.CommandOpcode =
DAC960_V1_GetErrorTable;
Command->V1.CommandMailbox.Type3.BusAddress =
- Virtual_to_Bus(&Controller->V1.NewErrorTable);
+ Virtual_to_Bus32(&Controller->V1.NewErrorTable);
DAC960_QueueCommand(Command);
return;
}
@@ -3536,7 +3548,7 @@
Command->V1.CommandMailbox.Type3.CommandOpcode =
DAC960_V1_GetRebuildProgress;
Command->V1.CommandMailbox.Type3.BusAddress =
- Virtual_to_Bus(&Controller->V1.RebuildProgress);
+ Virtual_to_Bus32(&Controller->V1.RebuildProgress);
DAC960_QueueCommand(Command);
return;
}
@@ -3552,7 +3564,7 @@
InquiryStandardData->PeripheralDeviceType = 0x1F;
Command->V1.CommandMailbox.Type3.CommandOpcode = DAC960_V1_DCDB;
Command->V1.CommandMailbox.Type3.BusAddress =
- Virtual_to_Bus(DCDB);
+ Virtual_to_Bus32(DCDB);
DCDB->Channel = Controller->V1.DeviceStateChannel;
DCDB->TargetID = Controller->V1.DeviceStateTargetID;
DCDB->Direction = DAC960_V1_DCDB_DataTransferDeviceToSystem;
@@ -3561,7 +3573,7 @@
DCDB->NoAutomaticRequestSense = false;
DCDB->DisconnectPermitted = true;
DCDB->TransferLength = sizeof(DAC960_SCSI_Inquiry_T);
- DCDB->BusAddress = Virtual_to_Bus(InquiryStandardData);
+ DCDB->BusAddress = Virtual_to_Bus32(InquiryStandardData);
DCDB->CDBLength = 6;
DCDB->TransferLengthHigh4 = 0;
DCDB->SenseLength = sizeof(DCDB->SenseData);
@@ -3585,7 +3597,7 @@
InquiryUnitSerialNumber->PeripheralDeviceType = 0x1F;
Command->V1.CommandMailbox.Type3.CommandOpcode = DAC960_V1_DCDB;
Command->V1.CommandMailbox.Type3.BusAddress =
- Virtual_to_Bus(DCDB);
+ Virtual_to_Bus32(DCDB);
DCDB->Channel = Controller->V1.DeviceStateChannel;
DCDB->TargetID = Controller->V1.DeviceStateTargetID;
DCDB->Direction = DAC960_V1_DCDB_DataTransferDeviceToSystem;
@@ -3595,7 +3607,7 @@
DCDB->DisconnectPermitted = true;
DCDB->TransferLength =
sizeof(DAC960_SCSI_Inquiry_UnitSerialNumber_T);
- DCDB->BusAddress = Virtual_to_Bus(InquiryUnitSerialNumber);
+ DCDB->BusAddress = Virtual_to_Bus32(InquiryUnitSerialNumber);
DCDB->CDBLength = 6;
DCDB->TransferLengthHigh4 = 0;
DCDB->SenseLength = sizeof(DCDB->SenseData);
@@ -3609,35 +3621,31 @@
Controller->V1.NeedDeviceSerialNumberInformation = false;
return;
}
- if (++Controller->V1.DeviceStateTargetID == Controller->Targets)
+ if (Controller->V1.StartDeviceStateScan)
+ {
+ Controller->V1.DeviceStateChannel = 0;
+ Controller->V1.DeviceStateTargetID = 0;
+ Controller->V1.StartDeviceStateScan = false;
+ }
+ else if (++Controller->V1.DeviceStateTargetID == Controller->Targets)
{
Controller->V1.DeviceStateChannel++;
Controller->V1.DeviceStateTargetID = 0;
}
- while (Controller->V1.DeviceStateChannel < Controller->Channels)
+ if (Controller->V1.DeviceStateChannel < Controller->Channels)
{
- DAC960_V1_DeviceState_T *OldDeviceState =
- &Controller->V1.DeviceState[Controller->V1.DeviceStateChannel]
- [Controller->V1.DeviceStateTargetID];
- if (OldDeviceState->Present &&
- OldDeviceState->DeviceType == DAC960_V1_DiskType)
- {
- Command->V1.CommandMailbox.Type3D.CommandOpcode =
- DAC960_V1_GetDeviceState;
- Command->V1.CommandMailbox.Type3D.Channel =
- Controller->V1.DeviceStateChannel;
- Command->V1.CommandMailbox.Type3D.TargetID =
- Controller->V1.DeviceStateTargetID;
- Command->V1.CommandMailbox.Type3D.BusAddress =
- Virtual_to_Bus(&Controller->V1.NewDeviceState);
- DAC960_QueueCommand(Command);
- return;
- }
- if (++Controller->V1.DeviceStateTargetID == Controller->Targets)
- {
- Controller->V1.DeviceStateChannel++;
- Controller->V1.DeviceStateTargetID = 0;
- }
+ Controller->V1.NewDeviceState.DeviceState =
+ DAC960_V1_Device_Dead;
+ Command->V1.CommandMailbox.Type3D.CommandOpcode =
+ DAC960_V1_GetDeviceState;
+ Command->V1.CommandMailbox.Type3D.Channel =
+ Controller->V1.DeviceStateChannel;
+ Command->V1.CommandMailbox.Type3D.TargetID =
+ Controller->V1.DeviceStateTargetID;
+ Command->V1.CommandMailbox.Type3D.BusAddress =
+ Virtual_to_Bus32(&Controller->V1.NewDeviceState);
+ DAC960_QueueCommand(Command);
+ return;
}
Controller->V1.NeedDeviceStateInformation = false;
}
@@ -3647,7 +3655,7 @@
Command->V1.CommandMailbox.Type3.CommandOpcode =
DAC960_V1_GetLogicalDriveInformation;
Command->V1.CommandMailbox.Type3.BusAddress =
- Virtual_to_Bus(&Controller->V1.NewLogicalDriveInformation);
+ Virtual_to_Bus32(&Controller->V1.NewLogicalDriveInformation);
DAC960_QueueCommand(Command);
return;
}
@@ -3657,7 +3665,7 @@
Command->V1.CommandMailbox.Type3.CommandOpcode =
DAC960_V1_GetRebuildProgress;
Command->V1.CommandMailbox.Type3.BusAddress =
- Virtual_to_Bus(&Controller->V1.RebuildProgress);
+ Virtual_to_Bus32(&Controller->V1.RebuildProgress);
DAC960_QueueCommand(Command);
return;
}
@@ -3667,7 +3675,7 @@
Command->V1.CommandMailbox.Type3.CommandOpcode =
DAC960_V1_RebuildStat;
Command->V1.CommandMailbox.Type3.BusAddress =
- Virtual_to_Bus(&Controller->V1.RebuildProgress);
+ Virtual_to_Bus32(&Controller->V1.RebuildProgress);
DAC960_QueueCommand(Command);
return;
}
@@ -4045,7 +4053,7 @@
Command->BlockCount << DAC960_BlockSizeBits;
CommandMailbox->SCSI_10.DataTransferMemoryAddress
.ScatterGatherSegments[0].SegmentDataPointer =
- Virtual_to_Bus(BufferHeader->b_data);
+ Virtual_to_Bus64(BufferHeader->b_data);
CommandMailbox->SCSI_10.DataTransferMemoryAddress
.ScatterGatherSegments[0].SegmentByteCount =
CommandMailbox->SCSI_10.DataTransferSize;
@@ -4106,7 +4114,7 @@
CommandMailbox->SCSI_10.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(NextBufferHeader->b_data);
+ Virtual_to_Bus64(NextBufferHeader->b_data);
CommandMailbox->SCSI_10.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -4132,12 +4140,9 @@
Controller->LogicalDriveCount =
NewControllerInfo->LogicalDevicesPresent;
Controller->V2.NeedLogicalDeviceInformation = true;
- Controller->V2.NewLogicalDeviceInformation.LogicalDeviceNumber = 0;
Controller->V2.NeedPhysicalDeviceInformation = true;
- Controller->V2.PhysicalDeviceIndex = 0;
- Controller->V2.NewPhysicalDeviceInformation.Channel = 0;
- Controller->V2.NewPhysicalDeviceInformation.TargetID = 0;
- Controller->V2.NewPhysicalDeviceInformation.LogicalUnit = 0;
+ Controller->V2.StartLogicalDeviceInformationScan = true;
+ Controller->V2.StartPhysicalDeviceInformationScan = true;
Controller->MonitoringAlertMode =
(NewControllerInfo->LogicalDevicesCritical > 0 ||
NewControllerInfo->LogicalDevicesOffline > 0 ||
@@ -4160,7 +4165,49 @@
unsigned int PhysicalDeviceIndex = Controller->V2.PhysicalDeviceIndex;
DAC960_V2_PhysicalDeviceInfo_T *PhysicalDeviceInfo =
Controller->V2.PhysicalDeviceInformation[PhysicalDeviceIndex];
- DAC960_SCSI_Inquiry_UnitSerialNumber_T *InquiryUnitSerialNumber;
+ DAC960_SCSI_Inquiry_UnitSerialNumber_T *InquiryUnitSerialNumber =
+ Controller->V2.InquiryUnitSerialNumber[PhysicalDeviceIndex];
+ unsigned int DeviceIndex;
+ while (PhysicalDeviceInfo != NULL &&
+ (NewPhysicalDeviceInfo->Channel >
+ PhysicalDeviceInfo->Channel ||
+ (NewPhysicalDeviceInfo->Channel ==
+ PhysicalDeviceInfo->Channel &&
+ (NewPhysicalDeviceInfo->TargetID >
+ PhysicalDeviceInfo->TargetID ||
+ (NewPhysicalDeviceInfo->TargetID ==
+ PhysicalDeviceInfo->TargetID &&
+ NewPhysicalDeviceInfo->LogicalUnit >
+ PhysicalDeviceInfo->LogicalUnit)))))
+ {
+ DAC960_Critical("Physical Device %d:%d No Longer Exists\n",
+ Controller,
+ PhysicalDeviceInfo->Channel,
+ PhysicalDeviceInfo->TargetID);
+ Controller->V2.PhysicalDeviceInformation
+ [PhysicalDeviceIndex] = NULL;
+ Controller->V2.InquiryUnitSerialNumber
+ [PhysicalDeviceIndex] = NULL;
+ kfree(PhysicalDeviceInfo);
+ kfree(InquiryUnitSerialNumber);
+ for (DeviceIndex = PhysicalDeviceIndex;
+ DeviceIndex < DAC960_V2_MaxPhysicalDevices - 1;
+ DeviceIndex++)
+ {
+ Controller->V2.PhysicalDeviceInformation[DeviceIndex] =
+ Controller->V2.PhysicalDeviceInformation[DeviceIndex+1];
+ Controller->V2.InquiryUnitSerialNumber[DeviceIndex] =
+ Controller->V2.InquiryUnitSerialNumber[DeviceIndex+1];
+ }
+ Controller->V2.PhysicalDeviceInformation
+ [DAC960_V2_MaxPhysicalDevices-1] = NULL;
+ Controller->V2.InquiryUnitSerialNumber
+ [DAC960_V2_MaxPhysicalDevices-1] = NULL;
+ PhysicalDeviceInfo =
+ Controller->V2.PhysicalDeviceInformation[PhysicalDeviceIndex];
+ InquiryUnitSerialNumber =
+ Controller->V2.InquiryUnitSerialNumber[PhysicalDeviceIndex];
+ }
if (PhysicalDeviceInfo == NULL ||
(NewPhysicalDeviceInfo->Channel !=
PhysicalDeviceInfo->Channel) ||
@@ -4169,14 +4216,14 @@
(NewPhysicalDeviceInfo->LogicalUnit !=
PhysicalDeviceInfo->LogicalUnit))
{
- unsigned int DeviceIndex;
PhysicalDeviceInfo = (DAC960_V2_PhysicalDeviceInfo_T *)
kmalloc(sizeof(DAC960_V2_PhysicalDeviceInfo_T), GFP_ATOMIC);
InquiryUnitSerialNumber =
(DAC960_SCSI_Inquiry_UnitSerialNumber_T *)
kmalloc(sizeof(DAC960_SCSI_Inquiry_UnitSerialNumber_T),
GFP_ATOMIC);
- if (InquiryUnitSerialNumber == NULL)
+ if (InquiryUnitSerialNumber == NULL &&
+ PhysicalDeviceInfo != NULL)
{
kfree(PhysicalDeviceInfo);
PhysicalDeviceInfo = NULL;
@@ -4189,21 +4236,6 @@
? "" : " - Allocation Failed"));
if (PhysicalDeviceInfo != NULL)
{
- for (DeviceIndex = PhysicalDeviceIndex;
- DeviceIndex < DAC960_V2_MaxPhysicalDevices - 1;
- DeviceIndex++)
- {
- Controller->V2.PhysicalDeviceInformation[DeviceIndex+1] =
- Controller->V2.PhysicalDeviceInformation[DeviceIndex];
- Controller->V2.InquiryUnitSerialNumber[DeviceIndex+1] =
- Controller->V2.InquiryUnitSerialNumber[DeviceIndex];
- Controller->V2.PhysicalDeviceInformation
- [PhysicalDeviceIndex] =
- PhysicalDeviceInfo;
- Controller->V2.InquiryUnitSerialNumber
- [PhysicalDeviceIndex] =
- InquiryUnitSerialNumber;
- }
memset(PhysicalDeviceInfo, 0,
sizeof(DAC960_V2_PhysicalDeviceInfo_T));
PhysicalDeviceInfo->PhysicalDeviceState =
@@ -4211,6 +4243,21 @@
memset(InquiryUnitSerialNumber, 0,
sizeof(DAC960_SCSI_Inquiry_UnitSerialNumber_T));
InquiryUnitSerialNumber->PeripheralDeviceType = 0x1F;
+ for (DeviceIndex = DAC960_V2_MaxPhysicalDevices - 1;
+ DeviceIndex > PhysicalDeviceIndex;
+ DeviceIndex--)
+ {
+ Controller->V2.PhysicalDeviceInformation[DeviceIndex] =
+ Controller->V2.PhysicalDeviceInformation[DeviceIndex-1];
+ Controller->V2.InquiryUnitSerialNumber[DeviceIndex] =
+ Controller->V2.InquiryUnitSerialNumber[DeviceIndex-1];
+ }
+ Controller->V2.PhysicalDeviceInformation
+ [PhysicalDeviceIndex] =
+ PhysicalDeviceInfo;
+ Controller->V2.InquiryUnitSerialNumber
+ [PhysicalDeviceIndex] =
+ InquiryUnitSerialNumber;
Controller->V2.NeedDeviceSerialNumberInformation = true;
}
}
@@ -4273,8 +4320,10 @@
NewPhysicalDeviceInfo
->PredictedFailuresDetected);
}
- if (PhysicalDeviceInfo->PhysicalDeviceState
- == DAC960_V2_Device_Dead &&
+ if ((PhysicalDeviceInfo->PhysicalDeviceState
+ == DAC960_V2_Device_Dead ||
+ PhysicalDeviceInfo->PhysicalDeviceState
+ == DAC960_V2_Device_InvalidState) &&
NewPhysicalDeviceInfo->PhysicalDeviceState
!= DAC960_V2_Device_Dead)
Controller->V2.NeedDeviceSerialNumberInformation = true;
@@ -4285,7 +4334,28 @@
Controller->V2.PhysicalDeviceIndex++;
}
else if (CommandOpcode == DAC960_V2_GetPhysicalDeviceInfoValid)
- Controller->V2.NeedPhysicalDeviceInformation = false;
+ {
+ unsigned int DeviceIndex;
+ for (DeviceIndex = Controller->V2.PhysicalDeviceIndex;
+ DeviceIndex < DAC960_V2_MaxPhysicalDevices;
+ DeviceIndex++)
+ {
+ DAC960_V2_PhysicalDeviceInfo_T *PhysicalDeviceInfo =
+ Controller->V2.PhysicalDeviceInformation[DeviceIndex];
+ DAC960_SCSI_Inquiry_UnitSerialNumber_T *InquiryUnitSerialNumber =
+ Controller->V2.InquiryUnitSerialNumber[DeviceIndex];
+ if (PhysicalDeviceInfo == NULL) break;
+ DAC960_Critical("Physical Device %d:%d No Longer Exists\n",
+ Controller,
+ PhysicalDeviceInfo->Channel,
+ PhysicalDeviceInfo->TargetID);
+ Controller->V2.PhysicalDeviceInformation[DeviceIndex] = NULL;
+ Controller->V2.InquiryUnitSerialNumber[DeviceIndex] = NULL;
+ kfree(PhysicalDeviceInfo);
+ kfree(InquiryUnitSerialNumber);
+ }
+ Controller->V2.NeedPhysicalDeviceInformation = false;
+ }
else if (CommandOpcode == DAC960_V2_GetLogicalDeviceInfoValid &&
CommandStatus == DAC960_V2_NormalCompletion)
{
@@ -4392,13 +4462,50 @@
NewLogicalDeviceInfo
->PatrolOperationBlockNumber,
LogicalDeviceSize);
+ if (LogicalDeviceInfo->BackgroundInitializationInProgress &&
+ !NewLogicalDeviceInfo->BackgroundInitializationInProgress)
+ DAC960_Progress("Logical Drive %d (/dev/rd/c%dd%d) "
+ "Background Initialization %s\n",
+ Controller,
+ LogicalDeviceNumber,
+ Controller->ControllerNumber,
+ LogicalDeviceNumber,
+ (NewLogicalDeviceInfo->LogicalDeviceControl
+ .LogicalDeviceInitialized
+ ? "Completed" : "Failed"));
memcpy(LogicalDeviceInfo, NewLogicalDeviceInfo,
sizeof(DAC960_V2_LogicalDeviceInfo_T));
}
+ Controller->V2.LogicalDriveFoundDuringScan
+ [LogicalDeviceNumber] = true;
NewLogicalDeviceInfo->LogicalDeviceNumber++;
}
else if (CommandOpcode == DAC960_V2_GetLogicalDeviceInfoValid)
- Controller->V2.NeedLogicalDeviceInformation = false;
+ {
+ int LogicalDriveNumber;
+ for (LogicalDriveNumber = 0;
+ LogicalDriveNumber < DAC960_MaxLogicalDrives;
+ LogicalDriveNumber++)
+ {
+ DAC960_V2_LogicalDeviceInfo_T *LogicalDeviceInfo =
+ Controller->V2.LogicalDeviceInformation[LogicalDriveNumber];
+ if (LogicalDeviceInfo == NULL ||
+ Controller->V2.LogicalDriveFoundDuringScan
+ [LogicalDriveNumber])
+ continue;
+ DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) "
+ "No Longer Exists\n", Controller,
+ LogicalDriveNumber,
+ Controller->ControllerNumber,
+ LogicalDriveNumber);
+ Controller->V2.LogicalDeviceInformation
+ [LogicalDriveNumber] = NULL;
+ kfree(LogicalDeviceInfo);
+ Controller->LogicalDriveInitiallyAccessible
+ [LogicalDriveNumber] = false;
+ }
+ Controller->V2.NeedLogicalDeviceInformation = false;
+ }
if (Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
- Controller->V2.NextEventSequenceNumber > 0)
{
@@ -4414,7 +4521,7 @@
CommandMailbox->GetEvent.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(&Controller->V2.Event);
+ Virtual_to_Bus64(&Controller->V2.Event);
CommandMailbox->GetEvent.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -4451,7 +4558,7 @@
CommandMailbox->SCSI_10.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(InquiryUnitSerialNumber);
+ Virtual_to_Bus64(InquiryUnitSerialNumber);
CommandMailbox->SCSI_10.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -4460,6 +4567,14 @@
Controller->V2.NeedDeviceSerialNumberInformation = false;
return;
}
+ if (Controller->V2.StartPhysicalDeviceInformationScan)
+ {
+ Controller->V2.PhysicalDeviceIndex = 0;
+ Controller->V2.NewPhysicalDeviceInformation.Channel = 0;
+ Controller->V2.NewPhysicalDeviceInformation.TargetID = 0;
+ Controller->V2.NewPhysicalDeviceInformation.LogicalUnit = 0;
+ Controller->V2.StartPhysicalDeviceInformationScan = false;
+ }
CommandMailbox->PhysicalDeviceInfo.CommandOpcode = DAC960_V2_IOCTL;
CommandMailbox->PhysicalDeviceInfo.DataTransferSize =
sizeof(DAC960_V2_PhysicalDeviceInfo_T);
@@ -4474,7 +4589,7 @@
CommandMailbox->PhysicalDeviceInfo.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(&Controller->V2.NewPhysicalDeviceInformation);
+ Virtual_to_Bus64(&Controller->V2.NewPhysicalDeviceInformation);
CommandMailbox->PhysicalDeviceInfo.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -4484,6 +4599,18 @@
}
if (Controller->V2.NeedLogicalDeviceInformation)
{
+ if (Controller->V2.StartLogicalDeviceInformationScan)
+ {
+ int LogicalDriveNumber;
+ for (LogicalDriveNumber = 0;
+ LogicalDriveNumber < DAC960_MaxLogicalDrives;
+ LogicalDriveNumber++)
+ Controller->V2.LogicalDriveFoundDuringScan
+ [LogicalDriveNumber] = false;
+ Controller->V2.NewLogicalDeviceInformation
+ .LogicalDeviceNumber = 0;
+ Controller->V2.StartLogicalDeviceInformationScan = false;
+ }
CommandMailbox->LogicalDeviceInfo.CommandOpcode = DAC960_V2_IOCTL;
CommandMailbox->LogicalDeviceInfo.DataTransferSize =
sizeof(DAC960_V2_LogicalDeviceInfo_T);
@@ -4494,7 +4621,7 @@
CommandMailbox->LogicalDeviceInfo.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(&Controller->V2.NewLogicalDeviceInformation);
+ Virtual_to_Bus64(&Controller->V2.NewLogicalDeviceInformation);
CommandMailbox->LogicalDeviceInfo.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -4792,7 +4919,8 @@
DAC960_V1_ClearCommand(Command);
Command->CommandType = DAC960_MonitoringCommand;
CommandMailbox->Type3.CommandOpcode = DAC960_V1_Enquiry;
- CommandMailbox->Type3.BusAddress = Virtual_to_Bus(&Controller->V1.NewEnquiry);
+ CommandMailbox->Type3.BusAddress =
+ Virtual_to_Bus32(&Controller->V1.NewEnquiry);
DAC960_QueueCommand(Command);
}
@@ -4820,7 +4948,7 @@
CommandMailbox->ControllerInfo.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(&Controller->V2.NewControllerInformation);
+ Virtual_to_Bus64(&Controller->V2.NewControllerInformation);
CommandMailbox->ControllerInfo.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -4863,6 +4991,28 @@
&Controller->V2.ControllerInformation;
unsigned int StatusChangeCounter =
Controller->V2.HealthStatusBuffer->StatusChangeCounter;
+ boolean ForceMonitoringCommand = false;
+ if (jiffies - Controller->SecondaryMonitoringTime
+ > DAC960_SecondaryMonitoringInterval)
+ {
+ int LogicalDriveNumber;
+ for (LogicalDriveNumber = 0;
+ LogicalDriveNumber < DAC960_MaxLogicalDrives;
+ LogicalDriveNumber++)
+ {
+ DAC960_V2_LogicalDeviceInfo_T *LogicalDeviceInfo =
+ Controller->V2.LogicalDeviceInformation[LogicalDriveNumber];
+ if (LogicalDeviceInfo == NULL) continue;
+ if (!LogicalDeviceInfo->LogicalDeviceControl
+ .LogicalDeviceInitialized &&
+ Controller->LogicalDriveUsageCount[LogicalDriveNumber] > 0)
+ {
+ ForceMonitoringCommand = true;
+ break;
+ }
+ }
+ Controller->SecondaryMonitoringTime = jiffies;
+ }
if (StatusChangeCounter == Controller->V2.StatusChangeCounter &&
Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
== Controller->V2.NextEventSequenceNumber &&
@@ -4873,7 +5023,8 @@
ControllerInfo->RebuildsActive +
ControllerInfo->OnlineExpansionsActive == 0 ||
jiffies - Controller->PrimaryMonitoringTime
- < DAC960_MonitoringTimerInterval))
+ < DAC960_MonitoringTimerInterval) &&
+ !ForceMonitoringCommand)
{
Controller->MonitoringTimer.expires =
jiffies + DAC960_HealthStatusMonitoringInterval;
@@ -4997,8 +5148,7 @@
DiskGeometry_T Geometry, *UserGeometry;
DAC960_Controller_T *Controller;
int PartitionNumber;
- if (File == NULL) return -EINVAL;
- if (File->f_flags & O_NONBLOCK)
+ if (File != NULL && (File->f_flags & O_NONBLOCK))
return DAC960_UserIOCTL(Inode, File, Request, Argument);
if (ControllerNumber < 0 || ControllerNumber > DAC960_ControllerCount - 1)
return -ENXIO;
@@ -5225,10 +5375,17 @@
if (CommandOpcode == DAC960_V1_DCDB)
{
DAC960_AcquireControllerLock(Controller, &ProcessorFlags);
- while (Controller->V1.DirectCommandActive[DCDB.Channel]
- [DCDB.TargetID] ||
- (Command = DAC960_AllocateCommand(Controller)) == NULL)
+ while ((Command = DAC960_AllocateCommand(Controller)) == NULL)
DAC960_WaitForCommand(Controller);
+ while (Controller->V1.DirectCommandActive[DCDB.Channel]
+ [DCDB.TargetID])
+ {
+ spin_unlock_irq(&io_request_lock);
+ __wait_event(Controller->CommandWaitQueue,
+ !Controller->V1.DirectCommandActive
+ [DCDB.Channel][DCDB.TargetID]);
+ spin_lock_irq(&io_request_lock);
+ }
Controller->V1.DirectCommandActive[DCDB.Channel]
[DCDB.TargetID] = true;
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
@@ -5237,8 +5394,8 @@
memcpy(&Command->V1.CommandMailbox, &UserCommand.CommandMailbox,
sizeof(DAC960_V1_CommandMailbox_T));
Command->V1.CommandMailbox.Type3.BusAddress =
- Virtual_to_Bus(&DCDB);
- DCDB.BusAddress = Virtual_to_Bus(DataTransferBuffer);
+ Virtual_to_Bus32(&DCDB);
+ DCDB.BusAddress = Virtual_to_Bus32(DataTransferBuffer);
}
else
{
@@ -5252,7 +5409,7 @@
sizeof(DAC960_V1_CommandMailbox_T));
if (DataTransferBuffer != NULL)
Command->V1.CommandMailbox.Type3.BusAddress =
- Virtual_to_Bus(DataTransferBuffer);
+ Virtual_to_Bus32(DataTransferBuffer);
}
DAC960_ExecuteCommand(Command);
CommandStatus = Command->V1.CommandStatus;
@@ -5365,7 +5522,7 @@
CommandMailbox->Common.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(DataTransferBuffer);
+ Virtual_to_Bus64(DataTransferBuffer);
CommandMailbox->Common.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -5377,7 +5534,7 @@
.NoAutoRequestSense = false;
CommandMailbox->Common.RequestSenseSize = RequestSenseLength;
CommandMailbox->Common.RequestSenseBusAddress =
- Virtual_to_Bus(RequestSenseBuffer);
+ Virtual_to_Bus64(RequestSenseBuffer);
}
DAC960_ExecuteCommand(Command);
CommandStatus = Command->V2.CommandStatus;
@@ -5557,9 +5714,9 @@
memcpy(&Command->V1.CommandMailbox, &KernelCommand->CommandMailbox,
sizeof(DAC960_V1_CommandMailbox_T));
Command->V1.CommandMailbox.Type3.BusAddress =
- Virtual_to_Bus(DCDB);
+ Virtual_to_Bus32(DCDB);
Command->V1.KernelCommand = KernelCommand;
- DCDB->BusAddress = Virtual_to_Bus(DataTransferBuffer);
+ DCDB->BusAddress = Virtual_to_Bus32(DataTransferBuffer);
DAC960_QueueCommand(Command);
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
}
@@ -5578,7 +5735,7 @@
sizeof(DAC960_V1_CommandMailbox_T));
if (DataTransferBuffer != NULL)
Command->V1.CommandMailbox.Type3.BusAddress =
- Virtual_to_Bus(DataTransferBuffer);
+ Virtual_to_Bus32(DataTransferBuffer);
Command->V1.KernelCommand = KernelCommand;
DAC960_QueueCommand(Command);
DAC960_ReleaseControllerLock(Controller, &ProcessorFlags);
@@ -5655,7 +5812,7 @@
CommandMailbox->Common.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(DataTransferBuffer);
+ Virtual_to_Bus64(DataTransferBuffer);
CommandMailbox->Common.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
@@ -5666,7 +5823,7 @@
CommandMailbox->Common.CommandControlBits
.NoAutoRequestSense = false;
CommandMailbox->Common.RequestSenseBusAddress =
- Virtual_to_Bus(RequestSenseBuffer);
+ Virtual_to_Bus64(RequestSenseBuffer);
}
Command->V2.KernelCommand = KernelCommand;
DAC960_QueueCommand(Command);
@@ -6104,7 +6261,7 @@
CommandMailbox->Type3R.CommandOpcode = DAC960_V1_RebuildControl;
CommandMailbox->Type3R.RebuildRateConstant = 0xFF;
CommandMailbox->Type3R.BusAddress =
- Virtual_to_Bus(&OldRebuildRateConstant);
+ Virtual_to_Bus32(&OldRebuildRateConstant);
DAC960_ExecuteCommand(Command);
switch (Command->V1.CommandStatus)
{
@@ -6160,7 +6317,7 @@
CommandMailbox->Common.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentDataPointer =
- Virtual_to_Bus(&PhysicalToLogicalDevice);
+ Virtual_to_Bus64(&PhysicalToLogicalDevice);
CommandMailbox->Common.DataTransferMemoryAddress
.ScatterGatherSegments[0]
.SegmentByteCount =
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)