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