|
12 | 12 | */
|
13 | 13 |
|
14 | 14 | #include <linux/acpi.h>
|
| 15 | +#include <linux/efi.h> |
15 | 16 | #include <linux/pci.h>
|
16 | 17 | #include <linux/init.h>
|
17 | 18 | #include <linux/bitmap.h>
|
@@ -442,6 +443,32 @@ static bool is_acpi_reserved(u64 start, u64 end, enum e820_type not_used)
|
442 | 443 | return mcfg_res.flags;
|
443 | 444 | }
|
444 | 445 |
|
| 446 | +static bool is_efi_mmio(u64 start, u64 end, enum e820_type not_used) |
| 447 | +{ |
| 448 | +#ifdef CONFIG_EFI |
| 449 | + efi_memory_desc_t *md; |
| 450 | + u64 size, mmio_start, mmio_end; |
| 451 | + |
| 452 | + for_each_efi_memory_desc(md) { |
| 453 | + if (md->type == EFI_MEMORY_MAPPED_IO) { |
| 454 | + size = md->num_pages << EFI_PAGE_SHIFT; |
| 455 | + mmio_start = md->phys_addr; |
| 456 | + mmio_end = mmio_start + size; |
| 457 | + |
| 458 | + /* |
| 459 | + * N.B. Caller supplies (start, start + size), |
| 460 | + * so to match, mmio_end is the first address |
| 461 | + * *past* the EFI_MEMORY_MAPPED_IO area. |
| 462 | + */ |
| 463 | + if (mmio_start <= start && end <= mmio_end) |
| 464 | + return true; |
| 465 | + } |
| 466 | + } |
| 467 | +#endif |
| 468 | + |
| 469 | + return false; |
| 470 | +} |
| 471 | + |
445 | 472 | typedef bool (*check_reserved_t)(u64 start, u64 end, enum e820_type type);
|
446 | 473 |
|
447 | 474 | static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
|
@@ -513,6 +540,10 @@ pci_mmcfg_check_reserved(struct device *dev, struct pci_mmcfg_region *cfg, int e
|
513 | 540 | "MMCONFIG at %pR not reserved in "
|
514 | 541 | "ACPI motherboard resources\n",
|
515 | 542 | &cfg->res);
|
| 543 | + |
| 544 | + if (is_mmconf_reserved(is_efi_mmio, cfg, dev, |
| 545 | + "EfiMemoryMappedIO")) |
| 546 | + return true; |
516 | 547 | }
|
517 | 548 |
|
518 | 549 | /*
|
|
0 commit comments