@@ -662,11 +662,11 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2033, quirk_no_aersid);
662
662
*/
663
663
static void pci_amd_enable_64bit_bar (struct pci_dev * dev )
664
664
{
665
+ static const char * name = "PCI Bus 0000:00" ;
666
+ struct resource * res , * conflict ;
665
667
u32 base , limit , high ;
666
668
struct pci_dev * other ;
667
- struct resource * res ;
668
669
unsigned i ;
669
- int r ;
670
670
671
671
if (!(pci_probe & PCI_BIG_ROOT_WINDOW ))
672
672
return ;
@@ -707,21 +707,26 @@ static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
707
707
* Allocate a 256GB window directly below the 0xfd00000000 hardware
708
708
* limit (see AMD Family 15h Models 30h-3Fh BKDG, sec 2.4.6).
709
709
*/
710
- res -> name = "PCI Bus 0000:00" ;
710
+ res -> name = name ;
711
711
res -> flags = IORESOURCE_PREFETCH | IORESOURCE_MEM |
712
712
IORESOURCE_MEM_64 | IORESOURCE_WINDOW ;
713
713
res -> start = 0xbd00000000ull ;
714
714
res -> end = 0xfd00000000ull - 1 ;
715
715
716
- r = request_resource (& iomem_resource , res );
717
- if (r ) {
716
+ conflict = request_resource_conflict (& iomem_resource , res );
717
+ if (conflict ) {
718
718
kfree (res );
719
- return ;
720
- }
719
+ if ( conflict -> name != name )
720
+ return ;
721
721
722
- dev_info (& dev -> dev , "adding root bus resource %pR (tainting kernel)\n" ,
723
- res );
724
- add_taint (TAINT_FIRMWARE_WORKAROUND , LOCKDEP_STILL_OK );
722
+ /* We are resuming from suspend; just reenable the window */
723
+ res = conflict ;
724
+ } else {
725
+ dev_info (& dev -> dev , "adding root bus resource %pR (tainting kernel)\n" ,
726
+ res );
727
+ add_taint (TAINT_FIRMWARE_WORKAROUND , LOCKDEP_STILL_OK );
728
+ pci_bus_add_resource (dev -> bus , res , 0 );
729
+ }
725
730
726
731
base = ((res -> start >> 8 ) & AMD_141b_MMIO_BASE_MMIOBASE_MASK ) |
727
732
AMD_141b_MMIO_BASE_RE_MASK | AMD_141b_MMIO_BASE_WE_MASK ;
@@ -733,13 +738,16 @@ static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
733
738
pci_write_config_dword (dev , AMD_141b_MMIO_HIGH (i ), high );
734
739
pci_write_config_dword (dev , AMD_141b_MMIO_LIMIT (i ), limit );
735
740
pci_write_config_dword (dev , AMD_141b_MMIO_BASE (i ), base );
736
-
737
- pci_bus_add_resource (dev -> bus , res , 0 );
738
741
}
739
742
DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_AMD , 0x1401 , pci_amd_enable_64bit_bar );
740
743
DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_AMD , 0x141b , pci_amd_enable_64bit_bar );
741
744
DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_AMD , 0x1571 , pci_amd_enable_64bit_bar );
742
745
DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_AMD , 0x15b1 , pci_amd_enable_64bit_bar );
743
746
DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_AMD , 0x1601 , pci_amd_enable_64bit_bar );
747
+ DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_AMD , 0x1401 , pci_amd_enable_64bit_bar );
748
+ DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_AMD , 0x141b , pci_amd_enable_64bit_bar );
749
+ DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_AMD , 0x1571 , pci_amd_enable_64bit_bar );
750
+ DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_AMD , 0x15b1 , pci_amd_enable_64bit_bar );
751
+ DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_AMD , 0x1601 , pci_amd_enable_64bit_bar );
744
752
745
753
#endif
0 commit comments