Home | History | Annotate | Line # | Download | only in sys
      1 /* $NetBSD: drvctlio.h,v 1.7 2008/05/31 13:24:57 freza Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 2006 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Jason R. Thorpe.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  * POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 /* This interface is experimental and may change. */
     33 
     34 #ifndef _SYS_DRVCTLIO_H_
     35 #define _SYS_DRVCTLIO_H_
     36 
     37 #include <prop/proplib.h>
     38 #include <sys/ioccom.h>
     39 
     40 #define DRVCTLDEV "/dev/drvctl"
     41 
     42 struct devdetachargs {
     43 	char devname[16];
     44 };
     45 
     46 struct devlistargs {
     47 	char l_devname[16];
     48 	char (*l_childname)[16];
     49 	size_t l_children;
     50 };
     51 
     52 enum devpmflags {
     53 	DEVPM_F_SUBTREE = 0x1
     54 };
     55 
     56 struct devpmargs {
     57 	char devname[16];
     58 	uint32_t flags;
     59 };
     60 
     61 struct devrescanargs {
     62 	char busname[16];
     63 	char ifattr[16];
     64 	unsigned int numlocators;
     65 	int *locators;
     66 };
     67 
     68 #define DRVDETACHDEV _IOW('D', 123, struct devdetachargs)
     69 #define DRVRESCANBUS _IOW('D', 124, struct devrescanargs)
     70 #define	DRVCTLCOMMAND _IOWR('D', 125, struct plistref)
     71 #define DRVRESUMEDEV _IOW('D', 126, struct devpmargs)
     72 #define DRVLISTDEV _IOWR('D', 127, struct devlistargs)
     73 #define DRVGETEVENT _IOR('D', 128, struct plistref)
     74 #define DRVSUSPENDDEV _IOW('D', 129, struct devpmargs)
     75 
     76 /*
     77  * DRVCTLCOMMAND documentation
     78  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~
     79  *
     80  * Generic ioctl that takes a dictionary as an argument (specifies the
     81  * command and arguments) and returns a dictionary with the results.
     82  *
     83  * Command arguments are structured like so:
     84  *
     85  * <dict>
     86  *	<key>drvctl-command</key>
     87  *	<string>...</string>
     88  *	<!-- optional arguments -->
     89  *	<key>drvctl-arguments</key>
     90  *	<dict>
     91  *		<!-- arguments vary with command -->
     92  *	</dict>
     93  * </dict>
     94  *
     95  * Results are returned like so:
     96  *
     97  * <dict>
     98  *	<key>drvctl-error</key>
     99  *	<!-- 0 == success, otherwise an errno value -->
    100  *	<integer>...</integer>
    101  *	<!-- optional additional error message -->
    102  *	<key>drvctl-error-message</key>
    103  *	<string>...</string>
    104  *	<!-- optional results dictionary -->
    105  *	<key>drvctl-result-data</key>
    106  *	<dict>
    107  *		<!-- results vary with command -->
    108  *	</dict>
    109  * </dict>
    110  *
    111  *
    112  * Commands recognized by DRVCTLCOMMAND
    113  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    114  *
    115  * get-properties
    116  *
    117  * Arguments:
    118  *
    119  *	<dict>
    120  *		<key>device-name</key>
    121  *		<string>...</string>
    122  *	</dict>
    123  *
    124  * Results:
    125  *	<dict>
    126  *		<!-- contents of device's properties dictionary -->
    127  *	</dict>
    128  */
    129 
    130 #endif /* _SYS_DRVCTLIO_H_ */
    131