/* Boot console: the earliest on-screen output. * * Draws 8x16 text straight into the boot framebuffer described at 0x600. It * needs no heap, no paging (the LFB is identity-accessible), no drivers and * no shadow buffer, so it can be the first C code in kernel_main. Purpose: * stage tracing on machines without serial, and a last visible screen if the * kernel wedges before the WM paints. The WM's first frame covers it; * bootcon_set_enabled(0) stops drawing before that happens. The face, cell * grid and top-left origin match the BIOS loader text and the ring-3 * terminal, and a full screen scrolls instead of wrapping. */ #ifndef BOOTCON_H #define BOOTCON_H #define BOOTCON_LOG_PAGES 8 /* Ring for the storage scan thread's own serial output (see bootcon.c). It * is allocated on demand from the frame allocator, not BSS. */ #define BOOTCON_SCAN_PAGES 4 void bootcon_init(void); int bootcon_ok(void); void bootcon_set_enabled(int on); void bootcon_puts(const char *s); /* Switch drawing to the LFB's kernel address once paging is on (the LFB may * live in the ioremap window, not at its physical address); 0 is ignored. */ void bootcon_set_lfb(void *va); void bootcon_dec(unsigned int v); void bootcon_hex(unsigned int v); /* One line with the cached mode geometry and LFB address. */ void bootcon_fb_info(void); /* Allocate the RAM log after the page allocator is up. The buffer is taken * from the frame allocator, not BSS, to keep _end below the 0x90000 wall. */ void bootcon_log_init(void); /* Everything written through bootcon_puts() after bootcon_log_init(), * including text produced after the WM has taken over the framebuffer. The * returned buffer is NUL terminated; *len is the number of valid bytes. */ const char *bootcon_log(unsigned int *len); int bootcon_log_truncated(void); /* Capture the bootscan kernel thread's serial output. begin() is called by * the thread itself (it allocates the ring and records the thread pid), end() * stops the capture when the thread returns. serial_putc() feeds every COM1 * character through bootcon_scan_char(), which keeps only the owning * thread's output. The ring survives end() so the `bootscan` window can * still tail the completed log. */ void bootcon_scan_begin(void); void bootcon_scan_end(void); void bootcon_scan_char(char c); unsigned int bootcon_scan_total(void); unsigned int bootcon_scan_start(void); unsigned int bootcon_scan_capacity(void); int bootcon_scan_running(void); /* Copy up to max bytes from absolute offset off; off is clamped to the * oldest byte still in the ring. Returns the byte count. */ unsigned int bootcon_scan_read(unsigned int off, char *dst, unsigned int max); #endif