<feed xmlns='http://www.w3.org/2005/Atom'>
<title>opensbi.git/lib/sbi/sbi_console.c, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://cgit.235523.xyz/opensbi.git/atom/lib/sbi/sbi_console.c?h=master</id>
<link rel='self' href='http://cgit.235523.xyz/opensbi.git/atom/lib/sbi/sbi_console.c?h=master'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/'/>
<updated>2024-07-24T06:48:41Z</updated>
<entry>
<title>lib: sbi: Introduce an early console buffer for caching early prints</title>
<updated>2024-07-24T06:48:41Z</updated>
<author>
<name>Anup Patel</name>
<email>apatel@ventanamicro.com</email>
</author>
<published>2024-07-05T04:34:12Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=bb7267a07f8f93b30355c66538f0752c4766b309'/>
<id>urn:sha1:bb7267a07f8f93b30355c66538f0752c4766b309</id>
<content type='text'>
The console device is registered by platform only in early_init()
callback so any prints before this point will be lost. Introduce an
early console buffer for caching prints before platform early_init().

For crashes before platform early_init(), users can simply dump the
contents of the console_early_buffer[] string using a debugger. The
relative address of the console_early_buffer[] string can be found
using following two commands:

CONSOLE_EARLY_FIFO_ADDR=`${CROSS_COMPILE}objdump -D \
build/platform/generic/firmware/fw_dynamic.elf | \
grep "&lt;console_early_fifo&gt;:" | awk '{print $1}'`

${CROSS_COMPILE}objdump -R build/platform/generic/firmware/fw_dynamic.elf | \
grep $CONSOLE_EARLY_FIFO_ADDR | awk '{print $3}'

Signed-off-by: Anup Patel &lt;apatel@ventanamicro.com&gt;
Reviewed-By: Himanshu Chauhan &lt;hchauhan@ventanamicro.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Remove sbi_console_init() and console_init() platform callback</title>
<updated>2024-07-24T06:48:33Z</updated>
<author>
<name>Anup Patel</name>
<email>apatel@ventanamicro.com</email>
</author>
<published>2024-07-04T15:39:17Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=119b15a5535bc6f466a7f89857fcce820fe2b290'/>
<id>urn:sha1:119b15a5535bc6f466a7f89857fcce820fe2b290</id>
<content type='text'>
Now that all platforms have been updated to initialize serial console
device in early_init(), the sbi_console_init() and console_init()
platform callback are redundant hence remove them.

Signed-off-by: Anup Patel &lt;apatel@ventanamicro.com&gt;
Reviewed-By: Himanshu Chauhan &lt;hchauhan@ventanamicro.com&gt;
</content>
</entry>
<entry>
<title>lib: tests: Move tests to a separate directory</title>
<updated>2024-03-19T05:50:40Z</updated>
<author>
<name>Ivan Orlov</name>
<email>ivan.orlov0322@gmail.com</email>
</author>
<published>2024-03-13T15:01:57Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=5c992a115a15ce2f2518f0ff7a655b42c3a8ebad'/>
<id>urn:sha1:5c992a115a15ce2f2518f0ff7a655b42c3a8ebad</id>
<content type='text'>
Move all of the SBIUnit-related code into the lib/sbi/tests directory.
Update 'Makefile' to index objects from the tests subdirectory.

I don't think creating the full separate list of Makefile variables
(libsbitests-objs-path-y, libsbitests-object-mks, etc. as it is done for
libsbiutils) is necessary for the tests because:

1) `lib/sbi/tests/objects.mk` is already indexed into
'libsbi-objects-mks' since the find expression for the libsbi-object-mks
variable looks for objects.mk files in the nested directories as well).

2) Tests are tightly coupled with the `lib/sbi/` sources, therefore it
may be reasonable to store the list of lib/sbi and lib/sbi/tests object
files together in the libsbi-objs-path-y variable.

Additionally, update relative paths in the tests where necessary.

Signed-off-by: Ivan Orlov &lt;ivan.orlov0322@gmail.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: tests: Add sbi_console test</title>
<updated>2024-03-10T04:42:52Z</updated>
<author>
<name>Ivan Orlov</name>
<email>ivan.orlov0322@gmail.com</email>
</author>
<published>2024-03-04T21:45:51Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=87d8fe78653e77de33cc12b9df07fc3a202f7d49'/>
<id>urn:sha1:87d8fe78653e77de33cc12b9df07fc3a202f7d49</id>
<content type='text'>
Add the test suite covering some of the functions from
lib/sbi/sbi_console.c: putc, puts and printf. The test covers a variety
of format specifiers for printf and different strings and characters for
putc and puts.

