Home | History | Annotate | Line # | Download | only in include
      1  1.1     skrll /*	$OpenBSD: pci_machdep.h,v 1.1 2003/09/29 19:23:02 mickey Exp $	*/
      2  1.1     skrll 
      3  1.1     skrll /*
      4  1.1     skrll  * Copyright (c) 2003 Michael Shalayeff
      5  1.1     skrll  * All rights reserved.
      6  1.1     skrll  *
      7  1.1     skrll  * Redistribution and use in source and binary forms, with or without
      8  1.1     skrll  * modification, are permitted provided that the following conditions
      9  1.1     skrll  * are met:
     10  1.1     skrll  * 1. Redistributions of source code must retain the above copyright
     11  1.1     skrll  *    notice, this list of conditions and the following disclaimer.
     12  1.1     skrll  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1     skrll  *    notice, this list of conditions and the following disclaimer in the
     14  1.1     skrll  *    documentation and/or other materials provided with the distribution.
     15  1.1     skrll  *
     16  1.1     skrll  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  1.1     skrll  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  1.1     skrll  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  1.1     skrll  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
     20  1.1     skrll  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     21  1.1     skrll  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     22  1.1     skrll  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  1.1     skrll  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     24  1.1     skrll  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     25  1.1     skrll  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     26  1.1     skrll  * THE POSSIBILITY OF SUCH DAMAGE.
     27  1.1     skrll  */
     28  1.1     skrll 
     29  1.1     skrll #ifndef	_MACHINE_PCI_MACHDEP_H_
     30  1.1     skrll #define	_MACHINE_PCI_MACHDEP_H_
     31  1.1     skrll 
     32  1.1     skrll /*
     33  1.1     skrll  * Types provided to machine-independent PCI code
     34  1.1     skrll  */
     35  1.1     skrll typedef struct hppa_pci_chipset_tag *pci_chipset_tag_t;
     36  1.1     skrll typedef u_long pcitag_t;
     37  1.1     skrll typedef u_long pci_intr_handle_t;
     38  1.1     skrll 
     39  1.1     skrll struct pci_attach_args;
     40  1.1     skrll 
     41  1.1     skrll struct hppa_pci_chipset_tag {
     42  1.1     skrll 	void		*_cookie;
     43  1.1     skrll 	void		(*pc_attach_hook)(device_t,
     44  1.1     skrll 			    device_t, struct pcibus_attach_args *);
     45  1.1     skrll 	int		(*pc_bus_maxdevs)(void *, int);
     46  1.1     skrll 	pcitag_t	(*pc_make_tag)(void *, int, int, int);
     47  1.1     skrll 	void		(*pc_decompose_tag)(void *, pcitag_t, int *,
     48  1.1     skrll 			    int *, int *);
     49  1.1     skrll 	pcireg_t	(*pc_conf_read)(void *, pcitag_t, int);
     50  1.1     skrll 	void		(*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
     51  1.1     skrll 
     52  1.1     skrll 	int		(*pc_intr_map)(const struct pci_attach_args *,
     53  1.1     skrll 			    pci_intr_handle_t *);
     54  1.2  christos 	const char	*(*pc_intr_string)(void *, pci_intr_handle_t,
     55  1.2  christos 			    char *, size_t);
     56  1.3     skrll 	int		(*pc_intr_setattr)(void *, pci_intr_handle_t *,
     57  1.3     skrll 			    int, uint64_t);
     58  1.1     skrll 	void		*(*pc_intr_establish)(void *, pci_intr_handle_t,
     59  1.1     skrll 			    int, int (*)(void *), void *);
     60  1.1     skrll 	void		(*pc_intr_disestablish)(void *, void *);
     61  1.1     skrll 
     62  1.1     skrll 	void		*(*pc_alloc_parent)(device_t,
     63  1.1     skrll 			    struct pci_attach_args *, int);
     64  1.1     skrll };
     65  1.1     skrll 
     66  1.1     skrll /*
     67  1.1     skrll  * Functions provided to machine-independent PCI code.
     68  1.1     skrll  */
     69  1.1     skrll #define	pci_attach_hook(p, s, pba)					\
     70  1.1     skrll     (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
     71  1.1     skrll #define	pci_bus_maxdevs(c, b)						\
     72  1.1     skrll     (*(c)->pc_bus_maxdevs)((c)->_cookie, (b))
     73  1.1     skrll #define	pci_make_tag(c, b, d, f)					\
     74  1.1     skrll     (*(c)->pc_make_tag)((c)->_cookie, (b), (d), (f))
     75  1.1     skrll #define	pci_decompose_tag(c, t, bp, dp, fp)				\
     76  1.1     skrll     (*(c)->pc_decompose_tag)((c)->_cookie, (t), (bp), (dp), (fp))
     77  1.1     skrll #define	pci_conf_read(c, t, r)						\
     78  1.1     skrll     (*(c)->pc_conf_read)((c)->_cookie, (t), (r))
     79  1.1     skrll #define	pci_conf_write(c, t, r, v)					\
     80  1.1     skrll     (*(c)->pc_conf_write)((c)->_cookie, (t), (r), (v))
     81  1.1     skrll #define	pci_intr_map(p, ihp)						\
     82  1.1     skrll     (*(p)->pa_pc->pc_intr_map)((p), (ihp))
     83  1.1     skrll #define	pci_intr_line(ih)	(ih)
     84  1.2  christos #define	pci_intr_string(c, ih, buf, len)				\
     85  1.2  christos     (*(c)->pc_intr_string)((c)->_cookie, (ih), (buf), (len))
     86  1.1     skrll #define	pci_intr_establish(c, ih, l, h, a)				\
     87  1.1     skrll     (*(c)->pc_intr_establish)((c)->_cookie, (ih), (l), (h), (a))
     88  1.1     skrll #define	pci_intr_disestablish(c, iv)					\
     89  1.1     skrll     (*(c)->pc_intr_disestablish)((c)->_cookie, (iv))
     90  1.1     skrll 
     91  1.3     skrll static inline int
     92  1.3     skrll pci_intr_setattr(pci_chipset_tag_t pc, pci_intr_handle_t *ihp,
     93  1.3     skrll     int attr, uint64_t data)
     94  1.3     skrll {
     95  1.3     skrll 	if (!pc->pc_intr_setattr)
     96  1.3     skrll 		return ENODEV;
     97  1.3     skrll 	return pc->pc_intr_setattr(pc, ihp, attr, data);
     98  1.3     skrll }
     99  1.3     skrll 
    100  1.1     skrll #define	pciide_machdep_compat_intr_establish(a, b, c, d, e)	(NULL)
    101  1.1     skrll #define	pciide_machdep_compat_intr_disestablish(a, b)	((void)(a), (void)(b))
    102  1.1     skrll 
    103  1.1     skrll #define	pci_intr_evcnt(a, b) (NULL)
    104  1.1     skrll 
    105  1.1     skrll #endif /* _MACHINE_PCI_MACHDEP_H_ */
    106