
Hello Wolfgang,
Wolfgang Denk wrote:
Please don't call empty functions if you can avoid it. It adds to the code size, and makes understanding the code much harder.
No problem. I can easily #ifdef the call to UcodeCopy rather than the body itself, since it's predicated on the need for the patch. But cpm_load_patch() should still has to be called unconditionally and if no relocation is required at all, it will be empty. This is a small price to pay for the ability to handle different cases automatically without the need to worry about whether a microcode patch is actually needed (because depending on the CPU and actual settings there might be no relocation or relocation with or without a patch).
I believe that we need some centralized code, because certain combination of patches/devices do affect other devices (that's the nature of microcode patches provided my Motorola) that might not really be used by a certain board, but still have to be programmed correctly. For example, the combined I2C/SPI/SMC relocation patch requires correct rpbase settings on both SMC1 and SMC2 regardless of whether you plan to use them or not.
Unfortunately, all these dependancies are a little difficult to express via C preprocessor (at least not without making the configuration much more complex and error prone). You can see that the code in mpc8xx_upatch.h got pretty complex on its own.
Regards, Vladimir