]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/bhnd/bhnd_bus_if.m
MFV r296989:
[FreeBSD/FreeBSD.git] / sys / dev / bhnd / bhnd_bus_if.m
1 #-
2 # Copyright (c) 2015 Landon Fuller <landon@landonf.org>
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 ``AS IS'' AND ANY EXPRESS OR
15 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 # IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
18 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
23 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 #
25 # $FreeBSD$
26
27 #include <sys/types.h>
28 #include <sys/bus.h>
29 #include <sys/rman.h>
30
31 #include <dev/bhnd/bhnd_types.h>
32
33 INTERFACE bhnd_bus;
34
35 #
36 # bhnd(4) bus interface
37 #
38
39 HEADER {
40         /* forward declarations */
41         struct bhnd_board_info;
42         struct bhnd_core_info;
43         struct bhnd_chipid;
44         struct bhnd_devinfo;
45         struct bhnd_resource;
46 }
47
48 CODE {
49         #include <sys/systm.h>
50
51         #include <dev/bhnd/bhndvar.h>
52         
53         static struct bhnd_chipid *
54         bhnd_bus_null_get_chipid(device_t dev, device_t child)
55         {
56                 panic("bhnd_bus_get_chipid unimplemented");
57         }
58
59         static bhnd_attach_type
60         bhnd_bus_null_get_attach_type(device_t dev, device_t child)
61         {
62                 panic("bhnd_bus_get_attach_type unimplemented");
63         }
64
65         static int
66         bhnd_bus_null_read_board_info(device_t dev, device_t child,
67             struct bhnd_board_info *info)
68         {
69                 panic("bhnd_bus_read_boardinfo unimplemented");
70         }
71         
72         static void
73         bhnd_bus_null_child_added(device_t dev, device_t child)
74         {
75         }
76
77         static device_t
78         bhnd_bus_null_find_hostb_device(device_t dev)
79         {
80                 panic("bhnd_bus_find_hostb_device unimplemented");
81         }
82
83         static bool
84         bhnd_bus_null_is_hw_disabled(device_t dev, device_t child)
85         {
86                 panic("bhnd_bus_is_hw_disabled unimplemented");
87         }
88         
89         static int
90         bhnd_bus_null_get_probe_order(device_t dev, device_t child)
91         {
92                 panic("bhnd_bus_get_probe_order unimplemented");
93         }
94
95         static int
96         bhnd_bus_null_get_port_rid(device_t dev, device_t child,
97             bhnd_port_type port_type, u_int port, u_int region)
98         {
99                 return (-1);
100         }
101         
102         static int
103         bhnd_bus_null_decode_port_rid(device_t dev, device_t child, int type,
104             int rid, bhnd_port_type *port_type, u_int *port, u_int *region)
105         {
106                 return (ENOENT);
107         }
108
109         static int
110         bhnd_bus_null_get_region_addr(device_t dev, device_t child, 
111             bhnd_port_type type, u_int port, u_int region, bhnd_addr_t *addr,
112             bhnd_size_t *size)
113         {
114                 return (ENOENT);
115         }
116         
117         static int
118         bhnd_bus_null_get_nvram_var(device_t dev, device_t child,
119             const char *name, void *buf, size_t *size)
120         {
121                 return (ENODEV);
122         }
123
124 }
125
126 /**
127  * Return the active host bridge core for the bhnd bus, if any.
128  *
129  * @param dev The bhnd bus device.
130  *
131  * @retval device_t if a hostb device exists
132  * @retval NULL if no hostb device is found.
133  */
134 METHOD device_t find_hostb_device {
135         device_t dev;
136 } DEFAULT bhnd_bus_null_find_hostb_device;
137
138 /**
139  * Return true if the hardware components required by @p child are unpopulated
140  * or otherwise unusable.
141  *
142  * In some cases, enumerated devices may have pins that are left floating, or
143  * the hardware may otherwise be non-functional; this method allows a parent
144  * device to explicitly specify if a successfully enumerated @p child should
145  * be disabled.
146  *
147  * @param dev The device whose child is being examined.
148  * @param child The child device.
149  */
150 METHOD bool is_hw_disabled {
151         device_t dev;
152         device_t child;
153 } DEFAULT bhnd_bus_null_is_hw_disabled;
154
155 /**
156  * Return the probe (and attach) order for @p child. 
157  *
158  * All devices on the bhnd(4) bus will be probed, attached, or resumed in
159  * ascending order; they will be suspended, shutdown, and detached in
160  * descending order.
161  *
162  * The following device methods will be dispatched in ascending probe order
163  * by the bus:
164  *
165  * - DEVICE_PROBE()
166  * - DEVICE_ATTACH()
167  * - DEVICE_RESUME()
168  *
169  * The following device methods will be dispatched in descending probe order
170  * by the bus:
171  *
172  * - DEVICE_SHUTDOWN()
173  * - DEVICE_DETACH()
174  * - DEVICE_SUSPEND()
175  *
176  * @param dev The device whose child is being examined.
177  * @param child The child device.
178  *
179  * Refer to BHND_PROBE_* and BHND_PROBE_ORDER_* for the standard set of
180  * priorities.
181  */
182 METHOD int get_probe_order {
183         device_t dev;
184         device_t child;
185 } DEFAULT bhnd_bus_null_get_probe_order;
186
187 /**
188  * Return the BHND chip identification for the parent bus.
189  *
190  * @param dev The device whose child is being examined.
191  * @param child The child device.
192  */
193 METHOD const struct bhnd_chipid * get_chipid {
194         device_t dev;
195         device_t child;
196 } DEFAULT bhnd_bus_null_get_chipid;
197
198 /**
199  * Return the BHND attachment type of the parent bus.
200  *
201  * @param dev The device whose child is being examined.
202  * @param child The child device.
203  *
204  * @retval BHND_ATTACH_ADAPTER if the bus is resident on a bridged adapter,
205  * such as a WiFi chipset.
206  * @retval BHND_ATTACH_NATIVE if the bus provides hardware services (clock,
207  * CPU, etc) to a directly attached native host.
208  */
209 METHOD bhnd_attach_type get_attach_type {
210         device_t dev;
211         device_t child;
212 } DEFAULT bhnd_bus_null_get_attach_type;
213
214 /**
215  * Attempt to read the BHND board identification from the parent bus.
216  *
217  * This relies on NVRAM access, and will fail if a valid NVRAM device cannot
218  * be found, or is not yet attached.
219  *
220  * @param dev The parent of @p child.
221  * @param child The bhnd device requesting board info.
222  * @param[out] info On success, will be populated with the bhnd(4) device's
223  * board information.
224  *
225  * @retval 0 success
226  * @retval ENODEV       No valid NVRAM source could be found.
227  * @retval non-zero     If reading @p name otherwise fails, a regular unix
228  *                      error code will be returned.
229  */
230 METHOD int read_board_info {
231         device_t dev;
232         device_t child;
233         struct bhnd_board_info *info;
234 } DEFAULT bhnd_bus_null_read_board_info;
235
236 /**
237  * Allocate and zero-initialize a buffer suitably sized and aligned for a
238  * bhnd_devinfo structure.
239  *
240  * @param dev The bhnd bus device.
241  *
242  * @retval non-NULL     success
243  * @retval NULL         allocation failed
244  */
245 METHOD struct bhnd_devinfo * alloc_devinfo {
246         device_t dev;
247 };
248
249 /**
250  * Release memory previously allocated for @p devinfo.
251  *
252  * @param dev The bhnd bus device.
253  * @param dinfo A devinfo buffer previously allocated via
254  * BHND_BUS_ALLOC_DEVINFO().
255  */
256 METHOD void free_devinfo {
257         device_t dev;
258         struct bhnd_devinfo *dinfo;
259 };
260
261 /**
262  * Notify a bhnd bus that a child was added.
263  *
264  * Called at the end of BUS_ADD_CHILD() to allow the concrete bhnd(4)
265  * driver instance to initialize any additional driver-specific state for the
266  * child.
267  *
268  * @param dev The bhnd bus whose child is being added.
269  * @param child The child added to @p dev.
270  */
271 METHOD void child_added {
272         device_t dev;
273         device_t child;
274 } DEFAULT bhnd_bus_null_child_added;
275
276 /**
277  * Reset the device's hardware core.
278  *
279  * @param dev The parent of @p child.
280  * @param child The device to be reset.
281  * @param flags Device-specific core flags to be supplied on reset.
282  *
283  * @retval 0 success
284  * @retval non-zero error
285  */
286 METHOD int reset_core {
287         device_t dev;
288         device_t child;
289         uint16_t flags;
290 }
291
292 /**
293  * Suspend a device hardware core.
294  *
295  * @param dev The parent of @p child.
296  * @param child The device to be reset.
297  *
298  * @retval 0 success
299  * @retval non-zero error
300  */
301 METHOD int suspend_core {
302         device_t dev;
303         device_t child;
304 }
305
306 /**
307  * Allocate a bhnd resource.
308  *
309  * This method's semantics are functionally identical to the bus API of the same
310  * name; refer to BUS_ALLOC_RESOURCE for complete documentation.
311  */
312 METHOD struct bhnd_resource * alloc_resource {
313         device_t dev;
314         device_t child;
315         int type;
316         int *rid;
317         rman_res_t start;
318         rman_res_t end;
319         rman_res_t count;
320         u_int flags;
321 } DEFAULT bhnd_bus_generic_alloc_resource;
322
323 /**
324  * Release a bhnd resource.
325  *
326  * This method's semantics are functionally identical to the bus API of the same
327  * name; refer to BUS_RELEASE_RESOURCE for complete documentation.
328  */
329 METHOD int release_resource {
330         device_t dev;
331         device_t child;
332         int type;
333         int rid;
334         struct bhnd_resource *res;
335 } DEFAULT bhnd_bus_generic_release_resource;
336
337 /**
338  * Activate a bhnd resource.
339  *
340  * This method's semantics are functionally identical to the bus API of the same
341  * name; refer to BUS_ACTIVATE_RESOURCE for complete documentation.
342  */
343 METHOD int activate_resource {
344         device_t dev;
345         device_t child;
346         int type;
347         int rid;
348         struct bhnd_resource *r;
349 } DEFAULT bhnd_bus_generic_activate_resource;
350
351 /**
352  * Deactivate a bhnd resource.
353  *
354  * This method's semantics are functionally identical to the bus API of the same
355  * name; refer to BUS_DEACTIVATE_RESOURCE for complete documentation.
356  */
357 METHOD int deactivate_resource {
358         device_t dev;
359         device_t child;
360         int type;
361         int rid;
362         struct bhnd_resource *r;
363 } DEFAULT bhnd_bus_generic_deactivate_resource;
364
365 /**
366  * Return true if @p region_num is a valid region on @p port_num of
367  * @p type attached to @p child.
368  *
369  * @param dev The device whose child is being examined.
370  * @param child The child device.
371  * @param type The port type being queried.
372  * @param port_num The port number being queried.
373  * @param region_num The region number being queried.
374  */
375 METHOD bool is_region_valid {
376         device_t dev;
377         device_t child;
378         bhnd_port_type type;
379         u_int port_num;
380         u_int region_num;
381 };
382
383 /**
384  * Return the number of ports of type @p type attached to @p child.
385  *
386  * @param dev The device whose child is being examined.
387  * @param child The child device.
388  * @param type The port type being queried.
389  */
390 METHOD u_int get_port_count {
391         device_t dev;
392         device_t child;
393         bhnd_port_type type;
394 };
395
396 /**
397  * Return the number of memory regions mapped to @p child @p port of
398  * type @p type.
399  *
400  * @param dev The device whose child is being examined.
401  * @param child The child device.
402  * @param port The port number being queried.
403  * @param type The port type being queried.
404  */
405 METHOD u_int get_region_count {
406         device_t dev;
407         device_t child;
408         bhnd_port_type type;
409         u_int port;
410 };
411
412 /**
413  * Return the SYS_RES_MEMORY resource-ID for a port/region pair attached to
414  * @p child.
415  *
416  * @param dev The bus device.
417  * @param child The bhnd child.
418  * @param port_type The port type.
419  * @param port_num The index of the child interconnect port.
420  * @param region_num The index of the port-mapped address region.
421  *
422  * @retval -1 No such port/region found.
423  */
424 METHOD int get_port_rid {
425         device_t dev;
426         device_t child;
427         bhnd_port_type port_type;
428         u_int port_num;
429         u_int region_num;
430 } DEFAULT bhnd_bus_null_get_port_rid;
431
432
433 /**
434  * Decode a port / region pair on @p child defined by @p type and @p rid.
435  *
436  * @param dev The bus device.
437  * @param child The bhnd child.
438  * @param type The resource type.
439  * @param rid The resource ID.
440  * @param[out] port_type The port's type.
441  * @param[out] port The port identifier.
442  * @param[out] region The identifier of the memory region on @p port.
443  * 
444  * @retval 0 success
445  * @retval non-zero No matching type/rid found.
446  */
447 METHOD int decode_port_rid {
448         device_t dev;
449         device_t child;
450         int type;
451         int rid;
452         bhnd_port_type *port_type;
453         u_int *port;
454         u_int *region;
455 } DEFAULT bhnd_bus_null_decode_port_rid;
456
457 /**
458  * Get the address and size of @p region on @p port.
459  *
460  * @param dev The bus device.
461  * @param child The bhnd child.
462  * @param port_type The port type.
463  * @param port The port identifier.
464  * @param region The identifier of the memory region on @p port.
465  * @param[out] region_addr The region's base address.
466  * @param[out] region_size The region's size.
467  *
468  * @retval 0 success
469  * @retval non-zero No matching port/region found.
470  */
471 METHOD int get_region_addr {
472         device_t dev;
473         device_t child;
474         bhnd_port_type port_type;
475         u_int port;
476         u_int region;
477         bhnd_addr_t *region_addr;
478         bhnd_size_t *region_size;
479 } DEFAULT bhnd_bus_null_get_region_addr;
480
481 /**
482  * Read an NVRAM variable.
483  * 
484  * It is the responsibility of the bus to delegate this request to
485  * the appropriate NVRAM child device, or to a parent bus implementation.
486  *
487  * @param               dev     The bus device.
488  * @param               child   The requesting device.
489  * @param               name    The NVRAM variable name.
490  * @param[out]          buf     On success, the requested value will be written
491  *                              to this buffer. This argment may be NULL if
492  *                              the value is not desired.
493  * @param[in,out]       size    The capacity of @p buf. On success, will be set
494  *                              to the actual size of the requested value.
495  *
496  * @retval 0            success
497  * @retval ENOENT       The requested variable was not found.
498  * @retval ENOMEM       If @p buf is non-NULL and a buffer of @p size is too
499  *                      small to hold the requested value.
500  * @retval ENODEV       No valid NVRAM source could be found.
501  * @retval non-zero     If reading @p name otherwise fails, a regular unix
502  *                      error code will be returned.
503  */
504 METHOD int get_nvram_var {
505         device_t         dev;
506         device_t         child;
507         const char      *name;
508         void            *buf;
509         size_t          *size;
510 } DEFAULT bhnd_bus_null_get_nvram_var;
511
512
513 /** An implementation of bus_read_1() compatible with bhnd_resource */
514 METHOD uint8_t read_1 {
515         device_t dev;
516         device_t child;
517         struct bhnd_resource *r;
518         bus_size_t offset;
519 }
520
521 /** An implementation of bus_read_2() compatible with bhnd_resource */
522 METHOD uint16_t read_2 {
523         device_t dev;
524         device_t child;
525         struct bhnd_resource *r;
526         bus_size_t offset;
527 }
528
529 /** An implementation of bus_read_4() compatible with bhnd_resource */
530 METHOD uint32_t read_4 {
531         device_t dev;
532         device_t child;
533         struct bhnd_resource *r;
534         bus_size_t offset;
535 }
536
537 /** An implementation of bus_write_1() compatible with bhnd_resource */
538 METHOD void write_1 {
539         device_t dev;
540         device_t child;
541         struct bhnd_resource *r;
542         bus_size_t offset;
543         uint8_t value;
544 }
545
546 /** An implementation of bus_write_2() compatible with bhnd_resource */
547 METHOD void write_2 {
548         device_t dev;
549         device_t child;
550         struct bhnd_resource *r;
551         bus_size_t offset;
552         uint16_t value;
553 }
554
555 /** An implementation of bus_write_4() compatible with bhnd_resource */
556 METHOD void write_4 {
557         device_t dev;
558         device_t child;
559         struct bhnd_resource *r;
560         bus_size_t offset;
561         uint32_t value;
562 }
563
564 /** An implementation of bus_read_stream_1() compatible with bhnd_resource */
565 METHOD uint8_t read_stream_1 {
566         device_t dev;
567         device_t child;
568         struct bhnd_resource *r;
569         bus_size_t offset;
570 }
571
572 /** An implementation of bus_read_stream_2() compatible with bhnd_resource */
573 METHOD uint16_t read_stream_2 {
574         device_t dev;
575         device_t child;
576         struct bhnd_resource *r;
577         bus_size_t offset;
578 }
579
580 /** An implementation of bus_read_stream_4() compatible with bhnd_resource */
581 METHOD uint32_t read_stream_4 {
582         device_t dev;
583         device_t child;
584         struct bhnd_resource *r;
585         bus_size_t offset;
586 }
587
588 /** An implementation of bus_write_stream_1() compatible with bhnd_resource */
589 METHOD void write_stream_1 {
590         device_t dev;
591         device_t child;
592         struct bhnd_resource *r;
593         bus_size_t offset;
594         uint8_t value;
595 }
596
597 /** An implementation of bus_write_stream_2() compatible with bhnd_resource */
598 METHOD void write_stream_2 {
599         device_t dev;
600         device_t child;
601         struct bhnd_resource *r;
602         bus_size_t offset;
603         uint16_t value;
604 }
605
606 /** An implementation of bus_write_stream_4() compatible with bhnd_resource */
607 METHOD void write_stream_4 {
608         device_t dev;
609         device_t child;
610         struct bhnd_resource *r;
611         bus_size_t offset;
612         uint32_t value;
613 }
614
615 /** An implementation of bus_read_multi_1() compatible with bhnd_resource */
616 METHOD void read_multi_1 {
617         device_t dev;
618         device_t child;
619         struct bhnd_resource *r;
620         bus_size_t offset;
621         uint8_t *datap;
622         bus_size_t count;
623 }
624
625 /** An implementation of bus_read_multi_2() compatible with bhnd_resource */
626 METHOD void read_multi_2 {
627         device_t dev;
628         device_t child;
629         struct bhnd_resource *r;
630         bus_size_t offset;
631         uint16_t *datap;
632         bus_size_t count;
633 }
634
635 /** An implementation of bus_read_multi_4() compatible with bhnd_resource */
636 METHOD void read_multi_4 {
637         device_t dev;
638         device_t child;
639         struct bhnd_resource *r;
640         bus_size_t offset;
641         uint32_t *datap;
642         bus_size_t count;
643 }
644
645 /** An implementation of bus_write_multi_1() compatible with bhnd_resource */
646 METHOD void write_multi_1 {
647         device_t dev;
648         device_t child;
649         struct bhnd_resource *r;
650         bus_size_t offset;
651         uint8_t *datap;
652         bus_size_t count;
653 }
654
655 /** An implementation of bus_write_multi_2() compatible with bhnd_resource */
656 METHOD void write_multi_2 {
657         device_t dev;
658         device_t child;
659         struct bhnd_resource *r;
660         bus_size_t offset;
661         uint16_t *datap;
662         bus_size_t count;
663 }
664
665 /** An implementation of bus_write_multi_4() compatible with bhnd_resource */
666 METHOD void write_multi_4 {
667         device_t dev;
668         device_t child;
669         struct bhnd_resource *r;
670         bus_size_t offset;
671         uint32_t *datap;
672         bus_size_t count;
673 }
674
675 /** An implementation of bus_read_multi_stream_1() compatible
676  *  bhnd_resource */
677 METHOD void read_multi_stream_1 {
678         device_t dev;
679         device_t child;
680         struct bhnd_resource *r;
681         bus_size_t offset;
682         uint8_t *datap;
683         bus_size_t count;
684 }
685
686 /** An implementation of bus_read_multi_stream_2() compatible
687  *  bhnd_resource */
688 METHOD void read_multi_stream_2 {
689         device_t dev;
690         device_t child;
691         struct bhnd_resource *r;
692         bus_size_t offset;
693         uint16_t *datap;
694         bus_size_t count;
695 }
696
697 /** An implementation of bus_read_multi_stream_4() compatible
698  *  bhnd_resource */
699 METHOD void read_multi_stream_4 {
700         device_t dev;
701         device_t child;
702         struct bhnd_resource *r;
703         bus_size_t offset;
704         uint32_t *datap;
705         bus_size_t count;
706 }
707
708 /** An implementation of bus_write_multi_stream_1() compatible
709  *  bhnd_resource */
710 METHOD void write_multi_stream_1 {
711         device_t dev;
712         device_t child;
713         struct bhnd_resource *r;
714         bus_size_t offset;
715         uint8_t *datap;
716         bus_size_t count;
717 }
718
719 /** An implementation of bus_write_multi_stream_2() compatible with
720  *  bhnd_resource */
721 METHOD void write_multi_stream_2 {
722         device_t dev;
723         device_t child;
724         struct bhnd_resource *r;
725         bus_size_t offset;
726         uint16_t *datap;
727         bus_size_t count;
728 }
729
730 /** An implementation of bus_write_multi_stream_4() compatible with
731  *  bhnd_resource */
732 METHOD void write_multi_stream_4 {
733         device_t dev;
734         device_t child;
735         struct bhnd_resource *r;
736         bus_size_t offset;
737         uint32_t *datap;
738         bus_size_t count;
739 }
740
741 /** An implementation of bus_set_multi_1() compatible with bhnd_resource */
742 METHOD void set_multi_1 {
743         device_t dev;
744         device_t child;
745         struct bhnd_resource *r;
746         bus_size_t offset;
747         uint8_t value;
748         bus_size_t count;
749 }
750
751 /** An implementation of bus_set_multi_2() compatible with bhnd_resource */
752 METHOD void set_multi_2 {
753         device_t dev;
754         device_t child;
755         struct bhnd_resource *r;
756         bus_size_t offset;
757         uint16_t value;
758         bus_size_t count;
759 }
760
761 /** An implementation of bus_set_multi_4() compatible with bhnd_resource */
762 METHOD void set_multi_4 {
763         device_t dev;
764         device_t child;
765         struct bhnd_resource *r;
766         bus_size_t offset;
767         uint32_t value;
768         bus_size_t count;
769 }
770
771 /** An implementation of bus_set_region_1() compatible with bhnd_resource */
772 METHOD void set_region_1 {
773         device_t dev;
774         device_t child;
775         struct bhnd_resource *r;
776         bus_size_t offset;
777         uint8_t value;
778         bus_size_t count;
779 }
780
781 /** An implementation of bus_set_region_2() compatible with bhnd_resource */
782 METHOD void set_region_2 {
783         device_t dev;
784         device_t child;
785         struct bhnd_resource *r;
786         bus_size_t offset;
787         uint16_t value;
788         bus_size_t count;
789 }
790
791 /** An implementation of bus_set_region_4() compatible with bhnd_resource */
792 METHOD void set_region_4 {
793         device_t dev;
794         device_t child;
795         struct bhnd_resource *r;
796         bus_size_t offset;
797         uint32_t value;
798         bus_size_t count;
799 }
800
801 /** An implementation of bus_read_region_1() compatible with bhnd_resource */
802 METHOD void read_region_1 {
803         device_t dev;
804         device_t child;
805         struct bhnd_resource *r;
806         bus_size_t offset;
807         uint8_t *datap;
808         bus_size_t count;
809 }
810
811 /** An implementation of bus_read_region_2() compatible with bhnd_resource */
812 METHOD void read_region_2 {
813         device_t dev;
814         device_t child;
815         struct bhnd_resource *r;
816         bus_size_t offset;
817         uint16_t *datap;
818         bus_size_t count;
819 }
820
821 /** An implementation of bus_read_region_4() compatible with bhnd_resource */
822 METHOD void read_region_4 {
823         device_t dev;
824         device_t child;
825         struct bhnd_resource *r;
826         bus_size_t offset;
827         uint32_t *datap;
828         bus_size_t count;
829 }
830
831 /** An implementation of bus_read_region_stream_1() compatible with
832   * bhnd_resource */
833 METHOD void read_region_stream_1 {
834         device_t dev;
835         device_t child;
836         struct bhnd_resource *r;
837         bus_size_t offset;
838         uint8_t *datap;
839         bus_size_t count;
840 }
841
842 /** An implementation of bus_read_region_stream_2() compatible with
843   * bhnd_resource */
844 METHOD void read_region_stream_2 {
845         device_t dev;
846         device_t child;
847         struct bhnd_resource *r;
848         bus_size_t offset;
849         uint16_t *datap;
850         bus_size_t count;
851 }
852
853 /** An implementation of bus_read_region_stream_4() compatible with
854   * bhnd_resource */
855 METHOD void read_region_stream_4 {
856         device_t dev;
857         device_t child;
858         struct bhnd_resource *r;
859         bus_size_t offset;
860         uint32_t *datap;
861         bus_size_t count;
862 }
863
864 /** An implementation of bus_write_region_1() compatible with bhnd_resource */
865 METHOD void write_region_1 {
866         device_t dev;
867         device_t child;
868         struct bhnd_resource *r;
869         bus_size_t offset;
870         uint8_t *datap;
871         bus_size_t count;
872 }
873
874 /** An implementation of bus_write_region_2() compatible with bhnd_resource */
875 METHOD void write_region_2 {
876         device_t dev;
877         device_t child;
878         struct bhnd_resource *r;
879         bus_size_t offset;
880         uint16_t *datap;
881         bus_size_t count;
882 }
883
884 /** An implementation of bus_write_region_4() compatible with bhnd_resource */
885 METHOD void write_region_4 {
886         device_t dev;
887         device_t child;
888         struct bhnd_resource *r;
889         bus_size_t offset;
890         uint32_t *datap;
891         bus_size_t count;
892 }
893
894 /** An implementation of bus_write_region_stream_1() compatible with
895   * bhnd_resource */
896 METHOD void write_region_stream_1 {
897         device_t dev;
898         device_t child;
899         struct bhnd_resource *r;
900         bus_size_t offset;
901         uint8_t *datap;
902         bus_size_t count;
903 }
904
905 /** An implementation of bus_write_region_stream_2() compatible with
906   * bhnd_resource */
907 METHOD void write_region_stream_2 {
908         device_t dev;
909         device_t child;
910         struct bhnd_resource *r;
911         bus_size_t offset;
912         uint16_t *datap;
913         bus_size_t count;
914 }
915
916 /** An implementation of bus_write_region_stream_4() compatible with
917   * bhnd_resource */
918 METHOD void write_region_stream_4 {
919         device_t dev;
920         device_t child;
921         struct bhnd_resource *r;
922         bus_size_t offset;
923         uint32_t *datap;
924         bus_size_t count;
925 }
926
927 /** An implementation of bus_barrier() compatible with bhnd_resource */
928 METHOD void barrier {
929         device_t dev;
930         device_t child;
931         struct bhnd_resource *r;
932         bus_size_t offset;
933         bus_size_t length;
934         int flags;
935 }