]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/sys/bus.h
This commit was generated by cvs2svn to compensate for changes in r156369,
[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, 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
326 static __inline struct resource *
327 bus_alloc_resource_any(device_t dev, int type, int *rid, u_int flags)
328 {
329         return (bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags));
330 }
331
332 /*
333  * Access functions for device.
334  */
335 device_t        device_add_child(device_t dev, const char *name, int unit);
336 device_t        device_add_child_ordered(device_t dev, int order,
337                                          const char *name, int unit);
338 void    device_busy(device_t dev);
339 int     device_delete_child(device_t dev, device_t child);
340 int     device_attach(device_t dev);
341 int     device_detach(device_t dev);
342 void    device_disable(device_t dev);
343 void    device_enable(device_t dev);
344 device_t        device_find_child(device_t dev, const char *classname,
345                                   int unit);
346 const char      *device_get_desc(device_t dev);
347 devclass_t      device_get_devclass(device_t dev);
348 driver_t        *device_get_driver(device_t dev);
349 u_int32_t       device_get_flags(device_t dev);
350 device_t        device_get_parent(device_t dev);
351 int     device_get_children(device_t dev, device_t **listp, int *countp);
352 void    *device_get_ivars(device_t dev);
353 void    device_set_ivars(device_t dev, void *ivars);
354 const   char *device_get_name(device_t dev);
355 const   char *device_get_nameunit(device_t dev);
356 void    *device_get_softc(device_t dev);
357 device_state_t  device_get_state(device_t dev);
358 int     device_get_unit(device_t dev);
359 struct sysctl_ctx_list *device_get_sysctl_ctx(device_t dev);
360 struct sysctl_oid *device_get_sysctl_tree(device_t dev);
361 int     device_is_alive(device_t dev);  /* did probe succeed? */
362 int     device_is_attached(device_t dev);       /* did attach succeed? */
363 int     device_is_enabled(device_t dev);
364 int     device_is_quiet(device_t dev);
365 int     device_print_prettyname(device_t dev);
366 int     device_printf(device_t dev, const char *, ...) __printflike(2, 3);
367 int     device_probe_and_attach(device_t dev);
368 int     device_probe_child(device_t bus, device_t dev);
369 int     device_quiesce(device_t dev);
370 void    device_quiet(device_t dev);
371 void    device_set_desc(device_t dev, const char* desc);
372 void    device_set_desc_copy(device_t dev, const char* desc);
373 int     device_set_devclass(device_t dev, const char *classname);
374 int     device_set_driver(device_t dev, driver_t *driver);
375 void    device_set_flags(device_t dev, u_int32_t flags);
376 void    device_set_softc(device_t dev, void *softc);
377 int     device_set_unit(device_t dev, int unit);        /* XXX DONT USE XXX */
378 int     device_shutdown(device_t dev);
379 void    device_unbusy(device_t dev);
380 void    device_verbose(device_t dev);
381
382 /*
383  * Access functions for devclass.
384  */
385 int     devclass_add_driver(devclass_t dc, kobj_class_t driver);
386 int     devclass_delete_driver(devclass_t dc, kobj_class_t driver);
387 devclass_t      devclass_create(const char *classname);
388 devclass_t      devclass_find(const char *classname);
389 kobj_class_t    devclass_find_driver(devclass_t dc, const char *classname);
390 const char      *devclass_get_name(devclass_t dc);
391 device_t        devclass_get_device(devclass_t dc, int unit);
392 void    *devclass_get_softc(devclass_t dc, int unit);
393 int     devclass_get_devices(devclass_t dc, device_t **listp, int *countp);
394 int     devclass_get_drivers(devclass_t dc, driver_t ***listp, int *countp);
395 int     devclass_get_count(devclass_t dc);
396 int     devclass_get_maxunit(devclass_t dc);
397 int     devclass_find_free_unit(devclass_t dc, int unit);
398 void    devclass_set_parent(devclass_t dc, devclass_t pdc);
399 devclass_t      devclass_get_parent(devclass_t dc);
400 struct sysctl_ctx_list *devclass_get_sysctl_ctx(devclass_t dc);
401 struct sysctl_oid *devclass_get_sysctl_tree(devclass_t dc);
402 int     devclass_quiesce_driver(devclass_t dc, kobj_class_t driver);
403
404 /*
405  * Access functions for device resources.
406  */
407
408 int     resource_int_value(const char *name, int unit, const char *resname,
409                            int *result);
410 int     resource_long_value(const char *name, int unit, const char *resname,
411                             long *result);
412 int     resource_string_value(const char *name, int unit, const char *resname,
413                               const char **result);
414 int     resource_disabled(const char *name, int unit);
415 int     resource_find_match(int *anchor, const char **name, int *unit,
416                             const char *resname, const char *value);
417 int     resource_find_dev(int *anchor, const char *name, int *unit,
418                           const char *resname, const char *value);
419 int     resource_set_int(const char *name, int unit, const char *resname,
420                          int value);
421 int     resource_set_long(const char *name, int unit, const char *resname,
422                           long value);
423 int     resource_set_string(const char *name, int unit, const char *resname,
424                             const char *value);
425 /*
426  * Functions for maintaining and checking consistency of
427  * bus information exported to userspace.
428  */
429 int     bus_data_generation_check(int generation);
430 void    bus_data_generation_update(void);
431
432 /**
433  * Some convenience defines for probe routines to return.  These are just
434  * suggested values, and there's nothing magical about them.
435  * BUS_PROBE_SPECIFIC is for devices that cannot be reprobed, and that no
436  * possible other driver may exist (typically legacy drivers who don't fallow
437  * all the rules, or special needs drivers).  BUS_PROBE_VENDOR is the
438  * suggested value that vendor supplied drivers use.  This is for source or
439  * binary drivers that are not yet integrated into the FreeBSD tree.  Its use
440  * in the base OS is prohibited.  BUS_PROBE_DEFAULT is the normal return value
441  * for drivers to use.  It is intended that nearly all of the drivers in the
442  * tree should return this value.  BUS_PROBE_LOW_PRIORITY are for drivers that
443  * have special requirements like when there are two drivers that support
444  * overlapping series of hardware devices.  In this case the one that supports
445  * the older part of the line would return this value, while the one that
446  * supports the newer ones would return BUS_PROBE_DEFAULT.  BUS_PROBE_GENERIC
447  * is for drivers that wish to have a generic form and a specialized form,
448  * like is done with the pci bus and the acpi pci bus.  BUS_PROBE_HOOVER is
449  * for those busses that implement a generic device place-holder for devices on
450  * the bus that have no more specific driver for them (aka ugen).
451  */
452 #define BUS_PROBE_SPECIFIC      0       /* Only I can use this device */
453 #define BUS_PROBE_VENDOR        (-10)   /* Vendor supplied driver */
454 #define BUS_PROBE_DEFAULT       (-20)   /* Base OS default driver */
455 #define BUS_PROBE_LOW_PRIORITY  (-40)   /* Older, less desirable drivers */
456 #define BUS_PROBE_GENERIC       (-100)  /* generic driver for dev */
457 #define BUS_PROBE_HOOVER        (-500)  /* Generic dev for all devs on bus */
458
459 /**
460  * Shorthand for constructing method tables.
461  */
462 #define DEVMETHOD       KOBJMETHOD
463
464 /*
465  * Some common device interfaces.
466  */
467 #include "device_if.h"
468 #include "bus_if.h"
469
470 struct  module;
471
472 int     driver_module_handler(struct module *, int, void *);
473
474 /**
475  * Module support for automatically adding drivers to busses.
476  */
477 struct driver_module_data {
478         int             (*dmd_chainevh)(struct module *, int, void *);
479         void            *dmd_chainarg;
480         const char      *dmd_busname;
481         kobj_class_t    dmd_driver;
482         devclass_t      *dmd_devclass;
483 };
484
485 #define DRIVER_MODULE(name, busname, driver, devclass, evh, arg)        \
486                                                                         \
487 static struct driver_module_data name##_##busname##_driver_mod = {      \
488         evh, arg,                                                       \
489         #busname,                                                       \
490         (kobj_class_t) &driver,                                         \
491         &devclass                                                       \
492 };                                                                      \
493                                                                         \
494 static moduledata_t name##_##busname##_mod = {                          \
495         #busname "/" #name,                                             \
496         driver_module_handler,                                          \
497         &name##_##busname##_driver_mod                                  \
498 };                                                                      \
499 DECLARE_MODULE(name##_##busname, name##_##busname##_mod,                \
500                SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
501
502 /**
503  * Generic ivar accessor generation macros for bus drivers
504  */
505 #define __BUS_ACCESSOR(varp, var, ivarp, ivar, type)                    \
506                                                                         \
507 static __inline type varp ## _get_ ## var(device_t dev)                 \
508 {                                                                       \
509         uintptr_t v;                                                    \
510         BUS_READ_IVAR(device_get_parent(dev), dev,                      \
511             ivarp ## _IVAR_ ## ivar, &v);                               \
512         return ((type) v);                                              \
513 }                                                                       \
514                                                                         \
515 static __inline void varp ## _set_ ## var(device_t dev, type t)         \
516 {                                                                       \
517         uintptr_t v = (uintptr_t) t;                                    \
518         BUS_WRITE_IVAR(device_get_parent(dev), dev,                     \
519             ivarp ## _IVAR_ ## ivar, v);                                \
520 }
521
522 /**
523  * Shorthand macros, taking resource argument
524  * Generated with sys/tools/bus_macro.sh
525  */
526
527 #define bus_barrier(r, o, l, f) \
528         bus_space_barrier((r)->r_bustag, (r)->r_bushandle, (o), (l), (f))
529 #define bus_read_1(r, o) \
530         bus_space_read_1((r)->r_bustag, (r)->r_bushandle, (o))
531 #define bus_read_multi_1(r, o, d, c) \
532         bus_space_read_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
533 #define bus_read_region_1(r, o, d, c) \
534         bus_space_read_region_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
535 #define bus_set_multi_1(r, o, v, c) \
536         bus_space_set_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
537 #define bus_set_region_1(r, o, v, c) \
538         bus_space_set_region_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
539 #define bus_write_1(r, o, v) \
540         bus_space_write_1((r)->r_bustag, (r)->r_bushandle, (o), (v))
541 #define bus_write_multi_1(r, o, d, c) \
542         bus_space_write_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
543 #define bus_write_region_1(r, o, d, c) \
544         bus_space_write_region_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
545 #define bus_read_stream_1(r, o) \
546         bus_space_read_stream_1((r)->r_bustag, (r)->r_bushandle, (o))
547 #define bus_read_multi_stream_1(r, o, d, c) \
548         bus_space_read_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
549 #define bus_read_region_stream_1(r, o, d, c) \
550         bus_space_read_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
551 #define bus_set_multi_stream_1(r, o, v, c) \
552         bus_space_set_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
553 #define bus_set_region_stream_1(r, o, v, c) \
554         bus_space_set_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
555 #define bus_write_stream_1(r, o, v) \
556         bus_space_write_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v))
557 #define bus_write_multi_stream_1(r, o, d, c) \
558         bus_space_write_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
559 #define bus_write_region_stream_1(r, o, d, c) \
560         bus_space_write_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
561 #define bus_read_2(r, o) \
562         bus_space_read_2((r)->r_bustag, (r)->r_bushandle, (o))
563 #define bus_read_multi_2(r, o, d, c) \
564         bus_space_read_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
565 #define bus_read_region_2(r, o, d, c) \
566         bus_space_read_region_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
567 #define bus_set_multi_2(r, o, v, c) \
568         bus_space_set_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
569 #define bus_set_region_2(r, o, v, c) \
570         bus_space_set_region_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
571 #define bus_write_2(r, o, v) \
572         bus_space_write_2((r)->r_bustag, (r)->r_bushandle, (o), (v))
573 #define bus_write_multi_2(r, o, d, c) \
574         bus_space_write_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
575 #define bus_write_region_2(r, o, d, c) \
576         bus_space_write_region_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
577 #define bus_read_stream_2(r, o) \
578         bus_space_read_stream_2((r)->r_bustag, (r)->r_bushandle, (o))
579 #define bus_read_multi_stream_2(r, o, d, c) \
580         bus_space_read_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
581 #define bus_read_region_stream_2(r, o, d, c) \
582         bus_space_read_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
583 #define bus_set_multi_stream_2(r, o, v, c) \
584         bus_space_set_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
585 #define bus_set_region_stream_2(r, o, v, c) \
586         bus_space_set_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
587 #define bus_write_stream_2(r, o, v) \
588         bus_space_write_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v))
589 #define bus_write_multi_stream_2(r, o, d, c) \
590         bus_space_write_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
591 #define bus_write_region_stream_2(r, o, d, c) \
592         bus_space_write_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
593 #define bus_read_4(r, o) \
594         bus_space_read_4((r)->r_bustag, (r)->r_bushandle, (o))
595 #define bus_read_multi_4(r, o, d, c) \
596         bus_space_read_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
597 #define bus_read_region_4(r, o, d, c) \
598         bus_space_read_region_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
599 #define bus_set_multi_4(r, o, v, c) \
600         bus_space_set_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
601 #define bus_set_region_4(r, o, v, c) \
602         bus_space_set_region_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
603 #define bus_write_4(r, o, v) \
604         bus_space_write_4((r)->r_bustag, (r)->r_bushandle, (o), (v))
605 #define bus_write_multi_4(r, o, d, c) \
606         bus_space_write_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
607 #define bus_write_region_4(r, o, d, c) \
608         bus_space_write_region_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
609 #define bus_read_stream_4(r, o) \
610         bus_space_read_stream_4((r)->r_bustag, (r)->r_bushandle, (o))
611 #define bus_read_multi_stream_4(r, o, d, c) \
612         bus_space_read_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
613 #define bus_read_region_stream_4(r, o, d, c) \
614         bus_space_read_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
615 #define bus_set_multi_stream_4(r, o, v, c) \
616         bus_space_set_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
617 #define bus_set_region_stream_4(r, o, v, c) \
618         bus_space_set_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
619 #define bus_write_stream_4(r, o, v) \
620         bus_space_write_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v))
621 #define bus_write_multi_stream_4(r, o, d, c) \
622         bus_space_write_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
623 #define bus_write_region_stream_4(r, o, d, c) \
624         bus_space_write_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
625 #define bus_read_8(r, o) \
626         bus_space_read_8((r)->r_bustag, (r)->r_bushandle, (o))
627 #define bus_read_multi_8(r, o, d, c) \
628         bus_space_read_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
629 #define bus_read_region_8(r, o, d, c) \
630         bus_space_read_region_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
631 #define bus_set_multi_8(r, o, v, c) \
632         bus_space_set_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
633 #define bus_set_region_8(r, o, v, c) \
634         bus_space_set_region_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
635 #define bus_write_8(r, o, v) \
636         bus_space_write_8((r)->r_bustag, (r)->r_bushandle, (o), (v))
637 #define bus_write_multi_8(r, o, d, c) \
638         bus_space_write_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
639 #define bus_write_region_8(r, o, d, c) \
640         bus_space_write_region_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
641 #define bus_read_stream_8(r, o) \
642         bus_space_read_stream_8((r)->r_bustag, (r)->r_bushandle, (o))
643 #define bus_read_multi_stream_8(r, o, d, c) \
644         bus_space_read_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
645 #define bus_read_region_stream_8(r, o, d, c) \
646         bus_space_read_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
647 #define bus_set_multi_stream_8(r, o, v, c) \
648         bus_space_set_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
649 #define bus_set_region_stream_8(r, o, v, c) \
650         bus_space_set_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
651 #define bus_write_stream_8(r, o, v) \
652         bus_space_write_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v))
653 #define bus_write_multi_stream_8(r, o, d, c) \
654         bus_space_write_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
655 #define bus_write_region_stream_8(r, o, d, c) \
656         bus_space_write_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
657 #endif /* _KERNEL */
658
659 #endif /* !_SYS_BUS_H_ */