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