Skip to contentSkip to conversation

drm/radeon: Sun XVR-300 support on sparc64

PATCH Applied Imre Kaloz 2 participants 4 messages Sep 27

Subsystems (3)
lore
Share & tools
lore

Imre Kaloz

author
#0 lore raw

v2 cover drm/radeon: Sun XVR-300 support on sparc64

These two patches get radeon KMS working on the Sun XVR-300, a FireMV 2200 PCIe (RV370) board, in sparc64 hosts.

Patch 1 fixes an Oops that any posted radeon card on sparc64 hits in igp_read_bios_from_vram(), which dereferences an ioremap() cookie to check the VBIOS signature. It is tagged for stable.

Patch 2 adds a legacy connector table for the XVR-300, which has no COMBIOS for the driver to parse, so both DVI-I outputs are found. The XVR-300 needs both.

Tested on a Sun Ultra 45 with an XVR-300.

Changes in v2:
- Read the signature with readb() before the allocation instead of checking the RAM copy, as radeon_read_bios() does (patch 1).

Imre Kaloz (2):
drm/radeon: Read the VRAM VBIOS signature with readb() drm/radeon: add a connector table for the Sun XVR-300

 drivers/gpu/drm/radeon/radeon_bios.c    |  6 ++-
 drivers/gpu/drm/radeon/radeon_combios.c | 51 +++++++++++++++++++++++++
 drivers/gpu/drm/radeon/radeon_mode.h    |  3 +-
 3 files changed, 58 insertions(+), 2 deletions(-)

base-commit: fe2ec83746e501645709761605c2464a44fd2929

Signature · 1 line
2.47.3
author
#1 lore raw

PATCH v2 1/2 drm/radeon: Read the VRAM VBIOS signature with readb()

igp_read_bios_from_vram() checked bios[0]/bios[1] with a plain __iomem load, which faults on sparc64 before the copy runs at all. radeon_read_bios() already reads its two signature bytes with readb() ahead of its own copy; use the same accessor here, keeping the check before the allocation.

Fixes b442962a9e82 ("drm/radeon/kms: add support for "Surround View"")

---
Changes in v2:
- Read the signature with readb() before the allocation instead of checking the RAM copy, as radeon_read_bios() does.

 drivers/gpu/drm/radeon/radeon_bios.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_bios.c +5 -1
index 8595f4c6e2e5..1da6bf1c17ff 100644
@@ -49,6 +49,7 @@
 static bool igp_read_bios_from_vram(struct radeon_device *rdev)
 {
 	uint8_t __iomem *bios;
+	uint8_t val1, val2;
 	resource_size_t vram_base;
 	resource_size_t size = 256 * 1024; /* ??? */
 
@@ -63,7 +64,10 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev)
 		return false;
 	}
 
-	if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
+	val1 = readb(&bios[0]);
+	val2 = readb(&bios[1]);
+
+	if (size == 0 || val1 != 0x55 || val2 != 0xaa) {
 		iounmap(bios);
 		return false;
 	}
Signature · 1 line
2.47.3
author
#2 lore raw

PATCH v2 2/2 drm/radeon: add a connector table for the Sun XVR-300

In reply to Imre Kaloz

The Sun XVR-300 is a FireMV 2200 PCIe (RV370) board with an FCode-only Open Firmware ROM and no COMBIOS to parse, so the generic connector table leaves both DVI-I outputs undetected. Both XVR-300 SKUs report device ID 5b64 with an ATI subsystem ID rather than Sun's, so match the OF node name prefix instead. The table comes from the board's FCode.

---
 drivers/gpu/drm/radeon/radeon_combios.c | 51 +++++++++++++++++++++++++
 drivers/gpu/drm/radeon/radeon_mode.h    |  3 +-
 2 files changed, 53 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_combios.c +51 -0
index b3e7a747f11e..096f953c67be 100644
@@ -25,6 +25,7 @@
  *          Alex Deucher
  */
 
+#include <linux/of.h>
 #include <linux/pci.h>
 
 #include <drm/drm_device.h>
@@ -1512,6 +1513,14 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
 			rdev->mode_info.connector_table = CT_RN50_POWER;
 		else
 #endif
