Skip to contentSkip to conversation

radeon_cp: use request_firmware

PATCH In review Jaswinder Singh 6 participants 10 messages Aug 7, 2008 – Dec 30, 2008

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 radeon_cp: use request_firmware

Moved datah before datal because datah is required before datal.

Firmware blob looks like this...

	__be32 datah
	__be32 datal
---
 drivers/gpu/drm/radeon/radeon_cp.c        |  152 ++-
 drivers/gpu/drm/radeon/radeon_drv.h       |    6 +
 drivers/gpu/drm/radeon/radeon_microcode.h | 1844 -----------------------------
 firmware/Makefile                         |    4 +
 firmware/WHENCE                           |   40 +
 firmware/radeon/R100_cp.bin.ihex          |  130 ++
 firmware/radeon/R200_cp.bin.ihex          |  130 ++
 firmware/radeon/R300_cp.bin.ihex          |  130 ++
 firmware/radeon/R420_cp.bin.ihex          |  130 ++
 firmware/radeon/R520_cp.bin.ihex          |  130 ++
 firmware/radeon/RS600_cp.bin.ihex         |  130 ++
 firmware/radeon/RS690_cp.bin.ihex         |  130 ++
 12 files changed, 1050 insertions(+), 1906 deletions(-)
 delete mode 100644 drivers/gpu/drm/radeon/radeon_microcode.h
 create mode 100644 firmware/radeon/R100_cp.bin.ihex
 create mode 100644 firmware/radeon/R200_cp.bin.ihex
 create mode 100644 firmware/radeon/R300_cp.bin.ihex
 create mode 100644 firmware/radeon/R420_cp.bin.ihex
 create mode 100644 firmware/radeon/R520_cp.bin.ihex
 create mode 100644 firmware/radeon/RS600_cp.bin.ihex
 create mode 100644 firmware/radeon/RS690_cp.bin.ihex
drivers/gpu/drm/radeon/radeon_cp.c +90 -62
index f0de81a..9eb9117 100644
@@ -35,10 +35,25 @@
 #include "radeon_drv.h"
 #include "r300_reg.h"
 
-#include "radeon_microcode.h"
-
 #define RADEON_FIFO_DEBUG	0
 
+/* Firmware Names */
+#define FIRMWARE_R100		"radeon/R100_cp.bin"
+#define FIRMWARE_R200		"radeon/R200_cp.bin"
+#define FIRMWARE_R300		"radeon/R300_cp.bin"
+#define FIRMWARE_R420		"radeon/R420_cp.bin"
+#define FIRMWARE_RS600		"radeon/RS600_cp.bin"
+#define FIRMWARE_RS690		"radeon/RS690_cp.bin"
+#define FIRMWARE_R520		"radeon/R520_cp.bin"
+
+MODULE_FIRMWARE(FIRMWARE_R100);
+MODULE_FIRMWARE(FIRMWARE_R200);
+MODULE_FIRMWARE(FIRMWARE_R300);
+MODULE_FIRMWARE(FIRMWARE_R420);
+MODULE_FIRMWARE(FIRMWARE_RS600);
+MODULE_FIRMWARE(FIRMWARE_RS690);
+MODULE_FIRMWARE(FIRMWARE_R520);
+
 static int radeon_do_cleanup_cp(struct drm_device * dev);
 
 static u32 R500_READ_MCIND(drm_radeon_private_t *dev_priv, int addr)
@@ -320,12 +335,20 @@ static void radeon_init_pipes(drm_radeon_private_t *dev_priv)
  */
 
 /* Load the microcode for the CP */
-static void radeon_cp_load_microcode(drm_radeon_private_t * dev_priv)
+static int radeon_cp_init_microcode(drm_radeon_private_t *dev_priv)
 {
-	int i;
+	struct platform_device *pdev;
+	const char *fw_name = NULL;
+	int err;
+
 	DRM_DEBUG("\n");
 
-	radeon_do_wait_for_idle(dev_priv);
+	pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0);
+	err = IS_ERR(pdev);
+	if (err) {
+		printk(KERN_ERR "radeon_cp: Failed to register firmware\n");
+		return -EINVAL;
+	}
 
 	RADEON_WRITE(RADEON_CP_ME_RAM_ADDR, 0);
 	if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R100) ||
