drivers/gpu/drm/radeon/rv770_smc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/rv770_smc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/rv770_smc.c- Extension
.c- Size
- 15417 bytes
- Lines
- 620
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hradeon.hrv770d.hrv770_dpm.hrv770_smc.hatom.hradeon_ucode.h
Detected Declarations
function rv770_set_smc_sram_addressfunction rv770_copy_bytes_to_smcfunction rv770_program_interrupt_vectorsfunction rv770_start_smcfunction rv770_reset_smcfunction rv770_stop_smc_clockfunction rv770_start_smc_clockfunction rv770_is_smc_runningfunction rv770_send_msg_to_smcfunction rv770_wait_for_smc_inactivefunction rv770_clear_smc_sramfunction rv770_load_smc_ucodefunction rv770_read_smc_sram_dwordfunction rv770_write_smc_sram_dword
Annotated Snippet
while (byte_count > 0) {
/* SMC address space is BE */
data = (data << 8) + *src++;
byte_count--;
}
data <<= extra_shift;
data |= (original_data & ~((~0UL) << extra_shift));
ret = rv770_set_smc_sram_address(rdev, addr, limit);
if (ret)
goto done;
WREG32(SMC_SRAM_DATA, data);
}
done:
spin_unlock_irqrestore(&rdev->smc_idx_lock, flags);
return ret;
}
static int rv770_program_interrupt_vectors(struct radeon_device *rdev,
u32 smc_first_vector, const u8 *src,
u32 byte_count)
{
u32 tmp, i;
if (byte_count % 4)
return -EINVAL;
if (smc_first_vector < FIRST_SMC_INT_VECT_REG) {
tmp = FIRST_SMC_INT_VECT_REG - smc_first_vector;
if (tmp > byte_count)
return 0;
byte_count -= tmp;
src += tmp;
smc_first_vector = FIRST_SMC_INT_VECT_REG;
}
for (i = 0; i < byte_count; i += 4) {
/* SMC address space is BE */
tmp = (src[i] << 24) | (src[i + 1] << 16) | (src[i + 2] << 8) | src[i + 3];
WREG32(SMC_ISR_FFD8_FFDB + i, tmp);
}
return 0;
}
void rv770_start_smc(struct radeon_device *rdev)
{
WREG32_P(SMC_IO, SMC_RST_N, ~SMC_RST_N);
}
void rv770_reset_smc(struct radeon_device *rdev)
{
WREG32_P(SMC_IO, 0, ~SMC_RST_N);
}
void rv770_stop_smc_clock(struct radeon_device *rdev)
{
WREG32_P(SMC_IO, 0, ~SMC_CLK_EN);
}
void rv770_start_smc_clock(struct radeon_device *rdev)
{
WREG32_P(SMC_IO, SMC_CLK_EN, ~SMC_CLK_EN);
}
bool rv770_is_smc_running(struct radeon_device *rdev)
{
u32 tmp;
tmp = RREG32(SMC_IO);
if ((tmp & SMC_RST_N) && (tmp & SMC_CLK_EN))
return true;
else
return false;
}
PPSMC_Result rv770_send_msg_to_smc(struct radeon_device *rdev, PPSMC_Msg msg)
{
u32 tmp;
int i;
PPSMC_Result result;
Annotation
- Immediate include surface: `linux/firmware.h`, `radeon.h`, `rv770d.h`, `rv770_dpm.h`, `rv770_smc.h`, `atom.h`, `radeon_ucode.h`.
- Detected declarations: `function rv770_set_smc_sram_address`, `function rv770_copy_bytes_to_smc`, `function rv770_program_interrupt_vectors`, `function rv770_start_smc`, `function rv770_reset_smc`, `function rv770_stop_smc_clock`, `function rv770_start_smc_clock`, `function rv770_is_smc_running`, `function rv770_send_msg_to_smc`, `function rv770_wait_for_smc_inactive`.
- 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.