blob: 191e5d38226f55c6c3fc32a7d6b7a431d5ed99c3 [file] [log] [blame]
Christopher Ferris38062f92014-07-09 15:33:25 -07001/****************************************************************************
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 __MIC_COMMON_H_
20#define __MIC_COMMON_H_
21#include <linux/virtio_ring.h>
Tao Baod7db5942015-01-28 10:07:51 -080022#define __mic_align(a,x) (((a) + (x) - 1) & ~((x) - 1))
Christopher Ferris38062f92014-07-09 15:33:25 -070023struct mic_device_desc {
Tao Baod7db5942015-01-28 10:07:51 -080024 __s8 type;
25 __u8 num_vq;
26 __u8 feature_len;
Tao Baod7db5942015-01-28 10:07:51 -080027 __u8 config_len;
28 __u8 status;
29 __le64 config[0];
30} __attribute__((aligned(8)));
Christopher Ferris38062f92014-07-09 15:33:25 -070031struct mic_device_ctrl {
Tao Baod7db5942015-01-28 10:07:51 -080032 __le64 vdev;
33 __u8 config_change;
34 __u8 vdev_reset;
Tao Baod7db5942015-01-28 10:07:51 -080035 __u8 guest_ack;
36 __u8 host_ack;
37 __u8 used_address_updated;
38 __s8 c2h_vdev_db;
Tao Baod7db5942015-01-28 10:07:51 -080039 __s8 h2c_vdev_db;
40} __attribute__((aligned(8)));
Christopher Ferris38062f92014-07-09 15:33:25 -070041struct mic_bootparam {
Tao Baod7db5942015-01-28 10:07:51 -080042 __le32 magic;
Tao Baod7db5942015-01-28 10:07:51 -080043 __s8 h2c_config_db;
Christopher Ferris05d08e92016-02-04 13:16:38 -080044 __u8 node_id;
45 __u8 h2c_scif_db;
46 __u8 c2h_scif_db;
Christopher Ferris05d08e92016-02-04 13:16:38 -080047 __u64 scif_host_dma_addr;
48 __u64 scif_card_dma_addr;
Tao Baod7db5942015-01-28 10:07:51 -080049} __attribute__((aligned(8)));
Christopher Ferris38062f92014-07-09 15:33:25 -070050struct mic_device_page {
Christopher Ferris05d08e92016-02-04 13:16:38 -080051 struct mic_bootparam bootparam;
Tao Baod7db5942015-01-28 10:07:51 -080052 struct mic_device_desc desc[0];
Christopher Ferris38062f92014-07-09 15:33:25 -070053};
54struct mic_vqconfig {
Christopher Ferris05d08e92016-02-04 13:16:38 -080055 __le64 address;
Tao Baod7db5942015-01-28 10:07:51 -080056 __le64 used_address;
57 __le16 num;
58} __attribute__((aligned(8)));
Christopher Ferris05d08e92016-02-04 13:16:38 -080059#define MIC_VIRTIO_RING_ALIGN 4096
Christopher Ferris38062f92014-07-09 15:33:25 -070060#define MIC_MAX_VRINGS 4
61#define MIC_VRING_ENTRIES 128
62#define MIC_MAX_VRING_ENTRIES 128
Christopher Ferris05d08e92016-02-04 13:16:38 -080063#define MIC_MAX_DESC_BLK_SIZE 256
Christopher Ferris38062f92014-07-09 15:33:25 -070064struct _mic_vring_info {
Tao Baod7db5942015-01-28 10:07:51 -080065 __u16 avail_idx;
66 __le32 magic;
Christopher Ferris05d08e92016-02-04 13:16:38 -080067};
Christopher Ferris38062f92014-07-09 15:33:25 -070068struct mic_vring {
Tao Baod7db5942015-01-28 10:07:51 -080069 struct vring vr;
70 struct _mic_vring_info * info;
Christopher Ferris05d08e92016-02-04 13:16:38 -080071 void * va;
Tao Baod7db5942015-01-28 10:07:51 -080072 int len;
Christopher Ferris38062f92014-07-09 15:33:25 -070073};
74#define mic_aligned_desc_size(d) __mic_align(mic_desc_size(d), 8)
Christopher Ferris05d08e92016-02-04 13:16:38 -080075#ifndef INTEL_MIC_CARD
Christopher Ferris38062f92014-07-09 15:33:25 -070076#endif
77#define MIC_DP_SIZE 4096
78#define MIC_MAGIC 0xc0ffee00
79enum mic_states {
Christopher Ferris05d08e92016-02-04 13:16:38 -080080 MIC_READY = 0,
81 MIC_BOOTING,
Tao Baod7db5942015-01-28 10:07:51 -080082 MIC_ONLINE,
83 MIC_SHUTTING_DOWN,
Christopher Ferris05d08e92016-02-04 13:16:38 -080084 MIC_RESETTING,
Tao Baod7db5942015-01-28 10:07:51 -080085 MIC_RESET_FAILED,
Tao Baod7db5942015-01-28 10:07:51 -080086 MIC_LAST
Christopher Ferris05d08e92016-02-04 13:16:38 -080087};
Christopher Ferris38062f92014-07-09 15:33:25 -070088enum mic_status {
Tao Baod7db5942015-01-28 10:07:51 -080089 MIC_NOP = 0,
90 MIC_CRASHED,
Christopher Ferris05d08e92016-02-04 13:16:38 -080091 MIC_HALTED,
Tao Baod7db5942015-01-28 10:07:51 -080092 MIC_POWER_OFF,
93 MIC_RESTART,
94 MIC_STATUS_LAST
Christopher Ferris05d08e92016-02-04 13:16:38 -080095};
Christopher Ferris38062f92014-07-09 15:33:25 -070096#endif