Print this page
XXXX introduce drv_sectohz
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/ddi.h
+++ new/usr/src/uts/common/sys/ddi.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 + * Copyright 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
24 25 *
25 26 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
26 27 * Use is subject to license terms.
27 28 */
28 29
29 30 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
30 31 /* All Rights Reserved */
31 32
32 33
33 34 #ifndef _SYS_DDI_H
34 35 #define _SYS_DDI_H
35 36
36 37 #include <sys/types.h>
37 38 #include <sys/map.h>
38 39 #include <sys/buf.h>
39 40 #include <sys/uio.h>
40 41 #include <sys/stream.h>
41 42
42 43 #ifdef __cplusplus
43 44 extern "C" {
44 45 #endif
45 46
46 47 /*
47 48 * ddi.h -- the flag and function definitions needed by DDI-conforming
48 49 * drivers. This header file contains #undefs to undefine macros that
49 50 * drivers would otherwise pick up in order that function definitions
50 51 * may be used. Programmers should place the include of "sys/ddi.h"
51 52 * after any header files that define the macros #undef'ed or the code
52 53 * may compile incorrectly.
53 54 */
54 55
55 56 /*
56 57 * define min() and max() as macros so that drivers will not pick up the
57 58 * min() and max() kernel functions since they do signed comparison only.
58 59 */
59 60 #ifdef min
60 61 #undef min
61 62 #endif /* min */
62 63 #define min(a, b) ((a) < (b) ? (a) : (b))
63 64
64 65 #ifdef max
65 66 #undef max
66 67 #endif /* max */
67 68 #define max(a, b) ((a) < (b) ? (b) : (a))
68 69
69 70 #define TIME 1
70 71 #define UPROCP 2
71 72 #define PPGRP 3
72 73 #define LBOLT 4
73 74 #define SYSRINT 5
74 75 #define SYSXINT 6
75 76 #define SYSMINT 7
76 77 #define SYSRAWC 8
77 78 #define SYSCANC 9
↓ open down ↓ |
44 lines elided |
↑ open up ↑ |
78 79 #define SYSOUTC 10
79 80 #define PPID 11
80 81 #define PSID 12
81 82 #define UCRED 13
82 83
83 84 extern int drv_getparm(uint_t, void *);
84 85 extern int drv_setparm(uint_t, ulong_t);
85 86 extern void drv_usecwait(clock_t);
86 87 extern clock_t drv_hztousec(clock_t);
87 88 extern clock_t drv_usectohz(clock_t);
89 +extern clock_t drv_sectohz(clock_t);
88 90 extern void delay(clock_t);
89 91 extern void time_to_wait(clock_t *, clock_t);
90 92
91 93 /* XXX -- should be changed to major_t */
92 94 /* convert external to internal major number */
93 95
94 96 extern int etoimajor(major_t);
95 97 /* convert internal to extern major number */
96 98 extern int itoemajor(major_t, int);
97 99 extern int drv_priv(struct cred *);
98 100
99 101 /*
100 102 * The following declarations take the place of macros in
101 103 * sysmacros.h The undefs are for any case where a driver includes
102 104 * sysmacros.h, even though DDI conforming drivers must not.
103 105 */
104 106 #undef getemajor
105 107 #undef geteminor
106 108 #undef getmajor
107 109 #undef getminor
108 110 #undef makedevice
109 111 #undef cmpdev
110 112 #undef expdev
111 113
112 114
113 115 extern major_t getemajor(dev_t);
114 116 extern minor_t geteminor(dev_t);
115 117 extern major_t getmajor(dev_t);
116 118 extern minor_t getminor(dev_t);
117 119 extern dev_t makedevice(major_t, minor_t);
118 120 extern o_dev_t cmpdev(dev_t);
119 121 extern dev_t expdev(dev_t);
120 122
121 123 /*
122 124 * The following macros from param.h are also being converted to
123 125 * functions and #undefs must be done here as well since param.h
124 126 * will be included by most if not every driver
125 127 */
126 128
127 129 #undef btop
128 130 #undef btopr
129 131 #undef ptob
130 132
131 133 extern unsigned long btop(unsigned long);
132 134 extern unsigned long btopr(unsigned long);
133 135 extern unsigned long ptob(unsigned long);
134 136
135 137
136 138 /* STREAMS drivers and modules must include stream.h to pick up the */
137 139 /* needed structure and flag definitions. As was the case with map.h, */
138 140 /* macros used by both the kernel and drivers in times past now have */
139 141 /* a macro definition for the kernel and a function definition for */
140 142 /* drivers. The following #undefs allow drivers to include stream.h */
141 143 /* but call the functions rather than macros. */
142 144
143 145 #undef OTHERQ
144 146 #undef RD
145 147 #undef WR
146 148 #undef SAMESTR
147 149 #undef datamsg
148 150
149 151 extern struct queue *OTHERQ(queue_t *); /* stream.h */
150 152 extern struct queue *RD(queue_t *);
151 153 extern struct queue *WR(queue_t *);
152 154 extern int SAMESTR(queue_t *);
153 155 extern int datamsg(unsigned char);
154 156
155 157 /* declarations of functions for allocating and deallocating the space */
156 158 /* for a buffer header (just a header, not the associated buffer) */
157 159
158 160 extern struct buf *getrbuf(int);
159 161 extern void freerbuf(struct buf *);
160 162
161 163 #ifdef _KERNEL
162 164 /*
163 165 * SVR4MP replacement for hat_getkpfnum()
164 166 */
165 167 #define NOPAGE (-1) /* value returned for invalid addresses */
166 168
167 169 typedef pfn_t ppid_t; /* a 'physical page identifier' - no math allowed! */
168 170
169 171 extern ppid_t kvtoppid(caddr_t);
170 172
171 173 extern int qassociate(queue_t *, int);
172 174
173 175 #endif /* _KERNEL */
174 176
175 177 #ifdef __cplusplus
176 178 }
177 179 #endif
178 180
179 181 #endif /* _SYS_DDI_H */
↓ open down ↓ |
82 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX