BSD 4_2 development
[unix-history] / usr / doc / config / 6.t
CommitLineData
c557cacd
C
1.ds LH "Building Systems With Config
2.ds RH "Adding New Devices
3.ds CF July 27, 1983
4.LP
5.nr H2 0
6.nr H1 6
7.ds CH "
8.bp
9.ds CH "\(hy \\n(PN \(hy
10.LG
11.B
12.ce
136. ADDING NEW SYSTEM SOFTWARE
14.sp 2
15.R
16.NL
17.PP
18This section is not for the novice, it describes
19some of the inner workings of the configuration process as
20well as the pertinent parts of the system autoconfiguration process.
21It is intended to give
22those people who intend to install new device drivers and/or
23other system facilities sufficient information to do so in the
24manner which will allow others to easily share the changes.
25.PP
26This section is broken into four parts:
27.IP \(bu 3
28general guidelines to be followed in modifying system code,
29.IP \(bu 3
30how to add a device driver to 4.2BSD,
31.IP \(bu 3
32how UNIBUS device drivers are autoconfigured under 4.2BSD on the VAX, and
33.IP \(bu 3
34how to add non-standard system facilities to 4.2BSD.
35.NH 2
36Modifying system code
37.PP
38If you wish to make site-specific modifications to the system
39it is best to bracket them with
40.DS
41#ifdef SITENAME
42\&...
43#endif
44.DE
45to allow your source to be easily distributed to others, and
46also to simplify \fIdiff\fP\|(1) listings. If you choose not
47to use a source code control system (e.g. SCCS, RCS), and
48perhaps even if you do, it is
49recommended that you save the old code with something
50of the form:
51.DS
52#ifndef SITENAME
53\&...
54#endif
55.DE
56We try to isolate our site-dependent code in individual files
57which may be configured with pseudo-device specifications.
58.PP
59Indicate machine specific code with ``#ifdef vax''. 4.2BSD
60has undergone extensive work to make it extremely portable to
61machines with similar architectures \- you may someday find
62yourself trying to use a single copy of the source code on
63multiple machines.
64.PP
65Use \fIlint\fP periodically if you make changes to the system.
66The 4.2BSD release has only one line of lint in it. It
67is very simple to lint the kernel. Use the LINT configuration
68file, designed to pull in as much of the kernel source code as
69possible, in the following manner.
70.DS
71$ cd /sys/conf
72$ mkdir ../LINT
73$ config LINT
74$ cd ../LINT
75$ make depend
76$ make assym.s
77$ make \-k lint > linterrs 2>&1 &
78(or for users of \fIcsh\fP\|(1))
79% make \-k >& linterrs
80.DE
81This takes about 45 minutes on a lightly loaded
82VAX-11/750, but is well worth it.
83.NH 2
84Adding device drivers to 4.2BSD
85.PP
86The i/o system and
87.I config
88have been designed to easily allow new device support to be added.
89As described in ``Installing and Operating 4.2BSD on the VAX'',
90the system source directories are organized as follows:
91.DS
92.TS
93lw(1.0i) l.
94/sys/h machine independent include files
95/sys/sys machine independent system source files
96/sys/conf site configuration files and basic templates
97/sys/net network independent, but network related code
98/sys/netinet DARPA Internet code
99/sys/netimp IMP support code
100/sys/netpup PUP-1 support code
101/sys/vax VAX specific mainline code
102/sys/vaxif VAX network interface code
103/sys/vaxmba VAX MASSBUS device drivers and related code
104/sys/vaxuba VAX UNIBUS device drivers and related code
105.TE
106.DE
107.PP
108Existing block and character device drivers for the VAX
109reside in ``/sys/vax'', ``/sys/vaxmba'', and ``/sys/vaxuba''. Network
110interface drivers reside in ``/sys/vaxif''. Any new device
111drivers should be placed in the appropriate source code directory
112and named so as not to conflict with existing devices.
113Normally, definitions for things like device registers are placed in
114a separate file in the same directory. For example, the ``dh''
115device driver is named ``dh.c'' and its associated include file is
116named ``dhreg.h''.
117.PP
118Once the source for the device driver has been placed in a directory,
119the file ``/sys/conf/files.machine'', and possibly
120``/sys/conf/devices.machine'' should be modified. The
121.I files
122files in the conf directory contain a line for each source or binary-only
123file in the system. Those files which are machine independent are
124located in ``/sys/conf/files'' while machine specific files
125are in ``/sys/conf/files.machine''. The ``devices.machine'' file
126is used to map device names to major block device numbers. If the device
127driver being added provides support for a new disk
128you will want to modify this file (the format is obvious).
129.PP
130The format of the
131.I files
132file has grown somewhat complex over time. Entries are normally of
133the form
134.IP
135.nf
136.DT
137\fIvaxuba/foo.c\fP \fBoptional\fP foo \fBdevice-driver\fP
138.LP
139where the keyword
140.I optional
141indicates that to compile the ``foo''
142driver into the system it must be specified in the configuration file.
143If instead the driver is specified as
144.IR standard ,
145the file
146will be loaded no matter what configuration is requested.
147This is not normally done with device drivers. The fact that
148the file is specified as a
149.I device-driver
150results, on the VAX, in the compilation including a
151.B \-i
152option for the C optimizer. This is required when pointer references
153are made to memory locations in the VAX i/o address space.
154.PP
155Aside from including the driver in the
156.I files
157file, it must also be added to the device configuration tables. These
158are located in ``/sys/vax/conf.c'', or similar for machines other than
159the VAX. If you don't understand what to add to this file, you should
160study an entry for an existing driver.
161Remember that the position in the block
162device table specifies what the major block device number is, this is
163needed in the ``devices.machine'' file if the device is a disk.
164.PP
165With the configuration information in place, your configuration
166file appropriately modified, and a system reconfigured and rebooted
167you should incorporate the shell commands needed to install the special
168files in the file system to the file ``/dev/MAKEDEV'' or
169``/dev/MAKEDEV.local''. This is discussed in the document ``Installing
170and Operating 4.2BSD on the VAX''.
171.NH 2
172Autoconfiguration on the VAX
173.PP
1744.2BSD (and 4.1BSD) require all device drivers to conform to a
175set of rules which allow the system to:
176.IP 1)
177support multiple UNIBUS and MASSBUS adapters,
178.IP 2)
179support system configuration at boot time, and
180.IP 3)
181manage resources so as not to crash when devices request
182resources which are unavailable.
183.LP
184In addition, devices such as the RK07 which require
185everyone else to get off the UNIBUS when they are running
186need cooperation from other DMA devices if they are to work.
187Since it is unlikely that you will be writing a device driver
188for a MASSBUS device, this section is devoted exclusively to
189describing the i/o system and autoconfiguration process as it
190applies to UNIBUS devices.
191.PP
192Each UNIBUS on a VAX has a set of resources:
193.IP \(bu
194496 map registers which are used to convert from the 18 bit UNIBUS
195addresses into the much larger VAX address space.
196.IP \(bu
197Some number of buffered data paths (3 on an 11/750, 15 on an 11/780, 0
198on an 11/730) which are used by high speed devices to transfer
199data using fewer bus cycles.
200.LP
201There is a structure of type \fIstruct uba_hd\fR in the system per UNIBUS
202adapter used to manage these resources. This structure also contains
203a linked list where devices waiting for resources to complete DMA UNIBUS
204activity have requests waiting.
205.PP
206There are three central structures in the writing of drivers for UNIBUS
207controllers; devices which do not do DMA i/o can often use only two
208of these structures. The structures are \fIstruct uba_ctlr\fR, the
209UNIBUS controller structure, \fIstruct uba_device\fR the UNIBUS
210device structure, and \fIstruct uba_driver\fR, the UNIBUS driver structure.
211The \fIuba_ctlr\fR and \fIuba_device\fR structures are in
212one-to-one correspondence with the definitions of controllers and
213devices in the system configuration.
214Each driver has a \fIstruct uba_driver\fR structure specifying an internal
215interface to the rest of the system.
216.PP
217Thus a specification
218.DS
219controller sc0 at uba0 csr 0176700 vector upintr
220.DE
221would cause a \fIstruct uba_ctlr\fR to be declared and initialized in
222the file \fIioconf.c\fR for the system configured from this description.
223Similarly specifying
224.DS
225disk up0 at sc0 drive 0
226.DE
227would declare a related \fIuba_device\fR in the same file.
228The \fIup.c\fR driver which implements this driver specifies in
229its declarations:
230.DS
231int upprobe(), upslave(), upattach(), updgo(), upintr();
232struct uba_ctlr *upminfo[NSC];
233struct uba_device *updinfo[NUP];
234u_short upstd[] = { 0776700, 0774400, 0776300, 0 };
235struct uba_driver scdriver =
236 { upprobe, upslave, upattach, updgo, upstd, "up", updinfo, "sc", upminfo };
237.DE
238initializing the \fIuba_driver\fR structure.
239The driver will support some number of controllers named \fIsc0\fR, \fIsc1\fR,
240etc, and some number of drives named \fIup0\fR, \fIup1\fR, etc. where the
241drives may be on any of the controllers (that is there is a single
242linear name space for devices, separate from the controllers.)
243.PP
244We now explain the fields in the various structures. It may help
245to look at a copy of \fIvaxuba/ubareg.h\fR, \fIh/ubavar.h\fR and drivers
246such as \fIup.c\fR and \fIdz.c\fR while reading the descriptions of
247the various structure fields.
248.SH
249uba_driver structure
250.PP
251One of these structures exists per driver. It is initialized in
252the driver and contains functions used by the configuration program
253and by the UNIBUS resource routines. The fields of the structure are:
254.IP \fBud_probe\fP
255A routine which is given a \fIcaddr_t\fR address as argument and
256should cause an interrupt on the device whose control-status register
257is at that address in virtual memory. It may be the case that the
258device does not exist, so the probe routine should use delays (via
259the DELAY(n) macro which delays for \fIn\fR microseconds) rather than
260waiting for specific events to occur. The routine must \fBnot\fR
261declare its argument as a \fIregister\fR parameter, but \fBmust\fR declare
262.DS
263register int br, cvec;
264.DE
265as local variables. At boot time the system takes special measures
266that these variables are ``value-result'' parameters. The \fIbr\fR
267is the IPL of the device when it interrupts, and the \fIcvec\fR
268is the interrupt vector address on the UNIBUS. These registers
269are actually filled in in the interrupt handler when an interrupt occurs.
270.IP
271As an example, here is the \fIup.c\fR
272probe routine:
273.DS
274upprobe(reg)
275 caddr_t reg;
276{
277 register int br, cvec;
278
279#ifdef lint
280 br = 0; cvec = br; br = cvec;
281#endif
282 ((struct updevice *)reg)->upcs1 = UP_IE|UP_RDY;
283 DELAY(10);
284 ((struct updevice *)reg)->upcs1 = 0;
285 return (sizeof (struct updevice));
286}
287.DE
288The definitions for \fIlint\fR serve to indicate to it that the
289\fIbr\fR and \fIcvec\fR variables are value-result. The statements
290here interrupt enable the device and write the ready bit UP_RDY.
291The 10 microsecond delay insures that the interrupt enable will
292not be canceled before the interrupt can be posted. The return of
293``sizeof (struct updevice)'' here indicates that the probe routine
294is satisfied that the device is present (the value returned is not
295currently used, but future plans dictate you should return the amount
296of space in the device's register bank). A probe routine may use
297the function ``badaddr'' to see
298if certain other addresses are accessible on the UNIBUS (without generating
299a machine check), or look at the contents of locations where certain
300registers should be. If the registers contents are not acceptable or
301the addresses don't respond, the probe routine can return 0 and the
302device will not be considered to be there.
303.IP
304One other thing to note is that the action of different VAXen when illegal
305addresses are accessed on the UNIBUS may differ. Some of the machines
306may generate machine checks and some may cause UNIBUS errors. Such
307considerations are handled by the configuration program and the driver
308writer need not be concerned with them.
309.IP
310It is also possible to write a very simple probe routine for a one-of-a-kind
311device if probing is difficult or impossible. Such a routine would include
312statements of the form:
313.DS
314br = 0x15;
315cvec = 0200;
316.DE
317for instance, to declare that the device ran at UNIBUS br5 and interrupted
318through vector 0200 on the UNIBUS. The current UDA-50 driver does
319something similar to this because the device is so difficult to force
320an interrupt on that it hardly seems worthwhile.
321.IP \fBud_slave\fP
322This routine is called with a \fIuba_device\fR structure (yet to
323be described) and the address of the device controller. It should
324determine whether a particular slave device of a controller is
325present, returning 1 if it is and 0 if it is not.
326As an example here is the slave routine for \fIup.c\fR.
327.DS
328upslave(ui, reg)
329 struct uba_device *ui;
330 caddr_t reg;
331{
332 register struct updevice *upaddr = (struct updevice *)reg;
333
334 upaddr->upcs1 = 0; /* conservative */
335 upaddr->upcs2 = ui->ui_slave;
336 if (upaddr->upcs2&UPCS2_NED) {
337 upaddr->upcs1 = UP_DCLR|UP_GO;
338 return (0);
339 }
340 return (1);
341}
342.DE
343Here the code fetches the slave (disk unit) number from the \fIui_slave\fR
344field of the \fIuba_device\fR structure, and sees if the controller
345responds that that is a non-existent driver (NED). If the drive
346a drive clear is issued to clean the state of the controller, and 0 is
347returned indicating that the slave is not there. Otherwise a 1 is returned.
348.IP \fBud_attach\fP
349The attach routine is called after the autoconfigure code and the driver concur
350that a peripheral exists attached to a controller. This is the routine
351where internal driver state about the peripheral can be initialized.
352Here is the \fIattach\fR routine from the \fIup.c\fR driver:
353.DS
354.DT
355upattach(ui)
356 register struct uba_device *ui;
357{
358 register struct updevice *upaddr;
359
360 if (upwstart == 0) {
361 timeout(upwatch, (caddr_t)0, hz);
362 upwstart++;
363 }
364 if (ui->ui_dk >= 0)
365 dk_mspw[ui->ui_dk] = .0000020345;
366 upip[ui->ui_ctlr][ui->ui_slave] = ui;
367 up_softc[ui->ui_ctlr].sc_ndrive++;
368 ui->ui_type = upmaptype(ui);
369}
370.DE
371The attach routine here performs a number of functions. The first
372time any drive is attached to the controller it starts the timeout
373routine which watches the disk drives to make sure that interrupts
374aren't lost. It also initializes, for devices which have been assigned
375\fIiostat\fR numbers (when ui->ui_dk >= 0), the transfer rate of the
376device in the array \fIdk_mspw\fR, the fraction of a second it takes
377to transfer 16 bit word. It then initializes an inverting pointer
378in the array \fIupip\fR which will be used later to determine, for a
379particular \fIup\fR controller and slave number, the corresponding
380\fIuba_device\fR. It increments the count of the number of devices
381on this controller, so that search commands can later be avoided
382if the count is exactly 1. It then attempts to decipher the actual
383type of drive attached to the controller in a controller-specific
384way. On the EMULEX SC-21 it may ask for the number of tracks on
385the device and use this to decide what the drive type is. The drive
386type is used to setup disk partition mapping tables and other
387device specific information.
388.IP \fBud_dgo\fP
389.br
390Is the routine which is called by the UNIBUS resource management
391routines when an operation is ready to be started (because the required
392resources have been allocated). The routine in \fIup.c\fR is:
393.DS
394updgo(um)
395 struct uba_ctlr *um;
396{
397 register struct updevice *upaddr = (struct updevice *)um->um_addr;
398
399 upaddr->upba = um->um_ubinfo;
400 upaddr->upcs1 = um->um_cmd|((um->um_ubinfo>>8)&0x300);
401}
402.DE
403This routine uses the field \fIum_ubinfo\fR of the \fIuba_ctlr\fR
404structure which is where the UNIBUS routines store the UNIBUS
405map allocation information. In particluar, the low 18 bits of this
406word give the UNIBUS address assigned to the transfer. The assignment
407to \fIupba\fR in the go routine places the low 16 bits of the UNIBUS
408address in the disk UNIBUS address register. The next assignment
409places the disk operation command and the extended (high 2) address
410bits in the device control-status register, starting the i/o operation.
411The field \fIum_cmd\fR was initialized with the command to be stuffed
412here in the driver code itself before the call to the \fIubago\fR
413routine which eventually resulted in the call to \fIupdgo\fR.
414.IP \fBud_addr\fP
415Are the conventional addresses for the device control registers in
416UNIBUS space. This information is used by the system
417to look for instances of the device supported by the driver.
418When the system probes for the device it first checks for a
419control-status register located at the address indicated in
420the configuration file (if supplied), then uses the list of
421conventional addresses pointed to be \fIud_addr\fP.
422.IP \fBud_dname\fP
423Is the name of a \fIdevice\fR supported by this controller; thus the
424disks on a SC-21 controller are called \fIup0\fR, \fIup1\fR, etc.
425That is because this field contains \fIup\fR.
426.IP \fBud_dinfo\fP
427Is an array of back pointers to the \fIuba_device\fR structures for
428each device attached to the controller. Each driver defines a set of
429controllers and a set of devices. The device address space is always
430one-dimensional, so that the presence of extra controllers may be
431masked away (e.g. by pattern matching) to take advantage of hardware
432redundancy. This field is filled in by the configuration program,
433and used by the driver.
434.IP \fBud_mname\fP
435The name of a controller, e.g. \fIsc\fR for the \fIup.c\fR driver.
436The first SC-21 is called \fIsc0\fR, etc.
437.IP \fBud_minfo\fP
438The backpointer array to the structures for the controllers.
439.IP \fBud_xclu\fP
440If non-zero specifies that the controller requires exclusive
441use of the UNIBUS when it is running. This is non-zero currently
442only for the RK611 controller for the RK07 disks to map around a hardware
443problem. It could also be used if 6250bpi tape drives are to be used
444on the UNIBUS to insure that they get the bandwidth that they need
445(basically the whole bus).
446.SH
447uba_ctlr structure
448.PP
449One of these structures exists per-controller.
450The fields link the controller to its UNIBUS adapter and contain the
451state information about the devices on the controller. The fields are:
452.IP \fBum_driver\fP
453A pointer to the \fIstruct uba_device\fR for this driver, which has
454fields as defined above.
455.IP \fBum_ctlr\fP
456The controller number for this controller, e.g. the 0 in \fIsc0\fR.
457.IP \fBum_alive\fP
458Set to 1 if the controller is considered alive; currently, always set
459for any structure encountered during normal operation. That is, the
460driver will have a handle on a \fIuba_ctlr\fR structure only if the
461configuration routines set this field to a 1 and entered it into the
462driver tables.
463.IP \fBum_intr\fP
464The interrupt vector routines for this device. These are generated
465by \fIconfig\fP and this field is initialized in the
466\fIioconf.c\fR file.
467.IP \fBum_hd\fP
468.br
469A back-pointer to the UNIBUS adapter to which this controller is attached.
470.IP \fBum_cmd\fP
471A place for the driver to store the command which is to be given to
472the device before calling the routine \fIubago\fR with the devices
473\fIuba_device\fR structure. This information is then retrieved when the
474device go routine is called and stuffed in the device control status register
475to start the i/o operation.
476.IP \fBum_ubinfo\fP
477Information about the UNIBUS resources allocated to the device. This is
478normally only used in device driver go routine (as \fIupdgo\fR above)
479and occasionally in exceptional condition handling such as ECC correction.
480.IP \fBum_tab\fP
481This buffer structure is a place where the driver hangs the device structures
482which are ready to transfer. Each driver allocates a buf structure for each
483device (e.g. \fIupdtab\fR in the \fIup.c\fR driver) for this purpose.
484You can think of this structure as a device-control-block, and the
485buf structures linked to it as the unit-control-blocks.
486The code for dealing with this structure is stylized; see the \fIrk.c\fR
487or \fIup.c\fR driver for the details. If the \fIubago\fR routine
488is to be used, the structure attached to this \fIbuf\fR structure
489must be:
490.RS
491.IP \(bu 3
492A chain of \fIbuf\fR structures for each waiting device on this controller.
493.IP \(bu 3
494On each waiting \fIbuf\fR structure another \fIbuf\fR structure which is
495the one containing the parameters of the i/o operation.
496.RE
497.SH
498uba_device structure
499.PP
500One of these structures exist for each device attached to a UNIBUS
501controller. Devices which are not attached to controllers or which
502perform no buffered data path
503DMA i/o may have only a device structure. Thus \fIdz\fR
504and \fIdh\fR devices have only \fIuba_device\fR structures.
505The fields are:
506.IP \fBui_driver\fP
507A pointer to the \fIstruct uba_driver\fR structure for this device type.
508.IP \fBui_unit\fP
509The unit number of this device, e.g. 0 in \fBup0\fR, or 1 in \fBdh1\fR.
510.IP \fBui_ctlr\fP
511.br
512The number of the controller on which this device is attached, or \-1
513if this device is not on a controller.
514.IP \fBui_ubanum\fP
515The number of the UNIBUS on which this device is attached.
516.IP \fBui_slave\fP
517The slave number of this device on the controller which it is attached to,
518or \-1 if the device is not a slave. Thus a disk which was unit 2 on
519a SC-21 would have \fIui_slave\fR 2; it might or might not be \fIup2\fR,
520that depends on the system configuration specification.
521.IP \fBui_intr\fP
522.br
523The interrupt vector entries for this device, copied into the UNIBUS
524interrupt vector at boot time. The values of these fields are filled
525in by \fIconfig\fP to small code segments which it
526generates in the file \fIubglue.s\fR.
527.IP \fBui_addr\fP
528The control-status register address of this device.
529.IP \fBui_dk\fP
530.br
531The iostat number assigned to this device. Numbers are assigned to
532disks only, and are small positive integers which index the various
533\fIdk_*\fP arrays in <\fIsys/dk.h\fP>.
534.IP \fBui_flags\fP
535The optional ``flags \fIxxx\fP'' parameter from the configuration
536specification was copied to this field, to be interpreted by the driver.
537If \fIflags\fP was not specified, then this field will contain a 0.
538.IP \fBui_alive\fP
539The device is really there. Presently set to 1 when a device is
540determined to be alive, and left 1.
541.IP \fBui_type\fP
542The device type, to be used by the driver internally.
543.IP \fBui_physaddr\fP
544The physical memory address of the device control-status register.
545This is used in the device dump routines typically.
546.IP \fBui_mi\fP
547.br
548A \fIstruct uba_ctlr\fP pointer to the controller (if any) on which
549this device resides.
550.IP \fBui_hd\fP
551.br
552A \fIstruct uba_hd\fP pointer to the UNIBUS on which this device resides.
553.SH
554UNIBUS resource management routines
555.PP
556UNIBUS drivers are supported by a collection of utility routines
557which manage UNIBUS resources. If a driver attempts to bypass the
558UNIBUS routines, other drivers may not operate properly.
559The major routines are: \fIuballoc\fP to allocate UNIBUS resources,
560\fIubarelse\fP to release previously allocated resources, and
561\fIubago\fP to initiate DMA. When allocating UNIBUS resources
562you may request that you
563.IP NEEDBDP
564if you need a buffered data path,
565.IP HAVEBDP
566if you already have a buffered data path and just want new
567mapping registers (and access to the UNIBUS), and
568.IP CANTWAIT
569if you are calling (potentially) from interrupt level
570.LP
571If the presentation here does not answer all the questions
572you may have, consult the file /sys/vaxuba/uba.c
573.SH
574Autoconfiguration requirements
575.PP
576Basically all you have to do is write a \fIud_probe\fP and a \fIud_attach\fP
577routine for the controller. It suffices to have a \fIud_probe\fP routine
578which just initializes \fIbr\fP and \fIcvec\fP, and a \fIud_attach\fP
579routine which does nothing.
580Making the device fully configurable requires, of course, more work,
581but is worth it if you expect the device to be in common usage
582and want to share it with others.
583.PP
584If you managed to create all the needed hooks, then make sure you include
585the necessary header files; the ones included by \fIvaxuba/ct.c\fP are nearly
586minimal. Order is important here, don't be surprised at undefined structure
587complaints if you order the includes wrongly.
588Finally if you get the device configured in, you can try bootstrapping
589and see if configuration messages print out about your device.
590It is a good idea to have some messages in the probe routine so that
591you can see that you are getting called and what is going on.
592If you do not get called, then you probably have the control-status
593register address wrong in your system configuration. The autoconfigure
594code notices that the device doesn't exist in this case and you will never
595get called.
596.PP
597Assuming that your probe routine works and you manage
598to generate an interrupt, then you are basically back to where you
599would have been under older versions of UNIX.
600Just be sure to use the \fIui_ctlr\fP field of the \fIuba_device\fP
601structures to address the device; compiling in funny constants
602will make your driver only work on the CPU type you have (780, 750, or 730).
603.PP
604Other bad things that might happen while you are setting up the configuration
605stuff:
606.IP \(bu 3
607You get ``nexus zero vector'' errors from the system. This will happen
608if you cause a device to interrupt, but take away the interrupt enable
609so fast that the UNIBUS adapter cancels the interrupt and confuses
610the processor. The best thing to do it to put a modest delay in the
611probe code between the instructions which should cause and interrupt and
612the clearing of the interrupt enable. (You should clear interrupt
613enable before you leave the probe routine so the device doesn't interrupt
614more and confuse the system while it is configuring other devices.)
615.IP \(bu 3
616The device refuses to interrupt or interrupts with a ``zero vector''.
617This typically indicates a problem with the hardware or, for devices
618which emulate other devices, that the emulation is incomplete. Devices
619may fail to present interrupt vectors because they have configuration
620switches set wrong, or because they are being accessed in inappropriate ways.
621Incomplete emulation can cause ``maintenance mode'' features to not work
622properly, and these features are often needed to force device interrupts.
623.NH 2
624Adding non-standard system facilities
625.PP
626This section considers the work needed to augment
627.IR config 's
628data base files for non-standard system facilities.
629.PP
630As far as
631.I config
632is concerned
633non-standard facilities may fall into two categories.
634.I Config
635understands that certain files are used especially for
636kernel profiling. These files are indicated in the
637.I files
638files with a
639.I profiling-routine
640keyword. For example, the current profiling subroutines
641are sequestered off in a separate file with the following
642entry:
643.IP
644.nf
645.DT
646\fIsys/subr_mcount.c\fP \fBoptional\fP \fBprofiling-routine\fP
647.fi
648.LP
649The
650.I profiling-routine
651keyword forces
652.I config
653to not compile the source file with the
654.B \-pg
655option.
656.PP
657The second keyword which can be of use is the
658.I config-dependent
659keyword. This causes
660.I config
661to compile the indicated module with the global configuration
662parameters. This allows certain modules, such as
663.I machdep.c
664to size system data structures based on the maximum number
665of users configured for the system.