Project

General

Profile

Qualcomm Kernel » History » Version 8

laforge, 12/17/2016 11:22 AM

1 6 laforge
{{>toc}}
2
3 1 laforge
h1. Qualcomm Kernel
4
5
Random notes about the Qualcomm Kernel as used on the MDM9615
6
7
h2. diag
8
9
h3. diag forwarding
10
11
<pre>
12
drivers/char/diag/diagfwd.[ch]
13
drivers/usb/gadget/f_diag.[ch]
14
drivers/usb/misc/diag_bridge.c
15
</pre>
16
17
* the usb diag gadget handles diag packet read/write over usb
18
* issues events like USB_DIAG_READ_DONE
19
* picked up by diagfwd.c
20
** can forward diag requests via SMD shared memory to other processors
21
22
h3. diag char
23
24 6 laforge
The kernel exports a /dev/diag char device which userspce processes can
25
use to register/listen for DIAG events from the system, or actually
26
register a DIAG 'subsystem' themselves which can then be controlled from
27
QXDM.
28
29 1 laforge
<pre>
30
drivers/char/diag/diagchar_core.c
31
</pre>
32
33
* ioctl()s for diag configuration
34
* supports several concurrent diag clients
35
* diag logging can be directed to USB/HSIC, character device and more
36
** {USB,CALLBACK,MEMORY_DEVICE,UART,NO_LOGGING}_MODE
37
38 5 laforge
drivers/char/diag/diag_dci.c
39 1 laforge
40
* DCI table is a routing table where pid/sockets can register for a
41
  given DCI.  socket close/cleanup code releases all DCI routes for
42
  that socket.
