drivers/scsi/aic7xxx/aic79xx_osm_pci.c
Source file repositories/reference/linux-study-clean/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/aic7xxx/aic79xx_osm_pci.c- Extension
.c- Size
- 10225 bytes
- Lines
- 379
- Domain
- Driver Families
- Bucket
- drivers/scsi
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
aic79xx_osm.haic79xx_inline.haic79xx_pci.h
Detected Declarations
function ahd_linux_pci_dev_suspendfunction ahd_linux_pci_dev_resumefunction ahd_linux_pci_dev_removefunction ahd_linux_pci_inherit_flagsfunction ahd_linux_pci_dev_probefunction ahd_linux_pci_initfunction ahd_linux_pci_exitfunction ahd_linux_pci_reserve_io_regionsfunction ahd_linux_pci_reserve_mem_regionfunction ahd_pci_map_registersfunction ahd_pci_map_intfunction ahd_power_state_change
Annotated Snippet
static struct pci_driver aic79xx_pci_driver = {
.name = "aic79xx",
.probe = ahd_linux_pci_dev_probe,
.driver.pm = &ahd_linux_pci_dev_pm_ops,
.remove = ahd_linux_pci_dev_remove,
.id_table = ahd_linux_pci_id_table
};
int
ahd_linux_pci_init(void)
{
return pci_register_driver(&aic79xx_pci_driver);
}
void
ahd_linux_pci_exit(void)
{
pci_unregister_driver(&aic79xx_pci_driver);
}
static int
ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd, resource_size_t *base,
resource_size_t *base2)
{
*base = pci_resource_start(ahd->dev_softc, 0);
/*
* This is really the 3rd bar and should be at index 2,
* but the Linux PCI code doesn't know how to "count" 64bit
* bars.
*/
*base2 = pci_resource_start(ahd->dev_softc, 3);
if (*base == 0 || *base2 == 0)
return (ENOMEM);
if (!request_region(*base, 256, "aic79xx"))
return (ENOMEM);
if (!request_region(*base2, 256, "aic79xx")) {
release_region(*base, 256);
return (ENOMEM);
}
return (0);
}
static int
ahd_linux_pci_reserve_mem_region(struct ahd_softc *ahd,
resource_size_t *bus_addr,
uint8_t __iomem **maddr)
{
resource_size_t start;
resource_size_t base_page;
u_long base_offset;
int error = 0;
if (aic79xx_allow_memio == 0)
return (ENOMEM);
if ((ahd->bugs & AHD_PCIX_MMAPIO_BUG) != 0)
return (ENOMEM);
start = pci_resource_start(ahd->dev_softc, 1);
base_page = start & PAGE_MASK;
base_offset = start - base_page;
if (start != 0) {
*bus_addr = start;
if (!request_mem_region(start, 0x1000, "aic79xx"))
error = ENOMEM;
if (!error) {
*maddr = ioremap(base_page, base_offset + 512);
if (*maddr == NULL) {
error = ENOMEM;
release_mem_region(start, 0x1000);
} else
*maddr += base_offset;
}
} else
error = ENOMEM;
return (error);
}
int
ahd_pci_map_registers(struct ahd_softc *ahd)
{
uint32_t command;
resource_size_t base;
uint8_t __iomem *maddr;
int error;
/*
* If its allowed, we prefer memory mapped access.
*/
command = ahd_pci_read_config(ahd->dev_softc, PCIR_COMMAND, 4);
Annotation
- Immediate include surface: `aic79xx_osm.h`, `aic79xx_inline.h`, `aic79xx_pci.h`.
- Detected declarations: `function ahd_linux_pci_dev_suspend`, `function ahd_linux_pci_dev_resume`, `function ahd_linux_pci_dev_remove`, `function ahd_linux_pci_inherit_flags`, `function ahd_linux_pci_dev_probe`, `function ahd_linux_pci_init`, `function ahd_linux_pci_exit`, `function ahd_linux_pci_reserve_io_regions`, `function ahd_linux_pci_reserve_mem_region`, `function ahd_pci_map_registers`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: pattern 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.