free_mem is a misnomer. We never update it with the free memory for
LMB. Instead, it describes all available memory and is checked against
used_mem to decide whether an area is free or not.
So let's rename this field to better match its usage.
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Tested-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
(cherry picked from commit 400c34db89)
LMB flags is not an enum anymore. It's currently used as a bitmask
in various places of our code. So make it a u32 which is more
appropriate when dealing with masks.
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Tested-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
(cherry picked from commit 3d56c06551)
Since net_test_wget() is testing a command and is in test/cmd it should
be in the 'cmd' test suite, not 'lib'.
Saving and restoring the values of the environment variables that the
test manipulates is necessary to avoid a regression when running the
whole ut test suite. A minimal reproducer is:
$ ./u-boot -T -c "ut cmd net_test_wget; ut dm dm_test_eth_act" | \
grep -E "(Test:|Failures:)"
Reported-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
(cherry picked from commit 20f641987f)
Add a new 'malloc dump' command that walks the dlmalloc heap from start
to end, printing each chunk's address, size (in hex), and status
(used/free/top). This is useful for debugging memory allocation issues.
When CONFIG_MCHECK_HEAP_PROTECTION is enabled, the caller string is
also shown if available.
Example output:
Heap dump: 18a1d000 - 1ea1f000
Address Size Status
----------------------------------
18a1d000 10 (chunk header)
18a1d010 90 used
18adfc30 60 <free>
18adff90 5f3f030 top
1ea1f000 end
----------------------------------
Used: c2ef0 bytes in 931 chunks
Free: 5f3f0c0 bytes in 2 chunks + top
Expand the console-record size to handle this command.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add counters to track the number of calls to malloc(), free(), and
realloc(). These are displayed by the 'malloc info' command and
accessible via malloc_get_info().
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add a command to display malloc heap statistics, showing total heap
size and memory currently in use.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
The TrueType console driver calls malloc/free for every character
rendered, which causes significant memory fragmentation and allocation
traffic.
Add CONFIG_CONSOLE_TRUETYPE_GLYPH_BUF to enable a pre-allocated buffer
in the driver's private data. The buffer starts at 4KB and grows via
realloc() as needed. When rendering a glyph, use this buffer to avoid
malloc/free for normal characters.
The buffer is allocated lazily after relocation to avoid consuming
early malloc space before the full heap is available.
Add CONFIG_VIDEO_GLYPH_STATS (default y on sandbox) to track the number
of glyphs rendered. Use 'font info' to view the count.
Series-changes: 2
- Rename the Kconfig to just enable the feature: always allocate
Co-developed-by: Claude Opus 4 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Display relative paths instead of absolute paths in backtrace output,
making the output cleaner and more portable across different build
environments.
This works by adding a SRCTREE define to lib/backtrace.c and stripping
it from filenames when printing.
Series-to: concept
Series-cc: heinrich
Cover-letter:
backtrace: Add runtime support for looking at the backtrace
In some cases the backtrace contains useful information, such as whether
a particular function was called earlier in the stack.
This series provides a very simple backtrace library, along with some
sandbox-specific functions to allow it to work. It is designed such that
another arch could implement it.
A new 'backtrace' command provides access to the backtrace.
END
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add a new 'backtrace' command which prints the current call stack, which
is useful for debugging. The command is enabled by CONFIG_CMD_BACKTRACE
Add docs and a test.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
It is sometimes useful to use a real TKey even when running with the
test devicetree. Put it first, so it becomes the default. Update tests
to select the emulator explicitly.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Rather than Blake2b, use SHA256 to obtain the disk-encryption key based
on the key material provided by the TKey. This matches the upcoming
disk-encryption test.
Signed-off-by: Simon Glass <simon.glass@canonical.com>
There are quite a few media devices in test.dts which are not enabled by
default, so are not bound on startup. Sometimes it is useful to be able
to use these from the command line.
Add 'sb devon' and 'sb devoff' subcommands to enable and disable devices
from the device tree. For example, running sandbox with -T, then
'sb devon mmc11' enables the mmc11 device mentioned in test.dts
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
There is already a Python test. Add a few C tests as well, for bootstage
itself and for the 'bootstage' command.
Add helpers to access the internal state. Be careful to zero records
when removing them, since if the record is later reused, bootstage
expects the time to be zero.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a new 'tkey' command that provides an interface to interact with
Tillitis TKey security tokens. Subcommands include:
- info: Display device information (UDI, name, version, mode)
- load: Load and run applications on the TKey
- pubkey: Get the public key from a signer app
- getkey: Derive disk encryption keys with password and USS
This command enables U-Boot to use TKey devices for secure key
derivation for full-disk encryption.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
The flags contain lots of little pieces of information. Print them out
with the bdinfo command, so the user can look them up if needed.
Signed-off-by: Simon Glass <sjg@chromium.org>
Complete the support for this feature by dealing with rendering, the
moving to a particular row/column and scrolling.
Provide a simple test to check that things look right.
Allow omitting the font name to request the default font.
Fix an errant tab nearby.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
It is sometimes useful to use a bitmap font for the console even when
truetype fonts are available. As a starting point, pull in the
font table and provide information about font sizes. Allow selection of
a bitmap font by name, as well as listing available bitmap fonts.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a new 'chid compat' subcommand that finds the compatible string
matching the current hardware's CHID and sets the fdtcompat environment
variable. This examines the devicetree under /chid for nodes with
hardware-id child nodes containing CHID data that matches the system's
generated CHIDs.
The command prints the found compatible string to the console and
automatically sets the fdtcompat environment variable for use by
other U-Boot commands.
Series-to: concept
Cover-letter:
Selection of devicetree using CHIDs
This series implements support for Microsoft's Computer Hardware
Identifier (CHID) specification in U-Boot. CHIDs provide a standardised
way to identify hardware configurations using SMBIOS data, enabling
automatic selection of appropriate device tree overlays and drivers when
the firmware itself lacks support for devicetree.
The CHID system generates UUIDs from various combinations of hardware
information (manufacturer, product name, BIOS version, etc.) creating a
hierarchy from most to least specific. This allows U-Boot to
automatically select the correct devicetree compatible-string for the
hardware on which it running.
This series includes:
* Core CHID Infrastructure:
- UUID v5 generation with Microsoft's CHID namespace
- Support for all 15 CHID variants (HardwareID-00 through HardwareID-14)
- SMBIOS data extraction and processing
* Devicetree Integration:
- hwids_to_dtsi.py script to convert CHID files to devicetree .dtsi
- Automatic inclusion of the .dtsi into the board'' devicetree
- Runtime compatible-string-selection based on hardware CHIDs
* chid command:
- chid show - show current hardware information and generated CHIDs
- chid list - list all supported CHID variants and generated UUIDs
- chid variants - show information about CHID variant restrictions
- chid compat - select the compatible string for current hardware
* ARM/EFI Support:
- CHID mappings for a selection of ARM-based Windows devices
- Support for Qualcomm Snapdragon platforms (MSM8998, SC7180, SC8180X,
SC8280XP, SDM850, X1E series)
* Testing:
- Sandbox tests using mock SMBIOS data
- CI integration for hwids_to_dtsi validation
- Validation against Microsoft's ComputerHardwareIds.exe output
Documentation is provided for this new subsystem and associated
commands.
END
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:22
Add a 'chid list' command to display the values for all CHID variants.
Also add 'chid detail' to see all details about a variant.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Provide a simple command which supports showing the information which
goes into calculating a CHID. The information is obtained entirely from
SMBIOS tables at present.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Some common smbios settings are not included with sandbox. Add these to
test.dts so the data is more meaningful.
Update smbios tests to match the new devicetree values.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Create a sandbox test for the smbios command. This checks that the
expected output is produced.
Drop the unnecessary 0x before each address, since U-Boot uses hex by
default.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a new 'fdt reserved' subcommand that displays all reserved memory
regions defined in the device tree's /reserved-memory node. This command
provides a formatted table showing the ID, name, start address, and size
of each reserved memory region.
Avoid a conflict with the existing 'fdt resize' command. Update the docs
and add a test.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Move fdt_print() function from cmd/fdt.c to a new lib/fdt_print.c file
to make it available as a library function for other code to use.
Move and rename is_printable_string(), making it available as well.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Show the actual value being used by the pager, if enabled.
Series-changes: 2
- Add new patch to show the pager page_len value
Signed-off-by: Simon Glass <sjg@chromium.org>
On platforms where most of the memory is above 4GB, the EFI app may find
itself using addresses with 9 or even 10 digits. Expand the width of the
columns to cope with this.
Add some double bars across digits 9 and 8 so that it is easier to make
the value.
Signed-off-by: Simon Glass <sjg@chromium.org>
Provide a simple command to read a named file into memory.
Skip this test on sandbox for now, as it doesn't support this feature in
its emulation of QEMU.
Signed-off-by: Simon Glass <sjg@chromium.org>
There are a few selectors in a different region which contain what seems
to be arch-specific information. Add a way to display this. So far it
only works on x86.
Signed-off-by: Simon Glass <sjg@chromium.org>
QEMU provides a table containing the ACPI tables and information on how
to relocate them to any suitable memory address. Add a command to show
this information.
Signed-off-by: Simon Glass <sjg@chromium.org>
There are quite a few values provided by QEMU and used by U-Boot, for
which it isn't possible to see the values. Add a new 'qfw dump' command
to support this.
Skip this test on sandbox for now, as it doesn't support this feature in
its emulation of QEMU.
Signed-off-by: Simon Glass <sjg@chromium.org>
Update the command to show the size and selected file, since this is
useful information at times. Add a heading so it is clear what each
field refers to.
Add a simple test as well.
Signed-off-by: Simon Glass <sjg@chromium.org>
These tests are designed to work on sandbox only. The truetype font
changes the current font, which QEMU targets may not support. The
meminfo test assumes a particular memory size.
Mark them as sandbox-only.
Signed-off-by: Simon Glass <sjg@chromium.org>
The kernel searching bootconfig will be off-by-1 and never match
thus always not found in this case.
Signed-off-by: George Chan <gchan9527@gmail.com>
Use 'fdt' as the tag and update fdt_test_chosen:
Signed-off-by: Simon Glass <sjg@chromium.org>
Some test commands (such as "false", or the empty string) need
CONFIG_HUSH_PARSER=y. Fix test/cmd/command.c.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
According to HTTP/1.0 standard the HTTP reply consist of
* Status Line + CRLF
* Zero or more Response Header Fields (each ended with CRLF)
* CRLF on new line (Response Header Fields end marker)
* Optional Entity Body.
Thus in response headers we state:
Content-Length = 30
but actual transferred file data is:
"\r\n<html><body>Hi</body></html>\r\n".
This is 32 bytes of data.
So we get and check for correctness 32 bytes of data, but
* The response we are used is incorrect, real server will
set Content-Length to 32.
* default_wget_info->hdr_cont_len will be set to wrong
value 30 (used for efi http booting).
Fix an issue by:
* replace bogus response with an actual response from the HTTP server
* format response to show HTTP response structure
* recalculate md5sum as transferred file data has been changed.
The server response was captured with the commands
echo -ne "<html><body>Hi</body></html>\n" > ~/public_html/test.html
echo -ne "GET /~${USER}/test.html HTTP/1.0\r\n\r\n" | netcat localhost 80 >reply.txt
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Changes:
* update to new tcp stack
* fix zero values for ISS and IRS issue (see RFC 9293)
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>
The setexpr.s command allows to concatenate two strings.
According to the description in doc/usage/cmd/setexpr.rst the parameters
value1 and value2 can be either direct values or pointers to a
memory location holding the values.
Unfortunately `setexpr.s <value1> + <value2>` fails if any of the values
is a direct value. $? is set to false.
* Add support for direct values in setexpr.s.
* Correct the unit test for "setexpr.s fred 0".
* Add a new unit test for "setexpr.s fred '1' + '3'" giving '13'.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
env_set() frees the previous value after allocating the new value.
As the free() may merge memory chunks the available memory is not
expected to stay constant.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
env_set() frees the previous value after allocating the new value.
As the free() may merge memory chunks the available memory is not
expected to stay constant.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
It is confusing to have both "$(PHASE_)" and "$(XPL_)" be used in our
Makefiles as part of the macros to determine when to do something in our
Makefiles based on what phase of the build we are in. For consistency,
bring this down to a single macro and use "$(PHASE_)" only.
Signed-off-by: Tom Rini <trini@konsulko.com>