[fa.info-vax] AST queueing from VMS device drivers

info-vax (12/08/82)

>From lars@ACC  Tue Dec  7 18:30:44 1982
Mail-From: ARPANET host ACC rcvd at 7-Dec-82 0831-PST
To: info-vax@sri-csl
Remailed-Date:  7 Dec 1982 0928-PST
Remailed-From: the tty of Geoffrey S. Goodfellow  <Geoff5 at SRI-CSL>
Remailed-To: Info-VAX@SRI-CSL: ;

I am writing a VAX/VMS device driver, which occasionally needs to issue
ASTs to the owner of the device in order to announce unsolicited input.
By reading the I/O User's Manual, it would appear that
     a) the original VMS style of doing this would be to send a
	message from the driver to an associated mailbox
     b) a more recent style would be to allow a special i/o
	function code to mean "enable special asts to the following
	address".
I am going to peruse the TTDRIVER (class driver) microfiche to find
out what is involved in either. Does anyone have experience with either
technique and/or have helpful hints, examples or pointers ?

Lars Poulsen
Associated Computer Consultants

----

info-vax (12/10/82)

>From rice!wert@lbl-unix  Fri Dec 10 02:50:06 1982
Mail-From: ARPANET host LBL-UNIX rcvd at 9-Dec-82 1324-PST
To: rice!lbl-unix!lars@ACC
Cc: rice!lbl-unix!info-vax@sri-csl
In-Reply-To: lars's message of 7 Dec 1982 at 0830-PST
Remailed-Date:  9 Dec 1982 2209-PST
Remailed-From: the tty of Geoffrey S. Goodfellow  <Geoff5 at SRI-CSL>
Remailed-To: Info-VAX@SRI-CSL: ;

If all you want to do is issue an AST to the process, you can do this
from one of two modes:

1) The first mode operates as follows:

The process issues a qio call which causes the creation of an attention
AST. When the device driver decides that an attention condition exists,
the list of attention ASTs is delivered to all processes with requests.
This list is flushed; that is, each process has to reenable the
attention AST to obtain futher notifications. This is the mode in which
the control C attentions are handled. 

There are several VMS supplied routines to handle this mode (see the
routines COM$SETATTNAST, COM$DELATTNAST, COM$FLUSHATTNS).

2) The second mode works as follows (this is harder):

The process enables (once) an AST to be delivered during device
attention conditions. This enable will last for the entire life of the
channel. When a device attention condition arises, an ACB is constructed
and delivered to the process. This method is harder because an ACB
cannot be allocated from non-paged pool while at device IPL. But, it
could be done by dropping to device driver IPL (the software levels)
by one of various schemes.

The preferred method is (1). It is easier, and it gets around recursion
in device attention handlers. I have a driver for a pseudo device which
we use to deliver "signals" to processes which wish to receive them. It
uses a variant of (1), except that it does the work by hand. We use it
in our unix emulation that we are developing here. I could send it to
you, if you wish an example.

Most of this information comes from the "VAX/VMS Internals and Data
Structures" manual, from DEC, and, of course, the Guide to Writing a
Device Driver. But most of the mechanisms involved did not become clear
until we read the internals manual.