Commit Graph

19 Commits

Author SHA1 Message Date
Manoj Prabhu B 75b11c7f00 diag: Clear masks upon logging exit
This patch clears the peripheral masks upon the mdlog exit
and USB disconnection. This enables to keep the data and
cmd channel open for read.

CRs-Fixed: 1057143
Change-Id: Ie6f19319b75f3bf389ddd5a8168fd3bcd3efbc8b
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2017-12-19 21:34:38 -08:00
Manoj Prabhu B d77eb46756 diag: Fix possible kernel addresses leak
This patch addresses kernel addresses leak by changing
the format specifier to adhere to the kptr_restrict system setting.

CRs-Fixed: 987013
Change-Id: I32649a26f54d96c56d80aa2a1bd5f5d9dd0dd9d3
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2016-06-16 02:50:29 -07:00
Mohit Aggarwal dffbb2e56c diag: Rectify possible double free of buffers in usb device mode
There is a possibility of double freeing the memory buffer
in case for usb device mode. This patch protects the buffer
entries and does the necessary clean-up with proper protection.

Change-Id: I5388e5392aa88740ee41f6d8a9cd12805d48616e
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
2016-01-07 02:42:52 -08:00
Katish Paran 8fc91bd8e3 diag: Max size supported from usb
The max size packet written to usb may vary depending upon the
type of usb controller in use. This patch modifies the max packet
size that can be written to usb depending upon the value returned
from usb controller.

Change-Id: I144929b4ebe3f705dc7eff4f68be2a3cb426bd93
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-07-16 22:06:56 -07:00
Katish Paran f233c5eb41 diag: Atomic operations does not require spinlock
There is no need to perform atomic operations under spinlock.

Change-Id: I2a38b672ec63f36c07c15d5460db16fbe826d47b
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-06-17 14:16:24 +05:30
Ravi Aravamudhan c2c052b2fd diag: usb: Do not queue a read on USB write complete
Diag driver was unnecessarily queueing a read to USB channel when
USB gives us a write complete callback. This patch removes the
call to queue a work for reading data from USB.

Change-Id: I4c023e1f91b6676e90e8cda9b69d4d6c6a982a35
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-06-03 18:08:16 -07:00
Katish Paran 1866433583 diag: Enable hdlc encoding in case if logging mode changes
Currently hdlc encoding is not turned on by default in case if
the logging mode is changed from usb mode to memory device mode
or vice-versa. By design, the hdlc encoding must be turned on
after any logging switch. Also, stop any further reads over
peripherals until the time the mux layer is established.

Change-Id: I21f89771412e2da8ee0243f5f6bb24f917038300
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-05-12 15:25:23 -07:00
Ravi Aravamudhan a78fabb8f0 diag: usb: Add support for partial writes over USB
Diag driver needs to support writing partial packets over USB to
remove any dependency on the controller properties. Make change
to write large buffers in chunks.

Change-Id: I9f70396adbe3dfb988ad65319442ede88fbc6896
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-05-04 17:58:08 -07:00
Ravi Aravamudhan 636ccf45ad diag: Separate SMD structures from Diag core logic
Diag SMD structures are embedded inside Diag core logic. This patch
modularizes operations performed over SMD, keeping it distinct from
other diag modules.

Change-Id: I6bd99b109da7b71d6310708312078d7334cc0f58
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-05-04 17:54:17 -07:00
Ravi Aravamudhan 19c8a11969 diag: Fix race condition in the diag-usb layer
There can be a race condition in setting the value of read_pending
in the diag driver. Incorrect value may result in diag not queueing
any reads to the usb driver.

Change-Id: I7eb2d5d86e71c9a5ef21d155e7ccbe9b3d9e0d83
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-04-20 16:30:58 +05:30
Katish Paran 981462ff2f diag: Flush the data only in case for Memory Device Mode
Once the logging is switched, from USB_MODE to MEMORY_DEVICE_MODE
diag is not expecting write done notification from USB. In case
for asynchronous writes notification for USB, the data can be
dropped. This ensures that the flush_workqueue is called only
in case where diag is logging in Memory device mode and write
done notification is being called from memory device context.

Change-Id: Ideed995f96797e1950647c3657e4ab013dda74aa
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-03-04 01:56:48 -08:00
Sreelakshmi Gownipalli aa7e3687e5 diag: Check if usb is connected while allocating usb requests
In usb_connect() check whether the usb is connected before allocating
any usb read and write requests.

Change-Id: I3873dd2b5e98d9e9adbdf0cff3e0a5b0399f620d
Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
2015-02-22 21:54:45 -08:00
Linux Build Service Account 6c547a92f1 Merge "diag: Check if usb is connected before usb_diag_write()" 2014-11-15 11:23:48 -08:00
Sreelakshmi Gownipalli abfe4ede57 diag: Check if usb is connected before usb_diag_write()
Check if usb is connected before writing to USB so
that there is no race condition  between usb_connected
variable update when usb is disconnected and
the time when we actually read the usb_connected variable.

Change-Id: I19135b0f7d1eb70e0aaa2be3beb62408aded34c2
Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
2014-11-14 18:08:01 -08:00
Linux Build Service Account bcffab8dac Merge "diag: Make fixes to Memory Device mode" 2014-11-07 14:33:22 -08:00
Katish Paran 76984b8c59 diag: Read data over peripherals in case of memory device mode
In case of usb disconnect, the logging mode needs to be checked
accordingly to decide whether the data needs to be read over
peripherals or not. In case of memory device mode the data needs
to be read continuoulsy over smd channel even if the usb is
disconnected.

Change-Id: I963740bc3b66a77c2ef68a2c58b48a5c7ed0ab0b
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2014-10-28 17:58:24 +05:30
Ravi Aravamudhan abae544172 diag: Make fixes to Memory Device mode
Currently the size of the buffer table in diag memory device mode
is set to a predefined value. This patch makes the size of the
buffer table consistent with the maximum number of buffers
possible.

Change-Id: I51313499f7bbe85b589605b7c3b27e27573d1684
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2014-09-30 13:54:30 -07:00
Ravi Aravamudhan 38604baa7b diag: Modularize different logging modes
Diag driver has an ability to log diag data to USB or to the user
space clients. Make changes to modularize different modes of
logging schemes.

Change-Id: I91c95ce4ec8117f6926d8e6dfa164fd6cb07dc4b
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2014-08-04 15:50:12 -07:00
Ravi Aravamudhan d3d930b1a7 diag: Create separate module for Diag-USB interaction
Diag USB structures are deeply coupled with diag drivers. Each
instance of USB channel is used explicitly. Make changes to
modularize USB channels designated for Diag.

Change-Id: Id408e227e7e92178afa847064afe18bb6c0dd019
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2014-07-23 15:44:11 -07:00