drivers/gpu/drm/i915/display/intel_rom.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_rom.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/intel_rom.c- Extension
.c- Size
- 3235 bytes
- Lines
- 164
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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/pci.hdrm/drm_device.hintel_de.hintel_display_types.hintel_rom.hintel_oprom_regs.h
Detected Declarations
struct intel_romfunction spi_read32function spi_read16function pci_read32function pci_read16function pci_read_blockfunction pci_freefunction intel_rom_read32function intel_rom_read16function intel_rom_read_blockfunction intel_rom_findfunction intel_rom_sizefunction intel_rom_free
Annotated Snippet
struct intel_rom {
/* for PCI ROM */
struct pci_dev *pdev;
void __iomem *oprom;
/* for SPI */
struct intel_display *display;
loff_t offset;
size_t size;
u32 (*read32)(struct intel_rom *rom, loff_t offset);
u16 (*read16)(struct intel_rom *rom, loff_t offset);
void (*read_block)(struct intel_rom *rom, void *data, loff_t offset, size_t size);
void (*free)(struct intel_rom *rom);
};
static u32 spi_read32(struct intel_rom *rom, loff_t offset)
{
intel_de_write(rom->display, PRIMARY_SPI_ADDRESS,
rom->offset + offset);
return intel_de_read(rom->display, PRIMARY_SPI_TRIGGER);
}
static u16 spi_read16(struct intel_rom *rom, loff_t offset)
{
return spi_read32(rom, offset) & 0xffff;
}
struct intel_rom *intel_rom_spi(struct drm_device *drm)
{
struct intel_rom *rom;
u32 static_region;
rom = kzalloc_obj(*rom);
if (!rom)
return NULL;
rom->display = to_intel_display(drm);
static_region = intel_de_read(rom->display, SPI_STATIC_REGIONS);
static_region &= OPTIONROM_SPI_REGIONID_MASK;
intel_de_write(rom->display, PRIMARY_SPI_REGIONID, static_region);
rom->offset = intel_de_read(rom->display, OROM_OFFSET) & OROM_OFFSET_MASK;
rom->size = 0x200000;
rom->read32 = spi_read32;
rom->read16 = spi_read16;
return rom;
}
static u32 pci_read32(struct intel_rom *rom, loff_t offset)
{
return ioread32(rom->oprom + offset);
}
static u16 pci_read16(struct intel_rom *rom, loff_t offset)
{
return ioread16(rom->oprom + offset);
}
static void pci_read_block(struct intel_rom *rom, void *data,
loff_t offset, size_t size)
{
memcpy_fromio(data, rom->oprom + offset, size);
}
static void pci_free(struct intel_rom *rom)
{
pci_unmap_rom(rom->pdev, rom->oprom);
}
struct intel_rom *intel_rom_pci(struct drm_device *drm)
{
struct intel_rom *rom;
rom = kzalloc_obj(*rom);
if (!rom)
return NULL;
rom->pdev = to_pci_dev(drm->dev);
rom->oprom = pci_map_rom(rom->pdev, &rom->size);
if (!rom->oprom) {
kfree(rom);
return NULL;
Annotation
- Immediate include surface: `linux/pci.h`, `drm/drm_device.h`, `intel_de.h`, `intel_display_types.h`, `intel_rom.h`, `intel_oprom_regs.h`.
- Detected declarations: `struct intel_rom`, `function spi_read32`, `function spi_read16`, `function pci_read32`, `function pci_read16`, `function pci_read_block`, `function pci_free`, `function intel_rom_read32`, `function intel_rom_read16`, `function intel_rom_read_block`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.