|
Lines 117-122
static void pci_mask_msix(device_t dev,
Link Here
|
| 117 |
static void pci_unmask_msix(device_t dev, u_int index); |
117 |
static void pci_unmask_msix(device_t dev, u_int index); |
| 118 |
static int pci_msi_blacklisted(void); |
118 |
static int pci_msi_blacklisted(void); |
| 119 |
static int pci_msix_blacklisted(void); |
119 |
static int pci_msix_blacklisted(void); |
|
|
120 |
static void pci_fix_asus_smbus(device_t dev); |
| 120 |
static void pci_resume_msi(device_t dev); |
121 |
static void pci_resume_msi(device_t dev); |
| 121 |
static void pci_resume_msix(device_t dev); |
122 |
static void pci_resume_msix(device_t dev); |
| 122 |
static int pci_remap_intr_method(device_t bus, device_t dev, |
123 |
static int pci_remap_intr_method(device_t bus, device_t dev, |
|
Lines 221-274
struct pci_quirk {
Link Here
|
| 221 |
#define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ |
222 |
#define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ |
| 222 |
#define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */ |
223 |
#define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */ |
| 223 |
#define PCI_QUIRK_MSI_INTX_BUG 6 /* PCIM_CMD_INTxDIS disables MSI */ |
224 |
#define PCI_QUIRK_MSI_INTX_BUG 6 /* PCIM_CMD_INTxDIS disables MSI */ |
|
|
225 |
#define PCI_QUIRK_FIXUP_ROUTINE 7 /* PCI needs a fix to continue */ |
| 224 |
int arg1; |
226 |
int arg1; |
| 225 |
int arg2; |
227 |
int arg2; |
|
|
228 |
void (*fixup_func)(device_t dev); |
| 226 |
}; |
229 |
}; |
| 227 |
|
230 |
|
| 228 |
static const struct pci_quirk pci_quirks[] = { |
231 |
static const struct pci_quirk pci_quirks[] = { |
| 229 |
/* The Intel 82371AB and 82443MX have a map register at offset 0x90. */ |
232 |
/* The Intel 82371AB and 82443MX have a map register at offset 0x90. */ |
| 230 |
{ 0x71138086, PCI_QUIRK_MAP_REG, 0x90, 0 }, |
233 |
{ 0x71138086, PCI_QUIRK_MAP_REG, 0x90, 0, NULL }, |
| 231 |
{ 0x719b8086, PCI_QUIRK_MAP_REG, 0x90, 0 }, |
234 |
{ 0x719b8086, PCI_QUIRK_MAP_REG, 0x90, 0, NULL }, |
| 232 |
/* As does the Serverworks OSB4 (the SMBus mapping register) */ |
235 |
/* As does the Serverworks OSB4 (the SMBus mapping register) */ |
| 233 |
{ 0x02001166, PCI_QUIRK_MAP_REG, 0x90, 0 }, |
236 |
{ 0x02001166, PCI_QUIRK_MAP_REG, 0x90, 0, NULL }, |
| 234 |
|
237 |
|
| 235 |
/* |
238 |
/* |
| 236 |
* MSI doesn't work with the ServerWorks CNB20-HE Host Bridge |
239 |
* MSI doesn't work with the ServerWorks CNB20-HE Host Bridge |
| 237 |
* or the CMIC-SL (AKA ServerWorks GC_LE). |
240 |
* or the CMIC-SL (AKA ServerWorks GC_LE). |
| 238 |
*/ |
241 |
*/ |
| 239 |
{ 0x00141166, PCI_QUIRK_DISABLE_MSI, 0, 0 }, |
242 |
{ 0x00141166, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, |
| 240 |
{ 0x00171166, PCI_QUIRK_DISABLE_MSI, 0, 0 }, |
243 |
{ 0x00171166, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, |
| 241 |
|
244 |
|
| 242 |
/* |
245 |
/* |
| 243 |
* MSI doesn't work on earlier Intel chipsets including |
246 |
* MSI doesn't work on earlier Intel chipsets including |
| 244 |
* E7500, E7501, E7505, 845, 865, 875/E7210, and 855. |
247 |
* E7500, E7501, E7505, 845, 865, 875/E7210, and 855. |
| 245 |
*/ |
248 |
*/ |
| 246 |
{ 0x25408086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, |
249 |
{ 0x25408086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, |
| 247 |
{ 0x254c8086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, |
250 |
{ 0x254c8086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, |
| 248 |
{ 0x25508086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, |
251 |
{ 0x25508086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, |
| 249 |
{ 0x25608086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, |
252 |
{ 0x25608086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, |
| 250 |
{ 0x25708086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, |
253 |
{ 0x25708086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, |
| 251 |
{ 0x25788086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, |
254 |
{ 0x25788086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, |
| 252 |
{ 0x35808086, PCI_QUIRK_DISABLE_MSI, 0, 0 }, |
255 |
{ 0x35808086, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, |
| 253 |
|
256 |
|
| 254 |
/* |
257 |
/* |
| 255 |
* MSI doesn't work with devices behind the AMD 8131 HT-PCIX |
258 |
* MSI doesn't work with devices behind the AMD 8131 HT-PCIX |
| 256 |
* bridge. |
259 |
* bridge. |
| 257 |
*/ |
260 |
*/ |
| 258 |
{ 0x74501022, PCI_QUIRK_DISABLE_MSI, 0, 0 }, |
261 |
{ 0x74501022, PCI_QUIRK_DISABLE_MSI, 0, 0, NULL }, |
| 259 |
|
262 |
|
| 260 |
/* |
263 |
/* |
| 261 |
* MSI-X allocation doesn't work properly for devices passed through |
264 |
* MSI-X allocation doesn't work properly for devices passed through |
| 262 |
* by VMware up to at least ESXi 5.1. |
265 |
* by VMware up to at least ESXi 5.1. |
| 263 |
*/ |
266 |
*/ |
| 264 |
{ 0x079015ad, PCI_QUIRK_DISABLE_MSIX, 0, 0 }, /* PCI/PCI-X */ |
267 |
{ 0x079015ad, PCI_QUIRK_DISABLE_MSIX, 0, 0, NULL }, /* PCI/PCI-X */ |
| 265 |
{ 0x07a015ad, PCI_QUIRK_DISABLE_MSIX, 0, 0 }, /* PCIe */ |
268 |
{ 0x07a015ad, PCI_QUIRK_DISABLE_MSIX, 0, 0, NULL }, /* PCIe */ |
| 266 |
|
269 |
|
| 267 |
/* |
270 |
/* |
| 268 |
* Some virtualization environments emulate an older chipset |
271 |
* Some virtualization environments emulate an older chipset |
| 269 |
* but support MSI just fine. QEMU uses the Intel 82440. |
272 |
* but support MSI just fine. QEMU uses the Intel 82440. |
| 270 |
*/ |
273 |
*/ |
| 271 |
{ 0x12378086, PCI_QUIRK_ENABLE_MSI_VM, 0, 0 }, |
274 |
{ 0x12378086, PCI_QUIRK_ENABLE_MSI_VM, 0, 0, NULL }, |
| 272 |
|
275 |
|
| 273 |
/* |
276 |
/* |
| 274 |
* HPET MMIO base address may appear in Bar1 for AMD SB600 SMBus |
277 |
* HPET MMIO base address may appear in Bar1 for AMD SB600 SMBus |
|
Lines 278-306
static const struct pci_quirk pci_quirks
Link Here
|
| 278 |
* For SB600 A21 and later, firmware must set the bit to hide it. |
281 |
* For SB600 A21 and later, firmware must set the bit to hide it. |
| 279 |
* For SB700 and later, it is unused and hardcoded to zero. |
282 |
* For SB700 and later, it is unused and hardcoded to zero. |
| 280 |
*/ |
283 |
*/ |
| 281 |
{ 0x43851002, PCI_QUIRK_UNMAP_REG, 0x14, 0 }, |
284 |
{ 0x43851002, PCI_QUIRK_UNMAP_REG, 0x14, 0, NULL }, |
| 282 |
|
285 |
|
| 283 |
/* |
286 |
/* |
| 284 |
* Atheros AR8161/AR8162/E2200/E2400/E2500 Ethernet controllers have |
287 |
* Atheros AR8161/AR8162/E2200/E2400/E2500 Ethernet controllers have |
| 285 |
* a bug that MSI interrupt does not assert if PCIM_CMD_INTxDIS bit |
288 |
* a bug that MSI interrupt does not assert if PCIM_CMD_INTxDIS bit |
| 286 |
* of the command register is set. |
289 |
* of the command register is set. |
| 287 |
*/ |
290 |
*/ |
| 288 |
{ 0x10911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, |
291 |
{ 0x10911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0, NULL }, |
| 289 |
{ 0xE0911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, |
292 |
{ 0xE0911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0, NULL }, |
| 290 |
{ 0xE0A11969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, |
293 |
{ 0xE0A11969, PCI_QUIRK_MSI_INTX_BUG, 0, 0, NULL }, |
| 291 |
{ 0xE0B11969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, |
294 |
{ 0xE0B11969, PCI_QUIRK_MSI_INTX_BUG, 0, 0, NULL }, |
| 292 |
{ 0x10901969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, |
295 |
{ 0x10901969, PCI_QUIRK_MSI_INTX_BUG, 0, 0, NULL }, |
| 293 |
|
296 |
|
| 294 |
/* |
297 |
/* |
| 295 |
* Broadcom BCM5714(S)/BCM5715(S)/BCM5780(S) Ethernet MACs don't |
298 |
* Broadcom BCM5714(S)/BCM5715(S)/BCM5780(S) Ethernet MACs don't |
| 296 |
* issue MSI interrupts with PCIM_CMD_INTxDIS set either. |
299 |
* issue MSI interrupts with PCIM_CMD_INTxDIS set either. |
| 297 |
*/ |
300 |
*/ |
| 298 |
{ 0x166814e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5714 */ |
301 |
{ 0x166814e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0, NULL }, /* BCM5714 */ |
| 299 |
{ 0x166914e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5714S */ |
302 |
{ 0x166914e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0, NULL }, /* BCM5714S */ |
| 300 |
{ 0x166a14e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5780 */ |
303 |
{ 0x166a14e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0, NULL }, /* BCM5780 */ |
| 301 |
{ 0x166b14e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5780S */ |
304 |
{ 0x166b14e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0, NULL }, /* BCM5780S */ |
| 302 |
{ 0x167814e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5715 */ |
305 |
{ 0x167814e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0, NULL }, /* BCM5715 */ |
| 303 |
{ 0x167914e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5715S */ |
306 |
{ 0x167914e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0, NULL }, /* BCM5715S */ |
|
|
307 |
|
| 308 |
/* |
| 309 |
* The ASUS P4B-motherboards needs a hack to enable the Intel 801SMBus |
| 310 |
*/ |
| 311 |
{ 0x24408086, PCI_QUIRK_FIXUP_ROUTINE, 0, 0, &pci_fix_asus_smbus }, |
| 312 |
{ 0x24C08086, PCI_QUIRK_FIXUP_ROUTINE, 0, 0, &pci_fix_asus_smbus }, |
| 304 |
|
313 |
|
| 305 |
{ 0 } |
314 |
{ 0 } |
| 306 |
}; |
315 |
}; |
|
Lines 585-590
pci_fixancient(pcicfgregs *cfg)
Link Here
|
| 585 |
cfg->hdrtype = PCIM_HDRTYPE_BRIDGE; |
594 |
cfg->hdrtype = PCIM_HDRTYPE_BRIDGE; |
| 586 |
} |
595 |
} |
| 587 |
|
596 |
|
|
|
597 |
/* asus p4b/p4pe hack */ |
| 598 |
|
| 599 |
static void |
| 600 |
pci_fix_asus_smbus(device_t dev) |
| 601 |
{ |
| 602 |
int pmccfg; |
| 603 |
|
| 604 |
/* read subsystem vendor-id */ |
| 605 |
pmccfg = pci_read_config(dev, 0xF2, 2); |
| 606 |
printf(" [-] pmccfg: %.4x\n",pmccfg); |
| 607 |
if( pmccfg & 0x8 ){ |
| 608 |
pmccfg &= ~0x8; |
| 609 |
pci_write_config(dev, 0xF2, pmccfg, 2); |
| 610 |
pmccfg = pci_read_config(dev, 0xF2, 2); |
| 611 |
if( pmccfg & 0x8 ) |
| 612 |
printf("Could not enable Intel 801SMBus!\n"); |
| 613 |
else |
| 614 |
printf("Enabled Intel 801SMBus\n"); |
| 615 |
} |
| 616 |
} |
| 617 |
|
| 588 |
/* extract header type specific config data */ |
618 |
/* extract header type specific config data */ |
| 589 |
|
619 |
|
| 590 |
static void |
620 |
static void |
|
Lines 3851-3856
pci_add_resources(device_t bus, device_t
Link Here
|
| 3851 |
* Skip quirked resources. |
3881 |
* Skip quirked resources. |
| 3852 |
*/ |
3882 |
*/ |
| 3853 |
for (q = &pci_quirks[0]; q->devid != 0; q++) |
3883 |
for (q = &pci_quirks[0]; q->devid != 0; q++) |
|
|
3884 |
if (q->devid == ((cfg->device << 16) | cfg->vendor)){ |
| 3885 |
if (q->type == PCI_QUIRK_MAP_REG) |
| 3886 |
pci_add_map(bus, dev, q->arg1, rl, force, 0); |
| 3887 |
else if (q->type == PCI_QUIRK_FIXUP_ROUTINE) |
| 3888 |
q->fixup_func(dev); |
| 3889 |
} |
| 3854 |
if (q->devid == devid && |
3890 |
if (q->devid == devid && |
| 3855 |
q->type == PCI_QUIRK_UNMAP_REG && |
3891 |
q->type == PCI_QUIRK_UNMAP_REG && |
| 3856 |
q->arg1 == PCIR_BAR(i)) |
3892 |
q->arg1 == PCIR_BAR(i)) |