// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB /* Copyright (c) 2015 - 2021 Intel Corporation */ #include "osdep.h" #include "hmc.h" #include "defs.h" #include "type.h" #include "protos.h" #include "pble.h" static int add_pble_prm(struct irdma_hmc_pble_rsrc *pble_rsrc); /** * irdma_destroy_pble_prm - destroy prm during module unload * @pble_rsrc: pble resources */ void irdma_destroy_pble_prm(struct irdma_hmc_pble_rsrc *pble_rsrc) { … } /** * irdma_hmc_init_pble - Initialize pble resources during module load * @dev: irdma_sc_dev struct * @pble_rsrc: pble resources */ int irdma_hmc_init_pble(struct irdma_sc_dev *dev, struct irdma_hmc_pble_rsrc *pble_rsrc) { … } /** * get_sd_pd_idx - Returns sd index, pd index and rel_pd_idx from fpm address * @pble_rsrc: structure containing fpm address * @idx: where to return indexes */ static void get_sd_pd_idx(struct irdma_hmc_pble_rsrc *pble_rsrc, struct sd_pd_idx *idx) { … } /** * add_sd_direct - add sd direct for pble * @pble_rsrc: pble resource ptr * @info: page info for sd */ static int add_sd_direct(struct irdma_hmc_pble_rsrc *pble_rsrc, struct irdma_add_page_info *info) { … } /** * fpm_to_idx - given fpm address, get pble index * @pble_rsrc: pble resource management * @addr: fpm address for index */ static u32 fpm_to_idx(struct irdma_hmc_pble_rsrc *pble_rsrc, u64 addr) { … } /** * add_bp_pages - add backing pages for sd * @pble_rsrc: pble resource management * @info: page info for sd */ static int add_bp_pages(struct irdma_hmc_pble_rsrc *pble_rsrc, struct irdma_add_page_info *info) { … } /** * irdma_get_type - add a sd entry type for sd * @dev: irdma_sc_dev struct * @idx: index of sd * @pages: pages in the sd */ static enum irdma_sd_entry_type irdma_get_type(struct irdma_sc_dev *dev, struct sd_pd_idx *idx, u32 pages) { … } /** * add_pble_prm - add a sd entry for pble resoure * @pble_rsrc: pble resource management */ static int add_pble_prm(struct irdma_hmc_pble_rsrc *pble_rsrc) { … } /** * free_lvl2 - fee level 2 pble * @pble_rsrc: pble resource management * @palloc: level 2 pble allocation */ static void free_lvl2(struct irdma_hmc_pble_rsrc *pble_rsrc, struct irdma_pble_alloc *palloc) { … } /** * get_lvl2_pble - get level 2 pble resource * @pble_rsrc: pble resource management * @palloc: level 2 pble allocation */ static int get_lvl2_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, struct irdma_pble_alloc *palloc) { … } /** * get_lvl1_pble - get level 1 pble resource * @pble_rsrc: pble resource management * @palloc: level 1 pble allocation */ static int get_lvl1_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, struct irdma_pble_alloc *palloc) { … } /** * get_lvl1_lvl2_pble - calls get_lvl1 and get_lvl2 pble routine * @pble_rsrc: pble resources * @palloc: contains all inforamtion regarding pble (idx + pble addr) * @lvl: Bitmask for requested pble level */ static int get_lvl1_lvl2_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, struct irdma_pble_alloc *palloc, u8 lvl) { … } /** * irdma_get_pble - allocate pbles from the prm * @pble_rsrc: pble resources * @palloc: contains all inforamtion regarding pble (idx + pble addr) * @pble_cnt: #of pbles requested * @lvl: requested pble level mask */ int irdma_get_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, struct irdma_pble_alloc *palloc, u32 pble_cnt, u8 lvl) { … } /** * irdma_free_pble - put pbles back into prm * @pble_rsrc: pble resources * @palloc: contains all information regarding pble resource being freed */ void irdma_free_pble(struct irdma_hmc_pble_rsrc *pble_rsrc, struct irdma_pble_alloc *palloc) { … }