summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-04-14 07:50:59 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-07-15 08:20:23 -0400
commit93d2c159673325624ef3f2d14ededfcdf76f948b (patch)
treef4a0c154b41e89cb33bc730be69a8f7fcf598b60
parent8db8acee4b326bfd5bc9a164a7f9ef844ec0fd2e (diff)
docs: pti_intel_mid.txt: convert it to pti_intel_mid.rst
Convert this small file to ReST format and rename it. Most of the conversion were related to adjusting whitespaces in order for each section to be properly parsed. While this is not part of any book, mark it as :orphan:, in order to avoid build warnings. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r--Documentation/pti/pti_intel_mid.rst106
-rw-r--r--Documentation/pti/pti_intel_mid.txt99
2 files changed, 106 insertions, 99 deletions
diff --git a/Documentation/pti/pti_intel_mid.rst b/Documentation/pti/pti_intel_mid.rst
new file mode 100644
index 000000000000..ea05725174cb
--- /dev/null
+++ b/Documentation/pti/pti_intel_mid.rst
@@ -0,0 +1,106 @@
1:orphan:
2
3=============
4Intel MID PTI
5=============
6
7The Intel MID PTI project is HW implemented in Intel Atom
8system-on-a-chip designs based on the Parallel Trace
9Interface for MIPI P1149.7 cJTAG standard. The kernel solution
10for this platform involves the following files::
11
12 ./include/linux/pti.h
13 ./drivers/.../n_tracesink.h
14 ./drivers/.../n_tracerouter.c
15 ./drivers/.../n_tracesink.c
16 ./drivers/.../pti.c
17
18pti.c is the driver that enables various debugging features
19popular on platforms from certain mobile manufacturers.
20n_tracerouter.c and n_tracesink.c allow extra system information to
21be collected and routed to the pti driver, such as trace
22debugging data from a modem. Although n_tracerouter
23and n_tracesink are a part of the complete PTI solution,
24these two line disciplines can work separately from
25pti.c and route any data stream from one /dev/tty node
26to another /dev/tty node via kernel-space. This provides
27a stable, reliable connection that will not break unless
28the user-space application shuts down (plus avoids
29kernel->user->kernel context switch overheads of routing
30data).
31
32An example debugging usage for this driver system:
33
34 * Hook /dev/ttyPTI0 to syslogd. Opening this port will also start
35 a console device to further capture debugging messages to PTI.
36 * Hook /dev/ttyPTI1 to modem debugging data to write to PTI HW.
37 This is where n_tracerouter and n_tracesink are used.
38 * Hook /dev/pti to a user-level debugging application for writing
39 to PTI HW.
40 * `Use mipi_` Kernel Driver API in other device drivers for
41 debugging to PTI by first requesting a PTI write address via
42 mipi_request_masterchannel(1).
43
44Below is example pseudo-code on how a 'privileged' application
45can hook up n_tracerouter and n_tracesink to any tty on
46a system. 'Privileged' means the application has enough
47privileges to successfully manipulate the ldisc drivers
48but is not just blindly executing as 'root'. Keep in mind
49the use of ioctl(,TIOCSETD,) is not specific to the n_tracerouter
50and n_tracesink line discpline drivers but is a generic
51operation for a program to use a line discpline driver
52on a tty port other than the default n_tty::
53
54 /////////// To hook up n_tracerouter and n_tracesink /////////
55
56 // Note that n_tracerouter depends on n_tracesink.
57 #include <errno.h>
58 #define ONE_TTY "/dev/ttyOne"
59 #define TWO_TTY "/dev/ttyTwo"
60
61 // needed global to hand onto ldisc connection
62 static int g_fd_source = -1;
63 static int g_fd_sink = -1;
64
65 // these two vars used to grab LDISC values from loaded ldisc drivers
66 // in OS. Look at /proc/tty/ldiscs to get the right numbers from
67 // the ldiscs loaded in the system.
68 int source_ldisc_num, sink_ldisc_num = -1;
69 int retval;
70
71 g_fd_source = open(ONE_TTY, O_RDWR); // must be R/W
72 g_fd_sink = open(TWO_TTY, O_RDWR); // must be R/W
73
74 if (g_fd_source <= 0) || (g_fd_sink <= 0) {
75 // doubt you'll want to use these exact error lines of code
76 printf("Error on open(). errno: %d\n",errno);
77 return errno;
78 }
79
80 retval = ioctl(g_fd_sink, TIOCSETD, &sink_ldisc_num);
81 if (retval < 0) {
82 printf("Error on ioctl(). errno: %d\n", errno);
83 return errno;
84 }
85
86 retval = ioctl(g_fd_source, TIOCSETD, &source_ldisc_num);
87 if (retval < 0) {
88 printf("Error on ioctl(). errno: %d\n", errno);
89 return errno;
90 }
91
92 /////////// To disconnect n_tracerouter and n_tracesink ////////
93
94 // First make sure data through the ldiscs has stopped.
95
96 // Second, disconnect ldiscs. This provides a
97 // little cleaner shutdown on tty stack.
98 sink_ldisc_num = 0;
99 source_ldisc_num = 0;
100 ioctl(g_fd_uart, TIOCSETD, &sink_ldisc_num);
101 ioctl(g_fd_gadget, TIOCSETD, &source_ldisc_num);
102
103 // Three, program closes connection, and cleanup:
104 close(g_fd_uart);
105 close(g_fd_gadget);
106 g_fd_uart = g_fd_gadget = NULL;
diff --git a/Documentation/pti/pti_intel_mid.txt b/Documentation/pti/pti_intel_mid.txt
deleted file mode 100644
index e7a5b6d1f7a9..000000000000
--- a/Documentation/pti/pti_intel_mid.txt
+++ /dev/null
@@ -1,99 +0,0 @@
1The Intel MID PTI project is HW implemented in Intel Atom
2system-on-a-chip designs based on the Parallel Trace
3Interface for MIPI P1149.7 cJTAG standard. The kernel solution
4for this platform involves the following files:
5
6./include/linux/pti.h
7./drivers/.../n_tracesink.h
8./drivers/.../n_tracerouter.c
9./drivers/.../n_tracesink.c
10./drivers/.../pti.c
11
12pti.c is the driver that enables various debugging features
13popular on platforms from certain mobile manufacturers.
14n_tracerouter.c and n_tracesink.c allow extra system information to
15be collected and routed to the pti driver, such as trace
16debugging data from a modem. Although n_tracerouter
17and n_tracesink are a part of the complete PTI solution,
18these two line disciplines can work separately from
19pti.c and route any data stream from one /dev/tty node
20to another /dev/tty node via kernel-space. This provides
21a stable, reliable connection that will not break unless
22the user-space application shuts down (plus avoids
23kernel->user->kernel context switch overheads of routing
24data).
25
26An example debugging usage for this driver system:
27 *Hook /dev/ttyPTI0 to syslogd. Opening this port will also start
28 a console device to further capture debugging messages to PTI.
29 *Hook /dev/ttyPTI1 to modem debugging data to write to PTI HW.
30 This is where n_tracerouter and n_tracesink are used.
31 *Hook /dev/pti to a user-level debugging application for writing
32 to PTI HW.
33 *Use mipi_* Kernel Driver API in other device drivers for
34 debugging to PTI by first requesting a PTI write address via
35 mipi_request_masterchannel(1).
36
37Below is example pseudo-code on how a 'privileged' application
38can hook up n_tracerouter and n_tracesink to any tty on
39a system. 'Privileged' means the application has enough
40privileges to successfully manipulate the ldisc drivers
41but is not just blindly executing as 'root'. Keep in mind
42the use of ioctl(,TIOCSETD,) is not specific to the n_tracerouter
43and n_tracesink line discpline drivers but is a generic
44operation for a program to use a line discpline driver
45on a tty port other than the default n_tty.
46
47/////////// To hook up n_tracerouter and n_tracesink /////////
48
49// Note that n_tracerouter depends on n_tracesink.
50#include <errno.h>
51#define ONE_TTY "/dev/ttyOne"
52#define TWO_TTY "/dev/ttyTwo"
53
54// needed global to hand onto ldisc connection
55static int g_fd_source = -1;
56static int g_fd_sink = -1;
57
58// these two vars used to grab LDISC values from loaded ldisc drivers
59// in OS. Look at /proc/tty/ldiscs to get the right numbers from
60// the ldiscs loaded in the system.
61int source_ldisc_num, sink_ldisc_num = -1;
62int retval;
63
64g_fd_source = open(ONE_TTY, O_RDWR); // must be R/W
65g_fd_sink = open(TWO_TTY, O_RDWR); // must be R/W
66
67if (g_fd_source <= 0) || (g_fd_sink <= 0) {
68 // doubt you'll want to use these exact error lines of code
69 printf("Error on open(). errno: %d\n",errno);
70 return errno;
71}
72
73retval = ioctl(g_fd_sink, TIOCSETD, &sink_ldisc_num);
74if (retval < 0) {
75 printf("Error on ioctl(). errno: %d\n", errno);
76 return errno;
77}
78
79retval = ioctl(g_fd_source, TIOCSETD, &source_ldisc_num);
80if (retval < 0) {
81 printf("Error on ioctl(). errno: %d\n", errno);
82 return errno;
83}
84
85/////////// To disconnect n_tracerouter and n_tracesink ////////
86
87// First make sure data through the ldiscs has stopped.
88
89// Second, disconnect ldiscs. This provides a
90// little cleaner shutdown on tty stack.
91sink_ldisc_num = 0;
92source_ldisc_num = 0;
93ioctl(g_fd_uart, TIOCSETD, &sink_ldisc_num);
94ioctl(g_fd_gadget, TIOCSETD, &source_ldisc_num);
95
96// Three, program closes connection, and cleanup:
97close(g_fd_uart);
98close(g_fd_gadget);
99g_fd_uart = g_fd_gadget = NULL;