1/*	$OpenBSD: schizovar.h,v 1.10 2007/01/14 16:19:49 kettenis Exp $	*/
2
3/*
4 * Copyright (c) 2002 Jason L. Wright (jason@thought.net)
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 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
20 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29struct schizo_pbm {
30	struct schizo_softc *sp_sc;
31
32	struct schizo_range *sp_range;
33	pci_chipset_tag_t sp_pc;
34	int sp_nreg;
35	int sp_nrange;
36	int sp_nintmap;
37
38	bus_space_tag_t		sp_memt;
39	bus_space_tag_t		sp_iot;
40	bus_space_tag_t		sp_regt;
41	bus_space_handle_t	sp_regh;
42	bus_space_tag_t		sp_cfgt;
43	bus_space_handle_t	sp_cfgh;
44	bus_dma_tag_t		sp_dmat;
45	int			sp_bus;
46	int			sp_flags;
47	int			sp_bus_a;
48	bus_addr_t		sp_confpaddr;
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_bust;
60	bus_addr_t sc_ctrl;
61	bus_space_handle_t sc_ctrlh;
62
63	int sc_tomatillo;
64};
65
66#define	schizo_read(sc,r) \
67    bus_space_read_8((sc)->sc_bust, (sc)->sc_ctrlh, (r))
68#define	schizo_write(sc,r,v) \
69    bus_space_write_8((sc)->sc_bust, (sc)->sc_ctrlh, (r), (v))
70#define	schizo_pbm_read(pbm,r) \
71    bus_space_read_8((pbm)->sp_regt, (pbm)->sp_regh, (r))
72#define	schizo_pbm_write(pbm,r,v) \
73    bus_space_write_8((pbm)->sp_regt, (pbm)->sp_regh, (r), (v))
74#define	schizo_cfg_read(pbm,r) \
75    bus_space_read_4((pbm)->sp_cfgt, (pbm)->sp_cfgh, (r))
76#define	schizo_cfg_write(pbm,r,v) \
77    bus_space_write_4((pbm)->sp_cfgt, (pbm)->sp_cfgh, (r), (v))
78