         << LINES .001/.009 ARE RESERVED FOR SYSTEMS INTEGRATION >>     00000001
                                                               <<f9326>>05899010
       << the -1 below is so that the header acts as an      >><<f9326>>05899020
       << ioq entry on the first return after all ioq's are  >><<f9326>>05899030
       << in use.  The index points to the free tail and the >><<f9326>>05899040
       << free head is used as the link word by RETURNIOQ.   >><<f9326>>05899050
                                                               <<f9326>>05899060
      THEN IQH'FREETAIL := IQH'FREEHEAD'INDEX - 1              <<f9326>>05900000
                      << ZERO FREELIST BIT AND PCB # >>        <<*9545>>06409100
                      ELSE ARQX'PCB := 0;                      <<*9545>>06410000
                                                               <<f9326>>06429010
       << the -1 below is so that the header acts as an      >><<f9326>>06429020
       << drq entry on the first return after all drq's are  >><<f9326>>06429030
       << in use.  The index points to the free tail and the >><<f9326>>06429040
       << free head is used as the link word by RETURNDRQ.   >><<f9326>>06429050
                                                               <<f9326>>06429060
      THEN  AQH'FREETAIL :=  AQH'FREEHEAD'INDEX - 1            <<f9326>>06430000
INTEGER PROCPRI; <<CPU PRIORITY FROM PCB ENTRY>>               <<Q9366>>08512000
                                                               <<Q9366>>08513000
