160727d8bSWarner Losh /*- 2*71e3c308SPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3*71e3c308SPedro 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 * $FreeBSD$ 29d2ac2316SJake Burkholder */ 30d2ac2316SJake Burkholder 31d2ac2316SJake Burkholder #ifndef _MACHINE_RUNQ_H_ 32d2ac2316SJake Burkholder #define _MACHINE_RUNQ_H_ 33d2ac2316SJake Burkholder 34c3e289e1SNathan Whitehorn #ifdef __powerpc64__ 35c3e289e1SNathan Whitehorn #define RQB_LEN (1UL) /* Number of priority status words. */ 36c3e289e1SNathan Whitehorn #define RQB_L2BPW (6UL) /* Log2(sizeof(rqb_word_t) * NBBY)). */ 37c3e289e1SNathan Whitehorn #else 38d2ac2316SJake Burkholder #define RQB_LEN (2) /* Number of priority status words. */ 39d2ac2316SJake Burkholder #define RQB_L2BPW (5) /* Log2(sizeof(rqb_word_t) * NBBY)). */ 40c3e289e1SNathan Whitehorn #endif 41c3e289e1SNathan Whitehorn #define RQB_BPW (1UL<<RQB_L2BPW) /* Bits in an rqb_word_t. */ 42d2ac2316SJake Burkholder 43c3e289e1SNathan Whitehorn #define RQB_BIT(pri) (1UL << ((pri) & (RQB_BPW - 1))) 44d2ac2316SJake Burkholder #define RQB_WORD(pri) ((pri) >> RQB_L2BPW) 45d2ac2316SJake Burkholder 46c3e289e1SNathan Whitehorn #define RQB_FFS(word) (ffsl(word) - 1) 47d2ac2316SJake Burkholder 48d2ac2316SJake Burkholder /* 49d2ac2316SJake Burkholder * Type of run queue status word. 50d2ac2316SJake Burkholder */ 51c3e289e1SNathan Whitehorn #ifdef __powerpc64__ 52c3e289e1SNathan Whitehorn typedef u_int64_t rqb_word_t; 53c3e289e1SNathan Whitehorn #else 54d2ac2316SJake Burkholder typedef u_int32_t rqb_word_t; 55c3e289e1SNathan Whitehorn #endif 56d2ac2316SJake Burkholder 57d2ac2316SJake Burkholder #endif 58