概述
MSM平台AP和CP封装到一个芯片,共享内容。所以之前也说过,高通的MSM解决方案中,CP的代码都是由AP放到指定地址的内存中以供CP运行。那上传完代码,CP开始跑之后,AP/CP之间的通信又是怎么弄的呢?
其实也是在内存中开辟一段共享内存进行通信的。高通文档中有介绍以下三种。
-
SMD : Shared Memory Driver
-
SMEM : Shared Memory Manager
-
SMSM : Shared State Machine
来看一下上面三种共享内存的具体说明:
SMEM :
-
Shared memory service, provides basic SMEM allocation services
-
Section of physical RAM is located at a predetermined location, sharing between
processors
-
Provides low-level interprocessor communication primitives (apps processor to
modem processor) that can be called from interrupt context
SMSM:
-
Shared memory state machine
-
Provides low-level synchronization between different processors
SMD :
-
Shared memory driver
-
Provides multiple data channels
smd channel setup过程
1.首先Modem会调用sio_open()等函数接口,根据port id打开一个smd port。smd_sio_open()函数会被调用。然后smdi_alloc_channel_info()函数会在shared memory分配一个port.
2.在AP端,msm_smd_probe()会启动一个wrker thread,叫smd_channel_probe_worker()。这个函数会detect所有已经被modem端分配过的smd channel。通过这一步之后,驱动函数就可以通过smd channel名字打开一个smd channel。
实际在smd_init_dt.c的 msm_smd_probe()函数中添加log输出结果为:
<6>[0.538769] [0:swapper/0:1] msm_smd_probe remote_pid=1
<6>[0.539232] [0:swapper/0:1] msm_smd_probe remote_pid=4
<6>[0.539665] [0:swapper/0:1] msm_smd_probe remote_pid=6
当然这个结果是根据dtsi文件定义里读出来的内容。
qcom,smd-modem {
compatible = "qcom,smd";
qcom,smd-edge = <0>;
qcom,smd-irq-offset = <0x0>;
qcom,smd-irq-bitmask = <0x1000>;
interrupts = <0 25 1>;
label = "modem";
};
...
qcom,smd-wcnss {
compatible = "qcom,smd";
qcom,smd-edge = <6>;
qcom,smd-irq-offset = <0x0>;
qcom,smd-irq-bitmask = <0x20000>;
interrupts = <0 142 1>;
label = "wcnss";
};
...
qcom,smd-rpm {
compatible = "qcom,smd";
qcom,smd-edge = <15>;
qcom,smd-irq-offset = <0x0>;
qcom,smd-irq-bitmask = <0x1>;
interrupts = <0 168 1>;
label = "rpm";
qcom,irq-no-suspend;
qcom,not-loadable;
};
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
上面定义的edge,用来根据edge_to_pids变量来转换成remote pid。edge对应的值是以下枚举类型。
enum {
SMD_APPS_MODEM = 0,
SMD_APPS_QDSP,
SMD_MODEM_QDSP,
SMD_APPS_DSPS,
SMD_MODEM_DSPS,
SMD_QDSP_DSPS,
SMD_APPS_WCNSS,
SMD_MODEM_WCNSS,
SMD_QDSP_WCNSS,
SMD_DSPS_WCNSS,
SMD_APPS_Q6FW,
SMD_MODEM_Q6FW,
SMD_QDSP_Q6FW,
SMD_DSPS_Q6FW,
SMD_WCNSS_Q6FW,
SMD_APPS_RPM,
SMD_MODEM_RPM,
SMD_QDSP_RPM,
SMD_WCNSS_RPM,
SMD_TZ_RPM,
SMD_NUM_TYPE,
};
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
然后在smd_channel_probe_worker()->scan_alloc_table函数中添加log。
static void smd_channel_probe_worker(struct work_struct *work)
{
struct smd_alloc_elm *shared;
struct remote_proc_info *r_info;
unsigned tbl_size;
r_info = container_of(work, struct remote_proc_info, probe_work);
shared = smem_get_entry(ID_CH_ALLOC_TBL, &tbl_size,
r_info->remote_pid, 0);
if (!shared) {
pr_err("%s: allocation table not initialized\n", __func__);
return;
}
mutex_lock(&smd_probe_lock);
scan_alloc_table(shared, r_info->ch_allocated, PRI_ALLOC_TBL,
tbl_size / sizeof(*shared),
r_info);
shared = smem_get_entry(SMEM_CHANNEL_ALLOC_TBL_2, &tbl_size,
r_info->remote_pid, 0);
if (shared)
scan_alloc_table(shared,
&(r_info->ch_allocated[SMEM_NUM_SMD_STREAM_CHANNELS]),
SEC_ALLOC_TBL,
tbl_size / sizeof(*shared),
r_info);
mutex_unlock(&smd_probe_lock);
}
static void scan_alloc_table(struct smd_alloc_elm *shared,
char *smd_ch_allocated,
int table_id,
unsigned num_entries,
struct remote_proc_info *r_info)
{
if (!smd_alloc_channel(&shared[n], table_id, r_info)) {
pr_info("shared[%d].name = %s, r_info->remote_pid = %d table_id=%d\n",n,shared[n].name,r_info->remote_pid,table_id);
smd_ch_allocated[n] = 1;
}
else
SMD_INFO(
"Probe skipping proc %d, tbl %d, ch %d, not allocated\n",
r_info->remote_pid, table_id, n);
}
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
输出的log结果为:
<6>[0.544016][0:kworker/0:1:34] shared[4].name = rpm_requests, r_info->remote_pid = 6 table_id=1
<6>[10.294419][0:kworker/0:1:34] shared[1].name = IPCRTR, r_info->remote_pid = 1 table_id=1
<6>[10.295081][0:kworker/0:1:34] shared[2].name = SSM_RTR_MODEM_APPS, r_info->remote_pid = 1 table_id=1
<6>[10.848152][0:kworker/0:1:34] shared[3].name = sys_mon, r_info->remote_pid = 1 table_id=1
<6>[10.863365][0:kworker/0:1:34] shared[4].name = DIAG_2_CMD, r_info->remote_pid = 1 table_id=1
<6>[10.864631][0:kworker/0:1:34] shared[5].name = DIAG_2, r_info->remote_pid = 1 table_id=1
<6>[10.866978][0:kworker/0:1:34] shared[6].name = DIAG_CNTL, r_info->remote_pid = 1 table_id=1
<6>[10.868057][0:kworker/0:1:34] shared[7].name = DIAG_CMD, r_info->remote_pid = 1 table_id=1
<6>[10.869126][0:kworker/0:1:34] shared[8].name = DIAG, r_info->remote_pid = 1 table_id=1
<6>[10.874224][0:kworker/0:1:34] shared[9].name = apr_audio_svc, r_info->remote_pid = 1 table_id=1
<6>[10.874991][0:kworker/0:1:34] shared[10].name = apr_apps2, r_info->remote_pid = 1 table_id=1
<6>[12.453190][0:kworker/0:1:34] shared[1].name = IPCRTR, r_info->remote_pid = 4 table_id=1
<6>[12.454124][0:kworker/0:1:34] shared[2].name = sys_mon, r_info->remote_pid = 4 table_id=1
<6>[12.455103][0:kworker/0:1:34] shared[3].name = APPS_RIVA_CTRL, r_info->remote_pid = 4 table_id=1
<6>[12.456004][0:kworker/0:1:34] shared[4].name = APPS_RIVA_DATA, r_info->remote_pid = 4 table_id=1
<6>[12.583796][0:kworker/0:1:34] shared[5].name = WCNSS_CTRL, r_info->remote_pid = 4 table_id=1
<6>[12.584751][0:kworker/0:1:34] shared[6].name = WLAN_CTRL, r_info->remote_pid = 4 table_id=1
<6>[12.836919][0:kworker/0:1:34] shared[7].name = APPS_RIVA_BT_CMD, r_info->remote_pid = 4 table_id=1
<6>[12.837876][0:kworker/0:1:34] shared[8].name = APPS_RIVA_BT_ACL, r_info->remote_pid = 4 table_id=1
<6>[12.838729][0:kworker/0:1:34] shared[9].name = APPS_RIVA_ANT_CMD, r_info->remote_pid = 4 table_id=1
<6>[12.839399][0:kworker/0:1:34] shared[10].name = APPS_RIVA_ANT_DATA, r_info->remote_pid = 4 table_id=1
<6>[12.843247][0:kworker/0:1:34] shared[11].name = APPS_FM, r_info->remote_pid = 4 table_id=1
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
这里显示的都是在启动的时候扫描smd之后,调用smd_alloc_channel()函数初始化相应的数据结构之后的结果。
在smd_alloc_channel()函数中,会根据上面的名字,初始化一个platform device!!之后也是会根据这个名字来注册platform driver。这些platform driver当然可以在/sys/devices/platform/目录下是看得到的。
root@gtelwifiue:/sys/devices/platform # ls
APPS_FM.6
APPS_RIVA_ANT_CMD.6
APPS_RIVA_ANT_DATA.6
APPS_RIVA_BT_ACL.6
APPS_RIVA_BT_CMD.6
APPS_RIVA_CTRL.6
APPS_RIVA_DATA.6
DIAG.0
DIAG_2.0
DIAG_2_CMD.0
DIAG_CMD.0
DIAG_CNTL.0
IPCRTR.0
IPCRTR.6
SSM_RTR_MODEM_APPS.0
SVC0000000e:00000001.1
SVC0000000f:00000001.1
SVC0000000f:00000001.2
SVC00000010:00000002.1
SVC00000016:00000101.1
SVC00000017:00000001.1
SVC00000018:00000001.1
SVC0000001c:00000001.1
SVC0000001c:00000101.1
SVC00000022:00000001.1
SVC0000002b:00000001.1
SVC00000034:00000101.1
SVC000000e8:00000101.1
SVC00000100:00000100.1
SVC00000100:00000100.2
WCNSS_CTRL.6
WLAN_CTRL.6
alarmtimer
apr_apps2.0
apr_audio_svc.0
msm_hsusb
msm_hsusb_host
power
reg-dummy
regulatory.0
rpm_requests.15
sec-thermistor
secgpio_dvs
snd-soc-dummy
sys_mon.0
sys_mon.6
uevent
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
qc_smd_ch_xxx.log
Primary allocation table:
4|rpm_requests |P|APPS |OPENED |0x00400|0x00188|0x00188|DCCiwRsB|0x00000
5|rpm_requests |P|MDMSW| Access Restricted
6|rpm_requests |P|WCNSS| Access Restricted
7|rpm_requests |P|TZ | Access Restricted
APPS <-> MDMSW Primary allocation table:
0|DS |S|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsB|0x00000
1|IPCRTR |P|APPS |OPENED |0x02000|0x00F28|0x00F28|DCCiwrsB|0x00000
2|SSM_RTR_MODEM_APPS |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
3|sys_mon |P|APPS |OPENED |0x00400|0x002BE|0x002BE|DCCiwrsB|0x00000
4|DIAG_2_CMD |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000
5|DIAG_2 |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000
6|DIAG_CNTL |P|APPS |OPENED |0x02000|0x00083|0x00083|DCCiwrsb|0x00000
7|DIAG_CMD |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000
8|DIAG |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000
9|apr_audio_svc |P|APPS |OPENED |0x02000|0x0064E|0x0064E|DCCiwrsB|0x00000
10|apr_apps2 |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
| | |MDMSW|OPENING|0x02000|0x00000|0x00000|DCCiwrSb|0x00000
-------------------------------------------------------------------------------
11|DATA1 |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
| | |MDMSW|OPENING|0x02000|0x00000|0x00000|dCciwrSb|0x00000
-------------------------------------------------------------------------------
12|DATA2 |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
| | |MDMSW|OPENING|0x02000|0x00000|0x00000|dCciwrSb|0x00000
-------------------------------------------------------------------------------
13|DATA3 |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
| | |MDMSW|OPENING|0x02000|0x00000|0x00000|dCciwrSb|0x00000
-------------------------------------------------------------------------------
14|DATA4 |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
| | |MDMSW|OPENING|0x02000|0x00000|0x00000|dCciwrSb|0x00000
-------------------------------------------------------------------------------
15|DATA11 |S|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
| | |MDMSW|OPENING|0x02000|0x00000|0x00000|dCciwrSb|0x00000
-------------------------------------------------------------------------------
16|DATA40 |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
| | |MDMSW|OPENING|0x02000|0x00000|0x00000|dcciwrSb|0x00000
-------------------------------------------------------------------------------
17|DATA5_CNTL |P|APPS |OPENED |0x00400|0x001AA|0x001AA|DCCiwrsB|0x00000
18|DATA6_CNTL |P|APPS |OPENED |0x00400|0x00338|0x00338|DCCiwrsB|0x00000
| | |MDMSW|OPENED |0x00400|0x00363|0x00363|DCCiwrsB|0x00000
-------------------------------------------------------------------------------
19|DATA7_CNTL |P|APPS |OPENED |0x00400|0x001A2|0x001A2|DCCiwrsB|0x00000
20|DATA8_CNTL |P|APPS |OPENED |0x00400|0x001A2|0x001A2|DCCiwrsB|0x00000
| | |MDMSW|OPENED |0x00400|0x001F7|0x001F7|DCCiwrsB|0x00000
-------------------------------------------------------------------------------
21|DATA9_CNTL |P|APPS |OPENED |0x00400|0x001A2|0x001A2|DCCiwrsB|0x00000
22|DATA12_CNTL |P|APPS |OPENED |0x00400|0x001A2|0x001A2|DCCiwrsB|0x00000
| | |MDMSW|OPENED |0x00400|0x001F7|0x001F7|DCCiwrsB|0x00000
-------------------------------------------------------------------------------
23|DATA13_CNTL |P|APPS |OPENED |0x00400|0x001A2|0x001A2|DCCiwrsB|0x00000
24|DATA14_CNTL |P|APPS |OPENED |0x00400|0x001A2|0x001A2|DCCiwrsB|0x00000
| | |MDMSW|OPENED |0x00400|0x001F7|0x001F7|DCCiwrsB|0x00000
-------------------------------------------------------------------------------
25|DATA15_CNTL |P|APPS |CLOSED |0x00400|0x00000|0x00000|dcciwrsb|0x00000
26|DATA16_CNTL |P|APPS |CLOSED |0x00400|0x00000|0x00000|dcciwrsb|0x00000
| | |MDMSW|OPENING|0x00400|0x00000|0x00000|DCCiwrSb|0x00000
-------------------------------------------------------------------------------
27|DATA40_CNTL |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
APPS <-> WCNSS Primary allocation table:
1|IPCRTR |P|APPS |OPENED |0x02000|0x00168|0x00168|DCCiwrsB|0x00000
2|sys_mon |P|APPS |OPENED |0x00400|0x00267|0x00267|DCCiwRsB|0x00000
3|APPS_RIVA_CTRL |P|APPS |OPENED |0x02000|0x00062|0x00062|DCCiwrsb|0x00000
4|APPS_RIVA_DATA |P|APPS |OPENED |0x02000|0x00000|0x00000|DCCiwrsb|0x00000
5|WCNSS_CTRL |P|APPS |OPENED |0x02000|0x01638|0x01638|DCCiwrsB|0x00000
6|WLAN_CTRL |P|APPS |OPENED |0x02000|0x00277|0x00277|DCCiwrsB|0x00000
7|APPS_RIVA_BT_CMD |P|APPS |OPENED |0x02000|0x0182C|0x0182C|DCCiwrsB|0x00000
8|APPS_RIVA_BT_ACL |P|APPS |OPENED |0x02000|0x01904|0x01904|DCCiwrsB|0x00000
9|APPS_RIVA_ANT_CMD |P|APPS |CLOSED |0x00400|0x00000|0x00000|dcciwrsb|0x00000
10|APPS_RIVA_ANT_DATA |P|APPS |CLOSED |0x00800|0x00000|0x00000|dcciwrsb|0x00000
| | |WCNSS|OPENING|0x00800|0x00000|0x00000|DCCiwrSb|0x00000
-------------------------------------------------------------------------------
11|APPS_FM |P|APPS |CLOSED |0x02000|0x00000|0x00000|dcciwrsb|0x00000
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
每个port名字和对应的生成的节点之间的关系,可以再msm8916.dtsi文件中找得到。
比如在msm_smd_pkt.c文件中,parse_smdpkt_devicetree()函数中可以看到在读qcom,smdpkt-dev-name的信息,然后后面会根据这个名字调用device_create()函数!!虽然msm_smd_tty.c对应的”qcom,smdtty”中没有用”qcom,smdpkt-dev-name”定义设备名字,但一般在alias{}那里都定义了一个别名,好像都是根据这个别名来定的设备的名字!!
aliases {
sdhc1 = &sdhc_1;
sdhc2 = &sdhc_2;
smd0 = &smdtty_ds;
smd1 = &smdtty_apps_fm;
smd2 = &smdtty_apps_riva_bt_acl;
smd3 = &smdtty_apps_riva_bt_cmd;
smd4 = &smdtty_mbalbridge;
smd5 = &smdtty_apps_riva_ant_cmd;
smd6 = &smdtty_apps_riva_ant_data;
smd7 = &smdtty_data1;
smd8 = &smdtty_data4;
smd11 = &smdtty_data11;
smd21 = &smdtty_data21;
smd36 = &smdtty_loopback;
i2c0 = &i2c_0;
i2c1 = &i2c_1;
i2c5 = &i2c_5;
i2c6 = &i2c_6;
i2c4 = &i2c_4;
};
qcom,smdtty {
compatible = "qcom,smdtty";
smdtty_ds: qcom,smdtty-ds {
qcom,smdtty-remote = "modem";
qcom,smdtty-port-name = "DS";
};
smdtty_apps_fm: qcom,smdtty-apps-fm {
qcom,smdtty-remote = "wcnss";
qcom,smdtty-port-name = "APPS_FM";
};
smdtty_apps_riva_bt_acl: smdtty-apps-riva-bt-acl {
qcom,smdtty-remote = "wcnss";
qcom,smdtty-port-name = "APPS_RIVA_BT_ACL";
};
smdtty_apps_riva_bt_cmd: qcom,smdtty-apps-riva-bt-cmd {
qcom,smdtty-remote = "wcnss";
qcom,smdtty-port-name = "APPS_RIVA_BT_CMD";
};
smdtty_mbalbridge: qcom,smdtty-mbalbridge {
qcom,smdtty-remote = "modem";
qcom,smdtty-port-name = "MBALBRIDGE";
};
smdtty_apps_riva_ant_cmd: smdtty-apps-riva-ant-cmd {
qcom,smdtty-remote = "wcnss";
qcom,smdtty-port-name = "APPS_RIVA_ANT_CMD";
};
smdtty_apps_riva_ant_data: smdtty-apps-riva-ant-data {
qcom,smdtty-remote = "wcnss";
qcom,smdtty-port-name = "APPS_RIVA_ANT_DATA";
};
smdtty_data1: qcom,smdtty-data1 {
qcom,smdtty-remote = "modem";
qcom,smdtty-port-name = "DATA1";
};
smdtty_data4: qcom,smdtty-data4 {
qcom,smdtty-remote = "modem";
qcom,smdtty-port-name = "DATA4";
};
smdtty_data11: qcom,smdtty-data11 {
qcom,smdtty-remote = "modem";
qcom,smdtty-port-name = "DATA11";
};
smdtty_data21: qcom,smdtty-data21 {
qcom,smdtty-remote = "modem";
qcom,smdtty-port-name = "DATA21";
};
smdtty_loopback: smdtty-loopback {
qcom,smdtty-remote = "modem";
qcom,smdtty-port-name = "LOOPBACK";
qcom,smdtty-dev-name = "LOOPBACK_TTY";
};
};
qcom,smdpkt {
compatible = "qcom,smdpkt";
qcom,smdpkt-data5-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA5_CNTL";
qcom,smdpkt-dev-name = "smdcntl0";
};
qcom,smdpkt-data6-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA6_CNTL";
qcom,smdpkt-dev-name = "smdcntl1";
};
qcom,smdpkt-data7-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA7_CNTL";
qcom,smdpkt-dev-name = "smdcntl2";
};
qcom,smdpkt-data8-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA8_CNTL";
qcom,smdpkt-dev-name = "smdcntl3";
};
qcom,smdpkt-data9-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA9_CNTL";
qcom,smdpkt-dev-name = "smdcntl4";
};
qcom,smdpkt-data12-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA12_CNTL";
qcom,smdpkt-dev-name = "smdcntl5";
};
qcom,smdpkt-data13-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA13_CNTL";
qcom,smdpkt-dev-name = "smdcntl6";
};
qcom,smdpkt-data14-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA14_CNTL";
qcom,smdpkt-dev-name = "smdcntl7";
};
qcom,smdpkt-data15-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA15_CNTL";
qcom,smdpkt-dev-name = "smdcntl9";
};
qcom,smdpkt-data16-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA16_CNTL";
qcom,smdpkt-dev-name = "smdcntl10";
};
qcom,smdpkt-data17-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA17_CNTL";
qcom,smdpkt-dev-name = "smdcntl11";
};
qcom,smdpkt-data22 {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA22";
qcom,smdpkt-dev-name = "smd22";
};
qcom,smdpkt-data23-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA23_CNTL";
qcom,smdpkt-dev-name = "smdcnt_rev0";
};
qcom,smdpkt-data24-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA24_CNTL";
qcom,smdpkt-dev-name = "smdcnt_rev1";
};
qcom,smdpkt-data25-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA25_CNTL";
qcom,smdpkt-dev-name = "smdcnt_rev2";
};
qcom,smdpkt-data26-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA26_CNTL";
qcom,smdpkt-dev-name = "smdcnt_rev3";
};
qcom,smdpkt-data27-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA27_CNTL";
qcom,smdpkt-dev-name = "smdcnt_rev4";
};
qcom,smdpkt-data28-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA28_CNTL";
qcom,smdpkt-dev-name = "smdcnt_rev5";
};
qcom,smdpkt-data29-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA29_CNTL";
qcom,smdpkt-dev-name = "smdcnt_rev6";
};
qcom,smdpkt-data30-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA30_CNTL";
qcom,smdpkt-dev-name = "smdcnt_rev7";
};
qcom,smdpkt-data31-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA31_CNTL";
qcom,smdpkt-dev-name = "smdcnt_rev8";
};
qcom,smdpkt-data40-cntl {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "DATA40_CNTL";
qcom,smdpkt-dev-name = "smdcntl8";
};
qcom,smdpkt-apr-apps2 {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "apr_apps2";
qcom,smdpkt-dev-name = "apr_apps2";
};
qcom,smdpkt-loopback {
qcom,smdpkt-remote = "modem";
qcom,smdpkt-port-name = "LOOPBACK";
qcom,smdpkt-dev-name = "smd_pkt_loopback";
};
}
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
-
204
-
205
-
206
-
207
-
208
-
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
-
204
-
205
-
206
-
207
-
208
-
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
至此,就知道在哪里会初始化smd channel,然后AP检测到smd channel之后打开相应的smd channel等内容了。相应的节点创建也可以知道了,但这些节点不管smd channel有没有打开都会创建!!
在Ril代码中,可以看到有打开/dev/smd0等节点。
这些节点的ops函数组其实都差不多,msm_smd_pkt.c中是smd_pkt_fops,msm_smd_tty中是smd_tty_ops。
都是在调用到之后,才根据文件名等,再找出来是哪个smd channel,然后调用smd_named_open_on_edge函数打开smd channel。读写等操作的话,还要看当初smd_alloc_channel()的时候的相应的channel是packet传输还是stream传输!!这个估计都不是AP这边决定的,但可以在smd_alloc_channel()函数中打log查看每个smd channel的类型。
SMD_DBG()这种函数用来输出smd等log信息。看这些内容可以在/d/ipc_logging下看的到的,如果是SMD_INFO和SMD_DBG内容就是在/d/ipc_logging/smd目录下。这个是因为~~看下面代码注释
#define SMD_DBG(x...) do { \
if (msm_smd_debug_mask & MSM_SMD_DEBUG) \
IPC_LOG_SMD(KERN_DEBUG, x); \
} while (0)
#define SMD_INFO(x...) do { \
if (msm_smd_debug_mask & MSM_SMD_INFO) \
IPC_LOG_SMD(KERN_INFO, x); \
} while (0)
smd_log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smd", 0);
#define IPC_LOG_SMD(level, x...) do { \
if (smd_log_ctx) \
ipc_log_string(smd_log_ctx, x); \
else \
printk(level x); \
} while (0)
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
以下是qc_smdpkt_xxx.log:
[ 11247.679255802] <SMD_PKT>: ch_notify: DATA event in smd_pkt_dev id:0
[ 11247.679286896] <SMD_PKT>: check_and_wakeup_reader: wake_up smd_pkt_dev id:0
[ 11247.679292469] <SMD_PKT>: check_and_wakeup_writer: 1000 bytes write space in smd_pkt_dev id:0
[ 11247.679332781] <SMD_PKT>: smd_pkt_poll sets POLLIN for smd_pkt_dev id: 0
[ 11247.679372521] <SMD_PKT>: Begin smd_pkt_read on smd_pkt_dev id:0 buffer_size 5086
[ 11247.679430594] <SMD_PKT>: smd_pkt_read unlocked smd_pkt_dev id:0 wakeup_source
[ 11247.679436479] <SMD_PKT>: Finished smd_pkt_read on smd_pkt_dev id:0 20 bytes
[ 11247.679462677] <SMD_PKT>: check_and_wakeup_reader: No packet in smd_pkt_dev id:0
[ 11253.959471134] <SMD_PKT>: Begin smd_pkt_write on smd_pkt_dev id:0 data_size 13
[ 11253.959521967] <SMD_PKT>: Finished smd_pkt_write on smd_pkt_dev id:0 13 bytes
[ 11253.959942853] <SMD_PKT>: ch_notify: DATA event in smd_pkt_dev id:0
[ 11253.959981186] <SMD_PKT>: check_and_wakeup_reader: wake_up smd_pkt_dev id:0
[ 11253.959982748] <SMD_PKT>: smd_pkt_poll sets POLLIN for smd_pkt_dev id: 0
[ 11253.959985248] <SMD_PKT>: check_and_wakeup_writer: 1000 bytes write space in smd_pkt_dev id:0
[ 11253.960014207] <SMD_PKT>: Begin smd_pkt_read on smd_pkt_dev id:0 buffer_size 5086
[ 11253.960050561] <SMD_PKT>: smd_pkt_read unlocked smd_pkt_dev id:0 wakeup_source
[ 11253.960054780] <SMD_PKT>: Finished smd_pkt_read on smd_pkt_dev id:0 20 bytes
[ 11253.960072123] <SMD_PKT>: check_and_wakeup_reader: No packet in smd_pkt_dev id:0
[ 11260.707648550] <SMD_PKT>: Begin smd_pkt_write on smd_pkt_dev id:0 data_size 13
[ 11260.707704800] <SMD_PKT>: Finished smd_pkt_write on smd_pkt_dev id:0 13 bytes
[ 11260.708084957] <SMD_PKT>: ch_notify: DATA event in smd_pkt_dev id:0
[ 11260.708118811] <SMD_PKT>: check_and_wakeup_reader: wake_up smd_pkt_dev id:0
[ 11260.708123290] <SMD_PKT>: check_and_wakeup_writer: 1000 bytes write space in smd_pkt_dev id:0
[ 11260.708154540] <SMD_PKT>: packet_arrival_worker locking smd_pkt_dev id:0 wakeup source
[ 11260.708218654] <SMD_PKT>: smd_pkt_poll sets POLLIN for smd_pkt_dev id: 0
[ 11260.708571415] <SMD_PKT>: Begin smd_pkt_read on smd_pkt_dev id:0 buffer_size 5086
[ 11260.708609384] <SMD_PKT>: smd_pkt_read unlocked smd_pkt_dev id:0 wakeup_source
[ 11260.708613863] <SMD_PKT>: Finished smd_pkt_read on smd_pkt_dev id:0 20 bytes
[ 11260.708631832] <SMD_PKT>: check_and_wakeup_reader: No packet in smd_pkt_dev id:0
[ 11264.686568250] <SMD_PKT>: Begin smd_pkt_write on smd_pkt_dev id:0 data_size 13
[ 11264.686618146] <SMD_PKT>: Finished smd_pkt_write on smd_pkt_dev id:0 13 bytes
[ 11264.686985281] <SMD_PKT>: ch_notify: DATA event in smd_pkt_dev id:0
[ 11264.687013979] <SMD_PKT>: check_and_wakeup_reader: wake_up smd_pkt_dev id:0
[ 11264.687018406] <SMD_PKT>: check_and_wakeup_writer: 1000 bytes write space in smd_pkt_dev id:0
[ 11264.687091062] <SMD_PKT>: smd_pkt_poll sets POLLIN for smd_pkt_dev id: 0
[ 11264.687141010] <SMD_PKT>: packet_arrival_worker locking smd_pkt_dev id:0 wakeup source
[ 11264.687145906] <SMD_PKT>: Begin smd_pkt_read on smd_pkt_dev id:0 buffer_size 5086
[ 11264.687185073] <SMD_PKT>: smd_pkt_read unlocked smd_pkt_dev id:0 wakeup_source
[ 11264.687189917] <SMD_PKT>: Finished smd_pkt_read on smd_pkt_dev id:0 20 bytes
[ 11264.687207937] <SMD_PKT>: check_and_wakeup_reader: No packet in smd_pkt_dev id:0
[ 11271.507262281] <SMD_PKT>: Begin smd_pkt_write on smd_pkt_dev id:0 data_size 13
[ 11271.507305719] <SMD_PKT>: Finished smd_pkt_write on smd_pkt_dev id:0 13 bytes
[ 11271.507728167] <SMD_PKT>: ch_notify: DATA event in smd_pkt_dev id:0
[ 11271.507759625] <SMD_PKT>: check_and_wakeup_reader: wake_up smd_pkt_dev id:0
[ 11271.507763583] <SMD_PKT>: check_and_wakeup_writer: 1000 bytes write space in smd_pkt_dev id:0
[ 11271.507796604] <SMD_PKT>: smd_pkt_poll sets POLLIN for smd_pkt_dev id: 0
[ 11271.507822854] <SMD_PKT>: Begin smd_pkt_read on smd_pkt_dev id:0 buffer_size 5086
[ 11271.507862333] <SMD_PKT>: smd_pkt_read unlocked smd_pkt_dev id:0 wakeup_source
[ 11271.507866500] <SMD_PKT>: Finished smd_pkt_read on smd_pkt_dev id:0 20 bytes
[ 11271.507884364] <SMD_PKT>: check_and_wakeup_reader: No packet in smd_pkt_dev id:0
[ 11274.734097551] <SMD_PKT>: Begin smd_pkt_write on smd_pkt_dev id:0 data_size 13
[ 11274.734160676] <SMD_PKT>: Finished smd_pkt_write on smd_pkt_dev id:0 13 bytes
[ 11274.734588697] <SMD_PKT>: ch_notify: DATA event in smd_pkt_dev id:0
[ 11274.734628333] <SMD_PKT>: check_and_wakeup_reader: wake_up smd_pkt_dev id:0
[ 11274.734633645] <SMD_PKT>: check_and_wakeup_writer: 1000 bytes write space in smd_pkt_dev id:0
[ 11274.735154999] <SMD_PKT>: packet_arrival_worker locking smd_pkt_dev id:0 wakeup source
[ 11274.735238385] <SMD_PKT>: smd_pkt_poll sets POLLIN for smd_pkt_dev id: 0
[ 11274.735276614] <SMD_PKT>: Begin smd_pkt_read on smd_pkt_dev id:0 buffer_size 5086
[ 11274.735333906] <SMD_PKT>: smd_pkt_read unlocked smd_pkt_dev id:0 wakeup_source
[ 11274.735339374] <SMD_PKT>: Finished smd_pkt_read on smd_pkt_dev id:0 20 bytes
[ 11274.735361145] <SMD_PKT>: check_and_wakeup_reader: No packet in smd_pkt_dev id:0
[ 11281.493969135] <SMD_PKT>: Begin smd_pkt_write on smd_pkt_dev id:0 data_size 13
[ 11281.494015593] <SMD_PKT>: Finished smd_pkt_write on smd_pkt_dev id:0 13 bytes
[ 11281.496142103] <SMD_PKT>: ch_notify: DATA event in smd_pkt_dev id:0
[ 11281.496202520] <SMD_PKT>: check_and_wakeup_reader: wake_up smd_pkt_dev id:0
[ 11281.496207780] <SMD_PKT>: check_and_wakeup_writer: 1000 bytes write space in smd_pkt_dev id:0
[ 11281.496255801] <SMD_PKT>: packet_arrival_worker locking smd_pkt_dev id:0 wakeup source
[ 11281.496423249] <SMD_PKT>: smd_pkt_poll sets POLLIN for smd_pkt_dev id: 0
[ 11281.496776582] <SMD_PKT>: Begin smd_pkt_read on smd_pkt_dev id:0 buffer_size 5086
[ 11281.496824707] <SMD_PKT>: smd_pkt_read unlocked smd_pkt_dev id:0 wakeup_source
[ 11281.496828822] <SMD_PKT>: Finished smd_pkt_read on smd_pkt_dev id:0 20 bytes
[ 11281.496848614] <SMD_PKT>: check_and_wakeup_reader: No packet in smd_pkt_dev id:0
[ 11284.784395968] <SMD_PKT>: Begin smd_pkt_write on smd_pkt_dev id:0 data_size 13
[ 11284.784449301] <SMD_PKT>: Finished smd_pkt_write on smd_pkt_dev id:0 13 bytes
[ 11284.786411332] <SMD_PKT>: ch_notify: DATA event in smd_pkt_dev id:0
[ 11284.786464301] <SMD_PKT>: check_and_wakeup_reader: wake_up smd_pkt_dev id:0
[ 11284.786469197] <SMD_PKT>: check_and_wakeup_writer: 1000 bytes write space in smd_pkt_dev id:0
[ 11284.786477790] <SMD_PKT>: smd_pkt_poll sets POLLIN for smd_pkt_dev id: 0
[ 11284.786504093] <SMD_PKT>: packet_arrival_worker locking smd_pkt_dev id:0 wakeup source
[ 11284.786811645] <SMD_PKT>: Begin smd_pkt_read on smd_pkt_dev id:0 buffer_size 5086
[ 11284.786848363] <SMD_PKT>: smd_pkt_read unlocked smd_pkt_dev id:0 wakeup_source
[ 11284.786852582] <SMD_PKT>: Finished smd_pkt_read on smd_pkt_dev id:0 20 bytes
[ 11284.786870290] <SMD_PKT>: check_and_wakeup_reader: No packet in smd_pkt_dev id:0
[ 11288.184812488] <SMD_PKT>: Begin smd_pkt_write on smd_pkt_dev id:0 data_size 13
[ 11288.184869311] <SMD_PKT>: Finished smd_pkt_write on smd_pkt_dev id:0 13 bytes
[ 11288.187012645] <SMD_PKT>: ch_notify: DATA event in smd_pkt_dev id:0
[ 11288.187054572] <SMD_PKT>: check_and_wakeup_reader: wake_up smd_pkt_dev id:0
[ 11288.187060145] <SMD_PKT>: check_and_wakeup_writer: 1000 bytes write space in smd_pkt_dev id:0
[ 11288.187062592] <SMD_PKT>: smd_pkt_poll sets POLLIN for smd_pkt_dev id: 0
[ 11288.187099884] <SMD_PKT>: Begin smd_pkt_read on smd_pkt_dev id:0 buffer_size 5086
[ 11288.187139363] <SMD_PKT>: smd_pkt_read unlocked smd_pkt_dev id:0 wakeup_source
[ 11288.187143530] <SMD_PKT>: Finished smd_pkt_read on smd_pkt_dev id:0 20 bytes
[ 11288.187161499] <SMD_PKT>: check_and_wakeup_reader: No packet in smd_pkt_dev id:0
[ 11294.361732247] <SMD_PKT>: Begin smd_pkt_write on smd_pkt_dev id:0 data_size 13
[ 11294.361781205] <SMD_PKT>: Finished smd_pkt_write on smd_pkt_dev id:0 13 bytes
[ 11294.362070320] <SMD_PKT>: ch_notify: DATA event in smd_pkt_dev id:0
[ 11294.362108132] <SMD_PKT>: check_and_wakeup_reader: wake_up smd_pkt_dev id:0
[ 11294.362108288] <SMD_PKT>: smd_pkt_poll sets POLLIN for smd_pkt_dev id: 0
[ 11294.362112403] <SMD_PKT>: check_and_wakeup_writer: 1000 bytes write space in smd_pkt_dev id:0
[ 11294.362459851] <SMD_PKT>: Begin smd_pkt_read on smd_pkt_dev id:0 buffer_size 5086
[ 11294.362544070] <SMD_PKT>: smd_pkt_read unlocked smd_pkt_dev id:0 wakeup_source
[ 11294.362548393] <SMD_PKT>: Finished smd_pkt_read on smd_pkt_dev id:0 20 bytes
[ 11294.362567299] <SMD_PKT>: check_and_wakeup_reader: No packet in smd_pkt_dev id:0
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
后续,,
smd,smem,smsm等共享内存所占据的内存范围,大小??
/system/bin/smdexe 这个代码在哪里,都干嘛的?init.rc里边这样定义了一个service,但没有找到代码,后续需要说明。
service SMD-daemon /system/bin/smdexe
class main
user root
group system radio inet net_raw
这个service注册还在oemclientreceiver.cpp文件中添加了下面的一段内容。
ProcessInfo allowedProcess[] = {
...
{ AID_SYSTEM, -1, "/system/bin/smdexe" },
...
};
debug需要的一些log抓取
Some diag related issues seen when doing factory/RF tests are hard to debug and related to multiple technical areas, like diag/smd/usb/qmsl based tools.
we always need comprehensive logs from all sides to begin our analysis and finally find root cause.
Here is a list of what logs are expected to be provided to Qcom to begin analysis.
QMSL log, Port trace log, USB analyzer log, diag debugfs status dump, ipc logging for diag smd channels, and ramdump with matchable elfs.
How the log collected:
1. Power on device
2. QPST recognized DIAG port
3. Echo pr_debug for diagfwd.c/ diagchar_core.c
4. Collect ipc_logging for smd channels
5. Enable Port trace log
6. Start USB analyzer log collection
7. Begin the test – -when doing test, qmsl log is collected
8. After see failure, stop Port trace log, stop USB analyzer log collection.
9. Dump diag debugfs status
10. Echo c to sysrq-trigger to trigger a panic and collect ramdump.
Where step 3-4 is done by script named “test.bat”
If no usb analyzer, ignore step 6.
9-10 is done by script named “diag_panic.bat”
test.bat
adb wait-for-devices
adb shell “echo 1 >/sys/module/msm_poweroff/parameters/download_mode”
adb shell “echo 1 > /proc/sys/kernel/sysrq”
adb shell “echo ‘file diagfwd.c +p’ > /sys/kernel/debug/dynamic_debug/control”
adb shell “echo ‘file diagchar_core.c +p’ > /sys/kernel/debug/dynamic_debug/control”
adb shell cat /d/ipc_logging/smd/log_cont
diag_panic.bat
adb shell cat /sys/kernel/debug/diag/work_pending;
adb shell cat /sys/kernel/debug/diag/status;
adb shell cat /sys/kernel/debug/diag/table;
adb shell cat /sys/kernel/debug/diag/mempool;
adb shell dmesg >dmesg.txt
adb shell “echo c > /proc/sysrq-trigger”
Appendix:
how to capture port trace log:
-
Bring up “QPST Configuration” and Highlight the port your phone is connected to
-
Do a Shift+right click on the highlighted item Select “Port Trace”
If you do not see ‘Port Trace’ in the drop-down menu, you may not have pressed ‘Shift’ while right-clicking
-
Set the value to either Turned Off, Debugging or Debugging & Port Traffic (see below for details) Close “QPST Configuration”
The port trace log will be saved in following location
-
Look for QPST Icon on right bottom of the PC, right click & then click on Open the Data Directory . You should see PortTrace_COMx.dbg (where x is the port number).
it is better you can enable the port trace before doing test. and disable it immediately after issue reproduced.
Too much logs is not preferred and it is hard for us to do filtering and analysis.