1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Intel Corporation
3  */
4 
5 #ifndef _PCI_NETUIO_H_
6 #define _PCI_NETUIO_H_
7 
8 /* GUID definition for device class netUIO */
9 DEFINE_GUID(GUID_DEVCLASS_NETUIO, 0x78912bc1, 0xcb8e, 0x4b28,
10 	0xa3, 0x29, 0xf3, 0x22, 0xeb, 0xad, 0xbe, 0x0f);
11 
12 /* GUID definition for the netuio device interface */
13 DEFINE_GUID(GUID_DEVINTERFACE_NETUIO, 0x08336f60, 0x0679, 0x4c6c,
14 	0x85, 0xd2, 0xae, 0x7c, 0xed, 0x65, 0xff, 0xf7);
15 
16 /* IOCTL code definitions */
17 #define IOCTL_NETUIO_MAP_HW_INTO_USERSPACE \
18 	CTL_CODE(FILE_DEVICE_NETWORK, 51, METHOD_BUFFERED, \
19 			 FILE_READ_ACCESS | FILE_WRITE_ACCESS)
20 
21 #define  MAX_DEVICENAME_SZ 255
22 
23 #pragma pack(push)
24 #pragma pack(8)
25 struct mem_region {
26 	UINT64 size;  /* memory region size */
27 	LARGE_INTEGER phys_addr;  /* physical address of the memory region */
28 	PVOID virt_addr;  /* virtual address of the memory region */
29 	PVOID user_mapped_virt_addr;  /* virtual address of the region mapped */
30 					/* into user process context */
31 };
32 
33 #define PCI_MAX_BAR 6
34 
35 struct device_info {
36 	struct mem_region hw[PCI_MAX_BAR];
37 };
38 #pragma pack(pop)
39 
40 /**
41  * Get device resource information by sending ioctl to netuio driver
42  *
43  * This function is private to EAL.
44  *
45  * @param dev_info
46  *   HDEVINFO handle to device information set
47  * @param dev_info_data
48  *   SP_DEVINFO_DATA structure holding information about this enumerated device
49  * @param dev
50  *   PCI device context for this device
51  * @return
52  *   - 0 on success.
53  *   - negative on error.
54  */
55 int
56 get_netuio_device_info(HDEVINFO dev_info, PSP_DEVINFO_DATA dev_info_data,
57 	struct rte_pci_device *dev);
58 
59 #endif /* _PCI_NETUIO_H_ */
60