Sophie

Sophie

distrib > CentOS > 5 > x86_64 > by-pkgid > ea32411352494358b8d75a78402a4713 > files > 3607

kernel-2.6.18-238.19.1.el5.centos.plus.src.rpm

From: Dean Nelson <dnelson@redhat.com>
Date: Wed, 26 May 2010 13:17:08 -0400
Subject: [pci] fix return value from pcix_get_max_mmrbc()
Message-id: <20100526131708.5326.10102.send-patch@localhost.localdomain>
Patchwork-id: 25811
O-Subject: [RHEL5.6 PATCH 2/4] PCI: fix return value from pcix_get_max_mmrbc()
Bugzilla: 578492
RH-Acked-by: Prarit Bhargava <prarit@redhat.com>
RH-Acked-by: Don Dutile <ddutile@redhat.com>

Resolves RHBZ 578492.

For the PCI_X_STATUS register, pcix_get_max_mmrbc() is returning an incorrect
value, which is based on:

	(stat & PCI_X_STATUS_MAX_READ) >> 12

Valid return values are 512, 1024, 2048, 4096, which correspond to a 'stat'
(masked and right shifted by 21) of 0, 1, 2, 3, respectively.

A right shift by 11 would generate the correct return value when 'stat' (masked
and right shifted by 21) has a value of 1 or 2. But for a value of 0 or 3 it's
not possible to generate the correct return value by only right shifting.

Fix is based on pcix_get_mmrbc()'s similar dealings with the PCI_X_CMD register.

Backport of upstream commit:
http://git.kernel.org/linus/25daeb550b69e89aff59bc6a84218a12b5203531


diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c9b4b18..0bf6fed 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1631,7 +1631,7 @@ pcix_get_max_mmrbc(struct pci_dev *dev)
 	if (err)
 		return -EINVAL;
 
-	return (stat & PCI_X_STATUS_MAX_READ) >> 12;
+	return 512 << ((stat & PCI_X_STATUS_MAX_READ) >> 21);
 }
 EXPORT_SYMBOL(pcix_get_max_mmrbc);