drivers/pnp/quirks.c
Source file repositories/reference/linux-study-clean/drivers/pnp/quirks.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pnp/quirks.c- Extension
.c- Size
- 12190 bytes
- Lines
- 454
- Domain
- Driver Families
- Bucket
- drivers/pnp
- 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.
- 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/types.hlinux/kernel.hlinux/pci.hlinux/string.hlinux/slab.hlinux/pnp.hlinux/io.hbase.hasm/amd/nb.h
Detected Declarations
function Copyrightfunction quirk_awe32_resourcesfunction regionsfunction quirk_cmi8330_resourcesfunction list_for_each_entryfunction quirk_sb16audio_resourcesfunction list_for_each_entryfunction quirk_add_irq_optional_dependent_setsfunction quirk_ad1815_mpu_resourcesfunction list_for_each_entryfunction quirk_system_pci_resourcesfunction pci_dev_for_each_resourcefunction quirk_amd_mmconfig_areafunction list_for_each_entryfunction quirk_intel_mchfunction list_for_each_entryfunction pnp_fixup_device
Annotated Snippet
pnp_option_set(option) != set) {
set = pnp_option_set(option);
quirk_awe32_add_ports(dev, option, 0x800);
quirk_awe32_add_ports(dev, option, 0x400);
}
}
}
static void quirk_cmi8330_resources(struct pnp_dev *dev)
{
struct pnp_option *option;
struct pnp_irq *irq;
struct pnp_dma *dma;
list_for_each_entry(option, &dev->options, list) {
if (!pnp_option_is_dependent(option))
continue;
if (option->type == IORESOURCE_IRQ) {
irq = &option->u.irq;
bitmap_zero(irq->map.bits, PNP_IRQ_NR);
__set_bit(5, irq->map.bits);
__set_bit(7, irq->map.bits);
__set_bit(10, irq->map.bits);
dev_info(&dev->dev, "set possible IRQs in "
"option set %d to 5, 7, 10\n",
pnp_option_set(option));
} else if (option->type == IORESOURCE_DMA) {
dma = &option->u.dma;
if ((dma->flags & IORESOURCE_DMA_TYPE_MASK) ==
IORESOURCE_DMA_8BIT &&
dma->map != 0x0A) {
dev_info(&dev->dev, "changing possible "
"DMA channel mask in option set %d "
"from %#02x to 0x0A (1, 3)\n",
pnp_option_set(option), dma->map);
dma->map = 0x0A;
}
}
}
}
static void quirk_sb16audio_resources(struct pnp_dev *dev)
{
struct pnp_option *option;
unsigned int prev_option_flags = ~0, n = 0;
struct pnp_port *port;
/*
* The default range on the OPL port for these devices is 0x388-0x388.
* Here we increase that range so that two such cards can be
* auto-configured.
*/
list_for_each_entry(option, &dev->options, list) {
if (prev_option_flags != option->flags) {
prev_option_flags = option->flags;
n = 0;
}
if (pnp_option_is_dependent(option) &&
option->type == IORESOURCE_IO) {
n++;
port = &option->u.port;
if (n == 3 && port->min == port->max) {
port->max += 0x70;
dev_info(&dev->dev, "increased option port "
"range from %#llx-%#llx to "
"%#llx-%#llx\n",
(unsigned long long) port->min,
(unsigned long long) port->min,
(unsigned long long) port->min,
(unsigned long long) port->max);
}
}
}
}
static struct pnp_option *pnp_clone_dependent_set(struct pnp_dev *dev,
unsigned int set)
{
struct pnp_option *tail = NULL, *first_new_option = NULL;
struct pnp_option *option, *new_option;
unsigned int flags;
list_for_each_entry(option, &dev->options, list) {
if (pnp_option_is_dependent(option))
tail = option;
}
if (!tail) {
dev_err(&dev->dev, "no dependent option sets\n");
Annotation
- Immediate include surface: `linux/types.h`, `linux/kernel.h`, `linux/pci.h`, `linux/string.h`, `linux/slab.h`, `linux/pnp.h`, `linux/io.h`, `base.h`.
- Detected declarations: `function Copyright`, `function quirk_awe32_resources`, `function regions`, `function quirk_cmi8330_resources`, `function list_for_each_entry`, `function quirk_sb16audio_resources`, `function list_for_each_entry`, `function quirk_add_irq_optional_dependent_sets`, `function quirk_ad1815_mpu_resources`, `function list_for_each_entry`.
- Atlas domain: Driver Families / drivers/pnp.
- 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.