schizovar.h revision 1.3
1/*	$NetBSD: schizovar.h,v 1.3 2008/12/13 08:07:23 mrg 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@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
30struct 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_tag_t		sp_cfgt;
44	bus_space_handle_t	sp_cfgh;
45	bus_dma_tag_t		sp_dmat;
46	int			sp_bus;
47	int			sp_flags;
48	int			sp_bus_a;
49	struct iommu_state	sp_is;
50	struct strbuf_ctl	sp_sb;
51	char			sp_flush[0x80];
52};
53
54struct schizo_softc {
55	struct device sc_dv;
56	int sc_node;
57	int sc_ign;
58	bus_dma_tag_t sc_dmat;
59	bus_space_tag_t sc_bustag;
60	bus_addr_t sc_ctrl;
61	bus_space_handle_t sc_ctrlh;
62	bus_space_handle_t sc_confh;
63	struct upa_reg sc_reg0;
64
65	int sc_busa;
66	int sc_tomatillo;
67};
68
69#define	schizo_read(sc,r) \
70    bus_space_read_8((sc)->sc_bustag, (sc)->sc_ctrlh, (r))
71#define	schizo_write(sc,r,v) \
72    bus_space_write_8((sc)->sc_bustag, (sc)->sc_ctrlh, (r), (v))
73#define	schizo_pbm_read(pbm,r) \
74    bus_space_read_8((pbm)->sp_regt, (pbm)->sp_regh, (r))
75#define	schizo_pbm_write(pbm,r,v) \
76    bus_space_write_8((pbm)->sp_regt, (pbm)->sp_regh, (r), (v))
77#define	schizo_cfg_read(pbm,r) \
78    bus_space_read_4((pbm)->sp_cfgt, (pbm)->sp_cfgh, (r))
79#define	schizo_cfg_write(pbm,r,v) \
80    bus_space_write_4((pbm)->sp_cfgt, (pbm)->sp_cfgh, (r), (v))
81