@@ -334,52 +357,27 @@ static void radeon_cp_load_microcode(drm_radeon_private_t * dev_priv)
 	    ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS100) ||
 	    ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS200)) {
 		DRM_INFO("Loading R100 Microcode\n");
-		for (i = 0; i < 256; i++) {
-			RADEON_WRITE(RADEON_CP_ME_RAM_DATAH,
-				     R100_cp_microcode[i][1]);
-			RADEON_WRITE(RADEON_CP_ME_RAM_DATAL,
-				     R100_cp_microcode[i][0]);
-		}
+		fw_name = FIRMWARE_R100;
 	} else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R200) ||
 		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV250) ||
 		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV280) ||
 		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS300)) {
 		DRM_INFO("Loading R200 Microcode\n");
-		for (i = 0; i < 256; i++) {
-			RADEON_WRITE(RADEON_CP_ME_RAM_DATAH,
-				     R200_cp_microcode[i][1]);
-			RADEON_WRITE(RADEON_CP_ME_RAM_DATAL,
-				     R200_cp_microcode[i][0]);
-		}
+		fw_name = FIRMWARE_R200;
 	} else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R300) ||
 		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R350) ||
 		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV350) ||
 		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV380) ||
 		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS480)) {
 		DRM_INFO("Loading R300 Microcode\n");
-		for (i = 0; i < 256; i++) {
-			RADEON_WRITE(RADEON_CP_ME_RAM_DATAH,
-				     R300_cp_microcode[i][1]);
-			RADEON_WRITE(RADEON_CP_ME_RAM_DATAL,
-				     R300_cp_microcode[i][0]);
-		}
+		fw_name = FIRMWARE_R300;
 	} else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R420) ||
 		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV410)) {
 		DRM_INFO("Loading R400 Microcode\n");
-		for (i = 0; i < 256; i++) {
-			RADEON_WRITE(RADEON_CP_ME_RAM_DATAH,
-				     R420_cp_microcode[i][1]);
-			RADEON_WRITE(RADEON_CP_ME_RAM_DATAL,
-				     R420_cp_microcode[i][0]);
-		}
+		fw_name = FIRMWARE_R420;
 	} else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) {
 		DRM_INFO("Loading RS690 Microcode\n");
-		for (i = 0; i < 256; i++) {
-			RADEON_WRITE(RADEON_CP_ME_RAM_DATAH,
-				     RS690_cp_microcode[i][1]);
-			RADEON_WRITE(RADEON_CP_ME_RAM_DATAL,
-				     RS690_cp_microcode[i][0]);
-		}
+		fw_name = FIRMWARE_RS690;
 	} else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) ||
 		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R520) ||
 		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV530) ||
@@ -387,11 +385,40 @@ static void radeon_cp_load_microcode(drm_radeon_private_t * dev_priv)
 		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV560) ||
 		   ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV570)) {
 		DRM_INFO("Loading R500 Microcode\n");
-		for (i = 0; i < 256; i++) {
+		fw_name = FIRMWARE_R520;
+	}
+
+	err = request_firmware(&dev_priv->fw, fw_name, &pdev->dev);
+	platform_device_unregister(pdev);
+	if (err)
+		printk(KERN_ERR "radeon_cp: Failed to load firmware \"%s\"\n",
+		       fw_name);
+
+	if (dev_priv->fw->size % 8) {
+		printk(KERN_ERR
+		       "radeon_cp: Bogus length %zu in firmware \"%s\"\n",
+		       dev_priv->fw->size, fw_name);
+		err = -EINVAL;
+		release_firmware(dev_priv->fw);
+	}
+	return err;
+}
+
+static void radeon_cp_load_microcode(drm_radeon_private_t *dev_priv)
+{
+	const __be32 *fw_data;
+	int i, size;
+
+	radeon_do_wait_for_idle(dev_priv);
+
+	if (dev_priv->fw) {
+		size = dev_priv->fw->size / 4;
+		fw_data = (const __be32 *)&dev_priv->fw->data[0];
+		for (i = 0; i < size; i += 2) {
 			RADEON_WRITE(RADEON_CP_ME_RAM_DATAH,
-				     R520_cp_microcode[i][1]);
+				     be32_to_cpup(&fw_data[i]));
 			RADEON_WRITE(RADEON_CP_ME_RAM_DATAL,
-				     R520_cp_microcode[i][0]);
+				     be32_to_cpup(&fw_data[i + 1]));
 		}
 	}
 }
