MASTER(4-SVR4) RISC/os Reference Manual MASTER(4-SVR4)
NAME
master - master configuration database
DESCRIPTION
The master configuration database is a collection of files.
Each file contains configuration information for a device or
module that may be included in the system. A file is named
with the module name to which it applies. This collection
of files is maintained in a directory called
$ROOT3/usr/src/uts/mips/master.d. Each individual file has
an identical format. For convenience, this collection of
files will be referred to as the master file, as though it
was a single file. This will allow a reference to the mas-
ter file to be understood to mean the individual file in the
master.d directory that corresponds to the name of a device
or module. The file is used by the lboot(1M) program to
obtain device information to generate the device driver and
configurable module files. master consists of two parts;
they are separated by a line with a dollar sign ($) in
column 1. Part 1 contains device information for both
hardware and software devices, and loadable modules. Part 2
contains parameter declarations. Any line with an asterisk
(*) in column 1 is treated as a comment.
Part 1, Description
Hardware devices, software drivers and loadable modules are
defined with a line containing the following information.
Field 1 must begin in the left most position on the line.
Fields are separated by white space (tab or blank).
Field 1:
element
characteristics
o specify only once
r required device
b block device
c character device
t initialize cdevsw[].d_ttys
j file system
s software driver
f STREAMS driver
m STREAMS module
x not a driver; a loadable module
k kernel module
p driver supports asynchronous I/O
D driver is DDI/DKI compliant
M DDI/DKI compliant STREAMS module (same
as specifying Dm)
V driver supports vectored buffers
a address array must be generated
Printed 11/19/92 Page 1
MASTER(4-SVR4) RISC/os Reference Manual MASTER(4-SVR4)
Field 2: handler prefix (14 chars. maximum)
Field 3: software device, external major number list.
Separate multiple major numbers with , (comma) and
be sure not to use spaces in the list. Use a list
of major numbers if you have a device that can
support multiple major numbers (for example, the
Interphase 4210 SCSI board). Each additional card
placed in a system will have a different major
number. This field can be a - if this is not a
software driver or if you wish to have the major
number assigned by lboot (lboot will only assign
one major number).
Field 4: number of sub-devices per device; - if none. This
is an optional second element that can be after
the number of sub-devices, and are separated by a
,. The element is the number of controllers per
major number. Using a - for this field means that
only one major number will be used no matter how
many controllers exist. Therefore, 3,4 would mean
3 sub-devices per controller, and 4 controllers
per each major number. -,4 would mean no sub-
devices, and 4 controllers per major number. If
the second element denoting the number of con-
trollers per major number is left off, it is the
same as if you denote - for it.
Field 5: dependency list (optional); this is a comma
separated list of other drivers or modules that
must be present in the configuration if this
module is to be included.
For each module, two classes of information are required by
lboot(1M): external routine references and variable defini-
tions. Routine lines begin with white space and immediately
follow the initial module specification line. These lines
are free form, thus they may be continued arbitrarily
between non-blank tokens as long as the first character of a
line is white space. Variable definition lines begin after
a line that contains a '$' in column one. Variable defini-
tions follow C language conventions, with slight modifica-
tions.
Part 1, Routine Reference Lines
If the UNIX system kernel or other dependent module contains
external references to a module, but the module is not con-
figured, then these external references would be undefined.
Therefore, the routine reference lines are used to provide
the information necessary to generate appropriate dummy
functions at boot time when the driver is not loaded.
Page 2 Printed 11/19/92
MASTER(4-SVR4) RISC/os Reference Manual MASTER(4-SVR4)
Routine references are defined as follows:
Field 1: routine name ()
Field 2: the routine type: one of
{} routine_name(){}
{nulldev} routine_name(){nulldev();}
{nosys} routine_name(){return nosys();}
{nodev} routine_name(){return nodev();}
{false} routine_name(){return 0;}
{true} routine_name(){return 1;}
{fsnull} routine_name(){return fsnull();}
{fsstray} routine_name(){return fsstray();}
{nopkg} routine_name(){nopkg();}
{noreach} routine_name(){noreach();}
Part 2, Variables
Variables may be declared and (optionally) statically ini-
tialized on lines after a line whose first character is a
dollar sign ('$'). Variable definitions follow standard C
syntax for global declarations, with the following in-line
substitutions:
##M the internal major number assigned to the current
module if it is a device driver; zero of this
module is not a device driver.
##E the external major number assigned to the current
module; either explicitly defined by the current
master file entry, or assigned by lboot(1M).
##C number of controllers present; this number is
determined dynamically by lboot(1M) for hardware
devices, or by the number provided in the system
file for non-hardware drivers or modules.
##D number of devices per controller taken directly
from the current master file entry.
##P number of controllers per major number. From the
master-file.
##N number of major numbers neede to support this dev-
ice.
##I, ##X these will give you the list of the internal major
number and external major numbers respectively.
The intended use is as follows. This example
might appear in the declaration section of a mas-
ter file:
Printed 11/19/92 Page 3
MASTER(4-SVR4) RISC/os Reference Manual MASTER(4-SVR4)
int internal [##N] = ##I;
int external [##N] = ##X;
Since ##N is the numbers of major used, that is what you can
use to declare the size of the arrays. For a 4 major number
case, these lines might be translated in the
master<suffix>.c file as
int internal [4] = {4,5,9,11};
int external [4] = {22,27,31,35};
Note that when multiple major numbers are used, ##E is
analogous to the first external major-number in the array,
but is not recommended as the way to obtain multi-major
information. Similarly with ##M.
EXAMPLES
A sample master file for a shared memory module would be
named "shm". The module is an optional loadable software
module that can only be specified once. The module prefix
is shm, and it has no major number associated with it. In
addition, another module named "ipc" is necessary for the
correct operation of this module.
*FLAG PREFIX SOFT #DEV DEPENDENCIES
ox shm - - ipc
shmsys(){nosys}
shmexec(){}
shmexit(){}
shmfork(){}
shmslp(){true}
shmtext(){}
$
#define SHMMAX 131072
#define SHMMIN 1
#define SHMMNI 100
#define SHMSEG 6
#define SHMALL 512
struct shmid_ds shmem[SHMMNI];
struct shminfo shminfo = {
SHMMAX,
SHMMIN,
SHMMNI,
SHMSEG,
SHMALL,
};
Page 4 Printed 11/19/92
MASTER(4-SVR4) RISC/os Reference Manual MASTER(4-SVR4)
This master file will cause routines named shmsys, shmexec,
etc., to be generated by the boot program if the shm driver
is not loaded, and there is a reference to this routine from
any other module loaded. When the driver is loaded, the
structure array shmem will be allocated, and the structure
shminfo will be allocated and initialized as specified.
A sample master file for a VME disk driver would be named
"dkip". The driver is a block and a character device, the
driver prefix is dkip, and the external major number is 4.
The VME interrupt priority level and vector numbers are
declared in the system file (see lboot(1M)).
*FLAG PREFIX SOFT #DEV DEPENDENCIES
bc dkip 4 - - io
$$$
/* disk driver variable tables */
#include "sys/dvh.h"
#include "sys/dkipreg.h"
#include "sys/elog.h"
struct iotime dkipiotime[##C][DKIPUPC]; /* io statistics */
struct iobuf dkipctab[##C]; /* controller queues */
struct iobuf dkiputab[##C][DKIPUPC]; /* drive queues */
int dkipmajor = ##E; /* external major # */
This master file will cause entries in the block and charac-
ter device switch tables to be generated, if this module is
loaded. Since this is a hardware device (implied by the
block and character flags), VME interrupt structures will be
generated, also, by the boot program. The declared arrays
will all be sized to the number of controllers present,
which is determined by the boot program, based on informa-
tion in the system file
$ROOT/usr/src/uts/mips/master.d/system[.suffix].
FILES
$ROOT/usr/src/uts/mips/master.d/*
$ROOT/usr/src/uts/mips/master.d/system[.suffix]
SEE ALSO
system(4), lboot(1M).
Printed 11/19/92 Page 5