1*445371e8SJerin Jacob /* 2*445371e8SJerin Jacob * BSD LICENSE 3*445371e8SJerin Jacob * 4*445371e8SJerin Jacob * Copyright (C) Cavium Inc. 2017. All rights reserved. 5*445371e8SJerin Jacob * 6*445371e8SJerin Jacob * Redistribution and use in source and binary forms, with or without 7*445371e8SJerin Jacob * modification, are permitted provided that the following conditions 8*445371e8SJerin Jacob * are met: 9*445371e8SJerin Jacob * 10*445371e8SJerin Jacob * * Redistributions of source code must retain the above copyright 11*445371e8SJerin Jacob * notice, this list of conditions and the following disclaimer. 12*445371e8SJerin Jacob * * Redistributions in binary form must reproduce the above copyright 13*445371e8SJerin Jacob * notice, this list of conditions and the following disclaimer in 14*445371e8SJerin Jacob * the documentation and/or other materials provided with the 15*445371e8SJerin Jacob * distribution. 16*445371e8SJerin Jacob * * Neither the name of Cavium networks nor the names of its 17*445371e8SJerin Jacob * contributors may be used to endorse or promote products derived 18*445371e8SJerin Jacob * from this software without specific prior written permission. 19*445371e8SJerin Jacob * 20*445371e8SJerin Jacob * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21*445371e8SJerin Jacob * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22*445371e8SJerin Jacob * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23*445371e8SJerin Jacob * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24*445371e8SJerin Jacob * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25*445371e8SJerin Jacob * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26*445371e8SJerin Jacob * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27*445371e8SJerin Jacob * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28*445371e8SJerin Jacob * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29*445371e8SJerin Jacob * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30*445371e8SJerin Jacob * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31*445371e8SJerin Jacob */ 32*445371e8SJerin Jacob #include <string.h> 33*445371e8SJerin Jacob 34*445371e8SJerin Jacob #include <rte_eal.h> 35*445371e8SJerin Jacob #include <rte_pci.h> 36*445371e8SJerin Jacob 37*445371e8SJerin Jacob #define PCI_VENDOR_ID_CAVIUM 0x177D 38*445371e8SJerin Jacob #define PCI_DEVICE_ID_OCTEONTX_PKI_VF 0xA0DD 39*445371e8SJerin Jacob 40*445371e8SJerin Jacob /* PKIVF pcie device */ 41*445371e8SJerin Jacob static int 42*445371e8SJerin Jacob pkivf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) 43*445371e8SJerin Jacob { 44*445371e8SJerin Jacob RTE_SET_USED(pci_drv); 45*445371e8SJerin Jacob RTE_SET_USED(pci_dev); 46*445371e8SJerin Jacob 47*445371e8SJerin Jacob /* For secondary processes, the primary has done all the work */ 48*445371e8SJerin Jacob if (rte_eal_process_type() != RTE_PROC_PRIMARY) 49*445371e8SJerin Jacob return 0; 50*445371e8SJerin Jacob 51*445371e8SJerin Jacob return 0; 52*445371e8SJerin Jacob } 53*445371e8SJerin Jacob 54*445371e8SJerin Jacob static const struct rte_pci_id pci_pkivf_map[] = { 55*445371e8SJerin Jacob { 56*445371e8SJerin Jacob RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, 57*445371e8SJerin Jacob PCI_DEVICE_ID_OCTEONTX_PKI_VF) 58*445371e8SJerin Jacob }, 59*445371e8SJerin Jacob { 60*445371e8SJerin Jacob .vendor_id = 0, 61*445371e8SJerin Jacob }, 62*445371e8SJerin Jacob }; 63*445371e8SJerin Jacob 64*445371e8SJerin Jacob static struct rte_pci_driver pci_pkivf = { 65*445371e8SJerin Jacob .id_table = pci_pkivf_map, 66*445371e8SJerin Jacob .drv_flags = RTE_PCI_DRV_NEED_MAPPING, 67*445371e8SJerin Jacob .probe = pkivf_probe, 68*445371e8SJerin Jacob }; 69*445371e8SJerin Jacob 70*445371e8SJerin Jacob RTE_PMD_REGISTER_PCI(octeontx_pkivf, pci_pkivf); 71