$PAGE "MPE TABLE ACCESS:  LOGICAL/PHYSICAL DEVICE TABLE (LPDT)"         00001000
<<**********************************************************>>          00002000
<<*                                                        *>>          00003000
<<*                INCLLPDT - Module xx                    *>>          00004000
<<*                    MPE4 version                        *>>          00005000
<<*                                                        *>>          00006000
<<**********************************************************>>          00007000
                                                                        00008000
$IF X8 = OFF                                                            00009000
$CONTROL NOLIST                                                         00010000
$IF                                                                     00011000
COMMENT --                                                              00012000
                                                                        00013000
LOGICAL-TO-PHYSICAL DEVICE TABLE (LPDT)                                 00014000
---------------------------------------                                 00015000
                                                                        00016000
DST = 13 (= %15)                                                        00017000
SIR =  9 (= %11)                                                        00018000
                                                                        00019000
  The LPDT has several fields which describe the  state  of  a          00020000
device. Some of these fields have the same meaning for all de-          00021000
vices.  Others are device dependent.  All are described below.          00022000
  The LPDT is one of the most popular--and most abused--tables          00023000
in MPE.  The chief reason for its popularity  is  that  it  is          00024000
main-memory  resident  and  has its own SYSDB-relative pointer          00025000
(SYSDB + 8, or absolute location %1010).  A designer who wants          00026000
to check some device  attribute  knows  that  the  attribute's          00027000
field  need  not  be brought in from disc if it is kept in the          00028000
LPDT.  This has led to cramming entirely too much  information          00029000
into the present two-word entry. A third word would do much to          00030000
relieve the crowding, but in addition to taking up  more  main          00031000
memory  there are many modules which access the LPDT as a dou-          00032000
ble array.  All these modules would need changing.                      00033000
  There are two types of devices represented in the LPDT: real          00034000
