1d30ea906Sjfb8856606 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) 22bfe3f2eSlogwang * 32bfe3f2eSlogwang * Copyright 2010-2011 Freescale Semiconductor, Inc. 42bfe3f2eSlogwang * All rights reserved. 5*2d9fd380Sjfb8856606 * Copyright 2020 NXP 62bfe3f2eSlogwang * 72bfe3f2eSlogwang */ 82bfe3f2eSlogwang 92bfe3f2eSlogwang #ifndef __PROCESS_H 102bfe3f2eSlogwang #define __PROCESS_H 112bfe3f2eSlogwang 122bfe3f2eSlogwang #include <compat.h> 13*2d9fd380Sjfb8856606 #include <rte_ethdev.h> 142bfe3f2eSlogwang 152bfe3f2eSlogwang /* The process device underlies process-wide user/kernel interactions, such as 162bfe3f2eSlogwang * mapping dma_mem memory and providing accompanying ioctl()s. (This isn't used 172bfe3f2eSlogwang * for portals, which use one UIO device each.). 182bfe3f2eSlogwang */ 192bfe3f2eSlogwang #define PROCESS_PATH "/dev/fsl-usdpaa" 202bfe3f2eSlogwang 212bfe3f2eSlogwang /* Allocation of resource IDs uses a generic interface. This enum is used to 222bfe3f2eSlogwang * distinguish between the type of underlying object being manipulated. 232bfe3f2eSlogwang */ 242bfe3f2eSlogwang enum dpaa_id_type { 252bfe3f2eSlogwang dpaa_id_fqid, 262bfe3f2eSlogwang dpaa_id_bpid, 272bfe3f2eSlogwang dpaa_id_qpool, 282bfe3f2eSlogwang dpaa_id_cgrid, 292bfe3f2eSlogwang dpaa_id_max /* <-- not a valid type, represents the number of types */ 302bfe3f2eSlogwang }; 312bfe3f2eSlogwang 322bfe3f2eSlogwang int process_alloc(enum dpaa_id_type id_type, uint32_t *base, uint32_t num, 332bfe3f2eSlogwang uint32_t align, int partial); 342bfe3f2eSlogwang void process_release(enum dpaa_id_type id_type, uint32_t base, uint32_t num); 352bfe3f2eSlogwang 362bfe3f2eSlogwang int process_reserve(enum dpaa_id_type id_type, uint32_t base, uint32_t num); 372bfe3f2eSlogwang 382bfe3f2eSlogwang /* Mapping and using QMan/BMan portals */ 392bfe3f2eSlogwang enum dpaa_portal_type { 402bfe3f2eSlogwang dpaa_portal_qman, 412bfe3f2eSlogwang dpaa_portal_bman, 422bfe3f2eSlogwang }; 432bfe3f2eSlogwang 44d30ea906Sjfb8856606 struct dpaa_portal_map { 45d30ea906Sjfb8856606 void *cinh; 46d30ea906Sjfb8856606 void *cena; 47d30ea906Sjfb8856606 }; 48d30ea906Sjfb8856606 492bfe3f2eSlogwang struct dpaa_ioctl_portal_map { 502bfe3f2eSlogwang /* Input parameter, is a qman or bman portal required. */ 512bfe3f2eSlogwang enum dpaa_portal_type type; 522bfe3f2eSlogwang /* Specifes a specific portal index to map or 0xffffffff 532bfe3f2eSlogwang * for don't care. 542bfe3f2eSlogwang */ 552bfe3f2eSlogwang uint32_t index; 562bfe3f2eSlogwang 572bfe3f2eSlogwang /* Return value if the map succeeds, this gives the mapped 582bfe3f2eSlogwang * cache-inhibited (cinh) and cache-enabled (cena) addresses. 592bfe3f2eSlogwang */ 60d30ea906Sjfb8856606 struct dpaa_portal_map addr; 61d30ea906Sjfb8856606 622bfe3f2eSlogwang /* Qman-specific return values */ 632bfe3f2eSlogwang u16 channel; 642bfe3f2eSlogwang uint32_t pools; 652bfe3f2eSlogwang }; 662bfe3f2eSlogwang 672bfe3f2eSlogwang int process_portal_map(struct dpaa_ioctl_portal_map *params); 682bfe3f2eSlogwang int process_portal_unmap(struct dpaa_portal_map *map); 692bfe3f2eSlogwang 702bfe3f2eSlogwang struct dpaa_ioctl_irq_map { 712bfe3f2eSlogwang enum dpaa_portal_type type; /* Type of portal to map */ 722bfe3f2eSlogwang int fd; /* File descriptor that contains the portal */ 732bfe3f2eSlogwang void *portal_cinh; /* Cache inhibited area to identify the portal */ 742bfe3f2eSlogwang }; 752bfe3f2eSlogwang 762bfe3f2eSlogwang int process_portal_irq_map(int fd, struct dpaa_ioctl_irq_map *irq); 772bfe3f2eSlogwang int process_portal_irq_unmap(int fd); 782bfe3f2eSlogwang 79*2d9fd380Sjfb8856606 struct usdpaa_ioctl_link_status { 80*2d9fd380Sjfb8856606 char if_name[IF_NAME_MAX_LEN]; 81*2d9fd380Sjfb8856606 uint32_t efd; 82*2d9fd380Sjfb8856606 }; 83*2d9fd380Sjfb8856606 84*2d9fd380Sjfb8856606 __rte_internal 85*2d9fd380Sjfb8856606 int dpaa_intr_enable(char *if_name, int efd); 86*2d9fd380Sjfb8856606 87*2d9fd380Sjfb8856606 __rte_internal 88*2d9fd380Sjfb8856606 int dpaa_intr_disable(char *if_name); 89*2d9fd380Sjfb8856606 90*2d9fd380Sjfb8856606 struct usdpaa_ioctl_link_status_args_old { 91*2d9fd380Sjfb8856606 /* network device node name */ 92*2d9fd380Sjfb8856606 char if_name[IF_NAME_MAX_LEN]; 93*2d9fd380Sjfb8856606 /* link status(ETH_LINK_UP/DOWN) */ 94*2d9fd380Sjfb8856606 int link_status; 95*2d9fd380Sjfb8856606 }; 96*2d9fd380Sjfb8856606 97*2d9fd380Sjfb8856606 struct usdpaa_ioctl_link_status_args { 98*2d9fd380Sjfb8856606 /* network device node name */ 99*2d9fd380Sjfb8856606 char if_name[IF_NAME_MAX_LEN]; 100*2d9fd380Sjfb8856606 /* link status(ETH_LINK_UP/DOWN) */ 101*2d9fd380Sjfb8856606 int link_status; 102*2d9fd380Sjfb8856606 /* link speed (ETH_SPEED_NUM_)*/ 103*2d9fd380Sjfb8856606 int link_speed; 104*2d9fd380Sjfb8856606 /* link duplex (ETH_LINK_[HALF/FULL]_DUPLEX)*/ 105*2d9fd380Sjfb8856606 int link_duplex; 106*2d9fd380Sjfb8856606 /* link autoneg (ETH_LINK_AUTONEG/FIXED)*/ 107*2d9fd380Sjfb8856606 int link_autoneg; 108*2d9fd380Sjfb8856606 109*2d9fd380Sjfb8856606 }; 110*2d9fd380Sjfb8856606 111*2d9fd380Sjfb8856606 struct usdpaa_ioctl_update_link_status_args { 112*2d9fd380Sjfb8856606 /* network device node name */ 113*2d9fd380Sjfb8856606 char if_name[IF_NAME_MAX_LEN]; 114*2d9fd380Sjfb8856606 /* link status(ETH_LINK_UP/DOWN) */ 115*2d9fd380Sjfb8856606 int link_status; 116*2d9fd380Sjfb8856606 }; 117*2d9fd380Sjfb8856606 118*2d9fd380Sjfb8856606 struct usdpaa_ioctl_update_link_speed { 119*2d9fd380Sjfb8856606 /* network device node name*/ 120*2d9fd380Sjfb8856606 char if_name[IF_NAME_MAX_LEN]; 121*2d9fd380Sjfb8856606 /* link speed (ETH_SPEED_NUM_)*/ 122*2d9fd380Sjfb8856606 int link_speed; 123*2d9fd380Sjfb8856606 /* link duplex (ETH_LINK_[HALF/FULL]_DUPLEX)*/ 124*2d9fd380Sjfb8856606 int link_duplex; 125*2d9fd380Sjfb8856606 }; 126*2d9fd380Sjfb8856606 127*2d9fd380Sjfb8856606 __rte_internal 128*2d9fd380Sjfb8856606 int dpaa_get_link_status(char *if_name, struct rte_eth_link *link); 129*2d9fd380Sjfb8856606 __rte_internal 130*2d9fd380Sjfb8856606 int dpaa_update_link_status(char *if_name, int link_status); 131*2d9fd380Sjfb8856606 __rte_internal 132*2d9fd380Sjfb8856606 int dpaa_update_link_speed(char *if_name, int speed, int duplex); 133*2d9fd380Sjfb8856606 __rte_internal 134*2d9fd380Sjfb8856606 int dpaa_restart_link_autoneg(char *if_name); 135*2d9fd380Sjfb8856606 __rte_internal 136*2d9fd380Sjfb8856606 int dpaa_get_ioctl_version_number(void); 137*2d9fd380Sjfb8856606 1382bfe3f2eSlogwang #endif /* __PROCESS_H */ 139