Re: [PATCH 0/5] SRAM patcher: patch register addresses in SRAM code at runtime

Kevin Hilman
2007-11-14T17:38:26Z

On Wed, 2007-11-14 at 01:30 -0700, Paul Walmsley wrote:
> Several SRAM-based assembly-language routines in the Linux OMAP kernel
> use hardcoded virtual addresses to access system registers. These
> addresses were defined at compile-time by the preprocessor, since the
> same registers often appeared at different virtual addresses
> depending upon the target OMAP architecture. Hardcoding the addresses
> is efficient and convenient to implement; but precludes a single kernel
> binary image from supporting multiple OMAP architectures.
>
> This patches implement a different approach. They patch in the
> correct register addresses at runtime into the SRAM, just after the
> code is copied there. While the current code simply writes in the
> preprocessor-defined address bases, a forthcoming patch series uses
> this code to write runtime-computed address bases.
>
> The code that does the patching is quite paranoid by default, and will
> refuse to overwrite any address that does not contain a magic number,
> SRAM_VA_MAGIC. It also contains debugging printks which can be
> activated by defining the DEBUG symbol in sram.c and compiling with
> CONFIG_DEBUG_LL enabled.
>
> Boot-tested on N800 and 3430SDP. If someone out there with a 2430SDP
> can give these a whirl, that would be appreciated. Comments welcome,

Looks good for 2430DSP.

I tested suspend, and sleep-when-idle (both of which can hit full
retention BTW.)

Kevin