In order to do that, the test "mocks" the sbi_console_device structure
by setting the 'console_dev' variable to the virtual console.

Signed-off-by: Ivan Orlov &lt;ivan.orlov0322@gmail.com&gt;
Reviewed-by: Andrew Jones &lt;ajones@ventanamicro.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Make console_puts/console_putc interchangeable</title>
<updated>2023-11-17T10:33:21Z</updated>
<author>
<name>Xiang W</name>
<email>wxjstz@126.com</email>
</author>
<published>2023-11-17T01:03:58Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=3aaed4fadfce9e02823c813bd5a69a84376b3397'/>
<id>urn:sha1:3aaed4fadfce9e02823c813bd5a69a84376b3397</id>
<content type='text'>
console_puts/console_putc should replace each other, but the previous
sbi_putc can only use console_putc. This patch addresses this problem.

Signed-off-by: Xiang W &lt;wxjstz@126.com&gt;
Reviewed-by: Guo Ren &lt;guoren@kernel.org&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Fix missing '\0' when buffer szie equal 1</title>
<updated>2023-07-12T05:07:43Z</updated>
<author>
<name>Xiang W</name>
<email>wxjstz@126.com</email>
</author>
<published>2023-07-09T16:03:26Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=a73982d7376a71cf6e230b255069da46fe2becc9'/>
<id>urn:sha1:a73982d7376a71cf6e230b255069da46fe2becc9</id>
<content type='text'>
Fix special case: sbi_snprintf(out, out_len, ...) when out_len equal
1, The previous code will not fill the buffer with any char.

Signed-off-by: Xiang W &lt;wxjstz@126.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Fix timing of clearing tbuf</title>
<updated>2023-07-12T05:07:16Z</updated>
<author>
<name>Xiang W</name>
<email>wxjstz@126.com</email>
</author>
<published>2023-07-09T16:02:30Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=ff43168137a4890fe65460c1506fdf08c26bebad'/>
<id>urn:sha1:ff43168137a4890fe65460c1506fdf08c26bebad</id>
<content type='text'>
A single scan of the format char may add multiple characters to the
tbuf, causing a buffer overflow. You should check if tbuf is full in
printc so that it does not cause a buffer overflow.

Signed-off-by: Xiang W &lt;wxjstz@126.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Fix printc</title>
<updated>2023-07-12T04:32:27Z</updated>
<author>
<name>Xiang W</name>
<email>wxjstz@126.com</email>
</author>
<published>2023-07-09T16:02:29Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=cc89fa7b5481b3279f1628f71debf795d5618044'/>
<id>urn:sha1:cc89fa7b5481b3279f1628f71debf795d5618044</id>
<content type='text'>
Because *out needs to reserve a byte to hold '\0', no more characters
should be added to the buffer when *out has one byte left, and the
buffer size *out_len should not be modified. this patch prevents
the correction of *out_len when *out_len is 1.

Signed-off-by: Xiang W &lt;wxjstz@126.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Simplify prints</title>
<updated>2023-07-12T04:32:06Z</updated>
<author>
<name>Xiang W</name>
<email>wxjstz@126.com</email>
</author>
<published>2023-07-09T16:02:28Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=3b6fcddcebf82bb58ac750a2ab4d6e22d7549ac9'/>
<id>urn:sha1:3b6fcddcebf82bb58ac750a2ab4d6e22d7549ac9</id>
<content type='text'>
When doing width = width - strlen(string) in prints there is no need
to consider the case that witdh may be less than 0. This is because
the code to do filling needs to be executed under the condition that
width &gt; 0.

Signed-off-by: Xiang W &lt;wxjstz@126.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Fix printi</title>
<updated>2023-07-12T04:31:43Z</updated>
<author>
<name>Xiang W</name>
<email>wxjstz@126.com</email>
</author>
<published>2023-07-09T16:02:27Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=c6ee5ae5a485335fa28a5f74811f900d8da9f87d'/>
<id>urn:sha1:c6ee5ae5a485335fa28a5f74811f900d8da9f87d</id>
<content type='text'>
Fix two bug:
&gt; printf("%#08x", 0x123); /* print 0000x123 */
&gt; printf("%#x", 0); /* print 0x0 */

Signed-off-by: Xiang W &lt;wxjstz@126.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
</feed>
