coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
helpers.c File Reference
#include <console/console.h>
#include <inttypes.h>
#include <baseboard/variants.h>
#include <ec/google/chromeec/ec.h>
Include dependency graph for helpers.c:

Go to the source code of this file.

Enumerations

enum  {
  FW_CONFIG_MASK_DB_INDEX = 0xf , FW_CONFIG_DB_INDEX_SHIFT = 0 , FW_CONFIG_MASK_MB_USB_INDEX = 0xf , FW_CONFIG_MB_USB_INDEX_SHIFT = 4 ,
  FW_CONFIG_MASK_LID_ACCEL = 0x7 , FW_CONFIG_LID_ACCEL_SHIFT = 8 , FW_CONFIG_MASK_BASE_GYRO = 0x7 , FW_CONFIG_BASE_GYRO_SHIFT = 11 ,
  FW_CONFIG_MASK_KEYB_BL = 0x1 , FW_CONFIG_KEYB_BL_SHIFT = 14 , FW_CONFIG_MASK_LID_ANGLE_TABLET_MODE = 0x1 , FW_CONFIG_LID_ANGLE_TABLET_MODE_SHIFT = 15 ,
  FW_CONFIG_MASK_STYLUS = 0x1 , FW_CONFIG_STYLUS_SHIFT = 16 , FW_CONFIG_MASK_FP = 0x1 , FW_CONFIG_SHIFT_FP = 17 ,
  FW_CONFIG_MASK_NVME = 0x1 , FW_CONFIG_SHIFT_NVME = 18 , FW_CONFIG_MASK_EMMC = 0x1 , FW_CONFIG_SHIFT_EMMC = 19 ,
  FW_CONFIG_MASK_SD_CTRLR = 0x7 , FW_CONFIG_SHIFT_SD_CTRLR = 20 , FW_CONFIG_MASK_SAR = 0x7 , FW_CONFIG_SHIFT_SAR = 23 ,
  FW_CONFIG_MASK_MB_TYPE = 0x1 , FW_CONFIG_SHIFT_MB_TYPE = 26 , FW_CONFIG_MASK_FAN = 0x3 , FW_CONFIG_SHIFT_FAN = 27 ,
  FW_CONFIG_MASK_WWAN = 0x1 , FW_CONFIG_SHIFT_WWAN = 29 , FW_CONFIG_MASK_AUDIO_AMP = 0x1 , FW_CONFIG_SHIFT_AUDIO_AMP = 35 ,
  FW_CONFIG_MASK_AUDIO_CODEC_SOURCE = 0x3 , FW_CONFIG_SHIFT_AUDIO_CODEC_SOURCE = 36
}
 

Functions

static int get_fw_config (uint64_t *val)
 
static unsigned int extract_field (uint64_t mask, int shift)
 
int variant_gets_sar_config (void)
 
int variant_gets_mb_type_config (void)
 
int variant_has_emmc (void)
 
int variant_has_nvme (void)
 
int variant_has_wwan (void)
 
int variant_is_convertible (void)
 
bool variant_uses_v3_schematics (void)
 
bool variant_uses_v3_6_schematics (void)
 
bool variant_uses_codec_gpi (void)
 
bool variant_has_active_low_wifi_power (void)
 
int variant_get_daughterboard_id (void)
 
bool variant_has_fingerprint (void)
 
bool fpmcu_needs_delay (void)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FW_CONFIG_MASK_DB_INDEX 
FW_CONFIG_DB_INDEX_SHIFT 
FW_CONFIG_MASK_MB_USB_INDEX 
FW_CONFIG_MB_USB_INDEX_SHIFT 
FW_CONFIG_MASK_LID_ACCEL 
FW_CONFIG_LID_ACCEL_SHIFT 
FW_CONFIG_MASK_BASE_GYRO 
FW_CONFIG_BASE_GYRO_SHIFT 
FW_CONFIG_MASK_KEYB_BL 
FW_CONFIG_KEYB_BL_SHIFT 
FW_CONFIG_MASK_LID_ANGLE_TABLET_MODE 
FW_CONFIG_LID_ANGLE_TABLET_MODE_SHIFT 
FW_CONFIG_MASK_STYLUS 
FW_CONFIG_STYLUS_SHIFT 
FW_CONFIG_MASK_FP 
FW_CONFIG_SHIFT_FP 
FW_CONFIG_MASK_NVME 
FW_CONFIG_SHIFT_NVME 
FW_CONFIG_MASK_EMMC 
FW_CONFIG_SHIFT_EMMC 
FW_CONFIG_MASK_SD_CTRLR 
FW_CONFIG_SHIFT_SD_CTRLR 
FW_CONFIG_MASK_SAR 
FW_CONFIG_SHIFT_SAR 
FW_CONFIG_MASK_MB_TYPE 
FW_CONFIG_SHIFT_MB_TYPE 
FW_CONFIG_MASK_FAN 
FW_CONFIG_SHIFT_FAN 
FW_CONFIG_MASK_WWAN 
FW_CONFIG_SHIFT_WWAN 
FW_CONFIG_MASK_AUDIO_AMP 
FW_CONFIG_SHIFT_AUDIO_AMP 
FW_CONFIG_MASK_AUDIO_CODEC_SOURCE 
FW_CONFIG_SHIFT_AUDIO_CODEC_SOURCE 

