blob: b45506d1f506b27f4ffc327215dde236af070b77 [file] [log] [blame]
Christopher Ferris05d08e92016-02-04 13:16:38 -08001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _LINUX__HFI1_USER_H
20#define _LINUX__HFI1_USER_H
21#include <linux/types.h>
Christopher Ferris106b3a82016-08-24 12:15:38 -070022#define HFI1_USER_SWMAJOR 6
Christopher Ferris48af7cb2017-02-21 12:35:09 -080023#define HFI1_USER_SWMINOR 3
Christopher Ferris106b3a82016-08-24 12:15:38 -070024#define HFI1_SWMAJOR_SHIFT 16
Christopher Ferris05d08e92016-02-04 13:16:38 -080025#define HFI1_CAP_DMA_RTAIL (1UL << 0)
26#define HFI1_CAP_SDMA (1UL << 1)
Christopher Ferris106b3a82016-08-24 12:15:38 -070027#define HFI1_CAP_SDMA_AHG (1UL << 2)
Christopher Ferris05d08e92016-02-04 13:16:38 -080028#define HFI1_CAP_EXTENDED_PSN (1UL << 3)
29#define HFI1_CAP_HDRSUPP (1UL << 4)
30#define HFI1_CAP_USE_SDMA_HEAD (1UL << 6)
Christopher Ferris106b3a82016-08-24 12:15:38 -070031#define HFI1_CAP_MULTI_PKT_EGR (1UL << 7)
Christopher Ferris05d08e92016-02-04 13:16:38 -080032#define HFI1_CAP_NODROP_RHQ_FULL (1UL << 8)
33#define HFI1_CAP_NODROP_EGR_FULL (1UL << 9)
34#define HFI1_CAP_TID_UNMAP (1UL << 10)
Christopher Ferris106b3a82016-08-24 12:15:38 -070035#define HFI1_CAP_PRINT_UNIMPL (1UL << 11)
Christopher Ferris05d08e92016-02-04 13:16:38 -080036#define HFI1_CAP_ALLOW_PERM_JKEY (1UL << 12)
37#define HFI1_CAP_NO_INTEGRITY (1UL << 13)
38#define HFI1_CAP_PKEY_CHECK (1UL << 14)
Christopher Ferris106b3a82016-08-24 12:15:38 -070039#define HFI1_CAP_STATIC_RATE_CTRL (1UL << 15)
Christopher Ferris05d08e92016-02-04 13:16:38 -080040#define HFI1_CAP_SDMA_HEAD_CHECK (1UL << 17)
41#define HFI1_CAP_EARLY_CREDIT_RETURN (1UL << 18)
42#define HFI1_RCVHDR_ENTSIZE_2 (1UL << 0)
43#define HFI1_RCVHDR_ENTSIZE_16 (1UL << 1)
Christopher Ferris05d08e92016-02-04 13:16:38 -080044#define HFI1_RCVDHR_ENTSIZE_32 (1UL << 2)
Christopher Ferris05d08e92016-02-04 13:16:38 -080045#define HFI1_CMD_ASSIGN_CTXT 1
46#define HFI1_CMD_CTXT_INFO 2
47#define HFI1_CMD_USER_INFO 3
48#define HFI1_CMD_TID_UPDATE 4
Christopher Ferris05d08e92016-02-04 13:16:38 -080049#define HFI1_CMD_TID_FREE 5
50#define HFI1_CMD_CREDIT_UPD 6
Christopher Ferris106b3a82016-08-24 12:15:38 -070051#define HFI1_CMD_RECV_CTRL 8
Christopher Ferris05d08e92016-02-04 13:16:38 -080052#define HFI1_CMD_POLL_TYPE 9
53#define HFI1_CMD_ACK_EVENT 10
54#define HFI1_CMD_SET_PKEY 11
55#define HFI1_CMD_CTXT_RESET 12
Christopher Ferris106b3a82016-08-24 12:15:38 -070056#define HFI1_CMD_TID_INVAL_READ 13
57#define HFI1_CMD_GET_VERS 14
58#define IB_IOCTL_MAGIC 0x1b
Christopher Ferris106b3a82016-08-24 12:15:38 -070059#define __NUM(cmd) (HFI1_CMD_ ##cmd + 0xe0)
60struct hfi1_cmd;
61#define HFI1_IOCTL_ASSIGN_CTXT _IOWR(IB_IOCTL_MAGIC, __NUM(ASSIGN_CTXT), struct hfi1_user_info)
62#define HFI1_IOCTL_CTXT_INFO _IOW(IB_IOCTL_MAGIC, __NUM(CTXT_INFO), struct hfi1_ctxt_info)
Christopher Ferris106b3a82016-08-24 12:15:38 -070063#define HFI1_IOCTL_USER_INFO _IOW(IB_IOCTL_MAGIC, __NUM(USER_INFO), struct hfi1_base_info)
64#define HFI1_IOCTL_TID_UPDATE _IOWR(IB_IOCTL_MAGIC, __NUM(TID_UPDATE), struct hfi1_tid_info)
65#define HFI1_IOCTL_TID_FREE _IOWR(IB_IOCTL_MAGIC, __NUM(TID_FREE), struct hfi1_tid_info)
66#define HFI1_IOCTL_CREDIT_UPD _IO(IB_IOCTL_MAGIC, __NUM(CREDIT_UPD))
Christopher Ferris106b3a82016-08-24 12:15:38 -070067#define HFI1_IOCTL_RECV_CTRL _IOW(IB_IOCTL_MAGIC, __NUM(RECV_CTRL), int)
68#define HFI1_IOCTL_POLL_TYPE _IOW(IB_IOCTL_MAGIC, __NUM(POLL_TYPE), int)
69#define HFI1_IOCTL_ACK_EVENT _IOW(IB_IOCTL_MAGIC, __NUM(ACK_EVENT), unsigned long)
70#define HFI1_IOCTL_SET_PKEY _IOW(IB_IOCTL_MAGIC, __NUM(SET_PKEY), __u16)
Christopher Ferris106b3a82016-08-24 12:15:38 -070071#define HFI1_IOCTL_CTXT_RESET _IO(IB_IOCTL_MAGIC, __NUM(CTXT_RESET))
72#define HFI1_IOCTL_TID_INVAL_READ _IOWR(IB_IOCTL_MAGIC, __NUM(TID_INVAL_READ), struct hfi1_tid_info)
73#define HFI1_IOCTL_GET_VERS _IOR(IB_IOCTL_MAGIC, __NUM(GET_VERS), int)
Christopher Ferris05d08e92016-02-04 13:16:38 -080074#define _HFI1_EVENT_FROZEN_BIT 0
75#define _HFI1_EVENT_LINKDOWN_BIT 1
76#define _HFI1_EVENT_LID_CHANGE_BIT 2
77#define _HFI1_EVENT_LMC_CHANGE_BIT 3
Christopher Ferris05d08e92016-02-04 13:16:38 -080078#define _HFI1_EVENT_SL2VL_CHANGE_BIT 4
Christopher Ferris106b3a82016-08-24 12:15:38 -070079#define _HFI1_EVENT_TID_MMU_NOTIFY_BIT 5
80#define _HFI1_MAX_EVENT_BIT _HFI1_EVENT_TID_MMU_NOTIFY_BIT
Christopher Ferris05d08e92016-02-04 13:16:38 -080081#define HFI1_EVENT_FROZEN (1UL << _HFI1_EVENT_FROZEN_BIT)
Christopher Ferris106b3a82016-08-24 12:15:38 -070082#define HFI1_EVENT_LINKDOWN (1UL << _HFI1_EVENT_LINKDOWN_BIT)
Christopher Ferris106b3a82016-08-24 12:15:38 -070083#define HFI1_EVENT_LID_CHANGE (1UL << _HFI1_EVENT_LID_CHANGE_BIT)
84#define HFI1_EVENT_LMC_CHANGE (1UL << _HFI1_EVENT_LMC_CHANGE_BIT)
85#define HFI1_EVENT_SL2VL_CHANGE (1UL << _HFI1_EVENT_SL2VL_CHANGE_BIT)
86#define HFI1_EVENT_TID_MMU_NOTIFY (1UL << _HFI1_EVENT_TID_MMU_NOTIFY_BIT)
Christopher Ferris05d08e92016-02-04 13:16:38 -080087#define HFI1_STATUS_INITTED 0x1
Christopher Ferris05d08e92016-02-04 13:16:38 -080088#define HFI1_STATUS_CHIP_PRESENT 0x20
89#define HFI1_STATUS_IB_READY 0x40
90#define HFI1_STATUS_IB_CONF 0x80
Christopher Ferris106b3a82016-08-24 12:15:38 -070091#define HFI1_STATUS_HWERROR 0x200
Christopher Ferris05d08e92016-02-04 13:16:38 -080092#define HFI1_MAX_SHARED_CTXTS 8
93#define HFI1_POLL_TYPE_ANYRCV 0x0
94#define HFI1_POLL_TYPE_URGENT 0x1
Christopher Ferris106b3a82016-08-24 12:15:38 -070095struct hfi1_user_info {
Christopher Ferris05d08e92016-02-04 13:16:38 -080096 __u32 userversion;
Christopher Ferris106b3a82016-08-24 12:15:38 -070097 __u32 pad;
Christopher Ferris05d08e92016-02-04 13:16:38 -080098 __u16 subctxt_cnt;
Christopher Ferris05d08e92016-02-04 13:16:38 -080099 __u16 subctxt_id;
100 __u8 uuid[16];
101};
102struct hfi1_ctxt_info {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800103 __u64 runtime_flags;
104 __u32 rcvegr_size;
105 __u16 num_active;
106 __u16 unit;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800107 __u16 ctxt;
108 __u16 subctxt;
109 __u16 rcvtids;
110 __u16 credits;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800111 __u16 numa_node;
112 __u16 rec_cpu;
113 __u16 send_ctxt;
114 __u16 egrtids;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800115 __u16 rcvhdrq_cnt;
116 __u16 rcvhdrq_entsize;
117 __u16 sdma_ring_size;
118};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800119struct hfi1_tid_info {
120 __u64 vaddr;
121 __u64 tidlist;
122 __u32 tidcnt;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800123 __u32 length;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800124};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800125enum hfi1_sdma_comp_state {
126 FREE = 0,
127 QUEUED,
128 COMPLETE,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800129 ERROR
130};
131struct hfi1_sdma_comp_entry {
132 __u32 status;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800133 __u32 errcode;
134};
135struct hfi1_status {
136 __u64 dev;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800137 __u64 port;
138 char freezemsg[0];
139};
140struct hfi1_base_info {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800141 __u32 hw_version;
142 __u32 sw_version;
143 __u16 jkey;
144 __u16 padding1;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800145 __u32 bthqp;
146 __u64 sc_credits_addr;
147 __u64 pio_bufbase_sop;
148 __u64 pio_bufbase;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800149 __u64 rcvhdr_bufbase;
150 __u64 rcvegr_bufbase;
151 __u64 sdma_comp_bufbase;
152 __u64 user_regbase;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800153 __u64 events_bufbase;
154 __u64 status_bufbase;
155 __u64 rcvhdrtail_base;
156 __u64 subctxt_uregbase;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800157 __u64 subctxt_rcvegrbuf;
158 __u64 subctxt_rcvhdrbuf;
159};
160enum sdma_req_opcode {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800161 EXPECTED = 0,
162 EAGER
163};
164#define HFI1_SDMA_REQ_VERSION_MASK 0xF
Christopher Ferris05d08e92016-02-04 13:16:38 -0800165#define HFI1_SDMA_REQ_VERSION_SHIFT 0x0
166#define HFI1_SDMA_REQ_OPCODE_MASK 0xF
167#define HFI1_SDMA_REQ_OPCODE_SHIFT 0x4
168#define HFI1_SDMA_REQ_IOVCNT_MASK 0xFF
Christopher Ferris05d08e92016-02-04 13:16:38 -0800169#define HFI1_SDMA_REQ_IOVCNT_SHIFT 0x8
170struct sdma_req_info {
171 __u16 ctrl;
172 __u16 npkts;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800173 __u16 fragsize;
174 __u16 comp_idx;
175} __packed;
176struct hfi1_kdeth_header {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800177 __le32 ver_tid_offset;
178 __le16 jkey;
179 __le16 hcrc;
180 __le32 swdata[7];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800181} __packed;
182struct hfi1_pkt_header {
183 __le16 pbc[4];
184 __be16 lrh[4];
Christopher Ferris05d08e92016-02-04 13:16:38 -0800185 __be32 bth[3];
186 struct hfi1_kdeth_header kdeth;
187} __packed;
188enum hfi1_ureg {
Christopher Ferris05d08e92016-02-04 13:16:38 -0800189 ur_rcvhdrtail = 0,
190 ur_rcvhdrhead = 1,
191 ur_rcvegrindextail = 2,
192 ur_rcvegrindexhead = 3,
Christopher Ferris05d08e92016-02-04 13:16:38 -0800193 ur_rcvegroffsettail = 4,
194 ur_maxreg,
195 ur_rcvtidflowtable = 256
196};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800197#endif