drivers/char/agp/amd64-agp.c
Source file repositories/reference/linux-study-clean/drivers/char/agp/amd64-agp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/char/agp/amd64-agp.c- Extension
.c- Size
- 20486 bytes
- Lines
- 807
- Domain
- Driver Families
- Bucket
- drivers/char
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/module.hlinux/pci.hlinux/init.hlinux/agp_backend.hlinux/mmzone.hasm/page.hasm/e820/api.hasm/amd/nb.hasm/gart.hagp.h
Detected Declarations
function amd64_tlbflushfunction amd64_insert_memoryfunction amd64_fetch_sizefunction amd64_configurefunction amd_8151_configurefunction amd64_cleanupfunction agp_aperture_validfunction fix_northbridgefunction cache_nbsfunction amd8151_initfunction uli_agp_initfunction nforce3_agp_initfunction agp_amd64_probefunction agp_amd64_removefunction agp_amd64_resumefunction agp_amd64_initfunction agp_amd64_mod_initfunction agp_amd64_cleanupmodule init agp_amd64_mod_init
Annotated Snippet
static struct pci_driver agp_amd64_pci_driver = {
.name = "agpgart-amd64",
.id_table = agp_amd64_pci_table,
.probe = agp_amd64_probe,
.remove = agp_amd64_remove,
.driver.pm = &agp_amd64_pm_ops,
};
/* Not static due to IOMMU code calling it early. */
int __init agp_amd64_init(void)
{
struct pci_dev *pdev = NULL;
int err = 0;
if (agp_off)
return -EINVAL;
err = pci_register_driver(&agp_amd64_pci_driver);
if (err < 0)
return err;
if (agp_bridges_found == 0) {
if (!agp_try_unsupported && !agp_try_unsupported_boot) {
printk(KERN_INFO PFX "No supported AGP bridge found.\n");
#ifdef MODULE
printk(KERN_INFO PFX "You can try agp_try_unsupported=1\n");
#else
printk(KERN_INFO PFX "You can boot with agp=try_unsupported\n");
#endif
pci_unregister_driver(&agp_amd64_pci_driver);
return -ENODEV;
}
/* First check that we have at least one AMD64 NB */
if (!amd_nb_num()) {
pci_unregister_driver(&agp_amd64_pci_driver);
return -ENODEV;
}
/* Look for any AGP bridge */
for_each_pci_dev(pdev)
if (pci_find_capability(pdev, PCI_CAP_ID_AGP))
pci_add_dynid(&agp_amd64_pci_driver,
pdev->vendor, pdev->device,
pdev->subsystem_vendor,
pdev->subsystem_device, 0, 0, 0);
if (agp_bridges_found == 0) {
pci_unregister_driver(&agp_amd64_pci_driver);
err = -ENODEV;
}
}
return err;
}
static int __init agp_amd64_mod_init(void)
{
#ifndef MODULE
if (gart_iommu_aperture)
return agp_bridges_found ? 0 : -ENODEV;
#endif
return agp_amd64_init();
}
static void __exit agp_amd64_cleanup(void)
{
#ifndef MODULE
if (gart_iommu_aperture)
return;
#endif
if (aperture_resource)
release_resource(aperture_resource);
pci_unregister_driver(&agp_amd64_pci_driver);
}
module_init(agp_amd64_mod_init);
module_exit(agp_amd64_cleanup);
MODULE_AUTHOR("Dave Jones, Andi Kleen");
module_param(agp_try_unsupported, bool, 0);
MODULE_DESCRIPTION("GART driver for the AMD Opteron/Athlon64 on-CPU northbridge");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/module.h`, `linux/pci.h`, `linux/init.h`, `linux/agp_backend.h`, `linux/mmzone.h`, `asm/page.h`, `asm/e820/api.h`, `asm/amd/nb.h`.
- Detected declarations: `function amd64_tlbflush`, `function amd64_insert_memory`, `function amd64_fetch_size`, `function amd64_configure`, `function amd_8151_configure`, `function amd64_cleanup`, `function agp_aperture_valid`, `function fix_northbridge`, `function cache_nbs`, `function amd8151_init`.
- Atlas domain: Driver Families / drivers/char.
- Implementation status: pattern 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.