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 2020 NXP 6 * 7 */ 8 9 #ifndef __PROCESS_H 10 #define __PROCESS_H 11 12 #include <compat.h> 13 14 /* The process device underlies process-wide user/kernel interactions, such as 15 * mapping dma_mem memory and providing accompanying ioctl()s. (This isn't used 16 * for portals, which use one UIO device each.). 17 */ 18 #define PROCESS_PATH "/dev/fsl-usdpaa" 19 20 /* Allocation of resource IDs uses a generic interface. This enum is used to 21 * distinguish between the type of underlying object being manipulated. 22 */ 23 enum dpaa_id_type { 24 dpaa_id_fqid, 25 dpaa_id_bpid, 26 dpaa_id_qpool, 27 dpaa_id_cgrid, 28 dpaa_id_max /* <-- not a valid type, represents the number of types */ 29 }; 30 31 int process_alloc(enum dpaa_id_type id_type, uint32_t *base, uint32_t num, 32 uint32_t align, int partial); 33 void process_release(enum dpaa_id_type id_type, uint32_t base, uint32_t num); 34 35 int process_reserve(enum dpaa_id_type id_type, uint32_t base, uint32_t num); 36 37 /* Mapping and using QMan/BMan portals */ 38 enum dpaa_portal_type { 39 dpaa_portal_qman, 40 dpaa_portal_bman, 41 }; 42 43 struct dpaa_portal_map { 44 void *cinh; 45 void *cena; 46 }; 47 48 struct dpaa_ioctl_portal_map { 49 /* Input parameter, is a qman or bman portal required. */ 50 enum dpaa_portal_type type; 51 /* Specifes a specific portal index to map or 0xffffffff 52 * for don't care. 53 */ 54 uint32_t index; 55 56 /* Return value if the map succeeds, this gives the mapped 57 * cache-inhibited (cinh) and cache-enabled (cena) addresses. 58 */ 59 struct dpaa_portal_map addr; 60 61 /* Qman-specific return values */ 62 u16 channel; 63 uint32_t pools; 64 }; 65 66 int process_portal_map(struct dpaa_ioctl_portal_map *params); 67 int process_portal_unmap(struct dpaa_portal_map *map); 68 69 struct dpaa_ioctl_irq_map { 70 enum dpaa_portal_type type; /* Type of portal to map */ 71 int fd; /* File descriptor that contains the portal */ 72 void *portal_cinh; /* Cache inhibited area to identify the portal */ 73 }; 74 75 int process_portal_irq_map(int fd, struct dpaa_ioctl_irq_map *irq); 76 int process_portal_irq_unmap(int fd); 77 78 struct usdpaa_ioctl_link_status { 79 char if_name[IF_NAME_MAX_LEN]; 80 uint32_t efd; 81 }; 82 83 __rte_internal 84 int dpaa_intr_enable(char *if_name, int efd); 85 86 __rte_internal 87 int dpaa_intr_disable(char *if_name); 88 89 struct usdpaa_ioctl_link_status_args { 90 /* network device node name */ 91 char if_name[IF_NAME_MAX_LEN]; 92 int link_status; 93 }; 94 95 struct usdpaa_ioctl_update_link_status_args { 96 /* network device node name */ 97 char if_name[IF_NAME_MAX_LEN]; 98 /* link status(ETH_LINK_UP/DOWN) */ 99 int link_status; 100 }; 101 102 __rte_internal 103 int dpaa_get_link_status(char *if_name); 104 105 __rte_internal 106 int dpaa_update_link_status(char *if_name, int link_status); 107 108 #endif /* __PROCESS_H */ 109