tools/testing/selftests/firmware/fw_fallback.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/firmware/fw_fallback.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/firmware/fw_fallback.sh- Extension
.sh- Size
- 6756 bytes
- Lines
- 284
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function load_fw_custom_cancel
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# This validates that the kernel will fall back to using the fallback mechanism
# to load firmware it can't find on disk itself. We must request a firmware
# that the kernel won't find, and any installed helper (e.g. udev) also
# won't find so that we can do the load ourself manually.
set -e
TEST_REQS_FW_SYSFS_FALLBACK="yes"
TEST_REQS_FW_SET_CUSTOM_PATH="no"
TEST_DIR=$(dirname $0)
source $TEST_DIR/fw_lib.sh
check_mods
check_setup
verify_reqs
setup_tmp_file
trap "test_finish" EXIT
load_fw()
{
local name="$1"
local file="$2"
# This will block until our load (below) has finished.
echo -n "$name" >"$DIR"/trigger_request &
# Give kernel a chance to react.
local timeout=10
while [ ! -e "$DIR"/"$name"/loading ]; do
sleep 0.1
timeout=$(( $timeout - 1 ))
if [ "$timeout" -eq 0 ]; then
echo "$0: firmware interface never appeared" >&2
exit 1
fi
done
echo 1 >"$DIR"/"$name"/loading
cat "$file" >"$DIR"/"$name"/data
echo 0 >"$DIR"/"$name"/loading
# Wait for request to finish.
wait
}
load_fw_cancel()
{
local name="$1"
local file="$2"
# This will block until our load (below) has finished.
echo -n "$name" >"$DIR"/trigger_request 2>/dev/null &
# Give kernel a chance to react.
local timeout=10
while [ ! -e "$DIR"/"$name"/loading ]; do
sleep 0.1
timeout=$(( $timeout - 1 ))
if [ "$timeout" -eq 0 ]; then
echo "$0: firmware interface never appeared" >&2
exit 1
fi
done
echo -1 >"$DIR"/"$name"/loading
# Wait for request to finish.
wait
Annotation
- Detected declarations: `function load_fw_custom_cancel`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.