129cb31c9SChaoyong He /* SPDX-License-Identifier: BSD-3-Clause 229cb31c9SChaoyong He * Copyright (c) 2023 Corigine, Inc. 329cb31c9SChaoyong He * All rights reserved. 429cb31c9SChaoyong He */ 529cb31c9SChaoyong He 629cb31c9SChaoyong He #ifndef __NFP_COMMON_PCI_H__ 729cb31c9SChaoyong He #define __NFP_COMMON_PCI_H__ 829cb31c9SChaoyong He 929cb31c9SChaoyong He #include <bus_pci_driver.h> 1029cb31c9SChaoyong He 1129cb31c9SChaoyong He /* Initialization function for the driver called during device probing. */ 1229cb31c9SChaoyong He typedef int (nfp_class_driver_probe_t)(struct rte_pci_device *dev); 1329cb31c9SChaoyong He 1429cb31c9SChaoyong He /* Uninitialization function for the driver called during hot-unplugging. */ 1529cb31c9SChaoyong He typedef int (nfp_class_driver_remove_t)(struct rte_pci_device *dev); 1629cb31c9SChaoyong He 1729cb31c9SChaoyong He enum nfp_class { 1829cb31c9SChaoyong He NFP_CLASS_ETH, 19*7f11d166SChaoyong He NFP_CLASS_VDPA, 2029cb31c9SChaoyong He NFP_CLASS_INVALID, 2129cb31c9SChaoyong He }; 2229cb31c9SChaoyong He 2329cb31c9SChaoyong He /* Describing a nfp common class driver. */ 2429cb31c9SChaoyong He struct nfp_class_driver { 2529cb31c9SChaoyong He TAILQ_ENTRY(nfp_class_driver) next; 2629cb31c9SChaoyong He enum nfp_class drv_class; /**< Class of this driver. */ 2729cb31c9SChaoyong He const char *name; /**< Driver name. */ 2829cb31c9SChaoyong He const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */ 2929cb31c9SChaoyong He uint32_t drv_flags; /**< Flags RTE_PCI_DRV_*. */ 3029cb31c9SChaoyong He nfp_class_driver_probe_t *probe; /**< Device probe function. */ 3129cb31c9SChaoyong He nfp_class_driver_remove_t *remove; /**< Device remove function. */ 3229cb31c9SChaoyong He }; 3329cb31c9SChaoyong He 3429cb31c9SChaoyong He /** 3529cb31c9SChaoyong He * Register a nfp device driver. 3629cb31c9SChaoyong He * 3729cb31c9SChaoyong He * @param driver 3829cb31c9SChaoyong He * A pointer to a nfp_driver structure describing the driver 3929cb31c9SChaoyong He * to be registered. 4029cb31c9SChaoyong He */ 4129cb31c9SChaoyong He __rte_internal 4229cb31c9SChaoyong He void 4329cb31c9SChaoyong He nfp_class_driver_register(struct nfp_class_driver *driver); 4429cb31c9SChaoyong He 4529cb31c9SChaoyong He #endif /* __NFP_COMMON_PCI_H__ */ 46