coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
fw_cfg.c File Reference
#include <endian.h>
#include <stdlib.h>
#include <string.h>
#include <smbios.h>
#include <console/console.h>
#include <arch/io.h>
#include <acpi/acpi.h>
#include <commonlib/endian.h>
#include "fw_cfg.h"
#include "fw_cfg_if.h"
Include dependency graph for fw_cfg.c:

Go to the source code of this file.

Data Structures

struct  BiosLinkerLoaderEntry
 

Macros

#define FW_CFG_PORT_CTL   0x0510
 
#define FW_CFG_PORT_DATA   0x0511
 
#define FW_CFG_DMA_ADDR_HIGH   0x0514
 
#define FW_CFG_DMA_ADDR_LOW   0x0518
 
#define BIOS_LINKER_LOADER_FILESZ   56
 

Typedefs

typedef struct BiosLinkerLoaderEntry BiosLinkerLoaderEntry
 

Enumerations

enum  { BIOS_LINKER_LOADER_COMMAND_ALLOCATE = 0x1 , BIOS_LINKER_LOADER_COMMAND_ADD_POINTER = 0x2 , BIOS_LINKER_LOADER_COMMAND_ADD_CHECKSUM = 0x3 }
 
enum  { BIOS_LINKER_LOADER_ALLOC_ZONE_HIGH = 0x1 , BIOS_LINKER_LOADER_ALLOC_ZONE_FSEG = 0x2 }
 

Functions

static void fw_cfg_dma (int control, void *buf, int len)
 
static int fw_cfg_present (void)
 
static void fw_cfg_select (uint16_t entry)
 
static void fw_cfg_read (void *dst, int dstlen)
 
void fw_cfg_get (uint16_t entry, void *dst, int dstlen)
 
static int fw_cfg_find_file (FWCfgFile *file, const char *name)
 
int fw_cfg_check_file (FWCfgFile *file, const char *name)
 
static int fw_cfg_e820_select (uint32_t *size)
 
static int fw_cfg_e820_read (FwCfgE820Entry *entry, uint32_t *size, uint32_t *pos)
 
uintptr_t fw_cfg_tolud (void)
 
int fw_cfg_max_cpus (void)
 
unsigned long fw_cfg_acpi_tables (unsigned long start)
 
static void fw_cfg_smbios_init (void)
 
static unsigned long smbios_next (unsigned long current)
 
unsigned long fw_cfg_smbios_tables (int *handle, unsigned long *current)
 
const char * smbios_mainboard_manufacturer (void)
 
const char * smbios_mainboard_product_name (void)
 
const char * smbios_mainboard_version (void)
 
const char * smbios_mainboard_serial_number (void)
 
void smbios_system_set_uuid (u8 *uuid)
 

Variables

static int fw_cfg_detected
 
static uint8_t fw_ver
 
struct BiosLinkerLoaderEntry __packed
 
static const char * type1_manufacturer
 
static const char * type1_product_name
 
static const char * type1_version
 
static const char * type1_serial_number
 
static const char * type1_family
 
static u8 type1_uuid [16]
 

Macro Definition Documentation

◆ BIOS_LINKER_LOADER_FILESZ

#define BIOS_LINKER_LOADER_FILESZ   56

Definition at line 163 of file fw_cfg.c.

◆ FW_CFG_DMA_ADDR_HIGH

#define FW_CFG_DMA_ADDR_HIGH   0x0514

Definition at line 17 of file fw_cfg.c.

◆ FW_CFG_DMA_ADDR_LOW

#define FW_CFG_DMA_ADDR_LOW   0x0518

Definition at line 18 of file fw_cfg.c.

◆ FW_CFG_PORT_CTL

#define FW_CFG_PORT_CTL   0x0510

Definition at line 15 of file fw_cfg.c.

◆ FW_CFG_PORT_DATA

#define FW_CFG_PORT_DATA   0x0511

Definition at line 16 of file fw_cfg.c.

Typedef Documentation

◆ BiosLinkerLoaderEntry

Definition at line 131 of file fw_cfg.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BIOS_LINKER_LOADER_COMMAND_ALLOCATE 
BIOS_LINKER_LOADER_COMMAND_ADD_POINTER 
BIOS_LINKER_LOADER_COMMAND_ADD_CHECKSUM 

Definition at line 215 of file fw_cfg.c.

◆ anonymous enum

anonymous enum
Enumerator
BIOS_LINKER_LOADER_ALLOC_ZONE_HIGH 
BIOS_LINKER_LOADER_ALLOC_ZONE_FSEG 

Definition at line 221 of file fw_cfg.c.

Function Documentation

◆ fw_cfg_acpi_tables()

◆ fw_cfg_check_file()

int fw_cfg_check_file ( FWCfgFile file,
const char *  name 
)

Definition at line 85 of file fw_cfg.c.

References fw_cfg_find_file(), fw_cfg_present(), and name.

Referenced by cpu_pci_domain_read_resources(), fw_cfg_acpi_tables(), fw_cfg_smbios_tables(), and get_recovery_mode_switch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fw_cfg_dma()

static void fw_cfg_dma ( int  control,
void buf,
int  len 
)
static

Definition at line 512 of file fw_cfg.c.

References buf, dma, FW_CFG_DMA_ADDR_HIGH, FW_CFG_DMA_ADDR_LOW, FW_CFG_DMA_CTL_ERROR, and outl().

Referenced by fw_cfg_read().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fw_cfg_e820_read()

static int fw_cfg_e820_read ( FwCfgE820Entry entry,
uint32_t size,
uint32_t pos 
)
static

Definition at line 103 of file fw_cfg.c.

References fw_cfg_read().

