1*ba7319e9SDmitry Salychev /*- 2*ba7319e9SDmitry Salychev * SPDX-License-Identifier: BSD-2-Clause 3*ba7319e9SDmitry Salychev * 4*ba7319e9SDmitry Salychev * Copyright © 2022 Dmitry Salychev 5*ba7319e9SDmitry Salychev * 6*ba7319e9SDmitry Salychev * Redistribution and use in source and binary forms, with or without 7*ba7319e9SDmitry Salychev * modification, are permitted provided that the following conditions 8*ba7319e9SDmitry Salychev * are met: 9*ba7319e9SDmitry Salychev * 1. Redistributions of source code must retain the above copyright 10*ba7319e9SDmitry Salychev * notice, this list of conditions and the following disclaimer. 11*ba7319e9SDmitry Salychev * 2. Redistributions in binary form must reproduce the above copyright 12*ba7319e9SDmitry Salychev * notice, this list of conditions and the following disclaimer in the 13*ba7319e9SDmitry Salychev * documentation and/or other materials provided with the distribution. 14*ba7319e9SDmitry Salychev * 15*ba7319e9SDmitry Salychev * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16*ba7319e9SDmitry Salychev * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17*ba7319e9SDmitry Salychev * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18*ba7319e9SDmitry Salychev * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19*ba7319e9SDmitry Salychev * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20*ba7319e9SDmitry Salychev * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21*ba7319e9SDmitry Salychev * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22*ba7319e9SDmitry Salychev * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23*ba7319e9SDmitry Salychev * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24*ba7319e9SDmitry Salychev * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25*ba7319e9SDmitry Salychev * SUCH DAMAGE. 26*ba7319e9SDmitry Salychev */ 27*ba7319e9SDmitry Salychev 28*ba7319e9SDmitry Salychev #ifndef _DPAA2_BP_H 29*ba7319e9SDmitry Salychev #define _DPAA2_BP_H 30*ba7319e9SDmitry Salychev 31*ba7319e9SDmitry Salychev #include <sys/bus.h> 32*ba7319e9SDmitry Salychev 33*ba7319e9SDmitry Salychev /* Maximum resources per DPBP: 1 DPMCP. */ 34*ba7319e9SDmitry Salychev #define DPAA2_BP_MAX_RESOURCES 1 35*ba7319e9SDmitry Salychev 36*ba7319e9SDmitry Salychev /** 37*ba7319e9SDmitry Salychev * @brief Attributes of the DPBP object. 38*ba7319e9SDmitry Salychev * 39*ba7319e9SDmitry Salychev * id: DPBP object ID. 40*ba7319e9SDmitry Salychev * bpid: Hardware buffer pool ID; should be used as an argument in 41*ba7319e9SDmitry Salychev * acquire/release operations on buffers. 42*ba7319e9SDmitry Salychev */ 43*ba7319e9SDmitry Salychev struct dpaa2_bp_attr { 44*ba7319e9SDmitry Salychev uint32_t id; 45*ba7319e9SDmitry Salychev uint16_t bpid; 46*ba7319e9SDmitry Salychev }; 47*ba7319e9SDmitry Salychev 48*ba7319e9SDmitry Salychev /** 49*ba7319e9SDmitry Salychev * @brief Configuration/state of the buffer pool. 50*ba7319e9SDmitry Salychev */ 51*ba7319e9SDmitry Salychev struct dpaa2_bp_conf { 52*ba7319e9SDmitry Salychev uint8_t bdi; 53*ba7319e9SDmitry Salychev uint8_t state; /* bitmask */ 54*ba7319e9SDmitry Salychev uint32_t free_bufn; 55*ba7319e9SDmitry Salychev }; 56*ba7319e9SDmitry Salychev 57*ba7319e9SDmitry Salychev /** 58*ba7319e9SDmitry Salychev * @brief Software context for the DPAA2 Buffer Pool driver. 59*ba7319e9SDmitry Salychev */ 60*ba7319e9SDmitry Salychev struct dpaa2_bp_softc { 61*ba7319e9SDmitry Salychev device_t dev; 62*ba7319e9SDmitry Salychev struct dpaa2_bp_attr attr; 63*ba7319e9SDmitry Salychev struct resource *res[DPAA2_BP_MAX_RESOURCES]; 64*ba7319e9SDmitry Salychev }; 65*ba7319e9SDmitry Salychev 66*ba7319e9SDmitry Salychev extern struct resource_spec dpaa2_bp_spec[]; 67*ba7319e9SDmitry Salychev 68*ba7319e9SDmitry Salychev #endif /* _DPAA2_BP_H */ 69