1/****************************************************************************
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>
22#define __mic_align(a,x) (((a) + (x) - 1) & ~((x) - 1))
23struct mic_device_desc {
24  __s8 type;
25  __u8 num_vq;
26  __u8 feature_len;
27  __u8 config_len;
28  __u8 status;
29  __le64 config[0];
30} __attribute__((aligned(8)));
31struct mic_device_ctrl {
32  __le64 vdev;
33  __u8 config_change;
34  __u8 vdev_reset;
35  __u8 guest_ack;
36  __u8 host_ack;
37  __u8 used_address_updated;
38  __s8 c2h_vdev_db;
39  __s8 h2c_vdev_db;
40} __attribute__((aligned(8)));
41struct mic_bootparam {
42  __le32 magic;
43  __s8 h2c_config_db;
44  __u8 node_id;
45  __u8 h2c_scif_db;
46  __u8 c2h_scif_db;
47  __u64 scif_host_dma_addr;
48  __u64 scif_card_dma_addr;
49} __attribute__((aligned(8)));
50struct mic_device_page {
51  struct mic_bootparam bootparam;
52  struct mic_device_desc desc[0];
53};
54struct mic_vqconfig {
55  __le64 address;
56  __le64 used_address;
57  __le16 num;
58} __attribute__((aligned(8)));
59#define MIC_VIRTIO_RING_ALIGN 4096
60#define MIC_MAX_VRINGS 4
61#define MIC_VRING_ENTRIES 128
62#define MIC_MAX_VRING_ENTRIES 128
63#define MIC_MAX_DESC_BLK_SIZE 256
64struct _mic_vring_info {
65  __u16 avail_idx;
66  __le32 magic;
67};
68struct mic_vring {
69  struct vring vr;
70  struct _mic_vring_info * info;
71  void * va;
72  int len;
73};
74#define mic_aligned_desc_size(d) __mic_align(mic_desc_size(d), 8)
75#ifndef INTEL_MIC_CARD
76#endif
77#define MIC_DP_SIZE 4096
78#define MIC_MAGIC 0xc0ffee00
79enum mic_states {
80  MIC_READY = 0,
81  MIC_BOOTING,
82  MIC_ONLINE,
83  MIC_SHUTTING_DOWN,
84  MIC_RESETTING,
85  MIC_RESET_FAILED,
86  MIC_LAST
87};
88enum mic_status {
89  MIC_NOP = 0,
90  MIC_CRASHED,
91  MIC_HALTED,
92  MIC_POWER_OFF,
93  MIC_RESTART,
94  MIC_STATUS_LAST
95};
96#endif
97