xref: /dflybsd-src/sys/dev/drm/include/uapi/linux/pci.h (revision 789731325bde747251c28a37e0a00ed4efb88c46)
11cefe05aSFrançois Tigeot /*
2465fa37bSFrançois Tigeot  * Copyright (c) 2018-2019 François Tigeot <ftigeot@wolfpond.org>
31cefe05aSFrançois Tigeot  * All rights reserved.
41cefe05aSFrançois Tigeot  *
51cefe05aSFrançois Tigeot  * Redistribution and use in source and binary forms, with or without
61cefe05aSFrançois Tigeot  * modification, are permitted provided that the following conditions
71cefe05aSFrançois Tigeot  * are met:
81cefe05aSFrançois Tigeot  * 1. Redistributions of source code must retain the above copyright
91cefe05aSFrançois Tigeot  *    notice unmodified, this list of conditions, and the following
101cefe05aSFrançois Tigeot  *    disclaimer.
111cefe05aSFrançois Tigeot  * 2. Redistributions in binary form must reproduce the above copyright
121cefe05aSFrançois Tigeot  *    notice, this list of conditions and the following disclaimer in the
131cefe05aSFrançois Tigeot  *    documentation and/or other materials provided with the distribution.
141cefe05aSFrançois Tigeot  *
151cefe05aSFrançois Tigeot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
161cefe05aSFrançois Tigeot  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
171cefe05aSFrançois Tigeot  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
181cefe05aSFrançois Tigeot  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
191cefe05aSFrançois Tigeot  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
201cefe05aSFrançois Tigeot  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
211cefe05aSFrançois Tigeot  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
221cefe05aSFrançois Tigeot  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
231cefe05aSFrançois Tigeot  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
241cefe05aSFrançois Tigeot  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
251cefe05aSFrançois Tigeot  */
261cefe05aSFrançois Tigeot 
271cefe05aSFrançois Tigeot #ifndef _UAPI_LINUX_PCI_H_
281cefe05aSFrançois Tigeot #define _UAPI_LINUX_PCI_H_
291cefe05aSFrançois Tigeot 
30465fa37bSFrançois Tigeot #include <linux/pci_regs.h>
31465fa37bSFrançois Tigeot 
321cefe05aSFrançois Tigeot #define PCI_DEVFN(slot, func)	((((slot) & 0x1f) << 3) | ((func) & 0x07))
331cefe05aSFrançois Tigeot #define PCI_SLOT(devfn)		(((devfn) >> 3) & 0x1f)
341cefe05aSFrançois Tigeot #define PCI_FUNC(devfn)		((devfn) & 0x07)
35*78973132SSergey Zigachev /* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */
36*78973132SSergey Zigachev #define PCI_BUS_NUM(x) (((x) >> 8) & 0xff)
371cefe05aSFrançois Tigeot 
381cefe05aSFrançois Tigeot #endif /* _UAPI_LINUX_PCI_H_ */
39