1hat_getkpfnum(9F)        Kernel Functions for Drivers        hat_getkpfnum(9F)
2
3
4

NAME

6       hat_getkpfnum - get page frame number for kernel address
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <sys/ddi.h>
11       #include <sys/sunddi.h>
12
13       pfn_t hat_getkpfnum(caddr_t addr);
14
15

INTERFACE LEVEL

17       This  interface  is obsolete. A driver devmap(9E) entry point should be
18       provided instead.
19

PARAMETERS

21       addr     The kernel virtual address for which the page frame number  is
22                to be returned.
23
24

DESCRIPTION

26       hat_getkpfnum() returns the page frame number corresponding to the ker‐
27       nel virtual address, addr.
28
29
30       addr must be a kernel virtual address  which  maps  to  device  memory.
31       ddi_map_regs(9F)  can  be  used  to  obtain  this address. For example,
32       ddi_map_regs(9F) can be called in the driver's attach(9E) routine.  The
33       resulting  kernel  virtual  address  can  be  saved  by the driver (see
34       ddi_soft_state(9F))   and   used   in   mmap(9E).   The   corresponding
35       ddi_unmap_regs(9F) call can be made in the driver's detach(9E) routine.
36       Refer to mmap(9E) for more information.
37

RETURN VALUES

39       The page frame number corresponding to the valid, device-mapped virtual
40       address addr. Otherwise the return value is undefined.
41

CONTEXT

43       hat_getkpfnum() can be called only from user or kernel context.
44

ATTRIBUTES

46       See attributes(5) for descriptions of the following attributes:
47
48
49
50
51       ┌─────────────────────────────┬─────────────────────────────┐
52       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
53       ├─────────────────────────────┼─────────────────────────────┤
54       │Interface stability          │Obsolete                     │
55       └─────────────────────────────┴─────────────────────────────┘
56

SEE ALSO

58       attach(9E),   detach(9E),   devmap(9E),   mmap(9E),   ddi_map_regs(9F),
59       ddi_soft_state(9F), ddi_unmap_regs(9F)
60
61
62       Writing Device Drivers
63

NOTES

65       For some devices, mapping device memory in the driver's attach(9E) rou‐
66       tine  and unmapping device memory in the driver's detach(9E) routine is
67       a sizeable drain on system  resources.  This  is  especially  true  for
68       devices  with  a  large  amount  of  physical  address  space. Refer to
69       mmap(9E) for alternative methods.
70
71
72
73SunOS 5.11                       13 June 2004                hat_getkpfnum(9F)
Impressum