xref: /freebsd/sys/i386/include/runq.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
186cb007fSWarner Losh /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
383ef78beSPedro F. Giffuni  *
4d2ac2316SJake Burkholder  * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org>
5d2ac2316SJake Burkholder  * All rights reserved.
6d2ac2316SJake Burkholder  *
7d2ac2316SJake Burkholder  * Redistribution and use in source and binary forms, with or without
8d2ac2316SJake Burkholder  * modification, are permitted provided that the following conditions
9d2ac2316SJake Burkholder  * are met:
10d2ac2316SJake Burkholder  * 1. Redistributions of source code must retain the above copyright
11d2ac2316SJake Burkholder  *    notice, this list of conditions and the following disclaimer.
12d2ac2316SJake Burkholder  * 2. Redistributions in binary form must reproduce the above copyright
13d2ac2316SJake Burkholder  *    notice, this list of conditions and the following disclaimer in the
14d2ac2316SJake Burkholder  *    documentation and/or other materials provided with the distribution.
15d2ac2316SJake Burkholder  *
16d2ac2316SJake Burkholder  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17d2ac2316SJake Burkholder  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18d2ac2316SJake Burkholder  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19d2ac2316SJake Burkholder  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20d2ac2316SJake Burkholder  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21d2ac2316SJake Burkholder  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22d2ac2316SJake Burkholder  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23d2ac2316SJake Burkholder  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24d2ac2316SJake Burkholder  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25d2ac2316SJake Burkholder  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26d2ac2316SJake Burkholder  * SUCH DAMAGE.
27d2ac2316SJake Burkholder  */
28d2ac2316SJake Burkholder 
29d2ac2316SJake Burkholder #ifndef	_MACHINE_RUNQ_H_
30d2ac2316SJake Burkholder #define	_MACHINE_RUNQ_H_
31d2ac2316SJake Burkholder 
32d2ac2316SJake Burkholder #define	RQB_LEN		(2)		/* Number of priority status words. */
33d2ac2316SJake Burkholder #define	RQB_L2BPW	(5)		/* Log2(sizeof(rqb_word_t) * NBBY)). */
34d2ac2316SJake Burkholder #define	RQB_BPW		(1<<RQB_L2BPW)	/* Bits in an rqb_word_t. */
35d2ac2316SJake Burkholder 
36d2ac2316SJake Burkholder #define	RQB_BIT(pri)	(1 << ((pri) & (RQB_BPW - 1)))
37d2ac2316SJake Burkholder #define	RQB_WORD(pri)	((pri) >> RQB_L2BPW)
38d2ac2316SJake Burkholder 
392f9267ecSPeter Wemm #define	RQB_FFS(word)	(ffs(word) - 1)
40d2ac2316SJake Burkholder 
41d2ac2316SJake Burkholder /*
42d2ac2316SJake Burkholder  * Type of run queue status word.
43d2ac2316SJake Burkholder  */
44d2ac2316SJake Burkholder typedef	u_int32_t	rqb_word_t;
45d2ac2316SJake Burkholder 
46d2ac2316SJake Burkholder #endif
47