drivers/gpu/drm/radeon/r300.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/r300.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/r300.c- Extension
.c- Size
- 43379 bytes
- Lines
- 1591
- 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/debugfs.hlinux/pci.hlinux/seq_file.hlinux/slab.hdrm/drm.hdrm/drm_device.hdrm/drm_file.hdrm/radeon_drm.hr100_track.hr300_reg_safe.hr300d.hradeon.hradeon_asic.hradeon_reg.hrv350d.h
Detected Declarations
function filesfunction rv370_pcie_wregfunction rv370_pcie_gart_tlb_flushfunction rv370_pcie_gart_get_page_entryfunction rv370_pcie_gart_set_pagefunction rv370_pcie_gart_initfunction rv370_pcie_gart_enablefunction rv370_pcie_gart_disablefunction rv370_pcie_gart_finifunction r300_fence_ring_emitfunction r300_ring_startfunction r300_erratafunction r300_mc_wait_for_idlefunction r300_gpu_initfunction r300_asic_resetfunction r300_mc_initfunction rv370_set_pcie_lanesfunction rv370_get_pcie_lanesfunction rv370_debugfs_pcie_gart_info_showfunction rv370_debugfs_pcie_gart_info_initfunction r300_packet0_checkfunction r300_packet3_checkfunction r300_cs_parsefunction r300_set_reg_safefunction r300_mc_programfunction r300_clock_startupfunction r300_startupfunction r300_resumefunction r300_suspendfunction r300_finifunction r300_init
Annotated Snippet
if (tmp & R300_MC_IDLE) {
return 0;
}
udelay(1);
}
return -1;
}
/* rs400_gpu_init also calls this! */
void r300_gpu_init(struct radeon_device *rdev)
{
uint32_t gb_tile_config, tmp;
if ((rdev->family == CHIP_R300 && rdev->pdev->device != 0x4144) ||
(rdev->family == CHIP_R350 && rdev->pdev->device != 0x4148)) {
/* r300,r350 */
rdev->num_gb_pipes = 2;
} else {
/* rv350,rv370,rv380,r300 AD, r350 AH */
rdev->num_gb_pipes = 1;
}
rdev->num_z_pipes = 1;
gb_tile_config = (R300_ENABLE_TILING | R300_TILE_SIZE_16);
switch (rdev->num_gb_pipes) {
case 2:
gb_tile_config |= R300_PIPE_COUNT_R300;
break;
case 3:
gb_tile_config |= R300_PIPE_COUNT_R420_3P;
break;
case 4:
gb_tile_config |= R300_PIPE_COUNT_R420;
break;
default:
case 1:
gb_tile_config |= R300_PIPE_COUNT_RV350;
break;
}
WREG32(R300_GB_TILE_CONFIG, gb_tile_config);
if (r100_gui_wait_for_idle(rdev)) {
pr_warn("Failed to wait GUI idle while programming pipes. Bad things might happen.\n");
}
tmp = RREG32(R300_DST_PIPE_CONFIG);
WREG32(R300_DST_PIPE_CONFIG, tmp | R300_PIPE_AUTO_CONFIG);
WREG32(R300_RB2D_DSTCACHE_MODE,
R300_DC_AUTOFLUSH_ENABLE |
R300_DC_DC_DISABLE_IGNORE_PE);
if (r100_gui_wait_for_idle(rdev)) {
pr_warn("Failed to wait GUI idle while programming pipes. Bad things might happen.\n");
}
if (r300_mc_wait_for_idle(rdev)) {
pr_warn("Failed to wait MC idle while programming pipes. Bad things might happen.\n");
}
DRM_INFO("radeon: %d quad pipes, %d Z pipes initialized\n",
rdev->num_gb_pipes, rdev->num_z_pipes);
}
int r300_asic_reset(struct radeon_device *rdev, bool hard)
{
struct r100_mc_save save;
u32 status, tmp;
int ret = 0;
status = RREG32(R_000E40_RBBM_STATUS);
if (!G_000E40_GUI_ACTIVE(status)) {
return 0;
}
r100_mc_stop(rdev, &save);
status = RREG32(R_000E40_RBBM_STATUS);
dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, status);
/* stop CP */
WREG32(RADEON_CP_CSQ_CNTL, 0);
tmp = RREG32(RADEON_CP_RB_CNTL);
WREG32(RADEON_CP_RB_CNTL, tmp | RADEON_RB_RPTR_WR_ENA);
WREG32(RADEON_CP_RB_RPTR_WR, 0);
WREG32(RADEON_CP_RB_WPTR, 0);
WREG32(RADEON_CP_RB_CNTL, tmp);
/* save PCI state */
pci_save_state(rdev->pdev);
/* disable bus mastering */
r100_bm_disable(rdev);
WREG32(R_0000F0_RBBM_SOFT_RESET, S_0000F0_SOFT_RESET_VAP(1) |
S_0000F0_SOFT_RESET_GA(1));
RREG32(R_0000F0_RBBM_SOFT_RESET);
mdelay(500);
WREG32(R_0000F0_RBBM_SOFT_RESET, 0);
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/pci.h`, `linux/seq_file.h`, `linux/slab.h`, `drm/drm.h`, `drm/drm_device.h`, `drm/drm_file.h`, `drm/radeon_drm.h`.
- Detected declarations: `function files`, `function rv370_pcie_wreg`, `function rv370_pcie_gart_tlb_flush`, `function rv370_pcie_gart_get_page_entry`, `function rv370_pcie_gart_set_page`, `function rv370_pcie_gart_init`, `function rv370_pcie_gart_enable`, `function rv370_pcie_gart_disable`, `function rv370_pcie_gart_fini`, `function r300_fence_ring_emit`.
- 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.