Referenced by fw_cfg_tolud().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fw_cfg_e820_select()

static int fw_cfg_e820_select ( uint32_t size)
static

Definition at line 92 of file fw_cfg.c.

References fw_cfg_find_file(), fw_cfg_present(), and fw_cfg_select().

Referenced by fw_cfg_tolud().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fw_cfg_find_file()

static int fw_cfg_find_file ( FWCfgFile file,
const char *  name 
)
static

Definition at line 64 of file fw_cfg.c.

References BIOS_INFO, count, FW_CFG_FILE_DIR, fw_cfg_read(), fw_cfg_select(), name, printk, and strcmp().

Referenced by fw_cfg_check_file(), and fw_cfg_e820_select().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fw_cfg_get()

void fw_cfg_get ( uint16_t  entry,
void dst,
int  dstlen 
)

Definition at line 58 of file fw_cfg.c.

References fw_cfg_read(), and fw_cfg_select().

Referenced by cpu_pci_domain_read_resources(), fw_cfg_acpi_tables(), fw_cfg_present(), fw_cfg_smbios_init(), fw_cfg_smbios_tables(), and get_recovery_mode_switch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fw_cfg_max_cpus()

int fw_cfg_max_cpus ( void  )

Definition at line 131 of file fw_cfg.c.

◆ fw_cfg_present()

static int fw_cfg_present ( void  )
static

Definition at line 25 of file fw_cfg.c.

References BIOS_INFO, fw_cfg_detected, fw_cfg_get(), FW_CFG_ID, FW_CFG_SIG_SIZE, FW_CFG_SIGNATURE, fw_ver, memcmp(), and printk.

Referenced by fw_cfg_check_file(), and fw_cfg_e820_select().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fw_cfg_read()

static void fw_cfg_read ( void dst,
int  dstlen 
)
static

Definition at line 50 of file fw_cfg.c.

References fw_cfg_dma(), FW_CFG_DMA_CTL_READ, FW_CFG_PORT_DATA, FW_CFG_VERSION_DMA, fw_ver, and insb().

Referenced by fw_cfg_e820_read(), fw_cfg_find_file(), and fw_cfg_get().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fw_cfg_select()

static void fw_cfg_select ( uint16_t  entry)
static

Definition at line 45 of file fw_cfg.c.

References FW_CFG_PORT_CTL, and outw().

Referenced by fw_cfg_e820_select(), fw_cfg_find_file(), and fw_cfg_get().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fw_cfg_smbios_init()

◆ fw_cfg_smbios_tables()

unsigned long fw_cfg_smbios_tables ( int *  handle,
unsigned long *  current 
)

◆ fw_cfg_tolud()

uintptr_t fw_cfg_tolud ( void  )

Definition at line 115 of file fw_cfg.c.

References FwCfgE820Entry::address, fw_cfg_e820_read(), fw_cfg_e820_select(), FwCfgE820Entry::length, and FwCfgE820Entry::type.

Referenced by cbmem_top_chipset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ smbios_mainboard_manufacturer()

const char* smbios_mainboard_manufacturer ( void  )

Definition at line 478 of file fw_cfg.c.

References fw_cfg_smbios_init(), and type1_manufacturer.

Here is the call graph for this function:

◆ smbios_mainboard_product_name()

const char* smbios_mainboard_product_name ( void  )

Definition at line 484 of file fw_cfg.c.

References fw_cfg_smbios_init(), and type1_product_name.

Here is the call graph for this function:

◆ smbios_mainboard_serial_number()

const char* smbios_mainboard_serial_number ( void  )

Definition at line 496 of file fw_cfg.c.

References fw_cfg_smbios_init(), and type1_serial_number.

Here is the call graph for this function:

◆ smbios_mainboard_version()

const char* smbios_mainboard_version ( void  )

Definition at line 490 of file fw_cfg.c.

References fw_cfg_smbios_init(), and type1_version.

Here is the call graph for this function:

◆ smbios_next()

static unsigned long smbios_next ( unsigned long  current)
static

Definition at line 394 of file fw_cfg.c.

References count, header, s, and strlen().

Referenced by fw_cfg_smbios_tables().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ smbios_system_set_uuid()

void smbios_system_set_uuid ( u8 uuid)

Definition at line 502 of file fw_cfg.c.

References fw_cfg_smbios_init(), memcpy(), and type1_uuid.

Here is the call graph for this function:

Variable Documentation

◆ __packed

◆ fw_cfg_detected

int fw_cfg_detected
static

Definition at line 20 of file fw_cfg.c.

Referenced by fw_cfg_present().

◆ fw_ver

◆ type1_family

const char* type1_family
static

Definition at line 348 of file fw_cfg.c.

Referenced by fw_cfg_smbios_init().

◆ type1_manufacturer

const char* type1_manufacturer
static

Definition at line 344 of file fw_cfg.c.

Referenced by fw_cfg_smbios_init(), and smbios_mainboard_manufacturer().

◆ type1_product_name

const char* type1_product_name
static

Definition at line 345 of file fw_cfg.c.

Referenced by fw_cfg_smbios_init(), and smbios_mainboard_product_name().

◆ type1_serial_number

const char* type1_serial_number
static

Definition at line 347 of file fw_cfg.c.

Referenced by fw_cfg_smbios_init(), and smbios_mainboard_serial_number().

◆ type1_uuid

u8 type1_uuid[16]
static

Definition at line 349 of file fw_cfg.c.

Referenced by fw_cfg_smbios_init(), and smbios_system_set_uuid().

◆ type1_version

const char* type1_version
static

Definition at line 346 of file fw_cfg.c.

Referenced by fw_cfg_smbios_init(), and smbios_mainboard_version().