Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc1e2213 authored by Carter Cooper's avatar Carter Cooper
Browse files

msm: kgsl: Add property to get ucode and GPMU versions



Add a function to return the versioning information for the ucode and GPMU.

Change-Id: I7640346cd47bf17d3c828b8fcda8183fb4e56f16
Signed-off-by: default avatarCarter Cooper <ccooper@codeaurora.org>
parent 729ef8ff
Loading
Loading
Loading
Loading
+53 −2
Original line number Diff line number Diff line
@@ -1686,7 +1686,7 @@ int adreno_reset(struct kgsl_device *device)
}

static int adreno_getproperty(struct kgsl_device *device,
				enum kgsl_property_type type,
				unsigned int type,
				void __user *value,
				size_t sizebytes)
{
@@ -1812,6 +1812,57 @@ static int adreno_getproperty(struct kgsl_device *device,
			status = 0;
		}
		break;
	case KGSL_PROP_UCODE_VERSION:
		{
			struct kgsl_ucode_version ucode;

			if (sizebytes != sizeof(ucode)) {
				status = -EINVAL;
				break;
			}
			memset(&ucode, 0, sizeof(ucode));

			ucode.pfp = adreno_dev->pfp_fw_version;
			ucode.pm4 = adreno_dev->pm4_fw_version;

			if (copy_to_user(value, &ucode, sizeof(ucode))) {
				status = -EFAULT;
				break;
			}
			status = 0;
		}
		break;
	case KGSL_PROP_GPMU_VERSION:
		{
			struct kgsl_gpmu_version gpmu;

			if (adreno_dev->gpucore == NULL) {
				status = -EINVAL;
				break;
			}

			if (!ADRENO_FEATURE(adreno_dev, ADRENO_GPMU)) {
				status = -EOPNOTSUPP;
				break;
			}

			if (sizebytes != sizeof(gpmu)) {
				status = -EINVAL;
				break;
			}
			memset(&gpmu, 0, sizeof(gpmu));

			gpmu.major = adreno_dev->gpucore->gpmu_major;
			gpmu.minor = adreno_dev->gpucore->gpmu_minor;
			gpmu.features = adreno_dev->gpucore->gpmu_features;

			if (copy_to_user(value, &gpmu, sizeof(gpmu))) {
				status = -EFAULT;
				break;
			}
			status = 0;
		}
		break;
	default:
		status = -EINVAL;
	}
@@ -1880,7 +1931,7 @@ int adreno_set_constraint(struct kgsl_device *device,
}

static int adreno_setproperty(struct kgsl_device_private *dev_priv,
				enum kgsl_property_type type,
				unsigned int type,
				void __user *value,
				unsigned int sizebytes)
{
+5 −9
Original line number Diff line number Diff line
@@ -1480,7 +1480,8 @@ int a5xx_rb_init(struct adreno_device *adreno_dev,
}

static int _load_firmware(struct adreno_device *adreno_dev, const char *fwfile,
			  struct kgsl_memdesc *ucode, size_t *ucode_size)
			  struct kgsl_memdesc *ucode, size_t *ucode_size,
			  unsigned int *ucode_version)
{
	struct kgsl_device *device = &adreno_dev->dev;
	const struct firmware *fw = NULL;
@@ -1502,6 +1503,7 @@ static int _load_firmware(struct adreno_device *adreno_dev, const char *fwfile,

	memcpy(ucode->hostptr, &fw->data[4], fw->size - 4);
	*ucode_size = (fw->size - 4) / sizeof(uint32_t);
	*ucode_version = fw->data[4];

	release_firmware(fw);

@@ -1515,22 +1517,16 @@ static int _load_firmware(struct adreno_device *adreno_dev, const char *fwfile,
int a5xx_microcode_read(struct adreno_device *adreno_dev)
{
	int ret;
	uint *ucode;

	ret = _load_firmware(adreno_dev,
			 adreno_dev->gpucore->pm4fw_name, &adreno_dev->pm4,
						 &adreno_dev->pm4_fw_size);
			 &adreno_dev->pm4_fw_size, &adreno_dev->pm4_fw_version);
	if (ret)
		return ret;

	ret = _load_firmware(adreno_dev,
			 adreno_dev->gpucore->pfpfw_name, &adreno_dev->pfp,
						 &adreno_dev->pfp_fw_size);

	ucode = (int *) adreno_dev->pm4.hostptr;
	adreno_dev->pm4_fw_version = ucode[0];
	ucode = (int *) adreno_dev->pfp.hostptr;
	adreno_dev->pfp_fw_version = ucode[0];
			 &adreno_dev->pfp_fw_size, &adreno_dev->pfp_fw_version);
	if (ret)
		return ret;

+2 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
#include "adreno_compat.h"

int adreno_getproperty_compat(struct kgsl_device *device,
				enum kgsl_property_type type,
				unsigned int type,
				void __user *value,
				size_t sizebytes)
{
@@ -101,7 +101,7 @@ int adreno_getproperty_compat(struct kgsl_device *device,
}

int adreno_setproperty_compat(struct kgsl_device_private *dev_priv,
				enum kgsl_property_type type,
				unsigned int type,
				void __user *value,
				unsigned int sizebytes)
{
+4 −4
Original line number Diff line number Diff line
@@ -19,12 +19,12 @@
#include "kgsl_device.h"

int adreno_getproperty_compat(struct kgsl_device *device,
			enum kgsl_property_type type,
			unsigned int type,
			void __user *value,
			size_t sizebytes);

int adreno_setproperty_compat(struct kgsl_device_private *dev_priv,
				enum kgsl_property_type type,
				unsigned int type,
				void __user *value,
				unsigned int sizebytes);

@@ -34,14 +34,14 @@ long adreno_compat_ioctl(struct kgsl_device_private *dev_priv,
#else

static inline int adreno_getproperty_compat(struct kgsl_device *device,
				enum kgsl_property_type type,
				unsigned int type,
				void __user *value, size_t sizebytes)
{
	BUG();
}

static inline int adreno_setproperty_compat(struct kgsl_device_private
				*dev_priv, enum kgsl_property_type type,
				*dev_priv, unsigned int type,
				void __user *value, unsigned int sizebytes)
{
	BUG();
+4 −4
Original line number Diff line number Diff line
@@ -130,10 +130,10 @@ struct kgsl_functable {
	int (*start) (struct kgsl_device *device, int priority);
	int (*stop) (struct kgsl_device *device);
	int (*getproperty) (struct kgsl_device *device,
		enum kgsl_property_type type, void __user *value,
		unsigned int type, void __user *value,
		size_t sizebytes);
	int (*getproperty_compat) (struct kgsl_device *device,
		enum kgsl_property_type type, void __user *value,
		unsigned int type, void __user *value,
		size_t sizebytes);
	int (*waittimestamp) (struct kgsl_device *device,
		struct kgsl_context *context, unsigned int timestamp,
@@ -164,10 +164,10 @@ struct kgsl_functable {
	long (*compat_ioctl) (struct kgsl_device_private *dev_priv,
		unsigned int cmd, unsigned long arg);
	int (*setproperty) (struct kgsl_device_private *dev_priv,
		enum kgsl_property_type type, void __user *value,
		unsigned int type, void __user *value,
		unsigned int sizebytes);
	int (*setproperty_compat) (struct kgsl_device_private *dev_priv,
		enum kgsl_property_type type, void __user *value,
		unsigned int type, void __user *value,
		unsigned int sizebytes);
	void (*drawctxt_sched)(struct kgsl_device *device,
		struct kgsl_context *context);
Loading