device_calls revision 1.2
11.2Sthorpej$NetBSD: device_calls,v 1.2 2025/09/08 00:12:21 thorpej Exp $
21.1Sthorpej
31.1Sthorpej/*-
41.1Sthorpej * Copyright (c) 2021 The NetBSD Foundation, Inc.
51.1Sthorpej * All rights reserved.
61.1Sthorpej *
71.1Sthorpej * This code is derived from software contributed to The NetBSD Foundation
81.1Sthorpej * by Jason R. Thorpe.
91.1Sthorpej *
101.1Sthorpej * Redistribution and use in source and binary forms, with or without
111.1Sthorpej * modification, are permitted provided that the following conditions
121.1Sthorpej * are met:
131.1Sthorpej * 1. Redistributions of source code must retain the above copyright
141.1Sthorpej *    notice, this list of conditions and the following disclaimer.
151.1Sthorpej * 2. Redistributions in binary form must reproduce the above copyright
161.1Sthorpej *    notice, this list of conditions and the following disclaimer in the
171.1Sthorpej *    documentation and/or other materials provided with the distribution.
181.1Sthorpej *
191.1Sthorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201.1Sthorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211.1Sthorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221.1Sthorpej * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231.1Sthorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241.1Sthorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251.1Sthorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261.1Sthorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271.1Sthorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281.1Sthorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291.1Sthorpej * POSSIBILITY OF SUCH DAMAGE.
301.1Sthorpej */
311.1Sthorpej
321.1Sthorpej/*
331.1Sthorpej * Device calls used by the device autoconfiguration subsystem
341.1Sthorpej */
351.1Sthorpej
361.1Sthorpejsubsystem device;
371.1Sthorpej
381.1Sthorpej/*
391.1Sthorpej * device-enumerate-children
401.1Sthorpej *
411.1Sthorpej * Enumerates the direct children of a device, invoking the callback for
421.1Sthorpej * each one.  The callback is passed the devhandle_t corresponding to the
431.1Sthorpej * child device, as well as a user-supplied argument.  If the callback
441.1Sthorpej * returns true, then enumeration continues.  If the callback returns false,
451.1Sthorpej * enumeration is stopped.
461.1Sthorpej */
471.1Sthorpejdevice-enumerate-children {
481.1Sthorpej	bool	(*callback)(device_t, devhandle_t, void *);
491.1Sthorpej	void *	callback_arg;
501.1Sthorpej};
511.2Sthorpej
521.2Sthorpej/*
531.2Sthorpej * device-is-system-todr
541.2Sthorpej *
551.2Sthorpej * This is a filter that is considered when attaching the system TODR / RTC.
561.2Sthorpej * For systems which may have multiple TODR / RTC devices, the platform
571.2Sthorpej * device tree may have information about which is authoritative.  This is
581.2Sthorpej * an optional method, and in its absence, the system will proceed as if
591.2Sthorpej * the answer was "yes".
601.2Sthorpej */
611.2Sthorpejdevice-is-system-todr {
621.2Sthorpej	bool	result;		/* OUT */
631.2Sthorpej};
64