head     56.3;
access   paws bayes jws quist dew jwh;
symbols  ;
locks    ; strict;
comment  @# @;


56.3
date     93.01.27.13.54.16;  author jwh;  state Exp;
branches ;
next     56.2;

56.2
date     93.01.27.12.26.17;  author jwh;  state Exp;
branches ;
next     56.1;

56.1
date     91.11.05.10.02.04;  author jwh;  state Exp;
branches ;
next     55.1;

55.1
date     91.08.25.10.36.53;  author jwh;  state Exp;
branches ;
next     54.1;

54.1
date     91.03.18.15.37.34;  author jwh;  state Exp;
branches ;
next     53.1;

53.1
date     91.03.11.19.35.55;  author jwh;  state Exp;
branches ;
next     52.1;

52.1
date     91.02.19.09.22.02;  author jwh;  state Exp;
branches ;
next     51.1;

51.1
date     91.01.30.16.20.40;  author jwh;  state Exp;
branches ;
next     50.1;

50.1
date     90.10.29.16.34.30;  author jwh;  state Exp;
branches ;
next     49.1;

49.1
date     90.08.14.14.18.10;  author jwh;  state Exp;
branches ;
next     48.1;

48.1
date     90.07.26.11.24.45;  author jwh;  state Exp;
branches ;
next     47.1;

47.1
date     90.05.14.11.11.23;  author dew;  state Exp;
branches ;
next     46.1;

46.1
date     90.05.07.08.58.28;  author jwh;  state Exp;
branches ;
next     45.1;

45.1
date     90.04.19.16.06.18;  author jwh;  state Exp;
branches ;
next     44.1;

44.1
date     90.04.01.22.26.20;  author jwh;  state Exp;
branches ;
next     43.1;

43.1
date     90.03.20.14.16.43;  author jwh;  state Exp;
branches ;
next     42.1;

42.1
date     90.01.23.18.00.18;  author jwh;  state Exp;
branches ;
next     41.2;

41.2
date     90.01.10.15.02.42;  author dew;  state Exp;
branches ;
next     41.1;

41.1
date     89.12.22.11.41.57;  author jwh;  state Exp;
branches ;
next     40.2;

40.2
date     89.10.13.09.58.34;  author dew;  state Exp;
branches ;
next     40.1;

40.1
date     89.09.29.12.03.02;  author jwh;  state Exp;
branches ;
next     39.1;

39.1
date     89.09.26.16.47.57;  author dew;  state Exp;
branches ;
next     1.1;

1.1
date     89.09.14.10.27.18;  author dew;  state Exp;
branches ;
next     ;


desc
@SCSI_ISR is the SCSI Generic Driver Interupt Service Routine.
@


56.3
log
@
pws2rcs automatic delta on Wed Jan 27 13:14:25 MST 1993
@
text
@{
	SCSI ISR handler.

	Contains the SCSI ISR interface.
}
module SCSI_ISR;

import SCSI_DEFS, SCSI_UTILS, OSD_LL, HWI_UTILS, STATE_DRIVE, COMMANDS;

export
	procedure isrScsiISR(Sc:S_TYPE_ISC);
implement

procedure isrScsiISR(Sc:S_TYPE_ISC);
var
	pScBlock:PtrSelectCodeBlockType;
	pSB:PtrSessionBlockType;
	i,j:integer;
	IsrSessionFound:Boolean;
	ResultCode:EventType;
	b:integer;
	mask:integer;
begin
try
	{
	  Find the first session block that is in a run state (only one allowed)
	}
	mask := 0;
	pScBlock := osdGetScBlock(Sc);
	with pScBlock^, PtrScsiChip^  do
	begin
		IsrSessionFound := false;
		i := 0;
		repeat
			pSB := DeviceSessionPtrs[i];
			if pSB <> nil then
			with pSB^, InternalBlock do
			begin
				if (SessionState = SessionRunning) and (ISRWaiting) then
				begin
					IsrSessionFound := true;
					mask := IsrMask;
				end;
			end;
			i := i + 1;
		until (IsrSessionFound) or (i > 7);

		if (not IsrSessionFound) and (ints.ints = Reselected) then
		begin
			i := ord(data_regs.temp) - ord(bdid);
			j := 0;
			while (i <> 1) and (j < 7) do
			begin
				i := osdBitLsR(i, 1);
				j := j + 1;
			end;
			pSB := DeviceSessionPtrs[j];
			if pSB <> nil then
			with pSB^, InternalBlock do
			begin
				if (SessionState = SessionSuspended) and (ISRWaiting) then
				begin
					IsrSessionFound := true;
					mask := IsrMask;
				end;
			end;
		end;

		if (IsrSessionFound) and (mask <> 0) and
		   (osdBitOr(ints.ints, mask) = mask) then
		begin
			{ session isrproc is expecting and can handle the isr }
			StartState(pSB);
		end
		else
		begin
			{
			  Either no session claims ISR or session can't handle it.
			}
			if IsrSessionFound then
			begin
				{
				 session can not handle the isr,
				 kill the session and reset the device
				}
				utlSetInternalErr(pSB, ScsiInteruptErr);
				pSB^.InternalBlock.ISRError := True;
				StartState(pSB);
			end
			else
			begin
				{
				 Reset the Hardware and unlink all sessions.
				}
				cmdSCCleanUp(Sc);
			end;
		end;
	end;
	recover
	begin
		cmdSCCleanUp(Sc);
	end; {recover}
