drivers/firmware/tegra/bpmp.c
Source file repositories/reference/linux-study-clean/drivers/firmware/tegra/bpmp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/tegra/bpmp.c- Extension
.c- Size
- 21174 bytes
- Lines
- 942
- Domain
- Driver Families
- Bucket
- drivers/firmware
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk/tegra.hlinux/genalloc.hlinux/mailbox_client.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/pm.hlinux/semaphore.hlinux/sched/clock.hsoc/tegra/bpmp.hsoc/tegra/bpmp-abi.hsoc/tegra/ivc.hbpmp-private.h
Detected Declarations
function Copyrightfunction tegra_bpmp_putfunction tegra_bpmp_channel_get_thread_indexfunction tegra_bpmp_message_validfunction tegra_bpmp_is_response_readyfunction tegra_bpmp_is_request_readyfunction tegra_bpmp_wait_responsefunction tegra_bpmp_ack_responsefunction tegra_bpmp_ack_requestfunction tegra_bpmp_is_request_channel_freefunction tegra_bpmp_is_response_channel_freefunction tegra_bpmp_wait_request_channel_freefunction tegra_bpmp_post_requestfunction tegra_bpmp_post_responsefunction tegra_bpmp_ring_doorbellfunction __tegra_bpmp_channel_readfunction tegra_bpmp_channel_readfunction __tegra_bpmp_channel_writefunction tegra_bpmp_write_threadedfunction tegra_bpmp_channel_writefunction tegra_bpmp_transfer_atomicfunction tegra_bpmp_transferfunction tegra_bpmp_mrq_returnfunction tegra_bpmp_handle_mrqfunction tegra_bpmp_request_mrqfunction tegra_bpmp_free_mrqfunction tegra_bpmp_mrq_is_supportedfunction tegra_bpmp_mrq_handle_pingfunction tegra_bpmp_pingfunction tegra_bpmp_get_firmware_tag_oldfunction tegra_bpmp_get_firmware_tagfunction tegra_bpmp_channel_signalfunction tegra_bpmp_handle_rxfunction for_each_set_bitfunction tegra_bpmp_probefunction tegra_bpmp_suspendfunction tegra_bpmp_resumefunction IS_ENABLEDexport tegra_bpmp_get_with_idexport tegra_bpmp_getexport tegra_bpmp_putexport tegra_bpmp_transfer_atomicexport tegra_bpmp_transferexport tegra_bpmp_mrq_returnexport tegra_bpmp_request_mrqexport tegra_bpmp_free_mrqexport tegra_bpmp_mrq_is_supported
Annotated Snippet
if (tegra_bpmp_is_response_ready(channel)) {
tegra_bpmp_channel_signal(channel);
clear_bit(i, busy);
}
}
spin_unlock(&bpmp->lock);
}
static int tegra_bpmp_probe(struct platform_device *pdev)
{
struct tegra_bpmp *bpmp;
char tag[TAG_SZ];
size_t size;
int err;
bpmp = devm_kzalloc(&pdev->dev, sizeof(*bpmp), GFP_KERNEL);
if (!bpmp)
return -ENOMEM;
bpmp->soc = of_device_get_match_data(&pdev->dev);
bpmp->dev = &pdev->dev;
INIT_LIST_HEAD(&bpmp->mrqs);
spin_lock_init(&bpmp->lock);
bpmp->threaded.count = bpmp->soc->channels.thread.count;
sema_init(&bpmp->threaded.lock, bpmp->threaded.count);
size = BITS_TO_LONGS(bpmp->threaded.count) * sizeof(long);
bpmp->threaded.allocated = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
if (!bpmp->threaded.allocated)
return -ENOMEM;
bpmp->threaded.busy = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
if (!bpmp->threaded.busy)
return -ENOMEM;
spin_lock_init(&bpmp->atomic_tx_lock);
bpmp->tx_channel = devm_kzalloc(&pdev->dev, sizeof(*bpmp->tx_channel),
GFP_KERNEL);
if (!bpmp->tx_channel)
return -ENOMEM;
bpmp->rx_channel = devm_kzalloc(&pdev->dev, sizeof(*bpmp->rx_channel),
GFP_KERNEL);
if (!bpmp->rx_channel)
return -ENOMEM;
bpmp->threaded_channels = devm_kcalloc(&pdev->dev, bpmp->threaded.count,
sizeof(*bpmp->threaded_channels),
GFP_KERNEL);
if (!bpmp->threaded_channels)
return -ENOMEM;
platform_set_drvdata(pdev, bpmp);
err = bpmp->soc->ops->init(bpmp);
if (err < 0)
return err;
err = tegra_bpmp_request_mrq(bpmp, MRQ_PING,
tegra_bpmp_mrq_handle_ping, bpmp);
if (err < 0)
goto deinit;
err = tegra_bpmp_ping(bpmp);
if (err < 0) {
dev_err(&pdev->dev, "failed to ping BPMP: %d\n", err);
goto free_mrq;
}
err = tegra_bpmp_get_firmware_tag(bpmp, tag, sizeof(tag));
if (err < 0) {
dev_err(&pdev->dev, "failed to get firmware tag: %d\n", err);
goto free_mrq;
}
dev_info(&pdev->dev, "firmware: %.*s\n", (int)sizeof(tag), tag);
err = of_platform_default_populate(pdev->dev.of_node, NULL, &pdev->dev);
if (err < 0)
goto free_mrq;
if (of_property_present(pdev->dev.of_node, "#clock-cells")) {
err = tegra_bpmp_init_clocks(bpmp);
if (err < 0)
goto free_mrq;
}
Annotation
- Immediate include surface: `linux/clk/tegra.h`, `linux/genalloc.h`, `linux/mailbox_client.h`, `linux/module.h`, `linux/of.h`, `linux/of_platform.h`, `linux/platform_device.h`, `linux/pm.h`.
- Detected declarations: `function Copyright`, `function tegra_bpmp_put`, `function tegra_bpmp_channel_get_thread_index`, `function tegra_bpmp_message_valid`, `function tegra_bpmp_is_response_ready`, `function tegra_bpmp_is_request_ready`, `function tegra_bpmp_wait_response`, `function tegra_bpmp_ack_response`, `function tegra_bpmp_ack_request`, `function tegra_bpmp_is_request_channel_free`.
- Atlas domain: Driver Families / drivers/firmware.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.