From: Thomas Meyer <thomas@m3y3r.de> To: linux-kernel@vger.kernel.org Cc: gimli@dark-green.com Subject: Re: [PATCH 1/1] Fix boot on efi 32 bit Machines [try #4] Date: Sun, 16 Jul 2006 14:09:11 +0200 Message-ID: <1153051752.12981.0.camel@hotzenplotz.treehouse> (raw) Hi. For the record. Feedback is welcome. But i guess we stick with Edgars solution. PS: Where do i get the PCI firmware specification for free? My idea was that the EFI memory map doesn't explicitly reserve all not used memory, because the PCI MCFG memory area isn't listed in the EFI memory map. but this seems to be a bug?! diff --git a/arch/i386/kernel/efi.c b/arch/i386/kernel/efi.c index fe15804..4a81f35 100644 --- a/arch/i386/kernel/efi.c +++ b/arch/i386/kernel/efi.c @@ -39,7 +39,7 @@ #include <asm/processor.h> #include <asm/desc.h> #include <asm/tlbflush.h> -#define EFI_DEBUG 0 +#define EFI_DEBUG 1 #define PFX "EFI: " extern efi_status_t asmlinkage efi_call_phys(void *, ...); @@ -649,3 +649,27 @@ u64 efi_mem_attributes(unsigned long phy } return 0; } + +int efi_is_free(unsigned long s, unsigned long e) +{ + + int i; + efi_memory_desc_t *md; + void *p; + + for (p = memmap.map, i = 0; p < memmap.map_end; p += memmap.desc_size, i++) { + md = p; + /* is the region (part) in overlap with the current region ?*/ + if (md->phys_addr >= e || md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) <= s) { + continue; + } else { + if (md->type == EFI_MEMORY_MAPPED_IO) { + printk("EFI: memmap entry: %i is already mapped!\n", i); + } else { + printk("EFI: MCFG blocking memmap entry: %i\n", i); + return 0; + } + } + } + return 1; +} diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c index e545b09..bcf4665 100644 --- a/arch/i386/pci/mmconfig.c +++ b/arch/i386/pci/mmconfig.c @@ -13,6 +13,7 @@ #include <linux/pci.h> #include <linux/init.h> #include <linux/acpi.h> #include <asm/e820.h> +#include <linux/efi.h> #include "pci.h" /* aperture is up to 256MB but BIOS may reserve less */ @@ -198,13 +199,23 @@ void __init pci_mmcfg_init(void) (pci_mmcfg_config[0].base_address == 0)) return; - if (!e820_all_mapped(pci_mmcfg_config[0].base_address, - pci_mmcfg_config[0].base_address + MMCONFIG_APER_MIN, - E820_RESERVED)) { - printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %x is not E820-reserved\n", - pci_mmcfg_config[0].base_address); - printk(KERN_ERR "PCI: Not using MMCONFIG.\n"); - return; + if (efi_enabled) { + if (!efi_is_free(pci_mmcfg_config[0].base_address, + pci_mmcfg_config[0].base_address + MMCONFIG_APER_MIN)) { + printk(KERN_ERR "PCI: EFI: memory region at %x is already in use!\n", + pci_mmcfg_config[0].base_address); + printk(KERN_ERR "PCI: Not using MMCONFIG.\n"); + return; + } + } else { + if (!e820_all_mapped(pci_mmcfg_config[0].base_address, + pci_mmcfg_config[0].base_address + MMCONFIG_APER_MIN, + E820_RESERVED)) { + printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %x is not E820-reserved.\n", + pci_mmcfg_config[0].base_address); + printk(KERN_ERR "PCI: Not using MMCONFIG.\n"); + return; + } } printk(KERN_INFO "PCI: Using MMCONFIG\n"); diff --git a/include/linux/efi.h b/include/linux/efi.h index 66d621d..7dffbf9 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -302,6 +302,7 @@ extern void efi_initialize_iomem_resourc struct resource *data_resource); extern unsigned long __init efi_get_time(void); extern int __init efi_set_rtc_mmss(unsigned long nowtime); +extern int efi_is_free(unsigned long s, unsigned long e); extern struct efi_memory_map memmap; /**
next reply index Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-07-16 12:09 Thomas Meyer [this message] -- strict thread matches above, loose matches on Subject: below -- 2006-07-14 13:57 Chuck Ebbert 2006-07-14 14:45 ` Edgar Hucek 2006-07-14 19:28 ` Edgar Hucek 2006-06-26 22:22 Thomas Meyer 2006-06-26 21:19 Edgar Hucek 2006-06-26 21:33 ` Linus Torvalds 2006-06-27 6:15 ` Edgar Hucek 2006-06-27 6:20 ` Linus Torvalds 2006-06-28 22:37 ` H. Peter Anvin 2006-07-02 17:39 ` Eric W. Biederman 2006-07-02 17:42 ` H. Peter Anvin 2006-07-02 18:26 ` Eric W. Biederman 2006-07-02 18:46 ` Arjan van de Ven 2006-07-05 9:38 ` Edgar Hucek 2006-07-05 15:52 ` Eric W. Biederman 2006-07-13 21:46 ` Edgar Hucek 2006-07-13 22:15 ` Linus Torvalds 2006-07-14 4:23 ` Eric W. Biederman 2006-07-14 6:22 ` H. Peter Anvin 2006-07-14 6:20 ` Edgar Hucek 2006-07-14 16:09 ` Linus Torvalds
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1153051752.12981.0.camel@hotzenplotz.treehouse \ --to=thomas@m3y3r.de \ --cc=gimli@dark-green.com \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
LKML Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \ linux-kernel@vger.kernel.org public-inbox-index lkml Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git