1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 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 * $FreeBSD: releng/12.2/sys/sys/bus.h 360525 2020-05-01 09:46:27Z hselasky $ 29 */ 30 31 #ifndef _SYS_BUS_H_ 32 #define _SYS_BUS_H_ 33 34 #include <limits.h> 35 #include <sys/types.h> 36 #include <arm/include/_bus.h> 37 #include <sys/module.h> 38 #include <sys/queue.h> 39 #include <los_hwi.h> 40 41 typedef struct device *device_t; 42 43 typedef uint32_t u_int32_t; 44 45 /** 46 * @brief State of the device. 47 */ 48 typedef enum device_state { 49 DS_NOTPRESENT = 10, /**< @brief not probed or probe failed */ 50 DS_ALIVE = 20, /**< @brief probe succeeded */ 51 DS_ATTACHING = 25, /**< @brief currently attaching */ 52 DS_ATTACHED = 30, /**< @brief attach method called */ 53 DS_BUSY = 40 /**< @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 state */ 70 device_state_t dv_state; /**< @brief State of attachment */ 71 /* XXX more driver info? */ 72 }; 73 74 /* Flags exported via dv_flags. */ 75 #define DF_ENABLED 0x01 /* device should be probed/attached */ 76 #define DF_FIXEDCLASS 0x02 /* devclass specified at create time */ 77 #define DF_WILDCARD 0x04 /* unit was originally wildcard */ 78 #define DF_DESCMALLOCED 0x08 /* description was malloced */ 79 #define DF_QUIET 0x10 /* don't print verbose attach message */ 80 #define DF_DONENOMATCH 0x20 /* don't execute DEVICE_NOMATCH again */ 81 #define DF_EXTERNALSOFTC 0x40 /* softc not allocated by us */ 82 #define DF_REBID 0x80 /* Can rebid after attach */ 83 #define DF_SUSPENDED 0x100 /* Device is suspended. */ 84 85 #define SYS_RES_IRQ 1 /* interrupt lines */ 86 #define SYS_RES_DRQ 2 /* isa dma lines */ 87 #define SYS_RES_MEMORY 3 /* i/o memory */ 88 #define SYS_RES_IOPORT 4 /* i/o ports */ 89 90 #include <sys/kobj.h> 91 92 /** 93 * @brief A device driver (included mainly for compatibility with 94 * FreeBSD 4.x). 95 */ 96 typedef struct kobj_class driver_t; 97 98 /** 99 * @brief A device class 100 * 101 * The devclass object has two main functions in the system. The first 102 * is to manage the allocation of unit numbers for device instances 103 * and the second is to hold the list of device drivers for a 104 * particular bus type. Each devclass has a name and there cannot be 105 * two devclasses with the same name. This ensures that unique unit 106 * numbers are allocated to device instances. 107 * 108 * Drivers that support several different bus attachments (e.g. isa, 109 * pci, pccard) should all use the same devclass to ensure that unit 110 * numbers do not conflict. 111 * 112 * Each devclass may also have a parent devclass. This is used when 113 * searching for device drivers to allow a form of inheritance. When 114 * matching drivers with devices, first the driver list of the parent 115 * device's devclass is searched. If no driver is found in that list, 116 * the search continues in the parent devclass (if any). 117 */ 118 typedef struct devclass *devclass_t; 119 120 /** 121 * @brief A device method 122 */ 123 #define device_method_t kobj_method_t 124 125 /** 126 * @brief Driver interrupt filter return values 127 * 128 * If a driver provides an interrupt filter routine it must return an 129 * integer consisting of oring together zero or more of the following 130 * flags: 131 * 132 * FILTER_STRAY - this device did not trigger the interrupt 133 * FILTER_HANDLED - the interrupt has been fully handled and can be EOId 134 * FILTER_SCHEDULE_THREAD - the threaded interrupt handler should be 135 * scheduled to execute 136 * 137 * If the driver does not provide a filter, then the interrupt code will 138 * act is if the filter had returned FILTER_SCHEDULE_THREAD. Note that it 139 * is illegal to specify any other flag with FILTER_STRAY and that it is 140 * illegal to not specify either of FILTER_HANDLED or FILTER_SCHEDULE_THREAD 141 * if FILTER_STRAY is not specified. 142 */ 143 #define FILTER_STRAY 0x01 144 #define FILTER_HANDLED 0x02 145 #define FILTER_SCHEDULE_THREAD 0x04 146 147 /** 148 * @brief Driver interrupt service routines 149 * 150 * The filter routine is run in primary interrupt context and may not 151 * block or use regular mutexes. It may only use spin mutexes for 152 * synchronization. The filter may either completely handle the 153 * interrupt or it may perform some of the work and defer more 154 * expensive work to the regular interrupt handler. If a filter 155 * routine is not registered by the driver, then the regular interrupt 156 * handler is always used to handle interrupts from this device. 157 * 158 * The regular interrupt handler executes in its own thread context 159 * and may use regular mutexes. However, it is prohibited from 160 * sleeping on a sleep queue. 161 */ 162 typedef int driver_filter_t(void*); 163 typedef void driver_intr_t(int, void*); 164 165 /** 166 * @brief This structure is deprecated. 167 * 168 * Use the kobj(9) macro DEFINE_CLASS to 169 * declare classes which implement device drivers. 170 */ 171 struct driver { 172 KOBJ_CLASS_FIELDS; 173 }; 174 175 176 typedef uint64_t rman_res_t; 177 /* 178 * Definitions for drivers which need to keep simple lists of resources 179 * for their child devices. 180 */ 181 /* 182 * The public (kernel) view of struct resource 183 * 184 * NB: Changing the offset/size/type of existing fields in struct resource 185 * NB: breaks the device driver ABI and is strongly FORBIDDEN. 186 * NB: Appending new fields is probably just misguided. 187 */ 188 189 struct resource { 190 rman_res_t start; /**< @brief start of resource range */ 191 rman_res_t end; /**< @brief end of resource range */ 192 rman_res_t count; /**< @brief count within range */ 193 }; 194 195 /** 196 * @brief An entry for a single resource in a resource list. 197 */ 198 struct resource_list_entry { 199 STAILQ_ENTRY(resource_list_entry) link; 200 int type; /**< @brief type argument to alloc_resource */ 201 int rid; /**< @brief resource identifier */ 202 int flags; /**< @brief resource flags */ 203 struct resource *res; /**< @brief the real resource when allocated */ 204 }; 205 STAILQ_HEAD(resource_list, resource_list_entry); 206 207 #define RLE_RESERVED 0x0001 /* Reserved by the parent bus. */ 208 #define RLE_ALLOCATED 0x0002 /* Reserved resource is allocated. */ 209 #define RLE_PREFETCH 0x0004 /* Resource is a prefetch range. */ 210 211 void resource_list_init(struct resource_list *rl); 212 void resource_list_free(struct resource_list *rl); 213 struct resource_list_entry * 214 resource_list_add(struct resource_list *rl, 215 int type, int rid, 216 rman_res_t start, rman_res_t end, rman_res_t count); 217 struct resource_list_entry* 218 resource_list_find(struct resource_list *rl, 219 int type, int rid); 220 221 typedef void (*add_res_callback_t)(const char *devclass_name, int type, int unit, rman_res_t start, rman_res_t end, 222 rman_res_t count); 223 void machine_resource_init(add_res_callback_t callback); 224 225 /* 226 * The root bus, to which all top-level busses are attached. 227 */ 228 extern device_t root_bus; 229 extern devclass_t root_devclass; 230 void root_bus_configure(void); 231 232 extern device_t nexus; 233 234 /* 235 * Useful functions for implementing busses. 236 */ 237 int bus_generic_attach(device_t dev); 238 239 device_t 240 bus_generic_add_child(device_t dev, u_int order, const char *name, 241 int unit); 242 int bus_generic_child_present(device_t dev, device_t child); 243 244 int bus_generic_detach(device_t dev); 245 void bus_generic_driver_added(device_t dev, driver_t *driver); 246 int bus_generic_get_domain(device_t dev, device_t child, int *domain); 247 248 void bus_generic_new_pass(device_t dev); 249 int bus_print_child_header(device_t dev, device_t child); 250 int bus_print_child_domain(device_t dev, device_t child); 251 int bus_print_child_footer(device_t dev, device_t child); 252 int bus_generic_print_child(device_t dev, device_t child); 253 int bus_generic_probe(device_t dev); 254 int bus_generic_read_ivar(device_t dev, device_t child, int which, 255 uintptr_t *result); 256 int bus_generic_resume(device_t dev); 257 int bus_generic_resume_child(device_t dev, device_t child); 258 259 int bus_generic_shutdown(device_t dev); 260 int bus_generic_suspend(device_t dev); 261 int bus_generic_suspend_child(device_t dev, device_t child); 262 263 int bus_generic_write_ivar(device_t dev, device_t child, int which, 264 uintptr_t value); 265 int bus_helper_reset_post(device_t dev, int flags); 266 int bus_helper_reset_prepare(device_t dev, int flags); 267 int bus_null_rescan(device_t dev); 268 269 struct resource *bus_alloc_resource(device_t dev, int type, int *rid, 270 rman_res_t start, rman_res_t end, 271 rman_res_t count, u_int flags); 272 int bus_generic_resume(device_t dev); 273 int bus_generic_resume_child(device_t dev, device_t child); 274 275 int bus_child_location_str(device_t child, char *buf, size_t buflen); 276 277 static __inline struct resource * 278 bus_alloc_resource_any(device_t dev, int type, int *rid, u_int flags) 279 { 280 return (bus_alloc_resource(dev, type, rid, 0, ~0, 1, flags)); 281 } 282 283 /* 284 * Access functions for device. 285 */ 286 device_t device_add_child(device_t dev, const char *name, int unit); 287 device_t device_add_child_ordered(device_t dev, u_int order, 288 const char *name, int unit); 289 void device_busy(device_t dev); 290 int device_delete_child(device_t dev, device_t child); 291 int device_delete_children(device_t dev); 292 int device_attach(device_t dev); 293 int device_detach(device_t dev); 294 void device_disable(device_t dev); 295 void device_enable(device_t dev); 296 device_t device_find_child(device_t dev, const char *classname, 297 int unit); 298 const char *device_get_desc(device_t dev); 299 devclass_t device_get_devclass(device_t dev); 300 driver_t *device_get_driver(device_t dev); 301 u_int32_t device_get_flags(device_t dev); 302 device_t device_get_parent(device_t dev); 303 int device_get_children(device_t dev, device_t **listp, int *countp); 304 void *device_get_ivars(device_t dev); 305 void device_set_ivars(device_t dev, void *ivars); 306 const char *device_get_name(device_t dev); 307 const char *device_get_nameunit(device_t dev); 308 void *device_get_softc(device_t dev); 309 device_state_t device_get_state(device_t dev); 310 int device_get_unit(device_t dev); 311 struct sysctl_ctx_list *device_get_sysctl_ctx(device_t dev); 312 struct sysctl_oid *device_get_sysctl_tree(device_t dev); 313 int device_is_alive(device_t dev); /* did probe succeed? */ 314 int device_is_attached(device_t dev); /* did attach succeed? */ 315 int device_is_enabled(device_t dev); 316 int device_is_suspended(device_t dev); 317 int device_is_quiet(device_t dev); 318 device_t device_lookup_by_name(const char *name); 319 int device_print_prettyname(device_t dev); 320 int device_printf(device_t dev, const char *, ...) __printflike(2, 3); 321 int device_probe(device_t dev); 322 int device_probe_and_attach(device_t dev); 323 int device_probe_child(device_t bus, device_t dev); 324 int device_quiesce(device_t dev); 325 void device_quiet(device_t dev); 326 void device_set_desc(device_t dev, const char* desc); 327 void device_set_desc_copy(device_t dev, const char* desc); 328 int device_set_devclass(device_t dev, const char *classname); 329 int device_set_devclass_fixed(device_t dev, const char *classname); 330 int device_set_driver(device_t dev, driver_t *driver); 331 void device_set_flags(device_t dev, u_int32_t flags); 332 void device_set_softc(device_t dev, void *softc); 333 void device_free_softc(void *softc); 334 void device_claim_softc(device_t dev); 335 int device_set_unit(device_t dev, int unit); /* XXX DONT USE XXX */ 336 int device_shutdown(device_t dev); 337 void device_unbusy(device_t dev); 338 void device_verbose(device_t dev); 339 340 /* port for interrupt setup and teardown */ 341 int bus_setup_intr(int irq, int flags, driver_intr_t *intr, void *arg); 342 int bus_teardown_intr(int irq, void *arg); 343 344 /* 345 * Access functions for devclass. 346 */ 347 int devclass_add_driver(devclass_t dc, driver_t *driver, 348 int pass, devclass_t *dcp); 349 devclass_t devclass_create(const char *classname); 350 int devclass_delete_driver(devclass_t busclass, driver_t *driver); 351 devclass_t devclass_find(const char *classname); 352 const char *devclass_get_name(devclass_t dc); 353 device_t devclass_get_device(devclass_t dc, int unit); 354 void *devclass_get_softc(devclass_t dc, int unit); 355 int devclass_get_devices(devclass_t dc, device_t **listp, int *countp); 356 int devclass_get_drivers(devclass_t dc, driver_t ***listp, int *countp); 357 int devclass_get_count(devclass_t dc); 358 int devclass_get_maxunit(devclass_t dc); 359 int devclass_find_free_unit(devclass_t dc, int unit); 360 void devclass_set_parent(devclass_t dc, devclass_t pdc); 361 devclass_t devclass_get_parent(devclass_t dc); 362 363 /* 364 * Functions for maintaining and checking consistency of 365 * bus information exported to userspace. 366 */ 367 int bus_data_generation_check(int generation); 368 void bus_data_generation_update(void); 369 370 /** 371 * Some convenience defines for probe routines to return. These are just 372 * suggested values, and there's nothing magical about them. 373 * BUS_PROBE_SPECIFIC is for devices that cannot be reprobed, and that no 374 * possible other driver may exist (typically legacy drivers who don't fallow 375 * all the rules, or special needs drivers). BUS_PROBE_VENDOR is the 376 * suggested value that vendor supplied drivers use. This is for source or 377 * binary drivers that are not yet integrated into the FreeBSD tree. Its use 378 * in the base OS is prohibited. BUS_PROBE_DEFAULT is the normal return value 379 * for drivers to use. It is intended that nearly all of the drivers in the 380 * tree should return this value. BUS_PROBE_LOW_PRIORITY are for drivers that 381 * have special requirements like when there are two drivers that support 382 * overlapping series of hardware devices. In this case the one that supports 383 * the older part of the line would return this value, while the one that 384 * supports the newer ones would return BUS_PROBE_DEFAULT. BUS_PROBE_GENERIC 385 * is for drivers that wish to have a generic form and a specialized form, 386 * like is done with the pci bus and the acpi pci bus. BUS_PROBE_HOOVER is 387 * for those busses that implement a generic device place-holder for devices on 388 * the bus that have no more specific driver for them (aka ugen). 389 * BUS_PROBE_NOWILDCARD or lower means that the device isn't really bidding 390 * for a device node, but accepts only devices that its parent has told it 391 * use this driver. 392 */ 393 #define BUS_PROBE_SPECIFIC 0 /* Only I can use this device */ 394 #define BUS_PROBE_VENDOR (-10) /* Vendor supplied driver */ 395 #define BUS_PROBE_DEFAULT (-20) /* Base OS default driver */ 396 #define BUS_PROBE_LOW_PRIORITY (-40) /* Older, less desirable drivers */ 397 #define BUS_PROBE_GENERIC (-100) /* generic driver for dev */ 398 #define BUS_PROBE_HOOVER (-1000000) /* Driver for any dev on bus */ 399 #define BUS_PROBE_NOWILDCARD (-2000000000) /* No wildcard device matches */ 400 401 /** 402 * During boot, the device tree is scanned multiple times. Each scan, 403 * or pass, drivers may be attached to devices. Each driver 404 * attachment is assigned a pass number. Drivers may only probe and 405 * attach to devices if their pass number is less than or equal to the 406 * current system-wide pass number. The default pass is the last pass 407 * and is used by most drivers. Drivers needed by the scheduler are 408 * probed in earlier passes. 409 */ 410 #define BUS_PASS_ROOT 0 /* Used to attach root0. */ 411 #define BUS_PASS_BUS 10 /* Busses and bridges. */ 412 #define BUS_PASS_CPU 20 /* CPU devices. */ 413 #define BUS_PASS_RESOURCE 30 /* Resource discovery. */ 414 #define BUS_PASS_INTERRUPT 40 /* Interrupt controllers. */ 415 #define BUS_PASS_TIMER 50 /* Timers and clocks. */ 416 #define BUS_PASS_SCHEDULER 60 /* Start scheduler. */ 417 #define BUS_PASS_DEFAULT INT_MAX /* Everything else. */ 418 419 #define BUS_PASS_ORDER_FIRST 0 420 #define BUS_PASS_ORDER_EARLY 2 421 #define BUS_PASS_ORDER_MIDDLE 5 422 #define BUS_PASS_ORDER_LATE 7 423 #define BUS_PASS_ORDER_LAST 9 424 425 extern int bus_current_pass; 426 427 void bus_set_pass(int pass); 428 429 /** 430 * Shorthands for constructing method tables. 431 */ 432 #define DEVMETHOD KOBJMETHOD 433 #define DEVMETHOD_END KOBJMETHOD_END 434 435 /* 436 * Some common device interfaces. 437 */ 438 #include "device_if.h" 439 #include "bus_if.h" 440 441 struct module; 442 443 int driver_module_handler(struct module *, int, void *); 444 445 /** 446 * Module support for automatically adding drivers to busses. 447 */ 448 struct driver_module_data { 449 int (*dmd_chainevh)(struct module *, int, void *); 450 void *dmd_chainarg; 451 const char *dmd_busname; 452 kobj_class_t dmd_driver; 453 devclass_t *dmd_devclass; 454 int dmd_pass; 455 }; 456 457 #define EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ 458 evh, arg, order, pass) \ 459 \ 460 /*static */struct driver_module_data name##_##busname##_driver_mod = { \ 461 evh, arg, \ 462 #busname, \ 463 (kobj_class_t) &driver, \ 464 &devclass, \ 465 pass \ 466 }; \ 467 \ 468 /*static */moduledata_t name##_##busname##_mod = { \ 469 #busname "/" #name, \ 470 driver_module_handler, \ 471 &name##_##busname##_driver_mod \ 472 }; \ 473 DECLARE_MODULE(name##_##busname, name##_##busname##_mod, \ 474 SI_SUB_DRIVERS, order) 475 476 #define EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, pass) \ 477 EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ 478 evh, arg, SI_ORDER_MIDDLE, pass) 479 480 #define DRIVER_MODULE_ORDERED(name, busname, driver, devclass, evh, arg,\ 481 order) \ 482 EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ 483 evh, arg, order, BUS_PASS_DEFAULT) 484 485 #define DRIVER_MODULE(name, busname, driver, devclass, evh, arg) \ 486 EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, \ 487 BUS_PASS_DEFAULT) 488 489 /** 490 * Generic ivar accessor generation macros for bus drivers 491 */ 492 #define __BUS_ACCESSOR(varp, var, ivarp, ivar, type) \ 493 \ 494 static __inline type varp ## _get_ ## var(device_t dev) \ 495 { \ 496 uintptr_t v; \ 497 int e; \ 498 e = BUS_READ_IVAR(device_get_parent(dev), dev, \ 499 ivarp ## _IVAR_ ## ivar, &v); \ 500 if (e != 0) { \ 501 device_printf(dev, "failed to read ivar " \ 502 __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \ 503 "error = %d\n", \ 504 device_get_nameunit(device_get_parent(dev)), e); \ 505 } \ 506 return ((type) v); \ 507 } \ 508 \ 509 static __inline void varp ## _set_ ## var(device_t dev, type t) \ 510 { \ 511 uintptr_t v = (uintptr_t) t; \ 512 int e; \ 513 e = BUS_WRITE_IVAR(device_get_parent(dev), dev, \ 514 ivarp ## _IVAR_ ## ivar, v); \ 515 if (e != 0) { \ 516 device_printf(dev, "failed to write ivar " \ 517 __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \ 518 "error = %d\n", \ 519 device_get_nameunit(device_get_parent(dev)), e); \ 520 } \ 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 659 #endif /* !_SYS_BUS_H_ */ 660