Turnstone Operating System
Loading...
Searching...
No Matches
main.c File Reference

EFI entry point. More...

#include "setup.h"
#include <strings.h>
#include <linker.h>
#include <systeminfo.h>
#include <cpu.h>
#include <cpu/sync.h>
#include <buffer.h>
#include <data.h>
#include <zpack.h>
#include <xxhash.h>
#include <tosdb/tosdb.h>
#include <memory/paging.h>
#include <memory/frame.h>
#include <stdbufs.h>
#include <random.h>

Classes

struct  efi_tosdb_context_t
 EFI tosdb context. More...
 

Typedefs

typedef int8_t(* kernel_start_t) (system_info_t *sysinfo)
 kernel start function type More...
 
typedef struct efi_tosdb_context_t efi_tosdb_context_t
 typedef for efi_tosdb_context_t
 

Functions

 MODULE ("turnstone.efi")
 
efi_status_t efi_setup_heap (void)
 setup EFI heap More...
 
efi_status_t efi_setup_graphics (video_frame_buffer_t **vfb_res)
 setup EFI graphics More...
 
efi_status_t efi_print_variable_names (void)
 prints efi variable names. More...
 
efi_status_t efi_is_pxe_boot (boolean_t *result)
 check is current boot is PXE boot. More...
 
EFIAPI efi_status_t efi_main (efi_handle_t image, efi_system_table_t *system_table)
 EFI main function. More...
 
efi_status_t efi_open_local_tosdb (efi_block_io_t *bio, efi_tosdb_context_t **tdb_ctx)
 helper function for local tosdb loading More...
 
efi_status_t efi_load_local_tosdb (efi_tosdb_context_t **tdb_ctx)
 loads tosdb from disk if current boot is not PXE boot. More...
 
efi_status_t efi_load_pxe_tosdb (efi_tosdb_context_t **tdb_ctx)
 loads tosdb from PXE if current boot is PXE boot. More...
 
efi_status_t efi_tosdb_read_config (efi_tosdb_context_t *tdb_ctx, const char_t *config_key, void **config_value)
 reads config value for system from tosdb. More...
 

Variables

efi_system_table_tST
 
efi_boot_services_tBS
 
efi_runtime_services_tRS
 

Detailed Description

EFI entry point.

This file contains EFI entry point and other EFI related methods.

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Typedef Documentation

◆ kernel_start_t

kernel_start_t

kernel start function type

this function is called by EFI entry point to start kernel.

Parameters
[in]sysinfosystem information
Returns
0 on success, -1 on failure (return means kernel is not started)

Function Documentation

◆ efi_is_pxe_boot()

efi_status_t efi_is_pxe_boot ( boolean_t *  result)

check is current boot is PXE boot.

for checking PXE boot, this method checks if EFI variable "BootCurrent" contains mac address.

Parameters
[out]resulttrue if current boot is PXE boot, false otherwise.
Returns
EFI_SUCCESS if all goes well.

◆ efi_load_local_tosdb()

efi_status_t efi_load_local_tosdb ( efi_tosdb_context_t **  tdb_ctx)

loads tosdb from disk if current boot is not PXE boot.

Parameters
[out]tdb_ctxtosdb context
Returns
EFI_SUCCESS if all goes well

◆ efi_load_pxe_tosdb()

efi_status_t efi_load_pxe_tosdb ( efi_tosdb_context_t **  tdb_ctx)

loads tosdb from PXE if current boot is PXE boot.

Parameters
[out]tdb_ctxtosdb context
Returns
EFI_SUCCESS if all goes well

◆ efi_main()

EFIAPI efi_status_t efi_main ( efi_handle_t  image,
efi_system_table_t system_table 
)

EFI main function.

this function is called by EFI entry point. Also this function should be EFIAPI because of EFI calling convention.

Parameters
[in]imageimage handle
[in]system_tablesystem table
Returns
EFI_SUCCESS if all goes well

◆ efi_open_local_tosdb()

efi_status_t efi_open_local_tosdb ( efi_block_io_t bio,
efi_tosdb_context_t **  tdb_ctx 
)

helper function for local tosdb loading

Parameters
[in]bioblock io interface
[out]tdb_ctxtosdb context
Returns
EFI_SUCCESS if all goes well

◆ efi_print_variable_names()

efi_status_t efi_print_variable_names ( void  )

prints efi variable names.

Returns
EFI_SUCCESS if all goes well.

◆ efi_setup_graphics()

efi_status_t efi_setup_graphics ( video_frame_buffer_t **  vfb_res)

setup EFI graphics

this method sets up graphics mode and returns video frame buffer. Min resolution is 1092x1080.

Parameters
[out]vfb_resvideo frame buffer
Returns
EFI_SUCCESS if all goes well

◆ efi_setup_heap()

efi_status_t efi_setup_heap ( void  )

setup EFI heap

Returns
EFI_SUCCESS if all goes well

◆ efi_tosdb_read_config()

efi_status_t efi_tosdb_read_config ( efi_tosdb_context_t tdb_ctx,
const char_t config_key,
void **  config_value 
)

reads config value for system from tosdb.

Parameters
[in]tdb_ctxtosdb context
[in]config_keyconfig key
[out]config_valueconfig value
Returns
EFI_SUCCESS if all goes well

◆ MODULE()

MODULE ( "turnstone.efi"  )

module name

Variable Documentation

◆ BS

EFI boot services global variable

◆ RS

EFI runtime services global variable

◆ ST

EFI system table global variable