init(D2) init(D2)
NAME
init - initialize a device
SYNOPSIS
void prefixinit(void);
DESCRIPTION
The init routine executes during system initialization to
initialize drivers and the devices they control.
Return Values
None
USAGE
This entry point is optional.
Although init and start routines both perform initialization
tasks, they execute at different times during system start-up.
For this reason, they should be used to handle different types
of initialization tasks.
init routines:
execute during system initialization
handle any driver and device setup and initialization
that must take place before system services are
initialized (for example, perform any setup and
initialization that must be done before device
interrupts are enabled)
may only call the kernel functions listed below
start routines:
execute after system services are initialized
handle all driver and device setup and initialization
that can take place after system services are
initialized (most driver setup and initialization tasks
can be performed at this time, using a start routine)
handle any driver and device setup and initialization
that can only take place after system services are
initialized (for example, perform any setup and
initialization that must be done after device interrupts
Copyright 1994 Novell, Inc. Page 1
init(D2) init(D2)
are enabled)
Types of activities performed by the init routine include
initializing data structures, allocating memory for private
data, mapping the device into virtual address space, and
initializing hardware
The following kernel functions can be called from the driver's
init routine:
ASSERT dma_swstart makedevice
bcmp drv_gethardware max
bcopy drv_getparm min
bioreset drv_hztousec outb
btop drv_usectohz outl
btopr drv_usecwait outw
bzero etoimajor physmap
cmn_err getemajor physmap_free
dma_disable geteminor repinsb
dma_enable getmajor repinsl
dma_free_buf getminor repinsw
dma_free_cb inb repoutsb
dma_get_best_mode inl repoutsl
dma_get_buf inw repoutsw
dma_get_cb itoemajor rmalloc
dma_prog kmem_alloc rminit
dma_stop kmem_free rmfree
dma_swsetup kmem_zalloc vtop
On multiprocessor systems, the following additional kernel
functions can be called from the driver's init routine:
kmem_alloc_physcontig phfree SLEEP_ALLOC
kmem_free_physcontig rmallocmap SV_ALLOC
LOCK_ALLOC rmfreemap
phalloc RWLOCK_ALLOC
init routines for dynamically loadable modules are not called
during system start-up as they are for statically linked
modules. A loadable module's initialization is performed by
its _load(D2) routine, which is called each time the module is
loaded into a running system. However, if the processing done
by a module's init routine when the module is configured as a
statically linked module can also be used when the module is
configured as a loadable module, the module can call its init
routine from its _load routine.
Copyright 1994 Novell, Inc. Page 2
init(D2) init(D2)
Synchronization Constraints
Functions that can result in the caller sleeping, or that
require user context, such as sleep(D3), may not be called
from init. Any function that provides a flag to prevent it
from sleeping must be called such that the function does not
sleep.
REFERENCES
_load(D2), start(D2)
NOTICES
Portability
AT-compatible architectures
Applicability
ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp
Copyright 1994 Novell, Inc. Page 3