drivers/scsi/aic7xxx/aic7xxx_pci.c
Source file repositories/reference/linux-study-clean/drivers/scsi/aic7xxx/aic7xxx_pci.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/aic7xxx/aic7xxx_pci.c- Extension
.c- Size
- 61690 bytes
- Lines
- 2461
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: implementation source
- Status
- source 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 or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
aic7xxx_osm.haic7xxx_inline.haic7xxx_93cx6.haic7xxx_pci.h
Detected Declarations
function ahc_compose_idfunction ahc_9005_subdevinfo_validfunction ahc_find_pci_devicefunction ahc_pci_configfunction busfunction ahc_ext_scbram_presentfunction ahc_scbram_configfunction ahc_probe_ext_scbramfunction ahc_pci_test_register_accessfunction check_extportfunction ahc_parse_pci_eepromfunction configure_terminationfunction ahc_new_term_detectfunction aic787X_cable_detectfunction aic785X_cable_detectfunction ahc_acquire_seepromfunction ahc_release_seepromfunction write_brdctlfunction read_brdctlfunction ahc_pci_intrfunction ahc_pci_chip_initfunction ahc_pci_resumefunction ahc_aic785X_setupfunction ahc_aic7860_setupfunction ahc_apa1480_setupfunction ahc_aic7870_setupfunction ahc_aic7870h_setupfunction ahc_aha394X_setupfunction ahc_aha394Xh_setupfunction ahc_aha398X_setupfunction ahc_aha494X_setupfunction ahc_aha494Xh_setupfunction ahc_aic7880_setupfunction ahc_aic7880h_setupfunction ahc_aha2940Pro_setupfunction ahc_aha394XU_setupfunction ahc_aha394XUh_setupfunction ahc_aha398XU_setupfunction ahc_aic7890_setupfunction ahc_aic7892_setupfunction ahc_aic7895_setupfunction ahc_aic7895h_setupfunction ahc_aic7896_setupfunction ahc_aic7899_setupfunction ahc_aha29160C_setupfunction ahc_raid_setupfunction ahc_aha394XX_setupfunction ahc_aha398XX_setup
Annotated Snippet
switch (SUBID_9005_TYPE(subdevice)) {
case SUBID_9005_TYPE_MB:
break;
case SUBID_9005_TYPE_CARD:
case SUBID_9005_TYPE_LCCARD:
/*
* Currently only trust Adaptec cards to
* get the sub device info correct.
*/
if (DEVID_9005_TYPE(device) == DEVID_9005_TYPE_HBA)
result = 1;
break;
case SUBID_9005_TYPE_RAID:
break;
default:
break;
}
}
return (result);
}
const struct ahc_pci_identity *
ahc_find_pci_device(ahc_dev_softc_t pci)
{
uint64_t full_id;
uint16_t device;
uint16_t vendor;
uint16_t subdevice;
uint16_t subvendor;
const struct ahc_pci_identity *entry;
u_int i;
vendor = ahc_pci_read_config(pci, PCIR_DEVVENDOR, /*bytes*/2);
device = ahc_pci_read_config(pci, PCIR_DEVICE, /*bytes*/2);
subvendor = ahc_pci_read_config(pci, PCI_SUBSYSTEM_VENDOR_ID, /*bytes*/2);
subdevice = ahc_pci_read_config(pci, PCI_SUBSYSTEM_ID, /*bytes*/2);
full_id = ahc_compose_id(device, vendor, subdevice, subvendor);
/*
* If the second function is not hooked up, ignore it.
* Unfortunately, not all MB vendors implement the
* subdevice ID as per the Adaptec spec, so do our best
* to sanity check it prior to accepting the subdevice
* ID as valid.
*/
if (ahc_get_pci_function(pci) > 0
&& ahc_9005_subdevinfo_valid(device, vendor, subdevice, subvendor)
&& SUBID_9005_MFUNCENB(subdevice) == 0)
return (NULL);
for (i = 0; i < ahc_num_pci_devs; i++) {
entry = &ahc_pci_ident_table[i];
if (entry->full_id == (full_id & entry->id_mask)) {
/* Honor exclusion entries. */
if (entry->name == NULL)
return (NULL);
return (entry);
}
}
return (NULL);
}
int
ahc_pci_config(struct ahc_softc *ahc, const struct ahc_pci_identity *entry)
{
u_int command;
u_int our_id;
u_int sxfrctl1;
u_int scsiseq;
u_int dscommand0;
uint32_t devconfig;
int error;
uint8_t sblkctl;
our_id = 0;
error = entry->setup(ahc);
if (error != 0)
return (error);
ahc->chip |= AHC_PCI;
ahc->description = entry->name;
pci_set_power_state(ahc->dev_softc, AHC_POWER_STATE_D0);
error = ahc_pci_map_registers(ahc);
if (error != 0)
return (error);
/*
* Before we continue probing the card, ensure that
* its interrupts are *disabled*. We don't want
Annotation
- Immediate include surface: `aic7xxx_osm.h`, `aic7xxx_inline.h`, `aic7xxx_93cx6.h`, `aic7xxx_pci.h`.
- Detected declarations: `function ahc_compose_id`, `function ahc_9005_subdevinfo_valid`, `function ahc_find_pci_device`, `function ahc_pci_config`, `function bus`, `function ahc_ext_scbram_present`, `function ahc_scbram_config`, `function ahc_probe_ext_scbram`, `function ahc_pci_test_register_access`, `function check_extport`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source 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.