Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

badaddr(9r) [osf1 man page]

BADADDR(9r)															       BADADDR(9r)

NAME
BADADDR - General: Probes the address during device autoconfiguration SYNOPSIS
int BADADDR( caddr_t addr, int length, struct bus_ctlr_common *ptr ); ARGUMENTS
Specifies the address of the device registers or memory. Specifies the length (in bytes) of the data to be checked. Valid values are 1, 2, and 4 on 32-bit machines and 4 and 8 on 64-bit machines. Specifies a pointer to a bus_ctlr_common structure. You cast this argument as a pointer to either a bus or controller structure. DESCRIPTION
The BADADDR routine generates a call to a machine-dependent routine that does a read access check of the data at the supplied address and dismisses any machine check exception that may result from the attempted access. You call this routine to probe for memory or I/O devices at a specified address during device autoconfiguration. NOTES
You can use BADADDR in device drivers that are statically configured into the kernel. However, you cannot use BADADDR if the driver is dynamically configured into the kernel. If you implement the driver to be both statically and dynamically configured, you can declare a variable and use it to control the call to BADADDR. The following code fragment shows the use of such a variable used in the probe routine for the /dev/none driver: . . . if (none_is_dynamic) { /* Code to handle tasks associated with a dynamically * * configured driver */ . . . } else { /* Code to handle tasks (including the call to BADADDR) * * associated with a statically configured driver * * including call to BADADDR */ } . . . The EISA and ISA buses do not generate a machine check when BADADDR performs a read access to a nonexistent location. These buses always return success when BADADDR performs a read access to their address space. For the PCI bus and the VMEbus, you must do the following before calling BADADDR: Call the iohandle_to_phys routine to convert the I/O han- dle to a valid system physical address Call the PHYS_TO_KSEG routine to convert the valid system physical address to a kernel-unmapped vir- tual address Call the BADADDR routine, passing this kernel-unmapped virtual address as the first argument RETURN VALUES
The BADADDR routine returns the value 0 (zero) if the data is accessible or a nonzero value if the data is not accessible. BADADDR(9r)

Check Out this Related 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.10 13 June 2004 hat_getkpfnum(9F)
Man Page