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).
53 * The default log stream to be used.
58 int rte_eal_common_log_init(FILE *default_log);
61 * Fill configuration with number of physical and logical processors
63 * This function is private to EAL.
65 * Parse /proc/cpuinfo to get the number of physical and logical
66 * processors on the machine.
69 * 0 on success, negative on error
71 int rte_eal_cpu_init(void);
76 * This function is private to EAL.
78 * Fill configuration structure with these infos, and return 0 on success.
81 * 0 on success, negative on error
83 int rte_eal_memory_init(void);
88 * This function is private to EAL.
90 * Mmap memory areas used by HPET (high precision event timer) that will
91 * provide our time reference, and configure the TSC frequency also for it
92 * to be used as a reference.
95 * 0 on success, negative on error
97 int rte_eal_timer_init(void);
102 * This function is private to EAL.
105 * 0 on success, negative on error
107 int rte_eal_log_early_init(void);
110 * Init the default log stream
112 * This function is private to EAL.
115 * 0 on success, negative on error
117 int rte_eal_log_init(const char *id, int facility);
120 * Init the PCI infrastructure
122 * This function is private to EAL.
125 * 0 on success, negative on error
127 int rte_eal_pci_init(void);
129 struct rte_pci_driver;
130 struct rte_pci_device;
133 * Unbind kernel driver for this device
135 * This function is private to EAL.
138 * 0 on success, negative on error
140 int pci_unbind_kernel_driver(struct rte_pci_device *dev);
143 * Map the PCI resource of a PCI device in virtual memory
145 * This function is private to EAL.
148 * 0 on success, negative on error
150 int pci_uio_map_resource(struct rte_pci_device *dev);
153 * Unmap the PCI resource of a PCI device
155 * This function is private to EAL.
157 void pci_uio_unmap_resource(struct rte_pci_device *dev);
160 * Allocate uio resource for PCI device
162 * This function is private to EAL.
165 * PCI device to allocate uio resource
167 * Pointer to uio resource.
168 * If the function returns 0, the pointer will be filled.
170 * 0 on success, negative on error
172 int pci_uio_alloc_resource(struct rte_pci_device *dev,
173 struct mapped_pci_resource **uio_res);
176 * Free uio resource for PCI device
178 * This function is private to EAL.
181 * PCI device to free uio resource
183 * Pointer to uio resource.
185 void pci_uio_free_resource(struct rte_pci_device *dev,
186 struct mapped_pci_resource *uio_res);
189 * Map device memory to uio resource
191 * This function is private to EAL.
194 * PCI device that has memory information.
196 * Memory resource index of the PCI device.
198 * uio resource that will keep mapping information.
200 * Mapping information index of the uio resource.
202 * 0 on success, negative on error
204 int pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
205 struct mapped_pci_resource *uio_res, int map_idx);
208 * Init tail queues for non-EAL library structures. This is to allow
209 * the rings, mempools, etc. lists to be shared among multiple processes
211 * This function is private to EAL
214 * 0 on success, negative on error
216 int rte_eal_tailqs_init(void);
219 * Init interrupt handling.
221 * This function is private to EAL.
224 * 0 on success, negative on error
226 int rte_eal_intr_init(void);
229 * Init alarm mechanism. This is to allow a callback be called after
232 * This function is private to EAL.
235 * 0 on success, negative on error
237 int rte_eal_alarm_init(void);
240 * Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
244 * The module's name which need to be checked
247 * -1 means some error happens(NULL pointer or open failure)
248 * 0 means the module not loaded
249 * 1 means the module loaded
251 int rte_eal_check_module(const char *module_name);
256 * This function is private to the EAL.
258 unsigned eal_cpu_core_id(unsigned lcore_id);
261 * Check if cpu is present.
263 * This function is private to the EAL.
265 int eal_cpu_detected(unsigned lcore_id);
268 * Set TSC frequency from precise value or estimation
270 * This function is private to the EAL.
272 void set_tsc_freq(void);
275 * Get precise TSC frequency from system
277 * This function is private to the EAL.
279 uint64_t get_tsc_freq(void);
282 * Prepare physical memory mapping
283 * i.e. hugepages on Linux and
286 * This function is private to the EAL.
288 int rte_eal_hugepage_init(void);
291 * Creates memory mapping in secondary process
292 * i.e. hugepages on Linux and
295 * This function is private to the EAL.
297 int rte_eal_hugepage_attach(void);
299 #endif /* _EAL_PRIVATE_H_ */