<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 20.06.2009 2:50 Uhr, ron minnich wrote:
<blockquote
 cite="mid:13426df10906191750p532bb391tf7968b6a1019be38@mail.gmail.com"
 type="cite">
  <pre wrap="">On Fri, Jun 19, 2009 at 5:17 PM, Stefan Reinauer<a class="moz-txt-link-rfc2396E" href="mailto:stepan@coresystems.de"><stepan@coresystems.de></a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Carl-Daniel Hailfinger wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">do_printk is defined in src/arch/i386/lib/printk_init.c as almost
identical function, but without console_tx_flush and without locking. If
only one CPU uses the lockless variant, we lose.

      </pre>
    </blockquote>
    <pre wrap="">This is the version that was intended to be used when CONFIG_USE_INIT is
set.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
reminder. do_printk is (or should be) used ONLY in the CAR code. It
does not use variables that are only available in the RAM code, such
as the console_drivers structure .
  </pre>
</blockquote>
<br>
All versions of printk_debug() use a do_printk() implementation.<br>
<br>
Then there's print_debug, being the weaker version of printk_debug. But
print_debug which can not do variables should not be used in CAR code.<br>
Instead you should set the CONFIG_USE_PRINTK_IN_CAR (?) option and use
printk_debug instead. <br>
<br>
printk_debug is a wrapper around do_printk() which calls do_printk with
BIOS_DEBUG as first parameter, that's it.<br>
<br>
There is a do_printk for CAR in src/arch/i386/lib/printk_init.c however
and one for stage2 in src/console/printk.c<br>
<br>
<blockquote
 cite="mid:13426df10906191750p532bb391tf7968b6a1019be38@mail.gmail.com"
 type="cite">
  <pre wrap="">Don't assume you can just stop using it. It is that way for a reason,
as I found out very recently with the qemu CAR changes.

Note that printk calls console_tx_byte, which does this:
static void __console_tx_byte(unsigned char byte)
{
        struct console_driver *driver;
        for(driver = console_drivers; driver < econsole_drivers; driver++) {
                driver->tx_byte(byte);
        }
}


do_printk calls its very own console_tx_byte, which is this:

void console_tx_byte(unsigned char byte)
{
        if (byte == '\n')
                uart8250_tx_byte(TTYS0_BASE, '\r');
        uart8250_tx_byte(TTYS0_BASE, byte);
}

So it's a lot more than just not calling console_tx_flush. These are
not insignificant differences.

I am just trying to wave a caution flag here.

  </pre>
</blockquote>
Absolutely agreed, and we shouldn't change anything on the struct
console_driver level. At all<br>
<br>
<blockquote
 cite="mid:13426df10906191750p532bb391tf7968b6a1019be38@mail.gmail.com"
 type="cite">
  <pre wrap="">You must take some care before you decide you can replace do_printk
with printk.</pre>
</blockquote>
Nope... I started doing some replacements in our internal tree a few
weeks/months back and it works like a charme.<br>
<br>
<br>
<blockquote
 cite="mid:13426df10906191750p532bb391tf7968b6a1019be38@mail.gmail.com"
 type="cite">
  <pre wrap=""> They're not even compiled into the same stage (or should
not be).
  </pre>
</blockquote>
<br>
There does not even exist a printk in coreboot v2, right now. So they
are only compiled into different projects ;)<br>
<br>
<br>
Stefan<br>
<br>
<pre class="moz-signature" cols="72">-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: <a class="moz-txt-link-abbreviated" href="mailto:info@coresystems.de">info@coresystems.de</a>  • <a class="moz-txt-link-freetext" href="http://www.coresystems.de/">http://www.coresystems.de/</a>
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866
</pre>
</body>
</html>