@@ -853,14 +880,14 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on)
 static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
+	int err = -EINVAL;
 
 	DRM_DEBUG("\n");
 
 	/* if we require new memory map but we don't have it fail */
 	if ((dev_priv->flags & RADEON_NEW_MEMMAP) && !dev_priv->new_memmap) {
 		DRM_ERROR("Cannot initialise DRM on this card\nThis card requires a new X.org DDX for 3D\n");
-		radeon_do_cleanup_cp(dev);
-		return -EINVAL;
+		goto out;
 	}
 
 	if (init->is_pci && (dev_priv->flags & RADEON_IS_AGP)) {
@@ -874,16 +901,14 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
 
 	if ((!(dev_priv->flags & RADEON_IS_AGP)) && !dev->sg) {
 		DRM_ERROR("PCI GART memory not allocated!\n");
-		radeon_do_cleanup_cp(dev);
-		return -EINVAL;
+		goto out;
 	}
 
 	dev_priv->usec_timeout = init->usec_timeout;
 	if (dev_priv->usec_timeout < 1 ||
 	    dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT) {
 		DRM_DEBUG("TIMEOUT problem!\n");
-		radeon_do_cleanup_cp(dev);
-		return -EINVAL;
+		goto out;
 	}
 
 	/* Enable vblank on CRTC1 for older X servers
@@ -911,8 +936,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
 	if ((init->cp_mode != RADEON_CSQ_PRIBM_INDDIS) &&
 	    (init->cp_mode != RADEON_CSQ_PRIBM_INDBM)) {
 		DRM_DEBUG("BAD cp_mode (%x)!\n", init->cp_mode);
-		radeon_do_cleanup_cp(dev);
-		return -EINVAL;
+		goto out;
 	}
 
 	switch (init->fb_bpp) {
@@ -980,28 +1004,24 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
 	dev_priv->sarea = drm_getsarea(dev);
 	if (!dev_priv->sarea) {
 		DRM_ERROR("could not find sarea!\n");
-		radeon_do_cleanup_cp(dev);
-		return -EINVAL;
+		goto out;
 	}
 
 	dev_priv->cp_ring = drm_core_findmap(dev, init->ring_offset);
 	if (!dev_priv->cp_ring) {
 		DRM_ERROR("could not find cp ring region!\n");
-		radeon_do_cleanup_cp(dev);
-		return -EINVAL;
+		goto out;
 	}
 	dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset);
 	if (!dev_priv->ring_rptr) {
 		DRM_ERROR("could not find ring read pointer!\n");
-		radeon_do_cleanup_cp(dev);
-		return -EINVAL;
+		goto out;
 	}
 	dev->agp_buffer_token = init->buffers_offset;
 	dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset);
 	if (!dev->agp_buffer_map) {
 		DRM_ERROR("could not find dma buffer region!\n");
-		radeon_do_cleanup_cp(dev);
-		return -EINVAL;
+		goto out;
 	}
 
 	if (init->gart_textures_offset) {
@@ -1009,8 +1029,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
 		    drm_core_findmap(dev, init->gart_textures_offset);
 		if (!dev_priv->gart_textures) {
 			DRM_ERROR("could not find GART texture region!\n");
-			radeon_do_cleanup_cp(dev);
-			return -EINVAL;
+			goto out;
 		}
 	}
 
@@ -1027,8 +1046,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
 		    !dev_priv->ring_rptr->handle ||
 		    !dev->agp_buffer_map->handle) {
 			DRM_ERROR("could not find ioremap agp regions!\n");
-			radeon_do_cleanup_cp(dev);
-			return -EINVAL;
+			goto out;
 		}
 	} else
 #endif
@@ -1180,21 +1198,25 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
 			if (dev_priv->flags & RADEON_IS_PCIE) {
 				DRM_ERROR
 				    ("Cannot use PCI Express without GART in FB memory\n");
-				radeon_do_cleanup_cp(dev);
-				return -EINVAL;
+				goto out;
 			}
 		}
 
 		if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) {
 			DRM_ERROR("failed to init PCI GART!\n");
-			radeon_do_cleanup_cp(dev);
-			return -ENOMEM;
+			err = -ENOMEM;
+			goto out;
 		}
 
 		/* Turn on PCI GART */
 		radeon_set_pcigart(dev_priv, 1);
 	}
 