43
44 7 laforge
h4. DIAG_IOCTL_COMMAND_REG
45
46
* Register a new DIAG command so it can be used from the outside world (QXDM)
47
* use 'struct diag_cmd_reg_entry_t' per command
48
* driver keeps a driver->cmd_reg_list of registered commands
49
50
h4. DIAG_IOCTL_COMMAND_DEREG
51
52
* unregister debug command
53
54
h4. DIAG_IOCTL_GET_DELAYED_RSP_ID
55
56
h4. DIAG_IOCTL_DCI_REG
57
58
h4. DIAG_IOCTL_DCI_DEINIT
59
60
h4. DIAG_IOCTL_DCI_SUPPORT
61
62
h4. DIAG_IOCTL_DCI_HEALTH_STATS
63
64
h4. DIAG_IOCTL_DCI_LOG_STATUS
65
66
h4. DIAG_IOCTL_DCI_EVENT_STATUS
67
68
h4. DIAG_IOCTL_DCI_CLEAR_LOGS
69
70
h4. DIAG_IOCTL_DCI_CLEAR_EVENTS
71
72
h4. DIAG_IOCTL_LSM_DEINIT
73
74
h4. DIAG_IOCTL_SWITCH_LOGGING
75
76
* switch between USB and shared-memory diag
77
* 
78
79
h4. DIAG_IOCTL_REMOTE_DEV
80
81
h4. DIAG_IOCTL_VOTE_REAL_TIME
82
83
h4. DIAG_IOCTL_GET_REAL_TIME
84
85
h4. DIAG_IOCTL_PERIPHERAL_BUF_CONFIG
86
87
h4. DIAG_IOCTL_PERIPHERAL_BUF_DRAIN
88
89
h4. DIAG_IOCTL_REGISTER_CALLBACK
90
91
* doen't really do anything but checking arguments ?!?
92
93
h4. DIAG_IOCTL_HDLC_TOGGLE
94
95
enable or disable HDLC framing of /dev/diag
96 6 laforge
97
98 1 laforge
h2. SMD (shared memory)
99
100
* SMD sub-systems:
101
** Modem (assumed to be hexagon with modem firmware?)
102
** Q6 (formerly known as LPASS == Low Power Audio SubSystem)
103
** DSPS
104
** WCNSS (Wireless Connectivity Sub System) aka 'riva'
105
** RPM (Resource Power Manager)
106
* inter-processor-interrupts for various 'edges'
107
108
h3. core driver
109
110
* arch/arm/mach-msm/smd.c
111
112
h4. api
113 4 laforge
114 1 laforge
* smd_open()
115
* smd_close()
116
* smd_write*()
117
* smd_read*()
118
* smsm_*()
119
120 3 laforge
h3. MSM IPC socket
121 1 laforge
122
* arch/arm/mach-msm/ipc_socket.c
123
* AF_MSM_IPC
124
125 3 laforge
126
h3. packet ports
127 1 laforge
128
* Some kind of packet oriented interface towards the SMD
129
* msm_smd_pkt.c contains driver
130
** smdpkt0..7+smd22 devices, 2048 byte buffer
131
** open/release/read/write/poll syscalls implemented
132 6 laforge
133
h2. smem_log
134
135
This is some kidn of high speed shared memory based event log to which all processors can log events.
136
137
Userspace applications can use write() to @/dev/smem_log@ to add log entries.
138
139
Qualcomm uses a proprietary minimal shim layer offering SMEM_LOG_EVENT and SMEM_LOG_EVENT6 macros
140
that can be used to write events with an event ID plus three data words or six data words, respectively.
141
142
The shared memory log can be read from linux userspace via debugfs, see the devices in @/sys/kernel/debug/smem_log@
143
and simply use @cat@ on them. You will get lines like
144
<pre>
145
MODM: 3982377401 000d0000: 00000001: 03000019 01000028 01000015 53505041 00000061 5f696d71
146
MODM: 3982378159      QCSI: 00000004: 00040029 00240015 00000003 00000001 0000002b 00000000
147
MODM: 3982378619 000d0000: 00000001: 03000019 0100002b 01000015 53505041 00000061 5f696d71
148
APPS: 3982397356      QCCI: 00000005: 0004001d 0024000e 00000003 00000003 00000019 00000000
149
APPS: 3982400571      QCCI: 00000005: 00040029 0024000e 00000003 00000003 00000019 00000000
150
MODM: 1841235211      QCSI: 00000004: 0004001e 0024001c 00000003 00000001 00000028 00000000
151
MODM: 1841236665 000d0000: 00000001: 03000019 01000028 0101001c 53505041 00000061 5f696d71
152
MODM: 1841241411      QCSI: 00000004: 0004002a 0024001c 00000003 00000001 0000002b 00000000
153
MODM: 1841242246 000d0000: 00000001: 03000019 0100002b 0100001c 53505041 00000061 5f696d71
154
MODM: 1841243796      QCSI: 00000004: 0004002b 00660019 00000003 00000001 0000002b 00000000
155
MODM: 1841244286 000d0000: 00000001: 03000019 0100002b 01000019 53505041 00000061 5f696d71
156
APPS: 1841255456      QCCI: 00000005: 0004001e 00240015 00000003 00000003 00000019 00000000
157
MODM: 1841255335 000d0000: 00000002: 0100ffff 0300ffff 07000014 53505041 0000016c 74646d73
158
MODM: 1841255828 000d0000: 00000702: 00000001 00000028 00000007
159
APPS: 1841261430      QCCI: 00000005: 0004002a 00240015 00000003 00000003 00000019 00000000
160
</pre>
161 8 laforge
162
h2. rmnet
163
164
"remote network" ?
165
* consists of control channel and data channel
166
* data channel carries IP data
167
* control channel carries QMI messages
168
169
* drivers/net/ethernet/msm/msm_rmnet_bam.c
170
** ioctl() to set ethernet or rawip (RMNET_IOCTL_SET_LLP_ETHERNET, RMNET_IOCTL_SET_LLP_IP, RMNET_IOCTL_GET_LLP), initial boot time config is ETHERNET
171
** use msm_bam_dmux_open() to attach
172
** use RMNET_IOCTL_GET_EPID to get the BAM_DMUX endpoint id
173
174
h2. bam (Bus Access Manager/Module)
175
176
* The Bus Access Manager/Module (BAM) can be
177
  considered as a distributed data mover (DM)
178
* some kind of DMA controller/engine
179
* A number of the on-chip devices have their own BAM DMA controller
180
  and use it to move data between system memory and peripherals or
181
  between two peripherals.
182
183
Files:
184
<pre>
185
./drivers/dma/qcom_bam_dma.c
186
./drivers/net/ethernet/msm/msm_rmnet_bam.c
187
./drivers/platform/msm/sps/bam.c
188
./drivers/platform/msm/sps/sps_bam.c
189
./drivers/platform/msm/usb_bam.c
190
</pre>
191
192
* channels (BAM_DMUX_)
193
** RMNET_0...7
194
** USB_RMNET_0
195
** DATA_REV_RMNET_0..8
196
** USB_DPL
197
198
seem to be be based on dmux ./drivers/soc/qcom/bam_dmux.c
199
200
h2. IPA (Internet Packet Accelerator)
201
202
Internet Packet Accelerator (IPA) is a programmable protocol
203
processor HW block. It is designed to support generic HW processing
204
of UL/DL IP packets for various use cases independent of radio
205
technology.
206
207
See drivers/platform/msm/ipa/
208
209
h2. bam2bam
210
211
maybe soem kind of direct connection between two peripherals by means of the BAM?
212
213
h2. Android USB Gadget
214
215
see [[Android_USB_Gadget]]
Add picture from clipboard (Maximum size: 48.8 MB)