0001 What: /sys/firmware/memmap/
0002 Date: June 2008
0003 Contact: Bernhard Walle <bernhard.walle@gmx.de>
0004 Description:
0005 On all platforms, the firmware provides a memory map which the
0006 kernel reads. The resources from that memory map are registered
0007 in the kernel resource tree and exposed to userspace via
0008 /proc/iomem (together with other resources).
0009
0010 However, on most architectures that firmware-provided memory
0011 map is modified afterwards by the kernel itself, either because
0012 the kernel merges that memory map with other information or
0013 just because the user overwrites that memory map via command
0014 line.
0015
0016 kexec needs the raw firmware-provided memory map to setup the
0017 parameter segment of the kernel that should be booted with
0018 kexec. Also, the raw memory map is useful for debugging. For
0019 that reason, /sys/firmware/memmap is an interface that provides
0020 the raw memory map to userspace.
0021
0022 The structure is as follows: Under /sys/firmware/memmap there
0023 are subdirectories with the number of the entry as their name::
0024
0025 /sys/firmware/memmap/0
0026 /sys/firmware/memmap/1
0027 /sys/firmware/memmap/2
0028 /sys/firmware/memmap/3
0029 ...
0030
0031 The maximum depends on the number of memory map entries provided
0032 by the firmware. The order is just the order that the firmware
0033 provides.
0034
0035 Each directory contains three files:
0036
0037 ======== =====================================================
0038 start The start address (as hexadecimal number with the
0039 '0x' prefix).
0040 end The end address, inclusive (regardless whether the
0041 firmware provides inclusive or exclusive ranges).
0042 type Type of the entry as string. See below for a list of
0043 valid types.
0044 ======== =====================================================
0045
0046 So, for example::
0047
0048 /sys/firmware/memmap/0/start
0049 /sys/firmware/memmap/0/end
0050 /sys/firmware/memmap/0/type
0051 /sys/firmware/memmap/1/start
0052 ...
0053
0054 Currently following types exist:
0055
0056 - System RAM
0057 - ACPI Tables
0058 - ACPI Non-volatile Storage
0059 - Unusable memory
0060 - Persistent Memory (legacy)
0061 - Persistent Memory
0062 - Soft Reserved
0063 - reserved
0064
0065 Following shell snippet can be used to display that memory
0066 map in a human-readable format::
0067
0068 #!/bin/bash
0069 cd /sys/firmware/memmap
0070 for dir in * ; do
0071 start=$(cat $dir/start)
0072 end=$(cat $dir/end)
0073 type=$(cat $dir/type)
0074 printf "%016x-%016x (%s)\n" $start $[ $end +1] "$type"
0075 done