Merge tag 'for-5.19/parisc-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 4 Jun 2022 20:50:23 +0000 (13:50 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 4 Jun 2022 20:50:23 +0000 (13:50 -0700)
Pull more parisc architecture updates from Helge Deller:
 "A fix to prevent crash at bootup if CONFIG_SCHED_MC is enabled, and
  add auto-detection of primary graphics card for framebuffer driver"

* tag 'for-5.19/parisc-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  parisc/stifb: Keep track of hardware path of graphics card
  parisc/stifb: Implement fb_is_primary_device()
  parisc: fix a crash with multicore scheduler

1  2 
drivers/video/console/sticore.c

index 837011be9978bf606b3bcc7845db1f0e22bfc16f,6a947ff96d6eb900ecad7067742fc0ac7943e2fa..fa23bf0247b048d7252ed4f9fc91ff169bc84216
  #include <asm/pdc.h>
  #include <asm/cacheflush.h>
  #include <asm/grfioctl.h>
+ #include <asm/fb.h>
  
  #include "../fbdev/sticore.h"
  
- #define STI_DRIVERVERSION "Version 0.9b"
+ #define STI_DRIVERVERSION "Version 0.9c"
  
  static struct sti_struct *default_sti __read_mostly;
  
@@@ -502,7 -503,7 +503,7 @@@ sti_select_fbfont(struct sti_cooked_ro
        if (!fbfont)
                return NULL;
  
-       pr_info("STI selected %ux%u framebuffer font %s for sticon\n",
+       pr_info("    using %ux%u framebuffer font %s\n",
                        fbfont->width, fbfont->height, fbfont->name);
                        
        bpc = ((fbfont->width+7)/8) * fbfont->height; 
@@@ -549,26 -550,6 +550,26 @@@ sti_select_fbfont(struct sti_cooked_ro
  }
  #endif
  
 +static void sti_dump_font(struct sti_cooked_font *font)
 +{
 +#ifdef STI_DUMP_FONT
 +      unsigned char *p = (unsigned char *)font->raw;
 +      int n;
 +
 +      p += sizeof(struct sti_rom_font);
 +      pr_debug("  w %d h %d bpc %d\n", font->width, font->height,
 +                                      font->raw->bytes_per_char);
 +
 +      for (n = 0; n < 256 * font->raw->bytes_per_char; n += 16, p += 16) {
 +              pr_debug("        0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x,"
 +                      " 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x,"
 +                      " 0x%02x, 0x%02x, 0x%02x, 0x%02x,\n",
 +                      p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8],
 +                      p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
 +      }
 +#endif
 +}
 +
  static int sti_search_font(struct sti_cooked_rom *rom, int height, int width)
  {
        struct sti_cooked_font *font;
@@@ -816,7 -797,6 +817,7 @@@ static int sti_read_rom(int wordmode, s
        sti->font->width = sti->font->raw->width;
        sti->font->height = sti->font->raw->height;
        sti_font_convert_bytemode(sti, sti->font);
 +      sti_dump_font(sti->font);
  
        sti->sti_mem_request = raw->sti_mem_req;
        sti->graphics_id[0] = raw->graphics_id[0];
@@@ -967,6 -947,7 +968,7 @@@ out_err
  
  static void sticore_check_for_default_sti(struct sti_struct *sti, char *path)
  {
+       pr_info("    located at [%s]\n", sti->pa_path);
        if (strcmp (path, default_sti_path) == 0)
                default_sti = sti;
  }
   */
  static int __init sticore_pa_init(struct parisc_device *dev)
  {
-       char pa_path[21];
        struct sti_struct *sti = NULL;
        int hpa = dev->hpa.start;
  
        if (!sti)
                return 1;
  
-       print_pa_hwpath(dev, pa_path);
-       sticore_check_for_default_sti(sti, pa_path);
+       print_pa_hwpath(dev, sti->pa_path);
+       sticore_check_for_default_sti(sti, sti->pa_path);
        return 0;
  }
  
@@@ -1028,9 -1008,8 +1029,8 @@@ static int sticore_pci_init(struct pci_
  
        sti = sti_try_rom_generic(rom_base, fb_base, pd);
        if (sti) {
-               char pa_path[30];
-               print_pci_hwpath(pd, pa_path);
-               sticore_check_for_default_sti(sti, pa_path);
+               print_pci_hwpath(pd, sti->pa_path);
+               sticore_check_for_default_sti(sti, sti->pa_path);
        }
        
        if (!sti) {
@@@ -1148,6 -1127,22 +1148,22 @@@ int sti_call(const struct sti_struct *s
        return ret;
  }
  
+ /* check if given fb_info is the primary device */
+ int fb_is_primary_device(struct fb_info *info)
+ {
+       struct sti_struct *sti;
+       sti = sti_get_rom(0);
+       /* if no built-in graphics card found, allow any fb driver as default */
+       if (!sti)
+               return true;
+       /* return true if it's the default built-in framebuffer driver */
+       return (sti->info == info);
+ }
+ EXPORT_SYMBOL(fb_is_primary_device);
  MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer");
  MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines");
  MODULE_LICENSE("GPL v2");