xref: /netbsd-src/sys/arch/landisk/include/pci_machdep.h (revision f92b57445925e7defe041e88efb7f45387fff779)
1*f92b5744Smartin /*	$NetBSD: pci_machdep.h,v 1.7 2022/10/31 15:57:52 martin Exp $	*/
21fd097bfSuwe 
31fd097bfSuwe /*
41fd097bfSuwe  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
51fd097bfSuwe  * Copyright (c) 1994 Charles M. Hannum.  All rights reserved.
61fd097bfSuwe  *
71fd097bfSuwe  * Redistribution and use in source and binary forms, with or without
81fd097bfSuwe  * modification, are permitted provided that the following conditions
91fd097bfSuwe  * are met:
101fd097bfSuwe  * 1. Redistributions of source code must retain the above copyright
111fd097bfSuwe  *    notice, this list of conditions and the following disclaimer.
121fd097bfSuwe  * 2. Redistributions in binary form must reproduce the above copyright
131fd097bfSuwe  *    notice, this list of conditions and the following disclaimer in the
141fd097bfSuwe  *    documentation and/or other materials provided with the distribution.
151fd097bfSuwe  * 3. All advertising materials mentioning features or use of this software
161fd097bfSuwe  *    must display the following acknowledgement:
171fd097bfSuwe  *	This product includes software developed by Charles M. Hannum.
181fd097bfSuwe  * 4. The name of the author may not be used to endorse or promote products
191fd097bfSuwe  *    derived from this software without specific prior written permission.
201fd097bfSuwe  *
211fd097bfSuwe  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
221fd097bfSuwe  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
231fd097bfSuwe  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
241fd097bfSuwe  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
251fd097bfSuwe  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
261fd097bfSuwe  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
271fd097bfSuwe  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
281fd097bfSuwe  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
291fd097bfSuwe  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
301fd097bfSuwe  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
311fd097bfSuwe  */
321fd097bfSuwe 
331fd097bfSuwe #ifndef _LANDISK_PCI_MACHDEP_H
341fd097bfSuwe #define _LANDISK_PCI_MACHDEP_H
351fd097bfSuwe 
361fd097bfSuwe /*
371fd097bfSuwe  * Machine-specific definitions for PCI autoconfiguration.
381fd097bfSuwe  */
391fd097bfSuwe #define	__HAVE_PCI_CONF_HOOK
401fd097bfSuwe 
411fd097bfSuwe /*
421fd097bfSuwe  * Types provided to machine-independent PCI code
431fd097bfSuwe  */
441fd097bfSuwe typedef void *pci_chipset_tag_t;
451fd097bfSuwe typedef int pcitag_t;
461fd097bfSuwe typedef int pci_intr_handle_t;
471fd097bfSuwe 
481fd097bfSuwe #include <sh3/dev/shpcicvar.h>
491fd097bfSuwe 
501fd097bfSuwe /*
511fd097bfSuwe  * Forward declarations.
521fd097bfSuwe  */
531fd097bfSuwe struct pci_attach_args;
541fd097bfSuwe 
551fd097bfSuwe /*
561fd097bfSuwe  * Functions provided to machine-independent PCI code.
571fd097bfSuwe  */
58cbab9cadSchs void landisk_pci_attach_hook(device_t, device_t,
591fd097bfSuwe     struct pcibus_attach_args *);
603a4f5f68Sdyoung int landisk_pci_intr_map(const struct pci_attach_args *, pci_intr_handle_t *);
61eb94f743Sjoerg const char *landisk_pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t,
62e58a356cSchristos     char *, size_t);
631fd097bfSuwe const struct evcnt *landisk_pci_intr_evcnt(pci_chipset_tag_t,pci_intr_handle_t);
641fd097bfSuwe void *landisk_pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, int,
651fd097bfSuwe     int (*)(void *), void *);
661fd097bfSuwe void landisk_pci_intr_disestablish(pci_chipset_tag_t, void *);
671fd097bfSuwe void landisk_pci_conf_interrupt(void *v, int bus, int dev, int pin,
681fd097bfSuwe     int swiz, int *iline);
691fd097bfSuwe int landisk_pci_conf_hook(void *, int, int, int, pcireg_t);
701fd097bfSuwe 
711fd097bfSuwe #define	pci_bus_maxdevs(v, busno) \
721fd097bfSuwe 	shpcic_bus_maxdevs(v, busno)
731fd097bfSuwe #define	pci_make_tag(v, bus, dev, func) \
741fd097bfSuwe 	shpcic_make_tag(v, bus, dev, func)
751fd097bfSuwe #define	pci_decompose_tag(v, tag, bp, dp, fp) \
761fd097bfSuwe 	shpcic_decompose_tag(v, tag, bp, dp, fp)
771fd097bfSuwe #define	pci_conf_read(v, tag, reg) \
781fd097bfSuwe 	shpcic_conf_read(v, tag, reg)
791fd097bfSuwe #define	pci_conf_write(v, tag, reg, data) \
801fd097bfSuwe 	shpcic_conf_write(v, tag, reg, data)
811fd097bfSuwe 
821fd097bfSuwe #define	pci_attach_hook(pa, self, pba) \
831fd097bfSuwe 	landisk_pci_attach_hook(pa, self, pba)
841fd097bfSuwe #define	pci_intr_map(pa, ihp) \
851fd097bfSuwe 	landisk_pci_intr_map(pa, ihp)
8630baabb6Sriastradh #define	pci_intr_setattr(pa, ihp, attr, data) \
8730baabb6Sriastradh 	landisk_pci_intr_setattr(pa, ihp, attr, data)
88e58a356cSchristos #define	pci_intr_string(v, ih, buf, len) \
89e58a356cSchristos 	landisk_pci_intr_string(v, ih, buf, len)
901fd097bfSuwe #define	pci_intr_evcnt(v, ih) \
911fd097bfSuwe 	landisk_pci_intr_evcnt(v, ih)
921fd097bfSuwe #define	pci_intr_establish(v, ih, level, ih_fun, ih_arg) \
931fd097bfSuwe 	landisk_pci_intr_establish(v, ih, level, ih_fun, ih_arg)
941fd097bfSuwe #define	pci_intr_disestablish(v, cookie) \
951fd097bfSuwe 	landisk_pci_intr_disestablish(v, cookie)
961fd097bfSuwe #define	pci_conf_interrupt(v, bus, dev, pin, swiz, iline) \
971fd097bfSuwe 	landisk_pci_conf_interrupt(v, bus, dev, pin, swiz, iline)
981fd097bfSuwe #define	pci_conf_hook(v, bus, dev, func, id) \
991fd097bfSuwe 	landisk_pci_conf_hook(v, bus, dev, func, id)
1001fd097bfSuwe 
1011fd097bfSuwe #ifdef _KERNEL
1021fd097bfSuwe /*
1031fd097bfSuwe  * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED
1041fd097bfSuwe  * BY PORTABLE CODE.
1051fd097bfSuwe  */
1061fd097bfSuwe #endif
1071fd097bfSuwe 
1081fd097bfSuwe #endif /* _LANDISK_PCI_MACHDEP_H */
109