brintos

brintos / linux-shallow public Read only

0
0
Text · 2.4 KiB · 9205122 Raw
76 lines · plain
1What:		/sys/firmware/memmap/2Date:		June 20083Contact:	Bernhard Walle <bernhard.walle@gmx.de>4Description:5		On all platforms, the firmware provides a memory map which the6		kernel reads. The resources from that memory map are registered7		in the kernel resource tree and exposed to userspace via8		/proc/iomem (together with other resources).9 10		However, on most architectures that firmware-provided memory11		map is modified afterwards by the kernel itself, either because12		the kernel merges that memory map with other information or13		just because the user overwrites that memory map via command14		line.15 16		kexec needs the raw firmware-provided memory map to setup the17		parameter segment of the kernel that should be booted with18		kexec. Also, the raw memory map is useful for debugging. For19		that reason, /sys/firmware/memmap is an interface that provides20		the raw memory map to userspace.21 22		The structure is as follows: Under /sys/firmware/memmap there23		are subdirectories with the number of the entry as their name::24 25			/sys/firmware/memmap/026			/sys/firmware/memmap/127			/sys/firmware/memmap/228			/sys/firmware/memmap/329			...30 31		The maximum depends on the number of memory map entries provided32		by the firmware. The order is just the order that the firmware33		provides.34 35		Each directory contains three files:36 37		========  =====================================================38		start	  The start address (as hexadecimal number with the39			  '0x' prefix).40		end	  The end address, inclusive (regardless whether the41			  firmware provides inclusive or exclusive ranges).42		type	  Type of the entry as string. See below for a list of43			  valid types.44		========  =====================================================45 46		So, for example::47 48			/sys/firmware/memmap/0/start49			/sys/firmware/memmap/0/end50			/sys/firmware/memmap/0/type51			/sys/firmware/memmap/1/start52			...53 54		Currently following types exist:55 56		  - System RAM57		  - ACPI Tables58		  - ACPI Non-volatile Storage59		  - Unusable memory60		  - Persistent Memory (legacy)61		  - Persistent Memory62		  - Soft Reserved63		  - reserved64 65		Following shell snippet can be used to display that memory66		map in a human-readable format::67 68		  #!/bin/bash69		  cd /sys/firmware/memmap70		  for dir in * ; do71		      start=$(cat $dir/start)72		      end=$(cat $dir/end)73		      type=$(cat $dir/type)74		      printf "%016x-%016x (%s)\n" $start $[ $end +1] "$type"75		  done76