+		if (of_node_name_prefix(rdev->pdev->dev.of_node, "SUNW,XVR-300"))
+			/* FireMV 2200 PCIe with FCode-only ROM, no COMBIOS
+			 * to parse; both XVR-300 SKUs share device ID 5b64
+			 * with an ATI subsystem ID, so match the OF node
+			 * name instead.
+			 */
+			rdev->mode_info.connector_table = CT_SUN_XVR300;
+		else
 			rdev->mode_info.connector_table = CT_GENERIC;
 	}
 
@@ -2187,6 +2196,48 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
 					    CONNECTOR_OBJECT_ID_SVIDEO,
 					    &hpd);
 		break;
+	case CT_SUN_XVR300:
+		DRM_INFO("Connector Table: %d (sun xvr-300)\n",
+			 rdev->mode_info.connector_table);
+		/* DVI-I - internal tmds, tv dac */
+		ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0);
+		hpd.hpd = RADEON_HPD_1;
+		radeon_add_legacy_encoder(dev,
+					  radeon_get_encoder_enum(dev,
+								ATOM_DEVICE_DFP1_SUPPORT,
+								0),
+					  ATOM_DEVICE_DFP1_SUPPORT);
+		radeon_add_legacy_encoder(dev,
+					  radeon_get_encoder_enum(dev,
+								ATOM_DEVICE_CRT2_SUPPORT,
+								2),
+					  ATOM_DEVICE_CRT2_SUPPORT);
+		radeon_add_legacy_connector(dev, 0,
+					    ATOM_DEVICE_DFP1_SUPPORT |
+					    ATOM_DEVICE_CRT2_SUPPORT,
+					    DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
+					    CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
+					    &hpd);
+		/* DVI-I - sil164 dvo, primary dac */
+		ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0);
+		hpd.hpd = RADEON_HPD_2;
+		radeon_add_legacy_encoder(dev,
+					  radeon_get_encoder_enum(dev,
+								ATOM_DEVICE_DFP2_SUPPORT,
+								0),
+					  ATOM_DEVICE_DFP2_SUPPORT);
+		radeon_add_legacy_encoder(dev,
+					  radeon_get_encoder_enum(dev,
+								ATOM_DEVICE_CRT1_SUPPORT,
+								1),
+					  ATOM_DEVICE_CRT1_SUPPORT);
+		radeon_add_legacy_connector(dev, 1,
+					    ATOM_DEVICE_DFP2_SUPPORT |
+					    ATOM_DEVICE_CRT1_SUPPORT,
+					    DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
+					    CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
+					    &hpd);
+		break;
 	default:
 		DRM_INFO("Connector table: %d (invalid)\n",
 			 rdev->mode_info.connector_table);
drivers/gpu/drm/radeon/radeon_mode.h +2 -1
index 031a3bf6fe0a..6a16d821915d 100644
@@ -226,7 +226,8 @@ enum radeon_connector_table {
 	CT_MAC_X800,
 	CT_MAC_G5_9600,
 	CT_SAM440EP,
-	CT_MAC_G4_SILVER
+	CT_MAC_G4_SILVER,
+	CT_SUN_XVR300
 };
 
 enum radeon_dvo_chip {
Signature · 1 line
2.47.3
Applied
#3 lore raw
In reply to Imre Kaloz
Quoted 14 lines · Imre Kaloz

These two patches get radeon KMS working on the Sun XVR-300, a FireMV 2200 PCIe (RV370) board, in sparc64 hosts.

Patch 1 fixes an Oops that any posted radeon card on sparc64 hits in igp_read_bios_from_vram(), which dereferences an ioremap() cookie to check the VBIOS signature. It is tagged for stable.

Patch 2 adds a legacy connector table for the XVR-300, which has no COMBIOS for the driver to parse, so both DVI-I outputs are found. The XVR-300 needs both.

Tested on a Sun Ultra 45 with an XVR-300.

Quoted 7 lines

Changes in v2:
- Read the signature with readb() before the allocation instead of checking the RAM copy, as radeon_read_bios() does (patch 1).

Imre Kaloz (2):
drm/radeon: Read the VRAM VBIOS signature with readb() drm/radeon: add a connector table for the Sun XVR-300

Applied the series. Thanks!

Alex

Quoted 11 lines
 drivers/gpu/drm/radeon/radeon_bios.c    |  6 ++-
 drivers/gpu/drm/radeon/radeon_combios.c | 51 +++++++++++++++++++++++++
 drivers/gpu/drm/radeon/radeon_mode.h    |  3 +-
 3 files changed, 58 insertions(+), 2 deletions(-)

base-commit: fe2ec83746e501645709761605c2464a44fd2929 --
2.47.3