PCI updates - handle resource flags correctly
PATCH 1/1 PCI updates - handle resource flags correctly
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.
drivers/pci/pci.c +3 -1
@@ -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 ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html