1 /* 2 * SPDX-License-Identifier: Apache-2.0 3 * Copyright (c) 2019 Intel Corp. 4 */ 5 6 #include <zephyr/kernel.h> 7 #include <zephyr/arch/x86/memmap.h> 8 memmap(void)9void memmap(void) 10 { 11 printk("MEMORY MAP: source is "); 12 13 switch (x86_memmap_source) { 14 case X86_MEMMAP_SOURCE_DEFAULT: 15 printk("default"); 16 break; 17 case X86_MEMMAP_SOURCE_MULTIBOOT_MEM: 18 printk("Multiboot basic map"); 19 break; 20 case X86_MEMMAP_SOURCE_MULTIBOOT_MMAP: 21 printk("Multiboot extended map"); 22 break; 23 case X86_MEMMAP_SOURCE_MANUAL: 24 printk("manual"); 25 break; 26 default: 27 printk("unknown"); 28 } 29 30 printk(", max %d entries\n", CONFIG_X86_MEMMAP_ENTRIES); 31 32 for (int i = 0; i < CONFIG_X86_MEMMAP_ENTRIES; ++i) { 33 struct x86_memmap_entry *entry = x86_memmap + i; 34 const char *label; 35 36 switch (entry->type) { 37 case X86_MEMMAP_ENTRY_UNUSED: 38 continue; 39 case X86_MEMMAP_ENTRY_RAM: 40 label = "RAM"; 41 break; 42 case X86_MEMMAP_ENTRY_ACPI: 43 label = "ACPI"; 44 break; 45 case X86_MEMMAP_ENTRY_NVS: 46 label = "NVS"; 47 break; 48 case X86_MEMMAP_ENTRY_DEFECTIVE: 49 label = "DEFECTIVE"; 50 break; 51 default: 52 label = "UNKNOWN"; 53 } 54 55 printk("\t%016llx -> %016llx %s (%lldK)\n", 56 entry->base, entry->base + entry->length - 1, 57 label, 58 entry->length / 1024); 59 } 60 61 printk("\n\tKernel exclusions:\n"); 62 63 for (int i = 0; i < x86_nr_memmap_exclusions; ++i) { 64 printk("\t%p -> %p (%s)\n", 65 x86_memmap_exclusions[i].start, 66 x86_memmap_exclusions[i].end, 67 x86_memmap_exclusions[i].name); 68 } 69 70 printk("\n"); 71 } 72