AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
earlycon.c File Reference

x86: the early console, where printk() writes before the kernel's terminals exist. More...

#include <core/kargs.h>
#include <core/string.h>
#include <console/earlycon.h>

Go to the source code of this file.

Functions

int earlycon_fb_available (void)
 Says whether the boot loader's framebuffer can be the early console.
int earlycon_puts (char *s)
 Writes a string on the early console.
int earlycon_putc (char c)
 Writes a character on the early console.
int earlycon_on_screen (void)
 Says whether the early console writes on the screen, rather than on a serial port.
void earlycon_init ()
 Sets up the early console at boot, before anything else.
void earlycon_reinit ()
 Sets up the early console again, once the kernel's command line has been read, since it may choose another console (earlycon=).

Variables

static struct earlycon * earlycon
struct earlycon earlycon_uart
struct earlycon earlycon_vga
struct earlycon earlycon_fb

Detailed Description

x86: the early console, where printk() writes before the kernel's terminals exist.

It starts on the first serial port, and once the kernel's command line is read (earlycon_reinit()), moves to the boot loader's framebuffer if there is one. earlycon=ttyS0, earlycon=vga or earlycon=fb chooses it explicitly.

Definition in file earlycon.c.

Function Documentation

◆ earlycon_fb_available()

int earlycon_fb_available ( void )
extern

Says whether the boot loader's framebuffer can be the early console.

Returns
1 if one was registered and has 32 bits per pixel, 0 if not

Definition at line 55 of file fb.c.

References earlycon_fb_available(), fb_depth, fb_paddr, and fb_size.

Referenced by earlycon_fb_available(), and earlycon_reinit().

◆ earlycon_init()

void earlycon_init ( void )

Sets up the early console at boot, before anything else.

Definition at line 49 of file earlycon.c.

References earlycon_init(), earlycon_uart, and earlycon::init.

◆ earlycon_on_screen()

int earlycon_on_screen ( void )

Says whether the early console writes on the screen, rather than on a serial port.

Returns
1 if it writes on the screen, 0 if not

Definition at line 43 of file earlycon.c.

References earlycon_on_screen(), and earlycon_uart.

◆ earlycon_putc()

int earlycon_putc ( char c)

Writes a character on the early console.

Parameters
cthe character
Returns
1 if it was written, 0 if not

Definition at line 34 of file earlycon.c.

References earlycon_putc(), and earlycon::putc.

◆ earlycon_puts()

int earlycon_puts ( char * s)

Writes a string on the early console.

Parameters
sthe string
Returns
how many characters were written

Definition at line 26 of file earlycon.c.

References earlycon_puts(), and earlycon::puts.

◆ earlycon_reinit()

void earlycon_reinit ( void )

Sets up the early console again, once the kernel's command line has been read, since it may choose another console (earlycon=).

Definition at line 58 of file earlycon.c.

References earlycon_fb, earlycon_fb_available(), earlycon_reinit(), earlycon_uart, earlycon_vga, earlycon::init, kargs_get(), and NULL.

Variable Documentation

◆ earlycon

struct earlycon* earlycon
static

Definition at line 15 of file earlycon.c.

◆ earlycon_fb

struct earlycon earlycon_fb
extern

Definition at line 161 of file fb.c.

Referenced by earlycon_reinit().

◆ earlycon_uart

struct earlycon earlycon_uart
extern

Definition at line 92 of file uart.c.

Referenced by earlycon_init(), earlycon_on_screen(), and earlycon_reinit().

◆ earlycon_vga

struct earlycon earlycon_vga
extern

Definition at line 85 of file vga.c.

Referenced by earlycon_reinit().