Home | History | Annotate | Line # | Download | only in sys
      1 /*	$NetBSD: device_calls.h,v 1.2 2025/09/08 00:13:09 thorpej Exp $	*/
      2 
      3 /*
      4  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
      5  *
      6  * generated from:
      7  *	NetBSD: device_calls,v 1.2 2025/09/08 00:12:21 thorpej Exp
      8  */
      9 
     10 /*-
     11  * Copyright (c) 2021 The NetBSD Foundation, Inc.
     12  * All rights reserved.
     13  *
     14  * This code is derived from software contributed to The NetBSD Foundation
     15  * by Jason R. Thorpe.
     16  *
     17  * Redistribution and use in source and binary forms, with or without
     18  * modification, are permitted provided that the following conditions
     19  * are met:
     20  * 1. Redistributions of source code must retain the above copyright
     21  *    notice, this list of conditions and the following disclaimer.
     22  * 2. Redistributions in binary form must reproduce the above copyright
     23  *    notice, this list of conditions and the following disclaimer in the
     24  *    documentation and/or other materials provided with the distribution.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 /*
     40  * Device calls used by the device autoconfiguration subsystem
     41  */
     42 
     43 #ifndef _DEVICE_CALLS_H_
     44 #define _DEVICE_CALLS_H_
     45 
     46 #include <sys/device.h>
     47 
     48 /*
     49  * device-enumerate-children
     50  *
     51  * Enumerates the direct children of a device, invoking the callback for
     52  * each one.  The callback is passed the devhandle_t corresponding to the
     53  * child device, as well as a user-supplied argument.  If the callback
     54  * returns true, then enumeration continues.  If the callback returns false,
     55  * enumeration is stopped.
     56  */
     57 struct device_enumerate_children_args {
     58 	bool	(*callback)(device_t, devhandle_t, void *);
     59 	void *	callback_arg;
     60 };
     61 
     62 union device_enumerate_children_binding {
     63 	struct device_call_generic generic;
     64 	struct {
     65 		const char *name;
     66 		struct device_enumerate_children_args *args;
     67 	} binding;
     68 };
     69 
     70 #define DEVICE_ENUMERATE_CHILDREN_STR "device-enumerate-children"
     71 
     72 #define DEVICE_ENUMERATE_CHILDREN(_args_) \
     73 	&((const union device_enumerate_children_binding){ \
     74 		.binding.name = "device-enumerate-children", \
     75 		.binding.args = (_args_), \
     76 	})
     77 
     78 /*
     79  * device-is-system-todr
     80  *
     81  * This is a filter that is considered when attaching the system TODR / RTC.
     82  * For systems which may have multiple TODR / RTC devices, the platform
     83  * device tree may have information about which is authoritative.  This is
     84  * an optional method, and in its absence, the system will proceed as if
     85  * the answer was "yes".
     86  */
     87 struct device_is_system_todr_args {
     88 	bool	result;		/* OUT */
     89 };
     90 
     91 union device_is_system_todr_binding {
     92 	struct device_call_generic generic;
     93 	struct {
     94 		const char *name;
     95 		struct device_is_system_todr_args *args;
     96 	} binding;
     97 };
     98 
     99 #define DEVICE_IS_SYSTEM_TODR_STR "device-is-system-todr"
    100 
    101 #define DEVICE_IS_SYSTEM_TODR(_args_) \
    102 	&((const union device_is_system_todr_binding){ \
    103 		.binding.name = "device-is-system-todr", \
    104 		.binding.args = (_args_), \
    105 	})
    106 
    107 #endif /* _DEVICE_CALLS_H_ */
    108