1/*
2 * Copyright 2009, Colin G��nther, coling@gmx.de. All Rights Reserved.
3 * Copyright 2007, Axel D��rfler, axeld@pinc-software.de. All Rights Reserved.
4 * Copyright 2007, Hugo Santos. All Rights Reserved.
5 * Copyright 2004, Marcus Overhagen. All Rights Reserved.
6 * Distributed under the terms of the MIT License.
7 */
8#ifndef SHARED_H_
9#define SHARED_H_
10
11
12#include <sys/bus.h>
13
14
15#define MAX_DEVICES	8
16
17
18struct ifnet;
19
20struct device {
21	struct device	*parent;
22	struct device	*root;
23
24	driver_t		*driver;
25	struct list		children;
26
27	uint32			flags;
28
29	char			device_name[128];
30	int				unit;
31	char			nameunit[64];
32	const char		*description;
33	void			*softc;
34	void			*ivars;
35
36	struct {
37		void* (*device_register)(device_t dev);
38		int (*probe)(device_t dev);
39		int (*attach)(device_t dev);
40		int (*detach)(device_t dev);
41		int (*suspend)(device_t dev);
42		int (*resume)(device_t dev);
43		void (*shutdown)(device_t dev);
44
45		int (*miibus_readreg)(device_t, int, int);
46		int (*miibus_writereg)(device_t, int, int, int);
47		void (*miibus_statchg)(device_t);
48		void (*miibus_linkchg)(device_t);
49		void (*miibus_mediainit)(device_t);
50
51		int (*bus_child_location_str)(device_t dev __unused, device_t child,
52			char *buf, size_t buflen);
53		int (*bus_child_pnpinfo_str)(device_t dev __unused, device_t child,
54			char *buf, size_t buflen);
55		void (*bus_hinted_child)(device_t dev, const char *name, int unit);
56		int (*bus_print_child)(device_t dev, device_t child);
57		int (*bus_read_ivar)(device_t dev, device_t child __unused, int which,
58		    uintptr_t *result);
59		bus_dma_tag_t (*bus_get_dma_tag)(device_t dev);
60	} methods;
61
62	struct list_link link;
63};
64
65
66extern const char *gDeviceNameList[];
67extern struct ifnet *gDevices[];
68extern int32 gDeviceCount;
69
70#endif /* SHARED_H_ */
71