drivers: use SPDX tag in NXP dpaa files
[dpdk.git] / drivers / bus / dpaa / include / process.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 __PROCESS_H
9 #define __PROCESS_H
10
11 #include <compat.h>
12
13 /* The process device underlies process-wide user/kernel interactions, such as
14  * mapping dma_mem memory and providing accompanying ioctl()s. (This isn't used
15  * for portals, which use one UIO device each.).
16  */
17 #define PROCESS_PATH            "/dev/fsl-usdpaa"
18
19 /* Allocation of resource IDs uses a generic interface. This enum is used to
20  * distinguish between the type of underlying object being manipulated.
21  */
22 enum dpaa_id_type {
23         dpaa_id_fqid,
24         dpaa_id_bpid,
25         dpaa_id_qpool,
26         dpaa_id_cgrid,
27         dpaa_id_max /* <-- not a valid type, represents the number of types */
28 };
29
30 int process_alloc(enum dpaa_id_type id_type, uint32_t *base, uint32_t num,
31                   uint32_t align, int partial);
32 void process_release(enum dpaa_id_type id_type, uint32_t base, uint32_t num);
33
34 int process_reserve(enum dpaa_id_type id_type, uint32_t base, uint32_t num);
35
36 /* Mapping and using QMan/BMan portals */
37 enum dpaa_portal_type {
38         dpaa_portal_qman,
39         dpaa_portal_bman,
40 };
41
42 struct dpaa_ioctl_portal_map {
43         /* Input parameter, is a qman or bman portal required. */
44         enum dpaa_portal_type type;
45         /* Specifes a specific portal index to map or 0xffffffff
46          * for don't care.
47          */
48         uint32_t index;
49
50         /* Return value if the map succeeds, this gives the mapped
51          * cache-inhibited (cinh) and cache-enabled (cena) addresses.
52          */
53         struct dpaa_portal_map {
54                 void *cinh;
55                 void *cena;
56         } addr;
57         /* Qman-specific return values */
58         u16 channel;
59         uint32_t pools;
60 };
61
62 int process_portal_map(struct dpaa_ioctl_portal_map *params);
63 int process_portal_unmap(struct dpaa_portal_map *map);
64
65 struct dpaa_ioctl_irq_map {
66         enum dpaa_portal_type type; /* Type of portal to map */
67         int fd; /* File descriptor that contains the portal */
68         void *portal_cinh; /* Cache inhibited area to identify the portal */
69 };
70
71 int process_portal_irq_map(int fd,  struct dpaa_ioctl_irq_map *irq);
72 int process_portal_irq_unmap(int fd);
73
74 #endif  /*  __PROCESS_H */