efi.c (1cbc99dfe5d7d686fd022647f4e489b5eb8e9068) | efi.c (78ce248faa3c46e24e9bd42db3ab3650659f16dd) |
---|---|
1/* 2 * efi.c - EFI subsystem 3 * 4 * Copyright (C) 2001,2003,2004 Dell <Matt_Domsch@dell.com> 5 * Copyright (C) 2004 Intel Corporation <matthew.e.tolentino@intel.com> 6 * Copyright (C) 2013 Tom Gundersen <teg@jklm.no> 7 * 8 * This code registers /sys/firmware/efi{,/efivars} when EFI is supported, --- 606 unchanged lines hidden (view full) --- 615 * 616 * Despite being marked __weak, most architectures should *not* 617 * override this function. It is __weak solely for the benefit 618 * of ia64 which has a funky EFI memory map that doesn't work 619 * the same way as other architectures. 620 */ 621u64 __weak efi_mem_attributes(unsigned long phys_addr) 622{ | 1/* 2 * efi.c - EFI subsystem 3 * 4 * Copyright (C) 2001,2003,2004 Dell <Matt_Domsch@dell.com> 5 * Copyright (C) 2004 Intel Corporation <matthew.e.tolentino@intel.com> 6 * Copyright (C) 2013 Tom Gundersen <teg@jklm.no> 7 * 8 * This code registers /sys/firmware/efi{,/efivars} when EFI is supported, --- 606 unchanged lines hidden (view full) --- 615 * 616 * Despite being marked __weak, most architectures should *not* 617 * override this function. It is __weak solely for the benefit 618 * of ia64 which has a funky EFI memory map that doesn't work 619 * the same way as other architectures. 620 */ 621u64 __weak efi_mem_attributes(unsigned long phys_addr) 622{ |
623 struct efi_memory_map *map; | |
624 efi_memory_desc_t *md; | 623 efi_memory_desc_t *md; |
625 void *p; | |
626 627 if (!efi_enabled(EFI_MEMMAP)) 628 return 0; 629 | 624 625 if (!efi_enabled(EFI_MEMMAP)) 626 return 0; 627 |
630 map = efi.memmap; 631 for (p = map->map; p < map->map_end; p += map->desc_size) { 632 md = p; | 628 for_each_efi_memory_desc(md) { |
633 if ((md->phys_addr <= phys_addr) && 634 (phys_addr < (md->phys_addr + 635 (md->num_pages << EFI_PAGE_SHIFT)))) 636 return md->attribute; 637 } 638 return 0; 639} | 629 if ((md->phys_addr <= phys_addr) && 630 (phys_addr < (md->phys_addr + 631 (md->num_pages << EFI_PAGE_SHIFT)))) 632 return md->attribute; 633 } 634 return 0; 635} |