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 int qman_thread_fd(void); 62 int bman_thread_fd(void); 63 64 /* Post-process interrupts. NB, the kernel IRQ handler disables the interrupt 65 * line before notifying us, and this post-processing re-enables it once 66 * processing is complete. As such, it is essential to call this before going 67 * into another blocking read/select/poll. 68 */ 69 void qman_thread_irq(void); 70 void bman_thread_irq(void); 71 void qman_fq_portal_thread_irq(struct qman_portal *qp); 72 73 void qman_clear_irq(void); 74 75 /* Global setup */ 76 int qman_global_init(void); 77 int bman_global_init(void); 78 79 /* Direct portal create and destroy */ 80 struct qman_portal *fsl_qman_fq_portal_create(int *fd); 81 int fsl_qman_fq_portal_destroy(struct qman_portal *qp); 82 int fsl_qman_fq_portal_init(struct qman_portal *qp); 83 84 #ifdef __cplusplus 85 } 86 #endif 87 88 #endif /* __FSL_USD_H */ 89