Commit | Line | Data |
---|---|---|
800f879a AT |
1 | /* |
2 | * Copyright 2010-2017 Intel Corporation. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License, version 2, | |
6 | * as published by the Free Software Foundation. | |
7 | * | |
8 | * This program is distributed in the hope that it will be useful, | |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
11 | * General Public License for more details. | |
12 | * | |
13 | * Disclaimer: The codes contained in these modules may be specific to | |
14 | * the Intel Software Development Platform codenamed Knights Ferry, | |
15 | * and the Intel product codenamed Knights Corner, and are not backward | |
16 | * compatible with other Intel products. Additionally, Intel will NOT | |
17 | * support the codes or instruction set in future products. | |
18 | * | |
19 | * Intel offers no warranty of any kind regarding the code. This code is | |
20 | * licensed on an "AS IS" basis and Intel is not obligated to provide | |
21 | * any support, assistance, installation, training, or other services | |
22 | * of any kind. Intel is also not obligated to provide any updates, | |
23 | * enhancements or extensions. Intel specifically disclaims any warranty | |
24 | * of merchantability, non-infringement, fitness for any particular | |
25 | * purpose, and any other warranty. | |
26 | * | |
27 | * Further, Intel disclaims all liability of any kind, including but | |
28 | * not limited to liability for infringement of any proprietary rights, | |
29 | * relating to the use of the code, even if Intel is notified of the | |
30 | * possibility of such liability. Except as expressly stated in an Intel | |
31 | * license agreement provided with this code and agreed upon with Intel, | |
32 | * no license, express or implied, by estoppel or otherwise, to any | |
33 | * intellectual property rights is granted herein. | |
34 | */ | |
35 | ||
36 | #include <linux/errno.h> | |
37 | #include <linux/hardirq.h> | |
38 | #include <linux/types.h> | |
39 | #include <linux/capability.h> | |
40 | #include <linux/slab.h> | |
41 | #include <linux/string.h> | |
42 | #include <linux/gfp.h> | |
43 | #include <linux/vmalloc.h> | |
44 | #include <asm/io.h> | |
45 | #include <linux/kernel.h> | |
46 | #include <linux/mm_types.h> | |
47 | #include <linux/jiffies.h> | |
48 | #include <linux/timer.h> | |
49 | #include <linux/irqflags.h> | |
50 | #include <linux/time.h> | |
51 | #include <linux/spinlock.h> | |
52 | #include <linux/mutex.h> | |
53 | #include <linux/semaphore.h> | |
54 | #include <linux/kthread.h> | |
55 | #include <linux/sched.h> | |
56 | #include <linux/delay.h> | |
57 | #include <linux/wait.h> | |
58 | #include <asm/bug.h> | |
59 | #include <linux/pci.h> | |
60 | #include <linux/device.h> | |
61 | #include <linux/fs.h> | |
62 | #include <linux/list.h> | |
63 | #include <linux/workqueue.h> | |
64 | #include <linux/interrupt.h> | |
65 | #include <asm/atomic.h> | |
66 | #include <linux/netdevice.h> | |
67 | #include <linux/debugfs.h> | |
68 | ||
69 | #define MIC_BOOT_PARAM_HEADER_VERSION 8 | |
70 | ||
71 | #define MIC_OS_BOOTSTATUS_SUCCESS 1 | |
72 | #define MIC_OS_BOOTSTATUS_BOOT_0 2 // Initial state of uOS boot | |
73 | #define MIC_OS_BOOTSTATUS_ERROR_VERSION_MISMATCH 3 | |
74 | #define MIC_OS_BOOTSTATUS_ERROR 4 | |
75 | ||
76 | #define MIC_HOST_DEFAULT 6 // Only value accepted so do not change | |
77 | ||
78 | #define MIC_ENG_APPLICATION 0 | |
79 | #define MIC_ENG_PAGING 1 | |
80 | #define MIC_ENG_VIDEO 2 | |
81 | #define MIC_ENG_HIGHPRIORITY 3 | |
82 | #define MIC_ENG_MAX_SUPPORTED_ENGINES 4 | |
83 | ||
84 | struct ringbuf_memdesc | |
85 | { | |
86 | uint64_t address; // Location of the ring buffer | |
87 | uint32_t size; // size of ring buffer | |
88 | uint32_t reserved; // pad | |
89 | }; | |
90 | ||
91 | struct mic_bootparam | |
92 | { | |
93 | uint64_t bp_version; | |
94 | ||
95 | union | |
96 | { | |
97 | uint32_t bp_bootstatus; | |
98 | uint64_t bp_reserved; | |
99 | }; | |
100 | ||
101 | uint64_t bp_vcons_addr; | |
102 | uint64_t bp_vcons_size; | |
103 | uint64_t bp_shdata_addr; | |
104 | uint64_t bp_shdata_size; | |
105 | struct ringbuf_memdesc bp_ringbuf[MIC_ENG_MAX_SUPPORTED_ENGINES]; | |
106 | ||
107 | uint64_t bp_unused0; | |
108 | uint64_t bp_unused1; | |
109 | uint64_t bp_unused2; | |
110 | uint64_t bp_unused3; | |
111 | uint64_t bp_unused4; | |
112 | uint64_t bp_unused5; | |
113 | uint64_t bp_unused6; | |
114 | uint64_t bp_unused7; | |
115 | ||
116 | uint64_t bp_engstate_addr; | |
117 | ||
118 | struct ringbuf_memdesc bp_unused8; | |
119 | ||
120 | uint64_t bp_unused9; | |
121 | uint64_t bp_unused10; | |
122 | uint64_t bp_unused11; | |
123 | ||
124 | }; | |
125 | ||
126 | struct host_bootparam | |
127 | { | |
128 | uint64_t bp_version; | |
129 | ||
130 | union | |
131 | { | |
132 | uint64_t bp_host_type; | |
133 | uint64_t bp_reserved; | |
134 | }; | |
135 | ||
136 | uint64_t bp_vcons_addr; | |
137 | uint64_t bp_vcons_size; | |
138 | ||
139 | uint64_t bp_unused0; | |
140 | ||
141 | uint64_t bp_engstate_addr; | |
142 | ||
143 | struct ringbuf_memdesc bp_ringbuf[MIC_ENG_MAX_SUPPORTED_ENGINES]; | |
144 | ||
145 | uint64_t bp_dmabuf_size[MIC_ENG_MAX_SUPPORTED_ENGINES]; | |
146 | ||
147 | uint64_t bp_unused1; | |
148 | uint64_t bp_unused2; | |
149 | ||
150 | uint64_t bp_aper_size; | |
151 | ||
152 | uint8_t bp_unused3[36]; | |
153 | uint64_t bp_unused4; | |
154 | ||
155 | struct ringbuf_memdesc bp_unused5; | |
156 | ||
157 | uint64_t bp_unused6; | |
158 | uint64_t bp_unused7; | |
159 | ||
160 | uint32_t bp_watchdog_timeout; | |
161 | }; | |
162 | ||
163 | struct enginestate_mic | |
164 | { | |
165 | uint32_t writeOffset __attribute__((aligned(64))); | |
166 | uint32_t lastCompletedFence __attribute__((aligned(64))); | |
167 | uint32_t fenceWhenPreempted __attribute__((aligned(64))); | |
168 | uint32_t preemptOffset __attribute__((aligned(64))); | |
169 | }; | |
170 |