No empty .Rs/.Re
[netbsd-mini2440.git] / sys / dev / marvell / gtpcivar.h
blob157a119f3f2ca82fbdb349329bc26e8bbe8ad246
1 /* $NetBSD: gtpcivar.h,v 1.7 2006/02/16 20:17:19 perry Exp $ */
3 /*
4 * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
5 * All rights reserved.
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.
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.
40 #ifndef _DEV_MARVELL_GTPCIVAR_H
41 #define _DEV_MARVELL_GTPCIVAR_H
45 struct gtpci_chipset {
46 struct pci_chipset gtpc_pc;
47 int gtpc_busno;
48 pcitag_t gtpc_self;
49 bus_space_tag_t gtpc_io_bs;
50 bus_space_tag_t gtpc_mem_bs;
51 bus_space_tag_t gtpc_gt_memt;
52 bus_space_handle_t gtpc_gt_memh;
53 bus_size_t gtpc_cfgaddr;
54 bus_size_t gtpc_cfgdata;
55 bus_size_t gtpc_syncreg;
56 bool gtpc_host;
60 #ifdef _KERNEL
61 static uint32_t __inline
62 gtpci_read(struct gtpci_chipset *gtpc, bus_size_t reg)
64 uint32_t rv;
65 (void) bus_space_read_4(gtpc->gtpc_gt_memt, gtpc->gtpc_gt_memh,
66 gtpc->gtpc_syncreg);
67 rv = bus_space_read_4(gtpc->gtpc_gt_memt, gtpc->gtpc_gt_memh, reg);
68 (void) bus_space_read_4(gtpc->gtpc_gt_memt, gtpc->gtpc_gt_memh,
69 gtpc->gtpc_syncreg);
70 return rv;
73 static void __inline
74 gtpci_write(struct gtpci_chipset *gtpc, bus_size_t reg, uint32_t val)
76 (void) bus_space_read_4(gtpc->gtpc_gt_memt, gtpc->gtpc_gt_memh,
77 gtpc->gtpc_syncreg);
78 bus_space_write_4(gtpc->gtpc_gt_memt, gtpc->gtpc_gt_memh, reg, val);
79 (void) bus_space_read_4(gtpc->gtpc_gt_memt, gtpc->gtpc_gt_memh,
80 gtpc->gtpc_syncreg);
83 void gtpci_bus_configure(struct gtpci_chipset *);
85 pcitag_t gtpci_make_tag(pci_chipset_tag_t, int, int, int);
86 void gtpci_decompose_tag(pci_chipset_tag_t, pcitag_t, int *, int *, int *);
87 pcireg_t gtpci_conf_read(pci_chipset_tag_t, pcitag_t, int);
88 void gtpci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
90 void gtpci_md_bus_devorder(pci_chipset_tag_t, int, char []);
91 int gtpci_md_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
92 int gtpci_md_conf_hook(pci_chipset_tag_t, int, int, int, pcireg_t);
93 void gtpci_md_conf_interrupt(pci_chipset_tag_t, int, int, int, int, int *);
94 #endif /* _KERNEL */
96 #endif /* _DEV_MARVELL_GTPCIVAR_H */