xref: /netbsd-src/sys/sys/device_calls.h (revision 4ecce2b27a2f2020318319a080e331eea1ed3ad9)
1*4ecce2b2Sthorpej /*	$NetBSD: device_calls.h,v 1.1 2021/09/15 17:33:08 thorpej Exp $	*/
2*4ecce2b2Sthorpej 
3*4ecce2b2Sthorpej /*
4*4ecce2b2Sthorpej  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
5*4ecce2b2Sthorpej  *
6*4ecce2b2Sthorpej  * generated from:
7*4ecce2b2Sthorpej  *	NetBSD: device_calls,v 1.1 2021/09/15 17:26:06 thorpej Exp
8*4ecce2b2Sthorpej  */
9*4ecce2b2Sthorpej 
10*4ecce2b2Sthorpej /*-
11*4ecce2b2Sthorpej  * Copyright (c) 2021 The NetBSD Foundation, Inc.
12*4ecce2b2Sthorpej  * All rights reserved.
13*4ecce2b2Sthorpej  *
14*4ecce2b2Sthorpej  * This code is derived from software contributed to The NetBSD Foundation
15*4ecce2b2Sthorpej  * by Jason R. Thorpe.
16*4ecce2b2Sthorpej  *
17*4ecce2b2Sthorpej  * Redistribution and use in source and binary forms, with or without
18*4ecce2b2Sthorpej  * modification, are permitted provided that the following conditions
19*4ecce2b2Sthorpej  * are met:
20*4ecce2b2Sthorpej  * 1. Redistributions of source code must retain the above copyright
21*4ecce2b2Sthorpej  *    notice, this list of conditions and the following disclaimer.
22*4ecce2b2Sthorpej  * 2. Redistributions in binary form must reproduce the above copyright
23*4ecce2b2Sthorpej  *    notice, this list of conditions and the following disclaimer in the
24*4ecce2b2Sthorpej  *    documentation and/or other materials provided with the distribution.
25*4ecce2b2Sthorpej  *
26*4ecce2b2Sthorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27*4ecce2b2Sthorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28*4ecce2b2Sthorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29*4ecce2b2Sthorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30*4ecce2b2Sthorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31*4ecce2b2Sthorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32*4ecce2b2Sthorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33*4ecce2b2Sthorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34*4ecce2b2Sthorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35*4ecce2b2Sthorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36*4ecce2b2Sthorpej  * POSSIBILITY OF SUCH DAMAGE.
37*4ecce2b2Sthorpej  */
38*4ecce2b2Sthorpej 
39*4ecce2b2Sthorpej /*
40*4ecce2b2Sthorpej  * Device calls used by the device autoconfiguration subsystem
41*4ecce2b2Sthorpej  */
42*4ecce2b2Sthorpej 
43*4ecce2b2Sthorpej #ifndef _DEVICE_CALLS_H_
44*4ecce2b2Sthorpej #define _DEVICE_CALLS_H_
45*4ecce2b2Sthorpej 
46*4ecce2b2Sthorpej #include <sys/device.h>
47*4ecce2b2Sthorpej 
48*4ecce2b2Sthorpej /*
49*4ecce2b2Sthorpej  * device-enumerate-children
50*4ecce2b2Sthorpej  *
51*4ecce2b2Sthorpej  * Enumerates the direct children of a device, invoking the callback for
52*4ecce2b2Sthorpej  * each one.  The callback is passed the devhandle_t corresponding to the
53*4ecce2b2Sthorpej  * child device, as well as a user-supplied argument.  If the callback
54*4ecce2b2Sthorpej  * returns true, then enumeration continues.  If the callback returns false,
55*4ecce2b2Sthorpej  * enumeration is stopped.
56*4ecce2b2Sthorpej  */
57*4ecce2b2Sthorpej struct device_enumerate_children_args {
58*4ecce2b2Sthorpej 	bool	(*callback)(device_t, devhandle_t, void *);
59*4ecce2b2Sthorpej 	void *	callback_arg;
60*4ecce2b2Sthorpej };
61*4ecce2b2Sthorpej 
62*4ecce2b2Sthorpej union device_enumerate_children_binding {
63*4ecce2b2Sthorpej 	struct device_call_generic generic;
64*4ecce2b2Sthorpej 	struct {
65*4ecce2b2Sthorpej 		const char *name;
66*4ecce2b2Sthorpej 		struct device_enumerate_children_args *args;
67*4ecce2b2Sthorpej 	} binding;
68*4ecce2b2Sthorpej };
69*4ecce2b2Sthorpej 
70*4ecce2b2Sthorpej #define DEVICE_ENUMERATE_CHILDREN_STR "device-enumerate-children"
71*4ecce2b2Sthorpej 
72*4ecce2b2Sthorpej #define DEVICE_ENUMERATE_CHILDREN(_args_) \
73*4ecce2b2Sthorpej 	&((const union device_enumerate_children_binding){ \
74*4ecce2b2Sthorpej 		.binding.name = "device-enumerate-children", \
75*4ecce2b2Sthorpej 		.binding.args = (_args_), \
76*4ecce2b2Sthorpej 	})
77*4ecce2b2Sthorpej 
78*4ecce2b2Sthorpej #endif /* _DEVICE_CALLS_H_ */
79