b1d34ae11c2cbf07a955996530b0635d0d267978
[dpdk.git] / drivers / bus / pci / windows / pci.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2020 Mellanox Technologies, Ltd
3  */
4 #include <rte_errno.h>
5 #include <rte_log.h>
6
7 #include <rte_string_fns.h>
8 #include <rte_eal_memconfig.h>
9
10 #include "private.h"
11
12 /* The functions below are not implemented on Windows,
13  * but need to be defined for compilation purposes
14  */
15
16 /* Map pci device */
17 int
18 rte_pci_map_device(struct rte_pci_device *dev __rte_unused)
19 {
20         /* This function is not implemented on Windows.
21          * We really should short-circuit the call to these functions by
22          * clearing the RTE_PCI_DRV_NEED_MAPPING flag
23          * in the rte_pci_driver flags.
24          */
25         return 0;
26 }
27
28 /* Unmap pci device */
29 void
30 rte_pci_unmap_device(struct rte_pci_device *dev __rte_unused)
31 {
32         /* This function is not implemented on Windows.
33          * We really should short-circuit the call to these functions by
34          * clearing the RTE_PCI_DRV_NEED_MAPPING flag
35          * in the rte_pci_driver flags.
36          */
37 }
38
39 int
40 pci_update_device(const struct rte_pci_addr *addr __rte_unused)
41 {
42         /* This function is not implemented on Windows.
43          * We really should short-circuit the call to these functions by
44          * clearing the RTE_PCI_DRV_NEED_MAPPING flag
45          * in the rte_pci_driver flags.
46          */
47         return 0;
48 }
49
50 /* Read PCI config space. */
51 int
52 rte_pci_read_config(const struct rte_pci_device *dev __rte_unused,
53         void *buf __rte_unused, size_t len __rte_unused,
54         off_t offset __rte_unused)
55 {
56         /* This function is not implemented on Windows.
57          * We really should short-circuit the call to these functions by
58          * clearing the RTE_PCI_DRV_NEED_MAPPING flag
59          * in the rte_pci_driver flags.
60          */
61         return 0;
62 }
63
64 /* Write PCI config space. */
65 int
66 rte_pci_write_config(const struct rte_pci_device *dev __rte_unused,
67         const void *buf __rte_unused, size_t len __rte_unused,
68         off_t offset __rte_unused)
69 {
70         /* This function is not implemented on Windows.
71          * We really should short-circuit the call to these functions by
72          * clearing the RTE_PCI_DRV_NEED_MAPPING flag
73          * in the rte_pci_driver flags.
74          */
75         return 0;
76 }
77
78 enum rte_iova_mode
79 pci_device_iova_mode(const struct rte_pci_driver *pdrv __rte_unused,
80                 const struct rte_pci_device *pdev __rte_unused)
81 {
82         /* This function is not implemented on Windows.
83          * We really should short-circuit the call to these functions by
84          * clearing the RTE_PCI_DRV_NEED_MAPPING flag
85          * in the rte_pci_driver flags.
86          */
87         return RTE_IOVA_DC;
88 }
89
90 int
91 rte_pci_ioport_map(struct rte_pci_device *dev __rte_unused,
92         int bar __rte_unused, struct rte_pci_ioport *p __rte_unused)
93 {
94         /* This function is not implemented on Windows.
95          * We really should short-circuit the call to these functions by
96          * clearing the RTE_PCI_DRV_NEED_MAPPING flag
97          * in the rte_pci_driver flags.
98          */
99         return -1;
100 }
101
102
103 void
104 rte_pci_ioport_read(struct rte_pci_ioport *p __rte_unused,
105         void *data __rte_unused, size_t len __rte_unused,
106         off_t offset __rte_unused)
107 {
108         /* This function is not implemented on Windows.
109          * We really should short-circuit the call to these functions by
110          * clearing the RTE_PCI_DRV_NEED_MAPPING flag
111          * in the rte_pci_driver flags.
112          */
113 }
114
115 int
116 rte_pci_ioport_unmap(struct rte_pci_ioport *p __rte_unused)
117 {
118         /* This function is not implemented on Windows.
119          * We really should short-circuit the call to these functions by
120          * clearing the RTE_PCI_DRV_NEED_MAPPING flag
121          * in the rte_pci_driver flags.
122          */
123         return -1;
124 }
125
126 bool
127 pci_device_iommu_support_va(const struct rte_pci_device *dev __rte_unused)
128 {
129         /* This function is not implemented on Windows.
130          * We really should short-circuit the call to these functions by
131          * clearing the RTE_PCI_DRV_NEED_MAPPING flag
132          * in the rte_pci_driver flags.
133          */
134         return false;
135 }
136
137 void
138 rte_pci_ioport_write(struct rte_pci_ioport *p __rte_unused,
139                 const void *data __rte_unused, size_t len __rte_unused,
140                 off_t offset __rte_unused)
141 {
142         /* This function is not implemented on Windows.
143          * We really should short-circuit the call to these functions by
144          * clearing the RTE_PCI_DRV_NEED_MAPPING flag
145          * in the rte_pci_driver flags.
146          */
147 }
148
149
150 /* remap the PCI resource of a PCI device in anonymous virtual memory */
151 int
152 pci_uio_remap_resource(struct rte_pci_device *dev __rte_unused)
153 {
154         /* This function is not implemented on Windows.
155          * We really should short-circuit the call to these functions by
156          * clearing the RTE_PCI_DRV_NEED_MAPPING flag
157          * in the rte_pci_driver flags.
158          */
159         return -1;
160 }
161 /*
162  * Scan the contents of the PCI bus
163  * and add all network class devices into the devices list.
164  */
165 int
166 rte_pci_scan(void)
167 {
168         return 0;
169 }