TO: Ard Biesheuvel <ard.biesheu...@linaro.org>

tree:   https://git.linaro.org/people/ard.biesheuvel/linux-arm arm-efi
head:   9cf8e27f9369913d1322c80bd90400b5552d5c0a
commit: cd6882c5f60e1afcee1e870d73860f2f3cbe13e6 [4/8] arm64/efi: refactor EFI 
init and runtime code for reuse by 32-bit ARM
reproduce:
  # apt-get install sparse
  git checkout cd6882c5f60e1afcee1e870d73860f2f3cbe13e6
  make ARCH=x86_64 allmodconfig
  make C=1 CF=-D__CHECK_ENDIAN__
:::::: branch date: 2 hours ago
:::::: commit date: 2 hours ago

   drivers/firmware/efi/arm-runtime.c:53:34: sparse: Expected ; at end of 
statement
   drivers/firmware/efi/arm-runtime.c:53:34: sparse: got prot
   drivers/firmware/efi/arm-runtime.c:53:17: sparse: undefined identifier 
'__arm_efi_prot_t'
   drivers/firmware/efi/arm-runtime.c:74:25: sparse: undefined identifier 'prot'
   drivers/firmware/efi/arm-runtime.c:76:25: sparse: undefined identifier 'prot'
   drivers/firmware/efi/arm-runtime.c:78:25: sparse: undefined identifier 'prot'
   drivers/firmware/efi/arm-runtime.c:80:17: sparse: undefined identifier 
'create_efi_mapping'
   drivers/firmware/efi/arm-runtime.c:107:38: sparse: undefined identifier 
'__arm_efi_memremap'
>> drivers/firmware/efi/arm-runtime.c:107:23: sparse: cast from unknown type
   drivers/firmware/efi/arm-runtime.c:120:9: sparse: undefined identifier 
'__arm_efi_memunmap'
   drivers/firmware/efi/arm-runtime.c:135:9: sparse: undefined identifier 
'efi_set_pgd'
   drivers/firmware/efi/arm-runtime.c:140:9: sparse: undefined identifier 
'efi_set_pgd'
   drivers/firmware/efi/arm-runtime.c: In function 'efi_virtmap_init':
   drivers/firmware/efi/arm-runtime.c:53:3: error: unknown type name 
'__arm_efi_prot_t'
      __arm_efi_prot_t prot;
      ^
   drivers/firmware/efi/arm-runtime.c:74:11: error: '__EFI_DEVICE' undeclared 
(first use in this function)
       prot = __EFI_DEVICE;
              ^
   drivers/firmware/efi/arm-runtime.c:74:11: note: each undeclared identifier 
is reported only once for each function it appears in
   drivers/firmware/efi/arm-runtime.c:76:11: error: '__EFI_MEMORY_RWX' 
undeclared (first use in this function)
       prot = __EFI_MEMORY_RWX;
              ^
   drivers/firmware/efi/arm-runtime.c:78:11: error: '__EFI_MEMORY_RW' 
undeclared (first use in this function)
       prot = __EFI_MEMORY_RW;
              ^
   drivers/firmware/efi/arm-runtime.c:80:3: error: implicit declaration of 
function 'create_efi_mapping' [-Werror=implicit-function-declaration]
      create_efi_mapping(&efi_mm, paddr, md->virt_addr, size, prot);
      ^
   drivers/firmware/efi/arm-runtime.c: In function 
'arm_enable_runtime_services':
   drivers/firmware/efi/arm-runtime.c:107:2: error: implicit declaration of 
