Home | History | Annotate | Line # | Download | only in include
pci_machdep.h revision 1.1
      1  1.1  rkujawa /*	$NetBSD: pci_machdep.h,v 1.1 2011/08/04 17:48:51 rkujawa Exp $ */
      2  1.1  rkujawa 
      3  1.1  rkujawa /*-
      4  1.1  rkujawa  * Copyright (c) 2011 The NetBSD Foundation, Inc.
      5  1.1  rkujawa  * All rights reserved.
      6  1.1  rkujawa  *
      7  1.1  rkujawa  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  rkujawa  * by Radoslaw Kujawa.
      9  1.1  rkujawa  *
     10  1.1  rkujawa  * Redistribution and use in source and binary forms, with or without
     11  1.1  rkujawa  * modification, are permitted provided that the following conditions
     12  1.1  rkujawa  * are met:
     13  1.1  rkujawa  * 1. Redistributions of source code must retain the above copyright
     14  1.1  rkujawa  *    notice, this list of conditions and the following disclaimer.
     15  1.1  rkujawa  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  rkujawa  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  rkujawa  *    documentation and/or other materials provided with the distribution.
     18  1.1  rkujawa  *
     19  1.1  rkujawa  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  1.1  rkujawa  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.1  rkujawa  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.1  rkujawa  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  1.1  rkujawa  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.1  rkujawa  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.1  rkujawa  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.1  rkujawa  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.1  rkujawa  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.1  rkujawa  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.1  rkujawa  * POSSIBILITY OF SUCH DAMAGE.
     30  1.1  rkujawa  */
     31  1.1  rkujawa 
     32  1.1  rkujawa #ifndef _AMIGA_PCI_MACHDEP_H_
     33  1.1  rkujawa #define _AMIGA_PCI_MACHDEP_H_
     34  1.1  rkujawa 
     35  1.1  rkujawa #include <sys/bus.h>
     36  1.1  rkujawa 
     37  1.1  rkujawa #include <machine/intr.h>
     38  1.1  rkujawa 
     39  1.1  rkujawa #include <m68k/bus_dma.h>
     40  1.1  rkujawa 
     41  1.1  rkujawa /*
     42  1.1  rkujawa  * Forward declarations.
     43  1.1  rkujawa  */
     44  1.1  rkujawa struct pci_attach_args;
     45  1.1  rkujawa 
     46  1.1  rkujawa /*
     47  1.1  rkujawa  * Types provided to machine-independent PCI code
     48  1.1  rkujawa  */
     49  1.1  rkujawa typedef struct	amiga_pci_chipset *pci_chipset_tag_t;
     50  1.1  rkujawa typedef u_long	pcitag_t;
     51  1.1  rkujawa typedef u_long	pci_intr_handle_t;
     52  1.1  rkujawa 
     53  1.1  rkujawa /*
     54  1.1  rkujawa  * amiga-specific PCI structure and type definitions.
     55  1.1  rkujawa  * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
     56  1.1  rkujawa  */
     57  1.1  rkujawa struct amiga_pci_chipset {
     58  1.1  rkujawa 	void		*pc_conf_v;
     59  1.1  rkujawa 	void		(*pc_attach_hook)(device_t, device_t,
     60  1.1  rkujawa 			    struct pcibus_attach_args *);
     61  1.1  rkujawa 	int		(*pc_bus_maxdevs)(pci_chipset_tag_t, int);
     62  1.1  rkujawa 	pcitag_t	(*pc_make_tag)(pci_chipset_tag_t, int, int, int);
     63  1.1  rkujawa 	void		(*pc_decompose_tag)(pci_chipset_tag_t, pcitag_t, int *,
     64  1.1  rkujawa 			    int *, int *);
     65  1.1  rkujawa 			pcireg_t(*pc_conf_read)(pci_chipset_tag_t, pcitag_t,
     66  1.1  rkujawa 			    int);
     67  1.1  rkujawa 	void		(*pc_conf_write)(pci_chipset_tag_t, pcitag_t, int,
     68  1.1  rkujawa 			    pcireg_t);
     69  1.1  rkujawa 	int		(*pc_intr_map)(const struct pci_attach_args *,
     70  1.1  rkujawa 			    pci_intr_handle_t *);
     71  1.1  rkujawa 	const char	*(*pc_intr_string)(pci_chipset_tag_t,
     72  1.1  rkujawa 			    pci_intr_handle_t);
     73  1.1  rkujawa 	void		*(*pc_intr_establish)(pci_chipset_tag_t,
     74  1.1  rkujawa 			    pci_intr_handle_t, int, int (*) (void *), void *);
     75  1.1  rkujawa 	void		(*pc_intr_disestablish)(pci_chipset_tag_t, void *);
     76  1.1  rkujawa 	void		(*pc_conf_interrupt)(pci_chipset_tag_t, int, int, int,
     77  1.1  rkujawa 			    int, int *);
     78  1.1  rkujawa 	int		(*pc_conf_hook)(pci_chipset_tag_t, int, int, int,
     79  1.1  rkujawa 			    pcireg_t);
     80  1.1  rkujawa 
     81  1.1  rkujawa 	bus_space_tag_t pci_conf_iot;
     82  1.1  rkujawa 	bus_space_handle_t pci_conf_ioh;
     83  1.1  rkujawa };
     84  1.1  rkujawa 
     85  1.1  rkujawa 
     86  1.1  rkujawa /*
     87  1.1  rkujawa  * Functions provided to machine-independent PCI code.
     88  1.1  rkujawa  */
     89  1.1  rkujawa #define	pci_attach_hook(p, s, pba)					\
     90  1.1  rkujawa 	(*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
     91  1.1  rkujawa #define	pci_bus_maxdevs(c, b)						\
     92  1.1  rkujawa 	(*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
     93  1.1  rkujawa #define	pci_make_tag(c, b, d, f)					\
     94  1.1  rkujawa 	(*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
     95  1.1  rkujawa #define	pci_decompose_tag(c, t, bp, dp, fp)				\
     96  1.1  rkujawa 	(*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
     97  1.1  rkujawa #define	pci_conf_read(c, t, r)						\
     98  1.1  rkujawa 	(*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
     99  1.1  rkujawa #define	pci_conf_write(c, t, r, v)					\
    100  1.1  rkujawa 	(*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
    101  1.1  rkujawa #define	pci_intr_map(pa, ihp)						\
    102  1.1  rkujawa 	(*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
    103  1.1  rkujawa #define	pci_intr_string(c, ih)						\
    104  1.1  rkujawa 	(*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
    105  1.1  rkujawa #define	pci_intr_evcnt(c, ih)						\
    106  1.1  rkujawa 	(*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih))
    107  1.1  rkujawa #define	pci_intr_establish(c, ih, l, h, a)				\
    108  1.1  rkujawa 	(*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
    109  1.1  rkujawa #define	pci_intr_disestablish(c, iv)					\
    110  1.1  rkujawa 	(*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
    111  1.1  rkujawa 
    112  1.1  rkujawa #endif
    113