#ifndef BDN_H
#define BDN_H
struct Codec_Info {
u32_t version;
enum codec_location {
e_None = 0,
e_Here = 1,
e_FRU_EEPROM = 2
} loc;
u16_t total_size;
u16_t num_msg_segments;
};
#define MAX_CODEC_SIZE 0x8000
#define CODEC_SEGMENT_SIZE 0x400
#define NUMBER_OF_SEGMENTS (MAX_CODEC_SIZE/CODEC_SEGMENT_SIZE)
struct codec_t {
u8_t data[NUMBER_OF_SEGMENTS][CODEC_SEGMENT_SIZE];
};
typedef u32 bdn_cfg;
#define BDN_CFG_SIZE_MASK 0x0000ffff
#define BDN_CFG_SIZE_OFFSET 0
#define BDN_CFG_STATE_MASK 0x00ff0000
#define BDN_CFG_STATE_OFFSET 16
#define BDN_CFG_STATE_ACTIVE 0x00010000
#define BDN_CFG_STATE_PENDING 0x00020000
struct bdn_fcoe_boot_target {
u16 wwpn;
u16 lUNID;
};
#if 0
#define MAX_FCOE_IBOOT_PORT_ID 8
#define MAX_IBOOT_TARGETS 8
struct bdn_fcoe_boot_next_dlr {
bdn_cfg hdr;
u16 fcoe_boot_enable;
u16 fcoe_cvid;
u16 fcoe_wwnn;
u16 n_port_id[MAX_FCOE_IBOOT_PORT_ID];
struct fcoe_boot_target targets[MAX_IBOOT_TARGETS];
};
struct bdn_fcoe_boot {
fcoe_iboot_next_dlr next_dlr;
};
#endif
struct bdn_netport_now {
bdn_cfg hdr;
u8 enable_port;
u8 rsrv;
u8 num_pfs_min_bw;
u8 num_pfs_max_bw;
u8 min_bw[E2_FUNC_MAX];
u8 max_bw[E2_FUNC_MAX];
};
struct bdn_netport_on_port_reset {
bdn_cfg hdr;
u32 link_config;
#define BDN_LINK_CONFIG_ADVERTISED_SPEED_MASK 0x0000ffff
#define BDN_LINK_CONFIG_ADVERTISED_SPEED_SHIFT 0
#define BDN_LINK_CONFIG_FLOW_CONTROL_MASK 0x00070000
#define BDN_LINK_CONFIG_FLOW_CONTROL_SHIFT 16
#define BDN_LINK_CONFIG_PFC_ENABLED_MASK 0x00080000
#define BDN_LINK_CONFIG_PFC_ENABLED_SHIFT 19
#define BDN_LINK_CONFIG_EEE_ENABLED_MASK 0x00100000
#define BDN_LINK_CONFIG_EEE_ENABLED_SHIFT 20
};
struct bdn_netport_next_os_boot {
bdn_cfg hdr;
u8 num_pfs;
u8 num_vf_per_pf[E2_FUNC_MAX];
};
struct bdn_netport {
struct bdn_netport_now now;
struct bdn_netport_on_port_reset on_port_reset;
struct bdn_netport_next_os_boot next_os_boot;
};
#define CONNECTION_ID_LEN 16
struct bdn_flexfunc_now {
bdn_cfg hdr;
u8 connection_id[CONNECTION_ID_LEN];
u8 fnic_enabled;
u8 rsrv[3];
};
struct bdn_flexfunc_next_os_boot {
bdn_cfg hdr;
u8 mac_addr[6];
u8 func_type;
u8 boot_mode;
};
struct bdn_flex_func {
struct bdn_flexfunc_now now;
struct bdn_flexfunc_next_os_boot next_os_boot;
};
#ifndef PF_NUM_MAX
#define PF_NUM_MAX 8
#endif
struct bdn {
u32 size;
u32 uuid;
struct Codec_Info codec_info;
struct codec_t codec;
struct bdn_netport netport[PORT_MAX * NVM_PATH_MAX];
struct bdn_flex_func flexfunc[PF_NUM_MAX];
u32 crc;
};
union bdn_image {
struct bdn bdn;
u8_t rsrv[0x9000];
};
#define BDN_SIZE (sizeof(struct bdn))
#define BDN_CODEC_INFO() (ASN1_P->bdn_addr + OFFSETOF(struct bdn, codec_info))
#define BDN_CODEC_DATA() (ASN1_P->bdn_addr + OFFSETOF(struct bdn, codec))
#define BDN_NETPORT_NOW(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, netport[(papo.path << 1) + papo.port].now))
#define BDN_NETPORT_ON_PORT_RESET(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, netport[(papo.path << 1) + papo.port].on_port_reset))
#define BDN_NETPORT_NEXT_OS_BOOT(papo) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, netport[(papo.path << 1) + papo.port].next_os_boot))
#define BDN_FLEXFUNC_NOW(pf_num) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, flexfunc[pf_num].now))
#define BDN_FLEXFUNC_NEXT_OS_BOOT(pf_num) (ASN1_P->bdn_addr + OFFSETOF(struct bdn, flexfunc[pf_num].next_os_boot))
#define BDN_CRC() (ASN1_P->bdn_addr + sizeof(union bdn_image))
int bd_populate_os_reset_config(void);
int bd_populate_port_reset_config(int path, int port);
#endif