aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@amd.com>2014-11-09 05:45:11 -0500
committerOded Gabbay <oded.gabbay@amd.com>2014-11-09 05:45:11 -0500
commitf7694323b44edb6ef690cffd97fcb9055f60677e (patch)
tree9cbf0b4db732818623b11e0c49356d1c2ed469db /drivers/gpu
parent61466c651fc2faffe89000e9d42661f6ab81d8e4 (diff)
drm/radeon: Add implementation of get_fw_version
This patch implements a new interface that was added to the kfd-->kgd interface. The new interface function retrieves the firmware version that is currently in use by a specific engine. The firmware was uploaded to the engine by the radeon driver. v2: Returns the fw version of the specific engine, as passed into the function by a new parameter Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/radeon_kfd.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_kfd.c b/drivers/gpu/drm/radeon/radeon_kfd.c
index 065d02068ec3..242fd8b1b221 100644
--- a/drivers/gpu/drm/radeon/radeon_kfd.c
+++ b/drivers/gpu/drm/radeon/radeon_kfd.c
@@ -28,6 +28,8 @@
28#include "cikd.h" 28#include "cikd.h"
29#include "cik_reg.h" 29#include "cik_reg.h"
30#include "radeon_kfd.h" 30#include "radeon_kfd.h"
31#include "radeon_ucode.h"
32#include <linux/firmware.h>
31 33
32#define CIK_PIPE_PER_MEC (4) 34#define CIK_PIPE_PER_MEC (4)
33 35
@@ -49,6 +51,7 @@ static uint64_t get_vmem_size(struct kgd_dev *kgd);
49static uint64_t get_gpu_clock_counter(struct kgd_dev *kgd); 51static uint64_t get_gpu_clock_counter(struct kgd_dev *kgd);
50 52
51static uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd); 53static uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd);
54static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type);
52 55
53/* 56/*
54 * Register access functions 57 * Register access functions
@@ -91,6 +94,7 @@ static const struct kfd2kgd_calls kfd2kgd = {
91 .hqd_load = kgd_hqd_load, 94 .hqd_load = kgd_hqd_load,
92 .hqd_is_occupies = kgd_hqd_is_occupies, 95 .hqd_is_occupies = kgd_hqd_is_occupies,
93 .hqd_destroy = kgd_hqd_destroy, 96 .hqd_destroy = kgd_hqd_destroy,
97 .get_fw_version = get_fw_version
94}; 98};
95 99
96static const struct kgd2kfd_calls *kgd2kfd; 100static const struct kgd2kfd_calls *kgd2kfd;
@@ -561,3 +565,52 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type,
561 release_queue(kgd); 565 release_queue(kgd);
562 return 0; 566 return 0;
563} 567}
568
569static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type)
570{
571 struct radeon_device *rdev = (struct radeon_device *) kgd;
572 const union radeon_firmware_header *hdr;
573
574 BUG_ON(kgd == NULL || rdev->mec_fw == NULL);
575
576 switch (type) {
577 case KGD_ENGINE_PFP:
578 hdr = (const union radeon_firmware_header *) rdev->pfp_fw->data;
579 break;
580
581 case KGD_ENGINE_ME:
582 hdr = (const union radeon_firmware_header *) rdev->me_fw->data;
583 break;
584
585 case KGD_ENGINE_CE:
586 hdr = (const union radeon_firmware_header *) rdev->ce_fw->data;
587 break;
588
589 case KGD_ENGINE_MEC1:
590 hdr = (const union radeon_firmware_header *) rdev->mec_fw->data;
591 break;
592
593 case KGD_ENGINE_MEC2:
594 hdr = (const union radeon_firmware_header *)
595 rdev->mec2_fw->data;
596 break;
597
598 case KGD_ENGINE_RLC:
599 hdr = (const union radeon_firmware_header *) rdev->rlc_fw->data;
600 break;
601
602 case KGD_ENGINE_SDMA:
603 hdr = (const union radeon_firmware_header *)
604 rdev->sdma_fw->data;
605 break;
606
607 default:
608 return 0;
609 }
610
611 if (hdr == NULL)
612 return 0;
613
614 /* Only 12 bit in use*/
615 return hdr->common.ucode_version;
616}