xref: /freebsd/sys/i386/include/runq.h (revision 2f9267ec2327d71bca865a65fefdf1afa83c6778)
1d2ac2316SJake Burkholder /*
2d2ac2316SJake Burkholder  * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org>
3d2ac2316SJake Burkholder  * All rights reserved.
4d2ac2316SJake Burkholder  *
5d2ac2316SJake Burkholder  * Redistribution and use in source and binary forms, with or without
6d2ac2316SJake Burkholder  * modification, are permitted provided that the following conditions
7d2ac2316SJake Burkholder  * are met:
8d2ac2316SJake Burkholder  * 1. Redistributions of source code must retain the above copyright
9d2ac2316SJake Burkholder  *    notice, this list of conditions and the following disclaimer.
10d2ac2316SJake Burkholder  * 2. Redistributions in binary form must reproduce the above copyright
11d2ac2316SJake Burkholder  *    notice, this list of conditions and the following disclaimer in the
12d2ac2316SJake Burkholder  *    documentation and/or other materials provided with the distribution.
13d2ac2316SJake Burkholder  *
14d2ac2316SJake Burkholder  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15d2ac2316SJake Burkholder  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16d2ac2316SJake Burkholder  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17d2ac2316SJake Burkholder  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18d2ac2316SJake Burkholder  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19d2ac2316SJake Burkholder  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20d2ac2316SJake Burkholder  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21d2ac2316SJake Burkholder  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22d2ac2316SJake Burkholder  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23d2ac2316SJake Burkholder  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24d2ac2316SJake Burkholder  * SUCH DAMAGE.
25d2ac2316SJake Burkholder  *
26d2ac2316SJake Burkholder  * $FreeBSD$
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