4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #ifndef _EAL_PRIVATE_H_
35 #define _EAL_PRIVATE_H_
41 * Initialize the memzone subsystem (private to eal).
47 int rte_eal_memzone_init(void);
50 * Common log initialization function (private to eal).
52 * Called by environment-specific log initialization function to initialize
56 * The default log stream to be used.
61 int rte_eal_common_log_init(FILE *default_log);
64 * Fill configuration with number of physical and logical processors
66 * This function is private to EAL.
68 * Parse /proc/cpuinfo to get the number of physical and logical
69 * processors on the machine.
72 * 0 on success, negative on error
74 int rte_eal_cpu_init(void);
79 * This function is private to EAL.
81 * Fill configuration structure with these infos, and return 0 on success.
84 * 0 on success, negative on error
86 int rte_eal_memory_init(void);
91 * This function is private to EAL.
93 * Mmap memory areas used by HPET (high precision event timer) that will
94 * provide our time reference, and configure the TSC frequency also for it
95 * to be used as a reference.
98 * 0 on success, negative on error
100 int rte_eal_timer_init(void);
105 * This function is private to EAL.
108 * 0 on success, negative on error
110 int rte_eal_log_early_init(void);
113 * Init the default log stream
115 * This function is private to EAL.
118 * 0 on success, negative on error
120 int rte_eal_log_init(const char *id, int facility);
123 * Init the default log stream
125 * This function is private to EAL.
128 * 0 on success, negative on error
130 int rte_eal_pci_init(void);
132 #ifdef RTE_LIBRTE_IVSHMEM
134 * Init the memory from IVSHMEM devices
136 * This function is private to EAL.
139 * 0 on success, negative on error
141 int rte_eal_ivshmem_init(void);
144 * Init objects in IVSHMEM devices
146 * This function is private to EAL.
149 * 0 on success, negative on error
151 int rte_eal_ivshmem_obj_init(void);
154 struct rte_pci_driver;
155 struct rte_pci_device;
160 * This function is private to EAL.
163 * 0 on success, negative on error
165 int pci_map_device(struct rte_pci_device *dev);
167 #ifdef RTE_LIBRTE_EAL_HOTPLUG
171 * This function is private to EAL.
173 void pci_unmap_device(struct rte_pci_device *dev);
174 #endif /* RTE_LIBRTE_EAL_HOTPLUG */
177 * Map the PCI resource of a PCI device in virtual memory
179 * This function is private to EAL.
182 * 0 on success, negative on error
184 int pci_uio_map_resource(struct rte_pci_device *dev);
186 #ifdef RTE_LIBRTE_EAL_HOTPLUG
188 * Unmap the PCI resource of a PCI device
190 * This function is private to EAL.
192 void pci_uio_unmap_resource(struct rte_pci_device *dev);
193 #endif /* RTE_LIBRTE_EAL_HOTPLUG */
196 * Mmap memory for single PCI device
198 * This function is private to EAL.
201 * 0 on success, negative on error
203 int rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr,
204 struct rte_pci_device *dev);
207 * Munmap memory for single PCI device
209 * This function is private to EAL.
212 * The pointer to the pci driver structure
214 * The pointer to the pci device structure
216 * 0 on success, negative on error
218 int rte_eal_pci_close_one_driver(struct rte_pci_driver *dr,
219 struct rte_pci_device *dev);
222 * Allocate uio resource for PCI device
224 * This function is private to EAL.
227 * PCI device to allocate uio resource
229 * Pointer to uio resource.
230 * If the function returns 0, the pointer will be filled.
232 * 0 on success, negative on error
234 int pci_uio_alloc_resource(struct rte_pci_device *dev,
235 struct mapped_pci_resource **uio_res);
238 * Free uio resource for PCI device
240 * This function is private to EAL.
243 * PCI device to free uio resource
245 * Pointer to uio resource.
247 void pci_uio_free_resource(struct rte_pci_device *dev,
248 struct mapped_pci_resource *uio_res);
251 * Map device memory to uio resource
253 * This function is private to EAL.
256 * PCI device that has memory information.
258 * Memory resource index of the PCI device.
260 * uio resource that will keep mapping information.
262 * Mapping information index of the uio resource.
264 * 0 on success, negative on error
266 int pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
267 struct mapped_pci_resource *uio_res, int map_idx);
270 * Init tail queues for non-EAL library structures. This is to allow
271 * the rings, mempools, etc. lists to be shared among multiple processes
273 * This function is private to EAL
276 * 0 on success, negative on error
278 int rte_eal_tailqs_init(void);
281 * Init interrupt handling.
283 * This function is private to EAL.
286 * 0 on success, negative on error
288 int rte_eal_intr_init(void);
291 * Init alarm mechanism. This is to allow a callback be called after
294 * This function is private to EAL.
297 * 0 on success, negative on error
299 int rte_eal_alarm_init(void);
302 * This function initialises any virtual devices
304 * This function is private to the EAL.
306 int rte_eal_dev_init(void);
309 * Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
313 * The module's name which need to be checked
316 * -1 means some error happens(NULL pointer or open failure)
317 * 0 means the module not loaded
318 * 1 means the module loaded
320 int rte_eal_check_module(const char *module_name);
322 #endif /* _EAL_PRIVATE_H_ */