Browse Source

Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6

* 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  agp: amd64, fix pci reference leaks
  drm/edid: Allow non-fatal checksum errors in CEA blocks
  drm/radeon/kms: suppress a build warning (unused variable)
  drm: Fixes linux-next & linux-2.6 checkstack warnings:
  nouveau: fix acpi_lid_open undefined
  drm/radeon/kms: release AGP bridge at suspend
Linus Torvalds 15 years ago
parent
commit
31f4671799

+ 18 - 10
drivers/char/agp/amd64-agp.c

@@ -384,7 +384,7 @@ static int __devinit uli_agp_init(struct pci_dev *pdev)
 {
 {
 	u32 httfea,baseaddr,enuscr;
 	u32 httfea,baseaddr,enuscr;
 	struct pci_dev *dev1;
 	struct pci_dev *dev1;
-	int i;
+	int i, ret;
 	unsigned size = amd64_fetch_size();
 	unsigned size = amd64_fetch_size();
 
 
 	dev_info(&pdev->dev, "setting up ULi AGP\n");
 	dev_info(&pdev->dev, "setting up ULi AGP\n");
@@ -400,15 +400,18 @@ static int __devinit uli_agp_init(struct pci_dev *pdev)
 
 
 	if (i == ARRAY_SIZE(uli_sizes)) {
 	if (i == ARRAY_SIZE(uli_sizes)) {
 		dev_info(&pdev->dev, "no ULi size found for %d\n", size);
 		dev_info(&pdev->dev, "no ULi size found for %d\n", size);
-		return -ENODEV;
+		ret = -ENODEV;
+		goto put;
 	}
 	}
 
 
 	/* shadow x86-64 registers into ULi registers */
 	/* shadow x86-64 registers into ULi registers */
 	pci_read_config_dword (k8_northbridges[0], AMD64_GARTAPERTUREBASE, &httfea);
 	pci_read_config_dword (k8_northbridges[0], AMD64_GARTAPERTUREBASE, &httfea);
 
 
 	/* if x86-64 aperture base is beyond 4G, exit here */
 	/* if x86-64 aperture base is beyond 4G, exit here */
-	if ((httfea & 0x7fff) >> (32 - 25))
-		return -ENODEV;
+	if ((httfea & 0x7fff) >> (32 - 25)) {
+		ret = -ENODEV;
+		goto put;
+	}
 
 
 	httfea = (httfea& 0x7fff) << 25;
 	httfea = (httfea& 0x7fff) << 25;
 
 
@@ -420,9 +423,10 @@ static int __devinit uli_agp_init(struct pci_dev *pdev)
 	enuscr= httfea+ (size * 1024 * 1024) - 1;
 	enuscr= httfea+ (size * 1024 * 1024) - 1;
 	pci_write_config_dword(dev1, ULI_X86_64_HTT_FEA_REG, httfea);
 	pci_write_config_dword(dev1, ULI_X86_64_HTT_FEA_REG, httfea);
 	pci_write_config_dword(dev1, ULI_X86_64_ENU_SCR_REG, enuscr);
 	pci_write_config_dword(dev1, ULI_X86_64_ENU_SCR_REG, enuscr);
-
+	ret = 0;
+put:
 	pci_dev_put(dev1);
 	pci_dev_put(dev1);
-	return 0;
+	return ret;
 }
 }
 
 
 
 
