xref: /freebsd/sys/dev/pci/pci_private.h (revision 098ca2bda93c701c5331d4e6aace072495b4caaa)
1098ca2bdSWarner Losh /*-
27ba175acSWarner Losh  * Copyright (c) 1997, Stefan Esser <se@freebsd.org>
37ba175acSWarner Losh  * Copyright (c) 2000, Michael Smith <msmith@freebsd.org>
47ba175acSWarner Losh  * Copyright (c) 2000, BSDi
57ba175acSWarner Losh  * All rights reserved.
67ba175acSWarner Losh  *
77ba175acSWarner Losh  * Redistribution and use in source and binary forms, with or without
87ba175acSWarner Losh  * modification, are permitted provided that the following conditions
97ba175acSWarner Losh  * are met:
107ba175acSWarner Losh  * 1. Redistributions of source code must retain the above copyright
117ba175acSWarner Losh  *    notice unmodified, this list of conditions, and the following
127ba175acSWarner Losh  *    disclaimer.
137ba175acSWarner Losh  * 2. Redistributions in binary form must reproduce the above copyright
147ba175acSWarner Losh  *    notice, this list of conditions and the following disclaimer in the
157ba175acSWarner Losh  *    documentation and/or other materials provided with the distribution.
167ba175acSWarner Losh  *
177ba175acSWarner Losh  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
187ba175acSWarner Losh  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
197ba175acSWarner Losh  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
207ba175acSWarner Losh  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
217ba175acSWarner Losh  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
227ba175acSWarner Losh  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
237ba175acSWarner Losh  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
247ba175acSWarner Losh  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
257ba175acSWarner Losh  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
267ba175acSWarner Losh  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
277ba175acSWarner Losh  *
287ba175acSWarner Losh  * $FreeBSD$
297ba175acSWarner Losh  *
307ba175acSWarner Losh  */
317ba175acSWarner Losh 
327ba175acSWarner Losh #ifndef _PCI_PRIVATE_H_
337ba175acSWarner Losh #define _PCI_PRIVATE_H_
347ba175acSWarner Losh 
357ba175acSWarner Losh /*
367ba175acSWarner Losh  * Export definitions of the pci bus so that we can more easily share
377ba175acSWarner Losh  * it with "subclass" busses.  A more generic subclassing mechanism would
387ba175acSWarner Losh  * be nice, but is not present in the tree at this time.
397ba175acSWarner Losh  */
4042dbeaeeSJohn Baldwin extern devclass_t pci_devclass;
4142dbeaeeSJohn Baldwin 
4242dbeaeeSJohn Baldwin void		pci_add_children(device_t dev, int busno, size_t dinfo_size);
4342dbeaeeSJohn Baldwin void		pci_add_child(device_t bus, struct pci_devinfo *dinfo);
44cd8b53edSWarner Losh void		pci_driver_added(device_t dev, driver_t *driver);
457ba175acSWarner Losh int		pci_print_child(device_t dev, device_t child);
467ba175acSWarner Losh void		pci_probe_nomatch(device_t dev, device_t child);
477ba175acSWarner Losh int		pci_read_ivar(device_t dev, device_t child, int which,
487ba175acSWarner Losh 		    uintptr_t *result);
497ba175acSWarner Losh int		pci_write_ivar(device_t dev, device_t child, int which,
507ba175acSWarner Losh 		    uintptr_t value);
517ba175acSWarner Losh int		pci_set_powerstate_method(device_t dev, device_t child,
527ba175acSWarner Losh 		    int state);
537ba175acSWarner Losh int		pci_get_powerstate_method(device_t dev, device_t child);
54b0cb115fSWarner Losh uint32_t	pci_read_config_method(device_t dev, device_t child,
557ba175acSWarner Losh 		    int reg, int width);
567ba175acSWarner Losh void		pci_write_config_method(device_t dev, device_t child,
57b0cb115fSWarner Losh 		    int reg, uint32_t val, int width);
58c047e5b1SMatthew N. Dodd int		pci_enable_busmaster_method(device_t dev, device_t child);
59c047e5b1SMatthew N. Dodd int		pci_disable_busmaster_method(device_t dev, device_t child);
60c047e5b1SMatthew N. Dodd int		pci_enable_io_method(device_t dev, device_t child, int space);
61c047e5b1SMatthew N. Dodd int		pci_disable_io_method(device_t dev, device_t child, int space);
627ba175acSWarner Losh struct resource	*pci_alloc_resource(device_t dev, device_t child,
637ba175acSWarner Losh 		    int type, int *rid, u_long start, u_long end, u_long count,
647ba175acSWarner Losh 		    u_int flags);
657ba175acSWarner Losh void		pci_delete_resource(device_t dev, device_t child,
667ba175acSWarner Losh 		    int type, int rid);
677ba175acSWarner Losh struct resource_list *pci_get_resource_list (device_t dev, device_t child);
6820fe0073SWarner Losh struct pci_devinfo *pci_read_device(device_t pcib, int b, int s, int f,
6920fe0073SWarner Losh 		    size_t size);
707ba175acSWarner Losh void		pci_print_verbose(struct pci_devinfo *dinfo);
717ba175acSWarner Losh int		pci_freecfg(struct pci_devinfo *dinfo);
725794c593SWarner Losh int		pci_child_location_str_method(device_t cbdev, device_t child,
735794c593SWarner Losh 		    char *buf, size_t buflen);
745794c593SWarner Losh int		pci_child_pnpinfo_str_method(device_t cbdev, device_t child,
755794c593SWarner Losh 		    char *buf, size_t buflen);
763920999dSThomas Moestl int		pci_assign_interrupt_method(device_t dev, device_t child);
77526b5e65SMitsuru IWASAKI int		pci_resume(device_t dev);
78cd8b53edSWarner Losh int		pci_suspend(device_t dev);
797ba175acSWarner Losh #endif /* _PCI_PRIVATE_H_ */
80