Author: jhb
Date: Tue Dec  3 22:01:45 2019
New Revision: 355359
URL: https://svnweb.freebsd.org/changeset/base/355359

Log:
  MFC 342160: Work around BIOS quirks on HPE Proliant MicroServer Gen10
  
  PR:           221350

Modified:
  stable/12/sys/dev/pci/pci.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/dev/pci/pci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/dev/pci/pci.c
==============================================================================
--- stable/12/sys/dev/pci/pci.c Tue Dec  3 21:05:33 2019        (r355358)
+++ stable/12/sys/dev/pci/pci.c Tue Dec  3 22:01:45 2019        (r355359)
@@ -234,6 +234,7 @@ struct pci_quirk {
 #define        PCI_QUIRK_UNMAP_REG     4 /* Ignore PCI map register */
 #define        PCI_QUIRK_DISABLE_MSIX  5 /* MSI-X doesn't work */
 #define        PCI_QUIRK_MSI_INTX_BUG  6 /* PCIM_CMD_INTxDIS disables MSI */
+#define        PCI_QUIRK_REALLOC_BAR   7 /* Can't allocate memory at the 
default address */
        int     arg1;
        int     arg2;
 };
@@ -315,6 +316,12 @@ static const struct pci_quirk pci_quirks[] = {
        { 0x167814e4, PCI_QUIRK_MSI_INTX_BUG,   0,      0 }, /* BCM5715 */
        { 0x167914e4, PCI_QUIRK_MSI_INTX_BUG,   0,      0 }, /* BCM5715S */
 
+       /*
+        * HPE Gen 10 VGA has a memory range that can't be allocated in the
+        * expected place.
+        */
+       { 0x98741002, PCI_QUIRK_REALLOC_BAR,    0,      0 },
+
        { 0 }
 };
 
@@ -3293,7 +3300,9 @@ pci_add_map(device_t bus, device_t dev, int reg, struc
         */
        res = resource_list_reserve(rl, bus, dev, type, &reg, start, end, count,
            flags);
-       if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0)) {
+       if ((pci_do_realloc_bars
+               || pci_has_quirk(pci_get_devid(dev), PCI_QUIRK_REALLOC_BAR))
+           && res == NULL && (start != 0 || end != ~0)) {
                /*
                 * If the allocation fails, try to allocate a resource for
                 * this BAR using any available range.  The firmware felt
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to