drivers/video/fbdev/imsttfb.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/imsttfb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/imsttfb.c- Extension
.c- Size
- 44928 bytes
- Lines
- 1651
- Domain
- Driver Families
- Bucket
- drivers/video
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/aperture.hlinux/module.hlinux/kernel.hlinux/errno.hlinux/string.hlinux/mm.hlinux/vmalloc.hlinux/delay.hlinux/interrupt.hlinux/fb.hlinux/init.hlinux/pci.hasm/io.hlinux/uaccess.hlinux/nvram.hmacmodes.h
Detected Declarations
struct initvaluesstruct imstt_regvalsstruct imstt_parfunction read_reg_le32function write_reg_le32function getclkMHzfunction setclkMHzfunction compute_imstt_regvals_ibmfunction compute_imstt_regvals_tvpfunction compute_imstt_regvalsfunction set_imstt_regvals_ibmfunction set_imstt_regvals_tvpfunction set_imstt_regvalsfunction Ifunction set_offsetfunction set_555function set_565function imsttfb_check_varfunction imsttfb_set_parfunction imsttfb_setcolregfunction imsttfb_pan_displayfunction imsttfb_blankfunction imsttfb_fillrectfunction imsttfb_copyareafunction imsttfb_load_cursor_imagefunction imstt_set_cursorfunction imsttfb_cursorfunction imsttfb_ioctlfunction init_imsttfunction imsttfb_probefunction imsttfb_removefunction imsttfb_setupfunction imsttfb_initfunction imsttfb_exitmodule init imsttfb_init
Annotated Snippet
static struct pci_driver imsttfb_pci_driver = {
.name = "imsttfb",
.id_table = imsttfb_pci_tbl,
.probe = imsttfb_probe,
.remove = imsttfb_remove,
};
static const struct fb_ops imsttfb_ops = {
.owner = THIS_MODULE,
__FB_DEFAULT_IOMEM_OPS_RDWR,
.fb_check_var = imsttfb_check_var,
.fb_set_par = imsttfb_set_par,
.fb_setcolreg = imsttfb_setcolreg,
.fb_pan_display = imsttfb_pan_display,
.fb_blank = imsttfb_blank,
.fb_fillrect = imsttfb_fillrect,
.fb_copyarea = imsttfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_ioctl = imsttfb_ioctl,
__FB_DEFAULT_IOMEM_OPS_MMAP,
};
static int init_imstt(struct fb_info *info)
{
struct imstt_par *par = info->par;
__u32 i, tmp, *ip, *end;
tmp = read_reg_le32(par->dc_regs, PRC);
if (par->ramdac == IBM)
info->fix.smem_len = (tmp & 0x0004) ? 0x400000 : 0x200000;
else
info->fix.smem_len = 0x800000;
ip = (__u32 *)info->screen_base;
end = (__u32 *)(info->screen_base + info->fix.smem_len);
while (ip < end)
*ip++ = 0;
/* initialize the card */
tmp = read_reg_le32(par->dc_regs, STGCTL);
write_reg_le32(par->dc_regs, STGCTL, tmp & ~0x1);
write_reg_le32(par->dc_regs, SSR, 0);
/* set default values for DAC registers */
if (par->ramdac == IBM) {
par->cmap_regs[PPMASK] = 0xff;
eieio();
par->cmap_regs[PIDXHI] = 0;
eieio();
for (i = 0; i < ARRAY_SIZE(ibm_initregs); i++) {
par->cmap_regs[PIDXLO] = ibm_initregs[i].addr;
eieio();
par->cmap_regs[PIDXDATA] = ibm_initregs[i].value;
eieio();
}
} else {
for (i = 0; i < ARRAY_SIZE(tvp_initregs); i++) {
par->cmap_regs[TVPADDRW] = tvp_initregs[i].addr;
eieio();
par->cmap_regs[TVPIDATA] = tvp_initregs[i].value;
eieio();
}
}
#if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32)
if (IS_REACHABLE(CONFIG_NVRAM) && machine_is(powermac)) {
int vmode = init_vmode, cmode = init_cmode;
if (vmode == -1) {
vmode = nvram_read_byte(NV_VMODE);
if (vmode <= 0 || vmode > VMODE_MAX)
vmode = VMODE_640_480_67;
}
if (cmode == -1) {
cmode = nvram_read_byte(NV_CMODE);
if (cmode < CMODE_8 || cmode > CMODE_32)
cmode = CMODE_8;
}
if (mac_vmode_to_var(vmode, cmode, &info->var)) {
info->var.xres = info->var.xres_virtual = INIT_XRES;
info->var.yres = info->var.yres_virtual = INIT_YRES;
info->var.bits_per_pixel = INIT_BPP;
}
} else
#endif
{
info->var.xres = info->var.xres_virtual = INIT_XRES;
info->var.yres = info->var.yres_virtual = INIT_YRES;
info->var.bits_per_pixel = INIT_BPP;
}
Annotation
- Immediate include surface: `linux/aperture.h`, `linux/module.h`, `linux/kernel.h`, `linux/errno.h`, `linux/string.h`, `linux/mm.h`, `linux/vmalloc.h`, `linux/delay.h`.
- Detected declarations: `struct initvalues`, `struct imstt_regvals`, `struct imstt_par`, `function read_reg_le32`, `function write_reg_le32`, `function getclkMHz`, `function setclkMHz`, `function compute_imstt_regvals_ibm`, `function compute_imstt_regvals_tvp`, `function compute_imstt_regvals`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.