summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorAnand Vastrad <anand.vastrad@intel.com>2017-07-08 19:11:46 -0700
committerSaul Wold <sgw@linux.intel.com>2017-07-10 07:40:44 -0700
commita7077153afda971b3c526bf23dd082e615ac2069 (patch)
tree599b71c7d2a94ed11dd543a176f7d8393b3b6d0c /common
parentfe4eff06ac6a197486f15647833e4f897fee34eb (diff)
downloadmeta-intel-a7077153afda971b3c526bf23dd082e615ac2069.tar.gz
lms8: Added 0003-Fix-device-file-referanc* patch which uses /dev/mei0.
LMS uses /dev/mei to talk to mei, which is not present in recent kernels. So LMS fails to initialize and is broken. In addition to that the select timesout post write in SendMessage api which causes communication to mei fail leading to malfunctioning of LMS. 0003-Fix-device-file-referanc*.patch uses /dev/mei0 and removes select post write in SendMessage api and relies on write return length for write verification. This patch is required to get LMS properly working. Signed-off-by: Anand Vastrad <anand.vastrad@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'common')
-rw-r--r--common/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch91
-rw-r--r--common/recipes-bsp/amt/lms8_8.0.0-7.bb1
2 files changed, 92 insertions, 0 deletions
diff --git a/common/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch b/common/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch
new file mode 100644
index 00000000..433d3016
--- /dev/null
+++ b/common/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch
@@ -0,0 +1,91 @@
1Fix device file referance to /dev/mei0, remove select post write.
2
3LMS uses /dev/mei character device which is absent on current kernel versions causing LMS fail to initialize. LMS sends messages to MEI with a post select timeout. Select timeout causes SendMessage to fail causing LMS to not to communicate properly with MEI.
4
5Adding /dev/mei0 device file reference to check first and then /dev/mei sucessfully initializes LMS. Rely on write return length and remove select with timeout to fix communication with MEI.
6
7Upstream-Status: Pending
8
9Signed-off-by: Anand Vastrad <anand.vastrad@intel.com>
10---
11 src/mei/MEILinux.cpp | 43 +++++++------------------------------------
12 1 file changed, 7 insertions(+), 36 deletions(-)
13
14diff --git a/src/mei/MEILinux.cpp b/src/mei/MEILinux.cpp
15index 1e9d28f..6d23f54 100755
16--- a/src/mei/MEILinux.cpp
17+++ b/src/mei/MEILinux.cpp
18@@ -94,13 +94,17 @@ bool MEILinux::Init(unsigned char reqProtocolVersion)
19 Deinit();
20 }
21
22- _fd = open("/dev/mei", O_RDWR);
23+ _fd = open("/dev/mei0", O_RDWR);
24
25 if (_fd == -1 ) {
26 if (_verbose) {
27- fprintf(stderr, "Error: Cannot establish a handle to the MEI driver\n");
28+ fprintf(stderr, "Warning: Cannot establish a handle to the MEI driver mei0, retrying with mei \n");
29+ }
30+ _fd = open("/dev/mei", O_RDWR);
31+ if (_fd == -1 ) {
32+ fprintf(stderr, "Error: Cannot establish a handle to the MEI driver mei\n");
33+ return false;
34 }
35- return false;
36 }
37 _initialized = true;
38
39@@ -181,13 +185,7 @@ int MEILinux::ReceiveMessage(unsigned char *buffer, int len, unsigned long timeo
40 int MEILinux::SendMessage(const unsigned char *buffer, int len, unsigned long timeout)
41 {
42 int rv = 0;
43- int return_length =0;
44 int error = 0;
45- fd_set set;
46- struct timeval tv;
47-
48- tv.tv_sec = timeout / 1000;
49- tv.tv_usec =(timeout % 1000) * 1000000;
50
51 if (_verbose) {
52 fprintf(stdout, "call write length = %d\n", len);
53@@ -198,35 +196,8 @@ int MEILinux::SendMessage(const unsigned char *buffer, int len, unsigned long ti
54 if (_verbose) {
55 fprintf(stderr,"write failed with status %d %d\n", rv, error);
56 }
57- goto out;
58- }
59-
60- return_length = rv;
61-
62- FD_ZERO(&set);
63- FD_SET(_fd, &set);
64- rv = select(_fd+1 ,&set, NULL, NULL, &tv);
65- if (rv > 0 && FD_ISSET(_fd, &set)) {
66- if (_verbose) {
67- fprintf(stderr, "write success\n");
68- }
69 }
70- else if (rv == 0) {
71- if (_verbose) {
72- fprintf(stderr, "write failed on timeout with status\n");
73- }
74- goto out;
75- }
76- else { //rv<0
77- if (_verbose) {
78- fprintf(stderr, "write failed on select with status %d\n", rv);
79- }
80- goto out;
81- }
82-
83- rv = return_length;
84
85-out:
86 if (rv < 0) {
87 Deinit();
88 }
89--
902.7.4
91
diff --git a/common/recipes-bsp/amt/lms8_8.0.0-7.bb b/common/recipes-bsp/amt/lms8_8.0.0-7.bb
index 842e34a0..145b307e 100644
--- a/common/recipes-bsp/amt/lms8_8.0.0-7.bb
+++ b/common/recipes-bsp/amt/lms8_8.0.0-7.bb
@@ -12,6 +12,7 @@ SRC_URI = "http://software.intel.com/sites/default/files/${BPN}-${PV}.tar.gz \
12 file://0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch \ 12 file://0001-Protocol.cpp-Add-whitespace-for-gcc6-compile-error.patch \
13 file://0001-Include-sys-select.h-for-fd_set.patch \ 13 file://0001-Include-sys-select.h-for-fd_set.patch \
14 file://0002-Use-proper-netinet-in.h-API.patch \ 14 file://0002-Use-proper-netinet-in.h-API.patch \
15 file://0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch \
15 " 16 "
16 17
17COMPATIBLE_HOST = '(i.86|x86_64).*-linux' 18COMPATIBLE_HOST = '(i.86|x86_64).*-linux'