From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Mon, 22 Aug 2011 22:10:24 +0200 Subject: [U-Boot] [RFC][PATCH] Replace clunky init sequence architecture In-Reply-To: <1313670862-31216-1-git-send-email-graeme.russ@gmail.com> References: <1313670862-31216-1-git-send-email-graeme.russ@gmail.com> Message-ID: <20110822201024.505BD11EF9D9@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Graeme Russ, In message <1313670862-31216-1-git-send-email-graeme.russ@gmail.com> you wrote: > NOTE: This is an x86 only patch - I didn't include x86 in the patch heading > because it is a proof of concept for a global patch - Sorry for the blatant > etiquette violation ;) Don't worry. For an RFC tyhis is OK. > Replace the init_fnc_t *init_sequence[] style init sequence with one based > on the Linux __initcall macros. > > Functions are declared as initialisation functions by using the new > INIT_FUNC() macro. The three parameters to INIT_FUNC() are: > - Type - f = pre-relocation (flash), r = post-relocation (RAM) > - Sequence - Lower numbers are run first > - Function - The function to call during the init sequence For general remarks please see my previous comment to your older posting about this topic here: http://article.gmane.org/gmane.comp.boot-loaders.u-boot/105824 > For a board to add an arbitrary initialisation function is trivial - > simply add a INIT_FUNC() entry with an appropriate sequence number This is actually hte biffest voncern I have: I cannot imagine how you will try to figure out the exact init sequence when writing the code (or, even worse, when reading somebody else's code). > I imagine the sequence numbers could be #defined, but I don't exactly > now what the linker will do - I use leading zeros in the sequence numbers > to ensure correct ordering. This is another concern: what exactly will the linker do, and different versions of linkers with differen options and/or levels of optimization? Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Real computer scientists don't comment their code. The identifiers are so long they can't afford the disk space.