Skip to content

Commit 30e22b2

Browse files
committed
Merge branch 'pci/misc' into next
* pci/misc: PCI: Clean up quirk_io_region PCI: Use vma_pages() to replace (vm_end - vm_start) >> PAGE_SHIFT PCI: Use PCI_EXP_SLTCAP_PSN mask when extracting slot number PCI: Remove unnecessary dependencies between PME and ACPI [SCSI] mvumi: Use PCI_VENDOR_ID_MARVELL_EXT for 0x1b4b [SCSI] mvsas: Use PCI_VENDOR_ID_MARVELL_EXT for 0x1b4b ahci: Use PCI_VENDOR_ID_MARVELL_EXT for 0x1b4b PCI: Define macro for Marvell vendor ID PCI: Add MSI INTX_DISABLE quirks for AR8161/AR8162/AR8171/AR8172/E210X PCI: aer_inject: Fix return values when device not found
2 parents 26c0995 + 65195c7 commit 30e22b2

11 files changed

Lines changed: 80 additions & 104 deletions

File tree

‎drivers/ata/ahci.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,17 +413,17 @@ static const struct pci_device_id ahci_pci_tbl[] = {
413413
/* Marvell */
414414
{ PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */
415415
{ PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */
416-
{ PCI_DEVICE(0x1b4b, 0x9123),
416+
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9123),
417417
.class = PCI_CLASS_STORAGE_SATA_AHCI,
418418
.class_mask = 0xffffff,
419419
.driver_data = board_ahci_yes_fbs }, /* 88se9128 */
420-
{ PCI_DEVICE(0x1b4b, 0x9125),
420+
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9125),
421421
.driver_data = board_ahci_yes_fbs }, /* 88se9125 */
422-
{ PCI_DEVICE(0x1b4b, 0x917a),
422+
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x917a),
423423
.driver_data = board_ahci_yes_fbs }, /* 88se9172 */
424-
{ PCI_DEVICE(0x1b4b, 0x9192),
424+
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192),
425425
.driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */
426-
{ PCI_DEVICE(0x1b4b, 0x91a3),
426+
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3),
427427
.driver_data = board_ahci_yes_fbs },
428428

429429
/* Promise */

‎drivers/pci/hotplug/pciehp_acpi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static int __init dummy_probe(struct pcie_device *dev)
9090
slot = kzalloc(sizeof(*slot), GFP_KERNEL);
9191
if (!slot)
9292
return -ENOMEM;
93-
slot->number = slot_cap >> 19;
93+
slot->number = (slot_cap & PCI_EXP_SLTCAP_PSN) >> 19;
9494
list_for_each_entry(tmp, &dummy_slots, list) {
9595
if (tmp->number == slot->number)
9696
dup_slot_id++;

‎drivers/pci/pci-sysfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma,
897897

898898
if (pci_resource_len(pdev, resno) == 0)
899899
return 0;
900-
nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
900+
nr = vma_pages(vma);
901901
start = vma->vm_pgoff;
902902
size = ((pci_resource_len(pdev, resno) - 1) >> PAGE_SHIFT) + 1;
903903
pci_start = (mmap_api == PCI_MMAP_PROCFS) ?

‎drivers/pci/pcie/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ endchoice
8282

8383
config PCIE_PME
8484
def_bool y
85-
depends on PCIEPORTBUS && PM_RUNTIME && ACPI
85+
depends on PCIEPORTBUS && PM_RUNTIME

‎drivers/pci/pcie/aer/aer_inject.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,13 +334,13 @@ static int aer_inject(struct aer_error_inj *einj)
334334
return -ENODEV;
335335
rpdev = pcie_find_root_port(dev);
336336
if (!rpdev) {
337-
ret = -ENOTTY;
337+
ret = -ENODEV;
338338
goto out_put;
339339
}
340340

341341
pos_cap_err = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
342342
if (!pos_cap_err) {
343-
ret = -ENOTTY;
343+
ret = -EPERM;
344344
goto out_put;
345345
}
346346
pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_SEVER, &sever);
@@ -350,7 +350,7 @@ static int aer_inject(struct aer_error_inj *einj)
350350

351351
rp_pos_cap_err = pci_find_ext_capability(rpdev, PCI_EXT_CAP_ID_ERR);
352352
if (!rp_pos_cap_err) {
353-
ret = -ENOTTY;
353+
ret = -EPERM;
354354
goto out_put;
355355
}
356356

‎drivers/pci/pcie/pme.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include <linux/interrupt.h>
2020
#include <linux/device.h>
2121
#include <linux/pcieport_if.h>
22-
#include <linux/acpi.h>
23-
#include <linux/pci-acpi.h>
2422
#include <linux/pm_runtime.h>
2523