+	err = radeon_cp_init_microcode(dev_priv);
+	if (err) {
+		DRM_ERROR("Failed to load firmware!\n");
+		goto out;
+	}
 	radeon_cp_load_microcode(dev_priv);
 	radeon_cp_init_ring_buffer(dev, dev_priv);
 
@@ -1204,6 +1226,9 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
 	radeon_test_writeback(dev_priv);
 
 	return 0;
+out:
+	radeon_do_cleanup_cp(dev);
+	return err;
 }
 
 static int radeon_do_cleanup_cp(struct drm_device * dev)
@@ -1249,6 +1274,9 @@ static int radeon_do_cleanup_cp(struct drm_device * dev)
 			dev_priv->gart_info.addr = 0;
 		}
 	}
+
+	release_firmware(dev_priv->fw);
+
 	/* only clear to the start of flags */
 	memset(dev_priv, 0, offsetof(drm_radeon_private_t, flags));
 
drivers/gpu/drm/radeon/radeon_drv.h +6 -0
index 3f0eca9..5cc808e 100644
@@ -31,6 +31,9 @@
 #ifndef __RADEON_DRV_H__
 #define __RADEON_DRV_H__
 
+#include <linux/firmware.h>
+#include <linux/platform_device.h>
+
 /* General customization:
  */
 
