Skip to content
Snippets Groups Projects
  • Chuanhong Guo's avatar
    2f024b79
    ramips: mt7621: do memory detection on KSEG1 · 2f024b79
    Chuanhong Guo authored
    
    It's reported that current memory detection code occasionally detects
    larger memory under some bootloaders.
    Current memory detection code tests whether address space wraps around
    on KSEG0, which is unreliable because it's cached.
    
    Rewrite memory size detection to perform the same test on KSEG1 instead.
    While at it, this patch also does the following two things:
    1. use a fixed pattern instead of a random function pointer as the magic
       value.
    2. add an additional memory write and a second comparison as part of the
       test to prevent possible smaller memory detection result due to
       leftover values in memory.
    
    Fixes: 6d91ddf5 ("ramips: mt7621: add support for memory detection")
    Reported-by: default avatarRui Salvaterra <rsalvaterra@gmail.com>
    Tested-by: default avatarRui Salvaterra <rsalvaterra@gmail.com>
    Signed-off-by: default avatarChuanhong Guo <gch981213@gmail.com>
    2f024b79
    History
    ramips: mt7621: do memory detection on KSEG1
    Chuanhong Guo authored
    
    It's reported that current memory detection code occasionally detects
    larger memory under some bootloaders.
    Current memory detection code tests whether address space wraps around
    on KSEG0, which is unreliable because it's cached.
    
    Rewrite memory size detection to perform the same test on KSEG1 instead.
    While at it, this patch also does the following two things:
    1. use a fixed pattern instead of a random function pointer as the magic
       value.
    2. add an additional memory write and a second comparison as part of the
       test to prevent possible smaller memory detection result due to
       leftover values in memory.
    
    Fixes: 6d91ddf5 ("ramips: mt7621: add support for memory detection")
    Reported-by: default avatarRui Salvaterra <rsalvaterra@gmail.com>
    Tested-by: default avatarRui Salvaterra <rsalvaterra@gmail.com>
    Signed-off-by: default avatarChuanhong Guo <gch981213@gmail.com>