_bus.h revision 145253
1/*-
2 * Copyright (c) 2005 M. Warner Losh.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions, and the following disclaimer,
10 *    without modification, immediately at the beginning of the file.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in
13 *    the documentation and/or other materials provided with the
14 *    distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/pc98/include/_bus.h 145253 2005-04-18 21:45:34Z imp $
29 */
30
31#ifndef PC98_INCLUDE__BUS_H
32#define PC98_INCLUDE__BUS_H
33
34/*
35 * Bus address and size types
36 */
37typedef u_int bus_addr_t;
38typedef u_int bus_size_t;
39
40/*
41 * Access methods for bus resources and address space.
42 */
43struct bus_space_tag {
44#define	BUS_SPACE_IO	0
45#define	BUS_SPACE_MEM	1
46	u_int	bs_tag;			/* bus space flags */
47
48	struct bus_space_access_methods bs_da;	/* direct access */
49	struct bus_space_access_methods bs_ra;	/* relocate access */
50#if	0
51	struct bus_space_access_methods bs_ida;	/* indexed direct access */
52#endif
53};
54typedef struct bus_space_tag *bus_space_tag_t;
55
56/*
57 * bus space handle
58 */
59struct bus_space_handle {
60	bus_addr_t	bsh_base;
61	size_t		bsh_sz;
62
63	bus_addr_t	bsh_iat[BUS_SPACE_IAT_MAXSIZE];
64	size_t		bsh_maxiatsz;
65	size_t		bsh_iatsz;
66
67	struct resource	**bsh_res;
68	size_t		bsh_ressz;
69
70	struct bus_space_access_methods bsh_bam;
71};
72typedef struct bus_space_handle *bus_space_handle_t;
73
74#endif /* PC98_INCLUDE__BUS_H */
75