drivers/gpu/drm/radeon/atom.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/atom.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/atom.c- Extension
.c- Size
- 35992 bytes
- Lines
- 1440
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/sched.hlinux/slab.hlinux/string_helpers.hlinux/unaligned.hdrm/drm_device.hdrm/drm_util.hatom.hatom-names.hatom-bits.hradeon.h
Detected Declarations
function debug_print_spacesfunction atom_iio_executefunction atom_get_src_intfunction atom_skip_src_intfunction atom_get_srcfunction atom_get_src_directfunction atom_get_dstfunction atom_skip_dstfunction atom_put_dstfunction atom_op_addfunction atom_op_andfunction atom_op_beepfunction atom_op_calltablefunction atom_op_clearfunction atom_op_comparefunction atom_op_delayfunction atom_op_divfunction atom_op_eotfunction atom_op_maskfunction atom_op_movefunction atom_op_mulfunction atom_op_nopfunction atom_op_postcardfunction atom_op_repeatfunction atom_op_restoreregfunction atom_op_saveregfunction atom_op_setdatablockfunction atom_op_setfbbasefunction atom_op_setportfunction atom_op_setregblockfunction atom_op_shift_leftfunction atom_op_shift_rightfunction atom_op_shlfunction atom_op_shrfunction atom_op_subfunction atom_op_switchfunction atom_op_testfunction atom_op_xorfunction atom_op_debugfunction atom_execute_table_lockedfunction atom_execute_table_scratch_unlockedfunction atom_execute_tablefunction atom_index_iiofunction strlenfunction strlenfunction atom_asic_initfunction atom_destroyfunction atom_parse_data_header
Annotated Snippet
switch (CU8(base)) {
case ATOM_IIO_NOP:
base++;
break;
case ATOM_IIO_READ:
temp = ctx->card->ioreg_read(ctx->card, CU16(base + 1));
base += 3;
break;
case ATOM_IIO_WRITE:
if (rdev->family == CHIP_RV515)
(void)ctx->card->ioreg_read(ctx->card, CU16(base + 1));
ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp);
base += 3;
break;
case ATOM_IIO_CLEAR:
temp &=
~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
CU8(base + 2));
base += 3;
break;
case ATOM_IIO_SET:
temp |=
(0xFFFFFFFF >> (32 - CU8(base + 1))) << CU8(base +
2);
base += 3;
break;
case ATOM_IIO_MOVE_INDEX:
temp &=
~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
CU8(base + 3));
temp |=
((index >> CU8(base + 2)) &
(0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base +
3);
base += 4;
break;
case ATOM_IIO_MOVE_DATA:
temp &=
~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
CU8(base + 3));
temp |=
((data >> CU8(base + 2)) &
(0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base +
3);
base += 4;
break;
case ATOM_IIO_MOVE_ATTR:
temp &=
~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
CU8(base + 3));
temp |=
((ctx->io_attr >> CU8(base + 2)) &
(0xFFFFFFFF >> (32 - CU8(base + 1)))) <<
CU8(base + 3);
base += 4;
break;
case ATOM_IIO_END:
return temp;
default:
pr_info("Unknown IIO opcode\n");
return 0;
}
}
static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr,
int *ptr, uint32_t *saved, int print)
{
uint32_t idx, val = 0xCDCDCDCD, align, arg;
struct atom_context *gctx = ctx->ctx;
arg = attr & 7;
align = (attr >> 3) & 7;
switch (arg) {
case ATOM_ARG_REG:
idx = U16(*ptr);
(*ptr) += 2;
if (print)
DEBUG("REG[0x%04X]", idx);
idx += gctx->reg_block;
switch (gctx->io_mode) {
case ATOM_IO_MM:
val = gctx->card->reg_read(gctx->card, idx);
break;
case ATOM_IO_PCI:
pr_info("PCI registers are not implemented\n");
return 0;
case ATOM_IO_SYSIO:
pr_info("SYSIO registers are not implemented\n");
return 0;
default:
if (!(gctx->io_mode & 0x80)) {
Annotation
- Immediate include surface: `linux/module.h`, `linux/sched.h`, `linux/slab.h`, `linux/string_helpers.h`, `linux/unaligned.h`, `drm/drm_device.h`, `drm/drm_util.h`, `atom.h`.
- Detected declarations: `function debug_print_spaces`, `function atom_iio_execute`, `function atom_get_src_int`, `function atom_skip_src_int`, `function atom_get_src`, `function atom_get_src_direct`, `function atom_get_dst`, `function atom_skip_dst`, `function atom_put_dst`, `function atom_op_add`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.