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