1 // Copyright 2016 The Fuchsia Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #pragma once 6 7 // clang-format off 8 9 // DEFAULT ioctls accept and received byte[] data 10 // the particular ioctl may define more specific structures 11 #define IOCTL_KIND_DEFAULT 0x0 12 13 // GET_HANDLE ioctls accept plain data and return 14 // a single handle, optionally followed by plain data 15 #define IOCTL_KIND_GET_HANDLE 0x1 16 17 // GET_TWO_HANDLES ioctls accept plain data and return 18 // two handles, optionally followed by plain data 19 #define IOCTL_KIND_GET_TWO_HANDLES 0x2 20 21 // GET_THREE_HANDLES ioctls accept plain data and return 22 // three handles, optionally followed by plain data 23 #define IOCTL_KIND_GET_THREE_HANDLES 0x4 24 25 // SET_HANDLE ioctls accept a handle, and optionally 26 // plain data afterwards. 27 #define IOCTL_KIND_SET_HANDLE 0x3 28 29 // SET_TWO_HANDLES ioctls accepts two handles, and 30 // optionally plain data afterwards. 31 #define IOCTL_KIND_SET_TWO_HANDLES 0x5 32 33 // core device/vfs ioctl families 34 #define IOCTL_FAMILY_RESERVED 0x00 35 #define IOCTL_FAMILY_DEVICE 0x01 36 #define IOCTL_FAMILY_VFS 0x02 37 #define IOCTL_FAMILY_DMCTL 0x03 38 #define IOCTL_FAMILY_TEST 0x04 39 40 // device protocol families 41 #define IOCTL_FAMILY_CONSOLE 0x10 42 #define IOCTL_FAMILY_INPUT 0x11 43 // 0x12 unused 44 #define IOCTL_FAMILY_BLOCK 0x13 45 #define IOCTL_FAMILY_I2C 0x14 46 #define IOCTL_FAMILY_USB_DEVICE 0x16 47 #define IOCTL_FAMILY_HID 0x17 48 // 0x18 unused 49 #define IOCTL_FAMILY_AUDIO 0x19 50 #define IOCTL_FAMILY_MIDI 0x1A 51 #define IOCTL_FAMILY_KTRACE 0x1B 52 #define IOCTL_FAMILY_BT_HCI 0x1C 53 #define IOCTL_FAMILY_SYSINFO 0x1D 54 // 0x1E unused 55 #define IOCTL_FAMILY_RTC 0x1F // ioctls for RTC 56 #define IOCTL_FAMILY_ETH 0x20 57 #define IOCTL_FAMILY_INSNTRACE 0x21 // ioctls for instruction tracing 58 #define IOCTL_FAMILY_RAMDISK 0x22 59 #define IOCTL_FAMILY_SDMMC 0x23 60 #define IOCTL_FAMILY_WLAN 0x24 61 #define IOCTL_FAMILY_PTY 0x25 62 #define IOCTL_FAMILY_NETCONFIG 0x26 63 #define IOCTL_FAMILY_ETHERTAP 0x27 64 #define IOCTL_FAMILY_USB_PERIPHERAL 0x28 65 #define IOCTL_FAMILY_USB_VIRT_BUS 0x29 66 #define IOCTL_FAMILY_CPUPERF 0x2A 67 #define IOCTL_FAMILY_POWER 0x30 68 #define IOCTL_FAMILY_THERMAL 0x31 69 #define IOCTL_FAMILY_CAMERA 0x32 70 #define IOCTL_FAMILY_BT_HOST 0x33 71 #define IOCTL_FAMILY_WLANPHY 0x34 72 #define IOCTL_FAMILY_SERIAL 0x35 73 #define IOCTL_FAMILY_WLANTAP 0x36 74 #define IOCTL_FAMILY_DISPLAY_CONTROLLER 0x37 75 #define IOCTL_FAMILY_DEBUG 0x38 76 #define IOCTL_FAMILY_AUDIO_CODEC 0x39 77 #define IOCTL_FAMILY_BACKLIGHT 0x3A 78 #define IOCTL_FAMILY_NAND_TEST 0x3B 79 #define IOCTL_FAMILY_TEE 0x3C 80 #define IOCTL_FAMILY_SKIP_BLOCK 0x3D 81 #define IOCTL_FAMILY_USB_TEST 0x3E 82 #define IOCTL_FAMILY_CLK 0x3F 83 // 0x40 unused. 84 #define IOCTL_FAMILY_QMI 0x41 85 86 // IOCTL constructor 87 // --K-FFNN 88 #define IOCTL(kind, family, number) \ 89 ((((kind) & 0xF) << 20) | (((family) & 0xFF) << 8) | ((number) & 0xFF)) 90 91 // IOCTL accessors 92 #define IOCTL_KIND(n) (((n) >> 20) & 0xF) 93 #define IOCTL_FAMILY(n) (((n) >> 8) & 0xFF) 94 #define IOCTL_NUMBER(n) ((n) & 0xFF) 95