xref: /linux/drivers/net/ethernet/mellanox/mlxsw/pci.h (revision d1ba52638456f20f81e9182b74d56ce036b39c6d)
11d20d23cSJiri Pirko /*
21d20d23cSJiri Pirko  * drivers/net/ethernet/mellanox/mlxsw/pci.h
31d20d23cSJiri Pirko  * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
41d20d23cSJiri Pirko  * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com>
51d20d23cSJiri Pirko  *
61d20d23cSJiri Pirko  * Redistribution and use in source and binary forms, with or without
71d20d23cSJiri Pirko  * modification, are permitted provided that the following conditions are met:
81d20d23cSJiri Pirko  *
91d20d23cSJiri Pirko  * 1. Redistributions of source code must retain the above copyright
101d20d23cSJiri Pirko  *    notice, this list of conditions and the following disclaimer.
111d20d23cSJiri Pirko  * 2. Redistributions in binary form must reproduce the above copyright
121d20d23cSJiri Pirko  *    notice, this list of conditions and the following disclaimer in the
131d20d23cSJiri Pirko  *    documentation and/or other materials provided with the distribution.
141d20d23cSJiri Pirko  * 3. Neither the names of the copyright holders nor the names of its
151d20d23cSJiri Pirko  *    contributors may be used to endorse or promote products derived from
161d20d23cSJiri Pirko  *    this software without specific prior written permission.
171d20d23cSJiri Pirko  *
181d20d23cSJiri Pirko  * Alternatively, this software may be distributed under the terms of the
191d20d23cSJiri Pirko  * GNU General Public License ("GPL") version 2 as published by the Free
201d20d23cSJiri Pirko  * Software Foundation.
211d20d23cSJiri Pirko  *
221d20d23cSJiri Pirko  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
231d20d23cSJiri Pirko  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241d20d23cSJiri Pirko  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251d20d23cSJiri Pirko  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
261d20d23cSJiri Pirko  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
271d20d23cSJiri Pirko  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
281d20d23cSJiri Pirko  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
291d20d23cSJiri Pirko  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
301d20d23cSJiri Pirko  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
311d20d23cSJiri Pirko  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
321d20d23cSJiri Pirko  * POSSIBILITY OF SUCH DAMAGE.
331d20d23cSJiri Pirko  */
341d20d23cSJiri Pirko 
351d20d23cSJiri Pirko #ifndef _MLXSW_PCI_H
361d20d23cSJiri Pirko #define _MLXSW_PCI_H
371d20d23cSJiri Pirko 
381d20d23cSJiri Pirko #include <linux/pci.h>
391d20d23cSJiri Pirko 
401d20d23cSJiri Pirko #define PCI_DEVICE_ID_MELLANOX_SWITCHX2		0xc738
411d20d23cSJiri Pirko #define PCI_DEVICE_ID_MELLANOX_SPECTRUM		0xcb84
42*d1ba5263SElad Raz #define PCI_DEVICE_ID_MELLANOX_SWITCHIB		0xcb20
43*d1ba5263SElad Raz #define PCI_DEVICE_ID_MELLANOX_SWITCHIB2	0xcf08
441d20d23cSJiri Pirko 
451d20d23cSJiri Pirko #if IS_ENABLED(CONFIG_MLXSW_PCI)
461d20d23cSJiri Pirko 
471d20d23cSJiri Pirko int mlxsw_pci_driver_register(struct pci_driver *pci_driver);
481d20d23cSJiri Pirko void mlxsw_pci_driver_unregister(struct pci_driver *pci_driver);
491d20d23cSJiri Pirko 
501d20d23cSJiri Pirko #else
511d20d23cSJiri Pirko 
521d20d23cSJiri Pirko static inline int
531d20d23cSJiri Pirko mlxsw_pci_driver_register(struct pci_driver *pci_driver)
541d20d23cSJiri Pirko {
551d20d23cSJiri Pirko 	return 0;
561d20d23cSJiri Pirko }
571d20d23cSJiri Pirko 
581d20d23cSJiri Pirko static inline void
591d20d23cSJiri Pirko mlxsw_pci_driver_unregister(struct pci_driver *pci_driver)
601d20d23cSJiri Pirko {
611d20d23cSJiri Pirko }
621d20d23cSJiri Pirko 
631d20d23cSJiri Pirko #endif
641d20d23cSJiri Pirko 
651d20d23cSJiri Pirko #endif
66