Exemplo n.º 1
0
static int cik_sdma_sw_init(void *handle)
{
    struct amdgpu_ring *ring;
    struct amdgpu_device *adev = (struct amdgpu_device *)handle;
    int r;

    r = cik_sdma_init_microcode(adev);
    if (r) {
        DRM_ERROR("Failed to load sdma firmware!\n");
        return r;
    }

    /* SDMA trap event */
    r = amdgpu_irq_add_id(adev, 224, &adev->sdma_trap_irq);
    if (r)
        return r;

    /* SDMA Privileged inst */
    r = amdgpu_irq_add_id(adev, 241, &adev->sdma_illegal_inst_irq);
    if (r)
        return r;

    /* SDMA Privileged inst */
    r = amdgpu_irq_add_id(adev, 247, &adev->sdma_illegal_inst_irq);
    if (r)
        return r;

    ring = &adev->sdma[0].ring;
    ring->ring_obj = NULL;

    ring = &adev->sdma[1].ring;
    ring->ring_obj = NULL;

    ring = &adev->sdma[0].ring;
    sprintf(ring->name, "sdma0");
    r = amdgpu_ring_init(adev, ring, 256 * 1024,
                         SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0), 0xf,
                         &adev->sdma_trap_irq, AMDGPU_SDMA_IRQ_TRAP0,
                         AMDGPU_RING_TYPE_SDMA);
    if (r)
        return r;

    ring = &adev->sdma[1].ring;
    sprintf(ring->name, "sdma1");
    r = amdgpu_ring_init(adev, ring, 256 * 1024,
                         SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0), 0xf,
                         &adev->sdma_trap_irq, AMDGPU_SDMA_IRQ_TRAP1,
                         AMDGPU_RING_TYPE_SDMA);
    if (r)
        return r;

    return r;
}
Exemplo n.º 2
0
static int cik_sdma_sw_init(void *handle)
{
	struct amdgpu_ring *ring;
	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
	int r, i;

	r = cik_sdma_init_microcode(adev);
	if (r) {
		DRM_ERROR("Failed to load sdma firmware!\n");
		return r;
	}

	/* SDMA trap event */
	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, 224,
			      &adev->sdma.trap_irq);
	if (r)
		return r;

	/* SDMA Privileged inst */
	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, 241,
			      &adev->sdma.illegal_inst_irq);
	if (r)
		return r;

	/* SDMA Privileged inst */
	r = amdgpu_irq_add_id(adev, AMDGPU_IH_CLIENTID_LEGACY, 247,
			      &adev->sdma.illegal_inst_irq);
	if (r)
		return r;

	for (i = 0; i < adev->sdma.num_instances; i++) {
		ring = &adev->sdma.instance[i].ring;
		ring->ring_obj = NULL;
		sprintf(ring->name, "sdma%d", i);
		r = amdgpu_ring_init(adev, ring, 1024,
				     &adev->sdma.trap_irq,
				     (i == 0) ?
				     AMDGPU_SDMA_IRQ_TRAP0 :
				     AMDGPU_SDMA_IRQ_TRAP1);
		if (r)
			return r;
	}

	return r;
}