Home | History | Annotate | Line # | Download | only in include
pci_machdep.h revision 1.24.16.1
      1  1.24.16.1  perseant /* $NetBSD: pci_machdep.h,v 1.24.16.1 2025/08/02 05:55:22 perseant Exp $ */
      2        1.1       cgd 
      3        1.1       cgd /*
      4        1.3       cgd  * Copyright (c) 1996 Carnegie-Mellon University.
      5        1.1       cgd  * All rights reserved.
      6        1.1       cgd  *
      7        1.1       cgd  * Author: Chris G. Demetriou
      8        1.1       cgd  *
      9        1.1       cgd  * Permission to use, copy, modify and distribute this software and
     10        1.1       cgd  * its documentation is hereby granted, provided that both the copyright
     11        1.1       cgd  * notice and this permission notice appear in all copies of the
     12        1.1       cgd  * software, derivative works or modified versions, and any portions
     13        1.1       cgd  * thereof, and that both notices appear in supporting documentation.
     14        1.1       cgd  *
     15        1.1       cgd  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16        1.1       cgd  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17        1.1       cgd  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18        1.1       cgd  *
     19        1.1       cgd  * Carnegie Mellon requests users of this software to return to
     20        1.1       cgd  *
     21        1.1       cgd  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22        1.1       cgd  *  School of Computer Science
     23        1.1       cgd  *  Carnegie Mellon University
     24        1.1       cgd  *  Pittsburgh PA 15213-3890
     25        1.1       cgd  *
     26        1.1       cgd  * any improvements or extensions that they make and grant Carnegie the
     27        1.1       cgd  * rights to redistribute these changes.
     28        1.1       cgd  */
     29        1.3       cgd 
     30       1.19   thorpej #ifndef _ALPHA_PCI_MACHDEP_H_
     31       1.19   thorpej #define	_ALPHA_PCI_MACHDEP_H_
     32       1.19   thorpej 
     33       1.19   thorpej #include <sys/errno.h>
     34       1.19   thorpej 
     35        1.1       cgd /*
     36        1.1       cgd  * Machine-specific definitions for PCI autoconfiguration.
     37        1.1       cgd  */
     38        1.7    simonb #define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
     39       1.22   thorpej #define	_PCI_HAVE_DMA64
     40        1.1       cgd 
     41        1.1       cgd /*
     42        1.3       cgd  * Types provided to machine-independent PCI code
     43        1.3       cgd  */
     44        1.3       cgd typedef struct alpha_pci_chipset *pci_chipset_tag_t;
     45        1.3       cgd typedef u_long pcitag_t;
     46       1.19   thorpej typedef struct {
     47       1.19   thorpej 	u_long value;
     48       1.19   thorpej } pci_intr_handle_t;
     49        1.3       cgd 
     50        1.3       cgd /*
     51        1.3       cgd  * Forward declarations.
     52        1.3       cgd  */
     53        1.3       cgd struct pci_attach_args;
     54       1.19   thorpej struct alpha_shared_intr;
     55        1.3       cgd 
     56        1.3       cgd /*
     57        1.3       cgd  * alpha-specific PCI structure and type definitions.
     58        1.3       cgd  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
     59        1.3       cgd  */
     60        1.3       cgd struct alpha_pci_chipset {
     61        1.3       cgd 	void		*pc_conf_v;
     62       1.14      matt 	void		(*pc_attach_hook)(device_t, device_t,
     63       1.14      matt 			    struct pcibus_attach_args *);
     64        1.4       cgd 	int		(*pc_bus_maxdevs)(void *, int);
     65        1.4       cgd 	pcitag_t	(*pc_make_tag)(void *, int, int, int);
     66        1.9   thorpej 	void		(*pc_decompose_tag)(void *, pcitag_t, int *,
     67        1.9   thorpej 			    int *, int *);
     68        1.4       cgd 	pcireg_t	(*pc_conf_read)(void *, pcitag_t, int);
     69        1.4       cgd 	void		(*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
     70        1.3       cgd 
     71        1.3       cgd 	void		*pc_intr_v;
     72       1.15      matt 	int		(*pc_intr_map)(const struct pci_attach_args *,
     73        1.4       cgd 			    pci_intr_handle_t *);
     74       1.19   thorpej 	const char	*(*pc_intr_string)(pci_chipset_tag_t,
     75       1.19   thorpej 			    pci_intr_handle_t, char *, size_t);
     76       1.19   thorpej 	const struct evcnt *(*pc_intr_evcnt)(pci_chipset_tag_t,
     77       1.19   thorpej 			    pci_intr_handle_t);
     78       1.19   thorpej 	void		*(*pc_intr_establish)(pci_chipset_tag_t,
     79       1.19   thorpej 			    pci_intr_handle_t, int, int (*)(void *), void *);
     80       1.19   thorpej 	void		(*pc_intr_disestablish)(pci_chipset_tag_t, void *);
     81        1.3       cgd 
     82       1.19   thorpej 	void		*(*pc_pciide_compat_intr_establish)(device_t,
     83       1.14      matt 			    const struct pci_attach_args *, int,
     84       1.14      matt 			    int (*)(void *), void *);
     85       1.19   thorpej 
     86       1.19   thorpej 	struct alpha_shared_intr *pc_shared_intrs;
     87       1.19   thorpej 	const char	*pc_intr_desc;
     88       1.19   thorpej 	u_long		pc_vecbase;
     89       1.19   thorpej 	u_int		pc_nirq;
     90       1.19   thorpej 
     91       1.20   thorpej 	u_long		pc_eligible_cpus;
     92       1.20   thorpej 
     93       1.19   thorpej 	void		(*pc_intr_enable)(pci_chipset_tag_t, int);
     94       1.19   thorpej 	void		(*pc_intr_disable)(pci_chipset_tag_t, int);
     95       1.20   thorpej 	void		(*pc_intr_set_affinity)(pci_chipset_tag_t, int,
     96       1.20   thorpej 			    struct cpu_info *);
     97        1.3       cgd };
     98        1.3       cgd 
     99       1.23   thorpej struct alpha_pci_intr_impl {
    100       1.23   thorpej 	uint64_t	systype;
    101       1.23   thorpej 	void		(*intr_init)(void *, bus_space_tag_t, bus_space_tag_t,
    102       1.23   thorpej 			    pci_chipset_tag_t);
    103       1.23   thorpej };
    104       1.23   thorpej 
    105       1.23   thorpej #define	ALPHA_PCI_INTR_INIT(_st_, _fn_)					\
    106       1.23   thorpej static const struct alpha_pci_intr_impl __CONCAT(intr_impl_st_,_st_) = {\
    107       1.23   thorpej 	.systype = (_st_), .intr_init = (_fn_),				\
    108       1.23   thorpej };									\
    109       1.23   thorpej __link_set_add_rodata(alpha_pci_intr_impls, __CONCAT(intr_impl_st_,_st_));
    110       1.23   thorpej 
    111        1.3       cgd /*
    112        1.3       cgd  * Functions provided to machine-independent PCI code.
    113        1.3       cgd  */
    114       1.19   thorpej void	pci_attach_hook(device_t, device_t, struct pcibus_attach_args *);
    115       1.19   thorpej int	pci_bus_maxdevs(pci_chipset_tag_t, int);
    116       1.19   thorpej pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int);
    117       1.19   thorpej void	pci_decompose_tag(pci_chipset_tag_t, pcitag_t, int *, int *, int *);
    118       1.19   thorpej pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
    119       1.19   thorpej void	pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
    120       1.19   thorpej 
    121       1.19   thorpej int	pci_intr_map(const struct pci_attach_args *, pci_intr_handle_t *);
    122       1.19   thorpej const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t,
    123       1.19   thorpej 	    char *, size_t);
    124       1.19   thorpej const struct evcnt *pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
    125       1.19   thorpej void	*pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, int,
    126       1.19   thorpej 	    int (*)(void *), void *);
    127       1.19   thorpej void	pci_intr_disestablish(pci_chipset_tag_t, void *);
    128       1.10   thorpej 
    129        1.3       cgd /*
    130        1.3       cgd  * alpha-specific PCI functions.
    131        1.3       cgd  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
    132        1.1       cgd  */
    133  1.24.16.1  perseant void	pci_consinit(pci_chipset_tag_t, bus_space_tag_t, bus_space_tag_t,
    134  1.24.16.1  perseant 	    bus_space_tag_t, bus_space_tag_t);
    135        1.4       cgd void	pci_display_console(bus_space_tag_t, bus_space_tag_t,
    136        1.4       cgd 	    pci_chipset_tag_t, int, int, int);
    137  1.24.16.1  perseant void	pci_find_bootdev(device_t, device_t, void *);
    138       1.16   tsutsui void	device_pci_register(device_t, void *);
    139       1.19   thorpej 
    140       1.23   thorpej void	alpha_pci_intr_init(void *, bus_space_tag_t, bus_space_tag_t,
    141       1.23   thorpej 	    pci_chipset_tag_t);
    142       1.24   thorpej void	alpha_pci_intr_alloc(pci_chipset_tag_t, unsigned int);
    143       1.23   thorpej 
    144       1.19   thorpej int	alpha_pci_generic_intr_map(const struct pci_attach_args *,
    145       1.19   thorpej 	    pci_intr_handle_t *);
    146       1.19   thorpej const char *alpha_pci_generic_intr_string(pci_chipset_tag_t,
    147       1.19   thorpej 	    pci_intr_handle_t, char *, size_t);
    148       1.19   thorpej const struct evcnt *alpha_pci_generic_intr_evcnt(pci_chipset_tag_t,
    149       1.19   thorpej 	    pci_intr_handle_t);
    150       1.19   thorpej void	*alpha_pci_generic_intr_establish(pci_chipset_tag_t,
    151       1.19   thorpej 	    pci_intr_handle_t, int, int (*)(void *), void *);
    152       1.19   thorpej void	alpha_pci_generic_intr_disestablish(pci_chipset_tag_t, void *);
    153       1.19   thorpej void	alpha_pci_generic_iointr(void *, unsigned long);
    154       1.19   thorpej 
    155       1.21   thorpej void	alpha_pci_generic_intr_redistribute(pci_chipset_tag_t);
    156       1.21   thorpej 
    157       1.19   thorpej void	alpha_pci_intr_handle_init(pci_intr_handle_t *, u_int, u_int);
    158       1.19   thorpej void	alpha_pci_intr_handle_set_irq(pci_intr_handle_t *, u_int);
    159       1.19   thorpej u_int	alpha_pci_intr_handle_get_irq(const pci_intr_handle_t *);
    160       1.19   thorpej void	alpha_pci_intr_handle_set_flags(pci_intr_handle_t *, u_int);
    161       1.19   thorpej u_int	alpha_pci_intr_handle_get_flags(const pci_intr_handle_t *);
    162       1.19   thorpej 
    163       1.19   thorpej #endif /* _ALPHA_PCI_MACHDEP_H_ */
    164