iPXE
Data Structures | Defines | Functions | Variables
mlx_nvconfig_defaults.c File Reference
#include "../../mlx_lib/mlx_nvconfig/mlx_nvconfig.h"
#include "../../include/public/mlx_memory.h"
#include "../../include/public/mlx_bail.h"
#include "../../mlx_lib/mlx_nvconfig/mlx_nvconfig_defaults.h"

Go to the source code of this file.

Data Structures

struct  tlv_default

Defines

#define TlvDefaultEntry(_tlv_type, _data_size, _set_defaults)

Functions

 FILE_LICENCE (GPL2_OR_LATER)
static mlx_status nvconfig_get_boot_default_conf (IN void *data, IN int status, OUT void *def_struct)
static mlx_status nvconfig_get_boot_ext_default_conf (IN void *data, IN int status, OUT void *def_struct)
static mlx_status nvconfig_get_iscsi_init_dhcp_default_conf (IN void *data, IN int status, OUT void *def_struct)
static mlx_status nvconfig_get_ib_boot_default_conf (IN void *data, IN int status, OUT void *def_struct)
static mlx_status nvconfig_get_wol_default_conf (IN void *data, IN int status, OUT void *def_struct)
static mlx_status nvconfig_get_iscsi_gen_default_conf (IN void *data, IN int status, OUT void *def_struct)
static mlx_status nvconfig_get_ib_dhcp_default_conf (IN void *data, IN int status, OUT void *def_struct)
static mlx_status nvconfig_get_ocsd_ocbb_default_conf (IN void *data, IN int status, OUT void *def_struct)
static mlx_status nvconfig_get_vpi_link_default_conf (IN void *data, IN int status, OUT void *def_struct)
static mlx_status nvconfig_get_rom_banner_to_default_conf (IN void *data, IN int status, OUT void *def_struct)
static mlx_status nvconfig_get_nv_virt_caps_default_conf (IN void *data, IN int status, OUT void *def_struct)
static mlx_status nvconfig_get_nv_virt_default_conf (IN void *data, IN int status, OUT void *def_struct)
static mlx_status nvconfig_get_rom_cap_default_conf (IN void *data, IN int status, OUT void *def_struct)
static mlx_status nvconfig_nvdata_default_access (IN mlx_utils *utils, IN mlx_uint8 port, IN mlx_uint16 tlv_type, IN mlx_size data_size, OUT mlx_void *data)
static mlx_status nvconfig_nvdata_read_default_value (IN mlx_utils *utils, IN mlx_uint8 modifier, IN struct tlv_default *def, OUT void *def_struct)
static void nvconfig_nvdata_read_default_values (IN mlx_utils *utils, IN mlx_uint8 modifier, IN struct tlv_default defaults_table[], IN mlx_uint8 defaults_table_size, OUT void *def_strct)
mlx_status nvconfig_read_port_default_values (IN mlx_utils *utils, IN mlx_uint8 port, OUT struct mlx_nvconfig_port_conf_defaults *port_conf_def)
mlx_status nvconfig_read_general_default_values (IN mlx_utils *utils, OUT struct mlx_nvconfig_conf_defaults *conf_def)
mlx_status nvconfig_read_rom_ini_values (IN mlx_utils *utils, OUT struct mlx_nvcofnig_romini *rom_ini)

Variables

static struct tlv_default tlv_port_defaults []
static struct tlv_default tlv_general_defaults []

Define Documentation

#define TlvDefaultEntry (   _tlv_type,
  _data_size,
  _set_defaults 
)
Value:
{ \
  .tlv_type = _tlv_type,                     \
  .data_size = sizeof ( _data_size ),                   \
  .set_defaults = _set_defaults,                  \
  }

Definition at line 34 of file mlx_nvconfig_defaults.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER  )
static mlx_status nvconfig_get_boot_default_conf ( IN void *  data,
IN int  status,
OUT void *  def_struct 
) [static]
static mlx_status nvconfig_get_boot_ext_default_conf ( IN void *  data,
IN int  status,
OUT void *  def_struct 
) [static]
static mlx_status nvconfig_get_iscsi_init_dhcp_default_conf ( IN void *  data,
IN int  status,
OUT void *  def_struct 
) [static]
static mlx_status nvconfig_get_ib_boot_default_conf ( IN void *  data,
IN int  status,
OUT void *  def_struct 
) [static]

Definition at line 128 of file mlx_nvconfig_defaults.c.

References mlx_nvconfig_port_conf_defaults::boot_pkey, mlx_nvconfig_nic_ib_boot_conf::boot_pkey, MLX_CHECK_STATUS, NULL, and status.

