16b293258SBenjamin Herrenschmidt /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 26b293258SBenjamin Herrenschmidt #ifndef _UAPI_LINUX_FSI_H 36b293258SBenjamin Herrenschmidt #define _UAPI_LINUX_FSI_H 46b293258SBenjamin Herrenschmidt 56b293258SBenjamin Herrenschmidt #include <linux/types.h> 66b293258SBenjamin Herrenschmidt #include <linux/ioctl.h> 76b293258SBenjamin Herrenschmidt 86b293258SBenjamin Herrenschmidt /* 96b293258SBenjamin Herrenschmidt * /dev/scom "raw" ioctl interface 106b293258SBenjamin Herrenschmidt * 116b293258SBenjamin Herrenschmidt * The driver supports a high level "read/write" interface which 126b293258SBenjamin Herrenschmidt * handles retries and converts the status to Linux error codes, 136b293258SBenjamin Herrenschmidt * however low level tools an debugger need to access the "raw" 146b293258SBenjamin Herrenschmidt * HW status information and interpret it themselves, so this 156b293258SBenjamin Herrenschmidt * ioctl interface is also provided for their use case. 166b293258SBenjamin Herrenschmidt */ 176b293258SBenjamin Herrenschmidt 186b293258SBenjamin Herrenschmidt /* Structure for SCOM read/write */ 196b293258SBenjamin Herrenschmidt struct scom_access { 206b293258SBenjamin Herrenschmidt __u64 addr; /* SCOM address, supports indirect */ 216b293258SBenjamin Herrenschmidt __u64 data; /* SCOM data (in for write, out for read) */ 226b293258SBenjamin Herrenschmidt __u64 mask; /* Data mask for writes */ 236b293258SBenjamin Herrenschmidt __u32 intf_errors; /* Interface error flags */ 246b293258SBenjamin Herrenschmidt #define SCOM_INTF_ERR_PARITY 0x00000001 /* Parity error */ 256b293258SBenjamin Herrenschmidt #define SCOM_INTF_ERR_PROTECTION 0x00000002 /* Blocked by secure boot */ 266b293258SBenjamin Herrenschmidt #define SCOM_INTF_ERR_ABORT 0x00000004 /* PIB reset during access */ 276b293258SBenjamin Herrenschmidt #define SCOM_INTF_ERR_UNKNOWN 0x80000000 /* Unknown error */ 286b293258SBenjamin Herrenschmidt /* 296b293258SBenjamin Herrenschmidt * Note: Any other bit set in intf_errors need to be considered as an 306b293258SBenjamin Herrenschmidt * error. Future implementations may define new error conditions. The 316b293258SBenjamin Herrenschmidt * pib_status below is only valid if intf_errors is 0. 326b293258SBenjamin Herrenschmidt */ 336b293258SBenjamin Herrenschmidt __u8 pib_status; /* 3-bit PIB status */ 346b293258SBenjamin Herrenschmidt #define SCOM_PIB_SUCCESS 0 /* Access successful */ 356b293258SBenjamin Herrenschmidt #define SCOM_PIB_BLOCKED 1 /* PIB blocked, pls retry */ 366b293258SBenjamin Herrenschmidt #define SCOM_PIB_OFFLINE 2 /* Chiplet offline */ 376b293258SBenjamin Herrenschmidt #define SCOM_PIB_PARTIAL 3 /* Partial good */ 386b293258SBenjamin Herrenschmidt #define SCOM_PIB_BAD_ADDR 4 /* Invalid address */ 396b293258SBenjamin Herrenschmidt #define SCOM_PIB_CLK_ERR 5 /* Clock error */ 406b293258SBenjamin Herrenschmidt #define SCOM_PIB_PARITY_ERR 6 /* Parity error on the PIB bus */ 416b293258SBenjamin Herrenschmidt #define SCOM_PIB_TIMEOUT 7 /* Bus timeout */ 426b293258SBenjamin Herrenschmidt __u8 pad; 436b293258SBenjamin Herrenschmidt }; 446b293258SBenjamin Herrenschmidt 456b293258SBenjamin Herrenschmidt /* Flags for SCOM check */ 466b293258SBenjamin Herrenschmidt #define SCOM_CHECK_SUPPORTED 0x00000001 /* Interface supported */ 476b293258SBenjamin Herrenschmidt #define SCOM_CHECK_PROTECTED 0x00000002 /* Interface blocked by secure boot */ 486b293258SBenjamin Herrenschmidt 496b293258SBenjamin Herrenschmidt /* Flags for SCOM reset */ 506b293258SBenjamin Herrenschmidt #define SCOM_RESET_INTF 0x00000001 /* Reset interface */ 516b293258SBenjamin Herrenschmidt #define SCOM_RESET_PIB 0x00000002 /* Reset PIB */ 526b293258SBenjamin Herrenschmidt 536b293258SBenjamin Herrenschmidt #define FSI_SCOM_CHECK _IOR('s', 0x00, __u32) 546b293258SBenjamin Herrenschmidt #define FSI_SCOM_READ _IOWR('s', 0x01, struct scom_access) 556b293258SBenjamin Herrenschmidt #define FSI_SCOM_WRITE _IOWR('s', 0x02, struct scom_access) 566b293258SBenjamin Herrenschmidt #define FSI_SCOM_RESET _IOW('s', 0x03, __u32) 576b293258SBenjamin Herrenschmidt 58a1dc6308SAmitay Isaacs /* 59a1dc6308SAmitay Isaacs * /dev/sbefifo* ioctl interface 60a1dc6308SAmitay Isaacs */ 61a1dc6308SAmitay Isaacs 62a1dc6308SAmitay Isaacs /** 63*19c064deSEddie James * FSI_SBEFIFO_CMD_TIMEOUT sets the timeout for writing data to the SBEFIFO. 64*19c064deSEddie James * 65*19c064deSEddie James * The command timeout is specified in seconds. The minimum value of command 66*19c064deSEddie James * timeout is 1 seconds (default) and the maximum value of command timeout is 67*19c064deSEddie James * 120 seconds. A command timeout of 0 will reset the value to the default of 68*19c064deSEddie James * 1 seconds. 69*19c064deSEddie James */ 70*19c064deSEddie James #define FSI_SBEFIFO_CMD_TIMEOUT_SECONDS _IOW('s', 0x01, __u32) 71*19c064deSEddie James 72*19c064deSEddie James /** 73a1dc6308SAmitay Isaacs * FSI_SBEFIFO_READ_TIMEOUT sets the read timeout for response from SBE. 74a1dc6308SAmitay Isaacs * 75a1dc6308SAmitay Isaacs * The read timeout is specified in seconds. The minimum value of read 76a1dc6308SAmitay Isaacs * timeout is 10 seconds (default) and the maximum value of read timeout is 77a1dc6308SAmitay Isaacs * 120 seconds. A read timeout of 0 will reset the value to the default of 78a1dc6308SAmitay Isaacs * (10 seconds). 79a1dc6308SAmitay Isaacs */ 80a1dc6308SAmitay Isaacs #define FSI_SBEFIFO_READ_TIMEOUT_SECONDS _IOW('s', 0x00, __u32) 81a1dc6308SAmitay Isaacs 826b293258SBenjamin Herrenschmidt #endif /* _UAPI_LINUX_FSI_H */ 83