x86, efi: Fix PCI ROM handing in EFI boot stub, in 32-bit mode
authorDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 7 Jan 2013 22:09:49 +0000 (22:09 +0000)
committerH. Peter Anvin <hpa@linux.intel.com>
Mon, 28 Jan 2013 04:19:37 +0000 (20:19 -0800)
The 'Attributes' argument to pci->Attributes() function is 64-bit. So
when invoking in 32-bit mode it takes two registers, not just one.

This fixes memory corruption when booting via the 32-bit EFI boot stub.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Cc: <stable@kernel.org>
Link: http://lkml.kernel.org/r/1358513837.2397.247.camel@shinybook.infradead.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Matt Fleming <matt.fleming@intel.com>
arch/x86/boot/compressed/eboot.c

index 448a86e154a94baa93f620b7761e1500bb7eb7c0..b7f220877294a45e6aa63d83ac0ab8656b3533f7 100644 (file)
@@ -295,10 +295,15 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
                if (!pci)
                        continue;
 
                if (!pci)
                        continue;
 
+#ifdef CONFIG_X86_64
                status = efi_call_phys4(pci->attributes, pci,
                                        EfiPciIoAttributeOperationGet, 0,
                                        &attributes);
                status = efi_call_phys4(pci->attributes, pci,
                                        EfiPciIoAttributeOperationGet, 0,
                                        &attributes);
-
+#else
+               status = efi_call_phys5(pci->attributes, pci,
+                                       EfiPciIoAttributeOperationGet, 0, 0,
+                                       &attributes);
+#endif
                if (status != EFI_SUCCESS)
                        continue;
 
                if (status != EFI_SUCCESS)
                        continue;