2 * Copyright (c) 2005-2009 Ariff Abdullah <ariff@FreeBSD.org>
3 * Copyright (c) 1999 Cameron Grant <cg@FreeBSD.org>
4 * Copyright (c) 1995 Hannu Savolainen
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * $FreeBSD: head/sys/dev/sound/pcm/sound.h 274035 2014-11-03 11:11:45Z bapt $
32 * first, include kernel header files.
39 #include <sys/param.h>
40 #include <sys/systm.h>
41 #include <sys/ioccom.h>
42 #include <sys/filio.h>
43 #include <sys/sockio.h>
44 #include <sys/fcntl.h>
46 #include <sys/kernel.h> /* for DATA_SET */
47 #include <sys/module.h>
51 #include <sys/syslog.h>
52 #include <sys/errno.h>
53 #include <sys/malloc.h>
56 #include <sys/limits.h>
60 #include <sys/soundcard.h>
61 #include <sys/sysctl.h>
67 #include <sys/mplock2.h>
68 #include <sys/mutex.h>
69 #include <sys/condvar.h>
70 #include <sys/taskqueue.h>
72 #ifndef KOBJMETHOD_END
73 #define KOBJMETHOD_END { NULL, NULL }
81 #include <dev/sound/pcm/buffer.h>
82 #include <dev/sound/pcm/matrix.h>
83 #include <dev/sound/pcm/matrix_map.h>
84 #include <dev/sound/pcm/channel.h>
85 #include <dev/sound/pcm/feeder.h>
86 #include <dev/sound/pcm/mixer.h>
87 #include <dev/sound/pcm/dsp.h>
88 #include <dev/sound/clone.h>
89 #include <dev/sound/unit.h>
91 #define PCM_SOFTC_SIZE (sizeof(struct snddev_info))
93 #define SND_STATUSLEN 64
95 #define SOUND_MODVER 5
97 #define SOUND_MINVER SOUND_MODVER
98 #define SOUND_PREFVER SOUND_MODVER
99 #define SOUND_MAXVER SOUND_MODVER
102 * Minor number encoding: 0xFFFF00FF
108 #define SND_U_MASK 0x000000FF
109 #define SND_C_MASK 0x07FF0000
110 #define SND_D_MASK 0xF8000000
112 #define PCMMAXUNIT 255
114 #define PCMMAXCHAN 2047
115 #define PCMMAXCLONE PCMMAXCHAN
120 #define PCMUNIT(x) (minor(x) & 0x00FF)
121 #define PCMSUBUNIT(x) ((minor(x) >> 16) & 0x07FF)
122 #define PCMDEV(x) ((minor(x) >> 27) & 0x001F)
124 #define PCMUNIT_DEFAULT 0x00FF
126 #define PCMMKMINOR(u, d, sub) (snd_u2unit(u) | snd_c2unit(sub) | snd_d2unit(d))
128 #define snd_unit2u(m) ((m) & 0x00FF)
129 #define snd_unit2c(m) (((m) >> 16) & 0x07FF)
130 #define snd_unit2d(m) (((m) >> 27) & 0x001F)
132 #define snd_u2unit(u) ((u) & 0x00FF)
133 #define snd_c2unit(c) (((c) & 0x07FF) << 16)
134 #define snd_d2unit(d) (((d) & 0x001F) << 27)
136 #define snd_mkunit(u, d, c) (snd_u2unit(u) | snd_d2unit(d) | snd_c2unit(c))
139 * By design, limit possible channels for each direction.
141 #define SND_MAXHWCHAN 256
142 #define SND_MAXVCHANS SND_MAXHWCHAN
144 #define SD_F_SIMPLEX 0x00000001
145 #define SD_F_AUTOVCHAN 0x00000002
146 #define SD_F_SOFTPCMVOL 0x00000004
148 * Obsolete due to better matrixing
151 #define SD_F_PSWAPLR 0x00000008
152 #define SD_F_RSWAPLR 0x00000010
154 #define SD_F_DYING 0x00000008
155 #define SD_F_SUICIDE 0x00000010
156 #define SD_F_BUSY 0x00000020
157 #define SD_F_MPSAFE 0x00000040
158 #define SD_F_REGISTERED 0x00000080
159 #define SD_F_BITPERFECT 0x00000100
160 #define SD_F_VPC 0x00000200 /* volume-per-channel */
161 #define SD_F_EQ 0x00000400 /* EQ */
162 #define SD_F_EQ_ENABLED 0x00000800 /* EQ enabled */
163 #define SD_F_EQ_BYPASSED 0x00001000 /* EQ bypassed */
164 #define SD_F_EQ_PC 0x00002000 /* EQ per-channel */
166 #define SD_F_EQ_DEFAULT (SD_F_EQ | SD_F_EQ_ENABLED)
167 #define SD_F_EQ_MASK (SD_F_EQ | SD_F_EQ_ENABLED | \
168 SD_F_EQ_BYPASSED | SD_F_EQ_PC)
170 #define SD_F_PRIO_RD 0x10000000
171 #define SD_F_PRIO_WR 0x20000000
172 #define SD_F_PRIO_SET (SD_F_PRIO_RD | SD_F_PRIO_WR)
173 #define SD_F_DIR_SET 0x40000000
174 #define SD_F_TRANSIENT 0xf0000000
176 #define SD_F_BITS "\020" \
195 #define PCM_ALIVE(x) ((x) != NULL && (x)->lock != NULL && \
196 !((x)->flags & SD_F_DYING))
197 #define PCM_REGISTERED(x) (PCM_ALIVE(x) && \
198 ((x)->flags & SD_F_REGISTERED))
200 /* many variables should be reduced to a range. Here define a macro */
201 #define RANGE(var, low, high) (var) = \
202 (((var)<(low))? (low) : ((var)>(high))? (high) : (var))
203 #define DSP_BUFFSIZE (8192)
205 /* make figuring out what a format is easier. got AFMT_STEREO already */
206 #define AFMT_32BIT (AFMT_S32_LE | AFMT_S32_BE | AFMT_U32_LE | AFMT_U32_BE)
207 #define AFMT_24BIT (AFMT_S24_LE | AFMT_S24_BE | AFMT_U24_LE | AFMT_U24_BE)
208 #define AFMT_16BIT (AFMT_S16_LE | AFMT_S16_BE | AFMT_U16_LE | AFMT_U16_BE)
209 #define AFMT_G711 (AFMT_MU_LAW | AFMT_A_LAW)
210 #define AFMT_8BIT (AFMT_G711 | AFMT_U8 | AFMT_S8)
211 #define AFMT_SIGNED (AFMT_S32_LE | AFMT_S32_BE | AFMT_S24_LE | AFMT_S24_BE | \
212 AFMT_S16_LE | AFMT_S16_BE | AFMT_S8)
213 #define AFMT_BIGENDIAN (AFMT_S32_BE | AFMT_U32_BE | AFMT_S24_BE | AFMT_U24_BE | \
214 AFMT_S16_BE | AFMT_U16_BE)
216 #define AFMT_CONVERTIBLE (AFMT_8BIT | AFMT_16BIT | AFMT_24BIT | \
219 /* Supported vchan mixing formats */
220 #define AFMT_VCHAN (AFMT_CONVERTIBLE & ~AFMT_G711)
222 #define AFMT_PASSTHROUGH AFMT_AC3
223 #define AFMT_PASSTHROUGH_RATE 48000
224 #define AFMT_PASSTHROUGH_CHANNEL 2
225 #define AFMT_PASSTHROUGH_EXTCHANNEL 0
228 * We're simply using unused, contiguous bits from various AFMT_ definitions.
231 #define AFMT_ENCODING_MASK 0xf00fffff
232 #define AFMT_CHANNEL_MASK 0x01f00000
233 #define AFMT_CHANNEL_SHIFT 20
234 #define AFMT_CHANNEL_MAX 0x7f
235 #define AFMT_EXTCHANNEL_MASK 0x0e000000
236 #define AFMT_EXTCHANNEL_SHIFT 25
238 #define AFMT_ENCODING(v) ((v) & AFMT_ENCODING_MASK)
240 #define AFMT_EXTCHANNEL(v) (((v) & AFMT_EXTCHANNEL_MASK) >> \
241 AFMT_EXTCHANNEL_SHIFT)
243 #define AFMT_CHANNEL(v) (((v) & AFMT_CHANNEL_MASK) >> \
246 #define AFMT_BIT(v) (((v) & AFMT_32BIT) ? 32 : \
247 (((v) & AFMT_24BIT) ? 24 : \
248 ((((v) & AFMT_16BIT) || \
249 ((v) & AFMT_PASSTHROUGH)) ? 16 : 8)))
251 #define AFMT_BPS(v) (AFMT_BIT(v) >> 3)
252 #define AFMT_ALIGN(v) (AFMT_BPS(v) * AFMT_CHANNEL(v))
254 #define SND_FORMAT(f, c, e) (AFMT_ENCODING(f) | \
255 (((c) << AFMT_CHANNEL_SHIFT) & \
256 AFMT_CHANNEL_MASK) | \
257 (((e) << AFMT_EXTCHANNEL_SHIFT) & \
258 AFMT_EXTCHANNEL_MASK))
260 #define AFMT_U8_NE AFMT_U8
261 #define AFMT_S8_NE AFMT_S8
263 #define AFMT_SIGNED_NE (AFMT_S8_NE | AFMT_S16_NE | AFMT_S24_NE | AFMT_S32_NE)
265 #define AFMT_NE (AFMT_SIGNED_NE | AFMT_U8_NE | AFMT_U16_NE | \
266 AFMT_U24_NE | AFMT_U32_NE)
269 * Minor numbers for the sound driver.
271 * Unfortunately Creative called the codec chip of SB as a DSP. For this
272 * reason the /dev/dsp is reserved for digitized audio use. There is a
273 * device for true DSP processors but it will be called something else.
274 * In v3.0 it's /dev/sndproc but this could be a temporary solution.
277 #define SND_DEV_CTL 0 /* Control port /dev/mixer */
278 #define SND_DEV_SEQ 1 /* Sequencer /dev/sequencer */
279 #define SND_DEV_MIDIN 2 /* Raw midi access */
280 #define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */
281 #define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
282 #define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */
283 #define SND_DEV_STATUS 6 /* /dev/sndstat */
284 /* #7 not in use now. */
285 #define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */
286 #define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */
287 #define SND_DEV_PSS SND_DEV_SNDPROC /* ? */
288 #define SND_DEV_NORESET 10
290 #define SND_DEV_DSPHW_PLAY 11 /* specific playback channel */
291 #define SND_DEV_DSPHW_VPLAY 12 /* specific virtual playback channel */
292 #define SND_DEV_DSPHW_REC 13 /* specific record channel */
293 #define SND_DEV_DSPHW_VREC 14 /* specific virtual record channel */
295 #define SND_DEV_DSPHW_CD 15 /* s16le/stereo 44100Hz CD */
298 * OSSv4 compatible device. For now, it serve no purpose and
299 * the cloning itself will forward the request to ordinary /dev/dsp
302 #define SND_DEV_DSP_MMAP 16 /* /dev/dsp_mmap */
303 #define SND_DEV_DSP_AC3 17 /* /dev/dsp_ac3 */
304 #define SND_DEV_DSP_MULTICH 18 /* /dev/dsp_multich */
305 #define SND_DEV_DSP_SPDIFOUT 19 /* /dev/dsp_spdifout */
306 #define SND_DEV_DSP_SPDIFIN 20 /* /dev/dsp_spdifin */
308 #define SND_DEV_LAST SND_DEV_DSP_SPDIFIN
309 #define SND_DEV_MAX PCMMAXDEV
311 #define DSP_DEFAULT_SPEED 8000
316 extern int pcm_veto_load;
318 extern int snd_maxautovchans;
319 extern int snd_verbose;
320 extern devclass_t pcm_devclass;
321 extern struct unrhdr *pcmsg_unrhdr;
324 * some macros for debugging purposes
325 * DDB/DEB to enable/disable debugging stuff
326 * BVDDB to enable debugging when bootverbose
328 #define BVDDB(x) if (bootverbose) x
334 SYSCTL_DECL(_hw_snd);
336 int pcm_setvchans(struct snddev_info *d, int direction, int newcnt, int num);
337 int pcm_chnalloc(struct snddev_info *d, struct pcm_channel **ch, int direction,
338 pid_t pid, char *comm, int devunit);
339 int pcm_chnrelease(struct pcm_channel *c);
340 int pcm_chnref(struct pcm_channel *c, int ref);
341 int pcm_inprog(struct snddev_info *d, int delta);
343 struct pcm_channel *pcm_chn_create(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, int dir, int num, void *devinfo);
344 int pcm_chn_destroy(struct pcm_channel *ch);
345 int pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch);
346 int pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch);
348 int pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo);
349 unsigned int pcm_getbuffersize(device_t dev, unsigned int minbufsz, unsigned int deflt, unsigned int maxbufsz);
350 int pcm_register(device_t dev, void *devinfo, int numplay, int numrec);
351 int pcm_unregister(device_t dev);
352 int pcm_setstatus(device_t dev, char *str);
353 u_int32_t pcm_getflags(device_t dev);
354 void pcm_setflags(device_t dev, u_int32_t val);
355 void *pcm_getdevinfo(device_t dev);
358 int snd_setup_intr(device_t dev, struct resource *res, int flags,
359 driver_intr_t hand, void *param, void **cookiep);
361 void *snd_mtxcreate(const char *desc, const char *type);
362 void snd_mtxfree(void *m);
363 void snd_mtxassert(void *m);
364 #define snd_mtxlock(m) lockmgr(m, LK_EXCLUSIVE)
365 #define snd_mtxunlock(m) lockmgr(m, LK_RELEASE)
367 typedef int (*sndstat_handler)(struct sbuf *s, device_t dev, int verbose);
368 int sndstat_acquire(struct thread *td);
369 int sndstat_release(struct thread *td);
370 int sndstat_register(device_t dev, char *str, sndstat_handler handler);
371 int sndstat_registerfile(char *str);
372 int sndstat_unregister(device_t dev);
373 int sndstat_unregisterfile(char *str);
375 #define SND_DECLARE_FILE(version) \
376 _SND_DECLARE_FILE(__LINE__, version)
378 #define _SND_DECLARE_FILE(uniq, version) \
379 __SND_DECLARE_FILE(uniq, version)
381 #define __SND_DECLARE_FILE(uniq, version) \
382 static char sndstat_vinfo[] = version; \
383 SYSINIT(sdf_ ## uniq, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sndstat_registerfile, sndstat_vinfo); \
384 SYSUNINIT(sdf_ ## uniq, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sndstat_unregisterfile, sndstat_vinfo);
386 /* usage of flags in device config entry (config file) */
387 #define DV_F_DRQ_MASK 0x00000007 /* mask for secondary drq */
388 #define DV_F_DUAL_DMA 0x00000010 /* set to use secondary dma channel */
390 /* ought to be made obsolete but still used by mss */
391 #define DV_F_DEV_MASK 0x0000ff00 /* force device type/class */
392 #define DV_F_DEV_SHIFT 8 /* force device type/class */
395 * this is rather kludgey- we need to duplicate these struct def'ns from sound.c
396 * so that the macro versions of pcm_{,un}lock can dereference them.
397 * we also have to do this now makedev() has gone away.
403 SLIST_HEAD(, pcm_channel) head;
405 SLIST_HEAD(, pcm_channel) head;
408 SLIST_HEAD(, pcm_channel) head;
412 TAILQ_HEAD(dsp_cdevinfo_linkhead, dsp_cdevinfo) dsp_cdevinfo_pool;
413 struct snd_clone *clones;
414 unsigned devcount, playcount, reccount, pvchancount, rvchancount ;
420 char status[SND_STATUSLEN];
422 struct cdev *mixer_dev;
423 struct cdev *dsp_clonedev;
424 uint32_t pvchanrate, pvchanformat;
425 uint32_t rvchanrate, rvchanformat;
427 struct sysctl_ctx_list play_sysctl_ctx, rec_sysctl_ctx;
428 struct sysctl_oid *play_sysctl_tree, *rec_sysctl_tree;
432 void sound_oss_sysinfo(oss_sysinfo *);
433 int sound_oss_card_info(oss_card_info *);
435 #define PCM_LOCKOWNED(d) (lockstatus((d)->lock, curthread) == LK_EXCLUSIVE)
436 #define PCM_LOCK(d) lockmgr((d)->lock, LK_EXCLUSIVE)
437 #define PCM_UNLOCK(d) lockmgr((d)->lock, LK_RELEASE)
438 #define PCM_TRYLOCK(d) lockmgr((d)->lock, LK_EXCLUSIVE|LK_NOWAIT)
439 #define PCM_LOCKASSERT(d) KKASSERT(lockstatus((d)->lock, curthread) == LK_EXCLUSIVE)
440 #define PCM_UNLOCKASSERT(d) KKASSERT(lockstatus((d)->lock, curthread) != LK_EXCLUSIVE)
443 * For PCM_[WAIT | ACQUIRE | RELEASE], be sure to surround these
444 * with PCM_LOCK/UNLOCK() sequence, or I'll come to gnaw upon you!
446 #ifdef SND_DIAGNOSTIC
447 #define PCM_WAIT(x) do { \
448 if (!PCM_LOCKOWNED(x)) \
449 panic("%s(%d): [PCM WAIT] Mutex not owned!", \
450 __func__, __LINE__); \
451 while ((x)->flags & SD_F_BUSY) { \
452 if (snd_verbose > 3) \
453 device_printf((x)->dev, \
454 "%s(%d): [PCM WAIT] calling cv_wait().\n", \
455 __func__, __LINE__); \
456 cv_wait(&(x)->cv, (x)->lock); \
460 #define PCM_ACQUIRE(x) do { \
461 if (!PCM_LOCKOWNED(x)) \
462 panic("%s(%d): [PCM ACQUIRE] Mutex not owned!", \
463 __func__, __LINE__); \
464 if ((x)->flags & SD_F_BUSY) \
465 panic("%s(%d): [PCM ACQUIRE] " \
466 "Trying to acquire BUSY cv!", __func__, __LINE__); \
467 (x)->flags |= SD_F_BUSY; \
470 #define PCM_RELEASE(x) do { \
471 if (!PCM_LOCKOWNED(x)) \
472 panic("%s(%d): [PCM RELEASE] Mutex not owned!", \
473 __func__, __LINE__); \
474 if ((x)->flags & SD_F_BUSY) { \
475 (x)->flags &= ~SD_F_BUSY; \
476 if ((x)->cv.cv_waiters != 0) { \
477 if ((x)->cv.cv_waiters > 1 && snd_verbose > 3) \
478 device_printf((x)->dev, \
479 "%s(%d): [PCM RELEASE] " \
480 "cv_waiters=%d > 1!\n", \
481 __func__, __LINE__, \
482 (x)->cv.cv_waiters); \
483 cv_broadcast(&(x)->cv); \
486 panic("%s(%d): [PCM RELEASE] Releasing non-BUSY cv!", \
487 __func__, __LINE__); \
490 /* Quick version, for shorter path. */
491 #define PCM_ACQUIRE_QUICK(x) do { \
492 if (PCM_LOCKOWNED(x)) \
493 panic("%s(%d): [PCM ACQUIRE QUICK] Mutex owned!", \
494 __func__, __LINE__); \
501 #define PCM_RELEASE_QUICK(x) do { \
502 if (PCM_LOCKOWNED(x)) \
503 panic("%s(%d): [PCM RELEASE QUICK] Mutex owned!", \
504 __func__, __LINE__); \
510 #define PCM_BUSYASSERT(x) do { \
511 if (!((x) != NULL && ((x)->flags & SD_F_BUSY))) \
512 panic("%s(%d): [PCM BUSYASSERT] " \
513 "Failed, snddev_info=%p", __func__, __LINE__, x); \
516 #define PCM_GIANT_ENTER(x) do { \
517 int _pcm_giant = 0; \
518 if (PCM_LOCKOWNED(x)) \
519 panic("%s(%d): [GIANT ENTER] PCM lock owned!", \
520 __func__, __LINE__); \
521 if (mtx_owned(&Giant) != 0 && snd_verbose > 3) \
522 device_printf((x)->dev, \
523 "%s(%d): [GIANT ENTER] Giant owned!\n", \
524 __func__, __LINE__); \
525 if (!((x)->flags & SD_F_MPSAFE) && mtx_owned(&Giant) == 0) \
531 #define PCM_GIANT_EXIT(x) do { \
532 if (PCM_LOCKOWNED(x)) \
533 panic("%s(%d): [GIANT EXIT] PCM lock owned!", \
534 __func__, __LINE__); \
535 if (!(_pcm_giant == 0 || _pcm_giant == 1)) \
536 panic("%s(%d): [GIANT EXIT] _pcm_giant screwed!", \
537 __func__, __LINE__); \
538 if ((x)->flags & SD_F_MPSAFE) { \
539 if (_pcm_giant == 1) \
540 panic("%s(%d): [GIANT EXIT] MPSAFE Giant?", \
541 __func__, __LINE__); \
542 if (mtx_owned(&Giant) != 0 && snd_verbose > 3) \
543 device_printf((x)->dev, \
544 "%s(%d): [GIANT EXIT] Giant owned!\n", \
545 __func__, __LINE__); \
547 if (_pcm_giant != 0) { \
548 if (mtx_owned(&Giant) == 0) \
549 panic("%s(%d): [GIANT EXIT] Giant not owned!", \
550 __func__, __LINE__); \
552 mtx_unlock(&Giant); \
555 #else /* SND_DIAGNOSTIC */
556 #define PCM_WAIT(x) do { \
558 while ((x)->flags & SD_F_BUSY) \
559 cv_wait(&(x)->cv, (x)->lock); \
562 #define PCM_ACQUIRE(x) do { \
564 KASSERT(!((x)->flags & SD_F_BUSY), \
565 ("%s(%d): [PCM ACQUIRE] Trying to acquire BUSY cv!", \
566 __func__, __LINE__)); \
567 (x)->flags |= SD_F_BUSY; \
570 #define PCM_RELEASE(x) do { \
572 KASSERT((x)->flags & SD_F_BUSY, \
573 ("%s(%d): [PCM RELEASE] Releasing non-BUSY cv!", \
574 __func__, __LINE__)); \
575 (x)->flags &= ~SD_F_BUSY; \
576 if ((x)->cv.cv_waiters != 0) \
577 cv_broadcast(&(x)->cv); \
580 /* Quick version, for shorter path. */
581 #define PCM_ACQUIRE_QUICK(x) do { \
582 PCM_UNLOCKASSERT(x); \
589 #define PCM_RELEASE_QUICK(x) do { \
590 PCM_UNLOCKASSERT(x); \
596 #define PCM_BUSYASSERT(x) KASSERT(x != NULL && \
597 ((x)->flags & SD_F_BUSY), \
598 ("%s(%d): [PCM BUSYASSERT] " \
599 "Failed, snddev_info=%p", \
600 __func__, __LINE__, x))
602 #define PCM_GIANT_ENTER(x) do { \
603 if (!((x)->flags & SD_F_MPSAFE)) \
607 #define PCM_GIANT_EXIT(x) do { \
608 if (!((x)->flags & SD_F_MPSAFE)) \
611 #endif /* !SND_DIAGNOSTIC */
613 #define PCM_GIANT_LEAVE(x) PCM_GIANT_EXIT(x)
616 #define PCM_KLDSTRING(a) ("kld " # a)
618 #define PCM_KLDSTRING(a) ""