drivers/i2c/busses/i2c-piix4.c
Source file repositories/reference/linux-study-clean/drivers/i2c/busses/i2c-piix4.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/i2c/busses/i2c-piix4.c- Extension
.c- Size
- 31701 bytes
- Lines
- 1159
- Domain
- Driver Families
- Bucket
- drivers/i2c
- 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/moduleparam.hlinux/pci.hlinux/kernel.hlinux/delay.hlinux/stddef.hlinux/ioport.hlinux/i2c.hlinux/i2c-smbus.hlinux/slab.hlinux/dmi.hlinux/acpi.hlinux/io.hlinux/platform_data/x86/amd-fch.hi2c-piix4.h
Detected Declarations
struct i2c_piix4_adapdatafunction piix4_sb800_region_requestfunction piix4_sb800_region_releasefunction piix4_sb800_use_mmiofunction piix4_setupfunction piix4_setup_sb800_smbafunction piix4_setup_sb800function piix4_setup_auxfunction piix4_transactionfunction piix4_accessfunction piix4_imc_readfunction piix4_imc_writefunction piix4_imc_sleepfunction piix4_imc_wakeupfunction piix4_sb800_port_selfunction piix4_access_sb800function IMCfunction piix4_funcfunction piix4_add_adapterfunction piix4_add_adapters_sb800function piix4_probefunction piix4_adap_removefunction piix4_remove
Annotated Snippet
static struct pci_driver piix4_driver;
static const struct dmi_system_id piix4_dmi_blacklist[] = {
{
.ident = "Sapphire AM2RD790",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "SAPPHIRE Inc."),
DMI_MATCH(DMI_BOARD_NAME, "PC-AM2RD790"),
},
},
{
.ident = "DFI Lanparty UT 790FX",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "DFI Inc."),
DMI_MATCH(DMI_BOARD_NAME, "LP UT 790FX"),
},
},
{ }
};
/* The IBM entry is in a separate table because we only check it
on Intel-based systems */
static const struct dmi_system_id piix4_dmi_ibm[] = {
{
.ident = "IBM",
.matches = { DMI_MATCH(DMI_SYS_VENDOR, "IBM"), },
},
{ }
};
/*
* SB800 globals
*/
static u8 piix4_port_sel_sb800;
static u8 piix4_port_mask_sb800;
static u8 piix4_port_shift_sb800;
static const char *piix4_main_port_names_sb800[PIIX4_MAX_ADAPTERS] = {
" port 0", " port 2", " port 3", " port 4"
};
static const char *piix4_aux_port_name_sb800 = " port 1";
struct i2c_piix4_adapdata {
unsigned short smba;
/* SB800 */
bool sb800_main;
bool notify_imc;
u8 port; /* Port number, shifted */
struct sb800_mmio_cfg mmio_cfg;
};
int piix4_sb800_region_request(struct device *dev, struct sb800_mmio_cfg *mmio_cfg)
{
if (mmio_cfg->use_mmio) {
void __iomem *addr;
if (!request_mem_region_muxed(FCH_PM_BASE,
SB800_PIIX4_FCH_PM_SIZE,
"sb800_piix4_smb")) {
dev_err(dev,
"SMBus base address memory region 0x%x already in use.\n",
FCH_PM_BASE);
return -EBUSY;
}
addr = ioremap(FCH_PM_BASE,
SB800_PIIX4_FCH_PM_SIZE);
if (!addr) {
release_mem_region(FCH_PM_BASE,
SB800_PIIX4_FCH_PM_SIZE);
dev_err(dev, "SMBus base address mapping failed.\n");
return -ENOMEM;
}
mmio_cfg->addr = addr;
return 0;
}
if (!request_muxed_region(SB800_PIIX4_SMB_IDX, SB800_PIIX4_SMB_MAP_SIZE,
"sb800_piix4_smb")) {
dev_err(dev,
"SMBus base address index region 0x%x already in use.\n",
SB800_PIIX4_SMB_IDX);
return -EBUSY;
}
return 0;
}
EXPORT_SYMBOL_NS_GPL(piix4_sb800_region_request, "PIIX4_SMBUS");
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/pci.h`, `linux/kernel.h`, `linux/delay.h`, `linux/stddef.h`, `linux/ioport.h`, `linux/i2c.h`.
- Detected declarations: `struct i2c_piix4_adapdata`, `function piix4_sb800_region_request`, `function piix4_sb800_region_release`, `function piix4_sb800_use_mmio`, `function piix4_setup`, `function piix4_setup_sb800_smba`, `function piix4_setup_sb800`, `function piix4_setup_aux`, `function piix4_transaction`, `function piix4_access`.
- Atlas domain: Driver Families / drivers/i2c.
- 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.