drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c- Extension
.c- Size
- 60707 bytes
- Lines
- 1964
- 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
drm/amdgpu_drm.hamdgpu.hamdgpu_atombios.hamdgpu_atomfirmware.hamdgpu_i2c.hamdgpu_display.hatom.hatom-bits.hatombios_encoders.hbif/bif_4_1_d.h
Detected Declarations
function amdgpu_atombios_gpio_i2c_num_entriesfunction amdgpu_atombios_get_bus_rec_for_i2c_gpiofunction amdgpu_atombios_lookup_i2c_gpiofunction amdgpu_atombios_i2c_initfunction amdgpu_atombios_oem_i2c_initfunction amdgpu_atombios_lookup_gpiofunction amdgpu_atombios_get_hpd_info_from_gpiofunction amdgpu_atombios_has_dce_engine_infofunction amdgpu_atombios_get_connector_info_from_object_tablefunction amdgpu_atombios_get_clock_infofunction amdgpu_atombios_get_gfx_infofunction amdgpu_atombios_get_vram_widthfunction amdgpu_atombios_get_igp_ss_overridesfunction amdgpu_atombios_get_asic_ss_infofunction amdgpu_atombios_get_clock_dividersfunction amdgpu_atombios_get_memory_pll_dividersfunction amdgpu_atombios_set_engine_dram_timingsfunction amdgpu_atombios_get_default_voltagesfunction amdgpu_atombios_get_max_vddcfunction amdgpu_atombios_get_leakage_vddc_based_on_leakage_idxfunction amdgpu_atombios_get_svi2_infofunction amdgpu_atombios_is_voltage_gpiofunction amdgpu_atombios_get_voltage_tablefunction amdgpu_atombios_init_mc_reg_tablefunction amdgpu_atombios_has_gpu_virtualization_tablefunction amdgpu_atombios_scratch_regs_lockfunction amdgpu_atombios_scratch_regs_initfunction amdgpu_atombios_scratch_regs_engine_hungfunction amdgpu_atombios_scratch_regs_set_backlight_levelfunction amdgpu_atombios_scratch_need_asic_initfunction ALIGNfunction amdgpu_atombios_allocate_fb_scratchfunction actionsfunction interpreterfunction interpreterfunction interpreterfunction amdgpu_atombios_get_vbios_versionfunction amdgpu_atombios_get_vbios_buildfunction amdgpu_vbios_version_attrs_is_visiblefunction amdgpu_atombios_sysfs_initfunction interpreterfunction interpreterfunction amdgpu_atombios_get_data_table
Annotated Snippet
if (gpio->sucI2cId.ucAccess == id) {
i2c = amdgpu_atombios_get_bus_rec_for_i2c_gpio(gpio);
break;
}
gpio = (ATOM_GPIO_I2C_ASSIGMENT *)
((u8 *)gpio + sizeof(ATOM_GPIO_I2C_ASSIGMENT));
}
}
return i2c;
}
void amdgpu_atombios_i2c_init(struct amdgpu_device *adev)
{
struct atom_context *ctx = adev->mode_info.atom_context;
ATOM_GPIO_I2C_ASSIGMENT *gpio;
struct amdgpu_i2c_bus_rec i2c;
int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info);
struct _ATOM_GPIO_I2C_INFO *i2c_info;
uint16_t data_offset, size;
int i, num_indices;
char stmp[32];
if (amdgpu_atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) {
i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset);
num_indices = amdgpu_atombios_gpio_i2c_num_entries(size);
gpio = &i2c_info->asGPIO_Info[0];
for (i = 0; i < num_indices; i++) {
i2c = amdgpu_atombios_get_bus_rec_for_i2c_gpio(gpio);
if (i2c.valid) {
sprintf(stmp, "0x%x", i2c.i2c_id);
adev->i2c_bus[i] = amdgpu_i2c_create(adev_to_drm(adev), &i2c, stmp);
}
gpio = (ATOM_GPIO_I2C_ASSIGMENT *)
((u8 *)gpio + sizeof(ATOM_GPIO_I2C_ASSIGMENT));
}
}
}
void amdgpu_atombios_oem_i2c_init(struct amdgpu_device *adev, u8 i2c_id)
{
struct atom_context *ctx = adev->mode_info.atom_context;
ATOM_GPIO_I2C_ASSIGMENT *gpio;
struct amdgpu_i2c_bus_rec i2c;
int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info);
struct _ATOM_GPIO_I2C_INFO *i2c_info;
uint16_t data_offset, size;
int i, num_indices;
char stmp[32];
if (amdgpu_atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) {
i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset);
num_indices = amdgpu_atombios_gpio_i2c_num_entries(size);
gpio = &i2c_info->asGPIO_Info[0];
for (i = 0; i < num_indices; i++) {
i2c = amdgpu_atombios_get_bus_rec_for_i2c_gpio(gpio);
if (i2c.valid && i2c.i2c_id == i2c_id) {
sprintf(stmp, "OEM 0x%x", i2c.i2c_id);
adev->i2c_bus[i] = amdgpu_i2c_create(adev_to_drm(adev), &i2c, stmp);
break;
}
gpio = (ATOM_GPIO_I2C_ASSIGMENT *)
((u8 *)gpio + sizeof(ATOM_GPIO_I2C_ASSIGMENT));
}
}
}
struct amdgpu_gpio_rec
amdgpu_atombios_lookup_gpio(struct amdgpu_device *adev,
u8 id)
{
struct atom_context *ctx = adev->mode_info.atom_context;
struct amdgpu_gpio_rec gpio;
int index = GetIndexIntoMasterTable(DATA, GPIO_Pin_LUT);
struct _ATOM_GPIO_PIN_LUT *gpio_info;
ATOM_GPIO_PIN_ASSIGNMENT *pin;
u16 data_offset, size;
int i, num_indices;
memset(&gpio, 0, sizeof(struct amdgpu_gpio_rec));
gpio.valid = false;
if (amdgpu_atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) {
gpio_info = (struct _ATOM_GPIO_PIN_LUT *)(ctx->bios + data_offset);
Annotation
- Immediate include surface: `drm/amdgpu_drm.h`, `amdgpu.h`, `amdgpu_atombios.h`, `amdgpu_atomfirmware.h`, `amdgpu_i2c.h`, `amdgpu_display.h`, `atom.h`, `atom-bits.h`.
- Detected declarations: `function amdgpu_atombios_gpio_i2c_num_entries`, `function amdgpu_atombios_get_bus_rec_for_i2c_gpio`, `function amdgpu_atombios_lookup_i2c_gpio`, `function amdgpu_atombios_i2c_init`, `function amdgpu_atombios_oem_i2c_init`, `function amdgpu_atombios_lookup_gpio`, `function amdgpu_atombios_get_hpd_info_from_gpio`, `function amdgpu_atombios_has_dce_engine_info`, `function amdgpu_atombios_get_connector_info_from_object_table`, `function amdgpu_atombios_get_clock_info`.
- 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.