]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/sys/bus.h
This commit was generated by cvs2svn to compensate for changes in r161561,
[FreeBSD/FreeBSD.git] / sys / sys / bus.h
1 /*-
2  * Copyright (c) 1997,1998,2003 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  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
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$
27  */
28
29 #ifndef _SYS_BUS_H_
30 #define _SYS_BUS_H_
31
32 /**
33  * @defgroup NEWBUS newbus - a generic framework for managing devices
34  * @{
35  */
36
37 /**
38  * @brief Interface information structure.
39  */
40 struct u_businfo {
41         int     ub_version;             /**< @brief interface version */
42 #define BUS_USER_VERSION        1
43         int     ub_generation;          /**< @brief generation count */
44 };
45
46 /**
47  * @brief State of the device.
48  */
49 typedef enum device_state {
50         DS_NOTPRESENT,                  /**< @brief not probed or probe failed */
51         DS_ALIVE,                       /**< @brief probe succeeded */
52         DS_ATTACHED,                    /**< @brief attach method called */
53         DS_BUSY                         /**< @brief device is open */
54 } device_state_t;
55
56 /**
57  * @brief Device information exported to userspace.
58  */
59 struct u_device {
60         uintptr_t       dv_handle;
61         uintptr_t       dv_parent;
62
63         char            dv_name[32];            /**< @brief Name of device in tree. */
64         char            dv_desc[32];            /**< @brief Driver description */
65         char            dv_drivername[32];      /**< @brief Driver name */
66         char            dv_pnpinfo[128];        /**< @brief Plug and play info */
67         char            dv_location[128];       /**< @brief Where is the device? */
68         uint32_t        dv_devflags;            /**< @brief API Flags for device */
69         uint16_t        dv_flags;               /**< @brief flags for dev date */
70         device_state_t  dv_state;               /**< @brief State of attachment */
71         /* XXX more driver info? */
72 };
73
74 #ifdef _KERNEL
75
76 #include <sys/queue.h>
77 #include <sys/kobj.h>
78
79 /**
80  * devctl hooks.  Typically one should use the devctl_notify
81  * hook to send the message.  However, devctl_queue_data is also
82  * included in case devctl_notify isn't sufficiently general.
83  */
84 void devctl_notify(const char *__system, const char *__subsystem,
85     const char *__type, const char *__data);
86 void devctl_queue_data(char *__data);
87
88 /**
89  * @brief A device driver (included mainly for compatibility with
90  * FreeBSD 4.x).
91  */
92 typedef struct kobj_class       driver_t;
93
94 /**
95  * @brief A device class
96  *
97  * The devclass object has two main functions in the system. The first
98  * is to manage the allocation of unit numbers for device instances
99  * and the second is to hold the list of device drivers for a
100  * particular bus type. Each devclass has a name and there cannot be
101  * two devclasses with the same name. This ensures that unique unit
102  * numbers are allocated to device instances.
103  *
104  * Drivers that support several different bus attachments (e.g. isa,
105  * pci, pccard) should all use the same devclass to ensure that unit
106  * numbers do not conflict.
107  *
108  * Each devclass may also have a parent devclass. This is used when
109  * searching for device drivers to allow a form of inheritance. When
110  * matching drivers with devices, first the driver list of the parent
111  * device's devclass is searched. If no driver is found in that list,
112  * the search continues in the parent devclass (if any).
113  */
114 typedef struct devclass         *devclass_t;
115
116 /**
117  * @brief A device method (included mainly for compatibility with
118  * FreeBSD 4.x).
119  */
120 #define device_method_t         kobj_method_t
121
122 /**
123  * @brief A driver interrupt service routine
124  */
125 typedef void driver_intr_t(void*);
126
127 /**
128  * @brief Interrupt type bits.
129  * 
130  * These flags are used both by newbus interrupt
131  * registration (nexus.c) and also in struct intrec, which defines
132  * interrupt properties.
133  *
134  * XXX We should probably revisit this and remove the vestiges of the
135  * spls implicit in names like INTR_TYPE_TTY. In the meantime, don't
136  * confuse things by renaming them (Grog, 18 July 2000).
137  *
138  * We define this in terms of bits because some devices may belong
139  * to multiple classes (and therefore need to be included in
140  * multiple interrupt masks, which is what this really serves to
141  * indicate. Buses which do interrupt remapping will want to
142  * change their type to reflect what sort of devices are underneath.
143  */
144 enum intr_type {
145         INTR_TYPE_TTY = 1,
146         INTR_TYPE_BIO = 2,
147         INTR_TYPE_NET = 4,
148         INTR_TYPE_CAM = 8,
149         INTR_TYPE_MISC = 16,
150         INTR_TYPE_CLK = 32,
151         INTR_TYPE_AV = 64,
152         INTR_FAST = 128,
153         INTR_EXCL = 256,                /* exclusive interrupt */
154         INTR_MPSAFE = 512,              /* this interrupt is SMP safe */
155         INTR_ENTROPY = 1024             /* this interrupt provides entropy */
156 };
157
158 enum intr_trigger {
159         INTR_TRIGGER_CONFORM = 0,
160         INTR_TRIGGER_EDGE = 1,
161         INTR_TRIGGER_LEVEL = 2
162 };
163
164 enum intr_polarity {
165         INTR_POLARITY_CONFORM = 0,
166         INTR_POLARITY_HIGH = 1,
167         INTR_POLARITY_LOW = 2
168 };
169
170 typedef int (*devop_t)(void);
171
172 /**
173  * @brief This structure is deprecated.
174  *
175  * Use the kobj(9) macro DEFINE_CLASS to
176  * declare classes which implement device drivers.
177  */
178 struct driver {
179         KOBJ_CLASS_FIELDS;
180 };
181
182 /*
183  * Definitions for drivers which need to keep simple lists of resources
184  * for their child devices.
185  */
186 struct  resource;
187
188 /**
189  * @brief An entry for a single resource in a resource list.
190  */
191 struct resource_list_entry {
192         STAILQ_ENTRY(resource_list_entry) link;
193         int     type;                   /**< @brief type argument to alloc_resource */
194         int     rid;                    /**< @brief resource identifier */
195         struct  resource *res;          /**< @brief the real resource when allocated */
196         u_long  start;                  /**< @brief start of resource range */
197         u_long  end;                    /**< @brief end of resource range */
198         u_long  count;                  /**< @brief count within range */
199 };
200 STAILQ_HEAD(resource_list, resource_list_entry);
201
202 void    resource_list_init(struct resource_list *rl);
203 void    resource_list_free(struct resource_list *rl);
204 struct resource_list_entry *
205         resource_list_add(struct resource_list *rl,
206                           int type, int rid,
207                           u_long start, u_long end, u_long count);
208 int     resource_list_add_next(struct resource_list *rl,
209                           int type,
210                           u_long start, u_long end, u_long count);
211 struct resource_list_entry*
212         resource_list_find(struct resource_list *rl,
213                            int type, int rid);
214 void    resource_list_delete(struct resource_list *rl,
215                              int type, int rid);
216 struct resource *
217         resource_list_alloc(struct resource_list *rl,
218                             device_t bus, device_t child,
219                             int type, int *rid,
220                             u_long start, u_long end,
221                             u_long count, u_int flags);
222 int     resource_list_release(struct resource_list *rl,
223                               device_t bus, device_t child,
224                               int type, int rid, struct resource *res);
225 void    resource_list_purge(struct resource_list *rl);
226 int     resource_list_print_type(struct resource_list *rl,
227                                  const char *name, int type,
228                                  const char *format);
229
230 /*
231  * The root bus, to which all top-level busses are attached.
232  */
233 extern device_t root_bus;
234 extern devclass_t root_devclass;
235 void    root_bus_configure(void);
236
237 /*
238  * Useful functions for implementing busses.
239  */
240
241 int     bus_generic_activate_resource(device_t dev, device_t child, int type,
242                                       int rid, struct resource *r);
243 struct resource *
244         bus_generic_alloc_resource(device_t bus, device_t child, int type,
245                                    int *rid, u_long start, u_long end,
246                                    u_long count, u_int flags);
247 int     bus_generic_attach(device_t dev);
248 int     bus_generic_child_present(device_t dev, device_t child);
249 int     bus_generic_config_intr(device_t, int, enum intr_trigger,
250                                 enum intr_polarity);
251 int     bus_generic_deactivate_resource(device_t dev, device_t child, int type,
252                                         int rid, struct resource *r);
253 int     bus_generic_detach(device_t dev);
254 void    bus_generic_driver_added(device_t dev, driver_t *driver);
255 struct resource_list *
256         bus_generic_get_resource_list (device_t, device_t);
257 int     bus_print_child_header(device_t dev, device_t child);
258 int     bus_print_child_footer(device_t dev, device_t child);
259 int     bus_generic_print_child(device_t dev, device_t child);
260 int     bus_generic_probe(device_t dev);
261 int     bus_generic_read_ivar(device_t dev, device_t child, int which,
262                               uintptr_t *result);
263 int     bus_generic_release_resource(device_t bus, device_t child,
264                                      int type, int rid, struct resource *r);
265 int     bus_generic_resume(device_t dev);
266 int     bus_generic_setup_intr(device_t dev, device_t child,
267                                struct resource *irq, int flags,
268                                driver_intr_t *intr, void *arg, void **cookiep);
269
270 struct resource *
271         bus_generic_rl_alloc_resource (device_t, device_t, int, int *,
272                                        u_long, u_long, u_long, u_int);
273 void    bus_generic_rl_delete_resource (device_t, device_t, int, int);
274 int     bus_generic_rl_get_resource (device_t, device_t, int, int, u_long *,
275                                      u_long *);
276 int     bus_generic_rl_set_resource (device_t, device_t, int, int, u_long,
277                                      u_long);
278 int     bus_generic_rl_release_resource (device_t, device_t, int, int,
279                                          struct resource *);
280
281 int     bus_generic_shutdown(device_t dev);
282 int     bus_generic_suspend(device_t dev);
283 int     bus_generic_teardown_intr(device_t dev, device_t child,
284                                   struct resource *irq, void *cookie);
285 int     bus_generic_write_ivar(device_t dev, device_t child, int which,
286                                uintptr_t value);
287
288 /*
289  * Wrapper functions for the BUS_*_RESOURCE methods to make client code
290  * a little simpler.
291  */
292
293 struct resource_spec {
294         int     type;
295         int     rid;
296         int     flags;
297 };
298
299 int bus_alloc_resources(device_t dev, struct resource_spec *rs, struct resource **res);
300 void bus_release_resources(device_t dev, const struct resource_spec *rs, struct resource **res);
301
302 struct  resource *bus_alloc_resource(device_t dev, int type, int *rid,
303                                      u_long start, u_long end, u_long count,
304                                      u_int flags);
305 int     bus_activate_resource(device_t dev, int type, int rid,
306                               struct resource *r);
307 int     bus_deactivate_resource(device_t dev, int type, int rid,
308                                 struct resource *r);
309 int     bus_release_resource(device_t dev, int type, int rid,
310                              struct resource *r);
311 int     bus_free_resource(device_t dev, int type, struct resource *r);
312 int     bus_setup_intr(device_t dev, struct resource *r, int flags,
313                        driver_intr_t handler, void *arg, void **cookiep);
314 int     bus_teardown_intr(device_t dev, struct resource *r, void *cookie);
315 int     bus_set_resource(device_t dev, int type, int rid,
316                          u_long start, u_long count);
317 int     bus_get_resource(device_t dev, int type, int rid,
318                          u_long *startp, u_long *countp);
319 u_long  bus_get_resource_start(device_t dev, int type, int rid);
320 u_long  bus_get_resource_count(device_t dev, int type, int rid);
321 void    bus_delete_resource(device_t dev, int type, int rid);
322 int     bus_child_present(device_t child);
323 int     bus_child_pnpinfo_str(device_t child, char *buf, size_t buflen);
324 int     bus_child_location_str(device_t child, char *buf, size_t buflen);
325 void    bus_enumerate_hinted_children(device_t bus);
326
327 static __inline struct resource *
328 bus_alloc_resource_any(device_t dev, int type, int *rid, u_int flags)
329 {
330         return (bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags));
331 }
332
333 /*
334  * Access functions for device.
335  */
336 device_t        device_add_child(device_t dev, const char *name, int unit);
337 device_t        device_add_child_ordered(device_t dev, int order,
338                                          const char *name, int unit);
339 void    device_busy(device_t dev);
340 int     device_delete_child(device_t dev, device_t child);
341 int     device_attach(device_t dev);
342 int     device_detach(device_t dev);
343 void    device_disable(device_t dev);
344 void    device_enable(device_t dev);
345 device_t        device_find_child(device_t dev, const char *classname,
346                                   int unit);
347 const char      *device_get_desc(device_t dev);
348 devclass_t      device_get_devclass(device_t dev);
349 driver_t        *device_get_driver(device_t dev);
350 u_int32_t       device_get_flags(device_t dev);
351 device_t        device_get_parent(device_t dev);
352 int     device_get_children(device_t dev, device_t **listp, int *countp);
353 void    *device_get_ivars(device_t dev);
354 void    device_set_ivars(device_t dev, void *ivars);
355 const   char *device_get_name(device_t dev);
356 const   char *device_get_nameunit(device_t dev);
357 void    *device_get_softc(device_t dev);
358 device_state_t  device_get_state(device_t dev);
359 int     device_get_unit(device_t dev);
360 struct sysctl_ctx_list *device_get_sysctl_ctx(device_t dev);
361 struct sysctl_oid *device_get_sysctl_tree(device_t dev);
362 int     device_is_alive(device_t dev);  /* did probe succeed? */
363 int     device_is_attached(device_t dev);       /* did attach succeed? */
364 int     device_is_enabled(device_t dev);
365 int     device_is_quiet(device_t dev);
366 int     device_print_prettyname(device_t dev);
367 int     device_printf(device_t dev, const char *, ...) __printflike(2, 3);
368 int     device_probe_and_attach(device_t dev);
369 int     device_probe_child(device_t bus, device_t dev);
370 int     device_quiesce(device_t dev);
371 void    device_quiet(device_t dev);
372 void    device_set_desc(device_t dev, const char* desc);
373 void    device_set_desc_copy(device_t dev, const char* desc);
374 int     device_set_devclass(device_t dev, const char *classname);
375 int     device_set_driver(device_t dev, driver_t *driver);
376 void    device_set_flags(device_t dev, u_int32_t flags);
377 void    device_set_softc(device_t dev, void *softc);
378 int     device_set_unit(device_t dev, int unit);        /* XXX DONT USE XXX */
379 int     device_shutdown(device_t dev);
380 void    device_unbusy(device_t dev);
381 void    device_verbose(device_t dev);
382
383 /*
384  * Access functions for devclass.
385  */
386 int     devclass_add_driver(devclass_t dc, kobj_class_t driver);
387 int     devclass_delete_driver(devclass_t dc, kobj_class_t driver);
388 devclass_t      devclass_create(const char *classname);
389 devclass_t      devclass_find(const char *classname);
390 kobj_class_t    devclass_find_driver(devclass_t dc, const char *classname);
391 const char      *devclass_get_name(devclass_t dc);
392 device_t        devclass_get_device(devclass_t dc, int unit);
393 void    *devclass_get_softc(devclass_t dc, int unit);
394 int     devclass_get_devices(devclass_t dc, device_t **listp, int *countp);
395 int     devclass_get_drivers(devclass_t dc, driver_t ***listp, int *countp);
396 int     devclass_get_count(devclass_t dc);
397 int     devclass_get_maxunit(devclass_t dc);
398 int     devclass_find_free_unit(devclass_t dc, int unit);
399 void    devclass_set_parent(devclass_t dc, devclass_t pdc);
400 devclass_t      devclass_get_parent(devclass_t dc);
401 struct sysctl_ctx_list *devclass_get_sysctl_ctx(devclass_t dc);
402 struct sysctl_oid *devclass_get_sysctl_tree(devclass_t dc);
403 int     devclass_quiesce_driver(devclass_t dc, kobj_class_t driver);
404
405 /*
406  * Access functions for device resources.
407  */
408
409 int     resource_int_value(const char *name, int unit, const char *resname,
410                            int *result);
411 int     resource_long_value(const char *name, int unit, const char *resname,
412                             long *result);
413 int     resource_string_value(const char *name, int unit, const char *resname,
414                               const char **result);
415 int     resource_disabled(const char *name, int unit);
416 int     resource_find_match(int *anchor, const char **name, int *unit,
417                             const char *resname, const char *value);
418 int     resource_find_dev(int *anchor, const char *name, int *unit,
419                           const char *resname, const char *value);
420 int     resource_set_int(const char *name, int unit, const char *resname,
421                          int value);
422 int     resource_set_long(const char *name, int unit, const char *resname,
423                           long value);
424 int     resource_set_string(const char *name, int unit, const char *resname,
425                             const char *value);
426 /*
427  * Functions for maintaining and checking consistency of
428  * bus information exported to userspace.
429  */
430 int     bus_data_generation_check(int generation);
431 void    bus_data_generation_update(void);
432
433 /**
434  * Some convenience defines for probe routines to return.  These are just
435  * suggested values, and there's nothing magical about them.
436  * BUS_PROBE_SPECIFIC is for devices that cannot be reprobed, and that no
437  * possible other driver may exist (typically legacy drivers who don't fallow
438  * all the rules, or special needs drivers).  BUS_PROBE_VENDOR is the
439  * suggested value that vendor supplied drivers use.  This is for source or
440  * binary drivers that are not yet integrated into the FreeBSD tree.  Its use
441  * in the base OS is prohibited.  BUS_PROBE_DEFAULT is the normal return value
442  * for drivers to use.  It is intended that nearly all of the drivers in the
443  * tree should return this value.  BUS_PROBE_LOW_PRIORITY are for drivers that
444  * have special requirements like when there are two drivers that support
445  * overlapping series of hardware devices.  In this case the one that supports
446  * the older part of the line would return this value, while the one that
447  * supports the newer ones would return BUS_PROBE_DEFAULT.  BUS_PROBE_GENERIC
448  * is for drivers that wish to have a generic form and a specialized form,
449  * like is done with the pci bus and the acpi pci bus.  BUS_PROBE_HOOVER is
450  * for those busses that implement a generic device place-holder for devices on
451  * the bus that have no more specific driver for them (aka ugen).
452  */
453 #define BUS_PROBE_SPECIFIC      0       /* Only I can use this device */
454 #define BUS_PROBE_VENDOR        (-10)   /* Vendor supplied driver */
455 #define BUS_PROBE_DEFAULT       (-20)   /* Base OS default driver */
456 #define BUS_PROBE_LOW_PRIORITY  (-40)   /* Older, less desirable drivers */
457 #define BUS_PROBE_GENERIC       (-100)  /* generic driver for dev */
458 #define BUS_PROBE_HOOVER        (-500)  /* Generic dev for all devs on bus */
459
460 /**
461  * Shorthand for constructing method tables.
462  */
463 #define DEVMETHOD       KOBJMETHOD
464
465 /*
466  * Some common device interfaces.
467  */
468 #include "device_if.h"
469 #include "bus_if.h"
470
471 struct  module;
472
473 int     driver_module_handler(struct module *, int, void *);
474
475 /**
476  * Module support for automatically adding drivers to busses.
477  */
478 struct driver_module_data {
479         int             (*dmd_chainevh)(struct module *, int, void *);
480         void            *dmd_chainarg;
481         const char      *dmd_busname;
482         kobj_class_t    dmd_driver;
483         devclass_t      *dmd_devclass;
484 };
485
486 #define DRIVER_MODULE(name, busname, driver, devclass, evh, arg)        \
487                                                                         \
488 static struct driver_module_data name##_##busname##_driver_mod = {      \
489         evh, arg,                                                       \
490         #busname,                                                       \
491         (kobj_class_t) &driver,                                         \
492         &devclass                                                       \
493 };                                                                      \
494                                                                         \
495 static moduledata_t name##_##busname##_mod = {                          \
496         #busname "/" #name,                                             \
497         driver_module_handler,                                          \
498         &name##_##busname##_driver_mod                                  \
499 };                                                                      \
500 DECLARE_MODULE(name##_##busname, name##_##busname##_mod,                \
501                SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
502
503 /**
504  * Generic ivar accessor generation macros for bus drivers
505  */
506 #define __BUS_ACCESSOR(varp, var, ivarp, ivar, type)                    \
507                                                                         \
508 static __inline type varp ## _get_ ## var(device_t dev)                 \
509 {                                                                       \
510         uintptr_t v;                                                    \
511         BUS_READ_IVAR(device_get_parent(dev), dev,                      \
512             ivarp ## _IVAR_ ## ivar, &v);                               \
513         return ((type) v);                                              \
514 }                                                                       \
515                                                                         \
516 static __inline void varp ## _set_ ## var(device_t dev, type t)         \
517 {                                                                       \
518         uintptr_t v = (uintptr_t) t;                                    \
519         BUS_WRITE_IVAR(device_get_parent(dev), dev,                     \
520             ivarp ## _IVAR_ ## ivar, v);                                \
521 }
522
523 /**
524  * Shorthand macros, taking resource argument
525  * Generated with sys/tools/bus_macro.sh
526  */
527
528 #define bus_barrier(r, o, l, f) \
529         bus_space_barrier((r)->r_bustag, (r)->r_bushandle, (o), (l), (f))
530 #define bus_read_1(r, o) \
531         bus_space_read_1((r)->r_bustag, (r)->r_bushandle, (o))
532 #define bus_read_multi_1(r, o, d, c) \
533         bus_space_read_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
534 #define bus_read_region_1(r, o, d, c) \
535         bus_space_read_region_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
536 #define bus_set_multi_1(r, o, v, c) \
537         bus_space_set_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
538 #define bus_set_region_1(r, o, v, c) \
539         bus_space_set_region_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
540 #define bus_write_1(r, o, v) \
541         bus_space_write_1((r)->r_bustag, (r)->r_bushandle, (o), (v))
542 #define bus_write_multi_1(r, o, d, c) \
543         bus_space_write_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
544 #define bus_write_region_1(r, o, d, c) \
545         bus_space_write_region_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
546 #define bus_read_stream_1(r, o) \
547         bus_space_read_stream_1((r)->r_bustag, (r)->r_bushandle, (o))
548 #define bus_read_multi_stream_1(r, o, d, c) \
549         bus_space_read_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
550 #define bus_read_region_stream_1(r, o, d, c) \
551         bus_space_read_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
552 #define bus_set_multi_stream_1(r, o, v, c) \
553         bus_space_set_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
554 #define bus_set_region_stream_1(r, o, v, c) \
555         bus_space_set_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
556 #define bus_write_stream_1(r, o, v) \
557         bus_space_write_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v))
558 #define bus_write_multi_stream_1(r, o, d, c) \
559         bus_space_write_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
560 #define bus_write_region_stream_1(r, o, d, c) \
561         bus_space_write_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
562 #define bus_read_2(r, o) \
563         bus_space_read_2((r)->r_bustag, (r)->r_bushandle, (o))
564 #define bus_read_multi_2(r, o, d, c) \
565         bus_space_read_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
566 #define bus_read_region_2(r, o, d, c) \
567         bus_space_read_region_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
568 #define bus_set_multi_2(r, o, v, c) \
569         bus_space_set_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
570 #define bus_set_region_2(r, o, v, c) \
571         bus_space_set_region_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
572 #define bus_write_2(r, o, v) \
573         bus_space_write_2((r)->r_bustag, (r)->r_bushandle, (o), (v))
574 #define bus_write_multi_2(r, o, d, c) \
575         bus_space_write_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
576 #define bus_write_region_2(r, o, d, c) \
577         bus_space_write_region_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
578 #define bus_read_stream_2(r, o) \
579         bus_space_read_stream_2((r)->r_bustag, (r)->r_bushandle, (o))
580 #define bus_read_multi_stream_2(r, o, d, c) \
581         bus_space_read_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
582 #define bus_read_region_stream_2(r, o, d, c) \
583         bus_space_read_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
584 #define bus_set_multi_stream_2(r, o, v, c) \
585         bus_space_set_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
586 #define bus_set_region_stream_2(r, o, v, c) \
587         bus_space_set_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
588 #define bus_write_stream_2(r, o, v) \
589         bus_space_write_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v))
590 #define bus_write_multi_stream_2(r, o, d, c) \
591         bus_space_write_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
592 #define bus_write_region_stream_2(r, o, d, c) \
593         bus_space_write_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
594 #define bus_read_4(r, o) \
595         bus_space_read_4((r)->r_bustag, (r)->r_bushandle, (o))
596 #define bus_read_multi_4(r, o, d, c) \
597         bus_space_read_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
598 #define bus_read_region_4(r, o, d, c) \
599         bus_space_read_region_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
600 #define bus_set_multi_4(r, o, v, c) \
601         bus_space_set_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
602 #define bus_set_region_4(r, o, v, c) \
603         bus_space_set_region_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
604 #define bus_write_4(r, o, v) \
605         bus_space_write_4((r)->r_bustag, (r)->r_bushandle, (o), (v))
606 #define bus_write_multi_4(r, o, d, c) \
607         bus_space_write_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
608 #define bus_write_region_4(r, o, d, c) \
609         bus_space_write_region_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
610 #define bus_read_stream_4(r, o) \
611         bus_space_read_stream_4((r)->r_bustag, (r)->r_bushandle, (o))
612 #define bus_read_multi_stream_4(r, o, d, c) \
613         bus_space_read_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
614 #define bus_read_region_stream_4(r, o, d, c) \
615         bus_space_read_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
616 #define bus_set_multi_stream_4(r, o, v, c) \
617         bus_space_set_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
618 #define bus_set_region_stream_4(r, o, v, c) \
619         bus_space_set_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
620 #define bus_write_stream_4(r, o, v) \
621         bus_space_write_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v))
622 #define bus_write_multi_stream_4(r, o, d, c) \
623         bus_space_write_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
624 #define bus_write_region_stream_4(r, o, d, c) \
625         bus_space_write_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
626 #define bus_read_8(r, o) \
627         bus_space_read_8((r)->r_bustag, (r)->r_bushandle, (o))
628 #define bus_read_multi_8(r, o, d, c) \
629         bus_space_read_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
630 #define bus_read_region_8(r, o, d, c) \
631         bus_space_read_region_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
632 #define bus_set_multi_8(r, o, v, c) \
633         bus_space_set_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
634 #define bus_set_region_8(r, o, v, c) \
635         bus_space_set_region_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
636 #define bus_write_8(r, o, v) \
637         bus_space_write_8((r)->r_bustag, (r)->r_bushandle, (o), (v))
638 #define bus_write_multi_8(r, o, d, c) \
639         bus_space_write_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
640 #define bus_write_region_8(r, o, d, c) \
641         bus_space_write_region_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
642 #define bus_read_stream_8(r, o) \
643         bus_space_read_stream_8((r)->r_bustag, (r)->r_bushandle, (o))
644 #define bus_read_multi_stream_8(r, o, d, c) \
645         bus_space_read_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
646 #define bus_read_region_stream_8(r, o, d, c) \
647         bus_space_read_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
648 #define bus_set_multi_stream_8(r, o, v, c) \
649         bus_space_set_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
650 #define bus_set_region_stream_8(r, o, v, c) \
651         bus_space_set_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
652 #define bus_write_stream_8(r, o, v) \
653         bus_space_write_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v))
654 #define bus_write_multi_stream_8(r, o, d, c) \
655         bus_space_write_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
656 #define bus_write_region_stream_8(r, o, d, c) \
657         bus_space_write_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
658 #endif /* _KERNEL */
659
660 #endif /* !_SYS_BUS_H_ */