Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

hat_getkpfnum(9f) [opensolaris man page]

hat_getkpfnum(9F)					   Kernel Functions for Drivers 					 hat_getkpfnum(9F)

NAME
hat_getkpfnum - get page frame number for kernel address SYNOPSIS
#include <sys/types.h> #include <sys/ddi.h> #include <sys/sunddi.h> pfn_t hat_getkpfnum(caddr_t addr); INTERFACE LEVEL
This interface is obsolete. A driver devmap(9E) entry point should be provided instead. PARAMETERS
addr The kernel virtual address for which the page frame number is to be returned. DESCRIPTION
hat_getkpfnum() returns the page frame number corresponding to the kernel virtual address, addr. addr must be a kernel virtual address which maps to device memory. ddi_map_regs(9F) can be used to obtain this address. For example, ddi_map_regs(9F) can be called in the driver's attach(9E) routine. The resulting kernel virtual address can be saved by the driver (see ddi_soft_state(9F)) and used in mmap(9E). The corresponding ddi_unmap_regs(9F) call can be made in the driver's detach(9E) routine. Refer to mmap(9E) for more information. RETURN VALUES
The page frame number corresponding to the valid, device-mapped virtual address addr. Otherwise the return value is undefined. CONTEXT
hat_getkpfnum() can be called only from user or kernel context. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface stability |Obsolete | +-----------------------------+-----------------------------+ SEE ALSO
attach(9E), detach(9E), devmap(9E), mmap(9E), ddi_map_regs(9F), ddi_soft_state(9F), ddi_unmap_regs(9F) Writing Device Drivers NOTES
For some devices, mapping device memory in the driver's attach(9E) routine and unmapping device memory in the driver's detach(9E) routine is a sizeable drain on system resources. This is especially true for devices with a large amount of physical address space. Refer to mmap(9E) for alternative methods. SunOS 5.11 13 June 2004 hat_getkpfnum(9F)

Check Out this Related Man Page

ddi_map_regs(9F)					   Kernel Functions for Drivers 					  ddi_map_regs(9F)

NAME
ddi_map_regs, ddi_unmap_regs - map or unmap registers SYNOPSIS
#include <sys/conf.h> #include <sys/ddi.h> #include <sys/sunddi.h> int ddi_map_regs(dev_info_t *dip, uint_t rnumber, caddr_t *kaddrp, off_t offset, off_t len); void ddi_unmap_regs(dev_info_t *dip, uint_t rnumber, caddr_t *kaddrp, off_t offset, off_t len); INTERFACE LEVEL
These interfaces are obsolete. Use ddi_regs_map_setup(9F) instead of ddi_map_regs(). Use ddi_regs_map_free(9F) instead of ddi_unmap_regs(). PARAMETERS
ddi_map_regs() dip Pointer to the device's dev_info structure. rnumber Register set number. kaddrp Pointer to the base kernel address of the mapped region (set on return). offset Offset into register space. len Length to be mapped. ddi_unmap_regs() dip Pointer to the device's dev_info structure. rnumber Register set number. kaddrp Pointer to the base kernel address of the region to be unmapped. offset Offset into register space. len Length to be unmapped. DESCRIPTION
ddi_map_regs() maps in the register set given by rnumber. The register number determines which register set will be mapped if more than one exists. The base kernel virtual address of the mapped register set is returned in kaddrp. offset specifies an offset into the register space to start from and len indicates the size of the area to be mapped. If len is non-zero, it overrides the length given in the register set description. See the discussion of the reg property in sbus(4) and for more information on register set descriptions. If len and offset are 0, the entire space is mapped. ddi_unmap_regs() undoes mappings set up by ddi_map_regs(). This is provided for drivers preparing to detach themselves from the system, allowing them to release allocated mappings. Mappings must be released in the same way they were mapped (a call to ddi_unmap_regs() must correspond to a previous call to ddi_map_regs()). Releasing portions of previous mappings is not allowed. rnumber determines which register set will be unmapped if more than one exists. The kaddrp, offset and len specify the area to be unmapped. kaddrp is a pointer to the address returned from ddi_map_regs(); offset and len should match what ddi_map_regs() was called with. RETURN VALUES
ddi_map_regs() returns: DDI_SUCCESS on success. CONTEXT
These functions can be called from user or interrupt context. ATTRIBUTES
See attributes(5) for a description of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Stability Level |Obsolete | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5), sbus(4), ddi_regs_map_free(9F), ddi_regs_map_setup(9F) Writing Device Drivers SunOS 5.10 27 Sep 2002 ddi_map_regs(9F)

Featured Tech Videos