gtpcivar.h revision 1.1 1 /* $NetBSD: gtpcivar.h,v 1.1 2003/03/05 22:08:22 matt Exp $ */
2
3 /*
4 * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed for the NetBSD Project by
18 * Allegro Networks, Inc., and Wasabi Systems, Inc.
19 * 4. The name of Allegro Networks, Inc. may not be used to endorse
20 * or promote products derived from this software without specific prior
21 * written permission.
22 * 5. The name of Wasabi Systems, Inc. may not be used to endorse
23 * or promote products derived from this software without specific prior
24 * written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY ALLEGRO NETWORKS, INC. AND
27 * WASABI SYSTEMS, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
28 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
29 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30 * IN NO EVENT SHALL EITHER ALLEGRO NETWORKS, INC. OR WASABI SYSTEMS, INC.
31 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40 #ifndef _DEV_MARVELL_GTPCIVAR_H
41 #define _DEV_MARVELL_GTPCIVAR_H
42
43 /*
44 */
45
46 static uint32_t __inline
47 gtpci_read(pci_chipset_tag_t pc, bus_size_t reg)
48 {
49 uint32_t rv;
50 (void) gt_read(pc->pc_md.mdpc_gt, pc->pc_md.mdpc_syncreg);
51 rv = gt_read(pc->pc_md.mdpc_gt, reg);
52 (void) gt_read(pc->pc_md.mdpc_gt, pc->pc_md.mdpc_syncreg);
53 return rv;
54 }
55
56 static void __inline
57 gtpci_write(pci_chipset_tag_t pc, bus_size_t reg, uint32_t val)
58 {
59 (void) gt_read(pc->pc_md.mdpc_gt, pc->pc_md.mdpc_syncreg);
60 gt_write(pc->pc_md.mdpc_gt, reg, val);
61 (void) gt_read(pc->pc_md.mdpc_gt, pc->pc_md.mdpc_syncreg);
62 }
63
64 pcitag_t gtpci_make_tag(pci_chipset_tag_t, int, int, int);
65 void gtpci_decompose_tag(pci_chipset_tag_t, pcitag_t, int *, int *, int *);
66 pcireg_t gtpci_conf_read(pci_chipset_tag_t, pcitag_t, int);
67 void gtpci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
68
69 void gtpci_md_bus_devorder(pci_chipset_tag_t, int, char []);
70 int gtpci_md_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
71 int gtpci_md_conf_hook(pci_chipset_tag_t, int, int, int, pcireg_t);
72 void gtpci_md_conf_interrupt(pci_chipset_tag_t, int, int, int, int, int *);
73
74 #endif /* _DEV_MARVELL_GTPCIVAR_H */
75