Skip to content

Commit 7048910

Browse files
committed
x86/pci: Rename 'MMCONFIG' to 'ECAM', use pr_fmt
The "MMCONFIG" term is not used in PCI/PCIe specs. Replace it with "ECAM", the term used in PCIe r6.0, sec 7.2.2. Define pr_fmt() instead of repeating PREFIX in every log message. Link: https://lore.kernel.org/r/[email protected] Tested-by: Tomasz Pala <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 286ae88 commit 7048910

File tree

3 files changed

+52
-67
lines changed

3 files changed

+52
-67
lines changed

arch/x86/pci/mmconfig-shared.c

Lines changed: 48 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/*
3-
* mmconfig-shared.c - Low-level direct PCI config space access via
4-
* MMCONFIG - common code between i386 and x86-64.
3+
* Low-level direct PCI config space access via ECAM - common code between
4+
* i386 and x86-64.
55
*
66
* This code does:
77
* - known chipset handling
@@ -11,6 +11,8 @@
1111
* themselves.
1212
*/
1313

14+
#define pr_fmt(fmt) "PCI: " fmt
15+
1416
#include <linux/acpi.h>
1517
#include <linux/efi.h>
1618
#include <linux/pci.h>
@@ -24,9 +26,7 @@
2426
#include <asm/pci_x86.h>
2527
#include <asm/acpi.h>
2628

27-
#define PREFIX "PCI: "
28-
29-
/* Indicate if the mmcfg resources have been placed into the resource table. */
29+
/* Indicate if the ECAM resources have been placed into the resource table */
3030
static bool pci_mmcfg_running_state;
3131
static bool pci_mmcfg_arch_init_failed;
3232
static DEFINE_MUTEX(pci_mmcfg_lock);
@@ -90,7 +90,7 @@ static struct pci_mmcfg_region *pci_mmconfig_alloc(int segment, int start,
9090
res->end = addr + PCI_MMCFG_BUS_OFFSET(end + 1) - 1;
9191
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
9292
snprintf(new->name, PCI_MMCFG_RESOURCE_NAME_LEN,
93-
"PCI MMCONFIG %04x [bus %02x-%02x]", segment, start, end);
93+
"PCI ECAM %04x [bus %02x-%02x]", segment, start, end);
9494
res->name = new->name;
9595

9696
return new;
@@ -107,10 +107,8 @@ struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start,
107107
list_add_sorted(new);
108108
mutex_unlock(&pci_mmcfg_lock);
109109

110-
pr_info(PREFIX
111-
"MMCONFIG for domain %04x [bus %02x-%02x] at %pR "
112-
"(base %#lx)\n",
113-
segment, start, end, &new->res, (unsigned long)addr);
110+
pr_info("ECAM %pR (base %#lx) for domain %04x [bus %02x-%02x]\n",
111+
&new->res, (unsigned long)addr, segment, start, end);
114112
}
115113

116114
return new;
@@ -205,7 +203,7 @@ static const char *__init pci_mmcfg_amd_fam10h(void)
205203
msr <<= 32;
206204
msr |= low;
207205

208-
/* mmconfig is not enable */
206+
/* ECAM is not enabled */
209207
if (!(msr & FAM10H_MMIO_CONF_ENABLE))
210208
return NULL;
211209

@@ -367,7 +365,7 @@ static int __init pci_mmcfg_check_hostbridge(void)
367365
name = pci_mmcfg_probes[i].probe();
368366

369367
if (name)
370-
pr_info(PREFIX "%s with MMCONFIG support\n", name);
368+
pr_info("%s with ECAM support\n", name);
371369
}
372370

373371
/* some end_bus_number is crazy, fix it */
@@ -487,11 +485,10 @@ static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
487485
return false;
488486

