logo.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Linux logo to be displayed on boot
  4. *
  5. * Copyright (C) 1996 Larry Ewing ([email protected])
  6. * Copyright (C) 1996,1998 Jakub Jelinek ([email protected])
  7. * Copyright (C) 2001 Greg Banks <[email protected]>
  8. * Copyright (C) 2001 Jan-Benedict Glaw <[email protected]>
  9. * Copyright (C) 2003 Geert Uytterhoeven <[email protected]>
  10. */
  11. #include <linux/linux_logo.h>
  12. #include <linux/stddef.h>
  13. #include <linux/module.h>
  14. #ifdef CONFIG_M68K
  15. #include <asm/setup.h>
  16. #endif
  17. static bool nologo;
  18. module_param(nologo, bool, 0);
  19. MODULE_PARM_DESC(nologo, "Disables startup logo");
  20. /*
  21. * Logos are located in the initdata, and will be freed in kernel_init.
  22. * Use late_init to mark the logos as freed to prevent any further use.
  23. */
  24. static bool logos_freed;
  25. static int __init fb_logo_late_init(void)
  26. {
  27. logos_freed = true;
  28. return 0;
  29. }
  30. late_initcall_sync(fb_logo_late_init);
  31. /* logo's are marked __initdata. Use __ref to tell
  32. * modpost that it is intended that this function uses data
  33. * marked __initdata.
  34. */
  35. const struct linux_logo * __ref fb_find_logo(int depth)
  36. {
  37. const struct linux_logo *logo = NULL;
  38. if (nologo || logos_freed)
  39. return NULL;
  40. if (depth >= 1) {
  41. #ifdef CONFIG_LOGO_LINUX_MONO
  42. /* Generic Linux logo */
  43. logo = &logo_linux_mono;
  44. #endif
  45. #ifdef CONFIG_LOGO_SUPERH_MONO
  46. /* SuperH Linux logo */
  47. logo = &logo_superh_mono;
  48. #endif
  49. }
  50. if (depth >= 4) {
  51. #ifdef CONFIG_LOGO_LINUX_VGA16
  52. /* Generic Linux logo */
  53. logo = &logo_linux_vga16;
  54. #endif
  55. #ifdef CONFIG_LOGO_SUPERH_VGA16
  56. /* SuperH Linux logo */
  57. logo = &logo_superh_vga16;
  58. #endif
  59. }
  60. if (depth >= 8) {
  61. #ifdef CONFIG_LOGO_LINUX_CLUT224
  62. /* Generic Linux logo */
  63. logo = &logo_linux_clut224;
  64. #endif
  65. #ifdef CONFIG_LOGO_DEC_CLUT224
  66. /* DEC Linux logo on MIPS/MIPS64 or ALPHA */
  67. logo = &logo_dec_clut224;
  68. #endif
  69. #ifdef CONFIG_LOGO_MAC_CLUT224
  70. /* Macintosh Linux logo on m68k */
  71. if (MACH_IS_MAC)
  72. logo = &logo_mac_clut224;
  73. #endif
  74. #ifdef CONFIG_LOGO_PARISC_CLUT224
  75. /* PA-RISC Linux logo */
  76. logo = &logo_parisc_clut224;
  77. #endif
  78. #ifdef CONFIG_LOGO_SGI_CLUT224
  79. /* SGI Linux logo on MIPS/MIPS64 */
  80. logo = &logo_sgi_clut224;
  81. #endif
  82. #ifdef CONFIG_LOGO_SUN_CLUT224
  83. /* Sun Linux logo */
  84. logo = &logo_sun_clut224;
  85. #endif
  86. #ifdef CONFIG_LOGO_SUPERH_CLUT224
  87. /* SuperH Linux logo */
  88. logo = &logo_superh_clut224;
  89. #endif
  90. }
  91. return logo;
  92. }
  93. EXPORT_SYMBOL_GPL(fb_find_logo);