{
        union mlx_nvconfig_nic_ib_boot_conf *ib_boot_conf =
                        (union mlx_nvconfig_nic_ib_boot_conf *) data;
        struct mlx_nvconfig_port_conf_defaults *port_conf_def =
                        (struct mlx_nvconfig_port_conf_defaults *) def_struct;

        MLX_CHECK_STATUS(NULL, status, nvdata_access_err,
                        "nvconfig_nvdata_default_access failed ");
        port_conf_def->boot_pkey = ib_boot_conf->boot_pkey;

nvdata_access_err:
        return status;
}
static mlx_status nvconfig_get_wol_default_conf ( IN void *  data,
IN int  status,
OUT void *  def_struct 
) [static]

Definition at line 149 of file mlx_nvconfig_defaults.c.

References mlx_nvconfig_port_conf_defaults::en_wol_magic, mlx_nvconfig_wol_conf::en_wol_magic, MLX_CHECK_STATUS, NULL, and status.

{
        union mlx_nvconfig_wol_conf *wol_conf = (union mlx_nvconfig_wol_conf *) data;
        struct mlx_nvconfig_port_conf_defaults *port_conf_def =
                        (struct mlx_nvconfig_port_conf_defaults *) def_struct;

        MLX_CHECK_STATUS(NULL, status, nvdata_access_err,
                        "nvconfig_nvdata_default_access failed ");
        port_conf_def->en_wol_magic = wol_conf->en_wol_magic;

nvdata_access_err:
        return status;
}
static mlx_status nvconfig_get_iscsi_gen_default_conf ( IN void *  data,
IN int  status,
OUT void *  def_struct 
) [static]

Definition at line 169 of file mlx_nvconfig_defaults.c.

References mlx_nvconfig_iscsi_general::boot_to_target, mlx_nvconfig_iscsi_general::chap_auth_en, mlx_nvconfig_iscsi_general::chap_mutual_auth_en, DEFAULT_ISCSI_DRIVE_NUM, mlx_nvconfig_iscsi_general::drive_num, mlx_nvconfig_port_conf_defaults::iscsi_boot_to_target, mlx_nvconfig_port_conf_defaults::iscsi_chap_auth_en, mlx_nvconfig_port_conf_defaults::iscsi_chap_mutual_auth_en, mlx_nvconfig_port_conf_defaults::iscsi_drive_num, mlx_nvconfig_port_conf_defaults::iscsi_link_up_delay_time, mlx_nvconfig_port_conf_defaults::iscsi_lun_busy_retry_count, mlx_nvconfig_port_conf_defaults::iscsi_tcp_timestamps_en, mlx_nvconfig_port_conf_defaults::iscsi_vlan_en, mlx_nvconfig_iscsi_general::link_up_delay_time, mlx_nvconfig_iscsi_general::lun_busy_retry_count, MLX_CHECK_STATUS, MLX_SUCCESS, NULL, status, mlx_nvconfig_iscsi_general::tcp_timestamps_en, and mlx_nvconfig_iscsi_general::vlan_en.

{
        union mlx_nvconfig_iscsi_general *iscsi_gen =
                        (union mlx_nvconfig_iscsi_general *) data;
        struct mlx_nvconfig_port_conf_defaults *port_conf_def =
                        (struct mlx_nvconfig_port_conf_defaults *) def_struct;

        MLX_CHECK_STATUS(NULL, status, nvdata_access_err,
                        "nvconfig_nvdata_default_access failed ");
        port_conf_def->iscsi_boot_to_target = iscsi_gen->boot_to_target;
        port_conf_def->iscsi_vlan_en = iscsi_gen->vlan_en;
        port_conf_def->iscsi_tcp_timestamps_en = iscsi_gen->tcp_timestamps_en;
        port_conf_def->iscsi_chap_mutual_auth_en = iscsi_gen->chap_mutual_auth_en;
        port_conf_def->iscsi_chap_auth_en = iscsi_gen->chap_auth_en;
        port_conf_def->iscsi_lun_busy_retry_count = iscsi_gen->lun_busy_retry_count;
        port_conf_def->iscsi_link_up_delay_time = iscsi_gen->link_up_delay_time;
        port_conf_def->iscsi_drive_num = iscsi_gen->drive_num;

        return MLX_SUCCESS;

nvdata_access_err:
        port_conf_def->iscsi_drive_num = DEFAULT_ISCSI_DRIVE_NUM;
        return status;
}
static mlx_status nvconfig_get_ib_dhcp_default_conf ( IN void *  data,
IN int  status,
OUT void *  def_struct 
) [static]

