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

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

File Facts

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

if (use_doorbell) {
			doorbell_range = REG_SET_FIELD(doorbell_range,
						       GDC_S2A0_S2A_DOORBELL_ENTRY_6_CTRL,
						       S2A_DOORBELL_PORT6_ENABLE,
						       0x1);
			doorbell_range = REG_SET_FIELD(doorbell_range,
						       GDC_S2A0_S2A_DOORBELL_ENTRY_6_CTRL,
						       S2A_DOORBELL_PORT6_AWID,
						       0xe);
			doorbell_range = REG_SET_FIELD(doorbell_range,
						       GDC_S2A0_S2A_DOORBELL_ENTRY_6_CTRL,
						       S2A_DOORBELL_PORT6_RANGE_OFFSET,
						       doorbell_index);
			doorbell_range = REG_SET_FIELD(doorbell_range,
						       GDC_S2A0_S2A_DOORBELL_ENTRY_6_CTRL,
						       S2A_DOORBELL_PORT6_RANGE_SIZE,
						       doorbell_size);
			doorbell_range = REG_SET_FIELD(doorbell_range,
						       GDC_S2A0_S2A_DOORBELL_ENTRY_6_CTRL,
						       S2A_DOORBELL_PORT6_AWADDR_31_28_VALUE,
						       0xe);
			doorbell_range1 = REG_SET_FIELD(doorbell_range1,
						        GDC_S2A0_S2A_DOORBELL_ENTRY_6_CTRL1,
						        S2A_DOORBELL_PORT6_TARGET_PORT_TYPE,
						        0x3);
			doorbell_range1 = REG_SET_FIELD(doorbell_range1,
						        GDC_S2A0_S2A_DOORBELL_ENTRY_6_CTRL1,
						        S2A_DOORBELL_PORT6_TARGET_DIEID,
						        0x0);
			doorbell_range1 = REG_SET_FIELD(doorbell_range1,
						        GDC_S2A0_S2A_DOORBELL_ENTRY_6_CTRL1,
						        S2A_DOORBELL_PORT6_TARGET_PORT_ID,
						        0x0);
		}

		WREG32_SOC15(NBIO, 0, regGDC_S2A0_S2A_DOORBELL_ENTRY_6_CTRL, doorbell_range);
		WREG32_SOC15(NBIO, 0, regGDC_S2A0_S2A_DOORBELL_ENTRY_6_CTRL1, doorbell_range1);
	}
}

static void nbio_v6_3_2_vcn_doorbell_range(struct amdgpu_device *adev,
					   bool use_doorbell, int doorbell_index,
					   int instance)
{
	u32 doorbell_range = 0;
	u32 doorbell_range1 = 0;

	if (use_doorbell) {
		doorbell_range = REG_SET_FIELD(doorbell_range,
					       GDC_S2A0_S2A_DOORBELL_ENTRY_2_CTRL,
					       S2A_DOORBELL_PORT2_ENABLE,
					       0x1);
		doorbell_range = REG_SET_FIELD(doorbell_range,
					       GDC_S2A0_S2A_DOORBELL_ENTRY_2_CTRL,
					       S2A_DOORBELL_PORT2_AWID,
					       (instance % adev->vcn.num_inst_per_aid) ? 0x7 : 0x4);
		doorbell_range = REG_SET_FIELD(doorbell_range,
					       GDC_S2A0_S2A_DOORBELL_ENTRY_2_CTRL,
					       S2A_DOORBELL_PORT2_RANGE_OFFSET,
					       doorbell_index);
		doorbell_range = REG_SET_FIELD(doorbell_range,
					       GDC_S2A0_S2A_DOORBELL_ENTRY_2_CTRL,
					       S2A_DOORBELL_PORT2_RANGE_SIZE,
					       8);
		doorbell_range = REG_SET_FIELD(doorbell_range,
					       GDC_S2A0_S2A_DOORBELL_ENTRY_2_CTRL,
					       S2A_DOORBELL_PORT2_AWADDR_31_28_VALUE,
					       (instance % adev->vcn.num_inst_per_aid) ? 0x7 : 0x4);
		doorbell_range1 = REG_SET_FIELD(doorbell_range1,
						GDC_S2A0_S2A_DOORBELL_ENTRY_2_CTRL1,
					        S2A_DOORBELL_PORT2_TARGET_PORT_TYPE,
					        0x3);
		doorbell_range1 = REG_SET_FIELD(doorbell_range1,
						GDC_S2A0_S2A_DOORBELL_ENTRY_2_CTRL1,
					        S2A_DOORBELL_PORT2_TARGET_DIEID,
					        (instance / adev->vcn.num_inst_per_aid) ? 0x3 : 0x0);
		doorbell_range1 = REG_SET_FIELD(doorbell_range1,
						GDC_S2A0_S2A_DOORBELL_ENTRY_2_CTRL1,
					        S2A_DOORBELL_PORT2_TARGET_PORT_ID,
					        0x0);
	}

	switch (instance) {
	case 0:
		WREG32_SOC15(NBIO, 0, regGDC_S2A0_S2A_DOORBELL_ENTRY_2_CTRL, doorbell_range);
		WREG32_SOC15(NBIO, 0, regGDC_S2A0_S2A_DOORBELL_ENTRY_2_CTRL1, doorbell_range1);
		break;
	case 1:
		WREG32_SOC15(NBIO, 0, regGDC_S2A0_S2A_DOORBELL_ENTRY_3_CTRL, doorbell_range);
		WREG32_SOC15(NBIO, 0, regGDC_S2A0_S2A_DOORBELL_ENTRY_3_CTRL1, doorbell_range1);

Annotation

Implementation Notes