• Bernhard Walle's avatar
    sysfs: add /sys/firmware/memmap · 69ac9cd6
    Bernhard Walle authored
    This patch adds /sys/firmware/memmap interface that represents the BIOS
    (or Firmware) provided memory map. The tree looks like:
    
        /sys/firmware/memmap/0/start   (hex number)
                               end     (hex number)
                               type    (string)
        ...                 /1/start
                               end
                               type
    
    With the following shell snippet one can print the memory map in the same form
    the kernel prints itself when booting on x86 (the E820 map).
    
      --------- 8< --------------------------
        #!/bin/sh
        cd /sys/firmware/memmap
        for dir in * ; do
            start=$(cat $dir/start)
            end=$(cat $dir/end)
            type=$(cat $dir/type)
            printf "%016x-%016x (%s)\n" $start $[ $end +1] "$type"
        done
      --------- >8 --------------------------
    
    That patch only provides the needed interface:
    
     1. The sysfs interface.
     2. The structure and enumeration definition.
     3. The function firmware_map_add() and firmware_ma...
    69ac9cd6
sysfs-firmware-memmap 2.27 KB