1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 252eabba5SLogan Gunthorpe /* 352eabba5SLogan Gunthorpe * Microsemi Switchtec PCIe Driver 452eabba5SLogan Gunthorpe * Copyright (c) 2017, Microsemi Corporation 552eabba5SLogan Gunthorpe * 652eabba5SLogan Gunthorpe * This program is free software; you can redistribute it and/or modify it 752eabba5SLogan Gunthorpe * under the terms and conditions of the GNU General Public License, 852eabba5SLogan Gunthorpe * version 2, as published by the Free Software Foundation. 952eabba5SLogan Gunthorpe * 1052eabba5SLogan Gunthorpe * This program is distributed in the hope it will be useful, but WITHOUT 1152eabba5SLogan Gunthorpe * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1252eabba5SLogan Gunthorpe * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 1352eabba5SLogan Gunthorpe * more details. 1452eabba5SLogan Gunthorpe * 1552eabba5SLogan Gunthorpe */ 1652eabba5SLogan Gunthorpe 1752eabba5SLogan Gunthorpe #ifndef _UAPI_LINUX_SWITCHTEC_IOCTL_H 1852eabba5SLogan Gunthorpe #define _UAPI_LINUX_SWITCHTEC_IOCTL_H 1952eabba5SLogan Gunthorpe 2052eabba5SLogan Gunthorpe #include <linux/types.h> 2152eabba5SLogan Gunthorpe 2252eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_CFG0 0 2352eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_CFG1 1 2452eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_IMG0 2 2552eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_IMG1 3 2652eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_NVLOG 4 2752eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_VENDOR0 5 2852eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_VENDOR1 6 2952eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_VENDOR2 7 3052eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_VENDOR3 8 3152eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_VENDOR4 9 3252eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_VENDOR5 10 3352eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_VENDOR6 11 3452eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_VENDOR7 12 35*4efa1d2eSKelvin Cao #define SWITCHTEC_IOCTL_PART_BL2_0 13 36*4efa1d2eSKelvin Cao #define SWITCHTEC_IOCTL_PART_BL2_1 14 37*4efa1d2eSKelvin Cao #define SWITCHTEC_IOCTL_PART_MAP_0 15 38*4efa1d2eSKelvin Cao #define SWITCHTEC_IOCTL_PART_MAP_1 16 39*4efa1d2eSKelvin Cao #define SWITCHTEC_IOCTL_PART_KEY_0 17 40*4efa1d2eSKelvin Cao #define SWITCHTEC_IOCTL_PART_KEY_1 18 41*4efa1d2eSKelvin Cao 42fcccd282SLogan Gunthorpe #define SWITCHTEC_NUM_PARTITIONS_GEN3 13 43*4efa1d2eSKelvin Cao #define SWITCHTEC_NUM_PARTITIONS_GEN4 19 44fcccd282SLogan Gunthorpe 45fcccd282SLogan Gunthorpe /* obsolete: for compatibility with old userspace software */ 46fcccd282SLogan Gunthorpe #define SWITCHTEC_IOCTL_NUM_PARTITIONS SWITCHTEC_NUM_PARTITIONS_GEN3 4752eabba5SLogan Gunthorpe 4852eabba5SLogan Gunthorpe struct switchtec_ioctl_flash_info { 4952eabba5SLogan Gunthorpe __u64 flash_length; 5052eabba5SLogan Gunthorpe __u32 num_partitions; 5152eabba5SLogan Gunthorpe __u32 padding; 5252eabba5SLogan Gunthorpe }; 5352eabba5SLogan Gunthorpe 54079e3bc5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_ACTIVE 1 55079e3bc5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PART_RUNNING 2 56079e3bc5SLogan Gunthorpe 5752eabba5SLogan Gunthorpe struct switchtec_ioctl_flash_part_info { 5852eabba5SLogan Gunthorpe __u32 flash_partition; 5952eabba5SLogan Gunthorpe __u32 address; 6052eabba5SLogan Gunthorpe __u32 length; 6152eabba5SLogan Gunthorpe __u32 active; 6252eabba5SLogan Gunthorpe }; 6352eabba5SLogan Gunthorpe 64ba8a3982SWesley Sheng struct switchtec_ioctl_event_summary_legacy { 6552eabba5SLogan Gunthorpe __u64 global; 6652eabba5SLogan Gunthorpe __u64 part_bitmap; 6752eabba5SLogan Gunthorpe __u32 local_part; 6852eabba5SLogan Gunthorpe __u32 padding; 6952eabba5SLogan Gunthorpe __u32 part[48]; 7052eabba5SLogan Gunthorpe __u32 pff[48]; 7152eabba5SLogan Gunthorpe }; 7252eabba5SLogan Gunthorpe 73ba8a3982SWesley Sheng struct switchtec_ioctl_event_summary { 74ba8a3982SWesley Sheng __u64 global; 75ba8a3982SWesley Sheng __u64 part_bitmap; 76ba8a3982SWesley Sheng __u32 local_part; 77ba8a3982SWesley Sheng __u32 padding; 78ba8a3982SWesley Sheng __u32 part[48]; 79ba8a3982SWesley Sheng __u32 pff[255]; 80ba8a3982SWesley Sheng }; 81ba8a3982SWesley Sheng 8252eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_STACK_ERROR 0 8352eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_PPU_ERROR 1 8452eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_ISP_ERROR 2 8552eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_SYS_RESET 3 8652eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FW_EXC 4 8752eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FW_NMI 5 8852eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FW_NON_FATAL 6 8952eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FW_FATAL 7 9052eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_TWI_MRPC_COMP 8 9152eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_TWI_MRPC_COMP_ASYNC 9 9252eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_CLI_MRPC_COMP 10 9352eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_CLI_MRPC_COMP_ASYNC 11 9452eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_GPIO_INT 12 9552eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_PART_RESET 13 9652eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_MRPC_COMP 14 9752eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_MRPC_COMP_ASYNC 15 9852eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_DYN_PART_BIND_COMP 16 9952eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_AER_IN_P2P 17 10052eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_AER_IN_VEP 18 10152eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_DPC 19 10252eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_CTS 20 10352eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_HOTPLUG 21 10452eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_IER 22 10552eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_THRESH 23 10652eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_POWER_MGMT 24 10752eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_TLP_THROTTLING 25 10852eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FORCE_SPEED 26 10952eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_CREDIT_TIMEOUT 27 11052eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_LINK_STATE 28 111f0edce7aSLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_GFMS 29 112a6b0ef9aSLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_INTERCOMM_REQ_NOTIFY 30 113a6b0ef9aSLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_UEC 31 114a6b0ef9aSLogan Gunthorpe #define SWITCHTEC_IOCTL_MAX_EVENTS 32 11552eabba5SLogan Gunthorpe 11652eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_LOCAL_PART_IDX -1 11752eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_IDX_ALL -2 11852eabba5SLogan Gunthorpe 11952eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FLAG_CLEAR (1 << 0) 12052eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_POLL (1 << 1) 12152eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_LOG (1 << 2) 12252eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_CLI (1 << 3) 12352eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_FATAL (1 << 4) 12452eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_POLL (1 << 5) 12552eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_LOG (1 << 6) 12652eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_CLI (1 << 7) 12752eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_FATAL (1 << 8) 12852eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_FLAG_UNUSED (~0x1ff) 12952eabba5SLogan Gunthorpe 13052eabba5SLogan Gunthorpe struct switchtec_ioctl_event_ctl { 13152eabba5SLogan Gunthorpe __u32 event_id; 13252eabba5SLogan Gunthorpe __s32 index; 13352eabba5SLogan Gunthorpe __u32 flags; 13452eabba5SLogan Gunthorpe __u32 occurred; 13552eabba5SLogan Gunthorpe __u32 count; 13652eabba5SLogan Gunthorpe __u32 data[5]; 13752eabba5SLogan Gunthorpe }; 13852eabba5SLogan Gunthorpe 13952eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PFF_VEP 100 14052eabba5SLogan Gunthorpe struct switchtec_ioctl_pff_port { 14152eabba5SLogan Gunthorpe __u32 pff; 14252eabba5SLogan Gunthorpe __u32 partition; 14352eabba5SLogan Gunthorpe __u32 port; 14452eabba5SLogan Gunthorpe }; 14552eabba5SLogan Gunthorpe 14652eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_FLASH_INFO \ 14752eabba5SLogan Gunthorpe _IOR('W', 0x40, struct switchtec_ioctl_flash_info) 14852eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_FLASH_PART_INFO \ 14952eabba5SLogan Gunthorpe _IOWR('W', 0x41, struct switchtec_ioctl_flash_part_info) 15052eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_SUMMARY \ 15152eabba5SLogan Gunthorpe _IOR('W', 0x42, struct switchtec_ioctl_event_summary) 152ba8a3982SWesley Sheng #define SWITCHTEC_IOCTL_EVENT_SUMMARY_LEGACY \ 153ba8a3982SWesley Sheng _IOR('W', 0x42, struct switchtec_ioctl_event_summary_legacy) 15452eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_EVENT_CTL \ 15552eabba5SLogan Gunthorpe _IOWR('W', 0x43, struct switchtec_ioctl_event_ctl) 15652eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PFF_TO_PORT \ 15752eabba5SLogan Gunthorpe _IOWR('W', 0x44, struct switchtec_ioctl_pff_port) 15852eabba5SLogan Gunthorpe #define SWITCHTEC_IOCTL_PORT_TO_PFF \ 15952eabba5SLogan Gunthorpe _IOWR('W', 0x45, struct switchtec_ioctl_pff_port) 16052eabba5SLogan Gunthorpe 16152eabba5SLogan Gunthorpe #endif 162