From: bburk on


I need to be able to get a hardware reset to a SATA device through a SCSI
Storport, Miniport and/or ATA port driver.

You'd think that:
stat = DeviceIoControl(AdapterHandle,
IOCTL_STORAGE_RESET_BUS,
&bus_reset,
sizeof(STORAGE_BUS_RESET_REQUEST),
NULL,
0,
&bytesTransferred,
NULL);

would do the trick, but it doesn't. It issues a hard reset to Fibre Channel
adapters, but no luck on SAS/SATA. It succeeds, but appears to do nothing.

I've also tried a few variants on:
struct {
SRB_IO_CONTROL sic;
SCSI_REQUEST_BLOCK srb;
} ioctl;


errorchk=0;
SetLastError(0);

device[idx]->errorchk=0;
ZeroMemory(&ioctl,sizeof(ioctl));

ioctl.srb.Length = sizeof(SCSI_REQUEST_BLOCK);
ioctl.srb.PathId = device[idx]->bus;
ioctl.srb.TargetId = device[idx]->tid;
ioctl.srb.Lun = device[idx]->lun;
ioctl.srb.TimeOutValue = device[idx]->CDB_TimeOut/1000;
ioctl.srb.Function = SRB_FUNCTION_RESET_BUS;
//SRB_FUNCTION_RESET_DEVICE;

AdapterHandle = HBA_API_Entry[device[idx]->haidx].handle;

SetLastError(0);
stat = DeviceIoControl(AdapterHandle,
IOCTL_SCSI_MINIPORT,
&ioctl,
sizeof(ioctl), &ioctl,
sizeof(ioctl),
&device[idx]->returned,
FALSE);

but these just fail with a status of 0, and a GetLastError() result of 1306.



Any suggestions?