From: Greg Kroah-Hartman Date: Wed, 26 Sep 2012 23:05:06 +0000 (-0700) Subject: 3.5-stable patches X-Git-Tag: v3.0.44~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a47421b177d0eaf2ac49540729d8bba4a70ed57;p=thirdparty%2Fkernel%2Fstable-queue.git 3.5-stable patches added patches: drm-radeon-implement-acpi-vfct-vbios-fetch-v3.patch drm-radeon-kms-extend-the-fujitsu-d3003-s2-board-connector-quirk-to-cover-later-silicon-stepping.patch drm-radeon-split-atrm-support-out-from-the-atpx-handler-v3.patch --- diff --git a/queue-3.5/drm-radeon-implement-acpi-vfct-vbios-fetch-v3.patch b/queue-3.5/drm-radeon-implement-acpi-vfct-vbios-fetch-v3.patch new file mode 100644 index 00000000000..72db2be1874 --- /dev/null +++ b/queue-3.5/drm-radeon-implement-acpi-vfct-vbios-fetch-v3.patch @@ -0,0 +1,109 @@ +From 268ba0a99f89a84dc5eb312470896113d0709c74 Mon Sep 17 00:00:00 2001 +From: David Lamparter +Date: Thu, 16 Aug 2012 15:45:20 -0400 +Subject: drm/radeon: implement ACPI VFCT vbios fetch (v3) + +From: David Lamparter + +commit 268ba0a99f89a84dc5eb312470896113d0709c74 upstream. + +This is required for pure UEFI systems. The vbios is stored +in ACPI rather than at the legacy vga location. + +Fixes: +https://bugs.freedesktop.org/show_bug.cgi?id=26891 + +V2: fix #ifdefs as per Greg's comments +V3: fix it harder + +Signed-off-by: Alex Deucher +Reviewed-by: Jerome Glisse +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/radeon_bios.c | 60 +++++++++++++++++++++++++++++++++++ + 1 file changed, 60 insertions(+) + +--- a/drivers/gpu/drm/radeon/radeon_bios.c ++++ b/drivers/gpu/drm/radeon/radeon_bios.c +@@ -32,6 +32,7 @@ + + #include + #include ++#include + /* + * BIOS. + */ +@@ -548,6 +549,63 @@ static bool radeon_read_disabled_bios(st + return legacy_read_disabled_bios(rdev); + } + ++#ifdef CONFIG_ACPI ++static bool radeon_acpi_vfct_bios(struct radeon_device *rdev) ++{ ++ bool ret = false; ++ struct acpi_table_header *hdr; ++ /* acpi_get_table_with_size is not exported :( */ ++ acpi_size tbl_size = 0x7fffffff; ++ UEFI_ACPI_VFCT *vfct; ++ GOP_VBIOS_CONTENT *vbios; ++ VFCT_IMAGE_HEADER *vhdr; ++ ++ if (!ACPI_SUCCESS(acpi_get_table("VFCT", 1, &hdr))) ++ return false; ++ if (tbl_size < sizeof(UEFI_ACPI_VFCT)) { ++ DRM_ERROR("ACPI VFCT table present but broken (too short #1)\n"); ++ goto out_unmap; ++ } ++ ++ vfct = (UEFI_ACPI_VFCT *)hdr; ++ if (vfct->VBIOSImageOffset + sizeof(VFCT_IMAGE_HEADER) > tbl_size) { ++ DRM_ERROR("ACPI VFCT table present but broken (too short #2)\n"); ++ goto out_unmap; ++ } ++ ++ vbios = (GOP_VBIOS_CONTENT *)((char *)hdr + vfct->VBIOSImageOffset); ++ vhdr = &vbios->VbiosHeader; ++ DRM_INFO("ACPI VFCT contains a BIOS for %02x:%02x.%d %04x:%04x, size %d\n", ++ vhdr->PCIBus, vhdr->PCIDevice, vhdr->PCIFunction, ++ vhdr->VendorID, vhdr->DeviceID, vhdr->ImageLength); ++ ++ if (vhdr->PCIBus != rdev->pdev->bus->number || ++ vhdr->PCIDevice != PCI_SLOT(rdev->pdev->devfn) || ++ vhdr->PCIFunction != PCI_FUNC(rdev->pdev->devfn) || ++ vhdr->VendorID != rdev->pdev->vendor || ++ vhdr->DeviceID != rdev->pdev->device) { ++ DRM_INFO("ACPI VFCT table is not for this card\n"); ++ goto out_unmap; ++ }; ++ ++ if (vfct->VBIOSImageOffset + sizeof(VFCT_IMAGE_HEADER) + vhdr->ImageLength > tbl_size) { ++ DRM_ERROR("ACPI VFCT image truncated\n"); ++ goto out_unmap; ++ } ++ ++ rdev->bios = kmemdup(&vbios->VbiosContent, vhdr->ImageLength, GFP_KERNEL); ++ ret = !!rdev->bios; ++ ++out_unmap: ++ /* uh, no idea what to do here... */ ++ return ret; ++} ++#else ++static inline bool radeon_acpi_vfct_bios(struct radeon_device *rdev) ++{ ++ return false; ++} ++#endif + + bool radeon_get_bios(struct radeon_device *rdev) + { +@@ -556,6 +614,8 @@ bool radeon_get_bios(struct radeon_devic + + r = radeon_atrm_get_bios(rdev); + if (r == false) ++ r = radeon_acpi_vfct_bios(rdev); ++ if (r == false) + r = igp_read_bios_from_vram(rdev); + if (r == false) + r = radeon_read_bios(rdev); diff --git a/queue-3.5/drm-radeon-kms-extend-the-fujitsu-d3003-s2-board-connector-quirk-to-cover-later-silicon-stepping.patch b/queue-3.5/drm-radeon-kms-extend-the-fujitsu-d3003-s2-board-connector-quirk-to-cover-later-silicon-stepping.patch new file mode 100644 index 00000000000..c6fe3c10bf3 --- /dev/null +++ b/queue-3.5/drm-radeon-kms-extend-the-fujitsu-d3003-s2-board-connector-quirk-to-cover-later-silicon-stepping.patch @@ -0,0 +1,32 @@ +From 52e9b39d9a89ae33662596bd30e62dd56bddbe73 Mon Sep 17 00:00:00 2001 +From: Tvrtko Ursulin +Date: Mon, 20 Aug 2012 15:16:04 +0100 +Subject: drm/radeon/kms: extend the Fujitsu D3003-S2 board connector quirk to cover later silicon stepping + +From: Tvrtko Ursulin + +commit 52e9b39d9a89ae33662596bd30e62dd56bddbe73 upstream. + +There is a more recent APU stepping with a new PCI ID +shipping in the same board by Fujitsu which needs the +same quirk to correctly mark the back plane connectors. + +Signed-off-by: Tvrtko Ursulin +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/radeon_atombios.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/radeon/radeon_atombios.c ++++ b/drivers/gpu/drm/radeon/radeon_atombios.c +@@ -452,7 +452,7 @@ static bool radeon_atom_apply_quirks(str + } + + /* Fujitsu D3003-S2 board lists DVI-I as DVI-D and VGA */ +- if ((dev->pdev->device == 0x9802) && ++ if (((dev->pdev->device == 0x9802) || (dev->pdev->device == 0x9806)) && + (dev->pdev->subsystem_vendor == 0x1734) && + (dev->pdev->subsystem_device == 0x11bd)) { + if (*connector_type == DRM_MODE_CONNECTOR_VGA) { diff --git a/queue-3.5/drm-radeon-split-atrm-support-out-from-the-atpx-handler-v3.patch b/queue-3.5/drm-radeon-split-atrm-support-out-from-the-atpx-handler-v3.patch new file mode 100644 index 00000000000..f988a352d6d --- /dev/null +++ b/queue-3.5/drm-radeon-split-atrm-support-out-from-the-atpx-handler-v3.patch @@ -0,0 +1,245 @@ +From c61e2775873f603148e8e998a938721b7d222d24 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Thu, 16 Aug 2012 15:39:09 -0400 +Subject: drm/radeon: split ATRM support out from the ATPX handler (v3) + +From: Alex Deucher + +commit c61e2775873f603148e8e998a938721b7d222d24 upstream. + +There are systems that use ATRM, but not ATPX. + +Fixes: +https://bugs.freedesktop.org/show_bug.cgi?id=41265 + +V2: fix #ifdefs as per Greg's comments +V3: fix it harder + +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/radeon.h | 15 ----- + drivers/gpu/drm/radeon/radeon_atpx_handler.c | 56 ------------------ + drivers/gpu/drm/radeon/radeon_bios.c | 80 +++++++++++++++++++++++++-- + 3 files changed, 77 insertions(+), 74 deletions(-) + +--- a/drivers/gpu/drm/radeon/radeon.h ++++ b/drivers/gpu/drm/radeon/radeon.h +@@ -143,21 +143,6 @@ struct radeon_device; + /* + * BIOS. + */ +-#define ATRM_BIOS_PAGE 4096 +- +-#if defined(CONFIG_VGA_SWITCHEROO) +-bool radeon_atrm_supported(struct pci_dev *pdev); +-int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len); +-#else +-static inline bool radeon_atrm_supported(struct pci_dev *pdev) +-{ +- return false; +-} +- +-static inline int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len){ +- return -EINVAL; +-} +-#endif + bool radeon_get_bios(struct radeon_device *rdev); + + +--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c ++++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c +@@ -30,57 +30,8 @@ static struct radeon_atpx_priv { + /* handle for device - and atpx */ + acpi_handle dhandle; + acpi_handle atpx_handle; +- acpi_handle atrm_handle; + } radeon_atpx_priv; + +-/* retrieve the ROM in 4k blocks */ +-static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t *bios, +- int offset, int len) +-{ +- acpi_status status; +- union acpi_object atrm_arg_elements[2], *obj; +- struct acpi_object_list atrm_arg; +- struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL}; +- +- atrm_arg.count = 2; +- atrm_arg.pointer = &atrm_arg_elements[0]; +- +- atrm_arg_elements[0].type = ACPI_TYPE_INTEGER; +- atrm_arg_elements[0].integer.value = offset; +- +- atrm_arg_elements[1].type = ACPI_TYPE_INTEGER; +- atrm_arg_elements[1].integer.value = len; +- +- status = acpi_evaluate_object(atrm_handle, NULL, &atrm_arg, &buffer); +- if (ACPI_FAILURE(status)) { +- printk("failed to evaluate ATRM got %s\n", acpi_format_exception(status)); +- return -ENODEV; +- } +- +- obj = (union acpi_object *)buffer.pointer; +- memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length); +- len = obj->buffer.length; +- kfree(buffer.pointer); +- return len; +-} +- +-bool radeon_atrm_supported(struct pci_dev *pdev) +-{ +- /* get the discrete ROM only via ATRM */ +- if (!radeon_atpx_priv.atpx_detected) +- return false; +- +- if (radeon_atpx_priv.dhandle == DEVICE_ACPI_HANDLE(&pdev->dev)) +- return false; +- return true; +-} +- +- +-int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len) +-{ +- return radeon_atrm_call(radeon_atpx_priv.atrm_handle, bios, offset, len); +-} +- + static int radeon_atpx_get_version(acpi_handle handle) + { + acpi_status status; +@@ -198,7 +149,7 @@ static int radeon_atpx_power_state(enum + + static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) + { +- acpi_handle dhandle, atpx_handle, atrm_handle; ++ acpi_handle dhandle, atpx_handle; + acpi_status status; + + dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); +@@ -209,13 +160,8 @@ static bool radeon_atpx_pci_probe_handle + if (ACPI_FAILURE(status)) + return false; + +- status = acpi_get_handle(dhandle, "ATRM", &atrm_handle); +- if (ACPI_FAILURE(status)) +- return false; +- + radeon_atpx_priv.dhandle = dhandle; + radeon_atpx_priv.atpx_handle = atpx_handle; +- radeon_atpx_priv.atrm_handle = atrm_handle; + return true; + } + +--- a/drivers/gpu/drm/radeon/radeon_bios.c ++++ b/drivers/gpu/drm/radeon/radeon_bios.c +@@ -98,16 +98,81 @@ static bool radeon_read_bios(struct rade + return true; + } + ++#ifdef CONFIG_ACPI + /* ATRM is used to get the BIOS on the discrete cards in + * dual-gpu systems. + */ ++/* retrieve the ROM in 4k blocks */ ++#define ATRM_BIOS_PAGE 4096 ++/** ++ * radeon_atrm_call - fetch a chunk of the vbios ++ * ++ * @atrm_handle: acpi ATRM handle ++ * @bios: vbios image pointer ++ * @offset: offset of vbios image data to fetch ++ * @len: length of vbios image data to fetch ++ * ++ * Executes ATRM to fetch a chunk of the discrete ++ * vbios image on PX systems (all asics). ++ * Returns the length of the buffer fetched. ++ */ ++static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t *bios, ++ int offset, int len) ++{ ++ acpi_status status; ++ union acpi_object atrm_arg_elements[2], *obj; ++ struct acpi_object_list atrm_arg; ++ struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL}; ++ ++ atrm_arg.count = 2; ++ atrm_arg.pointer = &atrm_arg_elements[0]; ++ ++ atrm_arg_elements[0].type = ACPI_TYPE_INTEGER; ++ atrm_arg_elements[0].integer.value = offset; ++ ++ atrm_arg_elements[1].type = ACPI_TYPE_INTEGER; ++ atrm_arg_elements[1].integer.value = len; ++ ++ status = acpi_evaluate_object(atrm_handle, NULL, &atrm_arg, &buffer); ++ if (ACPI_FAILURE(status)) { ++ printk("failed to evaluate ATRM got %s\n", acpi_format_exception(status)); ++ return -ENODEV; ++ } ++ ++ obj = (union acpi_object *)buffer.pointer; ++ memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length); ++ len = obj->buffer.length; ++ kfree(buffer.pointer); ++ return len; ++} ++ + static bool radeon_atrm_get_bios(struct radeon_device *rdev) + { + int ret; + int size = 256 * 1024; + int i; ++ struct pci_dev *pdev = NULL; ++ acpi_handle dhandle, atrm_handle; ++ acpi_status status; ++ bool found = false; + +- if (!radeon_atrm_supported(rdev->pdev)) ++ /* ATRM is for the discrete card only */ ++ if (rdev->flags & RADEON_IS_IGP) ++ return false; ++ ++ while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { ++ dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); ++ if (!dhandle) ++ continue; ++ ++ status = acpi_get_handle(dhandle, "ATRM", &atrm_handle); ++ if (!ACPI_FAILURE(status)) { ++ found = true; ++ break; ++ } ++ } ++ ++ if (!found) + return false; + + rdev->bios = kmalloc(size, GFP_KERNEL); +@@ -117,9 +182,10 @@ static bool radeon_atrm_get_bios(struct + } + + for (i = 0; i < size / ATRM_BIOS_PAGE; i++) { +- ret = radeon_atrm_get_bios_chunk(rdev->bios, +- (i * ATRM_BIOS_PAGE), +- ATRM_BIOS_PAGE); ++ ret = radeon_atrm_call(atrm_handle, ++ rdev->bios, ++ (i * ATRM_BIOS_PAGE), ++ ATRM_BIOS_PAGE); + if (ret < ATRM_BIOS_PAGE) + break; + } +@@ -130,6 +196,12 @@ static bool radeon_atrm_get_bios(struct + } + return true; + } ++#else ++static inline bool radeon_atrm_get_bios(struct radeon_device *rdev) ++{ ++ return false; ++} ++#endif + + static bool ni_read_disabled_bios(struct radeon_device *rdev) + { diff --git a/queue-3.5/series b/queue-3.5/series index 615a4d6dcdd..b3efc18a058 100644 --- a/queue-3.5/series +++ b/queue-3.5/series @@ -181,3 +181,6 @@ fbcon-fix-race-condition-between-console-lock-and-cursor-timer-v1.1.patch drm-radeon-avoid-turning-off-spread-spectrum-for-used-pll.patch drm-radeon-ss-use-num_crtc-rather-than-hardcoded-6.patch drm-radeon-fence-virtual-address-and-free-it-once-idle-v4.patch +drm-radeon-split-atrm-support-out-from-the-atpx-handler-v3.patch +drm-radeon-implement-acpi-vfct-vbios-fetch-v3.patch +drm-radeon-kms-extend-the-fujitsu-d3003-s2-board-connector-quirk-to-cover-later-silicon-stepping.patch