1 /****^  ***********************************************************
 2         *                                                         *
 3         * Copyright, (C) Honeywell Bull Inc., 1987                *
 4         *                                                         *
 5         * Copyright, (C) Honeywell Information Systems Inc., 1983 *
 6         *                                                         *
 7         *********************************************************** */
 8 
 9 /* format: style4,delnl,insnl,indattr,ifthen,dclind10 */
10 
11 ioi_wire:
12      procedure;
13 
14 /* IOI buffer wiring and unwiring routines */
15 /* Finished August 1982 by Chris Jones from what Charlie Hornig left me */
16 /* Modified 1984-08-09 BIM for dia support */
17 
18 
19 /****^  HISTORY COMMENTS:
20   1) change(86-03-03,Farley), approve(86-07-18,MCR7439),
21      audit(86-08-18,Fawcett), install(86-10-20,MR12.0-1189):
22      Changed to execute in the BCE environment.
23                                                    END HISTORY COMMENTS */
24 
25 
26 dcl       p_dtep                 ptr parameter;             /* (I) pointer to a device table entry */
27 
28 dcl       sys_info$service_system
29                                  bit (1) aligned external static;
30 
31 dcl       ioi_page_table$fill    entry (fixed bin, ptr, fixed bin (35));
32 
33 dcl       pc_abs$wire_abs        entry (ptr, fixed bin (9), fixed bin (9), fixed bin (35));
34 dcl       pc_abs$wire_abs_contig entry (ptr, fixed bin (9), fixed bin (9), fixed bin (35));
35 dcl       pc_abs$unwire_abs      entry (ptr, fixed bin (9), fixed bin (9));
36 dcl       code                   fixed bin (35);
37 dcl       np                     fixed bin (9);
38 
39 dcl       (divide)               builtin;
40 ^L
41 /* This entry is called to wire the caller's IOI workspace.
42    it will be wired in memory connected to the
43    bootload SCU and a page table will be built to point to it. */
44 wire:
45      entry (p_dtep);
46 
47           dtep = p_dtep;
48           if dte.workspace_wired then
49                return;
50 
51           np = divide (dte.bound + 1023, 1024, 9, 0);       /* number of pages to wire */
52           if sys_info$service_system then
53                call pc_abs$wire_abs (dte.workspace_astep, 0, np, code);
54           else call pc_abs$wire_abs_contig (dte.workspace_astep, 0, np, code);
55           if code ^= 0 then do;
56 error:                                                      /* syserr here? */
57                return;
58           end;
59 
60           call ioi_page_table$fill (dte.ptx, dte.workspace_astep, code);
61           if code ^= 0 then
62                goto error;
63 
64           dte.workspace_wired = "1"b;
65           return;
66 ^L
67 /* This entry is called to unwire the user's workspace.  For performance reasons, the workspace is left wired
68    for a while after the I/O completes in it (since another I/O will most likely start soon, and wiring and
69    unwiring is expensive).  Thus, this entry is called by the check_timeout routine when it determines that
70    the workspace has been idle  long enough. */
71 unwire:
72      entry (p_dtep);
73 
74           dtep = p_dtep;
75           if ^dte.workspace_wired then
76                return;
77 
78           np = divide (dte.bound + 1023, 1024, 9, 0);       /* number of pages to unwire */
79           call pc_abs$unwire_abs (dte.workspace_astep, 0, np);
80           dte.workspace_wired = "0"b;
81           return;
82 ^L
83 %include ioi_data;
84 
85      end ioi_wire;