1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 1997,1998,2003 Doug Rabson
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29 #ifndef _SYS_BUS_H_
30 #define _SYS_BUS_H_
31
32 #include <limits.h>
33 #include <sys/types.h>
34 #include <arm/include/_bus.h>
35 #include <sys/module.h>
36 #include <sys/queue.h>
37 #include <los_hwi.h>
38
39 typedef struct device *device_t;
40
41 typedef uint32_t u_int32_t;
42
43 /**
44 * @brief State of the device.
45 */
46 typedef enum device_state {
47 DS_NOTPRESENT = 10, /**< @brief not probed or probe failed */
48 DS_ALIVE = 20, /**< @brief probe succeeded */
49 DS_ATTACHING = 25, /**< @brief currently attaching */
50 DS_ATTACHED = 30, /**< @brief attach method called */
51 DS_BUSY = 40 /**< @brief device is open */
52 } device_state_t;
53
54 /**
55 * * @brief Device information exported to userspace.
56 * */
57 struct u_device {
58 uintptr_t dv_handle;
59 uintptr_t dv_parent;
60
61 char dv_name[32]; /**< @brief Name of device in tree. */
62 char dv_desc[32]; /**< @brief Driver description */
63 char dv_drivername[32]; /**< @brief Driver name */
64 char dv_pnpinfo[128]; /**< @brief Plug and play info */
65 char dv_location[128]; /**< @brief Where is the device? */
66 uint32_t dv_devflags; /**< @brief API Flags for device */
67 uint16_t dv_flags; /**< @brief flags for dev state */
68 device_state_t dv_state; /**< @brief State of attachment */
69 /* XXX more driver info? */
70 };
71
72 /* Flags exported via dv_flags. */
73 #define DF_ENABLED 0x01 /* device should be probed/attached */
74 #define DF_FIXEDCLASS 0x02 /* devclass specified at create time */
75 #define DF_WILDCARD 0x04 /* unit was originally wildcard */
76 #define DF_DESCMALLOCED 0x08 /* description was malloced */
77 #define DF_QUIET 0x10 /* don't print verbose attach message */
78 #define DF_DONENOMATCH 0x20 /* don't execute DEVICE_NOMATCH again */
79 #define DF_EXTERNALSOFTC 0x40 /* softc not allocated by us */
80 #define DF_REBID 0x80 /* Can rebid after attach */
81 #define DF_SUSPENDED 0x100 /* Device is suspended. */
82
83 #define SYS_RES_IRQ 1 /* interrupt lines */
84 #define SYS_RES_DRQ 2 /* isa dma lines */
85 #define SYS_RES_MEMORY 3 /* i/o memory */
86 #define SYS_RES_IOPORT 4 /* i/o ports */
87
88 #include <sys/kobj.h>
89
90 /**
91 * @brief A device driver (included mainly for compatibility with
92 * FreeBSD 4.x).
93 */
94 typedef struct kobj_class driver_t;
95
96 /**
97 * @brief A device class
98 *
99 * The devclass object has two main functions in the system. The first
100 * is to manage the allocation of unit numbers for device instances
101 * and the second is to hold the list of device drivers for a
102 * particular bus type. Each devclass has a name and there cannot be
103 * two devclasses with the same name. This ensures that unique unit
104 * numbers are allocated to device instances.
105 *
106 * Drivers that support several different bus attachments (e.g. isa,
107 * pci, pccard) should all use the same devclass to ensure that unit
108 * numbers do not conflict.
109 *
110 * Each devclass may also have a parent devclass. This is used when
111 * searching for device drivers to allow a form of inheritance. When
112 * matching drivers with devices, first the driver list of the parent
113 * device's devclass is searched. If no driver is found in that list,
114 * the search continues in the parent devclass (if any).
115 */
116 typedef struct devclass *devclass_t;
117
118 /**
119 * @brief A device method
120 */
121 #define device_method_t kobj_method_t
122
123 /**
124 * @brief Driver interrupt filter return values
125 *
126 * If a driver provides an interrupt filter routine it must return an
127 * integer consisting of oring together zero or more of the following
128 * flags:
129 *
130 * FILTER_STRAY - this device did not trigger the interrupt
131 * FILTER_HANDLED - the interrupt has been fully handled and can be EOId
132 * FILTER_SCHEDULE_THREAD - the threaded interrupt handler should be
133 * scheduled to execute
134 *
135 * If the driver does not provide a filter, then the interrupt code will
136 * act is if the filter had returned FILTER_SCHEDULE_THREAD. Note that it
137 * is illegal to specify any other flag with FILTER_STRAY and that it is
138 * illegal to not specify either of FILTER_HANDLED or FILTER_SCHEDULE_THREAD
139 * if FILTER_STRAY is not specified.
140 */
141 #define FILTER_STRAY 0x01
142 #define FILTER_HANDLED 0x02
143 #define FILTER_SCHEDULE_THREAD 0x04
144
145 /**
146 * @brief Driver interrupt service routines
147 *
148 * The filter routine is run in primary interrupt context and may not
149 * block or use regular mutexes. It may only use spin mutexes for
150 * synchronization. The filter may either completely handle the
151 * interrupt or it may perform some of the work and defer more
152 * expensive work to the regular interrupt handler. If a filter
153 * routine is not registered by the driver, then the regular interrupt
154 * handler is always used to handle interrupts from this device.
155 *
156 * The regular interrupt handler executes in its own thread context
157 * and may use regular mutexes. However, it is prohibited from
158 * sleeping on a sleep queue.
159 */
160 typedef int driver_filter_t(void*);
161 typedef void driver_intr_t(int, void*);
162
163 /**
164 * @brief This structure is deprecated.
165 *
166 * Use the kobj(9) macro DEFINE_CLASS to
167 * declare classes which implement device drivers.
168 */
169 struct driver {
170 KOBJ_CLASS_FIELDS;
171 };
172
173
174 typedef uint64_t rman_res_t;
175 /*
176 * Definitions for drivers which need to keep simple lists of resources
177 * for their child devices.
178 */
179 /*
180 * The public (kernel) view of struct resource
181 *
182 * NB: Changing the offset/size/type of existing fields in struct resource
183 * NB: breaks the device driver ABI and is strongly FORBIDDEN.
184 * NB: Appending new fields is probably just misguided.
185 */
186
187 struct resource {
188 rman_res_t start; /**< @brief start of resource range */
189 rman_res_t end; /**< @brief end of resource range */
190 rman_res_t count; /**< @brief count within range */
191 };
192
193 /**
194 * @brief An entry for a single resource in a resource list.
195 */
196 struct resource_list_entry {
197 STAILQ_ENTRY(resource_list_entry) link;
198 int type; /**< @brief type argument to alloc_resource */
199 int rid; /**< @brief resource identifier */
200 int flags; /**< @brief resource flags */
201 struct resource *res; /**< @brief the real resource when allocated */
202 };
203 STAILQ_HEAD(resource_list, resource_list_entry);
204
205 #define RLE_RESERVED 0x0001 /* Reserved by the parent bus. */
206 #define RLE_ALLOCATED 0x0002 /* Reserved resource is allocated. */
207 #define RLE_PREFETCH 0x0004 /* Resource is a prefetch range. */
208
209 void resource_list_init(struct resource_list *rl);
210 void resource_list_free(struct resource_list *rl);
211 struct resource_list_entry *
212 resource_list_add(struct resource_list *rl,
213 int type, int rid,
214 rman_res_t start, rman_res_t end, rman_res_t count);
215 struct resource_list_entry*
216 resource_list_find(struct resource_list *rl,
217 int type, int rid);
218
219 typedef void (*add_res_callback_t)(const char *devclass_name, int type, int unit, rman_res_t start, rman_res_t end,
220 rman_res_t count);
221 void machine_resource_init(add_res_callback_t callback);
222
223 /*
224 * The root bus, to which all top-level busses are attached.
225 */
226 extern device_t root_bus;
227 extern devclass_t root_devclass;
228 void root_bus_configure(void);
229
230 extern device_t nexus;
231
232 /*
233 * Useful functions for implementing busses.
234 */
235
236 struct _cpuset;
237
238 int bus_generic_attach(device_t dev);
239
240 device_t
241 bus_generic_add_child(device_t dev, u_int order, const char *name,
242 int unit);
243 int bus_generic_child_present(device_t dev, device_t child);
244
245 int bus_generic_detach(device_t dev);
246 void bus_generic_driver_added(device_t dev, driver_t *driver);
247 int bus_generic_get_domain(device_t dev, device_t child, int *domain);
248
249 void bus_generic_new_pass(device_t dev);
250 int bus_print_child_header(device_t dev, device_t child);
251 int bus_print_child_domain(device_t dev, device_t child);
252 int bus_print_child_footer(device_t dev, device_t child);
253 int bus_generic_print_child(device_t dev, device_t child);
254 int bus_generic_probe(device_t dev);
255 int bus_generic_read_ivar(device_t dev, device_t child, int which,
256 uintptr_t *result);
257 int bus_generic_resume(device_t dev);
258 int bus_generic_resume_child(device_t dev, device_t child);
259
260 int bus_generic_shutdown(device_t dev);
261 int bus_generic_suspend(device_t dev);
262 int bus_generic_suspend_child(device_t dev, device_t child);
263
264 int bus_generic_write_ivar(device_t dev, device_t child, int which,
265 uintptr_t value);
266 int bus_helper_reset_post(device_t dev, int flags);
267 int bus_helper_reset_prepare(device_t dev, int flags);
268 int bus_null_rescan(device_t dev);
269
270 struct resource *bus_alloc_resource(device_t dev, int type, int *rid,
271 rman_res_t start, rman_res_t end,
272 rman_res_t count, u_int flags);
273 int bus_generic_resume(device_t dev);
274 int bus_generic_resume_child(device_t dev, device_t child);
275
276 int bus_child_location_str(device_t child, char *buf, size_t buflen);
277
278 static __inline struct resource *
bus_alloc_resource_any(device_t dev,int type,int * rid,u_int flags)279 bus_alloc_resource_any(device_t dev, int type, int *rid, u_int flags)
280 {
281 return (bus_alloc_resource(dev, type, rid, 0, ~0, 1, flags));
282 }
283
284 /*
285 * Access functions for device.
286 */
287 device_t device_add_child(device_t dev, const char *name, int unit);
288 device_t device_add_child_ordered(device_t dev, u_int order,
289 const char *name, int unit);
290 void device_busy(device_t dev);
291 int device_delete_child(device_t dev, device_t child);
292 int device_delete_children(device_t dev);
293 int device_attach(device_t dev);
294 int device_detach(device_t dev);
295 void device_disable(device_t dev);
296 void device_enable(device_t dev);
297 device_t device_find_child(device_t dev, const char *classname,
298 int unit);
299 const char *device_get_desc(device_t dev);
300 devclass_t device_get_devclass(device_t dev);
301 driver_t *device_get_driver(device_t dev);
302 u_int32_t device_get_flags(device_t dev);
303 device_t device_get_parent(device_t dev);
304 int device_get_children(device_t dev, device_t **listp, int *countp);
305 void *device_get_ivars(device_t dev);
306 void device_set_ivars(device_t dev, void *ivars);
307 const char *device_get_name(device_t dev);
308 const char *device_get_nameunit(device_t dev);
309 void *device_get_softc(device_t dev);
310 device_state_t device_get_state(device_t dev);
311 int device_get_unit(device_t dev);
312 struct sysctl_ctx_list *device_get_sysctl_ctx(device_t dev);
313 struct sysctl_oid *device_get_sysctl_tree(device_t dev);
314 int device_is_alive(device_t dev); /* did probe succeed? */
315 int device_is_attached(device_t dev); /* did attach succeed? */
316 int device_is_enabled(device_t dev);
317 int device_is_suspended(device_t dev);
318 int device_is_quiet(device_t dev);
319 device_t device_lookup_by_name(const char *name);
320 int device_print_prettyname(device_t dev);
321 int device_printf(device_t dev, const char *, ...) __printflike(2, 3);
322 int device_probe(device_t dev);
323 int device_probe_and_attach(device_t dev);
324 int device_probe_child(device_t bus, device_t dev);
325 int device_quiesce(device_t dev);
326 void device_quiet(device_t dev);
327 void device_set_desc(device_t dev, const char* desc);
328 void device_set_desc_copy(device_t dev, const char* desc);
329 int device_set_devclass(device_t dev, const char *classname);
330 int device_set_devclass_fixed(device_t dev, const char *classname);
331 bool device_is_devclass_fixed(device_t dev);
332 int device_set_driver(device_t dev, driver_t *driver);
333 void device_set_flags(device_t dev, u_int32_t flags);
334 void device_set_softc(device_t dev, void *softc);
335 void device_free_softc(void *softc);
336 void device_claim_softc(device_t dev);
337 int device_set_unit(device_t dev, int unit); /* XXX DONT USE XXX */
338 int device_shutdown(device_t dev);
339 void device_unbusy(device_t dev);
340 void device_verbose(device_t dev);
341
342 /* port for interrupt setup and teardown */
343 int bus_setup_intr(int irq, int flags, driver_intr_t *intr, void *arg);
344 int bus_teardown_intr(int irq, void *arg);
345
346 /*
347 * Access functions for devclass.
348 */
349 int devclass_add_driver(devclass_t dc, driver_t *driver,
350 int pass, devclass_t *dcp);
351 devclass_t devclass_create(const char *classname);
352 int devclass_delete_driver(devclass_t busclass, driver_t *driver);
353 devclass_t devclass_find(const char *classname);
354 const char *devclass_get_name(devclass_t dc);
355 device_t devclass_get_device(devclass_t dc, int unit);
356 void *devclass_get_softc(devclass_t dc, int unit);
357 int devclass_get_devices(devclass_t dc, device_t **listp, int *countp);
358 int devclass_get_drivers(devclass_t dc, driver_t ***listp, int *countp);
359 int devclass_get_count(devclass_t dc);
360 int devclass_get_maxunit(devclass_t dc);
361 int devclass_find_free_unit(devclass_t dc, int unit);
362 void devclass_set_parent(devclass_t dc, devclass_t pdc);
363 devclass_t devclass_get_parent(devclass_t dc);
364
365 /*
366 * Functions for maintaining and checking consistency of
367 * bus information exported to userspace.
368 */
369 int bus_data_generation_check(int generation);
370 void bus_data_generation_update(void);
371
372 /**
373 * Some convenience defines for probe routines to return. These are just
374 * suggested values, and there's nothing magical about them.
375 * BUS_PROBE_SPECIFIC is for devices that cannot be reprobed, and that no
376 * possible other driver may exist (typically legacy drivers who don't fallow
377 * all the rules, or special needs drivers). BUS_PROBE_VENDOR is the
378 * suggested value that vendor supplied drivers use. This is for source or
379 * binary drivers that are not yet integrated into the FreeBSD tree. Its use
380 * in the base OS is prohibited. BUS_PROBE_DEFAULT is the normal return value
381 * for drivers to use. It is intended that nearly all of the drivers in the
382 * tree should return this value. BUS_PROBE_LOW_PRIORITY are for drivers that
383 * have special requirements like when there are two drivers that support
384 * overlapping series of hardware devices. In this case the one that supports
385 * the older part of the line would return this value, while the one that
386 * supports the newer ones would return BUS_PROBE_DEFAULT. BUS_PROBE_GENERIC
387 * is for drivers that wish to have a generic form and a specialized form,
388 * like is done with the pci bus and the acpi pci bus. BUS_PROBE_HOOVER is
389 * for those busses that implement a generic device place-holder for devices on
390 * the bus that have no more specific driver for them (aka ugen).
391 * BUS_PROBE_NOWILDCARD or lower means that the device isn't really bidding
392 * for a device node, but accepts only devices that its parent has told it
393 * use this driver.
394 */
395 #define BUS_PROBE_SPECIFIC 0 /* Only I can use this device */
396 #define BUS_PROBE_VENDOR (-10) /* Vendor supplied driver */
397 #define BUS_PROBE_DEFAULT (-20) /* Base OS default driver */
398 #define BUS_PROBE_LOW_PRIORITY (-40) /* Older, less desirable drivers */
399 #define BUS_PROBE_GENERIC (-100) /* generic driver for dev */
400 #define BUS_PROBE_HOOVER (-1000000) /* Driver for any dev on bus */
401 #define BUS_PROBE_NOWILDCARD (-2000000000) /* No wildcard device matches */
402
403 /**
404 * During boot, the device tree is scanned multiple times. Each scan,
405 * or pass, drivers may be attached to devices. Each driver
406 * attachment is assigned a pass number. Drivers may only probe and
407 * attach to devices if their pass number is less than or equal to the
408 * current system-wide pass number. The default pass is the last pass
409 * and is used by most drivers. Drivers needed by the scheduler are
410 * probed in earlier passes.
411 */
412 #define BUS_PASS_ROOT 0 /* Used to attach root0. */
413 #define BUS_PASS_BUS 10 /* Busses and bridges. */
414 #define BUS_PASS_CPU 20 /* CPU devices. */
415 #define BUS_PASS_RESOURCE 30 /* Resource discovery. */
416 #define BUS_PASS_INTERRUPT 40 /* Interrupt controllers. */
417 #define BUS_PASS_TIMER 50 /* Timers and clocks. */
418 #define BUS_PASS_SCHEDULER 60 /* Start scheduler. */
419 #define BUS_PASS_DEFAULT INT_MAX /* Everything else. */
420
421 #define BUS_PASS_ORDER_FIRST 0
422 #define BUS_PASS_ORDER_EARLY 2
423 #define BUS_PASS_ORDER_MIDDLE 5
424 #define BUS_PASS_ORDER_LATE 7
425 #define BUS_PASS_ORDER_LAST 9
426
427 extern int bus_current_pass;
428
429 void bus_set_pass(int pass);
430
431 /**
432 * Shorthands for constructing method tables.
433 */
434 #define DEVMETHOD KOBJMETHOD
435 #define DEVMETHOD_END KOBJMETHOD_END
436
437 /*
438 * Some common device interfaces.
439 */
440 #include "device_if.h"
441 #include "bus_if.h"
442
443 struct module;
444
445 int driver_module_handler(struct module *, int, void *);
446
447 /**
448 * Module support for automatically adding drivers to busses.
449 */
450 struct driver_module_data {
451 int (*dmd_chainevh)(struct module *, int, void *);
452 void *dmd_chainarg;
453 const char *dmd_busname;
454 kobj_class_t dmd_driver;
455 devclass_t *dmd_devclass;
456 int dmd_pass;
457 };
458
459 #define EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \
460 evh, arg, order, pass) \
461 \
462 /*static */struct driver_module_data name##_##busname##_driver_mod = { \
463 evh, arg, \
464 #busname, \
465 (kobj_class_t) &driver, \
466 &devclass, \
467 pass \
468 }; \
469 \
470 /*static */moduledata_t name##_##busname##_mod = { \
471 #busname "/" #name, \
472 driver_module_handler, \
473 &name##_##busname##_driver_mod \
474 }; \
475 DECLARE_MODULE(name##_##busname, name##_##busname##_mod, \
476 SI_SUB_DRIVERS, order)
477
478 #define EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, pass) \
479 EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \
480 evh, arg, SI_ORDER_MIDDLE, pass)
481
482 #define DRIVER_MODULE_ORDERED(name, busname, driver, devclass, evh, arg,\
483 order) \
484 EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \
485 evh, arg, order, BUS_PASS_DEFAULT)
486
487 #define DRIVER_MODULE(name, busname, driver, devclass, evh, arg) \
488 EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, \
489 BUS_PASS_DEFAULT)
490
491 /**
492 * Generic ivar accessor generation macros for bus drivers
493 */
494 #define __BUS_ACCESSOR(varp, var, ivarp, ivar, type) \
495 \
496 static __inline type varp ## _get_ ## var(device_t dev) \
497 { \
498 uintptr_t v; \
499 int e; \
500 e = BUS_READ_IVAR(device_get_parent(dev), dev, \
501 ivarp ## _IVAR_ ## ivar, &v); \
502 if (e != 0) { \
503 device_printf(dev, "failed to read ivar " \
504 __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \
505 "error = %d\n", \
506 device_get_nameunit(device_get_parent(dev)), e); \
507 } \
508 return ((type) v); \
509 } \
510 \
511 static __inline void varp ## _set_ ## var(device_t dev, type t) \
512 { \
513 uintptr_t v = (uintptr_t) t; \
514 int e; \
515 e = BUS_WRITE_IVAR(device_get_parent(dev), dev, \
516 ivarp ## _IVAR_ ## ivar, v); \
517 if (e != 0) { \
518 device_printf(dev, "failed to write ivar " \
519 __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \
520 "error = %d\n", \
521 device_get_nameunit(device_get_parent(dev)), e); \
522 } \
523 }
524
525 /**
526 * Shorthand macros, taking resource argument
527 * Generated with sys/tools/bus_macro.sh
528 */
529
530 #define bus_barrier(r, o, l, f) \
531 bus_space_barrier((r)->r_bustag, (r)->r_bushandle, (o), (l), (f))
532 #define bus_poke_1(r, o, v) \
533 bus_space_poke_1((r)->r_bustag, (r)->r_bushandle, (o), (v))
534 #define bus_peek_1(r, o, vp) \
535 bus_space_peek_1((r)->r_bustag, (r)->r_bushandle, (o), (vp))
536 #define bus_read_1(r, o) \
537 bus_space_read_1((r)->r_bustag, (r)->r_bushandle, (o))
538 #define bus_read_multi_1(r, o, d, c) \
539 bus_space_read_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
540 #define bus_read_region_1(r, o, d, c) \
541 bus_space_read_region_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
542 #define bus_set_multi_1(r, o, v, c) \
543 bus_space_set_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
544 #define bus_set_region_1(r, o, v, c) \
545 bus_space_set_region_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
546 #define bus_write_1(r, o, v) \
547 bus_space_write_1((r)->r_bustag, (r)->r_bushandle, (o), (v))
548 #define bus_write_multi_1(r, o, d, c) \
549 bus_space_write_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
550 #define bus_write_region_1(r, o, d, c) \
551 bus_space_write_region_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
552 #define bus_read_stream_1(r, o) \
553 bus_space_read_stream_1((r)->r_bustag, (r)->r_bushandle, (o))
554 #define bus_read_multi_stream_1(r, o, d, c) \
555 bus_space_read_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
556 #define bus_read_region_stream_1(r, o, d, c) \
557 bus_space_read_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
558 #define bus_set_multi_stream_1(r, o, v, c) \
559 bus_space_set_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
560 #define bus_set_region_stream_1(r, o, v, c) \
561 bus_space_set_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
562 #define bus_write_stream_1(r, o, v) \
563 bus_space_write_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v))
564 #define bus_write_multi_stream_1(r, o, d, c) \
565 bus_space_write_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
566 #define bus_write_region_stream_1(r, o, d, c) \
567 bus_space_write_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
568 #define bus_poke_2(r, o, v) \
569 bus_space_poke_2((r)->r_bustag, (r)->r_bushandle, (o), (v))
570 #define bus_peek_2(r, o, vp) \
571 bus_space_peek_2((r)->r_bustag, (r)->r_bushandle, (o), (vp))
572 #define bus_read_2(r, o) \
573 bus_space_read_2((r)->r_bustag, (r)->r_bushandle, (o))
574 #define bus_read_multi_2(r, o, d, c) \
575 bus_space_read_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
576 #define bus_read_region_2(r, o, d, c) \
577 bus_space_read_region_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
578 #define bus_set_multi_2(r, o, v, c) \
579 bus_space_set_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
580 #define bus_set_region_2(r, o, v, c) \
581 bus_space_set_region_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
582 #define bus_write_2(r, o, v) \
583 bus_space_write_2((r)->r_bustag, (r)->r_bushandle, (o), (v))
584 #define bus_write_multi_2(r, o, d, c) \
585 bus_space_write_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
586 #define bus_write_region_2(r, o, d, c) \
587 bus_space_write_region_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
588 #define bus_read_stream_2(r, o) \
589 bus_space_read_stream_2((r)->r_bustag, (r)->r_bushandle, (o))
590 #define bus_read_multi_stream_2(r, o, d, c) \
591 bus_space_read_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
592 #define bus_read_region_stream_2(r, o, d, c) \
593 bus_space_read_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
594 #define bus_set_multi_stream_2(r, o, v, c) \
595 bus_space_set_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
596 #define bus_set_region_stream_2(r, o, v, c) \
597 bus_space_set_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
598 #define bus_write_stream_2(r, o, v) \
599 bus_space_write_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v))
600 #define bus_write_multi_stream_2(r, o, d, c) \
601 bus_space_write_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
602 #define bus_write_region_stream_2(r, o, d, c) \
603 bus_space_write_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
604 #define bus_poke_4(r, o, v) \
605 bus_space_poke_4((r)->r_bustag, (r)->r_bushandle, (o), (v))
606 #define bus_peek_4(r, o, vp) \
607 bus_space_peek_4((r)->r_bustag, (r)->r_bushandle, (o), (vp))
608 #define bus_read_4(r, o) \
609 bus_space_read_4((r)->r_bustag, (r)->r_bushandle, (o))
610 #define bus_read_multi_4(r, o, d, c) \
611 bus_space_read_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
612 #define bus_read_region_4(r, o, d, c) \
613 bus_space_read_region_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
614 #define bus_set_multi_4(r, o, v, c) \
615 bus_space_set_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
616 #define bus_set_region_4(r, o, v, c) \
617 bus_space_set_region_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
618 #define bus_write_4(r, o, v) \
619 bus_space_write_4((r)->r_bustag, (r)->r_bushandle, (o), (v))
620 #define bus_write_multi_4(r, o, d, c) \
621 bus_space_write_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
622 #define bus_write_region_4(r, o, d, c) \
623 bus_space_write_region_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
624 #define bus_read_stream_4(r, o) \
625 bus_space_read_stream_4((r)->r_bustag, (r)->r_bushandle, (o))
626 #define bus_read_multi_stream_4(r, o, d, c) \
627 bus_space_read_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
628 #define bus_read_region_stream_4(r, o, d, c) \
629 bus_space_read_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
630 #define bus_set_multi_stream_4(r, o, v, c) \
631 bus_space_set_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
632 #define bus_set_region_stream_4(r, o, v, c) \
633 bus_space_set_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
634 #define bus_write_stream_4(r, o, v) \
635 bus_space_write_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v))
636 #define bus_write_multi_stream_4(r, o, d, c) \
637 bus_space_write_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
638 #define bus_write_region_stream_4(r, o, d, c) \
639 bus_space_write_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
640 #define bus_poke_8(r, o, v) \
641 bus_space_poke_8((r)->r_bustag, (r)->r_bushandle, (o), (v))
642 #define bus_peek_8(r, o, vp) \
643 bus_space_peek_8((r)->r_bustag, (r)->r_bushandle, (o), (vp))
644 #define bus_read_8(r, o) \
645 bus_space_read_8((r)->r_bustag, (r)->r_bushandle, (o))
646 #define bus_read_multi_8(r, o, d, c) \
647 bus_space_read_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
648 #define bus_read_region_8(r, o, d, c) \
649 bus_space_read_region_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
650 #define bus_set_multi_8(r, o, v, c) \
651 bus_space_set_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
652 #define bus_set_region_8(r, o, v, c) \
653 bus_space_set_region_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
654 #define bus_write_8(r, o, v) \
655 bus_space_write_8((r)->r_bustag, (r)->r_bushandle, (o), (v))
656 #define bus_write_multi_8(r, o, d, c) \
657 bus_space_write_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
658 #define bus_write_region_8(r, o, d, c) \
659 bus_space_write_region_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
660 #define bus_read_stream_8(r, o) \
661 bus_space_read_stream_8((r)->r_bustag, (r)->r_bushandle, (o))
662 #define bus_read_multi_stream_8(r, o, d, c) \
663 bus_space_read_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
664 #define bus_read_region_stream_8(r, o, d, c) \
665 bus_space_read_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
666 #define bus_set_multi_stream_8(r, o, v, c) \
667 bus_space_set_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
668 #define bus_set_region_stream_8(r, o, v, c) \
669 bus_space_set_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
670 #define bus_write_stream_8(r, o, v) \
671 bus_space_write_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v))
672 #define bus_write_multi_stream_8(r, o, d, c) \
673 bus_space_write_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
674 #define bus_write_region_stream_8(r, o, d, c) \
675 bus_space_write_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
676
677 #endif /* !_SYS_BUS_H_ */
678