function '__arm_efi_memremap' [-Werror=implicit-function-declaration]
     memmap.map = (__force void *)__arm_efi_memremap(
     ^
   drivers/firmware/efi/arm-runtime.c:107:15: warning: cast to pointer from 
integer of different size [-Wint-to-pointer-cast]
     memmap.map = (__force void *)__arm_efi_memremap(
                  ^
   drivers/firmware/efi/arm-runtime.c:120:2: error: implicit declaration of 
function '__arm_efi_memunmap' [-Werror=implicit-function-declaration]
     __arm_efi_memunmap(memmap.map);
     ^
   drivers/firmware/efi/arm-runtime.c: In function 'efi_virtmap_load':
   drivers/firmware/efi/arm-runtime.c:135:2: error: implicit declaration of 
function 'efi_set_pgd' [-Werror=implicit-function-declaration]
     efi_set_pgd(&efi_mm);
     ^
   cc1: some warnings being treated as errors

git remote add ard.biesheuvel 
https://git.linaro.org/people/ard.biesheuvel/linux-arm
git remote update ard.biesheuvel
git checkout cd6882c5f60e1afcee1e870d73860f2f3cbe13e6
vim +107 drivers/firmware/efi/arm-runtime.c

2d7aa70aa Ard Biesheuvel 2015-04-28   47        efi_memory_desc_t *md;
2d7aa70aa Ard Biesheuvel 2015-04-28   48  
cd6882c5f Ard Biesheuvel 2015-04-28   49        efi_mm.pgd = pgd_alloc(&efi_mm);
cd6882c5f Ard Biesheuvel 2015-04-28   50  
2d7aa70aa Ard Biesheuvel 2015-04-28   51        
for_each_efi_memory_desc(&memmap, md) {
2d7aa70aa Ard Biesheuvel 2015-04-28   52                u64 paddr, npages, size;
cd6882c5f Ard Biesheuvel 2015-04-28  @53                __arm_efi_prot_t prot;
2d7aa70aa Ard Biesheuvel 2015-04-28   54  
2d7aa70aa Ard Biesheuvel 2015-04-28   55                if (!(md->attribute & 
EFI_MEMORY_RUNTIME))
2d7aa70aa Ard Biesheuvel 2015-04-28   56                        continue;
2d7aa70aa Ard Biesheuvel 2015-04-28   57                if (md->virt_addr == 0)
2d7aa70aa Ard Biesheuvel 2015-04-28   58                        return false;
2d7aa70aa Ard Biesheuvel 2015-04-28   59  
2d7aa70aa Ard Biesheuvel 2015-04-28   60                paddr = md->phys_addr;
2d7aa70aa Ard Biesheuvel 2015-04-28   61                npages = md->num_pages;
2d7aa70aa Ard Biesheuvel 2015-04-28   62                
memrange_efi_to_native(&paddr, &npages);
2d7aa70aa Ard Biesheuvel 2015-04-28   63                size = npages << 
PAGE_SHIFT;
2d7aa70aa Ard Biesheuvel 2015-04-28   64  
cd6882c5f Ard Biesheuvel 2015-04-28   65                pr_info("  EFI remap 
%pa => %p\n",
cd6882c5f Ard Biesheuvel 2015-04-28   66                        &md->phys_addr, 
(void *)(unsigned long)md->virt_addr);
2d7aa70aa Ard Biesheuvel 2015-04-28   67  
2d7aa70aa Ard Biesheuvel 2015-04-28   68                /*
2d7aa70aa Ard Biesheuvel 2015-04-28   69                 * Only regions of type 
EFI_RUNTIME_SERVICES_CODE need to be
2d7aa70aa Ard Biesheuvel 2015-04-28   70                 * executable, 
everything else can be mapped with the XN bits
2d7aa70aa Ard Biesheuvel 2015-04-28   71                 * set.
2d7aa70aa Ard Biesheuvel 2015-04-28   72                 */
2d7aa70aa Ard Biesheuvel 2015-04-28   73                if (md->type == 
EFI_MEMORY_MAPPED_IO)
cd6882c5f Ard Biesheuvel 2015-04-28   74                        prot = 
__EFI_DEVICE;
2d7aa70aa Ard Biesheuvel 2015-04-28   75                else if (md->type == 
EFI_RUNTIME_SERVICES_CODE)
cd6882c5f Ard Biesheuvel 2015-04-28   76                        prot = 
__EFI_MEMORY_RWX;
2d7aa70aa Ard Biesheuvel 2015-04-28   77                else
cd6882c5f Ard Biesheuvel 2015-04-28   78                        prot = 
__EFI_MEMORY_RW;
2d7aa70aa Ard Biesheuvel 2015-04-28   79  
cd6882c5f Ard Biesheuvel 2015-04-28   80                
create_efi_mapping(&efi_mm, paddr, md->virt_addr, size, prot);
2d7aa70aa Ard Biesheuvel 2015-04-28   81        }
2d7aa70aa Ard Biesheuvel 2015-04-28   82        return true;
2d7aa70aa Ard Biesheuvel 2015-04-28   83  }
2d7aa70aa Ard Biesheuvel 2015-04-28   84  
2d7aa70aa Ard Biesheuvel 2015-04-28   85  /*
2d7aa70aa Ard Biesheuvel 2015-04-28   86   * Enable the UEFI Runtime Services 
if all prerequisites are in place, i.e.,
2d7aa70aa Ard Biesheuvel 2015-04-28   87   * non-early mapping of the UEFI 
system table and virtual mappings for all
2d7aa70aa Ard Biesheuvel 2015-04-28   88   * EFI_MEMORY_RUNTIME regions.
2d7aa70aa Ard Biesheuvel 2015-04-28   89   */
cd6882c5f Ard Biesheuvel 2015-04-28   90  static int __init 
arm_enable_runtime_services(void)
2d7aa70aa Ard Biesheuvel 2015-04-28   91  {
2d7aa70aa Ard Biesheuvel 2015-04-28   92        u64 mapsize;
2d7aa70aa Ard Biesheuvel 2015-04-28   93  
2d7aa70aa Ard Biesheuvel 2015-04-28   94        if (!efi_enabled(EFI_BOOT)) {
2d7aa70aa Ard Biesheuvel 2015-04-28   95                pr_info("EFI services 
will not be available.\n");
2d7aa70aa Ard Biesheuvel 2015-04-28   96                return -1;
2d7aa70aa Ard Biesheuvel 2015-04-28   97        }
2d7aa70aa Ard Biesheuvel 2015-04-28   98  
2d7aa70aa Ard Biesheuvel 2015-04-28   99        if (efi_runtime_disabled()) {
2d7aa70aa Ard Biesheuvel 2015-04-28  100                pr_info("EFI runtime 
services will be disabled.\n");
2d7aa70aa Ard Biesheuvel 2015-04-28  101                return -1;
2d7aa70aa Ard Biesheuvel 2015-04-28  102        }
2d7aa70aa Ard Biesheuvel 2015-04-28  103  
2d7aa70aa Ard Biesheuvel 2015-04-28  104        pr_info("Remapping and enabling 
EFI services.\n");
2d7aa70aa Ard Biesheuvel 2015-04-28  105  
2d7aa70aa Ard Biesheuvel 2015-04-28  106        mapsize = memmap.map_end - 
memmap.map;
cd6882c5f Ard Biesheuvel 2015-04-28 @107        memmap.map = (__force void 
*)__arm_efi_memremap(
cd6882c5f Ard Biesheuvel 2015-04-28  108                        
(phys_addr_t)(unsigned long)memmap.phys_map, mapsize);
2d7aa70aa Ard Biesheuvel 2015-04-28  109        if (!memmap.map) {
2d7aa70aa Ard Biesheuvel 2015-04-28  110                pr_err("Failed to remap 
EFI memory map\n");

---
0-DAY kernel test infrastructure                Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild                 Intel Corporation
_______________________________________________
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild

Reply via email to