Search for all logical units (LUNs) of a SCSI target.

svn path=/trunk/; revision=5981
This commit is contained in:
Eric Kohl 2003-09-04 11:30:42 +00:00
parent 4517f7f992
commit 74ef9cda04

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: scsiport.c,v 1.31 2003/08/27 21:30:37 dwelch Exp $ /* $Id: scsiport.c,v 1.32 2003/09/04 11:30:42 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -546,6 +546,9 @@ ScsiPortInitialize(IN PVOID Argument1,
return(Status); return(Status);
} }
/* Get inquiry data */
ScsiPortInquire(RealDeviceExtension);
/* Build the registry device map */ /* Build the registry device map */
ScsiPortBuildDeviceMap(RealDeviceExtension, ScsiPortBuildDeviceMap(RealDeviceExtension,
(PUNICODE_STRING)Argument2); (PUNICODE_STRING)Argument2);
@ -1242,6 +1245,7 @@ ScsiPortCreatePortDevice(IN PDRIVER_OBJECT DriverObject,
{ {
DbgPrint("Could not Connect Interrupt %d\n", DbgPrint("Could not Connect Interrupt %d\n",
PortDeviceExtension->PortConfig.BusInterruptVector); PortDeviceExtension->PortConfig.BusInterruptVector);
IoDeleteDevice(PortDeviceObject);
return(Status); return(Status);
} }
@ -1279,8 +1283,7 @@ ScsiPortCreatePortDevice(IN PDRIVER_OBJECT DriverObject,
PortDeviceExtension->PortBusInfo = NULL; PortDeviceExtension->PortBusInfo = NULL;
DPRINT("DeviceExtension %p\n", PortDeviceExtension); DPRINT("DeviceExtension %p\n", PortDeviceExtension);
ScsiPortInquire(PortDeviceExtension); // ScsiPortInquire(PortDeviceExtension);
/* FIXME: Copy more configuration data? */ /* FIXME: Copy more configuration data? */
@ -1311,6 +1314,7 @@ ScsiPortInquire(PSCSI_PORT_DEVICE_EXTENSION DeviceExtension)
SCSI_REQUEST_BLOCK Srb; SCSI_REQUEST_BLOCK Srb;
ULONG Bus; ULONG Bus;
ULONG Target; ULONG Target;
ULONG Lun;
ULONG UnitCount; ULONG UnitCount;
ULONG DataSize; ULONG DataSize;
BOOLEAN Result; BOOLEAN Result;
@ -1350,7 +1354,10 @@ ScsiPortInquire(PSCSI_PORT_DEVICE_EXTENSION DeviceExtension)
for (Target = 0; Target < DeviceExtension->PortConfig.MaximumNumberOfTargets; Target++) for (Target = 0; Target < DeviceExtension->PortConfig.MaximumNumberOfTargets; Target++)
{ {
Srb.TargetId = Target; Srb.TargetId = Target;
Srb.Lun = 0;
for (Lun = 0; Lun < SCSI_MAXIMUM_LOGICAL_UNITS; Lun++)
{
Srb.Lun = Lun;
Srb.SrbStatus = SRB_STATUS_SUCCESS; Srb.SrbStatus = SRB_STATUS_SUCCESS;
Result = DeviceExtension->HwStartIo(&DeviceExtension->MiniPortDeviceExtension, Result = DeviceExtension->HwStartIo(&DeviceExtension->MiniPortDeviceExtension,
@ -1361,7 +1368,7 @@ ScsiPortInquire(PSCSI_PORT_DEVICE_EXTENSION DeviceExtension)
{ {
UnitInfo->PathId = Bus; UnitInfo->PathId = Bus;
UnitInfo->TargetId = Target; UnitInfo->TargetId = Target;
UnitInfo->Lun = 0; UnitInfo->Lun = Lun;
UnitInfo->InquiryDataLength = INQUIRYDATABUFFERSIZE; UnitInfo->InquiryDataLength = INQUIRYDATABUFFERSIZE;
memcpy(&UnitInfo->InquiryData, memcpy(&UnitInfo->InquiryData,
Srb.DataBuffer, Srb.DataBuffer,
@ -1372,6 +1379,11 @@ ScsiPortInquire(PSCSI_PORT_DEVICE_EXTENSION DeviceExtension)
UnitInfo = (PSCSI_INQUIRY_DATA)((PUCHAR)UnitInfo + sizeof(SCSI_INQUIRY_DATA)+INQUIRYDATABUFFERSIZE-1); UnitInfo = (PSCSI_INQUIRY_DATA)((PUCHAR)UnitInfo + sizeof(SCSI_INQUIRY_DATA)+INQUIRYDATABUFFERSIZE-1);
UnitCount++; UnitCount++;
} }
else if (Lun == 0)
{
break;
}
}
} }
DPRINT("UnitCount: %lu\n", UnitCount); DPRINT("UnitCount: %lu\n", UnitCount);
AdapterInfo->BusData[Bus].NumberOfLogicalUnits = UnitCount; AdapterInfo->BusData[Bus].NumberOfLogicalUnits = UnitCount;