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>
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>
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>
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>
There is no need to perform atomic operations under spinlock.
Change-Id: I2a38b672ec63f36c07c15d5460db16fbe826d47b
Signed-off-by: Katish Paran <kparan@codeaurora.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>