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