1178172Simp/*-
2178172Simp * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org>
3178172Simp * All rights reserved.
4178172Simp *
5178172Simp * Redistribution and use in source and binary forms, with or without
6178172Simp * modification, are permitted provided that the following conditions
7178172Simp * are met:
8178172Simp * 1. Redistributions of source code must retain the above copyright
9178172Simp *    notice, this list of conditions and the following disclaimer.
10178172Simp * 2. Redistributions in binary form must reproduce the above copyright
11178172Simp *    notice, this list of conditions and the following disclaimer in the
12178172Simp *    documentation and/or other materials provided with the distribution.
13178172Simp *
14178172Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17178172Simp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22178172Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24178172Simp * SUCH DAMAGE.
25178172Simp *
26178172Simp *	from: src/sys/i386/include/runq.h,v 1.3 2005/01/06 22:18:15 imp
27178172Simp * $FreeBSD$
28178172Simp */
29178172Simp
30178172Simp#ifndef _MACHINE_RUNQ_H_
31178172Simp#define	_MACHINE_RUNQ_H_
32178172Simp
33210605Sjchandra#ifdef __mips_n64
34209811Sjchandra#define	RQB_LEN		(1)		/* Number of priority status words. */
35209811Sjchandra#define	RQB_L2BPW	(6)		/* Log2(sizeof(rqb_word_t) * NBBY)). */
36209811Sjchandra#else
37178172Simp#define	RQB_LEN		(2)		/* Number of priority status words. */
38178172Simp#define	RQB_L2BPW	(5)		/* Log2(sizeof(rqb_word_t) * NBBY)). */
39209811Sjchandra#endif
40178172Simp#define	RQB_BPW		(1<<RQB_L2BPW)	/* Bits in an rqb_word_t. */
41178172Simp
42209811Sjchandra#define	RQB_BIT(pri)	(1ul << ((pri) & (RQB_BPW - 1)))
43178172Simp#define	RQB_WORD(pri)	((pri) >> RQB_L2BPW)
44178172Simp
45210605Sjchandra#ifdef __mips_n64
46210605Sjchandra#define	RQB_FFS(word)	(ffsl(word) - 1)
47210605Sjchandra#else
48178172Simp#define	RQB_FFS(word)	(ffs(word) - 1)
49210605Sjchandra#endif
50178172Simp
51178172Simp/*
52178172Simp * Type of run queue status word.
53178172Simp */
54210605Sjchandra#ifdef __mips_n64
55209811Sjchandratypedef	u_int64_t	rqb_word_t;
56209811Sjchandra#else
57209811Sjchandratypedef	u_int32_t	rqb_word_t;
58209811Sjchandra#endif
59178172Simp
60178172Simp#endif
61