2624
#include "../pci.h"

‎drivers/pci/quirks.c‎

Lines changed: 63 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -324,29 +324,30 @@ static void quirk_cs5536_vsa(struct pci_dev *dev)
324324
}
325325
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, quirk_cs5536_vsa);
326326

327-
static void quirk_io_region(struct pci_dev *dev, unsigned region,
328-
unsigned size, int nr, const char *name)
327+
static void quirk_io_region(struct pci_dev *dev, int port,
328+
unsigned size, int nr, const char *name)
329329
{
330-
region &= ~(size-1);
331-
if (region) {
332-
struct pci_bus_region bus_region;
333-
struct resource *res = dev->resource + nr;
330+
u16 region;
331+
struct pci_bus_region bus_region;
332+
struct resource *res = dev->resource + nr;
334333

335-
res->name = pci_name(dev);
336-
res->start = region;
337-
res->end = region + size - 1;
338-
res->flags = IORESOURCE_IO;
334+
pci_read_config_word(dev, port, &region);
335+
region &= ~(size - 1);
339336

340-
/* Convert from PCI bus to resource space. */
341-
bus_region.start = res->start;
342-
bus_region.end = res->end;
343-
pcibios_bus_to_resource(dev, res, &bus_region);
337+
if (!region)
338+
return;
344339

345-
if (pci_claim_resource(dev, nr) == 0)
346-
dev_info(&dev->dev, "quirk: %pR claimed by %s\n",
347-
res, name);
348-
}
349-
}
340+
res->name = pci_name(dev);
341+
res->flags = IORESOURCE_IO;
342+
343+
/* Convert from PCI bus to resource space */
344+
bus_region.start = region;
345+
bus_region.end = region + size - 1;
346+
pcibios_bus_to_resource(dev, res, &bus_region);
347+
348+
if (!pci_claim_resource(dev, nr))
349+
dev_info(&dev->dev, "quirk: %pR claimed by %s\n", res, name);
350+
}
350351

351352
/*
352353
* ATI Northbridge setups MCE the processor if you even
@@ -374,12 +375,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100, quirk_ati_
374375
*/
375376
static void quirk_ali7101_acpi(struct pci_dev *dev)
376377
{
377-
u16 region;
378-
379-
pci_read_config_word(dev, 0xE0, &region);
380-
quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES, "ali7101 ACPI");
381-
pci_read_config_word(dev, 0xE2, &region);
382-
quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1, "ali7101 SMB");
378+
quirk_io_region(dev, 0xE0, 64, PCI_BRIDGE_RESOURCES, "ali7101 ACPI");
379+
quirk_io_region(dev, 0xE2, 32, PCI_BRIDGE_RESOURCES+1, "ali7101 SMB");
383380
}
384381
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, quirk_ali7101_acpi);
385382

@@ -442,12 +439,10 @@ static void piix4_mem_quirk(struct pci_dev *dev, const char *name, unsigned int
442439
*/
443440
static void quirk_piix4_acpi(struct pci_dev *dev)
444441
{
445-
u32 region, res_a;
442+
u32 res_a;
446443

447-
pci_read_config_dword(dev, 0x40, &region);
448-
quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES, "PIIX4 ACPI");
449-
pci_read_config_dword(dev, 0x90, &region);
450-
quirk_io_region(dev, region, 16, PCI_BRIDGE_RESOURCES+1, "PIIX4 SMB");
444+
quirk_io_region(dev, 0x40, 64, PCI_BRIDGE_RESOURCES, "PIIX4 ACPI");
445+
quirk_io_region(dev, 0x90, 16, PCI_BRIDGE_RESOURCES+1, "PIIX4 SMB");
451446

452447
/* Device resource A has enables for some of the other ones */
453448
pci_read_config_dword(dev, 0x5c, &res_a);
@@ -491,7 +486,6 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3, qui
491486
*/
492487
static void quirk_ich4_lpc_acpi(struct pci_dev *dev)
493488
{
494-
u32 region;
495489
u8 enable;
496490

497491
/*
@@ -503,22 +497,14 @@ static void quirk_ich4_lpc_acpi(struct pci_dev *dev)
503497
*/
504498

505499
pci_read_config_byte(dev, ICH_ACPI_CNTL, &enable);
506-
if (enable & ICH4_ACPI_EN) {
507-
pci_read_config_dword(dev, ICH_PMBASE, &region);
508-
region &= PCI_BASE_ADDRESS_IO_MASK;
509-
if (region >= PCIBIOS_MIN_IO)
510-
quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES,
511-
"ICH4 ACPI/GPIO/TCO");
512-
}
500+
if (enable & ICH4_ACPI_EN)
501+
quirk_io_region(dev, ICH_PMBASE, 128, PCI_BRIDGE_RESOURCES,
502+
"ICH4 ACPI/GPIO/TCO");
513503

514504
pci_read_config_byte(dev, ICH4_GPIO_CNTL, &enable);
515-
if (enable & ICH4_GPIO_EN) {
516-
pci_read_config_dword(dev, ICH4_GPIOBASE, &region);
517-
region &= PCI_BASE_ADDRESS_IO_MASK;
518-
if (region >= PCIBIOS_MIN_IO)
519-
quirk_io_region(dev, region, 64,
520-
PCI_BRIDGE_RESOURCES + 1, "ICH4 GPIO");
521-
}
505+
if (enable & ICH4_GPIO_EN)
506+
quirk_io_region(dev, ICH4_GPIOBASE, 64, PCI_BRIDGE_RESOURCES+1,
507+
"ICH4 GPIO");
522508
}
523509
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi);
524510
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi);
@@ -533,26 +519,17 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, qui
533519