@@ -311,6 +314,9 @@ typedef struct drm_radeon_private {
 	unsigned long fb_aper_offset;
 
 	int num_gb_pipes;
+
+	/* firmware */
+	const struct firmware *fw;
 } drm_radeon_private_t;
 
 typedef struct drm_radeon_buf_priv {
drivers/gpu/drm/radeon/radeon_microcode.h deleted +0 -1844

1,844 lines not on this page · raw message

firmware/Makefile +4 -0
index a11e607..4f8874e 100644
@@ -34,6 +34,10 @@ fw-shipped-$(CONFIG_ATARI_DSP56K) += dsp56k/bootstrap.bin
 fw-shipped-$(CONFIG_ATM_AMBASSADOR) += atmsar11.fw
 fw-shipped-$(CONFIG_CASSINI) += sun/cassini.bin
 fw-shipped-$(CONFIG_COMPUTONE) += intelliport2.bin
+fw-shipped-$(CONFIG_DRM_RADEON) += radeon/R100_cp.bin radeon/R200_cp.bin \
+				   radeon/R300_cp.bin radeon/R420_cp.bin \
+				   radeon/RS600_cp.bin radeon/RS690_cp.bin \
+				   radeon/R520_cp.bin
 fw-shipped-$(CONFIG_DVB_AV7110) += av7110/bootcode.bin
 fw-shipped-$(CONFIG_DVB_TTUSB_BUDGET) += ttusb-budget/dspbootcode.bin
 fw-shipped-$(CONFIG_E100) += e100/d101m_ucode.bin e100/d101s_ucode.bin \
firmware/WHENCE +40 -0
index fe02eec..64a2473 100644
@@ -572,3 +572,43 @@ Licence:
 Found in hex form in kernel source.
 
 --------------------------------------------------------------------------
+
+Driver: DRM_RADEON - ATI Radeon
+
+File: radeon/R100_cp.bin
+File: radeon/R200_cp.bin
+File: radeon/R300_cp.bin
+File: radeon/R420_cp.bin
+File: radeon/RS600_cp.bin
+File: radeon/RS690_cp.bin
+File: radeon/R520_cp.bin
+
+Licence:
+/*
+ * Copyright 2007 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
firmware/radeon/R100_cp.bin.ihex new file +130 -0

130 lines not on this page · raw message

firmware/radeon/R200_cp.bin.ihex new file +130 -0

130 lines not on this page · raw message

firmware/radeon/R300_cp.bin.ihex new file +130 -0

130 lines not on this page · raw message

firmware/radeon/R420_cp.bin.ihex new file +130 -0

130 lines not on this page · raw message

firmware/radeon/R520_cp.bin.ihex new file +130 -0

130 lines not on this page · raw message

firmware/radeon/RS600_cp.bin.ihex new file +130 -0

130 lines not on this page · raw message

firmware/radeon/RS690_cp.bin.ihex new file +130 -0

15 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.5.5.1

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 7 lines · Jaswinder Singh

Moved datah before datal because datah is required before datal.

Firmware blob looks like this...

	__be32 datah
	__be32 datal

When applied to 2.6.27-rc2, firmware/Makefile was rejected, so I manually added the blob list to that Makefile in what looked to be the correct place. And added a "make firmware_install" to my kernel builder script.

Unforch:
MK_FW firmware/R100_cp.bin.ihex.gen.S
make[1]: *** No rule to make target firmware/R100_cp.bin.ihex', needed by firmware/R100_cp.bin.ihex.gen.o'. Stop. make[1]: *** Waiting for unfinished jobs....
make: *** [firmware] Error 2

I suspect I need to go back and hand edit the .config to add the "radeon/" in front of each of those, so its looking for
"firmware/radeon/R100_cp.bin.ihex" in each of those cases. Correct? Or can
I use "radeon/*" ?

[...]

Signature · 5 lines
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Fiber optics caused gas main leak
#2 lore raw

Hello Gene,

Quoted 10 lines · Gene Heskett

When applied to 2.6.27-rc2, firmware/Makefile was rejected, so I manually added the blob list to that Makefile in what looked to be the correct place. And added a "make firmware_install" to my kernel builder script.

Unforch:
MK_FW firmware/R100_cp.bin.ihex.gen.S
make[1]: *** No rule to make target firmware/R100_cp.bin.ihex', needed by firmware/R100_cp.bin.ihex.gen.o'. Stop. make[1]: *** Waiting for unfinished jobs....
make: *** [firmware] Error 2

It seems your firmware/Makefile is not good.

it should look like this :-

fw-shipped-$(CONFIG_DRM_RADEON) += radeon/R100_cp.bin radeon/R200_cp.bin \
                                   radeon/R300_cp.bin radeon/R420_cp.bin \
                                   radeon/RS600_cp.bin radeon/RS690_cp.bin \
                                   radeon/R520_cp.bin

I think you forget to write radeon before R100_cp.bin

And you can collect my updated patch from :
http://git.infradead.org/users/jaswinder/firm-jsr-2.6.git

Thank you,

Jaswinder Singh.

#3 lore raw
In reply to Jaswinder Singh

Hello all,

Quoted 21 lines · Jaswinder Singh

Moved datah before datal because datah is required before datal.

Firmware blob looks like this...

       __be32 datah
       __be32 datal
---
 drivers/gpu/drm/radeon/radeon_cp.c        |  152 ++-
 drivers/gpu/drm/radeon/radeon_drv.h       |    6 +
 drivers/gpu/drm/radeon/radeon_microcode.h | 1844 -----------------------------
 firmware/Makefile                         |    4 +
 firmware/WHENCE                           |   40 +
 firmware/radeon/R100_cp.bin.ihex          |  130 ++
 firmware/radeon/R200_cp.bin.ihex          |  130 ++
 firmware/radeon/R300_cp.bin.ihex          |  130 ++
 firmware/radeon/R420_cp.bin.ihex          |  130 ++
 firmware/radeon/R520_cp.bin.ihex          |  130 ++
 firmware/radeon/RS600_cp.bin.ihex         |  130 ++
 firmware/radeon/RS690_cp.bin.ihex         |  130 ++
 12 files changed, 1050 insertions(+), 1906 deletions(-)
Quoted 9 lines
 delete mode 100644 drivers/gpu/drm/radeon/radeon_microcode.h
 create mode 100644 firmware/radeon/R100_cp.bin.ihex
 create mode 100644 firmware/radeon/R200_cp.bin.ihex
 create mode 100644 firmware/radeon/R300_cp.bin.ihex
 create mode 100644 firmware/radeon/R420_cp.bin.ihex
 create mode 100644 firmware/radeon/R520_cp.bin.ihex
 create mode 100644 firmware/radeon/RS600_cp.bin.ihex
 create mode 100644 firmware/radeon/RS690_cp.bin.ihex

Is available at
http://git.infradead.org/users/jaswinder/firm-jsr-2.6.git?a=commit;h=3a911a216742e4ab998f3281409d46a62f252716

Please let me know, should I need to resend this patch for :
1. git kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git OR
2. git kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

Thank you,

Jaswinder Singh.

#4 lore raw
Quoted 10 lines

Is available at
http://git.infradead.org/users/jaswinder/firm-jsr-2.6.git?a=commit;h=3a911a216742e4ab998f3281409d46a62f252716

Please let me know, should I need to resend this patch for :
1. git kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git OR
2. git kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

How much testing has this seen on what range of cards and on what architectures? I'd like some success stories from people using this patch. Is Debian shipping it?

Its do think firmware patches are stupid (I do), but I'm not against applying them if they are proven working.

Dave.

#5 lore raw
Quoted 6 lines · Dave Airlie
Quoted 6 lines

Is available at
http://git.infradead.org/users/jaswinder/firm-jsr-2.6.git?a=commit;h=3a911a216742e4ab998f3281409d46a62f252716

Quoted 9 lines
Quoted 4 lines

Please let me know, should I need to resend this patch for :
1. git kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git OR
2. git kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

How much testing has this seen on what range of cards and on what architectures? I'd like some success stories from people using this patch. Is Debian shipping it?

Not at this time. AFAIK Ben Hutchings has tested that patch, although I don't know on what hardware, and if he got other testers. Ben?

Quoted 3 lines

Its do think firmware patches are stupid (I do), but I'm not against applying them if they are proven working.

Cheers,
Julien

#6 lore raw
Quoted 13 lines · Julien Cristau
Quoted 11 lines · Dave Airlie
Quoted 10 lines

Is available at
http://git.infradead.org/users/jaswinder/firm-jsr-2.6.git?a=commit;h=3a911a216742e4ab998f3281409d46a62f252716

Please let me know, should I need to resend this patch for :
1. git kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git OR
2. git kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

Quoted 6 lines
Quoted 4 lines

How much testing has this seen on what range of cards and on what architectures? I'd like some success stories from people using this patch. Is Debian shipping it?

Not at this time. AFAIK Ben Hutchings has tested that patch, although I don't know on what hardware, and if he got other testers. Ben?

I had to revise Jaswinder's patch as it allowed a double-free. I'm attaching the version I've tested (which is against v2.6.26 so the paths are different). That was tested on a Radeon Mobility 7500 (R100 if I remember correctly).

Ben.

Signature · 3 lines
Ben Hutchings
Unix is many things to many people,
but it's never been everything to anybody.

commit 61114ee8e98e86b3160d547b6dbe7ec7bac445f5

Author: Ben Hutchings <[email protected]>
Date:   Wed Oct 15 01:29:35 2008 +0100

radeon: Use request_firmware() to load CP microcode

Tested on Radeon 7500 (RV200) with and without firmware installed.

drivers/char/drm/Kconfig +1 -1
index 3b0dd6a..17edd8a 100644
@@ -35,7 +35,7 @@ config DRM_R128
 config DRM_RADEON
 	tristate "ATI Radeon"
 	depends on DRM && PCI
-	depends on BROKEN
+	select FW_LOADER
 	help
 	  Choose this option if you have an ATI Radeon graphics card.  There
 	  are both PCI and AGP versions.  You don't need to choose this to
drivers/char/drm/radeon_cp.c +76 -39

175 lines not on this page · raw message

drivers/char/drm/radeon_drv.h +6 -0
index 3f0eca9..5cc808e 100644
@@ -31,6 +31,9 @@
 #ifndef __RADEON_DRV_H__
 #define __RADEON_DRV_H__
 
+#include <linux/firmware.h>
+#include <linux/platform_device.h>
+
 /* General customization:
  */
 
@@ -311,6 +314,9 @@ typedef struct drm_radeon_private {
 	unsigned long fb_aper_offset;
 
 	int num_gb_pipes;
+
+	/* firmware */
+	const struct firmware *fw;
 } drm_radeon_private_t;
 
 typedef struct drm_radeon_buf_priv {
#7 lore raw

Hello Ben, Dave,

Quoted 4 lines · Ben Hutchings

I had to revise Jaswinder's patch as it allowed a double-free. I'm attaching the version I've tested (which is against v2.6.26 so the paths are different). That was tested on a Radeon Mobility 7500 (R100 if I remember correctly).

What is next step.

Thank you,
JSR

#8 lore raw

PATCH 1/1 radeon: Use request_firmware() to load CP microcode

Based on a patch by Jaswinder Singh Rajput <[email protected]>.

Moved datah before datal because datah is required before datal.

Firmware blob looks like this...

    __be32 datah
    __be32 datal

---

Quoted 9 lines · Jaswinder Singh Rajput

Hello Ben, Dave,

Quoted 4 lines · Ben Hutchings

I had to revise Jaswinder's patch as it allowed a double-free. I'm attaching the version I've tested (which is against v2.6.26 so the paths are different). That was tested on a Radeon Mobility 7500 (R100 if I remember correctly).

What is next step.

Here's a patch against the drm-next branch of drm-2.6.git, basically the same as what I've tested against the Debian kernel. However, in the context of this branch it is compile-tested only as yet. Note that I removed the RS600 firmware/microcode completely as it was unused.

Ben.

 drivers/gpu/drm/Kconfig                   |    1 +
 drivers/gpu/drm/radeon/radeon_cp.c        |  115 ++-
 drivers/gpu/drm/radeon/radeon_drv.h       |    6 +
 drivers/gpu/drm/radeon/radeon_microcode.h | 1844 -----------------------------
 firmware/Makefile                         |    3 +
 firmware/WHENCE                           |   40 +
 firmware/radeon/R100_cp.bin.ihex          |  130 ++
 firmware/radeon/R200_cp.bin.ihex          |  130 ++
 firmware/radeon/R300_cp.bin.ihex          |  130 ++
 firmware/radeon/R420_cp.bin.ihex          |  130 ++
 firmware/radeon/R520_cp.bin.ihex          |  130 ++
 firmware/radeon/RS690_cp.bin.ihex         |  130 ++
 12 files changed, 906 insertions(+), 1883 deletions(-)
 delete mode 100644 drivers/gpu/drm/radeon/radeon_microcode.h
 create mode 100644 firmware/radeon/R100_cp.bin.ihex
 create mode 100644 firmware/radeon/R200_cp.bin.ihex
 create mode 100644 firmware/radeon/R300_cp.bin.ihex
 create mode 100644 firmware/radeon/R420_cp.bin.ihex
 create mode 100644 firmware/radeon/R520_cp.bin.ihex
 create mode 100644 firmware/radeon/RS690_cp.bin.ihex
drivers/gpu/drm/Kconfig +1 -0
index 783ec70..63da963 100644
@@ -37,6 +37,7 @@ config DRM_R128
 config DRM_RADEON
 	tristate "ATI Radeon"
 	depends on DRM && PCI
+	select FW_LOADER
 	help
 	  Choose this option if you have an ATI Radeon graphics card.  There
 	  are both PCI and AGP versions.  You don't need to choose this to
drivers/gpu/drm/radeon/radeon_cp.c +76 -39

177 lines not on this page · raw message

drivers/gpu/drm/radeon/radeon_drv.h +6 -0
index 490bc7c..046343f 100644
@@ -31,6 +31,9 @@
 #ifndef __RADEON_DRV_H__
 #define __RADEON_DRV_H__
 
+#include <linux/firmware.h>
+#include <linux/platform_device.h>
+
 /* General customization:
  */
 
@@ -321,6 +324,9 @@ typedef struct drm_radeon_private {
 	int num_gb_pipes;
 	int track_flush;
 	drm_local_map_t *mmio;
+
+	/* firmware */
+	const struct firmware *fw;
 } drm_radeon_private_t;
 
 typedef struct drm_radeon_buf_priv {
drivers/gpu/drm/radeon/radeon_microcode.h deleted +0 -1844

1,844 lines not on this page · raw message

firmware/Makefile +3 -0
index 3346ed8..bef2f5f 100644
@@ -26,6 +26,9 @@ fw-shipped-$(CONFIG_CASSINI) += sun/cassini.bin
 fw-shipped-$(CONFIG_COMPUTONE) += intelliport2.bin
 fw-shipped-$(CONFIG_DRM_MGA) += matrox/g200_warp.fw matrox/g400_warp.fw
 fw-shipped-$(CONFIG_DRM_R128) += r128/r128_cce.bin
+fw-shipped-$(CONFIG_DRM_RADEON) += radeon/R100_cp.bin radeon/R200_cp.bin \
+				   radeon/R300_cp.bin radeon/R420_cp.bin \
+				   radeon/RS690_cp.bin radeon/R520_cp.bin
 fw-shipped-$(CONFIG_DVB_TTUSB_BUDGET) += ttusb-budget/dspbootcode.bin
 fw-shipped-$(CONFIG_SMCTR) += tr_smctr.bin
 fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp
firmware/WHENCE +40 -0
index caaa9eb..abb066c 100644
@@ -412,3 +412,43 @@ Copyright 2000 Advanced Micro Devices, Inc.
 Found in decimal form in kernel source.
 
 --------------------------------------------------------------------------
+
+Driver: DRM_RADEON - ATI Radeon
+
+File: radeon/R100_cp.bin
+File: radeon/R200_cp.bin
+File: radeon/R300_cp.bin
+File: radeon/R420_cp.bin
+File: radeon/RS600_cp.bin
+File: radeon/RS690_cp.bin
+File: radeon/R520_cp.bin
+
+Licence:
+/*
+ * Copyright 2007 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
firmware/radeon/R100_cp.bin.ihex new file +130 -0

130 lines not on this page · raw message

firmware/radeon/R200_cp.bin.ihex new file +130 -0

130 lines not on this page · raw message

firmware/radeon/R300_cp.bin.ihex new file +130 -0

130 lines not on this page · raw message

firmware/radeon/R420_cp.bin.ihex new file +130 -0

130 lines not on this page · raw message

firmware/radeon/R520_cp.bin.ihex new file +130 -0

130 lines not on this page · raw message

firmware/radeon/RS690_cp.bin.ihex new file +130 -0

130 lines not on this page · raw message

Signature · 2 lines
Ben Hutchings
Life would be so much easier if we could look at the source code.
#9 lore raw
In reply to Dave Airlie

Hello Dave,

Quoted 6 lines · Dave Airlie
Quoted 6 lines

Is available at
http://git.infradead.org/users/jaswinder/firm-jsr-2.6.git?a=commit;h=3a911a216742e4ab998f3281409d46a62f252716

Quoted 9 lines
Quoted 4 lines

Please let me know, should I need to resend this patch for :
1. git kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git OR
2. git kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

How much testing has this seen on what range of cards and on what architectures? I'd like some success stories from people using this patch. Is Debian shipping it?

I have tested this patch with ATI Radeon 9200SE on Intel machine. It uses R200 microcode and works great on my machine.

For further testing can I update this patch for git kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git or some other testing git.

Thank you,

Jaswinder Singh.