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