github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/dev_i2c.txt (about) 1 # Copyright 2018 syzkaller project authors. All rights reserved. 2 # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 include <uapi/linux/i2c-dev.h> 5 include <uapi/linux/i2c.h> 6 7 define I2C_MAX_BLOCK_1 (I2C_SMBUS_BLOCK_MAX + 1) 8 define I2C_MAX_BLOCK_2 (I2C_SMBUS_BLOCK_MAX + 2) 9 10 resource fd_i2c[fd] 11 12 syz_open_dev$I2C(dev ptr[in, string["/dev/i2c-#"]], id intptr, flags flags[open_flags]) fd_i2c 13 14 ioctl$I2C_RETRIES(fd fd_i2c, cmd const[I2C_RETRIES], arg intptr) 15 ioctl$I2C_TIMEOUT(fd fd_i2c, cmd const[I2C_TIMEOUT], arg intptr) 16 ioctl$I2C_SLAVE(fd fd_i2c, cmd const[I2C_SLAVE], arg intptr[0:0x3ff]) 17 ioctl$I2C_SLAVE_FORCE(fd fd_i2c, cmd const[I2C_SLAVE_FORCE], arg intptr[0:0x3ff]) 18 ioctl$I2C_TENBIT(fd fd_i2c, cmd const[I2C_TENBIT], arg boolptr) 19 ioctl$I2C_PEC(fd fd_i2c, cmd const[I2C_PEC], arg intptr) 20 21 ioctl$I2C_FUNCS(fd fd_i2c, cmd const[I2C_FUNCS], arg ptr[in, intptr]) 22 ioctl$I2C_RDWR(fd fd_i2c, cmd const[I2C_RDWR], arg ptr[in, i2c_rdwr_ioctl_data]) 23 ioctl$I2C_SMBUS(fd fd_i2c, cmd const[I2C_SMBUS], arg ptr[in, i2c_smbus_ioctl_data]) 24 25 i2c_smbus_ioctl_data { 26 read_write bool8 27 command int8 28 size int32[I2C_SMBUS_QUICK:I2C_SMBUS_I2C_BLOCK_DATA] 29 data ptr[in, i2c_smbus_data] 30 } 31 32 i2c_smbus_data { 33 size int8[0:I2C_MAX_BLOCK_2] 34 block array[int8, I2C_MAX_BLOCK_1] 35 } 36 37 i2c_rdwr_ioctl_data { 38 msgs ptr[in, array[i2c_msg]] 39 nmsgs len[msgs, int32] 40 } 41 42 i2c_msg { 43 addr int16 44 flags flags[i2c_msg_flags, int16] 45 len len[buf, int16] 46 buf ptr[in, array[int8]] 47 } 48 49 i2c_msg_flags = I2C_M_RD, I2C_M_TEN, I2C_M_DMA_SAFE, I2C_M_RECV_LEN, I2C_M_NO_RD_ACK, I2C_M_IGNORE_NAK, I2C_M_REV_DIR_ADDR, I2C_M_NOSTART, I2C_M_STOP