From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johnny Hung Subject: Re: How the kernel printk works before do console_setup. Date: Thu, 25 Jun 2009 14:27:54 +0800 Message-ID: References: <4A41B3A5.9010807@am.sony.com> <1245884203.21200.18.camel@pasglop> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=4njc4OwCo6Gbr3WtPjuFOt5cyESNMmZO1DWrFOpsCdE=; b=lr3X0miWfne+LW/4TbvZaK5tK6nNuBMa9ZLHvIBahJbiU5+KvpbIDtlbT+j0bcUmGj 7KS2B4teUjXQB9gsg8HLgQMWcbDfQP7idx+Uzkry2kJr+k+aPZwiK/ED8gVILYdjVHTx xzDfzdljaB7QuNNYvdtW1EzepTG9hlyJfNQak= In-Reply-To: <1245884203.21200.18.camel@pasglop> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+glppd-linuxppc64-dev=m.gmane.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+glppd-linuxppc64-dev=m.gmane.org@lists.ozlabs.org To: Benjamin Herrenschmidt Cc: linuxppc-dev@lists.ozlabs.org, linux-embedded@vger.kernel.org, linux-kernel@vger.kernel.org 2009/6/25 Benjamin Herrenschmidt : > >> Before the console is set up, the printk data is formatted >> and put into the kernel log buffer, but not sent to any console. >> Any messages printk'ed before that are buffered but do not >> appear. =A0When the console is initialized, then all buffered >> messages are sent to the console, and subsequent printks cause >> the message to go to the log buffer, but then immediately >> get sent from there to the console. >> >> Under certain conditions you can examine the log buffer of >> a kernel that failed to initialize it's console, after a >> warm reset of the machine, using the firmware memory dump >> command. > > On ppc, we have tricks to display things earlier :-) > > We can initialize the serial ports way before console_setup() (and we do > in most cases) and we use what we call the "udbg" console until the real > one takes over. The "udbg" console is a very small layer which outputs > via a provided "putc" routine. Platforms can provide their own here, we > have a collection of standard ones for legacy UARTs (it should be > automatically setup in that case by the code in legacy_serial), Apple > ESCCs, etc... We even have compile time options that allow that stuff to > be initialized before start_kernel... Thank you. This is what I described and want to understand. The arch/powerpc/kernel/legacy_serial.c do find_legacy_serial_ports then take a default serial port by using open firmware device tree information. The find_legacy_serial_ports() called form setup_arch but I don't know who call setup_arch (setup_32.c)function. Can you give me a hint ? Thanks in advance= d. BRs, H. Johnny