schizovar.h revision 1.5 1 /* $NetBSD: schizovar.h,v 1.5 2011/06/03 02:58:07 christos Exp $ */
2 /* $OpenBSD: schizovar.h,v 1.10 2007/01/14 16:19:49 kettenis Exp $ */
3
4 /*
5 * Copyright (c) 2002 Jason L. Wright (jason (at) thought.net)
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 struct schizo_pbm {
31 struct schizo_softc *sp_sc;
32
33 struct schizo_range *sp_range;
34 pci_chipset_tag_t sp_pc;
35 int sp_nreg;
36 int sp_nrange;
37 int sp_nintmap;
38
39 bus_space_tag_t sp_memt;
40 bus_space_tag_t sp_iot;
41 bus_space_tag_t sp_regt;
42 bus_space_handle_t sp_regh;
43 bus_space_handle_t sp_intrh;
44 bus_space_tag_t sp_cfgt;
45 bus_space_handle_t sp_cfgh;
46 bus_dma_tag_t sp_dmat;
47 int sp_bus;
48 int sp_flags;
49 int sp_bus_a;
50 struct iommu_state sp_is;
51 struct strbuf_ctl sp_sb;
52 char sp_flush[0x80];
53 };
54
55 struct schizo_softc {
56 device_t sc_dev;
57 int sc_node;
58 int sc_ign;
59 bus_dma_tag_t sc_dmat;
60 bus_space_tag_t sc_bustag;
61 bus_space_handle_t sc_ctrlh;
62 bus_space_handle_t sc_confh;
63
64 int sc_busa;
65 int sc_tomatillo;
66 };
67
68 #define schizo_read(sc,r) \
69 bus_space_read_8((sc)->sc_bustag, (sc)->sc_ctrlh, (r))
70 #define schizo_write(sc,r,v) \
71 bus_space_write_8((sc)->sc_bustag, (sc)->sc_ctrlh, (r), (v))
72 #define schizo_pbm_read(pbm,r) \
73 bus_space_read_8((pbm)->sp_regt, (pbm)->sp_regh, (r))
74 #define schizo_pbm_write(pbm,r,v) \
75 bus_space_write_8((pbm)->sp_regt, (pbm)->sp_regh, (r), (v))
76 #define schizo_pbm_readintr(pbm,r) \
77 bus_space_read_8((pbm)->sp_regt, (pbm)->sp_intrh, (r))
78 #define schizo_pbm_writeintr(pbm,r,v) \
79 bus_space_write_8((pbm)->sp_regt, (pbm)->sp_intrh, (r), (v))
80 #define schizo_cfg_read(pbm,r) \
81 bus_space_read_4((pbm)->sp_cfgt, (pbm)->sp_cfgh, (r))
82 #define schizo_cfg_write(pbm,r,v) \
83 bus_space_write_4((pbm)->sp_cfgt, (pbm)->sp_cfgh, (r), (v))
84