/*1* Copyright (c) 2024 Netflix, Inc.2*3* SPDX-License-Identifier: BSD-2-Clause4*/56/*7* This file provides all the gfx glue, or stubs, so that we can build, if we8* want, two versions of the bios loader: one with graphics support and one9* without. This allows us to keep the calls in other places, like libraries10* that are tricky to compile twice. It also reduces the number of ifdefs we11* need to support the old text-only video console. This could also be two12* separate files, but it is short and having it all here helps to constrain13* dependency creap somewhat.14*/1516#include <stand.h>17#ifndef BIOS_TEXT_ONLY18#include "bootstrap.h"19#include "libi386/libi386.h"20#include "libi386/vbe.h"21#include <gfx_fb.h>22#endif2324#ifdef BIOS_TEXT_ONLY /* Note: likely need a forced commits when this changes */25void autoload_font(bool bios);2627void28autoload_font(bool bios)29{30}3132vm_offset_t build_font_module(vm_offset_t addr);3334vm_offset_t35build_font_module(vm_offset_t addr)36{37return addr;38}3940struct preloaded_file;41void bi_load_vbe_data(struct preloaded_file *kfp);4243void bi_load_vbe_data(struct preloaded_file *kfp)44{45}4647#else4849void50bi_load_vbe_data(struct preloaded_file *kfp)51{52if (!kfp->f_tg_kernel_support) {53/*54* Loaded kernel does not have vt/vbe backend,55* switch console to text mode.56*/57if (vbe_available())58bios_set_text_mode(VGA_TEXT_MODE);59return;60}6162if (vbe_available()) {63file_addmetadata(kfp, MODINFOMD_VBE_FB,64sizeof(gfx_state.tg_fb), &gfx_state.tg_fb);65}66}67#endif686970