534520
static void ich6_lpc_acpi_gpio(struct pci_dev *dev)
535521
{
536-
u32 region;
537522
u8 enable;
538523

539524
pci_read_config_byte(dev, ICH_ACPI_CNTL, &enable);
540-
if (enable & ICH6_ACPI_EN) {
541-
pci_read_config_dword(dev, ICH_PMBASE, &region);
542-
region &= PCI_BASE_ADDRESS_IO_MASK;
543-
if (region >= PCIBIOS_MIN_IO)
544-
quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES,
545-
"ICH6 ACPI/GPIO/TCO");
546-
}
525+
if (enable & ICH6_ACPI_EN)
526+
quirk_io_region(dev, ICH_PMBASE, 128, PCI_BRIDGE_RESOURCES,
527+
"ICH6 ACPI/GPIO/TCO");
547528

548529
pci_read_config_byte(dev, ICH6_GPIO_CNTL, &enable);
549-
if (enable & ICH6_GPIO_EN) {
550-
pci_read_config_dword(dev, ICH6_GPIOBASE, &region);
551-
region &= PCI_BASE_ADDRESS_IO_MASK;
552-
if (region >= PCIBIOS_MIN_IO)
553-
quirk_io_region(dev, region, 64,
554-
PCI_BRIDGE_RESOURCES + 1, "ICH6 GPIO");
555-
}
530+
if (enable & ICH6_GPIO_EN)
531+
quirk_io_region(dev, ICH6_GPIOBASE, 64, PCI_BRIDGE_RESOURCES+1,
532+
"ICH6 GPIO");
556533
}
557534

558535
static void ich6_lpc_generic_decode(struct pci_dev *dev, unsigned reg, const char *name, int dynsize)
@@ -650,13 +627,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_1, qui
650627
*/
651628
static void quirk_vt82c586_acpi(struct pci_dev *dev)
652629
{
653-
u32 region;
654-
655-
if (dev->revision & 0x10) {
656-
pci_read_config_dword(dev, 0x48, &region);
657-
region &= PCI_BASE_ADDRESS_IO_MASK;
658-
quirk_io_region(dev, region, 256, PCI_BRIDGE_RESOURCES, "vt82c586 ACPI");
659-
}
630+
if (dev->revision & 0x10)
631+
quirk_io_region(dev, 0x48, 256, PCI_BRIDGE_RESOURCES,
632+
"vt82c586 ACPI");
660633
}
661634
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_vt82c586_acpi);
662635

@@ -668,18 +641,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_vt
668641
*/
669642
static void quirk_vt82c686_acpi(struct pci_dev *dev)
670643
{
671-
u16 hm;
672-
u32 smb;
673-
674644
quirk_vt82c586_acpi(dev);
675645

676-
pci_read_config_word(dev, 0x70, &hm);
677-
hm &= PCI_BASE_ADDRESS_IO_MASK;
678-
quirk_io_region(dev, hm, 128, PCI_BRIDGE_RESOURCES + 1, "vt82c686 HW-mon");
646+
quirk_io_region(dev, 0x70, 128, PCI_BRIDGE_RESOURCES+1,
647+
"vt82c686 HW-mon");
679648

680-
pci_read_config_dword(dev, 0x90, &smb);
681-
smb &= PCI_BASE_ADDRESS_IO_MASK;
682-
quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 2, "vt82c686 SMB");
649+
quirk_io_region(dev, 0x90, 16, PCI_BRIDGE_RESOURCES+2, "vt82c686 SMB");
683650
}
684651
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi);
685652

