master(4) FILE FORMATS master(4)
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
/usr/src/uts/sony/master.d. Each file has an identical for-
mat. For convenience, this collection of files will be
referred to as the master file, as though it were a single
file. Treating the master file as a single file allows a
reference to the master 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
mboot(1M) program to obtain device information to reconfig-
ure kernel accordingly. It is also used by the sysdef(1M)
program to obtain the names of supported devices. master
consists of two parts; they are separated by a line with a
dollar sign ($) in column 1. Part 1 contains device infor-
mation for both hardware and software devices, and loadable
modules. Part 2 contains parameter declarations and other
data structure definitions needed by the driver/module. Any
line with an asterisk (*) in column 1 is treated as a com-
ment.
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 leftmost 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
a generate segment descriptor
array
t initialize cdevsw[ ].d_ttys
s software driver
f STREAMS driver
m STREAMS module
x not a driver; a loadable module
d dispatcher class
j file system type
e executable type
n new System V.4 device driver
interface (when not specified,
default D_OLD flag is used in
the switch table)
1
master(4) FILE FORMATS master(4)
z no DMA breakup for the device
driver (when not specified,
default D_NOBRKUP flag is used
in the switch table)
number first interrupt vector for an
integral device
none no flags for this driver or
module
Field 2: number of interrupt vectors required by a
hardware device: "-" if none.
Field 3: handler prefix (15 characters maximum)
Field 4: software device, external major number list.
If multiple major numbers are listed,
separate them with ",". Be sure not to use
spaces in the list. This field can be a "-"
if this is not a software driver or if you
wish to have the major number assigned by
mboot(1M). mboot will only assign one major
number, hence you can not use mboot to assign
multiple major numbers for one driver.
Field 5: 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 controllers per major
number is left off, it is the same as if you
denote "-" for it.
Field 6: interrupt priority level of the device; "-"
if none
Field 7: 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
mboot: external routine references and variable defini-
tions. Routine reference lines begin with white space and
immediately follow the initial module specification line.
These lines are free form, thus they may be continued arbi-
trarily between non-blank tokens as long as the first char-
acter of a line is white space. Variable definition lines
begin after a line that contains a '$' in column one. Vari-
able definitions follow C language conventions, with slight
modifications.
2
master(4) FILE FORMATS master(4)
Part 1.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. The
format of a routine reference is as follows:
routine_name()action
The valid actions and their meanings are:
{} {}
{nosys} {return nosys();}
{nodev} {return nodev();}
{false} {return 0;}
{true} {return 1;}
{nopkg} {return nopkg();}
{noreach} panic the system
Part 2. Variable Definition Lines
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
if 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
mboot(1M).
##C number of controllers present; this number is
determined dynamically by mboot(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 needed to support
this device.
##I, ##X these will give you the list of the internal
major number and external major numbers
respectively. The intended use is as fol-
lows. This example might appear in the
declaration section of a master file:
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
3
master(4) FILE FORMATS master(4)
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 recom-
mended as the way to obtain multi-major
information. Similarly with ##M.
EXAMPLE
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.
*
* SHM - IPC shared memory module
*
*FLAG #VEC PREFIX SOFT #DEV IPL DEPENDENCIES/VARIABLES
ox - shm - - - ipc
shmsys(){nosys}
shmexec(){}
shmexit(){}
shmfork(){}
shmslp(){true}
shmtext(){}
$$$
#define SHMMAX 131072
#define SHMMIN 1
#define SHMMNI 100
#define SHMSEG 6
struct shmid_ds shmem[SHMMNI];
struct shminfo shminfo = {
SHMMAX, SHMMIN, SHMMNI, SHMSEG
};
This master file will cause routines named shmsys, shmexec,
etc., to be generated by the boot program if the shm module
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 allocated and initialized.
A sample master file for an ethernet driver would be named
"en". This STREAM-based software driver module uses the new
System V.4 device driver interface. The module prefix is
"sen", and the major number associated with it is 5.
*
* Sony ethernet driver
4
master(4) FILE FORMATS master(4)
*
*FLAG #VEC PREFIX SOFT #DEV IPL DEPENDENCIES/VARIABLES
snf - sen 5 10 -
$$$
/* * provide stats for internet 'netstat' cmd if INETSTATS is set */
#define INETSTATS 0
#define ENDEBUG 0x0000
#define ENMAXDEV 3
int sen_nstr = ##D;
int sen_maxdev = ENMAXDEV;
int inetstats = INETSTATS;
int sen_debug = ENDEBUG;
struct sen_dev sen_dev[ENMAXDEV];
struct sen_str sen_str[##D];
When the driver is loaded, the structure array
sen_dev[ ] and sen_str[ ] will be allocated. Variables
sen_nstr, sen_maxdev, inetstats, and sen_debug will be
allocated and initialized accordingly.
FILES
/usr/src/uts/sony/master.d/*
/usr/src/uts/sony/master.gen/sysgen.[suffix]
/usr/src/uts/sony/master.gen/system.[suffix]
SEE ALSO
drvinstall(1M), mboot(1M), sysdef(1M), system(4)
5