diff mbox

[V1,14/29] xen/video: hdlcd: Use early_printk instead of printk

Message ID 1377701263-3319-15-git-send-email-julien.grall@linaro.org
State Superseded, archived
Headers show

Commit Message

Julien Grall Aug. 28, 2013, 2:47 p.m. UTC
The video driver is initialized before the console is correctly set up.
Therefore, printk will never output if there is no serial configured.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
 xen/drivers/video/arm_hdlcd.c |   23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

Comments

Ian Campbell Sept. 6, 2013, 4:48 p.m. UTC | #1
On Wed, 2013-08-28 at 15:47 +0100, Julien Grall wrote:
> The video driver is initialized before the console is correctly set up.
> Therefore, printk will never output if there is no serial configured.

On the flip side if you have a serial console but not early printk you
won't see these messages instead.

I suppose in that case we don't even try to initialise the hdlcd, since
it will belong to dom0, right? Except I don't see where that happens.
Shouldn't this code only be activated if you have console=hdlcd or
something?

> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> ---
>  xen/drivers/video/arm_hdlcd.c |   23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/xen/drivers/video/arm_hdlcd.c b/xen/drivers/video/arm_hdlcd.c
> index ab464c6..dffda9a 100644
> --- a/xen/drivers/video/arm_hdlcd.c
> +++ b/xen/drivers/video/arm_hdlcd.c
> @@ -146,13 +146,13 @@ void __init video_init(void)
>  
>      if ( !hdlcd_start )
>      {
> -        printk(KERN_ERR "HDLCD address missing from device tree, disabling driver\n");
> +        early_printk(KERN_ERR "HDLCD: address missing from device tree, disabling driver\n");
>          return;
>      }
>  
>      if ( !hdlcd_start || !framebuffer_start )
>      {
> -        printk(KERN_ERR "HDLCD: framebuffer address missing from device tree, disabling driver\n");
> +        early_printk(KERN_ERR "HDLCD: framebuffer address missing from device tree, disabling driver\n");
>          return;
>      }
>  
> @@ -166,27 +166,27 @@ void __init video_init(void)
>      else if ( strlen(mode_string) < strlen("800x600@60") ||
>              strlen(mode_string) > sizeof(_mode_string) - 1 )
>      {
> -        printk(KERN_ERR "HDLCD: invalid modeline=%s\n", mode_string);
> +        early_printk(KERN_ERR "HDLCD: invalid modeline=%s\n", mode_string);
>          return;
>      } else {
>          char *s = strchr(mode_string, '-');
>          if ( !s )
>          {
> -            printk(KERN_INFO "HDLCD: bpp not found in modeline %s, assume 32 bpp\n",
> -                    mode_string);
> +            early_printk(KERN_INFO "HDLCD: bpp not found in modeline %s, assume 32 bpp\n",
> +                         mode_string);
>              get_color_masks("32", &c);
>              memcpy(_mode_string, mode_string, strlen(mode_string) + 1);
>              bytes_per_pixel = 4;
>          } else {
>              if ( strlen(s) < 6 )
>              {
> -                printk(KERN_ERR "HDLCD: invalid mode %s\n", mode_string);
> +                early_printk(KERN_ERR "HDLCD: invalid mode %s\n", mode_string);
>                  return;
>              }
>              s++;
>              if ( get_color_masks(s, &c) < 0 )
>              {
> -                printk(KERN_WARNING "HDLCD: unsupported bpp %s\n", s);
> +                early_printk(KERN_WARNING "HDLCD: unsupported bpp %s\n", s);
>                  return;
>              }
>              bytes_per_pixel = simple_strtoll(s, NULL, 10) / 8;
> @@ -205,22 +205,23 @@ void __init video_init(void)
>      }
>      if ( !videomode )
>      {
> -        printk(KERN_WARNING "HDLCD: unsupported videomode %s\n", _mode_string);
> +        early_printk(KERN_WARNING "HDLCD: unsupported videomode %s\n",
> +                     _mode_string);
>          return;
>      }
>  
>      if ( framebuffer_size < bytes_per_pixel * videomode->xres * videomode->yres )
>      {
> -        printk(KERN_ERR "HDLCD: the framebuffer is too small, disabling the HDLCD driver\n");
> +        early_printk(KERN_ERR "HDLCD: the framebuffer is too small, disabling the HDLCD driver\n");
>          return;
>      }
>  
> -    printk(KERN_INFO "Initializing HDLCD driver\n");
> +    early_printk(KERN_INFO "Initializing HDLCD driver\n");
>  
>      lfb = ioremap_wc(framebuffer_start, framebuffer_size);
>      if ( !lfb )
>      {
> -        printk(KERN_ERR "Couldn't map the framebuffer\n");
> +        early_printk(KERN_ERR "Couldn't map the framebuffer\n");
>          return;
>      }
>      memset(lfb, 0x00, bytes_per_pixel * videomode->xres * videomode->yres);
Julien Grall Sept. 9, 2013, 11:21 a.m. UTC | #2
On 09/06/2013 05:48 PM, Ian Campbell wrote:
> On Wed, 2013-08-28 at 15:47 +0100, Julien Grall wrote:
>> The video driver is initialized before the console is correctly set up.
>> Therefore, printk will never output if there is no serial configured.
>
> On the flip side if you have a serial console but not early printk you
> won't see these messages instead.

It depends, the console code will parse the console string and 
initialize the different console driver (serial, vga,...) one by one.
   - console=vga,serial => the VGA needs to use early printk
   - console=vga        => the VGA needs to use early printk
   - console=serial,vga => the VGA needs to use printk and can use early 
printk if it's enabled.

>
> I suppose in that case we don't even try to initialise the hdlcd, since
> it will belong to dom0, right? Except I don't see where that happens.
> Shouldn't this code only be activated if you have console=hdlcd or
> something?

For the moment, the hdlcd is the default device for vga. So if 
console=vga, Xen will initialize the hdcld by calling video_init().
We will need to implement something similar to dt-uart.

>>
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>> ---
>>   xen/drivers/video/arm_hdlcd.c |   23 ++++++++++++-----------
>>   1 file changed, 12 insertions(+), 11 deletions(-)
>>
>> diff --git a/xen/drivers/video/arm_hdlcd.c b/xen/drivers/video/arm_hdlcd.c
>> index ab464c6..dffda9a 100644
>> --- a/xen/drivers/video/arm_hdlcd.c
>> +++ b/xen/drivers/video/arm_hdlcd.c
>> @@ -146,13 +146,13 @@ void __init video_init(void)
>>
>>       if ( !hdlcd_start )
>>       {
>> -        printk(KERN_ERR "HDLCD address missing from device tree, disabling driver\n");
>> +        early_printk(KERN_ERR "HDLCD: address missing from device tree, disabling driver\n");
>>           return;
>>       }
>>
>>       if ( !hdlcd_start || !framebuffer_start )
>>       {
>> -        printk(KERN_ERR "HDLCD: framebuffer address missing from device tree, disabling driver\n");
>> +        early_printk(KERN_ERR "HDLCD: framebuffer address missing from device tree, disabling driver\n");
>>           return;
>>       }
>>
>> @@ -166,27 +166,27 @@ void __init video_init(void)
>>       else if ( strlen(mode_string) < strlen("800x600@60") ||
>>               strlen(mode_string) > sizeof(_mode_string) - 1 )
>>       {
>> -        printk(KERN_ERR "HDLCD: invalid modeline=%s\n", mode_string);
>> +        early_printk(KERN_ERR "HDLCD: invalid modeline=%s\n", mode_string);
>>           return;
>>       } else {
>>           char *s = strchr(mode_string, '-');
>>           if ( !s )
>>           {
>> -            printk(KERN_INFO "HDLCD: bpp not found in modeline %s, assume 32 bpp\n",
>> -                    mode_string);
>> +            early_printk(KERN_INFO "HDLCD: bpp not found in modeline %s, assume 32 bpp\n",
>> +                         mode_string);
>>               get_color_masks("32", &c);
>>               memcpy(_mode_string, mode_string, strlen(mode_string) + 1);
>>               bytes_per_pixel = 4;
>>           } else {
>>               if ( strlen(s) < 6 )
>>               {
>> -                printk(KERN_ERR "HDLCD: invalid mode %s\n", mode_string);
>> +                early_printk(KERN_ERR "HDLCD: invalid mode %s\n", mode_string);
>>                   return;
>>               }
>>               s++;
>>               if ( get_color_masks(s, &c) < 0 )
>>               {
>> -                printk(KERN_WARNING "HDLCD: unsupported bpp %s\n", s);
>> +                early_printk(KERN_WARNING "HDLCD: unsupported bpp %s\n", s);
>>                   return;
>>               }
>>               bytes_per_pixel = simple_strtoll(s, NULL, 10) / 8;
>> @@ -205,22 +205,23 @@ void __init video_init(void)
>>       }
>>       if ( !videomode )
>>       {
>> -        printk(KERN_WARNING "HDLCD: unsupported videomode %s\n", _mode_string);
>> +        early_printk(KERN_WARNING "HDLCD: unsupported videomode %s\n",
>> +                     _mode_string);
>>           return;
>>       }
>>
>>       if ( framebuffer_size < bytes_per_pixel * videomode->xres * videomode->yres )
>>       {
>> -        printk(KERN_ERR "HDLCD: the framebuffer is too small, disabling the HDLCD driver\n");
>> +        early_printk(KERN_ERR "HDLCD: the framebuffer is too small, disabling the HDLCD driver\n");
>>           return;
>>       }
>>
>> -    printk(KERN_INFO "Initializing HDLCD driver\n");
>> +    early_printk(KERN_INFO "Initializing HDLCD driver\n");
>>
>>       lfb = ioremap_wc(framebuffer_start, framebuffer_size);
>>       if ( !lfb )
>>       {
>> -        printk(KERN_ERR "Couldn't map the framebuffer\n");
>> +        early_printk(KERN_ERR "Couldn't map the framebuffer\n");
>>           return;
>>       }
>>       memset(lfb, 0x00, bytes_per_pixel * videomode->xres * videomode->yres);
>
>
diff mbox

Patch

diff --git a/xen/drivers/video/arm_hdlcd.c b/xen/drivers/video/arm_hdlcd.c
index ab464c6..dffda9a 100644
--- a/xen/drivers/video/arm_hdlcd.c
+++ b/xen/drivers/video/arm_hdlcd.c
@@ -146,13 +146,13 @@  void __init video_init(void)
 
     if ( !hdlcd_start )
     {
-        printk(KERN_ERR "HDLCD address missing from device tree, disabling driver\n");
+        early_printk(KERN_ERR "HDLCD: address missing from device tree, disabling driver\n");
         return;
     }
 
     if ( !hdlcd_start || !framebuffer_start )
     {
-        printk(KERN_ERR "HDLCD: framebuffer address missing from device tree, disabling driver\n");
+        early_printk(KERN_ERR "HDLCD: framebuffer address missing from device tree, disabling driver\n");
         return;
     }
 
@@ -166,27 +166,27 @@  void __init video_init(void)
     else if ( strlen(mode_string) < strlen("800x600@60") ||
             strlen(mode_string) > sizeof(_mode_string) - 1 )
     {
-        printk(KERN_ERR "HDLCD: invalid modeline=%s\n", mode_string);
+        early_printk(KERN_ERR "HDLCD: invalid modeline=%s\n", mode_string);
         return;
     } else {
         char *s = strchr(mode_string, '-');
         if ( !s )
         {
-            printk(KERN_INFO "HDLCD: bpp not found in modeline %s, assume 32 bpp\n",
-                    mode_string);
+            early_printk(KERN_INFO "HDLCD: bpp not found in modeline %s, assume 32 bpp\n",
+                         mode_string);
             get_color_masks("32", &c);
             memcpy(_mode_string, mode_string, strlen(mode_string) + 1);
             bytes_per_pixel = 4;
         } else {
             if ( strlen(s) < 6 )
             {
-                printk(KERN_ERR "HDLCD: invalid mode %s\n", mode_string);
+                early_printk(KERN_ERR "HDLCD: invalid mode %s\n", mode_string);
                 return;
             }
             s++;
             if ( get_color_masks(s, &c) < 0 )
             {
-                printk(KERN_WARNING "HDLCD: unsupported bpp %s\n", s);
+                early_printk(KERN_WARNING "HDLCD: unsupported bpp %s\n", s);
                 return;
             }
             bytes_per_pixel = simple_strtoll(s, NULL, 10) / 8;
@@ -205,22 +205,23 @@  void __init video_init(void)
     }
     if ( !videomode )
     {
-        printk(KERN_WARNING "HDLCD: unsupported videomode %s\n", _mode_string);
+        early_printk(KERN_WARNING "HDLCD: unsupported videomode %s\n",
+                     _mode_string);
         return;
     }
 
     if ( framebuffer_size < bytes_per_pixel * videomode->xres * videomode->yres )
     {
-        printk(KERN_ERR "HDLCD: the framebuffer is too small, disabling the HDLCD driver\n");
+        early_printk(KERN_ERR "HDLCD: the framebuffer is too small, disabling the HDLCD driver\n");
         return;
     }
 
-    printk(KERN_INFO "Initializing HDLCD driver\n");
+    early_printk(KERN_INFO "Initializing HDLCD driver\n");
 
     lfb = ioremap_wc(framebuffer_start, framebuffer_size);
     if ( !lfb )
     {
-        printk(KERN_ERR "Couldn't map the framebuffer\n");
+        early_printk(KERN_ERR "Couldn't map the framebuffer\n");
         return;
     }
     memset(lfb, 0x00, bytes_per_pixel * videomode->xres * videomode->yres);