@@ -690,15 +657,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt
690657
*/
691658
static void quirk_vt8235_acpi(struct pci_dev *dev)
692659
{
693-
u16 pm, smb;
694-
695-
pci_read_config_word(dev, 0x88, &pm);
696-
pm &= PCI_BASE_ADDRESS_IO_MASK;
697-
quirk_io_region(dev, pm, 128, PCI_BRIDGE_RESOURCES, "vt8235 PM");
698-
699-
pci_read_config_word(dev, 0xd0, &smb);
700-
smb &= PCI_BASE_ADDRESS_IO_MASK;
701-
quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 1, "vt8235 SMB");
660+
quirk_io_region(dev, 0x88, 128, PCI_BRIDGE_RESOURCES, "vt8235 PM");
661+
quirk_io_region(dev, 0xd0, 16, PCI_BRIDGE_RESOURCES+1, "vt8235 SMB");
702662
}
703663
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi);
704664

@@ -2594,6 +2554,14 @@ static void quirk_msi_intx_disable_ati_bug(struct pci_dev *dev)
25942554
dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
25952555
pci_dev_put(p);
25962556
}
2557+
static void quirk_msi_intx_disable_qca_bug(struct pci_dev *dev)
2558+
{
2559+
/* AR816X/AR817X/E210X MSI is fixed at HW level from revision 0x18 */
2560+
if (dev->revision < 0x18) {
2561+
dev_info(&dev->dev, "set MSI_INTX_DISABLE_BUG flag\n");
2562+
dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
2563+
}
2564+
}
25972565
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
25982566
PCI_DEVICE_ID_TIGON3_5780,
25992567
quirk_msi_intx_disable_bug);
@@ -2643,6 +2611,16 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, 0x1073,
26432611
quirk_msi_intx_disable_bug);
26442612
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, 0x1083,
26452613
quirk_msi_intx_disable_bug);
2614+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, 0x1090,
2615+
quirk_msi_intx_disable_qca_bug);
2616+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, 0x1091,
2617+
quirk_msi_intx_disable_qca_bug);
2618+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, 0x10a0,
2619+
quirk_msi_intx_disable_qca_bug);
2620+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, 0x10a1,
2621+
quirk_msi_intx_disable_qca_bug);
2622+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, 0xe091,
2623+
quirk_msi_intx_disable_qca_bug);
26462624
#endif /* CONFIG_PCI_MSI */
26472625

26482626
/* Allow manual resource allocation for PCI hotplug bridges

‎drivers/scsi/mvsas/mv_init.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ static struct pci_device_id mvs_pci_table[] = {
703703
{ PCI_VDEVICE(TTI, 0x2744), chip_9480 },
704704
{ PCI_VDEVICE(TTI, 0x2760), chip_9480 },
705705
{
706-
.vendor = 0x1b4b,
706+
.vendor = PCI_VENDOR_ID_MARVELL_EXT,
707707
.device = 0x9480,
708708
.subvendor = PCI_ANY_ID,
709709
.subdevice = 0x9480,
@@ -712,7 +712,7 @@ static struct pci_device_id mvs_pci_table[] = {
712712
.driver_data = chip_9480,
713713
},
714714
{
715-
.vendor = 0x1b4b,
715+
.vendor = PCI_VENDOR_ID_MARVELL_EXT,
716716
.device = 0x9445,
717717
.subvendor = PCI_ANY_ID,
718718
.subdevice = 0x9480,
@@ -721,7 +721,7 @@ static struct pci_device_id mvs_pci_table[] = {
721721
.driver_data = chip_9445,
722722
},
723723
{
724-
.vendor = 0x1b4b,
724+
.vendor = PCI_VENDOR_ID_MARVELL_EXT,
725725
.device = 0x9485,
726726
.subvendor = PCI_ANY_ID,
727727
.subdevice = 0x9480,

‎drivers/scsi/mvumi.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ MODULE_AUTHOR("jyli@marvell.com");
4949
MODULE_DESCRIPTION("Marvell UMI Driver");
5050

5151
static DEFINE_PCI_DEVICE_TABLE(mvumi_pci_table) = {
52-
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_2, PCI_DEVICE_ID_MARVELL_MV9143) },
53-
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_2, PCI_DEVICE_ID_MARVELL_MV9580) },
52+
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, PCI_DEVICE_ID_MARVELL_MV9143) },
53+
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, PCI_DEVICE_ID_MARVELL_MV9580) },
5454
{ 0 }
5555
};
5656

‎drivers/scsi/mvumi.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#define VER_BUILD 1500
3333

3434
#define MV_DRIVER_NAME "mvumi"
35-
#define PCI_VENDOR_ID_MARVELL_2 0x1b4b
3635
#define PCI_DEVICE_ID_MARVELL_MV9143 0x9143
3736
#define PCI_DEVICE_ID_MARVELL_MV9580 0x9580
3837

0 commit comments

Comments
 (0)