Deleted Added
full compact
bus.h (58884) bus.h (59093)
1/*-
2 * Copyright (c) 1997,1998 Doug Rabson
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 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1997,1998 Doug Rabson
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 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/sys/bus.h 58884 2000-04-01 06:06:37Z imp $
26 * $FreeBSD: head/sys/sys/bus.h 59093 2000-04-08 14:17:18Z dfr $
27 */
28
29#ifndef _SYS_BUS_H_
30#define _SYS_BUS_H_
31
32#ifdef _KERNEL
33
34#include <sys/queue.h>
27 */
28
29#ifndef _SYS_BUS_H_
30#define _SYS_BUS_H_
31
32#ifdef _KERNEL
33
34#include <sys/queue.h>
35#include <sys/kobj.h>
35
36/*
37 * Forward declarations
38 */
39typedef struct device *device_t;
40typedef struct driver driver_t;
36
37/*
38 * Forward declarations
39 */
40typedef struct device *device_t;
41typedef struct driver driver_t;
41typedef struct device_method device_method_t;
42typedef struct devclass *devclass_t;
42typedef struct devclass *devclass_t;
43typedef struct device_ops *device_ops_t;
44typedef struct device_op_desc *device_op_desc_t;
43#define device_method_t kobj_method_t
45
46typedef void driver_intr_t(void*);
47
48/*
49 * We define this in terms of bits because some devices may belong
50 * to multiple classes (and therefore need to be included in
51 * multiple interrupt masks, which is what this really serves to
52 * indicate. Buses which do interrupt remapping will want to

--- 5 unchanged lines hidden (view full) ---

58 INTR_TYPE_NET = 4,
59 INTR_TYPE_CAM = 8,
60 INTR_TYPE_MISC = 16,
61 INTR_TYPE_FAST = 128
62};
63
64typedef int (*devop_t)(void);
65
44
45typedef void driver_intr_t(void*);
46
47/*
48 * We define this in terms of bits because some devices may belong
49 * to multiple classes (and therefore need to be included in
50 * multiple interrupt masks, which is what this really serves to
51 * indicate. Buses which do interrupt remapping will want to

--- 5 unchanged lines hidden (view full) ---

57 INTR_TYPE_NET = 4,
58 INTR_TYPE_CAM = 8,
59 INTR_TYPE_MISC = 16,
60 INTR_TYPE_FAST = 128
61};
62
63typedef int (*devop_t)(void);
64
66struct device_method {
67 device_op_desc_t desc;
68 devop_t func;
69};
70
71struct driver {
65struct driver {
72 const char *name; /* driver name */
73 device_method_t *methods; /* method table */
74 size_t softc; /* size of device softc struct */
66 KOBJ_CLASS_FIELDS;
75 void *priv; /* driver private data */
67 void *priv; /* driver private data */
76 device_ops_t ops; /* compiled method table */
77 int refs; /* # devclasses containing driver */
78};
79
80typedef enum device_state {
81 DS_NOTPRESENT, /* not probed or probe failed */
82 DS_ALIVE, /* probe succeeded */
83 DS_ATTACHED, /* attach method called */
84 DS_BUSY /* device is open */

--- 211 unchanged lines hidden (view full) ---

296 long value);
297int resource_set_string(const char *name, int unit, const char *resname,
298 const char *value);
299int resource_count(void);
300
301/*
302 * Shorthand for constructing method tables.
303 */
68 int refs; /* # devclasses containing driver */
69};
70
71typedef enum device_state {
72 DS_NOTPRESENT, /* not probed or probe failed */
73 DS_ALIVE, /* probe succeeded */
74 DS_ATTACHED, /* attach method called */
75 DS_BUSY /* device is open */

--- 211 unchanged lines hidden (view full) ---

287 long value);
288int resource_set_string(const char *name, int unit, const char *resname,
289 const char *value);
290int resource_count(void);
291
292/*
293 * Shorthand for constructing method tables.
294 */
304#define DEVMETHOD(NAME, FUNC) { &NAME##_desc, (devop_t) FUNC }
295#define DEVMETHOD KOBJMETHOD
305
306/*
307 * Some common device interfaces.
308 */
309#include "device_if.h"
310#include "bus_if.h"
311
312struct module;

--- 58 unchanged lines hidden ---
296
297/*
298 * Some common device interfaces.
299 */
300#include "device_if.h"
301#include "bus_if.h"
302
303struct module;

--- 58 unchanged lines hidden ---