sysfs-firmware-memmap 2.4 KB

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