xref: /netbsd-src/sys/dev/marvell/gtpcivar.h (revision a8140c3a4987b851e039c83d6b8d7fd7e35f0a91)
1*a8140c3aSmatt /*	$NetBSD: gtpcivar.h,v 1.11 2012/09/07 04:25:37 matt Exp $	*/
2ff2281b4Smatt /*
3a748aedcSkiyohara  * Copyright (c) 2008 KIYOHARA Takashi
4ff2281b4Smatt  * All rights reserved.
5ff2281b4Smatt  *
6ff2281b4Smatt  * Redistribution and use in source and binary forms, with or without
7ff2281b4Smatt  * modification, are permitted provided that the following conditions
8ff2281b4Smatt  * are met:
9ff2281b4Smatt  * 1. Redistributions of source code must retain the above copyright
10ff2281b4Smatt  *    notice, this list of conditions and the following disclaimer.
11ff2281b4Smatt  * 2. Redistributions in binary form must reproduce the above copyright
12ff2281b4Smatt  *    notice, this list of conditions and the following disclaimer in the
13ff2281b4Smatt  *    documentation and/or other materials provided with the distribution.
14ff2281b4Smatt  *
15a748aedcSkiyohara  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16a748aedcSkiyohara  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17a748aedcSkiyohara  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18a748aedcSkiyohara  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19a748aedcSkiyohara  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20a748aedcSkiyohara  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21a748aedcSkiyohara  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22a748aedcSkiyohara  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23a748aedcSkiyohara  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24a748aedcSkiyohara  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25ff2281b4Smatt  * POSSIBILITY OF SUCH DAMAGE.
26ff2281b4Smatt  */
27ff2281b4Smatt 
28a748aedcSkiyohara #ifndef	_GTPCIVAR_H_
29a748aedcSkiyohara #define	_GTPCIVAR_H_
30ff2281b4Smatt 
31a748aedcSkiyohara struct gtpci_softc {
32a748aedcSkiyohara 	device_t sc_dev;
33a748aedcSkiyohara 	int sc_model;
34a748aedcSkiyohara 	int sc_rev;
35a748aedcSkiyohara 	int sc_unit;
36a748aedcSkiyohara 
37a748aedcSkiyohara 	bus_space_tag_t sc_iot;
38a748aedcSkiyohara 	bus_space_handle_t sc_ioh;
39a748aedcSkiyohara 	pci_chipset_tag_t sc_pc;
4008ea2a49Smatt };
41ff2281b4Smatt 
42742d392dSkiyohara /* protection flags */
43742d392dSkiyohara struct gtpci_prot {
44742d392dSkiyohara 	uint32_t acbl_flags;
45742d392dSkiyohara 	uint32_t acs_flags;
46742d392dSkiyohara };
47742d392dSkiyohara 
48a748aedcSkiyohara #if NPCI > 0
49a748aedcSkiyohara void gtpci_attach_hook(device_t, device_t, struct pcibus_attach_args *);
50a748aedcSkiyohara int gtpci_bus_maxdevs(void *, int);
51a748aedcSkiyohara pcitag_t gtpci_make_tag(void *, int, int, int);
52a748aedcSkiyohara void gtpci_decompose_tag(void *, pcitag_t, int *, int *, int *);
53a748aedcSkiyohara pcireg_t gtpci_conf_read(void *, pcitag_t, int);
54a748aedcSkiyohara void gtpci_conf_write(void *, pcitag_t, int, pcireg_t);
55*a8140c3aSmatt int gtpci_conf_hook(void *, int, int, int, pcireg_t);
56*a8140c3aSmatt void gtpci_conf_interrupt(void *, int, int, int, int, int *);
57a748aedcSkiyohara int gtpci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
58a748aedcSkiyohara const char *gtpci_intr_string(void *, pci_intr_handle_t);
59a748aedcSkiyohara const struct evcnt *gtpci_intr_evcnt(void *, pci_intr_handle_t);
60a748aedcSkiyohara void *gtpci_intr_establish(void *, pci_intr_handle_t, int, int (*)(void *),
61a748aedcSkiyohara 			   void *);
62a748aedcSkiyohara void gtpci_intr_disestablish(void *, void *);
63a748aedcSkiyohara #endif
6408ea2a49Smatt 
65a748aedcSkiyohara #endif	/* _GTPCIVAR_H_ */
66