Home | History | Annotate | Line # | Download | only in include
pci_machdep.h revision 1.21
      1  1.21  thorpej /* $NetBSD: pci_machdep.h,v 1.21 2020/09/26 21:07:48 thorpej 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.1      cgd 
     40   1.1      cgd /*
     41   1.3      cgd  * Types provided to machine-independent PCI code
     42   1.3      cgd  */
     43   1.3      cgd typedef struct alpha_pci_chipset *pci_chipset_tag_t;
     44   1.3      cgd typedef u_long pcitag_t;
     45  1.19  thorpej typedef struct {
     46  1.19  thorpej 	u_long value;
     47  1.19  thorpej } pci_intr_handle_t;
     48   1.3      cgd 
     49   1.3      cgd /*
     50   1.3      cgd  * Forward declarations.
     51   1.3      cgd  */
     52   1.3      cgd struct pci_attach_args;
     53  1.19  thorpej struct alpha_shared_intr;
     54   1.3      cgd 
     55   1.3      cgd /*
     56   1.3      cgd  * alpha-specific PCI structure and type definitions.
     57   1.3      cgd  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
     58   1.3      cgd  */
     59   1.3      cgd struct alpha_pci_chipset {
     60   1.3      cgd 	void		*pc_conf_v;
     61  1.14     matt 	void		(*pc_attach_hook)(device_t, device_t,
     62  1.14     matt 			    struct pcibus_attach_args *);
     63   1.4      cgd 	int		(*pc_bus_maxdevs)(void *, int);
     64   1.4      cgd 	pcitag_t	(*pc_make_tag)(void *, int, int, int);
     65   1.9  thorpej 	void		(*pc_decompose_tag)(void *, pcitag_t, int *,
     66   1.9  thorpej 			    int *, int *);
     67   1.4      cgd 	pcireg_t	(*pc_conf_read)(void *, pcitag_t, int);
     68   1.4      cgd 	void		(*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
     69   1.3      cgd 
     70   1.3      cgd 	void		*pc_intr_v;
     71  1.15     matt 	int		(*pc_intr_map)(const struct pci_attach_args *,
     72   1.4      cgd 			    pci_intr_handle_t *);
     73  1.19  thorpej 	const char	*(*pc_intr_string)(pci_chipset_tag_t,
     74  1.19  thorpej 			    pci_intr_handle_t, char *, size_t);
     75  1.19  thorpej 	const struct evcnt *(*pc_intr_evcnt)(pci_chipset_tag_t,
     76  1.19  thorpej 			    pci_intr_handle_t);
     77  1.19  thorpej 	void		*(*pc_intr_establish)(pci_chipset_tag_t,
     78  1.19  thorpej 			    pci_intr_handle_t, int, int (*)(void *), void *);
     79  1.19  thorpej 	void		(*pc_intr_disestablish)(pci_chipset_tag_t, void *);
     80   1.3      cgd 
     81  1.19  thorpej 	void		*(*pc_pciide_compat_intr_establish)(device_t,
     82  1.14     matt 			    const struct pci_attach_args *, int,
     83  1.14     matt 			    int (*)(void *), void *);
     84  1.19  thorpej 
     85  1.19  thorpej 	struct alpha_shared_intr *pc_shared_intrs;
     86  1.19  thorpej 	const char	*pc_intr_desc;
     87  1.19  thorpej 	u_long		pc_vecbase;
     88  1.19  thorpej 	u_int		pc_nirq;
     89  1.19  thorpej 
     90  1.20  thorpej 	u_long		pc_eligible_cpus;
     91  1.20  thorpej 
     92  1.19  thorpej 	void		(*pc_intr_enable)(pci_chipset_tag_t, int);
     93  1.19  thorpej 	void		(*pc_intr_disable)(pci_chipset_tag_t, int);
     94  1.20  thorpej 	void		(*pc_intr_set_affinity)(pci_chipset_tag_t, int,
     95  1.20  thorpej 			    struct cpu_info *);
     96   1.3      cgd };
     97   1.3      cgd 
     98   1.3      cgd /*
     99   1.3      cgd  * Functions provided to machine-independent PCI code.
    100   1.3      cgd  */
    101  1.19  thorpej void	pci_attach_hook(device_t, device_t, struct pcibus_attach_args *);
    102  1.19  thorpej int	pci_bus_maxdevs(pci_chipset_tag_t, int);
    103  1.19  thorpej pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int);
    104  1.19  thorpej void	pci_decompose_tag(pci_chipset_tag_t, pcitag_t, int *, int *, int *);
    105  1.19  thorpej pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
    106  1.19  thorpej void	pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
    107  1.19  thorpej 
    108  1.19  thorpej int	pci_intr_map(const struct pci_attach_args *, pci_intr_handle_t *);
    109  1.19  thorpej const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t,
    110  1.19  thorpej 	    char *, size_t);
    111  1.19  thorpej const struct evcnt *pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
    112  1.19  thorpej void	*pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, int,
    113  1.19  thorpej 	    int (*)(void *), void *);
    114  1.19  thorpej void	pci_intr_disestablish(pci_chipset_tag_t, void *);
    115  1.10  thorpej 
    116   1.3      cgd /*
    117   1.3      cgd  * alpha-specific PCI functions.
    118   1.3      cgd  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
    119   1.1      cgd  */
    120   1.4      cgd void	pci_display_console(bus_space_tag_t, bus_space_tag_t,
    121   1.4      cgd 	    pci_chipset_tag_t, int, int, int);
    122  1.16  tsutsui void	device_pci_register(device_t, void *);
    123  1.19  thorpej 
    124  1.19  thorpej int	alpha_pci_generic_intr_map(const struct pci_attach_args *,
    125  1.19  thorpej 	    pci_intr_handle_t *);
    126  1.19  thorpej const char *alpha_pci_generic_intr_string(pci_chipset_tag_t,
    127  1.19  thorpej 	    pci_intr_handle_t, char *, size_t);
    128  1.19  thorpej const struct evcnt *alpha_pci_generic_intr_evcnt(pci_chipset_tag_t,
    129  1.19  thorpej 	    pci_intr_handle_t);
    130  1.19  thorpej void	*alpha_pci_generic_intr_establish(pci_chipset_tag_t,
    131  1.19  thorpej 	    pci_intr_handle_t, int, int (*)(void *), void *);
    132  1.19  thorpej void	alpha_pci_generic_intr_disestablish(pci_chipset_tag_t, void *);
    133  1.19  thorpej void	alpha_pci_generic_iointr(void *, unsigned long);
    134  1.19  thorpej 
    135  1.21  thorpej void	alpha_pci_generic_intr_redistribute(pci_chipset_tag_t);
    136  1.21  thorpej 
    137  1.19  thorpej void	alpha_pci_intr_handle_init(pci_intr_handle_t *, u_int, u_int);
    138  1.19  thorpej void	alpha_pci_intr_handle_set_irq(pci_intr_handle_t *, u_int);
    139  1.19  thorpej u_int	alpha_pci_intr_handle_get_irq(const pci_intr_handle_t *);
    140  1.19  thorpej void	alpha_pci_intr_handle_set_flags(pci_intr_handle_t *, u_int);
    141  1.19  thorpej u_int	alpha_pci_intr_handle_get_flags(const pci_intr_handle_t *);
    142  1.19  thorpej 
    143  1.19  thorpej #endif /* _ALPHA_PCI_MACHDEP_H_ */
    144