Lines Matching +full:out +full:- +full:of +full:- +full:window

1 /*-
2 * Copyright (c) 2015-2016 Landon Fuller <landon@landonf.org>
6 * Portions of this software were developed by Landon Fuller
9 * Portions of this software were developed by Landon Fuller
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer,
26 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
29 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
34 * THE POSSIBILITY OF SUCH DAMAGES.
146 * Dynamic register window allocation reference.
154 * A dynamic register window allocation record.
157 const struct bhndb_regwin *win; /**< window definition */
160 rman_res_t target; /**< the current window address, or 0x0 if unknown */
169 bhnd_addr_t addr; /**< start of mapped range */
170 bhnd_size_t size; /**< size of mapped range */
184 void *ih_cookiep; /**< hostb-assigned cookiep, or NULL if bus_setup_intr() incomplete. */
206 struct mtx dw_steal_mtx; /**< spinlock must be held when stealing a dynamic window allocation */
207 struct bhndb_dw_alloc *dw_alloc; /**< dynamic window allocation records */
208 size_t dwa_count; /**< number of dynamic windows available. */
209 bitstr_t *dwa_freelist; /**< dynamic window free list */
211 allocate a dynamic window */
226 bit_ffs(br->dwa_freelist, br->dwa_count, &bit); in bhndb_dw_all_free()
227 return (bit == -1); in bhndb_dw_all_free()
231 * Find the next free dynamic window region in @p br.
241 bit_ffc(br->dwa_freelist, br->dwa_count, &bit); in bhndb_dw_next_free()
242 if (bit == -1) in bhndb_dw_next_free()
245 dw_free = &br->dw_alloc[bit]; in bhndb_dw_next_free()
247 KASSERT(LIST_EMPTY(&dw_free->refs), in bhndb_dw_next_free()
248 ("free list out of sync with refs")); in bhndb_dw_next_free()
254 * Returns true if a dynamic window allocation is marked as free.
257 * @param dwa The dynamic window allocation record to be checked.
262 bool is_free = LIST_EMPTY(&dwa->refs); in bhndb_dw_is_free()
264 KASSERT(is_free == !bit_test(br->dwa_freelist, dwa->rnid), in bhndb_dw_is_free()
265 ("refs out of sync with free list")); in bhndb_dw_is_free()
271 mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->dev), \
273 #define BHNDB_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
274 #define BHNDB_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
275 #define BHNDB_LOCK_ASSERT(sc, what) mtx_assert(&(sc)->sc_mtx, what)
276 #define BHNDB_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_mtx)