1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) 2 * 3 * Copyright 2010-2011 Freescale Semiconductor, Inc. 4 * All rights reserved. 5 * Copyright 2019 NXP 6 * 7 */ 8 9 #ifndef __FSL_USD_H 10 #define __FSL_USD_H 11 12 #include <compat.h> 13 #include <dpaa_list.h> 14 #include <fsl_qman.h> 15 16 #include <rte_compat.h> 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 /* Thread-entry/exit hooks; */ 23 int qman_thread_init(void); 24 int bman_thread_init(void); 25 int qman_thread_finish(void); 26 int bman_thread_finish(void); 27 28 #define QBMAN_ANY_PORTAL_IDX 0xffffffff 29 30 /* Obtain and free raw (unitialized) portals */ 31 32 struct dpaa_raw_portal { 33 /* inputs */ 34 35 /* set to non zero to turn on stashing */ 36 uint8_t enable_stash; 37 /* Stashing attributes for the portal */ 38 uint32_t cpu; 39 uint32_t cache; 40 uint32_t window; 41 42 /* Specifies the stash request queue this portal should use */ 43 uint8_t sdest; 44 45 /* Specifies a specific portal index to map or QBMAN_ANY_PORTAL_IDX 46 * for don't care. The portal index will be populated by the 47 * driver when the ioctl() successfully completes. 48 */ 49 uint32_t index; 50 51 /* outputs */ 52 uint64_t cinh; 53 uint64_t cena; 54 }; 55 56 int qman_allocate_raw_portal(struct dpaa_raw_portal *portal); 57 int qman_free_raw_portal(struct dpaa_raw_portal *portal); 58 59 int bman_allocate_raw_portal(struct dpaa_raw_portal *portal); 60 int bman_free_raw_portal(struct dpaa_raw_portal *portal); 61 62 /* Obtain thread-local UIO file-descriptors */ 63 __rte_internal 64 int qman_thread_fd(void); 65 int bman_thread_fd(void); 66 67 /* Post-process interrupts. NB, the kernel IRQ handler disables the interrupt 68 * line before notifying us, and this post-processing re-enables it once 69 * processing is complete. As such, it is essential to call this before going 70 * into another blocking read/select/poll. 71 */ 72 __rte_internal 73 void qman_thread_irq(void); 74 75 __rte_internal 76 void bman_thread_irq(void); 77 __rte_internal 78 void qman_fq_portal_thread_irq(struct qman_portal *qp); 79 __rte_internal 80 void qman_clear_irq(void); 81 82 /* Global setup */ 83 int qman_global_init(void); 84 int bman_global_init(void); 85 86 /* Direct portal create and destroy */ 87 __rte_internal 88 struct qman_portal *fsl_qman_fq_portal_create(int *fd); 89 int fsl_qman_fq_portal_destroy(struct qman_portal *qp); 90 int fsl_qman_fq_portal_init(struct qman_portal *qp); 91 92 #ifdef __cplusplus 93 } 94 #endif 95 96 #endif /* __FSL_USD_H */ 97