Am 11.01.2010 23:41, schrieb Peter Stuge:
Patrick Georgi wrote:
- Implement it like in southbridge/amd/amd8111:
4a. Add a new file (I recommend "southbridge/$vendor/$device/bootblock.c") with a static void bootblock_southbridge_init(void) function that enables rom mapping 4b. Set BOOTBLOCK_SOUTHBRIDGE_INIT to point to the file
Please can some of these be renamed?
map_rom.c (or map_full_rom.c or possibly enable_rom_decode.c) southbridge_map_rom() (or similar per filename above)
We already have $chipsetid_enable_rom.c in some directories, which can't easily be reused for tinybootblock (romcc vs. gcc differences). I used such generic names because we might decide that we also want to have serial enable in the bootblock.
My reasoning is that the build system is a great place to describe _when_ files are used, but code and filenames need only say _what_ they do - if there is one single convention.
I think 4b. should be made general. I don't know if I prefer always including the file and having an empty function, or allowing the file to be included only for southbridges where it actually exists. Empty functions really suck; source code noise. Automagic build rules do too; rename a file and get a runtime error instead of a buildtime error. I have to go with the lesser evil; the empty function.
If the config variable and the filename disagree, the compiler fails to find the file. That's a buildtime error, as far as I can see.
Your proposal would mean that there's a default value for BOOTBLOCK_SOUTHBRIDGE_INIT, probably in src/arch/i386/Kconfig, which points to the dummy. You forget to change the value and it uses the empty function, instead of what it actually should use - that's a silent (but instant) runtime error.
Patrick