• Aucun résultat trouvé

DRIVERS FOR NPR DEVICES USING EXTENDED MEMORY

Dans le document M-PLUS Guide to Writing an I/O Driver (Page 158-161)

DEBUGGING A USER-SUPPLIED DRIVER

7.3 DRIVERS FOR NPR DEVICES USING EXTENDED MEMORY

SpeciaL features must be built into drivers for non-MASSBUS NPR (nonprncessor request) devices attached to a PDP-II processor with

extend,~d-memory support (22-bit addressing).

Non-Exl:ended memory NPR devices on the PDP-II processor must perform I/O transfers by using UNIBUS Mapping Registers (UMRs) as described in the PDP-II Processor Handbook. One UMR is required for each 4K words

invo~ur--in the transfer -- as specified by the contents of U.CNT in the UCH. When multiple UMRs are required for a transfer, they must be contiguous.

A drivf'r can be assigned UMRs through anyone of three procedures:

~. Dynamically allocating UMRs for the duration of the data transfer, or

2. Dynamically allocating UMRs for longer periods of time, or 3. Statically allocating UMRs during system generation.

NOTE

In large systems, use of the procedures above to hold UMRs for longer periods than necessary can result in the blocking of other drivers and a reduction in system throughput.

7-2

EXECUTIVE SERVICES AVAILABLE TO AN I/O DRIVER 7.3.1 Calling $STMAP and $MPUBM or $STMPI and $MPUBI

To obtain UMRs through use of the $STMAP and $MPUBM or the $STMPI and

$MPUBI routines, a driver must:

• Have available six words for a mapping register assignment block in the 22-bit working storage area of the device's controller request block (KRB). The end of this area is accessed by adding the contents of K.OFF to the address at K.CSR. If the driver uses $STMPI and $MPUBl, i t must also have available a lO-word block

• Call the routine $STMAP or $STMPI (Set Up UNIBUS Mapping Address) after getting the I/O packet

• Call the routine $MPUBM or $MPUB1 (Map UNIBUS to Memory) before initiating a transfer

These requirements are detailed in the Note that these routines are only performing a data transfer.

following three sUbsections.

required when the driver is

7.3.1.1 Allocating a Mapping Register Assignment Block - The

controller request block (KRB) of an NPR device requires a 6-word mapping register assignment block located in the 22-bit working storage area. It does not have to be initialized. Any initial contents are simply overwritten.

The following example shows the allocation of a mapping register assignment block.

.BLKW M.LGTH ;UMR WORK AREA

If the driver does not support parallel NPR operations requiring UMR mapping, i t calls $STMAP and $MPUBM. If the driver supports parallel NPR operations requiring UMR mapping, it must call $STMPI and $MPUBI.

In the latter situation, the six additional words in the 22-bit working storage area are not used but must still be present. In addit.ion, the driver data base must provide a lO-word mapping register assignment block for each data transfer to be mapped as specified in the description of $STMPI later in Section 7.4.31.

7.3.1.2 Calling $STMAP or $STMP1 - In the coding at the initiator entry point, after the call to $GTPKT, the NPR-device driver must call the routine $STMAP or $STMPI. These routines dynamically allocate required UMRs. If UMRs are not available immediately, the driver is blocked. Such blocking, if it occurs, is completely transparent to the driver. The driver resumes processing at fork level when the UMRs have been allocated. The register returns are absolutely identical whether or not blocking has occurred.

$STMAP or $STMPI stores into U.BUF and U.BUF+2 (in the UCB) a UNIBUS address that causes the appropriate UMR to be selected for mapping the transfer. The call to $STMAP or $STMPI must be conditionalized on M$$EXT.

7.3.1.3 Calling $MPUBM or $MPUBI - Before executing the transfer, the driver must call $MPUBM or $MPUBI. These routines get the buffer's

EXECUTIVE SERVICES AVAILABLE TO AN I/O DRIVER

22-bit physical address and load the UNIBUS mapping registers so that transfE'rs are mapped directly to the task's space. The call to $MPUBM or $MPUBI must be conditionalized on M$$EXT.

If the driver calls $STMAP and $MPUBM, the UMRs allocated to it are deallocated during the call to $IODON or $IOALT. If the driver calls

$STMPI and $MPUBl, it must call $DEUMR to deallocate any allocated UMRs bE~fore calling $IODON or $IOALT.

7.3.2 Calling $ASUMR and $DEUMR

Use of the procedure described in Section 7.3.3 assures that UMRs are always allocated. However, a driver may not require UMRs to be allocated all of the time, and yet require UMRs for periods of time longer than the normal time-frame between $GTPKT and $IODON (or

$IOALT). In such cases, there is a third procedure for allocating UMRs.

Through use of the Executive routines $ASUMR and $DEUMR, a driver can dynamically allocate, retain over a desired time-frame, and deallocate UMRs. Refer to Section 7.4 for descriptions of the $ASUMR and $DEUMR routines.

Similar to the $STMAP/$MPUBM procedure, the use of $ASUMR and $DEUMR also l-equires the allocation of a 6-word mapping register assignment block. In this instance, however, the block must not be located in the 2:~-bit working storage area. $IODON or $IOALT, when called, will attempt to deallocate the UMRs of a block found in the 22-bit working storage area. To avoid this deallocation, the mapping register assignment block could be dynamically allocated from the pool. Figure 7-1 details the format of the 6-word block.

M.LNK M.UMRA M.UMRN M.UMVL M.UMVH M.BFVH M.BFVL

Link Word Address of first assigned UMR Number of assigned UMRs *4 Low 16 bits mapped by first assigned UM R High 6 bits of

I

High 2 bits mapped by physical buffer address UMR (in bits 4 and 5)

Low 16 bits of physical buffer address

ZK-276-81

Figure 7-1: Mapping Register Assignment Block

7.3.3 Statically Allocating UMRs During System Generation

UMRs cC:ln be statically assigned during system generation. The system generation procedure defines the symbol N$$UMR equal to a fixed number of UMRE, multiplied by 4, that are statically assigned to the system.

Before assembling the Executive, the user can cause the static allocation of an additional number of UMRs by editing the Executive assembly prefix file RSXMC.MAC. The value of the symbol N$$UMR can then b~ increased to represent the additional number of desired UMRs multiplied by 4.

7-4

EXECUTIVE 'SERVICES AVAILABLE TO AN I/O DRIVER The Ex~~cutive assembly prefix file RSXMC.MAC

following three symbols, which describe the allocated during system generation:

further defines the

available for the user's infcrmation.

They are

Dans le document M-PLUS Guide to Writing an I/O Driver (Page 158-161)