uboot/board/coreboot/coreboot/coreboot.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0+
   2/*
   3 * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
   4 */
   5
   6#include <common.h>
   7#include <splash.h>
   8#include <init.h>
   9#include <smbios.h>
  10#include <asm/cb_sysinfo.h>
  11#include <asm/global_data.h>
  12
  13int board_early_init_r(void)
  14{
  15        /*
  16         * Make sure PCI bus is enumerated so that peripherals on the PCI bus
  17         * can be discovered by their drivers
  18         */
  19        pci_init();
  20
  21        return 0;
  22}
  23
  24#ifdef CONFIG_SMBIOS_PARSER
  25int show_board_info(void)
  26{
  27        const struct smbios_entry *smbios = smbios_entry(lib_sysinfo.smbios_start, lib_sysinfo.smbios_size);
  28
  29        if (!smbios)
  30                goto fallback;
  31
  32        const struct smbios_header *bios = smbios_header(smbios, SMBIOS_BIOS_INFORMATION);
  33        const struct smbios_header *system = smbios_header(smbios, SMBIOS_SYSTEM_INFORMATION);
  34        const struct smbios_type0 *t0 = (struct smbios_type0 *)bios;
  35        const struct smbios_type1 *t1 = (struct smbios_type1 *)system;
  36
  37        if (!t0 || !t1)
  38                goto fallback;
  39
  40        const char *bios_ver = smbios_string(bios, t0->bios_ver);
  41        const char *bios_date = smbios_string(bios, t0->bios_release_date);
  42        const char *model = smbios_string(system, t1->product_name);
  43        const char *manufacturer = smbios_string(system, t1->manufacturer);
  44
  45        if (!model || !manufacturer || !bios_ver)
  46                goto fallback;
  47
  48        printf("Vendor: %s\n", manufacturer);
  49        printf("Model: %s\n", model);
  50        printf("BIOS Version: %s\n", bios_ver);
  51        if (bios_date)
  52                printf("BIOS date: %s\n", bios_date);
  53
  54        return 0;
  55
  56fallback:
  57#ifdef CONFIG_OF_CONTROL
  58        DECLARE_GLOBAL_DATA_PTR;
  59
  60        model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
  61
  62        if (model)
  63                printf("Model: %s\n", model);
  64#endif
  65
  66        return checkboard();
  67}
  68#endif
  69
  70static struct splash_location coreboot_splash_locations[] = {
  71        {
  72                .name = "virtio_fs",
  73                .storage = SPLASH_STORAGE_VIRTIO,
  74                .flags = SPLASH_STORAGE_RAW,
  75                .devpart = "0",
  76        },
  77};
  78
  79int splash_screen_prepare(void)
  80{
  81        return splash_source_load(coreboot_splash_locations,
  82                                  ARRAY_SIZE(coreboot_splash_locations));
  83}
  84