linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] Fix boot on efi 32 bit Machines [try #4]
@ 2006-06-26 21:19 Edgar Hucek
  2006-06-26 21:33 ` Linus Torvalds
  0 siblings, 1 reply; 34+ messages in thread
From: Edgar Hucek @ 2006-06-26 21:19 UTC (permalink / raw)
  To: LKML; +Cc: akpm, torvalds

Fix EFI boot on 32 bit machines with PCI Express slots.
Efi machines does not have an e820 memory map.
Without this patch a native EFI boot, on
Intel Macs, is impossible.

Signed-off-by: Edgar Hucek <hostmaster@ed-soft.at>

--- a/arch/i386/kernel/setup.c  2006-06-25 03:13:24.000000000 +0200
+++ b/arch/i386/kernel/setup.c  2006-06-25 03:13:50.000000000 +0200
@@ -975,6 +975,10 @@
        u64 start = s;
        u64 end = e;
        int i;
+
+       if (efi_enabled)
+               return 1;
+
        for (i = 0; i < e820.nr_map; i++) {
                struct e820entry *ei = &e820.map[i];
                if (type && ei->type != type)



^ permalink raw reply	[flat|nested] 34+ messages in thread
* Re: [PATCH 1/1] Fix boot on efi 32 bit Machines [try #4]
@ 2006-06-26 22:22 Thomas Meyer
  0 siblings, 0 replies; 34+ messages in thread
From: Thomas Meyer @ 2006-06-26 22:22 UTC (permalink / raw)
  To: linux-kernel

But doesn't the whole imacfb commit only make sense while booting  
native from efi? and booting native from efi is in the moment only  
possible through this patch.

with kind regards
thomas

PS: and i can't boot via csm at the moment, because i use gpt only!  
and i don't want to mix up old style partition table and gpt like  
boot camp do.



^ permalink raw reply	[flat|nested] 34+ messages in thread
* Re: [PATCH 1/1] Fix boot on efi 32 bit Machines [try #4]
@ 2006-07-14 13:57 Chuck Ebbert
  2006-07-14 14:45 ` Edgar Hucek
  2006-07-14 19:28 ` Edgar Hucek
  0 siblings, 2 replies; 34+ messages in thread
From: Chuck Ebbert @ 2006-07-14 13:57 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Edgar Hucek, linux-kernel

In-Reply-To: <Pine.LNX.4.64.0607131507220.5623@g5.osdl.org>

On Thu, 13 Jul 2006 15:15:21 -0700, Linus Torvalds wrote:

> > From kernel 2.6.16 to kernel 2.6.17 a new check is made.
> > File arch/i386/pci/mmconfig.c -> funktion pci_mmcfg_init -> check e820_all_mapped
> > The courios thing is that this check will always fail on the
> > Intel Macs booted through efi. Parsing of the ACPI_MCFG table
> > returns e0000000 for the start. But this location is
> > not in the memory map which the efi firmware have :
> > BIOS-EFI: 00000000e00f8000 - 00000000e00f9000 (reserved)
> 
> It _sounds_ like you may not have converted all the EFI types 
> (EFI_UNUSABLE_MEMORY?), but regardless, I think it would be fine to have 
> perhaps a "PCI_FORCE_MMCONF" flag that avoided that sanity check, and then 
> you could have some code (either the EFI code _or_ some DMI code) that 
> sets it for the Intel Macs.
> 
> Note that the check in pci_mmcfg_init() shouldn't be some EFI hack itself, 
> it would be a real flag for the PCI subsystem, independently of EFI (I can 
> see it being useful for a kernel command line option, even), and the only 
> EFI connection would be that perhaps the EFI code ends up setting that 
> flag (especially if there is some EFI command for doing this).
> 
> Btw, if you do do this, I think we should make sure that the MMCONFIG base 
> address is reserved in the PCI MMIO resource structures (which we don't do 
> now, I think - part of the whole point of verifying that it's marked as 
> E820_RESERVED is exactly the fact that otherwise we migth have problems 
> with PCI MMIO resource allocations allocating a regular PCI resource over 
> the MMCONFIG space..)

I just reposted Rajesh's patch for this (fixed the one previous complaint
from the list.)

 Subj:  [patch, take 3] PCI: use ACPI to verify extended config space on x86

Edgar, can you get it and test?

Discussion should probably continue in that thread...

-- 
Chuck
 "You can't read a newspaper if you can't read."  --George W. Bush

^ permalink raw reply	[flat|nested] 34+ messages in thread
* Re: [PATCH 1/1] Fix boot on efi 32 bit Machines [try #4]
@ 2006-07-16 12:09 Thomas Meyer
  0 siblings, 0 replies; 34+ messages in thread
From: Thomas Meyer @ 2006-07-16 12:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: gimli

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;

 /**



^ permalink raw reply related	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2006-07-26 15:05 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-26 21:19 [PATCH 1/1] Fix boot on efi 32 bit Machines [try #4] 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
2006-07-16  8:55                           ` [PATCH 1/1] Add efi e820 memory mapping on x86 [try #1] Edgar Hucek
2006-07-25  4:29                             ` Andrew Morton
2006-07-25  5:17                               ` Eric W. Biederman
2006-07-25  5:32                               ` Linus Torvalds
2006-07-25  5:34                                 ` H. Peter Anvin
2006-07-25  5:44                                   ` Linus Torvalds
2006-07-25  6:26                                     ` H. Peter Anvin
2006-07-25  6:00                                 ` Linus Torvalds
2006-07-16  9:00                           ` [PATCH 1/1] Add force of use MMCONFIG " Edgar Hucek
2006-07-25  4:33                             ` Andrew Morton
2006-07-25  5:27                               ` Linus Torvalds
2006-07-26 15:05                                 ` Andi Kleen
2006-06-26 22:22 [PATCH 1/1] Fix boot on efi 32 bit Machines [try #4] Thomas Meyer
2006-07-14 13:57 Chuck Ebbert
2006-07-14 14:45 ` Edgar Hucek
2006-07-14 19:28 ` Edgar Hucek
2006-07-16 12:09 Thomas Meyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).