aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/quirks.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/quirks.c')
-rw-r--r--drivers/pnp/quirks.c100
1 files changed, 65 insertions, 35 deletions
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 4065139753b6..37993206ae5d 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -17,7 +17,6 @@
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/pnp.h> 18#include <linux/pnp.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/dmi.h>
21#include <linux/kallsyms.h> 20#include <linux/kallsyms.h>
22#include "base.h" 21#include "base.h"
23 22
@@ -109,42 +108,73 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev)
109 "pnp: SB audio device quirk - increasing port range\n"); 108 "pnp: SB audio device quirk - increasing port range\n");
110} 109}
111 110
112static void quirk_supermicro_h8dce_system(struct pnp_dev *dev) 111
112#include <linux/pci.h>
113
114static void quirk_system_pci_resources(struct pnp_dev *dev)
113{ 115{
114 int i; 116 struct pci_dev *pdev = NULL;
115 static struct dmi_system_id supermicro_h8dce[] = { 117 resource_size_t pnp_start, pnp_end, pci_start, pci_end;
116 { 118 int i, j;
117 .ident = "Supermicro H8DCE",
118 .matches = {
119 DMI_MATCH(DMI_SYS_VENDOR, "Supermicro"),
120 DMI_MATCH(DMI_PRODUCT_NAME, "H8DCE"),
121 },
122 },
123 { }
124 };
125
126 if (!dmi_check_system(supermicro_h8dce))
127 return;
128 119
129 /* 120 /*
130 * On the Supermicro H8DCE, there's a system device with resources 121 * Some BIOSes have PNP motherboard devices with resources that
131 * that overlap BAR 6 of the built-in SATA PCI adapter. If the PNP 122 * partially overlap PCI BARs. The PNP system driver claims these
132 * system device claims them, the sata_nv driver won't be able to. 123 * motherboard resources, which prevents the normal PCI driver from
133 * More details at: 124 * requesting them later.
134 * https://bugzilla.redhat.com/show_bug.cgi?id=280641 125 *
135 * https://bugzilla.redhat.com/show_bug.cgi?id=313491 126 * This patch disables the PNP resources that conflict with PCI BARs
136 * http://lkml.org/lkml/2008/1/9/449 127 * so they won't be claimed by the PNP system driver.
137 * http://thread.gmane.org/gmane.linux.acpi.devel/27312
138 */ 128 */
139 for (i = 0; i < PNP_MAX_MEM; i++) { 129 for_each_pci_dev(pdev) {
140 if (pnp_mem_valid(dev, i) && pnp_mem_len(dev, i) && 130 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
141 (pnp_mem_start(dev, i) & 0xdfef0000) == 0xdfef0000) { 131 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM) ||
142 dev_warn(&dev->dev, "disabling 0x%llx-0x%llx to prevent" 132 pci_resource_len(pdev, i) == 0)
143 " conflict with sata_nv PCI device\n", 133 continue;
144 (unsigned long long) pnp_mem_start(dev, i), 134
145 (unsigned long long) (pnp_mem_start(dev, i) + 135 pci_start = pci_resource_start(pdev, i);
146 pnp_mem_len(dev, i) - 1)); 136 pci_end = pci_resource_end(pdev, i);
147 pnp_mem_flags(dev, i) = 0; 137 for (j = 0; j < PNP_MAX_MEM; j++) {
138 if (!pnp_mem_valid(dev, j) ||
139 pnp_mem_len(dev, j) == 0)
140 continue;
141
142 pnp_start = pnp_mem_start(dev, j);
143 pnp_end = pnp_mem_end(dev, j);
144
145 /*
146 * If the PNP region doesn't overlap the PCI
147 * region at all, there's no problem.
148 */
149 if (pnp_end < pci_start || pnp_start > pci_end)
150 continue;
151
152 /*
153 * If the PNP region completely encloses (or is
154 * at least as large as) the PCI region, that's
155 * also OK. For example, this happens when the
156 * PNP device describes a bridge with PCI
157 * behind it.
158 */
159 if (pnp_start <= pci_start &&
160 pnp_end >= pci_end)
161 continue;
162
163 /*
164 * Otherwise, the PNP region overlaps *part* of
165 * the PCI region, and that might prevent a PCI
166 * driver from requesting its resources.
167 */
168 dev_warn(&dev->dev, "mem resource "
169 "(0x%llx-0x%llx) overlaps %s BAR %d "
170 "(0x%llx-0x%llx), disabling\n",
171 (unsigned long long) pnp_start,
172 (unsigned long long) pnp_end,
173 pci_name(pdev), i,
174 (unsigned long long) pci_start,
175 (unsigned long long) pci_end);
176 pnp_mem_flags(dev, j) = 0;
177 }
148 } 178 }
149 } 179 }
150} 180}
@@ -169,8 +199,8 @@ static struct pnp_fixup pnp_fixups[] = {
169 {"CTL0043", quirk_sb16audio_resources}, 199 {"CTL0043", quirk_sb16audio_resources},
170 {"CTL0044", quirk_sb16audio_resources}, 200 {"CTL0044", quirk_sb16audio_resources},
171 {"CTL0045", quirk_sb16audio_resources}, 201 {"CTL0045", quirk_sb16audio_resources},
172 {"PNP0c01", quirk_supermicro_h8dce_system}, 202 {"PNP0c01", quirk_system_pci_resources},
173 {"PNP0c02", quirk_supermicro_h8dce_system}, 203 {"PNP0c02", quirk_system_pci_resources},
174 {""} 204 {""}
175}; 205};
176 206