1 /* 2 * Copyright (c) 2026 Abdelkader Boudih <freebsd@seuros.com> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 * 6 * Apple BCE queue management. 7 */ 8 9 #ifndef _APPLE_BCE_QUEUE_H_ 10 #define _APPLE_BCE_QUEUE_H_ 11 12 #include "apple_bce.h" 13 14 struct apple_bce_softc; 15 16 /* CQ operations */ 17 struct bce_queue_cq *bce_alloc_cq(struct apple_bce_softc *sc, int qid, 18 uint32_t el_count); 19 void bce_free_cq(struct apple_bce_softc *sc, struct bce_queue_cq *cq); 20 void bce_get_cq_memcfg(struct bce_queue_cq *cq, 21 struct bce_queue_memcfg *cfg); 22 void bce_handle_cq_completions(struct apple_bce_softc *sc, 23 struct bce_queue_cq *cq); 24 25 /* SQ operations */ 26 struct bce_queue_sq *bce_alloc_sq(struct apple_bce_softc *sc, int qid, 27 uint32_t el_size, uint32_t el_count, 28 bce_sq_completion_fn compl, void *userdata); 29 void bce_free_sq(struct apple_bce_softc *sc, struct bce_queue_sq *sq); 30 void bce_get_sq_memcfg(struct bce_queue_sq *sq, struct bce_queue_cq *cq, 31 struct bce_queue_memcfg *cfg); 32 33 /* Submission helpers */ 34 int bce_reserve_submission(struct bce_queue_sq *sq); 35 void *bce_next_submission(struct bce_queue_sq *sq); 36 void bce_submit_to_device(struct apple_bce_softc *sc, 37 struct bce_queue_sq *sq); 38 void bce_notify_submission_complete(struct bce_queue_sq *sq); 39 40 /* Command queue */ 41 struct bce_queue_cmdq *bce_alloc_cmdq(struct apple_bce_softc *sc, 42 struct bce_queue_sq *sq); 43 void bce_free_cmdq(struct bce_queue_cmdq *cmdq); 44 uint32_t bce_cmd_register_queue(struct bce_queue_cmdq *cmdq, 45 struct apple_bce_softc *sc, struct bce_queue_memcfg *cfg, 46 const char *name, int isdirout); 47 uint32_t bce_cmd_unregister_queue(struct bce_queue_cmdq *cmdq, 48 struct apple_bce_softc *sc, int qid); 49 uint32_t bce_cmd_flush_queue(struct bce_queue_cmdq *cmdq, 50 struct apple_bce_softc *sc, int qid); 51 52 #endif /* _APPLE_BCE_QUEUE_H_ */ 53