From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Hellstrom Date: Thu, 13 Mar 2008 13:53:42 +0100 Subject: [U-Boot-Users] [PATCH 5/8] SPARC: Added AMBA PnP Information listing command for LEON3 In-Reply-To: <20080313121731.80797247AF@gemini.denx.de> References: <20080313121731.80797247AF@gemini.denx.de> Message-ID: <47D923D6.10605@gaisler.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Wolfgang Denk wrote: >In message <47D8F64D.6030903@gaisler.com> you wrote: > > >>This patch adds an U-Boot command, ambapp, which prints a summary >>of AMBA Bus Plug & Play information. >> >> >... > > >>diff --git a/common/Makefile b/common/Makefile >>index a88d1ef..3d369ff 100644 >>--- a/common/Makefile >>+++ b/common/Makefile >>@@ -91,6 +91,7 @@ COBJS-$(CONFIG_CMD_STRINGS) += cmd_strings.o >> COBJS-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o >> COBJS-$(CONFIG_CMD_UNIVERSE) += cmd_universe.o >> COBJS-$(CONFIG_CMD_USB) += cmd_usb.o >>+COBJS-y += cmd_ambapp.o >> >> > >Please compile the code only for boards that enable it in the >configuration. > > Ok. > > >>diff --git a/common/cmd_ambapp.c b/common/cmd_ambapp.c >>new file mode 100644 >>index 0000000..5329a3a >>--- /dev/null >>+++ b/common/cmd_ambapp.c >> >> >... >... > > >>+#include >>+#include >>+ >>+#if defined(CONFIG_CMD_AMBAPP) >> >> > >This should not be needed any more, then. > > > >>+#ifndef CONFIG_LEON3 >>+#error Only LEON3 processors support the AMBA Plug&Play bus >>+#endif >>+ >>+#include >>+ >>+DECLARE_GLOBAL_DATA_PTR; >>+ >>+/* We put these variables into .data section so that they are >>+ * zero when entering the AMBA Plug & Play Section the first time. >>+ * BSS is not garantueed to be zero since BSS hasn't been cleared >>+ * the first times entering the AMBA functions. >>+ */ >> >> > >Um.... when would that be? Command code like this cannot be executed >before relocation to RAM, and by then the BSS *is* zeroed. > > > One part of this patch was part of the LEON2&3 patch, I missed that. cpu/leon3/ambapp.c:31,73,220 The thing is that the ambapp_apb_print variable is used when executing in rom before BSS has been cleared (cpu/leon3/ambapp.c:74 called from cpu/leon3/cpu_init.c:92 used to find the IRQ contoller). This is the case only because the ambapp command extends the standard leon3 scanning functions with a callback that is responsible to print what is found during scanning. The ambapp_apb_print controls if the callback function is called or not. I choose to implement it like this for smaller size, else I would have two scanning routines doing almost the exact same thing. Best Regards, Daniel Hellstrom >Best regards, > >Wolfgang Denk > > >