1/* $OpenBSD: armv7var.h,v 1.18 2021/04/02 03:02:46 tb Exp $ */
2/*
3 * Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.org>
4 * Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#ifndef __ARMV7VAR_H__
20#define __ARMV7VAR_H__
21
22extern struct bus_space armv7_bs_tag;
23
24/* Boards device list */
25struct board_dev {
26	char	*name;
27	int	unit;
28};
29
30/* Needed by omap */
31struct armv7_softc {
32	struct device sc_dv;
33
34	struct board_dev *sc_board_devs;
35};
36
37/* Physical memory range for on-chip devices. */
38
39struct armv7mem {
40	bus_addr_t	addr;
41	bus_size_t	size;
42};
43
44#define ARMV7_DEV_NMEM 6
45#define ARMV7_DEV_NIRQ 4
46#define ARMV7_DEV_NDMA 4
47
48/* Descriptor for all on-chip devices. */
49struct armv7_dev {
50	char	*name;			/* driver name or made up name */
51	int	unit;			/* driver instance number or -1 */
52	struct	armv7mem mem[ARMV7_DEV_NMEM]; /* memory ranges */
53	int	irq[ARMV7_DEV_NIRQ];	/* IRQ number(s) */
54	int	dma[ARMV7_DEV_NDMA];	/* DMA chan number(s) */
55};
56
57/* Passed as third arg to attach functions. */
58struct armv7_attach_args {
59	struct armv7_dev	*aa_dev;
60	bus_space_tag_t		aa_iot;
61	bus_dma_tag_t		aa_dmat;
62};
63
64extern struct armv7_dev *armv7_devs;
65
66void	armv7_set_devs(struct armv7_dev *);
67struct	armv7_dev *armv7_find_dev(const char *, int);
68void	armv7_attach(struct device *, struct device *, void *);
69int	armv7_submatch(struct device *, void *, void *);
70
71#endif /* __ARMV7VAR_H__ */
72
73