1
1
// SPDX-License-Identifier: GPL-2.0
2
2
/*
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.
5
5
*
6
6
* This code does:
7
7
* - known chipset handling
11
11
* themselves.
12
12
*/
13
13
14
+ #define pr_fmt (fmt ) "PCI: " fmt
15
+
14
16
#include <linux/acpi.h>
15
17
#include <linux/efi.h>
16
18
#include <linux/pci.h>
24
26
#include <asm/pci_x86.h>
25
27
#include <asm/acpi.h>
26
28
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 */
30
30
static bool pci_mmcfg_running_state ;
31
31
static bool pci_mmcfg_arch_init_failed ;
32
32
static DEFINE_MUTEX (pci_mmcfg_lock );
@@ -90,7 +90,7 @@ static struct pci_mmcfg_region *pci_mmconfig_alloc(int segment, int start,
90
90
res -> end = addr + PCI_MMCFG_BUS_OFFSET (end + 1 ) - 1 ;
91
91
res -> flags = IORESOURCE_MEM | IORESOURCE_BUSY ;
92
92
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 );
94
94
res -> name = new -> name ;
95
95
96
96
return new ;
@@ -107,10 +107,8 @@ struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start,
107
107
list_add_sorted (new );
108
108
mutex_unlock (& pci_mmcfg_lock );
109
109
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 );
114
112
}
115
113
116
114
return new ;
@@ -205,7 +203,7 @@ static const char *__init pci_mmcfg_amd_fam10h(void)
205
203
msr <<= 32 ;
206
204
msr |= low ;
207
205
208
- /* mmconfig is not enable */
206
+ /* ECAM is not enabled */
209
207
if (!(msr & FAM10H_MMIO_CONF_ENABLE ))
210
208
return NULL ;
211
209
@@ -367,7 +365,7 @@ static int __init pci_mmcfg_check_hostbridge(void)
367
365
name = pci_mmcfg_probes [i ].probe ();
368
366
369
367
if (name )
370
- pr_info (PREFIX "%s with MMCONFIG support\n" , name );
368
+ pr_info ("%s with ECAM support\n" , name );
371
369
}
372
370
373
371
/* some end_bus_number is crazy, fix it */
@@ -487,11 +485,10 @@ static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
487
485
return false;
488
486
489
487
if (dev )
490
- dev_info (dev , "MMCONFIG at %pR reserved as %s\n" ,
488
+ dev_info (dev , "ECAM %pR reserved as %s\n" ,
491
489
& cfg -> res , method );
492
490
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 );
495
492
496
493
if (old_size != size ) {
497
494
/* update end_bus */
@@ -500,20 +497,16 @@ static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
500
497
cfg -> res .end = cfg -> res .start +
501
498
PCI_MMCFG_BUS_OFFSET (num_buses ) - 1 ;
502
499
snprintf (cfg -> name , PCI_MMCFG_RESOURCE_NAME_LEN ,
503
- "PCI MMCONFIG %04x [bus %02x-%02x]" ,
500
+ "PCI ECAM %04x [bus %02x-%02x]" ,
504
501
cfg -> segment , cfg -> start_bus , cfg -> end_bus );
505
502
506
503
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 );
511
506
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 );
517
510
}
518
511
519
512
return true;
@@ -530,26 +523,22 @@ pci_mmcfg_check_reserved(struct device *dev, struct pci_mmcfg_region *cfg, int e
530
523
return true;
531
524
532
525
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" ,
536
527
& cfg -> res );
537
528
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 );
542
531
543
532
if (is_efi_mmio (& cfg -> res )) {
544
533
pr_info ("ECAM %pR is EfiMemoryMappedIO; assuming valid\n" ,
545
534
& cfg -> res );
546
535
conflict = insert_resource_conflict (& iomem_resource ,
547
536
& cfg -> res );
548
537
if (conflict )
549
- pr_warn ("MMCONFIG %pR conflicts with %s %pR\n" ,
538
+ pr_warn ("ECAM %pR conflicts with %s %pR\n" ,
550
539
& cfg -> res , conflict -> name , conflict );
551
540
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" ,
553
542
& cfg -> res );
554
543
return true;
555
544
}
@@ -579,7 +568,7 @@ static void __init pci_mmcfg_reject_broken(int early)
579
568
580
569
list_for_each_entry (cfg , & pci_mmcfg_list , list ) {
581
570
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" ,
583
572
& cfg -> res );
584
573
free_all_mmcfg ();
585
574
return ;
@@ -599,9 +588,9 @@ static int __init acpi_mcfg_check_entry(struct acpi_table_mcfg *mcfg,
599
588
if ((mcfg -> header .revision >= 1 ) && (dmi_get_bios_year () >= 2010 ))
600
589
return 0 ;
601
590
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 );
605
594
return - EINVAL ;
606
595
}
607
596
@@ -626,7 +615,7 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
626
615
i -= sizeof (struct acpi_mcfg_allocation );
627
616
}
628
617
if (entries == 0 ) {
629
- pr_err (PREFIX "MMCONFIG has no entries\n" );
618
+ pr_err ("MCFG has no entries\n" );
630
619
return - ENODEV ;
631
620
}
632
621
@@ -640,7 +629,7 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
640
629
641
630
if (pci_mmconfig_add (cfg -> pci_segment , cfg -> start_bus_number ,
642
631
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" );
644
633
free_all_mmcfg ();
645
634
return - ENOMEM ;
646
635
}
@@ -677,7 +666,7 @@ static int pci_mmcfg_for_each_region(int (*func)(__u64 start, __u64 size,
677
666
678
667
static void __init __pci_mmcfg_init (int early )
679
668
{
680
- pr_debug (PREFIX "%s(%s)\n" , __func__ , early ? "early" : "late" );
669
+ pr_debug ("%s(%s)\n" , __func__ , early ? "early" : "late" );
681
670
682
671
pci_mmcfg_reject_broken (early );
683
672
if (list_empty (& pci_mmcfg_list ))
@@ -705,7 +694,7 @@ static int __initdata known_bridge;
705
694
706
695
void __init pci_mmcfg_early_init (void )
707
696
{
708
- pr_debug (PREFIX "%s() pci_probe %#x\n" , __func__ , pci_probe );
697
+ pr_debug ("%s() pci_probe %#x\n" , __func__ , pci_probe );
709
698
710
699
if (pci_probe & PCI_PROBE_MMCONF ) {
711
700
if (pci_mmcfg_check_hostbridge ())
@@ -720,16 +709,16 @@ void __init pci_mmcfg_early_init(void)
720
709
721
710
void __init pci_mmcfg_late_init (void )
722
711
{
723
- pr_debug (PREFIX "%s() pci_probe %#x\n" , __func__ , pci_probe );
712
+ pr_debug ("%s() pci_probe %#x\n" , __func__ , pci_probe );
724
713
725
- /* MMCONFIG disabled */
714
+ /* ECAM disabled */
726
715
if ((pci_probe & PCI_PROBE_MMCONF ) == 0 )
727
716
return ;
728
717
729
718
if (known_bridge )
730
719
return ;
731
720
732
- /* MMCONFIG hasn't been enabled yet, try again */
721
+ /* ECAM hasn't been enabled yet, try again */
733
722
if (pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF ) {
734
723
acpi_table_parse (ACPI_SIG_MCFG , pci_parse_mcfg );
735
724
__pci_mmcfg_init (0 );
@@ -742,9 +731,9 @@ static int __init pci_mmcfg_late_insert_resources(void)
742
731
743
732
pci_mmcfg_running_state = true;
744
733
745
- pr_debug (PREFIX "%s() pci_probe %#x\n" , __func__ , pci_probe );
734
+ pr_debug ("%s() pci_probe %#x\n" , __func__ , pci_probe );
746
735
747
- /* If we are not using MMCONFIG , don't insert the resources. */
736
+ /* If we are not using ECAM , don't insert the resources. */
748
737
if ((pci_probe & PCI_PROBE_MMCONF ) == 0 )
749
738
return 1 ;
750
739
@@ -755,7 +744,7 @@ static int __init pci_mmcfg_late_insert_resources(void)
755
744
*/
756
745
list_for_each_entry (cfg , & pci_mmcfg_list , list ) {
757
746
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 );
759
748
insert_resource (& iomem_resource , & cfg -> res );
760
749
}
761
750
}
@@ -764,13 +753,13 @@ static int __init pci_mmcfg_late_insert_resources(void)
764
753
}
765
754
766
755
/*
767
- * Perform MMCONFIG resource insertion after PCI initialization to allow for
756
+ * Perform ECAM resource insertion after PCI initialization to allow for
768
757
* misprogrammed MCFG tables that state larger sizes but actually conflict
769
758
* with other system resources.
770
759
*/
771
760
late_initcall (pci_mmcfg_late_insert_resources );
772
761
773
- /* Add MMCFG information for host bridges */
762
+ /* Add ECAM information for host bridges */
774
763
int pci_mmconfig_insert (struct device * dev , u16 seg , u8 start , u8 end ,
775
764
phys_addr_t addr )
776
765
{
@@ -790,11 +779,9 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
790
779
cfg = pci_mmconfig_lookup (seg , start );
791
780
if (cfg ) {
792
781
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 );
798
785
mutex_unlock (& pci_mmcfg_lock );
799
786
return - EEXIST ;
800
787
}
@@ -807,10 +794,10 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
807
794
rc = - EBUSY ;
808
795
cfg = pci_mmconfig_alloc (seg , start , end , addr );
809
796
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" );
811
798
rc = - ENOMEM ;
812
799
} 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" ,
814
801
& cfg -> res );
815
802
} else {
816
803
/* 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,
819
806
& cfg -> res );
820
807
821
808
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" ,
825
810
& cfg -> res , tmp -> name , tmp );
826
811
} 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 );
828
813
} else {
829
814
list_add_sorted (cfg );
830
- dev_info (dev , "MMCONFIG at %pR (base %#lx)\n" ,
815
+ dev_info (dev , "ECAM %pR (base %#lx)\n" ,
831
816
& cfg -> res , (unsigned long )addr );
832
817
cfg = NULL ;
833
818
rc = 0 ;
@@ -845,7 +830,7 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
845
830
return rc ;
846
831
}
847
832
848
- /* Delete MMCFG information for host bridges */
833
+ /* Delete ECAM information for host bridges */
849
834
int pci_mmconfig_delete (u16 seg , u8 start , u8 end )
850
835
{
851
836
struct pci_mmcfg_region * cfg ;
0 commit comments