Diag System Architecture: Submit Technical Questions at
Diag System Architecture: Submit Technical Questions at
80-NA157-61 E
April 25, 2014
Restricted Distribution: Not to be distributed to anyone who is not an employee of either Qualcomm or its
subsidiaries without the express approval of Qualcomm’s Configuration Management.
Not to be used, copied, reproduced, or modified in whole or in part, nor its contents revealed in any manner to others
without the express written permission of Qualcomm Technologies, Inc.
Qualcomm reserves the right to make changes to the product(s) or information contained herein without notice. No
liability is assumed for any damages arising directly or indirectly by their use or application. The information
provided in this document is provided on an “as is” basis.
This document contains confidential and proprietary information and must be shredded when discarded.
Qualcomm is a trademark of QUALCOMM Incorporated, registered in the United States and other countries. All
QUALCOMM Incorporated trademarks are used with permission. Other product and brand names may be
trademarks or registered trademarks of their respective owners.
This technical data may be subject to U.S. and international export, re-export, or transfer (“export”) laws. Diversion
contrary to U.S. and international law is strictly prohibited.
1 Introduction...................................................................................................... 7
1.1 Purpose.......................................................................................................................... 7
1.2 Scope............................................................................................................................. 7
1.3 Conventions .................................................................................................................. 7
1.4 References..................................................................................................................... 8
1.5 Technical assistance ...................................................................................................... 8
1.6 Acronyms ...................................................................................................................... 8
5 Socket Logging.............................................................................................. 43
5.1 Initial setup ................................................................................................................. 44
5.1.1 Ping device from PC ........................................................................................ 44
5.1.2 Ping PC from device ........................................................................................ 44
5.2 Application usage ....................................................................................................... 45
5.2.1 Running the diag_socket_log application ........................................................ 45
5.2.2 Stopping the diag_socket_log application ....................................................... 45
5.3 QPST configuration .................................................................................................... 46
8 Listeners......................................................................................................... 63
8.1 Single listener ............................................................................................................. 63
8.2 Extended listener......................................................................................................... 64
9 Debugging ...................................................................................................... 65
9.1 QPST disconnect/“No Phone” status .......................................................................... 65
10 Code Structure............................................................................................. 91
10.1 L4/Rex ...................................................................................................................... 91
10.2 Linux ......................................................................................................................... 92
10.2.1 LA .................................................................................................................. 92
10.2.2 LE .................................................................................................................. 93
Figures
Figure 5-1 Architecture for socket logging ................................................................................................ 43
Figure 7-1 Diag consumer services overview ............................................................................................ 54
Figure 7-2 Call flow for initialization ........................................................................................................ 55
Figure 7-3 Call flow for command request/response service..................................................................... 56
Figure 7-4 Call flow for logs/events services ............................................................................................ 57
Figure 9-1 Log packet generation call flow ............................................................................................... 79
Figure 9-2 Event report generation call flow ............................................................................................. 81
Figure 9-3 F3 message generation call flow .............................................................................................. 82
Figure 9-4 Diag DSM pools and watermark queues .................................................................................. 85
Figure 9-5 Diag sleep voting call flow....................................................................................................... 87
Tables
Table 1-1 Reference documents and standards ............................................................................................ 8
Table 2-1 ESN request ............................................................................................................................... 12
Table 2-2 ESN response............................................................................................................................. 13
Table 2-3 MSG 2.0 macros ........................................................................................................................ 14
Table 2-4 Bit values for DIAG_F3_TRACE_DETAIL_MASK_DEFAULT_VAL ................................. 15
Table 3-1 Single response APSS command table ...................................................................................... 20
Table 3-2 Single response modem command table.................................................................................... 20
Table 3-3 Delayed response APSS command table ................................................................................... 23
Table 3-4 Delayed response modem command table ................................................................................ 23
Table 4-1 Options available with diag_mdlog application ........................................................................ 29
Table 5-1 diag_socket_log command arguments....................................................................................... 45
Table 6-1 diag_uart_log command arguments........................................................................................... 47
Table 7-1 Log packet structure .................................................................................................................. 58
Table 9-1 Modem loopback command structure in APSS Linux dispatch table ....................................... 74
2 1.1 Purpose
3 This document describes the diagnostic module system-level architecture, its functionalities, and
4 the newer features.
5 1.2 Scope
6 This document is meant for engineers using and working with diagnostic module services.
7 1.3 Conventions
8 Function declarations, function names, type declarations, and code samples appear in a different
9 font, e.g., #include.
10 Code variables appear in angle brackets, e.g., <number>.
11 Button and key names appear in bold font, e.g., click Save or press Enter.
12 If you are viewing this document using a color monitor, or if you print this document to a color
13 printer, red boldface indicates code that is to be added, and blue strikethrough indicates code
14 that is to be replaced or removed (if present).
15 Shading indicates content that has been added or changed in this revision of the document.
1 1.4 References
2 Reference documents are listed in Table 1-1. Reference documents that are no longer applicable
3 are deleted from this table; therefore, reference numbers may not be sequential.
Ref. Document
Qualcomm Technologies
Q1 Application Note: Software Glossary for Customers CL93-V3077-1
Q2 Diagnostic Services Interface Specification and Operational Description 80-V6135-1
Q3 CDMA Dual-Mode Subscriber Station Serial Data Interface Control Document 80-V1294-1
(ICD)
Q6 Diagnostic Consumer Interface API on Linux 80-N8469-2
Q7 QXDM Professional™ User Guide 80-V1241-21
Q11 Diagnostic Services Subsystem Interface Control Document (ICD) 80-V1294-10
Q14 Long Term Evolution (LTE) Interface Control Document (ICD) 80-VP457-1
Q15 Presentation: Secure Services Module (SSM) Overview for Windows Phone 8 80-NA027-1
Q16 Presentation: Secure Services Module (SSM) Overview for Linux Android™ 80-NH283-1
Resources
R1 Declaring and Enforcing Permissions http://developer.android.com/guide/topics/
security/permissions.html#declaring
5
11 1.6 Acronyms
12 For definitions of terms and abbreviations, see [Q1].
13
Remote Modem
processor
Local registration Local registration
table table
APSS ADSP
14 2. When a command request is sent from a connected PC via QXDM Professional™ (QXDM
15 Pro), the apps processor compares the request to its table, and the command is forwarded to
16 the relevant processor.
1 3. The processor handling the command, e.g., modem or ADSP, sends a response routed
2 through the apps processor, which forwards it to the PC.
3
4
17 Subsystem commands are discussed in subsystem ICDs, and the nonsubsystem commands are
18 explained in [Q3].
19 The packet service operates by using a dispatch table for inbound packets. The master table is a
20 list of client tables, each identified by an SSID, and a table of command code/packet handler
21 function pointer sets.
22 When it is dispatched, the client must allocate a response packet. Allocation is implemented using
23 the dedicated diag heap. If allocation is not successful, a block and retry mechanism is employed
24 until enough memory is available for the response packet. Clients should still handle the case of a
25 NULL response allocation by not sending one.
26 When it is committed, the response is placed in a queue to be serviced by the diag task at the next
27 Tx packet boundary. diagpkt_rsp_send() is called by diagbuf_drain() to dequeue and send a
28 response packet. This is done at every packet boundary to ensure that packet service response
29 packets are sent to the external device as quickly as possible. If packet service latency is greater
30 than ~2 sec, external devices may time out and assume that the connection with diag services is
31 lost. Therefore, the client should respond in less than 1 sec.
32 APIs and implementation can be found in diagpkt.h and diagpkt.c.
33 A simple example using the ESN request and response is shown in Table 2-1 and Table 2-2.
1 Table 2-3 shows the macros for Debug Message service MSG 2.0.
4 For example, in MSG_2 (ss_id, ss_mask, fmt, arg1, arg2), ss_mask can take the values FATAL,
5 ERROR, HIGH, MED, and LOW (msg_mask.h).
6 2.3.2.1 Filtering
7 MSG 2.0 filtering uses a 32-bit mask for each SSID. Each message is filtered using a bitwise
8 AND against a MSG system mask. If the AND operation is nonzero, the message passes the
9 filter. There are two types of filtering:
10 n Build-time filtering – Each SSID has a build mask with the naming convention,
11 MSG_BUILD_MASK_<SSID name> (msgtgt.h). A MSG macro is conditionally compiled
12 into the code based on this build-time mask.
13 n Runtime filtering – Filtering is performed based on the mask set by the user in an external
14 tool, e.g., QXDM Pro.
15 Filter table
16 The external device may query the message service for a list of SSID ranges and build/runtime
17 masks for all SSIDs. When msg.c is compiled, it enables MSG_TGL_GEN prior to including
18 msgcfg.h. This declares a table to be used by the Debug Message service. This table is a list of
19 structures containing SSID ranges and pointers to build mask arrays and runtime mask arrays.
20 The external device may query all of this information. As SSIDs are added to msgcfg.h, this table
21 must also be updated.
22 Legacy macros are assigned to MSG_SSID_LEGACY (SSID 0), unless
23 MSG_BT_SSID_LEGACY is set to a valid SSID symbol.
24 2.3.2.2 F3 trace
25 F3 trace is a runtime buffer in the device’s RAM memory where F3/Debug messages can be
26 saved and retrieved later from a RAM dump. F3 trace does not support MSG_SPRINTF macros.
27 Definitions needed for this feature are:
28 n DIAG_F3_TRACE_BUFFER_SIZE – Defines the buffer size; currently set to 128 KB
29 n FEATURE_SAVE_DEBUG_TRACE – Main feature to enable F3 trace saving; must be
30 defined
31 n FEATURE_SAVE_TRACE_ON_BY_DEFAULT – Enables F3 trace saving by default when
32 NV items are not set. For example:
33 ¨ If feature is defined and NV items are set, NV item values are used.
34 ¨ If feature is not defined and NV items are not set, F3 trace is disabled.
1 ¨ If feature is enabled, the following defines can be used to further control the settings:
2 – DIAG_F3_TRACE_CONTROL_MASK_DEFAULT_VAL
3 • 0x0 – Disables F3 message saving
4 • 0x1 – Enables F3 message saving
5 – DIAG_F3_TRACE_DETAIL_MASK_DEFAULT_VAL – 8-bit bitmask (where bit 0
6 is Least Significant Bit) that controls the levels of detail of the saved F3 trace; if a bit
7 is set to 1, the information associated with that bit is saved to the buffer; bitmask
8 details are given in Table 2-4.
10 2.3.2.3 Qshrink
11 Qshrink reduces the memory footprint of F3 messages in target builds. Prior to Qshrink 2.0, the
12 optimization was done by maintaining a hash table for format strings and filenames. This hash
13 table was shared with QXDM Pro and used by the T32 recovery script to reconstruct the hashed
14 messages from F3 trace; e.g., a 4-byte hash is assigned to the following debug message with an
15 associated source file:
16
19 Qshrink 3.0 additionally hashes the SSID, subsystem mask, and runtime mask associated with the
20 F3 message. The hash table is added to modem ELF for runtime filtering and reconstruction of
21 hashed messages. The reconstruction is currently being done by diag for QXDM Pro messages
22 (not needed for F3 trace), so no change is needed on the QXDM Pro side.
1 This service queues reported events and packages several events to be sent in a single packet. To
2 save bandwidth, several events are reported in one packet. Time deltas are used to compress the
3 timestamp information.
4 The event service is designed to be reliable. Event packets are sent before any other unsolicited
5 diagnostic data type. Event packets are sent when the stale timer expires or the event queue
6 exceeds a configurable threshold size, which is settable in diagtune.h.
7
19 #define DIAG_SUBSYS_DIAG_SERV 18
20 PACK(void *) diagdiag_subsys_loopback (
21 PACK(void *) req_pkt,
22 uint16 pkt_len
23 )
24 {
25 /* Retrieve sub-system command code from request pkt*/
26 diagpkt_subsys_cmd_code_type cmd_code =
27 diagpkt_subsys_get_cmd_code (req);
28 /* Allocate memory for response pkt */
29 diag_subsys_loopback_rsp_type *rsp =
30 (diag_subsys_loopback_rsp_type *)diagpkt_subsys_alloc
31 (DIAG_SUBSYS_DIAG_SERV, cmd_code, pkt_len);
32
13 2. Create a subsystem command table. APSS commands are shown in Table 3-1 and modem
14 commands are shown in Table 3-2.
15 ¨ API
16
17 typedef struct
18 {
19 word cmd_code_lo; /* Minimum Command code value */
20 word cmd_code_hi; /* Maximum Command code value */
21 PACK(void *) (*func_ptr) (PACK(void *) req_pkt_ptr, uint16
22 pkt_len); /* Pointer to Function to handle the packet when command
23 code is in the range of cmd_code_lo, cmd_code_hi */
24 }
25 diagpkt_user_table_entry_type;
26
17 #define DIAG_SUBSYS_DIAG_SERV 18
18 DIAGPKT_DISPATCH_TABLE_REGISTER (DIAG_SUBSYS_DIAG_SERV,
19 diagdiag_subsys_tbl);
20
24 After defining a new log packet, it is necessary to rebuild the code and verify that the new log
25 packet performs properly. Information on debugging the new subsystem command will be
26 provided in the next revision of this document.
9 #define DIAG_SUBSYS_DIAG_SERV 18
10 #define DIAGDIAG_STRESS_TEST_DELAYED_RSP 0x0063 /* 99 */
11 PACK(void *) diagdiag_delayed_rsp_test (
12 PACK(void *) req_pkt,
13 uint16 pkt_len
14 )
15 {
16 uint32 delayed_rsp_id = 0;
17 /* Allocates immediate response pkt for sub-system version 2 pkt
18 (cmd code 128)*/
19 diagdiag_delayed_rsp_test_rsp_type *rsp =
20 (diagdiag_delayed_rsp_test_rsp_type *)diagpkt_subsys_alloc_v2
21 (DIAG_SUBSYS_DIAG_SERV, DIAGDIAG_STRESS_TEST_DELAYED_RSP,
22 sizeof(diagdiag_delayed_rsp_test_rsp_type));
23 if(rsp) {
24 delayed_rsp_id = rsp->delayed_rsp_id; /*Set by Diag dispatcher to
25 help Tool unify all responses for this command*/
26 /* Commit immediate response pkt, or return 'rsp' pointer for
27 Diag dispatcher to commit*/
28 diagpkt_commit(rsp);
29 }
30
1 rsp = NULL;
2 /* Allocates delayed response pkt for sub-system version 2 pkt (cmd
3 code 128)*/
4 rsp = (diagdiag_delayed_rsp_test_rsp_type
5 *)diagpkt_subsys_alloc_v2_delay(DIAG_SUBSYS_DIAG_SERV,
6 DIAGDIAG_STRESS_TEST_DELAYED_RSP, delayed_rsp_id,
7 sizeof(diagdiag_delayed_rsp_test_rsp_type));
8 if(rsp) {
9 rsp->response_cnt = 1; /* should increment for each response pkt
10 sent*/
11 /* Must be called for the delayed response to be committed */
12 diagpkt_delay_commit(rsp);
13 }
14
15 return NULL;
16 }
17
18 2. Create a subsystem command table. APSS commands are shown in Table 3-3 and modem
19 commands are shown in Table 3-4.
20 ¨ API – Same as shown in Section 3.1.1
21 ¨ Sample code on the modem
22
4 #define DIAGPKT_DISPATCH_TABLE_REGISTER_V2_DELAY(xx_cmdcode,
5 xx_subsysid, xx_entry) \
6 do { \
7 static diagpkt_master_table_type xx_entry##_table = { \
8 1, xx_cmdcode, xx_subsysid, sizeof (xx_entry) / sizeof
9 (xx_entry[0]), DIAG_NO_PROC, 0, DIAGCOMM_CTRL_NO_PORT, xx_entry \
10 }; \
11 /*lint -save -e717 */ \
12 diagpkt_tbl_reg_append_proc (&xx_entry##_table); \
13 } while (0)
14 /*lint -restore */
15
26 After defining a new log packet, it is necessary to rebuild the code and verify that the new log
27 packet performs properly. Information on debugging the new subsystem command will be
28 provided in the next revision of this document.
6 …
7 #define LOG_DATA_PROTOCOL_LOGGING_EX_C ((0x82C) + LOG_1X_BASE_C)
8 #define LOG_RF_WCDMA_LOG_V3_C ((0x82D) + LOG_1X_BASE_C)
9 #define LOG_ROHC_DECOMPRESSOR_INPUT_C ((0x82E) + LOG_1X_BASE_C)
10 #define LOG_ROHC_COMPRESSOR_OUTPUT_C ((0x82F) + LOG_1X_BASE_C)
11
15 To add a new log packet, add it to the list of defines and update LOG_1X_LAST_C to specify the
16 last log packet ID. The following example shows the addition of 0x830.
17
18 …
19 #define LOG_DATA_PROTOCOL_LOGGING_EX_C ((0x82C) + LOG_1X_BASE_C)
20 #define LOG_RF_WCDMA_LOG_V3_C ((0x82D) + LOG_1X_BASE_C)
21 #define LOG_ROHC_DECOMPRESSOR_INPUT_C ((0x82E) + LOG_1X_BASE_C)
22 #define LOG_ROHC_COMPRESSOR_OUTPUT_C ((0x82F) + LOG_1X_BASE_C)
23 #define LOG_FOO_TEST_C ((0x830) + LOG_1X_BASE_C)
24
28 The following code sample illustrates the use of the new log packet:
29
30 #include "log.h"
31 #include "log_codes.h"
32
33 typedef struct
34 {
35 log_hdr_type xx_header; /* place holder */
36 int param; /* parameter */
37 int task_pri; /* task priority */
38 } foo_log_type;
39
7 if (log != NULL)
8 {
9 log.foo1 = param;
10 log.foo2 = rex_get_pri ();
11 log_commit (log);
12 }
13 }
14
15 After defining a new log packet, it is necessary to rebuild the code and verify that the new log
16 packet performs properly.
21 …
22 EVENT_PM_UE_MODE = 0x9D6,
23 EVENT_TDSCDMA_SELF_HOSTING = 0x9D7,
24 EVENT_LTE_ML1_SEARCH_IDLE = 0x9D8,
25
26 EVENT_LAST_ID = 0x9D8,
27 EVENT_NEXT_UNUSED_EVENT,
28
29 To add a new event, add it to the list of defines and update EVENT_LAST_ID to specify the last
30 event ID. The following example shows the addition of 0x9D9:
31
32 …
33 EVENT_PM_UE_MODE = 0x9D6,
34 EVENT_TDSCDMA_SELF_HOSTING = 0x9D7,
35 EVENT_LTE_ML1_SEARCH_IDLE = 0x9D8,
36 EVENT_FOO = 0x9D9,
37
38 EVENT_LAST_ID = 0x9D9,
39 EVENT_NEXT_UNUSED_EVENT,
40
1 The following code sample illustrates the use of the new event:
2
3 #include "event.h"
4 #include "event_defs.h"
5
10 event_report (EVENT_FOO);
11
12 /* ... */
13 }
14
15 After defining an event report, it is necessary to rebuild the code and verify that the new event
16 report performs properly.
26 In msgtgt.h, define the mask for the new SSID. In the following example,
27 MSG_BUILD_MASK_MSG_SSID_FOO is defined as a new mask:
28
29 …
30 #if 1
31 #define MSG_BUILD_MASK_MSG_SSID_FOO (MSG_LVL_MED | 0x00ff00)
32 #endif
33
1 The following code sample illustrates the use of the new SSID:
2
3 #include "msg.h"
4 #include "msgcfg.h"
5
14 After adding a new SSID, it is necessary to rebuild the code to verify that the new SSID is
15 registered.
16
2 On-device logging allows diagnostic traffic to be saved to a memory device, i.e., SD card or
3 eMMC. It can be used in field testing when connecting the device to a workstation or laptop is
4 undesirable. Later on, host PC tools can be used to process the logged items files.
5 On-device logging uses circular logging, which allows logging to continue even if the device runs
6 out of memory. When the device runs out of memory, the application deletes the oldest log file to
7 create free space and continues logging. With each deletion of a file, the application prints the log
8 filename and size of the log file (in KB) that was deleted to create space. The deleted logs are not
9 recoverable.
20 ls
21
22 When the SD card is mounted on the device, a list of files present on the SD card appears. If a
23 list of files does not appear, reboot the phone and repeat this step. It takes approximately
24 10 sec for the card to get mounted after power-up.
25 4. Once the SD card is mounted, push the mask configuration file to the device.
26
31 /system/bin/diag_mdlog
32
1 Table 4-1 gives the available options with the diag_mdlog application.
3 Syntax example
4
22
23
1 5. In the SD Logging drop-down list, select Save Diag masks for Stream 1 and click OK.
2
3
5 NOTE: Stream 2 is intended for an obsolete feature and should not be used.
6 6. Enter a filename or keep the system-generated one and click Save. A diag.cfg file, e.g.,
7 DIAG_test1.cfg, is generated in the C:\Users\Public\Documents\Qualcomm\QXDM\
8 ISF\DIAG directory.
9 NOTE: It is not necessary to close QXDM Pro before generating another config file, although there is no
10 harm in doing so. Closing QXDM Pro after generating a config file does not result in deletion of
11 a saved file.
10
11
13
14
1 5. In the SD Logging drop-down list, select Load Diag masks for Stream 1.
2
3
5 NOTE: Stream 2 is intended for an obsolete feature and should not be used.
6 6. From the file dialog that appears, select an existing diag.cfg file and click Open.
7
8
1 The diag masks from the chosen stream are loaded and displayed.
8 75 18 0 0 1 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0
9
5
6
7 The name of the diag stress test request displays in the QXDM Pro Command Example status
8 bar.
9
10
12
13
4
5
6 b. Select the applicable .cfg file and click Open. The subsystem command automatically
7 appends to the end of the selected file.
8 Note that this dialog is displayed only if a diag stress test subsystem was selected.
10 NOTE: If there are no .cfg files in the folder, see Section 4.4.1 for instructions on creating a .cfg file.
2
3
1 4. When the Save the request to... dialog appears, select a diag.cfg file and click Open:
2
3
4 5. Click OK in the Config dialog. The Task Profile subsystem requests are automatically saved
5 in the selected diag config file.
6
7
8 NOTE: If there is no diag.cfg file in the folder, see Section 4.4.1 for instructions on creating a .cfg file.
11 In the default design, non-HLOS processors frequently drain packets to the communication layer
12 and hence to the apps processor. This results in too many wake-ups for the apps processor,
13 causing high current drain for the device. Non-HLOS processors have the ability to buffer data
14 for longer durations, reducing the current drain on the device.
15 When there is more than one client in the system, a client opting for real-time data is not
16 suppressed by a client opting for Non-Real-Time (NRT) data. The clients vote for their desired
17 mode and the apps processor diag makes a decision on the final mode, considering all the active
18 diag clients (DCI and different logging modes) and the state of USB connection.
19 The APIs for voting for Real-Time and NRT/Buffering modes are provided for the diag and DCI
20 clients.
1 4.5.1 NRT/Buffering
2 In NRT mode, there are very few apps processor wake-ups. If there are no other active processes
3 running, it might go to power collapse, and hence the diag driver would drop packets to be sent to
4 user space.
5 To prevent the system from power collapse, the diag driver notifies the Power Management core
6 that a wake-up event is being processed by acquiring a wake-up source object. The diag driver
7 acquires the wake-up source in the SMD-notify context and holds the wake-up source until the
8 data is copied to the user space library. Once the data reaches the user space, the diag library
9 signals the client to release the acquired wake-up object. It is then the client’s responsibility to
10 acquire and release a new wake-up source(s) within their app to process the data.
11 When NRT or Buffering mode is selected on a processor, the diag drain timer is set to a larger
12 value along with the buffer threshold adjusted to hold more data before forwarding it to the apps
13 processor. When a USB is connected, power consumption is already high and there is no
14 significant savings in power. APIs are provided for diag and DCI clients to achieve these power
15 savings, giving similar results to running on-device logging with a –b (buffering) argument:
16
19 This function is used for the diag client. It accepts parameters MODE_REALTIME or
20 MODE_NONREALTIME and returns 0 for success.
3 The diag_mdlog on-device logging application can also be started at boot time, without ADB
4 shell command intervention. To start diag_mdlog at boot time, the following code changes must
5 be made and the code recompiled.
9 MSM8960
10 File: /system/core/rootdir/init.rc
11 At the end of the file, add the code shown below.
14 APQ8064+MDM9x15
15 Make the same changes as on MSM8960 above.
16 If logs from MDM are missing, try the following change in diag_mdlog.c:
/* Read mask file to tell On Device Logging what you are interested in */
sleep(10);
diag_read_mask_file();
. . .
}
17
1 MDM9x15
2 Add a diag_mdlog bash script such as the following.
#! /bin/sh
set -e
case "$1" in
start)
echo -n "Starting diag_mdlog: "
start-stop-daemon -S -b -a /usr/bin/diag_mdlog -- -f /data/all_logs.cfg
-o /data/diag_logs
echo "done"
;;
stop)
echo -n "Stopping diag_mdlog: "
start-stop-daemon -K -n diag_mdlog
echo "done"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage diag_mdlog { start | stop | restart }" >&2
exit 1
;;
esac
exit 0
3
4 Linux services can be started, stopped, and reloaded with the use of scripts stocked in /etc/init.d/.
5 However, during startup or when changing run level, those scripts are searched as follows in
6 /etc/rcX.d/, where X is the run level number.
7 1. Push the above script in /etc/init.d/.
8 2. Add symlinks to this script in /etc/rc?.d/.
2 The socket logging feature provides diagnostic traffic over Ethernet and Wi-Fi. If the device has
3 Ethernet/Wi-Fi enabled, it can be connected to QPST and QXDM Pro to fetch diag packets
4 similar to other logging methods. The architecture for socket logging is shown in Figure 5-1.
8 C:\Users\johndoe>ping 10.73.82.37
9 Pinging 10.73.82.37 with 32 bytes of data:
10 Reply from 10.73.82.37: bytes=32 time=76ms TTL=55
11 Reply from 10.73.82.37: bytes=32 time=100ms TTL=55
12 Reply from 10.73.82.37: bytes=32 time=122ms TTL=55
13 …
13 Note that appending an & to the command causes the application to run in the background, which
14 allows the application to keep running when the USB cable is disconnected.
18 # ps
19
24 When the diag_socket_log app exits, diag functionality returns to the default USB configuration.
2 UART logging refers to getting diag packets over a UART device. The device can be connected
3 to QPST/QXDM Pro via UART, and traffic can be fetched similar to other logging methods.
6 6.1.3 Examples
7 n The user can start the application with MSM, MDM, or QSC traffic as follows:
8
11 This instance of the UART application kills the previous instance of the UART application
12 running with a processor type as MDM/QSC and starts routing diag traffic from
13 MSM→QXDM Pro.
14 n To switch to the remote (MDM, MDM2, etc.) processor, start the UART application in
15 another shell with the processor option as MDM:
16
19 This instance of the UART application kills the previous instance of the application running
20 with an MSM/QSC processor type and starts routing diag traffic from MDM→QXDM Pro.
21 n To switch to the remote QSC processor, start the UART application in another shell with
22 QSC as a processor option:
23
26 This instance of the UART application kills the previous instance of the application running with
27 an MSM/MDM processor type and starts routing diag traffic from QSC→QXDM Pro.
3 The apps processor serves as master in the diag central routing architecture. All slave processors
4 (modem, ADSP, and WCNSS) forward their diag traffic to the apps processor, which then pushes
5 the traffic over the USB or UART channels.
6 The modem processor can have a standalone diag configuration as well, i.e., only modem diag
7 traffic is pushed out of the device. This can be done by configuring a UART device on the
8 modem to support diag services. Hence, a UART device can be configured either on the apps
9 processor or modem processor for diag services.
10 Make sure that the GSBI or BLSP device pins being used on the configured processor are not
11 being used on any other processor or by some client other than diag services.
define FEATURE_FIRST_UART
define FEATURE_DMOV_HS_UART_ON_APPS
define FEATURE_RDEVMAP_DIAG_DEFAULT_TO_USB
define RDM_USB_SER1_INIT_SRVC RDM_DIAG_SRVC
define RDM_UART1_INIT_SRVC RDM_DIAG_SRVC
define FEATURE_DIAG_MP_MASTER_APPS
define FEATURE_DIAG_MP_MASTER_MODEM
define FEATURE_DIAG_MP_MODEM_ONLY
define DIAG_RUNTIME_DEVMAP
define FEATURE_RDEVMAP_DIAG_DEFAULT_TO_USB
define RDM_USB_SER1_INIT_SRVC RDM_DIAG_SRVC
define FEATURE_DIAG_MP_MASTER_APPS
define FEATURE_DIAG_MP_MASTER_MODEM
define FEATURE_DIAG_MP_MODEM_ONLY
define DIAG_RUNTIME_DEVMAP
define FEATURE_FIRST_UART
define FEATURE_DIAG_MODEM_ONLY
define FEATURE_FIRST_UART
define FEATURE_DIAG_MODEM_ONLY
9 The UART configurations have been tested to work with the following tools:
10 n QXDM Pro
11 n QPST NV Backup/Restore
12 n EFS Explorer
13 n QSPR
14 6.4 Limitations
15 Due to UART throughput, QPST may lose the port connection in heavy traffic. QPST only waits
16 400 ms for any command/response, including polling. Because of a throughput bottleneck, the
17 response is delayed and reaches QPST after 2 to 3 sec.
18 If a port disconnection issue is observed during diag over UART logging:
19 n Update QPST register settings
20 n Configure QPST and QXDM Pro for the new settings
21 The default QPST port parameter settings are:
22 n Polling timeout duration – 400 ms
23 n Polling timer interval – 600 ms
24 n Polling maximum retries – 3
[HKEY_LOCAL_MACHINE\Software\Qualcomm\QPST\PARAMS\PORT_SERVER]
"polling_timeout_ms"=dword:00000bb8
"polling_timer_interval_ms"=dword:00000bb8
"polling_max_tries"=dword:00000005
[HKEY_CURRENT_USER\Software\Qualcomm\QPST\PARAMS\PORT_SERVER]
"polling_timeout_ms"=dword:00000bb8
"polling_timer_interval_ms"=dword:00000bb8
"polling_max_tries"=dword:00000005
10 or
11 ¨ Manually change the registry setting for QPST, i.e., the timeout, polling interval, and
12 number of retries.
13 – Go to regedit, to the path [HKEY_LOCAL_MACHINE\Software\Qualcomm\
14 QPST\PARAMS\PORT_SERVER], and update the configuration values.
15 • polling_timeout_ms – 3000 ms
16 • polling_timer_interval_ms – 3000 ms
17 • polling_max_tries – 5
18 – Go to regedit, to the path [HKEY_CURRENT_USER\Software\Qualcomm\
19 QPST\PARAMS\PORT_SERVER], and update the configuration values.
20 • polling_timeout_ms – 3000 ms
21 • polling_timer_interval_ms – 3000 ms
22 • polling_max_tries – 5
12 5. Start QXDM Pro and set the mask per the requirement. However, this should be kept minimal
13 and use only required logs. Wait for the target to be enumerated in QPST over the UART
14 port. This may take additional time because the QPST parameters were changed.
15 6. Connect QXDM Pro to the device over the COM port.
16 7. In this configuration, runtime switching does not work because QPST needs time for the port
17 to be reenumerated due to the change in parameters. To change the logging processor:
18 a. Disconnect QXDM Pro.
19 b. Kill the diag_over_uart app. Wait for the target to be enumerated on USB (all ports) and
20 to disappear from the UART port. This takes time due to the change in the QPST port
21 parameter.
22 c. Start the UART app with the desired processor by repeating steps 4 through 6.
23
4 7.1 Overview
5 The DCI allows a client application to inject command requests; to set logs and events masks on
6 the peripheral processor; and receive back command responses, log packets, and event reports on
7 the apps processor. The existing diag communication with PC Tools has not changed. Therefore,
8 this interface can be used simultaneously with the existing use of QXDM Pro/On-Device
9 Logging.
10 A new SMD data channel is opened to handle DCI traffic. The apps processor Diag Router
11 manages the traffic between the peripheral processors and individual clients. Figure 7-1 is an
12 architectural diagram of DCI.
13
1 7.2 Initialization
2 A client application must call Diag_LSM_Init() to access the diag user space library/LSM API.
3 This call creates a read thread for the client application. While this read thread performs all read
4 operations with the kernel driver and is internal to the diag library, the main client application
5 thread is responsible for write operations such as sending command packets, masks, etc.
6 The client must register with DCI, via the LSM layer, to receive a handle for using any of the
7 DCI services.
8 As part of the initialization process, a client may also register a signal callback and indicate the
9 peripherals for which it must receive state change notification. This notification can be triggered
10 by the opening or closing of a peripheral’s DCI channel (as shown in Figure 7-2), which can be
11 caused by events such as a Subsystem Restart (SSR). The kernel driver keeps track of all DCI
12 clients with the corresponding peripheral mask, signal information, and log/event masks for each
13 client.
14 Figure 7-2 shows the call flow.
Client Peripheral
Apps Kernel
Application Processor
[handle]
Trigger Callback
[ACK]
15
12 NOTE: Unlike command/response packets sent over the primary diag data stream, those sent over the
13 DCI channel are not High-Level Data Link Control (HDLC)-encoded.
Client Client
Peripheral
Application Application Apps Kernel
Processor
(main thread) (LSM read thread)
In sleep state
Trigger command
callback
15
14 NOTE: Unlike log and event packets sent over the primary diag data stream, packets sent using the DCI
15 are not HDLC-encoded.
Client Client
Peripheral
Application Application Apps Kernel
Processor
(main thread) (LSM read thread)
Register log/event
callbacks with LSM layer
Set log/event masks
Send log/event masks
In sleep state
Trigger log/event
callbacks
17
19 7.5 Limitations
20 Currently, DCI support is available on both the modem and apps processors.
21 DCI does not currently support diag debug/F3 messages.
15 7.6.1 Usage
16 Run the sample app using /system/bin/diag_dci_sample.
17 7.6.2 Parsing
18 The sample application has logic to partially parse the log packets to demonstrate processing raw
19 bytes received by a DCI Client.
20 Table 7-1 lists the complete log packet format described in [Q3].
25 Log codes are maintained in several ICDs by each technology team, e.g., the ICD for LTE log
26 packets is [Q14].
27 Raw output
28 c 2 5f 11 0 0 6c b1 52 9e c2 0 2 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
29 0 0 0 0 0 ..
30 20 0 c8 14 0 0 82 b1 52 9e c2 0 1 0 0 fa 63 63 1e 5 64 14 64 14 64 14 64 14
31 64 14 14 0
32 Parsed output
33 Received a Log of type DIAG TEST LOG, length = <log_size>
34 c 2 5f 11 0 0 6c b1 52 9e c2 0 2 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
35 0 0 0 0 0 ..
36 Received a Log of type CPU MONITOR MODEM, length = <log_size>
37 20 0 c8 14 0 0 82 b1 52 9e c2 0 1 0 0 fa 63 63 1e 5 64 14 64 14 64 14 64 14
38 64 14 14 0
1 7.7 Security
2 Several security methods exist to help protect unauthorized applications from using or abusing
3 DCI. The following sections provide a brief overview of these methods, referring to other detailed
4 documentation where appropriate.
21 NOTE: A full descriptions of the Secure Services Module (SSM) can be found in [Q15] or [Q16]
22 depending on the HLOS.
23 The SSM service on the modem processor provides fine-grain controls with which diag
24 commands can be allowed to execute on the modem. Each incoming diag command received on
25 the modem (either through the DCI channel or the standard diag channel) is checked against the
26 modem’s SSM permissions files that have been provisioned to the device by the OEM:
27 n Allowed by SSM – Command executes
28 n Disallowed by SSM – Error response returns to the originator of the command
12 7.8.1.1 DCI
13 A DCI client can request NRT mode by using the following API commands:
14 1. To vote for Real-Time or NRT mode:
15
11 The listener is called if any one of the logs specified by the logs array is generated. num_logs
12 should be the number of logs present in the logs array.
13 The API used to remove an extended log listener is:
14
3 This chapter gives information on troubleshooting QPST port connection issues, collecting QPST
4 port traces, and various techniques and scripts available for analyzing other port connection
5 status. In addition, techniques are described for debugging commands on the APSS and modem
6 processor.
5 3. Select Debugging and Port Traffic from the pop-up dialog window and click OK.
7 A port trace file (PortTrace_COMx) will be created in the QPST Data directory (QPST
8 Configuration→Help→Open Log File Directory).
9 4. Reproduce the issue.
10 5. Once the issue is seen, stop Port trace by selecting Turned Off from the Port Trace options.
11 6. Analyze the generated PortTrace_COMx to investigate the issue.
4 COM3<0C 14 3A 7E
5 2008/11/05 14:37:45.454: 780: P: 12 20 115200 size: 4 --> QueueCount=0
6 2008/11/05 14:37:45.454: 1 reads queued
7 COM3<0C E1 00 E1 F1 1B 04 74 01 00 C8 11 03 00 C8 11
8 03 00 FC 01 FC 01 00 00 00 FF 00 00 00 00 00 00
9 00 00 F6 02 00 00 00 00 00 00 00 00 00 00 00 00
10 F3 28 7E
11
12 To interpret these bytes, refer to [Q3]. The > and < shown in the snippet reflect the direction of
13 the byte stream from/to QPST and the COM port. For example:
14 n COM3<0C 14 3A 7E – QPST sent 0C 14 3A 7E (the request packet) to COM3
15 n COM3>0C E1 ... 7E – Response packet sent from COM3 to QPST
16 In the snippet above:
17 n The last byte, 7E, is the end of the message tag for every diag packet.
18 n The last 2 bytes before the last byte 7E are those for the checksum.
19 n The first 1 byte is the command code, and the matching command definition is found in [Q3].
20 The screenshots here shows the request packet interpretation in QPST port trace.
21
1 This screenshot shows the response packet interpretation in QPST port trace.
3 9.1.3 Ports
4 n If you do not see the expected port, or the port displays “No Phone,” click Add New Port in
5 QPST to determine if the desired port is listed. If so, select the desired port.
6 n Check in Windows Device Manager/Ports. Is there a Diagnostics USB port present? If a
7 Diagnostics USB port is not listed, then it is a USB problem.
8 n Unplug the USB cable, wait for 30 sec, and plug it back in. You should see the port entry for
9 your phone disappear and reappear. If you do not see the port entry disappear and reappear, it
10 is a USB problem.
11 9.1.4 Modem
12 Check to see if the modem is running. In the Windows Device Manager:
13 1. Click Modems.
14 2. Right-click the QTI USB modem entry and select Properties.
15 3. Click Diagnostics.
16 4. Click Query Modem to determine the status of the modem. It is running if the response is
17 “Success.”
16 adb shell
17
20 cd /data/kernel-tests
21 chmod 777 *
22 ./smd_pkt_loopback_test
23
24 3. Monitor the output from the test. If it does not say “Passed,” then it is an SMD problem.
25 9.1.7 Debugfs
26 The diag implementation of debugfs provides some visibility into the current state of the apps
27 Linux Diag. To use debugfs, log into an ADB shell and set up debugfs by entering the following
28 commands:
29
30 mkdir /data/debugfs
31 mount -t debugfs 0/data/debugfs
32
36 cd /data/debugfs/diag
37
5 cat status
6
7 ¨ Display the registration table, i.e., all messages that are currently registered with apps
8 Linux Diag.
9
10 cat table
11
12 ¨ Note that this table is quite large. To output to a file on a PC, from a Windows command
13 window, enter the command:
14
17 If the process_id is -1, then the command is a registration from one of the peripherals and the
18 client contains the ID of the peripheral. The IDs are defined as follows:
19 ¨ Modem – 0
20 ¨ ADSP – 1
21 ¨ WCNSS – 2
22 ¨ APSS – 3
23 Otherwise, the process_id is the process ID of the app that registered for the command that is
24 running on the apps processor. In this case, the client should be 1 (for apps).
25 3. Display the current pending status of the work structs.
26
27 cat work_pending
28
29 4. If the device supports HSIC, display the Diag HSIC driver status.
30
31 cat hsic
32
36 cd /data/debugfs/smd
37
1 2. The tbl and ch commands provide information on the SMD channels opened, i.e., their status
2 and the bytes read/written over these channels:
3 ¨ tbl
4
5 cat tbl
6
7
15 ¨ cat
16
17 cat ch
18
12
9 Table 9-1 Modem loopback command structure in APSS Linux dispatch table
cmd_code subsys_id client_id cmd_code_lo cmd_code_hi process_id
255 18 0 41 41 -1
10 The apps processor forwards this command request to the modem according to client_id.
11 To check if a Linux process registered to service a command is running:
12
1 If a command is found in the dispatch table, and something goes wrong with the command
2 handler that returns a NULL response, no response will be sent by diag.
3 9.2.2 F3 masks
4 F3 masks can be seen as driver→msg_masks.
5 As shown here, every SSID is composed of 4 bytes. The masks start from index 5. Highlighted
6 entries refer to Call Manager (SSID 5) and Diagnostic Services (SSID 7) masks.
10
10 The second command displays the kernel messages to the command window and places them in
11 the dmesg.txt file. This command shows the kernel messages that currently exist and after
12 displaying them, stops and returns to the command line.
13
16 If there are difficulties using the diag user space library when running a user space app, make sure
17 the app was successful in its call to initialize the diag user space library by checking the return
18 value from Diag_LSM_Init():
19 n 1 (TRUE) – Call is successful
20 n 0 (FALSE) – Initialization has failed
21 One of the main causes of failure is permissions. The /dev/diag port has 660 permissions, which
22 allows user and group read/write permissions. Running the app with any of the following should
23 allow access to the /dev/diag port:
24 n Run as user root
25 n Run as user system
26 n Run with qcom_diag group permissions
1 3. diagpkt_process_request()
2 ¨ Search Command Dispatch table (diagpkt_master_table); if present, call callback, which
3 returns the pointer to the response
4 – diagpkt_commit() on the rsp pointer to commit rsp to diag buffer
5 • Queues rsp packet onto response queue, diagpkt_rsp_q
6 • Sets DIAG_RX_RSP_SIG
7 ¨ If not present in the table, sends an error response
8 – diagpkt_err_rsp()
9 4. diagpkt_rsp_send()
10 ¨ diagbuf_send_pkt()
11
13
1 n DIAG_EVENT_DRAIN_SEC_SIG
2 ¨ Set whenever event_stale_sec() is called, indicating that Diag is ready to send an event
3 report packet for secondary queue events
4 ¨ Handled by calling event_drain_sec() to drain events from secondary event queue
5 event_q_sec to transport layer
6 n DIAG_EVENT_TIMER_SIG
7 ¨ Set whenever event_stale_timer expires
8 ¨ Handled by calling event_stale(), which calls event_drain() to drain events from event_q
9 to transport layer
10 n DIAG_EVENT_TIMER_SEC_SIG
11 ¨ Set whenever event_stale_timer_sec expires
12 ¨ Handled by calling event_stale_sec(), which calls event_drain() to drain events from
13 event_q_sec to transport layer
14
5 The “lock” in DSM pool is a mutex lock used by DSM Layer to manage the flow control, as per the above callback threshold values. This
6 should be a 4-byte positive value. Make sure FEATURE_DSM_REX or a similar DSM feature is defined to initialize the “lock” field in a
7 DSM pool structure.
1 n diag_cx_state
2 ¨ First LSB is for DIAG_CX_COMM_S, i.e., Communications Layer connection. If set to
3 0, the channel is not connected; hence, diag will vote for sleep.
4 n diagbuf_head/diagbuf_tail
5 ¨ Both pointers should be equal, showing an empty buffer.
6 ¨ If diagbuf_head is less than diagbuf_tail, it is wrapped, and if diagbuf_head is more than
7 128 k, it is secretly wrapped.
8 n diag_tcb.sigs
9 ¨ DIAG_DRAIN_TIMER_SIG 0x00200000 (set on drain timer expiration)
10 ¨ DIAG_DRAIN_TIMER_LEN 200 ms
11 ¨ DIAG_TX_SIG 0x00000080 (when client commits data to diag buffer)
12 ¨ DIAG_RX_RSP_SIG 0x00000200 (when responses are generated for Rx
13 traffic)
14
1 9.3.9 F3 trace
2 This feature maintains a circular buffer of debug (F3) messages, showing the last n messages sent
3 from the processor. This buffer is separate from other buffers used by diag. It uses an independent
4 message mask that is configured at compile time or (on the modem) by NV items. The
5 masks/filter used by QXDM for debug messages do not apply to the F3 trace buffer.
6 The recover_f3.cmm script is used to extract and process messages from the F3 trace buffer.
7 F3 trace has certain limitations:
8 n It is not supported by all diag MSG APIs, e.g., MSG_SPRINTF is not supported.
9 n It only supports legacy MSG levels (HIGH, MED, LOW, etc.). Messages sent using custom
10 message levels (which are supported by diag) will not be recorded in the F3 trace buffer.
11 9.3.10 Timestamps
12 Each diag packet contains a timestamp field. The timestamp represents the time the packet was
13 allocated, not the time the packet was sent. The timestamp is generated locally on each processor
14 as follows:
15 n Diag reads the timestamp using the time API available on the image it is running on.
16 n Diag does not control or set the timestamp in any way.
17 Timestamp differences or jumps in QXDM Pro logs between packets generally mean either one
18 of the following:
19 n The time value was updated on the individual processor.
20 or
21 n The packets are being sent from different processors, and the timestamps between the
22 processors are not synchronized.
3 10.1 L4/Rex
4 Diag public API files
5 n core\api\services\
6 ¨ diag.h
7 ¨ diag_fusion.h
8 ¨ diag_LSM.h
9 ¨ diagbuf.h
10 ¨ diagcmd.h – Defines command codes and SSIDs
11 ¨ diagcomm.h
12 ¨ diagdiag.h
13 ¨ diagdsm.h
14 ¨ diagnv.h
15 ¨ diagpkt.h
16 ¨ event.h
17 ¨ event_defs.h – Defines event IDs
18 ¨ log.h
19 ¨ log_codes.h – Defines log codes (additional log codes defined in log_codes_umts.h,
20 log_codes_wcdma.h, log_codes_gsm.h)
21 ¨ msg.h
22 ¨ msg_diag_service.h
23 ¨ msg_mask.h
24 ¨ msg_pkt_defs.h
25 ¨ msg_qsr.h
26 ¨ msg_wince.h
27 ¨ msgcfg.h – Defines F3 SSIDs
28 ¨ msgtgt.h – Defines levels for each SSID (High, Med, Low, etc.)
17 10.2 Linux
18 10.2.1 LA
19 Diag public files
20 n kernel\drivers\char\diag\..
1 10.2.2 LE
2 Diag public files
3 n kernel\drivers\char\diag\..
11 #include <mach/msm_ipc_logging.h>
12 void *ipc_log_context_create(int max_num_pages, const char *mod_name);
13 int ipc_log_string(void *ilctxt, const char *fmt, ...);
14
20 APSS API:
21 #include arch_timer.h
22 cycle_t arch_counter_get_cntpct(void);
23
24 MPSS API:
25 #include "DDITimetick.h" //for DalTimetick APIs
26 #include "DalDevice.h" //for DAL data types
27 #include "DALStdErr.h" //for DAL return code
28 static __inline DALResult DalTimetick_Attach(const char *pSystemTimer,
29 DalDeviceHandle** phDalHandle);
30 static __inline DALResult DalTimetick_GetTimetick64(DalDeviceHandle *
31 _h, DalTimetickTime64Type * ticks);
32
1 Debug patches are used to record events using common MPM timecount on APSS and MPSS.
2 MPSS Diag starts a timer when DSMs are exhausted. The timer is cleared when DSMs are freed
3 up. When this timer expires, if DSMs are still not available, crash dumps of the SMD state are
4 gathered.
5 1. MPSS SMD sent the last interrupt at 0x8C64122AF, for which diag must have queued the
6 DSM at 0x8C6412237.
7 After that, several DSMs were queued with SIO until 0x8C7BB15EC. Diag started dropping
8 packets from this point onward, finally leading to a crash at 0x8CAB21F8B.
9
10
11 2. MPSS sent the last IRQ at 0x8C64122AF and APSS received the last IRQ at 0x8C6414B9D.
12 By backtracking in these logs up to ~10 IRQs, it is possible to match a sent IRQ with a
13 received one with the initial time gap in microseconds and then milliseconds.
14 With that mapping, a matching received IRQ is not seen on APSS for the IRQ sent by MPSS.
15 Since the last IRQ on APSS happened a little after the last one sent from MPSS, it is likely
16 that APSS serviced the last two sent IRQs collectively only one time.
17
1 After the last received IRQ, APSS goes into power collapse at the time when diag had to write packets to the SD card. This is clearly
2 an issue that needs to be fixed. A patch was released for the SS for holding wakeup object from when diag is notified to read SMD
3 data, until the time when it is written fully to the user space app. At this point, it is not possible to tell if this issue has led to the
4 subsequent unusual events, i.e., MPSS SMD waiting for ACK interrupt from APSS to empty DSMs, etc.
1 3. After correlating the Kernel log (yellow highlighting) with the rest of the logs (IPC log, red
2 boldface), it can be seen that while the APSS is goes into power collapse, MPSS sends it
3 interrupts to read SMD data. The APSS SMD driver notifies diag, but diag fails to send
4 packets to user space since the APSS has gone into power collapse. The MPSS diag then
5 starts dropping packets and eventually crashes. Later when APSS has resumed, diag writes
6 previously pending packets to user space.
7
24 …
25 <4>[ 252.381492] [0: kworker/u:1: 35] Disabling non-boot CPUs
26 ...
27 <6>[ 252.381753] [0: kworker/u:1: 35] msm_pm_enter
28 <6>[ 252.381753] [0: kworker/u:1: 35] msm_pm_enter: power
29 collapse
30 …
31 <6>[ 252.381753] [0: kworker/u:1: 35] Enabled clock count: 14
32 [ POWER COLLAPSE starts, but Diag has not sent packets to
33 userspace ]
34
3 It is important to correctly file diag software problems with the proper problem area code. This
4 will ensure problem assignments are sent to the diag support team for a more prompt resolution.
5 Apps processor
6 The following shows the list of possible values for Problem Area 3 when reporting apps
7 processor diag issues.
9 When filing a diag software problem support case for an apps processor, select a problem area as
10 follows:
11 n DCI – Usage, Design, Implementation (DCI); see Chapter 7
12 n OnDevice/SD logging – See Chapter 4; logs required are mask configuration file (.cfg) and
13 log file (.qmdl); possible issues include:
14 ¨ Cannot save traffic or traffic stops from a core or chipset (in case of fused chipsets)
15 ¨ Cannot execute mdlog script
16 ¨ Packet timestamp synchronization issue
17 ¨ Throughput concerns
18 n Other – Diag listener issues, etc.
19 n Port disconnect – Diag port is lost in QPST/QXDM Pro and goes to Waiting state; QPST port
20 trace logs as described in Chapter 9 are required
21 n Socket logging – Diag over Ethernet or Wi-Fi
22 n UART logging – Configuring diag service over UART; see Chapter 6
1 Other processor
2 The following shows the list of possible values for Problem Area 3 when reporting other
3 processor diag issues.
5 When filing a diag software problem support case for a nonapps processor, select a problem area
6 as follows:
7 n DCI – DCI
8 n Initialization – Command/log registrations, etc.
9 n Other – Diag Listener issues, etc.
10 n Security – Diag security concerns
11 n Sleep issues – Diag voting against sleep/diag waking up the core intermittently; logs required
12 are core RAM dump with matching ELF/vmlinux; reproduction steps
13
4 This appendix discusses the QCOM_DIAG custom Android permissions. It describes how to
5 declare these permissions and how to enable an APK to use them. The implementation of these
6 permissions provides a mapping between the high-level Android permission and the low-level
7 Linux permission. See [R1] for information on the mapping.
15 <permission android:description="@string/desc"
16 android:label="@string/label"
17 android:name="com.qualcomm.permission.QCOM_DIAG"
18 android:protectionLevel="signatureOrSystem"/>
19
20 If the APK needs to use these permissions, it must declare its need in the APK’s
21 AndroidManifest.xml file using the format here:
22
23 <uses-permission android:name="com.qualcomm.permission.QCOM_DIAG"/>
24
25 NOTE: The protection level for this permission is signatureOrSystem. This requires that the APK be
26 either part of the system image or a signed APK to use either of these permissions.
5 <permissions>
6 <permission name="com.qualcomm.permission.QCOM_DIAG" >
7 <group gid="qcom_diag" />
8 </permission>
9 </permissions>
14 LOCAL_MODULE_TAG := optional
15
16 For information on how to add the APK to the system image, see Section B.1.5.
17 The following will cause the APK to be signed with the platform certificate:
18
19 LOCAL_CERTIFICATE := platform
20
25 LOCAL_MODULE := com.qualcomm.qcom_diag.xml
26 LOCAL_MODULE_TAGS := optional
27 LOCAL_MODULE_CLASS := ETC
28 LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
29
8 DIAG += com.qualcomm.diag.qcom_diag
9 DIAG += com.qualcomm.qcom_diag.xml
10
11 where the APK name is com.qualcomm.diag.qcom_diag and the mapping .xml file is
12 com.qualcomm.qcom_diag.xml.
13 The device-vendor.mk file can be found in <build_root>/vendor/qcom/proprietary/common/
14 config, where build_root is the root folder of the Android source code.
24 <uses-permission android:name="com.qualcomm.permission.QCOM_DIAG"/>
25
6 java –jar
7 <build_root>/out/host/<your_host>/framework/signapk.jar
8 <build_root>/build/target/product/security/platform.x509.pem
9 <build_root>/build/target/product/security/platform.pk8 unsigned_app.apk
10 signed_app.apk
11
13 NOTE: This command will sign the APK only for this particular build.
14 Signing an APK with the platform key will allow that APK to use any permission protected by
15 the platform key.
16