Definition at line 199 of file mlx_nvconfig_defaults.c.

References mlx_nvconfig_port_conf_defaults::client_identifier, mlx_nvconfig_ib_dhcp_conf::client_identifier, mlx_nvconfig_port_conf_defaults::mac_admin_bit, mlx_nvconfig_ib_dhcp_conf::mac_admin_bit, MLX_CHECK_STATUS, NULL, and status.

{
        union mlx_nvconfig_ib_dhcp_conf *ib_dhcp =
                        (union mlx_nvconfig_ib_dhcp_conf *) data;
        struct mlx_nvconfig_port_conf_defaults *port_conf_def =
                        (struct mlx_nvconfig_port_conf_defaults *) def_struct;

        MLX_CHECK_STATUS(NULL, status, nvdata_access_err,
                        "nvconfig_nvdata_default_access failed ");
        port_conf_def->client_identifier = ib_dhcp->client_identifier;
        port_conf_def->mac_admin_bit = ib_dhcp->mac_admin_bit;

nvdata_access_err:
        return status;
}
static mlx_status nvconfig_get_ocsd_ocbb_default_conf ( IN void *  data,
IN int  status,
OUT void *  def_struct 
) [static]

Definition at line 221 of file mlx_nvconfig_defaults.c.

References DEFAULT_OCSD_OCBB_EN, MLX_CHECK_STATUS, MLX_SUCCESS, NULL, mlx_nvconfig_conf_defaults::ocsd_ocbb_en, mlx_nvconfig_ocsd_ocbb_conf::ocsd_ocbb_en, and status.

                                                     {
        union mlx_nvconfig_ocsd_ocbb_conf *ocsd_ocbb =
                        (union mlx_nvconfig_ocsd_ocbb_conf *) data;
        struct mlx_nvconfig_conf_defaults *conf_def =
                        (struct mlx_nvconfig_conf_defaults *) def_struct;

        MLX_CHECK_STATUS(NULL, status, nvdata_access_err,
                        "TLV not found. Using hard-coded defaults ");
        conf_def->ocsd_ocbb_en = ocsd_ocbb->ocsd_ocbb_en;

        return MLX_SUCCESS;

nvdata_access_err:
        conf_def->ocsd_ocbb_en = DEFAULT_OCSD_OCBB_EN;

        return status;
}
static mlx_status nvconfig_get_vpi_link_default_conf ( IN void *  data,
IN int  status,
OUT void *  def_struct 
) [static]
static mlx_status nvconfig_get_rom_banner_to_default_conf ( IN void *  data,
IN int  status,
OUT void *  def_struct 
) [static]

Definition at line 264 of file mlx_nvconfig_defaults.c.

References DEFAULT_FLEXBOOT_MENU_TO, mlx_nvconfig_conf_defaults::flexboot_menu_to, MLX_CHECK_STATUS, MLX_SUCCESS, NULL, mlx_nvconfig_rom_banner_timeout_conf::rom_banner_to, and status.

{
        union mlx_nvconfig_rom_banner_timeout_conf *rom_banner_timeout_conf =
                        (union mlx_nvconfig_rom_banner_timeout_conf *) data;
        struct mlx_nvconfig_conf_defaults *conf_def =
                        (struct mlx_nvconfig_conf_defaults *) def_struct;

        MLX_CHECK_STATUS(NULL, status, nvdata_access_err,
                        "TLV not found. Using hard-coded defaults ");
        conf_def->flexboot_menu_to = rom_banner_timeout_conf->rom_banner_to;

        return MLX_SUCCESS;

nvdata_access_err:
        conf_def->flexboot_menu_to = DEFAULT_FLEXBOOT_MENU_TO;

        return status;
}
static mlx_status nvconfig_get_nv_virt_caps_default_conf ( IN void *  data,
IN int  status,
OUT void *  def_struct 
) [static]

Definition at line 289 of file mlx_nvconfig_defaults.c.

References DEFAULT_MAX_VFS, mlx_nvconfig_conf_defaults::max_vfs, mlx_nvconfig_virt_caps::max_vfs_per_pf, MLX_CHECK_STATUS, MLX_SUCCESS, NULL, and status.

