drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
Extension
.c
Size
96183 bytes
Lines
2895
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct atom_smc_dpm_info_table_13_0_7 {
	struct atom_common_table_header table_header;
	BoardTable_t BoardTable;
};
#endif

static int smu_v13_0_7_append_powerplay_table(struct smu_context *smu)
{
	struct smu_table_context *table_context = &smu->smu_table;

	PPTable_t *smc_pptable = table_context->driver_pptable;

	struct atom_smc_dpm_info_table_13_0_7 *smc_dpm_table;

	BoardTable_t *BoardTable = &smc_pptable->BoardTable;

	int index, ret;

	index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
	smc_dpm_info);

	ret = amdgpu_atombios_get_data_table(smu->adev, index, NULL, NULL, NULL,
			(uint8_t **)&smc_dpm_table);
	if (ret)
		return ret;

	memcpy(BoardTable, &smc_dpm_table->BoardTable, sizeof(BoardTable_t));

	return 0;
}

static int smu_v13_0_7_get_pptable_from_pmfw(struct smu_context *smu,
					     void **table,
					     uint32_t *size)
{
	struct smu_table_context *smu_table = &smu->smu_table;
	void *combo_pptable = smu_table->combo_pptable;
	int ret = 0;

	ret = smu_cmn_get_combo_pptable(smu);
	if (ret)
		return ret;

	*table = combo_pptable;
	*size = sizeof(struct smu_13_0_7_powerplay_table);

	return 0;
}

static int smu_v13_0_7_setup_pptable(struct smu_context *smu)
{
	struct smu_table_context *smu_table = &smu->smu_table;
	struct amdgpu_device *adev = smu->adev;
	int ret = 0;

	/*
	 * With SCPM enabled, the pptable used will be signed. It cannot
	 * be used directly by driver. To get the raw pptable, we need to
	 * rely on the combo pptable(and its revelant SMU message).
	 */
	ret = smu_v13_0_7_get_pptable_from_pmfw(smu,
						&smu_table->power_play_table,
						&smu_table->power_play_table_size);
	if (ret)
		return ret;

	ret = smu_v13_0_7_store_powerplay_table(smu);
	if (ret)
		return ret;

	/*
	 * With SCPM enabled, the operation below will be handled
	 * by PSP. Driver involvment is unnecessary and useless.
	 */
	if (!adev->scpm_enabled) {
		ret = smu_v13_0_7_append_powerplay_table(smu);
		if (ret)
			return ret;
	}

	ret = smu_v13_0_7_check_powerplay_table(smu);
	if (ret)
		return ret;

	return ret;
}

static int smu_v13_0_7_tables_init(struct smu_context *smu)
{
	struct smu_table_context *smu_table = &smu->smu_table;

Annotation

Implementation Notes