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