mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] PCI updates - handle resource flags correctly
@ 2001-12-18 23:50 Russell King
  0 siblings, 0 replies; only message in thread
From: Russell King @ 2001-12-18 23:50 UTC (permalink / raw)
  To: linux-kernel

The following patch fixes a problem noticed on ARM while the generic PCI
code allocates bus addresses.

The region flags ended up containing some of the low-order bits of the IO
address that was read initially.  This carries over some of the old PCI
address bits after the PCI resource allocator has reassigned them.

Obviously not good.  The following patch correctly masks the resource flags
depending on the resource type.

This patch is being sent for only review at this time, but is ultimately
targeted at both the 2.4 and 2.5 kernel series.

diff -ur orig/drivers/pci/pci.c linux/drivers/pci/pci.c
--- orig/drivers/pci/pci.c	Fri Nov 23 10:12:15 2001
+++ linux/drivers/pci/pci.c	Tue Dec 18 19:31:15 2001
@@ -914,13 +914,15 @@
 			l = 0;
 		if ((l & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY) {
 			res->start = l & PCI_BASE_ADDRESS_MEM_MASK;
+			res->flags |= l & ~PCI_BASE_ADDRESS_MEM_MASK;
 			sz = pci_size(sz, PCI_BASE_ADDRESS_MEM_MASK);
 		} else {
 			res->start = l & PCI_BASE_ADDRESS_IO_MASK;
+			res->flags |= l & ~PCI_BASE_ADDRESS_IO_MASK;
 			sz = pci_size(sz, PCI_BASE_ADDRESS_IO_MASK & 0xffff);
 		}
 		res->end = res->start + (unsigned long) sz;
-		res->flags |= (l & 0xf) | pci_calc_resource_flags(l);
+		res->flags |= pci_calc_resource_flags(l);
 		if ((l & (PCI_BASE_ADDRESS_SPACE | PCI_BASE_ADDRESS_MEM_TYPE_MASK))
 		    == (PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64)) {
 			pci_read_config_dword(dev, reg+4, &l);


--
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-12-19 11:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-18 23:50 [PATCH] PCI updates - handle resource flags correctly Russell King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome