• Home
  • Raw
  • Download

Lines Matching +full:merge +full:- +full:base

1 // SPDX-License-Identifier: GPL-2.0+
35 { EFI_MEMORY_WC_SHIFT, "write-coalescing" },
36 { EFI_MEMORY_WT_SHIFT, "write-through" },
37 { EFI_MEMORY_WB_SHIFT, "write-back" },
39 { EFI_MEMORY_WP_SHIFT, "write-protect" },
40 { EFI_MEMORY_RP_SHIFT, "read-protect" },
41 { EFI_MEMORY_XP_SHIFT, "execute-protect" },
59 int64_t diff = desc1->physical_start - desc2->physical_start; in h_cmp_entry()
62 * Manually calculate the difference to avoid sign loss in the 64-bit in h_cmp_entry()
63 * to 32-bit conversion in h_cmp_entry()
65 return diff < 0 ? -1 : diff > 0 ? 1 : 0; in h_cmp_entry()
70 struct efi_mem_desc *desc, *end, *base, *dest, *prev; in efi_build_mem_table() local
74 base = malloc(size + sizeof(*desc)); in efi_build_mem_table()
75 if (!base) { in efi_build_mem_table()
80 count = ((ulong)end - (ulong)map->desc) / map->desc_size; in efi_build_mem_table()
81 memcpy(base, map->desc, (ulong)end - (ulong)map->desc); in efi_build_mem_table()
82 qsort(base, count, map->desc_size, h_cmp_entry); in efi_build_mem_table()
85 dest = base; in efi_build_mem_table()
86 end = (struct efi_mem_desc *)((ulong)base + count * map->desc_size); in efi_build_mem_table()
87 for (desc = base; desc < end; desc = efi_get_next_mem_desc(map, desc)) { in efi_build_mem_table()
88 bool merge = true; in efi_build_mem_table() local
89 int type = desc->type; in efi_build_mem_table()
91 if (skip_bs && is_boot_services(desc->type)) in efi_build_mem_table()
94 memcpy(dest, desc, map->desc_size); in efi_build_mem_table()
95 dest->type = type; in efi_build_mem_table()
97 merge = false; in efi_build_mem_table()
98 else if (desc->physical_start != addr) in efi_build_mem_table()
99 merge = false; in efi_build_mem_table()
101 merge = false; in efi_build_mem_table()
102 else if (prev->type != EFI_CONVENTIONAL_MEMORY) in efi_build_mem_table()
103 merge = false; in efi_build_mem_table()
105 if (merge) { in efi_build_mem_table()
106 prev->num_pages += desc->num_pages; in efi_build_mem_table()
111 addr = desc->physical_start + (desc->num_pages << in efi_build_mem_table()
116 dest->type = EFI_TABLE_END; in efi_build_mem_table()
118 return base; in efi_build_mem_table()
129 printf(" # %-14s %10s %10s %10s %s\n", "Type", "Physical", in efi_print_mem_table()
135 for (upto = 0; desc->type != EFI_TABLE_END; in efi_print_mem_table()
140 if (skip_bs && is_boot_services(desc->type)) in efi_print_mem_table()
142 if (desc->physical_start != addr) { in efi_print_mem_table()
143 printf(" %-14s %010llx %10s %010llx\n", "<gap>", in efi_print_mem_table()
144 addr, "", desc->physical_start - addr); in efi_print_mem_table()
146 size = desc->num_pages << EFI_PAGE_SHIFT; in efi_print_mem_table()
148 name = desc->type < ARRAY_SIZE(type_name) ? in efi_print_mem_table()
149 type_name[desc->type] : "<invalid>"; in efi_print_mem_table()
150 printf("%2d %x:%-12s %010llx %010llx %010llx ", upto, in efi_print_mem_table()
151 desc->type, name, desc->physical_start, in efi_print_mem_table()
152 desc->virtual_start, size); in efi_print_mem_table()
153 if (desc->attribute & EFI_MEMORY_RUNTIME) in efi_print_mem_table()
155 printf("%llx", desc->attribute & ~EFI_MEMORY_RUNTIME); in efi_print_mem_table()
159 if (attr_seen[i] == desc->attribute) in efi_print_mem_table()
163 attr_seen[attr_seen_count++] = desc->attribute; in efi_print_mem_table()
164 addr = desc->physical_start + size; in efi_print_mem_table()
200 case -ENOENT: in do_efi_mem()
203 case -EPROTONOSUPPORT: in do_efi_mem()
208 gd->arch.table, map, size, map->version, map->desc_size); in do_efi_mem()
209 if (map->version != EFI_MEM_DESC_VERSION) { in do_efi_mem()
211 ret = -EPROTONOSUPPORT; in do_efi_mem()
217 ret = -ENOMEM; in do_efi_mem()
242 argc -= 2; in do_efi()
244 if (!efi_cmd || argc > efi_cmd->maxargs) in do_efi()
247 ret = efi_cmd->cmd(efi_cmd, flag, argc, argv); in do_efi()