drivers/ata/libahci_platform.c
Source file repositories/reference/linux-study-clean/drivers/ata/libahci_platform.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/ata/libahci_platform.c- Extension
.c- Size
- 24160 bytes
- Lines
- 968
- Domain
- Driver Families
- Bucket
- drivers/ata
- 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.
- 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.hlinux/kernel.hlinux/gfp.hlinux/module.hlinux/pm.hlinux/interrupt.hlinux/device.hlinux/platform_device.hlinux/libata.hlinux/ahci_platform.hlinux/phy/phy.hlinux/pm_runtime.hlinux/of.hlinux/of_platform.hlinux/reset.hahci.h
Detected Declarations
function ahci_platform_enable_physfunction ahci_platform_disable_physfunction ahci_platform_enable_clksfunction ahci_platform_disable_clksfunction ahci_platform_deassert_rstsfunction rearmsfunction ahci_platform_enable_regulatorsfunction ahci_platform_disable_regulatorsfunction ahci_platform_enable_resourcesfunction ahci_platform_disable_resourcesfunction ahci_platform_put_resourcesfunction ahci_platform_get_phyfunction ahci_platform_get_regulatorfunction ahci_platform_get_firmwarefunction for_each_child_of_node_scopedfunction ahci_platform_find_max_port_idfunction for_each_child_of_node_scopedfunction controllerfunction ahci_platform_init_hostfunction ahci_host_stopfunction ahci_platform_shutdownfunction ahci_platform_suspend_hostfunction ahci_platform_resume_hostfunction ahci_platform_suspendfunction ahci_platform_resumeexport ahci_platform_opsexport ahci_platform_enable_physexport ahci_platform_disable_physexport ahci_platform_find_clkexport ahci_platform_enable_clksexport ahci_platform_disable_clksexport ahci_platform_deassert_rstsexport ahci_platform_assert_rstsexport ahci_platform_enable_regulatorsexport ahci_platform_disable_regulatorsexport ahci_platform_enable_resourcesexport ahci_platform_disable_resourcesexport ahci_platform_get_resourcesexport ahci_platform_init_hostexport ahci_platform_shutdownexport ahci_platform_suspend_hostexport ahci_platform_resume_hostexport ahci_platform_suspendexport ahci_platform_resume
Annotated Snippet
if (rc) {
phy_exit(hpriv->phys[i]);
goto disable_phys;
}
rc = phy_power_on(hpriv->phys[i]);
if (rc) {
phy_exit(hpriv->phys[i]);
goto disable_phys;
}
}
return 0;
disable_phys:
while (--i >= 0) {
if (ahci_ignore_port(hpriv, i))
continue;
phy_power_off(hpriv->phys[i]);
phy_exit(hpriv->phys[i]);
}
return rc;
}
EXPORT_SYMBOL_GPL(ahci_platform_enable_phys);
/**
* ahci_platform_disable_phys - Disable PHYs
* @hpriv: host private area to store config values
*
* This function disables all PHYs found in hpriv->phys.
*/
void ahci_platform_disable_phys(struct ahci_host_priv *hpriv)
{
int i;
for (i = 0; i < hpriv->nports; i++) {
if (ahci_ignore_port(hpriv, i))
continue;
phy_power_off(hpriv->phys[i]);
phy_exit(hpriv->phys[i]);
}
}
EXPORT_SYMBOL_GPL(ahci_platform_disable_phys);
/**
* ahci_platform_find_clk - Find platform clock
* @hpriv: host private area to store config values
* @con_id: clock connection ID
*
* This function returns a pointer to the clock descriptor of the clock with
* the passed ID.
*
* RETURNS:
* Pointer to the clock descriptor on success otherwise NULL
*/
struct clk *ahci_platform_find_clk(struct ahci_host_priv *hpriv, const char *con_id)
{
int i;
for (i = 0; i < hpriv->n_clks; i++) {
if (hpriv->clks[i].id && !strcmp(hpriv->clks[i].id, con_id))
return hpriv->clks[i].clk;
}
return NULL;
}
EXPORT_SYMBOL_GPL(ahci_platform_find_clk);
/**
* ahci_platform_enable_clks - Enable platform clocks
* @hpriv: host private area to store config values
*
* This function enables all the clks found for the AHCI device.
*
* RETURNS:
* 0 on success otherwise a negative error code
*/
int ahci_platform_enable_clks(struct ahci_host_priv *hpriv)
{
return clk_bulk_prepare_enable(hpriv->n_clks, hpriv->clks);
}
EXPORT_SYMBOL_GPL(ahci_platform_enable_clks);
/**
* ahci_platform_disable_clks - Disable platform clocks
* @hpriv: host private area to store config values
*
* This function disables all the clocks enabled before
Annotation
- Immediate include surface: `linux/clk.h`, `linux/kernel.h`, `linux/gfp.h`, `linux/module.h`, `linux/pm.h`, `linux/interrupt.h`, `linux/device.h`, `linux/platform_device.h`.
- Detected declarations: `function ahci_platform_enable_phys`, `function ahci_platform_disable_phys`, `function ahci_platform_enable_clks`, `function ahci_platform_disable_clks`, `function ahci_platform_deassert_rsts`, `function rearms`, `function ahci_platform_enable_regulators`, `function ahci_platform_disable_regulators`, `function ahci_platform_enable_resources`, `function ahci_platform_disable_resources`.
- Atlas domain: Driver Families / drivers/ata.
- Implementation status: integration implementation candidate.
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.