Definition at line 9 of file helpers.c.

Function Documentation

◆ extract_field()

static unsigned int extract_field ( uint64_t  mask,
int  shift 
)
static

Definition at line 82 of file helpers.c.

References get_fw_config(), and mask.

Referenced by variant_get_daughterboard_id(), variant_gets_mb_type_config(), variant_gets_sar_config(), variant_has_emmc(), variant_has_nvme(), variant_has_wwan(), and variant_is_convertible().

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

◆ fpmcu_needs_delay()

bool fpmcu_needs_delay ( void  )

Definition at line 194 of file helpers.c.

References google_chromeec_cbi_get_board_version().

Referenced by finalize_gpios().

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

◆ get_fw_config()

static int get_fw_config ( uint64_t val)
static

Definition at line 63 of file helpers.c.

References BIOS_ERR, google_chromeec_cbi_get_fw_config(), printk, and val.

Referenced by extract_field().

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

◆ variant_get_daughterboard_id()

int variant_get_daughterboard_id ( void  )

Definition at line 181 of file helpers.c.

References extract_field(), FW_CONFIG_DB_INDEX_SHIFT, and FW_CONFIG_MASK_DB_INDEX.

Referenced by variant_get_dxio_ddi_descriptors().

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

◆ variant_gets_mb_type_config()

int variant_gets_mb_type_config ( void  )

Definition at line 98 of file helpers.c.

References extract_field(), FW_CONFIG_MASK_MB_TYPE, and FW_CONFIG_SHIFT_MB_TYPE.

Referenced by variant_updm_update().

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

◆ variant_gets_sar_config()

int variant_gets_sar_config ( void  )

Definition at line 93 of file helpers.c.

References extract_field(), FW_CONFIG_MASK_SAR, and FW_CONFIG_SHIFT_SAR.

Referenced by get_wifi_sar_cbfs_filename().

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

◆ variant_has_active_low_wifi_power()

bool variant_has_active_low_wifi_power ( void  )

Definition at line 165 of file helpers.c.

References CONFIG, and google_chromeec_cbi_get_board_version().

Referenced by wifi_power_reset_configure_v3().

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

◆ variant_has_emmc()

int variant_has_emmc ( void  )

Definition at line 103 of file helpers.c.

References extract_field(), FW_CONFIG_MASK_EMMC, and FW_CONFIG_SHIFT_EMMC.

Referenced by variant_devtree_update().

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

◆ variant_has_fingerprint()

bool variant_has_fingerprint ( void  )

Definition at line 186 of file helpers.c.

References CONFIG.

Referenced by finalize_gpios().

Here is the caller graph for this function:

◆ variant_has_nvme()

int variant_has_nvme ( void  )

Definition at line 108 of file helpers.c.

References extract_field(), FW_CONFIG_MASK_NVME, and FW_CONFIG_SHIFT_NVME.

Here is the call graph for this function:

◆ variant_has_wwan()

int variant_has_wwan ( void  )

Definition at line 113 of file helpers.c.

References extract_field(), FW_CONFIG_MASK_WWAN, and FW_CONFIG_SHIFT_WWAN.

Referenced by variant_devtree_update().

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

◆ variant_is_convertible()

int variant_is_convertible ( void  )

Definition at line 118 of file helpers.c.

References extract_field(), FW_CONFIG_LID_ANGLE_TABLET_MODE_SHIFT, and FW_CONFIG_MASK_LID_ANGLE_TABLET_MODE.

Referenced by variant_devtree_update().

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

◆ variant_uses_codec_gpi()

bool variant_uses_codec_gpi ( void  )

Definition at line 160 of file helpers.c.

References variant_uses_v3_6_schematics().

Referenced by update_hp_int_odl().

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

◆ variant_uses_v3_6_schematics()

bool variant_uses_v3_6_schematics ( void  )

Definition at line 140 of file helpers.c.

References CONFIG, and google_chromeec_cbi_get_board_version().

Referenced by variant_touchscreen_update(), and variant_uses_codec_gpi().

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

◆ variant_uses_v3_schematics()

bool variant_uses_v3_schematics ( void  )

Definition at line 124 of file helpers.c.

References CONFIG, and google_chromeec_cbi_get_board_version().

Referenced by update_dmic_gpio(), variant_bluetooth_update(), and variant_pcie_gpio_configure().

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