1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * Microsemi Switchtec PCIe Driver 4 * Copyright (c) 2017, Microsemi Corporation 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms and conditions of the GNU General Public License, 8 * version 2, as published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 * more details. 14 * 15 */ 16 17 #ifndef _UAPI_LINUX_SWITCHTEC_IOCTL_H 18 #define _UAPI_LINUX_SWITCHTEC_IOCTL_H 19 20 #include <linux/types.h> 21 22 #define SWITCHTEC_IOCTL_PART_CFG0 0 23 #define SWITCHTEC_IOCTL_PART_CFG1 1 24 #define SWITCHTEC_IOCTL_PART_IMG0 2 25 #define SWITCHTEC_IOCTL_PART_IMG1 3 26 #define SWITCHTEC_IOCTL_PART_NVLOG 4 27 #define SWITCHTEC_IOCTL_PART_VENDOR0 5 28 #define SWITCHTEC_IOCTL_PART_VENDOR1 6 29 #define SWITCHTEC_IOCTL_PART_VENDOR2 7 30 #define SWITCHTEC_IOCTL_PART_VENDOR3 8 31 #define SWITCHTEC_IOCTL_PART_VENDOR4 9 32 #define SWITCHTEC_IOCTL_PART_VENDOR5 10 33 #define SWITCHTEC_IOCTL_PART_VENDOR6 11 34 #define SWITCHTEC_IOCTL_PART_VENDOR7 12 35 #define SWITCHTEC_IOCTL_NUM_PARTITIONS 13 36 37 struct switchtec_ioctl_flash_info { 38 __u64 flash_length; 39 __u32 num_partitions; 40 __u32 padding; 41 }; 42 43 #define SWITCHTEC_IOCTL_PART_ACTIVE 1 44 #define SWITCHTEC_IOCTL_PART_RUNNING 2 45 46 struct switchtec_ioctl_flash_part_info { 47 __u32 flash_partition; 48 __u32 address; 49 __u32 length; 50 __u32 active; 51 }; 52 53 struct switchtec_ioctl_event_summary { 54 __u64 global; 55 __u64 part_bitmap; 56 __u32 local_part; 57 __u32 padding; 58 __u32 part[48]; 59 __u32 pff[48]; 60 }; 61 62 #define SWITCHTEC_IOCTL_EVENT_STACK_ERROR 0 63 #define SWITCHTEC_IOCTL_EVENT_PPU_ERROR 1 64 #define SWITCHTEC_IOCTL_EVENT_ISP_ERROR 2 65 #define SWITCHTEC_IOCTL_EVENT_SYS_RESET 3 66 #define SWITCHTEC_IOCTL_EVENT_FW_EXC 4 67 #define SWITCHTEC_IOCTL_EVENT_FW_NMI 5 68 #define SWITCHTEC_IOCTL_EVENT_FW_NON_FATAL 6 69 #define SWITCHTEC_IOCTL_EVENT_FW_FATAL 7 70 #define SWITCHTEC_IOCTL_EVENT_TWI_MRPC_COMP 8 71 #define SWITCHTEC_IOCTL_EVENT_TWI_MRPC_COMP_ASYNC 9 72 #define SWITCHTEC_IOCTL_EVENT_CLI_MRPC_COMP 10 73 #define SWITCHTEC_IOCTL_EVENT_CLI_MRPC_COMP_ASYNC 11 74 #define SWITCHTEC_IOCTL_EVENT_GPIO_INT 12 75 #define SWITCHTEC_IOCTL_EVENT_PART_RESET 13 76 #define SWITCHTEC_IOCTL_EVENT_MRPC_COMP 14 77 #define SWITCHTEC_IOCTL_EVENT_MRPC_COMP_ASYNC 15 78 #define SWITCHTEC_IOCTL_EVENT_DYN_PART_BIND_COMP 16 79 #define SWITCHTEC_IOCTL_EVENT_AER_IN_P2P 17 80 #define SWITCHTEC_IOCTL_EVENT_AER_IN_VEP 18 81 #define SWITCHTEC_IOCTL_EVENT_DPC 19 82 #define SWITCHTEC_IOCTL_EVENT_CTS 20 83 #define SWITCHTEC_IOCTL_EVENT_HOTPLUG 21 84 #define SWITCHTEC_IOCTL_EVENT_IER 22 85 #define SWITCHTEC_IOCTL_EVENT_THRESH 23 86 #define SWITCHTEC_IOCTL_EVENT_POWER_MGMT 24 87 #define SWITCHTEC_IOCTL_EVENT_TLP_THROTTLING 25 88 #define SWITCHTEC_IOCTL_EVENT_FORCE_SPEED 26 89 #define SWITCHTEC_IOCTL_EVENT_CREDIT_TIMEOUT 27 90 #define SWITCHTEC_IOCTL_EVENT_LINK_STATE 28 91 #define SWITCHTEC_IOCTL_EVENT_GFMS 29 92 #define SWITCHTEC_IOCTL_MAX_EVENTS 30 93 94 #define SWITCHTEC_IOCTL_EVENT_LOCAL_PART_IDX -1 95 #define SWITCHTEC_IOCTL_EVENT_IDX_ALL -2 96 97 #define SWITCHTEC_IOCTL_EVENT_FLAG_CLEAR (1 << 0) 98 #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_POLL (1 << 1) 99 #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_LOG (1 << 2) 100 #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_CLI (1 << 3) 101 #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_FATAL (1 << 4) 102 #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_POLL (1 << 5) 103 #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_LOG (1 << 6) 104 #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_CLI (1 << 7) 105 #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_FATAL (1 << 8) 106 #define SWITCHTEC_IOCTL_EVENT_FLAG_UNUSED (~0x1ff) 107 108 struct switchtec_ioctl_event_ctl { 109 __u32 event_id; 110 __s32 index; 111 __u32 flags; 112 __u32 occurred; 113 __u32 count; 114 __u32 data[5]; 115 }; 116 117 #define SWITCHTEC_IOCTL_PFF_VEP 100 118 struct switchtec_ioctl_pff_port { 119 __u32 pff; 120 __u32 partition; 121 __u32 port; 122 }; 123 124 #define SWITCHTEC_IOCTL_FLASH_INFO \ 125 _IOR('W', 0x40, struct switchtec_ioctl_flash_info) 126 #define SWITCHTEC_IOCTL_FLASH_PART_INFO \ 127 _IOWR('W', 0x41, struct switchtec_ioctl_flash_part_info) 128 #define SWITCHTEC_IOCTL_EVENT_SUMMARY \ 129 _IOR('W', 0x42, struct switchtec_ioctl_event_summary) 130 #define SWITCHTEC_IOCTL_EVENT_CTL \ 131 _IOWR('W', 0x43, struct switchtec_ioctl_event_ctl) 132 #define SWITCHTEC_IOCTL_PFF_TO_PORT \ 133 _IOWR('W', 0x44, struct switchtec_ioctl_pff_port) 134 #define SWITCHTEC_IOCTL_PORT_TO_PFF \ 135 _IOWR('W', 0x45, struct switchtec_ioctl_pff_port) 136 137 #endif 138