drivers/gpu/drm/amd/amdgpu/smuio_v13_0_3.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/smuio_v13_0_3.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/amdgpu/smuio_v13_0_3.c
Extension
.c
Size
2957 bytes
Lines
110
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

#include "amdgpu.h"
#include "smuio_v13_0_3.h"
#include "soc15_common.h"
#include "smuio/smuio_13_0_3_offset.h"
#include "smuio/smuio_13_0_3_sh_mask.h"

#define PKG_TYPE_MASK		0x00000003L

/**
 * smuio_v13_0_3_get_die_id - query die id from FCH.
 *
 * @adev: amdgpu device pointer
 *
 * Returns die id
 */
static u32 smuio_v13_0_3_get_die_id(struct amdgpu_device *adev)
{
	u32 data, die_id;

	data = RREG32_SOC15(SMUIO, 0, regSMUIO_MCM_CONFIG);
	die_id = REG_GET_FIELD(data, SMUIO_MCM_CONFIG, DIE_ID);

	return die_id;
}

/**
 * smuio_v13_0_3_get_socket_id - query socket id from FCH
 *
 * @adev: amdgpu device pointer
 *
 * Returns socket id
 */
static u32 smuio_v13_0_3_get_socket_id(struct amdgpu_device *adev)
{
	u32 data, socket_id;

	data = RREG32_SOC15(SMUIO, 0, regSMUIO_MCM_CONFIG);
	socket_id = REG_GET_FIELD(data, SMUIO_MCM_CONFIG, SOCKET_ID);

	return socket_id;
}

/**
 * smuio_v13_0_3_get_pkg_type - query package type set by MP1/bootcode
 *
 * @adev: amdgpu device pointer
 *
 * Returns package type
 */

static enum amdgpu_pkg_type smuio_v13_0_3_get_pkg_type(struct amdgpu_device *adev)
{
	enum amdgpu_pkg_type pkg_type;
	u32 data;

	data = RREG32_SOC15(SMUIO, 0, regSMUIO_MCM_CONFIG);
	data = REG_GET_FIELD(data, SMUIO_MCM_CONFIG, PKG_TYPE);
	/* pkg_type[4:0]
	 *
	 * bit 1 == 1 APU form factor
	 *
	 * b0100 - b1111 - Reserved
	 */
	switch (data & PKG_TYPE_MASK) {
	case 0x0:
		pkg_type = AMDGPU_PKG_TYPE_CEM;
		break;
	case 0x1:
		pkg_type = AMDGPU_PKG_TYPE_OAM;
		break;
	case 0x2:
		pkg_type = AMDGPU_PKG_TYPE_APU;
		break;
	default:
		pkg_type = AMDGPU_PKG_TYPE_UNKNOWN;
		break;
	}

	return pkg_type;
}


const struct amdgpu_smuio_funcs smuio_v13_0_3_funcs = {
	.get_die_id = smuio_v13_0_3_get_die_id,
	.get_socket_id = smuio_v13_0_3_get_socket_id,
	.get_pkg_type = smuio_v13_0_3_get_pkg_type,
};

Annotation

Implementation Notes