| 1 |
|
| 2 |
|
| 3 |
#define __SIMPLE_DEVICE__ |
| 4 |
|
| 5 |
#include <bootmode.h> |
| 6 |
#include <bootsplash.h> |
| 7 |
#include <console/console.h> |
| 8 |
#include <cpu/x86/mtrr.h> |
| 9 |
#include <device/pci_ops.h> |
| 10 |
#include <fsp/api.h> |
| 11 |
#include <fsp/fsp_gop_blt.h> |
| 12 |
#include <fsp/graphics.h> |
| 13 |
#include <fsp/util.h> |
| 14 |
#include <intelblocks/graphics.h> |
| 15 |
#include <soc/iomap.h> |
| 16 |
#include <soc/soc_chip.h> |
| 17 |
#include <stdlib.h> |
| 18 |
#include <string.h> |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
static void program_igd_lmembar(uint32_t base) |
| 28 |
{ |
| 29 |
const uint16_t disable_mask = ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); |
| 30 |
const uint16_t enable_mask = (PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); |
| 31 |
|
| 32 |
|
| 33 |
pci_and_config16(SA_DEV_IGD, PCI_COMMAND, disable_mask); |
| 34 |
|
| 35 |
|
| 36 |
pci_write_config32(SA_DEV_IGD, PCI_BASE_ADDRESS_2, base); |
| 37 |
|
| 38 |
|
| 39 |
pci_or_config16(SA_DEV_IGD, PCI_COMMAND, enable_mask); |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
int soc_mark_gfx_memory(void) |
| 50 |
{ |
| 51 |
|
| 52 |
int temp_mtrr_index = acquire_and_configure_mtrr(GMADR_BASE, GMADR_SIZE, MTRR_TYPE_WRCOMB); |
| 53 |
if (temp_mtrr_index < 0) { |
| 54 |
printk(BIOS_ERR, "Failed to configure WC MTRR for GMADR.\n"); |
| 55 |
return -1; |
| 56 |
} |
| 57 |
|
| 58 |
return temp_mtrr_index; |
| 59 |
} |
| 60 |
|
| 61 |
void soc_load_logo_by_coreboot(void) |
| 62 |
{ |
| 63 |
const struct hob_graphics_info *ginfo; |
| 64 |
struct soc_intel_common_config *config = chip_get_common_soc_structure(); |
| 65 |
struct logo_config logo_cfg; |
| 66 |
size_t size; |
| 67 |
|
| 68 |
|
| 69 |
ginfo = fsp_find_extension_hob_by_guid(fsp_graphics_info_guid, &size); |
| 70 |
if (!ginfo || ginfo->framebuffer_base == 0) { |
| 71 |
printk(BIOS_ERR, "Graphics information HOB not found or invalid framebuffer base.\n"); |
| 72 |
return; |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
program_igd_lmembar(GMADR_BASE); |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
if (CONFIG(VBOOT_LID_SWITCH) ? !get_lid_switch() : !CONFIG(RUN_FSP_GOP)) |
| 87 |
config->panel_orientation = LB_FB_ORIENTATION_NORMAL; |
| 88 |
|
| 89 |
|
| 90 |
memset((void *)&logo_cfg, 0, sizeof(logo_cfg)); |
| 91 |
logo_cfg.framebuffer_base = ginfo->framebuffer_base; |
| 92 |
logo_cfg.horizontal_resolution = ginfo->horizontal_resolution; |
| 93 |
logo_cfg.vertical_resolution = ginfo->vertical_resolution; |
| 94 |
logo_cfg.bytes_per_scanline = ginfo->pixels_per_scanline * |
| 95 |
sizeof(efi_graphics_output_blt_pixel); |
| 96 |
logo_cfg.panel_orientation = config->panel_orientation; |
| 97 |
logo_cfg.halignment = FW_SPLASH_HALIGNMENT_CENTER; |
| 98 |
logo_cfg.valignment = config->logo_valignment; |
| 99 |
logo_cfg.logo_bottom_margin = config->logo_bottom_margin; |
| 100 |
|
| 101 |
render_logo_to_framebuffer(&logo_cfg); |
| 102 |
} |