devices and virtual devices.  A real device is one  which  has          00035000
been  configured  into the system and is capable of performing          00036000
input and/or output.  A virtual device simulates some  of  the          00037000
properties of a real device (for example a spooled line print-          00038000
er or an INP), but there is no physical I/O involved.  The two          00039000
main uses for virtual devices are for OPEN spooled devicefiles          00040000
and certain communication devices (such as INP's).                      00041000
  A given virtual device entry is in use only  while  the  de-          00042000
vicefile it represents is open.  When the file is FCLOSEd, the          00043000
entry becomes available for another virtual  device.  This  is          00044000
the reason for the SYSDUMP/INITIAL configurator question MAX #          00045000
OF OPEN SPOOLFILES--it needs to know how many  virtual  device          00046000
entries to allocate to the LPDT (and to the LDT).                       00047000
  Entries in the LPDT are ordered by  logical  device  number.          00048000
The  first  word address of a real device entry is obtained by          00049000
multiplying the LDN by the entry size.  Except for the 0th en-          00050000
try, entries for which no logical device is  configured  on  a          00051000
given system are used for virtual device entries.  Any remain-          00052000
ing virtual device entries follow the last real device entry.           00053000
$PAGE                                                                   00054000
                       Entry 0                                          00055000
                       -------                                          00056000
                                                                        00057000
    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15                      00058000
  +--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--+                     00059000
 0|    Highest entry #    |     Entry size = 2    |                     00060000
  +-----------------------+-----------------------+                     00061000
 1|         DEVREC service request count          |                     00062000
  +-----------------------------------------------+                     00063000
                                                                        00064000
Discussion:                                                             00065000
  Word 1 is incremented by a device driver  whenever  it  sets          00066000
the  Device  Ownership  State  field (below) to 2 (Service Re-          00067000
quested).  DEVREC decrements the count for each  interrupt  it          00068000
services  until  the count reaches 0, at which time DEVREC hi-          00069000
bernates.                                                               00070000
                       -- CAUTION --                                    00071000
         Device drivers must lock this table by  DIS-                   00072000
         ABLE/ENABLEing,  -NOT-  by trying to acquire                   00073000
         the LPDT SIR.                                                  00074000
                                                                        00075000
                                                                        00076000
          Typical entry (virtual devices)                               00077000
          -------------------------------                               00078000
                                                                        00079000
    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15                      00080000
  +--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--+                     00081000
 0| 1|IO|        Pointer to XDD subentry          |                     00082000
  +--+--+--+--+--+--+--+--------+--+--+-----------+                     00083000
 1|     |  |  |  |  |  |        |  |  |           |                     00084000
  +-----+--+--+--+--+--+--------+--+--+-----------+                     00085000
                                                                        00086000
IO -- 0 for output, 1 for input.                                        00087000
                                                                        00088000
Word 0, bit 0 is 1 for a virtual device, 0 for a real  device.          00089000
The  fields  in word 1 are the same, as applicable, as for the          00090000
real device represented by a given virtual device.  See below.          00091000
                                                                        00092000
                                                                        00093000
          Typical entry (all real devices)                              00094000
          --------------------------------                              00095000
                                                                        00096000
    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15                      00097000
  +--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--+                     00098000
 0| 0|     SYSDB-relative pointer to the DIT      |                     00099000
  +--+--+--+--+--+--+--+--------+--+--+-----------+                     00100000
  |Devc | J|Da|  | D| I| End of |  |  |Au: Device |                     00101000
 1|Owned| o|ta|  | u| n|  File  |  |  |to: Subtype|                     00102000
  |State| b|  |  | p| t|Cndition|  |  |  :        |                     00103000
  +-----+--+--+--+--+--+--------+--+--+-----------+                     00104000
$PAGE                                                                   00105000
Discussion:                                                             00106000
  Word 1.( 0:2) -- Device Ownership State:                              00107000
                   0 -- Not owned by any process.                       00108000
                   1 -- Owned by a process.                             00109000
                   2 -- Service requested.  Set by driver  for          00110000
                        unexpected  interrupt, then wakes DEV-          00111000
                        REC.                                            00112000
                   3 -- Service granted.  Set by DEVREC. Logon          00113000
                        sequence is 0-2-3-1.                            00114000
                   3 -- Device reserved (alternate  use).  Set          00115000
                        during   STARTSPOOL,  spooler  process          00116000
                        sets to 1 when it gets started.                 00117000
  Word 1.( 2:1) -- Device is Job/Session Accepting if true.             00118000
  Word 1.( 3:1) -- Device is Data Accepting if true.                    00119000
  Word 1.( 5:1) -- Device is Duplicative if true (all  devices          00120000
                   except discs).                                       00121000
  Word 1.( 6:1) -- Device is Interactive if true (all  devices          00122000
                   except discs).                                       00123000
  Word 1.( 7:3) -- End of File condition:                               00124000
                   0 -- No EOF detected.                                00125000
                   1 -- Hardware EOF (e.g., tape mark).                 00126000
                   2 -- :DATA  record read.                             00127000
                   3 -- :EOD   record read.                             00128000
                   4 -- :HELLO record read.                             00129000
                   5 -- :BYE   record read.                             00130000
                   6 -- :JOB   record read.                             00131000
                   7 -- :EOJ   record read.                             00132000
  Word 1.(12:4) -- Device subtype. See discussion for tape en-          00133000
                   try (below) for a description of  the  Auto          00134000
                   bit (12:1).                                          00135000
  The remaining bits in Word 1 are  device-dependent  and  are          00136000
described with their corresponding entry diagram.                       00137000
                                                                        00138000
                                                                        00139000
          Entry for terminal-like devices                               00140000
          -------------------------------                               00141000
                                                                        00142000
    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15                      00143000
  +--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--+                     00144000
 0| 0|     SYSDB-relative pointer to the DIT      |                     00145000
  +--+--+--+--+--+--+--+--------+--+--+-----------+                     00146000
  |Devc | J|Da|Ct| D| I| End of | B| L|    Device |                     00147000
 1|Owned| o|ta|lY| u| n|  File  | r| o|    Subtype|                     00148000
  |State| b|  |  | p| t|Cndition| k| g|           |                     00149000
  +-----+--+--+--+--+--+--------+--+--+-----------+                     00150000
                                                                        00151000
Discussion (unique fields only):                                        00152000
  Word 1.( 4:1) -- CONTROL-Y is allowed and has been detected.          00153000
  Word 1.(10:1) -- BREAK has been detected -OR-  ignore  BREAK          00154000
                   if the C.I. is running.                              00155000
  Word 1.(11:1) -- The terminal is logging on. This bit is set          00156000
                   by  PROGEN  and  DEVREC  when the logon se-          00157000
                   quence starts.  If  the  bit  is  off  when          00158000
                   polled  by  INITJSMP, the terminal has dis-          00159000
                   connected.  For now, only IOTERM0 and  HIO-          00160000
                   TERM0  support the use of this bit.  Multi-          00161000
                   point and DS pseudo-terminals do not.                00162000
$PAGE                                                                   00163000
               Entry for tape drives                                    00164000
               ---------------------                                    00165000
                                                                        00166000
    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15                      00167000
  +--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--+                     00168000
 0| 0|     SYSDB-relative pointer to the DIT      |                     00169000
  +--+--+--+--+--+--+--+--------+--+--+-----------+                     00170000
  |Devc | J|Da| B| D| I| End of |  | A|Au: Device |                     00171000
 1|Owned| o|ta| O| u| n|  File  |  | V|to: Subtype|                     00172000
  |State| b|  | T| p| t|Cndition|  | R|  :        |                     00173000
  +-----+--+--+--+--+--+--------+--+--+-----------+                     00174000
                                                                        00175000
Discussion (unique fields only):                                        00176000
  Word 1.( 4:1) -- BOT.  Tape is at Load Point  -OR-  no  tape          00177000
                   mounted.  Recording  density  may  only  be          00178000
                   switched when this bit is true (for  multi-          00179000
                   ple density tape drives).                            00180000
  Word 1.(11:1) -- If true,  DEVREC  is  performing  Automatic          00181000
                   Volume  Recognition  (AVR)  on  a  tape (or          00182000
                   PVPROC is doing the same on a serial disc),          00183000
                   -OR- AVR is to be suppressed on job or data          00184000
                   accepting devices.                                   00185000
  Word 1.(12:1) -- Part of Device Subtype field.  If true, de-          00186000
                   vice  is   allocated   automatically   when          00187000
                   opened.  If false, operator must allocate.           00188000
                                                                        00189000
               Entry for disc drives                                    00190000
               ---------------------                                    00191000
                                                                        00192000
    0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15                      00193000
  +--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--+                     00194000
 0| 0|     SYSDB-relative pointer to the DIT      |                     00195000
  +--+--+--+--+--+--+--+--------+--+--+-----------+                     00196000
  |Devc | J|Da| N|Mt|RV| End of | S| F|    Device |                     00197000
 1|Owned| o|ta| S|d |  |  File  |or| o|    Subtype|                     00198000
  |State| b|  | D|PV|  |Cndition| F| r|           |                     00199000
  +-----+--+--+--+--+--+--------+--+--+-----------+                     00200000
                                                                        00201000
Discussion (unique fields only):                                        00202000
  Word 1.( 0:2) -- Device  Ownership  State.  May  not  be   1          00203000
                   (owned) for shared device (system volume or          00204000
                   private volume).  Serial and foreign  discs          00205000
                   are non-sharable and may be owned.  See the          00206000
                   full discussion of this field under Typical          00207000
                   Entry, above.                                        00208000
  Word 1.( 4:1) -- If true, the disc is  a  non-system  domain          00209000
                   (private  volume,  serial  disc  or foreign          00210000
                   disc) disc drive.                                    00211000
  Word 1.( 5:1) -- If true, disc is a mounted private volume.           00212000
  Word 1.( 6:1) -- If true, the disc is a reserved volume used          00213000
                   to satisfy the requirements of a  multiple-          00214000
                   volume private volume set.                           00215000
  Word 1.(10:1) -- If true, the disc is a physically and logi-          00216000
                   cally mounted serial or foreign disc.  Bits          00217000
                   5 and 6 must be false.                               00218000
  Word 1.(11:1) -- If bit 10 is true, then 1 ==> foreign disc,          00219000
                   0 ==> serial disc.                                   00220000
$PAGE                                                                   00221000
$IF X8 = OFF                                                            00222000
$CONTROL LIST                                                           00223000
$IF                                                                     00224000
             *-*-*-*-*-*-*-*-*-*-*-*-*-*-*                              00225000
             |  Declarations start here  |                              00226000
             *-*-*-*-*-*-*-*-*-*-*-*-*-*-*                              00227000
                                                                        00228000
Conventions used in the declarations:                                   00229000
1.  The LPDT is referenced via the system pointer at  absolute          00230000
    location  %1010.  The pointer is declared in this $INCLUDE          00231000
    file.                                                               00232000
2.  We assume the existence of an offset integer,  LPDT'INDEX,          00233000
    to  access a particular LPDT entry.  LPDT'INDEX would nor-          00234000
    mally be set to LDEV# * LPDT'ENTRY'SIZE.                            00235000
3.  Each DEFINE is prefixed by LPDT'... to distinguish it from          00236000
    references to other MPE tables.                                     00237000
4.  DEFINEs of fields are  listed  alphabetically  for  easier          00238000
    lookup without using XREF. DEFINEs of states of fields are          00239000
    listed sequentially following the field DEFINE.  The  com-          00240000
    ment field indicates for which device(s) a symbol is rele-          00241000
    vant, according to the following code:                              00242000
       ABD -- All But Disc           TAP -- tape                        00243000
       ALL -- all devices            TRM -- terminal                    00244000
       DSC -- all discs              VDV -- virtual devices             00245000
       NSD -- non-system domain discs                                   00246000
;                                                                       00247000
$IF X6 = OFF                                                            00248000
                                                                        00249000
LOGICAL POINTER                                                         00250000
   LPDT                   =   8;                                        00251000
                                                                        00252000
$IF                                                                     00253000
                                                                        00254000
EQUATE                                                                  00255000
   LPDT'DST               = %15,                                        00256000
   LPDT'SIR               = %11,                                        00257000
   LPDT'MPE'VERSION       =   4,                                        00258000
                                                                        00259000
<< The following EQUATE must be changed if the length of an >>          00260000
<< LPDT entry changes.                                      >>          00261000
                                                                        00262000
   SIZE'OF'LPDT'ENTRY     =   2;                                        00263000
$PAGE                                                                   00264000
DEFINE                                                                  00265000
   LPDT'AUTO'ALLOC        = LPDT(LPDT'INDEX+1).(12:1)#,<<TAP>>          00266000
   LPDT'AUTO'SUBTYPE      = LPDT(LPDT'INDEX+1).(13:3)#,<<TAP>>          00267000
   LPDT'BREAK             = LPDT(LPDT'INDEX+1).(10:1)#,<<TRM>>          00268000
   LPDT'CONTROL'Y         = LPDT(LPDT'INDEX+1).(4:1) #,<<TRM>>          00269000
   LPDT'DATA'ACCEPT       = LPDT(LPDT'INDEX+1).(3:1) #,<<ALL>>          00270000
   LPDT'DEV'OWN'STATE     = LPDT(LPDT'INDEX+1).(0:2) #,<<ALL>>          00271000
      LPDT'NOT'OWNED      = 0                        #,                 00272000
      LPDT'OWNED          = 1                        #,                 00273000
      LPDT'SERVICE'REQ    = 2                        #,                 00274000
      LPDT'SERVICE'OK     = 3                        #,                 00275000
      LPDT'RESERVED       = 3                        #,                 00276000
   LPDT'DIT'PTR           = LPDT(LPDT'INDEX+0).(1:15)#,<<ALL>>          00277000
   LPDT'DUPLICATIVE       = LPDT(LPDT'INDEX+1).(5:1) #,<<ABD>>          00278000
   LPDT'ENTRY'SIZE        = LPDT(0).(8:8)            #,                 00279000
   LPDT'EOF'TYPE          = LPDT(LPDT'INDEX+1).(7:3) #,<<ALL>>          00280000
      LPDT'NO'EOF         = 0                        #,                 00281000
      LPDT'HARDWARE'EOF   = 1                        #,                 00282000
      LPDT'DATA           = 2                        #,                 00283000
      LPDT'EOD            = 3                        #,                 00284000
      LPDT'HELLO          = 4                        #,                 00285000
      LPDT'BYE            = 5                        #,                 00286000
      LPDT'JOB            = 6                        #,                 00287000
      LPDT'EOJ            = 7                        #,                 00288000
   LPDT'INTERACTIVE       = LPDT(LPDT'INDEX+1).(6:1) #,<<ABD>>          00289000
   LPDT'JOB'ACCEPT        = LPDT(LPDT'INDEX+1).(2:1) #,<<ALL>>          00290000
   LPDT'LOAD'POINT        = LPDT(LPDT'INDEX+1).(4:1) #,<<TAP>>          00291000
   LPDT'LOGGING'ON        = LPDT(LPDT'INDEX+1).(11:1)#,<<TRM>>          00292000
   LPDT'MAX'ENTRIES       = LPDT(0).(0:8)            #,                 00293000
   LPDT'MOUNTED'PV        = LPDT(LPDT'INDEX+1).(5:1) #,<<NSD>>          00294000
   LPDT'NON'SYS'DOMAIN    = LPDT(LPDT'INDEX+1).(4:1) #,<<DSC>>          00295000
   LPDT'NOT'PV'OR'SYS     = LPDT(LPDT'INDEX+1).(4:3) = 4#,              00296000
   LPDT'RDY'SER'FRN'DISC  = LPDT(LPDT'INDEX+1).(10:1)#,<<NSD>>          00297000
   LPDT'RESERVED'PV       = LPDT(LPDT'INDEX+1).(6:1) #,<<NSD>>          00298000
   LPDT'SERIAL'OR'FOREIGN = LPDT(LPDT'INDEX+1).(11:1)#,<<NSD>>          00299000
      LPDT'SERIAL         = 0                        #,                 00300000
      LPDT'FOREIGN        = 1                        #,                 00301000
   LPDT'SERV'REQ'COUNT    = LPDT(1)                  #,                 00302000
   LPDT'SUBTYPE           = LPDT(LPDT'INDEX+1).(12:4)#,<<ALL>>          00303000
   LPDT'TAPE'AVR          = LPDT(LPDT'INDEX+1).(11:1)#,<<TAP>>          00304000
   LPDT'VDEV'DIRECTION    = LPDT(LPDT'INDEX+0).(1:1) #,<<VDV>>          00305000
      LPDT'VDEV'INPUT     = 0                        #,                 00306000
      LPDT'VDEV'OUTPUT    = 1                        #,                 00307000
   LPDT'VIRTUAL'DEVICE    = LPDT(LPDT'INDEX+0).(0:1) #,<<VDV>>          00308000
   LPDT'XDD'SUBENTRY'PTR  = LPDT(LPDT'INDEX+0).(2:14)#;<<VDV>>          00309000
                                                                        00310000
COMMENT --                                                              00311000
<<**********************************************************>>          00312000
<<*                                                        *>>          00313000
<<*                    END INCLLPDT                        *>>          00314000
<<*                                                        *>>          00315000
<<**********************************************************>>          00316000
;                                                                       00317000
