xref: /netbsd-src/lib/libpci/pci.h (revision 62ee7dc27baa40ad66a6b4799630c1b418add616)
1*62ee7dc2Smrg /*	$NetBSD: pci.h,v 1.9 2016/09/24 23:12:54 mrg Exp $	*/
216487fdfSthorpej 
316487fdfSthorpej /*
416487fdfSthorpej  * Copyright 2001 Wasabi Systems, Inc.
516487fdfSthorpej  * All rights reserved.
616487fdfSthorpej  *
716487fdfSthorpej  * Written by Jason R. Thorpe for Wasabi Systems, Inc.
816487fdfSthorpej  *
916487fdfSthorpej  * Redistribution and use in source and binary forms, with or without
1016487fdfSthorpej  * modification, are permitted provided that the following conditions
1116487fdfSthorpej  * are met:
1216487fdfSthorpej  * 1. Redistributions of source code must retain the above copyright
1316487fdfSthorpej  *    notice, this list of conditions and the following disclaimer.
1416487fdfSthorpej  * 2. Redistributions in binary form must reproduce the above copyright
1516487fdfSthorpej  *    notice, this list of conditions and the following disclaimer in the
1616487fdfSthorpej  *    documentation and/or other materials provided with the distribution.
1716487fdfSthorpej  * 3. All advertising materials mentioning features or use of this software
1816487fdfSthorpej  *    must display the following acknowledgement:
1916487fdfSthorpej  *	This product includes software developed for the NetBSD Project by
2016487fdfSthorpej  *	Wasabi Systems, Inc.
2116487fdfSthorpej  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
2216487fdfSthorpej  *    or promote products derived from this software without specific prior
2316487fdfSthorpej  *    written permission.
2416487fdfSthorpej  *
2516487fdfSthorpej  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
2616487fdfSthorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2716487fdfSthorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2816487fdfSthorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
2916487fdfSthorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
3016487fdfSthorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
3116487fdfSthorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
3216487fdfSthorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
3316487fdfSthorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3416487fdfSthorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3516487fdfSthorpej  * POSSIBILITY OF SUCH DAMAGE.
3616487fdfSthorpej  */
3716487fdfSthorpej 
3816487fdfSthorpej #ifndef _PCI_H_
3916487fdfSthorpej #define	_PCI_H_
4016487fdfSthorpej 
415d13788bSdholland #include <stddef.h>
425d13788bSdholland #include <stdint.h> /* XXX */
435d13788bSdholland 
4416487fdfSthorpej /*
4516487fdfSthorpej  * Interface to the PCI bus for user programs.
4616487fdfSthorpej  */
4716487fdfSthorpej 
4816487fdfSthorpej typedef uint32_t pcireg_t;	/* XXX */
4916487fdfSthorpej 
5016487fdfSthorpej /* pci_bus.c */
51398f5724Sdholland int	pcibus_conf_read(int, unsigned int, unsigned int, unsigned int,
52398f5724Sdholland 		unsigned int, pcireg_t *);
53398f5724Sdholland int	pcibus_conf_write(int, unsigned int, unsigned int, unsigned int,
54398f5724Sdholland 		unsigned int, pcireg_t);
5516487fdfSthorpej 
5616487fdfSthorpej /* pci_device.c */
57398f5724Sdholland int	pcidev_conf_read(int, unsigned int, pcireg_t *);
58398f5724Sdholland int	pcidev_conf_write(int, unsigned int, pcireg_t);
5916487fdfSthorpej 
601e4a2ee3Smrg /* pci_drvname.c */
61398f5724Sdholland int	pci_drvname(int, unsigned int, unsigned int, char *, size_t);
62*62ee7dc2Smrg int	pci_drvnameonbus(int, unsigned int, unsigned int, unsigned int, char *,
63*62ee7dc2Smrg 		size_t);
641e4a2ee3Smrg 
6516487fdfSthorpej /* pci_subr.c */
667407d114Skleink void	pci_devinfo(pcireg_t, pcireg_t, int, char *, size_t);
67398f5724Sdholland void	pci_conf_print(int, unsigned int, unsigned int, unsigned int);
6816487fdfSthorpej 
6916487fdfSthorpej #endif /* _PCI_H_ */
70