summarylogtreecommitdiffstats
path: root/epiphany_uapi.h
diff options
context:
space:
mode:
authorKaczanowski Mateusz2020-01-08 14:26:55 +0100
committerKaczanowski Mateusz2020-01-08 14:29:17 +0100
commit68ecd2668c735031ed3bdfbcb749fb131f459dd2 (patch)
treec53ff32ab986b8d9c4c18e8dfbba13d27318faa2 /epiphany_uapi.h
downloadaur-68ecd2668c735031ed3bdfbcb749fb131f459dd2.tar.gz
initial commit
Diffstat (limited to 'epiphany_uapi.h')
-rw-r--r--epiphany_uapi.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/epiphany_uapi.h b/epiphany_uapi.h
new file mode 100644
index 000000000000..7666e735190a
--- /dev/null
+++ b/epiphany_uapi.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2015 Adapteva Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * The full GNU General Public License is included in this distribution in the
+ * file called COPYING.
+ */
+
+#ifndef _UAPI_MISC_EPIPHANY_H
+#define _UAPI_MISC_EPIPHANY_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#define E_MESH_MAX_ARRAYS 128
+#define E_LINK_MAX_MEM_MAPPINGS 256
+
+enum e_link_side {
+ E_SIDE_N = 0,
+ E_SIDE_E,
+ E_SIDE_S,
+ E_SIDE_W,
+ E_SIDE_MAX
+};
+
+enum e_connection_type {
+ E_CONN_DISCONNECTED = 0,
+ E_CONN_ELINK,
+ E_CONN_ARRAY,
+ E_CONN_MAX
+};
+
+enum e_chip_type {
+ E_CHIP_UNKNOWN = 0,
+ E_CHIP_E16G301,
+ E_CHIP_E64G401,
+ E_CHIP_MAX
+};
+
+struct e_mappings_info {
+ __u64 nmappings;
+ struct {
+ __u64 emesh_addr;
+ __u64 size;
+ } mappings[E_LINK_MAX_MEM_MAPPINGS];
+} __attribute__((packed));
+
+struct e_array_info {
+ __u64 id;
+ __u64 chip_type;
+ __u64 chip_rows;
+ __u64 chip_cols;
+ __u64 parent_side;
+ __u64 mesh_dev;
+ struct {
+ __u64 type;
+ union {
+ __u64 dev;
+ __u64 id;
+ };
+ } connections[E_SIDE_MAX];
+} __attribute__((packed));
+
+struct e_elink_info {
+ __u64 dev;
+ __u32 version;
+ __u32 _pad;
+ __u64 connection_type;
+ union {
+ struct e_array_info array;
+ __u64 remote_elink_id;
+ };
+} __attribute__((packed));
+
+struct e_mesh_info {
+ __u64 dev;
+ __u64 chip_type;
+ __u64 narrays;
+#if 1
+ struct e_array_info arrays[E_MESH_MAX_ARRAYS];
+#endif
+} __attribute__((packed));
+
+struct e_mailbox_msg {
+ __u32 from;
+ __u32 data;
+} __attribute__((packed));
+
+
+#define E_IOCTL_MAGIC 'E'
+#define E_IO(nr) _IO(E_IOCTL_MAGIC, nr)
+#define E_IOR(nr, type) _IOR(E_IOCTL_MAGIC, nr, type)
+#define E_IOW(nr, type) _IOW(E_IOCTL_MAGIC, nr, type)
+#define E_IOWR(nr, type) _IOWR(E_IOCTL_MAGIC, nr, type)
+
+/**
+ * If you add an IOC command, please update the
+ * EPIPHANY_IOC_MAXNR macro
+ */
+
+#define E_IOCTL_RESET E_IO(0x00)
+#define E_IOCTL_ELINK_PROBE E_IOR(0x01, struct e_elink_info)
+#define E_IOCTL_MESH_PROBE E_IOR(0x02, struct e_mesh_info)
+#define E_IOCTL_GET_MAPPINGS E_IOR(0x03, struct e_mappings_info)
+#define E_IOCTL_MAILBOX_READ E_IOWR(0x04, struct e_mailbox_msg)
+#define E_IOCTL_MAILBOX_COUNT E_IO(0x05)
+#define E_IOCTL_THERMAL_DISALLOW E_IO(0x06)
+#define E_IOCTL_THERMAL_ALLOW E_IO(0x07)
+
+#define E_IOCTL_MAXNR 0x07
+
+#endif /* _UAPI_MISC_EPIPHANY_H */