@@ -441,7 +445,7 @@ static int nforce3_agp_init(struct pci_dev *pdev)
 {
 {
 	u32 tmp, apbase, apbar, aplimit;
 	u32 tmp, apbase, apbar, aplimit;
 	struct pci_dev *dev1;
 	struct pci_dev *dev1;
-	int i;
+	int i, ret;
 	unsigned size = amd64_fetch_size();
 	unsigned size = amd64_fetch_size();
 
 
 	dev_info(&pdev->dev, "setting up Nforce3 AGP\n");
 	dev_info(&pdev->dev, "setting up Nforce3 AGP\n");
@@ -458,7 +462,8 @@ static int nforce3_agp_init(struct pci_dev *pdev)
 
 
 	if (i == ARRAY_SIZE(nforce3_sizes)) {
 	if (i == ARRAY_SIZE(nforce3_sizes)) {
 		dev_info(&pdev->dev, "no NForce3 size found for %d\n", size);
 		dev_info(&pdev->dev, "no NForce3 size found for %d\n", size);
-		return -ENODEV;
+		ret = -ENODEV;
+		goto put;
 	}
 	}
 
 
 	pci_read_config_dword(dev1, NVIDIA_X86_64_1_APSIZE, &tmp);
 	pci_read_config_dword(dev1, NVIDIA_X86_64_1_APSIZE, &tmp);
@@ -472,7 +477,8 @@ static int nforce3_agp_init(struct pci_dev *pdev)
 	/* if x86-64 aperture base is beyond 4G, exit here */
 	/* if x86-64 aperture base is beyond 4G, exit here */
 	if ( (apbase & 0x7fff) >> (32 - 25) ) {
 	if ( (apbase & 0x7fff) >> (32 - 25) ) {
 		dev_info(&pdev->dev, "aperture base > 4G\n");
 		dev_info(&pdev->dev, "aperture base > 4G\n");
-		return -ENODEV;
+		ret = -ENODEV;
+		goto put;
 	}
 	}
 
 
 	apbase = (apbase & 0x7fff) << 25;
 	apbase = (apbase & 0x7fff) << 25;
@@ -488,9 +494,11 @@ static int nforce3_agp_init(struct pci_dev *pdev)
 	pci_write_config_dword(dev1, NVIDIA_X86_64_1_APBASE2, apbase);
 	pci_write_config_dword(dev1, NVIDIA_X86_64_1_APBASE2, apbase);
 	pci_write_config_dword(dev1, NVIDIA_X86_64_1_APLIMIT2, aplimit);
 	pci_write_config_dword(dev1, NVIDIA_X86_64_1_APLIMIT2, aplimit);
 
 
+	ret = 0;
+put:
 	pci_dev_put(dev1);
 	pci_dev_put(dev1);
 
 
-	return 0;
+	return ret;
 }
 }
 
 
 static int __devinit agp_amd64_probe(struct pci_dev *pdev,
 static int __devinit agp_amd64_probe(struct pci_dev *pdev,

+ 4 - 1
drivers/gpu/drm/drm_edid.c

@@ -147,7 +147,10 @@ drm_edid_block_valid(u8 *raw_edid)
 		csum += raw_edid[i];
 		csum += raw_edid[i];
 	if (csum) {
 	if (csum) {
 		DRM_ERROR("EDID checksum is invalid, remainder is %d\n", csum);
 		DRM_ERROR("EDID checksum is invalid, remainder is %d\n", csum);
-		goto bad;
+
+		/* allow CEA to slide through, switches mangle this */
+		if (raw_edid[0] != 0x02)
+			goto bad;
 	}
 	}
 
 
 	/* per-block-type checks */
 	/* per-block-type checks */

+ 2 - 1
drivers/gpu/drm/nouveau/nouveau_connector.c

@@ -241,7 +241,8 @@ nouveau_connector_detect(struct drm_connector *connector)
 	if (nv_encoder && nv_connector->native_mode) {
 	if (nv_encoder && nv_connector->native_mode) {
 		unsigned status = connector_status_connected;
 		unsigned status = connector_status_connected;
 
 
-#ifdef CONFIG_ACPI
+#if defined(CONFIG_ACPI_BUTTON) || \
+	(defined(CONFIG_ACPI_BUTTON_MODULE) && defined(MODULE))
 		if (!nouveau_ignorelid && !acpi_lid_open())
 		if (!nouveau_ignorelid && !acpi_lid_open())
 			status = connector_status_unknown;
 			status = connector_status_unknown;
 #endif
 #endif

+ 7 - 1
drivers/gpu/drm/nouveau/nv40_graph.c

@@ -253,7 +253,11 @@ nv40_graph_init(struct drm_device *dev)
 
 
 	if (!dev_priv->engine.graph.ctxprog) {
 	if (!dev_priv->engine.graph.ctxprog) {
 		struct nouveau_grctx ctx = {};
 		struct nouveau_grctx ctx = {};
-		uint32_t cp[256];
+		uint32_t *cp;
+
+		cp = kmalloc(sizeof(*cp) * 256, GFP_KERNEL);
+		if (!cp)
+			return -ENOMEM;
 
 
 		ctx.dev = dev;
 		ctx.dev = dev;
 		ctx.mode = NOUVEAU_GRCTX_PROG;
 		ctx.mode = NOUVEAU_GRCTX_PROG;
@@ -265,6 +269,8 @@ nv40_graph_init(struct drm_device *dev)
 		nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0);
 		nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0);
 		for (i = 0; i < ctx.ctxprog_len; i++)
 		for (i = 0; i < ctx.ctxprog_len; i++)
 			nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA, cp[i]);
 			nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA, cp[i]);
+
+		kfree(cp);
 	}
 	}
 
 
 	/* No context present currently */
 	/* No context present currently */

