drivers/bus/mhi/host/boot.c
Source file repositories/reference/linux-study-clean/drivers/bus/mhi/host/boot.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bus/mhi/host/boot.c- Extension
.c- Size
- 17648 bytes
- Lines
- 641
- Domain
- Driver Families
- Bucket
- drivers/bus
- 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.
- 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/delay.hlinux/device.hlinux/dma-direction.hlinux/dma-mapping.hlinux/firmware.hlinux/interrupt.hlinux/list.hlinux/mhi.hlinux/module.hlinux/random.hlinux/slab.hlinux/wait.hinternal.h
Detected Declarations
function Copyrightfunction __mhi_download_rddm_in_panicfunction mhi_download_rddm_imagefunction mhi_fw_load_error_dumpfunction mhi_fw_load_bhiefunction mhi_fw_load_bhifunction mhi_free_bhi_bufferfunction mhi_free_bhie_tablefunction mhi_alloc_bhi_bufferfunction mhi_alloc_bhie_tablefunction mhi_firmware_copy_bhiefunction mhi_fw_load_type_getfunction mhi_load_image_bhifunction mhi_load_image_bhiefunction mhi_fw_load_handlerfunction imagesfunction mhi_download_amss_imageexport mhi_download_rddm_image
Annotated Snippet
while (rddm_retry--) {
ee = mhi_get_exec_env(mhi_cntrl);
if (ee == MHI_EE_RDDM)
break;
udelay(delayus);
}
if (rddm_retry <= 0) {
/* Hardware reset so force device to enter RDDM */
dev_dbg(dev,
"Did not enter RDDM, do a host req reset\n");
mhi_soc_reset(mhi_cntrl);
udelay(delayus);
}
ee = mhi_get_exec_env(mhi_cntrl);
}
dev_dbg(dev,
"Waiting for RDDM image download via BHIe, current EE:%s\n",
TO_MHI_EXEC_STR(ee));
while (retry--) {
ret = mhi_read_reg_field(mhi_cntrl, base, BHIE_RXVECSTATUS_OFFS,
BHIE_RXVECSTATUS_STATUS_BMSK, &rx_status);
if (ret)
return -EIO;
if (rx_status == BHIE_RXVECSTATUS_STATUS_XFER_COMPL)
return 0;
udelay(delayus);
}
ee = mhi_get_exec_env(mhi_cntrl);
ret = mhi_read_reg(mhi_cntrl, base, BHIE_RXVECSTATUS_OFFS, &rx_status);
dev_err(dev, "RXVEC_STATUS: 0x%x\n", rx_status);
error_exit_rddm:
dev_err(dev, "RDDM transfer failed. Current EE: %s\n",
TO_MHI_EXEC_STR(ee));
return -EIO;
}
/* Download RDDM image from device */
int mhi_download_rddm_image(struct mhi_controller *mhi_cntrl, bool in_panic)
{
void __iomem *base = mhi_cntrl->bhie;
struct device *dev = &mhi_cntrl->mhi_dev->dev;
u32 rx_status;
if (in_panic)
return __mhi_download_rddm_in_panic(mhi_cntrl);
dev_dbg(dev, "Waiting for RDDM image download via BHIe\n");
/* Wait for the image download to complete */
wait_event_timeout(mhi_cntrl->state_event,
mhi_read_reg_field(mhi_cntrl, base,
BHIE_RXVECSTATUS_OFFS,
BHIE_RXVECSTATUS_STATUS_BMSK,
&rx_status) || rx_status,
msecs_to_jiffies(mhi_cntrl->timeout_ms));
return (rx_status == BHIE_RXVECSTATUS_STATUS_XFER_COMPL) ? 0 : -EIO;
}
EXPORT_SYMBOL_GPL(mhi_download_rddm_image);
static void mhi_fw_load_error_dump(struct mhi_controller *mhi_cntrl)
{
struct device *dev = &mhi_cntrl->mhi_dev->dev;
rwlock_t *pm_lock = &mhi_cntrl->pm_lock;
void __iomem *base = mhi_cntrl->bhi;
int ret, i;
u32 val;
struct {
char *name;
u32 offset;
} error_reg[] = {
{ "ERROR_CODE", BHI_ERRCODE },
{ "ERROR_DBG1", BHI_ERRDBG1 },
{ "ERROR_DBG2", BHI_ERRDBG2 },
{ "ERROR_DBG3", BHI_ERRDBG3 },
{ NULL },
};
read_lock_bh(pm_lock);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/device.h`, `linux/dma-direction.h`, `linux/dma-mapping.h`, `linux/firmware.h`, `linux/interrupt.h`, `linux/list.h`, `linux/mhi.h`.
- Detected declarations: `function Copyright`, `function __mhi_download_rddm_in_panic`, `function mhi_download_rddm_image`, `function mhi_fw_load_error_dump`, `function mhi_fw_load_bhie`, `function mhi_fw_load_bhi`, `function mhi_free_bhi_buffer`, `function mhi_free_bhie_table`, `function mhi_alloc_bhi_buffer`, `function mhi_alloc_bhie_table`.
- Atlas domain: Driver Families / drivers/bus.
- Implementation status: integration implementation candidate.
- 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.