#define _EAL_PRIVATE_H_
#include <stdbool.h>
+#include <stdint.h>
#include <stdio.h>
#include <rte_pci.h>
*/
int rte_eal_log_init(const char *id, int facility);
+struct rte_pci_driver;
+struct rte_pci_device;
+
/**
- * Init the PCI infrastructure
+ * Probe the PCI bus
*
- * This function is private to EAL.
+ * @return
+ * - 0 on success.
+ * - !0 on error.
+ */
+int
+rte_pci_probe(void);
+
+/**
+ * Scan the content of the PCI bus, and the devices in the devices
+ * list
*
* @return
- * 0 on success, negative on error
+ * 0 on success, negative on error
*/
-int rte_eal_pci_init(void);
+int rte_pci_scan(void);
-struct rte_pci_driver;
-struct rte_pci_device;
+/**
+ * Probe the single PCI device.
+ *
+ * Scan the content of the PCI bus, and find the pci device specified by pci
+ * address, then call the probe() function for registered driver that has a
+ * matching entry in its id_table for discovered device.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address to probe.
+ * @return
+ * - 0 on success.
+ * - Negative on error.
+ */
+int rte_pci_probe_one(const struct rte_pci_addr *addr);
+
+/**
+ * Close the single PCI device.
+ *
+ * Scan the content of the PCI bus, and find the pci device specified by pci
+ * address, then call the remove() function for registered driver that has a
+ * matching entry in its id_table for discovered device.
+ *
+ * @param addr
+ * The PCI Bus-Device-Function address to close.
+ * @return
+ * - 0 on success.
+ * - Negative on error.
+ */
+int rte_pci_detach(const struct rte_pci_addr *addr);
+
+/**
+ * Find the name of a PCI device.
+ */
+void pci_name_set(struct rte_pci_device *dev);
/**
* Add a PCI device to the PCI Bus (append to PCI Device list). This function
* PCI device to add
* @return void
*/
-void rte_eal_pci_add_device(struct rte_pci_device *pci_dev);
+void rte_pci_add_device(struct rte_pci_device *pci_dev);
/**
* Insert a PCI device in the PCI Bus at a particular location in the device
* PCI device to be added before exist_pci_dev
* @return void
*/
-void rte_eal_pci_insert_device(struct rte_pci_device *exist_pci_dev,
- struct rte_pci_device *new_pci_dev);
+void rte_pci_insert_device(struct rte_pci_device *exist_pci_dev,
+ struct rte_pci_device *new_pci_dev);
/**
* Remove a PCI device from the PCI Bus. This sets to NULL the bus references
* PCI device to be removed from PCI Bus
* @return void
*/
-void rte_eal_pci_remove_device(struct rte_pci_device *pci_device);
+void rte_pci_remove_device(struct rte_pci_device *pci_device);
/**
* Update a pci device object by asking the kernel for the latest information.
int pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
struct mapped_pci_resource *uio_res, int map_idx);
+/*
+ * Match the PCI Driver and Device using the ID Table
+ *
+ * @param pci_drv
+ * PCI driver from which ID table would be extracted
+ * @param pci_dev
+ * PCI device to match against the driver
+ * @return
+ * 1 for successful match
+ * 0 for unsuccessful match
+ */
+int
+rte_pci_match(const struct rte_pci_driver *pci_drv,
+ const struct rte_pci_device *pci_dev);
+
/**
* Init tail queues for non-EAL library structures. This is to allow
* the rings, mempools, etc. lists to be shared among multiple processes
*/
uint64_t get_tsc_freq(void);
+/**
+ * Get TSC frequency if the architecture supports.
+ *
+ * This function is private to the EAL.
+ *
+ * @return
+ * The number of TSC cycles in one second.
+ * Returns zero if the architecture support is not available.
+ */
+uint64_t get_tsc_freq_arch(void);
+
/**
* Prepare physical memory mapping
* i.e. hugepages on Linux and
int rte_eal_hugepage_attach(void);
/**
- * Returns true if the system is able to obtain
- * physical addresses. Return false if using DMA
- * addresses through an IOMMU.
+ * Find a bus capable of identifying a device.
*
- * Drivers based on uio will not load unless physical
- * addresses are obtainable. It is only possible to get
- * physical addresses when running as a privileged user.
+ * @param str
+ * A device identifier (PCI address, virtual PMD name, ...).
+ *
+ * @return
+ * A valid bus handle if found.
+ * NULL if no bus is able to parse this device.
*/
-bool rte_eal_using_phys_addrs(void);
+struct rte_bus *rte_bus_find_by_device_name(const char *str);
#endif /* _EAL_PRIVATE_H_ */