New upstream version 18.02
[deb_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_portal_map {
43         void *cinh;
44         void *cena;
45 };
46
47 struct dpaa_ioctl_portal_map {
48         /* Input parameter, is a qman or bman portal required. */
49         enum dpaa_portal_type type;
50         /* Specifes a specific portal index to map or 0xffffffff
51          * for don't care.
52          */
53         uint32_t index;
54
55         /* Return value if the map succeeds, this gives the mapped
56          * cache-inhibited (cinh) and cache-enabled (cena) addresses.
57          */
58         struct dpaa_portal_map addr;
59
60         /* Qman-specific return values */
61         u16 channel;
62         uint32_t pools;
63 };
64
65 int process_portal_map(struct dpaa_ioctl_portal_map *params);
66 int process_portal_unmap(struct dpaa_portal_map *map);
67
68 struct dpaa_ioctl_irq_map {
69         enum dpaa_portal_type type; /* Type of portal to map */
70         int fd; /* File descriptor that contains the portal */
71         void *portal_cinh; /* Cache inhibited area to identify the portal */
72 };
73
74 int process_portal_irq_map(int fd,  struct dpaa_ioctl_irq_map *irq);
75 int process_portal_irq_unmap(int fd);
76
77 #endif  /*  __PROCESS_H */