{
        union mlx_nvconfig_virt_caps *nv_virt_caps =
                        (union mlx_nvconfig_virt_caps *) data;
        struct mlx_nvconfig_conf_defaults *conf_def =
                        (struct mlx_nvconfig_conf_defaults *) def_struct;

        MLX_CHECK_STATUS(NULL, status, nvdata_access_err,
                        "TLV not found. Using hard-coded defaults ");
        conf_def->max_vfs = nv_virt_caps->max_vfs_per_pf;

        return MLX_SUCCESS;

nvdata_access_err:
        conf_def->max_vfs = DEFAULT_MAX_VFS;

        return status;
}
static mlx_status nvconfig_get_nv_virt_default_conf ( IN void *  data,
IN int  status,
OUT void *  def_struct 
) [static]

Definition at line 314 of file mlx_nvconfig_defaults.c.

References MLX_CHECK_STATUS, NULL, mlx_nvconfig_virt_conf::num_of_vfs, mlx_nvconfig_conf_defaults::sriov_en, status, mlx_nvconfig_conf_defaults::total_vfs, and mlx_nvconfig_virt_conf::virt_mode.

{
        union mlx_nvconfig_virt_conf *nv_virt_conf =
                        (union mlx_nvconfig_virt_conf *) data;
        struct mlx_nvconfig_conf_defaults *conf_def =
                        (struct mlx_nvconfig_conf_defaults *) def_struct;

        MLX_CHECK_STATUS(NULL, status, nvdata_access_err,
                        "nvconfig_nvdata_default_access failed ");
        conf_def->total_vfs = nv_virt_conf->num_of_vfs;
        conf_def->sriov_en = nv_virt_conf->virt_mode;

nvdata_access_err:
        return status;
}
static mlx_status nvconfig_get_rom_cap_default_conf ( IN void *  data,
IN int  status,
OUT void *  def_struct 
) [static]

Definition at line 336 of file mlx_nvconfig_defaults.c.

References mlx_nvconfig_conf_defaults::boot_ip_ver_en, mlx_nvconfig_rom_cap_conf::boot_ip_ver_en, DEFAULT_BOOT_IP_VERSION_EN, MLX_CHECK_STATUS, MLX_SUCCESS, NULL, and status.

                                                     {
        union mlx_nvconfig_rom_cap_conf *rom_cap_conf =
                        (union mlx_nvconfig_rom_cap_conf *) data;
        struct mlx_nvconfig_conf_defaults *conf_def =
                        (struct mlx_nvconfig_conf_defaults *) def_struct;

        MLX_CHECK_STATUS(NULL, status, nvdata_access_err,
                        "TLV not found. Using hard-coded defaults ");
        conf_def->boot_ip_ver_en = rom_cap_conf->boot_ip_ver_en;

        return MLX_SUCCESS;

nvdata_access_err:
        rom_cap_conf->boot_ip_ver_en = DEFAULT_BOOT_IP_VERSION_EN;

        return status;
}
static mlx_status nvconfig_nvdata_default_access ( IN mlx_utils utils,
IN mlx_uint8  port,
IN mlx_uint16  tlv_type,
IN mlx_size  data_size,
OUT mlx_void data 
) [static]

Definition at line 376 of file mlx_nvconfig_defaults.c.

References tlv_default::data_size, index, MLX_CHECK_STATUS, mlx_memory_be32_to_cpu(), MLX_SUCCESS, NULL, nvconfig_nvdata_access(), status, TLV_ACCESS_DEFAULT_EN, and version.

Referenced by nvconfig_nvdata_read_default_value().

{
        mlx_status status = MLX_SUCCESS;
        mlx_uint32 index;
        mlx_uint8 version = 0;

        status = nvconfig_nvdata_access(utils, port, tlv_type, REG_ACCESS_READ,
                        data_size, TLV_ACCESS_DEFAULT_EN, 0,
                        &version, data);
        MLX_CHECK_STATUS(NULL, status, nvdata_access_err,
                                "nvconfig_nvdata_access failed ");
        for (index = 0; index * 4 < data_size; index++) {
                mlx_memory_be32_to_cpu(utils, (((mlx_uint32 *) data)[index]),
                                ((mlx_uint32 *) data) + index);
        }

nvdata_access_err:
        return status;
}
static mlx_status nvconfig_nvdata_read_default_value ( IN mlx_utils utils,
IN mlx_uint8  modifier,
IN struct tlv_default def,
OUT void *  def_struct 
) [static]

Definition at line 404 of file mlx_nvconfig_defaults.c.

References data, MLX_CHECK_STATUS, mlx_memory_free(), mlx_memory_zalloc(), MLX_SUCCESS, NULL, nvconfig_nvdata_default_access(), and status.

Referenced by nvconfig_nvdata_read_default_values().