end;

end;
@


56.2
log
@
pws2rcs automatic delta on Wed Jan 27 11:57:27 MST 1993
@
text
@d1 105
@


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@a0 105
{
	SCSI ISR handler.

	Contains the SCSI ISR interface.
}
module SCSI_ISR;

import SCSI_DEFS, SCSI_UTILS, OSD_LL, HWI_UTILS, STATE_DRIVE, COMMANDS;

export
	procedure isrScsiISR(Sc:S_TYPE_ISC);
implement

procedure isrScsiISR(Sc:S_TYPE_ISC);
var
	pScBlock:PtrSelectCodeBlockType;
	pSB:PtrSessionBlockType;
	i,j:integer;
	IsrSessionFound:Boolean;
	ResultCode:EventType;
	b:integer;
	mask:integer;
begin
try
	{
	  Find the first session block that is in a run state (only one allowed)
	}
	mask := 0;
	pScBlock := osdGetScBlock(Sc);
	with pScBlock^, PtrScsiChip^  do
	begin
		IsrSessionFound := false;
		i := 0;
		repeat
			pSB := DeviceSessionPtrs[i];
			if pSB <> nil then
			with pSB^, InternalBlock do
			begin
				if (SessionState = SessionRunning) and (ISRWaiting) then
				begin
					IsrSessionFound := true;
					mask := IsrMask;
				end;
			end;
			i := i + 1;
		until (IsrSessionFound) or (i > 7);

		if (not IsrSessionFound) and (ints.ints = Reselected) then
		begin
			i := ord(data_regs.temp) - ord(bdid);
			j := 0;
			while (i <> 1) and (j < 7) do
			begin
				i := osdBitLsR(i, 1);
				j := j + 1;
			end;
			pSB := DeviceSessionPtrs[j];
			if pSB <> nil then
			with pSB^, InternalBlock do
			begin
				if (SessionState = SessionSuspended) and (ISRWaiting) then
				begin
					IsrSessionFound := true;
					mask := IsrMask;
				end;
			end;
		end;

		if (IsrSessionFound) and (mask <> 0) and
		   (osdBitOr(ints.ints, mask) = mask) then
		begin
			{ session isrproc is expecting and can handle the isr }
			StartState(pSB);
		end
		else
		begin
			{
			  Either no session claims ISR or session can't handle it.
			}
			if IsrSessionFound then
			begin
				{
				 session can not handle the isr,
				 kill the session and reset the device
				}
				utlSetInternalErr(pSB, ScsiInteruptErr);
				pSB^.InternalBlock.ISRError := True;
				StartState(pSB);
			end
			else
			begin
				{
				 Reset the Hardware and unlink all sessions.
				}
				cmdSCCleanUp(Sc);
			end;
		end;
	end;
	recover
	begin
		cmdSCCleanUp(Sc);
	end; {recover}
end;

end;
@


55.1
log
@Automatic bump of revision number for PWS version 3.25A
@
text
@@


54.1
log
@Automatic bump of revision number for PWS version 3.24
@
text
@@


53.1
log
@Automatic bump of revision number for PWS version 3.24B
@
text
@@


52.1
log
@Automatic bump of revision number for PWS version 3.24A
@
text
@@


51.1
log
@Automatic bump of revision number for PWS version 3.24d
@
text
@@


50.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@@


49.1
log
@Automatic bump of revision number for PWS version 3.24b
@
text
@@


48.1
log
@Automatic bump of revision number for PWS version 3.24a
@
text
@@


47.1
log
@Automatic bump of revision number for PWS version 3.23
@
text
@@


46.1
log
@Automatic bump of revision number for PWS version 3.23
@
text
@@


45.1
log
@Automatic bump of revision number for PWS version 3.23C
@
text
@@


44.1
log
@Automatic bump of revision number for PWS version 3.23B
@
text
@@


43.1
log
@Automatic bump of revision number for PWS version 3.23aA
@
text
@@


42.1
log
@Automatic bump of revision number for PWS version 3.23e
@
text
@@


41.2
log
@No longer need the writeln statements that were in this file.
@
text
@@


41.1
log
@Automatic bump of revision number for PWS version 3.23d
@
text
@a29 1
{writeln('Got an isr on select code: ',Sc);}
a71 1
{writeln('Found a session that claims the ISR; Restarting the State Driver');}
a79 1
{writeln('Either no session claims ISR or session can not handle it.');}
a87 1
{writeln('Calling state driver to kill session.');}
a94 1
{writeln('Resetting the hardware');}
a100 2
{writeln('Escape in ISR!!!. escapecode: ', escapecode);}
{writeln('Resetting the hardware');}
@


40.2
log
@Updated to reflect SCSI_DEFS modifications for programmer's interface.
@
text
@@


40.1
log
@Automatic bump of revision number for PWS version 3.23c
@
text
@d38 1
a38 1
			with pSB^.InternalBlock do
d60 1
a60 1
			with pSB^.InternalBlock do
@


39.1
log
@Automatic bump of revision number for PWS version 3.23b
@
text
@@


1.1
log
@Initial revision
@
text
@@