EQUATE ICS'CSCHEDBASECELL = %43;                               <<Q9366>>08514000
   PROCPRI := LPCB(CURPRC + QUEUEINGINFOWORDNUM).PRIFIELD;     <<Q9366>>09260000
   IF LPCB(CURPRC + RESABORTINFOWORDNUM).HASSIRFLAG AND        <<Q9366>>09261000
      PROCPRI > ICS(-ICS'CSCHEDBASECELL) THEN                  <<Q9366>>09262000
      PROCPRI := ICS(-ICS'CSCHEDBASECELL); <<IF THE PROCESS>>  <<Q9366>>09263000
      <<IS RUNNING IN NON-LINEAR QUEUE AND HOLDING A SIR >>    <<Q9366>>09264000
      <<THEN ITS PRIORITY WILL BE AT THE PRIORITY OF C BASE>>  <<Q9366>>09264100
   DRQ'URGCLAS := PROCPRI;                                     <<Q9366>>09265000
$PAGE "CHECK'FOR'DEVREC;checks devices that should be AVR'd."  <<s9286>>14497000
logical procedure CHECK'FOR'DEVREC(LDEV, PARM);                <<s9286>>14498000
                                                               <<s9286>>14499000
value   LDEV,        << logical device              >>         <<s9286>>14500000
        PARM;        << DEVREC invocation parameter >>         <<s9286>>14501000
logical LDEV,                                                  <<s9286>>14502000
        PARM;                                                  <<s9286>>14503000
option  PRIVILEGED, UNCALLABLE;                                <<s9286>>14504000
begin                                                          <<s9286>>14505000
                                                               <<s9286>>14506000
COMMENT                                                        <<s9286>>14507000
                                                               <<s9286>>14508000
   CHECK'FOR'DEVREC is called to determine whether a particular<<s9286>>14509000
logical device (LDEV) should be AVR'd or already has been      <<s9286>>14510000
AVR'd.                                                         <<s9286>>14511000
                                                               <<s9286>>14512000
   CHECK'FOR'DEVREC returns TRUE if the device should be AVR'd.<<s9286>>14513000
FALSE is returned if the device cannot be AVR'd or already has <<s9286>>14514000
been AVR'd.                                                    <<s9286>>14515000
                                                               <<s9286>>14516000
   CHECK'FOR'DEVREC will perform an AWAKE on DEVREC if         <<s9286>>14517000
PARM.(15:1) = 1.                                               <<s9286>>14518000
                                                               <<s9286>>14519000
   RECOGNIZE'DEVICE is an entry point used by SIODM calls      <<s9286>>14520000
to CHECK'FOR'DEVREC. Note that DB is not changed for entry     <<s9286>>14521000
point RECOGNIZE'DEVICE.                                        <<s9286>>14521010
                                                               <<s9286>>14522000
   If primary entry point CHECK'FOR'DEVREC is used then DB     <<s9286>>14523000
will be set to SYSDB upon entry then reset back to the         <<s9286>>14524000
Callers' DB and DB Bank before exiting.                        <<s9286>>14524010
                                                               <<s9286>>14525000
   Procedures called are AWAKE, SETSYSDB & RESETDB.            <<s9286>>14526000
                                                               <<s9286>>14527000
                                                               <<s9286>>14528000
   LDEV  -  logical device to check for AVR capability.        <<s9286>>14529000
   PARM  -  notifies CHECK'FOR'DEVREC whether to do an AWAKE   <<s9286>>14530000
            on DEVREC.                                         <<s9286>>14531000
                                                               <<s9286>>14532000
TABLES referenced:                                             <<s9286>>14533000
                                                               <<s9286>>14534000
   LPDT  -  contains device subtype, device recognition state  <<s9286>>14535000
            and the pointer to the Device Information Table.   <<s9286>>14536000
   DIT   -  contains pointer to Driver Linkage Table.          <<s9286>>14537000
   DLT   -  contains device type.                              <<s9286>>14538000
                                                               <<s9286>>14539000
;  << end of comment >>                                        <<s9286>>14540000
                                                               <<s9286>>14541000
                                                               <<s9286>>14542000
                                                               <<s9286>>14543000
                                                               <<s9286>>14544000
                                                               <<s9286>>14545000
define                                                         <<s9286>>14546000
   WAKE'DEVREC = PARM.(15:1)#; << if set and have an AVR   >>  <<s9286>>14547000
                               << device that hasn't been  >>  <<s9286>>14548000
                               << AVR'd then AWAKE DEVREC. >>  <<s9286>>14549000
                                                               <<s9286>>14550000
logical                                                        <<s9286>>14551000
   LPDT'INDEX,                 << used to peg the LPDT     >>  <<s9286>>14552000
   CALL'FROM'SIODM,            << SIODM entry point flag   >>  <<s9286>>14553000
   RET'VALUE;                  << value to return          >>  <<s9286>>14554000
                                                               <<s9286>>14555000
integer                                                        <<s9286>>14556000
   TYPE,                       << device type              >>  <<s9286>>14557000
   SUBTYPE,                    << device subtype           >>  <<s9286>>14558000
   OLDDB;                      << callers' return DB parm  >>  <<s9286>>14559000
                                                               <<s9286>>14560000
logical pointer                                                <<s9286>>14561000
   DITP,                       << Device Information Table >>  <<s9286>>14562000
   DLTP;                       << Driver Linkage Table     >>  <<s9286>>14563000
                                                               <<s9286>>14564000
entry                                                          <<s9286>>14565000
   RECOGNIZE'DEVICE;           << entry for SIODM          >>  <<s9286>>14566000
                                                               <<s9286>>14567000
                                                               <<s9286>>14568000
                                                               <<s9286>>14569000
                                                               <<s9286>>14570000
<<*********************************************************>>  <<s9286>>14570010
<<                                                         >>  <<s9286>>14570020
<< Note that DB only gets changed to SYSDB and reset back  >>  <<s9286>>14570030
<< to the callers' DB and DB Bank if this procedure is     >>  <<s9286>>14570040
<< entered through primary entry point CHECK'FOR'DEVREC.   >>  <<s9286>>14570050
<<                                                         >>  <<s9286>>14570060
<<*********************************************************>>  <<s9286>>14570070
                                                               <<s9286>>14571000
OLDDB := SETSYSDB;             << save callers environment >>  <<s9286>>14572000
CALL'FROM'SIODM := FALSE;      << set SIODM entry flag     >>  <<s9286>>14573000
goto COMMON'START;             << primary entry point      >>  <<s9286>>14574000
                                                               <<s9286>>14575000
RECOGNIZE'DEVICE:              << SIODM's entry point      >>  <<s9286>>14576000
                                                               <<s9286>>14577000
CALL'FROM'SIODM := TRUE;       << set entry point flag     >>  <<s9286>>14578000
                                                               <<s9286>>14579000
COMMON'START:                  << back to common code      >>  <<s9286>>14580000
                                                               <<s9286>>14581000
                                                               <<s9286>>14582000
<< peg the LPDT and set up pointers, variables >>              <<s9286>>14583000
                                                               <<s9286>>14584000
LPDT'INDEX := LDEV * LPDT'ENTRY'SIZE;                          <<s9286>>14585000
@DITP := LPDT'DIT'PTR;             << set DIT from LPDT >>     <<s9286>>14586000
@DLTP := DITP(DDLTP);              << set DLT from DIT  >>     <<s9286>>14587000
TYPE := DLTP(DSIZE).DEVTYPE;       << device type       >>     <<s9286>>14588000
SUBTYPE := LPDT'SUBTYPE;           << device subtype    >>     <<s9286>>14589000
RET'VALUE := FALSE;                << set return value  >>     <<s9286>>14590000
                                                               <<s9286>>14591000
<<                                                      >>     <<s9286>>14592000
<< Don't bother DEVREC if the device is "mounted" or    >>     <<s9286>>14593000
<< the System isn't UP yet or PVPROC is making this     >>     <<s9286>>14594000
<< request. Only if SIODM didn't make this call.        >>     <<s9286>>14595000
<<                                                      >>     <<s9286>>14596000
                                                               <<s9286>>14597000
if not CALL'FROM'SIODM and                                     <<s9286>>14598000
   (LPDT'RDY'SER'FRN'DISC or not SYSUP or (CURPRC=PVPROCPCBP)) <<s9286>>14599000
   then goto FORGET'IT;                                        <<s9286>>14600000
                                                               <<s9286>>14601000
if (LPDT'DATA'ACCEPT or LPDT'JOB'ACCEPT) and                   <<s9286>>14602000
   (LPDT'DEV'OWN'STATE = LPDT'NOT'OWNED) then RET'VALUE:=TRUE  <<s9286>>14603000
                                                               <<s9286>>14604000
else if (LPDT'DEV'OWN'STATE = LPDT'NOT'OWNED) and              <<s9286>>14605000
   AVR and MAGTAPE then RET'VALUE := TRUE                      <<s9286>>14606000
                                                               <<s9286>>14607000
else if 0 <= TYPE <= 3 then                                    <<s9286>>14608000
   case *TYPE of                                               <<s9286>>14609000
      begin << TYPE cases >>                                   <<s9286>>14610000
                                                               <<s9286>>14611000
      <<0>> begin  << 13037 disc family >>                     <<s9286>>14612000
            if LPDT'NON'SYS'DOMAIN = 1 then RET'VALUE := TRUE  <<s9286>>14613000
            else if (SUBTYPE = 5) or (SUBTYPE = 11)            <<s9286>>14614000
               then RET'VALUE := TRUE;                         <<s9286>>14615000
            end;   << 13037 disc family >>                     <<s9286>>14616000
                                                               <<s9286>>14617000
      <<1>> begin  << 2660 disc drive   >>                     <<s9286>>14618000
            end;   << 2660 disc drive   >>                     <<s9286>>14619000
                                                               <<s9286>>14620000
      <<2>> begin  << Floppy disc drive >>                     <<s9286>>14621000
            RET'VALUE := TRUE;                                 <<s9286>>14622000
            end;   << Floppy disc drive >>                     <<s9286>>14623000
                                                               <<s9286>>14624000
      <<3>> begin  << CS 80 devices     >>                     <<s9286>>14625000
            if LPDT'NON'SYS'DOMAIN = 1 then RET'VALUE := TRUE; <<s9286>>14626000
            end;   << CS 80 devices     >>                     <<s9286>>14627000
                                                               <<s9286>>14628000
      end;  << case of *TYPE >>                                <<s9286>>14629000
                                                               <<s9286>>14630000
if RET'VALUE and                                               <<s9286>>14631000
   (  (LPDT'DEV'OWN'STATE = LPDT'NOT'OWNED)                    <<s9286>>14632000
                    or                                         <<s9286>>14633000
   (LPDT'DEV'OWN'STATE = LPDT'OWNED)  ) then                   <<s9286>>14634000
   begin                                                       <<s9286>>14635000
   if WAKE'DEVREC then                                         <<s9286>>14636000
      begin                                                    <<s9286>>14637000
      DISABLE;        << disable interrupts >>                 <<s9286>>14638000
                                                               <<s9286>>14639000
      <<                                               >>      <<s9286>>14640000
      << set service requested & bump serv. req. count >>      <<s9286>>14641000
      << reset interrupt ack. if request from SIODM    >>      <<s9286>>14642000
      <<                                               >>      <<s9286>>14643000
                                                               <<s9286>>14644000
      LPDT'DEV'OWN'STATE := LPDT'SERVICE'REQ;                  <<s9286>>14645000
      LPDT'SERV'REQ'COUNT := LPDT'SERV'REQ'COUNT + 1;          <<s9286>>14646000
      if CALL'FROM'SIODM then DITP.IAK := 0;                   <<s9286>>14647000
                                                               <<s9286>>14648000
      ENABLE;         << enable interrupts >>                  <<s9286>>14649000
      AWAKE(DEVRECPCBP, JUNKWAIT, NOWAIT); << wake DEVREC >>   <<s9286>>14650000
      end;  << if WAKE'DEVREC >>                               <<s9286>>14651000
   end   << if RET'VALUE, etc. >>                              <<s9286>>14652000
else RET'VALUE := FALSE;                                       <<s9286>>14653000
                                                               <<s9286>>14654000
FORGET'IT:                                                     <<s9286>>14655000
                                                               <<s9286>>14656000
CHECK'FOR'DEVREC := RET'VALUE; << give caller return value >>  <<s9286>>14657000
                                                               <<s9286>>14658000
if not CALL'FROM'SIODM then RESETDB(OLDDB);  << restore DB >>  <<s9286>>14659000
end;  << CHECK'FOR'DEVREC >>                                   <<s9286>>14660000
DEFINE                                                         <<09419>>14811000
   DRIVER'CONTROLS'AVR = LOGICAL (DITP(DUNIT).(3:1)) #;        <<09419>>14812000
$EDIT VOID = 15090000                                          <<s9286>>15070000
   LDEV     = DITP(DLDEV)#,                                    <<s9286>>15125100
$EDIT VOID = 15740000                                          <<s9286>>15380000
      IF X <> -1 THEN                                          <<C9352>>15925000
                                                               <<09419>>16330100
COMMENT --                                                     <<09419>>16330200
  Usually an interrupt of an idle CP means a device  has  gone <<09419>>16330300
on  or  off line.  For non-system domain discs, PVPROC manages <<09419>>16330400
the table entries associated with these  events.  Trouble  is, <<09419>>16330500
CS80 devices can interrupt the idle CP for other reasons (such <<09419>>16330600
as a release request for internal maintenance or operator  un- <<09419>>16330700
load).  Until now, these interrupts also caused PVPROC to run, <<09419>>16330800
and it was up to PVPROC and the driver to make sure these  in- <<09419>>16330900
terrupts  were  ignored.  With  this change, drivers which are <<09419>>16331000
smart enough to know the difference between  on/off  line  and <<09419>>16331100
internal  interrupts  can cause SIODM to bypass State 6 (unex- <<09419>>16331200
pected interrupt) and go directly to State 0 (Start  Request). <<09419>>16331300
This  implies  that the driver will return to State 6 when PV- <<09419>>16331400
PROC should be scheduled, and to some other  state  (typically <<09419>>16331500
State 5 (Request Complete)) at other times.                    <<09419>>16331600
;                                                              <<09419>>16331700
IF STATE = 6 AND DRIVER'CONTROLS'AVR THEN                      <<09419>>16331800
   DITP.STATEF := STATE := 0;                                  <<09419>>16331900
   << check if valid device to AVR and if it is then >>        <<s9286>>19945000
   << wake up DEVREC to do the work.                 >>        <<s9286>>19950000
                                                               <<s9286>>19955000
   RECOGNIZE'DEVICE(LDEV, DEVREC'WAKE);                        <<s9286>>19960000
$EDIT VOID = 20015000                                          <<s9286>>19965000
   STATE := IF STATE = %16 THEN 0 ELSE 3;                      <<I9166>>20400000
$EDIT VOID = 20971685                                          <<s9286>>20971000
$PAGE "REQUEST STATUS FROM DISC DEVICES"                                20975000
                                                               <<s9286>>21291000
         IF X <> -1 THEN                                       <<C9352>>28160000
