1*4882a593SmuzhiyunWhat: /sys/firmware/memmap/ 2*4882a593SmuzhiyunDate: June 2008 3*4882a593SmuzhiyunContact: Bernhard Walle <bernhard.walle@gmx.de> 4*4882a593SmuzhiyunDescription: 5*4882a593Smuzhiyun On all platforms, the firmware provides a memory map which the 6*4882a593Smuzhiyun kernel reads. The resources from that memory map are registered 7*4882a593Smuzhiyun in the kernel resource tree and exposed to userspace via 8*4882a593Smuzhiyun /proc/iomem (together with other resources). 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun However, on most architectures that firmware-provided memory 11*4882a593Smuzhiyun map is modified afterwards by the kernel itself, either because 12*4882a593Smuzhiyun the kernel merges that memory map with other information or 13*4882a593Smuzhiyun just because the user overwrites that memory map via command 14*4882a593Smuzhiyun line. 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun kexec needs the raw firmware-provided memory map to setup the 17*4882a593Smuzhiyun parameter segment of the kernel that should be booted with 18*4882a593Smuzhiyun kexec. Also, the raw memory map is useful for debugging. For 19*4882a593Smuzhiyun that reason, /sys/firmware/memmap is an interface that provides 20*4882a593Smuzhiyun the raw memory map to userspace. 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun The structure is as follows: Under /sys/firmware/memmap there 23*4882a593Smuzhiyun are subdirectories with the number of the entry as their name:: 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun /sys/firmware/memmap/0 26*4882a593Smuzhiyun /sys/firmware/memmap/1 27*4882a593Smuzhiyun /sys/firmware/memmap/2 28*4882a593Smuzhiyun /sys/firmware/memmap/3 29*4882a593Smuzhiyun ... 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun The maximum depends on the number of memory map entries provided 32*4882a593Smuzhiyun by the firmware. The order is just the order that the firmware 33*4882a593Smuzhiyun provides. 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun Each directory contains three files: 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun ======== ===================================================== 38*4882a593Smuzhiyun start The start address (as hexadecimal number with the 39*4882a593Smuzhiyun '0x' prefix). 40*4882a593Smuzhiyun end The end address, inclusive (regardless whether the 41*4882a593Smuzhiyun firmware provides inclusive or exclusive ranges). 42*4882a593Smuzhiyun type Type of the entry as string. See below for a list of 43*4882a593Smuzhiyun valid types. 44*4882a593Smuzhiyun ======== ===================================================== 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun So, for example:: 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun /sys/firmware/memmap/0/start 49*4882a593Smuzhiyun /sys/firmware/memmap/0/end 50*4882a593Smuzhiyun /sys/firmware/memmap/0/type 51*4882a593Smuzhiyun /sys/firmware/memmap/1/start 52*4882a593Smuzhiyun ... 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun Currently following types exist: 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun - System RAM 57*4882a593Smuzhiyun - ACPI Tables 58*4882a593Smuzhiyun - ACPI Non-volatile Storage 59*4882a593Smuzhiyun - reserved 60*4882a593Smuzhiyun 61*4882a593Smuzhiyun Following shell snippet can be used to display that memory 62*4882a593Smuzhiyun map in a human-readable format:: 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun #!/bin/bash 65*4882a593Smuzhiyun cd /sys/firmware/memmap 66*4882a593Smuzhiyun for dir in * ; do 67*4882a593Smuzhiyun start=$(cat $dir/start) 68*4882a593Smuzhiyun end=$(cat $dir/end) 69*4882a593Smuzhiyun type=$(cat $dir/type) 70*4882a593Smuzhiyun printf "%016x-%016x (%s)\n" $start $[ $end +1] "$type" 71*4882a593Smuzhiyun done 72