net/cnxk: remove restriction on VF for PFC config
[dpdk.git] / drivers / net / enetfec / enet_uio.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2021 NXP
3  */
4
5 #include "enet_ethdev.h"
6
7 /* Prefix path to sysfs directory where UIO device attributes are exported.
8  * Path for UIO device X is /sys/class/uio/uioX
9  */
10 #define FEC_UIO_DEVICE_SYS_ATTR_PATH    "/sys/class/uio"
11
12 /* Subfolder in sysfs where mapping attributes are exported
13  * for each UIO device. Path for mapping Y for device X is:
14  * /sys/class/uio/uioX/maps/mapY
15  */
16 #define FEC_UIO_DEVICE_SYS_MAP_ATTR     "maps/map"
17
18 /* Name of UIO device file prefix. Each UIO device will have a device file
19  * /dev/uioX, where X is the minor device number.
20  */
21 #define FEC_UIO_DEVICE_FILE_NAME        "/dev/uio"
22 /*
23  * Name of UIO device. User space FEC will have a corresponding
24  * UIO device.
25  * Maximum length is #FEC_UIO_MAX_DEVICE_NAME_LENGTH.
26  *
27  * @note  Must be kept in sync with FEC kernel driver
28  * define #FEC_UIO_DEVICE_NAME !
29  */
30 #define FEC_UIO_DEVICE_NAME     "imx-fec-uio"
31
32 /* Maximum length for the name of an UIO device file.
33  * Device file name format is: /dev/uioX.
34  */
35 #define FEC_UIO_MAX_DEVICE_FILE_NAME_LENGTH     30
36
37 /* Maximum length for the name of an attribute file for an UIO device.
38  * Attribute files are exported in sysfs and have the name formatted as:
39  * /sys/class/uio/uioX/<attribute_file_name>
40  */
41 #define FEC_UIO_MAX_ATTR_FILE_NAME      100
42
43 /* The id for the mapping used to export ENETFEC registers and BD memory to
44  * user space through UIO device.
45  */
46 #define FEC_UIO_REG_MAP_ID              0
47 #define FEC_UIO_BD_MAP_ID               1
48
49 #define MAP_PAGE_SIZE                   4096
50
51 struct uio_job {
52         uint32_t fec_id;
53         int uio_fd;
54         void *bd_start_addr;
55         void *register_base_addr;
56         int map_size;
57         uint64_t map_addr;
58         int uio_minor_number;
59 };
60
61 int enetfec_configure(void);
62 int config_enetfec_uio(struct enetfec_private *fep);
63 void enetfec_uio_init(void);
64 void enetfec_cleanup(struct enetfec_private *fep);