drivers/pnp/pnpbios/rsparser.c
Source file repositories/reference/linux-study-clean/drivers/pnp/pnpbios/rsparser.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pnp/pnpbios/rsparser.c- Extension
.c- Size
- 17094 bytes
- Lines
- 811
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ctype.hlinux/pnp.hlinux/string.hlinux/pci.h../base.hpnpbios.h
Detected Declarations
function pcibios_penalize_isa_irqfunction pnpbios_parse_allocated_memresourcefunction pnpbios_parse_mem_optionfunction pnpbios_parse_mem32_optionfunction pnpbios_parse_fixed_mem32_optionfunction pnpbios_parse_irq_optionfunction pnpbios_parse_dma_optionfunction pnpbios_parse_port_optionfunction pnpbios_parse_fixed_port_optionfunction pnpbios_parse_resource_option_datafunction pnpbios_encode_memfunction pnpbios_encode_mem32function pnpbios_encode_fixed_mem32function pnpbios_encode_irqfunction pnpbios_encode_dmafunction pnpbios_encode_portfunction pnpbios_encode_fixed_portfunction pnpbios_parse_data_streamfunction pnpbios_read_resources_from_nodefunction pnpbios_write_resources_to_node
Annotated Snippet
if (p[0] & LARGE_TAG) { /* large tag */
len = (p[2] << 8) | p[1];
tag = p[0];
} else { /* small tag */
len = p[0] & 0x07;
tag = ((p[0] >> 3) & 0x0f);
}
switch (tag) {
case LARGE_TAG_MEM:
if (len != 9)
goto len_err;
io = *(short *)&p[4];
size = *(short *)&p[10];
pnpbios_parse_allocated_memresource(dev, io, size);
break;
case LARGE_TAG_ANSISTR:
/* ignore this for now */
break;
case LARGE_TAG_VENDOR:
/* do nothing */
break;
case LARGE_TAG_MEM32:
if (len != 17)
goto len_err;
io = *(int *)&p[4];
size = *(int *)&p[16];
pnpbios_parse_allocated_memresource(dev, io, size);
break;
case LARGE_TAG_FIXEDMEM32:
if (len != 9)
goto len_err;
io = *(int *)&p[4];
size = *(int *)&p[8];
pnpbios_parse_allocated_memresource(dev, io, size);
break;
case SMALL_TAG_IRQ:
if (len < 2 || len > 3)
goto len_err;
flags = 0;
io = -1;
mask = p[1] + p[2] * 256;
for (i = 0; i < 16; i++, mask = mask >> 1)
if (mask & 0x01)
io = i;
if (io != -1)
pcibios_penalize_isa_irq(io, 1);
else
flags = IORESOURCE_DISABLED;
pnp_add_irq_resource(dev, io, flags);
break;
case SMALL_TAG_DMA:
if (len != 2)
goto len_err;
flags = 0;
io = -1;
mask = p[1];
for (i = 0; i < 8; i++, mask = mask >> 1)
if (mask & 0x01)
io = i;
if (io == -1)
flags = IORESOURCE_DISABLED;
pnp_add_dma_resource(dev, io, flags);
break;
case SMALL_TAG_PORT:
if (len != 7)
goto len_err;
io = p[2] + p[3] * 256;
size = p[7];
pnpbios_parse_allocated_ioresource(dev, io, size);
break;
case SMALL_TAG_VENDOR:
/* do nothing */
break;
case SMALL_TAG_FIXEDPORT:
if (len != 3)
goto len_err;
io = p[1] + p[2] * 256;
size = p[3];
pnpbios_parse_allocated_ioresource(dev, io, size);
Annotation
- Immediate include surface: `linux/ctype.h`, `linux/pnp.h`, `linux/string.h`, `linux/pci.h`, `../base.h`, `pnpbios.h`.
- Detected declarations: `function pcibios_penalize_isa_irq`, `function pnpbios_parse_allocated_memresource`, `function pnpbios_parse_mem_option`, `function pnpbios_parse_mem32_option`, `function pnpbios_parse_fixed_mem32_option`, `function pnpbios_parse_irq_option`, `function pnpbios_parse_dma_option`, `function pnpbios_parse_port_option`, `function pnpbios_parse_fixed_port_option`, `function pnpbios_parse_resource_option_data`.
- 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.