+ 1 - 0
drivers/gpu/drm/radeon/atombios_crtc.c

@@ -707,6 +707,7 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode
 		break;
 		break;
 	case ATOM_DCPLL:
 	case ATOM_DCPLL:
 	case ATOM_PPLL_INVALID:
 	case ATOM_PPLL_INVALID:
+	default:
 		pll = &rdev->clock.dcpll;
 		pll = &rdev->clock.dcpll;
 		break;
 		break;
 	}
 	}

+ 1 - 0
drivers/gpu/drm/radeon/radeon.h

@@ -576,6 +576,7 @@ typedef int (*radeon_packet3_check_t)(struct radeon_cs_parser *p,
  */
  */
 int radeon_agp_init(struct radeon_device *rdev);
 int radeon_agp_init(struct radeon_device *rdev);
 void radeon_agp_resume(struct radeon_device *rdev);
 void radeon_agp_resume(struct radeon_device *rdev);
+void radeon_agp_suspend(struct radeon_device *rdev);
 void radeon_agp_fini(struct radeon_device *rdev);
 void radeon_agp_fini(struct radeon_device *rdev);
 
 
 
 

+ 5 - 0
drivers/gpu/drm/radeon/radeon_agp.c

@@ -270,3 +270,8 @@ void radeon_agp_fini(struct radeon_device *rdev)
 	}
 	}
 #endif
 #endif
 }
 }
+
+void radeon_agp_suspend(struct radeon_device *rdev)
+{
+	radeon_agp_fini(rdev);
+}

+ 11 - 2
drivers/gpu/drm/radeon/radeon_atombios.c

@@ -680,10 +680,18 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
 	uint8_t dac;
 	uint8_t dac;
 	union atom_supported_devices *supported_devices;
 	union atom_supported_devices *supported_devices;
 	int i, j, max_device;
 	int i, j, max_device;
-	struct bios_connector bios_connectors[ATOM_MAX_SUPPORTED_DEVICE];
+	struct bios_connector *bios_connectors;
+	size_t bc_size = sizeof(*bios_connectors) * ATOM_MAX_SUPPORTED_DEVICE;
 
 
-	if (!atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset))
+	bios_connectors = kzalloc(bc_size, GFP_KERNEL);
+	if (!bios_connectors)
+		return false;
+
+	if (!atom_parse_data_header(ctx, index, &size, &frev, &crev,
+				    &data_offset)) {
+		kfree(bios_connectors);
 		return false;
 		return false;
+	}
 
 
 	supported_devices =
 	supported_devices =
 	    (union atom_supported_devices *)(ctx->bios + data_offset);
 	    (union atom_supported_devices *)(ctx->bios + data_offset);
@@ -851,6 +859,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
 
 
 	radeon_link_encoder_connector(dev);
 	radeon_link_encoder_connector(dev);
 
 
+	kfree(bios_connectors);
 	return true;
 	return true;
 }
 }
 
 

+ 2 - 0
drivers/gpu/drm/radeon/radeon_device.c

@@ -754,6 +754,8 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
 	/* evict remaining vram memory */
 	/* evict remaining vram memory */
 	radeon_bo_evict_vram(rdev);
 	radeon_bo_evict_vram(rdev);
 
 
+	radeon_agp_suspend(rdev);
+
 	pci_save_state(dev->pdev);
 	pci_save_state(dev->pdev);
 	if (state.event == PM_EVENT_SUSPEND) {
 	if (state.event == PM_EVENT_SUSPEND) {
 		/* Shut down the device */
 		/* Shut down the device */