Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (C) 2013 Intel Corporation; author Matt Fleming
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include <linux/console.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <linux/efi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/font.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/serial_core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/screen_info.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <asm/early_ioremap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) static const struct console *earlycon_console __initdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) static const struct font_desc *font;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) static u32 efi_x, efi_y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) static u64 fb_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) static bool fb_wb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) static void *efi_fb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * EFI earlycon needs to use early_memremap() to map the framebuffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * But early_memremap() is not usable for 'earlycon=efifb keep_bootcon',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * memremap() should be used instead. memremap() will be available after
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * paging_init() which is earlier than initcall callbacks. Thus adding this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * early initcall function early_efi_map_fb() to map the whole EFI framebuffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) static int __init efi_earlycon_remap_fb(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	/* bail if there is no bootconsole or it has been disabled already */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	if (!earlycon_console || !(earlycon_console->flags & CON_ENABLED))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	efi_fb = memremap(fb_base, screen_info.lfb_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 			  fb_wb ? MEMREMAP_WB : MEMREMAP_WC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	return efi_fb ? 0 : -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) early_initcall(efi_earlycon_remap_fb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) static int __init efi_earlycon_unmap_fb(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	/* unmap the bootconsole fb unless keep_bootcon has left it enabled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	if (efi_fb && !(earlycon_console->flags & CON_ENABLED))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		memunmap(efi_fb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) late_initcall(efi_earlycon_unmap_fb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) static __ref void *efi_earlycon_map(unsigned long start, unsigned long len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	pgprot_t fb_prot;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	if (efi_fb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 		return efi_fb + start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	fb_prot = fb_wb ? PAGE_KERNEL : pgprot_writecombine(PAGE_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	return early_memremap_prot(fb_base + start, len, pgprot_val(fb_prot));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) static __ref void efi_earlycon_unmap(void *addr, unsigned long len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	if (efi_fb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	early_memunmap(addr, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) static void efi_earlycon_clear_scanline(unsigned int y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	unsigned long *dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	u16 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	len = screen_info.lfb_linelength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	dst = efi_earlycon_map(y*len, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	if (!dst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	memset(dst, 0, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	efi_earlycon_unmap(dst, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) static void efi_earlycon_scroll_up(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	unsigned long *dst, *src;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	u16 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	u32 i, height;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	len = screen_info.lfb_linelength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	height = screen_info.lfb_height;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	for (i = 0; i < height - font->height; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		dst = efi_earlycon_map(i*len, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		if (!dst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 			return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		src = efi_earlycon_map((i + font->height) * len, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		if (!src) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 			efi_earlycon_unmap(dst, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 			return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		memmove(dst, src, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		efi_earlycon_unmap(src, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		efi_earlycon_unmap(dst, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned int h)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	const u32 color_black = 0x00000000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	const u32 color_white = 0x00ffffff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	const u8 *src;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	int m, n, bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	u8 x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	bytes = BITS_TO_BYTES(font->width);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	src = font->data + c * font->height * bytes + h * bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	for (m = 0; m < font->width; m++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		n = m % 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		x = *(src + m / 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		if ((x >> (7 - n)) & 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 			*dst = color_white;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 			*dst = color_black;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		dst++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) static void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) efi_earlycon_write(struct console *con, const char *str, unsigned int num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	struct screen_info *si;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	unsigned int len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	const char *s;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	void *dst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	si = &screen_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	len = si->lfb_linelength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	while (num) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		unsigned int linemax;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		unsigned int h, count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		for (s = str; *s && *s != '\n'; s++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 			if (count == num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 			count++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		linemax = (si->lfb_width - efi_x) / font->width;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		if (count > linemax)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 			count = linemax;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 		for (h = 0; h < font->height; h++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 			unsigned int n, x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 			dst = efi_earlycon_map((efi_y + h) * len, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 			if (!dst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 				return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 			s = str;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 			n = count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 			x = efi_x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 			while (n-- > 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 				efi_earlycon_write_char(dst + x*4, *s, h);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 				x += font->width;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 				s++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 			efi_earlycon_unmap(dst, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		num -= count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		efi_x += count * font->width;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		str += count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		if (num > 0 && *s == '\n') {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 			efi_x = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 			efi_y += font->height;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 			str++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 			num--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 		if (efi_x + font->width > si->lfb_width) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 			efi_x = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 			efi_y += font->height;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		if (efi_y + font->height > si->lfb_height) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 			u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 			efi_y -= font->height;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 			efi_earlycon_scroll_up();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 			for (i = 0; i < font->height; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 				efi_earlycon_clear_scanline(efi_y + i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) static int __init efi_earlycon_setup(struct earlycon_device *device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 				     const char *opt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	struct screen_info *si;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	u16 xres, yres;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	fb_base = screen_info.lfb_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		fb_base |= (u64)screen_info.ext_lfb_base << 32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	fb_wb = opt && !strcmp(opt, "ram");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	si = &screen_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	xres = si->lfb_width;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	yres = si->lfb_height;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	 * efi_earlycon_write_char() implicitly assumes a framebuffer with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	 * 32 bits per pixel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	if (si->lfb_depth != 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	font = get_default_font(xres, yres, -1, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	if (!font)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	efi_y = rounddown(yres, font->height) - font->height;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	for (i = 0; i < (yres - efi_y) / font->height; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 		efi_earlycon_scroll_up();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	device->con->write = efi_earlycon_write;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	earlycon_console = device->con;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) EARLYCON_DECLARE(efifb, efi_earlycon_setup);