489487
if (dev)
490-
dev_info(dev, "MMCONFIG at %pR reserved as %s\n",
488+
dev_info(dev, "ECAM %pR reserved as %s\n",
491489
&cfg->res, method);
492490
else
493-
pr_info(PREFIX "MMCONFIG at %pR reserved as %s\n",
494-
&cfg->res, method);
491+
pr_info("ECAM %pR reserved as %s\n", &cfg->res, method);
495492

496493
if (old_size != size) {
497494
/* update end_bus */
@@ -500,20 +497,16 @@ static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
500497
cfg->res.end = cfg->res.start +
501498
PCI_MMCFG_BUS_OFFSET(num_buses) - 1;
502499
snprintf(cfg->name, PCI_MMCFG_RESOURCE_NAME_LEN,
503-
"PCI MMCONFIG %04x [bus %02x-%02x]",
500+
"PCI ECAM %04x [bus %02x-%02x]",
504501
cfg->segment, cfg->start_bus, cfg->end_bus);
505502

506503
if (dev)
507-
dev_info(dev,
508-
"MMCONFIG "
509-
"at %pR (base %#lx) (size reduced!)\n",
510-
&cfg->res, (unsigned long) cfg->address);
504+
dev_info(dev, "ECAM %pR (base %#lx) (size reduced!)\n",
505+
&cfg->res, (unsigned long) cfg->address);
511506
else
512-
pr_info(PREFIX
513-
"MMCONFIG for %04x [bus%02x-%02x] "
514-
"at %pR (base %#lx) (size reduced!)\n",
515-
cfg->segment, cfg->start_bus, cfg->end_bus,
516-
&cfg->res, (unsigned long) cfg->address);
507+
pr_info("ECAM %pR (base %#lx) for %04x [bus%02x-%02x] (size reduced!)\n",
508+
&cfg->res, (unsigned long) cfg->address,
509+
cfg->segment, cfg->start_bus, cfg->end_bus);
517510
}
518511

519512
return true;
@@ -530,26 +523,22 @@ pci_mmcfg_check_reserved(struct device *dev, struct pci_mmcfg_region *cfg, int e
530523
return true;
531524

532525
if (dev)
533-
dev_info(dev, FW_INFO
534-
"MMCONFIG at %pR not reserved in "
535-
"ACPI motherboard resources\n",
526+
dev_info(dev, FW_INFO "ECAM %pR not reserved in ACPI motherboard resources\n",
536527
&cfg->res);
537528
else
538-
pr_info(FW_INFO PREFIX
539-
"MMCONFIG at %pR not reserved in "
540-
"ACPI motherboard resources\n",
541-
&cfg->res);
529+
pr_info(FW_INFO "ECAM %pR not reserved in ACPI motherboard resources\n",
530+
&cfg->res);
542531

543532
if (is_efi_mmio(&cfg->res)) {
544533
pr_info("ECAM %pR is EfiMemoryMappedIO; assuming valid\n",
545534
&cfg->res);
546535
conflict = insert_resource_conflict(&iomem_resource,
547536
&cfg->res);
548537
if (conflict)
549-
pr_warn("MMCONFIG %pR conflicts with %s %pR\n",
538+
pr_warn("ECAM %pR conflicts with %s %pR\n",
550539
&cfg->res, conflict->name, conflict);
551540
else
552-
pr_info("MMCONFIG %pR reserved to work around lack of ACPI motherboard _CRS\n",
541+
pr_info("ECAM %pR reserved to work around lack of ACPI motherboard _CRS\n",
553542
&cfg->res);
554543
return true;
555544
}
@@ -579,7 +568,7 @@ static void __init pci_mmcfg_reject_broken(int early)
579568

580569
list_for_each_entry(cfg, &pci_mmcfg_list, list) {
581570
if (pci_mmcfg_check_reserved(NULL, cfg, early) == 0) {
582-
pr_info(PREFIX "not using MMCONFIG (%pR not reserved)\n",
571+
pr_info("not using ECAM (%pR not reserved)\n",
583572
&cfg->res);
584573
free_all_mmcfg();
585574
return;
@@ -599,9 +588,9 @@ static int __init acpi_mcfg_check_entry(struct acpi_table_mcfg *mcfg,
599588
if ((mcfg->header.revision >= 1) && (dmi_get_bios_year() >= 2010))
600589
return 0;
601590

602-
pr_err(PREFIX "MCFG region for %04x [bus %02x-%02x] at %#llx "
603-
"is above 4GB, ignored\n", cfg->pci_segment,
604-
cfg->start_bus_number, cfg->end_bus_number, cfg->address);
591+
pr_err("ECAM at %#llx for %04x [bus %02x-%02x] is above 4GB, ignored\n",
592+
cfg->address, cfg->pci_segment, cfg->start_bus_number,
593+
cfg->end_bus_number);
605594
return -EINVAL;
606595
}
607596

@@ -626,7 +615,7 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
626615
i -= sizeof(struct acpi_mcfg_allocation);
627616
}
628617
if (entries == 0) {
629-
pr_err(PREFIX "MMCONFIG has no entries\n");
618+
pr_err("MCFG has no entries\n");
630619
return -ENODEV;
631620
}
632621

@@ -640,7 +629,7 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
640629

641630
if (pci_mmconfig_add(cfg->pci_segment, cfg->start_bus_number,
642631
cfg->end_bus_number, cfg->address) == NULL) {
643-
pr_warn(PREFIX "no memory for MCFG entries\n");
632+
pr_warn("no memory for MCFG entries\n");
644633
free_all_mmcfg();
645634
return -ENOMEM;
646635
}
@@ -677,7 +666,7 @@ static int pci_mmcfg_for_each_region(int (*func)(__u64 start, __u64 size,
677666

678667
static void __init __pci_mmcfg_init(int early)
679668
{
680-
pr_debug(PREFIX "%s(%s)\n", __func__, early ? "early" : "late");
669+
pr_debug("%s(%s)\n", __func__, early ? "early" : "late");
681670

682671
pci_mmcfg_reject_broken(early);
683672
if (list_empty(&pci_mmcfg_list))
@@ -705,7 +694,7 @@ static int __initdata known_bridge;
705694

706695
void __init pci_mmcfg_early_init(void)
707696
{
708-
pr_debug(PREFIX "%s() pci_probe %#x\n", __func__, pci_probe);
697+
pr_debug("%s() pci_probe %#x\n", __func__, pci_probe);
709698

710699
if (pci_probe & PCI_PROBE_MMCONF) {
711700
if (pci_mmcfg_check_hostbridge())
@@ -720,16 +709,16 @@ void __init pci_mmcfg_early_init(void)
720709

721710
void __init pci_mmcfg_late_init(void)
722711
{
723-
pr_debug(PREFIX "%s() pci_probe %#x\n", __func__, pci_probe);
712+
pr_debug("%s() pci_probe %#x\n", __func__, pci_probe);
724713

725-
/* MMCONFIG disabled */
714+
/* ECAM disabled */
726715
if ((pci_probe & PCI_PROBE_MMCONF) == 0)
727716
return;
728717

729718
if (known_bridge)
730719
return;
731720

732-
/* MMCONFIG hasn't been enabled yet, try again */
721+
/* ECAM hasn't been enabled yet, try again */
733722
if (pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF) {
734723
acpi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg);
735724
__pci_mmcfg_init(0);
@@ -742,9 +731,9 @@ static int __init pci_mmcfg_late_insert_resources(void)
742731

743732
pci_mmcfg_running_state = true;
744733

745-
pr_debug(PREFIX "%s() pci_probe %#x\n", __func__, pci_probe);
734+
pr_debug("%s() pci_probe %#x\n", __func__, pci_probe);
746735

747-
/* If we are not using MMCONFIG, don't insert the resources. */
736+
/* If we are not using ECAM, don't insert the resources. */
748737
if ((pci_probe & PCI_PROBE_MMCONF) == 0)
749738
return 1;
750739

@@ -755,7 +744,7 @@ static int __init pci_mmcfg_late_insert_resources(void)
755744
*/
756745
list_for_each_entry(cfg, &pci_mmcfg_list, list) {
757746
if (!cfg->res.parent) {
758-
pr_debug(PREFIX "%s() insert %pR\n", __func__, &cfg->res);
747+
pr_debug("%s() insert %pR\n", __func__, &cfg->res);
759748
insert_resource(&iomem_resource, &cfg->res);
760749
}
761750
}
@@ -764,13 +753,13 @@ static int __init pci_mmcfg_late_insert_resources(void)
764753
}
765754

766755
/*
767-
* Perform MMCONFIG resource insertion after PCI initialization to allow for
756+
* Perform ECAM resource insertion after PCI initialization to allow for
768757
* misprogrammed MCFG tables that state larger sizes but actually conflict
769758
* with other system resources.
770759
*/
771760
late_initcall(pci_mmcfg_late_insert_resources);
772761

773-
/* Add MMCFG information for host bridges */
762+
/* Add ECAM information for host bridges */
774763
int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
775764
phys_addr_t addr)
776765
{
@@ -790,11 +779,9 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
790779
cfg = pci_mmconfig_lookup(seg, start);
791780
if (cfg) {
792781
if (cfg->end_bus < end)
793-
dev_info(dev, FW_INFO
794-
"MMCONFIG for "
795-
"domain %04x [bus %02x-%02x] "
796-
"only partially covers this bridge\n",
797-
cfg->segment, cfg->start_bus, cfg->end_bus);
782+
dev_info(dev, FW_INFO "ECAM %pR for domain %04x [bus %02x-%02x] only partially covers this bridge\n",
783+
&cfg->res, cfg->segment, cfg->start_bus,
784+
cfg->end_bus);
798785
mutex_unlock(&pci_mmcfg_lock);
799786
return -EEXIST;
800787
}
@@ -807,10 +794,10 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
807794
rc = -EBUSY;
808795
cfg = pci_mmconfig_alloc(seg, start, end, addr);
809796
if (cfg == NULL) {
810-
dev_warn(dev, "fail to add MMCONFIG (out of memory)\n");
797+
dev_warn(dev, "fail to add ECAM (out of memory)\n");
811798
rc = -ENOMEM;
812799
} else if (!pci_mmcfg_check_reserved(dev, cfg, 0)) {
813-
dev_warn(dev, FW_BUG "MMCONFIG %pR isn't reserved\n",
800+
dev_warn(dev, FW_BUG "ECAM %pR isn't reserved\n",
814801
&cfg->res);
815802
} else {
816803
/* Insert resource if it's not in boot stage */
@@ -819,15 +806,13 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
819806
&cfg->res);
820807

821808
if (tmp) {
822-
dev_warn(dev,
823-
"MMCONFIG %pR conflicts with "
824-
"%s %pR\n",
809+
dev_warn(dev, "ECAM %pR conflicts with %s %pR\n",
825810
&cfg->res, tmp->name, tmp);
826811
} else if (pci_mmcfg_arch_map(cfg)) {
827-
dev_warn(dev, "fail to map MMCONFIG %pR\n", &cfg->res);
812+
dev_warn(dev, "fail to map ECAM %pR\n", &cfg->res);
828813
} else {
829814
list_add_sorted(cfg);
830-
dev_info(dev, "MMCONFIG at %pR (base %#lx)\n",
815+
dev_info(dev, "ECAM %pR (base %#lx)\n",
831816
&cfg->res, (unsigned long)addr);
832817
cfg = NULL;
833818
rc = 0;
@@ -845,7 +830,7 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
845830
return rc;
846831
}
847832

848-
/* Delete MMCFG information for host bridges */
833+
/* Delete ECAM information for host bridges */
849834
int pci_mmconfig_delete(u16 seg, u8 start, u8 end)
850835
{
851836
struct pci_mmcfg_region *cfg;

arch/x86/pci/mmconfig_32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const struct pci_raw_ops pci_mmcfg = {
131131

132132
int __init pci_mmcfg_arch_init(void)
133133
{
134-
printk(KERN_INFO "PCI: Using MMCONFIG for extended config space\n");
134+
printk(KERN_INFO "PCI: Using ECAM for extended config space\n");
135135
raw_pci_ext_ops = &pci_mmcfg;
136136
return 1;
137137
}

arch/x86/pci/mmconfig_64.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* space mapped. This allows lockless config space operation.
77
*/
88

9+
#define pr_fmt(fmt) "PCI: " fmt
10+
911
#include <linux/pci.h>
1012
#include <linux/init.h>
1113
#include <linux/acpi.h>
@@ -14,8 +16,6 @@
1416
#include <asm/e820/api.h>
1517
#include <asm/pci_x86.h>
1618

17-
#define PREFIX "PCI: "
18-
1919
static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
2020
{
2121
struct pci_mmcfg_region *cfg = pci_mmconfig_lookup(seg, bus);
@@ -138,7 +138,7 @@ int pci_mmcfg_arch_map(struct pci_mmcfg_region *cfg)
138138
{
139139
cfg->virt = mcfg_ioremap(cfg);
140140
if (!cfg->virt) {
141-
pr_err(PREFIX "can't map MMCONFIG at %pR\n", &cfg->res);
141+
pr_err("can't map ECAM at %pR\n", &cfg->res);
142142
return -ENOMEM;
143143
}
144144

0 commit comments

Comments
 (0)