{
        mlx_status status = MLX_SUCCESS;
        void *data = NULL;

        status = mlx_memory_zalloc(utils, def->data_size,&data);
        MLX_CHECK_STATUS(utils, status, memory_err,
                                "mlx_memory_zalloc failed ");
        status = nvconfig_nvdata_default_access(utils, modifier, def->tlv_type,
                        def->data_size, data);
        def->set_defaults(data, status, def_struct);
        mlx_memory_free(utils, &data);

memory_err:
        return status;
}
static void nvconfig_nvdata_read_default_values ( IN mlx_utils utils,
IN mlx_uint8  modifier,
IN struct tlv_default  defaults_table[],
IN mlx_uint8  defaults_table_size,
OUT void *  def_strct 
) [static]

Definition at line 428 of file mlx_nvconfig_defaults.c.

References nvconfig_nvdata_read_default_value().

Referenced by nvconfig_read_general_default_values(), and nvconfig_read_port_default_values().

{
        struct tlv_default *defs;
        unsigned int i;

        for (i = 0; i < defaults_table_size; i++) {
                defs = &defaults_table[i];
                nvconfig_nvdata_read_default_value(utils, modifier, defs, def_strct);
        }
}

Definition at line 446 of file mlx_nvconfig_defaults.c.

References MLX_DEBUG_ERROR, MLX_INVALID_PARAMETER, mlx_memory_set(), MLX_SUCCESS, NULL, nvconfig_nvdata_read_default_values(), and status.

{
        mlx_status status = MLX_SUCCESS;

        if (utils == NULL || port_conf_def == NULL) {
                status = MLX_INVALID_PARAMETER;
                MLX_DEBUG_ERROR(utils,"bad params.");
                goto bad_param;
        }
        mlx_memory_set(utils, port_conf_def, 0, sizeof(*port_conf_def));
        nvconfig_nvdata_read_default_values(utils, port, tlv_port_defaults,
                                (sizeof(tlv_port_defaults)/sizeof(tlv_port_defaults[0])),
                                port_conf_def);

bad_param:
        return status;
}

Definition at line 469 of file mlx_nvconfig_defaults.c.

References MLX_DEBUG_ERROR, MLX_INVALID_PARAMETER, mlx_memory_set(), MLX_SUCCESS, NULL, nvconfig_nvdata_read_default_values(), and status.

{
        mlx_status status = MLX_SUCCESS;

        if (utils == NULL || conf_def == NULL) {
                status = MLX_INVALID_PARAMETER;
                MLX_DEBUG_ERROR(utils,"bad params.");
                goto bad_param;
        }
        mlx_memory_set(utils, conf_def, 0, sizeof(*conf_def));
        nvconfig_nvdata_read_default_values(utils, 0, tlv_general_defaults,
                        (sizeof(tlv_general_defaults)/sizeof(tlv_general_defaults[0])),
                        conf_def);

bad_param:
        return status;
}

Definition at line 491 of file mlx_nvconfig_defaults.c.

References GLOBAL_ROM_INI_TYPE, index, MLX_CHECK_STATUS, MLX_DEBUG_ERROR, MLX_INVALID_PARAMETER, mlx_memory_be32_to_cpu(), mlx_memory_set(), MLX_SUCCESS, NULL, nvconfig_nvdata_access(), status, TLV_ACCESS_DEFAULT_DIS, and version.

{
        mlx_status status = MLX_SUCCESS;
        mlx_uint8 version = 0;
        mlx_uint32 index;

        if (utils == NULL || rom_ini == NULL) {
                status = MLX_INVALID_PARAMETER;
                MLX_DEBUG_ERROR(utils,"bad params.");
                goto bad_param;
        }
        mlx_memory_set(utils, rom_ini, 0, sizeof(*rom_ini));

        status = nvconfig_nvdata_access(utils, 0, GLOBAL_ROM_INI_TYPE, REG_ACCESS_READ,
                        sizeof(*rom_ini), TLV_ACCESS_DEFAULT_DIS, 0,
                        &version, rom_ini);
        MLX_CHECK_STATUS(NULL, status, bad_param,
                                "nvconfig_nvdata_access failed ");
        for (index = 0; index * 4 < sizeof(*rom_ini); index++) {
                mlx_memory_be32_to_cpu(utils, (((mlx_uint32 *) rom_ini)[index]),
                                ((mlx_uint32 *) rom_ini) + index);
        }

bad_param:
        return status;
}

Variable Documentation

struct tlv_default tlv_port_defaults[] [static]
struct tlv_default tlv_general_defaults[] [static]